dinou 9.3.0 → 10.0.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.
- package/CHANGELOG.md +196 -0
- package/README.md +157 -132
- package/dinou/adapters/bun.js +34 -5
- package/dinou/adapters/cloudflare.js +110 -17
- package/dinou/adapters/deno.js +46 -8
- package/dinou/adapters/netlify.js +86 -50
- package/dinou/adapters/node.js +8 -0
- package/dinou/assets.d.ts +32 -5
- package/dinou/bun/build.js +190 -106
- package/dinou/cli.js +992 -532
- package/dinou/cloudflare/build.js +187 -106
- package/dinou/compiled/autoprefixer/index.js +509 -517
- package/dinou/compiled/babel-core/index.js +738 -716
- package/dinou/compiled/babel-generator/index.js +341 -299
- package/dinou/compiled/babel-loader/index.js +766 -744
- package/dinou/compiled/babel-parser/index.js +2 -2
- package/dinou/compiled/babel-plugin-react-compiler/index.js +178 -178
- package/dinou/compiled/babel-plugin-syntax-import-meta/index.js +4 -4
- package/dinou/compiled/babel-preset-react/index.js +752 -730
- package/dinou/compiled/babel-preset-typescript/index.js +738 -716
- package/dinou/compiled/babel-traverse/index.js +463 -433
- package/dinou/compiled/babel-types/index.js +176 -176
- package/dinou/compiled/chokidar/index.js +4 -4
- package/dinou/compiled/commander/index.js +15 -15
- package/dinou/compiled/copy-webpack-plugin/index.js +433 -425
- package/dinou/compiled/css-loader/index.js +289 -289
- package/dinou/compiled/css-loader/runtime/api.js +85 -0
- package/dinou/compiled/css-loader/runtime/getUrl.js +26 -0
- package/dinou/compiled/css-loader/runtime/noSourceMaps.js +5 -0
- package/dinou/compiled/css-loader/runtime/package.json +3 -0
- package/dinou/compiled/css-loader/runtime/sourceMaps.js +16 -0
- package/dinou/compiled/fast-glob/index.js +5810 -0
- package/dinou/compiled/generic-names/index.js +16 -16
- package/dinou/compiled/mini-css-extract-plugin/{chunk-YYEJWYXE.js → chunk-R6DP5ZYM.js} +36 -36
- package/dinou/compiled/mini-css-extract-plugin/hmr/hotModuleReplacement.js +253 -0
- package/dinou/compiled/mini-css-extract-plugin/hmr/normalize-url.js +39 -0
- package/dinou/compiled/mini-css-extract-plugin/hmr/package.json +3 -0
- package/dinou/compiled/mini-css-extract-plugin/index.js +1 -1
- package/dinou/compiled/mini-css-extract-plugin/loader.js +5 -5
- package/dinou/compiled/postcss/index.js +83 -83
- package/dinou/compiled/postcss-import/index.js +147 -117
- package/dinou/compiled/postcss-modules/index.js +216 -216
- package/dinou/compiled/resolve/index.js +1224 -0
- package/dinou/compiled/rollup-plugin-babel/index.js +753 -731
- package/dinou/compiled/rollup-plugin-commonjs/index.js +43 -38
- package/dinou/compiled/rollup-plugin-delete/index.js +615 -253
- package/dinou/compiled/rollup-plugin-json/index.js +22 -18
- package/dinou/compiled/rollup-plugin-node-resolve/index.js +130 -100
- package/dinou/compiled/rollup-plugin-postcss/index.js +3299 -3277
- package/dinou/compiled/rollup-plugin-replace/index.js +34 -29
- package/dinou/compiled/tailwindcss-postcss/index.js +214 -211
- package/dinou/compiled/vendors-manifest.json +59 -83
- package/dinou/core/asset-extensions.js +482 -33
- package/dinou/core/bailout-proxy.js +21 -2
- package/dinou/core/build-static-pages.js +523 -371
- package/dinou/core/builtin-asset-extensions.js +63 -0
- package/dinou/core/cache-revalidate.js +449 -256
- package/dinou/core/cache-slot.js +289 -79
- package/dinou/core/client-webpack.jsx +470 -39
- package/dinou/core/client.jsx +402 -39
- package/dinou/core/config.js +3 -0
- package/dinou/core/copy-static-dirs.js +98 -0
- package/dinou/core/createScopedName.js +22 -4
- package/dinou/core/dinou-paths.js +1 -1
- package/dinou/core/discover-layouts.js +200 -0
- package/dinou/core/edge-ssr.js +1 -1
- package/dinou/core/ensure-vendor-mode.js +78 -19
- package/dinou/core/env.js +544 -0
- package/dinou/core/export-static.js +41 -9
- package/dinou/core/generate-route-types.js +989 -95
- package/dinou/core/generate-static-rsc.js +5 -6
- package/dinou/core/generate-static.js +45 -6
- package/dinou/core/get-abs-path-with-ext.js +217 -75
- package/dinou/core/get-asset-from-manifest.js +19 -8
- package/dinou/core/get-error-jsx.js +4 -5
- package/dinou/core/get-file-path-and-dynamic-params.js +561 -338
- package/dinou/core/get-jsx.js +220 -53
- package/dinou/core/handler.js +1647 -466
- package/dinou/core/import-module.js +7 -0
- package/dinou/core/layout-functions.js +72 -13
- package/dinou/core/link.jsx +34 -6
- package/dinou/core/load-dinou-config.js +520 -89
- package/dinou/core/manifest-provider.js +4 -14
- package/dinou/core/navigation-utils.js +141 -3
- package/dinou/core/navigation.js +134 -50
- package/dinou/core/node-middleware-runner.js +165 -0
- package/dinou/core/postcss-pipeline.js +236 -0
- package/dinou/core/ppr-context.js +114 -22
- package/dinou/core/ppr-runtime.js +391 -127
- package/dinou/core/redirect.jsx +1 -1
- package/dinou/core/render-jsx-to-client-jsx.js +216 -48
- package/dinou/core/request-context.js +59 -3
- package/dinou/core/resolve-contextual-dinou.js +523 -0
- package/dinou/core/resolve-setup-files.js +85 -27
- package/dinou/core/revalidating.js +10 -2
- package/dinou/core/route-generator.js +6 -2
- package/dinou/core/rsc-renderer.js +4 -1
- package/dinou/core/run-ssg.js +6 -0
- package/dinou/core/runtime-env.js +265 -0
- package/dinou/core/server-css-modules-plugin.js +155 -0
- package/dinou/core/server-function-proxy-webpack.js +27 -2
- package/dinou/core/server-function-proxy.js +27 -2
- package/dinou/core/slot.js +47 -2
- package/dinou/core/static-assets.js +503 -0
- package/dinou/core/storage-adapter.js +452 -24
- package/dinou/core/transform-server-functions.js +272 -24
- package/dinou/core/tsconfig-aliases.js +964 -0
- package/dinou/core/uneject.js +640 -0
- package/dinou/core/url-resolver.js +1 -1
- package/dinou/core/vfs.js +11 -2
- package/dinou/css.d.ts +4 -1
- package/dinou/deno/build.js +205 -153
- package/dinou/deno/seed-kv.js +4 -0
- package/dinou/env.d.ts +22 -2
- package/dinou/esbuild/build.js +40 -50
- package/dinou/esbuild/dev.js +33 -7
- package/dinou/esbuild/helpers-esbuild/get-config-esbuild-prod.js +41 -16
- package/dinou/esbuild/helpers-esbuild/get-config-esbuild.js +51 -49
- package/dinou/esbuild/helpers-esbuild/get-esbuild-entries.js +73 -60
- package/dinou/esbuild/helpers-esbuild/swc-disk-cache.js +35 -16
- package/dinou/esbuild/helpers-esbuild/write.js +13 -3
- package/dinou/esbuild/plugins-esbuild/assets-plugin.js +100 -238
- package/dinou/esbuild/plugins-esbuild/babel-react-compiler-plugin.js +73 -29
- package/dinou/esbuild/plugins-esbuild/css-processor-plugin.js +283 -91
- package/dinou/esbuild/plugins-esbuild/manifest-generator-plugin.js +3 -5
- package/dinou/esbuild/plugins-esbuild/react-client-manifest-plugin.js +9 -3
- package/dinou/esbuild/plugins-esbuild/server-functions-plugin.js +4 -3
- package/dinou/esbuild/plugins-esbuild/stable-chunk-names-and-maps-plugin.js +10 -1
- package/dinou/esbuild/plugins-postcss/postcss-extract-plugin.js +84 -21
- package/dinou/esbuild/react-refresh/esm-hmr/client.js +31 -10
- package/dinou/esbuild/react-refresh/esm-hmr-plugin.js +48 -18
- package/dinou/esbuild/react-refresh/is-react-refresh-boundary.js +9 -1
- package/dinou/esbuild/react-refresh/react-refresh-runtime.js +13 -7
- package/dinou/index.d.ts +1028 -88
- package/dinou/node/build.js +138 -74
- package/dinou/node/bundle-dual-engine.js +393 -131
- package/dinou/node/dev.js +1005 -275
- package/dinou/package.json +11 -34
- package/dinou/rollup/postcss.config.js +3 -4
- package/dinou/rollup/react-refresh/esm-hmr/client.js +31 -10
- package/dinou/rollup/react-refresh/react-refresh-wrap-modules.js +16 -13
- package/dinou/rollup/react-refresh/rollup-plugin-esm-hmr.js +53 -7
- package/dinou/rollup/rollup-plugins/dinou-asset-plugin.js +58 -20
- package/dinou/rollup/rollup-plugins/manifest-generator-plugin.js +16 -7
- package/dinou/rollup/rollup-plugins/rollup-plugin-react-client-manifest.js +118 -42
- package/dinou/rollup/rollup-plugins/rollup-plugin-server-functions.js +48 -36
- package/dinou/rollup/rollup.config.js +174 -101
- package/dinou/scripts/build-vendors.js +123 -33
- package/dinou/server.d.ts +126 -15
- package/dinou/webpack/helpers/get-webpack-entries.js +87 -41
- package/dinou/webpack/helpers/patch-webpack-internals.js +93 -1
- package/dinou/webpack/loaders/server-functions-loader.js +1 -1
- package/dinou/webpack/plugins/manifest-generator-plugin.js +27 -7
- package/dinou/webpack/plugins/server-functions-plugin.js +39 -12
- package/dinou/webpack/plugins/webpack-memory-plugin.js +25 -12
- package/dinou/webpack/postcss.config.js +3 -4
- package/dinou/webpack/webpack.config.js +408 -132
- package/eject.js +6 -224
- package/package.json +7 -9
- package/dinou/compiled/cross-env/index.js +0 -661
- package/dinou/compiled/dotenv/index.js +0 -375
- package/dinou/compiled/esbuild-copy-static-files/index.js +0 -63
- package/dinou/compiled/esbuild-tsconfig-paths/index.js +0 -1314
- package/dinou/compiled/rollup-plugin-copy/index.js +0 -12066
- package/dinou/compiled/rollup-plugin-tsconfig-paths/index.js +0 -569
- package/dinou/compiled/tsconfig-paths-webpack-plugin/index.js +0 -3956
|
@@ -21,7 +21,13 @@ import { hydrateRoot } from "react-dom/client";
|
|
|
21
21
|
import { RouterContext } from "./navigation.js";
|
|
22
22
|
import { resolveUrl, isExternalUrl } from "./navigation-utils.js";
|
|
23
23
|
import { createServerFunctionProxy } from "./server-function-proxy-webpack.js";
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
DinouPageContext,
|
|
26
|
+
DinouPageSlot,
|
|
27
|
+
cleanErrorStack,
|
|
28
|
+
flushPendingSsrStreams,
|
|
29
|
+
pruneOrphanedSsrStreams,
|
|
30
|
+
} from "./slot.js";
|
|
25
31
|
|
|
26
32
|
// ====================================================================
|
|
27
33
|
// 1. GLOBAL STATE (Outside the component)
|
|
@@ -56,15 +62,97 @@ const scrollToCurrentHash = (rawHash = typeof window !== "undefined" ? window.lo
|
|
|
56
62
|
// 2. PURE HELPERS
|
|
57
63
|
// ====================================================================
|
|
58
64
|
|
|
65
|
+
const safeDecodeSeg = (val) => {
|
|
66
|
+
try {
|
|
67
|
+
return val ? decodeURIComponent(val) : val;
|
|
68
|
+
} catch (e) {
|
|
69
|
+
return val;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const isRouterSyntaxSeg = (rawSeg) => {
|
|
74
|
+
const seg = safeDecodeSeg(rawSeg);
|
|
75
|
+
return Boolean(
|
|
76
|
+
seg &&
|
|
77
|
+
((seg.startsWith("(") && seg.endsWith(")")) ||
|
|
78
|
+
(seg.startsWith("[") && seg.endsWith("]")) ||
|
|
79
|
+
seg.startsWith("@") ||
|
|
80
|
+
seg.startsWith("_"))
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const matchRoutePattern = (pSegs, uSegs, pIdx = 0, uIdx = 0) => {
|
|
85
|
+
if (pIdx === pSegs.length) return uIdx === uSegs.length;
|
|
86
|
+
const p = pSegs[pIdx];
|
|
87
|
+
if (p.startsWith("[[...") && p.endsWith("]]")) {
|
|
88
|
+
if (pIdx === pSegs.length - 1) return uIdx <= uSegs.length;
|
|
89
|
+
for (let k = uIdx; k <= uSegs.length; k++) {
|
|
90
|
+
if (matchRoutePattern(pSegs, uSegs, pIdx + 1, k)) return true;
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
if (p.startsWith("[...") && p.endsWith("]")) {
|
|
95
|
+
if (uIdx >= uSegs.length) return false;
|
|
96
|
+
if (pIdx === pSegs.length - 1) return true;
|
|
97
|
+
for (let k = uIdx + 1; k <= uSegs.length; k++) {
|
|
98
|
+
if (matchRoutePattern(pSegs, uSegs, pIdx + 1, k)) return true;
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
if (p.startsWith("[[") && p.endsWith("]]")) {
|
|
103
|
+
if (
|
|
104
|
+
uIdx < uSegs.length &&
|
|
105
|
+
matchRoutePattern(pSegs, uSegs, pIdx + 1, uIdx + 1)
|
|
106
|
+
) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
return matchRoutePattern(pSegs, uSegs, pIdx + 1, uIdx);
|
|
110
|
+
}
|
|
111
|
+
if (p.startsWith("[") && p.endsWith("]")) {
|
|
112
|
+
if (uIdx >= uSegs.length) return false;
|
|
113
|
+
return matchRoutePattern(pSegs, uSegs, pIdx + 1, uIdx + 1);
|
|
114
|
+
}
|
|
115
|
+
if (uIdx >= uSegs.length || isRouterSyntaxSeg(uSegs[uIdx])) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
if (uSegs[uIdx] !== p && safeDecodeSeg(uSegs[uIdx]) !== p) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
return matchRoutePattern(pSegs, uSegs, pIdx + 1, uIdx + 1);
|
|
122
|
+
};
|
|
123
|
+
|
|
59
124
|
// Helper to determine active layout folder for a pathname
|
|
60
125
|
const getLayoutKey = (pathname) => {
|
|
61
126
|
const rawLayouts = (typeof window !== "undefined" && window.__DINOU_LAYOUTS__) || ["", "docs"];
|
|
62
|
-
const
|
|
127
|
+
const pageRules = rawLayouts.filter((l) => typeof l === "string" && l.startsWith("="));
|
|
128
|
+
const layouts = rawLayouts.filter(
|
|
129
|
+
(l) => typeof l === "string" && !l.startsWith("!") && !l.startsWith("=")
|
|
130
|
+
);
|
|
63
131
|
const noLayouts = rawLayouts
|
|
64
132
|
.filter((l) => typeof l === "string" && l.startsWith("!"))
|
|
65
133
|
.map((l) => l.slice(1));
|
|
66
134
|
const cleanPath0 = pathname.split("?")[0].split("#")[0];
|
|
67
135
|
const segments0 = cleanPath0.split("/").filter(Boolean);
|
|
136
|
+
|
|
137
|
+
for (const rule of pageRules) {
|
|
138
|
+
const colonIdx = rule.lastIndexOf(":");
|
|
139
|
+
if (colonIdx === -1) continue;
|
|
140
|
+
const pattern = rule.slice(1, colonIdx);
|
|
141
|
+
const spec = rule.slice(colonIdx + 1);
|
|
142
|
+
const pSegs = pattern ? pattern.split("/").filter(Boolean) : [];
|
|
143
|
+
if (matchRoutePattern(pSegs, segments0)) {
|
|
144
|
+
if (spec === "-1") return null;
|
|
145
|
+
if (spec.startsWith("*-")) {
|
|
146
|
+
const trailing = Number(spec.slice(2)) || 0;
|
|
147
|
+
const take = Math.max(0, segments0.length - trailing);
|
|
148
|
+
return take === 0 ? "/" : "/" + segments0.slice(0, take).join("/");
|
|
149
|
+
}
|
|
150
|
+
const depth = Number(spec);
|
|
151
|
+
if (depth <= 0) return "/";
|
|
152
|
+
return "/" + segments0.slice(0, depth).join("/");
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
68
156
|
const fullCandidate = segments0.join("/");
|
|
69
157
|
if (
|
|
70
158
|
noLayouts.includes(fullCandidate) ||
|
|
@@ -137,14 +225,149 @@ const isHashChangeOnly = (finalPath) => {
|
|
|
137
225
|
);
|
|
138
226
|
};
|
|
139
227
|
|
|
228
|
+
const consumeInlineRscResponse = (kind) => {
|
|
229
|
+
if (typeof window === "undefined" || !window.__DINOU_INLINE_RSC__) {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
const consumedFlag = `__DINOU_RSC_${kind}_CONSUMED__`;
|
|
233
|
+
if (window[consumedFlag]) {
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
window[consumedFlag] = true;
|
|
237
|
+
|
|
238
|
+
const arrName = `__DINOU_RSC_${kind}__`;
|
|
239
|
+
const doneName = `__DINOU_RSC_${kind}_DONE__`;
|
|
240
|
+
const pushFnName = `__DINOU_RSC_${kind}_PUSH__`;
|
|
241
|
+
const closeFnName = `__DINOU_RSC_${kind}_CLOSE__`;
|
|
242
|
+
|
|
243
|
+
const encoder = new TextEncoder();
|
|
244
|
+
const stream = new ReadableStream({
|
|
245
|
+
start(controller) {
|
|
246
|
+
let closed = false;
|
|
247
|
+
const existing = window[arrName];
|
|
248
|
+
if (Array.isArray(existing)) {
|
|
249
|
+
for (const chunk of existing) {
|
|
250
|
+
if (chunk) controller.enqueue(encoder.encode(chunk));
|
|
251
|
+
}
|
|
252
|
+
existing.length = 0;
|
|
253
|
+
}
|
|
254
|
+
if (window[doneName]) {
|
|
255
|
+
closed = true;
|
|
256
|
+
controller.close();
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
window[pushFnName] = (chunk) => {
|
|
260
|
+
if (closed || !chunk) return;
|
|
261
|
+
try {
|
|
262
|
+
controller.enqueue(encoder.encode(chunk));
|
|
263
|
+
} catch (e) {}
|
|
264
|
+
};
|
|
265
|
+
window[closeFnName] = () => {
|
|
266
|
+
if (closed) return;
|
|
267
|
+
closed = true;
|
|
268
|
+
try {
|
|
269
|
+
controller.close();
|
|
270
|
+
} catch (e) {}
|
|
271
|
+
};
|
|
272
|
+
if (document.readyState === "complete" && !window[doneName]) {
|
|
273
|
+
setTimeout(() => {
|
|
274
|
+
if (!closed) {
|
|
275
|
+
closed = true;
|
|
276
|
+
try {
|
|
277
|
+
controller.close();
|
|
278
|
+
} catch (e) {}
|
|
279
|
+
}
|
|
280
|
+
}, 0);
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
return new Response(stream, {
|
|
286
|
+
status: 200,
|
|
287
|
+
headers: { "Content-Type": "text/x-component" },
|
|
288
|
+
});
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
const isStaticExportMode = () =>
|
|
292
|
+
typeof window !== "undefined" && Boolean(window.__DINOU_STATIC_EXPORT__);
|
|
293
|
+
|
|
294
|
+
const isStaticExportUnloading = () =>
|
|
295
|
+
typeof window !== "undefined" && Boolean(window.__DINOU_STATIC_EXPORT_UNLOADING__);
|
|
296
|
+
|
|
297
|
+
// Static-export .rsc payloads are pre-rendered static files (not streaming SSR).
|
|
298
|
+
// Buffer the body into an in-memory ArrayBuffer before handing a Response to
|
|
299
|
+
// createFromFetch so that triggering window.location.replace() on a non-RSC
|
|
300
|
+
// fallback cannot abort an in-flight network ReadableStream (e.g. Firefox's
|
|
301
|
+
// "Error in input stream") inside React Flight's stream reader.
|
|
302
|
+
const bufferStaticExportResponse = (res) => {
|
|
303
|
+
if (isStaticExportUnloading()) {
|
|
304
|
+
return new Promise(() => {});
|
|
305
|
+
}
|
|
306
|
+
return res.arrayBuffer().then(
|
|
307
|
+
(buf) => {
|
|
308
|
+
if (isStaticExportUnloading()) {
|
|
309
|
+
return new Promise(() => {});
|
|
310
|
+
}
|
|
311
|
+
return new Response(buf, {
|
|
312
|
+
status: res.status,
|
|
313
|
+
statusText: res.statusText,
|
|
314
|
+
headers: {
|
|
315
|
+
"Content-Type": res.headers.get("content-type") || "text/x-component",
|
|
316
|
+
},
|
|
317
|
+
});
|
|
318
|
+
},
|
|
319
|
+
(err) => {
|
|
320
|
+
if (isStaticExportUnloading()) {
|
|
321
|
+
return new Promise(() => {});
|
|
322
|
+
}
|
|
323
|
+
throw err;
|
|
324
|
+
}
|
|
325
|
+
);
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
const buildStaticExportRscUrl = (rawRouteOrKey, fileName) => {
|
|
329
|
+
const withoutHash = String(rawRouteOrKey || "/").split("#")[0];
|
|
330
|
+
const qIdx = withoutHash.indexOf("?");
|
|
331
|
+
const rawPathname = qIdx === -1 ? withoutHash : withoutHash.slice(0, qIdx);
|
|
332
|
+
const existingQuery = qIdx === -1 ? "" : withoutHash.slice(qIdx + 1);
|
|
333
|
+
const cleanPathname = rawPathname.replace(/\/+$/, "");
|
|
334
|
+
const baseRscPath = cleanPathname ? `${cleanPathname}/${fileName}` : `/${fileName}`;
|
|
335
|
+
return existingQuery ? `${baseRscPath}?${existingQuery}` : baseRscPath;
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
const executeRscRedirect = (redirectUrl) => {
|
|
339
|
+
if (!redirectUrl || typeof window === "undefined") return;
|
|
340
|
+
if (/^https?:\/\//i.test(redirectUrl) || !window.__DINOU_ROUTER_NAVIGATE__) {
|
|
341
|
+
window.location.href = redirectUrl;
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
if (getCurrentRoute() !== redirectUrl) {
|
|
345
|
+
window.__DINOU_ROUTER_NAVIGATE__(redirectUrl, { replace: true });
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
|
|
140
349
|
const getPagePayload = (route, isPrefetch = false, version = 0) => {
|
|
141
|
-
const url = route.split("::")[0];
|
|
350
|
+
const url = route.split("::")[0].split("#")[0] || "/";
|
|
142
351
|
if (pageCache.has(url)) {
|
|
143
352
|
return pageCache.get(url);
|
|
144
353
|
}
|
|
145
354
|
|
|
355
|
+
const staticExport = isStaticExportMode();
|
|
356
|
+
if (staticExport && isStaticExportUnloading()) {
|
|
357
|
+
const pendingPromise = createFromFetch(new Promise(() => {}), {
|
|
358
|
+
callServer: async (id, args) => {
|
|
359
|
+
const proxy = createServerFunctionProxy(id);
|
|
360
|
+
return proxy(...args);
|
|
361
|
+
},
|
|
362
|
+
});
|
|
363
|
+
pendingPromise.catch(() => {});
|
|
364
|
+
pageCache.set(url, pendingPromise);
|
|
365
|
+
return pendingPromise;
|
|
366
|
+
}
|
|
146
367
|
let payloadUrl;
|
|
147
|
-
if (
|
|
368
|
+
if (staticExport) {
|
|
369
|
+
payloadUrl = buildStaticExportRscUrl(url, "page.rsc");
|
|
370
|
+
} else if (window.__DINOU_USE_OLD_RSC__ || window.__DINOU_USE_STATIC__) {
|
|
148
371
|
payloadUrl = window.__DINOU_USE_OLD_RSC__
|
|
149
372
|
? window.__DINOU_USE_STATIC__
|
|
150
373
|
? "/____rsc_page_old_static____" + url
|
|
@@ -160,7 +383,8 @@ const getPagePayload = (route, isPrefetch = false, version = 0) => {
|
|
|
160
383
|
!isPrefetch &&
|
|
161
384
|
typeof document !== "undefined" &&
|
|
162
385
|
(!document.body || document.body.getAttribute("data-hydrated") !== "true");
|
|
163
|
-
const buildId =
|
|
386
|
+
const buildId =
|
|
387
|
+
staticExport || isInitialHydration ? window.__DINOU_BUILD_ID__ : undefined;
|
|
164
388
|
if (buildId && !version) {
|
|
165
389
|
payloadUrl += (payloadUrl.includes("?") ? "&" : "?") + "____build_id____=" + buildId;
|
|
166
390
|
}
|
|
@@ -168,22 +392,52 @@ const getPagePayload = (route, isPrefetch = false, version = 0) => {
|
|
|
168
392
|
payloadUrl += (payloadUrl.includes("?") ? "&" : "?") + "____v____=" + version;
|
|
169
393
|
}
|
|
170
394
|
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
395
|
+
const inlineRes = isInitialHydration && !version ? consumeInlineRscResponse("P") : null;
|
|
396
|
+
const fetchPromise = inlineRes
|
|
397
|
+
? Promise.resolve(inlineRes)
|
|
398
|
+
: fetch(payloadUrl, {
|
|
399
|
+
cache: staticExport && !version ? "default" : "no-store",
|
|
400
|
+
}).then((res) => {
|
|
401
|
+
if (res.headers.has("x-rsc-redirect")) {
|
|
402
|
+
const redirectUrl = res.headers.get("x-rsc-redirect");
|
|
403
|
+
const isCurrentTarget =
|
|
404
|
+
typeof window !== "undefined" &&
|
|
405
|
+
getCurrentRoute() === url.split("#")[0];
|
|
406
|
+
pageCache.delete(url);
|
|
407
|
+
if (isCurrentTarget && redirectUrl) {
|
|
408
|
+
executeRscRedirect(redirectUrl);
|
|
409
|
+
}
|
|
410
|
+
return new Promise(() => {});
|
|
411
|
+
}
|
|
412
|
+
if (isStaticExportUnloading()) {
|
|
413
|
+
return new Promise(() => {});
|
|
414
|
+
}
|
|
415
|
+
if (
|
|
416
|
+
staticExport &&
|
|
417
|
+
(!res.ok ||
|
|
418
|
+
(res.headers.get("content-type") || "").toLowerCase().includes("text/html"))
|
|
419
|
+
) {
|
|
420
|
+
if (!isPrefetch && !isInitialHydration) {
|
|
421
|
+
window.__DINOU_STATIC_EXPORT_UNLOADING__ = true;
|
|
422
|
+
window.location.replace(url);
|
|
179
423
|
} else {
|
|
180
|
-
|
|
424
|
+
pageCache.delete(url);
|
|
181
425
|
}
|
|
426
|
+
return new Promise(() => {});
|
|
182
427
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
428
|
+
if (staticExport) {
|
|
429
|
+
return bufferStaticExportResponse(res);
|
|
430
|
+
}
|
|
431
|
+
return res;
|
|
432
|
+
}, (err) => {
|
|
433
|
+
if (isStaticExportUnloading()) {
|
|
434
|
+
return new Promise(() => {});
|
|
435
|
+
}
|
|
436
|
+
throw err;
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
const promise = createFromFetch(
|
|
440
|
+
fetchPromise,
|
|
187
441
|
{
|
|
188
442
|
callServer: async (id, args) => {
|
|
189
443
|
const proxy = createServerFunctionProxy(id);
|
|
@@ -199,20 +453,34 @@ const getPagePayload = (route, isPrefetch = false, version = 0) => {
|
|
|
199
453
|
|
|
200
454
|
const getLayoutPayload = (layoutKey, searchPart = "", version = 0) => {
|
|
201
455
|
if (!layoutKey) return null;
|
|
202
|
-
const
|
|
456
|
+
const staticExport = isStaticExportMode();
|
|
457
|
+
const cacheKey = staticExport ? layoutKey : `${layoutKey}${searchPart}`;
|
|
203
458
|
if (layoutCache.has(cacheKey)) {
|
|
204
459
|
return layoutCache.get(cacheKey);
|
|
205
460
|
}
|
|
461
|
+
if (staticExport && isStaticExportUnloading()) {
|
|
462
|
+
const pendingPromise = createFromFetch(new Promise(() => {}), {
|
|
463
|
+
callServer: async (id, args) => {
|
|
464
|
+
const proxy = createServerFunctionProxy(id);
|
|
465
|
+
return proxy(...args);
|
|
466
|
+
},
|
|
467
|
+
});
|
|
468
|
+
pendingPromise.catch(() => {});
|
|
469
|
+
layoutCache.set(cacheKey, pendingPromise);
|
|
470
|
+
return pendingPromise;
|
|
471
|
+
}
|
|
206
472
|
|
|
207
473
|
const isInitialHydration =
|
|
208
474
|
typeof document !== "undefined" &&
|
|
209
475
|
(!document.body || document.body.getAttribute("data-hydrated") !== "true");
|
|
210
|
-
const buildId =
|
|
476
|
+
const buildId =
|
|
477
|
+
staticExport || isInitialHydration ? window.__DINOU_BUILD_ID__ : undefined;
|
|
211
478
|
const cleanKey = layoutKey === "/" ? "" : layoutKey;
|
|
212
|
-
let layoutUrl =
|
|
213
|
-
(
|
|
214
|
-
|
|
215
|
-
|
|
479
|
+
let layoutUrl = staticExport
|
|
480
|
+
? buildStaticExportRscUrl((cleanKey || "/") + searchPart, "layout.rsc")
|
|
481
|
+
: (window.__DINOU_USE_STATIC__
|
|
482
|
+
? "/____rsc_layout_static____"
|
|
483
|
+
: "/____rsc_layout____") + cleanKey + searchPart;
|
|
216
484
|
|
|
217
485
|
if (buildId && !version) {
|
|
218
486
|
layoutUrl += (layoutUrl.includes("?") ? "&" : "?") + "____build_id____=" + buildId;
|
|
@@ -222,15 +490,54 @@ const getLayoutPayload = (layoutKey, searchPart = "", version = 0) => {
|
|
|
222
490
|
layoutUrl += (layoutUrl.includes("?") ? "&" : "?") + "____v____=" + version;
|
|
223
491
|
}
|
|
224
492
|
|
|
493
|
+
const inlineRes = isInitialHydration && !version ? consumeInlineRscResponse("L") : null;
|
|
494
|
+
const fetchPromise = inlineRes
|
|
495
|
+
? Promise.resolve(inlineRes)
|
|
496
|
+
: fetch(layoutUrl, {
|
|
497
|
+
cache: staticExport && !version ? "default" : "no-store",
|
|
498
|
+
}).then(
|
|
499
|
+
(res) => {
|
|
500
|
+
if (res.headers.has("x-rsc-redirect")) {
|
|
501
|
+
const redirectUrl = res.headers.get("x-rsc-redirect");
|
|
502
|
+
const isCurrentLayout =
|
|
503
|
+
typeof window !== "undefined" &&
|
|
504
|
+
getLayoutKey(window.location.pathname) === layoutKey;
|
|
505
|
+
layoutCache.delete(cacheKey);
|
|
506
|
+
if (isCurrentLayout && redirectUrl) {
|
|
507
|
+
executeRscRedirect(redirectUrl);
|
|
508
|
+
}
|
|
509
|
+
return new Promise(() => {});
|
|
510
|
+
}
|
|
511
|
+
if (isStaticExportUnloading()) {
|
|
512
|
+
return new Promise(() => {});
|
|
513
|
+
}
|
|
514
|
+
if (
|
|
515
|
+
staticExport &&
|
|
516
|
+
(!res.ok ||
|
|
517
|
+
(res.headers.get("content-type") || "").toLowerCase().includes("text/html"))
|
|
518
|
+
) {
|
|
519
|
+
return new Promise(() => {});
|
|
520
|
+
}
|
|
521
|
+
if (staticExport) {
|
|
522
|
+
return bufferStaticExportResponse(res);
|
|
523
|
+
}
|
|
524
|
+
if (!res.ok) {
|
|
525
|
+
console.warn(
|
|
526
|
+
`[Dinou Router] Layout ${layoutKey} fetch returned status ${res.status}`
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
return res;
|
|
530
|
+
},
|
|
531
|
+
(err) => {
|
|
532
|
+
if (isStaticExportUnloading()) {
|
|
533
|
+
return new Promise(() => {});
|
|
534
|
+
}
|
|
535
|
+
throw err;
|
|
536
|
+
}
|
|
537
|
+
);
|
|
538
|
+
|
|
225
539
|
const promise = createFromFetch(
|
|
226
|
-
|
|
227
|
-
if (!res.ok) {
|
|
228
|
-
console.warn(
|
|
229
|
-
`[Dinou Router] Layout ${layoutKey} fetch returned status ${res.status}`
|
|
230
|
-
);
|
|
231
|
-
}
|
|
232
|
-
return res;
|
|
233
|
-
}),
|
|
540
|
+
fetchPromise,
|
|
234
541
|
{
|
|
235
542
|
callServer: async (id, args) => {
|
|
236
543
|
const proxy = createServerFunctionProxy(id);
|
|
@@ -245,6 +552,9 @@ const getLayoutPayload = (layoutKey, searchPart = "", version = 0) => {
|
|
|
245
552
|
};
|
|
246
553
|
|
|
247
554
|
const getErrorRSCPayload = (route, error) => {
|
|
555
|
+
if (isStaticExportMode() || isStaticExportUnloading()) {
|
|
556
|
+
return null;
|
|
557
|
+
}
|
|
248
558
|
const url = route.split("::")[0];
|
|
249
559
|
const cacheKey = `error::${url}::${error.message || String(error)}`;
|
|
250
560
|
if (pageCache.has(cacheKey)) {
|
|
@@ -285,6 +595,7 @@ const getErrorRSCPayload = (route, error) => {
|
|
|
285
595
|
},
|
|
286
596
|
}
|
|
287
597
|
);
|
|
598
|
+
promise.catch(() => {});
|
|
288
599
|
pageCache.set(cacheKey, promise);
|
|
289
600
|
return promise;
|
|
290
601
|
};
|
|
@@ -313,6 +624,7 @@ const fetchSlotRSC = (slotId, options = {}) => {
|
|
|
313
624
|
|
|
314
625
|
export const refreshSlot = (slotId, options) => {
|
|
315
626
|
if (typeof window !== "undefined") {
|
|
627
|
+
flushPendingSsrStreams();
|
|
316
628
|
const promises = [];
|
|
317
629
|
window.dispatchEvent(
|
|
318
630
|
new CustomEvent("dinou:refresh-slot", {
|
|
@@ -341,6 +653,7 @@ class ErrorBoundary extends Component {
|
|
|
341
653
|
}
|
|
342
654
|
|
|
343
655
|
componentDidCatch(error, errorInfo) {
|
|
656
|
+
if (isStaticExportUnloading()) return;
|
|
344
657
|
console.error("[Dinou] ErrorBoundary caught error:", error, errorInfo);
|
|
345
658
|
if (this.props.onError) {
|
|
346
659
|
this.props.onError(error);
|
|
@@ -355,6 +668,9 @@ class ErrorBoundary extends Component {
|
|
|
355
668
|
|
|
356
669
|
render() {
|
|
357
670
|
if (this.state.hasError) {
|
|
671
|
+
if (isStaticExportUnloading()) {
|
|
672
|
+
return null;
|
|
673
|
+
}
|
|
358
674
|
if (this.props.fallback) {
|
|
359
675
|
return this.props.fallback(this.state.error);
|
|
360
676
|
}
|
|
@@ -475,6 +791,15 @@ function Router() {
|
|
|
475
791
|
}
|
|
476
792
|
const finalPath = resolveUrl(href, window.location.pathname);
|
|
477
793
|
|
|
794
|
+
if (isExternalUrl(finalPath)) {
|
|
795
|
+
if (options.replace) {
|
|
796
|
+
window.location.replace(finalPath);
|
|
797
|
+
} else {
|
|
798
|
+
window.location.assign(finalPath);
|
|
799
|
+
}
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
|
|
478
803
|
// 🛡️ NAVIGATE PROTECTION: Hash Detection
|
|
479
804
|
if (isHashChangeOnly(finalPath)) {
|
|
480
805
|
if (options.replace) {
|
|
@@ -493,8 +818,10 @@ function Router() {
|
|
|
493
818
|
return; // CRITICAL STOP
|
|
494
819
|
}
|
|
495
820
|
|
|
821
|
+
const routeWithoutHash = finalPath.split("#")[0] || "/";
|
|
822
|
+
|
|
496
823
|
if (options.fresh) {
|
|
497
|
-
pageCache.delete(
|
|
824
|
+
pageCache.delete(routeWithoutHash);
|
|
498
825
|
}
|
|
499
826
|
|
|
500
827
|
// Normal RSC Navigation
|
|
@@ -508,9 +835,13 @@ function Router() {
|
|
|
508
835
|
window.history.pushState(null, "", finalPath);
|
|
509
836
|
}
|
|
510
837
|
|
|
838
|
+
flushPendingSsrStreams();
|
|
511
839
|
startTransition(() => {
|
|
512
840
|
setIsPopState(false);
|
|
513
|
-
setRoute(
|
|
841
|
+
setRoute(routeWithoutHash);
|
|
842
|
+
if (options.fresh) {
|
|
843
|
+
setVersion((v) => v + 1);
|
|
844
|
+
}
|
|
514
845
|
setNavError(null);
|
|
515
846
|
setNavCount((c) => c + 1);
|
|
516
847
|
});
|
|
@@ -534,6 +865,7 @@ function Router() {
|
|
|
534
865
|
}
|
|
535
866
|
}
|
|
536
867
|
|
|
868
|
+
flushPendingSsrStreams();
|
|
537
869
|
startTransition(() => {
|
|
538
870
|
setVersion((v) => v + 1);
|
|
539
871
|
if (shouldRefreshLayout) {
|
|
@@ -549,17 +881,19 @@ function Router() {
|
|
|
549
881
|
window.__DINOU_PREFETCH__ = (url) => {
|
|
550
882
|
// 🛡️ PREFETCH PROTECTION: If it's a local hash, do nothing
|
|
551
883
|
if (isHashChangeOnly(url)) return;
|
|
552
|
-
const
|
|
884
|
+
const cleanUrl = String(url || "/").split("#")[0] || "/";
|
|
885
|
+
const lKey = getLayoutKey(cleanUrl);
|
|
553
886
|
if (lKey && !layoutCache.has(lKey)) {
|
|
554
887
|
getLayoutPayload(lKey);
|
|
555
888
|
}
|
|
556
|
-
getPagePayload(
|
|
889
|
+
getPagePayload(cleanUrl, true);
|
|
557
890
|
};
|
|
558
891
|
|
|
559
892
|
window.__DINOU_ROUTER_NAVIGATE__ = navigate;
|
|
560
893
|
window.__DINOU_ROUTER_REFRESH__ = refresh;
|
|
561
894
|
|
|
562
895
|
// Hydration
|
|
896
|
+
flushPendingSsrStreams();
|
|
563
897
|
document.body.setAttribute("data-hydrated", "true");
|
|
564
898
|
|
|
565
899
|
return () => {
|
|
@@ -584,7 +918,9 @@ function Router() {
|
|
|
584
918
|
const anchor = e.target.closest("a");
|
|
585
919
|
if (
|
|
586
920
|
!anchor ||
|
|
587
|
-
anchor.target ||
|
|
921
|
+
(anchor.target && anchor.target !== "_self") ||
|
|
922
|
+
anchor.hasAttribute("download") ||
|
|
923
|
+
e.button !== 0 ||
|
|
588
924
|
e.metaKey ||
|
|
589
925
|
e.ctrlKey ||
|
|
590
926
|
e.shiftKey ||
|
|
@@ -615,6 +951,7 @@ function Router() {
|
|
|
615
951
|
window.__DINOU_ACTIVE_LAYOUT__ = null;
|
|
616
952
|
}
|
|
617
953
|
const target = getCurrentRoute();
|
|
954
|
+
flushPendingSsrStreams();
|
|
618
955
|
startTransition(() => {
|
|
619
956
|
setIsPopState(true);
|
|
620
957
|
setRoute(target);
|
|
@@ -729,6 +1066,7 @@ function Router() {
|
|
|
729
1066
|
}, [route, version, navError]);
|
|
730
1067
|
|
|
731
1068
|
useLayoutEffect(() => {
|
|
1069
|
+
pruneOrphanedSsrStreams();
|
|
732
1070
|
if (
|
|
733
1071
|
typeof document !== "undefined" &&
|
|
734
1072
|
document.body &&
|
|
@@ -768,7 +1106,7 @@ function Router() {
|
|
|
768
1106
|
<RouterContext.Provider value={contextValue}>
|
|
769
1107
|
<ErrorBoundary
|
|
770
1108
|
resetKey={`${route}::${navCount}`}
|
|
771
|
-
onError={setNavError}
|
|
1109
|
+
onError={isStaticExportMode() ? undefined : setNavError}
|
|
772
1110
|
>
|
|
773
1111
|
<DinouPageContext.Provider value={slotContextValue}>
|
|
774
1112
|
{navError
|
|
@@ -791,6 +1129,9 @@ const app = useStrictMode
|
|
|
791
1129
|
: routerElement;
|
|
792
1130
|
|
|
793
1131
|
const onRecoverableError = (error) => {
|
|
1132
|
+
if (isStaticExportUnloading()) {
|
|
1133
|
+
return;
|
|
1134
|
+
}
|
|
794
1135
|
if (
|
|
795
1136
|
error?.name === "InvalidStateError" &&
|
|
796
1137
|
(error?.message?.includes("Document hidden") || (typeof document !== "undefined" && document.hidden))
|
|
@@ -808,6 +1149,24 @@ const onRecoverableError = (error) => {
|
|
|
808
1149
|
}
|
|
809
1150
|
};
|
|
810
1151
|
|
|
1152
|
+
const onUncaughtError = (error) => {
|
|
1153
|
+
if (isStaticExportUnloading()) {
|
|
1154
|
+
return;
|
|
1155
|
+
}
|
|
1156
|
+
if (typeof reportError === "function") {
|
|
1157
|
+
reportError(error);
|
|
1158
|
+
} else {
|
|
1159
|
+
console.error(error);
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
|
|
1163
|
+
const onCaughtError = (error) => {
|
|
1164
|
+
if (isStaticExportUnloading()) {
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
console.error(error);
|
|
1168
|
+
};
|
|
1169
|
+
|
|
811
1170
|
// If the server rendered a fatal layout error during SSR (meaning there is no layout DOM to hydrate),
|
|
812
1171
|
// do NOT attempt to hydrate the application over it.
|
|
813
1172
|
const hasInitialServerError =
|
|
@@ -816,7 +1175,11 @@ const isLayoutError =
|
|
|
816
1175
|
hasInitialServerError && window.__DINOU_ERROR_SEGMENT__ !== "page";
|
|
817
1176
|
|
|
818
1177
|
if (!isLayoutError) {
|
|
819
|
-
hydrateRoot(document, app, {
|
|
1178
|
+
hydrateRoot(document, app, {
|
|
1179
|
+
onRecoverableError,
|
|
1180
|
+
onUncaughtError,
|
|
1181
|
+
onCaughtError,
|
|
1182
|
+
});
|
|
820
1183
|
} else {
|
|
821
1184
|
console.warn(
|
|
822
1185
|
"[Dinou] Initial layout server error detected:",
|
|
@@ -828,6 +1191,74 @@ if (!isLayoutError) {
|
|
|
828
1191
|
}
|
|
829
1192
|
}
|
|
830
1193
|
|
|
1194
|
+
if (
|
|
1195
|
+
process.env.NODE_ENV !== "production" &&
|
|
1196
|
+
typeof window !== "undefined" &&
|
|
1197
|
+
typeof WebSocket !== "undefined"
|
|
1198
|
+
) {
|
|
1199
|
+
try {
|
|
1200
|
+
const hmrPort = process.env.DINOU_HMR_PORT || "3001";
|
|
1201
|
+
const wsProtocol = window.location.protocol === "https:" ? "wss:" : "ws:";
|
|
1202
|
+
const wsUrl = `${wsProtocol}//${window.location.hostname}:${hmrPort}/ws`;
|
|
1203
|
+
const ws = new WebSocket(wsUrl);
|
|
1204
|
+
|
|
1205
|
+
const applyStyleUpdate = (targetUrl) => {
|
|
1206
|
+
const cleanTarget = targetUrl ? targetUrl.split("?")[0] : "";
|
|
1207
|
+
const links = document.querySelectorAll('link[rel="stylesheet"]');
|
|
1208
|
+
for (const link of links) {
|
|
1209
|
+
const rawHref = link.getAttribute("href");
|
|
1210
|
+
if (!rawHref) continue;
|
|
1211
|
+
const cleanHref = rawHref.split("?")[0];
|
|
1212
|
+
if (
|
|
1213
|
+
!cleanTarget ||
|
|
1214
|
+
cleanHref.endsWith(cleanTarget) ||
|
|
1215
|
+
cleanTarget.endsWith(cleanHref) ||
|
|
1216
|
+
cleanHref.includes("styles.css")
|
|
1217
|
+
) {
|
|
1218
|
+
const nextUrl = new URL(link.href, window.location.origin);
|
|
1219
|
+
nextUrl.searchParams.set("t", String(Date.now()));
|
|
1220
|
+
link.href = nextUrl.href;
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
};
|
|
1224
|
+
|
|
1225
|
+
ws.addEventListener("message", (event) => {
|
|
1226
|
+
if (!event?.data || typeof event.data !== "string") return;
|
|
1227
|
+
try {
|
|
1228
|
+
const parsed = JSON.parse(event.data);
|
|
1229
|
+
if (parsed.type === "static-changed") {
|
|
1230
|
+
window.location.reload();
|
|
1231
|
+
return;
|
|
1232
|
+
}
|
|
1233
|
+
if (parsed.type === "dinou-hmr" && parsed.data) {
|
|
1234
|
+
const msg = parsed.data;
|
|
1235
|
+
if (msg.type === "reload") {
|
|
1236
|
+
window.location.reload();
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
if (msg.type === "style-update") {
|
|
1240
|
+
applyStyleUpdate(msg.url || "/styles.css");
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1243
|
+
if (msg.type === "rsc-update") {
|
|
1244
|
+
if (typeof window.__DINOU_ROUTER_REFRESH__ === "function") {
|
|
1245
|
+
const refreshLayout = Boolean(
|
|
1246
|
+
msg.layout ||
|
|
1247
|
+
(msg.path &&
|
|
1248
|
+
(/(?:^|[\\/])layout\.[jt]sx?$/i.test(msg.path) ||
|
|
1249
|
+
/\.module\.css$/i.test(msg.path)))
|
|
1250
|
+
);
|
|
1251
|
+
window.__DINOU_ROUTER_REFRESH__({ layout: refreshLayout });
|
|
1252
|
+
} else {
|
|
1253
|
+
window.location.reload();
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
} catch (e) {}
|
|
1258
|
+
});
|
|
1259
|
+
} catch (e) {}
|
|
1260
|
+
}
|
|
1261
|
+
|
|
831
1262
|
if (import.meta.hot) {
|
|
832
1263
|
import.meta.hot.accept();
|
|
833
1264
|
}
|