npm-pkg-lint 4.3.6 → 4.4.1

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
@@ -5663,7 +5663,7 @@ function centerLineColumn(el) {
5663
5663
  return el.replace(/(\d+)\s+(\d+)/u, (_m, p1, p2) => dim2(`${p1}:${p2}`));
5664
5664
  }
5665
5665
  function stripAnsi(text) {
5666
- return text.replace(/\u001B\[[0-9;]*m/g, "");
5666
+ return text.replaceAll(/\u001B\[[\d;]*m/g, "");
5667
5667
  }
5668
5668
  function stylish(results) {
5669
5669
  let output = "\n";
@@ -5672,10 +5672,10 @@ function stylish(results) {
5672
5672
  let fixableErrorCount = 0;
5673
5673
  let fixableWarningCount = 0;
5674
5674
  let summaryColor = yellow2;
5675
- results.forEach((result) => {
5675
+ for (const result of results) {
5676
5676
  const messages = result.messages;
5677
5677
  if (messages.length === 0) {
5678
- return;
5678
+ continue;
5679
5679
  }
5680
5680
  errorCount += result.errorCount;
5681
5681
  warningCount += result.warningCount;
@@ -5710,7 +5710,7 @@ function stylish(results) {
5710
5710
  output += `${formattedTable}
5711
5711
 
5712
5712
  `;
5713
- });
5713
+ }
5714
5714
  const total = errorCount + warningCount;
5715
5715
  if (total > 0) {
5716
5716
  output += summaryColor(
@@ -7791,7 +7791,7 @@ var _i = class extends Ie {
7791
7791
  this.src.removeListener("error", this.proxyErrors), super.unpipe();
7792
7792
  }
7793
7793
  constructor(t, e, i) {
7794
- super(t, e, i), this.proxyErrors = (r) => e.emit("error", r), t.on("error", this.proxyErrors);
7794
+ super(t, e, i), this.proxyErrors = (r) => this.dest.emit("error", r), t.on("error", this.proxyErrors);
7795
7795
  }
7796
7796
  };
7797
7797
  var zr = (s3) => !!s3.objectMode;
@@ -8043,6 +8043,7 @@ var A = class extends Oi {
8043
8043
  });
8044
8044
  }, throw: e, return: e, [Symbol.asyncIterator]() {
8045
8045
  return this;
8046
+ }, [Symbol.asyncDispose]: async () => {
8046
8047
  } };
8047
8048
  }
8048
8049
  [Symbol.iterator]() {
@@ -8054,6 +8055,7 @@ var A = class extends Oi {
8054
8055
  };
8055
8056
  return this.once("end", e), this.once(yi, e), this.once(w, e), { next: i, throw: e, return: e, [Symbol.iterator]() {
8056
8057
  return this;
8058
+ }, [Symbol.dispose]: () => {
8057
8059
  } };
8058
8060
  }
8059
8061
  destroy(t) {
@@ -10117,16 +10119,15 @@ var qt = class extends st {
10117
10119
  [ps](t, e) {
10118
10120
  let i = t[e], { type: r } = t;
10119
10121
  if (!i || this.preservePaths) return true;
10120
- let n = i.split("/");
10121
- if (n.includes("..") || Oe && /^[a-z]:\.\.$/i.test(n[0] ?? "")) {
10122
+ let [n, o] = ce(i), h = o.replace(/\\/g, "/").split("/");
10123
+ if (h.includes("..") || Oe && /^[a-z]:\.\.$/i.test(h[0] ?? "")) {
10122
10124
  if (e === "path" || r === "Link") return this.warn("TAR_ENTRY_ERROR", `${e} contains '..'`, { entry: t, [e]: i }), false;
10123
10125
  {
10124
10126
  let a = R.posix.dirname(t.path), l = R.posix.normalize(R.posix.join(a, i));
10125
10127
  if (l.startsWith("../") || l === "..") return this.warn("TAR_ENTRY_ERROR", `${e} escapes extraction directory`, { entry: t, [e]: i }), false;
10126
10128
  }
10127
10129
  }
10128
- let [o, h] = ce(i);
10129
- return o && (t[e] = String(h), this.warn("TAR_ENTRY_INFO", `stripping ${o} from absolute ${e}`, { entry: t, [e]: i })), true;
10130
+ return n && (t[e] = String(o), this.warn("TAR_ENTRY_INFO", `stripping ${n} from absolute ${e}`, { entry: t, [e]: i })), true;
10130
10131
  }
10131
10132
  [_r](t) {
10132
10133
  let e = f(t.path), i = e.split("/");
@@ -11478,7 +11479,7 @@ function* outdatedEngines(pkg, pkgAst, ignoreNodeVersion) {
11478
11479
  if (!descriptor.eol) {
11479
11480
  break;
11480
11481
  }
11481
- const expanded = version2.replace(/[xX*]/g, "999");
11482
+ const expanded = version2.replaceAll(/[*Xx]/g, "999");
11482
11483
  if (!import_semver2.default.satisfies(expanded, range)) {
11483
11484
  continue;
11484
11485
  }
@@ -11711,13 +11712,14 @@ var ValidationError = class extends Error {
11711
11712
  validator;
11712
11713
  constructor(validator, message) {
11713
11714
  super(message);
11715
+ this.name = "ValidationError";
11714
11716
  this.validator = validator;
11715
11717
  }
11716
11718
  };
11717
11719
 
11718
11720
  // src/validators/non-empty.ts
11719
11721
  function isEmpty(value) {
11720
- return typeof value === "undefined" || value === null || value === "";
11722
+ return value === void 0 || value === null || value === "";
11721
11723
  }
11722
11724
  function nonempty(key, value) {
11723
11725
  if (isEmpty(value)) {
@@ -11745,7 +11747,7 @@ function nonempty(key, value) {
11745
11747
 
11746
11748
  // src/validators/present.ts
11747
11749
  function present(key, value) {
11748
- if (typeof value === "undefined" || value === null) {
11750
+ if (value === void 0 || value === null) {
11749
11751
  throw new ValidationError(present.name, `"${key}" must be set`);
11750
11752
  }
11751
11753
  }
@@ -11843,7 +11845,7 @@ function validRepoUrl(key, value) {
11843
11845
 
11844
11846
  // src/validators/valid-url.ts
11845
11847
  function validUrl(key, value) {
11846
- if (typeof value === "string" && /^https:\/\/.+$/.exec(value)) {
11848
+ if (typeof value === "string" && /^https:\/\/.+$/.test(value)) {
11847
11849
  return;
11848
11850
  } else if (value && typeof value === "object" && "url" in value) {
11849
11851
  validUrl(`${key}.url`, value.url);
@@ -11905,7 +11907,7 @@ function verifyDependencies(pkg, pkgAst, options) {
11905
11907
  if (options.allowedDependencies.has(dependency)) {
11906
11908
  continue;
11907
11909
  }
11908
- if (options.allowTypesDependencies && /^@types\//.exec(dependency)) {
11910
+ if (options.allowTypesDependencies && dependency.startsWith("@types/")) {
11909
11911
  continue;
11910
11912
  }
11911
11913
  if (isDisallowedDependency(pkg, dependency)) {
@@ -11986,7 +11988,7 @@ async function verifyShebang(pkg, tarball) {
11986
11988
  const contents = await getFileContent(tarball, binaries);
11987
11989
  for (const [filePath, content] of Object.entries(contents)) {
11988
11990
  const text = content.toString("utf-8");
11989
- if (/^#!.+?\r?\n/.exec(text)) {
11991
+ if (/^#!.+?\r?\n/.test(text)) {
11990
11992
  continue;
11991
11993
  }
11992
11994
  results.push({
@@ -12109,7 +12111,7 @@ async function run() {
12109
12111
  help: "ignore error for outdated node version (restricted to MAJOR version if given)"
12110
12112
  });
12111
12113
  const args = parser.parse_args();
12112
- const allowedDependencies2 = new Set(args.allow_dependency.map((it2) => it2.split(",")).flat());
12114
+ const allowedDependencies2 = new Set(args.allow_dependency.flatMap((it2) => it2.split(",")));
12113
12115
  if (args.cache) {
12114
12116
  await setCacheDirecory(args.cache);
12115
12117
  }
@@ -12157,10 +12159,7 @@ async function run() {
12157
12159
  }, 0);
12158
12160
  process.exitCode = totalErrors > 0 ? 1 : 0;
12159
12161
  }
12160
- run().catch((err) => {
12161
- console.error(err);
12162
- process.exitCode = 1;
12163
- });
12162
+ await run();
12164
12163
  /*! Bundled license information:
12165
12164
 
12166
12165
  tmp/lib/tmp.js: