npm-pkg-lint 5.1.6 → 5.1.8
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/index.js +27 -15
- package/dist/index.js.map +3 -3
- package/package.json +7 -1
package/dist/index.js
CHANGED
|
@@ -15,7 +15,11 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
15
15
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
16
16
|
});
|
|
17
17
|
var __commonJS = (cb, mod) => function __require2() {
|
|
18
|
-
|
|
18
|
+
try {
|
|
19
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
20
|
+
} catch (e) {
|
|
21
|
+
throw mod = 0, e;
|
|
22
|
+
}
|
|
19
23
|
};
|
|
20
24
|
var __copyProps = (to2, from, except, desc) => {
|
|
21
25
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -4687,20 +4691,22 @@ var require_range = __commonJS({
|
|
|
4687
4691
|
return comp;
|
|
4688
4692
|
};
|
|
4689
4693
|
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
4694
|
+
var invalidXRangeOrder = (M2, m2, p2) => isX(M2) && !isX(m2) || isX(m2) && p2 && !isX(p2);
|
|
4690
4695
|
var replaceTildes = (comp, options) => {
|
|
4691
4696
|
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
4692
4697
|
};
|
|
4693
4698
|
var replaceTilde = (comp, options) => {
|
|
4694
4699
|
const r = options.loose ? re2[t.TILDELOOSE] : re2[t.TILDE];
|
|
4700
|
+
const z2 = options.includePrerelease ? "-0" : "";
|
|
4695
4701
|
return comp.replace(r, (_2, M2, m2, p2, pr2) => {
|
|
4696
4702
|
debug("tilde", comp, _2, M2, m2, p2, pr2);
|
|
4697
4703
|
let ret;
|
|
4698
4704
|
if (isX(M2)) {
|
|
4699
4705
|
ret = "";
|
|
4700
4706
|
} else if (isX(m2)) {
|
|
4701
|
-
ret = `>=${M2}.0.0 <${+M2 + 1}.0.0-0`;
|
|
4707
|
+
ret = `>=${M2}.0.0${z2} <${+M2 + 1}.0.0-0`;
|
|
4702
4708
|
} else if (isX(p2)) {
|
|
4703
|
-
ret = `>=${M2}.${m2}.0 <${M2}.${+m2 + 1}.0-0`;
|
|
4709
|
+
ret = `>=${M2}.${m2}.0${z2} <${M2}.${+m2 + 1}.0-0`;
|
|
4704
4710
|
} else if (pr2) {
|
|
4705
4711
|
debug("replaceTilde pr", pr2);
|
|
4706
4712
|
ret = `>=${M2}.${m2}.${p2}-${pr2} <${M2}.${+m2 + 1}.0-0`;
|
|
@@ -4767,6 +4773,9 @@ var require_range = __commonJS({
|
|
|
4767
4773
|
const r = options.loose ? re2[t.XRANGELOOSE] : re2[t.XRANGE];
|
|
4768
4774
|
return comp.replace(r, (ret, gtlt, M2, m2, p2, pr2) => {
|
|
4769
4775
|
debug("xRange", comp, ret, gtlt, M2, m2, p2, pr2);
|
|
4776
|
+
if (invalidXRangeOrder(M2, m2, p2)) {
|
|
4777
|
+
return comp;
|
|
4778
|
+
}
|
|
4770
4779
|
const xM = isX(M2);
|
|
4771
4780
|
const xm = xM || isX(m2);
|
|
4772
4781
|
const xp = xm || isX(p2);
|
|
@@ -7652,7 +7661,7 @@ var blacklist = [
|
|
|
7652
7661
|
filename("gulpfile.esm.js"),
|
|
7653
7662
|
filename("Herebyfile.js"),
|
|
7654
7663
|
filename("Herebyfile.mjs"),
|
|
7655
|
-
/*
|
|
7664
|
+
/* CI */
|
|
7656
7665
|
/^\.azure-.*$/,
|
|
7657
7666
|
directory(".circleci"),
|
|
7658
7667
|
directory(".github"),
|
|
@@ -10657,7 +10666,9 @@ async function getFileList(filename2) {
|
|
|
10657
10666
|
await Ft({
|
|
10658
10667
|
file: filename2,
|
|
10659
10668
|
strict: true,
|
|
10660
|
-
|
|
10669
|
+
onReadEntry(entry) {
|
|
10670
|
+
entries.push(entry);
|
|
10671
|
+
}
|
|
10661
10672
|
});
|
|
10662
10673
|
return entries.map((entry) => {
|
|
10663
10674
|
const filename3 = entry.path;
|
|
@@ -10695,11 +10706,11 @@ function blacklistedFiles(filelist) {
|
|
|
10695
10706
|
function normalizeRequiredFiles(src) {
|
|
10696
10707
|
if (typeof src === "string") {
|
|
10697
10708
|
return [src];
|
|
10698
|
-
}
|
|
10709
|
+
}
|
|
10710
|
+
if (Array.isArray(src)) {
|
|
10699
10711
|
return src;
|
|
10700
|
-
} else {
|
|
10701
|
-
return Object.values(src).filter((it2) => it2 !== false);
|
|
10702
10712
|
}
|
|
10713
|
+
return Object.values(src).filter((it2) => it2 !== false);
|
|
10703
10714
|
}
|
|
10704
10715
|
function* yieldRequiredFiles(src, template) {
|
|
10705
10716
|
const files = normalizeRequiredFiles(src);
|
|
@@ -11590,7 +11601,7 @@ function getProtocol(version2, field) {
|
|
|
11590
11601
|
}
|
|
11591
11602
|
return null;
|
|
11592
11603
|
}
|
|
11593
|
-
var githubShorthandRe = /^[A-
|
|
11604
|
+
var githubShorthandRe = /^[A-Z][\w-]*\/[\w.-]+(?:#.+)?$/i;
|
|
11594
11605
|
var gitUrlRe = /^[^@]+@[^:]+:.+/;
|
|
11595
11606
|
function isGithubShorthand(version2) {
|
|
11596
11607
|
return !version2.includes(":") && githubShorthandRe.test(version2);
|
|
@@ -11716,7 +11727,7 @@ function* outdatedEngines(pkg, pkgAst, ignoreNodeVersion) {
|
|
|
11716
11727
|
if (!descriptor.eol) {
|
|
11717
11728
|
break;
|
|
11718
11729
|
}
|
|
11719
|
-
const expanded = version2.replaceAll(/[*
|
|
11730
|
+
const expanded = version2.replaceAll(/[*X]/gi, "999");
|
|
11720
11731
|
if (!import_semver2.default.satisfies(expanded, range)) {
|
|
11721
11732
|
continue;
|
|
11722
11733
|
}
|
|
@@ -11947,6 +11958,7 @@ async function verifyEngineConstraint(pkg) {
|
|
|
11947
11958
|
// src/validators/validation-error.ts
|
|
11948
11959
|
var ValidationError = class extends Error {
|
|
11949
11960
|
validator;
|
|
11961
|
+
/* eslint-disable-next-line unicorn/custom-error-definition -- technical debt */
|
|
11950
11962
|
constructor(validator, message) {
|
|
11951
11963
|
super(message);
|
|
11952
11964
|
this.name = "ValidationError";
|
|
@@ -11956,7 +11968,7 @@ var ValidationError = class extends Error {
|
|
|
11956
11968
|
|
|
11957
11969
|
// src/validators/non-empty.ts
|
|
11958
11970
|
function isEmpty(value) {
|
|
11959
|
-
return
|
|
11971
|
+
return [void 0, null, ""].includes(value);
|
|
11960
11972
|
}
|
|
11961
11973
|
function nonempty(key, value) {
|
|
11962
11974
|
if (isEmpty(value)) {
|
|
@@ -12084,7 +12096,8 @@ function validRepoUrl(key, value) {
|
|
|
12084
12096
|
function validUrl(key, value) {
|
|
12085
12097
|
if (typeof value === "string" && /^https:\/\/.+$/.test(value)) {
|
|
12086
12098
|
return;
|
|
12087
|
-
}
|
|
12099
|
+
}
|
|
12100
|
+
if (value && typeof value === "object" && "url" in value) {
|
|
12088
12101
|
validUrl(`${key}.url`, value.url);
|
|
12089
12102
|
} else {
|
|
12090
12103
|
throw new ValidationError(validUrl.name, `"${key}" must be a valid url (https only)`);
|
|
@@ -12313,7 +12326,7 @@ async function verifyShebang(pkg, tarball) {
|
|
|
12313
12326
|
const contents = await getFileContent(tarball, binaries);
|
|
12314
12327
|
for (const [filePath, content] of Object.entries(contents)) {
|
|
12315
12328
|
const text = content.toString("utf-8");
|
|
12316
|
-
if (
|
|
12329
|
+
if (/^#!.+\r?\n/.test(text)) {
|
|
12317
12330
|
continue;
|
|
12318
12331
|
}
|
|
12319
12332
|
results.push({
|
|
@@ -12473,9 +12486,8 @@ async function run() {
|
|
|
12473
12486
|
result.messages.sort((a, b2) => {
|
|
12474
12487
|
if (a.line !== b2.line) {
|
|
12475
12488
|
return a.line - b2.line;
|
|
12476
|
-
} else {
|
|
12477
|
-
return a.column - b2.column;
|
|
12478
12489
|
}
|
|
12490
|
+
return a.column - b2.column;
|
|
12479
12491
|
});
|
|
12480
12492
|
}
|
|
12481
12493
|
const output = stylish(results);
|