watskeburt 4.1.0 → 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/cli.js +1 -1
- package/dist/format/format.js +1 -4
- package/dist/format/regex.js +1 -1
- package/dist/git-primitives.js +1 -1
- package/dist/main.js +1 -1
- package/dist/parse-diff-lines.js +2 -2
- package/dist/parse-status-lines.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/types/watskeburt.d.ts +3 -1
package/dist/cli.js
CHANGED
package/dist/format/format.js
CHANGED
|
@@ -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
|
}
|
package/dist/format/regex.js
CHANGED
|
@@ -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("|");
|
package/dist/git-primitives.js
CHANGED
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
|
|
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),
|
package/dist/parse-diff-lines.js
CHANGED
|
@@ -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
|
|
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 =
|
|
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 =
|
|
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
|
+
export const VERSION = "4.2.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "watskeburt",
|
|
3
|
-
"version": "4.
|
|
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
|
|
51
|
+
"test": "echo see github for test, build and analysis scripts"
|
|
52
52
|
}
|
|
53
53
|
}
|
package/types/watskeburt.d.ts
CHANGED
|
@@ -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
|
}
|