ts-swc-transform 2.7.5 → 2.7.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/transformFile.js +23 -9
- package/dist/cjs/lib/transformFile.js.map +1 -1
- package/dist/cjs/workers/transformTypes.js +161 -43
- package/dist/cjs/workers/transformTypes.js.map +1 -1
- package/dist/esm/lib/transformFile.js +24 -8
- package/dist/esm/lib/transformFile.js.map +1 -1
- package/dist/esm/workers/transformTypes.js +88 -43
- package/dist/esm/workers/transformTypes.js.map +1 -1
- package/package.json +28 -28
|
@@ -90,15 +90,29 @@ function transformFile(entry, dest, type, options, callback) {
|
|
|
90
90
|
swc.transformFile(entry.fullPath, _object_spread_props(_object_spread({}, ext === '.tsx' || ext === '.jsx' ? swcOptions.tsxOptions : swcOptions.nonTsxOptions), {
|
|
91
91
|
filename: entry.basename
|
|
92
92
|
})).then(function(output) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
// Get source file mode to preserve executable permissions
|
|
94
|
+
_fs.default.stat(entry.fullPath, function(statErr, stats) {
|
|
95
|
+
if (statErr) return callback(statErr);
|
|
96
|
+
var extTarget = type === 'esm' ? (0, _patchESMts.default)(entry, output, options) : (0, _patchCJSts.default)(entry, output, options);
|
|
97
|
+
var ext = _path.default.extname(entry.path);
|
|
98
|
+
var outPath = _path.default.join(dest, (ext ? entry.path.slice(0, -ext.length) : entry.path) + extTarget);
|
|
99
|
+
(0, _mkdirpclassic.default)(_path.default.dirname(outPath), function() {
|
|
100
|
+
var queue = new _queuecb.default();
|
|
101
|
+
queue.defer(_fs.default.writeFile.bind(null, outPath, output.code, 'utf8'));
|
|
102
|
+
if (output.map && options.sourceMaps) queue.defer(_fs.default.writeFile.bind(null, "".concat(outPath, ".map"), output.map, 'utf8'));
|
|
103
|
+
queue.await(function(err) {
|
|
104
|
+
if (err) return callback(err);
|
|
105
|
+
// Preserve executable permissions from source (only +x bits, not full mode)
|
|
106
|
+
var execBits = stats.mode & 73;
|
|
107
|
+
if (execBits) {
|
|
108
|
+
_fs.default.chmod(outPath, 420 | execBits, function(_chmodErr) {
|
|
109
|
+
// Ignore chmod errors (e.g., on Windows)
|
|
110
|
+
callback(null, outPath);
|
|
111
|
+
});
|
|
112
|
+
} else {
|
|
113
|
+
callback(null, outPath);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
102
116
|
});
|
|
103
117
|
});
|
|
104
118
|
}).catch(callback);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/transformFile.ts"],"sourcesContent":["import type { Output } from '@swc/core';\nimport fs from 'fs';\nimport type { Entry } from 'fs-iterator';\nimport mkdirp from 'mkdirp-classic';\nimport Module from 'module';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport patchCJS from '../lib/patchCJS.ts';\nimport patchESM from '../lib/patchESM.ts';\nimport prepareSWCOptions from '../lib/prepareSWCOptions.ts';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nimport type { ConfigOptions, TargetType, TransformFileCallback } from '../types.ts';\n\nexport default function transformFile(entry: Entry, dest: string, type: TargetType, options: ConfigOptions, callback: TransformFileCallback): undefined {\n let tsconfig = options.tsconfig;\n\n // overrides for cjs\n if (type === 'cjs') {\n tsconfig = { ...tsconfig };\n tsconfig.config = { ...tsconfig.config };\n tsconfig.config.compilerOptions = { ...(tsconfig.config.compilerOptions || {}) };\n tsconfig.config.compilerOptions.module = 'commonjs';\n tsconfig.config.compilerOptions.target = 'es5';\n }\n\n const swcOptions = prepareSWCOptions(tsconfig);\n const swc = _require('@swc/core');\n const ext = path.extname(entry.basename);\n\n swc\n .transformFile(entry.fullPath, {\n ...(ext === '.tsx' || ext === '.jsx' ? swcOptions.tsxOptions : swcOptions.nonTsxOptions),\n filename: entry.basename,\n })\n .then((output: Output) => {\n const extTarget = type === 'esm' ? patchESM(entry, output, options) : patchCJS(entry, output, options);\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/transformFile.ts"],"sourcesContent":["import type { Output } from '@swc/core';\nimport fs from 'fs';\nimport type { Entry } from 'fs-iterator';\nimport mkdirp from 'mkdirp-classic';\nimport Module from 'module';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport patchCJS from '../lib/patchCJS.ts';\nimport patchESM from '../lib/patchESM.ts';\nimport prepareSWCOptions from '../lib/prepareSWCOptions.ts';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nimport type { ConfigOptions, TargetType, TransformFileCallback } from '../types.ts';\n\nexport default function transformFile(entry: Entry, dest: string, type: TargetType, options: ConfigOptions, callback: TransformFileCallback): undefined {\n let tsconfig = options.tsconfig;\n\n // overrides for cjs\n if (type === 'cjs') {\n tsconfig = { ...tsconfig };\n tsconfig.config = { ...tsconfig.config };\n tsconfig.config.compilerOptions = { ...(tsconfig.config.compilerOptions || {}) };\n tsconfig.config.compilerOptions.module = 'commonjs';\n tsconfig.config.compilerOptions.target = 'es5';\n }\n\n const swcOptions = prepareSWCOptions(tsconfig);\n const swc = _require('@swc/core');\n const ext = path.extname(entry.basename);\n\n swc\n .transformFile(entry.fullPath, {\n ...(ext === '.tsx' || ext === '.jsx' ? swcOptions.tsxOptions : swcOptions.nonTsxOptions),\n filename: entry.basename,\n })\n .then((output: Output) => {\n // Get source file mode to preserve executable permissions\n fs.stat(entry.fullPath, (statErr, stats) => {\n if (statErr) return callback(statErr);\n\n const extTarget = type === 'esm' ? patchESM(entry, output, options) : patchCJS(entry, output, options);\n const ext = path.extname(entry.path);\n const outPath = path.join(dest, (ext ? entry.path.slice(0, -ext.length) : entry.path) + extTarget);\n\n mkdirp(path.dirname(outPath), () => {\n const queue = new Queue();\n queue.defer(fs.writeFile.bind(null, outPath, output.code, 'utf8'));\n if (output.map && options.sourceMaps) queue.defer(fs.writeFile.bind(null, `${outPath}.map`, output.map, 'utf8'));\n queue.await((err) => {\n if (err) return callback(err);\n\n // Preserve executable permissions from source (only +x bits, not full mode)\n const execBits = stats.mode & 0o111;\n if (execBits) {\n fs.chmod(outPath, 0o644 | execBits, (_chmodErr) => {\n // Ignore chmod errors (e.g., on Windows)\n callback(null, outPath);\n });\n } else {\n callback(null, outPath);\n }\n });\n });\n });\n })\n .catch(callback);\n}\n"],"names":["transformFile","_require","require","Module","createRequire","entry","dest","type","options","callback","tsconfig","config","compilerOptions","module","target","swcOptions","prepareSWCOptions","swc","ext","path","extname","basename","fullPath","tsxOptions","nonTsxOptions","filename","then","output","fs","stat","statErr","stats","extTarget","patchESM","patchCJS","outPath","join","slice","length","mkdirp","dirname","queue","Queue","defer","writeFile","bind","code","map","sourceMaps","await","err","execBits","mode","chmod","_chmodErr","catch"],"mappings":";;;;+BAeA;;;eAAwBA;;;yDAdT;oEAEI;6DACA;2DACF;8DACC;iEACG;iEACA;0EACS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9B,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAI3E,SAASF,cAAcK,KAAY,EAAEC,IAAY,EAAEC,IAAgB,EAAEC,OAAsB,EAAEC,QAA+B;IACzI,IAAIC,WAAWF,QAAQE,QAAQ;IAE/B,oBAAoB;IACpB,IAAIH,SAAS,OAAO;QAClBG,WAAW,mBAAKA;QAChBA,SAASC,MAAM,GAAG,mBAAKD,SAASC,MAAM;QACtCD,SAASC,MAAM,CAACC,eAAe,GAAG,mBAAMF,SAASC,MAAM,CAACC,eAAe,IAAI,CAAC;QAC5EF,SAASC,MAAM,CAACC,eAAe,CAACC,MAAM,GAAG;QACzCH,SAASC,MAAM,CAACC,eAAe,CAACE,MAAM,GAAG;IAC3C;I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4EAA4E;oBAC5E,IAAMC,WAAWpB,MAAMqB,IAAI,GAAG;oBAC9B,IAAID,UAAU;wBACZvB,WAAE,CAACyB,KAAK,CAAClB,SAAS,MAAQgB,UAAU,SAACG;4BACnC,yCAAyC;4BACzC7C,SAAS,MAAM0B;wBACjB;oBACF,OAAO;wBACL1B,SAAS,MAAM0B;oBACjB;gBACF;YACF;QACF;IACF,GACCoB,KAAK,CAAC9C;AACX"}
|
|
@@ -11,10 +11,20 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
12
|
var _fsiterator = /*#__PURE__*/ _interop_require_default(require("fs-iterator"));
|
|
13
13
|
var _module = /*#__PURE__*/ _interop_require_default(require("module"));
|
|
14
|
+
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
15
|
+
var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
|
|
14
16
|
var _compatts = require("../compat.js");
|
|
15
17
|
var _constantsts = require("../constants.js");
|
|
16
18
|
var _createMatcherts = /*#__PURE__*/ _interop_require_default(require("../createMatcher.js"));
|
|
17
19
|
var _rewriteExtensionsts = require("../lib/rewriteExtensions.js");
|
|
20
|
+
function _array_like_to_array(arr, len) {
|
|
21
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
22
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
23
|
+
return arr2;
|
|
24
|
+
}
|
|
25
|
+
function _array_with_holes(arr) {
|
|
26
|
+
if (Array.isArray(arr)) return arr;
|
|
27
|
+
}
|
|
18
28
|
function _define_property(obj, key, value) {
|
|
19
29
|
if (key in obj) {
|
|
20
30
|
Object.defineProperty(obj, key, {
|
|
@@ -33,6 +43,33 @@ function _interop_require_default(obj) {
|
|
|
33
43
|
default: obj
|
|
34
44
|
};
|
|
35
45
|
}
|
|
46
|
+
function _iterable_to_array_limit(arr, i) {
|
|
47
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
48
|
+
if (_i == null) return;
|
|
49
|
+
var _arr = [];
|
|
50
|
+
var _n = true;
|
|
51
|
+
var _d = false;
|
|
52
|
+
var _s, _e;
|
|
53
|
+
try {
|
|
54
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
55
|
+
_arr.push(_s.value);
|
|
56
|
+
if (i && _arr.length === i) break;
|
|
57
|
+
}
|
|
58
|
+
} catch (err) {
|
|
59
|
+
_d = true;
|
|
60
|
+
_e = err;
|
|
61
|
+
} finally{
|
|
62
|
+
try {
|
|
63
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
64
|
+
} finally{
|
|
65
|
+
if (_d) throw _e;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return _arr;
|
|
69
|
+
}
|
|
70
|
+
function _non_iterable_rest() {
|
|
71
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
72
|
+
}
|
|
36
73
|
function _object_spread(target) {
|
|
37
74
|
for(var i = 1; i < arguments.length; i++){
|
|
38
75
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -72,6 +109,17 @@ function _object_spread_props(target, source) {
|
|
|
72
109
|
}
|
|
73
110
|
return target;
|
|
74
111
|
}
|
|
112
|
+
function _sliced_to_array(arr, i) {
|
|
113
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
114
|
+
}
|
|
115
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
116
|
+
if (!o) return;
|
|
117
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
118
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
119
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
120
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
121
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
122
|
+
}
|
|
75
123
|
var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
|
|
76
124
|
function transformTypesWorker(src, dest, options, callback) {
|
|
77
125
|
var tsconfig = options.tsconfig;
|
|
@@ -92,52 +140,122 @@ function transformTypesWorker(src, dest, options, callback) {
|
|
|
92
140
|
callback(err);
|
|
93
141
|
return;
|
|
94
142
|
}
|
|
95
|
-
|
|
96
|
-
var
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
143
|
+
// Step 1: Stat all source files to get their modes (async)
|
|
144
|
+
var sourceModes = new Map();
|
|
145
|
+
var statQueue = new _queuecb.default();
|
|
146
|
+
entries.forEach(function(entry) {
|
|
147
|
+
statQueue.defer(function(cb) {
|
|
148
|
+
_fs.default.stat(entry.fullPath, function(statErr, stats) {
|
|
149
|
+
if (!statErr) sourceModes.set(entry.fullPath, stats.mode);
|
|
150
|
+
cb(); // Continue even on error
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
statQueue.await(function(statErr) {
|
|
155
|
+
if (statErr) {
|
|
156
|
+
callback(statErr);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
// Step 2: TypeScript emit (inherently sync - cannot change)
|
|
160
|
+
var compilerOptions = ts.convertCompilerOptionsFromJson(tsconfig.config.compilerOptions, '');
|
|
161
|
+
var config = {
|
|
162
|
+
fileNames: entries.map(function(entry) {
|
|
163
|
+
return entry.fullPath;
|
|
164
|
+
}),
|
|
165
|
+
options: _object_spread_props(_object_spread({}, compilerOptions.options), {
|
|
166
|
+
outDir: dest,
|
|
167
|
+
noEmit: false,
|
|
168
|
+
allowJs: true,
|
|
169
|
+
declaration: true,
|
|
170
|
+
emitDeclarationOnly: true,
|
|
171
|
+
listEmittedFiles: true
|
|
172
|
+
}),
|
|
173
|
+
projectReferences: tsconfig.config.references
|
|
174
|
+
};
|
|
175
|
+
var fileNames = config.fileNames, _$options = config.options, projectReferences = config.projectReferences;
|
|
176
|
+
var host = ts.createCompilerHostWorker(_$options, /*setParentNodes*/ undefined, ts.sys);
|
|
177
|
+
var programOptions = {
|
|
178
|
+
rootNames: fileNames,
|
|
179
|
+
options: _$options,
|
|
180
|
+
projectReferences: projectReferences,
|
|
181
|
+
host: host,
|
|
182
|
+
configFileParsingDiagnostics: ts.getConfigFileParsingDiagnostics({
|
|
183
|
+
fileNames: fileNames,
|
|
184
|
+
options: _$options
|
|
185
|
+
})
|
|
186
|
+
};
|
|
187
|
+
var program = ts.createProgram(programOptions);
|
|
188
|
+
var res = program.emit();
|
|
189
|
+
// Step 3: Post-process emitted files (async)
|
|
190
|
+
var postQueue = new _queuecb.default();
|
|
191
|
+
if (res.emittedFiles) {
|
|
192
|
+
res.emittedFiles.forEach(function(file) {
|
|
193
|
+
// 3a: Rewrite extensions (convert from sync to async)
|
|
194
|
+
// TODO: remove patch for https://github.com/microsoft/TypeScript/issues/61037
|
|
195
|
+
if (compilerOptions.options.rewriteRelativeImportExtensions) {
|
|
196
|
+
if ((0, _compatts.stringEndsWith)(file, '.d.ts') || (0, _compatts.stringEndsWith)(file, '.d.cts') || (0, _compatts.stringEndsWith)(file, '.d.mts')) {
|
|
197
|
+
postQueue.defer(function(cb) {
|
|
198
|
+
_fs.default.readFile(file, 'utf8', function(readErr, content) {
|
|
199
|
+
if (readErr) return cb(); // Ignore errors, continue
|
|
200
|
+
var updated = (0, _rewriteExtensionsts.rewriteExtensions)(content);
|
|
201
|
+
if (updated !== content) {
|
|
202
|
+
_fs.default.writeFile(file, updated, 'utf8', function() {
|
|
203
|
+
return cb();
|
|
204
|
+
}); // Ignore write errors
|
|
205
|
+
} else {
|
|
206
|
+
cb();
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
});
|
|
133
210
|
}
|
|
134
|
-
} catch (_err) {
|
|
135
|
-
// Ignore errors
|
|
136
211
|
}
|
|
137
|
-
|
|
212
|
+
// 3b: Apply executable permissions from source files
|
|
213
|
+
if ((0, _compatts.stringEndsWith)(file, '.d.ts') || (0, _compatts.stringEndsWith)(file, '.d.cts') || (0, _compatts.stringEndsWith)(file, '.d.mts')) {
|
|
214
|
+
var relativePath = _path.default.relative(dest, file);
|
|
215
|
+
var baseName = relativePath.replace(/\.d\.(ts|mts|cts)$/, '');
|
|
216
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
217
|
+
try {
|
|
218
|
+
var _loop = function() {
|
|
219
|
+
var _step_value = _sliced_to_array(_step.value, 2), srcPath = _step_value[0], mode = _step_value[1];
|
|
220
|
+
var srcRelative = _path.default.relative(src, srcPath);
|
|
221
|
+
var srcBase = srcRelative.replace(/\.(ts|tsx|mts|cts)$/, '');
|
|
222
|
+
if (baseName === srcBase) {
|
|
223
|
+
var execBits = mode & 73;
|
|
224
|
+
if (execBits) {
|
|
225
|
+
postQueue.defer(function(cb) {
|
|
226
|
+
_fs.default.chmod(file, 420 | execBits, function() {
|
|
227
|
+
return cb();
|
|
228
|
+
}); // Ignore chmod errors
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
return "break";
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
for(var _iterator = sourceModes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
235
|
+
var _ret = _loop();
|
|
236
|
+
if (_ret === "break") break;
|
|
237
|
+
}
|
|
238
|
+
} catch (err) {
|
|
239
|
+
_didIteratorError = true;
|
|
240
|
+
_iteratorError = err;
|
|
241
|
+
} finally{
|
|
242
|
+
try {
|
|
243
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
244
|
+
_iterator.return();
|
|
245
|
+
}
|
|
246
|
+
} finally{
|
|
247
|
+
if (_didIteratorError) {
|
|
248
|
+
throw _iteratorError;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
postQueue.await(function() {
|
|
256
|
+
return callback(null, res.emittedFiles);
|
|
138
257
|
});
|
|
139
|
-
}
|
|
140
|
-
callback(null, res.emittedFiles);
|
|
258
|
+
});
|
|
141
259
|
});
|
|
142
260
|
}
|
|
143
261
|
/* 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/workers/transformTypes.ts"],"sourcesContent":["import fs from 'fs';\nimport Iterator, { type Entry } from 'fs-iterator';\nimport Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nimport { stringEndsWith } from '../compat.ts';\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\nexport default function transformTypesWorker(src: string, dest: string, options: ConfigOptions, callback: TransformTypesCallback): undefined {\n const tsconfig = options.tsconfig;\n const matcher = createMatcher(tsconfig);\n const ts = _require('typescript');\n\n const entries = [];\n const iterator = new Iterator(src);\n iterator.forEach(\n (entry: Entry): undefined => {\n if (!entry.stats.isFile()) return;\n if (entry.basename[0] === '.') return;\n if (typeFileRegEx.test(entry.basename)) return;\n if (!matcher(entry.fullPath)) return;\n entries.push(entry);\n },\n { concurrency: Infinity },\n (err): undefined => {\n if (err) {\n callback(err);\n return;\n }\n\n const compilerOptions = ts.convertCompilerOptionsFromJson(tsconfig.config.compilerOptions, '');\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformTypes.ts"],"sourcesContent":["import fs from 'fs';\nimport Iterator, { type Entry } from 'fs-iterator';\nimport Module from 'module';\nimport path from 'path';\nimport Queue from 'queue-cb';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nimport { stringEndsWith } from '../compat.ts';\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\nexport default function transformTypesWorker(src: string, dest: string, options: ConfigOptions, callback: TransformTypesCallback): undefined {\n const tsconfig = options.tsconfig;\n const matcher = createMatcher(tsconfig);\n const ts = _require('typescript');\n\n const entries = [];\n const iterator = new Iterator(src);\n iterator.forEach(\n (entry: Entry): undefined => {\n if (!entry.stats.isFile()) return;\n if (entry.basename[0] === '.') return;\n if (typeFileRegEx.test(entry.basename)) return;\n if (!matcher(entry.fullPath)) return;\n entries.push(entry);\n },\n { concurrency: Infinity },\n (err): undefined => {\n if (err) {\n callback(err);\n return;\n }\n\n // Step 1: Stat all source files to get their modes (async)\n const sourceModes = new Map<string, number>();\n const statQueue = new Queue();\n entries.forEach((entry) => {\n statQueue.defer((cb) => {\n fs.stat(entry.fullPath, (statErr, stats) => {\n if (!statErr) sourceModes.set(entry.fullPath, stats.mode);\n cb(); // Continue even on error\n });\n });\n });\n\n statQueue.await((statErr) => {\n if (statErr) {\n callback(statErr);\n return;\n }\n\n // Step 2: TypeScript emit (inherently sync - cannot change)\n const compilerOptions = ts.convertCompilerOptionsFromJson(tsconfig.config.compilerOptions, '');\n const config = {\n fileNames: entries.map((entry) => entry.fullPath),\n options: {\n ...compilerOptions.options,\n outDir: dest,\n noEmit: false,\n allowJs: true,\n declaration: true,\n emitDeclarationOnly: true,\n listEmittedFiles: true,\n },\n projectReferences: tsconfig.config.references,\n };\n const { fileNames, options, projectReferences } = config;\n const host = ts.createCompilerHostWorker(options, /*setParentNodes*/ undefined, ts.sys);\n const programOptions = {\n rootNames: fileNames,\n options,\n projectReferences,\n host,\n configFileParsingDiagnostics: ts.getConfigFileParsingDiagnostics({ fileNames, options }),\n };\n const program = ts.createProgram(programOptions);\n const res = program.emit();\n\n // Step 3: Post-process emitted files (async)\n const postQueue = new Queue();\n\n if (res.emittedFiles) {\n res.emittedFiles.forEach((file) => {\n // 3a: Rewrite extensions (convert from sync to async)\n // TODO: remove patch for https://github.com/microsoft/TypeScript/issues/61037\n if (compilerOptions.options.rewriteRelativeImportExtensions) {\n if (stringEndsWith(file, '.d.ts') || stringEndsWith(file, '.d.cts') || stringEndsWith(file, '.d.mts')) {\n postQueue.defer((cb) => {\n fs.readFile(file, 'utf8', (readErr, content) => {\n if (readErr) return cb(); // Ignore errors, continue\n const updated = rewriteExtensions(content);\n if (updated !== content) {\n fs.writeFile(file, updated, 'utf8', () => cb()); // Ignore write errors\n } else {\n cb();\n }\n });\n });\n }\n }\n\n // 3b: Apply executable permissions from source files\n if (stringEndsWith(file, '.d.ts') || stringEndsWith(file, '.d.cts') || stringEndsWith(file, '.d.mts')) {\n const relativePath = path.relative(dest, file);\n const baseName = relativePath.replace(/\\.d\\.(ts|mts|cts)$/, '');\n\n for (const [srcPath, mode] of sourceModes) {\n const srcRelative = path.relative(src, srcPath);\n const srcBase = srcRelative.replace(/\\.(ts|tsx|mts|cts)$/, '');\n if (baseName === srcBase) {\n const execBits = mode & 0o111;\n if (execBits) {\n postQueue.defer((cb) => {\n fs.chmod(file, 0o644 | execBits, () => cb()); // Ignore chmod errors\n });\n }\n break;\n }\n }\n }\n });\n }\n\n postQueue.await(() => callback(null, res.emittedFiles));\n });\n }\n );\n}\n"],"names":["transformTypesWorker","_require","require","Module","createRequire","src","dest","options","callback","tsconfig","matcher","createMatcher","ts","entries","iterator","Iterator","forEach","entry","stats","isFile","basename","typeFileRegEx","test","fullPath","push","concurrency","Infinity","err","sourceModes","Map","statQueue","Queue","defer","cb","fs","stat","statErr","set","mode","await","compilerOptions","convertCompilerOptionsFromJson","config","fileNames","map","outDir","noEmit","allowJs","declaration","emitDeclarationOnly","listEmittedFiles","projectReferences","references","host","createCompilerHostWorker","undefined","sys","programOptions","rootNames","configFileParsingDiagnostics","getConfigFileParsingDiagnostics","program","createProgram","res","emit","postQueue","emittedFiles","file","rewriteRelativeImportExtensions","stringEndsWith","readFile","readErr","content","updated","rewriteExtensions","writeFile","relativePath","path","relative","baseName","replace","srcPath","srcRelative","srcBase","execBits","chmod"],"mappings":";;;;+BAeA;;;eAAwBA;;;yDAfT;iEACsB;6DAClB;2DACF;8DACC;wBAIa;2BACD;sEACJ;mCACQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AALlC,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAS3E,SAASF,qBAAqBK,GAAW,EAAEC,IAAY,EAAEC,OAAsB,EAAEC,QAAgC;IAC9H,IAAMC,WAAWF,QAAQE,QAAQ;IACjC,IAAMC,UAAUC,IAAAA,wBAAa,EAACF;IAC9B,IAAMG,KAAKX,SAAS;IAEpB,IAAMY,UAAU,EAAE;IAClB,IAAMC,WAAW,IAAIC,mBAAQ,CAACV;IAC9BS,SAASE,OAAO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AA,2BAAA;;;gCAAA,mCAAA,iBAAOC,0BAAS3C;gCACnB,IAAM4C,cAAcL,aAAI,CAACC,QAAQ,CAACzE,KAAK4E;gCACvC,IAAME,UAAUD,YAAYF,OAAO,CAAC,uBAAuB;gCAC3D,IAAID,aAAaI,SAAS;oCACxB,IAAMC,WAAW9C,OAAO;oCACxB,IAAI8C,UAAU;wCACZnB,UAAUjC,KAAK,CAAC,SAACC;4CACfC,WAAE,CAACmD,KAAK,CAAClB,MAAM,MAAQiB,UAAU;uDAAMnD;gDAAO,sBAAsB;wCACtE;oCACF;oCACA,OAAA;gCACF;4BACF;4BAZA,QAAK,YAAyBL,gCAAzB,SAAA,6BAAA,QAAA,yBAAA;;;;;4BAAA;4BAAA;;;qCAAA,6BAAA;oCAAA;;;oCAAA;0CAAA;;;;oBAaP;gBACF;YACF;YAEAqC,UAAU1B,KAAK,CAAC;uBAAM/B,SAAS,MAAMuD,IAAIG,YAAY;;QACvD;IACF;AAEJ"}
|
|
@@ -30,14 +30,30 @@ export default function transformFile(entry, dest, type, options, callback) {
|
|
|
30
30
|
...ext === '.tsx' || ext === '.jsx' ? swcOptions.tsxOptions : swcOptions.nonTsxOptions,
|
|
31
31
|
filename: entry.basename
|
|
32
32
|
}).then((output)=>{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
// Get source file mode to preserve executable permissions
|
|
34
|
+
fs.stat(entry.fullPath, (statErr, stats)=>{
|
|
35
|
+
if (statErr) return callback(statErr);
|
|
36
|
+
const extTarget = type === 'esm' ? patchESM(entry, output, options) : patchCJS(entry, output, options);
|
|
37
|
+
const ext = path.extname(entry.path);
|
|
38
|
+
const outPath = path.join(dest, (ext ? entry.path.slice(0, -ext.length) : entry.path) + extTarget);
|
|
39
|
+
mkdirp(path.dirname(outPath), ()=>{
|
|
40
|
+
const queue = new Queue();
|
|
41
|
+
queue.defer(fs.writeFile.bind(null, outPath, output.code, 'utf8'));
|
|
42
|
+
if (output.map && options.sourceMaps) queue.defer(fs.writeFile.bind(null, `${outPath}.map`, output.map, 'utf8'));
|
|
43
|
+
queue.await((err)=>{
|
|
44
|
+
if (err) return callback(err);
|
|
45
|
+
// Preserve executable permissions from source (only +x bits, not full mode)
|
|
46
|
+
const execBits = stats.mode & 0o111;
|
|
47
|
+
if (execBits) {
|
|
48
|
+
fs.chmod(outPath, 0o644 | execBits, (_chmodErr)=>{
|
|
49
|
+
// Ignore chmod errors (e.g., on Windows)
|
|
50
|
+
callback(null, outPath);
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
callback(null, outPath);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
});
|
|
41
57
|
});
|
|
42
58
|
}).catch(callback);
|
|
43
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/transformFile.ts"],"sourcesContent":["import type { Output } from '@swc/core';\nimport fs from 'fs';\nimport type { Entry } from 'fs-iterator';\nimport mkdirp from 'mkdirp-classic';\nimport Module from 'module';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport patchCJS from '../lib/patchCJS.ts';\nimport patchESM from '../lib/patchESM.ts';\nimport prepareSWCOptions from '../lib/prepareSWCOptions.ts';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nimport type { ConfigOptions, TargetType, TransformFileCallback } from '../types.ts';\n\nexport default function transformFile(entry: Entry, dest: string, type: TargetType, options: ConfigOptions, callback: TransformFileCallback): undefined {\n let tsconfig = options.tsconfig;\n\n // overrides for cjs\n if (type === 'cjs') {\n tsconfig = { ...tsconfig };\n tsconfig.config = { ...tsconfig.config };\n tsconfig.config.compilerOptions = { ...(tsconfig.config.compilerOptions || {}) };\n tsconfig.config.compilerOptions.module = 'commonjs';\n tsconfig.config.compilerOptions.target = 'es5';\n }\n\n const swcOptions = prepareSWCOptions(tsconfig);\n const swc = _require('@swc/core');\n const ext = path.extname(entry.basename);\n\n swc\n .transformFile(entry.fullPath, {\n ...(ext === '.tsx' || ext === '.jsx' ? swcOptions.tsxOptions : swcOptions.nonTsxOptions),\n filename: entry.basename,\n })\n .then((output: Output) => {\n const extTarget = type === 'esm' ? patchESM(entry, output, options) : patchCJS(entry, output, options);\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/transformFile.ts"],"sourcesContent":["import type { Output } from '@swc/core';\nimport fs from 'fs';\nimport type { Entry } from 'fs-iterator';\nimport mkdirp from 'mkdirp-classic';\nimport Module from 'module';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport patchCJS from '../lib/patchCJS.ts';\nimport patchESM from '../lib/patchESM.ts';\nimport prepareSWCOptions from '../lib/prepareSWCOptions.ts';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nimport type { ConfigOptions, TargetType, TransformFileCallback } from '../types.ts';\n\nexport default function transformFile(entry: Entry, dest: string, type: TargetType, options: ConfigOptions, callback: TransformFileCallback): undefined {\n let tsconfig = options.tsconfig;\n\n // overrides for cjs\n if (type === 'cjs') {\n tsconfig = { ...tsconfig };\n tsconfig.config = { ...tsconfig.config };\n tsconfig.config.compilerOptions = { ...(tsconfig.config.compilerOptions || {}) };\n tsconfig.config.compilerOptions.module = 'commonjs';\n tsconfig.config.compilerOptions.target = 'es5';\n }\n\n const swcOptions = prepareSWCOptions(tsconfig);\n const swc = _require('@swc/core');\n const ext = path.extname(entry.basename);\n\n swc\n .transformFile(entry.fullPath, {\n ...(ext === '.tsx' || ext === '.jsx' ? swcOptions.tsxOptions : swcOptions.nonTsxOptions),\n filename: entry.basename,\n })\n .then((output: Output) => {\n // Get source file mode to preserve executable permissions\n fs.stat(entry.fullPath, (statErr, stats) => {\n if (statErr) return callback(statErr);\n\n const extTarget = type === 'esm' ? patchESM(entry, output, options) : patchCJS(entry, output, options);\n const ext = path.extname(entry.path);\n const outPath = path.join(dest, (ext ? entry.path.slice(0, -ext.length) : entry.path) + extTarget);\n\n mkdirp(path.dirname(outPath), () => {\n const queue = new Queue();\n queue.defer(fs.writeFile.bind(null, outPath, output.code, 'utf8'));\n if (output.map && options.sourceMaps) queue.defer(fs.writeFile.bind(null, `${outPath}.map`, output.map, 'utf8'));\n queue.await((err) => {\n if (err) return callback(err);\n\n // Preserve executable permissions from source (only +x bits, not full mode)\n const execBits = stats.mode & 0o111;\n if (execBits) {\n fs.chmod(outPath, 0o644 | execBits, (_chmodErr) => {\n // Ignore chmod errors (e.g., on Windows)\n callback(null, outPath);\n });\n } else {\n callback(null, outPath);\n }\n });\n });\n });\n })\n .catch(callback);\n}\n"],"names":["fs","mkdirp","Module","path","Queue","patchCJS","patchESM","prepareSWCOptions","_require","require","createRequire","url","transformFile","entry","dest","type","options","callback","tsconfig","config","compilerOptions","module","target","swcOptions","swc","ext","extname","basename","fullPath","tsxOptions","nonTsxOptions","filename","then","output","stat","statErr","stats","extTarget","outPath","join","slice","length","dirname","queue","defer","writeFile","bind","code","map","sourceMaps","await","err","execBits","mode","chmod","_chmodErr","catch"],"mappings":"AACA,OAAOA,QAAQ,KAAK;AAEpB,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAC7B,OAAOC,cAAc,qBAAqB;AAC1C,OAAOC,cAAc,qBAAqB;AAC1C,OAAOC,uBAAuB,8BAA8B;AAE5D,MAAMC,WAAW,OAAOC,YAAY,cAAcP,OAAOQ,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAI1F,eAAe,SAASG,cAAcC,KAAY,EAAEC,IAAY,EAAEC,IAAgB,EAAEC,OAAsB,EAAEC,QAA+B;IACzI,IAAIC,WAAWF,QAAQE,QAAQ;IAE/B,oBAAoB;IACpB,IAAIH,SAAS,OAAO;QAClBG,WAAW;YAAE,G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N,MAAMC,KAAK,CAAC5C,GAAG6C,SAAS,CAACC,IAAI,CAAC,MAAM,GAAGR,QAAQ,IAAI,CAAC,EAAEL,OAAOe,GAAG,EAAE;gBACxGL,MAAMO,KAAK,CAAC,CAACC;oBACX,IAAIA,KAAK,OAAOlC,SAASkC;oBAEzB,4EAA4E;oBAC5E,MAAMC,WAAWhB,MAAMiB,IAAI,GAAG;oBAC9B,IAAID,UAAU;wBACZpD,GAAGsD,KAAK,CAAChB,SAAS,QAAQc,UAAU,CAACG;4BACnC,yCAAyC;4BACzCtC,SAAS,MAAMqB;wBACjB;oBACF,OAAO;wBACLrB,SAAS,MAAMqB;oBACjB;gBACF;YACF;QACF;IACF,GACCkB,KAAK,CAACvC;AACX"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import Iterator from 'fs-iterator';
|
|
3
3
|
import Module from 'module';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import Queue from 'queue-cb';
|
|
4
6
|
const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
|
|
5
7
|
import { stringEndsWith } from '../compat.js';
|
|
6
8
|
import { typeFileRegEx } from '../constants.js';
|
|
@@ -25,50 +27,93 @@ export default function transformTypesWorker(src, dest, options, callback) {
|
|
|
25
27
|
callback(err);
|
|
26
28
|
return;
|
|
27
29
|
}
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
30
|
+
// Step 1: Stat all source files to get their modes (async)
|
|
31
|
+
const sourceModes = new Map();
|
|
32
|
+
const statQueue = new Queue();
|
|
33
|
+
entries.forEach((entry)=>{
|
|
34
|
+
statQueue.defer((cb)=>{
|
|
35
|
+
fs.stat(entry.fullPath, (statErr, stats)=>{
|
|
36
|
+
if (!statErr) sourceModes.set(entry.fullPath, stats.mode);
|
|
37
|
+
cb(); // Continue even on error
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
statQueue.await((statErr)=>{
|
|
42
|
+
if (statErr) {
|
|
43
|
+
callback(statErr);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
// Step 2: TypeScript emit (inherently sync - cannot change)
|
|
47
|
+
const compilerOptions = ts.convertCompilerOptionsFromJson(tsconfig.config.compilerOptions, '');
|
|
48
|
+
const config = {
|
|
49
|
+
fileNames: entries.map((entry)=>entry.fullPath),
|
|
50
|
+
options: {
|
|
51
|
+
...compilerOptions.options,
|
|
52
|
+
outDir: dest,
|
|
53
|
+
noEmit: false,
|
|
54
|
+
allowJs: true,
|
|
55
|
+
declaration: true,
|
|
56
|
+
emitDeclarationOnly: true,
|
|
57
|
+
listEmittedFiles: true
|
|
58
|
+
},
|
|
59
|
+
projectReferences: tsconfig.config.references
|
|
60
|
+
};
|
|
61
|
+
const { fileNames, options, projectReferences } = config;
|
|
62
|
+
const host = ts.createCompilerHostWorker(options, /*setParentNodes*/ undefined, ts.sys);
|
|
63
|
+
const programOptions = {
|
|
64
|
+
rootNames: fileNames,
|
|
65
|
+
options,
|
|
66
|
+
projectReferences,
|
|
67
|
+
host,
|
|
68
|
+
configFileParsingDiagnostics: ts.getConfigFileParsingDiagnostics({
|
|
69
|
+
fileNames,
|
|
70
|
+
options
|
|
71
|
+
})
|
|
72
|
+
};
|
|
73
|
+
const program = ts.createProgram(programOptions);
|
|
74
|
+
const res = program.emit();
|
|
75
|
+
// Step 3: Post-process emitted files (async)
|
|
76
|
+
const postQueue = new Queue();
|
|
77
|
+
if (res.emittedFiles) {
|
|
78
|
+
res.emittedFiles.forEach((file)=>{
|
|
79
|
+
// 3a: Rewrite extensions (convert from sync to async)
|
|
80
|
+
// TODO: remove patch for https://github.com/microsoft/TypeScript/issues/61037
|
|
81
|
+
if (compilerOptions.options.rewriteRelativeImportExtensions) {
|
|
82
|
+
if (stringEndsWith(file, '.d.ts') || stringEndsWith(file, '.d.cts') || stringEndsWith(file, '.d.mts')) {
|
|
83
|
+
postQueue.defer((cb)=>{
|
|
84
|
+
fs.readFile(file, 'utf8', (readErr, content)=>{
|
|
85
|
+
if (readErr) return cb(); // Ignore errors, continue
|
|
86
|
+
const updated = rewriteExtensions(content);
|
|
87
|
+
if (updated !== content) {
|
|
88
|
+
fs.writeFile(file, updated, 'utf8', ()=>cb()); // Ignore write errors
|
|
89
|
+
} else {
|
|
90
|
+
cb();
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
65
94
|
}
|
|
66
|
-
} catch (_err) {
|
|
67
|
-
// Ignore errors
|
|
68
95
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
96
|
+
// 3b: Apply executable permissions from source files
|
|
97
|
+
if (stringEndsWith(file, '.d.ts') || stringEndsWith(file, '.d.cts') || stringEndsWith(file, '.d.mts')) {
|
|
98
|
+
const relativePath = path.relative(dest, file);
|
|
99
|
+
const baseName = relativePath.replace(/\.d\.(ts|mts|cts)$/, '');
|
|
100
|
+
for (const [srcPath, mode] of sourceModes){
|
|
101
|
+
const srcRelative = path.relative(src, srcPath);
|
|
102
|
+
const srcBase = srcRelative.replace(/\.(ts|tsx|mts|cts)$/, '');
|
|
103
|
+
if (baseName === srcBase) {
|
|
104
|
+
const execBits = mode & 0o111;
|
|
105
|
+
if (execBits) {
|
|
106
|
+
postQueue.defer((cb)=>{
|
|
107
|
+
fs.chmod(file, 0o644 | execBits, ()=>cb()); // Ignore chmod errors
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
postQueue.await(()=>callback(null, res.emittedFiles));
|
|
117
|
+
});
|
|
73
118
|
});
|
|
74
119
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformTypes.ts"],"sourcesContent":["import fs from 'fs';\nimport Iterator, { type Entry } from 'fs-iterator';\nimport Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nimport { stringEndsWith } from '../compat.ts';\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\nexport default function transformTypesWorker(src: string, dest: string, options: ConfigOptions, callback: TransformTypesCallback): undefined {\n const tsconfig = options.tsconfig;\n const matcher = createMatcher(tsconfig);\n const ts = _require('typescript');\n\n const entries = [];\n const iterator = new Iterator(src);\n iterator.forEach(\n (entry: Entry): undefined => {\n if (!entry.stats.isFile()) return;\n if (entry.basename[0] === '.') return;\n if (typeFileRegEx.test(entry.basename)) return;\n if (!matcher(entry.fullPath)) return;\n entries.push(entry);\n },\n { concurrency: Infinity },\n (err): undefined => {\n if (err) {\n callback(err);\n return;\n }\n\n const compilerOptions = ts.convertCompilerOptionsFromJson(tsconfig.config.compilerOptions, '');\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformTypes.ts"],"sourcesContent":["import fs from 'fs';\nimport Iterator, { type Entry } from 'fs-iterator';\nimport Module from 'module';\nimport path from 'path';\nimport Queue from 'queue-cb';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nimport { stringEndsWith } from '../compat.ts';\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\nexport default function transformTypesWorker(src: string, dest: string, options: ConfigOptions, callback: TransformTypesCallback): undefined {\n const tsconfig = options.tsconfig;\n const matcher = createMatcher(tsconfig);\n const ts = _require('typescript');\n\n const entries = [];\n const iterator = new Iterator(src);\n iterator.forEach(\n (entry: Entry): undefined => {\n if (!entry.stats.isFile()) return;\n if (entry.basename[0] === '.') return;\n if (typeFileRegEx.test(entry.basename)) return;\n if (!matcher(entry.fullPath)) return;\n entries.push(entry);\n },\n { concurrency: Infinity },\n (err): undefined => {\n if (err) {\n callback(err);\n return;\n }\n\n // Step 1: Stat all source files to get their modes (async)\n const sourceModes = new Map<string, number>();\n const statQueue = new Queue();\n entries.forEach((entry) => {\n statQueue.defer((cb) => {\n fs.stat(entry.fullPath, (statErr, stats) => {\n if (!statErr) sourceModes.set(entry.fullPath, stats.mode);\n cb(); // Continue even on error\n });\n });\n });\n\n statQueue.await((statErr) => {\n if (statErr) {\n callback(statErr);\n return;\n }\n\n // Step 2: TypeScript emit (inherently sync - cannot change)\n const compilerOptions = ts.convertCompilerOptionsFromJson(tsconfig.config.compilerOptions, '');\n const config = {\n fileNames: entries.map((entry) => entry.fullPath),\n options: {\n ...compilerOptions.options,\n outDir: dest,\n noEmit: false,\n allowJs: true,\n declaration: true,\n emitDeclarationOnly: true,\n listEmittedFiles: true,\n },\n projectReferences: tsconfig.config.references,\n };\n const { fileNames, options, projectReferences } = config;\n const host = ts.createCompilerHostWorker(options, /*setParentNodes*/ undefined, ts.sys);\n const programOptions = {\n rootNames: fileNames,\n options,\n projectReferences,\n host,\n configFileParsingDiagnostics: ts.getConfigFileParsingDiagnostics({ fileNames, options }),\n };\n const program = ts.createProgram(programOptions);\n const res = program.emit();\n\n // Step 3: Post-process emitted files (async)\n const postQueue = new Queue();\n\n if (res.emittedFiles) {\n res.emittedFiles.forEach((file) => {\n // 3a: Rewrite extensions (convert from sync to async)\n // TODO: remove patch for https://github.com/microsoft/TypeScript/issues/61037\n if (compilerOptions.options.rewriteRelativeImportExtensions) {\n if (stringEndsWith(file, '.d.ts') || stringEndsWith(file, '.d.cts') || stringEndsWith(file, '.d.mts')) {\n postQueue.defer((cb) => {\n fs.readFile(file, 'utf8', (readErr, content) => {\n if (readErr) return cb(); // Ignore errors, continue\n const updated = rewriteExtensions(content);\n if (updated !== content) {\n fs.writeFile(file, updated, 'utf8', () => cb()); // Ignore write errors\n } else {\n cb();\n }\n });\n });\n }\n }\n\n // 3b: Apply executable permissions from source files\n if (stringEndsWith(file, '.d.ts') || stringEndsWith(file, '.d.cts') || stringEndsWith(file, '.d.mts')) {\n const relativePath = path.relative(dest, file);\n const baseName = relativePath.replace(/\\.d\\.(ts|mts|cts)$/, '');\n\n for (const [srcPath, mode] of sourceModes) {\n const srcRelative = path.relative(src, srcPath);\n const srcBase = srcRelative.replace(/\\.(ts|tsx|mts|cts)$/, '');\n if (baseName === srcBase) {\n const execBits = mode & 0o111;\n if (execBits) {\n postQueue.defer((cb) => {\n fs.chmod(file, 0o644 | execBits, () => cb()); // Ignore chmod errors\n });\n }\n break;\n }\n }\n }\n });\n }\n\n postQueue.await(() => callback(null, res.emittedFiles));\n });\n }\n );\n}\n"],"names":["fs","Iterator","Module","path","Queue","_require","require","createRequire","url","stringEndsWith","typeFileRegEx","createMatcher","rewriteExtensions","transformTypesWorker","src","dest","options","callback","tsconfig","matcher","ts","entries","iterator","forEach","entry","stats","isFile","basename","test","fullPath","push","concurrency","Infinity","err","sourceModes","Map","statQueue","defer","cb","stat","statErr","set","mode","await","compilerOptions","convertCompilerOptionsFromJson","config","fileNames","map","outDir","noEmit","allowJs","declaration","emitDeclarationOnly","listEmittedFiles","projectReferences","references","host","createCompilerHostWorker","undefined","sys","programOptions","rootNames","configFileParsingDiagnostics","getConfigFileParsingDiagnostics","program","createProgram","res","emit","postQueue","emittedFiles","file","rewriteRelativeImportExtensions","readFile","readErr","content","updated","writeFile","relativePath","relative","baseName","replace","srcPath","srcRelative","srcBase","execBits","chmod"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,cAA8B,cAAc;AACnD,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAE7B,MAAMC,WAAW,OAAOC,YAAY,cAAcJ,OAAOK,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAE1F,SAASG,cAAc,QAAQ,eAAe;AAC9C,SAASC,aAAa,QAAQ,kBAAkB;AAChD,OAAOC,mBAAmB,sBAAsB;AAChD,SAASC,iBAAiB,QAAQ,8BAA8B;AAIhE,eAAe,SAASC,qBAAqBC,GAAW,EAAEC,IAAY,EAAEC,OAAsB,EAAEC,QAAgC;IAC9H,MAAMC,WAAWF,QAAQE,QAAQ;IACjC,MAAMC,UAAUR,cAAcO;IAC9B,MAAME,KAAKf,SAAS;IAEpB,MAAMgB,UAAU,EAAE;IAClB,MAAMC,WAAW,IAAIrB,SAASa;IAC9BQ,SAASC,OAAO,CACd,CAACC;QACC,IAAI,CAACA,MAAMC,KAAK,CAACC,MAAM,IAAI;QAC3B,IAAIF,MAAMG,QAAQ,CAAC,EAAE,KAAK,KAAK;QAC/B,IAAIjB,cAAckB,IAAI,CAACJ,MAAMG,QAAQ,GAAG;QACxC,IAAI,CAACR,QAAQK,MAAMK,QAAQ,GAAG;QAC9BR,QAAQS,IAAI,CAACN;IACf,GACA;QAAEO,aAAaC;IAAS,GACxB,CAACC;QACC,IAAIA,KAAK;YACPhB,SAASgB;YACT;QACF;QAEA,2DAA2D;QAC3D,MAAMC,cAAc,IAAIC;QACxB,MAAMC,YAAY,IAAIhC;QACtBiB,QAAQE,OAAO,CAAC,CAACC;YACfY,UAAUC,KAAK,CAAC,CAACC;gBAC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,IAAI/D,eAAe8D,MAAM,YAAY9D,eAAe8D,MAAM,aAAa9D,eAAe8D,MAAM,WAAW;4BACrGF,UAAUhC,KAAK,CAAC,CAACC;gCACftC,GAAGyE,QAAQ,CAACF,MAAM,QAAQ,CAACG,SAASC;oCAClC,IAAID,SAAS,OAAOpC,MAAM,0BAA0B;oCACpD,MAAMsC,UAAUhE,kBAAkB+D;oCAClC,IAAIC,YAAYD,SAAS;wCACvB3E,GAAG6E,SAAS,CAACN,MAAMK,SAAS,QAAQ,IAAMtC,OAAO,sBAAsB;oCACzE,OAAO;wCACLA;oCACF;gCACF;4BACF;wBACF;oBACF;oBAEA,qDAAqD;oBACrD,IAAI7B,eAAe8D,MAAM,YAAY9D,eAAe8D,MAAM,aAAa9D,eAAe8D,MAAM,WAAW;wBACrG,MAAMO,eAAe3E,KAAK4E,QAAQ,CAAChE,MAAMwD;wBACzC,MAAMS,WAAWF,aAAaG,OAAO,CAAC,sBAAsB;wBAE5D,KAAK,MAAM,CAACC,SAASxC,KAAK,IAAIR,YAAa;4BACzC,MAAMiD,cAAchF,KAAK4E,QAAQ,CAACjE,KAAKoE;4BACvC,MAAME,UAAUD,YAAYF,OAAO,CAAC,uBAAuB;4BAC3D,IAAID,aAAaI,SAAS;gCACxB,MAAMC,WAAW3C,OAAO;gCACxB,IAAI2C,UAAU;oCACZhB,UAAUhC,KAAK,CAAC,CAACC;wCACftC,GAAGsF,KAAK,CAACf,MAAM,QAAQc,UAAU,IAAM/C,OAAO,sBAAsB;oCACtE;gCACF;gCACA;4BACF;wBACF;oBACF;gBACF;YACF;YAEA+B,UAAU1B,KAAK,CAAC,IAAM1B,SAAS,MAAMkD,IAAIG,YAAY;QACvD;IACF;AAEJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-swc-transform",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.7",
|
|
4
4
|
"description": "Typescript transformers for swc. Supports Node >= 0.8",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"matcher",
|
|
@@ -44,35 +44,35 @@
|
|
|
44
44
|
"version": "tsds version"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@swc/core": "
|
|
48
|
-
"core-js-pure": "
|
|
49
|
-
"exit": "
|
|
50
|
-
"fs-iterator": "
|
|
51
|
-
"install-optional": "
|
|
52
|
-
"is-absolute": "
|
|
53
|
-
"lodash.debounce": "
|
|
54
|
-
"lodash.find": "
|
|
55
|
-
"mkdirp-classic": "
|
|
56
|
-
"node-version-call": "
|
|
57
|
-
"queue-cb": "
|
|
58
|
-
"read-tsconfig-sync": "
|
|
59
|
-
"resolve": "
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"typescript": "*"
|
|
47
|
+
"@swc/core": "^1.15.3",
|
|
48
|
+
"core-js-pure": "^3.47.0",
|
|
49
|
+
"exit-compat": "^1.0.0",
|
|
50
|
+
"fs-iterator": "^6.1.10",
|
|
51
|
+
"install-optional": "^1.0.16",
|
|
52
|
+
"is-absolute": "^1.0.0",
|
|
53
|
+
"lodash.debounce": "^4.0.8",
|
|
54
|
+
"lodash.find": "^4.6.0",
|
|
55
|
+
"mkdirp-classic": "^0.5.3",
|
|
56
|
+
"node-version-call": "^1.9.19",
|
|
57
|
+
"queue-cb": "^1.6.1",
|
|
58
|
+
"read-tsconfig-sync": "^1.1.6",
|
|
59
|
+
"resolve": "^1.22.11",
|
|
60
|
+
"test-match": "^1.1.1",
|
|
61
|
+
"ts-node": "^10.9.2",
|
|
62
|
+
"typescript": "^5.9.3"
|
|
64
63
|
},
|
|
65
64
|
"devDependencies": {
|
|
66
|
-
"@types/mocha": "
|
|
67
|
-
"@types/node": "
|
|
68
|
-
"core-js": "
|
|
69
|
-
"cr": "
|
|
70
|
-
"cross-spawn-cb": "
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
65
|
+
"@types/mocha": "^10.0.10",
|
|
66
|
+
"@types/node": "^25.0.0",
|
|
67
|
+
"core-js": "^3.47.0",
|
|
68
|
+
"cr": "^0.1.0",
|
|
69
|
+
"cross-spawn-cb": "^2.4.10",
|
|
70
|
+
"fs-remove-compat": "^0.2.1",
|
|
71
|
+
"node-version-use": "^2.1.1",
|
|
72
|
+
"pinkie-promise": "^2.0.1",
|
|
73
|
+
"react": "^19.2.1",
|
|
74
|
+
"ts-dev-stack": "^1.21.3",
|
|
75
|
+
"tsds-config": "^0.2.0"
|
|
76
76
|
},
|
|
77
77
|
"engines": {
|
|
78
78
|
"node": ">=0.8"
|