vinext 0.1.3 → 0.1.5

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.
Files changed (185) hide show
  1. package/dist/build/client-build-config.d.ts +11 -2
  2. package/dist/build/client-build-config.js +17 -6
  3. package/dist/build/css-url-assets.d.ts +1 -1
  4. package/dist/build/css-url-assets.js +9 -7
  5. package/dist/build/prerender.js +3 -1
  6. package/dist/cache/cache-adapters-virtual.js +1 -1
  7. package/dist/client/pages-router-link-navigation.d.ts +33 -7
  8. package/dist/client/pages-router-link-navigation.js +32 -2
  9. package/dist/client/vinext-next-data.js +2 -0
  10. package/dist/cloudflare/src/cache/kv-data-adapter.runtime.d.ts +1 -1
  11. package/dist/config/config-matchers.d.ts +11 -1
  12. package/dist/config/config-matchers.js +14 -2
  13. package/dist/config/tsconfig-paths.js +14 -1
  14. package/dist/deploy.js +20 -13
  15. package/dist/entries/app-rsc-entry.js +27 -22
  16. package/dist/entries/pages-client-entry.js +14 -13
  17. package/dist/entries/pages-server-entry.js +8 -27
  18. package/dist/index.js +365 -147
  19. package/dist/plugins/css-data-url.js +30 -26
  20. package/dist/plugins/dynamic-preload-metadata.js +2 -4
  21. package/dist/plugins/extensionless-dynamic-import.js +27 -24
  22. package/dist/plugins/fonts.js +5 -4
  23. package/dist/plugins/import-meta-url.js +21 -15
  24. package/dist/plugins/instrumentation-client.js +1 -1
  25. package/dist/plugins/middleware-server-only.js +7 -6
  26. package/dist/plugins/og-assets.js +48 -46
  27. package/dist/plugins/optimize-imports.js +9 -3
  28. package/dist/plugins/remove-console.d.ts +7 -1
  29. package/dist/plugins/remove-console.js +4 -1
  30. package/dist/plugins/require-context.js +21 -20
  31. package/dist/plugins/strip-server-exports.d.ts +16 -8
  32. package/dist/plugins/strip-server-exports.js +496 -46
  33. package/dist/routing/app-route-graph.js +2 -2
  34. package/dist/server/app-bfcache-identity.d.ts +26 -0
  35. package/dist/server/app-bfcache-identity.js +127 -0
  36. package/dist/server/app-browser-action-result.js +1 -1
  37. package/dist/server/app-browser-entry.js +22 -12
  38. package/dist/server/app-browser-navigation-controller.d.ts +1 -1
  39. package/dist/server/app-browser-navigation-controller.js +1 -1
  40. package/dist/server/app-browser-state.d.ts +3 -22
  41. package/dist/server/app-browser-state.js +23 -139
  42. package/dist/server/app-browser-stream.js +1 -1
  43. package/dist/server/app-browser-visible-commit.d.ts +1 -1
  44. package/dist/server/app-browser-visible-commit.js +3 -2
  45. package/dist/server/app-fallback-renderer.d.ts +1 -1
  46. package/dist/server/app-layout-param-observation.d.ts +1 -1
  47. package/dist/server/app-layout-param-observation.js +1 -1
  48. package/dist/server/app-middleware.js +2 -1
  49. package/dist/server/app-page-boundary-render.d.ts +1 -1
  50. package/dist/server/app-page-boundary.js +1 -1
  51. package/dist/server/app-page-cache-finalizer.d.ts +62 -0
  52. package/dist/server/app-page-cache-finalizer.js +122 -0
  53. package/dist/server/app-page-cache-render.d.ts +2 -2
  54. package/dist/server/app-page-cache-render.js +1 -1
  55. package/dist/server/app-page-cache.d.ts +2 -53
  56. package/dist/server/app-page-cache.js +5 -131
  57. package/dist/server/app-page-dispatch.d.ts +2 -2
  58. package/dist/server/app-page-dispatch.js +10 -8
  59. package/dist/server/app-page-probe.js +3 -2
  60. package/dist/server/app-page-render-observation.js +2 -2
  61. package/dist/server/app-page-render.d.ts +3 -3
  62. package/dist/server/app-page-render.js +3 -2
  63. package/dist/server/app-page-stream.d.ts +2 -9
  64. package/dist/server/app-page-stream.js +1 -35
  65. package/dist/server/app-pages-bridge.d.ts +5 -1
  66. package/dist/server/app-pages-bridge.js +5 -13
  67. package/dist/server/app-request-context.d.ts +1 -2
  68. package/dist/server/app-request-context.js +2 -1
  69. package/dist/server/app-route-handler-dispatch.js +3 -2
  70. package/dist/server/app-route-handler-execution.d.ts +1 -1
  71. package/dist/server/app-route-handler-execution.js +1 -1
  72. package/dist/server/app-route-handler-response.d.ts +1 -1
  73. package/dist/server/app-router-entry.js +2 -1
  74. package/dist/server/app-rsc-handler.d.ts +3 -0
  75. package/dist/server/app-rsc-handler.js +73 -31
  76. package/dist/server/app-rsc-response-finalizer.js +1 -1
  77. package/dist/server/app-rsc-route-matching.js +6 -2
  78. package/dist/server/app-server-action-execution.d.ts +1 -1
  79. package/dist/server/app-server-action-execution.js +10 -6
  80. package/dist/server/app-ssr-entry.d.ts +1 -1
  81. package/dist/server/app-ssr-entry.js +12 -38
  82. package/dist/server/app-ssr-router-instance.d.ts +6 -0
  83. package/dist/server/app-ssr-router-instance.js +24 -0
  84. package/dist/server/app-ssr-stream.js +1 -1
  85. package/dist/server/artifact-compatibility.js +1 -1
  86. package/dist/server/before-interactive-head.d.ts +17 -0
  87. package/dist/server/before-interactive-head.js +35 -0
  88. package/dist/server/client-reuse-manifest.js +1 -1
  89. package/dist/server/csp.js +1 -4
  90. package/dist/server/defer-until-stream-consumed.d.ts +7 -0
  91. package/dist/server/defer-until-stream-consumed.js +34 -0
  92. package/dist/server/dev-server.js +82 -37
  93. package/dist/server/instrumentation.js +1 -1
  94. package/dist/server/isr-cache.d.ts +1 -1
  95. package/dist/server/isr-cache.js +1 -1
  96. package/dist/server/isr-decision.d.ts +1 -1
  97. package/dist/server/middleware-matcher.js +20 -9
  98. package/dist/server/middleware-runtime.d.ts +3 -4
  99. package/dist/server/middleware-runtime.js +4 -2
  100. package/dist/server/navigation-planner.d.ts +3 -12
  101. package/dist/server/navigation-planner.js +24 -0
  102. package/dist/server/navigation-trace.d.ts +2 -1
  103. package/dist/server/navigation-trace.js +1 -0
  104. package/dist/server/open-redirect.d.ts +12 -0
  105. package/dist/server/open-redirect.js +21 -0
  106. package/dist/server/operation-token.d.ts +40 -0
  107. package/dist/server/operation-token.js +85 -0
  108. package/dist/server/pages-data-route.d.ts +1 -1
  109. package/dist/server/pages-data-route.js +7 -4
  110. package/dist/server/pages-dev-module-url.d.ts +4 -0
  111. package/dist/server/pages-dev-module-url.js +15 -0
  112. package/dist/server/pages-document-initial-props.d.ts +4 -15
  113. package/dist/server/pages-document-initial-props.js +27 -56
  114. package/dist/server/pages-i18n.js +2 -2
  115. package/dist/server/pages-page-data.d.ts +1 -1
  116. package/dist/server/pages-page-data.js +3 -1
  117. package/dist/server/pages-page-handler.js +3 -1
  118. package/dist/server/pages-page-response.d.ts +3 -1
  119. package/dist/server/pages-page-response.js +6 -6
  120. package/dist/server/pages-readiness.js +1 -1
  121. package/dist/server/pages-request-pipeline.d.ts +7 -7
  122. package/dist/server/pages-request-pipeline.js +63 -21
  123. package/dist/server/prod-server.d.ts +3 -1
  124. package/dist/server/prod-server.js +43 -11
  125. package/dist/server/request-pipeline.d.ts +1 -24
  126. package/dist/server/request-pipeline.js +1 -33
  127. package/dist/server/seed-cache.d.ts +1 -1
  128. package/dist/server/static-file-cache.js +16 -4
  129. package/dist/shims/before-interactive-context.d.ts +14 -3
  130. package/dist/shims/cache-handler.d.ts +106 -0
  131. package/dist/shims/cache-handler.js +176 -0
  132. package/dist/shims/cache-request-state.d.ts +47 -0
  133. package/dist/shims/cache-request-state.js +126 -0
  134. package/dist/shims/cache-runtime.d.ts +2 -2
  135. package/dist/shims/cache-runtime.js +3 -14
  136. package/dist/shims/cache.d.ts +3 -231
  137. package/dist/shims/cache.js +17 -383
  138. package/dist/shims/cdn-cache.d.ts +1 -1
  139. package/dist/shims/cdn-cache.js +1 -1
  140. package/dist/shims/document.d.ts +15 -20
  141. package/dist/shims/document.js +5 -8
  142. package/dist/shims/error-boundary-navigation.d.ts +7 -0
  143. package/dist/shims/error-boundary-navigation.js +44 -0
  144. package/dist/shims/error-boundary.js +10 -8
  145. package/dist/shims/error.js +2 -1
  146. package/dist/shims/fetch-cache.js +1 -1
  147. package/dist/shims/form.js +1 -1
  148. package/dist/shims/image.js +74 -9
  149. package/dist/shims/internal/app-page-props-cache-key.d.ts +5 -0
  150. package/dist/shims/internal/app-page-props-cache-key.js +16 -0
  151. package/dist/shims/internal/navigation-untracked.js +2 -1
  152. package/dist/shims/internal/pages-data-fetch-dedup.d.ts +6 -7
  153. package/dist/shims/internal/pages-data-fetch-dedup.js +67 -14
  154. package/dist/shims/internal/pages-data-target.js +1 -1
  155. package/dist/shims/layout-segment-context.d.ts +1 -1
  156. package/dist/shims/layout-segment-context.js +2 -1
  157. package/dist/shims/link.js +38 -17
  158. package/dist/shims/metadata.js +4 -4
  159. package/dist/shims/navigation-context-state.d.ts +40 -0
  160. package/dist/shims/navigation-context-state.js +116 -0
  161. package/dist/shims/navigation-errors.d.ts +55 -0
  162. package/dist/shims/navigation-errors.js +110 -0
  163. package/dist/shims/navigation-server.d.ts +3 -0
  164. package/dist/shims/navigation-server.js +3 -0
  165. package/dist/shims/navigation-state.d.ts +1 -2
  166. package/dist/shims/navigation-state.js +2 -1
  167. package/dist/shims/navigation.d.ts +3 -291
  168. package/dist/shims/navigation.js +16 -445
  169. package/dist/shims/navigation.react-server.d.ts +2 -2
  170. package/dist/shims/navigation.react-server.js +3 -1
  171. package/dist/shims/request-state-types.d.ts +3 -3
  172. package/dist/shims/router.d.ts +6 -2
  173. package/dist/shims/router.js +99 -20
  174. package/dist/shims/script.js +9 -5
  175. package/dist/shims/slot.js +3 -1
  176. package/dist/shims/unified-request-context.d.ts +2 -2
  177. package/dist/utils/has-trailing-comma.d.ts +24 -0
  178. package/dist/utils/has-trailing-comma.js +62 -0
  179. package/dist/utils/text-stream.d.ts +1 -1
  180. package/dist/utils/text-stream.js +2 -2
  181. package/dist/utils/virtual-module.d.ts +5 -0
  182. package/dist/utils/virtual-module.js +0 -0
  183. package/dist/utils/vite-version.d.ts +12 -1
  184. package/dist/utils/vite-version.js +9 -1
  185. package/package.json +5 -1
