weifuwu 0.17.21 → 0.17.23

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/index.js CHANGED
@@ -1018,7 +1018,9 @@ ${src}`;
1018
1018
  // ── client bundle ─────────────────────────────────────────────────────────
1019
1019
  async buildClientBundle(entryPath, layoutPaths, pagesDir) {
1020
1020
  try {
1021
+ const layoutImports = layoutPaths.map((p) => `import${JSON.stringify(p)};`).join("");
1021
1022
  const code = [
1023
+ layoutImports,
1022
1024
  `import{hydrateRoot}from'react-dom/client';`,
1023
1025
  `import{createElement,useState,useEffect}from'react';`,
1024
1026
  `import{TsxContext}from'weifuwu/react';`,
package/dist/react.js CHANGED
@@ -544,13 +544,14 @@ function useLocale() {
544
544
 
545
545
  // client-theme.ts
546
546
  function resolveTheme(theme) {
547
- if (theme === "system") {
547
+ if (theme === "system" && typeof window !== "undefined") {
548
548
  return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
549
549
  }
550
550
  return theme;
551
551
  }
552
552
  var _mqListener = null;
553
553
  function applyTheme(theme) {
554
+ if (typeof document === "undefined") return;
554
555
  const resolved = resolveTheme(theme);
555
556
  document.documentElement.dataset.theme = resolved;
556
557
  if (theme === "system") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weifuwu",
3
- "version": "0.17.21",
3
+ "version": "0.17.23",
4
4
  "description": "Web-standard HTTP framework for Node.js — (req, ctx) => Response",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",