@decocms/start 1.2.8 → 1.2.9
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/package.json +1 -1
- package/src/cms/resolve.ts +0 -37
- package/src/routes/cmsRoute.ts +0 -26
package/package.json
CHANGED
package/src/cms/resolve.ts
CHANGED
|
@@ -504,21 +504,12 @@ async function internalResolve(value: unknown, rctx: ResolveContext): Promise<un
|
|
|
504
504
|
// Unknown type — resolve props but preserve __resolveType (it's a section)
|
|
505
505
|
const { __resolveType: _, ...rest } = obj;
|
|
506
506
|
|
|
507
|
-
if (resolveType.includes("eader")) {
|
|
508
|
-
console.log(`[HEADER-RESOLVE] resolveType="${resolveType}" restKeys=[${Object.keys(rest).join(",")}] depth=${rctx.depth}`);
|
|
509
|
-
}
|
|
510
|
-
|
|
511
507
|
// onBeforeResolveProps: let sections transform raw props before resolution.
|
|
512
508
|
// This runs with unresolved props (containing __resolveType refs) so sections
|
|
513
509
|
// can extract metadata that would be lost after resolution (e.g., collection IDs).
|
|
514
510
|
const propsToResolve = await applyOnBeforeResolveProps(resolveType, rest);
|
|
515
511
|
|
|
516
512
|
const resolvedRest = await resolveProps(propsToResolve, childCtx);
|
|
517
|
-
|
|
518
|
-
if (resolveType.includes("eader")) {
|
|
519
|
-
console.log(`[HEADER-RESOLVE] DONE resolvedKeys=[${Object.keys(resolvedRest).join(",")}]`);
|
|
520
|
-
}
|
|
521
|
-
|
|
522
513
|
return { __resolveType: resolveType, ...resolvedRest };
|
|
523
514
|
}
|
|
524
515
|
|
|
@@ -627,17 +618,7 @@ async function resolveRawSection(
|
|
|
627
618
|
section: unknown,
|
|
628
619
|
rctx: ResolveContext,
|
|
629
620
|
): Promise<ResolvedSection[]> {
|
|
630
|
-
const sectionRt = (section as any)?.__resolveType;
|
|
631
|
-
if (String(sectionRt).includes("eader")) {
|
|
632
|
-
console.log(`[RAW-SECTION-ENTER] sectionRt="${sectionRt}"`);
|
|
633
|
-
}
|
|
634
|
-
|
|
635
621
|
const resolved = await internalResolve(section, rctx);
|
|
636
|
-
|
|
637
|
-
if (String(sectionRt).includes("eader")) {
|
|
638
|
-
console.log(`[RAW-SECTION-RESOLVED] resolved type=${typeof resolved} isObj=${resolved && typeof resolved === 'object'} keys=${resolved && typeof resolved === 'object' ? Object.keys(resolved as any).join(',') : 'N/A'}`);
|
|
639
|
-
}
|
|
640
|
-
|
|
641
622
|
if (!resolved || typeof resolved !== "object") return [];
|
|
642
623
|
|
|
643
624
|
const items = Array.isArray(resolved) ? resolved : [resolved];
|
|
@@ -649,11 +630,6 @@ async function resolveRawSection(
|
|
|
649
630
|
if (!obj.__resolveType) continue;
|
|
650
631
|
|
|
651
632
|
const resolveType = obj.__resolveType as string;
|
|
652
|
-
|
|
653
|
-
if (resolveType.includes("eader")) {
|
|
654
|
-
console.log(`[RAW-SECTION] resolveType="${resolveType}" objKeys=[${Object.keys(obj).join(",")}]`);
|
|
655
|
-
}
|
|
656
|
-
|
|
657
633
|
const sectionLoader = getSection(resolveType);
|
|
658
634
|
if (!sectionLoader) {
|
|
659
635
|
console.warn(`[CMS] No component registered for: ${resolveType}`);
|
|
@@ -662,11 +638,6 @@ async function resolveRawSection(
|
|
|
662
638
|
|
|
663
639
|
const { __resolveType: _, ...rawProps } = obj;
|
|
664
640
|
const props = normalizeNestedSections(rawProps) as Record<string, unknown>;
|
|
665
|
-
|
|
666
|
-
if (resolveType.includes("eader")) {
|
|
667
|
-
console.log(`[RAW-SECTION] rawPropKeys=[${Object.keys(rawProps).join(",")}] normalizedPropKeys=[${Object.keys(props).join(",")}]`);
|
|
668
|
-
}
|
|
669
|
-
|
|
670
641
|
results.push({
|
|
671
642
|
component: resolveType,
|
|
672
643
|
props,
|
|
@@ -996,11 +967,6 @@ function resolveSectionShallow(
|
|
|
996
967
|
const rt = current.__resolveType as string | undefined;
|
|
997
968
|
if (!rt) return null;
|
|
998
969
|
|
|
999
|
-
// Debug: trace section resolution for Header
|
|
1000
|
-
if (String(rt).includes("eader") || (depth > 0 && String(current.__resolveType).includes("eader"))) {
|
|
1001
|
-
console.log(`[SECTION-RESOLVE] depth=${depth} rt="${rt}" currentKeys=${Object.keys(current).length} getSection=${!!getSection(rt)} inBlocks=${!!loadBlocks()[rt]}`);
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
970
|
if (SKIP_RESOLVE_TYPES.has(rt)) return null;
|
|
1005
971
|
|
|
1006
972
|
// Lazy wrapper — unwrap to the inner section
|
|
@@ -1054,9 +1020,6 @@ function resolveSectionShallow(
|
|
|
1054
1020
|
// Check if this is a registered section — we found it
|
|
1055
1021
|
if (getSection(rt)) {
|
|
1056
1022
|
const { __resolveType: _, ...rawProps } = current;
|
|
1057
|
-
if (rt.includes("eader")) {
|
|
1058
|
-
console.log(`[SECTION-RESOLVE] FOUND section "${rt}" rawProps keys: [${Object.keys(rawProps).join(", ")}]`);
|
|
1059
|
-
}
|
|
1060
1023
|
return {
|
|
1061
1024
|
component: rt,
|
|
1062
1025
|
key: rt,
|
package/src/routes/cmsRoute.ts
CHANGED
|
@@ -99,21 +99,8 @@ async function loadCmsPageInternal(fullPath: string) {
|
|
|
99
99
|
const request = new Request(urlWithSearch, {
|
|
100
100
|
headers: originRequest.headers,
|
|
101
101
|
});
|
|
102
|
-
|
|
103
|
-
for (const s of page.resolvedSections) {
|
|
104
|
-
if (s.component?.includes("eader")) {
|
|
105
|
-
console.log(`[CMS-ROUTE] BEFORE loaders: "${s.component}" propKeys=[${Object.keys(s.props || {}).join(",")}]`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
102
|
const enrichedSections = await runSectionLoaders(page.resolvedSections, request);
|
|
110
103
|
|
|
111
|
-
for (const s of enrichedSections) {
|
|
112
|
-
if (s.component?.includes("eader")) {
|
|
113
|
-
console.log(`[CMS-ROUTE] AFTER loaders: "${s.component}" propKeys=[${Object.keys(s.props || {}).join(",")}]`);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
104
|
// Pre-import eager section modules so their default exports are cached
|
|
118
105
|
// in resolvedComponents. This ensures SSR renders with direct component
|
|
119
106
|
// refs, and the client hydration can skip React.lazy/Suspense.
|
|
@@ -175,21 +162,8 @@ export const loadCmsHomePage = createServerFn({ method: "GET" }).handler(async (
|
|
|
175
162
|
};
|
|
176
163
|
const page = await resolveDecoPage("/", matcherCtx);
|
|
177
164
|
if (!page) return null;
|
|
178
|
-
|
|
179
|
-
for (const s of page.resolvedSections) {
|
|
180
|
-
if (s.component?.includes("eader")) {
|
|
181
|
-
console.log(`[HOME-ROUTE] BEFORE loaders: "${s.component}" propKeys=[${Object.keys(s.props || {}).join(",")}] propsSize=${JSON.stringify(s.props || {}).length}`);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
165
|
const enrichedSections = await runSectionLoaders(page.resolvedSections, request);
|
|
186
166
|
|
|
187
|
-
for (const s of enrichedSections) {
|
|
188
|
-
if (s.component?.includes("eader")) {
|
|
189
|
-
console.log(`[HOME-ROUTE] AFTER loaders: "${s.component}" propKeys=[${Object.keys(s.props || {}).join(",")}]`);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
167
|
const eagerKeys = enrichedSections.map((s) => s.component);
|
|
194
168
|
await preloadSectionComponents(eagerKeys);
|
|
195
169
|
|