ddd-ts-kit 0.113.0 → 0.113.2
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/CHANGELOG.md +47 -0
- package/dist/help/work-notes.d.ts.map +1 -1
- package/dist/help/work-notes.js +7 -2
- package/dist/help/work-notes.js.map +1 -1
- package/dist/init/manifest/versions.js +25 -25
- package/dist/markers/merge-imports.d.ts.map +1 -1
- package/dist/markers/merge-imports.js +2 -22
- package/dist/markers/merge-imports.js.map +1 -1
- package/dist/markers/one-line-imports.d.ts +3 -0
- package/dist/markers/one-line-imports.d.ts.map +1 -0
- package/dist/markers/one-line-imports.js +22 -0
- package/dist/markers/one-line-imports.js.map +1 -0
- package/dist/merge/declarations/binds-the-name.d.ts +8 -0
- package/dist/merge/declarations/binds-the-name.d.ts.map +1 -0
- package/dist/merge/declarations/binds-the-name.js +40 -0
- package/dist/merge/declarations/binds-the-name.js.map +1 -0
- package/dist/merge/declarations/brackets-left-open.d.ts +7 -0
- package/dist/merge/declarations/brackets-left-open.d.ts.map +1 -0
- package/dist/merge/declarations/brackets-left-open.js +21 -0
- package/dist/merge/declarations/brackets-left-open.js.map +1 -0
- package/dist/merge/declarations/close-of.d.ts +3 -0
- package/dist/merge/declarations/close-of.d.ts.map +1 -0
- package/dist/merge/declarations/close-of.js +15 -0
- package/dist/merge/declarations/close-of.js.map +1 -0
- package/dist/merge/declarations/declaration.d.ts +15 -0
- package/dist/merge/declarations/declaration.d.ts.map +1 -0
- package/dist/merge/declarations/declaration.js +2 -0
- package/dist/merge/declarations/declaration.js.map +1 -0
- package/dist/merge/declarations/declarations-of.d.ts +13 -0
- package/dist/merge/declarations/declarations-of.d.ts.map +1 -0
- package/dist/merge/declarations/declarations-of.js +130 -0
- package/dist/merge/declarations/declarations-of.js.map +1 -0
- package/dist/merge/declarations/declared-lines.d.ts +14 -0
- package/dist/merge/declarations/declared-lines.d.ts.map +1 -0
- package/dist/merge/declarations/declared-lines.js +42 -0
- package/dist/merge/declarations/declared-lines.js.map +1 -0
- package/dist/merge/declarations/declared-side.d.ts +8 -0
- package/dist/merge/declarations/declared-side.d.ts.map +1 -0
- package/dist/merge/declarations/declared-side.js +2 -0
- package/dist/merge/declarations/declared-side.js.map +1 -0
- package/dist/merge/declarations/declares-a-member.d.ts +7 -0
- package/dist/merge/declarations/declares-a-member.d.ts.map +1 -0
- package/dist/merge/declarations/declares-a-member.js +29 -0
- package/dist/merge/declarations/declares-a-member.js.map +1 -0
- package/dist/merge/declarations/enclosing-group.d.ts +8 -0
- package/dist/merge/declarations/enclosing-group.d.ts.map +1 -0
- package/dist/merge/declarations/enclosing-group.js +16 -0
- package/dist/merge/declarations/enclosing-group.js.map +1 -0
- package/dist/merge/declarations/holds-every-line.d.ts +3 -0
- package/dist/merge/declarations/holds-every-line.d.ts.map +1 -0
- package/dist/merge/declarations/holds-every-line.js +10 -0
- package/dist/merge/declarations/holds-every-line.js.map +1 -0
- package/dist/merge/declarations/imports-read-as-merged.d.ts +9 -0
- package/dist/merge/declarations/imports-read-as-merged.d.ts.map +1 -0
- package/dist/merge/declarations/imports-read-as-merged.js +23 -0
- package/dist/merge/declarations/imports-read-as-merged.js.map +1 -0
- package/dist/merge/declarations/inverts-a-reference.d.ts +12 -0
- package/dist/merge/declarations/inverts-a-reference.d.ts.map +1 -0
- package/dist/merge/declarations/inverts-a-reference.js +25 -0
- package/dist/merge/declarations/inverts-a-reference.js.map +1 -0
- package/dist/merge/declarations/lead-of.d.ts +15 -0
- package/dist/merge/declarations/lead-of.d.ts.map +1 -0
- package/dist/merge/declarations/lead-of.js +19 -0
- package/dist/merge/declarations/lead-of.js.map +1 -0
- package/dist/merge/declarations/lines-of-both-sides.d.ts +10 -0
- package/dist/merge/declarations/lines-of-both-sides.d.ts.map +1 -0
- package/dist/merge/declarations/lines-of-both-sides.js +22 -0
- package/dist/merge/declarations/lines-of-both-sides.js.map +1 -0
- package/dist/merge/declarations/merge-declarations.d.ts +44 -0
- package/dist/merge/declarations/merge-declarations.d.ts.map +1 -0
- package/dist/merge/declarations/merge-declarations.js +87 -0
- package/dist/merge/declarations/merge-declarations.js.map +1 -0
- package/dist/merge/declarations/merged-file.d.ts +15 -0
- package/dist/merge/declarations/merged-file.d.ts.map +1 -0
- package/dist/merge/declarations/merged-file.js +55 -0
- package/dist/merge/declarations/merged-file.js.map +1 -0
- package/dist/merge/declarations/merged-imports.d.ts +9 -0
- package/dist/merge/declarations/merged-imports.d.ts.map +1 -0
- package/dist/merge/declarations/merged-imports.js +25 -0
- package/dist/merge/declarations/merged-imports.js.map +1 -0
- package/dist/merge/declarations/merged-lines.d.ts +10 -0
- package/dist/merge/declarations/merged-lines.d.ts.map +1 -0
- package/dist/merge/declarations/merged-lines.js +10 -0
- package/dist/merge/declarations/merged-lines.js.map +1 -0
- package/dist/merge/declarations/merged-region.d.ts +33 -0
- package/dist/merge/declarations/merged-region.d.ts.map +1 -0
- package/dist/merge/declarations/merged-region.js +122 -0
- package/dist/merge/declarations/merged-region.js.map +1 -0
- package/dist/merge/declarations/reads-a-removed.d.ts +8 -0
- package/dist/merge/declarations/reads-a-removed.d.ts.map +1 -0
- package/dist/merge/declarations/reads-a-removed.js +27 -0
- package/dist/merge/declarations/reads-a-removed.js.map +1 -0
- package/dist/merge/declarations/reads-as-merged.d.ts +9 -0
- package/dist/merge/declarations/reads-as-merged.d.ts.map +1 -0
- package/dist/merge/declarations/reads-as-merged.js +19 -0
- package/dist/merge/declarations/reads-as-merged.js.map +1 -0
- package/dist/merge/declarations/reads-the-name.d.ts +10 -0
- package/dist/merge/declarations/reads-the-name.d.ts.map +1 -0
- package/dist/merge/declarations/reads-the-name.js +23 -0
- package/dist/merge/declarations/reads-the-name.js.map +1 -0
- package/dist/merge/declarations/settle-declarations.d.ts +25 -0
- package/dist/merge/declarations/settle-declarations.d.ts.map +1 -0
- package/dist/merge/declarations/settle-declarations.js +114 -0
- package/dist/merge/declarations/settle-declarations.js.map +1 -0
- package/dist/merge/declarations/shares-half-a-pair.d.ts +11 -0
- package/dist/merge/declarations/shares-half-a-pair.d.ts.map +1 -0
- package/dist/merge/declarations/shares-half-a-pair.js +41 -0
- package/dist/merge/declarations/shares-half-a-pair.js.map +1 -0
- package/dist/merge/declarations/shown-of.d.ts +5 -0
- package/dist/merge/declarations/shown-of.d.ts.map +1 -0
- package/dist/merge/declarations/shown-of.js +5 -0
- package/dist/merge/declarations/shown-of.js.map +1 -0
- package/dist/merge/declarations/sides-of-region.d.ts +5 -0
- package/dist/merge/declarations/sides-of-region.d.ts.map +1 -0
- package/dist/merge/declarations/sides-of-region.js +19 -0
- package/dist/merge/declarations/sides-of-region.js.map +1 -0
- package/dist/merge/declarations/union-in-doubt.d.ts +17 -0
- package/dist/merge/declarations/union-in-doubt.d.ts.map +1 -0
- package/dist/merge/declarations/union-in-doubt.js +84 -0
- package/dist/merge/declarations/union-in-doubt.js.map +1 -0
- package/dist/merge/declarations/union-reads-as-merged.d.ts +23 -0
- package/dist/merge/declarations/union-reads-as-merged.d.ts.map +1 -0
- package/dist/merge/declarations/union-reads-as-merged.js +155 -0
- package/dist/merge/declarations/union-reads-as-merged.js.map +1 -0
- package/dist/merge/for-you-entry.js +4 -1
- package/dist/merge/for-you-entry.js.map +1 -1
- package/dist/merge/resolution.d.ts +2 -0
- package/dist/merge/resolution.d.ts.map +1 -1
- package/dist/merge/resolve-conflict.d.ts +5 -2
- package/dist/merge/resolve-conflict.d.ts.map +1 -1
- package/dist/merge/resolve-conflict.js +62 -15
- package/dist/merge/resolve-conflict.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -6
- package/templates/pipeline/package-scripts.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merged-file.js","sourceRoot":"","sources":["../../../src/merge/declarations/merged-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,E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AAC,SAAS;QACX,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAClH,CAAC;AAED,uCAAuC;AACvC,SAAS,OAAO,CAAC,GAAW,EAAE,IAAuB,EAAE,KAAc;IACnE,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5C,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAE3D,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DeclaredSides } from './merge-declarations.js';
|
|
2
|
+
/**
|
|
3
|
+
* The imports region merged statement by statement when each statement of the three sides reads
|
|
4
|
+
* as one import: each on one line, then merged as the registry merges whole statements, the names
|
|
5
|
+
* imported from one module in one statement. Undefined when a statement holds a comment or is no
|
|
6
|
+
* import: the region is then merged as any other declarations.
|
|
7
|
+
*/
|
|
8
|
+
export declare function mergedImports({ ours, base, theirs }: DeclaredSides): string[] | undefined;
|
|
9
|
+
//# sourceMappingURL=merged-imports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merged-imports.d.ts","sourceRoot":"","sources":["../../../src/merge/declarations/merged-imports.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAK1D;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,aAAa,GAAG,MAAM,EAAE,GAAG,SAAS,CASzF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { oneLineImports } from '../../markers/one-line-imports.js';
|
|
2
|
+
import { registryUnion } from '../registry-union.js';
|
|
3
|
+
/** A whole import statement on one line, without a comment. */
|
|
4
|
+
const ONE_IMPORT = /^import\s[^/']*(?:'[^']*')?;$/;
|
|
5
|
+
/**
|
|
6
|
+
* The imports region merged statement by statement when each statement of the three sides reads
|
|
7
|
+
* as one import: each on one line, then merged as the registry merges whole statements, the names
|
|
8
|
+
* imported from one module in one statement. Undefined when a statement holds a comment or is no
|
|
9
|
+
* import: the region is then merged as any other declarations.
|
|
10
|
+
*/
|
|
11
|
+
export function mergedImports({ ours, base, theirs }) {
|
|
12
|
+
const sides = [ours, base, theirs].map(statementsOf);
|
|
13
|
+
const [mine, origin, other] = sides;
|
|
14
|
+
if (mine === undefined || origin === undefined || other === undefined) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
return registryUnion({ kind: 'conflict', ours: mine, base: origin, theirs: other, raw: [], line: 1 }, 'imports');
|
|
18
|
+
}
|
|
19
|
+
function statementsOf(side) {
|
|
20
|
+
const statements = side.declarations.map(({ lines }) => oneLineImports(lines));
|
|
21
|
+
return statements.every((lines) => lines.length === 1 && ONE_IMPORT.test(lines[0] ?? ''))
|
|
22
|
+
? statements.flat()
|
|
23
|
+
: undefined;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=merged-imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merged-imports.js","sourceRoot":"","sources":["../../../src/merge/declarations/merged-imports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIlD,+DAA+D;AAC/D,MAAM,UAAU,GAAG,+BAA+B,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAiB;IACjE,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACrD,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC;IAEpC,IAAI,IAAI,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,aAAa,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;AACnH,CAAC;AAED,SAAS,YAAY,CAAC,IAAkB;IACtC,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;IAE/E,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACvF,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE;QACnB,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Versions } from './merged-file.js';
|
|
2
|
+
/** What merges the lines of the three versions of a declaration; undefined when they do not merge without a conflict. */
|
|
3
|
+
export type LineMerge = (versions: Versions) => readonly string[] | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* The lines of a declaration both sides changed, merged as git merges a file, as merge-trunk
|
|
6
|
+
* computes the merge of the tree. Undefined when the versions conflict, or when git cannot write
|
|
7
|
+
* or merge them: the declaration is then left to a person.
|
|
8
|
+
*/
|
|
9
|
+
export declare function mergedLines(top: string, versions: Versions): string[] | undefined;
|
|
10
|
+
//# sourceMappingURL=merged-lines.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merged-lines.d.ts","sourceRoot":"","sources":["../../../src/merge/declarations/merged-lines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE1D,yHAAyH;AACzH,MAAM,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,QAAQ,KAAK,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;AAE9E;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,EAAE,GAAG,SAAS,CAEjF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { mergedFile } from './merged-file.js';
|
|
2
|
+
/**
|
|
3
|
+
* The lines of a declaration both sides changed, merged as git merges a file, as merge-trunk
|
|
4
|
+
* computes the merge of the tree. Undefined when the versions conflict, or when git cannot write
|
|
5
|
+
* or merge them: the declaration is then left to a person.
|
|
6
|
+
*/
|
|
7
|
+
export function mergedLines(top, versions) {
|
|
8
|
+
return mergedFile(top, versions, false);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=merged-lines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merged-lines.js","sourceRoot":"","sources":["../../../src/merge/declarations/merged-lines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiB,MAAM,eAAe,CAAC;AAK1D;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,QAAkB;IACzD,OAAO,UAAU,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ConflictedPath } from '../conflicted-path.js';
|
|
2
|
+
import { type ConflictLabels } from './declared-lines.js';
|
|
3
|
+
/** What a region of declarations leaves to a person. */
|
|
4
|
+
export interface HeldRegion {
|
|
5
|
+
/** How to settle it. */
|
|
6
|
+
readonly advice: string;
|
|
7
|
+
/** How many conflicts of the file lie in it. */
|
|
8
|
+
readonly blocks: number;
|
|
9
|
+
}
|
|
10
|
+
/** The lines a region of declarations is written again with, and what it leaves to a person. */
|
|
11
|
+
export type RegionOutcome = {
|
|
12
|
+
readonly lines: readonly string[];
|
|
13
|
+
} | {
|
|
14
|
+
readonly lines: readonly string[] | undefined;
|
|
15
|
+
readonly held: HeldRegion;
|
|
16
|
+
};
|
|
17
|
+
/** What the merge of a region is given: the repository, the marker lines of its conflicts, how many it holds. */
|
|
18
|
+
interface Given {
|
|
19
|
+
readonly top: string;
|
|
20
|
+
readonly labels: ConflictLabels;
|
|
21
|
+
readonly blocks: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A region of a conflicted file merged from its three sides, declaration by declaration. Its
|
|
25
|
+
* lines hold a conflict for each declaration the two sides do not agree on. Nothing is written,
|
|
26
|
+
* and the conflicts git wrote stay for a person, when the region is not read with certainty: a
|
|
27
|
+
* side, the base among them, does not hold it once or cannot be read, the declarations of the
|
|
28
|
+
* sides cannot be paired or ordered, the merged lines do not read back as the declarations merged, a
|
|
29
|
+
* side removed a declaration the other started to read, or a declaration would stand above one it reads.
|
|
30
|
+
*/
|
|
31
|
+
export declare function mergedRegion(name: string, path: ConflictedPath, { top, labels, blocks }: Given): RegionOutcome;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=merged-region.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merged-region.d.ts","sourceRoot":"","sources":["../../../src/merge/declarations/merged-region.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAE,KAAK,cAAc,EAAiB,MAAM,kBAAkB,CAAC;AAUtE,wDAAwD;AACxD,MAAM,WAAW,UAAU;IACzB,wBAAwB;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,gGAAgG;AAChG,MAAM,MAAM,aAAa,GACrB;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GACrC;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;AAEjF,iHAAiH;AACjH,UAAU,KAAK;IACb,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,GAAG,aAAa,CA8B9G"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { declaredLines } from './declared-lines.js';
|
|
2
|
+
import { mergeDeclarations } from './merge-declarations.js';
|
|
3
|
+
import { mergedLines } from './merged-lines.js';
|
|
4
|
+
import { invertsAReference } from './inverts-a-reference.js';
|
|
5
|
+
import { readsARemoved } from './reads-a-removed.js';
|
|
6
|
+
import { readsAsMerged } from './reads-as-merged.js';
|
|
7
|
+
import { shownOf } from './shown-of.js';
|
|
8
|
+
import { sidesOfRegion } from './sides-of-region.js';
|
|
9
|
+
import { mergedImports } from './merged-imports.js';
|
|
10
|
+
/**
|
|
11
|
+
* A region of a conflicted file merged from its three sides, declaration by declaration. Its
|
|
12
|
+
* lines hold a conflict for each declaration the two sides do not agree on. Nothing is written,
|
|
13
|
+
* and the conflicts git wrote stay for a person, when the region is not read with certainty: a
|
|
14
|
+
* side, the base among them, does not hold it once or cannot be read, the declarations of the
|
|
15
|
+
* sides cannot be paired or ordered, the merged lines do not read back as the declarations merged, a
|
|
16
|
+
* side removed a declaration the other started to read, or a declaration would stand above one it reads.
|
|
17
|
+
*/
|
|
18
|
+
export function mergedRegion(name, path, { top, labels, blocks }) {
|
|
19
|
+
const sides = sidesOfRegion(name, path);
|
|
20
|
+
if (sides === undefined) {
|
|
21
|
+
return unread(name, blocks);
|
|
22
|
+
}
|
|
23
|
+
const imports = name === 'imports' ? mergedImports(sides) : undefined;
|
|
24
|
+
if (imports !== undefined) {
|
|
25
|
+
return { lines: imports };
|
|
26
|
+
}
|
|
27
|
+
const outcome = mergeDeclarations(sides, (versions) => mergedLines(top, versions));
|
|
28
|
+
const why = whyNot(outcome, sides);
|
|
29
|
+
if ('refused' in outcome || why !== undefined) {
|
|
30
|
+
return unread(name, blocks, why);
|
|
31
|
+
}
|
|
32
|
+
const lines = declaredLines(outcome.merged, outcome.lead, labels);
|
|
33
|
+
const conflicts = outcome.merged.flatMap((item) => (item.kind === 'conflict' ? [item] : []));
|
|
34
|
+
return conflicts.length === 0
|
|
35
|
+
? { lines }
|
|
36
|
+
: {
|
|
37
|
+
lines,
|
|
38
|
+
held: { advice: `${adviceOf(name, conflicts)}${renamedOf(conflicts, sides)}`, blocks: conflicts.length },
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Why a region is not written as merged: its declarations were not merged, they do not read
|
|
43
|
+
* back, a side removed one the other started to read, the merged region sets one above a
|
|
44
|
+
* declaration it reads against the sides, or they give the file two default exports.
|
|
45
|
+
*/
|
|
46
|
+
function whyNot(outcome, sides) {
|
|
47
|
+
if ('refused' in outcome) {
|
|
48
|
+
return outcome.refused === 'unnamed' && !oneSideAlone(sides) ? 'gone' : outcome.refused;
|
|
49
|
+
}
|
|
50
|
+
if (!readsAsMerged(outcome.merged, outcome.lead)) {
|
|
51
|
+
return 'unread';
|
|
52
|
+
}
|
|
53
|
+
if (readsARemoved(sides)) {
|
|
54
|
+
return 'removed';
|
|
55
|
+
}
|
|
56
|
+
const declarations = outcome.merged.flatMap((item) => shownOf(item) ?? []);
|
|
57
|
+
if (invertsAReference({ declarations, trailing: 0 }, sides)) {
|
|
58
|
+
return 'above';
|
|
59
|
+
}
|
|
60
|
+
return outcome.merged.filter(exportsADefault).length > 1 ? 'defaults' : undefined;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Whether a side changed or removed a statement of the base that declares no name and the other
|
|
64
|
+
* did not do the same: one side alone holds it as the base does, or a side wrote a statement the
|
|
65
|
+
* base does not hold, which may be that one changed. Otherwise both removed it.
|
|
66
|
+
*/
|
|
67
|
+
function oneSideAlone({ ours, base, theirs }) {
|
|
68
|
+
const keys = (side) => new Set(side.declarations.map(({ key }) => key));
|
|
69
|
+
const inOurs = keys(ours);
|
|
70
|
+
const inTheirs = keys(theirs);
|
|
71
|
+
const inBase = keys(base);
|
|
72
|
+
const nameless = (side) => side.declarations.filter(({ name }) => name === undefined);
|
|
73
|
+
return (nameless(base).some(({ key }) => inOurs.has(key) !== inTheirs.has(key)) ||
|
|
74
|
+
[...nameless(ours), ...nameless(theirs)].some(({ key }) => !inBase.has(key)));
|
|
75
|
+
}
|
|
76
|
+
/** A default export in either spelling: `export default ...` or `export { name as default }`. */
|
|
77
|
+
const DEFAULT_EXPORT = /^\s*export\s+(?:default\b|(?:type\s+)?\{[^}]*\bas\s+default\b)/;
|
|
78
|
+
/** Whether a declaration of the merged region, in the version of a side when it is left to a person, gives the file its default export. */
|
|
79
|
+
function exportsADefault(item) {
|
|
80
|
+
return shownOf(item)?.lines.some((line) => DEFAULT_EXPORT.test(line)) === true;
|
|
81
|
+
}
|
|
82
|
+
const WHOLE = ', and its hunks show lines, not whole declarations: keep each declaration of both sides whole, once, its brackets closed';
|
|
83
|
+
/** What stops the merge of a region by declaration, and what to do of its hunks, said to the person they are left to. */
|
|
84
|
+
const WHY = {
|
|
85
|
+
unread: `holds declarations of several lines the kit could not read with certainty${WHOLE}.`,
|
|
86
|
+
unnamed: `holds a statement that declares no name and that one side changed or removed, which the kit does not merge${WHOLE}.`,
|
|
87
|
+
entries: `holds lines that end no statement (entries of a list, or statements written without \`;\`) on which the two sides differ, which the kit does not merge one by one${WHOLE}.`,
|
|
88
|
+
twice: 'holds two statements with no declared name that open alike, one holding every line of the other, which the kit cannot tell from one statement written twice, and its hunks show lines, not whole statements: write it once if it is one statement, each whole if they are two.',
|
|
89
|
+
order: `holds declarations the two sides set in two different orders${WHOLE}, in the order that holds for both.`,
|
|
90
|
+
gone: `holds a statement that declares no name and that both sides removed, which the kit does not merge${WHOLE}.`,
|
|
91
|
+
above: `holds a declaration that would stand above one it reads once the two sides are merged${WHOLE}, in the order that holds for both.`,
|
|
92
|
+
removed: `holds a declaration one side removed and that a declaration the other side wrote reads${WHOLE}, the one removed kept or the other written without it.`,
|
|
93
|
+
defaults: 'holds a default export of each side, and a file has one: write the one the file keeps, whole, and export what the other side declared under a name.',
|
|
94
|
+
};
|
|
95
|
+
function unread(name, blocks, why = 'unread') {
|
|
96
|
+
return { lines: undefined, held: { advice: `the region \`${name}\` ${WHY[why]}`, blocks } };
|
|
97
|
+
}
|
|
98
|
+
/** What to do of the declarations left: each named when both sides hold it, the region when a side removed one. */
|
|
99
|
+
function adviceOf(name, conflicts) {
|
|
100
|
+
const names = conflicts.map(({ ours, theirs }) => ours === undefined || theirs === undefined ? undefined : ours.name);
|
|
101
|
+
const what = names.includes(undefined)
|
|
102
|
+
? `in the region \`${name}\`: for each hunk`
|
|
103
|
+
: `on ${names.map((declared) => `\`${declared}\``).join(', ')} in the region \`${name}\`: for each`;
|
|
104
|
+
return `the two sides do not agree ${what}, write the one declaration that keeps the intent of both, whole, or remove it.`;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* What is said more when one side removed a declaration the other changed and that side also
|
|
108
|
+
* wrote one neither the base nor the other side holds: the kit cannot tell a declaration given
|
|
109
|
+
* another name from one replaced by another.
|
|
110
|
+
*/
|
|
111
|
+
function renamedOf(conflicts, sides) {
|
|
112
|
+
const keys = (side) => new Set(side.declarations.map(({ key }) => key));
|
|
113
|
+
const inBase = keys(sides.base);
|
|
114
|
+
const wroteAnother = (side, other) => side.declarations.some(({ key }) => !inBase.has(key) && !keys(other).has(key));
|
|
115
|
+
const renamed = conflicts.some(({ ours, base, theirs }) => base !== undefined &&
|
|
116
|
+
((ours === undefined && wroteAnother(sides.ours, sides.theirs)) ||
|
|
117
|
+
(theirs === undefined && wroteAnother(sides.theirs, sides.ours))));
|
|
118
|
+
return renamed
|
|
119
|
+
? ' If a declaration of the side that removed it is this one under another name, write the change there and remove the hunk.'
|
|
120
|
+
: '';
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=merged-region.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merged-region.js","sourceRoot":"","sources":["../../../src/merge/declarations/merged-region.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuB,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAA8C,iBAAiB,EAAgB,MAAM,sBAAsB,CAAC;AACnH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,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G;AACH,SAAS,SAAS,CAAC,SAA8B,EAAE,KAAoB;IACrE,MAAM,IAAI,GAAG,CAAC,IAAkB,EAAe,EAAE,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACnG,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEhC,MAAM,YAAY,GAAG,CAAC,IAAkB,EAAE,KAAmB,EAAW,EAAE,CACxE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAEjF,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAC5B,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CACzB,IAAI,KAAK,SAAS;QAClB,CAAC,CAAC,IAAI,KAAK,SAAS,IAAI,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YAC7D,CAAC,MAAM,KAAK,SAAS,IAAI,YAAY,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CACtE,CAAC;IAEF,OAAO,OAAO;QACZ,CAAC,CAAC,2HAA2H;QAC7H,CAAC,CAAC,EAAE,CAAC;AACT,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DeclaredSides } from './merge-declarations.js';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a side removed a declaration the other left as the base holds it, while that other
|
|
4
|
+
* side wrote or changed a declaration that reads it and whose base version, if any, did not: one
|
|
5
|
+
* removed what the other started to read, and no merge of the two holds for both.
|
|
6
|
+
*/
|
|
7
|
+
export declare function readsARemoved({ ours, base, theirs }: DeclaredSides): boolean;
|
|
8
|
+
//# sourceMappingURL=reads-a-removed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reads-a-removed.d.ts","sourceRoot":"","sources":["../../../src/merge/declarations/reads-a-removed.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,aAAa,GAAG,OAAO,CAE5E"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { readsTheName } from './reads-the-name.js';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a side removed a declaration the other left as the base holds it, while that other
|
|
4
|
+
* side wrote or changed a declaration that reads it and whose base version, if any, did not: one
|
|
5
|
+
* removed what the other started to read, and no merge of the two holds for both.
|
|
6
|
+
*/
|
|
7
|
+
export function readsARemoved({ ours, base, theirs }) {
|
|
8
|
+
return startedToRead(ours, base, theirs) || startedToRead(theirs, base, ours);
|
|
9
|
+
}
|
|
10
|
+
/** Whether a side started to read a declaration it left alone and the other side removed. */
|
|
11
|
+
function startedToRead(keeper, base, remover) {
|
|
12
|
+
const inBase = byKey(base);
|
|
13
|
+
const removed = new Set(remover.declarations.map(({ key }) => key));
|
|
14
|
+
const gone = keeper.declarations.filter((kept) => kept.name !== undefined && !removed.has(kept.key) && same(kept, inBase.get(kept.key)));
|
|
15
|
+
return keeper.declarations.some((written) => {
|
|
16
|
+
const before = inBase.get(written.key);
|
|
17
|
+
return (!same(written, before) &&
|
|
18
|
+
gone.some(({ key, name }) => key !== written.key && readsTheName(written, name) && !(before !== undefined && readsTheName(before, name))));
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function byKey(side) {
|
|
22
|
+
return new Map(side.declarations.map((declaration) => [declaration.key, declaration]));
|
|
23
|
+
}
|
|
24
|
+
function same(one, other) {
|
|
25
|
+
return one.lines.join('\n') === other?.lines.join('\n');
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=reads-a-removed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reads-a-removed.js","sourceRoot":"","sources":["../../../src/merge/declarations/reads-a-removed.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAiB;IACjE,OAAO,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAChF,CAAC;AAED,6FAA6F;AAC7F,SAAS,aAAa,CAAC,MAAoB,EAAE,IAAkB,EAAE,OAAqB;IACpF,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEpE,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CACrC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAChG,CAAC;IAEF,OAAO,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;QAC1C,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAEvC,OAAO,CACL,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC;YACtB,IAAI,CAAC,IAAI,CACP,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,CAChB,GAAG,KAAK,OAAO,CAAC,GAAG,IAAI,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,SAAS,IAAI,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAC9G,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,KAAK,CAAC,IAAkB;IAC/B,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;AACzF,CAAC;AAED,SAAS,IAAI,CAAC,GAAgB,EAAE,KAA8B;IAC5D,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DeclaredSide } from './declared-side.js';
|
|
2
|
+
import type { MergedDeclaration } from './merge-declarations.js';
|
|
3
|
+
/**
|
|
4
|
+
* Whether the lines a merged region is written with read back as the declarations merged, each
|
|
5
|
+
* whole, in their order, every bracket paired: the last check before anything is written. A
|
|
6
|
+
* declaration left to a person is read as the version of one side.
|
|
7
|
+
*/
|
|
8
|
+
export declare function readsAsMerged(merged: readonly MergedDeclaration[], ours: DeclaredSide): boolean;
|
|
9
|
+
//# sourceMappingURL=reads-as-merged.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reads-as-merged.d.ts","sourceRoot":"","sources":["../../../src/merge/declarations/reads-as-merged.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAK9D;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAW/F"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { declarationsOf } from './declarations-of.js';
|
|
2
|
+
import { declaredLines } from './declared-lines.js';
|
|
3
|
+
import { shownOf } from './shown-of.js';
|
|
4
|
+
const NO_LABELS = { ours: '', base: '', theirs: '' };
|
|
5
|
+
/**
|
|
6
|
+
* Whether the lines a merged region is written with read back as the declarations merged, each
|
|
7
|
+
* whole, in their order, every bracket paired: the last check before anything is written. A
|
|
8
|
+
* declaration left to a person is read as the version of one side.
|
|
9
|
+
*/
|
|
10
|
+
export function readsAsMerged(merged, ours) {
|
|
11
|
+
const shown = merged.flatMap((item) => {
|
|
12
|
+
const declaration = shownOf(item);
|
|
13
|
+
return declaration === undefined ? [] : [{ kind: 'kept', declaration }];
|
|
14
|
+
});
|
|
15
|
+
const read = declarationsOf(declaredLines(shown, ours, NO_LABELS));
|
|
16
|
+
const texts = shown.map(({ declaration }) => declaration.lines.join('\n'));
|
|
17
|
+
return read?.declarations.map(({ lines }) => lines.join('\n')).join('\n\0') === texts.join('\n\0');
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=reads-as-merged.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reads-as-merged.js","sourceRoot":"","sources":["../../../src/merge/declarations/reads-as-merged.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,MAAM,SAAS,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAErD;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,MAAoC,EAAE,IAAkB;IACpF,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACpC,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAElC,OAAO,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,WAAW,EAAE,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,cAAc,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IACnE,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAE3E,OAAO,IAAI,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACrG,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Declaration } from './declaration.js';
|
|
2
|
+
/**
|
|
3
|
+
* Whether the code of a declaration reads a name: it holds it as a whole word, comments and
|
|
4
|
+
* strings left out, a type that names it and a spread of it among them (`typeof orders`,
|
|
5
|
+
* `...orders`). A member of another value (`other.orders`, `other?.orders`) is not a read of it,
|
|
6
|
+
* nor a member the code declares under that name. No scope is read: a declaration that binds the
|
|
7
|
+
* name itself is not taken to read the outer one at all.
|
|
8
|
+
*/
|
|
9
|
+
export declare function readsTheName({ lines }: Declaration, name: string | undefined): boolean;
|
|
10
|
+
//# sourceMappingURL=reads-the-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reads-the-name.d.ts","sourceRoot":"","sources":["../../../src/merge/declarations/reads-the-name.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAetF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { scan } from '../../check/scan/scan.js';
|
|
2
|
+
import { bindsTheName } from './binds-the-name.js';
|
|
3
|
+
import { declaresAMember } from './declares-a-member.js';
|
|
4
|
+
/**
|
|
5
|
+
* Whether the code of a declaration reads a name: it holds it as a whole word, comments and
|
|
6
|
+
* strings left out, a type that names it and a spread of it among them (`typeof orders`,
|
|
7
|
+
* `...orders`). A member of another value (`other.orders`, `other?.orders`) is not a read of it,
|
|
8
|
+
* nor a member the code declares under that name. No scope is read: a declaration that binds the
|
|
9
|
+
* name itself is not taken to read the outer one at all.
|
|
10
|
+
*/
|
|
11
|
+
export function readsTheName({ lines }, name) {
|
|
12
|
+
const code = scan(lines.join('\n')).code;
|
|
13
|
+
if (name === undefined || bindsTheName(code, name)) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
const word = new RegExp(`(?<![\\w$])${name.replaceAll('$', '\\$')}(?![\\w$])`, 'g');
|
|
17
|
+
return [...code.matchAll(word)].some(({ index }) => {
|
|
18
|
+
const before = code.slice(0, index).trimEnd();
|
|
19
|
+
const member = before.endsWith('.') && !before.endsWith('...');
|
|
20
|
+
return !member && !declaresAMember(code, index, name);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=reads-the-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reads-the-name.js","sourceRoot":"","sources":["../../../src/merge/declarations/reads-the-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,EAAE,KAAK,EAAe,EAAE,IAAwB;IAC3E,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAEzC,IAAI,IAAI,KAAK,SAAS,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QACnD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,MAAM,CAAC,cAAc,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;IAEpF,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QACjD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;QAC9C,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAE/D,OAAO,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ConflictedPath } from '../conflicted-path.js';
|
|
2
|
+
import { type HeldRegion } from './merged-region.js';
|
|
3
|
+
/** What the merge of the declarations of a file gives. */
|
|
4
|
+
export interface SettledDeclarations {
|
|
5
|
+
/** The text of the merge, each region of declarations that could be merged written again. */
|
|
6
|
+
readonly content: string;
|
|
7
|
+
/** The regions the union of lines would break, by name, that it must not settle: what is left of each to a person. */
|
|
8
|
+
readonly held: ReadonlyMap<string, HeldRegion>;
|
|
9
|
+
/** Whether a region was merged declaration by declaration. */
|
|
10
|
+
readonly merged: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Merges, in the text a merge wrote for a file, each generated region in which the lines of both
|
|
14
|
+
* sides, kept, would not give the two sides merged. They leave a declaration open: git sets two
|
|
15
|
+
* tables, two models or two functions added at one place side by side and keeps the lines they
|
|
16
|
+
* share once, so that the union of the lines no longer pairs their brackets. Or they pair them
|
|
17
|
+
* and the region they give, read back, is not the declarations of the three sides merged one by
|
|
18
|
+
* one: a line of one side stands inside a declaration of the other, a declaration lacks a line,
|
|
19
|
+
* stands twice, came back, or stands above one it reads. Such a region is merged from the
|
|
20
|
+
* three sides of the file, declaration by declaration. Any other region is left to the union of
|
|
21
|
+
* lines, untouched: `top` is the repository the lines of a declaration both sides changed are
|
|
22
|
+
* merged in.
|
|
23
|
+
*/
|
|
24
|
+
export declare function settleDeclarations(path: ConflictedPath, top: string): SettledDeclarations;
|
|
25
|
+
//# sourceMappingURL=settle-declarations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settle-declarations.d.ts","sourceRoot":"","sources":["../../../src/merge/declarations/settle-declarations.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAMzD,OAAO,EAAE,KAAK,UAAU,EAAgB,MAAM,iBAAiB,CAAC;AAMhE,0DAA0D;AAC1D,MAAM,WAAW,mBAAmB;IAClC,6FAA6F;IAC7F,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,sHAAsH;IACtH,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC/C,8DAA8D;IAC9D,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,GAAG,mBAAmB,CA4BzF"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { scan } from '../../check/scan/scan.js';
|
|
2
|
+
import { REGION_MARKER, regionsOf } from '../../markers/index.js';
|
|
3
|
+
import { conflictBlocks } from '../conflict-blocks.js';
|
|
4
|
+
import { registryUnion } from '../registry-union.js';
|
|
5
|
+
import { bracketsLeftOpen } from './brackets-left-open.js';
|
|
6
|
+
import { linesOfBothSides } from './lines-of-both-sides.js';
|
|
7
|
+
import { importsReadAsMerged } from './imports-read-as-merged.js';
|
|
8
|
+
import { mergedRegion } from './merged-region.js';
|
|
9
|
+
import { sharesHalfAPair } from './shares-half-a-pair.js';
|
|
10
|
+
import { sidesOfRegion } from './sides-of-region.js';
|
|
11
|
+
import { unionReadsAsMerged } from './union-reads-as-merged.js';
|
|
12
|
+
/**
|
|
13
|
+
* Merges, in the text a merge wrote for a file, each generated region in which the lines of both
|
|
14
|
+
* sides, kept, would not give the two sides merged. They leave a declaration open: git sets two
|
|
15
|
+
* tables, two models or two functions added at one place side by side and keeps the lines they
|
|
16
|
+
* share once, so that the union of the lines no longer pairs their brackets. Or they pair them
|
|
17
|
+
* and the region they give, read back, is not the declarations of the three sides merged one by
|
|
18
|
+
* one: a line of one side stands inside a declaration of the other, a declaration lacks a line,
|
|
19
|
+
* stands twice, came back, or stands above one it reads. Such a region is merged from the
|
|
20
|
+
* three sides of the file, declaration by declaration. Any other region is left to the union of
|
|
21
|
+
* lines, untouched: `top` is the repository the lines of a declaration both sides changed are
|
|
22
|
+
* merged in.
|
|
23
|
+
*/
|
|
24
|
+
export function settleDeclarations(path, top) {
|
|
25
|
+
const text = path.merged ?? '';
|
|
26
|
+
const owners = ownersOf(text);
|
|
27
|
+
const lines = text.split('\n');
|
|
28
|
+
const held = new Map();
|
|
29
|
+
let merged = false;
|
|
30
|
+
const frame = regionsOf(lines.map((line, at) => (owners[at] === undefined ? line : '')));
|
|
31
|
+
const written = [];
|
|
32
|
+
let from = 0;
|
|
33
|
+
for (const region of frame.filter((candidate) => unionIsWrong(candidate, { path, top, lines, owners }))) {
|
|
34
|
+
const blocks = blocksIn(region, owners);
|
|
35
|
+
const outcome = mergedRegion(region.name, path, { top, labels: labelsOf(blocks[0]), blocks: blocks.length });
|
|
36
|
+
if ('held' in outcome) {
|
|
37
|
+
held.set(region.name, outcome.held);
|
|
38
|
+
// A conflict in a region written inside this one is a conflict of this one: no union settles it either.
|
|
39
|
+
innerNames(lines.slice(region.open + 1, region.close)).forEach((inner) => held.set(inner, NOTHING_MORE));
|
|
40
|
+
}
|
|
41
|
+
if (outcome.lines !== undefined) {
|
|
42
|
+
written.push(...lines.slice(from, region.open + 1), ...outcome.lines);
|
|
43
|
+
from = region.close;
|
|
44
|
+
merged = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return { content: [...written, ...lines.slice(from)].join('\n'), held, merged };
|
|
48
|
+
}
|
|
49
|
+
/** A region written inside one that is left: its conflicts are counted with those of the outer one. */
|
|
50
|
+
const NOTHING_MORE = { advice: '', blocks: 0 };
|
|
51
|
+
/** The names of the regions whose markers these lines hold. */
|
|
52
|
+
function innerNames(lines) {
|
|
53
|
+
return lines.flatMap((line) => REGION_MARKER.exec(line)?.[2] ?? []);
|
|
54
|
+
}
|
|
55
|
+
/** For each line of the text of a merge, the conflict it is a line of. */
|
|
56
|
+
function ownersOf(text) {
|
|
57
|
+
return conflictBlocks(text).flatMap((segment) => segment.kind === 'conflict'
|
|
58
|
+
? Array(segment.raw.length).fill(segment)
|
|
59
|
+
: Array(segment.lines.length).fill(undefined));
|
|
60
|
+
}
|
|
61
|
+
/** The conflicts that lie in a region, each once. */
|
|
62
|
+
function blocksIn(region, owners) {
|
|
63
|
+
return [...new Set(owners.slice(region.open + 1, region.close))].flatMap((owner) => owner === undefined ? [] : [owner]);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Whether the lines of both sides, kept as the registry keeps them, give a region that is not the
|
|
67
|
+
* two sides merged. Three cases. The region the union of lines writes does not pair its brackets.
|
|
68
|
+
* It pairs them by chance, two different statements added in one conflict opening or closing on
|
|
69
|
+
* one line the union keeps once. Or it pairs them and does not read back as the declarations of
|
|
70
|
+
* the three sides merged one by one. A region with no conflict, or with one that holds a marker,
|
|
71
|
+
* which no union settles, is not concerned.
|
|
72
|
+
*/
|
|
73
|
+
function unionIsWrong(region, { path, top, lines, owners }) {
|
|
74
|
+
const blocks = blocksIn(region, owners);
|
|
75
|
+
const sides = blocks.flatMap((block) => [...block.ours, ...block.base, ...block.theirs]);
|
|
76
|
+
if (blocks.length === 0 || sides.some((line) => REGION_MARKER.test(line))) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
const union = lines.slice(region.open + 1, region.close).flatMap((line, at) => {
|
|
80
|
+
const owner = owners[region.open + 1 + at];
|
|
81
|
+
if (owner === undefined) {
|
|
82
|
+
return [line];
|
|
83
|
+
}
|
|
84
|
+
return owner === owners[region.open + at] ? [] : registryUnion(owner, region.name);
|
|
85
|
+
});
|
|
86
|
+
return (blocks.some(sharesHalfAPair) ||
|
|
87
|
+
bracketsLeftOpen(scan(union.join('\n')).code)?.length !== 0 ||
|
|
88
|
+
!readsAsMerged(union, { name: region.name, path, top }));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Whether the region the union of lines gives is the two sides merged. It is read back against
|
|
92
|
+
* the three sides merged declaration by declaration, and kept when it reads as that merge. It is
|
|
93
|
+
* kept too, as it always was, when the kit has nothing certain to read it against: a side is not
|
|
94
|
+
* read with certainty, or the two sides differ on lines that end no statement, read as lines
|
|
95
|
+
* only. The `imports` region is read by what it brings.
|
|
96
|
+
*/
|
|
97
|
+
function readsAsMerged(union, { name, path, top }) {
|
|
98
|
+
const readAs = { region: name, prisma: path.file.endsWith('.prisma') };
|
|
99
|
+
const sides = sidesOfRegion(name, path);
|
|
100
|
+
if (sides === undefined || (name === 'imports' && importsReadAsMerged(union, sides))) {
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
return unionReadsAsMerged(union, sides, (versions) => linesOfBothSides(top, versions, readAs)) !== 'mixed';
|
|
104
|
+
}
|
|
105
|
+
/** The marker lines of the first conflict of a region: the declarations left to a person are written with the same. */
|
|
106
|
+
function labelsOf(block) {
|
|
107
|
+
const base = block?.raw[block.ours.length + 1] ?? '';
|
|
108
|
+
return {
|
|
109
|
+
ours: block?.raw[0] ?? '<<<<<<< ours',
|
|
110
|
+
base: base.startsWith('|||||||') ? base : '||||||| base',
|
|
111
|
+
theirs: block?.raw.at(-1) ?? '>>>>>>> theirs',
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=settle-declarations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settle-declarations.js","sourceRoot":"","sources":["../../../src/merge/declarations/settle-declarations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAe,SAAS,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAsB,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAmB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,O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O,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,KAAK,OAAO,CAAC;AAC7G,CAAC;AAED,uHAAuH;AACvH,SAAS,QAAQ,CAAC,KAAgC;IAChD,MAAM,IAAI,GAAG,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAErD,OAAO;QACL,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,cAAc;QACrC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;QACxD,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,gBAAgB;KAC9C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ConflictBlock } from '../conflict-blocks.js';
|
|
2
|
+
/**
|
|
3
|
+
* Whether the union of the lines of a conflict would pair the brackets of two different
|
|
4
|
+
* statements by chance. The lines each side adds are read in units that pair their own brackets:
|
|
5
|
+
* one line, or a run from a line that opens a bracket to the line that closes it. Two different
|
|
6
|
+
* units that open on the same line, or close on the same line, lose that line once in the union,
|
|
7
|
+
* which keeps each line once; a unit both sides added alike is one unit, kept once as the union
|
|
8
|
+
* keeps it, and never counts.
|
|
9
|
+
*/
|
|
10
|
+
export declare function sharesHalfAPair(block: ConflictBlock): boolean;
|
|
11
|
+
//# sourceMappingURL=shares-half-a-pair.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shares-half-a-pair.d.ts","sourceRoot":"","sources":["../../../src/merge/declarations/shares-half-a-pair.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAQ7D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { scan } from '../../check/scan/scan.js';
|
|
2
|
+
import { bracketsLeftOpen } from './brackets-left-open.js';
|
|
3
|
+
/**
|
|
4
|
+
* Whether the union of the lines of a conflict would pair the brackets of two different
|
|
5
|
+
* statements by chance. The lines each side adds are read in units that pair their own brackets:
|
|
6
|
+
* one line, or a run from a line that opens a bracket to the line that closes it. Two different
|
|
7
|
+
* units that open on the same line, or close on the same line, lose that line once in the union,
|
|
8
|
+
* which keeps each line once; a unit both sides added alike is one unit, kept once as the union
|
|
9
|
+
* keeps it, and never counts.
|
|
10
|
+
*/
|
|
11
|
+
export function sharesHalfAPair(block) {
|
|
12
|
+
const inBase = new Set(unitsOf(block.base).map(textOf));
|
|
13
|
+
const added = [...unitsOf(block.ours), ...unitsOf(block.theirs)].filter((unit) => !inBase.has(textOf(unit)));
|
|
14
|
+
const different = added.filter((unit, at) => added.findIndex((other) => textOf(other) === textOf(unit)) === at);
|
|
15
|
+
return different.some((unit, at) => different.slice(at + 1).some((other) => unit[0] === other[0] || unit.at(-1) === other.at(-1)));
|
|
16
|
+
}
|
|
17
|
+
function textOf(unit) {
|
|
18
|
+
return unit.join('\n');
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The lines of one side of a conflict in units, blank lines left out: a line that pairs its own
|
|
22
|
+
* brackets, a run of lines up to the one that closes what the first opened, a line that closes a
|
|
23
|
+
* bracket the conflict did not open, and what is left open at its end.
|
|
24
|
+
*/
|
|
25
|
+
function unitsOf(lines) {
|
|
26
|
+
const units = [];
|
|
27
|
+
let unit = [];
|
|
28
|
+
let open = [];
|
|
29
|
+
for (const line of lines.filter((candidate) => candidate.trim() !== '')) {
|
|
30
|
+
const left = bracketsLeftOpen(scan(line).code, open);
|
|
31
|
+
units.push(...(left === undefined && unit.length > 0 ? [unit] : []));
|
|
32
|
+
unit = left === undefined ? [line] : [...unit, line];
|
|
33
|
+
open = left ?? [];
|
|
34
|
+
if (open.length === 0) {
|
|
35
|
+
units.push(unit);
|
|
36
|
+
unit = [];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return unit.length === 0 ? units : [...units, unit];
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=shares-half-a-pair.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shares-half-a-pair.js","sourceRoot":"","sources":["../../../src/merge/declarations/shares-half-a-pair.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,KAAoB;IAClD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7G,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IAEhH,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,CACjC,SAAS,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