@bleedingdev/modern-js-runtime 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/boundary-debugger/index.js +13 -3
- package/dist/cjs/cli/registry.js +18 -0
- package/dist/cjs/cli/ssr/index.js +3 -2
- package/dist/cjs/cli/ssr/loadable-bundler-plugin.js +8 -4
- package/dist/cjs/core/browser/hydrate.js +16 -2
- package/dist/cjs/core/browser/index.js +15 -3
- package/dist/cjs/core/context/index.js +3 -0
- package/dist/cjs/core/context/public.js +49 -0
- package/dist/cjs/core/context/runtime.js +6 -8
- package/dist/cjs/core/react/wrapper.js +57 -0
- package/dist/cjs/core/server/federatedCss.js +7 -3
- package/dist/cjs/core/server/requestHandler.js +15 -45
- package/dist/cjs/core/server/requestResponse.js +83 -0
- package/dist/cjs/core/server/routerCleanup.js +16 -6
- package/dist/cjs/core/server/scriptOrder.js +13 -10
- package/dist/cjs/core/server/stream/afterTemplate.js +9 -5
- package/dist/cjs/core/server/stream/template.js +3 -3
- package/dist/cjs/core/server/string/loadable.js +3 -11
- package/dist/cjs/index.js +7 -6
- package/dist/cjs/module-federation/consume-surface.js +199 -0
- package/dist/cjs/module-federation/distributed-ssr.js +134 -0
- package/dist/cjs/module-federation/index.js +258 -120
- package/dist/cjs/module-federation/last-known-good.js +124 -0
- package/dist/cjs/module-federation/manifest-recovery-runtime-plugin.js +140 -0
- package/dist/cjs/module-federation/surface-resolution-types.js +61 -0
- package/dist/cjs/router/cli/code/nestedRoutes.js +3 -0
- package/dist/cjs/router/cli/code/templates.js +3 -2
- package/dist/cjs/router/cli/constants.js +1 -0
- package/dist/cjs/router/cli/nestedRoutesSpec.js +3 -1
- package/dist/cjs/router/runtime/hooks.js +7 -6
- package/dist/cjs/router/runtime/internal.js +30 -16
- package/dist/cjs/router/runtime/plugin.js +6 -7
- package/dist/cjs/router/runtime/provider.js +58 -12
- package/dist/esm/boundary-debugger/index.mjs +13 -3
- package/dist/esm/cli/code.mjs +12 -12
- package/dist/esm/cli/registry.mjs +0 -0
- package/dist/esm/cli/ssr/index.mjs +3 -2
- package/dist/esm/cli/ssr/loadable-bundler-plugin.mjs +8 -4
- package/dist/esm/core/browser/hydrate.mjs +15 -4
- package/dist/esm/core/browser/index.mjs +11 -5
- package/dist/esm/core/context/index.mjs +1 -1
- package/dist/esm/core/context/public.mjs +5 -0
- package/dist/esm/core/context/runtime.mjs +4 -6
- package/dist/esm/core/react/wrapper.mjs +58 -1
- package/dist/esm/core/server/federatedCss.mjs +7 -3
- package/dist/esm/core/server/requestHandler.mjs +15 -45
- package/dist/esm/core/server/requestResponse.mjs +39 -0
- package/dist/esm/core/server/routerCleanup.mjs +11 -4
- package/dist/esm/core/server/scriptOrder.mjs +11 -8
- package/dist/esm/core/server/stream/afterTemplate.mjs +10 -6
- package/dist/esm/core/server/stream/template.mjs +3 -3
- package/dist/esm/core/server/string/loadable.mjs +3 -8
- package/dist/esm/exports/loadable.mjs +3 -3
- package/dist/esm/index.mjs +2 -1
- package/dist/esm/module-federation/consume-surface.mjs +158 -0
- package/dist/esm/module-federation/distributed-ssr.mjs +81 -0
- package/dist/esm/module-federation/index.mjs +6 -0
- package/dist/esm/module-federation/last-known-good.mjs +80 -0
- package/dist/esm/module-federation/manifest-recovery-runtime-plugin.mjs +100 -0
- package/dist/esm/module-federation/surface-resolution-types.mjs +8 -0
- package/dist/esm/router/cli/code/index.mjs +5 -5
- package/dist/esm/router/cli/code/nestedRoutes.mjs +3 -0
- package/dist/esm/router/cli/code/templates.mjs +3 -2
- package/dist/esm/router/cli/constants.mjs +1 -0
- package/dist/esm/router/cli/handler.mjs +3 -3
- package/dist/esm/router/cli/nestedRoutesSpec.mjs +3 -1
- package/dist/esm/router/runtime/hooks.mjs +7 -6
- package/dist/esm/router/runtime/internal.mjs +26 -18
- package/dist/esm/router/runtime/plugin.mjs +6 -7
- package/dist/esm/router/runtime/provider.mjs +56 -13
- package/dist/esm-node/boundary-debugger/index.mjs +13 -3
- package/dist/esm-node/cli/code.mjs +12 -12
- package/dist/esm-node/cli/registry.mjs +1 -0
- package/dist/esm-node/cli/ssr/index.mjs +3 -2
- package/dist/esm-node/cli/ssr/loadable-bundler-plugin.mjs +8 -4
- package/dist/esm-node/core/browser/hydrate.mjs +15 -4
- package/dist/esm-node/core/browser/index.mjs +11 -5
- package/dist/esm-node/core/context/index.mjs +1 -1
- package/dist/esm-node/core/context/public.mjs +6 -0
- package/dist/esm-node/core/context/runtime.mjs +4 -6
- package/dist/esm-node/core/react/wrapper.mjs +58 -1
- package/dist/esm-node/core/server/federatedCss.mjs +7 -3
- package/dist/esm-node/core/server/requestHandler.mjs +15 -45
- package/dist/esm-node/core/server/requestResponse.mjs +40 -0
- package/dist/esm-node/core/server/routerCleanup.mjs +11 -4
- package/dist/esm-node/core/server/scriptOrder.mjs +11 -8
- package/dist/esm-node/core/server/stream/afterTemplate.mjs +10 -6
- package/dist/esm-node/core/server/stream/template.mjs +3 -3
- package/dist/esm-node/core/server/string/loadable.mjs +3 -8
- package/dist/esm-node/exports/loadable.mjs +3 -3
- package/dist/esm-node/index.mjs +2 -1
- package/dist/esm-node/module-federation/consume-surface.mjs +159 -0
- package/dist/esm-node/module-federation/distributed-ssr.mjs +82 -0
- package/dist/esm-node/module-federation/index.mjs +6 -0
- package/dist/esm-node/module-federation/last-known-good.mjs +81 -0
- package/dist/esm-node/module-federation/manifest-recovery-runtime-plugin.mjs +101 -0
- package/dist/esm-node/module-federation/surface-resolution-types.mjs +9 -0
- package/dist/esm-node/router/cli/code/index.mjs +5 -5
- package/dist/esm-node/router/cli/code/nestedRoutes.mjs +3 -0
- package/dist/esm-node/router/cli/code/templates.mjs +3 -2
- package/dist/esm-node/router/cli/constants.mjs +1 -0
- package/dist/esm-node/router/cli/handler.mjs +3 -3
- package/dist/esm-node/router/cli/nestedRoutesSpec.mjs +3 -1
- package/dist/esm-node/router/runtime/hooks.mjs +7 -6
- package/dist/esm-node/router/runtime/internal.mjs +26 -18
- package/dist/esm-node/router/runtime/plugin.mjs +6 -7
- package/dist/esm-node/router/runtime/provider.mjs +56 -13
- package/dist/types/boundary-debugger/index.d.ts +1 -1
- package/dist/types/cli/registry.d.ts +2 -0
- package/dist/types/common.d.ts +8 -1
- package/dist/types/core/browser/hydrate.d.ts +2 -1
- package/dist/types/core/browser/index.d.ts +4 -0
- package/dist/types/core/context/index.d.ts +26 -10
- package/dist/types/core/context/monitors/default.d.ts +10 -2
- package/dist/types/core/context/monitors/index.d.ts +1 -1
- package/dist/types/core/context/monitors/index.server.d.ts +2 -2
- package/dist/types/core/context/public.d.ts +27 -0
- package/dist/types/core/context/runtime.d.ts +12 -22
- package/dist/types/core/react/index.d.ts +1 -1
- package/dist/types/core/server/requestResponse.d.ts +15 -0
- package/dist/types/core/server/routerCleanup.d.ts +2 -1
- package/dist/types/core/server/scriptOrder.d.ts +1 -1
- package/dist/types/core/server/stream/shared.d.ts +2 -2
- package/dist/types/core/server/string/loadable.d.ts +0 -2
- package/dist/types/exports/head.d.ts +1 -1
- package/dist/types/index.d.ts +5 -5
- package/dist/types/internal.d.ts +0 -1
- package/dist/types/module-federation/consume-surface.d.ts +104 -0
- package/dist/types/module-federation/distributed-ssr.d.ts +61 -0
- package/dist/types/module-federation/index.d.ts +6 -0
- package/dist/types/module-federation/last-known-good.d.ts +72 -0
- package/dist/types/module-federation/manifest-recovery-runtime-plugin.d.ts +25 -0
- package/dist/types/module-federation/surface-resolution-types.d.ts +23 -0
- package/dist/types/router/cli/constants.d.ts +1 -0
- package/dist/types/router/runtime/hooks.d.ts +10 -6
- package/dist/types/router/runtime/internal.d.ts +13 -3
- package/dist/types/router/runtime/plugin.d.ts +1 -1
- package/dist/types/router/runtime/plugin.node.d.ts +1 -1
- package/dist/types/router/runtime/provider.d.ts +28 -11
- package/dist/types/router/runtime/types.d.ts +27 -5
- package/package.json +46 -27
- package/dist/cjs/exports/tanstack-router.js +0 -83
- package/dist/esm/exports/tanstack-router.mjs +0 -30
- package/dist/esm-node/exports/tanstack-router.mjs +0 -31
- package/dist/types/exports/tanstack-router.d.ts +0 -88
|
@@ -3,15 +3,13 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { storage } from "@modern-js/runtime-utils/node";
|
|
4
4
|
import { getPathname, parseCookie, parseHeaders, parseQuery } from "@modern-js/runtime-utils/universal/request";
|
|
5
5
|
import react, { Fragment } from "react";
|
|
6
|
-
import { getRouterServerSnapshot } from "../../router/runtime/lifecycle.mjs";
|
|
7
|
-
import { handleRSCRedirect } from "../../router/runtime/rsc-router.mjs";
|
|
8
6
|
import { getGlobalInternalRuntimeContext, getGlobalRSCRoot } from "../context/index.mjs";
|
|
9
7
|
import { getInitialContext } from "../context/runtime.mjs";
|
|
10
8
|
import { getServerPayload } from "../context/serverPayload/index.mjs";
|
|
11
9
|
import { createRoot } from "../react/index.mjs";
|
|
12
10
|
import { CHUNK_CSS_PLACEHOLDER } from "./constants.mjs";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
11
|
+
import { applyRouterSnapshotResult, createLoaderRedirectResponse, finalizeRenderResponse } from "./requestResponse.mjs";
|
|
12
|
+
import { createRouterCleanup, finishWithRouterCleanup, runWithRouterCleanupOnError } from "./routerCleanup.mjs";
|
|
15
13
|
import { getSSRConfigByEntry, getSSRMode } from "./utils.mjs";
|
|
16
14
|
async function handleRSCRequest(request, Root, context, options, handleRequest) {
|
|
17
15
|
const serverPayload = getServerPayload();
|
|
@@ -31,29 +29,6 @@ async function handleRSCRequest(request, Root, context, options, handleRequest)
|
|
|
31
29
|
runtimeContext: context
|
|
32
30
|
});
|
|
33
31
|
}
|
|
34
|
-
const isRedirectStatus = (status)=>status >= 300 && status <= 399;
|
|
35
|
-
const processRedirect = (headers, status, ctx)=>{
|
|
36
|
-
if (ctx.enableRsc && ctx.isRSCNavigation) return handleRSCRedirect(headers, ctx.basename, status);
|
|
37
|
-
return new Response(null, {
|
|
38
|
-
status,
|
|
39
|
-
headers
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
const applyRouterSnapshotResult = (context, onError)=>{
|
|
43
|
-
const routerServerSnapshot = getRouterServerSnapshot(context);
|
|
44
|
-
const routerStatusCode = routerServerSnapshot?.statusCode ?? context.routerContext?.statusCode;
|
|
45
|
-
if (routerStatusCode && 200 !== routerStatusCode) context.ssrContext?.response.status(routerStatusCode);
|
|
46
|
-
const errors = Object.values(routerServerSnapshot?.errors || context.routerContext?.errors || {});
|
|
47
|
-
if (errors.length > 0) onError(errors[0], SSRErrors.LOADER_ERROR);
|
|
48
|
-
};
|
|
49
|
-
const createLoaderRedirectResponse = (beforeRenderResult, redirectCtx)=>{
|
|
50
|
-
if (!beforeRenderResult || !isRedirectStatus(beforeRenderResult.status)) return;
|
|
51
|
-
if (beforeRenderResult.headers.has('X-Modernjs-Redirect')) return beforeRenderResult;
|
|
52
|
-
const redirectUrl = beforeRenderResult.headers.get('Location') || '/';
|
|
53
|
-
return processRedirect(new Headers({
|
|
54
|
-
Location: redirectUrl
|
|
55
|
-
}), beforeRenderResult.status, redirectCtx);
|
|
56
|
-
};
|
|
57
32
|
const renderRequest = async (request, Root, context, options, handleRequest, enableRsc)=>{
|
|
58
33
|
if (enableRsc) return handleRSCRequest(request, Root, context, options, handleRequest);
|
|
59
34
|
return handleRequest(request, Root, {
|
|
@@ -61,17 +36,6 @@ const renderRequest = async (request, Root, context, options, handleRequest, ena
|
|
|
61
36
|
runtimeContext: context
|
|
62
37
|
});
|
|
63
38
|
};
|
|
64
|
-
const finalizeRenderResponse = (response, responseProxy, redirectCtx, routerCleanup)=>{
|
|
65
|
-
if (-1 !== responseProxy.status && isRedirectStatus(responseProxy.status) && responseProxy.headers.Location) return processRedirect(new Headers(responseProxy.headers), responseProxy.status, redirectCtx);
|
|
66
|
-
Object.entries(responseProxy.headers).forEach(([key, value])=>{
|
|
67
|
-
response.headers.set(key, value);
|
|
68
|
-
});
|
|
69
|
-
if (-1 !== responseProxy.status) return routerCleanup.deferUntilBodyDone(new Response(response.body, {
|
|
70
|
-
status: responseProxy.status,
|
|
71
|
-
headers: response.headers
|
|
72
|
-
}));
|
|
73
|
-
return routerCleanup.deferUntilBodyDone(response);
|
|
74
|
-
};
|
|
75
39
|
function createSSRContext(request, options) {
|
|
76
40
|
const { config, loaderContext, onError, onTiming, locals, resource, params, responseProxy, reporter } = options;
|
|
77
41
|
const { nonce, useJsonScript } = config;
|
|
@@ -167,20 +131,26 @@ const createRequestHandler = async (handleRequest, createRequestOptions)=>{
|
|
|
167
131
|
isRSCNavigation: 'true' === request.headers.get('x-rsc-tree'),
|
|
168
132
|
basename: ssrContext.baseUrl || '/'
|
|
169
133
|
};
|
|
170
|
-
|
|
171
|
-
|
|
134
|
+
const routerCleanup = createRouterCleanup(context, options.onError);
|
|
135
|
+
const beforeRenderResult = await runWithRouterCleanupOnError(routerCleanup, ()=>runBeforeRender(context));
|
|
136
|
+
await runWithRouterCleanupOnError(routerCleanup, ()=>{
|
|
172
137
|
applyRouterSnapshotResult(context, options.onError);
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
138
|
+
});
|
|
139
|
+
if ("u" > typeof Response) {
|
|
140
|
+
const redirectResponse = await runWithRouterCleanupOnError(routerCleanup, ()=>createLoaderRedirectResponse(beforeRenderResult, redirectCtx));
|
|
141
|
+
if (redirectResponse) {
|
|
142
|
+
await routerCleanup.run();
|
|
143
|
+
return redirectResponse;
|
|
176
144
|
}
|
|
145
|
+
}
|
|
146
|
+
await runWithRouterCleanupOnError(routerCleanup, ()=>{
|
|
177
147
|
if (!createRequestOptions?.enableRsc) {
|
|
178
148
|
const { htmlTemplate } = options.resource;
|
|
179
149
|
options.resource.htmlTemplate = htmlTemplate.replace('</head>', `${CHUNK_CSS_PLACEHOLDER}</head>`);
|
|
180
150
|
}
|
|
181
|
-
const response = await renderRequest(request, Root, context, options, handleRequest, !!createRequestOptions?.enableRsc);
|
|
182
|
-
return finalizeRenderResponse(response, responseProxy, redirectCtx, routerCleanup);
|
|
183
151
|
});
|
|
152
|
+
const response = await runWithRouterCleanupOnError(routerCleanup, ()=>renderRequest(request, Root, context, options, handleRequest, !!createRequestOptions?.enableRsc));
|
|
153
|
+
return finishWithRouterCleanup(routerCleanup, ()=>finalizeRenderResponse(response, responseProxy, redirectCtx, routerCleanup));
|
|
184
154
|
});
|
|
185
155
|
};
|
|
186
156
|
return requestHandler;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { getRouterServerSnapshot } from "../../router/runtime/lifecycle.mjs";
|
|
3
|
+
import { handleRSCRedirect } from "../../router/runtime/rsc-router.mjs";
|
|
4
|
+
import { SSRErrors } from "./tracer.mjs";
|
|
5
|
+
const isRedirectStatus = (status)=>status >= 300 && status <= 399;
|
|
6
|
+
const isNullBodyStatus = (status)=>204 === status || 205 === status || 304 === status;
|
|
7
|
+
const processRedirect = (headers, status, ctx)=>{
|
|
8
|
+
if (ctx.enableRsc && ctx.isRSCNavigation) return handleRSCRedirect(headers, ctx.basename, status);
|
|
9
|
+
return new Response(null, {
|
|
10
|
+
status,
|
|
11
|
+
headers
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
const applyRouterSnapshotResult = (context, onError)=>{
|
|
15
|
+
const routerServerSnapshot = getRouterServerSnapshot(context);
|
|
16
|
+
const routerStatusCode = routerServerSnapshot?.statusCode ?? context.routerContext?.statusCode;
|
|
17
|
+
if (routerStatusCode && 200 !== routerStatusCode) context.ssrContext?.response.status(routerStatusCode);
|
|
18
|
+
const errors = Object.values(routerServerSnapshot?.errors || context.routerContext?.errors || {});
|
|
19
|
+
if (errors.length > 0) onError(errors[0], SSRErrors.LOADER_ERROR);
|
|
20
|
+
};
|
|
21
|
+
const createLoaderRedirectResponse = (beforeRenderResult, redirectCtx)=>{
|
|
22
|
+
if (!beforeRenderResult || !isRedirectStatus(beforeRenderResult.status)) return;
|
|
23
|
+
if (beforeRenderResult.headers.has('X-Modernjs-Redirect')) return beforeRenderResult;
|
|
24
|
+
const redirectUrl = beforeRenderResult.headers.get('Location') || '/';
|
|
25
|
+
return processRedirect(new Headers({
|
|
26
|
+
Location: redirectUrl
|
|
27
|
+
}), beforeRenderResult.status, redirectCtx);
|
|
28
|
+
};
|
|
29
|
+
const finalizeRenderResponse = (response, responseProxy, redirectCtx, routerCleanup)=>{
|
|
30
|
+
if (-1 !== responseProxy.status && isRedirectStatus(responseProxy.status) && responseProxy.headers.Location) return processRedirect(new Headers(responseProxy.headers), responseProxy.status, redirectCtx);
|
|
31
|
+
Object.entries(responseProxy.headers).forEach(([key, value])=>{
|
|
32
|
+
response.headers.set(key, value);
|
|
33
|
+
});
|
|
34
|
+
if (-1 !== responseProxy.status) return routerCleanup.deferUntilBodyDone(new Response(isNullBodyStatus(responseProxy.status) ? null : response.body, {
|
|
35
|
+
status: responseProxy.status,
|
|
36
|
+
headers: response.headers
|
|
37
|
+
}));
|
|
38
|
+
return routerCleanup.deferUntilBodyDone(response);
|
|
39
|
+
};
|
|
40
|
+
export { applyRouterSnapshotResult, createLoaderRedirectResponse, finalizeRenderResponse };
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { getRouterRuntimeState } from "../../router/runtime/lifecycle.mjs";
|
|
3
3
|
const ROUTER_CLEANUP_ERROR = 'An error occurs during router runtime cleanup';
|
|
4
|
-
async function
|
|
5
|
-
const routerCleanup = createRouterCleanup(runtimeContext, onError);
|
|
4
|
+
async function runWithRouterCleanupOnError(routerCleanup, callback) {
|
|
6
5
|
try {
|
|
7
|
-
return await callback(
|
|
6
|
+
return await callback();
|
|
7
|
+
} catch (error) {
|
|
8
|
+
await routerCleanup.run();
|
|
9
|
+
throw error;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
async function finishWithRouterCleanup(routerCleanup, callback) {
|
|
13
|
+
try {
|
|
14
|
+
return await callback();
|
|
8
15
|
} finally{
|
|
9
16
|
if (!routerCleanup.deferred) await routerCleanup.run();
|
|
10
17
|
}
|
|
@@ -64,4 +71,4 @@ function createRouterCleanup(runtimeContext, onError) {
|
|
|
64
71
|
deferUntilBodyDone
|
|
65
72
|
};
|
|
66
73
|
}
|
|
67
|
-
export { ROUTER_CLEANUP_ERROR, createRouterCleanup,
|
|
74
|
+
export { ROUTER_CLEANUP_ERROR, createRouterCleanup, finishWithRouterCleanup, runWithRouterCleanupOnError };
|
|
@@ -43,6 +43,10 @@ function getMatchedRouteAssets(runtimeContext, routeManifest) {
|
|
|
43
43
|
const matchedRouteIds = getRouterMatchedRouteIds(runtimeContext) ?? [];
|
|
44
44
|
return matchedRouteIds.flatMap((routeId)=>routeAssets[routeId]?.assets ?? []);
|
|
45
45
|
}
|
|
46
|
+
function getMatchedRouteChunks(runtimeContext, routeManifest, routeAssetToChunk) {
|
|
47
|
+
if (!routeManifest) return [];
|
|
48
|
+
return getMatchedRouteAssets(runtimeContext, routeManifest).map(routeAssetToChunk);
|
|
49
|
+
}
|
|
46
50
|
const orderHydrationScriptChunks = ({ asyncEntryChunks, collectedChunks, matchedRouteChunks, entryName })=>{
|
|
47
51
|
const asyncEntryScriptChunks = [];
|
|
48
52
|
const asyncEntryDependencyChunks = [];
|
|
@@ -73,13 +77,12 @@ function createRouteHydrationScriptTags(runtimeContext, entryName, options = {})
|
|
|
73
77
|
const { nonce, template } = options;
|
|
74
78
|
const routeAssets = getRouteAssets(runtimeContext);
|
|
75
79
|
if (void 0 === routeAssets) return '';
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
...
|
|
79
|
-
routeAssets[`async-${entryName}`]
|
|
80
|
-
].filter((
|
|
81
|
-
const jsAssets = Array.from(new Set(assetEntries.flatMap((entry)=>(entry.assets ?? []).filter((asset)=>asset.endsWith('.js')))));
|
|
80
|
+
const existingScriptSrcs = void 0 === template ? new Set() : new Set(getScriptTags(template).map(({ src })=>src));
|
|
81
|
+
const jsAssets = Array.from(new Set([
|
|
82
|
+
...getMatchedRouteAssets(runtimeContext),
|
|
83
|
+
...routeAssets[`async-${entryName}`]?.assets ?? []
|
|
84
|
+
].filter((asset)=>asset.endsWith('.js'))));
|
|
82
85
|
const nonceAttr = void 0 === nonce || '' === nonce ? '' : ` nonce="${nonce}"`;
|
|
83
|
-
return jsAssets.filter((asset)
|
|
86
|
+
return jsAssets.filter((asset)=>!existingScriptSrcs.has(asset)).map((asset)=>`<script src=${asset}${nonceAttr}></script>`).join(' ');
|
|
84
87
|
}
|
|
85
|
-
export { createRouteHydrationScriptTags,
|
|
88
|
+
export { createRouteHydrationScriptTags, getMatchedRouteChunks, injectBeforeHydrationEntryScript, orderHydrationScriptChunks, replaceChunkJsPlaceholder };
|
|
@@ -5,19 +5,20 @@ import { SSR_DATA_JSON_ID } from "../../constants.mjs";
|
|
|
5
5
|
import { SSR_DATA_PLACEHOLDER } from "../constants.mjs";
|
|
6
6
|
import { createRouteHydrationScriptTags, replaceChunkJsPlaceholder } from "../scriptOrder.mjs";
|
|
7
7
|
import { buildHtml } from "../shared.mjs";
|
|
8
|
-
import { attributesToString
|
|
8
|
+
import { attributesToString } from "../utils.mjs";
|
|
9
9
|
function buildShellAfterTemplate(afterAppTemplate, options) {
|
|
10
10
|
const { request, config, ssrConfig, runtimeContext, renderLevel, entryName } = options;
|
|
11
11
|
const callbacks = [
|
|
12
|
+
(template)=>injectJs(template, entryName, config.nonce),
|
|
12
13
|
createReplaceSSRData({
|
|
13
14
|
request,
|
|
14
15
|
ssrConfig,
|
|
15
16
|
nonce: config.nonce,
|
|
16
17
|
useJsonScript: config.useJsonScript,
|
|
17
18
|
runtimeContext,
|
|
18
|
-
renderLevel
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
renderLevel,
|
|
20
|
+
entryName
|
|
21
|
+
})
|
|
21
22
|
];
|
|
22
23
|
async function injectJs(template, entryName, nonce) {
|
|
23
24
|
const jsChunkStr = createRouteHydrationScriptTags(runtimeContext, entryName, {
|
|
@@ -30,7 +31,7 @@ function buildShellAfterTemplate(afterAppTemplate, options) {
|
|
|
30
31
|
return buildHtml(afterAppTemplate, callbacks);
|
|
31
32
|
}
|
|
32
33
|
function createReplaceSSRData(options) {
|
|
33
|
-
const { runtimeContext, nonce, renderLevel, useJsonScript, ssrConfig } = options;
|
|
34
|
+
const { runtimeContext, nonce, renderLevel, useJsonScript, ssrConfig, entryName } = options;
|
|
34
35
|
const { request, reporter } = runtimeContext.ssrContext;
|
|
35
36
|
const headers = 'object' == typeof ssrConfig && ssrConfig.unsafeHeaders ? Object.fromEntries(Object.entries(request.headers).filter(([key, _])=>ssrConfig.unsafeHeaders?.map((header)=>header.toLowerCase())?.includes(key.toLowerCase()))) : void 0;
|
|
36
37
|
const ssrData = {
|
|
@@ -61,6 +62,9 @@ function createReplaceSSRData(options) {
|
|
|
61
62
|
const ssrDataScript = useJsonScript ? `<script type="application/json" id="${SSR_DATA_JSON_ID}">${serializeSSRData}</script>` : `<script${attrsStr}>window._SSR_DATA = ${serializeSSRData}</script>`;
|
|
62
63
|
const hydrationScripts = getRouterHydrationScripts(runtimeContext);
|
|
63
64
|
const ssrScripts = hydrationScripts.length ? `${ssrDataScript}\n${hydrationScripts.join('\n')}` : ssrDataScript;
|
|
64
|
-
return (template)=>
|
|
65
|
+
return (template)=>{
|
|
66
|
+
if (!template.includes(SSR_DATA_PLACEHOLDER)) return template;
|
|
67
|
+
return replaceChunkJsPlaceholder(template, ssrScripts, entryName, SSR_DATA_PLACEHOLDER);
|
|
68
|
+
};
|
|
65
69
|
}
|
|
66
70
|
export { buildShellAfterTemplate };
|
|
@@ -3,12 +3,12 @@ import { buildShellAfterTemplate } from "./afterTemplate.mjs";
|
|
|
3
3
|
import { buildShellBeforeTemplate } from "./beforeTemplate.mjs";
|
|
4
4
|
const HTML_SEPARATOR = '<!--<?- html ?>-->';
|
|
5
5
|
const getTemplates = async (htmlTemplate, options)=>{
|
|
6
|
-
const
|
|
6
|
+
const builtTemplate = await buildShellAfterTemplate(htmlTemplate, options);
|
|
7
|
+
const [beforeAppTemplate = '', afterAppHtmlTemplate = ''] = builtTemplate.split(HTML_SEPARATOR) || [];
|
|
7
8
|
const builtBeforeTemplate = await buildShellBeforeTemplate(beforeAppTemplate, options);
|
|
8
|
-
const builtAfterTemplate = await buildShellAfterTemplate(afterAppHtmlTemplate, options);
|
|
9
9
|
return {
|
|
10
10
|
shellBefore: builtBeforeTemplate,
|
|
11
|
-
shellAfter:
|
|
11
|
+
shellAfter: afterAppHtmlTemplate
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
export { getTemplates };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { ChunkExtractor } from "@loadable/server";
|
|
3
3
|
import { createFederatedCssLinks } from "../federatedCss.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { getMatchedRouteChunks, orderHydrationScriptChunks } from "../scriptOrder.mjs";
|
|
5
5
|
import { attributesToString, checkIsNode, hasStylesheetLink } from "../utils.mjs";
|
|
6
6
|
import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
7
7
|
import { dirname as __rspack_dirname } from "node:path";
|
|
@@ -32,11 +32,6 @@ const readAsset = async (chunk)=>{
|
|
|
32
32
|
return fs.readFile(filepath, 'utf-8');
|
|
33
33
|
};
|
|
34
34
|
class LoadableCollector {
|
|
35
|
-
getMatchedRouteChunks() {
|
|
36
|
-
const { routeManifest, runtimeContext } = this.options;
|
|
37
|
-
if (!routeManifest) return [];
|
|
38
|
-
return getMatchedRouteAssets(runtimeContext, routeManifest).map(routeAssetToChunk);
|
|
39
|
-
}
|
|
40
35
|
collect(comopnent) {
|
|
41
36
|
const { stats, entryName } = this.options;
|
|
42
37
|
if (!stats) return comopnent;
|
|
@@ -58,7 +53,7 @@ class LoadableCollector {
|
|
|
58
53
|
]));
|
|
59
54
|
} catch (e) {}
|
|
60
55
|
const collectedChunks = extractor ? extractor.getChunkAssets(extractor.chunks) : [];
|
|
61
|
-
const matchedRouteChunks =
|
|
56
|
+
const matchedRouteChunks = getMatchedRouteChunks(options.runtimeContext, options.routeManifest, routeAssetToChunk);
|
|
62
57
|
const orderedScriptChunks = orderHydrationScriptChunks({
|
|
63
58
|
asyncEntryChunks: asyncChunks,
|
|
64
59
|
collectedChunks,
|
|
@@ -136,4 +131,4 @@ class LoadableCollector {
|
|
|
136
131
|
this.options = options;
|
|
137
132
|
}
|
|
138
133
|
}
|
|
139
|
-
export { LoadableCollector
|
|
134
|
+
export { LoadableCollector };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import * as
|
|
2
|
+
import * as __rspack_external__loadable_component_ee3b4254 from "@loadable/component";
|
|
3
3
|
export * from "@loadable/component";
|
|
4
4
|
function asLoadableNamespace(value) {
|
|
5
5
|
return 'object' == typeof value && null !== value ? value : {};
|
|
@@ -16,8 +16,8 @@ function resolveLoadable(module) {
|
|
|
16
16
|
if ('function' != typeof loadable) throw new TypeError('Modern.js runtime loadable export must resolve to a function');
|
|
17
17
|
return loadable;
|
|
18
18
|
}
|
|
19
|
-
const loadable_loadable = resolveLoadable(
|
|
20
|
-
const loadableNamespace = asLoadableNamespace(
|
|
19
|
+
const loadable_loadable = resolveLoadable(__rspack_external__loadable_component_ee3b4254);
|
|
20
|
+
const loadableNamespace = asLoadableNamespace(__rspack_external__loadable_component_ee3b4254);
|
|
21
21
|
const loadableDefaultNamespace = asLoadableNamespace(loadableNamespace.default);
|
|
22
22
|
const callableLoadableNamespace = asLoadableNamespace(loadable_loadable);
|
|
23
23
|
const lazy = loadableNamespace.lazy ?? loadableDefaultNamespace.lazy ?? callableLoadableNamespace.lazy;
|
package/dist/esm-node/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
export { isBrowser } from "./common.mjs";
|
|
3
|
-
export {
|
|
3
|
+
export { defineRuntimeConfig } from "./core/config.mjs";
|
|
4
4
|
export { getMonitors } from "./core/context/monitors/index.mjs";
|
|
5
|
+
export { RuntimeContext, useRuntimeContext } from "./core/context/public.mjs";
|
|
5
6
|
export { getRequest } from "./core/context/request/index.mjs";
|
|
6
7
|
export { redirect, setHeaders, setStatus } from "./core/context/response/index.mjs";
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { classifyModuleFederationFallback, createModuleFederationFallbackTelemetry, emitModuleFederationFallbackTelemetry } from "./index.mjs";
|
|
3
|
+
import { createDiscoveryError, formatSurfaceRef, parseSurfaceRef, validateSurfaceRef } from "./surface-resolution-types.mjs";
|
|
4
|
+
function classifyDiscoveryError(code) {
|
|
5
|
+
switch(code){
|
|
6
|
+
case 'major-not-published':
|
|
7
|
+
case 'stale-record':
|
|
8
|
+
return 'version-skew';
|
|
9
|
+
case 'identity-mismatch':
|
|
10
|
+
return 'contract';
|
|
11
|
+
case 'unknown-unit':
|
|
12
|
+
case 'unknown-surface':
|
|
13
|
+
case 'provider-unavailable':
|
|
14
|
+
return 'remote-unavailable';
|
|
15
|
+
default:
|
|
16
|
+
return 'remote-unavailable';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function toRemoteString(ref) {
|
|
20
|
+
return void 0 === validateSurfaceRef(ref) ? formatSurfaceRef(ref) : `${ref.unitId}#${ref.surfaceId}`;
|
|
21
|
+
}
|
|
22
|
+
async function reportFailure(options, ref, base) {
|
|
23
|
+
const remote = toRemoteString(ref);
|
|
24
|
+
const telemetry = createModuleFederationFallbackTelemetry({
|
|
25
|
+
appName: options.appName,
|
|
26
|
+
classification: base.classification,
|
|
27
|
+
error: base.error ?? base.discoveryError,
|
|
28
|
+
metadata: {
|
|
29
|
+
env: options.env,
|
|
30
|
+
surfaceRef: remote,
|
|
31
|
+
...base.discoveryError ? {
|
|
32
|
+
discoveryErrorCode: base.discoveryError.code
|
|
33
|
+
} : {},
|
|
34
|
+
...base.resolved ? {
|
|
35
|
+
buildMarker: base.resolved.buildMarker
|
|
36
|
+
} : {}
|
|
37
|
+
},
|
|
38
|
+
phase: base.phase,
|
|
39
|
+
remote,
|
|
40
|
+
status: 'degraded'
|
|
41
|
+
});
|
|
42
|
+
try {
|
|
43
|
+
await emitModuleFederationFallbackTelemetry({
|
|
44
|
+
appName: options.appName,
|
|
45
|
+
classification: base.classification,
|
|
46
|
+
error: base.error ?? base.discoveryError,
|
|
47
|
+
metadata: telemetry.metadata,
|
|
48
|
+
phase: base.phase,
|
|
49
|
+
remote,
|
|
50
|
+
status: 'degraded'
|
|
51
|
+
}, options.telemetry ?? {});
|
|
52
|
+
} catch {}
|
|
53
|
+
const failure = {
|
|
54
|
+
ref,
|
|
55
|
+
env: options.env,
|
|
56
|
+
phase: base.phase,
|
|
57
|
+
classification: base.classification,
|
|
58
|
+
telemetry
|
|
59
|
+
};
|
|
60
|
+
if (base.discoveryError) failure.discoveryError = base.discoveryError;
|
|
61
|
+
if (void 0 !== base.error) failure.error = base.error;
|
|
62
|
+
if (base.resolved) failure.resolved = base.resolved;
|
|
63
|
+
const critical = (options.classification ?? 'critical') === 'critical';
|
|
64
|
+
const reason = base.discoveryError ?? (void 0 !== base.error ? base.error : createDiscoveryError('identity-mismatch', remote, `resolved record for "${remote}" is incompatible`, {
|
|
65
|
+
env: options.env
|
|
66
|
+
}));
|
|
67
|
+
let degradedValue;
|
|
68
|
+
try {
|
|
69
|
+
degradedValue = await options.degraded(failure);
|
|
70
|
+
} catch (handlerError) {
|
|
71
|
+
try {
|
|
72
|
+
await emitModuleFederationFallbackTelemetry({
|
|
73
|
+
appName: options.appName,
|
|
74
|
+
classification: base.classification,
|
|
75
|
+
error: handlerError,
|
|
76
|
+
metadata: {
|
|
77
|
+
...telemetry.metadata,
|
|
78
|
+
degradedHandlerFailed: true
|
|
79
|
+
},
|
|
80
|
+
phase: base.phase,
|
|
81
|
+
remote,
|
|
82
|
+
status: 'failed'
|
|
83
|
+
}, options.telemetry ?? {});
|
|
84
|
+
} catch {}
|
|
85
|
+
if (critical) throw reason;
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (critical) throw reason;
|
|
89
|
+
return degradedValue;
|
|
90
|
+
}
|
|
91
|
+
async function consumeSurface(options) {
|
|
92
|
+
let ref;
|
|
93
|
+
if ('string' == typeof options.ref) {
|
|
94
|
+
const parsed = parseSurfaceRef(options.ref);
|
|
95
|
+
if (!parsed.ok) {
|
|
96
|
+
const hashIndex = options.ref.indexOf('#');
|
|
97
|
+
const echoed = -1 === hashIndex ? {
|
|
98
|
+
unitId: options.ref,
|
|
99
|
+
surfaceId: ''
|
|
100
|
+
} : {
|
|
101
|
+
unitId: options.ref.slice(0, hashIndex),
|
|
102
|
+
surfaceId: options.ref.slice(hashIndex + 1)
|
|
103
|
+
};
|
|
104
|
+
return reportFailure(options, echoed, {
|
|
105
|
+
phase: 'discovery',
|
|
106
|
+
classification: 'remote-unavailable',
|
|
107
|
+
discoveryError: createDiscoveryError('unknown-surface', options.ref, `SurfaceRef "${options.ref}" is not a valid canonical reference (${parsed.error.code}).`, {
|
|
108
|
+
parseError: parsed.error,
|
|
109
|
+
env: options.env
|
|
110
|
+
})
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
ref = parsed.ref;
|
|
114
|
+
} else ref = options.ref;
|
|
115
|
+
let resolution;
|
|
116
|
+
try {
|
|
117
|
+
resolution = await options.provider.resolve(ref, options.env);
|
|
118
|
+
} catch (error) {
|
|
119
|
+
return reportFailure(options, ref, {
|
|
120
|
+
phase: 'discovery',
|
|
121
|
+
classification: classifyModuleFederationFallback(error),
|
|
122
|
+
error
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
if (!resolution.ok) return reportFailure(options, ref, {
|
|
126
|
+
phase: 'discovery',
|
|
127
|
+
classification: classifyDiscoveryError(resolution.error.code),
|
|
128
|
+
discoveryError: resolution.error
|
|
129
|
+
});
|
|
130
|
+
const resolved = resolution.unit;
|
|
131
|
+
if ('incompatible' === resolved.compatibility.status) return reportFailure(options, ref, {
|
|
132
|
+
phase: 'discovery',
|
|
133
|
+
classification: 'contract',
|
|
134
|
+
resolved
|
|
135
|
+
});
|
|
136
|
+
try {
|
|
137
|
+
return await options.load({
|
|
138
|
+
resolved,
|
|
139
|
+
ref,
|
|
140
|
+
env: options.env
|
|
141
|
+
});
|
|
142
|
+
} catch (error) {
|
|
143
|
+
return reportFailure(options, ref, {
|
|
144
|
+
phase: 'load',
|
|
145
|
+
classification: classifyModuleFederationFallback(error),
|
|
146
|
+
error,
|
|
147
|
+
resolved
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function createSurfaceConsumer(base) {
|
|
152
|
+
return function(options) {
|
|
153
|
+
return consumeSurface({
|
|
154
|
+
...base,
|
|
155
|
+
...options
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
export { consumeSurface, createSurfaceConsumer };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useRuntimeContext } from "../core/context/runtime.mjs";
|
|
4
|
+
const DISTRIBUTED_SSR_FRAGMENTS_LOCALS_KEY = '__modernDistributedSsrFragments';
|
|
5
|
+
const DISTRIBUTED_SSR_FRAGMENT_REQUEST_LOCALS_KEY = '__modernDistributedSsrFragmentRequest';
|
|
6
|
+
function distributedSsrFragmentKey(remote, expose) {
|
|
7
|
+
return `${remote}::${expose}`;
|
|
8
|
+
}
|
|
9
|
+
function getDistributedSsrFragmentContext(response) {
|
|
10
|
+
const locals = response?.locals;
|
|
11
|
+
if (!locals || 'object' != typeof locals) return;
|
|
12
|
+
const context = locals[DISTRIBUTED_SSR_FRAGMENTS_LOCALS_KEY];
|
|
13
|
+
if (!context || 'object' != typeof context) return;
|
|
14
|
+
return context;
|
|
15
|
+
}
|
|
16
|
+
function useDistributedSsrFragmentProps({ boundaryId, expose }) {
|
|
17
|
+
const runtimeContext = useRuntimeContext();
|
|
18
|
+
const locals = runtimeContext.requestContext?.response?.locals;
|
|
19
|
+
const request = locals && 'object' == typeof locals ? locals[DISTRIBUTED_SSR_FRAGMENT_REQUEST_LOCALS_KEY] : void 0;
|
|
20
|
+
if (!request || 'object' != typeof request || request.boundaryId !== boundaryId || request.expose !== expose) throw new Error(`Distributed SSR fragment request contract mismatch for ${boundaryId} ${expose}.`);
|
|
21
|
+
const props = request.props;
|
|
22
|
+
if (!props || 'object' != typeof props || Array.isArray(props)) throw new Error(`Distributed SSR fragment request props must be an object for ${boundaryId} ${expose}.`);
|
|
23
|
+
return props;
|
|
24
|
+
}
|
|
25
|
+
function isThenable(value) {
|
|
26
|
+
return 'function' == typeof value.then;
|
|
27
|
+
}
|
|
28
|
+
function DistributedSsrBoundary({ children, expose, fallback, fragmentProps = {}, remote }) {
|
|
29
|
+
const runtimeContext = useRuntimeContext();
|
|
30
|
+
const key = distributedSsrFragmentKey(remote, expose);
|
|
31
|
+
const attributes = {
|
|
32
|
+
'data-modern-distributed-ssr-boundary': key
|
|
33
|
+
};
|
|
34
|
+
if (runtimeContext.isBrowser) return /*#__PURE__*/ jsx("div", {
|
|
35
|
+
...attributes,
|
|
36
|
+
children: children
|
|
37
|
+
});
|
|
38
|
+
const fragmentContext = getDistributedSsrFragmentContext(runtimeContext.requestContext?.response);
|
|
39
|
+
if (!fragmentContext) return /*#__PURE__*/ jsx("div", {
|
|
40
|
+
...attributes,
|
|
41
|
+
children: children
|
|
42
|
+
});
|
|
43
|
+
const fragmentOrPromise = fragmentContext.resolve?.(remote, expose, fragmentProps) ?? fragmentContext.fragments?.[key];
|
|
44
|
+
if (fragmentOrPromise && isThenable(fragmentOrPromise)) throw fragmentOrPromise;
|
|
45
|
+
const fragment = fragmentOrPromise;
|
|
46
|
+
if (fragment?.status === 'ready') return /*#__PURE__*/ jsx("div", {
|
|
47
|
+
...attributes,
|
|
48
|
+
"data-modern-distributed-ssr-build": fragment.buildMarker,
|
|
49
|
+
"data-modern-distributed-ssr-digest": fragment.digest,
|
|
50
|
+
"data-modern-distributed-ssr-status": "ready",
|
|
51
|
+
dangerouslySetInnerHTML: {
|
|
52
|
+
__html: fragment.html
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return /*#__PURE__*/ jsx("div", {
|
|
56
|
+
...attributes,
|
|
57
|
+
"data-modern-distributed-ssr-reason": fragment?.reason ?? 'missing',
|
|
58
|
+
"data-modern-distributed-ssr-status": "degraded",
|
|
59
|
+
children: fallback
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function createDistributedSsrComponent({ createComponent, expose, fallback, remote }) {
|
|
63
|
+
let RemoteComponent;
|
|
64
|
+
function DeferredRemoteComponent(props) {
|
|
65
|
+
RemoteComponent ??= createComponent();
|
|
66
|
+
return /*#__PURE__*/ jsx(RemoteComponent, {
|
|
67
|
+
...props
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return function(props) {
|
|
71
|
+
return /*#__PURE__*/ jsx(DistributedSsrBoundary, {
|
|
72
|
+
expose: expose,
|
|
73
|
+
fallback: fallback,
|
|
74
|
+
fragmentProps: props,
|
|
75
|
+
remote: remote,
|
|
76
|
+
children: /*#__PURE__*/ jsx(DeferredRemoteComponent, {
|
|
77
|
+
...props
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export { DISTRIBUTED_SSR_FRAGMENTS_LOCALS_KEY, DISTRIBUTED_SSR_FRAGMENT_REQUEST_LOCALS_KEY, DistributedSsrBoundary, createDistributedSsrComponent, distributedSsrFragmentKey, useDistributedSsrFragmentProps };
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
+
export * from "./consume-surface.mjs";
|
|
3
|
+
export * from "./distributed-ssr.mjs";
|
|
4
|
+
export * from "./last-known-good.mjs";
|
|
5
|
+
export * from "./manifest-recovery-runtime-plugin.mjs";
|
|
6
|
+
export * from "./surface-resolution-types.mjs";
|
|
2
7
|
const MODULE_FEDERATION_FALLBACK_SIGNAL_EVENT = 'modernjs:mf-runtime-fallback';
|
|
3
8
|
const MODULE_FEDERATION_RECOVERY_SIGNAL_EVENT = 'modernjs:mf-runtime-recovery';
|
|
4
9
|
const DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT = '/_modern/contract-gates/runtime-fallback';
|
|
@@ -107,4 +112,5 @@ async function emitModuleFederationFallbackTelemetry(input, options = {}) {
|
|
|
107
112
|
postStatus: response.status
|
|
108
113
|
};
|
|
109
114
|
}
|
|
115
|
+
export { DISTRIBUTED_SSR_FRAGMENT_REQUEST_LOCALS_KEY, useDistributedSsrFragmentProps } from "./distributed-ssr.mjs";
|
|
110
116
|
export { DEFAULT_RUNTIME_FALLBACK_SIGNAL_AUTH_HEADER, DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT, MODULE_FEDERATION_FALLBACK_SIGNAL_EVENT, MODULE_FEDERATION_RECOVERY_SIGNAL_EVENT, ModuleFederationRemoteComponentContractError, ModuleFederationRemoteLoadError, ModuleFederationRemoteLoadTimeoutError, classifyModuleFederationFallback, createModuleFederationFallbackTelemetry, emitModuleFederationFallbackTelemetry, toModuleFederationFallbackAttributes };
|