Socket
Socket
Sign inDemoInstall

get-node

Package Overview
Dependencies
96
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 13.3.0 to 13.4.0

20

build/src/arch.js
import{platform}from"process";
export const validateArch=function(arch){
if(arch in PLATFORMS){
return;
}
const availableArch=Object.keys(PLATFORMS).join(", ");
throw new TypeError(
`Option "arch" must not be ${arch} but one of: ${availableArch}`);
};
export const getArch=function(arch){

@@ -12,9 +24,3 @@ /* c8 ignore start */

const archA=PLATFORMS[arch];
if(archA===undefined){
throw new Error(`Unsupported CPU architecture: ${arch}`);
}
return archA;
return PLATFORMS[arch];
};

@@ -21,0 +27,0 @@

@@ -14,4 +14,3 @@ import{download}from"./download.js";

fetchOpts}=
await getOpts({...opts,versionRange});
await getOpts(versionRange,opts);
const version=await getVersion({

@@ -18,0 +17,0 @@ versionRange:versionRangeA,

@@ -1,59 +0,45 @@

import{cwd as getCwd,arch}from"process";
import{arch as processArch}from"process";
import{excludeKeys}from"filter-obj";
import{validate,multipleValidOptions}from"jest-validate";
import semver from"semver";
import isPlainObj from"is-plain-obj";
import{addOutput}from"./output.js";
import{validateArch}from"./arch.js";
import{getDefaultOutput,validateOutput}from"./output.js";
import{DEFAULT_VERSION_RANGE,validateVersionRange}from"./version.js";
export const getOpts=async function(opts){
validate(opts,{exampleConfig:EXAMPLE_OPTS});
export const getOpts=async function(
versionRange=DEFAULT_VERSION_RANGE,
opts={})
{
validateVersionRange(versionRange);
const optsA=excludeKeys(opts,isUndefined);
const optsB={...DEFAULT_OPTS,...optsA};
if(!isPlainObj(opts)){
throw new TypeError(`Options must be a plain object: ${opts}`);
}
const optsC=await addOutput(optsB);
const{
output=await getDefaultOutput(),
arch=processArch,
cwd,
fetch:fetchOpt,
mirror,
progress=false}=
opts;
validateVersionRange(optsC);
validateOutput(output);
validateArch(arch);
const{cwd,fetch:fetchOpt,mirror,progress,...optsD}=optsC;
const preferredNodeOpts={cwd,fetch:fetchOpt,mirror};
const nodeVersionAliasOpts={fetch:fetchOpt,mirror};
const fetchOpts={mirror,progress};
return{...optsD,preferredNodeOpts,nodeVersionAliasOpts,fetchOpts};
};
return{
versionRange,
output,
arch,
preferredNodeOpts,
nodeVersionAliasOpts,
fetchOpts};
const isUndefined=function(key,value){
return value===undefined;
};
const DEFAULT_OPTS={
versionRange:"latest",
progress:false,
arch};
const EXAMPLE_OPTS={
...DEFAULT_OPTS,
output:getCwd(),
versionRange:"8",
cwd:multipleValidOptions(getCwd(),new URL(".",import.meta.url)),
fetch:true,
mirror:"https://nodejs.org/dist"};
const validateVersionRange=function({versionRange}){
if(!ALIASES.has(versionRange)&&semver.validRange(versionRange)===null){
throw new TypeError(`Not a valid Node version range: ${versionRange}`);
}
};
const ALIASES=new Set(["latest","lts","global","local"]);
//# sourceMappingURL=options.js.map
import globalCacheDir from"global-cache-dir";
export const addOutput=async function(opts){
const output=await getOutput(opts);
return{...opts,output};
export const getDefaultOutput=async function(){
return await globalCacheDir(CACHE_DIR);
};
const getOutput=async function({output}){
if(output!==undefined){
return output;
const CACHE_DIR="nve";
export const validateOutput=function(output){
if(typeof output!=="string"){
throw new TypeError(`Option "output" must be a string: ${output}`);
}
const outputA=await globalCacheDir(CACHE_DIR);
return outputA;
};
const CACHE_DIR="nve";
//# sourceMappingURL=output.js.map

@@ -8,5 +8,23 @@ import{version as processVersion}from"process";

export const DEFAULT_VERSION_RANGE="latest";
export const validateVersionRange=function(versionRange){
if(typeof versionRange!=="string"){
throw new TypeError(`Node version range must be a string: ${versionRange}`);
}
if(!ALIASES.has(versionRange)&&semver.validRange(versionRange)===null){
throw new TypeError(`Not a valid Node version range: ${versionRange}`);
}
};
const ALIASES=new Set(["latest","lts","global","local"]);
export const getVersion=async function({

@@ -13,0 +31,0 @@ versionRange,

{
"name": "get-node",
"version": "13.3.0",
"version": "13.4.0",
"type": "module",

@@ -50,14 +50,13 @@ "exports": "./build/src/main.js",

"execa": "^6.1.0",
"fetch-node-website": "^7.1.0",
"filter-obj": "^5.1.0",
"fetch-node-website": "^7.2.0",
"get-stream": "^6.0.0",
"global-cache-dir": "^4.2.0",
"jest-validate": "^29.0.1",
"global-cache-dir": "^4.3.1",
"is-plain-obj": "^4.1.0",
"jszip": "^3.10.1",
"mem": "^9.0.2",
"move-file": "^3.0.0",
"node-version-alias": "^3.2.0",
"node-version-alias": "^3.3.0",
"path-exists": "^5.0.0",
"path-key": "^4.0.0",
"preferred-node-version": "^3.2.0",
"preferred-node-version": "^3.4.0",
"semver": "^7.3.7",

@@ -68,7 +67,7 @@ "tar-fs": "^2.1.1",

"devDependencies": {
"@ehmicky/dev-tasks": "^1.0.91",
"@ehmicky/dev-tasks": "^1.0.94",
"@types/node": "^17.0.31",
"is-ci": "^3.0.1",
"sinon": "^14.0.0",
"test-each": "^5.4.0"
"test-each": "^5.4.1"
},

@@ -75,0 +74,0 @@ "engines": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc