ts-swc-transform 2.4.8 → 2.5.0

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,7 @@ Object.defineProperty(exports, "default", {
9
9
  }
10
10
  });
11
11
  var _installoptional = require("install-optional");
12
+ var _lodashdebounce = /*#__PURE__*/ _interop_require_default(require("lodash.debounce"));
12
13
  var _module = /*#__PURE__*/ _interop_require_default(require("module"));
13
14
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
14
15
  var _url = /*#__PURE__*/ _interop_require_default(require("url"));
@@ -19,8 +20,12 @@ function _interop_require_default(obj) {
19
20
  }
20
21
  var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
21
22
  var __dirname = _path.default.dirname(typeof __filename !== 'undefined' ? __filename : _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()));
23
+ var installSyncSWC = (0, _lodashdebounce.default)(_installoptional.installSync, 300, {
24
+ leading: true,
25
+ trailing: false
26
+ });
22
27
  function prepareSWCOptions(tsconfig) {
23
- (0, _installoptional.installSync)('@swc/core', "".concat(process.platform, "-").concat(process.arch), {
28
+ installSyncSWC('@swc/core', "".concat(process.platform, "-").concat(process.arch), {
24
29
  cwd: __dirname
25
30
  });
26
31
  try {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/prepareSWCOptions.ts"],"sourcesContent":["import type { Options } from '@swc/core';\nimport { installSync } from 'install-optional';\nimport Module from 'module';\nimport path from 'path';\nimport url from 'url';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\n\nimport type { TSConfig } from '../types.ts';\n\nexport interface TranspilerOptions {\n tsxOptions: Options;\n nonTsxOptions: Options;\n}\n\nexport default function prepareSWCOptions(tsconfig: TSConfig): TranspilerOptions {\n installSync('@swc/core', `${process.platform}-${process.arch}`, { cwd: __dirname });\n try {\n const ts = _require('typescript');\n const swc = _require('@swc/core');\n const transpiler = _require('ts-node/transpilers/swc');\n const parsed = ts.parseJsonConfigFileContent(tsconfig.config, ts.sys, path.dirname(tsconfig.path));\n return transpiler.createSwcOptions(parsed.options, undefined, swc, 'swc');\n } catch (err) {\n console.log(`prepareSWCOptions failed: ${err.message}`);\n return {} as TranspilerOptions;\n }\n}\n"],"names":["prepareSWCOptions","_require","require","Module","createRequire","__dirname","path","dirname","__filename","url","fileURLToPath","tsconfig","installSync","process","platform","arch","cwd","ts","swc","transpiler","parsed","parseJsonConfigFileContent","config","sys","createSwcOptions","options","undefined","err","console","log","message"],"mappings":";;;;+BAgBA;;;eAAwBA;;;+BAfI;6DACT;2DACF;0DACD;;;;;;AAEhB,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaC,YAAG,CAACC,aAAa,CAAC;AASnF,SAASV,kBAAkBW,QAAkB;IAC1DC,IAAAA,4BAAW,EAAC,aAAa,AAAC,GAAsBC,OAApBA,QAAQC,QAAQ,EAAC,KAAgB,OAAbD,QAAQE,IAAI,GAAI;QAAEC,KAAKX;IAAU;IACjF,IAAI;QACF,IAAMY,KAAKhB,SAAS;QACpB,IAAMiB,MAAMjB,SAAS;QACrB,IAAMkB,aAAalB,SAAS;QAC5B,IAAMmB,SAASH,GAAGI,0BAA0B,CAACV,SAASW,MAAM,EAAEL,GAAGM,GAAG,EAAEjB,aAAI,CAACC,OAAO,CAACI,SAASL,IAAI;QAChG,OAAOa,WAAWK,gBAAgB,CAACJ,OAAOK,OAAO,EAAEC,WAAWR,KAAK;IACrE,EAAE,OAAOS,KAAK;QACZC,QAAQC,GAAG,CAAC,AAAC,6BAAwC,OAAZF,IAAIG,OAAO;QACpD,OAAO,CAAC;IACV;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/prepareSWCOptions.ts"],"sourcesContent":["import type { Options } from '@swc/core';\nimport { installSync } from 'install-optional';\nimport debounce from 'lodash.debounce';\nimport Module from 'module';\nimport path from 'path';\nimport url from 'url';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\n\nimport type { TSConfig } from '../types.ts';\n\nexport interface TranspilerOptions {\n tsxOptions: Options;\n nonTsxOptions: Options;\n}\n\nconst installSyncSWC = debounce(installSync, 300, { leading: true, trailing: false });\n\nexport default function prepareSWCOptions(tsconfig: TSConfig): TranspilerOptions {\n installSyncSWC('@swc/core', `${process.platform}-${process.arch}`, { cwd: __dirname });\n try {\n const ts = _require('typescript');\n const swc = _require('@swc/core');\n const transpiler = _require('ts-node/transpilers/swc');\n const parsed = ts.parseJsonConfigFileContent(tsconfig.config, ts.sys, path.dirname(tsconfig.path));\n return transpiler.createSwcOptions(parsed.options, undefined, swc, 'swc');\n } catch (err) {\n console.log(`prepareSWCOptions failed: ${err.message}`);\n return {} as TranspilerOptions;\n }\n}\n"],"names":["prepareSWCOptions","_require","require","Module","createRequire","__dirname","path","dirname","__filename","url","fileURLToPath","installSyncSWC","debounce","installSync","leading","trailing","tsconfig","process","platform","arch","cwd","ts","swc","transpiler","parsed","parseJsonConfigFileContent","config","sys","createSwcOptions","options","undefined","err","console","log","message"],"mappings":";;;;+BAmBA;;;eAAwBA;;;+BAlBI;qEACP;6DACF;2DACF;0DACD;;;;;;AAEhB,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaC,YAAG,CAACC,aAAa,CAAC;AASlG,IAAMC,iBAAiBC,IAAAA,uBAAQ,EAACC,4BAAW,EAAE,KAAK;IAAEC,SAAS;IAAMC,UAAU;AAAM;AAEpE,SAASf,kBAAkBgB,QAAkB;IAC1DL,eAAe,aAAa,AAAC,GAAsBM,OAApBA,QAAQC,QAAQ,EAAC,KAAgB,OAAbD,QAAQE,IAAI,GAAI;QAAEC,KAAKf;IAAU;IACpF,IAAI;QACF,IAAMgB,KAAKpB,SAAS;QACpB,IAAMqB,MAAMrB,SAAS;QACrB,IAAMsB,aAAatB,SAAS;QAC5B,IAAMuB,SAASH,GAAGI,0BAA0B,CAACT,SAASU,MAAM,EAAEL,GAAGM,GAAG,EAAErB,aAAI,CAACC,OAAO,CAACS,SAASV,IAAI;QAChG,OAAOiB,WAAWK,gBAAgB,CAACJ,OAAOK,OAAO,EAAEC,WAAWR,KAAK;IACrE,EAAE,OAAOS,KAAK;QACZC,QAAQC,GAAG,CAAC,AAAC,6BAAwC,OAAZF,IAAIG,OAAO;QACpD,OAAO,CAAC;IACV;AACF"}
@@ -1,11 +1,16 @@
1
1
  import { installSync } from 'install-optional';
2
+ import debounce from 'lodash.debounce';
2
3
  import Module from 'module';
3
4
  import path from 'path';
4
5
  import url from 'url';
5
6
  const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
6
7
  const __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));
8
+ const installSyncSWC = debounce(installSync, 300, {
9
+ leading: true,
10
+ trailing: false
11
+ });
7
12
  export default function prepareSWCOptions(tsconfig) {
8
- installSync('@swc/core', `${process.platform}-${process.arch}`, {
13
+ installSyncSWC('@swc/core', `${process.platform}-${process.arch}`, {
9
14
  cwd: __dirname
10
15
  });
11
16
  try {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/prepareSWCOptions.ts"],"sourcesContent":["import type { Options } from '@swc/core';\nimport { installSync } from 'install-optional';\nimport Module from 'module';\nimport path from 'path';\nimport url from 'url';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\n\nimport type { TSConfig } from '../types.ts';\n\nexport interface TranspilerOptions {\n tsxOptions: Options;\n nonTsxOptions: Options;\n}\n\nexport default function prepareSWCOptions(tsconfig: TSConfig): TranspilerOptions {\n installSync('@swc/core', `${process.platform}-${process.arch}`, { cwd: __dirname });\n try {\n const ts = _require('typescript');\n const swc = _require('@swc/core');\n const transpiler = _require('ts-node/transpilers/swc');\n const parsed = ts.parseJsonConfigFileContent(tsconfig.config, ts.sys, path.dirname(tsconfig.path));\n return transpiler.createSwcOptions(parsed.options, undefined, swc, 'swc');\n } catch (err) {\n console.log(`prepareSWCOptions failed: ${err.message}`);\n return {} as TranspilerOptions;\n }\n}\n"],"names":["installSync","Module","path","url","_require","require","createRequire","__dirname","dirname","__filename","fileURLToPath","prepareSWCOptions","tsconfig","process","platform","arch","cwd","ts","swc","transpiler","parsed","parseJsonConfigFileContent","config","sys","createSwcOptions","options","undefined","err","console","log","message"],"mappings":"AACA,SAASA,WAAW,QAAQ,mBAAmB;AAC/C,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AAEtB,MAAMC,WAAW,OAAOC,YAAY,cAAcJ,OAAOK,aAAa,CAAC,YAAYH,GAAG,IAAIE;AAC1F,MAAME,YAAYL,KAAKM,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaN,IAAIO,aAAa,CAAC,YAAYP,GAAG;AASjH,eAAe,SAASQ,kBAAkBC,QAAkB;IAC1DZ,YAAY,aAAa,GAAGa,QAAQC,QAAQ,CAAC,CAAC,EAAED,QAAQE,IAAI,EAAE,EAAE;QAAEC,KAAKT;IAAU;IACjF,IAAI;QACF,MAAMU,KAAKb,SAAS;QACpB,MAAMc,MAAMd,SAAS;QACrB,MAAMe,aAAaf,SAAS;QAC5B,MAAMgB,SAASH,GAAGI,0BAA0B,CAACT,SAASU,MAAM,EAAEL,GAAGM,GAAG,EAAErB,KAAKM,OAAO,CAACI,SAASV,IAAI;QAChG,OAAOiB,WAAWK,gBAAgB,CAACJ,OAAOK,OAAO,EAAEC,WAAWR,KAAK;IACrE,EAAE,OAAOS,KAAK;QACZC,QAAQC,GAAG,CAAC,CAAC,0BAA0B,EAAEF,IAAIG,OAAO,EAAE;QACtD,OAAO,CAAC;IACV;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/prepareSWCOptions.ts"],"sourcesContent":["import type { Options } from '@swc/core';\nimport { installSync } from 'install-optional';\nimport debounce from 'lodash.debounce';\nimport Module from 'module';\nimport path from 'path';\nimport url from 'url';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\n\nimport type { TSConfig } from '../types.ts';\n\nexport interface TranspilerOptions {\n tsxOptions: Options;\n nonTsxOptions: Options;\n}\n\nconst installSyncSWC = debounce(installSync, 300, { leading: true, trailing: false });\n\nexport default function prepareSWCOptions(tsconfig: TSConfig): TranspilerOptions {\n installSyncSWC('@swc/core', `${process.platform}-${process.arch}`, { cwd: __dirname });\n try {\n const ts = _require('typescript');\n const swc = _require('@swc/core');\n const transpiler = _require('ts-node/transpilers/swc');\n const parsed = ts.parseJsonConfigFileContent(tsconfig.config, ts.sys, path.dirname(tsconfig.path));\n return transpiler.createSwcOptions(parsed.options, undefined, swc, 'swc');\n } catch (err) {\n console.log(`prepareSWCOptions failed: ${err.message}`);\n return {} as TranspilerOptions;\n }\n}\n"],"names":["installSync","debounce","Module","path","url","_require","require","createRequire","__dirname","dirname","__filename","fileURLToPath","installSyncSWC","leading","trailing","prepareSWCOptions","tsconfig","process","platform","arch","cwd","ts","swc","transpiler","parsed","parseJsonConfigFileContent","config","sys","createSwcOptions","options","undefined","err","console","log","message"],"mappings":"AACA,SAASA,WAAW,QAAQ,mBAAmB;AAC/C,OAAOC,cAAc,kBAAkB;AACvC,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AAEtB,MAAMC,WAAW,OAAOC,YAAY,cAAcJ,OAAOK,aAAa,CAAC,YAAYH,GAAG,IAAIE;AAC1F,MAAME,YAAYL,KAAKM,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaN,IAAIO,aAAa,CAAC,YAAYP,GAAG;AASjH,MAAMQ,iBAAiBX,SAASD,aAAa,KAAK;IAAEa,SAAS;IAAMC,UAAU;AAAM;AAEnF,eAAe,SAASC,kBAAkBC,QAAkB;IAC1DJ,eAAe,aAAa,GAAGK,QAAQC,QAAQ,CAAC,CAAC,EAAED,QAAQE,IAAI,EAAE,EAAE;QAAEC,KAAKZ;IAAU;IACpF,IAAI;QACF,MAAMa,KAAKhB,SAAS;QACpB,MAAMiB,MAAMjB,SAAS;QACrB,MAAMkB,aAAalB,SAAS;QAC5B,MAAMmB,SAASH,GAAGI,0BAA0B,CAACT,SAASU,MAAM,EAAEL,GAAGM,GAAG,EAAExB,KAAKM,OAAO,CAACO,SAASb,IAAI;QAChG,OAAOoB,WAAWK,gBAAgB,CAACJ,OAAOK,OAAO,EAAEC,WAAWR,KAAK;IACrE,EAAE,OAAOS,KAAK;QACZC,QAAQC,GAAG,CAAC,CAAC,0BAA0B,EAAEF,IAAIG,OAAO,EAAE;QACtD,OAAO,CAAC;IACV;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-swc-transform",
3
- "version": "2.4.8",
3
+ "version": "2.5.0",
4
4
  "description": "Typescript transformers for swc. Supports Node >= 0.8",
5
5
  "keywords": [
6
6
  "matcher",
@@ -49,10 +49,11 @@
49
49
  "fs-iterator": "^6.0.6",
50
50
  "install-optional": "^1.0.3",
51
51
  "is-absolute": "^1.0.0",
52
+ "lodash.debounce": "^4.0.8",
52
53
  "lodash.find": "^4.6.0",
53
54
  "minimatch": "^3.1.2",
54
55
  "mkdirp-classic": "^0.5.3",
55
- "node-version-call": "^1.8.12",
56
+ "node-version-call": "^1.9.0",
56
57
  "path-posix": "^1.0.0",
57
58
  "queue-cb": "^1.5.5",
58
59
  "read-tsconfig-sync": "^1.0.1",