ts-swc-transform 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/cjs/index.d.cts +0 -1
  2. package/dist/cjs/index.d.ts +0 -1
  3. package/dist/cjs/index.js +0 -4
  4. package/dist/cjs/index.js.map +1 -1
  5. package/dist/cjs/transformDirectory.js +2 -2
  6. package/dist/cjs/transformDirectory.js.map +1 -1
  7. package/dist/cjs/transformSync.js +2 -2
  8. package/dist/cjs/transformSync.js.map +1 -1
  9. package/dist/cjs/transformTypes.js +2 -2
  10. package/dist/cjs/transformTypes.js.map +1 -1
  11. package/dist/cjs/types.d.cts +2 -6
  12. package/dist/cjs/types.d.ts +2 -6
  13. package/dist/cjs/types.js +0 -48
  14. package/dist/cjs/types.js.map +1 -1
  15. package/dist/esm/index.d.ts +0 -1
  16. package/dist/esm/index.js +0 -1
  17. package/dist/esm/index.js.map +1 -1
  18. package/dist/esm/transformDirectory.js +1 -1
  19. package/dist/esm/transformDirectory.js.map +1 -1
  20. package/dist/esm/transformSync.js +1 -1
  21. package/dist/esm/transformSync.js.map +1 -1
  22. package/dist/esm/transformTypes.js +1 -1
  23. package/dist/esm/transformTypes.js.map +1 -1
  24. package/dist/esm/types.d.ts +2 -6
  25. package/dist/esm/types.js +1 -1
  26. package/dist/esm/types.js.map +1 -1
  27. package/package.json +2 -2
  28. package/dist/cjs/TSConfigSchema.d.cts +0 -3261
  29. package/dist/cjs/TSConfigSchema.d.ts +0 -3261
  30. package/dist/cjs/TSConfigSchema.js +0 -7
  31. package/dist/cjs/TSConfigSchema.js.map +0 -1
  32. package/dist/cjs/loadConfigSync.d.cts +0 -2
  33. package/dist/cjs/loadConfigSync.d.ts +0 -2
  34. package/dist/cjs/loadConfigSync.js +0 -15
  35. package/dist/cjs/loadConfigSync.js.map +0 -1
  36. package/dist/esm/TSConfigSchema.d.ts +0 -3261
  37. package/dist/esm/TSConfigSchema.js +0 -3
  38. package/dist/esm/TSConfigSchema.js.map +0 -1
  39. package/dist/esm/loadConfigSync.d.ts +0 -2
  40. package/dist/esm/loadConfigSync.js +0 -4
  41. package/dist/esm/loadConfigSync.js.map +0 -1
@@ -1,6 +1,5 @@
1
1
  export * as constants from './constants.ts';
2
2
  export { default as createMatcher } from './createMatcher.ts';
3
- export { default as loadConfigSync } from './loadConfigSync.ts';
4
3
  export { default as resolveFileSync } from './resolveFileSync.ts';
5
4
  export { default as toPath } from './toPath.ts';
6
5
  export { default as transformDirectory } from './transformDirectory.ts';
@@ -1,6 +1,5 @@
1
1
  export * as constants from './constants.ts';
2
2
  export { default as createMatcher } from './createMatcher.ts';
3
- export { default as loadConfigSync } from './loadConfigSync.ts';
4
3
  export { default as resolveFileSync } from './resolveFileSync.ts';
5
4
  export { default as toPath } from './toPath.ts';
6
5
  export { default as transformDirectory } from './transformDirectory.ts';
package/dist/cjs/index.js CHANGED
@@ -15,9 +15,6 @@ _export(exports, {
15
15
  get createMatcher () {
16
16
  return _createMatcherts.default;
17
17
  },
18
- get loadConfigSync () {
19
- return _loadConfigSyncts.default;
20
- },
21
18
  get resolveFileSync () {
22
19
  return _resolveFileSyncts.default;
23
20
  },
@@ -36,7 +33,6 @@ _export(exports, {
36
33
  });
37
34
  var _constantsts = /*#__PURE__*/ _interop_require_wildcard(require("./constants.js"));
38
35
  var _createMatcherts = /*#__PURE__*/ _interop_require_default(require("./createMatcher.js"));
39
- var _loadConfigSyncts = /*#__PURE__*/ _interop_require_default(require("./loadConfigSync.js"));
40
36
  var _resolveFileSyncts = /*#__PURE__*/ _interop_require_default(require("./resolveFileSync.js"));
41
37
  var _toPathts = /*#__PURE__*/ _interop_require_default(require("./toPath.js"));
42
38
  var _transformDirectoryts = /*#__PURE__*/ _interop_require_default(require("./transformDirectory.js"));
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/index.ts"],"sourcesContent":["export * as constants from './constants.ts';\nexport { default as createMatcher } from './createMatcher.ts';\nexport { default as loadConfigSync } from './loadConfigSync.ts';\nexport { default as resolveFileSync } from './resolveFileSync.ts';\nexport { default as toPath } from './toPath.ts';\nexport { default as transformDirectory } from './transformDirectory.ts';\nexport { default as transformSync } from './transformSync.ts';\nexport { default as transformTypes } from './transformTypes.ts';\nexport type * from './types.ts';\n"],"names":["constants","createMatcher","loadConfigSync","resolveFileSync","toPath","transformDirectory","transformSync","transformTypes"],"mappings":";;;;;;;;;;;QAAYA;;;QACQC;eAAAA,wBAAa;;QACbC;eAAAA,yBAAc;;QACdC;eAAAA,0BAAe;;QACfC;eAAAA,iBAAM;;QACNC;eAAAA,6BAAkB;;QAClBC;eAAAA,wBAAa;;QACbC;eAAAA,yBAAc;;;mEAPP;sEACc;uEACC;wEACC;+DACT;2EACY;sEACL;uEACC"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/index.ts"],"sourcesContent":["export * as constants from './constants.ts';\nexport { default as createMatcher } from './createMatcher.ts';\nexport { default as resolveFileSync } from './resolveFileSync.ts';\nexport { default as toPath } from './toPath.ts';\nexport { default as transformDirectory } from './transformDirectory.ts';\nexport { default as transformSync } from './transformSync.ts';\nexport { default as transformTypes } from './transformTypes.ts';\nexport type * from './types.ts';\n"],"names":["constants","createMatcher","resolveFileSync","toPath","transformDirectory","transformSync","transformTypes"],"mappings":";;;;;;;;;;;QAAYA;;;QACQC;eAAAA,wBAAa;;QACbC;eAAAA,0BAAe;;QACfC;eAAAA,iBAAM;;QACNC;eAAAA,6BAAkB;;QAClBC;eAAAA,wBAAa;;QACbC;eAAAA,yBAAc;;;mEANP;sEACc;wEACE;+DACT;2EACY;sEACL;uEACC"}
@@ -9,8 +9,8 @@ Object.defineProperty(exports, "default", {
9
9
  }
10
10
  });
