node-install-release 1.7.5 → 1.7.7

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 (102) hide show
  1. package/dist/cjs/constants.cjs +65 -0
  2. package/dist/cjs/constants.cjs.map +1 -1
  3. package/dist/cjs/index.cjs +0 -1
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/installNPM/installBin.cjs +2 -34
  6. package/dist/cjs/installNPM/installBin.cjs.map +1 -1
  7. package/dist/cjs/installNPM/installLib.cjs +12 -20
  8. package/dist/cjs/installNPM/installLib.cjs.map +1 -1
  9. package/dist/cjs/installNode/index.cjs +35 -21
  10. package/dist/cjs/installNode/index.cjs.map +1 -1
  11. package/dist/cjs/installNode/installCompressed.cjs +24 -22
  12. package/dist/cjs/installNode/installCompressed.cjs.map +1 -1
  13. package/dist/cjs/installNode/installExe.cjs +12 -8
  14. package/dist/cjs/installNode/installExe.cjs.map +1 -1
  15. package/dist/cjs/installNode/installFilename.cjs +31 -0
  16. package/dist/cjs/installNode/installFilename.cjs.map +1 -0
  17. package/dist/cjs/installNode/installSource/buildPosix.cjs +14 -18
  18. package/dist/cjs/installNode/installSource/buildPosix.cjs.map +1 -1
  19. package/dist/cjs/installNode/installSource/buildWin32.cjs +5 -8
  20. package/dist/cjs/installNode/installSource/buildWin32.cjs.map +1 -1
  21. package/dist/cjs/installNode/installSource/index.cjs +6 -3
  22. package/dist/cjs/installNode/installSource/index.cjs.map +1 -1
  23. package/dist/cjs/installNode/validateDownload.cjs +42 -0
  24. package/dist/cjs/installNode/validateDownload.cjs.map +1 -0
  25. package/dist/cjs/lib/checkMissing.cjs +11 -3
  26. package/dist/cjs/lib/checkMissing.cjs.map +1 -1
  27. package/dist/cjs/{lib → machine}/arch.cjs +3 -2
  28. package/dist/cjs/machine/arch.cjs.map +1 -0
  29. package/dist/cjs/{polyfills.cjs → machine/execSync/polyfill.cjs} +1 -1
  30. package/dist/cjs/machine/execSync/polyfill.cjs.map +1 -0
  31. package/dist/cjs/machine/execSync/worker.cjs.map +1 -0
  32. package/dist/cjs/workers/install.cjs +2 -33
  33. package/dist/cjs/workers/install.cjs.map +1 -1
  34. package/dist/esm/constants.mjs +44 -0
  35. package/dist/esm/constants.mjs.map +1 -1
  36. package/dist/esm/index.mjs +0 -1
  37. package/dist/esm/index.mjs.map +1 -1
  38. package/dist/esm/installNPM/installBin.mjs +2 -34
  39. package/dist/esm/installNPM/installBin.mjs.map +1 -1
  40. package/dist/esm/installNPM/installLib.mjs +12 -18
  41. package/dist/esm/installNPM/installLib.mjs.map +1 -1
  42. package/dist/esm/installNode/index.mjs +32 -22
  43. package/dist/esm/installNode/index.mjs.map +1 -1
  44. package/dist/esm/installNode/installCompressed.mjs +24 -24
  45. package/dist/esm/installNode/installCompressed.mjs.map +1 -1
  46. package/dist/esm/installNode/installExe.mjs +12 -8
  47. package/dist/esm/installNode/installExe.mjs.map +1 -1
  48. package/dist/esm/installNode/installFilename.mjs +15 -0
  49. package/dist/esm/installNode/installFilename.mjs.map +1 -0
  50. package/dist/esm/installNode/installSource/buildPosix.mjs +13 -17
  51. package/dist/esm/installNode/installSource/buildPosix.mjs.map +1 -1
  52. package/dist/esm/installNode/installSource/buildWin32.mjs +4 -9
  53. package/dist/esm/installNode/installSource/buildWin32.mjs.map +1 -1
  54. package/dist/esm/installNode/installSource/index.mjs +6 -3
  55. package/dist/esm/installNode/installSource/index.mjs.map +1 -1
  56. package/dist/esm/installNode/validateDownload.mjs +24 -0
  57. package/dist/esm/installNode/validateDownload.mjs.map +1 -0
  58. package/dist/esm/lib/checkMissing.mjs +1 -1
  59. package/dist/esm/lib/checkMissing.mjs.map +1 -1
  60. package/dist/esm/{lib → machine}/arch.cjs +1 -0
  61. package/dist/esm/machine/arch.cjs.map +1 -0
  62. package/dist/esm/{polyfills.cjs → machine/execSync/polyfill.cjs} +1 -1
  63. package/dist/esm/machine/execSync/polyfill.cjs.map +1 -0
  64. package/dist/esm/machine/execSync/worker.cjs.map +1 -0
  65. package/dist/esm/workers/install.mjs +2 -9
  66. package/dist/esm/workers/install.mjs.map +1 -1
  67. package/dist/types/constants.d.ts +26 -0
  68. package/dist/types/index.d.ts +0 -1
  69. package/dist/types/installNode/installCompressed.d.ts +1 -1
  70. package/dist/types/installNode/installExe.d.ts +1 -1
  71. package/dist/types/installNode/installFilename.d.ts +1 -0
  72. package/dist/types/installNode/installSource/buildPosix.d.ts +1 -1
  73. package/dist/types/installNode/installSource/index.d.ts +1 -1
  74. package/dist/types/installNode/validateDownload.d.ts +1 -0
  75. package/dist/types/lib/checkMissing.d.ts +10 -0
  76. package/package.json +6 -9
  77. package/dist/cjs/installNode/findDistPaths.cjs +0 -34
  78. package/dist/cjs/installNode/findDistPaths.cjs.map +0 -1
  79. package/dist/cjs/installNode/prebuilts.cjs +0 -53
  80. package/dist/cjs/installNode/prebuilts.cjs.map +0 -1
  81. package/dist/cjs/lib/arch.cjs.map +0 -1
  82. package/dist/cjs/lib/endsWithFn.cjs +0 -29
  83. package/dist/cjs/lib/endsWithFn.cjs.map +0 -1
  84. package/dist/cjs/polyfills/execCallback.cjs.map +0 -1
  85. package/dist/cjs/polyfills.cjs.map +0 -1
  86. package/dist/esm/installNode/findDistPaths.mjs +0 -18
  87. package/dist/esm/installNode/findDistPaths.mjs.map +0 -1
  88. package/dist/esm/installNode/prebuilts.mjs +0 -37
  89. package/dist/esm/installNode/prebuilts.mjs.map +0 -1
  90. package/dist/esm/lib/arch.cjs.map +0 -1
  91. package/dist/esm/lib/endsWithFn.mjs +0 -13
  92. package/dist/esm/lib/endsWithFn.mjs.map +0 -1
  93. package/dist/esm/polyfills/execCallback.cjs.map +0 -1
  94. package/dist/esm/polyfills.cjs.map +0 -1
  95. package/dist/types/installNode/findDistPaths.d.ts +0 -5
  96. package/dist/types/installNode/prebuilts.d.ts +0 -1
  97. package/dist/types/lib/endsWithFn.d.ts +0 -1
  98. /package/dist/cjs/{polyfills/execCallback.cjs → machine/execSync/worker.cjs} +0 -0
  99. /package/dist/esm/{polyfills/execCallback.cjs → machine/execSync/worker.cjs} +0 -0
  100. /package/dist/types/{lib → machine}/arch.d.cts +0 -0
  101. /package/dist/types/{polyfills.d.cts → machine/execSync/polyfill.d.cts} +0 -0
  102. /package/dist/types/{polyfills/execCallback.d.cts → machine/execSync/worker.d.cts} +0 -0
