@modern-js/runtime 2.49.1 → 2.49.3-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/router/runtime/plugin.js +2 -2
- package/dist/cjs/router/runtime/plugin.node.js +2 -2
- package/dist/cjs/ssr/serverRender/renderToStream/bulidTemplate.before.js +7 -15
- package/dist/esm/router/runtime/plugin.js +2 -2
- package/dist/esm/router/runtime/plugin.node.js +2 -2
- package/dist/esm/ssr/serverRender/renderToStream/bulidTemplate.before.js +115 -132
- package/dist/esm-node/router/runtime/plugin.js +2 -2
- package/dist/esm-node/router/runtime/plugin.node.js +2 -2
- package/dist/esm-node/ssr/serverRender/renderToStream/bulidTemplate.before.js +8 -16
- package/dist/js/modern/cli/index.js +72 -0
- package/dist/js/modern/common.js +4 -0
- package/dist/js/modern/config.js +0 -0
- package/dist/js/modern/core/app-config.js +10 -0
- package/dist/js/modern/core/compatible.js +285 -0
- package/dist/js/modern/core/index.js +16 -0
- package/dist/js/modern/core/loader/index.js +4 -0
- package/dist/js/modern/core/loader/loaderManager.js +165 -0
- package/dist/js/modern/core/loader/useLoader.js +114 -0
- package/dist/js/modern/core/plugin.js +58 -0
- package/dist/js/modern/document/Body.js +23 -0
- package/dist/js/modern/document/DocumentContext.js +9 -0
- package/dist/js/modern/document/DocumentStructrueContext.js +11 -0
- package/dist/js/modern/document/Head.js +27 -0
- package/dist/js/modern/document/Html.js +78 -0
- package/dist/js/modern/document/Links.js +10 -0
- package/dist/js/modern/document/Root.js +33 -0
- package/dist/js/modern/document/Script.js +20 -0
- package/dist/js/modern/document/Scripts.js +10 -0
- package/dist/js/modern/document/cli/index.js +228 -0
- package/dist/js/modern/document/constants.js +49 -0
- package/dist/js/modern/document/index.js +10 -0
- package/dist/js/modern/exports/head.js +6 -0
- package/dist/js/modern/exports/loadable.js +6 -0
- package/dist/js/modern/exports/server.js +4 -0
- package/dist/js/modern/exports/styled.js +6 -0
- package/dist/js/modern/index.js +22 -0
- package/dist/js/modern/router/cli/index.js +120 -0
- package/dist/js/modern/router/index.js +7 -0
- package/dist/js/modern/router/runtime/DefaultNotFound.js +14 -0
- package/dist/js/modern/router/runtime/index.js +9 -0
- package/dist/js/modern/router/runtime/plugin.js +104 -0
- package/dist/js/modern/router/runtime/plugin.node.js +149 -0
- package/dist/js/modern/router/runtime/server.js +1 -0
- package/dist/js/modern/router/runtime/types.js +0 -0
- package/dist/js/modern/router/runtime/utils.js +196 -0
- package/dist/js/modern/router/runtime/withRouter.js +36 -0
- package/dist/js/modern/runtime-context.js +7 -0
- package/dist/js/modern/ssr/cli/babel-plugin-ssr-loader-id.js +130 -0
- package/dist/js/modern/ssr/cli/index.js +172 -0
- package/dist/js/modern/ssr/index.js +159 -0
- package/dist/js/modern/ssr/index.node.js +79 -0
- package/dist/js/modern/ssr/prefetch.js +69 -0
- package/dist/js/modern/ssr/react/index.js +6 -0
- package/dist/js/modern/ssr/react/nossr/index.js +14 -0
- package/dist/js/modern/ssr/react/prerender/index.js +108 -0
- package/dist/js/modern/ssr/react/prerender/type.js +0 -0
- package/dist/js/modern/ssr/react/prerender/util.js +96 -0
- package/dist/js/modern/ssr/react/withCallback/index.js +15 -0
- package/dist/js/modern/ssr/serverRender/helmet.js +44 -0
- package/dist/js/modern/ssr/serverRender/index.js +35 -0
- package/dist/js/modern/ssr/serverRender/renderToStream/buildTemplate.after.js +36 -0
- package/dist/js/modern/ssr/serverRender/renderToStream/buildTemplate.share.js +11 -0
- package/dist/js/modern/ssr/serverRender/renderToStream/bulidTemplate.before.js +61 -0
- package/dist/js/modern/ssr/serverRender/renderToStream/index.js +58 -0
- package/dist/js/modern/ssr/serverRender/renderToStream/loadable.js +24 -0
- package/dist/js/modern/ssr/serverRender/renderToStream/renderToPipe.js +94 -0
- package/dist/js/modern/ssr/serverRender/renderToStream/styledComponent.js +12 -0
- package/dist/js/modern/ssr/serverRender/renderToStream/template.js +22 -0
- package/dist/js/modern/ssr/serverRender/renderToStream/type.js +0 -0
- package/dist/js/modern/ssr/serverRender/renderToString/entry.js +171 -0
- package/dist/js/modern/ssr/serverRender/renderToString/index.js +52 -0
- package/dist/js/modern/ssr/serverRender/renderToString/loadable.js +48 -0
- package/dist/js/modern/ssr/serverRender/renderToString/reduce.js +8 -0
- package/dist/js/modern/ssr/serverRender/renderToString/styledComponent.js +11 -0
- package/dist/js/modern/ssr/serverRender/renderToString/template.js +58 -0
- package/dist/js/modern/ssr/serverRender/renderToString/type.js +9 -0
- package/dist/js/modern/ssr/serverRender/types.js +4 -0
- package/dist/js/modern/ssr/serverRender/utils.js +22 -0
- package/dist/js/modern/ssr/utils.js +81 -0
- package/dist/js/modern/state/cli/index.js +83 -0
- package/dist/js/modern/state/index.js +7 -0
- package/dist/js/modern/state/plugins.js +13 -0
- package/dist/js/modern/state/runtime/index.js +9 -0
- package/dist/js/modern/state/runtime/plugin.js +97 -0
- package/dist/js/modern/state/types.js +0 -0
- package/dist/js/node/cli/index.js +99 -0
- package/dist/js/node/common.js +27 -0
- package/dist/js/node/config.js +15 -0
- package/dist/js/node/core/app-config.js +34 -0
- package/dist/js/node/core/compatible.js +312 -0
- package/dist/js/node/core/index.js +47 -0
- package/dist/js/node/core/loader/index.js +33 -0
- package/dist/js/node/core/loader/loaderManager.js +195 -0
- package/dist/js/node/core/loader/useLoader.js +132 -0
- package/dist/js/node/core/plugin.js +80 -0
- package/dist/js/node/document/Body.js +43 -0
- package/dist/js/node/document/DocumentContext.js +38 -0
- package/dist/js/node/document/DocumentStructrueContext.js +40 -0
- package/dist/js/node/document/Head.js +51 -0
- package/dist/js/node/document/Html.js +101 -0
- package/dist/js/node/document/Links.js +33 -0
- package/dist/js/node/document/Root.js +57 -0
- package/dist/js/node/document/Script.js +40 -0
- package/dist/js/node/document/Scripts.js +33 -0
- package/dist/js/node/document/cli/index.js +240 -0
- package/dist/js/node/document/constants.js +86 -0
- package/dist/js/node/document/index.js +26 -0
- package/dist/js/node/exports/head.js +34 -0
- package/dist/js/node/exports/loadable.js +34 -0
- package/dist/js/node/exports/server.js +27 -0
- package/dist/js/node/exports/styled.js +34 -0
- package/dist/js/node/index.js +44 -0
- package/dist/js/node/router/cli/index.js +135 -0
- package/dist/js/node/router/index.js +37 -0
- package/dist/js/node/router/runtime/DefaultNotFound.js +37 -0
- package/dist/js/node/router/runtime/index.js +33 -0
- package/dist/js/node/router/runtime/plugin.js +127 -0
- package/dist/js/node/router/runtime/plugin.node.js +175 -0
- package/dist/js/node/router/runtime/server.js +17 -0
- package/dist/js/node/router/runtime/types.js +15 -0
- package/dist/js/node/router/runtime/utils.js +221 -0
- package/dist/js/node/router/runtime/withRouter.js +57 -0
- package/dist/js/node/runtime-context.js +31 -0
- package/dist/js/node/ssr/cli/babel-plugin-ssr-loader-id.js +139 -0
- package/dist/js/node/ssr/cli/index.js +190 -0
- package/dist/js/node/ssr/index.js +185 -0
- package/dist/js/node/ssr/index.node.js +107 -0
- package/dist/js/node/ssr/prefetch.js +90 -0
- package/dist/js/node/ssr/react/index.js +30 -0
- package/dist/js/node/ssr/react/nossr/index.js +43 -0
- package/dist/js/node/ssr/react/prerender/index.js +130 -0
- package/dist/js/node/ssr/react/prerender/type.js +15 -0
- package/dist/js/node/ssr/react/prerender/util.js +123 -0
- package/dist/js/node/ssr/react/withCallback/index.js +38 -0
- package/dist/js/node/ssr/serverRender/helmet.js +65 -0
- package/dist/js/node/ssr/serverRender/index.js +56 -0
- package/dist/js/node/ssr/serverRender/renderToStream/buildTemplate.after.js +65 -0
- package/dist/js/node/ssr/serverRender/renderToStream/buildTemplate.share.js +35 -0
- package/dist/js/node/ssr/serverRender/renderToStream/bulidTemplate.before.js +87 -0
- package/dist/js/node/ssr/serverRender/renderToStream/index.js +87 -0
- package/dist/js/node/ssr/serverRender/renderToStream/loadable.js +47 -0
- package/dist/js/node/ssr/serverRender/renderToStream/renderToPipe.js +111 -0
- package/dist/js/node/ssr/serverRender/renderToStream/styledComponent.js +35 -0
- package/dist/js/node/ssr/serverRender/renderToStream/template.js +45 -0
- package/dist/js/node/ssr/serverRender/renderToStream/type.js +15 -0
- package/dist/js/node/ssr/serverRender/renderToString/entry.js +196 -0
- package/dist/js/node/ssr/serverRender/renderToString/index.js +81 -0
- package/dist/js/node/ssr/serverRender/renderToString/loadable.js +71 -0
- package/dist/js/node/ssr/serverRender/renderToString/reduce.js +31 -0
- package/dist/js/node/ssr/serverRender/renderToString/styledComponent.js +34 -0
- package/dist/js/node/ssr/serverRender/renderToString/template.js +82 -0
- package/dist/js/node/ssr/serverRender/renderToString/type.js +32 -0
- package/dist/js/node/ssr/serverRender/types.js +27 -0
- package/dist/js/node/ssr/serverRender/utils.js +46 -0
- package/dist/js/node/ssr/utils.js +106 -0
- package/dist/js/node/state/cli/index.js +100 -0
- package/dist/js/node/state/index.js +37 -0
- package/dist/js/node/state/plugins.js +45 -0
- package/dist/js/node/state/runtime/index.js +40 -0
- package/dist/js/node/state/runtime/plugin.js +121 -0
- package/dist/js/node/state/types.js +15 -0
- package/dist/js/treeshaking/cli/index.js +186 -0
- package/dist/js/treeshaking/common.js +4 -0
- package/dist/js/treeshaking/config.js +1 -0
- package/dist/js/treeshaking/core/app-config.js +9 -0
- package/dist/js/treeshaking/core/compatible.js +485 -0
- package/dist/js/treeshaking/core/index.js +7 -0
- package/dist/js/treeshaking/core/loader/index.js +2 -0
- package/dist/js/treeshaking/core/loader/loaderManager.js +406 -0
- package/dist/js/treeshaking/core/loader/useLoader.js +188 -0
- package/dist/js/treeshaking/core/plugin.js +176 -0
- package/dist/js/treeshaking/document/Body.js +18 -0
- package/dist/js/treeshaking/document/DocumentContext.js +7 -0
- package/dist/js/treeshaking/document/DocumentStructrueContext.js +9 -0
- package/dist/js/treeshaking/document/Head.js +24 -0
- package/dist/js/treeshaking/document/Html.js +99 -0
- package/dist/js/treeshaking/document/Links.js +8 -0
- package/dist/js/treeshaking/document/Root.js +26 -0
- package/dist/js/treeshaking/document/Script.js +15 -0
- package/dist/js/treeshaking/document/Scripts.js +8 -0
- package/dist/js/treeshaking/document/cli/index.js +393 -0
- package/dist/js/treeshaking/document/constants.js +35 -0
- package/dist/js/treeshaking/document/index.js +10 -0
- package/dist/js/treeshaking/exports/head.js +4 -0
- package/dist/js/treeshaking/exports/loadable.js +4 -0
- package/dist/js/treeshaking/exports/server.js +4 -0
- package/dist/js/treeshaking/exports/styled.js +4 -0
- package/dist/js/treeshaking/index.js +3 -0
- package/dist/js/treeshaking/router/cli/index.js +148 -0
- package/dist/js/treeshaking/router/index.js +4 -0
- package/dist/js/treeshaking/router/runtime/DefaultNotFound.js +14 -0
- package/dist/js/treeshaking/router/runtime/index.js +6 -0
- package/dist/js/treeshaking/router/runtime/plugin.js +132 -0
- package/dist/js/treeshaking/router/runtime/plugin.node.js +390 -0
- package/dist/js/treeshaking/router/runtime/server.js +1 -0
- package/dist/js/treeshaking/router/runtime/types.js +1 -0
- package/dist/js/treeshaking/router/runtime/utils.js +260 -0
- package/dist/js/treeshaking/router/runtime/withRouter.js +67 -0
- package/dist/js/treeshaking/runtime-context.js +4 -0
- package/dist/js/treeshaking/ssr/cli/babel-plugin-ssr-loader-id.js +122 -0
- package/dist/js/treeshaking/ssr/cli/index.js +217 -0
- package/dist/js/treeshaking/ssr/index.js +315 -0
- package/dist/js/treeshaking/ssr/index.node.js +240 -0
- package/dist/js/treeshaking/ssr/prefetch.js +199 -0
- package/dist/js/treeshaking/ssr/react/index.js +3 -0
- package/dist/js/treeshaking/ssr/react/nossr/index.js +58 -0
- package/dist/js/treeshaking/ssr/react/prerender/index.js +237 -0
- package/dist/js/treeshaking/ssr/react/prerender/type.js +1 -0
- package/dist/js/treeshaking/ssr/react/prerender/util.js +108 -0
- package/dist/js/treeshaking/ssr/react/withCallback/index.js +16 -0
- package/dist/js/treeshaking/ssr/serverRender/helmet.js +42 -0
- package/dist/js/treeshaking/ssr/serverRender/index.js +169 -0
- package/dist/js/treeshaking/ssr/serverRender/renderToStream/buildTemplate.after.js +34 -0
- package/dist/js/treeshaking/ssr/serverRender/renderToStream/buildTemplate.share.js +7 -0
- package/dist/js/treeshaking/ssr/serverRender/renderToStream/bulidTemplate.before.js +115 -0
- package/dist/js/treeshaking/ssr/serverRender/renderToStream/index.js +165 -0
- package/dist/js/treeshaking/ssr/serverRender/renderToStream/loadable.js +22 -0
- package/dist/js/treeshaking/ssr/serverRender/renderToStream/renderToPipe.js +119 -0
- package/dist/js/treeshaking/ssr/serverRender/renderToStream/styledComponent.js +11 -0
- package/dist/js/treeshaking/ssr/serverRender/renderToStream/template.js +63 -0
- package/dist/js/treeshaking/ssr/serverRender/renderToStream/type.js +1 -0
- package/dist/js/treeshaking/ssr/serverRender/renderToString/entry.js +393 -0
- package/dist/js/treeshaking/ssr/serverRender/renderToString/index.js +165 -0
- package/dist/js/treeshaking/ssr/serverRender/renderToString/loadable.js +56 -0
- package/dist/js/treeshaking/ssr/serverRender/renderToString/reduce.js +10 -0
- package/dist/js/treeshaking/ssr/serverRender/renderToString/styledComponent.js +9 -0
- package/dist/js/treeshaking/ssr/serverRender/renderToString/template.js +156 -0
- package/dist/js/treeshaking/ssr/serverRender/renderToString/type.js +7 -0
- package/dist/js/treeshaking/ssr/serverRender/types.js +2 -0
- package/dist/js/treeshaking/ssr/serverRender/utils.js +69 -0
- package/dist/js/treeshaking/ssr/utils.js +134 -0
- package/dist/js/treeshaking/state/cli/index.js +71 -0
- package/dist/js/treeshaking/state/index.js +4 -0
- package/dist/js/treeshaking/state/plugins.js +14 -0
- package/dist/js/treeshaking/state/runtime/index.js +5 -0
- package/dist/js/treeshaking/state/runtime/plugin.js +198 -0
- package/dist/js/treeshaking/state/types.js +1 -0
- package/dist/types/document/Html.d.ts +2 -2
- 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/types.d.ts +1 -0
- package/package.json +10 -10
|
@@ -55,7 +55,7 @@ function modifyRoutes(modifyFunction) {
|
|
|
55
55
|
console.error("It is not allowed to modify routes config after create router.");
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
const routerPlugin = ({ serverBase = [], supportHtml5History = true, basename = "", routesConfig, createRoutes }) => {
|
|
58
|
+
const routerPlugin = ({ serverBase = [], supportHtml5History = true, basename = "", originBaseUrl = "", routesConfig, createRoutes }) => {
|
|
59
59
|
const select = (pathname) => serverBase.find((baseUrl) => pathname.search(baseUrl) === 0) || "/";
|
|
60
60
|
let routes = [];
|
|
61
61
|
finalRouteConfig = routesConfig;
|
|
@@ -91,7 +91,7 @@ const routerPlugin = ({ serverBase = [], supportHtml5History = true, basename =
|
|
|
91
91
|
const getRouteApp = () => {
|
|
92
92
|
const useCreateRouter = (props) => {
|
|
93
93
|
var _window__SERVER_DATA;
|
|
94
|
-
const baseUrl = ((_window__SERVER_DATA = window._SERVER_DATA) === null || _window__SERVER_DATA === void 0 ? void 0 : _window__SERVER_DATA.router.baseUrl) || select(location.pathname);
|
|
94
|
+
const baseUrl = originBaseUrl || ((_window__SERVER_DATA = window._SERVER_DATA) === null || _window__SERVER_DATA === void 0 ? void 0 : _window__SERVER_DATA.router.baseUrl) || select(location.pathname);
|
|
95
95
|
const _basename = baseUrl === "/" ? (0, import_utils.urlJoin)(baseUrl, basename) : baseUrl;
|
|
96
96
|
let hydrationData = window._ROUTER_DATA;
|
|
97
97
|
const runtimeContext = (0, import_react.useContext)(import_core.RuntimeReactContext);
|
|
@@ -71,7 +71,7 @@ function createFetchHeaders(requestHeaders) {
|
|
|
71
71
|
}
|
|
72
72
|
return headers;
|
|
73
73
|
}
|
|
74
|
-
const routerPlugin = ({ basename = "", routesConfig, createRoutes }) => {
|
|
74
|
+
const routerPlugin = ({ basename = "", originBaseUrl = "", routesConfig, createRoutes }) => {
|
|
75
75
|
return {
|
|
76
76
|
name: "@modern-js/plugin-router",
|
|
77
77
|
registerHook: {
|
|
@@ -86,7 +86,7 @@ const routerPlugin = ({ basename = "", routesConfig, createRoutes }) => {
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
const { request, mode: ssrMode, nonce } = context.ssrContext;
|
|
89
|
-
const baseUrl = request.baseUrl;
|
|
89
|
+
const baseUrl = originBaseUrl || request.baseUrl;
|
|
90
90
|
const _basename = baseUrl === "/" ? (0, import_utils.urlJoin)(baseUrl, basename) : baseUrl;
|
|
91
91
|
const { reporter, serverTiming } = context.ssrContext;
|
|
92
92
|
const requestContext = (0, import_node.createRequestContext)();
|
|
@@ -54,23 +54,19 @@ const checkIsInline = (chunk, enableInline) => {
|
|
|
54
54
|
return false;
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
-
function
|
|
57
|
+
async function buildShellBeforeTemplate(beforeAppTemplate, context, pluginConfig) {
|
|
58
58
|
const helmetData = import_react_helmet.default.renderStatic();
|
|
59
59
|
const callbacks = [
|
|
60
|
-
(
|
|
61
|
-
return helmetData ? (0, import_helmet.default)(
|
|
60
|
+
(headTemplate) => {
|
|
61
|
+
return helmetData ? (0, import_helmet.default)(headTemplate, helmetData) : headTemplate;
|
|
62
62
|
},
|
|
63
63
|
// @TODO: prefetch scripts of lazy component
|
|
64
64
|
injectCss
|
|
65
65
|
];
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return "";
|
|
69
|
-
}
|
|
70
|
-
return (0, import_buildTemplate.buildTemplate)(headTemplate, callbacks);
|
|
71
|
-
async function injectCss(headTemplate2) {
|
|
66
|
+
return (0, import_buildTemplate.buildTemplate)(beforeAppTemplate, callbacks);
|
|
67
|
+
async function injectCss(template) {
|
|
72
68
|
const css = await getCssChunks();
|
|
73
|
-
return (0, import_utils.safeReplace)(
|
|
69
|
+
return (0, import_utils.safeReplace)(template, import_constants.CHUNK_CSS_PLACEHOLDER, css);
|
|
74
70
|
async function getCssChunks() {
|
|
75
71
|
const { routeManifest, routerContext, routes } = context;
|
|
76
72
|
if (!routeManifest || !routerContext || !routes) {
|
|
@@ -88,7 +84,7 @@ function getHeadTemplate(beforeEntryTemplate, context, pluginConfig) {
|
|
|
88
84
|
const routeManifest2 = routeAssets[routeId];
|
|
89
85
|
if (routeManifest2) {
|
|
90
86
|
const { referenceCssAssets = [] } = routeManifest2;
|
|
91
|
-
const _cssChunks = referenceCssAssets.filter((asset) => (asset === null || asset === void 0 ? void 0 : asset.endsWith(".css")) && !
|
|
87
|
+
const _cssChunks = referenceCssAssets.filter((asset) => (asset === null || asset === void 0 ? void 0 : asset.endsWith(".css")) && !template.includes(asset));
|
|
92
88
|
cssChunks.push(..._cssChunks);
|
|
93
89
|
}
|
|
94
90
|
}
|
|
@@ -108,10 +104,6 @@ function getHeadTemplate(beforeEntryTemplate, context, pluginConfig) {
|
|
|
108
104
|
}
|
|
109
105
|
}
|
|
110
106
|
}
|
|
111
|
-
async function buildShellBeforeTemplate(beforeAppTemplate, context, pluginConfig) {
|
|
112
|
-
const headTemplate = await getHeadTemplate(beforeAppTemplate, context, pluginConfig);
|
|
113
|
-
return beforeAppTemplate.replace(import_buildTemplate.HEAD_REG_EXP, headTemplate);
|
|
114
|
-
}
|
|
115
107
|
// Annotate the CommonJS export names for ESM import in node:
|
|
116
108
|
0 && (module.exports = {
|
|
117
109
|
buildShellBeforeTemplate
|
|
@@ -23,7 +23,7 @@ function modifyRoutes(modifyFunction) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
var routerPlugin = function(param) {
|
|
26
|
-
var _param_serverBase = param.serverBase, serverBase = _param_serverBase === void 0 ? [] : _param_serverBase, _param_supportHtml5History = param.supportHtml5History, supportHtml5History = _param_supportHtml5History === void 0 ? true : _param_supportHtml5History, _param_basename = param.basename, basename = _param_basename === void 0 ? "" : _param_basename, routesConfig = param.routesConfig, createRoutes = param.createRoutes;
|
|
26
|
+
var _param_serverBase = param.serverBase, serverBase = _param_serverBase === void 0 ? [] : _param_serverBase, _param_supportHtml5History = param.supportHtml5History, supportHtml5History = _param_supportHtml5History === void 0 ? true : _param_supportHtml5History, _param_basename = param.basename, basename = _param_basename === void 0 ? "" : _param_basename, _param_originBaseUrl = param.originBaseUrl, originBaseUrl = _param_originBaseUrl === void 0 ? "" : _param_originBaseUrl, routesConfig = param.routesConfig, createRoutes = param.createRoutes;
|
|
27
27
|
var select = function(pathname) {
|
|
28
28
|
return serverBase.find(function(baseUrl) {
|
|
29
29
|
return pathname.search(baseUrl) === 0;
|
|
@@ -65,7 +65,7 @@ var routerPlugin = function(param) {
|
|
|
65
65
|
var getRouteApp = function() {
|
|
66
66
|
var useCreateRouter = function(props) {
|
|
67
67
|
var _window__SERVER_DATA;
|
|
68
|
-
var baseUrl = ((_window__SERVER_DATA = window._SERVER_DATA) === null || _window__SERVER_DATA === void 0 ? void 0 : _window__SERVER_DATA.router.baseUrl) || select(location.pathname);
|
|
68
|
+
var baseUrl = originBaseUrl || ((_window__SERVER_DATA = window._SERVER_DATA) === null || _window__SERVER_DATA === void 0 ? void 0 : _window__SERVER_DATA.router.baseUrl) || select(location.pathname);
|
|
69
69
|
var _basename = baseUrl === "/" ? urlJoin(baseUrl, basename) : baseUrl;
|
|
70
70
|
var hydrationData = window._ROUTER_DATA;
|
|
71
71
|
var runtimeContext = useContext(RuntimeReactContext);
|
|
@@ -77,7 +77,7 @@ function createFetchHeaders(requestHeaders) {
|
|
|
77
77
|
return headers;
|
|
78
78
|
}
|
|
79
79
|
var routerPlugin = function(param) {
|
|
80
|
-
var _param_basename = param.basename, basename = _param_basename === void 0 ? "" : _param_basename, routesConfig = param.routesConfig, createRoutes = param.createRoutes;
|
|
80
|
+
var _param_basename = param.basename, basename = _param_basename === void 0 ? "" : _param_basename, _param_originBaseUrl = param.originBaseUrl, originBaseUrl = _param_originBaseUrl === void 0 ? "" : _param_originBaseUrl, routesConfig = param.routesConfig, createRoutes = param.createRoutes;
|
|
81
81
|
return {
|
|
82
82
|
name: "@modern-js/plugin-router",
|
|
83
83
|
registerHook: {
|
|
@@ -101,7 +101,7 @@ var routerPlugin = function(param) {
|
|
|
101
101
|
];
|
|
102
102
|
}
|
|
103
103
|
_context_ssrContext = context.ssrContext, request = _context_ssrContext.request, ssrMode = _context_ssrContext.mode, nonce = _context_ssrContext.nonce;
|
|
104
|
-
baseUrl = request.baseUrl;
|
|
104
|
+
baseUrl = originBaseUrl || request.baseUrl;
|
|
105
105
|
_basename = baseUrl === "/" ? urlJoin(baseUrl, basename) : baseUrl;
|
|
106
106
|
_context_ssrContext1 = context.ssrContext, reporter = _context_ssrContext1.reporter, serverTiming = _context_ssrContext1.serverTiming;
|
|
107
107
|
requestContext = createRequestContext();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
2
|
import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
|
|
3
|
-
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
4
3
|
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
5
4
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
6
5
|
import ReactHelmet from "react-helmet";
|
|
@@ -8,7 +7,7 @@ import { matchRoutes } from "@modern-js/runtime-utils/router";
|
|
|
8
7
|
import helmetReplace from "../helmet";
|
|
9
8
|
import { CHUNK_CSS_PLACEHOLDER } from "../constants";
|
|
10
9
|
import { checkIsNode, safeReplace } from "../utils";
|
|
11
|
-
import {
|
|
10
|
+
import { buildTemplate } from "./buildTemplate.share";
|
|
12
11
|
var readAsset = function() {
|
|
13
12
|
var _ref = _async_to_generator(function(chunk) {
|
|
14
13
|
var fs, path, filepath;
|
|
@@ -50,145 +49,129 @@ var checkIsInline = function(chunk, enableInline) {
|
|
|
50
49
|
return false;
|
|
51
50
|
}
|
|
52
51
|
};
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
switch (_state.label) {
|
|
81
|
-
case 0:
|
|
82
|
-
routeManifest = context.routeManifest, routerContext = context.routerContext, routes = context.routes;
|
|
83
|
-
if (!routeManifest || !routerContext || !routes) {
|
|
84
|
-
return [
|
|
85
|
-
2,
|
|
86
|
-
""
|
|
87
|
-
];
|
|
88
|
-
}
|
|
89
|
-
routeAssets = routeManifest.routeAssets;
|
|
90
|
-
cssChunks = [];
|
|
91
|
-
matches = matchRoutes(routes, routerContext.location, routerContext.basename);
|
|
92
|
-
matches === null || matches === void 0 ? void 0 : matches.forEach(function(match, index) {
|
|
93
|
-
if (!index) {
|
|
94
|
-
return;
|
|
52
|
+
function buildShellBeforeTemplate(beforeAppTemplate, context, pluginConfig) {
|
|
53
|
+
return _buildShellBeforeTemplate.apply(this, arguments);
|
|
54
|
+
}
|
|
55
|
+
function _buildShellBeforeTemplate() {
|
|
56
|
+
_buildShellBeforeTemplate = _async_to_generator(function(beforeAppTemplate, context, pluginConfig) {
|
|
57
|
+
var helmetData, callbacks;
|
|
58
|
+
function injectCss(template) {
|
|
59
|
+
return _injectCss.apply(this, arguments);
|
|
60
|
+
}
|
|
61
|
+
function _injectCss() {
|
|
62
|
+
_injectCss = _async_to_generator(function(template) {
|
|
63
|
+
var css;
|
|
64
|
+
function getCssChunks() {
|
|
65
|
+
return _getCssChunks.apply(this, arguments);
|
|
66
|
+
}
|
|
67
|
+
function _getCssChunks() {
|
|
68
|
+
_getCssChunks = _async_to_generator(function() {
|
|
69
|
+
var routeManifest, routerContext, routes, routeAssets, cssChunks, matches, enableInlineStyles, styles;
|
|
70
|
+
return _ts_generator(this, function(_state) {
|
|
71
|
+
switch (_state.label) {
|
|
72
|
+
case 0:
|
|
73
|
+
routeManifest = context.routeManifest, routerContext = context.routerContext, routes = context.routes;
|
|
74
|
+
if (!routeManifest || !routerContext || !routes) {
|
|
75
|
+
return [
|
|
76
|
+
2,
|
|
77
|
+
""
|
|
78
|
+
];
|
|
95
79
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
var _cssChunks1 = referenceCssAssets.filter(function(asset) {
|
|
103
|
-
return (asset === null || asset === void 0 ? void 0 : asset.endsWith(".css")) && !headTemplate2.includes(asset);
|
|
104
|
-
});
|
|
105
|
-
(_cssChunks = cssChunks).push.apply(_cssChunks, _to_consumable_array(_cssChunks1));
|
|
80
|
+
routeAssets = routeManifest.routeAssets;
|
|
81
|
+
cssChunks = [];
|
|
82
|
+
matches = matchRoutes(routes, routerContext.location, routerContext.basename);
|
|
83
|
+
matches === null || matches === void 0 ? void 0 : matches.forEach(function(match, index) {
|
|
84
|
+
if (!index) {
|
|
85
|
+
return;
|
|
106
86
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
87
|
+
var routeId = match.route.id;
|
|
88
|
+
if (routeId) {
|
|
89
|
+
var routeManifest2 = routeAssets[routeId];
|
|
90
|
+
if (routeManifest2) {
|
|
91
|
+
var _cssChunks;
|
|
92
|
+
var _routeManifest_referenceCssAssets = routeManifest2.referenceCssAssets, referenceCssAssets = _routeManifest_referenceCssAssets === void 0 ? [] : _routeManifest_referenceCssAssets;
|
|
93
|
+
var _cssChunks1 = referenceCssAssets.filter(function(asset) {
|
|
94
|
+
return (asset === null || asset === void 0 ? void 0 : asset.endsWith(".css")) && !template.includes(asset);
|
|
95
|
+
});
|
|
96
|
+
(_cssChunks = cssChunks).push.apply(_cssChunks, _to_consumable_array(_cssChunks1));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
enableInlineStyles = pluginConfig.enableInlineStyles;
|
|
101
|
+
return [
|
|
102
|
+
4,
|
|
103
|
+
Promise.all(cssChunks.map(function() {
|
|
104
|
+
var _ref = _async_to_generator(function(chunk) {
|
|
105
|
+
var link;
|
|
106
|
+
return _ts_generator(this, function(_state2) {
|
|
107
|
+
link = '<link href="'.concat(chunk, '" rel="stylesheet" />');
|
|
108
|
+
if (checkIsNode() && checkIsInline(chunk, enableInlineStyles)) {
|
|
109
|
+
return [
|
|
110
|
+
2,
|
|
111
|
+
readAsset(chunk).then(function(content) {
|
|
112
|
+
return "<style>".concat(content, "</style>");
|
|
113
|
+
}).catch(function(_) {
|
|
114
|
+
return link;
|
|
115
|
+
})
|
|
116
|
+
];
|
|
117
|
+
} else {
|
|
118
|
+
return [
|
|
119
|
+
2,
|
|
120
|
+
link
|
|
121
|
+
];
|
|
122
|
+
}
|
|
127
123
|
return [
|
|
128
|
-
2
|
|
129
|
-
link
|
|
124
|
+
2
|
|
130
125
|
];
|
|
131
|
-
}
|
|
132
|
-
return [
|
|
133
|
-
2
|
|
134
|
-
];
|
|
126
|
+
});
|
|
135
127
|
});
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
128
|
+
return function(chunk) {
|
|
129
|
+
return _ref.apply(this, arguments);
|
|
130
|
+
};
|
|
131
|
+
}()))
|
|
132
|
+
];
|
|
133
|
+
case 1:
|
|
134
|
+
styles = _state.sent();
|
|
135
|
+
return [
|
|
136
|
+
2,
|
|
137
|
+
"".concat(styles.join(""))
|
|
138
|
+
];
|
|
139
|
+
}
|
|
140
|
+
});
|
|
149
141
|
});
|
|
150
|
-
|
|
151
|
-
return _getCssChunks.apply(this, arguments);
|
|
152
|
-
}
|
|
153
|
-
return _ts_generator(this, function(_state) {
|
|
154
|
-
switch (_state.label) {
|
|
155
|
-
case 0:
|
|
156
|
-
return [
|
|
157
|
-
4,
|
|
158
|
-
getCssChunks()
|
|
159
|
-
];
|
|
160
|
-
case 1:
|
|
161
|
-
css = _state.sent();
|
|
162
|
-
return [
|
|
163
|
-
2,
|
|
164
|
-
safeReplace(headTemplate2, CHUNK_CSS_PLACEHOLDER, css)
|
|
165
|
-
];
|
|
142
|
+
return _getCssChunks.apply(this, arguments);
|
|
166
143
|
}
|
|
144
|
+
return _ts_generator(this, function(_state) {
|
|
145
|
+
switch (_state.label) {
|
|
146
|
+
case 0:
|
|
147
|
+
return [
|
|
148
|
+
4,
|
|
149
|
+
getCssChunks()
|
|
150
|
+
];
|
|
151
|
+
case 1:
|
|
152
|
+
css = _state.sent();
|
|
153
|
+
return [
|
|
154
|
+
2,
|
|
155
|
+
safeReplace(template, CHUNK_CSS_PLACEHOLDER, css)
|
|
156
|
+
];
|
|
157
|
+
}
|
|
158
|
+
});
|
|
167
159
|
});
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
function buildShellBeforeTemplate(beforeAppTemplate, context, pluginConfig) {
|
|
173
|
-
return _buildShellBeforeTemplate.apply(this, arguments);
|
|
174
|
-
}
|
|
175
|
-
function _buildShellBeforeTemplate() {
|
|
176
|
-
_buildShellBeforeTemplate = _async_to_generator(function(beforeAppTemplate, context, pluginConfig) {
|
|
177
|
-
var headTemplate;
|
|
160
|
+
return _injectCss.apply(this, arguments);
|
|
161
|
+
}
|
|
178
162
|
return _ts_generator(this, function(_state) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
163
|
+
helmetData = ReactHelmet.renderStatic();
|
|
164
|
+
callbacks = [
|
|
165
|
+
function(headTemplate) {
|
|
166
|
+
return helmetData ? helmetReplace(headTemplate, helmetData) : headTemplate;
|
|
167
|
+
},
|
|
168
|
+
// @TODO: prefetch scripts of lazy component
|
|
169
|
+
injectCss
|
|
170
|
+
];
|
|
171
|
+
return [
|
|
172
|
+
2,
|
|
173
|
+
buildTemplate(beforeAppTemplate, callbacks)
|
|
174
|
+
];
|
|
192
175
|
});
|
|
193
176
|
});
|
|
194
177
|
return _buildShellBeforeTemplate.apply(this, arguments);
|
|
@@ -19,7 +19,7 @@ function modifyRoutes(modifyFunction) {
|
|
|
19
19
|
console.error("It is not allowed to modify routes config after create router.");
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
const routerPlugin = ({ serverBase = [], supportHtml5History = true, basename = "", routesConfig, createRoutes }) => {
|
|
22
|
+
const routerPlugin = ({ serverBase = [], supportHtml5History = true, basename = "", originBaseUrl = "", routesConfig, createRoutes }) => {
|
|
23
23
|
const select = (pathname) => serverBase.find((baseUrl) => pathname.search(baseUrl) === 0) || "/";
|
|
24
24
|
let routes = [];
|
|
25
25
|
finalRouteConfig = routesConfig;
|
|
@@ -55,7 +55,7 @@ const routerPlugin = ({ serverBase = [], supportHtml5History = true, basename =
|
|
|
55
55
|
const getRouteApp = () => {
|
|
56
56
|
const useCreateRouter = (props) => {
|
|
57
57
|
var _window__SERVER_DATA;
|
|
58
|
-
const baseUrl = ((_window__SERVER_DATA = window._SERVER_DATA) === null || _window__SERVER_DATA === void 0 ? void 0 : _window__SERVER_DATA.router.baseUrl) || select(location.pathname);
|
|
58
|
+
const baseUrl = originBaseUrl || ((_window__SERVER_DATA = window._SERVER_DATA) === null || _window__SERVER_DATA === void 0 ? void 0 : _window__SERVER_DATA.router.baseUrl) || select(location.pathname);
|
|
59
59
|
const _basename = baseUrl === "/" ? urlJoin(baseUrl, basename) : baseUrl;
|
|
60
60
|
let hydrationData = window._ROUTER_DATA;
|
|
61
61
|
const runtimeContext = useContext(RuntimeReactContext);
|
|
@@ -36,7 +36,7 @@ function createFetchHeaders(requestHeaders) {
|
|
|
36
36
|
}
|
|
37
37
|
return headers;
|
|
38
38
|
}
|
|
39
|
-
const routerPlugin = ({ basename = "", routesConfig, createRoutes }) => {
|
|
39
|
+
const routerPlugin = ({ basename = "", originBaseUrl = "", routesConfig, createRoutes }) => {
|
|
40
40
|
return {
|
|
41
41
|
name: "@modern-js/plugin-router",
|
|
42
42
|
registerHook: {
|
|
@@ -51,7 +51,7 @@ const routerPlugin = ({ basename = "", routesConfig, createRoutes }) => {
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
const { request, mode: ssrMode, nonce } = context.ssrContext;
|
|
54
|
-
const baseUrl = request.baseUrl;
|
|
54
|
+
const baseUrl = originBaseUrl || request.baseUrl;
|
|
55
55
|
const _basename = baseUrl === "/" ? urlJoin(baseUrl, basename) : baseUrl;
|
|
56
56
|
const { reporter, serverTiming } = context.ssrContext;
|
|
57
57
|
const requestContext = createRequestContext();
|
|
@@ -3,7 +3,7 @@ import { matchRoutes } from "@modern-js/runtime-utils/router";
|
|
|
3
3
|
import helmetReplace from "../helmet";
|
|
4
4
|
import { CHUNK_CSS_PLACEHOLDER } from "../constants";
|
|
5
5
|
import { checkIsNode, safeReplace } from "../utils";
|
|
6
|
-
import {
|
|
6
|
+
import { buildTemplate } from "./buildTemplate.share";
|
|
7
7
|
const readAsset = async (chunk) => {
|
|
8
8
|
const fs = await import("fs/promises");
|
|
9
9
|
const path = await import("path");
|
|
@@ -21,23 +21,19 @@ const checkIsInline = (chunk, enableInline) => {
|
|
|
21
21
|
return false;
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
function
|
|
24
|
+
async function buildShellBeforeTemplate(beforeAppTemplate, context, pluginConfig) {
|
|
25
25
|
const helmetData = ReactHelmet.renderStatic();
|
|
26
26
|
const callbacks = [
|
|
27
|
-
(
|
|
28
|
-
return helmetData ? helmetReplace(
|
|
27
|
+
(headTemplate) => {
|
|
28
|
+
return helmetData ? helmetReplace(headTemplate, helmetData) : headTemplate;
|
|
29
29
|
},
|
|
30
30
|
// @TODO: prefetch scripts of lazy component
|
|
31
31
|
injectCss
|
|
32
32
|
];
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return "";
|
|
36
|
-
}
|
|
37
|
-
return buildTemplate(headTemplate, callbacks);
|
|
38
|
-
async function injectCss(headTemplate2) {
|
|
33
|
+
return buildTemplate(beforeAppTemplate, callbacks);
|
|
34
|
+
async function injectCss(template) {
|
|
39
35
|
const css = await getCssChunks();
|
|
40
|
-
return safeReplace(
|
|
36
|
+
return safeReplace(template, CHUNK_CSS_PLACEHOLDER, css);
|
|
41
37
|
async function getCssChunks() {
|
|
42
38
|
const { routeManifest, routerContext, routes } = context;
|
|
43
39
|
if (!routeManifest || !routerContext || !routes) {
|
|
@@ -55,7 +51,7 @@ function getHeadTemplate(beforeEntryTemplate, context, pluginConfig) {
|
|
|
55
51
|
const routeManifest2 = routeAssets[routeId];
|
|
56
52
|
if (routeManifest2) {
|
|
57
53
|
const { referenceCssAssets = [] } = routeManifest2;
|
|
58
|
-
const _cssChunks = referenceCssAssets.filter((asset) => (asset === null || asset === void 0 ? void 0 : asset.endsWith(".css")) && !
|
|
54
|
+
const _cssChunks = referenceCssAssets.filter((asset) => (asset === null || asset === void 0 ? void 0 : asset.endsWith(".css")) && !template.includes(asset));
|
|
59
55
|
cssChunks.push(..._cssChunks);
|
|
60
56
|
}
|
|
61
57
|
}
|
|
@@ -75,10 +71,6 @@ function getHeadTemplate(beforeEntryTemplate, context, pluginConfig) {
|
|
|
75
71
|
}
|
|
76
72
|
}
|
|
77
73
|
}
|
|
78
|
-
async function buildShellBeforeTemplate(beforeAppTemplate, context, pluginConfig) {
|
|
79
|
-
const headTemplate = await getHeadTemplate(beforeAppTemplate, context, pluginConfig);
|
|
80
|
-
return beforeAppTemplate.replace(HEAD_REG_EXP, headTemplate);
|
|
81
|
-
}
|
|
82
74
|
export {
|
|
83
75
|
buildShellBeforeTemplate
|
|
84
76
|
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import path from "path";
|
|
22
|
+
import { PLUGIN_SCHEMAS, cleanRequireCache, isReact18 } from "@modern-js/utils";
|
|
23
|
+
import PluginState from "../state/cli";
|
|
24
|
+
import PluginSSR from "../ssr/cli";
|
|
25
|
+
import PluginRouter from "../router/cli";
|
|
26
|
+
import Document from "../document/cli";
|
|
27
|
+
var cli_default = () => ({
|
|
28
|
+
name: "@modern-js/runtime",
|
|
29
|
+
post: [
|
|
30
|
+
"@modern-js/plugin-router",
|
|
31
|
+
"@modern-js/plugin-ssr",
|
|
32
|
+
"@modern-js/plugin-document",
|
|
33
|
+
"@modern-js/plugin-state",
|
|
34
|
+
"@modern-js/plugin-design-token"
|
|
35
|
+
],
|
|
36
|
+
usePlugins: [PluginState(), PluginSSR(), PluginRouter(), Document()],
|
|
37
|
+
setup: (api) => {
|
|
38
|
+
return {
|
|
39
|
+
config() {
|
|
40
|
+
const dir = api.useAppContext().internalDirectory || "";
|
|
41
|
+
process.env.IS_REACT18 = isReact18(path.join(dir, "../../")).toString();
|
|
42
|
+
return {
|
|
43
|
+
runtime: {},
|
|
44
|
+
runtimeByEntries: {},
|
|
45
|
+
source: {
|
|
46
|
+
alias: {
|
|
47
|
+
"styled-components": require.resolve("styled-components")
|
|
48
|
+
},
|
|
49
|
+
globalVars: {
|
|
50
|
+
"process.env.IS_REACT18": process.env.IS_REACT18
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
validateSchema() {
|
|
56
|
+
return PLUGIN_SCHEMAS["@modern-js/runtime"];
|
|
57
|
+
},
|
|
58
|
+
beforeRestart() {
|
|
59
|
+
return __async(this, null, function* () {
|
|
60
|
+
cleanRequireCache([
|
|
61
|
+
require.resolve("../state/cli"),
|
|
62
|
+
require.resolve("../router/cli"),
|
|
63
|
+
require.resolve("../ssr/cli")
|
|
64
|
+
]);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
export {
|
|
71
|
+
cli_default as default
|
|
72
|
+
};
|
|
File without changes
|