ts-swc-transform 1.13.9 → 1.13.10
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/bindings/ensure.cjs +4 -4
- package/dist/cjs/bindings/ensure.cjs.map +1 -1
- package/dist/cjs/bindings/findDependency.cjs +2 -1
- package/dist/cjs/bindings/findDependency.cjs.map +1 -1
- package/dist/cjs/bindings/install.cjs +2 -3
- package/dist/cjs/bindings/install.cjs.map +1 -1
- package/dist/esm/bindings/ensure.cjs +4 -4
- package/dist/esm/bindings/ensure.cjs.map +1 -1
- package/dist/esm/bindings/findDependency.cjs +2 -1
- package/dist/esm/bindings/findDependency.cjs.map +1 -1
- package/dist/esm/bindings/install.cjs +2 -3
- package/dist/esm/bindings/install.cjs.map +1 -1
- package/dist/types/bindings/findDependency.d.cts +1 -1
- package/package.json +1 -1
|
@@ -19,8 +19,8 @@ module.exports = function ensureBindings(identifier, target, callback) {
|
|
|
19
19
|
if (bindings[identifier] === undefined) bindings[identifier] = {};
|
|
20
20
|
if (bindings[identifier][target] === undefined) {
|
|
21
21
|
bindings[identifier][target] = resolveOnce(function(cb) {
|
|
22
|
-
var _findDependency = findDependency(identifier, target), name = _findDependency.name,
|
|
23
|
-
return existsSync(path.join(
|
|
22
|
+
var _findDependency = findDependency(identifier, target), name = _findDependency.name, nodeModules = _findDependency.nodeModules;
|
|
23
|
+
return existsSync(path.join(nodeModules, name)) ? cb() : require(workerPath)(identifier, target, cb);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
bindings[identifier][target](callback);
|
|
@@ -30,8 +30,8 @@ module.exports.sync = function(identifier, target) {
|
|
|
30
30
|
if (bindingsSync[identifier] === undefined) bindingsSync[identifier] = {};
|
|
31
31
|
if (bindingsSync[identifier][target] === undefined) {
|
|
32
32
|
bindingsSync[identifier][target] = function() {
|
|
33
|
-
var _findDependency = findDependency(identifier, target), name = _findDependency.name,
|
|
34
|
-
return existsSync(path.join(
|
|
33
|
+
var _findDependency = findDependency(identifier, target), name = _findDependency.name, nodeModules = _findDependency.nodeModules;
|
|
34
|
+
return existsSync(path.join(nodeModules, name)) ? target : require('node-version-call')({
|
|
35
35
|
version: version,
|
|
36
36
|
callbacks: true
|
|
37
37
|
}, workerPath, identifier, target);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/ensure.cjs"],"sourcesContent":["const path = require('path');\nconst fs = require('fs');\nconst resolveOnce = require('resolve-once-cb');\nconst findDependency = require('./findDependency.cjs');\n\nconst workerPath = path.join(__dirname, 'install.cjs');\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\n\nconst existsSync = (test) => {\n try {\n (fs.accessSync || fs.statSync)(test);\n return true;\n } catch (_) {\n return false;\n }\n};\n\nconst bindings = {};\nmodule.exports = function ensureBindings(identifier, target, callback) {\n if (bindings[identifier] === undefined) bindings[identifier] = {};\n if (bindings[identifier][target] === undefined) {\n bindings[identifier][target] = resolveOnce((cb) => {\n const { name,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/ensure.cjs"],"sourcesContent":["const path = require('path');\nconst fs = require('fs');\nconst resolveOnce = require('resolve-once-cb');\nconst findDependency = require('./findDependency.cjs');\n\nconst workerPath = path.join(__dirname, 'install.cjs');\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\n\nconst existsSync = (test) => {\n try {\n (fs.accessSync || fs.statSync)(test);\n return true;\n } catch (_) {\n return false;\n }\n};\n\nconst bindings = {};\nmodule.exports = function ensureBindings(identifier, target, callback) {\n if (bindings[identifier] === undefined) bindings[identifier] = {};\n if (bindings[identifier][target] === undefined) {\n bindings[identifier][target] = resolveOnce((cb) => {\n const { name, nodeModules } = findDependency(identifier, target);\n return existsSync(path.join(nodeModules, name)) ? cb() : require(workerPath)(identifier, target, cb);\n });\n }\n bindings[identifier][target](callback);\n};\n\nconst bindingsSync = {};\nmodule.exports.sync = (identifier, target) => {\n if (bindingsSync[identifier] === undefined) bindingsSync[identifier] = {};\n if (bindingsSync[identifier][target] === undefined) {\n bindingsSync[identifier][target] = (() => {\n const { name, nodeModules } = findDependency(identifier, target);\n return existsSync(path.join(nodeModules, name)) ? target : require('node-version-call')({ version, callbacks: true }, workerPath, identifier, target);\n })();\n }\n};\n"],"names":["path","require","fs","resolveOnce","findDependency","workerPath","join","__dirname","major","process","versions","node","split","version","existsSync","test","accessSync","statSync","_","bindings","module","exports","ensureBindings","identifier","target","callback","undefined","cb","name","nodeModules","bindingsSync","sync","callbacks"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AACrB,IAAMC,KAAKD,QAAQ;AACnB,IAAME,cAAcF,QAAQ;AAC5B,IAAMG,iBAAiBH,QAAQ;AAE/B,IAAMI,aAAaL,KAAKM,IAAI,CAACC,WAAW;AACxC,IAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,UAAUL,QAAQ,KAAK,WAAW;AAExC,IAAMM,aAAa,SAACC;IAClB,IAAI;QACDb,CAAAA,GAAGc,UAAU,IAAId,GAAGe,QAAQ,AAAD,EAAGF;QAC/B,OAAO;IACT,EAAE,OAAOG,GAAG;QACV,OAAO;IACT;AACF;AAEA,IAAMC,WAAW,CAAC;AAClBC,OAAOC,OAAO,GAAG,SAASC,eAAeC,UAAU,EAAEC,MAAM,EAAEC,QAAQ;IACnE,IAAIN,QAAQ,CAACI,WAAW,KAAKG,WAAWP,QAAQ,CAACI,WAAW,GAAG,CAAC;IAChE,IAAIJ,QAAQ,CAACI,WAAW,CAACC,OAAO,KAAKE,WAAW;QAC9CP,QAAQ,CAACI,WAAW,CAACC,OAAO,GAAGrB,YAAY,SAACwB;YAC1C,IAA8BvB,kBAAAA,eAAemB,YAAYC,SAAjDI,OAAsBxB,gBAAtBwB,MAAMC,cAAgBzB,gBAAhByB;YACd,OAAOf,WAAWd,KAAKM,IAAI,CAACuB,aAAaD,SAASD,OAAO1B,QAAQI,YAAYkB,YAAYC,QAAQG;QACnG;IACF;IACAR,QAAQ,CAACI,WAAW,CAACC,OAAO,CAACC;AAC/B;AAEA,IAAMK,eAAe,CAAC;AACtBV,OAAOC,OAAO,CAACU,IAAI,GAAG,SAACR,YAAYC;IACjC,IAAIM,YAAY,CAACP,WAAW,KAAKG,WAAWI,YAAY,CAACP,WAAW,GAAG,CAAC;IACxE,IAAIO,YAAY,CAACP,WAAW,CAACC,OAAO,KAAKE,WAAW;QAClDI,YAAY,CAACP,WAAW,CAACC,OAAO,GAAG,AAAC;YAClC,IAA8BpB,kBAAAA,eAAemB,YAAYC,SAAjDI,OAAsBxB,gBAAtBwB,MAAMC,cAAgBzB,gBAAhByB;YACd,OAAOf,WAAWd,KAAKM,IAAI,CAACuB,aAAaD,SAASJ,SAASvB,QAAQ,qBAAqB;gBAAEY,SAAAA;gBAASmB,WAAW;YAAK,GAAG3B,YAAYkB,YAAYC;QAChJ;IACF;AACF"}
|
|
@@ -4,6 +4,7 @@ var fs = require('fs');
|
|
|
4
4
|
var resolve = require('resolve');
|
|
5
5
|
module.exports = function findDependency(identifier, target) {
|
|
6
6
|
var packagePath = resolve.sync("".concat(identifier, "/package.json"));
|
|
7
|
+
var nodeModules = identifier[0] === '@' ? path.join(packagePath, '..', '..', '..') : path.join(packagePath, '..', '..');
|
|
7
8
|
var optionalDependencies = JSON.parse(fs.readFileSync(packagePath, 'utf8')).optionalDependencies;
|
|
8
9
|
var name = Object.keys(optionalDependencies).find(function(name) {
|
|
9
10
|
return name.indexOf(target) >= 0;
|
|
@@ -11,7 +12,7 @@ module.exports = function findDependency(identifier, target) {
|
|
|
11
12
|
return name ? {
|
|
12
13
|
name: name,
|
|
13
14
|
version: optionalDependencies[name],
|
|
14
|
-
|
|
15
|
+
nodeModules: nodeModules
|
|
15
16
|
} : null;
|
|
16
17
|
};
|
|
17
18
|
/* 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/bindings/findDependency.cjs"],"sourcesContent":["const path = require('path');\nconst fs = require('fs');\nconst resolve = require('resolve');\n\nmodule.exports = function findDependency(identifier, target) {\n const packagePath = resolve.sync(`${identifier}/package.json`);\n const optionalDependencies = JSON.parse(fs.readFileSync(packagePath, 'utf8')).optionalDependencies;\n const name = Object.keys(optionalDependencies).find((name) => name.indexOf(target) >= 0);\n return name ? { name, version: optionalDependencies[name],
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/findDependency.cjs"],"sourcesContent":["const path = require('path');\nconst fs = require('fs');\nconst resolve = require('resolve');\n\nmodule.exports = function findDependency(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 return name ? { name, version: optionalDependencies[name], nodeModules } : null;\n};\n"],"names":["path","require","fs","resolve","module","exports","findDependency","identifier","target","packagePath","sync","nodeModules","join","optionalDependencies","JSON","parse","readFileSync","name","Object","keys","find","indexOf","version"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AACrB,IAAMC,KAAKD,QAAQ;AACnB,IAAME,UAAUF,QAAQ;AAExBG,OAAOC,OAAO,GAAG,SAASC,eAAeC,UAAU,EAAEC,MAAM;IACzD,IAAMC,cAAcN,QAAQO,IAAI,CAAC,AAAC,GAAa,OAAXH,YAAW;IAC/C,IAAMI,cAAcJ,UAAU,CAAC,EAAE,KAAK,MAAMP,KAAKY,IAAI,CAACH,aAAa,MAAM,MAAM,QAAQT,KAAKY,IAAI,CAACH,aAAa,MAAM;IACpH,IAAMI,uBAAuBC,KAAKC,KAAK,CAACb,GAAGc,YAAY,CAACP,aAAa,SAASI,oBAAoB;IAClG,IAAMI,OAAOC,OAAOC,IAAI,CAACN,sBAAsBO,IAAI,CAAC,SAACH;eAASA,KAAKI,OAAO,CAACb,WAAW;;IACtF,OAAOS,OAAO;QAAEA,MAAAA;QAAMK,SAAST,oBAAoB,CAACI,KAAK;QAAEN,aAAAA;IAAY,IAAI;AAC7E"}
|
|
@@ -3,11 +3,10 @@ var path = require('path');
|
|
|
3
3
|
var installModule = require('install-module-linked');
|
|
4
4
|
var findDependency = require('./findDependency.cjs');
|
|
5
5
|
module.exports = function installBindings(identifier, target, callback) {
|
|
6
|
-
var _findDependency = findDependency(identifier, target), name = _findDependency.name, version = _findDependency.version,
|
|
7
|
-
var nodeModules = path.join(modulePath, '..', 'node_modules');
|
|
6
|
+
var _findDependency = findDependency(identifier, target), name = _findDependency.name, version = _findDependency.version, nodeModules = _findDependency.nodeModules;
|
|
8
7
|
var installString = version ? "".concat(name, "@").concat(version) : name;
|
|
9
8
|
installModule(installString, nodeModules, function(err) {
|
|
10
|
-
console.log("installed ".concat(path.join(nodeModules, name)
|
|
9
|
+
console.log("installed ".concat(path.join(nodeModules, name)).concat(!err ? '' : ' with errors: ${err.message}'));
|
|
11
10
|
callback(err);
|
|
12
11
|
});
|
|
13
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/install.cjs"],"sourcesContent":["const path = require('path');\nconst installModule = require('install-module-linked');\nconst findDependency = require('./findDependency.cjs');\n\nmodule.exports = function installBindings(identifier, target, callback) {\n const { name, version,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/install.cjs"],"sourcesContent":["const path = require('path');\nconst installModule = require('install-module-linked');\nconst findDependency = require('./findDependency.cjs');\n\nmodule.exports = function installBindings(identifier, target, callback) {\n const { name, version, nodeModules } = findDependency(identifier, target);\n const installString = version ? `${name}@${version}` : name;\n\n installModule(installString, nodeModules, (err) => {\n console.log(`installed ${path.join(nodeModules, name)}${!err ? '' : ' with errors: ${err.message}'}`);\n callback(err);\n });\n};\n"],"names":["path","require","installModule","findDependency","module","exports","installBindings","identifier","target","callback","name","version","nodeModules","installString","err","console","log","join"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AACrB,IAAMC,gBAAgBD,QAAQ;AAC9B,IAAME,iBAAiBF,QAAQ;AAE/BG,OAAOC,OAAO,GAAG,SAASC,gBAAgBC,UAAU,EAAEC,MAAM,EAAEC,QAAQ;IACpE,IAAuCN,kBAAAA,eAAeI,YAAYC,SAA1DE,OAA+BP,gBAA/BO,MAAMC,UAAyBR,gBAAzBQ,SAASC,cAAgBT,gBAAhBS;IACvB,IAAMC,gBAAgBF,UAAU,AAAC,GAAUA,OAARD,MAAK,KAAW,OAARC,WAAYD;IAEvDR,cAAcW,eAAeD,aAAa,SAACE;QACzCC,QAAQC,GAAG,CAAC,AAAC,aAA2C,OAA/BhB,KAAKiB,IAAI,CAACL,aAAaF,OAAmD,OAA3C,CAACI,MAAM,KAAK;QACpEL,SAASK;IACX;AACF"}
|
|
@@ -18,8 +18,8 @@ module.exports = function ensureBindings(identifier, target, callback) {
|
|
|
18
18
|
if (bindings[identifier] === undefined) bindings[identifier] = {};
|
|
19
19
|
if (bindings[identifier][target] === undefined) {
|
|
20
20
|
bindings[identifier][target] = resolveOnce((cb)=>{
|
|
21
|
-
const { name,
|
|
22
|
-
return existsSync(path.join(
|
|
21
|
+
const { name, nodeModules } = findDependency(identifier, target);
|
|
22
|
+
return existsSync(path.join(nodeModules, name)) ? cb() : require(workerPath)(identifier, target, cb);
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
bindings[identifier][target](callback);
|
|
@@ -29,8 +29,8 @@ module.exports.sync = (identifier, target)=>{
|
|
|
29
29
|
if (bindingsSync[identifier] === undefined) bindingsSync[identifier] = {};
|
|
30
30
|
if (bindingsSync[identifier][target] === undefined) {
|
|
31
31
|
bindingsSync[identifier][target] = (()=>{
|
|
32
|
-
const { name,
|
|
33
|
-
return existsSync(path.join(
|
|
32
|
+
const { name, nodeModules } = findDependency(identifier, target);
|
|
33
|
+
return existsSync(path.join(nodeModules, name)) ? target : require('node-version-call')({
|
|
34
34
|
version,
|
|
35
35
|
callbacks: true
|
|
36
36
|
}, workerPath, identifier, target);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/ensure.cjs"],"sourcesContent":["const path = require('path');\nconst fs = require('fs');\nconst resolveOnce = require('resolve-once-cb');\nconst findDependency = require('./findDependency.cjs');\n\nconst workerPath = path.join(__dirname, 'install.cjs');\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\n\nconst existsSync = (test) => {\n try {\n (fs.accessSync || fs.statSync)(test);\n return true;\n } catch (_) {\n return false;\n }\n};\n\nconst bindings = {};\nmodule.exports = function ensureBindings(identifier, target, callback) {\n if (bindings[identifier] === undefined) bindings[identifier] = {};\n if (bindings[identifier][target] === undefined) {\n bindings[identifier][target] = resolveOnce((cb) => {\n const { name,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/ensure.cjs"],"sourcesContent":["const path = require('path');\nconst fs = require('fs');\nconst resolveOnce = require('resolve-once-cb');\nconst findDependency = require('./findDependency.cjs');\n\nconst workerPath = path.join(__dirname, 'install.cjs');\nconst major = +process.versions.node.split('.')[0];\nconst version = major < 14 ? 'stable' : 'local';\n\nconst existsSync = (test) => {\n try {\n (fs.accessSync || fs.statSync)(test);\n return true;\n } catch (_) {\n return false;\n }\n};\n\nconst bindings = {};\nmodule.exports = function ensureBindings(identifier, target, callback) {\n if (bindings[identifier] === undefined) bindings[identifier] = {};\n if (bindings[identifier][target] === undefined) {\n bindings[identifier][target] = resolveOnce((cb) => {\n const { name, nodeModules } = findDependency(identifier, target);\n return existsSync(path.join(nodeModules, name)) ? cb() : require(workerPath)(identifier, target, cb);\n });\n }\n bindings[identifier][target](callback);\n};\n\nconst bindingsSync = {};\nmodule.exports.sync = (identifier, target) => {\n if (bindingsSync[identifier] === undefined) bindingsSync[identifier] = {};\n if (bindingsSync[identifier][target] === undefined) {\n bindingsSync[identifier][target] = (() => {\n const { name, nodeModules } = findDependency(identifier, target);\n return existsSync(path.join(nodeModules, name)) ? target : require('node-version-call')({ version, callbacks: true }, workerPath, identifier, target);\n })();\n }\n};\n"],"names":["path","require","fs","resolveOnce","findDependency","workerPath","join","__dirname","major","process","versions","node","split","version","existsSync","test","accessSync","statSync","_","bindings","module","exports","ensureBindings","identifier","target","callback","undefined","cb","name","nodeModules","bindingsSync","sync","callbacks"],"mappings":"AAAA,MAAMA,OAAOC,QAAQ;AACrB,MAAMC,KAAKD,QAAQ;AACnB,MAAME,cAAcF,QAAQ;AAC5B,MAAMG,iBAAiBH,QAAQ;AAE/B,MAAMI,aAAaL,KAAKM,IAAI,CAACC,WAAW;AACxC,MAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,UAAUL,QAAQ,KAAK,WAAW;AAExC,MAAMM,aAAa,CAACC;IAClB,IAAI;QACDb,CAAAA,GAAGc,UAAU,IAAId,GAAGe,QAAQ,AAAD,EAAGF;QAC/B,OAAO;IACT,EAAE,OAAOG,GAAG;QACV,OAAO;IACT;AACF;AAEA,MAAMC,WAAW,CAAC;AAClBC,OAAOC,OAAO,GAAG,SAASC,eAAeC,UAAU,EAAEC,MAAM,EAAEC,QAAQ;IACnE,IAAIN,QAAQ,CAACI,WAAW,KAAKG,WAAWP,QAAQ,CAACI,WAAW,GAAG,CAAC;IAChE,IAAIJ,QAAQ,CAACI,WAAW,CAACC,OAAO,KAAKE,WAAW;QAC9CP,QAAQ,CAACI,WAAW,CAACC,OAAO,GAAGrB,YAAY,CAACwB;YAC1C,MAAM,EAAEC,IAAI,EAAEC,WAAW,EAAE,GAAGzB,eAAemB,YAAYC;YACzD,OAAOV,WAAWd,KAAKM,IAAI,CAACuB,aAAaD,SAASD,OAAO1B,QAAQI,YAAYkB,YAAYC,QAAQG;QACnG;IACF;IACAR,QAAQ,CAACI,WAAW,CAACC,OAAO,CAACC;AAC/B;AAEA,MAAMK,eAAe,CAAC;AACtBV,OAAOC,OAAO,CAACU,IAAI,GAAG,CAACR,YAAYC;IACjC,IAAIM,YAAY,CAACP,WAAW,KAAKG,WAAWI,YAAY,CAACP,WAAW,GAAG,CAAC;IACxE,IAAIO,YAAY,CAACP,WAAW,CAACC,OAAO,KAAKE,WAAW;QAClDI,YAAY,CAACP,WAAW,CAACC,OAAO,GAAG,AAAC,CAAA;YAClC,MAAM,EAAEI,IAAI,EAAEC,WAAW,EAAE,GAAGzB,eAAemB,YAAYC;YACzD,OAAOV,WAAWd,KAAKM,IAAI,CAACuB,aAAaD,SAASJ,SAASvB,QAAQ,qBAAqB;gBAAEY;gBAASmB,WAAW;YAAK,GAAG3B,YAAYkB,YAAYC;QAChJ,CAAA;IACF;AACF"}
|
|
@@ -3,11 +3,12 @@ const fs = require('fs');
|
|
|
3
3
|
const resolve = require('resolve');
|
|
4
4
|
module.exports = function findDependency(identifier, target) {
|
|
5
5
|
const packagePath = resolve.sync(`${identifier}/package.json`);
|
|
6
|
+
const nodeModules = identifier[0] === '@' ? path.join(packagePath, '..', '..', '..') : path.join(packagePath, '..', '..');
|
|
6
7
|
const optionalDependencies = JSON.parse(fs.readFileSync(packagePath, 'utf8')).optionalDependencies;
|
|
7
8
|
const name = Object.keys(optionalDependencies).find((name)=>name.indexOf(target) >= 0);
|
|
8
9
|
return name ? {
|
|
9
10
|
name,
|
|
10
11
|
version: optionalDependencies[name],
|
|
11
|
-
|
|
12
|
+
nodeModules
|
|
12
13
|
} : null;
|
|
13
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/findDependency.cjs"],"sourcesContent":["const path = require('path');\nconst fs = require('fs');\nconst resolve = require('resolve');\n\nmodule.exports = function findDependency(identifier, target) {\n const packagePath = resolve.sync(`${identifier}/package.json`);\n const optionalDependencies = JSON.parse(fs.readFileSync(packagePath, 'utf8')).optionalDependencies;\n const name = Object.keys(optionalDependencies).find((name) => name.indexOf(target) >= 0);\n return name ? { name, version: optionalDependencies[name],
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/findDependency.cjs"],"sourcesContent":["const path = require('path');\nconst fs = require('fs');\nconst resolve = require('resolve');\n\nmodule.exports = function findDependency(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 return name ? { name, version: optionalDependencies[name], nodeModules } : null;\n};\n"],"names":["path","require","fs","resolve","module","exports","findDependency","identifier","target","packagePath","sync","nodeModules","join","optionalDependencies","JSON","parse","readFileSync","name","Object","keys","find","indexOf","version"],"mappings":"AAAA,MAAMA,OAAOC,QAAQ;AACrB,MAAMC,KAAKD,QAAQ;AACnB,MAAME,UAAUF,QAAQ;AAExBG,OAAOC,OAAO,GAAG,SAASC,eAAeC,UAAU,EAAEC,MAAM;IACzD,MAAMC,cAAcN,QAAQO,IAAI,CAAC,GAAGH,WAAW,aAAa,CAAC;IAC7D,MAAMI,cAAcJ,UAAU,CAAC,EAAE,KAAK,MAAMP,KAAKY,IAAI,CAACH,aAAa,MAAM,MAAM,QAAQT,KAAKY,IAAI,CAACH,aAAa,MAAM;IACpH,MAAMI,uBAAuBC,KAAKC,KAAK,CAACb,GAAGc,YAAY,CAACP,aAAa,SAASI,oBAAoB;IAClG,MAAMI,OAAOC,OAAOC,IAAI,CAACN,sBAAsBO,IAAI,CAAC,CAACH,OAASA,KAAKI,OAAO,CAACb,WAAW;IACtF,OAAOS,OAAO;QAAEA;QAAMK,SAAST,oBAAoB,CAACI,KAAK;QAAEN;IAAY,IAAI;AAC7E"}
|
|
@@ -2,11 +2,10 @@ const path = require('path');
|
|
|
2
2
|
const installModule = require('install-module-linked');
|
|
3
3
|
const findDependency = require('./findDependency.cjs');
|
|
4
4
|
module.exports = function installBindings(identifier, target, callback) {
|
|
5
|
-
const { name, version,
|
|
6
|
-
const nodeModules = path.join(modulePath, '..', 'node_modules');
|
|
5
|
+
const { name, version, nodeModules } = findDependency(identifier, target);
|
|
7
6
|
const installString = version ? `${name}@${version}` : name;
|
|
8
7
|
installModule(installString, nodeModules, (err)=>{
|
|
9
|
-
console.log(`installed ${path.join(nodeModules, name)}
|
|
8
|
+
console.log(`installed ${path.join(nodeModules, name)}${!err ? '' : ' with errors: ${err.message}'}`);
|
|
10
9
|
callback(err);
|
|
11
10
|
});
|
|
12
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/install.cjs"],"sourcesContent":["const path = require('path');\nconst installModule = require('install-module-linked');\nconst findDependency = require('./findDependency.cjs');\n\nmodule.exports = function installBindings(identifier, target, callback) {\n const { name, version,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/bindings/install.cjs"],"sourcesContent":["const path = require('path');\nconst installModule = require('install-module-linked');\nconst findDependency = require('./findDependency.cjs');\n\nmodule.exports = function installBindings(identifier, target, callback) {\n const { name, version, nodeModules } = findDependency(identifier, target);\n const installString = version ? `${name}@${version}` : name;\n\n installModule(installString, nodeModules, (err) => {\n console.log(`installed ${path.join(nodeModules, name)}${!err ? '' : ' with errors: ${err.message}'}`);\n callback(err);\n });\n};\n"],"names":["path","require","installModule","findDependency","module","exports","installBindings","identifier","target","callback","name","version","nodeModules","installString","err","console","log","join"],"mappings":"AAAA,MAAMA,OAAOC,QAAQ;AACrB,MAAMC,gBAAgBD,QAAQ;AAC9B,MAAME,iBAAiBF,QAAQ;AAE/BG,OAAOC,OAAO,GAAG,SAASC,gBAAgBC,UAAU,EAAEC,MAAM,EAAEC,QAAQ;IACpE,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,WAAW,EAAE,GAAGT,eAAeI,YAAYC;IAClE,MAAMK,gBAAgBF,UAAU,GAAGD,KAAK,CAAC,EAAEC,SAAS,GAAGD;IAEvDR,cAAcW,eAAeD,aAAa,CAACE;QACzCC,QAAQC,GAAG,CAAC,CAAC,UAAU,EAAEhB,KAAKiB,IAAI,CAACL,aAAaF,QAAQ,CAACI,MAAM,KAAK,gCAAgC;QACpGL,SAASK;IACX;AACF"}
|