watskeburt 4.0.0 → 4.0.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/parse-diff-lines.js +3 -5
- package/dist/parse-status-lines.js +6 -12
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/parse-diff-lines.js
CHANGED
@@ -1,21 +1,19 @@
|
|
1
1
|
import { EOL } from "node:os";
|
2
2
|
import { changeChar2ChangeType } from "./map-change-type.js";
|
3
3
|
const DIFF_NAME_STATUS_LINE_PATTERN =
|
4
|
-
/^(?<
|
4
|
+
/^(?<type>[ACDMRTUXB])(?<similarity>[0-9]{3})?[ \t]+(?<name>[^ \t]+)[ \t]*(?<newName>[^ \t]+)?$/;
|
5
5
|
export function parseDiffLines(pString) {
|
6
6
|
return pString
|
7
7
|
.split(EOL)
|
8
8
|
.filter(Boolean)
|
9
9
|
.map(parseDiffLine)
|
10
|
-
.filter(
|
11
|
-
({ name, type: changeType }) => Boolean(name) && Boolean(changeType),
|
12
|
-
);
|
10
|
+
.filter(({ name, type }) => Boolean(name) && Boolean(type));
|
13
11
|
}
|
14
12
|
export function parseDiffLine(pString) {
|
15
13
|
const lMatchResult = pString.match(DIFF_NAME_STATUS_LINE_PATTERN);
|
16
14
|
const lReturnValue = {};
|
17
15
|
if (lMatchResult?.groups) {
|
18
|
-
lReturnValue.type = changeChar2ChangeType(lMatchResult.groups.
|
16
|
+
lReturnValue.type = changeChar2ChangeType(lMatchResult.groups.type);
|
19
17
|
if (lMatchResult.groups.newName) {
|
20
18
|
lReturnValue.name = lMatchResult.groups.newName;
|
21
19
|
lReturnValue.oldName = lMatchResult.groups.name;
|
@@ -1,30 +1,24 @@
|
|
1
1
|
import { EOL } from "node:os";
|
2
2
|
import { changeChar2ChangeType } from "./map-change-type.js";
|
3
3
|
const DIFF_SHORT_STATUS_LINE_PATTERN =
|
4
|
-
/^(?<
|
4
|
+
/^(?<stagedType>[ ACDMRTUXB?!])(?<unStagedType>[ ACDMRTUXB?!])[ \t]+(?<name>[^ \t]+)(( -> )(?<newName>[^ \t]+))?$/;
|
5
5
|
export function parseStatusLines(pString) {
|
6
6
|
return pString
|
7
7
|
.split(EOL)
|
8
8
|
.filter(Boolean)
|
9
9
|
.map(parseStatusLine)
|
10
|
-
.filter(
|
11
|
-
({ name, type: changeType }) => Boolean(name) && Boolean(changeType),
|
12
|
-
);
|
10
|
+
.filter(({ name, type }) => Boolean(name) && Boolean(type));
|
13
11
|
}
|
14
12
|
export function parseStatusLine(pString) {
|
15
13
|
const lMatchResult = pString.match(DIFF_SHORT_STATUS_LINE_PATTERN);
|
16
14
|
const lReturnValue = {};
|
17
15
|
if (lMatchResult?.groups) {
|
18
|
-
const
|
19
|
-
|
20
|
-
|
21
|
-
const lUnStagedChangeType = changeChar2ChangeType(
|
22
|
-
lMatchResult.groups.unStagedChangeType,
|
16
|
+
const lStagedType = changeChar2ChangeType(lMatchResult.groups.stagedType);
|
17
|
+
const lUnStagedType = changeChar2ChangeType(
|
18
|
+
lMatchResult.groups.unStagedType,
|
23
19
|
);
|
24
20
|
lReturnValue.type =
|
25
|
-
|
26
|
-
? lUnStagedChangeType
|
27
|
-
: lStagedChangeType;
|
21
|
+
lStagedType === "unmodified" ? lUnStagedType : lStagedType;
|
28
22
|
if (lMatchResult.groups.newName) {
|
29
23
|
lReturnValue.name = lMatchResult.groups.newName;
|
30
24
|
lReturnValue.oldName = lMatchResult.groups.name;
|
package/dist/version.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const VERSION = "4.0.
|
1
|
+
export const VERSION = "4.0.1";
|