node-install-release 1.6.3 → 1.7.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 (188) hide show
  1. package/bin/cli.cjs +3 -0
  2. package/dist/cjs/{cli.js → cli.cjs} +8 -46
  3. package/dist/cjs/cli.cjs.map +1 -0
  4. package/dist/cjs/constants.cjs +21 -0
  5. package/dist/cjs/constants.cjs.map +1 -0
  6. package/dist/cjs/{index.js → index.cjs} +8 -8
  7. package/dist/cjs/index.cjs.map +1 -0
  8. package/dist/cjs/installNPM/index.cjs +24 -0
  9. package/dist/cjs/installNPM/index.cjs.map +1 -0
  10. package/dist/cjs/installNPM/installBin.cjs +64 -0
  11. package/dist/cjs/installNPM/installBin.cjs.map +1 -0
  12. package/dist/cjs/installNPM/installLib.cjs +49 -0
  13. package/dist/cjs/installNPM/installLib.cjs.map +1 -0
  14. package/dist/cjs/installNode/{findDistPaths.js → findDistPaths.cjs} +20 -6
  15. package/dist/cjs/installNode/findDistPaths.cjs.map +1 -0
  16. package/dist/cjs/installNode/index.cjs +40 -0
  17. package/dist/cjs/installNode/index.cjs.map +1 -0
  18. package/dist/cjs/installNode/{installCompressed.js → installCompressed.cjs} +30 -16
  19. package/dist/cjs/installNode/installCompressed.cjs.map +1 -0
  20. package/dist/cjs/installNode/installExe.cjs +32 -0
  21. package/dist/cjs/installNode/installExe.cjs.map +1 -0
  22. package/dist/cjs/installNode/installSource/buildPosix.cjs +44 -0
  23. package/dist/cjs/installNode/installSource/buildPosix.cjs.map +1 -0
  24. package/dist/cjs/installNode/installSource/buildWin32.cjs +40 -0
  25. package/dist/cjs/installNode/installSource/buildWin32.cjs.map +1 -0
  26. package/dist/cjs/installNode/installSource/index.cjs +36 -0
  27. package/dist/cjs/installNode/installSource/index.cjs.map +1 -0
  28. package/dist/cjs/installNode/{prebuilts.js → prebuilts.cjs} +19 -6
  29. package/dist/cjs/installNode/prebuilts.cjs.map +1 -0
  30. package/dist/cjs/lib/arch.cjs.map +1 -0
  31. package/dist/cjs/{checkMissing.js → lib/checkMissing.cjs} +22 -8
  32. package/dist/cjs/lib/checkMissing.cjs.map +1 -0
  33. package/dist/cjs/{conditionalCache.js → lib/conditionalCache.cjs} +27 -13
  34. package/dist/cjs/lib/conditionalCache.cjs.map +1 -0
  35. package/dist/cjs/lib/conditionalCopy.cjs +36 -0
  36. package/dist/cjs/lib/conditionalCopy.cjs.map +1 -0
  37. package/dist/cjs/{conditionalExtract.js → lib/conditionalExtract.cjs} +25 -11
  38. package/dist/cjs/lib/conditionalExtract.cjs.map +1 -0
  39. package/dist/cjs/lib/copyFile.cjs +41 -0
  40. package/dist/cjs/lib/copyFile.cjs.map +1 -0
  41. package/dist/cjs/lib/endsWithFn.cjs +29 -0
  42. package/dist/cjs/lib/endsWithFn.cjs.map +1 -0
  43. package/dist/cjs/lib/ensureDestinationParent.cjs +23 -0
  44. package/dist/cjs/lib/ensureDestinationParent.cjs.map +1 -0
  45. package/dist/cjs/lib/progress.cjs +22 -0
  46. package/dist/cjs/lib/progress.cjs.map +1 -0
  47. package/dist/cjs/polyfills/execCallback.cjs.map +1 -0
  48. package/dist/cjs/{polyfills.js → polyfills.cjs} +1 -1
  49. package/dist/cjs/polyfills.cjs.map +1 -0
  50. package/dist/cjs/{progress.js → types.cjs} +3 -6
  51. package/dist/cjs/types.cjs.map +1 -0
  52. package/dist/cjs/workers/install.cjs +120 -0
  53. package/dist/cjs/workers/install.cjs.map +1 -0
  54. package/dist/esm/cli.mjs +38 -0
  55. package/dist/esm/cli.mjs.map +1 -0
  56. package/dist/esm/constants.mjs +2 -0
  57. package/dist/esm/constants.mjs.map +1 -0
  58. package/dist/esm/index.mjs +11 -0
  59. package/dist/esm/index.mjs.map +1 -0
  60. package/dist/esm/installNPM/index.mjs +8 -0
  61. package/dist/esm/installNPM/index.mjs.map +1 -0
  62. package/dist/{cjs/installNPM/installBin.js → esm/installNPM/installBin.mjs} +13 -15
  63. package/dist/esm/installNPM/installBin.mjs.map +1 -0
  64. package/dist/esm/installNPM/installLib.mjs +31 -0
  65. package/dist/esm/installNPM/installLib.mjs.map +1 -0
  66. package/dist/esm/installNode/findDistPaths.mjs +18 -0
  67. package/dist/esm/installNode/findDistPaths.mjs.map +1 -0
  68. package/dist/esm/installNode/index.mjs +24 -0
  69. package/dist/esm/installNode/index.mjs.map +1 -0
  70. package/dist/esm/installNode/installCompressed.mjs +34 -0
  71. package/dist/esm/installNode/installCompressed.mjs.map +1 -0
  72. package/dist/esm/installNode/installExe.mjs +16 -0
  73. package/dist/esm/installNode/installExe.mjs.map +1 -0
  74. package/dist/esm/installNode/installSource/buildPosix.mjs +28 -0
  75. package/dist/esm/installNode/installSource/buildPosix.mjs.map +1 -0
  76. package/dist/esm/installNode/installSource/buildWin32.mjs +24 -0
  77. package/dist/esm/installNode/installSource/buildWin32.mjs.map +1 -0
  78. package/dist/esm/installNode/installSource/index.mjs +20 -0
  79. package/dist/esm/installNode/installSource/index.mjs.map +1 -0
  80. package/dist/esm/installNode/prebuilts.mjs +37 -0
  81. package/dist/esm/installNode/prebuilts.mjs.map +1 -0
  82. package/dist/esm/lib/arch.cjs +69 -0
  83. package/dist/esm/lib/arch.cjs.map +1 -0
  84. package/dist/esm/lib/checkMissing.mjs +41 -0
  85. package/dist/esm/lib/checkMissing.mjs.map +1 -0
  86. package/dist/esm/lib/conditionalCache.mjs +27 -0
  87. package/dist/esm/lib/conditionalCache.mjs.map +1 -0
  88. package/dist/esm/lib/conditionalCopy.mjs +20 -0
  89. package/dist/esm/lib/conditionalCopy.mjs.map +1 -0
  90. package/dist/esm/lib/conditionalExtract.mjs +26 -0
  91. package/dist/esm/lib/conditionalExtract.mjs.map +1 -0
  92. package/dist/esm/lib/copyFile.mjs +25 -0
  93. package/dist/esm/lib/copyFile.mjs.map +1 -0
  94. package/dist/esm/lib/endsWithFn.mjs +13 -0
  95. package/dist/esm/lib/endsWithFn.mjs.map +1 -0
  96. package/dist/esm/lib/ensureDestinationParent.mjs +7 -0
  97. package/dist/esm/lib/ensureDestinationParent.mjs.map +1 -0
  98. package/dist/esm/lib/progress.mjs +6 -0
  99. package/dist/esm/lib/progress.mjs.map +1 -0
  100. package/dist/esm/polyfills/execCallback.cjs +4 -0
  101. package/dist/esm/polyfills/execCallback.cjs.map +1 -0
  102. package/dist/esm/polyfills.cjs +12 -0
  103. package/dist/esm/polyfills.cjs.map +1 -0
  104. package/dist/esm/types.mjs +1 -0
  105. package/dist/esm/types.mjs.map +1 -0
  106. package/dist/esm/workers/install.mjs +52 -0
  107. package/dist/esm/workers/install.mjs.map +1 -0
  108. package/dist/types/cli.d.ts +1 -1
  109. package/dist/types/constants.d.ts +2 -0
  110. package/dist/types/index.d.ts +4 -0
  111. package/dist/types/installNPM/index.d.ts +1 -2
  112. package/dist/types/installNPM/installBin.d.ts +1 -2
  113. package/dist/types/installNPM/installLib.d.ts +1 -2
  114. package/dist/types/installNode/findDistPaths.d.ts +1 -2
  115. package/dist/types/installNode/index.d.ts +1 -2
  116. package/dist/types/installNode/installCompressed.d.ts +1 -2
  117. package/dist/types/installNode/installExe.d.ts +1 -2
  118. package/dist/types/installNode/installSource/buildPosix.d.ts +1 -2
  119. package/dist/types/installNode/installSource/buildWin32.d.ts +1 -2
  120. package/dist/types/installNode/installSource/index.d.ts +1 -2
  121. package/dist/types/installNode/prebuilts.d.ts +1 -2
  122. package/dist/types/lib/checkMissing.d.ts +1 -0
  123. package/dist/types/lib/conditionalCache.d.ts +1 -0
  124. package/dist/types/lib/conditionalCopy.d.ts +1 -0
  125. package/dist/types/lib/conditionalExtract.d.ts +1 -0
  126. package/dist/types/lib/copyFile.d.ts +1 -0
  127. package/dist/types/lib/endsWithFn.d.ts +1 -0
  128. package/dist/types/lib/ensureDestinationParent.d.ts +1 -0
  129. package/dist/types/lib/progress.d.ts +1 -0
  130. package/dist/types/types.d.ts +14 -0
  131. package/dist/types/workers/install.d.ts +1 -0
  132. package/package.json +17 -10
  133. package/bin/cli.js +0 -3
  134. package/dist/cjs/arch.js.map +0 -1
  135. package/dist/cjs/checkMissing.js.map +0 -1
  136. package/dist/cjs/cli.js.map +0 -1
  137. package/dist/cjs/conditionalCache.js.map +0 -1
  138. package/dist/cjs/conditionalCopy.js +0 -22
  139. package/dist/cjs/conditionalCopy.js.map +0 -1
  140. package/dist/cjs/conditionalExtract.js.map +0 -1
  141. package/dist/cjs/copyFile.js +0 -27
  142. package/dist/cjs/copyFile.js.map +0 -1
  143. package/dist/cjs/endsWithFn.js +0 -15
  144. package/dist/cjs/endsWithFn.js.map +0 -1
  145. package/dist/cjs/ensureDestinationParent.js +0 -11
  146. package/dist/cjs/ensureDestinationParent.js.map +0 -1
  147. package/dist/cjs/index.js.map +0 -1
  148. package/dist/cjs/install.js +0 -98
  149. package/dist/cjs/install.js.map +0 -1
  150. package/dist/cjs/installNPM/index.js +0 -10
  151. package/dist/cjs/installNPM/index.js.map +0 -1
  152. package/dist/cjs/installNPM/installBin.js.map +0 -1
  153. package/dist/cjs/installNPM/installLib.js +0 -35
  154. package/dist/cjs/installNPM/installLib.js.map +0 -1
  155. package/dist/cjs/installNode/findDistPaths.js.map +0 -1
  156. package/dist/cjs/installNode/index.js +0 -26
  157. package/dist/cjs/installNode/index.js.map +0 -1
  158. package/dist/cjs/installNode/installCompressed.js.map +0 -1
  159. package/dist/cjs/installNode/installExe.js +0 -18
  160. package/dist/cjs/installNode/installExe.js.map +0 -1
  161. package/dist/cjs/installNode/installSource/buildPosix.js +0 -30
  162. package/dist/cjs/installNode/installSource/buildPosix.js.map +0 -1
  163. package/dist/cjs/installNode/installSource/buildWin32.js +0 -26
  164. package/dist/cjs/installNode/installSource/buildWin32.js.map +0 -1
  165. package/dist/cjs/installNode/installSource/index.js +0 -22
  166. package/dist/cjs/installNode/installSource/index.js.map +0 -1
  167. package/dist/cjs/installNode/prebuilts.js.map +0 -1
  168. package/dist/cjs/installVersion.js +0 -22
  169. package/dist/cjs/installVersion.js.map +0 -1
  170. package/dist/cjs/package.json +0 -1
  171. package/dist/cjs/polyfills.js.map +0 -1
  172. package/dist/cjs/progress.js.map +0 -1
  173. package/dist/cjs/workers/execCallback.js.map +0 -1
  174. package/dist/types/checkMissing.d.ts +0 -2
  175. package/dist/types/conditionalCache.d.ts +0 -2
  176. package/dist/types/conditionalCopy.d.ts +0 -2
  177. package/dist/types/conditionalExtract.d.ts +0 -2
  178. package/dist/types/copyFile.d.ts +0 -2
  179. package/dist/types/endsWithFn.d.ts +0 -2
  180. package/dist/types/ensureDestinationParent.d.ts +0 -2
  181. package/dist/types/index.d.mts +0 -1
  182. package/dist/types/install.d.ts +0 -2
  183. package/dist/types/installVersion.d.ts +0 -2
  184. package/dist/types/progress.d.ts +0 -2
  185. /package/dist/cjs/{arch.js → lib/arch.cjs} +0 -0
  186. /package/dist/cjs/{workers/execCallback.js → polyfills/execCallback.cjs} +0 -0
  187. /package/dist/types/{arch.d.ts → lib/arch.d.cts} +0 -0
  188. /package/dist/types/{workers/execCallback.d.ts → polyfills/execCallback.d.cts} +0 -0
