dsh-diff-approval 0.13.0 → 0.13.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/lib/client.js +115 -107
- package/lib/types/client/whole-file-diff.d.ts +9 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -652,11 +652,23 @@ window.__ModuleLoader__.load({
|
|
|
652
652
|
* @param newText - the file content after the pending change.
|
|
653
653
|
* @returns the complete row list with totals.
|
|
654
654
|
*/
|
|
655
|
+
/**
|
|
656
|
+
* Normalize content for equality: line endings → `\n`, and a single trailing
|
|
657
|
+
* newline is a terminator rather than a line. The result is the line bodies
|
|
658
|
+
* joined by `\n` with no trailing newline, so representation-only differences
|
|
659
|
+
* (EOL style, trailing-newline presence) compare equal.
|
|
660
|
+
* @param text - the content to normalize.
|
|
661
|
+
* @returns the normalized line bodies.
|
|
662
|
+
*/
|
|
663
|
+
function contentKey(text) {
|
|
664
|
+
const normalized = text.replace(/\r\n?/g, "\n");
|
|
665
|
+
return normalized.endsWith("\n") ? normalized.slice(0, -1) : normalized;
|
|
666
|
+
}
|
|
655
667
|
function computeWholeFileDiff(oldText, newText) {
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
if (
|
|
659
|
-
rows: contentLines(
|
|
668
|
+
const oldNorm = oldText.replace(/\r\n?/g, "\n");
|
|
669
|
+
const newNorm = newText.replace(/\r\n?/g, "\n");
|
|
670
|
+
if (contentKey(oldNorm) === contentKey(newNorm)) return {
|
|
671
|
+
rows: contentLines(oldNorm).map((text, index) => ({
|
|
660
672
|
kind: "context",
|
|
661
673
|
text,
|
|
662
674
|
oldLine: index + 1,
|
|
@@ -665,10 +677,9 @@ window.__ModuleLoader__.load({
|
|
|
665
677
|
removed: 0,
|
|
666
678
|
added: 0
|
|
667
679
|
};
|
|
668
|
-
const oldLines = contentLines(
|
|
669
|
-
const newLines = contentLines(
|
|
670
|
-
const
|
|
671
|
-
const patch = structuredPatch("", "", oldText, newText, void 0, void 0, { context });
|
|
680
|
+
const oldLines = contentLines(oldNorm);
|
|
681
|
+
const newLines = contentLines(newNorm);
|
|
682
|
+
const patch = structuredPatch("", "", oldNorm, newNorm, void 0, void 0, { context: Math.max(1, oldLines.length, newLines.length) });
|
|
672
683
|
const rows = [];
|
|
673
684
|
let removed = 0;
|
|
674
685
|
let added = 0;
|
|
@@ -11921,115 +11932,115 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
11921
11932
|
document.head.appendChild(tag);
|
|
11922
11933
|
}
|
|
11923
11934
|
var PendingPanel_module_css_default = {
|
|
11924
|
-
"
|
|
11925
|
-
"searchBar": "F1KBNa_searchBar",
|
|
11926
|
-
"diffPath": "F1KBNa_diffPath",
|
|
11927
|
-
"flexSpacer": "F1KBNa_flexSpacer",
|
|
11928
|
-
"splitRdel": "F1KBNa_splitRdel",
|
|
11929
|
-
"settingsRowTitle": "F1KBNa_settingsRowTitle",
|
|
11930
|
-
"settingsSelectorChevron": "F1KBNa_settingsSelectorChevron",
|
|
11931
|
-
"group": "F1KBNa_group",
|
|
11932
|
-
"iconAction": "F1KBNa_iconAction",
|
|
11933
|
-
"blockFlash": "F1KBNa_blockFlash",
|
|
11934
|
-
"overviewRuler": "F1KBNa_overviewRuler",
|
|
11935
|
-
"row": "F1KBNa_row",
|
|
11936
|
-
"close": "F1KBNa_close",
|
|
11937
|
-
"settingsRowDesc": "F1KBNa_settingsRowDesc",
|
|
11938
|
-
"states": "F1KBNa_states",
|
|
11939
|
-
"code": "F1KBNa_code",
|
|
11940
|
-
"kindTag": "F1KBNa_kindTag",
|
|
11941
|
-
"badgeCount": "F1KBNa_badgeCount",
|
|
11942
|
-
"badge": "F1KBNa_badge",
|
|
11943
|
-
"emptyState": "F1KBNa_emptyState",
|
|
11944
|
-
"rowPath": "F1KBNa_rowPath",
|
|
11945
|
-
"notice": "F1KBNa_notice",
|
|
11935
|
+
"title": "F1KBNa_title",
|
|
11946
11936
|
"diffBodyWrap": "F1KBNa_diffBodyWrap",
|
|
11947
|
-
"missingHint": "F1KBNa_missingHint",
|
|
11948
|
-
"resizeHandle": "F1KBNa_resizeHandle",
|
|
11949
|
-
"splitRoot": "F1KBNa_splitRoot",
|
|
11950
|
-
"expandExpanded": "F1KBNa_expandExpanded",
|
|
11951
|
-
"splitLadd": "F1KBNa_splitLadd",
|
|
11952
|
-
"settingsPage": "F1KBNa_settingsPage",
|
|
11953
|
-
"fullscreenBackdrop": "F1KBNa_fullscreenBackdrop",
|
|
11954
|
-
"layer": "F1KBNa_layer",
|
|
11955
11937
|
"settingsSelector": "F1KBNa_settingsSelector",
|
|
11956
|
-
"
|
|
11957
|
-
"importButton": "F1KBNa_importButton",
|
|
11958
|
-
"addCount": "F1KBNa_addCount",
|
|
11959
|
-
"context": "F1KBNa_context",
|
|
11960
|
-
"header": "F1KBNa_header",
|
|
11961
|
-
"gutter": "F1KBNa_gutter",
|
|
11962
|
-
"confirmActions": "F1KBNa_confirmActions",
|
|
11963
|
-
"searchInput": "F1KBNa_searchInput",
|
|
11964
|
-
"importNote": "F1KBNa_importNote",
|
|
11965
|
-
"noticeText": "F1KBNa_noticeText",
|
|
11966
|
-
"wrap": "F1KBNa_wrap",
|
|
11967
|
-
"splitHScrollRow": "F1KBNa_splitHScrollRow",
|
|
11968
|
-
"blockActions": "F1KBNa_blockActions",
|
|
11969
|
-
"splitHScroll": "F1KBNa_splitHScroll",
|
|
11970
|
-
"splitHScrollFill": "F1KBNa_splitHScrollFill",
|
|
11971
|
-
"fileListFloat": "F1KBNa_fileListFloat",
|
|
11938
|
+
"confirmBackdrop": "F1KBNa_confirmBackdrop",
|
|
11972
11939
|
"noteCentered": "F1KBNa_noteCentered",
|
|
11940
|
+
"actionError": "F1KBNa_actionError",
|
|
11941
|
+
"rows": "F1KBNa_rows",
|
|
11973
11942
|
"diffActions": "F1KBNa_diffActions",
|
|
11974
|
-
"searchCount": "F1KBNa_searchCount",
|
|
11975
|
-
"add": "F1KBNa_add",
|
|
11976
|
-
"diffStats": "F1KBNa_diffStats",
|
|
11977
|
-
"langLabel": "F1KBNa_langLabel",
|
|
11978
|
-
"detailEmpty": "F1KBNa_detailEmpty",
|
|
11979
|
-
"actionPrimary": "F1KBNa_actionPrimary",
|
|
11980
11943
|
"diffBody": "F1KBNa_diffBody",
|
|
11981
|
-
"
|
|
11982
|
-
"
|
|
11983
|
-
"
|
|
11984
|
-
"
|
|
11985
|
-
"
|
|
11986
|
-
"
|
|
11987
|
-
"
|
|
11988
|
-
"rowFailed": "F1KBNa_rowFailed",
|
|
11989
|
-
"listScroll": "F1KBNa_listScroll",
|
|
11990
|
-
"actionError": "F1KBNa_actionError",
|
|
11991
|
-
"headerActions": "F1KBNa_headerActions",
|
|
11992
|
-
"confirmCard": "F1KBNa_confirmCard",
|
|
11944
|
+
"note": "F1KBNa_note",
|
|
11945
|
+
"diffFlash": "F1KBNa_diffFlash",
|
|
11946
|
+
"overviewRuler": "F1KBNa_overviewRuler",
|
|
11947
|
+
"iconAction": "F1KBNa_iconAction",
|
|
11948
|
+
"context": "F1KBNa_context",
|
|
11949
|
+
"panel": "F1KBNa_panel",
|
|
11950
|
+
"langSelect": "F1KBNa_langSelect",
|
|
11993
11951
|
"actionQuietDisabled": "F1KBNa_actionQuietDisabled",
|
|
11994
|
-
"
|
|
11995
|
-
"
|
|
11996
|
-
"
|
|
11997
|
-
"
|
|
11998
|
-
"
|
|
11999
|
-
"detail": "F1KBNa_detail",
|
|
12000
|
-
"splitRadd": "F1KBNa_splitRadd",
|
|
12001
|
-
"footerButtons": "F1KBNa_footerButtons",
|
|
11952
|
+
"wrapActive": "F1KBNa_wrapActive",
|
|
11953
|
+
"settingsRowDesc": "F1KBNa_settingsRowDesc",
|
|
11954
|
+
"confirmActions": "F1KBNa_confirmActions",
|
|
11955
|
+
"actionPrimary": "F1KBNa_actionPrimary",
|
|
11956
|
+
"rowFailed": "F1KBNa_rowFailed",
|
|
12002
11957
|
"expand": "F1KBNa_expand",
|
|
12003
|
-
"
|
|
11958
|
+
"blockPosition": "F1KBNa_blockPosition",
|
|
11959
|
+
"vSpacer": "F1KBNa_vSpacer",
|
|
11960
|
+
"rowPath": "F1KBNa_rowPath",
|
|
11961
|
+
"wrap": "F1KBNa_wrap",
|
|
12004
11962
|
"markerAdd": "F1KBNa_markerAdd",
|
|
12005
|
-
"
|
|
12006
|
-
"line": "F1KBNa_line",
|
|
12007
|
-
"wrapActive": "F1KBNa_wrapActive",
|
|
12008
|
-
"diffBodySplit": "F1KBNa_diffBodySplit",
|
|
11963
|
+
"splitHScroll": "F1KBNa_splitHScroll",
|
|
12009
11964
|
"delCount": "F1KBNa_delCount",
|
|
11965
|
+
"subline": "F1KBNa_subline",
|
|
11966
|
+
"detail": "F1KBNa_detail",
|
|
11967
|
+
"footerButtons": "F1KBNa_footerButtons",
|
|
11968
|
+
"splitRoot": "F1KBNa_splitRoot",
|
|
11969
|
+
"splitCol": "F1KBNa_splitCol",
|
|
11970
|
+
"splitHScrollFill": "F1KBNa_splitHScrollFill",
|
|
11971
|
+
"splitLadd": "F1KBNa_splitLadd",
|
|
11972
|
+
"code": "F1KBNa_code",
|
|
11973
|
+
"splitRadd": "F1KBNa_splitRadd",
|
|
11974
|
+
"settingsRowText": "F1KBNa_settingsRowText",
|
|
11975
|
+
"split": "F1KBNa_split",
|
|
11976
|
+
"action": "F1KBNa_action",
|
|
11977
|
+
"kindHint": "F1KBNa_kindHint",
|
|
11978
|
+
"layer": "F1KBNa_layer",
|
|
11979
|
+
"badgeCount": "F1KBNa_badgeCount",
|
|
11980
|
+
"diffHeader": "F1KBNa_diffHeader",
|
|
11981
|
+
"diffStats": "F1KBNa_diffStats",
|
|
11982
|
+
"addCount": "F1KBNa_addCount",
|
|
12010
11983
|
"confirmText": "F1KBNa_confirmText",
|
|
12011
|
-
"
|
|
12012
|
-
"
|
|
12013
|
-
"settingsRow": "F1KBNa_settingsRow",
|
|
12014
|
-
"diffFlash": "F1KBNa_diffFlash",
|
|
11984
|
+
"settingsPage": "F1KBNa_settingsPage",
|
|
11985
|
+
"searchBar": "F1KBNa_searchBar",
|
|
12015
11986
|
"del": "F1KBNa_del",
|
|
12016
|
-
"title": "F1KBNa_title",
|
|
12017
11987
|
"statusAction": "F1KBNa_statusAction",
|
|
12018
|
-
"
|
|
11988
|
+
"splitHScrollRow": "F1KBNa_splitHScrollRow",
|
|
11989
|
+
"splitLdel": "F1KBNa_splitLdel",
|
|
11990
|
+
"flexSpacer": "F1KBNa_flexSpacer",
|
|
12019
11991
|
"fileList": "F1KBNa_fileList",
|
|
12020
|
-
"
|
|
12021
|
-
"
|
|
12022
|
-
"
|
|
12023
|
-
"
|
|
11992
|
+
"notice": "F1KBNa_notice",
|
|
11993
|
+
"bulkActions": "F1KBNa_bulkActions",
|
|
11994
|
+
"missingHint": "F1KBNa_missingHint",
|
|
11995
|
+
"group": "F1KBNa_group",
|
|
11996
|
+
"markerDel": "F1KBNa_markerDel",
|
|
11997
|
+
"readError": "F1KBNa_readError",
|
|
11998
|
+
"diffPath": "F1KBNa_diffPath",
|
|
11999
|
+
"settingsSelectorChevron": "F1KBNa_settingsSelectorChevron",
|
|
12000
|
+
"overviewMarker": "F1KBNa_overviewMarker",
|
|
12001
|
+
"add": "F1KBNa_add",
|
|
12024
12002
|
"statusBar": "F1KBNa_statusBar",
|
|
12025
|
-
"
|
|
12026
|
-
"
|
|
12027
|
-
"
|
|
12028
|
-
"
|
|
12003
|
+
"emptyState": "F1KBNa_emptyState",
|
|
12004
|
+
"hint": "F1KBNa_hint",
|
|
12005
|
+
"expandExpanded": "F1KBNa_expandExpanded",
|
|
12006
|
+
"close": "F1KBNa_close",
|
|
12007
|
+
"searchInput": "F1KBNa_searchInput",
|
|
12008
|
+
"lines": "F1KBNa_lines",
|
|
12009
|
+
"badgeLabel": "F1KBNa_badgeLabel",
|
|
12010
|
+
"noticeText": "F1KBNa_noticeText",
|
|
12011
|
+
"resizeHandle": "F1KBNa_resizeHandle",
|
|
12012
|
+
"blockActions": "F1KBNa_blockActions",
|
|
12013
|
+
"langLabel": "F1KBNa_langLabel",
|
|
12014
|
+
"noticeButton": "F1KBNa_noticeButton",
|
|
12015
|
+
"confirmCard": "F1KBNa_confirmCard",
|
|
12016
|
+
"headerActions": "F1KBNa_headerActions",
|
|
12017
|
+
"settingsRow": "F1KBNa_settingsRow",
|
|
12018
|
+
"importButton": "F1KBNa_importButton",
|
|
12029
12019
|
"rowHead": "F1KBNa_rowHead",
|
|
12030
|
-
"
|
|
12031
|
-
"
|
|
12032
|
-
"
|
|
12020
|
+
"searchCount": "F1KBNa_searchCount",
|
|
12021
|
+
"diff": "F1KBNa_diff",
|
|
12022
|
+
"row": "F1KBNa_row",
|
|
12023
|
+
"line": "F1KBNa_line",
|
|
12024
|
+
"gutter": "F1KBNa_gutter",
|
|
12025
|
+
"splitCols": "F1KBNa_splitCols",
|
|
12026
|
+
"importNote": "F1KBNa_importNote",
|
|
12027
|
+
"splitDivider": "F1KBNa_splitDivider",
|
|
12028
|
+
"listScroll": "F1KBNa_listScroll",
|
|
12029
|
+
"rail": "F1KBNa_rail",
|
|
12030
|
+
"missing": "F1KBNa_missing",
|
|
12031
|
+
"rowMeta": "F1KBNa_rowMeta",
|
|
12032
|
+
"fileListFloat": "F1KBNa_fileListFloat",
|
|
12033
|
+
"badge": "F1KBNa_badge",
|
|
12034
|
+
"divergedHint": "F1KBNa_divergedHint",
|
|
12035
|
+
"diffBodySplit": "F1KBNa_diffBodySplit",
|
|
12036
|
+
"fullscreenBackdrop": "F1KBNa_fullscreenBackdrop",
|
|
12037
|
+
"header": "F1KBNa_header",
|
|
12038
|
+
"kindTag": "F1KBNa_kindTag",
|
|
12039
|
+
"settingsRowTitle": "F1KBNa_settingsRowTitle",
|
|
12040
|
+
"blockFlash": "F1KBNa_blockFlash",
|
|
12041
|
+
"detailEmpty": "F1KBNa_detailEmpty",
|
|
12042
|
+
"states": "F1KBNa_states",
|
|
12043
|
+
"splitRdel": "F1KBNa_splitRdel"
|
|
12033
12044
|
};
|
|
12034
12045
|
//#endregion
|
|
12035
12046
|
//#region lib/types/client/PendingPanel.js
|
|
@@ -15363,11 +15374,8 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
15363
15374
|
const snapshot = store.getSnapshot();
|
|
15364
15375
|
for (const file of snapshot.files) {
|
|
15365
15376
|
const previous = lastContent.get(file.path);
|
|
15366
|
-
if (previous
|
|
15367
|
-
|
|
15368
|
-
remap(file.path, previous, file.newText, snapshot.workspacePath);
|
|
15369
|
-
lastContent.set(file.path, file.newText);
|
|
15370
|
-
}
|
|
15377
|
+
if (previous !== void 0 && contentKey(previous) !== contentKey(file.newText)) remap(file.path, previous, file.newText, snapshot.workspacePath);
|
|
15378
|
+
lastContent.set(file.path, file.newText);
|
|
15371
15379
|
}
|
|
15372
15380
|
for (const path of [...lastContent.keys()]) if (!snapshot.files.some((file) => file.path === path)) lastContent.delete(path);
|
|
15373
15381
|
};
|
|
@@ -37,4 +37,13 @@ export interface WholeFileDiff {
|
|
|
37
37
|
* @param newText - the file content after the pending change.
|
|
38
38
|
* @returns the complete row list with totals.
|
|
39
39
|
*/
|
|
40
|
+
/**
|
|
41
|
+
* Normalize content for equality: line endings → `\n`, and a single trailing
|
|
42
|
+
* newline is a terminator rather than a line. The result is the line bodies
|
|
43
|
+
* joined by `\n` with no trailing newline, so representation-only differences
|
|
44
|
+
* (EOL style, trailing-newline presence) compare equal.
|
|
45
|
+
* @param text - the content to normalize.
|
|
46
|
+
* @returns the normalized line bodies.
|
|
47
|
+
*/
|
|
48
|
+
export declare function contentKey(text: string): string;
|
|
40
49
|
export declare function computeWholeFileDiff(oldText: string, newText: string): WholeFileDiff;
|
package/package.json
CHANGED