ts-swc-transform 2.6.15 → 2.6.18

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,7 +26,7 @@ function _interop_require_default(obj) {
26
26
  var interop = "/* 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; }";
27
27
  function patchCJS(entry, output, options) {
28
28
  var rewrite = (options.tsconfig.config.compilerOptions || {}).rewriteRelativeImportExtensions;
29
- if (rewrite) output.code = (0, _rewriteExtensionsts.rewriteExtensions)(output.code);
29
+ if (rewrite) output.code = (0, _rewriteExtensionsts.rewriteExtensionsCJS)(output.code);
30
30
  output.code += interop;
31
31
  return (0, _rewriteExtensionsts.replaceExtension)(_path.default.extname(entry.basename));
32
32
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/patchCJS.ts"],"sourcesContent":["import path from 'path';\nimport { replaceExtension, rewriteExtensions } from './rewriteExtensions.ts';\n\n// https://github.com/vercel/next.js/blob/20b63e13ab2631d6043277895d373aa31a1b327c/packages/next/taskfile-swc.js#L118-L125\nexport const interop = \"/* 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; }\";\n\nimport type { Output } from '@swc/core';\nimport type { Entry } from 'fs-iterator';\nimport type { CompilerOptions } from 'typescript';\nimport type { ConfigOptions } from '../types.ts';\n\ninterface InternalCompilerOptions extends CompilerOptions {\n rewriteRelativeImportExtensions?: boolean;\n}\n\nexport default function patchCJS(entry: Entry, output: Output, options: ConfigOptions): string {\n const rewrite = ((options.tsconfig.config.compilerOptions || {}) as unknown as InternalCompilerOptions).rewriteRelativeImportExtensions;\n if (rewrite) output.code = rewriteExtensions(output.code);\n output.code += interop;\n\n return replaceExtension(path.extname(entry.basename));\n}\n"],"names":["patchCJS","interop","entry","output","options","rewrite","tsconfig","config","compilerOptions","rewriteRelativeImportExtensions","code","rewriteExtensions","replaceExtension","path","extname","basename"],"mappings":";;;;;;;;;;;QAeA;eAAwBA;;QAXXC;eAAAA;;;2DAJI;mCACmC;;;;;;AAG7C,IAAMA,UAAU;AAWR,SAASD,SAASE,KAAY,EAAEC,MAAc,EAAEC,OAAsB;IACnF,IAAMC,UAAU,AAAED,CAAAA,QAAQE,QAAQ,CAACC,MAAM,CAACC,eAAe,IAAI,CAAC,CAAA,EAA0CC,+BAA+B;IACvI,IAAIJ,SAASF,OAAOO,IAAI,GAAGC,IAAAA,sCAAiB,EAACR,OAAOO,IAAI;IACxDP,OAAOO,IAAI,IAAIT;IAEf,OAAOW,IAAAA,qCAAgB,EAACC,aAAI,CAACC,OAAO,CAACZ,MAAMa,QAAQ;AACrD"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/patchCJS.ts"],"sourcesContent":["import path from 'path';\nimport { replaceExtension, rewriteExtensionsCJS } from './rewriteExtensions.ts';\n\n// https://github.com/vercel/next.js/blob/20b63e13ab2631d6043277895d373aa31a1b327c/packages/next/taskfile-swc.js#L118-L125\nexport const interop = \"/* 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; }\";\n\nimport type { Output } from '@swc/core';\nimport type { Entry } from 'fs-iterator';\nimport type { CompilerOptions } from 'typescript';\nimport type { ConfigOptions } from '../types.ts';\n\ninterface InternalCompilerOptions extends CompilerOptions {\n rewriteRelativeImportExtensions?: boolean;\n}\n\nexport default function patchCJS(entry: Entry, output: Output, options: ConfigOptions): string {\n const rewrite = ((options.tsconfig.config.compilerOptions || {}) as unknown as InternalCompilerOptions).rewriteRelativeImportExtensions;\n if (rewrite) output.code = rewriteExtensionsCJS(output.code);\n output.code += interop;\n\n return replaceExtension(path.extname(entry.basename));\n}\n"],"names":["patchCJS","interop","entry","output","options","rewrite","tsconfig","config","compilerOptions","rewriteRelativeImportExtensions","code","rewriteExtensionsCJS","replaceExtension","path","extname","basename"],"mappings":";;;;;;;;;;;QAeA;eAAwBA;;QAXXC;eAAAA;;;2DAJI;mCACsC;;;;;;AAGhD,IAAMA,UAAU;AAWR,SAASD,SAASE,KAAY,EAAEC,MAAc,EAAEC,OAAsB;IACnF,IAAMC,UAAU,AAAED,CAAAA,QAAQE,QAAQ,CAACC,MAAM,CAACC,eAAe,IAAI,CAAC,CAAA,EAA0CC,+BAA+B;IACvI,IAAIJ,SAASF,OAAOO,IAAI,GAAGC,IAAAA,yCAAoB,EAACR,OAAOO,IAAI;IAC3DP,OAAOO,IAAI,IAAIT;IAEf,OAAOW,IAAAA,qCAAgB,EAACC,aAAI,CAACC,OAAO,CAACZ,MAAMa,QAAQ;AACrD"}
@@ -6,3 +6,4 @@ export declare const extensions: {
6
6
  };
7
7
  export declare function replaceExtension(ext: string): string;
8
8
  export declare function rewriteExtensions(content: string): string;
9
+ export declare function rewriteExtensionsCJS(content: string): string;
@@ -17,6 +17,9 @@ _export(exports, {
17
17
  },
18
18
  get rewriteExtensions () {
19
19
  return rewriteExtensions;
20
+ },
21
+ get rewriteExtensionsCJS () {
22
+ return rewriteExtensionsCJS;
20
23
  }
21
24
  });
22
25
  var extensions = {
@@ -29,13 +32,50 @@ function replaceExtension(ext) {
29
32
  var replace = extensions[ext];
30
33
  return replace === undefined ? ext : replace;
31
34
  }
32
- // Pure regex solution for rewriting TypeScript extensions to JavaScript
33
- // Pattern: quote + relative path (starts with .) + TS extension + matching quote
34
- var extensionPattern = /(['"`])(\.[-\w./]*?)\.(tsx?|mts|cts)\1/g;
35
+ // Helper to check if a path is relative (starts with ./ or ../)
36
+ function isRelativePath(path) {
37
+ return path.startsWith('./') || path.startsWith('../');
38
+ }
35
39
  function rewriteExtensions(content) {
36
- return content.replace(extensionPattern, function(_match, quote, path, ext) {
37
- var newExt = extensions[".".concat(ext)];
38
- return "".concat(quote).concat(path).concat(newExt).concat(quote);
40
+ var result = content;
41
+ // Pattern 1: Import/Export statements (with optional 'type' keyword)
42
+ // Matches: import { X } from './path.ts'
43
+ // import type { X } from './path.ts'
44
+ // export * from './path.ts'
45
+ // export type * from './path.ts'
46
+ result = result.replace(/\b(import|export)(\s+type)?(?:\s+[^'"]*?\s+from\s+|\s+)['"]([^'"]+)\.(tsx?|mts|cts)['"]/g, function(match, keyword, typeKeyword, path, ext) {
47
+ if (!isRelativePath(path)) return match;
48
+ var newExt = replaceExtension(".".concat(ext));
49
+ return match.replace(".".concat(ext, '"'), "".concat(newExt, '"')).replace(".".concat(ext, "'"), "".concat(newExt, "'")).replace(".".concat(ext, "`"), "".concat(newExt, "`"));
50
+ });
51
+ // Pattern 2: Dynamic import types
52
+ // Matches: typeof import('./path.ts')
53
+ result = result.replace(/\bimport\s*\(\s*['"]([^'"]+)\.(tsx?|mts|cts)['"]\s*\)/g, function(match, path, ext) {
54
+ if (!isRelativePath(path)) return match;
55
+ var newExt = replaceExtension(".".concat(ext));
56
+ return match.replace(".".concat(ext, '"'), "".concat(newExt, '"')).replace(".".concat(ext, "'"), "".concat(newExt, "'")).replace(".".concat(ext, "`"), "".concat(newExt, "`"));
57
+ });
58
+ // Pattern 3: Triple-slash path references
59
+ // Matches: /// <reference path="./file.ts" />
60
+ // /// <reference path="./file.d.ts" />
61
+ result = result.replace(/\/\/\/\s*<reference\s+path\s*=\s*['"]([^'"]+)\.(d\.ts|tsx?|mts|cts)['"]\s*\/>/g, function(match, path, ext) {
62
+ if (!isRelativePath(path)) return match;
63
+ // Special case: .d.ts → .d.js
64
+ var newExt = ext === 'd.ts' ? '.d.js' : replaceExtension(".".concat(ext));
65
+ return match.replace(".".concat(ext, '"'), "".concat(newExt, '"')).replace(".".concat(ext, "'"), "".concat(newExt, "'")).replace(".".concat(ext, "`"), "".concat(newExt, "`"));
66
+ });
67
+ return result;
68
+ }
69
+ function rewriteExtensionsCJS(content) {
70
+ // Start with all ESM patterns
71
+ var result = rewriteExtensions(content);
72
+ // Pattern 4: CommonJS require() statements
73
+ // Matches: require('./path.js')
74
+ result = result.replace(/\brequire\s*\(\s*['"]([^'"]+)\.(tsx?|mts|cts)['"]\s*\)/g, function(match, path, ext) {
75
+ if (!isRelativePath(path)) return match;
76
+ var newExt = replaceExtension(".".concat(ext));
77
+ return match.replace(".".concat(ext, '"'), "".concat(newExt, '"')).replace(".".concat(ext, "'"), "".concat(newExt, "'")).replace(".".concat(ext, "`"), "".concat(newExt, "`"));
39
78
  });
79
+ return result;
40
80
  }
41
81
  /* 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/lib/rewriteExtensions.ts"],"sourcesContent":["export const extensions = {\n '.ts': '.js',\n '.tsx': '.js',\n '.mts': '.mjs',\n '.cts': '.cjs',\n};\n\nexport function replaceExtension(ext: string): string {\n const replace = extensions[ext];\n return replace === undefined ? ext : replace;\n}\n\n// Pure regex solution for rewriting TypeScript extensions to JavaScript\n// Pattern: quote + relative path (starts with .) + TS extension + matching quote\nconst extensionPattern = /(['\"`])(\\.[-\\w./]*?)\\.(tsx?|mts|cts)\\1/g;\n\nexport function rewriteExtensions(content: string): string {\n return content.replace(extensionPattern, (_match, quote, path, ext) => {\n const newExt = extensions[`.${ext}`];\n return `${quote}${path}${newExt}${quote}`;\n });\n}\n"],"names":["extensions","replaceExtension","rewriteExtensions","ext","replace","undefined","extensionPattern","content","_match","quote","path","newExt"],"mappings":";;;;;;;;;;;QAAaA;eAAAA;;QAOGC;eAAAA;;QASAC;eAAAA;;;AAhBT,IAAMF,aAAa;IACxB,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;AACV;AAEO,SAASC,iBAAiBE,GAAW;IAC1C,IAAMC,UAAUJ,UAAU,CAACG,IAAI;IAC/B,OAAOC,YAAYC,YAAYF,MAAMC;AACvC;AAEA,wEAAwE;AACxE,iFAAiF;AACjF,IAAME,mBAAmB;AAElB,SAASJ,kBAAkBK,OAAe;IAC/C,OAAOA,QAAQH,OAAO,CAACE,kBAAkB,SAACE,QAAQC,OAAOC,MAAMP;QAC7D,IAAMQ,SAASX,UAAU,CAAC,AAAC,IAAO,OAAJG,KAAM;QACpC,OAAO,AAAC,GAAUO,OAARD,OAAeE,OAAPD,MAAgBD,OAATE,QAAe,OAANF;IACpC;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/rewriteExtensions.ts"],"sourcesContent":["export const extensions = {\n '.ts': '.js',\n '.tsx': '.js',\n '.mts': '.mjs',\n '.cts': '.cjs',\n};\n\nexport function replaceExtension(ext: string): string {\n const replace = extensions[ext];\n return replace === undefined ? ext : replace;\n}\n\n// Helper to check if a path is relative (starts with ./ or ../)\nfunction isRelativePath(path: string): boolean {\n return path.startsWith('./') || path.startsWith('../');\n}\n\n// Multi-pattern transformer for TypeScript extension rewriting\n// See: https://github.com/microsoft/TypeScript/issues/61037\n// TODO: Remove when TypeScript natively supports rewriteRelativeImportExtensions in .d.ts files\n\nexport function rewriteExtensions(content: string): string {\n let result = content;\n\n // Pattern 1: Import/Export statements (with optional 'type' keyword)\n // Matches: import { X } from './path.ts'\n // import type { X } from './path.ts'\n // export * from './path.ts'\n // export type * from './path.ts'\n result = result.replace(\n /\\b(import|export)(\\s+type)?(?:\\s+[^'\"]*?\\s+from\\s+|\\s+)['\"]([^'\"]+)\\.(tsx?|mts|cts)['\"]/g,\n (match, keyword, typeKeyword, path, ext) => {\n if (!isRelativePath(path)) return match;\n const newExt = replaceExtension(`.${ext}`);\n return match.replace(`.${ext}\"`, `${newExt}\"`).replace(`.${ext}'`, `${newExt}'`).replace(`.${ext}\\``, `${newExt}\\``);\n }\n );\n\n // Pattern 2: Dynamic import types\n // Matches: typeof import('./path.ts')\n result = result.replace(\n /\\bimport\\s*\\(\\s*['\"]([^'\"]+)\\.(tsx?|mts|cts)['\"]\\s*\\)/g,\n (match, path, ext) => {\n if (!isRelativePath(path)) return match;\n const newExt = replaceExtension(`.${ext}`);\n return match.replace(`.${ext}\"`, `${newExt}\"`).replace(`.${ext}'`, `${newExt}'`).replace(`.${ext}\\``, `${newExt}\\``);\n }\n );\n\n // Pattern 3: Triple-slash path references\n // Matches: /// <reference path=\"./file.ts\" />\n // /// <reference path=\"./file.d.ts\" />\n result = result.replace(\n /\\/\\/\\/\\s*<reference\\s+path\\s*=\\s*['\"]([^'\"]+)\\.(d\\.ts|tsx?|mts|cts)['\"]\\s*\\/>/g,\n (match, path, ext) => {\n if (!isRelativePath(path)) return match;\n // Special case: .d.ts → .d.js\n const newExt = ext === 'd.ts' ? '.d.js' : replaceExtension(`.${ext}`);\n return match.replace(`.${ext}\"`, `${newExt}\"`).replace(`.${ext}'`, `${newExt}'`).replace(`.${ext}\\``, `${newExt}\\``);\n }\n );\n\n return result;\n}\n\n// CJS-specific version that also handles require() statements\nexport function rewriteExtensionsCJS(content: string): string {\n // Start with all ESM patterns\n let result = rewriteExtensions(content);\n\n // Pattern 4: CommonJS require() statements\n // Matches: require('./path.ts')\n result = result.replace(\n /\\brequire\\s*\\(\\s*['\"]([^'\"]+)\\.(tsx?|mts|cts)['\"]\\s*\\)/g,\n (match, path, ext) => {\n if (!isRelativePath(path)) return match;\n const newExt = replaceExtension(`.${ext}`);\n return match.replace(`.${ext}\"`, `${newExt}\"`).replace(`.${ext}'`, `${newExt}'`).replace(`.${ext}\\``, `${newExt}\\``);\n }\n );\n\n return result;\n}\n"],"names":["extensions","replaceExtension","rewriteExtensions","rewriteExtensionsCJS","ext","replace","undefined","isRelativePath","path","startsWith","content","result","match","keyword","typeKeyword","newExt"],"mappings":";;;;;;;;;;;QAAaA;eAAAA;;QAOGC;eAAAA;;QAcAC;eAAAA;;QA6CAC;eAAAA;;;AAlET,IAAMH,aAAa;IACxB,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;AACV;AAEO,SAASC,iBAAiBG,GAAW;IAC1C,IAAMC,UAAUL,UAAU,CAACI,IAAI;IAC/B,OAAOC,YAAYC,YAAYF,MAAMC;AACvC;AAEA,gEAAgE;AAChE,SAASE,eAAeC,IAAY;IAClC,OAAOA,KAAKC,UAAU,CAAC,SAASD,KAAKC,UAAU,CAAC;AAClD;AAMO,SAASP,kBAAkBQ,OAAe;IAC/C,IAAIC,SAASD;IAEb,qEAAqE;IACrE,yCAAyC;IACzC,8CAA8C;IAC9C,qCAAqC;IACrC,0CAA0C;IAC1CC,SAASA,OAAON,OAAO,CACrB,4FACA,SAACO,OAAOC,SAASC,aAAaN,MAAMJ;QAClC,IAAI,CAACG,eAAeC,OAAO,OAAOI;QAClC,IAAMG,SAASd,iBAAiB,AAAC,IAAO,OAAJG;QACpC,OAAOQ,MAAMP,OAAO,CAAC,AAAC,IAAO,OAAJD,KAAI,MAAI,AAAC,GAAS,OAAPW,QAAO,MAAIV,OAAO,CAAC,AAAC,IAAO,OAAJD,KAAI,MAAI,AAAC,GAAS,OAAPW,QAAO,MAAIV,OAAO,CAAC,AAAC,IAAO,OAAJD,KAAI,MAAK,AAAC,GAAS,OAAPW,QAAO;IAClH;IAGF,kCAAkC;IAClC,sCAAsC;IACtCJ,SAASA,OAAON,OAAO,CACrB,0DACA,SAACO,OAAOJ,MAAMJ;QACZ,IAAI,CAACG,eAAeC,OAAO,OAAOI;QAClC,IAAMG,SAASd,iBAAiB,AAAC,IAAO,OAAJG;QACpC,OAAOQ,MAAMP,OAAO,CAAC,AAAC,IAAO,OAAJD,KAAI,MAAI,AAAC,GAAS,OAAPW,QAAO,MAAIV,OAAO,CAAC,AAAC,IAAO,OAAJD,KAAI,MAAI,AAAC,GAAS,OAAPW,QAAO,MAAIV,OAAO,CAAC,AAAC,IAAO,OAAJD,KAAI,MAAK,AAAC,GAAS,OAAPW,QAAO;IAClH;IAGF,0CAA0C;IAC1C,8CAA8C;IAC9C,gDAAgD;IAChDJ,SAASA,OAAON,OAAO,CACrB,kFACA,SAACO,OAAOJ,MAAMJ;QACZ,IAAI,CAACG,eAAeC,OAAO,OAAOI;QAClC,8BAA8B;QAC9B,IAAMG,SAASX,QAAQ,SAAS,UAAUH,iBAAiB,AAAC,IAAO,OAAJG;QAC/D,OAAOQ,MAAMP,OAAO,CAAC,AAAC,IAAO,OAAJD,KAAI,MAAI,AAAC,GAAS,OAAPW,QAAO,MAAIV,OAAO,CAAC,AAAC,IAAO,OAAJD,KAAI,MAAI,AAAC,GAAS,OAAPW,QAAO,MAAIV,OAAO,CAAC,AAAC,IAAO,OAAJD,KAAI,MAAK,AAAC,GAAS,OAAPW,QAAO;IAClH;IAGF,OAAOJ;AACT;AAGO,SAASR,qBAAqBO,OAAe;IAClD,8BAA8B;IAC9B,IAAIC,SAAST,kBAAkBQ;IAE/B,2CAA2C;IAC3C,gCAAgC;IAChCC,SAASA,OAAON,OAAO,CACrB,2DACA,SAACO,OAAOJ,MAAMJ;QACZ,IAAI,CAACG,eAAeC,OAAO,OAAOI;QAClC,IAAMG,SAASd,iBAAiB,AAAC,IAAO,OAAJG;QACpC,OAAOQ,MAAMP,OAAO,CAAC,AAAC,IAAO,OAAJD,KAAI,MAAI,AAAC,GAAS,OAAPW,QAAO,MAAIV,OAAO,CAAC,AAAC,IAAO,OAAJD,KAAI,MAAI,AAAC,GAAS,OAAPW,QAAO,MAAIV,OAAO,CAAC,AAAC,IAAO,OAAJD,KAAI,MAAK,AAAC,GAAS,OAAPW,QAAO;IAClH;IAGF,OAAOJ;AACT"}
@@ -1,10 +1,10 @@
1
1
  import path from 'path';
2
- import { replaceExtension, rewriteExtensions } from './rewriteExtensions.js';
2
+ import { replaceExtension, rewriteExtensionsCJS } from './rewriteExtensions.js';
3
3
  // https://github.com/vercel/next.js/blob/20b63e13ab2631d6043277895d373aa31a1b327c/packages/next/taskfile-swc.js#L118-L125
4
4
  export const interop = "/* 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; }";
5
5
  export default function patchCJS(entry, output, options) {
6
6
  const rewrite = (options.tsconfig.config.compilerOptions || {}).rewriteRelativeImportExtensions;
7
- if (rewrite) output.code = rewriteExtensions(output.code);
7
+ if (rewrite) output.code = rewriteExtensionsCJS(output.code);
8
8
  output.code += interop;
9
9
  return replaceExtension(path.extname(entry.basename));
10
10
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/patchCJS.ts"],"sourcesContent":["import path from 'path';\nimport { replaceExtension, rewriteExtensions } from './rewriteExtensions.ts';\n\n// https://github.com/vercel/next.js/blob/20b63e13ab2631d6043277895d373aa31a1b327c/packages/next/taskfile-swc.js#L118-L125\nexport const interop = \"/* 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; }\";\n\nimport type { Output } from '@swc/core';\nimport type { Entry } from 'fs-iterator';\nimport type { CompilerOptions } from 'typescript';\nimport type { ConfigOptions } from '../types.ts';\n\ninterface InternalCompilerOptions extends CompilerOptions {\n rewriteRelativeImportExtensions?: boolean;\n}\n\nexport default function patchCJS(entry: Entry, output: Output, options: ConfigOptions): string {\n const rewrite = ((options.tsconfig.config.compilerOptions || {}) as unknown as InternalCompilerOptions).rewriteRelativeImportExtensions;\n if (rewrite) output.code = rewriteExtensions(output.code);\n output.code += interop;\n\n return replaceExtension(path.extname(entry.basename));\n}\n"],"names":["path","replaceExtension","rewriteExtensions","interop","patchCJS","entry","output","options","rewrite","tsconfig","config","compilerOptions","rewriteRelativeImportExtensions","code","extname","basename"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,yBAAyB;AAE7E,0HAA0H;AAC1H,OAAO,MAAMC,UAAU,oQAAoQ;AAW3R,eAAe,SAASC,SAASC,KAAY,EAAEC,MAAc,EAAEC,OAAsB;IACnF,MAAMC,UAAU,AAAED,CAAAA,QAAQE,QAAQ,CAACC,MAAM,CAACC,eAAe,IAAI,CAAC,CAAA,EAA0CC,+BAA+B;IACvI,IAAIJ,SAASF,OAAOO,IAAI,GAAGX,kBAAkBI,OAAOO,IAAI;IACxDP,OAAOO,IAAI,IAAIV;IAEf,OAAOF,iBAAiBD,KAAKc,OAAO,CAACT,MAAMU,QAAQ;AACrD"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/patchCJS.ts"],"sourcesContent":["import path from 'path';\nimport { replaceExtension, rewriteExtensionsCJS } from './rewriteExtensions.ts';\n\n// https://github.com/vercel/next.js/blob/20b63e13ab2631d6043277895d373aa31a1b327c/packages/next/taskfile-swc.js#L118-L125\nexport const interop = \"/* 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; }\";\n\nimport type { Output } from '@swc/core';\nimport type { Entry } from 'fs-iterator';\nimport type { CompilerOptions } from 'typescript';\nimport type { ConfigOptions } from '../types.ts';\n\ninterface InternalCompilerOptions extends CompilerOptions {\n rewriteRelativeImportExtensions?: boolean;\n}\n\nexport default function patchCJS(entry: Entry, output: Output, options: ConfigOptions): string {\n const rewrite = ((options.tsconfig.config.compilerOptions || {}) as unknown as InternalCompilerOptions).rewriteRelativeImportExtensions;\n if (rewrite) output.code = rewriteExtensionsCJS(output.code);\n output.code += interop;\n\n return replaceExtension(path.extname(entry.basename));\n}\n"],"names":["path","replaceExtension","rewriteExtensionsCJS","interop","patchCJS","entry","output","options","rewrite","tsconfig","config","compilerOptions","rewriteRelativeImportExtensions","code","extname","basename"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,SAASC,gBAAgB,EAAEC,oBAAoB,QAAQ,yBAAyB;AAEhF,0HAA0H;AAC1H,OAAO,MAAMC,UAAU,oQAAoQ;AAW3R,eAAe,SAASC,SAASC,KAAY,EAAEC,MAAc,EAAEC,OAAsB;IACnF,MAAMC,UAAU,AAAED,CAAAA,QAAQE,QAAQ,CAACC,MAAM,CAACC,eAAe,IAAI,CAAC,CAAA,EAA0CC,+BAA+B;IACvI,IAAIJ,SAASF,OAAOO,IAAI,GAAGX,qBAAqBI,OAAOO,IAAI;IAC3DP,OAAOO,IAAI,IAAIV;IAEf,OAAOF,iBAAiBD,KAAKc,OAAO,CAACT,MAAMU,QAAQ;AACrD"}
@@ -6,3 +6,4 @@ export declare const extensions: {
6
6
  };
7
7
  export declare function replaceExtension(ext: string): string;
8
8
  export declare function rewriteExtensions(content: string): string;
9
+ export declare function rewriteExtensionsCJS(content: string): string;
@@ -8,12 +8,53 @@ export function replaceExtension(ext) {
8
8
  const replace = extensions[ext];
9
9
  return replace === undefined ? ext : replace;
10
10
  }
11
- // Pure regex solution for rewriting TypeScript extensions to JavaScript
12
- // Pattern: quote + relative path (starts with .) + TS extension + matching quote
13
- const extensionPattern = /(['"`])(\.[-\w./]*?)\.(tsx?|mts|cts)\1/g;
11
+ // Helper to check if a path is relative (starts with ./ or ../)
12
+ function isRelativePath(path) {
13
+ return path.startsWith('./') || path.startsWith('../');
14
+ }
15
+ // Multi-pattern transformer for TypeScript extension rewriting
16
+ // See: https://github.com/microsoft/TypeScript/issues/61037
17
+ // TODO: Remove when TypeScript natively supports rewriteRelativeImportExtensions in .d.ts files
14
18
  export function rewriteExtensions(content) {
15
- return content.replace(extensionPattern, (_match, quote, path, ext)=>{
16
- const newExt = extensions[`.${ext}`];
17
- return `${quote}${path}${newExt}${quote}`;
19
+ let result = content;
20
+ // Pattern 1: Import/Export statements (with optional 'type' keyword)
21
+ // Matches: import { X } from './path.js'
22
+ // import type { X } from './path.js'
23
+ // export * from './path.js'
24
+ // export type * from './path.js'
25
+ result = result.replace(/\b(import|export)(\s+type)?(?:\s+[^'"]*?\s+from\s+|\s+)['"]([^'"]+)\.(tsx?|mts|cts)['"]/g, (match, keyword, typeKeyword, path, ext)=>{
26
+ if (!isRelativePath(path)) return match;
27
+ const newExt = replaceExtension(`.${ext}`);
28
+ return match.replace(`.${ext}"`, `${newExt}"`).replace(`.${ext}'`, `${newExt}'`).replace(`.${ext}\``, `${newExt}\``);
29
+ });
30
+ // Pattern 2: Dynamic import types
31
+ // Matches: typeof import('./path.ts')
32
+ result = result.replace(/\bimport\s*\(\s*['"]([^'"]+)\.(tsx?|mts|cts)['"]\s*\)/g, (match, path, ext)=>{
33
+ if (!isRelativePath(path)) return match;
34
+ const newExt = replaceExtension(`.${ext}`);
35
+ return match.replace(`.${ext}"`, `${newExt}"`).replace(`.${ext}'`, `${newExt}'`).replace(`.${ext}\``, `${newExt}\``);
36
+ });
37
+ // Pattern 3: Triple-slash path references
38
+ // Matches: /// <reference path="./file.ts" />
39
+ // /// <reference path="./file.d.ts" />
40
+ result = result.replace(/\/\/\/\s*<reference\s+path\s*=\s*['"]([^'"]+)\.(d\.ts|tsx?|mts|cts)['"]\s*\/>/g, (match, path, ext)=>{
41
+ if (!isRelativePath(path)) return match;
42
+ // Special case: .d.ts → .d.js
43
+ const newExt = ext === 'd.ts' ? '.d.js' : replaceExtension(`.${ext}`);
44
+ return match.replace(`.${ext}"`, `${newExt}"`).replace(`.${ext}'`, `${newExt}'`).replace(`.${ext}\``, `${newExt}\``);
45
+ });
46
+ return result;
47
+ }
48
+ // CJS-specific version that also handles require() statements
49
+ export function rewriteExtensionsCJS(content) {
50
+ // Start with all ESM patterns
51
+ let result = rewriteExtensions(content);
52
+ // Pattern 4: CommonJS require() statements
53
+ // Matches: require('./path.ts')
54
+ result = result.replace(/\brequire\s*\(\s*['"]([^'"]+)\.(tsx?|mts|cts)['"]\s*\)/g, (match, path, ext)=>{
55
+ if (!isRelativePath(path)) return match;
56
+ const newExt = replaceExtension(`.${ext}`);
57
+ return match.replace(`.${ext}"`, `${newExt}"`).replace(`.${ext}'`, `${newExt}'`).replace(`.${ext}\``, `${newExt}\``);
18
58
  });
59
+ return result;
19
60
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/rewriteExtensions.ts"],"sourcesContent":["export const extensions = {\n '.ts': '.js',\n '.tsx': '.js',\n '.mts': '.mjs',\n '.cts': '.cjs',\n};\n\nexport function replaceExtension(ext: string): string {\n const replace = extensions[ext];\n return replace === undefined ? ext : replace;\n}\n\n// Pure regex solution for rewriting TypeScript extensions to JavaScript\n// Pattern: quote + relative path (starts with .) + TS extension + matching quote\nconst extensionPattern = /(['\"`])(\\.[-\\w./]*?)\\.(tsx?|mts|cts)\\1/g;\n\nexport function rewriteExtensions(content: string): string {\n return content.replace(extensionPattern, (_match, quote, path, ext) => {\n const newExt = extensions[`.${ext}`];\n return `${quote}${path}${newExt}${quote}`;\n });\n}\n"],"names":["extensions","replaceExtension","ext","replace","undefined","extensionPattern","rewriteExtensions","content","_match","quote","path","newExt"],"mappings":"AAAA,OAAO,MAAMA,aAAa;IACxB,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;AACV,EAAE;AAEF,OAAO,SAASC,iBAAiBC,GAAW;IAC1C,MAAMC,UAAUH,UAAU,CAACE,IAAI;IAC/B,OAAOC,YAAYC,YAAYF,MAAMC;AACvC;AAEA,wEAAwE;AACxE,iFAAiF;AACjF,MAAME,mBAAmB;AAEzB,OAAO,SAASC,kBAAkBC,OAAe;IAC/C,OAAOA,QAAQJ,OAAO,CAACE,kBAAkB,CAACG,QAAQC,OAAOC,MAAMR;QAC7D,MAAMS,SAASX,UAAU,CAAC,CAAC,CAAC,EAAEE,KAAK,CAAC;QACpC,OAAO,GAAGO,QAAQC,OAAOC,SAASF,OAAO;IAC3C;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/rewriteExtensions.ts"],"sourcesContent":["export const extensions = {\n '.ts': '.js',\n '.tsx': '.js',\n '.mts': '.mjs',\n '.cts': '.cjs',\n};\n\nexport function replaceExtension(ext: string): string {\n const replace = extensions[ext];\n return replace === undefined ? ext : replace;\n}\n\n// Helper to check if a path is relative (starts with ./ or ../)\nfunction isRelativePath(path: string): boolean {\n return path.startsWith('./') || path.startsWith('../');\n}\n\n// Multi-pattern transformer for TypeScript extension rewriting\n// See: https://github.com/microsoft/TypeScript/issues/61037\n// TODO: Remove when TypeScript natively supports rewriteRelativeImportExtensions in .d.ts files\n\nexport function rewriteExtensions(content: string): string {\n let result = content;\n\n // Pattern 1: Import/Export statements (with optional 'type' keyword)\n // Matches: import { X } from './path.ts'\n // import type { X } from './path.ts'\n // export * from './path.ts'\n // export type * from './path.ts'\n result = result.replace(\n /\\b(import|export)(\\s+type)?(?:\\s+[^'\"]*?\\s+from\\s+|\\s+)['\"]([^'\"]+)\\.(tsx?|mts|cts)['\"]/g,\n (match, keyword, typeKeyword, path, ext) => {\n if (!isRelativePath(path)) return match;\n const newExt = replaceExtension(`.${ext}`);\n return match.replace(`.${ext}\"`, `${newExt}\"`).replace(`.${ext}'`, `${newExt}'`).replace(`.${ext}\\``, `${newExt}\\``);\n }\n );\n\n // Pattern 2: Dynamic import types\n // Matches: typeof import('./path.ts')\n result = result.replace(\n /\\bimport\\s*\\(\\s*['\"]([^'\"]+)\\.(tsx?|mts|cts)['\"]\\s*\\)/g,\n (match, path, ext) => {\n if (!isRelativePath(path)) return match;\n const newExt = replaceExtension(`.${ext}`);\n return match.replace(`.${ext}\"`, `${newExt}\"`).replace(`.${ext}'`, `${newExt}'`).replace(`.${ext}\\``, `${newExt}\\``);\n }\n );\n\n // Pattern 3: Triple-slash path references\n // Matches: /// <reference path=\"./file.ts\" />\n // /// <reference path=\"./file.d.ts\" />\n result = result.replace(\n /\\/\\/\\/\\s*<reference\\s+path\\s*=\\s*['\"]([^'\"]+)\\.(d\\.ts|tsx?|mts|cts)['\"]\\s*\\/>/g,\n (match, path, ext) => {\n if (!isRelativePath(path)) return match;\n // Special case: .d.ts → .d.js\n const newExt = ext === 'd.ts' ? '.d.js' : replaceExtension(`.${ext}`);\n return match.replace(`.${ext}\"`, `${newExt}\"`).replace(`.${ext}'`, `${newExt}'`).replace(`.${ext}\\``, `${newExt}\\``);\n }\n );\n\n return result;\n}\n\n// CJS-specific version that also handles require() statements\nexport function rewriteExtensionsCJS(content: string): string {\n // Start with all ESM patterns\n let result = rewriteExtensions(content);\n\n // Pattern 4: CommonJS require() statements\n // Matches: require('./path.ts')\n result = result.replace(\n /\\brequire\\s*\\(\\s*['\"]([^'\"]+)\\.(tsx?|mts|cts)['\"]\\s*\\)/g,\n (match, path, ext) => {\n if (!isRelativePath(path)) return match;\n const newExt = replaceExtension(`.${ext}`);\n return match.replace(`.${ext}\"`, `${newExt}\"`).replace(`.${ext}'`, `${newExt}'`).replace(`.${ext}\\``, `${newExt}\\``);\n }\n );\n\n return result;\n}\n"],"names":["extensions","replaceExtension","ext","replace","undefined","isRelativePath","path","startsWith","rewriteExtensions","content","result","match","keyword","typeKeyword","newExt","rewriteExtensionsCJS"],"mappings":"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-swc-transform",
3
- "version": "2.6.15",
3
+ "version": "2.6.18",
4
4
  "description": "Typescript transformers for swc. Supports Node >= 0.8",
5
5
  "keywords": [
6
6
  "matcher",
@@ -32,7 +32,6 @@
32
32
  "types": "dist/cjs/index.d.cts",
33
33
  "files": [
34
34
  "dist",
35
- "scripts",
36
35
  "assets"
37
36
  ],
38
37
  "scripts": {
@@ -1,3 +0,0 @@
1
- export declare const moduleRegEx: RegExp;
2
- export declare const typeFileRegEx: RegExp;
3
- export declare const extensions: string[];
@@ -1,2 +0,0 @@
1
- import type { Matcher, TSConfig } from './types.js';
2
- export default function createMatcher(tsconfig: TSConfig): Matcher;
@@ -1,8 +0,0 @@
1
- export * as constants from './constants.js';
2
- export { default as createMatcher } from './createMatcher.js';
3
- export { default as resolveFileSync } from './resolveFileSync.js';
4
- export { default as toPath } from './toPath.js';
5
- export { default as transformDirectory } from './transformDirectory.js';
6
- export { default as transformSync } from './transformSync.js';
7
- export { default as transformTypes } from './transformTypes.js';
8
- export type * from './types.js';
@@ -1 +0,0 @@
1
- export default function importMetaResolve(specifier: string, url: URL): string;
@@ -1,5 +0,0 @@
1
- export interface Parsed {
2
- content: string;
3
- isSpecifier: boolean;
4
- }
5
- export default function parser(code: string, regex: RegExp): Parsed[];
@@ -1,5 +0,0 @@
1
- export declare const interop = "/* 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; }";
2
- import type { Output } from '@swc/core';
3
- import type { Entry } from 'fs-iterator';
4
- import type { ConfigOptions } from '../types.js';
5
- export default function patchCJS(entry: Entry, output: Output, options: ConfigOptions): string;
@@ -1,4 +0,0 @@
1
- import type { Output } from '@swc/core';
2
- import type { Entry } from 'fs-iterator';
3
- import type { ConfigOptions } from '../types.js';
4
- export default function patchESM(entry: Entry, output: Output, options: ConfigOptions): string;
@@ -1,7 +0,0 @@
1
- import type { Options } from '@swc/core';
2
- import type { TSConfig } from '../types.js';
3
- export interface TranspilerOptions {
4
- tsxOptions: Options;
5
- nonTsxOptions: Options;
6
- }
7
- export default function prepareSWCOptions(tsconfig: TSConfig): TranspilerOptions;
@@ -1,8 +0,0 @@
1
- export declare const extensions: {
2
- '.ts': string;
3
- '.tsx': string;
4
- '.mts': string;
5
- '.cts': string;
6
- };
7
- export declare function replaceExtension(ext: string): string;
8
- export declare function rewriteExtensions(content: string): string;
@@ -1,3 +0,0 @@
1
- import type { Entry } from 'fs-iterator';
2
- import type { ConfigOptions, TargetType, TransformFileCallback } from '../types.js';
3
- export default function transformFile(entry: Entry, dest: string, type: TargetType, options: ConfigOptions, callback: TransformFileCallback): undefined;
@@ -1,3 +0,0 @@
1
- import URL from 'core-js-pure/actual/url/index.js';
2
- export declare function fileURLToPath(url: string | URL): string;
3
- export declare function pathToFileURL(pathname: string): URL;
@@ -1,2 +0,0 @@
1
- import type { Context } from './types.js';
2
- export default function resolveFileSync(specifier: string, context?: Context): string;
@@ -1,2 +0,0 @@
1
- import type { Context } from './types.js';
2
- export default function toPath(specifier: string, context?: Context): string;
@@ -1,2 +0,0 @@
1
- import type { ConfigOptions, TargetType, TransformDirectoryCallback } from './types.js';
2
- export default function transformDirectory(src: string, dest: string, type: TargetType, options?: ConfigOptions | TransformDirectoryCallback, callback?: TransformDirectoryCallback): undefined | Promise<string[]>;
@@ -1,3 +0,0 @@
1
- import type { TSConfig } from './types.js';
2
- import type { Output } from '@swc/core';
3
- export default function transformSync(contents: string, fileName: string, tsconfig?: TSConfig): Output;
@@ -1,2 +0,0 @@
1
- import type { ConfigOptions, TransformTypesCallback } from './types.js';
2
- export default function transformTypes(src: string, dest: string, options?: ConfigOptions | TransformTypesCallback, callback?: TransformTypesCallback): undefined | Promise<string[]>;
@@ -1,16 +0,0 @@
1
- import type { TSConfig } from 'read-tsconfig-sync';
2
- export interface Context {
3
- parentURL?: string;
4
- parentPath?: string;
5
- }
6
- export type { TSConfig, TSConfigSchema } from 'read-tsconfig-sync';
7
- export interface ConfigOptions {
8
- tsconfig?: TSConfig;
9
- cwd?: string;
10
- sourceMaps?: boolean;
11
- }
12
- export type TransformDirectoryCallback = (err?: Error, filePaths?: string[]) => void;
13
- export type TransformFileCallback = (err?: Error, destFilePath?: string) => void;
14
- export type TransformTypesCallback = (err?: Error, filePaths?: string[]) => void;
15
- export type Matcher = (filePath: string) => boolean;
16
- export type TargetType = 'cjs' | 'esm';
@@ -1,2 +0,0 @@
1
- import type { ConfigOptions, TargetType, TransformDirectoryCallback } from '../types.js';
2
- export default function transformDirectoryWorker(src: string, dest: string, type: TargetType, options: ConfigOptions, callback: TransformDirectoryCallback): undefined;
@@ -1,3 +0,0 @@
1
- import type { Output } from '@swc/core';
2
- import type { TSConfig } from '../types.js';
3
- export default function transformSyncWorker(contents: string, fileName: string, tsconfig: TSConfig): Output;
@@ -1,2 +0,0 @@
1
- import type { ConfigOptions, TransformTypesCallback } from '../types.js';
2
- export default function transformTypesWorker(src: string, dest: string, options: ConfigOptions, callback: TransformTypesCallback): undefined;