mnfst 0.5.26 → 0.5.28
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/manifest.data.js +23 -17
- package/package.json +1 -1
package/dist/manifest.data.js
CHANGED
|
@@ -2315,32 +2315,38 @@ function getLoadingBranchSafe() {
|
|
|
2315
2315
|
return cachedLoadingBranchSafe;
|
|
2316
2316
|
}
|
|
2317
2317
|
|
|
2318
|
-
//
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
const
|
|
2318
|
+
// Max depth for loading placeholder chain; beyond this, string keys return '' to avoid stack overflow.
|
|
2319
|
+
const MAX_LOADING_BRANCH_DEPTH = 10;
|
|
2320
|
+
|
|
2321
|
+
const loadingBranchByDepth = Object.create(null);
|
|
2322
|
+
function getLoadingBranch(depth) {
|
|
2323
|
+
const d = depth == null ? 0 : Math.min(Math.max(0, depth), MAX_LOADING_BRANCH_DEPTH);
|
|
2324
|
+
if (loadingBranchByDepth[d]) return loadingBranchByDepth[d];
|
|
2324
2325
|
const emptyStr = function () { return ''; };
|
|
2325
|
-
|
|
2326
|
+
const nextDepth = d + 1;
|
|
2327
|
+
const getReturnForStringKey = () =>
|
|
2328
|
+
nextDepth <= MAX_LOADING_BRANCH_DEPTH ? getLoadingBranch(nextDepth) : '';
|
|
2329
|
+
loadingBranchByDepth[d] = new Proxy(Object.create(null), {
|
|
2326
2330
|
get(_, key) {
|
|
2327
2331
|
if (key === Symbol.toPrimitive || key === 'valueOf' || key === 'toString') return emptyStr;
|
|
2328
2332
|
if (key === 'then' || key === 'catch' || key === 'finally') return undefined;
|
|
2329
2333
|
if (key === Symbol.iterator) return function* () { };
|
|
2330
|
-
if (key === '$route' || key === '$search' || key === '$query')
|
|
2334
|
+
if (key === '$route' || key === '$search' || key === '$query') {
|
|
2335
|
+
return function () { return getLoadingBranch(nextDepth <= MAX_LOADING_BRANCH_DEPTH ? nextDepth : MAX_LOADING_BRANCH_DEPTH); };
|
|
2336
|
+
}
|
|
2331
2337
|
if (key === 'length') return 0;
|
|
2332
|
-
if (typeof key === 'string') return
|
|
2333
|
-
return undefined;
|
|
2338
|
+
if (typeof key === 'string') return getReturnForStringKey();
|
|
2339
|
+
if (typeof key === 'symbol') return undefined;
|
|
2340
|
+
return getLoadingBranch(MAX_LOADING_BRANCH_DEPTH);
|
|
2334
2341
|
},
|
|
2335
2342
|
has() { return true; }
|
|
2336
2343
|
});
|
|
2337
|
-
return
|
|
2344
|
+
return loadingBranchByDepth[d];
|
|
2338
2345
|
}
|
|
2339
2346
|
|
|
2340
2347
|
// Create a simple fallback object that returns empty strings for all properties.
|
|
2341
|
-
//
|
|
2342
|
-
//
|
|
2343
|
-
// For other props (json, yaml, etc.) use getLoadingBranch() (chainable) so $route and deep paths work.
|
|
2348
|
+
// Nested data keys use getLoadingBranch() (chainable) so $route, $search, $query and deep paths
|
|
2349
|
+
// don't throw while loading (e.g. $x.content.legal.$route('path')).
|
|
2344
2350
|
function createSimpleFallback(propForPlaceholder) {
|
|
2345
2351
|
const fallback = Object.create(null);
|
|
2346
2352
|
|
|
@@ -2496,11 +2502,11 @@ function createSimpleFallback(propForPlaceholder) {
|
|
|
2496
2502
|
}
|
|
2497
2503
|
}
|
|
2498
2504
|
|
|
2499
|
-
// For string keys that look like data: use
|
|
2500
|
-
//
|
|
2505
|
+
// For string keys that look like data: use chainable placeholder so nested arrays (e.g. content.legal)
|
|
2506
|
+
// have $route/$search/$query and expressions like $x.content.legal.$route('path') don't throw while loading.
|
|
2501
2507
|
if (typeof key === 'string' && key.length > 0 && key.length < 64 &&
|
|
2502
2508
|
!key.startsWith('$') && key !== 'length') {
|
|
2503
|
-
return
|
|
2509
|
+
return getLoadingBranch();
|
|
2504
2510
|
}
|
|
2505
2511
|
|
|
2506
2512
|
// For any other key, return chaining fallback — never return the loading proxy itself.
|