@constela/start 1.5.0 → 1.5.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.
@@ -1307,6 +1307,7 @@ async function resolvePageExport(pageDefault, params, expectedParams) {
1307
1307
 
1308
1308
  // src/edge/adapter.ts
1309
1309
  import { matchRoute } from "@constela/router";
1310
+ import { isCookieInitialExpr } from "@constela/core";
1310
1311
  async function defaultLoadModule(file) {
1311
1312
  return import(file);
1312
1313
  }
@@ -1395,7 +1396,15 @@ function createAdapter(options) {
1395
1396
  };
1396
1397
  const hydrationScript = generateHydrationScript(program, void 0, routeContext);
1397
1398
  const themeState = program.state?.["theme"];
1398
- const initialTheme = themeState?.initial;
1399
+ let initialTheme;
1400
+ if (themeState) {
1401
+ if (isCookieInitialExpr(themeState.initial)) {
1402
+ const cookieValue = cookies[themeState.initial.key];
1403
+ initialTheme = cookieValue ?? themeState.initial.default;
1404
+ } else if (typeof themeState.initial === "string") {
1405
+ initialTheme = themeState.initial;
1406
+ }
1407
+ }
1399
1408
  const html = wrapHtml(content, hydrationScript, void 0, initialTheme ? {
1400
1409
  theme: initialTheme,
1401
1410
  defaultTheme: initialTheme,
@@ -1609,6 +1618,7 @@ import { createServer } from "http";
1609
1618
  import { createReadStream } from "fs";
1610
1619
  import { join as join7, isAbsolute } from "path";
1611
1620
  import { createServer as createViteServer } from "vite";
1621
+ import { isCookieInitialExpr as isCookieInitialExpr2 } from "@constela/core";
1612
1622
 
1613
1623
  // src/json-page-loader.ts
1614
1624
  import { existsSync as existsSync6, readFileSync as readFileSync4 } from "fs";
@@ -2377,7 +2387,15 @@ async function createDevServer(options = {}) {
2377
2387
  const cssHead = css ? (Array.isArray(css) ? css : [css]).map((p) => `<link rel="stylesheet" href="/${p}">`).join("\n") : "";
2378
2388
  const head = [metaTags, cssHead].filter(Boolean).join("\n");
2379
2389
  const themeState = composedProgram.state?.["theme"];
2380
- const initialTheme = themeState?.initial;
2390
+ let initialTheme;
2391
+ if (themeState) {
2392
+ if (isCookieInitialExpr2(themeState.initial)) {
2393
+ const cookieValue = cookies[themeState.initial.key];
2394
+ initialTheme = cookieValue ?? themeState.initial.default;
2395
+ } else if (typeof themeState.initial === "string") {
2396
+ initialTheme = themeState.initial;
2397
+ }
2398
+ }
2381
2399
  const importMap = {
2382
2400
  "@constela/runtime": "/node_modules/@constela/runtime/dist/index.js",
2383
2401
  "@constela/core": "/node_modules/@constela/core/dist/index.js",
package/dist/cli/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  hyperlink,
5
5
  loadConfig,
6
6
  resolveConfig
7
- } from "../chunk-NYYUZJG5.js";
7
+ } from "../chunk-W6SJTQAP.js";
8
8
  import "../chunk-LCCIX5MB.js";
9
9
 
10
10
  // src/cli/index.ts
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  transformCsv,
29
29
  transformMdx,
30
30
  transformYaml
31
- } from "./chunk-NYYUZJG5.js";
31
+ } from "./chunk-W6SJTQAP.js";
32
32
  import {
33
33
  evaluateMetaExpression,
34
34
  generateHydrationScript,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constela/start",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Meta-framework for Constela applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -45,8 +45,8 @@
45
45
  "tailwindcss": "^4.0.0",
46
46
  "@constela/compiler": "0.11.1",
47
47
  "@constela/core": "0.12.0",
48
- "@constela/server": "8.0.0",
49
48
  "@constela/runtime": "0.15.0",
49
+ "@constela/server": "8.0.0",
50
50
  "@constela/router": "13.0.0"
51
51
  },
52
52
  "devDependencies": {