@adecore/merge 0.49.6 → 0.49.7
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/resolve.js +11 -0
- package/package.json +1 -1
- package/src/resolve.ts +14 -0
package/dist/resolve.js
CHANGED
|
@@ -41,6 +41,17 @@ function covers(base, outer, inner) {
|
|
|
41
41
|
return false;
|
|
42
42
|
}
|
|
43
43
|
const added = [...outer.slice(0, start), ...outer.slice(start + inner.length)];
|
|
44
|
+
if (added.length > 16 && added.length * base.length > 4096) {
|
|
45
|
+
// Most rejected candidates fail immediately; avoid indexing the whole conflict for them.
|
|
46
|
+
for (const line of added.slice(0, 4)) {
|
|
47
|
+
if (base.includes(line) && !inner.includes(line)) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const original = new Set(base);
|
|
52
|
+
const retained = new Set(inner);
|
|
53
|
+
return added.every((line) => !original.has(line) || retained.has(line));
|
|
54
|
+
}
|
|
44
55
|
return added.every((line) => !base.includes(line) || inner.includes(line));
|
|
45
56
|
}
|
|
46
57
|
/*
|
package/package.json
CHANGED
package/src/resolve.ts
CHANGED
|
@@ -53,6 +53,20 @@ function covers(base: readonly string[], outer: readonly string[], inner: readon
|
|
|
53
53
|
|
|
54
54
|
const added = [...outer.slice(0, start), ...outer.slice(start + inner.length)];
|
|
55
55
|
|
|
56
|
+
if (added.length > 16 && added.length * base.length > 4096) {
|
|
57
|
+
// Most rejected candidates fail immediately; avoid indexing the whole conflict for them.
|
|
58
|
+
for (const line of added.slice(0, 4)) {
|
|
59
|
+
if (base.includes(line) && !inner.includes(line)) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const original = new Set(base);
|
|
65
|
+
const retained = new Set(inner);
|
|
66
|
+
|
|
67
|
+
return added.every((line) => !original.has(line) || retained.has(line));
|
|
68
|
+
}
|
|
69
|
+
|
|
56
70
|
return added.every((line) => !base.includes(line) || inner.includes(line));
|
|
57
71
|
}
|
|
58
72
|
|