ts-swc-transform 1.12.4 → 1.12.6

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.
@@ -70,7 +70,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
70
70
  var _default = _installBindings.default;
71
71
  var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
72
72
  var __dirname = _path.default.dirname(typeof __filename === 'undefined' ? _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()) : __filename);
73
- var workerPath = _path.default.resolve(__dirname, '..', '..', 'cjs', 'workers', 'installBindings.cjs');
73
+ var workerPath = _path.default.join(__dirname, '..', '..', 'cjs', 'workers', 'installBindings.cjs');
74
74
  var major = +process.versions.node.split('.')[0];
75
75
  var version = major < 14 ? 'stable' : 'local';
76
76
  var callLazy = (0, _lazycache.default)(_require)('node-version-call');
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/installBindings.ts"],"sourcesContent":["import installBindings, { isInstalled } from '../workers/installBindings';\nexport default installBindings;\n\nimport path from 'path';\nimport url from 'url';\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.resolve(__dirname, '..', '..', 'cjs', 'workers', 'installBindings.cjs');\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\n\nconst callLazy = lazy(_require)('node-version-call');\nconst install = lazy((target) => {\n return isInstalled(target) ? target : callLazy()({ version, callbacks: true }, workerPath, target);\n});\n\nexport const sync = (target) => install(target)();\n"],"names":["sync","installBindings","_require","require","Module","createRequire","__dirname","path","dirname","__filename","url","fileURLToPath","workerPath","resolve","major","process","versions","node","split","version","callLazy","lazy","install","target","isInstalled","callbacks"],"mappings":";;;;;;;;;;;IACA,OAA+B;eAA/B;;IAkBaA,IAAI;eAAJA;;;uEAnBgC;2DAG5B;0DACD;6DAEG;gEACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IANjB,WAAeC,wBAAe;AAO9B,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,aAAaL,aAAI,CAACM,OAAO,CAACP,WAAW,MAAM,MAAM,OAAO,WAAW;AACzE,IAAMQ,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,UAAUL,QAAQ,KAAK,WAAW;AAExC,IAAMM,WAAWC,IAAAA,kBAAI,EAACnB,UAAU;AAChC,IAAMoB,UAAUD,IAAAA,kBAAI,EAAC,SAACE;IACpB,OAAOC,IAAAA,4BAAW,EAACD,UAAUA,SAASH,WAAW;QAAED,SAAAA;QAASM,WAAW;IAAK,GAAGb,YAAYW;AAC7F;AAEO,IAAMvB,OAAO,SAACuB;WAAWD,QAAQC"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/installBindings.ts"],"sourcesContent":["import installBindings, { isInstalled } from '../workers/installBindings';\nexport default installBindings;\n\nimport path from 'path';\nimport url from 'url';\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', '..', 'cjs', 'workers', 'installBindings.cjs');\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\n\nconst callLazy = lazy(_require)('node-version-call');\nconst install = lazy((target) => {\n return isInstalled(target) ? target : callLazy()({ version, callbacks: true }, workerPath, target);\n});\n\nexport const sync = (target) => install(target)();\n"],"names":["sync","installBindings","_require","require","Module","createRequire","__dirname","path","dirname","__filename","url","fileURLToPath","workerPath","join","major","process","versions","node","split","version","callLazy","lazy","install","target","isInstalled","callbacks"],"mappings":";;;;;;;;;;;IACA,OAA+B;eAA/B;;IAkBaA,IAAI;eAAJA;;;uEAnBgC;2DAG5B;0DACD;6DAEG;gEACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IANjB,WAAeC,wBAAe;AAO9B,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,aAAaL,aAAI,CAACM,IAAI,CAACP,WAAW,MAAM,MAAM,OAAO,WAAW;AACtE,IAAMQ,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,UAAUL,QAAQ,KAAK,WAAW;AAExC,IAAMM,WAAWC,IAAAA,kBAAI,EAACnB,UAAU;AAChC,IAAMoB,UAAUD,IAAAA,kBAAI,EAAC,SAACE;IACpB,OAAOC,IAAAA,4BAAW,EAACD,UAAUA,SAASH,WAAW;QAAED,SAAAA;QAASM,WAAW;IAAK,GAAGb,YAAYW;AAC7F;AAEO,IAAMvB,OAAO,SAACuB;WAAWD,QAAQC"}
@@ -36,7 +36,7 @@ function toPath(specifier, context) {
36
36
  if ((0, _isabsolute.default)(specifier)) return specifier;
37
37
  if (specifier[0] === '.') {
38
38
  var parentPath = context ? getParentPath(context) : process.cwd();
39
- return _path.default.resolve(parentPath, specifier);
39
+ return _path.default.join(parentPath, specifier);
40
40
  }
41
41
  if (_constants.moduleRegEx.test(specifier)) {
42
42
  var parentPath1 = context ? getParentPath(context) : process.cwd();
@@ -58,11 +58,11 @@ function toPath(specifier, context) {
58
58
  }
59
59
  });
60
60
  if (!pkg || !pkg.json.module) return main; // no modules, use main
61
- if (pkg.json.name === specifier) return _path.default.resolve(pkg.dir, pkg.json.module); // the module
61
+ if (pkg.json.name === specifier) return _path.default.join(pkg.dir, pkg.json.module); // the module
62
62
  // a relative path. Only accept if it doesn't break the relative naming and it exists
63
- var modulePath = _path.default.resolve(pkg.dir, pkg.json.module);
64
- var mainPath = _path.default.resolve(pkg.dir, pkg.json.main);
65
- var moduleResolved = _path.default.resolve(modulePath, _path.default.relative(mainPath, main));
63
+ var modulePath = _path.default.join(pkg.dir, pkg.json.module);
64
+ var mainPath = _path.default.join(pkg.dir, pkg.json.main);
65
+ var moduleResolved = _path.default.join(modulePath, _path.default.relative(mainPath, main));
66
66
  return moduleResolved.indexOf(specifier.replace(pkg.json.name, '')) < 0 || !existsSync(moduleResolved) ? main : moduleResolved;
67
67
  }
