@wular/pnext 0.1.7 → 0.1.9
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/server/_chunks/{aliases-j47a10ce.js → aliases-fhv4dt06.js} +7 -5
- package/dist/server/_chunks/{analyze-arswqe6s.js → analyze-09kx9q6r.js} +17 -13
- package/dist/server/_chunks/{boot-af0mv3dy.js → boot-8aj7efqk.js} +13 -11
- package/dist/server/_chunks/{build-spy3dxp4.js → build-jda155c9.js} +7 -5
- package/dist/server/_chunks/{build-tier-m7yvqz61.js → build-tier-qrkpfsk1.js} +59 -75
- package/dist/server/_chunks/{build-t9h0hec3.js → build-wspv5h60.js} +1004 -1191
- package/dist/server/_chunks/{compile-53j02j27.js → compile-040r79gj.js} +2 -2
- package/dist/server/_chunks/{config-n2z7yxps.js → config-7h84p6q8.js} +6 -4
- package/dist/server/_chunks/{config-1yzwexq6.js → config-d4hqyygy.js} +12 -3
- package/dist/server/_chunks/{create-meec9hs6.js → create-skj8wzt5.js} +4 -3
- package/dist/server/_chunks/{dev-fjmqg6en.js → dev-pennd36n.js} +2 -2
- package/dist/server/_chunks/{generate-n9sh6hzt.js → generate-d8vb1d21.js} +5 -4
- package/dist/server/_chunks/{index-eeaanp2e.js → index-0qt2vapb.js} +3 -3
- package/dist/server/_chunks/{index-91x12ykq.js → index-0r5eqfc7.js} +6 -1
- package/dist/server/_chunks/{index-9ych9ma8.js → index-0wm2p3ks.js} +2 -2
- package/dist/server/_chunks/{index-357na4a8.js → index-141vcwk6.js} +1 -1
- package/dist/server/_chunks/{index-2dv4y4wd.js → index-1y0cesgn.js} +16 -10
- package/dist/server/_chunks/{index-ytjvpbm2.js → index-26gwrm07.js} +3 -3
- package/dist/server/_chunks/{index-8k7pfejn.js → index-3r6qpe8a.js} +7 -7
- package/dist/server/_chunks/{index-rn8dyr1f.js → index-42fef2rv.js} +8 -48
- package/dist/server/_chunks/{index-ncnes8c6.js → index-47gx7trn.js} +2 -2
- package/dist/server/_chunks/{index-20ppawv7.js → index-4qsce64w.js} +3 -3
- package/dist/server/_chunks/{index-1011cscr.js → index-4vf121ws.js} +61 -29
- package/dist/server/_chunks/{index-cf4rvxv6.js → index-52k54ykj.js} +1 -1
- package/dist/server/_chunks/{index-nyrba2kr.js → index-53fnn598.js} +11 -11
- package/dist/server/_chunks/{index-4hgjrqh7.js → index-6tb725m8.js} +2 -2
- package/dist/server/_chunks/{index-3xbr4eyv.js → index-912z4mfx.js} +3 -3
- package/dist/server/_chunks/{index-sjpckxqn.js → index-9f49w76j.js} +1 -1
- package/dist/server/_chunks/{index-jepjvcrf.js → index-aarf1brn.js} +1 -1
- package/dist/server/_chunks/{index-9n2914ww.js → index-akkrvjn6.js} +1 -1
- package/dist/server/_chunks/index-bzd2ef7t.js +10 -0
- package/dist/server/_chunks/{index-sv8m6789.js → index-cqcwwxfp.js} +5 -5
- package/dist/server/_chunks/{index-yz54pxrh.js → index-d1jsmhhk.js} +4 -9
- package/dist/server/_chunks/{index-vvmmknm1.js → index-da0fphj0.js} +19 -15
- package/dist/server/_chunks/{index-sctcgyvv.js → index-drwv61cc.js} +2 -2
- package/dist/server/_chunks/{index-z84ab1w0.js → index-e176wk6x.js} +3 -3
- package/dist/server/_chunks/{index-9hx2641q.js → index-entm8bmz.js} +1 -1
- package/dist/server/_chunks/index-fpghsgb4.js +352 -0
- package/dist/server/_chunks/{index-jx7bqvw1.js → index-hr63fvzn.js} +1 -1
- package/dist/server/_chunks/{index-eajaspjk.js → index-j0m1jxqa.js} +1 -1
- package/dist/server/_chunks/index-jbj7ehef.js +50 -0
- package/dist/server/_chunks/{index-egykcqg3.js → index-jexsy9a8.js} +1 -1
- package/dist/server/_chunks/{index-fkp000p1.js → index-jjppzw0s.js} +2 -2
- package/dist/server/_chunks/index-jt8e1pje.js +12 -0
- package/dist/server/_chunks/{index-ggk2j965.js → index-kpdph69z.js} +56 -50
- package/dist/server/_chunks/{index-6e4fqv30.js → index-m63czgq5.js} +2 -0
- package/dist/server/_chunks/{index-c0g2wf3z.js → index-md5jchzy.js} +1 -1
- package/dist/server/_chunks/{index-tvqkq6e6.js → index-n814hcky.js} +1 -1
- package/dist/server/_chunks/{index-06nyqntx.js → index-q3r9z8mq.js} +1 -1
- package/dist/server/_chunks/{index-4q2gbfwk.js → index-qjrh7w2g.js} +2 -2
- package/dist/server/_chunks/{index-3b3at80h.js → index-s61bx2aj.js} +6 -3
- package/dist/server/_chunks/{index-ym67zqxp.js → index-tf4j19ge.js} +1 -1
- package/dist/server/_chunks/{index-qn4z5s3c.js → index-typcbcsv.js} +3 -3
- package/dist/server/_chunks/{index-p77b4kcx.js → index-veycp46e.js} +1 -1
- package/dist/server/_chunks/{index-11sfk4hb.js → index-vmr35jjw.js} +1 -1
- package/dist/server/_chunks/{index-kq8kpzye.js → index-vqs3rebe.js} +3 -3
- package/dist/server/_chunks/{index-danncfhy.js → index-wm36rj4v.js} +1 -1
- package/dist/server/_chunks/{index-z4z9zv3b.js → index-x9c55pzy.js} +141 -3
- package/dist/server/_chunks/{index-y2jr2n72.js → index-xrsg0041.js} +4 -4
- package/dist/server/_chunks/{index-k1g3epw0.js → index-xs3411qh.js} +10 -10
- package/dist/server/_chunks/{index-0374j2b9.js → index-y4d02znn.js} +1 -1
- package/dist/server/_chunks/{index-wpfhfbs4.js → index-y71a76dn.js} +4 -4
- package/dist/server/_chunks/{index-qm6kmhqs.js → index-y7mzvq2q.js} +1 -1
- package/dist/server/_chunks/{index-hkdfj58q.js → index-y9bygr95.js} +1 -1
- package/dist/server/_chunks/{index-3tf1xjsp.js → index-yghskk8w.js} +11 -11
- package/dist/server/_chunks/{index-5gyr4emz.js → index-yzcpr3yw.js} +4 -4
- package/dist/server/_chunks/{index-x93hv0sc.js → index-zedjt25v.js} +23 -10
- package/dist/server/_chunks/{index-tq0pc7eg.js → index-zfrwq472.js} +3 -3
- package/dist/server/_chunks/{loader-7yw0j98z.js → loader-w1e0n5sm.js} +12 -10
- package/dist/server/_chunks/{modules-jn8bmbn8.js → modules-730j14cm.js} +14 -12
- package/dist/server/_chunks/{pipeline-yy9jhydf.js → pipeline-yjdnwbhm.js} +25 -21
- package/dist/server/_chunks/{production-jar9ztm3.js → production-1xe9b7wd.js} +14 -3
- package/dist/server/_chunks/{proxy-config-j84dgksn.js → proxy-config-9r9e0jvn.js} +7 -5
- package/dist/server/_chunks/{proxy-w1d0wmsn.js → proxy-pnevsbfd.js} +12 -10
- package/dist/server/_chunks/{router-k1reahfn.js → router-rzge0vz8.js} +10 -7
- package/dist/server/_chunks/{routes-2s277fc6.js → routes-0x8wjvcj.js} +12 -10
- package/dist/server/_chunks/{run-pvd8bs1t.js → run-tk90r3ac.js} +5 -4
- package/dist/server/_chunks/{server-mt4a994c.js → server-gev78ejc.js} +38 -34
- package/dist/server/_chunks/{tsconfig-defaults-1nb3308g.js → tsconfig-defaults-qe9wd6ne.js} +5 -4
- package/dist/server/_chunks/{typegen-0qr0459b.js → typegen-0yw8sry8.js} +15 -13
- package/dist/server/cli/index.js +12 -15
- package/dist/server/cli/start.js +35 -14
- package/dist/server/compat/next/cache.js +5 -5
- package/dist/server/compat/next/config-headers.js +8 -6
- package/dist/server/compat/next/config-loader.js +1 -1
- package/dist/server/compat/next/dist/server/web/spec-extension/revalidate.js +5 -5
- package/dist/server/compat/next/dist/server/web/spec-extension/unstable-cache.js +5 -5
- package/dist/server/compat/next/dist/server/web/spec-extension/unstable-no-store.js +5 -5
- package/dist/server/compat/next/dynamic.js +3 -14
- package/dist/server/compat/next/font/cache.js +6 -4
- package/dist/server/compat/next/font/local.js +7 -5
- package/dist/server/compat/next/font/runtime.js +7 -5
- package/dist/server/compat/next/headers.js +4 -4
- package/dist/server/compat/next/image/config.js +2 -2
- package/dist/server/compat/next/image/optimizer.js +3 -3
- package/dist/server/compat/next/image/static-metadata.js +4 -4
- package/dist/server/compat/next/legacy-request-apis.js +3 -3
- package/dist/server/compat/next/link-transform.js +4 -3
- package/dist/server/compat/next/navigation.js +5 -4
- package/dist/server/compat/next/redirects.js +8 -6
- package/dist/server/compat/next/resource-hints.js +2 -2
- package/dist/server/compat/next/rewrites.js +7 -5
- package/dist/server/compat/next/root-params.js +3 -3
- package/dist/server/compat/next/route-state.js +2 -2
- package/dist/server/compat/next/script.js +2 -2
- package/dist/server/compat/next/server.js +5 -5
- package/dist/server/generation.json +1 -1
- package/package.json +1 -1
- package/reference/compat.md +1 -1
- package/reference/config.md +2 -2
- package/reference/dev.md +1 -1
- package/reference/getting-started.md +1 -1
- package/reference/rendering.md +4 -4
- package/src/api/dynamic.tsx +84 -4
- package/src/cli/adapters/vercel-warm.ts +40 -29
- package/src/cli/adapters/vercel.ts +101 -1265
- package/src/cli/analyze.ts +3 -2
- package/src/cli/build/cache.ts +6 -6
- package/src/cli/build.ts +33 -33
- package/src/cli/index.ts +4 -6
- package/src/cli/serve/pipeline.ts +16 -10
- package/src/cli/serve/standalone-worker.ts +8 -0
- package/src/cli/serve/standalone.ts +727 -0
- package/src/cli/start.ts +29 -8
- package/src/client/build.ts +1 -1
- package/src/client/reference-stub.ts +2 -34
- package/src/compat/actions/extensions.ts +3 -2
- package/src/compat/bundler/require-context.ts +2 -1
- package/src/compat/bundler/webpack-loaders.ts +3 -2
- package/src/compat/bundler/worker.ts +2 -2
- package/src/compat/css/inline-css.ts +1 -1
- package/src/compat/export/build-complete.ts +1 -1
- package/src/compat/export/emit.ts +4 -4
- package/src/compat/export/standalone.ts +30 -65
- package/src/compat/image-optimizer/optimize.ts +1 -1
- package/src/compat/lifecycle/instrumentation-client.ts +4 -3
- package/src/compat/metadata-artifacts.ts +1 -1
- package/src/compat/next/config-loader.ts +3 -0
- package/src/compat/next/dynamic.tsx +10 -23
- package/src/compat/next/font/cache.ts +2 -1
- package/src/compat/next/font/runtime.ts +1 -1
- package/src/compat/register/image.ts +1 -1
- package/src/compat/typecheck/check.ts +6 -4
- package/src/config.ts +28 -5
- package/src/css/assets.ts +1 -1
- package/src/css/build.ts +16 -9
- package/src/dev/client-chunk-store.ts +2 -1
- package/src/dev/restart/client-key.ts +2 -1
- package/src/dev/restart/global-css.ts +2 -1
- package/src/dev/restart/route-bundle-key.ts +2 -1
- package/src/dev/restart/route-facts.ts +2 -1
- package/src/dev/server.ts +8 -7
- package/src/out-paths.ts +10 -0
- package/src/render/renderer.ts +1 -1
- package/src/resolve/dynamic.ts +4 -0
- package/src/resolve/engine.ts +2 -12
- package/src/resolve/scan-facts.ts +185 -1
- package/src/routing/metadata-files.ts +1 -1
- package/src/runtime/loader.ts +5 -3
- package/src/runtime/module-cache.ts +2 -1
- package/src/runtime/modules.ts +50 -16
- package/src/runtime/prebundle.ts +23 -3
- package/src/runtime/production.ts +105 -40
- package/src/runtime/release-graph.ts +21 -13
- package/src/runtime/vendor-build.ts +45 -23
- package/src/types.ts +2 -3
- package/src/utils/directive.ts +40 -0
- package/src/utils/fs.ts +7 -2
- package/src/utils/resource-query.ts +12 -0
- package/dist/server/_chunks/index-tqn2qnnn.js +0 -241
- package/dist/server/_chunks/index-y36a0ybw.js +0 -57
- package/src/cli/serve/entry.ts +0 -52
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
unstable_cache
|
|
4
|
-
} from "../../../../../../_chunks/index-
|
|
5
|
-
import"../../../../../../_chunks/index-
|
|
6
|
-
import"../../../../../../_chunks/index-
|
|
7
|
-
import"../../../../../../_chunks/index-
|
|
4
|
+
} from "../../../../../../_chunks/index-zfrwq472.js";
|
|
5
|
+
import"../../../../../../_chunks/index-entm8bmz.js";
|
|
6
|
+
import"../../../../../../_chunks/index-j0m1jxqa.js";
|
|
7
|
+
import"../../../../../../_chunks/index-akkrvjn6.js";
|
|
8
8
|
import"../../../../../../_chunks/index-bcws5eh2.js";
|
|
9
|
-
import"../../../../../../_chunks/index-
|
|
9
|
+
import"../../../../../../_chunks/index-m63czgq5.js";
|
|
10
10
|
import"../../../../../../_chunks/index-cjgqs13g.js";
|
|
11
11
|
import"../../../../../../_chunks/index-jks0x0a1.js";
|
|
12
12
|
import"../../../../../../_chunks/index-6b009mt0.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
unstable_noStore
|
|
4
|
-
} from "../../../../../../_chunks/index-
|
|
5
|
-
import"../../../../../../_chunks/index-
|
|
6
|
-
import"../../../../../../_chunks/index-
|
|
7
|
-
import"../../../../../../_chunks/index-
|
|
4
|
+
} from "../../../../../../_chunks/index-zfrwq472.js";
|
|
5
|
+
import"../../../../../../_chunks/index-entm8bmz.js";
|
|
6
|
+
import"../../../../../../_chunks/index-j0m1jxqa.js";
|
|
7
|
+
import"../../../../../../_chunks/index-akkrvjn6.js";
|
|
8
8
|
import"../../../../../../_chunks/index-bcws5eh2.js";
|
|
9
|
-
import"../../../../../../_chunks/index-
|
|
9
|
+
import"../../../../../../_chunks/index-m63czgq5.js";
|
|
10
10
|
import"../../../../../../_chunks/index-cjgqs13g.js";
|
|
11
11
|
import"../../../../../../_chunks/index-jks0x0a1.js";
|
|
12
12
|
import"../../../../../../_chunks/index-6b009mt0.js";
|
|
@@ -3,29 +3,18 @@ import"../../_chunks/index-rt9qq1va.js";
|
|
|
3
3
|
|
|
4
4
|
// src/compat/next/dynamic.tsx
|
|
5
5
|
import { h } from "preact";
|
|
6
|
-
import { lazy, Suspense } from "preact/compat";
|
|
7
6
|
import {
|
|
8
7
|
dynamic as pnextDynamic,
|
|
9
8
|
dynamicReferenceSymbol
|
|
10
9
|
} from "../../../../src/api/dynamic.tsx";
|
|
11
10
|
function dynamic(loader, options = {}, target) {
|
|
12
|
-
if (typeof loader === "string")
|
|
13
|
-
return pnextDynamic(loader, options, target);
|
|
14
11
|
const coreDynamic = pnextDynamic(loader, options, target);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (options.ssr === false) {
|
|
19
|
-
return h("pnext-dynamic", { style: { display: "contents" } }, typeof window === "undefined" ? null : h(coreDynamic, props));
|
|
20
|
-
}
|
|
21
|
-
return h(Suspense, { fallback: Loading ? h(Loading, props) : null }, h(Lazy, props));
|
|
22
|
-
};
|
|
12
|
+
if (typeof loader === "string" || options.ssr !== false)
|
|
13
|
+
return coreDynamic;
|
|
14
|
+
const DynamicComponent = (props) => h("pnext-dynamic", { style: { display: "contents" } }, typeof window === "undefined" ? null : h(coreDynamic, props));
|
|
23
15
|
DynamicComponent[dynamicReferenceSymbol] = coreDynamic[dynamicReferenceSymbol];
|
|
24
16
|
return DynamicComponent;
|
|
25
17
|
}
|
|
26
|
-
function componentFromModule(module) {
|
|
27
|
-
return typeof module === "function" ? module : module.default;
|
|
28
|
-
}
|
|
29
18
|
export {
|
|
30
19
|
dynamic as default,
|
|
31
20
|
dynamic
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
persistFont,
|
|
4
4
|
persistedFont
|
|
5
|
-
} from "../../../_chunks/index-
|
|
5
|
+
} from "../../../_chunks/index-s61bx2aj.js";
|
|
6
6
|
import"../../../_chunks/index-knp0s912.js";
|
|
7
|
-
import"../../../_chunks/index-
|
|
8
|
-
import"../../../_chunks/index-
|
|
9
|
-
import"../../../_chunks/index-
|
|
7
|
+
import"../../../_chunks/index-md5jchzy.js";
|
|
8
|
+
import"../../../_chunks/index-4qsce64w.js";
|
|
9
|
+
import"../../../_chunks/index-bzd2ef7t.js";
|
|
10
|
+
import"../../../_chunks/index-fpghsgb4.js";
|
|
11
|
+
import"../../../_chunks/index-jt8e1pje.js";
|
|
10
12
|
import"../../../_chunks/index-rt9qq1va.js";
|
|
11
13
|
export {
|
|
12
14
|
persistFont,
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
localFont
|
|
4
|
-
} from "../../../_chunks/index-
|
|
5
|
-
import"../../../_chunks/index-
|
|
4
|
+
} from "../../../_chunks/index-26gwrm07.js";
|
|
5
|
+
import"../../../_chunks/index-s61bx2aj.js";
|
|
6
6
|
import"../../../_chunks/index-knp0s912.js";
|
|
7
|
-
import"../../../_chunks/index-
|
|
7
|
+
import"../../../_chunks/index-md5jchzy.js";
|
|
8
8
|
import"../../../_chunks/index-fn1chkkd.js";
|
|
9
|
-
import"../../../_chunks/index-
|
|
10
|
-
import"../../../_chunks/index-
|
|
9
|
+
import"../../../_chunks/index-4qsce64w.js";
|
|
10
|
+
import"../../../_chunks/index-bzd2ef7t.js";
|
|
11
|
+
import"../../../_chunks/index-fpghsgb4.js";
|
|
11
12
|
import"../../../_chunks/index-grta8ap3.js";
|
|
12
13
|
import"../../../_chunks/index-kresp2n8.js";
|
|
13
14
|
import"../../../_chunks/index-e3a6yx84.js";
|
|
15
|
+
import"../../../_chunks/index-jt8e1pje.js";
|
|
14
16
|
import"../../../_chunks/index-zqpqyg8p.js";
|
|
15
17
|
import"../../../_chunks/index-qjj6gddn.js";
|
|
16
18
|
import"../../../_chunks/index-rt9qq1va.js";
|
|
@@ -12,16 +12,18 @@ import {
|
|
|
12
12
|
releaseFonts,
|
|
13
13
|
runWithFontScope,
|
|
14
14
|
takeFontHeaderPreloads
|
|
15
|
-
} from "../../../_chunks/index-
|
|
16
|
-
import"../../../_chunks/index-
|
|
15
|
+
} from "../../../_chunks/index-26gwrm07.js";
|
|
16
|
+
import"../../../_chunks/index-s61bx2aj.js";
|
|
17
17
|
import"../../../_chunks/index-knp0s912.js";
|
|
18
|
-
import"../../../_chunks/index-
|
|
18
|
+
import"../../../_chunks/index-md5jchzy.js";
|
|
19
19
|
import"../../../_chunks/index-fn1chkkd.js";
|
|
20
|
-
import"../../../_chunks/index-
|
|
21
|
-
import"../../../_chunks/index-
|
|
20
|
+
import"../../../_chunks/index-4qsce64w.js";
|
|
21
|
+
import"../../../_chunks/index-bzd2ef7t.js";
|
|
22
|
+
import"../../../_chunks/index-fpghsgb4.js";
|
|
22
23
|
import"../../../_chunks/index-grta8ap3.js";
|
|
23
24
|
import"../../../_chunks/index-kresp2n8.js";
|
|
24
25
|
import"../../../_chunks/index-e3a6yx84.js";
|
|
26
|
+
import"../../../_chunks/index-jt8e1pje.js";
|
|
25
27
|
import"../../../_chunks/index-zqpqyg8p.js";
|
|
26
28
|
import"../../../_chunks/index-qjj6gddn.js";
|
|
27
29
|
import"../../../_chunks/index-rt9qq1va.js";
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
cookies,
|
|
5
5
|
draftMode,
|
|
6
6
|
headers
|
|
7
|
-
} from "../../_chunks/index-
|
|
7
|
+
} from "../../_chunks/index-drwv61cc.js";
|
|
8
8
|
import"../../_chunks/index-2vz0wzdn.js";
|
|
9
|
-
import"../../_chunks/index-
|
|
10
|
-
import"../../_chunks/index-
|
|
9
|
+
import"../../_chunks/index-y4d02znn.js";
|
|
10
|
+
import"../../_chunks/index-akkrvjn6.js";
|
|
11
11
|
import"../../_chunks/index-bcws5eh2.js";
|
|
12
|
-
import"../../_chunks/index-
|
|
12
|
+
import"../../_chunks/index-m63czgq5.js";
|
|
13
13
|
import"../../_chunks/index-cjgqs13g.js";
|
|
14
14
|
import"../../_chunks/index-jks0x0a1.js";
|
|
15
15
|
import"../../_chunks/index-6b009mt0.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
getImagesConfig
|
|
4
|
-
} from "../../../_chunks/index-
|
|
5
|
-
import"../../../_chunks/index-
|
|
4
|
+
} from "../../../_chunks/index-141vcwk6.js";
|
|
5
|
+
import"../../../_chunks/index-m63czgq5.js";
|
|
6
6
|
import"../../../_chunks/index-cjgqs13g.js";
|
|
7
7
|
import"../../../_chunks/index-jks0x0a1.js";
|
|
8
8
|
import"../../../_chunks/index-6b009mt0.js";
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
generateBlurDataURL,
|
|
4
4
|
isImageOptimizerRequest,
|
|
5
5
|
serveImageOptimizer
|
|
6
|
-
} from "../../../_chunks/index-
|
|
6
|
+
} from "../../../_chunks/index-typcbcsv.js";
|
|
7
7
|
import"../../../_chunks/index-tgsfjmep.js";
|
|
8
|
-
import"../../../_chunks/index-
|
|
8
|
+
import"../../../_chunks/index-141vcwk6.js";
|
|
9
9
|
import"../../../_chunks/index-bcws5eh2.js";
|
|
10
|
-
import"../../../_chunks/index-
|
|
10
|
+
import"../../../_chunks/index-m63czgq5.js";
|
|
11
11
|
import"../../../_chunks/index-cjgqs13g.js";
|
|
12
12
|
import"../../../_chunks/index-jks0x0a1.js";
|
|
13
13
|
import"../../../_chunks/index-6b009mt0.js";
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
staticImageModule,
|
|
7
7
|
staticImageModuleText,
|
|
8
8
|
staticMediaRelative
|
|
9
|
-
} from "../../../_chunks/index-
|
|
10
|
-
import"../../../_chunks/index-
|
|
9
|
+
} from "../../../_chunks/index-q3r9z8mq.js";
|
|
10
|
+
import"../../../_chunks/index-typcbcsv.js";
|
|
11
11
|
import"../../../_chunks/index-tgsfjmep.js";
|
|
12
|
-
import"../../../_chunks/index-
|
|
12
|
+
import"../../../_chunks/index-141vcwk6.js";
|
|
13
13
|
import"../../../_chunks/index-bcws5eh2.js";
|
|
14
|
-
import"../../../_chunks/index-
|
|
14
|
+
import"../../../_chunks/index-m63czgq5.js";
|
|
15
15
|
import"../../../_chunks/index-cjgqs13g.js";
|
|
16
16
|
import"../../../_chunks/index-jks0x0a1.js";
|
|
17
17
|
import"../../../_chunks/index-6b009mt0.js";
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
withSyncAccess,
|
|
4
4
|
withSyncProps
|
|
5
|
-
} from "../../_chunks/index-
|
|
6
|
-
import"../../_chunks/index-
|
|
5
|
+
} from "../../_chunks/index-y4d02znn.js";
|
|
6
|
+
import"../../_chunks/index-akkrvjn6.js";
|
|
7
7
|
import"../../_chunks/index-bcws5eh2.js";
|
|
8
|
-
import"../../_chunks/index-
|
|
8
|
+
import"../../_chunks/index-m63czgq5.js";
|
|
9
9
|
import"../../_chunks/index-cjgqs13g.js";
|
|
10
10
|
import"../../_chunks/index-jks0x0a1.js";
|
|
11
11
|
import"../../_chunks/index-6b009mt0.js";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
rewriteLegacyLinkValidation
|
|
4
|
-
} from "../../_chunks/index-
|
|
5
|
-
import"../../_chunks/index-
|
|
6
|
-
import"../../_chunks/index-
|
|
4
|
+
} from "../../_chunks/index-vmr35jjw.js";
|
|
5
|
+
import"../../_chunks/index-x9c55pzy.js";
|
|
6
|
+
import"../../_chunks/index-d1jsmhhk.js";
|
|
7
7
|
import"../../_chunks/index-7wc9n8be.js";
|
|
8
8
|
import"../../_chunks/index-pym1cezq.js";
|
|
9
|
+
import"../../_chunks/index-jt8e1pje.js";
|
|
9
10
|
import"../../_chunks/index-zqpqyg8p.js";
|
|
10
11
|
import"../../_chunks/index-qjj6gddn.js";
|
|
11
12
|
import"../../_chunks/index-rt9qq1va.js";
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
currentLayoutSegments,
|
|
4
4
|
currentParamsSnapshot,
|
|
5
5
|
hasLayoutSegmentScope
|
|
6
|
-
} from "../../_chunks/index-
|
|
7
|
-
import"../../_chunks/index-
|
|
8
|
-
import"../../_chunks/index-
|
|
9
|
-
import"../../_chunks/index-
|
|
6
|
+
} from "../../_chunks/index-jjppzw0s.js";
|
|
7
|
+
import"../../_chunks/index-veycp46e.js";
|
|
8
|
+
import"../../_chunks/index-4qsce64w.js";
|
|
9
|
+
import"../../_chunks/index-fpghsgb4.js";
|
|
10
10
|
import {
|
|
11
11
|
canonicalUrlHref
|
|
12
12
|
} from "../../_chunks/index-en7n9f7m.js";
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
PostponeError,
|
|
20
20
|
isPostpone
|
|
21
21
|
} from "../../_chunks/index-e3a6yx84.js";
|
|
22
|
+
import"../../_chunks/index-jt8e1pje.js";
|
|
22
23
|
import"../../_chunks/index-zqpqyg8p.js";
|
|
23
24
|
import"../../_chunks/index-qjj6gddn.js";
|
|
24
25
|
import {
|
|
@@ -2,26 +2,28 @@
|
|
|
2
2
|
import {
|
|
3
3
|
loadCompatRedirects,
|
|
4
4
|
resolveCompatRedirect
|
|
5
|
-
} from "../../_chunks/index-
|
|
6
|
-
import"../../_chunks/index-
|
|
5
|
+
} from "../../_chunks/index-y9bygr95.js";
|
|
6
|
+
import"../../_chunks/index-e176wk6x.js";
|
|
7
7
|
import"../../_chunks/index-6q7zvrap.js";
|
|
8
8
|
import"../../_chunks/index-79ngvam8.js";
|
|
9
|
-
import"../../_chunks/index-
|
|
9
|
+
import"../../_chunks/index-akkrvjn6.js";
|
|
10
10
|
import"../../_chunks/index-bcws5eh2.js";
|
|
11
|
-
import"../../_chunks/index-
|
|
11
|
+
import"../../_chunks/index-m63czgq5.js";
|
|
12
12
|
import"../../_chunks/index-cjgqs13g.js";
|
|
13
13
|
import"../../_chunks/index-jks0x0a1.js";
|
|
14
14
|
import"../../_chunks/index-6b009mt0.js";
|
|
15
15
|
import"../../_chunks/index-4zzebszd.js";
|
|
16
16
|
import"../../_chunks/index-sq3kvz3g.js";
|
|
17
17
|
import"../../_chunks/index-ckkdpht5.js";
|
|
18
|
-
import"../../_chunks/index-
|
|
19
|
-
import"../../_chunks/index-
|
|
18
|
+
import"../../_chunks/index-zedjt25v.js";
|
|
19
|
+
import"../../_chunks/index-bzd2ef7t.js";
|
|
20
|
+
import"../../_chunks/index-fpghsgb4.js";
|
|
20
21
|
import"../../_chunks/index-grta8ap3.js";
|
|
21
22
|
import"../../_chunks/index-kresp2n8.js";
|
|
22
23
|
import"../../_chunks/index-e3a6yx84.js";
|
|
23
24
|
import"../../_chunks/index-7wc9n8be.js";
|
|
24
25
|
import"../../_chunks/index-pym1cezq.js";
|
|
26
|
+
import"../../_chunks/index-jt8e1pje.js";
|
|
25
27
|
import"../../_chunks/index-qjj6gddn.js";
|
|
26
28
|
import"../../_chunks/index-rt9qq1va.js";
|
|
27
29
|
export {
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
registerResourceHintFinalizer,
|
|
6
6
|
takeResourceHintHeader,
|
|
7
7
|
takeResourceHintsForResponse
|
|
8
|
-
} from "../../_chunks/index-
|
|
9
|
-
import"../../_chunks/index-
|
|
8
|
+
} from "../../_chunks/index-tf4j19ge.js";
|
|
9
|
+
import"../../_chunks/index-m63czgq5.js";
|
|
10
10
|
import"../../_chunks/index-cjgqs13g.js";
|
|
11
11
|
import"../../_chunks/index-jks0x0a1.js";
|
|
12
12
|
import"../../_chunks/index-6b009mt0.js";
|
|
@@ -8,25 +8,27 @@ import {
|
|
|
8
8
|
resolveCompatRewrite,
|
|
9
9
|
splitDestination,
|
|
10
10
|
substitute
|
|
11
|
-
} from "../../_chunks/index-
|
|
11
|
+
} from "../../_chunks/index-e176wk6x.js";
|
|
12
12
|
import"../../_chunks/index-6q7zvrap.js";
|
|
13
13
|
import"../../_chunks/index-79ngvam8.js";
|
|
14
|
-
import"../../_chunks/index-
|
|
14
|
+
import"../../_chunks/index-akkrvjn6.js";
|
|
15
15
|
import"../../_chunks/index-bcws5eh2.js";
|
|
16
|
-
import"../../_chunks/index-
|
|
16
|
+
import"../../_chunks/index-m63czgq5.js";
|
|
17
17
|
import"../../_chunks/index-cjgqs13g.js";
|
|
18
18
|
import"../../_chunks/index-jks0x0a1.js";
|
|
19
19
|
import"../../_chunks/index-6b009mt0.js";
|
|
20
20
|
import"../../_chunks/index-4zzebszd.js";
|
|
21
21
|
import"../../_chunks/index-sq3kvz3g.js";
|
|
22
22
|
import"../../_chunks/index-ckkdpht5.js";
|
|
23
|
-
import"../../_chunks/index-
|
|
24
|
-
import"../../_chunks/index-
|
|
23
|
+
import"../../_chunks/index-zedjt25v.js";
|
|
24
|
+
import"../../_chunks/index-bzd2ef7t.js";
|
|
25
|
+
import"../../_chunks/index-fpghsgb4.js";
|
|
25
26
|
import"../../_chunks/index-grta8ap3.js";
|
|
26
27
|
import"../../_chunks/index-kresp2n8.js";
|
|
27
28
|
import"../../_chunks/index-e3a6yx84.js";
|
|
28
29
|
import"../../_chunks/index-7wc9n8be.js";
|
|
29
30
|
import"../../_chunks/index-pym1cezq.js";
|
|
31
|
+
import"../../_chunks/index-jt8e1pje.js";
|
|
30
32
|
import"../../_chunks/index-qjj6gddn.js";
|
|
31
33
|
import"../../_chunks/index-rt9qq1va.js";
|
|
32
34
|
export {
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
insideUseCacheProducer,
|
|
8
8
|
recordUseCacheRootParamRead
|
|
9
|
-
} from "../../_chunks/index-
|
|
9
|
+
} from "../../_chunks/index-j0m1jxqa.js";
|
|
10
10
|
import {
|
|
11
11
|
currentRenderCacheMeta,
|
|
12
12
|
insideUnstableCacheProducer
|
|
13
|
-
} from "../../_chunks/index-
|
|
13
|
+
} from "../../_chunks/index-akkrvjn6.js";
|
|
14
14
|
import"../../_chunks/index-bcws5eh2.js";
|
|
15
|
-
import"../../_chunks/index-
|
|
15
|
+
import"../../_chunks/index-m63czgq5.js";
|
|
16
16
|
import"../../_chunks/index-cjgqs13g.js";
|
|
17
17
|
import"../../_chunks/index-jks0x0a1.js";
|
|
18
18
|
import"../../_chunks/index-6b009mt0.js";
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
nextClientRouteState,
|
|
4
4
|
staticSiblingNames,
|
|
5
5
|
staticSiblingNamesBySegment
|
|
6
|
-
} from "../../_chunks/index-
|
|
6
|
+
} from "../../_chunks/index-52k54ykj.js";
|
|
7
7
|
import"../../_chunks/index-z88qv16t.js";
|
|
8
|
-
import"../../_chunks/index-
|
|
8
|
+
import"../../_chunks/index-m63czgq5.js";
|
|
9
9
|
import"../../_chunks/index-cjgqs13g.js";
|
|
10
10
|
import"../../_chunks/index-jks0x0a1.js";
|
|
11
11
|
import"../../_chunks/index-6b009mt0.js";
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
renderPartytownHeadScripts,
|
|
10
10
|
takeDeferredScripts,
|
|
11
11
|
takeHeadScripts
|
|
12
|
-
} from "../../_chunks/index-
|
|
12
|
+
} from "../../_chunks/index-9f49w76j.js";
|
|
13
13
|
import"../../_chunks/index-ye9hmsvf.js";
|
|
14
|
-
import"../../_chunks/index-
|
|
14
|
+
import"../../_chunks/index-m63czgq5.js";
|
|
15
15
|
import"../../_chunks/index-cjgqs13g.js";
|
|
16
16
|
import"../../_chunks/index-jks0x0a1.js";
|
|
17
17
|
import"../../_chunks/index-6b009mt0.js";
|
|
@@ -6,23 +6,23 @@ import {
|
|
|
6
6
|
} from "../../_chunks/index-r97ptz1q.js";
|
|
7
7
|
import {
|
|
8
8
|
io
|
|
9
|
-
} from "../../_chunks/index-
|
|
9
|
+
} from "../../_chunks/index-entm8bmz.js";
|
|
10
10
|
import {
|
|
11
11
|
assertDynamicErrorRequestApi
|
|
12
|
-
} from "../../_chunks/index-
|
|
12
|
+
} from "../../_chunks/index-drwv61cc.js";
|
|
13
13
|
import {
|
|
14
14
|
afterRequestApisAllowed,
|
|
15
15
|
assertRequestApiAllowedInAfter,
|
|
16
16
|
recordRequestPath,
|
|
17
17
|
runWithAfterRequestApiScope
|
|
18
18
|
} from "../../_chunks/index-2vz0wzdn.js";
|
|
19
|
-
import"../../_chunks/index-
|
|
19
|
+
import"../../_chunks/index-y4d02znn.js";
|
|
20
20
|
import {
|
|
21
21
|
assertNoDynamicApiInsideCache,
|
|
22
22
|
currentRenderCacheMeta
|
|
23
|
-
} from "../../_chunks/index-
|
|
23
|
+
} from "../../_chunks/index-akkrvjn6.js";
|
|
24
24
|
import"../../_chunks/index-bcws5eh2.js";
|
|
25
|
-
import"../../_chunks/index-
|
|
25
|
+
import"../../_chunks/index-m63czgq5.js";
|
|
26
26
|
import"../../_chunks/index-cjgqs13g.js";
|
|
27
27
|
import"../../_chunks/index-jks0x0a1.js";
|
|
28
28
|
import"../../_chunks/index-6b009mt0.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.1.
|
|
1
|
+
{"version":"0.1.9","fingerprint":"5c05030a635e53e4","source":["src/api/cache.ts","src/api/client-navigation.ts","src/api/dynamic.tsx","src/api/link.tsx","src/api/navigation.ts","src/api/server.ts","src/api/suspense.ts","src/client/router/events.ts","src/client/router/history.ts","src/client/router/hub.ts","src/client/router/index.ts","src/client/router/page-slot.ts","src/client/router/policies.ts","src/client/router/runtime.ts","src/index.ts","src/internal.ts","src/request/cache.ts","src/routing/href.ts","src/utils/decode.ts"]}
|
package/package.json
CHANGED
package/reference/compat.md
CHANGED
|
@@ -125,4 +125,4 @@ A route or proxy declaring an edge runtime, and a Pages Router handler configure
|
|
|
125
125
|
|
|
126
126
|
`output: 'export'` writes a static tree to `out/`, or to `distDir` when the app configures a custom one. The tree carries the HTML and the flat per-page artifacts the client router fetches when no pnext server is present, the client runtime under `_next/static/chunks/`, the build manifests, the `public/` tree, and the not-found page. Dynamic routes without `generateStaticParams`, pages forcing dynamic rendering, and route handlers with disallowed segment config are build errors, as they are in Next.
|
|
127
127
|
|
|
128
|
-
`output: 'standalone'` writes
|
|
128
|
+
`output: 'standalone'` writes the same `standalone/` folder as every build (see [Deploy](./dev.md#deploy)), at `.next/standalone/`, with `.nft.json` traces, a middleware manifest and a `server.js` that serves it on `PORT` and `HOSTNAME` via `node server.js`. Bun must be installed. `public/` and static files are already inside.
|
package/reference/config.md
CHANGED
|
@@ -21,7 +21,7 @@ This is the form `pnext create` scaffolds. With `compat.next`, pnext also loads
|
|
|
21
21
|
|
|
22
22
|
| Field | Default | What it does |
|
|
23
23
|
| ----------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------- |
|
|
24
|
-
| `outDir` | `'.pnext'` | Build output
|
|
24
|
+
| `outDir` | `'.pnext'` | Build output: the shippable `standalone/` folder, the build `cache/`, and generated `types/`. |
|
|
25
25
|
| `basePath` | `''` | Path prefix for an app served below the domain root. |
|
|
26
26
|
| `assetPrefix` | `basePath` | URL prefix for emitted assets. Set it when assets come from a CDN. |
|
|
27
27
|
| `trailingSlash` | `false` | Canonicalizes URLs to a trailing slash and redirects the form without one. |
|
|
@@ -51,7 +51,7 @@ Both `compat.next` and `compat.reactCompiler` imply `compat.react`. Direct Preac
|
|
|
51
51
|
|
|
52
52
|
## Deployment adapter
|
|
53
53
|
|
|
54
|
-
`exclude` and `keep`
|
|
54
|
+
`exclude` drops matching directories and file suffixes from `standalone/`. `keep` ships matching app files the server reads at runtime. Both apply to the Vercel function.
|
|
55
55
|
|
|
56
56
|
```ts
|
|
57
57
|
export default {
|
package/reference/dev.md
CHANGED
|
@@ -48,7 +48,7 @@ Debug flags: `--experimental-build-mode compile|generate` splits the build into
|
|
|
48
48
|
|
|
49
49
|
## Deploy
|
|
50
50
|
|
|
51
|
-
pnext deploys anywhere Bun runs: a VPS, a container, or any host you control. Run `pnext build
|
|
51
|
+
pnext deploys anywhere Bun runs: a VPS, a container, or any host you control. Run `pnext build`, then ship `<outDir>/standalone`; it needs nothing else. Serve it with `pnext start`, or import `standalone/server/entry.js` in your own server and call `createRequestHandler()`. To use a CDN, upload `standalone/static/` as-is.
|
|
52
52
|
|
|
53
53
|
Vercel has a dedicated adapter: `pnext build --adapter vercel` writes Build Output to `.vercel/output`. Static pages and static route-handler responses are emitted as files; everything dynamic runs in a single `_pnext` function on Vercel's Bun runtime.
|
|
54
54
|
|
|
@@ -41,7 +41,7 @@ pnext start
|
|
|
41
41
|
|
|
42
42
|
`pnext build` makes the production build and `pnext start` serves it. Routes render on the server per request; ones that never read the request are prerendered to static HTML at build time.
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
Ship `.pnext/standalone` to any host with Bun. For Vercel, build with `pnext build --adapter vercel` and it writes ready-to-deploy Build Output.
|
|
45
45
|
|
|
46
46
|
## A quick tour
|
|
47
47
|
|
package/reference/rendering.md
CHANGED
|
@@ -40,7 +40,7 @@ Put the directive at the top of a page when the whole page needs browser-only be
|
|
|
40
40
|
|
|
41
41
|
## Lazy loading
|
|
42
42
|
|
|
43
|
-
`dynamic()` defers loading a component
|
|
43
|
+
`dynamic()` defers loading a component in Server and Client Components. The loader can also be a literal module path for a default export.
|
|
44
44
|
|
|
45
45
|
```tsx
|
|
46
46
|
import { dynamic } from '@wular/pnext/dynamic'
|
|
@@ -50,10 +50,10 @@ const Chart = dynamic(() => import('./chart').then(m => m.Chart), {
|
|
|
50
50
|
})
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
The component renders on the server and hydrates by default. The options change that:
|
|
54
54
|
|
|
55
|
-
- `ssr: false`
|
|
56
|
-
- `load: 'visible'` waits for the
|
|
55
|
+
- `ssr: false` renders only in the browser.
|
|
56
|
+
- `load: 'visible'` waits for the component to enter view, and accepts `rootMargin` and `threshold`. It renders only in the browser, except with `ssr: true` in a Server Component.
|
|
57
57
|
- `loading` supplies fallback UI.
|
|
58
58
|
|
|
59
59
|
## Props that cross the boundary
|
package/src/api/dynamic.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsxImportSource preact */
|
|
2
|
-
import { h, type ComponentType } from 'preact'
|
|
3
|
-
import { useEffect, useRef, useState } from 'preact/hooks'
|
|
2
|
+
import { Component, h, type ComponentChildren, type ComponentType } from 'preact'
|
|
3
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks'
|
|
4
4
|
|
|
5
5
|
export type DynamicModule<Props> = ComponentType<Props> | { default: ComponentType<Props> }
|
|
6
6
|
export type DynamicLoader<Props> = string | (() => Promise<DynamicModule<Props>>)
|
|
@@ -35,6 +35,7 @@ export function dynamic<Props extends object = object>(
|
|
|
35
35
|
) {
|
|
36
36
|
let loaded: ComponentType<Props> | null = null
|
|
37
37
|
let pending: Promise<ComponentType<Props>> | null = null
|
|
38
|
+
let failed = false
|
|
38
39
|
const loadModule =
|
|
39
40
|
typeof loader === 'string'
|
|
40
41
|
? () => {
|
|
@@ -50,11 +51,45 @@ export function dynamic<Props extends object = object>(
|
|
|
50
51
|
return pending
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
// Rendered on the server and hydrated from its markup: suspends until the module loads.
|
|
55
|
+
function Loaded(props: Props) {
|
|
56
|
+
const ref = useRef<HTMLElement>(null)
|
|
57
|
+
const [remounts, setRemounts] = useState(0)
|
|
58
|
+
// The server sent `loading` because its load failed: replace that markup, never hydrate it.
|
|
59
|
+
useLayoutEffect(() => {
|
|
60
|
+
if (ref.current?.hasAttribute('data-pnext-loading')) setRemounts(1)
|
|
61
|
+
}, [])
|
|
62
|
+
if (loaded)
|
|
63
|
+
return h('pnext-dynamic', { key: remounts, ref, style: HOST_STYLE }, h(loaded, props))
|
|
64
|
+
const Loading = options.loading
|
|
65
|
+
if (failed) {
|
|
66
|
+
return h(
|
|
67
|
+
'pnext-dynamic',
|
|
68
|
+
{ ref, style: HOST_STYLE, 'data-pnext-loading': '' },
|
|
69
|
+
Loading ? h(Loading, props) : null,
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/only-throw-error
|
|
73
|
+
throw typeof window === 'undefined'
|
|
74
|
+
? load().then(
|
|
75
|
+
() => undefined,
|
|
76
|
+
() => {
|
|
77
|
+
failed = true
|
|
78
|
+
},
|
|
79
|
+
)
|
|
80
|
+
: load()
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function ClientDynamic(props: Props) {
|
|
84
|
+
const [Component, setComponent] = useState<ComponentType<Props> | null>(null)
|
|
55
85
|
const [shouldLoad, setShouldLoad] = useState(() => options.load !== 'visible')
|
|
56
86
|
const visibleRef = useRef<HTMLDivElement>(null)
|
|
57
87
|
|
|
88
|
+
// The server sent `loading`: hydrate it, then swap in a module that is already loaded.
|
|
89
|
+
useLayoutEffect(() => {
|
|
90
|
+
if (loaded) setComponent(() => loaded)
|
|
91
|
+
}, [])
|
|
92
|
+
|
|
58
93
|
useEffect(() => {
|
|
59
94
|
if (Component || shouldLoad) return
|
|
60
95
|
const node = visibleRef.current
|
|
@@ -98,6 +133,18 @@ export function dynamic<Props extends object = object>(
|
|
|
98
133
|
return Loading ? h(Loading, props) : null
|
|
99
134
|
}
|
|
100
135
|
|
|
136
|
+
const DynamicComponent =
|
|
137
|
+
options.ssr === false || options.load === 'visible'
|
|
138
|
+
? ClientDynamic
|
|
139
|
+
: (props: Props) =>
|
|
140
|
+
typeof window === 'undefined'
|
|
141
|
+
? h(Loaded, props)
|
|
142
|
+
: h(
|
|
143
|
+
DynamicBoundary,
|
|
144
|
+
{ fallback: options.loading ? h(options.loading, props) : null },
|
|
145
|
+
h(Loaded, props),
|
|
146
|
+
)
|
|
147
|
+
|
|
101
148
|
;(
|
|
102
149
|
DynamicComponent as typeof DynamicComponent & {
|
|
103
150
|
[dynamicReferenceSymbol]: DynamicReference<Props>
|
|
@@ -106,3 +153,36 @@ export function dynamic<Props extends object = object>(
|
|
|
106
153
|
|
|
107
154
|
return DynamicComponent
|
|
108
155
|
}
|
|
156
|
+
|
|
157
|
+
const HOST_STYLE = { display: 'contents' }
|
|
158
|
+
// preact's mangled MODE_HYDRATE flag on a vnode's `__u`.
|
|
159
|
+
const MODE_HYDRATE = 32
|
|
160
|
+
|
|
161
|
+
interface SuspendedVNode {
|
|
162
|
+
__u: number
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Suspense for one dynamic(): hydration keeps the server markup until the chunk loads, a fresh render
|
|
166
|
+
// shows `fallback`. `__c` is compat's mangled `_childDidSuspend`, so compat suspends here too.
|
|
167
|
+
class DynamicBoundary extends Component<
|
|
168
|
+
{ fallback: ComponentChildren; children?: ComponentChildren },
|
|
169
|
+
{ waiting?: boolean; held?: boolean }
|
|
170
|
+
> {
|
|
171
|
+
__c(promise: Promise<unknown>, vnode: SuspendedVNode) {
|
|
172
|
+
this.setState({ waiting: true, held: (vnode.__u & MODE_HYDRATE) !== 0 })
|
|
173
|
+
void promise.then(() => this.setState({ waiting: false }))
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
componentDidCatch(error: unknown) {
|
|
177
|
+
if (!(error instanceof Promise)) throw error
|
|
178
|
+
this.__c(error, (this as unknown as { __v: { __k: SuspendedVNode[] } }).__v.__k[0]!)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
shouldComponentUpdate(_props: unknown, state: { waiting?: boolean; held?: boolean }) {
|
|
182
|
+
return !(state.waiting && state.held)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
render() {
|
|
186
|
+
return this.state.waiting && !this.state.held ? this.props.fallback : this.props.children
|
|
187
|
+
}
|
|
188
|
+
}
|