@forsakringskassan/commitlint-config 3.1.2 → 3.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.
Files changed (2) hide show
  1. package/dist/install.js +28 -19
  2. package/package.json +1 -1
package/dist/install.js CHANGED
@@ -480,10 +480,11 @@ var require_is_ci = __commonJS({
480
480
  });
481
481
 
482
482
  // src/install.ts
483
+ var import_is_ci = __toESM(require_is_ci(), 1);
484
+ import * as fsp from "fs/promises";
485
+ import { spawnSync } from "node:child_process";
483
486
  import fs2 from "node:fs";
484
487
  import path4 from "node:path";
485
- import { spawnSync } from "node:child_process";
486
- import * as fsp from "fs/promises";
487
488
 
488
489
  // node_modules/nano-spawn/source/context.js
489
490
  import process2 from "node:process";
@@ -491,7 +492,13 @@ import { stripVTControlCharacters } from "node:util";
491
492
  var getContext = (raw) => ({
492
493
  start: process2.hrtime.bigint(),
493
494
  command: raw.map((part) => getCommandPart(stripVTControlCharacters(part))).join(" "),
494
- state: { stdout: "", stderr: "", output: "" }
495
+ state: {
496
+ stdout: "",
497
+ stderr: "",
498
+ output: "",
499
+ isIterating: {},
500
+ nonIterable: [false, false]
501
+ }
495
502
  });
496
503
  var getCommandPart = (part) => /[^\w./-]/.test(part) ? `'${part.replaceAll("'", "'\\''")}'` : part;
497
504
 
@@ -649,8 +656,8 @@ var concatenateShell = (file, commandArguments, options) => options.shell && com
649
656
  var bufferOutput = (stream2, { state }, streamName) => {
650
657
  if (stream2) {
651
658
  stream2.setEncoding("utf8");
652
- if (!state.isIterating) {
653
- state.isIterating = false;
659
+ if (!state.isIterating[streamName]) {
660
+ state.isIterating[streamName] = false;
654
661
  stream2.on("data", (chunk) => {
655
662
  state[streamName] += chunk;
656
663
  state.output += chunk;
@@ -695,16 +702,20 @@ var closeStdin = async (nodeChildProcess) => {
695
702
 
696
703
  // node_modules/nano-spawn/source/iterable.js
697
704
  import * as readline from "node:readline/promises";
698
- var lineIterator = async function* (subprocess, { state }, streamName) {
699
- if (state.isIterating === false) {
705
+ var lineIterator = async function* (subprocess, { state }, streamName, index) {
706
+ if (state.isIterating[streamName] === false) {
700
707
  throw new Error(`The subprocess must be iterated right away, for example:
701
708
  for await (const line of spawn(...)) { ... }`);
702
709
  }
703
- state.isIterating = true;
710
+ state.isIterating[streamName] = true;
704
711
  try {
705
712
  const { [streamName]: stream2 } = await subprocess.nodeChildProcess;
706
713
  if (!stream2) {
707
- return;
714
+ state.nonIterable[index] = true;
715
+ const message = state.nonIterable.every(Boolean) ? "either the option `stdout` or `stderr`" : `the option \`${streamName}\``;
716
+ throw new TypeError(
717
+ `The subprocess cannot be iterated unless ${message} is 'pipe'.`
718
+ );
708
719
  }
709
720
  handleErrors(subprocess);
710
721
  yield* readline.createInterface({ input: stream2 });
@@ -718,11 +729,11 @@ var handleErrors = async (subprocess) => {
718
729
  } catch {
719
730
  }
720
731
  };
721
- var combineAsyncIterators = async function* (...iterators) {
732
+ var combineAsyncIterators = async function* ({ state }, ...iterators) {
722
733
  try {
723
734
  let promises = [];
724
735
  while (iterators.length > 0) {
725
- promises = iterators.map((iterator2, index2) => promises[index2] ?? getNext(iterator2));
736
+ promises = iterators.map((iterator2, index2) => promises[index2] ?? getNext(iterator2, index2, state));
726
737
  const [{ value, done }, index] = await Promise.race(promises.map((promise, index2) => Promise.all([promise, index2])));
727
738
  const [iterator] = iterators.splice(index, 1);
728
739
  promises.splice(index, 1);
@@ -735,13 +746,14 @@ var combineAsyncIterators = async function* (...iterators) {
735
746
  await Promise.all(iterators.map((iterator) => iterator.return()));
736
747
  }
737
748
  };
738
- var getNext = async (iterator) => {
749
+ var getNext = async (iterator, index, { nonIterable }) => {
739
750
  try {
740
751
  return await iterator.next();
741
752
  } catch (error) {
742
- await iterator.throw(error);
753
+ return shouldIgnoreError(nonIterable, index) ? iterator.return() : iterator.throw(error);
743
754
  }
744
755
  };
756
+ var shouldIgnoreError = (nonIterable, index) => nonIterable.every(Boolean) ? index !== nonIterable.length - 1 : nonIterable[index];
745
757
 
746
758
  // node_modules/nano-spawn/source/index.js
747
759
  function spawn2(file, second, third, previous) {
@@ -752,20 +764,17 @@ function spawn2(file, second, third, previous) {
752
764
  let subprocess = getResult(nodeChildProcess, spawnOptions, context);
753
765
  Object.assign(subprocess, { nodeChildProcess });
754
766
  subprocess = previous ? handlePipe([previous, subprocess]) : subprocess;
755
- const stdout = lineIterator(subprocess, context, "stdout");
756
- const stderr = lineIterator(subprocess, context, "stderr");
767
+ const stdout = lineIterator(subprocess, context, "stdout", 0);
768
+ const stderr = lineIterator(subprocess, context, "stderr", 1);
757
769
  return Object.assign(subprocess, {
758
770
  nodeChildProcess,
759
771
  stdout,
760
772
  stderr,
761
- [Symbol.asyncIterator]: () => combineAsyncIterators(stdout, stderr),
773
+ [Symbol.asyncIterator]: () => combineAsyncIterators(context, stdout, stderr),
762
774
  pipe: (file2, second2, third2) => spawn2(file2, second2, third2, subprocess)
763
775
  });
764
776
  }
765
777
 
766
- // src/install.ts
767
- var import_is_ci = __toESM(require_is_ci(), 1);
768
-
769
778
  // node_modules/@isaacs/balanced-match/dist/esm/index.js
770
779
  var balanced = (a, b, str) => {
771
780
  const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/commitlint-config",
3
- "version": "3.1.2",
3
+ "version": "3.2.0",
4
4
  "description": "FK commitlint shareable config",
5
5
  "keywords": [
6
6
  "commitlint"