vinext 0.0.23 → 0.0.25
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/README.md +24 -0
- package/dist/check.d.ts.map +1 -1
- package/dist/check.js +3 -2
- package/dist/check.js.map +1 -1
- package/dist/client/entry.js +1 -1
- package/dist/client/entry.js.map +1 -1
- package/dist/config/config-matchers.d.ts +21 -0
- package/dist/config/config-matchers.d.ts.map +1 -1
- package/dist/config/config-matchers.js +59 -9
- package/dist/config/config-matchers.js.map +1 -1
- package/dist/config/next-config.d.ts +8 -2
- package/dist/config/next-config.d.ts.map +1 -1
- package/dist/config/next-config.js +90 -35
- package/dist/config/next-config.js.map +1 -1
- package/dist/deploy.d.ts +10 -0
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +140 -56
- package/dist/deploy.js.map +1 -1
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +195 -25
- package/dist/index.js.map +1 -1
- package/dist/plugins/async-hooks-stub.d.ts +16 -0
- package/dist/plugins/async-hooks-stub.d.ts.map +1 -0
- package/dist/plugins/async-hooks-stub.js +45 -0
- package/dist/plugins/async-hooks-stub.js.map +1 -0
- package/dist/routing/app-router.d.ts +12 -6
- package/dist/routing/app-router.d.ts.map +1 -1
- package/dist/routing/app-router.js +19 -40
- package/dist/routing/app-router.js.map +1 -1
- package/dist/routing/pages-router.d.ts.map +1 -1
- package/dist/routing/pages-router.js +3 -9
- package/dist/routing/pages-router.js.map +1 -1
- package/dist/routing/utils.d.ts +9 -0
- package/dist/routing/utils.d.ts.map +1 -1
- package/dist/routing/utils.js +10 -0
- package/dist/routing/utils.js.map +1 -1
- package/dist/server/api-handler.d.ts.map +1 -1
- package/dist/server/api-handler.js +6 -0
- package/dist/server/api-handler.js.map +1 -1
- package/dist/server/app-dev-server.d.ts +2 -2
- package/dist/server/app-dev-server.d.ts.map +1 -1
- package/dist/server/app-dev-server.js +294 -133
- package/dist/server/app-dev-server.js.map +1 -1
- package/dist/server/dev-module-runner.d.ts +84 -0
- package/dist/server/dev-module-runner.d.ts.map +1 -0
- package/dist/server/dev-module-runner.js +105 -0
- package/dist/server/dev-module-runner.js.map +1 -0
- package/dist/server/dev-server.js.map +1 -1
- package/dist/server/instrumentation.d.ts +52 -9
- package/dist/server/instrumentation.d.ts.map +1 -1
- package/dist/server/instrumentation.js +52 -15
- package/dist/server/instrumentation.js.map +1 -1
- package/dist/server/middleware.d.ts +7 -3
- package/dist/server/middleware.d.ts.map +1 -1
- package/dist/server/middleware.js +16 -6
- package/dist/server/middleware.js.map +1 -1
- package/dist/server/prod-server.d.ts +8 -2
- package/dist/server/prod-server.d.ts.map +1 -1
- package/dist/server/prod-server.js +56 -35
- package/dist/server/prod-server.js.map +1 -1
- package/dist/server/worker-utils.d.ts +15 -0
- package/dist/server/worker-utils.d.ts.map +1 -0
- package/dist/server/worker-utils.js +41 -0
- package/dist/server/worker-utils.js.map +1 -0
- package/dist/shims/cache.d.ts.map +1 -1
- package/dist/shims/cache.js +14 -2
- package/dist/shims/cache.js.map +1 -1
- package/dist/shims/fetch-cache.d.ts.map +1 -1
- package/dist/shims/fetch-cache.js +139 -29
- package/dist/shims/fetch-cache.js.map +1 -1
- package/dist/shims/form.d.ts.map +1 -1
- package/dist/shims/form.js +2 -3
- package/dist/shims/form.js.map +1 -1
- package/dist/shims/headers.d.ts +6 -0
- package/dist/shims/headers.d.ts.map +1 -1
- package/dist/shims/headers.js +8 -0
- package/dist/shims/headers.js.map +1 -1
- package/dist/shims/layout-segment-context.d.ts +5 -4
- package/dist/shims/layout-segment-context.d.ts.map +1 -1
- package/dist/shims/layout-segment-context.js +6 -5
- package/dist/shims/layout-segment-context.js.map +1 -1
- package/dist/shims/link.d.ts.map +1 -1
- package/dist/shims/link.js +32 -17
- package/dist/shims/link.js.map +1 -1
- package/dist/shims/navigation.d.ts +14 -11
- package/dist/shims/navigation.d.ts.map +1 -1
- package/dist/shims/navigation.js +122 -102
- package/dist/shims/navigation.js.map +1 -1
- package/dist/shims/router.d.ts.map +1 -1
- package/dist/shims/router.js +37 -21
- package/dist/shims/router.js.map +1 -1
- package/dist/shims/server.d.ts +2 -0
- package/dist/shims/server.d.ts.map +1 -1
- package/dist/shims/server.js +4 -0
- package/dist/shims/server.js.map +1 -1
- package/dist/shims/url-utils.d.ts +13 -0
- package/dist/shims/url-utils.d.ts.map +1 -0
- package/dist/shims/url-utils.js +28 -0
- package/dist/shims/url-utils.js.map +1 -0
- package/dist/utils/project.d.ts +13 -1
- package/dist/utils/project.d.ts.map +1 -1
- package/dist/utils/project.js +63 -13
- package/dist/utils/project.js.map +1 -1
- package/package.json +6 -1
package/dist/shims/navigation.js
CHANGED
|
@@ -10,12 +10,13 @@
|
|
|
10
10
|
// would throw at link time for missing bindings. With `import * as React`, the
|
|
11
11
|
// bindings are just `undefined` on the namespace object and we can guard at runtime.
|
|
12
12
|
import * as React from "react";
|
|
13
|
-
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
13
|
+
import { toSameOriginPath } from "./url-utils.js";
|
|
14
|
+
// ─── Layout segment context ───────────────────────────────────────────────────
|
|
15
|
+
// Stores the child segments below the current layout. Each layout wraps its
|
|
16
|
+
// children with a provider whose value is the remaining route tree segments
|
|
17
|
+
// (including route groups, with dynamic params resolved to actual values).
|
|
18
|
+
// Created lazily because `React.createContext` is NOT available in the
|
|
19
|
+
// react-server condition of React. In the RSC environment, this remains null.
|
|
19
20
|
let _LayoutSegmentCtx = null;
|
|
20
21
|
// ─── ServerInsertedHTML context ────────────────────────────────────────────────
|
|
21
22
|
// Used by CSS-in-JS libraries (Apollo Client, styled-components, emotion) to
|
|
@@ -39,18 +40,18 @@ export const ServerInsertedHTMLContext = typeof React.createContext === "functio
|
|
|
39
40
|
*/
|
|
40
41
|
export function getLayoutSegmentContext() {
|
|
41
42
|
if (_LayoutSegmentCtx === null && typeof React.createContext === "function") {
|
|
42
|
-
_LayoutSegmentCtx = React.createContext(
|
|
43
|
+
_LayoutSegmentCtx = React.createContext([]);
|
|
43
44
|
}
|
|
44
45
|
return _LayoutSegmentCtx;
|
|
45
46
|
}
|
|
46
47
|
/**
|
|
47
|
-
* Read the
|
|
48
|
-
* is available (RSC environment, outside React tree
|
|
48
|
+
* Read the child segments below the current layout from context.
|
|
49
|
+
* Returns [] if no context is available (RSC environment, outside React tree).
|
|
49
50
|
*/
|
|
50
|
-
function
|
|
51
|
+
function useChildSegments() {
|
|
51
52
|
const ctx = getLayoutSegmentContext();
|
|
52
53
|
if (!ctx)
|
|
53
|
-
return
|
|
54
|
+
return [];
|
|
54
55
|
// useContext is safe here because if createContext exists, useContext does too.
|
|
55
56
|
// This branch is only taken in SSR/Browser, never in RSC.
|
|
56
57
|
// Try/catch for unit tests that call this hook outside a React render tree.
|
|
@@ -58,7 +59,7 @@ function useLayoutSegmentDepth() {
|
|
|
58
59
|
return React.useContext(ctx);
|
|
59
60
|
}
|
|
60
61
|
catch {
|
|
61
|
-
return
|
|
62
|
+
return [];
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
// ---------------------------------------------------------------------------
|
|
@@ -148,11 +149,10 @@ export function toRscUrl(href) {
|
|
|
148
149
|
export function getPrefetchCache() {
|
|
149
150
|
if (isServer)
|
|
150
151
|
return new Map();
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
win.__VINEXT_RSC_PREFETCH_CACHE__ = new Map();
|
|
152
|
+
if (!window.__VINEXT_RSC_PREFETCH_CACHE__) {
|
|
153
|
+
window.__VINEXT_RSC_PREFETCH_CACHE__ = new Map();
|
|
154
154
|
}
|
|
155
|
-
return
|
|
155
|
+
return window.__VINEXT_RSC_PREFETCH_CACHE__;
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
158
|
* Get or create the shared set of already-prefetched RSC URLs on window.
|
|
@@ -161,11 +161,10 @@ export function getPrefetchCache() {
|
|
|
161
161
|
export function getPrefetchedUrls() {
|
|
162
162
|
if (isServer)
|
|
163
163
|
return new Set();
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
win.__VINEXT_RSC_PREFETCHED_URLS__ = new Set();
|
|
164
|
+
if (!window.__VINEXT_RSC_PREFETCHED_URLS__) {
|
|
165
|
+
window.__VINEXT_RSC_PREFETCHED_URLS__ = new Set();
|
|
167
166
|
}
|
|
168
|
-
return
|
|
167
|
+
return window.__VINEXT_RSC_PREFETCHED_URLS__;
|
|
169
168
|
}
|
|
170
169
|
/**
|
|
171
170
|
* Store a prefetched RSC response in the cache.
|
|
@@ -371,17 +370,23 @@ function restoreScrollPosition(state) {
|
|
|
371
370
|
* Navigate to a URL, handling external URLs, hash-only changes, and RSC navigation.
|
|
372
371
|
*/
|
|
373
372
|
async function navigateImpl(href, mode, scroll) {
|
|
374
|
-
//
|
|
373
|
+
// Normalize same-origin absolute URLs to local paths for SPA navigation
|
|
374
|
+
let normalizedHref = href;
|
|
375
375
|
if (isExternalUrl(href)) {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
376
|
+
const localPath = toSameOriginPath(href);
|
|
377
|
+
if (localPath == null) {
|
|
378
|
+
// Truly external: use full page navigation
|
|
379
|
+
if (mode === "replace") {
|
|
380
|
+
window.location.replace(href);
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
window.location.assign(href);
|
|
384
|
+
}
|
|
385
|
+
return;
|
|
381
386
|
}
|
|
382
|
-
|
|
387
|
+
normalizedHref = localPath;
|
|
383
388
|
}
|
|
384
|
-
const fullHref = withBasePath(
|
|
389
|
+
const fullHref = withBasePath(normalizedHref);
|
|
385
390
|
// Save scroll position before navigating (for back/forward restoration)
|
|
386
391
|
if (mode === "push") {
|
|
387
392
|
saveScrollPosition();
|
|
@@ -426,100 +431,115 @@ async function navigateImpl(href, mode, scroll) {
|
|
|
426
431
|
}
|
|
427
432
|
}
|
|
428
433
|
}
|
|
434
|
+
// ---------------------------------------------------------------------------
|
|
435
|
+
// App Router router singleton
|
|
436
|
+
//
|
|
437
|
+
// All methods close over module-level state (navigateImpl, withBasePath, etc.)
|
|
438
|
+
// and carry no per-render data, so the object can be created once and reused.
|
|
439
|
+
// Next.js returns the same router reference on every call to useRouter(), which
|
|
440
|
+
// matters for components that rely on referential equality (e.g. useMemo /
|
|
441
|
+
// useEffect dependency arrays, React.memo bailouts).
|
|
442
|
+
// ---------------------------------------------------------------------------
|
|
443
|
+
const _appRouter = {
|
|
444
|
+
push(href, options) {
|
|
445
|
+
if (isServer)
|
|
446
|
+
return;
|
|
447
|
+
void navigateImpl(href, "push", options?.scroll !== false);
|
|
448
|
+
},
|
|
449
|
+
replace(href, options) {
|
|
450
|
+
if (isServer)
|
|
451
|
+
return;
|
|
452
|
+
void navigateImpl(href, "replace", options?.scroll !== false);
|
|
453
|
+
},
|
|
454
|
+
back() {
|
|
455
|
+
if (isServer)
|
|
456
|
+
return;
|
|
457
|
+
window.history.back();
|
|
458
|
+
},
|
|
459
|
+
forward() {
|
|
460
|
+
if (isServer)
|
|
461
|
+
return;
|
|
462
|
+
window.history.forward();
|
|
463
|
+
},
|
|
464
|
+
refresh() {
|
|
465
|
+
if (isServer)
|
|
466
|
+
return;
|
|
467
|
+
// Re-fetch the current page's RSC stream
|
|
468
|
+
if (typeof window.__VINEXT_RSC_NAVIGATE__ === "function") {
|
|
469
|
+
window.__VINEXT_RSC_NAVIGATE__(window.location.href);
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
prefetch(href) {
|
|
473
|
+
if (isServer)
|
|
474
|
+
return;
|
|
475
|
+
// Prefetch the RSC payload for the target route and store in cache
|
|
476
|
+
const fullHref = withBasePath(href);
|
|
477
|
+
const rscUrl = toRscUrl(fullHref);
|
|
478
|
+
const prefetched = getPrefetchedUrls();
|
|
479
|
+
if (prefetched.has(rscUrl))
|
|
480
|
+
return;
|
|
481
|
+
prefetched.add(rscUrl);
|
|
482
|
+
fetch(rscUrl, {
|
|
483
|
+
headers: { Accept: "text/x-component" },
|
|
484
|
+
credentials: "include",
|
|
485
|
+
priority: "low",
|
|
486
|
+
}).then((response) => {
|
|
487
|
+
if (response.ok) {
|
|
488
|
+
storePrefetchResponse(rscUrl, response);
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
// Non-ok response: allow retry on next prefetch() call
|
|
492
|
+
prefetched.delete(rscUrl);
|
|
493
|
+
}
|
|
494
|
+
}).catch(() => {
|
|
495
|
+
// Network error: allow retry on next prefetch() call
|
|
496
|
+
prefetched.delete(rscUrl);
|
|
497
|
+
});
|
|
498
|
+
},
|
|
499
|
+
};
|
|
429
500
|
/**
|
|
430
501
|
* App Router's useRouter — returns push/replace/back/forward/refresh.
|
|
431
502
|
* Different from Pages Router's useRouter (next/router).
|
|
503
|
+
*
|
|
504
|
+
* Returns a stable singleton: the same object reference on every call,
|
|
505
|
+
* matching Next.js behavior so components using referential equality
|
|
506
|
+
* (e.g. useMemo / useEffect deps, React.memo) don't re-render unnecessarily.
|
|
432
507
|
*/
|
|
433
508
|
export function useRouter() {
|
|
434
|
-
|
|
435
|
-
push(href, options) {
|
|
436
|
-
if (isServer)
|
|
437
|
-
return;
|
|
438
|
-
void navigateImpl(href, "push", options?.scroll !== false);
|
|
439
|
-
},
|
|
440
|
-
replace(href, options) {
|
|
441
|
-
if (isServer)
|
|
442
|
-
return;
|
|
443
|
-
void navigateImpl(href, "replace", options?.scroll !== false);
|
|
444
|
-
},
|
|
445
|
-
back() {
|
|
446
|
-
if (isServer)
|
|
447
|
-
return;
|
|
448
|
-
window.history.back();
|
|
449
|
-
},
|
|
450
|
-
forward() {
|
|
451
|
-
if (isServer)
|
|
452
|
-
return;
|
|
453
|
-
window.history.forward();
|
|
454
|
-
},
|
|
455
|
-
refresh() {
|
|
456
|
-
if (isServer)
|
|
457
|
-
return;
|
|
458
|
-
// Re-fetch the current page's RSC stream
|
|
459
|
-
if (typeof window.__VINEXT_RSC_NAVIGATE__ === "function") {
|
|
460
|
-
window.__VINEXT_RSC_NAVIGATE__(window.location.href);
|
|
461
|
-
}
|
|
462
|
-
},
|
|
463
|
-
prefetch(href) {
|
|
464
|
-
if (isServer)
|
|
465
|
-
return;
|
|
466
|
-
// Prefetch the RSC payload for the target route and store in cache
|
|
467
|
-
const fullHref = withBasePath(href);
|
|
468
|
-
const rscUrl = toRscUrl(fullHref);
|
|
469
|
-
const prefetched = getPrefetchedUrls();
|
|
470
|
-
if (prefetched.has(rscUrl))
|
|
471
|
-
return;
|
|
472
|
-
prefetched.add(rscUrl);
|
|
473
|
-
fetch(rscUrl, {
|
|
474
|
-
headers: { Accept: "text/x-component" },
|
|
475
|
-
credentials: "include",
|
|
476
|
-
priority: "low",
|
|
477
|
-
}).then((response) => {
|
|
478
|
-
if (response.ok) {
|
|
479
|
-
storePrefetchResponse(rscUrl, response);
|
|
480
|
-
}
|
|
481
|
-
else {
|
|
482
|
-
// Non-ok response: allow retry on next prefetch() call
|
|
483
|
-
prefetched.delete(rscUrl);
|
|
484
|
-
}
|
|
485
|
-
}).catch(() => {
|
|
486
|
-
// Network error: allow retry on next prefetch() call
|
|
487
|
-
prefetched.delete(rscUrl);
|
|
488
|
-
});
|
|
489
|
-
},
|
|
490
|
-
};
|
|
491
|
-
return router;
|
|
509
|
+
return _appRouter;
|
|
492
510
|
}
|
|
493
511
|
/**
|
|
494
512
|
* Returns the active child segment one level below the layout where it's called.
|
|
495
513
|
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
* of the pathname. Returns null if at the leaf (no child segments).
|
|
514
|
+
* Returns the first segment from the route tree below this layout, including
|
|
515
|
+
* route groups (e.g., "(marketing)") and resolved dynamic params. Returns null
|
|
516
|
+
* if at the leaf (no child segments).
|
|
500
517
|
*
|
|
501
518
|
* @param parallelRoutesKey - Which parallel route to read (default: "children")
|
|
502
519
|
*/
|
|
503
|
-
export function useSelectedLayoutSegment(
|
|
504
|
-
|
|
520
|
+
export function useSelectedLayoutSegment(
|
|
521
|
+
// parallelRoutesKey is accepted for API compat but not yet supported —
|
|
522
|
+
// vinext doesn't implement parallel routes with separate segment tracking.
|
|
523
|
+
_parallelRoutesKey) {
|
|
524
|
+
const segments = useSelectedLayoutSegments(_parallelRoutesKey);
|
|
505
525
|
return segments.length > 0 ? segments[0] : null;
|
|
506
526
|
}
|
|
507
527
|
/**
|
|
508
528
|
* Returns all active segments below the layout where it's called.
|
|
509
529
|
*
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
*
|
|
530
|
+
* Each layout in the App Router tree wraps its children with a
|
|
531
|
+
* LayoutSegmentProvider whose value is the remaining route tree segments
|
|
532
|
+
* (including route groups, with dynamic params resolved to actual values
|
|
533
|
+
* and catch-all segments joined with "/"). This hook reads those segments
|
|
534
|
+
* directly from context.
|
|
515
535
|
*
|
|
516
536
|
* @param parallelRoutesKey - Which parallel route to read (default: "children")
|
|
517
537
|
*/
|
|
518
|
-
export function useSelectedLayoutSegments(
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
return
|
|
538
|
+
export function useSelectedLayoutSegments(
|
|
539
|
+
// parallelRoutesKey is accepted for API compat but not yet supported —
|
|
540
|
+
// vinext doesn't implement parallel routes with separate segment tracking.
|
|
541
|
+
_parallelRoutesKey) {
|
|
542
|
+
return useChildSegments();
|
|
523
543
|
}
|
|
524
544
|
/**
|
|
525
545
|
* useServerInsertedHTML — inject HTML during SSR from client components.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/shims/navigation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,iFAAiF;AACjF,iFAAiF;AACjF,+EAA+E;AAC/E,qFAAqF;AACrF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,iFAAiF;AACjF,wEAAwE;AACxE,kFAAkF;AAClF,4EAA4E;AAC5E,oEAAoE;AACpE,6EAA6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AC;IAChE,MAAM,KAAK,CAAC;AACd,CAAC;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,qDAAqD;AAErD,oCAAoC;AACpC,IAAI,CAAC,QAAQ,EAAE,CAAC;IACd,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE;QAC5C,eAAe,EAAE,CAAC;QAClB,sDAAsD;QACtD,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,8EAA8E;IAC9E,kEAAkE;IAClE,EAAE;IACF,uEAAuE;IACvE,yEAAyE;IACzE,sEAAsE;IACtE,mEAAmE;IACnE,oDAAoD;IACpD,EAAE;IACF,2EAA2E;IAC3E,uEAAuE;IACvE,cAAc;IACd,8EAA8E;IAC9E,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACxE,MAAM,oBAAoB,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAE9E,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,SAAS,gBAAgB,CAClD,IAAa,EACb,MAAc,EACd,GAAyB;QAEzB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QACrC,eAAe,EAAE,CAAC;IACpB,CAAC,CAAC;IAEF,MAAM,CAAC,OAAO,CAAC,YAAY,GAAG,SAAS,mBAAmB,CACxD,IAAa,EACb,MAAc,EACd,GAAyB;QAEzB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QACxC,eAAe,EAAE,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * next/navigation shim\n *\n * App Router navigation hooks. These work on both server (RSC) and client.\n * Server-side: reads from a request context set by the RSC handler.\n * Client-side: reads from browser Location API and provides navigation.\n */\n\n// Use namespace import for RSC safety: the react-server condition doesn't export\n// createContext/useContext/useSyncExternalStore as named exports, and strict ESM\n// would throw at link time for missing bindings. With `import * as React`, the\n// bindings are just `undefined` on the namespace object and we can guard at runtime.\nimport * as React from \"react\";\n\n// ─── Layout segment depth context ─────────────────────────────────────────────\n// Used by useSelectedLayoutSegments() to know which layout it's inside.\n// The context is created lazily because `React.createContext` is NOT available in\n// the react-server condition of React. In the RSC environment, this remains\n// null and the hooks fall back to returning all segments (depth 0).\n// In SSR and browser environments, the context is created and used normally.\n\nlet _LayoutSegmentCtx: React.Context<number> | null = null;\n\n// ─── ServerInsertedHTML context ────────────────────────────────────────────────\n// Used by CSS-in-JS libraries (Apollo Client, styled-components, emotion) to\n// register HTML injection callbacks during SSR via useContext().\n// The SSR entry wraps the rendered tree with a Provider whose value is a\n// callback registration function (useServerInsertedHTML).\n//\n// In Next.js, ServerInsertedHTMLContext holds a function:\n// (callback: () => React.ReactNode) => void\n// Libraries call useContext(ServerInsertedHTMLContext) to get this function,\n// then call it to register callbacks that inject HTML during SSR.\n//\n// Created eagerly at module load time. In the RSC environment (react-server\n// condition), createContext isn't available so this will be null.\n\nexport const ServerInsertedHTMLContext: React.Context<\n ((callback: () => unknown) => void) | null\n> | null =\n typeof React.createContext === \"function\"\n ? React.createContext<((callback: () => unknown) => void) | null>(null)\n : null;\n\n/**\n * Get or create the layout segment context.\n * Returns null in the RSC environment (createContext unavailable).\n */\nexport function getLayoutSegmentContext(): React.Context<number> | null {\n if (_LayoutSegmentCtx === null && typeof React.createContext === \"function\") {\n _LayoutSegmentCtx = React.createContext<number>(0);\n }\n return _LayoutSegmentCtx;\n}\n\n/**\n * Read the layout segment depth from context. Returns 0 if no context\n * is available (RSC environment, outside React tree, or root level).\n */\nfunction useLayoutSegmentDepth(): number {\n const ctx = getLayoutSegmentContext();\n if (!ctx) return 0;\n // useContext is safe here because if createContext exists, useContext does too.\n // This branch is only taken in SSR/Browser, never in RSC.\n // Try/catch for unit tests that call this hook outside a React render tree.\n try {\n return React.useContext(ctx);\n } catch {\n return 0;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Server-side request context (set by the RSC entry before rendering)\n// ---------------------------------------------------------------------------\n\nexport interface NavigationContext {\n pathname: string;\n searchParams: URLSearchParams;\n params: Record<string, string | string[]>;\n}\n\n// ---------------------------------------------------------------------------\n// Server-side navigation state lives in a separate server-only module\n// (navigation-state.ts) that uses AsyncLocalStorage for request isolation.\n// This module is bundled for the browser, so it can't import node:async_hooks.\n//\n// On the server: state functions are set by navigation-state.ts at import time.\n// On the client: _serverContext falls back to null (hooks use window instead).\n// ---------------------------------------------------------------------------\n\nlet _serverContext: NavigationContext | null = null;\nlet _serverInsertedHTMLCallbacks: Array<() => unknown> = [];\n\n// These are overridden by navigation-state.ts on the server to use ALS.\nlet _getServerContext = (): NavigationContext | null => _serverContext;\nlet _setServerContext = (ctx: NavigationContext | null): void => { _serverContext = ctx; };\nlet _getInsertedHTMLCallbacks = (): Array<() => unknown> => _serverInsertedHTMLCallbacks;\nlet _clearInsertedHTMLCallbacks = (): void => { _serverInsertedHTMLCallbacks = []; };\n\n/**\n * Register ALS-backed state accessors. Called by navigation-state.ts on import.\n * @internal\n */\nexport function _registerStateAccessors(accessors: {\n getServerContext: () => NavigationContext | null;\n setServerContext: (ctx: NavigationContext | null) => void;\n getInsertedHTMLCallbacks: () => Array<() => unknown>;\n clearInsertedHTMLCallbacks: () => void;\n}): void {\n _getServerContext = accessors.getServerContext;\n _setServerContext = accessors.setServerContext;\n _getInsertedHTMLCallbacks = accessors.getInsertedHTMLCallbacks;\n _clearInsertedHTMLCallbacks = accessors.clearInsertedHTMLCallbacks;\n}\n\n/**\n * Get the navigation context for the current SSR/RSC render.\n * Reads from AsyncLocalStorage when available (concurrent-safe),\n * otherwise falls back to module-level state.\n */\nexport function getNavigationContext(): NavigationContext | null {\n return _getServerContext();\n}\n\n/**\n * Set the navigation context for the current SSR/RSC render.\n * Called by the framework entry before rendering each request.\n */\nexport function setNavigationContext(ctx: NavigationContext | null): void {\n _setServerContext(ctx);\n}\n\n// ---------------------------------------------------------------------------\n// Client-side state\n// ---------------------------------------------------------------------------\n\nconst isServer = typeof window === \"undefined\";\n\n/** basePath from next.config.js, injected by the plugin at build time */\nconst __basePath: string = process.env.__NEXT_ROUTER_BASEPATH ?? \"\";\n\n/** Strip basePath prefix from a browser pathname */\nfunction stripBasePath(p: string): string {\n if (!__basePath) return p;\n if (p.startsWith(__basePath)) return p.slice(__basePath.length) || \"/\";\n return p;\n}\n\n/** Prepend basePath to a path for browser URLs / fetches */\nfunction withBasePath(p: string): string {\n if (!__basePath) return p;\n return __basePath + p;\n}\n\n// ---------------------------------------------------------------------------\n// RSC prefetch cache utilities (shared between link.tsx and browser entry)\n// ---------------------------------------------------------------------------\n\n/** Maximum number of entries in the RSC prefetch cache. */\nconst MAX_PREFETCH_CACHE_SIZE = 50;\n\n/** TTL for prefetch cache entries in ms (matches Next.js static prefetch TTL). */\nexport const PREFETCH_CACHE_TTL = 30_000;\n\nexport interface PrefetchCacheEntry {\n response: Response;\n timestamp: number;\n}\n\n/**\n * Convert a pathname (with optional query/hash) to its .rsc URL.\n * Strips trailing slashes before appending `.rsc` so that cache keys\n * are consistent regardless of the `trailingSlash` config setting.\n */\nexport function toRscUrl(href: string): string {\n const [beforeHash] = href.split(\"#\");\n const qIdx = beforeHash.indexOf(\"?\");\n const pathname = qIdx === -1 ? beforeHash : beforeHash.slice(0, qIdx);\n const query = qIdx === -1 ? \"\" : beforeHash.slice(qIdx);\n // Strip trailing slash (but preserve \"/\" root) for consistent cache keys\n const normalizedPath = pathname.length > 1 && pathname.endsWith(\"/\")\n ? pathname.slice(0, -1)\n : pathname;\n return normalizedPath + \".rsc\" + query;\n}\n\n/** Get or create the shared in-memory RSC prefetch cache on window. */\nexport function getPrefetchCache(): Map<string, PrefetchCacheEntry> {\n if (isServer) return new Map();\n const win = window as any;\n if (!win.__VINEXT_RSC_PREFETCH_CACHE__) {\n win.__VINEXT_RSC_PREFETCH_CACHE__ = new Map<string, PrefetchCacheEntry>();\n }\n return win.__VINEXT_RSC_PREFETCH_CACHE__;\n}\n\n/**\n * Get or create the shared set of already-prefetched RSC URLs on window.\n * Keyed by rscUrl so that the browser entry can clear entries when consumed.\n */\nexport function getPrefetchedUrls(): Set<string> {\n if (isServer) return new Set();\n const win = window as any;\n if (!win.__VINEXT_RSC_PREFETCHED_URLS__) {\n win.__VINEXT_RSC_PREFETCHED_URLS__ = new Set<string>();\n }\n return win.__VINEXT_RSC_PREFETCHED_URLS__;\n}\n\n/**\n * Store a prefetched RSC response in the cache.\n * Enforces a maximum cache size to prevent unbounded memory growth on\n * link-heavy pages.\n */\nexport function storePrefetchResponse(rscUrl: string, response: Response): void {\n const cache = getPrefetchCache();\n // Evict oldest entry if at capacity (Map iterates in insertion order)\n if (cache.size >= MAX_PREFETCH_CACHE_SIZE) {\n const oldest = cache.keys().next().value;\n if (oldest !== undefined) cache.delete(oldest);\n }\n cache.set(rscUrl, { response, timestamp: Date.now() });\n}\n\n// Client navigation listeners\ntype NavigationListener = () => void;\nconst _listeners: Set<NavigationListener> = new Set();\n\nfunction notifyListeners(): void {\n for (const fn of _listeners) fn();\n}\n\n// Cached URLSearchParams, pathname, etc. for referential stability\n// useSyncExternalStore compares snapshots with Object.is — avoid creating\n// new instances on every render (infinite re-renders).\nlet _cachedSearch = !isServer ? window.location.search : \"\";\nlet _cachedSearchParams: URLSearchParams = new URLSearchParams(_cachedSearch);\nlet _cachedServerSearchParams: URLSearchParams | null = null;\nlet _cachedPathname = !isServer ? stripBasePath(window.location.pathname) : \"/\";\n\nfunction getPathnameSnapshot(): string {\n const current = stripBasePath(window.location.pathname);\n if (current !== _cachedPathname) {\n _cachedPathname = current;\n }\n return _cachedPathname;\n}\n\nfunction getSearchParamsSnapshot(): URLSearchParams {\n const current = window.location.search;\n if (current !== _cachedSearch) {\n _cachedSearch = current;\n _cachedSearchParams = new URLSearchParams(current);\n }\n return _cachedSearchParams;\n}\n\nfunction getServerSearchParamsSnapshot(): URLSearchParams {\n const ctx = _getServerContext();\n if (ctx?.searchParams != null) return ctx.searchParams;\n if (_cachedServerSearchParams === null) {\n _cachedServerSearchParams = new URLSearchParams();\n }\n return _cachedServerSearchParams;\n}\n\n// Track client-side params (set during RSC hydration/navigation)\n// We cache the params object for referential stability — only create a new\n// object when the params actually change (shallow key/value comparison).\nlet _clientParams: Record<string, string | string[]> = {};\nlet _clientParamsJson = \"{}\";\n\nexport function setClientParams(params: Record<string, string | string[]>): void {\n const json = JSON.stringify(params);\n if (json !== _clientParamsJson) {\n _clientParams = params;\n _clientParamsJson = json;\n }\n}\n\n/** Get the current client params (for testing referential stability). */\nexport function getClientParams(): Record<string, string | string[]> {\n return _clientParams;\n}\n\n// ---------------------------------------------------------------------------\n// Hooks\n// ---------------------------------------------------------------------------\n\n/**\n * Returns the current pathname.\n * Server: from request context. Client: from window.location.\n */\nexport function usePathname(): string {\n if (isServer) {\n // During SSR of \"use client\" components, the navigation context may not be set.\n // Return a safe fallback — the client will hydrate with the real value.\n return _getServerContext()?.pathname ?? \"/\";\n }\n // Client-side: use the hook system for reactivity\n return React.useSyncExternalStore(\n (cb: () => void) => { _listeners.add(cb); return () => { _listeners.delete(cb); }; },\n getPathnameSnapshot,\n () => _getServerContext()?.pathname ?? \"/\",\n );\n}\n\n/**\n * Returns the current search params as a read-only URLSearchParams.\n */\nexport function useSearchParams(): URLSearchParams {\n if (isServer) {\n // During SSR of \"use client\" components, the navigation context may not be set.\n // Return a safe fallback — the client will hydrate with the real value.\n return _getServerContext()?.searchParams ?? new URLSearchParams();\n }\n return React.useSyncExternalStore(\n (cb: () => void) => { _listeners.add(cb); return () => { _listeners.delete(cb); }; },\n getSearchParamsSnapshot,\n getServerSearchParamsSnapshot,\n );\n}\n\n/**\n * Returns the dynamic params for the current route.\n */\nexport function useParams<\n T extends Record<string, string | string[]> = Record<string, string | string[]>,\n>(): T {\n if (isServer) {\n // During SSR of \"use client\" components, the navigation context may not be set.\n return (_getServerContext()?.params ?? {}) as T;\n }\n return _clientParams as T;\n}\n\n/**\n * Check if a href is an external URL (any URL scheme per RFC 3986, or protocol-relative).\n */\nfunction isExternalUrl(href: string): boolean {\n return /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith(\"//\");\n}\n\n/**\n * Check if a href is only a hash change relative to the current URL.\n */\nfunction isHashOnlyChange(href: string): boolean {\n if (typeof window === \"undefined\") return false;\n if (href.startsWith(\"#\")) return true;\n try {\n const current = new URL(window.location.href);\n const next = new URL(href, window.location.href);\n return current.pathname === next.pathname && current.search === next.search && next.hash !== \"\";\n } catch {\n return false;\n }\n}\n\n/**\n * Scroll to a hash target element, or to the top if no hash.\n */\nfunction scrollToHash(hash: string): void {\n if (!hash || hash === \"#\") {\n window.scrollTo(0, 0);\n return;\n }\n const id = hash.slice(1);\n const element = document.getElementById(id);\n if (element) {\n element.scrollIntoView({ behavior: \"auto\" });\n }\n}\n\n/**\n * Reference to the native history.replaceState before patching.\n * Used internally to avoid triggering the interception for internal operations\n * (e.g. saving scroll position shouldn't cause re-renders).\n * Captured before the history method patching at the bottom of this module.\n */\nconst _nativeReplaceState = !isServer\n ? window.history.replaceState.bind(window.history)\n : (null as unknown as typeof window.history.replaceState);\n\n/**\n * Save the current scroll position into the current history state.\n * Called before every navigation to enable scroll restoration on back/forward.\n *\n * Uses _nativeReplaceState to avoid triggering the history.replaceState\n * interception (which would cause spurious re-renders from notifyListeners).\n */\nfunction saveScrollPosition(): void {\n const state = window.history.state ?? {};\n _nativeReplaceState.call(\n window.history,\n { ...state, __vinext_scrollX: window.scrollX, __vinext_scrollY: window.scrollY },\n \"\",\n );\n}\n\n/**\n * Restore scroll position from a history state object (used on popstate).\n *\n * When an RSC navigation is in flight (back/forward triggers both this\n * handler and the browser entry's popstate handler which calls\n * __VINEXT_RSC_NAVIGATE__), we must wait for the new content to render\n * before scrolling. Otherwise the user sees old content flash at the\n * restored scroll position.\n *\n * This handler fires before the browser entry's popstate handler (because\n * navigation.ts is loaded before hydration completes), so we defer via a\n * microtask to give the browser entry handler a chance to set\n * __VINEXT_RSC_PENDING__ first.\n */\nfunction restoreScrollPosition(state: unknown): void {\n if (state && typeof state === \"object\" && \"__vinext_scrollY\" in state) {\n const { __vinext_scrollX: x, __vinext_scrollY: y } = state as {\n __vinext_scrollX: number;\n __vinext_scrollY: number;\n };\n\n // Defer to allow other popstate listeners (browser entry) to run first\n // and set __VINEXT_RSC_PENDING__. Promise.resolve() schedules a microtask\n // that runs after all synchronous event listeners have completed.\n void Promise.resolve().then(() => {\n const pending: Promise<void> | null = (window as any).__VINEXT_RSC_PENDING__ ?? null;\n\n if (pending) {\n // Wait for the RSC navigation to finish rendering, then scroll.\n void pending.then(() => {\n requestAnimationFrame(() => {\n window.scrollTo(x, y);\n });\n });\n } else {\n // No RSC navigation in flight (Pages Router or already settled).\n requestAnimationFrame(() => {\n window.scrollTo(x, y);\n });\n }\n });\n }\n}\n\n/**\n * Navigate to a URL, handling external URLs, hash-only changes, and RSC navigation.\n */\nasync function navigateImpl(\n href: string,\n mode: \"push\" | \"replace\",\n scroll: boolean,\n): Promise<void> {\n // External URLs: use full page navigation\n if (isExternalUrl(href)) {\n if (mode === \"replace\") {\n window.location.replace(href);\n } else {\n window.location.assign(href);\n }\n return;\n }\n\n const fullHref = withBasePath(href);\n\n // Save scroll position before navigating (for back/forward restoration)\n if (mode === \"push\") {\n saveScrollPosition();\n }\n\n // Hash-only change: update URL and scroll to target, skip RSC fetch\n if (isHashOnlyChange(fullHref)) {\n const hash = fullHref.includes(\"#\") ? fullHref.slice(fullHref.indexOf(\"#\")) : \"\";\n if (mode === \"replace\") {\n window.history.replaceState(null, \"\", fullHref);\n } else {\n window.history.pushState(null, \"\", fullHref);\n }\n notifyListeners();\n if (scroll) {\n scrollToHash(hash);\n }\n return;\n }\n\n // Extract hash for post-navigation scrolling\n const hashIdx = fullHref.indexOf(\"#\");\n const hash = hashIdx !== -1 ? fullHref.slice(hashIdx) : \"\";\n\n if (mode === \"replace\") {\n window.history.replaceState(null, \"\", fullHref);\n } else {\n window.history.pushState(null, \"\", fullHref);\n }\n notifyListeners();\n\n // Trigger RSC re-fetch if available, and wait for the new content to render\n // before scrolling. This prevents the old page from visibly jumping to the\n // top before the new content paints.\n if (typeof (window as any).__VINEXT_RSC_NAVIGATE__ === \"function\") {\n await (window as any).__VINEXT_RSC_NAVIGATE__(fullHref);\n }\n\n if (scroll) {\n if (hash) {\n scrollToHash(hash);\n } else {\n window.scrollTo(0, 0);\n }\n }\n}\n\n/**\n * App Router's useRouter — returns push/replace/back/forward/refresh.\n * Different from Pages Router's useRouter (next/router).\n */\nexport function useRouter() {\n const router = {\n push(href: string, options?: { scroll?: boolean }): void {\n if (isServer) return;\n void navigateImpl(href, \"push\", options?.scroll !== false);\n },\n replace(href: string, options?: { scroll?: boolean }): void {\n if (isServer) return;\n void navigateImpl(href, \"replace\", options?.scroll !== false);\n },\n back(): void {\n if (isServer) return;\n window.history.back();\n },\n forward(): void {\n if (isServer) return;\n window.history.forward();\n },\n refresh(): void {\n if (isServer) return;\n // Re-fetch the current page's RSC stream\n if (typeof (window as any).__VINEXT_RSC_NAVIGATE__ === \"function\") {\n (window as any).__VINEXT_RSC_NAVIGATE__(window.location.href);\n }\n },\n prefetch(href: string): void {\n if (isServer) return;\n // Prefetch the RSC payload for the target route and store in cache\n const fullHref = withBasePath(href);\n const rscUrl = toRscUrl(fullHref);\n const prefetched = getPrefetchedUrls();\n if (prefetched.has(rscUrl)) return;\n prefetched.add(rscUrl);\n fetch(rscUrl, {\n headers: { Accept: \"text/x-component\" },\n credentials: \"include\",\n priority: \"low\" as RequestInit[\"priority\"],\n }).then((response) => {\n if (response.ok) {\n storePrefetchResponse(rscUrl, response);\n } else {\n // Non-ok response: allow retry on next prefetch() call\n prefetched.delete(rscUrl);\n }\n }).catch(() => {\n // Network error: allow retry on next prefetch() call\n prefetched.delete(rscUrl);\n });\n },\n };\n return router;\n}\n\n/**\n * Returns the active child segment one level below the layout where it's called.\n *\n * In Next.js, this is layout-aware: it returns the segment relative to the\n * nearest parent layout. In our implementation, we approximate by returning\n * the first segment after a specified parallel route key, or the first segment\n * of the pathname. Returns null if at the leaf (no child segments).\n *\n * @param parallelRoutesKey - Which parallel route to read (default: \"children\")\n */\nexport function useSelectedLayoutSegment(\n parallelRoutesKey?: string,\n): string | null {\n const segments = useSelectedLayoutSegments(parallelRoutesKey);\n return segments.length > 0 ? segments[0] : null;\n}\n\n/**\n * Returns all active segments below the layout where it's called.\n *\n * In Next.js, this returns the full array of segments from the current\n * layout down to the leaf page. Each layout in the tree wraps its children\n * with a LayoutSegmentProvider that records the URL segment depth at that\n * level. This hook reads that depth from context and slices the pathname\n * segments accordingly.\n *\n * @param parallelRoutesKey - Which parallel route to read (default: \"children\")\n */\nexport function useSelectedLayoutSegments(\n _parallelRoutesKey?: string,\n): string[] {\n const pathname = usePathname();\n const depth = useLayoutSegmentDepth();\n const segments = pathname.split(\"/\").filter(Boolean);\n return segments.slice(depth);\n}\n\n/**\n * ReadonlyURLSearchParams — type alias matching Next.js.\n * In Next.js this prevents mutation, but since URLSearchParams is the underlying\n * type in our implementation, we export it as-is for type compatibility.\n */\nexport type ReadonlyURLSearchParams = URLSearchParams;\n\n/**\n * useServerInsertedHTML — inject HTML during SSR from client components.\n *\n * Used by CSS-in-JS libraries (styled-components, emotion, StyleX) to inject\n * <style> tags during SSR so styles appear in the initial HTML (no FOUC).\n *\n * The callback is called once after each SSR render pass. The returned JSX/HTML\n * is serialized and injected into the HTML stream.\n *\n * Usage (in a \"use client\" component wrapping children):\n * useServerInsertedHTML(() => {\n * const styles = sheet.getStyleElement();\n * sheet.instance.clearTag();\n * return <>{styles}</>;\n * });\n */\n\nexport function useServerInsertedHTML(callback: () => unknown): void {\n if (typeof document !== \"undefined\") {\n // Client-side: no-op (styles are already in the DOM)\n return;\n }\n _getInsertedHTMLCallbacks().push(callback);\n}\n\n/**\n * Flush all collected useServerInsertedHTML callbacks.\n * Returns an array of results (React elements or strings).\n * Clears the callback list so the next render starts fresh.\n *\n * Called by the SSR entry after renderToReadableStream completes.\n */\nexport function flushServerInsertedHTML(): unknown[] {\n const callbacks = _getInsertedHTMLCallbacks();\n const results: unknown[] = [];\n for (const cb of callbacks) {\n try {\n const result = cb();\n if (result != null) results.push(result);\n } catch {\n // Ignore errors from individual callbacks\n }\n }\n callbacks.length = 0;\n return results;\n}\n\n/**\n * Clear all collected useServerInsertedHTML callbacks without flushing.\n * Used for cleanup between requests.\n */\nexport function clearServerInsertedHTML(): void {\n _clearInsertedHTMLCallbacks();\n}\n\n// ---------------------------------------------------------------------------\n// Non-hook utilities (can be called from Server Components)\n// ---------------------------------------------------------------------------\n\n/**\n * HTTP Access Fallback error code — shared prefix for notFound/forbidden/unauthorized.\n * Matches Next.js 16's unified error handling approach.\n */\nexport const HTTP_ERROR_FALLBACK_ERROR_CODE = \"NEXT_HTTP_ERROR_FALLBACK\";\n\n/**\n * Check if an error is an HTTP Access Fallback error (notFound, forbidden, unauthorized).\n */\nexport function isHTTPAccessFallbackError(error: unknown): boolean {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String((error as any).digest);\n return (\n digest === \"NEXT_NOT_FOUND\" || // legacy compat\n digest.startsWith(`${HTTP_ERROR_FALLBACK_ERROR_CODE};`)\n );\n }\n return false;\n}\n\n/**\n * Extract the HTTP status code from an HTTP Access Fallback error.\n * Returns 404 for legacy NEXT_NOT_FOUND errors.\n */\nexport function getAccessFallbackHTTPStatus(error: unknown): number {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String((error as any).digest);\n if (digest === \"NEXT_NOT_FOUND\") return 404;\n if (digest.startsWith(`${HTTP_ERROR_FALLBACK_ERROR_CODE};`)) {\n return parseInt(digest.split(\";\")[1], 10);\n }\n }\n return 404;\n}\n\n/**\n * Enum matching Next.js RedirectType for type-safe redirect calls.\n */\nexport enum RedirectType {\n push = \"push\",\n replace = \"replace\",\n}\n\n/**\n * Throw a redirect. Caught by the framework to send a redirect response.\n */\nexport function redirect(url: string, type?: \"replace\" | \"push\" | RedirectType): never {\n const error = new Error(`NEXT_REDIRECT:${url}`);\n (error as any).digest = `NEXT_REDIRECT;${type ?? \"replace\"};${encodeURIComponent(url)}`;\n throw error;\n}\n\n/**\n * Trigger a permanent redirect (308).\n */\nexport function permanentRedirect(url: string): never {\n const error = new Error(`NEXT_REDIRECT:${url}`);\n (error as any).digest = `NEXT_REDIRECT;replace;${encodeURIComponent(url)};308`;\n throw error;\n}\n\n/**\n * Trigger a not-found response (404). Caught by the framework.\n */\nexport function notFound(): never {\n const error = new Error(\"NEXT_NOT_FOUND\");\n (error as any).digest = `${HTTP_ERROR_FALLBACK_ERROR_CODE};404`;\n throw error;\n}\n\n/**\n * Trigger a forbidden response (403). Caught by the framework.\n * In Next.js, this is gated behind experimental.authInterrupts — we\n * support it unconditionally for maximum compatibility.\n */\nexport function forbidden(): never {\n const error = new Error(\"NEXT_FORBIDDEN\");\n (error as any).digest = `${HTTP_ERROR_FALLBACK_ERROR_CODE};403`;\n throw error;\n}\n\n/**\n * Trigger an unauthorized response (401). Caught by the framework.\n * In Next.js, this is gated behind experimental.authInterrupts — we\n * support it unconditionally for maximum compatibility.\n */\nexport function unauthorized(): never {\n const error = new Error(\"NEXT_UNAUTHORIZED\");\n (error as any).digest = `${HTTP_ERROR_FALLBACK_ERROR_CODE};401`;\n throw error;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n// React hooks are imported at the top level via ESM.\n\n// Listen for popstate on the client\nif (!isServer) {\n window.addEventListener(\"popstate\", (event) => {\n notifyListeners();\n // Restore scroll position for back/forward navigation\n restoreScrollPosition(event.state);\n });\n\n // ---------------------------------------------------------------------------\n // history.pushState / replaceState interception (shallow routing)\n //\n // Next.js intercepts these native methods so that when user code calls\n // `window.history.pushState(null, '', '/new-path?filter=abc')` directly,\n // React hooks like usePathname() and useSearchParams() re-render with\n // the new URL. This is the foundation for shallow routing patterns\n // (filter UIs, tabs, URL search param state, etc.).\n //\n // We wrap the original methods, call through to the native implementation,\n // then notify our listener system so useSyncExternalStore picks up the\n // URL change.\n // ---------------------------------------------------------------------------\n const originalPushState = window.history.pushState.bind(window.history);\n const originalReplaceState = window.history.replaceState.bind(window.history);\n\n window.history.pushState = function patchedPushState(\n data: unknown,\n unused: string,\n url?: string | URL | null,\n ): void {\n originalPushState(data, unused, url);\n notifyListeners();\n };\n\n window.history.replaceState = function patchedReplaceState(\n data: unknown,\n unused: string,\n url?: string | URL | null,\n ): void {\n originalReplaceState(data, unused, url);\n notifyListeners();\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/shims/navigation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,iFAAiF;AACjF,iFAAiF;AACjF,+EAA+E;AAC/E,qFAAqF;AACrF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,iFAAiF;AACjF,4EAA4E;AAC5E,4EAA4E;AAC5E,2EAA2E;AAC3E,uEAAuE;AACvE,8EAA8E;AAE9E,IAAI,iBAAiB,GAAmC,IAAI,CAAC;AAE7D,kFAAkF;AAClF,6EAA6E;AAC7E,iEAAiE;AACjE,yEAAyE;AACzE,0DAA0D;AAC1D,EAAE;AACF,0DAA0D;AAC1D,8CAA8C;AAC9C,6EAA6E;AAC7E,kEAAkE;AAClE,EAAE;AACF,4EAA4E;AAC5E,kEAAkE;AAElE,MAAM,CAAC,MAAM,yBAAyB,GAGpC,OAAO,KAAK,CAAC,aAAa,KAAK,UAAU;IACvC,CAAC,CAAC,KAAK,CAAC,aAAa,CAA6C,IAAI,CAAC;IACvE,CAAC,CAAC,IAAI,CAAC;AAEX;;;GAGG;AACH,MAAM,UAAU,uBAAuB;IACrC,IAAI,iBAAiB,KAAK,IAAI,IAAI,OAAO,KAAK,CA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AyE;IACzE,sEAAsE;IACtE,mEAAmE;IACnE,oDAAoD;IACpD,EAAE;IACF,2EAA2E;IAC3E,uEAAuE;IACvE,cAAc;IACd,8EAA8E;IAC9E,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACxE,MAAM,oBAAoB,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAE9E,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,SAAS,gBAAgB,CAClD,IAAa,EACb,MAAc,EACd,GAAyB;QAEzB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QACrC,eAAe,EAAE,CAAC;IACpB,CAAC,CAAC;IAEF,MAAM,CAAC,OAAO,CAAC,YAAY,GAAG,SAAS,mBAAmB,CACxD,IAAa,EACb,MAAc,EACd,GAAyB;QAEzB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QACxC,eAAe,EAAE,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * next/navigation shim\n *\n * App Router navigation hooks. These work on both server (RSC) and client.\n * Server-side: reads from a request context set by the RSC handler.\n * Client-side: reads from browser Location API and provides navigation.\n */\n\n// Use namespace import for RSC safety: the react-server condition doesn't export\n// createContext/useContext/useSyncExternalStore as named exports, and strict ESM\n// would throw at link time for missing bindings. With `import * as React`, the\n// bindings are just `undefined` on the namespace object and we can guard at runtime.\nimport * as React from \"react\";\nimport { toSameOriginPath } from \"./url-utils.js\";\n\n// ─── Layout segment context ───────────────────────────────────────────────────\n// Stores the child segments below the current layout. Each layout wraps its\n// children with a provider whose value is the remaining route tree segments\n// (including route groups, with dynamic params resolved to actual values).\n// Created lazily because `React.createContext` is NOT available in the\n// react-server condition of React. In the RSC environment, this remains null.\n\nlet _LayoutSegmentCtx: React.Context<string[]> | null = null;\n\n// ─── ServerInsertedHTML context ────────────────────────────────────────────────\n// Used by CSS-in-JS libraries (Apollo Client, styled-components, emotion) to\n// register HTML injection callbacks during SSR via useContext().\n// The SSR entry wraps the rendered tree with a Provider whose value is a\n// callback registration function (useServerInsertedHTML).\n//\n// In Next.js, ServerInsertedHTMLContext holds a function:\n// (callback: () => React.ReactNode) => void\n// Libraries call useContext(ServerInsertedHTMLContext) to get this function,\n// then call it to register callbacks that inject HTML during SSR.\n//\n// Created eagerly at module load time. In the RSC environment (react-server\n// condition), createContext isn't available so this will be null.\n\nexport const ServerInsertedHTMLContext: React.Context<\n ((callback: () => unknown) => void) | null\n> | null =\n typeof React.createContext === \"function\"\n ? React.createContext<((callback: () => unknown) => void) | null>(null)\n : null;\n\n/**\n * Get or create the layout segment context.\n * Returns null in the RSC environment (createContext unavailable).\n */\nexport function getLayoutSegmentContext(): React.Context<string[]> | null {\n if (_LayoutSegmentCtx === null && typeof React.createContext === \"function\") {\n _LayoutSegmentCtx = React.createContext<string[]>([]);\n }\n return _LayoutSegmentCtx;\n}\n\n/**\n * Read the child segments below the current layout from context.\n * Returns [] if no context is available (RSC environment, outside React tree).\n */\nfunction useChildSegments(): string[] {\n const ctx = getLayoutSegmentContext();\n if (!ctx) return [];\n // useContext is safe here because if createContext exists, useContext does too.\n // This branch is only taken in SSR/Browser, never in RSC.\n // Try/catch for unit tests that call this hook outside a React render tree.\n try {\n return React.useContext(ctx);\n } catch {\n return [];\n }\n}\n\n// ---------------------------------------------------------------------------\n// Server-side request context (set by the RSC entry before rendering)\n// ---------------------------------------------------------------------------\n\nexport interface NavigationContext {\n pathname: string;\n searchParams: URLSearchParams;\n params: Record<string, string | string[]>;\n}\n\n// ---------------------------------------------------------------------------\n// Server-side navigation state lives in a separate server-only module\n// (navigation-state.ts) that uses AsyncLocalStorage for request isolation.\n// This module is bundled for the browser, so it can't import node:async_hooks.\n//\n// On the server: state functions are set by navigation-state.ts at import time.\n// On the client: _serverContext falls back to null (hooks use window instead).\n// ---------------------------------------------------------------------------\n\nlet _serverContext: NavigationContext | null = null;\nlet _serverInsertedHTMLCallbacks: Array<() => unknown> = [];\n\n// These are overridden by navigation-state.ts on the server to use ALS.\nlet _getServerContext = (): NavigationContext | null => _serverContext;\nlet _setServerContext = (ctx: NavigationContext | null): void => { _serverContext = ctx; };\nlet _getInsertedHTMLCallbacks = (): Array<() => unknown> => _serverInsertedHTMLCallbacks;\nlet _clearInsertedHTMLCallbacks = (): void => { _serverInsertedHTMLCallbacks = []; };\n\n/**\n * Register ALS-backed state accessors. Called by navigation-state.ts on import.\n * @internal\n */\nexport function _registerStateAccessors(accessors: {\n getServerContext: () => NavigationContext | null;\n setServerContext: (ctx: NavigationContext | null) => void;\n getInsertedHTMLCallbacks: () => Array<() => unknown>;\n clearInsertedHTMLCallbacks: () => void;\n}): void {\n _getServerContext = accessors.getServerContext;\n _setServerContext = accessors.setServerContext;\n _getInsertedHTMLCallbacks = accessors.getInsertedHTMLCallbacks;\n _clearInsertedHTMLCallbacks = accessors.clearInsertedHTMLCallbacks;\n}\n\n/**\n * Get the navigation context for the current SSR/RSC render.\n * Reads from AsyncLocalStorage when available (concurrent-safe),\n * otherwise falls back to module-level state.\n */\nexport function getNavigationContext(): NavigationContext | null {\n return _getServerContext();\n}\n\n/**\n * Set the navigation context for the current SSR/RSC render.\n * Called by the framework entry before rendering each request.\n */\nexport function setNavigationContext(ctx: NavigationContext | null): void {\n _setServerContext(ctx);\n}\n\n// ---------------------------------------------------------------------------\n// Client-side state\n// ---------------------------------------------------------------------------\n\nconst isServer = typeof window === \"undefined\";\n\n/** basePath from next.config.js, injected by the plugin at build time */\nconst __basePath: string = process.env.__NEXT_ROUTER_BASEPATH ?? \"\";\n\n/** Strip basePath prefix from a browser pathname */\nfunction stripBasePath(p: string): string {\n if (!__basePath) return p;\n if (p.startsWith(__basePath)) return p.slice(__basePath.length) || \"/\";\n return p;\n}\n\n/** Prepend basePath to a path for browser URLs / fetches */\nfunction withBasePath(p: string): string {\n if (!__basePath) return p;\n return __basePath + p;\n}\n\n// ---------------------------------------------------------------------------\n// RSC prefetch cache utilities (shared between link.tsx and browser entry)\n// ---------------------------------------------------------------------------\n\n/** Maximum number of entries in the RSC prefetch cache. */\nconst MAX_PREFETCH_CACHE_SIZE = 50;\n\n/** TTL for prefetch cache entries in ms (matches Next.js static prefetch TTL). */\nexport const PREFETCH_CACHE_TTL = 30_000;\n\nexport interface PrefetchCacheEntry {\n response: Response;\n timestamp: number;\n}\n\n/**\n * Convert a pathname (with optional query/hash) to its .rsc URL.\n * Strips trailing slashes before appending `.rsc` so that cache keys\n * are consistent regardless of the `trailingSlash` config setting.\n */\nexport function toRscUrl(href: string): string {\n const [beforeHash] = href.split(\"#\");\n const qIdx = beforeHash.indexOf(\"?\");\n const pathname = qIdx === -1 ? beforeHash : beforeHash.slice(0, qIdx);\n const query = qIdx === -1 ? \"\" : beforeHash.slice(qIdx);\n // Strip trailing slash (but preserve \"/\" root) for consistent cache keys\n const normalizedPath = pathname.length > 1 && pathname.endsWith(\"/\")\n ? pathname.slice(0, -1)\n : pathname;\n return normalizedPath + \".rsc\" + query;\n}\n\n/** Get or create the shared in-memory RSC prefetch cache on window. */\nexport function getPrefetchCache(): Map<string, PrefetchCacheEntry> {\n if (isServer) return new Map();\n if (!window.__VINEXT_RSC_PREFETCH_CACHE__) {\n window.__VINEXT_RSC_PREFETCH_CACHE__ = new Map<string, PrefetchCacheEntry>();\n }\n return window.__VINEXT_RSC_PREFETCH_CACHE__;\n}\n\n/**\n * Get or create the shared set of already-prefetched RSC URLs on window.\n * Keyed by rscUrl so that the browser entry can clear entries when consumed.\n */\nexport function getPrefetchedUrls(): Set<string> {\n if (isServer) return new Set();\n if (!window.__VINEXT_RSC_PREFETCHED_URLS__) {\n window.__VINEXT_RSC_PREFETCHED_URLS__ = new Set<string>();\n }\n return window.__VINEXT_RSC_PREFETCHED_URLS__;\n}\n\n/**\n * Store a prefetched RSC response in the cache.\n * Enforces a maximum cache size to prevent unbounded memory growth on\n * link-heavy pages.\n */\nexport function storePrefetchResponse(rscUrl: string, response: Response): void {\n const cache = getPrefetchCache();\n // Evict oldest entry if at capacity (Map iterates in insertion order)\n if (cache.size >= MAX_PREFETCH_CACHE_SIZE) {\n const oldest = cache.keys().next().value;\n if (oldest !== undefined) cache.delete(oldest);\n }\n cache.set(rscUrl, { response, timestamp: Date.now() });\n}\n\n// Client navigation listeners\ntype NavigationListener = () => void;\nconst _listeners: Set<NavigationListener> = new Set();\n\nfunction notifyListeners(): void {\n for (const fn of _listeners) fn();\n}\n\n// Cached URLSearchParams, pathname, etc. for referential stability\n// useSyncExternalStore compares snapshots with Object.is — avoid creating\n// new instances on every render (infinite re-renders).\nlet _cachedSearch = !isServer ? window.location.search : \"\";\nlet _cachedSearchParams: URLSearchParams = new URLSearchParams(_cachedSearch);\nlet _cachedServerSearchParams: URLSearchParams | null = null;\nlet _cachedPathname = !isServer ? stripBasePath(window.location.pathname) : \"/\";\n\nfunction getPathnameSnapshot(): string {\n const current = stripBasePath(window.location.pathname);\n if (current !== _cachedPathname) {\n _cachedPathname = current;\n }\n return _cachedPathname;\n}\n\nfunction getSearchParamsSnapshot(): URLSearchParams {\n const current = window.location.search;\n if (current !== _cachedSearch) {\n _cachedSearch = current;\n _cachedSearchParams = new URLSearchParams(current);\n }\n return _cachedSearchParams;\n}\n\nfunction getServerSearchParamsSnapshot(): URLSearchParams {\n const ctx = _getServerContext();\n if (ctx?.searchParams != null) return ctx.searchParams;\n if (_cachedServerSearchParams === null) {\n _cachedServerSearchParams = new URLSearchParams();\n }\n return _cachedServerSearchParams;\n}\n\n// Track client-side params (set during RSC hydration/navigation)\n// We cache the params object for referential stability — only create a new\n// object when the params actually change (shallow key/value comparison).\nlet _clientParams: Record<string, string | string[]> = {};\nlet _clientParamsJson = \"{}\";\n\nexport function setClientParams(params: Record<string, string | string[]>): void {\n const json = JSON.stringify(params);\n if (json !== _clientParamsJson) {\n _clientParams = params;\n _clientParamsJson = json;\n }\n}\n\n/** Get the current client params (for testing referential stability). */\nexport function getClientParams(): Record<string, string | string[]> {\n return _clientParams;\n}\n\n// ---------------------------------------------------------------------------\n// Hooks\n// ---------------------------------------------------------------------------\n\n/**\n * Returns the current pathname.\n * Server: from request context. Client: from window.location.\n */\nexport function usePathname(): string {\n if (isServer) {\n // During SSR of \"use client\" components, the navigation context may not be set.\n // Return a safe fallback — the client will hydrate with the real value.\n return _getServerContext()?.pathname ?? \"/\";\n }\n // Client-side: use the hook system for reactivity\n return React.useSyncExternalStore(\n (cb: () => void) => { _listeners.add(cb); return () => { _listeners.delete(cb); }; },\n getPathnameSnapshot,\n () => _getServerContext()?.pathname ?? \"/\",\n );\n}\n\n/**\n * Returns the current search params as a read-only URLSearchParams.\n */\nexport function useSearchParams(): URLSearchParams {\n if (isServer) {\n // During SSR of \"use client\" components, the navigation context may not be set.\n // Return a safe fallback — the client will hydrate with the real value.\n return _getServerContext()?.searchParams ?? new URLSearchParams();\n }\n return React.useSyncExternalStore(\n (cb: () => void) => { _listeners.add(cb); return () => { _listeners.delete(cb); }; },\n getSearchParamsSnapshot,\n getServerSearchParamsSnapshot,\n );\n}\n\n/**\n * Returns the dynamic params for the current route.\n */\nexport function useParams<\n T extends Record<string, string | string[]> = Record<string, string | string[]>,\n>(): T {\n if (isServer) {\n // During SSR of \"use client\" components, the navigation context may not be set.\n return (_getServerContext()?.params ?? {}) as T;\n }\n return _clientParams as T;\n}\n\n/**\n * Check if a href is an external URL (any URL scheme per RFC 3986, or protocol-relative).\n */\nfunction isExternalUrl(href: string): boolean {\n return /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith(\"//\");\n}\n\n/**\n * Check if a href is only a hash change relative to the current URL.\n */\nfunction isHashOnlyChange(href: string): boolean {\n if (typeof window === \"undefined\") return false;\n if (href.startsWith(\"#\")) return true;\n try {\n const current = new URL(window.location.href);\n const next = new URL(href, window.location.href);\n return current.pathname === next.pathname && current.search === next.search && next.hash !== \"\";\n } catch {\n return false;\n }\n}\n\n/**\n * Scroll to a hash target element, or to the top if no hash.\n */\nfunction scrollToHash(hash: string): void {\n if (!hash || hash === \"#\") {\n window.scrollTo(0, 0);\n return;\n }\n const id = hash.slice(1);\n const element = document.getElementById(id);\n if (element) {\n element.scrollIntoView({ behavior: \"auto\" });\n }\n}\n\n/**\n * Reference to the native history.replaceState before patching.\n * Used internally to avoid triggering the interception for internal operations\n * (e.g. saving scroll position shouldn't cause re-renders).\n * Captured before the history method patching at the bottom of this module.\n */\nconst _nativeReplaceState = !isServer\n ? window.history.replaceState.bind(window.history)\n : (null as unknown as typeof window.history.replaceState);\n\n/**\n * Save the current scroll position into the current history state.\n * Called before every navigation to enable scroll restoration on back/forward.\n *\n * Uses _nativeReplaceState to avoid triggering the history.replaceState\n * interception (which would cause spurious re-renders from notifyListeners).\n */\nfunction saveScrollPosition(): void {\n const state = window.history.state ?? {};\n _nativeReplaceState.call(\n window.history,\n { ...state, __vinext_scrollX: window.scrollX, __vinext_scrollY: window.scrollY },\n \"\",\n );\n}\n\n/**\n * Restore scroll position from a history state object (used on popstate).\n *\n * When an RSC navigation is in flight (back/forward triggers both this\n * handler and the browser entry's popstate handler which calls\n * __VINEXT_RSC_NAVIGATE__), we must wait for the new content to render\n * before scrolling. Otherwise the user sees old content flash at the\n * restored scroll position.\n *\n * This handler fires before the browser entry's popstate handler (because\n * navigation.ts is loaded before hydration completes), so we defer via a\n * microtask to give the browser entry handler a chance to set\n * __VINEXT_RSC_PENDING__ first.\n */\nfunction restoreScrollPosition(state: unknown): void {\n if (state && typeof state === \"object\" && \"__vinext_scrollY\" in state) {\n const { __vinext_scrollX: x, __vinext_scrollY: y } = state as {\n __vinext_scrollX: number;\n __vinext_scrollY: number;\n };\n\n // Defer to allow other popstate listeners (browser entry) to run first\n // and set __VINEXT_RSC_PENDING__. Promise.resolve() schedules a microtask\n // that runs after all synchronous event listeners have completed.\n void Promise.resolve().then(() => {\n const pending: Promise<void> | null = window.__VINEXT_RSC_PENDING__ ?? null;\n\n if (pending) {\n // Wait for the RSC navigation to finish rendering, then scroll.\n void pending.then(() => {\n requestAnimationFrame(() => {\n window.scrollTo(x, y);\n });\n });\n } else {\n // No RSC navigation in flight (Pages Router or already settled).\n requestAnimationFrame(() => {\n window.scrollTo(x, y);\n });\n }\n });\n }\n}\n\n/**\n * Navigate to a URL, handling external URLs, hash-only changes, and RSC navigation.\n */\nasync function navigateImpl(\n href: string,\n mode: \"push\" | \"replace\",\n scroll: boolean,\n): Promise<void> {\n // Normalize same-origin absolute URLs to local paths for SPA navigation\n let normalizedHref = href;\n if (isExternalUrl(href)) {\n const localPath = toSameOriginPath(href);\n if (localPath == null) {\n // Truly external: use full page navigation\n if (mode === \"replace\") {\n window.location.replace(href);\n } else {\n window.location.assign(href);\n }\n return;\n }\n normalizedHref = localPath;\n }\n\n const fullHref = withBasePath(normalizedHref);\n\n // Save scroll position before navigating (for back/forward restoration)\n if (mode === \"push\") {\n saveScrollPosition();\n }\n\n // Hash-only change: update URL and scroll to target, skip RSC fetch\n if (isHashOnlyChange(fullHref)) {\n const hash = fullHref.includes(\"#\") ? fullHref.slice(fullHref.indexOf(\"#\")) : \"\";\n if (mode === \"replace\") {\n window.history.replaceState(null, \"\", fullHref);\n } else {\n window.history.pushState(null, \"\", fullHref);\n }\n notifyListeners();\n if (scroll) {\n scrollToHash(hash);\n }\n return;\n }\n\n // Extract hash for post-navigation scrolling\n const hashIdx = fullHref.indexOf(\"#\");\n const hash = hashIdx !== -1 ? fullHref.slice(hashIdx) : \"\";\n\n if (mode === \"replace\") {\n window.history.replaceState(null, \"\", fullHref);\n } else {\n window.history.pushState(null, \"\", fullHref);\n }\n notifyListeners();\n\n // Trigger RSC re-fetch if available, and wait for the new content to render\n // before scrolling. This prevents the old page from visibly jumping to the\n // top before the new content paints.\n if (typeof window.__VINEXT_RSC_NAVIGATE__ === \"function\") {\n await window.__VINEXT_RSC_NAVIGATE__(fullHref);\n }\n\n if (scroll) {\n if (hash) {\n scrollToHash(hash);\n } else {\n window.scrollTo(0, 0);\n }\n }\n}\n\n// ---------------------------------------------------------------------------\n// App Router router singleton\n//\n// All methods close over module-level state (navigateImpl, withBasePath, etc.)\n// and carry no per-render data, so the object can be created once and reused.\n// Next.js returns the same router reference on every call to useRouter(), which\n// matters for components that rely on referential equality (e.g. useMemo /\n// useEffect dependency arrays, React.memo bailouts).\n// ---------------------------------------------------------------------------\n\nconst _appRouter = {\n push(href: string, options?: { scroll?: boolean }): void {\n if (isServer) return;\n void navigateImpl(href, \"push\", options?.scroll !== false);\n },\n replace(href: string, options?: { scroll?: boolean }): void {\n if (isServer) return;\n void navigateImpl(href, \"replace\", options?.scroll !== false);\n },\n back(): void {\n if (isServer) return;\n window.history.back();\n },\n forward(): void {\n if (isServer) return;\n window.history.forward();\n },\n refresh(): void {\n if (isServer) return;\n // Re-fetch the current page's RSC stream\n if (typeof window.__VINEXT_RSC_NAVIGATE__ === \"function\") {\n window.__VINEXT_RSC_NAVIGATE__(window.location.href);\n }\n },\n prefetch(href: string): void {\n if (isServer) return;\n // Prefetch the RSC payload for the target route and store in cache\n const fullHref = withBasePath(href);\n const rscUrl = toRscUrl(fullHref);\n const prefetched = getPrefetchedUrls();\n if (prefetched.has(rscUrl)) return;\n prefetched.add(rscUrl);\n fetch(rscUrl, {\n headers: { Accept: \"text/x-component\" },\n credentials: \"include\",\n priority: \"low\" as RequestInit[\"priority\"],\n }).then((response) => {\n if (response.ok) {\n storePrefetchResponse(rscUrl, response);\n } else {\n // Non-ok response: allow retry on next prefetch() call\n prefetched.delete(rscUrl);\n }\n }).catch(() => {\n // Network error: allow retry on next prefetch() call\n prefetched.delete(rscUrl);\n });\n },\n};\n\n/**\n * App Router's useRouter — returns push/replace/back/forward/refresh.\n * Different from Pages Router's useRouter (next/router).\n *\n * Returns a stable singleton: the same object reference on every call,\n * matching Next.js behavior so components using referential equality\n * (e.g. useMemo / useEffect deps, React.memo) don't re-render unnecessarily.\n */\nexport function useRouter() {\n return _appRouter;\n}\n\n/**\n * Returns the active child segment one level below the layout where it's called.\n *\n * Returns the first segment from the route tree below this layout, including\n * route groups (e.g., \"(marketing)\") and resolved dynamic params. Returns null\n * if at the leaf (no child segments).\n *\n * @param parallelRoutesKey - Which parallel route to read (default: \"children\")\n */\nexport function useSelectedLayoutSegment(\n // parallelRoutesKey is accepted for API compat but not yet supported —\n // vinext doesn't implement parallel routes with separate segment tracking.\n _parallelRoutesKey?: string,\n): string | null {\n const segments = useSelectedLayoutSegments(_parallelRoutesKey);\n return segments.length > 0 ? segments[0] : null;\n}\n\n/**\n * Returns all active segments below the layout where it's called.\n *\n * Each layout in the App Router tree wraps its children with a\n * LayoutSegmentProvider whose value is the remaining route tree segments\n * (including route groups, with dynamic params resolved to actual values\n * and catch-all segments joined with \"/\"). This hook reads those segments\n * directly from context.\n *\n * @param parallelRoutesKey - Which parallel route to read (default: \"children\")\n */\nexport function useSelectedLayoutSegments(\n // parallelRoutesKey is accepted for API compat but not yet supported —\n // vinext doesn't implement parallel routes with separate segment tracking.\n _parallelRoutesKey?: string,\n): string[] {\n return useChildSegments();\n}\n\n/**\n * ReadonlyURLSearchParams — type alias matching Next.js.\n * In Next.js this prevents mutation, but since URLSearchParams is the underlying\n * type in our implementation, we export it as-is for type compatibility.\n */\nexport type ReadonlyURLSearchParams = URLSearchParams;\n\n/**\n * useServerInsertedHTML — inject HTML during SSR from client components.\n *\n * Used by CSS-in-JS libraries (styled-components, emotion, StyleX) to inject\n * <style> tags during SSR so styles appear in the initial HTML (no FOUC).\n *\n * The callback is called once after each SSR render pass. The returned JSX/HTML\n * is serialized and injected into the HTML stream.\n *\n * Usage (in a \"use client\" component wrapping children):\n * useServerInsertedHTML(() => {\n * const styles = sheet.getStyleElement();\n * sheet.instance.clearTag();\n * return <>{styles}</>;\n * });\n */\n\nexport function useServerInsertedHTML(callback: () => unknown): void {\n if (typeof document !== \"undefined\") {\n // Client-side: no-op (styles are already in the DOM)\n return;\n }\n _getInsertedHTMLCallbacks().push(callback);\n}\n\n/**\n * Flush all collected useServerInsertedHTML callbacks.\n * Returns an array of results (React elements or strings).\n * Clears the callback list so the next render starts fresh.\n *\n * Called by the SSR entry after renderToReadableStream completes.\n */\nexport function flushServerInsertedHTML(): unknown[] {\n const callbacks = _getInsertedHTMLCallbacks();\n const results: unknown[] = [];\n for (const cb of callbacks) {\n try {\n const result = cb();\n if (result != null) results.push(result);\n } catch {\n // Ignore errors from individual callbacks\n }\n }\n callbacks.length = 0;\n return results;\n}\n\n/**\n * Clear all collected useServerInsertedHTML callbacks without flushing.\n * Used for cleanup between requests.\n */\nexport function clearServerInsertedHTML(): void {\n _clearInsertedHTMLCallbacks();\n}\n\n// ---------------------------------------------------------------------------\n// Non-hook utilities (can be called from Server Components)\n// ---------------------------------------------------------------------------\n\n/**\n * HTTP Access Fallback error code — shared prefix for notFound/forbidden/unauthorized.\n * Matches Next.js 16's unified error handling approach.\n */\nexport const HTTP_ERROR_FALLBACK_ERROR_CODE = \"NEXT_HTTP_ERROR_FALLBACK\";\n\n/**\n * Check if an error is an HTTP Access Fallback error (notFound, forbidden, unauthorized).\n */\nexport function isHTTPAccessFallbackError(error: unknown): boolean {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String((error as any).digest);\n return (\n digest === \"NEXT_NOT_FOUND\" || // legacy compat\n digest.startsWith(`${HTTP_ERROR_FALLBACK_ERROR_CODE};`)\n );\n }\n return false;\n}\n\n/**\n * Extract the HTTP status code from an HTTP Access Fallback error.\n * Returns 404 for legacy NEXT_NOT_FOUND errors.\n */\nexport function getAccessFallbackHTTPStatus(error: unknown): number {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String((error as any).digest);\n if (digest === \"NEXT_NOT_FOUND\") return 404;\n if (digest.startsWith(`${HTTP_ERROR_FALLBACK_ERROR_CODE};`)) {\n return parseInt(digest.split(\";\")[1], 10);\n }\n }\n return 404;\n}\n\n/**\n * Enum matching Next.js RedirectType for type-safe redirect calls.\n */\nexport enum RedirectType {\n push = \"push\",\n replace = \"replace\",\n}\n\n/**\n * Throw a redirect. Caught by the framework to send a redirect response.\n */\nexport function redirect(url: string, type?: \"replace\" | \"push\" | RedirectType): never {\n const error = new Error(`NEXT_REDIRECT:${url}`);\n (error as any).digest = `NEXT_REDIRECT;${type ?? \"replace\"};${encodeURIComponent(url)}`;\n throw error;\n}\n\n/**\n * Trigger a permanent redirect (308).\n */\nexport function permanentRedirect(url: string): never {\n const error = new Error(`NEXT_REDIRECT:${url}`);\n (error as any).digest = `NEXT_REDIRECT;replace;${encodeURIComponent(url)};308`;\n throw error;\n}\n\n/**\n * Trigger a not-found response (404). Caught by the framework.\n */\nexport function notFound(): never {\n const error = new Error(\"NEXT_NOT_FOUND\");\n (error as any).digest = `${HTTP_ERROR_FALLBACK_ERROR_CODE};404`;\n throw error;\n}\n\n/**\n * Trigger a forbidden response (403). Caught by the framework.\n * In Next.js, this is gated behind experimental.authInterrupts — we\n * support it unconditionally for maximum compatibility.\n */\nexport function forbidden(): never {\n const error = new Error(\"NEXT_FORBIDDEN\");\n (error as any).digest = `${HTTP_ERROR_FALLBACK_ERROR_CODE};403`;\n throw error;\n}\n\n/**\n * Trigger an unauthorized response (401). Caught by the framework.\n * In Next.js, this is gated behind experimental.authInterrupts — we\n * support it unconditionally for maximum compatibility.\n */\nexport function unauthorized(): never {\n const error = new Error(\"NEXT_UNAUTHORIZED\");\n (error as any).digest = `${HTTP_ERROR_FALLBACK_ERROR_CODE};401`;\n throw error;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n// React hooks are imported at the top level via ESM.\n\n// Listen for popstate on the client\nif (!isServer) {\n window.addEventListener(\"popstate\", (event) => {\n notifyListeners();\n // Restore scroll position for back/forward navigation\n restoreScrollPosition(event.state);\n });\n\n // ---------------------------------------------------------------------------\n // history.pushState / replaceState interception (shallow routing)\n //\n // Next.js intercepts these native methods so that when user code calls\n // `window.history.pushState(null, '', '/new-path?filter=abc')` directly,\n // React hooks like usePathname() and useSearchParams() re-render with\n // the new URL. This is the foundation for shallow routing patterns\n // (filter UIs, tabs, URL search param state, etc.).\n //\n // We wrap the original methods, call through to the native implementation,\n // then notify our listener system so useSyncExternalStore picks up the\n // URL change.\n // ---------------------------------------------------------------------------\n const originalPushState = window.history.pushState.bind(window.history);\n const originalReplaceState = window.history.replaceState.bind(window.history);\n\n window.history.pushState = function patchedPushState(\n data: unknown,\n unused: string,\n url?: string | URL | null,\n ): void {\n originalPushState(data, unused, url);\n notifyListeners();\n };\n\n window.history.replaceState = function patchedReplaceState(\n data: unknown,\n unused: string,\n url?: string | URL | null,\n ): void {\n originalReplaceState(data, unused, url);\n notifyListeners();\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/shims/router.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAA4D,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/shims/router.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAA4D,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAqBpG,KAAK,sBAAsB,GAAG,CAAC,KAAK,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAA;CAAE,KAAK,OAAO,CAAC;AAE7G,UAAU,UAAU;IAClB,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IACzC,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB;IAChB,QAAQ,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