@@ -0,0 +1,127 @@
1
+ import { countConsumedPathnameSegments, isInvisibleSegment, normalizePathnameForRouteMatch, splitPathSegments } from "../routing/utils.js";
2
+ import { normalizePath } from "./normalize-path.js";
3
+ import { AppElementsWire } from "./app-elements-wire.js";
4
+ import "./app-elements.js";
5
+ import "./app-bfcache-id.js";
6
+ import { isBfcacheSegmentId } from "./app-history-state.js";
7
+ //#region src/server/app-bfcache-identity.ts
8
+ let nextBfcacheId = 0;
9
+ function rememberBfcacheId(value) {
10
+ const match = /^_b_(\d+)_$/.exec(value);
11
+ if (!match) return;
12
+ nextBfcacheId = Math.max(nextBfcacheId, Number(match[1]));
13
+ }
14
+ function mintBfcacheId() {
15
+ nextBfcacheId += 1;
16
+ return `_b_${nextBfcacheId}_`;
17
+ }
18
+ function getVisibleTreePathSegments(treePath) {
19
+ return splitPathSegments(treePath).filter((segment) => !isInvisibleSegment(segment));
20
+ }
21
+ function getTreePathIdentityPrefix(pathname, treePath) {
22
+ const pathnameSegments = splitPathSegments(pathname);
23
+ const consumedPathnameSegments = countConsumedPathnameSegments(getVisibleTreePathSegments(treePath), pathnameSegments.length);
24
+ if (consumedPathnameSegments === 0) return "/";
25
+ return `/${pathnameSegments.slice(0, consumedPathnameSegments).join("/")}`;
26
+ }
27
+ function readAppElementsMetadata(elements) {
28
+ let metadata;
29
+ try {
30
+ metadata = AppElementsWire.readMetadata(elements);
31
+ } catch {
32
+ return null;
33
+ }
34
+ const slotBindingsBySlotId = /* @__PURE__ */ new Map();
35
+ for (const binding of metadata.slotBindings) slotBindingsBySlotId.set(binding.slotId, binding);
36
+ return {
37
+ metadata,
38
+ slotBindingsBySlotId
39
+ };
40
+ }
41
+ function createActiveSlotIdentity(id, parsed) {
42
+ const activeSlotBinding = parsed?.slotBindingsBySlotId.get(id);
43
+ if (activeSlotBinding?.activeRouteId != null) return `${id}@${activeSlotBinding.activeRouteId}`;
44
+ const interception = parsed?.metadata.interception;
45
+ if (interception?.slotId !== id) return null;
46
+ return `${id}@${interception.targetRouteId}`;
47
+ }
48
+ /**
49
+ * Derive BFCache identity from AppElements wire keys. Keep wire-key parsing
50
+ * contained here until vinext has a route-manifest authority equivalent to
51
+ * Next.js CacheNode or segment-cache state.
52
+ */
53
+ function createBfcacheSegmentIdentity(id, options) {
54
+ const parsed = AppElementsWire.parseElementKey(id);
55
+ if (!parsed) return null;
56
+ if (parsed.kind === "page") return `${id}@${options.pathname}`;
57
+ if (parsed.kind === "slot") {
58
+ const activeSlotIdentity = createActiveSlotIdentity(id, options.metadata);
59
+ if (activeSlotIdentity !== null) return activeSlotIdentity;
60
+ return `${id}@${getTreePathIdentityPrefix(options.pathname, parsed.treePath)}`;
61
+ }
62
+ if (parsed.kind === "layout" || parsed.kind === "template") return `${id}@${getTreePathIdentityPrefix(options.pathname, parsed.treePath)}`;
63
+ return null;
64
+ }
65
+ function collectBfcacheSegmentIds(elements, parsed) {
66
+ const ids = new Set(Object.keys(elements));
67
+ const metadata = parsed === void 0 ? readAppElementsMetadata(elements) : parsed;
68
+ for (const layoutId of metadata?.metadata.layoutIds ?? []) ids.add(layoutId);
69
+ return Array.from(ids).filter(isBfcacheSegmentId);
70
+ }
71
+ function createInitialBfcacheIdMap(elements) {
72
+ const ids = {};
73
+ for (const id of collectBfcacheSegmentIds(elements)) ids[id] = "0";
74
+ return ids;
75
+ }
76
+ function normalizeBfcachePathname(pathname) {
77
+ const normalized = normalizePath(normalizePathnameForRouteMatch(pathname));
78
+ return normalized.length > 1 ? normalized.replace(/\/$/, "") : normalized;
79
+ }
80
+ function createBfcacheSegmentStateKeyMap(options) {
81
+ const metadata = readAppElementsMetadata(options.elements);
82
+ const normalizedPathname = normalizeBfcachePathname(options.pathname);
83
+ const stateKeys = {};
84
+ for (const id of collectBfcacheSegmentIds(options.elements, metadata)) {
85
+ const stateKey = createBfcacheSegmentIdentity(id, {
86
+ metadata,
87
+ pathname: normalizedPathname
88
+ });
89
+ if (stateKey !== null) stateKeys[id] = stateKey;
90
+ }
91
+ return stateKeys;
92
+ }
93
+ function createNextBfcacheIdMap(options) {
94
+ const current = options.reuseCurrent === false ? {} : options.current;
95
+ for (const value of Object.values(current)) rememberBfcacheId(value);
96
+ for (const value of Object.values(options.restored ?? {})) rememberBfcacheId(value);
97
+ const currentMetadata = readAppElementsMetadata(options.currentElements);
98
+ const nextMetadata = readAppElementsMetadata(options.elements);
99
+ const currentPathname = normalizeBfcachePathname(options.currentPathname);
100
+ const nextPathname = normalizeBfcachePathname(options.nextPathname);
101
+ const ids = {};
102
+ for (const id of collectBfcacheSegmentIds(options.elements, nextMetadata)) {
103
+ const currentValue = createBfcacheSegmentIdentity(id, {
104
+ metadata: currentMetadata,
105
+ pathname: currentPathname
106
+ }) === createBfcacheSegmentIdentity(id, {
107
+ metadata: nextMetadata,
108
+ pathname: nextPathname
109
+ }) ? current[id] : void 0;
110
+ const value = options.restored?.[id] ?? currentValue ?? mintBfcacheId();
111
+ ids[id] = value;
112
+ rememberBfcacheId(value);
113
+ }
114
+ return ids;
115
+ }
116
+ function preserveBfcacheIdsForMergedElements(options) {
117
+ const ids = {};
118
+ for (const id of collectBfcacheSegmentIds(options.elements)) {
119
+ const value = options.next[id] ?? options.previous[id];
120
+ if (value === void 0) continue;
121
+ ids[id] = value;
122
+ rememberBfcacheId(value);
123
+ }
124
+ return ids;
125
+ }
126
+ //#endregion
127
+ export { createBfcacheSegmentStateKeyMap, createInitialBfcacheIdMap, createNextBfcacheIdMap, preserveBfcacheIdsForMergedElements };
@@ -33,7 +33,7 @@ function parseServerActionRevalidationHeader(headers) {
33
33
  }
