@reckona/mreact-router 0.0.207 → 0.0.209
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 +2 -2
- package/dist/adapters/cloudflare.d.ts +3 -3
- package/dist/adapters/cloudflare.d.ts.map +1 -1
- package/dist/adapters/cloudflare.js +11 -4
- package/dist/adapters/cloudflare.js.map +1 -1
- package/dist/boundaries.d.ts +37 -1
- package/dist/boundaries.d.ts.map +1 -1
- package/dist/boundaries.js +125 -4
- package/dist/boundaries.js.map +1 -1
- package/dist/build.d.ts +6 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +269 -24
- package/dist/build.js.map +1 -1
- package/dist/bundle-pipeline.d.ts +1 -0
- package/dist/bundle-pipeline.d.ts.map +1 -1
- package/dist/bundle-pipeline.js +4 -1
- package/dist/bundle-pipeline.js.map +1 -1
- package/dist/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +67 -7
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +17 -0
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/module-runner.js +9 -1
- package/dist/module-runner.js.map +1 -1
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +23 -23
- package/dist/render.js.map +1 -1
- package/dist/request-header-tracking.d.ts +19 -0
- package/dist/request-header-tracking.d.ts.map +1 -1
- package/dist/request-header-tracking.js +48 -0
- package/dist/request-header-tracking.js.map +1 -1
- package/dist/tailwind-source.d.ts.map +1 -1
- package/dist/tailwind-source.js +147 -1
- package/dist/tailwind-source.js.map +1 -1
- package/dist/types.d.ts +14 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/vite.d.ts +1 -0
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +4 -0
- package/dist/vite.js.map +1 -1
- package/package.json +11 -11
- package/src/adapters/cloudflare.ts +14 -5
- package/src/boundaries.ts +224 -4
- package/src/build.ts +383 -24
- package/src/bundle-pipeline.ts +9 -4
- package/src/client.ts +104 -10
- package/src/config.ts +32 -0
- package/src/index.ts +10 -0
- package/src/module-runner.ts +9 -1
- package/src/render.ts +30 -16
- package/src/request-header-tracking.ts +61 -0
- package/src/tailwind-source.ts +164 -1
- package/src/types.ts +15 -2
- package/src/vite.ts +5 -0
package/dist/render.js
CHANGED
|
@@ -15,7 +15,7 @@ import { appFileConventionContentType } from "./file-conventions.js";
|
|
|
15
15
|
import { dispatchServerActionRequest, prepareRouteServerActionPlaceholders, prepareRouteServerActions, } from "./actions.js";
|
|
16
16
|
import { serverActionCookie } from "./csrf.js";
|
|
17
17
|
import { activeRouteCacheContext, withRouteCacheContext, cachedRouteResponse, cacheRouteResponse, routeCacheKey, routeCachePolicyFromSource, } from "./cache.js";
|
|
18
|
-
import { trackRequestHeaderReads, withTrackedRequest, } from "./request-header-tracking.js";
|
|
18
|
+
import { trackRequestHeaderReads, routeLocationFromRequest, routeLocationForHydration, routeLocationFromUrl, withTrackedRouteLocation, withTrackedRequest, } from "./request-header-tracking.js";
|
|
19
19
|
import { configuredHstsHeader, hasInvalidConfiguredHsts } from "./security-headers.js";
|
|
20
20
|
import { resolveRouterCacheLimit } from "./cache-config.js";
|
|
21
21
|
import { protectNonceBearingResponse } from "./prerender-entry.js";
|
|
@@ -638,7 +638,7 @@ async function renderAppRequestInternal(options) {
|
|
|
638
638
|
clientRoute,
|
|
639
639
|
props: {
|
|
640
640
|
params: matched.params,
|
|
641
|
-
request:
|
|
641
|
+
request: routeLocationForHydration(url),
|
|
642
642
|
},
|
|
643
643
|
routePath: matched.route.path,
|
|
644
644
|
script: clientScript,
|
|
@@ -696,11 +696,11 @@ async function renderAppRequestInternal(options) {
|
|
|
696
696
|
headers: { "content-type": "text/plain; charset=utf-8" },
|
|
697
697
|
});
|
|
698
698
|
}
|
|
699
|
-
const renderedPage = await runWithQueryClient(queryClient, () => runServerModuleWithSlots(stringOutput.code,
|
|
699
|
+
const renderedPage = await runWithQueryClient(queryClient, () => runServerModuleWithSlots(stringOutput.code, withTrackedRouteLocation({
|
|
700
700
|
data,
|
|
701
701
|
params: matched.params,
|
|
702
702
|
queryClient,
|
|
703
|
-
}, appRequest, trackedRequest), matched.route.file, options.serverModules, options.serverModuleCacheVersion, options.define, options.vitePlugins, undefined, options.importPolicy, options.devServerModuleCacheVersion));
|
|
703
|
+
}, appRequest, trackedRequest, routeLocationFromUrl(url)), matched.route.file, options.serverModules, options.serverModuleCacheVersion, options.define, options.vitePlugins, undefined, options.importPolicy, options.devServerModuleCacheVersion));
|
|
704
704
|
const pageHtml = renderedPage.html;
|
|
705
705
|
const pageHtmlForLayout = clientRoute
|
|
706
706
|
? withHydrationMarkers({
|
|
@@ -711,7 +711,7 @@ async function renderAppRequestInternal(options) {
|
|
|
711
711
|
script: clientScript,
|
|
712
712
|
props: {
|
|
713
713
|
params: matched.params,
|
|
714
|
-
request:
|
|
714
|
+
request: routeLocationForHydration(url),
|
|
715
715
|
data,
|
|
716
716
|
},
|
|
717
717
|
})
|
|
@@ -720,11 +720,11 @@ async function renderAppRequestInternal(options) {
|
|
|
720
720
|
appDir: options.appDir,
|
|
721
721
|
pageFile: matched.route.file,
|
|
722
722
|
html: pageHtmlForLayout,
|
|
723
|
-
props:
|
|
723
|
+
props: withTrackedRouteLocation({
|
|
724
724
|
data,
|
|
725
725
|
params: matched.params,
|
|
726
726
|
queryClient,
|
|
727
|
-
}, appRequest, trackedRequest),
|
|
727
|
+
}, appRequest, trackedRequest, routeLocationFromUrl(url)),
|
|
728
728
|
slots: renderedPage.slots,
|
|
729
729
|
serverModules: options.serverModules,
|
|
730
730
|
serverModuleCacheVersion: options.serverModuleCacheVersion,
|
|
@@ -834,7 +834,7 @@ async function renderAppRequestInternal(options) {
|
|
|
834
834
|
params: matched.params,
|
|
835
835
|
queryClient,
|
|
836
836
|
request: appRequest,
|
|
837
|
-
requestUrl: url.
|
|
837
|
+
requestUrl: url.href,
|
|
838
838
|
trackedRequest,
|
|
839
839
|
routePath: matched.route.path,
|
|
840
840
|
routeScripts: options.clientScripts,
|
|
@@ -860,11 +860,11 @@ async function renderAppRequestInternal(options) {
|
|
|
860
860
|
return response;
|
|
861
861
|
}
|
|
862
862
|
const data = streamData;
|
|
863
|
-
const props =
|
|
863
|
+
const props = withTrackedRouteLocation({
|
|
864
864
|
data,
|
|
865
865
|
params: matched.params,
|
|
866
866
|
queryClient,
|
|
867
|
-
}, appRequest, trackedRequest);
|
|
867
|
+
}, appRequest, trackedRequest, routeLocationFromUrl(url));
|
|
868
868
|
phaseStartedAt = renderTimingPhaseStartedAt(timing);
|
|
869
869
|
const stream = runServerStreamModule(output.code, {
|
|
870
870
|
appDir: options.appDir,
|
|
@@ -873,7 +873,7 @@ async function renderAppRequestInternal(options) {
|
|
|
873
873
|
markerRequest: options.request,
|
|
874
874
|
prerenderVariantCapture: options.prerenderVariantCapture,
|
|
875
875
|
props,
|
|
876
|
-
requestUrl: url.
|
|
876
|
+
requestUrl: url.href,
|
|
877
877
|
routePath: matched.route.path,
|
|
878
878
|
routeScripts: options.clientScripts,
|
|
879
879
|
serverModules: options.serverModules,
|
|
@@ -933,11 +933,11 @@ async function renderAppRequestInternal(options) {
|
|
|
933
933
|
});
|
|
934
934
|
}
|
|
935
935
|
phaseStartedAt = renderTimingPhaseStartedAt(timing);
|
|
936
|
-
const renderedPage = await runWithQueryClient(queryClient, () => runServerModuleWithSlots(output.code,
|
|
936
|
+
const renderedPage = await runWithQueryClient(queryClient, () => runServerModuleWithSlots(output.code, withTrackedRouteLocation({
|
|
937
937
|
data,
|
|
938
938
|
params: matched.params,
|
|
939
939
|
queryClient,
|
|
940
|
-
}, appRequest, trackedRequest), matched.route.file, options.serverModules, options.serverModuleCacheVersion, options.define, options.vitePlugins, timing, options.importPolicy, options.devServerModuleCacheVersion));
|
|
940
|
+
}, appRequest, trackedRequest, routeLocationFromUrl(url)), matched.route.file, options.serverModules, options.serverModuleCacheVersion, options.define, options.vitePlugins, timing, options.importPolicy, options.devServerModuleCacheVersion));
|
|
941
941
|
finishRenderTimingPhase(timing, phaseStartedAt, "pageRenderMs");
|
|
942
942
|
const pageHtml = renderedPage.html;
|
|
943
943
|
// Wrap the page (not the full document) with the hydration marker so
|
|
@@ -954,7 +954,7 @@ async function renderAppRequestInternal(options) {
|
|
|
954
954
|
script: clientScript,
|
|
955
955
|
props: {
|
|
956
956
|
params: matched.params,
|
|
957
|
-
request:
|
|
957
|
+
request: routeLocationForHydration(url),
|
|
958
958
|
data,
|
|
959
959
|
},
|
|
960
960
|
})
|
|
@@ -964,11 +964,11 @@ async function renderAppRequestInternal(options) {
|
|
|
964
964
|
appDir: options.appDir,
|
|
965
965
|
pageFile: matched.route.file,
|
|
966
966
|
html: pageHtmlForLayout,
|
|
967
|
-
props:
|
|
967
|
+
props: withTrackedRouteLocation({
|
|
968
968
|
data,
|
|
969
969
|
params: matched.params,
|
|
970
970
|
queryClient,
|
|
971
|
-
}, appRequest, trackedRequest),
|
|
971
|
+
}, appRequest, trackedRequest, routeLocationFromUrl(url)),
|
|
972
972
|
slots: renderedPage.slots,
|
|
973
973
|
serverModules: options.serverModules,
|
|
974
974
|
serverModuleCacheVersion: options.serverModuleCacheVersion,
|
|
@@ -1432,7 +1432,7 @@ function errorBoundaryProps(error, request, routePath) {
|
|
|
1432
1432
|
error: normalizeErrorForProps(error),
|
|
1433
1433
|
params: {},
|
|
1434
1434
|
queryClient: createQueryClient(),
|
|
1435
|
-
request,
|
|
1435
|
+
request: routeLocationFromRequest(request),
|
|
1436
1436
|
requestId: requestIdForErrorContext(request),
|
|
1437
1437
|
routeId: routeIdForPath(routePath ?? new URL(request.url).pathname),
|
|
1438
1438
|
traceId: traceContextFromRequest(request)?.traceId,
|
|
@@ -2193,7 +2193,7 @@ function runServerStreamModule(code, options) {
|
|
|
2193
2193
|
script: options.script,
|
|
2194
2194
|
props: {
|
|
2195
2195
|
params: options.props.params,
|
|
2196
|
-
request:
|
|
2196
|
+
request: routeLocationForHydration(new URL(options.requestUrl, options.markerRequest.url)),
|
|
2197
2197
|
data: options.props.data,
|
|
2198
2198
|
},
|
|
2199
2199
|
})
|
|
@@ -2311,11 +2311,11 @@ function localServerSourceImportCandidates(base) {
|
|
|
2311
2311
|
return candidates;
|
|
2312
2312
|
}
|
|
2313
2313
|
async function runServerStreamModuleWithLoading(code, options) {
|
|
2314
|
-
const loadingProps =
|
|
2314
|
+
const loadingProps = withTrackedRouteLocation({
|
|
2315
2315
|
data: undefined,
|
|
2316
2316
|
params: options.params,
|
|
2317
2317
|
queryClient: options.queryClient,
|
|
2318
|
-
}, options.request, options.trackedRequest);
|
|
2318
|
+
}, options.request, options.trackedRequest, routeLocationFromUrl(new URL(options.requestUrl)));
|
|
2319
2319
|
const layoutShells = await layoutShellsForPage(options.appDir, options.pageFile, loadingProps, {}, options.serverModules, options.serverModuleCacheVersion, options.serverSourceFiles, options.clientRouteInferenceCache, options.define, options.vitePlugins, options.importPolicy);
|
|
2320
2320
|
const loadingHtml = await renderServerFileToHtml(options.loadingFile, loadingProps, options.serverModules, options.serverModuleCacheVersion, options.serverSourceFiles, options.define, options.vitePlugins);
|
|
2321
2321
|
const marker = options.clientRoute
|
|
@@ -2326,7 +2326,7 @@ async function runServerStreamModuleWithLoading(code, options) {
|
|
|
2326
2326
|
script: options.script,
|
|
2327
2327
|
props: {
|
|
2328
2328
|
params: options.params,
|
|
2329
|
-
request:
|
|
2329
|
+
request: routeLocationForHydration(new URL(options.requestUrl)),
|
|
2330
2330
|
},
|
|
2331
2331
|
})
|
|
2332
2332
|
: serverOnlyRouteMarkerParts(options.routePath, options.markerRequest, options.prerenderVariantCapture === true);
|
|
@@ -2349,11 +2349,11 @@ async function runServerStreamModuleWithLoading(code, options) {
|
|
|
2349
2349
|
}
|
|
2350
2350
|
sink.append(marker?.prefix ?? "");
|
|
2351
2351
|
renderOutOfOrderBoundary(sink, "mreact-route", options.data, async (boundarySink, data) => {
|
|
2352
|
-
await appendServerStreamModule(code, boundarySink,
|
|
2352
|
+
await appendServerStreamModule(code, boundarySink, withTrackedRouteLocation({
|
|
2353
2353
|
data,
|
|
2354
2354
|
params: options.params,
|
|
2355
2355
|
queryClient: options.queryClient,
|
|
2356
|
-
}, options.request, options.trackedRequest), options.pageFile, options.serverModules, options.serverModuleCacheVersion, options.define, options.vitePlugins, options.importPolicy);
|
|
2356
|
+
}, options.request, options.trackedRequest, routeLocationFromUrl(new URL(options.requestUrl))), options.pageFile, options.serverModules, options.serverModuleCacheVersion, options.define, options.vitePlugins, options.importPolicy);
|
|
2357
2357
|
}, {
|
|
2358
2358
|
async catch(boundarySink, error) {
|
|
2359
2359
|
try {
|