68
68
  return specifier;
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport isAbsolute from 'is-absolute';\nimport resolve from 'resolve';\nimport { moduleRegEx } from './constants';\nimport fileURLToPath from './lib/fileURLToPath';\nimport type { Context } from './types';\n\nconst existsSync = (test) => {\n try {\n (fs.accessSync || fs.statSync)(test);\n return true;\n } catch (_) {\n return false;\n }\n};\n\nfunction getParentPath(context: Context) {\n if (context.parentPath) return path.dirname(context.parentPath);\n return context.parentURL ? path.dirname(toPath(context.parentURL)) : process.cwd();\n}\n\nexport default function toPath(specifier: string, context?: Context) {\n if (specifier.startsWith('file:')) return fileURLToPath(specifier);\n if (isAbsolute(specifier)) return specifier;\n if (specifier[0] === '.') {\n const parentPath = context ? getParentPath(context) : process.cwd();\n return path.resolve(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n\n let pkg = null;\n const main = resolve.sync(specifier, {\n basedir: parentPath,\n extensions: ['.js', '.json', '.node', '.mjs'],\n packageFilter(json, dir) {\n pkg = { json, dir };\n return json;\n },\n });\n if (!pkg || !pkg.json.module) return main; // no modules, use main\n if (pkg.json.name === specifier) return path.resolve(pkg.dir, pkg.json.module); // the module\n\n // a relative path. Only accept if it doesn't break the relative naming and it exists\n const modulePath = path.resolve(pkg.dir, pkg.json.module);\n const mainPath = path.resolve(pkg.dir, pkg.json.main);\n const moduleResolved = path.resolve(modulePath, path.relative(mainPath, main));\n return moduleResolved.indexOf(specifier.replace(pkg.json.name, '')) < 0 || !existsSync(moduleResolved) ? main : moduleResolved;\n }\n\n return specifier;\n}\n"],"names":["toPath","existsSync","test","fs","accessSync","statSync","_","getParentPath","context","parentPath","path","dirname","parentURL","process","cwd","specifier","startsWith","fileURLToPath","isAbsolute","resolve","moduleRegEx","pkg","main","sync","basedir","extensions","packageFilter","json","dir","module","name","modulePath","mainPath","moduleResolved","relative","indexOf","replace"],"mappings":";;;;+BAsBA;;;eAAwBA;;;yDAtBT;2DACE;iEACM;8DACH;yBACQ;oEACF;;;;;;AAG1B,IAAMC,aAAa,SAACC;IAClB,IAAI;QACDC,CAAAA,WAAE,CAACC,UAAU,IAAID,WAAE,CAACE,QAAQ,AAAD,EAAGH;QAC/B,OAAO;IACT,EAAE,OAAOI,GAAG;QACV,OAAO;IACT;AACF;AAEA,SAASC,cAAcC,OAAgB;IACrC,IAAIA,QAAQC,UAAU,EAAE,OAAOC,aAAI,CAACC,OAAO,CAACH,QAAQC,UAAU;IAC9D,OAAOD,QAAQI,SAAS,GAAGF,aAAI,CAACC,OAAO,CAACX,OAAOQ,QAAQI,SAAS,KAAKC,QAAQC,GAAG;AAClF;AAEe,SAASd,OAAOe,SAAiB,EAAEP,OAAiB;IACjE,IAAIO,UAAUC,UAAU,CAAC,UAAU,OAAOC,IAAAA,sBAAa,EAACF;IACxD,I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":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport isAbsolute from 'is-absolute';\nimport resolve from 'resolve';\nimport { moduleRegEx } from './constants';\nimport fileURLToPath from './lib/fileURLToPath';\nimport type { Context } from './types';\n\nconst existsSync = (test) => {\n try {\n (fs.accessSync || fs.statSync)(test);\n return true;\n } catch (_) {\n return false;\n }\n};\n\nfunction getParentPath(context: Context) {\n if (context.parentPath) return path.dirname(context.parentPath);\n return context.parentURL ? path.dirname(toPath(context.parentURL)) : process.cwd();\n}\n\nexport default function toPath(specifier: string, context?: Context) {\n if (specifier.startsWith('file:')) return fileURLToPath(specifier);\n if (isAbsolute(specifier)) return specifier;\n if (specifier[0] === '.') {\n const parentPath = context ? getParentPath(context) : process.cwd();\n return path.join(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n\n let pkg = null;\n const main = resolve.sync(specifier, {\n basedir: parentPath,\n extensions: ['.js', '.json', '.node', '.mjs'],\n packageFilter(json, dir) {\n pkg = { json, dir };\n return json;\n },\n });\n if (!pkg || !pkg.json.module) return main; // no modules, use main\n if (pkg.json.name === specifier) return path.join(pkg.dir, pkg.json.module); // the module\n\n // a relative path. Only accept if it doesn't break the relative naming and it exists\n const modulePath = path.join(pkg.dir, pkg.json.module);\n const mainPath = path.join(pkg.dir, pkg.json.main);\n const moduleResolved = path.join(modulePath, path.relative(mainPath, main));\n return moduleResolved.indexOf(specifier.replace(pkg.json.name, '')) < 0 || !existsSync(moduleResolved) ? main : moduleResolved;\n }\n\n return specifier;\n}\n"],"names":["toPath","existsSync","test","fs","accessSync","statSync","_","getParentPath","context","parentPath","path","dirname","parentURL","process","cwd","specifier","startsWith","fileURLToPath","isAbsolute","join","moduleRegEx","pkg","main","resolve","sync","basedir","extensions","packageFilter","json","dir","module","name","modulePath","mainPath","moduleResolved","relative","indexOf","replace"],"mappings":";;;;+B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hB,WAAW,OAAOL,aAAI,CAACS,IAAI,CAACE,IAAIQ,GAAG,EAAER,IAAIO,IAAI,CAACE,MAAM,GAAG,aAAa;QAE1F,qFAAqF;QACrF,IAAME,aAAatB,aAAI,CAACS,IAAI,CAACE,IAAIQ,GAAG,EAAER,IAAIO,IAAI,CAACE,MAAM;QACrD,IAAMG,WAAWvB,aAAI,CAACS,IAAI,CAACE,IAAIQ,GAAG,EAAER,IAAIO,IAAI,CAACN,IAAI;QACjD,IAAMY,iBAAiBxB,aAAI,CAACS,IAAI,CAACa,YAAYtB,aAAI,CAACyB,QAAQ,CAACF,UAAUX;QACrE,OAAOY,eAAeE,OAAO,CAACrB,UAAUsB,OAAO,CAAChB,IAAIO,IAAI,CAACG,IAAI,EAAE,OAAO,KAAK,CAAC9B,WAAWiC,kBAAkBZ,OAAOY;IAClH;IAEA,OAAOnB;AACT"}
@@ -56,7 +56,7 @@ function _object_spread(target) {
56
56
  var major = +process.versions.node.split('.')[0];
57
57
  var version = major < 14 ? 'stable' : 'local';
58
58
  var __dirname = _path.default.dirname(typeof __filename === 'undefined' ? _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()) : __filename);
59
- var workerPath = _path.default.resolve(__dirname, '..', 'cjs', 'workers', 'transformDirectory.cjs');
59
+ var workerPath = _path.default.join(__dirname, '..', 'cjs', 'workers', 'transformDirectory.cjs');
60
60
  var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
61
61
  var callLazy = (0, _lazycache.default)(_require)('node-version-call');
62
62
  var workerLazy = (0, _lazycache.default)(_require)(workerPath);
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformDirectory.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport loadTsConfig from './loadTsConfig';\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.resolve(__dirname, '..', 'cjs', 'workers', 'transformDirectory.cjs');\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst callLazy = lazy(_require)('node-version-call');\nconst workerLazy = lazy(_require)(workerPath);\n\nfunction dispatch(version, src, dest, type, options, callback) {\n if (version === 'local') return workerLazy()(src, dest, type, options, callback);\n try {\n callback(null, callLazy()({ version, callbacks: true }, workerPath, src, dest, type, options));\n } catch (err) {\n callback(err);\n }\n}\n\nimport type { ConfigOptions, TransformDirectoryCallback } from './types';\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: string, dest: string, type: string, options?: ConfigOptions | TransformDirectoryCallback, callback?: TransformDirectoryCallback): undefined | Promise<string[]> {\n try {\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 options === 'function') {\n callback = options as TransformDirectoryCallback;\n options = null;\n }\n options = options || {};\n const tsconfig = loadTsConfig({ cwd: src, ...options }, 'transformDirectory');\n options = { tsconfig, ...options };\n\n if (typeof callback === 'function') return dispatch(version, src, dest, type, options, callback);\n return new Promise((resolve, reject) => dispatch(version, src, dest, type, options, (err, result) => (err ? reject(err) : resolve(result))));\n } catch (err) {\n console.log(err);\n if (callback) callback(err);\n else return Promise.reject(err);\n }\n}\n"],"names":["transformDirectory","major","process","versions","node","split","version","__dirname","path","dirname","__filename","url","fileURLToPath","workerPath","resolve","_require","require","Module","createRequire","callLazy","lazy","workerLazy","dispatch","src","dest","type","options","callback","callbacks","err","Error","tsconfig","loadTsConfig","cwd","Promise","reject","result","console","log"],"mappings":";;;;+BAyBA;;;;;;;CAOC,GACD;;;eAAwBA;;;2DAjCP;0DACD;mEACS;6DAON;gEACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AANjB,IAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,UAAUL,QAAQ,KAAK,WAAW;AACxC,IAAMM,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,aAAaL,aAAI,CAACM,OAAO,CAACP,WAAW,MAAM,OAAO,WAAW;AAInE,IAAMQ,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,WAAWC,IAAAA,kBAAI,EAACL,UAAU;AAChC,IAAMM,aAAaD,IAAAA,kBAAI,EAACL,UAAUF;AAElC,SAASS,SAAShB,OAAO,EAAEiB,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC3D,IAAIrB,YAAY,SAAS,OAAOe,aAAaE,KAAKC,MAAMC,MAAMC,SAASC;IACvE,IAAI;QACFA,SAAS,MAAMR,WAAW;YAAEb,SAAAA;YAASsB,WAAW;QAAK,GAAGf,YAAYU,KAAKC,MAAMC,MAAMC;IACvF,EAAE,OAAOG,KAAK;QACZF,SAASE;IACX;AACF;AAWe,SAAS7B,mBAAmBuB,GAAW,EAAEC,IAAY,EAAEC,IAAY,EAAEC,OAAoD,EAAEC,QAAqC;IAC7K,IAAI;QACF,IAAI,OAAOJ,QAAQ,UAAU,MAAM,IAAIO,MAAM;QAC7C,IAAI,OAAON,SAAS,UAAU,MAAM,IAAIM,MAAM;QAC9C,IAAI,OAAOL,SAAS,UAAU,MAAM,IAAIK,MAAM;QAE9C,IAAI,OAAOJ,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAU;QACZ;QACAA,UAAUA,WAAW,CAAC;QACtB,IAAMK,WAAWC,IAAAA,qBAAY,EAAC;YAAEC,KAAKV;WAAQG,UAAW;QACxDA,UAAU;YAAEK,UAAAA;WAAaL;QAEzB,IAAI,OAAOC,aAAa,YAAY,OAAOL,SAAShB,SAASiB,KAAKC,MAAMC,MAAMC,SAASC;QACvF,OAAO,IAAIO,QAAQ,SAACpB,SAASqB;mBAAWb,SAAShB,SAASiB,KAAKC,MAAMC,MAAMC,SAAS,SAACG,KAAKO;uBAAYP,MAAMM,OAAON,OAAOf,QAAQsB;;;IACpI,EAAE,OAAOP,KAAK;QACZQ,QAAQC,GAAG,CAACT;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOK,QAAQC,MAAM,CAACN;IAC7B;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformDirectory.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport loadTsConfig from './loadTsConfig';\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformDirectory.cjs');\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst callLazy = lazy(_require)('node-version-call');\nconst workerLazy = lazy(_require)(workerPath);\n\nfunction dispatch(version, src, dest, type, options, callback) {\n if (version === 'local') return workerLazy()(src, dest, type, options, callback);\n try {\n callback(null, callLazy()({ version, callbacks: true }, workerPath, src, dest, type, options));\n } catch (err) {\n callback(err);\n }\n}\n\nimport type { ConfigOptions, TransformDirectoryCallback } from './types';\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: string, dest: string, type: string, options?: ConfigOptions | TransformDirectoryCallback, callback?: TransformDirectoryCallback): undefined | Promise<string[]> {\n try {\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 options === 'function') {\n callback = options as TransformDirectoryCallback;\n options = null;\n }\n options = options || {};\n const tsconfig = loadTsConfig({ cwd: src, ...options }, 'transformDirectory');\n options = { tsconfig, ...options };\n\n if (typeof callback === 'function') return dispatch(version, src, dest, type, options, callback);\n return new Promise((resolve, reject) => dispatch(version, src, dest, type, options, (err, result) => (err ? reject(err) : resolve(result))));\n } catch (err) {\n console.log(err);\n if (callback) callback(err);\n else return Promise.reject(err);\n }\n}\n"],"names":["transformDirectory","major","process","versions","node","split","version","__dirname","path","dirname","__filename","url","fileURLToPath","workerPath","join","_require","require","Module","createRequire","callLazy","lazy","workerLazy","dispatch","src","dest","type","options","callback","callbacks","err","Error","tsconfig","loadTsConfig","cwd","Promise","resolve","reject","result","console","log"],"mappings":";;;;+BAyBA;;;;;;;CAOC,GACD;;;eAAwBA;;;2DAjCP;0DACD;mEACS;6DAON;gEACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AANjB,IAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,UAAUL,QAAQ,KAAK,WAAW;AACxC,IAAMM,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,aAAaL,aAAI,CAACM,IAAI,CAACP,WAAW,MAAM,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IAAIF,UAAUA,SAASE;aAClB,OAAOK,QAAQE,MAAM,CAACP;IAC7B;AACF"}
@@ -67,7 +67,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
67
67
  var major = +process.versions.node.split('.')[0];
68
68
  var version = major < 14 ? 'stable' : 'local';
69
69
  var __dirname = _path.default.dirname(typeof __filename === 'undefined' ? _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()) : __filename);
