ts-swc-transform 1.12.1 → 1.12.2
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/constants.cjs +0 -6
- package/dist/cjs/constants.cjs.map +1 -1
- package/dist/cjs/workers/transformDirectory.cjs +2 -2
- package/dist/cjs/workers/transformDirectory.cjs.map +1 -1
- package/dist/cjs/workers/transformTypes.cjs +2 -2
- package/dist/cjs/workers/transformTypes.cjs.map +1 -1
- package/dist/esm/constants.mjs +0 -3
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/workers/transformDirectory.mjs +3 -3
- package/dist/esm/workers/transformDirectory.mjs.map +1 -1
- package/dist/esm/workers/transformTypes.mjs +3 -3
- package/dist/esm/workers/transformTypes.mjs.map +1 -1
- package/dist/types/constants.d.ts +0 -1
- package/package.json +1 -1
package/dist/cjs/constants.cjs
CHANGED
|
@@ -9,9 +9,6 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
SKIPS: function() {
|
|
13
|
-
return SKIPS;
|
|
14
|
-
},
|
|
15
12
|
extensions: function() {
|
|
16
13
|
return extensions;
|
|
17
14
|
},
|
|
@@ -52,7 +49,4 @@ var extensions = [
|
|
|
52
49
|
'.es6',
|
|
53
50
|
'.es'
|
|
54
51
|
];
|
|
55
|
-
var SKIPS = [
|
|
56
|
-
'.DS_Store'
|
|
57
|
-
];
|
|
58
52
|
/* 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/constants.ts"],"sourcesContent":["export const moduleRegEx = /^[^.\\/]|^\\.[^.\\/]|^\\.\\.[^\\/]/;\nexport const typeFileRegEx = /^[^.]+\\.d\\.[cm]?ts$/;\n\nexport const moduleDependencyRegEx = '\\\\s*[\\'\"`]([^\\'\"`]+)[\\'\"`]\\\\s*';\nexport const moduleNameRegEx = '\\\\s*(?:[\\\\w${},\\\\s*]+)\\\\s*';\nexport const requireRegEx = new RegExp(`(?:(?:var|const|let)${moduleNameRegEx}=\\\\s*)?require\\\\(${moduleDependencyRegEx}\\\\)?`, 'g');\nexport const importRegEx = new RegExp(`${requireRegEx}|import(?:${moduleNameRegEx}from\\\\s*)?${moduleDependencyRegEx};?|export(?:${moduleNameRegEx}from\\\\s*)?${moduleDependencyRegEx}?`, 'g');\nexport const extensions = ['.js', '.jsx', '.cjs', '.mjs', '.ts', '.tsx', '.cts', '.mts', '.es6', '.es'];\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/constants.ts"],"sourcesContent":["export const moduleRegEx = /^[^.\\/]|^\\.[^.\\/]|^\\.\\.[^\\/]/;\nexport const typeFileRegEx = /^[^.]+\\.d\\.[cm]?ts$/;\n\nexport const moduleDependencyRegEx = '\\\\s*[\\'\"`]([^\\'\"`]+)[\\'\"`]\\\\s*';\nexport const moduleNameRegEx = '\\\\s*(?:[\\\\w${},\\\\s*]+)\\\\s*';\nexport const requireRegEx = new RegExp(`(?:(?:var|const|let)${moduleNameRegEx}=\\\\s*)?require\\\\(${moduleDependencyRegEx}\\\\)?`, 'g');\nexport const importRegEx = new RegExp(`${requireRegEx}|import(?:${moduleNameRegEx}from\\\\s*)?${moduleDependencyRegEx};?|export(?:${moduleNameRegEx}from\\\\s*)?${moduleDependencyRegEx}?`, 'g');\nexport const extensions = ['.js', '.jsx', '.cjs', '.mjs', '.ts', '.tsx', '.cts', '.mts', '.es6', '.es'];\n"],"names":["extensions","importRegEx","moduleDependencyRegEx","moduleNameRegEx","moduleRegEx","requireRegEx","typeFileRegEx","RegExp"],"mappings":";;;;;;;;;;;IAOaA,UAAU;eAAVA;;IADAC,WAAW;eAAXA;;IAHAC,qBAAqB;eAArBA;;IACAC,eAAe;eAAfA;;IAJAC,WAAW;eAAXA;;IAKAC,YAAY;eAAZA;;IAJAC,aAAa;eAAbA;;;AADN,IAAMF,cAAc;AACpB,IAAME,gBAAgB;AAEtB,IAAMJ,wBAAwB;AAC9B,IAAMC,kBAAkB;AACxB,IAAME,eAAe,IAAIE,OAAO,AAAC,uBAAyDL,OAAnCC,iBAAgB,qBAAyC,OAAtBD,uBAAsB,SAAO;AACvH,IAAMD,cAAc,IAAIM,OAAO,AAAC,GAA2BJ,OAAzBE,cAAa,cAAwCH,OAA5BC,iBAAgB,cAAgDA,OAApCD,uBAAsB,gBAA0CA,OAA5BC,iBAAgB,cAAkC,OAAtBD,uBAAsB,MAAI;AACjL,IAAMF,aAAa;IAAC;IAAO;IAAQ;IAAQ;IAAQ;IAAO;IAAQ;IAAQ;IAAQ;IAAQ;CAAM"}
|
|
@@ -86,9 +86,9 @@ function transformDirectoryWorker(src, dest, type, options, callback) {
|
|
|
86
86
|
var iterator = new _fsiterator.default(src);
|
|
87
87
|
iterator.forEach(function(entry) {
|
|
88
88
|
if (!entry.stats.isFile()) return;
|
|
89
|
-
if (
|
|
89
|
+
if (entry.basename[0] === '.') return;
|
|
90
90
|
if (_constants.typeFileRegEx.test(entry.basename)) return;
|
|
91
|
-
if (
|
|
91
|
+
if (!matcher(entry.fullPath)) return;
|
|
92
92
|
var ext = _path.default.extname(entry.basename);
|
|
93
93
|
if (ext && _constants.extensions.indexOf(ext) < 0) return;
|
|
94
94
|
entries.push(entry);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformDirectory.ts"],"sourcesContent":["import path from 'path';\nimport Iterator from 'fs-iterator';\nimport Queue from 'queue-cb';\nimport rimraf2 from 'rimraf2';\n\nimport {
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformDirectory.ts"],"sourcesContent":["import path from 'path';\nimport Iterator from 'fs-iterator';\nimport Queue from 'queue-cb';\nimport rimraf2 from 'rimraf2';\n\nimport { extensions, typeFileRegEx } from '../constants';\nimport createMatcher from '../createMatcher';\nimport installBindings from '../lib/installBindings';\nimport transformFile from '../lib/transformFile';\n\nconst target = `${process.platform}-${process.arch}`;\n\nexport default function transformDirectoryWorker(src, dest, type, options, callback) {\n const tsconfig = options.tsconfig;\n const matcher = createMatcher(tsconfig);\n\n installBindings(target, (err) => {\n if (err) return callback(err);\n\n rimraf2(dest, { disableGlob: true }, () => {\n const entries = [];\n const iterator = new Iterator(src);\n iterator.forEach(\n (entry) => {\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 const ext = path.extname(entry.basename);\n if (ext && extensions.indexOf(ext) < 0) return;\n entries.push(entry);\n },\n (err) => {\n if (err) return callback(err);\n const results = [];\n options = { ...options, tsconfig, src, dest };\n\n const queue = new Queue();\n entries.forEach((entry) => {\n queue.defer((cb) =>\n transformFile(entry, dest, type, options, (err, outPath) => {\n if (err) return cb(err);\n results.push(path.normalize(outPath));\n if (options.sourceMaps) results.push(`${path.normalize(outPath)}.map`);\n cb();\n })\n );\n });\n queue.await((err) => (err ? callback(err) : callback(null, results)));\n }\n );\n });\n });\n}\n"],"names":["transformDirectoryWorker","target","process","platform","arch","src","dest","type","options","callback","tsconfig","matcher","createMatcher","installBindings","err","rimraf2","disableGlob","entries","iterator","Iterator","forEach","entry","stats","isFile","basename","typeFileRegEx","test","fullPath","ext","path","extname","extensions","indexOf","push","results","queue","Queue","defer","cb","transformFile","outPath","normalize","sourceMaps","await"],"mappings":";;;;+BAYA;;;eAAwBA;;;2DAZP;iEACI;8DACH;8DACE;yBAEsB;oEAChB;sEACE;oEACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,IAAMC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CAACY,SAAS,CAACD;4BAC5B,IAAIhC,QAAQkC,UAAU,EAAER,QAAQD,IAAI,CAAC,AAAC,GAA0B,OAAxBJ,aAAI,CAACY,SAAS,CAACD,UAAS;4BAChEF;wBACF;;gBAEJ;gBACAH,MAAMQ,KAAK,CAAC,SAAC7B;2BAASA,MAAML,SAASK,OAAOL,SAAS,MAAMyB;;YAC7D;QAEJ;IACF;AACF"}
|
|
@@ -83,9 +83,9 @@ function transformTypesWorker(src, dest, options, callback) {
|
|
|
83
83
|
var iterator = new _fsiterator.default(src);
|
|
84
84
|
iterator.forEach(function(entry) {
|
|
85
85
|
if (!entry.stats.isFile()) return;
|
|
86
|
-
if (
|
|
86
|
+
if (entry.basename[0] === '.') return;
|
|
87
87
|
if (_constants.typeFileRegEx.test(entry.basename)) return;
|
|
88
|
-
if (
|
|
88
|
+
if (!matcher(entry.fullPath)) return;
|
|
89
89
|
entries.push(entry);
|
|
90
90
|
}, {
|
|
91
91
|
concurrency: Infinity
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformTypes.ts"],"sourcesContent":["import Iterator from 'fs-iterator';\nimport rimraf2 from 'rimraf2';\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst tsLazy = lazy(_require)('typescript');\n\nimport {
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformTypes.ts"],"sourcesContent":["import Iterator from 'fs-iterator';\nimport rimraf2 from 'rimraf2';\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst tsLazy = lazy(_require)('typescript');\n\nimport { typeFileRegEx } from '../constants';\nimport createMatcher from '../createMatcher';\n\nexport default function transformTypesWorker(src, dest, options, callback) {\n const tsconfig = options.tsconfig;\n const matcher = createMatcher(tsconfig);\n\n rimraf2(dest, { disableGlob: true }, () => {\n const entries = [];\n const iterator = new Iterator(src);\n iterator.forEach(\n (entry) => {\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) => {\n if (err) return callback(err);\n\n const ts = tsLazy();\n const config = {\n fileNames: entries.map((entry) => entry.fullPath),\n options: {\n ...(tsconfig.compilerOptions || {}),\n outDir: dest,\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 callback(null, res.emittedFiles);\n }\n );\n });\n}\n"],"names":["transformTypesWorker","_require","require","Module","createRequire","tsLazy","lazy","src","dest","options","callback","tsconfig","matcher","createMatcher","rimraf2","disableGlob","entries","iterator","Iterator","forEach","entry","stats","isFile","basename","typeFileRegEx","test","fullPath","push","concurrency","Infinity","err","ts","config","fileNames","map","compilerOptions","outDir","allowJs","declaration","emitDeclarationOnly","listEmittedFiles","projectReferences","references","host","createCompilerHostWorker","undefined","sys","programOptions","rootNames","configFileParsingDiagnostics","getConfigFileParsingDiagnostics","program","createProgram","res","emit","emittedFiles"],"mappings":";;;;+BAWA;;;eAAwBA;;;iEAXH;8DACD;6DAED;gEACF;yBAIa;oEACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAJ1B,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,S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AAEjB,WAAAA;oBAAWxB,SAAAA;gBAAQ;YACxF;YACA,IAAM0C,UAAUpB,GAAGqB,aAAa,CAACL;YACjC,IAAMM,MAAMF,QAAQG,IAAI;YACxB5C,SAAS,MAAM2C,IAAIE,YAAY;QACjC;IAEJ;AACF"}
|
package/dist/esm/constants.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/constants.ts"],"sourcesContent":["export const moduleRegEx = /^[^.\\/]|^\\.[^.\\/]|^\\.\\.[^\\/]/;\nexport const typeFileRegEx = /^[^.]+\\.d\\.[cm]?ts$/;\n\nexport const moduleDependencyRegEx = '\\\\s*[\\'\"`]([^\\'\"`]+)[\\'\"`]\\\\s*';\nexport const moduleNameRegEx = '\\\\s*(?:[\\\\w${},\\\\s*]+)\\\\s*';\nexport const requireRegEx = new RegExp(`(?:(?:var|const|let)${moduleNameRegEx}=\\\\s*)?require\\\\(${moduleDependencyRegEx}\\\\)?`, 'g');\nexport const importRegEx = new RegExp(`${requireRegEx}|import(?:${moduleNameRegEx}from\\\\s*)?${moduleDependencyRegEx};?|export(?:${moduleNameRegEx}from\\\\s*)?${moduleDependencyRegEx}?`, 'g');\nexport const extensions = ['.js', '.jsx', '.cjs', '.mjs', '.ts', '.tsx', '.cts', '.mts', '.es6', '.es'];\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/constants.ts"],"sourcesContent":["export const moduleRegEx = /^[^.\\/]|^\\.[^.\\/]|^\\.\\.[^\\/]/;\nexport const typeFileRegEx = /^[^.]+\\.d\\.[cm]?ts$/;\n\nexport const moduleDependencyRegEx = '\\\\s*[\\'\"`]([^\\'\"`]+)[\\'\"`]\\\\s*';\nexport const moduleNameRegEx = '\\\\s*(?:[\\\\w${},\\\\s*]+)\\\\s*';\nexport const requireRegEx = new RegExp(`(?:(?:var|const|let)${moduleNameRegEx}=\\\\s*)?require\\\\(${moduleDependencyRegEx}\\\\)?`, 'g');\nexport const importRegEx = new RegExp(`${requireRegEx}|import(?:${moduleNameRegEx}from\\\\s*)?${moduleDependencyRegEx};?|export(?:${moduleNameRegEx}from\\\\s*)?${moduleDependencyRegEx}?`, 'g');\nexport const extensions = ['.js', '.jsx', '.cjs', '.mjs', '.ts', '.tsx', '.cts', '.mts', '.es6', '.es'];\n"],"names":["moduleRegEx","typeFileRegEx","moduleDependencyRegEx","moduleNameRegEx","requireRegEx","RegExp","importRegEx","extensions"],"mappings":"AAAA,OAAO,MAAMA,cAAc,+BAA+B;AAC1D,OAAO,MAAMC,gBAAgB,sBAAsB;AAEnD,OAAO,MAAMC,wBAAwB,iCAAiC;AACtE,OAAO,MAAMC,kBAAkB,6BAA6B;AAC5D,OAAO,MAAMC,eAAe,IAAIC,OAAO,CAAC,oBAAoB,EAAEF,gBAAgB,iBAAiB,EAAED,sBAAsB,IAAI,CAAC,EAAE,KAAK;AACnI,OAAO,MAAMI,cAAc,IAAID,OAAO,GAAGD,aAAa,UAAU,EAAED,gBAAgB,UAAU,EAAED,sBAAsB,YAAY,EAAEC,gBAAgB,UAAU,EAAED,sBAAsB,CAAC,CAAC,EAAE,KAAK;AAC7L,OAAO,MAAMK,aAAa;IAAC;IAAO;IAAQ;IAAQ;IAAQ;IAAO;IAAQ;IAAQ;IAAQ;IAAQ;CAAM,CAAC"}
|
|
@@ -2,7 +2,7 @@ import path from 'path';
|
|
|
2
2
|
import Iterator from 'fs-iterator';
|
|
3
3
|
import Queue from 'queue-cb';
|
|
4
4
|
import rimraf2 from 'rimraf2';
|
|
5
|
-
import {
|
|
5
|
+
import { extensions, typeFileRegEx } from '../constants.mjs';
|
|
6
6
|
import createMatcher from '../createMatcher.mjs';
|
|
7
7
|
import installBindings from '../lib/installBindings.mjs';
|
|
8
8
|
import transformFile from '../lib/transformFile.mjs';
|
|
@@ -19,9 +19,9 @@ export default function transformDirectoryWorker(src, dest, type, options, callb
|
|
|
19
19
|
const iterator = new Iterator(src);
|
|
20
20
|
iterator.forEach((entry)=>{
|
|
21
21
|
if (!entry.stats.isFile()) return;
|
|
22
|
-
if (
|
|
22
|
+
if (entry.basename[0] === '.') return;
|
|
23
23
|
if (typeFileRegEx.test(entry.basename)) return;
|
|
24
|
-
if (
|
|
24
|
+
if (!matcher(entry.fullPath)) return;
|
|
25
25
|
const ext = path.extname(entry.basename);
|
|
26
26
|
if (ext && extensions.indexOf(ext) < 0) return;
|
|
27
27
|
entries.push(entry);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformDirectory.ts"],"sourcesContent":["import path from 'path';\nimport Iterator from 'fs-iterator';\nimport Queue from 'queue-cb';\nimport rimraf2 from 'rimraf2';\n\nimport {
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformDirectory.ts"],"sourcesContent":["import path from 'path';\nimport Iterator from 'fs-iterator';\nimport Queue from 'queue-cb';\nimport rimraf2 from 'rimraf2';\n\nimport { extensions, typeFileRegEx } from '../constants';\nimport createMatcher from '../createMatcher';\nimport installBindings from '../lib/installBindings';\nimport transformFile from '../lib/transformFile';\n\nconst target = `${process.platform}-${process.arch}`;\n\nexport default function transformDirectoryWorker(src, dest, type, options, callback) {\n const tsconfig = options.tsconfig;\n const matcher = createMatcher(tsconfig);\n\n installBindings(target, (err) => {\n if (err) return callback(err);\n\n rimraf2(dest, { disableGlob: true }, () => {\n const entries = [];\n const iterator = new Iterator(src);\n iterator.forEach(\n (entry) => {\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 const ext = path.extname(entry.basename);\n if (ext && extensions.indexOf(ext) < 0) return;\n entries.push(entry);\n },\n (err) => {\n if (err) return callback(err);\n const results = [];\n options = { ...options, tsconfig, src, dest };\n\n const queue = new Queue();\n entries.forEach((entry) => {\n queue.defer((cb) =>\n transformFile(entry, dest, type, options, (err, outPath) => {\n if (err) return cb(err);\n results.push(path.normalize(outPath));\n if (options.sourceMaps) results.push(`${path.normalize(outPath)}.map`);\n cb();\n })\n );\n });\n queue.await((err) => (err ? callback(err) : callback(null, results)));\n }\n );\n });\n });\n}\n"],"names":["path","Iterator","Queue","rimraf2","extensions","typeFileRegEx","createMatcher","installBindings","transformFile","target","process","platform","arch","transformDirectoryWorker","src","dest","type","options","callback","tsconfig","matcher","err","disableGlob","entries","iterator","forEach","entry","stats","isFile","basename","test","fullPath","ext","extname","indexOf","push","results","queue","defer","cb","outPath","normalize","sourceMaps","await"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,cAAc,cAAc;AACnC,OAAOC,WAAW,WAAW;AAC7B,OAAOC,aAAa,UAAU;AAE9B,SAASC,UAAU,EAAEC,aAAa,QAAQ,eAAe;AACzD,OAAOC,mBAAmB,mBAAmB;AAC7C,OAAOC,qBAAqB,yBAAyB;AACrD,OAAOC,mBAAmB,uBAAuB;AAEjD,MAAMC,SAAS,GAAGC,QAAQC,QAAQ,CAAC,CAAC,EAAED,QAAQE,IAAI,EAAE;AAEpD,eAAe,SAASC,yBAAyBC,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACjF,MAAMC,WAAWF,QAAQE,QAAQ;IACjC,MAAMC,UAAUd,cAAca;IAE9BZ,gBAAgBE,QAAQ,CAACY;QACvB,IAAIA,KAAK,OAAOH,SAASG;QAEzBlB,QAAQY,MAAM;YAAEO,aAAa;QAAK,GAAG;YACnC,MAAMC,UAAU,EAAE;YAClB,MAAMC,WAAW,IAAIvB,SAASa;YAC9BU,SAASC,OAAO,CACd,CAACC;gBACC,IAAI,CAACA,MAAMC,KAAK,CAACC,MAAM,IAAI;gBAC3B,IAAIF,MAAMG,QAAQ,CAAC,EAAE,KAAK,KAAK;gBAC/B,IAAIxB,cAAcyB,IAAI,CAACJ,MAAMG,QAAQ,GAAG;gBACxC,IAAI,CAACT,QAAQM,MAAMK,QAAQ,GAAG;gBAC9B,MAAMC,MAAMhC,KAAKiC,OAAO,CAACP,MAAMG,QAAQ;gBACvC,IAAIG,OAAO5B,WAAW8B,OAAO,CAACF,OAAO,GAAG;gBACxCT,QAAQY,IAAI,CAACT;YACf,GACA,CAACL;gBACC,IAAIA,KAAK,OAAOH,SAASG;gBACzB,MAAMe,UAAU,EAAE;gBAClBnB,UAAU;oBAAE,GAAGA,OAAO;oBAAEE;oBAAUL;oBAAKC;gBAAK;gBAE5C,MAAMsB,QAAQ,IAAInC;gBAClBqB,QAAQE,OAAO,CAAC,CAACC;oBACfW,MAAMC,KAAK,CAAC,CAACC,KACX/B,cAAckB,OAAOX,MAAMC,MAAMC,SAAS,CAACI,KAAKmB;4BAC9C,IAAInB,KAAK,OAAOkB,GAAGlB;4BACnBe,QAAQD,IAAI,CAACnC,KAAKyC,SAAS,CAACD;4BAC5B,IAAIvB,QAAQyB,UAAU,EAAEN,QAAQD,IAAI,CAAC,GAAGnC,KAAKyC,SAAS,CAACD,SAAS,IAAI,CAAC;4BACrED;wBACF;gBAEJ;gBACAF,MAAMM,KAAK,CAAC,CAACtB,MAASA,MAAMH,SAASG,OAAOH,SAAS,MAAMkB;YAC7D;QAEJ;IACF;AACF"}
|
|
@@ -4,7 +4,7 @@ import Module from 'module';
|
|
|
4
4
|
import lazy from 'lazy-cache';
|
|
5
5
|
const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
|
|
6
6
|
const tsLazy = lazy(_require)('typescript');
|
|
7
|
-
import {
|
|
7
|
+
import { typeFileRegEx } from '../constants.mjs';
|
|
8
8
|
import createMatcher from '../createMatcher.mjs';
|
|
9
9
|
export default function transformTypesWorker(src, dest, options, callback) {
|
|
10
10
|
const tsconfig = options.tsconfig;
|
|
@@ -16,9 +16,9 @@ export default function transformTypesWorker(src, dest, options, callback) {
|
|
|
16
16
|
const iterator = new Iterator(src);
|
|
17
17
|
iterator.forEach((entry)=>{
|
|
18
18
|
if (!entry.stats.isFile()) return;
|
|
19
|
-
if (
|
|
19
|
+
if (entry.basename[0] === '.') return;
|
|
20
20
|
if (typeFileRegEx.test(entry.basename)) return;
|
|
21
|
-
if (
|
|
21
|
+
if (!matcher(entry.fullPath)) return;
|
|
22
22
|
entries.push(entry);
|
|
23
23
|
}, {
|
|
24
24
|
concurrency: Infinity
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformTypes.ts"],"sourcesContent":["import Iterator from 'fs-iterator';\nimport rimraf2 from 'rimraf2';\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst tsLazy = lazy(_require)('typescript');\n\nimport {
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformTypes.ts"],"sourcesContent":["import Iterator from 'fs-iterator';\nimport rimraf2 from 'rimraf2';\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst tsLazy = lazy(_require)('typescript');\n\nimport { typeFileRegEx } from '../constants';\nimport createMatcher from '../createMatcher';\n\nexport default function transformTypesWorker(src, dest, options, callback) {\n const tsconfig = options.tsconfig;\n const matcher = createMatcher(tsconfig);\n\n rimraf2(dest, { disableGlob: true }, () => {\n const entries = [];\n const iterator = new Iterator(src);\n iterator.forEach(\n (entry) => {\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) => {\n if (err) return callback(err);\n\n const ts = tsLazy();\n const config = {\n fileNames: entries.map((entry) => entry.fullPath),\n options: {\n ...(tsconfig.compilerOptions || {}),\n outDir: dest,\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 callback(null, res.emittedFiles);\n }\n );\n });\n}\n"],"names":["Iterator","rimraf2","Module","lazy","_require","require","createRequire","url","tsLazy","typeFileRegEx","createMatcher","transformTypesWorker","src","dest","options","callback","tsconfig","matcher","disableGlob","entries","iterator","forEach","entry","stats","isFile","basename","test","fullPath","push","concurrency","Infinity","err","ts","config","fileNames","map","compilerOptions","outDir","allowJs","declaration","emitDeclarationOnly","listEmittedFiles","projectReferences","references","host","createCompilerHostWorker","undefined","sys","programOptions","rootNames","configFileParsingDiagnostics","getConfigFileParsingDiagnostics","program","createProgram","res","emit","emittedFiles"],"mappings":"AAAA,OAAOA,cAAc,cAAc;AACnC,OAAOC,aAAa,UAAU;AAE9B,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,aAAa;AAC9B,MAAMC,WAAW,OAAOC,YAAY,cAAcH,OAAOI,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAC1F,MAAMG,SAASL,KAAKC,UAAU;AAE9B,SAASK,aAAa,QAAQ,eAAe;AAC7C,OAAOC,mBAAmB,mBAAmB;AAE7C,eAAe,SAASC,qBAAqBC,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACvE,MAAMC,WAAWF,QAAQE,QAAQ;IACjC,MAAMC,UAAUP,cAAcM;IAE9Bf,QAAQY,MAAM;QAAEK,aAAa;IAAK,GAAG;QACnC,MAAMC,UAAU,EAAE;QAClB,MAAMC,WAAW,IAAIpB,SAASY;QAC9BQ,SAASC,OAAO,CACd,CAACC;YAC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