node-install-release 0.4.6 → 0.4.8

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 (103) hide show
  1. package/dist/cjs/arch.js +67 -0
  2. package/dist/cjs/arch.js.map +1 -0
  3. package/dist/cjs/checkMissing.js +48 -0
  4. package/dist/cjs/checkMissing.js.map +1 -0
  5. package/dist/cjs/conditionalCache.js +34 -0
  6. package/dist/cjs/conditionalCache.js.map +1 -0
  7. package/dist/cjs/conditionalCopy.js +27 -0
  8. package/dist/cjs/conditionalCopy.js.map +1 -0
  9. package/dist/cjs/conditionalExtract.js +33 -0
  10. package/dist/cjs/conditionalExtract.js.map +1 -0
  11. package/dist/cjs/copyFile.js +30 -0
  12. package/dist/cjs/copyFile.js.map +1 -0
  13. package/dist/cjs/endsWithFn.js +20 -0
  14. package/dist/cjs/endsWithFn.js.map +1 -0
  15. package/dist/cjs/ensureDestinationParent.js +16 -0
  16. package/dist/cjs/ensureDestinationParent.js.map +1 -0
  17. package/dist/cjs/index.js +23 -0
  18. package/dist/cjs/index.js.map +1 -0
  19. package/dist/cjs/install.js +53 -0
  20. package/dist/cjs/install.js.map +1 -0
  21. package/dist/cjs/installNPM/index.js +15 -0
  22. package/dist/cjs/installNPM/index.js.map +1 -0
  23. package/dist/cjs/installNPM/installBin.js +55 -0
  24. package/dist/cjs/installNPM/installBin.js.map +1 -0
  25. package/dist/cjs/installNPM/installLib.js +40 -0
  26. package/dist/cjs/installNPM/installLib.js.map +1 -0
  27. package/dist/cjs/installNode/filenames.js +41 -0
  28. package/dist/cjs/installNode/filenames.js.map +1 -0
  29. package/dist/cjs/installNode/findDistPaths.js +25 -0
  30. package/dist/cjs/installNode/findDistPaths.js.map +1 -0
  31. package/dist/cjs/installNode/index.js +31 -0
  32. package/dist/cjs/installNode/index.js.map +1 -0
  33. package/dist/cjs/installNode/installCompressed.js +38 -0
  34. package/dist/cjs/installNode/installCompressed.js.map +1 -0
  35. package/dist/cjs/installNode/installExe.js +23 -0
  36. package/dist/cjs/installNode/installExe.js.map +1 -0
  37. package/dist/cjs/installNode/installSource/buildPosix.js +35 -0
  38. package/dist/cjs/installNode/installSource/buildPosix.js.map +1 -0
  39. package/dist/cjs/installNode/installSource/buildWin32.js +31 -0
  40. package/dist/cjs/installNode/installSource/buildWin32.js.map +1 -0
  41. package/dist/cjs/installNode/installSource/index.js +27 -0
  42. package/dist/cjs/installNode/installSource/index.js.map +1 -0
  43. package/dist/cjs/installVersion.js +27 -0
  44. package/dist/cjs/installVersion.js.map +1 -0
  45. package/dist/cjs/package.json +1 -0
  46. package/dist/cjs/polyfills/execCallback.js +11 -0
  47. package/dist/cjs/polyfills/execCallback.js.map +1 -0
  48. package/dist/cjs/polyfills/index.js +21 -0
  49. package/dist/cjs/polyfills/index.js.map +1 -0
  50. package/dist/cjs/progress.js +13 -0
  51. package/dist/cjs/progress.js.map +1 -0
  52. package/dist/types/arch.d.ts +2 -0
  53. package/dist/types/buildPosix.d.ts +2 -0
  54. package/dist/types/checkMissing.d.ts +2 -0
  55. package/dist/types/conditionalCache.d.ts +2 -0
  56. package/dist/types/conditionalCopy.d.ts +2 -0
  57. package/dist/types/conditionalExtract.d.ts +2 -0
  58. package/dist/types/copyFile.d.ts +2 -0
  59. package/dist/types/endsWithFn.d.ts +2 -0
  60. package/dist/types/ensureDestinationParent.d.ts +2 -0
  61. package/dist/types/execCallback.d.ts +4 -0
  62. package/dist/types/index.d.ts +2 -0
  63. package/dist/types/install.d.ts +2 -0
  64. package/dist/types/installNPM/index.d.ts +2 -0
  65. package/dist/types/installNPM/installBin.d.ts +2 -0
  66. package/dist/types/installNPM/installLib.d.ts +2 -0
  67. package/dist/types/installNode/filenames.d.ts +2 -0
  68. package/dist/types/installNode/findDistPaths.d.ts +6 -0
  69. package/dist/types/installNode/index.d.ts +2 -0
  70. package/dist/types/installNode/installCompressed.d.ts +2 -0
  71. package/dist/types/installNode/installExe.d.ts +2 -0
  72. package/dist/types/installNode/installSource/buildPosix.d.ts +2 -0
  73. package/dist/types/installNode/installSource/buildWin32.d.ts +2 -0
  74. package/dist/types/installNode/installSource/index.d.ts +2 -0
  75. package/dist/types/installVersion.d.ts +2 -0
  76. package/dist/types/polyfills/index.d.ts +1 -0
  77. package/dist/types/progress.d.ts +2 -0
  78. package/package.json +27 -24
  79. package/lib/arch.js +0 -72
  80. package/lib/checkMissing.js +0 -36
  81. package/lib/conditionalCache.js +0 -28
  82. package/lib/conditionalCopy.js +0 -25
  83. package/lib/conditionalExtract.js +0 -27
  84. package/lib/copyFile.js +0 -28
  85. package/lib/endsWithFn.js +0 -12
  86. package/lib/ensureDestinationParent.js +0 -10
  87. package/lib/index.js +0 -19
  88. package/lib/install.js +0 -45
  89. package/lib/installNPM/index.js +0 -9
  90. package/lib/installNPM/installBin.js +0 -31
  91. package/lib/installNPM/installLib.js +0 -39
  92. package/lib/installNode/filenames.js +0 -31
  93. package/lib/installNode/findDistPaths.js +0 -13
  94. package/lib/installNode/index.js +0 -25
  95. package/lib/installNode/installCompressed.js +0 -31
  96. package/lib/installNode/installExe.js +0 -19
  97. package/lib/installNode/installSource/buildPosix.js +0 -21
  98. package/lib/installNode/installSource/buildWin32.js +0 -25
  99. package/lib/installNode/installSource/index.js +0 -21
  100. package/lib/installVersion.js +0 -24
  101. package/lib/polyfills/execCallback.js +0 -5
  102. package/lib/polyfills/index.js +0 -15
  103. package/lib/progress.js +0 -7
