@bleedingdev/modern-js-plugin-tanstack 3.5.0-ultramodern.9 → 3.5.0-ultramodern.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/cli/artifacts.js +157 -0
- package/dist/cjs/cli/index.js +8 -79
- package/dist/cjs/cli/tanstackTypes/canonicalRoutes.js +113 -0
- package/dist/cjs/cli/tanstackTypes/shared.js +123 -0
- package/dist/cjs/cli/tanstackTypes/source.js +255 -0
- package/dist/cjs/cli/tanstackTypes.js +4 -350
- package/dist/cjs/runtime/blockingSubscribe.js +57 -0
- package/dist/cjs/runtime/{pluginCore.js → clientBasepath.js} +12 -19
- package/dist/cjs/runtime/clientHydration.js +118 -0
- package/dist/cjs/runtime/dataMutation.js +11 -176
- package/dist/cjs/runtime/formData.js +116 -0
- package/dist/cjs/runtime/loaderBridge.js +7 -11
- package/dist/cjs/runtime/plugin.js +21 -125
- package/dist/cjs/runtime/plugin.node.js +45 -125
- package/dist/cjs/runtime/pluginShared.js +87 -0
- package/dist/cjs/runtime/prefetchLink.js +15 -2
- package/dist/cjs/runtime/register.js +3 -16
- package/dist/cjs/runtime/routeTree/components.js +102 -0
- package/dist/cjs/runtime/routeTree/construction.js +152 -0
- package/dist/cjs/runtime/routeTree/index.js +47 -0
- package/dist/cjs/runtime/routeTree/loaders.js +158 -0
- package/dist/cjs/runtime/routeTree/paths.js +57 -0
- package/dist/cjs/runtime/routeTree/staticData.js +63 -0
- package/dist/cjs/runtime/routeTree/tanstackRoutes.js +57 -0
- package/dist/cjs/runtime/routeTree/types.js +18 -0
- package/dist/cjs/runtime/routeTree.js +7 -320
- package/dist/cjs/runtime/router.js +15 -2
- package/dist/cjs/runtime/rsc/CompositeComponent.js +18 -13
- package/dist/cjs/runtime/rsc/ReplayableStream.js +0 -4
- package/dist/cjs/runtime/rsc/RscNodeRenderer.js +5 -16
- package/dist/cjs/runtime/rsc/client.js +8 -25
- package/dist/cjs/runtime/rsc/flightSerialization.js +132 -0
- package/dist/cjs/runtime/rsc/payloadErrors.js +99 -0
- package/dist/cjs/runtime/rsc/payloadFetch.js +105 -0
- package/dist/cjs/runtime/rsc/payloadRouter.js +21 -142
- package/dist/cjs/runtime/rsc/payloadRoutes.js +94 -0
- package/dist/cjs/runtime/rsc/payloadStorage.js +58 -0
- package/dist/cjs/runtime/rsc/server.js +14 -18
- package/dist/cjs/runtime/rsc/shared.js +68 -0
- package/dist/cjs/runtime/rsc/slotUsageSanitizer.js +1 -0
- package/dist/cjs/runtime/rsc/treeGetter.js +72 -0
- package/dist/cjs/runtime/shared/isAbsoluteUrl.js +47 -0
- package/dist/cjs/runtime/ssrManagedTags.js +103 -0
- package/dist/cjs/runtime/ssrPreload.js +89 -0
- package/dist/cjs/runtime/ssrTypes.js +18 -0
- package/dist/cjs/runtime/state.js +1 -1
- package/dist/cjs/runtime/submitAction.js +161 -0
- package/dist/cjs/runtime/utils.js +49 -86
- package/dist/esm/cli/artifacts.mjs +103 -0
- package/dist/esm/cli/index.mjs +8 -82
- package/dist/esm/cli/tanstackTypes/canonicalRoutes.mjs +75 -0
- package/dist/esm/cli/tanstackTypes/shared.mjs +61 -0
- package/dist/esm/cli/tanstackTypes/source.mjs +207 -0
- package/dist/esm/cli/tanstackTypes.mjs +2 -339
- package/dist/esm/runtime/blockingSubscribe.mjs +19 -0
- package/dist/esm/runtime/clientBasepath.mjs +10 -0
- package/dist/esm/runtime/clientHydration.mjs +71 -0
- package/dist/esm/runtime/dataMutation.mjs +2 -167
- package/dist/esm/runtime/formData.mjs +63 -0
- package/dist/esm/runtime/loaderBridge.mjs +5 -9
- package/dist/esm/runtime/plugin.mjs +14 -118
- package/dist/esm/runtime/plugin.node.mjs +41 -121
- package/dist/esm/runtime/pluginShared.mjs +40 -0
- package/dist/esm/runtime/prefetchLink.mjs +18 -5
- package/dist/esm/runtime/register.mjs +1 -14
- package/dist/esm/runtime/routeTree/components.mjs +55 -0
- package/dist/esm/runtime/routeTree/construction.mjs +111 -0
- package/dist/esm/runtime/routeTree/index.mjs +2 -0
- package/dist/esm/runtime/routeTree/loaders.mjs +117 -0
- package/dist/esm/runtime/routeTree/paths.mjs +16 -0
- package/dist/esm/runtime/routeTree/staticData.mjs +22 -0
- package/dist/esm/runtime/routeTree/tanstackRoutes.mjs +13 -0
- package/dist/esm/runtime/routeTree/types.mjs +0 -0
- package/dist/esm/runtime/routeTree.mjs +1 -318
- package/dist/esm/runtime/router.mjs +16 -2
- package/dist/esm/runtime/rsc/CompositeComponent.mjs +18 -13
- package/dist/esm/runtime/rsc/ReplayableStream.mjs +1 -1
- package/dist/esm/runtime/rsc/RscNodeRenderer.mjs +4 -15
- package/dist/esm/runtime/rsc/client.mjs +6 -26
- package/dist/esm/runtime/rsc/flightSerialization.mjs +88 -0
- package/dist/esm/runtime/rsc/payloadErrors.mjs +49 -0
- package/dist/esm/runtime/rsc/payloadFetch.mjs +55 -0
- package/dist/esm/runtime/rsc/payloadRouter.mjs +12 -133
- package/dist/esm/runtime/rsc/payloadRoutes.mjs +50 -0
- package/dist/esm/runtime/rsc/payloadStorage.mjs +14 -0
- package/dist/esm/runtime/rsc/server.mjs +17 -21
- package/dist/esm/runtime/rsc/shared.mjs +21 -0
- package/dist/esm/runtime/rsc/slotUsageSanitizer.mjs +1 -0
- package/dist/esm/runtime/rsc/treeGetter.mjs +34 -0
- package/dist/esm/runtime/shared/isAbsoluteUrl.mjs +9 -0
- package/dist/esm/runtime/ssrManagedTags.mjs +53 -0
- package/dist/esm/runtime/ssrPreload.mjs +51 -0
- package/dist/esm/runtime/ssrTypes.mjs +0 -0
- package/dist/esm/runtime/state.mjs +1 -1
- package/dist/esm/runtime/submitAction.mjs +120 -0
- package/dist/esm/runtime/utils.mjs +47 -75
- package/dist/esm-node/cli/artifacts.mjs +104 -0
- package/dist/esm-node/cli/index.mjs +8 -82
- package/dist/esm-node/cli/tanstackTypes/canonicalRoutes.mjs +76 -0
- package/dist/esm-node/cli/tanstackTypes/shared.mjs +62 -0
- package/dist/esm-node/cli/tanstackTypes/source.mjs +208 -0
- package/dist/esm-node/cli/tanstackTypes.mjs +2 -339
- package/dist/esm-node/runtime/blockingSubscribe.mjs +20 -0
- package/dist/esm-node/runtime/clientBasepath.mjs +11 -0
- package/dist/esm-node/runtime/clientHydration.mjs +72 -0
- package/dist/esm-node/runtime/dataMutation.mjs +2 -167
- package/dist/esm-node/runtime/formData.mjs +64 -0
- package/dist/esm-node/runtime/loaderBridge.mjs +5 -9
- package/dist/esm-node/runtime/plugin.mjs +14 -118
- package/dist/esm-node/runtime/plugin.node.mjs +41 -121
- package/dist/esm-node/runtime/pluginShared.mjs +41 -0
- package/dist/esm-node/runtime/prefetchLink.mjs +18 -5
- package/dist/esm-node/runtime/register.mjs +1 -14
- package/dist/esm-node/runtime/routeTree/components.mjs +56 -0
- package/dist/esm-node/runtime/routeTree/construction.mjs +112 -0
- package/dist/esm-node/runtime/routeTree/index.mjs +3 -0
- package/dist/esm-node/runtime/routeTree/loaders.mjs +118 -0
- package/dist/esm-node/runtime/routeTree/paths.mjs +17 -0
- package/dist/esm-node/runtime/routeTree/staticData.mjs +23 -0
- package/dist/esm-node/runtime/routeTree/tanstackRoutes.mjs +14 -0
- package/dist/esm-node/runtime/routeTree/types.mjs +1 -0
- package/dist/esm-node/runtime/routeTree.mjs +1 -318
- package/dist/esm-node/runtime/router.mjs +16 -2
- package/dist/esm-node/runtime/rsc/CompositeComponent.mjs +18 -13
- package/dist/esm-node/runtime/rsc/ReplayableStream.mjs +1 -1
- package/dist/esm-node/runtime/rsc/RscNodeRenderer.mjs +4 -15
- package/dist/esm-node/runtime/rsc/client.mjs +6 -26
- package/dist/esm-node/runtime/rsc/flightSerialization.mjs +89 -0
- package/dist/esm-node/runtime/rsc/payloadErrors.mjs +50 -0
- package/dist/esm-node/runtime/rsc/payloadFetch.mjs +56 -0
- package/dist/esm-node/runtime/rsc/payloadRouter.mjs +12 -133
- package/dist/esm-node/runtime/rsc/payloadRoutes.mjs +51 -0
- package/dist/esm-node/runtime/rsc/payloadStorage.mjs +15 -0
- package/dist/esm-node/runtime/rsc/server.mjs +17 -21
- package/dist/esm-node/runtime/rsc/shared.mjs +22 -0
- package/dist/esm-node/runtime/rsc/slotUsageSanitizer.mjs +1 -0
- package/dist/esm-node/runtime/rsc/treeGetter.mjs +35 -0
- package/dist/esm-node/runtime/shared/isAbsoluteUrl.mjs +10 -0
- package/dist/esm-node/runtime/ssrManagedTags.mjs +54 -0
- package/dist/esm-node/runtime/ssrPreload.mjs +52 -0
- package/dist/esm-node/runtime/ssrTypes.mjs +1 -0
- package/dist/esm-node/runtime/state.mjs +1 -1
- package/dist/esm-node/runtime/submitAction.mjs +121 -0
- package/dist/esm-node/runtime/utils.mjs +47 -75
- package/dist/types/cli/artifacts.d.ts +33 -0
- package/dist/types/cli/index.d.ts +2 -22
- package/dist/types/cli/tanstackTypes/canonicalRoutes.d.ts +22 -0
- package/dist/types/cli/tanstackTypes/shared.d.ts +20 -0
- package/dist/types/cli/tanstackTypes/source.d.ts +12 -0
- package/dist/types/cli/tanstackTypes.d.ts +3 -31
- package/dist/types/runtime/blockingSubscribe.d.ts +1 -0
- package/dist/types/runtime/clientBasepath.d.ts +1 -0
- package/dist/types/runtime/clientHydration.d.ts +10 -0
- package/dist/types/runtime/dataMutation.d.ts +3 -12
- package/dist/types/runtime/formData.d.ts +24 -0
- package/dist/types/runtime/loaderBridge.d.ts +2 -1
- package/dist/types/runtime/plugin.d.ts +1 -1
- package/dist/types/runtime/plugin.node.d.ts +1 -1
- package/dist/types/runtime/pluginShared.d.ts +38 -0
- package/dist/types/runtime/register.d.ts +10 -9
- package/dist/types/runtime/routeTree/components.d.ts +7 -0
- package/dist/types/runtime/routeTree/construction.d.ts +5 -0
- package/dist/types/runtime/routeTree/index.d.ts +2 -0
- package/dist/types/runtime/routeTree/loaders.d.ts +4 -0
- package/dist/types/runtime/routeTree/paths.d.ts +3 -0
- package/dist/types/runtime/routeTree/staticData.d.ts +19 -0
- package/dist/types/runtime/routeTree/tanstackRoutes.d.ts +4 -0
- package/dist/types/runtime/routeTree/types.d.ts +76 -0
- package/dist/types/runtime/routeTree.d.ts +1 -9
- package/dist/types/runtime/router.d.ts +6 -7
- package/dist/types/runtime/rsc/CompositeComponent.d.ts +1 -2
- package/dist/types/runtime/rsc/ReplayableStream.d.ts +3 -2
- package/dist/types/runtime/rsc/RscNodeRenderer.d.ts +2 -3
- package/dist/types/runtime/rsc/SlotContext.d.ts +2 -1
- package/dist/types/runtime/rsc/client.d.ts +2 -0
- package/dist/types/runtime/rsc/flightSerialization.d.ts +3 -0
- package/dist/types/runtime/rsc/payloadErrors.d.ts +6 -0
- package/dist/types/runtime/rsc/payloadFetch.d.ts +8 -0
- package/dist/types/runtime/rsc/payloadRouter.d.ts +2 -10
- package/dist/types/runtime/rsc/payloadRoutes.d.ts +40 -0
- package/dist/types/runtime/rsc/payloadStorage.d.ts +5 -0
- package/dist/types/runtime/rsc/shared.d.ts +18 -0
- package/dist/types/runtime/rsc/treeGetter.d.ts +1 -0
- package/dist/types/runtime/shared/isAbsoluteUrl.d.ts +1 -0
- package/dist/types/runtime/ssrManagedTags.d.ts +7 -0
- package/dist/types/runtime/ssrPreload.d.ts +2 -0
- package/dist/types/runtime/ssrTypes.d.ts +44 -0
- package/dist/types/runtime/state.d.ts +1 -1
- package/dist/types/runtime/submitAction.d.ts +14 -0
- package/dist/types/runtime/types.d.ts +4 -10
- package/dist/types/runtime/utils.d.ts +4 -24
- package/package.json +37 -17
- package/rstest.config.mts +23 -0
- package/src/cli/artifacts.ts +255 -0
- package/src/cli/index.ts +7 -185
- package/src/cli/tanstackTypes/canonicalRoutes.ts +157 -0
- package/src/cli/tanstackTypes/shared.ts +113 -0
- package/src/cli/tanstackTypes/source.ts +414 -0
- package/src/cli/tanstackTypes.ts +4 -647
- package/src/runtime/blockingSubscribe.ts +48 -0
- package/src/runtime/clientBasepath.ts +12 -0
- package/src/runtime/clientHydration.ts +149 -0
- package/src/runtime/dataMutation.tsx +9 -306
- package/src/runtime/formData.ts +153 -0
- package/src/runtime/loaderBridge.ts +11 -12
- package/src/runtime/plugin.node.tsx +76 -291
- package/src/runtime/plugin.tsx +21 -257
- package/src/runtime/pluginShared.ts +112 -0
- package/src/runtime/prefetchLink.tsx +78 -15
- package/src/runtime/register.ts +10 -42
- package/src/runtime/routeTree/components.ts +130 -0
- package/src/runtime/routeTree/construction.ts +238 -0
- package/src/runtime/routeTree/index.ts +7 -0
- package/src/runtime/routeTree/loaders.ts +232 -0
- package/src/runtime/routeTree/paths.ts +36 -0
- package/src/runtime/routeTree/staticData.ts +66 -0
- package/src/runtime/routeTree/tanstackRoutes.ts +36 -0
- package/src/runtime/routeTree/types.ts +87 -0
- package/src/runtime/routeTree.ts +5 -750
- package/src/runtime/router.ts +35 -7
- package/src/runtime/rsc/CompositeComponent.tsx +29 -20
- package/src/runtime/rsc/ReplayableStream.ts +2 -2
- package/src/runtime/rsc/RscNodeRenderer.tsx +9 -27
- package/src/runtime/rsc/SlotContext.tsx +1 -1
- package/src/runtime/rsc/client.tsx +12 -40
- package/src/runtime/rsc/flightSerialization.ts +158 -0
- package/src/runtime/rsc/payloadErrors.ts +73 -0
- package/src/runtime/rsc/payloadFetch.ts +92 -0
- package/src/runtime/rsc/payloadRouter.ts +29 -234
- package/src/runtime/rsc/payloadRoutes.ts +122 -0
- package/src/runtime/rsc/payloadStorage.ts +35 -0
- package/src/runtime/rsc/server.tsx +20 -29
- package/src/runtime/rsc/shared.ts +70 -0
- package/src/runtime/rsc/slotUsageSanitizer.ts +4 -0
- package/src/runtime/rsc/treeGetter.tsx +52 -0
- package/src/runtime/shared/isAbsoluteUrl.ts +8 -0
- package/src/runtime/ssrManagedTags.ts +107 -0
- package/src/runtime/ssrPreload.ts +125 -0
- package/src/runtime/ssrTypes.ts +51 -0
- package/src/runtime/state.ts +9 -3
- package/src/runtime/submitAction.ts +201 -0
- package/src/runtime/types.ts +4 -18
- package/src/runtime/utils.tsx +76 -110
- package/src/types/react-server-dom-rspack.d.ts +56 -0
- package/tests/castRatchet.test.ts +85 -0
- package/tests/realm-isolation.test.ts +114 -0
- package/tests/router/cli.test.ts +7 -0
- package/tests/router/clientHydration.test.tsx +61 -0
- package/tests/router/dataMutation.test.tsx +59 -0
- package/tests/router/fixtures/legacyRuntimeRouter.ts +10 -0
- package/tests/router/fixtures/router-gen.golden.txt +71 -0
- package/tests/router/fixtures/router-gen.oxlint.json +5 -0
- package/tests/router/flightSerialization.roundtrip.test.tsx +137 -0
- package/tests/router/generateRouteArtifacts.test.ts +106 -0
- package/tests/router/hooks.test.ts +14 -0
- package/tests/router/loaderBridge.test.ts +21 -0
- package/tests/router/prefetchLink.test.tsx +106 -59
- package/tests/router/prefetchLinkPreload.test.tsx +85 -0
- package/tests/router/register.test.ts +1 -39
- package/tests/router/routeTree.test.ts +51 -11
- package/tests/router/routerCompatibility.test.ts +245 -0
- package/tests/router/rsc.test.tsx +189 -0
- package/tests/router/rscPayloadRouterMatrix.test.ts +197 -0
- package/tests/router/slotUsageSanitizer.test.ts +23 -0
- package/tests/router/ssrPreload.test.ts +30 -0
- package/tests/router/tanstackTypes.test.ts +298 -1
- package/dist/esm/runtime/pluginCore.mjs +0 -14
- package/dist/esm-node/runtime/pluginCore.mjs +0 -15
- package/dist/types/runtime/pluginCore.d.ts +0 -21
- package/src/runtime/pluginCore.ts +0 -48
|
@@ -28,331 +28,18 @@ var __webpack_require__ = {};
|
|
|
28
28
|
var __webpack_exports__ = {};
|
|
29
29
|
__webpack_require__.r(__webpack_exports__);
|
|
30
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
createRouteTreeFromRouteObjects: ()=>createRouteTreeFromRouteObjects,
|
|
32
|
-
getModernRouteIdsFromMatches: ()=>getModernRouteIdsFromMatches
|
|
31
|
+
createRouteTreeFromRouteObjects: ()=>index_js_namespaceObject.createRouteTreeFromRouteObjects,
|
|
32
|
+
getModernRouteIdsFromMatches: ()=>index_js_namespaceObject.getModernRouteIdsFromMatches,
|
|
33
|
+
pickRouteModuleComponent: ()=>index_js_namespaceObject.pickRouteModuleComponent
|
|
33
34
|
});
|
|
34
|
-
const
|
|
35
|
-
const react_router_namespaceObject = require("@tanstack/react-router");
|
|
36
|
-
const external_react_namespaceObject = require("react");
|
|
37
|
-
const external_loaderBridge_js_namespaceObject = require("./loaderBridge.js");
|
|
38
|
-
const external_outlet_js_namespaceObject = require("./outlet.js");
|
|
39
|
-
const payloadRouter_js_namespaceObject = require("./rsc/payloadRouter.js");
|
|
40
|
-
function createTanstackRoute(options) {
|
|
41
|
-
return (0, react_router_namespaceObject.createRoute)(options);
|
|
42
|
-
}
|
|
43
|
-
function createTanstackRootRoute(options) {
|
|
44
|
-
return (0, react_router_namespaceObject.createRootRoute)(options);
|
|
45
|
-
}
|
|
46
|
-
function wrapRouteComponentWithModernContext(route, component, routeId) {
|
|
47
|
-
const routeMatchId = routeId || route.id;
|
|
48
|
-
if (component && routeMatchId) route.options.component = (0, external_outlet_js_namespaceObject.withModernRouteMatchContext)(component, routeMatchId);
|
|
49
|
-
}
|
|
50
|
-
function toTanstackPath(pathname) {
|
|
51
|
-
return pathname.split('/').map((segment)=>{
|
|
52
|
-
if (!segment) return segment;
|
|
53
|
-
if ('*' === segment) return '$';
|
|
54
|
-
if (segment.startsWith(':')) {
|
|
55
|
-
const name = segment.slice(1);
|
|
56
|
-
if (name.endsWith('?')) return `{-$${name.slice(0, -1)}}`;
|
|
57
|
-
return `$${name}`;
|
|
58
|
-
}
|
|
59
|
-
return segment;
|
|
60
|
-
}).join('/');
|
|
61
|
-
}
|
|
62
|
-
function isModernDeferredData(value) {
|
|
63
|
-
if (!value || 'object' != typeof value) return false;
|
|
64
|
-
const deferred = value;
|
|
65
|
-
return true === deferred.__modern_deferred && Boolean(deferred.data) && 'object' == typeof deferred.data && !Array.isArray(deferred.data);
|
|
66
|
-
}
|
|
67
|
-
function normalizeModernLoaderResult(result) {
|
|
68
|
-
return isModernDeferredData(result) ? result.data : result;
|
|
69
|
-
}
|
|
70
|
-
function normalizeModernLoaderResponse(result) {
|
|
71
|
-
if ((0, external_loaderBridge_js_namespaceObject.isResponse)(result)) {
|
|
72
|
-
if ((0, external_loaderBridge_js_namespaceObject.isRedirectResponse)(result)) {
|
|
73
|
-
const location = result.headers.get('Location') || '/';
|
|
74
|
-
(0, external_loaderBridge_js_namespaceObject.throwTanstackRedirect)(location);
|
|
75
|
-
}
|
|
76
|
-
if (404 === result.status) throw (0, react_router_namespaceObject.notFound)();
|
|
77
|
-
}
|
|
78
|
-
return normalizeModernLoaderResult(result);
|
|
79
|
-
}
|
|
80
|
-
function pickRouteModuleComponent(routeModule, seen = new Set()) {
|
|
81
|
-
if ('function' == typeof routeModule || routeModule && 'object' == typeof routeModule && '$$typeof' in routeModule) return routeModule;
|
|
82
|
-
if (!routeModule || 'object' != typeof routeModule) return;
|
|
83
|
-
if (seen.has(routeModule)) return;
|
|
84
|
-
seen.add(routeModule);
|
|
85
|
-
const module = routeModule;
|
|
86
|
-
for (const candidate of [
|
|
87
|
-
module.default,
|
|
88
|
-
module.Component
|
|
89
|
-
]){
|
|
90
|
-
const component = pickRouteModuleComponent(candidate, seen);
|
|
91
|
-
if (component) return component;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function createServerLazyImportComponent(lazyImport, fallbackComponent) {
|
|
95
|
-
if ("u" > typeof document) return fallbackComponent;
|
|
96
|
-
let resolvedComponent;
|
|
97
|
-
let pendingLoad;
|
|
98
|
-
const load = async ()=>{
|
|
99
|
-
if (resolvedComponent) return resolvedComponent;
|
|
100
|
-
const routeModule = await lazyImport();
|
|
101
|
-
const component = pickRouteModuleComponent(routeModule);
|
|
102
|
-
if (component) resolvedComponent = component;
|
|
103
|
-
return resolvedComponent;
|
|
104
|
-
};
|
|
105
|
-
const Component = (props)=>{
|
|
106
|
-
if (resolvedComponent) return (0, external_react_namespaceObject.createElement)(resolvedComponent, props);
|
|
107
|
-
pendingLoad ||= load();
|
|
108
|
-
throw pendingLoad;
|
|
109
|
-
};
|
|
110
|
-
Component.load = load;
|
|
111
|
-
Component.preload = load;
|
|
112
|
-
return Component;
|
|
113
|
-
}
|
|
114
|
-
function createModernRequest(input, signal) {
|
|
115
|
-
return new Request(input, {
|
|
116
|
-
signal
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
function getModernUrlFromLoaderContext(ctx) {
|
|
120
|
-
const href = 'string' == typeof ctx?.location ? ctx.location : ctx?.location?.publicHref || ctx?.location?.href || ctx?.location?.url?.href || '/';
|
|
121
|
-
const baseRequest = ctx?.context?.request instanceof Request ? ctx.context.request : void 0;
|
|
122
|
-
const baseUrl = baseRequest?.url || ("u" > typeof window ? window.origin : 'http://localhost');
|
|
123
|
-
return new URL(href || '/', baseUrl);
|
|
124
|
-
}
|
|
125
|
-
function rememberRouteLocation(state, ctx) {
|
|
126
|
-
state.currentUrl = getModernUrlFromLoaderContext(ctx);
|
|
127
|
-
state.currentParams = ctx?.params || {};
|
|
128
|
-
}
|
|
129
|
-
function createModernShouldReload(shouldRevalidate, state) {
|
|
130
|
-
if ('function' != typeof shouldRevalidate) return;
|
|
131
|
-
const revalidate = shouldRevalidate;
|
|
132
|
-
return (ctx)=>{
|
|
133
|
-
const nextUrl = getModernUrlFromLoaderContext(ctx);
|
|
134
|
-
const nextParams = ctx?.params || {};
|
|
135
|
-
const result = revalidate({
|
|
136
|
-
currentUrl: state.currentUrl || nextUrl,
|
|
137
|
-
currentParams: state.currentParams || nextParams,
|
|
138
|
-
nextUrl,
|
|
139
|
-
nextParams,
|
|
140
|
-
defaultShouldRevalidate: void 0
|
|
141
|
-
});
|
|
142
|
-
state.currentUrl = nextUrl;
|
|
143
|
-
state.currentParams = nextParams;
|
|
144
|
-
return 'boolean' == typeof result ? result : void 0;
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
function isRouteObjectPathlessLayout(route) {
|
|
148
|
-
return !route.path && !route.index;
|
|
149
|
-
}
|
|
150
|
-
function isRouteObjectSplatRoute(route) {
|
|
151
|
-
return 'string' == typeof route.path && route.path.includes('*');
|
|
152
|
-
}
|
|
153
|
-
function mapParamsForRouteObjectLoader({ route, params }) {
|
|
154
|
-
if (isRouteObjectSplatRoute(route)) {
|
|
155
|
-
const { _splat, ...rest } = params;
|
|
156
|
-
if (void 0 !== _splat) return {
|
|
157
|
-
...rest,
|
|
158
|
-
'*': _splat
|
|
159
|
-
};
|
|
160
|
-
return rest;
|
|
161
|
-
}
|
|
162
|
-
return params;
|
|
163
|
-
}
|
|
164
|
-
function wrapRouteObjectLoader(route, revalidationState, options = {}) {
|
|
165
|
-
const modernRoute = route;
|
|
166
|
-
const routeLoader = modernRoute.loader;
|
|
167
|
-
if ('function' != typeof routeLoader) return;
|
|
168
|
-
return async (ctx)=>{
|
|
169
|
-
try {
|
|
170
|
-
if (revalidationState) rememberRouteLocation(revalidationState, ctx);
|
|
171
|
-
if ('function' == typeof modernRoute.lazyImport) try {
|
|
172
|
-
await modernRoute.lazyImport();
|
|
173
|
-
} catch {}
|
|
174
|
-
const signal = ctx?.abortController?.signal || ctx?.signal || new AbortController().signal;
|
|
175
|
-
const baseRequest = ctx?.context?.request instanceof Request ? ctx.context.request : void 0;
|
|
176
|
-
const href = 'string' == typeof ctx?.location ? ctx.location : ctx?.location?.publicHref || ctx?.location?.href || ctx?.location?.url?.href || '';
|
|
177
|
-
const request = void 0 !== baseRequest ? new Request(baseRequest, {
|
|
178
|
-
signal
|
|
179
|
-
}) : createModernRequest(href, signal);
|
|
180
|
-
const params = mapParamsForRouteObjectLoader({
|
|
181
|
-
route,
|
|
182
|
-
params: ctx.params || {}
|
|
183
|
-
});
|
|
184
|
-
const loadModernData = async ()=>{
|
|
185
|
-
const result = await routeLoader({
|
|
186
|
-
request,
|
|
187
|
-
params,
|
|
188
|
-
context: ctx?.context?.requestContext
|
|
189
|
-
});
|
|
190
|
-
return normalizeModernLoaderResponse(result);
|
|
191
|
-
};
|
|
192
|
-
if (options.rscPayloadRouter && (0, payloadRouter_js_namespaceObject.isTanstackRscPayloadNavigationEnabled)()) return (0, payloadRouter_js_namespaceObject.loadTanstackRscRouteData)({
|
|
193
|
-
hasClientLoader: modernRoute.hasClientLoader || void 0 !== modernRoute.clientData,
|
|
194
|
-
loadClientData: loadModernData,
|
|
195
|
-
request,
|
|
196
|
-
routeId: ctx.route?.id
|
|
197
|
-
});
|
|
198
|
-
return loadModernData();
|
|
199
|
-
} catch (err) {
|
|
200
|
-
if ((0, external_loaderBridge_js_namespaceObject.isResponse)(err)) {
|
|
201
|
-
if ((0, external_loaderBridge_js_namespaceObject.isTanstackRedirect)(err)) throw err;
|
|
202
|
-
if ((0, external_loaderBridge_js_namespaceObject.isRedirectResponse)(err)) {
|
|
203
|
-
const location = err.headers.get('Location') || '/';
|
|
204
|
-
(0, external_loaderBridge_js_namespaceObject.throwTanstackRedirect)(location);
|
|
205
|
-
}
|
|
206
|
-
if (404 === err.status) throw (0, react_router_namespaceObject.notFound)();
|
|
207
|
-
}
|
|
208
|
-
throw err;
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
function toRouteComponent(routeObject) {
|
|
213
|
-
const route = routeObject;
|
|
214
|
-
const lazyImport = 'function' == typeof route.lazyImport ? route.lazyImport : void 0;
|
|
215
|
-
const fallbackComponent = route.Component ? route.Component : route.element ? ()=>route.element : void 0;
|
|
216
|
-
if (lazyImport && fallbackComponent) return createServerLazyImportComponent(lazyImport, fallbackComponent);
|
|
217
|
-
if (route.Component) return route.Component;
|
|
218
|
-
const element = route.element;
|
|
219
|
-
if (element) return ()=>element;
|
|
220
|
-
}
|
|
221
|
-
function toErrorComponent(routeObject) {
|
|
222
|
-
const route = routeObject;
|
|
223
|
-
if (route.ErrorBoundary) return route.ErrorBoundary;
|
|
224
|
-
if (route.errorElement) return ()=>route.errorElement;
|
|
225
|
-
}
|
|
226
|
-
function toPendingComponent(routeObject) {
|
|
227
|
-
const route = routeObject;
|
|
228
|
-
return route.HydrateFallback || route.pendingComponent || void 0;
|
|
229
|
-
}
|
|
230
|
-
function mergeModernRouteHandle(route) {
|
|
231
|
-
const config = route.config;
|
|
232
|
-
const handle = {
|
|
233
|
-
...route.handle,
|
|
234
|
-
...config && 'object' == typeof config ? config.handle : {}
|
|
235
|
-
};
|
|
236
|
-
return Object.keys(handle).length > 0 ? handle : void 0;
|
|
237
|
-
}
|
|
238
|
-
function createRouteStaticData(opts) {
|
|
239
|
-
const staticData = {};
|
|
240
|
-
if (opts.modernRouteId) staticData.modernRouteId = opts.modernRouteId;
|
|
241
|
-
if (opts.modernRouteAction) staticData.modernRouteAction = opts.modernRouteAction;
|
|
242
|
-
if (opts.modernRouteHandle) staticData.modernRouteHandle = opts.modernRouteHandle;
|
|
243
|
-
if (opts.modernRouteHasAction) staticData.modernRouteHasAction = true;
|
|
244
|
-
if (opts.modernRouteHasClientLoader) staticData.modernRouteHasClientLoader = true;
|
|
245
|
-
if (opts.modernRouteHasLoader) staticData.modernRouteHasLoader = true;
|
|
246
|
-
if (opts.modernRouteIsClientComponent) staticData.modernRouteIsClientComponent = true;
|
|
247
|
-
if (opts.modernRouteLoader) staticData.modernRouteLoader = opts.modernRouteLoader;
|
|
248
|
-
if (opts.modernRouteShouldRevalidate) staticData.modernRouteShouldRevalidate = opts.modernRouteShouldRevalidate;
|
|
249
|
-
return Object.keys(staticData).length > 0 ? staticData : void 0;
|
|
250
|
-
}
|
|
251
|
-
function createRouteFromRouteObject(opts) {
|
|
252
|
-
const { options = {}, parent, routeObject } = opts;
|
|
253
|
-
const modernRouteObject = routeObject;
|
|
254
|
-
const revalidationState = {};
|
|
255
|
-
const shouldRevalidate = modernRouteObject.shouldRevalidate;
|
|
256
|
-
const shouldReload = createModernShouldReload(shouldRevalidate, revalidationState);
|
|
257
|
-
const stableFallbackId = routeObject.id || modernRouteObject.file || routeObject.path || 'pathless';
|
|
258
|
-
const component = toRouteComponent(routeObject);
|
|
259
|
-
const base = {
|
|
260
|
-
getParentRoute: ()=>parent,
|
|
261
|
-
component,
|
|
262
|
-
pendingComponent: toPendingComponent(routeObject),
|
|
263
|
-
errorComponent: toErrorComponent(routeObject),
|
|
264
|
-
validateSearch: modernRouteObject.validateSearch,
|
|
265
|
-
loaderDeps: modernRouteObject.loaderDeps,
|
|
266
|
-
staticData: createRouteStaticData({
|
|
267
|
-
modernRouteId: routeObject.id,
|
|
268
|
-
modernRouteAction: modernRouteObject.action,
|
|
269
|
-
modernRouteHandle: mergeModernRouteHandle(modernRouteObject),
|
|
270
|
-
modernRouteHasAction: modernRouteObject.hasAction || Boolean(modernRouteObject.action),
|
|
271
|
-
modernRouteHasClientLoader: modernRouteObject.hasClientLoader || void 0 !== modernRouteObject.clientData,
|
|
272
|
-
modernRouteHasLoader: modernRouteObject.hasLoader || 'function' == typeof modernRouteObject.loader,
|
|
273
|
-
modernRouteIsClientComponent: modernRouteObject.isClientComponent,
|
|
274
|
-
modernRouteLoader: modernRouteObject.loader,
|
|
275
|
-
modernRouteShouldRevalidate: shouldRevalidate
|
|
276
|
-
}),
|
|
277
|
-
loader: wrapRouteObjectLoader(routeObject, revalidationState, options)
|
|
278
|
-
};
|
|
279
|
-
if (modernRouteObject.inValidSSRRoute) base.ssr = false;
|
|
280
|
-
if (shouldReload) base.shouldReload = shouldReload;
|
|
281
|
-
if (isRouteObjectPathlessLayout(routeObject)) base.id = stableFallbackId;
|
|
282
|
-
else base.path = routeObject.index ? '/' : toTanstackPath(routeObject.path || '');
|
|
283
|
-
const route = createTanstackRoute(base);
|
|
284
|
-
wrapRouteComponentWithModernContext(route, component, routeObject.id);
|
|
285
|
-
const children = routeObject.children;
|
|
286
|
-
if (children && children.length > 0) {
|
|
287
|
-
const childRoutes = children.map((child)=>createRouteFromRouteObject({
|
|
288
|
-
options,
|
|
289
|
-
parent: route,
|
|
290
|
-
routeObject: child
|
|
291
|
-
}));
|
|
292
|
-
route.addChildren(childRoutes);
|
|
293
|
-
}
|
|
294
|
-
return route;
|
|
295
|
-
}
|
|
296
|
-
function getRootLikeRouteObject(routes) {
|
|
297
|
-
return routes.find((route)=>'/' === route.path && !route.index);
|
|
298
|
-
}
|
|
299
|
-
function createRouteTreeFromRouteObjects(routes, options = {}) {
|
|
300
|
-
const rootLikeRoute = getRootLikeRouteObject(routes);
|
|
301
|
-
const rootRevalidationState = {};
|
|
302
|
-
const rootShouldRevalidate = rootLikeRoute?.shouldRevalidate;
|
|
303
|
-
const rootShouldReload = createModernShouldReload(rootShouldRevalidate, rootRevalidationState);
|
|
304
|
-
const rootComponent = rootLikeRoute ? toRouteComponent(rootLikeRoute) : void 0;
|
|
305
|
-
const rootRouteOptions = {
|
|
306
|
-
component: rootComponent,
|
|
307
|
-
pendingComponent: rootLikeRoute ? toPendingComponent(rootLikeRoute) : void 0,
|
|
308
|
-
errorComponent: rootLikeRoute ? toErrorComponent(rootLikeRoute) : void 0,
|
|
309
|
-
validateSearch: rootLikeRoute?.validateSearch,
|
|
310
|
-
loaderDeps: rootLikeRoute?.loaderDeps,
|
|
311
|
-
notFoundComponent: context_namespaceObject.DefaultNotFound,
|
|
312
|
-
staticData: createRouteStaticData({
|
|
313
|
-
modernRouteId: rootLikeRoute?.id,
|
|
314
|
-
modernRouteAction: rootLikeRoute?.action,
|
|
315
|
-
modernRouteHandle: rootLikeRoute ? mergeModernRouteHandle(rootLikeRoute) : void 0,
|
|
316
|
-
modernRouteHasAction: rootLikeRoute?.hasAction || Boolean(rootLikeRoute?.action),
|
|
317
|
-
modernRouteHasClientLoader: rootLikeRoute?.hasClientLoader || void 0 !== rootLikeRoute?.clientData,
|
|
318
|
-
modernRouteHasLoader: rootLikeRoute?.hasLoader || 'function' == typeof rootLikeRoute?.loader,
|
|
319
|
-
modernRouteIsClientComponent: rootLikeRoute?.isClientComponent,
|
|
320
|
-
modernRouteLoader: rootLikeRoute?.loader,
|
|
321
|
-
modernRouteShouldRevalidate: rootShouldRevalidate
|
|
322
|
-
}),
|
|
323
|
-
loader: rootLikeRoute ? wrapRouteObjectLoader(rootLikeRoute, rootRevalidationState, options) : void 0
|
|
324
|
-
};
|
|
325
|
-
if (rootShouldReload) rootRouteOptions.shouldReload = rootShouldReload;
|
|
326
|
-
if (rootLikeRoute?.inValidSSRRoute) rootRouteOptions.ssr = false;
|
|
327
|
-
const rootRoute = createTanstackRootRoute(rootRouteOptions);
|
|
328
|
-
if (rootComponent) rootRoute.options.component = (0, external_outlet_js_namespaceObject.withModernRouteMatchContext)(rootComponent, react_router_namespaceObject.rootRouteId);
|
|
329
|
-
const topLevel = rootLikeRoute ? [
|
|
330
|
-
...rootLikeRoute.children || [],
|
|
331
|
-
...routes.filter((route)=>route !== rootLikeRoute)
|
|
332
|
-
] : routes;
|
|
333
|
-
const childRoutes = topLevel.map((routeObject)=>createRouteFromRouteObject({
|
|
334
|
-
options,
|
|
335
|
-
parent: rootRoute,
|
|
336
|
-
routeObject
|
|
337
|
-
}));
|
|
338
|
-
rootRoute.addChildren(childRoutes);
|
|
339
|
-
return rootRoute;
|
|
340
|
-
}
|
|
341
|
-
function getModernRouteIdsFromMatches(router) {
|
|
342
|
-
const matches = router.state.matches || [];
|
|
343
|
-
const routesById = router.routesById;
|
|
344
|
-
const ids = matches.map((match)=>{
|
|
345
|
-
const normalizedMatch = match;
|
|
346
|
-
const routeId = 'string' == typeof normalizedMatch.routeId ? normalizedMatch.routeId : void 0;
|
|
347
|
-
return normalizedMatch.route?.options?.staticData?.modernRouteId ?? (routeId ? routesById?.[routeId]?.options?.staticData?.modernRouteId : void 0);
|
|
348
|
-
}).filter((id)=>'string' == typeof id);
|
|
349
|
-
return Array.from(new Set(ids));
|
|
350
|
-
}
|
|
35
|
+
const index_js_namespaceObject = require("./routeTree/index.js");
|
|
351
36
|
exports.createRouteTreeFromRouteObjects = __webpack_exports__.createRouteTreeFromRouteObjects;
|
|
352
37
|
exports.getModernRouteIdsFromMatches = __webpack_exports__.getModernRouteIdsFromMatches;
|
|
38
|
+
exports.pickRouteModuleComponent = __webpack_exports__.pickRouteModuleComponent;
|
|
353
39
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
354
40
|
"createRouteTreeFromRouteObjects",
|
|
355
|
-
"getModernRouteIdsFromMatches"
|
|
41
|
+
"getModernRouteIdsFromMatches",
|
|
42
|
+
"pickRouteModuleComponent"
|
|
356
43
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
357
44
|
Object.defineProperty(exports, '__esModule', {
|
|
358
45
|
value: true
|
|
@@ -28,10 +28,23 @@ var __webpack_require__ = {};
|
|
|
28
28
|
var __webpack_exports__ = {};
|
|
29
29
|
__webpack_require__.r(__webpack_exports__);
|
|
30
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
routerPlugin: ()=>
|
|
31
|
+
routerPlugin: ()=>routerPlugin
|
|
32
32
|
});
|
|
33
|
-
require("./register.js");
|
|
34
33
|
const internal_namespaceObject = require("@modern-js/runtime/router/internal");
|
|
34
|
+
const external_register_js_namespaceObject = require("./register.js");
|
|
35
|
+
function getRouterPlugin() {
|
|
36
|
+
const createRouterPlugin = Reflect.get(internal_namespaceObject, 'createRouterPlugin');
|
|
37
|
+
if ('function' == typeof createRouterPlugin) return createRouterPlugin([
|
|
38
|
+
{
|
|
39
|
+
name: 'tanstack',
|
|
40
|
+
factory: external_register_js_namespaceObject.tanstackRouterProviderFactory
|
|
41
|
+
}
|
|
42
|
+
]);
|
|
43
|
+
const legacyRouterPlugin = Reflect.get(internal_namespaceObject, 'routerPlugin');
|
|
44
|
+
if ('function' == typeof legacyRouterPlugin) return external_register_js_namespaceObject.tanstackRouterProviderFactory;
|
|
45
|
+
throw new Error('[@modern-js/plugin-tanstack] The installed @modern-js/runtime/router/internal exports neither createRouterPlugin nor routerPlugin. Install a compatible @modern-js/runtime version.');
|
|
46
|
+
}
|
|
47
|
+
const routerPlugin = getRouterPlugin();
|
|
35
48
|
exports.routerPlugin = __webpack_exports__.routerPlugin;
|
|
36
49
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
37
50
|
"routerPlugin"
|
|
@@ -34,22 +34,27 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
34
34
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
35
35
|
const external_react_namespaceObject = require("react");
|
|
36
36
|
const external_SlotContext_js_namespaceObject = require("./SlotContext.js");
|
|
37
|
+
const external_shared_js_namespaceObject = require("./shared.js");
|
|
37
38
|
const external_symbols_js_namespaceObject = require("./symbols.js");
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
const external_treeGetter_js_namespaceObject = require("./treeGetter.js");
|
|
40
|
+
const rawServerValueGetters = new WeakMap();
|
|
41
|
+
function getRawServerTreeGetter(src) {
|
|
42
|
+
if (!src || 'object' != typeof src && 'function' != typeof src) return;
|
|
43
|
+
const source = src;
|
|
44
|
+
const stream = source[external_symbols_js_namespaceObject.SERVER_COMPONENT_STREAM];
|
|
45
|
+
if ('function' != typeof stream?.createReplayStream) return;
|
|
46
|
+
let getTree = rawServerValueGetters.get(src);
|
|
47
|
+
if (!getTree) {
|
|
48
|
+
getTree = (0, external_treeGetter_js_namespaceObject.createTreeGetterFromFlightStream)(stream.createReplayStream());
|
|
49
|
+
rawServerValueGetters.set(src, getTree);
|
|
46
50
|
}
|
|
47
|
-
return
|
|
51
|
+
return getTree;
|
|
48
52
|
}
|
|
49
53
|
function CompositeInner({ slotProps, src, strict }) {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
const tree = (0, external_shared_js_namespaceObject.renderSelectedTree)(src, {
|
|
55
|
+
getTree: src[external_symbols_js_namespaceObject.RSC_PROXY_GET_TREE] || getRawServerTreeGetter(src),
|
|
56
|
+
missingTreeError: 'CompositeComponent src must come from createCompositeComponent().'
|
|
57
|
+
});
|
|
53
58
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_SlotContext_js_namespaceObject.SlotProvider, {
|
|
54
59
|
implementations: slotProps,
|
|
55
60
|
strict: strict,
|
|
@@ -59,7 +64,7 @@ function CompositeInner({ slotProps, src, strict }) {
|
|
|
59
64
|
function CompositeComponent(props) {
|
|
60
65
|
const { children, src, strict, ...slotProps } = props;
|
|
61
66
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_namespaceObject.Suspense, {
|
|
62
|
-
fallback: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(EmptyFallback, {}),
|
|
67
|
+
fallback: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_shared_js_namespaceObject.EmptyFallback, {}),
|
|
63
68
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(CompositeInner, {
|
|
64
69
|
slotProps: {
|
|
65
70
|
...slotProps,
|
|
@@ -132,13 +132,9 @@ _REPLAYABLE_STREAM_MARKER = REPLAYABLE_STREAM_MARKER;
|
|
|
132
132
|
var _REPLAYABLE_STREAM_MARKER;
|
|
133
133
|
__webpack_require__.d(__webpack_exports__, {
|
|
134
134
|
ReplayableStream: ()=>ReplayableStream
|
|
135
|
-
}, {
|
|
136
|
-
REPLAYABLE_STREAM_MARKER: REPLAYABLE_STREAM_MARKER
|
|
137
135
|
});
|
|
138
|
-
exports.REPLAYABLE_STREAM_MARKER = __webpack_exports__.REPLAYABLE_STREAM_MARKER;
|
|
139
136
|
exports.ReplayableStream = __webpack_exports__.ReplayableStream;
|
|
140
137
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
141
|
-
"REPLAYABLE_STREAM_MARKER",
|
|
142
138
|
"ReplayableStream"
|
|
143
139
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
144
140
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -33,28 +33,17 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
33
33
|
});
|
|
34
34
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
35
35
|
const external_react_namespaceObject = require("react");
|
|
36
|
-
const
|
|
37
|
-
function EmptyFallback() {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
function selectTreePath(tree, path) {
|
|
41
|
-
let current = tree;
|
|
42
|
-
for (const key of path){
|
|
43
|
-
if (null === current || 'object' != typeof current) return null;
|
|
44
|
-
current = current[key];
|
|
45
|
-
}
|
|
46
|
-
return current;
|
|
47
|
-
}
|
|
36
|
+
const external_shared_js_namespaceObject = require("./shared.js");
|
|
48
37
|
function RscNodeRenderInner({ data }) {
|
|
49
|
-
const getTree = data[external_symbols_js_namespaceObject.RSC_PROXY_GET_TREE];
|
|
50
|
-
if (!getTree) throw new Error('Renderable RSC is missing its decoded tree getter.');
|
|
51
38
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
|
|
52
|
-
children:
|
|
39
|
+
children: (0, external_shared_js_namespaceObject.renderSelectedTree)(data, {
|
|
40
|
+
missingTreeError: 'Renderable RSC is missing its decoded tree getter.'
|
|
41
|
+
})
|
|
53
42
|
});
|
|
54
43
|
}
|
|
55
44
|
function RscNodeRenderer({ data }) {
|
|
56
45
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_namespaceObject.Suspense, {
|
|
57
|
-
fallback: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(EmptyFallback, {}),
|
|
46
|
+
fallback: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_shared_js_namespaceObject.EmptyFallback, {}),
|
|
58
47
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(RscNodeRenderInner, {
|
|
59
48
|
data: data
|
|
60
49
|
})
|
|
@@ -30,46 +30,27 @@ var __webpack_exports__ = {};
|
|
|
30
30
|
__webpack_require__.r(__webpack_exports__);
|
|
31
31
|
__webpack_require__.d(__webpack_exports__, {
|
|
32
32
|
CompositeComponent: ()=>external_CompositeComponent_js_namespaceObject.CompositeComponent,
|
|
33
|
+
createTanstackRscValueFromFlight: ()=>createTanstackRscValueFromFlight,
|
|
33
34
|
getTanstackRscSerializationAdapters: ()=>getTanstackRscSerializationAdapters,
|
|
34
35
|
rscSerializationAdapter: ()=>rscSerializationAdapter
|
|
35
36
|
});
|
|
36
37
|
const react_router_namespaceObject = require("@tanstack/react-router");
|
|
37
|
-
const external_react_namespaceObject = require("react");
|
|
38
38
|
const external_CompositeComponent_js_namespaceObject = require("./CompositeComponent.js");
|
|
39
39
|
const external_createRscProxy_js_namespaceObject = require("./createRscProxy.js");
|
|
40
|
-
|
|
41
|
-
function loadModernRscClientRuntime() {
|
|
42
|
-
modernRscClientRuntimePromise ??= import("@modern-js/runtime/rsc/client").then((runtime)=>{
|
|
43
|
-
runtime.setServerCallback(runtime.callServer);
|
|
44
|
-
return runtime;
|
|
45
|
-
});
|
|
46
|
-
return modernRscClientRuntimePromise;
|
|
47
|
-
}
|
|
48
|
-
function createTreeGetter(stream) {
|
|
49
|
-
let ready = false;
|
|
50
|
-
let tree;
|
|
51
|
-
const treePromise = loadModernRscClientRuntime().then((runtime)=>runtime.createFromReadableStream(stream, {
|
|
52
|
-
callServer: runtime.callServer
|
|
53
|
-
})).then((value)=>{
|
|
54
|
-
tree = value;
|
|
55
|
-
ready = true;
|
|
56
|
-
return value;
|
|
57
|
-
});
|
|
58
|
-
return ()=>{
|
|
59
|
-
if (ready) return tree;
|
|
60
|
-
return (0, external_react_namespaceObject.use)(treePromise);
|
|
61
|
-
};
|
|
62
|
-
}
|
|
40
|
+
const external_treeGetter_js_namespaceObject = require("./treeGetter.js");
|
|
63
41
|
function createFromFlightStream(serialized) {
|
|
64
42
|
const streamWrapper = {
|
|
65
43
|
createReplayStream: ()=>serialized.stream
|
|
66
44
|
};
|
|
67
|
-
return (0, external_createRscProxy_js_namespaceObject.createRscProxy)(
|
|
45
|
+
return (0, external_createRscProxy_js_namespaceObject.createRscProxy)((0, external_treeGetter_js_namespaceObject.createTreeGetterFromFlightStream)(serialized.stream), {
|
|
68
46
|
renderable: 'renderable' === serialized.kind,
|
|
69
47
|
slotUsagesStream: serialized.slotUsagesStream,
|
|
70
48
|
stream: streamWrapper
|
|
71
49
|
});
|
|
72
50
|
}
|
|
51
|
+
function createTanstackRscValueFromFlight(serialized) {
|
|
52
|
+
return createFromFlightStream(serialized);
|
|
53
|
+
}
|
|
73
54
|
const adapter = (0, react_router_namespaceObject.createSerializationAdapter)({
|
|
74
55
|
key: '$MODERN_TANSTACK_RSC',
|
|
75
56
|
test: (_value)=>false,
|
|
@@ -85,10 +66,12 @@ function getTanstackRscSerializationAdapters() {
|
|
|
85
66
|
}
|
|
86
67
|
const rscSerializationAdapter = getTanstackRscSerializationAdapters;
|
|
87
68
|
exports.CompositeComponent = __webpack_exports__.CompositeComponent;
|
|
69
|
+
exports.createTanstackRscValueFromFlight = __webpack_exports__.createTanstackRscValueFromFlight;
|
|
88
70
|
exports.getTanstackRscSerializationAdapters = __webpack_exports__.getTanstackRscSerializationAdapters;
|
|
89
71
|
exports.rscSerializationAdapter = __webpack_exports__.rscSerializationAdapter;
|
|
90
72
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
91
73
|
"CompositeComponent",
|
|
74
|
+
"createTanstackRscValueFromFlight",
|
|
92
75
|
"getTanstackRscSerializationAdapters",
|
|
93
76
|
"rscSerializationAdapter"
|
|
94
77
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
isPlainObject: ()=>isPlainObject,
|
|
32
|
+
reviveTanstackRscFlightValues: ()=>reviveTanstackRscFlightValues,
|
|
33
|
+
serializeTanstackRscFlightValues: ()=>serializeTanstackRscFlightValues
|
|
34
|
+
});
|
|
35
|
+
const external_shared_js_namespaceObject = require("./shared.js");
|
|
36
|
+
const external_symbols_js_namespaceObject = require("./symbols.js");
|
|
37
|
+
function isPlainObject(value) {
|
|
38
|
+
if (!value || 'object' != typeof value) return false;
|
|
39
|
+
const prototype = Object.getPrototypeOf(value);
|
|
40
|
+
return prototype === Object.prototype || null === prototype;
|
|
41
|
+
}
|
|
42
|
+
function serializeTanstackRscFlightValues(value, seen = new WeakMap()) {
|
|
43
|
+
if ((0, external_symbols_js_namespaceObject.isServerComponent)(value)) {
|
|
44
|
+
const streamWrapper = value[external_symbols_js_namespaceObject.SERVER_COMPONENT_STREAM];
|
|
45
|
+
if (!streamWrapper) throw new Error('Cannot serialize TanStack RSC without a Flight stream.');
|
|
46
|
+
const kind = (0, external_symbols_js_namespaceObject.isRenderableServerComponent)(value) ? 'renderable' : 'composite';
|
|
47
|
+
const slotUsagesStream = 'development' === process.env.NODE_ENV && 'composite' === kind ? value[external_symbols_js_namespaceObject.RSC_SLOT_USAGES_STREAM] : void 0;
|
|
48
|
+
return {
|
|
49
|
+
[external_shared_js_namespaceObject.TANSTACK_RSC_FLIGHT_VALUE]: true,
|
|
50
|
+
kind,
|
|
51
|
+
stream: streamWrapper.createReplayStream(),
|
|
52
|
+
...slotUsagesStream ? {
|
|
53
|
+
slotUsagesStream
|
|
54
|
+
} : {}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (!value || 'object' != typeof value) return value;
|
|
58
|
+
if (seen.has(value)) return seen.get(value);
|
|
59
|
+
if (value instanceof Map) {
|
|
60
|
+
const result = new Map();
|
|
61
|
+
seen.set(value, result);
|
|
62
|
+
for (const [key, item] of value)result.set(serializeTanstackRscFlightValues(key, seen), serializeTanstackRscFlightValues(item, seen));
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
if (value instanceof Set) {
|
|
66
|
+
const result = new Set();
|
|
67
|
+
seen.set(value, result);
|
|
68
|
+
for (const item of value)result.add(serializeTanstackRscFlightValues(item, seen));
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
if (Array.isArray(value)) {
|
|
72
|
+
const result = [];
|
|
73
|
+
seen.set(value, result);
|
|
74
|
+
for (const item of value)result.push(serializeTanstackRscFlightValues(item, seen));
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
if (!isPlainObject(value)) return value;
|
|
78
|
+
const result = {};
|
|
79
|
+
seen.set(value, result);
|
|
80
|
+
for (const [key, item] of Object.entries(value))result[key] = serializeTanstackRscFlightValues(item, seen);
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
async function reviveTanstackRscFlightValues(value, seen = new WeakMap()) {
|
|
84
|
+
let reviver;
|
|
85
|
+
const getReviver = async ()=>{
|
|
86
|
+
if (!reviver) {
|
|
87
|
+
const client = await import("./client.js");
|
|
88
|
+
reviver = client.createTanstackRscValueFromFlight;
|
|
89
|
+
}
|
|
90
|
+
return reviver;
|
|
91
|
+
};
|
|
92
|
+
const visit = async (current)=>{
|
|
93
|
+
if ((0, external_shared_js_namespaceObject.isSerializedTanstackRscFlightValue)(current)) return (await getReviver())(current);
|
|
94
|
+
if (!current || 'object' != typeof current) return current;
|
|
95
|
+
if (seen.has(current)) return seen.get(current);
|
|
96
|
+
if (current instanceof Map) {
|
|
97
|
+
const result = new Map();
|
|
98
|
+
seen.set(current, result);
|
|
99
|
+
for (const [key, item] of current)result.set(await visit(key), await visit(item));
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
if (current instanceof Set) {
|
|
103
|
+
const result = new Set();
|
|
104
|
+
seen.set(current, result);
|
|
105
|
+
for (const item of current)result.add(await visit(item));
|
|
106
|
+
return result;
|
|
107
|
+
}
|
|
108
|
+
if (Array.isArray(current)) {
|
|
109
|
+
const result = [];
|
|
110
|
+
seen.set(current, result);
|
|
111
|
+
for (const item of current)result.push(await visit(item));
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
if (!isPlainObject(current)) return current;
|
|
115
|
+
const result = {};
|
|
116
|
+
seen.set(current, result);
|
|
117
|
+
for (const [key, item] of Object.entries(current))result[key] = await visit(item);
|
|
118
|
+
return result;
|
|
119
|
+
};
|
|
120
|
+
return visit(value);
|
|
121
|
+
}
|
|
122
|
+
exports.isPlainObject = __webpack_exports__.isPlainObject;
|
|
123
|
+
exports.reviveTanstackRscFlightValues = __webpack_exports__.reviveTanstackRscFlightValues;
|
|
124
|
+
exports.serializeTanstackRscFlightValues = __webpack_exports__.serializeTanstackRscFlightValues;
|
|
125
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
126
|
+
"isPlainObject",
|
|
127
|
+
"reviveTanstackRscFlightValues",
|
|
128
|
+
"serializeTanstackRscFlightValues"
|
|
129
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
130
|
+
Object.defineProperty(exports, '__esModule', {
|
|
131
|
+
value: true
|
|
132
|
+
});
|