ts-swc-transform 1.11.9 → 1.11.11

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.
@@ -9,6 +9,9 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
+ SKIPS: function() {
13
+ return SKIPS;
14
+ },
12
15
  extensions: function() {
13
16
  return extensions;
14
17
  },
@@ -49,4 +52,7 @@ var extensions = [
49
52
  '.es6',
50
53
  '.es'
51
54
  ];
55
+ var SKIPS = [
56
+ '.DS_Store'
57
+ ];
52
58
  /* 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"],"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"}
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\nexport const SKIPS = ['.DS_Store'];\n"],"names":["SKIPS","extensions","importRegEx","moduleDependencyRegEx","moduleNameRegEx","moduleRegEx","requireRegEx","typeFileRegEx","RegExp"],"mappings":";;;;;;;;;;;IASaA,KAAK;eAALA;;IAFAC,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;AAEhG,IAAMD,QAAQ;IAAC;CAAY"}
@@ -88,6 +88,7 @@ function transformDirectoryWorker(src, dest, type, options, callback) {
88
88
  if (!entry.stats.isFile()) return;
89
89
  if (!matcher(entry.fullPath)) return;
90
90
  if (_constants.typeFileRegEx.test(entry.basename)) return;
91
+ if (_constants.SKIPS.indexOf(entry.basename) >= 0) return;
91
92
  var ext = _path.default.extname(entry.basename);
92
93
  if (ext && _constants.extensions.indexOf(ext) < 0) return;
93
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 { 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 (!matcher(entry.fullPath)) return;\n if (typeFileRegEx.test(entry.basename)) 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","fullPath","typeFileRegEx","test","basename","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,SAAS,AAAC,GAAsBC,OAApBA,QAAQC,QAAQ,EAAC,KAAgB,OAAbD,QAAQE,IAAI;AAEnC,SAASJ,yBAAyBK,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAA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AAML,SAASK,OAAOL,SAAS,MAAMyB;;YAC7D;QAEJ;IACF;AACF"}
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 { SKIPS, 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 (!matcher(entry.fullPath)) return;\n if (typeFileRegEx.test(entry.basename)) return;\n if (SKIPS.indexOf(entry.basename) >= 0) 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","fullPath","typeFileRegEx","test","basename","SKIPS","indexOf","ext","path","extname","extensions","push","results","queue","Queue","defer","cb","transformFile","outPath","normalize","sourceMaps","await"],"mappings":";;;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AAME,KAAK,CAAC,SAACC;+BACXC,IAAAA,sBAAa,EAACnB,OAAOf,MAAMC,MAAMC,SAAS,SAACM,KAAK2B;4BAC9C,IAAI3B,KAAK,OAAOyB,GAAGzB;4BACnBqB,QAAQD,IAAI,CAACH,aAAI,CAACW,SAAS,CAACD;4BAC5B,IAAIjC,QAAQmC,UAAU,EAAER,QAAQD,IAAI,CAAC,AAAC,GAA0B,OAAxBH,aAAI,CAACW,SAAS,CAACD,UAAS;4BAChEF;wBACF;;gBAEJ;gBACAH,MAAMQ,KAAK,CAAC,SAAC9B;2BAASA,MAAML,SAASK,OAAOL,SAAS,MAAM0B;;YAC7D;QAEJ;IACF;AACF"}
@@ -85,6 +85,7 @@ function transformTypesWorker(src, dest, options, callback) {
85
85
  if (!entry.stats.isFile()) return;
86
86
  if (!matcher(entry.fullPath)) return;
87
87
  if (_constants.typeFileRegEx.test(entry.basename)) return;
88
+ if (_constants.SKIPS.indexOf(entry.basename) >= 0) return;
88
89
  entries.push(entry);
89
90
  }, {
90
91
  concurrency: Infinity
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformTypes.ts"],"sourcesContent":["import path from 'path';\nimport 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 (!matcher(entry.fullPath)) return;\n if (typeFileRegEx.test(entry.basename)) 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","fullPath","typeFileRegEx","test","basename","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":";;;;+BAYA;;;eAAwBA;;;iEAXH;8DACD;6DAED;gEACF;yBAIa;oEACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAJ1B,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,SAASC,IAAAA,kBAAI,EAACL,UAAU;AAKf,SAASD,qBAAqBO,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACvE,IAAMC,WAAWF,QAAQE,QAAQ;IACjC,IAAMC,UAAUC,IAAAA,sBAAa,EAACF;IAE9BG,IAAAA,gBAAO,EAACN,MAAM;QAAEO,aAAa;IAAK,GAAG;QACnC,IAAMC,UAAU,EAAE;QAClB,IAAMC,WAAW,IAAIC,mBAAQ,CAACX;QAC9BU,SAASE,OAAO,CACd,SAACC;YACC,IAAI,CAACA,MAAMC,KAAK,CAACC,MAAM,IAAI;YAC3B,IAAI,CAACV,QAAQQ,MAAMG,QAAQ,GAAG;YAC9B,IAAIC,wBAAa,CAACC,IAAI,CAACL,MAAMM,QAAQ,GAAG;YACxCV,QAAQW,IAAI,CAACP;QACf,GACA;YAAEQ,aAAaC;QAAS,GACxB,SAACC;YACC,IAAIA,KAAK,OAAOpB,SAASoB;YAEzB,IAAMC,KAAK1B;YACX,IAAM2B,SAAS;gBACbC,WAAWjB,QAAQkB,GAAG,CAAC,SAACd;2BAAUA,MAAMG,QAAQ;;gBAChDd,SAAS,wCACHE,SAASwB,eAAe,IAAI,CAAC;oBACjCC,QAAQ5B;oBACR6B,SAAS;oBACTC,aAAa;oBACbC,qBAAqB;oBACrBC,kBAAkB;;gBAEpBC,mBAAmB9B,SAASqB,MAAM,CAACU,UAAU;YAC/C;YACA,IAAQT,YAA0CD,OAA1CC,WAAWxB,YAA+BuB,OAA/BvB,SAASgC,oBAAsBT,OAAtBS;YAC5B,IAAME,OAAOZ,GAAGa,wBAAwB,CAACnC,WAAS,gBAAgB,GAAGoC,WAAWd,GAAGe,GAAG;YACtF,IAAMC,iBAAiB;gBACrBC,WAAWf;gBACXxB,SAAAA;gBACAgC,mBAAAA;gBACAE,MAAAA;gBACAM,8BAA8BlB,GAAGmB,+BAA+B,CAAC;oBAAEjB,WAAAA;oBAAWxB,SAAAA;gBAAQ;YACxF;YACA,IAAM0C,UAAUpB,GAAGqB,aAAa,CAACL;YACjC,IAAMM,MAAMF,QAAQG,IAAI;YACxB5C,SAAS,MAAM2C,IAAIE,YAAY;QACjC;IAEJ;AACF"}
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 { SKIPS, 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 (!matcher(entry.fullPath)) return;\n if (typeFileRegEx.test(entry.basename)) return;\n if (SKIPS.indexOf(entry.basename) >= 0) 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","fullPath","typeFileRegEx","test","basename","SKIPS","indexOf","push","concurrency","Infinity","err","ts","config","fileNames","map","compilerOptions","outDir","allowJs","declaration","emitDeclarationOnly","listEmittedFiles","projectReferences","references","host","createCompilerHostWorker","undefined","sys","programOptions","rootNames","configFileParsingDiagnostics","getConfigFileParsingDiag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CC,WAAW1B,YAA+ByB,OAA/BzB,SAASkC,oBAAsBT,OAAtBS;YAC5B,IAAME,OAAOZ,GAAGa,wBAAwB,CAACrC,WAAS,gBAAgB,GAAGsC,WAAWd,GAAGe,GAAG;YACtF,IAAMC,iBAAiB;gBACrBC,WAAWf;gBACX1B,SAAAA;gBACAkC,mBAAAA;gBACAE,MAAAA;gBACAM,8BAA8BlB,GAAGmB,+BAA+B,CAAC;oBAAEjB,WAAAA;oBAAW1B,SAAAA;gBAAQ;YACxF;YACA,IAAM4C,UAAUpB,GAAGqB,aAAa,CAACL;YACjC,IAAMM,MAAMF,QAAQG,IAAI;YACxB9C,SAAS,MAAM6C,IAAIE,YAAY;QACjC;IAEJ;AACF"}
@@ -16,3 +16,6 @@ export const extensions = [
16
16
  '.es6',
17
17
  '.es'
18
18
  ];
19
+ export const SKIPS = [
20
+ '.DS_Store'
21
+ ];
@@ -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"],"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"}
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\nexport const SKIPS = ['.DS_Store'];\n"],"names":["moduleRegEx","typeFileRegEx","moduleDependencyRegEx","moduleNameRegEx","requireRegEx","RegExp","importRegEx","extensions","SKIPS"],"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;AAExG,OAAO,MAAMC,QAAQ;IAAC;CAAY,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 { extensions, typeFileRegEx } from '../constants.mjs';
5
+ import { SKIPS, 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';
@@ -21,6 +21,7 @@ export default function transformDirectoryWorker(src, dest, type, options, callb
21
21
  if (!entry.stats.isFile()) return;
22
22
  if (!matcher(entry.fullPath)) return;
23
23
  if (typeFileRegEx.test(entry.basename)) return;
24
+ if (SKIPS.indexOf(entry.basename) >= 0) return;
24
25
  const ext = path.extname(entry.basename);
25
26
  if (ext && extensions.indexOf(ext) < 0) return;
26
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 { 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 (!matcher(entry.fullPath)) return;\n if (typeFileRegEx.test(entry.basename)) 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","fullPath","test","basename","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,eA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QyB,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"}
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 { SKIPS, 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 (!matcher(entry.fullPath)) return;\n if (typeFileRegEx.test(entry.basename)) return;\n if (SKIPS.indexOf(entry.basename) >= 0) 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","SKIPS","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","fullPath","test","basename","indexOf","ext","extname","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,KAAK,EAAEC,UAAU,EAAEC,aAAa,QAAQ,eAAe;AAChE,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;QAEzBnB,QAAQa,MAAM;YAAEO,aAAa;QAAK,GAAG;YACnC,MAAMC,UAAU,EAAE;YAClB,MAAMC,WAAW,IAAIxB,SAASc;YAC9BU,SAASC,OAAO,CACd,CAACC;gBACC,IAAI,CAACA,MAAMC,KAAK,CAACC,MAAM,IAAI;gBAC3B,IAAI,CAACR,QAAQM,MAAMG,QAAQ,GAAG;gBAC9B,IAAIxB,cAAcyB,IAAI,CAACJ,MAAMK,QAAQ,GAAG;gBACxC,IAAI5B,MAAM6B,OAAO,CAACN,MAAMK,QAAQ,KAAK,GAAG;gBACxC,MAAME,MAAMlC,KAAKmC,OAAO,CAACR,MAAMK,QAAQ;gBACvC,IAAIE,OAAO7B,WAAW4B,OAAO,CAACC,OAAO,GAAG;gBACxCV,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,IAAIpC;gBAClBsB,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,CAACpC,KAAK0C,SAAS,CAACD;4BAC5B,IAAIvB,QAAQyB,UAAU,EAAEN,QAAQD,IAAI,CAAC,GAAGpC,KAAK0C,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 { typeFileRegEx } from '../constants.mjs';
7
+ import { SKIPS, 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;
@@ -18,6 +18,7 @@ export default function transformTypesWorker(src, dest, options, callback) {
18
18
  if (!entry.stats.isFile()) return;
19
19
  if (!matcher(entry.fullPath)) return;
20
20
  if (typeFileRegEx.test(entry.basename)) return;
21
+ if (SKIPS.indexOf(entry.basename) >= 0) return;
21
22
  entries.push(entry);
22
23
  }, {
23
24
  concurrency: Infinity
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/workers/transformTypes.ts"],"sourcesContent":["import path from 'path';\nimport 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 (!matcher(entry.fullPath)) return;\n if (typeFileRegEx.test(entry.basename)) 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","fullPath","test","basename","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":"AACA,OAAOA,cAAc,cAAc;A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Ge,GAAG;YACtF,MAAMC,iBAAiB;gBACrBC,WAAWf;gBACXpB;gBACA4B;gBACAE;gBACAM,8BAA8BlB,GAAGmB,+BAA+B,CAAC;oBAAEjB;oBAAWpB;gBAAQ;YACxF;YACA,MAAMsC,UAAUpB,GAAGqB,aAAa,CAACL;YACjC,MAAMM,MAAMF,QAAQG,IAAI;YACxBxC,SAAS,MAAMuC,IAAIE,YAAY;QACjC;IAEJ;AACF"}
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 { SKIPS, 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 (!matcher(entry.fullPath)) return;\n if (typeFileRegEx.test(entry.basename)) return;\n if (SKIPS.indexOf(entry.basename) >= 0) 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","SKIPS","typeFileRegEx","createMatcher","transformTypesWorker","src","dest","options","callback","tsconfig","matcher","disableGlob","entries","iterator","forEach","entry","stats","isFile","fullPath","test","basename","indexOf","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,KAAK,EAAEC,aAAa,QAAQ,eAAe;AACpD,OAAOC,mBAAmB,mBAAmB;AAE7C,eAAe,SAASC,qBAAqBC,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACvE,MAAMC,WAAWF,QAAQE,QAAQ;IACjC,MAAMC,UAAUP,cAAcM;IAE9BhB,QAAQa,MAAM;QAAEK,aAAa;IAAK,GAAG;QACnC,MAAMC,UAAU,EAAE;QAClB,MAAMC,WAAW,IAAIrB,SAASa;QAC9BQ,SAASC,OAAO,CACd,CAACC;YACC,IAAI,CAACA,MAAMC,KAAK,CAACC,MAAM,IAAI;YAC3B,IAAI,CAACP,QAAQK,MAAMG,QAAQ,GAAG;YAC9B,IAAIhB,cAAciB,IAAI,CAACJ,MAAMK,QAAQ,GAAG;YACxC,IAAInB,MAAMoB,OAAO,CAACN,MAAMK,QAAQ,KAAK,GAAG;YACxCR,QAAQU,IAAI,CAACP;QACf,GACA;YAAEQ,aAAaC;QAAS,GACxB,CAACC;YACC,IAAIA,KAAK,OAAOjB,SAASiB;YAEzB,MAAMC,KAAK1B;YACX,MAAM2B,SAAS;gBACbC,WAAWhB,QAAQiB,GAAG,CAAC,CAACd,QAAUA,MAAMG,QAAQ;gBAChDX,SAAS;oBACP,GAAIE,SAASqB,eAAe,IAAI,CAAC,CAAC;oBAClCC,QAAQzB;oBACR0B,SAAS;oBACTC,aAAa;oBACbC,qBAAqB;oBACrBC,kBAAkB;gBACpB;gBACAC,mBAAmB3B,SAASkB,MAAM,CAACU,UAAU;YAC/C;YACA,MAAM,EAAET,SAAS,EAAErB,OAAO,EAAE6B,iBAAiB,EAAE,GAAGT;YAClD,MAAMW,OAAOZ,GAAGa,wBAAwB,CAAChC,SAAS,gBAAgB,GAAGiC,WAAWd,GAAGe,GAAG;YACtF,MAAMC,iBAAiB;gBACrBC,WAAWf;gBACXrB;gBACA6B;gBACAE;gBACAM,8BAA8BlB,GAAGmB,+BAA+B,CAAC;oBAAEjB;oBAAWrB;gBAAQ;YACxF;YACA,MAAMuC,UAAUpB,GAAGqB,aAAa,CAACL;YACjC,MAAMM,MAAMF,QAAQG,IAAI;YACxBzC,SAAS,MAAMwC,IAAIE,YAAY;QACjC;IAEJ;AACF"}
@@ -5,3 +5,4 @@ export declare const moduleNameRegEx = "\\s*(?:[\\w${},\\s*]+)\\s*";
5
5
  export declare const requireRegEx: RegExp;
6
6
  export declare const importRegEx: RegExp;
7
7
  export declare const extensions: string[];
8
+ export declare const SKIPS: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-swc-transform",
3
- "version": "1.11.9",
3
+ "version": "1.11.11",
4
4
  "description": "Typescript transformers for swc. Supports Node >= 0.8",
5
5
  "keywords": [
6
6
  "matcher",
@@ -39,6 +39,7 @@
39
39
  "scripts": {
40
40
  "build": "tsds build",
41
41
  "deploy": "tsds deploy",
42
+ "docs": "tsds docs",
42
43
  "format": "biome check --write --unsafe src/ test/",
43
44
  "test": "tsds test:node --no-timeouts",
44
45
  "test:engines": "nvu engines npm test",
@@ -55,7 +56,7 @@
55
56
  "lazy-cache": "^2.0.2",
56
57
  "minimatch": "^3.1.2",
57
58
  "mkdirp-classic": "^0.5.3",
58
- "node-version-call": "^1.4.8",
59
+ "node-version-call": "^1.4.9",
59
60
  "path-posix": "^1.0.0",
60
61
  "queue-cb": "^1.4.4",
61
62
  "resolve": "^1.22.10",