34
34
  }
35
35
  function createServerActionHttpFallbackError(status) {
36
- if (status < 400 || status > 599) return null;
36
+ if (status !== 401 && status !== 403 && status !== 404) return null;
37
37
  const digest = status === 404 ? "NEXT_HTTP_ERROR_FALLBACK;404" : `NEXT_HTTP_ERROR_FALLBACK;${status}`;
38
38
  const error = /* @__PURE__ */ new Error(status === 404 ? "NEXT_NOT_FOUND" : `NEXT_HTTP_ERROR_FALLBACK;${status}`);
39
39
  return Object.assign(error, { digest });
@@ -6,25 +6,28 @@ import { getMountedSlotIdsHeader, resolveVisitedResponseInterceptionContext } fr
6
6
  import { AppRouterContext } from "../shims/internal/app-router-context.js";
7
7
  import { installWindowNext, setWindowNextInternalSourcePage } from "../client/window-next.js";
8
8
  import { retryScrollTo, scrollToHashTargetOnNextFrame } from "../shims/hash-scroll.js";
9
- import { getNavigationRuntime, registerNavigationRuntimeBootstrap, registerNavigationRuntimeFunctions } from "../client/navigation-runtime.js";
10
- import { notifyAppRouterTransitionStart } from "../client/instrumentation-client-state.js";
11
- import { clearAppNavigationFailureTarget, installAppNavigationFailureListeners } from "../client/app-nav-failure-handler.js";
12
- import { resolveManifestNavigationInterceptionContext, resolveMiddlewareRewriteNavigationInterceptionContext } from "./app-browser-interception-context.js";
13
- import { readHistoryStatePreviousNextUrl } from "./app-history-state.js";
14
- import { VINEXT_RSC_COMPATIBILITY_ID_HEADER, VINEXT_RSC_CONTENT_TYPE, createRscRequestHeaders, createRscRequestUrl, createServerActionRequestUrl, getVinextRscCompatibilityId } from "./app-rsc-cache-busting.js";
15
- import { AppBrowserMpaNavigationScheduler } from "./app-browser-mpa-navigation.js";
16
- import { navigationPlanner } from "./navigation-planner.js";
17
- import { beginAppRouterScrollIntent, consumeAppRouterScrollIntent } from "../shims/app-router-scroll-state.js";
18
- import { __basePath, appRouterInstance, commitClientNavigationState, consumePrefetchResponseForNavigation, createCachedRscResponseSnapshot, createClientNavigationRenderSnapshot, createSnapshotPathAndSearch, decodeRedirectError, getBfcacheIdMapContext, getClientNavigationRenderContext, getPrefetchCache, hasPrefetchCacheEntryForNavigation, invalidatePrefetchCache, isRedirectError, pushHistoryStateWithoutNotify, replaceClientParamsWithoutNotify, replaceHistoryStateWithoutNotify, resolvePrefetchCacheEntryMountedSlotsHeader, restoreRscResponse, saveScrollPosition, setClientParams, setMountedSlotsHeader, setNavigationContext, setPendingPathname, useRouter } from "../shims/navigation.js";
9
+ import { getBfcacheIdMapContext, setNavigationContext } from "../shims/navigation-context-state.js";
10
+ import { decodeRedirectError, isRedirectError } from "../shims/navigation-errors.js";
19
11
  import DefaultGlobalError from "../shims/default-global-error.js";
12
+ import { clearAppNavigationFailureTarget, installAppNavigationFailureListeners } from "../client/app-nav-failure-handler.js";
20
13
  import { DevRecoveryBoundary, GlobalErrorBoundary, RedirectBoundary } from "../shims/error-boundary.js";
14
+ import { beginAppRouterScrollIntent, consumeAppRouterScrollIntent } from "../shims/app-router-scroll-state.js";
21
15
  import { AppRouterScrollCommitProvider } from "../shims/app-router-scroll.js";
22
16
  import { BfcacheStateKeyMapContext, ElementsContext, Slot } from "../shims/slot.js";
17
+ import { VINEXT_RSC_COMPATIBILITY_ID_HEADER, VINEXT_RSC_CONTENT_TYPE, createRscRequestHeaders, createRscRequestUrl, createServerActionRequestUrl, getVinextRscCompatibilityId } from "./app-rsc-cache-busting.js";
18
+ import { getNavigationRuntime, registerNavigationRuntimeBootstrap, registerNavigationRuntimeFunctions } from "../client/navigation-runtime.js";
19
+ import { notifyAppRouterTransitionStart } from "../client/instrumentation-client-state.js";
23
20
  import "../client/instrumentation-client.js";
21
+ import { readHistoryStatePreviousNextUrl } from "./app-history-state.js";
22
+ import { createBfcacheSegmentStateKeyMap, createInitialBfcacheIdMap } from "./app-bfcache-identity.js";
24
23
  import { createDiscardedServerActionRefreshScheduler, createServerActionInitiationSnapshot, createServerActionResultFacts, isServerActionResult, normalizeServerActionThrownValue, parseServerActionRevalidationHeader, readInvalidServerActionResponseError, shouldClearClientNavigationCachesForServerActionResult } from "./app-browser-action-result.js";
25
24
  import { createClientReuseManifestHeaderFromVisibleAppState } from "./app-browser-client-reuse-manifest.js";
25
+ import { resolveManifestNavigationInterceptionContext, resolveMiddlewareRewriteNavigationInterceptionContext } from "./app-browser-interception-context.js";
26
+ import { AppBrowserMpaNavigationScheduler } from "./app-browser-mpa-navigation.js";
27
+ import { navigationPlanner } from "./navigation-planner.js";
28
+ import { __basePath, appRouterInstance, commitClientNavigationState, consumePrefetchResponseForNavigation, createCachedRscResponseSnapshot, createClientNavigationRenderSnapshot, createSnapshotPathAndSearch, getClientNavigationRenderContext, getPrefetchCache, hasPrefetchCacheEntryForNavigation, invalidatePrefetchCache, pushHistoryStateWithoutNotify, replaceClientParamsWithoutNotify, replaceHistoryStateWithoutNotify, resolvePrefetchCacheEntryMountedSlotsHeader, restoreRscResponse, saveScrollPosition, setClientParams, setMountedSlotsHeader, setPendingPathname, useRouter } from "../shims/navigation.js";
26
29
  import { chunksToReadableStream, createProgressiveRscStream, getVinextBrowserGlobal } from "./app-browser-stream.js";
27
- import { FRESH_APP_NAVIGATION_PAYLOAD_ORIGIN, VISITED_CACHE_APP_NAVIGATION_PAYLOAD_ORIGIN, createBfcacheSegmentStateKeyMap, createInitialBfcacheIdMap, isCacheRestorableAppPayloadMetadata, resolveInterceptionContextFromPreviousNextUrl, resolveServerActionRequestState } from "./app-browser-state.js";
30
+ import { FRESH_APP_NAVIGATION_PAYLOAD_ORIGIN, VISITED_CACHE_APP_NAVIGATION_PAYLOAD_ORIGIN, isCacheRestorableAppPayloadMetadata, resolveInterceptionContextFromPreviousNextUrl, resolveServerActionRequestState } from "./app-browser-state.js";
28
31
  import { clearHardNavigationLoopGuard, createAppBrowserNavigationController, createBasePathStrippedPathAndSearch } from "./app-browser-navigation-controller.js";
29
32
  import { applyServerActionResultDecision } from "./app-browser-server-action-navigation.js";
30
33
  import { consumeInitialFormState, createVinextHydrateRootOptions, hydrateRootInTransition } from "./app-browser-hydration.js";
@@ -839,10 +842,14 @@ function bootstrapHydration(rscStream) {
839
842
  startTransition
840
843
  });
