Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

detect-node-support

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detect-node-support - npm Package Compare versions

Comparing version 1.3.0-alpha.2 to 1.3.0

7

lib/deps.js

@@ -12,7 +12,8 @@ 'use strict';

const internals = {
log: Debug('detect-node-support')
};
const internals = {};
internals.log = Debug('detect-node-support');
internals.resolve = async ({ packageJson, lockfile }, options) => {

@@ -19,0 +20,0 @@

@@ -14,4 +14,4 @@ 'use strict';

const internals = {
cache: new Map(),
log: Debug('detect-node-support-loader')
log: Debug('detect-node-support:loader'),
error: Debug('detect-node-support:error')
};

@@ -74,2 +74,6 @@

if (repository.split('/').length === 2) {
repository = `https://github.com/${repository}`;
}
const parsedRepository = GitUrlParse(repository);

@@ -96,14 +100,5 @@

if (options === undefined && internals.cache.has(url)) {
internals.log('From cache: %s', url);
return internals.cache.get(url);
}
try {
const { payload } = await Wreck.get(url, options);
if (options === undefined) {
internals.cache.set(url, payload);
}
internals.log('Loaded: %s', url);

@@ -114,3 +109,3 @@ return payload;

if (err.output && err.output.statusCode === 404) {
if (err.data && err.data.res.statusCode === 404) {
internals.log('Not found: %s', url);

@@ -122,2 +117,3 @@ const error = new Error(`${repository} does not contain a ${filename}`);

internals.error('Failed to load: %s', url);
throw err;

@@ -176,7 +172,1 @@ }

};
exports.clearCache = () => {
internals.cache = new Map();
};

@@ -34,4 +34,4 @@ 'use strict';

if (what.includes('/') && !what.startsWith('@')) {
return { repository: `https://github.com/${what}` };
if (what.split('/').length === 2 && !what.startsWith('@')) {
return { repository: what };
}

@@ -38,0 +38,0 @@

@@ -6,9 +6,5 @@ 'use strict';

const TravisImports = require('./imports');
const Utils = require('../utils');
const internals = {};
internals.nodeAliases = {

@@ -21,9 +17,17 @@ latest: 'active',

internals.scan = async (travisYaml, options) => {
internals.toArray = (v) => {
await TravisImports.apply(travisYaml, options);
if (v === undefined) {
return [];
}
return Array.isArray(v) ? v : [v];
};
internals.scan = async (travisYaml) => {
const rawSet = new Set();
for (const v of Utils.toArray(travisYaml.node_js)) {
for (const v of internals.toArray(travisYaml.node_js)) {
rawSet.add(v);

@@ -34,5 +38,5 @@ }

for (const env of Utils.toArray(travisYaml.env.matrix)) {
for (const env of internals.toArray(travisYaml.env.matrix)) {
const matches = env.match(/(?:NODEJS_VER|TRAVIS_NODE_VERSION|NODE_VER)="?(node\/)?(?<version>[\w./*]+)"?/);
const matches = env.match(/(?:NODEJS_VER|TRAVIS_NODE_VERSION|NODE_VER)="?(node\/)?(?<version>[\w./*]+)"?/); /* hack syntax highlighter 🤦‍♂️ */

@@ -47,3 +51,3 @@ if (matches) {

for (const include of Utils.toArray(travisYaml.matrix.include)) {
for (const include of internals.toArray(travisYaml.matrix.include)) {

@@ -99,4 +103,4 @@ if (include.node_js) {

return {
travis: await internals.scan(travisYaml, { loadFile })
travis: await internals.scan(travisYaml)
};
};

@@ -25,11 +25,1 @@ 'use strict';

};
exports.toArray = (v) => {
if (v === undefined) {
return [];
}
return Array.isArray(v) ? v : [v];
};
{
"name": "detect-node-support",
"version": "1.3.0-alpha.2",
"version": "1.3.0",
"description": "List the Node.js versions supported by the package/repository",

@@ -5,0 +5,0 @@ "bin": {

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc