node-install-release 1.7.1 → 1.7.3

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.
@@ -9,6 +9,12 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
+ DEFAULT_ROOT_PATH: function() {
13
+ return DEFAULT_ROOT_PATH;
14
+ },
15
+ DEFAULT_STORAGE_PATHS: function() {
16
+ return DEFAULT_STORAGE_PATHS;
17
+ },
12
18
  NODE: function() {
13
19
  return NODE;
14
20
  },
@@ -16,6 +22,16 @@ _export(exports, {
16
22
  return isWindows;
17
23
  }
18
24
  });
25
+ var _path = /*#__PURE__*/ _interop_require_default(require("path"));
26
+ var _homedirpolyfill = /*#__PURE__*/ _interop_require_default(require("homedir-polyfill"));
27
+ var _createStoragePaths = /*#__PURE__*/ _interop_require_default(require("./createStoragePaths.cjs"));
28
+ function _interop_require_default(obj) {
29
+ return obj && obj.__esModule ? obj : {
30
+ default: obj
31
+ };
32
+ }
19
33
  var isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);
20
34
  var NODE = isWindows ? 'node.exe' : 'node';
35
+ var DEFAULT_ROOT_PATH = _path.default.join((0, _homedirpolyfill.default)(), '.nir');
36
+ var DEFAULT_STORAGE_PATHS = (0, _createStoragePaths.default)(DEFAULT_ROOT_PATH);
21
37
  /* 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-install-release/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
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/constants.ts"],"sourcesContent":["import path from 'path';\nimport home from 'homedir-polyfill';\nimport createStoragePaths from './createStoragePaths';\n\nexport const isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nexport const NODE = isWindows ? 'node.exe' : 'node';\n\nexport const DEFAULT_ROOT_PATH = path.join(home(), '.nir');\nexport const DEFAULT_STORAGE_PATHS = createStoragePaths(DEFAULT_ROOT_PATH);\n"],"names":["DEFAULT_ROOT_PATH","DEFAULT_STORAGE_PATHS","NODE","isWindows","process","platform","test","env","OSTYPE","path","join","home","createStoragePaths"],"mappings":";;;;;;;;;;;IAOaA,iBAAiB;eAAjBA;;IACAC,qBAAqB;eAArBA;;IAHAC,IAAI;eAAJA;;IADAC,SAAS;eAATA;;;2DAJI;sEACA;yEACc;;;;;;AAExB,IAAMA,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAC3F,IAAMN,OAAOC,YAAY,aAAa;AAEtC,IAAMH,oBAAoBS,aAAI,CAACC,IAAI,CAACC,IAAAA,wBAAI,KAAI;AAC5C,IAAMV,wBAAwBW,IAAAA,2BAAkB,EAACZ"}
@@ -0,0 +1,32 @@
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 createResult;
9
+ }
10
+ });
11
+ var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
+ var _constants = require("./constants.cjs");
13
+ var _createStoragePaths = /*#__PURE__*/ _interop_require_default(require("./createStoragePaths.cjs"));
14
+ function _interop_require_default(obj) {
15
+ return obj && obj.__esModule ? obj : {
16
+ default: obj
17
+ };
18
+ }
19
+ function createResult(options, version) {
20
+ var storagePaths = options.storagePath ? (0, _createStoragePaths.default)(options.storagePath) : _constants.DEFAULT_STORAGE_PATHS;
21
+ var installPath = options.installPath || storagePaths.installPath;
22
+ if (options.name) installPath = _path.default.join(installPath, options.name);
23
+ else if (!options.installPath) installPath = _path.default.join(installPath, version);
24
+ var binRoot = _constants.isWindows ? installPath : _path.default.join(installPath, 'bin');
25
+ var execPath = _path.default.join(binRoot, _constants.NODE);
26
+ return {
27
+ version: version,
28
+ installPath: installPath,
29
+ execPath: execPath
30
+ };
31
+ }
32
+ /* 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-install-release/src/createResult.ts"],"sourcesContent":["import path from 'path';\nimport { DEFAULT_STORAGE_PATHS, NODE, isWindows } from './constants';\n\nimport createStoragePaths from './createStoragePaths';\nimport type { InstallOptions, InstallResult } from './types';\n\nexport default function createResult(options: InstallOptions, version: string): InstallResult {\n const storagePaths = options.storagePath ? createStoragePaths(options.storagePath) : DEFAULT_STORAGE_PATHS;\n let installPath = options.installPath || storagePaths.installPath;\n\n if (options.name) installPath = path.join(installPath, options.name);\n else if (!options.installPath) installPath = path.join(installPath, version);\n const binRoot = isWindows ? installPath : path.join(installPath, 'bin');\n const execPath = path.join(binRoot, NODE);\n return { version, installPath, execPath };\n}\n"],"names":["createResult","options","version","storagePaths","storagePath","createStoragePaths","DEFAULT_STORAGE_PATHS","installPath","name","path","join","binRoot","isWindows","execPath","NODE"],"mappings":";;;;+BAMA;;;eAAwBA;;;2DANP;yBACsC;yEAExB;;;;;;AAGhB,SAASA,aAAaC,OAAuB,EAAEC,OAAe;IAC3E,IAAMC,eAAeF,QAAQG,WAAW,GAAGC,IAAAA,2BAAkB,EAACJ,QAAQG,WAAW,IAAIE,gCAAqB;IAC1G,IAAIC,cAAcN,QAAQM,WAAW,IAAIJ,aAAaI,WAAW;IAEjE,IAAIN,QAAQO,IAAI,EAAED,cAAcE,aAAI,CAACC,IAAI,CAACH,aAAaN,QAAQO,IAAI;SAC9D,IAAI,CAACP,QAAQM,WAAW,EAAEA,cAAcE,aAAI,CAACC,IAAI,CAACH,aAAaL;IACpE,IAAMS,UAAUC,oBAAS,GAAGL,cAAcE,aAAI,CAACC,IAAI,CAACH,aAAa;IACjE,IAAMM,WAAWJ,aAAI,CAACC,IAAI,CAACC,SAASG,eAAI;IACxC,OAAO;QAAEZ,SAAAA;QAASK,aAAAA;QAAaM,UAAAA;IAAS;AAC1C"}
@@ -2,14 +2,23 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
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
+ createStoragePaths: function() {
13
+ return _createStoragePaths.default;
14
+ },
15
+ default: function() {
8
16
  return install;
9
17
  }
10
18
  });
11
19
  require("./polyfills.cjs");
12
20
  var _install = /*#__PURE__*/ _interop_require_default(require("./workers/install.cjs"));
