node-version-install 0.2.0 → 0.2.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.
@@ -27,15 +27,15 @@ function _interop_require_default(obj) {
27
27
  default: obj
28
28
  };
29
29
  }
30
- function install(versionExpression, rootInstallPath, options, callback) {
30
+ function install(versionExpression, options, callback) {
31
31
  if (typeof options === 'function') {
32
32
  callback = options;
33
33
  options = {};
34
34
  }
35
35
  options = options || {};
36
- if (typeof callback === 'function') return (0, _install.default)(versionExpression, rootInstallPath, options, callback);
36
+ if (typeof callback === 'function') return (0, _install.default)(versionExpression, options, callback);
37
37
  return new Promise(function(resolve, reject) {
38
- return (0, _install.default)(versionExpression, rootInstallPath, options, function(err, result) {
38
+ return (0, _install.default)(versionExpression, options, function(err, result) {
39
39
  return err ? reject(err) : resolve(result);
40
40
  });
41
41
  });
@@ -46,12 +46,12 @@ var SLEEP_MS = 200;
46
46
  var __dirname = _path.default.dirname(typeof __filename === 'undefined' ? _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()) : __filename);
47
47
  var root = (0, _modulerootsync.default)(__dirname);
48
48
  var workerPath = _path.default.join(root, 'dist', 'cjs', 'workers', 'install.cjs');
49
- function sync(versionExpression, rootInstallPath, options) {
49
+ function sync(versionExpression, options) {
50
50
  options = options || {};
51
51
  return execFunction().default({
52
52
  cwd: process.cwd(),
53
53
  sleep: SLEEP_MS,
54
54
  callbacks: true
55
- }, workerPath, versionExpression, rootInstallPath, options);
55
+ }, workerPath, versionExpression, options);
56
56
  }
57
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; }
@@ -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';\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"}
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, 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) => worker(versionExpression, 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, 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,OASC;eATuBA;;IAqBRC,IAAI;eAAJA;;;2DA7BC;0DACD;qEACO;8DACJ;6DAgBA;gEACF;;;;;;AAZF,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;eAAWH,IAAAA,gBAAM,EAACH,mBAAmBC,SAAS,SAACM,KAAKC;mBAAYD,MAAMD,OAAOC,OAAOF,QAAQG;;;AAC3H;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"}
@@ -11,9 +11,8 @@ 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.cjs");
15
14
  var _homedirpolyfill = /*#__PURE__*/ _interop_require_default(require("homedir-polyfill"));
16
- var _createPaths = /*#__PURE__*/ _interop_require_default(require("../createPaths.cjs"));
15
+ var _nodeinstallrelease = require("node-install-release");
17
16
  var _module = /*#__PURE__*/ _interop_require_default(require("module"));
18
17
  var _lazycache = /*#__PURE__*/ _interop_require_default(require("lazy-cache"));
19
18
  function _define_property(obj, key, value) {
@@ -49,14 +48,40 @@ function _object_spread(target) {
49
48
  }
50
49
  return target;
51
50
  }
52
- var DEFAULT_ROOT_PATH = _path.default.join((0, _homedirpolyfill.default)(), '.nvu');
53
- var DEFAULT_INSTALL_PATHS = (0, _createPaths.default)(DEFAULT_ROOT_PATH);
51
+ function ownKeys(object, enumerableOnly) {
52
+ var keys = Object.keys(object);
53
+ if (Object.getOwnPropertySymbols) {
54
+ var symbols = Object.getOwnPropertySymbols(object);
55
+ if (enumerableOnly) {
56
+ symbols = symbols.filter(function(sym) {
57
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
58
+ });
59
+ }
60
+ keys.push.apply(keys, symbols);
61
+ }
62
+ return keys;
63
+ }
64
+ function _object_spread_props(target, source) {
65
+ source = source != null ? source : {};
66
+ if (Object.getOwnPropertyDescriptors) {
67
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
68
+ } else {
69
+ ownKeys(Object(source)).forEach(function(key) {
70
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
71
+ });
72
+ }
73
+ return target;
74
+ }
75
+ var DEFAULT_STORAGE_PATH = _path.default.join((0, _homedirpolyfill.default)(), '.nvu');
54
76
  var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
55
77
  var resolveVersions = (0, _lazycache.default)(_require)('node-resolve-versions');
56
78
  var installRelease = (0, _lazycache.default)(_require)('node-install-release');
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
- resolveVersions()(versionExpression, _object_spread({}, options), function(err, versions) {
79
+ function installWorker(versionExpression, options, callback) {
80
+ var storagePath = options.storagePath || DEFAULT_STORAGE_PATH;
81
+ options = _object_spread({
82
+ storagePath: storagePath
83
+ }, options);
84
+ resolveVersions()(versionExpression, options, function(err, versions) {
60
85
  if (err) return callback(err);
61
86
  if (!versions.length) return callback(new Error("No versions found from expression: ".concat(versionExpression)));
62
87
  var results = [];
@@ -64,23 +89,17 @@ function installWorker(versionExpression, rootInstallPath, options, callback) {
64
89
  versions.forEach(function(version) {
65
90
  queue.defer(function(cb) {
66
91
  var done = function done(error) {
67
- results.push({
68
- version: version,
69
- installPath: installPath,
70
- execPath: execPath,
92
+ results.push(_object_spread_props(_object_spread({}, result), {
71
93
  error: error
72
- });
94
+ }));
73
95
  cb();
74
96
  };
75
- var installPath = _path.default.join(rootInstallPath, version);
76
- var binRoot = _constants.isWindows ? installPath : _path.default.join(installPath, 'bin');
77
- var execPath = _path.default.join(binRoot, _constants.NODE);
78
- _fs.default.stat(execPath, function(_, stat) {
79
- // TODO remove redundant options
80
- stat ? done() : installRelease()(version, installPath, {
81
- cachePath: cachePath,
82
- buildPath: buildPath
83
- }, done);
97
+ var versionOptions = _object_spread({
98
+ name: version
99
+ }, options);
100
+ var result = (0, _nodeinstallrelease.createResult)(versionOptions, version);
101
+ _fs.default.stat(result.execPath, function(_, stat) {
102
+ return stat ? done() : installRelease()(version, versionOptions, done);
84
103
  });
85
104
  });
86
105
  });
@@ -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';\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"}
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';\n\nimport home from 'homedir-polyfill';\nimport { createResult } from 'node-install-release';\nconst DEFAULT_STORAGE_PATH = path.join(home(), '.nvu');\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, options: InstallOptions, callback) {\n const storagePath = options.storagePath || DEFAULT_STORAGE_PATH;\n options = { storagePath, ...options };\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 versionOptions = { name: version, ...options };\n const result = createResult(versionOptions, version);\n\n function done(error?) {\n results.push({ ...result, error });\n cb();\n }\n fs.stat(result.execPath, (_, stat) => (stat ? done() : installRelease()(version, versionOptions, done)));\n });\n });\n queue.await((err) => (err ? callback(err) : callback(null, results)));\n });\n}\n"],"names":["installWorker","DEFAULT_STORAGE_PATH","path","join","home","_require","require","Module","createRequire","resolveVersions","lazy","installRelease","versionExpression","options","callback","storagePath","err","versions","length","Error","results","queue","Queue","concurrency","forEach","version","defer","cb","done","error","push","result","versionOptions","name","createResult","fs","stat","execPath","_","await"],"mappings":";;;;+BAgBA;;;eAAwBA;;;yDAhBT;2DACE;8DACC;sEAED;kCACY;6DAGV;gEACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAHjB,IAAMC,uBAAuBC,aAAI,CAACC,IAAI,CAACC,IAAAA,wBAAI,KAAI;AAI/C,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,kBAAkBC,IAAAA,kBAAI,EAACL,UAAU;AACvC,IAAMM,iBAAiBD,IAAAA,kBAAI,EAACL,UAAU;AAIvB,SAASL,cAAcY,iBAAyB,EAAEC,OAAuB,EAAEC,QAAQ;IAChG,IAAMC,cAAcF,QAAQE,WAAW,IAAId;IAC3CY,UAAU;QAAEE,aAAAA;OAAgBF;IAE5BJ,kBAAkBG,mBAAmBC,SAAS,SAACG,KAAKC;QAClD,IAAID,KAAK,OAAOF,SAASE;QACzB,IAAI,CAACC,SAASC,MAAM,EAAE,OAAOJ,SAAS,IAAIK,MAAM,AAAC,sCAAuD,OAAlBP;QAEtF,IAAMQ,UAA2B,EAAE;QACnC,IAAMC,QAAQ,IAAIC,gBAAK,CAACT,QAAQU,WAAW,IAAI;QAC/CN,SAASO,OAAO,CAAC,SAACC;YAChBJ,MAAMK,KAAK,CAAC,SAACC;oBAIFC,OAAT,SAASA,KAAKC,KAAM;oBAClBT,QAAQU,IAAI,CAAC,wCAAKC;wBAAQF,OAAAA;;oBAC1BF;gBACF;gBANA,IAAMK,iBAAiB;oBAAEC,MAAMR;mBAAYZ;gBAC3C,IAAMkB,SAASG,IAAAA,gCAAY,EAACF,gBAAgBP;gBAM5CU,WAAE,CAACC,IAAI,CAACL,OAAOM,QAAQ,EAAE,SAACC,GAAGF;2BAAUA,OAAOR,SAASjB,iBAAiBc,SAASO,gBAAgBJ;;YACnG;QACF;QACAP,MAAMkB,KAAK,CAAC,SAACvB;mBAASA,MAAMF,SAASE,OAAOF,SAAS,MAAMM;;IAC7D;AACF"}
@@ -2,14 +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 default function install(versionExpression, rootInstallPath, options, callback) {
5
+ export default function install(versionExpression, options, callback) {
6
6
  if (typeof options === 'function') {
7
7
  callback = options;
8
8
  options = {};
9
9
  }
10
10
  options = options || {};
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)));
11
+ if (typeof callback === 'function') return worker(versionExpression, options, callback);
12
+ return new Promise((resolve, reject)=>worker(versionExpression, options, (err, result)=>err ? reject(err) : resolve(result)));
13
13
  }
14
14
  import Module from 'module';
15
15
  import lazy from 'lazy-cache';
@@ -19,11 +19,11 @@ const SLEEP_MS = 200;
19
19
  const __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);
20
20
  const root = moduleRoot(__dirname);
21
21
  const workerPath = path.join(root, 'dist', 'cjs', 'workers', 'install.cjs');
22
- export function sync(versionExpression, rootInstallPath, options) {
22
+ export function sync(versionExpression, options) {
23
23
  options = options || {};
24
24
  return execFunction().default({
25
25
  cwd: process.cwd(),
26
26
  sleep: SLEEP_MS,
27
27
  callbacks: true
28
- }, workerPath, versionExpression, rootInstallPath, options);
28
+ }, workerPath, versionExpression, options);
29
29
  }
@@ -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';\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"}
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, 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) => worker(versionExpression, 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, options?: InstallOptions): InstallResult[] {\n options = options || {};\n return execFunction().default({ cwd: process.cwd(), sleep: SLEEP_MS, callbacks: true }, workerPath, versionExpression, options);\n}\n"],"names":["path","url","moduleRoot","worker","install","versionExpression","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,OAAwB,EAAEC,QAA0B;IAC7G,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IAEtB,IAAI,OAAOC,aAAa,YAAY,OAAOJ,OAAOE,mBAAmBC,SAASC;IAC9E,OAAO,IAAIC,QAAQ,CAACC,SAASC,SAAWP,OAAOE,mBAAmBC,SAAS,CAACK,KAAKC,SAAYD,MAAMD,OAAOC,OAAOF,QAAQG;AAC3H;AAEA,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,aAAa;AAC9B,MAAMC,WAAW,OAAOC,YAAY,cAAcH,OAAOI,aAAa,CAAC,YAAYhB,GAAG,IAAIe;AAC1F,MAAME,eAAeJ,KAAKC,UAAU;AAEpC,MAAMI,WAAW;AACjB,MAAMC,YAAYpB,KAAKqB,OAAO,CAAC,OAAOC,eAAe,cAAcrB,IAAIsB,aAAa,CAAC,YAAYtB,GAAG,IAAIqB;AACxG,MAAME,OAAOtB,WAAWkB;AACxB,MAAMK,aAAazB,KAAK0B,IAAI,CAACF,MAAM,QAAQ,OAAO,WAAW;AAE7D,OAAO,SAASG,KAAKtB,iBAAyB,EAAEC,OAAwB;IACtEA,UAAUA,WAAW,CAAC;IACtB,OAAOY,eAAeU,OAAO,CAAC;QAAEC,KAAKC,QAAQD,GAAG;QAAIE,OAAOZ;QAAUa,WAAW;IAAK,GAAGP,YAAYpB,mBAAmBC;AACzH"}
@@ -1 +1 @@
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"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/types.ts"],"sourcesContent":["import type { InstallOptions as InstallOptionsBase, InstallResult as InstallResultBase } from 'node-install-release';\n\nexport interface InstallResult extends InstallResultBase {\n error?: Error;\n}\n\nexport interface InstallOptions extends InstallOptionsBase {\n concurrency?: number;\n}\n\nexport type InstallCallback = (err?: Error, results?: InstallResult[]) => void;\n"],"names":[],"mappings":"AAUA,WAA+E"}
@@ -1,46 +1,40 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
3
  import Queue from 'queue-cb';
4
- import { NODE, isWindows } from '../constants.mjs';
5
4
  import home from 'homedir-polyfill';
6
- import createPaths from '../createPaths.mjs';
7
- const DEFAULT_ROOT_PATH = path.join(home(), '.nvu');
8
- const DEFAULT_INSTALL_PATHS = createPaths(DEFAULT_ROOT_PATH);
5
+ import { createResult } from 'node-install-release';
6
+ const DEFAULT_STORAGE_PATH = path.join(home(), '.nvu');
9
7
  import Module from 'module';
10
8
  import lazy from 'lazy-cache';
11
9
  const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
12
10
  const resolveVersions = lazy(_require)('node-resolve-versions');
13
11
  const installRelease = lazy(_require)('node-install-release');
14
- export default function installWorker(versionExpression, rootInstallPath, options, callback) {
15
- const { buildPath, cachePath } = options.cachePath ? createPaths(options.cachePath) : DEFAULT_INSTALL_PATHS;
16
- resolveVersions()(versionExpression, {
12
+ export default function installWorker(versionExpression, options, callback) {
13
+ const storagePath = options.storagePath || DEFAULT_STORAGE_PATH;
14
+ options = {
15
+ storagePath,
17
16
  ...options
18
- }, (err, versions)=>{
17
+ };
18
+ resolveVersions()(versionExpression, options, (err, versions)=>{
19
19
  if (err) return callback(err);
20
20
  if (!versions.length) return callback(new Error(`No versions found from expression: ${versionExpression}`));
21
21
  const results = [];
22
22
  const queue = new Queue(options.concurrency || 1);
23
23
  versions.forEach((version)=>{
24
24
  queue.defer((cb)=>{
25
- const installPath = path.join(rootInstallPath, version);
26
- const binRoot = isWindows ? installPath : path.join(installPath, 'bin');
27
- const execPath = path.join(binRoot, NODE);
25
+ const versionOptions = {
26
+ name: version,
27
+ ...options
28
+ };
29
+ const result = createResult(versionOptions, version);
28
30
  function done(error) {
29
31
  results.push({
30
- version,
31
- installPath,
32
- execPath,
32
+ ...result,
33
33
  error
34
34
  });
35
35
  cb();
36
36
  }
37
- fs.stat(execPath, (_, stat)=>{
38
- // TODO remove redundant options
39
- stat ? done() : installRelease()(version, installPath, {
40
- cachePath,
41
- buildPath
42
- }, done);
43
- });
37
+ fs.stat(result.execPath, (_, stat)=>stat ? done() : installRelease()(version, versionOptions, done));
44
38
  });
45
39
  });
46
40
  queue.await((err)=>err ? callback(err) : callback(null, results));
@@ -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';\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
+ {"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';\n\nimport home from 'homedir-polyfill';\nimport { createResult } from 'node-install-release';\nconst DEFAULT_STORAGE_PATH = path.join(home(), '.nvu');\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, options: InstallOptions, callback) {\n const storagePath = options.storagePath || DEFAULT_STORAGE_PATH;\n options = { storagePath, ...options };\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 versionOptions = { name: version, ...options };\n const result = createResult(versionOptions, version);\n\n function done(error?) {\n results.push({ ...result, error });\n cb();\n }\n fs.stat(result.execPath, (_, stat) => (stat ? done() : installRelease()(version, versionOptions, done)));\n });\n });\n queue.await((err) => (err ? callback(err) : callback(null, results)));\n });\n}\n"],"names":["fs","path","Queue","home","createResult","DEFAULT_STORAGE_PATH","join","Module","lazy","_require","require","createRequire","url","resolveVersions","installRelease","installWorker","versionExpression","options","callback","storagePath","err","versions","length","Error","results","queue","concurrency","forEach","version","defer","cb","versionOptions","name","result","done","error","push","stat","execPath","_","await"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAE7B,OAAOC,UAAU,mBAAmB;AACpC,SAASC,YAAY,QAAQ,uBAAuB;AACpD,MAAMC,uBAAuBJ,KAAKK,IAAI,CAACH,QAAQ;AAE/C,OAAOI,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,OAAuB,EAAEC,QAAQ;IAChG,MAAMC,cAAcF,QAAQE,WAAW,IAAId;IAC3CY,UAAU;QAAEE;QAAa,GAAGF,OAAO;IAAC;IAEpCJ,kBAAkBG,mBAAmBC,SAAS,CAACG,KAAKC;QAClD,IAAID,KAAK,OAAOF,SAASE;QACzB,IAAI,CAACC,SAASC,MAAM,EAAE,OAAOJ,SAAS,IAAIK,MAAM,CAAC,mCAAmC,EAAEP,mBAAmB;QAEzG,MAAMQ,UAA2B,EAAE;QACnC,MAAMC,QAAQ,IAAIvB,MAAMe,QAAQS,WAAW,IAAI;QAC/CL,SAASM,OAAO,CAAC,CAACC;YAChBH,MAAMI,KAAK,CAAC,CAACC;gBACX,MAAMC,iBAAiB;oBAAEC,MAAMJ;oBAAS,GAAGX,OAAO;gBAAC;gBACnD,MAAMgB,SAAS7B,aAAa2B,gBAAgBH;gBAE5C,SAASM,KAAKC,KAAM;oBAClBX,QAAQY,IAAI,CAAC;wBAAE,GAAGH,MAAM;wBAAEE;oBAAM;oBAChCL;gBACF;gBACA9B,GAAGqC,IAAI,CAACJ,OAAOK,QAAQ,EAAE,CAACC,GAAGF,OAAUA,OAAOH,SAASpB,iBAAiBc,SAASG,gBAAgBG;YACnG;QACF;QACAT,MAAMe,KAAK,CAAC,CAACpB,MAASA,MAAMF,SAASE,OAAOF,SAAS,MAAMM;IAC7D;AACF"}
@@ -1,4 +1,4 @@
1
1
  import type { InstallCallback, InstallOptions, InstallResult } from './types';
2
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[];
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,15 +1,8 @@
1
- export type CacheLocations = {
2
- cachePath: string;
3
- buildPath: string;
4
- };
5
- export type InstallResult = {
6
- version: string;
7
- installPath: string;
8
- execPath: string;
1
+ import type { InstallOptions as InstallOptionsBase, InstallResult as InstallResultBase } from 'node-install-release';
2
+ export interface InstallResult extends InstallResultBase {
9
3
  error?: Error;
10
- };
11
- export interface InstallOptions {
12
- cachePath?: string;
4
+ }
5
+ export interface InstallOptions extends InstallOptionsBase {
13
6
  concurrency?: number;
14
7
  }
15
8
  export type InstallCallback = (err?: Error, results?: InstallResult[]) => void;
@@ -1,2 +1,2 @@
1
1
  import type { InstallOptions } from '../types';
2
- export default function installWorker(versionExpression: string, rootInstallPath: any, options: InstallOptions, callback: any): void;
2
+ export default function installWorker(versionExpression: string, options: InstallOptions, callback: any): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-version-install",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Install NodeJs by version string asynchronously or synchronously",
5
5
  "keywords": [
6
6
  "node",
@@ -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.7.0",
54
+ "node-install-release": "^1.7.6",
55
55
  "node-resolve-versions": "^1.0.5",
56
56
  "queue-cb": "^1.4.4"
57
57
  },
@@ -60,7 +60,7 @@
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
+ "cross-spawn-cb": "^2.0.1",
64
64
  "fs-exists-sync": "^0.1.0",
65
65
  "is-version": "^0.2.1",
66
66
  "node-version-utils": "^1.2.1",
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- NODE: function() {
13
- return NODE;
14
- },
15
- isWindows: function() {
16
- return isWindows;
17
- }
18
- });
19
- var isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);
20
- var NODE = isWindows ? 'node.exe' : 'node';
21
- /* 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/node-version/node-version-install/src/constants.ts"],"sourcesContent":["export const isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nexport const NODE = isWindows ? 'node.exe' : 'node';\n"],"names":["NODE","isWindows","process","platform","test","env","OSTYPE"],"mappings":";;;;;;;;;;;IACaA,IAAI;eAAJA;;IADAC,SAAS;eAATA;;;AAAN,IAAMA,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAC3F,IAAMN,OAAOC,YAAY,aAAa"}
@@ -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 createPaths;
9
- }
10
- });
11
- var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
- function _interop_require_default(obj) {
13
- return obj && obj.__esModule ? obj : {
14
- default: obj
15
- };
16
- }
17
- function createPaths(installPath) {
18
- return {
19
- cachePath: _path.default.join(installPath, 'cache'),
20
- buildPath: _path.default.join(installPath, 'build')
21
- };
22
- }
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/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"}
@@ -1,2 +0,0 @@
1
- export const isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);
2
- export const NODE = isWindows ? 'node.exe' : 'node';
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/constants.ts"],"sourcesContent":["export const isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nexport const NODE = isWindows ? 'node.exe' : 'node';\n"],"names":["isWindows","process","platform","test","env","OSTYPE","NODE"],"mappings":"AAAA,OAAO,MAAMA,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM,EAAE;AACpG,OAAO,MAAMC,OAAON,YAAY,aAAa,OAAO"}
@@ -1,7 +0,0 @@
1
- import path from 'path';
2
- export default function createPaths(installPath) {
3
- return {
4
- cachePath: path.join(installPath, 'cache'),
5
- buildPath: path.join(installPath, 'build')
6
- };
7
- }
@@ -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 { 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"}
@@ -1,2 +0,0 @@
1
- export declare const isWindows: boolean;
2
- export declare const NODE: string;
@@ -1,2 +0,0 @@
1
- import type { CacheLocations } from './types';
2
- export default function createPaths(installPath: string): CacheLocations;