ts-swc-transform 0.1.1 → 0.2.0
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/createMatcher.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/lib/regexDependencies.js +1 -1
- package/dist/cjs/transformDirectory.js +3 -3
- package/dist/cjs/transformDirectory.js.map +1 -1
- package/dist/cjs/transformFile.js +3 -3
- package/dist/cjs/transformFile.js.map +1 -1
- package/dist/cjs/transformSync.js +1 -1
- package/dist/cjs/workers/transformSync.js +1 -1
- package/dist/esm/transformDirectory.mjs +2 -2
- package/dist/esm/transformDirectory.mjs.map +1 -1
- package/dist/esm/transformFile.mjs +2 -2
- package/dist/esm/transformFile.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -42,4 +42,4 @@ function createMatcher(config) {
|
|
|
42
42
|
return !includes.length;
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
/* CJS INTEROP */ if (exports.__esModule && exports.default) {
|
|
45
|
+
/* 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]; }; module.exports = exports.default; } catch (_) {} }
|
package/dist/cjs/index.js
CHANGED
|
@@ -31,4 +31,4 @@ function _interop_require_default(obj) {
|
|
|
31
31
|
default: obj
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
/* CJS INTEROP */ if (exports.__esModule && exports.default) {
|
|
34
|
+
/* 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]; }; module.exports = exports.default; } catch (_) {} }
|
|
@@ -18,4 +18,4 @@ function regexDependencies(esm) {
|
|
|
18
18
|
}
|
|
19
19
|
return new RegExp(regex, 'g');
|
|
20
20
|
}
|
|
21
|
-
/* CJS INTEROP */ if (exports.__esModule && exports.default) {
|
|
21
|
+
/* 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]; }; module.exports = exports.default; } catch (_) {} }
|
|
@@ -82,11 +82,11 @@ function transformDirectoryCallback(src, dest, type, options, callback) {
|
|
|
82
82
|
callback = options;
|
|
83
83
|
options = {};
|
|
84
84
|
}
|
|
85
|
+
options = options || {};
|
|
85
86
|
if (typeof src !== 'string') throw new Error('transformDirectory: unexpected source');
|
|
86
87
|
if (typeof dest !== 'string') throw new Error('transformDirectory: unexpected destination directory');
|
|
87
88
|
if (typeof type !== 'string') throw new Error('transformDirectory: unexpected type');
|
|
88
|
-
var
|
|
89
|
-
var config = options.confg ? options.confg : _gettsconfigcompat.default.getTsconfig(_path.default.resolve(cwd, 'tsconfig.json'));
|
|
89
|
+
var config = options.confg ? options.confg : _gettsconfigcompat.default.getTsconfig(src);
|
|
90
90
|
var matcher = (0, _createMatcher.default)(config);
|
|
91
91
|
options = _object_spread_props(_object_spread({}, options), {
|
|
92
92
|
config: config
|
|
@@ -114,4 +114,4 @@ function transformDirectory(src, dest, type, options, callback) {
|
|
|
114
114
|
});
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
|
-
/* CJS INTEROP */ if (exports.__esModule && exports.default) {
|
|
117
|
+
/* 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]; }; module.exports = exports.default; } catch (_) {} }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["transformDirectory.mjs"],"sourcesContent":["import path from 'path';\nimport Iterator from 'fs-iterator';\nimport getTS from 'get-tsconfig-compat';\n\nimport createMatcher from './createMatcher.mjs';\nimport transformFile from './transformFile.mjs';\n\nfunction transformDirectoryCallback(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\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 const
|
|
1
|
+
{"version":3,"sources":["transformDirectory.mjs"],"sourcesContent":["import path from 'path';\nimport Iterator from 'fs-iterator';\nimport getTS from 'get-tsconfig-compat';\n\nimport createMatcher from './createMatcher.mjs';\nimport transformFile from './transformFile.mjs';\n\nfunction transformDirectoryCallback(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n\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 const config = options.confg ? options.confg : getTS.getTsconfig(src);\n const matcher = createMatcher(config);\n\n options = { ...options, config };\n const iterator = new Iterator(src);\n iterator.forEach(\n (entry, cb) => {\n if (!entry.stats.isFile()) return cb();\n if (!matcher(entry.fullPath)) return cb();\n transformFile(entry.fullPath, path.dirname(path.join(dest, entry.path)), type, options, cb);\n },\n { callbacks: true, concurrency: options.concurrency || 1024 },\n callback\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 transformDirectory(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\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","src","dest","type","options","callback","Error","config","confg","getTS","getTsconfig","matcher","createMatcher","iterator","Iterator","forEach","entry","cb","stats","isFile","fullPath","transformFile","path","dirname","join","callbacks","concurrency","Promise","resolve","reject","compileCallback","err","result"],"mappings":";;;;+BAkCA;;;;;;;CAOC,GACD;;;eAAwBA;;;2DA1CP;iEACI;wEACH;oEAEQ;oEACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,SAASC,2BAA2BC,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACpE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IAEtB,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIK,MAAM;IAC7C,IAAI,OAAOJ,SAAS,UAAU,MAAM,IAAII,MAAM;IAC9C,IAAI,OAAOH,SAAS,UAAU,MAAM,IAAIG,MAAM;IAE9C,IAAMC,SAASH,QAAQI,KAAK,GAAGJ,QAAQI,KAAK,GAAGC,0BAAK,CAACC,WAAW,CAACT;IACjE,IAAMU,UAAUC,IAAAA,sBAAa,EAACL;IAE9BH,UAAU,wCAAKA;QAASG,QAAAA;;IACxB,IAAMM,WAAW,IAAIC,mBAAQ,CAACb;IAC9BY,SAASE,OAAO,CACd,SAACC,OAAOC;QACN,IAAI,CAACD,MAAME,KAAK,CAACC,MAAM,IAAI,OAAOF;QAClC,IAAI,CAACN,QAAQK,MAAMI,QAAQ,GAAG,OAAOH;QACrCI,IAAAA,sBAAa,EAACL,MAAMI,QAAQ,EAAEE,aAAI,CAACC,OAAO,CAACD,aAAI,CAACE,IAAI,CAACtB,MAAMc,MAAMM,IAAI,IAAInB,MAAMC,SAASa;IAC1F,GACA;QAAEQ,WAAW;QAAMC,aAAatB,QAAQsB,WAAW,IAAI;IAAK,GAC5DrB;AAEJ;AAUe,SAASN,mBAAmBE,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC3E,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IAEtB,IAAI,OAAOC,aAAa,YAAY,OAAOL,2BAA2BC,KAAKC,MAAMC,MAAMC,SAASC;IAChG,OAAO,IAAIsB,QAAQ,SAACC,SAASC;QAC3B7B,2BAA2BC,KAAKC,MAAMC,MAAMC,SAAS,SAAS0B,gBAAgBC,GAAG,EAAEC,MAAM;YACvFD,MAAMF,OAAOE,OAAOH,QAAQI;QAC9B;IACF;AACF"}
|
|
@@ -107,6 +107,7 @@ function transformFileCallback(src, dest, type, options, callback) {
|
|
|
107
107
|
callback = options;
|
|
108
108
|
options = {};
|
|
109
109
|
}
|
|
110
|
+
options = options || {};
|
|
110
111
|
if (typeof src !== 'string') throw new Error('transformFile: unexpected source');
|
|
111
112
|
if (typeof dest !== 'string') throw new Error('transformFile: unexpected destination directory');
|
|
112
113
|
if (typeof type !== 'string') throw new Error('transformFile: unexpected type');
|
|
@@ -114,8 +115,7 @@ function transformFileCallback(src, dest, type, options, callback) {
|
|
|
114
115
|
if (err) return callback(err);
|
|
115
116
|
callback = (0, _calloncefn.default)(callback);
|
|
116
117
|
try {
|
|
117
|
-
var
|
|
118
|
-
var config = options.confg ? options.confg : _gettsconfigcompat.default.getTsconfig(_path.default.resolve(cwd, 'tsconfig.json'));
|
|
118
|
+
var config = options.confg ? options.confg : _gettsconfigcompat.default.getTsconfig(src);
|
|
119
119
|
// overrides for cjs
|
|
120
120
|
if (type === 'cjs') {
|
|
121
121
|
config = _object_spread({}, config);
|
|
@@ -165,4 +165,4 @@ function transformFile(src, dest, type, options, callback) {
|
|
|
165
165
|
});
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
-
/* CJS INTEROP */ if (exports.__esModule && exports.default) {
|
|
168
|
+
/* 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]; }; module.exports = exports.default; } catch (_) {} }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["transformFile.mjs"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport once from 'call-once-fn';\nimport getTS from 'get-tsconfig-compat';\nimport mkdirp from 'mkdirp';\nimport Queue from 'queue-cb';\n\nimport regexDependencies from './lib/regexDependencies.mjs';\nimport transformSync from './transformSync.cjs';\n\nconst regexESM = regexDependencies(true);\nconst regexCJS = regexDependencies();\n\nconst importReplaceMJS = ['.js', '.ts', '.tsx', '.mts', '.mjs'];\nconst importReplaceCJS = ['.cts'];\nconst requireReplaceJS = ['.mjs', '.cjs', '.ts', '.tsx', '.mts', '.cts'];\n\nfunction makeReplacements(code, regex, extensions, extension) {\n let matches = [];\n let match = regex.exec(code);\n while (match) {\n const dependency = match[1] || match[2] || match[3] || match[4];\n const ext = extensions.find((x) => dependency.slice(-x.length) === x);\n if (ext) matches.push({ ext, match, dependency });\n match = regex.exec(code);\n }\n\n matches = matches.reverse();\n for (const index in matches) {\n const match = matches[index];\n const start = match.match.index + match.match[0].indexOf(match.dependency) + match.dependency.indexOf(match.ext);\n code = code.substring(0, start) + extension + code.substring(start + match.ext.length);\n }\n return code;\n}\n\n// https://github.com/vercel/next.js/blob/20b63e13ab2631d6043277895d373aa31a1b327c/packages/next/taskfile-swc.js#L118-L125\nconst interopClientDefaultExport = \"/* 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]; }; module.exports = exports.default; } catch (_) {} }\";\n\nfunction transformFileCallback(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\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 fs.readFile(src, 'utf8', (err, contents) => {\n if (err) return callback(err);\n callback = once(callback);\n\n try {\n
|
|
1
|
+
{"version":3,"sources":["transformFile.mjs"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport once from 'call-once-fn';\nimport getTS from 'get-tsconfig-compat';\nimport mkdirp from 'mkdirp';\nimport Queue from 'queue-cb';\n\nimport regexDependencies from './lib/regexDependencies.mjs';\nimport transformSync from './transformSync.cjs';\n\nconst regexESM = regexDependencies(true);\nconst regexCJS = regexDependencies();\n\nconst importReplaceMJS = ['.js', '.ts', '.tsx', '.mts', '.mjs'];\nconst importReplaceCJS = ['.cts'];\nconst requireReplaceJS = ['.mjs', '.cjs', '.ts', '.tsx', '.mts', '.cts'];\n\nfunction makeReplacements(code, regex, extensions, extension) {\n let matches = [];\n let match = regex.exec(code);\n while (match) {\n const dependency = match[1] || match[2] || match[3] || match[4];\n const ext = extensions.find((x) => dependency.slice(-x.length) === x);\n if (ext) matches.push({ ext, match, dependency });\n match = regex.exec(code);\n }\n\n matches = matches.reverse();\n for (const index in matches) {\n const match = matches[index];\n const start = match.match.index + match.match[0].indexOf(match.dependency) + match.dependency.indexOf(match.ext);\n code = code.substring(0, start) + extension + code.substring(start + match.ext.length);\n }\n return code;\n}\n\n// https://github.com/vercel/next.js/blob/20b63e13ab2631d6043277895d373aa31a1b327c/packages/next/taskfile-swc.js#L118-L125\nconst interopClientDefaultExport = \"/* 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]; }; module.exports = exports.default; } catch (_) {} }\";\n\nfunction transformFileCallback(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n\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 fs.readFile(src, 'utf8', (err, contents) => {\n if (err) return callback(err);\n callback = once(callback);\n\n try {\n let config = options.confg ? options.confg : getTS.getTsconfig(src);\n\n // overrides for cjs\n if (type === 'cjs') {\n config = { ...config };\n config.config = { ...(config.config || {}) };\n config.config.compilerOptions = { ...(config.config.compilerOptions || {}) };\n config.config.compilerOptions.module = 'CommonJS';\n config.config.compilerOptions.target = 'ES5';\n }\n\n const basename = path.basename(src);\n const output = transformSync(contents, basename, config);\n\n // infer extension and patch .mjs imports\n let ext = path.extname(basename);\n if (type === 'esm') {\n ext = importReplaceMJS.indexOf(ext) >= 0 ? '.mjs' : ext;\n output.code = makeReplacements(output.code, regexESM, importReplaceMJS, '.mjs');\n ext = importReplaceCJS.indexOf(ext) >= 0 ? '.cjs' : ext;\n output.code = makeReplacements(output.code, regexESM, importReplaceCJS, '.cjs');\n } else {\n ext = requireReplaceJS.indexOf(ext) >= 0 ? '.js' : ext;\n output.code = makeReplacements(output.code, regexCJS, requireReplaceJS, '.js');\n output.code += interopClientDefaultExport;\n }\n const destFilePath = path.join(dest, basename.replace(/\\.[^/.]+$/, '') + ext);\n\n mkdirp(path.dirname(destFilePath), () => {\n const queue = new Queue();\n queue.defer(fs.writeFile.bind(null, destFilePath, output.code, 'utf8'));\n !options.sourceMaps || queue.defer(fs.writeFile.bind(null, `${destFilePath}.map`, output.map, 'utf8'));\n queue.await(() => (err ? callback(err) : callback(null, destFilePath)));\n });\n } catch (err) {\n callback(err);\n }\n });\n}\n\n/**\n * @param {string} src The source directory to traverse.\n * @param {string} dest The output directory to write the file 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 | null, destFilePath: string) =>} [callback] Optional callback returing the path to the transformed file. Uses promise if callback not provided.\n * @returns {void | Promise<string>} Optional promise returing the path to the transformed file 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\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","regexESM","regexDependencies","regexCJS","importReplaceMJS","importReplaceCJS","requireReplaceJS","makeReplacements","code","regex","extensions","extension","dependency","match","ext","find","x","slice","length","matches","push","exec","reverse","index","start","indexOf","substring","interopClientDefaultExport","transformFileCallback","src","dest","type","options","callback","Error","fs","readFile","err","contents","once","config","confg","getTS","getTsconfig","compilerOptions","module","target","basename","path","output","transformSync","extname","destFilePath","join","replace","mkdirp","dirname","queue","Queue","defer","writeFile","bind","sourceMaps","map","await","Promise","resolve","reject","compileCallback","result"],"mappings":";;;;+BA+FA;;;;;;;CAOC,GACD;;;eAAwBA;;;yDAvGT;2DACE;iEACA;wEACC;6DACC;8DACD;wEAEY;uEACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,IAAMC,WAAWC,IAAAA,0BAAiB,EAAC;AACnC,IAAMC,WAAWD,IAAAA,0BAAiB;AAElC,IAAME,mBAAmB;IAAC;IAAO;IAAO;IAAQ;IAAQ;CAAO;AAC/D,IAAMC,mBAAmB;IAAC;CAAO;AACjC,IAAMC,mBAAmB;IAAC;IAAQ;IAAQ;IAAO;IAAQ;IAAQ;CAAO;AAExE,SAASC,iBAAiBC,IAAI,EAAEC,KAAK,EAAEC,UAAU,EAAEC,SAAS;;QAIxD,IAAMC,aAAaC,KAAK,CAAC,EAAE,IAAIA,KAAK,CAAC,EAAE,IAAIA,KAAK,CAAC,EAAE,IAAIA,KAAK,CAAC,EAAE;QAC/D,IAAMC,MAAMJ,WAAWK,IAAI,CAAC,SAACC;mBAAMJ,WAAWK,KAAK,CAAC,CAACD,EAAEE,MAAM,MAAMF;;QACnE,IAAIF,KAAKK,QAAQC,IAAI,CAAC;YAAEN,KAAAA;YAAKD,OAAAA;YAAOD,YAAAA;QAAW;QAC/CC,QAAQJ,MAAMY,IAAI,CAACb;IACrB;IAPA,IAAIW,UAAU,EAAE;IAChB,IAAIN,QAAQJ,MAAMY,IAAI,CAAC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AO3B,MAAMJ,SAASI,OAAOJ,SAAS,MAAMmB;;YAC1D;QACF,EAAE,OAAOf,KAAK;YACZJ,SAASI;QACX;IACF;AACF;AAUe,SAASrC,cAAc6B,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACtE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IAEtB,IAAI,OAAOC,aAAa,YAAY,OAAOL,sBAAsBC,KAAKC,MAAMC,MAAMC,SAASC;IAC3F,OAAO,IAAIgC,QAAQ,SAACC,SAASC;QAC3BvC,sBAAsBC,KAAKC,MAAMC,MAAMC,SAAS,SAASoC,gBAAgB/B,GAAG,EAAEgC,MAAM;YAClFhC,MAAM8B,OAAO9B,OAAO6B,QAAQG;QAC9B;IACF;AACF"}
|
|
@@ -12,4 +12,4 @@ var call = null; // break dependencies
|
|
|
12
12
|
if (!call) call = require('node-version-call'); // break dependencies
|
|
13
13
|
return call(version, worker, contents, fileName, config);
|
|
14
14
|
};
|
|
15
|
-
/* CJS INTEROP */ if (exports.__esModule && exports.default) {
|
|
15
|
+
/* 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]; }; module.exports = exports.default; } catch (_) {} }
|
|
@@ -21,4 +21,4 @@ module.exports = function transformSync(contents, fileName, config) {
|
|
|
21
21
|
map: res.sourceMapText
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
-
/* CJS INTEROP */ if (exports.__esModule && exports.default) {
|
|
24
|
+
/* 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]; }; module.exports = exports.default; } catch (_) {} }
|
|
@@ -8,11 +8,11 @@ function transformDirectoryCallback(src, dest, type, options, callback) {
|
|
|
8
8
|
callback = options;
|
|
9
9
|
options = {};
|
|
10
10
|
}
|
|
11
|
+
options = options || {};
|
|
11
12
|
if (typeof src !== 'string') throw new Error('transformDirectory: unexpected source');
|
|
12
13
|
if (typeof dest !== 'string') throw new Error('transformDirectory: unexpected destination directory');
|
|
13
14
|
if (typeof type !== 'string') throw new Error('transformDirectory: unexpected type');
|
|
14
|
-
const
|
|
15
|
-
const config = options.confg ? options.confg : getTS.getTsconfig(path.resolve(cwd, 'tsconfig.json'));
|
|
15
|
+
const config = options.confg ? options.confg : getTS.getTsconfig(src);
|
|
16
16
|
const matcher = createMatcher(config);
|
|
17
17
|
options = {
|
|
18
18
|
...options,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["transformDirectory.mjs"],"sourcesContent":["import path from 'path';\nimport Iterator from 'fs-iterator';\nimport getTS from 'get-tsconfig-compat';\n\nimport createMatcher from './createMatcher.mjs';\nimport transformFile from './transformFile.mjs';\n\nfunction transformDirectoryCallback(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\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 const
|
|
1
|
+
{"version":3,"sources":["transformDirectory.mjs"],"sourcesContent":["import path from 'path';\nimport Iterator from 'fs-iterator';\nimport getTS from 'get-tsconfig-compat';\n\nimport createMatcher from './createMatcher.mjs';\nimport transformFile from './transformFile.mjs';\n\nfunction transformDirectoryCallback(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n\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 const config = options.confg ? options.confg : getTS.getTsconfig(src);\n const matcher = createMatcher(config);\n\n options = { ...options, config };\n const iterator = new Iterator(src);\n iterator.forEach(\n (entry, cb) => {\n if (!entry.stats.isFile()) return cb();\n if (!matcher(entry.fullPath)) return cb();\n transformFile(entry.fullPath, path.dirname(path.join(dest, entry.path)), type, options, cb);\n },\n { callbacks: true, concurrency: options.concurrency || 1024 },\n callback\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 transformDirectory(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\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":["path","Iterator","getTS","createMatcher","transformFile","transformDirectoryCallback","src","dest","type","options","callback","Error","config","confg","getTsconfig","matcher","iterator","forEach","entry","cb","stats","isFile","fullPath","dirname","join","callbacks","concurrency","transformDirectory","Promise","resolve","reject","compileCallback","err","result"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,cAAc,cAAc;AACnC,OAAOC,WAAW,sBAAsB;AAExC,OAAOC,mBAAmB,sBAAsB;AAChD,OAAOC,mBAAmB,sBAAsB;AAEhD,SAASC,2BAA2BC,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACpE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IAEtB,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIK,MAAM;IAC7C,IAAI,OAAOJ,SAAS,UAAU,MAAM,IAAII,MAAM;IAC9C,IAAI,OAAOH,SAAS,UAAU,MAAM,IAAIG,MAAM;IAE9C,MAAMC,SAASH,QAAQI,KAAK,GAAGJ,QAAQI,KAAK,GAAGX,MAAMY,WAAW,CAACR;IACjE,MAAMS,UAAUZ,cAAcS;IAE9BH,UAAU;QAAE,GAAGA,OAAO;QAAEG;IAAO;IAC/B,MAAMI,WAAW,IAAIf,SAASK;IAC9BU,SAASC,OAAO,CACd,CAACC,OAAOC;QACN,IAAI,CAACD,MAAME,KAAK,CAACC,MAAM,IAAI,OAAOF;QAClC,IAAI,CAACJ,QAAQG,MAAMI,QAAQ,GAAG,OAAOH;QACrCf,cAAcc,MAAMI,QAAQ,EAAEtB,KAAKuB,OAAO,CAACvB,KAAKwB,IAAI,CAACjB,MAAMW,MAAMlB,IAAI,IAAIQ,MAAMC,SAASU;IAC1F,GACA;QAAEM,WAAW;QAAMC,aAAajB,QAAQiB,WAAW,IAAI;IAAK,GAC5DhB;AAEJ;AAEA;;;;;;;CAOC,GACD,eAAe,SAASiB,mBAAmBrB,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC3E,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IAEtB,IAAI,OAAOC,aAAa,YAAY,OAAOL,2BAA2BC,KAAKC,MAAMC,MAAMC,SAASC;IAChG,OAAO,IAAIkB,QAAQ,CAACC,SAASC;QAC3BzB,2BAA2BC,KAAKC,MAAMC,MAAMC,SAAS,SAASsB,gBAAgBC,GAAG,EAAEC,MAAM;YACvFD,MAAMF,OAAOE,OAAOH,QAAQI;QAC9B;IACF;AACF"}
|
|
@@ -54,6 +54,7 @@ function transformFileCallback(src, dest, type, options, callback) {
|
|
|
54
54
|
callback = options;
|
|
55
55
|
options = {};
|
|
56
56
|
}
|
|
57
|
+
options = options || {};
|
|
57
58
|
if (typeof src !== 'string') throw new Error('transformFile: unexpected source');
|
|
58
59
|
if (typeof dest !== 'string') throw new Error('transformFile: unexpected destination directory');
|
|
59
60
|
if (typeof type !== 'string') throw new Error('transformFile: unexpected type');
|
|
@@ -61,8 +62,7 @@ function transformFileCallback(src, dest, type, options, callback) {
|
|
|
61
62
|
if (err) return callback(err);
|
|
62
63
|
callback = once(callback);
|
|
63
64
|
try {
|
|
64
|
-
|
|
65
|
-
let config = options.confg ? options.confg : getTS.getTsconfig(path.resolve(cwd, 'tsconfig.json'));
|
|
65
|
+
let config = options.confg ? options.confg : getTS.getTsconfig(src);
|
|
66
66
|
// overrides for cjs
|
|
67
67
|
if (type === 'cjs') {
|
|
68
68
|
config = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["transformFile.mjs"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport once from 'call-once-fn';\nimport getTS from 'get-tsconfig-compat';\nimport mkdirp from 'mkdirp';\nimport Queue from 'queue-cb';\n\nimport regexDependencies from './lib/regexDependencies.mjs';\nimport transformSync from './transformSync.cjs';\n\nconst regexESM = regexDependencies(true);\nconst regexCJS = regexDependencies();\n\nconst importReplaceMJS = ['.js', '.ts', '.tsx', '.mts', '.mjs'];\nconst importReplaceCJS = ['.cts'];\nconst requireReplaceJS = ['.mjs', '.cjs', '.ts', '.tsx', '.mts', '.cts'];\n\nfunction makeReplacements(code, regex, extensions, extension) {\n let matches = [];\n let match = regex.exec(code);\n while (match) {\n const dependency = match[1] || match[2] || match[3] || match[4];\n const ext = extensions.find((x) => dependency.slice(-x.length) === x);\n if (ext) matches.push({ ext, match, dependency });\n match = regex.exec(code);\n }\n\n matches = matches.reverse();\n for (const index in matches) {\n const match = matches[index];\n const start = match.match.index + match.match[0].indexOf(match.dependency) + match.dependency.indexOf(match.ext);\n code = code.substring(0, start) + extension + code.substring(start + match.ext.length);\n }\n return code;\n}\n\n// https://github.com/vercel/next.js/blob/20b63e13ab2631d6043277895d373aa31a1b327c/packages/next/taskfile-swc.js#L118-L125\nconst interopClientDefaultExport = \"/* 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]; }; module.exports = exports.default; } catch (_) {} }\";\n\nfunction transformFileCallback(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\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 fs.readFile(src, 'utf8', (err, contents) => {\n if (err) return callback(err);\n callback = once(callback);\n\n try {\n
|
|
1
|
+
{"version":3,"sources":["transformFile.mjs"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport once from 'call-once-fn';\nimport getTS from 'get-tsconfig-compat';\nimport mkdirp from 'mkdirp';\nimport Queue from 'queue-cb';\n\nimport regexDependencies from './lib/regexDependencies.mjs';\nimport transformSync from './transformSync.cjs';\n\nconst regexESM = regexDependencies(true);\nconst regexCJS = regexDependencies();\n\nconst importReplaceMJS = ['.js', '.ts', '.tsx', '.mts', '.mjs'];\nconst importReplaceCJS = ['.cts'];\nconst requireReplaceJS = ['.mjs', '.cjs', '.ts', '.tsx', '.mts', '.cts'];\n\nfunction makeReplacements(code, regex, extensions, extension) {\n let matches = [];\n let match = regex.exec(code);\n while (match) {\n const dependency = match[1] || match[2] || match[3] || match[4];\n const ext = extensions.find((x) => dependency.slice(-x.length) === x);\n if (ext) matches.push({ ext, match, dependency });\n match = regex.exec(code);\n }\n\n matches = matches.reverse();\n for (const index in matches) {\n const match = matches[index];\n const start = match.match.index + match.match[0].indexOf(match.dependency) + match.dependency.indexOf(match.ext);\n code = code.substring(0, start) + extension + code.substring(start + match.ext.length);\n }\n return code;\n}\n\n// https://github.com/vercel/next.js/blob/20b63e13ab2631d6043277895d373aa31a1b327c/packages/next/taskfile-swc.js#L118-L125\nconst interopClientDefaultExport = \"/* 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]; }; module.exports = exports.default; } catch (_) {} }\";\n\nfunction transformFileCallback(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n\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 fs.readFile(src, 'utf8', (err, contents) => {\n if (err) return callback(err);\n callback = once(callback);\n\n try {\n let config = options.confg ? options.confg : getTS.getTsconfig(src);\n\n // overrides for cjs\n if (type === 'cjs') {\n config = { ...config };\n config.config = { ...(config.config || {}) };\n config.config.compilerOptions = { ...(config.config.compilerOptions || {}) };\n config.config.compilerOptions.module = 'CommonJS';\n config.config.compilerOptions.target = 'ES5';\n }\n\n const basename = path.basename(src);\n const output = transformSync(contents, basename, config);\n\n // infer extension and patch .mjs imports\n let ext = path.extname(basename);\n if (type === 'esm') {\n ext = importReplaceMJS.indexOf(ext) >= 0 ? '.mjs' : ext;\n output.code = makeReplacements(output.code, regexESM, importReplaceMJS, '.mjs');\n ext = importReplaceCJS.indexOf(ext) >= 0 ? '.cjs' : ext;\n output.code = makeReplacements(output.code, regexESM, importReplaceCJS, '.cjs');\n } else {\n ext = requireReplaceJS.indexOf(ext) >= 0 ? '.js' : ext;\n output.code = makeReplacements(output.code, regexCJS, requireReplaceJS, '.js');\n output.code += interopClientDefaultExport;\n }\n const destFilePath = path.join(dest, basename.replace(/\\.[^/.]+$/, '') + ext);\n\n mkdirp(path.dirname(destFilePath), () => {\n const queue = new Queue();\n queue.defer(fs.writeFile.bind(null, destFilePath, output.code, 'utf8'));\n !options.sourceMaps || queue.defer(fs.writeFile.bind(null, `${destFilePath}.map`, output.map, 'utf8'));\n queue.await(() => (err ? callback(err) : callback(null, destFilePath)));\n });\n } catch (err) {\n callback(err);\n }\n });\n}\n\n/**\n * @param {string} src The source directory to traverse.\n * @param {string} dest The output directory to write the file 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 | null, destFilePath: string) =>} [callback] Optional callback returing the path to the transformed file. Uses promise if callback not provided.\n * @returns {void | Promise<string>} Optional promise returing the path to the transformed file 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\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":["fs","path","once","getTS","mkdirp","Queue","regexDependencies","transformSync","regexESM","regexCJS","importReplaceMJS","importReplaceCJS","requireReplaceJS","makeReplacements","code","regex","extensions","extension","matches","match","exec","dependency","ext","find","x","slice","length","push","reverse","index","start","indexOf","substring","interopClientDefaultExport","transformFileCallback","src","dest","type","options","callback","Error","readFile","err","contents","config","confg","getTsconfig","compilerOptions","module","target","basename","output","extname","destFilePath","join","replace","dirname","queue","defer","writeFile","bind","sourceMaps","map","await","transformFile","Promise","resolve","reject","compileCallback","result"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,UAAU,eAAe;AAChC,OAAOC,WAAW,sBAAsB;AACxC,OAAOC,YAAY,SAAS;AAC5B,OAAOC,WAAW,WAAW;AAE7B,OAAOC,uBAAuB,8BAA8B;AAC5D,OAAOC,mBAAmB,sBAAsB;AAEhD,MAAMC,WAAWF,kBAAkB;AACnC,MAAMG,WAAWH;AAEjB,MAAMI,mBAAmB;IAAC;IAAO;IAAO;IAAQ;IAAQ;CAAO;AAC/D,MAAMC,mBAAmB;IAAC;CAAO;AACjC,MAAMC,mBAAmB;IAAC;IAAQ;IAAQ;IAAO;IAAQ;IAAQ;CAAO;AAExE,SAASC,iBAAiBC,IAAI,EAAEC,KAAK,EAAEC,UAAU,EAAEC,SAAS;IAC1D,IA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Aa,MAAMjC;YAEzElB,OAAOH,KAAKuD,OAAO,CAACH,eAAe;gBACjC,MAAMI,QAAQ,IAAIpD;gBAClBoD,MAAMC,KAAK,CAAC1D,GAAG2D,SAAS,CAACC,IAAI,CAAC,MAAMP,cAAcF,OAAOrC,IAAI,EAAE;gBAC/D,CAACwB,QAAQuB,UAAU,IAAIJ,MAAMC,KAAK,CAAC1D,GAAG2D,SAAS,CAACC,IAAI,CAAC,MAAM,GAAGP,aAAa,IAAI,CAAC,EAAEF,OAAOW,GAAG,EAAE;gBAC9FL,MAAMM,KAAK,CAAC,IAAOrB,MAAMH,SAASG,OAAOH,SAAS,MAAMc;YAC1D;QACF,EAAE,OAAOX,KAAK;YACZH,SAASG;QACX;IACF;AACF;AAEA;;;;;;;CAOC,GACD,eAAe,SAASsB,cAAc7B,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACtE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IAEtB,IAAI,OAAOC,aAAa,YAAY,OAAOL,sBAAsBC,KAAKC,MAAMC,MAAMC,SAASC;IAC3F,OAAO,IAAI0B,QAAQ,CAACC,SAASC;QAC3BjC,sBAAsBC,KAAKC,MAAMC,MAAMC,SAAS,SAAS8B,gBAAgB1B,GAAG,EAAE2B,MAAM;YAClF3B,MAAMyB,OAAOzB,OAAOwB,QAAQG;QAC9B;IACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-swc-transform",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Typescript transformers for swc. Supports Node >= 0.8",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"matcher",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"queue-cb": "^1.2.1",
|
|
73
73
|
"react": "^18.3.1",
|
|
74
74
|
"rimraf2": "^2.8.2",
|
|
75
|
-
"ts-dev-stack": "^0.
|
|
75
|
+
"ts-dev-stack": "^0.19.0",
|
|
76
76
|
"ts-node": "^10.8.2",
|
|
77
77
|
"typescript": "^5.7.2"
|
|
78
78
|
},
|