ts-swc-transform 1.7.0 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/cjs/{index-base.js → index.js} +16 -0
  2. package/dist/cjs/index.js.map +1 -0
  3. package/dist/cjs/lib/loadSWC.js +23 -2
  4. package/dist/cjs/lib/loadSWC.js.map +1 -1
  5. package/dist/cjs/lib/wrapWorker.js +78 -0
  6. package/dist/cjs/lib/wrapWorker.js.map +1 -0
  7. package/dist/cjs/{esm/transformDirectory.js → transformDirectory.js} +11 -12
  8. package/dist/cjs/transformDirectory.js.map +1 -0
  9. package/dist/cjs/{cjs/transformFile.js → transformFile.js} +8 -19
  10. package/dist/cjs/transformFile.js.map +1 -0
  11. package/dist/cjs/{cjs/transformSync.js → transformSync.js} +7 -10
  12. package/dist/cjs/transformSync.js.map +1 -0
  13. package/dist/cjs/{cjs/transformTypes.js → transformTypes.js} +9 -20
  14. package/dist/cjs/transformTypes.js.map +1 -0
  15. package/dist/cjs/workers/transformSync.js +3 -43
  16. package/dist/cjs/workers/transformSync.js.map +1 -1
  17. package/dist/cjs/workers/transformTypes.js +3 -3
  18. package/dist/cjs/workers/transformTypes.js.map +1 -1
  19. package/dist/esm/{index-base.mjs → index.mjs} +4 -0
  20. package/dist/esm/index.mjs.map +1 -0
  21. package/dist/esm/lib/loadSWC.mjs +20 -1
  22. package/dist/esm/lib/loadSWC.mjs.map +1 -1
  23. package/dist/esm/lib/wrapWorker.mjs +25 -0
  24. package/dist/esm/lib/wrapWorker.mjs.map +1 -0
  25. package/dist/esm/{esm/transformDirectory.mjs → transformDirectory.mjs} +11 -13
  26. package/dist/esm/transformDirectory.mjs.map +1 -0
  27. package/dist/esm/{esm/transformFile.mjs → transformFile.mjs} +11 -13
  28. package/dist/esm/transformFile.mjs.map +1 -0
  29. package/dist/esm/{cjs/transformSync.mjs → transformSync.mjs} +7 -11
  30. package/dist/esm/transformSync.mjs.map +1 -0
  31. package/dist/esm/{cjs/transformTypes.mjs → transformTypes.mjs} +9 -21
  32. package/dist/esm/transformTypes.mjs.map +1 -0
  33. package/dist/esm/workers/transformSync.mjs +2 -1
  34. package/dist/esm/workers/transformSync.mjs.map +1 -1
  35. package/dist/esm/workers/transformTypes.mjs +2 -2
  36. package/dist/esm/workers/transformTypes.mjs.map +1 -1
  37. package/package.json +7 -7
  38. package/dist/cjs/cjs/transformDirectory.js +0 -59
  39. package/dist/cjs/cjs/transformDirectory.js.map +0 -1
  40. package/dist/cjs/cjs/transformFile.js.map +0 -1
  41. package/dist/cjs/cjs/transformSync.js.map +0 -1
  42. package/dist/cjs/cjs/transformTypes.js.map +0 -1
  43. package/dist/cjs/esm/transformDirectory.js.map +0 -1
  44. package/dist/cjs/esm/transformFile.js +0 -49
  45. package/dist/cjs/esm/transformFile.js.map +0 -1
  46. package/dist/cjs/esm/transformSync.js +0 -17
  47. package/dist/cjs/esm/transformSync.js.map +0 -1
  48. package/dist/cjs/esm/transformTypes.js +0 -47
  49. package/dist/cjs/esm/transformTypes.js.map +0 -1
  50. package/dist/cjs/index-base.js.map +0 -1
  51. package/dist/cjs/index.cjs.js +0 -48
  52. package/dist/cjs/index.cjs.js.map +0 -1
  53. package/dist/cjs/index.esm.js +0 -48
  54. package/dist/cjs/index.esm.js.map +0 -1
  55. package/dist/cjs/lib/installBindings.js +0 -38
  56. package/dist/cjs/lib/installBindings.js.map +0 -1
  57. package/dist/cjs/lib/packageRoot.js +0 -26
  58. package/dist/cjs/lib/packageRoot.js.map +0 -1
  59. package/dist/esm/cjs/transformDirectory.mjs +0 -44
  60. package/dist/esm/cjs/transformDirectory.mjs.map +0 -1
  61. package/dist/esm/cjs/transformFile.mjs +0 -44
  62. package/dist/esm/cjs/transformFile.mjs.map +0 -1
  63. package/dist/esm/cjs/transformSync.mjs.map +0 -1
  64. package/dist/esm/cjs/transformTypes.mjs.map +0 -1
  65. package/dist/esm/esm/transformDirectory.mjs.map +0 -1
  66. package/dist/esm/esm/transformFile.mjs.map +0 -1
  67. package/dist/esm/esm/transformSync.mjs +0 -1
  68. package/dist/esm/esm/transformSync.mjs.map +0 -1
  69. package/dist/esm/esm/transformTypes.mjs +0 -32
  70. package/dist/esm/esm/transformTypes.mjs.map +0 -1
  71. package/dist/esm/index-base.mjs.map +0 -1
  72. package/dist/esm/index.cjs.mjs +0 -5
  73. package/dist/esm/index.cjs.mjs.map +0 -1
  74. package/dist/esm/index.esm.mjs +0 -5
  75. package/dist/esm/index.esm.mjs.map +0 -1
  76. package/dist/esm/lib/installBindings.mjs +0 -20
  77. package/dist/esm/lib/installBindings.mjs.map +0 -1
  78. package/dist/esm/lib/packageRoot.mjs +0 -10
  79. package/dist/esm/lib/packageRoot.mjs.map +0 -1
  80. package/dist/types/cjs/transformDirectory.d.ts +0 -9
  81. package/dist/types/cjs/transformFile.d.ts +0 -9
  82. package/dist/types/cjs/transformSync.d.ts +0 -8
  83. package/dist/types/cjs/transformTypes.d.ts +0 -8
  84. package/dist/types/constants.d.ts +0 -3
  85. package/dist/types/createMatcher.d.ts +0 -5
  86. package/dist/types/esm/transformDirectory.d.ts +0 -9
  87. package/dist/types/esm/transformFile.d.ts +0 -9
  88. package/dist/types/esm/transformSync.d.ts +0 -1
  89. package/dist/types/esm/transformTypes.d.ts +0 -8
  90. package/dist/types/extensions.d.ts +0 -2
  91. package/dist/types/index-base.d.ts +0 -6
  92. package/dist/types/index.cjs.d.ts +0 -5
  93. package/dist/types/index.esm.d.ts +0 -5
  94. package/dist/types/lib/existsSync.d.ts +0 -3
  95. package/dist/types/lib/fileURLToPath.d.ts +0 -3
  96. package/dist/types/lib/installBindings.d.ts +0 -1
  97. package/dist/types/lib/lazy.d.cts +0 -1
  98. package/dist/types/lib/loadSWC.d.ts +0 -2
  99. package/dist/types/lib/packageRoot.d.ts +0 -1
  100. package/dist/types/resolveFileSync.d.ts +0 -2
  101. package/dist/types/toPath.d.ts +0 -2
  102. package/dist/types/types.d.ts +0 -4
  103. package/dist/types/workers/transformDirectory.d.ts +0 -1
  104. package/dist/types/workers/transformFile.d.ts +0 -1
  105. package/dist/types/workers/transformSync.d.ts +0 -2
  106. package/dist/types/workers/transformTypes.d.ts +0 -1
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- transformDirectory: function() {
13
- return _transformDirectory.default;
14
- },
15
- transformFile: function() {
16
- return _transformFile.default;
17
- },
18
- transformSync: function() {
19
- return _transformSync.default;
20
- },
21
- transformTypes: function() {
22
- return _transformTypes.default;
23
- }
24
- });
25
- _export_star(require("./index-base.js"), exports);
26
- var _transformFile = /*#__PURE__*/ _interop_require_default(require("./esm/transformFile.js"));
27
- var _transformDirectory = /*#__PURE__*/ _interop_require_default(require("./esm/transformDirectory.js"));
28
- var _transformSync = /*#__PURE__*/ _interop_require_default(require("./esm/transformSync.js"));
29
- var _transformTypes = /*#__PURE__*/ _interop_require_default(require("./esm/transformTypes.js"));
30
- function _export_star(from, to) {
31
- Object.keys(from).forEach(function(k) {
32
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
33
- Object.defineProperty(to, k, {
34
- enumerable: true,
35
- get: function() {
36
- return from[k];
37
- }
38
- });
39
- }
40
- });
41
- return from;
42
- }
43
- function _interop_require_default(obj) {
44
- return obj && obj.__esModule ? obj : {
45
- default: obj
46
- };
47
- }
48
- /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.esm.ts"],"sourcesContent":["export * from './index-base.js';\nexport { default as transformFile } from './esm/transformFile.js';\nexport { default as transformDirectory } from './esm/transformDirectory.js';\nexport { default as transformSync } from './esm/transformSync.js';\nexport { default as transformTypes } from './esm/transformTypes.js';\n"],"names":["transformDirectory","transformFile","transformSync","transformTypes"],"mappings":";;;;;;;;;;;IAEoBA,kBAAkB;eAAlBA,2BAAkB;;IADlBC,aAAa;eAAbA,sBAAa;;IAEbC,aAAa;eAAbA,sBAAa;;IACbC,cAAc;eAAdA,uBAAc;;;qBAJpB;oEAC2B;yEACK;oEACL;qEACC"}
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return installBindings;
9
- }
10
- });
11
- var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
12
- var _path = /*#__PURE__*/ _interop_require_default(require("path"));
13
- var _installmodulelinked = /*#__PURE__*/ _interop_require_default(require("install-module-linked"));
14
- var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
15
- var _resolve = /*#__PURE__*/ _interop_require_default(require("resolve"));
16
- function _interop_require_default(obj) {
17
- return obj && obj.__esModule ? obj : {
18
- default: obj
19
- };
20
- }
21
- function installBindings(callback) {
22
- var swcPackagePath = _resolve.default.sync('@swc/core/package.json');
23
- var swcDir = _path.default.dirname(_path.default.dirname(swcPackagePath));
24
- var optionalDependencies = JSON.parse(_fs.default.readFileSync(swcPackagePath, 'utf8')).optionalDependencies;
25
- var depKey = "".concat(process.platform, "-").concat(process.arch);
26
- var queue = new _queuecb.default();
27
- Object.keys(optionalDependencies).filter(function(name) {
28
- return name.indexOf(depKey) >= 0;
29
- }).map(function(name) {
30
- queue.defer(function(callback) {
31
- var version = optionalDependencies[name];
32
- var installString = "".concat(name).concat(version ? "@".concat(version) : '');
33
- (0, _installmodulelinked.default)(installString, _path.default.dirname(swcDir), callback);
34
- });
35
- });
36
- queue.await(callback);
37
- }
38
- /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["installBindings.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport installModule from 'install-module-linked';\nimport Queue from 'queue-cb';\nimport resolve from 'resolve';\n\nexport default function installBindings(callback) {\n const swcPackagePath = resolve.sync('@swc/core/package.json');\n const swcDir = path.dirname(path.dirname(swcPackagePath));\n const { optionalDependencies } = JSON.parse(fs.readFileSync(swcPackagePath, 'utf8'));\n const depKey = `${process.platform}-${process.arch}`;\n\n const queue = new Queue();\n Object.keys(optionalDependencies)\n .filter((name) => name.indexOf(depKey) >= 0)\n .map((name) => {\n queue.defer((callback) => {\n const version = optionalDependencies[name];\n const installString = `${name}${version ? `@${version}` : ''}`;\n installModule(installString, path.dirname(swcDir), callback);\n });\n });\n queue.await(callback);\n}\n"],"names":["installBindings","callback","swcPackagePath","resolve","sync","swcDir","path","dirname","optionalDependencies","JSON","parse","fs","readFileSync","depKey","process","platform","arch","queue","Queue","Object","keys","filter","name","indexOf","map","defer","version","installString","installModule","await"],"mappings":";;;;+BAMA;;;eAAwBA;;;yDANT;2DACE;0EACS;8DACR;8DACE;;;;;;AAEL,SAASA,gBAAgBC,QAAQ;IAC9C,IAAMC,iBAAiBC,gBAAO,CAACC,IAAI,CAAC;IACpC,IAAMC,SAASC,aAAI,CAACC,OAAO,CAACD,aAAI,CAACC,OAAO,CAACL;IACzC,IAAM,AAAEM,uBAAyBC,KAAKC,KAAK,CAACC,WAAE,CAACC,YAAY,CAACV,gBAAgB,SAApEM;IACR,IAAMK,SAAS,AAAC,GAAsBC,OAApBA,QAAQC,QAAQ,EAAC,KAAgB,OAAbD,QAAQE,IAAI;IAElD,IAAMC,QAAQ,IAAIC,gBAAK;IACvBC,OAAOC,IAAI,CAACZ,sBACTa,MAAM,CAAC,SAACC;eAASA,KAAKC,OAAO,CAACV,WAAW;OACzCW,GAAG,CAAC,SAACF;QACJL,MAAMQ,KAAK,CAAC,SAACxB;YACX,IAAMyB,UAAUlB,oBAAoB,CAACc,KAAK;YAC1C,IAAMK,gBAAgB,AAAC,GAASD,OAAPJ,MAAoC,OAA7BI,UAAU,AAAC,IAAW,OAARA,WAAY;YAC1DE,IAAAA,4BAAa,EAACD,eAAerB,aAAI,CAACC,OAAO,CAACF,SAASJ;QACrD;IACF;IACFgB,MAAMY,KAAK,CAAC5B;AACd"}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return packageRoot;
9
- }
10
- });
11
- var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
12
- var _path = /*#__PURE__*/ _interop_require_default(require("path"));
13
- var _existsSync = /*#__PURE__*/ _interop_require_default(require("./existsSync.js"));
14
- function _interop_require_default(obj) {
15
- return obj && obj.__esModule ? obj : {
16
- default: obj
17
- };
18
- }
19
- function packageRoot(dir) {
20
- var packagePath = _path.default.join(dir, 'package.json');
21
- if ((0, _existsSync.default)(packagePath) && JSON.parse(_fs.default.readFileSync(packagePath, 'utf8')).name) return dir;
22
- var nextDir = _path.default.dirname(dir);
23
- if (nextDir === dir) throw new Error('Package root not found');
24
- return packageRoot(nextDir);
25
- }
26
- /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["packageRoot.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport existsSync from './existsSync.js';\n\nexport default function packageRoot(dir) {\n const packagePath = path.join(dir, 'package.json');\n if (existsSync(packagePath) && JSON.parse(fs.readFileSync(packagePath, 'utf8')).name) return dir;\n const nextDir = path.dirname(dir);\n if (nextDir === dir) throw new Error('Package root not found');\n return packageRoot(nextDir);\n}\n"],"names":["packageRoot","dir","packagePath","path","join","existsSync","JSON","parse","fs","readFileSync","name","nextDir","dirname","Error"],"mappings":";;;;+BAIA;;;eAAwBA;;;yDAJT;2DACE;iEACM;;;;;;AAER,SAASA,YAAYC,GAAG;IACrC,IAAMC,cAAcC,aAAI,CAACC,IAAI,CAACH,KAAK;IACnC,IAAII,IAAAA,mBAAU,EAACH,gBAAgBI,KAAKC,KAAK,CAACC,WAAE,CAACC,YAAY,CAACP,aAAa,SAASQ,IAAI,EAAE,OAAOT;IAC7F,IAAMU,UAAUR,aAAI,CAACS,OAAO,CAACX;IAC7B,IAAIU,YAAYV,KAAK,MAAM,IAAIY,MAAM;IACrC,OAAOb,YAAYW;AACrB"}
@@ -1,44 +0,0 @@
1
- import path from 'path';
2
- import url from 'url';
3
- // @ts-ignore
4
- import lazy from '../lib/lazy.cjs';
5
- import packageRoot from '../lib/packageRoot.mjs';
6
- const __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));
7
- const root = packageRoot(__dirname);
8
- const worker = path.resolve(root, 'dist', 'cjs', 'workers', 'transformDirectory.js');
9
- const version = 'lts';
10
- const call = lazy('node-version-call');
11
- function transformDirectoryCallback(src, dest, type, options, callback) {
12
- try {
13
- const res = call()({
14
- version,
15
- callbacks: true
16
- }, worker, src, dest, type, options);
17
- return callback(null, res);
18
- } catch (err) {
19
- return callback(err);
20
- }
21
- }
22
- /**
23
- * @param {string} src The source directory to traverse.
24
- * @param {string} dest The output directory to write files to.
25
- * @param {string} type The type of transform ('esm' or 'cjs').
26
- * @param {{sourceMaps: boolean, tsconfig: TsConfigResult}} options Options to pass to swc.
27
- * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.
28
- * @returns {void | Promise<any>} Optional promise if callback not provided.
29
- */ export default function transformDirectory(src, dest, type, options, callback) {
30
- if (typeof options === 'function') {
31
- callback = options;
32
- options = null;
33
- }
34
- options = options || {};
35
- if (typeof src !== 'string') throw new Error('transformDirectory: unexpected source');
36
- if (typeof dest !== 'string') throw new Error('transformDirectory: unexpected destination directory');
37
- if (typeof type !== 'string') throw new Error('transformDirectory: unexpected type');
38
- if (typeof callback === 'function') return transformDirectoryCallback(src, dest, type, options, callback);
39
- return new Promise((resolve, reject)=>{
40
- transformDirectoryCallback(src, dest, type, options, function compileCallback(err, result) {
41
- err ? reject(err) : resolve(result);
42
- });
43
- });
44
- }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["transformDirectory.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\n\n// @ts-ignore\nimport lazy from '../lib/lazy.cjs';\nimport packageRoot from '../lib/packageRoot.js';\n\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst root = packageRoot(__dirname);\nconst worker = path.resolve(root, 'dist', 'cjs', 'workers', 'transformDirectory.js');\nconst version = 'lts';\nconst call = lazy('node-version-call');\n\nfunction transformDirectoryCallback(src, dest, type, options, callback) {\n try {\n const res = call()({ version, callbacks: true }, worker, src, dest, type, options);\n return callback(null, res);\n } catch (err) {\n return callback(err);\n }\n}\n\n/**\n * @param {string} src The source directory to traverse.\n * @param {string} dest The output directory to write files to.\n * @param {string} type The type of transform ('esm' or 'cjs').\n * @param {{sourceMaps: boolean, tsconfig: TsConfigResult}} options Options to pass to swc.\n * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.\n * @returns {void | Promise<any>} Optional promise if callback not provided.\n */\nexport default function transformDirectory(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n if (typeof src !== 'string') throw new Error('transformDirectory: unexpected source');\n if (typeof dest !== 'string') throw new Error('transformDirectory: unexpected destination directory');\n if (typeof type !== 'string') throw new Error('transformDirectory: unexpected type');\n\n if (typeof callback === 'function') return transformDirectoryCallback(src, dest, type, options, callback);\n return new Promise((resolve, reject) => {\n transformDirectoryCallback(src, dest, type, options, function compileCallback(err, result) {\n err ? reject(err) : resolve(result);\n });\n });\n}\n"],"names":["path","url","lazy","packageRoot","__dirname","dirname","__filename","fileURLToPath","root","worker","resolve","version","call","transformDirectoryCallback","src","dest","type","options","callback","res","callbacks","err","transformDirectory","Error","Promise","reject","compileCallback","result"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AAEtB,aAAa;AACb,OAAOC,UAAU,kBAAkB;AACnC,OAAOC,iBAAiB,wBAAwB;AAEhD,MAAMC,YAAYJ,KAAKK,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaL,IAAIM,aAAa,CAAC,YAAYN,GAAG;AACjH,MAAMO,OAAOL,YAAYC;AACzB,MAAMK,SAAST,KAAKU,OAAO,CAACF,MAAM,QAAQ,OAAO,WAAW;AAC5D,MAAMG,UAAU;AAChB,MAAMC,OAAOV,KAAK;AAElB,SAASW,2BAA2BC,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACpE,IAAI;QACF,MAAMC,MAAMP,OAAO;YAAED;YAASS,WAAW;QAAK,GAAGX,QAAQK,KAAKC,MAAMC,MAAMC;QAC1E,OAAOC,SAAS,MAAMC;IACxB,EAAE,OAAOE,KAAK;QACZ,OAAOH,SAASG;IAClB;AACF;AAEA;;;;;;;CAOC,GACD,eAAe,SAASC,mBAAmBR,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC3E,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IACtB,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIS,MAAM;IAC7C,IAAI,OAAOR,SAAS,UAAU,MAAM,IAAIQ,MAAM;IAC9C,IAAI,OAAOP,SAAS,UAAU,MAAM,IAAIO,MAAM;IAE9C,IAAI,OAAOL,aAAa,YAAY,OAAOL,2BAA2BC,KAAKC,MAAMC,MAAMC,SAASC;IAChG,OAAO,IAAIM,QAAQ,CAACd,SAASe;QAC3BZ,2BAA2BC,KAAKC,MAAMC,MAAMC,SAAS,SAASS,gBAAgBL,GAAG,EAAEM,MAAM;YACvFN,MAAMI,OAAOJ,OAAOX,QAAQiB;QAC9B;IACF;AACF"}
@@ -1,44 +0,0 @@
1
- import path from 'path';
2
- import url from 'url';
3
- // @ts-ignore
4
- import lazy from '../lib/lazy.cjs';
5
- import packageRoot from '../lib/packageRoot.mjs';
6
- const __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));
7
- const root = packageRoot(__dirname);
8
- const worker = path.resolve(root, 'dist', 'cjs', 'workers', 'transformFile.js');
9
- const version = 'lts';
10
- const call = lazy('node-version-call');
11
- function transformFileCallback(src, dest, type, options, callback) {
12
- try {
13
- const res = call()({
14
- version,
15
- callbacks: true
16
- }, worker, src, dest, type, options);
17
- return callback(null, res);
18
- } catch (err) {
19
- return callback(err);
20
- }
21
- }
22
- /**
23
- * @param {string} src The source directory to traverse.
24
- * @param {string} dest The output directory to write files to.
25
- * @param {string} type The type of transform ('esm' or 'cjs').
26
- * @param {{sourceMaps: boolean}} options Options to pass to swc.
27
- * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.
28
- * @returns {void | Promise<any>} Optional promise if callback not provided.
29
- */ export default function transformFile(src, dest, type, options, callback) {
30
- if (typeof options === 'function') {
31
- callback = options;
32
- options = null;
33
- }
34
- options = options || {};
35
- if (typeof src !== 'string') throw new Error('transformFile: unexpected source');
36
- if (typeof dest !== 'string') throw new Error('transformFile: unexpected destination directory');
37
- if (typeof type !== 'string') throw new Error('transformFile: unexpected type');
38
- if (typeof callback === 'function') return transformFileCallback(src, dest, type, options, callback);
39
- return new Promise((resolve, reject)=>{
40
- transformFileCallback(src, dest, type, options, function compileCallback(err, result) {
41
- err ? reject(err) : resolve(result);
42
- });
43
- });
44
- }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["transformFile.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\n\n// @ts-ignore\nimport lazy from '../lib/lazy.cjs';\nimport packageRoot from '../lib/packageRoot.js';\n\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst root = packageRoot(__dirname);\nconst worker = path.resolve(root, 'dist', 'cjs', 'workers', 'transformFile.js');\nconst version = 'lts';\nconst call = lazy('node-version-call');\n\nfunction transformFileCallback(src, dest, type, options, callback) {\n try {\n const res = call()({ version, callbacks: true }, worker, src, dest, type, options);\n return callback(null, res);\n } catch (err) {\n return callback(err);\n }\n}\n\n/**\n * @param {string} src The source directory to traverse.\n * @param {string} dest The output directory to write files to.\n * @param {string} type The type of transform ('esm' or 'cjs').\n * @param {{sourceMaps: boolean}} options Options to pass to swc.\n * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.\n * @returns {void | Promise<any>} Optional promise if callback not provided.\n */\nexport default function transformFile(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n if (typeof src !== 'string') throw new Error('transformFile: unexpected source');\n if (typeof dest !== 'string') throw new Error('transformFile: unexpected destination directory');\n if (typeof type !== 'string') throw new Error('transformFile: unexpected type');\n\n if (typeof callback === 'function') return transformFileCallback(src, dest, type, options, callback);\n return new Promise((resolve, reject) => {\n transformFileCallback(src, dest, type, options, function compileCallback(err, result) {\n err ? reject(err) : resolve(result);\n });\n });\n}\n"],"names":["path","url","lazy","packageRoot","__dirname","dirname","__filename","fileURLToPath","root","worker","resolve","version","call","transformFileCallback","src","dest","type","options","callback","res","callbacks","err","transformFile","Error","Promise","reject","compileCallback","result"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AAEtB,aAAa;AACb,OAAOC,UAAU,kBAAkB;AACnC,OAAOC,iBAAiB,wBAAwB;AAEhD,MAAMC,YAAYJ,KAAKK,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaL,IAAIM,aAAa,CAAC,YAAYN,GAAG;AACjH,MAAMO,OAAOL,YAAYC;AACzB,MAAMK,SAAST,KAAKU,OAAO,CAACF,MAAM,QAAQ,OAAO,WAAW;AAC5D,MAAMG,UAAU;AAChB,MAAMC,OAAOV,KAAK;AAElB,SAASW,sBAAsBC,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC/D,IAAI;QACF,MAAMC,MAAMP,OAAO;YAAED;YAASS,WAAW;QAAK,GAAGX,QAAQK,KAAKC,MAAMC,MAAMC;QAC1E,OAAOC,SAAS,MAAMC;IACxB,EAAE,OAAOE,KAAK;QACZ,OAAOH,SAASG;IAClB;AACF;AAEA;;;;;;;CAOC,GACD,eAAe,SAASC,cAAcR,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACtE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IACtB,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIS,MAAM;IAC7C,IAAI,OAAOR,SAAS,UAAU,MAAM,IAAIQ,MAAM;IAC9C,IAAI,OAAOP,SAAS,UAAU,MAAM,IAAIO,MAAM;IAE9C,IAAI,OAAOL,aAAa,YAAY,OAAOL,sBAAsBC,KAAKC,MAAMC,MAAMC,SAASC;IAC3F,OAAO,IAAIM,QAAQ,CAACd,SAASe;QAC3BZ,sBAAsBC,KAAKC,MAAMC,MAAMC,SAAS,SAASS,gBAAgBL,GAAG,EAAEM,MAAM;YAClFN,MAAMI,OAAOJ,OAAOX,QAAQiB;QAC9B;IACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["transformSync.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport type { TsConfigResult } from 'get-tsconfig-compat';\n\n// @ts-ignore\nimport lazy from '../lib/lazy.cjs';\nimport packageRoot from '../lib/packageRoot.js';\n\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst root = packageRoot(__dirname);\nconst worker = path.resolve(root, 'dist', 'cjs', 'workers', 'transformSync.js');\nconst version = 'lts';\nconst call = lazy('node-version-call');\n\n/**\n * @param {string} contents The file contents.\n * @param {string} fileName The filename.\n * @param {TsConfigResult} tsconfig The configuration.\n * @returns {{ code: string, map?: string }} Returns object with the transformed code and source map if option sourceMaps was provided.\n */\nexport default function transformSync(contents: string, fileName: string, tsconfig: TsConfigResult) {\n return call()({ version, callbacks: true }, worker, contents, fileName, tsconfig);\n}\n"],"names":["path","url","lazy","packageRoot","__dirname","dirname","__filename","fileURLToPath","root","worker","resolve","version","call","transformSync","contents","fileName","tsconfig","callbacks"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AAGtB,aAAa;AACb,OAAOC,UAAU,kBAAkB;AACnC,OAAOC,iBAAiB,wBAAwB;AAEhD,MAAMC,YAAYJ,KAAKK,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaL,IAAIM,aAAa,CAAC,YAAYN,GAAG;AACjH,MAAMO,OAAOL,YAAYC;AACzB,MAAMK,SAAST,KAAKU,OAAO,CAACF,MAAM,QAAQ,OAAO,WAAW;AAC5D,MAAMG,UAAU;AAChB,MAAMC,OAAOV,KAAK;AAElB;;;;;CAKC,GACD,eAAe,SAASW,cAAcC,QAAgB,EAAEC,QAAgB,EAAEC,QAAwB;IAChG,OAAOJ,OAAO;QAAED;QAASM,WAAW;IAAK,GAAGR,QAAQK,UAAUC,UAAUC;AAC1E"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["transformTypes.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\n\n// @ts-ignore\nimport lazy from '../lib/lazy.cjs';\nimport packageRoot from '../lib/packageRoot.js';\n\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst root = packageRoot(__dirname);\nconst worker = path.resolve(root, 'dist', 'cjs', 'workers', 'transformTypes.js');\nconst version = 'lts';\nconst call = lazy('node-version-call');\n\nfunction transformTypesCallback(src, dest, options, callback) {\n try {\n const res = call()({ version, callbacks: true }, worker, src, dest, options);\n return callback(null, res);\n } catch (err) {\n return callback(err);\n }\n}\n\n/**\n * @param {string} src The source directory to traverse.\n * @param {string} dest The output directory to write files to.\n * @param {{tsconfig: TsConfigResult}} options Options.\n * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.\n * @returns {void | Promise<any>} Optional promise if callback not provided.\n */\nexport default function transformTypes(src, dest, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n if (typeof src !== 'string') throw new Error('transformTypes: unexpected source');\n if (typeof dest !== 'string') throw new Error('transformTypes: unexpected destination directory');\n\n if (typeof callback === 'function') return transformTypesCallback(src, dest, options, callback);\n return new Promise((resolve, reject) => {\n transformTypesCallback(src, dest, options, function compileCallback(err, result) {\n err ? reject(err) : resolve(result);\n });\n });\n}\n"],"names":["path","url","lazy","packageRoot","__dirname","dirname","__filename","fileURLToPath","root","worker","resolve","version","call","transformTypesCallback","src","dest","options","callback","res","callbacks","err","transformTypes","Error","Promise","reject","compileCallback","result"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AAEtB,aAAa;AACb,OAAOC,UAAU,kBAAkB;AACnC,OAAOC,iBAAiB,wBAAwB;AAEhD,MAAMC,YAAYJ,KAAKK,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaL,IAAIM,aAAa,CAAC,YAAYN,GAAG;AACjH,MAAMO,OAAOL,YAAYC;AACzB,MAAMK,SAAST,KAAKU,OAAO,CAACF,MAAM,QAAQ,OAAO,WAAW;AAC5D,MAAMG,UAAU;AAChB,MAAMC,OAAOV,KAAK;AAElB,SAASW,uBAAuBC,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC1D,IAAI;QACF,MAAMC,MAAMN,OAAO;YAAED;YAASQ,WAAW;QAAK,GAAGV,QAAQK,KAAKC,MAAMC;QACpE,OAAOC,SAAS,MAAMC;IACxB,EAAE,OAAOE,KAAK;QACZ,OAAOH,SAASG;IAClB;AACF;AAEA;;;;;;CAMC,GACD,eAAe,SAASC,eAAeP,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACjE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IACtB,IAAI,OAAOF,QAAQ,UAAU,MAAM,IAAIQ,MAAM;IAC7C,IAAI,OAAOP,SAAS,UAAU,MAAM,IAAIO,MAAM;IAE9C,IAAI,OAAOL,aAAa,YAAY,OAAOJ,uBAAuBC,KAAKC,MAAMC,SAASC;IACtF,OAAO,IAAIM,QAAQ,CAACb,SAASc;QAC3BX,uBAAuBC,KAAKC,MAAMC,SAAS,SAASS,gBAAgBL,GAAG,EAAEM,MAAM;YAC7EN,MAAMI,OAAOJ,OAAOV,QAAQgB;QAC9B;IACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["transformDirectory.ts"],"sourcesContent":["import transformDirectoryCallbackCJS from '../cjs/transformDirectory.js';\nimport transformDirectoryCallbackWorker from '../workers/transformDirectory.js';\n\n// @ts-ignore\nimport lazy from '../lib/lazy.cjs';\nlet transformDirectoryCallback = transformDirectoryCallbackWorker;\ntry {\n // typescript cannot be loaded so run in lts\n lazy('typescript')();\n} catch {\n transformDirectoryCallback = transformDirectoryCallbackCJS;\n}\n\n/**\n * @param {string} src The source directory to traverse.\n * @param {string} dest The output directory to write files to.\n * @param {string} type The type of transform ('esm' or 'cjs').\n * @param {{sourceMaps: boolean}} options Options to pass to swc.\n * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.\n * @returns {void | Promise<any>} Optional promise if callback not provided.\n */\nexport default function transformDirectory(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n if (typeof src !== 'string') throw new Error('transformDirectory: unexpected source');\n if (typeof dest !== 'string') throw new Error('transformDirectory: unexpected destination directory');\n if (typeof type !== 'string') throw new Error('transformDirectory: unexpected type');\n\n if (typeof callback === 'function') return transformDirectoryCallback(src, dest, type, options, callback);\n return new Promise((resolve, reject) => {\n transformDirectoryCallback(src, dest, type, options, function compileCallback(err, result) {\n err ? reject(err) : resolve(result);\n });\n });\n}\n"],"names":["transformDirectoryCallbackCJS","transformDirectoryCallbackWorker","lazy","transformDirectoryCallback","transformDirectory","src","dest","type","options","callback","Error","Promise","resolve","reject","compileCallback","err","result"],"mappings":"AAAA,OAAOA,mCAAmC,+BAA+B;AACzE,OAAOC,sCAAsC,mCAAmC;AAEhF,aAAa;AACb,OAAOC,UAAU,kBAAkB;AACnC,IAAIC,6BAA6BF;AACjC,IAAI;IACF,4CAA4C;IAC5CC,KAAK;AACP,EAAE,OAAM;IACNC,6BAA6BH;AAC/B;AAEA;;;;;;;CAOC,GACD,eAAe,SAASI,mBAAmBC,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC3E,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IACtB,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIK,MAAM;IAC7C,IAAI,OAAOJ,SAAS,UAAU,MAAM,IAAII,MAAM;IAC9C,IAAI,OAAOH,SAAS,UAAU,MAAM,IAAIG,MAAM;IAE9C,IAAI,OAAOD,aAAa,YAAY,OAAON,2BAA2BE,KAAKC,MAAMC,MAAMC,SAASC;IAChG,OAAO,IAAIE,QAAQ,CAACC,SAASC;QAC3BV,2BAA2BE,KAAKC,MAAMC,MAAMC,SAAS,SAASM,gBAAgBC,GAAG,EAAEC,MAAM;YACvFD,MAAMF,OAAOE,OAAOH,QAAQI;QAC9B;IACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["transformFile.ts"],"sourcesContent":["import transformFileCallbackCJS from '../cjs/transformFile.js';\nimport transformFileCallbackWorker from '../workers/transformFile.js';\n\n// @ts-ignore\nimport lazy from '../lib/lazy.cjs';\nlet transformFileCallback = transformFileCallbackWorker;\ntry {\n // typescript cannot be loaded so run in lts\n lazy('typescript')();\n} catch {\n transformFileCallback = transformFileCallbackCJS;\n}\n\n/**\n * @param {string} src The source directory to traverse.\n * @param {string} dest The output directory to write files to.\n * @param {string} type The type of transform ('esm' or 'cjs').\n * @param {{sourceMaps: boolean}} options Options to pass to swc.\n * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.\n * @returns {void | Promise<any>} Optional promise if callback not provided.\n */\nexport default function transformFile(src, dest, type, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n if (typeof src !== 'string') throw new Error('transformFile: unexpected source');\n if (typeof dest !== 'string') throw new Error('transformFile: unexpected destination directory');\n if (typeof type !== 'string') throw new Error('transformFile: unexpected type');\n\n if (typeof callback === 'function') return transformFileCallback(src, dest, type, options, callback);\n return new Promise((resolve, reject) => {\n transformFileCallback(src, dest, type, options, function compileCallback(err, result) {\n err ? reject(err) : resolve(result);\n });\n });\n}\n"],"names":["transformFileCallbackCJS","transformFileCallbackWorker","lazy","transformFileCallback","transformFile","src","dest","type","options","callback","Error","Promise","resolve","reject","compileCallback","err","result"],"mappings":"AAAA,OAAOA,8BAA8B,0BAA0B;AAC/D,OAAOC,iCAAiC,8BAA8B;AAEtE,aAAa;AACb,OAAOC,UAAU,kBAAkB;AACnC,IAAIC,wBAAwBF;AAC5B,IAAI;IACF,4CAA4C;IAC5CC,KAAK;AACP,EAAE,OAAM;IACNC,wBAAwBH;AAC1B;AAEA;;;;;;;CAOC,GACD,eAAe,SAASI,cAAcC,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACtE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IACtB,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIK,MAAM;IAC7C,IAAI,OAAOJ,SAAS,UAAU,MAAM,IAAII,MAAM;IAC9C,IAAI,OAAOH,SAAS,UAAU,MAAM,IAAIG,MAAM;IAE9C,IAAI,OAAOD,aAAa,YAAY,OAAON,sBAAsBE,KAAKC,MAAMC,MAAMC,SAASC;IAC3F,OAAO,IAAIE,QAAQ,CAACC,SAASC;QAC3BV,sBAAsBE,KAAKC,MAAMC,MAAMC,SAAS,SAASM,gBAAgBC,GAAG,EAAEC,MAAM;YAClFD,MAAMF,OAAOE,OAAOH,QAAQI;QAC9B;IACF;AACF"}
@@ -1 +0,0 @@
1
- export { default } from '../cjs/transformSync.mjs';
@@ -1 +0,0 @@
1
- {"version":3,"sources":["transformSync.ts"],"sourcesContent":["export { default } from '../cjs/transformSync.js';\n"],"names":["default"],"mappings":"AAAA,SAASA,OAAO,QAAQ,0BAA0B"}
@@ -1,32 +0,0 @@
1
- import transformTypesCallbackCJS from '../cjs/transformTypes.mjs';
2
- // @ts-ignore
3
- import lazy from '../lib/lazy.cjs';
4
- let transformTypesCallback = transformTypesCallbackCJS;
5
- try {
6
- // typescript cannot be loaded so run in lts
7
- lazy('typescript')();
8
- lazy('tsc')();
9
- } catch {
10
- transformTypesCallback = transformTypesCallbackCJS;
11
- }
12
- /**
13
- * @param {string} src The source directory to traverse.
14
- * @param {string} dest The output directory to write files to.
15
- * @param {{tsconfig: TsConfigResult}} options Options.
16
- * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.
17
- * @returns {void | Promise<any>} Optional promise if callback not provided.
18
- */ export default function transformTypes(src, dest, options, callback) {
19
- if (typeof options === 'function') {
20
- callback = options;
21
- options = null;
22
- }
23
- options = options || {};
24
- if (typeof src !== 'string') throw new Error('transformTypes: unexpected source');
25
- if (typeof dest !== 'string') throw new Error('transformTypes: unexpected destination directory');
26
- if (typeof callback === 'function') return transformTypesCallback(src, dest, options, callback);
27
- return new Promise((resolve, reject)=>{
28
- transformTypesCallback(src, dest, options, function compileCallback(err, result) {
29
- err ? reject(err) : resolve(result);
30
- });
31
- });
32
- }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["transformTypes.ts"],"sourcesContent":["import transformTypesCallbackCJS from '../cjs/transformTypes.js';\nimport transformTypesCallbackWorker from '../workers/transformTypes.js';\n\n// @ts-ignore\nimport lazy from '../lib/lazy.cjs';\nlet transformTypesCallback = transformTypesCallbackCJS;\ntry {\n // typescript cannot be loaded so run in lts\n lazy('typescript')();\n lazy('tsc')();\n} catch {\n transformTypesCallback = transformTypesCallbackCJS;\n}\n\n/**\n * @param {string} src The source directory to traverse.\n * @param {string} dest The output directory to write files to.\n * @param {{tsconfig: TsConfigResult}} options Options.\n * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.\n * @returns {void | Promise<any>} Optional promise if callback not provided.\n */\nexport default function transformTypes(src, dest, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n if (typeof src !== 'string') throw new Error('transformTypes: unexpected source');\n if (typeof dest !== 'string') throw new Error('transformTypes: unexpected destination directory');\n\n if (typeof callback === 'function') return transformTypesCallback(src, dest, options, callback);\n return new Promise((resolve, reject) => {\n transformTypesCallback(src, dest, options, function compileCallback(err, result) {\n err ? reject(err) : resolve(result);\n });\n });\n}\n"],"names":["transformTypesCallbackCJS","lazy","transformTypesCallback","transformTypes","src","dest","options","callback","Error","Promise","resolve","reject","compileCallback","err","result"],"mappings":"AAAA,OAAOA,+BAA+B,2BAA2B;AAGjE,aAAa;AACb,OAAOC,UAAU,kBAAkB;AACnC,IAAIC,yBAAyBF;AAC7B,IAAI;IACF,4CAA4C;IAC5CC,KAAK;IACLA,KAAK;AACP,EAAE,OAAM;IACNC,yBAAyBF;AAC3B;AAEA;;;;;;CAMC,GACD,eAAe,SAASG,eAAeC,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACjE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IACtB,IAAI,OAAOF,QAAQ,UAAU,MAAM,IAAII,MAAM;IAC7C,IAAI,OAAOH,SAAS,UAAU,MAAM,IAAIG,MAAM;IAE9C,IAAI,OAAOD,aAAa,YAAY,OAAOL,uBAAuBE,KAAKC,MAAMC,SAASC;IACtF,OAAO,IAAIE,QAAQ,CAACC,SAASC;QAC3BT,uBAAuBE,KAAKC,MAAMC,SAAS,SAASM,gBAAgBC,GAAG,EAAEC,MAAM;YAC7ED,MAAMF,OAAOE,OAAOH,QAAQI;QAC9B;IACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index-base.ts"],"sourcesContent":["export type * from './types.js';\nexport { default as createMatcher } from './createMatcher.js';\nexport * as constants from './constants.js';\nexport { default as extensions } from './extensions.js';\nexport { default as resolveFileSync } from './resolveFileSync.js';\nexport { default as toPath } from './toPath.js';\n"],"names":["default","createMatcher","constants","extensions","resolveFileSync","toPath"],"mappings":"AACA,SAASA,WAAWC,aAAa,QAAQ,qBAAqB;AAC9D,OAAO,KAAKC,SAAS,MAAM,iBAAiB;AAC5C,SAASF,WAAWG,UAAU,QAAQ,kBAAkB;AACxD,SAASH,WAAWI,eAAe,QAAQ,uBAAuB;AAClE,SAASJ,WAAWK,MAAM,QAAQ,cAAc"}
@@ -1,5 +0,0 @@
1
- export * from './index-base.mjs';
2
- export { default as transformFile } from './cjs/transformFile.mjs';
3
- export { default as transformDirectory } from './cjs/transformDirectory.mjs';
4
- export { default as transformSync } from './cjs/transformSync.mjs';
5
- export { default as transformTypes } from './cjs/transformTypes.mjs';
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.cjs.ts"],"sourcesContent":["export * from './index-base.js';\nexport { default as transformFile } from './cjs/transformFile.js';\nexport { default as transformDirectory } from './cjs/transformDirectory.js';\nexport { default as transformSync } from './cjs/transformSync.js';\nexport { default as transformTypes } from './cjs/transformTypes.js';\n"],"names":["default","transformFile","transformDirectory","transformSync","transformTypes"],"mappings":"AAAA,cAAc,kBAAkB;AAChC,SAASA,WAAWC,aAAa,QAAQ,yBAAyB;AAClE,SAASD,WAAWE,kBAAkB,QAAQ,8BAA8B;AAC5E,SAASF,WAAWG,aAAa,QAAQ,yBAAyB;AAClE,SAASH,WAAWI,cAAc,QAAQ,0BAA0B"}
@@ -1,5 +0,0 @@
1
- export * from './index-base.mjs';
2
- export { default as transformFile } from './esm/transformFile.mjs';
3
- export { default as transformDirectory } from './esm/transformDirectory.mjs';
4
- export { default as transformSync } from './esm/transformSync.mjs';
5
- export { default as transformTypes } from './esm/transformTypes.mjs';
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.esm.ts"],"sourcesContent":["export * from './index-base.js';\nexport { default as transformFile } from './esm/transformFile.js';\nexport { default as transformDirectory } from './esm/transformDirectory.js';\nexport { default as transformSync } from './esm/transformSync.js';\nexport { default as transformTypes } from './esm/transformTypes.js';\n"],"names":["default","transformFile","transformDirectory","transformSync","transformTypes"],"mappings":"AAAA,cAAc,kBAAkB;AAChC,SAASA,WAAWC,aAAa,QAAQ,yBAAyB;AAClE,SAASD,WAAWE,kBAAkB,QAAQ,8BAA8B;AAC5E,SAASF,WAAWG,aAAa,QAAQ,yBAAyB;AAClE,SAASH,WAAWI,cAAc,QAAQ,0BAA0B"}
@@ -1,20 +0,0 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import installModule from 'install-module-linked';
4
- import Queue from 'queue-cb';
5
- import resolve from 'resolve';
6
- export default function installBindings(callback) {
7
- const swcPackagePath = resolve.sync('@swc/core/package.json');
8
- const swcDir = path.dirname(path.dirname(swcPackagePath));
9
- const { optionalDependencies } = JSON.parse(fs.readFileSync(swcPackagePath, 'utf8'));
10
- const depKey = `${process.platform}-${process.arch}`;
11
- const queue = new Queue();
12
- Object.keys(optionalDependencies).filter((name)=>name.indexOf(depKey) >= 0).map((name)=>{
13
- queue.defer((callback)=>{
14
- const version = optionalDependencies[name];
15
- const installString = `${name}${version ? `@${version}` : ''}`;
16
- installModule(installString, path.dirname(swcDir), callback);
17
- });
18
- });
19
- queue.await(callback);
20
- }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["installBindings.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport installModule from 'install-module-linked';\nimport Queue from 'queue-cb';\nimport resolve from 'resolve';\n\nexport default function installBindings(callback) {\n const swcPackagePath = resolve.sync('@swc/core/package.json');\n const swcDir = path.dirname(path.dirname(swcPackagePath));\n const { optionalDependencies } = JSON.parse(fs.readFileSync(swcPackagePath, 'utf8'));\n const depKey = `${process.platform}-${process.arch}`;\n\n const queue = new Queue();\n Object.keys(optionalDependencies)\n .filter((name) => name.indexOf(depKey) >= 0)\n .map((name) => {\n queue.defer((callback) => {\n const version = optionalDependencies[name];\n const installString = `${name}${version ? `@${version}` : ''}`;\n installModule(installString, path.dirname(swcDir), callback);\n });\n });\n queue.await(callback);\n}\n"],"names":["fs","path","installModule","Queue","resolve","installBindings","callback","swcPackagePath","sync","swcDir","dirname","optionalDependencies","JSON","parse","readFileSync","depKey","process","platform","arch","queue","Object","keys","filter","name","indexOf","map","defer","version","installString","await"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,mBAAmB,wBAAwB;AAClD,OAAOC,WAAW,WAAW;AAC7B,OAAOC,aAAa,UAAU;AAE9B,eAAe,SAASC,gBAAgBC,QAAQ;IAC9C,MAAMC,iBAAiBH,QAAQI,IAAI,CAAC;IACpC,MAAMC,SAASR,KAAKS,OAAO,CAACT,KAAKS,OAAO,CAACH;IACzC,MAAM,EAAEI,oBAAoB,EAAE,GAAGC,KAAKC,KAAK,CAACb,GAAGc,YAAY,CAACP,gBAAgB;IAC5E,MAAMQ,SAAS,GAAGC,QAAQC,QAAQ,CAAC,CAAC,EAAED,QAAQE,IAAI,EAAE;IAEpD,MAAMC,QAAQ,IAAIhB;IAClBiB,OAAOC,IAAI,CAACV,sBACTW,MAAM,CAAC,CAACC,OAASA,KAAKC,OAAO,CAACT,WAAW,GACzCU,GAAG,CAAC,CAACF;QACJJ,MAAMO,KAAK,CAAC,CAACpB;YACX,MAAMqB,UAAUhB,oBAAoB,CAACY,KAAK;YAC1C,MAAMK,gBAAgB,GAAGL,OAAOI,UAAU,CAAC,CAAC,EAAEA,SAAS,GAAG,IAAI;YAC9DzB,cAAc0B,eAAe3B,KAAKS,OAAO,CAACD,SAASH;QACrD;IACF;IACFa,MAAMU,KAAK,CAACvB;AACd"}
@@ -1,10 +0,0 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import existsSync from './existsSync.mjs';
4
- export default function packageRoot(dir) {
5
- const packagePath = path.join(dir, 'package.json');
6
- if (existsSync(packagePath) && JSON.parse(fs.readFileSync(packagePath, 'utf8')).name) return dir;
7
- const nextDir = path.dirname(dir);
8
- if (nextDir === dir) throw new Error('Package root not found');
9
- return packageRoot(nextDir);
10
- }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["packageRoot.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport existsSync from './existsSync.js';\n\nexport default function packageRoot(dir) {\n const packagePath = path.join(dir, 'package.json');\n if (existsSync(packagePath) && JSON.parse(fs.readFileSync(packagePath, 'utf8')).name) return dir;\n const nextDir = path.dirname(dir);\n if (nextDir === dir) throw new Error('Package root not found');\n return packageRoot(nextDir);\n}\n"],"names":["fs","path","existsSync","packageRoot","dir","packagePath","join","JSON","parse","readFileSync","name","nextDir","dirname","Error"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,gBAAgB,kBAAkB;AAEzC,eAAe,SAASC,YAAYC,GAAG;IACrC,MAAMC,cAAcJ,KAAKK,IAAI,CAACF,KAAK;IACnC,IAAIF,WAAWG,gBAAgBE,KAAKC,KAAK,CAACR,GAAGS,YAAY,CAACJ,aAAa,SAASK,IAAI,EAAE,OAAON;IAC7F,MAAMO,UAAUV,KAAKW,OAAO,CAACR;IAC7B,IAAIO,YAAYP,KAAK,MAAM,IAAIS,MAAM;IACrC,OAAOV,YAAYQ;AACrB"}
@@ -1,9 +0,0 @@
1
- /**
2
- * @param {string} src The source directory to traverse.
3
- * @param {string} dest The output directory to write files to.
4
- * @param {string} type The type of transform ('esm' or 'cjs').
5
- * @param {{sourceMaps: boolean, tsconfig: TsConfigResult}} options Options to pass to swc.
6
- * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.
7
- * @returns {void | Promise<any>} Optional promise if callback not provided.
8
- */
9
- export default function transformDirectory(src: any, dest: any, type: any, options: any, callback: any): any;
@@ -1,9 +0,0 @@
1
- /**
2
- * @param {string} src The source directory to traverse.
3
- * @param {string} dest The output directory to write files to.
4
- * @param {string} type The type of transform ('esm' or 'cjs').
5
- * @param {{sourceMaps: boolean}} options Options to pass to swc.
6
- * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.
7
- * @returns {void | Promise<any>} Optional promise if callback not provided.
8
- */
9
- export default function transformFile(src: any, dest: any, type: any, options: any, callback: any): any;
@@ -1,8 +0,0 @@
1
- import type { TsConfigResult } from 'get-tsconfig-compat';
2
- /**
3
- * @param {string} contents The file contents.
4
- * @param {string} fileName The filename.
5
- * @param {TsConfigResult} tsconfig The configuration.
6
- * @returns {{ code: string, map?: string }} Returns object with the transformed code and source map if option sourceMaps was provided.
7
- */
8
- export default function transformSync(contents: string, fileName: string, tsconfig: TsConfigResult): any;
@@ -1,8 +0,0 @@
1
- /**
2
- * @param {string} src The source directory to traverse.
3
- * @param {string} dest The output directory to write files to.
4
- * @param {{tsconfig: TsConfigResult}} options Options.
5
- * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.
6
- * @returns {void | Promise<any>} Optional promise if callback not provided.
7
- */
8
- export default function transformTypes(src: any, dest: any, options: any, callback: any): any;
@@ -1,3 +0,0 @@
1
- export declare const moduleRegEx: RegExp;
2
- export declare const typeFileRegEx: RegExp;
3
- export declare const SKIPS: string[];
@@ -1,5 +0,0 @@
1
- /**
2
- * @param {{path: string, config: Object}} config The path to the loaded TS config and typescript config.
3
- * @returns {(filePath:string) => boolean} The function to test for typescript files being included or excluded
4
- */
5
- export default function createMatcher(config: any): (filePath: any) => boolean;
@@ -1,9 +0,0 @@
1
- /**
2
- * @param {string} src The source directory to traverse.
3
- * @param {string} dest The output directory to write files to.
4
- * @param {string} type The type of transform ('esm' or 'cjs').
5
- * @param {{sourceMaps: boolean}} options Options to pass to swc.
6
- * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.
7
- * @returns {void | Promise<any>} Optional promise if callback not provided.
8
- */
9
- export default function transformDirectory(src: any, dest: any, type: any, options: any, callback: any): void | Promise<unknown>;
@@ -1,9 +0,0 @@
1
- /**
2
- * @param {string} src The source directory to traverse.
3
- * @param {string} dest The output directory to write files to.
4
- * @param {string} type The type of transform ('esm' or 'cjs').
5
- * @param {{sourceMaps: boolean}} options Options to pass to swc.
6
- * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.
7
- * @returns {void | Promise<any>} Optional promise if callback not provided.
8
- */
9
- export default function transformFile(src: any, dest: any, type: any, options: any, callback: any): void | Promise<unknown>;
@@ -1 +0,0 @@
1
- export { default } from '../cjs/transformSync.js';
@@ -1,8 +0,0 @@
1
- /**
2
- * @param {string} src The source directory to traverse.
3
- * @param {string} dest The output directory to write files to.
4
- * @param {{tsconfig: TsConfigResult}} options Options.
5
- * @param {(err?: Error) =>} [callback] Optional callback. Uses promise if callback not provided.
6
- * @returns {void | Promise<any>} Optional promise if callback not provided.
7
- */
8
- export default function transformTypes(src: any, dest: any, options: any, callback: any): any;
@@ -1,2 +0,0 @@
1
- declare const _default: string[];
2
- export default _default;
@@ -1,6 +0,0 @@
1
- export type * from './types.js';
2
- export { default as createMatcher } from './createMatcher.js';
3
- export * as constants from './constants.js';
4
- export { default as extensions } from './extensions.js';
5
- export { default as resolveFileSync } from './resolveFileSync.js';
6
- export { default as toPath } from './toPath.js';
@@ -1,5 +0,0 @@
1
- export * from './index-base.js';
2
- export { default as transformFile } from './cjs/transformFile.js';
3
- export { default as transformDirectory } from './cjs/transformDirectory.js';
4
- export { default as transformSync } from './cjs/transformSync.js';
5
- export { default as transformTypes } from './cjs/transformTypes.js';
@@ -1,5 +0,0 @@
1
- export * from './index-base.js';
2
- export { default as transformFile } from './esm/transformFile.js';
3
- export { default as transformDirectory } from './esm/transformDirectory.js';
4
- export { default as transformSync } from './esm/transformSync.js';
5
- export { default as transformTypes } from './esm/transformTypes.js';
@@ -1,3 +0,0 @@
1
- declare function existsSyncPolyfill(path: any): boolean;
2
- declare const _default: typeof existsSyncPolyfill;
3
- export default _default;
@@ -1,3 +0,0 @@
1
- import url from 'url';
2
- declare const _default: typeof url.fileURLToPath;
3
- export default _default;
@@ -1 +0,0 @@
1
- export default function installBindings(callback: any): void;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- declare const _default: any;
2
- export default _default;
@@ -1 +0,0 @@
1
- export default function packageRoot(dir: any): any;
@@ -1,2 +0,0 @@
1
- import type { Context } from './types.js';
2
- export default function resolveFileSync(specifier: string, context?: Context): any;
@@ -1,2 +0,0 @@
1
- import type { Context } from './types.js';
2
- export default function toPath(specifier: string, context?: Context): any;
@@ -1,4 +0,0 @@
1
- export interface Context {
2
- parentURL?: string;
3
- parentPath?: string;
4
- }
@@ -1 +0,0 @@
1
- export default function transformDirectoryWorker(src: any, dest: any, type: any, options: any, callback: any): void;
@@ -1 +0,0 @@
1
- export default function transformFileWorker(src: any, dest: any, type: any, options: any, callback: any): void;
@@ -1,2 +0,0 @@
1
- import type { TsConfigResult } from 'get-tsconfig-compat';
2
- export default function transformSyncWorker(contents: string, fileName: string, tsconfig: TsConfigResult, callback: any): void;
@@ -1 +0,0 @@
1
- export default function types(src: any, dest: any, options: any, callback: any): void;