21
+ var _createStoragePaths = /*#__PURE__*/ _interop_require_default(require("./createStoragePaths.cjs"));
13
22
  function _interop_require_default(obj) {
14
23
  return obj && obj.__esModule ? obj : {
15
24
  default: obj
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/index.ts"],"sourcesContent":["import './polyfills.cjs';\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 | InstallCallback, 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"],"names":["install","versionExpression","options","callback","worker","Promise","resolve","reject","err","result"],"mappings":";;;;+BAMA;;;eAAwBA;;;QANjB;8DACY;;;;;;AAKJ,SAASA,QAAQC,iBAAyB,EAAEC,OAA0C,EAAEC,QAA0B;IAC/H,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"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/index.ts"],"sourcesContent":["import './polyfills.cjs';\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 | InstallCallback, 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}\nexport { default as createStoragePaths } from './createStoragePaths';\n"],"names":["createStoragePaths","install","versionExpression","options","callback","worker","Promise","resolve","reject","err","result"],"mappings":";;;;;;;;;;;IAgBoBA,kBAAkB;eAAlBA,2BAAkB;;IAVtC,OASC;eATuBC;;;QANjB;8DACY;yEAe2B;;;;;;AAV/B,SAASA,QAAQC,iBAAyB,EAAEC,OAA0C,EAAEC,QAA0B;IAC/H,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"}
@@ -8,11 +8,10 @@ Object.defineProperty(exports, "default", {
8
8
  return install;
9
9
  }
10
10
  });
11
- var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
11
  var _mkdirpclassic = /*#__PURE__*/ _interop_require_default(require("mkdirp-classic"));
13
12
  var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
14
13
  var _constants = require("../constants.cjs");
15
- var _homedirpolyfill = /*#__PURE__*/ _interop_require_default(require("homedir-polyfill"));
14
+ var _createResult = /*#__PURE__*/ _interop_require_default(require("../createResult.cjs"));
16
15
  var _createStoragePaths = /*#__PURE__*/ _interop_require_default(require("../createStoragePaths.cjs"));
17
16
  var _noderesolveversions = /*#__PURE__*/ _interop_require_default(require("node-resolve-versions"));
18
17
  var _index = /*#__PURE__*/ _interop_require_default(require("../installNPM/index.cjs"));
@@ -76,16 +75,13 @@ function _object_spread_props(target, source) {
76
75
  }
77
76
  return target;
78
77
  }
79
- var DEFAULT_ROOT_PATH = _path.default.join((0, _homedirpolyfill.default)(), '.nir');
80
- var DEFAULT_STORAGE_PATHS = (0, _createStoragePaths.default)(DEFAULT_ROOT_PATH);
81
78
  var DEFAULT_OPTIONS = {
82
79
  downloadURL: function downloadURL(relativePath) {
83
80
  return "https://nodejs.org/dist/".concat(relativePath);
84
81
  }
85
82
  };
