@bleedingdev/modern-js-plugin-tanstack 3.2.0-ultramodern.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.
- package/LICENSE +21 -0
- package/dist/cjs/cli/index.js +268 -0
- package/dist/cjs/cli/tanstackTypes.js +388 -0
- package/dist/cjs/cli.js +65 -0
- package/dist/cjs/runtime/DefaultNotFound.js +47 -0
- package/dist/cjs/runtime/basepathRewrite.js +62 -0
- package/dist/cjs/runtime/dataMutation.js +345 -0
- package/dist/cjs/runtime/hooks.js +57 -0
- package/dist/cjs/runtime/index.js +114 -0
- package/dist/cjs/runtime/lifecycle.js +125 -0
- package/dist/cjs/runtime/plugin.js +250 -0
- package/dist/cjs/runtime/plugin.node.js +304 -0
- package/dist/cjs/runtime/prefetchLink.js +55 -0
- package/dist/cjs/runtime/routeTree.js +492 -0
- package/dist/cjs/runtime/rsc/ClientSlot.js +53 -0
- package/dist/cjs/runtime/rsc/CompositeComponent.js +75 -0
- package/dist/cjs/runtime/rsc/ReplayableStream.js +141 -0
- package/dist/cjs/runtime/rsc/RscNodeRenderer.js +65 -0
- package/dist/cjs/runtime/rsc/SlotContext.js +54 -0
- package/dist/cjs/runtime/rsc/client.js +93 -0
- package/dist/cjs/runtime/rsc/createRscProxy.js +141 -0
- package/dist/cjs/runtime/rsc/index.js +42 -0
- package/dist/cjs/runtime/rsc/payloadRouter.js +211 -0
- package/dist/cjs/runtime/rsc/server.js +246 -0
- package/dist/cjs/runtime/rsc/slotUsageSanitizer.js +65 -0
- package/dist/cjs/runtime/rsc/symbols.js +72 -0
- package/dist/cjs/runtime/types.js +18 -0
- package/dist/cjs/runtime/utils.js +142 -0
- package/dist/cjs/runtime.js +58 -0
- package/dist/esm/cli/index.mjs +201 -0
- package/dist/esm/cli/tanstackTypes.mjs +341 -0
- package/dist/esm/cli.mjs +2 -0
- package/dist/esm/rslib-runtime.mjs +18 -0
- package/dist/esm/runtime/DefaultNotFound.mjs +13 -0
- package/dist/esm/runtime/basepathRewrite.mjs +28 -0
- package/dist/esm/runtime/dataMutation.mjs +305 -0
- package/dist/esm/runtime/hooks.mjs +8 -0
- package/dist/esm/runtime/index.mjs +6 -0
- package/dist/esm/runtime/lifecycle.mjs +82 -0
- package/dist/esm/runtime/plugin.mjs +214 -0
- package/dist/esm/runtime/plugin.node.mjs +268 -0
- package/dist/esm/runtime/prefetchLink.mjs +18 -0
- package/dist/esm/runtime/routeTree.mjs +452 -0
- package/dist/esm/runtime/rsc/ClientSlot.mjs +19 -0
- package/dist/esm/runtime/rsc/CompositeComponent.mjs +41 -0
- package/dist/esm/runtime/rsc/ReplayableStream.mjs +104 -0
- package/dist/esm/runtime/rsc/RscNodeRenderer.mjs +31 -0
- package/dist/esm/runtime/rsc/SlotContext.mjs +17 -0
- package/dist/esm/runtime/rsc/client.mjs +53 -0
- package/dist/esm/runtime/rsc/createRscProxy.mjs +107 -0
- package/dist/esm/runtime/rsc/index.mjs +1 -0
- package/dist/esm/runtime/rsc/payloadRouter.mjs +162 -0
- package/dist/esm/runtime/rsc/server.mjs +200 -0
- package/dist/esm/runtime/rsc/slotUsageSanitizer.mjs +31 -0
- package/dist/esm/runtime/rsc/symbols.mjs +17 -0
- package/dist/esm/runtime/types.mjs +0 -0
- package/dist/esm/runtime/utils.mjs +89 -0
- package/dist/esm/runtime.mjs +1 -0
- package/dist/esm-node/cli/index.mjs +205 -0
- package/dist/esm-node/cli/tanstackTypes.mjs +342 -0
- package/dist/esm-node/cli.mjs +3 -0
- package/dist/esm-node/rslib-runtime.mjs +19 -0
- package/dist/esm-node/runtime/DefaultNotFound.mjs +14 -0
- package/dist/esm-node/runtime/basepathRewrite.mjs +29 -0
- package/dist/esm-node/runtime/dataMutation.mjs +306 -0
- package/dist/esm-node/runtime/hooks.mjs +9 -0
- package/dist/esm-node/runtime/index.mjs +7 -0
- package/dist/esm-node/runtime/lifecycle.mjs +83 -0
- package/dist/esm-node/runtime/plugin.mjs +215 -0
- package/dist/esm-node/runtime/plugin.node.mjs +269 -0
- package/dist/esm-node/runtime/prefetchLink.mjs +19 -0
- package/dist/esm-node/runtime/routeTree.mjs +453 -0
- package/dist/esm-node/runtime/rsc/ClientSlot.mjs +20 -0
- package/dist/esm-node/runtime/rsc/CompositeComponent.mjs +42 -0
- package/dist/esm-node/runtime/rsc/ReplayableStream.mjs +105 -0
- package/dist/esm-node/runtime/rsc/RscNodeRenderer.mjs +32 -0
- package/dist/esm-node/runtime/rsc/SlotContext.mjs +18 -0
- package/dist/esm-node/runtime/rsc/client.mjs +54 -0
- package/dist/esm-node/runtime/rsc/createRscProxy.mjs +108 -0
- package/dist/esm-node/runtime/rsc/index.mjs +2 -0
- package/dist/esm-node/runtime/rsc/payloadRouter.mjs +163 -0
- package/dist/esm-node/runtime/rsc/server.mjs +201 -0
- package/dist/esm-node/runtime/rsc/slotUsageSanitizer.mjs +32 -0
- package/dist/esm-node/runtime/rsc/symbols.mjs +18 -0
- package/dist/esm-node/runtime/types.mjs +1 -0
- package/dist/esm-node/runtime/utils.mjs +90 -0
- package/dist/esm-node/runtime.mjs +2 -0
- package/dist/types/cli/index.d.ts +20 -0
- package/dist/types/cli/tanstackTypes.d.ts +11 -0
- package/dist/types/cli.d.ts +2 -0
- package/dist/types/runtime/DefaultNotFound.d.ts +2 -0
- package/dist/types/runtime/basepathRewrite.d.ts +8 -0
- package/dist/types/runtime/dataMutation.d.ts +29 -0
- package/dist/types/runtime/hooks.d.ts +18 -0
- package/dist/types/runtime/index.d.ts +9 -0
- package/dist/types/runtime/lifecycle.d.ts +22 -0
- package/dist/types/runtime/plugin.d.ts +17 -0
- package/dist/types/runtime/plugin.node.d.ts +17 -0
- package/dist/types/runtime/prefetchLink.d.ts +11 -0
- package/dist/types/runtime/routeTree.d.ts +11 -0
- package/dist/types/runtime/rsc/ClientSlot.d.ts +5 -0
- package/dist/types/runtime/rsc/CompositeComponent.d.ts +3 -0
- package/dist/types/runtime/rsc/ReplayableStream.d.ts +24 -0
- package/dist/types/runtime/rsc/RscNodeRenderer.d.ts +5 -0
- package/dist/types/runtime/rsc/SlotContext.d.ts +11 -0
- package/dist/types/runtime/rsc/client.d.ts +11 -0
- package/dist/types/runtime/rsc/createRscProxy.d.ts +7 -0
- package/dist/types/runtime/rsc/index.d.ts +2 -0
- package/dist/types/runtime/rsc/payloadRouter.d.ts +24 -0
- package/dist/types/runtime/rsc/server.d.ts +14 -0
- package/dist/types/runtime/rsc/slotUsageSanitizer.d.ts +2 -0
- package/dist/types/runtime/rsc/symbols.d.ts +46 -0
- package/dist/types/runtime/types.d.ts +68 -0
- package/dist/types/runtime/utils.d.ts +36 -0
- package/dist/types/runtime.d.ts +1 -0
- package/dist/types-direct/cli/index.d.ts +20 -0
- package/dist/types-direct/cli/tanstackTypes.d.ts +11 -0
- package/dist/types-direct/cli.d.ts +2 -0
- package/dist/types-direct/runtime/DefaultNotFound.d.ts +2 -0
- package/dist/types-direct/runtime/basepathRewrite.d.ts +8 -0
- package/dist/types-direct/runtime/dataMutation.d.ts +29 -0
- package/dist/types-direct/runtime/hooks.d.ts +18 -0
- package/dist/types-direct/runtime/index.d.ts +9 -0
- package/dist/types-direct/runtime/lifecycle.d.ts +22 -0
- package/dist/types-direct/runtime/plugin.d.ts +17 -0
- package/dist/types-direct/runtime/plugin.node.d.ts +17 -0
- package/dist/types-direct/runtime/prefetchLink.d.ts +11 -0
- package/dist/types-direct/runtime/routeTree.d.ts +11 -0
- package/dist/types-direct/runtime/rsc/ClientSlot.d.ts +5 -0
- package/dist/types-direct/runtime/rsc/CompositeComponent.d.ts +3 -0
- package/dist/types-direct/runtime/rsc/ReplayableStream.d.ts +24 -0
- package/dist/types-direct/runtime/rsc/RscNodeRenderer.d.ts +5 -0
- package/dist/types-direct/runtime/rsc/SlotContext.d.ts +11 -0
- package/dist/types-direct/runtime/rsc/client.d.ts +11 -0
- package/dist/types-direct/runtime/rsc/createRscProxy.d.ts +7 -0
- package/dist/types-direct/runtime/rsc/index.d.ts +2 -0
- package/dist/types-direct/runtime/rsc/payloadRouter.d.ts +24 -0
- package/dist/types-direct/runtime/rsc/server.d.ts +14 -0
- package/dist/types-direct/runtime/rsc/slotUsageSanitizer.d.ts +2 -0
- package/dist/types-direct/runtime/rsc/symbols.d.ts +46 -0
- package/dist/types-direct/runtime/types.d.ts +68 -0
- package/dist/types-direct/runtime/utils.d.ts +36 -0
- package/dist/types-direct/runtime.d.ts +1 -0
- package/package.json +126 -0
- package/rslib.config.mts +4 -0
- package/rstest.config.mts +43 -0
- package/src/cli/index.ts +388 -0
- package/src/cli/tanstackTypes.ts +503 -0
- package/src/cli.ts +2 -0
- package/src/runtime/DefaultNotFound.tsx +15 -0
- package/src/runtime/basepathRewrite.ts +59 -0
- package/src/runtime/dataMutation.tsx +517 -0
- package/src/runtime/hooks.ts +34 -0
- package/src/runtime/index.tsx +30 -0
- package/src/runtime/lifecycle.ts +150 -0
- package/src/runtime/plugin.node.tsx +534 -0
- package/src/runtime/plugin.tsx +395 -0
- package/src/runtime/prefetchLink.tsx +87 -0
- package/src/runtime/routeTree.ts +942 -0
- package/src/runtime/rsc/ClientSlot.tsx +25 -0
- package/src/runtime/rsc/CompositeComponent.tsx +65 -0
- package/src/runtime/rsc/ReplayableStream.ts +155 -0
- package/src/runtime/rsc/RscNodeRenderer.tsx +45 -0
- package/src/runtime/rsc/SlotContext.tsx +31 -0
- package/src/runtime/rsc/client.tsx +90 -0
- package/src/runtime/rsc/createRscProxy.tsx +189 -0
- package/src/runtime/rsc/index.ts +10 -0
- package/src/runtime/rsc/payloadRouter.ts +318 -0
- package/src/runtime/rsc/server.tsx +303 -0
- package/src/runtime/rsc/slotUsageSanitizer.ts +76 -0
- package/src/runtime/rsc/symbols.ts +106 -0
- package/src/runtime/ssr-shim.d.ts +12 -0
- package/src/runtime/types.ts +83 -0
- package/src/runtime/utils.tsx +161 -0
- package/src/runtime.ts +1 -0
- package/tests/router/cli.test.ts +386 -0
- package/tests/router/dataMutation.test.tsx +396 -0
- package/tests/router/prefetchLink.test.tsx +43 -0
- package/tests/router/routeTree.test.ts +502 -0
- package/tests/router/rsc.test.tsx +256 -0
- package/tests/router/tanstackTypes.test.ts +62 -0
- package/tsconfig.json +12 -0
- package/tsconfig.tsgo.json +6 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
Link: ()=>Link,
|
|
28
|
+
NavLink: ()=>NavLink
|
|
29
|
+
});
|
|
30
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
+
const react_router_namespaceObject = require("@tanstack/react-router");
|
|
32
|
+
function resolvePreloadFromPrefetch(prefetch, preload) {
|
|
33
|
+
if (void 0 !== preload) return preload;
|
|
34
|
+
if ('none' === prefetch) return false;
|
|
35
|
+
if ('intent' === prefetch || 'render' === prefetch || 'viewport' === prefetch) return prefetch;
|
|
36
|
+
return preload;
|
|
37
|
+
}
|
|
38
|
+
const LinkComponentImpl = (props)=>{
|
|
39
|
+
const { prefetch, preload, ...rest } = props;
|
|
40
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_router_namespaceObject.Link, {
|
|
41
|
+
...rest,
|
|
42
|
+
preload: resolvePreloadFromPrefetch(prefetch, preload)
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
const Link = LinkComponentImpl;
|
|
46
|
+
const NavLink = LinkComponentImpl;
|
|
47
|
+
exports.Link = __webpack_exports__.Link;
|
|
48
|
+
exports.NavLink = __webpack_exports__.NavLink;
|
|
49
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
50
|
+
"Link",
|
|
51
|
+
"NavLink"
|
|
52
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
53
|
+
Object.defineProperty(exports, '__esModule', {
|
|
54
|
+
value: true
|
|
55
|
+
});
|
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
createRouteTreeFromModernRoutes: ()=>createRouteTreeFromModernRoutes,
|
|
28
|
+
createRouteTreeFromRouteObjects: ()=>createRouteTreeFromRouteObjects,
|
|
29
|
+
getModernRouteIdsFromMatches: ()=>getModernRouteIdsFromMatches
|
|
30
|
+
});
|
|
31
|
+
const react_router_namespaceObject = require("@tanstack/react-router");
|
|
32
|
+
const external_DefaultNotFound_js_namespaceObject = require("./DefaultNotFound.js");
|
|
33
|
+
const payloadRouter_js_namespaceObject = require("./rsc/payloadRouter.js");
|
|
34
|
+
function createTanstackRoute(options) {
|
|
35
|
+
return (0, react_router_namespaceObject.createRoute)(options);
|
|
36
|
+
}
|
|
37
|
+
function createTanstackRootRoute(options) {
|
|
38
|
+
return (0, react_router_namespaceObject.createRootRoute)(options);
|
|
39
|
+
}
|
|
40
|
+
function toTanstackPath(pathname) {
|
|
41
|
+
return pathname.split('/').map((segment)=>{
|
|
42
|
+
if (!segment) return segment;
|
|
43
|
+
if ('*' === segment) return '$';
|
|
44
|
+
if (segment.startsWith(':')) {
|
|
45
|
+
const name = segment.slice(1);
|
|
46
|
+
if (name.endsWith('?')) return `{-$${name.slice(0, -1)}}`;
|
|
47
|
+
return `$${name}`;
|
|
48
|
+
}
|
|
49
|
+
return segment;
|
|
50
|
+
}).join('/');
|
|
51
|
+
}
|
|
52
|
+
function isResponse(value) {
|
|
53
|
+
const record = value;
|
|
54
|
+
return null != record && 'object' == typeof record && 'number' == typeof record.status && 'object' == typeof record.headers;
|
|
55
|
+
}
|
|
56
|
+
function isTanstackRedirect(value) {
|
|
57
|
+
return isResponse(value) && 'object' == typeof value.options;
|
|
58
|
+
}
|
|
59
|
+
const redirectStatusCodes = new Set([
|
|
60
|
+
301,
|
|
61
|
+
302,
|
|
62
|
+
303,
|
|
63
|
+
307,
|
|
64
|
+
308
|
|
65
|
+
]);
|
|
66
|
+
function isRedirectResponse(res) {
|
|
67
|
+
return redirectStatusCodes.has(res.status);
|
|
68
|
+
}
|
|
69
|
+
function isModernDeferredData(value) {
|
|
70
|
+
if (!value || 'object' != typeof value) return false;
|
|
71
|
+
const deferred = value;
|
|
72
|
+
return true === deferred.__modern_deferred && Boolean(deferred.data) && 'object' == typeof deferred.data && !Array.isArray(deferred.data);
|
|
73
|
+
}
|
|
74
|
+
function normalizeModernLoaderResult(result) {
|
|
75
|
+
return isModernDeferredData(result) ? result.data : result;
|
|
76
|
+
}
|
|
77
|
+
function normalizeModernLoaderResponse(result) {
|
|
78
|
+
if (isResponse(result)) {
|
|
79
|
+
if (isRedirectResponse(result)) {
|
|
80
|
+
const location = result.headers.get('Location') || '/';
|
|
81
|
+
throwTanstackRedirect(location);
|
|
82
|
+
}
|
|
83
|
+
if (404 === result.status) throw (0, react_router_namespaceObject.notFound)();
|
|
84
|
+
}
|
|
85
|
+
return normalizeModernLoaderResult(result);
|
|
86
|
+
}
|
|
87
|
+
function isAbsoluteUrl(value) {
|
|
88
|
+
try {
|
|
89
|
+
new URL(value);
|
|
90
|
+
return true;
|
|
91
|
+
} catch {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function throwTanstackRedirect(location) {
|
|
96
|
+
const target = location || '/';
|
|
97
|
+
if (isAbsoluteUrl(target)) throw (0, react_router_namespaceObject.redirect)({
|
|
98
|
+
href: target
|
|
99
|
+
});
|
|
100
|
+
throw (0, react_router_namespaceObject.redirect)({
|
|
101
|
+
to: target
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function mapParamsForModernLoader({ modernRoute, params }) {
|
|
105
|
+
if ('nested' === modernRoute.type && modernRoute.path?.includes('*')) {
|
|
106
|
+
const { _splat, ...rest } = params;
|
|
107
|
+
if (void 0 !== _splat) return {
|
|
108
|
+
...rest,
|
|
109
|
+
'*': _splat
|
|
110
|
+
};
|
|
111
|
+
return rest;
|
|
112
|
+
}
|
|
113
|
+
return params;
|
|
114
|
+
}
|
|
115
|
+
function createModernRequest(input, signal) {
|
|
116
|
+
return new Request(input, {
|
|
117
|
+
signal
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function getModernUrlFromLoaderContext(ctx) {
|
|
121
|
+
const href = 'string' == typeof ctx?.location ? ctx.location : ctx?.location?.publicHref || ctx?.location?.href || ctx?.location?.url?.href || '/';
|
|
122
|
+
const baseRequest = ctx?.context?.request instanceof Request ? ctx.context.request : void 0;
|
|
123
|
+
const baseUrl = baseRequest?.url || ("u" > typeof window ? window.origin : 'http://localhost');
|
|
124
|
+
return new URL(href || '/', baseUrl);
|
|
125
|
+
}
|
|
126
|
+
function rememberRouteLocation(state, ctx) {
|
|
127
|
+
state.currentUrl = getModernUrlFromLoaderContext(ctx);
|
|
128
|
+
state.currentParams = ctx?.params || {};
|
|
129
|
+
}
|
|
130
|
+
function createModernShouldReload(shouldRevalidate, state) {
|
|
131
|
+
if ('function' != typeof shouldRevalidate) return;
|
|
132
|
+
const revalidate = shouldRevalidate;
|
|
133
|
+
return (ctx)=>{
|
|
134
|
+
const nextUrl = getModernUrlFromLoaderContext(ctx);
|
|
135
|
+
const nextParams = ctx?.params || {};
|
|
136
|
+
const result = revalidate({
|
|
137
|
+
currentUrl: state.currentUrl || nextUrl,
|
|
138
|
+
currentParams: state.currentParams || nextParams,
|
|
139
|
+
nextUrl,
|
|
140
|
+
nextParams,
|
|
141
|
+
defaultShouldRevalidate: void 0
|
|
142
|
+
});
|
|
143
|
+
state.currentUrl = nextUrl;
|
|
144
|
+
state.currentParams = nextParams;
|
|
145
|
+
return 'boolean' == typeof result ? result : void 0;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function wrapModernLoader(modernRoute, modernLoader, revalidationState, options = {}) {
|
|
149
|
+
const route = modernRoute;
|
|
150
|
+
return async (ctx)=>{
|
|
151
|
+
try {
|
|
152
|
+
if (revalidationState) rememberRouteLocation(revalidationState, ctx);
|
|
153
|
+
if ('function' == typeof route.lazyImport) try {
|
|
154
|
+
await route.lazyImport();
|
|
155
|
+
} catch {}
|
|
156
|
+
const signal = ctx?.abortController?.signal || ctx?.signal || new AbortController().signal;
|
|
157
|
+
const baseRequest = ctx?.context?.request instanceof Request ? ctx.context.request : void 0;
|
|
158
|
+
const href = 'string' == typeof ctx?.location ? ctx.location : ctx?.location?.publicHref || ctx?.location?.href || ctx?.location?.url?.href || '';
|
|
159
|
+
const request = baseRequest ? new Request(baseRequest, {
|
|
160
|
+
signal
|
|
161
|
+
}) : createModernRequest(href, signal);
|
|
162
|
+
const params = mapParamsForModernLoader({
|
|
163
|
+
modernRoute,
|
|
164
|
+
params: ctx.params || {}
|
|
165
|
+
});
|
|
166
|
+
const loadModernData = async ()=>{
|
|
167
|
+
const result = modernLoader ? await modernLoader({
|
|
168
|
+
request,
|
|
169
|
+
params,
|
|
170
|
+
context: ctx?.context?.requestContext
|
|
171
|
+
}) : null;
|
|
172
|
+
return normalizeModernLoaderResponse(result);
|
|
173
|
+
};
|
|
174
|
+
if (options.rscPayloadRouter && (0, payloadRouter_js_namespaceObject.isTanstackRscPayloadNavigationEnabled)()) return (0, payloadRouter_js_namespaceObject.loadTanstackRscRouteData)({
|
|
175
|
+
hasClientLoader: route.hasClientLoader || void 0 !== route.clientData,
|
|
176
|
+
loadClientData: loadModernData,
|
|
177
|
+
request,
|
|
178
|
+
routeId: ctx.route?.id
|
|
179
|
+
});
|
|
180
|
+
return loadModernData();
|
|
181
|
+
} catch (err) {
|
|
182
|
+
if (isResponse(err)) {
|
|
183
|
+
if (isTanstackRedirect(err)) throw err;
|
|
184
|
+
if (isRedirectResponse(err)) {
|
|
185
|
+
const location = err.headers.get('Location') || '/';
|
|
186
|
+
throwTanstackRedirect(location);
|
|
187
|
+
}
|
|
188
|
+
if (404 === err.status) throw (0, react_router_namespaceObject.notFound)();
|
|
189
|
+
}
|
|
190
|
+
throw err;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
function isRouteObjectPathlessLayout(route) {
|
|
195
|
+
return !route.path && !route.index;
|
|
196
|
+
}
|
|
197
|
+
function isRouteObjectSplatRoute(route) {
|
|
198
|
+
return 'string' == typeof route.path && route.path.includes('*');
|
|
199
|
+
}
|
|
200
|
+
function mapParamsForRouteObjectLoader({ route, params }) {
|
|
201
|
+
if (isRouteObjectSplatRoute(route)) {
|
|
202
|
+
const { _splat, ...rest } = params;
|
|
203
|
+
if (void 0 !== _splat) return {
|
|
204
|
+
...rest,
|
|
205
|
+
'*': _splat
|
|
206
|
+
};
|
|
207
|
+
return rest;
|
|
208
|
+
}
|
|
209
|
+
return params;
|
|
210
|
+
}
|
|
211
|
+
function wrapRouteObjectLoader(route, revalidationState, options = {}) {
|
|
212
|
+
const modernRoute = route;
|
|
213
|
+
const routeLoader = modernRoute.loader;
|
|
214
|
+
if ('function' != typeof routeLoader) return;
|
|
215
|
+
return async (ctx)=>{
|
|
216
|
+
try {
|
|
217
|
+
if (revalidationState) rememberRouteLocation(revalidationState, ctx);
|
|
218
|
+
if ('function' == typeof modernRoute.lazyImport) try {
|
|
219
|
+
await modernRoute.lazyImport();
|
|
220
|
+
} catch {}
|
|
221
|
+
const signal = ctx?.abortController?.signal || ctx?.signal || new AbortController().signal;
|
|
222
|
+
const baseRequest = ctx?.context?.request instanceof Request ? ctx.context.request : void 0;
|
|
223
|
+
const href = 'string' == typeof ctx?.location ? ctx.location : ctx?.location?.publicHref || ctx?.location?.href || ctx?.location?.url?.href || '';
|
|
224
|
+
const request = baseRequest ? new Request(baseRequest, {
|
|
225
|
+
signal
|
|
226
|
+
}) : createModernRequest(href, signal);
|
|
227
|
+
const params = mapParamsForRouteObjectLoader({
|
|
228
|
+
route,
|
|
229
|
+
params: ctx.params || {}
|
|
230
|
+
});
|
|
231
|
+
const loadModernData = async ()=>{
|
|
232
|
+
const result = await routeLoader({
|
|
233
|
+
request,
|
|
234
|
+
params,
|
|
235
|
+
context: ctx?.context?.requestContext
|
|
236
|
+
});
|
|
237
|
+
return normalizeModernLoaderResponse(result);
|
|
238
|
+
};
|
|
239
|
+
if (options.rscPayloadRouter && (0, payloadRouter_js_namespaceObject.isTanstackRscPayloadNavigationEnabled)()) return (0, payloadRouter_js_namespaceObject.loadTanstackRscRouteData)({
|
|
240
|
+
hasClientLoader: modernRoute.hasClientLoader || void 0 !== modernRoute.clientData,
|
|
241
|
+
loadClientData: loadModernData,
|
|
242
|
+
request,
|
|
243
|
+
routeId: ctx.route?.id
|
|
244
|
+
});
|
|
245
|
+
return loadModernData();
|
|
246
|
+
} catch (err) {
|
|
247
|
+
if (isResponse(err)) {
|
|
248
|
+
if (isTanstackRedirect(err)) throw err;
|
|
249
|
+
if (isRedirectResponse(err)) {
|
|
250
|
+
const location = err.headers.get('Location') || '/';
|
|
251
|
+
throwTanstackRedirect(location);
|
|
252
|
+
}
|
|
253
|
+
if (404 === err.status) throw (0, react_router_namespaceObject.notFound)();
|
|
254
|
+
}
|
|
255
|
+
throw err;
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
function toRouteComponent(routeObject) {
|
|
260
|
+
const route = routeObject;
|
|
261
|
+
if (route.Component) return route.Component;
|
|
262
|
+
const element = route.element;
|
|
263
|
+
if (element) return ()=>element;
|
|
264
|
+
}
|
|
265
|
+
function toErrorComponent(routeObject) {
|
|
266
|
+
const route = routeObject;
|
|
267
|
+
if (route.ErrorBoundary) return route.ErrorBoundary;
|
|
268
|
+
if (route.errorElement) return ()=>route.errorElement;
|
|
269
|
+
}
|
|
270
|
+
function toPendingComponent(routeObject) {
|
|
271
|
+
const route = routeObject;
|
|
272
|
+
return route.HydrateFallback || route.pendingComponent || void 0;
|
|
273
|
+
}
|
|
274
|
+
function mergeModernRouteHandle(route) {
|
|
275
|
+
const config = route.config;
|
|
276
|
+
const handle = {
|
|
277
|
+
...route.handle,
|
|
278
|
+
...config && 'object' == typeof config ? config.handle : {}
|
|
279
|
+
};
|
|
280
|
+
return Object.keys(handle).length > 0 ? handle : void 0;
|
|
281
|
+
}
|
|
282
|
+
function createRouteStaticData(opts) {
|
|
283
|
+
const staticData = {};
|
|
284
|
+
if (opts.modernRouteId) staticData.modernRouteId = opts.modernRouteId;
|
|
285
|
+
if (opts.modernRouteAction) staticData.modernRouteAction = opts.modernRouteAction;
|
|
286
|
+
if (opts.modernRouteHandle) staticData.modernRouteHandle = opts.modernRouteHandle;
|
|
287
|
+
if (opts.modernRouteHasAction) staticData.modernRouteHasAction = true;
|
|
288
|
+
if (opts.modernRouteHasClientLoader) staticData.modernRouteHasClientLoader = true;
|
|
289
|
+
if (opts.modernRouteHasLoader) staticData.modernRouteHasLoader = true;
|
|
290
|
+
if (opts.modernRouteIsClientComponent) staticData.modernRouteIsClientComponent = true;
|
|
291
|
+
if (opts.modernRouteLoader) staticData.modernRouteLoader = opts.modernRouteLoader;
|
|
292
|
+
if (opts.modernRouteShouldRevalidate) staticData.modernRouteShouldRevalidate = opts.modernRouteShouldRevalidate;
|
|
293
|
+
return Object.keys(staticData).length > 0 ? staticData : void 0;
|
|
294
|
+
}
|
|
295
|
+
function createRouteFromRouteObject(opts) {
|
|
296
|
+
const { options = {}, parent, routeObject } = opts;
|
|
297
|
+
const modernRouteObject = routeObject;
|
|
298
|
+
const revalidationState = {};
|
|
299
|
+
const shouldRevalidate = modernRouteObject.shouldRevalidate;
|
|
300
|
+
const shouldReload = createModernShouldReload(shouldRevalidate, revalidationState);
|
|
301
|
+
const stableFallbackId = routeObject.id || modernRouteObject.file || routeObject.path || 'pathless';
|
|
302
|
+
const base = {
|
|
303
|
+
getParentRoute: ()=>parent,
|
|
304
|
+
component: toRouteComponent(routeObject),
|
|
305
|
+
pendingComponent: toPendingComponent(routeObject),
|
|
306
|
+
errorComponent: toErrorComponent(routeObject),
|
|
307
|
+
wrapInSuspense: true,
|
|
308
|
+
staticData: createRouteStaticData({
|
|
309
|
+
modernRouteId: routeObject.id,
|
|
310
|
+
modernRouteAction: modernRouteObject.action,
|
|
311
|
+
modernRouteHandle: mergeModernRouteHandle(modernRouteObject),
|
|
312
|
+
modernRouteHasAction: modernRouteObject.hasAction || Boolean(modernRouteObject.action),
|
|
313
|
+
modernRouteHasClientLoader: modernRouteObject.hasClientLoader || void 0 !== modernRouteObject.clientData,
|
|
314
|
+
modernRouteHasLoader: modernRouteObject.hasLoader || 'function' == typeof modernRouteObject.loader,
|
|
315
|
+
modernRouteIsClientComponent: modernRouteObject.isClientComponent,
|
|
316
|
+
modernRouteLoader: modernRouteObject.loader,
|
|
317
|
+
modernRouteShouldRevalidate: shouldRevalidate
|
|
318
|
+
}),
|
|
319
|
+
loader: wrapRouteObjectLoader(routeObject, revalidationState, options)
|
|
320
|
+
};
|
|
321
|
+
if (modernRouteObject.inValidSSRRoute) base.ssr = false;
|
|
322
|
+
if (shouldReload) base.shouldReload = shouldReload;
|
|
323
|
+
if (isRouteObjectPathlessLayout(routeObject)) base.id = stableFallbackId;
|
|
324
|
+
else base.path = routeObject.index ? '/' : toTanstackPath(routeObject.path || '');
|
|
325
|
+
const route = createTanstackRoute(base);
|
|
326
|
+
const children = routeObject.children;
|
|
327
|
+
if (children && children.length > 0) {
|
|
328
|
+
const childRoutes = children.map((child)=>createRouteFromRouteObject({
|
|
329
|
+
options,
|
|
330
|
+
parent: route,
|
|
331
|
+
routeObject: child
|
|
332
|
+
}));
|
|
333
|
+
route.addChildren(childRoutes);
|
|
334
|
+
}
|
|
335
|
+
return route;
|
|
336
|
+
}
|
|
337
|
+
function createRouteFromModernRoute(opts) {
|
|
338
|
+
const { options = {}, parent, modernRoute } = opts;
|
|
339
|
+
const route = modernRoute;
|
|
340
|
+
const revalidationState = {};
|
|
341
|
+
const modernId = route.id;
|
|
342
|
+
const stableFallbackId = modernId || route._component || route.filename || route.data || ('function' == typeof route.loader ? route.id : void 0);
|
|
343
|
+
const pendingComponent = route.loading || route.pendingComponent;
|
|
344
|
+
const errorComponent = route.error || route.errorComponent;
|
|
345
|
+
const component = route.component;
|
|
346
|
+
const modernLoader = route.loader;
|
|
347
|
+
const modernAction = route.action;
|
|
348
|
+
const modernShouldRevalidate = route.shouldRevalidate;
|
|
349
|
+
const shouldReload = createModernShouldReload(modernShouldRevalidate, revalidationState);
|
|
350
|
+
const isPathlessLayout = 'nested' === route.type && 'boolean' != typeof route.index && void 0 === route.path;
|
|
351
|
+
const isIndexRoute = 'nested' === route.type && Boolean(route.index);
|
|
352
|
+
const base = {
|
|
353
|
+
getParentRoute: ()=>parent,
|
|
354
|
+
component: component || void 0,
|
|
355
|
+
pendingComponent: pendingComponent || void 0,
|
|
356
|
+
errorComponent: errorComponent || void 0,
|
|
357
|
+
wrapInSuspense: true,
|
|
358
|
+
staticData: createRouteStaticData({
|
|
359
|
+
modernRouteId: modernId,
|
|
360
|
+
modernRouteAction: modernAction,
|
|
361
|
+
modernRouteHandle: mergeModernRouteHandle(route),
|
|
362
|
+
modernRouteHasAction: route.hasAction || Boolean(modernAction),
|
|
363
|
+
modernRouteHasClientLoader: route.hasClientLoader || void 0 !== route.clientData,
|
|
364
|
+
modernRouteHasLoader: route.hasLoader || 'function' == typeof modernLoader,
|
|
365
|
+
modernRouteIsClientComponent: route.isClientComponent,
|
|
366
|
+
modernRouteLoader: modernLoader,
|
|
367
|
+
modernRouteShouldRevalidate: modernShouldRevalidate
|
|
368
|
+
}),
|
|
369
|
+
loader: wrapModernLoader(modernRoute, modernLoader, revalidationState, options)
|
|
370
|
+
};
|
|
371
|
+
if (route.inValidSSRRoute) base.ssr = false;
|
|
372
|
+
if (shouldReload) base.shouldReload = shouldReload;
|
|
373
|
+
if (isPathlessLayout) base.id = stableFallbackId || 'pathless';
|
|
374
|
+
else {
|
|
375
|
+
const rawPath = route.path;
|
|
376
|
+
base.path = isIndexRoute ? '/' : toTanstackPath(rawPath || '');
|
|
377
|
+
}
|
|
378
|
+
const tanstackRoute = createTanstackRoute(base);
|
|
379
|
+
const children = route.children;
|
|
380
|
+
if (children && children.length > 0) {
|
|
381
|
+
const childRoutes = children.map((child)=>createRouteFromModernRoute({
|
|
382
|
+
options,
|
|
383
|
+
parent: tanstackRoute,
|
|
384
|
+
modernRoute: child
|
|
385
|
+
}));
|
|
386
|
+
tanstackRoute.addChildren(childRoutes);
|
|
387
|
+
}
|
|
388
|
+
return tanstackRoute;
|
|
389
|
+
}
|
|
390
|
+
function createRouteTreeFromModernRoutes(routes, options = {}) {
|
|
391
|
+
const rootModern = routes.find((r)=>r && 'nested' === r.type && r.isRoot);
|
|
392
|
+
const rootComponent = rootModern?.component;
|
|
393
|
+
const pendingComponent = rootModern?.loading;
|
|
394
|
+
const errorComponent = rootModern?.error;
|
|
395
|
+
const rootLoader = rootModern?.loader;
|
|
396
|
+
const rootAction = rootModern?.action;
|
|
397
|
+
const rootModernId = rootModern?.id;
|
|
398
|
+
const rootShouldRevalidate = rootModern?.shouldRevalidate;
|
|
399
|
+
const rootRevalidationState = {};
|
|
400
|
+
const rootShouldReload = createModernShouldReload(rootShouldRevalidate, rootRevalidationState);
|
|
401
|
+
const rootRouteOptions = {
|
|
402
|
+
component: rootComponent || void 0,
|
|
403
|
+
pendingComponent: pendingComponent || void 0,
|
|
404
|
+
errorComponent: errorComponent || void 0,
|
|
405
|
+
wrapInSuspense: true,
|
|
406
|
+
notFoundComponent: external_DefaultNotFound_js_namespaceObject.DefaultNotFound,
|
|
407
|
+
staticData: createRouteStaticData({
|
|
408
|
+
modernRouteId: rootModernId,
|
|
409
|
+
modernRouteAction: rootAction,
|
|
410
|
+
modernRouteHandle: rootModern ? mergeModernRouteHandle(rootModern) : void 0,
|
|
411
|
+
modernRouteHasAction: rootModern?.hasAction || Boolean(rootAction),
|
|
412
|
+
modernRouteHasClientLoader: rootModern?.hasClientLoader || void 0 !== rootModern?.clientData,
|
|
413
|
+
modernRouteHasLoader: rootModern?.hasLoader || 'function' == typeof rootLoader,
|
|
414
|
+
modernRouteIsClientComponent: rootModern?.isClientComponent,
|
|
415
|
+
modernRouteLoader: rootLoader,
|
|
416
|
+
modernRouteShouldRevalidate: rootShouldRevalidate
|
|
417
|
+
}),
|
|
418
|
+
loader: rootModern ? wrapModernLoader(rootModern, rootLoader, rootRevalidationState, options) : void 0
|
|
419
|
+
};
|
|
420
|
+
if (rootShouldReload) rootRouteOptions.shouldReload = rootShouldReload;
|
|
421
|
+
if (rootModern?.inValidSSRRoute) rootRouteOptions.ssr = false;
|
|
422
|
+
const rootRoute = createTanstackRootRoute(rootRouteOptions);
|
|
423
|
+
const topLevel = rootModern ? rootModern.children || [] : routes;
|
|
424
|
+
const childRoutes = topLevel.map((child)=>createRouteFromModernRoute({
|
|
425
|
+
options,
|
|
426
|
+
parent: rootRoute,
|
|
427
|
+
modernRoute: child
|
|
428
|
+
}));
|
|
429
|
+
rootRoute.addChildren(childRoutes);
|
|
430
|
+
return rootRoute;
|
|
431
|
+
}
|
|
432
|
+
function getRootLikeRouteObject(routes) {
|
|
433
|
+
return routes.find((route)=>'/' === route.path && !route.index);
|
|
434
|
+
}
|
|
435
|
+
function createRouteTreeFromRouteObjects(routes, options = {}) {
|
|
436
|
+
const rootLikeRoute = getRootLikeRouteObject(routes);
|
|
437
|
+
const rootRevalidationState = {};
|
|
438
|
+
const rootShouldRevalidate = rootLikeRoute?.shouldRevalidate;
|
|
439
|
+
const rootShouldReload = createModernShouldReload(rootShouldRevalidate, rootRevalidationState);
|
|
440
|
+
const rootRouteOptions = {
|
|
441
|
+
component: rootLikeRoute ? toRouteComponent(rootLikeRoute) : void 0,
|
|
442
|
+
pendingComponent: rootLikeRoute ? toPendingComponent(rootLikeRoute) : void 0,
|
|
443
|
+
errorComponent: rootLikeRoute ? toErrorComponent(rootLikeRoute) : void 0,
|
|
444
|
+
wrapInSuspense: true,
|
|
445
|
+
notFoundComponent: external_DefaultNotFound_js_namespaceObject.DefaultNotFound,
|
|
446
|
+
staticData: createRouteStaticData({
|
|
447
|
+
modernRouteId: rootLikeRoute?.id,
|
|
448
|
+
modernRouteAction: rootLikeRoute?.action,
|
|
449
|
+
modernRouteHandle: rootLikeRoute ? mergeModernRouteHandle(rootLikeRoute) : void 0,
|
|
450
|
+
modernRouteHasAction: rootLikeRoute?.hasAction || Boolean(rootLikeRoute?.action),
|
|
451
|
+
modernRouteHasClientLoader: rootLikeRoute?.hasClientLoader || void 0 !== rootLikeRoute?.clientData,
|
|
452
|
+
modernRouteHasLoader: rootLikeRoute?.hasLoader || 'function' == typeof rootLikeRoute?.loader,
|
|
453
|
+
modernRouteIsClientComponent: rootLikeRoute?.isClientComponent,
|
|
454
|
+
modernRouteLoader: rootLikeRoute?.loader,
|
|
455
|
+
modernRouteShouldRevalidate: rootShouldRevalidate
|
|
456
|
+
}),
|
|
457
|
+
loader: rootLikeRoute ? wrapRouteObjectLoader(rootLikeRoute, rootRevalidationState, options) : void 0
|
|
458
|
+
};
|
|
459
|
+
if (rootShouldReload) rootRouteOptions.shouldReload = rootShouldReload;
|
|
460
|
+
if (rootLikeRoute?.inValidSSRRoute) rootRouteOptions.ssr = false;
|
|
461
|
+
const rootRoute = createTanstackRootRoute(rootRouteOptions);
|
|
462
|
+
const topLevel = rootLikeRoute ? [
|
|
463
|
+
...rootLikeRoute.children || [],
|
|
464
|
+
...routes.filter((route)=>route !== rootLikeRoute)
|
|
465
|
+
] : routes;
|
|
466
|
+
const childRoutes = topLevel.map((routeObject)=>createRouteFromRouteObject({
|
|
467
|
+
options,
|
|
468
|
+
parent: rootRoute,
|
|
469
|
+
routeObject
|
|
470
|
+
}));
|
|
471
|
+
rootRoute.addChildren(childRoutes);
|
|
472
|
+
return rootRoute;
|
|
473
|
+
}
|
|
474
|
+
function getModernRouteIdsFromMatches(router) {
|
|
475
|
+
const matches = router.state.matches || [];
|
|
476
|
+
const ids = matches.map((match)=>{
|
|
477
|
+
const route = match.route;
|
|
478
|
+
return route?.options?.staticData?.modernRouteId;
|
|
479
|
+
}).filter((id)=>'string' == typeof id);
|
|
480
|
+
return Array.from(new Set(ids));
|
|
481
|
+
}
|
|
482
|
+
exports.createRouteTreeFromModernRoutes = __webpack_exports__.createRouteTreeFromModernRoutes;
|
|
483
|
+
exports.createRouteTreeFromRouteObjects = __webpack_exports__.createRouteTreeFromRouteObjects;
|
|
484
|
+
exports.getModernRouteIdsFromMatches = __webpack_exports__.getModernRouteIdsFromMatches;
|
|
485
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
486
|
+
"createRouteTreeFromModernRoutes",
|
|
487
|
+
"createRouteTreeFromRouteObjects",
|
|
488
|
+
"getModernRouteIdsFromMatches"
|
|
489
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
490
|
+
Object.defineProperty(exports, '__esModule', {
|
|
491
|
+
value: true
|
|
492
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
6
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: definition[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.r = (exports1)=>{
|
|
17
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
18
|
+
value: 'Module'
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
21
|
+
value: true
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
})();
|
|
25
|
+
var __webpack_exports__ = {};
|
|
26
|
+
__webpack_require__.r(__webpack_exports__);
|
|
27
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
28
|
+
ClientSlot: ()=>ClientSlot
|
|
29
|
+
});
|
|
30
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
+
const external_SlotContext_js_namespaceObject = require("./SlotContext.js");
|
|
32
|
+
function ClientSlot({ args, slot }) {
|
|
33
|
+
const context = (0, external_SlotContext_js_namespaceObject.useSlotContext)();
|
|
34
|
+
if (!context) throw new Error('ClientSlot must be rendered inside CompositeComponent.');
|
|
35
|
+
const implementation = context.implementations[slot];
|
|
36
|
+
if (void 0 === implementation) {
|
|
37
|
+
if (context.strict) throw new Error(`Missing RSC slot implementation for "${slot}".`);
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
if ('function' == typeof implementation) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
|
|
41
|
+
children: implementation(...args)
|
|
42
|
+
});
|
|
43
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
|
|
44
|
+
children: implementation
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
exports.ClientSlot = __webpack_exports__.ClientSlot;
|
|
48
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
49
|
+
"ClientSlot"
|
|
50
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
51
|
+
Object.defineProperty(exports, '__esModule', {
|
|
52
|
+
value: true
|
|
53
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
6
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: definition[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.r = (exports1)=>{
|
|
17
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
18
|
+
value: 'Module'
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
21
|
+
value: true
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
})();
|
|
25
|
+
var __webpack_exports__ = {};
|
|
26
|
+
__webpack_require__.r(__webpack_exports__);
|
|
27
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
28
|
+
CompositeComponent: ()=>CompositeComponent
|
|
29
|
+
});
|
|
30
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
+
const external_react_namespaceObject = require("react");
|
|
32
|
+
const external_SlotContext_js_namespaceObject = require("./SlotContext.js");
|
|
33
|
+
const external_symbols_js_namespaceObject = require("./symbols.js");
|
|
34
|
+
function EmptyFallback() {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
function selectTreePath(tree, path) {
|
|
38
|
+
let current = tree;
|
|
39
|
+
for (const key of path){
|
|
40
|
+
if (null === current || 'object' != typeof current) return null;
|
|
41
|
+
current = current[key];
|
|
42
|
+
}
|
|
43
|
+
return current;
|
|
44
|
+
}
|
|
45
|
+
function CompositeInner({ slotProps, src, strict }) {
|
|
46
|
+
const getTree = src[external_symbols_js_namespaceObject.RSC_PROXY_GET_TREE];
|
|
47
|
+
if (!getTree) throw new Error('CompositeComponent src must come from createCompositeComponent().');
|
|
48
|
+
const tree = selectTreePath(getTree(), src[external_symbols_js_namespaceObject.RSC_PROXY_PATH] || []);
|
|
49
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_SlotContext_js_namespaceObject.SlotProvider, {
|
|
50
|
+
implementations: slotProps,
|
|
51
|
+
strict: strict,
|
|
52
|
+
children: tree
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function CompositeComponent(props) {
|
|
56
|
+
const { children, src, strict, ...slotProps } = props;
|
|
57
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_namespaceObject.Suspense, {
|
|
58
|
+
fallback: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(EmptyFallback, {}),
|
|
59
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(CompositeInner, {
|
|
60
|
+
slotProps: {
|
|
61
|
+
...slotProps,
|
|
62
|
+
children
|
|
63
|
+
},
|
|
64
|
+
src: src,
|
|
65
|
+
strict: strict
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
exports.CompositeComponent = __webpack_exports__.CompositeComponent;
|
|
70
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
71
|
+
"CompositeComponent"
|
|
72
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
73
|
+
Object.defineProperty(exports, '__esModule', {
|
|
74
|
+
value: true
|
|
75
|
+
});
|