npm-pkg-lint 5.1.7 → 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 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
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
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") {
@@ -4693,15 +4697,16 @@ var require_range = __commonJS({
4693
4697
  };
4694
4698
  var replaceTilde = (comp, options) => {
4695
4699
  const r = options.loose ? re2[t.TILDELOOSE] : re2[t.TILDE];
4700
+ const z2 = options.includePrerelease ? "-0" : "";
4696
4701
  return comp.replace(r, (_2, M2, m2, p2, pr2) => {
4697
4702
  debug("tilde", comp, _2, M2, m2, p2, pr2);
4698
4703
  let ret;
4699
4704
  if (isX(M2)) {
4700
4705
  ret = "";
4701
4706
  } else if (isX(m2)) {
4702
- ret = `>=${M2}.0.0 <${+M2 + 1}.0.0-0`;
4707
+ ret = `>=${M2}.0.0${z2} <${+M2 + 1}.0.0-0`;
4703
4708
  } else if (isX(p2)) {
4704
- ret = `>=${M2}.${m2}.0 <${M2}.${+m2 + 1}.0-0`;
4709
+ ret = `>=${M2}.${m2}.0${z2} <${M2}.${+m2 + 1}.0-0`;
4705
4710
  } else if (pr2) {
4706
4711
  debug("replaceTilde pr", pr2);
4707
4712
  ret = `>=${M2}.${m2}.${p2}-${pr2} <${M2}.${+m2 + 1}.0-0`;
@@ -7656,7 +7661,7 @@ var blacklist = [
7656
7661
  filename("gulpfile.esm.js"),
7657
7662
  filename("Herebyfile.js"),
7658
7663
  filename("Herebyfile.mjs"),
7659
- /* ci */
7664
+ /* CI */
7660
7665
  /^\.azure-.*$/,
7661
7666
  directory(".circleci"),
7662
7667
  directory(".github"),
@@ -10661,7 +10666,9 @@ async function getFileList(filename2) {
10661
10666
  await Ft({
10662
10667
  file: filename2,
10663
10668
  strict: true,
10664
- onentry: (entry) => entries.push(entry)
10669
+ onReadEntry(entry) {
10670
+ entries.push(entry);
10671
+ }
10665
10672
  });
10666
10673
  return entries.map((entry) => {
10667
10674
  const filename3 = entry.path;
@@ -10699,11 +10706,11 @@ function blacklistedFiles(filelist) {
10699
10706
  function normalizeRequiredFiles(src) {
10700
10707
  if (typeof src === "string") {
10701
10708
  return [src];
10702
- } else if (Array.isArray(src)) {
10709
+ }
10710
+ if (Array.isArray(src)) {
10703
10711
  return src;
10704
- } else {
10705
- return Object.values(src).filter((it2) => it2 !== false);
10706
10712
  }
10713
+ return Object.values(src).filter((it2) => it2 !== false);
10707
10714
  }
10708
10715
  function* yieldRequiredFiles(src, template) {
10709
10716
  const files = normalizeRequiredFiles(src);
@@ -11594,7 +11601,7 @@ function getProtocol(version2, field) {
11594
11601
  }
11595
11602
  return null;
11596
11603
  }
11597
- var githubShorthandRe = /^[A-Za-z][\w-]*\/[\w.-]+(?:#.+)?$/;
11604
+ var githubShorthandRe = /^[A-Z][\w-]*\/[\w.-]+(?:#.+)?$/i;
11598
11605
  var gitUrlRe = /^[^@]+@[^:]+:.+/;
11599
11606
  function isGithubShorthand(version2) {
11600
11607
  return !version2.includes(":") && githubShorthandRe.test(version2);
@@ -11720,7 +11727,7 @@ function* outdatedEngines(pkg, pkgAst, ignoreNodeVersion) {
11720
11727
  if (!descriptor.eol) {
11721
11728
  break;
11722
11729
  }
11723
- const expanded = version2.replaceAll(/[*Xx]/g, "999");
11730
+ const expanded = version2.replaceAll(/[*X]/gi, "999");
11724
11731
  if (!import_semver2.default.satisfies(expanded, range)) {
11725
11732
  continue;
11726
11733
  }
@@ -11951,6 +11958,7 @@ async function verifyEngineConstraint(pkg) {
11951
11958
  // src/validators/validation-error.ts
11952
11959
  var ValidationError = class extends Error {
11953
11960
  validator;
11961
+ /* eslint-disable-next-line unicorn/custom-error-definition -- technical debt */
11954
11962
  constructor(validator, message) {
11955
11963
  super(message);
11956
11964
  this.name = "ValidationError";
@@ -11960,7 +11968,7 @@ var ValidationError = class extends Error {
11960
11968
 
11961
11969
  // src/validators/non-empty.ts
11962
11970
  function isEmpty(value) {
11963
- return value === void 0 || value === null || value === "";
11971
+ return [void 0, null, ""].includes(value);
11964
11972
  }
11965
11973
  function nonempty(key, value) {
11966
11974
  if (isEmpty(value)) {
@@ -12088,7 +12096,8 @@ function validRepoUrl(key, value) {
12088
12096
  function validUrl(key, value) {
12089
12097
  if (typeof value === "string" && /^https:\/\/.+$/.test(value)) {
12090
12098
  return;
12091
- } else if (value && typeof value === "object" && "url" in value) {
12099
+ }
12100
+ if (value && typeof value === "object" && "url" in value) {
12092
12101
  validUrl(`${key}.url`, value.url);
12093
12102
  } else {
12094
12103
  throw new ValidationError(validUrl.name, `"${key}" must be a valid url (https only)`);
@@ -12317,7 +12326,7 @@ async function verifyShebang(pkg, tarball) {
12317
12326
  const contents = await getFileContent(tarball, binaries);
12318
12327
  for (const [filePath, content] of Object.entries(contents)) {
12319
12328
  const text = content.toString("utf-8");
12320
- if (/^#!.+?\r?\n/.test(text)) {
12329
+ if (/^#!.+\r?\n/.test(text)) {
12321
12330
  continue;
12322
12331
  }
12323
12332
  results.push({
@@ -12477,9 +12486,8 @@ async function run() {
12477
12486
  result.messages.sort((a, b2) => {
12478
12487
  if (a.line !== b2.line) {
12479
12488
  return a.line - b2.line;
12480
- } else {
12481
- return a.column - b2.column;
12482
12489
  }
12490
+ return a.column - b2.column;
12483
12491
  });
12484
12492
  }
12485
12493
  const output = stylish(results);