node-install-release 1.7.7 → 1.7.10
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/installNode/index.cjs +1 -0
- package/dist/cjs/installNode/index.cjs.map +1 -1
- package/dist/cjs/installNode/installExe.cjs +2 -1
- package/dist/cjs/installNode/installExe.cjs.map +1 -1
- package/dist/cjs/workers/install.cjs +8 -1
- package/dist/cjs/workers/install.cjs.map +1 -1
- package/dist/esm/installNode/index.mjs +1 -0
- package/dist/esm/installNode/index.mjs.map +1 -1
- package/dist/esm/installNode/installExe.mjs +2 -1
- package/dist/esm/installNode/installExe.mjs.map +1 -1
- package/dist/esm/workers/install.mjs +8 -1
- package/dist/esm/workers/install.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -42,6 +42,7 @@ function install(version, dest, options, callback) {
|
|
|
42
42
|
a
|
|
43
43
|
].concat(parts.slice(2)).join('-');
|
|
44
44
|
});
|
|
45
|
+
if (platform === 'win') filenames.push('win-x64-exe', 'win-x86-exe');
|
|
45
46
|
filenames.push('src');
|
|
46
47
|
var tryNext = function(cb) {
|
|
47
48
|
if (filenames.length === 0) return cb(new Error("Failed to find installable for ".concat(version)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/index.ts"],"sourcesContent":["import realArch from '../machine/arch.cjs';\nimport installFilename from './installFilename';\n\nconst PLATFORM_MAP = {\n win32: 'win',\n darwin: 'osx',\n};\n\nlet archMachine: NodeJS.Architecture;\nexport default function install(version, dest, options, callback) {\n if (!archMachine) archMachine = realArch() as NodeJS.Architecture;\n let platform = options.platform || process.platform;\n platform = PLATFORM_MAP[platform] || platform;\n const arch = options.arch || archMachine || process.arch;\n const parts = [platform, arch];\n if (options.type) parts.push(options.type);\n if (options.compression) parts.push(options.compression);\n\n const archs = [arch];\n if (archs.indexOf('x64') < 0) archs.push('x64');\n if (arch !== process.arch && archs.indexOf(process.arch) < 0) archs.push(process.arch);\n const filenames = archs.map((a) => [platform, a].concat(parts.slice(2)).join('-'));\n filenames.push('src');\n\n const tryNext = (cb) => {\n if (filenames.length === 0) return cb(new Error(`Failed to find installable for ${version}`));\n installFilename(filenames.shift(), version, dest, options, (err) => (err ? tryNext(cb) : cb()));\n };\n tryNext(callback);\n}\n"],"names":["install","PLATFORM_MAP","win32","darwin","archMachine","version","dest","options","callback","realArch","platform","process","arch","parts","type","push","compression","archs","indexOf","filenames","map","a","concat","slice","join","tryNext","cb","length","Error","installFilename","shift","err"],"mappings":";;;;+BASA;;;eAAwBA;;;8DATH;sEACO;;;;;;AAE5B,IAAMC,eAAe;IACnBC,OAAO;IACPC,QAAQ;AACV;AAEA,IAAIC;AACW,SAASJ,QAAQK,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC9D,IAAI,CAACJ,aAAaA,cAAcK,IAAAA,gBAAQ;IACxC,IAAIC,WAAWH,QAAQG,QAAQ,IAAIC,QAAQD,QAAQ;IACnDA,WAAWT,YAAY,CAACS,SAAS,IAAIA;IACrC,IAAME,OAAOL,QAAQK,IAAI,IAAIR,eAAeO,QAAQC,IAAI;IACxD,IAAMC,QAAQ;QAACH;QAAUE;KAAK;IAC9B,IAAIL,QAAQO,IAAI,EAAED,MAAME,IAAI,CAACR,QAAQO,IAAI;IACzC,IAAIP,QAAQS,WAAW,EAAEH,MAAME,IAAI,CAACR,QAAQS,WAAW;IAEvD,IAAMC,QAAQ;QAACL;KAAK;IACpB,IAAIK,MAAMC,OAAO,CAAC,SAAS,GAAGD,MAAMF,IAAI,CAAC;IACzC,IAAIH,SAASD,QAAQC,IAAI,IAAIK,MAAMC,OAAO,CAACP,QAAQC,IAAI,IAAI,GAAGK,MAAMF,IAAI,CAACJ,QAAQC,IAAI;IACrF,IAAMO,YAAYF,MAAMG,GAAG,CAAC,SAACC;eAAM;YAACX;YAAUW;SAAE,CAACC,MAAM,CAACT,MAAMU,KAAK,CAAC,IAAIC,IAAI,CAAC;;
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/index.ts"],"sourcesContent":["import realArch from '../machine/arch.cjs';\nimport installFilename from './installFilename';\n\nconst PLATFORM_MAP = {\n win32: 'win',\n darwin: 'osx',\n};\n\nlet archMachine: NodeJS.Architecture;\nexport default function install(version, dest, options, callback) {\n if (!archMachine) archMachine = realArch() as NodeJS.Architecture;\n let platform = options.platform || process.platform;\n platform = PLATFORM_MAP[platform] || platform;\n const arch = options.arch || archMachine || process.arch;\n const parts = [platform, arch];\n if (options.type) parts.push(options.type);\n if (options.compression) parts.push(options.compression);\n\n const archs = [arch];\n if (archs.indexOf('x64') < 0) archs.push('x64');\n if (arch !== process.arch && archs.indexOf(process.arch) < 0) archs.push(process.arch);\n const filenames = archs.map((a) => [platform, a].concat(parts.slice(2)).join('-'));\n if (platform === 'win') filenames.push('win-x64-exe', 'win-x86-exe');\n filenames.push('src');\n\n const tryNext = (cb) => {\n if (filenames.length === 0) return cb(new Error(`Failed to find installable for ${version}`));\n installFilename(filenames.shift(), version, dest, options, (err) => (err ? tryNext(cb) : cb()));\n };\n tryNext(callback);\n}\n"],"names":["install","PLATFORM_MAP","win32","darwin","archMachine","version","dest","options","callback","realArch","platform","process","arch","parts","type","push","compression","archs","indexOf","filenames","map","a","concat","slice","join","tryNext","cb","length","Error","installFilename","shift","err"],"mappings":";;;;+BASA;;;eAAwBA;;;8DATH;sEACO;;;;;;AAE5B,IAAMC,eAAe;IACnBC,OAAO;IACPC,QAAQ;AACV;AAEA,IAAIC;AACW,SAASJ,QAAQK,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC9D,IAAI,CAACJ,aAAaA,cAAcK,IAAAA,gBAAQ;IACxC,IAAIC,WAAWH,QAAQG,QAAQ,IAAIC,QAAQD,QAAQ;IACnDA,WAAWT,YAAY,CAACS,SAAS,IAAIA;IACrC,IAAME,OAAOL,QAAQK,IAAI,IAAIR,eAAeO,QAAQC,IAAI;IACxD,IAAMC,QAAQ;QAACH;QAAUE;KAAK;IAC9B,IAAIL,QAAQO,IAAI,EAAED,MAAME,IAAI,CAACR,QAAQO,IAAI;IACzC,IAAIP,QAAQS,WAAW,EAAEH,MAAME,IAAI,CAACR,QAAQS,WAAW;IAEvD,IAAMC,QAAQ;QAACL;KAAK;IACpB,IAAIK,MAAMC,OAAO,CAAC,SAAS,GAAGD,MAAMF,IAAI,CAAC;IACzC,IAAIH,SAASD,QAAQC,IAAI,IAAIK,MAAMC,OAAO,CAACP,QAAQC,IAAI,IAAI,GAAGK,MAAMF,IAAI,CAACJ,QAAQC,IAAI;IACrF,IAAMO,YAAYF,MAAMG,GAAG,CAAC,SAACC;eAAM;YAACX;YAAUW;SAAE,CAACC,MAAM,CAACT,MAAMU,KAAK,CAAC,IAAIC,IAAI,CAAC;;IAC7E,IAAId,aAAa,OAAOS,UAAUJ,IAAI,CAAC,eAAe;IACtDI,UAAUJ,IAAI,CAAC;IAEf,IAAMU,UAAU,SAACC;QACf,IAAIP,UAAUQ,MAAM,KAAK,GAAG,OAAOD,GAAG,IAAIE,MAAM,AAAC,kCAAyC,OAARvB;QAClFwB,IAAAA,wBAAe,EAACV,UAAUW,KAAK,IAAIzB,SAASC,MAAMC,SAAS,SAACwB;mBAASA,MAAMN,QAAQC,MAAMA;;IAC3F;IACAD,QAAQjB;AACV"}
|
|
@@ -26,10 +26,11 @@ function installExe(distPath, dest, options, callback) {
|
|
|
26
26
|
var destPath = _path.default.join(dest, _path.default.basename(distPath));
|
|
27
27
|
(0, _fsaccesscompat.default)(destPath, function(err) {
|
|
28
28
|
if (!err) return callback(); // already exists
|
|
29
|
+
console.log(1);
|
|
29
30
|
var queue = new _queuecb.default(1);
|
|
30
31
|
queue.defer(_conditionalCache.default.bind(null, downloadPath, cachePath));
|
|
31
32
|
queue.defer(_validateDownload.default.bind(null, distPath, cachePath));
|
|
32
|
-
queue.defer(_copyFile.default.bind(cachePath, destPath));
|
|
33
|
+
queue.defer(_copyFile.default.bind(null, cachePath, destPath));
|
|
33
34
|
queue.await(callback);
|
|
34
35
|
});
|
|
35
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installExe.ts"],"sourcesContent":["import path from 'path';\nimport access from 'fs-access-compat';\nimport Queue from 'queue-cb';\n\nimport { NODE_DIST_BASE_URL } from '../constants';\nimport conditionalCache from '../lib/conditionalCache';\nimport copyFile from '../lib/copyFile';\nimport validateDownload from './validateDownload';\n\nexport default function installExe(distPath, dest, options, callback) {\n const downloadPath = `${NODE_DIST_BASE_URL}/${distPath}`;\n const cachePath = path.join(options.cachePath, `node-${distPath}.exe`);\n const destPath = path.join(dest, path.basename(distPath));\n\n access(destPath, (err) => {\n if (!err) return callback(); // already exists\n\n const queue = new Queue(1);\n queue.defer(conditionalCache.bind(null, downloadPath, cachePath));\n queue.defer(validateDownload.bind(null, distPath, cachePath));\n queue.defer(copyFile.bind(cachePath, destPath));\n queue.await(callback);\n });\n}\n"],"names":["installExe","distPath","dest","options","callback","downloadPath","NODE_DIST_BASE_URL","cachePath","path","join","destPath","basename","access","err","queue","Queue","defer","conditionalCache","bind","validateDownload","copyFile","await"],"mappings":";;;;+BASA;;;eAAwBA;;;2DATP;qEACE;8DACD;yBAEiB;uEACN;+DACR;uEACQ;;;;;;AAEd,SAASA,WAAWC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAClE,IAAMC,eAAe,AAAC,GAAwBJ,OAAtBK,6BAAkB,EAAC,KAAY,OAATL;IAC9C,IAAMM,YAAYC,aAAI,CAACC,IAAI,CAACN,QAAQI,SAAS,EAAE,AAAC,QAAgB,OAATN,UAAS;IAChE,IAAMS,WAAWF,aAAI,CAACC,IAAI,CAACP,MAAMM,aAAI,CAACG,QAAQ,CAACV;IAE/CW,IAAAA,uBAAM,EAACF,UAAU,SAACG;QAChB,IAAI,CAACA,KAAK,OAAOT,YAAY,iBAAiB;
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installExe.ts"],"sourcesContent":["import path from 'path';\nimport access from 'fs-access-compat';\nimport Queue from 'queue-cb';\n\nimport { NODE_DIST_BASE_URL } from '../constants';\nimport conditionalCache from '../lib/conditionalCache';\nimport copyFile from '../lib/copyFile';\nimport validateDownload from './validateDownload';\n\nexport default function installExe(distPath, dest, options, callback) {\n const downloadPath = `${NODE_DIST_BASE_URL}/${distPath}`;\n const cachePath = path.join(options.cachePath, `node-${distPath}.exe`);\n const destPath = path.join(dest, path.basename(distPath));\n\n access(destPath, (err) => {\n if (!err) return callback(); // already exists\n\n console.log(1);\n const queue = new Queue(1);\n queue.defer(conditionalCache.bind(null, downloadPath, cachePath));\n queue.defer(validateDownload.bind(null, distPath, cachePath));\n queue.defer(copyFile.bind(null, cachePath, destPath));\n queue.await(callback);\n });\n}\n"],"names":["installExe","distPath","dest","options","callback","downloadPath","NODE_DIST_BASE_URL","cachePath","path","join","destPath","basename","access","err","console","log","queue","Queue","defer","conditionalCache","bind","validateDownload","copyFile","await"],"mappings":";;;;+BASA;;;eAAwBA;;;2DATP;qEACE;8DACD;yBAEiB;uEACN;+DACR;uEACQ;;;;;;AAEd,SAASA,WAAWC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAClE,IAAMC,eAAe,AAAC,GAAwBJ,OAAtBK,6BAAkB,EAAC,KAAY,OAATL;IAC9C,IAAMM,YAAYC,aAAI,CAACC,IAAI,CAACN,QAAQI,SAAS,EAAE,AAAC,QAAgB,OAATN,UAAS;IAChE,IAAMS,WAAWF,aAAI,CAACC,IAAI,CAACP,MAAMM,aAAI,CAACG,QAAQ,CAACV;IAE/CW,IAAAA,uBAAM,EAACF,UAAU,SAACG;QAChB,IAAI,CAACA,KAAK,OAAOT,YAAY,iBAAiB;QAE9CU,QAAQC,GAAG,CAAC;QACZ,IAAMC,QAAQ,IAAIC,gBAAK,CAAC;QACxBD,MAAME,KAAK,CAACC,yBAAgB,CAACC,IAAI,CAAC,MAAMf,cAAcE;QACtDS,MAAME,KAAK,CAACG,yBAAgB,CAACD,IAAI,CAAC,MAAMnB,UAAUM;QAClDS,MAAME,KAAK,CAACI,iBAAQ,CAACF,IAAI,CAAC,MAAMb,WAAWG;QAC3CM,MAAMO,KAAK,CAACnB;IACd;AACF"}
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return install;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
var _isversion = /*#__PURE__*/ _interop_require_default(require("is-version"));
|
|
11
12
|
var _mkdirpclassic = /*#__PURE__*/ _interop_require_default(require("mkdirp-classic"));
|
|
12
13
|
var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
|
|
13
14
|
var _constants = require("../constants.cjs");
|
|
@@ -51,10 +52,16 @@ function _object_spread(target) {
|
|
|
51
52
|
}
|
|
52
53
|
return target;
|
|
53
54
|
}
|
|
55
|
+
// short circuit
|
|
56
|
+
function getVersions(versionExpression, options, callback) {
|
|
57
|
+
(0, _isversion.default)(versionExpression) ? callback(null, [
|
|
58
|
+
versionExpression
|
|
59
|
+
]) : (0, _noderesolveversions.default)(versionExpression, options, callback);
|
|
60
|
+
}
|
|
54
61
|
function install(versionExpression, options, callback) {
|
|
55
62
|
var storagePaths = options.storagePath ? (0, _createStoragePaths.default)(options.storagePath) : _constants.DEFAULT_STORAGE_PATHS;
|
|
56
63
|
options = _object_spread({}, storagePaths, options);
|
|
57
|
-
(
|
|
64
|
+
getVersions(versionExpression, options, function(err, versions) {
|
|
58
65
|
if (err) return callback(err);
|
|
59
66
|
if (!versions.length) return callback(new Error("Could not resolve versions for: ".concat(versionExpression)));
|
|
60
67
|
if (versions.length !== 1) return callback(new Error("Version ".concat(versionExpression, " resolved to multiple versions: ").concat(versions.map(function(x) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/workers/install.ts"],"sourcesContent":["import mkdirp from 'mkdirp-classic';\nimport Queue from 'queue-cb';\nimport { DEFAULT_STORAGE_PATHS } from '../constants';\n\nimport createResult from '../createResult';\nimport createStoragePaths from '../createStoragePaths';\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\nexport default function install(versionExpression, options, callback) {\n const storagePaths = options.storagePath ? createStoragePaths(options.storagePath) : DEFAULT_STORAGE_PATHS;\n\n options = { ...storagePaths, ...options };\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/workers/install.ts"],"sourcesContent":["import isVersion from 'is-version';\nimport mkdirp from 'mkdirp-classic';\nimport Queue from 'queue-cb';\nimport { DEFAULT_STORAGE_PATHS } from '../constants';\n\nimport createResult from '../createResult';\nimport createStoragePaths from '../createStoragePaths';\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\n// short circuit\nfunction getVersions(versionExpression, options, callback) {\n isVersion(versionExpression) ? callback(null, [versionExpression]) : resolveVersions(versionExpression, options, callback);\n}\n\nexport default function install(versionExpression, options, callback) {\n const storagePaths = options.storagePath ? createStoragePaths(options.storagePath) : DEFAULT_STORAGE_PATHS;\n\n options = { ...storagePaths, ...options };\n getVersions(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 const result = createResult(options, version);\n\n checkMissing(result.installPath, options, (err, missing) => {\n if (err || !missing.length) return callback(err, result);\n\n const queue = new Queue(1);\n queue.defer(ensureDestinationParent.bind(null, result.installPath));\n !~missing.indexOf('node') || queue.defer(installNode.bind(null, version, result.installPath, options));\n !~missing.indexOf('npm') || queue.defer(installNPM.bind(null, version, result.installPath, options));\n queue.await((err) => (err ? callback(err) : callback(null, result)));\n });\n });\n });\n}\n"],"names":["install","getVersions","versionExpression","options","callback","isVersion","resolveVersions","storagePaths","storagePath","createStoragePaths","DEFAULT_STORAGE_PATHS","err","versions","length","Error","map","x","version","mkdirp","cachePath","result","createResult","checkMissing","installPath","missing","queue","Queue","defer","ensureDestinationParent","bind","indexOf","installNode","installNPM","await"],"mappings":";;;;+BAoBA;;;eAAwBA;;;gEApBF;oEACH;8DACD;yBACoB;mEAEb;yEACM;0EAEH;4DAEL;6DACC;mEACC;8EACW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEpC,gBAAgB;AAChB,SAASC,YAAYC,iBAAiB,EAAEC,OAAO,EAAEC,QAAQ;IACvDC,IAAAA,kBAAS,EAACH,qBAAqBE,SAAS,MAAM;QAACF;KAAkB,IAAII,IAAAA,4BAAe,EAACJ,mBAAmBC,SAASC;AACnH;AAEe,SAASJ,QAAQE,iBAAiB,EAAEC,OAAO,EAAEC,QAAQ;IAClE,IAAMG,eAAeJ,QAAQK,WAAW,GAAGC,IAAAA,2BAAkB,EAACN,QAAQK,WAAW,IAAIE,gCAAqB;IAE1GP,UAAU,mBAAKI,cAAiBJ;IAChCF,YAAYC,mBAAmBC,SAAS,SAACQ,KAAKC;QAC5C,IAAID,KAAK,OAAOP,SAASO;QACzB,IAAI,CAACC,SAASC,MAAM,EAAE,OAAOT,SAAS,IAAIU,MAAM,AAAC,mCAAoD,OAAlBZ;QACnF,IAAIU,SAASC,MAAM,KAAK,GAAG,OAAOT,SAAS,IAAIU,MAAM,AAAC,WAA8DF,OAApDV,mBAAkB,oCAAiE,OAA/BU,SAASG,GAAG,CAAC,SAACC;mBAAMA,EAAEC,OAAO;YAAE;QAEnJC,IAAAA,sBAAM,EAACf,QAAQgB,SAAS,EAAE,SAACR;YACzB,IAAIA,KAAK,OAAOP,SAASO;YACzB,IAAMM,UAAUL,QAAQ,CAAC,EAAE;YAC3B,IAAMQ,SAASC,IAAAA,qBAAY,EAAClB,SAASc;YAErCK,IAAAA,qBAAY,EAACF,OAAOG,WAAW,EAAEpB,SAAS,SAACQ,KAAKa;gBAC9C,IAAIb,OAAO,CAACa,QAAQX,MAAM,EAAE,OAAOT,SAASO,KAAKS;gBAEjD,IAAMK,QAAQ,IAAIC,gBAAK,CAAC;gBACxBD,MAAME,KAAK,CAACC,gCAAuB,CAACC,IAAI,CAAC,MAAMT,OAAOG,WAAW;gBACjE,CAAC,CAACC,QAAQM,OAAO,CAAC,WAAWL,MAAME,KAAK,CAACI,eAAW,CAACF,IAAI,CAAC,MAAMZ,SAASG,OAAOG,WAAW,EAAEpB;gBAC7F,CAAC,CAACqB,QAAQM,OAAO,CAAC,UAAUL,MAAME,KAAK,CAACK,cAAU,CAACH,IAAI,CAAC,MAAMZ,SAASG,OAAOG,WAAW,EAAEpB;gBAC3FsB,MAAMQ,KAAK,CAAC,SAACtB;2BAASA,MAAMP,SAASO,OAAOP,SAAS,MAAMgB;;YAC7D;QACF;IACF;AACF"}
|
|
@@ -25,6 +25,7 @@ export default function install(version, dest, options, callback) {
|
|
|
25
25
|
platform,
|
|
26
26
|
a
|
|
27
27
|
].concat(parts.slice(2)).join('-'));
|
|
28
|
+
if (platform === 'win') filenames.push('win-x64-exe', 'win-x86-exe');
|
|
28
29
|
filenames.push('src');
|
|
29
30
|
const tryNext = (cb)=>{
|
|
30
31
|
if (filenames.length === 0) return cb(new Error(`Failed to find installable for ${version}`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/index.ts"],"sourcesContent":["import realArch from '../machine/arch.cjs';\nimport installFilename from './installFilename';\n\nconst PLATFORM_MAP = {\n win32: 'win',\n darwin: 'osx',\n};\n\nlet archMachine: NodeJS.Architecture;\nexport default function install(version, dest, options, callback) {\n if (!archMachine) archMachine = realArch() as NodeJS.Architecture;\n let platform = options.platform || process.platform;\n platform = PLATFORM_MAP[platform] || platform;\n const arch = options.arch || archMachine || process.arch;\n const parts = [platform, arch];\n if (options.type) parts.push(options.type);\n if (options.compression) parts.push(options.compression);\n\n const archs = [arch];\n if (archs.indexOf('x64') < 0) archs.push('x64');\n if (arch !== process.arch && archs.indexOf(process.arch) < 0) archs.push(process.arch);\n const filenames = archs.map((a) => [platform, a].concat(parts.slice(2)).join('-'));\n filenames.push('src');\n\n const tryNext = (cb) => {\n if (filenames.length === 0) return cb(new Error(`Failed to find installable for ${version}`));\n installFilename(filenames.shift(), version, dest, options, (err) => (err ? tryNext(cb) : cb()));\n };\n tryNext(callback);\n}\n"],"names":["realArch","installFilename","PLATFORM_MAP","win32","darwin","archMachine","install","version","dest","options","callback","platform","process","arch","parts","type","push","compression","archs","indexOf","filenames","map","a","concat","slice","join","tryNext","cb","length","Error","shift","err"],"mappings":"AAAA,OAAOA,cAAc,sBAAsB;AAC3C,OAAOC,qBAAqB,oBAAoB;AAEhD,MAAMC,eAAe;IACnBC,OAAO;IACPC,QAAQ;AACV;AAEA,IAAIC;AACJ,eAAe,SAASC,QAAQC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC9D,IAAI,CAACL,aAAaA,cAAcL;IAChC,IAAIW,WAAWF,QAAQE,QAAQ,IAAIC,QAAQD,QAAQ;IACnDA,WAAWT,YAAY,CAACS,SAAS,IAAIA;IACrC,MAAME,OAAOJ,QAAQI,IAAI,IAAIR,eAAeO,QAAQC,IAAI;IACxD,MAAMC,QAAQ;QAACH;QAAUE;KAAK;IAC9B,IAAIJ,QAAQM,IAAI,EAAED,MAAME,IAAI,CAACP,QAAQM,IAAI;IACzC,IAAIN,QAAQQ,WAAW,EAAEH,MAAME,IAAI,CAACP,QAAQQ,WAAW;IAEvD,MAAMC,QAAQ;QAACL;KAAK;IACpB,IAAIK,MAAMC,OAAO,CAAC,SAAS,GAAGD,MAAMF,IAAI,CAAC;IACzC,IAAIH,SAASD,QAAQC,IAAI,IAAIK,MAAMC,OAAO,CAACP,QAAQC,IAAI,IAAI,GAAGK,MAAMF,IAAI,CAACJ,QAAQC,IAAI;IACrF,MAAMO,YAAYF,MAAMG,GAAG,CAAC,CAACC,IAAM;YAACX;YAAUW;SAAE,CAACC,MAAM,CAACT,MAAMU,KAAK,CAAC,IAAIC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/index.ts"],"sourcesContent":["import realArch from '../machine/arch.cjs';\nimport installFilename from './installFilename';\n\nconst PLATFORM_MAP = {\n win32: 'win',\n darwin: 'osx',\n};\n\nlet archMachine: NodeJS.Architecture;\nexport default function install(version, dest, options, callback) {\n if (!archMachine) archMachine = realArch() as NodeJS.Architecture;\n let platform = options.platform || process.platform;\n platform = PLATFORM_MAP[platform] || platform;\n const arch = options.arch || archMachine || process.arch;\n const parts = [platform, arch];\n if (options.type) parts.push(options.type);\n if (options.compression) parts.push(options.compression);\n\n const archs = [arch];\n if (archs.indexOf('x64') < 0) archs.push('x64');\n if (arch !== process.arch && archs.indexOf(process.arch) < 0) archs.push(process.arch);\n const filenames = archs.map((a) => [platform, a].concat(parts.slice(2)).join('-'));\n if (platform === 'win') filenames.push('win-x64-exe', 'win-x86-exe');\n filenames.push('src');\n\n const tryNext = (cb) => {\n if (filenames.length === 0) return cb(new Error(`Failed to find installable for ${version}`));\n installFilename(filenames.shift(), version, dest, options, (err) => (err ? tryNext(cb) : cb()));\n };\n tryNext(callback);\n}\n"],"names":["realArch","installFilename","PLATFORM_MAP","win32","darwin","archMachine","install","version","dest","options","callback","platform","process","arch","parts","type","push","compression","archs","indexOf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AML,QAAQC,MAAMA;IAC3F;IACAD,QAAQhB;AACV"}
|
|
@@ -11,10 +11,11 @@ export default function installExe(distPath, dest, options, callback) {
|
|
|
11
11
|
const destPath = path.join(dest, path.basename(distPath));
|
|
12
12
|
access(destPath, (err)=>{
|
|
13
13
|
if (!err) return callback(); // already exists
|
|
14
|
+
console.log(1);
|
|
14
15
|
const queue = new Queue(1);
|
|
15
16
|
queue.defer(conditionalCache.bind(null, downloadPath, cachePath));
|
|
16
17
|
queue.defer(validateDownload.bind(null, distPath, cachePath));
|
|
17
|
-
queue.defer(copyFile.bind(cachePath, destPath));
|
|
18
|
+
queue.defer(copyFile.bind(null, cachePath, destPath));
|
|
18
19
|
queue.await(callback);
|
|
19
20
|
});
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installExe.ts"],"sourcesContent":["import path from 'path';\nimport access from 'fs-access-compat';\nimport Queue from 'queue-cb';\n\nimport { NODE_DIST_BASE_URL } from '../constants';\nimport conditionalCache from '../lib/conditionalCache';\nimport copyFile from '../lib/copyFile';\nimport validateDownload from './validateDownload';\n\nexport default function installExe(distPath, dest, options, callback) {\n const downloadPath = `${NODE_DIST_BASE_URL}/${distPath}`;\n const cachePath = path.join(options.cachePath, `node-${distPath}.exe`);\n const destPath = path.join(dest, path.basename(distPath));\n\n access(destPath, (err) => {\n if (!err) return callback(); // already exists\n\n const queue = new Queue(1);\n queue.defer(conditionalCache.bind(null, downloadPath, cachePath));\n queue.defer(validateDownload.bind(null, distPath, cachePath));\n queue.defer(copyFile.bind(cachePath, destPath));\n queue.await(callback);\n });\n}\n"],"names":["path","access","Queue","NODE_DIST_BASE_URL","conditionalCache","copyFile","validateDownload","installExe","distPath","dest","options","callback","downloadPath","cachePath","join","destPath","basename","err","queue","defer","bind","await"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,YAAY,mBAAmB;AACtC,OAAOC,WAAW,WAAW;AAE7B,SAASC,kBAAkB,QAAQ,eAAe;AAClD,OAAOC,sBAAsB,0BAA0B;AACvD,OAAOC,cAAc,kBAAkB;AACvC,OAAOC,sBAAsB,qBAAqB;AAElD,eAAe,SAASC,WAAWC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAClE,MAAMC,eAAe,GAAGT,mBAAmB,CAAC,EAAEK,UAAU;IACxD,MAAMK,YAAYb,KAAKc,IAAI,CAACJ,QAAQG,SAAS,EAAE,CAAC,KAAK,EAAEL,SAAS,IAAI,CAAC;IACrE,MAAMO,WAAWf,KAAKc,IAAI,CAACL,MAAMT,KAAKgB,QAAQ,CAACR;IAE/CP,OAAOc,UAAU,CAACE;QAChB,IAAI,CAACA,KAAK,OAAON,YAAY,iBAAiB;
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installExe.ts"],"sourcesContent":["import path from 'path';\nimport access from 'fs-access-compat';\nimport Queue from 'queue-cb';\n\nimport { NODE_DIST_BASE_URL } from '../constants';\nimport conditionalCache from '../lib/conditionalCache';\nimport copyFile from '../lib/copyFile';\nimport validateDownload from './validateDownload';\n\nexport default function installExe(distPath, dest, options, callback) {\n const downloadPath = `${NODE_DIST_BASE_URL}/${distPath}`;\n const cachePath = path.join(options.cachePath, `node-${distPath}.exe`);\n const destPath = path.join(dest, path.basename(distPath));\n\n access(destPath, (err) => {\n if (!err) return callback(); // already exists\n\n console.log(1);\n const queue = new Queue(1);\n queue.defer(conditionalCache.bind(null, downloadPath, cachePath));\n queue.defer(validateDownload.bind(null, distPath, cachePath));\n queue.defer(copyFile.bind(null, cachePath, destPath));\n queue.await(callback);\n });\n}\n"],"names":["path","access","Queue","NODE_DIST_BASE_URL","conditionalCache","copyFile","validateDownload","installExe","distPath","dest","options","callback","downloadPath","cachePath","join","destPath","basename","err","console","log","queue","defer","bind","await"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,YAAY,mBAAmB;AACtC,OAAOC,WAAW,WAAW;AAE7B,SAASC,kBAAkB,QAAQ,eAAe;AAClD,OAAOC,sBAAsB,0BAA0B;AACvD,OAAOC,cAAc,kBAAkB;AACvC,OAAOC,sBAAsB,qBAAqB;AAElD,eAAe,SAASC,WAAWC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAClE,MAAMC,eAAe,GAAGT,mBAAmB,CAAC,EAAEK,UAAU;IACxD,MAAMK,YAAYb,KAAKc,IAAI,CAACJ,QAAQG,SAAS,EAAE,CAAC,KAAK,EAAEL,SAAS,IAAI,CAAC;IACrE,MAAMO,WAAWf,KAAKc,IAAI,CAACL,MAAMT,KAAKgB,QAAQ,CAACR;IAE/CP,OAAOc,UAAU,CAACE;QAChB,IAAI,CAACA,KAAK,OAAON,YAAY,iBAAiB;QAE9CO,QAAQC,GAAG,CAAC;QACZ,MAAMC,QAAQ,IAAIlB,MAAM;QACxBkB,MAAMC,KAAK,CAACjB,iBAAiBkB,IAAI,CAAC,MAAMV,cAAcC;QACtDO,MAAMC,KAAK,CAACf,iBAAiBgB,IAAI,CAAC,MAAMd,UAAUK;QAClDO,MAAMC,KAAK,CAAChB,SAASiB,IAAI,CAAC,MAAMT,WAAWE;QAC3CK,MAAMG,KAAK,CAACZ;IACd;AACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import isVersion from 'is-version';
|
|
1
2
|
import mkdirp from 'mkdirp-classic';
|
|
2
3
|
import Queue from 'queue-cb';
|
|
3
4
|
import { DEFAULT_STORAGE_PATHS } from '../constants.mjs';
|
|
@@ -8,13 +9,19 @@ import installNPM from '../installNPM/index.mjs';
|
|
|
8
9
|
import installNode from '../installNode/index.mjs';
|
|
9
10
|
import checkMissing from '../lib/checkMissing.mjs';
|
|
10
11
|
import ensureDestinationParent from '../lib/ensureDestinationParent.mjs';
|
|
12
|
+
// short circuit
|
|
13
|
+
function getVersions(versionExpression, options, callback) {
|
|
14
|
+
isVersion(versionExpression) ? callback(null, [
|
|
15
|
+
versionExpression
|
|
16
|
+
]) : resolveVersions(versionExpression, options, callback);
|
|
17
|
+
}
|
|
11
18
|
export default function install(versionExpression, options, callback) {
|
|
12
19
|
const storagePaths = options.storagePath ? createStoragePaths(options.storagePath) : DEFAULT_STORAGE_PATHS;
|
|
13
20
|
options = {
|
|
14
21
|
...storagePaths,
|
|
15
22
|
...options
|
|
16
23
|
};
|
|
17
|
-
|
|
24
|
+
getVersions(versionExpression, options, (err, versions)=>{
|
|
18
25
|
if (err) return callback(err);
|
|
19
26
|
if (!versions.length) return callback(new Error(`Could not resolve versions for: ${versionExpression}`));
|
|
20
27
|
if (versions.length !== 1) return callback(new Error(`Version ${versionExpression} resolved to multiple versions: ${versions.map((x)=>x.version)}. Expecting one.`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/workers/install.ts"],"sourcesContent":["import mkdirp from 'mkdirp-classic';\nimport Queue from 'queue-cb';\nimport { DEFAULT_STORAGE_PATHS } from '../constants';\n\nimport createResult from '../createResult';\nimport createStoragePaths from '../createStoragePaths';\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\nexport default function install(versionExpression, options, callback) {\n const storagePaths = options.storagePath ? createStoragePaths(options.storagePath) : DEFAULT_STORAGE_PATHS;\n\n options = { ...storagePaths, ...options };\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/workers/install.ts"],"sourcesContent":["import isVersion from 'is-version';\nimport mkdirp from 'mkdirp-classic';\nimport Queue from 'queue-cb';\nimport { DEFAULT_STORAGE_PATHS } from '../constants';\n\nimport createResult from '../createResult';\nimport createStoragePaths from '../createStoragePaths';\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\n// short circuit\nfunction getVersions(versionExpression, options, callback) {\n isVersion(versionExpression) ? callback(null, [versionExpression]) : resolveVersions(versionExpression, options, callback);\n}\n\nexport default function install(versionExpression, options, callback) {\n const storagePaths = options.storagePath ? createStoragePaths(options.storagePath) : DEFAULT_STORAGE_PATHS;\n\n options = { ...storagePaths, ...options };\n getVersions(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 const result = createResult(options, version);\n\n checkMissing(result.installPath, options, (err, missing) => {\n if (err || !missing.length) return callback(err, result);\n\n const queue = new Queue(1);\n queue.defer(ensureDestinationParent.bind(null, result.installPath));\n !~missing.indexOf('node') || queue.defer(installNode.bind(null, version, result.installPath, options));\n !~missing.indexOf('npm') || queue.defer(installNPM.bind(null, version, result.installPath, options));\n queue.await((err) => (err ? callback(err) : callback(null, result)));\n });\n });\n });\n}\n"],"names":["isVersion","mkdirp","Queue","DEFAULT_STORAGE_PATHS","createResult","createStoragePaths","resolveVersions","installNPM","installNode","checkMissing","ensureDestinationParent","getVersions","versionExpression","options","callback","install","storagePaths","storagePath","err","versions","length","Error","map","x","version","cachePath","result","installPath","missing","queue","defer","bind","indexOf","await"],"mappings":"AAAA,OAAOA,eAAe,aAAa;AACnC,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,WAAW,WAAW;AAC7B,SAASC,qBAAqB,QAAQ,eAAe;AAErD,OAAOC,kBAAkB,kBAAkB;AAC3C,OAAOC,wBAAwB,wBAAwB;AAEvD,OAAOC,qBAAqB,wBAAwB;AAEpD,OAAOC,gBAAgB,sBAAs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