node-install-release 1.9.6 → 1.10.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.
Files changed (79) hide show
  1. package/README.md +4 -4
  2. package/dist/cjs/cli.cjs +0 -2
  3. package/dist/cjs/cli.cjs.map +1 -1
  4. package/dist/cjs/constants.cjs +33 -15
  5. package/dist/cjs/constants.cjs.map +1 -1
  6. package/dist/cjs/createResult.cjs +5 -3
  7. package/dist/cjs/createResult.cjs.map +1 -1
  8. package/dist/cjs/installNPM/installBin.cjs +5 -8
  9. package/dist/cjs/installNPM/installBin.cjs.map +1 -1
  10. package/dist/cjs/installNPM/installLib.cjs +1 -1
  11. package/dist/cjs/installNPM/installLib.cjs.map +1 -1
  12. package/dist/cjs/installNode/index.cjs +33 -34
  13. package/dist/cjs/installNode/index.cjs.map +1 -1
  14. package/dist/cjs/installNode/installCompressed.cjs +5 -33
  15. package/dist/cjs/installNode/installCompressed.cjs.map +1 -1
  16. package/dist/cjs/installNode/installExe.cjs +6 -4
  17. package/dist/cjs/installNode/installExe.cjs.map +1 -1
  18. package/dist/cjs/installNode/installFilename.cjs +6 -2
  19. package/dist/cjs/installNode/installFilename.cjs.map +1 -1
  20. package/dist/cjs/installNode/installSource/buildPosix.cjs +2 -2
  21. package/dist/cjs/installNode/installSource/buildPosix.cjs.map +1 -1
  22. package/dist/cjs/installNode/installSource/buildWin32.cjs +4 -4
  23. package/dist/cjs/installNode/installSource/buildWin32.cjs.map +1 -1
  24. package/dist/cjs/installNode/installSource/index.cjs +1 -1
  25. package/dist/cjs/installNode/installSource/index.cjs.map +1 -1
  26. package/dist/cjs/lib/checkMissing.cjs +21 -46
  27. package/dist/cjs/lib/checkMissing.cjs.map +1 -1
  28. package/dist/cjs/lib/conditionalCache.cjs +4 -32
  29. package/dist/cjs/lib/conditionalCache.cjs.map +1 -1
  30. package/dist/cjs/lib/conditionalCopy.cjs +3 -3
  31. package/dist/cjs/lib/conditionalCopy.cjs.map +1 -1
  32. package/dist/cjs/lib/conditionalExtract.cjs +4 -32
  33. package/dist/cjs/lib/conditionalExtract.cjs.map +1 -1
  34. package/dist/cjs/lib/getTarget.cjs +37 -0
  35. package/dist/cjs/lib/getTarget.cjs.map +1 -0
  36. package/dist/cjs/workers/install.cjs +3 -2
  37. package/dist/cjs/workers/install.cjs.map +1 -1
  38. package/dist/esm/cli.mjs +0 -2
  39. package/dist/esm/cli.mjs.map +1 -1
  40. package/dist/esm/constants.mjs +20 -7
  41. package/dist/esm/constants.mjs.map +1 -1
  42. package/dist/esm/createResult.mjs +6 -4
  43. package/dist/esm/createResult.mjs.map +1 -1
  44. package/dist/esm/installNPM/installBin.mjs +4 -9
  45. package/dist/esm/installNPM/installBin.mjs.map +1 -1
  46. package/dist/esm/installNPM/installLib.mjs +1 -1
  47. package/dist/esm/installNPM/installLib.mjs.map +1 -1
  48. package/dist/esm/installNode/index.mjs +28 -29
  49. package/dist/esm/installNode/index.mjs.map +1 -1
  50. package/dist/esm/installNode/installCompressed.mjs +4 -5
  51. package/dist/esm/installNode/installCompressed.mjs.map +1 -1
  52. package/dist/esm/installNode/installExe.mjs +7 -5
  53. package/dist/esm/installNode/installExe.mjs.map +1 -1
  54. package/dist/esm/installNode/installFilename.mjs +6 -2
  55. package/dist/esm/installNode/installFilename.mjs.map +1 -1
  56. package/dist/esm/installNode/installSource/buildPosix.mjs +2 -2
  57. package/dist/esm/installNode/installSource/buildPosix.mjs.map +1 -1
  58. package/dist/esm/installNode/installSource/buildWin32.mjs +4 -4
  59. package/dist/esm/installNode/installSource/buildWin32.mjs.map +1 -1
  60. package/dist/esm/installNode/installSource/index.mjs +1 -1
  61. package/dist/esm/installNode/installSource/index.mjs.map +1 -1
  62. package/dist/esm/lib/checkMissing.mjs +18 -37
  63. package/dist/esm/lib/checkMissing.mjs.map +1 -1
  64. package/dist/esm/lib/conditionalCache.mjs +3 -4
  65. package/dist/esm/lib/conditionalCache.mjs.map +1 -1
  66. package/dist/esm/lib/conditionalCopy.mjs +3 -3
  67. package/dist/esm/lib/conditionalCopy.mjs.map +1 -1
  68. package/dist/esm/lib/conditionalExtract.mjs +3 -4
  69. package/dist/esm/lib/conditionalExtract.mjs.map +1 -1
  70. package/dist/esm/lib/getTarget.mjs +21 -0
  71. package/dist/esm/lib/getTarget.mjs.map +1 -0
  72. package/dist/esm/types.mjs.map +1 -1
  73. package/dist/esm/workers/install.mjs +4 -2
  74. package/dist/esm/workers/install.mjs.map +1 -1
  75. package/dist/types/constants.d.ts +14 -5
  76. package/dist/types/lib/checkMissing.d.ts +0 -10
  77. package/dist/types/lib/getTarget.d.ts +4 -0
  78. package/dist/types/types.d.ts +1 -0
  79. package/package.json +3 -4
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "default", {
11
11
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
12
  var _crossspawncb = /*#__PURE__*/ _interop_require_default(require("cross-spawn-cb"));
13
13
  var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
14
- var _fsaccesscompat = /*#__PURE__*/ _interop_require_default(require("fs-access-compat"));
14
+ var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
15
15
  var _conditionalCopy = /*#__PURE__*/ _interop_require_default(require("../../lib/conditionalCopy.cjs"));
16
16
  function _interop_require_default(obj) {
17
17
  return obj && obj.__esModule ? obj : {
@@ -21,16 +21,16 @@ function _interop_require_default(obj) {
21
21
  function installWin32(buildPath, dest, _options, callback) {
22
22
  var buildSource = _path.default.join(buildPath, 'out', 'Release', 'node.exe');
23
23
  var buildTarget = _path.default.join(dest, 'node.exe');
24
- (0, _fsaccesscompat.default)(buildTarget, function(err) {
24
+ _fs.default.stat(buildTarget, function(err) {
25
25
  if (!err) return callback(); // already exists
26
26
  var queue = new _queuecb.default(1);
27
- queue.defer(_fsaccesscompat.default.bind(null, buildSource, function(err) {
27
+ queue.defer(_fs.default.stat.bind(null, buildSource, function(err) {
28
28
  return !err ? callback() : (0, _crossspawncb.default)('./vcbuild', [], {
29
29
  stdio: 'inherit',
30
30
  cwd: buildPath
31
31
  });
32
32
  }));
33
- queue.defer(_conditionalCopy.default.bind(null, buildSource, buildTarget, {}));
33
+ queue.defer(_conditionalCopy.default.bind(null, buildSource, buildTarget, false));
34
34
  queue.await(callback);
35
35
  });
36
36
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installSource/buildWin32.ts"],"sourcesContent":["import path from 'path';\nimport spawn from 'cross-spawn-cb';\nimport Queue from 'queue-cb';\n\nimport access from 'fs-access-compat';\nimport conditionalCopy from '../../lib/conditionalCopy';\n\nexport default function installWin32(buildPath, dest, _options, callback) {\n const buildSource = path.join(buildPath, 'out', 'Release', 'node.exe');\n const buildTarget = path.join(dest, 'node.exe');\n\n access(buildTarget, (err) => {\n if (!err) return callback(); // already exists\n\n const queue = new Queue(1);\n queue.defer(access.bind(null, buildSource, (err) => (!err ? callback() : spawn('./vcbuild', [], { stdio: 'inherit', cwd: buildPath }))));\n queue.defer(conditionalCopy.bind(null, buildSource, buildTarget, {}));\n queue.await(callback);\n });\n}\n"],"names":["installWin32","buildPath","dest","_options","callback","buildSource","path","join","buildTarget","access","err","queue","Queue","defer","bind","spawn","stdio","cwd","conditionalCopy","await"],"mappings":";;;;+BAOA;;;eAAwBA;;;2DAPP;mEACC;8DACA;qEAEC;sEACS;;;;;;AAEb,SAASA,aAAaC,SAAS,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ;IACtE,IAAMC,cAAcC,aAAI,CAACC,IAAI,CAACN,WAAW,OAAO,WAAW;IAC3D,IAAMO,cAAcF,aAAI,CAACC,IAAI,CAACL,MAAM;IAEpCO,IAAAA,uBAAM,EAACD,aAAa,SAACE;QACnB,IAAI,CAACA,KAAK,OAAON,YAAY,iBAAiB;QAE9C,IAAMO,QAAQ,IAAIC,gBAAK,CAAC;QACxBD,MAAME,KAAK,CAACJ,uBAAM,CAACK,IAAI,CAAC,MAAMT,aAAa,SAACK;mBAAS,CAACA,MAAMN,aAAaW,IAAAA,qBAAK,EAAC,aAAa,EAAE,EAAE;gBAAEC,OAAO;gBAAWC,KAAKhB;YAAU;;QACnIU,MAAME,KAAK,CAACK,wBAAe,CAACJ,IAAI,CAAC,MAAMT,aAAaG,aAAa,CAAC;QAClEG,MAAMQ,KAAK,CAACf;IACd;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installSource/buildWin32.ts"],"sourcesContent":["import path from 'path';\nimport spawn from 'cross-spawn-cb';\nimport Queue from 'queue-cb';\n\nimport fs from 'fs';\nimport conditionalCopy from '../../lib/conditionalCopy';\n\nexport default function installWin32(buildPath, dest, _options, callback) {\n const buildSource = path.join(buildPath, 'out', 'Release', 'node.exe');\n const buildTarget = path.join(dest, 'node.exe');\n\n fs.stat(buildTarget, (err) => {\n if (!err) return callback(); // already exists\n\n const queue = new Queue(1);\n queue.defer(fs.stat.bind(null, buildSource, (err) => (!err ? callback() : spawn('./vcbuild', [], { stdio: 'inherit', cwd: buildPath }))));\n queue.defer(conditionalCopy.bind(null, buildSource, buildTarget, false));\n queue.await(callback);\n });\n}\n"],"names":["installWin32","buildPath","dest","_options","callback","buildSource","path","join","buildTarget","fs","stat","err","queue","Queue","defer","bind","spawn","stdio","cwd","conditionalCopy","await"],"mappings":";;;;+BAOA;;;eAAwBA;;;2DAPP;mEACC;8DACA;yDAEH;sEACa;;;;;;AAEb,SAASA,aAAaC,SAAS,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ;IACtE,IAAMC,cAAcC,aAAI,CAACC,IAAI,CAACN,WAAW,OAAO,WAAW;IAC3D,IAAMO,cAAcF,aAAI,CAACC,IAAI,CAACL,MAAM;IAEpCO,WAAE,CAACC,IAAI,CAACF,aAAa,SAACG;QACpB,IAAI,CAACA,KAAK,OAAOP,YAAY,iBAAiB;QAE9C,IAAMQ,QAAQ,IAAIC,gBAAK,CAAC;QACxBD,MAAME,KAAK,CAACL,WAAE,CAACC,IAAI,CAACK,IAAI,CAAC,MAAMV,aAAa,SAACM;mBAAS,CAACA,MAAMP,aAAaY,IAAAA,qBAAK,EAAC,aAAa,EAAE,EAAE;gBAAEC,OAAO;gBAAWC,KAAKjB;YAAU;;QACpIW,MAAME,KAAK,CAACK,wBAAe,CAACJ,IAAI,CAAC,MAAMV,aAAaG,aAAa;QACjEI,MAAMQ,KAAK,CAAChB;IACd;AACF"}
@@ -22,7 +22,7 @@ function _interop_require_default(obj) {
22
22
  };
23
23
  }
24
24
  function InstallSource(distPath, dest, options, callback) {
25
- var platform = options.platform || process.platform;
25
+ var platform = options.platform;
26
26
  var build = platform === 'win32' ? _buildWin32.default : _buildPosix.default;
27
27
  var downloadPath = "".concat(_constants.NODE_DIST_BASE_URL, "/").concat(distPath);
28
28
  var buildPath = _path.default.join(options.buildPath, _path.default.basename(distPath));
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installSource/index.ts"],"sourcesContent":["import path from 'path';\nimport Queue from 'queue-cb';\n\nimport { NODE_DIST_BASE_URL } from '../../constants';\nimport conditionalCache from '../../lib/conditionalCache';\nimport conditionalExtract from '../../lib/conditionalExtract';\nimport validateDownload from '../validateDownload';\nimport buildPosix from './buildPosix';\nimport buildWin32 from './buildWin32';\n\nexport default function InstallSource(distPath, dest, options, callback) {\n const platform = options.platform || process.platform;\n const build = platform === 'win32' ? buildWin32 : buildPosix;\n const downloadPath = `${NODE_DIST_BASE_URL}/${distPath}`;\n const buildPath = path.join(options.buildPath, path.basename(distPath));\n const cachePath = path.join(options.cachePath, path.basename(downloadPath));\n\n const queue = new Queue(1);\n queue.defer(conditionalCache.bind(null, downloadPath, cachePath));\n queue.defer(validateDownload.bind(null, distPath, cachePath));\n queue.defer(conditionalExtract.bind(null, cachePath, buildPath, { strip: 1 }));\n queue.defer(build.bind(null, buildPath, dest, options));\n queue.await(callback);\n}\n"],"names":["InstallSource","distPath","dest","options","callback","platform","process","build","buildWin32","buildPosix","downloadPath","NODE_DIST_BASE_URL","buildPath","path","join","basename","cachePath","queue","Queue","defer","conditionalCache","bind","validateDownload","conditionalExtract","strip","await"],"mappings":";;;;+BAUA;;;eAAwBA;;;2DAVP;8DACC;yBAEiB;uEACN;yEACE;uEACF;iEACN;iEACA;;;;;;AAER,SAASA,cAAcC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACrE,IAAMC,WAAWF,QAAQE,QAAQ,IAAIC,QAAQD,QAAQ;IACrD,IAAME,QAAQF,aAAa,UAAUG,mBAAU,GAAGC,mBAAU;IAC5D,IAAMC,eAAe,AAAC,GAAwBT,OAAtBU,6BAAkB,EAAC,KAAY,OAATV;IAC9C,IAAMW,YAAYC,aAAI,CAACC,IAAI,CAACX,QAAQS,SAAS,EAAEC,aAAI,CAACE,QAAQ,CAACd;IAC7D,IAAMe,YAAYH,aAAI,CAACC,IAAI,CAACX,QAAQa,SAAS,EAAEH,aAAI,CAACE,QAAQ,CAACL;IAE7D,IAAMO,QAAQ,IAAIC,gBAAK,CAAC;IACxBD,MAAME,KAAK,CAACC,yBAAgB,CAACC,IAAI,CAAC,MAAMX,cAAcM;IACtDC,MAAME,KAAK,CAACG,yBAAgB,CAACD,IAAI,CAAC,MAAMpB,UAAUe;IAClDC,MAAME,KAAK,CAACI,2BAAkB,CAACF,IAAI,CAAC,MAAML,WAAWJ,WAAW;QAAEY,OAAO;IAAE;IAC3EP,MAAME,KAAK,CAACZ,MAAMc,IAAI,CAAC,MAAMT,WAAWV,MAAMC;IAC9Cc,MAAMQ,KAAK,CAACrB;AACd"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installSource/index.ts"],"sourcesContent":["import path from 'path';\nimport Queue from 'queue-cb';\n\nimport { NODE_DIST_BASE_URL } from '../../constants';\nimport conditionalCache from '../../lib/conditionalCache';\nimport conditionalExtract from '../../lib/conditionalExtract';\nimport validateDownload from '../validateDownload';\nimport buildPosix from './buildPosix';\nimport buildWin32 from './buildWin32';\n\nexport default function InstallSource(distPath, dest, options, callback) {\n const platform = options.platform;\n const build = platform === 'win32' ? buildWin32 : buildPosix;\n const downloadPath = `${NODE_DIST_BASE_URL}/${distPath}`;\n const buildPath = path.join(options.buildPath, path.basename(distPath));\n const cachePath = path.join(options.cachePath, path.basename(downloadPath));\n\n const queue = new Queue(1);\n queue.defer(conditionalCache.bind(null, downloadPath, cachePath));\n queue.defer(validateDownload.bind(null, distPath, cachePath));\n queue.defer(conditionalExtract.bind(null, cachePath, buildPath, { strip: 1 }));\n queue.defer(build.bind(null, buildPath, dest, options));\n queue.await(callback);\n}\n"],"names":["InstallSource","distPath","dest","options","callback","platform","build","buildWin32","buildPosix","downloadPath","NODE_DIST_BASE_URL","buildPath","path","join","basename","cachePath","queue","Queue","defer","conditionalCache","bind","validateDownload","conditionalExtract","strip","await"],"mappings":";;;;+BAUA;;;eAAwBA;;;2DAVP;8DACC;yBAEiB;uEACN;yEACE;uEACF;iEACN;iEACA;;;;;;AAER,SAASA,cAAcC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACrE,IAAMC,WAAWF,QAAQE,QAAQ;IACjC,IAAMC,QAAQD,aAAa,UAAUE,mBAAU,GAAGC,mBAAU;IAC5D,IAAMC,eAAe,AAAC,GAAwBR,OAAtBS,6BAAkB,EAAC,KAAY,OAATT;IAC9C,IAAMU,YAAYC,aAAI,CAACC,IAAI,CAACV,QAAQQ,SAAS,EAAEC,aAAI,CAACE,QAAQ,CAACb;IAC7D,IAAMc,YAAYH,aAAI,CAACC,IAAI,CAACV,QAAQY,SAAS,EAAEH,aAAI,CAACE,QAAQ,CAACL;IAE7D,IAAMO,QAAQ,IAAIC,gBAAK,CAAC;IACxBD,MAAME,KAAK,CAACC,yBAAgB,CAACC,IAAI,CAAC,MAAMX,cAAcM;IACtDC,MAAME,KAAK,CAACG,yBAAgB,CAACD,IAAI,CAAC,MAAMnB,UAAUc;IAClDC,MAAME,KAAK,CAACI,2BAAkB,CAACF,IAAI,CAAC,MAAML,WAAWJ,WAAW;QAAEY,OAAO;IAAE;IAC3EP,MAAME,KAAK,CAACZ,MAAMc,IAAI,CAAC,MAAMT,WAAWT,MAAMC;IAC9Ca,MAAMQ,KAAK,CAACpB;AACd"}
@@ -2,63 +2,38 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
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
- PLATFORM_FILES: function() {
13
- return PLATFORM_FILES;
14
- },
15
- default: function() {
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
16
8
  return checkMissing;
17
9
  }
18
10
  });
19
11
  var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
20
12
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
21
- var _lodashkeys = /*#__PURE__*/ _interop_require_default(require("lodash.keys"));
13
+ var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
14
+ var _constants = require("../constants.cjs");
22
15
  function _interop_require_default(obj) {
23
16
  return obj && obj.__esModule ? obj : {
24
17
  default: obj
25
18
  };
26
19
  }
27
- var PLATFORM_FILES = {
28
- win32: {
29
- node: [
30
- 'node.exe'
31
- ],
32
- npm: [
33
- 'npm',
34
- 'npm.cmd'
35
- ]
36
- },
37
- posix: {
38
- node: [
39
- 'node'
40
- ],
41
- npm: [
42
- 'npm'
43
- ]
44
- }
45
- };
46
20
  function checkMissing(dest, options, callback) {
47
- var platform = options.platform || process.platform;
48
- var files = PLATFORM_FILES[platform] || PLATFORM_FILES.posix;
49
- var binPath = platform === 'win32' ? dest : _path.default.join(dest, 'bin');
50
- _fs.default.readdir(binPath, function(err, names) {
51
- if (err || !names.length) return callback(null, (0, _lodashkeys.default)(files));
52
- var missing = [];
53
- for(var key in files){
54
- var needed = files[key];
55
- for(var index = 0; index < needed.length; index++){
56
- if (!~names.indexOf(needed[index])) {
57
- missing.push(key);
58
- break;
59
- }
60
- }
61
- }
21
+ var platform = options.platform;
22
+ var nodePath = _constants.NODE_FILE_PATHS[platform] || _constants.NODE_FILE_PATHS.posix;
23
+ var npmPaths = _constants.NPM_FILE_PATHS[platform] || _constants.NPM_FILE_PATHS.posix;
24
+ var missing = [];
25
+ function check(filePath, key, cb) {
26
+ _fs.default.stat(_path.default.join(dest, filePath), function(err) {
27
+ if (err && missing.indexOf(key) < 0) missing.push(key);
28
+ cb();
29
+ });
30
+ }
31
+ var queue = new _queuecb.default();
32
+ queue.defer(check.bind(null, nodePath, 'node'));
33
+ for(var key in npmPaths){
34
+ if (!npmPaths[key].optional) queue.defer(check.bind(null, npmPaths[key].dest, 'npm'));
35
+ }
36
+ queue.await(function() {
62
37
  return callback(null, missing);
63
38
  });
64
39
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/checkMissing.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport keys from 'lodash.keys';\n\nexport const PLATFORM_FILES = {\n win32: {\n node: ['node.exe'],\n npm: ['npm', 'npm.cmd'],\n },\n posix: {\n node: ['node'],\n npm: ['npm'],\n },\n};\n\nexport default function checkMissing(dest, options, callback) {\n const platform = options.platform || process.platform;\n const files = PLATFORM_FILES[platform] || PLATFORM_FILES.posix;\n const binPath = platform === 'win32' ? dest : path.join(dest, 'bin');\n\n fs.readdir(binPath, (err, names) => {\n if (err || !names.length) return callback(null, keys(files));\n\n const missing = [];\n for (const key in files) {\n const needed = files[key];\n for (let index = 0; index < needed.length; index++) {\n if (!~names.indexOf(needed[index])) {\n missing.push(key);\n break;\n }\n }\n }\n return callback(null, missing);\n });\n}\n"],"names":["PLATFORM_FILES","checkMissing","win32","node","npm","posix","dest","options","callback","platform","process","files","binPath","path","join","fs","readdir","err","names","length","keys","missing","key","needed","index","indexOf","push"],"mappings":";;;;;;;;;;;IAIaA,cAAc;eAAdA;;IAWb,OAoBC;eApBuBC;;;yDAfT;2DACE;iEACA;;;;;;AAEV,IAAMD,iBAAiB;IAC5BE,OAAO;QACLC,MAAM;YAAC;SAAW;QAClBC,KAAK;YAAC;YAAO;SAAU;IACzB;IACAC,OAAO;QACLF,MAAM;YAAC;SAAO;QACdC,KAAK;YAAC;SAAM;IACd;AACF;AAEe,SAASH,aAAaK,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC1D,IAAMC,WAAWF,QAAQE,QAAQ,IAAIC,QAAQD,QAAQ;IACrD,IAAME,QAAQX,cAAc,CAACS,SAAS,IAAIT,eAAeK,KAAK;IAC9D,IAAMO,UAAUH,aAAa,UAAUH,OAAOO,aAAI,CAACC,IAAI,CAACR,MAAM;IAE9DS,WAAE,CAACC,OAAO,CAACJ,SAAS,SAACK,KAAKC;QACxB,IAAID,OAAO,CAACC,MAAMC,MAAM,EAAE,OAAOX,SAAS,MAAMY,IAAAA,mBAAI,EAACT;QAErD,IAAMU,UAAU,EAAE;QAClB,IAAK,IAAMC,OAAOX,MAAO;YACvB,IAAMY,SAASZ,KAAK,CAACW,IAAI;YACzB,IAAK,IAAIE,QAAQ,GAAGA,QAAQD,OAAOJ,MAAM,EAAEK,QAAS;gBAClD,IAAI,CAAC,CAACN,MAAMO,OAAO,CAACF,MAAM,CAACC,MAAM,GAAG;oBAClCH,QAAQK,IAAI,CAACJ;oBACb;gBACF;YACF;QACF;QACA,OAAOd,SAAS,MAAMa;IACxB;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/checkMissing.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport Queue from 'queue-cb';\n\nimport { NODE_FILE_PATHS, NPM_FILE_PATHS } from '../constants';\n\nexport default function checkMissing(dest, options, callback) {\n const platform = options.platform;\n const nodePath = NODE_FILE_PATHS[platform] || NODE_FILE_PATHS.posix;\n const npmPaths = NPM_FILE_PATHS[platform] || NPM_FILE_PATHS.posix;\n\n const missing = [];\n function check(filePath, key, cb) {\n fs.stat(path.join(dest, filePath), (err) => {\n if (err && missing.indexOf(key) < 0) missing.push(key);\n cb();\n });\n }\n\n const queue = new Queue();\n queue.defer(check.bind(null, nodePath, 'node'));\n for (const key in npmPaths) {\n if (!npmPaths[key].optional) queue.defer(check.bind(null, npmPaths[key].dest, 'npm'));\n }\n queue.await(() => callback(null, missing));\n}\n"],"names":["checkMissing","dest","options","callback","platform","nodePath","NODE_FILE_PATHS","posix","npmPaths","NPM_FILE_PATHS","missing","check","filePath","key","cb","fs","stat","path","join","err","indexOf","push","queue","Queue","defer","bind","optional","await"],"mappings":";;;;+BAMA;;;eAAwBA;;;yDANT;2DACE;8DACC;yBAE8B;;;;;;AAEjC,SAASA,aAAaC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC1D,IAAMC,WAAWF,QAAQE,QAAQ;IACjC,IAAMC,WAAWC,0BAAe,CAACF,SAAS,IAAIE,0BAAe,CAACC,KAAK;IACnE,IAAMC,WAAWC,yBAAc,CAACL,SAAS,IAAIK,yBAAc,CAACF,KAAK;IAEjE,IAAMG,UAAU,EAAE;IAClB,SAASC,MAAMC,QAAQ,EAAEC,GAAG,EAAEC,EAAE;QAC9BC,WAAE,CAACC,IAAI,CAACC,aAAI,CAACC,IAAI,CAACjB,MAAMW,WAAW,SAACO;YAClC,IAAIA,OAAOT,QAAQU,OAAO,CAACP,OAAO,GAAGH,QAAQW,IAAI,CAACR;YAClDC;QACF;IACF;IAEA,IAAMQ,QAAQ,IAAIC,gBAAK;IACvBD,MAAME,KAAK,CAACb,MAAMc,IAAI,CAAC,MAAMpB,UAAU;IACvC,IAAK,IAAMQ,OAAOL,SAAU;QAC1B,IAAI,CAACA,QAAQ,CAACK,IAAI,CAACa,QAAQ,EAAEJ,MAAME,KAAK,CAACb,MAAMc,IAAI,CAAC,MAAMjB,QAAQ,CAACK,IAAI,CAACZ,IAAI,EAAE;IAChF;IACAqB,MAAMK,KAAK,CAAC;eAAMxB,SAAS,MAAMO;;AACnC"}
@@ -8,57 +8,29 @@ Object.defineProperty(exports, "default", {
8
8
  return conditionalCache;
9
9
  }
10
10
  });
11
+ var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
11
12
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
- var _fsaccesscompat = /*#__PURE__*/ _interop_require_default(require("fs-access-compat"));
13
13
  var _getremote = /*#__PURE__*/ _interop_require_default(require("get-remote"));
14
14
  var _ensureDestinationParent = /*#__PURE__*/ _interop_require_default(require("./ensureDestinationParent.cjs"));
15
- function _define_property(obj, key, value) {
16
- if (key in obj) {
17
- Object.defineProperty(obj, key, {
18
- value: value,
19
- enumerable: true,
20
- configurable: true,
21
- writable: true
22
- });
23
- } else {
24
- obj[key] = value;
25
- }
26
- return obj;
27
- }
28
15
  function _interop_require_default(obj) {
29
16
  return obj && obj.__esModule ? obj : {
30
17
  default: obj
31
18
  };
32
19
  }
33
- function _object_spread(target) {
34
- for(var i = 1; i < arguments.length; i++){
35
- var source = arguments[i] != null ? arguments[i] : {};
36
- var ownKeys = Object.keys(source);
37
- if (typeof Object.getOwnPropertySymbols === "function") {
38
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
39
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
40
- }));
41
- }
42
- ownKeys.forEach(function(key) {
43
- _define_property(target, key, source[key]);
44
- });
45
- }
46
- return target;
47
- }
48
20
  function conditionalCache(endpoint, dest, options, callback) {
49
21
  if (typeof options === 'function') {
50
22
  callback = options;
51
23
  options = null;
52
24
  }
53
25
  options = options || {};
54
- (0, _fsaccesscompat.default)(dest, function(err) {
26
+ _fs.default.stat(dest, function(err) {
55
27
  if (!err) return callback(); // already exists
56
28
  (0, _ensureDestinationParent.default)(dest, function(err) {
57
29
  if (err) return callback(err);
58
- (0, _getremote.default)(endpoint, _object_spread({
30
+ (0, _getremote.default)(endpoint, {
59
31
  filename: _path.default.basename(dest),
60
32
  time: 1000
61
- }, options)).file(_path.default.dirname(dest), callback);
33
+ }).file(_path.default.dirname(dest), callback);
62
34
  });
63
35
  });
64
36
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/conditionalCache.ts"],"sourcesContent":["import path from 'path';\nimport access from 'fs-access-compat';\nimport get from 'get-remote';\n\nimport ensureDestinationParent from './ensureDestinationParent';\n\nexport default function conditionalCache(endpoint, dest, options, callback?) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n\n access(dest, (err) => {\n if (!err) return callback(); // already exists\n\n ensureDestinationParent(dest, (err) => {\n if (err) return callback(err);\n get(endpoint, { filename: path.basename(dest), time: 1000, ...options }).file(path.dirname(dest), callback);\n });\n });\n}\n"],"names":["conditionalCache","endpoint","dest","options","callback","access","err","ensureDestinationParent","get","filename","path","basename","time","file","dirname"],"mappings":";;;;+BAMA;;;eAAwBA;;;2DANP;qEACE;gEACH;8EAEoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErB,SAASA,iBAAiBC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAS;IACzE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IAEtBE,IAAAA,uBAAM,EAACH,MAAM,SAACI;QACZ,IAAI,CAACA,KAAK,OAAOF,YAAY,iBAAiB;QAE9CG,IAAAA,gCAAuB,EAACL,MAAM,SAACI;YAC7B,IAAIA,KAAK,OAAOF,SAASE;YACzBE,IAAAA,kBAAG,EAACP,UAAU;gBAAEQ,UAAUC,aAAI,CAACC,QAAQ,CAACT;gBAAOU,MAAM;eAAST,UAAWU,IAAI,CAACH,aAAI,CAACI,OAAO,CAACZ,OAAOE;QACpG;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/conditionalCache.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport get from 'get-remote';\n\nimport ensureDestinationParent from './ensureDestinationParent';\n\nexport default function conditionalCache(endpoint, dest, options, callback?) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n\n fs.stat(dest, (err) => {\n if (!err) return callback(); // already exists\n\n ensureDestinationParent(dest, (err) => {\n if (err) return callback(err);\n get(endpoint, { filename: path.basename(dest), time: 1000 }).file(path.dirname(dest), callback);\n });\n });\n}\n"],"names":["conditionalCache","endpoint","dest","options","callback","fs","stat","err","ensureDestinationParent","get","filename","path","basename","time","file","dirname"],"mappings":";;;;+BAMA;;;eAAwBA;;;yDANT;2DACE;gEACD;8EAEoB;;;;;;AAErB,SAASA,iBAAiBC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAS;IACzE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IAEtBE,WAAE,CAACC,IAAI,CAACJ,MAAM,SAACK;QACb,IAAI,CAACA,KAAK,OAAOH,YAAY,iBAAiB;QAE9CI,IAAAA,gCAAuB,EAACN,MAAM,SAACK;YAC7B,IAAIA,KAAK,OAAOH,SAASG;YACzBE,IAAAA,kBAAG,EAACR,UAAU;gBAAES,UAAUC,aAAI,CAACC,QAAQ,CAACV;gBAAOW,MAAM;YAAK,GAAGC,IAAI,CAACH,aAAI,CAACI,OAAO,CAACb,OAAOE;QACxF;IACF;AACF"}
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "default", {
8
8
  return conditionalCopy;
9
9
  }
10
10
  });
11
- var _fsaccesscompat = /*#__PURE__*/ _interop_require_default(require("fs-access-compat"));
11
+ var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
12
12
  var _copyFile = /*#__PURE__*/ _interop_require_default(require("./copyFile.cjs"));
13
13
  function _interop_require_default(obj) {
14
14
  return obj && obj.__esModule ? obj : {
@@ -17,9 +17,9 @@ function _interop_require_default(obj) {
17
17
  }
18
18
  function conditionalCopy(src, dest, optional, callback) {
19
19
  if (typeof optional === 'function') return callback(new Error('conditionalCopy missing options'));
20
- (0, _fsaccesscompat.default)(dest, function(err) {
20
+ _fs.default.stat(dest, function(err) {
21
21
  if (!err) return callback(); // already exists
22
- (0, _fsaccesscompat.default)(src, function(err) {
22
+ _fs.default.stat(src, function(err) {
23
23
  err && optional ? callback() : (0, _copyFile.default)(src, dest, callback); // optional file missing
24
24
  });
25
25
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/conditionalCopy.ts"],"sourcesContent":["import access from 'fs-access-compat';\nimport copyFile from './copyFile';\n\nexport default function conditionalCopy(src, dest, optional, callback) {\n if (typeof optional === 'function') return callback(new Error('conditionalCopy missing options'));\n\n access(dest, (err) => {\n if (!err) return callback(); // already exists\n\n access(src, (err) => {\n err && optional ? callback() : copyFile(src, dest, callback); // optional file missing\n });\n });\n}\n"],"names":["conditionalCopy","src","dest","optional","callback","Error","access","err","copyFile"],"mappings":";;;;+BAGA;;;eAAwBA;;;qEAHL;+DACE;;;;;;AAEN,SAASA,gBAAgBC,GAAG,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ;IACnE,IAAI,OAAOD,aAAa,YAAY,OAAOC,SAAS,IAAIC,MAAM;IAE9DC,IAAAA,uBAAM,EAACJ,MAAM,SAACK;QACZ,IAAI,CAACA,KAAK,OAAOH,YAAY,iBAAiB;QAE9CE,IAAAA,uBAAM,EAACL,KAAK,SAACM;YACXA,OAAOJ,WAAWC,aAAaI,IAAAA,iBAAQ,EAACP,KAAKC,MAAME,WAAW,wBAAwB;QACxF;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/conditionalCopy.ts"],"sourcesContent":["import fs from 'fs';\nimport copyFile from './copyFile';\n\nexport default function conditionalCopy(src, dest, optional, callback) {\n if (typeof optional === 'function') return callback(new Error('conditionalCopy missing options'));\n\n fs.stat(dest, (err) => {\n if (!err) return callback(); // already exists\n\n fs.stat(src, (err) => {\n err && optional ? callback() : copyFile(src, dest, callback); // optional file missing\n });\n });\n}\n"],"names":["conditionalCopy","src","dest","optional","callback","Error","fs","stat","err","copyFile"],"mappings":";;;;+BAGA;;;eAAwBA;;;yDAHT;+DACM;;;;;;AAEN,SAASA,gBAAgBC,GAAG,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ;IACnE,IAAI,OAAOD,aAAa,YAAY,OAAOC,SAAS,IAAIC,MAAM;IAE9DC,WAAE,CAACC,IAAI,CAACL,MAAM,SAACM;QACb,IAAI,CAACA,KAAK,OAAOJ,YAAY,iBAAiB;QAE9CE,WAAE,CAACC,IAAI,CAACN,KAAK,SAACO;YACZA,OAAOL,WAAWC,aAAaK,IAAAA,iBAAQ,EAACR,KAAKC,MAAME,WAAW,wBAAwB;QACxF;IACF;AACF"}
@@ -8,58 +8,30 @@ Object.defineProperty(exports, "default", {
8
8
  return conditionalExtract;
9
9
  }
10
10
  });
11
+ var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
11
12
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
13
  var _fastextract = /*#__PURE__*/ _interop_require_default(require("fast-extract"));
13
- var _fsaccesscompat = /*#__PURE__*/ _interop_require_default(require("fs-access-compat"));
14
14
  var _mkdirpclassic = /*#__PURE__*/ _interop_require_default(require("mkdirp-classic"));
15
15
  var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
16
- function _define_property(obj, key, value) {
17
- if (key in obj) {
18
- Object.defineProperty(obj, key, {
19
- value: value,
20
- enumerable: true,
21
- configurable: true,
22
- writable: true
23
- });
24
- } else {
25
- obj[key] = value;
26
- }
27
- return obj;
28
- }
29
16
  function _interop_require_default(obj) {
30
17
  return obj && obj.__esModule ? obj : {
31
18
  default: obj
32
19
  };
33
20
  }
34
- function _object_spread(target) {
35
- for(var i = 1; i < arguments.length; i++){
36
- var source = arguments[i] != null ? arguments[i] : {};
37
- var ownKeys = Object.keys(source);
38
- if (typeof Object.getOwnPropertySymbols === "function") {
39
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
40
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
41
- }));
42
- }
43
- ownKeys.forEach(function(key) {
44
- _define_property(target, key, source[key]);
45
- });
46
- }
47
- return target;
48
- }
49
21
  function conditionalExtract(src, dest, options, callback) {
50
22
  if (typeof options === 'function') {
51
23
  callback = options;
52
24
  options = null;
53
25
  }
54
26
  options = options || {};
55
- (0, _fsaccesscompat.default)(dest, function(err) {
27
+ _fs.default.stat(dest, function(err) {
56
28
  if (!err) return callback(); // already exists
57
29
  var queue = new _queuecb.default(1);
58
30
  queue.defer(_mkdirpclassic.default.bind(null, _path.default.dirname(dest)));
59
- queue.defer(_fastextract.default.bind(null, src, dest, _object_spread({
31
+ queue.defer(_fastextract.default.bind(null, src, dest, {
60
32
  strip: 1,
61
33
  time: 1000
62
- }, options)));
34
+ }));
63
35
  queue.await(callback);
64
36
  });
65
37
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/conditionalExtract.ts"],"sourcesContent":["import path from 'path';\nimport extract from 'fast-extract';\nimport access from 'fs-access-compat';\nimport mkdirp from 'mkdirp-classic';\nimport Queue from 'queue-cb';\n\nexport default function conditionalExtract(src, dest, options, callback?) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n\n access(dest, (err) => {\n if (!err) return callback(); // already exists\n\n const queue = new Queue(1);\n queue.defer(mkdirp.bind(null, path.dirname(dest)));\n queue.defer(extract.bind(null, src, dest, { strip: 1, time: 1000, ...options }));\n queue.await(callback);\n });\n}\n"],"names":["conditionalExtract","src","dest","options","callback","access","err","queue","Queue","defer","mkdirp","bind","path","dirname","extract","strip","time","await"],"mappings":";;;;+BAMA;;;eAAwBA;;;2DANP;kEACG;qEACD;oEACA;8DACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,SAASA,mBAAmBC,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAS;IACtE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IAEtBE,IAAAA,uBAAM,EAACH,MAAM,SAACI;QACZ,IAAI,CAACA,KAAK,OAAOF,YAAY,iBAAiB;QAE9C,IAAMG,QAAQ,IAAIC,gBAAK,CAAC;QACxBD,MAAME,KAAK,CAACC,sBAAM,CAACC,IAAI,CAAC,MAAMC,aAAI,CAACC,OAAO,CAACX;QAC3CK,MAAME,KAAK,CAACK,oBAAO,CAACH,IAAI,CAAC,MAAMV,KAAKC,MAAM;YAAEa,OAAO;YAAGC,MAAM;WAASb;QACrEI,MAAMU,KAAK,CAACb;IACd;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/conditionalExtract.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport extract from 'fast-extract';\nimport mkdirp from 'mkdirp-classic';\nimport Queue from 'queue-cb';\n\nexport default function conditionalExtract(src, dest, options, callback?) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n\n fs.stat(dest, (err) => {\n if (!err) return callback(); // already exists\n\n const queue = new Queue(1);\n queue.defer(mkdirp.bind(null, path.dirname(dest)));\n queue.defer(extract.bind(null, src, dest, { strip: 1, time: 1000 }));\n queue.await(callback);\n });\n}\n"],"names":["conditionalExtract","src","dest","options","callback","fs","stat","err","queue","Queue","defer","mkdirp","bind","path","dirname","extract","strip","time","await"],"mappings":";;;;+BAMA;;;eAAwBA;;;yDANT;2DACE;kEACG;oEACD;8DACD;;;;;;AAEH,SAASA,mBAAmBC,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAS;IACtE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IAEtBE,WAAE,CAACC,IAAI,CAACJ,MAAM,SAACK;QACb,IAAI,CAACA,KAAK,OAAOH,YAAY,iBAAiB;QAE9C,IAAMI,QAAQ,IAAIC,gBAAK,CAAC;QACxBD,MAAME,KAAK,CAACC,sBAAM,CAACC,IAAI,CAAC,MAAMC,aAAI,CAACC,OAAO,CAACZ;QAC3CM,MAAME,KAAK,CAACK,oBAAO,CAACH,IAAI,CAAC,MAAMX,KAAKC,MAAM;YAAEc,OAAO;YAAGC,MAAM;QAAK;QACjET,MAAMU,KAAK,CAACd;IACd;AACF"}
@@ -0,0 +1,37 @@
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 getTarget;
9
+ }
10
+ });
11
+ var _constants = require("../constants.cjs");
12
+ var _archcjs = /*#__PURE__*/ _interop_require_default(require("../machine/arch.cjs"));
13
+ function _interop_require_default(obj) {
14
+ return obj && obj.__esModule ? obj : {
15
+ default: obj
16
+ };
17
+ }
18
+ var archMachine;
19
+ function getTarget(options) {
20
+ var platform = options.platform;
21
+ var arch = options.arch;
22
+ if (options.filename) {
23
+ var filePlatform = options.filename.split('-')[0];
24
+ if (_constants.FILE_PLATFORMS.indexOf(filePlatform) >= 0) platform = _constants.FILE_PLATFORM_MAP[filePlatform] || filePlatform;
25
+ arch = options.filename.split('-')[1];
26
+ }
27
+ if (!platform) platform = process.platform;
28
+ if (!arch) {
29
+ if (!archMachine) archMachine = (0, _archcjs.default)(); // call first time needed
30
+ arch = archMachine;
31
+ }
32
+ return {
33
+ platform: platform,
34
+ arch: arch
35
+ };
36
+ }
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; }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/getTarget.ts"],"sourcesContent":["import { FILE_PLATFORMS, FILE_PLATFORM_MAP } from '../constants';\nimport machineArch from '../machine/arch.cjs';\n\nlet archMachine: NodeJS.Architecture;\nexport default function getTarget(options) {\n let platform = options.platform;\n let arch = options.arch;\n if (options.filename) {\n const filePlatform = options.filename.split('-')[0];\n if (FILE_PLATFORMS.indexOf(filePlatform) >= 0) platform = FILE_PLATFORM_MAP[filePlatform] || filePlatform;\n arch = options.filename.split('-')[1];\n }\n if (!platform) platform = process.platform;\n if (!arch) {\n if (!archMachine) archMachine = machineArch() as NodeJS.Architecture; // call first time needed\n arch = archMachine;\n }\n return { platform, arch };\n}\n"],"names":["getTarget","archMachine","options","platform","arch","filename","filePlatform","split","FILE_PLATFORMS","indexOf","FILE_PLATFORM_MAP","process","machineArch"],"mappings":";;;;+BAIA;;;eAAwBA;;;yBAJ0B;8DAC1B;;;;;;AAExB,IAAIC;AACW,SAASD,UAAUE,OAAO;IACvC,IAAIC,WAAWD,QAAQC,QAAQ;IAC/B,IAAIC,OAAOF,QAAQE,IAAI;IACvB,IAAIF,QAAQG,QAAQ,EAAE;QACpB,IAAMC,eAAeJ,QAAQG,QAAQ,CAACE,KAAK,CAAC,IAAI,CAAC,EAAE;QACnD,IAAIC,yBAAc,CAACC,OAAO,CAACH,iBAAiB,GAAGH,WAAWO,4BAAiB,CAACJ,aAAa,IAAIA;QAC7FF,OAAOF,QAAQG,QAAQ,CAACE,KAAK,CAAC,IAAI,CAAC,EAAE;IACvC;IACA,IAAI,CAACJ,UAAUA,WAAWQ,QAAQR,QAAQ;IAC1C,IAAI,CAACC,MAAM;QACT,IAAI,CAACH,aAAaA,cAAcW,IAAAA,gBAAW,KAA2B,yBAAyB;QAC/FR,OAAOH;IACT;IACA,OAAO;QAAEE,UAAAA;QAAUC,MAAAA;IAAK;AAC1B"}
@@ -10,11 +10,12 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  var _isversion = /*#__PURE__*/ _interop_require_default(require("is-version"));
12
12
  var _mkdirpclassic = /*#__PURE__*/ _interop_require_default(require("mkdirp-classic"));
13
+ var _noderesolveversions = /*#__PURE__*/ _interop_require_default(require("node-resolve-versions"));
13
14
  var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
14
15
  var _constants = require("../constants.cjs");
15
16
  var _createResult = /*#__PURE__*/ _interop_require_default(require("../createResult.cjs"));
16
17
  var _createStoragePaths = /*#__PURE__*/ _interop_require_default(require("../createStoragePaths.cjs"));
17
- var _noderesolveversions = /*#__PURE__*/ _interop_require_default(require("node-resolve-versions"));
18
+ var _getTarget = /*#__PURE__*/ _interop_require_default(require("../lib/getTarget.cjs"));
18
19
  var _index = /*#__PURE__*/ _interop_require_default(require("../installNPM/index.cjs"));
19
20
  var _index1 = /*#__PURE__*/ _interop_require_default(require("../installNode/index.cjs"));
20
21
  var _checkMissing = /*#__PURE__*/ _interop_require_default(require("../lib/checkMissing.cjs"));
@@ -60,7 +61,7 @@ function getVersions(versionExpression, options, callback) {
60
61
  }
61
62
  function install(versionExpression, options, callback) {
62
63
  var storagePaths = options.storagePath ? (0, _createStoragePaths.default)(options.storagePath) : _constants.DEFAULT_STORAGE_PATHS;
63
- options = _object_spread({}, storagePaths, options);
64
+ options = _object_spread({}, storagePaths, options, (0, _getTarget.default)(options));
64
65
  getVersions(versionExpression, options, function(err, versions) {
65
66
  if (err) return callback(err);
66
67
  if (!versions.length) return callback(new Error("Could not resolve versions for: ".concat(versionExpression)));
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/workers/install.ts"],"sourcesContent":["import isVersion from 'is-version';\nimport 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\n// short circuit\nfunction getVersions(versionExpression, options, callback) {\n isVersion(versionExpression) ? callback(null, [versionExpression]) : resolveVersions(versionExpression, options, callback);\n}\n\nexport default function install(versionExpression, options, callback) {\n const storagePaths = options.storagePath ? createStoragePaths(options.storagePath) : DEFAULT_STORAGE_PATHS;\n\n options = { ...storagePaths, ...options };\n getVersions(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 const version = versions[0];\n const result = createResult(options, 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(mkdirp.bind(null, options.cachePath));\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"],"names":["install","getVersions","versionExpression","options","callback","isVersion","resolveVersions","storagePaths","storagePath","createStoragePaths","DEFAULT_STORAGE_PATHS","err","versions","length","Error","map","x","version","result","createResult","checkMissing","installPath","missing","queue","Queue","defer","mkdirp","bind","cachePath","ensureDestinationParent","indexOf","installNode","installNPM","await"],"mappings":";;;;+BAoBA;;;eAAwBA;;;gEApBF;oEACH;8DACD;yBACoB;mEAEb;yEACM;0EAEH;4DAEL;6DACC;mEACC;8EACW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEpC,gBAAgB;AAChB,SAASC,YAAYC,iBAAiB,EAAEC,OAAO,EAAEC,QAAQ;IACvDC,IAAAA,kBAAS,EAACH,qBAAqBE,SAAS,MAAM;QAACF;KAAkB,IAAII,IAAAA,4BAAe,EAACJ,mBAAmBC,SAASC;AACnH;AAEe,SAASJ,QAAQE,iBAAiB,EAAEC,OAAO,EAAEC,QAAQ;IAClE,IAAMG,eAAeJ,QAAQK,WAAW,GAAGC,IAAAA,2BAAkB,EAACN,QAAQK,WAAW,IAAIE,gCAAqB;IAE1GP,UAAU,mBAAKI,cAAiBJ;IAChCF,YAAYC,mBAAmBC,SAAS,SAACQ,KAAKC;QAC5C,IAAID,KAAK,OAAOP,SAASO;QACzB,IAAI,CAACC,SAASC,MAAM,EAAE,OAAOT,SAAS,IAAIU,MAAM,AAAC,mCAAoD,OAAlBZ;QACnF,IAAIU,SAASC,MAAM,KAAK,GAAG,OAAOT,SAAS,IAAIU,MAAM,AAAC,WAA8DF,OAApDV,mBAAkB,oCAAiE,OAA/BU,SAASG,GAAG,CAAC,SAACC;mBAAMA,EAAEC,OAAO;YAAE;QAEnJ,IAAMA,UAAUL,QAAQ,CAAC,EAAE;QAC3B,IAAMM,SAASC,IAAAA,qBAAY,EAAChB,SAASc;QAErCG,IAAAA,qBAAY,EAACF,OAAOG,WAAW,EAAElB,SAAS,SAACQ,KAAKW;YAC9C,IAAIX,OAAO,CAACW,QAAQT,MAAM,EAAE,OAAOT,SAASO,KAAKO;YAEjD,IAAMK,QAAQ,IAAIC,gBAAK,CAAC;YACxBD,MAAME,KAAK,CAACC,sBAAM,CAACC,IAAI,CAAC,MAAMxB,QAAQyB,SAAS;YAC/CL,MAAME,KAAK,CAACI,gCAAuB,CAACF,IAAI,CAAC,MAAMT,OAAOG,WAAW;YACjE,CAAC,CAACC,QAAQQ,OAAO,CAAC,WAAWP,MAAME,KAAK,CAACM,eAAW,CAACJ,IAAI,CAAC,MAAMV,SAASC,OAAOG,WAAW,EAAElB;YAC7F,CAAC,CAACmB,QAAQQ,OAAO,CAAC,UAAUP,MAAME,KAAK,CAACO,cAAU,CAACL,IAAI,CAAC,MAAMV,SAASC,OAAOG,WAAW,EAAElB;YAC3FoB,MAAMU,KAAK,CAAC,SAACtB;uBAASA,MAAMP,SAASO,OAAOP,SAAS,MAAMc;;QAC7D;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/workers/install.ts"],"sourcesContent":["import isVersion from 'is-version';\nimport mkdirp from 'mkdirp-classic';\nimport resolveVersions from 'node-resolve-versions';\nimport Queue from 'queue-cb';\n\nimport { DEFAULT_STORAGE_PATHS } from '../constants';\n\nimport createResult from '../createResult';\nimport createStoragePaths from '../createStoragePaths';\nimport getTarget from '../lib/getTarget';\n\nimport installNPM from '../installNPM/index';\nimport installNode from '../installNode/index';\nimport checkMissing from '../lib/checkMissing';\nimport ensureDestinationParent from '../lib/ensureDestinationParent';\n\n// short circuit\nfunction getVersions(versionExpression, options, callback) {\n isVersion(versionExpression) ? callback(null, [versionExpression]) : resolveVersions(versionExpression, options, callback);\n}\n\nexport default function install(versionExpression, options, callback) {\n const storagePaths = options.storagePath ? createStoragePaths(options.storagePath) : DEFAULT_STORAGE_PATHS;\n options = { ...storagePaths, ...options, ...getTarget(options) };\n getVersions(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 const version = versions[0];\n const result = createResult(options, 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(mkdirp.bind(null, options.cachePath));\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"],"names":["install","getVersions","versionExpression","options","callback","isVersion","resolveVersions","storagePaths","storagePath","createStoragePaths","DEFAULT_STORAGE_PATHS","getTarget","err","versions","length","Error","map","x","version","result","createResult","checkMissing","installPath","missing","queue","Queue","defer","mkdirp","bind","cachePath","ensureDestinationParent","indexOf","installNode","installNPM","await"],"mappings":";;;;+BAqBA;;;eAAwBA;;;gEArBF;oEACH;0EACS;8DACV;yBAEoB;mEAEb;yEACM;gEACT;4DAEC;6DACC;mEACC;8EACW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEpC,gBAAgB;AAChB,SAASC,YAAYC,iBAAiB,EAAEC,OAAO,EAAEC,QAAQ;IACvDC,IAAAA,kBAAS,EAACH,qBAAqBE,SAAS,MAAM;QAACF;KAAkB,IAAII,IAAAA,4BAAe,EAACJ,mBAAmBC,SAASC;AACnH;AAEe,SAASJ,QAAQE,iBAAiB,EAAEC,OAAO,EAAEC,QAAQ;IAClE,IAAMG,eAAeJ,QAAQK,WAAW,GAAGC,IAAAA,2BAAkB,EAACN,QAAQK,WAAW,IAAIE,gCAAqB;IAC1GP,UAAU,mBAAKI,cAAiBJ,SAAYQ,IAAAA,kBAAS,EAACR;IACtDF,YAAYC,mBAAmBC,SAAS,SAACS,KAAKC;QAC5C,IAAID,KAAK,OAAOR,SAASQ;QACzB,IAAI,CAACC,SAASC,MAAM,EAAE,OAAOV,SAAS,IAAIW,MAAM,AAAC,mCAAoD,OAAlBb;QACnF,IAAIW,SAASC,MAAM,KAAK,GAAG,OAAOV,SAAS,IAAIW,MAAM,AAAC,WAA8DF,OAApDX,mBAAkB,oCAAiE,OAA/BW,SAASG,GAAG,CAAC,SAACC;mBAAMA,EAAEC,OAAO;YAAE;QAEnJ,IAAMA,UAAUL,QAAQ,CAAC,EAAE;QAC3B,IAAMM,SAASC,IAAAA,qBAAY,EAACjB,SAASe;QAErCG,IAAAA,qBAAY,EAACF,OAAOG,WAAW,EAAEnB,SAAS,SAACS,KAAKW;YAC9C,IAAIX,OAAO,CAACW,QAAQT,MAAM,EAAE,OAAOV,SAASQ,KAAKO;YAEjD,IAAMK,QAAQ,IAAIC,gBAAK,CAAC;YACxBD,MAAME,KAAK,CAACC,sBAAM,CAACC,IAAI,CAAC,MAAMzB,QAAQ0B,SAAS;YAC/CL,MAAME,KAAK,CAACI,gCAAuB,CAACF,IAAI,CAAC,MAAMT,OAAOG,WAAW;YACjE,CAAC,CAACC,QAAQQ,OAAO,CAAC,WAAWP,MAAME,KAAK,CAACM,eAAW,CAACJ,IAAI,CAAC,MAAMV,SAASC,OAAOG,WAAW,EAAEnB;YAC7F,CAAC,CAACoB,QAAQQ,OAAO,CAAC,UAAUP,MAAME,KAAK,CAACO,cAAU,CAACL,IAAI,CAAC,MAAMV,SAASC,OAAOG,WAAW,EAAEnB;YAC3FqB,MAAMU,KAAK,CAAC,SAACtB;uBAASA,MAAMR,SAASQ,OAAOR,SAAS,MAAMe;;QAC7D;IACF;AACF"}
package/dist/esm/cli.mjs CHANGED
@@ -20,9 +20,7 @@ export default ((argv)=>{
20
20
  console.log('Missing command. Example usage: nir version [directory]');
21
21
  return exit(-1);
22
22
  }
23
- console.log('cli', args[0], JSON.stringify(options));
24
23
  install(args[0], options, (err, result)=>{
25
- console.log('cli res', args[0], JSON.stringify(options), err, JSON.stringify(result));
26
24
  if (!options.silent) {
27
25
  console.log('\n======================');
28
26
  if (err) console.log(`${args[0]} not installed. Error: ${err.message}`);
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/cli.ts"],"sourcesContent":["import exit from 'exit';\nimport getopts from 'getopts-compat';\nimport install, { type InstallOptions } from './index';\n\nexport default (argv) => {\n const options = getopts(argv.slice(1), {\n alias: { platform: 'p', arch: 'a', filename: 'f', installPath: 'i', storagePath: 'c', silent: 's' },\n boolean: ['silent'],\n });\n\n const args = argv.slice(0, 1).concat(options._);\n if (args.length < 1) {\n console.log('Missing command. Example usage: nir version [directory]');\n return exit(-1);\n }\n console.log('cli', args[0], JSON.stringify(options));\n install(args[0], options as InstallOptions, (err, result) => {\n console.log('cli res', args[0], JSON.stringify(options), err, JSON.stringify(result));\n if (!options.silent) {\n console.log('\\n======================');\n if (err) console.log(`${args[0]} not installed. Error: ${err.message}`);\n else console.log(`${result.version} installed in: ${result.installPath}`);\n console.log('======================');\n }\n exit(err ? -1 : 0);\n });\n};\n"],"names":["exit","getopts","install","argv","options","slice","alias","platform","arch","filename","installPath","storagePath","silent","boolean","args","concat","_","length","console","log","JSON","stringify","err","result","message","version"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,aAAa,iBAAiB;AACrC,OAAOC,aAAsC,UAAU;AAEvD,eAAe,CAAA,CAACC;IACd,MAAMC,UAAUH,QAAQE,KAAKE,KAAK,CAAC,IAAI;QACrCC,OAAO;YAAEC,UAAU;YAAKC,MAAM;YAAKC,UAAU;YAAKC,aAAa;YAAKC,aAAa;YAAKC,QAAQ;QAAI;QAClGC,SAAS;YAAC;SAAS;IACrB;IAEA,MAAMC,OAAOX,KAAKE,KAAK,CAAC,GAAG,GAAGU,MAAM,CAACX,QAAQY,CAAC;IAC9C,IAAIF,KAAKG,MAAM,GAAG,GAAG;QACnBC,QAAQC,GAAG,CAAC;QACZ,OAAOnB,KAAK,CAAC;IACf;IACAkB,QAAQC,GAAG,CAAC,OAAOL,IAAI,CAAC,EAAE,EAAEM,KAAKC,SAAS,CAACjB;IAC3CF,QAAQY,IAAI,CAAC,EAAE,EAAEV,SAA2B,CAACkB,KAAKC;QAChDL,QAAQC,GAAG,CAAC,WAAWL,IAAI,CAAC,EAAE,EAAEM,KAAKC,SAAS,CAACjB,UAAUkB,KAAKF,KAAKC,SAAS,CAACE;QAC7E,IAAI,CAACnB,QAAQQ,MAAM,EAAE;YACnBM,QAAQC,GAAG,CAAC;YACZ,IAAIG,KAAKJ,QAAQC,GAAG,CAAC,GAAGL,IAAI,CAAC,EAAE,CAAC,uBAAuB,EAAEQ,IAAIE,OAAO,EAAE;iBACjEN,QAAQC,GAAG,CAAC,GAAGI,OAAOE,OAAO,CAAC,eAAe,EAAEF,OAAOb,WAAW,EAAE;YACxEQ,QAAQC,GAAG,CAAC;QACd;QACAnB,KAAKsB,MAAM,CAAC,IAAI;IAClB;AACF,CAAA,EAAE"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/cli.ts"],"sourcesContent":["import exit from 'exit';\nimport getopts from 'getopts-compat';\nimport install, { type InstallOptions } from './index';\n\nexport default (argv) => {\n const options = getopts(argv.slice(1), {\n alias: { platform: 'p', arch: 'a', filename: 'f', installPath: 'i', storagePath: 'c', silent: 's' },\n boolean: ['silent'],\n });\n\n const args = argv.slice(0, 1).concat(options._);\n if (args.length < 1) {\n console.log('Missing command. Example usage: nir version [directory]');\n return exit(-1);\n }\n install(args[0], options as InstallOptions, (err, result) => {\n if (!options.silent) {\n console.log('\\n======================');\n if (err) console.log(`${args[0]} not installed. Error: ${err.message}`);\n else console.log(`${result.version} installed in: ${result.installPath}`);\n console.log('======================');\n }\n exit(err ? -1 : 0);\n });\n};\n"],"names":["exit","getopts","install","argv","options","slice","alias","platform","arch","filename","installPath","storagePath","silent","boolean","args","concat","_","length","console","log","err","result","message","version"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,aAAa,iBAAiB;AACrC,OAAOC,aAAsC,UAAU;AAEvD,eAAe,CAAA,CAACC;IACd,MAAMC,UAAUH,QAAQE,KAAKE,KAAK,CAAC,IAAI;QACrCC,OAAO;YAAEC,UAAU;YAAKC,MAAM;YAAKC,UAAU;YAAKC,aAAa;YAAKC,aAAa;YAAKC,QAAQ;QAAI;QAClGC,SAAS;YAAC;SAAS;IACrB;IAEA,MAAMC,OAAOX,KAAKE,KAAK,CAAC,GAAG,GAAGU,MAAM,CAACX,QAAQY,CAAC;IAC9C,IAAIF,KAAKG,MAAM,GAAG,GAAG;QACnBC,QAAQC,GAAG,CAAC;QACZ,OAAOnB,KAAK,CAAC;IACf;IACAE,QAAQY,IAAI,CAAC,EAAE,EAAEV,SAA2B,CAACgB,KAAKC;QAChD,IAAI,CAACjB,QAAQQ,MAAM,EAAE;YACnBM,QAAQC,GAAG,CAAC;YACZ,IAAIC,KAAKF,QAAQC,GAAG,CAAC,GAAGL,IAAI,CAAC,EAAE,CAAC,uBAAuB,EAAEM,IAAIE,OAAO,EAAE;iBACjEJ,QAAQC,GAAG,CAAC,GAAGE,OAAOE,OAAO,CAAC,eAAe,EAAEF,OAAOX,WAAW,EAAE;YACxEQ,QAAQC,GAAG,CAAC;QACd;QACAnB,KAAKoB,MAAM,CAAC,IAAI;IAClB;AACF,CAAA,EAAE"}
@@ -1,25 +1,38 @@
1
1
  import path from 'path';
2
2
  import home from 'homedir-polyfill';
3
+ import keys from 'lodash.keys';
3
4
  // @ts-ignore
4
5
  import files from '../../assets/files.cjs';
5
6
  import createStoragePaths from './createStoragePaths.mjs';
6
7
  export const FILES = files;
7
- export const isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);
8
- export const NODE = isWindows ? 'node.exe' : 'node';
9
8
  export const DEFAULT_STORAGE_PATH = path.join(home(), '.nir');
10
9
  export const DEFAULT_STORAGE_PATHS = createStoragePaths(DEFAULT_STORAGE_PATH);
10
+ export const FILE_PLATFORMS = keys(FILES).filter((file)=>[
11
+ 'src',
12
+ 'headers'
13
+ ].indexOf(file) < 0);
14
+ export const FILE_PLATFORM_MAP = {
15
+ win: 'win32',
16
+ win32: 'win',
17
+ osx: 'darwin',
18
+ darwin: 'osx'
19
+ };
11
20
  export const EXTENSIONS_COMPRESSED = [
12
21
  '.gz',
13
22
  '.zip',
14
23
  '.xz',
15
24
  '.7z'
16
25
  ];
26
+ export const NODE_FILE_PATHS = {
27
+ win32: 'node.exe',
28
+ posix: path.join('bin', 'node')
29
+ };
17
30
  export const NODE_DIST_BASE_URL = 'https://nodejs.org/dist';
18
31
  export const NODE_SCHEDULES_URL = 'https://raw.githubusercontent.com/nodejs/Release/master/schedule.json';
19
32
  export const NPM_DIST_URL = 'https://registry.npmjs.org/npm';
20
33
  export const NPM_DIST_TAGS_URL = 'https://registry.npmjs.org/-/package/npm/dist-tags';
21
34
  export const NPM_MIN_VERSION = 3;
22
- export const NPM_PLATFORM_FILES = {
35
+ export const NPM_FILE_PATHS = {
23
36
  win32: [
24
37
  {
25
38
  src: path.join('node_modules', 'npm', 'bin', 'npm'),
@@ -42,12 +55,12 @@ export const NPM_PLATFORM_FILES = {
42
55
  ],
43
56
  posix: [
44
57
  {
45
- src: path.join('node_modules', 'npm', 'bin', 'npm-cli.js'),
46
- dest: 'npm'
58
+ src: path.join('lib', 'node_modules', 'npm', 'bin', 'npm-cli.js'),
59
+ dest: path.join('bin', 'npm')
47
60
  },
48
61
  {
49
- src: path.join('node_modules', 'npm', 'bin', 'npx-cli.js'),
50
- dest: 'npx',
62
+ src: path.join('lib', 'node_modules', 'npm', 'bin', 'npx-cli.js'),
63
+ dest: path.join('bin', 'npx'),
51
64
  optional: true
52
65
  }
53
66
  ]
@@ -1 +1 @@
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';\n// @ts-ignore\nimport files from '../../assets/files.cjs';\nimport createStoragePaths from './createStoragePaths';\n\nexport const FILES = files;\n\nexport const isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nexport const NODE = isWindows ? 'node.exe' : 'node';\n\nexport const DEFAULT_STORAGE_PATH = path.join(home(), '.nir');\nexport const DEFAULT_STORAGE_PATHS = createStoragePaths(DEFAULT_STORAGE_PATH);\n\nexport const EXTENSIONS_COMPRESSED = ['.gz', '.zip', '.xz', '.7z'];\n\nexport const NODE_DIST_BASE_URL = 'https://nodejs.org/dist';\nexport const NODE_SCHEDULES_URL = 'https://raw.githubusercontent.com/nodejs/Release/master/schedule.json';\n\nexport const NPM_DIST_URL = 'https://registry.npmjs.org/npm';\nexport const NPM_DIST_TAGS_URL = 'https://registry.npmjs.org/-/package/npm/dist-tags';\nexport const NPM_MIN_VERSION = 3;\nexport const NPM_PLATFORM_FILES = {\n win32: [\n { src: path.join('node_modules', 'npm', 'bin', 'npm'), dest: 'npm' },\n { src: path.join('node_modules', 'npm', 'bin', 'npm.cmd'), dest: 'npm.cmd' },\n { src: path.join('node_modules', 'npm', 'bin', 'npx'), dest: 'npx', optional: true },\n { src: path.join('node_modules', 'npm', 'bin', 'npx.cmd'), dest: 'npx.cmd', optional: true },\n ],\n posix: [\n { src: path.join('node_modules', 'npm', 'bin', 'npm-cli.js'), dest: 'npm' },\n { src: path.join('node_modules', 'npm', 'bin', 'npx-cli.js'), dest: 'npx', optional: true },\n ],\n};\n"],"names":["path","home","files","createStoragePaths","FILES","isWindows","process","platform","test","env","OSTYPE","NODE","DEFAULT_STORAGE_PATH","join","DEFAULT_STORAGE_PATHS","EXTENSIONS_COMPRESSED","NODE_DIST_BASE_URL","NODE_SCHEDULES_URL","NPM_DIST_URL","NPM_DIST_TAGS_URL","NPM_MIN_VERSION","NPM_PLATFORM_FILES","win32","src","dest","optional","posix"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,UAAU,mBAAmB;AACpC,aAAa;AACb,OAAOC,WAAW,yBAAyB;AAC3C,OAAOC,wBAAwB,uBAAuB;AAEtD,OAAO,MAAMC,QAAQF,MAAM;AAE3B,OAAO,MAAMG,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM,EAAE;AACpG,OAAO,MAAMC,OAAON,YAAY,aAAa,OAAO;AAEpD,OAAO,MAAMO,uBAAuBZ,KAAKa,IAAI,CAACZ,QAAQ,QAAQ;AAC9D,OAAO,MAAMa,wBAAwBX,mBAAmBS,sBAAsB;AAE9E,OAAO,MAAMG,wBAAwB;IAAC;IAAO;IAAQ;IAAO;CAAM,CAAC;AAEnE,OAAO,MAAMC,qBAAqB,0BAA0B;AAC5D,OAAO,MAAMC,qBAAqB,wEAAwE;AAE1G,OAAO,MAAMC,eAAe,iCAAiC;AAC7D,OAAO,MAAMC,oBAAoB,qDAAqD;AACtF,OAAO,MAAMC,kBAAkB,EAAE;AACjC,OAAO,MAAMC,qBAAqB;IAChCC,OAAO;QACL;YAAEC,KAAKvB,KAAKa,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAQW,MAAM;QAAM;QACnE;YAAED,KAAKvB,KAAKa,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAYW,MAAM;QAAU;QAC3E;YAAED,KAAKvB,KAAKa,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAQW,MAAM;YAAOC,UAAU;QAAK;QACnF;YAAEF,KAAKvB,KAAKa,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAYW,MAAM;YAAWC,UAAU;QAAK;KAC5F;IACDC,OAAO;QACL;YAAEH,KAAKvB,KAAKa,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAeW,MAAM;QAAM;QAC1E;YAAED,KAAKvB,KAAKa,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAeW,MAAM;YAAOC,UAAU;QAAK;KAC3F;AACH,EAAE"}
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 keys from 'lodash.keys';\n// @ts-ignore\nimport files from '../../assets/files.cjs';\nimport createStoragePaths from './createStoragePaths';\n\nexport const FILES = files;\nexport const DEFAULT_STORAGE_PATH = path.join(home(), '.nir');\nexport const DEFAULT_STORAGE_PATHS = createStoragePaths(DEFAULT_STORAGE_PATH);\n\nexport const FILE_PLATFORMS = keys(FILES).filter((file) => ['src', 'headers'].indexOf(file) < 0);\n\nexport const FILE_PLATFORM_MAP = {\n win: 'win32',\n win32: 'win',\n osx: 'darwin',\n darwin: 'osx',\n};\n\nexport const EXTENSIONS_COMPRESSED = ['.gz', '.zip', '.xz', '.7z'];\n\nexport const NODE_FILE_PATHS = {\n win32: 'node.exe',\n posix: path.join('bin', 'node'),\n};\nexport const NODE_DIST_BASE_URL = 'https://nodejs.org/dist';\nexport const NODE_SCHEDULES_URL = 'https://raw.githubusercontent.com/nodejs/Release/master/schedule.json';\n\nexport const NPM_DIST_URL = 'https://registry.npmjs.org/npm';\nexport const NPM_DIST_TAGS_URL = 'https://registry.npmjs.org/-/package/npm/dist-tags';\nexport const NPM_MIN_VERSION = 3;\nexport const NPM_FILE_PATHS = {\n win32: [\n { src: path.join('node_modules', 'npm', 'bin', 'npm'), dest: 'npm' },\n { src: path.join('node_modules', 'npm', 'bin', 'npm.cmd'), dest: 'npm.cmd' },\n { src: path.join('node_modules', 'npm', 'bin', 'npx'), dest: 'npx', optional: true },\n { src: path.join('node_modules', 'npm', 'bin', 'npx.cmd'), dest: 'npx.cmd', optional: true },\n ],\n posix: [\n { src: path.join('lib', 'node_modules', 'npm', 'bin', 'npm-cli.js'), dest: path.join('bin', 'npm') },\n { src: path.join('lib', 'node_modules', 'npm', 'bin', 'npx-cli.js'), dest: path.join('bin', 'npx'), optional: true },\n ],\n};\n"],"names":["path","home","keys","files","createStoragePaths","FILES","DEFAULT_STORAGE_PATH","join","DEFAULT_STORAGE_PATHS","FILE_PLATFORMS","filter","file","indexOf","FILE_PLATFORM_MAP","win","win32","osx","darwin","EXTENSIONS_COMPRESSED","NODE_FILE_PATHS","posix","NODE_DIST_BASE_URL","NODE_SCHEDULES_URL","NPM_DIST_URL","NPM_DIST_TAGS_URL","NPM_MIN_VERSION","NPM_FILE_PATHS","src","dest","optional"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,UAAU,mBAAmB;AACpC,OAAOC,UAAU,cAAc;AAC/B,aAAa;AACb,OAAOC,WAAW,yBAAyB;AAC3C,OAAOC,wBAAwB,uBAAuB;AAEtD,OAAO,MAAMC,QAAQF,MAAM;AAC3B,OAAO,MAAMG,uBAAuBN,KAAKO,IAAI,CAACN,QAAQ,QAAQ;AAC9D,OAAO,MAAMO,wBAAwBJ,mBAAmBE,sBAAsB;AAE9E,OAAO,MAAMG,iBAAiBP,KAAKG,OAAOK,MAAM,CAAC,CAACC,OAAS;QAAC;QAAO;KAAU,CAACC,OAAO,CAACD,QAAQ,GAAG;AAEjG,OAAO,MAAME,oBAAoB;IAC/BC,KAAK;IACLC,OAAO;IACPC,KAAK;IACLC,QAAQ;AACV,EAAE;AAEF,OAAO,MAAMC,wBAAwB;IAAC;IAAO;IAAQ;IAAO;CAAM,CAAC;AAEnE,OAAO,MAAMC,kBAAkB;IAC7BJ,OAAO;IACPK,OAAOpB,KAAKO,IAAI,CAAC,OAAO;AAC1B,EAAE;AACF,OAAO,MAAMc,qBAAqB,0BAA0B;AAC5D,OAAO,MAAMC,qBAAqB,wEAAwE;AAE1G,OAAO,MAAMC,eAAe,iCAAiC;AAC7D,OAAO,MAAMC,oBAAoB,qDAAqD;AACtF,OAAO,MAAMC,kBAAkB,EAAE;AACjC,OAAO,MAAMC,iBAAiB;IAC5BX,OAAO;QACL;YAAEY,KAAK3B,KAAKO,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAQqB,MAAM;QAAM;QACnE;YAAED,KAAK3B,KAAKO,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAYqB,MAAM;QAAU;QAC3E;YAAED,KAAK3B,KAAKO,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAQqB,MAAM;YAAOC,UAAU;QAAK;QACnF;YAAEF,KAAK3B,KAAKO,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAYqB,MAAM;YAAWC,UAAU;QAAK;KAC5F;IACDT,OAAO;QACL;YAAEO,KAAK3B,KAAKO,IAAI,CAAC,OAAO,gBAAgB,OAAO,OAAO;YAAeqB,MAAM5B,KAAKO,IAAI,CAAC,OAAO;QAAO;QACnG;YAAEoB,KAAK3B,KAAKO,IAAI,CAAC,OAAO,gBAAgB,OAAO,OAAO;YAAeqB,MAAM5B,KAAKO,IAAI,CAAC,OAAO;YAAQsB,UAAU;QAAK;KACpH;AACH,EAAE"}
@@ -1,16 +1,18 @@
1
1
  import path from 'path';
2
- import { DEFAULT_STORAGE_PATHS, NODE, isWindows } from './constants.mjs';
2
+ import { DEFAULT_STORAGE_PATHS, NODE_FILE_PATHS } from './constants.mjs';
3
3
  import createStoragePaths from './createStoragePaths.mjs';
4
4
  export default function createResult(options, version) {
5
5
  const storagePaths = options.storagePath ? createStoragePaths(options.storagePath) : DEFAULT_STORAGE_PATHS;
6
6
  let installPath = options.installPath || storagePaths.installPath;
7
7
  if (options.name) installPath = path.join(installPath, options.name);
8
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);
9
+ const platform = options.platform;
10
+ const nodePath = NODE_FILE_PATHS[platform] || NODE_FILE_PATHS.posix;
11
+ const execPath = path.join(installPath, nodePath);
11
12
  return {
12
13
  version,
13
14
  installPath,
14
- execPath
15
+ execPath,
16
+ platform
15
17
  };
16
18
  }
@@ -1 +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"}
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_FILE_PATHS } 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 platform = options.platform;\n const nodePath = NODE_FILE_PATHS[platform] || NODE_FILE_PATHS.posix;\n const execPath = path.join(installPath, nodePath);\n return { version, installPath, execPath, platform };\n}\n"],"names":["path","DEFAULT_STORAGE_PATHS","NODE_FILE_PATHS","createStoragePaths","createResult","options","version","storagePaths","storagePath","installPath","name","join","platform","nodePath","posix","execPath"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,SAASC,qBAAqB,EAAEC,eAAe,QAAQ,cAAc;AAErE,OAAOC,wBAAwB,uBAAuB;AAGtD,eAAe,SAASC,aAAaC,OAAuB,EAAEC,OAAe;IAC3E,MAAMC,eAAeF,QAAQG,WAAW,GAAGL,mBAAmBE,QAAQG,WAAW,IAAIP;IACrF,IAAIQ,cAAcJ,QAAQI,WAAW,IAAIF,aAAaE,WAAW;IAEjE,IAAIJ,QAAQK,IAAI,EAAED,cAAcT,KAAKW,IAAI,CAACF,aAAaJ,QAAQK,IAAI;SAC9D,IAAI,CAACL,QAAQI,WAAW,EAAEA,cAAcT,KAAKW,IAAI,CAACF,aAAaH;IACpE,MAAMM,WAAWP,QAAQO,QAAQ;IACjC,MAAMC,WAAWX,eAAe,CAACU,SAAS,IAAIV,gBAAgBY,KAAK;IACnE,MAAMC,WAAWf,KAAKW,IAAI,CAACF,aAAaI;IACxC,OAAO;QAAEP;QAASG;QAAaM;QAAUH;IAAS;AACpD"}