@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
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
EmptyFallback: ()=>EmptyFallback,
|
|
32
|
+
TANSTACK_RSC_FLIGHT_VALUE: ()=>TANSTACK_RSC_FLIGHT_VALUE,
|
|
33
|
+
isSerializedTanstackRscFlightValue: ()=>isSerializedTanstackRscFlightValue,
|
|
34
|
+
renderSelectedTree: ()=>renderSelectedTree
|
|
35
|
+
});
|
|
36
|
+
const external_symbols_js_namespaceObject = require("./symbols.js");
|
|
37
|
+
const TANSTACK_RSC_FLIGHT_VALUE = '__modernTanstackRsc';
|
|
38
|
+
function isSerializedTanstackRscFlightValue(value) {
|
|
39
|
+
return Boolean(value) && 'object' == typeof value && true === value[TANSTACK_RSC_FLIGHT_VALUE] && ('renderable' === value.kind || 'composite' === value.kind) && value.stream instanceof ReadableStream;
|
|
40
|
+
}
|
|
41
|
+
function EmptyFallback() {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
function selectTreePath(tree, path) {
|
|
45
|
+
let current = tree;
|
|
46
|
+
for (const key of path){
|
|
47
|
+
if (null === current || 'object' != typeof current) return null;
|
|
48
|
+
current = current[key];
|
|
49
|
+
}
|
|
50
|
+
return current;
|
|
51
|
+
}
|
|
52
|
+
function renderSelectedTree(src, { getTree = src[external_symbols_js_namespaceObject.RSC_PROXY_GET_TREE], missingTreeError }) {
|
|
53
|
+
if (!getTree) throw new Error(missingTreeError);
|
|
54
|
+
return selectTreePath(getTree(), src[external_symbols_js_namespaceObject.RSC_PROXY_PATH] || []);
|
|
55
|
+
}
|
|
56
|
+
exports.EmptyFallback = __webpack_exports__.EmptyFallback;
|
|
57
|
+
exports.TANSTACK_RSC_FLIGHT_VALUE = __webpack_exports__.TANSTACK_RSC_FLIGHT_VALUE;
|
|
58
|
+
exports.isSerializedTanstackRscFlightValue = __webpack_exports__.isSerializedTanstackRscFlightValue;
|
|
59
|
+
exports.renderSelectedTree = __webpack_exports__.renderSelectedTree;
|
|
60
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
61
|
+
"EmptyFallback",
|
|
62
|
+
"TANSTACK_RSC_FLIGHT_VALUE",
|
|
63
|
+
"isSerializedTanstackRscFlightValue",
|
|
64
|
+
"renderSelectedTree"
|
|
65
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
66
|
+
Object.defineProperty(exports, '__esModule', {
|
|
67
|
+
value: true
|
|
68
|
+
});
|
|
@@ -45,6 +45,7 @@ function sanitizeSlotArg(value, seen) {
|
|
|
45
45
|
if (null == value) return value;
|
|
46
46
|
if ('string' == typeof value || 'number' == typeof value || 'boolean' == typeof value || 'bigint' == typeof value) return value;
|
|
47
47
|
if ('object' != typeof value && 'function' != typeof value) return String(value);
|
|
48
|
+
if ('function' == typeof value) return '[Function]';
|
|
48
49
|
if (seen.has(value)) return '[Circular]';
|
|
49
50
|
seen.add(value);
|
|
50
51
|
if (Array.isArray(value)) return value.map((item)=>sanitizeSlotArg(item, seen));
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
6
|
+
var define = (defs, kind)=>{
|
|
7
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
[kind]: defs[key]
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
define(getters, "get");
|
|
13
|
+
define(values, "value");
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
(()=>{
|
|
17
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
18
|
+
})();
|
|
19
|
+
(()=>{
|
|
20
|
+
__webpack_require__.r = (exports1)=>{
|
|
21
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
22
|
+
value: 'Module'
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
25
|
+
value: true
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
})();
|
|
29
|
+
var __webpack_exports__ = {};
|
|
30
|
+
__webpack_require__.r(__webpack_exports__);
|
|
31
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
32
|
+
createTreeGetterFromFlightStream: ()=>createTreeGetterFromFlightStream
|
|
33
|
+
});
|
|
34
|
+
const external_react_namespaceObject = require("react");
|
|
35
|
+
let modernRscClientRuntimePromise;
|
|
36
|
+
function loadModernRscClientRuntime() {
|
|
37
|
+
modernRscClientRuntimePromise ??= import("@modern-js/runtime/rsc/client").then((runtime)=>{
|
|
38
|
+
runtime.setServerCallback(runtime.callServer);
|
|
39
|
+
return runtime;
|
|
40
|
+
});
|
|
41
|
+
return modernRscClientRuntimePromise;
|
|
42
|
+
}
|
|
43
|
+
async function createFromFlightStream(stream) {
|
|
44
|
+
if ("u" < typeof window) {
|
|
45
|
+
const runtime = await import("react-server-dom-rspack/client.edge");
|
|
46
|
+
return runtime.createFromReadableStream(stream);
|
|
47
|
+
}
|
|
48
|
+
const runtime = await loadModernRscClientRuntime();
|
|
49
|
+
return runtime.createFromReadableStream(stream, {
|
|
50
|
+
callServer: runtime.callServer
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function createTreeGetterFromFlightStream(stream) {
|
|
54
|
+
let ready = false;
|
|
55
|
+
let tree;
|
|
56
|
+
const treePromise = createFromFlightStream(stream).then((value)=>{
|
|
57
|
+
tree = value;
|
|
58
|
+
ready = true;
|
|
59
|
+
return value;
|
|
60
|
+
});
|
|
61
|
+
return ()=>{
|
|
62
|
+
if (ready) return tree;
|
|
63
|
+
return (0, external_react_namespaceObject.use)(treePromise);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
exports.createTreeGetterFromFlightStream = __webpack_exports__.createTreeGetterFromFlightStream;
|
|
67
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
68
|
+
"createTreeGetterFromFlightStream"
|
|
69
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
70
|
+
Object.defineProperty(exports, '__esModule', {
|
|
71
|
+
value: true
|
|
72
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
function isAbsoluteUrl(value) {
|
|
31
|
+
try {
|
|
32
|
+
new URL(value);
|
|
33
|
+
return true;
|
|
34
|
+
} catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
39
|
+
isAbsoluteUrl: ()=>isAbsoluteUrl
|
|
40
|
+
});
|
|
41
|
+
exports.isAbsoluteUrl = __webpack_exports__.isAbsoluteUrl;
|
|
42
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
43
|
+
"isAbsoluteUrl"
|
|
44
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
45
|
+
Object.defineProperty(exports, '__esModule', {
|
|
46
|
+
value: true
|
|
47
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
async function waitForRouterSerialization(tanstackRouter) {
|
|
31
|
+
const serverSsr = tanstackRouter.serverSsr;
|
|
32
|
+
if (!serverSsr || 'function' != typeof serverSsr.onSerializationFinished || serverSsr.isSerializationFinished?.()) return;
|
|
33
|
+
await new Promise((resolve)=>{
|
|
34
|
+
serverSsr.onSerializationFinished?.(resolve);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function htmlEscapeAttr(value) {
|
|
38
|
+
return value.replace(/&/g, '&').replace(/"/g, '"');
|
|
39
|
+
}
|
|
40
|
+
function routerManagedTagToHtml(tag) {
|
|
41
|
+
if (!tag || 'object' != typeof tag) return '';
|
|
42
|
+
const managedTag = tag;
|
|
43
|
+
if (!managedTag || "script" !== managedTag.tag) return '';
|
|
44
|
+
const attrs = managedTag.attrs || {};
|
|
45
|
+
const attrsStr = Object.entries(attrs).filter(([, v])=>null != v && false !== v).map(([k, v])=>{
|
|
46
|
+
const name = 'className' === k ? 'class' : k;
|
|
47
|
+
if (true === v) return name;
|
|
48
|
+
return `${name}="${htmlEscapeAttr(String(v))}"`;
|
|
49
|
+
}).join(' ');
|
|
50
|
+
const open = attrsStr.length ? `<script ${attrsStr}>` : "<script>";
|
|
51
|
+
const children = 'string' == typeof managedTag.children ? managedTag.children : '';
|
|
52
|
+
return `${open}${children}</script>`;
|
|
53
|
+
}
|
|
54
|
+
function routerManagedTagsToHtml(tags) {
|
|
55
|
+
const normalizedTags = Array.isArray(tags) ? tags : [
|
|
56
|
+
tags
|
|
57
|
+
];
|
|
58
|
+
return normalizedTags.map(routerManagedTagToHtml).filter(Boolean);
|
|
59
|
+
}
|
|
60
|
+
function createGetSsrHref(request) {
|
|
61
|
+
const url = new URL(request.url);
|
|
62
|
+
return `${url.pathname}${url.search}${url.hash}`;
|
|
63
|
+
}
|
|
64
|
+
function collectRouterErrors(tanstackRouter) {
|
|
65
|
+
const state = tanstackRouter.state;
|
|
66
|
+
const matches = Array.isArray(state.matches) ? state.matches : [];
|
|
67
|
+
const errors = matches.reduce((acc, match)=>{
|
|
68
|
+
if (!match.error) return acc;
|
|
69
|
+
const routeId = 'string' == typeof match.routeId ? match.routeId : 'string' == typeof match.route?.id ? match.route.id : `match-${Object.keys(acc).length}`;
|
|
70
|
+
acc[routeId] = match.error;
|
|
71
|
+
return acc;
|
|
72
|
+
}, {});
|
|
73
|
+
return Object.keys(errors).length > 0 ? errors : void 0;
|
|
74
|
+
}
|
|
75
|
+
async function attachServerSsrUtils(router) {
|
|
76
|
+
const { attachRouterServerSsrUtils } = await import("@tanstack/router-core/ssr/server");
|
|
77
|
+
attachRouterServerSsrUtils({
|
|
78
|
+
router,
|
|
79
|
+
manifest: void 0
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
83
|
+
attachServerSsrUtils: ()=>attachServerSsrUtils,
|
|
84
|
+
collectRouterErrors: ()=>collectRouterErrors,
|
|
85
|
+
createGetSsrHref: ()=>createGetSsrHref,
|
|
86
|
+
routerManagedTagsToHtml: ()=>routerManagedTagsToHtml,
|
|
87
|
+
waitForRouterSerialization: ()=>waitForRouterSerialization
|
|
88
|
+
});
|
|
89
|
+
exports.attachServerSsrUtils = __webpack_exports__.attachServerSsrUtils;
|
|
90
|
+
exports.collectRouterErrors = __webpack_exports__.collectRouterErrors;
|
|
91
|
+
exports.createGetSsrHref = __webpack_exports__.createGetSsrHref;
|
|
92
|
+
exports.routerManagedTagsToHtml = __webpack_exports__.routerManagedTagsToHtml;
|
|
93
|
+
exports.waitForRouterSerialization = __webpack_exports__.waitForRouterSerialization;
|
|
94
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
95
|
+
"attachServerSsrUtils",
|
|
96
|
+
"collectRouterErrors",
|
|
97
|
+
"createGetSsrHref",
|
|
98
|
+
"routerManagedTagsToHtml",
|
|
99
|
+
"waitForRouterSerialization"
|
|
100
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
101
|
+
Object.defineProperty(exports, '__esModule', {
|
|
102
|
+
value: true
|
|
103
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
function isPromiseLike(value) {
|
|
31
|
+
return Boolean(value && 'function' == typeof value.then);
|
|
32
|
+
}
|
|
33
|
+
function isPreloadableRouteComponent(component) {
|
|
34
|
+
if (!component || 'function' != typeof component) return false;
|
|
35
|
+
const preloadable = component;
|
|
36
|
+
return 'function' == typeof preloadable.load || 'function' == typeof preloadable.preload;
|
|
37
|
+
}
|
|
38
|
+
function isReactLazyRouteComponent(component) {
|
|
39
|
+
return null != component && 'object' == typeof component && 'function' == typeof component._init && '_payload' in component;
|
|
40
|
+
}
|
|
41
|
+
async function preloadReactLazyRouteComponent(component) {
|
|
42
|
+
try {
|
|
43
|
+
component._init?.(component._payload);
|
|
44
|
+
} catch (thrown) {
|
|
45
|
+
if (!isPromiseLike(thrown)) throw thrown;
|
|
46
|
+
await thrown;
|
|
47
|
+
component._init?.(component._payload);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async function preloadRouteComponent(component, preloadedComponents) {
|
|
51
|
+
if (isReactLazyRouteComponent(component)) {
|
|
52
|
+
if (preloadedComponents.has(component)) return;
|
|
53
|
+
preloadedComponents.add(component);
|
|
54
|
+
await preloadReactLazyRouteComponent(component);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (!isPreloadableRouteComponent(component)) return;
|
|
58
|
+
if (preloadedComponents.has(component)) return;
|
|
59
|
+
preloadedComponents.add(component);
|
|
60
|
+
if ('function' == typeof component.load) return void await component.load({});
|
|
61
|
+
await component.preload?.({});
|
|
62
|
+
}
|
|
63
|
+
async function preloadMatchedRouteComponents(tanstackRouter) {
|
|
64
|
+
const matches = Array.isArray(tanstackRouter.state.matches) ? tanstackRouter.state.matches : [];
|
|
65
|
+
const routesById = tanstackRouter.routesById || {};
|
|
66
|
+
const preloadedComponents = new Set();
|
|
67
|
+
await Promise.all(matches.map(async (match)=>{
|
|
68
|
+
const routeId = 'string' == typeof match.routeId ? match.routeId : 'string' == typeof match.route?.id ? match.route.id : void 0;
|
|
69
|
+
const route = routeId ? routesById[routeId] : match.route;
|
|
70
|
+
const options = route?.options;
|
|
71
|
+
if (!options) return;
|
|
72
|
+
await Promise.all([
|
|
73
|
+
preloadRouteComponent(options.component, preloadedComponents),
|
|
74
|
+
preloadRouteComponent(options.pendingComponent, preloadedComponents),
|
|
75
|
+
preloadRouteComponent(options.errorComponent, preloadedComponents),
|
|
76
|
+
preloadRouteComponent(options.notFoundComponent, preloadedComponents)
|
|
77
|
+
]);
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
81
|
+
preloadMatchedRouteComponents: ()=>preloadMatchedRouteComponents
|
|
82
|
+
});
|
|
83
|
+
exports.preloadMatchedRouteComponents = __webpack_exports__.preloadMatchedRouteComponents;
|
|
84
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
85
|
+
"preloadMatchedRouteComponents"
|
|
86
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
87
|
+
Object.defineProperty(exports, '__esModule', {
|
|
88
|
+
value: true
|
|
89
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.r = (exports1)=>{
|
|
5
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
+
value: 'Module'
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
var __webpack_exports__ = {};
|
|
14
|
+
__webpack_require__.r(__webpack_exports__);
|
|
15
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
16
|
+
Object.defineProperty(exports, '__esModule', {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
@@ -33,7 +33,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
33
33
|
const context_namespaceObject = require("@modern-js/runtime/context");
|
|
34
34
|
function getTanstackRouterState(context) {
|
|
35
35
|
const state = (0, context_namespaceObject.getRouterRuntimeState)(context);
|
|
36
|
-
if (void 0 === state || 'tanstack' !== state.framework) return;
|
|
36
|
+
if (void 0 === state || 'tanstack' !== state.framework || void 0 === state.instance) return;
|
|
37
37
|
return state;
|
|
38
38
|
}
|
|
39
39
|
exports.getTanstackRouterState = __webpack_exports__.getTanstackRouterState;
|
|
@@ -0,0 +1,161 @@
|
|
|
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
|
+
RouteActionResponseError: ()=>RouteActionResponseError,
|
|
32
|
+
submitRouteAction: ()=>submitRouteAction
|
|
33
|
+
});
|
|
34
|
+
const external_formData_js_namespaceObject = require("./formData.js");
|
|
35
|
+
class RouteActionResponseError extends Error {
|
|
36
|
+
constructor(response, data){
|
|
37
|
+
super(`Route action failed with status ${response.status}`);
|
|
38
|
+
this.name = 'RouteActionResponseError';
|
|
39
|
+
this.response = response;
|
|
40
|
+
this.data = data;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function resolveRouteHandlers(router, actionTo) {
|
|
44
|
+
const builtLocation = router.buildLocation({
|
|
45
|
+
to: actionTo
|
|
46
|
+
});
|
|
47
|
+
const href = router.getParsedLocationHref(builtLocation);
|
|
48
|
+
const matchedRoutes = router.getMatchedRoutes(builtLocation.pathname);
|
|
49
|
+
const routeStaticData = matchedRoutes.foundRoute?.options?.staticData;
|
|
50
|
+
const action = routeStaticData?.modernRouteAction;
|
|
51
|
+
const loader = routeStaticData?.modernRouteLoader;
|
|
52
|
+
return {
|
|
53
|
+
action,
|
|
54
|
+
loader,
|
|
55
|
+
href,
|
|
56
|
+
params: matchedRoutes.routeParams || {}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function isRedirectResponse(value) {
|
|
60
|
+
if (!(value instanceof Response)) return false;
|
|
61
|
+
return [
|
|
62
|
+
301,
|
|
63
|
+
302,
|
|
64
|
+
303,
|
|
65
|
+
307,
|
|
66
|
+
308
|
|
67
|
+
].includes(value.status);
|
|
68
|
+
}
|
|
69
|
+
async function parseResponseData(response) {
|
|
70
|
+
if (204 === response.status) return null;
|
|
71
|
+
const contentType = response.headers.get('Content-Type') || '';
|
|
72
|
+
if (contentType.includes('application/json')) return response.json();
|
|
73
|
+
return response.text();
|
|
74
|
+
}
|
|
75
|
+
async function parseResponseResultOrThrow(response) {
|
|
76
|
+
const parsed = await parseResponseData(response);
|
|
77
|
+
if (!response.ok) throw new RouteActionResponseError(response, parsed);
|
|
78
|
+
return parsed;
|
|
79
|
+
}
|
|
80
|
+
async function submitRouteAction({ router, target, options = {}, isFetcher = false, onInvalidateStart }) {
|
|
81
|
+
const method = (options.method || 'post').toLowerCase();
|
|
82
|
+
const encType = options.encType || 'application/x-www-form-urlencoded';
|
|
83
|
+
const actionTo = options.action || '.';
|
|
84
|
+
const formData = (0, external_formData_js_namespaceObject.toFormData)(target);
|
|
85
|
+
const resolved = resolveRouteHandlers(router, actionTo);
|
|
86
|
+
if ('get' === method) {
|
|
87
|
+
const search = (0, external_formData_js_namespaceObject.formDataToUrlSearchParams)(formData).toString();
|
|
88
|
+
const requestUrl = new URL(resolved.href, window.location.origin);
|
|
89
|
+
requestUrl.search = search;
|
|
90
|
+
if (isFetcher && resolved.loader) {
|
|
91
|
+
const result = await resolved.loader({
|
|
92
|
+
request: new Request(requestUrl, {
|
|
93
|
+
method: 'GET'
|
|
94
|
+
}),
|
|
95
|
+
params: resolved.params
|
|
96
|
+
});
|
|
97
|
+
if (result instanceof Response) {
|
|
98
|
+
const redirectTo = result.headers.get('X-Modernjs-Redirect') || result.headers.get('Location');
|
|
99
|
+
if (redirectTo || isRedirectResponse(result)) {
|
|
100
|
+
await router.navigate({
|
|
101
|
+
to: redirectTo || '/'
|
|
102
|
+
});
|
|
103
|
+
return parseResponseData(result);
|
|
104
|
+
}
|
|
105
|
+
return parseResponseResultOrThrow(result);
|
|
106
|
+
}
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
109
|
+
await router.navigate({
|
|
110
|
+
href: `${requestUrl.pathname}${requestUrl.search}${requestUrl.hash}`
|
|
111
|
+
});
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (!resolved.action) throw new Error(`No route action found for "${actionTo}"`);
|
|
115
|
+
const headers = new Headers();
|
|
116
|
+
let body = null;
|
|
117
|
+
if (encType.includes('application/json')) {
|
|
118
|
+
headers.set('Content-Type', 'application/json');
|
|
119
|
+
body = JSON.stringify(Object.fromEntries((0, external_formData_js_namespaceObject.formDataToUrlSearchParams)(formData).entries()));
|
|
120
|
+
} else if (encType.includes('text/plain')) {
|
|
121
|
+
headers.set('Content-Type', 'text/plain;charset=UTF-8');
|
|
122
|
+
body = (0, external_formData_js_namespaceObject.formDataToTextPlain)(formData);
|
|
123
|
+
} else if (encType.includes('application/x-www-form-urlencoded')) {
|
|
124
|
+
headers.set('Content-Type', 'application/x-www-form-urlencoded;charset=UTF-8');
|
|
125
|
+
body = (0, external_formData_js_namespaceObject.formDataToUrlSearchParams)(formData);
|
|
126
|
+
} else body = formData;
|
|
127
|
+
const request = new Request(new URL(resolved.href, window.location.origin), {
|
|
128
|
+
method: method.toUpperCase(),
|
|
129
|
+
headers,
|
|
130
|
+
body
|
|
131
|
+
});
|
|
132
|
+
const result = await resolved.action({
|
|
133
|
+
request,
|
|
134
|
+
params: resolved.params
|
|
135
|
+
});
|
|
136
|
+
if (result instanceof Response) {
|
|
137
|
+
const redirectTo = result.headers.get('X-Modernjs-Redirect') || result.headers.get('Location');
|
|
138
|
+
if (redirectTo || isRedirectResponse(result)) {
|
|
139
|
+
await router.navigate({
|
|
140
|
+
to: redirectTo || '/'
|
|
141
|
+
});
|
|
142
|
+
return parseResponseData(result);
|
|
143
|
+
}
|
|
144
|
+
const parsed = isFetcher ? await parseResponseResultOrThrow(result) : await parseResponseData(result);
|
|
145
|
+
onInvalidateStart?.();
|
|
146
|
+
await router.invalidate();
|
|
147
|
+
return parsed;
|
|
148
|
+
}
|
|
149
|
+
onInvalidateStart?.();
|
|
150
|
+
await router.invalidate();
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
exports.RouteActionResponseError = __webpack_exports__.RouteActionResponseError;
|
|
154
|
+
exports.submitRouteAction = __webpack_exports__.submitRouteAction;
|
|
155
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
156
|
+
"RouteActionResponseError",
|
|
157
|
+
"submitRouteAction"
|
|
158
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
159
|
+
Object.defineProperty(exports, '__esModule', {
|
|
160
|
+
value: true
|
|
161
|
+
});
|