70
- var workerPath = _path.default.resolve(__dirname, '..', 'cjs', 'workers', 'transformSync.cjs');
70
+ var workerPath = _path.default.join(__dirname, '..', 'cjs', 'workers', 'transformSync.cjs');
71
71
  var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
72
72
  var callLazy = (0, _lazycache.default)(_require)('node-version-call');
73
73
  var workerLazy = (0, _lazycache.default)(_require)(workerPath);
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformSync.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport * as getTS from 'get-tsconfig-compat';\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.resolve(__dirname, '..', 'cjs', 'workers', 'transformSync.cjs');\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst callLazy = lazy(_require)('node-version-call');\nconst workerLazy = lazy(_require)(workerPath);\n\nfunction dispatch(version, src, dest, options) {\n if (version === 'local') return workerLazy()(src, dest, options);\n return callLazy()(version, workerPath, src, dest, options);\n}\n\nimport type { Output } from '@swc/core';\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): Output {\n if (typeof contents !== 'string') throw new Error('transformTypes: unexpected contents');\n if (typeof fileName !== 'string') throw new Error('transformTypes: unexpected fileName');\n if (!tsconfig) tsconfig = getTS.getTsconfig(process.cwd());\n return dispatch(version, contents, fileName, tsconfig);\n}\n"],"names":["transformSync","major","process","versions","node","split","version","__dirname","path","dirname","__filename","url","fileURLToPath","workerPath","resolve","_require","require","Module","createRequire","callLazy","lazy","workerLazy","dispatch","src","dest","options","contents","fileName","tsconfig","Error","getTS","getTsconfig","cwd"],"mappings":";;;;+BAsBA;;;;;CAKC,GACD;;;eAAwBA;;;2DA5BP;0DACD;yEACO;6DAOJ;gEACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AANjB,IAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,UAAUL,QAAQ,KAAK,WAAW;AACxC,IAAMM,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,aAAaL,aAAI,CAACM,OAAO,CAACP,WAAW,MAAM,OAAO,WAAW;AAInE,IAAMQ,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,WAAWC,IAAAA,kBAAI,EAACL,UAAU;AAChC,IAAMM,aAAaD,IAAAA,kBAAI,EAACL,UAAUF;AAElC,SAASS,SAAShB,OAAO,EAAEiB,GAAG,EAAEC,IAAI,EAAEC,OAAO;IAC3C,IAAInB,YAAY,SAAS,OAAOe,aAAaE,KAAKC,MAAMC;IACxD,OAAON,WAAWb,SAASO,YAAYU,KAAKC,MAAMC;AACpD;AAUe,SAASzB,cAAc0B,QAAgB,EAAEC,QAAgB,EAAEC,QAAwB;IAChG,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAIG,MAAM;IAClD,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAIE,MAAM;IAClD,IAAI,CAACD,UAAUA,WAAWE,mBAAMC,WAAW,CAAC7B,QAAQ8B,GAAG;IACvD,OAAOV,SAAShB,SAASoB,UAAUC,UAAUC;AAC/C"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformSync.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport * as getTS from 'get-tsconfig-compat';\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformSync.cjs');\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst callLazy = lazy(_require)('node-version-call');\nconst workerLazy = lazy(_require)(workerPath);\n\nfunction dispatch(version, src, dest, options) {\n if (version === 'local') return workerLazy()(src, dest, options);\n return callLazy()(version, workerPath, src, dest, options);\n}\n\nimport type { Output } from '@swc/core';\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): Output {\n if (typeof contents !== 'string') throw new Error('transformTypes: unexpected contents');\n if (typeof fileName !== 'string') throw new Error('transformTypes: unexpected fileName');\n if (!tsconfig) tsconfig = getTS.getTsconfig(process.cwd());\n return dispatch(version, contents, fileName, tsconfig);\n}\n"],"names":["transformSync","major","process","versions","node","split","version","__dirname","path","dirname","__filename","url","fileURLToPath","workerPath","join","_require","require","Module","createRequire","callLazy","lazy","workerLazy","dispatch","src","dest","options","contents","fileName","tsconfig","Error","getTS","getTsconfig","cwd"],"mappings":";;;;+BAsBA;;;;;CAKC,GACD;;;eAAwBA;;;2DA5BP;0DACD;yEACO;6DAOJ;gEACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AANjB,IAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,UAAUL,QAAQ,KAAK,WAAW;AACxC,IAAMM,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,aAAaL,aAAI,CAACM,IAAI,CAACP,WAAW,MAAM,OAAO,WAAW;AAIhE,IAAMQ,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,WAAWC,IAAAA,kBAAI,EAACL,UAAU;AAChC,IAAMM,aAAaD,IAAAA,kBAAI,EAACL,UAAUF;AAElC,SAASS,SAAShB,OAAO,EAAEiB,GAAG,EAAEC,IAAI,EAAEC,OAAO;IAC3C,IAAInB,YAAY,SAAS,OAAOe,aAAaE,KAAKC,MAAMC;IACxD,OAAON,WAAWb,SAASO,YAAYU,KAAKC,MAAMC;AACpD;AAUe,SAASzB,cAAc0B,QAAgB,EAAEC,QAAgB,EAAEC,QAAwB;IAChG,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAIG,MAAM;IAClD,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAIE,MAAM;IAClD,IAAI,CAACD,UAAUA,WAAWE,mBAAMC,WAAW,CAAC7B,QAAQ8B,GAAG;IACvD,OAAOV,SAAShB,SAASoB,UAAUC,UAAUC;AAC/C"}
@@ -55,7 +55,7 @@ function _object_spread(target) {
55
55
  var major = +process.versions.node.split('.')[0];
56
56
  var version = major < 14 ? 'stable' : 'local';
57
57
  var __dirname = _path.default.dirname(typeof __filename === 'undefined' ? _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()) : __filename);
58
- var workerPath = _path.default.resolve(__dirname, '..', 'cjs', 'workers', 'transformTypes.cjs');
58
+ var workerPath = _path.default.join(__dirname, '..', 'cjs', 'workers', 'transformTypes.cjs');
59
59
  var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
60
60
  var callLazy = (0, _lazycache.default)(_require)('node-version-call');
