ts-swc-transform 1.15.0 → 1.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/toPath.cjs +16 -14
- package/dist/cjs/toPath.cjs.map +1 -1
- package/dist/esm/toPath.mjs +16 -14
- package/dist/esm/toPath.mjs.map +1 -1
- package/package.json +3 -3
package/dist/cjs/toPath.cjs
CHANGED
|
@@ -78,21 +78,23 @@ function toPath(specifier, context) {
|
|
|
78
78
|
}
|
|
79
79
|
if (_constants.moduleRegEx.test(specifier)) {
|
|
80
80
|
var parentPath1 = context ? getParentPath(context) : process.cwd();
|
|
81
|
-
if (useCJS) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
'.node',
|
|
88
|
-
'.mjs'
|
|
89
|
-
]
|
|
90
|
-
});
|
|
91
|
-
if (entryPath) return entryPath;
|
|
92
|
-
} else {
|
|
93
|
-
var entryURL = (0, _importmetaresolvecjs.resolve)(specifier, pathToFileURL(parentPath1));
|
|
94
|
-
if (entryURL) return fileURLToPath(entryURL);
|
|
81
|
+
if (!useCJS) {
|
|
82
|
+
try {
|
|
83
|
+
var entryURL = (0, _importmetaresolvecjs.resolve)(specifier, pathToFileURL(parentPath1));
|
|
84
|
+
if (entryURL) return fileURLToPath(entryURL);
|
|
85
|
+
} catch (_) {
|
|
86
|
+
/* it may fail due to commonjs edge cases */ }
|
|
95
87
|
}
|
|
88
|
+
var entryPath = _resolve.default.sync(specifier, {
|
|
89
|
+
basedir: parentPath1,
|
|
90
|
+
extensions: [
|
|
91
|
+
'.js',
|
|
92
|
+
'.json',
|
|
93
|
+
'.node',
|
|
94
|
+
'.mjs'
|
|
95
|
+
]
|
|
96
|
+
});
|
|
97
|
+
if (entryPath) return entryPath;
|
|
96
98
|
}
|
|
97
99
|
return specifier;
|
|
98
100
|
}
|
package/dist/cjs/toPath.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import module from 'module';\nimport path from 'path';\nimport url from 'url';\nimport isAbsolute from 'is-absolute';\nimport resolveCJS from 'resolve';\n// @ts-ignore\nimport { resolve as resolveESM } from '../../assets/import-meta-resolve.cjs';\nimport { moduleRegEx } from './constants';\nimport * as urlPolyfills from './lib/url-file-url';\nimport type { Context } from './types';\n\nconst useCJS = !module.createRequire;\nconst fileURLToPath = url.fileURLToPath || urlPolyfills.fileURLToPath;\nconst pathToFileURL = url.pathToFileURL || urlPolyfills.pathToFileURL;\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.join(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n if (useCJS) {\n const entryPath = resolveCJS.sync(specifier, {\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import module from 'module';\nimport path from 'path';\nimport url from 'url';\nimport isAbsolute from 'is-absolute';\nimport resolveCJS from 'resolve';\n// @ts-ignore\nimport { resolve as resolveESM } from '../../assets/import-meta-resolve.cjs';\nimport { moduleRegEx } from './constants';\nimport * as urlPolyfills from './lib/url-file-url';\nimport type { Context } from './types';\n\nconst useCJS = !module.createRequire;\nconst fileURLToPath = url.fileURLToPath || urlPolyfills.fileURLToPath;\nconst pathToFileURL = url.pathToFileURL || urlPolyfills.pathToFileURL;\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.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 = resolveESM(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","resolveESM","_","entryPath","resolveCJS","sync","basedir","extensions"],"mappings":";;;;+BAoBA;;;eAAwBA;;;6DApBL;2DACF;0DACD;iEACO;8DACA;oCAEe;yBACV;kEACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG9B,IAAMC,SAAS,CAACC,eAAM,CAACC,aAAa;AACpC,IAAMC,gBAAgBC,YAAG,CAACD,aAAa,IAAIE,YAAaF,aAAa;AACrE,IAAMG,gBAAgBF,YAAG,CAACE,aAAa,IAAID,YAAaC,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,sBAAW,CAACC,IAAI,CAACL,YAAY;QAC/B,IAAMN,cAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QACjE,IAAI,CAACd,QAAQ;YACX,IAAI;gBACF,IAAMqB,WAAWC,IAAAA,6BAAU,EAACP,WAAWT,cAAcG;gBACrD,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"}
|
package/dist/esm/toPath.mjs
CHANGED
|
@@ -23,21 +23,23 @@ export default function toPath(specifier, context) {
|
|
|
23
23
|
}
|
|
24
24
|
if (moduleRegEx.test(specifier)) {
|
|
25
25
|
const parentPath = context ? getParentPath(context) : process.cwd();
|
|
26
|
-
if (useCJS) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
'.node',
|
|
33
|
-
'.mjs'
|
|
34
|
-
]
|
|
35
|
-
});
|
|
36
|
-
if (entryPath) return entryPath;
|
|
37
|
-
} else {
|
|
38
|
-
const entryURL = resolveESM(specifier, pathToFileURL(parentPath));
|
|
39
|
-
if (entryURL) return fileURLToPath(entryURL);
|
|
26
|
+
if (!useCJS) {
|
|
27
|
+
try {
|
|
28
|
+
const entryURL = resolveESM(specifier, pathToFileURL(parentPath));
|
|
29
|
+
if (entryURL) return fileURLToPath(entryURL);
|
|
30
|
+
} catch (_) {
|
|
31
|
+
/* it may fail due to commonjs edge cases */ }
|
|
40
32
|
}
|
|
33
|
+
const entryPath = resolveCJS.sync(specifier, {
|
|
34
|
+
basedir: parentPath,
|
|
35
|
+
extensions: [
|
|
36
|
+
'.js',
|
|
37
|
+
'.json',
|
|
38
|
+
'.node',
|
|
39
|
+
'.mjs'
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
if (entryPath) return entryPath;
|
|
41
43
|
}
|
|
42
44
|
return specifier;
|
|
43
45
|
}
|
package/dist/esm/toPath.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import module from 'module';\nimport path from 'path';\nimport url from 'url';\nimport isAbsolute from 'is-absolute';\nimport resolveCJS from 'resolve';\n// @ts-ignore\nimport { resolve as resolveESM } from '../../assets/import-meta-resolve.cjs';\nimport { moduleRegEx } from './constants';\nimport * as urlPolyfills from './lib/url-file-url';\nimport type { Context } from './types';\n\nconst useCJS = !module.createRequire;\nconst fileURLToPath = url.fileURLToPath || urlPolyfills.fileURLToPath;\nconst pathToFileURL = url.pathToFileURL || urlPolyfills.pathToFileURL;\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.join(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n if (useCJS) {\n const entryPath = resolveCJS.sync(specifier, {\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import module from 'module';\nimport path from 'path';\nimport url from 'url';\nimport isAbsolute from 'is-absolute';\nimport resolveCJS from 'resolve';\n// @ts-ignore\nimport { resolve as resolveESM } from '../../assets/import-meta-resolve.cjs';\nimport { moduleRegEx } from './constants';\nimport * as urlPolyfills from './lib/url-file-url';\nimport type { Context } from './types';\n\nconst useCJS = !module.createRequire;\nconst fileURLToPath = url.fileURLToPath || urlPolyfills.fileURLToPath;\nconst pathToFileURL = url.pathToFileURL || urlPolyfills.pathToFileURL;\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.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 = resolveESM(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":["module","path","url","isAbsolute","resolveCJS","resolve","resolveESM","moduleRegEx","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,YAAY,SAAS;AAC5B,OAAOC,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,OAAOC,gBAAgB,cAAc;AACrC,OAAOC,gBAAgB,UAAU;AACjC,aAAa;AACb,SAASC,WAA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swc-transform",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.2",
|
|
4
4
|
"description": "Typescript transformers for swc. Supports Node >= 0.8",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"matcher",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"@swc/core": "*",
|
|
46
46
|
"core-js-pure": "^3.40.0",
|
|
47
47
|
"exit": "^0.1.2",
|
|
48
|
-
"fs-iterator": "^5.2.
|
|
48
|
+
"fs-iterator": "^5.2.11",
|
|
49
49
|
"get-tsconfig-compat": "^2.0.3",
|
|
50
50
|
"install-optional": "^0.1.0",
|
|
51
51
|
"is-absolute": "^1.0.0",
|
|
52
52
|
"minimatch": "^3.1.2",
|
|
53
53
|
"mkdirp-classic": "^0.5.3",
|
|
54
54
|
"path-posix": "^1.0.0",
|
|
55
|
-
"queue-cb": "^1.4.
|
|
55
|
+
"queue-cb": "^1.4.11",
|
|
56
56
|
"resolve": "^1.22.10",
|
|
57
57
|
"rimraf2": "^2.8.2",
|
|
58
58
|
"ts-node": "*",
|