ts-swc-transform 1.13.9 → 1.13.11

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.
Files changed (42) hide show
  1. package/dist/cjs/bindings/ensure.cjs +4 -7
  2. package/dist/cjs/bindings/ensure.cjs.map +1 -1
  3. package/dist/cjs/bindings/findDependency.cjs +2 -1
  4. package/dist/cjs/bindings/findDependency.cjs.map +1 -1
  5. package/dist/cjs/bindings/install.cjs +2 -3
  6. package/dist/cjs/bindings/install.cjs.map +1 -1
  7. package/dist/cjs/lib/swcPrepareOptions.cjs +3 -7
  8. package/dist/cjs/lib/swcPrepareOptions.cjs.map +1 -1
  9. package/dist/cjs/lib/transformFile.cjs +1 -3
  10. package/dist/cjs/lib/transformFile.cjs.map +1 -1
  11. package/dist/cjs/transformDirectory.cjs +1 -3
  12. package/dist/cjs/transformDirectory.cjs.map +1 -1
  13. package/dist/cjs/transformSync.cjs +1 -3
  14. package/dist/cjs/transformSync.cjs.map +1 -1
  15. package/dist/cjs/transformTypes.cjs +1 -3
  16. package/dist/cjs/transformTypes.cjs.map +1 -1
  17. package/dist/cjs/workers/transformSync.cjs +1 -3
  18. package/dist/cjs/workers/transformSync.cjs.map +1 -1
  19. package/dist/cjs/workers/transformTypes.cjs +1 -3
  20. package/dist/cjs/workers/transformTypes.cjs.map +1 -1
  21. package/dist/esm/bindings/ensure.cjs +4 -7
  22. package/dist/esm/bindings/ensure.cjs.map +1 -1
  23. package/dist/esm/bindings/findDependency.cjs +2 -1
  24. package/dist/esm/bindings/findDependency.cjs.map +1 -1
  25. package/dist/esm/bindings/install.cjs +2 -3
  26. package/dist/esm/bindings/install.cjs.map +1 -1
  27. package/dist/esm/lib/swcPrepareOptions.mjs +3 -7
  28. package/dist/esm/lib/swcPrepareOptions.mjs.map +1 -1
  29. package/dist/esm/lib/transformFile.mjs +1 -3
  30. package/dist/esm/lib/transformFile.mjs.map +1 -1
  31. package/dist/esm/transformDirectory.mjs +1 -3
  32. package/dist/esm/transformDirectory.mjs.map +1 -1
  33. package/dist/esm/transformSync.mjs +1 -3
  34. package/dist/esm/transformSync.mjs.map +1 -1
  35. package/dist/esm/transformTypes.mjs +1 -3
  36. package/dist/esm/transformTypes.mjs.map +1 -1
  37. package/dist/esm/workers/transformSync.mjs +1 -3
  38. package/dist/esm/workers/transformSync.mjs.map +1 -1
  39. package/dist/esm/workers/transformTypes.mjs +1 -3
  40. package/dist/esm/workers/transformTypes.mjs.map +1 -1
  41. package/dist/types/bindings/findDependency.d.cts +1 -1
  42. package/package.json +2 -6
@@ -4,8 +4,6 @@ var fs = require('fs');
4
4
  var resolveOnce = require('resolve-once-cb');
5
5
  var findDependency = require('./findDependency.cjs');
6
6
  var workerPath = path.join(__dirname, 'install.cjs');
