Socket
Socket
Sign inDemoInstall

@ts-bridge/cli

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ts-bridge/cli - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

dist/project-references.d.ts

11

CHANGELOG.md

@@ -10,2 +10,10 @@ # Changelog

## [0.3.0]
### Added
- Add experimental support for project references ([#30](https://github.com/ts-bridge/ts-bridge/pull/30), [#32](https://github.com/ts-bridge/ts-bridge/pull/32))
- If the specified `tsconfig.json` contains a `references` field, all
referenced projects will be sorted based on their dependencies, and built.
## [0.2.0]

@@ -70,3 +78,4 @@

[Unreleased]: https://github.com/ts-bridge/ts-bridge/compare/@ts-bridge/cli@0.2.0...HEAD
[Unreleased]: https://github.com/ts-bridge/ts-bridge/compare/@ts-bridge/cli@0.3.0...HEAD
[0.3.0]: https://github.com/ts-bridge/ts-bridge/compare/@ts-bridge/cli@0.2.0...@ts-bridge/cli@0.3.0
[0.2.0]: https://github.com/ts-bridge/ts-bridge/compare/@ts-bridge/cli@0.1.4...@ts-bridge/cli@0.2.0

@@ -73,0 +82,0 @@ [0.1.4]: https://github.com/ts-bridge/ts-bridge/compare/@ts-bridge/cli@0.1.3...@ts-bridge/cli@0.1.4

@@ -26,2 +26,3 @@ import type { SourceFile, TransformerFactory, ResolutionMode } from 'typescript';

declarationExtension: string;
sourceExtension: string;
target: ResolutionMode;

@@ -28,0 +29,0 @@ getTransformers: (options: TransformerOptions) => TransformerFactory<SourceFile>[];

@@ -9,2 +9,3 @@ import typescript from 'typescript';

declarationExtension: '.d.mts',
sourceExtension: '.mts',
target: ModuleKind.ESNext,

@@ -28,2 +29,3 @@ getTransformers: (options) => [

declarationExtension: '.d.cts',
sourceExtension: '.cts',
target: ModuleKind.CommonJS,

@@ -30,0 +32,0 @@ getTransformers: (options) => [

@@ -12,2 +12,3 @@ import { describe, expect, it } from 'vitest';

"name": "ES module",
"sourceExtension": ".mts",
"target": 99,

@@ -25,2 +26,3 @@ }

"name": "CommonJS module",
"sourceExtension": ".cts",
"target": 1,

@@ -27,0 +29,0 @@ }

51

dist/build.d.ts

@@ -1,2 +0,2 @@

import type { CompilerHost, CompilerOptions, Program, System } from 'typescript';
import type { CompilerHost, CompilerOptions, ParsedCommandLine, Program, ProjectReference, System } from 'typescript';
import typescript from 'typescript';

@@ -7,2 +7,3 @@ import type { BuildType } from './build-type.js';

compilerOptions: CompilerOptions;
projectReferences?: readonly ProjectReference[];
files: string[];

@@ -19,2 +20,3 @@ oldProgram?: Program;

* @param options.compilerOptions - The compiler options to use.
* @param options.projectReferences - The project references to use.
* @param options.files - The files to include in the program.

@@ -25,3 +27,3 @@ * @param options.oldProgram - The old program to reuse.

*/
export declare function getProgram({ compilerOptions, files, oldProgram, host, }: GetProgramOptions): Program;
export declare function getProgram({ compilerOptions, projectReferences, files, oldProgram, host, }: GetProgramOptions): Program;
/**

@@ -46,3 +48,3 @@ * Get the files to include in the build. This function will return the custom

export type BuildHandlerOptions = {
format: string[];
format: BuildType[];
project: string;

@@ -54,2 +56,3 @@ files?: string[];

verbose?: boolean;
references?: boolean;
};

@@ -62,6 +65,7 @@ /**

export declare function buildHandler(options: BuildHandlerOptions): void;
type BuildNode10Options = {
type BuilderOptions = {
program: Program;
projectReferences?: readonly ProjectReference[];
compilerOptions: CompilerOptions;
format: string[];
format: BuildType[];
files: string[];

@@ -71,2 +75,3 @@ system: System;

baseDirectory: string;
tsConfig: ParsedCommandLine;
verbose?: boolean;

@@ -82,2 +87,3 @@ };

* @param options.program - The TypeScript program to build.
* @param options.projectReferences - The project references to use.
* @param options.compilerOptions - The compiler options to use.

@@ -90,13 +96,36 @@ * @param options.format - The formats to build.

*/
export declare function buildNode10({ program, compilerOptions, format, files, system, host, verbose, }: BuildNode10Options): void;
export declare function buildNode10({ program, projectReferences, compilerOptions, format, files, system, host, verbose, }: BuilderOptions): void;
/**
* Build the project using the Node.js 16 module resolution strategy.
*
* @param program - The TypeScript program to build.
* @param formats - The formats to build.
* @param system - The file system to use.
* @param verbose - Whether to enable verbose logging.
* @param options - The build options.
* @param options.program - The TypeScript program to build.
* @param options.format - The formats to build.
* @param options.system - The file system to use.
* @param options.verbose - Whether to enable verbose logging.
*/
export declare function buildNode16(program: Program, formats: string[], system: System, verbose?: boolean): void;
export declare function buildNode16({ program, format, system, verbose, }: BuilderOptions): void;
/**
* Build the project references. This function will build the project references
* using the specified formats.
*
* @param options - The build options.
* @param options.program - The base TypeScript program to use.
* @param options.format - The formats to build.
* @param options.system - The file system to use.
* @param options.baseDirectory - The base directory of the project.
* @param options.verbose - Whether to enable verbose logging.
*/
export declare function buildProjectReferences({ program, format, system, baseDirectory, verbose, }: BuilderOptions): void;
/**
* Get the build function to use based on the TypeScript configuration. This
* function will return the appropriate build function based on whether project
* references are used and the module resolution strategy.
*
* @param tsConfig - The TypeScript configuration.
* @param useReferences - Whether to include project references in the build.
* @returns The build function to use.
*/
export declare function getBuildFunction(tsConfig: ParsedCommandLine, useReferences?: boolean): (options: BuilderOptions) => void;
/**
* Get the transformers to use for the build. This function will return the

@@ -103,0 +132,0 @@ * transformers to use based on the build type and whether shims are enabled.

@@ -1,2 +0,3 @@

import { dirname, join } from 'path';
import chalk from 'chalk';
import { dirname, join, relative } from 'path';
import typescript from 'typescript';

@@ -8,6 +9,8 @@ import { pathToFileURL } from 'url';

import { getWriteFileFunction, removeDirectory } from './file-system.js';
import { getLoggingTransformer } from './logging.js';
import { getLoggingTransformer, info } from './logging.js';
import { createProjectReferencesCompilerHost, getResolvedProjectReferences, } from './project-references.js';
import { isShimsPackageInstalled } from './shims.js';
import { executeSteps } from './steps.js';
import { getTypeImportExportTransformer, getExportExtensionTransformer, getImportExtensionTransformer, getRequireExtensionTransformer, } from './transformers.js';
import { getDefinedArray } from './utils.js';
const { createProgram, getPreEmitDiagnostics, ModuleResolutionKind } = typescript;

@@ -21,2 +24,3 @@ /**

* @param options.compilerOptions - The compiler options to use.
* @param options.projectReferences - The project references to use.
* @param options.files - The files to include in the program.

@@ -27,6 +31,7 @@ * @param options.oldProgram - The old program to reuse.

*/
export function getProgram({ compilerOptions, files, oldProgram, host, }) {
export function getProgram({ compilerOptions, projectReferences, files, oldProgram, host, }) {
const program = createProgram({
rootNames: files,
options: compilerOptions,
projectReferences,
oldProgram,

@@ -63,3 +68,3 @@ host,

export function buildHandler(options) {
const { format, project, files: customFiles, clean, system, host, verbose, } = options;
const { format, project, files: customFiles, clean, system, host, verbose, references, } = options;
const tsConfig = getTypeScriptConfig(project, system);

@@ -73,22 +78,22 @@ const baseOptions = getBaseCompilerOptions(dirname(project), tsConfig.options);

const compilerOptions = getCompilerOptions(baseOptions);
const program = getProgram({ compilerOptions, files, host });
if (compilerOptions.moduleResolution !== ModuleResolutionKind.Node16 &&
compilerOptions.moduleResolution !== ModuleResolutionKind.NodeNext) {
// If we use a module resolution other than `Node16` (or `NodeNext`), we
// need to create a separate program for each module format. This is
// unfortunately much slower than using the same program for all formats, so
// it's recommended to use `Node16` (or `NodeNext`) if possible.
buildNode10({
program,
compilerOptions,
format,
files,
system,
host,
baseDirectory,
verbose,
});
return;
}
buildNode16(program, format, system);
const program = getProgram({
compilerOptions,
files,
host,
projectReferences: tsConfig.projectReferences,
});
const buildOptions = {
projectReferences: tsConfig.projectReferences,
program,
compilerOptions,
format,
files,
system,
host,
baseDirectory,
tsConfig,
verbose,
};
const buildFunction = getBuildFunction(tsConfig, references);
buildFunction(buildOptions);
}

@@ -103,2 +108,3 @@ /**

* @param options.program - The TypeScript program to build.
* @param options.projectReferences - The project references to use.
* @param options.compilerOptions - The compiler options to use.

@@ -111,3 +117,3 @@ * @param options.format - The formats to build.

*/
export function buildNode10({ program, compilerOptions, format, files, system, host, verbose, }) {
export function buildNode10({ program, projectReferences, compilerOptions, format, files, system, host, verbose, }) {
const buildSteps = [

@@ -122,6 +128,8 @@ {

module: typescript.ModuleKind.ES2022,
// `ModuleResolutionKind.NodeJs` is in TypeScript 5 and later, but
// TypeScript 4 doesn't support `ModuleResolutionKind.Node10`.
// `ModuleResolutionKind.NodeJs` is deprecated in TypeScript 5 and
// later, but TypeScript 4 doesn't support
// `ModuleResolutionKind.Node10`.
moduleResolution: ModuleResolutionKind.NodeJs,
},
projectReferences,
files,

@@ -147,6 +155,8 @@ oldProgram: program,

module: typescript.ModuleKind.CommonJS,
// `ModuleResolutionKind.NodeJs` is in TypeScript 5 and later, but
// TypeScript 4 doesn't support `ModuleResolutionKind.Node10`.
// `ModuleResolutionKind.NodeJs` is deprecated in TypeScript 5 and
// later, but TypeScript 4 doesn't support
// `ModuleResolutionKind.Node10`.
moduleResolution: ModuleResolutionKind.NodeJs,
},
projectReferences,
files,

@@ -170,12 +180,13 @@ oldProgram: program,

*
* @param program - The TypeScript program to build.
* @param formats - The formats to build.
* @param system - The file system to use.
* @param verbose - Whether to enable verbose logging.
* @param options - The build options.
* @param options.program - The TypeScript program to build.
* @param options.format - The formats to build.
* @param options.system - The file system to use.
* @param options.verbose - Whether to enable verbose logging.
*/
export function buildNode16(program, formats, system, verbose) {
export function buildNode16({ program, format, system, verbose, }) {
const buildSteps = [
{
name: 'Building ES module.',
condition: () => formats.includes('module'),
condition: () => format.includes('module'),
task: () => {

@@ -187,3 +198,3 @@ build({ program, type: 'module', system });

name: 'Building CommonJS module.',
condition: () => formats.includes('commonjs'),
condition: () => format.includes('commonjs'),
task: () => {

@@ -197,2 +208,64 @@ build({ program, type: 'commonjs', system });

/**
* Build the project references. This function will build the project references
* using the specified formats.
*
* @param options - The build options.
* @param options.program - The base TypeScript program to use.
* @param options.format - The formats to build.
* @param options.system - The file system to use.
* @param options.baseDirectory - The base directory of the project.
* @param options.verbose - Whether to enable verbose logging.
*/
export function buildProjectReferences({ program, format, system, baseDirectory, verbose, }) {
const resolvedProjectReferences = getDefinedArray(program.getResolvedProjectReferences());
const sortedProjectReferences = getResolvedProjectReferences(baseDirectory, resolvedProjectReferences);
for (const { sourceFile, commandLine, references, } of sortedProjectReferences) {
verbose &&
info(`Building referenced project "${chalk.underline(relative(baseDirectory, sourceFile.fileName))}".`);
const { fileNames, options: childOptions, projectReferences: childProjectReferences, } = commandLine;
const baseChildOptions = getBaseCompilerOptions(dirname(sourceFile.fileName), childOptions);
const compilerOptions = getCompilerOptions(baseChildOptions);
const host = createProjectReferencesCompilerHost(format, compilerOptions, getDefinedArray(references), system);
const childProgram = getProgram({
compilerOptions,
host,
projectReferences: childProjectReferences,
files: fileNames,
oldProgram: program,
});
const buildFunction = getBuildFunction(commandLine);
buildFunction({
host,
program: childProgram,
projectReferences: childProjectReferences,
compilerOptions,
format,
files: fileNames,
system,
baseDirectory: dirname(sourceFile.fileName),
tsConfig: commandLine,
verbose,
});
}
}
/**
* Get the build function to use based on the TypeScript configuration. This
* function will return the appropriate build function based on whether project
* references are used and the module resolution strategy.
*
* @param tsConfig - The TypeScript configuration.
* @param useReferences - Whether to include project references in the build.
* @returns The build function to use.
*/
export function getBuildFunction(tsConfig, useReferences = false) {
if (useReferences && tsConfig.projectReferences) {
return buildProjectReferences;
}
if (tsConfig.options.moduleResolution !== ModuleResolutionKind.Node16 &&
tsConfig.options.moduleResolution !== ModuleResolutionKind.NodeNext) {
return buildNode10;
}
return buildNode16;
}
/**
* Get the transformers to use for the build. This function will return the

@@ -199,0 +272,0 @@ * transformers to use based on the build type and whether shims are enabled.

@@ -30,4 +30,5 @@ import { getFixture, noOp, parseJson } from '@ts-bridge/test-utils';

...sys,
writeFile(path, data) {
writeFile(path, data, writeByteOrderMark) {
files[relative(projectPath, path)] = data;
sys.writeFile(path, data, writeByteOrderMark);
},

@@ -285,2 +286,90 @@ };

});
describe('project references', () => {
describe('node 10', () => {
const log = vi.spyOn(console, 'log').mockImplementation(noOp);
let files;
beforeAll(() => {
files = compile(getFixture('project-references-node-10'), ['commonjs', 'module'], {
references: true,
verbose: true,
});
});
it('builds all projects when using project references', () => {
expect(Object.keys(files)).toStrictEqual([
'packages/project-3/dist/foo.mjs',
'packages/project-3/dist/foo.d.mts.map',
'packages/project-3/dist/foo.d.mts',
'packages/project-3/dist/index.mjs',
'packages/project-3/dist/index.d.mts.map',
'packages/project-3/dist/index.d.mts',
'packages/project-3/tsconfig.tsbuildinfo',
'packages/project-3/dist/foo.cjs',
'packages/project-3/dist/foo.d.cts.map',
'packages/project-3/dist/foo.d.cts',
'packages/project-3/dist/index.cjs',
'packages/project-3/dist/index.d.cts.map',
'packages/project-3/dist/index.d.cts',
'packages/project-1/dist/index.mjs',
'packages/project-1/dist/index.d.mts.map',
'packages/project-1/dist/index.d.mts',
'packages/project-1/tsconfig.tsbuildinfo',
'packages/project-1/dist/index.cjs',
'packages/project-1/dist/index.d.cts.map',
'packages/project-1/dist/index.d.cts',
'packages/project-2/dist/index.mjs',
'packages/project-2/dist/index.d.mts.map',
'packages/project-2/dist/index.d.mts',
'packages/project-2/tsconfig.tsbuildinfo',
'packages/project-2/dist/index.cjs',
'packages/project-2/dist/index.d.cts.map',
'packages/project-2/dist/index.d.cts',
]);
});
it('logs the project references', () => {
expect(log).toHaveBeenCalledWith(expect.stringMatching(/Building referenced project ".*packages\/project-1\/tsconfig\.json.*"\./u));
expect(log).toHaveBeenCalledWith(expect.stringMatching(/Building referenced project ".*packages\/project-2\/tsconfig\.json.*"\./u));
expect(log).toHaveBeenCalledWith(expect.stringMatching(/Building referenced project ".*packages\/project-3\/tsconfig\.json.*"\./u));
});
});
describe('node 16', () => {
let files;
beforeAll(() => {
files = compile(getFixture('project-references-node-16'), ['commonjs', 'module'], {
references: true,
verbose: true,
});
});
it('builds all projects when using project references', () => {
expect(Object.keys(files)).toStrictEqual([
'packages/project-3/dist/foo.mjs',
'packages/project-3/dist/foo.d.mts.map',
'packages/project-3/dist/foo.d.mts',
'packages/project-3/dist/index.mjs',
'packages/project-3/dist/index.d.mts.map',
'packages/project-3/dist/index.d.mts',
'packages/project-3/tsconfig.tsbuildinfo',
'packages/project-3/dist/foo.cjs',
'packages/project-3/dist/foo.d.cts.map',
'packages/project-3/dist/foo.d.cts',
'packages/project-3/dist/index.cjs',
'packages/project-3/dist/index.d.cts.map',
'packages/project-3/dist/index.d.cts',
'packages/project-1/dist/index.mjs',
'packages/project-1/dist/index.d.mts.map',
'packages/project-1/dist/index.d.mts',
'packages/project-1/tsconfig.tsbuildinfo',
'packages/project-1/dist/index.cjs',
'packages/project-1/dist/index.d.cts.map',
'packages/project-1/dist/index.d.cts',
'packages/project-2/dist/index.mjs',
'packages/project-2/dist/index.d.mts.map',
'packages/project-2/dist/index.d.mts',
'packages/project-2/tsconfig.tsbuildinfo',
'packages/project-2/dist/index.cjs',
'packages/project-2/dist/index.d.cts.map',
'packages/project-2/dist/index.d.cts',
]);
});
});
});
it('removes the output directory if `clean` is enabled', () => {

@@ -287,0 +376,0 @@ const path = getFixture('node-16');

@@ -44,12 +44,12 @@ import { resolve } from 'path';

default: false,
}),
// .positional('files', {
// type: 'string',
// description:
// 'The files to build. Defaults to the files in the `tsconfig.json`.',
// array: true,
// demandOption: false,
// }),
(options) => {
})
.option('references', {
// `tsc` uses `--build`.
alias: ['build'],
type: 'boolean',
description: 'Build project references in the project. Enabled by default if `tsconfig.json` contains project references.',
default: true,
}), ({ format, ...options }) => {
return buildHandler({
format: format,
...options,

@@ -56,0 +56,0 @@ system: sys,

@@ -30,2 +30,3 @@ import { noOp } from '@ts-bridge/test-utils';

'--clean',
'--references',
]);

@@ -36,2 +37,3 @@ expect(buildHandler).toHaveBeenCalledWith(expect.objectContaining({

project: resolve(process.cwd(), './tsconfig.json'),
references: true,
}));

@@ -38,0 +40,0 @@ });

@@ -1,2 +0,2 @@

import type { CompilerOptions } from 'typescript';
import type { CompilerOptions, System } from 'typescript';
import typescript from 'typescript';

@@ -13,3 +13,3 @@ export declare const BASE_COMPILER_OPTIONS: CompilerOptions;

*/
export declare function getTypeScriptConfig(path: string, system?: typescript.System): typescript.ParsedCommandLine;
export declare function getTypeScriptConfig(path: string, system?: System): typescript.ParsedCommandLine;
/**

@@ -16,0 +16,0 @@ * Get the base compiler options.

@@ -1,2 +0,2 @@

import { dirname } from 'path';
import { dirname, join } from 'path';
import typescript from 'typescript';

@@ -17,2 +17,21 @@ import { TypeScriptError } from './errors.js';

/**
* Get the TypeScript configuration path. This checks if the TypeScript
* configuration exists at the specified path, and the path + `tsconfig.json`.
* If the file exists at neither path, this throws an error.
*
* @param path - The path to check.
* @param system - The system to use for file operations.
* @returns The TypeScript configuration path.
*/
function getTypeScriptConfigPath(path, system) {
if (system.fileExists(path)) {
return path;
}
const configPath = join(path, 'tsconfig.json');
if (system.fileExists(configPath)) {
return configPath;
}
throw new Error(`The TypeScript configuration file does not exist at "${path}" or "${configPath}".`);
}
/**
* Get the TypeScript configuration.

@@ -27,10 +46,8 @@ *

export function getTypeScriptConfig(path, system = sys) {
if (!system.fileExists(path)) {
throw new Error(`The TypeScript configuration file does not exist: "${path}".`);
}
const { config, error } = readConfigFile(path, system.readFile.bind(system));
const resolvedPath = getTypeScriptConfigPath(path, system);
const { config, error } = readConfigFile(resolvedPath, system.readFile.bind(system));
if (error) {
throw new TypeScriptError('Failed to read the TypeScript configuration.', error);
}
const parsedConfig = parseJsonConfigFileContent(config, system, dirname(path));
const parsedConfig = parseJsonConfigFileContent(config, system, dirname(resolvedPath), undefined, resolvedPath);
if (parsedConfig.errors.length) {

@@ -54,3 +71,3 @@ throw new TypeScriptError('Failed to parse the TypeScript configuration.', parsedConfig.errors);

emitDeclarationOnly: false,
declarationDir: baseOptions.declarationDir ?? fallbackPath,
declarationDir: baseOptions.declarationDir ?? baseOptions.outDir ?? fallbackPath,
outDir: baseOptions.outDir ?? fallbackPath,

@@ -57,0 +74,0 @@ };

@@ -26,3 +26,3 @@ import { getMockTsConfig, getVirtualEnvironment, noOp, } from '@ts-bridge/test-utils';

{
"configFilePath": undefined,
"configFilePath": "/tsconfig.json",
"declaration": true,

@@ -44,4 +44,40 @@ "declarationDir": "/",

});
it('reads the TypeScript configuration from `/tsconfig.json` when specifying `/`', () => {
const { system } = getVirtualEnvironment({
files: {
'/index.ts': '// no-op',
},
tsconfig: getMockTsConfig({
compilerOptions: {
lib: ['ES2022'],
module: 'Node16',
moduleResolution: 'Node16',
outDir: '/foo',
skipLibCheck: true,
strict: true,
target: 'ES2022',
},
}),
});
expect(getTypeScriptConfig('/', system).options).toMatchInlineSnapshot(`
{
"configFilePath": "/tsconfig.json",
"declaration": true,
"declarationDir": "/",
"declarationMap": true,
"esModuleInterop": true,
"lib": [
"lib.es2022.d.ts",
],
"module": 100,
"moduleResolution": 3,
"outDir": "/foo",
"skipLibCheck": true,
"strict": true,
"target": 9,
}
`);
});
it('throws an error if the file does not exist', () => {
expect(() => getTypeScriptConfig('/tsconfig.json')).toThrowError('The TypeScript configuration file does not exist: "/tsconfig.json".');
expect(() => getTypeScriptConfig('/')).toThrowError('The TypeScript configuration file does not exist at "/" or "/tsconfig.json".');
});

@@ -48,0 +84,0 @@ it('throws an error if the file cannot be read', () => {

@@ -16,2 +16,10 @@ /**

export declare function getIdentifierName(value: string): string;
/**
* Get the defined values from an array, removing all `undefined` values. If the
* array itself is `undefined`, an empty array is returned.
*
* @param array - The array to get the defined values from.
* @returns The array with all `undefined` values removed.
*/
export declare function getDefinedArray<Type>(array: readonly (Type | undefined)[] | undefined): Type[];
//# sourceMappingURL=utils.d.ts.map

@@ -24,1 +24,14 @@ /**

}
/**
* Get the defined values from an array, removing all `undefined` values. If the
* array itself is `undefined`, an empty array is returned.
*
* @param array - The array to get the defined values from.
* @returns The array with all `undefined` values removed.
*/
export function getDefinedArray(array) {
if (!array) {
return [];
}
return array.filter((value) => value !== undefined);
}
import { describe, expect, it } from 'vitest';
import { isObject, getIdentifierName } from './utils.js';
import { isObject, getIdentifierName, getDefinedArray } from './utils.js';
describe('isObject', () => {

@@ -53,1 +53,14 @@ it('returns `true` if the value is an object', () => {

});
describe('getDefinedArray', () => {
it('returns the array if it is defined', () => {
expect(getDefinedArray([1, 2, 3])).toStrictEqual([1, 2, 3]);
});
it('removes undefined values from the array', () => {
expect(getDefinedArray([1, undefined, 2, undefined, 3])).toStrictEqual([
1, 2, 3,
]);
});
it('returns an empty array if the array is undefined', () => {
expect(getDefinedArray(undefined)).toStrictEqual([]);
});
});
{
"name": "@ts-bridge/cli",
"version": "0.2.0",
"version": "0.3.0",
"description": "Bridge the gap between ES modules and CommonJS modules with an easy-to-use alternative to `tsc`.",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc