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
@@ -0,0 +1,120 @@
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 _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
+ var _homedirpolyfill = /*#__PURE__*/ _interop_require_default(require("homedir-polyfill"));
13
+ var _mkdirpclassic = /*#__PURE__*/ _interop_require_default(require("mkdirp-classic"));
14
+ var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
15
+ var _constants = require("../constants.cjs");
16
+ var _noderesolveversions = /*#__PURE__*/ _interop_require_default(require("node-resolve-versions"));
17
+ var _index = /*#__PURE__*/ _interop_require_default(require("../installNPM/index.cjs"));
18
+ var _index1 = /*#__PURE__*/ _interop_require_default(require("../installNode/index.cjs"));
19
+ var _checkMissing = /*#__PURE__*/ _interop_require_default(require("../lib/checkMissing.cjs"));
20
+ var _ensureDestinationParent = /*#__PURE__*/ _interop_require_default(require("../lib/ensureDestinationParent.cjs"));
21
+ function _define_property(obj, key, value) {
22
+ if (key in obj) {
23
+ Object.defineProperty(obj, key, {
24
+ value: value,
25
+ enumerable: true,
26
+ configurable: true,
27
+ writable: true
28
+ });
29
+ } else {
30
+ obj[key] = value;
31
+ }
32
+ return obj;
33
+ }
34
+ function _interop_require_default(obj) {
35
+ return obj && obj.__esModule ? obj : {
36
+ default: obj
37
+ };
38
+ }
39
+ function _object_spread(target) {
40
+ for(var i = 1; i < arguments.length; i++){
41
+ var source = arguments[i] != null ? arguments[i] : {};
42
+ var ownKeys = Object.keys(source);
43
+ if (typeof Object.getOwnPropertySymbols === "function") {
44
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
45
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
46
+ }));
47
+ }
48
+ ownKeys.forEach(function(key) {
49
+ _define_property(target, key, source[key]);
50
+ });
51
+ }
52
+ return target;
53
+ }
54
+ function ownKeys(object, enumerableOnly) {
55
+ var keys = Object.keys(object);
56
+ if (Object.getOwnPropertySymbols) {
57
+ var symbols = Object.getOwnPropertySymbols(object);
58
+ if (enumerableOnly) {
59
+ symbols = symbols.filter(function(sym) {
60
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
61
+ });
62
+ }
63
+ keys.push.apply(keys, symbols);
64
+ }
65
+ return keys;
66
+ }
67
+ function _object_spread_props(target, source) {
68
+ source = source != null ? source : {};
69
+ if (Object.getOwnPropertyDescriptors) {
70
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
71
+ } else {
72
+ ownKeys(Object(source)).forEach(function(key) {
73
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
74
+ });
75
+ }
76
+ return target;
77
+ }
78
+ var DEFAULT_INSTALL_PATH = _path.default.join((0, _homedirpolyfill.default)(), '.nir');
79
+ var DEFAULT_OPTIONS = {
80
+ cachePath: _path.default.join(DEFAULT_INSTALL_PATH, 'cache'),
81
+ buildPath: _path.default.join(DEFAULT_INSTALL_PATH, 'build'),
82
+ downloadURL: function downloadURL(relativePath) {
83
+ return "https://nodejs.org/dist/".concat(relativePath);
84
+ }
85
+ };
86
+ function install(versionExpression, dest, options, callback) {
87
+ options = _object_spread_props(_object_spread({}, DEFAULT_OPTIONS, options), {
88
+ path: 'raw'
89
+ });
90
+ (0, _noderesolveversions.default)(versionExpression, options, function(err, versions) {
91
+ if (err) return callback(err);
92
+ if (!versions.length) return callback(new Error("Could not resolve versions for: ".concat(versionExpression)));
93
+ if (versions.length !== 1) return callback(new Error("Version ".concat(versionExpression, " resolved to multiple versions: ").concat(versions.map(function(x) {
94
+ return x.version;
95
+ }), ". Expecting one.")));
96
+ (0, _mkdirpclassic.default)(options.cachePath, function(err) {
97
+ if (err) return callback(err);
98
+ var version = versions[0];
99
+ var installPath = dest && versions.length > 1 ? _path.default.join(dest, version.version) : dest;
100
+ var binRoot = _constants.isWindows ? installPath : _path.default.join(installPath, 'bin');
101
+ var execPath = _path.default.join(binRoot, _constants.NODE);
102
+ if (options.addVersion) dest = _path.default.join(dest, version.version);
103
+ (0, _checkMissing.default)(dest, options, function(err, missing) {
104
+ if (err || !missing.length) return callback(err, dest);
105
+ var queue = new _queuecb.default(1);
106
+ queue.defer(_ensureDestinationParent.default.bind(null, dest));
107
+ !~missing.indexOf('node') || queue.defer(_index1.default.bind(null, version, dest, options));
108
+ !~missing.indexOf('npm') || queue.defer(_index.default.bind(null, version, dest, options));
109
+ queue.await(function(err) {
110
+ err ? callback(err) : callback(null, {
111
+ version: version.version,
112
+ installPath: installPath,
113
+ execPath: execPath
114
+ });
115
+ });
116
+ });
117
+ });
118
+ });
119
+ }
120
+ /* 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/workers/install.ts"],"sourcesContent":["import path from 'path';\nimport homedir from 'homedir-polyfill';\nimport mkdirp from 'mkdirp-classic';\nimport Queue from 'queue-cb';\nimport { NODE, isWindows } from '../constants';\n\nimport resolveVersions from 'node-resolve-versions';\n\nimport installNPM from '../installNPM/index';\nimport installNode from '../installNode/index';\nimport checkMissing from '../lib/checkMissing';\nimport ensureDestinationParent from '../lib/ensureDestinationParent';\n\nconst DEFAULT_INSTALL_PATH = path.join(homedir(), '.nir');\nconst DEFAULT_OPTIONS = {\n cachePath: path.join(DEFAULT_INSTALL_PATH, 'cache'),\n buildPath: path.join(DEFAULT_INSTALL_PATH, 'build'),\n downloadURL: function downloadURL(relativePath) {\n return `https://nodejs.org/dist/${relativePath}`;\n },\n};\n\nexport default function install(versionExpression, dest, options, callback) {\n options = { ...DEFAULT_OPTIONS, ...options, path: 'raw' };\n resolveVersions(versionExpression, options, (err, versions) => {\n if (err) return callback(err);\n if (!versions.length) return callback(new Error(`Could not resolve versions for: ${versionExpression}`));\n if (versions.length !== 1) return callback(new Error(`Version ${versionExpression} resolved to multiple versions: ${versions.map((x) => x.version)}. Expecting one.`));\n\n mkdirp(options.cachePath, (err) => {\n if (err) return callback(err);\n const version = versions[0];\n\n const installPath = dest && versions.length > 1 ? path.join(dest, version.version) : dest;\n const binRoot = isWindows ? installPath : path.join(installPath, 'bin');\n const execPath = path.join(binRoot, NODE);\n\n if (options.addVersion) dest = path.join(dest, version.version);\n\n checkMissing(dest, options, (err, missing) => {\n if (err || !missing.length) return callback(err, dest);\n\n const queue = new Queue(1);\n queue.defer(ensureDestinationParent.bind(null, dest));\n !~missing.indexOf('node') || queue.defer(installNode.bind(null, version, dest, options));\n !~missing.indexOf('npm') || queue.defer(installNPM.bind(null, version, dest, options));\n queue.await((err) => {\n err ? callback(err) : callback(null, { version: version.version, installPath, execPath });\n });\n });\n });\n });\n}\n"],"names":["install","DEFAULT_INSTALL_PATH","path","join","homedir","DEFAULT_OPTIONS","cachePath","buildPath","downloadURL","relativePath","versionExpression","dest","options","callback","resolveVersions","err","versions","length","Error","map","x","version","mkdirp","installPath","binRoot","isWindows","execPath","NODE","addVersion","checkMissing","missing","queue","Queue","defer","ensureDestinationParent","bind","indexOf","installNode","installNPM","await"],"mappings":";;;;+BAsBA;;;eAAwBA;;;2DAtBP;sEACG;oEACD;8DACD;yBACc;0EAEJ;4DAEL;6DACC;mEACC;8EACW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEpC,IAAMC,uBAAuBC,aAAI,CAACC,IAAI,CAACC,IAAAA,wBAAO,KAAI;AAClD,IAAMC,kBAAkB;IACtBC,WAAWJ,aAAI,CAACC,IAAI,CAACF,sBAAsB;IAC3CM,WAAWL,aAAI,CAACC,IAAI,CAACF,sBAAsB;IAC3CO,aAAa,SAASA,YAAYC,YAAY;QAC5C,OAAO,AAAC,2BAAuC,OAAbA;IACpC;AACF;AAEe,SAAST,QAAQU,iBAAiB,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACxED,UAAU,wCAAKP,iBAAoBO;QAASV,MAAM;;IAClDY,IAAAA,4BAAe,EAACJ,mBAAmBE,SAAS,SAACG,KAAKC;QAChD,IAAID,KAAK,OAAOF,SAASE;QACzB,IAAI,CAACC,SAASC,MAAM,EAAE,OAAOJ,SAAS,IAAIK,MAAM,AAAC,mCAAoD,OAAlBR;QACnF,IAAIM,SAASC,MAAM,KAAK,GAAG,OAAOJ,SAAS,IAAIK,MAAM,AAAC,WAA8DF,OAApDN,mBAAkB,oCAAiE,OAA/BM,SAASG,GAAG,CAAC,SAACC;mBAAMA,EAAEC,OAAO;YAAE;QAEnJC,IAAAA,sBAAM,EAACV,QAAQN,SAAS,EAAE,SAACS;YACzB,IAAIA,KAAK,OAAOF,SAASE;YACzB,IAAMM,UAAUL,QAAQ,CAAC,EAAE;YAE3B,IAAMO,cAAcZ,QAAQK,SAASC,MAAM,GAAG,IAAIf,aAAI,CAACC,IAAI,CAACQ,MAAMU,QAAQA,OAAO,IAAIV;YACrF,IAAMa,UAAUC,oBAAS,GAAGF,cAAcrB,aAAI,CAACC,IAAI,CAACoB,aAAa;YACjE,IAAMG,WAAWxB,aAAI,CAACC,IAAI,CAACqB,SAASG,eAAI;YAExC,IAAIf,QAAQgB,UAAU,EAAEjB,OAAOT,aAAI,CAACC,IAAI,CAACQ,MAAMU,QAAQA,OAAO;YAE9DQ,IAAAA,qBAAY,EAAClB,MAAMC,SAAS,SAACG,KAAKe;gBAChC,IAAIf,OAAO,CAACe,QAAQb,MAAM,EAAE,OAAOJ,SAASE,KAAKJ;gBAEjD,IAAMoB,QAAQ,IAAIC,gBAAK,CAAC;gBACxBD,MAAME,KAAK,CAACC,gCAAuB,CAACC,IAAI,CAAC,MAAMxB;gBAC/C,CAAC,CAACmB,QAAQM,OAAO,CAAC,WAAWL,MAAME,KAAK,CAACI,eAAW,CAACF,IAAI,CAAC,MAAMd,SAASV,MAAMC;gBAC/E,CAAC,CAACkB,QAAQM,OAAO,CAAC,UAAUL,MAAME,KAAK,CAACK,cAAU,CAACH,IAAI,CAAC,MAAMd,SAASV,MAAMC;gBAC7EmB,MAAMQ,KAAK,CAAC,SAACxB;oBACXA,MAAMF,SAASE,OAAOF,SAAS,MAAM;wBAAEQ,SAASA,QAAQA,OAAO;wBAAEE,aAAAA;wBAAaG,UAAAA;oBAAS;gBACzF;YACF;QACF;IACF;AACF"}
@@ -0,0 +1,38 @@
1
+ import exit from 'exit';
2
+ import getopts from 'getopts-compat';
3
+ import nir from './index.mjs';
4
+ export default ((argv)=>{
5
+ const options = getopts(argv.slice(1), {
6
+ alias: {
7
+ platform: 'p',
8
+ arch: 'a',
9
+ filename: 'f',
10
+ cachePath: 'c',
11
+ silent: 's'
12
+ },
13
+ boolean: [
14
+ 'silent'
15
+ ]
16
+ });
17
+ // define.option('-p, --platform [platform]', 'Platform like darwin');
18
+ // define.option('-a, --arch [arch]', 'Architecure x64, x86, arm-pi');
19
+ // define.option('-f, --filename [filename]', 'Distribution filename from https://nodejs.org/dist/index.json');
20
+ // define.option('-c, --cachePath [cachePath]', 'Cache directory');
21
+ const args = argv.slice(0, 1).concat(options._);
22
+ if (args.length < 1) {
23
+ console.log('Missing command. Example usage: nir version [directory]');
24
+ return exit(-1);
25
+ }
26
+ const installPath = args.length > 1 ? args[1] : process.cwd();
27
+ nir(args[0], installPath, {
28
+ addVersion: true
29
+ }, (err, result)=>{
30
+ if (!options.silent) {
31
+ console.log('\n======================');
32
+ if (err) console.log(`${args[0]} not installed. Error: ${err.message}`);
33
+ else console.log(`${result.version} installed in: ${installPath}`);
34
+ console.log('======================');
35
+ }
36
+ exit(err ? -1 : 0);
37
+ });
38
+ });
@@ -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":["exit","getopts","nir","argv","options","slice","alias","platform","arch","filename","cachePath","silent","boolean","args","concat","_","length","console","log","installPath","process","cwd","addVersion","err","result","message","version"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,aAAa,iBAAiB;AACrC,OAAOC,SAAS,UAAU;AAE1B,eAAe,CAAA,CAACC;IACd,MAAMC,UAAUH,QAAQE,KAAKE,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,MAAMC,OAAOV,KAAKE,KAAK,CAAC,GAAG,GAAGS,MAAM,CAACV,QAAQW,CAAC;IAC9C,IAAIF,KAAKG,MAAM,GAAG,GAAG;QACnBC,QAAQC,GAAG,CAAC;QACZ,OAAOlB,KAAK,CAAC;IACf;IAEA,MAAMmB,cAAcN,KAAKG,MAAM,GAAG,IAAIH,IAAI,CAAC,EAAE,GAAGO,QAAQC,GAAG;IAC3DnB,IAAIW,IAAI,CAAC,EAAE,EAAEM,aAAa;QAAEG,YAAY;IAAK,GAAG,CAACC,KAAKC;QACpD,IAAI,CAACpB,QAAQO,MAAM,EAAE;YACnBM,QAAQC,GAAG,CAAC;YACZ,IAAIK,KAAKN,QAAQC,GAAG,CAAC,GAAGL,IAAI,CAAC,EAAE,CAAC,uBAAuB,EAAEU,IAAIE,OAAO,EAAE;iBACjER,QAAQC,GAAG,CAAC,GAAGM,OAAOE,OAAO,CAAC,eAAe,EAAEP,aAAa;YACjEF,QAAQC,GAAG,CAAC;QACd;QACAlB,KAAKuB,MAAM,CAAC,IAAI;IAClB;AACF,CAAA,EAAE"}
@@ -0,0 +1,2 @@
1
+ export const isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);
2
+ export const NODE = isWindows ? 'node.exe' : 'node';
@@ -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":["isWindows","process","platform","test","env","OSTYPE","NODE"],"mappings":"AAAA,OAAO,MAAMA,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM,EAAE;AACpG,OAAO,MAAMC,OAAON,YAAY,aAAa,OAAO"}
@@ -0,0 +1,11 @@
1
+ import './polyfills.cjs';
2
+ import worker from './workers/install.mjs';
3
+ export default function install(versionExpression, dest, options, callback) {
4
+ if (typeof options === 'function') {
5
+ callback = options;
6
+ options = {};
7
+ }
8
+ options = options || {};
9
+ if (typeof callback === 'function') return worker(versionExpression, dest, options, callback);
10
+ return new Promise((resolve, reject)=>worker(versionExpression, dest, options, (err, result)=>err ? reject(err) : resolve(result)));
11
+ }
@@ -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":["worker","install","versionExpression","dest","options","callback","Promise","resolve","reject","err","result"],"mappings":"AAAA,OAAO,kBAAkB;AACzB,OAAOA,YAAY,oBAAoB;AAKvC,eAAe,SAASC,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,OAAOL,OAAOE,mBAAmBC,MAAMC,SAASC;IACpF,OAAO,IAAIC,QAAQ,CAACC,SAASC,SAAWR,OAAOE,mBAAmBC,MAAMC,SAAS,CAACK,KAAKC,SAAYD,MAAMD,OAAOC,OAAOF,QAAQG;AACjI"}
@@ -0,0 +1,8 @@
1
+ import installBin from './installBin.mjs';
2
+ import installLib from './installLib.mjs';
3
+ export default function install(version, dest, options, callback) {
4
+ installLib(version, dest, options, (err)=>{
5
+ if (err) return callback(err);
6
+ installBin(version, dest, options, callback);
7
+ });
8
+ }
@@ -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":["installBin","installLib","install","version","dest","options","callback","err"],"mappings":"AAAA,OAAOA,gBAAgB,eAAe;AACtC,OAAOC,gBAAgB,eAAe;AAEtC,eAAe,SAASC,QAAQC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC9DL,WAAWE,SAASC,MAAMC,SAAS,CAACE;QAClC,IAAIA,KAAK,OAAOD,SAASC;QACzBP,WAAWG,SAASC,MAAMC,SAASC;IACrC;AACF"}
@@ -1,8 +1,7 @@
1
- "use strict";
2
- var path = require('path');
3
- var Queue = require('queue-cb');
4
- var conditionalCopy = require('../conditionalCopy');
5
- var PLATFORM_FILES = {
1
+ import path from 'path';
2
+ import Queue from 'queue-cb';
3
+ import conditionalCopy from '../lib/conditionalCopy.mjs';
4
+ const PLATFORM_FILES = {
6
5
  win32: [
7
6
  {
8
7
  src: path.join('node_modules', 'npm', 'bin', 'npm'),
@@ -35,16 +34,15 @@ var PLATFORM_FILES = {
35
34
  }
36
35
  ]
37
36
  };
38
- module.exports = function installBin(_version, dest, options, callback) {
39
- var platform = options.platform || process.platform;
40
- var libPath = platform === 'win32' ? dest : path.join(dest, 'lib');
41
- var binPath = platform === 'win32' ? dest : path.join(dest, 'bin');
42
- var queue = new Queue();
43
- var files = PLATFORM_FILES[platform] || PLATFORM_FILES.posix;
44
- for(var index = 0; index < files.length; index++){
45
- var file = files[index];
37
+ export default function installBin(_version, dest, options, callback) {
38
+ const platform = options.platform || process.platform;
39
+ const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');
40
+ const binPath = platform === 'win32' ? dest : path.join(dest, 'bin');
41
+ const queue = new Queue();
42
+ const files = PLATFORM_FILES[platform] || PLATFORM_FILES.posix;
43
+ for(let index = 0; index < files.length; index++){
44
+ const file = files[index];
46
45
  queue.defer(conditionalCopy.bind(null, path.join(libPath, file.src), path.join(binPath, file.dest), file.optional));
47
46
  }
48
47
  queue.await(callback);
49
- };
50
- /* 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; }
48
+ }
@@ -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":["path","Queue","conditionalCopy","PLATFORM_FILES","win32","src","join","dest","optional","posix","installBin","_version","options","callback","platform","process","libPath","binPath","queue","files","index","length","file","defer","bind","await"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAC7B,OAAOC,qBAAqB,yBAAyB;AAErD,MAAMC,iBAAiB;IACrBC,OAAO;QACL;YAAEC,KAAKL,KAAKM,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAQC,MAAM;QAAM;QACnE;YAAEF,KAAKL,KAAKM,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAYC,MAAM;QAAU;QAC3E;YAAEF,KAAKL,KAAKM,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAQC,MAAM;YAAOC,UAAU;QAAK;QACnF;YAAEH,KAAKL,KAAKM,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAYC,MAAM;YAAWC,UAAU;QAAK;KAC5F;IACDC,OAAO;QACL;YAAEJ,KAAKL,KAAKM,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAeC,MAAM;QAAM;QAC1E;YAAEF,KAAKL,KAAKM,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAeC,MAAM;YAAOC,UAAU;QAAK;KAC3F;AACH;AAEA,eAAe,SAASE,WAAWC,QAAQ,EAAEJ,IAAI,EAAEK,OAAO,EAAEC,QAAQ;IAClE,MAAMC,WAAWF,QAAQE,QAAQ,IAAIC,QAAQD,QAAQ;IACrD,MAAME,UAAUF,aAAa,UAAUP,OAAOP,KAAKM,IAAI,CAACC,MAAM;IAC9D,MAAMU,UAAUH,aAAa,UAAUP,OAAOP,KAAKM,IAAI,CAACC,MAAM;IAE9D,MAAMW,QAAQ,IAAIjB;IAClB,MAAMkB,QAAQhB,cAAc,CAACW,SAAS,IAAIX,eAAeM,KAAK;IAC9D,IAAK,IAAIW,QAAQ,GAAGA,QAAQD,MAAME,MAAM,EAAED,QAAS;QACjD,MAAME,OAAOH,KAAK,CAACC,MAAM;QACzBF,MAAMK,KAAK,CAACrB,gBAAgBsB,IAAI,CAAC,MAAMxB,KAAKM,IAAI,CAACU,SAASM,KAAKjB,GAAG,GAAGL,KAAKM,IAAI,CAACW,SAASK,KAAKf,IAAI,GAAGe,KAAKd,QAAQ;IACnH;IAEAU,MAAMO,KAAK,CAACZ;AACd"}
@@ -0,0 +1,31 @@
1
+ import path from 'path';
2
+ import get from 'get-remote';
3
+ import conditionalCache from '../lib/conditionalCache.mjs';
4
+ import conditionalExtract from '../lib/conditionalExtract.mjs';
5
+ const NODE_DIST_URL = 'https://nodejs.org/dist/index.json';
6
+ const NPM_DIST_TAGS_URL = 'https://registry.npmjs.org/-/package/npm/dist-tags';
7
+ const NPM_DIST_URL = 'https://registry.npmjs.org/npm';
8
+ const NPM_MIN_VERSION = 3;
9
+ export default function installLib(version, dest, options, callback) {
10
+ const platform = options.platform || process.platform;
11
+ const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');
12
+ const installPath = path.join(libPath, 'node_modules', 'npm');
13
+ get(NODE_DIST_URL).json((err, res1)=>{
14
+ if (err) return callback(err);
15
+ const releases = res1.body;
16
+ const found = releases.find((record)=>record.version === version.version);
17
+ const npmMajorPair = found && found.npm ? +found.npm.split('.')[0] : NPM_MIN_VERSION;
18
+ const npmMajor = Math.max(npmMajorPair, NPM_MIN_VERSION);
19
+ get(NPM_DIST_TAGS_URL).json((err, res2)=>{
20
+ if (err) return callback(err);
21
+ const distTags = res2.body;
22
+ const installVersion = distTags[`latest-${npmMajor}`] || distTags[`next-${npmMajor}`] || distTags.latest;
23
+ const downloadPath = `${NPM_DIST_URL}/-/npm-${installVersion}.tgz`;
24
+ const cachePath = path.join(options.cachePath, path.basename(downloadPath));
25
+ conditionalCache(downloadPath, cachePath, (err)=>{
26
+ if (err) return callback(err);
27
+ conditionalExtract(cachePath, installPath, callback);
28
+ });
29
+ });
30
+ });
31
+ }
@@ -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":["path","get","conditionalCache","conditionalExtract","NODE_DIST_URL","NPM_DIST_TAGS_URL","NPM_DIST_URL","NPM_MIN_VERSION","installLib","version","dest","options","callback","platform","process","libPath","join","installPath","json","err","res1","releases","body","found","find","record","npmMajorPair","npm","split","npmMajor","Math","max","res2","distTags","installVersion","latest","downloadPath","cachePath","basename"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,aAAa;AAE7B,OAAOC,sBAAsB,0BAA0B;AACvD,OAAOC,wBAAwB,4BAA4B;AAE3D,MAAMC,gBAAgB;AACtB,MAAMC,oBAAoB;AAC1B,MAAMC,eAAe;AACrB,MAAMC,kBAAkB;AAWxB,eAAe,SAASC,WAAWC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACjE,MAAMC,WAAWF,QAAQE,QAAQ,IAAIC,QAAQD,QAAQ;IACrD,MAAME,UAAUF,aAAa,UAAUH,OAAOV,KAAKgB,IAAI,CAACN,MAAM;IAC9D,MAAMO,cAAcjB,KAAKgB,IAAI,CAACD,SAAS,gBAAgB;IAEvDd,IAAIG,eAAec,IAAI,CAAC,CAACC,KAAKC;QAC5B,IAAID,KAAK,OAAOP,SAASO;QACzB,MAAME,WAAWD,KAAKE,IAAI;QAE1B,MAAMC,QAAQF,SAASG,IAAI,CAAC,CAACC,SAAWA,OAAOhB,OAAO,KAAKA,QAAQA,OAAO;QAC1E,MAAMiB,eAAeH,SAASA,MAAMI,GAAG,GAAG,CAACJ,MAAMI,GAAG,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE,GAAGrB;QACrE,MAAMsB,WAAWC,KAAKC,GAAG,CAACL,cAAcnB;QAExCN,IAAII,mBAAmBa,IAAI,CAAC,CAACC,KAAKa;YAChC,IAAIb,KAAK,OAAOP,SAASO;YACzB,MAAMc,WAAWD,KAAKV,IAAI;YAC1B,MAAMY,iBAAiBD,QAAQ,CAAC,CAAC,OAAO,EAAEJ,UAAU,CAAC,IAAII,QAAQ,CAAC,CAAC,KAAK,EAAEJ,UAAU,CAAC,IAAII,SAASE,MAAM;YACxG,MAAMC,eAAe,GAAG9B,aAAa,OAAO,EAAE4B,eAAe,IAAI,CAAC;YAClE,MAAMG,YAAYrC,KAAKgB,IAAI,CAACL,QAAQ0B,SAAS,EAAErC,KAAKsC,QAAQ,CAACF;YAC7DlC,iBAAiBkC,cAAcC,WAAW,CAAClB;gBACzC,IAAIA,KAAK,OAAOP,SAASO;gBACzBhB,mBAAmBkC,WAAWpB,aAAaL;YAC7C;QACF;IACF;AACF"}
@@ -0,0 +1,18 @@
1
+ import distPaths from 'node-filename-to-dist-paths';
2
+ import prebuilts from './prebuilts.mjs';
3
+ export default function findDistPaths(version, options) {
4
+ const filenames = options.filename ? [
5
+ options.filename
6
+ ] : prebuilts(options);
7
+ for(let index = 0; index < filenames.length; index++){
8
+ const filename = filenames[index];
9
+ if (!~version.files.indexOf(filename)) continue;
10
+ const relativePaths = distPaths(filename, version.version);
11
+ if (relativePaths && relativePaths.length) return {
12
+ version: version.version,
13
+ filename: filename,
14
+ relativePaths: relativePaths
15
+ };
16
+ }
17
+ return null;
18
+ }
@@ -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":["distPaths","prebuilts","findDistPaths","version","options","filenames","filename","index","length","files","indexOf","relativePaths"],"mappings":"AAAA,OAAOA,eAAe,8BAA8B;AACpD,OAAOC,eAAe,cAAc;AAEpC,eAAe,SAASC,cAAcC,OAAO,EAAEC,OAAO;IACpD,MAAMC,YAAYD,QAAQE,QAAQ,GAAG;QAACF,QAAQE,QAAQ;KAAC,GAAGL,UAAUG;IACpE,IAAK,IAAIG,QAAQ,GAAGA,QAAQF,UAAUG,MAAM,EAAED,QAAS;QACrD,MAAMD,WAAWD,SAAS,CAACE,MAAM;QACjC,IAAI,CAAC,CAACJ,QAAQM,KAAK,CAACC,OAAO,CAACJ,WAAW;QACvC,MAAMK,gBAAgBX,UAAUM,UAAUH,QAAQA,OAAO;QACzD,IAAIQ,iBAAiBA,cAAcH,MAAM,EAAE,OAAO;YAAEL,SAASA,QAAQA,OAAO;YAAEG,UAAUA;YAAUK,eAAeA;QAAc;IACjI;IACA,OAAO;AACT"}
@@ -0,0 +1,24 @@
1
+ import find from 'lodash.find';
2
+ import endsWithFn from '../lib/endsWithFn.mjs';
3
+ import findDistPaths from './findDistPaths.mjs';
4
+ import installCompressed from './installCompressed.mjs';
5
+ import installExe from './installExe.mjs';
6
+ import installSource from './installSource/index.mjs';
7
+ export default function install(version, dest, options, callback) {
8
+ let record = findDistPaths(version, options);
9
+ if (record) {
10
+ if (record.filename === 'src') return installSource(record.relativePaths[0], dest, record, options, callback);
11
+ let relativePath = find(record.relativePaths, endsWithFn([
12
+ '.tar.gz',
13
+ '.zip'
14
+ ]));
15
+ if (relativePath) return installCompressed(relativePath, dest, record, options, callback);
16
+ relativePath = find(record.relativePaths, endsWithFn('.exe'));
17
+ if (relativePath) return installExe(relativePath, dest, record, options, callback);
18
+ }
19
+ record = findDistPaths(version, {
20
+ filename: 'src'
21
+ });
22
+ if (record && record.relativePaths.length) return installSource(record.relativePaths[0], dest, record, options, callback);
23
+ callback(new Error(`Unable to install ${version}`));
24
+ }
@@ -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":["find","endsWithFn","findDistPaths","installCompressed","installExe","installSource","install","version","dest","options","callback","record","filename","relativePaths","relativePath","length","Error"],"mappings":"AAAA,OAAOA,UAAU,cAAc;AAE/B,OAAOC,gBAAgB,oBAAoB;AAC3C,OAAOC,mBAAmB,kBAAkB;AAC5C,OAAOC,uBAAuB,sBAAsB;AACpD,OAAOC,gBAAgB,eAAe;AACtC,OAAOC,mBAAmB,wBAAwB;AAElD,eAAe,SAASC,QAAQC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC9D,IAAIC,SAAST,cAAcK,SAASE;IACpC,IAAIE,QAAQ;QACV,IAAIA,OAAOC,QAAQ,KAAK,OAAO,OAAOP,cAAcM,OAAOE,aAAa,CAAC,EAAE,EAAEL,MAAMG,QAAQF,SAASC;QAEpG,IAAII,eAAed,KAAKW,OAAOE,aAAa,EAAEZ,WAAW;YAAC;YAAW;SAAO;QAC5E,IAAIa,cAAc,OAAOX,kBAAkBW,cAAcN,MAAMG,QAAQF,SAASC;QAEhFI,eAAed,KAAKW,OAAOE,aAAa,EAAEZ,WAAW;QACrD,IAAIa,cAAc,OAAOV,WAAWU,cAAcN,MAAMG,QAAQF,SAASC;IAC3E;IAEAC,SAAST,cAAcK,SAAS;QAAEK,UAAU;IAAM;IAClD,IAAID,UAAUA,OAAOE,aAAa,CAACE,MAAM,EAAE,OAAOV,cAAcM,OAAOE,aAAa,CAAC,EAAE,EAAEL,MAAMG,QAAQF,SAASC;IAChHA,SAAS,IAAIM,MAAM,CAAC,kBAAkB,EAAET,SAAS;AACnD"}
@@ -0,0 +1,34 @@
1
+ import path from 'path';
2
+ import access from 'fs-access-compat';
3
+ import rimraf2 from 'rimraf2';
4
+ import conditionalCache from '../lib/conditionalCache.mjs';
5
+ import conditionalExtract from '../lib/conditionalExtract.mjs';
6
+ import progress from '../lib/progress.mjs';
7
+ export default function installCompressed(relativePath, dest, _record, options, callback) {
8
+ const downloadPath = options.downloadURL(relativePath);
9
+ const cachePath = path.join(options.cachePath, path.basename(downloadPath));
10
+ conditionalCache(downloadPath, cachePath, (err)=>{
11
+ if (err) return callback(err);
12
+ access(dest, (err)=>{
13
+ if (!err) return callback(); // already exists
14
+ conditionalExtract(cachePath, dest, {
15
+ strip: 1,
16
+ progress: progress,
17
+ time: 1000,
18
+ ...options
19
+ }, (err)=>{
20
+ console.log('');
21
+ if (err) return callback(err);
22
+ // some compressed versions of node come with npm pre-installed, but we want to override with a specific version
23
+ const platform = options.platform || process.platform;
24
+ const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');
25
+ const installPath = path.join(libPath, 'node_modules', 'npm');
26
+ rimraf2(installPath, {
27
+ disableGlob: true
28
+ }, ()=>{
29
+ callback(err);
30
+ });
31
+ });
32
+ });
33
+ });
34
+ }
@@ -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":["path","access","rimraf2","conditionalCache","conditionalExtract","progress","installCompressed","relativePath","dest","_record","options","callback","downloadPath","downloadURL","cachePath","join","basename","err","strip","time","console","log","platform","process","libPath","installPath","disableGlob"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,YAAY,mBAAmB;AACtC,OAAOC,aAAa,UAAU;AAE9B,OAAOC,sBAAsB,0BAA0B;AACvD,OAAOC,wBAAwB,4BAA4B;AAC3D,OAAOC,cAAc,qBAAqB;AAE1C,eAAe,SAASC,kBAAkBC,YAAY,EAAEC,IAAI,EAAEC,OAAO,EAAEC,OAAO,EAAEC,QAAQ;IACtF,MAAMC,eAAeF,QAAQG,WAAW,CAACN;IACzC,MAAMO,YAAYd,KAAKe,IAAI,CAACL,QAAQI,SAAS,EAAEd,KAAKgB,QAAQ,CAACJ;IAE7DT,iBAAiBS,cAAcE,WAAW,CAACG;QACzC,IAAIA,KAAK,OAAON,SAASM;QACzBhB,OAAOO,MAAM,CAACS;YACZ,IAAI,CAACA,KAAK,OAAON,YAAY,iBAAiB;YAC9CP,mBAAmBU,WAAWN,MAAM;gBAAEU,OAAO;gBAAGb,UAAUA;gBAAUc,MAAM;gBAAM,GAAGT,OAAO;YAAC,GAAG,CAACO;gBAC7FG,QAAQC,GAAG,CAAC;gBACZ,IAAIJ,KAAK,OAAON,SAASM;gBAEzB,gHAAgH;gBAChH,MAAMK,WAAWZ,QAAQY,QAAQ,IAAIC,QAAQD,QAAQ;gBACrD,MAAME,UAAUF,aAAa,UAAUd,OAAOR,KAAKe,IAAI,CAACP,MAAM;gBAC9D,MAAMiB,cAAczB,KAAKe,IAAI,CAACS,SAAS,gBAAgB;gBACvDtB,QAAQuB,aAAa;oBAAEC,aAAa;gBAAK,GAAG;oBAC1Cf,SAASM;gBACX;YACF;QACF;IACF;AACF"}
@@ -0,0 +1,16 @@
1
+ import path from 'path';
2
+ import access from 'fs-access-compat';
3
+ import conditionalCache from '../lib/conditionalCache.mjs';
4
+ import copyFile from '../lib/copyFile.mjs';
5
+ export default function installExe(relativePath, dest, record, options, callback) {
6
+ const downloadPath = options.downloadURL(relativePath);
7
+ const cachePath = path.join(options.cachePath, `node-${record.version}.exe`);
8
+ const destPath = path.join(dest, path.basename(relativePath));
9
+ access(destPath, (err)=>{
10
+ if (!err) return callback(); // already exists
11
+ conditionalCache(downloadPath, cachePath, (err)=>{
12
+ if (err) return callback(err);
13
+ copyFile(cachePath, destPath, callback);
14
+ });
15
+ });
16
+ }
@@ -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":["path","access","conditionalCache","copyFile","installExe","relativePath","dest","record","options","callback","downloadPath","downloadURL","cachePath","join","version","destPath","basename","err"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,YAAY,mBAAmB;AAEtC,OAAOC,sBAAsB,0BAA0B;AACvD,OAAOC,cAAc,kBAAkB;AAEvC,eAAe,SAASC,WAAWC,YAAY,EAAEC,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ;IAC9E,MAAMC,eAAeF,QAAQG,WAAW,CAACN;IACzC,MAAMO,YAAYZ,KAAKa,IAAI,CAACL,QAAQI,SAAS,EAAE,CAAC,KAAK,EAAEL,OAAOO,OAAO,CAAC,IAAI,CAAC;IAC3E,MAAMC,WAAWf,KAAKa,IAAI,CAACP,MAAMN,KAAKgB,QAAQ,CAACX;IAE/CJ,OAAOc,UAAU,CAACE;QAChB,IAAI,CAACA,KAAK,OAAOR,YAAY,iBAAiB;QAC9CP,iBAAiBQ,cAAcE,WAAW,CAACK;YACzC,IAAIA,KAAK,OAAOR,SAASQ;YACzBd,SAASS,WAAWG,UAAUN;QAChC;IACF;AACF"}
@@ -0,0 +1,28 @@
1
+ import path from 'path';
2
+ import spawn from 'cross-spawn-cb';
3
+ import access from 'fs-access-compat';
4
+ import Queue from 'queue-cb';
5
+ export default function installDefault(buildPath, dest, _options, callback) {
6
+ const buildTarget = path.join(dest, 'node');
7
+ access(buildTarget, (err)=>{
8
+ if (!err) return callback(); // already exists
9
+ const queue = new Queue(1);
10
+ queue.defer((callback)=>{
11
+ spawn('./configure', [
12
+ `--prefix=${dest}`
13
+ ], {
14
+ stdio: 'inherit',
15
+ cwd: buildPath
16
+ }, callback);
17
+ });
18
+ queue.defer((callback)=>{
19
+ spawn('make', [
20
+ 'install'
21
+ ], {
22
+ stdio: 'inherit',
23
+ cwd: buildPath
24
+ }, callback);
25
+ });
26
+ queue.await(callback);
27
+ });
28
+ }
@@ -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":["path","spawn","access","Queue","installDefault","buildPath","dest","_options","callback","buildTarget","join","err","queue","defer","stdio","cwd","await"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,WAAW,iBAAiB;AACnC,OAAOC,YAAY,mBAAmB;AACtC,OAAOC,WAAW,WAAW;AAE7B,eAAe,SAASC,eAAeC,SAAS,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ;IACxE,MAAMC,cAAcT,KAAKU,IAAI,CAACJ,MAAM;IAEpCJ,OAAOO,aAAa,CAACE;QACnB,IAAI,CAACA,KAAK,OAAOH,YAAY,iBAAiB;QAE9C,MAAMI,QAAQ,IAAIT,MAAM;QACxBS,MAAMC,KAAK,CAAC,CAACL;YACXP,MAAM,eAAe;gBAAC,CAAC,SAAS,EAAEK,MAAM;aAAC,EAAE;gBAAEQ,OAAO;gBAAWC,KAAKV;YAAU,GAAGG;QACnF;QACAI,MAAMC,KAAK,CAAC,CAACL;YACXP,MAAM,QAAQ;gBAAC;aAAU,EAAE;gBAAEa,OAAO;gBAAWC,KAAKV;YAAU,GAAGG;QACnE;QACAI,MAAMI,KAAK,CAACR;IACd;AACF"}
@@ -0,0 +1,24 @@
1
+ import path from 'path';
2
+ import spawn from 'cross-spawn-cb';
3
+ import Queue from 'queue-cb';
4
+ import access from 'fs-access-compat';
5
+ import conditionalCopy from '../../lib/conditionalCopy.mjs';
6
+ export default function installWin32(buildPath, dest, _options, callback) {
7
+ const buildSource = path.join(buildPath, 'out', 'Release', 'node.exe');
8
+ const buildTarget = path.join(dest, 'node.exe');
9
+ access(buildTarget, (err)=>{
10
+ if (!err) return callback(); // already exists
11
+ const queue = new Queue(1);
12
+ queue.defer((callback)=>{
13
+ access(buildSource, (err)=>{
14
+ if (!err) return callback(); // already exists
15
+ spawn('./vcbuild', [], {
16
+ stdio: 'inherit',
17
+ cwd: buildPath
18
+ }, callback);
19
+ });
20
+ });
21
+ queue.defer(conditionalCopy.bind(null, buildSource, buildTarget));
22
+ queue.await(callback);
23
+ });
24
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installSource/buildWin32.ts"],"sourcesContent":["import path from 'path';\nimport spawn from 'cross-spawn-cb';\nimport Queue from 'queue-cb';\n\nimport access from 'fs-access-compat';\nimport conditionalCopy from '../../lib/conditionalCopy';\n\nexport default function installWin32(buildPath, dest, _options, callback) {\n const buildSource = path.join(buildPath, 'out', 'Release', 'node.exe');\n const buildTarget = path.join(dest, 'node.exe');\n\n access(buildTarget, (err) => {\n if (!err) return callback(); // already exists\n\n const queue = new Queue(1);\n queue.defer((callback) => {\n access(buildSource, (err) => {\n if (!err) return callback(); // already exists\n spawn('./vcbuild', [], { stdio: 'inherit', cwd: buildPath }, callback);\n });\n });\n queue.defer(conditionalCopy.bind(null, buildSource, buildTarget));\n queue.await(callback);\n });\n}\n"],"names":["path","spawn","Queue","access","conditionalCopy","installWin32","buildPath","dest","_options","callback","buildSource","join","buildTarget","err","queue","defer","stdio","cwd","bind","await"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,WAAW,iBAAiB;AACnC,OAAOC,WAAW,WAAW;AAE7B,OAAOC,YAAY,mBAAmB;AACtC,OAAOC,qBAAqB,4BAA4B;AAExD,eAAe,SAASC,aAAaC,SAAS,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ;IACtE,MAAMC,cAAcV,KAAKW,IAAI,CAACL,WAAW,OAAO,WAAW;IAC3D,MAAMM,cAAcZ,KAAKW,IAAI,CAACJ,MAAM;IAEpCJ,OAAOS,aAAa,CAACC;QACnB,IAAI,CAACA,KAAK,OAAOJ,YAAY,iBAAiB;QAE9C,MAAMK,QAAQ,IAAIZ,MAAM;QACxBY,MAAMC,KAAK,CAAC,CAACN;YACXN,OAAOO,aAAa,CAACG;gBACnB,IAAI,CAACA,KAAK,OAAOJ,YAAY,iBAAiB;gBAC9CR,MAAM,aAAa,EAAE,EAAE;oBAAEe,OAAO;oBAAWC,KAAKX;gBAAU,GAAGG;YAC/D;QACF;QACAK,MAAMC,KAAK,CAACX,gBAAgBc,IAAI,CAAC,MAAMR,aAAaE;QACpDE,MAAMK,KAAK,CAACV;IACd;AACF"}
@@ -0,0 +1,20 @@
1
+ import path from 'path';
2
+ import Queue from 'queue-cb';
3
+ import conditionalCache from '../../lib/conditionalCache.mjs';
4
+ import conditionalExtract from '../../lib/conditionalExtract.mjs';
5
+ import buildPosix from './buildPosix.mjs';
6
+ import buildWin32 from './buildWin32.mjs';
7
+ export default function InstallSource(relativePath, dest, _record, options, callback) {
8
+ const platform = options.platform || process.platform;
9
+ const build = platform === 'win32' ? buildWin32 : buildPosix;
10
+ const downloadPath = options.downloadURL(relativePath);
11
+ const buildPath = path.join(options.buildPath, path.basename(relativePath));
12
+ const cachePath = path.join(options.cachePath, path.basename(downloadPath));
13
+ const queue = new Queue(1);
14
+ queue.defer(conditionalCache.bind(null, downloadPath, cachePath));
15
+ queue.defer(conditionalExtract.bind(null, cachePath, buildPath, {
16
+ strip: 1
17
+ }));
18
+ queue.defer(build.bind(null, buildPath, dest, options));
19
+ queue.await(callback);
20
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installSource/index.ts"],"sourcesContent":["import path from 'path';\nimport Queue from 'queue-cb';\n\nimport conditionalCache from '../../lib/conditionalCache';\nimport conditionalExtract from '../../lib/conditionalExtract';\nimport buildPosix from './buildPosix';\nimport buildWin32 from './buildWin32';\n\nexport default function InstallSource(relativePath, dest, _record, options, callback) {\n const platform = options.platform || process.platform;\n const build = platform === 'win32' ? buildWin32 : buildPosix;\n const downloadPath = options.downloadURL(relativePath);\n const buildPath = path.join(options.buildPath, path.basename(relativePath));\n const cachePath = path.join(options.cachePath, path.basename(downloadPath));\n\n const queue = new Queue(1);\n queue.defer(conditionalCache.bind(null, downloadPath, cachePath));\n queue.defer(conditionalExtract.bind(null, cachePath, buildPath, { strip: 1 }));\n queue.defer(build.bind(null, buildPath, dest, options));\n queue.await(callback);\n}\n"],"names":["path","Queue","conditionalCache","conditionalExtract","buildPosix","buildWin32","InstallSource","relativePath","dest","_record","options","callback","platform","process","build","downloadPath","downloadURL","buildPath","join","basename","cachePath","queue","defer","bind","strip","await"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAE7B,OAAOC,sBAAsB,6BAA6B;AAC1D,OAAOC,wBAAwB,+BAA+B;AAC9D,OAAOC,gBAAgB,eAAe;AACtC,OAAOC,gBAAgB,eAAe;AAEtC,eAAe,SAASC,cAAcC,YAAY,EAAEC,IAAI,EAAEC,OAAO,EAAEC,OAAO,EAAEC,QAAQ;IAClF,MAAMC,WAAWF,QAAQE,QAAQ,IAAIC,QAAQD,QAAQ;IACrD,MAAME,QAAQF,aAAa,UAAUP,aAAaD;IAClD,MAAMW,eAAeL,QAAQM,WAAW,CAACT;IACzC,MAAMU,YAAYjB,KAAKkB,IAAI,CAACR,QAAQO,SAAS,EAAEjB,KAAKmB,QAAQ,CAACZ;IAC7D,MAAMa,YAAYpB,KAAKkB,IAAI,CAACR,QAAQU,SAAS,EAAEpB,KAAKmB,QAAQ,CAACJ;IAE7D,MAAMM,QAAQ,IAAIpB,MAAM;IACxBoB,MAAMC,KAAK,CAACpB,iBAAiBqB,IAAI,CAAC,MAAMR,cAAcK;IACtDC,MAAMC,KAAK,CAACnB,mBAAmBoB,IAAI,CAAC,MAAMH,WAAWH,WAAW;QAAEO,OAAO;IAAE;IAC3EH,MAAMC,KAAK,CAACR,MAAMS,IAAI,CAAC,MAAMN,WAAWT,MAAME;IAC9CW,MAAMI,KAAK,CAACd;AACd"}
@@ -0,0 +1,37 @@
1
+ import arch from '../lib/arch.cjs';
2
+ const PLATFORM_OS = {
3
+ win32: 'win',
4
+ darwin: 'osx'
5
+ };
6
+ const PLATFORM_FILES = {
7
+ win32: [
8
+ 'zip',
9
+ 'exe'
10
+ ],
11
+ darwin: [
12
+ 'tar'
13
+ ]
14
+ };
15
+ let machineArch = null;
16
+ export default function prebuilts(options) {
17
+ if (!machineArch) machineArch = arch();
18
+ const platform = options.platform || process.platform;
19
+ const os = PLATFORM_OS[platform] || platform;
20
+ const archs = [];
21
+ if (options.arch) archs.push(options.arch);
22
+ archs.push(machineArch);
23
+ if (os.arch) archs.push(os.arch());
24
+ if (platform === 'darwin' && machineArch === 'arm64') archs.push('x64'); // fallback
25
+ const files = PLATFORM_FILES[platform];
26
+ const results = [];
27
+ for(let i = 0; i < archs.length; i++){
28
+ if (typeof files === 'undefined') {
29
+ results.push(`${os}-${archs[i]}`);
30
+ } else {
31
+ for(let j = 0; j < files.length; j++){
32
+ results.push(`${os}-${archs[i]}-${files[j]}`);
33
+ }
34
+ }
35
+ }
36
+ return results;
37
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/prebuilts.ts"],"sourcesContent":["import os from 'os';\nimport arch from '../lib/arch.cjs';\n\nconst PLATFORM_OS = {\n win32: 'win',\n darwin: 'osx',\n};\n\nconst PLATFORM_FILES = {\n win32: ['zip', 'exe'],\n darwin: ['tar'],\n};\nlet machineArch = null;\n\nexport default function prebuilts(options) {\n if (!machineArch) machineArch = arch();\n const platform = options.platform || process.platform;\n const os = PLATFORM_OS[platform] || platform;\n const archs = [];\n if (options.arch) archs.push(options.arch);\n archs.push(machineArch);\n if (os.arch) archs.push(os.arch());\n if (platform === 'darwin' && machineArch === 'arm64') archs.push('x64'); // fallback\n\n const files = PLATFORM_FILES[platform];\n const results = [];\n for (let i = 0; i < archs.length; i++) {\n if (typeof files === 'undefined') {\n results.push(`${os}-${archs[i]}`);\n } else {\n for (let j = 0; j < files.length; j++) {\n results.push(`${os}-${archs[i]}-${files[j]}`);\n }\n }\n }\n return results;\n}\n"],"names":["arch","PLATFORM_OS","win32","darwin","PLATFORM_FILES","machineArch","prebuilts","options","platform","process","os","archs","push","files","results","i","length","j"],"mappings":"AACA,OAAOA,UAAU,kBAAkB;AAEnC,MAAMC,cAAc;IAClBC,OAAO;IACPC,QAAQ;AACV;AAEA,MAAMC,iBAAiB;IACrBF,OAAO;QAAC;QAAO;KAAM;IACrBC,QAAQ;QAAC;KAAM;AACjB;AACA,IAAIE,cAAc;AAElB,eAAe,SAASC,UAAUC,OAAO;IACvC,IAAI,CAACF,aAAaA,cAAcL;IAChC,MAAMQ,WAAWD,QAAQC,QAAQ,IAAIC,QAAQD,QAAQ;IACrD,MAAME,KAAKT,WAAW,CAACO,SAAS,IAAIA;IACpC,MAAMG,QAAQ,EAAE;IAChB,IAAIJ,QAAQP,IAAI,EAAEW,MAAMC,IAAI,CAACL,QAAQP,IAAI;IACzCW,MAAMC,IAAI,CAACP;IACX,IAAIK,GAAGV,IAAI,EAAEW,MAAMC,IAAI,CAACF,GAAGV,IAAI;IAC/B,IAAIQ,aAAa,YAAYH,gBAAgB,SAASM,MAAMC,IAAI,CAAC,QAAQ,WAAW;IAEpF,MAAMC,QAAQT,cAAc,CAACI,SAAS;IACtC,MAAMM,UAAU,EAAE;IAClB,IAAK,IAAIC,IAAI,GAAGA,IAAIJ,MAAMK,MAAM,EAAED,IAAK;QACrC,IAAI,OAAOF,UAAU,aAAa;YAChCC,QAAQF,IAAI,CAAC,GAAGF,GAAG,CAAC,EAAEC,KAAK,CAACI,EAAE,EAAE;QAClC,OAAO;YACL,IAAK,IAAIE,IAAI,GAAGA,IAAIJ,MAAMG,MAAM,EAAEC,IAAK;gBACrCH,QAAQF,IAAI,CAAC,GAAGF,GAAG,CAAC,EAAEC,KAAK,CAACI,EAAE,CAAC,CAAC,EAAEF,KAAK,CAACI,EAAE,EAAE;YAC9C;QACF;IACF;IACA,OAAOH;AACT"}