61
61
  var workerLazy = (0, _lazycache.default)(_require)(workerPath);
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformTypes.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport loadTsConfig from './loadTsConfig';\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.resolve(__dirname, '..', 'cjs', 'workers', 'transformTypes.cjs');\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst callLazy = lazy(_require)('node-version-call');\nconst workerLazy = lazy(_require)(workerPath);\n\nfunction dispatch(version, src, dest, options, callback) {\n if (version === 'local') return workerLazy()(src, dest, options, callback);\n try {\n callback(null, callLazy()({ version, callbacks: true }, workerPath, src, dest, options));\n } catch (err) {\n callback(err);\n }\n}\n\nimport type { ConfigOptions, TransformTypesCallback } from './types';\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: string, dest: string, options?: ConfigOptions | TransformTypesCallback, callback?: TransformTypesCallback): undefined | Promise<string[]> {\n try {\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 options === 'function') {\n callback = options as TransformTypesCallback;\n options = null;\n }\n options = options || {};\n const tsconfig = loadTsConfig({ cwd: src, ...options }, 'transformTypes');\n options = { tsconfig, ...options };\n\n if (typeof callback === 'function') return dispatch(version, src, dest, options, callback);\n return new Promise((resolve, reject) => dispatch(version, src, dest, options, (err, result) => (err ? reject(err) : resolve(result))));\n } catch (err) {\n console.log(err);\n if (callback) callback(err);\n else return Promise.reject(err);\n }\n}\n"],"names":["transformTypes","major","process","versions","node","split","version","__dirname","path","dirname","__filename","url","fileURLToPath","workerPath","resolve","_require","require","Module","createRequire","callLazy","lazy","workerLazy","dispatch","src","dest","options","callback","callbacks","err","Error","tsconfig","loadTsConfig","cwd","Promise","reject","result","console","log"],"mappings":";;;;+BAyBA;;;;;;CAMC,GACD;;;eAAwBA;;;2DAhCP;0DACD;mEACS;6DAON;gEACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AANjB,IAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,UAAUL,QAAQ,KAAK,WAAW;AACxC,IAAMM,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,aAAaL,aAAI,CAACM,OAAO,CAACP,WAAW,MAAM,OAAO,WAAW;AAInE,IAAMQ,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,WAAWC,IAAAA,kBAAI,EAACL,UAAU;AAChC,IAAMM,aAAaD,IAAAA,kBAAI,EAACL,UAAUF;AAElC,SAASS,SAAShB,OAAO,EAAEiB,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACrD,IAAIpB,YAAY,SAAS,OAAOe,aAAaE,KAAKC,MAAMC,SAASC;IACjE,IAAI;QACFA,SAAS,MAAMP,WAAW;YAAEb,SAAAA;YAASqB,WAAW;QAAK,GAAGd,YAAYU,KAAKC,MAAMC;IACjF,EAAE,OAAOG,KAAK;QACZF,SAASE;IACX;AACF;AAUe,SAAS5B,eAAeuB,GAAW,EAAEC,IAAY,EAAEC,OAAgD,EAAEC,QAAiC;IACnJ,IAAI;QACF,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIM,MAAM;QAC7C,IAAI,OAAOL,SAAS,UAAU,MAAM,IAAIK,MAAM;QAE9C,IAAI,OAAOJ,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAU;QACZ;QACAA,UAAUA,WAAW,CAAC;QACtB,IAAMK,WAAWC,IAAAA,qBAAY,EAAC;YAAEC,KAAKT;WAAQE,UAAW;QACxDA,UAAU;YAAEK,UAAAA;WAAaL;QAEzB,IAAI,OAAOC,aAAa,YAAY,OAAOJ,SAAShB,SAASiB,KAAKC,MAAMC,SAASC;QACjF,OAAO,IAAIO,QAAQ,SAACnB,SAASoB;mBAAWZ,SAAShB,SAASiB,KAAKC,MAAMC,SAAS,SAACG,KAAKO;uBAAYP,MAAMM,OAAON,OAAOd,QAAQqB;;;IAC9H,EAAE,OAAOP,KAAK;QACZQ,QAAQC,GAAG,CAACT;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOK,QAAQC,MAAM,CAACN;IAC7B;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformTypes.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport loadTsConfig from './loadTsConfig';\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformTypes.cjs');\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst callLazy = lazy(_require)('node-version-call');\nconst workerLazy = lazy(_require)(workerPath);\n\nfunction dispatch(version, src, dest, options, callback) {\n if (version === 'local') return workerLazy()(src, dest, options, callback);\n try {\n callback(null, callLazy()({ version, callbacks: true }, workerPath, src, dest, options));\n } catch (err) {\n callback(err);\n }\n}\n\nimport type { ConfigOptions, TransformTypesCallback } from './types';\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: string, dest: string, options?: ConfigOptions | TransformTypesCallback, callback?: TransformTypesCallback): undefined | Promise<string[]> {\n try {\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 options === 'function') {\n callback = options as TransformTypesCallback;\n options = null;\n }\n options = options || {};\n const tsconfig = loadTsConfig({ cwd: src, ...options }, 'transformTypes');\n options = { tsconfig, ...options };\n\n if (typeof callback === 'function') return dispatch(version, src, dest, options, callback);\n return new Promise((resolve, reject) => dispatch(version, src, dest, options, (err, result) => (err ? reject(err) : resolve(result))));\n } catch (err) {\n console.log(err);\n if (callback) callback(err);\n else return Promise.reject(err);\n }\n}\n"],"names":["transformTypes","major","process","versions","node","split","version","__dirname","path","dirname","__filename","url","fileURLToPath","workerPath","join","_require","require","Module","createRequire","callLazy","lazy","workerLazy","dispatch","src","dest","options","callback","callbacks","err","Error","tsconfig","loadTsConfig","cwd","Promise","resolve","reject","result","console","log"],"mappings":";;;;+BAyBA;;;;;;CAMC,GACD;;;eAAwBA;;;2DAhCP;0DACD;mEACS;6DAON;gEACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AANjB,IAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,K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AS,SAACG,KAAKQ;uBAAYR,MAAMO,OAAOP,OAAOM,QAAQE;;;IAC9H,EAAE,OAAOR,KAAK;QACZS,QAAQC,GAAG,CAACV;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOK,QAAQE,MAAM,CAACP;IAC7B;AACF"}
@@ -6,7 +6,7 @@ import Module from 'module';
6
6
  import lazy from 'lazy-cache';
7
7
  const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
8
8
  const __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);
9
- const workerPath = path.resolve(__dirname, '..', '..', 'cjs', 'workers', 'installBindings.cjs');
9
+ const workerPath = path.join(__dirname, '..', '..', 'cjs', 'workers', 'installBindings.cjs');
10
10
  const major = +process.versions.node.split('.')[0];
11
11
  const version = major < 14 ? 'stable' : 'local';
12
12
  const callLazy = lazy(_require)('node-version-call');
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/installBindings.ts"],"sourcesContent":["import installBindings, { isInstalled } from '../workers/installBindings';\nexport default installBindings;\n\nimport path from 'path';\nimport url from 'url';\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.resolve(__dirname, '..', '..', 'cjs', 'workers', 'installBindings.cjs');\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\n\nconst callLazy = lazy(_require)('node-version-call');\nconst install = lazy((target) => {\n return isInstalled(target) ? target : callLazy()({ version, callbacks: true }, workerPath, target);\n});\n\nexport const sync = (target) => install(target)();\n"],"names":["installBindings","isInstalled","path","url","Module","lazy","_require","require","createRequire","__dirname","dirname","__filename","fileURLToPath","workerPath","resolve","major","process","versions","node","split","version","callLazy","install","target","callbacks","sync"],"mappings":"AAAA,OAAOA,mBAAmBC,WAAW,QAAQ,6BAA6B;AAC1E,eAAeD,gBAAgB;AAE/B,OAAOE,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AAEtB,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,aAAa;AAC9B,MAAMC,WAAW,OAAOC,YAAY,cAAcH,OAAOI,aAAa,CAAC,YAAYL,GAAG,IAAII;AAC1F,MAAME,YAAYP,KAAKQ,OAAO,CAAC,OAAOC,eAAe,cAAcR,IAAIS,aAAa,CAAC,YAAYT,GAAG,IAAIQ;AACxG,MAAME,aAAaX,KAAKY,OAAO,CAACL,WAAW,MAAM,MAAM,OAAO,WAAW;AACzE,MAAMM,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,UAAUL,QAAQ,KAAK,WAAW;AAExC,MAAMM,WAAWhB,KAAKC,UAAU;AAChC,MAAMgB,UAAUjB,KAAK,CAACkB;IACpB,OAAOtB,YAAYsB,UAAUA,SAASF,WAAW;QAAED;QAASI,WAAW;IAAK,GAAGX,YAAYU;AAC7F;AAEA,OAAO,MAAME,OAAO,CAACF,SAAWD,QAAQC,UAAU"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/installBindings.ts"],"sourcesContent":["import installBindings, { isInstalled } from '../workers/installBindings';\nexport default installBindings;\n\nimport path from 'path';\nimport url from 'url';\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', '..', 'cjs', 'workers', 'installBindings.cjs');\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\n\nconst callLazy = lazy(_require)('node-version-call');\nconst install = lazy((target) => {\n return isInstalled(target) ? target : callLazy()({ version, callbacks: true }, workerPath, target);\n});\n\nexport const sync = (target) => install(target)();\n"],"names":["installBindings","isInstalled","path","url","Module","lazy","_require","require","createRequire","__dirname","dirname","__filename","fileURLToPath","workerPath","join","major","process","versions","node","split","version","callLazy","install","target","callbacks","sync"],"mappings":"AAAA,OAAOA,mBAAmBC,WAAW,QAAQ,6BAA6B;AAC1E,eAAeD,gBAAgB;AAE/B,OAAOE,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AAEtB,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,aAAa;AAC9B,MAAMC,WAAW,OAAOC,YAAY,cAAcH,OAAOI,aAAa,CAAC,YAAYL,GAAG,IAAII;AAC1F,MAAME,YAAYP,KAAKQ,OAAO,CAAC,OAAOC,eAAe,cAAcR,IAAIS,aAAa,CAAC,YAAYT,GAAG,IAAIQ;AACxG,MAAME,aAAaX,KAAKY,IAAI,CAACL,WAAW,MAAM,MAAM,OAAO,WAAW;AACtE,MAAMM,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,UAAUL,QAAQ,KAAK,WAAW;AAExC,MAAMM,WAAWhB,KAAKC,UAAU;AAChC,MAAMgB,UAAUjB,KAAK,CAACkB;IACpB,OAAOtB,YAAYsB,UAAUA,SAASF,WAAW;QAAED;QAASI,WAAW;IAAK,GAAGX,YAAYU;AAC7F;AAEA,OAAO,MAAME,OAAO,CAACF,SAAWD,QAAQC,UAAU"}
@@ -21,7 +21,7 @@ export default function toPath(specifier, context) {
21
21
  if (isAbsolute(specifier)) return specifier;
22
22
  if (specifier[0] === '.') {
23
23
  const parentPath = context ? getParentPath(context) : process.cwd();
24
- return path.resolve(parentPath, specifier);
24
+ return path.join(parentPath, specifier);
25
25
  }
26
26
  if (moduleRegEx.test(specifier)) {
27
27
  const parentPath = context ? getParentPath(context) : process.cwd();
@@ -43,11 +43,11 @@ export default function toPath(specifier, context) {
43
43
  }
44
44
  });
