ts-swc-transform 2.3.0 → 2.4.1

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 (49) hide show
  1. package/dist/cjs/createMatcher.js +2 -2
  2. package/dist/cjs/createMatcher.js.map +1 -1
  3. package/dist/cjs/index.d.cts +0 -1
  4. package/dist/cjs/index.d.ts +0 -1
  5. package/dist/cjs/index.js +0 -4
  6. package/dist/cjs/index.js.map +1 -1
  7. package/dist/cjs/toPath.js +1 -1
  8. package/dist/cjs/toPath.js.map +1 -1
  9. package/dist/cjs/transformDirectory.js +2 -2
  10. package/dist/cjs/transformDirectory.js.map +1 -1
  11. package/dist/cjs/transformSync.js +2 -2
  12. package/dist/cjs/transformSync.js.map +1 -1
  13. package/dist/cjs/transformTypes.js +2 -2
  14. package/dist/cjs/transformTypes.js.map +1 -1
  15. package/dist/cjs/types.d.cts +2 -6
  16. package/dist/cjs/types.d.ts +2 -6
  17. package/dist/cjs/types.js +0 -48
  18. package/dist/cjs/types.js.map +1 -1
  19. package/dist/esm/createMatcher.js +2 -2
  20. package/dist/esm/createMatcher.js.map +1 -1
  21. package/dist/esm/index.d.ts +0 -1
  22. package/dist/esm/index.js +0 -1
  23. package/dist/esm/index.js.map +1 -1
  24. package/dist/esm/toPath.js +1 -1
  25. package/dist/esm/toPath.js.map +1 -1
  26. package/dist/esm/transformDirectory.js +1 -1
  27. package/dist/esm/transformDirectory.js.map +1 -1
  28. package/dist/esm/transformSync.js +1 -1
  29. package/dist/esm/transformSync.js.map +1 -1
  30. package/dist/esm/transformTypes.js +1 -1
  31. package/dist/esm/transformTypes.js.map +1 -1
  32. package/dist/esm/types.d.ts +2 -6
  33. package/dist/esm/types.js +1 -1
  34. package/dist/esm/types.js.map +1 -1
  35. package/package.json +4 -3
  36. package/dist/cjs/TSConfigSchema.d.cts +0 -3261
  37. package/dist/cjs/TSConfigSchema.d.ts +0 -3261
  38. package/dist/cjs/TSConfigSchema.js +0 -7
  39. package/dist/cjs/TSConfigSchema.js.map +0 -1
  40. package/dist/cjs/loadConfigSync.d.cts +0 -2
  41. package/dist/cjs/loadConfigSync.d.ts +0 -2
  42. package/dist/cjs/loadConfigSync.js +0 -15
  43. package/dist/cjs/loadConfigSync.js.map +0 -1
  44. package/dist/esm/TSConfigSchema.d.ts +0 -3261
  45. package/dist/esm/TSConfigSchema.js +0 -3
  46. package/dist/esm/TSConfigSchema.js.map +0 -1
  47. package/dist/esm/loadConfigSync.d.ts +0 -2
  48. package/dist/esm/loadConfigSync.js +0 -4
  49. package/dist/esm/loadConfigSync.js.map +0 -1