86
83
  function install(versionExpression, options, callback) {
87
- var storagePaths = options.storagePath ? (0, _createStoragePaths.default)(options.storagePath) : DEFAULT_STORAGE_PATHS;
88
- var dest = options.installPath ? options.installPath : storagePaths.installPath;
84
+ var storagePaths = options.storagePath ? (0, _createStoragePaths.default)(options.storagePath) : _constants.DEFAULT_STORAGE_PATHS;
89
85
  options = _object_spread_props(_object_spread({}, storagePaths, DEFAULT_OPTIONS, options), {
90
86
  path: 'raw'
91
87
  });
@@ -98,23 +94,15 @@ function install(versionExpression, options, callback) {
98
94
  (0, _mkdirpclassic.default)(options.cachePath, function(err) {
99
95
  if (err) return callback(err);
100
96
  var version = versions[0];
101
- var installPath = dest;
102
- if (options.name) installPath = _path.default.join(installPath, options.name);
103
- else if (!options.installPath) installPath = _path.default.join(installPath, version.version);
104
- var binRoot = _constants.isWindows ? installPath : _path.default.join(installPath, 'bin');
105
- var execPath = _path.default.join(binRoot, _constants.NODE);
106
- (0, _checkMissing.default)(dest, options, function(err, missing) {
107
- if (err || !missing.length) return callback(err, dest);
97
+ var result = (0, _createResult.default)(options, version.version);
98
+ (0, _checkMissing.default)(result.installPath, options, function(err, missing) {
99
+ if (err || !missing.length) return callback(err, result);
108
100
  var queue = new _queuecb.default(1);
109
- queue.defer(_ensureDestinationParent.default.bind(null, dest));
110
- !~missing.indexOf('node') || queue.defer(_index1.default.bind(null, version, dest, options));
111
- !~missing.indexOf('npm') || queue.defer(_index.default.bind(null, version, dest, options));
101
+ queue.defer(_ensureDestinationParent.default.bind(null, result.installPath));
102
+ !~missing.indexOf('node') || queue.defer(_index1.default.bind(null, version, result.installPath, options));
103
+ !~missing.indexOf('npm') || queue.defer(_index.default.bind(null, version, result.installPath, options));
112
104
  queue.await(function(err) {
113
- err ? callback(err) : callback(null, {
114
- version: version.version,
115
- installPath: installPath,
116
- execPath: execPath
117
- });
105
+ return err ? callback(err) : callback(null, result);
118
106
  });
119
107
  });
120
108
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/workers/install.ts"],"sourcesContent":["import path from 'path';\nimport mkdirp from 'mkdirp-classic';\nimport Queue from 'queue-cb';\nimport { NODE, isWindows } from '../constants';\n\nimport home from 'homedir-polyfill';\nimport createStoragePaths from '../createStoragePaths';\nconst DEFAULT_ROOT_PATH = path.join(home(), '.nir');\nconst DEFAULT_STORAGE_PATHS = createStoragePaths(DEFAULT_ROOT_PATH);\n\nimport resolveVersions from 'node-resolve-versions';\n\nimport installNPM from '../installNPM/index';\nimport installNode from '../installNode/index';\nimport checkMissing from '../lib/checkMissing';\nimport ensureDestinationParent from '../lib/ensureDestinationParent';\n\nconst DEFAULT_OPTIONS = {\n downloadURL: function downloadURL(relativePath) {\n return `https://nodejs.org/dist/${relativePath}`;\n },\n};\n\nexport default function install(versionExpression, options, callback) {\n const storagePaths = options.storagePath ? createStoragePaths(options.storagePath) : DEFAULT_STORAGE_PATHS;\n const dest = options.installPath ? options.installPath : storagePaths.installPath;\n\n options = { ...storagePaths, ...DEFAULT_OPTIONS, ...options, path: 'raw' };\n resolveVersions(versionExpression, options, (err, versions) => {\n if (err) return callback(err);\n if (!versions.length) return callback(new Error(`Could not resolve versions for: ${versionExpression}`));\n if (versions.length !== 1) return callback(new Error(`Version ${versionExpression} resolved to multiple versions: ${versions.map((x) => x.version)}. Expecting one.`));\n\n mkdirp(options.cachePath, (err) => {\n if (err) return callback(err);\n const version = versions[0];\n\n let installPath = dest;\n if (options.name) installPath = path.join(installPath, options.name);\n else if (!options.installPath) installPath = path.join(installPath, version.version);\n const binRoot = isWindows ? installPath : path.join(installPath, 'bin');\n const execPath = path.join(binRoot, NODE);\n\n checkMissing(dest, options, (err, missing) => {\n if (err || !missing.length) return callback(err, dest);\n\n const queue = new Queue(1);\n queue.defer(ensureDestinationParent.bind(null, dest));\n !~missing.indexOf('node') || queue.defer(installNode.bind(null, version, dest, options));\n !~missing.indexOf('npm') || queue.defer(installNPM.bind(null, version, dest, options));\n queue.await((err) => {\n err ? callback(err) : callback(null, { version: version.version, installPath, execPath });\n });\n });\n });\n });\n}\n"],"names":["install","DEFAULT_ROOT_PATH","path","join","home","DEFAULT_STORAGE_PATHS","createStoragePaths","DEFAULT_OPTIONS","downloadURL","relativePath","versionExpression","options","callback","storagePaths","storagePath","dest","installPath","resolveVersions","err","versions","length","Error","map","x","version","mkdirp","cachePath","name","binRoot","isWindows","execPath","NODE","checkMissing","missing","queue","Queue","defer","ensureDestinationParent","bind","indexOf","installNode","installNPM","await"],"mappings":";;;;+BAuBA;;;eAAwBA;;;2DAvBP;oEACE;8DACD;yBACc;sEAEf;yEACc;0EAIH;4DAEL;6DACC;mEACC;8EACW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AARpC,IAAMC,oBAAoBC,aAAI,CAACC,IAAI,CAACC,IAAAA,wBAAI,KAAI;AAC5C,IAAMC,wBAAwBC,IAAAA,2BAAkB,EAACL;AASjD,IAAMM,kBAAkB;IACtBC,aAAa,SAASA,YAAYC,YAAY;QAC5C,OAAO,AAAC,2BAAuC,OAAbA;IACpC;AACF;AAEe,SAAST,QAAQU,iBAAiB,EAAEC,OAAO,EAAEC,QAAQ;IAClE,IAAMC,eAAeF,QAAQG,WAAW,GAAGR,IAAAA,2BAAkB,EAACK,QAAQG,WAAW,IAAIT;IACrF,IAAMU,OAAOJ,QAAQK,WAAW,GAAGL,QAAQK,WAAW,GAAGH,aAAaG,WAAW;IAEjFL,UAAU,wCAAKE,cAAiBN,iBAAoBI;QAAST,MAAM;;IACnEe,IAAAA,4BAAe,EAACP,mBAAmBC,SAAS,SAACO,KAAKC;QAChD,IAAID,KAAK,OAAON,SAASM;QACzB,IAAI,CAACC,SAASC,MAAM,EAAE,OAAOR,SAAS,IAAIS,MAAM,AAAC,mCAAoD,OAAlBX;QACnF,IAAIS,SAASC,MAAM,KAAK,GAAG,OAAOR,SAAS,IAAIS,MAAM,AAAC,WAA8DF,OAApDT,mBAAkB,oCAAiE,OAA/BS,SAASG,GAAG,CAAC,SAACC;mBAAMA,EAAEC,OAAO;YAAE;QAEnJC,IAAAA,sBAAM,EAACd,QAAQe,SAAS,EAAE,SAACR;YACzB,IAAIA,KAAK,OAAON,SAASM;YACzB,IAAMM,UAAUL,QAAQ,CAAC,EAAE;YAE3B,IAAIH,cAAcD;YAClB,IAAIJ,QAAQgB,IAAI,EAAEX,cAAcd,aAAI,CAACC,IAAI,CAACa,aAAaL,QAAQgB,IAAI;iBAC9D,IAAI,CAAChB,QAAQK,WAAW,EAAEA,cAAcd,aAAI,CAACC,IAAI,CAACa,aAAaQ,QAAQA,OAAO;YACnF,IAAMI,UAAUC,oBAAS,GAAGb,cAAcd,aAAI,CAACC,IAAI,CAACa,aAAa;YACjE,IAAMc,WAAW5B,aAAI,CAACC,IAAI,CAACyB,SAASG,eAAI;YAExCC,IAAAA,qBAAY,EAACjB,MAAMJ,SAAS,SAACO,KAAKe;gBAChC,IAAIf,OAAO,CAACe,QAAQb,MAAM,EAAE,OAAOR,SAASM,KAAKH;gBAEjD,IAAMmB,QAAQ,IAAIC,gBAAK,CAAC;gBACxBD,MAAME,KAAK,CAACC,gCAAuB,CAACC,IAAI,CAAC,MAAMvB;gBAC/C,CAAC,CAACkB,QAAQM,OAAO,CAAC,WAAWL,MAAME,KAAK,CAACI,eAAW,CAACF,IAAI,CAAC,MAAMd,SAAST,MAAMJ;gBAC/E,CAAC,CAACsB,QAAQM,OAAO,CAAC,UAAUL,MAAME,KAAK,CAACK,cAAU,CAACH,IAAI,CAAC,MAAMd,SAAST,MAAMJ;gBAC7EuB,MAAMQ,KAAK,CAAC,SAACxB;oBACXA,MAAMN,SAASM,OAAON,SAAS,MAAM;wBAAEY,SAASA,QAAQA,OAAO;wBAAER,aAAAA;wBAAac,UAAAA;oBAAS;gBACzF;YACF;QACF;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/workers/install.ts"],"sourcesContent":["import mkdirp from 'mkdirp-classic';\nimport Queue from 'queue-cb';\nimport { DEFAULT_STORAGE_PATHS } from '../constants';\n\nimport createResult from '../createResult';\nimport createStoragePaths from '../createStoragePaths';\n\nimport resolveVersions from 'node-resolve-versions';\n\nimport installNPM from '../installNPM/index';\nimport installNode from '../installNode/index';\nimport checkMissing from '../lib/checkMissing';\nimport ensureDestinationParent from '../lib/ensureDestinationParent';\n\nconst DEFAULT_OPTIONS = {\n downloadURL: function downloadURL(relativePath) {\n return `https://nodejs.org/dist/${relativePath}`;\n },\n};\n\nexport default function install(versionExpression, options, callback) {\n const storagePaths = options.storagePath ? createStoragePaths(options.storagePath) : DEFAULT_STORAGE_PATHS;\n\n options = { ...storagePaths, ...DEFAULT_OPTIONS, ...options, path: 'raw' };\n resolveVersions(versionExpression, options, (err, versions) => {\n if (err) return callback(err);\n if (!versions.length) return callback(new Error(`Could not resolve versions for: ${versionExpression}`));\n if (versions.length !== 1) return callback(new Error(`Version ${versionExpression} resolved to multiple versions: ${versions.map((x) => x.version)}. Expecting one.`));\n\n mkdirp(options.cachePath, (err) => {\n if (err) return callback(err);\n const version = versions[0];\n const result = createResult(options, version.version);\n\n checkMissing(result.installPath, options, (err, missing) => {\n if (err || !missing.length) return callback(err, result);\n\n const queue = new Queue(1);\n queue.defer(ensureDestinationParent.bind(null, result.installPath));\n !~missing.indexOf('node') || queue.defer(installNode.bind(null, version, result.installPath, options));\n !~missing.indexOf('npm') || queue.defer(installNPM.bind(null, version, result.installPath, options));\n queue.await((err) => (err ? callback(err) : callback(null, result)));\n });\n });\n });\n}\n"],"names":["install","DEFAULT_OPTIONS","downloadURL","relativePath","versionExpression","options","callback","storagePaths","storagePath","createStoragePaths","DEFAULT_STORAGE_PATHS","path","resolveVersions","err","versions","length","Error","map","x","version","mkdirp","cachePath","result","createResult","checkMissing","installPath","missing","queue","Queue","defer","ensureDestinationParent","bind","indexOf","installNode","installNPM","await"],"mappings":";;;;+BAoBA;;;eAAwBA;;;oEApBL;8DACD;yBACoB;mEAEb;yEACM;0EAEH;4DAEL;6DACC;mEACC;8EACW;;;;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,CAAC,MAAMZ,SAASG,OAAOG,WAAW,EAAEpB;gBAC7F,CAAC,CAACqB,QAAQM,OAAO,CAAC,UAAUL,MAAME,KAAK,CAACK,cAAU,CAACH,IAAI,CAAC,MAAMZ,SAASG,OAAOG,WAAW,EAAEpB;gBAC3FsB,MAAMQ,KAAK,CAAC,SAACtB;2BAASA,MAAMP,SAASO,OAAOP,SAAS,MAAMgB;;YAC7D;QACF;IACF;AACF"}
@@ -1,2 +1,7 @@
1
+ import path from 'path';
2
+ import home from 'homedir-polyfill';
3
+ import createStoragePaths from './createStoragePaths.mjs';
1
4
  export const isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);
2
5
  export const NODE = isWindows ? 'node.exe' : 'node';
6
+ export const DEFAULT_ROOT_PATH = path.join(home(), '.nir');
7
+ export const DEFAULT_STORAGE_PATHS = createStoragePaths(DEFAULT_ROOT_PATH);
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/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
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/constants.ts"],"sourcesContent":["import path from 'path';\nimport home from 'homedir-polyfill';\nimport createStoragePaths from './createStoragePaths';\n\nexport const isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nexport const NODE = isWindows ? 'node.exe' : 'node';\n\nexport const DEFAULT_ROOT_PATH = path.join(home(), '.nir');\nexport const DEFAULT_STORAGE_PATHS = createStoragePaths(DEFAULT_ROOT_PATH);\n"],"names":["path","home","createStoragePaths","isWindows","process","platform","test","env","OSTYPE","NODE","DEFAULT_ROOT_PATH","join","DEFAULT_STORAGE_PATHS"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,UAAU,mBAAmB;AACpC,OAAOC,wBAAwB,uBAAuB;AAEtD,OAAO,MAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM,EAAE;AACpG,OAAO,MAAMC,OAAON,YAAY,aAAa,OAAO;AAEpD,OAAO,MAAMO,oBAAoBV,KAAKW,IAAI,CAACV,QAAQ,QAAQ;AAC3D,OAAO,MAAMW,wBAAwBV,mBAAmBQ,mBAAmB"}
@@ -0,0 +1,16 @@
1
+ import path from 'path';
2
+ import { DEFAULT_STORAGE_PATHS, NODE, isWindows } from './constants.mjs';
3
+ import createStoragePaths from './createStoragePaths.mjs';
4
+ export default function createResult(options, version) {
5
+ const storagePaths = options.storagePath ? createStoragePaths(options.storagePath) : DEFAULT_STORAGE_PATHS;
6
+ let installPath = options.installPath || storagePaths.installPath;
7
+ if (options.name) installPath = path.join(installPath, options.name);
8
+ else if (!options.installPath) installPath = path.join(installPath, version);
9
+ const binRoot = isWindows ? installPath : path.join(installPath, 'bin');
10
+ const execPath = path.join(binRoot, NODE);
11
+ return {
12
+ version,
13
+ installPath,
14
+ execPath
15
+ };
16
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/createResult.ts"],"sourcesContent":["import path from 'path';\nimport { DEFAULT_STORAGE_PATHS, NODE, isWindows } from './constants';\n\nimport createStoragePaths from './createStoragePaths';\nimport type { InstallOptions, InstallResult } from './types';\n\nexport default function createResult(options: InstallOptions, version: string): InstallResult {\n const storagePaths = options.storagePath ? createStoragePaths(options.storagePath) : DEFAULT_STORAGE_PATHS;\n let installPath = options.installPath || storagePaths.installPath;\n\n if (options.name) installPath = path.join(installPath, options.name);\n else if (!options.installPath) installPath = path.join(installPath, version);\n const binRoot = isWindows ? installPath : path.join(installPath, 'bin');\n const execPath = path.join(binRoot, NODE);\n return { version, installPath, execPath };\n}\n"],"names":["path","DEFAULT_STORAGE_PATHS","NODE","isWindows","createStoragePaths","createResult","options","version","storagePaths","storagePath","installPath","name","join","binRoot","execPath"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,SAASC,qBAAqB,EAAEC,IAAI,EAAEC,SAAS,QAAQ,cAAc;AAErE,OAAOC,wBAAwB,uBAAuB;AAGtD,eAAe,SAASC,aAAaC,OAAuB,EAAEC,OAAe;IAC3E,MAAMC,eAAeF,QAAQG,WAAW,GAAGL,mBAAmBE,QAAQG,WAAW,IAAIR;IACrF,IAAIS,cAAcJ,QAAQI,WAAW,IAAIF,aAAaE,WAAW;IAEjE,IAAIJ,QAAQK,IAAI,EAAED,cAAcV,KAAKY,IAAI,CAACF,aAAaJ,QAAQK,IAAI;SAC9D,IAAI,CAACL,QAAQI,WAAW,EAAEA,cAAcV,KAAKY,IAAI,CAACF,aAAaH;IACpE,MAAMM,UAAUV,YAAYO,cAAcV,KAAKY,IAAI,CAACF,aAAa;IACjE,MAAMI,WAAWd,KAAKY,IAAI,CAACC,SAASX;IACpC,OAAO;QAAEK;QAASG;QAAaI;IAAS;AAC1C"}
@@ -9,3 +9,4 @@ export default function install(versionExpression, options, callback) {
9
9
  if (typeof callback === 'function') return worker(versionExpression, options, callback);
10
10
  return new Promise((resolve, reject)=>worker(versionExpression, options, (err, result)=>err ? reject(err) : resolve(result)));
11
11
  }
12
+ export { default as createStoragePaths } from './createStoragePaths.mjs';
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/index.ts"],"sourcesContent":["import './polyfills.cjs';\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 | InstallCallback, 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"],"names":["worker","install","versionExpression","options","callback","Promise","resolve","reject","err","result"],"mappings":"AAAA,OAAO,kBAAkB;AACzB,OAAOA,YAAY,oBAAoB;AAKvC,eAAe,SAASC,QAAQC,iBAAyB,EAAEC,OAA0C,EAAEC,QAA0B;IAC/H,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"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/index.ts"],"sourcesContent":["import './polyfills.cjs';\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 | InstallCallback, 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}\nexport { default as createStoragePaths } from './createStoragePaths';\n"],"names":["worker","install","versionExpression","options","callback","Promise","resolve","reject","err","result","default","createStoragePaths"],"mappings":"AAAA,OAAO,kBAAkB;AACzB,OAAOA,YAAY,oBAAoB;AAKvC,eAAe,SAASC,QAAQC,iBAAyB,EAAEC,OAA0C,EAAEC,QAA0B;IAC/H,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;AACA,SAASC,WAAWC,kBAAkB,QAAQ,uBAAuB"}
@@ -1,11 +1,8 @@
1
- import path from 'path';
2
1
  import mkdirp from 'mkdirp-classic';
3
2
  import Queue from 'queue-cb';
4
- import { NODE, isWindows } from '../constants.mjs';
5
- import home from 'homedir-polyfill';
3
+ import { DEFAULT_STORAGE_PATHS } from '../constants.mjs';
4
+ import createResult from '../createResult.mjs';
6
5
  import createStoragePaths from '../createStoragePaths.mjs';
7
- const DEFAULT_ROOT_PATH = path.join(home(), '.nir');
8
- const DEFAULT_STORAGE_PATHS = createStoragePaths(DEFAULT_ROOT_PATH);
9
6
  import resolveVersions from 'node-resolve-versions';
10
7
  import installNPM from '../installNPM/index.mjs';
11
8
  import installNode from '../installNode/index.mjs';
@@ -18,7 +15,6 @@ const DEFAULT_OPTIONS = {
18
15
  };
19
16
  export default function install(versionExpression, options, callback) {
20
17
  const storagePaths = options.storagePath ? createStoragePaths(options.storagePath) : DEFAULT_STORAGE_PATHS;
21
- const dest = options.installPath ? options.installPath : storagePaths.installPath;
22
18
  options = {
23
19
  ...storagePaths,
24
20
  ...DEFAULT_OPTIONS,
@@ -32,24 +28,14 @@ export default function install(versionExpression, options, callback) {
32
28
  mkdirp(options.cachePath, (err)=>{
33
29
  if (err) return callback(err);
34
30
  const version = versions[0];
35
- let installPath = dest;
36
- if (options.name) installPath = path.join(installPath, options.name);
37
- else if (!options.installPath) installPath = path.join(installPath, version.version);
38
- const binRoot = isWindows ? installPath : path.join(installPath, 'bin');
39
- const execPath = path.join(binRoot, NODE);
40
- checkMissing(dest, options, (err, missing)=>{
41
- if (err || !missing.length) return callback(err, dest);
31
+ const result = createResult(options, version.version);
32
+ checkMissing(result.installPath, options, (err, missing)=>{
33
+ if (err || !missing.length) return callback(err, result);
42
34
  const queue = new Queue(1);
43
- queue.defer(ensureDestinationParent.bind(null, dest));
44
- !~missing.indexOf('node') || queue.defer(installNode.bind(null, version, dest, options));
45
- !~missing.indexOf('npm') || queue.defer(installNPM.bind(null, version, dest, options));
46
- queue.await((err)=>{
47
- err ? callback(err) : callback(null, {
48
- version: version.version,
49
- installPath,
50
- execPath
51
- });
52
- });
35
+ queue.defer(ensureDestinationParent.bind(null, result.installPath));
36
+ !~missing.indexOf('node') || queue.defer(installNode.bind(null, version, result.installPath, options));
37
+ !~missing.indexOf('npm') || queue.defer(installNPM.bind(null, version, result.installPath, options));
38
+ queue.await((err)=>err ? callback(err) : callback(null, result));
53
39
  });
54
40
  });
55
41
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/workers/install.ts"],"sourcesContent":["import path from 'path';\nimport mkdirp from 'mkdirp-classic';\nimport Queue from 'queue-cb';\nimport { NODE, isWindows } from '../constants';\n\nimport home from 'homedir-polyfill';\nimport createStoragePaths from '../createStoragePaths';\nconst DEFAULT_ROOT_PATH = path.join(home(), '.nir');\nconst DEFAULT_STORAGE_PATHS = createStoragePaths(DEFAULT_ROOT_PATH);\n\nimport resolveVersions from 'node-resolve-versions';\n\nimport installNPM from '../installNPM/index';\nimport installNode from '../installNode/index';\nimport checkMissing from '../lib/checkMissing';\nimport ensureDestinationParent from '../lib/ensureDestinationParent';\n\nconst DEFAULT_OPTIONS = {\n downloadURL: function downloadURL(relativePath) {\n return `https://nodejs.org/dist/${relativePath}`;\n },\n};\n\nexport default function install(versionExpression, options, callback) {\n const storagePaths = options.storagePath ? createStoragePaths(options.storagePath) : DEFAULT_STORAGE_PATHS;\n const dest = options.installPath ? options.installPath : storagePaths.installPath;\n\n options = { ...storagePaths, ...DEFAULT_OPTIONS, ...options, path: 'raw' };\n resolveVersions(versionExpression, options, (err, versions) => {\n if (err) return callback(err);\n if (!versions.length) return callback(new Error(`Could not resolve versions for: ${versionExpression}`));\n if (versions.length !== 1) return callback(new Error(`Version ${versionExpression} resolved to multiple versions: ${versions.map((x) => x.version)}. Expecting one.`));\n\n mkdirp(options.cachePath, (err) => {\n if (err) return callback(err);\n const version = versions[0];\n\n let installPath = dest;\n if (options.name) installPath = path.join(installPath, options.name);\n else if (!options.installPath) installPath = path.join(installPath, version.version);\n const binRoot = isWindows ? installPath : path.join(installPath, 'bin');\n const execPath = path.join(binRoot, NODE);\n\n checkMissing(dest, options, (err, missing) => {\n if (err || !missing.length) return callback(err, dest);\n\n const queue = new Queue(1);\n queue.defer(ensureDestinationParent.bind(null, dest));\n !~missing.indexOf('node') || queue.defer(installNode.bind(null, version, dest, options));\n !~missing.indexOf('npm') || queue.defer(installNPM.bind(null, version, dest, options));\n queue.await((err) => {\n err ? callback(err) : callback(null, { version: version.version, installPath, execPath });\n });\n });\n });\n });\n}\n"],"names":["path","mkdirp","Queue","NODE","isWindows","home","createStoragePaths","DEFAULT_ROOT_PATH","join","DEFAULT_STORAGE_PATHS","resolveVersions","installNPM","installNode","checkMissing","ensureDestinationParent","DEFAULT_OPTIONS","downloadURL","relativePath","install","versionExpression","options","callback","storagePaths","storagePath","dest","installPath","err","versions","length","Error","map","x","version","cachePath","name","binRoot","execPath","missing","queue","defer","bind","indexOf","await"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,WAAW,WAAW;AAC7B,SAASC,IAAI,EAAEC,SAAS,QAAQ,eAAe;AAE/C,OAAOC,UAAU,mBAAmB;AACpC,OAAOC,wBAAwB,wBAAwB;AACvD,MAAMC,oBAAoBP,KAAKQ,IAAI,CAACH,QAAQ;AAC5C,MAAMI,wBAAwBH,mBAAm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AAMG,UAAU/B,YAAYqB,cAAczB,KAAKQ,IAAI,CAACiB,aAAa;YACjE,MAAMW,WAAWpC,KAAKQ,IAAI,CAAC2B,SAAShC;YAEpCU,aAAaW,MAAMJ,SAAS,CAACM,KAAKW;gBAChC,IAAIX,OAAO,CAACW,QAAQT,MAAM,EAAE,OAAOP,SAASK,KAAKF;gBAEjD,MAAMc,QAAQ,IAAIpC,MAAM;gBACxBoC,MAAMC,KAAK,CAACzB,wBAAwB0B,IAAI,CAAC,MAAMhB;gBAC/C,CAAC,CAACa,QAAQI,OAAO,CAAC,WAAWH,MAAMC,KAAK,CAAC3B,YAAY4B,IAAI,CAAC,MAAMR,SAASR,MAAMJ;gBAC/E,CAAC,CAACiB,QAAQI,OAAO,CAAC,UAAUH,MAAMC,KAAK,CAAC5B,WAAW6B,IAAI,CAAC,MAAMR,SAASR,MAAMJ;gBAC7EkB,MAAMI,KAAK,CAAC,CAAChB;oBACXA,MAAML,SAASK,OAAOL,SAAS,MAAM;wBAAEW,SAASA,QAAQA,OAAO;wBAAEP;wBAAaW;oBAAS;gBACzF;YACF;QACF;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/workers/install.ts"],"sourcesContent":["import mkdirp from 'mkdirp-classic';\nimport Queue from 'queue-cb';\nimport { DEFAULT_STORAGE_PATHS } from '../constants';\n\nimport createResult from '../createResult';\nimport createStoragePaths from '../createStoragePaths';\n\nimport resolveVersions from 'node-resolve-versions';\n\nimport installNPM from '../installNPM/index';\nimport installNode from '../installNode/index';\nimport checkMissing from '../lib/checkMissing';\nimport ensureDestinationParent from '../lib/ensureDestinationParent';\n\nconst DEFAULT_OPTIONS = {\n downloadURL: function downloadURL(relativePath) {\n return `https://nodejs.org/dist/${relativePath}`;\n },\n};\n\nexport default function install(versionExpression, options, callback) {\n const storagePaths = options.storagePath ? createStoragePaths(options.storagePath) : DEFAULT_STORAGE_PATHS;\n\n options = { ...storagePaths, ...DEFAULT_OPTIONS, ...options, path: 'raw' };\n resolveVersions(versionExpression, options, (err, versions) => {\n if (err) return callback(err);\n if (!versions.length) return callback(new Error(`Could not resolve versions for: ${versionExpression}`));\n if (versions.length !== 1) return callback(new Error(`Version ${versionExpression} resolved to multiple versions: ${versions.map((x) => x.version)}. Expecting one.`));\n\n mkdirp(options.cachePath, (err) => {\n if (err) return callback(err);\n const version = versions[0];\n const result = createResult(options, version.version);\n\n checkMissing(result.installPath, options, (err, missing) => {\n if (err || !missing.length) return callback(err, result);\n\n const queue = new Queue(1);\n queue.defer(ensureDestinationParent.bind(null, result.installPath));\n !~missing.indexOf('node') || queue.defer(installNode.bind(null, version, result.installPath, options));\n !~missing.indexOf('npm') || queue.defer(installNPM.bind(null, version, result.installPath, options));\n queue.await((err) => (err ? callback(err) : callback(null, result)));\n });\n });\n });\n}\n"],"names":["mkdirp","Queue","DEFAULT_STORAGE_PATHS","createResult","createStoragePaths","resolveVersions","installNPM","installNode","checkMissing","ensureDestinationParent","DEFAULT_OPTIONS","downloadURL","relativePath","install","versionExpression","options","callback","storagePaths","storagePath","path","err","versions","length","Error","map","x","version","cachePath","result","installPath","missing","queue","defer","bind","indexOf","await"],"mappings":"AAAA,OAAOA,YAAY,iBAAiB;AACpC,OAAOC,WAAW,WAAW;AAC7B,SAASC,qBAAqB,QAAQ,eAAe;AAErD,OAAOC,kBAAkB,kBAAkB;AAC3C,OAAOC,wBAAwB,wBAAwB;AAEvD,OAAOC,qBAAqB,wBAAwB;AAEpD,OAAOC,gBAAgB,sBAAsB;AAC7C,OAAOC,iBAAiB,uBAAuB;AAC/C,OAAOC,kBAAkB,sBAAsB;AAC/C,OAAOC,6BAA6B,iCAAiC;AAErE,MAAMC,kBAAkB;IACtBC,aAAa,SAASA,YAAYC,YAAY;QAC5C,OAAO,CAAC,wBAAwB,EAAEA,cAAc;IAClD;AACF;AAEA,eAAe,SAASC,QAAQC,iBAAiB,EAAEC,OAAO,EAAEC,QAAQ;IAClE,MAAMC,eAAeF,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2 +1,4 @@
1
1
  export declare const isWindows: boolean;
2
2
  export declare const NODE: string;
3
+ export declare const DEFAULT_ROOT_PATH: any;
4
+ export declare const DEFAULT_STORAGE_PATHS: import("./types").StorageLocations;
@@ -0,0 +1,2 @@
1
+ import type { InstallOptions, InstallResult } from './types';
2
+ export default function createResult(options: InstallOptions, version: string): InstallResult;
@@ -2,3 +2,4 @@ import './polyfills.cjs';
2
2
  import type { InstallCallback, InstallOptions, InstallResult } from './types';
3
3
  export type * from './types';
4
4
  export default function install(versionExpression: string, options?: InstallOptions | InstallCallback, callback?: InstallCallback): undefined | Promise<InstallResult>;
5
+ export { default as createStoragePaths } from './createStoragePaths';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-install-release",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
4
  "description": "Cross-platform solution for installing releases of Node.js",
5
5
  "keywords": [
6
6
  "node",