45
45
  if (!pkg || !pkg.json.module) return main; // no modules, use main
46
- if (pkg.json.name === specifier) return path.resolve(pkg.dir, pkg.json.module); // the module
46
+ if (pkg.json.name === specifier) return path.join(pkg.dir, pkg.json.module); // the module
47
47
  // a relative path. Only accept if it doesn't break the relative naming and it exists
48
- const modulePath = path.resolve(pkg.dir, pkg.json.module);
49
- const mainPath = path.resolve(pkg.dir, pkg.json.main);
50
- const moduleResolved = path.resolve(modulePath, path.relative(mainPath, main));
48
+ const modulePath = path.join(pkg.dir, pkg.json.module);
49
+ const mainPath = path.join(pkg.dir, pkg.json.main);
50
+ const moduleResolved = path.join(modulePath, path.relative(mainPath, main));
51
51
  return moduleResolved.indexOf(specifier.replace(pkg.json.name, '')) < 0 || !existsSync(moduleResolved) ? main : moduleResolved;
52
52
  }
53
53
  return specifier;
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport isAbsolute from 'is-absolute';\nimport resolve from 'resolve';\nimport { moduleRegEx } from './constants';\nimport fileURLToPath from './lib/fileURLToPath';\nimport type { Context } from './types';\n\nconst existsSync = (test) => {\n try {\n (fs.accessSync || fs.statSync)(test);\n return true;\n } catch (_) {\n return false;\n }\n};\n\nfunction getParentPath(context: Context) {\n if (context.parentPath) return path.dirname(context.parentPath);\n return context.parentURL ? path.dirname(toPath(context.parentURL)) : process.cwd();\n}\n\nexport default function toPath(specifier: string, context?: Context) {\n if (specifier.startsWith('file:')) return fileURLToPath(specifier);\n if (isAbsolute(specifier)) return specifier;\n if (specifier[0] === '.') {\n const parentPath = context ? getParentPath(context) : process.cwd();\n return path.resolve(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n\n let pkg = null;\n const main = resolve.sync(specifier, {\n basedir: parentPath,\n extensions: ['.js', '.json', '.node', '.mjs'],\n packageFilter(json, dir) {\n pkg = { json, dir };\n return json;\n },\n });\n if (!pkg || !pkg.json.module) return main; // no modules, use main\n if (pkg.json.name === specifier) return path.resolve(pkg.dir, pkg.json.module); // the module\n\n // a relative path. Only accept if it doesn't break the relative naming and it exists\n const modulePath = path.resolve(pkg.dir, pkg.json.module);\n const mainPath = path.resolve(pkg.dir, pkg.json.main);\n const moduleResolved = path.resolve(modulePath, path.relative(mainPath, main));\n return moduleResolved.indexOf(specifier.replace(pkg.json.name, '')) < 0 || !existsSync(moduleResolved) ? main : moduleResolved;\n }\n\n return specifier;\n}\n"],"names":["fs","path","isAbsolute","resolve","moduleRegEx","fileURLToPath","existsSync","test","accessSync","statSync","_","getParentPath","context","parentPath","dirname","parentURL","toPath","process","cwd","specifier","startsWith","pkg","main","sync","basedir","extensions","packageFilter","json","dir","module","name","modulePath","mainPath","moduleResolved","relative","indexOf","replace"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,gBAAgB,cAAc;AACrC,OAAOC,aAAa,UAAU;AAC9B,SAASC,WAAW,QAAQ,cAAc;AAC1C,OAAOC,mBAAmB,sBAAsB;AAGhD,MAAMC,aAAa,CAACC;IAClB,IAAI;QACDP,CAAAA,GAAGQ,UAAU,IAAIR,GAAGS,QAAQ,AAAD,EAAGF;QAC/B,OAAO;IACT,EAAE,OAAOG,GAAG;QACV,OAAO;IACT;AACF;AAEA,SAASC,cAAcC,OAAgB;IACrC,IAAIA,QAAQC,UAAU,EAAE,OAAOZ,KAAKa,OAAO,CAACF,QAAQC,UAAU;IAC9D,OAAOD,QAAQG,SAAS,GAAGd,KAAKa,OAAO,CAACE,OAAOJ,QAAQG,SAAS,KAAKE,QAAQC,GAAG;AAClF;AAEA,eAAe,SAASF,OAAOG,SAAiB,EAAEP,OAAiB;IACjE,IAAIO,UAAUC,UAAU,CAAC,UAAU,OAAOf,cAAcc;IACxD,IAAIjB,WAAWiB,YAAY,OAAOA;IAClC,IAAIA,SAAS,CAAC,EAAE,KAAK,KAAK;QACxB,MAAMN,aAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QACjE,OAAOjB,KAAKE,OAAO,CAACU,YAAYM;IAClC;IACA,IAAIf,YAAYG,IAAI,CAACY,YAAY;QAC/B,MAAMN,aAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QAEjE,IAAIG,MAAM;QACV,MAAMC,OAAOnB,QAAQoB,IAAI,CAACJ,WAAW;YACnCK,SAASX;YACTY,YAAY;gBAAC;gBAAO;gBAAS;gBAAS;aAAO;YAC7CC,eAAcC,IAAI,EAAEC,GAAG;gBACrBP,MAAM;oBAAEM;oBAAMC;gBAAI;gBAClB,OAAOD;YACT;QACF;QACA,IAAI,CAACN,OAAO,CAACA,IAAIM,IAAI,CAACE,MAAM,EAAE,OAAOP,MAAM,uBAAuB;QAClE,IAAID,IAAIM,IAAI,CAACG,IAAI,KAAKX,WAAW,OAAOlB,KAAKE,OAAO,CAACkB,IAAIO,GAAG,EAAEP,IAAIM,IAAI,CAACE,MAAM,GAAG,aAAa;QAE7F,qFAAqF;QACrF,MAAME,aAAa9B,KAAKE,OAAO,CAACkB,IAAIO,GAAG,EAAEP,IAAIM,IAAI,CAACE,MAAM;QACxD,MAAMG,WAAW/B,KAAKE,OAAO,CAACkB,IAAIO,GAAG,EAAEP,IAAIM,IAAI,CAACL,IAAI;QACpD,MAAMW,iBAAiBhC,KAAKE,OAAO,CAAC4B,YAAY9B,KAAKiC,QAAQ,CAACF,UAAUV;QACxE,OAAOW,eAAeE,OAAO,CAAChB,UAAUiB,OAAO,CAACf,IAAIM,IAAI,CAACG,IAAI,EAAE,OAAO,KAAK,CAACxB,WAAW2B,kBAAkBX,OAAOW;IAClH;IAEA,OAAOd;AACT"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport isAbsolute from 'is-absolute';\nimport resolve from 'resolve';\nimport { moduleRegEx } from './constants';\nimport fileURLToPath from './lib/fileURLToPath';\nimport type { Context } from './types';\n\nconst existsSync = (test) => {\n try {\n (fs.accessSync || fs.statSync)(test);\n return true;\n } catch (_) {\n return false;\n }\n};\n\nfunction getParentPath(context: Context) {\n if (context.parentPath) return path.dirname(context.parentPath);\n return context.parentURL ? path.dirname(toPath(context.parentURL)) : process.cwd();\n}\n\nexport default function toPath(specifier: string, context?: Context) {\n if (specifier.startsWith('file:')) return fileURLToPath(specifier);\n if (isAbsolute(specifier)) return specifier;\n if (specifier[0] === '.') {\n const parentPath = context ? getParentPath(context) : process.cwd();\n return path.join(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n\n let pkg = null;\n const main = resolve.sync(specifier, {\n basedir: parentPath,\n extensions: ['.js', '.json', '.node', '.mjs'],\n packageFilter(json, dir) {\n pkg = { json, dir };\n return json;\n },\n });\n if (!pkg || !pkg.json.module) return main; // no modules, use main\n if (pkg.json.name === specifier) return path.join(pkg.dir, pkg.json.module); // the module\n\n // a relative path. Only accept if it doesn't break the relative naming and it exists\n const modulePath = path.join(pkg.dir, pkg.json.module);\n const mainPath = path.join(pkg.dir, pkg.json.main);\n const moduleResolved = path.join(modulePath, path.relative(mainPath, main));\n return moduleResolved.indexOf(specifier.replace(pkg.json.name, '')) < 0 || !existsSync(moduleResolved) ? main : moduleResolved;\n }\n\n return specifier;\n}\n"],"names":["fs","path","isAbsolute","resolve","moduleRegEx","fileURLToPath","existsSync","test","accessSync","statSync","_","getParentPath","context","parentPath","dirname","parentURL","toPath","process","cwd","specifier","startsWith","join","pkg","main","sync","basedir","extensions","packageFilter","json","dir","module","name","modulePath","mainPath","moduleResolved","relative","indexOf","replace"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,gBAAgB,cAAc;AACrC,OAAOC,aAAa,UAAU;AAC9B,SAASC,WAAW,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1F,qFAAqF;QACrF,MAAME,aAAa/B,KAAKoB,IAAI,CAACC,IAAIO,GAAG,EAAEP,IAAIM,IAAI,CAACE,MAAM;QACrD,MAAMG,WAAWhC,KAAKoB,IAAI,CAACC,IAAIO,GAAG,EAAEP,IAAIM,IAAI,CAACL,IAAI;QACjD,MAAMW,iBAAiBjC,KAAKoB,IAAI,CAACW,YAAY/B,KAAKkC,QAAQ,CAACF,UAAUV;QACrE,OAAOW,eAAeE,OAAO,CAACjB,UAAUkB,OAAO,CAACf,IAAIM,IAAI,CAACG,IAAI,EAAE,OAAO,KAAK,CAACzB,WAAW4B,kBAAkBX,OAAOW;IAClH;IAEA,OAAOf;AACT"}
@@ -4,7 +4,7 @@ import loadTsConfig from './loadTsConfig.mjs';
4
4
  const major = +process.versions.node.split('.')[0];
5
5
  const version = major < 14 ? 'stable' : 'local';
6
6
  const __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);
7
- const workerPath = path.resolve(__dirname, '..', 'cjs', 'workers', 'transformDirectory.cjs');
7
+ const workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformDirectory.cjs');
8
8
  import Module from 'module';
9
9
  import lazy from 'lazy-cache';
10
10
  const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformDirectory.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport loadTsConfig from './loadTsConfig';\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.resolve(__dirname, '..', 'cjs', 'workers', 'transformDirectory.cjs');\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst callLazy = lazy(_require)('node-version-call');\nconst workerLazy = lazy(_require)(workerPath);\n\nfunction dispatch(version, src, dest, type, options, callback) {\n if (version === 'local') return workerLazy()(src, dest, type, options, callback);\n try {\n callback(null, callLazy()({ version, callbacks: true }, workerPath, src, dest, type, options));\n } catch (err) {\n callback(err);\n }\n}\n\nimport type { ConfigOptions, TransformDirectoryCallback } from './types';\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: string, dest: string, type: string, options?: ConfigOptions | TransformDirectoryCallback, callback?: TransformDirectoryCallback): undefined | Promise<string[]> {\n try {\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 options === 'function') {\n callback = options as TransformDirectoryCallback;\n options = null;\n }\n options = options || {};\n const tsconfig = loadTsConfig({ cwd: src, ...options }, 'transformDirectory');\n options = { tsconfig, ...options };\n\n if (typeof callback === 'function') return dispatch(version, src, dest, type, options, callback);\n return new Promise((resolve, reject) => dispatch(version, src, dest, type, options, (err, result) => (err ? reject(err) : resolve(result))));\n } catch (err) {\n console.log(err);\n if (callback) callback(err);\n else return Promise.reject(err);\n }\n}\n"],"names":["path","url","loadTsConfig","major","process","versions","node","split","version","__dirname","dirname","__filename","fileURLToPath","workerPath","resolve","Module","lazy","_require","require","createRequire","callLazy","workerLazy","dispatch","src","dest","type","options","callback","callbacks","err","transformDirectory","Error","tsconfig","cwd","Promise","reject","result","console","log"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,OAAOC,kBAAkB,iBAAiB;AAE1C,MAAMC,QAAQ,CAACC,QAAQC,QAAQ,C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AGN,OAAO;QAAC;QAEjC,IAAI,OAAOC,aAAa,YAAY,OAAOL,SAASd,SAASe,KAAKC,MAAMC,MAAMC,SAASC;QACvF,OAAO,IAAIO,QAAQ,CAACpB,SAASqB,SAAWb,SAASd,SAASe,KAAKC,MAAMC,MAAMC,SAAS,CAACG,KAAKO,SAAYP,MAAMM,OAAON,OAAOf,QAAQsB;IACpI,EAAE,OAAOP,KAAK;QACZQ,QAAQC,GAAG,CAACT;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOK,QAAQC,MAAM,CAACN;IAC7B;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformDirectory.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport loadTsConfig from './loadTsConfig';\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformDirectory.cjs');\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst callLazy = lazy(_require)('node-version-call');\nconst workerLazy = lazy(_require)(workerPath);\n\nfunction dispatch(version, src, dest, type, options, callback) {\n if (version === 'local') return workerLazy()(src, dest, type, options, callback);\n try {\n callback(null, callLazy()({ version, callbacks: true }, workerPath, src, dest, type, options));\n } catch (err) {\n callback(err);\n }\n}\n\nimport type { ConfigOptions, TransformDirectoryCallback } from './types';\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: string, dest: string, type: string, options?: ConfigOptions | TransformDirectoryCallback, callback?: TransformDirectoryCallback): undefined | Promise<string[]> {\n try {\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 options === 'function') {\n callback = options as TransformDirectoryCallback;\n options = null;\n }\n options = options || {};\n const tsconfig = loadTsConfig({ cwd: src, ...options }, 'transformDirectory');\n options = { tsconfig, ...options };\n\n if (typeof callback === 'function') return dispatch(version, src, dest, type, options, callback);\n return new Promise((resolve, reject) => dispatch(version, src, dest, type, options, (err, result) => (err ? reject(err) : resolve(result))));\n } catch (err) {\n console.log(err);\n if (callback) callback(err);\n else return Promise.reject(err);\n }\n}\n"],"names":["path","url","loadTsConfig","major","process","versions","node","split","version","__dirname","dirname","__filename","fileURLToPath","workerPath","join","Module","lazy","_require","require","createRequire","callLazy","workerLazy","dispatch","src","dest","type","options","callback","callbacks","err","transformDirectory","Error","tsconfig","cwd","Promise","resolve","reject","result","console","log"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,OAAOC,kBAAkB,iBAAiB;AAE1C,MAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,UAAUL,QAAQ,KAAK,WAAW;AACxC,MAAMM,YAAYT,KAAKU,OAAO,CAAC,OAAOC,eAAe,cAAcV,IAAIW,aAAa,CAAC,YAAYX,GAAG,IAAIU;AACxG,MAAME,aAAab,KAAKc,IAAI,CAACL,WAAW,MAAM,OAAO,WAAW;AAEhE,OAAOM,YAAY,SAAS;AAC5B,OAAOC,UAAU,aAAa;AAC9B,MAAMC,WAAW,OAAOC,YAAY,cAAcH,OAAOI,aAAa,CAAC,YAAYlB,GAAG,IAAIiB;AAC1F,MAAME,WAAWJ,KAAKC,UAAU;AAChC,MAAMI,aAAaL,KAAKC,UAAUJ;AAElC,SAASS,SAASd,OAAO,EAAEe,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC3D,IAAInB,YAAY,SAAS,OAAOa,aAAaE,KAAKC,MAAMC,MAAMC,SAASC;IACvE,IAAI;QACFA,SAAS,MAAMP,WAAW;YAAEZ;YAASoB,WAAW;QAAK,GAAGf,YAAYU,KAAKC,MAAMC,MAAMC;IACvF,EAAE,OAAOG,KAAK;QACZF,SAASE;IACX;AACF;AAGA;;;;;;;CAOC,GACD,eAAe,SAASC,mBAAmBP,GAAW,EAAEC,IAAY,EAAEC,IAAY,EAAEC,OAAoD,EAAEC,QAAqC;IAC7K,IAAI;QACF,IAAI,OAAOJ,QAAQ,UAAU,MAAM,IAAIQ,MAAM;QAC7C,IAAI,OAAOP,SAAS,UAAU,MAAM,IAAIO,MAAM;QAC9C,IAAI,OAAON,SAAS,UAAU,MAAM,IAAIM,MAAM;QAE9C,IAAI,OAAOL,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAU;QACZ;QACAA,UAAUA,WAAW,CAAC;QACtB,MAAMM,WAAW9B,aAAa;YAAE+B,KAAKV;YAAK,GAAGG,OAAO;QAAC,GAAG;QACxDA,UAAU;YAAEM;YAAU,GAAGN,OAAO;QAAC;QAEjC,IAAI,OAAOC,aAAa,YAAY,OAAOL,SAASd,SAASe,KAAKC,MAAMC,MAAMC,SAASC;QACvF,OAAO,IAAIO,QAAQ,CAACC,SAASC,SAAWd,SAASd,SAASe,KAAKC,MAAMC,MAAMC,SAAS,CAACG,KAAKQ,SAAYR,MAAMO,OAAOP,OAAOM,QAAQE;IACpI,EAAE,OAAOR,KAAK;QACZS,QAAQC,GAAG,CAACV;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOK,QAAQE,MAAM,CAACP;IAC7B;AACF"}
@@ -4,7 +4,7 @@ import * as getTS from 'get-tsconfig-compat';
4
4
  const major = +process.versions.node.split('.')[0];
5
5
  const version = major < 14 ? 'stable' : 'local';
6
6
  const __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);