@@ -15,9 +15,30 @@ _export(exports, {
15
15
  DEFAULT_STORAGE_PATHS: function() {
16
16
  return DEFAULT_STORAGE_PATHS;
17
17
  },
18
+ EXTENSIONS_COMPRESSED: function() {
19
+ return EXTENSIONS_COMPRESSED;
20
+ },
18
21
  NODE: function() {
19
22
  return NODE;
20
23
  },
24
+ NODE_DIST_BASE_URL: function() {
25
+ return NODE_DIST_BASE_URL;
26
+ },
27
+ NODE_SCHEDULES_URL: function() {
28
+ return NODE_SCHEDULES_URL;
29
+ },
30
+ NPM_DIST_TAGS_URL: function() {
31
+ return NPM_DIST_TAGS_URL;
32
+ },
33
+ NPM_DIST_URL: function() {
34
+ return NPM_DIST_URL;
35
+ },
36
+ NPM_MIN_VERSION: function() {
37
+ return NPM_MIN_VERSION;
38
+ },
39
+ NPM_PLATFORM_FILES: function() {
40
+ return NPM_PLATFORM_FILES;
41
+ },
21
42
  isWindows: function() {
22
43
  return isWindows;
23
44
  }
@@ -34,4 +55,48 @@ var isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.e
34
55
  var NODE = isWindows ? 'node.exe' : 'node';
35
56
  var DEFAULT_STORAGE_PATH = _path.default.join((0, _homedirpolyfill.default)(), '.nir');
36
57
  var DEFAULT_STORAGE_PATHS = (0, _createStoragePaths.default)(DEFAULT_STORAGE_PATH);
58
+ var EXTENSIONS_COMPRESSED = [
59
+ '.gz',
60
+ '.zip',
61
+ '.xz',
62
+ '.7z'
63
+ ];
64
+ var NODE_DIST_BASE_URL = 'https://nodejs.org/dist';
65
+ var NODE_SCHEDULES_URL = 'https://raw.githubusercontent.com/nodejs/Release/master/schedule.json';
66
+ var NPM_DIST_URL = 'https://registry.npmjs.org/npm';
67
+ var NPM_DIST_TAGS_URL = 'https://registry.npmjs.org/-/package/npm/dist-tags';
68
+ var NPM_MIN_VERSION = 3;
69
+ var NPM_PLATFORM_FILES = {
70
+ win32: [
71
+ {
72
+ src: _path.default.join('node_modules', 'npm', 'bin', 'npm'),
73
+ dest: 'npm'
74
+ },
75
+ {
76
+ src: _path.default.join('node_modules', 'npm', 'bin', 'npm.cmd'),
77
+ dest: 'npm.cmd'
78
+ },
79
+ {
80
+ src: _path.default.join('node_modules', 'npm', 'bin', 'npx'),
81
+ dest: 'npx',
82
+ optional: true
83
+ },
84
+ {
85
+ src: _path.default.join('node_modules', 'npm', 'bin', 'npx.cmd'),
86
+ dest: 'npx.cmd',
87
+ optional: true
88
+ }
89
+ ],
90
+ posix: [
91
+ {
92
+ src: _path.default.join('node_modules', 'npm', 'bin', 'npm-cli.js'),
93
+ dest: 'npm'
94
+ },
95
+ {
96
+ src: _path.default.join('node_modules', 'npm', 'bin', 'npx-cli.js'),
97
+ dest: 'npx',
98
+ optional: true
99
+ }
100
+ ]
101
+ };
37
102
  /* 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":["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_STORAGE_PATH = path.join(home(), '.nir');\nexport const DEFAULT_STORAGE_PATHS = createStoragePaths(DEFAULT_STORAGE_PATH);\n"],"names":["DEFAULT_STORAGE_PATH","DEFAULT_STORAGE_PATHS","NODE","isWindows","process","platform","test","env","OSTYPE","path","join","home","createStoragePaths"],"mappings":";;;;;;;;;;;IAOaA,oBAAoB;eAApBA;;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,uBAAuBS,aAAI,CAACC,IAAI,CAACC,IAAAA,wBAAI,KAAI;AAC/C,IAAMV,wBAAwBW,IAAAA,2BAAkB,EAACZ"}
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_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":["DEFAULT_STORAGE_PATH","DEFAULT_STORAGE_PATHS","EXTENSIONS_COMPRESSED","NODE","NODE_DIST_BASE_URL","NODE_SCHEDULES_URL","NPM_DIST_TAGS_URL","NPM_DIST_URL","NPM_MIN_VERSION","NPM_PLATFORM_FILES","isWindows","process","platform","test","env","OSTYPE","path","join","home","createStoragePaths","win32","src","dest","optional","posix"],"mappings":";;;;;;;;;;;IAOaA,oBAAoB;eAApBA;;IACAC,qBAAqB;eAArBA;;IAEAC,qBAAqB;eAArBA;;IALAC,IAAI;eAAJA;;IAOAC,kBAAkB;eAAlBA;;IACAC,kBAAkB;eAAlBA;;IAGAC,iBAAiB;eAAjBA;;IADAC,YAAY;eAAZA;;IAEAC,eAAe;eAAfA;;IACAC,kBAAkB;eAAlBA;;IAdAC,SAAS;eAATA;;;2DAJI;sEACA;yEACc;;;;;;AAExB,IAAMA,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAC3F,IAAMZ,OAAOO,YAAY,aAAa;AAEtC,IAAMV,uBAAuBgB,aAAI,CAACC,IAAI,CAACC,IAAAA,wBAAI,KAAI;AAC/C,IAAMjB,wBAAwBkB,IAAAA,2BAAkB,EAACnB;AAEjD,IAAME,wBAAwB;IAAC;IAAO;IAAQ;IAAO;CAAM;AAE3D,IAAME,qBAAqB;AAC3B,IAAMC,qBAAqB;AAE3B,IAAME,eAAe;AACrB,IAAMD,oBAAoB;AAC1B,IAAME,kBAAkB;AACxB,IAAMC,qBAAqB;IAChCW,OAAO;QACL;YAAEC,KAAKL,aAAI,CAACC,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAQK,MAAM;QAAM;QACnE;YAAED,KAAKL,aAAI,CAACC,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAYK,MAAM;QAAU;QAC3E;YAAED,KAAKL,aAAI,CAACC,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAQK,MAAM;YAAOC,UAAU;QAAK;QACnF;YAAEF,KAAKL,aAAI,CAACC,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAYK,MAAM;YAAWC,UAAU;QAAK;KAC5F;IACDC,OAAO;QACL;YAAEH,KAAKL,aAAI,CAACC,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAeK,MAAM;QAAM;QAC1E;YAAED,KAAKL,aAAI,CAACC,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAeK,MAAM;YAAOC,UAAU;QAAK;KAC3F;AACH"}
@@ -19,7 +19,6 @@ _export(exports, {
19
19
  return install;
20
20
  }
21
21
  });
22
- require("./polyfills.cjs");
23
22
  var _install = /*#__PURE__*/ _interop_require_default(require("./workers/install.cjs"));
24
23
  var _createResult = /*#__PURE__*/ _interop_require_default(require("./createResult.cjs"));
25
24
  var _createStoragePaths = /*#__PURE__*/ _interop_require_default(require("./createStoragePaths.cjs"));
@@ -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}\nexport { default as createResult } from './createResult';\nexport { default as createStoragePaths } from './createStoragePaths';\n"],"names":["createResult","createStoragePaths","install","versionExpression","options","callback","worker","Promise","resolve","reject","err","result"],"mappings":";;;;;;;;;;;IAgBoBA,YAAY;eAAZA,qBAAY;;IACZC,kBAAkB;eAAlBA,2BAAkB;;IAXtC,OASC;eATuBC;;;QANjB;8DACY;mEAeqB;yEACM;;;;;;AAX/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"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/index.ts"],"sourcesContent":["import 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 createResult } from './createResult';\nexport { default as createStoragePaths } from './createStoragePaths';\n"],"names":["createResult","createStoragePaths","install","versionExpression","options","callback","worker","Promise","resolve","reject","err","result"],"mappings":";;;;;;;;;;;IAeoBA,YAAY;eAAZA,qBAAY;;IACZC,kBAAkB;eAAlBA,2BAAkB;;IAXtC,OASC;eATuBC;;;8DALL;mEAeqB;yEACM;;;;;;AAX/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"}
@@ -11,50 +11,18 @@ Object.defineProperty(exports, "default", {
11
11
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
12
  var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
13
13
  var _conditionalCopy = /*#__PURE__*/ _interop_require_default(require("../lib/conditionalCopy.cjs"));
14
+ var _constants = require("../constants.cjs");
14
15
  function _interop_require_default(obj) {
15
16
  return obj && obj.__esModule ? obj : {
16
17
  default: obj
17
18
  };
18
19
  }
19
- var PLATFORM_FILES = {
20
- win32: [
21
- {
22
- src: _path.default.join('node_modules', 'npm', 'bin', 'npm'),
23
- dest: 'npm'
24
- },
25
- {
26
- src: _path.default.join('node_modules', 'npm', 'bin', 'npm.cmd'),
27
- dest: 'npm.cmd'
28
- },
29
- {
30
- src: _path.default.join('node_modules', 'npm', 'bin', 'npx'),
31
- dest: 'npx',
32
- optional: true
33
- },
34
- {
35
- src: _path.default.join('node_modules', 'npm', 'bin', 'npx.cmd'),
36
- dest: 'npx.cmd',
37
- optional: true
38
- }
39
- ],
40
- posix: [
41
- {
42
- src: _path.default.join('node_modules', 'npm', 'bin', 'npm-cli.js'),
43
- dest: 'npm'
44
- },
45
- {
46
- src: _path.default.join('node_modules', 'npm', 'bin', 'npx-cli.js'),
47
- dest: 'npx',
48
- optional: true
49
- }
50
- ]
51
- };
52
20
  function installBin(_version, dest, options, callback) {
53
21
  var platform = options.platform || process.platform;
54
22
  var libPath = platform === 'win32' ? dest : _path.default.join(dest, 'lib');
55
23
  var binPath = platform === 'win32' ? dest : _path.default.join(dest, 'bin');
56
24
  var queue = new _queuecb.default();
57
- var files = PLATFORM_FILES[platform] || PLATFORM_FILES.posix;
25
+ var files = _constants.NPM_PLATFORM_FILES[platform] || _constants.NPM_PLATFORM_FILES.posix;
58
26
  for(var index = 0; index < files.length; index++){
59
27
  var file = files[index];
60
28
  queue.defer(_conditionalCopy.default.bind(null, _path.default.join(libPath, file.src), _path.default.join(binPath, file.dest), file.optional));
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNPM/installBin.ts"],"sourcesContent":["import path from 'path';\nimport Queue from 'queue-cb';\nimport conditionalCopy from '../lib/conditionalCopy';\n\nconst 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\nexport default function installBin(_version, dest, options, callback) {\n const platform = options.platform || process.platform;\n const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');\n const binPath = platform === 'win32' ? dest : path.join(dest, 'bin');\n\n const queue = new Queue();\n const files = PLATFORM_FILES[platform] || PLATFORM_FILES.posix;\n for (let index = 0; index < files.length; index++) {\n const file = files[index];\n queue.defer(conditionalCopy.bind(null, path.join(libPath, file.src), path.join(binPath, file.dest), file.optional));\n }\n\n queue.await(callback);\n}\n"],"names":["installBin","PLATFORM_FILES","win32","src","path","join","dest","optional","posix","_version","options","callback","platform","process","libPath","binPath","queue","Queue","files","index","length","file","defer","conditionalCopy","bind","await"],"mappings":";;;;+BAiBA;;;eAAwBA;;;2DAjBP;8DACC;sEACU;;;;;;AAE5B,IAAMC,iBAAiB;IACrBC,OAAO;QACL;YAAEC,KAAKC,aAAI,CAACC,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAQC,MAAM;QAAM;QACnE;YAAEH,KAAKC,aAAI,CAACC,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAYC,MAAM;QAAU;QAC3E;YAAEH,KAAKC,aAAI,CAACC,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAQC,MAAM;YAAOC,UAAU;QAAK;QACnF;YAAEJ,KAAKC,aAAI,CAACC,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAYC,MAAM;YAAWC,UAAU;QAAK;KAC5F;IACDC,OAAO;QACL;YAAEL,KAAKC,aAAI,CAACC,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAeC,MAAM;QAAM;QAC1E;YAAEH,KAAKC,aAAI,CAACC,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAeC,MAAM;YAAOC,UAAU;QAAK;KAC3F;AACH;AAEe,SAASP,WAAWS,QAAQ,EAAEH,IAAI,EAAEI,OAAO,EAAEC,QAAQ;IAClE,IAAMC,WAAWF,QAAQE,QAAQ,IAAIC,QAAQD,QAAQ;IACrD,IAAME,UAAUF,aAAa,UAAUN,OAAOF,aAAI,CAACC,IAAI,CAACC,MAAM;IAC9D,IAAMS,UAAUH,aAAa,UAAUN,OAAOF,aAAI,CAACC,IAAI,CAACC,MAAM;IAE9D,IAAMU,QAAQ,IAAIC,gBAAK;IACvB,IAAMC,QAAQjB,cAAc,CAACW,SAAS,IAAIX,eAAeO,KAAK;IAC9D,IAAK,IAAIW,QAAQ,GAAGA,QAAQD,MAAME,MAAM,EAAED,QAAS;QACjD,IAAME,OAAOH,KAAK,CAACC,MAAM;QACzBH,MAAMM,KAAK,CAACC,wBAAe,CAACC,IAAI,CAAC,MAAMpB,aAAI,CAACC,IAAI,CAACS,SAASO,KAAKlB,GAAG,GAAGC,aAAI,CAACC,IAAI,CAACU,SAASM,KAAKf,IAAI,GAAGe,KAAKd,QAAQ;IACnH;IAEAS,MAAMS,KAAK,CAACd;AACd"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNPM/installBin.ts"],"sourcesContent":["import path from 'path';\nimport Queue from 'queue-cb';\nimport conditionalCopy from '../lib/conditionalCopy';\n\nimport { NPM_PLATFORM_FILES } from '../constants';\n\nexport default function installBin(_version, dest, options, callback) {\n const platform = options.platform || process.platform;\n const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');\n const binPath = platform === 'win32' ? dest : path.join(dest, 'bin');\n\n const queue = new Queue();\n const files = NPM_PLATFORM_FILES[platform] || NPM_PLATFORM_FILES.posix;\n for (let index = 0; index < files.length; index++) {\n const file = files[index];\n queue.defer(conditionalCopy.bind(null, path.join(libPath, file.src), path.join(binPath, file.dest), file.optional));\n }\n\n queue.await(callback);\n}\n"],"names":["installBin","_version","dest","options","callback","platform","process","libPath","path","join","binPath","queue","Queue","files","NPM_PLATFORM_FILES","posix","index","length","file","defer","conditionalCopy","bind","src","optional","await"],"mappings":";;;;+BAMA;;;eAAwBA;;;2DANP;8DACC;sEACU;yBAEO;;;;;;AAEpB,SAASA,WAAWC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAClE,IAAMC,WAAWF,QAAQE,QAAQ,IAAIC,QAAQD,QAAQ;IACrD,IAAME,UAAUF,aAAa,UAAUH,OAAOM,aAAI,CAACC,IAAI,CAACP,MAAM;IAC9D,IAAMQ,UAAUL,aAAa,UAAUH,OAAOM,aAAI,CAACC,IAAI,CAACP,MAAM;IAE9D,IAAMS,QAAQ,IAAIC,gBAAK;IACvB,IAAMC,QAAQC,6BAAkB,CAACT,SAAS,IAAIS,6BAAkB,CAACC,KAAK;IACtE,IAAK,IAAIC,QAAQ,GAAGA,QAAQH,MAAMI,MAAM,EAAED,QAAS;QACjD,IAAME,OAAOL,KAAK,CAACG,MAAM;QACzBL,MAAMQ,KAAK,CAACC,wBAAe,CAACC,IAAI,CAAC,MAAMb,aAAI,CAACC,IAAI,CAACF,SAASW,KAAKI,GAAG,GAAGd,aAAI,CAACC,IAAI,CAACC,SAASQ,KAAKhB,IAAI,GAAGgB,KAAKK,QAAQ;IACnH;IAEAZ,MAAMa,KAAK,CAACpB;AACd"}
@@ -10,39 +10,31 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
12
  var _getremote = /*#__PURE__*/ _interop_require_default(require("get-remote"));
13
+ var _nodefilenametodistpaths = require("node-filename-to-dist-paths");
13
14
  var _conditionalCache = /*#__PURE__*/ _interop_require_default(require("../lib/conditionalCache.cjs"));
14
15
  var _conditionalExtract = /*#__PURE__*/ _interop_require_default(require("../lib/conditionalExtract.cjs"));
16
+ var _constants = require("../constants.cjs");
15
17
  function _interop_require_default(obj) {
16
18
  return obj && obj.__esModule ? obj : {
17
19
  default: obj
18
20
  };
19
21
  }
20
- var NODE_DIST_URL = 'https://nodejs.org/dist/index.json';
21
- var NPM_DIST_TAGS_URL = 'https://registry.npmjs.org/-/package/npm/dist-tags';
22
- var NPM_DIST_URL = 'https://registry.npmjs.org/npm';
23
- var NPM_MIN_VERSION = 3;
24
22
  function installLib(version, dest, options, callback) {
25
23
  var platform = options.platform || process.platform;
26
24
  var libPath = platform === 'win32' ? dest : _path.default.join(dest, 'lib');
27
25
  var installPath = _path.default.join(libPath, 'node_modules', 'npm');
28
- (0, _getremote.default)(NODE_DIST_URL).json(function(err, res1) {
26
+ var dist = (0, _nodefilenametodistpaths.getDist)(version);
27
+ var npmMajorPair = dist && dist.npm ? +dist.npm.split('.')[0] : _constants.NPM_MIN_VERSION;
28
+ var npmMajor = Math.max(npmMajorPair, _constants.NPM_MIN_VERSION);
29
+ (0, _getremote.default)(_constants.NPM_DIST_TAGS_URL).json(function(err, res) {
29
30
  if (err) return callback(err);
30
- var releases = res1.body;
31
- var found = releases.find(function(record) {
32
- return record.version === version.version;
33
- });
34
- var npmMajorPair = found && found.npm ? +found.npm.split('.')[0] : NPM_MIN_VERSION;
35
- var npmMajor = Math.max(npmMajorPair, NPM_MIN_VERSION);
36
- (0, _getremote.default)(NPM_DIST_TAGS_URL).json(function(err, res2) {
31
+ var distTags = res.body;
32
+ var installVersion = distTags["latest-".concat(npmMajor)] || distTags["next-".concat(npmMajor)] || distTags.latest;
33
+ var downloadPath = "".concat(_constants.NPM_DIST_URL, "/-/npm-").concat(installVersion, ".tgz");
34
+ var cachePath = _path.default.join(options.cachePath, _path.default.basename(downloadPath));
35
+ (0, _conditionalCache.default)(downloadPath, cachePath, function(err) {
37
36
  if (err) return callback(err);
38
- var distTags = res2.body;
39
- var installVersion = distTags["latest-".concat(npmMajor)] || distTags["next-".concat(npmMajor)] || distTags.latest;
40
- var downloadPath = "".concat(NPM_DIST_URL, "/-/npm-").concat(installVersion, ".tgz");
41
- var cachePath = _path.default.join(options.cachePath, _path.default.basename(downloadPath));
42
- (0, _conditionalCache.default)(downloadPath, cachePath, function(err) {
43
- if (err) return callback(err);
44
- (0, _conditionalExtract.default)(cachePath, installPath, callback);
45
- });
37
+ (0, _conditionalExtract.default)(cachePath, installPath, callback);
46
38
  });
47
39
  });
48
40
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNPM/installLib.ts"],"sourcesContent":["import path from 'path';\nimport get from 'get-remote';\n\nimport conditionalCache from '../lib/conditionalCache';\nimport conditionalExtract from '../lib/conditionalExtract';\n\nconst NODE_DIST_URL = 'https://nodejs.org/dist/index.json';\nconst NPM_DIST_TAGS_URL = 'https://registry.npmjs.org/-/package/npm/dist-tags';\nconst NPM_DIST_URL = 'https://registry.npmjs.org/npm';\nconst NPM_MIN_VERSION = 3;\n\ninterface ReleaseRecord {\n version: string;\n npm: string;\n}\n\ninterface DistRecord {\n latest: string;\n}\n\nexport default function installLib(version, dest, options, callback) {\n const platform = options.platform || process.platform;\n const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');\n const installPath = path.join(libPath, 'node_modules', 'npm');\n\n get(NODE_DIST_URL).json((err, res1) => {\n if (err) return callback(err);\n const releases = res1.body as ReleaseRecord[];\n\n const found = releases.find((record) => record.version === version.version);\n const npmMajorPair = found && found.npm ? +found.npm.split('.')[0] : NPM_MIN_VERSION;\n const npmMajor = Math.max(npmMajorPair, NPM_MIN_VERSION);\n\n get(NPM_DIST_TAGS_URL).json((err, res2) => {\n if (err) return callback(err);\n const distTags = res2.body as DistRecord;\n const installVersion = distTags[`latest-${npmMajor}`] || distTags[`next-${npmMajor}`] || distTags.latest;\n const downloadPath = `${NPM_DIST_URL}/-/npm-${installVersion}.tgz`;\n const cachePath = path.join(options.cachePath, path.basename(downloadPath));\n conditionalCache(downloadPath, cachePath, (err) => {\n if (err) return callback(err);\n conditionalExtract(cachePath, installPath, callback);\n });\n });\n });\n}\n"],"names":["installLib","NODE_DIST_URL","NPM_DIST_TAGS_URL","NPM_DIST_URL","NPM_MIN_VERSION","version","dest","options","callback","platform","process","libPath","path","join","installPath","get","json","err","res1","releases","body","found","find","record","npmMajorPair","npm","split","npmMajor","Math","max","res2","distTags","installVersion","latest","downloadPath","cachePath","basename","conditionalCache","conditionalExtract"],"mappings":";;;;+BAoBA;;;eAAwBA;;;2DApBP;gEACD;uEAEa;yEACE;;;;;;AAE/B,IAAMC,gBAAgB;AACtB,IAAMC,oBAAoB;AAC1B,IAAMC,eAAe;AACrB,IAAMC,kBAAkB;AAWT,SAASJ,WAAWK,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACjE,IAAMC,WAAWF,QAAQE,QAAQ,IAAIC,QAAQD,QAAQ;IACrD,IAAME,UAAUF,aAAa,UAAUH,OAAOM,aAAI,CAACC,IAAI,CAACP,MAAM;IAC9D,IAAMQ,cAAcF,aAAI,CAACC,IAAI,CAACF,SAAS,gBAAgB;IAEvDI,IAAAA,kBAAG,EAACd,eAAee,IAAI,CAAC,SAACC,KAAKC;QAC5B,IAAID,KAAK,OAAOT,SAASS;QACzB,IAAME,WAAWD,KAAKE,IAAI;QAE1B,IAAMC,QAAQF,SAASG,IAAI,CAAC,SAACC;mBAAWA,OAAOlB,OAAO,KAAKA,QAAQA,OAAO;;QAC1E,IAAMmB,eAAeH,SAASA,MAAMI,GAAG,GAAG,CAACJ,MAAMI,GAAG,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE,GAAGtB;QACrE,IAAMuB,WAAWC,KAAKC,GAAG,CAACL,cAAcpB;QAExCW,IAAAA,kBAAG,EAACb,mBAAmBc,IAAI,CAAC,SAACC,KAAKa;YAChC,IAAIb,KAAK,OAAOT,SAASS;YACzB,IAAMc,WAAWD,KAAKV,IAAI;YAC1B,IAAMY,iBAAiBD,QAAQ,CAAC,AAAC,UAAkB,OAATJ,UAAW,IAAII,QAAQ,CAAC,AAAC,QAAgB,OAATJ,UAAW,IAAII,SAASE,MAAM;YACxG,IAAMC,eAAe,AAAC,GAAwBF,OAAtB7B,cAAa,WAAwB,OAAf6B,gBAAe;YAC7D,IAAMG,YAAYvB,aAAI,CAACC,IAAI,CAACN,QAAQ4B,SAAS,EAAEvB,aAAI,CAACwB,QAAQ,CAACF;YAC7DG,IAAAA,yBAAgB,EAACH,cAAcC,WAAW,SAAClB;gBACzC,IAAIA,KAAK,OAAOT,SAASS;gBACzBqB,IAAAA,2BAAkB,EAACH,WAAWrB,aAAaN;YAC7C;QACF;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNPM/installLib.ts"],"sourcesContent":["import path from 'path';\nimport get from 'get-remote';\nimport { getDist } from 'node-filename-to-dist-paths';\n\nimport conditionalCache from '../lib/conditionalCache';\nimport conditionalExtract from '../lib/conditionalExtract';\n\nimport { NPM_DIST_TAGS_URL, NPM_DIST_URL, NPM_MIN_VERSION } from '../constants';\n\ninterface DistRecord {\n latest: string;\n}\n\nexport default function installLib(version, dest, options, callback) {\n const platform = options.platform || process.platform;\n const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');\n const installPath = path.join(libPath, 'node_modules', 'npm');\n\n const dist = getDist(version);\n const npmMajorPair = dist && dist.npm ? +dist.npm.split('.')[0] : NPM_MIN_VERSION;\n const npmMajor = Math.max(npmMajorPair, NPM_MIN_VERSION);\n\n get(NPM_DIST_TAGS_URL).json((err, res) => {\n if (err) return callback(err);\n const distTags = res.body as DistRecord;\n const installVersion = distTags[`latest-${npmMajor}`] || distTags[`next-${npmMajor}`] || distTags.latest;\n const downloadPath = `${NPM_DIST_URL}/-/npm-${installVersion}.tgz`;\n const cachePath = path.join(options.cachePath, path.basename(downloadPath));\n conditionalCache(downloadPath, cachePath, (err) => {\n if (err) return callback(err);\n conditionalExtract(cachePath, installPath, callback);\n });\n });\n}\n"],"names":["installLib","version","dest","options","callback","platform","process","libPath","path","join","installPath","dist","getDist","npmMajorPair","npm","split","NPM_MIN_VERSION","npmMajor","Math","max","get","NPM_DIST_TAGS_URL","json","err","res","distTags","body","installVersion","latest","downloadPath","NPM_DIST_URL","cachePath","basename","conditionalCache","conditionalExtract"],"mappings":";;;;+BAaA;;;eAAwBA;;;2DAbP;gEACD;uCACQ;uEAEK;yEACE;yBAEkC;;;;;;AAMlD,SAASA,WAAWC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACjE,IAAMC,WAAWF,QAAQE,QAAQ,IAAIC,QAAQD,QAAQ;IACrD,IAAME,UAAUF,aAAa,UAAUH,OAAOM,aAAI,CAACC,IAAI,CAACP,MAAM;IAC9D,IAAMQ,cAAcF,aAAI,CAACC,IAAI,CAACF,SAAS,gBAAgB;IAEvD,IAAMI,OAAOC,IAAAA,gCAAO,EAACX;IACrB,IAAMY,eAAeF,QAAQA,KAAKG,GAAG,GAAG,CAACH,KAAKG,GAAG,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE,GAAGC,0BAAe;IACjF,IAAMC,WAAWC,KAAKC,GAAG,CAACN,cAAcG,0BAAe;IAEvDI,IAAAA,kBAAG,EAACC,4BAAiB,EAAEC,IAAI,CAAC,SAACC,KAAKC;QAChC,IAAID,KAAK,OAAOnB,SAASmB;QACzB,IAAME,WAAWD,IAAIE,IAAI;QACzB,IAAMC,iBAAiBF,QAAQ,CAAC,AAAC,UAAkB,OAATR,UAAW,IAAIQ,QAAQ,CAAC,AAAC,QAAgB,OAATR,UAAW,IAAIQ,SAASG,MAAM;QACxG,IAAMC,eAAe,AAAC,GAAwBF,OAAtBG,uBAAY,EAAC,WAAwB,OAAfH,gBAAe;QAC7D,IAAMI,YAAYvB,aAAI,CAACC,IAAI,CAACN,QAAQ4B,SAAS,EAAEvB,aAAI,CAACwB,QAAQ,CAACH;QAC7DI,IAAAA,yBAAgB,EAACJ,cAAcE,WAAW,SAACR;YACzC,IAAIA,KAAK,OAAOnB,SAASmB;YACzBW,IAAAA,2BAAkB,EAACH,WAAWrB,aAAaN;QAC7C;IACF;AACF"}
@@ -8,33 +8,47 @@ Object.defineProperty(exports, "default", {
8
8
  return install;
9
9
  }
10
10
  });
11
- var _lodashfind = /*#__PURE__*/ _interop_require_default(require("lodash.find"));
12
- var _endsWithFn = /*#__PURE__*/ _interop_require_default(require("../lib/endsWithFn.cjs"));
13
- var _findDistPaths = /*#__PURE__*/ _interop_require_default(require("./findDistPaths.cjs"));
14
- var _installCompressed = /*#__PURE__*/ _interop_require_default(require("./installCompressed.cjs"));
15
- var _installExe = /*#__PURE__*/ _interop_require_default(require("./installExe.cjs"));
16
- var _index = /*#__PURE__*/ _interop_require_default(require("./installSource/index.cjs"));
11
+ var _archcjs = /*#__PURE__*/ _interop_require_default(require("../machine/arch.cjs"));
12
+ var _installFilename = /*#__PURE__*/ _interop_require_default(require("./installFilename.cjs"));
17
13
  function _interop_require_default(obj) {
18
14
  return obj && obj.__esModule ? obj : {
19
15
  default: obj
20
16
  };
21
17
  }
18
+ var PLATFORM_MAP = {
19
+ win32: 'win',
20
+ darwin: 'osx'
21
+ };
22
+ var archMachine;
22
23
  function install(version, dest, options, callback) {
23
- var record = (0, _findDistPaths.default)(version, options);
24
- if (record) {
25
- if (record.filename === 'src') return (0, _index.default)(record.relativePaths[0], dest, record, options, callback);
26
- var relativePath = (0, _lodashfind.default)(record.relativePaths, (0, _endsWithFn.default)([
27
- '.tar.gz',
28
- '.zip'
29
- ]));
30
- if (relativePath) return (0, _installCompressed.default)(relativePath, dest, record, options, callback);
31
- relativePath = (0, _lodashfind.default)(record.relativePaths, (0, _endsWithFn.default)('.exe'));
32
- if (relativePath) return (0, _installExe.default)(relativePath, dest, record, options, callback);
33
- }
34
- record = (0, _findDistPaths.default)(version, {
35
- filename: 'src'
24
+ if (!archMachine) archMachine = (0, _archcjs.default)();
25
+ var platform = options.platform || process.platform;
26
+ platform = PLATFORM_MAP[platform] || platform;
27
+ var arch = options.arch || archMachine || process.arch;
28
+ var parts = [
29
+ platform,
30
+ arch
31
+ ];
32
+ if (options.type) parts.push(options.type);
33
+ if (options.compression) parts.push(options.compression);
34
+ var archs = [
35
+ arch
36
+ ];
37
+ if (archs.indexOf('x64') < 0) archs.push('x64');
38
+ if (arch !== process.arch && archs.indexOf(process.arch) < 0) archs.push(process.arch);
39
+ var filenames = archs.map(function(a) {
40
+ return [
41
+ platform,
42
+ a
43
+ ].concat(parts.slice(2)).join('-');
36
44
  });
37
- if (record && record.relativePaths.length) return (0, _index.default)(record.relativePaths[0], dest, record, options, callback);
38
- callback(new Error("Unable to install ".concat(version)));
45
+ filenames.push('src');
46
+ var tryNext = function(cb) {
47
+ if (filenames.length === 0) return cb(new Error("Failed to find installable for ".concat(version)));
48
+ (0, _installFilename.default)(filenames.shift(), version, dest, options, function(err) {
49
+ return err ? tryNext(cb) : cb();
50
+ });
51
+ };
52
+ tryNext(callback);
39
53
  }
40
54
  /* 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/installNode/index.ts"],"sourcesContent":["import find from 'lodash.find';\n\nimport endsWithFn from '../lib/endsWithFn';\nimport findDistPaths from './findDistPaths';\nimport installCompressed from './installCompressed';\nimport installExe from './installExe';\nimport installSource from './installSource/index';\n\nexport default function install(version, dest, options, callback) {\n let record = findDistPaths(version, options);\n if (record) {\n if (record.filename === 'src') return installSource(record.relativePaths[0], dest, record, options, callback);\n\n let relativePath = find(record.relativePaths, endsWithFn(['.tar.gz', '.zip']));\n if (relativePath) return installCompressed(relativePath, dest, record, options, callback);\n\n relativePath = find(record.relativePaths, endsWithFn('.exe'));\n if (relativePath) return installExe(relativePath, dest, record, options, callback);\n }\n\n record = findDistPaths(version, { filename: 'src' });\n if (record && record.relativePaths.length) return installSource(record.relativePaths[0], dest, record, options, callback);\n callback(new Error(`Unable to install ${version}`));\n}\n"],"names":["install","version","dest","options","callback","record","findDistPaths","filename","installSource","relativePaths","relativePath","find","endsWithFn","installCompressed","installExe","length","Error"],"mappings":";;;;+BAQA;;;eAAwBA;;;iEARP;iEAEM;oEACG;wEACI;iEACP;4DACG;;;;;;AAEX,SAASA,QAAQC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC9D,IAAIC,SAASC,IAAAA,sBAAa,EAACL,SAASE;IACpC,IAAIE,QAAQ;QACV,IAAIA,OAAOE,QAAQ,KAAK,OAAO,OAAOC,IAAAA,cAAa,EAACH,OAAOI,aAAa,CAAC,EAAE,EAAEP,MAAMG,QAAQF,SAASC;QAEpG,IAAIM,eAAeC,IAAAA,mBAAI,EAACN,OAAOI,aAAa,EAAEG,IAAAA,mBAAU,EAAC;YAAC;YAAW;SAAO;QAC5E,IAAIF,cAAc,OAAOG,IAAAA,0BAAiB,EAACH,cAAcR,MAAMG,QAAQF,SAASC;QAEhFM,eAAeC,IAAAA,mBAAI,EAACN,OAAOI,aAAa,EAAEG,IAAAA,mBAAU,EAAC;QACrD,IAAIF,cAAc,OAAOI,IAAAA,mBAAU,EAACJ,cAAcR,MAAMG,QAAQF,SAASC;IAC3E;IAEAC,SAASC,IAAAA,sBAAa,EAACL,SAAS;QAAEM,UAAU;IAAM;IAClD,IAAIF,UAAUA,OAAOI,aAAa,CAACM,MAAM,EAAE,OAAOP,IAAAA,cAAa,EAACH,OAAOI,aAAa,CAAC,EAAE,EAAEP,MAAMG,QAAQF,SAASC;IAChHA,SAAS,IAAIY,MAAM,AAAC,qBAA4B,OAARf;AAC1C"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/index.ts"],"sourcesContent":["import realArch from '../machine/arch.cjs';\nimport installFilename from './installFilename';\n\nconst PLATFORM_MAP = {\n win32: 'win',\n darwin: 'osx',\n};\n\nlet archMachine: NodeJS.Architecture;\nexport default function install(version, dest, options, callback) {\n if (!archMachine) archMachine = realArch() as NodeJS.Architecture;\n let platform = options.platform || process.platform;\n platform = PLATFORM_MAP[platform] || platform;\n const arch = options.arch || archMachine || process.arch;\n const parts = [platform, arch];\n if (options.type) parts.push(options.type);\n if (options.compression) parts.push(options.compression);\n\n const archs = [arch];\n if (archs.indexOf('x64') < 0) archs.push('x64');\n if (arch !== process.arch && archs.indexOf(process.arch) < 0) archs.push(process.arch);\n const filenames = archs.map((a) => [platform, a].concat(parts.slice(2)).join('-'));\n filenames.push('src');\n\n const tryNext = (cb) => {\n if (filenames.length === 0) return cb(new Error(`Failed to find installable for ${version}`));\n installFilename(filenames.shift(), version, dest, options, (err) => (err ? tryNext(cb) : cb()));\n };\n tryNext(callback);\n}\n"],"names":["install","PLATFORM_MAP","win32","darwin","archMachine","version","dest","options","callback","realArch","platform","process","arch","parts","type","push","compression","archs","indexOf","filenames","map","a","concat","slice","join","tryNext","cb","length","Error","installFilename","shift","err"],"mappings":";;;;+BASA;;;eAAwBA;;;8DATH;sEACO;;;;;;AAE5B,IAAMC,eAAe;IACnBC,OAAO;IACPC,QAAQ;AACV;AAEA,IAAIC;AACW,SAASJ,QAAQK,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC9D,IAAI,CAACJ,aAAaA,cAAcK,IAAAA,gBAAQ;IACxC,IAAIC,WAAWH,QAAQG,QAAQ,IAAIC,QAAQD,QAAQ;IACnDA,WAAWT,YAAY,CAACS,SAAS,IAAIA;IACrC,IAAME,OAAOL,QAAQK,IAAI,IAAIR,eAAeO,QAAQC,IAAI;IACxD,IAAMC,QAAQ;QAACH;QAAUE;KAAK;IAC9B,IAAIL,QAAQO,IAAI,EAAED,MAAME,IAAI,CAACR,QAAQO,IAAI;IACzC,IAAIP,QAAQS,WAAW,EAAEH,MAAME,IAAI,CAACR,QAAQS,WAAW;IAEvD,IAAMC,QAAQ;QAACL;KAAK;IACpB,IAAIK,MAAMC,OAAO,CAAC,SAAS,GAAGD,MAAMF,IAAI,CAAC;IACzC,IAAIH,SAASD,QAAQC,IAAI,IAAIK,MAAMC,OAAO,CAACP,QAAQC,IAAI,IAAI,GAAGK,MAAMF,IAAI,CAACJ,QAAQC,IAAI;IACrF,IAAMO,YAAYF,MAAMG,GAAG,CAAC,SAACC;eAAM;YAACX;YAAUW;SAAE,CAACC,MAAM,CAACT,MAAMU,KAAK,CAAC,IAAIC,IAAI,CAAC;;IAC7EL,UAAUJ,IAAI,CAAC;IAEf,IAAMU,UAAU,SAACC;QACf,IAAIP,UAAUQ,MAAM,KAAK,GAAG,OAAOD,GAAG,IAAIE,MAAM,AAAC,kCAAyC,OAARvB;QAClFwB,IAAAA,wBAAe,EAACV,UAAUW,KAAK,IAAIzB,SAASC,MAAMC,SAAS,SAACwB;mBAASA,MAAMN,QAAQC,MAAMA;;IAC3F;IACAD,QAAQjB;AACV"}
@@ -10,10 +10,13 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
12
  var _fsaccesscompat = /*#__PURE__*/ _interop_require_default(require("fs-access-compat"));
13
+ var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
13
14
  var _rimraf2 = /*#__PURE__*/ _interop_require_default(require("rimraf2"));
15
+ var _constants = require("../constants.cjs");
14
16
  var _conditionalCache = /*#__PURE__*/ _interop_require_default(require("../lib/conditionalCache.cjs"));
15
17
  var _conditionalExtract = /*#__PURE__*/ _interop_require_default(require("../lib/conditionalExtract.cjs"));
16
18
  var _progress = /*#__PURE__*/ _interop_require_default(require("../lib/progress.cjs"));
19
+ var _validateDownload = /*#__PURE__*/ _interop_require_default(require("./validateDownload.cjs"));
17
20
  function _define_property(obj, key, value) {
18
21
  if (key in obj) {
19
22
  Object.defineProperty(obj, key, {
@@ -47,29 +50,28 @@ function _object_spread(target) {
47
50
  }
48
51
  return target;
49
52
  }
50
- function installCompressed(relativePath, dest, _record, options, callback) {
51
- var downloadPath = options.downloadURL(relativePath);
53
+ function installCompressed(distPath, dest, options, callback) {
54
+ var downloadPath = "".concat(_constants.NODE_DIST_BASE_URL, "/").concat(distPath);
52
55
  var cachePath = _path.default.join(options.cachePath, _path.default.basename(downloadPath));
53
- (0, _conditionalCache.default)(downloadPath, cachePath, function(err) {
54
- if (err) return callback(err);
55
- (0, _fsaccesscompat.default)(dest, function(err) {
56
- if (!err) return callback(); // already exists
57
- (0, _conditionalExtract.default)(cachePath, dest, _object_spread({
58
- strip: 1,
59
- progress: _progress.default,
60
- time: 1000
61
- }, options), function(err) {
62
- console.log('');
63
- if (err) return callback(err);
64
- // some compressed versions of node come with npm pre-installed, but we want to override with a specific version
65
- var platform = options.platform || process.platform;
66
- var libPath = platform === 'win32' ? dest : _path.default.join(dest, 'lib');
67
- var installPath = _path.default.join(libPath, 'node_modules', 'npm');
68
- (0, _rimraf2.default)(installPath, {
69
- disableGlob: true
70
- }, function() {
71
- callback(err);
72
- });
56
+ (0, _fsaccesscompat.default)(dest, function(err) {
57
+ if (!err) return callback(); // already exists
58
+ var queue = new _queuecb.default(1);
59
+ queue.defer(_conditionalCache.default.bind(null, downloadPath, cachePath));
60
+ queue.defer(_validateDownload.default.bind(null, distPath, cachePath));
61
+ queue.defer(_conditionalExtract.default.bind(null, cachePath, dest, _object_spread({
62
+ strip: 1,
63
+ progress: _progress.default,
64
+ time: 1000
65
+ }, options)));
66
+ queue.await(function(err) {
67
+ // some compressed versions of node come with npm pre-installed, but we want to override with a specific version
68
+ var platform = options.platform || process.platform;
69
+ var libPath = platform === 'win32' ? dest : _path.default.join(dest, 'lib');
70
+ var installPath = _path.default.join(libPath, 'node_modules', 'npm');
71
+ (0, _rimraf2.default)(installPath, {
72
+ disableGlob: true
73
+ }, function() {
74
+ return callback(err);
73
75
  });
74
76
  });
75
77
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installCompressed.ts"],"sourcesContent":["import path from 'path';\nimport access from 'fs-access-compat';\nimport rimraf2 from 'rimraf2';\n\nimport conditionalCache from '../lib/conditionalCache';\nimport conditionalExtract from '../lib/conditionalExtract';\nimport progress from '../lib/progress.js';\n\nexport default function installCompressed(relativePath, dest, _record, options, callback) {\n const downloadPath = options.downloadURL(relativePath);\n const cachePath = path.join(options.cachePath, path.basename(downloadPath));\n\n conditionalCache(downloadPath, cachePath, (err) => {\n if (err) return callback(err);\n access(dest, (err) => {\n if (!err) return callback(); // already exists\n conditionalExtract(cachePath, dest, { strip: 1, progress: progress, time: 1000, ...options }, (err) => {\n console.log('');\n if (err) return callback(err);\n\n // some compressed versions of node come with npm pre-installed, but we want to override with a specific version\n const platform = options.platform || process.platform;\n const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');\n const installPath = path.join(libPath, 'node_modules', 'npm');\n rimraf2(installPath, { disableGlob: true }, () => {\n callback(err);\n });\n });\n });\n });\n}\n"],"names":["installCompressed","relativePath","dest","_record","options","callback","downloadPath","downloadURL","cachePath","path","join","basename","conditionalCache","err","access","conditionalExtract","strip","progress","time","console","log","platform","process","libPath","installPath","rimraf2","disableGlob"],"mappings":";;;;+BAQA;;;eAAwBA;;;2DARP;qEACE;8DACC;uEAES;yEACE;+DACV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEN,SAASA,kBAAkBC,YAAY,EAAEC,IAAI,EAAEC,OAAO,EAAEC,OAAO,EAAEC,QAAQ;IACtF,IAAMC,eAAeF,QAAQG,WAAW,CAACN;IACzC,IAAMO,YAAYC,aAAI,CAACC,IAAI,CAACN,QAAQI,SAAS,EAAEC,aAAI,CAACE,QAAQ,CAACL;IAE7DM,IAAAA,yBAAgB,EAACN,cAAcE,WAAW,SAACK;QACzC,IAAIA,KAAK,OAAOR,SAASQ;QACzBC,IAAAA,uBAAM,EAACZ,MAAM,SAACW;YACZ,IAAI,CAACA,KAAK,OAAOR,YAAY,iBAAiB;YAC9CU,IAAAA,2BAAkB,EAACP,WAAWN,MAAM;gBAAEc,OAAO;gBAAGC,UAAUA,iBAAQ;gBAAEC,MAAM;eAASd,UAAW,SAACS;gBAC7FM,QAAQC,GAAG,CAAC;gBACZ,IAAIP,KAAK,OAAOR,SAASQ;gBAEzB,gHAAgH;gBAChH,IAAMQ,WAAWjB,QAAQiB,QAAQ,IAAIC,QAAQD,QAAQ;gBACrD,IAAME,UAAUF,aAAa,UAAUnB,OAAOO,aAAI,CAACC,IAAI,CAACR,MAAM;gBAC9D,IAAMsB,cAAcf,aAAI,CAACC,IAAI,CAACa,SAAS,gBAAgB;gBACvDE,IAAAA,gBAAO,EAACD,aAAa;oBAAEE,aAAa;gBAAK,GAAG;oBAC1CrB,SAASQ;gBACX;YACF;QACF;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installCompressed.ts"],"sourcesContent":["import path from 'path';\nimport access from 'fs-access-compat';\nimport Queue from 'queue-cb';\nimport rimraf2 from 'rimraf2';\n\nimport { NODE_DIST_BASE_URL } from '../constants';\nimport conditionalCache from '../lib/conditionalCache';\nimport conditionalExtract from '../lib/conditionalExtract';\nimport progress from '../lib/progress.js';\nimport validateDownload from './validateDownload';\n\nexport default function installCompressed(distPath, dest, options, callback) {\n const downloadPath = `${NODE_DIST_BASE_URL}/${distPath}`;\n const cachePath = path.join(options.cachePath, path.basename(downloadPath));\n\n access(dest, (err) => {\n if (!err) return callback(); // already exists\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, dest, { strip: 1, progress: progress, time: 1000, ...options }));\n queue.await((err) => {\n // some compressed versions of node come with npm pre-installed, but we want to override with a specific version\n const platform = options.platform || process.platform;\n const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');\n const installPath = path.join(libPath, 'node_modules', 'npm');\n rimraf2(installPath, { disableGlob: true }, () => callback(err));\n });\n });\n}\n"],"names":["installCompressed","distPath","dest","options","callback","downloadPath","NODE_DIST_BASE_URL","cachePath","path","join","basename","access","err","queue","Queue","defer","conditionalCache","bind","validateDownload","conditionalExtract","strip","progress","time","await","platform","process","libPath","installPath","rimraf2","disableGlob"],"mappings":";;;;+BAWA;;;eAAwBA;;;2DAXP;qEACE;8DACD;8DACE;yBAEe;uEACN;yEACE;+DACV;uEACQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,SAASA,kBAAkBC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACzE,IAAMC,eAAe,AAAC,GAAwBJ,OAAtBK,6BAAkB,EAAC,KAAY,OAATL;IAC9C,IAAMM,YAAYC,aAAI,CAACC,IAAI,CAACN,QAAQI,SAAS,EAAEC,aAAI,CAACE,QAAQ,CAACL;IAE7DM,IAAAA,uBAAM,EAACT,MAAM,SAACU;QACZ,IAAI,CAACA,KAAK,OAAOR,YAAY,iBAAiB;QAE9C,IAAMS,QAAQ,IAAIC,gBAAK,CAAC;QACxBD,MAAME,KAAK,CAACC,yBAAgB,CAACC,IAAI,CAAC,MAAMZ,cAAcE;QACtDM,MAAME,KAAK,CAACG,yBAAgB,CAACD,IAAI,CAAC,MAAMhB,UAAUM;QAClDM,MAAME,KAAK,CAACI,2BAAkB,CAACF,IAAI,CAAC,MAAMV,WAAWL,MAAM;YAAEkB,OAAO;YAAGC,UAAUA,iBAAQ;YAAEC,MAAM;WAASnB;QAC1GU,MAAMU,KAAK,CAAC,SAACX;YACX,gHAAgH;YAChH,IAAMY,WAAWrB,QAAQqB,QAAQ,IAAIC,QAAQD,QAAQ;YACrD,IAAME,UAAUF,aAAa,UAAUtB,OAAOM,aAAI,CAACC,IAAI,CAACP,MAAM;YAC9D,IAAMyB,cAAcnB,aAAI,CAACC,IAAI,CAACiB,SAAS,gBAAgB;YACvDE,IAAAA,gBAAO,EAACD,aAAa;gBAAEE,aAAa;YAAK,GAAG;uBAAMzB,SAASQ;;QAC7D;IACF;AACF"}
@@ -10,23 +10,27 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
12
  var _fsaccesscompat = /*#__PURE__*/ _interop_require_default(require("fs-access-compat"));
13
+ var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
14
+ var _constants = require("../constants.cjs");
13
15
  var _conditionalCache = /*#__PURE__*/ _interop_require_default(require("../lib/conditionalCache.cjs"));
14
16
  var _copyFile = /*#__PURE__*/ _interop_require_default(require("../lib/copyFile.cjs"));
17
+ var _validateDownload = /*#__PURE__*/ _interop_require_default(require("./validateDownload.cjs"));
15
18
  function _interop_require_default(obj) {
16
19
  return obj && obj.__esModule ? obj : {
17
20
  default: obj
18
21
  };
19
22
  }
20
- function installExe(relativePath, dest, record, options, callback) {
21
- var downloadPath = options.downloadURL(relativePath);
22
- var cachePath = _path.default.join(options.cachePath, "node-".concat(record.version, ".exe"));
23
- var destPath = _path.default.join(dest, _path.default.basename(relativePath));
23
+ function installExe(distPath, dest, options, callback) {
24
+ var downloadPath = "".concat(_constants.NODE_DIST_BASE_URL, "/").concat(distPath);
25
+ var cachePath = _path.default.join(options.cachePath, "node-".concat(distPath, ".exe"));
26
+ var destPath = _path.default.join(dest, _path.default.basename(distPath));
24
27
  (0, _fsaccesscompat.default)(destPath, function(err) {
25
28
  if (!err) return callback(); // already exists
26
- (0, _conditionalCache.default)(downloadPath, cachePath, function(err) {
27
- if (err) return callback(err);
28
- (0, _copyFile.default)(cachePath, destPath, callback);
29
- });
29
+ var queue = new _queuecb.default(1);
30
+ queue.defer(_conditionalCache.default.bind(null, downloadPath, cachePath));
31
+ queue.defer(_validateDownload.default.bind(null, distPath, cachePath));
32
+ queue.defer(_copyFile.default.bind(cachePath, destPath));
33
+ queue.await(callback);
30
34
  });
31
35
  }
32
36
  /* 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/installNode/installExe.ts"],"sourcesContent":["import path from 'path';\nimport access from 'fs-access-compat';\n\nimport conditionalCache from '../lib/conditionalCache';\nimport copyFile from '../lib/copyFile';\n\nexport default function installExe(relativePath, dest, record, options, callback) {\n const downloadPath = options.downloadURL(relativePath);\n const cachePath = path.join(options.cachePath, `node-${record.version}.exe`);\n const destPath = path.join(dest, path.basename(relativePath));\n\n access(destPath, (err) => {\n if (!err) return callback(); // already exists\n conditionalCache(downloadPath, cachePath, (err) => {\n if (err) return callback(err);\n copyFile(cachePath, destPath, callback);\n });\n });\n}\n"],"names":["installExe","relativePath","dest","record","options","callback","downloadPath","downloadURL","cachePath","path","join","version","destPath","basename","access","err","conditionalCache","copyFile"],"mappings":";;;;+BAMA;;;eAAwBA;;;2DANP;qEACE;uEAEU;+DACR;;;;;;AAEN,SAASA,WAAWC,YAAY,EAAEC,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ;IAC9E,IAAMC,eAAeF,QAAQG,WAAW,CAACN;IACzC,IAAMO,YAAYC,aAAI,CAACC,IAAI,CAACN,QAAQI,SAAS,EAAE,AAAC,QAAsB,OAAfL,OAAOQ,OAAO,EAAC;IACtE,IAAMC,WAAWH,aAAI,CAACC,IAAI,CAACR,MAAMO,aAAI,CAACI,QAAQ,CAACZ;IAE/Ca,IAAAA,uBAAM,EAACF,UAAU,SAACG;QAChB,IAAI,CAACA,KAAK,OAAOV,YAAY,iBAAiB;QAC9CW,IAAAA,yBAAgB,EAACV,cAAcE,WAAW,SAACO;YACzC,IAAIA,KAAK,OAAOV,SAASU;YACzBE,IAAAA,iBAAQ,EAACT,WAAWI,UAAUP;QAChC;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installExe.ts"],"sourcesContent":["import path from 'path';\nimport access from 'fs-access-compat';\nimport Queue from 'queue-cb';\n\nimport { NODE_DIST_BASE_URL } from '../constants';\nimport conditionalCache from '../lib/conditionalCache';\nimport copyFile from '../lib/copyFile';\nimport validateDownload from './validateDownload';\n\nexport default function installExe(distPath, dest, options, callback) {\n const downloadPath = `${NODE_DIST_BASE_URL}/${distPath}`;\n const cachePath = path.join(options.cachePath, `node-${distPath}.exe`);\n const destPath = path.join(dest, path.basename(distPath));\n\n access(destPath, (err) => {\n if (!err) return callback(); // already exists\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(copyFile.bind(cachePath, destPath));\n queue.await(callback);\n });\n}\n"],"names":["installExe","distPath","dest","options","callback","downloadPath","NODE_DIST_BASE_URL","cachePath","path","join","destPath","basename","access","err","queue","Queue","defer","conditionalCache","bind","validateDownload","copyFile","await"],"mappings":";;;;+BASA;;;eAAwBA;;;2DATP;qEACE;8DACD;yBAEiB;uEACN;+DACR;uEACQ;;;;;;AAEd,SAASA,WAAWC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAClE,IAAMC,eAAe,AAAC,GAAwBJ,OAAtBK,6BAAkB,EAAC,KAAY,OAATL;IAC9C,IAAMM,YAAYC,aAAI,CAACC,IAAI,CAACN,QAAQI,SAAS,EAAE,AAAC,QAAgB,OAATN,UAAS;IAChE,IAAMS,WAAWF,aAAI,CAACC,IAAI,CAACP,MAAMM,aAAI,CAACG,QAAQ,CAACV;IAE/CW,IAAAA,uBAAM,EAACF,UAAU,SAACG;QAChB,IAAI,CAACA,KAAK,OAAOT,YAAY,iBAAiB;QAE9C,IAAMU,QAAQ,IAAIC,gBAAK,CAAC;QACxBD,MAAME,KAAK,CAACC,yBAAgB,CAACC,IAAI,CAAC,MAAMb,cAAcE;QACtDO,MAAME,KAAK,CAACG,yBAAgB,CAACD,IAAI,CAAC,MAAMjB,UAAUM;QAClDO,MAAME,KAAK,CAACI,iBAAQ,CAACF,IAAI,CAACX,WAAWG;QACrCI,MAAMO,KAAK,CAACjB;IACd;AACF"}
@@ -0,0 +1,31 @@
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 installFilename;
9
+ }
10
+ });
11
+ var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
+ var _nodefilenametodistpaths = /*#__PURE__*/ _interop_require_default(require("node-filename-to-dist-paths"));
13
+ var _constants = require("../constants.cjs");
14
+ var _installCompressed = /*#__PURE__*/ _interop_require_default(require("./installCompressed.cjs"));
15
+ var _installExe = /*#__PURE__*/ _interop_require_default(require("./installExe.cjs"));
16
+ var _index = /*#__PURE__*/ _interop_require_default(require("./installSource/index.cjs"));
17
+ function _interop_require_default(obj) {
18
+ return obj && obj.__esModule ? obj : {
19
+ default: obj
20
+ };
21
+ }
22
+ function installFilename(filename, version, dest, options, callback) {
23
+ var distPath = (0, _nodefilenametodistpaths.default)(filename, version);
24
+ if (!distPath) return callback(new Error('Not found'));
25
+ var ext = _path.default.extname(distPath);
26
+ if (ext === '.exe') return (0, _installExe.default)(distPath, dest, options, callback);
27
+ if (_constants.EXTENSIONS_COMPRESSED.indexOf(ext) >= 0) return (0, _installCompressed.default)(distPath, dest, options, callback);
28
+ if (filename === 'src') return (0, _index.default)(distPath, dest, options, callback);
29
+ callback(new Error("Unable to install ".concat(version, " distPath: ").concat(distPath)));
30
+ }
31
+ /* 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/installNode/installFilename.ts"],"sourcesContent":["import path from 'path';\nimport fromFilename from 'node-filename-to-dist-paths';\nimport { EXTENSIONS_COMPRESSED } from '../constants';\n\nimport installCompressed from './installCompressed';\nimport installExe from './installExe';\nimport installSource from './installSource/index';\n\nexport default function installFilename(filename, version, dest, options, callback) {\n const distPath = fromFilename(filename, version);\n if (!distPath) return callback(new Error('Not found'));\n const ext = path.extname(distPath);\n\n if (ext === '.exe') return installExe(distPath, dest, options, callback);\n if (EXTENSIONS_COMPRESSED.indexOf(ext) >= 0) return installCompressed(distPath, dest, options, callback);\n if (filename === 'src') return installSource(distPath, dest, options, callback);\n callback(new Error(`Unable to install ${version} distPath: ${distPath}`));\n}\n"],"names":["installFilename","filename","version","dest","options","callback","distPath","fromFilename","Error","ext","path","extname","installExe","EXTENSIONS_COMPRESSED","indexOf","installCompressed","installSource"],"mappings":";;;;+BAQA;;;eAAwBA;;;2DARP;8EACQ;yBACa;wEAER;iEACP;4DACG;;;;;;AAEX,SAASA,gBAAgBC,QAAQ,EAAEC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAChF,IAAMC,WAAWC,IAAAA,gCAAY,EAACN,UAAUC;IACxC,IAAI,CAACI,UAAU,OAAOD,SAAS,IAAIG,MAAM;IACzC,IAAMC,MAAMC,aAAI,CAACC,OAAO,CAACL;IAEzB,IAAIG,QAAQ,QAAQ,OAAOG,IAAAA,mBAAU,EAACN,UAAUH,MAAMC,SAASC;IAC/D,IAAIQ,gCAAqB,CAACC,OAAO,CAACL,QAAQ,GAAG,OAAOM,IAAAA,0BAAiB,EAACT,UAAUH,MAAMC,SAASC;IAC/F,IAAIJ,aAAa,OAAO,OAAOe,IAAAA,cAAa,EAACV,UAAUH,MAAMC,SAASC;IACtEA,SAAS,IAAIG,MAAM,AAAC,qBAAyCF,OAArBJ,SAAQ,eAAsB,OAATI;AAC/D"}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
7
  get: function() {
8
- return installDefault;
8
+ return installPosix;
9
9
  }
10
10
  });
11
11
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
@@ -17,27 +17,23 @@ function _interop_require_default(obj) {
17
17
  default: obj
18
18
  };
19
19
  }
20
- function installDefault(buildPath, dest, _options, callback) {
20
+ function installPosix(buildPath, dest, _options, callback) {
21
21
  var buildTarget = _path.default.join(dest, 'node');
22
22
  (0, _fsaccesscompat.default)(buildTarget, function(err) {
23
23
  if (!err) return callback(); // already exists
24
24
  var queue = new _queuecb.default(1);
25
- queue.defer(function(callback) {
26
- (0, _crossspawncb.default)('./configure', [
27
- "--prefix=".concat(dest)
28
- ], {
29
- stdio: 'inherit',
30
- cwd: buildPath
31
- }, callback);
32
- });
33
- queue.defer(function(callback) {
34
- (0, _crossspawncb.default)('make', [
35
- 'install'
36
- ], {
37
- stdio: 'inherit',
38
- cwd: buildPath
39
- }, callback);
40
- });
25
+ queue.defer(_crossspawncb.default.bind(null, './configure', [
26
+ "--prefix=".concat(dest)
27
+ ], {
28
+ stdio: 'inherit',
29
+ cwd: buildPath
30
+ }));
31
+ queue.defer(_crossspawncb.default.bind(null, 'make', [
32
+ 'install'
33
+ ], {
34
+ stdio: 'inherit',
35
+ cwd: buildPath
36
+ }, callback));
41
37
  queue.await(callback);
42
38
  });
43
39
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installSource/buildPosix.ts"],"sourcesContent":["import path from 'path';\nimport spawn from 'cross-spawn-cb';\nimport access from 'fs-access-compat';\nimport Queue from 'queue-cb';\n\nexport default function installDefault(buildPath, dest, _options, callback) {\n const buildTarget = path.join(dest, 'node');\n\n access(buildTarget, (err) => {\n if (!err) return callback(); // already exists\n\n const queue = new Queue(1);\n queue.defer((callback) => {\n spawn('./configure', [`--prefix=${dest}`], { stdio: 'inherit', cwd: buildPath }, callback);\n });\n queue.defer((callback) => {\n spawn('make', ['install'], { stdio: 'inherit', cwd: buildPath }, callback);\n });\n queue.await(callback);\n });\n}\n"],"names":["installDefault","buildPath","dest","_options","callback","buildTarget","path","join","access","err","queue","Queue","defer","spawn","stdio","cwd","await"],"mappings":";;;;+BAKA;;;eAAwBA;;;2DALP;mEACC;qEACC;8DACD;;;;;;AAEH,SAASA,eAAeC,SAAS,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ;IACxE,IAAMC,cAAcC,aAAI,CAACC,IAAI,CAACL,MAAM;IAEpCM,IAAAA,uBAAM,EAACH,aAAa,SAACI;QACnB,IAAI,CAACA,KAAK,OAAOL,YAAY,iBAAiB;QAE9C,IAAMM,QAAQ,IAAIC,gBAAK,CAAC;QACxBD,MAAME,KAAK,CAAC,SAACR;YACXS,IAAAA,qBAAK,EAAC,eAAe;gBAAE,YAAgB,OAALX;aAAO,EAAE;gBAAEY,OAAO;gBAAWC,KAAKd;YAAU,GAAGG;QACnF;QACAM,MAAME,KAAK,CAAC,SAACR;YACXS,IAAAA,qBAAK,EAAC,QAAQ;gBAAC;aAAU,EAAE;gBAAEC,OAAO;gBAAWC,KAAKd;YAAU,GAAGG;QACnE;QACAM,MAAMM,KAAK,CAACZ;IACd;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installSource/buildPosix.ts"],"sourcesContent":["import path from 'path';\nimport spawn from 'cross-spawn-cb';\nimport access from 'fs-access-compat';\nimport Queue from 'queue-cb';\n\nexport default function installPosix(buildPath, dest, _options, callback) {\n const buildTarget = path.join(dest, 'node');\n\n access(buildTarget, (err) => {\n if (!err) return callback(); // already exists\n\n const queue = new Queue(1);\n queue.defer(spawn.bind(null, './configure', [`--prefix=${dest}`], { stdio: 'inherit', cwd: buildPath }));\n queue.defer(spawn.bind(null, 'make', ['install'], { stdio: 'inherit', cwd: buildPath }, callback));\n queue.await(callback);\n });\n}\n"],"names":["installPosix","buildPath","dest","_options","callback","buildTarget","path","join","access","err","queue","Queue","defer","spawn","bind","stdio","cwd","await"],"mappings":";;;;+BAKA;;;eAAwBA;;;2DALP;mEACC;qEACC;8DACD;;;;;;AAEH,SAASA,aAAaC,SAAS,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ;IACtE,IAAMC,cAAcC,aAAI,CAACC,IAAI,CAACL,MAAM;IAEpCM,IAAAA,uBAAM,EAACH,aAAa,SAACI;QACnB,IAAI,CAACA,KAAK,OAAOL,YAAY,iBAAiB;QAE9C,IAAMM,QAAQ,IAAIC,gBAAK,CAAC;QACxBD,MAAME,KAAK,CAACC,qBAAK,CAACC,IAAI,CAAC,MAAM,eAAe;YAAE,YAAgB,OAALZ;SAAO,EAAE;YAAEa,OAAO;YAAWC,KAAKf;QAAU;QACrGS,MAAME,KAAK,CAACC,qBAAK,CAACC,IAAI,CAAC,MAAM,QAAQ;YAAC;SAAU,EAAE;YAAEC,OAAO;YAAWC,KAAKf;QAAU,GAAGG;QACxFM,MAAMO,KAAK,CAACb;IACd;AACF"}