ts-swc-transform 1.7.0 → 1.7.2
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/cjs/{index-base.js → index.js} +16 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/lib/loadSWC.js +23 -2
- package/dist/cjs/lib/loadSWC.js.map +1 -1
- package/dist/cjs/lib/wrapWorker.js +78 -0
- package/dist/cjs/lib/wrapWorker.js.map +1 -0
- package/dist/cjs/{esm/transformDirectory.js → transformDirectory.js} +11 -12
- package/dist/cjs/transformDirectory.js.map +1 -0
- package/dist/cjs/{cjs/transformFile.js → transformFile.js} +8 -19
- package/dist/cjs/transformFile.js.map +1 -0
- package/dist/cjs/{cjs/transformSync.js → transformSync.js} +7 -10
- package/dist/cjs/transformSync.js.map +1 -0
- package/dist/cjs/{cjs/transformTypes.js → transformTypes.js} +9 -20
- package/dist/cjs/transformTypes.js.map +1 -0
- package/dist/cjs/workers/transformSync.js +3 -43
- package/dist/cjs/workers/transformSync.js.map +1 -1
- package/dist/cjs/workers/transformTypes.js +3 -3
- package/dist/cjs/workers/transformTypes.js.map +1 -1
- package/dist/esm/{index-base.mjs → index.mjs} +4 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/lib/loadSWC.mjs +20 -1
- package/dist/esm/lib/loadSWC.mjs.map +1 -1
- package/dist/esm/lib/wrapWorker.mjs +25 -0
- package/dist/esm/lib/wrapWorker.mjs.map +1 -0
- package/dist/esm/{esm/transformDirectory.mjs → transformDirectory.mjs} +11 -13
- package/dist/esm/transformDirectory.mjs.map +1 -0
- package/dist/esm/{esm/transformFile.mjs → transformFile.mjs} +11 -13
- package/dist/esm/transformFile.mjs.map +1 -0
- package/dist/esm/{cjs/transformSync.mjs → transformSync.mjs} +7 -11
- package/dist/esm/transformSync.mjs.map +1 -0
- package/dist/esm/{cjs/transformTypes.mjs → transformTypes.mjs} +9 -21
- package/dist/esm/transformTypes.mjs.map +1 -0
- package/dist/esm/workers/transformSync.mjs +2 -1
- package/dist/esm/workers/transformSync.mjs.map +1 -1
- package/dist/esm/workers/transformTypes.mjs +2 -2
- package/dist/esm/workers/transformTypes.mjs.map +1 -1
- package/package.json +7 -7
- package/dist/cjs/cjs/transformDirectory.js +0 -59
- package/dist/cjs/cjs/transformDirectory.js.map +0 -1
- package/dist/cjs/cjs/transformFile.js.map +0 -1
- package/dist/cjs/cjs/transformSync.js.map +0 -1
- package/dist/cjs/cjs/transformTypes.js.map +0 -1
- package/dist/cjs/esm/transformDirectory.js.map +0 -1
- package/dist/cjs/esm/transformFile.js +0 -49
- package/dist/cjs/esm/transformFile.js.map +0 -1
- package/dist/cjs/esm/transformSync.js +0 -17
- package/dist/cjs/esm/transformSync.js.map +0 -1
- package/dist/cjs/esm/transformTypes.js +0 -47
- package/dist/cjs/esm/transformTypes.js.map +0 -1
- package/dist/cjs/index-base.js.map +0 -1
- package/dist/cjs/index.cjs.js +0 -48
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/index.esm.js +0 -48
- package/dist/cjs/index.esm.js.map +0 -1
- package/dist/cjs/lib/installBindings.js +0 -38
- package/dist/cjs/lib/installBindings.js.map +0 -1
- package/dist/cjs/lib/packageRoot.js +0 -26
- package/dist/cjs/lib/packageRoot.js.map +0 -1
- package/dist/esm/cjs/transformDirectory.mjs +0 -44
- package/dist/esm/cjs/transformDirectory.mjs.map +0 -1
- package/dist/esm/cjs/transformFile.mjs +0 -44
- package/dist/esm/cjs/transformFile.mjs.map +0 -1
- package/dist/esm/cjs/transformSync.mjs.map +0 -1
- package/dist/esm/cjs/transformTypes.mjs.map +0 -1
- package/dist/esm/esm/transformDirectory.mjs.map +0 -1
- package/dist/esm/esm/transformFile.mjs.map +0 -1
- package/dist/esm/esm/transformSync.mjs +0 -1
- package/dist/esm/esm/transformSync.mjs.map +0 -1
- package/dist/esm/esm/transformTypes.mjs +0 -32
- package/dist/esm/esm/transformTypes.mjs.map +0 -1
- package/dist/esm/index-base.mjs.map +0 -1
- package/dist/esm/index.cjs.mjs +0 -5
- package/dist/esm/index.cjs.mjs.map +0 -1
- package/dist/esm/index.esm.mjs +0 -5
- package/dist/esm/index.esm.mjs.map +0 -1
- package/dist/esm/lib/installBindings.mjs +0 -20
- package/dist/esm/lib/installBindings.mjs.map +0 -1
- package/dist/esm/lib/packageRoot.mjs +0 -10
- package/dist/esm/lib/packageRoot.mjs.map +0 -1
- package/dist/types/cjs/transformDirectory.d.ts +0 -9
- package/dist/types/cjs/transformFile.d.ts +0 -9
- package/dist/types/cjs/transformSync.d.ts +0 -8
- package/dist/types/cjs/transformTypes.d.ts +0 -8
- package/dist/types/constants.d.ts +0 -3
- package/dist/types/createMatcher.d.ts +0 -5
- package/dist/types/esm/transformDirectory.d.ts +0 -9
- package/dist/types/esm/transformFile.d.ts +0 -9
- package/dist/types/esm/transformSync.d.ts +0 -1
- package/dist/types/esm/transformTypes.d.ts +0 -8
- package/dist/types/extensions.d.ts +0 -2
- package/dist/types/index-base.d.ts +0 -6
- package/dist/types/index.cjs.d.ts +0 -5
- package/dist/types/index.esm.d.ts +0 -5
- package/dist/types/lib/existsSync.d.ts +0 -3
- package/dist/types/lib/fileURLToPath.d.ts +0 -3
- package/dist/types/lib/installBindings.d.ts +0 -1
- package/dist/types/lib/lazy.d.cts +0 -1
- package/dist/types/lib/loadSWC.d.ts +0 -2
- package/dist/types/lib/packageRoot.d.ts +0 -1
- package/dist/types/resolveFileSync.d.ts +0 -2
- package/dist/types/toPath.d.ts +0 -2
- package/dist/types/types.d.ts +0 -4
- package/dist/types/workers/transformDirectory.d.ts +0 -1
- package/dist/types/workers/transformFile.d.ts +0 -1
- package/dist/types/workers/transformSync.d.ts +0 -2
- package/dist/types/workers/transformTypes.d.ts +0 -1
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
transformDirectoryCallback = transformDirectoryCallbackCJS;
|
|
11
|
-
}
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import url from 'url';
|
|
3
|
+
import wrapWorker from './lib/wrapWorker.mjs';
|
|
4
|
+
import worker from './workers/transformDirectory.mjs';
|
|
5
|
+
const __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));
|
|
6
|
+
const workerPath = path.resolve(__dirname, '..', 'cjs', 'transformDirectory.js');
|
|
7
|
+
const major = +process.versions.node.split('.')[0];
|
|
8
|
+
const version = major < 14 ? 'lts' : 'local';
|
|
9
|
+
const workerWrapper = wrapWorker(worker, workerPath, version);
|
|
12
10
|
/**
|
|
13
11
|
* @param {string} src The source directory to traverse.
|
|
14
12
|
* @param {string} dest The output directory to write files to.
|
|
@@ -25,9 +23,9 @@ try {
|
|
|
25
23
|
if (typeof src !== 'string') throw new Error('transformDirectory: unexpected source');
|
|
26
24
|
if (typeof dest !== 'string') throw new Error('transformDirectory: unexpected destination directory');
|
|
27
25
|
if (typeof type !== 'string') throw new Error('transformDirectory: unexpected type');
|
|
28
|
-
if (typeof callback === 'function') return
|
|
26
|
+
if (typeof callback === 'function') return workerWrapper(src, dest, type, options, callback);
|
|
29
27
|
return new Promise((resolve, reject)=>{
|
|
30
|
-
|
|
28
|
+
workerWrapper(src, dest, type, options, (err, result)=>{
|
|
31
29
|
err ? reject(err) : resolve(result);
|
|
32
30
|
});
|
|
33
31
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["transformDirectory.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport wrapWorker from './lib/wrapWorker.js';\nimport worker from './workers/transformDirectory.js';\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst workerPath = path.resolve(__dirname, '..', 'cjs', 'transformDirectory.js');\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'lts' : 'local';\nconst workerWrapper = wrapWorker(worker, workerPath, version);\n\n/**\n * @param {string} src The source directory to traverse.\n * @param {string} dest The output directory to write files to.\n * @param {string} type The type of transform ('esm' or 'cjs').\n * @param {{sourceMaps: boolean}} options Options to pass to swc.\n * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.\n * @returns {void | Promise<any>} Optional promise if callback not provided.\n */\nexport default function transformDirectory(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n if (typeof src !== 'string') throw new Error('transformDirectory: unexpected source');\n if (typeof dest !== 'string') throw new Error('transformDirectory: unexpected destination directory');\n if (typeof type !== 'string') throw new Error('transformDirectory: unexpected type');\n\n if (typeof callback === 'function') return workerWrapper(src, dest, type, options, callback);\n return new Promise((resolve, reject) => {\n workerWrapper(src, dest, type, options, (err, result) => {\n err ? reject(err) : resolve(result);\n });\n });\n}\n"],"names":["path","url","wrapWorker","worker","__dirname","dirname","__filename","fileURLToPath","workerPath","resolve","major","process","versions","node","split","version","workerWrapper","transformDirectory","src","dest","type","options","callback","Error","Promise","reject","err","result"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,OAAOC,gBAAgB,sBAAsB;AAC7C,OAAOC,YAAY,kCAAkC;AACrD,MAAMC,YAAYJ,KAAKK,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaL,IAAIM,aAAa,CAAC,YAAYN,GAAG;AACjH,MAAMO,aAAaR,KAAKS,OAAO,CAACL,WAAW,MAAM,OAAO;AACxD,MAAMM,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,UAAUL,QAAQ,KAAK,QAAQ;AACrC,MAAMM,gBAAgBd,WAAWC,QAAQK,YAAYO;AAErD;;;;;;;CAOC,GACD,eAAe,SAASE,mBAAmBC,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC3E,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IACtB,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIK,MAAM;IAC7C,IAAI,OAAOJ,SAAS,UAAU,MAAM,IAAII,MAAM;IAC9C,IAAI,OAAOH,SAAS,UAAU,MAAM,IAAIG,MAAM;IAE9C,IAAI,OAAOD,aAAa,YAAY,OAAON,cAAcE,KAAKC,MAAMC,MAAMC,SAASC;IACnF,OAAO,IAAIE,QAAQ,CAACf,SAASgB;QAC3BT,cAAcE,KAAKC,MAAMC,MAAMC,SAAS,CAACK,KAAKC;YAC5CD,MAAMD,OAAOC,OAAOjB,QAAQkB;QAC9B;IACF;AACF"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
transformFileCallback = transformFileCallbackCJS;
|
|
11
|
-
}
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import url from 'url';
|
|
3
|
+
import wrapWorker from './lib/wrapWorker.mjs';
|
|
4
|
+
import worker from './workers/transformFile.mjs';
|
|
5
|
+
const __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));
|
|
6
|
+
const workerPath = path.resolve(__dirname, '..', 'cjs', 'transformFile.js');
|
|
7
|
+
const major = +process.versions.node.split('.')[0];
|
|
8
|
+
const version = major < 14 ? 'lts' : 'local';
|
|
9
|
+
const workerWrapper = wrapWorker(worker, workerPath, version);
|
|
12
10
|
/**
|
|
13
11
|
* @param {string} src The source directory to traverse.
|
|
14
12
|
* @param {string} dest The output directory to write files to.
|
|
@@ -25,9 +23,9 @@ try {
|
|
|
25
23
|
if (typeof src !== 'string') throw new Error('transformFile: unexpected source');
|
|
26
24
|
if (typeof dest !== 'string') throw new Error('transformFile: unexpected destination directory');
|
|
27
25
|
if (typeof type !== 'string') throw new Error('transformFile: unexpected type');
|
|
28
|
-
if (typeof callback === 'function') return
|
|
26
|
+
if (typeof callback === 'function') return workerWrapper(src, dest, type, options, callback);
|
|
29
27
|
return new Promise((resolve, reject)=>{
|
|
30
|
-
|
|
28
|
+
workerWrapper(src, dest, type, options, (err, result)=>{
|
|
31
29
|
err ? reject(err) : resolve(result);
|
|
32
30
|
});
|
|
33
31
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["transformFile.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport wrapWorker from './lib/wrapWorker.js';\nimport worker from './workers/transformFile.js';\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst workerPath = path.resolve(__dirname, '..', 'cjs', 'transformFile.js');\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'lts' : 'local';\nconst workerWrapper = wrapWorker(worker, workerPath, version);\n\n/**\n * @param {string} src The source directory to traverse.\n * @param {string} dest The output directory to write files to.\n * @param {string} type The type of transform ('esm' or 'cjs').\n * @param {{sourceMaps: boolean}} options Options to pass to swc.\n * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.\n * @returns {void | Promise<any>} Optional promise if callback not provided.\n */\nexport default function transformFile(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n if (typeof src !== 'string') throw new Error('transformFile: unexpected source');\n if (typeof dest !== 'string') throw new Error('transformFile: unexpected destination directory');\n if (typeof type !== 'string') throw new Error('transformFile: unexpected type');\n\n if (typeof callback === 'function') return workerWrapper(src, dest, type, options, callback);\n return new Promise((resolve, reject) => {\n workerWrapper(src, dest, type, options, (err, result) => {\n err ? reject(err) : resolve(result);\n });\n });\n}\n"],"names":["path","url","wrapWorker","worker","__dirname","dirname","__filename","fileURLToPath","workerPath","resolve","major","process","versions","node","split","version","workerWrapper","transformFile","src","dest","type","options","callback","Error","Promise","reject","err","result"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,OAAOC,gBAAgB,sBAAsB;AAC7C,OAAOC,YAAY,6BAA6B;AAChD,MAAMC,YAAYJ,KAAKK,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaL,IAAIM,aAAa,CAAC,YAAYN,GAAG;AACjH,MAAMO,aAAaR,KAAKS,OAAO,CAACL,WAAW,MAAM,OAAO;AACxD,MAAMM,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,UAAUL,QAAQ,KAAK,QAAQ;AACrC,MAAMM,gBAAgBd,WAAWC,QAAQK,YAAYO;AAErD;;;;;;;CAOC,GACD,eAAe,SAASE,cAAcC,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACtE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IACtB,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIK,MAAM;IAC7C,IAAI,OAAOJ,SAAS,UAAU,MAAM,IAAII,MAAM;IAC9C,IAAI,OAAOH,SAAS,UAAU,MAAM,IAAIG,MAAM;IAE9C,IAAI,OAAOD,aAAa,YAAY,OAAON,cAAcE,KAAKC,MAAMC,MAAMC,SAASC;IACnF,OAAO,IAAIE,QAAQ,CAACf,SAASgB;QAC3BT,cAAcE,KAAKC,MAAMC,MAAMC,SAAS,CAACK,KAAKC;YAC5CD,MAAMD,OAAOC,OAAOjB,QAAQkB;QAC9B;IACF;AACF"}
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import url from 'url';
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import packageRoot from '../lib/packageRoot.mjs';
|
|
3
|
+
import wrapWorker from './lib/wrapWorker.mjs';
|
|
4
|
+
import worker from './workers/transformSync.mjs';
|
|
6
5
|
const __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const version = 'lts';
|
|
10
|
-
const call = lazy('node-version-call');
|
|
6
|
+
const workerPath = path.resolve(__dirname, '..', 'cjs', 'transformSync.js');
|
|
7
|
+
const workerWrapper = wrapWorker(worker, workerPath, 'lts', true);
|
|
11
8
|
/**
|
|
12
9
|
* @param {string} contents The file contents.
|
|
13
10
|
* @param {string} fileName The filename.
|
|
14
11
|
* @param {TsConfigResult} tsconfig The configuration.
|
|
15
12
|
* @returns {{ code: string, map?: string }} Returns object with the transformed code and source map if option sourceMaps was provided.
|
|
16
13
|
*/ export default function transformSync(contents, fileName, tsconfig) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}, worker, contents, fileName, tsconfig);
|
|
14
|
+
// biome-ignore lint/style/noArguments: <explanation>
|
|
15
|
+
if (arguments.length === 4) return workerWrapper(contents, fileName, tsconfig, arguments[3]);
|
|
16
|
+
return workerWrapper(contents, fileName, tsconfig);
|
|
21
17
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["transformSync.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport wrapWorker from './lib/wrapWorker.js';\nimport worker from './workers/transformSync.js';\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst workerPath = path.resolve(__dirname, '..', 'cjs', 'transformSync.js');\nconst workerWrapper = wrapWorker(worker, workerPath, 'lts', true);\n\nimport type { TsConfigResult } from 'get-tsconfig-compat';\n/**\n * @param {string} contents The file contents.\n * @param {string} fileName The filename.\n * @param {TsConfigResult} tsconfig The configuration.\n * @returns {{ code: string, map?: string }} Returns object with the transformed code and source map if option sourceMaps was provided.\n */\nexport default function transformSync(contents: string, fileName: string, tsconfig: TsConfigResult) {\n // biome-ignore lint/style/noArguments: <explanation>\n if (arguments.length === 4) return workerWrapper(contents, fileName, tsconfig, arguments[3]);\n return workerWrapper(contents, fileName, tsconfig);\n}\n"],"names":["path","url","wrapWorker","worker","__dirname","dirname","__filename","fileURLToPath","workerPath","resolve","workerWrapper","transformSync","contents","fileName","tsconfig","arguments","length"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,OAAOC,gBAAgB,sBAAsB;AAC7C,OAAOC,YAAY,6BAA6B;AAChD,MAAMC,YAAYJ,KAAKK,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaL,IAAIM,aAAa,CAAC,YAAYN,GAAG;AACjH,MAAMO,aAAaR,KAAKS,OAAO,CAACL,WAAW,MAAM,OAAO;AACxD,MAAMM,gBAAgBR,WAAWC,QAAQK,YAAY,OAAO;AAG5D;;;;;CAKC,GACD,eAAe,SAASG,cAAcC,QAAgB,EAAEC,QAAgB,EAAEC,QAAwB;IAChG,qDAAqD;IACrD,IAAIC,UAAUC,MAAM,KAAK,GAAG,OAAON,cAAcE,UAAUC,UAAUC,UAAUC,SAAS,CAAC,EAAE;IAC3F,OAAOL,cAAcE,UAAUC,UAAUC;AAC3C"}
|
|
@@ -1,31 +1,19 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import url from 'url';
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import packageRoot from '../lib/packageRoot.mjs';
|
|
3
|
+
import wrapWorker from './lib/wrapWorker.mjs';
|
|
4
|
+
import worker from './workers/transformTypes.mjs';
|
|
6
5
|
const __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const version = 'lts';
|
|
10
|
-
const
|
|
11
|
-
function transformTypesCallback(src, dest, options, callback) {
|
|
12
|
-
try {
|
|
13
|
-
const res = call()({
|
|
14
|
-
version,
|
|
15
|
-
callbacks: true
|
|
16
|
-
}, worker, src, dest, options);
|
|
17
|
-
return callback(null, res);
|
|
18
|
-
} catch (err) {
|
|
19
|
-
return callback(err);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
6
|
+
const workerPath = path.resolve(__dirname, '..', 'cjs', 'transformTypes.js');
|
|
7
|
+
const major = +process.versions.node.split('.')[0];
|
|
8
|
+
const version = major < 14 ? 'lts' : 'local';
|
|
9
|
+
const workerWrapper = wrapWorker(worker, workerPath, version);
|
|
22
10
|
/**
|
|
23
11
|
* @param {string} src The source directory to traverse.
|
|
24
12
|
* @param {string} dest The output directory to write files to.
|
|
25
13
|
* @param {{tsconfig: TsConfigResult}} options Options.
|
|
26
14
|
* @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.
|
|
27
15
|
* @returns {void | Promise<any>} Optional promise if callback not provided.
|
|
28
|
-
*/ export default function transformTypes(src, dest, options, callback) {
|
|
16
|
+
*/ export default function transformTypes(src, dest, _type, options, callback) {
|
|
29
17
|
if (typeof options === 'function') {
|
|
30
18
|
callback = options;
|
|
31
19
|
options = null;
|
|
@@ -33,9 +21,9 @@ function transformTypesCallback(src, dest, options, callback) {
|
|
|
33
21
|
options = options || {};
|
|
34
22
|
if (typeof src !== 'string') throw new Error('transformTypes: unexpected source');
|
|
35
23
|
if (typeof dest !== 'string') throw new Error('transformTypes: unexpected destination directory');
|
|
36
|
-
if (typeof callback === 'function') return
|
|
24
|
+
if (typeof callback === 'function') return workerWrapper(src, dest, options, callback);
|
|
37
25
|
return new Promise((resolve, reject)=>{
|
|
38
|
-
|
|
26
|
+
workerWrapper(src, dest, options, (err, result)=>{
|
|
39
27
|
err ? reject(err) : resolve(result);
|
|
40
28
|
});
|
|
41
29
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["transformTypes.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport wrapWorker from './lib/wrapWorker.js';\nimport worker from './workers/transformTypes.js';\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst workerPath = path.resolve(__dirname, '..', 'cjs', 'transformTypes.js');\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'lts' : 'local';\nconst workerWrapper = wrapWorker(worker, workerPath, version);\n\n/**\n * @param {string} src The source directory to traverse.\n * @param {string} dest The output directory to write files to.\n * @param {{tsconfig: TsConfigResult}} options Options.\n * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.\n * @returns {void | Promise<any>} Optional promise if callback not provided.\n */\nexport default function transformTypes(src, dest, _type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n if (typeof src !== 'string') throw new Error('transformTypes: unexpected source');\n if (typeof dest !== 'string') throw new Error('transformTypes: unexpected destination directory');\n\n if (typeof callback === 'function') return workerWrapper(src, dest, options, callback);\n return new Promise((resolve, reject) => {\n workerWrapper(src, dest, options, (err, result) => {\n err ? reject(err) : resolve(result);\n });\n });\n}\n"],"names":["path","url","wrapWorker","worker","__dirname","dirname","__filename","fileURLToPath","workerPath","resolve","major","process","versions","node","split","version","workerWrapper","transformTypes","src","dest","_type","options","callback","Error","Promise","reject","err","result"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,OAAOC,gBAAgB,sBAAsB;AAC7C,OAAOC,YAAY,8BAA8B;AACjD,MAAMC,YAAYJ,KAAKK,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaL,IAAIM,aAAa,CAAC,YAAYN,GAAG;AACjH,MAAMO,aAAaR,KAAKS,OAAO,CAACL,WAAW,MAAM,OAAO;AACxD,MAAMM,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,UAAUL,QAAQ,KAAK,QAAQ;AACrC,MAAMM,gBAAgBd,WAAWC,QAAQK,YAAYO;AAErD;;;;;;CAMC,GACD,eAAe,SAASE,eAAeC,GAAG,EAAEC,IAAI,EAAEC,KAAK,EAAEC,OAAO,EAAEC,QAAQ;IACxE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IACtB,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIK,MAAM;IAC7C,IAAI,OAAOJ,SAAS,UAAU,MAAM,IAAII,MAAM;IAE9C,IAAI,OAAOD,aAAa,YAAY,OAAON,cAAcE,KAAKC,MAAME,SAASC;IAC7E,OAAO,IAAIE,QAAQ,CAACf,SAASgB;QAC3BT,cAAcE,KAAKC,MAAME,SAAS,CAACK,KAAKC;YACtCD,MAAMD,OAAOC,OAAOjB,QAAQkB;QAC9B;IACF;AACF"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import * as transpiler from 'ts-node/transpilers/swc';
|
|
3
2
|
// @ts-ignore
|
|
4
3
|
import lazy from '../lib/lazy.cjs';
|
|
5
4
|
// @ts-ignore
|
|
6
5
|
import loadSWC from '../lib/loadSWC.mjs';
|
|
7
6
|
const lazyTS = lazy('typescript');
|
|
7
|
+
const lazyTranspiler = lazy('ts-node/transpilers/swc');
|
|
8
8
|
export default function transformSyncWorker(contents, fileName, tsconfig, callback) {
|
|
9
9
|
loadSWC((err, swc)=>{
|
|
10
10
|
if (err) return callback(err);
|
|
11
11
|
const ts = lazyTS();
|
|
12
|
+
const transpiler = lazyTranspiler();
|
|
12
13
|
const parsed = ts.parseJsonConfigFileContent(tsconfig.config, ts.sys, path.dirname(tsconfig.path));
|
|
13
14
|
const transpile = transpiler.create({
|
|
14
15
|
swc: swc,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["transformSync.ts"],"sourcesContent":["import path from 'path';\nimport type { TsConfigResult } from 'get-tsconfig-compat';\
|
|
1
|
+
{"version":3,"sources":["transformSync.ts"],"sourcesContent":["import path from 'path';\nimport type { TsConfigResult } from 'get-tsconfig-compat';\n// @ts-ignore\nimport lazy from '../lib/lazy.cjs';\n// @ts-ignore\nimport loadSWC from '../lib/loadSWC.js';\nconst lazyTS = lazy('typescript');\nconst lazyTranspiler = lazy('ts-node/transpilers/swc');\n\nexport default function transformSyncWorker(contents: string, fileName: string, tsconfig: TsConfigResult, callback) {\n loadSWC((err, swc) => {\n if (err) return callback(err);\n const ts = lazyTS();\n const transpiler = lazyTranspiler();\n\n const parsed = ts.parseJsonConfigFileContent(tsconfig.config, ts.sys, path.dirname(tsconfig.path));\n const transpile = transpiler.create({ swc: swc, service: { config: { options: parsed.options } } });\n const res = transpile.transpile(contents, { fileName });\n callback(null, { code: res.outputText, map: res.sourceMapText });\n });\n}\n"],"names":["path","lazy","loadSWC","lazyTS","lazyTranspiler","transformSyncWorker","contents","fileName","tsconfig","callback","err","swc","ts","transpiler","parsed","parseJsonConfigFileContent","config","sys","dirname","transpile","create","service","options","res","code","outputText","map","sourceMapText"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AAExB,aAAa;AACb,OAAOC,UAAU,kBAAkB;AACnC,aAAa;AACb,OAAOC,aAAa,oBAAoB;AACxC,MAAMC,SAASF,KAAK;AACpB,MAAMG,iBAAiBH,KAAK;AAE5B,eAAe,SAASI,oBAAoBC,QAAgB,EAAEC,QAAgB,EAAEC,QAAwB,EAAEC,QAAQ;IAChHP,QAAQ,CAACQ,KAAKC;QACZ,IAAID,KAAK,OAAOD,SAASC;QACzB,MAAME,KAAKT;QACX,MAAMU,aAAaT;QAEnB,MAAMU,SAASF,GAAGG,0BAA0B,CAACP,SAASQ,MAAM,EAAEJ,GAAGK,GAAG,EAAEjB,KAAKkB,OAAO,CAACV,SAASR,IAAI;QAChG,MAAMmB,YAAYN,WAAWO,MAAM,CAAC;YAAET,KAAKA;YAAKU,SAAS;gBAAEL,QAAQ;oBAAEM,SAASR,OAAOQ,OAAO;gBAAC;YAAE;QAAE;QACjG,MAAMC,MAAMJ,UAAUA,SAAS,CAACb,UAAU;YAAEC;QAAS;QACrDE,SAAS,MAAM;YAAEe,MAAMD,IAAIE,UAAU;YAAEC,KAAKH,IAAII,aAAa;QAAC;IAChE;AACF"}
|
|
@@ -4,7 +4,7 @@ import getTS from 'get-tsconfig-compat';
|
|
|
4
4
|
import rimraf2 from 'rimraf2';
|
|
5
5
|
import { SKIPS, typeFileRegEx } from '../constants.mjs';
|
|
6
6
|
import createMatcher from '../createMatcher.mjs';
|
|
7
|
-
export default function
|
|
7
|
+
export default function transformTypesWorker(src, dest, options, callback) {
|
|
8
8
|
const tsconfig = options.tsconfig ? options.tsconfig : getTS.getTsconfig(src);
|
|
9
9
|
const matcher = createMatcher(tsconfig);
|
|
10
10
|
const tsArgs = [];
|
|
@@ -37,7 +37,7 @@ export default function types(src, dest, options, callback) {
|
|
|
37
37
|
...tsArgs
|
|
38
38
|
];
|
|
39
39
|
spawn(args[0], args.slice(1), {
|
|
40
|
-
|
|
40
|
+
cwd: src
|
|
41
41
|
}, callback);
|
|
42
42
|
});
|
|
43
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["transformTypes.ts"],"sourcesContent":["import spawn from 'cross-spawn-cb';\nimport Iterator from 'fs-iterator';\nimport getTS from 'get-tsconfig-compat';\nimport rimraf2 from 'rimraf2';\n\nimport { SKIPS, typeFileRegEx } from '../constants.js';\nimport createMatcher from '../createMatcher.js';\n\nexport default function
|
|
1
|
+
{"version":3,"sources":["transformTypes.ts"],"sourcesContent":["import spawn from 'cross-spawn-cb';\nimport Iterator from 'fs-iterator';\nimport getTS from 'get-tsconfig-compat';\nimport rimraf2 from 'rimraf2';\n\nimport { SKIPS, typeFileRegEx } from '../constants.js';\nimport createMatcher from '../createMatcher.js';\n\nexport default function transformTypesWorker(src, dest, options, callback) {\n const tsconfig = options.tsconfig ? options.tsconfig : getTS.getTsconfig(src);\n const matcher = createMatcher(tsconfig);\n\n const tsArgs = [];\n for (const key in tsconfig.config.compilerOptions) {\n const value = tsconfig.config.compilerOptions[key];\n tsArgs.push(`--${key}`);\n tsArgs.push(Array.isArray(value) ? value.join(',') : value);\n }\n\n rimraf2(dest, { disableGlob: true }, () => {\n const entries = [];\n const iterator = new Iterator(src);\n iterator.forEach(\n (entry) => {\n if (!entry.stats.isFile()) return;\n if (!matcher(entry.fullPath)) return;\n if (typeFileRegEx.test(entry.basename)) return;\n if (SKIPS.indexOf(entry.basename) >= 0) return;\n entries.push(entry);\n },\n (err) => {\n if (err) return callback(err);\n\n const files = entries.map((entry) => entry.fullPath);\n const args = ['tsc', ...files, '--declaration', '--emitDeclarationOnly', '--outDir', dest, ...tsArgs];\n spawn(args[0], args.slice(1), { cwd: src }, callback);\n }\n );\n });\n}\n"],"names":["spawn","Iterator","getTS","rimraf2","SKIPS","typeFileRegEx","createMatcher","transformTypesWorker","src","dest","options","callback","tsconfig","getTsconfig","matcher","tsArgs","key","config","compilerOptions","value","push","Array","isArray","join","disableGlob","entries","iterator","forEach","entry","stats","isFile","fullPath","test","basename","indexOf","err","files","map","args","slice","cwd"],"mappings":"AAAA,OAAOA,WAAW,iBAAiB;AACnC,OAAOC,cAAc,cAAc;AACnC,OAAOC,WAAW,sBAAsB;AACxC,OAAOC,aAAa,UAAU;AAE9B,SAASC,KAAK,EAAEC,aAAa,QAAQ,kBAAkB;AACvD,OAAOC,mBAAmB,sBAAsB;AAEhD,eAAe,SAASC,qBAAqBC,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACvE,MAAMC,WAAWF,QAAQE,QAAQ,GAAGF,QAAQE,QAAQ,GAAGV,MAAMW,WAAW,CAACL;IACzE,MAAMM,UAAUR,cAAcM;IAE9B,MAAMG,SAAS,EAAE;IACjB,IAAK,MAAMC,OAAOJ,SAASK,MAAM,CAACC,eAAe,CAAE;QACjD,MAAMC,QAAQP,SAASK,MAAM,CAACC,eAAe,CAACF,IAAI;QAClDD,OAAOK,IAAI,CAAC,CAAC,EAAE,EAAEJ,KAAK;QACtBD,OAAOK,IAAI,CAACC,MAAMC,OAAO,CAACH,SAASA,MAAMI,IAAI,CAAC,OAAOJ;IACvD;IAEAhB,QAAQM,MAAM;QAAEe,aAAa;IAAK,GAAG;QACnC,MAAMC,UAAU,EAAE;QAClB,MAAMC,WAAW,IAAIzB,SAASO;QAC9BkB,SAASC,OAAO,CACd,CAACC;YACC,IAAI,CAACA,MAAMC,KAAK,CAACC,MAAM,IAAI;YAC3B,IAAI,CAAChB,QAAQc,MAAMG,QAAQ,GAAG;YAC9B,IAAI1B,cAAc2B,IAAI,CAACJ,MAAMK,QAAQ,GAAG;YACxC,IAAI7B,MAAM8B,OAAO,CAACN,MAAMK,QAAQ,KAAK,GAAG;YACxCR,QAAQL,IAAI,CAACQ;QACf,GACA,CAACO;YACC,IAAIA,KAAK,OAAOxB,SAASwB;YAEzB,MAAMC,QAAQX,QAAQY,GAAG,CAAC,CAACT,QAAUA,MAAMG,QAAQ;YACnD,MAAMO,OAAO;gBAAC;mBAAUF;gBAAO;gBAAiB;gBAAyB;gBAAY3B;mBAASM;aAAO;YACrGf,MAAMsC,IAAI,CAAC,EAAE,EAAEA,KAAKC,KAAK,CAAC,IAAI;gBAAEC,KAAKhC;YAAI,GAAGG;QAC9C;IAEJ;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-swc-transform",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "Typescript transformers for swc. Supports Node >= 0.8",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"matcher",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"type": "module",
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
|
-
"import": "./dist/esm/index.
|
|
27
|
-
"require": "./dist/cjs/index.
|
|
26
|
+
"import": "./dist/esm/index.mjs",
|
|
27
|
+
"require": "./dist/cjs/index.js",
|
|
28
28
|
"types": "./dist/types/index.d.ts"
|
|
29
29
|
},
|
|
30
30
|
"./*": "./*"
|
|
31
31
|
},
|
|
32
|
-
"main": "dist/cjs/index.
|
|
33
|
-
"module": "dist/dist/esm/index.
|
|
32
|
+
"main": "dist/cjs/index.js",
|
|
33
|
+
"module": "dist/dist/esm/index.mjs",
|
|
34
34
|
"types": "dist/types/index.d.ts",
|
|
35
35
|
"bin": {
|
|
36
36
|
"tst": "bin/cli.js"
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"core-js": "^3.39.0",
|
|
78
78
|
"cr": "^0.1.0",
|
|
79
79
|
"react": "^19.0.0",
|
|
80
|
-
"ts-dev-stack": "^1.4.
|
|
80
|
+
"ts-dev-stack": "^1.4.8",
|
|
81
81
|
"ts-node": "^10.8.2",
|
|
82
82
|
"typescript": "^5.7.2"
|
|
83
83
|
},
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"node": ">=0.8"
|
|
87
87
|
},
|
|
88
88
|
"tsds": {
|
|
89
|
-
"source": "src/index.
|
|
89
|
+
"source": "src/index.ts",
|
|
90
90
|
"targets": [
|
|
91
91
|
"cjs",
|
|
92
92
|
"esm"
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, /**
|
|
6
|
-
* @param {string} src The source directory to traverse.
|
|
7
|
-
* @param {string} dest The output directory to write files to.
|
|
8
|
-
* @param {string} type The type of transform ('esm' or 'cjs').
|
|
9
|
-
* @param {{sourceMaps: boolean, tsconfig: TsConfigResult}} options Options to pass to swc.
|
|
10
|
-
* @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.
|
|
11
|
-
* @returns {void | Promise<any>} Optional promise if callback not provided.
|
|
12
|
-
*/ "default", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function() {
|
|
15
|
-
return transformDirectory;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
19
|
-
var _url = /*#__PURE__*/ _interop_require_default(require("url"));
|
|
20
|
-
var _lazycjs = /*#__PURE__*/ _interop_require_default(require("../lib/lazy.js"));
|
|
21
|
-
var _packageRoot = /*#__PURE__*/ _interop_require_default(require("../lib/packageRoot.js"));
|
|
22
|
-
function _interop_require_default(obj) {
|
|
23
|
-
return obj && obj.__esModule ? obj : {
|
|
24
|
-
default: obj
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
var __dirname = _path.default.dirname(typeof __filename !== 'undefined' ? __filename : _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()));
|
|
28
|
-
var root = (0, _packageRoot.default)(__dirname);
|
|
29
|
-
var worker = _path.default.resolve(root, 'dist', 'cjs', 'workers', 'transformDirectory.js');
|
|
30
|
-
var version = 'lts';
|
|
31
|
-
var call = (0, _lazycjs.default)('node-version-call');
|
|
32
|
-
function transformDirectoryCallback(src, dest, type, options, callback) {
|
|
33
|
-
try {
|
|
34
|
-
var res = call()({
|
|
35
|
-
version: version,
|
|
36
|
-
callbacks: true
|
|
37
|
-
}, worker, src, dest, type, options);
|
|
38
|
-
return callback(null, res);
|
|
39
|
-
} catch (err) {
|
|
40
|
-
return callback(err);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function transformDirectory(src, dest, type, options, callback) {
|
|
44
|
-
if (typeof options === 'function') {
|
|
45
|
-
callback = options;
|
|
46
|
-
options = null;
|
|
47
|
-
}
|
|
48
|
-
options = options || {};
|
|
49
|
-
if (typeof src !== 'string') throw new Error('transformDirectory: unexpected source');
|
|
50
|
-
if (typeof dest !== 'string') throw new Error('transformDirectory: unexpected destination directory');
|
|
51
|
-
if (typeof type !== 'string') throw new Error('transformDirectory: unexpected type');
|
|
52
|
-
if (typeof callback === 'function') return transformDirectoryCallback(src, dest, type, options, callback);
|
|
53
|
-
return new Promise(function(resolve, reject) {
|
|
54
|
-
transformDirectoryCallback(src, dest, type, options, function compileCallback(err, result) {
|
|
55
|
-
err ? reject(err) : resolve(result);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
/* 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; }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["transformDirectory.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\n\n// @ts-ignore\nimport lazy from '../lib/lazy.cjs';\nimport packageRoot from '../lib/packageRoot.js';\n\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst root = packageRoot(__dirname);\nconst worker = path.resolve(root, 'dist', 'cjs', 'workers', 'transformDirectory.js');\nconst version = 'lts';\nconst call = lazy('node-version-call');\n\nfunction transformDirectoryCallback(src, dest, type, options, callback) {\n try {\n const res = call()({ version, callbacks: true }, worker, src, dest, type, options);\n return callback(null, res);\n } catch (err) {\n return callback(err);\n }\n}\n\n/**\n * @param {string} src The source directory to traverse.\n * @param {string} dest The output directory to write files to.\n * @param {string} type The type of transform ('esm' or 'cjs').\n * @param {{sourceMaps: boolean, tsconfig: TsConfigResult}} options Options to pass to swc.\n * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.\n * @returns {void | Promise<any>} Optional promise if callback not provided.\n */\nexport default function transformDirectory(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n if (typeof src !== 'string') throw new Error('transformDirectory: unexpected source');\n if (typeof dest !== 'string') throw new Error('transformDirectory: unexpected destination directory');\n if (typeof type !== 'string') throw new Error('transformDirectory: unexpected type');\n\n if (typeof callback === 'function') return transformDirectoryCallback(src, dest, type, options, callback);\n return new Promise((resolve, reject) => {\n transformDirectoryCallback(src, dest, type, options, function compileCallback(err, result) {\n err ? reject(err) : resolve(result);\n });\n });\n}\n"],"names":["transformDirectory","__dirname","path","dirname","__filename","url","fileURLToPath","root","packageRoot","worker","resolve","version","call","lazy","transformDirectoryCallback","src","dest","type","options","callback","res","callbacks","err","Error","Promise","reject","compileCallback","result"],"mappings":";;;;+BAsBA;;;;;;;CAOC,GACD;;;eAAwBA;;;2DA9BP;0DACD;8DAGC;kEACO;;;;;;AAExB,IAAMC,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaC,YAAG,CAACC,aAAa,CAAC;AAClG,IAAMC,OAAOC,IAAAA,oBAAW,EAACP;AACzB,IAAMQ,SAASP,aAAI,CAACQ,OAAO,CAACH,MAAM,QAAQ,OAAO,WAAW;AAC5D,IAAMI,UAAU;AAChB,IAAMC,OAAOC,IAAAA,gBAAI,EAAC;AAElB,SAASC,2BAA2BC,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACpE,IAAI;QACF,IAAMC,MAAMR,OAAO;YAAED,SAAAA;YAASU,WAAW;QAAK,GAAGZ,QAAQM,KAAKC,MAAMC,MAAMC;QAC1E,OAAOC,SAAS,MAAMC;IACxB,EAAE,OAAOE,KAAK;QACZ,OAAOH,SAASG;IAClB;AACF;AAUe,SAAStB,mBAAmBe,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC3E,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IACtB,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIQ,MAAM;IAC7C,IAAI,OAAOP,SAAS,UAAU,MAAM,IAAIO,MAAM;IAC9C,IAAI,OAAON,SAAS,UAAU,MAAM,IAAIM,MAAM;IAE9C,IAAI,OAAOJ,aAAa,YAAY,OAAOL,2BAA2BC,KAAKC,MAAMC,MAAMC,SAASC;IAChG,OAAO,IAAIK,QAAQ,SAACd,SAASe;QAC3BX,2BAA2BC,KAAKC,MAAMC,MAAMC,SAAS,SAASQ,gBAAgBJ,GAAG,EAAEK,MAAM;YACvFL,MAAMG,OAAOH,OAAOZ,QAAQiB;QAC9B;IACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["transformFile.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\n\n// @ts-ignore\nimport lazy from '../lib/lazy.cjs';\nimport packageRoot from '../lib/packageRoot.js';\n\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst root = packageRoot(__dirname);\nconst worker = path.resolve(root, 'dist', 'cjs', 'workers', 'transformFile.js');\nconst version = 'lts';\nconst call = lazy('node-version-call');\n\nfunction transformFileCallback(src, dest, type, options, callback) {\n try {\n const res = call()({ version, callbacks: true }, worker, src, dest, type, options);\n return callback(null, res);\n } catch (err) {\n return callback(err);\n }\n}\n\n/**\n * @param {string} src The source directory to traverse.\n * @param {string} dest The output directory to write files to.\n * @param {string} type The type of transform ('esm' or 'cjs').\n * @param {{sourceMaps: boolean}} options Options to pass to swc.\n * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.\n * @returns {void | Promise<any>} Optional promise if callback not provided.\n */\nexport default function transformFile(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n if (typeof src !== 'string') throw new Error('transformFile: unexpected source');\n if (typeof dest !== 'string') throw new Error('transformFile: unexpected destination directory');\n if (typeof type !== 'string') throw new Error('transformFile: unexpected type');\n\n if (typeof callback === 'function') return transformFileCallback(src, dest, type, options, callback);\n return new Promise((resolve, reject) => {\n transformFileCallback(src, dest, type, options, function compileCallback(err, result) {\n err ? reject(err) : resolve(result);\n });\n });\n}\n"],"names":["transformFile","__dirname","path","dirname","__filename","url","fileURLToPath","root","packageRoot","worker","resolve","version","call","lazy","transformFileCallback","src","dest","type","options","callback","res","callbacks","err","Error","Promise","reject","compileCallback","result"],"mappings":";;;;+BAsBA;;;;;;;CAOC,GACD;;;eAAwBA;;;2DA9BP;0DACD;8DAGC;kEACO;;;;;;AAExB,IAAMC,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaC,YAAG,CAACC,aAAa,CAAC;AAClG,IAAMC,OAAOC,IAAAA,oBAAW,EAACP;AACzB,IAAMQ,SAASP,aAAI,CAACQ,OAAO,CAACH,MAAM,QAAQ,OAAO,WAAW;AAC5D,IAAMI,UAAU;AAChB,IAAMC,OAAOC,IAAAA,gBAAI,EAAC;AAElB,SAASC,sBAAsBC,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC/D,IAAI;QACF,IAAMC,MAAMR,OAAO;YAAED,SAAAA;YAASU,WAAW;QAAK,GAAGZ,QAAQM,KAAKC,MAAMC,MAAMC;QAC1E,OAAOC,SAAS,MAAMC;IACxB,EAAE,OAAOE,KAAK;QACZ,OAAOH,SAASG;IAClB;AACF;AAUe,SAAStB,cAAce,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACtE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IACtB,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIQ,MAAM;IAC7C,IAAI,OAAOP,SAAS,UAAU,MAAM,IAAIO,MAAM;IAC9C,IAAI,OAAON,SAAS,UAAU,MAAM,IAAIM,MAAM;IAE9C,IAAI,OAAOJ,aAAa,YAAY,OAAOL,sBAAsBC,KAAKC,MAAMC,MAAMC,SAASC;IAC3F,OAAO,IAAIK,QAAQ,SAACd,SAASe;QAC3BX,sBAAsBC,KAAKC,MAAMC,MAAMC,SAAS,SAASQ,gBAAgBJ,GAAG,EAAEK,MAAM;YAClFL,MAAMG,OAAOH,OAAOZ,QAAQiB;QAC9B;IACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["transformSync.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport type { TsConfigResult } from 'get-tsconfig-compat';\n\n// @ts-ignore\nimport lazy from '../lib/lazy.cjs';\nimport packageRoot from '../lib/packageRoot.js';\n\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst root = packageRoot(__dirname);\nconst worker = path.resolve(root, 'dist', 'cjs', 'workers', 'transformSync.js');\nconst version = 'lts';\nconst call = lazy('node-version-call');\n\n/**\n * @param {string} contents The file contents.\n * @param {string} fileName The filename.\n * @param {TsConfigResult} tsconfig The configuration.\n * @returns {{ code: string, map?: string }} Returns object with the transformed code and source map if option sourceMaps was provided.\n */\nexport default function transformSync(contents: string, fileName: string, tsconfig: TsConfigResult) {\n return call()({ version, callbacks: true }, worker, contents, fileName, tsconfig);\n}\n"],"names":["transformSync","__dirname","path","dirname","__filename","url","fileURLToPath","root","packageRoot","worker","resolve","version","call","lazy","contents","fileName","tsconfig","callbacks"],"mappings":";;;;+BAcA;;;;;CAKC,GACD;;;eAAwBA;;;2DApBP;0DACD;8DAIC;kEACO;;;;;;AAExB,IAAMC,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaC,YAAG,CAACC,aAAa,CAAC;AAClG,IAAMC,OAAOC,IAAAA,oBAAW,EAACP;AACzB,IAAMQ,SAASP,aAAI,CAACQ,OAAO,CAACH,MAAM,QAAQ,OAAO,WAAW;AAC5D,IAAMI,UAAU;AAChB,IAAMC,OAAOC,IAAAA,gBAAI,EAAC;AAQH,SAASb,cAAcc,QAAgB,EAAEC,QAAgB,EAAEC,QAAwB;IAChG,OAAOJ,OAAO;QAAED,SAAAA;QAASM,WAAW;IAAK,GAAGR,QAAQK,UAAUC,UAAUC;AAC1E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["transformTypes.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\n\n// @ts-ignore\nimport lazy from '../lib/lazy.cjs';\nimport packageRoot from '../lib/packageRoot.js';\n\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst root = packageRoot(__dirname);\nconst worker = path.resolve(root, 'dist', 'cjs', 'workers', 'transformTypes.js');\nconst version = 'lts';\nconst call = lazy('node-version-call');\n\nfunction transformTypesCallback(src, dest, options, callback) {\n try {\n const res = call()({ version, callbacks: true }, worker, src, dest, options);\n return callback(null, res);\n } catch (err) {\n return callback(err);\n }\n}\n\n/**\n * @param {string} src The source directory to traverse.\n * @param {string} dest The output directory to write files to.\n * @param {{tsconfig: TsConfigResult}} options Options.\n * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.\n * @returns {void | Promise<any>} Optional promise if callback not provided.\n */\nexport default function transformTypes(src, dest, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n if (typeof src !== 'string') throw new Error('transformTypes: unexpected source');\n if (typeof dest !== 'string') throw new Error('transformTypes: unexpected destination directory');\n\n if (typeof callback === 'function') return transformTypesCallback(src, dest, options, callback);\n return new Promise((resolve, reject) => {\n transformTypesCallback(src, dest, options, function compileCallback(err, result) {\n err ? reject(err) : resolve(result);\n });\n });\n}\n"],"names":["transformTypes","__dirname","path","dirname","__filename","url","fileURLToPath","root","packageRoot","worker","resolve","version","call","lazy","transformTypesCallback","src","dest","options","callback","res","callbacks","err","Error","Promise","reject","compileCallback","result"],"mappings":";;;;+BAsBA;;;;;;CAMC,GACD;;;eAAwBA;;;2DA7BP;0DACD;8DAGC;kEACO;;;;;;AAExB,IAAMC,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaC,YAAG,CAACC,aAAa,CAAC;AAClG,IAAMC,OAAOC,IAAAA,oBAAW,EAACP;AACzB,IAAMQ,SAASP,aAAI,CAACQ,OAAO,CAACH,MAAM,QAAQ,OAAO,WAAW;AAC5D,IAAMI,UAAU;AAChB,IAAMC,OAAOC,IAAAA,gBAAI,EAAC;AAElB,SAASC,uBAAuBC,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC1D,IAAI;QACF,IAAMC,MAAMP,OAAO;YAAED,SAAAA;YAASS,WAAW;QAAK,GAAGX,QAAQM,KAAKC,MAAMC;QACpE,OAAOC,SAAS,MAAMC;IACxB,EAAE,OAAOE,KAAK;QACZ,OAAOH,SAASG;IAClB;AACF;AASe,SAASrB,eAAee,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACjE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IACtB,IAAI,OAAOF,QAAQ,UAAU,MAAM,IAAIO,MAAM;IAC7C,IAAI,OAAON,SAAS,UAAU,MAAM,IAAIM,MAAM;IAE9C,IAAI,OAAOJ,aAAa,YAAY,OAAOJ,uBAAuBC,KAAKC,MAAMC,SAASC;IACtF,OAAO,IAAIK,QAAQ,SAACb,SAASc;QAC3BV,uBAAuBC,KAAKC,MAAMC,SAAS,SAASQ,gBAAgBJ,GAAG,EAAEK,MAAM;YAC7EL,MAAMG,OAAOH,OAAOX,QAAQgB;QAC9B;IACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["transformDirectory.ts"],"sourcesContent":["import transformDirectoryCallbackCJS from '../cjs/transformDirectory.js';\nimport transformDirectoryCallbackWorker from '../workers/transformDirectory.js';\n\n// @ts-ignore\nimport lazy from '../lib/lazy.cjs';\nlet transformDirectoryCallback = transformDirectoryCallbackWorker;\ntry {\n // typescript cannot be loaded so run in lts\n lazy('typescript')();\n} catch {\n transformDirectoryCallback = transformDirectoryCallbackCJS;\n}\n\n/**\n * @param {string} src The source directory to traverse.\n * @param {string} dest The output directory to write files to.\n * @param {string} type The type of transform ('esm' or 'cjs').\n * @param {{sourceMaps: boolean}} options Options to pass to swc.\n * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.\n * @returns {void | Promise<any>} Optional promise if callback not provided.\n */\nexport default function transformDirectory(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n if (typeof src !== 'string') throw new Error('transformDirectory: unexpected source');\n if (typeof dest !== 'string') throw new Error('transformDirectory: unexpected destination directory');\n if (typeof type !== 'string') throw new Error('transformDirectory: unexpected type');\n\n if (typeof callback === 'function') return transformDirectoryCallback(src, dest, type, options, callback);\n return new Promise((resolve, reject) => {\n transformDirectoryCallback(src, dest, type, options, function compileCallback(err, result) {\n err ? reject(err) : resolve(result);\n });\n });\n}\n"],"names":["transformDirectory","transformDirectoryCallback","transformDirectoryCallbackWorker","lazy","transformDirectoryCallbackCJS","src","dest","type","options","callback","Error","Promise","resolve","reject","compileCallback","err","result"],"mappings":";;;;+BAaA;;;;;;;CAOC,GACD;;;eAAwBA;;;yEArBkB;0EACG;8DAG5B;;;;;;AACjB,IAAIC,6BAA6BC,4BAAgC;AACjE,IAAI;IACF,4CAA4C;IAC5CC,IAAAA,gBAAI,EAAC;AACP,EAAE,UAAM;IACNF,6BAA6BG,2BAA6B;AAC5D;AAUe,SAASJ,mBAAmBK,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC3E,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IACtB,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIK,MAAM;IAC7C,IAAI,OAAOJ,SAAS,UAAU,MAAM,IAAII,MAAM;IAC9C,IAAI,OAAOH,SAAS,UAAU,MAAM,IAAIG,MAAM;IAE9C,IAAI,OAAOD,aAAa,YAAY,OAAOR,2BAA2BI,KAAKC,MAAMC,MAAMC,SAASC;IAChG,OAAO,IAAIE,QAAQ,SAACC,SAASC;QAC3BZ,2BAA2BI,KAAKC,MAAMC,MAAMC,SAAS,SAASM,gBAAgBC,GAAG,EAAEC,MAAM;YACvFD,MAAMF,OAAOE,OAAOH,QAAQI;QAC9B;IACF;AACF"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, /**
|
|
6
|
-
* @param {string} src The source directory to traverse.
|
|
7
|
-
* @param {string} dest The output directory to write files to.
|
|
8
|
-
* @param {string} type The type of transform ('esm' or 'cjs').
|
|
9
|
-
* @param {{sourceMaps: boolean}} options Options to pass to swc.
|
|
10
|
-
* @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.
|
|
11
|
-
* @returns {void | Promise<any>} Optional promise if callback not provided.
|
|
12
|
-
*/ "default", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function() {
|
|
15
|
-
return transformFile;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _transformFile = /*#__PURE__*/ _interop_require_default(require("../cjs/transformFile.js"));
|
|
19
|
-
var _transformFile1 = /*#__PURE__*/ _interop_require_default(require("../workers/transformFile.js"));
|
|
20
|
-
var _lazycjs = /*#__PURE__*/ _interop_require_default(require("../lib/lazy.js"));
|
|
21
|
-
function _interop_require_default(obj) {
|
|
22
|
-
return obj && obj.__esModule ? obj : {
|
|
23
|
-
default: obj
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
var transformFileCallback = _transformFile1.default;
|
|
27
|
-
try {
|
|
28
|
-
// typescript cannot be loaded so run in lts
|
|
29
|
-
(0, _lazycjs.default)('typescript')();
|
|
30
|
-
} catch (e) {
|
|
31
|
-
transformFileCallback = _transformFile.default;
|
|
32
|
-
}
|
|
33
|
-
function transformFile(src, dest, type, options, callback) {
|
|
34
|
-
if (typeof options === 'function') {
|
|
35
|
-
callback = options;
|
|
36
|
-
options = null;
|
|
37
|
-
}
|
|
38
|
-
options = options || {};
|
|
39
|
-
if (typeof src !== 'string') throw new Error('transformFile: unexpected source');
|
|
40
|
-
if (typeof dest !== 'string') throw new Error('transformFile: unexpected destination directory');
|
|
41
|
-
if (typeof type !== 'string') throw new Error('transformFile: unexpected type');
|
|
42
|
-
if (typeof callback === 'function') return transformFileCallback(src, dest, type, options, callback);
|
|
43
|
-
return new Promise(function(resolve, reject) {
|
|
44
|
-
transformFileCallback(src, dest, type, options, function compileCallback(err, result) {
|
|
45
|
-
err ? reject(err) : resolve(result);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
/* 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; }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["transformFile.ts"],"sourcesContent":["import transformFileCallbackCJS from '../cjs/transformFile.js';\nimport transformFileCallbackWorker from '../workers/transformFile.js';\n\n// @ts-ignore\nimport lazy from '../lib/lazy.cjs';\nlet transformFileCallback = transformFileCallbackWorker;\ntry {\n // typescript cannot be loaded so run in lts\n lazy('typescript')();\n} catch {\n transformFileCallback = transformFileCallbackCJS;\n}\n\n/**\n * @param {string} src The source directory to traverse.\n * @param {string} dest The output directory to write files to.\n * @param {string} type The type of transform ('esm' or 'cjs').\n * @param {{sourceMaps: boolean}} options Options to pass to swc.\n * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.\n * @returns {void | Promise<any>} Optional promise if callback not provided.\n */\nexport default function transformFile(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n if (typeof src !== 'string') throw new Error('transformFile: unexpected source');\n if (typeof dest !== 'string') throw new Error('transformFile: unexpected destination directory');\n if (typeof type !== 'string') throw new Error('transformFile: unexpected type');\n\n if (typeof callback === 'function') return transformFileCallback(src, dest, type, options, callback);\n return new Promise((resolve, reject) => {\n transformFileCallback(src, dest, type, options, function compileCallback(err, result) {\n err ? reject(err) : resolve(result);\n });\n });\n}\n"],"names":["transformFile","transformFileCallback","transformFileCallbackWorker","lazy","transformFileCallbackCJS","src","dest","type","options","callback","Error","Promise","resolve","reject","compileCallback","err","result"],"mappings":";;;;+BAaA;;;;;;;CAOC,GACD;;;eAAwBA;;;oEArBa;qEACG;8DAGvB;;;;;;AACjB,IAAIC,wBAAwBC,uBAA2B;AACvD,IAAI;IACF,4CAA4C;IAC5CC,IAAAA,gBAAI,EAAC;AACP,EAAE,UAAM;IACNF,wBAAwBG,sBAAwB;AAClD;AAUe,SAASJ,cAAcK,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACtE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IACtB,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIK,MAAM;IAC7C,IAAI,OAAOJ,SAAS,UAAU,MAAM,IAAII,MAAM;IAC9C,IAAI,OAAOH,SAAS,UAAU,MAAM,IAAIG,MAAM;IAE9C,IAAI,OAAOD,aAAa,YAAY,OAAOR,sBAAsBI,KAAKC,MAAMC,MAAMC,SAASC;IAC3F,OAAO,IAAIE,QAAQ,SAACC,SAASC;QAC3BZ,sBAAsBI,KAAKC,MAAMC,MAAMC,SAAS,SAASM,gBAAgBC,GAAG,EAAEC,MAAM;YAClFD,MAAMF,OAAOE,OAAOH,QAAQI;QAC9B;IACF;AACF"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _transformSync.default;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _transformSync = /*#__PURE__*/ _interop_require_default(require("../cjs/transformSync.js"));
|
|
12
|
-
function _interop_require_default(obj) {
|
|
13
|
-
return obj && obj.__esModule ? obj : {
|
|
14
|
-
default: obj
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
/* 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; }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["transformSync.ts"],"sourcesContent":["export { default } from '../cjs/transformSync.js';\n"],"names":["default"],"mappings":";;;;+BAASA;;;eAAAA,sBAAO;;;oEAAQ"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, /**
|
|
6
|
-
* @param {string} src The source directory to traverse.
|
|
7
|
-
* @param {string} dest The output directory to write files to.
|
|
8
|
-
* @param {{tsconfig: TsConfigResult}} options Options.
|
|
9
|
-
* @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.
|
|
10
|
-
* @returns {void | Promise<any>} Optional promise if callback not provided.
|
|
11
|
-
*/ "default", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function() {
|
|
14
|
-
return transformTypes;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
var _transformTypes = /*#__PURE__*/ _interop_require_default(require("../cjs/transformTypes.js"));
|
|
18
|
-
var _lazycjs = /*#__PURE__*/ _interop_require_default(require("../lib/lazy.js"));
|
|
19
|
-
function _interop_require_default(obj) {
|
|
20
|
-
return obj && obj.__esModule ? obj : {
|
|
21
|
-
default: obj
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
var transformTypesCallback = _transformTypes.default;
|
|
25
|
-
try {
|
|
26
|
-
// typescript cannot be loaded so run in lts
|
|
27
|
-
(0, _lazycjs.default)('typescript')();
|
|
28
|
-
(0, _lazycjs.default)('tsc')();
|
|
29
|
-
} catch (e) {
|
|
30
|
-
transformTypesCallback = _transformTypes.default;
|
|
31
|
-
}
|
|
32
|
-
function transformTypes(src, dest, options, callback) {
|
|
33
|
-
if (typeof options === 'function') {
|
|
34
|
-
callback = options;
|
|
35
|
-
options = null;
|
|
36
|
-
}
|
|
37
|
-
options = options || {};
|
|
38
|
-
if (typeof src !== 'string') throw new Error('transformTypes: unexpected source');
|
|
39
|
-
if (typeof dest !== 'string') throw new Error('transformTypes: unexpected destination directory');
|
|
40
|
-
if (typeof callback === 'function') return transformTypesCallback(src, dest, options, callback);
|
|
41
|
-
return new Promise(function(resolve, reject) {
|
|
42
|
-
transformTypesCallback(src, dest, options, function compileCallback(err, result) {
|
|
43
|
-
err ? reject(err) : resolve(result);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
/* 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; }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["transformTypes.ts"],"sourcesContent":["import transformTypesCallbackCJS from '../cjs/transformTypes.js';\nimport transformTypesCallbackWorker from '../workers/transformTypes.js';\n\n// @ts-ignore\nimport lazy from '../lib/lazy.cjs';\nlet transformTypesCallback = transformTypesCallbackCJS;\ntry {\n // typescript cannot be loaded so run in lts\n lazy('typescript')();\n lazy('tsc')();\n} catch {\n transformTypesCallback = transformTypesCallbackCJS;\n}\n\n/**\n * @param {string} src The source directory to traverse.\n * @param {string} dest The output directory to write files to.\n * @param {{tsconfig: TsConfigResult}} options Options.\n * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.\n * @returns {void | Promise<any>} Optional promise if callback not provided.\n */\nexport default function transformTypes(src, dest, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n if (typeof src !== 'string') throw new Error('transformTypes: unexpected source');\n if (typeof dest !== 'string') throw new Error('transformTypes: unexpected destination directory');\n\n if (typeof callback === 'function') return transformTypesCallback(src, dest, options, callback);\n return new Promise((resolve, reject) => {\n transformTypesCallback(src, dest, options, function compileCallback(err, result) {\n err ? reject(err) : resolve(result);\n });\n });\n}\n"],"names":["transformTypes","transformTypesCallback","transformTypesCallbackCJS","lazy","src","dest","options","callback","Error","Promise","resolve","reject","compileCallback","err","result"],"mappings":";;;;+BAcA;;;;;;CAMC,GACD;;;eAAwBA;;;qEArBc;8DAIrB;;;;;;AACjB,IAAIC,yBAAyBC,uBAAyB;AACtD,IAAI;IACF,4CAA4C;IAC5CC,IAAAA,gBAAI,EAAC;IACLA,IAAAA,gBAAI,EAAC;AACP,EAAE,UAAM;IACNF,yBAAyBC,uBAAyB;AACpD;AASe,SAASF,eAAeI,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACjE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IACtB,IAAI,OAAOF,QAAQ,UAAU,MAAM,IAAII,MAAM;IAC7C,IAAI,OAAOH,SAAS,UAAU,MAAM,IAAIG,MAAM;IAE9C,IAAI,OAAOD,aAAa,YAAY,OAAON,uBAAuBG,KAAKC,MAAMC,SAASC;IACtF,OAAO,IAAIE,QAAQ,SAACC,SAASC;QAC3BV,uBAAuBG,KAAKC,MAAMC,SAAS,SAASM,gBAAgBC,GAAG,EAAEC,MAAM;YAC7ED,MAAMF,OAAOE,OAAOH,QAAQI;QAC9B;IACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index-base.ts"],"sourcesContent":["export type * from './types.js';\nexport { default as createMatcher } from './createMatcher.js';\nexport * as constants from './constants.js';\nexport { default as extensions } from './extensions.js';\nexport { default as resolveFileSync } from './resolveFileSync.js';\nexport { default as toPath } from './toPath.js';\n"],"names":["constants","createMatcher","extensions","resolveFileSync","toPath"],"mappings":";;;;;;;;;;;IAEYA,SAAS;;;IADDC,aAAa;eAAbA,sBAAa;;IAEbC,UAAU;eAAVA,mBAAU;;IACVC,eAAe;eAAfA,wBAAe;;IACfC,MAAM;eAANA,eAAM;;;oEAJe;iEACd;iEACW;sEACK;6DACT"}
|
package/dist/cjs/index.cjs.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
transformDirectory: function() {
|
|
13
|
-
return _transformDirectory.default;
|
|
14
|
-
},
|
|
15
|
-
transformFile: function() {
|
|
16
|
-
return _transformFile.default;
|
|
17
|
-
},
|
|
18
|
-
transformSync: function() {
|
|
19
|
-
return _transformSync.default;
|
|
20
|
-
},
|
|
21
|
-
transformTypes: function() {
|
|
22
|
-
return _transformTypes.default;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
_export_star(require("./index-base.js"), exports);
|
|
26
|
-
var _transformFile = /*#__PURE__*/ _interop_require_default(require("./cjs/transformFile.js"));
|
|
27
|
-
var _transformDirectory = /*#__PURE__*/ _interop_require_default(require("./cjs/transformDirectory.js"));
|
|
28
|
-
var _transformSync = /*#__PURE__*/ _interop_require_default(require("./cjs/transformSync.js"));
|
|
29
|
-
var _transformTypes = /*#__PURE__*/ _interop_require_default(require("./cjs/transformTypes.js"));
|
|
30
|
-
function _export_star(from, to) {
|
|
31
|
-
Object.keys(from).forEach(function(k) {
|
|
32
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
33
|
-
Object.defineProperty(to, k, {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function() {
|
|
36
|
-
return from[k];
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
return from;
|
|
42
|
-
}
|
|
43
|
-
function _interop_require_default(obj) {
|
|
44
|
-
return obj && obj.__esModule ? obj : {
|
|
45
|
-
default: obj
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
/* 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; }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.cjs.ts"],"sourcesContent":["export * from './index-base.js';\nexport { default as transformFile } from './cjs/transformFile.js';\nexport { default as transformDirectory } from './cjs/transformDirectory.js';\nexport { default as transformSync } from './cjs/transformSync.js';\nexport { default as transformTypes } from './cjs/transformTypes.js';\n"],"names":["transformDirectory","transformFile","transformSync","transformTypes"],"mappings":";;;;;;;;;;;IAEoBA,kBAAkB;eAAlBA,2BAAkB;;IADlBC,aAAa;eAAbA,sBAAa;;IAEbC,aAAa;eAAbA,sBAAa;;IACbC,cAAc;eAAdA,uBAAc;;;qBAJpB;oEAC2B;yEACK;oEACL;qEACC"}
|