ts-swc-transform 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/constants.d.ts +7 -0
- package/dist/esm/createMatcher.d.ts +3 -0
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/lib/patchCJS.d.ts +2 -0
- package/dist/esm/lib/patchESM.d.ts +1 -0
- package/dist/esm/lib/swcPrepareOptions.d.ts +2 -0
- package/dist/esm/lib/transformFile.d.ts +1 -0
- package/dist/esm/lib/url-file-url.d.ts +3 -0
- package/dist/esm/loadTsConfig.d.ts +3 -0
- package/dist/esm/resolveFileSync.d.ts +2 -0
- package/dist/esm/toPath.d.ts +2 -0
- package/dist/esm/transformDirectory.d.ts +10 -0
- package/dist/esm/transformSync.d.ts +9 -0
- package/dist/esm/transformTypes.d.ts +9 -0
- package/dist/esm/types.d.ts +13 -0
- package/dist/esm/workers/transformDirectory.d.ts +1 -0
- package/dist/esm/workers/transformSync.d.ts +2 -0
- package/dist/esm/workers/transformTypes.d.ts +1 -0
- package/package.json +1 -1
- /package/dist/{esm/constants.d.mts → cjs/constants.d.ts} +0 -0
- /package/dist/{esm/createMatcher.d.mts → cjs/createMatcher.d.ts} +0 -0
- /package/dist/{esm/index.d.mts → cjs/index.d.ts} +0 -0
- /package/dist/{esm/lib/patchCJS.d.mts → cjs/lib/patchCJS.d.ts} +0 -0
- /package/dist/{esm/lib/patchESM.d.mts → cjs/lib/patchESM.d.ts} +0 -0
- /package/dist/{esm/lib/swcPrepareOptions.d.mts → cjs/lib/swcPrepareOptions.d.ts} +0 -0
- /package/dist/{esm/lib/transformFile.d.mts → cjs/lib/transformFile.d.ts} +0 -0
- /package/dist/{esm/lib/url-file-url.d.mts → cjs/lib/url-file-url.d.ts} +0 -0
- /package/dist/{esm/loadTsConfig.d.mts → cjs/loadTsConfig.d.ts} +0 -0
- /package/dist/{esm/resolveFileSync.d.mts → cjs/resolveFileSync.d.ts} +0 -0
- /package/dist/{esm/toPath.d.mts → cjs/toPath.d.ts} +0 -0
- /package/dist/{esm/transformDirectory.d.mts → cjs/transformDirectory.d.ts} +0 -0
- /package/dist/{esm/transformSync.d.mts → cjs/transformSync.d.ts} +0 -0
- /package/dist/{esm/transformTypes.d.mts → cjs/transformTypes.d.ts} +0 -0
- /package/dist/{esm/types.d.mts → cjs/types.d.ts} +0 -0
- /package/dist/{esm/workers/transformDirectory.d.mts → cjs/workers/transformDirectory.d.ts} +0 -0
- /package/dist/{esm/workers/transformSync.d.mts → cjs/workers/transformSync.d.ts} +0 -0
- /package/dist/{esm/workers/transformTypes.d.mts → cjs/workers/transformTypes.d.ts} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const moduleRegEx: RegExp;
|
|
2
|
+
export declare const typeFileRegEx: RegExp;
|
|
3
|
+
export declare const moduleDependencyRegEx = "\\s*['\"`]([^'\"`]+)['\"`]\\s*";
|
|
4
|
+
export declare const moduleNameRegEx = "\\s*(?:[\\w${},\\s*]+)\\s*";
|
|
5
|
+
export declare const requireRegEx: RegExp;
|
|
6
|
+
export declare const importRegEx: RegExp;
|
|
7
|
+
export declare const extensions: string[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type * from './types.js';
|
|
2
|
+
export { default as createMatcher } from './createMatcher.js';
|
|
3
|
+
export * as constants from './constants.js';
|
|
4
|
+
export { default as resolveFileSync } from './resolveFileSync.js';
|
|
5
|
+
export { default as toPath } from './toPath.js';
|
|
6
|
+
export { default as transformDirectory } from './transformDirectory.js';
|
|
7
|
+
export { default as transformSync } from './transformSync.js';
|
|
8
|
+
export { default as transformTypes } from './transformTypes.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const interop = "/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }";
|
|
2
|
+
export default function patchCJS(entry: any, output: any, _options: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function patchESM(entry: any, _output: any, _options: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function transformFile(entry: any, dest: any, type: any, options: any, callback: any): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ConfigOptions, TransformDirectoryCallback } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* @param {string} src The source directory to traverse.
|
|
4
|
+
* @param {string} dest The output directory to write files to.
|
|
5
|
+
* @param {string} type The type of transform ('esm' or 'cjs').
|
|
6
|
+
* @param {{sourceMaps: boolean}} options Options to pass to swc.
|
|
7
|
+
* @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.
|
|
8
|
+
* @returns {void | Promise<any>} Optional promise if callback not provided.
|
|
9
|
+
*/
|
|
10
|
+
export default function transformDirectory(src: string, dest: string, type: string, options?: ConfigOptions | TransformDirectoryCallback, callback?: TransformDirectoryCallback): undefined | Promise<string[]>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Output } from '@swc/core';
|
|
2
|
+
import type { TsConfigResult } from 'get-tsconfig-compat';
|
|
3
|
+
/**
|
|
4
|
+
* @param {string} contents The file contents.
|
|
5
|
+
* @param {string} fileName The filename.
|
|
6
|
+
* @param {TsConfigResult} tsconfig The configuration.
|
|
7
|
+
* @returns {{ code: string, map?: string }} Returns object with the transformed code and source map if option sourceMaps was provided.
|
|
8
|
+
*/
|
|
9
|
+
export default function transformSync(contents: string, fileName: string, tsconfig: TsConfigResult): Output;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ConfigOptions, TransformTypesCallback } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* @param {string} src The source directory to traverse.
|
|
4
|
+
* @param {string} dest The output directory to write files to.
|
|
5
|
+
* @param {{tsconfig: TsConfigResult}} options Options.
|
|
6
|
+
* @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.
|
|
7
|
+
* @returns {void | Promise<any>} Optional promise if callback not provided.
|
|
8
|
+
*/
|
|
9
|
+
export default function transformTypes(src: string, dest: string, options?: ConfigOptions | TransformTypesCallback, callback?: TransformTypesCallback): undefined | Promise<string[]>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface Context {
|
|
2
|
+
parentURL?: string;
|
|
3
|
+
parentPath?: string;
|
|
4
|
+
}
|
|
5
|
+
import type { TsConfigResult } from 'get-tsconfig-compat';
|
|
6
|
+
export interface ConfigOptions {
|
|
7
|
+
tsconfig?: TsConfigResult;
|
|
8
|
+
cwd?: string;
|
|
9
|
+
}
|
|
10
|
+
export type TransformDirectoryCallback = (err?: Error, filePaths?: string[]) => void;
|
|
11
|
+
export type TransformFileCallback = (err?: Error, destFilePath?: string) => void;
|
|
12
|
+
export type TransformTypesCallback = (err?: Error, filePaths?: string[]) => void;
|
|
13
|
+
export type Matcher = (filePath: string) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function transformDirectoryWorker(src: any, dest: any, type: any, options: any, callback: any): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function transformTypesWorker(src: any, dest: any, options: any, callback: any): void;
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|