ts-swc-transform 1.3.2 → 1.3.4

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.
@@ -17,7 +17,6 @@ var _default = [
17
17
  '.tsx',
18
18
  '.cts',
19
19
  '.mts',
20
- '.json',
21
20
  '.es6',
22
21
  '.es'
23
22
  ];
@@ -1 +1 @@
1
- {"version":3,"sources":["extensions.ts"],"sourcesContent":["export default ['.js', '.jsx', '.cjs', '.mjs', '.ts', '.tsx', '.cts', '.mts', '.json', '.es6', '.es'];\n"],"names":[],"mappings":";;;;+BAAA;;;eAAA;;;IAAA,WAAe;IAAC;IAAO;IAAQ;IAAQ;IAAQ;IAAO;IAAQ;IAAQ;IAAQ;IAAS;IAAQ;CAAM"}
1
+ {"version":3,"sources":["extensions.ts"],"sourcesContent":["export default ['.js', '.jsx', '.cjs', '.mjs', '.ts', '.tsx', '.cts', '.mts', '.es6', '.es'];\n"],"names":[],"mappings":";;;;+BAAA;;;eAAA;;;IAAA,WAAe;IAAC;IAAO;IAAQ;IAAQ;IAAQ;IAAO;IAAQ;IAAQ;IAAQ;IAAQ;CAAM"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var path = require('path');
3
3
  var existsSync = require('./existsSync.js');
4
- var lazy = require('../lazy.js');
4
+ var lazy = require('./lazy.js');
5
5
  var major = +process.versions.node.split('.')[0];
6
6
  var version = major >= 14 ? 'local' : 'lts';
7
7
  var worker = path.resolve(path.dirname(__dirname), 'workers', "installBinding".concat(path.extname(__filename)));
@@ -1 +1 @@
1
- {"version":3,"sources":["installBindings.cts"],"sourcesContent":["const path = require('path');\nconst existsSync = require('./existsSync.cjs');\nconst lazy = require('../lazy.cjs');\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major >= 14 ? 'local' : 'lts';\nconst worker = path.resolve(path.dirname(__dirname), 'workers', `installBinding${path.extname(__filename)}`);\nconst call = lazy('node-version-call');\n\nconst installDir = path.dirname(path.dirname(path.dirname(require.resolve('@swc/core/package.json'))));\nconst { optionalDependencies } = require('@swc/core/package.json');\nconst depKey = `${process.platform}-${process.arch}`;\n\nfor (const key in optionalDependencies) {\n const depPath = path.join(installDir, key);\n if (key.indexOf(depKey) < 0 || existsSync(depPath)) continue;\n\n try {\n call()({ version, callbacks: true }, worker, key, optionalDependencies[key]);\n } catch (err) {\n console.log(`Failed to install ${key}@${optionalDependencies[key]}. Error: ${err.message}`);\n }\n}\n"],"names":["path","require","existsSync","lazy","major","process","versions","node","split","version","worker","resolve","dirname","__dirname","extname","__filename","call","installDir","optionalDependencies","depKey","platform","arch","key","depPath","join","indexOf","callbacks","err","console","log","message"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AACrB,IAAMC,aAAaD,QAAQ;AAC3B,IAAME,OAAOF,QAAQ;AAErB,IAAMG,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,UAAUL,SAAS,KAAK,UAAU;AACxC,IAAMM,SAASV,KAAKW,OAAO,CAACX,KAAKY,OAAO,CAACC,YAAY,WAAW,AAAC,iBAAyC,OAAzBb,KAAKc,OAAO,CAACC;AAC9F,IAAMC,OAAOb,KAAK;AAElB,IAAMc,aAAajB,KAAKY,OAAO,CAACZ,KAAKY,OAAO,CAACZ,KAAKY,OAAO,CAACX,QAAQU,OAAO,CAAC;AAC1E,IAAM,AAAEO,uBAAyBjB,QAAQ,0BAAjCiB;AACR,IAAMC,SAAS,AAAC,GAAsBd,OAApBA,QAAQe,QAAQ,EAAC,KAAgB,OAAbf,QAAQgB,IAAI;AAElD,IAAK,IAAMC,OAAOJ,qBAAsB;IACtC,IAAMK,UAAUvB,KAAKwB,IAAI,CAACP,YAAYK;IACtC,IAAIA,IAAIG,OAAO,CAACN,UAAU,KAAKjB,WAAWqB,UAAU;IAEpD,IAAI;QACFP,OAAO;YAAEP,SAAAA;YAASiB,WAAW;QAAK,GAAGhB,QAAQY,KAAKJ,oBAAoB,CAACI,IAAI;IAC7E,EAAE,OAAOK,KAAK;QACZC,QAAQC,GAAG,CAAC,AAAC,qBAA2BX,OAAPI,KAAI,KAAwCK,OAArCT,oBAAoB,CAACI,IAAI,EAAC,aAAuB,OAAZK,IAAIG,OAAO;IAC1F;AACF"}
1
+ {"version":3,"sources":["installBindings.cts"],"sourcesContent":["const path = require('path');\nconst existsSync = require('./existsSync.cjs');\nconst lazy = require('./lazy.cjs');\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major >= 14 ? 'local' : 'lts';\nconst worker = path.resolve(path.dirname(__dirname), 'workers', `installBinding${path.extname(__filename)}`);\nconst call = lazy('node-version-call');\n\nconst installDir = path.dirname(path.dirname(path.dirname(require.resolve('@swc/core/package.json'))));\nconst { optionalDependencies } = require('@swc/core/package.json');\nconst depKey = `${process.platform}-${process.arch}`;\n\nfor (const key in optionalDependencies) {\n const depPath = path.join(installDir, key);\n if (key.indexOf(depKey) < 0 || existsSync(depPath)) continue;\n\n try {\n call()({ version, callbacks: true }, worker, key, optionalDependencies[key]);\n } catch (err) {\n console.log(`Failed to install ${key}@${optionalDependencies[key]}. Error: ${err.message}`);\n }\n}\n"],"names":["path","require","existsSync","lazy","major","process","versions","node","split","version","worker","resolve","dirname","__dirname","extname","__filename","call","installDir","optionalDependencies","depKey","platform","arch","key","depPath","join","indexOf","callbacks","err","console","log","message"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AACrB,IAAMC,aAAaD,QAAQ;AAC3B,IAAME,OAAOF,QAAQ;AAErB,IAAMG,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,UAAUL,SAAS,KAAK,UAAU;AACxC,IAAMM,SAASV,KAAKW,OAAO,CAACX,KAAKY,OAAO,CAACC,YAAY,WAAW,AAAC,iBAAyC,OAAzBb,KAAKc,OAAO,CAACC;AAC9F,IAAMC,OAAOb,KAAK;AAElB,IAAMc,aAAajB,KAAKY,OAAO,CAACZ,KAAKY,OAAO,CAACZ,KAAKY,OAAO,CAACX,QAAQU,OAAO,CAAC;AAC1E,IAAM,AAAEO,uBAAyBjB,QAAQ,0BAAjCiB;AACR,IAAMC,SAAS,AAAC,GAAsBd,OAApBA,QAAQe,QAAQ,EAAC,KAAgB,OAAbf,QAAQgB,IAAI;AAElD,IAAK,IAAMC,OAAOJ,qBAAsB;IACtC,IAAMK,UAAUvB,KAAKwB,IAAI,CAACP,YAAYK;IACtC,IAAIA,IAAIG,OAAO,CAACN,UAAU,KAAKjB,WAAWqB,UAAU;IAEpD,IAAI;QACFP,OAAO;YAAEP,SAAAA;YAASiB,WAAW;QAAK,GAAGhB,QAAQY,KAAKJ,oBAAoB,CAACI,IAAI;IAC7E,EAAE,OAAOK,KAAK;QACZC,QAAQC,GAAG,CAAC,AAAC,qBAA2BX,OAAPI,KAAI,KAAwCK,OAArCT,oBAAoB,CAACI,IAAI,EAAC,aAAuB,OAAZK,IAAIG,OAAO;IAC1F;AACF"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ module.exports = process;
3
+ /* 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; }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["process.cts"],"sourcesContent":["module.exports = process;\n"],"names":["module","exports","process"],"mappings":";AAAAA,OAAOC,OAAO,GAAGC"}
@@ -11,10 +11,10 @@ Object.defineProperty(exports, "default", {
11
11
  var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
12
12
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
13
13
  var _isabsolute = /*#__PURE__*/ _interop_require_default(require("is-absolute"));
14
- var _process = /*#__PURE__*/ _interop_require_default(require("process"));
15
14
  var _resolve = /*#__PURE__*/ _interop_require_default(require("resolve"));
16
15
  var _constants = require("./constants.js");
17
16
  var _fileURLToPath = /*#__PURE__*/ _interop_require_default(require("./lib/fileURLToPath.js"));
17
+ var _processcjs = /*#__PURE__*/ _interop_require_default(require("./lib/process.js"));
18
18
  function _interop_require_default(obj) {
19
19
  return obj && obj.__esModule ? obj : {
20
20
  default: obj
@@ -22,17 +22,17 @@ function _interop_require_default(obj) {
22
22
  }
23
23
  function getParentPath(context) {
24
24
  if (context.parentPath) return _path.default.dirname(context.parentPath);
25
- return context.parentURL ? _path.default.dirname(toPath(context.parentURL)) : _process.default.cwd();
25
+ return context.parentURL ? _path.default.dirname(toPath(context.parentURL)) : _processcjs.default.cwd();
26
26
  }
27
27
  function toPath(specifier, context) {
28
28
  if (specifier.startsWith('file:')) return (0, _fileURLToPath.default)(specifier);
29
29
  if ((0, _isabsolute.default)(specifier)) return specifier;
30
30
  if (specifier[0] === '.') {
31
- var parentPath = context ? getParentPath(context) : _process.default.cwd();
31
+ var parentPath = context ? getParentPath(context) : _processcjs.default.cwd();
32
32
  return _path.default.resolve(parentPath, specifier);
33
33
  }
34
34
  if (_constants.moduleRegEx.test(specifier)) {
35
- var parentPath1 = context ? getParentPath(context) : _process.default.cwd();
35
+ var parentPath1 = context ? getParentPath(context) : _processcjs.default.cwd();
36
36
  var pkg = null;
37
37
  var main = _resolve.default.sync(specifier, {
38
38
  basedir: parentPath1,
@@ -1 +1 @@
1
- {"version":3,"sources":["toPath.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport isAbsolute from 'is-absolute';\nimport process from 'process';\nimport resolve from 'resolve';\nimport { moduleRegEx } from './constants.js';\nimport fileURLToPath from './lib/fileURLToPath.js';\nimport type { Context } from './types.js';\n\nfunction getParentPath(context: Context) {\n if (context.parentPath) return path.dirname(context.parentPath);\n return context.parentURL ? path.dirname(toPath(context.parentURL)) : process.cwd();\n}\n\nexport default function toPath(specifier: string, context?: Context) {\n if (specifier.startsWith('file:')) return fileURLToPath(specifier);\n if (isAbsolute(specifier)) return specifier;\n if (specifier[0] === '.') {\n const parentPath = context ? getParentPath(context) : process.cwd();\n return path.resolve(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n\n let pkg = null;\n const main = resolve.sync(specifier, {\n basedir: parentPath,\n extensions: ['.js', '.json', '.node', '.mjs'],\n packageFilter(json, dir) {\n pkg = { json, dir };\n return json;\n },\n });\n if (!pkg || !pkg.json.module) return main; // no modules, use main\n if (pkg.json.name === specifier) return path.resolve(pkg.dir, pkg.json.module); // the module\n\n // a relative path. Only accept if it doesn't break the relative naming and it exists\n const modulePath = path.resolve(pkg.dir, pkg.json.module);\n const mainPath = path.resolve(pkg.dir, pkg.json.main);\n const moduleResolved = path.resolve(modulePath, path.relative(mainPath, main));\n return moduleResolved.indexOf(specifier.replace(pkg.json.name, '')) < 0 || !fs.existsSync(moduleResolved) ? main : moduleResolved;\n }\n\n return specifier;\n}\n"],"names":["toPath","getParentPath","context","parentPath","path","dirname","parentURL","process","cwd","specifier","startsWith","fileURLToPath","isAbsolute","resolve","moduleRegEx","test","pkg","main","sync","basedir","extensions","packageFilter","json","dir","module","name","modulePath","mainPath","moduleResolved","relative","indexOf","replace","fs","existsSync"],"mappings":";;;;+BAcA;;;eAAwBA;;;yDAdT;2DACE;iEACM;8DACH;8DACA;yBACQ;oEACF;;;;;;AAG1B,SAASC,cAAcC,OAAgB;IACrC,IAAIA,QAAQC,UAAU,EAAE,OAAOC,aAAI,CAACC,OAAO,CAACH,QAAQC,UAAU;IAC9D,OAAOD,QAAQI,SAAS,GAAGF,aAAI,CAACC,OAAO,CAACL,OAAOE,QAAQI,SAAS,KAAKC,gBAAO,CAACC,GAAG;AAClF;AAEe,SAASR,OAAOS,SAAiB,EAAEP,OAAiB;IACjE,IAAIO,UAAUC,UAAU,CAAC,UAAU,OAAOC,IAAAA,sBAAa,EAACF;IACxD,IAAIG,IAAAA,mBAAU,EAACH,YAAY,OAAOA;IAClC,IAAIA,SAAS,CAAC,EAAE,KAAK,KAAK;QACxB,IAAMN,aAAaD,UAAUD,cAAcC,WAAWK,gBAAO,CAACC,GAAG;QACjE,OAAOJ,aAAI,CAACS,OAAO,CAACV,YAAYM;IAClC;IACA,IAAIK,sBAAW,CAACC,IAAI,CAACN,YAAY;QAC/B,IAAMN,cAAaD,UAAUD,cAAcC,WAAWK,gBAAO,CAACC,GAAG;QAEjE,IAAIQ,MAAM;QACV,IAAMC,OAAOJ,gBAAO,CAACK,IAAI,CAACT,WAAW;YACnCU,SAAShB;YACTiB,YAAY;gBAAC;gBAAO;gBAAS;gBAAS;aAAO;YAC7CC,eAAAA,SAAAA,cAAcC,IAAI,EAAEC,GAAG;gBACrBP,MAAM;oBAAEM,MAAAA;oBAAMC,KAAAA;gBAAI;gBAClB,OAAOD;YACT;QACF;QACA,IAAI,CAACN,OAAO,CAACA,IAAIM,IAAI,CAACE,MAAM,EAAE,OAAOP,MAAM,uBAAuB;QAClE,IAAID,IAAIM,IAAI,CAACG,IAAI,KAAKhB,WAAW,OAAOL,aAAI,CAACS,OAAO,CAACG,IAAIO,GAAG,EAAEP,IAAIM,IAAI,CAACE,MAAM,GAAG,aAAa;QAE7F,qFAAqF;QACrF,IAAME,aAAatB,aAAI,CAACS,OAAO,CAACG,IAAIO,GAAG,EAAEP,IAAIM,IAAI,CAACE,MAAM;QACxD,IAAMG,WAAWvB,aAAI,CAACS,OAAO,CAACG,IAAIO,GAAG,EAAEP,IAAIM,IAAI,CAACL,IAAI;QACpD,IAAMW,iBAAiBxB,aAAI,CAACS,OAAO,CAACa,YAAYtB,aAAI,CAACyB,QAAQ,CAACF,UAAUV;QACxE,OAAOW,eAAeE,OAAO,CAACrB,UAAUsB,OAAO,CAACf,IAAIM,IAAI,CAACG,IAAI,EAAE,OAAO,KAAK,CAACO,WAAE,CAACC,UAAU,CAACL,kBAAkBX,OAAOW;IACrH;IAEA,OAAOnB;AACT"}
1
+ {"version":3,"sources":["toPath.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport isAbsolute from 'is-absolute';\nimport resolve from 'resolve';\nimport { moduleRegEx } from './constants.js';\nimport fileURLToPath from './lib/fileURLToPath.js';\n// @ts-ignore\nimport process from './lib/process.cjs';\nimport type { Context } from './types.js';\n\nfunction getParentPath(context: Context) {\n if (context.parentPath) return path.dirname(context.parentPath);\n return context.parentURL ? path.dirname(toPath(context.parentURL)) : process.cwd();\n}\n\nexport default function toPath(specifier: string, context?: Context) {\n if (specifier.startsWith('file:')) return fileURLToPath(specifier);\n if (isAbsolute(specifier)) return specifier;\n if (specifier[0] === '.') {\n const parentPath = context ? getParentPath(context) : process.cwd();\n return path.resolve(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n\n let pkg = null;\n const main = resolve.sync(specifier, {\n basedir: parentPath,\n extensions: ['.js', '.json', '.node', '.mjs'],\n packageFilter(json, dir) {\n pkg = { json, dir };\n return json;\n },\n });\n if (!pkg || !pkg.json.module) return main; // no modules, use main\n if (pkg.json.name === specifier) return path.resolve(pkg.dir, pkg.json.module); // the module\n\n // a relative path. Only accept if it doesn't break the relative naming and it exists\n const modulePath = path.resolve(pkg.dir, pkg.json.module);\n const mainPath = path.resolve(pkg.dir, pkg.json.main);\n const moduleResolved = path.resolve(modulePath, path.relative(mainPath, main));\n return moduleResolved.indexOf(specifier.replace(pkg.json.name, '')) < 0 || !fs.existsSync(moduleResolved) ? main : moduleResolved;\n }\n\n return specifier;\n}\n"],"names":["toPath","getParentPath","context","parentPath","path","dirname","parentURL","process","cwd","specifier","startsWith","fileURLToPath","isAbsolute","resolve","moduleRegEx","test","pkg","main","sync","basedir","extensions","packageFilter","json","dir","module","name","modulePath","mainPath","moduleResolved","relative","indexOf","replace","fs","existsSync"],"mappings":";;;;+BAeA;;;eAAwBA;;;yDAfT;2DACE;iEACM;8DACH;yBACQ;oEACF;iEAEN;;;;;;AAGpB,SAASC,cAAcC,OAAgB;IACrC,IAAIA,QAAQC,UAAU,EAAE,OAAOC,aAAI,CAACC,OAAO,CAACH,QAAQC,UAAU;IAC9D,OAAOD,QAAQI,SAAS,GAAGF,aAAI,CAACC,OAAO,CAACL,OAAOE,QAAQI,SAAS,KAAKC,mBAAO,CAACC,GAAG;AAClF;AAEe,SAASR,OAAOS,SAAiB,EAAEP,OAAiB;IACjE,IAAIO,UAAUC,UAAU,CAAC,UAAU,OAAOC,IAAAA,sBAAa,EAACF;IACxD,IAAIG,IAAAA,mBAAU,EAACH,YAAY,OAAOA;IAClC,IAAIA,SAAS,CAAC,EAAE,KAAK,KAAK;QACxB,IAAMN,aAAaD,UAAUD,cAAcC,WAAWK,mBAAO,CAACC,GAAG;QACjE,OAAOJ,aAAI,CAACS,OAAO,CAACV,YAAYM;IAClC;IACA,IAAIK,sBAAW,CAACC,IAAI,CAACN,YAAY;QAC/B,IAAMN,cAAaD,UAAUD,cAAcC,WAAWK,mBAAO,CAACC,GAAG;QAEjE,IAAIQ,MAAM;QACV,IAAMC,OAAOJ,gBAAO,CAACK,IAAI,CAACT,WAAW;YACnCU,SAAShB;YACTiB,YAAY;gBAAC;gBAAO;gBAAS;gBAAS;aAAO;YAC7CC,eAAAA,SAAAA,cAAcC,IAAI,EAAEC,GAAG;gBACrBP,MAAM;oBAAEM,MAAAA;oBAAMC,KAAAA;gBAAI;gBAClB,OAAOD;YACT;QACF;QACA,IAAI,CAACN,OAAO,CAACA,IAAIM,IAAI,CAACE,MAAM,EAAE,OAAOP,MAAM,uBAAuB;QAClE,IAAID,IAAIM,IAAI,CAACG,IAAI,KAAKhB,WAAW,OAAOL,aAAI,CAACS,OAAO,CAACG,IAAIO,GAAG,EAAEP,IAAIM,IAAI,CAACE,MAAM,GAAG,aAAa;QAE7F,qFAAqF;QACrF,IAAME,aAAatB,aAAI,CAACS,OAAO,CAACG,IAAIO,GAAG,EAAEP,IAAIM,IAAI,CAACE,MAAM;QACxD,IAAMG,WAAWvB,aAAI,CAACS,OAAO,CAACG,IAAIO,GAAG,EAAEP,IAAIM,IAAI,CAACL,IAAI;QACpD,IAAMW,iBAAiBxB,aAAI,CAACS,OAAO,CAACa,YAAYtB,aAAI,CAACyB,QAAQ,CAACF,UAAUV;QACxE,OAAOW,eAAeE,OAAO,CAACrB,UAAUsB,OAAO,CAACf,IAAIM,IAAI,CAACG,IAAI,EAAE,OAAO,KAAK,CAACO,WAAE,CAACC,UAAU,CAACL,kBAAkBX,OAAOW;IACrH;IAEA,OAAOnB;AACT"}
@@ -14,14 +14,14 @@ Object.defineProperty(exports, /**
14
14
  });
15
15
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
16
16
  var _url = /*#__PURE__*/ _interop_require_default(require("url"));
17
- var _process = /*#__PURE__*/ _interop_require_default(require("process"));
18
17
  var _lazycjs = /*#__PURE__*/ _interop_require_default(require("./lib/lazy.js"));
18
+ var _processcjs = /*#__PURE__*/ _interop_require_default(require("./lib/process.js"));
19
19
  function _interop_require_default(obj) {
20
20
  return obj && obj.__esModule ? obj : {
21
21
  default: obj
22
22
  };
23
23
  }
24
- var major = +_process.default.versions.node.split('.')[0];
24
+ var major = +_processcjs.default.versions.node.split('.')[0];
25
25
  var version = major >= 14 ? 'local' : 'lts';
26
26
  var filename = typeof __filename !== 'undefined' ? __filename : _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString());
27
27
  var worker = _path.default.resolve(_path.default.dirname(filename), 'workers', "transformSync".concat(_path.default.extname(filename) === '.mjs' ? '.cjs' : '.js'));
@@ -1 +1 @@
1
- {"version":3,"sources":["transformSync.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\n\nimport process from 'process';\n// @ts-ignore\nimport lazy from './lib/lazy.cjs';\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major >= 14 ? 'local' : 'lts';\nconst filename = typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url);\nconst worker = path.resolve(path.dirname(filename), 'workers', `transformSync${path.extname(filename) === '.mjs' ? '.cjs' : '.js'}`);\nconst call = lazy('node-version-call');\n\n/**\n * @param {string} contents The file contents.\n * @param {string} fileName The filename.\n * @returns {{ code: string, map?: string }} Returns object with the transformed code and source map if option sourceMaps was provided.\n */\nexport default function transformSync(contents, fileName, config) {\n return call()(version, worker, contents, fileName, config);\n}\n"],"names":["transformSync","major","process","versions","node","split","version","filename","__filename","url","fileURLToPath","worker","path","resolve","dirname","extname","call","lazy","contents","fileName","config"],"mappings":";;;;+BAaA;;;;CAIC,GACD;;;eAAwBA;;;2DAlBP;0DACD;8DAEI;8DAEH;;;;;;AAEjB,IAAMC,QAAQ,CAACC,gBAAO,CAACC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,UAAUL,SAAS,KAAK,UAAU;AACxC,IAAMM,WAAW,OAAOC,eAAe,cAAcA,aAAaC,YAAG,CAACC,aAAa,CAAC;AACpF,IAAMC,SAASC,aAAI,CAACC,OAAO,CAACD,aAAI,CAACE,OAAO,CAACP,WAAW,WAAW,AAAC,gBAAkE,OAAnDK,aAAI,CAACG,OAAO,CAACR,cAAc,SAAS,SAAS;AAC5H,IAAMS,OAAOC,IAAAA,gBAAI,EAAC;AAOH,SAASjB,cAAckB,QAAQ,EAAEC,QAAQ,EAAEC,MAAM;IAC9D,OAAOJ,OAAOV,SAASK,QAAQO,UAAUC,UAAUC;AACrD"}
1
+ {"version":3,"sources":["transformSync.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\n\n// @ts-ignore\nimport lazy from './lib/lazy.cjs';\n// @ts-ignore\nimport process from './lib/process.cjs';\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major >= 14 ? 'local' : 'lts';\nconst filename = typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url);\nconst worker = path.resolve(path.dirname(filename), 'workers', `transformSync${path.extname(filename) === '.mjs' ? '.cjs' : '.js'}`);\nconst call = lazy('node-version-call');\n\n/**\n * @param {string} contents The file contents.\n * @param {string} fileName The filename.\n * @returns {{ code: string, map?: string }} Returns object with the transformed code and source map if option sourceMaps was provided.\n */\nexport default function transformSync(contents, fileName, config) {\n return call()(version, worker, contents, fileName, config);\n}\n"],"names":["transformSync","major","process","versions","node","split","version","filename","__filename","url","fileURLToPath","worker","path","resolve","dirname","extname","call","lazy","contents","fileName","config"],"mappings":";;;;+BAcA;;;;CAIC,GACD;;;eAAwBA;;;2DAnBP;0DACD;8DAGC;iEAEG;;;;;;AAEpB,IAAMC,QAAQ,CAACC,mBAAO,CAACC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,UAAUL,SAAS,KAAK,UAAU;AACxC,IAAMM,WAAW,OAAOC,eAAe,cAAcA,aAAaC,YAAG,CAACC,aAAa,CAAC;AACpF,IAAMC,SAASC,aAAI,CAACC,OAAO,CAACD,aAAI,CAACE,OAAO,CAACP,WAAW,WAAW,AAAC,gBAAkE,OAAnDK,aAAI,CAACG,OAAO,CAACR,cAAc,SAAS,SAAS;AAC5H,IAAMS,OAAOC,IAAAA,gBAAI,EAAC;AAOH,SAASjB,cAAckB,QAAQ,EAAEC,QAAQ,EAAEC,MAAM;IAC9D,OAAOJ,OAAOV,SAASK,QAAQO,UAAUC,UAAUC;AACrD"}
@@ -7,7 +7,6 @@ export default [
7
7
  '.tsx',
8
8
  '.cts',
9
9
  '.mts',
10
- '.json',
11
10
  '.es6',
12
11
  '.es'
13
12
  ];
@@ -1 +1 @@
1
- {"version":3,"sources":["extensions.ts"],"sourcesContent":["export default ['.js', '.jsx', '.cjs', '.mjs', '.ts', '.tsx', '.cts', '.mts', '.json', '.es6', '.es'];\n"],"names":[],"mappings":"AAAA,eAAe;IAAC;IAAO;IAAQ;IAAQ;IAAQ;IAAO;IAAQ;IAAQ;IAAQ;IAAS;IAAQ;CAAM,CAAC"}
1
+ {"version":3,"sources":["extensions.ts"],"sourcesContent":["export default ['.js', '.jsx', '.cjs', '.mjs', '.ts', '.tsx', '.cts', '.mts', '.es6', '.es'];\n"],"names":[],"mappings":"AAAA,eAAe;IAAC;IAAO;IAAQ;IAAQ;IAAQ;IAAO;IAAQ;IAAQ;IAAQ;IAAQ;CAAM,CAAC"}
@@ -1,6 +1,6 @@
1
1
  const path = require('path');
2
2
  const existsSync = require('./existsSync.cjs');
3
- const lazy = require('../lazy.cjs');
3
+ const lazy = require('./lazy.cjs');
4
4
  const major = +process.versions.node.split('.')[0];
5
5
  const version = major >= 14 ? 'local' : 'lts';
6
6
  const worker = path.resolve(path.dirname(__dirname), 'workers', `installBinding${path.extname(__filename)}`);
@@ -1 +1 @@
1
- {"version":3,"sources":["installBindings.cts"],"sourcesContent":["const path = require('path');\nconst existsSync = require('./existsSync.cjs');\nconst lazy = require('../lazy.cjs');\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major >= 14 ? 'local' : 'lts';\nconst worker = path.resolve(path.dirname(__dirname), 'workers', `installBinding${path.extname(__filename)}`);\nconst call = lazy('node-version-call');\n\nconst installDir = path.dirname(path.dirname(path.dirname(require.resolve('@swc/core/package.json'))));\nconst { optionalDependencies } = require('@swc/core/package.json');\nconst depKey = `${process.platform}-${process.arch}`;\n\nfor (const key in optionalDependencies) {\n const depPath = path.join(installDir, key);\n if (key.indexOf(depKey) < 0 || existsSync(depPath)) continue;\n\n try {\n call()({ version, callbacks: true }, worker, key, optionalDependencies[key]);\n } catch (err) {\n console.log(`Failed to install ${key}@${optionalDependencies[key]}. Error: ${err.message}`);\n }\n}\n"],"names":["path","require","existsSync","lazy","major","process","versions","node","split","version","worker","resolve","dirname","__dirname","extname","__filename","call","installDir","optionalDependencies","depKey","platform","arch","key","depPath","join","indexOf","callbacks","err","console","log","message"],"mappings":"AAAA,MAAMA,OAAOC,QAAQ;AACrB,MAAMC,aAAaD,QAAQ;AAC3B,MAAME,OAAOF,QAAQ;AAErB,MAAMG,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,UAAUL,SAAS,KAAK,UAAU;AACxC,MAAMM,SAASV,KAAKW,OAAO,CAACX,KAAKY,OAAO,CAACC,YAAY,WAAW,CAAC,cAAc,EAAEb,KAAKc,OAAO,CAACC,aAAa;AAC3G,MAAMC,OAAOb,KAAK;AAElB,MAAMc,aAAajB,KAAKY,OAAO,CAACZ,KAAKY,OAAO,CAACZ,KAAKY,OAAO,CAACX,QAAQU,OAAO,CAAC;AAC1E,MAAM,EAAEO,oBAAoB,EAAE,GAAGjB,QAAQ;AACzC,MAAMkB,SAAS,GAAGd,QAAQe,QAAQ,CAAC,CAAC,EAAEf,QAAQgB,IAAI,EAAE;AAEpD,IAAK,MAAMC,OAAOJ,qBAAsB;IACtC,MAAMK,UAAUvB,KAAKwB,IAAI,CAACP,YAAYK;IACtC,IAAIA,IAAIG,OAAO,CAACN,UAAU,KAAKjB,WAAWqB,UAAU;IAEpD,IAAI;QACFP,OAAO;YAAEP;YAASiB,WAAW;QAAK,GAAGhB,QAAQY,KAAKJ,oBAAoB,CAACI,IAAI;IAC7E,EAAE,OAAOK,KAAK;QACZC,QAAQC,GAAG,CAAC,CAAC,kBAAkB,EAAEP,IAAI,CAAC,EAAEJ,oBAAoB,CAACI,IAAI,CAAC,SAAS,EAAEK,IAAIG,OAAO,EAAE;IAC5F;AACF"}
1
+ {"version":3,"sources":["installBindings.cts"],"sourcesContent":["const path = require('path');\nconst existsSync = require('./existsSync.cjs');\nconst lazy = require('./lazy.cjs');\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major >= 14 ? 'local' : 'lts';\nconst worker = path.resolve(path.dirname(__dirname), 'workers', `installBinding${path.extname(__filename)}`);\nconst call = lazy('node-version-call');\n\nconst installDir = path.dirname(path.dirname(path.dirname(require.resolve('@swc/core/package.json'))));\nconst { optionalDependencies } = require('@swc/core/package.json');\nconst depKey = `${process.platform}-${process.arch}`;\n\nfor (const key in optionalDependencies) {\n const depPath = path.join(installDir, key);\n if (key.indexOf(depKey) < 0 || existsSync(depPath)) continue;\n\n try {\n call()({ version, callbacks: true }, worker, key, optionalDependencies[key]);\n } catch (err) {\n console.log(`Failed to install ${key}@${optionalDependencies[key]}. Error: ${err.message}`);\n }\n}\n"],"names":["path","require","existsSync","lazy","major","process","versions","node","split","version","worker","resolve","dirname","__dirname","extname","__filename","call","installDir","optionalDependencies","depKey","platform","arch","key","depPath","join","indexOf","callbacks","err","console","log","message"],"mappings":"AAAA,MAAMA,OAAOC,QAAQ;AACrB,MAAMC,aAAaD,QAAQ;AAC3B,MAAME,OAAOF,QAAQ;AAErB,MAAMG,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,UAAUL,SAAS,KAAK,UAAU;AACxC,MAAMM,SAASV,KAAKW,OAAO,CAACX,KAAKY,OAAO,CAACC,YAAY,WAAW,CAAC,cAAc,EAAEb,KAAKc,OAAO,CAACC,aAAa;AAC3G,MAAMC,OAAOb,KAAK;AAElB,MAAMc,aAAajB,KAAKY,OAAO,CAACZ,KAAKY,OAAO,CAACZ,KAAKY,OAAO,CAACX,QAAQU,OAAO,CAAC;AAC1E,MAAM,EAAEO,oBAAoB,EAAE,GAAGjB,QAAQ;AACzC,MAAMkB,SAAS,GAAGd,QAAQe,QAAQ,CAAC,CAAC,EAAEf,QAAQgB,IAAI,EAAE;AAEpD,IAAK,MAAMC,OAAOJ,qBAAsB;IACtC,MAAMK,UAAUvB,KAAKwB,IAAI,CAACP,YAAYK;IACtC,IAAIA,IAAIG,OAAO,CAACN,UAAU,KAAKjB,WAAWqB,UAAU;IAEpD,IAAI;QACFP,OAAO;YAAEP;YAASiB,WAAW;QAAK,GAAGhB,QAAQY,KAAKJ,oBAAoB,CAACI,IAAI;IAC7E,EAAE,OAAOK,KAAK;QACZC,QAAQC,GAAG,CAAC,CAAC,kBAAkB,EAAEP,IAAI,CAAC,EAAEJ,oBAAoB,CAACI,IAAI,CAAC,SAAS,EAAEK,IAAIG,OAAO,EAAE;IAC5F;AACF"}
@@ -0,0 +1 @@
1
+ module.exports = process;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["process.cts"],"sourcesContent":["module.exports = process;\n"],"names":["module","exports","process"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC"}
@@ -1,10 +1,11 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
3
  import isAbsolute from 'is-absolute';
4
- import process from 'process';
5
4
  import resolve from 'resolve';
6
5
  import { moduleRegEx } from './constants.mjs';
7
6
  import fileURLToPath from './lib/fileURLToPath.mjs';
7
+ // @ts-ignore
8
+ import process from './lib/process.cjs';
8
9
  function getParentPath(context) {
9
10
  if (context.parentPath) return path.dirname(context.parentPath);
10
11
  return context.parentURL ? path.dirname(toPath(context.parentURL)) : process.cwd();
@@ -1 +1 @@
1
- {"version":3,"sources":["toPath.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport isAbsolute from 'is-absolute';\nimport process from 'process';\nimport resolve from 'resolve';\nimport { moduleRegEx } from './constants.js';\nimport fileURLToPath from './lib/fileURLToPath.js';\nimport type { Context } from './types.js';\n\nfunction getParentPath(context: Context) {\n if (context.parentPath) return path.dirname(context.parentPath);\n return context.parentURL ? path.dirname(toPath(context.parentURL)) : process.cwd();\n}\n\nexport default function toPath(specifier: string, context?: Context) {\n if (specifier.startsWith('file:')) return fileURLToPath(specifier);\n if (isAbsolute(specifier)) return specifier;\n if (specifier[0] === '.') {\n const parentPath = context ? getParentPath(context) : process.cwd();\n return path.resolve(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n\n let pkg = null;\n const main = resolve.sync(specifier, {\n basedir: parentPath,\n extensions: ['.js', '.json', '.node', '.mjs'],\n packageFilter(json, dir) {\n pkg = { json, dir };\n return json;\n },\n });\n if (!pkg || !pkg.json.module) return main; // no modules, use main\n if (pkg.json.name === specifier) return path.resolve(pkg.dir, pkg.json.module); // the module\n\n // a relative path. Only accept if it doesn't break the relative naming and it exists\n const modulePath = path.resolve(pkg.dir, pkg.json.module);\n const mainPath = path.resolve(pkg.dir, pkg.json.main);\n const moduleResolved = path.resolve(modulePath, path.relative(mainPath, main));\n return moduleResolved.indexOf(specifier.replace(pkg.json.name, '')) < 0 || !fs.existsSync(moduleResolved) ? main : moduleResolved;\n }\n\n return specifier;\n}\n"],"names":["fs","path","isAbsolute","process","resolve","moduleRegEx","fileURLToPath","getParentPath","context","parentPath","dirname","parentURL","toPath","cwd","specifier","startsWith","test","pkg","main","sync","basedir","extensions","packageFilter","json","dir","module","name","modulePath","mainPath","moduleResolved","relative","indexOf","replace","existsSync"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,gBAAgB,cAAc;AACrC,OAAOC,aAAa,UAAU;AAC9B,OAAOC,aAAa,UAAU;AAC9B,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,OAAOC,mBAAmB,yBAAyB;AAGnD,SAASC,cAAcC,OAAgB;IACrC,IAAIA,QAAQC,UAAU,EAAE,OAAOR,KAAKS,OAAO,CAACF,QAAQC,UAAU;IAC9D,OAAOD,QAAQG,SAAS,GAAGV,KAAKS,OAAO,CAACE,OAAOJ,QAAQG,SAAS,KAAKR,QAAQU,GAAG;AAClF;AAEA,eAAe,SAASD,OAAOE,SAAiB,EAAEN,OAAiB;IACjE,IAAIM,UAAUC,UAAU,CAAC,UAAU,OAAOT,cAAcQ;IACxD,IAAIZ,WAAWY,YAAY,OAAOA;IAClC,IAAIA,SAAS,CAAC,EAAE,KAAK,KAAK;QACxB,MAAML,aAAaD,UAAUD,cAAcC,WAAWL,QAAQU,GAAG;QACjE,OAAOZ,KAAKG,OAAO,CAACK,YAAYK;IAClC;IACA,IAAIT,YAAYW,IAAI,CAACF,YAAY;QAC/B,MAAML,aAAaD,UAAUD,cAAcC,WAAWL,QAAQU,GAAG;QAEjE,IAAII,MAAM;QACV,MAAMC,OAAOd,QAAQe,IAAI,CAACL,WAAW;YACnCM,SAASX;YACTY,YAAY;gBAAC;gBAAO;gBAAS;gBAAS;aAAO;YAC7CC,eAAcC,IAAI,EAAEC,GAAG;gBACrBP,MAAM;oBAAEM;oBAAMC;gBAAI;gBAClB,OAAOD;YACT;QACF;QACA,IAAI,CAACN,OAAO,CAACA,IAAIM,IAAI,CAACE,MAAM,EAAE,OAAOP,MAAM,uBAAuB;QAClE,IAAID,IAAIM,IAAI,CAACG,IAAI,KAAKZ,WAAW,OAAOb,KAAKG,OAAO,CAACa,IAAIO,GAAG,EAAEP,IAAIM,IAAI,CAACE,MAAM,GAAG,aAAa;QAE7F,qFAAqF;QACrF,MAAME,aAAa1B,KAAKG,OAAO,CAACa,IAAIO,GAAG,EAAEP,IAAIM,IAAI,CAACE,MAAM;QACxD,MAAMG,WAAW3B,KAAKG,OAAO,CAACa,IAAIO,GAAG,EAAEP,IAAIM,IAAI,CAACL,IAAI;QACpD,MAAMW,iBAAiB5B,KAAKG,OAAO,CAACuB,YAAY1B,KAAK6B,QAAQ,CAACF,UAAUV;QACxE,OAAOW,eAAeE,OAAO,CAACjB,UAAUkB,OAAO,CAACf,IAAIM,IAAI,CAACG,IAAI,EAAE,OAAO,KAAK,CAAC1B,GAAGiC,UAAU,CAACJ,kBAAkBX,OAAOW;IACrH;IAEA,OAAOf;AACT"}
1
+ {"version":3,"sources":["toPath.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport isAbsolute from 'is-absolute';\nimport resolve from 'resolve';\nimport { moduleRegEx } from './constants.js';\nimport fileURLToPath from './lib/fileURLToPath.js';\n// @ts-ignore\nimport process from './lib/process.cjs';\nimport type { Context } from './types.js';\n\nfunction getParentPath(context: Context) {\n if (context.parentPath) return path.dirname(context.parentPath);\n return context.parentURL ? path.dirname(toPath(context.parentURL)) : process.cwd();\n}\n\nexport default function toPath(specifier: string, context?: Context) {\n if (specifier.startsWith('file:')) return fileURLToPath(specifier);\n if (isAbsolute(specifier)) return specifier;\n if (specifier[0] === '.') {\n const parentPath = context ? getParentPath(context) : process.cwd();\n return path.resolve(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n\n let pkg = null;\n const main = resolve.sync(specifier, {\n basedir: parentPath,\n extensions: ['.js', '.json', '.node', '.mjs'],\n packageFilter(json, dir) {\n pkg = { json, dir };\n return json;\n },\n });\n if (!pkg || !pkg.json.module) return main; // no modules, use main\n if (pkg.json.name === specifier) return path.resolve(pkg.dir, pkg.json.module); // the module\n\n // a relative path. Only accept if it doesn't break the relative naming and it exists\n const modulePath = path.resolve(pkg.dir, pkg.json.module);\n const mainPath = path.resolve(pkg.dir, pkg.json.main);\n const moduleResolved = path.resolve(modulePath, path.relative(mainPath, main));\n return moduleResolved.indexOf(specifier.replace(pkg.json.name, '')) < 0 || !fs.existsSync(moduleResolved) ? main : moduleResolved;\n }\n\n return specifier;\n}\n"],"names":["fs","path","isAbsolute","resolve","moduleRegEx","fileURLToPath","process","getParentPath","context","parentPath","dirname","parentURL","toPath","cwd","specifier","startsWith","test","pkg","main","sync","basedir","extensions","packageFilter","json","dir","module","name","modulePath","mainPath","moduleResolved","relative","indexOf","replace","existsSync"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,gBAAgB,cAAc;AACrC,OAAOC,aAAa,UAAU;AAC9B,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,OAAOC,mBAAmB,yBAAyB;AACnD,aAAa;AACb,OAAOC,aAAa,oBAAoB;AAGxC,SAASC,cAAcC,OAAgB;IACrC,IAAIA,QAAQC,UAAU,EAAE,OAAOR,KAAKS,OAAO,CAACF,QAAQC,UAAU;IAC9D,OAAOD,QAAQG,SAAS,GAAGV,KAAKS,OAAO,CAACE,OAAOJ,QAAQG,SAAS,KAAKL,QAAQO,GAAG;AAClF;AAEA,eAAe,SAASD,OAAOE,SAAiB,EAAEN,OAAiB;IACjE,IAAIM,UAAUC,UAAU,CAAC,UAAU,OAAOV,cAAcS;IACxD,IAAIZ,WAAWY,YAAY,OAAOA;IAClC,IAAIA,SAAS,CAAC,EAAE,KAAK,KAAK;QACxB,MAAML,aAAaD,UAAUD,cAAcC,WAAWF,QAAQO,GAAG;QACjE,OAAOZ,KAAKE,OAAO,CAACM,YAAYK;IAClC;IACA,IAAIV,YAAYY,IAAI,CAACF,YAAY;QAC/B,MAAML,aAAaD,UAAUD,cAAcC,WAAWF,QAAQO,GAAG;QAEjE,IAAII,MAAM;QACV,MAAMC,OAAOf,QAAQgB,IAAI,CAACL,WAAW;YACnCM,SAASX;YACTY,YAAY;gBAAC;gBAAO;gBAAS;gBAAS;aAAO;YAC7CC,eAAcC,IAAI,EAAEC,GAAG;gBACrBP,MAAM;oBAAEM;oBAAMC;gBAAI;gBAClB,OAAOD;YACT;QACF;QACA,IAAI,CAACN,OAAO,CAACA,IAAIM,IAAI,CAACE,MAAM,EAAE,OAAOP,MAAM,uBAAuB;QAClE,IAAID,IAAIM,IAAI,CAACG,IAAI,KAAKZ,WAAW,OAAOb,KAAKE,OAAO,CAACc,IAAIO,GAAG,EAAEP,IAAIM,IAAI,CAACE,MAAM,GAAG,aAAa;QAE7F,qFAAqF;QACrF,MAAME,aAAa1B,KAAKE,OAAO,CAACc,IAAIO,GAAG,EAAEP,IAAIM,IAAI,CAACE,MAAM;QACxD,MAAMG,WAAW3B,KAAKE,OAAO,CAACc,IAAIO,GAAG,EAAEP,IAAIM,IAAI,CAACL,IAAI;QACpD,MAAMW,iBAAiB5B,KAAKE,OAAO,CAACwB,YAAY1B,KAAK6B,QAAQ,CAACF,UAAUV;QACxE,OAAOW,eAAeE,OAAO,CAACjB,UAAUkB,OAAO,CAACf,IAAIM,IAAI,CAACG,IAAI,EAAE,OAAO,KAAK,CAAC1B,GAAGiC,UAAU,CAACJ,kBAAkBX,OAAOW;IACrH;IAEA,OAAOf;AACT"}
@@ -1,8 +1,9 @@
1
1
  import path from 'path';
2
2
  import url from 'url';
3
- import process from 'process';
4
3
  // @ts-ignore
5
4
  import lazy from './lib/lazy.cjs';
5
+ // @ts-ignore
6
+ import process from './lib/process.cjs';
6
7
  const major = +process.versions.node.split('.')[0];
7
8
  const version = major >= 14 ? 'local' : 'lts';
8
9
  const filename = typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url);
@@ -1 +1 @@
1
- {"version":3,"sources":["transformSync.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\n\nimport process from 'process';\n// @ts-ignore\nimport lazy from './lib/lazy.cjs';\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major >= 14 ? 'local' : 'lts';\nconst filename = typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url);\nconst worker = path.resolve(path.dirname(filename), 'workers', `transformSync${path.extname(filename) === '.mjs' ? '.cjs' : '.js'}`);\nconst call = lazy('node-version-call');\n\n/**\n * @param {string} contents The file contents.\n * @param {string} fileName The filename.\n * @returns {{ code: string, map?: string }} Returns object with the transformed code and source map if option sourceMaps was provided.\n */\nexport default function transformSync(contents, fileName, config) {\n return call()(version, worker, contents, fileName, config);\n}\n"],"names":["path","url","process","lazy","major","versions","node","split","version","filename","__filename","fileURLToPath","worker","resolve","dirname","extname","call","transformSync","contents","fileName","config"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AAEtB,OAAOC,aAAa,UAAU;AAC9B,aAAa;AACb,OAAOC,UAAU,iBAAiB;AAElC,MAAMC,QAAQ,CAACF,QAAQG,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,UAAUJ,SAAS,KAAK,UAAU;AACxC,MAAMK,WAAW,OAAOC,eAAe,cAAcA,aAAaT,IAAIU,aAAa,CAAC,YAAYV,GAAG;AACnG,MAAMW,SAASZ,KAAKa,OAAO,CAACb,KAAKc,OAAO,CAACL,WAAW,WAAW,CAAC,aAAa,EAAET,KAAKe,OAAO,CAACN,cAAc,SAAS,SAAS,OAAO;AACnI,MAAMO,OAAOb,KAAK;AAElB;;;;CAIC,GACD,eAAe,SAASc,cAAcC,QAAQ,EAAEC,QAAQ,EAAEC,MAAM;IAC9D,OAAOJ,OAAOR,SAASI,QAAQM,UAAUC,UAAUC;AACrD"}
1
+ {"version":3,"sources":["transformSync.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\n\n// @ts-ignore\nimport lazy from './lib/lazy.cjs';\n// @ts-ignore\nimport process from './lib/process.cjs';\n\nconst major = +process.versions.node.split('.')[0];\nconst version = major >= 14 ? 'local' : 'lts';\nconst filename = typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url);\nconst worker = path.resolve(path.dirname(filename), 'workers', `transformSync${path.extname(filename) === '.mjs' ? '.cjs' : '.js'}`);\nconst call = lazy('node-version-call');\n\n/**\n * @param {string} contents The file contents.\n * @param {string} fileName The filename.\n * @returns {{ code: string, map?: string }} Returns object with the transformed code and source map if option sourceMaps was provided.\n */\nexport default function transformSync(contents, fileName, config) {\n return call()(version, worker, contents, fileName, config);\n}\n"],"names":["path","url","lazy","process","major","versions","node","split","version","filename","__filename","fileURLToPath","worker","resolve","dirname","extname","call","transformSync","contents","fileName","config"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AAEtB,aAAa;AACb,OAAOC,UAAU,iBAAiB;AAClC,aAAa;AACb,OAAOC,aAAa,oBAAoB;AAExC,MAAMC,QAAQ,CAACD,QAAQE,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,UAAUJ,SAAS,KAAK,UAAU;AACxC,MAAMK,WAAW,OAAOC,eAAe,cAAcA,aAAaT,IAAIU,aAAa,CAAC,YAAYV,GAAG;AACnG,MAAMW,SAASZ,KAAKa,OAAO,CAACb,KAAKc,OAAO,CAACL,WAAW,WAAW,CAAC,aAAa,EAAET,KAAKe,OAAO,CAACN,cAAc,SAAS,SAAS,OAAO;AACnI,MAAMO,OAAOd,KAAK;AAElB;;;;CAIC,GACD,eAAe,SAASe,cAAcC,QAAQ,EAAEC,QAAQ,EAAEC,MAAM;IAC9D,OAAOJ,OAAOR,SAASI,QAAQM,UAAUC,UAAUC;AACrD"}
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-swc-transform",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "Typescript transformers for swc. Supports Node >= 0.8",
5
5
  "keywords": [
6
6
  "matcher",
@@ -61,7 +61,6 @@
61
61
  "mkdirp": "^0.5.6",
62
62
  "node-version-call": "^1.1.1",
63
63
  "path-posix": "^1.0.0",
64
- "process": "^0.11.10",
65
64
  "queue-cb": "^1.4.3",
66
65
  "resolve": "^1.22.9",
67
66
  "temp-suffix": "^0.1.1",
@@ -78,7 +77,7 @@
78
77
  "cr": "^0.1.0",
79
78
  "react": "^19.0.0",
80
79
  "rimraf2": "^2.8.2",
81
- "ts-dev-stack": "^1.2.3",
80
+ "ts-dev-stack": "^1.2.5",
82
81
  "ts-node": "^10.8.2",
83
82
  "typescript": "^5.7.2"
84
83
  },