@rebask/core 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/components/image.d.ts +16 -3
  2. package/dist/components/image.d.ts.map +1 -1
  3. package/dist/components/image.js +50 -68
  4. package/dist/components/link.d.ts.map +1 -1
  5. package/dist/components/link.js +6 -2
  6. package/dist/lib/image-optimization/fetch-remote-image.d.ts +17 -0
  7. package/dist/lib/image-optimization/fetch-remote-image.d.ts.map +1 -0
  8. package/dist/lib/image-optimization/fetch-remote-image.js +157 -0
  9. package/dist/lib/image-optimization/get-img-props.d.ts +3 -5
  10. package/dist/lib/image-optimization/get-img-props.d.ts.map +1 -1
  11. package/dist/lib/image-optimization/get-img-props.js +66 -40
  12. package/dist/lib/image-optimization/handler.d.ts +0 -3
  13. package/dist/lib/image-optimization/handler.d.ts.map +1 -1
  14. package/dist/lib/image-optimization/handler.js +339 -124
  15. package/dist/lib/image-optimization/image-config.d.ts +31 -4
  16. package/dist/lib/image-optimization/image-config.d.ts.map +1 -1
  17. package/dist/lib/image-optimization/image-config.js +6 -0
  18. package/dist/lib/image-optimization/image-error.d.ts +8 -0
  19. package/dist/lib/image-optimization/image-error.d.ts.map +1 -0
  20. package/dist/lib/image-optimization/image-error.js +10 -0
  21. package/dist/lib/image-optimization/image-plugin.d.ts.map +1 -1
  22. package/dist/lib/image-optimization/image-plugin.js +27 -14
  23. package/dist/lib/image-optimization/is-private-ip.d.ts +2 -0
  24. package/dist/lib/image-optimization/is-private-ip.d.ts.map +1 -0
  25. package/dist/lib/image-optimization/is-private-ip.js +43 -0
  26. package/dist/lib/image-optimization/match-patterns.d.ts +4 -0
  27. package/dist/lib/image-optimization/match-patterns.d.ts.map +1 -0
  28. package/dist/lib/image-optimization/match-patterns.js +39 -0
  29. package/dist/lib/image-optimization/read-body.d.ts +2 -0
  30. package/dist/lib/image-optimization/read-body.d.ts.map +1 -0
  31. package/dist/lib/image-optimization/read-body.js +27 -0
  32. package/dist/lib/image-optimization/static-image-loader.d.ts +2 -0
  33. package/dist/lib/image-optimization/static-image-loader.d.ts.map +1 -0
  34. package/dist/lib/image-optimization/static-image-loader.js +60 -0
  35. package/dist/lib/server-router/build-entries.d.ts.map +1 -1
  36. package/dist/lib/server-router/route-entries.js +1 -1
  37. package/dist/vite.d.ts.map +1 -1
  38. package/dist/vite.js +12 -4
  39. package/package.json +2 -1
  40. package/dist/__type_probe__.d.ts +0 -2
  41. package/dist/__type_probe__.d.ts.map +0 -1
  42. package/dist/__type_probe__.js +0 -4
  43. package/dist/components/error-boundary-client.d.ts +0 -49
  44. package/dist/components/error-boundary-client.d.ts.map +0 -1
  45. package/dist/components/error-boundary-client.js +0 -71
  46. package/dist/components/error-boundary.browser.d.ts +0 -8
  47. package/dist/components/error-boundary.browser.d.ts.map +0 -1
  48. package/dist/components/error-boundary.browser.js +0 -6
  49. package/dist/components/error.d.ts +0 -2
  50. package/dist/components/error.d.ts.map +0 -1
  51. package/dist/components/error.js +0 -5
  52. package/dist/components/not-found-activator.d.ts +0 -11
  53. package/dist/components/not-found-activator.d.ts.map +0 -1
  54. package/dist/components/not-found-activator.js +0 -26
  55. package/dist/components/not-found-boundary-client.d.ts +0 -3
  56. package/dist/components/not-found-boundary-client.d.ts.map +0 -1
  57. package/dist/components/not-found-boundary-client.js +0 -20
  58. package/dist/components/not-found-boundary.browser.d.ts +0 -8
  59. package/dist/components/not-found-boundary.browser.d.ts.map +0 -1
  60. package/dist/components/not-found-boundary.browser.js +0 -4
  61. package/dist/components/not-found-boundary.d.ts +0 -8
  62. package/dist/components/not-found-boundary.d.ts.map +0 -1
  63. package/dist/components/not-found-boundary.js +0 -9
  64. package/dist/components/not-found-thrower.d.ts +0 -2
  65. package/dist/components/not-found-thrower.d.ts.map +0 -1
  66. package/dist/components/not-found-thrower.js +0 -7
  67. package/dist/components/not-found.d.ts +0 -2
  68. package/dist/components/not-found.d.ts.map +0 -1
  69. package/dist/components/not-found.js +0 -5
  70. package/dist/components/status-page.d.ts +0 -6
  71. package/dist/components/status-page.d.ts.map +0 -1
  72. package/dist/components/status-page.js +0 -61
  73. package/dist/handler.d.ts +0 -12
  74. package/dist/handler.d.ts.map +0 -1
  75. package/dist/handler.js +0 -21
  76. package/dist/handlers/rsc/constants.d.ts +0 -3
  77. package/dist/handlers/rsc/constants.d.ts.map +0 -1
  78. package/dist/handlers/rsc/constants.js +0 -2
  79. package/dist/handlers/rsc/create-response.d.ts +0 -3
  80. package/dist/handlers/rsc/create-response.d.ts.map +0 -1
  81. package/dist/handlers/rsc/create-response.js +0 -378
  82. package/dist/handlers/rsc/render-with-retries.d.ts +0 -4
  83. package/dist/handlers/rsc/render-with-retries.d.ts.map +0 -1
  84. package/dist/handlers/rsc/render-with-retries.js +0 -154
  85. package/dist/handlers/rsc/retry-loop.d.ts +0 -3
  86. package/dist/handlers/rsc/retry-loop.d.ts.map +0 -1
  87. package/dist/handlers/rsc/retry-loop.js +0 -145
  88. package/dist/handlers/rsc/stream-rsc-payload.d.ts +0 -9
  89. package/dist/handlers/rsc/stream-rsc-payload.d.ts.map +0 -1
  90. package/dist/handlers/rsc/stream-rsc-payload.js +0 -20
  91. package/dist/handlers/rsc/types.d.ts +0 -26
  92. package/dist/handlers/rsc/types.d.ts.map +0 -1
  93. package/dist/handlers/rsc/types.js +0 -7
  94. package/dist/handlers/rsc.d.ts +0 -20
  95. package/dist/handlers/rsc.d.ts.map +0 -1
  96. package/dist/handlers/rsc.js +0 -872
  97. package/dist/integration.d.ts +0 -14
  98. package/dist/integration.d.ts.map +0 -1
  99. package/dist/integration.js +0 -9
  100. package/dist/lib/dev-module-load-race.d.ts +0 -8
  101. package/dist/lib/dev-module-load-race.d.ts.map +0 -1
  102. package/dist/lib/dev-module-load-race.js +0 -31
  103. package/dist/lib/dev-page-exports.d.ts +0 -5
  104. package/dist/lib/dev-page-exports.d.ts.map +0 -1
  105. package/dist/lib/dev-page-exports.js +0 -14
  106. package/dist/lib/environment-names.d.ts +0 -11
  107. package/dist/lib/environment-names.d.ts.map +0 -1
  108. package/dist/lib/environment-names.js +0 -10
  109. package/dist/lib/initial-hash-scroll.d.ts.map +0 -1
  110. package/dist/lib/not-found.d.ts +0 -5
  111. package/dist/lib/not-found.d.ts.map +0 -1
  112. package/dist/lib/not-found.js +0 -7
  113. package/dist/lib/page-exports.d.ts +0 -9
  114. package/dist/lib/page-exports.d.ts.map +0 -1
  115. package/dist/lib/page-exports.js +0 -47
  116. package/dist/lib/pattern-segments.d.ts +0 -8
  117. package/dist/lib/pattern-segments.d.ts.map +0 -1
  118. package/dist/lib/pattern-segments.js +0 -22
  119. package/dist/lib/ppr/cache-status.d.ts +0 -3
  120. package/dist/lib/ppr/cache-status.d.ts.map +0 -1
  121. package/dist/lib/ppr/cache-status.js +0 -5
  122. package/dist/lib/server-router-contract.d.ts +0 -42
  123. package/dist/lib/server-router-contract.d.ts.map +0 -1
  124. package/dist/lib/server-router-contract.js +0 -6
  125. package/dist/lib/server-router-loader.d.ts +0 -10
  126. package/dist/lib/server-router-loader.d.ts.map +0 -1
  127. package/dist/lib/server-router-loader.js +0 -180
  128. package/dist/lib/server-router.d.ts +0 -8
  129. package/dist/lib/server-router.d.ts.map +0 -1
  130. package/dist/lib/server-router.js +0 -173
  131. package/dist/plugins/ppr-upgrade.d.ts +0 -36
  132. package/dist/plugins/ppr-upgrade.d.ts.map +0 -1
  133. package/dist/plugins/ppr-upgrade.js +0 -32
  134. package/dist/plugins/server-router-fallback.d.ts +0 -15
  135. package/dist/plugins/server-router-fallback.d.ts.map +0 -1
  136. package/dist/plugins/server-router-fallback.js +0 -30
  137. package/dist/server.d.ts +0 -10
  138. package/dist/server.d.ts.map +0 -1
  139. package/dist/server.js +0 -57
