ts-swc-transform 2.10.0 → 2.11.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.
@@ -26,6 +26,7 @@ Object.defineProperty(exports, /**
26
26
  });
27
27
  var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
28
28
  var _module = /*#__PURE__*/ _interop_require_default(require("module"));
29
+ var _modulerootsync = /*#__PURE__*/ _interop_require_default(require("module-root-sync"));
29
30
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
30
31
  function _interop_require_default(obj) {
31
32
  return obj && obj.__esModule ? obj : {
@@ -85,31 +86,6 @@ function getResolveExports() {
85
86
  }
86
87
  return null;
87
88
  }
88
- /**
89
- * Find the containing package.json by walking up from a file path
90
- * Used for # subpath imports which are scoped to the containing package
91
- */ function findContainingPackage(filePath) {
92
- var dir = _path.default.dirname(filePath);
93
- var root = _path.default.parse(dir).root;
94
- while(dir !== root){
95
- var pkgJsonPath = _path.default.join(dir, 'package.json');
96
- try {
97
- if (_fs.default.existsSync(pkgJsonPath)) {
98
- var content = _fs.default.readFileSync(pkgJsonPath, 'utf8');
99
- return {
100
- dir: dir,
101
- json: JSON.parse(content)
102
- };
103
- }
104
- } catch (_) {
105
- // Ignore filesystem errors
106
- }
107
- var parent = _path.default.dirname(dir);
108
- if (parent === dir) break;
109
- dir = parent;
110
- }
111
- return null;
112
- }
113
89
  function resolveESM(specifier, parentPath) {
114
90
  var conditions = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [
115
91
  'node',
@@ -125,7 +101,19 @@ function resolveESM(specifier, parentPath) {
125
101
  var subpath;
126
102
  if (specifier.startsWith('#')) {
127
103
  // Subpath import - find containing package
128
- pkg = findContainingPackage(parentPath);
104
+ try {
105
+ var dir = (0, _modulerootsync.default)(parentPath, {
106
+ includeSynthetic: true
107
+ });
108
+ var pkgJsonPath = _path.default.join(dir, 'package.json');
109
+ var content = _fs.default.readFileSync(pkgJsonPath, 'utf8');
110
+ pkg = {
111
+ dir: dir,
112
+ json: JSON.parse(content)
113
+ };
114
+ } catch (_) {
115
+ pkg = null;
116
+ }
129
117
  subpath = specifier; // resolve.exports expects the full #specifier
130
118
  } else {
131
119
  // External package - find in node_modules
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/resolveESM.ts"],"sourcesContent":["/**\n * Unified ESM resolver\n *\n * Handles both:\n * - Package exports: import x from 'lodash' → uses exports field\n * - Subpath imports: import x from '#internal' → uses imports field\n *\n * Uses resolve.exports.resolve() which automatically detects the specifier type.\n * Only loaded on Node >= 12.2 where module.createRequire exists.\n */\n\nimport fs from 'fs';\nimport Module from 'module';\nimport path from 'path';\n\n// Lazy-load resolve.exports\ntype ResolveExportsModule = typeof import('resolve.exports');\nlet _resolveExports: ResolveExportsModule | null = null;\n\nfunction getResolveExports(): ResolveExportsModule | null {\n if (_resolveExports === null) {\n try {\n const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n _resolveExports = _require('resolve.exports') as ResolveExportsModule;\n } catch (_) {\n _resolveExports = null;\n }\n }\n return _resolveExports;\n}\n\n/**\n * Parse a specifier into package name and subpath\n * \"lodash\" → { pkgName: \"lodash\", subpath: \".\" }\n * \"lodash/get\" → { pkgName: \"lodash\", subpath: \"./get\" }\n * \"@scope/pkg\" → { pkgName: \"@scope/pkg\", subpath: \".\" }\n * \"@scope/pkg/foo\" → { pkgName: \"@scope/pkg\", subpath: \"./foo\" }\n */\nfunction parseSpecifier(specifier: string): { pkgName: string; subpath: string } {\n const parts = specifier.split('/');\n const pkgName = specifier[0] === '@' ? parts.slice(0, 2).join('/') : parts[0];\n const remainder = specifier.slice(pkgName.length);\n const subpath = remainder ? `.${remainder}` : '.';\n return { pkgName, subpath };\n}\n\n/**\n * Find package.json in node_modules for external packages\n */\nfunction findPackageInNodeModules(pkgName: string, basedir: string): { dir: string; json: Record<string, unknown> } | null {\n let dir = basedir;\n const root = path.parse(dir).root;\n\n while (dir !== root) {\n const pkgDir = path.join(dir, 'node_modules', pkgName);\n const pkgJsonPath = path.join(pkgDir, 'package.json');\n try {\n if (fs.existsSync(pkgJsonPath)) {\n const content = fs.readFileSync(pkgJsonPath, 'utf8');\n return { dir: pkgDir, json: JSON.parse(content) };\n }\n } catch (_) {\n // Ignore filesystem errors\n }\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n\n return null;\n}\n\n/**\n * Find the containing package.json by walking up from a file path\n * Used for # subpath imports which are scoped to the containing package\n */\nfunction findContainingPackage(filePath: string): { dir: string; json: Record<string, unknown> } | null {\n let dir = path.dirname(filePath);\n const root = path.parse(dir).root;\n\n while (dir !== root) {\n const pkgJsonPath = path.join(dir, 'package.json');\n try {\n if (fs.existsSync(pkgJsonPath)) {\n const content = fs.readFileSync(pkgJsonPath, 'utf8');\n return { dir, json: JSON.parse(content) };\n }\n } catch (_) {\n // Ignore filesystem errors\n }\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n\n return null;\n}\n\n/**\n * Resolve an ESM specifier to an absolute file path\n *\n * @param specifier - The import specifier (e.g., 'lodash', 'lodash/get', '#internal')\n * @param parentPath - The file path of the importing module\n * @param conditions - Export conditions (defaults to ['node', 'import'])\n * @returns The resolved absolute file path, or null if not resolvable\n */\nexport default function resolveESM(specifier: string, parentPath: string, conditions: string[] = ['node', 'import']): string | null {\n const resolveExportsMod = getResolveExports();\n if (!resolveExportsMod) {\n return null;\n }\n\n const { resolve: resolveFn, legacy } = resolveExportsMod;\n\n // Determine how to find the package.json based on specifier type\n let pkg: { dir: string; json: Record<string, unknown> } | null;\n let subpath: string;\n\n if (specifier.startsWith('#')) {\n // Subpath import - find containing package\n pkg = findContainingPackage(parentPath);\n subpath = specifier; // resolve.exports expects the full #specifier\n } else {\n // External package - find in node_modules\n const { pkgName, subpath: parsedSubpath } = parseSpecifier(specifier);\n pkg = findPackageInNodeModules(pkgName, parentPath);\n subpath = parsedSubpath;\n }\n\n if (!pkg) {\n return null;\n }\n\n // Use resolve.exports.resolve() which handles both exports and imports\n try {\n const resolved = resolveFn(pkg.json, subpath, { conditions });\n if (resolved?.[0]) {\n return path.join(pkg.dir, resolved[0]);\n }\n } catch (_) {\n // Resolution failed, try legacy\n }\n\n // Try legacy main/module fields for non-# imports\n if (!specifier.startsWith('#')) {\n try {\n const legacyMain = legacy(pkg.json);\n if (legacyMain) {\n let mainPath: string | undefined;\n if (typeof legacyMain === 'string') {\n mainPath = legacyMain;\n } else if (Array.isArray(legacyMain)) {\n mainPath = legacyMain[0];\n }\n if (mainPath) {\n return path.join(pkg.dir, mainPath);\n }\n }\n } catch (_) {\n // Legacy parsing failed\n }\n\n // Last resort: try index.js\n const indexPath = path.join(pkg.dir, 'index.js');\n try {\n if (fs.existsSync(indexPath)) {\n return indexPath;\n }\n } catch (_) {\n // Ignore\n }\n }\n\n return null;\n}\n"],"names":["resolveESM","_resolveExports","getResolveExports","_require","require","Module","createRequire","_","parseSpecifier","specifier","parts","split","pkgName","slice","join","remainder","length","subpath","findPackageInNodeModules","basedir","dir","root","path","parse","pkgDir","pkgJsonPath","fs","existsSync","content","readFileSync","json","JSON","parent","dirname","findContainingPackage","filePath","parentPath","conditions","resolveExportsMod","resolve","resolveFn","legacy","pkg","startsWith","parsedSubpath","resolved","legacyMain","mainPath","Array","isArray","indexPath"],"mappings":"AAAA;;;;;;;;;CASC;;;;+BAyFD;;;;;;;CAOC,GACD;;;eAAwBA;;;yDA/FT;6DACI;2DACF;;;;;;AAIjB,IAAIC,kBAA+C;AAEnD,SAASC;IACP,IAAID,oBAAoB,MAAM;QAC5B,IAAI;YACF,IAAME,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;YAC1FH,kBAAkBE,SAAS;QAC7B,EAAE,OAAOI,GAAG;YACVN,kBAAkB;QACpB;IACF;IACA,OAAOA;AACT;AAEA;;;;;;CAMC,GACD,SAASO,eAAeC,SAAi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AaL,OAAOC,IAAIZ,IAAI;YAClC,IAAIgB,YAAY;gBACd,IAAIC;gBACJ,IAAI,OAAOD,eAAe,UAAU;oBAClCC,WAAWD;gBACb,OAAO,IAAIE,MAAMC,OAAO,CAACH,aAAa;oBACpCC,WAAWD,UAAU,CAAC,EAAE;gBAC1B;gBACA,IAAIC,UAAU;oBACZ,OAAOzB,aAAI,CAACR,IAAI,CAAC4B,IAAItB,GAAG,EAAE2B;gBAC5B;YACF;QACF,EAAE,OAAOxC,GAAG;QACV,wBAAwB;QAC1B;QAEA,4BAA4B;QAC5B,IAAM2C,YAAY5B,aAAI,CAACR,IAAI,CAAC4B,IAAItB,GAAG,EAAE;QACrC,IAAI;YACF,IAAIM,WAAE,CAACC,UAAU,CAACuB,YAAY;gBAC5B,OAAOA;YACT;QACF,EAAE,OAAO3C,GAAG;QACV,SAAS;QACX;IACF;IAEA,OAAO;AACT"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/resolveESM.ts"],"sourcesContent":["/**\n * Unified ESM resolver\n *\n * Handles both:\n * - Package exports: import x from 'lodash' → uses exports field\n * - Subpath imports: import x from '#internal' → uses imports field\n *\n * Uses resolve.exports.resolve() which automatically detects the specifier type.\n * Only loaded on Node >= 12.2 where module.createRequire exists.\n */\n\nimport fs from 'fs';\nimport Module from 'module';\nimport findRoot from 'module-root-sync';\nimport path from 'path';\n\n// Lazy-load resolve.exports\ntype ResolveExportsModule = typeof import('resolve.exports');\nlet _resolveExports: ResolveExportsModule | null = null;\n\nfunction getResolveExports(): ResolveExportsModule | null {\n if (_resolveExports === null) {\n try {\n const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n _resolveExports = _require('resolve.exports') as ResolveExportsModule;\n } catch (_) {\n _resolveExports = null;\n }\n }\n return _resolveExports;\n}\n\n/**\n * Parse a specifier into package name and subpath\n * \"lodash\" → { pkgName: \"lodash\", subpath: \".\" }\n * \"lodash/get\" → { pkgName: \"lodash\", subpath: \"./get\" }\n * \"@scope/pkg\" → { pkgName: \"@scope/pkg\", subpath: \".\" }\n * \"@scope/pkg/foo\" → { pkgName: \"@scope/pkg\", subpath: \"./foo\" }\n */\nfunction parseSpecifier(specifier: string): { pkgName: string; subpath: string } {\n const parts = specifier.split('/');\n const pkgName = specifier[0] === '@' ? parts.slice(0, 2).join('/') : parts[0];\n const remainder = specifier.slice(pkgName.length);\n const subpath = remainder ? `.${remainder}` : '.';\n return { pkgName, subpath };\n}\n\n/**\n * Find package.json in node_modules for external packages\n */\nfunction findPackageInNodeModules(pkgName: string, basedir: string): { dir: string; json: Record<string, unknown> } | null {\n let dir = basedir;\n const root = path.parse(dir).root;\n\n while (dir !== root) {\n const pkgDir = path.join(dir, 'node_modules', pkgName);\n const pkgJsonPath = path.join(pkgDir, 'package.json');\n try {\n if (fs.existsSync(pkgJsonPath)) {\n const content = fs.readFileSync(pkgJsonPath, 'utf8');\n return { dir: pkgDir, json: JSON.parse(content) };\n }\n } catch (_) {\n // Ignore filesystem errors\n }\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n\n return null;\n}\n\n/**\n * Resolve an ESM specifier to an absolute file path\n *\n * @param specifier - The import specifier (e.g., 'lodash', 'lodash/get', '#internal')\n * @param parentPath - The file path of the importing module\n * @param conditions - Export conditions (defaults to ['node', 'import'])\n * @returns The resolved absolute file path, or null if not resolvable\n */\nexport default function resolveESM(specifier: string, parentPath: string, conditions: string[] = ['node', 'import']): string | null {\n const resolveExportsMod = getResolveExports();\n if (!resolveExportsMod) {\n return null;\n }\n\n const { resolve: resolveFn, legacy } = resolveExportsMod;\n\n // Determine how to find the package.json based on specifier type\n let pkg: { dir: string; json: Record<string, unknown> } | null;\n let subpath: string;\n\n if (specifier.startsWith('#')) {\n // Subpath import - find containing package\n try {\n const dir = findRoot(parentPath, { includeSynthetic: true });\n const pkgJsonPath = path.join(dir, 'package.json');\n const content = fs.readFileSync(pkgJsonPath, 'utf8');\n pkg = { dir, json: JSON.parse(content) };\n } catch (_) {\n pkg = null;\n }\n subpath = specifier; // resolve.exports expects the full #specifier\n } else {\n // External package - find in node_modules\n const { pkgName, subpath: parsedSubpath } = parseSpecifier(specifier);\n pkg = findPackageInNodeModules(pkgName, parentPath);\n subpath = parsedSubpath;\n }\n\n if (!pkg) {\n return null;\n }\n\n // Use resolve.exports.resolve() which handles both exports and imports\n try {\n const resolved = resolveFn(pkg.json, subpath, { conditions });\n if (resolved?.[0]) {\n return path.join(pkg.dir, resolved[0]);\n }\n } catch (_) {\n // Resolution failed, try legacy\n }\n\n // Try legacy main/module fields for non-# imports\n if (!specifier.startsWith('#')) {\n try {\n const legacyMain = legacy(pkg.json);\n if (legacyMain) {\n let mainPath: string | undefined;\n if (typeof legacyMain === 'string') {\n mainPath = legacyMain;\n } else if (Array.isArray(legacyMain)) {\n mainPath = legacyMain[0];\n }\n if (mainPath) {\n return path.join(pkg.dir, mainPath);\n }\n }\n } catch (_) {\n // Legacy parsing failed\n }\n\n // Last resort: try index.js\n const indexPath = path.join(pkg.dir, 'index.js');\n try {\n if (fs.existsSync(indexPath)) {\n return indexPath;\n }\n } catch (_) {\n // Ignore\n }\n }\n\n return null;\n}\n"],"names":["resolveESM","_resolveExports","getResolveExports","_require","require","Module","createRequire","_","parseSpecifier","specifier","parts","split","pkgName","slice","join","remainder","length","subpath","findPackageInNodeModules","basedir","dir","root","path","parse","pkgDir","pkgJsonPath","fs","existsSync","content","readFileSync","json","JSON","parent","dirname","parentPath","conditions","resolveExportsMod","resolve","resolveFn","legacy","pkg","startsWith","findRoot","includeSynthetic","parsedSubpath","resolved","legacyMain","mainPath","Array","isArray","indexPath"],"mappings":"AAAA;;;;;;;;;CASC;;;;+BAgED;;;;;;;CAOC,GACD;;;eAAwBA;;;yDAtET;6DACI;qEACE;2DACJ;;;;;;AAIjB,IAAIC,kBAA+C;AAEnD,SAASC;IACP,IAAID,oBAAoB,MAAM;QAC5B,IAAI;YACF,IAAME,WAAW,OAAOC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AWD;gBACb,OAAO,IAAIE,MAAMC,OAAO,CAACH,aAAa;oBACpCC,WAAWD,UAAU,CAAC,EAAE;gBAC1B;gBACA,IAAIC,UAAU;oBACZ,OAAOzB,aAAI,CAACR,IAAI,CAAC0B,IAAIpB,GAAG,EAAE2B;gBAC5B;YACF;QACF,EAAE,OAAOxC,GAAG;QACV,wBAAwB;QAC1B;QAEA,4BAA4B;QAC5B,IAAM2C,YAAY5B,aAAI,CAACR,IAAI,CAAC0B,IAAIpB,GAAG,EAAE;QACrC,IAAI;YACF,IAAIM,WAAE,CAACC,UAAU,CAACuB,YAAY;gBAC5B,OAAOA;YACT;QACF,EAAE,OAAO3C,GAAG;QACV,SAAS;QACX;IACF;IAEA,OAAO;AACT"}
@@ -63,15 +63,12 @@ function transformDirectory(src, dest, type, options, callback) {
63
63
  if (typeof src !== 'string') throw new Error('transformDirectory: unexpected source');
64
64
  if (typeof dest !== 'string') throw new Error('transformDirectory: unexpected destination directory');
65
65
  if (typeof type !== 'string') throw new Error('transformDirectory: unexpected type');
66
- if (typeof options === 'function') {
67
- callback = options;
68
- options = undefined;
69
- }
70
- var baseOpts = options || {};
71
- var tsconfig = baseOpts.tsconfig ? baseOpts.tsconfig : (0, _readtsconfigsync.default)(src);
66
+ callback = typeof options === 'function' ? options : callback;
67
+ options = typeof options === 'function' ? {} : options || {};
68
+ var tsconfig = options.tsconfig ? options.tsconfig : (0, _readtsconfigsync.default)(src);
72
69
  var opts = _object_spread({
73
70
  tsconfig: tsconfig
74
- }, baseOpts);
71
+ }, options);
75
72
  if (typeof callback === 'function') return worker(src, dest, type, opts, callback);
76
73
  return new Promise(function(resolve, reject) {
77
74
  return worker(src, dest, type, opts, function(err, result) {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformDirectory.ts"],"sourcesContent":["import Module from 'module';\nimport { bind } from 'node-version-call';\nimport path from 'path';\nimport loadConfigSync from 'read-tsconfig-sync';\nimport url from 'url';\n\nimport type { ConfigOptions, TargetType, TransformDirectoryCallback } from './types.ts';\n\nconst major = +process.versions.node.split('.')[0];\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformDirectory.js');\n\nfunction run(src: string, dest: string, type: TargetType, options: ConfigOptions, callback: TransformDirectoryCallback) {\n return _require(workerPath)(src, dest, type, options, callback);\n}\n\n// spawnOptions: false - no node/npm spawn (library call only)\nconst worker = major >= 20 ? run : bind('>=20', workerPath, { callbacks: true, spawnOptions: false });\n\nexport default function transformDirectory(src: string, dest: string, type: TargetType, callback: TransformDirectoryCallback): void;\nexport default function transformDirectory(src: string, dest: string, type: TargetType, options: ConfigOptions, callback: TransformDirectoryCallback): void;\nexport default function transformDirectory(src: string, dest: string, type: TargetType): Promise<string[]>;\nexport default function transformDirectory(src: string, dest: string, type: TargetType, options: ConfigOptions): Promise<string[]>;\nexport default function transformDirectory(src: string, dest: string, type: TargetType, options?: ConfigOptions | TransformDirectoryCallback, callback?: TransformDirectoryCallback): void | 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;\n options = undefined;\n }\n const baseOpts = (options || {}) as ConfigOptions;\n const tsconfig = baseOpts.tsconfig ? baseOpts.tsconfig : loadConfigSync(src);\n const opts: ConfigOptions = { tsconfig, ...baseOpts };\n\n if (typeof callback === 'function') return worker(src, dest, type, opts, callback);\n return new Promise((resolve, reject) =>\n worker(src, dest, type, opts, (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","_require","require","Module","createRequire","__dirname","path","dirname","__filename","url","fileURLToPath","workerPath","join","run","src","dest","type","options","callback","worker","bind","callbacks","spawnOptions","Error","undefined","baseOpts","tsconfig","loadConfigSync","opts","Promise","resolve","reject","err","result"],"mappings":";;;;+BAwBA;;;eAAwBA;;;6DAxBL;+BACE;2DACJ;uEACU;0DACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIhB,IAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,aAAaL,aAAI,CAACM,IAAI,CAACP,WAAW,MAAM,OAAO,WAAW;AAEhE,SAASQ,IAAIC,GAAW,EAAEC,IAAY,EAAEC,IAAgB,EAAEC,OAAsB,EAAEC,QAAoC;IACpH,OAAOjB,SAASU,YAAYG,KAAKC,MAAMC,MAAMC,SAASC;AACxD;AAEA,8DAA8D;AAC9D,IAAMC,SAASvB,SAAS,KAAKiB,MAAMO,IAAAA,qBAAI,EAAC,QAAQT,YAAY;IAAEU,WAAW;IAAMC,cAAc;AAAM;AAMpF,SAAS3B,mBAAmBmB,GAAW,EAAEC,IAAY,EAAEC,IAAgB,EAAEC,OAAoD,EAAEC,QAAqC;IACjL,IAAI;QACF,IAAI,OAAOJ,QAAQ,UAAU,MAAM,IAAIS,MAAM;QAC7C,IAAI,OAAOR,SAAS,UAAU,MAAM,IAAIQ,MAAM;QAC9C,IAAI,OAAOP,SAAS,UAAU,MAAM,IAAIO,MAAM;QAE9C,IAAI,OAAON,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAUO;QACZ;QACA,IAAMC,WAAYR,WAAW,CAAC;QAC9B,IAAMS,WAAWD,SAASC,QAAQ,GAAGD,SAASC,QAAQ,GAAGC,IAAAA,yBAAc,EAACb;QACxE,IAAMc,OAAsB;YAAEF,UAAAA;WAAaD;QAE3C,IAAI,OAAOP,aAAa,YAAY,OAAOC,OAAOL,KAAKC,MAAMC,MAAMY,MAAMV;QACzE,OAAO,IAAIW,QAAQ,SAACC,SAASC;mBAC3BZ,OAAOL,KAAKC,MAAMC,MAAMY,MAAM,SAACI,KAAKC;gBAClCD,MAAMD,OAAOC,OAAOF,QAAQG;YAC9B;;IAEJ,EAAE,OAAOD,KAAK;QACZ,IAAId,UAAUA,SAASc;aAClB,OAAOH,QAAQE,MAAM,CAACC;IAC7B;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformDirectory.ts"],"sourcesContent":["import Module from 'module';\nimport { bind } from 'node-version-call';\nimport path from 'path';\nimport loadConfigSync from 'read-tsconfig-sync';\nimport url from 'url';\n\nimport type { ConfigOptions, TargetType, TransformDirectoryCallback } from './types.ts';\n\nconst major = +process.versions.node.split('.')[0];\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformDirectory.js');\n\nfunction run(src: string, dest: string, type: TargetType, options: ConfigOptions, callback: TransformDirectoryCallback) {\n return _require(workerPath)(src, dest, type, options, callback);\n}\n\n// spawnOptions: false - no node/npm spawn (library call only)\nconst worker = major >= 20 ? run : bind('>=20', workerPath, { callbacks: true, spawnOptions: false });\n\nexport default function transformDirectory(src: string, dest: string, type: TargetType, callback: TransformDirectoryCallback): void;\nexport default function transformDirectory(src: string, dest: string, type: TargetType, options: ConfigOptions, callback: TransformDirectoryCallback): void;\nexport default function transformDirectory(src: string, dest: string, type: TargetType): Promise<string[]>;\nexport default function transformDirectory(src: string, dest: string, type: TargetType, options: ConfigOptions): Promise<string[]>;\nexport default function transformDirectory(src: string, dest: string, type: TargetType, options?: ConfigOptions | TransformDirectoryCallback, callback?: TransformDirectoryCallback): void | 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 callback = typeof options === 'function' ? options : callback;\n options = typeof options === 'function' ? {} : ((options || {}) as ConfigOptions);\n const tsconfig = options.tsconfig ? options.tsconfig : loadConfigSync(src);\n const opts: ConfigOptions = { tsconfig, ...options };\n\n if (typeof callback === 'function') return worker(src, dest, type, opts, callback);\n return new Promise((resolve, reject) =>\n worker(src, dest, type, opts, (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","_require","require","Module","createRequire","__dirname","path","dirname","__filename","url","fileURLToPath","workerPath","join","run","src","dest","type","options","callback","worker","bind","callbacks","spawnOptions","Error","tsconfig","loadConfigSync","opts","Promise","resolve","reject","err","result"],"mappings":";;;;+BAwBA;;;eAAwBA;;;6DAxBL;+BACE;2DACJ;uEACU;0DACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIhB,IAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,aAAaL,aAAI,CAACM,IAAI,CAACP,WAAW,MAAM,OAAO,WAAW;AAEhE,SAASQ,IAAIC,GAAW,EAAEC,IAAY,EAAEC,IAAgB,EAAEC,OAAsB,EAAEC,QAAoC;IACpH,OAAOjB,SAASU,YAAYG,KAAKC,MAAMC,MAAMC,SAASC;AACxD;AAEA,8DAA8D;AAC9D,IAAMC,SAASvB,SAAS,KAAKiB,MAAMO,IAAAA,qBAAI,EAAC,QAAQT,YAAY;IAAEU,WAAW;IAAMC,cAAc;AAAM;AAMpF,SAAS3B,mBAAmBmB,GAAW,EAAEC,IAAY,EAAEC,IAAgB,EAAEC,OAAoD,EAAEC,QAAqC;IACjL,IAAI;QACF,IAAI,OAAOJ,QAAQ,UAAU,MAAM,IAAIS,MAAM;QAC7C,IAAI,OAAOR,SAAS,UAAU,MAAM,IAAIQ,MAAM;QAC9C,IAAI,OAAOP,SAAS,UAAU,MAAM,IAAIO,MAAM;QAE9CL,WAAW,OAAOD,YAAY,aAAaA,UAAUC;QACrDD,UAAU,OAAOA,YAAY,aAAa,CAAC,IAAMA,WAAW,CAAC;QAC7D,IAAMO,WAAWP,QAAQO,QAAQ,GAAGP,QAAQO,QAAQ,GAAGC,IAAAA,yBAAc,EAACX;QACtE,IAAMY,OAAsB;YAAEF,UAAAA;WAAaP;QAE3C,IAAI,OAAOC,aAAa,YAAY,OAAOC,OAAOL,KAAKC,MAAMC,MAAMU,MAAMR;QACzE,OAAO,IAAIS,QAAQ,SAACC,SAASC;mBAC3BV,OAAOL,KAAKC,MAAMC,MAAMU,MAAM,SAACI,KAAKC;gBAClCD,MAAMD,OAAOC,OAAOF,QAAQG;YAC9B;;IAEJ,EAAE,OAAOD,KAAK;QACZ,IAAIZ,UAAUA,SAASY;aAClB,OAAOH,QAAQE,MAAM,CAACC;IAC7B;AACF"}
@@ -26,7 +26,7 @@ function run(contents, fileName, tsconfig) {
26
26
  return _require(workerPath)(contents, fileName, tsconfig);
27
27
  }
28
28
  // spawnOptions: false - no node/npm spawn (library call only)
29
- var worker = major >= 20 ? run : (0, _nodeversioncall.bind)('>=20', workerPath, {
29
+ var worker = major >= 20 ? run : (0, _nodeversioncall.bindSync)('>=20', workerPath, {
30
30
  spawnOptions: false
31
31
  });
32
32
  function transformSync(contents, fileName, tsconfig) {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformSync.ts"],"sourcesContent":["import Module from 'module';\nimport { bind } from 'node-version-call';\nimport 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 _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformSync.js');\n\nfunction run(contents: string, fileName: string, tsconfig: TSConfig) {\n return _require(workerPath)(contents, fileName, tsconfig);\n}\n\n// spawnOptions: false - no node/npm spawn (library call only)\nconst worker = major >= 20 ? run : bind('>=20', workerPath, { spawnOptions: false });\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('transformSync: unexpected contents');\n if (typeof fileName !== 'string') throw new Error('transformSync: unexpected fileName');\n if (!tsconfig) tsconfig = loadConfigSync(process.cwd());\n return worker(contents, fileName, tsconfig) as Output;\n}\n"],"names":["transformSync","major","process","versions","node","split","_require","require","Module","createRequire","__dirname","path","dirname","__filename","url","fileURLToPath","workerPath","join","run","contents","fileName","tsconfig","worker","bind","spawnOptions","Error","loadConfigSync","cwd"],"mappings":";;;;+BAqBA;;;eAAwBA;;;6DArBL;+BACE;2DACJ;uEACU;0DACX;;;;;;AAIhB,IAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,aAAaL,aAAI,CAACM,IAAI,CAACP,WAAW,MAAM,OAAO,WAAW;AAEhE,SAASQ,IAAIC,QAAgB,EAAEC,QAAgB,EAAEC,QAAkB;IACjE,OAAOf,SAASU,YAAYG,UAAUC,UAAUC;AAClD;AAEA,8DAA8D;AAC9D,IAAMC,SAASrB,SAAS,KAAKiB,MAAMK,IAAAA,qBAAI,EAAC,QAAQP,YAAY;IAAEQ,cAAc;AAAM;AAGnE,SAASxB,cAAcmB,QAAgB,EAAEC,QAAgB,EAAEC,QAAmB;IAC3F,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAIM,MAAM;IAClD,IAAI,OAAOL,aAAa,UAAU,MAAM,IAAIK,MAAM;IAClD,IAAI,CAACJ,UAAUA,WAAWK,IAAAA,yBAAc,EAACxB,QAAQyB,GAAG;IACpD,OAAOL,OAAOH,UAAUC,UAAUC;AACpC"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformSync.ts"],"sourcesContent":["import Module from 'module';\nimport { bindSync } from 'node-version-call';\nimport 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 _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformSync.js');\n\nfunction run(contents: string, fileName: string, tsconfig: TSConfig) {\n return _require(workerPath)(contents, fileName, tsconfig);\n}\n\n// spawnOptions: false - no node/npm spawn (library call only)\nconst worker = major >= 20 ? run : bindSync('>=20', workerPath, { spawnOptions: false });\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('transformSync: unexpected contents');\n if (typeof fileName !== 'string') throw new Error('transformSync: unexpected fileName');\n if (!tsconfig) tsconfig = loadConfigSync(process.cwd());\n return worker(contents, fileName, tsconfig) as Output;\n}\n"],"names":["transformSync","major","process","versions","node","split","_require","require","Module","createRequire","__dirname","path","dirname","__filename","url","fileURLToPath","workerPath","join","run","contents","fileName","tsconfig","worker","bindSync","spawnOptions","Error","loadConfigSync","cwd"],"mappings":";;;;+BAqBA;;;eAAwBA;;;6DArBL;+BACM;2DACR;uEACU;0DACX;;;;;;AAIhB,IAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,aAAaL,aAAI,CAACM,IAAI,CAACP,WAAW,MAAM,OAAO,WAAW;AAEhE,SAASQ,IAAIC,QAAgB,EAAEC,QAAgB,EAAEC,QAAkB;IACjE,OAAOf,SAASU,YAAYG,UAAUC,UAAUC;AAClD;AAEA,8DAA8D;AAC9D,IAAMC,SAASrB,SAAS,KAAKiB,MAAMK,IAAAA,yBAAQ,EAAC,QAAQP,YAAY;IAAEQ,cAAc;AAAM;AAGvE,SAASxB,cAAcmB,QAAgB,EAAEC,QAAgB,EAAEC,QAAmB;IAC3F,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAIM,MAAM;IAClD,IAAI,OAAOL,aAAa,UAAU,MAAM,IAAIK,MAAM;IAClD,IAAI,CAACJ,UAAUA,WAAWK,IAAAA,yBAAc,EAACxB,QAAQyB,GAAG;IACpD,OAAOL,OAAOH,UAAUC,UAAUC;AACpC"}
@@ -62,19 +62,16 @@ function transformTypes(src, dest, options, callback) {
62
62
  try {
63
63
  if (typeof src !== 'string') throw new Error('transformTypes: unexpected source');
64
64
  if (typeof dest !== 'string') throw new Error('transformTypes: unexpected destination directory');
65
- if (typeof options === 'function') {
66
- callback = options;
67
- options = undefined;
68
- }
69
- var baseOpts = options || {};
70
- var tsconfig = baseOpts.tsconfig ? baseOpts.tsconfig : (0, _readtsconfigsync.default)(src);
65
+ callback = typeof options === 'function' ? options : callback;
66
+ options = typeof options === 'function' ? {} : options || {};
67
+ var tsconfig = options.tsconfig ? options.tsconfig : (0, _readtsconfigsync.default)(src);
71
68
  var opts = _object_spread({
72
69
  tsconfig: tsconfig
73
- }, baseOpts);
70
+ }, options);
74
71
  if (typeof callback === 'function') return worker(src, dest, opts, callback);
75
72
  return new Promise(function(resolve, reject) {
76
73
  return worker(src, dest, opts, function(err, result) {
77
- return err ? reject(err) : resolve(result);
74
+ err ? reject(err) : resolve(result);
78
75
  });
79
76
  });
80
77
  } catch (err) {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformTypes.ts"],"sourcesContent":["import Module from 'module';\nimport { bind } from 'node-version-call';\nimport path from 'path';\nimport loadConfigSync from 'read-tsconfig-sync';\nimport url from 'url';\n\nimport type { ConfigOptions, TransformTypesCallback } from './types.ts';\n\nconst major = +process.versions.node.split('.')[0];\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformTypes.js');\n\nfunction run(src: string, dest: string, options: ConfigOptions, callback: TransformTypesCallback) {\n return _require(workerPath)(src, dest, options, callback);\n}\n\n// spawnOptions: false - no node/npm spawn (library call only)\nconst worker = major >= 20 ? run : bind('>=20', workerPath, { callbacks: true, spawnOptions: false });\n\nexport default function transformTypes(src: string, dest: string, callback: TransformTypesCallback): void;\nexport default function transformTypes(src: string, dest: string, options: ConfigOptions, callback: TransformTypesCallback): void;\nexport default function transformTypes(src: string, dest: string): Promise<string[]>;\nexport default function transformTypes(src: string, dest: string, options: ConfigOptions): Promise<string[]>;\nexport default function transformTypes(src: string, dest: string, options?: ConfigOptions | TransformTypesCallback, callback?: TransformTypesCallback): void | 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;\n options = undefined;\n }\n const baseOpts = (options || {}) as ConfigOptions;\n const tsconfig = baseOpts.tsconfig ? baseOpts.tsconfig : loadConfigSync(src);\n const opts: ConfigOptions = { tsconfig, ...baseOpts };\n\n if (typeof callback === 'function') return worker(src, dest, opts, callback);\n return new Promise((resolve, reject) => worker(src, dest, opts, (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","_require","require","Module","createRequire","__dirname","path","dirname","__filename","url","fileURLToPath","workerPath","join","run","src","dest","options","callback","worker","bind","callbacks","spawnOptions","Error","undefined","baseOpts","tsconfig","loadConfigSync","opts","Promise","resolve","reject","err","result"],"mappings":";;;;+BAwBA;;;eAAwBA;;;6DAxBL;+BACE;2DACJ;uEACU;0DACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIhB,IAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,aAAaL,aAAI,CAACM,IAAI,CAACP,WAAW,MAAM,OAAO,WAAW;AAEhE,SAASQ,IAAIC,GAAW,EAAEC,IAAY,EAAEC,OAAsB,EAAEC,QAAgC;IAC9F,OAAOhB,SAASU,YAAYG,KAAKC,MAAMC,SAASC;AAClD;AAEA,8DAA8D;AAC9D,IAAMC,SAAStB,SAAS,KAAKiB,MAAMM,IAAAA,qBAAI,EAAC,QAAQR,YAAY;IAAES,WAAW;IAAMC,cAAc;AAAM;AAMpF,SAAS1B,eAAemB,GAAW,EAAEC,IAAY,EAAEC,OAAgD,EAAEC,QAAiC;IACnJ,IAAI;QACF,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIQ,MAAM;QAC7C,IAAI,OAAOP,SAAS,UAAU,MAAM,IAAIO,MAAM;QAE9C,IAAI,OAAON,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAUO;QACZ;QACA,IAAMC,WAAYR,WAAW,CAAC;QAC9B,IAAMS,WAAWD,SAASC,QAAQ,GAAGD,SAASC,QAAQ,GAAGC,IAAAA,yBAAc,EAACZ;QACxE,IAAMa,OAAsB;YAAEF,UAAAA;WAAaD;QAE3C,IAAI,OAAOP,aAAa,YAAY,OAAOC,OAAOJ,KAAKC,MAAMY,MAAMV;QACnE,OAAO,IAAIW,QAAQ,SAACC,SAASC;mBAAWZ,OAAOJ,KAAKC,MAAMY,MAAM,SAACI,KAAKC;uBAAYD,MAAMD,OAAOC,OAAOF,QAAQG;;;IAChH,EAAE,OAAOD,KAAK;QACZ,IAAId,UAAUA,SAASc;aAClB,OAAOH,QAAQE,MAAM,CAACC;IAC7B;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformTypes.ts"],"sourcesContent":["import Module from 'module';\nimport { bind } from 'node-version-call';\nimport path from 'path';\nimport loadConfigSync from 'read-tsconfig-sync';\nimport url from 'url';\n\nimport type { ConfigOptions, TransformTypesCallback } from './types.ts';\n\nconst major = +process.versions.node.split('.')[0];\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformTypes.js');\n\nfunction run(src: string, dest: string, options: ConfigOptions, callback: TransformTypesCallback) {\n return _require(workerPath)(src, dest, options, callback);\n}\n\n// spawnOptions: false - no node/npm spawn (library call only)\nconst worker = major >= 20 ? run : bind('>=20', workerPath, { callbacks: true, spawnOptions: false });\n\nexport default function transformTypes(src: string, dest: string, callback: TransformTypesCallback): void;\nexport default function transformTypes(src: string, dest: string, options: ConfigOptions, callback: TransformTypesCallback): void;\nexport default function transformTypes(src: string, dest: string): Promise<string[]>;\nexport default function transformTypes(src: string, dest: string, options: ConfigOptions): Promise<string[]>;\nexport default function transformTypes(src: string, dest: string, options?: ConfigOptions | TransformTypesCallback, callback?: TransformTypesCallback): void | 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 callback = typeof options === 'function' ? options : callback;\n options = typeof options === 'function' ? {} : ((options || {}) as ConfigOptions);\n const tsconfig = options.tsconfig ? options.tsconfig : loadConfigSync(src);\n const opts: ConfigOptions = { tsconfig, ...options };\n\n if (typeof callback === 'function') return worker(src, dest, opts, callback);\n return new Promise((resolve, reject) =>\n worker(src, dest, opts, (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":["transformTypes","major","process","versions","node","split","_require","require","Module","createRequire","__dirname","path","dirname","__filename","url","fileURLToPath","workerPath","join","run","src","dest","options","callback","worker","bind","callbacks","spawnOptions","Error","tsconfig","loadConfigSync","opts","Promise","resolve","reject","err","result"],"mappings":";;;;+BAwBA;;;eAAwBA;;;6DAxBL;+BACE;2DACJ;uEACU;0DACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIhB,IAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,WAAW,OAAOC,YAA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Require exists.
10
10
  */ import fs from 'fs';
11
11
  import Module from 'module';
12
+ import findRoot from 'module-root-sync';
12
13
  import path from 'path';
13
14
  let _resolveExports = null;
14
15
  function getResolveExports() {
@@ -63,31 +64,6 @@ function getResolveExports() {
63
64
  }
64
65
  return null;
65
66
  }
66
- /**
67
- * Find the containing package.json by walking up from a file path
68
- * Used for # subpath imports which are scoped to the containing package
69
- */ function findContainingPackage(filePath) {
70
- let dir = path.dirname(filePath);
71
- const root = path.parse(dir).root;
72
- while(dir !== root){
73
- const pkgJsonPath = path.join(dir, 'package.json');
74
- try {
75
- if (fs.existsSync(pkgJsonPath)) {
76
- const content = fs.readFileSync(pkgJsonPath, 'utf8');
77
- return {
78
- dir,
79
- json: JSON.parse(content)
80
- };
81
- }
82
- } catch (_) {
83
- // Ignore filesystem errors
84
- }
85
- const parent = path.dirname(dir);
86
- if (parent === dir) break;
87
- dir = parent;
88
- }
89
- return null;
90
- }
91
67
  /**
92
68
  * Resolve an ESM specifier to an absolute file path
93
69
  *
@@ -109,7 +85,19 @@ function getResolveExports() {
109
85
  let subpath;
110
86
  if (specifier.startsWith('#')) {
111
87
  // Subpath import - find containing package
112
- pkg = findContainingPackage(parentPath);
88
+ try {
89
+ const dir = findRoot(parentPath, {
90
+ includeSynthetic: true
91
+ });
92
+ const pkgJsonPath = path.join(dir, 'package.json');
93
+ const content = fs.readFileSync(pkgJsonPath, 'utf8');
94
+ pkg = {
95
+ dir,
96
+ json: JSON.parse(content)
97
+ };
98
+ } catch (_) {
99
+ pkg = null;
100
+ }
113
101
  subpath = specifier; // resolve.exports expects the full #specifier
114
102
  } else {
115
103
  // External package - find in node_modules
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/resolveESM.ts"],"sourcesContent":["/**\n * Unified ESM resolver\n *\n * Handles both:\n * - Package exports: import x from 'lodash' → uses exports field\n * - Subpath imports: import x from '#internal' → uses imports field\n *\n * Uses resolve.exports.resolve() which automatically detects the specifier type.\n * Only loaded on Node >= 12.2 where module.createRequire exists.\n */\n\nimport fs from 'fs';\nimport Module from 'module';\nimport path from 'path';\n\n// Lazy-load resolve.exports\ntype ResolveExportsModule = typeof import('resolve.exports');\nlet _resolveExports: ResolveExportsModule | null = null;\n\nfunction getResolveExports(): ResolveExportsModule | null {\n if (_resolveExports === null) {\n try {\n const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n _resolveExports = _require('resolve.exports') as ResolveExportsModule;\n } catch (_) {\n _resolveExports = null;\n }\n }\n return _resolveExports;\n}\n\n/**\n * Parse a specifier into package name and subpath\n * \"lodash\" → { pkgName: \"lodash\", subpath: \".\" }\n * \"lodash/get\" → { pkgName: \"lodash\", subpath: \"./get\" }\n * \"@scope/pkg\" → { pkgName: \"@scope/pkg\", subpath: \".\" }\n * \"@scope/pkg/foo\" → { pkgName: \"@scope/pkg\", subpath: \"./foo\" }\n */\nfunction parseSpecifier(specifier: string): { pkgName: string; subpath: string } {\n const parts = specifier.split('/');\n const pkgName = specifier[0] === '@' ? parts.slice(0, 2).join('/') : parts[0];\n const remainder = specifier.slice(pkgName.length);\n const subpath = remainder ? `.${remainder}` : '.';\n return { pkgName, subpath };\n}\n\n/**\n * Find package.json in node_modules for external packages\n */\nfunction findPackageInNodeModules(pkgName: string, basedir: string): { dir: string; json: Record<string, unknown> } | null {\n let dir = basedir;\n const root = path.parse(dir).root;\n\n while (dir !== root) {\n const pkgDir = path.join(dir, 'node_modules', pkgName);\n const pkgJsonPath = path.join(pkgDir, 'package.json');\n try {\n if (fs.existsSync(pkgJsonPath)) {\n const content = fs.readFileSync(pkgJsonPath, 'utf8');\n return { dir: pkgDir, json: JSON.parse(content) };\n }\n } catch (_) {\n // Ignore filesystem errors\n }\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n\n return null;\n}\n\n/**\n * Find the containing package.json by walking up from a file path\n * Used for # subpath imports which are scoped to the containing package\n */\nfunction findContainingPackage(filePath: string): { dir: string; json: Record<string, unknown> } | null {\n let dir = path.dirname(filePath);\n const root = path.parse(dir).root;\n\n while (dir !== root) {\n const pkgJsonPath = path.join(dir, 'package.json');\n try {\n if (fs.existsSync(pkgJsonPath)) {\n const content = fs.readFileSync(pkgJsonPath, 'utf8');\n return { dir, json: JSON.parse(content) };\n }\n } catch (_) {\n // Ignore filesystem errors\n }\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n\n return null;\n}\n\n/**\n * Resolve an ESM specifier to an absolute file path\n *\n * @param specifier - The import specifier (e.g., 'lodash', 'lodash/get', '#internal')\n * @param parentPath - The file path of the importing module\n * @param conditions - Export conditions (defaults to ['node', 'import'])\n * @returns The resolved absolute file path, or null if not resolvable\n */\nexport default function resolveESM(specifier: string, parentPath: string, conditions: string[] = ['node', 'import']): string | null {\n const resolveExportsMod = getResolveExports();\n if (!resolveExportsMod) {\n return null;\n }\n\n const { resolve: resolveFn, legacy } = resolveExportsMod;\n\n // Determine how to find the package.json based on specifier type\n let pkg: { dir: string; json: Record<string, unknown> } | null;\n let subpath: string;\n\n if (specifier.startsWith('#')) {\n // Subpath import - find containing package\n pkg = findContainingPackage(parentPath);\n subpath = specifier; // resolve.exports expects the full #specifier\n } else {\n // External package - find in node_modules\n const { pkgName, subpath: parsedSubpath } = parseSpecifier(specifier);\n pkg = findPackageInNodeModules(pkgName, parentPath);\n subpath = parsedSubpath;\n }\n\n if (!pkg) {\n return null;\n }\n\n // Use resolve.exports.resolve() which handles both exports and imports\n try {\n const resolved = resolveFn(pkg.json, subpath, { conditions });\n if (resolved?.[0]) {\n return path.join(pkg.dir, resolved[0]);\n }\n } catch (_) {\n // Resolution failed, try legacy\n }\n\n // Try legacy main/module fields for non-# imports\n if (!specifier.startsWith('#')) {\n try {\n const legacyMain = legacy(pkg.json);\n if (legacyMain) {\n let mainPath: string | undefined;\n if (typeof legacyMain === 'string') {\n mainPath = legacyMain;\n } else if (Array.isArray(legacyMain)) {\n mainPath = legacyMain[0];\n }\n if (mainPath) {\n return path.join(pkg.dir, mainPath);\n }\n }\n } catch (_) {\n // Legacy parsing failed\n }\n\n // Last resort: try index.js\n const indexPath = path.join(pkg.dir, 'index.js');\n try {\n if (fs.existsSync(indexPath)) {\n return indexPath;\n }\n } catch (_) {\n // Ignore\n }\n }\n\n return null;\n}\n"],"names":["fs","Module","path","_resolveExports","getResolveExports","_require","require","createRequire","url","_","parseSpecifier","specifier","parts","split","pkgName","slice","join","remainder","length","subpath","findPackageInNodeModules","basedir","dir","root","parse","pkgDir","pkgJsonPath","existsSync","content","readFileSync","json","JSON","parent","dirname","findContainingPackage","filePath","resolveESM","parentPath","conditions","resolveExportsMod","resolve","resolveFn","legacy","pkg","startsWith","parsedSubpath","resolved","legacyMain","mainPath","Array","isArray","indexPath"],"mappings":"AAAA;;;;;;;;;CASC,GAED,OAAOA,QAAQ,KAAK;AACpB,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,OAAO;AAIxB,IAAIC,kBAA+C;AAEnD,SAASC;IACP,IAAID,oBAAoB,MAAM;QAC5B,IAAI;YACF,MAAME,WAAW,OAAOC,YAAY,cAAcL,OAAOM,aAAa,CAAC,YAAYC,GAAG,IAAIF;YAC1FH,kBAAkBE,SAAS;QAC7B,EAAE,OAAOI,GAAG;YACVN,kBAAkB;QACpB;IACF;IACA,OAAOA;AACT;AAEA;;;;;;CAMC,GACD,SAASO,eAAeC,SAAiB;IACvC,MAAMC,QAAQD,UAAUE,KAAK,CAAC;IAC9B,MAAMC,UAAUH,SAAS,CAAC,EAAE,KAAK,MAAMC,MAAMG,KAAK,CAAC,GAAG,GAAGC,IAAI,CAAC,OAAOJ,KAAK,CAAC,EAAE;IAC7E,MAAMK,YAAYN,UAAUI,KAAK,CAACD,QAAQI,MAAM;IAChD,MAAMC,UAAUF,YAAY,CAAC,CAAC,EAAEA,WAAW,GAAG;IAC9C,OAAO;QAAEH;QAASK;IAAQ;AAC5B;AAEA;;CAEC,GACD,SAASC,y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C,IAAI;YACF,IAAItB,GAAG2B,UAAU,CAACwB,YAAY;gBAC5B,OAAOA;YACT;QACF,EAAE,OAAO1C,GAAG;QACV,SAAS;QACX;IACF;IAEA,OAAO;AACT"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/resolveESM.ts"],"sourcesContent":["/**\n * Unified ESM resolver\n *\n * Handles both:\n * - Package exports: import x from 'lodash' → uses exports field\n * - Subpath imports: import x from '#internal' → uses imports field\n *\n * Uses resolve.exports.resolve() which automatically detects the specifier type.\n * Only loaded on Node >= 12.2 where module.createRequire exists.\n */\n\nimport fs from 'fs';\nimport Module from 'module';\nimport findRoot from 'module-root-sync';\nimport path from 'path';\n\n// Lazy-load resolve.exports\ntype ResolveExportsModule = typeof import('resolve.exports');\nlet _resolveExports: ResolveExportsModule | null = null;\n\nfunction getResolveExports(): ResolveExportsModule | null {\n if (_resolveExports === null) {\n try {\n const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n _resolveExports = _require('resolve.exports') as ResolveExportsModule;\n } catch (_) {\n _resolveExports = null;\n }\n }\n return _resolveExports;\n}\n\n/**\n * Parse a specifier into package name and subpath\n * \"lodash\" → { pkgName: \"lodash\", subpath: \".\" }\n * \"lodash/get\" → { pkgName: \"lodash\", subpath: \"./get\" }\n * \"@scope/pkg\" → { pkgName: \"@scope/pkg\", subpath: \".\" }\n * \"@scope/pkg/foo\" → { pkgName: \"@scope/pkg\", subpath: \"./foo\" }\n */\nfunction parseSpecifier(specifier: string): { pkgName: string; subpath: string } {\n const parts = specifier.split('/');\n const pkgName = specifier[0] === '@' ? parts.slice(0, 2).join('/') : parts[0];\n const remainder = specifier.slice(pkgName.length);\n const subpath = remainder ? `.${remainder}` : '.';\n return { pkgName, subpath };\n}\n\n/**\n * Find package.json in node_modules for external packages\n */\nfunction findPackageInNodeModules(pkgName: string, basedir: string): { dir: string; json: Record<string, unknown> } | null {\n let dir = basedir;\n const root = path.parse(dir).root;\n\n while (dir !== root) {\n const pkgDir = path.join(dir, 'node_modules', pkgName);\n const pkgJsonPath = path.join(pkgDir, 'package.json');\n try {\n if (fs.existsSync(pkgJsonPath)) {\n const content = fs.readFileSync(pkgJsonPath, 'utf8');\n return { dir: pkgDir, json: JSON.parse(content) };\n }\n } catch (_) {\n // Ignore filesystem errors\n }\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n\n return null;\n}\n\n/**\n * Resolve an ESM specifier to an absolute file path\n *\n * @param specifier - The import specifier (e.g., 'lodash', 'lodash/get', '#internal')\n * @param parentPath - The file path of the importing module\n * @param conditions - Export conditions (defaults to ['node', 'import'])\n * @returns The resolved absolute file path, or null if not resolvable\n */\nexport default function resolveESM(specifier: string, parentPath: string, conditions: string[] = ['node', 'import']): string | null {\n const resolveExportsMod = getResolveExports();\n if (!resolveExportsMod) {\n return null;\n }\n\n const { resolve: resolveFn, legacy } = resolveExportsMod;\n\n // Determine how to find the package.json based on specifier type\n let pkg: { dir: string; json: Record<string, unknown> } | null;\n let subpath: string;\n\n if (specifier.startsWith('#')) {\n // Subpath import - find containing package\n try {\n const dir = findRoot(parentPath, { includeSynthetic: true });\n const pkgJsonPath = path.join(dir, 'package.json');\n const content = fs.readFileSync(pkgJsonPath, 'utf8');\n pkg = { dir, json: JSON.parse(content) };\n } catch (_) {\n pkg = null;\n }\n subpath = specifier; // resolve.exports expects the full #specifier\n } else {\n // External package - find in node_modules\n const { pkgName, subpath: parsedSubpath } = parseSpecifier(specifier);\n pkg = findPackageInNodeModules(pkgName, parentPath);\n subpath = parsedSubpath;\n }\n\n if (!pkg) {\n return null;\n }\n\n // Use resolve.exports.resolve() which handles both exports and imports\n try {\n const resolved = resolveFn(pkg.json, subpath, { conditions });\n if (resolved?.[0]) {\n return path.join(pkg.dir, resolved[0]);\n }\n } catch (_) {\n // Resolution failed, try legacy\n }\n\n // Try legacy main/module fields for non-# imports\n if (!specifier.startsWith('#')) {\n try {\n const legacyMain = legacy(pkg.json);\n if (legacyMain) {\n let mainPath: string | undefined;\n if (typeof legacyMain === 'string') {\n mainPath = legacyMain;\n } else if (Array.isArray(legacyMain)) {\n mainPath = legacyMain[0];\n }\n if (mainPath) {\n return path.join(pkg.dir, mainPath);\n }\n }\n } catch (_) {\n // Legacy parsing failed\n }\n\n // Last resort: try index.js\n const indexPath = path.join(pkg.dir, 'index.js');\n try {\n if (fs.existsSync(indexPath)) {\n return indexPath;\n }\n } catch (_) {\n // Ignore\n }\n }\n\n return null;\n}\n"],"names":["fs","Module","findRoot","path","_resolveExports","getResolveExports","_require","require","createRequire","url","_","parseSpecifier","specifier","parts","split","pkgName","slice","join","remainder","length","subpath","findPackageInNodeModules","basedir","dir","root","parse","pkgDir","pkgJsonPath","existsSync","content","readFileSync","json","JSON","parent","dirname","resolveESM","parentPath","conditions","resolveExportsMod","resolve","resolveFn","legacy","pkg","startsWith","includeSynthetic","parsedSubpath","resolved","legacyMain","mainPath","Array","isArray","indexPath"],"mappings":"AAAA;;;;;;;;;CASC,GAED,OAAOA,QAAQ,KAAK;AACpB,OAAOC,YAAY,SAAS;AAC5B,OAAOC,cAAc,mBAAmB;AACxC,OAAOC,UAAU,OAAO;AAIxB,IAAIC,kBAA+C;AAEnD,SAASC;IACP,IAAID,oBAAoB,MAAM;QAC5B,IAAI;YACF,MAAME,WAAW,OAAOC,YAAY,cAAcN,OAAOO,aAAa,CAAC,YAAYC,GAAG,IAAIF;YAC1FH,kBAAkBE,SAAS;QAC7B,EAAE,OAAOI,GAAG;YACVN,kBAAkB;QACpB;IACF;IACA,OAAOA;AACT;AAEA;;;;;;CAMC,GACD,SAASO,eAAeC,SAAiB;IACvC,MAAMC,QAAQD,UAAUE,KAAK,CAAC;IAC9B,MAAMC,UAAUH,SAAS,CAAC,EAAE,KAAK,MAAMC,MAAMG,KAAK,CAAC,GAAG,GAAGC,IAAI,CAAC,OAAOJ,KAAK,CAAC,EAAE;IAC7E,MAAMK,YAAYN,UAAUI,KAAK,CAACD,Q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ory(src, dest, type, options, callback) {
20
20
  if (typeof src !== 'string') throw new Error('transformDirectory: unexpected source');
21
21
  if (typeof dest !== 'string') throw new Error('transformDirectory: unexpected destination directory');
22
22
  if (typeof type !== 'string') throw new Error('transformDirectory: unexpected type');
23
- if (typeof options === 'function') {
24
- callback = options;
25
- options = undefined;
26
- }
27
- const baseOpts = options || {};
28
- const tsconfig = baseOpts.tsconfig ? baseOpts.tsconfig : loadConfigSync(src);
23
+ callback = typeof options === 'function' ? options : callback;
24
+ options = typeof options === 'function' ? {} : options || {};
25
+ const tsconfig = options.tsconfig ? options.tsconfig : loadConfigSync(src);
29
26
  const opts = {
30
27
  tsconfig,
31
- ...baseOpts
28
+ ...options
32
29
  };
33
30
  if (typeof callback === 'function') return worker(src, dest, type, opts, callback);
34
31
  return new Promise((resolve, reject)=>worker(src, dest, type, opts, (err, result)=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformDirectory.ts"],"sourcesContent":["import Module from 'module';\nimport { bind } from 'node-version-call';\nimport path from 'path';\nimport loadConfigSync from 'read-tsconfig-sync';\nimport url from 'url';\n\nimport type { ConfigOptions, TargetType, TransformDirectoryCallback } from './types.ts';\n\nconst major = +process.versions.node.split('.')[0];\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformDirectory.js');\n\nfunction run(src: string, dest: string, type: TargetType, options: ConfigOptions, callback: TransformDirectoryCallback) {\n return _require(workerPath)(src, dest, type, options, callback);\n}\n\n// spawnOptions: false - no node/npm spawn (library call only)\nconst worker = major >= 20 ? run : bind('>=20', workerPath, { callbacks: true, spawnOptions: false });\n\nexport default function transformDirectory(src: string, dest: string, type: TargetType, callback: TransformDirectoryCallback): void;\nexport default function transformDirectory(src: string, dest: string, type: TargetType, options: ConfigOptions, callback: TransformDirectoryCallback): void;\nexport default function transformDirectory(src: string, dest: string, type: TargetType): Promise<string[]>;\nexport default function transformDirectory(src: string, dest: string, type: TargetType, options: ConfigOptions): Promise<string[]>;\nexport default function transformDirectory(src: string, dest: string, type: TargetType, options?: ConfigOptions | TransformDirectoryCallback, callback?: TransformDirectoryCallback): void | 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;\n options = undefined;\n }\n const baseOpts = (options || {}) as ConfigOptions;\n const tsconfig = baseOpts.tsconfig ? baseOpts.tsconfig : loadConfigSync(src);\n const opts: ConfigOptions = { tsconfig, ...baseOpts };\n\n if (typeof callback === 'function') return worker(src, dest, type, opts, callback);\n return new Promise((resolve, reject) =>\n worker(src, dest, type, opts, (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":["Module","bind","path","loadConfigSync","url","major","process","versions","node","split","_require","require","createRequire","__dirname","dirname","__filename","fileURLToPath","workerPath","join","run","src","dest","type","options","callback","worker","callbacks","spawnOptions","transformDirectory","Error","undefined","baseOpts","tsconfig","opts","Promise","resolve","reject","err","result"],"mappings":"AAAA,OAAOA,YAAY,SAAS;AAC5B,SAASC,IAAI,QAAQ,oBAAoB;AACzC,OAAOC,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,WAAW,OAAOC,YAAY,cAAcX,OAAOY,aAAa,CAAC,YAAYR,GAAG,IAAIO;AAC1F,MAAME,YAAYX,KAAKY,OAAO,CAAC,OAAOC,eAAe,cAAcX,IA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["import Module from 'module';\nimport { bind } from 'node-version-call';\nimport path from 'path';\nimport loadConfigSync from 'read-tsconfig-sync';\nimport url from 'url';\n\nimport type { ConfigOptions, TargetType, TransformDirectoryCallback } from './types.ts';\n\nconst major = +process.versions.node.split('.')[0];\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformDirectory.js');\n\nfunction run(src: string, dest: string, type: TargetType, options: ConfigOptions, callback: TransformDirectoryCallback) {\n return _require(workerPath)(src, dest, type, options, callback);\n}\n\n// spawnOptions: false - no node/npm spawn (library call only)\nconst worker = major >= 20 ? run : bind('>=20', workerPath, { callbacks: true, spawnOptions: false });\n\nexport default function transformDirectory(src: string, dest: string, type: TargetType, callback: TransformDirectoryCallback): void;\nexport default function transformDirectory(src: string, dest: string, type: TargetType, options: ConfigOptions, callback: TransformDirectoryCallback): void;\nexport default function transformDirectory(src: string, dest: string, type: TargetType): Promise<string[]>;\nexport default function transformDirectory(src: string, dest: string, type: TargetType, options: ConfigOptions): Promise<string[]>;\nexport default function transformDirectory(src: string, dest: string, type: TargetType, options?: ConfigOptions | TransformDirectoryCallback, callback?: TransformDirectoryCallback): void | 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 callback = typeof options === 'function' ? options : callback;\n options = typeof options === 'function' ? {} : ((options || {}) as ConfigOptions);\n const tsconfig = options.tsconfig ? options.tsconfig : loadConfigSync(src);\n const opts: ConfigOptions = { tsconfig, ...options };\n\n if (typeof callback === 'function') return worker(src, dest, type, opts, callback);\n return new Promise((resolve, reject) =>\n worker(src, dest, type, opts, (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":["Module","bind","path","loadConfigSync","url","major","process","versions","node","split","_require","require","createRequire","__dirname","dirname","__filename","fileURLToPath","workerPath","join","run","src","dest","type","options","callback","worker","callbacks","spawnOptions","transformDirectory","Error","tsconfig","opts","Promise","resolve","reject","err","result"],"mappings":"AAAA,OAAOA,YAAY,SAAS;AAC5B,SAASC,IAAI,QAAQ,oBAAoB;AACzC,OAAOC,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,WAAW,OAAOC,YAAY,cAAcX,OAAOY,aAAa,CAAC,YAAYR,GAAG,IAAIO;AAC1F,MAAME,YAAYX,KAAKY,OAAO,CAAC,OAAOC,eAAe,cAAcX,IAAIY,aAAa,CAAC,YAAYZ,GAAG,IAAIW;AACxG,MAAME,aAAaf,KAAKgB,IAAI,CAACL,WAAW,MAAM,OAAO,WAAW;AAEhE,SAASM,IAAIC,GAAW,EAAEC,IAAY,EAAEC,IAAgB,EAAEC,OAAsB,EAAEC,QAAoC;IACpH,OAAOd,SAASO,YAAYG,KAAKC,MAAMC,MAAMC,SAASC;AACxD;AAEA,8DAA8D;AAC9D,MAAMC,SAASpB,SAAS,KAAKc,MAAMlB,KAAK,QAAQgB,YAAY;IAAES,WAAW;IAAMC,cAAc;AAAM;AAMnG,eAAe,SAASC,mBAAmBR,GAAW,EAAEC,IAAY,EAAEC,IAAgB,EAAEC,OAAoD,EAAEC,QAAqC;IACjL,IAAI;QACF,IAAI,OAAOJ,QAAQ,UAAU,MAAM,IAAIS,MAAM;QAC7C,IAAI,OAAOR,SAAS,UAAU,MAAM,IAAIQ,MAAM;QAC9C,IAAI,OAAOP,SAAS,UAAU,MAAM,IAAIO,MAAM;QAE9CL,WAAW,OAAOD,YAAY,aAAaA,UAAUC;QACrDD,UAAU,OAAOA,YAAY,aAAa,CAAC,IAAMA,WAAW,CAAC;QAC7D,MAAMO,WAAWP,QAAQO,QAAQ,GAAGP,QAAQO,QAAQ,GAAG3B,eAAeiB;QACtE,MAAMW,OAAsB;YAAED;YAAU,GAAGP,OAAO;QAAC;QAEnD,IAAI,OAAOC,aAAa,YAAY,OAAOC,OAAOL,KAAKC,MAAMC,MAAMS,MAAMP;QACzE,OAAO,IAAIQ,QAAQ,CAACC,SAASC,SAC3BT,OAAOL,KAAKC,MAAMC,MAAMS,MAAM,CAACI,KAAKC;gBAClCD,MAAMD,OAAOC,OAAOF,QAAQG;YAC9B;IAEJ,EAAE,OAAOD,KAAK;QACZ,IAAIX,UAAUA,SAASW;aAClB,OAAOH,QAAQE,MAAM,CAACC;IAC7B;AACF"}
@@ -1,5 +1,5 @@
1
1
  import Module from 'module';
2
- import { bind } from 'node-version-call';
2
+ import { bindSync } from 'node-version-call';
3
3
  import path from 'path';
4
4
  import loadConfigSync from 'read-tsconfig-sync';
5
5
  import url from 'url';
@@ -11,7 +11,7 @@ function run(contents, fileName, tsconfig) {
11
11
  return _require(workerPath)(contents, fileName, tsconfig);
12
12
  }
13
13
  // spawnOptions: false - no node/npm spawn (library call only)
14
- const worker = major >= 20 ? run : bind('>=20', workerPath, {
14
+ const worker = major >= 20 ? run : bindSync('>=20', workerPath, {
15
15
  spawnOptions: false
16
16
  });
17
17
  export default function transformSync(contents, fileName, tsconfig) {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformSync.ts"],"sourcesContent":["import Module from 'module';\nimport { bind } from 'node-version-call';\nimport 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 _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformSync.js');\n\nfunction run(contents: string, fileName: string, tsconfig: TSConfig) {\n return _require(workerPath)(contents, fileName, tsconfig);\n}\n\n// spawnOptions: false - no node/npm spawn (library call only)\nconst worker = major >= 20 ? run : bind('>=20', workerPath, { spawnOptions: false });\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('transformSync: unexpected contents');\n if (typeof fileName !== 'string') throw new Error('transformSync: unexpected fileName');\n if (!tsconfig) tsconfig = loadConfigSync(process.cwd());\n return worker(contents, fileName, tsconfig) as Output;\n}\n"],"names":["Module","bind","path","loadConfigSync","url","major","process","versions","node","split","_require","require","createRequire","__dirname","dirname","__filename","fileURLToPath","workerPath","join","run","contents","fileName","tsconfig","worker","spawnOptions","transformSync","Error","cwd"],"mappings":"AAAA,OAAOA,YAAY,SAAS;AAC5B,SAASC,IAAI,QAAQ,oBAAoB;AACzC,OAAOC,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,WAAW,OAAOC,YAAY,cAAcX,OAAOY,aAAa,CAAC,YAAYR,GAAG,IAAIO;AAC1F,MAAME,YAAYX,KAAKY,OAAO,CAAC,OAAOC,eAAe,cAAcX,IAAIY,aAAa,CAAC,YAAYZ,GAAG,IAAIW;AACxG,MAAME,aAAaf,KAAKgB,IAAI,CAACL,WAAW,MAAM,OAAO,WAAW;AAEhE,SAASM,IAAIC,QAAgB,EAAEC,QAAgB,EAAEC,QAAkB;IACjE,OAAOZ,SAASO,YAAYG,UAAUC,UAAUC;AAClD;AAEA,8DAA8D;AAC9D,MAAMC,SAASlB,SAAS,KAAKc,MAAMlB,KAAK,QAAQgB,YAAY;IAAEO,cAAc;AAAM;AAGlF,eAAe,SAASC,cAAcL,QAAgB,EAAEC,QAAgB,EAAEC,QAAmB;IAC3F,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAIM,MAAM;IAClD,IAAI,OAAOL,aAAa,UAAU,MAAM,IAAIK,MAAM;IAClD,IAAI,CAACJ,UAAUA,WAAWnB,eAAeG,QAAQqB,GAAG;IACpD,OAAOJ,OAAOH,UAAUC,UAAUC;AACpC"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformSync.ts"],"sourcesContent":["import Module from 'module';\nimport { bindSync } from 'node-version-call';\nimport 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 _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformSync.js');\n\nfunction run(contents: string, fileName: string, tsconfig: TSConfig) {\n return _require(workerPath)(contents, fileName, tsconfig);\n}\n\n// spawnOptions: false - no node/npm spawn (library call only)\nconst worker = major >= 20 ? run : bindSync('>=20', workerPath, { spawnOptions: false });\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('transformSync: unexpected contents');\n if (typeof fileName !== 'string') throw new Error('transformSync: unexpected fileName');\n if (!tsconfig) tsconfig = loadConfigSync(process.cwd());\n return worker(contents, fileName, tsconfig) as Output;\n}\n"],"names":["Module","bindSync","path","loadConfigSync","url","major","process","versions","node","split","_require","require","createRequire","__dirname","dirname","__filename","fileURLToPath","workerPath","join","run","contents","fileName","tsconfig","worker","spawnOptions","transformSync","Error","cwd"],"mappings":"AAAA,OAAOA,YAAY,SAAS;AAC5B,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,OAAOC,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,WAAW,OAAOC,YAAY,cAAcX,OAAOY,aAAa,CAAC,YAAYR,GAAG,IAAIO;AAC1F,MAAME,YAAYX,KAAKY,OAAO,CAAC,OAAOC,eAAe,cAAcX,IAAIY,aAAa,CAAC,YAAYZ,GAAG,IAAIW;AACxG,MAAME,aAAaf,KAAKgB,IAAI,CAACL,WAAW,MAAM,OAAO,WAAW;AAEhE,SAASM,IAAIC,QAAgB,EAAEC,QAAgB,EAAEC,QAAkB;IACjE,OAAOZ,SAASO,YAAYG,UAAUC,UAAUC;AAClD;AAEA,8DAA8D;AAC9D,MAAMC,SAASlB,SAAS,KAAKc,MAAMlB,SAAS,QAAQgB,YAAY;IAAEO,cAAc;AAAM;AAGtF,eAAe,SAASC,cAAcL,QAAgB,EAAEC,QAAgB,EAAEC,QAAmB;IAC3F,IAAI,OAAOF,aAAa,UAAU,MAAM,IAAIM,MAAM;IAClD,IAAI,OAAOL,aAAa,UAAU,MAAM,IAAIK,MAAM;IAClD,IAAI,CAACJ,UAAUA,WAAWnB,eAAeG,QAAQqB,GAAG;IACpD,OAAOJ,OAAOH,UAAUC,UAAUC;AACpC"}
@@ -19,18 +19,17 @@ export default function transformTypes(src, dest, options, callback) {
19
19
  try {
20
20
  if (typeof src !== 'string') throw new Error('transformTypes: unexpected source');
21
21
  if (typeof dest !== 'string') throw new Error('transformTypes: unexpected destination directory');
22
- if (typeof options === 'function') {
23
- callback = options;
24
- options = undefined;
25
- }
26
- const baseOpts = options || {};
27
- const tsconfig = baseOpts.tsconfig ? baseOpts.tsconfig : loadConfigSync(src);
22
+ callback = typeof options === 'function' ? options : callback;
23
+ options = typeof options === 'function' ? {} : options || {};
24
+ const tsconfig = options.tsconfig ? options.tsconfig : loadConfigSync(src);
28
25
  const opts = {
29
26
  tsconfig,
30
- ...baseOpts
27
+ ...options
31
28
  };
32
29
  if (typeof callback === 'function') return worker(src, dest, opts, callback);
33
- return new Promise((resolve, reject)=>worker(src, dest, opts, (err, result)=>err ? reject(err) : resolve(result)));
30
+ return new Promise((resolve, reject)=>worker(src, dest, opts, (err, result)=>{
31
+ err ? reject(err) : resolve(result);
32
+ }));
34
33
  } catch (err) {
35
34
  if (callback) callback(err);
36
35
  else return Promise.reject(err);
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformTypes.ts"],"sourcesContent":["import Module from 'module';\nimport { bind } from 'node-version-call';\nimport path from 'path';\nimport loadConfigSync from 'read-tsconfig-sync';\nimport url from 'url';\n\nimport type { ConfigOptions, TransformTypesCallback } from './types.ts';\n\nconst major = +process.versions.node.split('.')[0];\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformTypes.js');\n\nfunction run(src: string, dest: string, options: ConfigOptions, callback: TransformTypesCallback) {\n return _require(workerPath)(src, dest, options, callback);\n}\n\n// spawnOptions: false - no node/npm spawn (library call only)\nconst worker = major >= 20 ? run : bind('>=20', workerPath, { callbacks: true, spawnOptions: false });\n\nexport default function transformTypes(src: string, dest: string, callback: TransformTypesCallback): void;\nexport default function transformTypes(src: string, dest: string, options: ConfigOptions, callback: TransformTypesCallback): void;\nexport default function transformTypes(src: string, dest: string): Promise<string[]>;\nexport default function transformTypes(src: string, dest: string, options: ConfigOptions): Promise<string[]>;\nexport default function transformTypes(src: string, dest: string, options?: ConfigOptions | TransformTypesCallback, callback?: TransformTypesCallback): void | 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;\n options = undefined;\n }\n const baseOpts = (options || {}) as ConfigOptions;\n const tsconfig = baseOpts.tsconfig ? baseOpts.tsconfig : loadConfigSync(src);\n const opts: ConfigOptions = { tsconfig, ...baseOpts };\n\n if (typeof callback === 'function') return worker(src, dest, opts, callback);\n return new Promise((resolve, reject) => worker(src, dest, opts, (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":["Module","bind","path","loadConfigSync","url","major","process","versions","node","split","_require","require","createRequire","__dirname","dirname","__filename","fileURLToPath","workerPath","join","run","src","dest","options","callback","worker","callbacks","spawnOptions","transformTypes","Error","undefined","baseOpts","tsconfig","opts","Promise","resolve","reject","err","result"],"mappings":"AAAA,OAAOA,YAAY,SAAS;AAC5B,SAASC,IAAI,QAAQ,oBAAoB;AACzC,OAAOC,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,WAAW,OAAOC,YAAY,cAAcX,OAAOY,aAAa,CAAC,YAAYR,GAAG,IAAIO;AAC1F,MAAME,YAAYX,KAAKY,OAAO,CAAC,OAAOC,eAAe,cAAcX,IAAIY,aAAa,CAAC,YAAYZ,GAAG,IAAIW;AACxG,MAAME,aAAaf,KAAKgB,IAAI,CAACL,WAAW,MAAM,OAAO,WAAW;AAEhE,SAASM,IAAIC,GAAW,EAAEC,IAAY,EAAEC,OAAsB,EAAEC,QAAgC;IAC9F,OAAOb,SAASO,YAAYG,KAAKC,MAAMC,SAASC;AAClD;AAEA,8DAA8D;AAC9D,MAAMC,SAASnB,SAAS,KAAKc,MAAMlB,KAAK,QAAQgB,YAAY;IAAEQ,WAAW;IAAMC,cAAc;AAAM;AAMnG,eAAe,SAASC,eAAeP,GAAW,EAAEC,IAAY,EAAEC,OAAgD,EAAEC,QAAiC;IACnJ,IAAI;QACF,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIQ,MAAM;QAC7C,IAAI,OAAOP,SAAS,UAAU,MAAM,IAAIO,MAAM;QAE9C,IAAI,OAAON,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAUO;QACZ;QACA,MAAMC,WAAYR,WAAW,CAAC;QAC9B,MAAMS,WAAWD,SAASC,QAAQ,GAAGD,SAASC,QAAQ,GAAG5B,eAAeiB;QACxE,MAAMY,OAAsB;YAAED;YAAU,GAAGD,QAAQ;QAAC;QAEpD,IAAI,OAAOP,aAAa,YAAY,OAAOC,OAAOJ,KAAKC,MAAMW,MAAMT;QACnE,OAAO,IAAIU,QAAQ,CAACC,SAASC,SAAWX,OAAOJ,KAAKC,MAAMW,MAAM,CAACI,KAAKC,SAAYD,MAAMD,OAAOC,OAAOF,QAAQG;IAChH,EAAE,OAAOD,KAAK;QACZ,IAAIb,UAAUA,SAASa;aAClB,OAAOH,QAAQE,MAAM,CAACC;IAC7B;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/transformTypes.ts"],"sourcesContent":["import Module from 'module';\nimport { bind } from 'node-version-call';\nimport path from 'path';\nimport loadConfigSync from 'read-tsconfig-sync';\nimport url from 'url';\n\nimport type { ConfigOptions, TransformTypesCallback } from './types.ts';\n\nconst major = +process.versions.node.split('.')[0];\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst workerPath = path.join(__dirname, '..', 'cjs', 'workers', 'transformTypes.js');\n\nfunction run(src: string, dest: string, options: ConfigOptions, callback: TransformTypesCallback) {\n return _require(workerPath)(src, dest, options, callback);\n}\n\n// spawnOptions: false - no node/npm spawn (library call only)\nconst worker = major >= 20 ? run : bind('>=20', workerPath, { callbacks: true, spawnOptions: false });\n\nexport default function transformTypes(src: string, dest: string, callback: TransformTypesCallback): void;\nexport default function transformTypes(src: string, dest: string, options: ConfigOptions, callback: TransformTypesCallback): void;\nexport default function transformTypes(src: string, dest: string): Promise<string[]>;\nexport default function transformTypes(src: string, dest: string, options: ConfigOptions): Promise<string[]>;\nexport default function transformTypes(src: string, dest: string, options?: ConfigOptions | TransformTypesCallback, callback?: TransformTypesCallback): void | 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 callback = typeof options === 'function' ? options : callback;\n options = typeof options === 'function' ? {} : ((options || {}) as ConfigOptions);\n const tsconfig = options.tsconfig ? options.tsconfig : loadConfigSync(src);\n const opts: ConfigOptions = { tsconfig, ...options };\n\n if (typeof callback === 'function') return worker(src, dest, opts, callback);\n return new Promise((resolve, reject) =>\n worker(src, dest, opts, (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":["Module","bind","path","loadConfigSync","url","major","process","versions","node","split","_require","require","createRequire","__dirname","dirname","__filename","fileURLToPath","workerPath","join","run","src","dest","options","callback","worker","callbacks","spawnOptions","transformTypes","Error","tsconfig","opts","Promise","resolve","reject","err","result"],"mappings":"AAAA,OAAOA,YAAY,SAAS;AAC5B,SAASC,IAAI,QAAQ,oBAAoB;AACzC,OAAOC,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,WAAW,OAAOC,YAAY,cAAcX,OAAOY,aAAa,CAAC,YAAYR,GAAG,IAAIO;AAC1F,MAAME,YAAYX,KAAKY,OAAO,CAAC,OAAOC,eAAe,cAAcX,IAAIY,aAAa,CAAC,YAAYZ,GAAG,IAAIW;AACxG,MAAME,aAAaf,KAAKgB,IAAI,CAACL,WAAW,MAAM,OAAO,WAAW;AAEhE,SAASM,IAAIC,GAAW,EAAEC,IAAY,EAAEC,OAAsB,EAAEC,QAAgC;IAC9F,OAAOb,SAASO,YAAYG,KAAKC,MAAMC,SAASC;AAClD;AAEA,8DAA8D;AAC9D,MAAMC,SAASnB,SAAS,KAAKc,MAAMlB,KAAK,QAAQgB,YAAY;IAAEQ,WAAW;IAAMC,cAAc;AAAM;AAMnG,eAAe,SAASC,eAAeP,GAAW,EAAEC,IAAY,EAAEC,OAAgD,EAAEC,QAAiC;IACnJ,IAAI;QACF,IAAI,OAAOH,QAAQ,UAAU,MAAM,IAAIQ,MAAM;QAC7C,IAAI,OAAOP,SAAS,UAAU,MAAM,IAAIO,MAAM;QAE9CL,WAAW,OAAOD,YAAY,aAAaA,UAAUC;QACrDD,UAAU,OAAOA,YAAY,aAAa,CAAC,IAAMA,WAAW,CAAC;QAC7D,MAAMO,WAAWP,QAAQO,QAAQ,GAAGP,QAAQO,QAAQ,GAAG1B,eAAeiB;QACtE,MAAMU,OAAsB;YAAED;YAAU,GAAGP,OAAO;QAAC;QAEnD,IAAI,OAAOC,aAAa,YAAY,OAAOC,OAAOJ,KAAKC,MAAMS,MAAMP;QACnE,OAAO,IAAIQ,QAAQ,CAACC,SAASC,SAC3BT,OAAOJ,KAAKC,MAAMS,MAAM,CAACI,KAAKC;gBAC5BD,MAAMD,OAAOC,OAAOF,QAAQG;YAC9B;IAEJ,EAAE,OAAOD,KAAK;QACZ,IAAIX,UAAUA,SAASW;aAClB,OAAOH,QAAQE,MAAM,CAACC;IAC7B;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-swc-transform",
3
- "version": "2.10.0",
3
+ "version": "2.11.0",
4
4
  "description": "Typescript transformers for swc. Supports Node >= 0.8",
5
5
  "keywords": [
6
6
  "matcher",
@@ -52,12 +52,13 @@
52
52
  "is-absolute": "^1.0.0",
53
53
  "lodash.debounce": "^4.0.8",
54
54
  "mkdirp-classic": "^0.5.2",
55
- "node-version-call": "^2.0.0",
55
+ "module-root-sync": "^2.0.2",
56
+ "node-version-call": "^3.0.0",
56
57
  "queue-cb": "^1.0.0",
57
- "read-tsconfig-sync": "^1.0.3",
58
+ "read-tsconfig-sync": "^1.1.0",
58
59
  "resolve": "^1.3.1",
59
60
  "resolve.exports": "^2.0.3",
60
- "test-match": "^1.1.4",
61
+ "test-match": "^1.0.0",
61
62
  "ts-node": "^10.9.0",
62
63
  "typescript": "^5.9.3"
63
64
  },