11
11
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
+ var _readtsconfigsync = /*#__PURE__*/ _interop_require_default(require("read-tsconfig-sync"));
12
13
  var _url = /*#__PURE__*/ _interop_require_default(require("url"));
13
- var _loadConfigSyncts = /*#__PURE__*/ _interop_require_default(require("./loadConfigSync.js"));
14
14
  var _module = /*#__PURE__*/ _interop_require_default(require("module"));
15
15
  function _define_property(obj, key, value) {
16
16
  if (key in obj) {
@@ -71,7 +71,7 @@ function transformDirectory(src, dest, type, options, callback) {
71
71
  options = null;
72
72
  }
73
73
  options = options || {};
74
- var tsconfig = options.tsconfig ? options.tsconfig : (0, _loadConfigSyncts.default)(src);
74
+ var tsconfig = options.tsconfig ? options.tsconfig : (0, _readtsconfigsync.default)(src);
75
75
  options = _object_spread({
76
76
  tsconfig: tsconfig
77
77
  }, 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 loadConfigSync from './loadConfigSync.ts';\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.js');\n\nimport Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nimport type { ConfigOptions, TargetType, TransformDirectoryCallback } from './types.ts';\n\nfunction dispatch(version: string, src: string, dest: string, type: TargetType, options: ConfigOptions, callback: TransformDirectoryCallback): undefined {\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\nexport default function transformDirectory(src: string, dest: string, type: TargetType, 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 || {}) as ConfigOptions;\n const tsconfig = options.tsconfig ? options.tsconfig : loadConfigSync(src);\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) =>\n dispatch(version, src, dest, type, options as ConfigOptions, (err, result) => {\n err ? reject(err) : resolve(result);\n })\n );\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","loadConfigSync","Promise","resolve","reject","result"],"mappings":";;;;+BAwBA;;;eAAwBA;;;2DAxBP;0DACD;uEACW;6DAOR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AAIhE,IAAMQ,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAI1F,SAASG,SAASb,OAAe,EAAEc,GAAW,EAAEC,IAAY,EAAEC,IAAgB,EAAEC,OAAsB,EAAEC,QAAoC;IAC1I,IAAIlB,YAAY,SAAS,OAAOS,SAASF,YAAYO,KAAKC,MAAMC,MAAMC,SAASC;IAC/E,IAAI;QACFA,SAAS,MAAMT,SAAS,qBAAqB;YAAET,SAAAA;YAASmB,WAAW;QAAK,GAAGZ,YAAYO,KAAKC,MAAMC,MAAMC;IAC1G,EAAE,OAAOG,KAAK;QACZF,SAASE;IACX;AACF;AAEe,SAAS1B,mBAAmBoB,GAAW,EAAEC,IAAY,EAAEC,IAAgB,EAAEC,OAAoD,EAAEC,QAAqC;IACjL,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,UAAWA,WAAW,CAAC;QACvB,IAAMK,WAAWL,QAAQK,QAAQ,GAAGL,QAAQK,QAAQ,GAAGC,IAAAA,yBAAc,EAACT;QACtEG,UAAU;YAAEK,UAAAA;WAAaL;QAEzB,IAAI,OAAOC,aAAa,YAAY,OAAOL,SAASb,SAASc,KAAKC,MAAMC,MAAMC,SAASC;QACvF,OAAO,IAAIM,QAAQ,SAACC,SAASC;mBAC3Bb,SAASb,SAASc,KAAKC,MAAMC,MAAMC,SAA0B,SAACG,KAAKO;gBACjEP,MAAMM,OAAON,OAAOK,QAAQE;YAC9B;;IAEJ,EAAE,OAAOP,KAAK;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOI,QAAQE,MAAM,CAACN;IAC7B;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformDirectory.ts"],"sourcesContent":["import path from 'path';\nimport loadConfigSync from 'read-tsconfig-sync';\nimport url from 'url';\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.js');\n\nimport Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nimport type { ConfigOptions, TargetType, TransformDirectoryCallback } from './types.ts';\n\nfunction dispatch(version: string, src: string, dest: string, type: TargetType, options: ConfigOptions, callback: TransformDirectoryCallback): undefined {\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\nexport default function transformDirectory(src: string, dest: string, type: TargetType, 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 || {}) as ConfigOptions;\n const tsconfig = options.tsconfig ? options.tsconfig : loadConfigSync(src);\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) =>\n dispatch(version, src, dest, type, options as ConfigOptions, (err, result) => {\n err ? reject(err) : resolve(result);\n })\n );\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","loadConfigSync","Promise","resolve","reject","result"],"mappings":";;;;+BAwBA;;;eAAwBA;;;2DAxBP;uEACU;0DACX;6DAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AAIhE,IAAMQ,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAI1F,SAASG,SAASb,OAAe,EAAEc,GAAW,EAAEC,IAAY,EAAEC,IAAgB,EAAEC,OAAsB,EAAEC,QAAoC;IAC1I,IAAIlB,YAAY,SAAS,OAAOS,SAASF,YAAYO,KAAKC,MAAMC,MAAMC,SAASC;IAC/E,IAAI;QACFA,SAAS,MAAMT,SAAS,qBAAqB;YAAET,SAAAA;YAASmB,WAAW;QAAK,GAAGZ,YAAYO,KAAKC,MAAMC,MAAMC;IAC1G,EAAE,OAAOG,KAAK;QACZF,SAASE;IACX;AACF;AAEe,SAAS1B,mBAAmBoB,GAAW,EAAEC,IAAY,EAAEC,IAAgB,EAAEC,OAAoD,EAAEC,QAAqC;IACjL,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,UAAWA,WAAW,CAAC;QACvB,IAAMK,WAAWL,QAAQK,QAAQ,GAAGL,QAAQK,QAAQ,GAAGC,IAAAA,yBAAc,EAACT;QACtEG,UAAU;YAAEK,UAAAA;WAAaL;QAEzB,IAAI,OAAOC,aAAa,YAAY,OAAOL,SAASb,SAASc,KAAKC,MAAMC,MAAMC,SAASC;QACvF,OAAO,IAAIM,QAAQ,SAACC,SAASC;mBAC3Bb,SAASb,SAASc,KAAKC,MAAMC,MAAMC,SAA0B,SAACG,KAAKO;gBACjEP,MAAMM,OAAON,OAAOK,QAAQE;YAC9B;;IAEJ,EAAE,OAAOP,KAAK;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOI,QAAQE,MAAM,CAACN;IAC7B;AACF"}
@@ -9,8 +9,8 @@ Object.defineProperty(exports, "default", {
9
9
  }
10
10
  });
