@deneb-ui/core 2.0.30 → 2.0.32
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
2
|
-
export declare function deepMerge<T extends Record<string, unknown>>(base: T, patch: Record<string, unknown>): T;
|
|
2
|
+
export declare function deepMerge<T extends Record<string, unknown>>(base: T, patch: Record<string, unknown>, depth?: number, seen?: WeakSet<object>): T;
|
package/dist/engine/deepMerge.js
CHANGED
|
@@ -5,11 +5,16 @@ exports.deepMerge = deepMerge;
|
|
|
5
5
|
function isPlainObject(value) {
|
|
6
6
|
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
7
7
|
}
|
|
8
|
-
function deepMerge(base, patch) {
|
|
8
|
+
function deepMerge(base, patch, depth = 0, seen = new WeakSet()) {
|
|
9
|
+
if (depth > 50)
|
|
10
|
+
return { ...base, ...patch };
|
|
11
|
+
if (seen.has(patch))
|
|
12
|
+
return patch;
|
|
13
|
+
seen.add(patch);
|
|
9
14
|
const next = { ...base };
|
|
10
15
|
for (const [key, value] of Object.entries(patch)) {
|
|
11
16
|
if (isPlainObject(value) && isPlainObject(next[key])) {
|
|
12
|
-
next[key] = deepMerge(next[key], value);
|
|
17
|
+
next[key] = deepMerge(next[key], value, depth + 1, seen);
|
|
13
18
|
}
|
|
14
19
|
else {
|
|
15
20
|
next[key] = value;
|
package/dist/fonts/resolve.js
CHANGED
|
@@ -32,7 +32,10 @@ function lookupFontDefinition(value) {
|
|
|
32
32
|
const primary = value.split(',')[0]?.trim().replace(/^['"]|['"]$/g, '');
|
|
33
33
|
if (primary) {
|
|
34
34
|
const primarySlug = normalizeFontId(primary);
|
|
35
|
-
|
|
35
|
+
// Unknown ids used to recurse with the same slug (String.split → stack overflow).
|
|
36
|
+
if (primarySlug && primarySlug !== slug) {
|
|
37
|
+
return lookupFontDefinition(primary);
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
return null;
|
|
38
41
|
}
|
|
@@ -97,9 +100,13 @@ function collectFontIdsFromSiteData(siteData) {
|
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
}
|
|
103
|
+
const seen = new WeakSet();
|
|
100
104
|
const walkContent = (node) => {
|
|
101
105
|
if (!node || typeof node !== 'object')
|
|
102
106
|
return;
|
|
107
|
+
if (seen.has(node))
|
|
108
|
+
return;
|
|
109
|
+
seen.add(node);
|
|
103
110
|
if (Array.isArray(node)) {
|
|
104
111
|
node.forEach(walkContent);
|
|
105
112
|
return;
|
package/package.json
CHANGED