@@ -1,154 +0,0 @@
1
- import { proxyPatterns } from "virtual:rebask/proxy-router";
2
- import { ResumeMode } from "../../lib/ppr/types.js";
3
- import { prerenderPaths } from "../../lib/prerender-paths.js";
4
- import {} from "../../lib/render-context.js";
5
- import { renderPageSegment, renderRouteSegments } from "../../lib/route-renderer.js";
6
- import { discardRscCacheWrite, renderRsc, runRscRequest } from "../../lib/rsc-request.js";
7
- import { ActionErrorCode } from "../../lib/types.js";
8
- import { getBoundaryError, markNotFound, markNotFoundThrown, OutgoingResponseHeaders, setBoundaryError, } from "../../request-context.js";
9
- import { CacheLookupKind } from "./cache-lookup.js";
10
- import { FallbackRouteError, onNotFound, RetryWithBoundaryError, RetryWithNotFoundBoundaryError, } from "./errors.js";
11
- import { handlePageRoute } from "./index.js";
12
- import { renderToResponse } from "./render-to-response.js";
13
- export async function renderWithRetries(state, cacheContext) {
14
- const { returnValue, formState, temporaryReferences, actionError, actionThrownError } = state.postBody;
15
- const match = { route: state.route, params: state.params };
16
- const shouldRenderRscSegment = state.isRscRequest && !state.isActionRscRequest;
17
- // We're in PPR mode if we should prerender, this is not a resume request, we don't have a
18
- // cached HTML entry already, and the route hasn't been flagged as having no shell
19
- // (except at build time).
20
- const isPpr = state.shouldPrerender &&
21
- !state.isResumeRequest &&
22
- cacheContext.kind !== CacheLookupKind.PprHit &&
23
- (!state.isNoShellRoute || state.isBuildPrerender);
24
- // Resuming a cached shell serves HTML that was rendered earlier, so this render must not
25
- // regenerate the cached data that HTML already contains.
26
- const isGeneratingCacheEntry = state.isStaticGen && cacheContext.kind !== CacheLookupKind.PprHit;
27
- let attempt = {};
28
- let response;
29
- while (true) {
30
- const abortOnDynamic = isPpr && attempt.activeErrorIndex === undefined;
31
- const renderContext = {
32
- errorBoundary: {
33
- activeIndex: attempt.activeErrorIndex,
34
- },
35
- notFoundBoundary: {
36
- activeIndex: attempt.activeNotFoundIndex,
37
- },
38
- ...(isPpr && {
39
- ppr: {
40
- controller: new AbortController(),
41
- abortOnDynamic,
42
- // This render fills a cache rather than streaming to a user, so it waits for a hanging
43
- // dynamic read instead of aborting as soon as the shell is ready.
44
- isCachePrerender: state.isBuildPrerender || state.isPrerenderUpgrade,
45
- resolvedParams: state.resolvedParams,
46
- paramNames: state.fullParamsSet,
47
- pendingShellWork: new Set(),
48
- usedUnresolvedParams: new Set(),
49
- },
50
- }),
51
- };
52
- try {
53
- response = await runRscRequest({
54
- input: {
55
- request: state.request,
56
- params: match.params,
57
- isStaticGeneration: isGeneratingCacheEntry,
58
- resumeData: state.resumeState?.type === ResumeMode.HTML
59
- ? state.resumeState.resumeData
60
- : undefined,
61
- },
62
- response: { headers: new OutgoingResponseHeaders() },
63
- }, renderContext, async () => {
64
- if (attempt.boundaryError)
65
- setBoundaryError(attempt.boundaryError);
66
- if (attempt.notFound)
67
- markNotFound();
68
- if (!state.isBuildPrerender &&
69
- state.isDynamicRoute &&
70
- state.isPageRoute &&
71
- (await prerenderPaths.isStaticPathMiss(state.route.filePath, state.url.pathname))) {
72
- markNotFoundThrown();
73
- }
74
- // No-JS native forms cannot consume RSC streams, so they recurse to render the full HTML
75
- // page. We bridge the action's 404 state here to ensure the subsequent page render knows
76
- // to activate the not-found boundaries.
77
- if (actionError === ActionErrorCode.NotFound && !state.isRscRequest) {
78
- markNotFound();
79
- }
80
- // Build seedData inside the request scope so `renderPage` can read `isNotFound()`.
81
- // For non-PPR routes this only needs to run once, but rebuilding is cheap because
82
- // module loaders are cached.
83
- state.seedData = shouldRenderRscSegment
84
- ? await renderPageSegment(match, attempt.boundaryError)
85
- : state.isRscRequest
86
- ? undefined
87
- : await renderRouteSegments(match, state.routeTree,
88
- // Native no-JS form submissions execute the action before the main render starts.
89
- // Re-inject unexpected action errors to activate the nearest error boundary
90
- !attempt.boundaryError ? actionThrownError : undefined);
91
- const boundaryError = getBoundaryError();
92
- let payload;
93
- if (state.isActionRscRequest) {
94
- if (returnValue !== undefined) {
95
- payload = { returnValue };
96
- }
97
- else if (formState !== undefined) {
98
- payload = { formState };
99
- }
100
- else if (actionError !== undefined) {
101
- payload = { actionError };
102
- }
103
- else {
104
- throw new Error("Expected an action result, form state, or action error for action RSC response.");
105
- }
106
- }
107
- else {
108
- if (!state.seedData) {
109
- throw new Error("Expected route seed data for route RSC response.");
110
- }
111
- payload = {
112
- seedData: state.seedData,
113
- routeTree: state.routeTree,
114
- ...(state.routePrediction && { routePrediction: state.routePrediction }),
115
- ...(proxyPatterns && { proxyPatterns }),
116
- ...(formState !== undefined && { formState }),
117
- ...(boundaryError && { error: boundaryError }),
118
- };
119
- }
120
- const pprSignal = renderContext.ppr?.controller.signal;
121
- // Renders that only fill a cache skip the resume phase, so pass them the PPR abort
122
- // signal to stop the RSC stream hanging on data that will never arrive. A render that
123
- // serves a user must not get it, because its RSC stream feeds the resume.
124
- const rscOptions = state.isBuildPrerender || state.isPrerenderUpgrade
125
- ? { temporaryReferences, ...(pprSignal && { signal: pprSignal }) }
126
- : { temporaryReferences };
127
- const stream = state.isActionRscRequest
128
- ? renderRsc(payload, rscOptions)
129
- : renderRsc(payload, rscOptions, onNotFound);
130
- return await renderToResponse(state, cacheContext, stream);
131
- });
132
- break;
133
- }
134
- catch (error) {
135
- if (error instanceof RetryWithBoundaryError) {
136
- attempt.activeErrorIndex = error.boundaryIndex;
137
- attempt.boundaryError = error.originalError;
138
- continue;
139
- }
140
- if (error instanceof RetryWithNotFoundBoundaryError) {
141
- attempt.activeNotFoundIndex = error.boundaryIndex;
142
- attempt.notFound = true;
143
- continue;
144
- }
145
- if (state.rscCacheWrite)
146
- discardRscCacheWrite(state.rscCacheWrite);
147
- if (error instanceof FallbackRouteError) {
148
- return handlePageRoute(state.request, error.fallbackRoute, state.params, state.handleOptions);
149
- }
150
- throw error;
151
- }
152
- }
153
- return response;
154
- }
@@ -1,3 +0,0 @@
1
- import type { CacheLookupOutcome, RenderRequestState } from "./types.js";
2
- export declare function renderWithRetries(state: RenderRequestState, cacheContext: CacheLookupOutcome): Promise<Response>;
3
- //# sourceMappingURL=retry-loop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"retry-loop.d.ts","sourceRoot":"","sources":["../../../src/handlers/rsc/retry-loop.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAgB,MAAM,YAAY,CAAA;AAEtF,wBAAsB,iBAAiB,CACtC,KAAK,EAAE,kBAAkB,EACzB,YAAY,EAAE,kBAAkB,GAC9B,OAAO,CAAC,QAAQ,CAAC,CAyJnB"}
@@ -1,145 +0,0 @@
1
- import { proxyPatterns } from "virtual:rebask/proxy-router";
2
- import { prerenderPaths } from "../../lib/prerender-paths.js";
3
- import {} from "../../lib/render-context.js";
4
- import { renderPageSegment, renderRouteSegments } from "../../lib/route-renderer.js";
5
- import { renderRsc, runRscRequest } from "../../lib/rsc-request.js";
6
- import { ActionErrorCode } from "../../lib/types.js";
7
- import { getBoundaryError, markNotFound, markNotFoundThrown, OutgoingResponseHeaders, setBoundaryError, } from "../../request-context.js";
8
- import { createResponse } from "./create-response.js";
9
- import { FallbackRouteError, onNotFound, RetryWithBoundaryError, RetryWithNotFoundBoundaryError, } from "./errors.js";
10
- import { handlePageRoute } from "./index.js";
11
- import { CacheLookupKind } from "./types.js";
12
- export async function renderWithRetries(state, cacheContext) {
13
- const { returnValue, formState, temporaryReferences, actionError, actionThrownError } = state.postBody;
14
- const match = { route: state.route, params: state.params };
15
- const shouldRenderRscSegment = state.isRscRequest && !state.isActionRscRequest;
16
- // We're in PPR mode if we should prerender, this is not a resume request, we don't have a
17
- // cached HTML entry already, and the route hasn't been flagged as having no shell
18
- // (except at build time).
19
- const isPpr = state.shouldPrerender &&
20
- !state.isResumeRequest &&
21
- cacheContext.kind !== CacheLookupKind.PprHit &&
22
- (!state.isNoShellRoute || state.isBuildPrerender);
23
- // In upgrade mode, we still want the PPR render path (so cacheLife/postponed handling stays
24
- // consistent) but we must NOT abort on dynamic access, as the goal is a fully-resolved render.
25
- const shouldAbortOnDynamic = isPpr && !state.isPrerenderUpgrade;
26
- let attempt = {};
27
- let response;
28
- while (true) {
29
- const abortOnDynamic = shouldAbortOnDynamic && attempt.activeErrorIndex === undefined;
30
- const renderContext = {
31
- errorBoundary: {
32
- isErrorPage: state.isErrorRoute,
33
- activeIndex: attempt.activeErrorIndex,
34
- },
35
- notFoundBoundary: {
36
- activeIndex: attempt.activeNotFoundIndex,
37
- pathnameMode: state.route.type === "not-found" ? "client" : "request",
38
- },
39
- ...(isPpr && {
40
- ppr: {
41
- controller: new AbortController(),
42
- abortOnDynamic,
43
- resolvedParams: state.resolvedParams,
44
- },
45
- }),
46
- };
47
- try {
48
- response = await runRscRequest({
49
- input: {
50
- request: state.request,
51
- params: match.params,
52
- isStaticGeneration: state.isStaticGen,
53
- },
54
- response: { headers: new OutgoingResponseHeaders() },
55
- }, renderContext, async () => {
56
- if (attempt.boundaryError)
57
- setBoundaryError(attempt.boundaryError);
58
- if (attempt.notFound)
59
- markNotFound();
60
- if (!state.isBuildPrerender &&
61
- state.isDynamicRoute &&
62
- state.isPageRoute &&
63
- (await prerenderPaths.isStaticPathMiss(state.route.filePath, state.url.pathname))) {
64
- markNotFoundThrown();
65
- }
66
- // No-JS native forms cannot consume RSC streams, so they recurse to render the full HTML
67
- // page. We bridge the action's 404 state here to ensure the subsequent page render knows
68
- // to activate the not-found boundaries.
69
- if (actionError === ActionErrorCode.NotFound && !state.isRscRequest) {
70
- markNotFound();
71
- }
72
- // Build seedData inside the request scope so `renderPage` can read `isNotFound()`.
73
- // For non-PPR routes this only needs to run once, but rebuilding is cheap because
74
- // module loaders are cached.
75
- state.seedData = shouldRenderRscSegment
76
- ? await renderPageSegment(match, attempt.boundaryError)
77
- : state.isRscRequest
78
- ? undefined
79
- : await renderRouteSegments(match, state.routeTree,
80
- // Native no-JS form submissions execute the action before the main render starts.
81
- // Re-inject unexpected action errors to activate the nearest error boundary
82
- !attempt.boundaryError ? actionThrownError : undefined);
83
- const boundaryError = getBoundaryError();
84
- let payload;
85
- if (state.isActionRscRequest) {
86
- if (returnValue !== undefined) {
87
- payload = { returnValue };
88
- }
89
- else if (formState !== undefined) {
90
- payload = { formState };
91
- }
92
- else if (actionError !== undefined) {
93
- payload = { actionError };
94
- }
95
- else {
96
- throw new Error("Expected an action result, form state, or action error for action RSC response.");
97
- }
98
- }
99
- else {
100
- if (!state.seedData) {
101
- throw new Error("Expected route seed data for route RSC response.");
102
- }
103
- payload = {
104
- seedData: state.seedData,
105
- routeTree: state.routeTree,
106
- ...(state.routePrediction && { routePrediction: state.routePrediction }),
107
- ...(proxyPatterns && { proxyPatterns }),
108
- ...(formState !== undefined && { formState }),
109
- ...(boundaryError && { error: boundaryError }),
110
- };
111
- }
112
- const pprSignal = renderContext.ppr?.controller.signal;
113
- // During build-time prerendering, pass the PPR abort signal to the RSC stream so it gets
114
- // aborted once the shell is captured. The resume phase is skipped at build time, so
115
- // without this the RSC stream would hang on unresolved dynamic data. At runtime the
116
- // RSC stream must continue to feed the resume phase.
117
- const rscOptions = state.isBuildPrerender
118
- ? { temporaryReferences, ...(pprSignal && { signal: pprSignal }) }
119
- : { temporaryReferences };
120
- const stream = state.isActionRscRequest
121
- ? renderRsc(payload, rscOptions)
122
- : renderRsc(payload, rscOptions, onNotFound);
123
- return await createResponse(state, cacheContext, stream);
124
- });
125
- break;
126
- }
127
- catch (error) {
128
- if (error instanceof RetryWithBoundaryError) {
129
- attempt.activeErrorIndex = error.boundaryIndex;
130
- attempt.boundaryError = error.originalError;
131
- continue;
132
- }
133
- if (error instanceof RetryWithNotFoundBoundaryError) {
134
- attempt.activeNotFoundIndex = error.boundaryIndex;
135
- attempt.notFound = true;
136
- continue;
137
- }
138
- if (error instanceof FallbackRouteError) {
139
- return handlePageRoute(state.request, error.fallbackRoute, state.params, state.handleOptions);
140
- }
141
- throw error;
142
- }
143
- }
144
- return response;
145
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Stream RSC payload for ResumeMode.RSC.
3
- *
4
- * The client already has the full HTML shell, so we bypass React's HTML renderer and send only
5
- * RSC data. The closing tags provide a minimal valid HTML document for `injectRSCPayload` to
6
- * insert the RSC script tags into.
7
- */
8
- export declare function streamRSCPayload(rscStream: ReadableStream<Uint8Array>): ReadableStream<Uint8Array>;
9
- //# sourceMappingURL=stream-rsc-payload.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream-rsc-payload.d.ts","sourceRoot":"","sources":["../../../src/handlers/rsc/stream-rsc-payload.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC/B,SAAS,EAAE,cAAc,CAAC,UAAU,CAAC,GACnC,cAAc,CAAC,UAAU,CAAC,CAW5B"}
@@ -1,20 +0,0 @@
1
- import { injectRSCPayload } from "rsc-html-stream/server";
2
- const closingTagsBytes = new TextEncoder().encode("</body></html>");
3
- /**
4
- * Stream RSC payload for ResumeMode.RSC.
5
- *
6
- * The client already has the full HTML shell, so we bypass React's HTML renderer and send only
7
- * RSC data. The closing tags provide a minimal valid HTML document for `injectRSCPayload` to
8
- * insert the RSC script tags into.
9
- */
10
- export function streamRSCPayload(rscStream) {
11
- const closingStream = new ReadableStream({
12
- start(controller) {
13
- controller.enqueue(closingTagsBytes);
14
- controller.close();
15
- },
16
- });
17
- // The transform reads the closing tags, waits for RSC data, and emits the RSC payload as script
18
- // tags followed by the closing tags.
19
- return closingStream.pipeThrough(injectRSCPayload(rscStream));
20
- }
@@ -1,26 +0,0 @@
1
- import type { HTMLCacheEntry } from "../../lib/cache-storage.js";
2
- export interface Revalidation {
3
- key: string;
4
- resolvedParams: Set<string> | null;
5
- }
6
- export declare enum CacheLookupKind {
7
- NoCache = 0,
8
- StaticHit = 1,
9
- PprHit = 2,
10
- Miss = 3
11
- }
12
- export type CacheLookupOutcome = {
13
- kind: CacheLookupKind.NoCache;
14
- } | {
15
- kind: CacheLookupKind.StaticHit;
16
- response: Response;
17
- } | {
18
- kind: CacheLookupKind.PprHit;
19
- entry: HTMLCacheEntry;
20
- promotionResolvedParams: Set<string> | null;
21
- revalidations: Revalidation[];
22
- } | {
23
- kind: CacheLookupKind.Miss;
24
- revalidations: Revalidation[];
25
- };
26
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/handlers/rsc/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAEhE,MAAM,WAAW,YAAY;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;CAClC;AAED,oBAAY,eAAe;IAC1B,OAAO,IAAA;IACP,SAAS,IAAA;IACT,MAAM,IAAA;IACN,IAAI,IAAA;CACJ;AAED,MAAM,MAAM,kBAAkB,GAC3B;IAAE,IAAI,EAAE,eAAe,CAAC,OAAO,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,eAAe,CAAC,SAAS,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GACvD;IACA,IAAI,EAAE,eAAe,CAAC,MAAM,CAAA;IAC5B,KAAK,EAAE,cAAc,CAAA;IACrB,uBAAuB,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;IAC3C,aAAa,EAAE,YAAY,EAAE,CAAA;CAC5B,GACD;IACA,IAAI,EAAE,eAAe,CAAC,IAAI,CAAA;IAC1B,aAAa,EAAE,YAAY,EAAE,CAAA;CAC5B,CAAA"}
@@ -1,7 +0,0 @@
1
- export var CacheLookupKind;
2
- (function (CacheLookupKind) {
3
- CacheLookupKind[CacheLookupKind["NoCache"] = 0] = "NoCache";
4
- CacheLookupKind[CacheLookupKind["StaticHit"] = 1] = "StaticHit";
5
- CacheLookupKind[CacheLookupKind["PprHit"] = 2] = "PprHit";
6
- CacheLookupKind[CacheLookupKind["Miss"] = 3] = "Miss";
7
- })(CacheLookupKind || (CacheLookupKind = {}));
@@ -1,20 +0,0 @@
1
- import { type CacheLife } from "../lib/cache-context.js";
2
- import { type Route } from "../lib/route-matcher.js";
3
- interface HandlePageRouteOptions {
4
- /** Whether this is a build-time prerendering call (affects error handling) */
5
- isBuildPrerender?: boolean;
6
- /** Build-time metadata emitted after prerender behavior is known */
7
- onBuildPrerenderMeta?: (meta: BuildPrerenderMeta) => void;
8
- }
9
- export type BuildPrerenderMeta = {
10
- hasShell: boolean;
11
- postponedState?: string;
12
- cacheLife?: Omit<CacheLife, "tags">;
13
- };
14
- /**
15
- * Page route handler for RSC rendering.
16
- * Called by the router after a page route is matched, and during prerendering.
17
- */
18
- export declare function handlePageRoute(request: Request, route: Route, params: Record<string, string | string[]>, handleOptions?: HandlePageRouteOptions): Promise<Response>;
19
- export {};
20
- //# sourceMappingURL=rsc.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../../src/handlers/rsc.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAgCxD,OAAO,EAAmB,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAA;AA2GrE,UAAU,sBAAsB;IAC/B,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,oEAAoE;IACpE,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAA;CACzD;AAED,MAAM,MAAM,kBAAkB,GAAG;IAChC,QAAQ,EAAE,OAAO,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,SAAS,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;CACnC,CAAA;AAuKD;;;GAGG;AACH,wBAAsB,eAAe,CACpC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EACzC,aAAa,CAAC,EAAE,sBAAsB,GACpC,OAAO,CAAC,QAAQ,CAAC,CA6tBnB"}