watskeburt 4.1.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/cli.js CHANGED
@@ -62,7 +62,7 @@ function getArguments(pArguments) {
62
62
  },
63
63
  extensions: {
64
64
  type: "string",
65
- short: "x",
65
+ short: "e",
66
66
  default:
67
67
  "cjs,cjsx,coffee,csx,cts,js,json,jsx,litcoffee,ls,mjs,mts,svelte,ts,tsx,vue,vuex",
68
68
  },
@@ -6,10 +6,7 @@ const OUTPUT_TYPE_TO_FUNCTION = new Map([
6
6
  ]);
7
7
  export function format(pChanges, pOutputType, pExtensions) {
8
8
  const lExtensions = new Set(
9
- pExtensions
10
- .split(",")
11
- .map((pExtension) => pExtension.trim())
12
- .map((pExtension) => `.${pExtension}`),
9
+ pExtensions.split(",").map((pExtension) => `.${pExtension.trim()}`),
13
10
  );
14
11
  return OUTPUT_TYPE_TO_FUNCTION.get(pOutputType)(pChanges, lExtensions);
15
12
  }
@@ -15,7 +15,7 @@ export default function formatAsRegex(
15
15
  .filter(
16
16
  (pChange) =>
17
17
  pChangeTypes.has(pChange.type) &&
18
- pExtensions.has(extname(pChange.name)),
18
+ (pExtensions.has(".*") || pExtensions.has(extname(pChange.name))),
19
19
  )
20
20
  .map(({ name }) => name.replace(/\\/g, "\\\\").replace(/\./g, "[.]"))
21
21
  .join("|");
@@ -60,7 +60,7 @@ function getGitResult(pArguments, pErrorMap, pSpawnFunction) {
60
60
  } else {
61
61
  pReject(
62
62
  new Error(
63
- pErrorMap.get(pCode ?? 0) ||
63
+ pErrorMap.get(pCode ?? 0) ??
64
64
  `internal git error: ${pCode} (${stringifyOutStream(lStdErrorData)})`,
65
65
  ),
66
66
  );
package/dist/main.js CHANGED
@@ -2,7 +2,7 @@ import { parseDiffLines } from "./parse-diff-lines.js";
2
2
  import { parseStatusLines } from "./parse-status-lines.js";
3
3
  import * as primitives from "./git-primitives.js";
4
4
  export async function list(pOptions) {
5
- const lOldRevision = pOptions?.oldRevision || (await primitives.getSHA());
5
+ const lOldRevision = pOptions?.oldRevision ?? (await primitives.getSHA());
6
6
  const lOptions = pOptions || {};
7
7
  const [lDiffLines, lStatusLines] = await Promise.all([
8
8
  primitives.getDiffLines(lOldRevision, pOptions?.newRevision),
@@ -1,7 +1,7 @@
1
1
  import { EOL } from "node:os";
2
2
  import { mapChangeType } from "./map-change-type.js";
3
3
  const DIFF_NAME_STATUS_LINE_PATTERN =
4
- /^(?<type>[ACDMRTUXB])(?<similarity>[0-9]{3})?[ \t]+(?<name>[^ \t]+)[ \t]*(?<newName>[^ \t]+)?$/;
4
+ /^(?<type>[ACDMRTUXB])(?<similarity>\d{3})?[ \t]+(?<name>[^ \t]+)[ \t]*(?<newName>[^ \t]+)?$/;
5
5
  export function parseDiffLines(pString) {
6
6
  return pString
7
7
  .split(EOL)
@@ -10,7 +10,7 @@ export function parseDiffLines(pString) {
10
10
  .filter(({ name, type }) => Boolean(name) && Boolean(type));
11
11
  }
12
12
  export function parseDiffLine(pString) {
13
- const lMatchResult = pString.match(DIFF_NAME_STATUS_LINE_PATTERN);
13
+ const lMatchResult = DIFF_NAME_STATUS_LINE_PATTERN.exec(pString);
14
14
  const lReturnValue = {};
15
15
  if (lMatchResult?.groups) {
16
16
  lReturnValue.type = mapChangeType(lMatchResult.groups.type);
@@ -10,7 +10,7 @@ export function parseStatusLines(pString) {
10
10
  .filter(({ name, type }) => Boolean(name) && Boolean(type));
11
11
  }
12
12
  export function parseStatusLine(pString) {
13
- const lMatchResult = pString.match(DIFF_SHORT_STATUS_LINE_PATTERN);
13
+ const lMatchResult = DIFF_SHORT_STATUS_LINE_PATTERN.exec(pString);
14
14
  const lReturnValue = {};
15
15
  if (lMatchResult?.groups) {
16
16
  const lStagedType = mapChangeType(lMatchResult.groups.stagedType);
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "4.1.0";
1
+ export const VERSION = "4.2.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "watskeburt",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "description": "List files changed since a git revision",
5
5
  "keywords": [
6
6
  "git",
@@ -48,6 +48,6 @@
48
48
  "node": "^18||>=20"
49
49
  },
50
50
  "scripts": {
51
- "test": "echo for test, build and static analysis scripts: see the github repository"
51
+ "test": "echo see github for test, build and analysis scripts"
52
52
  }
53
53
  }
@@ -54,7 +54,9 @@ export interface IFormatOptions extends IBaseOptions {
54
54
  outputType: "regex" | "json";
55
55
 
56
56
  /**
57
- * A comma-separated list of file extensions to include in the output
57
+ * A comma-separated list of file extensions to include in the output.
58
+ * When the list includes "*" all files are included. Currently applicable
59
+ * to the "regex" outputType only.
58
60
  */
59
61
  extensions: string;
60
62
  }