node-install-release 1.5.3 → 1.6.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.
- package/dist/cjs/archPatched.js +64 -0
- package/dist/cjs/archPatched.js.map +1 -0
- package/dist/cjs/installNode/findDistPaths.js +1 -1
- package/dist/cjs/installNode/findDistPaths.js.map +1 -1
- package/dist/cjs/installNode/prebuilds.js +1 -1
- package/dist/cjs/installNode/prebuilds.js.map +1 -1
- package/dist/types/archPatched.d.ts +2 -0
- package/package.json +1 -2
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// ****************************
|
|
2
|
+
// KM: patched to detect without making assumptions
|
|
3
|
+
// ****************************
|
|
4
|
+
/*! arch. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ "use strict";
|
|
5
|
+
var cp = require('child_process');
|
|
6
|
+
var fs = require('fs');
|
|
7
|
+
var path = require('path');
|
|
8
|
+
/**
|
|
9
|
+
* Returns the operating system's CPU architecture. This is different than
|
|
10
|
+
* `process.arch` or `os.arch()` which returns the architecture the Node.js (or
|
|
11
|
+
* Electron) binary was compiled for.
|
|
12
|
+
*/ module.exports = function arch() {
|
|
13
|
+
/**
|
|
14
|
+
* On macOS, we need to detect if x64 Node is running because the CPU is truly
|
|
15
|
+
* an Intel chip, or if it's running on Apple Silicon via Rosetta 2:
|
|
16
|
+
* https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment
|
|
17
|
+
*/ if (process.platform === 'darwin') {
|
|
18
|
+
var nativeArm = process.arch === 'arm64';
|
|
19
|
+
var rosettaArm = cp.execSync('sysctl -in sysctl.proc_translated', {
|
|
20
|
+
encoding: 'utf8'
|
|
21
|
+
}) === '1\n';
|
|
22
|
+
return nativeArm || rosettaArm ? 'arm64' : 'x64';
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* On Windows, the most reliable way to detect a 64-bit OS from within a 32-bit
|
|
26
|
+
* app is based on the presence of a WOW64 file: %SystemRoot%\SysNative.
|
|
27
|
+
* See: https://twitter.com/feross/status/776949077208510464
|
|
28
|
+
*/ if (process.platform === 'win32') {
|
|
29
|
+
var useEnv = false;
|
|
30
|
+
try {
|
|
31
|
+
useEnv = !!(process.env.SYSTEMROOT && fs.statSync(process.env.SYSTEMROOT));
|
|
32
|
+
} catch (_err) {}
|
|
33
|
+
var sysRoot = useEnv ? process.env.SYSTEMROOT : 'C:\\Windows';
|
|
34
|
+
// If %SystemRoot%\SysNative exists, we are in a WOW64 FS Redirected application.
|
|
35
|
+
var isWOW64 = false;
|
|
36
|
+
try {
|
|
37
|
+
isWOW64 = !!fs.statSync(path.join(sysRoot, 'sysnative'));
|
|
38
|
+
} catch (_err) {}
|
|
39
|
+
return isWOW64 ? 'x64' : 'x86';
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* On Linux, use the `getconf` command to get the architecture.
|
|
43
|
+
*/ if (process.platform === 'linux') {
|
|
44
|
+
var output = cp.execSync('getconf LONG_BIT', {
|
|
45
|
+
encoding: 'utf8'
|
|
46
|
+
});
|
|
47
|
+
return output === '64\n' ? 'x64' : 'x86';
|
|
48
|
+
}
|
|
49
|
+
// ****************************
|
|
50
|
+
// KM: patched to detect without making assumptions
|
|
51
|
+
// ****************************
|
|
52
|
+
/**
|
|
53
|
+
* The running binary is 64-bit, so the OS is clearly 64-bit.
|
|
54
|
+
*/ if (process.arch === 'x64') {
|
|
55
|
+
return 'x64';
|
|
56
|
+
}
|
|
57
|
+
// ****************************
|
|
58
|
+
// KM: patched to detect without making assumptions
|
|
59
|
+
// ****************************
|
|
60
|
+
/**
|
|
61
|
+
* If none of the above, assume the architecture is 32-bit.
|
|
62
|
+
*/ return 'x86';
|
|
63
|
+
};
|
|
64
|
+
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/archPatched.js"],"sourcesContent":["// ****************************\n// KM: patched to detect without making assumptions\n// ****************************\n\n/*! arch. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */\nconst cp = require('child_process');\nconst fs = require('fs');\nconst 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 const nativeArm = process.arch === 'arm64';\n const 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 let useEnv = false;\n try {\n useEnv = !!(process.env.SYSTEMROOT && fs.statSync(process.env.SYSTEMROOT));\n } catch (_err) {}\n\n const sysRoot = useEnv ? process.env.SYSTEMROOT : 'C:\\\\Windows';\n\n // If %SystemRoot%\\SysNative exists, we are in a WOW64 FS Redirected application.\n let 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 const output = cp.execSync('getconf LONG_BIT', { encoding: 'utf8' });\n return output === '64\\n' ? 'x64' : 'x86';\n }\n\n // ****************************\n // KM: patched to detect without making assumptions\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 // KM: patched to detect without making assumptions\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","output"],"mappings":"AAAA,+BAA+B;AAC/B,mDAAmD;AACnD,+BAA+B;AAE/B,2EAA2E;AAC3E,IAAMA,KAAKC,QAAQ;AACnB,IAAMC,KAAKD,QAAQ;AACnB,IAAME,OAAOF,QAAQ;AAErB;;;;CAIC,GACDG,OAAOC,OAAO,GAAG,SAASC;IACxB;;;;GAIC,GACD,IAAIC,QAAQC,QAAQ,KAAK,UAAU;QACjC,IAAMC,YAAYF,QAAQD,IAAI,KAAK;QACnC,IAAMI,aAAaV,GAAGW,QAAQ,CAAC,qCAAqC;YAAEC,UAAU;QAAO,OAAO;QAE9F,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,IAAMC,UAAUL,SAASN,QAAQO,GAAG,CAACC,UAAU,GAAG;QAElD,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,IAAMa,SAASrB,GAAGW,QAAQ,CAAC,oBAAoB;YAAEC,UAAU;QAAO;QAClE,OAAOS,WAAW,SAAS,QAAQ;IACrC;IAEA,+BAA+B;IAC/B,mDAAmD;IACnD,+BAA+B;IAE/B;;GAEC,GACD,IAAId,QAAQD,IAAI,KAAK,OAAO;QAC1B,OAAO;IACT;IACA,+BAA+B;IAC/B,mDAAmD;IACnD,+BAA+B;IAE/B;;GAEC,GACD,OAAO;AACT"}
|
|
@@ -7,7 +7,7 @@ module.exports = function findDistPaths(version, options) {
|
|
|
7
7
|
] : prebuilds(options);
|
|
8
8
|
for(var index = 0; index < filenames.length; index++){
|
|
9
9
|
var filename = filenames[index];
|
|
10
|
-
if (
|
|
10
|
+
if (version.files.indexOf(filename) < 0) continue;
|
|
11
11
|
var relativePaths = distPaths(filename, version.version);
|
|
12
12
|
if (relativePaths && relativePaths.length) return {
|
|
13
13
|
version: version.version,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/findDistPaths.js"],"sourcesContent":["const distPaths = require('node-filename-to-dist-paths');\nconst prebuilds = require('./prebuilds');\n\nmodule.exports = function findDistPaths(version, options) {\n const filenames = options.filename ? [options.filename] : prebuilds(options);\n for (let index = 0; index < filenames.length; index++) {\n const filename = filenames[index];\n if (
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/findDistPaths.js"],"sourcesContent":["const distPaths = require('node-filename-to-dist-paths');\nconst prebuilds = require('./prebuilds');\n\nmodule.exports = function findDistPaths(version, options) {\n const filenames = options.filename ? [options.filename] : prebuilds(options);\n for (let index = 0; index < filenames.length; index++) {\n const filename = filenames[index];\n if (version.files.indexOf(filename) < 0) 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","require","prebuilds","module","exports","findDistPaths","version","options","filenames","filename","index","length","files","indexOf","relativePaths"],"mappings":";AAAA,IAAMA,YAAYC,QAAQ;AAC1B,IAAMC,YAAYD,QAAQ;AAE1BE,OAAOC,OAAO,GAAG,SAASC,cAAcC,OAAO,EAAEC,OAAO;IACtD,IAAMC,YAAYD,QAAQE,QAAQ,GAAG;QAACF,QAAQE,QAAQ;KAAC,GAAGP,UAAUK;IACpE,IAAK,IAAIG,QAAQ,GAAGA,QAAQF,UAAUG,MAAM,EAAED,QAAS;QACrD,IAAMD,WAAWD,SAAS,CAACE,MAAM;QACjC,IAAIJ,QAAQM,KAAK,CAACC,OAAO,CAACJ,YAAY,GAAG;QACzC,IAAMK,gBAAgBd,UAAUS,UAAUH,QAAQA,OAAO;QACzD,IAAIQ,iBAAiBA,cAAcH,MAAM,EAAE,OAAO;YAAEL,SAASA,QAAQA,OAAO;YAAEG,UAAUA;YAAUK,eAAeA;QAAc;IACjI;IACA,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/prebuilds.js"],"sourcesContent":["const
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/prebuilds.js"],"sourcesContent":["const machineArch = require('../archPatched.js');\nconst osArch = require('os').arch;\n\nconst PLATFORM_OS = {\n win32: 'win',\n darwin: 'osx',\n};\n\nconst PLATFORM_FILES = {\n win32: ['zip', 'exe'],\n darwin: ['tar'],\n};\n\nmodule.exports = function prebuilts(options) {\n const platform = options.platform || process.platform;\n const os = PLATFORM_OS[platform] || platform;\n const archs = [machineArch()];\n if (osArch) archs.push(osArch());\n if (platform === 'darwin' && archs[0] === '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":["machineArch","require","osArch","arch","PLATFORM_OS","win32","darwin","PLATFORM_FILES","module","exports","prebuilts","options","platform","process","os","archs","push","files","results","i","length","j"],"mappings":";AAAA,IAAMA,cAAcC,QAAQ;AAC5B,IAAMC,SAASD,QAAQ,MAAME,IAAI;AAEjC,IAAMC,cAAc;IAClBC,OAAO;IACPC,QAAQ;AACV;AAEA,IAAMC,iBAAiB;IACrBF,OAAO;QAAC;QAAO;KAAM;IACrBC,QAAQ;QAAC;KAAM;AACjB;AAEAE,OAAOC,OAAO,GAAG,SAASC,UAAUC,OAAO;IACzC,IAAMC,WAAWD,QAAQC,QAAQ,IAAIC,QAAQD,QAAQ;IACrD,IAAME,KAAKV,WAAW,CAACQ,SAAS,IAAIA;IACpC,IAAMG,QAAQ;QAACf;KAAc;IAC7B,IAAIE,QAAQa,MAAMC,IAAI,CAACd;IACvB,IAAIU,aAAa,YAAYG,KAAK,CAAC,EAAE,KAAK,SAASA,MAAMC,IAAI,CAAC,QAAQ,WAAW;IAEjF,IAAMC,QAAQV,cAAc,CAACK,SAAS;IACtC,IAAMM,UAAU,EAAE;IAClB,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-install-release",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Cross-platform solution for installing releases of Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"version": "tsds version"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"arch": "^3.0.0",
|
|
37
36
|
"cross-spawn-cb": "^1.5.7",
|
|
38
37
|
"end-with": "^1.0.2",
|
|
39
38
|
"exit": "^0.1.2",
|