@constela/start 1.8.0 → 1.8.1
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.
|
@@ -3416,13 +3416,13 @@ async function processLayouts(pageInfo, layoutsDir, routeParams = {}) {
|
|
|
3416
3416
|
};
|
|
3417
3417
|
return updatedPageInfo;
|
|
3418
3418
|
}
|
|
3419
|
-
async function renderPageToHtml(program, params, runtimePath, cssPath, externalImports, widgets, lang) {
|
|
3419
|
+
async function renderPageToHtml(program, params, routePath, runtimePath, cssPath, externalImports, widgets, lang) {
|
|
3420
3420
|
const normalizedProgram = {
|
|
3421
3421
|
...program,
|
|
3422
3422
|
view: normalizeViewNode(structuredClone(program.view))
|
|
3423
3423
|
};
|
|
3424
3424
|
const ctx = {
|
|
3425
|
-
url:
|
|
3425
|
+
url: routePath,
|
|
3426
3426
|
params,
|
|
3427
3427
|
query: new URLSearchParams()
|
|
3428
3428
|
};
|
|
@@ -3430,12 +3430,12 @@ async function renderPageToHtml(program, params, runtimePath, cssPath, externalI
|
|
|
3430
3430
|
const routeContext = {
|
|
3431
3431
|
params,
|
|
3432
3432
|
query: {},
|
|
3433
|
-
path:
|
|
3433
|
+
path: routePath
|
|
3434
3434
|
};
|
|
3435
3435
|
const metaTags = generateMetaTags(normalizedProgram.route, {
|
|
3436
3436
|
params,
|
|
3437
3437
|
query: {},
|
|
3438
|
-
path:
|
|
3438
|
+
path: routePath
|
|
3439
3439
|
});
|
|
3440
3440
|
const cssLinkTag = cssPath ? `<link rel="stylesheet" href="${cssPath}">` : void 0;
|
|
3441
3441
|
const head = [metaTags, cssLinkTag].filter(Boolean).join("\n") || void 0;
|
|
@@ -3579,6 +3579,11 @@ async function build2(options) {
|
|
|
3579
3579
|
for (const pathEntry of staticPathsResult) {
|
|
3580
3580
|
const params = pathEntry.params;
|
|
3581
3581
|
const outputPath = paramsToOutputPath(route.pattern, params, outDir);
|
|
3582
|
+
let routePath = route.pattern;
|
|
3583
|
+
for (const [key, value] of Object.entries(params)) {
|
|
3584
|
+
routePath = routePath.replace(`:${key}`, value);
|
|
3585
|
+
routePath = routePath.replace("*", value);
|
|
3586
|
+
}
|
|
3582
3587
|
let boundPageInfo = pageInfo;
|
|
3583
3588
|
if (pathEntry.data && pageInfo.page.getStaticPaths?.source) {
|
|
3584
3589
|
const source = pageInfo.page.getStaticPaths.source;
|
|
@@ -3598,7 +3603,7 @@ async function build2(options) {
|
|
|
3598
3603
|
processedPageInfo = await processLayouts(boundPageInfo, layoutsDir, params);
|
|
3599
3604
|
}
|
|
3600
3605
|
const program = await convertToCompiledProgram(processedPageInfo);
|
|
3601
|
-
const html = await renderPageToHtml(program, params, runtimePath, cssPath, processedPageInfo.page.externalImports, processedPageInfo.widgets, seoLang);
|
|
3606
|
+
const html = await renderPageToHtml(program, params, routePath, runtimePath, cssPath, processedPageInfo.page.externalImports, processedPageInfo.widgets, seoLang);
|
|
3602
3607
|
await mkdir2(dirname5(outputPath), { recursive: true });
|
|
3603
3608
|
await writeFile(outputPath, html, "utf-8");
|
|
3604
3609
|
generatedFiles.push(outputPath);
|
|
@@ -3611,19 +3616,14 @@ async function build2(options) {
|
|
|
3611
3616
|
generatedFiles.push(parentOutputPath);
|
|
3612
3617
|
}
|
|
3613
3618
|
}
|
|
3614
|
-
let routePath = route.pattern;
|
|
3615
|
-
for (const [key, value] of Object.entries(params)) {
|
|
3616
|
-
routePath = routePath.replace(`:${key}`, value);
|
|
3617
|
-
routePath = routePath.replace("*", value);
|
|
3618
|
-
}
|
|
3619
3619
|
routes.push(routePath);
|
|
3620
3620
|
}
|
|
3621
3621
|
} else {
|
|
3622
3622
|
const loader = new JsonPageLoader(projectRoot, { routesDir: absoluteRoutesDir });
|
|
3623
3623
|
let pageInfo = await loader.loadPage(relPathFromProjectRoot);
|
|
3624
3624
|
let outputPath;
|
|
3625
|
+
const routePath = pageInfo.page.route?.path ?? route.pattern;
|
|
3625
3626
|
if (pageInfo.page.route?.path) {
|
|
3626
|
-
const routePath = pageInfo.page.route.path;
|
|
3627
3627
|
const relativePath = routePath.startsWith("/") ? routePath.slice(1) : routePath;
|
|
3628
3628
|
if (relativePath === "" || relativePath === "/") {
|
|
3629
3629
|
outputPath = join11(outDir, "index.html");
|
|
@@ -3637,7 +3637,7 @@ async function build2(options) {
|
|
|
3637
3637
|
pageInfo = await processLayouts(pageInfo, layoutsDir, {});
|
|
3638
3638
|
}
|
|
3639
3639
|
const program = await convertToCompiledProgram(pageInfo);
|
|
3640
|
-
const html = await renderPageToHtml(program, {}, runtimePath, cssPath, pageInfo.page.externalImports, pageInfo.widgets, seoLang);
|
|
3640
|
+
const html = await renderPageToHtml(program, {}, routePath, runtimePath, cssPath, pageInfo.page.externalImports, pageInfo.widgets, seoLang);
|
|
3641
3641
|
await mkdir2(dirname5(outputPath), { recursive: true });
|
|
3642
3642
|
await writeFile(outputPath, html, "utf-8");
|
|
3643
3643
|
generatedFiles.push(outputPath);
|
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.8.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Meta-framework for Constela applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"ws": "^8.18.0",
|
|
47
47
|
"@constela/compiler": "0.12.0",
|
|
48
48
|
"@constela/core": "0.13.0",
|
|
49
|
+
"@constela/server": "9.0.0",
|
|
49
50
|
"@constela/router": "15.0.0",
|
|
50
|
-
"@constela/runtime": "0.16.5"
|
|
51
|
-
"@constela/server": "9.0.0"
|
|
51
|
+
"@constela/runtime": "0.16.5"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/ws": "^8.5.0",
|