@constela/start 1.2.17 → 1.2.18
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.
|
@@ -2467,6 +2467,12 @@ function applyLayout(pageView, layoutView, namedSlots) {
|
|
|
2467
2467
|
}
|
|
2468
2468
|
function extractMdxContentSlot2(loadedData, dataSourceName, routeParams) {
|
|
2469
2469
|
const dataSource = loadedData[dataSourceName];
|
|
2470
|
+
if (dataSource && typeof dataSource === "object" && !Array.isArray(dataSource)) {
|
|
2471
|
+
if ("content" in dataSource) {
|
|
2472
|
+
return { "mdx-content": dataSource.content };
|
|
2473
|
+
}
|
|
2474
|
+
return void 0;
|
|
2475
|
+
}
|
|
2470
2476
|
if (!Array.isArray(dataSource)) {
|
|
2471
2477
|
return void 0;
|
|
2472
2478
|
}
|
|
@@ -2651,6 +2657,55 @@ async function processLayouts(pageInfo, layoutsDir, routeParams = {}) {
|
|
|
2651
2657
|
};
|
|
2652
2658
|
}
|
|
2653
2659
|
}
|
|
2660
|
+
let mergedState = {};
|
|
2661
|
+
for (let i = layoutChain.length - 1; i >= 0; i--) {
|
|
2662
|
+
const layout = layoutChain[i];
|
|
2663
|
+
if (layout?.state) {
|
|
2664
|
+
mergedState = {
|
|
2665
|
+
...mergedState,
|
|
2666
|
+
...layout.state
|
|
2667
|
+
};
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
if (pageInfo.page.state) {
|
|
2671
|
+
mergedState = {
|
|
2672
|
+
...mergedState,
|
|
2673
|
+
...pageInfo.page.state
|
|
2674
|
+
};
|
|
2675
|
+
}
|
|
2676
|
+
let mergedActionsMap = /* @__PURE__ */ new Map();
|
|
2677
|
+
for (let i = layoutChain.length - 1; i >= 0; i--) {
|
|
2678
|
+
const layout = layoutChain[i];
|
|
2679
|
+
if (layout?.actions && Array.isArray(layout.actions)) {
|
|
2680
|
+
for (const action of layout.actions) {
|
|
2681
|
+
const actionDef = action;
|
|
2682
|
+
mergedActionsMap.set(actionDef.name, action);
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
if (pageInfo.page.actions && Array.isArray(pageInfo.page.actions)) {
|
|
2687
|
+
for (const action of pageInfo.page.actions) {
|
|
2688
|
+
const actionDef = action;
|
|
2689
|
+
mergedActionsMap.set(actionDef.name, action);
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
const mergedActions = Array.from(mergedActionsMap.values());
|
|
2693
|
+
let mergedLifecycle;
|
|
2694
|
+
for (let i = layoutChain.length - 1; i >= 0; i--) {
|
|
2695
|
+
const layout = layoutChain[i];
|
|
2696
|
+
if (layout?.lifecycle) {
|
|
2697
|
+
mergedLifecycle = {
|
|
2698
|
+
...mergedLifecycle,
|
|
2699
|
+
...layout.lifecycle
|
|
2700
|
+
};
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
if (pageInfo.page.lifecycle) {
|
|
2704
|
+
mergedLifecycle = {
|
|
2705
|
+
...mergedLifecycle,
|
|
2706
|
+
...pageInfo.page.lifecycle
|
|
2707
|
+
};
|
|
2708
|
+
}
|
|
2654
2709
|
let namedSlots;
|
|
2655
2710
|
let effectiveRouteParams = routeParams;
|
|
2656
2711
|
if (!routeParams["slug"] && pageInfo.page.route?.path) {
|
|
@@ -2701,6 +2756,9 @@ async function processLayouts(pageInfo, layoutsDir, routeParams = {}) {
|
|
|
2701
2756
|
const normalizedLayoutView = normalizeViewNode(structuredClone(layout.view));
|
|
2702
2757
|
currentView = applyLayout(currentView, normalizedLayoutView, namedSlots);
|
|
2703
2758
|
}
|
|
2759
|
+
if (namedSlots && Object.keys(namedSlots).length > 0) {
|
|
2760
|
+
currentView = replaceSlot(currentView, currentView, namedSlots);
|
|
2761
|
+
}
|
|
2704
2762
|
const layoutParams = pageInfo.page.route?.layoutParams;
|
|
2705
2763
|
if (layoutParams && Object.keys(layoutParams).length > 0) {
|
|
2706
2764
|
currentView = substituteLayoutParamsInNode(currentView, layoutParams);
|
|
@@ -2716,7 +2774,10 @@ async function processLayouts(pageInfo, layoutsDir, routeParams = {}) {
|
|
|
2716
2774
|
page: {
|
|
2717
2775
|
...pageInfo.page,
|
|
2718
2776
|
view: currentView,
|
|
2719
|
-
route: updatedRoute
|
|
2777
|
+
route: updatedRoute,
|
|
2778
|
+
state: Object.keys(mergedState).length > 0 ? mergedState : void 0,
|
|
2779
|
+
actions: mergedActions.length > 0 ? mergedActions : void 0,
|
|
2780
|
+
lifecycle: mergedLifecycle
|
|
2720
2781
|
}
|
|
2721
2782
|
};
|
|
2722
2783
|
return updatedPageInfo;
|
|
@@ -2847,9 +2908,24 @@ async function build2(options) {
|
|
|
2847
2908
|
for (const pathEntry of staticPathsResult) {
|
|
2848
2909
|
const params = pathEntry.params;
|
|
2849
2910
|
const outputPath = paramsToOutputPath(route.pattern, params, outDir);
|
|
2850
|
-
let
|
|
2911
|
+
let boundPageInfo = pageInfo;
|
|
2912
|
+
if (pathEntry.data && pageInfo.page.getStaticPaths?.source) {
|
|
2913
|
+
const source = pageInfo.page.getStaticPaths.source;
|
|
2914
|
+
const sourceName = typeof source === "string" ? source : source.name;
|
|
2915
|
+
if (sourceName) {
|
|
2916
|
+
boundPageInfo = {
|
|
2917
|
+
...pageInfo,
|
|
2918
|
+
loadedData: {
|
|
2919
|
+
...pageInfo.loadedData,
|
|
2920
|
+
[sourceName]: pathEntry.data
|
|
2921
|
+
// Replace array with current item
|
|
2922
|
+
}
|
|
2923
|
+
};
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
let processedPageInfo = boundPageInfo;
|
|
2851
2927
|
if (layoutsDir) {
|
|
2852
|
-
processedPageInfo = await processLayouts(
|
|
2928
|
+
processedPageInfo = await processLayouts(boundPageInfo, layoutsDir, params);
|
|
2853
2929
|
}
|
|
2854
2930
|
const program = await convertToCompiledProgram(processedPageInfo);
|
|
2855
2931
|
const html = await renderPageToHtml(program, params, runtimePath, cssPath);
|
package/dist/cli/index.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constela/start",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.18",
|
|
4
4
|
"description": "Meta-framework for Constela applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"postcss": "^8.5.0",
|
|
44
44
|
"@tailwindcss/postcss": "^4.0.0",
|
|
45
45
|
"tailwindcss": "^4.0.0",
|
|
46
|
+
"@constela/router": "8.0.0",
|
|
46
47
|
"@constela/core": "0.7.0",
|
|
47
48
|
"@constela/runtime": "0.10.2",
|
|
48
|
-
"@constela/router": "8.0.0",
|
|
49
49
|
"@constela/compiler": "0.7.1",
|
|
50
50
|
"@constela/server": "3.0.1"
|
|
51
51
|
},
|