ts-swc-transform 2.11.6 → 2.11.7
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.
- package/dist/cjs/lib/patchCJS.d.cts +2 -2
- package/dist/cjs/lib/patchCJS.d.ts +2 -2
- package/dist/cjs/lib/patchCJS.js.map +1 -1
- package/dist/cjs/lib/patchESM.d.cts +2 -2
- package/dist/cjs/lib/patchESM.d.ts +2 -2
- package/dist/cjs/lib/patchESM.js.map +1 -1
- package/dist/cjs/lib/prepareSWCOptions.js +8 -1
- package/dist/cjs/lib/prepareSWCOptions.js.map +1 -1
- package/dist/cjs/lib/rewriteExtensions.d.cts +1 -6
- package/dist/cjs/lib/rewriteExtensions.d.ts +1 -6
- package/dist/cjs/lib/rewriteExtensions.js.map +1 -1
- package/dist/cjs/lib/transformFile.d.cts +2 -2
- package/dist/cjs/lib/transformFile.d.ts +2 -2
- package/dist/cjs/lib/transformFile.js +22 -9
- package/dist/cjs/lib/transformFile.js.map +1 -1
- package/dist/cjs/lib/urlFileUrl.js +2 -1
- package/dist/cjs/lib/urlFileUrl.js.map +1 -1
- package/dist/cjs/resolveFileSync.d.cts +1 -1
- package/dist/cjs/resolveFileSync.d.ts +1 -1
- package/dist/cjs/resolveFileSync.js.map +1 -1
- package/dist/cjs/transformDirectory.js +27 -3
- package/dist/cjs/transformDirectory.js.map +1 -1
- package/dist/cjs/transformTypes.js +27 -3
- package/dist/cjs/transformTypes.js.map +1 -1
- package/dist/cjs/types.d.cts +6 -3
- package/dist/cjs/types.d.ts +6 -3
- package/dist/cjs/workers/transformDirectory.d.cts +2 -2
- package/dist/cjs/workers/transformDirectory.d.ts +2 -2
- package/dist/cjs/workers/transformDirectory.js +12 -9
- package/dist/cjs/workers/transformDirectory.js.map +1 -1
- package/dist/cjs/workers/transformTypes.d.cts +2 -2
- package/dist/cjs/workers/transformTypes.d.ts +2 -2
- package/dist/cjs/workers/transformTypes.js +21 -10
- package/dist/cjs/workers/transformTypes.js.map +1 -1
- package/dist/esm/lib/patchCJS.d.ts +2 -2
- package/dist/esm/lib/patchCJS.js.map +1 -1
- package/dist/esm/lib/patchESM.d.ts +2 -2
- package/dist/esm/lib/patchESM.js.map +1 -1
- package/dist/esm/lib/prepareSWCOptions.js +1 -1
- package/dist/esm/lib/prepareSWCOptions.js.map +1 -1
- package/dist/esm/lib/rewriteExtensions.d.ts +1 -6
- package/dist/esm/lib/rewriteExtensions.js.map +1 -1
- package/dist/esm/lib/transformFile.d.ts +2 -2
- package/dist/esm/lib/transformFile.js +14 -12
- package/dist/esm/lib/transformFile.js.map +1 -1
- package/dist/esm/lib/urlFileUrl.js +2 -1
- package/dist/esm/lib/urlFileUrl.js.map +1 -1
- package/dist/esm/resolveFileSync.d.ts +1 -1
- package/dist/esm/resolveFileSync.js.map +1 -1
- package/dist/esm/transformDirectory.js +3 -3
- package/dist/esm/transformDirectory.js.map +1 -1
- package/dist/esm/transformTypes.js +3 -3
- package/dist/esm/transformTypes.js.map +1 -1
- package/dist/esm/types.d.ts +6 -3
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/workers/transformDirectory.d.ts +2 -2
- package/dist/esm/workers/transformDirectory.js +12 -9
- package/dist/esm/workers/transformDirectory.js.map +1 -1
- package/dist/esm/workers/transformTypes.d.ts +2 -2
- package/dist/esm/workers/transformTypes.js +19 -10
- package/dist/esm/workers/transformTypes.js.map +1 -1
- package/package.json +4 -1
|
@@ -13,31 +13,34 @@ export default function transformDirectoryWorker(src, dest, type, options, callb
|
|
|
13
13
|
alwaysStat: true
|
|
14
14
|
});
|
|
15
15
|
iterator.forEach((entry)=>{
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
|
|
16
|
+
const stats = entry.stats;
|
|
17
|
+
if (!stats || !stats.isFile()) return;
|
|
18
|
+
const basename = entry.basename;
|
|
19
|
+
if (basename[0] === '.') return;
|
|
20
|
+
if (typeFileRegEx.test(basename)) return;
|
|
19
21
|
if (!matcher(entry.fullPath)) return;
|
|
20
|
-
const ext = path.extname(
|
|
22
|
+
const ext = path.extname(basename);
|
|
21
23
|
if (ext && extensions.indexOf(ext) < 0) return;
|
|
22
24
|
entries.push(entry);
|
|
23
|
-
const stats = entry.stats;
|
|
24
25
|
if (stats.mode) {
|
|
25
26
|
modeByPath.set(entry.fullPath, stats.mode);
|
|
26
27
|
}
|
|
27
28
|
}, (err)=>{
|
|
28
29
|
if (err) return callback(err);
|
|
29
30
|
const results = [];
|
|
30
|
-
|
|
31
|
+
const opts = {
|
|
31
32
|
...options,
|
|
32
33
|
tsconfig
|
|
33
34
|
};
|
|
34
35
|
const queue = new Queue();
|
|
35
36
|
entries.forEach((entry)=>{
|
|
36
37
|
const mode = modeByPath.get(entry.fullPath);
|
|
37
|
-
queue.defer((cb)=>transformFile(entry, dest, type,
|
|
38
|
+
queue.defer((cb)=>transformFile(entry, dest, type, opts, mode, (err, outPath)=>{
|
|
38
39
|
if (err) return cb(err);
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
if (outPath) {
|
|
41
|
+
results.push(path.normalize(outPath));
|
|
42
|
+
if (opts.sourceMaps) results.push(`${path.normalize(outPath)}.map`);
|
|
43
|
+
}
|
|
41
44
|
cb();
|
|
42
45
|
}));
|
|
43
46
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformDirectory.ts"],"sourcesContent":["import type fs from 'fs';\nimport Iterator, { type Entry } from 'fs-iterator';\nimport path from 'path';\nimport Queue from 'queue-cb';\n\nimport { extensions, typeFileRegEx } from '../constants.ts';\nimport createMatcher from '../createMatcher.ts';\nimport transformFile from '../lib/transformFile.ts';\n\nimport type {
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformDirectory.ts"],"sourcesContent":["import type fs from 'fs';\nimport Iterator, { type Entry } from 'fs-iterator';\nimport path from 'path';\nimport Queue from 'queue-cb';\n\nimport { extensions, typeFileRegEx } from '../constants.ts';\nimport createMatcher from '../createMatcher.ts';\nimport transformFile from '../lib/transformFile.ts';\n\nimport type { InternalConfigOptions, TargetType, TransformDirectoryCallback } from '../types.ts';\n\nexport default function transformDirectoryWorker(src: string, dest: string, type: TargetType, options: InternalConfigOptions, callback: TransformDirectoryCallback) {\n const tsconfig = options.tsconfig;\n const matcher = createMatcher(tsconfig);\n\n const entries: Entry[] = [];\n const modeByPath = new Map<string, number>();\n const iterator = new Iterator(src, { alwaysStat: true });\n iterator.forEach(\n (entry: Entry): void => {\n const stats = entry.stats as fs.Stats | undefined;\n if (!stats || !stats.isFile()) return;\n const basename = entry.basename as string;\n if (basename[0] === '.') return;\n if (typeFileRegEx.test(basename)) return;\n if (!matcher(entry.fullPath)) return;\n const ext = path.extname(basename);\n if (ext && extensions.indexOf(ext) < 0) return;\n entries.push(entry);\n\n if (stats.mode) {\n modeByPath.set(entry.fullPath, stats.mode);\n }\n },\n (err) => {\n if (err) return callback(err);\n const results: string[] = [];\n const opts: InternalConfigOptions = { ...options, tsconfig };\n\n const queue = new Queue();\n entries.forEach((entry: Entry) => {\n const mode = modeByPath.get(entry.fullPath);\n queue.defer((cb) =>\n transformFile(entry, dest, type, opts, mode, (err, outPath) => {\n if (err) return cb(err);\n if (outPath) {\n results.push(path.normalize(outPath));\n if (opts.sourceMaps) results.push(`${path.normalize(outPath)}.map`);\n }\n cb();\n })\n );\n });\n queue.await((err) => (err ? callback(err) : callback(null, results)));\n }\n );\n}\n"],"names":["Iterator","path","Queue","extensions","typeFileRegEx","createMatcher","transformFile","transformDirectoryWorker","src","dest","type","options","callback","tsconfig","matcher","entries","modeByPath","Map","iterator","alwaysStat","forEach","entry","stats","isFile","basename","test","fullPath","ext","extname","indexOf","push","mode","set","err","results","opts","queue","get","defer","cb","outPath","normalize","sourceMaps","await"],"mappings":"AACA,OAAOA,cAA8B,cAAc;AACnD,OAAOC,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;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KO;oBACjD,IAAIP,KAAK,OAAOM,GAAGN;oBACnB,IAAIO,SAAS;wBACXN,QAAQJ,IAAI,CAAC7B,KAAKwC,SAAS,CAACD;wBAC5B,IAAIL,KAAKO,UAAU,EAAER,QAAQJ,IAAI,CAAC,GAAG7B,KAAKwC,SAAS,CAACD,SAAS,IAAI,CAAC;oBACpE;oBACAD;gBACF;QAEJ;QACAH,MAAMO,KAAK,CAAC,CAACV,MAASA,MAAMrB,SAASqB,OAAOrB,SAAS,MAAMsB;IAC7D;AAEJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export default function transformTypesWorker(src: string, dest: string, options:
|
|
1
|
+
import type { InternalConfigOptions, TransformTypesCallback } from '../types.js';
|
|
2
|
+
export default function transformTypesWorker(src: string, dest: string, options: InternalConfigOptions, callback: TransformTypesCallback): void;
|
|
@@ -50,10 +50,12 @@ export default function transformTypesWorker(src, dest, options, callback) {
|
|
|
50
50
|
const rootFiles = [];
|
|
51
51
|
const iterator = new Iterator(src);
|
|
52
52
|
iterator.forEach((entry)=>{
|
|
53
|
-
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
if (
|
|
53
|
+
const stats = entry.stats;
|
|
54
|
+
if (!stats || !stats.isFile()) return;
|
|
55
|
+
const basename = entry.basename;
|
|
56
|
+
if (basename[0] === '.') return;
|
|
57
|
+
if (typeFileRegEx.test(basename)) return;
|
|
58
|
+
if (!isAllowedRootFile(basename)) return;
|
|
57
59
|
if (!matcher(entry.fullPath)) return;
|
|
58
60
|
rootFiles.push(entry.fullPath);
|
|
59
61
|
}, {
|
|
@@ -70,7 +72,7 @@ export default function transformTypesWorker(src, dest, options, callback) {
|
|
|
70
72
|
allowJs: true,
|
|
71
73
|
declaration: true,
|
|
72
74
|
emitDeclarationOnly: true,
|
|
73
|
-
|
|
75
|
+
// Suppress TS6 deprecation warnings (TS5101/TS5107) for consumers still on legacy Node-targeted options.
|
|
74
76
|
ignoreDeprecations: '6.0'
|
|
75
77
|
};
|
|
76
78
|
const rewrite = ((_tsconfig_config_compilerOptions = tsconfig.config.compilerOptions) === null || _tsconfig_config_compilerOptions === void 0 ? void 0 : _tsconfig_config_compilerOptions.rewriteRelativeImportExtensions) === true;
|
|
@@ -106,13 +108,19 @@ export default function transformTypesWorker(src, dest, options, callback) {
|
|
|
106
108
|
'false'
|
|
107
109
|
];
|
|
108
110
|
runCompiler(tscPath, args, (runErr, res)=>{
|
|
109
|
-
if (runErr || res.status !== 0) {
|
|
110
|
-
var _ref;
|
|
111
|
-
|
|
111
|
+
if (runErr || !res || res.status !== 0) {
|
|
112
|
+
var _ref, _ref1;
|
|
113
|
+
// cross-spawn-cb sets runErr (with stdout/stderr/status copied onto it) on non-zero exit
|
|
114
|
+
// and does NOT pass res — read from runErr first, then fall back to res.
|
|
115
|
+
const source = runErr !== null && runErr !== void 0 ? runErr : res;
|
|
116
|
+
const status = source === null || source === void 0 ? void 0 : source.status;
|
|
117
|
+
const stdout = String((_ref = source === null || source === void 0 ? void 0 : source.stdout) !== null && _ref !== void 0 ? _ref : '');
|
|
118
|
+
const stderr = String((_ref1 = source === null || source === void 0 ? void 0 : source.stderr) !== null && _ref1 !== void 0 ? _ref1 : '');
|
|
119
|
+
const detail = `TypeScript compiler failed (status=${status}).\nstdout:\n${stdout.slice(0, 100000)}\nstderr:\n${stderr.slice(0, 20000)}`;
|
|
112
120
|
safeRm(tempDir, {
|
|
113
121
|
recursive: true,
|
|
114
122
|
force: true
|
|
115
|
-
}, ()=>callback(
|
|
123
|
+
}, ()=>callback(new Error(detail)));
|
|
116
124
|
return;
|
|
117
125
|
}
|
|
118
126
|
const emittedFiles = parseEmittedFiles(res, dest);
|
|
@@ -130,7 +138,8 @@ export default function transformTypesWorker(src, dest, options, callback) {
|
|
|
130
138
|
fs.readFile(file, 'utf8', (readErr, content)=>{
|
|
131
139
|
if (readErr) return cb();
|
|
132
140
|
const updated = rewriteExtensions(content);
|
|
133
|
-
updated === content
|
|
141
|
+
if (updated === content) cb();
|
|
142
|
+
else fs.writeFile(file, updated, 'utf8', (err)=>cb(err !== null && err !== void 0 ? err : undefined));
|
|
134
143
|
});
|
|
135
144
|
});
|
|
136
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformTypes.ts"],"sourcesContent":["import spawn, { type SpawnCallback, type SpawnResult } from 'cross-spawn-cb';\nimport fs from 'fs';\nimport Iterator, { type Entry } from 'fs-iterator';\nimport { safeRm } from 'fs-remove-compat';\nimport os from 'os';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport resolveBin from 'resolve-bin-sync';\n\nconst concurrency = Math.min(64, Math.max(8, (os.cpus()?.length ?? 4) * 8));\n\nconst tscPath = resolveBin('typescript', 'tsc');\n\nimport { typeFileRegEx } from '../constants.ts';\nimport createMatcher from '../createMatcher.ts';\nimport { rewriteExtensions } from '../lib/rewriteExtensions.ts';\n\nimport type { ConfigOptions, TransformTypesCallback } from '../types.ts';\n\n/* ---------------- root file filtering ---------------- */\n\nfunction isAllowedRootFile(basename: string): boolean {\n return (\n basename.endsWith('.d.ts') ||\n basename.endsWith('.d.mts') ||\n basename.endsWith('.d.cts') ||\n basename.endsWith('.ts') ||\n basename.endsWith('.tsx') ||\n basename.endsWith('.mts') ||\n basename.endsWith('.cts') ||\n basename.endsWith('.js') ||\n basename.endsWith('.jsx') ||\n basename.endsWith('.mjs') ||\n basename.endsWith('.cjs')\n );\n}\n\n/* ---------------- compiler execution ---------------- */\n\nfunction runCompiler(cmdPath: string, args: string[], cb: SpawnCallback): void {\n spawn(process.execPath, [cmdPath, ...args], { encoding: 'utf8' }, cb);\n}\n\n/* ---------------- emitted file parsing ---------------- */\n\nfunction parseEmittedFiles(res: SpawnResult, dest: string): string[] {\n const out: string[] = [];\n const seen = new Set<string>();\n const lines = `${res.stdout}\\n${res.stderr}`.split(/\\r?\\n/);\n\n for (let line of lines) {\n line = line.trim();\n if (!line) continue;\n\n if (/^TSFILE:\\s+/i.test(line)) line = line.replace(/^TSFILE:\\s+/i, '').trim();\n\n if (!path.isAbsolute(line)) continue;\n if (!(line.endsWith('.d.ts') || line.endsWith('.d.mts') || line.endsWith('.d.cts'))) continue;\n\n // Optional safety: only accept outputs under dest\n const rel = path.relative(dest, line);\n if (rel.startsWith('..') || path.isAbsolute(rel)) continue;\n\n if (!seen.has(line)) {\n seen.add(line);\n out.push(line);\n }\n }\n\n return out;\n}\n\nexport default function transformTypesWorker(src: string, dest: string, options: ConfigOptions, callback: TransformTypesCallback) {\n const tsconfig = options.tsconfig;\n const matcher = createMatcher(tsconfig);\n\n const rootFiles: string[] = [];\n const iterator = new Iterator(src);\n\n iterator.forEach(\n (entry: Entry): void => {\n if (!entry.stats.isFile()) return;\n if (entry.basename[0] === '.') return;\n if (typeFileRegEx.test(entry.basename)) return;\n if (!isAllowedRootFile(entry.basename)) return;\n if (!matcher(entry.fullPath)) return;\n\n rootFiles.push(entry.fullPath);\n },\n { concurrency },\n (err) => {\n if (err) return callback(err);\n if (rootFiles.length === 0) return callback(null, []);\n\n const compilerOptions = {\n ...tsconfig.config.compilerOptions,\n rootDir: src,\n outDir: dest,\n noEmit: false,\n allowJs: true,\n declaration: true,\n emitDeclarationOnly: true,\n downlevelIteration: undefined,\n ignoreDeprecations: '6.0',\n };\n\n const rewrite = tsconfig.config.compilerOptions?.rewriteRelativeImportExtensions === true;\n\n // Avoid collisions across concurrent runs.\n const tempDir = path.join(dest, '.ts-swc-transform-temp', String(process.pid), String(Date.now()));\n const tempConfigPath = path.join(tempDir, 'tsconfig.json');\n\n const tempConfig = {\n compilerOptions,\n files: rootFiles,\n include: [],\n exclude: [],\n ...(tsconfig.config.references && { references: tsconfig.config.references }),\n };\n\n fs.mkdir(tempDir, { recursive: true }, (mkdirErr) => {\n if (mkdirErr) return callback(mkdirErr);\n\n fs.writeFile(tempConfigPath, JSON.stringify(tempConfig, null, 2), 'utf8', (writeErr) => {\n if (writeErr) {\n safeRm(tempDir, { recursive: true, force: true }, () => callback(writeErr));\n return;\n }\n\n const args = ['--project', tempConfigPath, '--listEmittedFiles', '--pretty', 'false'];\n\n runCompiler(tscPath, args, (runErr, res) => {\n if (runErr || res.status !== 0) {\n const msg = `TypeScript compiler failed (status=${res?.status}).\\n${`stderr:\\n${String(res?.stderr ?? '')}`.slice(0, 20_000)}`;\n safeRm(tempDir, { recursive: true, force: true }, () => callback(runErr ?? new Error(msg)));\n return;\n }\n\n const emittedFiles = parseEmittedFiles(res, dest);\n if (emittedFiles.length === 0) {\n safeRm(tempDir, { recursive: true, force: true }, () => callback(new Error('TypeScript compiler produced no emitted declaration files')));\n return;\n }\n\n const postQueue = new Queue();\n\n if (rewrite) {\n for (const file of emittedFiles) {\n postQueue.defer((cb) => {\n fs.readFile(file, 'utf8', (readErr, content) => {\n if (readErr) return cb();\n const updated = rewriteExtensions(content);\n updated === content ? cb() : fs.writeFile(file, updated, 'utf8', cb);\n });\n });\n }\n }\n\n postQueue.await(() => {\n safeRm(tempDir, { recursive: true, force: true }, (rmErr) => callback(rmErr || null, emittedFiles));\n });\n });\n });\n });\n }\n );\n}\n"],"names":["os","spawn","fs","Iterator","safeRm","path","Queue","resolveBin","concurrency","Math","min","max","cpus","length","tscPath","typeFileRegEx","createMatcher","rewriteExtensions","isAllowedRootFile","basename","endsWith","runCompiler","cmdPath","args","cb","process","execPath","encoding","parseEmittedFiles","res","dest","out","seen","Set","lines","stdout","stderr","split","line","trim","test","replace","isAbsolute","rel","relative","startsWith","has","add","push","transformTypesWorker","src","options","callback","tsconfig","matcher","rootFiles","iterator","forEach","entry","stats","isFile","fullPath","err","compilerOptions","config","rootDir","outDir","noEmit","allowJs","declaration","emitDeclarationOnly","downlevelIteration","undefined","ignoreDeprecations","rewrite","rewriteRelativeImportExtensions","tempDir","join","String","pid","Date","now","tempConfigPath","tempConfig","files","include","exclude","references","mkdir","recursive","mkdirErr","writeFile","JSON","stringify","writeErr","force","runErr","status","msg","slice","Error","emittedFiles","postQueue","file","defer","readFile","readErr","content","updated","await","rmErr"],"mappings":";IAS8CA;AAT9C,OAAOC,WAAqD,iBAAiB;AAC7E,OAAOC,QAAQ,KAAK;AACpB,OAAOC,cAA8B,cAAc;AACnD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOJ,QAAQ,KAAK;AACpB,OAAOK,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAC7B,OAAOC,gBAAgB,mBAAmB;AAE1C,MAAMC,cAAcC,KAAKC,GAAG,CAAC,IAAID,KAAKE,GAAG,CAAC,GAAG,UAACX,WAAAA,GAAGY,IAAI,gBAAPZ,+BAAAA,SAAWa,MAAM,uCAAI,KAAK;AAExE,MAAMC,UAAUP,WAAW,cAAc;AAEzC,SAASQ,aAAa,QAAQ,kBAAkB;AAChD,OAAOC,mBAAmB,sBAAsB;AAChD,SAASC,iBAAiB,QAAQ,8BAA8B;AAIhE,yDAAyD,GAEzD,SAASC,kBAAkBC,QAAgB;IACzC,OACEA,SAASC,QAAQ,CAAC,YAClBD,SAASC,QAAQ,CAAC,aAClBD,SAASC,QAAQ,CAAC,aAClBD,SAASC,QAAQ,CAAC,UAClBD,SAASC,QAAQ,CAAC,WAClBD,SAASC,QAAQ,CAAC,WAClBD,SAASC,QAAQ,CAAC,WAClBD,SAASC,QAAQ,CAAC,UAClBD,SAASC,QAAQ,CAAC,WAClBD,SAASC,QAAQ,CAAC,WAClBD,SAASC,QAAQ,CAAC;AAEtB;AAEA,wDAAwD,GAExD,SAASC,YAAYC,OAAe,EAAEC,IAAc,EAAEC,EAAiB;IACrEvB,MAAMwB,QAAQC,QAAQ,EAAE;QAACJ;WAAYC;KAAK,EAAE;QAAEI,UAAU;IAAO,GAAGH;AACpE;AAEA,0DAA0D,GAE1D,SAASI,kBAAkBC,GAAgB,EAAEC,IAAY;IACvD,MAAMC,MAAgB,EAAE;IACxB,MAAMC,OAAO,IAAIC;IACjB,MAAMC,QAAQ,GAAG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E,MAAM,KAAK,GAAG;;wBAC9B,MAAMC,MAAM,CAAC,mCAAmC,EAAErE,gBAAAA,0BAAAA,IAAKoE,MAAM,CAAC,IAAI,EAAE,CAAC,SAAS,EAAEnB,eAAOjD,gBAAAA,0BAAAA,IAAKO,MAAM,uCAAI,KAAK,CAAC+D,KAAK,CAAC,GAAG,QAAS;wBAC9H/F,OAAOwE,SAAS;4BAAEa,WAAW;4BAAMM,OAAO;wBAAK,GAAG,IAAM3C,SAAS4C,mBAAAA,oBAAAA,SAAU,IAAII,MAAMF;wBACrF;oBACF;oBAEA,MAAMG,eAAezE,kBAAkBC,KAAKC;oBAC5C,IAAIuE,aAAaxF,MAAM,KAAK,GAAG;wBAC7BT,OAAOwE,SAAS;4BAAEa,WAAW;4BAAMM,OAAO;wBAAK,GAAG,IAAM3C,SAAS,IAAIgD,MAAM;wBAC3E;oBACF;oBAEA,MAAME,YAAY,IAAIhG;oBAEtB,IAAIoE,SAAS;wBACX,KAAK,MAAM6B,QAAQF,aAAc;4BAC/BC,UAAUE,KAAK,CAAC,CAAChF;gCACftB,GAAGuG,QAAQ,CAACF,MAAM,QAAQ,CAACG,SAASC;oCAClC,IAAID,SAAS,OAAOlF;oCACpB,MAAMoF,UAAU3F,kBAAkB0F;oCAClCC,YAAYD,UAAUnF,OAAOtB,GAAGyF,SAAS,CAACY,MAAMK,SAAS,QAAQpF;gCACnE;4BACF;wBACF;oBACF;oBAEA8E,UAAUO,KAAK,CAAC;wBACdzG,OAAOwE,SAAS;4BAAEa,WAAW;4BAAMM,OAAO;wBAAK,GAAG,CAACe,QAAU1D,SAAS0D,SAAS,MAAMT;oBACvF;gBACF;YACF;QACF;IACF;AAEJ"}
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformTypes.ts"],"sourcesContent":["import spawn, { type SpawnCallback, type SpawnResult } from 'cross-spawn-cb';\nimport fs from 'fs';\nimport Iterator, { type Entry } from 'fs-iterator';\nimport { safeRm } from 'fs-remove-compat';\nimport os from 'os';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport resolveBin from 'resolve-bin-sync';\n\nconst concurrency = Math.min(64, Math.max(8, (os.cpus()?.length ?? 4) * 8));\n\nconst tscPath = resolveBin('typescript', 'tsc');\n\nimport { typeFileRegEx } from '../constants.ts';\nimport createMatcher from '../createMatcher.ts';\nimport { rewriteExtensions } from '../lib/rewriteExtensions.ts';\n\nimport type { InternalConfigOptions, TransformTypesCallback } from '../types.ts';\n\n/* ---------------- root file filtering ---------------- */\n\nfunction isAllowedRootFile(basename: string): boolean {\n return (\n basename.endsWith('.d.ts') ||\n basename.endsWith('.d.mts') ||\n basename.endsWith('.d.cts') ||\n basename.endsWith('.ts') ||\n basename.endsWith('.tsx') ||\n basename.endsWith('.mts') ||\n basename.endsWith('.cts') ||\n basename.endsWith('.js') ||\n basename.endsWith('.jsx') ||\n basename.endsWith('.mjs') ||\n basename.endsWith('.cjs')\n );\n}\n\n/* ---------------- compiler execution ---------------- */\n\nfunction runCompiler(cmdPath: string, args: string[], cb: SpawnCallback): void {\n spawn(process.execPath, [cmdPath, ...args], { encoding: 'utf8' }, cb);\n}\n\n/* ---------------- emitted file parsing ---------------- */\n\nfunction parseEmittedFiles(res: SpawnResult, dest: string): string[] {\n const out: string[] = [];\n const seen = new Set<string>();\n const lines = `${res.stdout}\\n${res.stderr}`.split(/\\r?\\n/);\n\n for (let line of lines) {\n line = line.trim();\n if (!line) continue;\n\n if (/^TSFILE:\\s+/i.test(line)) line = line.replace(/^TSFILE:\\s+/i, '').trim();\n\n if (!path.isAbsolute(line)) continue;\n if (!(line.endsWith('.d.ts') || line.endsWith('.d.mts') || line.endsWith('.d.cts'))) continue;\n\n // Optional safety: only accept outputs under dest\n const rel = path.relative(dest, line);\n if (rel.startsWith('..') || path.isAbsolute(rel)) continue;\n\n if (!seen.has(line)) {\n seen.add(line);\n out.push(line);\n }\n }\n\n return out;\n}\n\nexport default function transformTypesWorker(src: string, dest: string, options: InternalConfigOptions, callback: TransformTypesCallback) {\n const tsconfig = options.tsconfig;\n const matcher = createMatcher(tsconfig);\n\n const rootFiles: string[] = [];\n const iterator = new Iterator(src);\n\n iterator.forEach(\n (entry: Entry): void => {\n const stats = entry.stats as fs.Stats | undefined;\n if (!stats || !stats.isFile()) return;\n const basename = entry.basename as string;\n if (basename[0] === '.') return;\n if (typeFileRegEx.test(basename)) return;\n if (!isAllowedRootFile(basename)) return;\n if (!matcher(entry.fullPath)) return;\n\n rootFiles.push(entry.fullPath);\n },\n { concurrency },\n (err) => {\n if (err) return callback(err);\n if (rootFiles.length === 0) return callback(null, []);\n\n const compilerOptions = {\n ...tsconfig.config.compilerOptions,\n rootDir: src,\n outDir: dest,\n noEmit: false,\n allowJs: true,\n declaration: true,\n emitDeclarationOnly: true,\n // Suppress TS6 deprecation warnings (TS5101/TS5107) for consumers still on legacy Node-targeted options.\n ignoreDeprecations: '6.0',\n };\n\n const rewrite = (tsconfig.config.compilerOptions as { rewriteRelativeImportExtensions?: boolean } | undefined)?.rewriteRelativeImportExtensions === true;\n\n // Avoid collisions across concurrent runs.\n const tempDir = path.join(dest, '.ts-swc-transform-temp', String(process.pid), String(Date.now()));\n const tempConfigPath = path.join(tempDir, 'tsconfig.json');\n\n const tempConfig = {\n compilerOptions,\n files: rootFiles,\n include: [],\n exclude: [],\n ...(tsconfig.config.references && { references: tsconfig.config.references }),\n };\n\n fs.mkdir(tempDir, { recursive: true }, (mkdirErr) => {\n if (mkdirErr) return callback(mkdirErr);\n\n fs.writeFile(tempConfigPath, JSON.stringify(tempConfig, null, 2), 'utf8', (writeErr) => {\n if (writeErr) {\n safeRm(tempDir, { recursive: true, force: true }, () => callback(writeErr));\n return;\n }\n\n const args = ['--project', tempConfigPath, '--listEmittedFiles', '--pretty', 'false'];\n\n runCompiler(tscPath, args, (runErr, res) => {\n if (runErr || !res || res.status !== 0) {\n // cross-spawn-cb sets runErr (with stdout/stderr/status copied onto it) on non-zero exit\n // and does NOT pass res — read from runErr first, then fall back to res.\n const source = (runErr as unknown as SpawnResult | undefined) ?? res;\n const status = source?.status;\n const stdout = String(source?.stdout ?? '');\n const stderr = String(source?.stderr ?? '');\n const detail = `TypeScript compiler failed (status=${status}).\\nstdout:\\n${stdout.slice(0, 100_000)}\\nstderr:\\n${stderr.slice(0, 20_000)}`;\n safeRm(tempDir, { recursive: true, force: true }, () => callback(new Error(detail)));\n return;\n }\n\n const emittedFiles = parseEmittedFiles(res, dest);\n if (emittedFiles.length === 0) {\n safeRm(tempDir, { recursive: true, force: true }, () => callback(new Error('TypeScript compiler produced no emitted declaration files')));\n return;\n }\n\n const postQueue = new Queue();\n\n if (rewrite) {\n for (const file of emittedFiles) {\n postQueue.defer((cb) => {\n fs.readFile(file, 'utf8', (readErr, content) => {\n if (readErr) return cb();\n const updated = rewriteExtensions(content);\n if (updated === content) cb();\n else fs.writeFile(file, updated, 'utf8', (err) => cb(err ?? undefined));\n });\n });\n }\n }\n\n postQueue.await(() => {\n safeRm(tempDir, { recursive: true, force: true }, (rmErr) => callback(rmErr || null, emittedFiles));\n });\n });\n });\n });\n }\n );\n}\n"],"names":["os","spawn","fs","Iterator","safeRm","path","Queue","resolveBin","concurrency","Math","min","max","cpus","length","tscPath","typeFileRegEx","createMatcher","rewriteExtensions","isAllowedRootFile","basename","endsWith","runCompiler","cmdPath","args","cb","process","execPath","encoding","parseEmittedFiles","res","dest","out","seen","Set","lines","stdout","stderr","split","line","trim","test","replace","isAbsolute","rel","relative","startsWith","has","add","push","transformTypesWorker","src","options","callback","tsconfig","matcher","rootFiles","iterator","forEach","entry","stats","isFile","fullPath","err","compilerOptions","config","rootDir","outDir","noEmit","allowJs","declaration","emitDeclarationOnly","ignoreDeprecations","rewrite","rewriteRelativeImportExtensions","tempDir","join","String","pid","Date","now","tempConfigPath","tempConfig","files","include","exclude","references","mkdir","recursive","mkdirErr","writeFile","JSON","stringify","writeErr","force","runErr","status","source","detail","slice","Error","emittedFiles","postQueue","file","defer","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K,GAAG,CAACiB,QAAU1D,SAAS0D,SAAS,MAAMV;oBACvF;gBACF;YACF;QACF;IACF;AAEJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-swc-transform",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.7",
|
|
4
4
|
"description": "Typescript transformers for swc. Supports Node >= 0.8",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"matcher",
|
|
@@ -64,9 +64,12 @@
|
|
|
64
64
|
"typescript": "^6.0.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
+
"@types/is-absolute": "^1.0.2",
|
|
68
|
+
"@types/lodash.debounce": "^4.0.9",
|
|
67
69
|
"@types/mocha": "*",
|
|
68
70
|
"@types/node": "*",
|
|
69
71
|
"@types/react": "*",
|
|
72
|
+
"@types/resolve": "^1.20.6",
|
|
70
73
|
"cr": "^0.1.0",
|
|
71
74
|
"cross-spawn-cb": "^3.0.0",
|
|
72
75
|
"fs-remove-compat": "^1.0.0",
|