@@ -0,0 +1,67 @@
1
+ // Inline until merged: https://github.com/jakejarvis/arch/blob/detect-arm/index.js
2
+ /*! arch. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ "use strict";
3
+ var cp = require("child_process");
4
+ var fs = require("fs");
5
+ var path = require("path");
6
+ /**
7
+ * Returns the operating system's CPU architecture. This is different than
8
+ * `process.arch` or `os.arch()` which returns the architecture the Node.js (or
9
+ * Electron) binary was compiled for.
10
+ */ module.exports = function arch() {
11
+ /**
12
+ * On macOS, we need to detect if x64 Node is running because the CPU is truly
13
+ * an Intel chip, or if it's running on Apple Silicon via Rosetta 2:
14
+ * https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment
15
+ */ if (process.platform === "darwin") {
16
+ var nativeArm = process.arch === "arm64";
17
+ var rosettaArm = cp.execSync("sysctl -in sysctl.proc_translated", {
18
+ encoding: "utf8"
19
+ }) === "1\n";
20
+ return nativeArm || rosettaArm ? "arm64" : "x64";
21
+ }
22
+ /**
23
+ * On Windows, the most reliable way to detect a 64-bit OS from within a 32-bit
24
+ * app is based on the presence of a WOW64 file: %SystemRoot%\SysNative.
25
+ * See: https://twitter.com/feross/status/776949077208510464
26
+ */ if (process.platform === "win32") {
27
+ var useEnv = false;
28
+ try {
29
+ useEnv = !!(process.env.SYSTEMROOT && fs.statSync(process.env.SYSTEMROOT));
30
+ } catch (_err) {}
31
+ var sysRoot = useEnv ? process.env.SYSTEMROOT : "C:\\Windows";
32
+ // If %SystemRoot%\SysNative exists, we are in a WOW64 FS Redirected application.
33
+ var isWOW64 = false;
34
+ try {
35
+ isWOW64 = !!fs.statSync(path.join(sysRoot, "sysnative"));
36
+ } catch (_err) {}
37
+ return isWOW64 ? "x64" : "x86";
38
+ }
39
+ /**
40
+ * On Linux, use the `getconf` command to get the architecture.
41
+ */ if (process.platform === "linux") {
42
+ try {
43
+ var output1 = cp.execSync("uname -a", {
44
+ encoding: "utf8"
45
+ });
46
+ if (~output1.indexOf("raspberrypi")) return "arm-pi";
47
+ } catch (_err) {}
48
+ var output = cp.execSync("getconf LONG_BIT", {
49
+ encoding: "utf8"
50
+ });
51
+ return output === "64\n" ? "x64" : "x86";
52
+ }
53
+ /**
54
+ * The running binary is 64-bit, so the OS is clearly 64-bit.
55
+ */ if (process.arch === "x64") {
56
+ return "x64";
57
+ }
58
+ /**
59
+ * If none of the above, assume the architecture is 32-bit.
60
+ */ return "x86";
61
+ };
62
+
63
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
64
+ Object.defineProperty(exports.default, '__esModule', { value: true });
65
+ for (var key in exports) exports.default[key] = exports[key];
66
+ module.exports = exports.default;
67
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["arch.js"],"sourcesContent":["// Inline until merged: https://github.com/jakejarvis/arch/blob/detect-arm/index.js\n\n/*! arch. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */\nvar cp = require('child_process');\nvar fs = require('fs');\nvar path = require('path');\n\n/**\n * Returns the operating system's CPU architecture. This is different than\n * `process.arch` or `os.arch()` which returns the architecture the Node.js (or\n * Electron) binary was compiled for.\n */\nmodule.exports = function arch() {\n /**\n * On macOS, we need to detect if x64 Node is running because the CPU is truly\n * an Intel chip, or if it's running on Apple Silicon via Rosetta 2:\n * https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment\n */\n if (process.platform === 'darwin') {\n var nativeArm = process.arch === 'arm64';\n var rosettaArm = cp.execSync('sysctl -in sysctl.proc_translated', { encoding: 'utf8' }) === '1\\n';\n\n return nativeArm || rosettaArm ? 'arm64' : 'x64';\n }\n\n /**\n * On Windows, the most reliable way to detect a 64-bit OS from within a 32-bit\n * app is based on the presence of a WOW64 file: %SystemRoot%\\SysNative.\n * See: https://twitter.com/feross/status/776949077208510464\n */\n if (process.platform === 'win32') {\n var useEnv = false;\n try {\n useEnv = !!(process.env.SYSTEMROOT && fs.statSync(process.env.SYSTEMROOT));\n } catch (_err) {}\n\n var sysRoot = useEnv ? process.env.SYSTEMROOT : 'C:\\\\Windows';\n\n // If %SystemRoot%\\SysNative exists, we are in a WOW64 FS Redirected application.\n var isWOW64 = false;\n try {\n isWOW64 = !!fs.statSync(path.join(sysRoot, 'sysnative'));\n } catch (_err) {}\n\n return isWOW64 ? 'x64' : 'x86';\n }\n\n /**\n * On Linux, use the `getconf` command to get the architecture.\n */\n if (process.platform === 'linux') {\n try {\n var output1 = cp.execSync('uname -a', { encoding: 'utf8' });\n if (~output1.indexOf('raspberrypi')) return 'arm-pi';\n } catch (_err) {}\n\n var output = cp.execSync('getconf LONG_BIT', { encoding: 'utf8' });\n return output === '64\\n' ? 'x64' : 'x86';\n }\n\n /**\n * The running binary is 64-bit, so the OS is clearly 64-bit.\n */\n if (process.arch === 'x64') {\n return 'x64';\n }\n\n /**\n * If none of the above, assume the architecture is 32-bit.\n */\n return 'x86';\n};\n"],"names":["cp","require","fs","path","module","exports","arch","process","platform","nativeArm","rosettaArm","execSync","encoding","useEnv","env","SYSTEMROOT","statSync","_err","sysRoot","isWOW64","join","output1","indexOf","output"],"mappings":"AAAA,mFAAmF;AAEnF,2EAA2E;AAC3E,IAAIA,KAAKC,QAAQ;AACjB,IAAIC,KAAKD,QAAQ;AACjB,IAAIE,OAAOF,QAAQ;AAEnB;;;;CAIC,GACDG,OAAOC,OAAO,GAAG,SAASC;IACxB;;;;GAIC,GACD,IAAIC,QAAQC,QAAQ,KAAK,UAAU;QACjC,IAAIC,YAAYF,QAAQD,IAAI,KAAK;QACjC,IAAII,aAAaV,GAAGW,QAAQ,CAAC,qCAAqC;YAAEC,UAAU;QAAO,OAAO;QAE5F,OAAOH,aAAaC,aAAa,UAAU;IAC7C;IAEA;;;;GAIC,GACD,IAAIH,QAAQC,QAAQ,KAAK,SAAS;QAChC,IAAIK,SAAS;QACb,IAAI;YACFA,SAAS,CAAC,CAAEN,CAAAA,QAAQO,GAAG,CAACC,UAAU,IAAIb,GAAGc,QAAQ,CAACT,QAAQO,GAAG,CAACC,UAAU,CAAA;QAC1E,EAAE,OAAOE,MAAM,CAAC;QAEhB,IAAIC,UAAUL,SAASN,QAAQO,GAAG,CAACC,UAAU,GAAG;QAEhD,iFAAiF;QACjF,IAAII,UAAU;QACd,IAAI;YACFA,UAAU,CAAC,CAACjB,GAAGc,QAAQ,CAACb,KAAKiB,IAAI,CAACF,SAAS;QAC7C,EAAE,OAAOD,MAAM,CAAC;QAEhB,OAAOE,UAAU,QAAQ;IAC3B;IAEA;;GAEC,GACD,IAAIZ,QAAQC,QAAQ,KAAK,SAAS;QAChC,IAAI;YACF,IAAIa,UAAUrB,GAAGW,QAAQ,CAAC,YAAY;gBAAEC,UAAU;YAAO;YACzD,IAAI,CAACS,QAAQC,OAAO,CAAC,gBAAgB,OAAO;QAC9C,EAAE,OAAOL,MAAM,CAAC;QAEhB,IAAIM,SAASvB,GAAGW,QAAQ,CAAC,oBAAoB;YAAEC,UAAU;QAAO;QAChE,OAAOW,WAAW,SAAS,QAAQ;IACrC;IAEA;;GAEC,GACD,IAAIhB,QAAQD,IAAI,KAAK,OAAO;QAC1B,OAAO;IACT;IAEA;;GAEC,GACD,OAAO;AACT"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var path = require("path");
3
+ var fs = require("fs");
4
+ var keys = require("lodash.keys");
5
+ var PLATFORM_FILES = {
6
+ win32: {
7
+ node: [
8
+ "node.exe"
9
+ ],
10
+ npm: [
11
+ "npm",
12
+ "npm.cmd"
13
+ ]
14
+ },
15
+ posix: {
16
+ node: [
17
+ "node"
18
+ ],
19
+ npm: [
20
+ "npm"
21
+ ]
22
+ }
23
+ };
24
+ module.exports = function checkMissing(dest, options, callback) {
25
+ var platform = options.platform || process.platform;
26
+ var files = PLATFORM_FILES[platform] || PLATFORM_FILES.posix;
27
+ var binPath = platform === "win32" ? dest : path.join(dest, "bin");
28
+ fs.readdir(binPath, function(err, names) {
29
+ if (err || !names.length) return callback(null, keys(files));
30
+ var missing = [];
31
+ for(var key in files){
32
+ var needed = files[key];
33
+ for(var index = 0; index < needed.length; index++){
34
+ if (!~names.indexOf(needed[index])) {
35
+ missing.push(key);
36
+ break;
37
+ }
38
+ }
39
+ }
40
+ return callback(null, missing);
41
+ });
42
+ };
43
+
44
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
45
+ Object.defineProperty(exports.default, '__esModule', { value: true });
46
+ for (var key in exports) exports.default[key] = exports[key];
47
+ module.exports = exports.default;
48
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["checkMissing.js"],"sourcesContent":["var path = require('path');\nvar fs = require('fs');\nvar keys = require('lodash.keys');\n\nvar PLATFORM_FILES = {\n win32: {\n node: ['node.exe'],\n npm: ['npm', 'npm.cmd'],\n },\n posix: {\n node: ['node'],\n npm: ['npm'],\n },\n};\n\nmodule.exports = function checkMissing(dest, options, callback) {\n var platform = options.platform || process.platform;\n var files = PLATFORM_FILES[platform] || PLATFORM_FILES.posix;\n var binPath = platform === 'win32' ? dest : path.join(dest, 'bin');\n\n fs.readdir(binPath, (err, names) => {\n if (err || !names.length) return callback(null, keys(files));\n\n var missing = [];\n for (var key in files) {\n var needed = files[key];\n for (var index = 0; index < needed.length; index++) {\n if (!~names.indexOf(needed[index])) {\n missing.push(key);\n break;\n }\n }\n }\n return callback(null, missing);\n });\n};\n"],"names":["path","require","fs","keys","PLATFORM_FILES","win32","node","npm","posix","module","exports","checkMissing","dest","options","callback","platform","process","files","binPath","join","readdir","err","names","length","missing","key","needed","index","indexOf","push"],"mappings":";AAAA,IAAIA,OAAOC,QAAQ;AACnB,IAAIC,KAAKD,QAAQ;AACjB,IAAIE,OAAOF,QAAQ;AAEnB,IAAIG,iBAAiB;IACnBC,OAAO;QACLC,MAAM;YAAC;SAAW;QAClBC,KAAK;YAAC;YAAO;SAAU;IACzB;IACAC,OAAO;QACLF,MAAM;YAAC;SAAO;QACdC,KAAK;YAAC;SAAM;IACd;AACF;AAEAE,OAAOC,OAAO,GAAG,SAASC,aAAaC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC5D,IAAIC,WAAWF,QAAQE,QAAQ,IAAIC,QAAQD,QAAQ;IACnD,IAAIE,QAAQb,cAAc,CAACW,SAAS,IAAIX,eAAeI,KAAK;IAC5D,IAAIU,UAAUH,aAAa,UAAUH,OAAOZ,KAAKmB,IAAI,CAACP,MAAM;IAE5DV,GAAGkB,OAAO,CAACF,SAAS,SAACG,KAAKC;QACxB,IAAID,OAAO,CAACC,MAAMC,MAAM,EAAE,OAAOT,SAAS,MAAMX,KAAKc;QAErD,IAAIO,UAAU,EAAE;QAChB,IAAK,IAAIC,OAAOR,MAAO;YACrB,IAAIS,SAAST,KAAK,CAACQ,IAAI;YACvB,IAAK,IAAIE,QAAQ,GAAGA,QAAQD,OAAOH,MAAM,EAAEI,QAAS;gBAClD,IAAI,CAAC,CAACL,MAAMM,OAAO,CAACF,MAAM,CAACC,MAAM,GAAG;oBAClCH,QAAQK,IAAI,CAACJ;oBACb;gBACF;YACF;QACF;QACA,OAAOX,SAAS,MAAMU;IACxB;AACF"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var path = require("path");
3
+ var get = require("get-remote");
4
+ var access = require("fs-access-compat");
5
+ var progress = require("./progress");
6
+ var ensureDestinationParent = require("./ensureDestinationParent");
7
+ module.exports = function conditionalCache(endpoint, dest, options, callback) {
8
+ if (typeof options === "function") {
9
+ callback = options;
10
+ options = null;
11
+ }
12
+ options = options || {};
13
+ access(dest, function(err) {
14
+ if (!err) return callback(); // already exists
15
+ ensureDestinationParent(dest, function(err) {
16
+ if (err) return callback(err);
17
+ // TODO: do I need assign?
18
+ get(endpoint, Object.assign({
19
+ filename: path.basename(dest),
20
+ progress: progress,
21
+ time: 1000
22
+ }, options)).file(path.dirname(dest), function(err) {
23
+ console.log("");
24
+ callback(err);
25
+ });
26
+ });
27
+ });
28
+ };
29
+
30
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
31
+ Object.defineProperty(exports.default, '__esModule', { value: true });
32
+ for (var key in exports) exports.default[key] = exports[key];
33
+ module.exports = exports.default;
34
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["conditionalCache.js"],"sourcesContent":["var path = require('path');\nvar get = require('get-remote');\nvar access = require('fs-access-compat');\n\nvar progress = require('./progress');\nvar ensureDestinationParent = require('./ensureDestinationParent');\n\nmodule.exports = function conditionalCache(endpoint, dest, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n\n access(dest, (err) => {\n if (!err) return callback(); // already exists\n\n ensureDestinationParent(dest, (err) => {\n if (err) return callback(err);\n\n // TODO: do I need assign?\n get(endpoint, Object.assign({ filename: path.basename(dest), progress: progress, time: 1000 }, options)).file(path.dirname(dest), (err) => {\n console.log('');\n callback(err);\n });\n });\n });\n};\n"],"names":["path","require","get","access","progress","ensureDestinationParent","module","exports","conditionalCache","endpoint","dest","options","callback","err","Object","assign","filename","basename","time","file","dirname","console","log"],"mappings":";AAAA,IAAIA,OAAOC,QAAQ;AACnB,IAAIC,MAAMD,QAAQ;AAClB,IAAIE,SAASF,QAAQ;AAErB,IAAIG,WAAWH,QAAQ;AACvB,IAAII,0BAA0BJ,QAAQ;AAEtCK,OAAOC,OAAO,GAAG,SAASC,iBAAiBC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC1E,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IAEtBR,OAAOO,MAAM,SAACG;QACZ,IAAI,CAACA,KAAK,OAAOD,YAAY,iBAAiB;QAE9CP,wBAAwBK,MAAM,SAACG;YAC7B,IAAIA,KAAK,OAAOD,SAASC;YAEzB,0BAA0B;YAC1BX,IAAIO,UAAUK,OAAOC,MAAM,CAAC;gBAAEC,UAAUhB,KAAKiB,QAAQ,CAACP;gBAAON,UAAUA;gBAAUc,MAAM;YAAK,GAAGP,UAAUQ,IAAI,CAACnB,KAAKoB,OAAO,CAACV,OAAO,SAACG;gBACjIQ,QAAQC,GAAG,CAAC;gBACZV,SAASC;YACX;QACF;IACF;AACF"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var access = require("fs-access-compat");
3
+ var copyFile = require("./copyFile");
4
+ var ensureDestinationParent = require("./ensureDestinationParent");
5
+ module.exports = function conditionalCopy(src, dest, optional, callback) {
6
+ if (typeof optional === "function") {
7
+ callback = optional;
8
+ optional = false;
9
+ }
10
+ access(dest, function(err) {
11
+ if (!err) return callback(); // already exists
12
+ ensureDestinationParent(dest, function(err) {
13
+ if (err) return callback(err);
14
+ if (!optional) return copyFile(src, dest, callback);
15
+ access(src, function(err) {
16
+ if (err) return callback(); // optional file missing
17
+ copyFile(src, dest, callback);
18
+ });
19
+ });
20
+ });
21
+ };
22
+
23
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
24
+ Object.defineProperty(exports.default, '__esModule', { value: true });
25
+ for (var key in exports) exports.default[key] = exports[key];
26
+ module.exports = exports.default;
27
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["conditionalCopy.js"],"sourcesContent":["var access = require('fs-access-compat');\n\nvar copyFile = require('./copyFile');\nvar ensureDestinationParent = require('./ensureDestinationParent');\n\nmodule.exports = function conditionalCopy(src, dest, optional, callback) {\n if (typeof optional === 'function') {\n callback = optional;\n optional = false;\n }\n\n access(dest, (err) => {\n if (!err) return callback(); // already exists\n\n ensureDestinationParent(dest, (err) => {\n if (err) return callback(err);\n if (!optional) return copyFile(src, dest, callback);\n\n access(src, (err) => {\n if (err) return callback(); // optional file missing\n copyFile(src, dest, callback);\n });\n });\n });\n};\n"],"names":["access","require","copyFile","ensureDestinationParent","module","exports","conditionalCopy","src","dest","optional","callback","err"],"mappings":";AAAA,IAAIA,SAASC,QAAQ;AAErB,IAAIC,WAAWD,QAAQ;AACvB,IAAIE,0BAA0BF,QAAQ;AAEtCG,OAAOC,OAAO,GAAG,SAASC,gBAAgBC,GAAG,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ;IACrE,IAAI,OAAOD,aAAa,YAAY;QAClCC,WAAWD;QACXA,WAAW;IACb;IAEAT,OAAOQ,MAAM,SAACG;QACZ,IAAI,CAACA,KAAK,OAAOD,YAAY,iBAAiB;QAE9CP,wBAAwBK,MAAM,SAACG;YAC7B,IAAIA,KAAK,OAAOD,SAASC;YACzB,IAAI,CAACF,UAAU,OAAOP,SAASK,KAAKC,MAAME;YAE1CV,OAAOO,KAAK,SAACI;gBACX,IAAIA,KAAK,OAAOD,YAAY,wBAAwB;gBACpDR,SAASK,KAAKC,MAAME;YACtB;QACF;IACF;AACF"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var path = require("path");
3
+ var extract = require("fast-extract");
4
+ var mkpath = require("mkpath");
5
+ var access = require("fs-access-compat");
6
+ var progress = require("./progress");
7
+ module.exports = function conditionalExtract(src, dest, options, callback) {
8
+ if (typeof options === "function") {
9
+ callback = options;
10
+ options = null;
11
+ }
12
+ options = options || {};
13
+ access(dest, function(err) {
14
+ if (!err) return callback(); // already exists
15
+ mkpath(path.dirname(dest), function() {
16
+ var extractOptions = Object.assign({
17
+ strip: 1,
18
+ progress: progress,
19
+ time: 1000
20
+ }, options);
21
+ extract(src, dest, extractOptions, function(err) {
22
+ console.log("");
23
+ callback(err);
24
+ });
25
+ });
26
+ });
27
+ };
28
+
29
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
30
+ Object.defineProperty(exports.default, '__esModule', { value: true });
31
+ for (var key in exports) exports.default[key] = exports[key];
32
+ module.exports = exports.default;
33
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["conditionalExtract.js"],"sourcesContent":["var path = require('path');\nvar extract = require('fast-extract');\nvar mkpath = require('mkpath');\nvar access = require('fs-access-compat');\n\nvar progress = require('./progress');\n\nmodule.exports = function conditionalExtract(src, dest, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n\n access(dest, (err) => {\n if (!err) return callback(); // already exists\n\n mkpath(path.dirname(dest), () => {\n var extractOptions = Object.assign({ strip: 1, progress: progress, time: 1000 }, options);\n\n extract(src, dest, extractOptions, (err) => {\n console.log('');\n callback(err);\n });\n });\n });\n};\n"],"names":["path","require","extract","mkpath","access","progress","module","exports","conditionalExtract","src","dest","options","callback","err","dirname","extractOptions","Object","assign","strip","time","console","log"],"mappings":";AAAA,IAAIA,OAAOC,QAAQ;AACnB,IAAIC,UAAUD,QAAQ;AACtB,IAAIE,SAASF,QAAQ;AACrB,IAAIG,SAASH,QAAQ;AAErB,IAAII,WAAWJ,QAAQ;AAEvBK,OAAOC,OAAO,GAAG,SAASC,mBAAmBC,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACvE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IAEtBP,OAAOM,MAAM,SAACG;QACZ,IAAI,CAACA,KAAK,OAAOD,YAAY,iBAAiB;QAE9CT,OAAOH,KAAKc,OAAO,CAACJ,OAAO;YACzB,IAAIK,iBAAiBC,OAAOC,MAAM,CAAC;gBAAEC,OAAO;gBAAGb,UAAUA;gBAAUc,MAAM;YAAK,GAAGR;YAEjFT,QAAQO,KAAKC,MAAMK,gBAAgB,SAACF;gBAClCO,QAAQC,GAAG,CAAC;gBACZT,SAASC;YACX;QACF;IACF;AACF"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var fs = require("fs");
3
+ var rimraf = require("rimraf");
4
+ var pump = require("pump");
5
+ var Queue = require("queue-cb");
6
+ var ensureDestinationParent = require("./ensureDestinationParent");
7
+ function streamCopyFile(src, dest, callback) {
8
+ fs.stat(src, function(err) {
9
+ if (err) return callback(err);
10
+ pump(fs.createReadStream(src), fs.createWriteStream(dest), callback);
11
+ });
12
+ }
13
+ var copyFile = fs.copyFile || streamCopyFile;
14
+ module.exports = function safeCopyFile(src, dest, callback) {
15
+ var queue = new Queue(1);
16
+ queue.defer(ensureDestinationParent.bind(null, dest));
17
+ queue.defer(function(callback) {
18
+ rimraf(dest, function(err) {
19
+ err && err.code !== "EEXIST" ? callback(err) : callback();
20
+ });
21
+ });
22
+ queue.defer(copyFile.bind(null, src, dest));
23
+ queue.await(callback);
24
+ };
25
+
26
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
27
+ Object.defineProperty(exports.default, '__esModule', { value: true });
28
+ for (var key in exports) exports.default[key] = exports[key];
29
+ module.exports = exports.default;
30
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["copyFile.js"],"sourcesContent":["var fs = require('fs');\nvar rimraf = require('rimraf');\nvar pump = require('pump');\nvar Queue = require('queue-cb');\n\nvar ensureDestinationParent = require('./ensureDestinationParent');\n\nfunction streamCopyFile(src, dest, callback) {\n fs.stat(src, (err) => {\n if (err) return callback(err);\n pump(fs.createReadStream(src), fs.createWriteStream(dest), callback);\n });\n}\n\nvar copyFile = fs.copyFile || streamCopyFile;\n\nmodule.exports = function safeCopyFile(src, dest, callback) {\n var queue = new Queue(1);\n\n queue.defer(ensureDestinationParent.bind(null, dest));\n queue.defer((callback) => {\n rimraf(dest, (err) => {\n err && err.code !== 'EEXIST' ? callback(err) : callback();\n });\n });\n queue.defer(copyFile.bind(null, src, dest));\n queue.await(callback);\n};\n"],"names":["fs","require","rimraf","pump","Queue","ensureDestinationParent","streamCopyFile","src","dest","callback","stat","err","createReadStream","createWriteStream","copyFile","module","exports","safeCopyFile","queue","defer","bind","code","await"],"mappings":";AAAA,IAAIA,KAAKC,QAAQ;AACjB,IAAIC,SAASD,QAAQ;AACrB,IAAIE,OAAOF,QAAQ;AACnB,IAAIG,QAAQH,QAAQ;AAEpB,IAAII,0BAA0BJ,QAAQ;AAEtC,SAASK,eAAeC,GAAG,EAAEC,IAAI,EAAEC,QAAQ;IACzCT,GAAGU,IAAI,CAACH,KAAK,SAACI;QACZ,IAAIA,KAAK,OAAOF,SAASE;QACzBR,KAAKH,GAAGY,gBAAgB,CAACL,MAAMP,GAAGa,iBAAiB,CAACL,OAAOC;IAC7D;AACF;AAEA,IAAIK,WAAWd,GAAGc,QAAQ,IAAIR;AAE9BS,OAAOC,OAAO,GAAG,SAASC,aAAaV,GAAG,EAAEC,IAAI,EAAEC,QAAQ;IACxD,IAAIS,QAAQ,IAAId,MAAM;IAEtBc,MAAMC,KAAK,CAACd,wBAAwBe,IAAI,CAAC,MAAMZ;IAC/CU,MAAMC,KAAK,CAAC,SAACV;QACXP,OAAOM,MAAM,SAACG;YACZA,OAAOA,IAAIU,IAAI,KAAK,WAAWZ,SAASE,OAAOF;QACjD;IACF;IACAS,MAAMC,KAAK,CAACL,SAASM,IAAI,CAAC,MAAMb,KAAKC;IACrCU,MAAMI,KAAK,CAACb;AACd"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var isArray = require("isarray");
3
+ var endsWith = require("end-with");
4
+ module.exports = function endsWithFn(endings) {
5
+ if (!isArray(endings)) endings = [
6
+ endings
7
+ ];
8
+ return function(string) {
9
+ for(var index = 0; index < endings.length; index++){
10
+ if (endsWith(string, endings[index])) return true;
11
+ }
12
+ return false;
13
+ };
14
+ };
15
+
16
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
17
+ Object.defineProperty(exports.default, '__esModule', { value: true });
18
+ for (var key in exports) exports.default[key] = exports[key];
19
+ module.exports = exports.default;
20
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["endsWithFn.js"],"sourcesContent":["var isArray = require('isarray');\nvar endsWith = require('end-with');\n\nmodule.exports = function endsWithFn(endings) {\n if (!isArray(endings)) endings = [endings];\n return (string) => {\n for (var index = 0; index < endings.length; index++) {\n if (endsWith(string, endings[index])) return true;\n }\n return false;\n };\n};\n"],"names":["isArray","require","endsWith","module","exports","endsWithFn","endings","string","index","length"],"mappings":";AAAA,IAAIA,UAAUC,QAAQ;AACtB,IAAIC,WAAWD,QAAQ;AAEvBE,OAAOC,OAAO,GAAG,SAASC,WAAWC,OAAO;IAC1C,IAAI,CAACN,QAAQM,UAAUA,UAAU;QAACA;KAAQ;IAC1C,OAAO,SAACC;QACN,IAAK,IAAIC,QAAQ,GAAGA,QAAQF,QAAQG,MAAM,EAAED,QAAS;YACnD,IAAIN,SAASK,QAAQD,OAAO,CAACE,MAAM,GAAG,OAAO;QAC/C;QACA,OAAO;IACT;AACF"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var path = require("path");
3
+ var mkpath = require("mkpath");
4
+ module.exports = function ensureDestinationParent(dest, callback) {
5
+ var parent = path.dirname(dest);
6
+ if (parent === "." || parent === "/") return callback();
7
+ mkpath(parent, function(err) {
8
+ callback(err);
9
+ });
10
+ };
11
+
12
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
13
+ Object.defineProperty(exports.default, '__esModule', { value: true });
14
+ for (var key in exports) exports.default[key] = exports[key];
15
+ module.exports = exports.default;
16
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["ensureDestinationParent.js"],"sourcesContent":["var path = require('path');\nvar mkpath = require('mkpath');\n\nmodule.exports = function ensureDestinationParent(dest, callback) {\n var parent = path.dirname(dest);\n if (parent === '.' || parent === '/') return callback();\n mkpath(parent, (err) => {\n callback(err);\n });\n};\n"],"names":["path","require","mkpath","module","exports","ensureDestinationParent","dest","callback","parent","dirname","err"],"mappings":";AAAA,IAAIA,OAAOC,QAAQ;AACnB,IAAIC,SAASD,QAAQ;AAErBE,OAAOC,OAAO,GAAG,SAASC,wBAAwBC,IAAI,EAAEC,QAAQ;IAC9D,IAAIC,SAASR,KAAKS,OAAO,CAACH;IAC1B,IAAIE,WAAW,OAAOA,WAAW,KAAK,OAAOD;IAC7CL,OAAOM,QAAQ,SAACE;QACdH,SAASG;IACX;AACF"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ require("./polyfills");
3
+ var install = require("./install");
4
+ function installRelease(versionDetails, dest, options, callback) {
5
+ if (typeof options === "function") {
6
+ callback = options;
7
+ options = null;
8
+ }
9
+ options = options || {};
10
+ if (typeof callback === "function") return install(versionDetails, dest, options, callback);
11
+ return new Promise(function(resolve, reject) {
12
+ installRelease(versionDetails, dest, options, function installCallback(err, result) {
13
+ err ? reject(err) : resolve(result);
14
+ });
15
+ });
16
+ }
17
+ module.exports = installRelease;
18
+
19
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
20
+ Object.defineProperty(exports.default, '__esModule', { value: true });
21
+ for (var key in exports) exports.default[key] = exports[key];
22
+ module.exports = exports.default;
23
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["require('./polyfills');\nvar install = require('./install');\n\nfunction installRelease(versionDetails, dest, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n\n if (typeof callback === 'function') return install(versionDetails, dest, options, callback);\n return new Promise((resolve, reject) => {\n installRelease(versionDetails, dest, options, function installCallback(err, result) {\n err ? reject(err) : resolve(result);\n });\n });\n}\n\nmodule.exports = installRelease;\n"],"names":["require","install","installRelease","versionDetails","dest","options","callback","Promise","resolve","reject","installCallback","err","result","module","exports"],"mappings":";AAAAA,QAAQ;AACR,IAAIC,UAAUD,QAAQ;AAEtB,SAASE,eAAeC,cAAc,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC7D,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IAEtB,IAAI,OAAOC,aAAa,YAAY,OAAOL,QAAQE,gBAAgBC,MAAMC,SAASC;IAClF,OAAO,IAAIC,QAAQ,SAACC,SAASC;QAC3BP,eAAeC,gBAAgBC,MAAMC,SAAS,SAASK,gBAAgBC,GAAG,EAAEC,MAAM;YAChFD,MAAMF,OAAOE,OAAOH,QAAQI;QAC9B;IACF;AACF;AAEAC,OAAOC,OAAO,GAAGZ"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var path = require("path");
3
+ var Queue = require("queue-cb");
4
+ var mkpath = require("mkpath");
5
+ var resolveVersions = require("node-resolve-versions");
6
+ var installVersion = require("./installVersion");
7
+ var NIR_DIR = path.join(require("osenv").home(), ".nir");
8
+ var DEFAULT_OPTIONS = {
9
+ cacheDirectory: path.join(NIR_DIR, "cache"),
10
+ buildDirectory: path.join(NIR_DIR, "build"),
11
+ downloadURL: function downloadURL(relativePath) {
12
+ return "https://nodejs.org/dist/".concat(relativePath);
13
+ }
14
+ };
15
+ module.exports = function install(versionDetails, dest, options, callback) {
16
+ options = Object.assign({}, DEFAULT_OPTIONS, options, {
17
+ path: "raw"
18
+ });
19
+ resolveVersions(versionDetails, options, function(err, versions) {
20
+ if (err) return callback(err);
21
+ if (!versions.length) return callback(new Error("Could not resolve versions for: ".concat(JSON.stringify(versionDetails))));
22
+ var results = [];
23
+ var queue = new Queue(1);
24
+ queue.defer(function(callback) {
25
+ mkpath(options.cacheDirectory, callback.bind(null, null));
26
+ });
27
+ for(var index = 0; index < versions.length; index++){
28
+ (function(version) {
29
+ queue.defer(function(callback) {
30
+ var installDirectory = dest && versions.length > 1 ? path.join(dest, version.version) : dest;
31
+ installVersion(version, installDirectory, options, function(err, fullPath) {
32
+ if (err) return callback(err);
33
+ results.push({
34
+ version: version.version,
35
+ error: err,
36
+ fullPath: fullPath
37
+ });
38
+ callback();
39
+ });
40
+ });
41
+ })(versions[index]);
42
+ }
43
+ queue.await(function(err) {
44
+ err ? callback(err) : callback(null, results);
45
+ });
46
+ });
47
+ };
48
+
49
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
50
+ Object.defineProperty(exports.default, '__esModule', { value: true });
51
+ for (var key in exports) exports.default[key] = exports[key];
52
+ module.exports = exports.default;
53
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["install.js"],"sourcesContent":["var path = require('path');\nvar Queue = require('queue-cb');\nvar mkpath = require('mkpath');\n\nvar resolveVersions = require('node-resolve-versions');\n\nvar installVersion = require('./installVersion');\n\nvar NIR_DIR = path.join(require('osenv').home(), '.nir');\nvar DEFAULT_OPTIONS = {\n cacheDirectory: path.join(NIR_DIR, 'cache'),\n buildDirectory: path.join(NIR_DIR, 'build'),\n downloadURL: function downloadURL(relativePath) {\n return `https://nodejs.org/dist/${relativePath}`;\n },\n};\n\nmodule.exports = function install(versionDetails, dest, options, callback) {\n options = Object.assign({}, DEFAULT_OPTIONS, options, { path: 'raw' });\n resolveVersions(versionDetails, options, (err, versions) => {\n if (err) return callback(err);\n if (!versions.length) return callback(new Error(`Could not resolve versions for: ${JSON.stringify(versionDetails)}`));\n\n var results = [];\n var queue = new Queue(1);\n queue.defer((callback) => {\n mkpath(options.cacheDirectory, callback.bind(null, null));\n });\n for (var index = 0; index < versions.length; index++) {\n ((version) => {\n queue.defer((callback) => {\n var installDirectory = dest && versions.length > 1 ? path.join(dest, version.version) : dest;\n installVersion(version, installDirectory, options, (err, fullPath) => {\n if (err) return callback(err);\n results.push({ version: version.version, error: err, fullPath: fullPath });\n callback();\n });\n });\n })(versions[index]);\n }\n queue.await((err) => {\n err ? callback(err) : callback(null, results);\n });\n });\n};\n"],"names":["path","require","Queue","mkpath","resolveVersions","installVersion","NIR_DIR","join","home","DEFAULT_OPTIONS","cacheDirectory","buildDirectory","downloadURL","relativePath","module","exports","install","versionDetails","dest","options","callback","Object","assign","err","versions","length","Error","JSON","stringify","results","queue","defer","bind","index","version","installDirectory","fullPath","push","error","await"],"mappings":";AAAA,IAAIA,OAAOC,QAAQ;AACnB,IAAIC,QAAQD,QAAQ;AACpB,IAAIE,SAASF,QAAQ;AAErB,IAAIG,kBAAkBH,QAAQ;AAE9B,IAAII,iBAAiBJ,QAAQ;AAE7B,IAAIK,UAAUN,KAAKO,IAAI,CAACN,QAAQ,SAASO,IAAI,IAAI;AACjD,IAAIC,kBAAkB;IACpBC,gBAAgBV,KAAKO,IAAI,CAACD,SAAS;IACnCK,gBAAgBX,KAAKO,IAAI,CAACD,SAAS;IACnCM,aAAa,SAASA,YAAYC,YAAY;QAC5C,OAAO,AAAC,2BAAuC,OAAbA;IACpC;AACF;AAEAC,OAAOC,OAAO,GAAG,SAASC,QAAQC,cAAc,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACvED,UAAUE,OAAOC,MAAM,CAAC,CAAC,GAAGb,iBAAiBU,SAAS;QAAEnB,MAAM;IAAM;IACpEI,gBAAgBa,gBAAgBE,SAAS,SAACI,KAAKC;QAC7C,IAAID,KAAK,OAAOH,SAASG;QACzB,IAAI,CAACC,SAASC,MAAM,EAAE,OAAOL,SAAS,IAAIM,MAAM,AAAC,mCAAiE,OAA/BC,KAAKC,SAAS,CAACX;QAElG,IAAIY,UAAU,EAAE;QAChB,IAAIC,QAAQ,IAAI5B,MAAM;QACtB4B,MAAMC,KAAK,CAAC,SAACX;YACXjB,OAAOgB,QAAQT,cAAc,EAAEU,SAASY,IAAI,CAAC,MAAM;QACrD;QACA,IAAK,IAAIC,QAAQ,GAAGA,QAAQT,SAASC,MAAM,EAAEQ,QAAS;YACnD,CAAA,SAACC;gBACAJ,MAAMC,KAAK,CAAC,SAACX;oBACX,IAAIe,mBAAmBjB,QAAQM,SAASC,MAAM,GAAG,IAAIzB,KAAKO,IAAI,CAACW,MAAMgB,QAAQA,OAAO,IAAIhB;oBACxFb,eAAe6B,SAASC,kBAAkBhB,SAAS,SAACI,KAAKa;wBACvD,IAAIb,KAAK,OAAOH,SAASG;wBACzBM,QAAQQ,IAAI,CAAC;4BAAEH,SAASA,QAAQA,OAAO;4BAAEI,OAAOf;4BAAKa,UAAUA;wBAAS;wBACxEhB;oBACF;gBACF;YACF,CAAA,EAAGI,QAAQ,CAACS,MAAM;QACpB;QACAH,MAAMS,KAAK,CAAC,SAAChB;YACXA,MAAMH,SAASG,OAAOH,SAAS,MAAMS;QACvC;IACF;AACF"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var installBin = require("./installBin");
3
+ var installLib = require("./installLib");
4
+ module.exports = function install(version, dest, options, callback) {
5
+ installLib(version, dest, options, function(err) {
6
+ if (err) return callback(err);
7
+ installBin(version, dest, options, callback);
8
+ });
9
+ };
10
+
11
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
12
+ Object.defineProperty(exports.default, '__esModule', { value: true });
13
+ for (var key in exports) exports.default[key] = exports[key];
14
+ module.exports = exports.default;
15
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["var installBin = require('./installBin');\nvar installLib = require('./installLib');\n\nmodule.exports = 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","require","installLib","module","exports","install","version","dest","options","callback","err"],"mappings":";AAAA,IAAIA,aAAaC,QAAQ;AACzB,IAAIC,aAAaD,QAAQ;AAEzBE,OAAOC,OAAO,GAAG,SAASC,QAAQC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAChEP,WAAWI,SAASC,MAAMC,SAAS,SAACE;QAClC,IAAIA,KAAK,OAAOD,SAASC;QACzBV,WAAWM,SAASC,MAAMC,SAASC;IACrC;AACF"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var path = require("path");
3
+ var Queue = require("queue-cb");
4
+ var conditionalCopy = require("../conditionalCopy");
5
+ var PLATFORM_FILES = {
6
+ win32: [
7
+ {
8
+ src: path.join("node_modules", "npm", "bin", "npm"),
9
+ dest: "npm"
10
+ },
11
+ {
12
+ src: path.join("node_modules", "npm", "bin", "npm.cmd"),
13
+ dest: "npm.cmd"
14
+ },
15
+ {
16
+ src: path.join("node_modules", "npm", "bin", "npx"),
17
+ dest: "npx",
18
+ optional: true
19
+ },
20
+ {
21
+ src: path.join("node_modules", "npm", "bin", "npx.cmd"),
22
+ dest: "npx.cmd",
23
+ optional: true
24
+ }
25
+ ],
26
+ posix: [
27
+ {
28
+ src: path.join("node_modules", "npm", "bin", "npm-cli.js"),
29
+ dest: "npm"
30
+ },
31
+ {
32
+ src: path.join("node_modules", "npm", "bin", "npx-cli.js"),
33
+ dest: "npx",
34
+ optional: true
35
+ }
36
+ ]
37
+ };
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];
46
+ queue.defer(conditionalCopy.bind(null, path.join(libPath, file.src), path.join(binPath, file.dest), file.optional));
47
+ }
48
+ queue.await(callback);
49
+ };
50
+
51
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
52
+ Object.defineProperty(exports.default, '__esModule', { value: true });
53
+ for (var key in exports) exports.default[key] = exports[key];
54
+ module.exports = exports.default;
55
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["installBin.js"],"sourcesContent":["var path = require('path');\nvar Queue = require('queue-cb');\nvar conditionalCopy = require('../conditionalCopy');\n\nvar 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\nmodule.exports = function installBin(_version, dest, options, callback) {\n var platform = options.platform || process.platform;\n var libPath = platform === 'win32' ? dest : path.join(dest, 'lib');\n var binPath = platform === 'win32' ? dest : path.join(dest, 'bin');\n\n var queue = new Queue();\n var files = PLATFORM_FILES[platform] || PLATFORM_FILES.posix;\n for (var index = 0; index < files.length; index++) {\n var 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","require","Queue","conditionalCopy","PLATFORM_FILES","win32","src","join","dest","optional","posix","module","exports","installBin","_version","options","callback","platform","process","libPath","binPath","queue","files","index","length","file","defer","bind","await"],"mappings":";AAAA,IAAIA,OAAOC,QAAQ;AACnB,IAAIC,QAAQD,QAAQ;AACpB,IAAIE,kBAAkBF,QAAQ;AAE9B,IAAIG,iBAAiB;IACnBC,OAAO;QACL;YAAEC,KAAKN,KAAKO,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAQC,MAAM;QAAM;QACnE;YAAEF,KAAKN,KAAKO,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAYC,MAAM;QAAU;QAC3E;YAAEF,KAAKN,KAAKO,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAQC,MAAM;YAAOC,UAAU;QAAK;QACnF;YAAEH,KAAKN,KAAKO,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAYC,MAAM;YAAWC,UAAU;QAAK;KAC5F;IACDC,OAAO;QACL;YAAEJ,KAAKN,KAAKO,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAeC,MAAM;QAAM;QAC1E;YAAEF,KAAKN,KAAKO,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAeC,MAAM;YAAOC,UAAU;QAAK;KAC3F;AACH;AAEAE,OAAOC,OAAO,GAAG,SAASC,WAAWC,QAAQ,EAAEN,IAAI,EAAEO,OAAO,EAAEC,QAAQ;IACpE,IAAIC,WAAWF,QAAQE,QAAQ,IAAIC,QAAQD,QAAQ;IACnD,IAAIE,UAAUF,aAAa,UAAUT,OAAOR,KAAKO,IAAI,CAACC,MAAM;IAC5D,IAAIY,UAAUH,aAAa,UAAUT,OAAOR,KAAKO,IAAI,CAACC,MAAM;IAE5D,IAAIa,QAAQ,IAAInB;IAChB,IAAIoB,QAAQlB,cAAc,CAACa,SAAS,IAAIb,eAAeM,KAAK;IAC5D,IAAK,IAAIa,QAAQ,GAAGA,QAAQD,MAAME,MAAM,EAAED,QAAS;QACjD,IAAIE,OAAOH,KAAK,CAACC,MAAM;QACvBF,MAAMK,KAAK,CAACvB,gBAAgBwB,IAAI,CAAC,MAAM3B,KAAKO,IAAI,CAACY,SAASM,KAAKnB,GAAG,GAAGN,KAAKO,IAAI,CAACa,SAASK,KAAKjB,IAAI,GAAGiB,KAAKhB,QAAQ;IACnH;IAEAY,MAAMO,KAAK,CAACZ;AACd"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var path = require("path");
3
+ var get = require("get-remote");
4
+ var conditionalCache = require("../conditionalCache");
5
+ var conditionalExtract = require("../conditionalExtract");
6
+ var NODE_DIST_URL = "https://nodejs.org/dist/index.json";
7
+ var NPM_DIST_TAGS_URL = "https://registry.npmjs.org/-/package/npm/dist-tags";
8
+ var NPM_DIST_URL = "https://registry.npmjs.org/npm";
9
+ var NPM_MIN_VERSION = 3;
10
+ module.exports = function installLib(version, dest, options, callback) {
11
+ var platform = options.platform || process.platform;
12
+ var libPath = platform === "win32" ? dest : path.join(dest, "lib");
13
+ var installPath = path.join(libPath, "node_modules", "npm");
14
+ get(NODE_DIST_URL).json(function(err, res1) {
15
+ if (err) return callback(err);
16
+ var releases = res1.body;
17
+ var found = releases.find(function(record) {
18
+ return record.version === version.version;
19
+ });
20
+ var npmMajorPair = (found === null || found === void 0 ? void 0 : found.npm) ? +found.npm.split(".")[0] : NPM_MIN_VERSION;
21
+ var npmMajor = Math.max(npmMajorPair, NPM_MIN_VERSION);
22
+ get(NPM_DIST_TAGS_URL).json(function(err, res2) {
23
+ if (err) return callback(err);
24
+ var distTags = res2.body;
25
+ var installVersion = distTags["latest-".concat(npmMajor)] || distTags["next-".concat(npmMajor)] || distTags.latest;
26
+ var downloadPath = "".concat(NPM_DIST_URL, "/-/npm-").concat(installVersion, ".tgz");
27
+ var cachePath = path.join(options.cacheDirectory, path.basename(downloadPath));
28
+ conditionalCache(downloadPath, cachePath, function(err) {
29
+ if (err) return callback(err);
30
+ conditionalExtract(cachePath, installPath, callback);
31
+ });
32
+ });
33
+ });
34
+ };
35
+
36
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
37
+ Object.defineProperty(exports.default, '__esModule', { value: true });
38
+ for (var key in exports) exports.default[key] = exports[key];
39
+ module.exports = exports.default;
40
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["installLib.js"],"sourcesContent":["var path = require('path');\nvar get = require('get-remote');\n\nvar conditionalCache = require('../conditionalCache');\nvar conditionalExtract = require('../conditionalExtract');\n\nvar NODE_DIST_URL = 'https://nodejs.org/dist/index.json';\nvar NPM_DIST_TAGS_URL = 'https://registry.npmjs.org/-/package/npm/dist-tags';\nvar NPM_DIST_URL = 'https://registry.npmjs.org/npm';\nvar NPM_MIN_VERSION = 3;\n\nmodule.exports = function installLib(version, dest, options, callback) {\n var platform = options.platform || process.platform;\n var libPath = platform === 'win32' ? dest : path.join(dest, 'lib');\n var installPath = path.join(libPath, 'node_modules', 'npm');\n\n get(NODE_DIST_URL).json((err, res1) => {\n if (err) return callback(err);\n var releases = res1.body;\n\n var found = releases.find((record) => record.version === version.version);\n var npmMajorPair = found?.npm ? +found.npm.split('.')[0] : NPM_MIN_VERSION;\n var npmMajor = Math.max(npmMajorPair, NPM_MIN_VERSION);\n\n get(NPM_DIST_TAGS_URL).json((err, res2) => {\n if (err) return callback(err);\n var distTags = res2.body;\n var installVersion = distTags[`latest-${npmMajor}`] || distTags[`next-${npmMajor}`] || distTags.latest;\n var downloadPath = `${NPM_DIST_URL}/-/npm-${installVersion}.tgz`;\n var cachePath = path.join(options.cacheDirectory, 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","require","get","conditionalCache","conditionalExtract","NODE_DIST_URL","NPM_DIST_TAGS_URL","NPM_DIST_URL","NPM_MIN_VERSION","module","exports","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","cacheDirectory","basename"],"mappings":";AAAA,IAAIA,OAAOC,QAAQ;AACnB,IAAIC,MAAMD,QAAQ;AAElB,IAAIE,mBAAmBF,QAAQ;AAC/B,IAAIG,qBAAqBH,QAAQ;AAEjC,IAAII,gBAAgB;AACpB,IAAIC,oBAAoB;AACxB,IAAIC,eAAe;AACnB,IAAIC,kBAAkB;AAEtBC,OAAOC,OAAO,GAAG,SAASC,WAAWC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACnE,IAAIC,WAAWF,QAAQE,QAAQ,IAAIC,QAAQD,QAAQ;IACnD,IAAIE,UAAUF,aAAa,UAAUH,OAAOb,KAAKmB,IAAI,CAACN,MAAM;IAC5D,IAAIO,cAAcpB,KAAKmB,IAAI,CAACD,SAAS,gBAAgB;IAErDhB,IAAIG,eAAegB,IAAI,CAAC,SAACC,KAAKC;QAC5B,IAAID,KAAK,OAAOP,SAASO;QACzB,IAAIE,WAAWD,KAAKE,IAAI;QAExB,IAAIC,QAAQF,SAASG,IAAI,CAAC,SAACC;mBAAWA,OAAOhB,OAAO,KAAKA,QAAQA,OAAO;;QACxE,IAAIiB,eAAeH,CAAAA,kBAAAA,4BAAAA,MAAOI,GAAG,IAAG,CAACJ,MAAMI,GAAG,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE,GAAGvB;QAC3D,IAAIwB,WAAWC,KAAKC,GAAG,CAACL,cAAcrB;QAEtCN,IAAII,mBAAmBe,IAAI,CAAC,SAACC,KAAKa;YAChC,IAAIb,KAAK,OAAOP,SAASO;YACzB,IAAIc,WAAWD,KAAKV,IAAI;YACxB,IAAIY,iBAAiBD,QAAQ,CAAC,AAAC,UAAkB,OAATJ,UAAW,IAAII,QAAQ,CAAC,AAAC,QAAgB,OAATJ,UAAW,IAAII,SAASE,MAAM;YACtG,IAAIC,eAAe,AAAC,GAAwBF,OAAtB9B,cAAa,WAAwB,OAAf8B,gBAAe;YAC3D,IAAIG,YAAYxC,KAAKmB,IAAI,CAACL,QAAQ2B,cAAc,EAAEzC,KAAK0C,QAAQ,CAACH;YAChEpC,iBAAiBoC,cAAcC,WAAW,SAAClB;gBACzC,IAAIA,KAAK,OAAOP,SAASO;gBACzBlB,mBAAmBoC,WAAWpB,aAAaL;YAC7C;QACF;IACF;AACF"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var osArch = require("os").arch || require("../arch");
3
+ var PLATFORM_OS = {
4
+ win32: "win",
5
+ darwin: "osx"
6
+ };
7
+ var PLATFORM_FILES = {
8
+ win32: [
9
+ "zip",
10
+ "exe"
11
+ ],
12
+ darwin: [
13
+ "tar"
14
+ ]
15
+ };
16
+ module.exports = function prebuiltFilenames(options) {
17
+ var platform = options.platform || process.platform;
18
+ var os = PLATFORM_OS[platform] || platform;
19
+ var archs = [
20
+ options.arch || osArch()
21
+ ];
22
+ if (platform === "darwin" && archs[0] === "arm64") archs.push("x64"); // fallback
23
+ var files = PLATFORM_FILES[platform];
24
+ var results = [];
25
+ for(var i = 0; i < archs.length; i++){
26
+ if (typeof files === "undefined") {
27
+ results.push("".concat(os, "-").concat(archs[i]));
28
+ } else {
29
+ for(var j = 0; j < files.length; j++){
30
+ results.push("".concat(os, "-").concat(archs[i], "-").concat(files[j]));
31
+ }
32
+ }
33
+ }
34
+ return results;
35
+ };
36
+
37
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
38
+ Object.defineProperty(exports.default, '__esModule', { value: true });
39
+ for (var key in exports) exports.default[key] = exports[key];
40
+ module.exports = exports.default;
41
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["filenames.js"],"sourcesContent":["var osArch = require('os').arch || require('../arch');\n\nvar PLATFORM_OS = {\n win32: 'win',\n darwin: 'osx',\n};\n\nvar PLATFORM_FILES = {\n win32: ['zip', 'exe'],\n darwin: ['tar'],\n};\n\nmodule.exports = function prebuiltFilenames(options) {\n var platform = options.platform || process.platform;\n var os = PLATFORM_OS[platform] || platform;\n var archs = [options.arch || osArch()];\n if (platform === 'darwin' && archs[0] === 'arm64') archs.push('x64'); // fallback\n\n var files = PLATFORM_FILES[platform];\n var results = [];\n for (var i = 0; i < archs.length; i++) {\n if (typeof files === 'undefined') {\n results.push(`${os}-${archs[i]}`);\n } else {\n for (var j = 0; j < files.length; j++) {\n results.push(`${os}-${archs[i]}-${files[j]}`);\n }\n }\n }\n return results;\n};\n"],"names":["osArch","require","arch","PLATFORM_OS","win32","darwin","PLATFORM_FILES","module","exports","prebuiltFilenames","options","platform","process","os","archs","push","files","results","i","length","j"],"mappings":";AAAA,IAAIA,SAASC,QAAQ,MAAMC,IAAI,IAAID,QAAQ;AAE3C,IAAIE,cAAc;IAChBC,OAAO;IACPC,QAAQ;AACV;AAEA,IAAIC,iBAAiB;IACnBF,OAAO;QAAC;QAAO;KAAM;IACrBC,QAAQ;QAAC;KAAM;AACjB;AAEAE,OAAOC,OAAO,GAAG,SAASC,kBAAkBC,OAAO;IACjD,IAAIC,WAAWD,QAAQC,QAAQ,IAAIC,QAAQD,QAAQ;IACnD,IAAIE,KAAKV,WAAW,CAACQ,SAAS,IAAIA;IAClC,IAAIG,QAAQ;QAACJ,QAAQR,IAAI,IAAIF;KAAS;IACtC,IAAIW,aAAa,YAAYG,KAAK,CAAC,EAAE,KAAK,SAASA,MAAMC,IAAI,CAAC,QAAQ,WAAW;IAEjF,IAAIC,QAAQV,cAAc,CAACK,SAAS;IACpC,IAAIM,UAAU,EAAE;IAChB,IAAK,IAAIC,IAAI,GAAGA,IAAIJ,MAAMK,MAAM,EAAED,IAAK;QACrC,IAAI,OAAOF,UAAU,aAAa;YAChCC,QAAQF,IAAI,CAAC,AAAC,GAAQD,OAAND,IAAG,KAAY,OAATC,KAAK,CAACI,EAAE;QAChC,OAAO;YACL,IAAK,IAAIE,IAAI,GAAGA,IAAIJ,MAAMG,MAAM,EAAEC,IAAK;gBACrCH,QAAQF,IAAI,CAAC,AAAC,GAAQD,OAAND,IAAG,KAAeG,OAAZF,KAAK,CAACI,EAAE,EAAC,KAAY,OAATF,KAAK,CAACI,EAAE;YAC5C;QACF;IACF;IACA,OAAOH;AACT"}