7
- var major = +process.versions.node.split('.')[0];
8
- var version = major < 14 ? 'stable' : 'local';
9
7
  var existsSync = function(test) {
10
8
  try {
11
9
  (fs.accessSync || fs.statSync)(test);
@@ -19,8 +17,8 @@ module.exports = function ensureBindings(identifier, target, callback) {
19
17
  if (bindings[identifier] === undefined) bindings[identifier] = {};
20
18
  if (bindings[identifier][target] === undefined) {
21
19
  bindings[identifier][target] = resolveOnce(function(cb) {
22
- var _findDependency = findDependency(identifier, target), name = _findDependency.name, modulePath = _findDependency.modulePath;
23
- return existsSync(path.join(modulePath, '..', 'node_modules', name)) ? cb() : require(workerPath)(identifier, target, cb);
20
+ var _findDependency = findDependency(identifier, target), name = _findDependency.name, nodeModules = _findDependency.nodeModules;
21
+ return existsSync(path.join(nodeModules, name)) ? cb() : require(workerPath)(identifier, target, cb);
24
22
  });
25
23
  }
26
24
  bindings[identifier][target](callback);
@@ -30,9 +28,8 @@ module.exports.sync = function(identifier, target) {
30
28
  if (bindingsSync[identifier] === undefined) bindingsSync[identifier] = {};
31
29
  if (bindingsSync[identifier][target] === undefined) {
32
30
  bindingsSync[identifier][target] = function() {
33
- var _findDependency = findDependency(identifier, target), name = _findDependency.name, modulePath = _findDependency.modulePath;
34
- return existsSync(path.join(modulePath, '..', 'node_modules', name)) ? target : require('node-version-call')({
35
- version: version,
31
+ var _findDependency = findDependency(identifier, target), name = _findDependency.name, nodeModules = _findDependency.nodeModules;
32
+ return existsSync(path.join(nodeModules, name)) ? target : require('function-exec-sync')({
36
33
  callbacks: true
37
34
  }, workerPath, identifier, target);
38
35
  }();
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/ensure.cjs"],"sourcesContent":["const path = require('path');\nconst fs = require('fs');\nconst resolveOnce = require('resolve-once-cb');\nconst findDependency = require('./findDependency.cjs');\n\nconst workerPath = path.join(__dirname, 'install.cjs');\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\n\nconst existsSync = (test) => {\n try {\n (fs.accessSync || fs.statSync)(test);\n return true;\n } catch (_) {\n return false;\n }\n};\n\nconst bindings = {};\nmodule.exports = function ensureBindings(identifier, target, callback) {\n if (bindings[identifier] === undefined) bindings[identifier] = {};\n if (bindings[identifier][target] === undefined) {\n bindings[identifier][target] = resolveOnce((cb) => {\n const { name, modulePath } = findDependency(identifier, target);\n return existsSync(path.join(modulePath, '..', 'node_modules', name)) ? cb() : require(workerPath)(identifier, target, cb);\n });\n }\n bindings[identifier][target](callback);\n};\n\nconst bindingsSync = {};\nmodule.exports.sync = (identifier, target) => {\n if (bindingsSync[identifier] === undefined) bindingsSync[identifier] = {};\n if (bindingsSync[identifier][target] === undefined) {\n bindingsSync[identifier][target] = (() => {\n const { name, modulePath } = findDependency(identifier, target);\n return existsSync(path.join(modulePath, '..', 'node_modules', name)) ? target : require('node-version-call')({ version, callbacks: true }, workerPath, identifier, target);\n })();\n }\n};\n"],"names":["path","require","fs","resolveOnce","findDependency","workerPath","join","__dirname","major","process","versions","node","split","version","existsSync","test","accessSync","statSync","_","bindings","module","exports","ensureBindings","identifier","target","callback","undefined","cb","name","modulePath","bindingsSync","sync","callbacks"],"mappings":";AAA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AACC,OAAO,GAAG,AAAC;YAClC,IAA6BpB,kBAAAA,eAAemB,YAAYC,SAAhDI,OAAqBxB,gBAArBwB,MAAMC,aAAezB,gBAAfyB;YACd,OAAOf,WAAWd,KAAKM,IAAI,CAACuB,YAAY,MAAM,gBAAgBD,SAASJ,SAASvB,QAAQ,qBAAqB;gBAAEY,SAAAA;gBAASmB,WAAW;YAAK,GAAG3B,YAAYkB,YAAYC;QACrK;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/ensure.cjs"],"sourcesContent":["const path = require('path');\nconst fs = require('fs');\nconst resolveOnce = require('resolve-once-cb');\nconst findDependency = require('./findDependency.cjs');\n\nconst workerPath = path.join(__dirname, 'install.cjs');\n\nconst existsSync = (test) => {\n try {\n (fs.accessSync || fs.statSync)(test);\n return true;\n } catch (_) {\n return false;\n }\n};\n\nconst bindings = {};\nmodule.exports = function ensureBindings(identifier, target, callback) {\n if (bindings[identifier] === undefined) bindings[identifier] = {};\n if (bindings[identifier][target] === undefined) {\n bindings[identifier][target] = resolveOnce((cb) => {\n const { name, nodeModules } = findDependency(identifier, target);\n return existsSync(path.join(nodeModules, name)) ? cb() : require(workerPath)(identifier, target, cb);\n });\n }\n bindings[identifier][target](callback);\n};\n\nconst bindingsSync = {};\nmodule.exports.sync = (identifier, target) => {\n if (bindingsSync[identifier] === undefined) bindingsSync[identifier] = {};\n if (bindingsSync[identifier][target] === undefined) {\n bindingsSync[identifier][target] = (() => {\n const { name, nodeModules } = findDependency(identifier, target);\n return existsSync(path.join(nodeModules, name)) ? target : require('function-exec-sync')({ callbacks: true }, workerPath, identifier, target);\n })();\n }\n};\n"],"names":["path","require","fs","resolveOnce","findDependency","workerPath","join","__dirname","existsSync","test","accessSync","statSync","_","bindings","module","exports","ensureBindings","identifier","target","callback","undefined","cb","name","nodeModules","bindingsSync","sync","callbacks"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AACrB,IAAMC,KAA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AQ,sBAAsB;gBAAEyB,WAAW;YAAK,GAAGrB,YAAYY,YAAYC;QACxI;IACF;AACF"}
@@ -4,6 +4,7 @@ var fs = require('fs');
4
4
  var resolve = require('resolve');
5
5
  module.exports = function findDependency(identifier, target) {
6
6
  var packagePath = resolve.sync("".concat(identifier, "/package.json"));
7
+ var nodeModules = identifier[0] === '@' ? path.join(packagePath, '..', '..', '..') : path.join(packagePath, '..', '..');
7
8
  var optionalDependencies = JSON.parse(fs.readFileSync(packagePath, 'utf8')).optionalDependencies;
8
9
  var name = Object.keys(optionalDependencies).find(function(name) {
9
10
  return name.indexOf(target) >= 0;
@@ -11,7 +12,7 @@ module.exports = function findDependency(identifier, target) {
11
12
  return name ? {
12
13
  name: name,
13
14
  version: optionalDependencies[name],
14
- modulePath: path.dirname(packagePath)
15
+ nodeModules: nodeModules
15
16
  } : null;
16
17
  };
17
18
  /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/findDependency.cjs"],"sourcesContent":["const path = require('path');\nconst fs = require('fs');\nconst resolve = require('resolve');\n\nmodule.exports = function findDependency(identifier, target) {\n const packagePath = resolve.sync(`${identifier}/package.json`);\n const optionalDependencies = JSON.parse(fs.readFileSync(packagePath, 'utf8')).optionalDependencies;\n const name = Object.keys(optionalDependencies).find((name) => name.indexOf(target) >= 0);\n return name ? { name, version: optionalDependencies[name], modulePath: path.dirname(packagePath) } : null;\n};\n"],"names":["path","require","fs","resolve","module","exports","findDependency","identifier","target","packagePath","sync","optionalDependencies","JSON","parse","readFileSync","name","Object","keys","find","indexOf","version","modulePath","dirname"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AACrB,IAAMC,KAAKD,QAAQ;AACnB,IAAME,UAAUF,QAAQ;AAExBG,OAAOC,OAAO,GAAG,SAASC,eAAeC,UAAU,EAAEC,MAAM;IACzD,IAAMC,cAAcN,QAAQO,IAAI,CAAC,AAAC,GAAa,OAAXH,YAAW;IAC/C,IAAMI,uBAAuBC,KAAKC,KAAK,CAACX,GAAGY,YAAY,CAACL,aAAa,SAASE,oBAAoB;IAClG,IAAMI,OAAOC,OAAOC,IAAI,CAACN,sBAAsBO,IAAI,CAAC,SAACH;eAASA,KAAKI,OAAO,CAACX,WAAW;;IACtF,OAAOO,OAAO;QAAEA,MAAAA;QAAMK,SAAST,oBAAoB,CAACI,KAAK;QAAEM,YAAYrB,KAAKsB,OAAO,CAACb;IAAa,IAAI;AACvG"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/findDependency.cjs"],"sourcesContent":["const path = require('path');\nconst fs = require('fs');\nconst resolve = require('resolve');\n\nmodule.exports = function findDependency(identifier, target) {\n const packagePath = resolve.sync(`${identifier}/package.json`);\n const nodeModules = identifier[0] === '@' ? path.join(packagePath, '..', '..', '..') : path.join(packagePath, '..', '..');\n const optionalDependencies = JSON.parse(fs.readFileSync(packagePath, 'utf8')).optionalDependencies;\n const name = Object.keys(optionalDependencies).find((name) => name.indexOf(target) >= 0);\n return name ? { name, version: optionalDependencies[name], nodeModules } : null;\n};\n"],"names":["path","require","fs","resolve","module","exports","findDependency","identifier","target","packagePath","sync","nodeModules","join","optionalDependencies","JSON","parse","readFileSync","name","Object","keys","find","indexOf","version"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AACrB,IAAMC,KAAKD,QAAQ;AACnB,IAAME,UAAUF,QAAQ;AAExBG,OAAOC,OAAO,GAAG,SAASC,eAAeC,UAAU,EAAEC,MAAM;IACzD,IAAMC,cAAcN,QAAQO,IAAI,CAAC,AAAC,GAAa,OAAXH,YAAW;IAC/C,IAAMI,cAAcJ,UAAU,CAAC,EAAE,KAAK,MAAMP,KAAKY,IAAI,CAACH,aAAa,MAAM,MAAM,QAAQT,KAAKY,IAAI,CAACH,aAAa,MAAM;IACpH,IAAMI,uBAAuBC,KAAKC,KAAK,CAACb,GAAGc,YAAY,CAACP,aAAa,SAASI,oBAAoB;IAClG,IAAMI,OAAOC,OAAOC,IAAI,CAACN,sBAAsBO,IAAI,CAAC,SAACH;eAASA,KAAKI,OAAO,CAACb,WAAW;;IACtF,OAAOS,OAAO;QAAEA,MAAAA;QAAMK,SAAST,oBAAoB,CAACI,KAAK;QAAEN,aAAAA;IAAY,IAAI;AAC7E"}
@@ -3,11 +3,10 @@ var path = require('path');
3
3
  var installModule = require('install-module-linked');
4
4
  var findDependency = require('./findDependency.cjs');
5
5
  module.exports = function installBindings(identifier, target, callback) {
6
- var _findDependency = findDependency(identifier, target), name = _findDependency.name, version = _findDependency.version, modulePath = _findDependency.modulePath;
7
- var nodeModules = path.join(modulePath, '..', 'node_modules');
6
+ var _findDependency = findDependency(identifier, target), name = _findDependency.name, version = _findDependency.version, nodeModules = _findDependency.nodeModules;
8
7
  var installString = version ? "".concat(name, "@").concat(version) : name;
9
8
  installModule(installString, nodeModules, function(err) {
10
- console.log("installed ".concat(path.join(nodeModules, name), " ").concat(!err ? 'successfully' : 'with errors: ${err.message}'));
9
+ console.log("installed ".concat(path.join(nodeModules, name)).concat(!err ? '' : ' with errors: ${err.message}'));
11
10
  callback(err);
12
11
  });
13
12
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/install.cjs"],"sourcesContent":["const path = require('path');\nconst installModule = require('install-module-linked');\nconst findDependency = require('./findDependency.cjs');\n\nmodule.exports = function installBindings(identifier, target, callback) {\n const { name, version, modulePath } = findDependency(identifier, target);\n const nodeModules = path.join(modulePath, '..', 'node_modules');\n const installString = version ? `${name}@${version}` : name;\n\n installModule(installString, nodeModules, (err) => {\n console.log(`installed ${path.join(nodeModules, name)} ${!err ? 'successfully' : 'with errors: ${err.message}'}`);\n callback(err);\n });\n};\n"],"names":["path","require","installModule","findDependency","module","exports","installBindings","identifier","target","callback","name","version","modulePath","nodeModules","join","installString","err","console","log"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AACrB,IAAMC,gBAAgBD,QAAQ;AAC9B,IAAME,iBAAiBF,QAAQ;AAE/BG,OAAOC,OAAO,GAAG,SAASC,gBAAgBC,UAAU,EAAEC,MAAM,EAAEC,QAAQ;IACpE,IAAsCN,kBAAAA,eAAeI,YAAYC,SAAzDE,OAA8BP,gBAA9BO,MAAMC,UAAwBR,gBAAxBQ,SAASC,aAAeT,gBAAfS;IACvB,IAAMC,cAAcb,KAAKc,IAAI,CAACF,YAAY,MAAM;IAChD,IAAMG,gBAAgBJ,UAAU,AAAC,GAAUA,OAARD,MAAK,KAAW,OAARC,WAAYD;IAEvDR,cAAca,eAAeF,aAAa,SAACG;QACzCC,QAAQC,GAAG,CAAC,AAAC,aAA4C,OAAhClB,KAAKc,IAAI,CAACD,aAAaH,OAAM,KAAyD,OAAtD,CAACM,MAAM,iBAAiB;QACjFP,SAASO;IACX;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/install.cjs"],"sourcesContent":["const path = require('path');\nconst installModule = require('install-module-linked');\nconst findDependency = require('./findDependency.cjs');\n\nmodule.exports = function installBindings(identifier, target, callback) {\n const { name, version, nodeModules } = findDependency(identifier, target);\n const installString = version ? `${name}@${version}` : name;\n\n installModule(installString, nodeModules, (err) => {\n console.log(`installed ${path.join(nodeModules, name)}${!err ? '' : ' with errors: ${err.message}'}`);\n callback(err);\n });\n};\n"],"names":["path","require","installModule","findDependency","module","exports","installBindings","identifier","target","callback","name","version","nodeModules","installString","err","console","log","join"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AACrB,IAAMC,gBAAgBD,QAAQ;AAC9B,IAAME,iBAAiBF,QAAQ;AAE/BG,OAAOC,OAAO,GAAG,SAASC,gBAAgBC,UAAU,EAAEC,MAAM,EAAEC,QAAQ;IACpE,IAAuCN,kBAAAA,eAAeI,YAAYC,SAA1DE,OAA+BP,gBAA/BO,MAAMC,UAAyBR,gBAAzBQ,SAASC,cAAgBT,gBAAhBS;IACvB,IAAMC,gBAAgBF,UAAU,AAAC,GAAUA,OAARD,MAAK,KAAW,OAARC,WAAYD;IAEvDR,cAAcW,eAAeD,aAAa,SAACE;QACzCC,QAAQC,GAAG,CAAC,AAAC,aAA2C,OAA/BhB,KAAKiB,IAAI,CAACL,aAAaF,OAAmD,OAA3C,CAACI,MAAM,KAAK;QACpEL,SAASK;IACX;AACF"}
@@ -11,22 +11,18 @@ Object.defineProperty(exports, "default", {
11
11
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
12
  var _ensurecjs = require("../bindings/ensure.cjs");
13
13
  var _module = /*#__PURE__*/ _interop_require_default(require("module"));
14
- var _lazycache = /*#__PURE__*/ _interop_require_default(require("lazy-cache"));
15
14
  function _interop_require_default(obj) {
16
15
  return obj && obj.__esModule ? obj : {
17
16
  default: obj
18
17
  };
19
18
  }
20
19
  var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
21
- var tsLazy = (0, _lazycache.default)(_require)('typescript');
22
- var swcLazy = (0, _lazycache.default)(_require)('@swc/core');
23
- var transpilerLazy = (0, _lazycache.default)(_require)('ts-node/transpilers/swc');
24
20
  function swcPrepareOptions(tsconfig) {
25
21
  (0, _ensurecjs.sync)('@swc/core', "".concat(process.platform, "-").concat(process.arch));
26
22
  try {
27
- var ts = tsLazy();
28
- var swc = swcLazy();
29
- var transpiler = transpilerLazy();
23
+ var ts = _require('typescript');
24
+ var swc = _require('@swc/core');
25
+ var transpiler = _require('ts-node/transpilers/swc');
30
26
  var parsed = ts.parseJsonConfigFileContent(tsconfig.config, ts.sys, _path.default.dirname(tsconfig.path));
31
27
  return transpiler.createSwcOptions(parsed.options, undefined, swc, 'swc');
32
28
  } catch (err) {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/swcPrepareOptions.ts"],"sourcesContent":["import path from 'path';\nimport { sync as ensureBindings } from '../bindings/ensure.cjs';\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst tsLazy = lazy(_require)('typescript');\nconst swcLazy = lazy(_require)('@swc/core');\nconst transpilerLazy = lazy(_require)('ts-node/transpilers/swc');\n\nimport type { TsConfigResult } from 'get-tsconfig-compat';\n\nexport default function swcPrepareOptions(tsconfig: TsConfigResult) {\n ensureBindings('@swc/core', `${process.platform}-${process.arch}`);\n try {\n const ts = tsLazy();\n const swc = swcLazy();\n const transpiler = transpilerLazy();\n const parsed = ts.parseJsonConfigFileContent(tsconfig.config, ts.sys, path.dirname(tsconfig.path));\n return transpiler.createSwcOptions(parsed.options, undefined, swc, 'swc');\n } catch (err) {\n console.log(`swcPrepareOptions failed: ${err.message}`);\n return {};\n }\n}\n"],"names":["swcPrepareOptions","_require","require","Module","createRequire","tsLazy","lazy","swcLazy","transpilerLazy","tsconfig","ensureBindings","process","platform","arch","ts","swc","transpiler","parsed","parseJsonConfigFileContent","config","sys","path","dirname","createSwcOptions","options","undefined","err","console","log","message"],"mappings":";;;;+BAYA;;;eAAwBA;;;2DAZP;yBACsB;6DAEpB;gEACF;;;;;;AACjB,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,SAASC,IAAAA,kBAAI,EAACL,UAAU;AAC9B,IAAMM,UAAUD,IAAAA,kBAAI,EAACL,UAAU;AAC/B,IAAMO,iBAAiBF,IAAAA,kBAAI,EAACL,UAAU;AAIvB,SAASD,kBAAkBS,QAAwB;IAChEC,IAAAA,eAAc,EAAC,aAAa,AAAC,GAAsBC,OAApBA,QAAQC,QAAQ,EAAC,KAAgB,OAAbD,QAAQE,IAAI;IAC/D,IAAI;QACF,IAAMC,KAAKT;QACX,IAAMU,MAAMR;QACZ,IAAMS,aAAaR;QACnB,IAAMS,SAASH,GAAGI,0BAA0B,CAACT,SAASU,MAAM,EAAEL,GAAGM,GAAG,EAAEC,aAAI,CAACC,OAAO,CAACb,SAASY,IAAI;QAChG,OAAOL,WAAWO,gBAAgB,CAACN,OAAOO,OAAO,EAAEC,WAAWV,KAAK;IACrE,EAAE,OAAOW,KAAK;QACZC,QAAQC,GAAG,CAAC,AAAC,6BAAwC,OAAZF,IAAIG,OAAO;QACpD,OAAO,CAAC;IACV;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/swcPrepareOptions.ts"],"sourcesContent":["import path from 'path';\nimport { sync as ensureBindings } from '../bindings/ensure.cjs';\n\nimport Module from 'module';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nimport type { TsConfigResult } from 'get-tsconfig-compat';\nexport default function swcPrepareOptions(tsconfig: TsConfigResult) {\n ensureBindings('@swc/core', `${process.platform}-${process.arch}`);\n try {\n const ts = _require('typescript');\n const swc = _require('@swc/core');\n const transpiler = _require('ts-node/transpilers/swc');\n const parsed = ts.parseJsonConfigFileContent(tsconfig.config, ts.sys, path.dirname(tsconfig.path));\n return transpiler.createSwcOptions(parsed.options, undefined, swc, 'swc');\n } catch (err) {\n console.log(`swcPrepareOptions failed: ${err.message}`);\n return {};\n }\n}\n"],"names":["swcPrepareOptions","_require","require","Module","createRequire","tsconfig","ensureBindings","process","platform","arch","ts","swc","transpiler","parsed","parseJsonConfigFileContent","config","sys","path","dirname","createSwcOptions","options","undefined","err","console","log","message"],"mappings":";;;;+BAOA;;;eAAwBA;;;2DAPP;yBACsB;6DAEpB;;;;;;AACnB,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAG3E,SAASF,kBAAkBK,QAAwB;IAChEC,IAAAA,eAAc,EAAC,aAAa,AAAC,GAAsBC,OAApBA,QAAQC,QAAQ,EAAC,KAAgB,OAAbD,QAAQE,IAAI;IAC/D,IAAI;QACF,IAAMC,KAAKT,SAAS;QACpB,IAAMU,MAAMV,SAAS;QACrB,IAAMW,aAAaX,SAAS;QAC5B,IAAMY,SAASH,GAAGI,0BAA0B,CAACT,SAASU,MAAM,EAAEL,GAAGM,GAAG,EAAEC,aAAI,CAACC,OAAO,CAACb,SAASY,IAAI;QAChG,OAAOL,WAAWO,gBAAgB,CAACN,OAAOO,OAAO,EAAEC,WAAWV,KAAK;IACrE,EAAE,OAAOW,KAAK;QACZC,QAAQC,GAAG,CAAC,AAAC,6BAAwC,OAAZF,IAAIG,OAAO;QACpD,OAAO,CAAC;IACV;AACF"}
@@ -17,7 +17,6 @@ var _patchCJS = /*#__PURE__*/ _interop_require_default(require("../lib/patchCJS.
17
17
  var _patchESM = /*#__PURE__*/ _interop_require_default(require("../lib/patchESM.cjs"));
18
18
  var _swcPrepareOptions = /*#__PURE__*/ _interop_require_default(require("../lib/swcPrepareOptions.cjs"));
19
19
  var _module = /*#__PURE__*/ _interop_require_default(require("module"));
20
- var _lazycache = /*#__PURE__*/ _interop_require_default(require("lazy-cache"));
21
20
  function _define_property(obj, key, value) {
22
21
  if (key in obj) {
23
22
  Object.defineProperty(obj, key, {
@@ -76,7 +75,6 @@ function _object_spread_props(target, source) {
76
75
  return target;
77
76
  }
78
77
  var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
79
- var swcLazy = (0, _lazycache.default)(_require)('@swc/core');
80
78
  function transformFile(entry, dest, type, options, callback) {
81
79
  (0, _ensurecjs.default)('@swc/core', "".concat(process.platform, "-").concat(process.arch), function(err) {
82
80
  if (err) return callback(err);
@@ -90,7 +88,7 @@ function transformFile(entry, dest, type, options, callback) {
90
88
  tsconfig.config.compilerOptions.target = 'ES5';
91
89
  }
92
90
  var swcOptions = (0, _swcPrepareOptions.default)(tsconfig);
93
- var swc = swcLazy();
91
+ var swc = _require('@swc/core');
94
92
  swc.transformFile(entry.fullPath, _object_spread_props(_object_spread({}, entry.basename.endsWith('.tsx') || entry.basename.endsWith('.jsx') ? swcOptions.tsxOptions : swcOptions.nonTsxOptions), {
95
93
  filename: entry.basename
96
94
  })).then(function(output) {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/transformFile.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport mkdirp from 'mkdirp-classic';\nimport Queue from 'queue-cb';\nimport ensureBindings from '../bindings/ensure.cjs';\n\nimport patchCJS from '../lib/patchCJS';\nimport patchESM from '../lib/patchESM';\nimport swcPrepareOptions from '../lib/swcPrepareOptions';\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst swcLazy = lazy(_require)('@swc/core');\n\nexport default function transformFile(entry, dest, type, options, callback) {\n ensureBindings('@swc/core', `${process.platform}-${process.arch}`, (err) => {\n if (err) return callback(err);\n\n let tsconfig = options.tsconfig;\n\n // overrides for cjs\n if (type === 'cjs') {\n tsconfig = { ...tsconfig };\n tsconfig.config = { ...tsconfig.config };\n tsconfig.config.compilerOptions = { ...(tsconfig.config.compilerOptions || {}) };\n tsconfig.config.compilerOptions.module = 'CommonJS';\n tsconfig.config.compilerOptions.target = 'ES5';\n }\n\n const swcOptions = swcPrepareOptions(tsconfig);\n const swc = swcLazy();\n\n swc\n .transformFile(entry.fullPath, {\n ...(entry.basename.endsWith('.tsx') || entry.basename.endsWith('.jsx') ? swcOptions.tsxOptions : swcOptions.nonTsxOptions),\n filename: entry.basename,\n })\n .then((output) => {\n const extTarget = type === 'esm' ? patchESM(entry, output, options) : patchCJS(entry, output, options);\n const ext = path.extname(entry.path);\n const outPath = path.join(dest, (ext ? entry.path.slice(0, -ext.length) : entry.path) + extTarget);\n\n mkdirp(path.dirname(outPath), () => {\n const queue = new Queue();\n queue.defer(fs.writeFile.bind(null, outPath, output.code, 'utf8'));\n !options.sourceMaps || queue.defer(fs.writeFile.bind(null, `${outPath}.map`, output.map, 'utf8'));\n queue.await((err) => (err ? callback(err) : callback(null, outPath)));\n });\n })\n .catch(callback);\n });\n}\n"],"names":["transformFile","_require","require","Module","createRequire","swcLazy","lazy","entry","dest","type","options","callback","ensureBindings","process","platform","arch","err","tsconfig","config","compilerOptions","module","target","swcOptions","swcPrepareOptions","swc","fullPath","basename","endsWith","tsxOptions","nonTsxOptions","filename","then","output","extTarget","patchESM","patchCJS","ext","path","extname","outPath","join","slice","length","mkdirp","dirname","queue","Queue","defer","fs","writeFile","bind","code","sourceMaps","map","await","catch"],"mappings":";;;;+BAeA;;;eAAwBA;;;yDAfT;2DACE;oEACE;8DACD;gEACS;+DAEN;+DACA;wEACS;6DAEX;gEACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACjB,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,UAAUC,IAAAA,kBAAI,EAACL,UAAU;AAEhB,SAASD,cAAcO,KAAK,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACxEC,IAAAA,kBAAc,EAAC,aAAa,AAAC,GAAsBC,OAApBA,QAAQC,QAAQ,EAAC,KAAgB,OAAbD,QAAQE,IAAI,GAAI,SAACC;QAClE,IAAIA,KAAK,OAAOL,SAASK;QAEzB,IAAIC,WAAWP,QAAQO,QAAQ;QAE/B,oBAAoB;QACpB,IAAIR,SAAS,OAAO;YAClBQ,WAAW,mBAAKA;YAChBA,SAASC,MAAM,GAAG,mBAAKD,SAASC,MAAM;YACtCD,SAASC,MAAM,CAACC,eAAe,GAAG,mBAAMF,SAASC,MAAM,CAACC,eAAe,IAAI,CAAC;YAC5EF,SAASC,MAAM,CAACC,eAAe,CAACC,MAAM,GAAG;YACzCH,SAASC,MAAM,CAACC,eAAe,CAACE,MAAM,GAAG;QAC3C;QAEA,IAAMC,aAAaC,IAAAA,0BAAiB,EAACN;QACrC,IAAMO,MAAMnB;QAEZmB,IACGxB,aAAa,CAACO,MAAMkB,QAAQ,EAAE,wCACzBlB,MAAMmB,QAAQ,CAACC,QAAQ,CAAC,WAAWpB,MAAMmB,QAAQ,CAACC,QAAQ,CAAC,UAAUL,WAAWM,UAAU,GAAGN,WAAWO,aAAa;YACzHC,UAAUvB,MAAMmB,QAAQ;YAEzBK,IAAI,CAAC,SAACC;YACL,IAAMC,YAAYxB,SAAS,QAAQyB,IAAAA,iBAAQ,EAAC3B,OAAOyB,QAAQtB,WAAWyB,IAAAA,iBAAQ,EAAC5B,OAAOyB,QAAQtB;YAC9F,IAAM0B,MAAMC,aAAI,CAACC,OAAO,CAAC/B,MAAM8B,IAAI;YACnC,IAAME,UAAUF,aAAI,CAACG,IAAI,CAAChC,MAAM,AAAC4B,CAAAA,MAAM7B,MAAM8B,IAAI,CAACI,KAAK,CAAC,GAAG,CAACL,IAAIM,MAAM,IAAInC,MAAM8B,IAAI,AAAD,IAAKJ;YAExFU,IAAAA,sBAAM,EAACN,aAAI,CAACO,OAAO,CAACL,UAAU;gBAC5B,IAAMM,QAAQ,IAAIC,gBAAK;gBACvBD,MAAME,KAAK,CAACC,WAAE,CAACC,SAAS,CAACC,IAAI,CAAC,MAAMX,SAASP,OAAOmB,IAAI,EAAE;gBAC1D,CAACzC,QAAQ0C,UAAU,IAAIP,MAAME,KAAK,CAACC,WAAE,CAACC,SAAS,CAACC,IAAI,CAAC,MAAM,AAAC,GAAU,OAARX,SAAQ,SAAOP,OAAOqB,GAAG,EAAE;gBACzFR,MAAMS,KAAK,CAAC,SAACtC;2BAASA,MAAML,SAASK,OAAOL,SAAS,MAAM4B;;YAC7D;QACF,GACCgB,KAAK,CAAC5C;IACX;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/transformFile.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport mkdirp from 'mkdirp-classic';\nimport Queue from 'queue-cb';\nimport ensureBindings from '../bindings/ensure.cjs';\n\nimport patchCJS from '../lib/patchCJS';\nimport patchESM from '../lib/patchESM';\nimport swcPrepareOptions from '../lib/swcPrepareOptions';\n\nimport Module from 'module';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nexport default function transformFile(entry, dest, type, options, callback) {\n ensureBindings('@swc/core', `${process.platform}-${process.arch}`, (err) => {\n if (err) return callback(err);\n\n let tsconfig = options.tsconfig;\n\n // overrides for cjs\n if (type === 'cjs') {\n tsconfig = { ...tsconfig };\n tsconfig.config = { ...tsconfig.config };\n tsconfig.config.compilerOptions = { ...(tsconfig.config.compilerOptions || {}) };\n tsconfig.config.compilerOptions.module = 'CommonJS';\n tsconfig.config.compilerOptions.target = 'ES5';\n }\n\n const swcOptions = swcPrepareOptions(tsconfig);\n const swc = _require('@swc/core');\n\n swc\n .transformFile(entry.fullPath, {\n ...(entry.basename.endsWith('.tsx') || entry.basename.endsWith('.jsx') ? swcOptions.tsxOptions : swcOptions.nonTsxOptions),\n filename: entry.basename,\n })\n .then((output) => {\n const extTarget = type === 'esm' ? patchESM(entry, output, options) : patchCJS(entry, output, options);\n const ext = path.extname(entry.path);\n const outPath = path.join(dest, (ext ? entry.path.slice(0, -ext.length) : entry.path) + extTarget);\n\n mkdirp(path.dirname(outPath), () => {\n const queue = new Queue();\n queue.defer(fs.writeFile.bind(null, outPath, output.code, 'utf8'));\n !options.sourceMaps || queue.defer(fs.writeFile.bind(null, `${outPath}.map`, output.map, 'utf8'));\n queue.await((err) => (err ? callback(err) : callback(null, outPath)));\n });\n })\n .catch(callback);\n });\n}\n"],"names":["transformFile","_require","require","Module","createRequire","entry","dest","type","options","callback","ensureBindings","process","platform","arch","err","tsconfig","config","compilerOptions","module","target","swcOptions","swcPrepareOptions","swc","fullPath","basename","endsWith","tsxOptions","nonTsxOptions","filename","then","output","extTarget","patchESM","patchCJS","ext","path","extname","outPath","join","slice","length","mkdirp","dirname","queue","Queue","defer","fs","writeFile","bind","code","sourceMaps","map","await","catch"],"mappings":";;;;+BAaA;;;eAAwBA;;;yDAbT;2DACE;oEACE;8DACD;gEACS;+DAEN;+DACA;wEACS;6DAEX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACnB,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAE3E,SAASF,cAAcK,KAAK,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACxEC,IAAAA,kBAAc,EAAC,aAAa,AAAC,GAAsBC,OAApBA,QAAQC,QAAQ,EAAC,KAAgB,OAAbD,QAAQE,IAAI,GAAI,SAACC;QAClE,IAAIA,KAAK,OAAOL,SAASK;QAEzB,IAAIC,WAAWP,QAAQO,QAAQ;QAE/B,oBAAoB;QACpB,IAAIR,SAAS,OAAO;YAClBQ,WAAW,mBAAKA;YAChBA,SAASC,MAAM,GAAG,mBAAKD,SAASC,MAAM;YACtCD,SAASC,MAAM,CAACC,eAAe,GAAG,mBAAMF,SAASC,MAAM,CAACC,eAAe,IAAI,CAAC;YAC5EF,SAASC,MAAM,CAACC,eAAe,CAACC,MAAM,GAAG;YACzCH,SAASC,MAAM,CAACC,eAAe,CAACE,MAAM,GAAG;QAC3C;QAEA,IAAMC,aAAaC,IAAAA,0BAAiB,EAACN;QACrC,IAAMO,MAAMrB,SAAS;QAErBqB,IACGtB,aAAa,CAACK,MAAMkB,QAAQ,EAAE,wCACzBlB,MAAMmB,QAAQ,CAACC,QAAQ,CAAC,WAAWpB,MAAMmB,QAAQ,CAACC,QAAQ,CAAC,UAAUL,WAAWM,UAAU,GAAGN,WAAWO,aAAa;YACzHC,UAAUvB,MAAMmB,QAAQ;YAEzBK,IAAI,CAAC,SAACC;YACL,IAAMC,YAAYxB,SAAS,QAAQyB,IAAAA,iBAAQ,EAAC3B,OAAOyB,QAAQtB,WAAWyB,IAAAA,iBAAQ,EAAC5B,OAAOyB,QAAQtB;YAC9F,IAAM0B,MAAMC,aAAI,CAACC,OAAO,CAAC/B,MAAM8B,IAAI;YACnC,IAAME,UAAUF,aAAI,CAACG,IAAI,CAAChC,MAAM,AAAC4B,CAAAA,MAAM7B,MAAM8B,IAAI,CAACI,KAAK,CAAC,GAAG,CAACL,IAAIM,MAAM,IAAInC,MAAM8B,IAAI,AAAD,IAAKJ;YAExFU,IAAAA,sBAAM,EAACN,aAAI,CAACO,OAAO,CAACL,UAAU;gBAC5B,IAAMM,QAAQ,IAAIC,gBAAK;gBACvBD,MAAME,KAAK,CAACC,WAAE,CAACC,SAAS,CAACC,IAAI,CAAC,MAAMX,SAASP,OAAOmB,IAAI,EAAE;gBAC1D,CAACzC,QAAQ0C,UAAU,IAAIP,MAAME,KAAK,CAACC,WAAE,CAACC,SAAS,CAACC,IAAI,CAAC,MAAM,AAAC,GAAU,OAARX,SAAQ,SAAOP,OAAOqB,GAAG,EAAE;gBACzFR,MAAMS,KAAK,CAAC,SAACtC;2BAASA,MAAML,SAASK,OAAOL,SAAS,MAAM4B;;YAC7D;QACF,GACCgB,KAAK,CAAC5C;IACX;AACF"}
@@ -19,7 +19,6 @@ var _path = /*#__PURE__*/ _interop_require_default(require("path"));
19
19
  var _url = /*#__PURE__*/ _interop_require_default(require("url"));
20
20
  var _loadTsConfig = /*#__PURE__*/ _interop_require_default(require("./loadTsConfig.cjs"));
21
21
  var _module = /*#__PURE__*/ _interop_require_default(require("module"));
22
- var _lazycache = /*#__PURE__*/ _interop_require_default(require("lazy-cache"));
23
22
  function _define_property(obj, key, value) {
24
23
  if (key in obj) {
25
24
  Object.defineProperty(obj, key, {
@@ -58,11 +57,10 @@ var version = major < 14 ? 'stable' : 'local';
58
57
  var __dirname = _path.default.dirname(typeof __filename === 'undefined' ? _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()) : __filename);
59
58
  var workerPath = _path.default.join(__dirname, '..', 'cjs', 'workers', 'transformDirectory.cjs');
60
59
  var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
61
- var callLazy = (0, _lazycache.default)(_require)('node-version-call');
62
60
  function dispatch(version, src, dest, type, options, callback) {
63
61
  if (version === 'local') return _require(workerPath)(src, dest, type, options, callback);
64
62
  try {
65
- callback(null, callLazy()({
63
+ callback(null, _require('node-version-call')({
66
64
  version: version,
67
65
  callbacks: true
68
66
  }, workerPath, src, dest, type, options));
@@ -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.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');\n\nfunction dispatch(version, src, dest, type, options, callback) {\n if (version === 'local') return _require(workerPath)(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) as undefined;\n return new Promise((resolve, reject) => dispatch(version, src, dest, type, options, (err, result) => (err ? reject(err) : resolve(result))));\n } catch (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","dispatch","src","dest","type","options","callback","callbacks","err","Error","tsconfig","loadTsConfig","cwd","Promise","resolve","reject","result"],"mappings":";;;;+BAwBA;;;;;;;CAOC,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,IAAI,CAACP,WAAW,MAAM,OAAO,WAAW;AAIhE,IAAMQ,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,WAAWC,IAAAA,kBAAI,EAACL,UAAU;AAEhC,SAASM,SAASf,OAAO,EAAEgB,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC3D,IAAIpB,YAAY,SAAS,OAAOS,SAASF,YAAYS,KAAKC,MAAMC,MAAMC,SAASC;IAC/E,IAAI;QACFA,SAAS,MAAMP,WAAW;YAAEb,SAAAA;YAASqB,WAAW;QAAK,GAAGd,YAAYS,KAAKC,MAAMC,MAAMC;IACvF,EAAE,OAAOG,KAAK;QACZF,SAASE;IACX;AACF;AAWe,SAAS5B,mBAAmBsB,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,SAASf,SAASgB,KAAKC,MAAMC,MAAMC,SAASC;QACvF,OAAO,IAAIO,QAAQ,SAACC,SAASC;mBAAWd,SAASf,SAASgB,KAAKC,MAAMC,MAAMC,SAAS,SAACG,KAAKQ;uBAAYR,MAAMO,OAAOP,OAAOM,QAAQE;;;IACpI,EAAE,OAAOR,KAAK;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOK,QAAQE,MAAM,CAACP;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';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nfunction dispatch(version, src, dest, type, options, callback) {\n if (version === 'local') return _require(workerPath)(src, dest, type, options, callback);\n try {\n callback(null, _require('node-version-call')({ 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) as undefined;\n return new Promise((resolve, reject) => dispatch(version, src, dest, type, options, (err, result) => (err ? reject(err) : resolve(result))));\n } catch (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","dispatch","src","dest","type","options","callback","callbacks","err","Error","tsconfig","loadTsConfig","cwd","Promise","resolve","reject","result"],"mappings":";;;;+BAsBA;;;;;;;CAOC,GACD;;;eAAwBA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AAI,OAAOC,aAAa,YAAY,OAAOL,SAASb,SAASc,KAAKC,MAAMC,MAAMC,SAASC;QACvF,OAAO,IAAIO,QAAQ,SAACC,SAASC;mBAAWd,SAASb,SAASc,KAAKC,MAAMC,MAAMC,SAAS,SAACG,KAAKQ;uBAAYR,MAAMO,OAAOP,OAAOM,QAAQE;;;IACpI,EAAE,OAAOR,KAAK;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOK,QAAQE,MAAM,CAACP;IAC7B;AACF"}
@@ -17,7 +17,6 @@ var _path = /*#__PURE__*/ _interop_require_default(require("path"));
17
17
  var _url = /*#__PURE__*/ _interop_require_default(require("url"));
18
18
  var _gettsconfigcompat = /*#__PURE__*/ _interop_require_wildcard(require("get-tsconfig-compat"));
19
19
  var _module = /*#__PURE__*/ _interop_require_default(require("module"));
20
- var _lazycache = /*#__PURE__*/ _interop_require_default(require("lazy-cache"));
21
20
  function _interop_require_default(obj) {
22
21
  return obj && obj.__esModule ? obj : {
23
22
  default: obj
@@ -69,10 +68,9 @@ var version = major < 14 ? 'stable' : 'local';
69
68
  var __dirname = _path.default.dirname(typeof __filename === 'undefined' ? _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()) : __filename);
70
69
  var workerPath = _path.default.join(__dirname, '..', 'cjs', 'workers', 'transformSync.cjs');
71
70
  var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
72
- var callLazy = (0, _lazycache.default)(_require)('node-version-call');
73
71
  function dispatch(version, contents, fileName, tsconfig) {
74
72
  if (version === 'local') return _require(workerPath)(contents, fileName, tsconfig);
75
- return callLazy()(version, workerPath, contents, fileName, tsconfig);
73
+ return _require('node-version-call')(version, workerPath, contents, fileName, tsconfig);
76
74
  }
77
75
  function transformSync(contents, fileName, tsconfig) {
78
76
  if (typeof contents !== 'string') throw new Error('transformTypes: unexpected contents');
@@ -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.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');\n\nfunction dispatch(version, contents, fileName, tsconfig) {\n if (version === 'local') return _require(workerPath)(contents, fileName, tsconfig);\n return callLazy()(version, workerPath, contents, fileName, tsconfig);\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","dispatch","contents","fileName","tsconfig","Error","getTS","getTsconfig","cwd"],"mappings":";;;;+BAqBA;;;;;CAKC,GACD;;;eAAwBA;;;2DA3BP;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;AAEhC,SAASM,SAASf,OAAO,EAAEgB,QAAQ,EAAEC,QAAQ,EAAEC,QAAQ;IACrD,IAAIlB,YAAY,SAAS,OAAOS,SAASF,YAAYS,UAAUC,UAAUC;IACzE,OAAOL,WAAWb,SAASO,YAAYS,UAAUC,UAAUC;AAC7D;AAUe,SAASxB,cAAcsB,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,CAACzB,QAAQ0B,GAAG;IACvD,OAAOP,SAASf,SAASgB,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';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nfunction dispatch(version, contents, fileName, tsconfig) {\n if (version === 'local') return _require(workerPath)(contents, fileName, tsconfig);\n return _require('node-version-call')(version, workerPath, contents, fileName, tsconfig);\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","dispatch","contents","fileName","tsconfig","Error","getTS","getTsconfig","cwd"],"mappings":";;;;+BAmBA;;;;;CAKC,GACD;;;eAAwBA;;;2DAzBP;0DACD;yEACO;6DAOJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AALnB,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;AAGhE,IAAMQ,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAE1F,SAASG,SAASb,OAAO,EAAEc,QAAQ,EAAEC,QAAQ,EAAEC,QAAQ;IACrD,IAAIhB,YAAY,SAAS,OAAOS,SAASF,YAAYO,UAAUC,UAAUC;IACzE,OAAOP,SAAS,qBAAqBT,SAASO,YAAYO,UAAUC,UAAUC;AAChF;AAUe,SAAStB,cAAcoB,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,CAACvB,QAAQwB,GAAG;IACvD,OAAOP,SAASb,SAASc,UAAUC,UAAUC;AAC/C"}
@@ -18,7 +18,6 @@ var _path = /*#__PURE__*/ _interop_require_default(require("path"));
18
18
  var _url = /*#__PURE__*/ _interop_require_default(require("url"));
19
19
  var _loadTsConfig = /*#__PURE__*/ _interop_require_default(require("./loadTsConfig.cjs"));
20
20
  var _module = /*#__PURE__*/ _interop_require_default(require("module"));
21
- var _lazycache = /*#__PURE__*/ _interop_require_default(require("lazy-cache"));
22
21
  function _define_property(obj, key, value) {
23
22
  if (key in obj) {
24
23
  Object.defineProperty(obj, key, {
@@ -57,11 +56,10 @@ var version = major < 14 ? 'stable' : 'local';
57
56
  var __dirname = _path.default.dirname(typeof __filename === 'undefined' ? _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()) : __filename);
58
57
  var workerPath = _path.default.join(__dirname, '..', 'cjs', 'workers', 'transformTypes.cjs');
59
58
  var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
60
- var callLazy = (0, _lazycache.default)(_require)('node-version-call');
61
59
  function dispatch(version, src, dest, options, callback) {
62
60
  if (version === 'local') return _require(workerPath)(src, dest, options, callback);
63
61
  try {
64
- callback(null, callLazy()({
62
+ callback(null, _require('node-version-call')({
65
63
  version: version,
66
64
  callbacks: true
67
65
  }, workerPath, src, dest, options));
@@ -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.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');\n\nfunction dispatch(version, src, dest, options, callback) {\n if (version === 'local') return _require(workerPath)(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 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","dispatch","src","dest","options","callback","callbacks","err","Error","tsconfig","loadTsConfig","cwd","Promise","resolve","reject","result"],"mappings":";;;;+BAwBA;;;;;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SAASf,SAASgB,KAAKC,MAAMC,SAASC;QACjF,OAAO,IAAIO,QAAQ,SAACC,SAASC;mBAAWb,SAASf,SAASgB,KAAKC,MAAMC,SAAS,SAACG,KAAKQ;uBAAYR,MAAMO,OAAOP,OAAOM,QAAQE;;;IAC9H,EAAE,OAAOR,KAAK;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOK,QAAQE,MAAM,CAACP;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';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nfunction dispatch(version, src, dest, options, callback) {\n if (version === 'local') return _require(workerPath)(src, dest, options, callback);\n try {\n callback(null, _require('node-version-call')({ 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 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","dispatch","src","dest","options","callback","callbacks","err","Error","tsconfig","loadTsConfig","cwd","Promise","resolve","reject","result"],"mappings":";;;;+BAsBA;;;;;;CAMC,GACD;;;eAAwBA;;;2DA7BP;0DACD;mEACS;6DAON;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AALnB,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;AAGhE,IAAMQ,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAE1F,SAASG,SAASb,OAAO,EAAEc,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACrD,IAAIjB,YAAY,SAAS,OAAOS,SAASF,YAAYO,KAAKC,MAAMC,SAASC;IACzE,IAAI;QACFA,SAAS,MAAMR,SAAS,qBAAqB;YAAET,SAAAA;YAASkB,WAAW;QAAK,GAAGX,YAAYO,KAAKC,MAAMC;IACpG,EAAE,OAAOG,KAAK;QACZF,SAASE;IACX;AACF;AAUe,SAASzB,eAAeoB,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,SAASb,SAASc,KAAKC,MAAMC,SAASC;QACjF,OAAO,IAAIO,QAAQ,SAACC,SAASC;mBAAWb,SAASb,SAASc,KAAKC,MAAMC,SAAS,SAACG,KAAKQ;uBAAYR,MAAMO,OAAOP,OAAOM,QAAQE;;;IAC9H,EAAE,OAAOR,KAAK;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOK,QAAQE,MAAM,CAACP;IAC7B;AACF"}
@@ -10,7 +10,6 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  var _swcPrepareOptions = /*#__PURE__*/ _interop_require_default(require("../lib/swcPrepareOptions.cjs"));
12
12
  var _module = /*#__PURE__*/ _interop_require_default(require("module"));
13
- var _lazycache = /*#__PURE__*/ _interop_require_default(require("lazy-cache"));
14
13
  function _define_property(obj, key, value) {
15
14
  if (key in obj) {
16
15
  Object.defineProperty(obj, key, {
@@ -69,10 +68,9 @@ function _object_spread_props(target, source) {
69
68
  return target;
70
69
  }
71
70
  var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
72
- var swcLazy = (0, _lazycache.default)(_require)('@swc/core');
73
71
  function transformSyncWorker(contents, fileName, tsconfig) {
74
72
  var swcOptions = (0, _swcPrepareOptions.default)(tsconfig);
75
- var swc = swcLazy();
73
+ var swc = _require('@swc/core');
76
74
  return swc.transformSync(contents, _object_spread_props(_object_spread({}, fileName.endsWith('.tsx') || fileName.endsWith('.jsx') ? swcOptions.tsxOptions : swcOptions.nonTsxOptions), {
77
75
  filename: fileName
78
76
  }));
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformSync.ts"],"sourcesContent":["import swcPrepareOptions from '../lib/swcPrepareOptions';\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst swcLazy = lazy(_require)('@swc/core');\n\nimport type { TsConfigResult } from 'get-tsconfig-compat';\nexport default function transformSyncWorker(contents: string, fileName: string, tsconfig: TsConfigResult) {\n const swcOptions = swcPrepareOptions(tsconfig);\n const swc = swcLazy();\n return swc.transformSync(contents, {\n ...(fileName.endsWith('.tsx') || fileName.endsWith('.jsx') ? swcOptions.tsxOptions : swcOptions.nonTsxOptions),\n filename: fileName,\n });\n}\n"],"names":["transformSyncWorker","_require","require","Module","createRequire","swcLazy","lazy","contents","fileName","tsconfig","swcOptions","swcPrepareOptions","swc","transformSync","endsWith","tsxOptions","nonTsxOptions","filename"],"mappings":";;;;+BAQA;;;eAAwBA;;;wEARM;6DAEX;gEACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACjB,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,UAAUC,IAAAA,kBAAI,EAACL,UAAU;AAGhB,SAASD,oBAAoBO,QAAgB,EAAEC,QAAgB,EAAEC,QAAwB;IACtG,IAAMC,aAAaC,IAAAA,0BAAiB,EAACF;IACrC,IAAMG,MAAMP;IACZ,OAAOO,IAAIC,aAAa,CAACN,UAAU,wCAC7BC,SAASM,QAAQ,CAAC,WAAWN,SAASM,QAAQ,CAAC,UAAUJ,WAAWK,UAAU,GAAGL,WAAWM,aAAa;QAC7GC,UAAUT;;AAEd"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformSync.ts"],"sourcesContent":["import swcPrepareOptions from '../lib/swcPrepareOptions';\n\nimport Module from 'module';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nimport type { TsConfigResult } from 'get-tsconfig-compat';\nexport default function transformSyncWorker(contents: string, fileName: string, tsconfig: TsConfigResult) {\n const swcOptions = swcPrepareOptions(tsconfig);\n const swc = _require('@swc/core');\n return swc.transformSync(contents, {\n ...(fileName.endsWith('.tsx') || fileName.endsWith('.jsx') ? swcOptions.tsxOptions : swcOptions.nonTsxOptions),\n filename: fileName,\n });\n}\n"],"names":["transformSyncWorker","_require","require","Module","createRequire","contents","fileName","tsconfig","swcOptions","swcPrepareOptions","swc","transformSync","endsWith","tsxOptions","nonTsxOptions","filename"],"mappings":";;;;+BAMA;;;eAAwBA;;;wEANM;6DAEX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACnB,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAG3E,SAASF,oBAAoBK,QAAgB,EAAEC,QAAgB,EAAEC,QAAwB;IACtG,IAAMC,aAAaC,IAAAA,0BAAiB,EAACF;IACrC,IAAMG,MAAMT,SAAS;IACrB,OAAOS,IAAIC,aAAa,CAACN,UAAU,wCAC7BC,SAASM,QAAQ,CAAC,WAAWN,SAASM,QAAQ,CAAC,UAAUJ,WAAWK,UAAU,GAAGL,WAAWM,aAAa;QAC7GC,UAAUT;;AAEd"}
@@ -11,7 +11,6 @@ Object.defineProperty(exports, "default", {
11
11
  var _fsiterator = /*#__PURE__*/ _interop_require_default(require("fs-iterator"));
12
12
  var _rimraf2 = /*#__PURE__*/ _interop_require_default(require("rimraf2"));
13
13
  var _module = /*#__PURE__*/ _interop_require_default(require("module"));
14
- var _lazycache = /*#__PURE__*/ _interop_require_default(require("lazy-cache"));
15
14
  var _constants = require("../constants.cjs");
16
15
  var _createMatcher = /*#__PURE__*/ _interop_require_default(require("../createMatcher.cjs"));
17
16
  function _define_property(obj, key, value) {
@@ -72,10 +71,10 @@ function _object_spread_props(target, source) {
72
71
  return target;
73
72
  }
74
73
  var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
75
- var tsLazy = (0, _lazycache.default)(_require)('typescript');
76
74
  function transformTypesWorker(src, dest, options, callback) {
77
75
  var tsconfig = options.tsconfig;
78
76
  var matcher = (0, _createMatcher.default)(tsconfig);
77
+ var ts = _require('typescript');
79
78
  (0, _rimraf2.default)(dest, {
80
79
  disableGlob: true
81
80
  }, function() {
@@ -91,7 +90,6 @@ function transformTypesWorker(src, dest, options, callback) {
91
90
  concurrency: Infinity
92
91
  }, function(err) {
93
92
  if (err) return callback(err);
94
- var ts = tsLazy();
95
93
  var config = {
96
94
  fileNames: entries.map(function(entry) {
97
95
  return entry.fullPath;
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformTypes.ts"],"sourcesContent":["import Iterator from 'fs-iterator';\nimport rimraf2 from 'rimraf2';\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst tsLazy = lazy(_require)('typescript');\n\nimport { typeFileRegEx } from '../constants';\nimport createMatcher from '../createMatcher';\n\nexport default function transformTypesWorker(src, dest, options, callback) {\n const tsconfig = options.tsconfig;\n const matcher = createMatcher(tsconfig);\n\n rimraf2(dest, { disableGlob: true }, () => {\n const entries = [];\n const iterator = new Iterator(src);\n iterator.forEach(\n (entry) => {\n if (!entry.stats.isFile()) return;\n if (entry.basename[0] === '.') return;\n if (typeFileRegEx.test(entry.basename)) return;\n if (!matcher(entry.fullPath)) return;\n entries.push(entry);\n },\n { concurrency: Infinity },\n (err) => {\n if (err) return callback(err);\n\n const ts = tsLazy();\n const config = {\n fileNames: entries.map((entry) => entry.fullPath),\n options: {\n ...(tsconfig.compilerOptions || {}),\n outDir: dest,\n allowJs: true,\n declaration: true,\n emitDeclarationOnly: true,\n listEmittedFiles: true,\n },\n projectReferences: tsconfig.config.references,\n };\n const { fileNames, options, projectReferences } = config;\n const host = ts.createCompilerHostWorker(options, /*setParentNodes*/ undefined, ts.sys);\n const programOptions = {\n rootNames: fileNames,\n options,\n projectReferences,\n host,\n configFileParsingDiagnostics: ts.getConfigFileParsingDiagnostics({ fileNames, options }),\n };\n const program = ts.createProgram(programOptions);\n const res = program.emit();\n callback(null, res.emittedFiles);\n }\n );\n });\n}\n"],"names":["transformTypesWorker","_require","require","Module","createRequire","tsLazy","lazy","src","dest","options","callback","tsconfig","matcher","createMatcher","rimraf2","disableGlob","entries","iterator","Iterator","forEach","entry","stats","isFile","basename","typeFileRegEx","test","fullPath","push","concurrency","Infinity","err","ts","config","fileNames","map","compilerOptions","outDir","allowJs","declaration","emitDeclarationOnly","listEmittedFiles","projectReferences","references","host","createCompilerHostWorker","undefined","sys","programOptions","rootNames","configFileParsingDiagnostics","getConfigFileParsingDiagnostics","program","createProgram","res","emit","emittedFiles"],"mappings":";;;;+BAWA;;;eAAwBA;;;iEAXH;8DACD;6DAED;gEACF;yBAIa;oEACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAJ1B,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,SAASC,IAAAA,kBAAI,EAACL,UAAU;AAKf,SAASD,qBAAqBO,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACvE,IAAMC,WAAWF,QAAQE,QAAQ;IACjC,IAAMC,UAAUC,IAAAA,sBAAa,EAACF;IAE9BG,IAAAA,gBAAO,EAACN,MAAM;QAAEO,aAAa;IAAK,GAAG;QACnC,IAAMC,UAAU,EAAE;QAClB,IAAMC,WAAW,IAAIC,mBAAQ,CAACX;QAC9BU,SAASE,OAAO,CACd,SAACC;YACC,IAAI,CAACA,MAAMC,KAAK,CAACC,MAAM,IAAI;YAC3B,IAAIF,MAAMG,QAAQ,CAAC,EAAE,KAAK,KAAK;YAC/B,IAAIC,wBAAa,CAACC,IAAI,CAACL,MAAMG,QAAQ,GAAG;YACxC,IAAI,CAACX,QAAQQ,MAAMM,QAAQ,GAAG;YAC9BV,QAAQW,IAAI,CAACP;QACf,GACA;YAAEQ,aAAaC;QAAS,GACxB,SAACC;YACC,IAAIA,KAAK,OAAOpB,SAASoB;YAEzB,IAAMC,KAAK1B;YACX,IAAM2B,SAAS;gBACbC,WAAWjB,QAAQkB,GAAG,CAAC,SAACd;2BAAUA,MAAMM,QAAQ;;gBAChDjB,SAAS,wCACHE,SAASwB,eAAe,IAAI,CAAC;oBACjCC,QAAQ5B;oBACR6B,SAAS;oBACTC,aAAa;oBACbC,qBAAqB;oBACrBC,kBAAkB;;gBAEpBC,mBAAmB9B,SAASqB,MAAM,CAACU,UAAU;YAC/C;YACA,IAAQT,YAA0CD,OAA1CC,WAAWxB,YAA+BuB,OAA/BvB,SAASgC,oBAAsBT,OAAtBS;YAC5B,IAAME,OAAOZ,GAAGa,wBAAwB,CAACnC,WAAS,gBAAgB,GAAGoC,WAAWd,GAAGe,GAAG;YACtF,IAAMC,iBAAiB;gBACrBC,WAAWf;gBACXxB,SAAAA;gBACAgC,mBAAAA;gBACAE,MAAAA;gBACAM,8BAA8BlB,GAAGmB,+BAA+B,CAAC;oBAAEjB,WAAAA;oBAAWxB,SAAAA;gBAAQ;YACxF;YACA,IAAM0C,UAAUpB,GAAGqB,aAAa,CAACL;YACjC,IAAMM,MAAMF,QAAQG,IAAI;YACxB5C,SAAS,MAAM2C,IAAIE,YAAY;QACjC;IAEJ;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformTypes.ts"],"sourcesContent":["import Iterator from 'fs-iterator';\nimport rimraf2 from 'rimraf2';\n\nimport Module from 'module';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nimport { typeFileRegEx } from '../constants';\nimport createMatcher from '../createMatcher';\n\nexport default function transformTypesWorker(src, dest, options, callback) {\n const tsconfig = options.tsconfig;\n const matcher = createMatcher(tsconfig);\n const ts = _require('typescript');\n\n rimraf2(dest, { disableGlob: true }, () => {\n const entries = [];\n const iterator = new Iterator(src);\n iterator.forEach(\n (entry) => {\n if (!entry.stats.isFile()) return;\n if (entry.basename[0] === '.') return;\n if (typeFileRegEx.test(entry.basename)) return;\n if (!matcher(entry.fullPath)) return;\n entries.push(entry);\n },\n { concurrency: Infinity },\n (err) => {\n if (err) return callback(err);\n\n const config = {\n fileNames: entries.map((entry) => entry.fullPath),\n options: {\n ...(tsconfig.compilerOptions || {}),\n outDir: dest,\n allowJs: true,\n declaration: true,\n emitDeclarationOnly: true,\n listEmittedFiles: true,\n },\n projectReferences: tsconfig.config.references,\n };\n const { fileNames, options, projectReferences } = config;\n const host = ts.createCompilerHostWorker(options, /*setParentNodes*/ undefined, ts.sys);\n const programOptions = {\n rootNames: fileNames,\n options,\n projectReferences,\n host,\n configFileParsingDiagnostics: ts.getConfigFileParsingDiagnostics({ fileNames, options }),\n };\n const program = ts.createProgram(programOptions);\n const res = program.emit();\n callback(null, res.emittedFiles);\n }\n );\n });\n}\n"],"names":["transformTypesWorker","_require","require","Module","createRequire","src","dest","options","callback","tsconfig","matcher","createMatcher","ts","rimraf2","disableGlob","entries","iterator","Iterator","forEach","entry","stats","isFile","basename","typeFileRegEx","test","fullPath","push","concurrency","Infinity","err","config","fileNames","map","compilerOptions","outDir","allowJs","declaration","emitDeclarationOnly","listEmittedFiles","projectReferences","references","host","createCompilerHostWorker","undefined","sys","programOptions","rootNames","configFileParsingDiagnostics","getConfigFileParsingDiagnostics","program","createProgram","res","emit","emittedFiles"],"mappings":";;;;+BASA;;;eAAwBA;;;iEATH;8DACD;6DAED;yBAGW;oEACJ;;;;;;;;;;;;;;;;;;;;;;;;;;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AWf;gBACXxB,SAAAA;gBACAgC,mBAAAA;gBACAE,MAAAA;gBACAM,8BAA8BnC,GAAGoC,+BAA+B,CAAC;oBAAEjB,WAAAA;oBAAWxB,SAAAA;gBAAQ;YACxF;YACA,IAAM0C,UAAUrC,GAAGsC,aAAa,CAACL;YACjC,IAAMM,MAAMF,QAAQG,IAAI;YACxB5C,SAAS,MAAM2C,IAAIE,YAAY;QACjC;IAEJ;AACF"}
@@ -3,8 +3,6 @@ const fs = require('fs');
3
3
  const resolveOnce = require('resolve-once-cb');
4
4
  const findDependency = require('./findDependency.cjs');
5
5
  const workerPath = path.join(__dirname, 'install.cjs');
6
- const major = +process.versions.node.split('.')[0];
7
- const version = major < 14 ? 'stable' : 'local';
8
6
  const existsSync = (test)=>{
9
7
  try {
10
8
  (fs.accessSync || fs.statSync)(test);
@@ -18,8 +16,8 @@ module.exports = function ensureBindings(identifier, target, callback) {
18
16
  if (bindings[identifier] === undefined) bindings[identifier] = {};
19
17
  if (bindings[identifier][target] === undefined) {
20
18
  bindings[identifier][target] = resolveOnce((cb)=>{
21
- const { name, modulePath } = findDependency(identifier, target);
22
- return existsSync(path.join(modulePath, '..', 'node_modules', name)) ? cb() : require(workerPath)(identifier, target, cb);
19
+ const { name, nodeModules } = findDependency(identifier, target);
20
+ return existsSync(path.join(nodeModules, name)) ? cb() : require(workerPath)(identifier, target, cb);
23
21
  });
24
22
  }
25
23
  bindings[identifier][target](callback);
@@ -29,9 +27,8 @@ module.exports.sync = (identifier, target)=>{
29
27
  if (bindingsSync[identifier] === undefined) bindingsSync[identifier] = {};
30
28
  if (bindingsSync[identifier][target] === undefined) {
31
29
  bindingsSync[identifier][target] = (()=>{
32
- const { name, modulePath } = findDependency(identifier, target);
33
- return existsSync(path.join(modulePath, '..', 'node_modules', name)) ? target : require('node-version-call')({
34
- version,
30
+ const { name, nodeModules } = findDependency(identifier, target);
31
+ return existsSync(path.join(nodeModules, name)) ? target : require('function-exec-sync')({
35
32
  callbacks: true
36
33
  }, workerPath, identifier, target);
37
34
  })();
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/ensure.cjs"],"sourcesContent":["const path = require('path');\nconst fs = require('fs');\nconst resolveOnce = require('resolve-once-cb');\nconst findDependency = require('./findDependency.cjs');\n\nconst workerPath = path.join(__dirname, 'install.cjs');\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\n\nconst existsSync = (test) => {\n try {\n (fs.accessSync || fs.statSync)(test);\n return true;\n } catch (_) {\n return false;\n }\n};\n\nconst bindings = {};\nmodule.exports = function ensureBindings(identifier, target, callback) {\n if (bindings[identifier] === undefined) bindings[identifier] = {};\n if (bindings[identifier][target] === undefined) {\n bindings[identifier][target] = resolveOnce((cb) => {\n const { name, modulePath } = findDependency(identifier, target);\n return existsSync(path.join(modulePath, '..', 'node_modules', name)) ? cb() : require(workerPath)(identifier, target, cb);\n });\n }\n bindings[identifier][target](callback);\n};\n\nconst bindingsSync = {};\nmodule.exports.sync = (identifier, target) => {\n if (bindingsSync[identifier] === undefined) bindingsSync[identifier] = {};\n if (bindingsSync[identifier][target] === undefined) {\n bindingsSync[identifier][target] = (() => {\n const { name, modulePath } = findDependency(identifier, target);\n return existsSync(path.join(modulePath, '..', 'node_modules', name)) ? target : require('node-version-call')({ version, callbacks: true }, workerPath, identifier, target);\n })();\n }\n};\n"],"names":["path","require","fs","resolveOnce","findDependency","workerPath","join","__dirname","major","process","versions","node","split","version","existsSync","test","accessSync","statSync","_","bindings","module","exports","ensureBindings","identifier","target","callback","undefined","cb","name","modulePath","bindingsSync","sync","callbacks"],"mappings":"AAAA,MAAMA,OAAOC,QAAQ;AACrB,MAAMC,KAAKD,QAAQ;AACnB,MAAME,cAAcF,QAAQ;AAC5B,MAAMG,iBAAiBH,QAAQ;AAE/B,MAAMI,aAAaL,KAAKM,IAAI,CAACC,WAAW;AACxC,MAAMC,QAAQ,CAACC,QAAQC,QAAQ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GAAG3B,YAAYkB,YAAYC;QACrK,CAAA;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/ensure.cjs"],"sourcesContent":["const path = require('path');\nconst fs = require('fs');\nconst resolveOnce = require('resolve-once-cb');\nconst findDependency = require('./findDependency.cjs');\n\nconst workerPath = path.join(__dirname, 'install.cjs');\n\nconst existsSync = (test) => {\n try {\n (fs.accessSync || fs.statSync)(test);\n return true;\n } catch (_) {\n return false;\n }\n};\n\nconst bindings = {};\nmodule.exports = function ensureBindings(identifier, target, callback) {\n if (bindings[identifier] === undefined) bindings[identifier] = {};\n if (bindings[identifier][target] === undefined) {\n bindings[identifier][target] = resolveOnce((cb) => {\n const { name, nodeModules } = findDependency(identifier, target);\n return existsSync(path.join(nodeModules, name)) ? cb() : require(workerPath)(identifier, target, cb);\n });\n }\n bindings[identifier][target](callback);\n};\n\nconst bindingsSync = {};\nmodule.exports.sync = (identifier, target) => {\n if (bindingsSync[identifier] === undefined) bindingsSync[identifier] = {};\n if (bindingsSync[identifier][target] === undefined) {\n bindingsSync[identifier][target] = (() => {\n const { name, nodeModules } = findDependency(identifier, target);\n return existsSync(path.join(nodeModules, name)) ? target : require('function-exec-sync')({ callbacks: true }, workerPath, identifier, target);\n })();\n }\n};\n"],"names":["path","require","fs","resolveOnce","findDependency","workerPath","join","__dirname","existsSync","test","accessSync","statSync","_","bindings","module","exports","ensureBindings","identifier","target","callback","undefined","cb","name","nodeModules","bindingsSync","sync","callbacks"],"mappings":"AAAA,MAAMA,OAAOC,QAAQ;AACrB,MAAMC,KAAKD,QAAQ;AACnB,MAAME,cAAcF,QAAQ;AAC5B,MAAMG,iBAAiBH,QAAQ;AAE/B,MAAMI,aAAaL,KAAKM,IAAI,CAACC,WAAW;AAExC,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,MAAMC,WAAW,CAAC;AAClBC,OAAOC,OAAO,GAAG,SAASC,eAAeC,UAAU,EAAEC,MAAM,EAAEC,QAAQ;IACnE,IAAIN,QAAQ,CAACI,WAAW,KAAKG,WAAWP,QAAQ,CAACI,WAAW,GAAG,CAAC;IAChE,IAAIJ,QAAQ,CAACI,WAAW,CAACC,OAAO,KAAKE,WAAW;QAC9CP,QAAQ,CAACI,WAAW,CAACC,OAAO,GAAGf,YAAY,CAACkB;YAC1C,MAAM,EAAEC,IAAI,EAAEC,WAAW,EAAE,GAAGnB,eAAea,YAAYC;YACzD,OAAOV,WAAWR,KAAKM,IAAI,CAACiB,aAAaD,SAASD,OAAOpB,QAAQI,YAAYY,YAAYC,QAAQG;QACnG;IACF;IACAR,QAAQ,CAACI,WAAW,CAACC,OAAO,CAACC;AAC/B;AAEA,MAAMK,eAAe,CAAC;AACtBV,OAAOC,OAAO,CAACU,IAAI,GAAG,CAACR,YAAYC;IACjC,IAAIM,YAAY,CAACP,WAAW,KAAKG,WAAWI,YAAY,CAACP,WAAW,GAAG,CAAC;IACxE,IAAIO,YAAY,CAACP,WAAW,CAACC,OAAO,KAAKE,WAAW;QAClDI,YAAY,CAACP,WAAW,CAACC,OAAO,GAAG,AAAC,CAAA;YAClC,MAAM,EAAEI,IAAI,EAAEC,WAAW,EAAE,GAAGnB,eAAea,YAAYC;YACzD,OAAOV,WAAWR,KAAKM,IAAI,CAACiB,aAAaD,SAASJ,SAASjB,QAAQ,sBAAsB;gBAAEyB,WAAW;YAAK,GAAGrB,YAAYY,YAAYC;QACxI,CAAA;IACF;AACF"}
@@ -3,11 +3,12 @@ const fs = require('fs');
3
3
  const resolve = require('resolve');
4
4
  module.exports = function findDependency(identifier, target) {
5
5
  const packagePath = resolve.sync(`${identifier}/package.json`);
6
+ const nodeModules = identifier[0] === '@' ? path.join(packagePath, '..', '..', '..') : path.join(packagePath, '..', '..');
6
7
  const optionalDependencies = JSON.parse(fs.readFileSync(packagePath, 'utf8')).optionalDependencies;
7
8
  const name = Object.keys(optionalDependencies).find((name)=>name.indexOf(target) >= 0);
8
9
  return name ? {
9
10
  name,
10
11
  version: optionalDependencies[name],
11
- modulePath: path.dirname(packagePath)
12
+ nodeModules
12
13
  } : null;
13
14
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/findDependency.cjs"],"sourcesContent":["const path = require('path');\nconst fs = require('fs');\nconst resolve = require('resolve');\n\nmodule.exports = function findDependency(identifier, target) {\n const packagePath = resolve.sync(`${identifier}/package.json`);\n const optionalDependencies = JSON.parse(fs.readFileSync(packagePath, 'utf8')).optionalDependencies;\n const name = Object.keys(optionalDependencies).find((name) => name.indexOf(target) >= 0);\n return name ? { name, version: optionalDependencies[name], modulePath: path.dirname(packagePath) } : null;\n};\n"],"names":["path","require","fs","resolve","module","exports","findDependency","identifier","target","packagePath","sync","optionalDependencies","JSON","parse","readFileSync","name","Object","keys","find","indexOf","version","modulePath","dirname"],"mappings":"AAAA,MAAMA,OAAOC,QAAQ;AACrB,MAAMC,KAAKD,QAAQ;AACnB,MAAME,UAAUF,QAAQ;AAExBG,OAAOC,OAAO,GAAG,SAASC,eAAeC,UAAU,EAAEC,MAAM;IACzD,MAAMC,cAAcN,QAAQO,IAAI,CAAC,GAAGH,WAAW,aAAa,CAAC;IAC7D,MAAMI,uBAAuBC,KAAKC,KAAK,CAACX,GAAGY,YAAY,CAACL,aAAa,SAASE,oBAAoB;IAClG,MAAMI,OAAOC,OAAOC,IAAI,CAACN,sBAAsBO,IAAI,CAAC,CAACH,OAASA,KAAKI,OAAO,CAACX,WAAW;IACtF,OAAOO,OAAO;QAAEA;QAAMK,SAAST,oBAAoB,CAACI,KAAK;QAAEM,YAAYrB,KAAKsB,OAAO,CAACb;IAAa,IAAI;AACvG"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/findDependency.cjs"],"sourcesContent":["const path = require('path');\nconst fs = require('fs');\nconst resolve = require('resolve');\n\nmodule.exports = function findDependency(identifier, target) {\n const packagePath = resolve.sync(`${identifier}/package.json`);\n const nodeModules = identifier[0] === '@' ? path.join(packagePath, '..', '..', '..') : path.join(packagePath, '..', '..');\n const optionalDependencies = JSON.parse(fs.readFileSync(packagePath, 'utf8')).optionalDependencies;\n const name = Object.keys(optionalDependencies).find((name) => name.indexOf(target) >= 0);\n return name ? { name, version: optionalDependencies[name], nodeModules } : null;\n};\n"],"names":["path","require","fs","resolve","module","exports","findDependency","identifier","target","packagePath","sync","nodeModules","join","optionalDependencies","JSON","parse","readFileSync","name","Object","keys","find","indexOf","version"],"mappings":"AAAA,MAAMA,OAAOC,QAAQ;AACrB,MAAMC,KAAKD,QAAQ;AACnB,MAAME,UAAUF,QAAQ;AAExBG,OAAOC,OAAO,GAAG,SAASC,eAAeC,UAAU,EAAEC,MAAM;IACzD,MAAMC,cAAcN,QAAQO,IAAI,CAAC,GAAGH,WAAW,aAAa,CAAC;IAC7D,MAAMI,cAAcJ,UAAU,CAAC,EAAE,KAAK,MAAMP,KAAKY,IAAI,CAACH,aAAa,MAAM,MAAM,QAAQT,KAAKY,IAAI,CAACH,aAAa,MAAM;IACpH,MAAMI,uBAAuBC,KAAKC,KAAK,CAACb,GAAGc,YAAY,CAACP,aAAa,SAASI,oBAAoB;IAClG,MAAMI,OAAOC,OAAOC,IAAI,CAACN,sBAAsBO,IAAI,CAAC,CAACH,OAASA,KAAKI,OAAO,CAACb,WAAW;IACtF,OAAOS,OAAO;QAAEA;QAAMK,SAAST,oBAAoB,CAACI,KAAK;QAAEN;IAAY,IAAI;AAC7E"}
@@ -2,11 +2,10 @@ const path = require('path');
2
2
  const installModule = require('install-module-linked');
3
3
  const findDependency = require('./findDependency.cjs');
4
4
  module.exports = function installBindings(identifier, target, callback) {
5
- const { name, version, modulePath } = findDependency(identifier, target);
6
- const nodeModules = path.join(modulePath, '..', 'node_modules');
5
+ const { name, version, nodeModules } = findDependency(identifier, target);
7
6
  const installString = version ? `${name}@${version}` : name;
8
7
  installModule(installString, nodeModules, (err)=>{
9
- console.log(`installed ${path.join(nodeModules, name)} ${!err ? 'successfully' : 'with errors: ${err.message}'}`);
8
+ console.log(`installed ${path.join(nodeModules, name)}${!err ? '' : ' with errors: ${err.message}'}`);
10
9
  callback(err);
11
10
  });
12
11
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/install.cjs"],"sourcesContent":["const path = require('path');\nconst installModule = require('install-module-linked');\nconst findDependency = require('./findDependency.cjs');\n\nmodule.exports = function installBindings(identifier, target, callback) {\n const { name, version, modulePath } = findDependency(identifier, target);\n const nodeModules = path.join(modulePath, '..', 'node_modules');\n const installString = version ? `${name}@${version}` : name;\n\n installModule(installString, nodeModules, (err) => {\n console.log(`installed ${path.join(nodeModules, name)} ${!err ? 'successfully' : 'with errors: ${err.message}'}`);\n callback(err);\n });\n};\n"],"names":["path","require","installModule","findDependency","module","exports","installBindings","identifier","target","callback","name","version","modulePath","nodeModules","join","installString","err","console","log"],"mappings":"AAAA,MAAMA,OAAOC,QAAQ;AACrB,MAAMC,gBAAgBD,QAAQ;AAC9B,MAAME,iBAAiBF,QAAQ;AAE/BG,OAAOC,OAAO,GAAG,SAASC,gBAAgBC,UAAU,EAAEC,MAAM,EAAEC,QAAQ;IACpE,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,UAAU,EAAE,GAAGT,eAAeI,YAAYC;IACjE,MAAMK,cAAcb,KAAKc,IAAI,CAACF,YAAY,MAAM;IAChD,MAAMG,gBAAgBJ,UAAU,GAAGD,KAAK,CAAC,EAAEC,SAAS,GAAGD;IAEvDR,cAAca,eAAeF,aAAa,CAACG;QACzCC,QAAQC,GAAG,CAAC,CAAC,UAAU,EAAElB,KAAKc,IAAI,CAACD,aAAaH,MAAM,CAAC,EAAE,CAACM,MAAM,iBAAiB,+BAA+B;QAChHP,SAASO;IACX;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/install.cjs"],"sourcesContent":["const path = require('path');\nconst installModule = require('install-module-linked');\nconst findDependency = require('./findDependency.cjs');\n\nmodule.exports = function installBindings(identifier, target, callback) {\n const { name, version, nodeModules } = findDependency(identifier, target);\n const installString = version ? `${name}@${version}` : name;\n\n installModule(installString, nodeModules, (err) => {\n console.log(`installed ${path.join(nodeModules, name)}${!err ? '' : ' with errors: ${err.message}'}`);\n callback(err);\n });\n};\n"],"names":["path","require","installModule","findDependency","module","exports","installBindings","identifier","target","callback","name","version","nodeModules","installString","err","console","log","join"],"mappings":"AAAA,MAAMA,OAAOC,QAAQ;AACrB,MAAMC,gBAAgBD,QAAQ;AAC9B,MAAME,iBAAiBF,QAAQ;AAE/BG,OAAOC,OAAO,GAAG,SAASC,gBAAgBC,UAAU,EAAEC,MAAM,EAAEC,QAAQ;IACpE,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,WAAW,EAAE,GAAGT,eAAeI,YAAYC;IAClE,MAAMK,gBAAgBF,UAAU,GAAGD,KAAK,CAAC,EAAEC,SAAS,GAAGD;IAEvDR,cAAcW,eAAeD,aAAa,CAACE;QACzCC,QAAQC,GAAG,CAAC,CAAC,UAAU,EAAEhB,KAAKiB,IAAI,CAACL,aAAaF,QAAQ,CAACI,MAAM,KAAK,gCAAgC;QACpGL,SAASK;IACX;AACF"}
@@ -1,17 +1,13 @@
1
1
  import path from 'path';
2
2
  import { sync as ensureBindings } from '../bindings/ensure.cjs';
3
3
  import Module from 'module';
4
- import lazy from 'lazy-cache';
5
4
  const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
6
- const tsLazy = lazy(_require)('typescript');
7
- const swcLazy = lazy(_require)('@swc/core');
8
- const transpilerLazy = lazy(_require)('ts-node/transpilers/swc');
9
5
  export default function swcPrepareOptions(tsconfig) {
10
6
  ensureBindings('@swc/core', `${process.platform}-${process.arch}`);
11
7
  try {
12
- const ts = tsLazy();
13
- const swc = swcLazy();
14
- const transpiler = transpilerLazy();
8
+ const ts = _require('typescript');
9
+ const swc = _require('@swc/core');
10
+ const transpiler = _require('ts-node/transpilers/swc');
15
11
  const parsed = ts.parseJsonConfigFileContent(tsconfig.config, ts.sys, path.dirname(tsconfig.path));
16
12
  return transpiler.createSwcOptions(parsed.options, undefined, swc, 'swc');
17
13
  } catch (err) {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/swcPrepareOptions.ts"],"sourcesContent":["import path from 'path';\nimport { sync as ensureBindings } from '../bindings/ensure.cjs';\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst tsLazy = lazy(_require)('typescript');\nconst swcLazy = lazy(_require)('@swc/core');\nconst transpilerLazy = lazy(_require)('ts-node/transpilers/swc');\n\nimport type { TsConfigResult } from 'get-tsconfig-compat';\n\nexport default function swcPrepareOptions(tsconfig: TsConfigResult) {\n ensureBindings('@swc/core', `${process.platform}-${process.arch}`);\n try {\n const ts = tsLazy();\n const swc = swcLazy();\n const transpiler = transpilerLazy();\n const parsed = ts.parseJsonConfigFileContent(tsconfig.config, ts.sys, path.dirname(tsconfig.path));\n return transpiler.createSwcOptions(parsed.options, undefined, swc, 'swc');\n } catch (err) {\n console.log(`swcPrepareOptions failed: ${err.message}`);\n return {};\n }\n}\n"],"names":["path","sync","ensureBindings","Module","lazy","_require","require","createRequire","url","tsLazy","swcLazy","transpilerLazy","swcPrepareOptions","tsconfig","process","platform","arch","ts","swc","transpiler","parsed","parseJsonConfigFileContent","config","sys","dirname","createSwcOptions","options","undefined","err","console","log","message"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,SAASC,QAAQC,cAAc,QAAQ,yBAAyB;AAEhE,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,aAAa;AAC9B,MAAMC,WAAW,OAAOC,YAAY,cAAcH,OAAOI,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAC1F,MAAMG,SAASL,KAAKC,UAAU;AAC9B,MAAMK,UAAUN,KAAKC,UAAU;AAC/B,MAAMM,iBAAiBP,KAAKC,UAAU;AAItC,eAAe,SAASO,kBAAkBC,QAAwB;IAChEX,eAAe,aAAa,GAAGY,QAAQC,QAAQ,CAAC,CAAC,EAAED,QAAQE,IAAI,EAAE;IACjE,IAAI;QACF,MAAMC,KAAKR;QACX,MAAMS,MAAMR;QACZ,MAAMS,aAAaR;QACnB,MAAMS,SAASH,GAAGI,0BAA0B,CAACR,SAASS,MAAM,EAAEL,GAAGM,GAAG,EAAEvB,KAAKwB,OAAO,CAACX,SAASb,IAAI;QAChG,OAAOmB,WAAWM,gBAAgB,CAACL,OAAOM,OAAO,EAAEC,WAAWT,KAAK;IACrE,EAAE,OAAOU,KAAK;QACZC,QAAQC,GAAG,CAAC,CAAC,0BAA0B,EAAEF,IAAIG,OAAO,EAAE;QACtD,OAAO,CAAC;IACV;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/swcPrepareOptions.ts"],"sourcesContent":["import path from 'path';\nimport { sync as ensureBindings } from '../bindings/ensure.cjs';\n\nimport Module from 'module';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nimport type { TsConfigResult } from 'get-tsconfig-compat';\nexport default function swcPrepareOptions(tsconfig: TsConfigResult) {\n ensureBindings('@swc/core', `${process.platform}-${process.arch}`);\n try {\n const ts = _require('typescript');\n const swc = _require('@swc/core');\n const transpiler = _require('ts-node/transpilers/swc');\n const parsed = ts.parseJsonConfigFileContent(tsconfig.config, ts.sys, path.dirname(tsconfig.path));\n return transpiler.createSwcOptions(parsed.options, undefined, swc, 'swc');\n } catch (err) {\n console.log(`swcPrepareOptions failed: ${err.message}`);\n return {};\n }\n}\n"],"names":["path","sync","ensureBindings","Module","_require","require","createRequire","url","swcPrepareOptions","tsconfig","process","platform","arch","ts","swc","transpiler","parsed","parseJsonConfigFileContent","config","sys","dirname","createSwcOptions","options","undefined","err","console","log","message"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,SAASC,QAAQC,cAAc,QAAQ,yBAAyB;AAEhE,OAAOC,YAAY,SAAS;AAC5B,MAAMC,WAAW,OAAOC,YAAY,cAAcF,OAAOG,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAG1F,eAAe,SAASG,kBAAkBC,QAAwB;IAChEP,eAAe,aAAa,GAAGQ,QAAQC,QAAQ,CAAC,CAAC,EAAED,QAAQE,IAAI,EAAE;IACjE,IAAI;QACF,MAAMC,KAAKT,SAAS;QACpB,MAAMU,MAAMV,SAAS;QACrB,MAAMW,aAAaX,SAAS;QAC5B,MAAMY,SAASH,GAAGI,0BAA0B,CAACR,SAASS,MAAM,EAAEL,GAAGM,GAAG,EAAEnB,KAAKoB,OAAO,CAACX,SAAST,IAAI;QAChG,OAAOe,WAAWM,gBAAgB,CAACL,OAAOM,OAAO,EAAEC,WAAWT,KAAK;IACrE,EAAE,OAAOU,KAAK;QACZC,QAAQC,GAAG,CAAC,CAAC,0BAA0B,EAAEF,IAAIG,OAAO,EAAE;QACtD,OAAO,CAAC;IACV;AACF"}
@@ -7,9 +7,7 @@ import patchCJS from '../lib/patchCJS.mjs';
7
7
  import patchESM from '../lib/patchESM.mjs';
8
8
  import swcPrepareOptions from '../lib/swcPrepareOptions.mjs';
9
9
  import Module from 'module';
10
- import lazy from 'lazy-cache';
11
10
  const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
12
- const swcLazy = lazy(_require)('@swc/core');
13
11
  export default function transformFile(entry, dest, type, options, callback) {
14
12
  ensureBindings('@swc/core', `${process.platform}-${process.arch}`, (err)=>{
15
13
  if (err) return callback(err);
@@ -29,7 +27,7 @@ export default function transformFile(entry, dest, type, options, callback) {
29
27
  tsconfig.config.compilerOptions.target = 'ES5';
30
28
  }
31
29
  const swcOptions = swcPrepareOptions(tsconfig);
32
- const swc = swcLazy();
30
+ const swc = _require('@swc/core');
33
31
  swc.transformFile(entry.fullPath, {
34
32
  ...entry.basename.endsWith('.tsx') || entry.basename.endsWith('.jsx') ? swcOptions.tsxOptions : swcOptions.nonTsxOptions,
35
33
  filename: entry.basename
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/transformFile.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport mkdirp from 'mkdirp-classic';\nimport Queue from 'queue-cb';\nimport ensureBindings from '../bindings/ensure.cjs';\n\nimport patchCJS from '../lib/patchCJS';\nimport patchESM from '../lib/patchESM';\nimport swcPrepareOptions from '../lib/swcPrepareOptions';\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst swcLazy = lazy(_require)('@swc/core');\n\nexport default function transformFile(entry, dest, type, options, callback) {\n ensureBindings('@swc/core', `${process.platform}-${process.arch}`, (err) => {\n if (err) return callback(err);\n\n let tsconfig = options.tsconfig;\n\n // overrides for cjs\n if (type === 'cjs') {\n tsconfig = { ...tsconfig };\n tsconfig.config = { ...tsconfig.config };\n tsconfig.config.compilerOptions = { ...(tsconfig.config.compilerOptions || {}) };\n tsconfig.config.compilerOptions.module = 'CommonJS';\n tsconfig.config.compilerOptions.target = 'ES5';\n }\n\n const swcOptions = swcPrepareOptions(tsconfig);\n const swc = swcLazy();\n\n swc\n .transformFile(entry.fullPath, {\n ...(entry.basename.endsWith('.tsx') || entry.basename.endsWith('.jsx') ? swcOptions.tsxOptions : swcOptions.nonTsxOptions),\n filename: entry.basename,\n })\n .then((output) => {\n const extTarget = type === 'esm' ? patchESM(entry, output, options) : patchCJS(entry, output, options);\n const ext = path.extname(entry.path);\n const outPath = path.join(dest, (ext ? entry.path.slice(0, -ext.length) : entry.path) + extTarget);\n\n mkdirp(path.dirname(outPath), () => {\n const queue = new Queue();\n queue.defer(fs.writeFile.bind(null, outPath, output.code, 'utf8'));\n !options.sourceMaps || queue.defer(fs.writeFile.bind(null, `${outPath}.map`, output.map, 'utf8'));\n queue.await((err) => (err ? callback(err) : callback(null, outPath)));\n });\n })\n .catch(callback);\n });\n}\n"],"names":["fs","path","mkdirp","Queue","ensureBindings","patchCJS","patchESM","swcPrepareOptions","Module","lazy","_require","require","createRequire","url","swcLazy","transformFile","entry","dest","type","options","callback","process","platform","arch","err","tsconfig","config","compilerOptions","module","target","swcOptions","swc","fullPath","basename","endsWith","tsxOptions","nonTsxOptions","filename","then","output","extTarget","ext","extname","outPath","join","slice","length","dirname","queue","defer","writeFile","bind","code","sourceMaps","map","await","catch"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,WAAW,WAAW;AAC7B,OAAOC,oBAAoB,yBAAyB;AAEpD,OAAOC,cAAc,kBAAkB;AACvC,OAAOC,cAAc,kBAAkB;AACvC,OAAOC,uBAAuB,2BAA2B;AAEzD,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,aAAa;AAC9B,MAAMC,WAAW,OAAOC,YAAY,cAAcH,OAAOI,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAC1F,MAAMG,UAAUL,KAAKC,UAAU;AAE/B,eAAe,SAASK,cAAcC,KAAK,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACxEhB,eAAe,aAAa,GAAGiB,QAAQC,QAAQ,CAAC,CAAC,EAAED,QAAQE,IAAI,EAAE,EAAE,CAACC;QAClE,IAAIA,KAAK,OAAOJ,SAASI;QAEzB,IAAIC,WAAWN,QAAQM,QAAQ;QAE/B,oBAAoB;QACpB,IAAIP,SAAS,OAAO;YAClBO,WAAW;gBAAE,GAAGA,QAAQ;YAAC;YACzBA,SAASC,MAAM,GAAG;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AASI,OAAOJ,SAAS,MAAMuB;YAC7D;QACF,GACCa,KAAK,CAACpC;IACX;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/transformFile.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport mkdirp from 'mkdirp-classic';\nimport Queue from 'queue-cb';\nimport ensureBindings from '../bindings/ensure.cjs';\n\nimport patchCJS from '../lib/patchCJS';\nimport patchESM from '../lib/patchESM';\nimport swcPrepareOptions from '../lib/swcPrepareOptions';\n\nimport Module from 'module';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nexport default function transformFile(entry, dest, type, options, callback) {\n ensureBindings('@swc/core', `${process.platform}-${process.arch}`, (err) => {\n if (err) return callback(err);\n\n let tsconfig = options.tsconfig;\n\n // overrides for cjs\n if (type === 'cjs') {\n tsconfig = { ...tsconfig };\n tsconfig.config = { ...tsconfig.config };\n tsconfig.config.compilerOptions = { ...(tsconfig.config.compilerOptions || {}) };\n tsconfig.config.compilerOptions.module = 'CommonJS';\n tsconfig.config.compilerOptions.target = 'ES5';\n }\n\n const swcOptions = swcPrepareOptions(tsconfig);\n const swc = _require('@swc/core');\n\n swc\n .transformFile(entry.fullPath, {\n ...(entry.basename.endsWith('.tsx') || entry.basename.endsWith('.jsx') ? swcOptions.tsxOptions : swcOptions.nonTsxOptions),\n filename: entry.basename,\n })\n .then((output) => {\n const extTarget = type === 'esm' ? patchESM(entry, output, options) : patchCJS(entry, output, options);\n const ext = path.extname(entry.path);\n const outPath = path.join(dest, (ext ? entry.path.slice(0, -ext.length) : entry.path) + extTarget);\n\n mkdirp(path.dirname(outPath), () => {\n const queue = new Queue();\n queue.defer(fs.writeFile.bind(null, outPath, output.code, 'utf8'));\n !options.sourceMaps || queue.defer(fs.writeFile.bind(null, `${outPath}.map`, output.map, 'utf8'));\n queue.await((err) => (err ? callback(err) : callback(null, outPath)));\n });\n })\n .catch(callback);\n });\n}\n"],"names":["fs","path","mkdirp","Queue","ensureBindings","patchCJS","patchESM","swcPrepareOptions","Module","_require","require","createRequire","url","transformFile","entry","dest","type","options","callback","process","platform","arch","err","tsconfig","config","compilerOptions","module","target","swcOptions","swc","fullPath","basename","endsWith","tsxOptions","nonTsxOptions","filename","then","output","extTarget","ext","extname","outPath","join","slice","length","dirname","queue","defer","writeFile","bind","code","sourceMaps","map","await","catch"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,WAAW,WAAW;AAC7B,OAAOC,oBAAoB,yBAAyB;AAEpD,OAAOC,cAAc,kBAAkB;AACvC,OAAOC,cAAc,kBAAkB;AACvC,OAAOC,uBAAuB,2BAA2B;AAEzD,OAAOC,YAAY,SAAS;AAC5B,MAAMC,WAAW,OAAOC,YAAY,cAAcF,OAAOG,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAE1F,eAAe,SAASG,cAAcC,KAAK,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACxEd,eAAe,aAAa,GAAGe,QAAQC,QAAQ,CAAC,CAAC,EAAED,QAAQE,IAAI,EAAE,EAAE,CAACC;QAClE,IAAIA,KAAK,OAAOJ,SAASI;QAEzB,IAAIC,WAAWN,QAAQM,QAAQ;QAE/B,oBAAoB;QACpB,IAAIP,SAAS,OAAO;YAClBO,WAAW;gBAAE,GAAGA,QAAQ;YAAC;YACzBA,SAASC,MAAM,GAAG;gBAAE,GAAGD,SAASC,MAAM;YAAC;YACvCD,SAASC,MAAM,CAACC,eAAe,GAAG;gBAAE,GAAIF,SAASC,MAAM,CAACC,eAAe,IAAI,CAAC,CAAC;YAAE;YAC/EF,SAASC,MAAM,CAACC,eAAe,CAACC,MAAM,GAAG;YACzCH,SAASC,MAAM,CAACC,eAAe,CAACE,MAAM,GAAG;QAC3C;QAEA,MAAMC,aAAarB,kBAAkBgB;QACrC,MAAMM,MAAMpB,SAAS;QAErBoB,IACGhB,aAAa,CAACC,MAAMgB,QAAQ,EAAE;YAC7B,GAAIhB,MAAMiB,QAAQ,CAACC,QAAQ,CAAC,WAAWlB,MAAMiB,QAAQ,CAACC,QAAQ,CAAC,UAAUJ,WAAWK,UAAU,GAAGL,WAAWM,aAAa;YACzHC,UAAUrB,MAAMiB,QAAQ;QAC1B,GACCK,IAAI,CAAC,CAACC;YACL,MAAMC,YAAYtB,SAAS,QAAQV,SAASQ,OAAOuB,QAAQpB,WAAWZ,SAASS,OAAOuB,QAAQpB;YAC9F,MAAMsB,MAAMtC,KAAKuC,OAAO,CAAC1B,MAAMb,IAAI;YACnC,MAAMwC,UAAUxC,KAAKyC,IAAI,CAAC3B,MAAM,AAACwB,CAAAA,MAAMzB,MAAMb,IAAI,CAAC0C,KAAK,CAAC,GAAG,CAACJ,IAAIK,MAAM,IAAI9B,MAAMb,IAAI,AAAD,IAAKqC;YAExFpC,OAAOD,KAAK4C,OAAO,CAACJ,UAAU;gBAC5B,MAAMK,QAAQ,IAAI3C;gBAClB2C,MAAMC,KAAK,CAAC/C,GAAGgD,SAAS,CAACC,IAAI,CAAC,MAAMR,SAASJ,OAAOa,IAAI,EAAE;gBAC1D,CAACjC,QAAQkC,UAAU,IAAIL,MAAMC,KAAK,CAAC/C,GAAGgD,SAAS,CAACC,IAAI,CAAC,MAAM,GAAGR,QAAQ,IAAI,CAAC,EAAEJ,OAAOe,GAAG,EAAE;gBACzFN,MAAMO,KAAK,CAAC,CAAC/B,MAASA,MAAMJ,SAASI,OAAOJ,SAAS,MAAMuB;YAC7D;QACF,GACCa,KAAK,CAACpC;IACX;AACF"}
@@ -6,13 +6,11 @@ const version = major < 14 ? 'stable' : 'local';
6
6
  const __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);
7
7
  const workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformDirectory.cjs');
8
8
  import Module from 'module';
9
- import lazy from 'lazy-cache';
10
9
  const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
11
- const callLazy = lazy(_require)('node-version-call');
12
10
  function dispatch(version, src, dest, type, options, callback) {
13
11
  if (version === 'local') return _require(workerPath)(src, dest, type, options, callback);
14
12
  try {
15
- callback(null, callLazy()({
13
+ callback(null, _require('node-version-call')({
16
14
  version,
17
15
  callbacks: true
18
16
  }, workerPath, src, dest, type, options));
@@ -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.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');\n\nfunction dispatch(version, src, dest, type, options, callback) {\n if (version === 'local') return _require(workerPath)(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) as undefined;\n return new Promise((resolve, reject) => dispatch(version, src, dest, type, options, (err, result) => (err ? reject(err) : resolve(result))));\n } catch (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","dispatch","src","dest","type","options","callback","callbacks","err","transformDirectory","Error","tsconfig","cwd","Promise","resolve","reject","result"],"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;AAEhC,SAASI,SAASb,OAAO,EAAEc,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC3D,IAAIlB,YAAY,SAAS,OAAOS,SAASJ,YAAYS,KAAKC,MAAMC,MAAMC,SAASC;IAC/E,IAAI;QACFA,SAAS,MAAMN,WAAW;YAAEZ;YAASmB,WAAW;QAAK,GAAGd,YAAYS,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,WAAW7B,aAAa;YAAE8B,KAAKV;YAAK,GAAGG,OAAO;QAAC,GAAG;QACxDA,UAAU;YAAEM;YAAU,GAAGN,OAAO;QAAC;QAEjC,IAAI,OAAOC,aAAa,YAAY,OAAOL,SAASb,SAASc,KAAKC,MAAMC,MAAMC,SAASC;QACvF,OAAO,IAAIO,QAAQ,CAACC,SAASC,SAAWd,SAASb,SAASc,KAAKC,MAAMC,MAAMC,SAAS,CAACG,KAAKQ,SAAYR,MAAMO,OAAOP,OAAOM,QAAQE;IACpI,EAAE,OAAOR,KAAK;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOK,QAAQE,MAAM,CAACP;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';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nfunction dispatch(version, src, dest, type, options, callback) {\n if (version === 'local') return _require(workerPath)(src, dest, type, options, callback);\n try {\n callback(null, _require('node-version-call')({ 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) as undefined;\n return new Promise((resolve, reject) => dispatch(version, src, dest, type, options, (err, result) => (err ? reject(err) : resolve(result))));\n } catch (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","_require","require","createRequire","dispatch","src","dest","type","options","callback","callbacks","err","transformDirectory","Error","tsconfig","cwd","Promise","resolve","reject","result"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,OAAOC,kBAAkB,iBAAiB;AAE1C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a,YAAY,OAAOL,SAASX,SAASY,KAAKC,MAAMC,MAAMC,SAASC;QACvF,OAAO,IAAIO,QAAQ,CAACC,SAASC,SAAWd,SAASX,SAASY,KAAKC,MAAMC,MAAMC,SAAS,CAACG,KAAKQ,SAAYR,MAAMO,OAAOP,OAAOM,QAAQE;IACpI,EAAE,OAAOR,KAAK;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOK,QAAQE,MAAM,CAACP;IAC7B;AACF"}
@@ -6,12 +6,10 @@ const version = major < 14 ? 'stable' : 'local';
6
6
  const __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);
7
7
  const workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformSync.cjs');
8
8
  import Module from 'module';
9
- import lazy from 'lazy-cache';
10
9
  const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
11
- const callLazy = lazy(_require)('node-version-call');
12
10
  function dispatch(version, contents, fileName, tsconfig) {
13
11
  if (version === 'local') return _require(workerPath)(contents, fileName, tsconfig);
14
- return callLazy()(version, workerPath, contents, fileName, tsconfig);
12
+ return _require('node-version-call')(version, workerPath, contents, fileName, tsconfig);
15
13
  }
16
14
  /**
17
15
  * @param {string} contents The file contents.
@@ -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.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');\n\nfunction dispatch(version, contents, fileName, tsconfig) {\n if (version === 'local') return _require(workerPath)(contents, fileName, tsconfig);\n return callLazy()(version, workerPath, contents, fileName, tsconfig);\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","dispatch","contents","fileName","tsconfig","transformSync","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;AAEhC,SAASI,SAASb,OAAO,EAAEc,QAAQ,EAAEC,QAAQ,EAAEC,QAAQ;IACrD,IAAIhB,YAAY,SAAS,OAAOS,SAASJ,YAAYS,UAAUC,UAAUC;IACzE,OAAOJ,WAAWZ,SAASK,YAAYS,UAAUC,UAAUC;AAC7D;AAIA;;;;;CAKC,GACD,eAAe,SAASC,cAAcH,QAAgB,EAAEC,QAAgB,EAAEC,QAAwB;IAChG,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAII,MAAM;IAClD,IAAI,OAAOH,aAAa,UAAU,MAAM,IAAIG,MAAM;IAClD,IAAI,CAACF,UAAUA,WAAWtB,MAAMyB,WAAW,CAACvB,QAAQwB,GAAG;IACvD,OAAOP,SAASb,SAASc,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';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nfunction dispatch(version, contents, fileName, tsconfig) {\n if (version === 'local') return _require(workerPath)(contents, fileName, tsconfig);\n return _require('node-version-call')(version, workerPath, contents, fileName, tsconfig);\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","_require","require","createRequire","dispatch","contents","fileName","tsconfig","transformSync","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,MAAMC,WAAW,OAAOC,YAAY,cAAcF,OAAOG,aAAa,CAAC,YAAYjB,GAAG,IAAIgB;AAE1F,SAASE,SAASX,OAAO,EAAEY,QAAQ,EAAEC,QAAQ,EAAEC,QAAQ;IACrD,IAAId,YAAY,SAAS,OAAOQ,SAASH,YAAYO,UAAUC,UAAUC;IACzE,OAAON,SAAS,qBAAqBR,SAASK,YAAYO,UAAUC,UAAUC;AAChF;AAIA;;;;;CAKC,GACD,eAAe,SAASC,cAAcH,QAAgB,EAAEC,QAAgB,EAAEC,QAAwB;IAChG,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAII,MAAM;IAClD,IAAI,OAAOH,aAAa,UAAU,MAAM,IAAIG,MAAM;IAClD,IAAI,CAACF,UAAUA,WAAWpB,MAAMuB,WAAW,CAACrB,QAAQsB,GAAG;IACvD,OAAOP,SAASX,SAASY,UAAUC,UAAUC;AAC/C"}
@@ -6,13 +6,11 @@ const version = major < 14 ? 'stable' : 'local';
6
6
  const __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);
7
7
  const workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformTypes.cjs');
8
8
  import Module from 'module';
9
- import lazy from 'lazy-cache';
10
9
  const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
11
- const callLazy = lazy(_require)('node-version-call');
12
10
  function dispatch(version, src, dest, options, callback) {
13
11
  if (version === 'local') return _require(workerPath)(src, dest, options, callback);
14
12
  try {
15
- callback(null, callLazy()({
13
+ callback(null, _require('node-version-call')({
16
14
  version,
17
15
  callbacks: true
18
16
  }, workerPath, src, dest, options));
@@ -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.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');\n\nfunction dispatch(version, src, dest, options, callback) {\n if (version === 'local') return _require(workerPath)(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 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","dispatch","src","dest","options","callback","callbacks","err","transformTypes","Error","tsconfig","cwd","Promise","resolve","reject","result"],"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;AAEhC,SAASI,SAASb,OAAO,EAAEc,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACrD,IAAIjB,YAAY,SAAS,OAAOS,SAASJ,YAAYS,KAAKC,MAAMC,SAASC;IACzE,IAAI;QACFA,SAAS,MAAML,WAAW;YAAEZ;YAASkB,WAAW;QAAK,GAAGb,YAAYS,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,WAAW5B,aAAa;YAAE6B,KAAKT;YAAK,GAAGE,OAAO;QAAC,GAAG;QACxDA,UAAU;YAAEM;YAAU,GAAGN,OAAO;QAAC;QAEjC,IAAI,OAAOC,aAAa,YAAY,OAAOJ,SAASb,SAASc,KAAKC,MAAMC,SAASC;QACjF,OAAO,IAAIO,QAAQ,CAACC,SAASC,SAAWb,SAASb,SAASc,KAAKC,MAAMC,SAAS,CAACG,KAAKQ,SAAYR,MAAMO,OAAOP,OAAOM,QAAQE;IAC9H,EAAE,OAAOR,KAAK;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOK,QAAQE,MAAM,CAACP;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';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nfunction dispatch(version, src, dest, options, callback) {\n if (version === 'local') return _require(workerPath)(src, dest, options, callback);\n try {\n callback(null, _require('node-version-call')({ 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 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","_require","require","createRequire","dispatch","src","dest","options","callback","callbacks","err","transformTypes","Error","tsconfig","cwd","Promise","resolve","reject","result"],"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,I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';
3
- import lazy from 'lazy-cache';
4
3
  const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
5
- const swcLazy = lazy(_require)('@swc/core');
6
4
  export default function transformSyncWorker(contents, fileName, tsconfig) {
7
5
  const swcOptions = swcPrepareOptions(tsconfig);
8
- const swc = swcLazy();
6
+ const swc = _require('@swc/core');
9
7
  return swc.transformSync(contents, {
10
8
  ...fileName.endsWith('.tsx') || fileName.endsWith('.jsx') ? swcOptions.tsxOptions : swcOptions.nonTsxOptions,
11
9
  filename: fileName
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformSync.ts"],"sourcesContent":["import swcPrepareOptions from '../lib/swcPrepareOptions';\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst swcLazy = lazy(_require)('@swc/core');\n\nimport type { TsConfigResult } from 'get-tsconfig-compat';\nexport default function transformSyncWorker(contents: string, fileName: string, tsconfig: TsConfigResult) {\n const swcOptions = swcPrepareOptions(tsconfig);\n const swc = swcLazy();\n return swc.transformSync(contents, {\n ...(fileName.endsWith('.tsx') || fileName.endsWith('.jsx') ? swcOptions.tsxOptions : swcOptions.nonTsxOptions),\n filename: fileName,\n });\n}\n"],"names":["swcPrepareOptions","Module","lazy","_require","require","createRequire","url","swcLazy","transformSyncWorker","contents","fileName","tsconfig","swcOptions","swc","transformSync","endsWith","tsxOptions","nonTsxOptions","filename"],"mappings":"AAAA,OAAOA,uBAAuB,2BAA2B;AAEzD,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,aAAa;AAC9B,MAAMC,WAAW,OAAOC,YAAY,cAAcH,OAAOI,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAC1F,MAAMG,UAAUL,KAAKC,UAAU;AAG/B,eAAe,SAASK,oBAAoBC,QAAgB,EAAEC,QAAgB,EAAEC,QAAwB;IACtG,MAAMC,aAAaZ,kBAAkBW;IACrC,MAAME,MAAMN;IACZ,OAAOM,IAAIC,aAAa,CAACL,UAAU;QACjC,GAAIC,SAASK,QAAQ,CAAC,WAAWL,SAASK,QAAQ,CAAC,UAAUH,WAAWI,UAAU,GAAGJ,WAAWK,aAAa;QAC7GC,UAAUR;IACZ;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformSync.ts"],"sourcesContent":["import swcPrepareOptions from '../lib/swcPrepareOptions';\n\nimport Module from 'module';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nimport type { TsConfigResult } from 'get-tsconfig-compat';\nexport default function transformSyncWorker(contents: string, fileName: string, tsconfig: TsConfigResult) {\n const swcOptions = swcPrepareOptions(tsconfig);\n const swc = _require('@swc/core');\n return swc.transformSync(contents, {\n ...(fileName.endsWith('.tsx') || fileName.endsWith('.jsx') ? swcOptions.tsxOptions : swcOptions.nonTsxOptions),\n filename: fileName,\n });\n}\n"],"names":["swcPrepareOptions","Module","_require","require","createRequire","url","transformSyncWorker","contents","fileName","tsconfig","swcOptions","swc","transformSync","endsWith","tsxOptions","nonTsxOptions","filename"],"mappings":"AAAA,OAAOA,uBAAuB,2BAA2B;AAEzD,OAAOC,YAAY,SAAS;AAC5B,MAAMC,WAAW,OAAOC,YAAY,cAAcF,OAAOG,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAG1F,eAAe,SAASG,oBAAoBC,QAAgB,EAAEC,QAAgB,EAAEC,QAAwB;IACtG,MAAMC,aAAaV,kBAAkBS;IACrC,MAAME,MAAMT,SAAS;IACrB,OAAOS,IAAIC,aAAa,CAACL,UAAU;QACjC,GAAIC,SAASK,QAAQ,CAAC,WAAWL,SAASK,QAAQ,CAAC,UAAUH,WAAWI,UAAU,GAAGJ,WAAWK,aAAa;QAC7GC,UAAUR;IACZ;AACF"}
@@ -1,14 +1,13 @@
1
1
  import Iterator from 'fs-iterator';
2
2
  import rimraf2 from 'rimraf2';
3
3
  import Module from 'module';
4
- import lazy from 'lazy-cache';
5
4
  const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
6
- const tsLazy = lazy(_require)('typescript');
7
5
  import { typeFileRegEx } from '../constants.mjs';
8
6
  import createMatcher from '../createMatcher.mjs';
9
7
  export default function transformTypesWorker(src, dest, options, callback) {
10
8
  const tsconfig = options.tsconfig;
11
9
  const matcher = createMatcher(tsconfig);
10
+ const ts = _require('typescript');
12
11
  rimraf2(dest, {
13
12
  disableGlob: true
14
13
  }, ()=>{
@@ -24,7 +23,6 @@ export default function transformTypesWorker(src, dest, options, callback) {
24
23
  concurrency: Infinity
25
24
  }, (err)=>{
26
25
  if (err) return callback(err);
27
- const ts = tsLazy();
28
26
  const config = {
29
27
  fileNames: entries.map((entry)=>entry.fullPath),
30
28
  options: {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformTypes.ts"],"sourcesContent":["import Iterator from 'fs-iterator';\nimport rimraf2 from 'rimraf2';\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst tsLazy = lazy(_require)('typescript');\n\nimport { typeFileRegEx } from '../constants';\nimport createMatcher from '../createMatcher';\n\nexport default function transformTypesWorker(src, dest, options, callback) {\n const tsconfig = options.tsconfig;\n const matcher = createMatcher(tsconfig);\n\n rimraf2(dest, { disableGlob: true }, () => {\n const entries = [];\n const iterator = new Iterator(src);\n iterator.forEach(\n (entry) => {\n if (!entry.stats.isFile()) return;\n if (entry.basename[0] === '.') return;\n if (typeFileRegEx.test(entry.basename)) return;\n if (!matcher(entry.fullPath)) return;\n entries.push(entry);\n },\n { concurrency: Infinity },\n (err) => {\n if (err) return callback(err);\n\n const ts = tsLazy();\n const config = {\n fileNames: entries.map((entry) => entry.fullPath),\n options: {\n ...(tsconfig.compilerOptions || {}),\n outDir: dest,\n allowJs: true,\n declaration: true,\n emitDeclarationOnly: true,\n listEmittedFiles: true,\n },\n projectReferences: tsconfig.config.references,\n };\n const { fileNames, options, projectReferences } = config;\n const host = ts.createCompilerHostWorker(options, /*setParentNodes*/ undefined, ts.sys);\n const programOptions = {\n rootNames: fileNames,\n options,\n projectReferences,\n host,\n configFileParsingDiagnostics: ts.getConfigFileParsingDiagnostics({ fileNames, options }),\n };\n const program = ts.createProgram(programOptions);\n const res = program.emit();\n callback(null, res.emittedFiles);\n }\n );\n });\n}\n"],"names":["Iterator","rimraf2","Module","lazy","_require","require","createRequire","url","tsLazy","typeFileRegEx","createMatcher","transformTypesWorker","src","dest","options","callback","tsconfig","matcher","disableGlob","entries","iterator","forEach","entry","stats","isFile","basename","test","fullPath","push","concurrency","Infinity","err","ts","config","fileNames","map","compilerOptions","outDir","allowJs","declaration","emitDeclarationOnly","listEmittedFiles","projectReferences","references","host","createCompilerHostWorker","undefined","sys","programOptions","rootNames","configFileParsingDiagnostics","getConfigFileParsingDiagnostics","program","createProgram","res","emit","emittedFiles"],"mappings":"AAAA,OAAOA,cAAc,cAAc;AACnC,OAAOC,aAAa,UAAU;AAE9B,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,aAAa;AAC9B,MAAMC,WAAW,OAAOC,YAAY,cAAcH,OAAOI,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAC1F,MAAMG,SAASL,KAAKC,UAAU;AAE9B,SAASK,aAAa,QAAQ,eAAe;AAC7C,OAAOC,mBAAmB,mBAAmB;AAE7C,eAAe,SAASC,qBAAqBC,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACvE,MAAMC,WAAWF,QAAQE,QAAQ;IACjC,MAAMC,UAAUP,cAAcM;IAE9Bf,QAAQY,MAAM;QAAEK,aAAa;IAAK,GAAG;QACnC,MAAMC,UAAU,EAAE;QAClB,MAAMC,WAAW,IAAIpB,SAASY;QAC9BQ,SAASC,OAAO,CACd,CAACC;YACC,IAAI,CAACA,MAAMC,KAAK,CAACC,MAAM,IAAI;YAC3B,IAAIF,MAAMG,QAAQ,CAAC,EAAE,KAAK,KAAK;YAC/B,IAAIhB,cAAciB,IAAI,CAACJ,MAAMG,QAAQ,GAAG;YACxC,IAAI,CAACR,QAAQK,MAAMK,QAAQ,GAAG;YAC9BR,QAAQS,IAAI,CAACN;QACf,GACA;YAAEO,aAAaC;QAAS,GACxB,CAACC;YACC,IAAIA,KAAK,OAAOhB,SAASgB;YAEzB,MAAMC,KAAKxB;YACX,MAAMyB,SAAS;gBACbC,WAAWf,QAAQgB,GAAG,CAAC,CAACb,QAAUA,MAAMK,QAAQ;gBAChDb,SAAS;oBACP,GAAIE,SAASoB,eAAe,IAAI,CAAC,CAAC;oBAClCC,QAAQxB;oBACRyB,SAAS;oBACTC,aAAa;oBACbC,qBAAqB;oBACrBC,kBAAkB;gBACpB;gBACAC,mBAAmB1B,SAASiB,MAAM,CAACU,UAAU;YAC/C;YACA,MAAM,EAAET,SAAS,EAAEpB,OAAO,EAAE4B,iBAAiB,EAAE,GAAGT;YAClD,MAAMW,OAAOZ,GAAGa,wBAAwB,CAAC/B,SAAS,gBAAgB,GAAGgC,WAAWd,GAAGe,GAAG;YACtF,MAAMC,iBAAiB;gBACrBC,WAAWf;gBACXpB;gBACA4B;gBACAE;gBACAM,8BAA8BlB,GAAGmB,+BAA+B,CAAC;oBAAEjB;oBAAWpB;gBAAQ;YACxF;YACA,MAAMsC,UAAUpB,GAAGqB,aAAa,CAACL;YACjC,MAAMM,MAAMF,QAAQG,IAAI;YACxBxC,SAAS,MAAMuC,IAAIE,YAAY;QACjC;IAEJ;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformTypes.ts"],"sourcesContent":["import Iterator from 'fs-iterator';\nimport rimraf2 from 'rimraf2';\n\nimport Module from 'module';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nimport { typeFileRegEx } from '../constants';\nimport createMatcher from '../createMatcher';\n\nexport default function transformTypesWorker(src, dest, options, callback) {\n const tsconfig = options.tsconfig;\n const matcher = createMatcher(tsconfig);\n const ts = _require('typescript');\n\n rimraf2(dest, { disableGlob: true }, () => {\n const entries = [];\n const iterator = new Iterator(src);\n iterator.forEach(\n (entry) => {\n if (!entry.stats.isFile()) return;\n if (entry.basename[0] === '.') return;\n if (typeFileRegEx.test(entry.basename)) return;\n if (!matcher(entry.fullPath)) return;\n entries.push(entry);\n },\n { concurrency: Infinity },\n (err) => {\n if (err) return callback(err);\n\n const config = {\n fileNames: entries.map((entry) => entry.fullPath),\n options: {\n ...(tsconfig.compilerOptions || {}),\n outDir: dest,\n allowJs: true,\n declaration: true,\n emitDeclarationOnly: true,\n listEmittedFiles: true,\n },\n projectReferences: tsconfig.config.references,\n };\n const { fileNames, options, projectReferences } = config;\n const host = ts.createCompilerHostWorker(options, /*setParentNodes*/ undefined, ts.sys);\n const programOptions = {\n rootNames: fileNames,\n options,\n projectReferences,\n host,\n configFileParsingDiagnostics: ts.getConfigFileParsingDiagnostics({ fileNames, options }),\n };\n const program = ts.createProgram(programOptions);\n const res = program.emit();\n callback(null, res.emittedFiles);\n }\n );\n });\n}\n"],"names":["Iterator","rimraf2","Module","_require","require","createRequire","url","typeFileRegEx","createMatcher","transformTypesWorker","src","dest","options","callback","tsconfig","matcher","ts","disableGlob","entries","iterator","forEach","entry","stats","isFile","basename","test","fullPath","push","concurrency","Infinity","err","config","fileNames","map","compilerOptions","outDir","allowJs","declaration","emitDeclarationOnly","listEmittedFiles","projectReferences","references","host","createCompilerHostWorker","undefined","sys","programOptions","rootNames","configFileParsingDiagnostics","getConfigFileParsingDiagnostics","program","createProgram","res","emit","emittedFiles"],"mappings":"AAAA,OAAOA,cAAc,cAAc;AACnC,OAAOC,aAAa,UAAU;AAE9B,OAAOC,YAAY,SAAS;AAC5B,MAAMC,WAAW,OAAOC,YAAY,cAAcF,OAAOG,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAE1F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YACxF;YACA,MAAMsC,UAAUlC,GAAGmC,aAAa,CAACL;YACjC,MAAMM,MAAMF,QAAQG,IAAI;YACxBxC,SAAS,MAAMuC,IAAIE,YAAY;QACjC;IAEJ;AACF"}
@@ -1,6 +1,6 @@
1
1
  declare function _exports(identifier: any, target: any): {
2
2
  name: string;
3
3
  version: any;
4
- modulePath: string;
4
+ nodeModules: string;
5
5
  };
6
6
  export = _exports;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-swc-transform",
3
- "version": "1.13.9",
3
+ "version": "1.13.11",
4
4
  "description": "Typescript transformers for swc. Supports Node >= 0.8",
5
5
  "keywords": [
6
6
  "matcher",
@@ -47,13 +47,12 @@
47
47
  "@swc/core": "*",
48
48
  "exit": "^0.1.2",
49
49
  "fs-iterator": "^5.2.10",
50
+ "function-exec-sync": "^1.2.5",
50
51
  "get-tsconfig-compat": "^2.0.3",
51
52
  "install-module-linked": "^1.1.8",
52
53
  "is-absolute": "^1.0.0",
53
- "lazy-cache": "^2.0.2",
54
54
  "minimatch": "^3.1.2",
55
55
  "mkdirp-classic": "^0.5.3",
56
- "node-version-call": "^1.6.6",
57
56
  "path-posix": "^1.0.0",
58
57
  "queue-cb": "^1.4.10",
59
58
  "resolve": "^1.22.10",
@@ -70,10 +69,7 @@
70
69
  "@types/node": "^22.10.5",
71
70
  "cr": "^0.1.0",
72
71
  "cross-spawn-cb": "^2.1.2",
73
- "es6-map": "^0.1.5",
74
- "es6-symbol": "^3.1.4",
75
72
  "lodash.difference": "^4.5.0",
76
- "object-assign": "^4.1.1",
77
73
  "pinkie-promise": "^2.0.1",
78
74
  "react": "^19.0.0",
79
75
  "ts-node": "^10.8.2",