11
11
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
+ var _readtsconfigsync = /*#__PURE__*/ _interop_require_default(require("read-tsconfig-sync"));
12
13
  var _url = /*#__PURE__*/ _interop_require_default(require("url"));
13
- var _loadConfigSyncts = /*#__PURE__*/ _interop_require_default(require("./loadConfigSync.js"));
14
14
  var _module = /*#__PURE__*/ _interop_require_default(require("module"));
15
15
  function _interop_require_default(obj) {
16
16
  return obj && obj.__esModule ? obj : {
@@ -29,7 +29,7 @@ function dispatch(version, contents, fileName, tsconfig) {
29
29
  function transformSync(contents, fileName, tsconfig) {
30
30
  if (typeof contents !== 'string') throw new Error('transformTypes: unexpected contents');
31
31
  if (typeof fileName !== 'string') throw new Error('transformTypes: unexpected fileName');
32
- if (!tsconfig) tsconfig = (0, _loadConfigSyncts.default)(process.cwd());
32
+ if (!tsconfig) tsconfig = (0, _readtsconfigsync.default)(process.cwd());
33
33
  return dispatch(version, contents, fileName, tsconfig);
34
34
  }
35
35
  /* 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/transformSync.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport loadConfigSync from './loadConfigSync.ts';\n\nimport type { TSConfig } from './types.ts';\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.js');\n\nimport Module from 'module';\n\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';\nexport default function transformSync(contents: string, fileName: string, tsconfig?: TSConfig): 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 = loadConfigSync(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","loadConfigSync","cwd"],"mappings":";;;;+BAqBA;;;eAAwBA;;;2DArBP;0DACD;uEACW;6DASR;;;;;;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;AAIhE,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;AAGe,SAAStB,cAAcoB,QAAgB,EAAEC,QAAgB,EAAEC,QAAmB;IAC3F,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAIG,MAAM;IAClD,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAIE,MAAM;IAClD,IAAI,CAACD,UAAUA,WAAWE,IAAAA,yBAAc,EAACtB,QAAQuB,GAAG;IACpD,OAAON,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 loadConfigSync from 'read-tsconfig-sync';\nimport url from 'url';\n\nimport type { TSConfig } from './types.ts';\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.js');\n\nimport Module from 'module';\n\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';\nexport default function transformSync(contents: string, fileName: string, tsconfig?: TSConfig): 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 = loadConfigSync(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","loadConfigSync","cwd"],"mappings":";;;;+BAqBA;;;eAAwBA;;;2DArBP;uEACU;0DACX;6DASG;;;;;;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;AAIhE,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;AAGe,SAAStB,cAAcoB,QAAgB,EAAEC,QAAgB,EAAEC,QAAmB;IAC3F,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAIG,MAAM;IAClD,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAIE,MAAM;IAClD,IAAI,CAACD,UAAUA,WAAWE,IAAAA,yBAAc,EAACtB,QAAQuB,GAAG;IACpD,OAAON,SAASb,SAASc,UAAUC,UAAUC;AAC/C"}
@@ -9,8 +9,8 @@ Object.defineProperty(exports, "default", {
9
9
  }
10
10
  });
11
11
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
+ var _readtsconfigsync = /*#__PURE__*/ _interop_require_default(require("read-tsconfig-sync"));
12
13
  var _url = /*#__PURE__*/ _interop_require_default(require("url"));
13
- var _loadConfigSyncts = /*#__PURE__*/ _interop_require_default(require("./loadConfigSync.js"));
14
14
  var _module = /*#__PURE__*/ _interop_require_default(require("module"));
15
15
  function _define_property(obj, key, value) {
16
16
  if (key in obj) {
@@ -70,7 +70,7 @@ function transformTypes(src, dest, options, callback) {
70
70
  options = null;
71
71
  }
72
72
  options = options || {};
73
- var tsconfig = options.tsconfig ? options.tsconfig : (0, _loadConfigSyncts.default)(src);
73
+ var tsconfig = options.tsconfig ? options.tsconfig : (0, _readtsconfigsync.default)(src);
74
74
  options = _object_spread({
75
75
  tsconfig: tsconfig
76
76
  }, 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 loadConfigSync from './loadConfigSync.ts';\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.js');\n\nimport Module from 'module';\n\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.ts';\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 || {}) as ConfigOptions;\n const tsconfig = options.tsconfig ? options.tsconfig : loadConfigSync(src);\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","loadConfigSync","Promise","resolve","reject","result"],"mappings":";;;;+BAuBA;;;eAAwBA;;;2DAvBP;0DACD;uEACW;6DAOR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AAIhE,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;AAGe,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,UAAWA,WAAW,CAAC;QACvB,IAAMK,WAAWL,QAAQK,QAAQ,GAAGL,QAAQK,QAAQ,GAAGC,IAAAA,yBAAc,EAACR;QACtEE,UAAU;YAAEK,UAAAA;WAAaL;QAEzB,IAAI,OAAOC,aAAa,YAAY,OAAOJ,SAASb,SAASc,KAAKC,MAAMC,SAASC;QACjF,OAAO,IAAIM,QAAQ,SAACC,SAASC;mBAAWZ,SAASb,SAASc,KAAKC,MAAMC,SAAS,SAACG,KAAKO;uBAAYP,MAAMM,OAAON,OAAOK,QAAQE;;;IAC9H,EAAE,OAAOP,KAAK;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOI,QAAQE,MAAM,CAACN;IAC7B;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformTypes.ts"],"sourcesContent":["import path from 'path';\nimport loadConfigSync from 'read-tsconfig-sync';\nimport url from 'url';\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.js');\n\nimport Module from 'module';\n\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.ts';\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 || {}) as ConfigOptions;\n const tsconfig = options.tsconfig ? options.tsconfig : loadConfigSync(src);\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","loadConfigSync","Promise","resolve","reject","result"],"mappings":";;;;+BAuBA;;;eAAwBA;;;2DAvBP;uEACU;0DACX;6DAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AAIhE,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;AAGe,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,UAAWA,WAAW,CAAC;QACvB,IAAMK,WAAWL,QAAQK,QAAQ,GAAGL,QAAQK,QAAQ,GAAGC,IAAAA,yBAAc,EAACR;QACtEE,UAAU;YAAEK,UAAAA;WAAaL;QAEzB,IAAI,OAAOC,aAAa,YAAY,OAAOJ,SAASb,SAASc,KAAKC,MAAMC,SAASC;QACjF,OAAO,IAAIM,QAAQ,SAACC,SAASC;mBAAWZ,SAASb,SAASc,KAAKC,MAAMC,SAAS,SAACG,KAAKO;uBAAYP,MAAMM,OAAON,OAAOK,QAAQE;;;IAC9H,EAAE,OAAOP,KAAK;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOI,QAAQE,MAAM,CAACN;IAC7B;AACF"}
@@ -1,13 +1,9 @@
1
- import type * as TSConfigSchema from './TSConfigSchema.ts';
1
+ import type { TSConfig } from 'read-tsconfig-sync';
2
2
  export interface Context {
3
3
  parentURL?: string;
4
4
  parentPath?: string;
5
5
  }
6
- export * as TSConfigSchema from './TSConfigSchema.ts';
7
- export interface TSConfig {
8
- path: string;
9
- config: TSConfigSchema.TSConfigData;
10
- }
6
+ export type { TSConfig, TSConfigSchema } from 'read-tsconfig-sync';
11
7
  export interface ConfigOptions {
12
8
  tsconfig?: TSConfig;
13
9
  cwd?: string;
@@ -1,13 +1,9 @@
1
- import type * as TSConfigSchema from './TSConfigSchema.ts';
1
+ import type { TSConfig } from 'read-tsconfig-sync';
2
2
  export interface Context {
3
3
  parentURL?: string;
4
4
  parentPath?: string;
5
5
  }
6
- export * as TSConfigSchema from './TSConfigSchema.ts';
7
- export interface TSConfig {
8
- path: string;
9
- config: TSConfigSchema.TSConfigData;
10
- }
6
+ export type { TSConfig, TSConfigSchema } from 'read-tsconfig-sync';
11
7
  export interface ConfigOptions {
12
8
  tsconfig?: TSConfig;
13
9
  cwd?: string;
package/dist/cjs/types.js CHANGED
@@ -2,52 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "TSConfigSchema", {
6
- enumerable: true,
7
- get: function() {
8
- return _TSConfigSchemats;
9
- }
10
- });
11
- var _TSConfigSchemats = /*#__PURE__*/ _interop_require_wildcard(require("./TSConfigSchema.js"));
12
- function _getRequireWildcardCache(nodeInterop) {
13
- if (typeof WeakMap !== "function") return null;
14
- var cacheBabelInterop = new WeakMap();
15
- var cacheNodeInterop = new WeakMap();
16
- return (_getRequireWildcardCache = function(nodeInterop) {
17
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
18
- })(nodeInterop);
19
- }
20
- function _interop_require_wildcard(obj, nodeInterop) {
21
- if (!nodeInterop && obj && obj.__esModule) {
22
- return obj;
23
- }
24
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
25
- return {
26
- default: obj
27
- };
28
- }
29
- var cache = _getRequireWildcardCache(nodeInterop);
30
- if (cache && cache.has(obj)) {
31
- return cache.get(obj);
32
- }
33
- var newObj = {
34
- __proto__: null
35
- };
36
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
37
- for(var key in obj){
38
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
39
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
40
- if (desc && (desc.get || desc.set)) {
41
- Object.defineProperty(newObj, key, desc);
42
- } else {
43
- newObj[key] = obj[key];
44
- }
45
- }
46
- }
47
- newObj.default = obj;
48
- if (cache) {
49
- cache.set(obj, newObj);
50
- }
51
- return newObj;
52
- }
53
5
  /* 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/types.ts"],"sourcesContent":["import type * as TSConfigSchema from './TSConfigSchema.ts';\n\nexport interface Context {\n parentURL?: string;\n parentPath?: string;\n}\n\nexport * as TSConfigSchema from './TSConfigSchema.ts';\nexport interface TSConfig {\n path: string;\n config: TSConfigSchema.TSConfigData;\n}\n\nexport interface ConfigOptions {\n tsconfig?: TSConfig;\n cwd?: string;\n sourceMaps?: boolean;\n}\n\nexport type TransformDirectoryCallback = (err?: Error, filePaths?: string[]) => void;\nexport type TransformFileCallback = (err?: Error, destFilePath?: string) => void;\nexport type TransformTypesCallback = (err?: Error, filePaths?: string[]) => void;\n\nexport type Matcher = (filePath: string) => boolean;\n\nexport type TargetType = 'cjs' | 'esm';\n"],"names":["TSConfigSchema"],"mappings":";;;;+BAOYA;;;;;;wEAAoB"}
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -1,6 +1,5 @@
1
1
  export * as constants from './constants.ts';
2
2
  export { default as createMatcher } from './createMatcher.ts';
3
- export { default as loadConfigSync } from './loadConfigSync.ts';
4
3
  export { default as resolveFileSync } from './resolveFileSync.ts';
5
4
  export { default as toPath } from './toPath.ts';
6
5
  export { default as transformDirectory } from './transformDirectory.ts';
package/dist/esm/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  export * as constants from './constants.js';
2
2
  export { default as createMatcher } from './createMatcher.js';
3
- export { default as loadConfigSync } from './loadConfigSync.js';
4
3
  export { default as resolveFileSync } from './resolveFileSync.js';
5
4
  export { default as toPath } from './toPath.js';
6
5
  export { default as transformDirectory } from './transformDirectory.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/index.ts"],"sourcesContent":["export * as constants from './constants.ts';\nexport { default as createMatcher } from './createMatcher.ts';\nexport { default as loadConfigSync } from './loadConfigSync.ts';\nexport { default as resolveFileSync } from './resolveFileSync.ts';\nexport { default as toPath } from './toPath.ts';\nexport { default as transformDirectory } from './transformDirectory.ts';\nexport { default as transformSync } from './transformSync.ts';\nexport { default as transformTypes } from './transformTypes.ts';\nexport type * from './types.ts';\n"],"names":["constants","default","createMatcher","loadConfigSync","resolveFileSync","toPath","transformDirectory","transformSync","transformTypes"],"mappings":"AAAA,OAAO,KAAKA,SAAS,MAAM,iBAAiB;AAC5C,SAASC,WAAWC,aAAa,QAAQ,qBAAqB;AAC9D,SAASD,WAAWE,cAAc,QAAQ,sBAAsB;AAChE,SAASF,WAAWG,eAAe,QAAQ,uBAAuB;AAClE,SAASH,WAAWI,MAAM,QAAQ,cAAc;AAChD,SAASJ,WAAWK,kBAAkB,QAAQ,0BAA0B;AACxE,SAASL,WAAWM,aAAa,QAAQ,qBAAqB;AAC9D,SAASN,WAAWO,cAAc,QAAQ,sBAAsB"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/index.ts"],"sourcesContent":["export * as constants from './constants.ts';\nexport { default as createMatcher } from './createMatcher.ts';\nexport { default as resolveFileSync } from './resolveFileSync.ts';\nexport { default as toPath } from './toPath.ts';\nexport { default as transformDirectory } from './transformDirectory.ts';\nexport { default as transformSync } from './transformSync.ts';\nexport { default as transformTypes } from './transformTypes.ts';\nexport type * from './types.ts';\n"],"names":["constants","default","createMatcher","resolveFileSync","toPath","transformDirectory","transformSync","transformTypes"],"mappings":"AAAA,OAAO,KAAKA,SAAS,MAAM,iBAAiB;AAC5C,SAASC,WAAWC,aAAa,QAAQ,qBAAqB;AAC9D,SAASD,WAAWE,eAAe,QAAQ,uBAAuB;AAClE,SAASF,WAAWG,MAAM,QAAQ,cAAc;AAChD,SAASH,WAAWI,kBAAkB,QAAQ,0BAA0B;AACxE,SAASJ,WAAWK,aAAa,QAAQ,qBAAqB;AAC9D,SAASL,WAAWM,cAAc,QAAQ,sBAAsB"}
@@ -1,6 +1,6 @@
1
1
  import path from 'path';
2
+ import loadConfigSync from 'read-tsconfig-sync';
2
3
  import url from 'url';
3
- import loadConfigSync from './loadConfigSync.js';
4
4
  const major = +process.versions.node.split('.')[0];
5
5
  const version = major < 14 ? 'stable' : 'local';
6
6
  const __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);
@@ -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 loadConfigSync from './loadConfigSync.ts';\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.js');\n\nimport Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nimport type { ConfigOptions, TargetType, TransformDirectoryCallback } from './types.ts';\n\nfunction dispatch(version: string, src: string, dest: string, type: TargetType, options: ConfigOptions, callback: TransformDirectoryCallback): undefined {\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\nexport default function transformDirectory(src: string, dest: string, type: TargetType, 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 || {}) as ConfigOptions;\n const tsconfig = options.tsconfig ? options.tsconfig : loadConfigSync(src);\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) =>\n dispatch(version, src, dest, type, options as ConfigOptions, (err, result) => {\n err ? reject(err) : resolve(result);\n })\n );\n } catch (err) {\n if (callback) callback(err);\n else return Promise.reject(err);\n }\n}\n"],"names":["path","url","loadConfigSync","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","Promise","resolve","reject","result"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,OAAOC,oBAAoB,sBAAsB;AAEjD,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;AAE5B,MAAMC,WAAW,OAAOC,YAAY,cAAcF,OAAOG,aAAa,CAAC,YAAYjB,GAAG,IAAIgB;AAI1F,SAASE,SAASX,OAAe,EAAEY,GAAW,EAAEC,IAAY,EAAEC,IAAgB,EAAEC,OAAsB,EAAEC,QAAoC;IAC1I,IAAIhB,YAAY,SAAS,OAAOQ,SAASH,YAAYO,KAAKC,MAAMC,MAAMC,SAASC;IAC/E,IAAI;QACFA,SAAS,MAAMR,SAAS,qBAAqB;YAAER;YAASiB,WAAW;QAAK,GAAGZ,YAAYO,KAAKC,MAAMC,MAAMC;IAC1G,EAAE,OAAOG,KAAK;QACZF,SAASE;IACX;AACF;AAEA,eAAe,SAASC,mBAAmBP,GAAW,EAAEC,IAAY,EAAEC,IAAgB,EAAEC,OAAoD,EAAEC,QAAqC;IACjL,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,UAAWA,WAAW,CAAC;QACvB,MAAMM,WAAWN,QAAQM,QAAQ,GAAGN,QAAQM,QAAQ,GAAG3B,eAAekB;QACtEG,UAAU;YAAEM;YAAU,GAAGN,OAAO;QAAC;QAEjC,IAAI,OAAOC,aAAa,YAAY,OAAOL,SAASX,SAASY,KAAKC,MAAMC,MAAMC,SAASC;QACvF,OAAO,IAAIM,QAAQ,CAACC,SAASC,SAC3Bb,SAASX,SAASY,KAAKC,MAAMC,MAAMC,SAA0B,CAACG,KAAKO;gBACjEP,MAAMM,OAAON,OAAOK,QAAQE;YAC9B;IAEJ,EAAE,OAAOP,KAAK;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOI,QAAQE,MAAM,CAACN;IAC7B;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformDirectory.ts"],"sourcesContent":["import path from 'path';\nimport loadConfigSync from 'read-tsconfig-sync';\nimport url from 'url';\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.js');\n\nimport Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nimport type { ConfigOptions, TargetType, TransformDirectoryCallback } from './types.ts';\n\nfunction dispatch(version: string, src: string, dest: string, type: TargetType, options: ConfigOptions, callback: TransformDirectoryCallback): undefined {\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\nexport default function transformDirectory(src: string, dest: string, type: TargetType, 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 || {}) as ConfigOptions;\n const tsconfig = options.tsconfig ? options.tsconfig : loadConfigSync(src);\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) =>\n dispatch(version, src, dest, type, options as ConfigOptions, (err, result) => {\n err ? reject(err) : resolve(result);\n })\n );\n } catch (err) {\n if (callback) callback(err);\n else return Promise.reject(err);\n }\n}\n"],"names":["path","loadConfigSync","url","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","Promise","resolve","reject","result"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,oBAAoB,qBAAqB;AAChD,OAAOC,SAAS,MAAM;AAEtB,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,cAAcT,IAAIU,aAAa,CAAC,YAAYV,GAAG,IAAIS;AACxG,MAAME,aAAab,KAAKc,IAAI,CAACL,WAAW,MAAM,OAAO,WAAW;AAEhE,OAAOM,YAAY,SAAS;AAE5B,MAAMC,WAAW,OAAOC,YAAY,cAAcF,OAAOG,aAAa,CAAC,YAAYhB,GAAG,IAAIe;AAI1F,SAASE,SAASX,OAAe,EAAEY,GAAW,EAAEC,IAAY,EAAEC,IAAgB,EAAEC,OAAsB,EAAEC,QAAoC;IAC1I,IAAIhB,YAAY,SAAS,OAAOQ,SAASH,YAAYO,KAAKC,MAAMC,MAAMC,SAASC;IAC/E,IAAI;QACFA,SAAS,MAAMR,SAAS,qBAAqB;YAAER;YAASiB,WAAW;QAAK,GAAGZ,YAAYO,KAAKC,MAAMC,MAAMC;IAC1G,EAAE,OAAOG,KAAK;QACZF,SAASE;IACX;AACF;AAEA,eAAe,SAASC,mBAAmBP,GAAW,EAAEC,IAAY,EAAEC,IAAgB,EAAEC,OAAoD,EAAEC,QAAqC;IACjL,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,UAAWA,WAAW,CAAC;QACvB,MAAMM,WAAWN,QAAQM,QAAQ,GAAGN,QAAQM,QAAQ,GAAG5B,eAAemB;QACtEG,UAAU;YAAEM;YAAU,GAAGN,OAAO;QAAC;QAEjC,IAAI,OAAOC,aAAa,YAAY,OAAOL,SAASX,SAASY,KAAKC,MAAMC,MAAMC,SAASC;QACvF,OAAO,IAAIM,QAAQ,CAACC,SAASC,SAC3Bb,SAASX,SAASY,KAAKC,MAAMC,MAAMC,SAA0B,CAACG,KAAKO;gBACjEP,MAAMM,OAAON,OAAOK,QAAQE;YAC9B;IAEJ,EAAE,OAAOP,KAAK;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOI,QAAQE,MAAM,CAACN;IAC7B;AACF"}
@@ -1,6 +1,6 @@
1
1
  import path from 'path';
2
+ import loadConfigSync from 'read-tsconfig-sync';
2
3
  import url from 'url';
3
- import loadConfigSync from './loadConfigSync.js';
4
4
  const major = +process.versions.node.split('.')[0];
5
5
  const version = major < 14 ? 'stable' : 'local';
6
6
  const __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);
@@ -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 loadConfigSync from './loadConfigSync.ts';\n\nimport type { TSConfig } from './types.ts';\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.js');\n\nimport Module from 'module';\n\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';\nexport default function transformSync(contents: string, fileName: string, tsconfig?: TSConfig): 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 = loadConfigSync(process.cwd());\n return dispatch(version, contents, fileName, tsconfig);\n}\n"],"names":["path","url","loadConfigSync","major","process","versions","node","split","version","__dirname","dirname","__filename","fileURLToPath","workerPath","join","Module","_require","require","createRequire","dispatch","contents","fileName","tsconfig","transformSync","Error","cwd"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,OAAOC,oBAAoB,sBAAsB;AAIjD,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;AAE5B,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;AAGA,eAAe,SAASC,cAAcH,QAAgB,EAAEC,QAAgB,EAAEC,QAAmB;IAC3F,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAII,MAAM;IAClD,IAAI,OAAOH,aAAa,UAAU,MAAM,IAAIG,MAAM;IAClD,IAAI,CAACF,UAAUA,WAAWpB,eAAeE,QAAQqB,GAAG;IACpD,OAAON,SAASX,SAASY,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 loadConfigSync from 'read-tsconfig-sync';\nimport url from 'url';\n\nimport type { TSConfig } from './types.ts';\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.js');\n\nimport Module from 'module';\n\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';\nexport default function transformSync(contents: string, fileName: string, tsconfig?: TSConfig): 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 = loadConfigSync(process.cwd());\n return dispatch(version, contents, fileName, tsconfig);\n}\n"],"names":["path","loadConfigSync","url","major","process","versions","node","split","version","__dirname","dirname","__filename","fileURLToPath","workerPath","join","Module","_require","require","createRequire","dispatch","contents","fileName","tsconfig","transformSync","Error","cwd"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,oBAAoB,qBAAqB;AAChD,OAAOC,SAAS,MAAM;AAItB,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,cAAcT,IAAIU,aAAa,CAAC,YAAYV,GAAG,IAAIS;AACxG,MAAME,aAAab,KAAKc,IAAI,CAACL,WAAW,MAAM,OAAO,WAAW;AAEhE,OAAOM,YAAY,SAAS;AAE5B,MAAMC,WAAW,OAAOC,YAAY,cAAcF,OAAOG,aAAa,CAAC,YAAYhB,GAAG,IAAIe;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;AAGA,eAAe,SAASC,cAAcH,QAAgB,EAAEC,QAAgB,EAAEC,QAAmB;IAC3F,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAII,MAAM;IAClD,IAAI,OAAOH,aAAa,UAAU,MAAM,IAAIG,MAAM;IAClD,IAAI,CAACF,UAAUA,WAAWrB,eAAeG,QAAQqB,GAAG;IACpD,OAAON,SAASX,SAASY,UAAUC,UAAUC;AAC/C"}
@@ -1,6 +1,6 @@
1
1
  import path from 'path';
2
+ import loadConfigSync from 'read-tsconfig-sync';
2
3
  import url from 'url';
3
- import loadConfigSync from './loadConfigSync.js';
4
4
  const major = +process.versions.node.split('.')[0];
5
5
  const version = major < 14 ? 'stable' : 'local';
6
6
  const __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);
@@ -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 loadConfigSync from './loadConfigSync.ts';\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.js');\n\nimport Module from 'module';\n\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.ts';\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 || {}) as ConfigOptions;\n const tsconfig = options.tsconfig ? options.tsconfig : loadConfigSync(src);\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","loadConfigSync","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","Promise","resolve","reject","result"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,OAAOC,oBAAoB,sBAAsB;AAEjD,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;AAE5B,MAAMC,WAAW,OAAOC,YAAY,cAAcF,OAAOG,aAAa,CAAC,YAAYjB,GAAG,IAAIgB;AAE1F,SAASE,SAASX,OAAO,EAAEY,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACrD,IAAIf,YAAY,SAAS,OAAOQ,SAASH,YAAYO,KAAKC,MAAMC,SAASC;IACzE,IAAI;QACFA,SAAS,MAAMP,SAAS,qBAAqB;YAAER;YAASgB,WAAW;QAAK,GAAGX,YAAYO,KAAKC,MAAMC;IACpG,EAAE,OAAOG,KAAK;QACZF,SAASE;IACX;AACF;AAGA,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,UAAWA,WAAW,CAAC;QACvB,MAAMM,WAAWN,QAAQM,QAAQ,GAAGN,QAAQM,QAAQ,GAAG1B,eAAekB;QACtEE,UAAU;YAAEM;YAAU,GAAGN,OAAO;QAAC;QAEjC,IAAI,OAAOC,aAAa,YAAY,OAAOJ,SAASX,SAASY,KAAKC,MAAMC,SAASC;QACjF,OAAO,IAAIM,QAAQ,CAACC,SAASC,SAAWZ,SAASX,SAASY,KAAKC,MAAMC,SAAS,CAACG,KAAKO,SAAYP,MAAMM,OAAON,OAAOK,QAAQE;IAC9H,EAAE,OAAOP,KAAK;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOI,QAAQE,MAAM,CAACN;IAC7B;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformTypes.ts"],"sourcesContent":["import path from 'path';\nimport loadConfigSync from 'read-tsconfig-sync';\nimport url from 'url';\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.js');\n\nimport Module from 'module';\n\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.ts';\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 || {}) as ConfigOptions;\n const tsconfig = options.tsconfig ? options.tsconfig : loadConfigSync(src);\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","loadConfigSync","url","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","Promise","resolve","reject","result"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,oBAAoB,qBAAqB;AAChD,OAAOC,SAAS,MAAM;AAEtB,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,cAAcT,IAAIU,aAAa,CAAC,YAAYV,GAAG,IAAIS;AACxG,MAAME,aAAab,KAAKc,IAAI,CAACL,WAAW,MAAM,OAAO,WAAW;AAEhE,OAAOM,YAAY,SAAS;AAE5B,MAAMC,WAAW,OAAOC,YAAY,cAAcF,OAAOG,aAAa,CAAC,YAAYhB,GAAG,IAAIe;AAE1F,SAASE,SAASX,OAAO,EAAEY,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACrD,IAAIf,YAAY,SAAS,OAAOQ,SAASH,YAAYO,KAAKC,MAAMC,SAASC;IACzE,IAAI;QACFA,SAAS,MAAMP,SAAS,qBAAqB;YAAER;YAASgB,WAAW;QAAK,GAAGX,YAAYO,KAAKC,MAAMC;IACpG,EAAE,OAAOG,KAAK;QACZF,SAASE;IACX;AACF;AAGA,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,UAAWA,WAAW,CAAC;QACvB,MAAMM,WAAWN,QAAQM,QAAQ,GAAGN,QAAQM,QAAQ,GAAG3B,eAAemB;QACtEE,UAAU;YAAEM;YAAU,GAAGN,OAAO;QAAC;QAEjC,IAAI,OAAOC,aAAa,YAAY,OAAOJ,SAASX,SAASY,KAAKC,MAAMC,SAASC;QACjF,OAAO,IAAIM,QAAQ,CAACC,SAASC,SAAWZ,SAASX,SAASY,KAAKC,MAAMC,SAAS,CAACG,KAAKO,SAAYP,MAAMM,OAAON,OAAOK,QAAQE;IAC9H,EAAE,OAAOP,KAAK;QACZ,IAAIF,UAAUA,SAASE;aAClB,OAAOI,QAAQE,MAAM,CAACN;IAC7B;AACF"}
@@ -1,13 +1,9 @@
1
- import type * as TSConfigSchema from './TSConfigSchema.ts';
1
+ import type { TSConfig } from 'read-tsconfig-sync';
2
2
  export interface Context {
3
3
  parentURL?: string;
4
4
  parentPath?: string;
5
5
  }
6
- export * as TSConfigSchema from './TSConfigSchema.ts';
7
- export interface TSConfig {
8
- path: string;
9
- config: TSConfigSchema.TSConfigData;
10
- }
6
+ export type { TSConfig, TSConfigSchema } from 'read-tsconfig-sync';
11
7
  export interface ConfigOptions {
12
8
  tsconfig?: TSConfig;
13
9
  cwd?: string;
package/dist/esm/types.js CHANGED
@@ -1 +1 @@
1
- export * as TSConfigSchema from './TSConfigSchema.js';
1
+ export { };
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/types.ts"],"sourcesContent":["import type * as TSConfigSchema from './TSConfigSchema.ts';\n\nexport interface Context {\n parentURL?: string;\n parentPath?: string;\n}\n\nexport * as TSConfigSchema from './TSConfigSchema.ts';\nexport interface TSConfig {\n path: string;\n config: TSConfigSchema.TSConfigData;\n}\n\nexport interface ConfigOptions {\n tsconfig?: TSConfig;\n cwd?: string;\n sourceMaps?: boolean;\n}\n\nexport type TransformDirectoryCallback = (err?: Error, filePaths?: string[]) => void;\nexport type TransformFileCallback = (err?: Error, destFilePath?: string) => void;\nexport type TransformTypesCallback = (err?: Error, filePaths?: string[]) => void;\n\nexport type Matcher = (filePath: string) => boolean;\n\nexport type TargetType = 'cjs' | 'esm';\n"],"names":["TSConfigSchema"],"mappings":"AAOA,OAAO,KAAKA,cAAc,MAAM,sBAAsB"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/types.ts"],"sourcesContent":["import type { TSConfig } from 'read-tsconfig-sync';\n\nexport interface Context {\n parentURL?: string;\n parentPath?: string;\n}\n\nexport type { TSConfig, TSConfigSchema } from 'read-tsconfig-sync';\nexport interface ConfigOptions {\n tsconfig?: TSConfig;\n cwd?: string;\n sourceMaps?: boolean;\n}\n\nexport type TransformDirectoryCallback = (err?: Error, filePaths?: string[]) => void;\nexport type TransformFileCallback = (err?: Error, destFilePath?: string) => void;\nexport type TransformTypesCallback = (err?: Error, filePaths?: string[]) => void;\n\nexport type Matcher = (filePath: string) => boolean;\n\nexport type TargetType = 'cjs' | 'esm';\n"],"names":[],"mappings":"AAoBA,WAAuC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-swc-transform",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Typescript transformers for swc. Supports Node >= 0.8",
5
5
  "keywords": [
6
6
  "matcher",
@@ -47,7 +47,6 @@
47
47
  "core-js-pure": "*",
48
48
  "exit": "^0.1.2",
49
49
  "fs-iterator": "^6.0.5",
50
- "get-tsconfig-compat": "^2.0.3",
51
50
  "install-optional": "^0.1.76",
52
51
  "is-absolute": "^1.0.0",
53
52
  "lodash.find": "^4.6.0",
@@ -56,6 +55,7 @@
56
55
  "node-version-call": "^1.8.5",
57
56
  "path-posix": "^1.0.0",
58
57
  "queue-cb": "^1.5.5",
58
+ "read-tsconfig-sync": "^0.1.0",
59
59
  "resolve": "^1.22.10",
60
60
  "rimraf2": "^2.8.2",
61
61
  "ts-node": "*",