dinou 9.0.3 → 9.2.0

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.
@@ -0,0 +1,25 @@
1
+ // dinou/core/no-dynamic.js
2
+ // Opt-out primitive for Static <Suspense> boundaries in Partial Prerendering (PPR).
3
+
4
+ const NO_DYNAMIC_HOOK_KEY = Symbol.for("dinou.ppr.noDynamic.hook");
5
+
6
+ /**
7
+ * Opts the enclosing <Suspense> boundary out of becoming a Dynamic PPR Hole
8
+ * when wrapping an async Server Component on a PPR route (`ppr = true`).
9
+ *
10
+ * Call `noDynamic()` synchronously at the top of your async Server Component
11
+ * (before the first `await`) so Dinou resolves its promise at build time and
12
+ * bakes the rendered output directly into the Static Shell (`shell.html`).
13
+ */
14
+ export function noDynamic() {
15
+ if (typeof window !== "undefined") {
16
+ return;
17
+ }
18
+ const hook = globalThis[NO_DYNAMIC_HOOK_KEY];
19
+ if (typeof hook === "function") {
20
+ hook();
21
+ }
22
+ }
23
+
24
+ export default noDynamic;
25
+