From a36e2537fd4c81df53fb6de01900beb9fa4fa0aa Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 2 Sep 2020 10:51:54 -0700 Subject: [PATCH] outdated: don't throw on non-version/tag/range dep --- lib/outdated.js | 4 ++++ .../json-parse-even-better-errors/LICENSE.md | 2 +- node_modules/json-parse-even-better-errors/index.js | 9 ++++++++- .../json-parse-even-better-errors/package.json | 2 +- package-lock.json | 12 ++++++------ 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/outdated.js b/lib/outdated.js index 660f1cd05704e..fa626ecbd0b8b 100644 --- a/lib/outdated.js +++ b/lib/outdated.js @@ -144,6 +144,10 @@ async function outdated_ (tree, deps, opts) { try { const packument = await getPackument(spec) const expected = edge.spec + // if it's not a range, version, or tag, skip it + if (!npa(`${edge.name}@${edge.spec}`).registry) { + return null + } const wanted = pickManifest(packument, expected, npm.flatOptions) const latest = pickManifest(packument, '*', npm.flatOptions) diff --git a/node_modules/json-parse-even-better-errors/LICENSE.md b/node_modules/json-parse-even-better-errors/LICENSE.md index cb6c4a624cc01..6991b7cbb89db 100644 --- a/node_modules/json-parse-even-better-errors/LICENSE.md +++ b/node_modules/json-parse-even-better-errors/LICENSE.md @@ -1,5 +1,5 @@ Copyright 2017 Kat Marchán -Copyright npm, Inc. and Contributors +Copyright npm, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff --git a/node_modules/json-parse-even-better-errors/index.js b/node_modules/json-parse-even-better-errors/index.js index 50cd15932c664..86a1fdc1ae809 100644 --- a/node_modules/json-parse-even-better-errors/index.js +++ b/node_modules/json-parse-even-better-errors/index.js @@ -66,7 +66,10 @@ const kIndent = Symbol.for('indent') const kNewline = Symbol.for('newline') // only respect indentation if we got a line break, otherwise squash it // things other than objects and arrays aren't indented, so ignore those +// Important: in both of these regexps, the $1 capture group is the newline +// or undefined, and the $2 capture group is the indent, or undefined. const formatRE = /^\s*[{\[]((?:\r?\n)+)([\s\t]*)/ +const emptyRE = /^(?:\{\}|\[\])((?:\r?\n)+)?$/ const parseJson = (txt, reviver, context) => { const parseText = stripBOM(txt) @@ -77,7 +80,11 @@ const parseJson = (txt, reviver, context) => { // otherwise, pick the indentation of the next line after the first \n // If the pattern doesn't match, then it means no indentation. // JSON.stringify ignores symbols, so this is reasonably safe. - const [, newline, indent] = parseText.match(formatRE) || [, '', ''] + // if the string is '{}' or '[]', then use the default 2-space indent. + const [, newline = '\n', indent = ' '] = parseText.match(emptyRE) || + parseText.match(formatRE) || + [, '', ''] + const result = JSON.parse(parseText, reviver) if (result && typeof result === 'object') { result[kNewline] = newline diff --git a/node_modules/json-parse-even-better-errors/package.json b/node_modules/json-parse-even-better-errors/package.json index d2abf42e1849f..ed0fdaf2e0f6f 100644 --- a/node_modules/json-parse-even-better-errors/package.json +++ b/node_modules/json-parse-even-better-errors/package.json @@ -1,6 +1,6 @@ { "name": "json-parse-even-better-errors", - "version": "2.3.0", + "version": "2.3.1", "description": "JSON.parse with context information on error", "main": "index.js", "files": [ diff --git a/package-lock.json b/package-lock.json index 495f2ff51c6a1..6974829d03e0b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3602,9 +3602,9 @@ "dev": true }, "node_modules/json-parse-even-better-errors": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.0.tgz", - "integrity": "sha512-o3aP+RsWDJZayj1SbHNQAI8x0v3T3SKiGoZlNYfbUP1S3omJQ6i9CnqADqkSPaOAxwua4/1YWx5CM7oiChJt2Q==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "inBundle": true }, "node_modules/json-schema": { @@ -11931,9 +11931,9 @@ "dev": true }, "json-parse-even-better-errors": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.0.tgz", - "integrity": "sha512-o3aP+RsWDJZayj1SbHNQAI8x0v3T3SKiGoZlNYfbUP1S3omJQ6i9CnqADqkSPaOAxwua4/1YWx5CM7oiChJt2Q==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" }, "json-schema": { "version": "0.2.3",