@@ -20,9 +20,9 @@ function createMatcher(tsconfig) {
20
20
  var tsconfigPath = _pathposix.default.dirname((0, _unixify.default)(tsconfig.path));
21
21
  function matchFn(condition) {
22
22
  var pattern = (0, _unixify.default)(condition);
23
- if (!_pathposix.default.isAbsolute(pattern) && !pattern.startsWith('*')) pattern = _pathposix.default.join(tsconfigPath, pattern);
23
+ if (!_pathposix.default.isAbsolute(pattern) && pattern.indexOf('*') !== 0) pattern = _pathposix.default.join(tsconfigPath, pattern);
24
24
  return function match(filePath) {
25
- return filePath.startsWith(pattern) || (0, _minimatch.default)(filePath, pattern);
25
+ return filePath.indexOf(pattern) === 0 || (0, _minimatch.default)(filePath, pattern);
26
26
  };
27
27
  }
28
28
  var includes = (tsconfig.config.include || []).map(matchFn);
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/createMatcher.ts"],"sourcesContent":["import minimatch from 'minimatch';\nimport path from 'path-posix';\nimport unixify from 'unixify';\nimport type { Matcher, TSConfig } from './types.ts';\n\nexport default function createMatcher(tsconfig: TSConfig): Matcher {\n const tsconfigPath = path.dirname(unixify(tsconfig.path));\n\n function matchFn(condition) {\n let pattern = unixify(condition);\n if (!path.isAbsolute(pattern) && !pattern.startsWith('*')) pattern = path.join(tsconfigPath, pattern);\n\n return function match(filePath) {\n return filePath.startsWith(pattern) || minimatch(filePath, pattern);\n };\n }\n\n const includes = ((tsconfig.config.include as string[]) || []).map(matchFn);\n const excludes = ((tsconfig.config.exclude as string[]) || []).map(matchFn);\n\n return function matcher(filePath) {\n if (filePath.endsWith('.json')) return false;\n\n filePath = unixify(filePath);\n for (let i = 0; i < excludes.length; ++i) {\n if (excludes[i](filePath)) return false;\n }\n for (let j = 0; j < includes.length; ++j) {\n if (includes[j](filePath)) return true;\n }\n return !includes.length;\n };\n}\n"],"names":["createMatcher","tsconfig","tsconfigPath","path","dirname","unixify","matchFn","condition","pattern","isAbsolute","startsWith","join","match","filePath","minimatch","includes","config","include","map","excludes","exclude","matcher","endsWith","i","length","j"],"mappings":";;;;+BAKA;;;eAAwBA;;;gEALF;gEACL;8DACG;;;;;;AAGL,SAASA,cAAcC,QAAkB;IACtD,IAAMC,eAAeC,kBAAI,CAACC,OAAO,CAACC,IAAAA,gBAAO,EAACJ,SAASE,IAAI;IAEvD,SAASG,QAAQC,SAAS;QACxB,IAAIC,UAAUH,IAAAA,gBAAO,EAACE;QACtB,IAAI,CAACJ,kBAAI,CAACM,UAAU,CAACD,YAAY,CAACA,QAAQE,UAAU,CAAC,MAAMF,UAAUL,kBAAI,CAACQ,IAAI,CAACT,cAAcM;QAE7F,OAAO,SAASI,MAAMC,QAAQ;YAC5B,OAAOA,SAASH,UAAU,CAACF,YAAYM,IAAAA,kBAAS,EAACD,UAAUL;QAC7D;IACF;IAEA,IAAMO,WAAW,AAAC,CAAA,AAACd,SAASe,MAAM,CAACC,OAAO,IAAiB,EAAE,AAAD,EAAGC,GAAG,CAACZ;IACnE,IAAMa,WAAW,AAAC,CAAA,AAAClB,SAASe,MAAM,CAACI,OAAO,IAAiB,EAAE,AAAD,EAAGF,GAAG,CAACZ;IAEnE,OAAO,SAASe,QAAQR,QAAQ;QAC9B,IAAIA,SAASS,QAAQ,CAAC,UAAU,OAAO;QAEvCT,WAAWR,IAAAA,gBAAO,EAACQ;QACnB,IAAK,IAAIU,IAAI,GAAGA,IAAIJ,SAASK,MAAM,EAAE,EAAED,EAAG;YACxC,IAAIJ,QAAQ,CAACI,EAAE,CAACV,WAAW,OAAO;QACpC;QACA,IAAK,IAAIY,IAAI,GAAGA,IAAIV,SAASS,MAAM,EAAE,EAAEC,EAAG;YACxC,IAAIV,QAAQ,CAACU,EAAE,CAACZ,WAAW,OAAO;QACpC;QACA,OAAO,CAACE,SAASS,MAAM;IACzB;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/createMatcher.ts"],"sourcesContent":["import minimatch from 'minimatch';\nimport path from 'path-posix';\nimport unixify from 'unixify';\nimport type { Matcher, TSConfig } from './types.ts';\n\nexport default function createMatcher(tsconfig: TSConfig): Matcher {\n const tsconfigPath = path.dirname(unixify(tsconfig.path));\n\n function matchFn(condition) {\n let pattern = unixify(condition);\n if (!path.isAbsolute(pattern) && pattern.indexOf('*') !== 0) pattern = path.join(tsconfigPath, pattern);\n\n return function match(filePath) {\n return filePath.indexOf(pattern) === 0 || minimatch(filePath, pattern);\n };\n }\n\n const includes = ((tsconfig.config.include as string[]) || []).map(matchFn);\n const excludes = ((tsconfig.config.exclude as string[]) || []).map(matchFn);\n\n return function matcher(filePath) {\n if (filePath.endsWith('.json')) return false;\n\n filePath = unixify(filePath);\n for (let i = 0; i < excludes.length; ++i) {\n if (excludes[i](filePath)) return false;\n }\n for (let j = 0; j < includes.length; ++j) {\n if (includes[j](filePath)) return true;\n }\n return !includes.length;\n };\n}\n"],"names":["createMatcher","tsconfig","tsconfigPath","path","dirname","unixify","matchFn","condition","pattern","isAbsolute","indexOf","join","match","filePath","minimatch","includes","config","include","map","excludes","exclude","matcher","endsWith","i","length","j"],"mappings":";;;;+BAKA;;;eAAwBA;;;gEALF;gEACL;8DACG;;;;;;AAGL,SAASA,cAAcC,QAAkB;IACtD,IAAMC,eAAeC,kBAAI,CAACC,OAAO,CAACC,IAAAA,gBAAO,EAACJ,SAASE,IAAI;IAEvD,SAASG,QAAQC,SAAS;QACxB,IAAIC,UAAUH,IAAAA,gBAAO,EAACE;QACtB,IAAI,CAACJ,kBAAI,CAACM,UAAU,CAACD,YAAYA,QAAQE,OAAO,CAAC,SAAS,GAAGF,UAAUL,kBAAI,CAACQ,IAAI,CAACT,cAAcM;QAE/F,OAAO,SAASI,MAAMC,QAAQ;YAC5B,OAAOA,SAASH,OAAO,CAACF,aAAa,KAAKM,IAAAA,kBAAS,EAACD,UAAUL;QAChE;IACF;IAEA,IAAMO,WAAW,AAAC,CAAA,AAACd,SAASe,MAAM,CAACC,OAAO,IAAiB,EAAE,AAAD,EAAGC,GAAG,CAACZ;IACnE,IAAMa,WAAW,AAAC,CAAA,AAAClB,SAASe,MAAM,CAACI,OAAO,IAAiB,EAAE,AAAD,EAAGF,GAAG,CAACZ;IAEnE,OAAO,SAASe,QAAQR,QAAQ;QAC9B,IAAIA,SAASS,QAAQ,CAAC,UAAU,OAAO;QAEvCT,WAAWR,IAAAA,gBAAO,EAACQ;QACnB,IAAK,IAAIU,IAAI,GAAGA,IAAIJ,SAASK,MAAM,EAAE,EAAED,EAAG;YACxC,IAAIJ,QAAQ,CAACI,EAAE,CAACV,WAAW,OAAO;QACpC;QACA,IAAK,IAAIY,IAAI,GAAGA,IAAIV,SAASS,MAAM,EAAE,EAAEC,EAAG;YACxC,IAAIV,QAAQ,CAACU,EAAE,CAACZ,WAAW,OAAO;QACpC;QACA,OAAO,CAACE,SAASS,MAAM;IACzB;AACF"}
@@ -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"}
@@ -70,7 +70,7 @@ function getParentPath(context) {
70
70
  return context.parentURL ? _path.default.dirname(toPath(context.parentURL)) : process.cwd();
71
71
  }
72
72
  function toPath(specifier, context) {
73
- if (specifier.startsWith('file:')) return fileURLToPath(specifier);
73
+ if (specifier.indexOf('file:') === 0) return fileURLToPath(specifier);
74
74
  if ((0, _isabsolute.default)(specifier)) return specifier;
75
75
  if (specifier[0] === '.') {
76
76
  var parentPath = context ? getParentPath(context) : process.cwd();
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import isAbsolute from 'is-absolute';\nimport module from 'module';\nimport path from 'path';\nimport resolveCJS from 'resolve';\nimport url from 'url';\nimport { moduleRegEx } from './constants.ts';\nimport importMetaResolve from './lib/import-meta-resolve.ts';\nimport * as urlPolyfills from './lib/urlFileUrl.ts';\nimport type { Context } from './types.ts';\n\nconst useCJS = !module.createRequire;\nconst fileURLToPath = url.fileURLToPath || urlPolyfills.fileURLToPath;\nconst pathToFileURL = url.pathToFileURL || urlPolyfills.pathToFileURL;\n\nfunction getParentPath(context: Context): string {\n if (context.parentPath) return path.dirname(context.parentPath);\n return context.parentURL ? path.dirname(toPath(context.parentURL)) : process.cwd();\n}\n\nexport default function toPath(specifier: string, context?: Context): string {\n if (specifier.startsWith('file:')) return fileURLToPath(specifier);\n if (isAbsolute(specifier)) return specifier;\n if (specifier[0] === '.') {\n const parentPath = context ? getParentPath(context) : process.cwd();\n return path.join(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n if (!useCJS) {\n try {\n const entryURL = importMetaResolve(specifier, pathToFileURL(parentPath));\n if (entryURL) return fileURLToPath(entryURL);\n } catch (_) {\n /* it may fail due to commonjs edge cases */\n }\n }\n const entryPath = resolveCJS.sync(specifier, {\n basedir: parentPath,\n extensions: ['.js', '.json', '.node', '.mjs'],\n });\n if (entryPath) return entryPath;\n }\n\n return specifier;\n}\n"],"names":["toPath","useCJS","module","createRequire","fileURLToPath","url","urlPolyfills","pathToFileURL","getParentPath","context","parentPath","path","dirname","parentURL","process","cwd","specifier","startsWith","isAbsolute","join","moduleRegEx","test","entryURL","importMetaResolve","_","entryPath","resolveCJS","sync","basedir","extensions"],"mappings":";;;;+BAmBA;;;eAAwBA;;;iEAnBD;6DACJ;2DACF;8DACM;0DACP;2BACY;0EACE;oEACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG9B,IAAMC,SAAS,CAACC,eAAM,CAACC,aAAa;AACpC,IAAMC,gBAAgBC,YAAG,CAACD,aAAa,IAAIE,cAAaF,aAAa;AACrE,IAAMG,gBAAgBF,YAAG,CAACE,aAAa,IAAID,cAAaC,aAAa;AAErE,SAASC,cAAcC,OAAgB;IACrC,IAAIA,QAAQC,UAAU,EAAE,OAAOC,aAAI,CAACC,OAAO,CAACH,QAAQC,UAAU;IAC9D,OAAOD,QAAQI,SAAS,GAAGF,aAAI,CAACC,OAAO,CAACZ,OAAOS,QAAQI,SAAS,KAAKC,QAAQC,GAAG;AAClF;AAEe,SAASf,OAAOgB,SAAiB,EAAEP,OAAiB;IACjE,IAAIO,UAAUC,UAAU,CAAC,UAAU,OAAOb,cAAcY;IACxD,IAAIE,IAAAA,mBAAU,EAACF,YAAY,OAAOA;IAClC,IAAIA,SAAS,CAAC,EAAE,KAAK,KAAK;QACxB,IAAMN,aAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QACjE,OAAOJ,aAAI,CAACQ,IAAI,CAACT,YAAYM;IAC/B;IACA,IAAII,wBAAW,CAACC,IAAI,CAACL,YAAY;QAC/B,IAAMN,cAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QACjE,IAAI,CAACd,QAAQ;YACX,IAAI;gBACF,IAAMqB,WAAWC,IAAAA,4BAAiB,EAACP,WAAWT,cAAcG;gBAC5D,IAAIY,UAAU,OAAOlB,cAAckB;YACrC,EAAE,OAAOE,GAAG;YACV,0CAA0C,GAC5C;QACF;QACA,IAAMC,YAAYC,gBAAU,CAACC,IAAI,CAACX,WAAW;YAC3CY,SAASlB;YACTmB,YAAY;gBAAC;gBAAO;gBAAS;gBAAS;aAAO;QAC/C;QACA,IAAIJ,WAAW,OAAOA;IACxB;IAEA,OAAOT;AACT"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import isAbsolute from 'is-absolute';\nimport module from 'module';\nimport path from 'path';\nimport resolveCJS from 'resolve';\nimport url from 'url';\nimport { moduleRegEx } from './constants.ts';\nimport importMetaResolve from './lib/import-meta-resolve.ts';\nimport * as urlPolyfills from './lib/urlFileUrl.ts';\nimport type { Context } from './types.ts';\n\nconst useCJS = !module.createRequire;\nconst fileURLToPath = url.fileURLToPath || urlPolyfills.fileURLToPath;\nconst pathToFileURL = url.pathToFileURL || urlPolyfills.pathToFileURL;\n\nfunction getParentPath(context: Context): string {\n if (context.parentPath) return path.dirname(context.parentPath);\n return context.parentURL ? path.dirname(toPath(context.parentURL)) : process.cwd();\n}\n\nexport default function toPath(specifier: string, context?: Context): string {\n if (specifier.indexOf('file:') === 0) return fileURLToPath(specifier);\n if (isAbsolute(specifier)) return specifier;\n if (specifier[0] === '.') {\n const parentPath = context ? getParentPath(context) : process.cwd();\n return path.join(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n if (!useCJS) {\n try {\n const entryURL = importMetaResolve(specifier, pathToFileURL(parentPath));\n if (entryURL) return fileURLToPath(entryURL);\n } catch (_) {\n /* it may fail due to commonjs edge cases */\n }\n }\n const entryPath = resolveCJS.sync(specifier, {\n basedir: parentPath,\n extensions: ['.js', '.json', '.node', '.mjs'],\n });\n if (entryPath) return entryPath;\n }\n\n return specifier;\n}\n"],"names":["toPath","useCJS","module","createRequire","fileURLToPath","url","urlPolyfills","pathToFileURL","getParentPath","context","parentPath","path","dirname","parentURL","process","cwd","specifier","indexOf","isAbsolute","join","moduleRegEx","test","entryURL","importMetaResolve","_","entryPath","resolveCJS","sync","basedir","extensions"],"mappings":";;;;+BAmBA;;;eAAwBA;;;iEAnBD;6DACJ;2DACF;8DACM;0DACP;2BACY;0EACE;oEACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG9B,IAAMC,SAAS,CAACC,eAAM,CAACC,aAAa;AACpC,IAAMC,gBAAgBC,YAAG,CAACD,aAAa,IAAIE,cAAaF,aAAa;AACrE,IAAMG,gBAAgBF,YAAG,CAACE,aAAa,IAAID,cAAaC,aAAa;AAErE,SAASC,cAAcC,OAAgB;IACrC,IAAIA,QAAQC,UAAU,EAAE,OAAOC,aAAI,CAACC,OAAO,CAACH,QAAQC,UAAU;IAC9D,OAAOD,QAAQI,SAAS,GAAGF,aAAI,CAACC,OAAO,CAACZ,OAAOS,QAAQI,SAAS,KAAKC,QAAQC,GAAG;AAClF;AAEe,SAASf,OAAOgB,SAAiB,EAAEP,OAAiB;IACjE,IAAIO,UAAUC,OAAO,CAAC,aAAa,GAAG,OAAOb,cAAcY;IAC3D,IAAIE,IAAAA,mBAAU,EAACF,YAAY,OAAOA;IAClC,IAAIA,SAAS,CAAC,EAAE,KAAK,KAAK;QACxB,IAAMN,aAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QACjE,OAAOJ,aAAI,CAACQ,IAAI,CAACT,YAAYM;IAC/B;IACA,IAAII,wBAAW,CAACC,IAAI,CAACL,YAAY;QAC/B,IAAMN,cAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QACjE,IAAI,CAACd,QAAQ;YACX,IAAI;gBACF,IAAMqB,WAAWC,IAAAA,4BAAiB,EAACP,WAAWT,cAAcG;gBAC5D,IAAIY,UAAU,OAAOlB,cAAckB;YACrC,EAAE,OAAOE,GAAG;YACV,0CAA0C,GAC5C;QACF;QACA,IAAMC,YAAYC,gBAAU,CAACC,IAAI,CAACX,WAAW;YAC3CY,SAASlB;YACTmB,YAAY;gBAAC;gBAAO;gBAAS;gBAAS;aAAO;QAC/C;QACA,IAAIJ,WAAW,OAAOA;IACxB;IAEA,OAAOT;AACT"}
@@ -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,a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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,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;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":""}
@@ -5,9 +5,9 @@ export default function createMatcher(tsconfig) {
5
5
  const tsconfigPath = path.dirname(unixify(tsconfig.path));
6
6
  function matchFn(condition) {
7
7
  let pattern = unixify(condition);
8
- if (!path.isAbsolute(pattern) && !pattern.startsWith('*')) pattern = path.join(tsconfigPath, pattern);
8
+ if (!path.isAbsolute(pattern) && pattern.indexOf('*') !== 0) pattern = path.join(tsconfigPath, pattern);
9
9
  return function match(filePath) {
10
- return filePath.startsWith(pattern) || minimatch(filePath, pattern);
10
+ return filePath.indexOf(pattern) === 0 || minimatch(filePath, pattern);
11
11
  };
12
12
  }
13
13
  const includes = (tsconfig.config.include || []).map(matchFn);
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/createMatcher.ts"],"sourcesContent":["import minimatch from 'minimatch';\nimport path from 'path-posix';\nimport unixify from 'unixify';\nimport type { Matcher, TSConfig } from './types.ts';\n\nexport default function createMatcher(tsconfig: TSConfig): Matcher {\n const tsconfigPath = path.dirname(unixify(tsconfig.path));\n\n function matchFn(condition) {\n let pattern = unixify(condition);\n if (!path.isAbsolute(pattern) && !pattern.startsWith('*')) pattern = path.join(tsconfigPath, pattern);\n\n return function match(filePath) {\n return filePath.startsWith(pattern) || minimatch(filePath, pattern);\n };\n }\n\n const includes = ((tsconfig.config.include as string[]) || []).map(matchFn);\n const excludes = ((tsconfig.config.exclude as string[]) || []).map(matchFn);\n\n return function matcher(filePath) {\n if (filePath.endsWith('.json')) return false;\n\n filePath = unixify(filePath);\n for (let i = 0; i < excludes.length; ++i) {\n if (excludes[i](filePath)) return false;\n }\n for (let j = 0; j < includes.length; ++j) {\n if (includes[j](filePath)) return true;\n }\n return !includes.length;\n };\n}\n"],"names":["minimatch","path","unixify","createMatcher","tsconfig","tsconfigPath","dirname","matchFn","condition","pattern","isAbsolute","startsWith","join","match","filePath","includes","config","include","map","excludes","exclude","matcher","endsWith","i","length","j"],"mappings":"AAAA,OAAOA,eAAe,YAAY;AAClC,OAAOC,UAAU,aAAa;AAC9B,OAAOC,aAAa,UAAU;AAG9B,eAAe,SAASC,cAAcC,QAAkB;IACtD,MAAMC,eAAeJ,KAAKK,OAAO,CAACJ,QAAQE,SAASH,IAAI;IAEvD,SAASM,QAAQC,SAAS;QACxB,IAAIC,UAAUP,QAAQM;QACtB,IAAI,CAACP,KAAKS,UAAU,CAACD,YAAY,CAACA,QAAQE,UAAU,CAAC,MAAMF,UAAUR,KAAKW,IAAI,CAACP,cAAcI;QAE7F,OAAO,SAASI,MAAMC,QAAQ;YAC5B,OAAOA,SAASH,UAAU,CAACF,YAAYT,UAAUc,UAAUL;QAC7D;IACF;IAEA,MAAMM,WAAW,AAAC,CAAA,AAACX,SAASY,MAAM,CAACC,OAAO,IAAiB,EAAE,AAAD,EAAGC,GAAG,CAACX;IACnE,MAAMY,WAAW,AAAC,CAAA,AAACf,SAASY,MAAM,CAACI,OAAO,IAAiB,EAAE,AAAD,EAAGF,GAAG,CAACX;IAEnE,OAAO,SAASc,QAAQP,QAAQ;QAC9B,IAAIA,SAASQ,QAAQ,CAAC,UAAU,OAAO;QAEvCR,WAAWZ,QAAQY;QACnB,IAAK,IAAIS,IAAI,GAAGA,IAAIJ,SAASK,MAAM,EAAE,EAAED,EAAG;YACxC,IAAIJ,QAAQ,CAACI,EAAE,CAACT,WAAW,OAAO;QACpC;QACA,IAAK,IAAIW,IAAI,GAAGA,IAAIV,SAASS,MAAM,EAAE,EAAEC,EAAG;YACxC,IAAIV,QAAQ,CAACU,EAAE,CAACX,WAAW,OAAO;QACpC;QACA,OAAO,CAACC,SAASS,MAAM;IACzB;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/createMatcher.ts"],"sourcesContent":["import minimatch from 'minimatch';\nimport path from 'path-posix';\nimport unixify from 'unixify';\nimport type { Matcher, TSConfig } from './types.ts';\n\nexport default function createMatcher(tsconfig: TSConfig): Matcher {\n const tsconfigPath = path.dirname(unixify(tsconfig.path));\n\n function matchFn(condition) {\n let pattern = unixify(condition);\n if (!path.isAbsolute(pattern) && pattern.indexOf('*') !== 0) pattern = path.join(tsconfigPath, pattern);\n\n return function match(filePath) {\n return filePath.indexOf(pattern) === 0 || minimatch(filePath, pattern);\n };\n }\n\n const includes = ((tsconfig.config.include as string[]) || []).map(matchFn);\n const excludes = ((tsconfig.config.exclude as string[]) || []).map(matchFn);\n\n return function matcher(filePath) {\n if (filePath.endsWith('.json')) return false;\n\n filePath = unixify(filePath);\n for (let i = 0; i < excludes.length; ++i) {\n if (excludes[i](filePath)) return false;\n }\n for (let j = 0; j < includes.length; ++j) {\n if (includes[j](filePath)) return true;\n }\n return !includes.length;\n };\n}\n"],"names":["minimatch","path","unixify","createMatcher","tsconfig","tsconfigPath","dirname","matchFn","condition","pattern","isAbsolute","indexOf","join","match","filePath","includes","config","include","map","excludes","exclude","matcher","endsWith","i","length","j"],"mappings":"AAAA,OAAOA,eAAe,YAAY;AAClC,OAAOC,UAAU,aAAa;AAC9B,OAAOC,aAAa,UAAU;AAG9B,eAAe,SAASC,cAAcC,QAAkB;IACtD,MAAMC,eAAeJ,KAAKK,OAAO,CAACJ,QAAQE,SAASH,IAAI;IAEvD,SAASM,QAAQC,SAAS;QACxB,IAAIC,UAAUP,QAAQM;QACtB,IAAI,CAACP,KAAKS,UAAU,CAACD,YAAYA,QAAQE,OAAO,CAAC,SAAS,GAAGF,UAAUR,KAAKW,IAAI,CAACP,cAAcI;QAE/F,OAAO,SAASI,MAAMC,QAAQ;YAC5B,OAAOA,SAASH,OAAO,CAACF,aAAa,KAAKT,UAAUc,UAAUL;QAChE;IACF;IAEA,MAAMM,WAAW,AAAC,CAAA,AAACX,SAASY,MAAM,CAACC,OAAO,IAAiB,EAAE,AAAD,EAAGC,GAAG,CAACX;IACnE,MAAMY,WAAW,AAAC,CAAA,AAACf,SAASY,MAAM,CAACI,OAAO,IAAiB,EAAE,AAAD,EAAGF,GAAG,CAACX;IAEnE,OAAO,SAASc,QAAQP,QAAQ;QAC9B,IAAIA,SAASQ,QAAQ,CAAC,UAAU,OAAO;QAEvCR,WAAWZ,QAAQY;QACnB,IAAK,IAAIS,IAAI,GAAGA,IAAIJ,SAASK,MAAM,EAAE,EAAED,EAAG;YACxC,IAAIJ,QAAQ,CAACI,EAAE,CAACT,WAAW,OAAO;QACpC;QACA,IAAK,IAAIW,IAAI,GAAGA,IAAIV,SAASS,MAAM,EAAE,EAAEC,EAAG;YACxC,IAAIV,QAAQ,CAACU,EAAE,CAACX,WAAW,OAAO;QACpC;QACA,OAAO,CAACC,SAASS,MAAM;IACzB;AACF"}
@@ -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"}
@@ -14,7 +14,7 @@ function getParentPath(context) {
14
14
  return context.parentURL ? path.dirname(toPath(context.parentURL)) : process.cwd();
15
15
  }
16
16
  export default function toPath(specifier, context) {
17
- if (specifier.startsWith('file:')) return fileURLToPath(specifier);
17
+ if (specifier.indexOf('file:') === 0) return fileURLToPath(specifier);
18
18
  if (isAbsolute(specifier)) return specifier;
19
19
  if (specifier[0] === '.') {
20
20
  const parentPath = context ? getParentPath(context) : process.cwd();
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import isAbsolute from 'is-absolute';\nimport module from 'module';\nimport path from 'path';\nimport resolveCJS from 'resolve';\nimport url from 'url';\nimport { moduleRegEx } from './constants.ts';\nimport importMetaResolve from './lib/import-meta-resolve.ts';\nimport * as urlPolyfills from './lib/urlFileUrl.ts';\nimport type { Context } from './types.ts';\n\nconst useCJS = !module.createRequire;\nconst fileURLToPath = url.fileURLToPath || urlPolyfills.fileURLToPath;\nconst pathToFileURL = url.pathToFileURL || urlPolyfills.pathToFileURL;\n\nfunction getParentPath(context: Context): string {\n if (context.parentPath) return path.dirname(context.parentPath);\n return context.parentURL ? path.dirname(toPath(context.parentURL)) : process.cwd();\n}\n\nexport default function toPath(specifier: string, context?: Context): string {\n if (specifier.startsWith('file:')) return fileURLToPath(specifier);\n if (isAbsolute(specifier)) return specifier;\n if (specifier[0] === '.') {\n const parentPath = context ? getParentPath(context) : process.cwd();\n return path.join(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n if (!useCJS) {\n try {\n const entryURL = importMetaResolve(specifier, pathToFileURL(parentPath));\n if (entryURL) return fileURLToPath(entryURL);\n } catch (_) {\n /* it may fail due to commonjs edge cases */\n }\n }\n const entryPath = resolveCJS.sync(specifier, {\n basedir: parentPath,\n extensions: ['.js', '.json', '.node', '.mjs'],\n });\n if (entryPath) return entryPath;\n }\n\n return specifier;\n}\n"],"names":["isAbsolute","module","path","resolveCJS","url","moduleRegEx","importMetaResolve","urlPolyfills","useCJS","createRequire","fileURLToPath","pathToFileURL","getParentPath","context","parentPath","dirname","parentURL","toPath","process","cwd","specifier","startsWith","join","test","entryURL","_","entryPath","sync","basedir","extensions"],"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AAS;gBAAS;aAAO;QAC/C;QACA,IAAIH,WAAW,OAAOA;IACxB;IAEA,OAAON;AACT"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import isAbsolute from 'is-absolute';\nimport module from 'module';\nimport path from 'path';\nimport resolveCJS from 'resolve';\nimport url from 'url';\nimport { moduleRegEx } from './constants.ts';\nimport importMetaResolve from './lib/import-meta-resolve.ts';\nimport * as urlPolyfills from './lib/urlFileUrl.ts';\nimport type { Context } from './types.ts';\n\nconst useCJS = !module.createRequire;\nconst fileURLToPath = url.fileURLToPath || urlPolyfills.fileURLToPath;\nconst pathToFileURL = url.pathToFileURL || urlPolyfills.pathToFileURL;\n\nfunction getParentPath(context: Context): string {\n if (context.parentPath) return path.dirname(context.parentPath);\n return context.parentURL ? path.dirname(toPath(context.parentURL)) : process.cwd();\n}\n\nexport default function toPath(specifier: string, context?: Context): string {\n if (specifier.indexOf('file:') === 0) return fileURLToPath(specifier);\n if (isAbsolute(specifier)) return specifier;\n if (specifier[0] === '.') {\n const parentPath = context ? getParentPath(context) : process.cwd();\n return path.join(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n if (!useCJS) {\n try {\n const entryURL = importMetaResolve(specifier, pathToFileURL(parentPath));\n if (entryURL) return fileURLToPath(entryURL);\n } catch (_) {\n /* it may fail due to commonjs edge cases */\n }\n }\n const entryPath = resolveCJS.sync(specifier, {\n basedir: parentPath,\n extensions: ['.js', '.json', '.node', '.mjs'],\n });\n if (entryPath) return entryPath;\n }\n\n return specifier;\n}\n"],"names":["isAbsolute","module","path","resolveCJS","url","moduleRegEx","importMetaResolve","urlPolyfills","useCJS","createRequire","fileURLToPath","pathToFileURL","getParentPath","context","parentPath","dirname","parentURL","toPath","process","cwd","specifier","indexOf","join","test","entryURL","_","entryPath","sync","basedir","extensions"],"mappings":"AAAA,OAAOA,gBAAgB,cAAc;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ACA,IAAIH,WAAW,OAAOA;IACxB;IAEA,OAAON;AACT"}
@@ -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,Y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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.1",
4
4
  "description": "Typescript transformers for swc. Supports Node >= 0.8",
5
5
  "keywords": [
6
6
  "matcher",
@@ -47,8 +47,7 @@
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
- "install-optional": "^0.1.76",
50
+ "install-optional": "^0.1.77",
52
51
  "is-absolute": "^1.0.0",
53
52
  "lodash.find": "^4.6.0",
54
53
  "minimatch": "^3.1.2",
@@ -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.1",
59
59
  "resolve": "^1.22.10",
60
60
  "rimraf2": "^2.8.2",
61
61
  "ts-node": "*",
@@ -65,6 +65,7 @@
65
65
  "devDependencies": {
66
66
  "@types/mocha": "*",
67
67
  "@types/node": "*",
68
+ "core-js": "^3.43.0",
68
69
  "cr": "*",
69
70
  "cross-spawn-cb": "*",
70
71
  "pinkie-promise": "*",