npm-pkg-lint 4.1.2 → 4.2.0

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
@@ -7511,6 +7511,7 @@ var git_default = regexp5;
7511
7511
 
7512
7512
  // src/blacklist/jest.ts
7513
7513
  var regexp6 = [
7514
+ directory("__fixtures__"),
7514
7515
  directory("__snapshots__"),
7515
7516
  directory("__tests__"),
7516
7517
  extension(".snap"),
@@ -7532,7 +7533,8 @@ var regexp7 = [
7532
7533
  filename(".npmignore"),
7533
7534
  filename(".npmrc"),
7534
7535
  filename(".nvmrc"),
7535
- filename("lerna.json")
7536
+ filename("lerna.json"),
7537
+ filename("yarn.lock")
7536
7538
  ];
7537
7539
  var node_default = regexp7;
7538
7540
 
@@ -15479,7 +15481,13 @@ import { stripVTControlCharacters } from "node:util";
15479
15481
  var getContext = (raw2) => ({
15480
15482
  start: process3.hrtime.bigint(),
15481
15483
  command: raw2.map((part) => getCommandPart(stripVTControlCharacters(part))).join(" "),
15482
- state: { stdout: "", stderr: "", output: "" }
15484
+ state: {
15485
+ stdout: "",
15486
+ stderr: "",
15487
+ output: "",
15488
+ isIterating: {},
15489
+ nonIterable: [false, false]
15490
+ }
15483
15491
  });
15484
15492
  var getCommandPart = (part) => /[^\w./-]/.test(part) ? `'${part.replaceAll("'", "'\\''")}'` : part;
15485
15493
 
@@ -15637,8 +15645,8 @@ var concatenateShell = (file, commandArguments, options) => options.shell && com
15637
15645
  var bufferOutput = (stream, { state }, streamName) => {
15638
15646
  if (stream) {
15639
15647
  stream.setEncoding("utf8");
15640
- if (!state.isIterating) {
15641
- state.isIterating = false;
15648
+ if (!state.isIterating[streamName]) {
15649
+ state.isIterating[streamName] = false;
15642
15650
  stream.on("data", (chunk) => {
15643
15651
  state[streamName] += chunk;
15644
15652
  state.output += chunk;
@@ -15683,16 +15691,20 @@ var closeStdin = async (nodeChildProcess) => {
15683
15691
 
15684
15692
  // node_modules/nano-spawn/source/iterable.js
15685
15693
  import * as readline from "node:readline/promises";
15686
- var lineIterator = async function* (subprocess, { state }, streamName) {
15687
- if (state.isIterating === false) {
15694
+ var lineIterator = async function* (subprocess, { state }, streamName, index) {
15695
+ if (state.isIterating[streamName] === false) {
15688
15696
  throw new Error(`The subprocess must be iterated right away, for example:
15689
15697
  for await (const line of spawn(...)) { ... }`);
15690
15698
  }
15691
- state.isIterating = true;
15699
+ state.isIterating[streamName] = true;
15692
15700
  try {
15693
15701
  const { [streamName]: stream } = await subprocess.nodeChildProcess;
15694
15702
  if (!stream) {
15695
- return;
15703
+ state.nonIterable[index] = true;
15704
+ const message = state.nonIterable.every(Boolean) ? "either the option `stdout` or `stderr`" : `the option \`${streamName}\``;
15705
+ throw new TypeError(
15706
+ `The subprocess cannot be iterated unless ${message} is 'pipe'.`
15707
+ );
15696
15708
  }
15697
15709
  handleErrors(subprocess);
15698
15710
  yield* readline.createInterface({ input: stream });
@@ -15706,11 +15718,11 @@ var handleErrors = async (subprocess) => {
15706
15718
  } catch {
15707
15719
  }
15708
15720
  };
15709
- var combineAsyncIterators = async function* (...iterators) {
15721
+ var combineAsyncIterators = async function* ({ state }, ...iterators) {
15710
15722
  try {
15711
15723
  let promises = [];
15712
15724
  while (iterators.length > 0) {
15713
- promises = iterators.map((iterator2, index2) => promises[index2] ?? getNext(iterator2));
15725
+ promises = iterators.map((iterator2, index2) => promises[index2] ?? getNext(iterator2, index2, state));
15714
15726
  const [{ value, done }, index] = await Promise.race(promises.map((promise, index2) => Promise.all([promise, index2])));
15715
15727
  const [iterator] = iterators.splice(index, 1);
15716
15728
  promises.splice(index, 1);
@@ -15723,13 +15735,14 @@ var combineAsyncIterators = async function* (...iterators) {
15723
15735
  await Promise.all(iterators.map((iterator) => iterator.return()));
15724
15736
  }
15725
15737
  };
15726
- var getNext = async (iterator) => {
15738
+ var getNext = async (iterator, index, { nonIterable }) => {
15727
15739
  try {
15728
15740
  return await iterator.next();
15729
15741
  } catch (error) {
15730
- await iterator.throw(error);
15742
+ return shouldIgnoreError(nonIterable, index) ? iterator.return() : iterator.throw(error);
15731
15743
  }
15732
15744
  };
15745
+ var shouldIgnoreError = (nonIterable, index) => nonIterable.every(Boolean) ? index !== nonIterable.length - 1 : nonIterable[index];
15733
15746
 
15734
15747
  // node_modules/nano-spawn/source/index.js
15735
15748
  function spawn2(file, second, third, previous) {
@@ -15740,13 +15753,13 @@ function spawn2(file, second, third, previous) {
15740
15753
  let subprocess = getResult(nodeChildProcess, spawnOptions, context);
15741
15754
  Object.assign(subprocess, { nodeChildProcess });
15742
15755
  subprocess = previous ? handlePipe([previous, subprocess]) : subprocess;
15743
- const stdout = lineIterator(subprocess, context, "stdout");
15744
- const stderr = lineIterator(subprocess, context, "stderr");
15756
+ const stdout = lineIterator(subprocess, context, "stdout", 0);
15757
+ const stderr = lineIterator(subprocess, context, "stderr", 1);
15745
15758
  return Object.assign(subprocess, {
15746
15759
  nodeChildProcess,
15747
15760
  stdout,
15748
15761
  stderr,
15749
- [Symbol.asyncIterator]: () => combineAsyncIterators(stdout, stderr),
15762
+ [Symbol.asyncIterator]: () => combineAsyncIterators(context, stdout, stderr),
15750
15763
  pipe: (file2, second2, third2) => spawn2(file2, second2, third2, subprocess)
15751
15764
  });
15752
15765
  }