841
844
  markInitialAppRouterBootstrapHydrated();
845
+ let activeNavigationAbortController = null;
842
846
  registerNavigationRuntimeFunctions({
843
847
  clearNavigationCaches: clearClientNavigationCaches,
844
848
  commitHashNavigation: (href, historyUpdateMode, scroll) => historyController.commitHashOnlyNavigation(href, historyUpdateMode, scroll),
845
849
  navigate: async function navigateRsc(href, redirectDepth = 0, navigationKind = "navigate", historyUpdateMode, previousNextUrlOverride, programmaticTransition = false, traversalIntent, scrollIntent, visibleCommitMode = "transition") {
850
+ activeNavigationAbortController?.abort();
851
+ const navigationAbortController = new AbortController();
852
+ activeNavigationAbortController = navigationAbortController;
846
853
  let pendingRouterState = null;
847
854
  const navId = browserNavigationController.beginNavigation();
848
855
  discardedServerActionRefreshScheduler.markNavigationStart();
@@ -1019,7 +1026,8 @@ function bootstrapHydration(rscStream) {
1019
1026
  }
1020
1027
  navResponse = await fetch(rscUrl, {
1021
1028
  headers: requestHeaders,
1022
- credentials: "include"
1029
+ credentials: "include",
1030
+ signal: navigationAbortController.signal
1023
1031
  });
1024
1032
  }
1025
1033
  if (!browserNavigationController.isCurrentNavigation(navId)) return;
@@ -1065,6 +1073,7 @@ function bootstrapHydration(rscStream) {
1065
1073
  headers: navResponse.headers
1066
1074
  });
1067
1075
  const cacheBufferPromise = new Response(cacheBranch).arrayBuffer();
1076
+ cacheBufferPromise.catch(() => {});
1068
1077
  if (!browserNavigationController.isCurrentNavigation(navId)) return;
1069
1078
  const rscPayload = decodeAppElementsPromise(createFromFetch(Promise.resolve(reactResponse)));
1070
1079
  if (!browserNavigationController.isCurrentNavigation(navId)) return;
@@ -1091,6 +1100,7 @@ function bootstrapHydration(rscStream) {
1091
1100
  if (!isPageUnloading) console.error("[vinext] RSC navigation error:", error);
1092
1101
  performHardNavigationForScrollIntent(navigationPlanner.classifyRscNavigationError({ currentHref }).url);
1093
1102
  } finally {
1103
+ if (activeNavigationAbortController === navigationAbortController) activeNavigationAbortController = null;
1094
1104
  browserNavigationController.finalizeNavigation(navId, pendingRouterState);
1095
1105
  discardedServerActionRefreshScheduler.markNavigationSettled();
1096
1106
  }
@@ -2,7 +2,7 @@ import { RouteManifest } from "../routing/app-route-graph.js";
2
2
  import { AppRouterScrollIntent } from "../shims/app-router-scroll-state.js";
3
3
  import { NavigationRuntimeVisibleCommitMode } from "../client/navigation-runtime.js";
4
4
  import { AppElements } from "./app-elements-wire.js";
5
- import { OperationLane } from "./navigation-planner.js";
5
+ import { OperationLane } from "./operation-token.js";
6
6
  import { ServerActionRevalidationKind } from "./app-browser-action-result.js";
7
7
  import { ClientNavigationRenderSnapshot, commitClientNavigationState, createSnapshotPathAndSearch } from "../shims/navigation.js";
8
8
  import { AppNavigationPayloadOrigin, AppRouterState } from "./app-browser-state.js";
@@ -1,8 +1,8 @@
1
1
  import { stripBasePath } from "../utils/base-path.js";
2
2
  import { clearAppNavigationFailureTarget, getAppNavigationFailureTarget } from "../client/app-nav-failure-handler.js";
3
3
  import { claimAppRouterScrollIntentForCommit, consumeAppRouterScrollIntent } from "../shims/app-router-scroll-state.js";
4
- import { activateNavigationSnapshot, clearPendingPathname, commitClientNavigationState, createSnapshotPathAndSearch } from "../shims/navigation.js";
5
4
  import { shouldScheduleRefreshForDiscardedServerAction } from "./app-browser-action-result.js";
5
+ import { activateNavigationSnapshot, clearPendingPathname, commitClientNavigationState, createSnapshotPathAndSearch } from "../shims/navigation.js";
6
6
  import { FRESH_APP_NAVIGATION_PAYLOAD_ORIGIN, createPendingNavigationCommit } from "./app-browser-state.js";
7
7
  import { applyApprovedVisibleCommit, approveHmrVisibleCommit, approvePendingNavigationCommit, resolveAndClassifyNavigationCommit } from "./app-browser-visible-commit.js";
8
8
  import { startTransition, useInsertionEffect, useLayoutEffect } from "react";
@@ -2,9 +2,10 @@ import { RouteManifest } from "../routing/app-route-graph.js";
2
2
  import { CacheEntryReuseProof } from "./cache-proof.js";
3
3
  import { AppElements, AppElementsInterception, AppElementsSlotBinding, LayoutFlags } from "./app-elements-wire.js";
4
4
  import { NavigationTrace } from "./navigation-trace.js";
5
- import { OperationLane } from "./navigation-planner.js";
6
- import { ClientNavigationRenderSnapshot } from "../shims/navigation.js";
5
+ import { OperationLane } from "./operation-token.js";
7
6
  import { BfcacheIdMap, HistoryTraversalIntent, createHistoryStateWithNavigationMetadata, createHistoryStateWithPreviousNextUrl, isHistoryStateBfcacheVersionCurrent, readHistoryStateBfcacheIds, readHistoryStateBfcacheVersion, readHistoryStatePreviousNextUrl, readHistoryStateTraversalIndex, resolveHistoryTraversalIntent } from "./app-history-state.js";
7
+ import { createBfcacheSegmentStateKeyMap, createInitialBfcacheIdMap, createNextBfcacheIdMap, preserveBfcacheIdsForMergedElements } from "./app-bfcache-identity.js";
8
+ import { ClientNavigationRenderSnapshot } from "../shims/navigation.js";
8
9
 
9
10
  //#region src/server/app-browser-state.d.ts
10
11
  type OperationRecordBase = {
@@ -70,7 +71,6 @@ type AppNavigationPayloadOrigin = Readonly<{
70
71
  } | {
71
72
  origin: "visited-cache";
72
73
  }>;
73
- type BfcacheStateKeyMap = Readonly<Record<string, string>>;
74
74
  declare const FRESH_APP_NAVIGATION_PAYLOAD_ORIGIN: AppNavigationPayloadOrigin;
75
75
  declare const VISITED_CACHE_APP_NAVIGATION_PAYLOAD_ORIGIN: AppNavigationPayloadOrigin;
76
76
  type PendingNavigationCommitDisposition = "dispatch" | "hard-navigate" | "skip";
@@ -91,25 +91,6 @@ type NonDispatchPendingNavigationCommitDispositionDecision = {
91
91
  trace: NavigationTrace;
92
92
  };
93
93
  type PendingNavigationCommitDispositionDecision = DispatchPendingNavigationCommitDispositionDecision | NonDispatchPendingNavigationCommitDispositionDecision;
94
- declare function createInitialBfcacheIdMap(elements: AppElements): BfcacheIdMap;
95
- declare function createBfcacheSegmentStateKeyMap(options: {
96
- elements: AppElements;
97
- pathname: string;
98
- }): BfcacheStateKeyMap;
99
- declare function createNextBfcacheIdMap(options: {
100
- current: BfcacheIdMap;
101
- currentElements: AppElements;
102
- currentPathname: string;
103
- elements: AppElements;
104
- nextPathname: string;
105
- restored?: BfcacheIdMap | null;
106
- reuseCurrent?: boolean;
107
- }): BfcacheIdMap;
108
- declare function preserveBfcacheIdsForMergedElements(options: {
109
- elements: AppElements;
110
- next: BfcacheIdMap;
111
- previous: BfcacheIdMap;
112
- }): BfcacheIdMap;
113
94
  declare function isCacheRestorableAppPayloadMetadata(metadata: CacheRestorableAppPayloadMetadata): metadata is CacheRestorableAppPayloadMetadata & {
114
95
  cacheEntryReuseProof: CacheEntryReuseProof;
115
96
  };
@@ -1,143 +1,20 @@
1
- import { countConsumedPathnameSegments, isInvisibleSegment, normalizePathnameForRouteMatch, splitPathSegments } from "../routing/utils.js";
1
+ import { normalizePathnameForRouteMatch } from "../routing/utils.js";
2
2
  import { stripBasePath } from "../utils/base-path.js";
3
3
  import { NEXT_ACTION_HEADER, RSC_ACTION_HEADER, VINEXT_INTERCEPTION_CONTEXT_HEADER, VINEXT_MOUNTED_SLOTS_HEADER } from "./headers.js";
4
4
  import { normalizePath } from "./normalize-path.js";
5
5
  import { AppElementsWire } from "./app-elements-wire.js";
6
6
  import { getMountedSlotIds, getMountedSlotIdsHeader } from "./app-elements.js";
7
- import "./app-bfcache-id.js";
8
- import { createHistoryStateWithNavigationMetadata, createHistoryStateWithPreviousNextUrl, isBfcacheSegmentId, isHistoryStateBfcacheVersionCurrent, readHistoryStateBfcacheIds, readHistoryStateBfcacheVersion, readHistoryStatePreviousNextUrl, readHistoryStateTraversalIndex, resolveHistoryTraversalIntent } from "./app-history-state.js";
9
7
  import { createRscRequestHeaders } from "./app-rsc-cache-busting.js";
8
+ import { createCacheEntryReuseProof } from "./cache-proof.js";
9
+ import { createHistoryStateWithNavigationMetadata, createHistoryStateWithPreviousNextUrl, isHistoryStateBfcacheVersionCurrent, readHistoryStateBfcacheIds, readHistoryStateBfcacheVersion, readHistoryStatePreviousNextUrl, readHistoryStateTraversalIndex, resolveHistoryTraversalIntent } from "./app-history-state.js";
10
+ import { createBfcacheSegmentStateKeyMap, createInitialBfcacheIdMap, createNextBfcacheIdMap, preserveBfcacheIdsForMergedElements } from "./app-bfcache-identity.js";
10
11
  import { NavigationTraceReasonCodes, createNavigationLifecycleTraceFields, createNavigationTrace } from "./navigation-trace.js";
12
+ import { verifyOperationTokenForCommit } from "./operation-token.js";
11
13
  import { navigationPlanner, resolveDefaultOrUnmatchedSlotPersistenceForLayouts } from "./navigation-planner.js";
12
14
  import { createSnapshotPathAndSearch } from "../shims/navigation.js";
13
- import { createCacheEntryReuseProof } from "./cache-proof.js";
14
15
  //#region src/server/app-browser-state.ts
15
16
  const FRESH_APP_NAVIGATION_PAYLOAD_ORIGIN = { origin: "fresh" };
16
17
  const VISITED_CACHE_APP_NAVIGATION_PAYLOAD_ORIGIN = { origin: "visited-cache" };
17
- let nextBfcacheId = 0;
18
- function rememberBfcacheId(value) {
19
- const match = /^_b_(\d+)_$/.exec(value);
20
- if (!match) return;
21
- nextBfcacheId = Math.max(nextBfcacheId, Number(match[1]));
22
- }
23
- function mintBfcacheId() {
24
- nextBfcacheId += 1;
25
- return `_b_${nextBfcacheId}_`;
26
- }
27
- function getVisibleTreePathSegments(treePath) {
28
- return splitPathSegments(treePath).filter((segment) => !isInvisibleSegment(segment));
29
- }
30
- function getTreePathIdentityPrefix(pathname, treePath) {
31
- const pathnameSegments = splitPathSegments(pathname);
32
- const consumedPathnameSegments = countConsumedPathnameSegments(getVisibleTreePathSegments(treePath), pathnameSegments.length);
33
- if (consumedPathnameSegments === 0) return "/";
34
- return `/${pathnameSegments.slice(0, consumedPathnameSegments).join("/")}`;
35
- }
36
- function readAppElementsMetadata(elements) {
37
- let metadata;
38
- try {
39
- metadata = AppElementsWire.readMetadata(elements);
40
- } catch {
41
- return null;
42
- }
43
- const slotBindingsBySlotId = /* @__PURE__ */ new Map();
44
- for (const binding of metadata.slotBindings) slotBindingsBySlotId.set(binding.slotId, binding);
45
- return {
46
- metadata,
47
- slotBindingsBySlotId
48
- };
49
- }
50
- function createActiveSlotIdentity(id, parsed) {
51
- const activeSlotBinding = parsed?.slotBindingsBySlotId.get(id);
52
- if (activeSlotBinding?.activeRouteId != null) return `${id}@${activeSlotBinding.activeRouteId}`;
53
- const interception = parsed?.metadata.interception;
54
- if (interception?.slotId !== id) return null;
55
- return `${id}@${interception.targetRouteId}`;
56
- }
57
- /**
58
- * Legacy bridge for deriving a bfcache segment identity from AppElements wire
59
- * keys. Keep wire-key parsing contained here until Vinext has a route-manifest
60
- * semantic authority equivalent to Next.js CacheNode/segment-cache state.
61
- */
62
- function createBfcacheSegmentIdentity(id, options) {
63
- const parsed = AppElementsWire.parseElementKey(id);
64
- if (!parsed) return null;
65
- if (parsed.kind === "page") return `${id}@${options.pathname}`;
66
- if (parsed.kind === "slot") {
67
- const activeSlotIdentity = createActiveSlotIdentity(id, options.metadata);
68
- if (activeSlotIdentity !== null) return activeSlotIdentity;
69
- return `${id}@${getTreePathIdentityPrefix(options.pathname, parsed.treePath)}`;
70
- }
71
- if (parsed.kind === "layout" || parsed.kind === "template") return `${id}@${getTreePathIdentityPrefix(options.pathname, parsed.treePath)}`;
72
- return null;
73
- }
74
- function collectBfcacheSegmentIds(elements, parsed) {
75
- const ids = new Set(Object.keys(elements));
76
- const metadata = parsed === void 0 ? readAppElementsMetadata(elements) : parsed;
77
- for (const layoutId of metadata?.metadata.layoutIds ?? []) ids.add(layoutId);
78
- return Array.from(ids).filter(isBfcacheSegmentId);
79
- }
80
- function createInitialBfcacheIdMap(elements) {
81
- const ids = {};
82
- for (const id of collectBfcacheSegmentIds(elements)) ids[id] = "0";
83
- return ids;
84
- }
85
- function normalizeBfcachePathname(pathname) {
86
- const normalized = normalizePath(normalizePathnameForRouteMatch(pathname));
87
- return normalized.length > 1 ? normalized.replace(/\/$/, "") : normalized;
88
- }
89
- function createBfcacheSegmentStateKeyMap(options) {
90
- const metadata = readAppElementsMetadata(options.elements);
91
- const normalizedPathname = normalizeBfcachePathname(options.pathname);
92
- const stateKeys = {};
93
- for (const id of collectBfcacheSegmentIds(options.elements, metadata)) {
94
- const stateKey = createBfcacheSegmentIdentity(id, {
95
- metadata,
96
- pathname: normalizedPathname
97
- });
98
- if (stateKey !== null) stateKeys[id] = stateKey;
99
- }
100
- return stateKeys;
101
- }
102
- function createNextBfcacheIdMap(options) {
103
- const current = options.reuseCurrent === false ? {} : options.current;
104
- for (const value of Object.values(current)) rememberBfcacheId(value);
105
- for (const value of Object.values(options.restored ?? {})) rememberBfcacheId(value);
106
- const currentMetadata = readAppElementsMetadata(options.currentElements);
107
- const nextMetadata = readAppElementsMetadata(options.elements);
108
- const currentPathname = normalizeBfcachePathname(options.currentPathname);
109
- const nextPathname = normalizeBfcachePathname(options.nextPathname);
110
- const ids = {};
111
- for (const id of collectBfcacheSegmentIds(options.elements, nextMetadata)) {
112
- const currentValue = createBfcacheSegmentIdentity(id, {
113
- metadata: currentMetadata,
114
- pathname: currentPathname
115
- }) === createBfcacheSegmentIdentity(id, {
116
- metadata: nextMetadata,
117
- pathname: nextPathname
118
- }) ? current[id] : void 0;
119
- const value = options.restored?.[id] ?? currentValue ?? mintBfcacheId();
120
- ids[id] = value;
121
- rememberBfcacheId(value);
122
- }
123
- return ids;
124
- }
125
- function preserveBfcacheIdsForMergedElements(options) {
126
- const ids = {};
127
- for (const id of collectBfcacheSegmentIds(options.elements)) {
128
- const nextValue = options.next[id];
129
- if (nextValue !== void 0) {
130
- ids[id] = nextValue;
131
- continue;
132
- }
133
- const previousValue = options.previous[id];
134
- if (previousValue !== void 0) {
135
- ids[id] = previousValue;
136
- rememberBfcacheId(previousValue);
137
- }
138
- }
139
- return ids;
140
- }
141
18
  function createOperationRecord(options) {
142
19
  return {
143
20
  id: options.id,
@@ -192,7 +69,17 @@ function resolveServerActionRequestState(options) {
192
69
  }
193
70
  function resolvePendingNavigationCommitDispositionDecision(options) {
194
71
  const traceFields = createPendingNavigationTraceFields(options);
195
- if (options.startedNavigationId !== options.activeNavigationId || options.pending.action.operation.startedVisibleCommitVersion !== options.currentState.visibleCommitVersion) return {
72
+ const targetSnapshot = createPendingRouteSnapshot(options.pending);
73
+ const verdict = verifyOperationTokenForCommit(createPendingNavigationOperationToken({
74
+ pending: options.pending,
75
+ routeManifest: options.routeManifest ?? null,
76
+ startedNavigationId: options.startedNavigationId,
77
+ targetSnapshot
78
+ }), {
79
+ activeNavigationId: options.activeNavigationId,
80
+ visibleCommitVersion: options.currentState.visibleCommitVersion
81
+ });
82
+ if (!verdict.authorized) return {
196
83
  disposition: "skip",
197
84
  preserveElementIds: [],
198
85
  trace: createNavigationTrace(NavigationTraceReasonCodes.staleOperation, traceFields)
@@ -202,6 +89,8 @@ function resolvePendingNavigationCommitDispositionDecision(options) {
202
89
  pending: options.pending,
203
90
  routeManifest: options.routeManifest ?? null,
204
91
  targetHref: options.targetHref,
92
+ targetSnapshot,
93
+ token: verdict.token,
205
94
  traceFields
206
95
  }));
207
96
  return mergeSkippedLayoutPreservation({
@@ -277,6 +166,7 @@ function createPendingNavigationOperationToken(options) {
277
166
  deploymentVersion: null,
278
167
  graphVersion: options.routeManifest?.graphVersion ?? null,
279
168
  lane: options.pending.action.operation.lane,
169
+ navigationId: options.startedNavigationId,
280
170
  operationId: options.pending.action.operation.id,
281
171
  targetSnapshotFingerprint: createRootBoundarySnapshotFingerprint(options.targetSnapshot)
282
172
  };
@@ -285,17 +175,11 @@ function createRootBoundarySnapshotFingerprint(snapshot) {
285
175
  return `${snapshot.routeId}|root:${snapshot.rootBoundaryId ?? "unknown"}`;
286
176
  }
287
177
  function planPendingRootBoundaryFlightResponse(options) {
288
- const targetSnapshot = createPendingRouteSnapshot(options.pending);
289
- const token = createPendingNavigationOperationToken({
290
- pending: options.pending,
291
- routeManifest: options.routeManifest,
292
- targetSnapshot
293
- });
294
178
  const cacheEntryReuseProof = options.pending.cacheEntryReuseProof;
295
179
  return navigationPlanner.plan({
296
180
  routeManifest: options.routeManifest,
297
181
  state: {
298
- nextOperationToken: token,
182
+ nextOperationToken: options.token,
299
183
  traceFields: options.traceFields,
300
184
  visibleCommitVersion: options.currentState.visibleCommitVersion,
301
185
  visibleSnapshot: createVisibleRouteSnapshot(options.currentState)
@@ -304,10 +188,10 @@ function planPendingRootBoundaryFlightResponse(options) {
304
188
  kind: "flightResponseArrived",
305
189
  result: {
306
190
  ...cacheEntryReuseProof ? { cacheEntryReuseProof } : {},
307
- href: options.targetHref ?? targetSnapshot.displayUrl,
308
- targetSnapshot
191
+ href: options.targetHref ?? options.targetSnapshot.displayUrl,
192
+ targetSnapshot: options.targetSnapshot
309
193
  },
310
- token
194
+ token: options.token
311
195
  }
312
196
  });
313
197
  }
@@ -1,5 +1,5 @@
1
- import { ensureNavigationRuntimeRscBootstrap, getNavigationRuntime } from "../client/navigation-runtime.js";
2
1
  import { decodeRscEmbeddedChunk } from "./app-rsc-embedded-chunks.js";
2
+ import { ensureNavigationRuntimeRscBootstrap, getNavigationRuntime } from "../client/navigation-runtime.js";
3
3
  //#region src/server/app-browser-stream.ts
4
4
  function getVinextBrowserGlobal() {
5
5
  return globalThis;
@@ -1,7 +1,7 @@
1
1
  import { RouteManifest } from "../routing/app-route-graph.js";
2
2
  import { AppElements } from "./app-elements-wire.js";
3
3
  import { NavigationTrace } from "./navigation-trace.js";
4
- import { OperationLane } from "./navigation-planner.js";
4
+ import { OperationLane } from "./operation-token.js";
5
5
  import { ClientNavigationRenderSnapshot } from "../shims/navigation.js";
6
6
  import { AppNavigationPayloadOrigin, AppRouterAction, AppRouterState, PendingNavigationCommit } from "./app-browser-state.js";
7
7
 
@@ -1,8 +1,9 @@
1
1
  import { normalizeAppElementsSlotBindings } from "./app-elements-wire.js";
2
2
  import "./app-elements.js";
3
- import { NavigationTraceReasonCodes, NavigationTraceTransactionCodes, createNavigationTrace, prependNavigationTraceEntry } from "./navigation-trace.js";
4
3
  import { mergeElements } from "../shims/slot.js";
5
- import { createPendingNavigationCommit, preserveBfcacheIdsForMergedElements, resolvePendingNavigationCommitDispositionDecision } from "./app-browser-state.js";
4
+ import { preserveBfcacheIdsForMergedElements } from "./app-bfcache-identity.js";
5
+ import { NavigationTraceReasonCodes, NavigationTraceTransactionCodes, createNavigationTrace, prependNavigationTraceEntry } from "./navigation-trace.js";
6
+ import { createPendingNavigationCommit, resolvePendingNavigationCommitDispositionDecision } from "./app-browser-state.js";
6
7
  //#region src/server/app-browser-visible-commit.ts
7
8
  const approvedVisibleCommitBrand = Symbol("ApprovedVisibleCommit");
8
9
  function applyApprovedVisibleCommit(state, commit) {
@@ -1,6 +1,6 @@
1
1
  import { MetadataFileRoute } from "./metadata-routes.js";
2
2
  import { AppElements } from "./app-elements-wire.js";
3
- import { NavigationContext } from "../shims/navigation.js";
3
+ import { NavigationContext } from "../shims/navigation-context-state.js";
4
4
  import { AppPageParams } from "./app-page-boundary.js";
5
5
  import { AppPageFontPreload } from "./app-page-execution.js";
6
6
  import { AppPageMiddlewareContext } from "./app-page-response.js";
@@ -1,5 +1,5 @@
1
+ import { UnstableCacheObservation } from "../shims/cache-request-state.js";
1
2
  import { RenderRequestApiKind } from "./cache-proof.js";
2
- import { UnstableCacheObservation } from "../shims/cache.js";
3
3
  import { ClientReuseManifestRejectionCode, ClientReuseManifestTraceFields } from "./client-reuse-manifest.js";
4
4
  import { ThenableParamsObserver } from "../shims/thenable-params.js";
5
5
 
@@ -1,6 +1,6 @@
1
1
  import { isInsideUnifiedScope, runWithUnifiedStateMutation } from "../shims/unified-request-context.js";
2
2
  import { peekDynamicUsage, peekRenderRequestApiUsage } from "../shims/headers.js";
3
- import { _peekRequestScopedCacheLife, _peekUnstableCacheObservations } from "../shims/cache.js";
3
+ import { _peekRequestScopedCacheLife, _peekUnstableCacheObservations } from "../shims/cache-request-state.js";
4
4
  import { getCollectedFetchTags, peekCacheableFetchObservations, peekDynamicFetchObservations } from "../shims/fetch-cache.js";
5
5
  import { isPromiseLike } from "../utils/promise.js";
6
6
  //#region src/server/app-layout-param-observation.ts
@@ -5,8 +5,9 @@ import { internalServerErrorResponse } from "./http-error-responses.js";
5
5
  import { cloneRequestWithHeaders, processMiddlewareHeaders } from "./request-pipeline.js";
6
6
  import { executeMiddleware } from "./middleware-runtime.js";
7
7
  import { applyMiddlewareRequestHeaders, setHeadersContext } from "../shims/headers.js";
8
- import { setNavigationContext } from "../shims/navigation.js";
8
+ import { setNavigationContext } from "../shims/navigation-context-state.js";
9
9
  import { mergeMiddlewareResponseHeaders } from "./middleware-response-headers.js";
10
+ import "../shims/navigation.js";
10
11
  //#region src/server/app-middleware.ts
11
12
  const FLIGHT_HEADER_SET = new Set(FLIGHT_HEADERS);
12
13
  function isForwardedMiddlewareContext(value) {
@@ -1,6 +1,6 @@
1
1
  import { MetadataFileRoute } from "./metadata-routes.js";
2
2
  import { AppElements } from "./app-elements-wire.js";
3
- import { NavigationContext } from "../shims/navigation.js";
3
+ import { NavigationContext } from "../shims/navigation-context-state.js";
4
4
  import { AppPageParams } from "./app-page-boundary.js";
5
5
  import { AppPageFontPreload } from "./app-page-execution.js";
6
6
  import { AppPageMiddlewareContext } from "./app-page-response.js";
@@ -1,6 +1,6 @@
1
1
  import { runWithFetchDedupe } from "../shims/fetch-cache.js";
2
- import { VINEXT_RSC_CONTENT_TYPE, VINEXT_RSC_VARY_HEADER, applyRscCompatibilityIdHeader } from "./app-rsc-cache-busting.js";
3
2
  import { resolveAppPageSegmentParams } from "./app-page-params.js";
3
+ import { VINEXT_RSC_CONTENT_TYPE, VINEXT_RSC_VARY_HEADER, applyRscCompatibilityIdHeader } from "./app-rsc-cache-busting.js";
4
4
  import { mergeMiddlewareResponseHeaders } from "./middleware-response-headers.js";
5
5
  import { applyEdgeRuntimeHeader } from "./app-page-response.js";
6
6
  //#region src/server/app-page-boundary.ts