package/bin/cli.cjs ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('../dist/cjs/cli.cjs')(process.argv.slice(2));
@@ -10,40 +10,12 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  var _exit = /*#__PURE__*/ _interop_require_default(require("exit"));
12
12
  var _getoptscompat = /*#__PURE__*/ _interop_require_default(require("getopts-compat"));
13
- var _index = /*#__PURE__*/ _interop_require_default(require("./index.js"));
14
- function _define_property(obj, key, value) {
15
- if (key in obj) {
16
- Object.defineProperty(obj, key, {
17
- value: value,
18
- enumerable: true,
19
- configurable: true,
20
- writable: true
21
- });
22
- } else {
23
- obj[key] = value;
24
- }
25
- return obj;
26
- }
13
+ var _index = /*#__PURE__*/ _interop_require_default(require("./index.cjs"));
27
14
  function _interop_require_default(obj) {
28
15
  return obj && obj.__esModule ? obj : {
29
16
  default: obj
30
17
  };
31
18
  }
32
- function _object_spread(target) {
33
- for(var i = 1; i < arguments.length; i++){
34
- var source = arguments[i] != null ? arguments[i] : {};
35
- var ownKeys = Object.keys(source);
36
- if (typeof Object.getOwnPropertySymbols === "function") {
37
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
38
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
39
- }));
40
- }
41
- ownKeys.forEach(function(key) {
42
- _define_property(target, key, source[key]);
43
- });
44
- }
45
- return target;
46
- }
47
19
  var _default = function(argv) {
48
20
  var options = (0, _getoptscompat.default)(argv.slice(1), {
49
21
  alias: {
@@ -66,27 +38,17 @@ var _default = function(argv) {
66
38
  console.log('Missing command. Example usage: nir version [directory]');
67
39
  return (0, _exit.default)(-1);
68
40
  }
69
- var installPath = args.length > 1 ? args[1] : null;
70
- (0, _index.default)(args[0], installPath, _object_spread({
71
- stdio: 'inherit'
72
- }, options), function(err, results) {
73
- if (err) {
74
- console.log(err.message);
75
- return (0, _exit.default)(err.code || -1);
76
- }
77
- var errors = results.filter(function(result) {
78
- return !!result.error;
79
- });
41
+ var installPath = args.length > 1 ? args[1] : process.cwd();
42
+ (0, _index.default)(args[0], installPath, {
43
+ addVersion: true
44
+ }, function(err, result) {
80
45
  if (!options.silent) {
81
46
  console.log('\n======================');
82
- for(var index = 0; index < results.length; index++){
83
- var result = results[index];
84
- if (result.error) console.log("".concat(result.version, " not installed. Error: ").concat(result.error.message));
85
- else console.log("".concat(result.version, " installed in: ").concat(result.fullPath));
86
- }
47
+ if (err) console.log("".concat(args[0], " not installed. Error: ").concat(err.message));
48
+ else console.log("".concat(result.version, " installed in: ").concat(installPath));
87
49
  console.log('======================');
88
50
  }
89
- (0, _exit.default)(errors.length ? -1 : 0);
51
+ (0, _exit.default)(err ? -1 : 0);
90
52
  });
91
53
  };
92
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; }
@@ -0,0 +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 nir from './index';\n\nexport default (argv) => {\n const options = getopts(argv.slice(1), {\n alias: { platform: 'p', arch: 'a', filename: 'f', cachePath: 'c', silent: 's' },\n boolean: ['silent'],\n });\n\n // define.option('-p, --platform [platform]', 'Platform like darwin');\n // define.option('-a, --arch [arch]', 'Architecure x64, x86, arm-pi');\n // define.option('-f, --filename [filename]', 'Distribution filename from https://nodejs.org/dist/index.json');\n // define.option('-c, --cachePath [cachePath]', 'Cache directory');\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\n const installPath = args.length > 1 ? args[1] : process.cwd();\n nir(args[0], installPath, { addVersion: true }, (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: ${installPath}`);\n console.log('======================');\n }\n exit(err ? -1 : 0);\n });\n};\n"],"names":["argv","options","getopts","slice","alias","platform","arch","filename","cachePath","silent","boolean","args","concat","_","length","console","log","exit","installPath","process","cwd","nir","addVersion","err","result","message","version"],"mappings":";;;;+BAIA;;;eAAA;;;2DAJiB;oEACG;4DACJ;;;;;;IAEhB,WAAe,SAACA;IACd,IAAMC,UAAUC,IAAAA,sBAAO,EAACF,KAAKG,KAAK,CAAC,IAAI;QACrCC,OAAO;YAAEC,UAAU;YAAKC,MAAM;YAAKC,UAAU;YAAKC,WAAW;YAAKC,QAAQ;QAAI;QAC9EC,SAAS;YAAC;SAAS;IACrB;IAEA,sEAAsE;IACtE,sEAAsE;IACtE,+GAA+G;IAC/G,mEAAmE;IAEnE,IAAMC,OAAOX,KAAKG,KAAK,CAAC,GAAG,GAAGS,MAAM,CAACX,QAAQY,CAAC;IAC9C,IAAIF,KAAKG,MAAM,GAAG,GAAG;QACnBC,QAAQC,GAAG,CAAC;QACZ,OAAOC,IAAAA,aAAI,EAAC,CAAC;IACf;IAEA,IAAMC,cAAcP,KAAKG,MAAM,GAAG,IAAIH,IAAI,CAAC,EAAE,GAAGQ,QAAQC,GAAG;IAC3DC,IAAAA,cAAG,EAACV,IAAI,CAAC,EAAE,EAAEO,aAAa;QAAEI,YAAY;IAAK,GAAG,SAACC,KAAKC;QACpD,IAAI,CAACvB,QAAQQ,MAAM,EAAE;YACnBM,QAAQC,GAAG,CAAC;YACZ,IAAIO,KAAKR,QAAQC,GAAG,CAAC,AAAC,GAAmCO,OAAjCZ,IAAI,CAAC,EAAE,EAAC,2BAAqC,OAAZY,IAAIE,OAAO;iBAC/DV,QAAQC,GAAG,CAAC,AAAC,GAAkCE,OAAhCM,OAAOE,OAAO,EAAC,mBAA6B,OAAZR;YACpDH,QAAQC,GAAG,CAAC;QACd;QACAC,IAAAA,aAAI,EAACM,MAAM,CAAC,IAAI;IAClB;AACF"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ NODE: function() {
13
+ return NODE;
14
+ },
15
+ isWindows: function() {
16
+ return isWindows;
17
+ }
18
+ });
19
+ var isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);
20
+ var NODE = isWindows ? 'node.exe' : 'node';
21
+ /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/constants.ts"],"sourcesContent":["export const isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nexport const NODE = isWindows ? 'node.exe' : 'node';\n"],"names":["NODE","isWindows","process","platform","test","env","OSTYPE"],"mappings":";;;;;;;;;;;IACaA,IAAI;eAAJA;;IADAC,SAAS;eAATA;;;AAAN,IAAMA,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAC3F,IAAMN,OAAOC,YAAY,aAAa"}
@@ -5,26 +5,26 @@ Object.defineProperty(exports, "__esModule", {
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
7
  get: function() {
8
- return installRelease;
8
+ return install;
9
9
  }
10
10
  });
11
- require("./polyfills.js");
12
- var _install = /*#__PURE__*/ _interop_require_default(require("./install"));
11
+ require("./polyfills.cjs");
12
+ var _install = /*#__PURE__*/ _interop_require_default(require("./workers/install.cjs"));
13
13
  function _interop_require_default(obj) {
14
14
  return obj && obj.__esModule ? obj : {
15
15
  default: obj
16
16
  };
17
17
  }
18
- function installRelease(versionDetails, dest, options, callback) {
18
+ function install(versionExpression, dest, options, callback) {
19
19
  if (typeof options === 'function') {
20
20
  callback = options;
21
- options = null;
21
+ options = {};
22
22
  }
23
23
  options = options || {};
24
- if (typeof callback === 'function') return (0, _install.default)(versionDetails, dest, options, callback);
24
+ if (typeof callback === 'function') return (0, _install.default)(versionExpression, dest, options, callback);
25
25
  return new Promise(function(resolve, reject) {
26
- installRelease(versionDetails, dest, options, function installCallback(err, result) {
27
- err ? reject(err) : resolve(result);
26
+ return (0, _install.default)(versionExpression, dest, options, function(err, result) {
27
+ return err ? reject(err) : resolve(result);
28
28
  });
29
29
  });
30
30
  }
@@ -0,0 +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, dest: 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, dest, options, callback) as undefined;\n return new Promise((resolve, reject) => worker(versionExpression, dest, options, (err, result) => (err ? reject(err) : resolve(result))));\n}\n"],"names":["install","versionExpression","dest","options","callback","worker","Promise","resolve","reject","err","result"],"mappings":";;;;+BAMA;;;eAAwBA;;;QANjB;8DACY;;;;;;AAKJ,SAASA,QAAQC,iBAAyB,EAAEC,IAAY,EAAEC,OAA0C,EAAEC,QAA0B;IAC7I,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IAEtB,IAAI,OAAOC,aAAa,YAAY,OAAOC,IAAAA,gBAAM,EAACJ,mBAAmBC,MAAMC,SAASC;IACpF,OAAO,IAAIE,QAAQ,SAACC,SAASC;eAAWH,IAAAA,gBAAM,EAACJ,mBAAmBC,MAAMC,SAAS,SAACM,KAAKC;mBAAYD,MAAMD,OAAOC,OAAOF,QAAQG;;;AACjI"}
@@ -0,0 +1,24 @@
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 install;
9
+ }
10
+ });
11
+ var _installBin = /*#__PURE__*/ _interop_require_default(require("./installBin.cjs"));
12
+ var _installLib = /*#__PURE__*/ _interop_require_default(require("./installLib.cjs"));
13
+ function _interop_require_default(obj) {
14
+ return obj && obj.__esModule ? obj : {
15
+ default: obj
16
+ };
17
+ }
18
+ function install(version, dest, options, callback) {
19
+ (0, _installLib.default)(version, dest, options, function(err) {
20
+ if (err) return callback(err);
21
+ (0, _installBin.default)(version, dest, options, callback);
22
+ });
23
+ }
24
+ /* 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/installNPM/index.ts"],"sourcesContent":["import installBin from './installBin';\nimport installLib from './installLib';\n\nexport default function install(version, dest, options, callback) {\n installLib(version, dest, options, (err) => {\n if (err) return callback(err);\n installBin(version, dest, options, callback);\n });\n}\n"],"names":["install","version","dest","options","callback","installLib","err","installBin"],"mappings":";;;;+BAGA;;;eAAwBA;;;iEAHD;iEACA;;;;;;AAER,SAASA,QAAQC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC9DC,IAAAA,mBAAU,EAACJ,SAASC,MAAMC,SAAS,SAACG;QAClC,IAAIA,KAAK,OAAOF,SAASE;QACzBC,IAAAA,mBAAU,EAACN,SAASC,MAAMC,SAASC;IACrC;AACF"}
@@ -0,0 +1,64 @@
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 installBin;
9
+ }
10
+ });
11
+ var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
+ var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
13
+ var _conditionalCopy = /*#__PURE__*/ _interop_require_default(require("../lib/conditionalCopy.cjs"));
14
+ function _interop_require_default(obj) {
15
+ return obj && obj.__esModule ? obj : {
16
+ default: obj
17
+ };
18
+ }
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
+ function installBin(_version, dest, options, callback) {
53
+ var platform = options.platform || process.platform;
54
+ var libPath = platform === 'win32' ? dest : _path.default.join(dest, 'lib');
55
+ var binPath = platform === 'win32' ? dest : _path.default.join(dest, 'bin');
56
+ var queue = new _queuecb.default();
57
+ var files = PLATFORM_FILES[platform] || PLATFORM_FILES.posix;
58
+ for(var index = 0; index < files.length; index++){
59
+ var file = files[index];
60
+ queue.defer(_conditionalCopy.default.bind(null, _path.default.join(libPath, file.src), _path.default.join(binPath, file.dest), file.optional));
61
+ }
62
+ queue.await(callback);
63
+ }
64
+ /* 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/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"}
@@ -0,0 +1,49 @@
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 installLib;
9
+ }
10
+ });
11
+ var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
+ var _getremote = /*#__PURE__*/ _interop_require_default(require("get-remote"));
13
+ var _conditionalCache = /*#__PURE__*/ _interop_require_default(require("../lib/conditionalCache.cjs"));
14
+ var _conditionalExtract = /*#__PURE__*/ _interop_require_default(require("../lib/conditionalExtract.cjs"));
15
+ function _interop_require_default(obj) {
16
+ return obj && obj.__esModule ? obj : {
17
+ default: obj
18
+ };
19
+ }
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
+ function installLib(version, dest, options, callback) {
25
+ var platform = options.platform || process.platform;
26
+ var libPath = platform === 'win32' ? dest : _path.default.join(dest, 'lib');
27
+ var installPath = _path.default.join(libPath, 'node_modules', 'npm');
28
+ (0, _getremote.default)(NODE_DIST_URL).json(function(err, res1) {
29
+ 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) {
37
+ 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
+ });
46
+ });
47
+ });
48
+ }
49
+ /* 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/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,14 +1,28 @@
1
1
  "use strict";
2
- var distPaths = require('node-filename-to-dist-paths');
3
- var prebuilts = require('./prebuilts');
4
- module.exports = function findDistPaths(version, options) {
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return findDistPaths;
9
+ }
10
+ });
11
+ var _nodefilenametodistpaths = /*#__PURE__*/ _interop_require_default(require("node-filename-to-dist-paths"));
12
+ var _prebuilts = /*#__PURE__*/ _interop_require_default(require("./prebuilts.cjs"));
13
+ function _interop_require_default(obj) {
14
+ return obj && obj.__esModule ? obj : {
15
+ default: obj
16
+ };
17
+ }
18
+ function findDistPaths(version, options) {
5
19
  var filenames = options.filename ? [
6
20
  options.filename
7
- ] : prebuilts(options);
21
+ ] : (0, _prebuilts.default)(options);
8
22
  for(var index = 0; index < filenames.length; index++){
9
23
  var filename = filenames[index];
10
24
  if (!~version.files.indexOf(filename)) continue;
11
- var relativePaths = distPaths(filename, version.version);
25
+ var relativePaths = (0, _nodefilenametodistpaths.default)(filename, version.version);
12
26
  if (relativePaths && relativePaths.length) return {
13
27
  version: version.version,
14
28
  filename: filename,
@@ -16,5 +30,5 @@ module.exports = function findDistPaths(version, options) {
16
30
  };
17
31
  }
18
32
  return null;
19
- };
33
+ }
20
34
  /* 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/findDistPaths.ts"],"sourcesContent":["import distPaths from 'node-filename-to-dist-paths';\nimport prebuilts from './prebuilts';\n\nexport default function findDistPaths(version, options) {\n const filenames = options.filename ? [options.filename] : prebuilts(options);\n for (let index = 0; index < filenames.length; index++) {\n const filename = filenames[index];\n if (!~version.files.indexOf(filename)) continue;\n const relativePaths = distPaths(filename, version.version);\n if (relativePaths && relativePaths.length) return { version: version.version, filename: filename, relativePaths: relativePaths };\n }\n return null;\n}\n"],"names":["findDistPaths","version","options","filenames","filename","prebuilts","index","length","files","indexOf","relativePaths","distPaths"],"mappings":";;;;+BAGA;;;eAAwBA;;;8EAHF;gEACA;;;;;;AAEP,SAASA,cAAcC,OAAO,EAAEC,OAAO;IACpD,IAAMC,YAAYD,QAAQE,QAAQ,GAAG;QAACF,QAAQE,QAAQ;KAAC,GAAGC,IAAAA,kBAAS,EAACH;IACpE,IAAK,IAAII,QAAQ,GAAGA,QAAQH,UAAUI,MAAM,EAAED,QAAS;QACrD,IAAMF,WAAWD,SAAS,CAACG,MAAM;QACjC,IAAI,CAAC,CAACL,QAAQO,KAAK,CAACC,OAAO,CAACL,WAAW;QACvC,IAAMM,gBAAgBC,IAAAA,gCAAS,EAACP,UAAUH,QAAQA,OAAO;QACzD,IAAIS,iBAAiBA,cAAcH,MAAM,EAAE,OAAO;YAAEN,SAASA,QAAQA,OAAO;YAAEG,UAAUA;YAAUM,eAAeA;QAAc;IACjI;IACA,OAAO;AACT"}
@@ -0,0 +1,40 @@
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 install;
9
+ }
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"));
17
+ function _interop_require_default(obj) {
18
+ return obj && obj.__esModule ? obj : {
19
+ default: obj
20
+ };
21
+ }
22
+ 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'
36
+ });
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)));
39
+ }
40
+ /* 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/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,4 +1,19 @@
1
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 installCompressed;
9
+ }
10
+ });
11
+ var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
+ var _fsaccesscompat = /*#__PURE__*/ _interop_require_default(require("fs-access-compat"));
13
+ var _rimraf2 = /*#__PURE__*/ _interop_require_default(require("rimraf2"));
14
+ var _conditionalCache = /*#__PURE__*/ _interop_require_default(require("../lib/conditionalCache.cjs"));
15
+ var _conditionalExtract = /*#__PURE__*/ _interop_require_default(require("../lib/conditionalExtract.cjs"));
16
+ var _progress = /*#__PURE__*/ _interop_require_default(require("../lib/progress.cjs"));
2
17
  function _define_property(obj, key, value) {
3
18
  if (key in obj) {
4
19
  Object.defineProperty(obj, key, {
@@ -12,6 +27,11 @@ function _define_property(obj, key, value) {
12
27
  }
13
28
  return obj;
14
29
  }
30
+ function _interop_require_default(obj) {
31
+ return obj && obj.__esModule ? obj : {
32
+ default: obj
33
+ };
34
+ }
15
35
  function _object_spread(target) {
16
36
  for(var i = 1; i < arguments.length; i++){
17
37
  var source = arguments[i] != null ? arguments[i] : {};
@@ -27,31 +47,25 @@ function _object_spread(target) {
27
47
  }
28
48
  return target;
29
49
  }
30
- var path = require('path');
31
- var access = require('fs-access-compat');
32
- var rimraf2 = require('rimraf2');
33
- var conditionalCache = require('../conditionalCache');
34
- var conditionalExtract = require('../conditionalExtract');
35
- var progress = require('../progress');
36
- module.exports = function installCompressed(relativePath, dest, _record, options, callback) {
50
+ function installCompressed(relativePath, dest, _record, options, callback) {
37
51
  var downloadPath = options.downloadURL(relativePath);
38
- var cachePath = path.join(options.cachePath, path.basename(downloadPath));
39
- conditionalCache(downloadPath, cachePath, function(err) {
52
+ var cachePath = _path.default.join(options.cachePath, _path.default.basename(downloadPath));
53
+ (0, _conditionalCache.default)(downloadPath, cachePath, function(err) {
40
54
  if (err) return callback(err);
41
- access(dest, function(err) {
55
+ (0, _fsaccesscompat.default)(dest, function(err) {
42
56
  if (!err) return callback(); // already exists
43
- conditionalExtract(cachePath, dest, _object_spread({
57
+ (0, _conditionalExtract.default)(cachePath, dest, _object_spread({
44
58
  strip: 1,
45
- progress: progress,
59
+ progress: _progress.default,
46
60
  time: 1000
47
61
  }, options), function(err) {
48
62
  console.log('');
49
63
  if (err) return callback(err);
50
64
  // some compressed versions of node come with npm pre-installed, but we want to override with a specific version
51
65
  var platform = options.platform || process.platform;
52
- var libPath = platform === 'win32' ? dest : path.join(dest, 'lib');
53
- var installPath = path.join(libPath, 'node_modules', 'npm');
54
- rimraf2(installPath, {
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, {
55
69
  disableGlob: true
56
70
  }, function() {
57
71
  callback(err);
@@ -59,5 +73,5 @@ module.exports = function installCompressed(relativePath, dest, _record, options
59
73
  });
60
74
  });
61
75
  });
62
- };
76
+ }
63
77
  /* 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/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"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return installExe;
9
+ }
10
+ });
11
+ var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
+ var _fsaccesscompat = /*#__PURE__*/ _interop_require_default(require("fs-access-compat"));
13
+ var _conditionalCache = /*#__PURE__*/ _interop_require_default(require("../lib/conditionalCache.cjs"));
14
+ var _copyFile = /*#__PURE__*/ _interop_require_default(require("../lib/copyFile.cjs"));
15
+ function _interop_require_default(obj) {
16
+ return obj && obj.__esModule ? obj : {
17
+ default: obj
18
+ };
19
+ }
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));
24
+ (0, _fsaccesscompat.default)(destPath, function(err) {
25
+ 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
+ });
30
+ });
31
+ }
32
+ /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/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"}
@@ -0,0 +1,44 @@
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 installDefault;
9
+ }
10
+ });
11
+ var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
+ var _crossspawncb = /*#__PURE__*/ _interop_require_default(require("cross-spawn-cb"));
13
+ var _fsaccesscompat = /*#__PURE__*/ _interop_require_default(require("fs-access-compat"));
14
+ var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
15
+ function _interop_require_default(obj) {
16
+ return obj && obj.__esModule ? obj : {
17
+ default: obj
18
+ };
19
+ }
20
+ function installDefault(buildPath, dest, _options, callback) {
21
+ var buildTarget = _path.default.join(dest, 'node');
22
+ (0, _fsaccesscompat.default)(buildTarget, function(err) {
23
+ if (!err) return callback(); // already exists
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
+ });
41
+ queue.await(callback);
42
+ });
43
+ }
44
+ /* 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/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"}