@bleedingdev/modern-js-runtime 3.2.0-ultramodern.11 → 3.2.0-ultramodern.110
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/boundary-debugger/index.js +303 -0
- package/dist/cjs/cache/index.js +9 -5
- package/dist/cjs/cli/alias.js +9 -5
- package/dist/cjs/cli/code.js +9 -5
- package/dist/cjs/cli/constants.js +20 -16
- package/dist/cjs/cli/entry.js +9 -5
- package/dist/cjs/cli/index.js +9 -5
- package/dist/cjs/cli/ssr/index.js +14 -20
- package/dist/cjs/cli/ssr/loadable-bundler-plugin.js +9 -5
- package/dist/cjs/cli/ssr/mode.js +12 -8
- package/dist/cjs/cli/template.js +9 -5
- package/dist/cjs/cli/template.server.js +10 -5
- package/dist/cjs/common.js +14 -10
- package/dist/cjs/core/browser/hydrate.js +9 -5
- package/dist/cjs/core/browser/index.js +9 -5
- package/dist/cjs/core/browser/withCallback.js +9 -5
- package/dist/cjs/core/compat/hooks.js +14 -10
- package/dist/cjs/core/compat/index.js +9 -5
- package/dist/cjs/core/compat/requestContext.js +13 -9
- package/dist/cjs/core/config.js +12 -8
- package/dist/cjs/core/constants.js +15 -10
- package/dist/cjs/core/context/index.js +9 -5
- package/dist/cjs/core/context/monitors/default.js +12 -8
- package/dist/cjs/core/context/monitors/index.js +9 -5
- package/dist/cjs/core/context/monitors/index.server.js +9 -5
- package/dist/cjs/core/context/request/index.js +12 -8
- package/dist/cjs/core/context/request/index.server.js +9 -5
- package/dist/cjs/core/context/response/index.js +15 -11
- package/dist/cjs/core/context/response/index.server.js +9 -5
- package/dist/cjs/core/context/runtime.js +9 -5
- package/dist/cjs/core/context/serverPayload/index.js +13 -9
- package/dist/cjs/core/context/serverPayload/index.server.js +9 -5
- package/dist/cjs/core/index.js +9 -5
- package/dist/cjs/core/plugin/index.js +9 -5
- package/dist/cjs/core/react/index.js +9 -5
- package/dist/cjs/core/react/wrapper.js +18 -8
- package/dist/cjs/core/server/constants.js +15 -11
- package/dist/cjs/core/server/federatedCss.js +51 -0
- package/dist/cjs/core/server/helmet.js +17 -7
- package/dist/cjs/core/server/index.js +9 -5
- package/dist/cjs/core/server/react/index.js +9 -5
- package/dist/cjs/core/server/react/no-ssr-cache/index.js +9 -5
- package/dist/cjs/core/server/react/nossr/index.js +9 -5
- package/dist/cjs/core/server/requestHandler.js +9 -5
- package/dist/cjs/core/server/scriptOrder.js +63 -0
- package/dist/cjs/core/server/server.js +9 -5
- package/dist/cjs/core/server/shared.js +12 -8
- package/dist/cjs/core/server/stream/afterTemplate.js +22 -10
- package/dist/cjs/core/server/stream/beforeTemplate.js +22 -25
- package/dist/cjs/core/server/stream/beforeTemplate.worker.js +102 -0
- package/dist/cjs/core/server/stream/createReadableStream.js +16 -7
- package/dist/cjs/core/server/stream/createReadableStream.worker.js +13 -7
- package/dist/cjs/core/server/stream/deferredScript.js +9 -5
- package/dist/cjs/core/server/stream/index.js +9 -5
- package/dist/cjs/core/server/stream/shared.js +12 -6
- package/dist/cjs/core/server/stream/template.js +9 -5
- package/dist/cjs/core/server/string/index.js +25 -14
- package/dist/cjs/core/server/string/loadable.js +83 -15
- package/dist/cjs/core/server/string/ssrData.js +9 -5
- package/dist/cjs/core/server/tracer.js +13 -9
- package/dist/cjs/core/server/utils.js +9 -5
- package/dist/cjs/document/Body.js +9 -5
- package/dist/cjs/document/Comment.js +9 -5
- package/dist/cjs/document/DocumentContext.js +9 -5
- package/dist/cjs/document/DocumentStructureContext.js +9 -5
- package/dist/cjs/document/Head.js +9 -5
- package/dist/cjs/document/Html.js +9 -5
- package/dist/cjs/document/Links.js +9 -5
- package/dist/cjs/document/Root.js +9 -5
- package/dist/cjs/document/Script.js +9 -5
- package/dist/cjs/document/Scripts.js +9 -5
- package/dist/cjs/document/Style.js +9 -5
- package/dist/cjs/document/Title.js +9 -5
- package/dist/cjs/document/cli/index.js +12 -6
- package/dist/cjs/document/constants.js +9 -5
- package/dist/cjs/document/index.js +9 -5
- package/dist/cjs/exports/config-routes.js +12 -8
- package/dist/cjs/exports/head.js +209 -10
- package/dist/cjs/exports/loadable.js +51 -12
- package/dist/cjs/exports/tanstack-router.js +320 -59
- package/dist/cjs/index.js +9 -5
- package/dist/cjs/internal.js +9 -5
- package/dist/cjs/react-server.js +9 -5
- package/dist/cjs/router/cli/code/getClientRoutes/getRoutes.js +9 -5
- package/dist/cjs/router/cli/code/getClientRoutes/index.js +9 -5
- package/dist/cjs/router/cli/code/getClientRoutes/utils.js +9 -5
- package/dist/cjs/router/cli/code/index.js +9 -5
- package/dist/cjs/router/cli/code/inspect.js +9 -5
- package/dist/cjs/router/cli/code/makeLegalIdentifier.js +12 -8
- package/dist/cjs/router/cli/code/nestedRoutes.js +9 -5
- package/dist/cjs/router/cli/code/tanstackTypes.js +125 -56
- package/dist/cjs/router/cli/code/templates.js +24 -14
- package/dist/cjs/router/cli/code/utils.js +9 -5
- package/dist/cjs/router/cli/config-routes/converter.js +9 -5
- package/dist/cjs/router/cli/config-routes/parseRouteConfig.js +9 -5
- package/dist/cjs/router/cli/constants.js +23 -19
- package/dist/cjs/router/cli/entry.js +9 -5
- package/dist/cjs/router/cli/handler.js +9 -5
- package/dist/cjs/router/cli/index.js +9 -5
- package/dist/cjs/router/index.js +9 -5
- package/dist/cjs/router/internal.js +12 -8
- package/dist/cjs/router/runtime/CSSLinks.js +9 -5
- package/dist/cjs/router/runtime/DefaultNotFound.js +9 -5
- package/dist/cjs/router/runtime/DeferredDataScripts.js +12 -8
- package/dist/cjs/router/runtime/DeferredDataScripts.node.js +9 -5
- package/dist/cjs/router/runtime/PrefetchLink.js +162 -26
- package/dist/cjs/router/runtime/constants.js +9 -5
- package/dist/cjs/router/runtime/hooks.js +9 -5
- package/dist/cjs/router/runtime/index.js +15 -10
- package/dist/cjs/router/runtime/internal.js +9 -5
- package/dist/cjs/router/runtime/lifecycle.js +18 -14
- package/dist/cjs/router/runtime/plugin.js +9 -5
- package/dist/cjs/router/runtime/plugin.node.js +9 -5
- package/dist/cjs/router/runtime/routerHelper.js +9 -5
- package/dist/cjs/router/runtime/rsc-router.js +9 -5
- package/dist/cjs/router/runtime/rsc.js +9 -5
- package/dist/cjs/router/runtime/server.js +9 -5
- package/dist/cjs/router/runtime/tanstack/basepathRewrite.js +12 -8
- package/dist/cjs/router/runtime/tanstack/dataMutation.js +9 -5
- package/dist/cjs/router/runtime/tanstack/hydrationBoundary.js +48 -0
- package/dist/cjs/router/runtime/tanstack/outlet.js +58 -0
- package/dist/cjs/router/runtime/tanstack/plugin.js +199 -96
- package/dist/cjs/router/runtime/tanstack/plugin.node.js +13 -19
- package/dist/cjs/router/runtime/tanstack/prefetchLink.js +10 -6
- package/dist/cjs/router/runtime/tanstack/routeTree.js +73 -17
- package/dist/cjs/router/runtime/tanstack/rsc/ClientSlot.js +9 -5
- package/dist/cjs/router/runtime/tanstack/rsc/CompositeComponent.js +9 -5
- package/dist/cjs/router/runtime/tanstack/rsc/ReplayableStream.js +14 -9
- package/dist/cjs/router/runtime/tanstack/rsc/RscNodeRenderer.js +9 -5
- package/dist/cjs/router/runtime/tanstack/rsc/SlotContext.js +9 -5
- package/dist/cjs/router/runtime/tanstack/rsc/client.js +9 -5
- package/dist/cjs/router/runtime/tanstack/rsc/createRscProxy.js +9 -5
- package/dist/cjs/router/runtime/tanstack/rsc/index.js +9 -5
- package/dist/cjs/router/runtime/tanstack/rsc/server.js +9 -5
- package/dist/cjs/router/runtime/tanstack/rsc/slotUsageSanitizer.js +9 -5
- package/dist/cjs/router/runtime/tanstack/rsc/symbols.js +20 -15
- package/dist/cjs/router/runtime/utils.js +9 -5
- package/dist/cjs/router/runtime/withRouter.js +9 -5
- package/dist/cjs/rsc/client.js +12 -8
- package/dist/cjs/rsc/server.js +9 -5
- package/dist/cjs/rsc/server.worker.js +62 -0
- package/dist/cjs/ssr/index.node.js +13 -9
- package/dist/cjs/ssr/serverRender/renderToStream/buildTemplate.after.js +9 -5
- package/dist/cjs/ssr/serverRender/renderToString/entry.js +18 -13
- package/dist/cjs/ssr/serverRender/types.js +9 -5
- package/dist/esm/boundary-debugger/index.mjs +263 -0
- package/dist/esm/cli/ssr/index.mjs +5 -15
- package/dist/esm/cli/template.server.mjs +1 -0
- package/dist/esm/core/react/wrapper.mjs +9 -3
- package/dist/esm/core/server/federatedCss.mjs +13 -0
- package/dist/esm/core/server/helmet.mjs +5 -2
- package/dist/esm/core/server/scriptOrder.mjs +25 -0
- package/dist/esm/core/server/stream/afterTemplate.mjs +14 -6
- package/dist/esm/core/server/stream/beforeTemplate.mjs +14 -11
- package/dist/esm/core/server/stream/beforeTemplate.worker.mjs +64 -0
- package/dist/esm/core/server/stream/createReadableStream.mjs +7 -2
- package/dist/esm/core/server/stream/createReadableStream.worker.mjs +4 -2
- package/dist/esm/core/server/stream/shared.mjs +3 -1
- package/dist/esm/core/server/string/index.mjs +17 -9
- package/dist/esm/core/server/string/loadable.mjs +70 -9
- package/dist/esm/document/cli/index.mjs +3 -1
- package/dist/esm/exports/head.mjs +193 -4
- package/dist/esm/exports/loadable.mjs +26 -3
- package/dist/esm/exports/tanstack-router.mjs +2 -1
- package/dist/esm/router/cli/code/tanstackTypes.mjs +116 -51
- package/dist/esm/router/cli/code/templates.mjs +15 -9
- package/dist/esm/router/runtime/PrefetchLink.mjs +153 -21
- package/dist/esm/router/runtime/tanstack/hydrationBoundary.mjs +10 -0
- package/dist/esm/router/runtime/tanstack/outlet.mjs +17 -0
- package/dist/esm/router/runtime/tanstack/plugin.mjs +193 -94
- package/dist/esm/router/runtime/tanstack/plugin.node.mjs +5 -15
- package/dist/esm/router/runtime/tanstack/prefetchLink.mjs +1 -1
- package/dist/esm/router/runtime/tanstack/routeTree.mjs +65 -13
- package/dist/esm/rsc/server.worker.mjs +1 -0
- package/dist/esm/ssr/serverRender/renderToString/entry.mjs +9 -6
- package/dist/esm-node/boundary-debugger/index.mjs +264 -0
- package/dist/esm-node/cli/ssr/index.mjs +5 -15
- package/dist/esm-node/cli/template.server.mjs +1 -0
- package/dist/esm-node/core/react/wrapper.mjs +9 -3
- package/dist/esm-node/core/server/federatedCss.mjs +14 -0
- package/dist/esm-node/core/server/helmet.mjs +5 -2
- package/dist/esm-node/core/server/scriptOrder.mjs +26 -0
- package/dist/esm-node/core/server/stream/afterTemplate.mjs +14 -6
- package/dist/esm-node/core/server/stream/beforeTemplate.mjs +14 -11
- package/dist/esm-node/core/server/stream/beforeTemplate.worker.mjs +65 -0
- package/dist/esm-node/core/server/stream/createReadableStream.mjs +7 -2
- package/dist/esm-node/core/server/stream/createReadableStream.worker.mjs +4 -2
- package/dist/esm-node/core/server/stream/shared.mjs +3 -1
- package/dist/esm-node/core/server/string/index.mjs +17 -9
- package/dist/esm-node/core/server/string/loadable.mjs +70 -9
- package/dist/esm-node/document/cli/index.mjs +3 -1
- package/dist/esm-node/exports/head.mjs +193 -4
- package/dist/esm-node/exports/loadable.mjs +26 -3
- package/dist/esm-node/exports/tanstack-router.mjs +2 -1
- package/dist/esm-node/router/cli/code/tanstackTypes.mjs +116 -51
- package/dist/esm-node/router/cli/code/templates.mjs +15 -9
- package/dist/esm-node/router/runtime/PrefetchLink.mjs +153 -21
- package/dist/esm-node/router/runtime/tanstack/hydrationBoundary.mjs +11 -0
- package/dist/esm-node/router/runtime/tanstack/outlet.mjs +18 -0
- package/dist/esm-node/router/runtime/tanstack/plugin.mjs +193 -94
- package/dist/esm-node/router/runtime/tanstack/plugin.node.mjs +5 -15
- package/dist/esm-node/router/runtime/tanstack/prefetchLink.mjs +1 -1
- package/dist/esm-node/router/runtime/tanstack/routeTree.mjs +65 -13
- package/dist/esm-node/rsc/server.worker.mjs +2 -0
- package/dist/esm-node/ssr/serverRender/renderToString/entry.mjs +9 -6
- package/dist/types/boundary-debugger/index.d.ts +28 -0
- package/dist/types/cli/entry.d.ts +2 -2
- package/dist/types/core/context/response/index.server.d.ts +4 -1
- package/dist/types/core/context/runtime.d.ts +4 -0
- package/dist/types/core/plugin/index.d.ts +1 -1
- package/dist/types/core/server/federatedCss.d.ts +5 -0
- package/dist/types/core/server/helmet.d.ts +5 -3
- package/dist/types/core/server/scriptOrder.d.ts +1 -0
- package/dist/types/core/server/stream/beforeTemplate.d.ts +1 -0
- package/dist/types/core/server/stream/beforeTemplate.worker.d.ts +10 -0
- package/dist/types/core/server/stream/shared.d.ts +8 -0
- package/dist/types/core/server/string/loadable.d.ts +11 -0
- package/dist/types/core/server/utils.d.ts +11 -1
- package/dist/types/document/constants.d.ts +3 -1
- package/dist/types/exports/head.d.ts +10 -3
- package/dist/types/exports/loadable.d.ts +8 -1
- package/dist/types/exports/tanstack-router.d.ts +3 -1
- package/dist/types/router/cli/code/utils.d.ts +1 -1
- package/dist/types/router/cli/entry.d.ts +1 -1
- package/dist/types/router/runtime/PrefetchLink.d.ts +5 -1
- package/dist/types/router/runtime/tanstack/hydrationBoundary.d.ts +2 -0
- package/dist/types/router/runtime/tanstack/outlet.d.ts +2 -0
- package/dist/types/rsc/server.worker.d.ts +1 -0
- package/package.json +31 -25
|
@@ -6,11 +6,12 @@ import { time } from "@modern-js/runtime-utils/time";
|
|
|
6
6
|
import { LOADER_REPORTER_NAME } from "@modern-js/utils/universal/constants";
|
|
7
7
|
import { RouterProvider, createMemoryHistory, createRouter } from "@tanstack/react-router";
|
|
8
8
|
import { attachRouterServerSsrUtils } from "@tanstack/react-router/ssr/server";
|
|
9
|
-
import {
|
|
9
|
+
import { useContext } from "react";
|
|
10
10
|
import { InternalRuntimeContext, getGlobalEnableRsc, getGlobalLayoutApp, getGlobalRoutes } from "../../../core/context/index.mjs";
|
|
11
11
|
import { applyRouterServerPrepareResult, createRouterServerSnapshot } from "../lifecycle.mjs";
|
|
12
12
|
import { createRouteObjectsFromConfig, urlJoin } from "../utils.mjs";
|
|
13
13
|
import { createModernBasepathRewrite } from "./basepathRewrite.mjs";
|
|
14
|
+
import { wrapTanstackSsrHydrationBoundary } from "./hydrationBoundary.mjs";
|
|
14
15
|
import { createRouteTreeFromRouteObjects, getModernRouteIdsFromMatches } from "./routeTree.mjs";
|
|
15
16
|
function isPreloadableRouteComponent(component) {
|
|
16
17
|
if (!component || 'function' != typeof component) return false;
|
|
@@ -38,13 +39,6 @@ async function preloadMatchedRouteComponents(tanstackRouter) {
|
|
|
38
39
|
]);
|
|
39
40
|
}));
|
|
40
41
|
}
|
|
41
|
-
async function waitForRouterSerialization(tanstackRouter) {
|
|
42
|
-
const serverSsr = tanstackRouter.serverSsr;
|
|
43
|
-
if (!serverSsr || 'function' != typeof serverSsr.onSerializationFinished || serverSsr.isSerializationFinished?.()) return;
|
|
44
|
-
await new Promise((resolve)=>{
|
|
45
|
-
serverSsr.onSerializationFinished?.(resolve);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
42
|
function htmlEscapeAttr(value) {
|
|
49
43
|
return value.replace(/&/g, '&').replace(/"/g, '"');
|
|
50
44
|
}
|
|
@@ -190,7 +184,6 @@ const tanstackRouterPlugin = (userConfig = {})=>({
|
|
|
190
184
|
await preloadMatchedRouteComponents(serverRouter);
|
|
191
185
|
context.ssrContext?.response.status(tanstackRouter.state.statusCode);
|
|
192
186
|
await serverRouter.serverSsr?.dehydrate?.();
|
|
193
|
-
await waitForRouterSerialization(serverRouter);
|
|
194
187
|
const ssrScriptTags = serverRouter.serverSsr?.takeBufferedScripts?.();
|
|
195
188
|
const hydrationScripts = routerManagedTagsToHtml(ssrScriptTags);
|
|
196
189
|
const matchedRouteIds = getModernRouteIdsFromMatches(serverRouter);
|
|
@@ -228,12 +221,9 @@ const tanstackRouterPlugin = (userConfig = {})=>({
|
|
|
228
221
|
if (!router) return App ? /*#__PURE__*/ jsx(App, {
|
|
229
222
|
...props
|
|
230
223
|
}) : null;
|
|
231
|
-
const routerWrapper = /*#__PURE__*/ jsx(
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
router: router
|
|
235
|
-
})
|
|
236
|
-
});
|
|
224
|
+
const routerWrapper = wrapTanstackSsrHydrationBoundary(/*#__PURE__*/ jsx(RouterProvider, {
|
|
225
|
+
router: router
|
|
226
|
+
}), true);
|
|
237
227
|
return App ? /*#__PURE__*/ jsx(App, {
|
|
238
228
|
children: routerWrapper
|
|
239
229
|
}) : routerWrapper;
|
|
@@ -5,7 +5,7 @@ function resolvePreloadFromPrefetch(prefetch, preload) {
|
|
|
5
5
|
if (void 0 !== preload) return preload;
|
|
6
6
|
if ('none' === prefetch) return false;
|
|
7
7
|
if ('intent' === prefetch || 'render' === prefetch || 'viewport' === prefetch) return prefetch;
|
|
8
|
-
return
|
|
8
|
+
return 'viewport';
|
|
9
9
|
}
|
|
10
10
|
const LinkComponentImpl = (props)=>{
|
|
11
11
|
const { prefetch, preload, ...rest } = props;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { createRootRoute, createRoute, notFound, redirect } from "@tanstack/react-router";
|
|
2
|
+
import { createRootRoute, createRoute, notFound, redirect, rootRouteId } from "@tanstack/react-router";
|
|
3
|
+
import { createElement } from "react";
|
|
3
4
|
import { DefaultNotFound } from "../DefaultNotFound.mjs";
|
|
5
|
+
import { withModernRouteMatchContext } from "./outlet.mjs";
|
|
4
6
|
function createTanstackRoute(options) {
|
|
5
7
|
return createRoute(options);
|
|
6
8
|
}
|
|
7
9
|
function createTanstackRootRoute(options) {
|
|
8
10
|
return createRootRoute(options);
|
|
9
11
|
}
|
|
12
|
+
function wrapRouteComponentWithModernContext(route, component, routeId) {
|
|
13
|
+
const routeMatchId = routeId || route.id;
|
|
14
|
+
if (component && routeMatchId) route.options.component = withModernRouteMatchContext(component, routeMatchId);
|
|
15
|
+
}
|
|
10
16
|
function toTanstackPath(pathname) {
|
|
11
17
|
return pathname.split('/').map((segment)=>{
|
|
12
18
|
if (!segment) return segment;
|
|
@@ -44,6 +50,40 @@ function isModernDeferredData(value) {
|
|
|
44
50
|
function normalizeModernLoaderResult(result) {
|
|
45
51
|
return isModernDeferredData(result) ? result.data : result;
|
|
46
52
|
}
|
|
53
|
+
function pickRouteModuleComponent(routeModule, seen = new Set()) {
|
|
54
|
+
if ('function' == typeof routeModule || routeModule && 'object' == typeof routeModule && '$$typeof' in routeModule) return routeModule;
|
|
55
|
+
if (!routeModule || 'object' != typeof routeModule) return;
|
|
56
|
+
if (seen.has(routeModule)) return;
|
|
57
|
+
seen.add(routeModule);
|
|
58
|
+
const module = routeModule;
|
|
59
|
+
for (const candidate of [
|
|
60
|
+
module.default,
|
|
61
|
+
module.Component
|
|
62
|
+
]){
|
|
63
|
+
const component = pickRouteModuleComponent(candidate, seen);
|
|
64
|
+
if (component) return component;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function createServerLazyImportComponent(lazyImport, fallbackComponent) {
|
|
68
|
+
if ("u" > typeof document) return fallbackComponent;
|
|
69
|
+
let resolvedComponent;
|
|
70
|
+
let pendingLoad;
|
|
71
|
+
const load = async ()=>{
|
|
72
|
+
if (resolvedComponent) return resolvedComponent;
|
|
73
|
+
const routeModule = await lazyImport();
|
|
74
|
+
const component = pickRouteModuleComponent(routeModule);
|
|
75
|
+
if (component) resolvedComponent = component;
|
|
76
|
+
return resolvedComponent;
|
|
77
|
+
};
|
|
78
|
+
const Component = (props)=>{
|
|
79
|
+
if (resolvedComponent) return createElement(resolvedComponent, props);
|
|
80
|
+
pendingLoad ||= load();
|
|
81
|
+
throw pendingLoad;
|
|
82
|
+
};
|
|
83
|
+
Component.load = load;
|
|
84
|
+
Component.preload = load;
|
|
85
|
+
return Component;
|
|
86
|
+
}
|
|
47
87
|
function throwTanstackRedirect(location) {
|
|
48
88
|
const target = location || '/';
|
|
49
89
|
try {
|
|
@@ -112,7 +152,7 @@ function wrapModernLoader(modernRoute, modernLoader, revalidationState) {
|
|
|
112
152
|
const signal = ctx?.abortController?.signal || ctx?.signal || new AbortController().signal;
|
|
113
153
|
const baseRequest = ctx?.context?.request instanceof Request ? ctx.context.request : void 0;
|
|
114
154
|
const href = 'string' == typeof ctx?.location ? ctx.location : ctx?.location?.publicHref || ctx?.location?.href || ctx?.location?.url?.href || '';
|
|
115
|
-
const request = baseRequest ? new Request(baseRequest, {
|
|
155
|
+
const request = void 0 !== baseRequest ? new Request(baseRequest, {
|
|
116
156
|
signal
|
|
117
157
|
}) : createModernRequest(href, signal);
|
|
118
158
|
const params = mapParamsForModernLoader({
|
|
@@ -175,7 +215,7 @@ function wrapRouteObjectLoader(route, revalidationState) {
|
|
|
175
215
|
const signal = ctx?.abortController?.signal || ctx?.signal || new AbortController().signal;
|
|
176
216
|
const baseRequest = ctx?.context?.request instanceof Request ? ctx.context.request : void 0;
|
|
177
217
|
const href = 'string' == typeof ctx?.location ? ctx.location : ctx?.location?.publicHref || ctx?.location?.href || ctx?.location?.url?.href || '';
|
|
178
|
-
const request = baseRequest ? new Request(baseRequest, {
|
|
218
|
+
const request = void 0 !== baseRequest ? new Request(baseRequest, {
|
|
179
219
|
signal
|
|
180
220
|
}) : createModernRequest(href, signal);
|
|
181
221
|
const params = mapParamsForRouteObjectLoader({
|
|
@@ -210,10 +250,18 @@ function wrapRouteObjectLoader(route, revalidationState) {
|
|
|
210
250
|
}
|
|
211
251
|
function toRouteComponent(routeObject) {
|
|
212
252
|
const route = routeObject;
|
|
253
|
+
const lazyImport = 'function' == typeof route.lazyImport ? route.lazyImport : void 0;
|
|
254
|
+
const fallbackComponent = route.Component ? route.Component : route.element ? ()=>route.element : void 0;
|
|
255
|
+
if (lazyImport && fallbackComponent) return createServerLazyImportComponent(lazyImport, fallbackComponent);
|
|
213
256
|
if (route.Component) return route.Component;
|
|
214
257
|
const element = route.element;
|
|
215
258
|
if (element) return ()=>element;
|
|
216
259
|
}
|
|
260
|
+
function toModernRouteComponent(route) {
|
|
261
|
+
const component = route.component || void 0;
|
|
262
|
+
if ('function' == typeof route.lazyImport && component) return createServerLazyImportComponent(route.lazyImport, component);
|
|
263
|
+
return component;
|
|
264
|
+
}
|
|
217
265
|
function toErrorComponent(routeObject) {
|
|
218
266
|
const route = routeObject;
|
|
219
267
|
if (route.ErrorBoundary) return route.ErrorBoundary;
|
|
@@ -251,12 +299,12 @@ function createRouteFromRouteObject(opts) {
|
|
|
251
299
|
const shouldRevalidate = modernRouteObject.shouldRevalidate;
|
|
252
300
|
const shouldReload = createModernShouldReload(shouldRevalidate, revalidationState);
|
|
253
301
|
const stableFallbackId = routeObject.id || modernRouteObject.file || routeObject.path || 'pathless';
|
|
302
|
+
const component = toRouteComponent(routeObject);
|
|
254
303
|
const base = {
|
|
255
304
|
getParentRoute: ()=>parent,
|
|
256
|
-
component
|
|
305
|
+
component,
|
|
257
306
|
pendingComponent: toPendingComponent(routeObject),
|
|
258
307
|
errorComponent: toErrorComponent(routeObject),
|
|
259
|
-
wrapInSuspense: true,
|
|
260
308
|
staticData: createRouteStaticData({
|
|
261
309
|
modernRouteId: routeObject.id,
|
|
262
310
|
modernRouteAction: modernRouteObject.action,
|
|
@@ -275,6 +323,7 @@ function createRouteFromRouteObject(opts) {
|
|
|
275
323
|
if (isRouteObjectPathlessLayout(routeObject)) base.id = stableFallbackId;
|
|
276
324
|
else base.path = routeObject.index ? '/' : toTanstackPath(routeObject.path || '');
|
|
277
325
|
const route = createTanstackRoute(base);
|
|
326
|
+
wrapRouteComponentWithModernContext(route, component, routeObject.id);
|
|
278
327
|
const children = routeObject.children;
|
|
279
328
|
if (children && children.length > 0) {
|
|
280
329
|
const childRoutes = children.map((child)=>createRouteFromRouteObject({
|
|
@@ -293,7 +342,7 @@ function createRouteFromModernRoute(opts) {
|
|
|
293
342
|
const stableFallbackId = modernId || route._component || route.filename || route.data || ('function' == typeof route.loader ? route.id : void 0);
|
|
294
343
|
const pendingComponent = route.loading || route.pendingComponent;
|
|
295
344
|
const errorComponent = route.error || route.errorComponent;
|
|
296
|
-
const component = route
|
|
345
|
+
const component = toModernRouteComponent(route);
|
|
297
346
|
const modernLoader = route.loader;
|
|
298
347
|
const modernAction = route.action;
|
|
299
348
|
const modernShouldRevalidate = route.shouldRevalidate;
|
|
@@ -305,7 +354,6 @@ function createRouteFromModernRoute(opts) {
|
|
|
305
354
|
component: component || void 0,
|
|
306
355
|
pendingComponent: pendingComponent || void 0,
|
|
307
356
|
errorComponent: errorComponent || void 0,
|
|
308
|
-
wrapInSuspense: true,
|
|
309
357
|
staticData: createRouteStaticData({
|
|
310
358
|
modernRouteId: modernId,
|
|
311
359
|
modernRouteAction: modernAction,
|
|
@@ -327,6 +375,7 @@ function createRouteFromModernRoute(opts) {
|
|
|
327
375
|
base.path = isIndexRoute ? '/' : toTanstackPath(rawPath || '');
|
|
328
376
|
}
|
|
329
377
|
const tanstackRoute = createTanstackRoute(base);
|
|
378
|
+
wrapRouteComponentWithModernContext(tanstackRoute, component, modernId);
|
|
330
379
|
const children = route.children;
|
|
331
380
|
if (children && children.length > 0) {
|
|
332
381
|
const childRoutes = children.map((child)=>createRouteFromModernRoute({
|
|
@@ -339,7 +388,7 @@ function createRouteFromModernRoute(opts) {
|
|
|
339
388
|
}
|
|
340
389
|
function createRouteTreeFromModernRoutes(routes) {
|
|
341
390
|
const rootModern = routes.find((r)=>r && 'nested' === r.type && r.isRoot);
|
|
342
|
-
const rootComponent = rootModern
|
|
391
|
+
const rootComponent = rootModern ? toModernRouteComponent(rootModern) : void 0;
|
|
343
392
|
const pendingComponent = rootModern?.loading;
|
|
344
393
|
const errorComponent = rootModern?.error;
|
|
345
394
|
const rootLoader = rootModern?.loader;
|
|
@@ -352,7 +401,6 @@ function createRouteTreeFromModernRoutes(routes) {
|
|
|
352
401
|
component: rootComponent || void 0,
|
|
353
402
|
pendingComponent: pendingComponent || void 0,
|
|
354
403
|
errorComponent: errorComponent || void 0,
|
|
355
|
-
wrapInSuspense: true,
|
|
356
404
|
notFoundComponent: DefaultNotFound,
|
|
357
405
|
staticData: createRouteStaticData({
|
|
358
406
|
modernRouteId: rootModernId,
|
|
@@ -370,6 +418,7 @@ function createRouteTreeFromModernRoutes(routes) {
|
|
|
370
418
|
if (rootShouldReload) rootRouteOptions.shouldReload = rootShouldReload;
|
|
371
419
|
if (rootModern?.inValidSSRRoute) rootRouteOptions.ssr = false;
|
|
372
420
|
const rootRoute = createTanstackRootRoute(rootRouteOptions);
|
|
421
|
+
if (rootComponent) rootRoute.options.component = withModernRouteMatchContext(rootComponent, rootRouteId);
|
|
373
422
|
const topLevel = rootModern ? rootModern.children || [] : routes;
|
|
374
423
|
const childRoutes = topLevel.map((child)=>createRouteFromModernRoute({
|
|
375
424
|
parent: rootRoute,
|
|
@@ -386,11 +435,11 @@ function createRouteTreeFromRouteObjects(routes) {
|
|
|
386
435
|
const rootRevalidationState = {};
|
|
387
436
|
const rootShouldRevalidate = rootLikeRoute?.shouldRevalidate;
|
|
388
437
|
const rootShouldReload = createModernShouldReload(rootShouldRevalidate, rootRevalidationState);
|
|
438
|
+
const rootComponent = rootLikeRoute ? toRouteComponent(rootLikeRoute) : void 0;
|
|
389
439
|
const rootRouteOptions = {
|
|
390
|
-
component:
|
|
440
|
+
component: rootComponent,
|
|
391
441
|
pendingComponent: rootLikeRoute ? toPendingComponent(rootLikeRoute) : void 0,
|
|
392
442
|
errorComponent: rootLikeRoute ? toErrorComponent(rootLikeRoute) : void 0,
|
|
393
|
-
wrapInSuspense: true,
|
|
394
443
|
notFoundComponent: DefaultNotFound,
|
|
395
444
|
staticData: createRouteStaticData({
|
|
396
445
|
modernRouteId: rootLikeRoute?.id,
|
|
@@ -408,6 +457,7 @@ function createRouteTreeFromRouteObjects(routes) {
|
|
|
408
457
|
if (rootShouldReload) rootRouteOptions.shouldReload = rootShouldReload;
|
|
409
458
|
if (rootLikeRoute?.inValidSSRRoute) rootRouteOptions.ssr = false;
|
|
410
459
|
const rootRoute = createTanstackRootRoute(rootRouteOptions);
|
|
460
|
+
if (rootComponent) rootRoute.options.component = withModernRouteMatchContext(rootComponent, rootRouteId);
|
|
411
461
|
const topLevel = rootLikeRoute ? [
|
|
412
462
|
...rootLikeRoute.children || [],
|
|
413
463
|
...routes.filter((route)=>route !== rootLikeRoute)
|
|
@@ -421,9 +471,11 @@ function createRouteTreeFromRouteObjects(routes) {
|
|
|
421
471
|
}
|
|
422
472
|
function getModernRouteIdsFromMatches(router) {
|
|
423
473
|
const matches = router.state.matches || [];
|
|
474
|
+
const routesById = router.routesById;
|
|
424
475
|
const ids = matches.map((match)=>{
|
|
425
|
-
const
|
|
426
|
-
|
|
476
|
+
const normalizedMatch = match;
|
|
477
|
+
const routeId = 'string' == typeof normalizedMatch.routeId ? normalizedMatch.routeId : void 0;
|
|
478
|
+
return normalizedMatch.route?.options?.staticData?.modernRouteId ?? (routeId ? routesById?.[routeId]?.options?.staticData?.modernRouteId : void 0);
|
|
427
479
|
}).filter((id)=>'string' == typeof id);
|
|
428
480
|
return Array.from(new Set(ids));
|
|
429
481
|
}
|
|
@@ -2,10 +2,10 @@ import "node:module";
|
|
|
2
2
|
import { sanitizeSSRPayload, serializeJson } from "@modern-js/runtime-utils/node";
|
|
3
3
|
import { time } from "@modern-js/runtime-utils/time";
|
|
4
4
|
import react from "react";
|
|
5
|
-
import
|
|
5
|
+
import { HelmetProvider } from "react-helmet-async";
|
|
6
|
+
import { getHelmetData, helmetReplace } from "../../../core/server/helmet.mjs";
|
|
6
7
|
import { serializeErrors } from "../../../router/runtime/utils.mjs";
|
|
7
8
|
import prefetch from "../../prefetch";
|
|
8
|
-
import helmet from "../helmet";
|
|
9
9
|
import { SSRErrors, SSRTimings } from "../tracker";
|
|
10
10
|
import { RenderLevel } from "../types.mjs";
|
|
11
11
|
import { ROUTER_DATA_JSON_ID, SSR_DATA_JSON_ID, attributesToString } from "../utils";
|
|
@@ -61,8 +61,8 @@ class Entry {
|
|
|
61
61
|
createReplaceSSRDataScript(ssrDataScripts),
|
|
62
62
|
...this.htmlModifiers
|
|
63
63
|
]);
|
|
64
|
-
const helmetData =
|
|
65
|
-
return helmetData ?
|
|
64
|
+
const helmetData = getHelmetData(context);
|
|
65
|
+
return helmetData ? helmetReplace(html, helmetData) : html;
|
|
66
66
|
}
|
|
67
67
|
async prefetch(context) {
|
|
68
68
|
let prefetchData;
|
|
@@ -83,11 +83,14 @@ class Entry {
|
|
|
83
83
|
const end = time();
|
|
84
84
|
const { ssrContext } = context;
|
|
85
85
|
try {
|
|
86
|
-
const
|
|
86
|
+
const helmetContext = context._helmetContext ??= {};
|
|
87
|
+
const App = react.createElement(HelmetProvider, {
|
|
88
|
+
context: helmetContext
|
|
89
|
+
}, react.createElement(this.App, {
|
|
87
90
|
context: Object.assign(context, {
|
|
88
91
|
ssr: true
|
|
89
92
|
})
|
|
90
|
-
});
|
|
93
|
+
}));
|
|
91
94
|
html = await createRender(App).addCollector(createStyledCollector(this.result)).addCollector(createLoadableCollector({
|
|
92
95
|
stats: ssrContext.loadableStats,
|
|
93
96
|
result: this.result,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { RuntimePlugin } from '../core';
|
|
2
|
+
export type BoundaryDebugEntry = {
|
|
3
|
+
appId: string;
|
|
4
|
+
color?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
mfName: string;
|
|
7
|
+
ownerTeam?: string;
|
|
8
|
+
packageName?: string;
|
|
9
|
+
role?: 'host' | 'vertical';
|
|
10
|
+
};
|
|
11
|
+
export type BoundaryDebugMetadata = {
|
|
12
|
+
appId: string;
|
|
13
|
+
boundaries: BoundaryDebugEntry[];
|
|
14
|
+
schemaVersion: 1;
|
|
15
|
+
};
|
|
16
|
+
export type BoundaryDebuggerControlMode = 'visible' | 'hidden-when-off' | 'hidden';
|
|
17
|
+
export type BoundaryDebuggerPluginOptions = {
|
|
18
|
+
controlMode?: BoundaryDebuggerControlMode;
|
|
19
|
+
enabledByDefault?: boolean;
|
|
20
|
+
labels?: Record<string, {
|
|
21
|
+
toggle: string;
|
|
22
|
+
}>;
|
|
23
|
+
legacySelector?: string;
|
|
24
|
+
metadata: BoundaryDebugMetadata;
|
|
25
|
+
storageKey?: string;
|
|
26
|
+
};
|
|
27
|
+
export declare const ultramodernBoundaryDebuggerPlugin: (options: BoundaryDebuggerPluginOptions) => RuntimePlugin;
|
|
28
|
+
export default ultramodernBoundaryDebuggerPlugin;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const hasApp: (dir: string) =>
|
|
2
|
-
export declare const isRuntimeEntry: (dir: string) =>
|
|
1
|
+
export declare const hasApp: (dir: string) => string | false;
|
|
2
|
+
export declare const isRuntimeEntry: (dir: string) => string | false;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export declare const getResponseProxy: () =>
|
|
1
|
+
export declare const getResponseProxy: () => {
|
|
2
|
+
headers: Record<string, string>;
|
|
3
|
+
status: number;
|
|
4
|
+
} | undefined;
|
|
2
5
|
export declare const setHeaders: (headers: Record<string, string>) => void;
|
|
3
6
|
export declare const setStatus: (status: number) => void;
|
|
4
7
|
export declare const redirect: (url: string, init?: number | ResponseInit) => void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RouteObject, StaticHandlerContext } from '@modern-js/runtime-utils/router';
|
|
2
|
+
import type { HelmetServerState } from 'react-helmet-async';
|
|
2
3
|
import type { InternalRouterRuntimeState, InternalRouterServerSnapshot, RouteManifest, RouterFramework } from '../../router/runtime/types';
|
|
3
4
|
import type { RequestContext, SSRServerContext } from '../types';
|
|
4
5
|
export interface TRuntimeContext {
|
|
@@ -28,6 +29,9 @@ export interface TInternalRuntimeContext extends TRuntimeContext {
|
|
|
28
29
|
ssrContext?: SSRServerContext;
|
|
29
30
|
_internalContext?: any;
|
|
30
31
|
_internalRouterBaseName?: any;
|
|
32
|
+
_helmetContext?: {
|
|
33
|
+
helmet?: HelmetServerState | null;
|
|
34
|
+
};
|
|
31
35
|
}
|
|
32
36
|
export declare const InternalRuntimeContext: import("react").Context<TInternalRuntimeContext>;
|
|
33
37
|
export declare const RuntimeContext: import("react").Context<TRuntimeContext>;
|
|
@@ -2,4 +2,4 @@ import type { InternalRuntimeContext } from '@modern-js/plugin/runtime';
|
|
|
2
2
|
import type { RuntimeConfig, RuntimeExtends, RuntimePlugin } from './types';
|
|
3
3
|
export type { RuntimePlugin };
|
|
4
4
|
export declare function registerPlugin(internalPlugins: RuntimePlugin[], runtimeConfig?: RuntimeConfig): InternalRuntimeContext<RuntimeExtends>;
|
|
5
|
-
export declare function mergeConfig(config: Record<string, any>, ...otherConfig: Record<string, any>[]): any
|
|
5
|
+
export declare function mergeConfig(config: Record<string, any>, ...otherConfig: Record<string, any>[]): Record<string, any>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
1
|
+
import type { HelmetServerState } from 'react-helmet-async';
|
|
2
|
+
import type { TInternalRuntimeContext } from '../context';
|
|
3
|
+
export declare function getHelmetData(runtimeContext: TInternalRuntimeContext): HelmetServerState | undefined;
|
|
4
|
+
export declare function createReplaceHelemt(helmetData?: HelmetServerState): (template: string) => string;
|
|
5
|
+
export declare function helmetReplace(content: string, helmetData: HelmetServerState): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function injectBeforeHydrationEntryScript(template: string, scripts: string, entryName?: string): string;
|
|
@@ -5,5 +5,6 @@ export interface BuildShellBeforeTemplateOptions {
|
|
|
5
5
|
entryName: string;
|
|
6
6
|
config: HandleRequestConfig;
|
|
7
7
|
styledComponentsStyleTags?: string;
|
|
8
|
+
moduleFederationCssAssets?: string[];
|
|
8
9
|
}
|
|
9
10
|
export declare function buildShellBeforeTemplate(beforeAppTemplate: string, options: BuildShellBeforeTemplateOptions): Promise<string>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TInternalRuntimeContext } from '../../context';
|
|
2
|
+
import type { HandleRequestConfig } from '../requestHandler';
|
|
3
|
+
export interface BuildShellBeforeTemplateOptions {
|
|
4
|
+
runtimeContext: TInternalRuntimeContext;
|
|
5
|
+
entryName: string;
|
|
6
|
+
config: HandleRequestConfig;
|
|
7
|
+
styledComponentsStyleTags?: string;
|
|
8
|
+
moduleFederationCssAssets?: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare function buildShellBeforeTemplate(beforeAppTemplate: string, options: BuildShellBeforeTemplateOptions): Promise<string>;
|
|
@@ -4,15 +4,23 @@ import type React from 'react';
|
|
|
4
4
|
import type { TRuntimeContext } from '../../context';
|
|
5
5
|
import type { HandleRequestConfig } from '../requestHandler';
|
|
6
6
|
import type { RenderStreaming, SSRConfig } from '../shared';
|
|
7
|
+
export type RscManifest = {
|
|
8
|
+
clientManifest?: RscClientManifest;
|
|
9
|
+
serverConsumerModuleMap?: unknown;
|
|
10
|
+
serverManifest?: RscServerManifest;
|
|
11
|
+
entryCssFiles?: Record<string, string[]>;
|
|
12
|
+
};
|
|
7
13
|
export type CreateReadableStreamFromElementOptions = {
|
|
8
14
|
runtimeContext: TRuntimeContext;
|
|
9
15
|
config: HandleRequestConfig;
|
|
10
16
|
ssrConfig: SSRConfig;
|
|
11
17
|
htmlTemplate: string;
|
|
12
18
|
entryName: string;
|
|
19
|
+
moduleFederationCssAssets?: string[];
|
|
13
20
|
rscClientManifest?: RscClientManifest;
|
|
14
21
|
rscSSRManifest?: RscSSRManifest;
|
|
15
22
|
rscServerManifest?: RscServerManifest;
|
|
23
|
+
rscManifest?: RscManifest;
|
|
16
24
|
rscRoot?: React.ReactElement;
|
|
17
25
|
onShellReady?: () => void;
|
|
18
26
|
onShellError?: (error: unknown) => void;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { type Chunk } from '@loadable/server';
|
|
1
2
|
import type { ReactElement } from 'react';
|
|
3
|
+
import type { TInternalRuntimeContext } from '../../context';
|
|
2
4
|
import type { ChunkSet, Collector } from './types';
|
|
3
5
|
declare module '@loadable/server' {
|
|
4
6
|
interface ChunkExtractor {
|
|
@@ -6,12 +8,20 @@ declare module '@loadable/server' {
|
|
|
6
8
|
getChunkAssets: (chunks: string[]) => Chunk[];
|
|
7
9
|
}
|
|
8
10
|
}
|
|
11
|
+
export declare const orderHydrationScriptChunks: ({ asyncEntryChunks, collectedChunks, matchedRouteChunks, entryName, }: {
|
|
12
|
+
asyncEntryChunks: Chunk[];
|
|
13
|
+
collectedChunks: Chunk[];
|
|
14
|
+
matchedRouteChunks: Chunk[];
|
|
15
|
+
entryName: string;
|
|
16
|
+
}) => Chunk[];
|
|
9
17
|
export interface LoadableCollectorOptions {
|
|
10
18
|
nonce?: string;
|
|
11
19
|
stats?: Record<string, any>;
|
|
12
20
|
routeManifest?: Record<string, any>;
|
|
21
|
+
runtimeContext: TInternalRuntimeContext;
|
|
13
22
|
template: string;
|
|
14
23
|
entryName: string;
|
|
24
|
+
moduleFederationCssAssets?: string[];
|
|
15
25
|
chunkSet: ChunkSet;
|
|
16
26
|
config: LoadableCollectorConfig;
|
|
17
27
|
}
|
|
@@ -27,6 +37,7 @@ export declare class LoadableCollector implements Collector {
|
|
|
27
37
|
private extractor?;
|
|
28
38
|
constructor(options: LoadableCollectorOptions);
|
|
29
39
|
private get existsAssets();
|
|
40
|
+
private getMatchedRouteChunks;
|
|
30
41
|
collect(comopnent: ReactElement): ReactElement;
|
|
31
42
|
effect(): Promise<void>;
|
|
32
43
|
private emitLoadableScripts;
|
|
@@ -15,5 +15,15 @@ export declare function checkIsNode(): boolean;
|
|
|
15
15
|
* license at https://github.com/remix-run/remix/blob/main/LICENSE.md
|
|
16
16
|
*/
|
|
17
17
|
export declare function serializeErrors(errors: StaticHandlerContext['errors']): StaticHandlerContext['errors'];
|
|
18
|
-
export declare function getSSRConfigByEntry(entryName: string, ssr?: ServerUserConfig['ssr'], ssrByEntries?: ServerUserConfig['ssrByEntries']):
|
|
18
|
+
export declare function getSSRConfigByEntry(entryName: string, ssr?: ServerUserConfig['ssr'], ssrByEntries?: ServerUserConfig['ssrByEntries']): true | {
|
|
19
|
+
forceCSR?: boolean;
|
|
20
|
+
mode?: import("@modern-js/types").SSRMode;
|
|
21
|
+
preload?: boolean | {
|
|
22
|
+
[x: string]: unknown;
|
|
23
|
+
};
|
|
24
|
+
inlineScript?: boolean;
|
|
25
|
+
disablePrerender?: boolean;
|
|
26
|
+
unsafeHeaders?: string[];
|
|
27
|
+
moduleFederationAppSSR?: boolean;
|
|
28
|
+
};
|
|
19
29
|
export declare function getSSRMode(ssrConfig?: SSRConfig): 'string' | 'stream' | false;
|
|
@@ -21,5 +21,7 @@ export declare const DOCUMENT_STYLE_PLACEHOLDER_END: string;
|
|
|
21
21
|
export declare const DOCUMENT_COMMENT_PLACEHOLDER_START: string;
|
|
22
22
|
export declare const DOCUMENT_COMMENT_PLACEHOLDER_END: string;
|
|
23
23
|
export declare const PLACEHOLDER_REPLACER_MAP: {
|
|
24
|
-
[
|
|
24
|
+
[DOCUMENT_SSR_PLACEHOLDER]: string;
|
|
25
|
+
[DOCUMENT_CHUNKSMAP_PLACEHOLDER]: string;
|
|
26
|
+
[DOCUMENT_SSRDATASCRIPT_PLACEHOLDER]: string;
|
|
25
27
|
};
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Helmet as AsyncHelmet, HelmetData as AsyncHelmetData, type HelmetDatum, type HelmetHTMLBodyDatum, type HelmetHTMLElementDatum, type HelmetProps, HelmetProvider, type HelmetServerState, type HelmetTags } from 'react-helmet-async';
|
|
3
|
+
export declare const Helmet: (props: React.PropsWithChildren<HelmetProps>) => React.CElement<React.PropsWithChildren<HelmetProps>, AsyncHelmet> | null;
|
|
4
|
+
declare const head: {
|
|
5
|
+
Helmet: (props: React.PropsWithChildren<HelmetProps>) => React.CElement<React.PropsWithChildren<HelmetProps>, AsyncHelmet> | null;
|
|
6
|
+
HelmetData: typeof AsyncHelmetData;
|
|
7
|
+
HelmetProvider: typeof HelmetProvider;
|
|
8
|
+
};
|
|
2
9
|
export default head;
|
|
3
|
-
export type {
|
|
4
|
-
export {
|
|
10
|
+
export type { HelmetDatum, HelmetHTMLBodyDatum, HelmetHTMLElementDatum, HelmetProps, HelmetServerState, HelmetTags, };
|
|
11
|
+
export { AsyncHelmetData as HelmetData, HelmetProvider };
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
type LoadableDefault = typeof import('@loadable/component').default;
|
|
2
|
+
type LoadableLazy = typeof import('@loadable/component').lazy;
|
|
3
|
+
type LoadableReady = typeof import('@loadable/component').loadableReady;
|
|
4
|
+
type LoadableInternals = unknown;
|
|
5
|
+
declare const loadable: LoadableDefault;
|
|
6
|
+
export declare const lazy: LoadableLazy;
|
|
7
|
+
export declare const loadableReady: LoadableReady;
|
|
8
|
+
export declare const __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: LoadableInternals;
|
|
2
9
|
export default loadable;
|
|
3
10
|
export * from '@loadable/component';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export * from '@tanstack/react-router';
|
|
1
|
+
export type * from '@tanstack/react-router';
|
|
2
|
+
export { Asset, Await, Block, CatchBoundary, CatchNotFound, ClientOnly, cleanPath, composeRewrites, createBrowserHistory, createControlledPromise, createFileRoute, createHashHistory, createHistory, createLazyFileRoute, createLazyRoute, createLink, createMemoryHistory, createRootRoute, createRootRouteWithContext, createRoute, createRouteMask, createRouter, createRouterConfig, createSerializationAdapter, DEFAULT_PROTOCOL_ALLOWLIST, DefaultGlobalNotFound, deepEqual, defaultParseSearch, defaultStringifySearch, defer, ErrorComponent, FileRoute, FileRouteLoader, functionalUpdate, getRouteApi, HeadContent, interpolatePath, isMatch, isNotFound, isPlainArray, isPlainObject, isRedirect, joinPaths, LazyRoute, lazyFn, lazyRouteComponent, linkOptions, Match, Matches, MatchRoute, Navigate, NotFoundRoute, notFound, parseSearchWith, RootRoute, Route, RouteApi, Router, RouterContextProvider, RouterProvider, reactUse, redirect, replaceEqualDeep, resolvePath, retainSearchParams, rootRouteId, rootRouteWithContext, ScriptOnce, Scripts, ScrollRestoration, SearchParamError, stringifySearchWith, stripSearchParams, trimPath, trimPathLeft, trimPathRight, useAwaited, useBlocker, useCanGoBack, useChildMatches, useElementScrollRestoration, useHydrated, useLayoutEffect, useLinkProps, useLoaderData, useLoaderDeps, useLocation, useMatch, useMatches, useMatchRoute, useNavigate, useParams, useParentMatches, useRouteContext, useRouter, useRouterState, useSearch, useTags, } from '@tanstack/react-router';
|
|
2
3
|
export type { Fetcher, FetcherState, FetcherSubmitOptions, FormProps, SubmitOptions, } from '../router/runtime/tanstack/dataMutation';
|
|
3
4
|
export { Form, RouteActionResponseError, useFetcher, } from '../router/runtime/tanstack/dataMutation';
|
|
5
|
+
export { Outlet } from '../router/runtime/tanstack/outlet';
|
|
4
6
|
export type { LinkProps, NavLinkProps, PrefetchBehavior, } from '../router/runtime/tanstack/prefetchLink';
|
|
5
7
|
export { Link, NavLink } from '../router/runtime/tanstack/prefetchLink';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const walkDirectory: (dir: string) => string[];
|
|
2
2
|
export declare const isPageComponentFile: (filePath: string) => boolean;
|
|
3
|
-
export declare const replaceWithAlias: (base: string, filePath: string, alias: string) =>
|
|
3
|
+
export declare const replaceWithAlias: (base: string, filePath: string, alias: string) => string;
|
|
4
4
|
export declare const parseModule: ({ source, filename, }: {
|
|
5
5
|
source: string;
|
|
6
6
|
filename: string;
|
|
@@ -13,6 +13,6 @@ export declare const getEntrypointRoutesDir: (entrypoint: {
|
|
|
13
13
|
export declare const getEntrypointRoutesOwner: (entrypoint: {
|
|
14
14
|
[ROUTES_OWNER_META_KEY]?: string;
|
|
15
15
|
}) => string | null;
|
|
16
|
-
export declare const hasNestedRoutes: (dir: string, routesDir?: string) =>
|
|
16
|
+
export declare const hasNestedRoutes: (dir: string, routesDir?: string) => boolean;
|
|
17
17
|
export declare const isRouteEntry: (dir: string, routesDir?: string) => string | false;
|
|
18
18
|
export declare const modifyEntrypoints: (entrypoints: Entrypoint[], routesDir?: string, routesOwner?: string) => EntrypointWithRoutesMeta[];
|
|
@@ -13,14 +13,18 @@ import React from 'react';
|
|
|
13
13
|
*
|
|
14
14
|
* - "intent": Fetched when the user focuses or hovers the link
|
|
15
15
|
* - "render": Fetched when the link is rendered
|
|
16
|
+
* - "viewport": Fetched when the link enters the viewport
|
|
16
17
|
* - "none": Never fetched
|
|
17
18
|
*/
|
|
18
|
-
type PrefetchBehavior = 'intent' | 'render' | 'none';
|
|
19
|
+
type PrefetchBehavior = 'intent' | 'render' | 'viewport' | 'none';
|
|
20
|
+
type PreloadBehavior = PrefetchBehavior | false;
|
|
19
21
|
export interface LinkProps extends RouterLinkProps {
|
|
20
22
|
prefetch?: PrefetchBehavior;
|
|
23
|
+
preload?: PreloadBehavior;
|
|
21
24
|
}
|
|
22
25
|
export interface NavLinkProps extends RouterNavLinkProps {
|
|
23
26
|
prefetch?: PrefetchBehavior;
|
|
27
|
+
preload?: PreloadBehavior;
|
|
24
28
|
}
|
|
25
29
|
declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
26
30
|
declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@modern-js/render/rsc-worker';
|