7
- const workerPath = path.resolve(__dirname, '..', 'cjs', 'workers', 'transformSync.cjs');
7
+ const workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformSync.cjs');
8
8
  import Module from 'module';
9
9
  import lazy from 'lazy-cache';
10
10
  const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformSync.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport * as getTS from 'get-tsconfig-compat';\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.resolve(__dirname, '..', 'cjs', 'workers', 'transformSync.cjs');\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst callLazy = lazy(_require)('node-version-call');\nconst workerLazy = lazy(_require)(workerPath);\n\nfunction dispatch(version, src, dest, options) {\n if (version === 'local') return workerLazy()(src, dest, options);\n return callLazy()(version, workerPath, src, dest, options);\n}\n\nimport type { Output } from '@swc/core';\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): Output {\n if (typeof contents !== 'string') throw new Error('transformTypes: unexpected contents');\n if (typeof fileName !== 'string') throw new Error('transformTypes: unexpected fileName');\n if (!tsconfig) tsconfig = getTS.getTsconfig(process.cwd());\n return dispatch(version, contents, fileName, tsconfig);\n}\n"],"names":["path","url","getTS","major","process","versions","node","split","version","__dirname","dirname","__filename","fileURLToPath","workerPath","resolve","Module","lazy","_require","require","createRequire","callLazy","workerLazy","dispatch","src","dest","options","transformSync","contents","fileName","tsconfig","Error","getTsconfig","cwd"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,YAAYC,WAAW,sBAAsB;AAE7C,MAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,UAAUL,QAAQ,KAAK,WAAW;AACxC,MAAMM,YAAYT,KAAKU,OAAO,CAAC,OAAOC,eAAe,cAAcV,IAAIW,aAAa,CAAC,YAAYX,GAAG,IAAIU;AACxG,MAAME,aAAab,KAAKc,OAAO,CAACL,WAAW,MAAM,OAAO,WAAW;AAEnE,OAAOM,YAAY,SAAS;AAC5B,OAAOC,UAAU,aAAa;AAC9B,MAAMC,WAAW,OAAOC,YAAY,cAAcH,OAAOI,aAAa,CAAC,YAAYlB,GAAG,IAAIiB;AAC1F,MAAME,WAAWJ,KAAKC,UAAU;AAChC,MAAMI,aAAaL,KAAKC,UAAUJ;AAElC,SAASS,SAASd,OAAO,EAAEe,GAAG,EAAEC,IAAI,EAAEC,OAAO;IAC3C,IAAIjB,YAAY,SAAS,OAAOa,aAAaE,KAAKC,MAAMC;IACxD,OAAOL,WAAWZ,SAASK,YAAYU,KAAKC,MAAMC;AACpD;AAIA;;;;;CAKC,GACD,eAAe,SAASC,cAAcC,QAAgB,EAAEC,QAAgB,EAAEC,QAAwB;IAChG,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAIG,MAAM;IAClD,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAIE,MAAM;IAClD,IAAI,CAACD,UAAUA,WAAW3B,MAAM6B,WAAW,CAAC3B,QAAQ4B,GAAG;IACvD,OAAOV,SAASd,SAASmB,UAAUC,UAAUC;AAC/C"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformSync.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport * as getTS from 'get-tsconfig-compat';\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformSync.cjs');\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst callLazy = lazy(_require)('node-version-call');\nconst workerLazy = lazy(_require)(workerPath);\n\nfunction dispatch(version, src, dest, options) {\n if (version === 'local') return workerLazy()(src, dest, options);\n return callLazy()(version, workerPath, src, dest, options);\n}\n\nimport type { Output } from '@swc/core';\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): Output {\n if (typeof contents !== 'string') throw new Error('transformTypes: unexpected contents');\n if (typeof fileName !== 'string') throw new Error('transformTypes: unexpected fileName');\n if (!tsconfig) tsconfig = getTS.getTsconfig(process.cwd());\n return dispatch(version, contents, fileName, tsconfig);\n}\n"],"names":["path","url","getTS","major","process","versions","node","split","version","__dirname","dirname","__filename","fileURLToPath","workerPath","join","Module","lazy","_require","require","createRequire","callLazy","workerLazy","dispatch","src","dest","options","transformSync","contents","fileName","tsconfig","Error","getTsconfig","cwd"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,YAAYC,WAAW,sBAAsB;AAE7C,MAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,UAAUL,QAAQ,KAAK,WAAW;AACxC,MAAMM,YAAYT,KAAKU,OAAO,CAAC,OAAOC,eAAe,cAAcV,IAAIW,aAAa,CAAC,YAAYX,GAAG,IAAIU;AACxG,MAAME,aAAab,KAAKc,IAAI,CAACL,WAAW,MAAM,OAAO,WAAW;AAEhE,OAAOM,YAAY,SAAS;AAC5B,OAAOC,UAAU,aAAa;AAC9B,MAAMC,WAAW,OAAOC,YAAY,cAAcH,OAAOI,aAAa,CAAC,YAAYlB,GAAG,IAAIiB;AAC1F,MAAME,WAAWJ,KAAKC,UAAU;AAChC,MAAMI,aAAaL,KAAKC,UAAUJ;AAElC,SAASS,SAASd,OAAO,EAAEe,GAAG,EAAEC,IAAI,EAAEC,OAAO;IAC3C,IAAIjB,YAAY,SAAS,OAAOa,aAAaE,KAAKC,MAAMC;IACxD,OAAOL,WAAWZ,SAASK,YAAYU,KAAKC,MAAMC;AACpD;AAIA;;;;;CAKC,GACD,eAAe,SAASC,cAAcC,QAAgB,EAAEC,QAAgB,EAAEC,QAAwB;IAChG,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAIG,MAAM;IAClD,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAIE,MAAM;IAClD,IAAI,CAACD,UAAUA,WAAW3B,MAAM6B,WAAW,CAAC3B,QAAQ4B,GAAG;IACvD,OAAOV,SAASd,SAASmB,UAAUC,UAAUC;AAC/C"}
