ts-swc-transform 2.1.1 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/lib/importMetaResolve.d.cts +2 -1
- package/dist/cjs/lib/importMetaResolve.d.ts +2 -1
- package/dist/cjs/lib/importMetaResolve.js +3 -3
- package/dist/cjs/lib/importMetaResolve.js.map +1 -1
- package/dist/cjs/toPath.js +2 -2
- package/dist/cjs/toPath.js.map +1 -1
- package/dist/esm/lib/importMetaResolve.d.ts +2 -1
- package/dist/esm/lib/importMetaResolve.js +1 -1
- package/dist/esm/lib/importMetaResolve.js.map +1 -1
- package/dist/esm/toPath.js +2 -2
- package/dist/esm/toPath.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: any;
|
|
2
|
+
export default _default;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: any;
|
|
2
|
+
export default _default;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
Object.defineProperty(exports, "
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: function() {
|
|
8
|
-
return
|
|
8
|
+
return _default;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
var _module = /*#__PURE__*/ _interop_require_default(require("module"));
|
|
@@ -16,5 +16,5 @@ function _interop_require_default(obj) {
|
|
|
16
16
|
}
|
|
17
17
|
var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
|
|
18
18
|
var path = '../../../assets/importMetaResolve.cjs';
|
|
19
|
-
var
|
|
19
|
+
var _default = _require(path).resolve;
|
|
20
20
|
/* 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/lib/importMetaResolve.ts"],"sourcesContent":["import Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst path = '../../../assets/importMetaResolve.cjs';\nexport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/importMetaResolve.ts"],"sourcesContent":["import Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst path = '../../../assets/importMetaResolve.cjs';\nexport default _require(path).resolve;\n"],"names":["_require","require","Module","createRequire","path","resolve"],"mappings":";;;;+BAIA;;;eAAA;;;6DAJmB;;;;;;AAEnB,IAAMA,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,OAAO;IACb,WAAeJ,SAASI,MAAMC,OAAO"}
|
package/dist/cjs/toPath.js
CHANGED
|
@@ -14,7 +14,7 @@ var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
|
14
14
|
var _resolve = /*#__PURE__*/ _interop_require_default(require("resolve"));
|
|
15
15
|
var _url = /*#__PURE__*/ _interop_require_default(require("url"));
|
|
16
16
|
var _constantsts = require("./constants.js");
|
|
17
|
-
var _importMetaResolvets = /*#__PURE__*/
|
|
17
|
+
var _importMetaResolvets = /*#__PURE__*/ _interop_require_default(require("./lib/importMetaResolve.js"));
|
|
18
18
|
var _urlFileUrlts = /*#__PURE__*/ _interop_require_wildcard(require("./lib/urlFileUrl.js"));
|
|
19
19
|
function _interop_require_default(obj) {
|
|
20
20
|
return obj && obj.__esModule ? obj : {
|
|
@@ -80,7 +80,7 @@ function toPath(specifier, context) {
|
|
|
80
80
|
var parentPath1 = context ? getParentPath(context) : process.cwd();
|
|
81
81
|
if (!useCJS) {
|
|
82
82
|
try {
|
|
83
|
-
var entryURL = _importMetaResolvets.
|
|
83
|
+
var entryURL = (0, _importMetaResolvets.default)(specifier, pathToFileURL(parentPath1));
|
|
84
84
|
if (entryURL) return fileURLToPath(entryURL);
|
|
85
85
|
} catch (_) {
|
|
86
86
|
/* it may fail due to commonjs edge cases */ }
|
package/dist/cjs/toPath.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import isAbsolute from 'is-absolute';\nimport module from 'module';\nimport path from 'path';\nimport resolveCJS from 'resolve';\nimport url from 'url';\nimport { moduleRegEx } from './constants.ts';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import isAbsolute from 'is-absolute';\nimport module from 'module';\nimport path from 'path';\nimport resolveCJS from 'resolve';\nimport url from 'url';\nimport { moduleRegEx } from './constants.ts';\nimport importMetaResolve from './lib/importMetaResolve.ts';\nimport * as urlPolyfills from './lib/urlFileUrl.ts';\nimport type { Context } from './types.ts';\n\nconst useCJS = !module.createRequire;\nconst fileURLToPath = url.fileURLToPath || urlPolyfills.fileURLToPath;\nconst pathToFileURL = url.pathToFileURL || urlPolyfills.pathToFileURL;\n\nfunction getParentPath(context: Context): string {\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): string {\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.join(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n if (!useCJS) {\n try {\n const entryURL = importMetaResolve(specifier, pathToFileURL(parentPath));\n if (entryURL) return fileURLToPath(entryURL);\n } catch (_) {\n /* it may fail due to commonjs edge cases */\n }\n }\n const entryPath = resolveCJS.sync(specifier, {\n basedir: parentPath,\n extensions: ['.js', '.json', '.node', '.mjs'],\n });\n if (entryPath) return entryPath;\n }\n\n return specifier;\n}\n"],"names":["toPath","useCJS","module","createRequire","fileURLToPath","url","urlPolyfills","pathToFileURL","getParentPath","context","parentPath","path","dirname","parentURL","process","cwd","specifier","startsWith","isAbsolute","join","moduleRegEx","test","entryURL","importMetaResolve","_","entryPath","resolveCJS","sync","basedir","extensions"],"mappings":";;;;+BAmBA;;;eAAwBA;;;iEAnBD;6DACJ;2DACF;8DACM;0DACP;2BACY;0EACE;oEACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG9B,IAAMC,SAAS,CAACC,eAAM,CAACC,aAAa;AACpC,IAAMC,gBAAgBC,YAAG,CAACD,aAAa,IAAIE,cAAaF,aAAa;AACrE,IAAMG,gBAAgBF,YAAG,CAACE,aAAa,IAAID,cAAaC,aAAa;AAErE,SAASC,cAAcC,OAAgB;IACrC,IAAIA,QAAQC,UAAU,EAAE,OAAOC,aAAI,CAACC,OAAO,CAACH,QAAQC,UAAU;IAC9D,OAAOD,QAAQI,SAAS,GAAGF,aAAI,CAACC,OAAO,CAACZ,OAAOS,QAAQI,SAAS,KAAKC,QAAQC,GAAG;AAClF;AAEe,SAASf,OAAOgB,SAAiB,EAAEP,OAAiB;IACjE,IAAIO,UAAUC,UAAU,CAAC,UAAU,OAAOb,cAAcY;IACxD,IAAIE,IAAAA,mBAAU,EAACF,YAAY,OAAOA;IAClC,IAAIA,SAAS,CAAC,EAAE,KAAK,KAAK;QACxB,IAAMN,aAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QACjE,OAAOJ,aAAI,CAACQ,IAAI,CAACT,YAAYM;IAC/B;IACA,IAAII,wBAAW,CAACC,IAAI,CAACL,YAAY;QAC/B,IAAMN,cAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QACjE,IAAI,CAACd,QAAQ;YACX,IAAI;gBACF,IAAMqB,WAAWC,IAAAA,4BAAiB,EAACP,WAAWT,cAAcG;gBAC5D,IAAIY,UAAU,OAAOlB,cAAckB;YACrC,EAAE,OAAOE,GAAG;YACV,0CAA0C,GAC5C;QACF;QACA,IAAMC,YAAYC,gBAAU,CAACC,IAAI,CAACX,WAAW;YAC3CY,SAASlB;YACTmB,YAAY;gBAAC;gBAAO;gBAAS;gBAAS;aAAO;QAC/C;QACA,IAAIJ,WAAW,OAAOA;IACxB;IAEA,OAAOT;AACT"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: any;
|
|
2
|
+
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import Module from 'module';
|
|
2
2
|
const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
|
|
3
3
|
const path = '../../../assets/importMetaResolve.cjs';
|
|
4
|
-
export
|
|
4
|
+
export default _require(path).resolve;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/importMetaResolve.ts"],"sourcesContent":["import Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst path = '../../../assets/importMetaResolve.cjs';\nexport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/importMetaResolve.ts"],"sourcesContent":["import Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst path = '../../../assets/importMetaResolve.cjs';\nexport default _require(path).resolve;\n"],"names":["Module","_require","require","createRequire","url","path","resolve"],"mappings":"AAAA,OAAOA,YAAY,SAAS;AAE5B,MAAMC,WAAW,OAAOC,YAAY,cAAcF,OAAOG,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAC1F,MAAMG,OAAO;AACb,eAAeJ,SAASI,MAAMC,OAAO,CAAC"}
|
package/dist/esm/toPath.js
CHANGED
|
@@ -4,7 +4,7 @@ import path from 'path';
|
|
|
4
4
|
import resolveCJS from 'resolve';
|
|
5
5
|
import url from 'url';
|
|
6
6
|
import { moduleRegEx } from './constants.js';
|
|
7
|
-
import
|
|
7
|
+
import importMetaResolve from './lib/importMetaResolve.js';
|
|
8
8
|
import * as urlPolyfills from './lib/urlFileUrl.js';
|
|
9
9
|
const useCJS = !module.createRequire;
|
|
10
10
|
const fileURLToPath = url.fileURLToPath || urlPolyfills.fileURLToPath;
|
|
@@ -24,7 +24,7 @@ export default function toPath(specifier, context) {
|
|
|
24
24
|
const parentPath = context ? getParentPath(context) : process.cwd();
|
|
25
25
|
if (!useCJS) {
|
|
26
26
|
try {
|
|
27
|
-
const entryURL =
|
|
27
|
+
const entryURL = importMetaResolve(specifier, pathToFileURL(parentPath));
|
|
28
28
|
if (entryURL) return fileURLToPath(entryURL);
|
|
29
29
|
} catch (_) {
|
|
30
30
|
/* it may fail due to commonjs edge cases */ }
|
package/dist/esm/toPath.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import isAbsolute from 'is-absolute';\nimport module from 'module';\nimport path from 'path';\nimport resolveCJS from 'resolve';\nimport url from 'url';\nimport { moduleRegEx } from './constants.ts';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import isAbsolute from 'is-absolute';\nimport module from 'module';\nimport path from 'path';\nimport resolveCJS from 'resolve';\nimport url from 'url';\nimport { moduleRegEx } from './constants.ts';\nimport importMetaResolve from './lib/importMetaResolve.ts';\nimport * as urlPolyfills from './lib/urlFileUrl.ts';\nimport type { Context } from './types.ts';\n\nconst useCJS = !module.createRequire;\nconst fileURLToPath = url.fileURLToPath || urlPolyfills.fileURLToPath;\nconst pathToFileURL = url.pathToFileURL || urlPolyfills.pathToFileURL;\n\nfunction getParentPath(context: Context): string {\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): string {\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.join(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n if (!useCJS) {\n try {\n const entryURL = importMetaResolve(specifier, pathToFileURL(parentPath));\n if (entryURL) return fileURLToPath(entryURL);\n } catch (_) {\n /* it may fail due to commonjs edge cases */\n }\n }\n const entryPath = resolveCJS.sync(specifier, {\n basedir: parentPath,\n extensions: ['.js', '.json', '.node', '.mjs'],\n });\n if (entryPath) return entryPath;\n }\n\n return specifier;\n}\n"],"names":["isAbsolute","module","path","resolveCJS","url","moduleRegEx","importMetaResolve","urlPolyfills","useCJS","createRequire","fileURLToPath","pathToFileURL","getParentPath","context","parentPath","dirname","parentURL","toPath","process","cwd","specifier","startsWith","join","test","entryURL","_","entryPath","sync","basedir","extensions"],"mappings":"AAAA,OAAOA,gBAAgB,cAAc;AACrC,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,OAAO;AACxB,OAAOC,gBAAgB,UAAU;AACjC,OAAOC,SAAS,MAAM;AACtB,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,OAAOC,uBAAuB,6BAA6B;AAC3D,YAAYC,kBAAkB,sBAAsB;AAGpD,MAAMC,SAAS,CAACP,OAAOQ,aAAa;AACpC,MAAMC,gBAAgBN,IAAIM,aAAa,IAAIH,aAAaG,aAAa;AACrE,MAAMC,gBAAgBP,IAAIO,aAAa,IAAIJ,aAAaI,aAAa;AAErE,SAASC,cAAcC,OAAgB;IACrC,IAAIA,QAAQC,UAAU,EAAE,OAAOZ,KAAKa,OAAO,CAACF,QAAQC,UAAU;IAC9D,OAAOD,QAAQG,SAAS,GAAGd,KAAKa,OAAO,CAACE,OAAOJ,QAAQG,SAAS,KAAKE,QAAQC,GAAG;AAClF;AAEA,eAAe,SAASF,OAAOG,SAAiB,EAAEP,OAAiB;IACjE,IAAIO,UAAUC,UAAU,CAAC,UAAU,OAAOX,cAAcU;IACxD,IAAIpB,WAAWoB,YAAY,OAAOA;IAClC,IAAIA,SAAS,CAAC,EAAE,KAAK,KAAK;QACxB,MAAMN,aAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QACjE,OAAOjB,KAAKoB,IAAI,CAACR,YAAYM;IAC/B;IACA,IAAIf,YAAYkB,IAAI,CAACH,YAAY;QAC/B,MAAMN,aAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QACjE,IAAI,CAACX,QAAQ;YACX,IAAI;gBACF,MAAMgB,WAAWlB,kBAAkBc,WAAWT,cAAcG;gBAC5D,IAAIU,UAAU,OAAOd,cAAcc;YACrC,EAAE,OAAOC,GAAG;YACV,0CAA0C,GAC5C;QACF;QACA,MAAMC,YAAYvB,WAAWwB,IAAI,CAACP,WAAW;YAC3CQ,SAASd;YACTe,YAAY;gBAAC;gBAAO;gBAAS;gBAAS;aAAO;QAC/C;QACA,IAAIH,WAAW,OAAOA;IACxB;IAEA,OAAON;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-swc-transform",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "Typescript transformers for swc. Supports Node >= 0.8",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"matcher",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"exit": "^0.1.2",
|
|
49
49
|
"fs-iterator": "^6.0.3",
|
|
50
50
|
"get-tsconfig-compat": "^2.0.3",
|
|
51
|
-
"install-optional": "^0.1.
|
|
51
|
+
"install-optional": "^0.1.69",
|
|
52
52
|
"is-absolute": "^1.0.0",
|
|
53
53
|
"lodash.find": "^4.6.0",
|
|
54
54
|
"minimatch": "^3.1.2",
|
|
55
55
|
"mkdirp-classic": "^0.5.3",
|
|
56
|
-
"node-version-call": "^1.7.
|
|
56
|
+
"node-version-call": "^1.7.16",
|
|
57
57
|
"path-posix": "^1.0.0",
|
|
58
58
|
"queue-cb": "^1.5.5",
|
|
59
59
|
"resolve": "^1.22.10",
|