@bleedingdev/modern-js-runtime 3.2.0-ultramodern.11 → 3.2.0-ultramodern.111
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
|
@@ -0,0 +1,102 @@
|
|
|
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
|
+
buildShellBeforeTemplate: ()=>buildShellBeforeTemplate
|
|
32
|
+
});
|
|
33
|
+
const router_namespaceObject = require("@modern-js/runtime-utils/router");
|
|
34
|
+
const lifecycle_js_namespaceObject = require("../../../router/runtime/lifecycle.js");
|
|
35
|
+
const external_constants_js_namespaceObject = require("../constants.js");
|
|
36
|
+
const external_federatedCss_js_namespaceObject = require("../federatedCss.js");
|
|
37
|
+
const external_helmet_js_namespaceObject = require("../helmet.js");
|
|
38
|
+
const external_shared_js_namespaceObject = require("../shared.js");
|
|
39
|
+
const external_utils_js_namespaceObject = require("../utils.js");
|
|
40
|
+
const checkIsInline = (chunk, enableInline)=>{
|
|
41
|
+
if ('production' !== process.env.NODE_ENV) return false;
|
|
42
|
+
if (enableInline instanceof RegExp) return enableInline.test(chunk);
|
|
43
|
+
return Boolean(enableInline);
|
|
44
|
+
};
|
|
45
|
+
async function buildShellBeforeTemplate(beforeAppTemplate, options) {
|
|
46
|
+
const { config, runtimeContext, styledComponentsStyleTags, entryName, moduleFederationCssAssets } = options;
|
|
47
|
+
const helmetData = (0, external_helmet_js_namespaceObject.getHelmetData)(runtimeContext);
|
|
48
|
+
const callbacks = [
|
|
49
|
+
(0, external_helmet_js_namespaceObject.createReplaceHelemt)(helmetData),
|
|
50
|
+
(template)=>injectCss(template, entryName, styledComponentsStyleTags)
|
|
51
|
+
];
|
|
52
|
+
return (0, external_shared_js_namespaceObject.buildHtml)(beforeAppTemplate, callbacks);
|
|
53
|
+
async function injectCss(template, entryName, styledComponentsStyleTags) {
|
|
54
|
+
let css = await getCssChunks();
|
|
55
|
+
if (styledComponentsStyleTags) css += styledComponentsStyleTags;
|
|
56
|
+
css += (0, external_federatedCss_js_namespaceObject.createFederatedCssLinks)(moduleFederationCssAssets, {
|
|
57
|
+
template,
|
|
58
|
+
existingAssets: css.match(/href="([^"]+)"/g)?.map((item)=>item.replace(/^href="/, '').replace(/"$/, ''))
|
|
59
|
+
});
|
|
60
|
+
return (0, external_utils_js_namespaceObject.safeReplace)(template, external_constants_js_namespaceObject.CHUNK_CSS_PLACEHOLDER, css);
|
|
61
|
+
async function getCssChunks() {
|
|
62
|
+
const { routeManifest, routerContext, routes } = runtimeContext;
|
|
63
|
+
if (!routeManifest) return '';
|
|
64
|
+
const { routeAssets } = routeManifest;
|
|
65
|
+
let matchedRouteManifests = [];
|
|
66
|
+
const matchedRouteIds = (0, lifecycle_js_namespaceObject.getRouterMatchedRouteIds)(runtimeContext);
|
|
67
|
+
if (matchedRouteIds?.length) matchedRouteManifests = matchedRouteIds.map((routeId)=>routeAssets[routeId]).filter(Boolean);
|
|
68
|
+
else if (routerContext && routes) {
|
|
69
|
+
const matches = (0, router_namespaceObject.matchRoutes)(routes, routerContext.location, routerContext.basename);
|
|
70
|
+
matchedRouteManifests = matches?.map((match, index)=>{
|
|
71
|
+
if (!index) return;
|
|
72
|
+
const routeId = match.route.id;
|
|
73
|
+
if (routeId) return routeAssets[routeId];
|
|
74
|
+
}).filter((routeManifest)=>void 0 !== routeManifest) ?? [];
|
|
75
|
+
}
|
|
76
|
+
const asyncEntry = routeAssets[`async-${entryName}`];
|
|
77
|
+
if (asyncEntry) matchedRouteManifests.push(asyncEntry);
|
|
78
|
+
const cssChunks = matchedRouteManifests.reduce((chunks, routeManifest)=>{
|
|
79
|
+
const { referenceCssAssets = [] } = routeManifest;
|
|
80
|
+
const _cssChunks = referenceCssAssets.filter((asset)=>asset?.endsWith('.css') && !template.includes(asset));
|
|
81
|
+
return [
|
|
82
|
+
...chunks,
|
|
83
|
+
..._cssChunks
|
|
84
|
+
];
|
|
85
|
+
}, []);
|
|
86
|
+
const { inlineStyles } = config;
|
|
87
|
+
const styles = cssChunks.map((chunk)=>{
|
|
88
|
+
const link = `<link href="${chunk}" rel="stylesheet" />`;
|
|
89
|
+
checkIsInline(chunk, inlineStyles);
|
|
90
|
+
return link;
|
|
91
|
+
});
|
|
92
|
+
return `${styles.join('')}`;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.buildShellBeforeTemplate = __webpack_exports__.buildShellBeforeTemplate;
|
|
97
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
98
|
+
"buildShellBeforeTemplate"
|
|
99
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
100
|
+
Object.defineProperty(exports, '__esModule', {
|
|
101
|
+
value: true
|
|
102
|
+
});
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -43,7 +47,7 @@ const defaultExtender = {
|
|
|
43
47
|
};
|
|
44
48
|
const createReadableStreamFromElement = async (request, rootElement, options)=>{
|
|
45
49
|
const { renderToPipeableStream } = await import("react-dom/server");
|
|
46
|
-
const { runtimeContext, htmlTemplate, config, ssrConfig, entryName } = options;
|
|
50
|
+
const { runtimeContext, htmlTemplate, config, ssrConfig, entryName, moduleFederationCssAssets } = options;
|
|
47
51
|
let shellChunkStatus = external_shared_js_namespaceObject.ShellChunkStatus.START;
|
|
48
52
|
let renderLevel = external_constants_js_namespaceObject.RenderLevel.SERVER_RENDER;
|
|
49
53
|
const forceStream2String = Boolean(process.env.MODERN_JS_STREAM_TO_STRING);
|
|
@@ -63,11 +67,14 @@ const createReadableStreamFromElement = async (request, rootElement, options)=>{
|
|
|
63
67
|
if (extender.modifyRootElement) processedRootElement = extender.modifyRootElement(processedRootElement);
|
|
64
68
|
});
|
|
65
69
|
const chunkVec = [];
|
|
70
|
+
let hasStartedPipe = false;
|
|
66
71
|
return new Promise((resolve)=>{
|
|
67
72
|
const { pipe: reactStreamingPipe } = renderToPipeableStream(processedRootElement, {
|
|
68
73
|
nonce: config.nonce,
|
|
69
74
|
identifierPrefix: constants_namespaceObject.SSR_HYDRATION_ID_PREFIX,
|
|
70
75
|
[onReady] () {
|
|
76
|
+
if (hasStartedPipe) return;
|
|
77
|
+
hasStartedPipe = true;
|
|
71
78
|
let styledComponentsStyleTags = '';
|
|
72
79
|
extenders.forEach((extender)=>{
|
|
73
80
|
if (extender.getStyleTags) styledComponentsStyleTags += extender.getStyleTags();
|
|
@@ -80,6 +87,7 @@ const createReadableStreamFromElement = async (request, rootElement, options)=>{
|
|
|
80
87
|
runtimeContext,
|
|
81
88
|
config,
|
|
82
89
|
entryName,
|
|
90
|
+
moduleFederationCssAssets,
|
|
83
91
|
styledComponentsStyleTags
|
|
84
92
|
}).then(({ shellAfter, shellBefore })=>{
|
|
85
93
|
const pendingScripts = [];
|
|
@@ -137,7 +145,8 @@ const createReadableStreamFromElement = async (request, rootElement, options)=>{
|
|
|
137
145
|
renderLevel,
|
|
138
146
|
runtimeContext,
|
|
139
147
|
entryName,
|
|
140
|
-
config
|
|
148
|
+
config,
|
|
149
|
+
moduleFederationCssAssets
|
|
141
150
|
}).then(({ shellAfter, shellBefore })=>{
|
|
142
151
|
const fallbackHtml = `${shellBefore}${shellAfter}`;
|
|
143
152
|
const readableStream = (0, external_shared_js_namespaceObject.getReadableStreamFromString)(fallbackHtml);
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -36,19 +40,21 @@ const external_template_js_namespaceObject = require("./template.js");
|
|
|
36
40
|
const createReadableStreamFromElement = async (request, rootElement, options)=>{
|
|
37
41
|
let shellChunkStatus = external_shared_js_namespaceObject.ShellChunkStatus.START;
|
|
38
42
|
const chunkVec = [];
|
|
39
|
-
const { htmlTemplate, runtimeContext, config, ssrConfig, entryName, rscRoot } = options;
|
|
43
|
+
const { htmlTemplate, runtimeContext, config, ssrConfig, entryName, moduleFederationCssAssets, rscManifest, rscRoot } = options;
|
|
40
44
|
const { shellBefore, shellAfter } = await (0, external_template_js_namespaceObject.getTemplates)(htmlTemplate, {
|
|
41
45
|
renderLevel: external_constants_js_namespaceObject.RenderLevel.SERVER_RENDER,
|
|
42
46
|
runtimeContext,
|
|
43
47
|
ssrConfig,
|
|
44
48
|
request,
|
|
45
49
|
config,
|
|
46
|
-
entryName
|
|
50
|
+
entryName,
|
|
51
|
+
moduleFederationCssAssets
|
|
47
52
|
});
|
|
48
53
|
try {
|
|
49
54
|
const readableOriginal = await (0, ssr_namespaceObject.renderSSRStream)(rootElement, {
|
|
50
55
|
request,
|
|
51
56
|
nonce: config.nonce,
|
|
57
|
+
rscManifest,
|
|
52
58
|
rscRoot: rscRoot,
|
|
53
59
|
routes: runtimeContext.routes,
|
|
54
60
|
onError (error) {
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -95,7 +99,7 @@ function createRenderStreaming(createReadableStreamPromise) {
|
|
|
95
99
|
const end = (0, time_namespaceObject.time)();
|
|
96
100
|
const { runtimeContext, config, resource } = options;
|
|
97
101
|
const { onError, onTiming } = options;
|
|
98
|
-
const { htmlTemplate, entryName } = resource;
|
|
102
|
+
const { htmlTemplate, entryName, moduleFederationCssAssets } = resource;
|
|
99
103
|
const ssrConfig = (0, external_utils_js_namespaceObject.getSSRConfigByEntry)(entryName, config.ssr, config.ssrByEntries);
|
|
100
104
|
const StreamServerRootWrapper = ({ children })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
101
105
|
children: [
|
|
@@ -115,9 +119,11 @@ function createRenderStreaming(createReadableStreamPromise) {
|
|
|
115
119
|
runtimeContext,
|
|
116
120
|
ssrConfig,
|
|
117
121
|
entryName,
|
|
122
|
+
moduleFederationCssAssets,
|
|
118
123
|
rscClientManifest: options.rscClientManifest,
|
|
119
124
|
rscSSRManifest: options.rscSSRManifest,
|
|
120
125
|
rscServerManifest: options.rscServerManifest,
|
|
126
|
+
rscManifest: options.rscManifest,
|
|
121
127
|
rscRoot: options.rscRoot,
|
|
122
128
|
onShellReady () {
|
|
123
129
|
const cost = end();
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -10,11 +10,15 @@ var __webpack_require__ = {};
|
|
|
10
10
|
};
|
|
11
11
|
})();
|
|
12
12
|
(()=>{
|
|
13
|
-
__webpack_require__.d = (exports1,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
18
22
|
};
|
|
19
23
|
})();
|
|
20
24
|
(()=>{
|
|
@@ -39,13 +43,12 @@ const time_namespaceObject = require("@modern-js/runtime-utils/time");
|
|
|
39
43
|
const constants_namespaceObject = require("@modern-js/utils/universal/constants");
|
|
40
44
|
const server_namespaceObject = require("react-dom/server");
|
|
41
45
|
var server_default = /*#__PURE__*/ __webpack_require__.n(server_namespaceObject);
|
|
42
|
-
const external_react_helmet_namespaceObject = require("react-helmet");
|
|
43
|
-
var external_react_helmet_default = /*#__PURE__*/ __webpack_require__.n(external_react_helmet_namespaceObject);
|
|
44
46
|
const external_constants_js_namespaceObject = require("../../constants.js");
|
|
45
47
|
const index_js_namespaceObject = require("../../context/index.js");
|
|
46
48
|
const wrapper_js_namespaceObject = require("../../react/wrapper.js");
|
|
47
49
|
const external_constants_js_namespaceObject_1 = require("../constants.js");
|
|
48
50
|
const external_helmet_js_namespaceObject = require("../helmet.js");
|
|
51
|
+
const external_scriptOrder_js_namespaceObject = require("../scriptOrder.js");
|
|
49
52
|
const external_shared_js_namespaceObject = require("../shared.js");
|
|
50
53
|
const external_tracer_js_namespaceObject = require("../tracer.js");
|
|
51
54
|
const external_utils_js_namespaceObject = require("../utils.js");
|
|
@@ -58,7 +61,7 @@ const renderString = async (request, serverRoot, options)=>{
|
|
|
58
61
|
onTiming
|
|
59
62
|
};
|
|
60
63
|
const routerContext = runtimeContext.routerContext;
|
|
61
|
-
const { htmlTemplate, entryName, loadableStats, routeManifest } = resource;
|
|
64
|
+
const { htmlTemplate, entryName, loadableStats, routeManifest, moduleFederationCssAssets } = resource;
|
|
62
65
|
const ssrConfig = (0, external_utils_js_namespaceObject.getSSRConfigByEntry)(entryName, config.ssr, config.ssrByEntries);
|
|
63
66
|
const chunkSet = {
|
|
64
67
|
renderLevel: external_constants_js_namespaceObject.RenderLevel.CLIENT_RENDER,
|
|
@@ -71,8 +74,10 @@ const renderString = async (request, serverRoot, options)=>{
|
|
|
71
74
|
stats: loadableStats,
|
|
72
75
|
nonce: config.nonce,
|
|
73
76
|
routeManifest,
|
|
77
|
+
runtimeContext,
|
|
74
78
|
template: htmlTemplate,
|
|
75
79
|
entryName,
|
|
80
|
+
moduleFederationCssAssets,
|
|
76
81
|
chunkSet,
|
|
77
82
|
config
|
|
78
83
|
}),
|
|
@@ -96,10 +101,10 @@ const renderString = async (request, serverRoot, options)=>{
|
|
|
96
101
|
const rootElement = (0, wrapper_js_namespaceObject.wrapRuntimeContextProvider)(serverRoot, Object.assign(runtimeContext, {
|
|
97
102
|
ssr: true
|
|
98
103
|
}));
|
|
99
|
-
const html = await generateHtml(rootElement, htmlTemplate, chunkSet, collectors, runtimeContext.ssrContext?.htmlModifiers || [], tracer);
|
|
104
|
+
const html = await generateHtml(rootElement, htmlTemplate, chunkSet, collectors, runtimeContext.ssrContext?.htmlModifiers || [], runtimeContext, entryName, tracer);
|
|
100
105
|
return html;
|
|
101
106
|
};
|
|
102
|
-
async function generateHtml(App, htmlTemplate, chunkSet, collectors, htmlModifiers, { onError, onTiming }) {
|
|
107
|
+
async function generateHtml(App, htmlTemplate, chunkSet, collectors, htmlModifiers, runtimeContext, entryName, { onError, onTiming }) {
|
|
103
108
|
let html = '';
|
|
104
109
|
let helmetData;
|
|
105
110
|
const finalApp = collectors.reduce((pre, creator)=>creator.collect?.(pre) || pre, App);
|
|
@@ -109,7 +114,7 @@ async function generateHtml(App, htmlTemplate, chunkSet, collectors, htmlModifie
|
|
|
109
114
|
identifierPrefix: constants_namespaceObject.SSR_HYDRATION_ID_PREFIX
|
|
110
115
|
});
|
|
111
116
|
chunkSet.renderLevel = external_constants_js_namespaceObject.RenderLevel.SERVER_RENDER;
|
|
112
|
-
helmetData =
|
|
117
|
+
helmetData = (0, external_helmet_js_namespaceObject.getHelmetData)(runtimeContext);
|
|
113
118
|
const cost = end();
|
|
114
119
|
onTiming(external_tracer_js_namespaceObject.SSRTimings.RENDER_HTML, cost);
|
|
115
120
|
} catch (e) {
|
|
@@ -120,7 +125,7 @@ async function generateHtml(App, htmlTemplate, chunkSet, collectors, htmlModifie
|
|
|
120
125
|
const { ssrScripts, cssChunk, jsChunk } = chunkSet;
|
|
121
126
|
const finalHtml = await (0, external_shared_js_namespaceObject.buildHtml)(htmlTemplate, [
|
|
122
127
|
createReplaceHtml(html),
|
|
123
|
-
createReplaceChunkJs(jsChunk),
|
|
128
|
+
createReplaceChunkJs(jsChunk, entryName),
|
|
124
129
|
createReplaceChunkCss(cssChunk),
|
|
125
130
|
createReplaceSSRDataScript(ssrScripts),
|
|
126
131
|
(0, external_helmet_js_namespaceObject.createReplaceHelemt)(helmetData),
|
|
@@ -134,8 +139,14 @@ function createReplaceHtml(html) {
|
|
|
134
139
|
function createReplaceSSRDataScript(data) {
|
|
135
140
|
return (template)=>(0, external_utils_js_namespaceObject.safeReplace)(template, external_constants_js_namespaceObject_1.SSR_DATA_PLACEHOLDER, data);
|
|
136
141
|
}
|
|
137
|
-
function createReplaceChunkJs(js) {
|
|
138
|
-
return (template)=>
|
|
142
|
+
function createReplaceChunkJs(js, entryName) {
|
|
143
|
+
return (template)=>{
|
|
144
|
+
if (!js) return (0, external_utils_js_namespaceObject.safeReplace)(template, external_constants_js_namespaceObject_1.CHUNK_JS_PLACEHOLDER, '');
|
|
145
|
+
const withoutPlaceholder = (0, external_utils_js_namespaceObject.safeReplace)(template, external_constants_js_namespaceObject_1.CHUNK_JS_PLACEHOLDER, '');
|
|
146
|
+
const withEarlyScripts = (0, external_scriptOrder_js_namespaceObject.injectBeforeHydrationEntryScript)(withoutPlaceholder, js, entryName);
|
|
147
|
+
if (withEarlyScripts !== withoutPlaceholder) return withEarlyScripts;
|
|
148
|
+
return (0, external_utils_js_namespaceObject.safeReplace)(template, external_constants_js_namespaceObject_1.CHUNK_JS_PLACEHOLDER, js);
|
|
149
|
+
};
|
|
139
150
|
}
|
|
140
151
|
function createReplaceChunkCss(css) {
|
|
141
152
|
return (template)=>(0, external_utils_js_namespaceObject.safeReplace)(template, external_constants_js_namespaceObject_1.CHUNK_CSS_PLACEHOLDER, css);
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -24,15 +28,45 @@ var __webpack_require__ = {};
|
|
|
24
28
|
var __webpack_exports__ = {};
|
|
25
29
|
__webpack_require__.r(__webpack_exports__);
|
|
26
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
LoadableCollector: ()=>LoadableCollector
|
|
31
|
+
LoadableCollector: ()=>LoadableCollector,
|
|
32
|
+
orderHydrationScriptChunks: ()=>orderHydrationScriptChunks
|
|
28
33
|
});
|
|
29
34
|
const server_namespaceObject = require("@loadable/server");
|
|
35
|
+
const lifecycle_js_namespaceObject = require("../../../router/runtime/lifecycle.js");
|
|
36
|
+
const external_federatedCss_js_namespaceObject = require("../federatedCss.js");
|
|
30
37
|
const external_utils_js_namespaceObject = require("../utils.js");
|
|
31
38
|
const extname = (uri)=>{
|
|
32
39
|
if ('string' != typeof uri || !uri.includes('.')) return '';
|
|
33
40
|
return `.${uri?.split('.').pop()}` || '';
|
|
34
41
|
};
|
|
35
42
|
const generateChunks = (chunks, ext)=>chunks.filter((chunk)=>Boolean(chunk.url)).filter((chunk)=>extname(chunk.url).slice(1) === ext);
|
|
43
|
+
const dedupeChunksByUrl = (chunks)=>{
|
|
44
|
+
const seen = new Set();
|
|
45
|
+
return chunks.filter((chunk)=>{
|
|
46
|
+
if (!chunk.url || seen.has(chunk.url)) return false;
|
|
47
|
+
seen.add(chunk.url);
|
|
48
|
+
return true;
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
const isAsyncEntryScriptChunk = (chunk, entryName)=>{
|
|
52
|
+
if (!chunk.url?.endsWith('.js')) return false;
|
|
53
|
+
const asyncEntryName = `async-${entryName}`;
|
|
54
|
+
const filename = chunk.filename || chunk.url;
|
|
55
|
+
const basename = filename.split('/').pop() || filename;
|
|
56
|
+
return basename === `${asyncEntryName}.js` || basename.startsWith(`${asyncEntryName}.`) || basename.startsWith(`${asyncEntryName}-`);
|
|
57
|
+
};
|
|
58
|
+
const orderHydrationScriptChunks = ({ asyncEntryChunks, collectedChunks, matchedRouteChunks, entryName })=>{
|
|
59
|
+
const asyncEntryScriptChunks = [];
|
|
60
|
+
const asyncEntryDependencyChunks = [];
|
|
61
|
+
for (const chunk of asyncEntryChunks)if (isAsyncEntryScriptChunk(chunk, entryName)) asyncEntryScriptChunks.push(chunk);
|
|
62
|
+
else asyncEntryDependencyChunks.push(chunk);
|
|
63
|
+
return dedupeChunksByUrl([
|
|
64
|
+
...asyncEntryDependencyChunks,
|
|
65
|
+
...collectedChunks,
|
|
66
|
+
...matchedRouteChunks,
|
|
67
|
+
...asyncEntryScriptChunks
|
|
68
|
+
]);
|
|
69
|
+
};
|
|
36
70
|
const checkIsInline = (chunk, enableInline)=>{
|
|
37
71
|
if ('production' !== process.env.NODE_ENV) return false;
|
|
38
72
|
if (enableInline instanceof RegExp) return enableInline.test(chunk.url);
|
|
@@ -49,6 +83,20 @@ class LoadableCollector {
|
|
|
49
83
|
const { routeManifest, entryName } = this.options;
|
|
50
84
|
return routeManifest?.routeAssets?.[entryName]?.assets;
|
|
51
85
|
}
|
|
86
|
+
getMatchedRouteChunks() {
|
|
87
|
+
const { routeManifest, runtimeContext } = this.options;
|
|
88
|
+
const routeAssets = routeManifest?.routeAssets;
|
|
89
|
+
if (!routeAssets) return [];
|
|
90
|
+
const matchedRouteIds = (0, lifecycle_js_namespaceObject.getRouterMatchedRouteIds)(runtimeContext) ?? [];
|
|
91
|
+
return matchedRouteIds.flatMap((routeId)=>{
|
|
92
|
+
const routeAsset = routeAssets[routeId];
|
|
93
|
+
return (routeAsset?.assets ?? []).map((asset)=>({
|
|
94
|
+
filename: asset.replace(/^\//, ''),
|
|
95
|
+
path: asset,
|
|
96
|
+
url: asset
|
|
97
|
+
}));
|
|
98
|
+
});
|
|
99
|
+
}
|
|
52
100
|
collect(comopnent) {
|
|
53
101
|
const { stats, entryName } = this.options;
|
|
54
102
|
if (!stats) return comopnent;
|
|
@@ -61,20 +109,29 @@ class LoadableCollector {
|
|
|
61
109
|
return this.extractor.collectChunks(comopnent);
|
|
62
110
|
}
|
|
63
111
|
async effect() {
|
|
64
|
-
if (!this.extractor) return;
|
|
65
112
|
const { extractor, options } = this;
|
|
66
113
|
const { entryName, config } = options;
|
|
67
114
|
const asyncChunks = [];
|
|
68
|
-
if (config.enableAsyncEntry) try {
|
|
115
|
+
if (extractor && config.enableAsyncEntry) try {
|
|
69
116
|
asyncChunks.push(...extractor.getChunkAssets([
|
|
70
117
|
`async-${entryName}`
|
|
71
118
|
]));
|
|
72
119
|
} catch (e) {}
|
|
73
|
-
const
|
|
74
|
-
const
|
|
120
|
+
const collectedChunks = extractor ? extractor.getChunkAssets(extractor.chunks) : [];
|
|
121
|
+
const matchedRouteChunks = this.getMatchedRouteChunks();
|
|
122
|
+
const orderedScriptChunks = orderHydrationScriptChunks({
|
|
123
|
+
asyncEntryChunks: asyncChunks,
|
|
124
|
+
collectedChunks,
|
|
125
|
+
matchedRouteChunks,
|
|
126
|
+
entryName
|
|
127
|
+
});
|
|
128
|
+
const chunks = [].concat(asyncChunks).concat(collectedChunks).concat(matchedRouteChunks);
|
|
129
|
+
const scriptChunks = generateChunks(orderedScriptChunks, 'js');
|
|
75
130
|
const styleChunks = generateChunks(chunks, 'css');
|
|
76
|
-
|
|
77
|
-
|
|
131
|
+
if (extractor) {
|
|
132
|
+
this.emitLoadableScripts(extractor);
|
|
133
|
+
await this.emitScriptAssets(scriptChunks);
|
|
134
|
+
}
|
|
78
135
|
await this.emitStyleAssets(styleChunks);
|
|
79
136
|
}
|
|
80
137
|
emitLoadableScripts(extractor) {
|
|
@@ -109,19 +166,28 @@ class LoadableCollector {
|
|
|
109
166
|
chunkSet.jsChunk += scripts.filter((script)=>Boolean(script)).join('');
|
|
110
167
|
}
|
|
111
168
|
async emitStyleAssets(chunks) {
|
|
112
|
-
const { template, chunkSet, config,
|
|
169
|
+
const { template, chunkSet, config, moduleFederationCssAssets } = this.options;
|
|
113
170
|
const { inlineStyles } = config;
|
|
114
171
|
const atrributes = (0, external_utils_js_namespaceObject.attributesToString)(this.generateAttributes());
|
|
115
172
|
const linkRegExp = /<link .*?href="([^"]+)".*?>/g;
|
|
116
173
|
const matchs = template.matchAll(linkRegExp);
|
|
117
174
|
const existedLinks = [];
|
|
118
175
|
for (const match of matchs)existedLinks.push(match[1]);
|
|
119
|
-
const
|
|
176
|
+
const emittedChunks = chunks.filter((chunk)=>!existedLinks.includes(chunk.url) && !this.existsAssets?.includes(chunk.path));
|
|
177
|
+
const css = await Promise.all(emittedChunks.map(async (chunk)=>{
|
|
120
178
|
const link = `<link${atrributes} href="${chunk.url}" rel="stylesheet" />`;
|
|
121
179
|
if ((0, external_utils_js_namespaceObject.checkIsNode)() && checkIsInline(chunk, inlineStyles)) return readAsset(chunk).then((content)=>`<style>${content}</style>`).catch((_)=>link);
|
|
122
180
|
return link;
|
|
123
181
|
}));
|
|
124
182
|
chunkSet.cssChunk += css.filter((css)=>Boolean(css)).join('');
|
|
183
|
+
chunkSet.cssChunk += (0, external_federatedCss_js_namespaceObject.createFederatedCssLinks)(moduleFederationCssAssets, {
|
|
184
|
+
template,
|
|
185
|
+
attributes: this.generateAttributes(),
|
|
186
|
+
existingAssets: [
|
|
187
|
+
...existedLinks,
|
|
188
|
+
...emittedChunks.map((chunk)=>chunk.url)
|
|
189
|
+
]
|
|
190
|
+
});
|
|
125
191
|
}
|
|
126
192
|
generateAttributes(extraAtr = {}) {
|
|
127
193
|
const { config } = this.options;
|
|
@@ -138,8 +204,10 @@ class LoadableCollector {
|
|
|
138
204
|
}
|
|
139
205
|
}
|
|
140
206
|
exports.LoadableCollector = __webpack_exports__.LoadableCollector;
|
|
207
|
+
exports.orderHydrationScriptChunks = __webpack_exports__.orderHydrationScriptChunks;
|
|
141
208
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
142
|
-
"LoadableCollector"
|
|
209
|
+
"LoadableCollector",
|
|
210
|
+
"orderHydrationScriptChunks"
|
|
143
211
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
144
212
|
Object.defineProperty(exports, '__esModule', {
|
|
145
213
|
value: true
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -23,10 +27,6 @@ var __webpack_require__ = {};
|
|
|
23
27
|
})();
|
|
24
28
|
var __webpack_exports__ = {};
|
|
25
29
|
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
SSRErrors: ()=>SSRErrors,
|
|
28
|
-
SSRTimings: ()=>SSRTimings
|
|
29
|
-
});
|
|
30
30
|
var SSRTimings = /*#__PURE__*/ function(SSRTimings) {
|
|
31
31
|
SSRTimings["PRERENDER"] = "ssr-prerender";
|
|
32
32
|
SSRTimings["RENDER_HTML"] = "ssr-render-html";
|
|
@@ -41,6 +41,10 @@ var SSRErrors = /*#__PURE__*/ function(SSRErrors) {
|
|
|
41
41
|
SSRErrors["LOADER_ERROR"] = "App error occurs during data loader";
|
|
42
42
|
return SSRErrors;
|
|
43
43
|
}({});
|
|
44
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
45
|
+
SSRErrors: ()=>SSRErrors,
|
|
46
|
+
SSRTimings: ()=>SSRTimings
|
|
47
|
+
});
|
|
44
48
|
exports.SSRErrors = __webpack_exports__.SSRErrors;
|
|
45
49
|
exports.SSRTimings = __webpack_exports__.SSRTimings;
|
|
46
50
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|