ts-swc-transform 1.13.13 → 1.15.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.
- package/assets/import-meta-resolve.cjs +1481 -0
- package/dist/cjs/createMatcher.cjs +1 -0
- package/dist/cjs/createMatcher.cjs.map +1 -1
- package/dist/cjs/lib/patchCJS.cjs +13 -6
- package/dist/cjs/lib/patchCJS.cjs.map +1 -1
- package/dist/cjs/lib/swcPrepareOptions.cjs +2 -2
- package/dist/cjs/lib/swcPrepareOptions.cjs.map +1 -1
- package/dist/cjs/lib/url-file-url.cjs +78 -0
- package/dist/cjs/lib/url-file-url.cjs.map +1 -0
- package/dist/cjs/toPath.cjs +63 -34
- package/dist/cjs/toPath.cjs.map +1 -1
- package/dist/esm/createMatcher.mjs +1 -0
- package/dist/esm/createMatcher.mjs.map +1 -1
- package/dist/esm/lib/patchCJS.mjs +2 -2
- package/dist/esm/lib/patchCJS.mjs.map +1 -1
- package/dist/esm/lib/swcPrepareOptions.mjs +2 -2
- package/dist/esm/lib/swcPrepareOptions.mjs.map +1 -1
- package/dist/esm/lib/url-file-url.mjs +54 -0
- package/dist/esm/lib/url-file-url.mjs.map +1 -0
- package/dist/esm/toPath.mjs +24 -35
- package/dist/esm/toPath.mjs.map +1 -1
- package/dist/types/lib/patchCJS.d.ts +1 -0
- package/dist/types/lib/url-file-url.d.ts +3 -0
- package/package.json +8 -9
- package/dist/cjs/lib/ensureBindingsSync.cjs +0 -43
- package/dist/cjs/lib/ensureBindingsSync.cjs.map +0 -1
- package/dist/cjs/lib/fileURLToPath.cjs +0 -23
- package/dist/cjs/lib/fileURLToPath.cjs.map +0 -1
- package/dist/esm/lib/ensureBindingsSync.mjs +0 -25
- package/dist/esm/lib/ensureBindingsSync.mjs.map +0 -1
- package/dist/esm/lib/fileURLToPath.mjs +0 -7
- package/dist/esm/lib/fileURLToPath.mjs.map +0 -1
- package/dist/types/lib/ensureBindingsSync.d.ts +0 -1
- package/dist/types/lib/fileURLToPath.d.ts +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-swc-transform",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "Typescript transformers for swc. Supports Node >= 0.8",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"matcher",
|
|
@@ -22,19 +22,17 @@
|
|
|
22
22
|
"author": "Kevin Malakoff <kmalakoff@gmail.com> (https://github.com/kmalakoff)",
|
|
23
23
|
"type": "module",
|
|
24
24
|
"exports": {
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"types": "./dist/types/index.d.ts"
|
|
29
|
-
},
|
|
30
|
-
"./*": "./*"
|
|
25
|
+
"import": "./dist/esm/index.mjs",
|
|
26
|
+
"require": "./dist/cjs/index.cjs",
|
|
27
|
+
"types": "./dist/types/index.d.ts"
|
|
31
28
|
},
|
|
32
29
|
"main": "dist/cjs/index.cjs",
|
|
33
30
|
"module": "dist/dist/esm/index.mjs",
|
|
34
31
|
"types": "dist/types/index.d.ts",
|
|
35
32
|
"files": [
|
|
36
33
|
"dist",
|
|
37
|
-
"scripts"
|
|
34
|
+
"scripts",
|
|
35
|
+
"assets"
|
|
38
36
|
],
|
|
39
37
|
"scripts": {
|
|
40
38
|
"build": "tsds build",
|
|
@@ -45,10 +43,11 @@
|
|
|
45
43
|
},
|
|
46
44
|
"dependencies": {
|
|
47
45
|
"@swc/core": "*",
|
|
46
|
+
"core-js-pure": "^3.40.0",
|
|
48
47
|
"exit": "^0.1.2",
|
|
49
48
|
"fs-iterator": "^5.2.10",
|
|
50
49
|
"get-tsconfig-compat": "^2.0.3",
|
|
51
|
-
"install-
|
|
50
|
+
"install-optional": "^0.1.0",
|
|
52
51
|
"is-absolute": "^1.0.0",
|
|
53
52
|
"minimatch": "^3.1.2",
|
|
54
53
|
"mkdirp-classic": "^0.5.3",
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return ensureBindingsSync;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
|
-
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
|
-
var _installmodulelinked = require("install-module-linked");
|
|
14
|
-
var _resolve = /*#__PURE__*/ _interop_require_default(require("resolve"));
|
|
15
|
-
function _interop_require_default(obj) {
|
|
16
|
-
return obj && obj.__esModule ? obj : {
|
|
17
|
-
default: obj
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
var existsSync = function(test) {
|
|
21
|
-
try {
|
|
22
|
-
(_fs.default.accessSync || _fs.default.statSync)(test);
|
|
23
|
-
return true;
|
|
24
|
-
} catch (_) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
var bindingsSync = {};
|
|
29
|
-
function ensureBindingsSync(identifier, target) {
|
|
30
|
-
if (bindingsSync[identifier] === undefined) bindingsSync[identifier] = {};
|
|
31
|
-
if (bindingsSync[identifier][target] === undefined) {
|
|
32
|
-
bindingsSync[identifier][target] = function() {
|
|
33
|
-
var packagePath = _resolve.default.sync("".concat(identifier, "/package.json"));
|
|
34
|
-
var nodeModules = identifier[0] === '@' ? _path.default.join(packagePath, '..', '..', '..') : _path.default.join(packagePath, '..', '..');
|
|
35
|
-
var optionalDependencies = JSON.parse(_fs.default.readFileSync(packagePath, 'utf8')).optionalDependencies;
|
|
36
|
-
var name = Object.keys(optionalDependencies).find(function(name) {
|
|
37
|
-
return name.indexOf(target) >= 0;
|
|
38
|
-
});
|
|
39
|
-
if (!existsSync(_path.default.join(nodeModules, name))) (0, _installmodulelinked.sync)("".concat(name, "@").concat(optionalDependencies[name]), nodeModules);
|
|
40
|
-
}();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/* 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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/ensureBindingsSync.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { sync as installModuleSync } from 'install-module-linked';\nimport resolve from 'resolve';\n\nconst existsSync = (test) => {\n try {\n (fs.accessSync || fs.statSync)(test);\n return true;\n } catch (_) {\n return false;\n }\n};\n\nconst bindingsSync = {};\nexport default function ensureBindingsSync(identifier, target) {\n if (bindingsSync[identifier] === undefined) bindingsSync[identifier] = {};\n if (bindingsSync[identifier][target] === undefined) {\n bindingsSync[identifier][target] = (() => {\n const packagePath = resolve.sync(`${identifier}/package.json`);\n const nodeModules = identifier[0] === '@' ? path.join(packagePath, '..', '..', '..') : path.join(packagePath, '..', '..');\n const optionalDependencies = JSON.parse(fs.readFileSync(packagePath, 'utf8')).optionalDependencies;\n const name = Object.keys(optionalDependencies).find((name) => name.indexOf(target) >= 0);\n if (!existsSync(path.join(nodeModules, name))) installModuleSync(`${name}@${optionalDependencies[name]}`, nodeModules);\n })();\n }\n}\n"],"names":["ensureBindingsSync","existsSync","test","fs","accessSync","statSync","_","bindingsSync","identifier","target","undefined","packagePath","resolve","sync","nodeModules","path","join","optionalDependencies","JSON","parse","readFileSync","name","Object","keys","find","indexOf","installModuleSync"],"mappings":";;;;+BAeA;;;eAAwBA;;;yDAfT;2DACE;mCACyB;8DACtB;;;;;;AAEpB,IAAMC,aAAa,SAACC;IAClB,IAAI;QACDC,CAAAA,WAAE,CAACC,UAAU,IAAID,WAAE,CAACE,QAAQ,AAAD,EAAGH;QAC/B,OAAO;IACT,EAAE,OAAOI,GAAG;QACV,OAAO;IACT;AACF;AAEA,IAAMC,eAAe,CAAC;AACP,SAASP,mBAAmBQ,UAAU,EAAEC,MAAM;IAC3D,IAAIF,YAAY,CAACC,WAAW,KAAKE,WAAWH,YAAY,CAACC,WAAW,GAAG,CAAC;IACxE,IAAID,YAAY,CAACC,WAAW,CAACC,OAAO,KAAKC,WAAW;QAClDH,YAAY,CAACC,WAAW,CAACC,OAAO,GAAG,AAAC;YAClC,IAAME,cAAcC,gBAAO,CAACC,IAAI,CAAC,AAAC,GAAa,OAAXL,YAAW;YAC/C,IAAMM,cAAcN,UAAU,CAAC,EAAE,KAAK,MAAMO,aAAI,CAACC,IAAI,CAACL,aAAa,MAAM,MAAM,QAAQI,aAAI,CAACC,IAAI,CAACL,aAAa,MAAM;YACpH,IAAMM,uBAAuBC,KAAKC,KAAK,CAAChB,WAAE,CAACiB,YAAY,CAACT,aAAa,SAASM,oBAAoB;YAClG,IAAMI,OAAOC,OAAOC,IAAI,CAACN,sBAAsBO,IAAI,CAAC,SAACH;uBAASA,KAAKI,OAAO,CAAChB,WAAW;;YACtF,IAAI,CAACR,WAAWc,aAAI,CAACC,IAAI,CAACF,aAAaO,QAAQK,IAAAA,yBAAiB,EAAC,AAAC,GAAUT,OAARI,MAAK,KAA8B,OAA3BJ,oBAAoB,CAACI,KAAK,GAAIP;QAC5G;IACF;AACF"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _default;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _url = /*#__PURE__*/ _interop_require_default(require("url"));
|
|
12
|
-
function _interop_require_default(obj) {
|
|
13
|
-
return obj && obj.__esModule ? obj : {
|
|
14
|
-
default: obj
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function fileURLToPathPolyfill(fileURL) {
|
|
18
|
-
var path = typeof fileURL === 'string' ? fileURL : fileURL.pathname;
|
|
19
|
-
if (!path.startsWith('file:')) throw new Error('The URL must use the file: protocol');
|
|
20
|
-
return decodeURIComponent(path.substring(7));
|
|
21
|
-
}
|
|
22
|
-
var _default = _url.default.fileURLToPath || fileURLToPathPolyfill;
|
|
23
|
-
/* 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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/fileURLToPath.ts"],"sourcesContent":["import url from 'url';\n\nfunction fileURLToPathPolyfill(fileURL) {\n const path = typeof fileURL === 'string' ? fileURL : fileURL.pathname;\n if (!path.startsWith('file:')) throw new Error('The URL must use the file: protocol');\n return decodeURIComponent(path.substring(7));\n}\n\nexport default url.fileURLToPath || fileURLToPathPolyfill;\n"],"names":["fileURLToPathPolyfill","fileURL","path","pathname","startsWith","Error","decodeURIComponent","substring","url","fileURLToPath"],"mappings":";;;;+BAQA;;;eAAA;;;0DARgB;;;;;;AAEhB,SAASA,sBAAsBC,OAAO;IACpC,IAAMC,OAAO,OAAOD,YAAY,WAAWA,UAAUA,QAAQE,QAAQ;IACrE,IAAI,CAACD,KAAKE,UAAU,CAAC,UAAU,MAAM,IAAIC,MAAM;IAC/C,OAAOC,mBAAmBJ,KAAKK,SAAS,CAAC;AAC3C;IAEA,WAAeC,YAAG,CAACC,aAAa,IAAIT"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { sync as installModuleSync } from 'install-module-linked';
|
|
4
|
-
import resolve from 'resolve';
|
|
5
|
-
const existsSync = (test)=>{
|
|
6
|
-
try {
|
|
7
|
-
(fs.accessSync || fs.statSync)(test);
|
|
8
|
-
return true;
|
|
9
|
-
} catch (_) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
const bindingsSync = {};
|
|
14
|
-
export default function ensureBindingsSync(identifier, target) {
|
|
15
|
-
if (bindingsSync[identifier] === undefined) bindingsSync[identifier] = {};
|
|
16
|
-
if (bindingsSync[identifier][target] === undefined) {
|
|
17
|
-
bindingsSync[identifier][target] = (()=>{
|
|
18
|
-
const packagePath = resolve.sync(`${identifier}/package.json`);
|
|
19
|
-
const nodeModules = identifier[0] === '@' ? path.join(packagePath, '..', '..', '..') : path.join(packagePath, '..', '..');
|
|
20
|
-
const optionalDependencies = JSON.parse(fs.readFileSync(packagePath, 'utf8')).optionalDependencies;
|
|
21
|
-
const name = Object.keys(optionalDependencies).find((name)=>name.indexOf(target) >= 0);
|
|
22
|
-
if (!existsSync(path.join(nodeModules, name))) installModuleSync(`${name}@${optionalDependencies[name]}`, nodeModules);
|
|
23
|
-
})();
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/ensureBindingsSync.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { sync as installModuleSync } from 'install-module-linked';\nimport resolve from 'resolve';\n\nconst existsSync = (test) => {\n try {\n (fs.accessSync || fs.statSync)(test);\n return true;\n } catch (_) {\n return false;\n }\n};\n\nconst bindingsSync = {};\nexport default function ensureBindingsSync(identifier, target) {\n if (bindingsSync[identifier] === undefined) bindingsSync[identifier] = {};\n if (bindingsSync[identifier][target] === undefined) {\n bindingsSync[identifier][target] = (() => {\n const packagePath = resolve.sync(`${identifier}/package.json`);\n const nodeModules = identifier[0] === '@' ? path.join(packagePath, '..', '..', '..') : path.join(packagePath, '..', '..');\n const optionalDependencies = JSON.parse(fs.readFileSync(packagePath, 'utf8')).optionalDependencies;\n const name = Object.keys(optionalDependencies).find((name) => name.indexOf(target) >= 0);\n if (!existsSync(path.join(nodeModules, name))) installModuleSync(`${name}@${optionalDependencies[name]}`, nodeModules);\n })();\n }\n}\n"],"names":["fs","path","sync","installModuleSync","resolve","existsSync","test","accessSync","statSync","_","bindingsSync","ensureBindingsSync","identifier","target","undefined","packagePath","nodeModules","join","optionalDependencies","JSON","parse","readFileSync","name","Object","keys","find","indexOf"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,SAASC,QAAQC,iBAAiB,QAAQ,wBAAwB;AAClE,OAAOC,aAAa,UAAU;AAE9B,MAAMC,aAAa,CAACC;IAClB,IAAI;QACDN,CAAAA,GAAGO,UAAU,IAAIP,GAAGQ,QAAQ,AAAD,EAAGF;QAC/B,OAAO;IACT,EAAE,OAAOG,GAAG;QACV,OAAO;IACT;AACF;AAEA,MAAMC,eAAe,CAAC;AACtB,eAAe,SAASC,mBAAmBC,UAAU,EAAEC,MAAM;IAC3D,IAAIH,YAAY,CAACE,WAAW,KAAKE,WAAWJ,YAAY,CAACE,WAAW,GAAG,CAAC;IACxE,IAAIF,YAAY,CAACE,WAAW,CAACC,OAAO,KAAKC,WAAW;QAClDJ,YAAY,CAACE,WAAW,CAACC,OAAO,GAAG,AAAC,CAAA;YAClC,MAAME,cAAcX,QAAQF,IAAI,CAAC,GAAGU,WAAW,aAAa,CAAC;YAC7D,MAAMI,cAAcJ,UAAU,CAAC,EAAE,KAAK,MAAMX,KAAKgB,IAAI,CAACF,aAAa,MAAM,MAAM,QAAQd,KAAKgB,IAAI,CAACF,aAAa,MAAM;YACpH,MAAMG,uBAAuBC,KAAKC,KAAK,CAACpB,GAAGqB,YAAY,CAACN,aAAa,SAASG,oBAAoB;YAClG,MAAMI,OAAOC,OAAOC,IAAI,CAACN,sBAAsBO,IAAI,CAAC,CAACH,OAASA,KAAKI,OAAO,CAACb,WAAW;YACtF,IAAI,CAACR,WAAWJ,KAAKgB,IAAI,CAACD,aAAaM,QAAQnB,kBAAkB,GAAGmB,KAAK,CAAC,EAAEJ,oBAAoB,CAACI,KAAK,EAAE,EAAEN;QAC5G,CAAA;IACF;AACF"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import url from 'url';
|
|
2
|
-
function fileURLToPathPolyfill(fileURL) {
|
|
3
|
-
const path = typeof fileURL === 'string' ? fileURL : fileURL.pathname;
|
|
4
|
-
if (!path.startsWith('file:')) throw new Error('The URL must use the file: protocol');
|
|
5
|
-
return decodeURIComponent(path.substring(7));
|
|
6
|
-
}
|
|
7
|
-
export default url.fileURLToPath || fileURLToPathPolyfill;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/fileURLToPath.ts"],"sourcesContent":["import url from 'url';\n\nfunction fileURLToPathPolyfill(fileURL) {\n const path = typeof fileURL === 'string' ? fileURL : fileURL.pathname;\n if (!path.startsWith('file:')) throw new Error('The URL must use the file: protocol');\n return decodeURIComponent(path.substring(7));\n}\n\nexport default url.fileURLToPath || fileURLToPathPolyfill;\n"],"names":["url","fileURLToPathPolyfill","fileURL","path","pathname","startsWith","Error","decodeURIComponent","substring","fileURLToPath"],"mappings":"AAAA,OAAOA,SAAS,MAAM;AAEtB,SAASC,sBAAsBC,OAAO;IACpC,MAAMC,OAAO,OAAOD,YAAY,WAAWA,UAAUA,QAAQE,QAAQ;IACrE,IAAI,CAACD,KAAKE,UAAU,CAAC,UAAU,MAAM,IAAIC,MAAM;IAC/C,OAAOC,mBAAmBJ,KAAKK,SAAS,CAAC;AAC3C;AAEA,eAAeR,IAAIS,aAAa,IAAIR,sBAAsB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function ensureBindingsSync(identifier: any, target: any): void;
|