node-version-install 0.1.2 → 0.2.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/dist/cjs/{createPaths.js → createPaths.cjs} +1 -2
- package/dist/cjs/createPaths.cjs.map +1 -0
- package/dist/cjs/{index.js → index.cjs} +8 -22
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/workers/{install.js → install.cjs} +7 -7
- package/dist/cjs/workers/install.cjs.map +1 -0
- package/dist/esm/createPaths.mjs +1 -2
- package/dist/esm/createPaths.mjs.map +1 -1
- package/dist/esm/index.mjs +6 -9
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/types.mjs.map +1 -1
- package/dist/esm/workers/install.mjs +5 -5
- package/dist/esm/workers/install.mjs.map +1 -1
- package/dist/types/createPaths.d.ts +2 -2
- package/dist/types/index.d.ts +4 -4
- package/dist/types/types.d.ts +3 -3
- package/dist/types/workers/install.d.ts +2 -2
- package/package.json +6 -5
- package/dist/cjs/createPaths.js.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/workers/install.js.map +0 -1
- package/dist/esm/package.json +0 -1
- /package/dist/cjs/{constants.js → constants.cjs} +0 -0
- /package/dist/cjs/{constants.js.map → constants.cjs.map} +0 -0
- /package/dist/cjs/{types.js → types.cjs} +0 -0
- /package/dist/cjs/{types.js.map → types.cjs.map} +0 -0
|
@@ -17,8 +17,7 @@ function _interop_require_default(obj) {
|
|
|
17
17
|
function createPaths(installPath) {
|
|
18
18
|
return {
|
|
19
19
|
cachePath: _path.default.join(installPath, 'cache'),
|
|
20
|
-
buildPath: _path.default.join(installPath, 'build')
|
|
21
|
-
installPath: _path.default.join(installPath, 'installed')
|
|
20
|
+
buildPath: _path.default.join(installPath, 'build')
|
|
22
21
|
};
|
|
23
22
|
}
|
|
24
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; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/createPaths.ts"],"sourcesContent":["import path from 'path';\n\nimport type { CacheLocations } from './types';\n\nexport default function createPaths(installPath: string): CacheLocations {\n return {\n cachePath: path.join(installPath, 'cache'),\n buildPath: path.join(installPath, 'build'),\n };\n}\n"],"names":["createPaths","installPath","cachePath","path","join","buildPath"],"mappings":";;;;+BAIA;;;eAAwBA;;;2DAJP;;;;;;AAIF,SAASA,YAAYC,WAAmB;IACrD,OAAO;QACLC,WAAWC,aAAI,CAACC,IAAI,CAACH,aAAa;QAClCI,WAAWF,aAAI,CAACC,IAAI,CAACH,aAAa;IACpC;AACF"}
|
|
@@ -19,38 +19,24 @@ _export(exports, {
|
|
|
19
19
|
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
20
20
|
var _url = /*#__PURE__*/ _interop_require_default(require("url"));
|
|
21
21
|
var _modulerootsync = /*#__PURE__*/ _interop_require_default(require("module-root-sync"));
|
|
22
|
-
var _install = /*#__PURE__*/ _interop_require_default(require("./workers/install.
|
|
23
|
-
_export_star(require("./types.js"), exports);
|
|
22
|
+
var _install = /*#__PURE__*/ _interop_require_default(require("./workers/install.cjs"));
|
|
24
23
|
var _module = /*#__PURE__*/ _interop_require_default(require("module"));
|
|
25
24
|
var _lazycache = /*#__PURE__*/ _interop_require_default(require("lazy-cache"));
|
|
26
|
-
function _export_star(from, to) {
|
|
27
|
-
Object.keys(from).forEach(function(k) {
|
|
28
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
29
|
-
Object.defineProperty(to, k, {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function() {
|
|
32
|
-
return from[k];
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
return from;
|
|
38
|
-
}
|
|
39
25
|
function _interop_require_default(obj) {
|
|
40
26
|
return obj && obj.__esModule ? obj : {
|
|
41
27
|
default: obj
|
|
42
28
|
};
|
|
43
29
|
}
|
|
44
|
-
function install(versionExpression, options, callback) {
|
|
30
|
+
function install(versionExpression, rootInstallPath, options, callback) {
|
|
45
31
|
if (typeof options === 'function') {
|
|
46
32
|
callback = options;
|
|
47
33
|
options = {};
|
|
48
34
|
}
|
|
49
35
|
options = options || {};
|
|
50
|
-
if (typeof callback === 'function') return (0, _install.default)(versionExpression, options, callback);
|
|
36
|
+
if (typeof callback === 'function') return (0, _install.default)(versionExpression, rootInstallPath, options, callback);
|
|
51
37
|
return new Promise(function(resolve, reject) {
|
|
52
|
-
return (0, _install.default)(versionExpression, options, function(err, result) {
|
|
53
|
-
err ? reject(err) : resolve(result);
|
|
38
|
+
return (0, _install.default)(versionExpression, rootInstallPath, options, function(err, result) {
|
|
39
|
+
return err ? reject(err) : resolve(result);
|
|
54
40
|
});
|
|
55
41
|
});
|
|
56
42
|
}
|
|
@@ -59,13 +45,13 @@ var execFunction = (0, _lazycache.default)(_require)('function-exec-sync');
|
|
|
59
45
|
var SLEEP_MS = 200;
|
|
60
46
|
var __dirname = _path.default.dirname(typeof __filename === 'undefined' ? _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()) : __filename);
|
|
61
47
|
var root = (0, _modulerootsync.default)(__dirname);
|
|
62
|
-
var workerPath = _path.default.join(root, 'dist', 'cjs', 'workers', 'install.
|
|
63
|
-
function sync(versionExpression, options) {
|
|
48
|
+
var workerPath = _path.default.join(root, 'dist', 'cjs', 'workers', 'install.cjs');
|
|
49
|
+
function sync(versionExpression, rootInstallPath, options) {
|
|
64
50
|
options = options || {};
|
|
65
51
|
return execFunction().default({
|
|
66
52
|
cwd: process.cwd(),
|
|
67
53
|
sleep: SLEEP_MS,
|
|
68
54
|
callbacks: true
|
|
69
|
-
}, workerPath, versionExpression, options);
|
|
55
|
+
}, workerPath, versionExpression, rootInstallPath, options);
|
|
70
56
|
}
|
|
71
57
|
/* 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":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/index.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport moduleRoot from 'module-root-sync';\nimport worker from './workers/install';\n\nimport type { InstallCallback, InstallOptions, InstallResult } from './types';\n\nexport type * from './types';\nexport default function install(versionExpression: string, rootInstallPath: string, options?: InstallOptions, callback?: InstallCallback): undefined | Promise<InstallResult[]> {\n if (typeof options === 'function') {\n callback = options as InstallCallback;\n options = {};\n }\n options = options || {};\n\n if (typeof callback === 'function') return worker(versionExpression, rootInstallPath, options, callback) as undefined;\n return new Promise((resolve, reject) => worker(versionExpression, rootInstallPath, options, (err, result) => (err ? reject(err) : resolve(result))));\n}\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst execFunction = lazy(_require)('function-exec-sync');\n\nconst SLEEP_MS = 200;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst root = moduleRoot(__dirname);\nconst workerPath = path.join(root, 'dist', 'cjs', 'workers', 'install.cjs');\n\nexport function sync(versionExpression: string, rootInstallPath: string, options?: InstallOptions): InstallResult[] {\n options = options || {};\n return execFunction().default({ cwd: process.cwd(), sleep: SLEEP_MS, callbacks: true }, workerPath, versionExpression, rootInstallPath, options);\n}\n"],"names":["install","sync","versionExpression","rootInstallPath","options","callback","worker","Promise","resolve","reject","err","result","_require","require","Module","createRequire","execFunction","lazy","SLEEP_MS","__dirname","path","dirname","__filename","url","fileURLToPath","root","moduleRoot","workerPath","join","default","cwd","process","sleep","callbacks"],"mappings":";;;;;;;;;;;IAQA,OASC;eATuBA;;IAqBRC,IAAI;eAAJA;;;2DA7BC;0DACD;qEACO;8DACJ;6DAgBA;gEACF;;;;;;AAZF,SAASD,QAAQE,iBAAyB,EAAEC,eAAuB,EAAEC,OAAwB,EAAEC,QAA0B;IACtI,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IAEtB,IAAI,OAAOC,aAAa,YAAY,OAAOC,IAAAA,gBAAM,EAACJ,mBAAmBC,iBAAiBC,SAASC;IAC/F,OAAO,IAAIE,QAAQ,SAACC,SAASC;eAAWH,IAAAA,gBAAM,EAACJ,mBAAmBC,iBAAiBC,SAAS,SAACM,KAAKC;mBAAYD,MAAMD,OAAOC,OAAOF,QAAQG;;;AAC5I;AAIA,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,eAAeC,IAAAA,kBAAI,EAACL,UAAU;AAEpC,IAAMM,WAAW;AACjB,IAAMC,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,OAAOC,IAAAA,uBAAU,EAACP;AACxB,IAAMQ,aAAaP,aAAI,CAACQ,IAAI,CAACH,MAAM,QAAQ,OAAO,WAAW;AAEtD,SAASxB,KAAKC,iBAAyB,EAAEC,eAAuB,EAAEC,OAAwB;IAC/FA,UAAUA,WAAW,CAAC;IACtB,OAAOY,eAAea,OAAO,CAAC;QAAEC,KAAKC,QAAQD,GAAG;QAAIE,OAAOd;QAAUe,WAAW;IAAK,GAAGN,YAAYzB,mBAAmBC,iBAAiBC;AAC1I"}
|
|
@@ -11,9 +11,9 @@ 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 _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
|
|
14
|
-
var _constants = require("../constants.
|
|
14
|
+
var _constants = require("../constants.cjs");
|
|
15
15
|
var _homedirpolyfill = /*#__PURE__*/ _interop_require_default(require("homedir-polyfill"));
|
|
16
|
-
var _createPaths = /*#__PURE__*/ _interop_require_default(require("../createPaths.
|
|
16
|
+
var _createPaths = /*#__PURE__*/ _interop_require_default(require("../createPaths.cjs"));
|
|
17
17
|
var _module = /*#__PURE__*/ _interop_require_default(require("module"));
|
|
18
18
|
var _lazycache = /*#__PURE__*/ _interop_require_default(require("lazy-cache"));
|
|
19
19
|
function _define_property(obj, key, value) {
|
|
@@ -54,8 +54,8 @@ var DEFAULT_INSTALL_PATHS = (0, _createPaths.default)(DEFAULT_ROOT_PATH);
|
|
|
54
54
|
var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
|
|
55
55
|
var resolveVersions = (0, _lazycache.default)(_require)('node-resolve-versions');
|
|
56
56
|
var installRelease = (0, _lazycache.default)(_require)('node-install-release');
|
|
57
|
-
function installWorker(versionExpression, options, callback) {
|
|
58
|
-
var _ref = options.
|
|
57
|
+
function installWorker(versionExpression, rootInstallPath, options, callback) {
|
|
58
|
+
var _ref = options.cachePath ? (0, _createPaths.default)(options.cachePath) : DEFAULT_INSTALL_PATHS, buildPath = _ref.buildPath, cachePath = _ref.cachePath;
|
|
59
59
|
resolveVersions()(versionExpression, _object_spread({}, options), function(err, versions) {
|
|
60
60
|
if (err) return callback(err);
|
|
61
61
|
if (!versions.length) return callback(new Error("No versions found from expression: ".concat(versionExpression)));
|
|
@@ -63,12 +63,12 @@ function installWorker(versionExpression, options, callback) {
|
|
|
63
63
|
var queue = new _queuecb.default(options.concurrency || 1);
|
|
64
64
|
versions.forEach(function(version) {
|
|
65
65
|
queue.defer(function(cb) {
|
|
66
|
-
var done = function done(
|
|
67
|
-
if (err) return cb(err);
|
|
66
|
+
var done = function done(error) {
|
|
68
67
|
results.push({
|
|
69
68
|
version: version,
|
|
70
69
|
installPath: installPath,
|
|
71
|
-
execPath: execPath
|
|
70
|
+
execPath: execPath,
|
|
71
|
+
error: error
|
|
72
72
|
});
|
|
73
73
|
cb();
|
|
74
74
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/workers/install.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport { NODE, isWindows } from '../constants';\n\nimport home from 'homedir-polyfill';\nimport createPaths from '../createPaths';\nconst DEFAULT_ROOT_PATH = path.join(home(), '.nvu');\nconst DEFAULT_INSTALL_PATHS = createPaths(DEFAULT_ROOT_PATH);\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst resolveVersions = lazy(_require)('node-resolve-versions');\nconst installRelease = lazy(_require)('node-install-release');\n\nimport type { InstallOptions, InstallResult } from '../types';\n\nexport default function installWorker(versionExpression: string, rootInstallPath, options: InstallOptions, callback) {\n const { buildPath, cachePath } = options.cachePath ? createPaths(options.cachePath) : DEFAULT_INSTALL_PATHS;\n\n resolveVersions()(versionExpression, { ...options }, (err, versions) => {\n if (err) return callback(err);\n if (!versions.length) return callback(new Error(`No versions found from expression: ${versionExpression}`));\n\n const results: InstallResult[] = [];\n const queue = new Queue(options.concurrency || 1);\n versions.forEach((version) => {\n queue.defer((cb) => {\n const installPath = path.join(rootInstallPath, version);\n const binRoot = isWindows ? installPath : path.join(installPath, 'bin');\n const execPath = path.join(binRoot, NODE);\n\n function done(error?) {\n results.push({ version, installPath, execPath, error });\n cb();\n }\n\n fs.stat(execPath, (_, stat) => {\n // TODO remove redundant options\n stat ? done() : installRelease()(version, installPath, { cachePath, buildPath }, done);\n });\n });\n });\n queue.await((err) => (err ? callback(err) : callback(null, results)));\n });\n}\n"],"names":["installWorker","DEFAULT_ROOT_PATH","path","join","home","DEFAULT_INSTALL_PATHS","createPaths","_require","require","Module","createRequire","resolveVersions","lazy","installRelease","versionExpression","rootInstallPath","options","callback","cachePath","buildPath","err","versions","length","Error","results","queue","Queue","concurrency","forEach","version","defer","cb","done","error","push","installPath","execPath","binRoot","isWindows","NODE","fs","stat","_","await"],"mappings":";;;;+BAkBA;;;eAAwBA;;;yDAlBT;2DACE;8DACC;yBACc;sEAEf;kEACO;6DAIL;gEACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAJjB,IAAMC,oBAAoBC,aAAI,CAACC,IAAI,CAACC,IAAAA,wBAAI,KAAI;AAC5C,IAAMC,wBAAwBC,IAAAA,oBAAW,EAACL;AAI1C,IAAMM,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,kBAAkBC,IAAAA,kBAAI,EAACL,UAAU;AACvC,IAAMM,iBAAiBD,IAAAA,kBAAI,EAACL,UAAU;AAIvB,SAASP,cAAcc,iBAAyB,EAAEC,eAAe,EAAEC,OAAuB,EAAEC,QAAQ;IACjH,IAAiCD,OAAAA,QAAQE,SAAS,GAAGZ,IAAAA,oBAAW,EAACU,QAAQE,SAAS,IAAIb,uBAA9Ec,YAAyBH,KAAzBG,WAAWD,YAAcF,KAAdE;IAEnBP,kBAAkBG,mBAAmB,mBAAKE,UAAW,SAACI,KAAKC;QACzD,IAAID,KAAK,OAAOH,SAASG;QACzB,IAAI,CAACC,SAASC,MAAM,EAAE,OAAOL,SAAS,IAAIM,MAAM,AAAC,sCAAuD,OAAlBT;QAEtF,IAAMU,UAA2B,EAAE;QACnC,IAAMC,QAAQ,IAAIC,gBAAK,CAACV,QAAQW,WAAW,IAAI;QAC/CN,SAASO,OAAO,CAAC,SAACC;YAChBJ,MAAMK,KAAK,CAAC,SAACC;oBAKFC,OAAT,SAASA,KAAKC,KAAM;oBAClBT,QAAQU,IAAI,CAAC;wBAAEL,SAAAA;wBAASM,aAAAA;wBAAaC,UAAAA;wBAAUH,OAAAA;oBAAM;oBACrDF;gBACF;gBAPA,IAAMI,cAAcjC,aAAI,CAACC,IAAI,CAACY,iBAAiBc;gBAC/C,IAAMQ,UAAUC,oBAAS,GAAGH,cAAcjC,aAAI,CAACC,IAAI,CAACgC,aAAa;gBACjE,IAAMC,WAAWlC,aAAI,CAACC,IAAI,CAACkC,SAASE,eAAI;gBAOxCC,WAAE,CAACC,IAAI,CAACL,UAAU,SAACM,GAAGD;oBACpB,gCAAgC;oBAChCA,OAAOT,SAASnB,iBAAiBgB,SAASM,aAAa;wBAAEjB,WAAAA;wBAAWC,WAAAA;oBAAU,GAAGa;gBACnF;YACF;QACF;QACAP,MAAMkB,KAAK,CAAC,SAACvB;mBAASA,MAAMH,SAASG,OAAOH,SAAS,MAAMO;;IAC7D;AACF"}
|
package/dist/esm/createPaths.mjs
CHANGED
|
@@ -2,7 +2,6 @@ import path from 'path';
|
|
|
2
2
|
export default function createPaths(installPath) {
|
|
3
3
|
return {
|
|
4
4
|
cachePath: path.join(installPath, 'cache'),
|
|
5
|
-
buildPath: path.join(installPath, 'build')
|
|
6
|
-
installPath: path.join(installPath, 'installed')
|
|
5
|
+
buildPath: path.join(installPath, 'build')
|
|
7
6
|
};
|
|
8
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/createPaths.ts"],"sourcesContent":["import path from 'path';\n\nimport type {
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/createPaths.ts"],"sourcesContent":["import path from 'path';\n\nimport type { CacheLocations } from './types';\n\nexport default function createPaths(installPath: string): CacheLocations {\n return {\n cachePath: path.join(installPath, 'cache'),\n buildPath: path.join(installPath, 'build'),\n };\n}\n"],"names":["path","createPaths","installPath","cachePath","join","buildPath"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AAIxB,eAAe,SAASC,YAAYC,WAAmB;IACrD,OAAO;QACLC,WAAWH,KAAKI,IAAI,CAACF,aAAa;QAClCG,WAAWL,KAAKI,IAAI,CAACF,aAAa;IACpC;AACF"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -2,17 +2,14 @@ import path from 'path';
|
|
|
2
2
|
import url from 'url';
|
|
3
3
|
import moduleRoot from 'module-root-sync';
|
|
4
4
|
import worker from './workers/install.mjs';
|
|
5
|
-
export
|
|
6
|
-
export default function install(versionExpression, options, callback) {
|
|
5
|
+
export default function install(versionExpression, rootInstallPath, options, callback) {
|
|
7
6
|
if (typeof options === 'function') {
|
|
8
7
|
callback = options;
|
|
9
8
|
options = {};
|
|
10
9
|
}
|
|
11
10
|
options = options || {};
|
|
12
|
-
if (typeof callback === 'function') return worker(versionExpression, options, callback);
|
|
13
|
-
return new Promise((resolve, reject)=>worker(versionExpression, options, (err, result)=>
|
|
14
|
-
err ? reject(err) : resolve(result);
|
|
15
|
-
}));
|
|
11
|
+
if (typeof callback === 'function') return worker(versionExpression, rootInstallPath, options, callback);
|
|
12
|
+
return new Promise((resolve, reject)=>worker(versionExpression, rootInstallPath, options, (err, result)=>err ? reject(err) : resolve(result)));
|
|
16
13
|
}
|
|
17
14
|
import Module from 'module';
|
|
18
15
|
import lazy from 'lazy-cache';
|
|
@@ -21,12 +18,12 @@ const execFunction = lazy(_require)('function-exec-sync');
|
|
|
21
18
|
const SLEEP_MS = 200;
|
|
22
19
|
const __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);
|
|
23
20
|
const root = moduleRoot(__dirname);
|
|
24
|
-
const workerPath = path.join(root, 'dist', 'cjs', 'workers', 'install.
|
|
25
|
-
export function sync(versionExpression, options) {
|
|
21
|
+
const workerPath = path.join(root, 'dist', 'cjs', 'workers', 'install.cjs');
|
|
22
|
+
export function sync(versionExpression, rootInstallPath, options) {
|
|
26
23
|
options = options || {};
|
|
27
24
|
return execFunction().default({
|
|
28
25
|
cwd: process.cwd(),
|
|
29
26
|
sleep: SLEEP_MS,
|
|
30
27
|
callbacks: true
|
|
31
|
-
}, workerPath, versionExpression, options);
|
|
28
|
+
}, workerPath, versionExpression, rootInstallPath, options);
|
|
32
29
|
}
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/index.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport moduleRoot from 'module-root-sync';\nimport worker from './workers/install
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/index.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport moduleRoot from 'module-root-sync';\nimport worker from './workers/install';\n\nimport type { InstallCallback, InstallOptions, InstallResult } from './types';\n\nexport type * from './types';\nexport default function install(versionExpression: string, rootInstallPath: string, options?: InstallOptions, callback?: InstallCallback): undefined | Promise<InstallResult[]> {\n if (typeof options === 'function') {\n callback = options as InstallCallback;\n options = {};\n }\n options = options || {};\n\n if (typeof callback === 'function') return worker(versionExpression, rootInstallPath, options, callback) as undefined;\n return new Promise((resolve, reject) => worker(versionExpression, rootInstallPath, options, (err, result) => (err ? reject(err) : resolve(result))));\n}\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst execFunction = lazy(_require)('function-exec-sync');\n\nconst SLEEP_MS = 200;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst root = moduleRoot(__dirname);\nconst workerPath = path.join(root, 'dist', 'cjs', 'workers', 'install.cjs');\n\nexport function sync(versionExpression: string, rootInstallPath: string, options?: InstallOptions): InstallResult[] {\n options = options || {};\n return execFunction().default({ cwd: process.cwd(), sleep: SLEEP_MS, callbacks: true }, workerPath, versionExpression, rootInstallPath, options);\n}\n"],"names":["path","url","moduleRoot","worker","install","versionExpression","rootInstallPath","options","callback","Promise","resolve","reject","err","result","Module","lazy","_require","require","createRequire","execFunction","SLEEP_MS","__dirname","dirname","__filename","fileURLToPath","root","workerPath","join","sync","default","cwd","process","sleep","callbacks"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,OAAOC,gBAAgB,mBAAmB;AAC1C,OAAOC,YAAY,oBAAoB;AAKvC,eAAe,SAASC,QAAQC,iBAAyB,EAAEC,eAAuB,EAAEC,OAAwB,EAAEC,QAA0B;IACtI,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IAEtB,IAAI,OAAOC,aAAa,YAAY,OAAOL,OAAOE,mBAAmBC,iBAAiBC,SAASC;IAC/F,OAAO,IAAIC,QAAQ,CAACC,SAASC,SAAWR,OAAOE,mBAAmBC,iBAAiBC,SAAS,CAACK,KAAKC,SAAYD,MAAMD,OAAOC,OAAOF,QAAQG;AAC5I;AAEA,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,aAAa;AAC9B,MAAMC,WAAW,OAAOC,YAAY,cAAcH,OAAOI,aAAa,CAAC,YAAYjB,GAAG,IAAIgB;AAC1F,MAAME,eAAeJ,KAAKC,UAAU;AAEpC,MAAMI,WAAW;AACjB,MAAMC,YAAYrB,KAAKsB,OAAO,CAAC,OAAOC,eAAe,cAActB,IAAIuB,aAAa,CAAC,YAAYvB,GAAG,IAAIsB;AACxG,MAAME,OAAOvB,WAAWmB;AACxB,MAAMK,aAAa1B,KAAK2B,IAAI,CAACF,MAAM,QAAQ,OAAO,WAAW;AAE7D,OAAO,SAASG,KAAKvB,iBAAyB,EAAEC,eAAuB,EAAEC,OAAwB;IAC/FA,UAAUA,WAAW,CAAC;IACtB,OAAOY,eAAeU,OAAO,CAAC;QAAEC,KAAKC,QAAQD,GAAG;QAAIE,OAAOZ;QAAUa,WAAW;IAAK,GAAGP,YAAYrB,mBAAmBC,iBAAiBC;AAC1I"}
|
package/dist/esm/types.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/types.ts"],"sourcesContent":["export type
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/types.ts"],"sourcesContent":["export type CacheLocations = {\n cachePath: string;\n buildPath: string;\n};\n\nexport type InstallResult = {\n version: string;\n installPath: string;\n execPath: string;\n error?: Error;\n};\n\nexport interface InstallOptions {\n cachePath?: string;\n concurrency?: number;\n}\n\nexport type InstallCallback = (err?: Error, results?: InstallResult[]) => void;\n"],"names":[],"mappings":"AAiBA,WAA+E"}
|
|
@@ -11,8 +11,8 @@ import lazy from 'lazy-cache';
|
|
|
11
11
|
const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
|
|
12
12
|
const resolveVersions = lazy(_require)('node-resolve-versions');
|
|
13
13
|
const installRelease = lazy(_require)('node-install-release');
|
|
14
|
-
export default function installWorker(versionExpression, options, callback) {
|
|
15
|
-
const { buildPath, cachePath
|
|
14
|
+
export default function installWorker(versionExpression, rootInstallPath, options, callback) {
|
|
15
|
+
const { buildPath, cachePath } = options.cachePath ? createPaths(options.cachePath) : DEFAULT_INSTALL_PATHS;
|
|
16
16
|
resolveVersions()(versionExpression, {
|
|
17
17
|
...options
|
|
18
18
|
}, (err, versions)=>{
|
|
@@ -25,12 +25,12 @@ export default function installWorker(versionExpression, options, callback) {
|
|
|
25
25
|
const installPath = path.join(rootInstallPath, version);
|
|
26
26
|
const binRoot = isWindows ? installPath : path.join(installPath, 'bin');
|
|
27
27
|
const execPath = path.join(binRoot, NODE);
|
|
28
|
-
function done(
|
|
29
|
-
if (err) return cb(err);
|
|
28
|
+
function done(error) {
|
|
30
29
|
results.push({
|
|
31
30
|
version,
|
|
32
31
|
installPath,
|
|
33
|
-
execPath
|
|
32
|
+
execPath,
|
|
33
|
+
error
|
|
34
34
|
});
|
|
35
35
|
cb();
|
|
36
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/workers/install.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport { NODE, isWindows } from '../constants
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/workers/install.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport { NODE, isWindows } from '../constants';\n\nimport home from 'homedir-polyfill';\nimport createPaths from '../createPaths';\nconst DEFAULT_ROOT_PATH = path.join(home(), '.nvu');\nconst DEFAULT_INSTALL_PATHS = createPaths(DEFAULT_ROOT_PATH);\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst resolveVersions = lazy(_require)('node-resolve-versions');\nconst installRelease = lazy(_require)('node-install-release');\n\nimport type { InstallOptions, InstallResult } from '../types';\n\nexport default function installWorker(versionExpression: string, rootInstallPath, options: InstallOptions, callback) {\n const { buildPath, cachePath } = options.cachePath ? createPaths(options.cachePath) : DEFAULT_INSTALL_PATHS;\n\n resolveVersions()(versionExpression, { ...options }, (err, versions) => {\n if (err) return callback(err);\n if (!versions.length) return callback(new Error(`No versions found from expression: ${versionExpression}`));\n\n const results: InstallResult[] = [];\n const queue = new Queue(options.concurrency || 1);\n versions.forEach((version) => {\n queue.defer((cb) => {\n const installPath = path.join(rootInstallPath, version);\n const binRoot = isWindows ? installPath : path.join(installPath, 'bin');\n const execPath = path.join(binRoot, NODE);\n\n function done(error?) {\n results.push({ version, installPath, execPath, error });\n cb();\n }\n\n fs.stat(execPath, (_, stat) => {\n // TODO remove redundant options\n stat ? done() : installRelease()(version, installPath, { cachePath, buildPath }, done);\n });\n });\n });\n queue.await((err) => (err ? callback(err) : callback(null, results)));\n });\n}\n"],"names":["fs","path","Queue","NODE","isWindows","home","createPaths","DEFAULT_ROOT_PATH","join","DEFAULT_INSTALL_PATHS","Module","lazy","_require","require","createRequire","url","resolveVersions","installRelease","installWorker","versionExpression","rootInstallPath","options","callback","buildPath","cachePath","err","versions","length","Error","results","queue","concurrency","forEach","version","defer","cb","installPath","binRoot","execPath","done","error","push","stat","_","await"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAC7B,SAASC,IAAI,EAAEC,SAAS,QAAQ,eAAe;AAE/C,OAAOC,UAAU,mBAAmB;AACpC,OAAOC,iBAAiB,iBAAiB;AACzC,MAAMC,oBAAoBN,KAAKO,IAAI,CAACH,QAAQ;AAC5C,MAAMI,wBAAwBH,YAAYC;AAE1C,OAAOG,YAAY,SAAS;AAC5B,OAAOC,UAAU,aAAa;AAC9B,MAAMC,WAAW,OAAOC,YAAY,cAAcH,OAAOI,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAC1F,MAAMG,kBAAkBL,KAAKC,UAAU;AACvC,MAAMK,iBAAiBN,KAAKC,UAAU;AAItC,eAAe,SAASM,cAAcC,iBAAyB,EAAEC,eAAe,EAAEC,OAAuB,EAAEC,QAAQ;IACjH,MAAM,EAAEC,SAAS,EAAEC,SAAS,EAAE,GAAGH,QAAQG,SAAS,GAAGlB,YAAYe,QAAQG,SAAS,IAAIf;IAEtFO,kBAAkBG,mBAAmB;QAAE,GAAGE,OAAO;IAAC,GAAG,CAACI,KAAKC;QACzD,IAAID,KAAK,OAAOH,SAASG;QACzB,IAAI,CAACC,SAASC,MAAM,EAAE,OAAOL,SAAS,IAAIM,MAAM,CAAC,mCAAmC,EAAET,mBAAmB;QAEzG,MAAMU,UAA2B,EAAE;QACnC,MAAMC,QAAQ,IAAI5B,MAAMmB,QAAQU,WAAW,IAAI;QAC/CL,SAASM,OAAO,CAAC,CAACC;YAChBH,MAAMI,KAAK,CAAC,CAACC;gBACX,MAAMC,cAAcnC,KAAKO,IAAI,CAACY,iBAAiBa;gBAC/C,MAAMI,UAAUjC,YAAYgC,cAAcnC,KAAKO,IAAI,CAAC4B,aAAa;gBACjE,MAAME,WAAWrC,KAAKO,IAAI,CAAC6B,SAASlC;gBAEpC,SAASoC,KAAKC,KAAM;oBAClBX,QAAQY,IAAI,CAAC;wBAAER;wBAASG;wBAAaE;wBAAUE;oBAAM;oBACrDL;gBACF;gBAEAnC,GAAG0C,IAAI,CAACJ,UAAU,CAACK,GAAGD;oBACpB,gCAAgC;oBAChCA,OAAOH,SAAStB,iBAAiBgB,SAASG,aAAa;wBAAEZ;wBAAWD;oBAAU,GAAGgB;gBACnF;YACF;QACF;QACAT,MAAMc,KAAK,CAAC,CAACnB,MAASA,MAAMH,SAASG,OAAOH,SAAS,MAAMO;IAC7D;AACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export default function createPaths(installPath: string):
|
|
1
|
+
import type { CacheLocations } from './types';
|
|
2
|
+
export default function createPaths(installPath: string): CacheLocations;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InstallCallback, InstallOptions, InstallResult } from './types
|
|
2
|
-
export * from './types
|
|
3
|
-
export default function install(versionExpression: string, options?: InstallOptions, callback?: InstallCallback): undefined | Promise<InstallResult[]>;
|
|
4
|
-
export declare function sync(versionExpression: string, options?: InstallOptions): InstallResult[];
|
|
1
|
+
import type { InstallCallback, InstallOptions, InstallResult } from './types';
|
|
2
|
+
export type * from './types';
|
|
3
|
+
export default function install(versionExpression: string, rootInstallPath: string, options?: InstallOptions, callback?: InstallCallback): undefined | Promise<InstallResult[]>;
|
|
4
|
+
export declare function sync(versionExpression: string, rootInstallPath: string, options?: InstallOptions): InstallResult[];
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type CacheLocations = {
|
|
2
2
|
cachePath: string;
|
|
3
3
|
buildPath: string;
|
|
4
|
-
installPath: string;
|
|
5
4
|
};
|
|
6
5
|
export type InstallResult = {
|
|
7
6
|
version: string;
|
|
8
7
|
installPath: string;
|
|
9
8
|
execPath: string;
|
|
9
|
+
error?: Error;
|
|
10
10
|
};
|
|
11
11
|
export interface InstallOptions {
|
|
12
|
-
|
|
12
|
+
cachePath?: string;
|
|
13
13
|
concurrency?: number;
|
|
14
14
|
}
|
|
15
15
|
export type InstallCallback = (err?: Error, results?: InstallResult[]) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { InstallOptions } from '../types
|
|
2
|
-
export default function installWorker(versionExpression: string, options: InstallOptions, callback: any): void;
|
|
1
|
+
import type { InstallOptions } from '../types';
|
|
2
|
+
export default function installWorker(versionExpression: string, rootInstallPath: any, options: InstallOptions, callback: any): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-version-install",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Install NodeJs by version string asynchronously or synchronously",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
29
|
"import": "./dist/esm/index.mjs",
|
|
30
|
-
"require": "./dist/cjs/index.
|
|
30
|
+
"require": "./dist/cjs/index.cjs",
|
|
31
31
|
"types": "./dist/types/index.d.ts"
|
|
32
32
|
},
|
|
33
33
|
"./*": "./*"
|
|
34
34
|
},
|
|
35
|
-
"main": "dist/cjs/index.
|
|
35
|
+
"main": "dist/cjs/index.cjs",
|
|
36
36
|
"module": "dist/dist/esm/index.mjs",
|
|
37
37
|
"types": "dist/types/index.d.ts",
|
|
38
38
|
"files": [
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"homedir-polyfill": "^1.0.3",
|
|
52
52
|
"lazy-cache": "^2.0.2",
|
|
53
53
|
"module-root-sync": "^0.1.1",
|
|
54
|
-
"node-install-release": "^1.
|
|
54
|
+
"node-install-release": "^1.7.0",
|
|
55
55
|
"node-resolve-versions": "^1.0.5",
|
|
56
56
|
"queue-cb": "^1.4.4"
|
|
57
57
|
},
|
|
@@ -60,9 +60,10 @@
|
|
|
60
60
|
"@types/mocha": "^10.0.10",
|
|
61
61
|
"@types/node": "^22.10.2",
|
|
62
62
|
"cr": "^0.1.0",
|
|
63
|
+
"cross-spawn-cb": "^2.0.0",
|
|
63
64
|
"fs-exists-sync": "^0.1.0",
|
|
64
65
|
"is-version": "^0.2.1",
|
|
65
|
-
"node-version-utils": "^1.1
|
|
66
|
+
"node-version-utils": "^1.2.1",
|
|
66
67
|
"pinkie-promise": "^2.0.1",
|
|
67
68
|
"rimraf2": "^2.8.2"
|
|
68
69
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/createPaths.ts"],"sourcesContent":["import path from 'path';\n\nimport type { InstallPaths } from './types.js';\n\nexport default function createPaths(installPath: string): InstallPaths {\n return {\n cachePath: path.join(installPath, 'cache'),\n buildPath: path.join(installPath, 'build'),\n installPath: path.join(installPath, 'installed'),\n };\n}\n"],"names":["createPaths","installPath","cachePath","path","join","buildPath"],"mappings":";;;;+BAIA;;;eAAwBA;;;2DAJP;;;;;;AAIF,SAASA,YAAYC,WAAmB;IACrD,OAAO;QACLC,WAAWC,aAAI,CAACC,IAAI,CAACH,aAAa;QAClCI,WAAWF,aAAI,CAACC,IAAI,CAACH,aAAa;QAClCA,aAAaE,aAAI,CAACC,IAAI,CAACH,aAAa;IACtC;AACF"}
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/index.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport moduleRoot from 'module-root-sync';\nimport worker from './workers/install.js';\n\nimport type { InstallCallback, InstallOptions, InstallResult } from './types.js';\n\nexport * from './types.js';\nexport default function install(versionExpression: string, options?: InstallOptions, callback?: InstallCallback): undefined | Promise<InstallResult[]> {\n if (typeof options === 'function') {\n callback = options as InstallCallback;\n options = {};\n }\n options = options || {};\n\n if (typeof callback === 'function') return worker(versionExpression, options, callback) as undefined;\n return new Promise((resolve, reject) =>\n worker(versionExpression, options, (err, result) => {\n err ? reject(err) : resolve(result);\n })\n );\n}\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst execFunction = lazy(_require)('function-exec-sync');\n\nconst SLEEP_MS = 200;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst root = moduleRoot(__dirname);\nconst workerPath = path.join(root, 'dist', 'cjs', 'workers', 'install.js');\n\nexport function sync(versionExpression: string, options?: InstallOptions): InstallResult[] {\n options = options || {};\n return execFunction().default({ cwd: process.cwd(), sleep: SLEEP_MS, callbacks: true }, workerPath, versionExpression, options);\n}\n"],"names":["install","sync","versionExpression","options","callback","worker","Promise","resolve","reject","err","result","_require","require","Module","createRequire","execFunction","lazy","SLEEP_MS","__dirname","path","dirname","__filename","url","fileURLToPath","root","moduleRoot","workerPath","join","default","cwd","process","sleep","callbacks"],"mappings":";;;;;;;;;;;IAQA,OAaC;eAbuBA;;IAyBRC,IAAI;eAAJA;;;2DAjCC;0DACD;qEACO;8DACJ;qBAIL;6DAgBK;gEACF;;;;;;;;;;;;;;;;;;;AAhBF,SAASD,QAAQE,iBAAyB,EAAEC,OAAwB,EAAEC,QAA0B;IAC7G,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IAEtB,IAAI,OAAOC,aAAa,YAAY,OAAOC,IAAAA,gBAAM,EAACH,mBAAmBC,SAASC;IAC9E,OAAO,IAAIE,QAAQ,SAACC,SAASC;eAC3BH,IAAAA,gBAAM,EAACH,mBAAmBC,SAAS,SAACM,KAAKC;YACvCD,MAAMD,OAAOC,OAAOF,QAAQG;QAC9B;;AAEJ;AAIA,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,eAAeC,IAAAA,kBAAI,EAACL,UAAU;AAEpC,IAAMM,WAAW;AACjB,IAAMC,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,OAAOC,IAAAA,uBAAU,EAACP;AACxB,IAAMQ,aAAaP,aAAI,CAACQ,IAAI,CAACH,MAAM,QAAQ,OAAO,WAAW;AAEtD,SAASvB,KAAKC,iBAAyB,EAAEC,OAAwB;IACtEA,UAAUA,WAAW,CAAC;IACtB,OAAOY,eAAea,OAAO,CAAC;QAAEC,KAAKC,QAAQD,GAAG;QAAIE,OAAOd;QAAUe,WAAW;IAAK,GAAGN,YAAYxB,mBAAmBC;AACzH"}
|
package/dist/cjs/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/workers/install.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport { NODE, isWindows } from '../constants.js';\n\nimport home from 'homedir-polyfill';\nimport createPaths from '../createPaths.js';\nconst DEFAULT_ROOT_PATH = path.join(home(), '.nvu');\nconst DEFAULT_INSTALL_PATHS = createPaths(DEFAULT_ROOT_PATH);\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst resolveVersions = lazy(_require)('node-resolve-versions');\nconst installRelease = lazy(_require)('node-install-release');\n\nimport type { InstallOptions, InstallResult } from '../types.js';\n\nexport default function installWorker(versionExpression: string, options: InstallOptions, callback) {\n const { buildPath, cachePath, installPath: rootInstallPath } = options.installPath ? createPaths(options.installPath) : DEFAULT_INSTALL_PATHS;\n\n resolveVersions()(versionExpression, { ...options }, (err, versions) => {\n if (err) return callback(err);\n if (!versions.length) return callback(new Error(`No versions found from expression: ${versionExpression}`));\n\n const results: InstallResult[] = [];\n const queue = new Queue(options.concurrency || 1);\n versions.forEach((version) => {\n queue.defer((cb) => {\n const installPath = path.join(rootInstallPath, version);\n const binRoot = isWindows ? installPath : path.join(installPath, 'bin');\n const execPath = path.join(binRoot, NODE);\n\n function done(err?) {\n if (err) return cb(err);\n results.push({ version, installPath, execPath });\n cb();\n }\n\n fs.stat(execPath, (_, stat) => {\n // TODO remove redundant options\n stat ? done() : installRelease()(version, installPath, { cachePath, buildPath }, done);\n });\n });\n });\n queue.await((err) => (err ? callback(err) : callback(null, results)));\n });\n}\n"],"names":["installWorker","DEFAULT_ROOT_PATH","path","join","home","DEFAULT_INSTALL_PATHS","createPaths","_require","require","Module","createRequire","resolveVersions","lazy","installRelease","versionExpression","options","callback","installPath","buildPath","cachePath","rootInstallPath","err","versions","length","Error","results","queue","Queue","concurrency","forEach","version","defer","cb","done","push","execPath","binRoot","isWindows","NODE","fs","stat","_","await"],"mappings":";;;;+BAkBA;;;eAAwBA;;;yDAlBT;2DACE;8DACC;yBACc;sEAEf;kEACO;6DAIL;gEACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAJjB,IAAMC,oBAAoBC,aAAI,CAACC,IAAI,CAACC,IAAAA,wBAAI,KAAI;AAC5C,IAAMC,wBAAwBC,IAAAA,oBAAW,EAACL;AAI1C,IAAMM,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,kBAAkBC,IAAAA,kBAAI,EAACL,UAAU;AACvC,IAAMM,iBAAiBD,IAAAA,kBAAI,EAACL,UAAU;AAIvB,SAASP,cAAcc,iBAAyB,EAAEC,OAAuB,EAAEC,QAAQ;IAChG,IAA+DD,OAAAA,QAAQE,WAAW,GAAGX,IAAAA,oBAAW,EAACS,QAAQE,WAAW,IAAIZ,uBAAhHa,YAAuDH,KAAvDG,WAAWC,YAA4CJ,KAA5CI,WAAWF,AAAaG,kBAAoBL,KAAjCE;IAE9BN,kBAAkBG,mBAAmB,mBAAKC,UAAW,SAACM,KAAKC;QACzD,IAAID,KAAK,OAAOL,SAASK;QACzB,IAAI,CAACC,SAASC,MAAM,EAAE,OAAOP,SAAS,IAAIQ,MAAM,AAAC,sCAAuD,OAAlBV;QAEtF,IAAMW,UAA2B,EAAE;QACnC,IAAMC,QAAQ,IAAIC,gBAAK,CAACZ,QAAQa,WAAW,IAAI;QAC/CN,SAASO,OAAO,CAAC,SAACC;YAChBJ,MAAMK,KAAK,CAAC,SAACC;oBAKFC,OAAT,SAASA,KAAKZ,GAAI;oBAChB,IAAIA,KAAK,OAAOW,GAAGX;oBACnBI,QAAQS,IAAI,CAAC;wBAAEJ,SAAAA;wBAASb,aAAAA;wBAAakB,UAAAA;oBAAS;oBAC9CH;gBACF;gBARA,IAAMf,cAAcf,aAAI,CAACC,IAAI,CAACiB,iBAAiBU;gBAC/C,IAAMM,UAAUC,oBAAS,GAAGpB,cAAcf,aAAI,CAACC,IAAI,CAACc,aAAa;gBACjE,IAAMkB,WAAWjC,aAAI,CAACC,IAAI,CAACiC,SAASE,eAAI;gBAQxCC,WAAE,CAACC,IAAI,CAACL,UAAU,SAACM,GAAGD;oBACpB,gCAAgC;oBAChCA,OAAOP,SAASpB,iBAAiBiB,SAASb,aAAa;wBAAEE,WAAAA;wBAAWD,WAAAA;oBAAU,GAAGe;gBACnF;YACF;QACF;QACAP,MAAMgB,KAAK,CAAC,SAACrB;mBAASA,MAAML,SAASK,OAAOL,SAAS,MAAMS;;IAC7D;AACF"}
|
package/dist/esm/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|