@@ -4,7 +4,7 @@ import loadTsConfig from './loadTsConfig.mjs';
4
4
  const major = +process.versions.node.split('.')[0];
5
5
  const version = major < 14 ? 'stable' : 'local';
6
6
  const __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);
7
- const workerPath = path.resolve(__dirname, '..', 'cjs', 'workers', 'transformTypes.cjs');
7
+ const workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformTypes.cjs');
8
8
  import Module from 'module';
9
9
  import lazy from 'lazy-cache';
10
10
  const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformTypes.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport loadTsConfig from './loadTsConfig';\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.resolve(__dirname, '..', 'cjs', 'workers', 'transformTypes.cjs');\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst callLazy = lazy(_require)('node-version-call');\nconst workerLazy = lazy(_require)(workerPath);\n\nfunction dispatch(version, src, dest, options, callback) {\n if (version === 'local') return workerLazy()(src, dest, options, callback);\n try {\n callback(null, callLazy()({ version, callbacks: true }, workerPath, src, dest, options));\n } catch (err) {\n callback(err);\n }\n}\n\nimport type { ConfigOptions, TransformTypesCallback } from './types';\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: string, dest: string, options?: ConfigOptions | TransformTypesCallback, callback?: TransformTypesCallback): undefined | Promise<string[]> {\n try {\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 options === 'function') {\n callback = options as TransformTypesCallback;\n options = null;\n }\n options = options || {};\n const tsconfig = loadTsConfig({ cwd: src, ...options }, 'transformTypes');\n options = { tsconfig, ...options };\n\n if (typeof callback === 'function') return dispatch(version, src, dest, options, callback);\n return new Promise((resolve, reject) => dispatch(version, src, dest, options, (err, result) => (err ? reject(err) : resolve(result))));\n } catch (err) {\n console.log(err);\n if (callback) callback(err);\n else return Promise.reject(err);\n }\n}\n"],"names":["path","url","loadTsConfig","major","process","versions","node","split","version","__dirname","dirname","__filename","fileURLToPath","workerPath","resolve","Module","lazy","_require","require","createRequire","callLazy","workerLazy","dispatch","src","dest","options","callback","callbacks","err","transformTypes","Error","tsconfig","cwd","Promise","reject","result","console","log"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,OAAOC,kBAAkB,iBAAiB;AAE1C,MAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,UAAUL,QAAQ,KAAK,WAAW;AACxC,MAAMM,YAAYT,KAAKU,OAAO,CAAC,OAAOC,eAAe,cAAcV,IAAIW,aAAa,CAAC,YAAYX,GAAG,IAAIU;AACxG,MAAME,aAAab,KAAKc,OAAO,CAACL,WAAW,MAAM,OAAO,WAAW;AAEnE,OAAOM,YAAY,SAAS;AAC5B,OAAOC,UAAU,aAAa;AAC9B,MAAMC,WAAW,OAAOC,YAAY,cAAcH,OAAOI,aAAa,CAAC,YAAYlB,GAAG,IAAIiB;AAC1F,MAAME,WAAWJ,KAAKC,UAAU;AAChC,MAAMI,aAAaL,KAAKC,UAAUJ;AAElC,SAASS,SAASd,OAAO,EAAEe,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACrD,IAAIlB,YAAY,SAAS,OAAOa,aAAaE,KAAKC,MAAMC,SAASC;IACjE,IAAI;QACFA,SAAS,MAAMN,WAAW;YAAEZ;YAASmB,WAAW;QAAK,GAAGd,YAAYU,KAAKC,MAAMC;IACjF,EAAE,OAAOG,KAAK;QACZF,SAASE;IACX;AACF;AAGA;;;;;;CAMC,GACD,eAAe,SAASC,eAAeN,GAAW,EAAEC,IAAY,EAAEC,OAAgD,EAAEC,QAAiC;IACnJ,IAAI;QACF,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIO,MAAM;QAC7C,IAAI,OAAON,SAAS,UAAU,MAAM,IAAIM,MAAM;QAE9C,IAAI,OAAOL,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAU;QACZ;QACAA,UAAUA,WAAW,CAAC;QACtB,MAAMM,WAAW7B,aAAa;YAAE8B,KAAKT;YAAK,GAAGE,OAAO;QAAC,GAAG;QACxDA,UAAU;YAAEM;YAAU,GAAGN,OAAO;QAAC;QAEjC,IAAI,OAAOC,aAAa,YAAY,OAAOJ,SAASd,SAASe,KAAKC,MAAMC,SAASC;QACjF,OAAO,IAAIO,QAAQ,CAACnB,SAASoB,SAAWZ,SAASd,SAASe,KAAKC,MAAMC,SAAS,CAACG,KAAKO,SAAYP,MAAMM,OAAON,OAAOd,QAAQqB;IAC9H,EAAE,OAAOP,KAAK;QACZQ,QAAQC,GAAG,CAACT;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOK,QAAQC,MAAM,CAACN;IAC7B;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformTypes.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport loadTsConfig from './loadTsConfig';\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformTypes.cjs');\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst callLazy = lazy(_require)('node-version-call');\nconst workerLazy = lazy(_require)(workerPath);\n\nfunction dispatch(version, src, dest, options, callback) {\n if (version === 'local') return workerLazy()(src, dest, options, callback);\n try {\n callback(null, callLazy()({ version, callbacks: true }, workerPath, src, dest, options));\n } catch (err) {\n callback(err);\n }\n}\n\nimport type { ConfigOptions, TransformTypesCallback } from './types';\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: string, dest: string, options?: ConfigOptions | TransformTypesCallback, callback?: TransformTypesCallback): undefined | Promise<string[]> {\n try {\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 options === 'function') {\n callback = options as TransformTypesCallback;\n options = null;\n }\n options = options || {};\n const tsconfig = loadTsConfig({ cwd: src, ...options }, 'transformTypes');\n options = { tsconfig, ...options };\n\n if (typeof callback === 'function') return dispatch(version, src, dest, options, callback);\n return new Promise((resolve, reject) => dispatch(version, src, dest, options, (err, result) => (err ? reject(err) : resolve(result))));\n } catch (err) {\n console.log(err);\n if (callback) callback(err);\n else return Promise.reject(err);\n }\n}\n"],"names":["path","url","loadTsConfig","major","process","versions","node","split","version","__dirname","dirname","__filename","fileURLToPath","workerPath","join","Module","lazy","_require","require","createRequire","callLazy","workerLazy","dispatch","src","dest","options","callback","callbacks","err","transformTypes","Error","tsconfig","cwd","Promise","resolve","reject","result","console","log"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,OAAOC,kBAAkB,iBAAiB;AAE1C,MAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,UAAUL,QAAQ,KAAK,WAAW;AACxC,MAAMM,YAAYT,KAAKU,OAAO,CAAC,OAAOC,eAAe,cAAcV,IAAIW,aAAa,CAAC,YAAYX,GAAG,IAAIU;AACxG,MAAME,aAAab,KAAKc,IAAI,CAACL,WAAW,MAAM,OAAO,WAAW;AAEhE,OAAOM,YAAY,SAAS;AAC5B,OAAOC,UAAU,aAAa;AAC9B,MAAMC,WAAW,OAAOC,YAAY,cAAcH,OAAOI,aAAa,CAAC,YAAYlB,GAAG,IAAIiB;AAC1F,MAAME,WAAWJ,KAAKC,UAAU;AAChC,MAAMI,aAAaL,KAAKC,UAAUJ;AAElC,SAASS,SAASd,OAAO,EAAEe,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACrD,IAAIlB,YAAY,SAAS,OAAOa,aAAaE,KAAKC,MAAMC,SAASC;IACjE,IAAI;QACFA,SAAS,MAAMN,WAAW;YAAEZ;YAASmB,WAAW;QAAK,GAAGd,YAAYU,KAAKC,MAAMC;IACjF,EAAE,OAAOG,KAAK;QACZF,SAASE;IACX;AACF;AAGA;;;;;;CAMC,GACD,eAAe,SAASC,eAAeN,GAAW,EAAEC,IAAY,EAAEC,OAAgD,EAAEC,QAAiC;IACnJ,IAAI;QACF,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIO,MAAM;QAC7C,IAAI,OAAON,SAAS,UAAU,MAAM,IAAIM,MAAM;QAE9C,IAAI,OAAOL,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAU;QACZ;QACAA,UAAUA,WAAW,CAAC;QACtB,MAAMM,WAAW7B,aAAa;YAAE8B,KAAKT;YAAK,GAAGE,OAAO;QAAC,GAAG;QACxDA,UAAU;YAAEM;YAAU,GAAGN,OAAO;QAAC;QAEjC,IAAI,OAAOC,aAAa,YAAY,OAAOJ,SAASd,SAASe,KAAKC,MAAMC,SAASC;QACjF,OAAO,IAAIO,QAAQ,CAACC,SAASC,SAAWb,SAASd,SAASe,KAAKC,MAAMC,SAAS,CAACG,KAAKQ,SAAYR,MAAMO,OAAOP,OAAOM,QAAQE;IAC9H,EAAE,OAAOR,KAAK;QACZS,QAAQC,GAAG,CAACV;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOK,QAAQE,MAAM,CAACP;IAC7B;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-swc-transform",
3
- "version": "1.12.4",
3
+ "version": "1.12.6",
4
4
  "description": "Typescript transformers for swc. Supports Node >= 0.8",
5
5
  "keywords": [
6
6
  "matcher",
@@ -49,18 +49,18 @@
49
49
  "dependencies": {
50
50
  "@swc/core": "*",
51
51
  "exit": "^0.1.2",
52
- "fs-iterator": "^5.2.1",
52
+ "fs-iterator": "^5.2.3",
53
53
  "get-tsconfig-compat": "^2.0.3",
54
- "install-module-linked": "^1.0.0",
54
+ "install-module-linked": "^1.0.3",
55
55
  "is-absolute": "^1.0.0",
56
56
  "lazy-cache": "^2.0.2",
57
57
  "minimatch": "^3.1.2",
58
58
  "mkdirp-classic": "^0.5.3",
59
- "node-version-call": "^1.5.0",
59
+ "node-version-call": "^1.5.1",
60
60
  "path-posix": "^1.0.0",
61
- "queue-cb": "^1.4.4",
61
+ "queue-cb": "^1.4.7",
62
62
  "resolve": "^1.22.10",
63
- "resolve-once-map-cb": "^0.1.0",
63
+ "resolve-once-map-cb": "^0.1.2",
64
64
  "rimraf2": "^2.8.2",
65
65
  "ts-node": "*",
66
66
  "typescript": "*",