@modern-js/runtime 2.55.0 → 2.56.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/cli/index.js +2 -3
- package/dist/cjs/cli/ssr/index.js +30 -14
- package/dist/cjs/core/browser/index.js +21 -1
- package/dist/cjs/core/plugin/index.js +2 -2
- package/dist/cjs/core/server/string/index.js +2 -2
- package/dist/cjs/core/server/string/prefetch.js +3 -3
- package/dist/cjs/core/utils/merge.js +53 -0
- package/dist/cjs/router/cli/code/index.js +2 -2
- package/dist/cjs/router/cli/entry.js +16 -15
- package/dist/cjs/router/runtime/PrefetchLink.js +1 -1
- package/dist/cjs/router/runtime/plugin.node.js +10 -17
- package/dist/esm/cli/index.js +1 -2
- package/dist/esm/cli/ssr/index.js +33 -16
- package/dist/esm/core/browser/index.js +19 -1
- package/dist/esm/core/plugin/index.js +1 -1
- package/dist/esm/core/server/string/index.js +3 -3
- package/dist/esm/core/server/string/prefetch.js +5 -5
- package/dist/esm/core/utils/merge.js +32 -0
- package/dist/esm/router/cli/code/index.js +3 -3
- package/dist/esm/router/cli/entry.js +19 -17
- package/dist/esm/router/runtime/PrefetchLink.js +1 -1
- package/dist/esm/router/runtime/plugin.node.js +10 -51
- package/dist/esm-node/cli/index.js +1 -2
- package/dist/esm-node/cli/ssr/index.js +30 -14
- package/dist/esm-node/core/browser/index.js +21 -1
- package/dist/esm-node/core/plugin/index.js +1 -1
- package/dist/esm-node/core/server/string/index.js +2 -2
- package/dist/esm-node/core/server/string/prefetch.js +3 -3
- package/dist/esm-node/core/utils/merge.js +29 -0
- package/dist/esm-node/router/cli/code/index.js +2 -2
- package/dist/esm-node/router/cli/entry.js +16 -15
- package/dist/esm-node/router/runtime/PrefetchLink.js +1 -1
- package/dist/esm-node/router/runtime/plugin.node.js +10 -16
- package/dist/types/core/browser/index.d.ts +1 -0
- package/dist/types/core/plugin/index.d.ts +1 -1
- package/dist/types/core/server/string/prefetch.d.ts +2 -1
- package/dist/types/core/utils/merge.d.ts +6 -0
- package/dist/types/router/runtime/plugin.node.d.ts +0 -2
- package/package.json +14 -14
package/dist/cjs/cli/index.js
CHANGED
|
@@ -39,7 +39,6 @@ __export(cli_exports, {
|
|
|
39
39
|
module.exports = __toCommonJS(cli_exports);
|
|
40
40
|
var import_path = __toESM(require("path"));
|
|
41
41
|
var import_utils = require("@modern-js/utils");
|
|
42
|
-
var import_core = require("@rsbuild/core");
|
|
43
42
|
var import_cli = require("../state/cli");
|
|
44
43
|
var import_cli2 = require("../router/cli");
|
|
45
44
|
var import_cli3 = require("../document/cli");
|
|
@@ -151,10 +150,10 @@ const runtimePlugin = (params) => ({
|
|
|
151
150
|
]);
|
|
152
151
|
}
|
|
153
152
|
},
|
|
154
|
-
rspack: (_config, { appendPlugins }) => {
|
|
153
|
+
rspack: (_config, { appendPlugins, rspack }) => {
|
|
155
154
|
if (!isReact18) {
|
|
156
155
|
appendPlugins([
|
|
157
|
-
new
|
|
156
|
+
new rspack.IgnorePlugin({
|
|
158
157
|
resourceRegExp: /^react-dom\/client$/,
|
|
159
158
|
contextRegExp: /./
|
|
160
159
|
})
|
|
@@ -53,6 +53,33 @@ const checkUseStringSSR = (config) => {
|
|
|
53
53
|
const { output } = config;
|
|
54
54
|
return Boolean(output === null || output === void 0 ? void 0 : output.ssg) || hasStringSSREntry(config);
|
|
55
55
|
};
|
|
56
|
+
const ssrBuilderPlugin = (modernAPI) => ({
|
|
57
|
+
name: "@modern-js/builder-plugin-ssr",
|
|
58
|
+
setup(api) {
|
|
59
|
+
api.modifyEnvironmentConfig((config, { name, mergeEnvironmentConfig }) => {
|
|
60
|
+
const isServerEnvironment = config.output.target === "node" || name === "serviceWorker";
|
|
61
|
+
const userConfig = modernAPI.useResolvedConfigContext();
|
|
62
|
+
const useLoadablePlugin = (0, import_utils.isUseSSRBundle)(userConfig) && !isServerEnvironment && checkUseStringSSR(userConfig);
|
|
63
|
+
return mergeEnvironmentConfig(config, {
|
|
64
|
+
source: {
|
|
65
|
+
define: {
|
|
66
|
+
"process.env.MODERN_TARGET": isServerEnvironment ? JSON.stringify("node") : JSON.stringify("browser")
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
tools: {
|
|
70
|
+
bundlerChain: useLoadablePlugin ? (chain) => {
|
|
71
|
+
const LoadableBundlerPlugin = require("./loadable-bundler-plugin.js");
|
|
72
|
+
chain.plugin("loadable").use(LoadableBundlerPlugin, [
|
|
73
|
+
{
|
|
74
|
+
filename: import_utils.LOADABLE_STATS_FILE
|
|
75
|
+
}
|
|
76
|
+
]);
|
|
77
|
+
} : void 0
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
56
83
|
const ssrPlugin = () => ({
|
|
57
84
|
name: "@modern-js/plugin-ssr",
|
|
58
85
|
required: [
|
|
@@ -86,27 +113,16 @@ const ssrPlugin = () => ({
|
|
|
86
113
|
}
|
|
87
114
|
})();
|
|
88
115
|
return {
|
|
116
|
+
builderPlugins: [
|
|
117
|
+
ssrBuilderPlugin(api)
|
|
118
|
+
],
|
|
89
119
|
source: {
|
|
90
120
|
alias: {
|
|
91
121
|
// ensure that all packages use the same storage in @modern-js/runtime-utils/node
|
|
92
122
|
"@modern-js/runtime-utils/node$": require.resolve("@modern-js/runtime-utils/node")
|
|
93
|
-
},
|
|
94
|
-
globalVars: (values, { target }) => {
|
|
95
|
-
values["process.env.MODERN_TARGET"] = target === "node" || target === "service-worker" ? "node" : "browser";
|
|
96
123
|
}
|
|
97
124
|
},
|
|
98
125
|
tools: {
|
|
99
|
-
bundlerChain(chain, { isServer, isServiceWorker }) {
|
|
100
|
-
const userConfig = api.useResolvedConfigContext();
|
|
101
|
-
if ((0, import_utils.isUseSSRBundle)(userConfig) && !isServer && !isServiceWorker && checkUseStringSSR(userConfig)) {
|
|
102
|
-
const LoadableBundlerPlugin = require("./loadable-bundler-plugin.js");
|
|
103
|
-
chain.plugin("loadable").use(LoadableBundlerPlugin, [
|
|
104
|
-
{
|
|
105
|
-
filename: import_utils.LOADABLE_STATS_FILE
|
|
106
|
-
}
|
|
107
|
-
]);
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
126
|
babel: babelHandler
|
|
111
127
|
}
|
|
112
128
|
};
|
|
@@ -32,12 +32,32 @@ __export(browser_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(browser_exports);
|
|
34
34
|
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_cookie = __toESM(require("cookie"));
|
|
35
36
|
var import_context = require("../context");
|
|
36
37
|
var import_runtime = require("../context/runtime");
|
|
37
38
|
var import_loaderManager = require("../loader/loaderManager");
|
|
38
39
|
var import_runner = require("../plugin/runner");
|
|
39
40
|
var import_hydrate = require("./hydrate");
|
|
40
41
|
const IS_REACT18 = process.env.IS_REACT18 === "true";
|
|
42
|
+
function getSSRData() {
|
|
43
|
+
const ssrData = window._SSR_DATA;
|
|
44
|
+
if (ssrData) {
|
|
45
|
+
const finalSSRData = {
|
|
46
|
+
...ssrData,
|
|
47
|
+
context: {
|
|
48
|
+
...ssrData.context,
|
|
49
|
+
request: {
|
|
50
|
+
...ssrData.context.request,
|
|
51
|
+
cookieMap: import_cookie.default.parse(document.cookie || "") || {},
|
|
52
|
+
cookie: document.cookie || "",
|
|
53
|
+
userAgent: navigator.userAgent,
|
|
54
|
+
referer: document.referrer
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
return finalSSRData;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
41
61
|
function isClientArgs(id) {
|
|
42
62
|
return typeof id === "undefined" || typeof id === "string" || typeof HTMLElement !== "undefined" && id instanceof HTMLElement;
|
|
43
63
|
}
|
|
@@ -54,7 +74,7 @@ async function render(App, id) {
|
|
|
54
74
|
});
|
|
55
75
|
if (isClientArgs(id)) {
|
|
56
76
|
var _ssrData_data, _ssrData_data1;
|
|
57
|
-
const ssrData =
|
|
77
|
+
const ssrData = getSSRData();
|
|
58
78
|
const loadersData = (ssrData === null || ssrData === void 0 ? void 0 : (_ssrData_data = ssrData.data) === null || _ssrData_data === void 0 ? void 0 : _ssrData_data.loadersData) || {};
|
|
59
79
|
const initialLoadersState = Object.keys(loadersData).reduce((res, key) => {
|
|
60
80
|
const loaderData = loadersData[key];
|
|
@@ -23,7 +23,7 @@ __export(plugin_exports, {
|
|
|
23
23
|
registerPlugin: () => registerPlugin
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(plugin_exports);
|
|
26
|
-
var
|
|
26
|
+
var import_merge = require("../utils/merge");
|
|
27
27
|
var import_base = require("./base");
|
|
28
28
|
var import_runner = require("./runner");
|
|
29
29
|
__reExport(plugin_exports, require("./base"), module.exports);
|
|
@@ -35,7 +35,7 @@ function registerPlugin(internalPlugins, runtimeConfig, customRuntime) {
|
|
|
35
35
|
return runner;
|
|
36
36
|
}
|
|
37
37
|
function mergeConfig(config, ...otherConfig) {
|
|
38
|
-
return (0,
|
|
38
|
+
return (0, import_merge.merge)(config, ...otherConfig);
|
|
39
39
|
}
|
|
40
40
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
41
|
0 && (module.exports = {
|
|
@@ -58,6 +58,7 @@ const renderString = async (request, serverRoot, options) => {
|
|
|
58
58
|
};
|
|
59
59
|
const routerContext = runtimeContext.routerContext;
|
|
60
60
|
const { htmlTemplate, entryName, loadableStats, routeManifest } = resource;
|
|
61
|
+
const ssrConfig = (0, import_utils.getSSRConfigByEntry)(entryName, config.ssr, config.ssrByEntries, staticGenerate);
|
|
61
62
|
const chunkSet = {
|
|
62
63
|
renderLevel: import_constants2.RenderLevel.CLIENT_RENDER,
|
|
63
64
|
ssrScripts: "",
|
|
@@ -66,12 +67,11 @@ const renderString = async (request, serverRoot, options) => {
|
|
|
66
67
|
};
|
|
67
68
|
let prefetchData = {};
|
|
68
69
|
try {
|
|
69
|
-
prefetchData = await (0, import_prefetch.prefetch)(serverRoot, request, options, tracer);
|
|
70
|
+
prefetchData = await (0, import_prefetch.prefetch)(serverRoot, request, options, ssrConfig, tracer);
|
|
70
71
|
chunkSet.renderLevel = import_constants2.RenderLevel.SERVER_PREFETCH;
|
|
71
72
|
} catch (e) {
|
|
72
73
|
chunkSet.renderLevel = import_constants2.RenderLevel.CLIENT_RENDER;
|
|
73
74
|
}
|
|
74
|
-
const ssrConfig = (0, import_utils.getSSRConfigByEntry)(entryName, config.ssr, config.ssrByEntries, staticGenerate);
|
|
75
75
|
const collectors = [
|
|
76
76
|
new import_styledComponent.StyledCollector(chunkSet),
|
|
77
77
|
new import_loadable.LoadableCollector({
|
|
@@ -38,13 +38,13 @@ var import_time = require("@modern-js/runtime-utils/time");
|
|
|
38
38
|
var import_request = require("@modern-js/runtime-utils/universal/request");
|
|
39
39
|
var import_react = __toESM(require("react"));
|
|
40
40
|
var import_tracer = require("../tracer");
|
|
41
|
-
const prefetch = async (App, request, options, { onError, onTiming }) => {
|
|
41
|
+
const prefetch = async (App, request, options, ssrConfig, { onError, onTiming }) => {
|
|
42
42
|
const headersData = (0, import_request.parseHeaders)(request);
|
|
43
|
-
const { runtimeContext: context, resource
|
|
43
|
+
const { runtimeContext: context, resource } = options;
|
|
44
44
|
const { entryName, loadableStats } = resource;
|
|
45
45
|
return (0, import_node.run)(headersData, async () => {
|
|
46
46
|
var _context_store;
|
|
47
|
-
if (!
|
|
47
|
+
if (typeof ssrConfig === "boolean" || !ssrConfig.disablePrerender) {
|
|
48
48
|
try {
|
|
49
49
|
const end = (0, import_time.time)();
|
|
50
50
|
if (loadableStats) {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var merge_exports = {};
|
|
20
|
+
__export(merge_exports, {
|
|
21
|
+
merge: () => merge
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(merge_exports);
|
|
24
|
+
function isObject(obj) {
|
|
25
|
+
return obj && typeof obj === "object" && !Array.isArray(obj);
|
|
26
|
+
}
|
|
27
|
+
function merge(target, ...sources) {
|
|
28
|
+
if (!sources.length) {
|
|
29
|
+
return target;
|
|
30
|
+
}
|
|
31
|
+
const source = sources.shift();
|
|
32
|
+
if (isObject(target) && isObject(source)) {
|
|
33
|
+
for (const key in source) {
|
|
34
|
+
if (isObject(source[key])) {
|
|
35
|
+
if (!target[key]) {
|
|
36
|
+
Object.assign(target, {
|
|
37
|
+
[key]: {}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
merge(target[key], source[key]);
|
|
41
|
+
} else {
|
|
42
|
+
Object.assign(target, {
|
|
43
|
+
[key]: source[key]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return merge(target, ...sources);
|
|
49
|
+
}
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
merge
|
|
53
|
+
});
|
|
@@ -48,10 +48,10 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
|
48
48
|
const oldVersion = typeof (config === null || config === void 0 ? void 0 : config.runtime.router) === "object" ? Boolean((config === null || config === void 0 ? void 0 : config.runtime.router).oldVersion) : false;
|
|
49
49
|
await Promise.all(entrypoints.map(generateEntryCode));
|
|
50
50
|
async function generateEntryCode(entrypoint) {
|
|
51
|
-
const { entryName, isMainEntry, isAutoMount,
|
|
51
|
+
const { entryName, isMainEntry, isAutoMount, pageRoutesEntry, nestedRoutesEntry } = entrypoint;
|
|
52
52
|
const { metaName } = api.useAppContext();
|
|
53
53
|
if (isAutoMount) {
|
|
54
|
-
if (
|
|
54
|
+
if (pageRoutesEntry || nestedRoutesEntry) {
|
|
55
55
|
var _config_output;
|
|
56
56
|
let initialRoutes = [];
|
|
57
57
|
let nestedRoutes = null;
|
|
@@ -54,29 +54,30 @@ const modifyEntrypoints = (entrypoints, config = {}) => {
|
|
|
54
54
|
if (!entrypoint.isAutoMount) {
|
|
55
55
|
return entrypoint;
|
|
56
56
|
}
|
|
57
|
+
if (entrypoint === null || entrypoint === void 0 ? void 0 : entrypoint.isCustomSourceEntry) {
|
|
58
|
+
if (entrypoint.fileSystemRoutes) {
|
|
59
|
+
if ((0, import_utils.isRouterV5)(config)) {
|
|
60
|
+
throw Error("Custom entries with conventional routing not support use react router v5!");
|
|
61
|
+
}
|
|
62
|
+
entrypoint.nestedRoutesEntry = entrypoint.entry;
|
|
63
|
+
}
|
|
64
|
+
return entrypoint;
|
|
65
|
+
}
|
|
57
66
|
const isHasApp = (0, import_entry.hasApp)(entrypoint.absoluteEntryDir);
|
|
58
67
|
if (isHasApp) {
|
|
59
68
|
return entrypoint;
|
|
60
69
|
}
|
|
61
|
-
const isHasNestedRoutes = hasNestedRoutes(entrypoint.absoluteEntryDir);
|
|
62
70
|
const isHasPages = hasPages(entrypoint.absoluteEntryDir);
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
if (entrypoint.fileSystemRoutes && !(0, import_utils.isRouterV5)(config)) {
|
|
67
|
-
entrypoint.nestedRoutesEntry = entrypoint.entry;
|
|
68
|
-
} else if (!entrypoint.fileSystemRoutes) {
|
|
71
|
+
if (isHasPages) {
|
|
72
|
+
entrypoint.pageRoutesEntry = import_path.default.join(entrypoint.absoluteEntryDir, import_constants.PAGES_DIR_NAME);
|
|
69
73
|
entrypoint.fileSystemRoutes = {
|
|
74
|
+
...entrypoint.fileSystemRoutes,
|
|
70
75
|
globalApp: (0, import_utils.findExists)(import_utils.JS_EXTENSIONS.map((ext) => import_path.default.resolve(entrypoint.absoluteEntryDir, `./${import_constants.PAGES_DIR_NAME}/${import_constants.FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT}${ext}`)))
|
|
71
76
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
entrypoint.nestedRoutesEntry = import_path.default.join(entrypoint.absoluteEntryDir, import_constants.NESTED_ROUTES_DIR);
|
|
77
|
-
}
|
|
78
|
-
} else {
|
|
79
|
-
throw Error("Custom entries with conventional routing not support use react router v5!");
|
|
77
|
+
}
|
|
78
|
+
const isHasNestedRoutes = hasNestedRoutes(entrypoint.absoluteEntryDir);
|
|
79
|
+
if (isHasNestedRoutes) {
|
|
80
|
+
entrypoint.nestedRoutesEntry = import_path.default.join(entrypoint.absoluteEntryDir, import_constants.NESTED_ROUTES_DIR);
|
|
80
81
|
}
|
|
81
82
|
return entrypoint;
|
|
82
83
|
});
|
|
@@ -105,7 +105,7 @@ async function loadRouteModule(route, routeAssets) {
|
|
|
105
105
|
}
|
|
106
106
|
try {
|
|
107
107
|
await Promise.all(chunkIds.map((chunkId) => {
|
|
108
|
-
return __webpack_chunk_load__ === null || __webpack_chunk_load__ === void 0 ? void 0 : __webpack_chunk_load__(
|
|
108
|
+
return __webpack_chunk_load__ === null || __webpack_chunk_load__ === void 0 ? void 0 : __webpack_chunk_load__(chunkId);
|
|
109
109
|
}));
|
|
110
110
|
} catch (error) {
|
|
111
111
|
console.error(error);
|
|
@@ -28,7 +28,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var plugin_node_exports = {};
|
|
30
30
|
__export(plugin_node_exports, {
|
|
31
|
-
createFetchHeaders: () => createFetchHeaders,
|
|
32
31
|
modifyRoutes: () => modifyRoutes,
|
|
33
32
|
routerPlugin: () => routerPlugin
|
|
34
33
|
});
|
|
@@ -47,20 +46,15 @@ var import_context = require("../../core/context");
|
|
|
47
46
|
var import_utils = require("./utils");
|
|
48
47
|
var import_hooks = require("./hooks");
|
|
49
48
|
var import_DeferredDataScripts = __toESM(require("./DeferredDataScripts.node"));
|
|
50
|
-
function
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
headers.set(key, values);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return headers;
|
|
49
|
+
function createRemixReuqest(request) {
|
|
50
|
+
const method = "GET";
|
|
51
|
+
const { headers } = request;
|
|
52
|
+
const controller = new AbortController();
|
|
53
|
+
return new Request(request.url, {
|
|
54
|
+
method,
|
|
55
|
+
headers,
|
|
56
|
+
signal: controller.signal
|
|
57
|
+
});
|
|
64
58
|
}
|
|
65
59
|
const routerPlugin = ({ basename = "", routesConfig, createRoutes }) => {
|
|
66
60
|
return {
|
|
@@ -101,7 +95,7 @@ const routerPlugin = ({ basename = "", routesConfig, createRoutes }) => {
|
|
|
101
95
|
const { query } = (0, import_remix_router.createStaticHandler)(routes, {
|
|
102
96
|
basename: _basename
|
|
103
97
|
});
|
|
104
|
-
const remixRequest = context.ssrContext.request.raw;
|
|
98
|
+
const remixRequest = createRemixReuqest(context.ssrContext.request.raw);
|
|
105
99
|
const end = (0, import_time.time)();
|
|
106
100
|
const routerContext = await query(remixRequest, {
|
|
107
101
|
requestContext
|
|
@@ -186,7 +180,6 @@ const modifyRoutes = () => {
|
|
|
186
180
|
};
|
|
187
181
|
// Annotate the CommonJS export names for ESM import in node:
|
|
188
182
|
0 && (module.exports = {
|
|
189
|
-
createFetchHeaders,
|
|
190
183
|
modifyRoutes,
|
|
191
184
|
routerPlugin
|
|
192
185
|
});
|
package/dist/esm/cli/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
|
3
3
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
4
4
|
import path from "path";
|
|
5
5
|
import { isReact18 as checkIsReact18, cleanRequireCache, createRuntimeExportsUtils } from "@modern-js/utils";
|
|
6
|
-
import { rspack } from "@rsbuild/core";
|
|
7
6
|
import { statePlugin } from "../state/cli";
|
|
8
7
|
import { routerPlugin } from "../router/cli";
|
|
9
8
|
import { documentPlugin } from "../document/cli";
|
|
@@ -138,7 +137,7 @@ var runtimePlugin = function(params) {
|
|
|
138
137
|
}
|
|
139
138
|
},
|
|
140
139
|
rspack: function(_config, param) {
|
|
141
|
-
var appendPlugins = param.appendPlugins;
|
|
140
|
+
var appendPlugins = param.appendPlugins, rspack = param.rspack;
|
|
142
141
|
if (!isReact18) {
|
|
143
142
|
appendPlugins([
|
|
144
143
|
new rspack.IgnorePlugin({
|
|
@@ -38,6 +38,36 @@ var checkUseStringSSR = function(config) {
|
|
|
38
38
|
var output = config.output;
|
|
39
39
|
return Boolean(output === null || output === void 0 ? void 0 : output.ssg) || hasStringSSREntry(config);
|
|
40
40
|
};
|
|
41
|
+
var ssrBuilderPlugin = function(modernAPI) {
|
|
42
|
+
return {
|
|
43
|
+
name: "@modern-js/builder-plugin-ssr",
|
|
44
|
+
setup: function setup(api) {
|
|
45
|
+
api.modifyEnvironmentConfig(function(config, param) {
|
|
46
|
+
var name = param.name, mergeEnvironmentConfig = param.mergeEnvironmentConfig;
|
|
47
|
+
var isServerEnvironment = config.output.target === "node" || name === "serviceWorker";
|
|
48
|
+
var userConfig = modernAPI.useResolvedConfigContext();
|
|
49
|
+
var useLoadablePlugin = isUseSSRBundle(userConfig) && !isServerEnvironment && checkUseStringSSR(userConfig);
|
|
50
|
+
return mergeEnvironmentConfig(config, {
|
|
51
|
+
source: {
|
|
52
|
+
define: {
|
|
53
|
+
"process.env.MODERN_TARGET": isServerEnvironment ? JSON.stringify("node") : JSON.stringify("browser")
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
tools: {
|
|
57
|
+
bundlerChain: useLoadablePlugin ? function(chain) {
|
|
58
|
+
var LoadableBundlerPlugin = require("./loadable-bundler-plugin.js");
|
|
59
|
+
chain.plugin("loadable").use(LoadableBundlerPlugin, [
|
|
60
|
+
{
|
|
61
|
+
filename: LOADABLE_STATS_FILE
|
|
62
|
+
}
|
|
63
|
+
]);
|
|
64
|
+
} : void 0
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
};
|
|
41
71
|
var ssrPlugin = function() {
|
|
42
72
|
return {
|
|
43
73
|
name: "@modern-js/plugin-ssr",
|
|
@@ -72,29 +102,16 @@ var ssrPlugin = function() {
|
|
|
72
102
|
}
|
|
73
103
|
}();
|
|
74
104
|
return {
|
|
105
|
+
builderPlugins: [
|
|
106
|
+
ssrBuilderPlugin(api)
|
|
107
|
+
],
|
|
75
108
|
source: {
|
|
76
109
|
alias: {
|
|
77
110
|
// ensure that all packages use the same storage in @modern-js/runtime-utils/node
|
|
78
111
|
"@modern-js/runtime-utils/node$": require.resolve("@modern-js/runtime-utils/node")
|
|
79
|
-
},
|
|
80
|
-
globalVars: function(values, param) {
|
|
81
|
-
var target = param.target;
|
|
82
|
-
values["process.env.MODERN_TARGET"] = target === "node" || target === "service-worker" ? "node" : "browser";
|
|
83
112
|
}
|
|
84
113
|
},
|
|
85
114
|
tools: {
|
|
86
|
-
bundlerChain: function bundlerChain(chain, param) {
|
|
87
|
-
var isServer = param.isServer, isServiceWorker = param.isServiceWorker;
|
|
88
|
-
var userConfig = api.useResolvedConfigContext();
|
|
89
|
-
if (isUseSSRBundle(userConfig) && !isServer && !isServiceWorker && checkUseStringSSR(userConfig)) {
|
|
90
|
-
var LoadableBundlerPlugin = require("./loadable-bundler-plugin.js");
|
|
91
|
-
chain.plugin("loadable").use(LoadableBundlerPlugin, [
|
|
92
|
-
{
|
|
93
|
-
filename: LOADABLE_STATS_FILE
|
|
94
|
-
}
|
|
95
|
-
]);
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
115
|
babel: babelHandler
|
|
99
116
|
}
|
|
100
117
|
};
|
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
2
|
import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
|
|
3
3
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
4
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
4
5
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
5
6
|
import React from "react";
|
|
7
|
+
import cookieTool from "cookie";
|
|
6
8
|
import { getGlobalAppInit } from "../context";
|
|
7
9
|
import { getInitialContext } from "../context/runtime";
|
|
8
10
|
import { createLoaderManager } from "../loader/loaderManager";
|
|
9
11
|
import { getGlobalRunner } from "../plugin/runner";
|
|
10
12
|
import { hydrateRoot } from "./hydrate";
|
|
11
13
|
var IS_REACT18 = process.env.IS_REACT18 === "true";
|
|
14
|
+
function getSSRData() {
|
|
15
|
+
var ssrData = window._SSR_DATA;
|
|
16
|
+
if (ssrData) {
|
|
17
|
+
var finalSSRData = _object_spread_props(_object_spread({}, ssrData), {
|
|
18
|
+
context: _object_spread_props(_object_spread({}, ssrData.context), {
|
|
19
|
+
request: _object_spread_props(_object_spread({}, ssrData.context.request), {
|
|
20
|
+
cookieMap: cookieTool.parse(document.cookie || "") || {},
|
|
21
|
+
cookie: document.cookie || "",
|
|
22
|
+
userAgent: navigator.userAgent,
|
|
23
|
+
referer: document.referrer
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
return finalSSRData;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
12
30
|
function isClientArgs(id) {
|
|
13
31
|
return typeof id === "undefined" || typeof id === "string" || typeof HTMLElement !== "undefined" && _instanceof(id, HTMLElement);
|
|
14
32
|
}
|
|
@@ -73,7 +91,7 @@ function _render() {
|
|
|
73
91
|
ModernHydrate = function ModernHydrate2(App2, callback) {
|
|
74
92
|
return _ModernHydrate.apply(this, arguments);
|
|
75
93
|
};
|
|
76
|
-
ssrData =
|
|
94
|
+
ssrData = getSSRData();
|
|
77
95
|
loadersData = (ssrData === null || ssrData === void 0 ? void 0 : (_ssrData_data = ssrData.data) === null || _ssrData_data === void 0 ? void 0 : _ssrData_data.loadersData) || {};
|
|
78
96
|
initialLoadersState = Object.keys(loadersData).reduce(function(res, key) {
|
|
79
97
|
var loaderData = loadersData[key];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
2
|
-
import { merge } from "
|
|
2
|
+
import { merge } from "../utils/merge";
|
|
3
3
|
import { runtime } from "./base";
|
|
4
4
|
import { setGlobalRunner } from "./runner";
|
|
5
5
|
export * from "./base";
|
|
@@ -25,7 +25,7 @@ var renderString = function() {
|
|
|
25
25
|
return [
|
|
26
26
|
2,
|
|
27
27
|
run(headersData, /* @__PURE__ */ _async_to_generator(function() {
|
|
28
|
-
var _runtimeContext_ssrContext, resource, runtimeContext, config, onError, onTiming, staticGenerate, tracer, routerContext, htmlTemplate, entryName, loadableStats, routeManifest, chunkSet, prefetchData, e,
|
|
28
|
+
var _runtimeContext_ssrContext, resource, runtimeContext, config, onError, onTiming, staticGenerate, tracer, routerContext, htmlTemplate, entryName, loadableStats, routeManifest, ssrConfig, chunkSet, prefetchData, e, collectors, rootElement, html;
|
|
29
29
|
return _ts_generator(this, function(_state2) {
|
|
30
30
|
switch (_state2.label) {
|
|
31
31
|
case 0:
|
|
@@ -36,6 +36,7 @@ var renderString = function() {
|
|
|
36
36
|
};
|
|
37
37
|
routerContext = runtimeContext.routerContext;
|
|
38
38
|
htmlTemplate = resource.htmlTemplate, entryName = resource.entryName, loadableStats = resource.loadableStats, routeManifest = resource.routeManifest;
|
|
39
|
+
ssrConfig = getSSRConfigByEntry(entryName, config.ssr, config.ssrByEntries, staticGenerate);
|
|
39
40
|
chunkSet = {
|
|
40
41
|
renderLevel: RenderLevel.CLIENT_RENDER,
|
|
41
42
|
ssrScripts: "",
|
|
@@ -53,7 +54,7 @@ var renderString = function() {
|
|
|
53
54
|
]);
|
|
54
55
|
return [
|
|
55
56
|
4,
|
|
56
|
-
prefetch(serverRoot, request, options, tracer)
|
|
57
|
+
prefetch(serverRoot, request, options, ssrConfig, tracer)
|
|
57
58
|
];
|
|
58
59
|
case 2:
|
|
59
60
|
prefetchData = _state2.sent();
|
|
@@ -70,7 +71,6 @@ var renderString = function() {
|
|
|
70
71
|
4
|
|
71
72
|
];
|
|
72
73
|
case 4:
|
|
73
|
-
ssrConfig = getSSRConfigByEntry(entryName, config.ssr, config.ssrByEntries, staticGenerate);
|
|
74
74
|
collectors = [
|
|
75
75
|
new StyledCollector(chunkSet),
|
|
76
76
|
new LoadableCollector({
|
|
@@ -8,12 +8,12 @@ import { parseHeaders } from "@modern-js/runtime-utils/universal/request";
|
|
|
8
8
|
import React from "react";
|
|
9
9
|
import { SSRErrors, SSRTimings } from "../tracer";
|
|
10
10
|
var prefetch = function() {
|
|
11
|
-
var _ref = _async_to_generator(function(App, request, options, param) {
|
|
12
|
-
var onError, onTiming, headersData, context, resource,
|
|
11
|
+
var _ref = _async_to_generator(function(App, request, options, ssrConfig, param) {
|
|
12
|
+
var onError, onTiming, headersData, context, resource, entryName, loadableStats;
|
|
13
13
|
return _ts_generator(this, function(_state) {
|
|
14
14
|
onError = param.onError, onTiming = param.onTiming;
|
|
15
15
|
headersData = parseHeaders(request);
|
|
16
|
-
context = options.runtimeContext, resource = options.resource
|
|
16
|
+
context = options.runtimeContext, resource = options.resource;
|
|
17
17
|
entryName = resource.entryName, loadableStats = resource.loadableStats;
|
|
18
18
|
return [
|
|
19
19
|
2,
|
|
@@ -22,7 +22,7 @@ var prefetch = function() {
|
|
|
22
22
|
return _ts_generator(this, function(_state2) {
|
|
23
23
|
switch (_state2.label) {
|
|
24
24
|
case 0:
|
|
25
|
-
if (!
|
|
25
|
+
if (typeof ssrConfig === "boolean" || !ssrConfig.disablePrerender) {
|
|
26
26
|
try {
|
|
27
27
|
end = time();
|
|
28
28
|
if (loadableStats) {
|
|
@@ -111,7 +111,7 @@ var prefetch = function() {
|
|
|
111
111
|
];
|
|
112
112
|
});
|
|
113
113
|
});
|
|
114
|
-
return function prefetch2(App, request, options, _) {
|
|
114
|
+
return function prefetch2(App, request, options, ssrConfig, _) {
|
|
115
115
|
return _ref.apply(this, arguments);
|
|
116
116
|
};
|
|
117
117
|
}();
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
2
|
+
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
3
|
+
function isObject(obj) {
|
|
4
|
+
return obj && typeof obj === "object" && !Array.isArray(obj);
|
|
5
|
+
}
|
|
6
|
+
function merge(target) {
|
|
7
|
+
for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
8
|
+
sources[_key - 1] = arguments[_key];
|
|
9
|
+
}
|
|
10
|
+
if (!sources.length) {
|
|
11
|
+
return target;
|
|
12
|
+
}
|
|
13
|
+
var source = sources.shift();
|
|
14
|
+
if (isObject(target) && isObject(source)) {
|
|
15
|
+
for (var key in source) {
|
|
16
|
+
if (isObject(source[key])) {
|
|
17
|
+
if (!target[key]) {
|
|
18
|
+
Object.assign(target, _define_property({}, key, {}));
|
|
19
|
+
}
|
|
20
|
+
merge(target[key], source[key]);
|
|
21
|
+
} else {
|
|
22
|
+
Object.assign(target, _define_property({}, key, source[key]));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return merge.apply(void 0, [
|
|
27
|
+
target
|
|
28
|
+
].concat(_to_consumable_array(sources)));
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
merge
|
|
32
|
+
};
|
|
@@ -16,18 +16,18 @@ var generateCode = function() {
|
|
|
16
16
|
}
|
|
17
17
|
function _generateEntryCode() {
|
|
18
18
|
_generateEntryCode = _async_to_generator(function(entrypoint) {
|
|
19
|
-
var entryName, isMainEntry, isAutoMount,
|
|
19
|
+
var entryName, isMainEntry, isAutoMount, pageRoutesEntry, nestedRoutesEntry, metaName, _config_output, initialRoutes, nestedRoutes, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, route, routes, _$config, ssr, useSSG, mode, hasPageRoute, code, _, _tmp, routesServerFile, code1, serverLoaderCombined, serverLoaderFile;
|
|
20
20
|
return _ts_generator(this, function(_state) {
|
|
21
21
|
switch (_state.label) {
|
|
22
22
|
case 0:
|
|
23
|
-
entryName = entrypoint.entryName, isMainEntry = entrypoint.isMainEntry, isAutoMount = entrypoint.isAutoMount,
|
|
23
|
+
entryName = entrypoint.entryName, isMainEntry = entrypoint.isMainEntry, isAutoMount = entrypoint.isAutoMount, pageRoutesEntry = entrypoint.pageRoutesEntry, nestedRoutesEntry = entrypoint.nestedRoutesEntry;
|
|
24
24
|
metaName = api.useAppContext().metaName;
|
|
25
25
|
if (!isAutoMount)
|
|
26
26
|
return [
|
|
27
27
|
3,
|
|
28
28
|
11
|
|
29
29
|
];
|
|
30
|
-
if (!
|
|
30
|
+
if (!(pageRoutesEntry || nestedRoutesEntry))
|
|
31
31
|
return [
|
|
32
32
|
3,
|
|
33
33
|
11
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
1
3
|
import path from "path";
|
|
2
4
|
import { JS_EXTENSIONS, findExists, fs, isRouterV5 } from "@modern-js/utils";
|
|
3
5
|
import { hasApp } from "../../cli/entry";
|
|
@@ -23,31 +25,31 @@ var modifyEntrypoints = function(entrypoints) {
|
|
|
23
25
|
if (!entrypoint.isAutoMount) {
|
|
24
26
|
return entrypoint;
|
|
25
27
|
}
|
|
28
|
+
if (entrypoint === null || entrypoint === void 0 ? void 0 : entrypoint.isCustomSourceEntry) {
|
|
29
|
+
if (entrypoint.fileSystemRoutes) {
|
|
30
|
+
if (isRouterV5(config)) {
|
|
31
|
+
throw Error("Custom entries with conventional routing not support use react router v5!");
|
|
32
|
+
}
|
|
33
|
+
entrypoint.nestedRoutesEntry = entrypoint.entry;
|
|
34
|
+
}
|
|
35
|
+
return entrypoint;
|
|
36
|
+
}
|
|
26
37
|
var isHasApp = hasApp(entrypoint.absoluteEntryDir);
|
|
27
38
|
if (isHasApp) {
|
|
28
39
|
return entrypoint;
|
|
29
40
|
}
|
|
30
|
-
var isHasNestedRoutes = hasNestedRoutes(entrypoint.absoluteEntryDir);
|
|
31
41
|
var isHasPages = hasPages(entrypoint.absoluteEntryDir);
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (entrypoint.fileSystemRoutes && !isRouterV5(config)) {
|
|
36
|
-
entrypoint.nestedRoutesEntry = entrypoint.entry;
|
|
37
|
-
} else if (!entrypoint.fileSystemRoutes) {
|
|
38
|
-
entrypoint.fileSystemRoutes = {
|
|
42
|
+
if (isHasPages) {
|
|
43
|
+
entrypoint.pageRoutesEntry = path.join(entrypoint.absoluteEntryDir, PAGES_DIR_NAME);
|
|
44
|
+
entrypoint.fileSystemRoutes = _object_spread_props(_object_spread({}, entrypoint.fileSystemRoutes), {
|
|
39
45
|
globalApp: findExists(JS_EXTENSIONS.map(function(ext) {
|
|
40
46
|
return path.resolve(entrypoint.absoluteEntryDir, "./".concat(PAGES_DIR_NAME, "/").concat(FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT).concat(ext));
|
|
41
47
|
}))
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
entrypoint.nestedRoutesEntry = path.join(entrypoint.absoluteEntryDir, NESTED_ROUTES_DIR);
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
throw Error("Custom entries with conventional routing not support use react router v5!");
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
var isHasNestedRoutes = hasNestedRoutes(entrypoint.absoluteEntryDir);
|
|
51
|
+
if (isHasNestedRoutes) {
|
|
52
|
+
entrypoint.nestedRoutesEntry = path.join(entrypoint.absoluteEntryDir, NESTED_ROUTES_DIR);
|
|
51
53
|
}
|
|
52
54
|
return entrypoint;
|
|
53
55
|
});
|
|
@@ -98,7 +98,7 @@ function _loadRouteModule() {
|
|
|
98
98
|
return [
|
|
99
99
|
4,
|
|
100
100
|
Promise.all(chunkIds.map(function(chunkId) {
|
|
101
|
-
return __webpack_chunk_load__ === null || __webpack_chunk_load__ === void 0 ? void 0 : __webpack_chunk_load__(
|
|
101
|
+
return __webpack_chunk_load__ === null || __webpack_chunk_load__ === void 0 ? void 0 : __webpack_chunk_load__(chunkId);
|
|
102
102
|
}))
|
|
103
103
|
];
|
|
104
104
|
case 2:
|
|
@@ -2,7 +2,6 @@ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
|
2
2
|
import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
|
|
3
3
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
4
4
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
5
|
-
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
6
5
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
7
6
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
8
7
|
import { useContext } from "react";
|
|
@@ -18,54 +17,15 @@ import { getGlobalLayoutApp, getGlobalRoutes } from "../../core/context";
|
|
|
18
17
|
import { renderRoutes, urlJoin } from "./utils";
|
|
19
18
|
import { modifyRoutes as modifyRoutesHook } from "./hooks";
|
|
20
19
|
import DeferredDataScripts from "./DeferredDataScripts.node";
|
|
21
|
-
function
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
try {
|
|
31
|
-
for (var _iterator1 = values[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
|
|
32
|
-
var value = _step1.value;
|
|
33
|
-
headers.append(key, value);
|
|
34
|
-
}
|
|
35
|
-
} catch (err) {
|
|
36
|
-
_didIteratorError1 = true;
|
|
37
|
-
_iteratorError1 = err;
|
|
38
|
-
} finally {
|
|
39
|
-
try {
|
|
40
|
-
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
41
|
-
_iterator1.return();
|
|
42
|
-
}
|
|
43
|
-
} finally {
|
|
44
|
-
if (_didIteratorError1) {
|
|
45
|
-
throw _iteratorError1;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
headers.set(key, values);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
} catch (err) {
|
|
55
|
-
_didIteratorError = true;
|
|
56
|
-
_iteratorError = err;
|
|
57
|
-
} finally {
|
|
58
|
-
try {
|
|
59
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
60
|
-
_iterator.return();
|
|
61
|
-
}
|
|
62
|
-
} finally {
|
|
63
|
-
if (_didIteratorError) {
|
|
64
|
-
throw _iteratorError;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return headers;
|
|
20
|
+
function createRemixReuqest(request) {
|
|
21
|
+
var method = "GET";
|
|
22
|
+
var headers = request.headers;
|
|
23
|
+
var controller = new AbortController();
|
|
24
|
+
return new Request(request.url, {
|
|
25
|
+
method,
|
|
26
|
+
headers,
|
|
27
|
+
signal: controller.signal
|
|
28
|
+
});
|
|
69
29
|
}
|
|
70
30
|
var routerPlugin = function(param) {
|
|
71
31
|
var _param_basename = param.basename, basename = _param_basename === void 0 ? "" : _param_basename, routesConfig = param.routesConfig, createRoutes = param.createRoutes;
|
|
@@ -114,7 +74,7 @@ var routerPlugin = function(param) {
|
|
|
114
74
|
query = createStaticHandler(routes, {
|
|
115
75
|
basename: _basename
|
|
116
76
|
}).query;
|
|
117
|
-
remixRequest = context.ssrContext.request.raw;
|
|
77
|
+
remixRequest = createRemixReuqest(context.ssrContext.request.raw);
|
|
118
78
|
end = time();
|
|
119
79
|
return [
|
|
120
80
|
4,
|
|
@@ -213,7 +173,6 @@ var routerPlugin = function(param) {
|
|
|
213
173
|
var modifyRoutes = function() {
|
|
214
174
|
};
|
|
215
175
|
export {
|
|
216
|
-
createFetchHeaders,
|
|
217
176
|
modifyRoutes,
|
|
218
177
|
routerPlugin
|
|
219
178
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { isReact18 as checkIsReact18, cleanRequireCache, createRuntimeExportsUtils } from "@modern-js/utils";
|
|
3
|
-
import { rspack } from "@rsbuild/core";
|
|
4
3
|
import { statePlugin } from "../state/cli";
|
|
5
4
|
import { routerPlugin } from "../router/cli";
|
|
6
5
|
import { documentPlugin } from "../document/cli";
|
|
@@ -112,7 +111,7 @@ const runtimePlugin = (params) => ({
|
|
|
112
111
|
]);
|
|
113
112
|
}
|
|
114
113
|
},
|
|
115
|
-
rspack: (_config, { appendPlugins }) => {
|
|
114
|
+
rspack: (_config, { appendPlugins, rspack }) => {
|
|
116
115
|
if (!isReact18) {
|
|
117
116
|
appendPlugins([
|
|
118
117
|
new rspack.IgnorePlugin({
|
|
@@ -19,6 +19,33 @@ const checkUseStringSSR = (config) => {
|
|
|
19
19
|
const { output } = config;
|
|
20
20
|
return Boolean(output === null || output === void 0 ? void 0 : output.ssg) || hasStringSSREntry(config);
|
|
21
21
|
};
|
|
22
|
+
const ssrBuilderPlugin = (modernAPI) => ({
|
|
23
|
+
name: "@modern-js/builder-plugin-ssr",
|
|
24
|
+
setup(api) {
|
|
25
|
+
api.modifyEnvironmentConfig((config, { name, mergeEnvironmentConfig }) => {
|
|
26
|
+
const isServerEnvironment = config.output.target === "node" || name === "serviceWorker";
|
|
27
|
+
const userConfig = modernAPI.useResolvedConfigContext();
|
|
28
|
+
const useLoadablePlugin = isUseSSRBundle(userConfig) && !isServerEnvironment && checkUseStringSSR(userConfig);
|
|
29
|
+
return mergeEnvironmentConfig(config, {
|
|
30
|
+
source: {
|
|
31
|
+
define: {
|
|
32
|
+
"process.env.MODERN_TARGET": isServerEnvironment ? JSON.stringify("node") : JSON.stringify("browser")
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
tools: {
|
|
36
|
+
bundlerChain: useLoadablePlugin ? (chain) => {
|
|
37
|
+
const LoadableBundlerPlugin = require("./loadable-bundler-plugin.js");
|
|
38
|
+
chain.plugin("loadable").use(LoadableBundlerPlugin, [
|
|
39
|
+
{
|
|
40
|
+
filename: LOADABLE_STATS_FILE
|
|
41
|
+
}
|
|
42
|
+
]);
|
|
43
|
+
} : void 0
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
22
49
|
const ssrPlugin = () => ({
|
|
23
50
|
name: "@modern-js/plugin-ssr",
|
|
24
51
|
required: [
|
|
@@ -52,27 +79,16 @@ const ssrPlugin = () => ({
|
|
|
52
79
|
}
|
|
53
80
|
})();
|
|
54
81
|
return {
|
|
82
|
+
builderPlugins: [
|
|
83
|
+
ssrBuilderPlugin(api)
|
|
84
|
+
],
|
|
55
85
|
source: {
|
|
56
86
|
alias: {
|
|
57
87
|
// ensure that all packages use the same storage in @modern-js/runtime-utils/node
|
|
58
88
|
"@modern-js/runtime-utils/node$": require.resolve("@modern-js/runtime-utils/node")
|
|
59
|
-
},
|
|
60
|
-
globalVars: (values, { target }) => {
|
|
61
|
-
values["process.env.MODERN_TARGET"] = target === "node" || target === "service-worker" ? "node" : "browser";
|
|
62
89
|
}
|
|
63
90
|
},
|
|
64
91
|
tools: {
|
|
65
|
-
bundlerChain(chain, { isServer, isServiceWorker }) {
|
|
66
|
-
const userConfig = api.useResolvedConfigContext();
|
|
67
|
-
if (isUseSSRBundle(userConfig) && !isServer && !isServiceWorker && checkUseStringSSR(userConfig)) {
|
|
68
|
-
const LoadableBundlerPlugin = require("./loadable-bundler-plugin.js");
|
|
69
|
-
chain.plugin("loadable").use(LoadableBundlerPlugin, [
|
|
70
|
-
{
|
|
71
|
-
filename: LOADABLE_STATS_FILE
|
|
72
|
-
}
|
|
73
|
-
]);
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
92
|
babel: babelHandler
|
|
77
93
|
}
|
|
78
94
|
};
|
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import cookieTool from "cookie";
|
|
2
3
|
import { getGlobalAppInit } from "../context";
|
|
3
4
|
import { getInitialContext } from "../context/runtime";
|
|
4
5
|
import { createLoaderManager } from "../loader/loaderManager";
|
|
5
6
|
import { getGlobalRunner } from "../plugin/runner";
|
|
6
7
|
import { hydrateRoot } from "./hydrate";
|
|
7
8
|
const IS_REACT18 = process.env.IS_REACT18 === "true";
|
|
9
|
+
function getSSRData() {
|
|
10
|
+
const ssrData = window._SSR_DATA;
|
|
11
|
+
if (ssrData) {
|
|
12
|
+
const finalSSRData = {
|
|
13
|
+
...ssrData,
|
|
14
|
+
context: {
|
|
15
|
+
...ssrData.context,
|
|
16
|
+
request: {
|
|
17
|
+
...ssrData.context.request,
|
|
18
|
+
cookieMap: cookieTool.parse(document.cookie || "") || {},
|
|
19
|
+
cookie: document.cookie || "",
|
|
20
|
+
userAgent: navigator.userAgent,
|
|
21
|
+
referer: document.referrer
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
return finalSSRData;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
8
28
|
function isClientArgs(id) {
|
|
9
29
|
return typeof id === "undefined" || typeof id === "string" || typeof HTMLElement !== "undefined" && id instanceof HTMLElement;
|
|
10
30
|
}
|
|
@@ -21,7 +41,7 @@ async function render(App, id) {
|
|
|
21
41
|
});
|
|
22
42
|
if (isClientArgs(id)) {
|
|
23
43
|
var _ssrData_data, _ssrData_data1;
|
|
24
|
-
const ssrData =
|
|
44
|
+
const ssrData = getSSRData();
|
|
25
45
|
const loadersData = (ssrData === null || ssrData === void 0 ? void 0 : (_ssrData_data = ssrData.data) === null || _ssrData_data === void 0 ? void 0 : _ssrData_data.loadersData) || {};
|
|
26
46
|
const initialLoadersState = Object.keys(loadersData).reduce((res, key) => {
|
|
27
47
|
const loaderData = loadersData[key];
|
|
@@ -25,6 +25,7 @@ const renderString = async (request, serverRoot, options) => {
|
|
|
25
25
|
};
|
|
26
26
|
const routerContext = runtimeContext.routerContext;
|
|
27
27
|
const { htmlTemplate, entryName, loadableStats, routeManifest } = resource;
|
|
28
|
+
const ssrConfig = getSSRConfigByEntry(entryName, config.ssr, config.ssrByEntries, staticGenerate);
|
|
28
29
|
const chunkSet = {
|
|
29
30
|
renderLevel: RenderLevel.CLIENT_RENDER,
|
|
30
31
|
ssrScripts: "",
|
|
@@ -33,12 +34,11 @@ const renderString = async (request, serverRoot, options) => {
|
|
|
33
34
|
};
|
|
34
35
|
let prefetchData = {};
|
|
35
36
|
try {
|
|
36
|
-
prefetchData = await prefetch(serverRoot, request, options, tracer);
|
|
37
|
+
prefetchData = await prefetch(serverRoot, request, options, ssrConfig, tracer);
|
|
37
38
|
chunkSet.renderLevel = RenderLevel.SERVER_PREFETCH;
|
|
38
39
|
} catch (e) {
|
|
39
40
|
chunkSet.renderLevel = RenderLevel.CLIENT_RENDER;
|
|
40
41
|
}
|
|
41
|
-
const ssrConfig = getSSRConfigByEntry(entryName, config.ssr, config.ssrByEntries, staticGenerate);
|
|
42
42
|
const collectors = [
|
|
43
43
|
new StyledCollector(chunkSet),
|
|
44
44
|
new LoadableCollector({
|
|
@@ -5,13 +5,13 @@ import { time } from "@modern-js/runtime-utils/time";
|
|
|
5
5
|
import { parseHeaders } from "@modern-js/runtime-utils/universal/request";
|
|
6
6
|
import React from "react";
|
|
7
7
|
import { SSRErrors, SSRTimings } from "../tracer";
|
|
8
|
-
const prefetch = async (App, request, options, { onError, onTiming }) => {
|
|
8
|
+
const prefetch = async (App, request, options, ssrConfig, { onError, onTiming }) => {
|
|
9
9
|
const headersData = parseHeaders(request);
|
|
10
|
-
const { runtimeContext: context, resource
|
|
10
|
+
const { runtimeContext: context, resource } = options;
|
|
11
11
|
const { entryName, loadableStats } = resource;
|
|
12
12
|
return run(headersData, async () => {
|
|
13
13
|
var _context_store;
|
|
14
|
-
if (!
|
|
14
|
+
if (typeof ssrConfig === "boolean" || !ssrConfig.disablePrerender) {
|
|
15
15
|
try {
|
|
16
16
|
const end = time();
|
|
17
17
|
if (loadableStats) {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function isObject(obj) {
|
|
2
|
+
return obj && typeof obj === "object" && !Array.isArray(obj);
|
|
3
|
+
}
|
|
4
|
+
function merge(target, ...sources) {
|
|
5
|
+
if (!sources.length) {
|
|
6
|
+
return target;
|
|
7
|
+
}
|
|
8
|
+
const source = sources.shift();
|
|
9
|
+
if (isObject(target) && isObject(source)) {
|
|
10
|
+
for (const key in source) {
|
|
11
|
+
if (isObject(source[key])) {
|
|
12
|
+
if (!target[key]) {
|
|
13
|
+
Object.assign(target, {
|
|
14
|
+
[key]: {}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
merge(target[key], source[key]);
|
|
18
|
+
} else {
|
|
19
|
+
Object.assign(target, {
|
|
20
|
+
[key]: source[key]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return merge(target, ...sources);
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
merge
|
|
29
|
+
};
|
|
@@ -14,10 +14,10 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
|
14
14
|
const oldVersion = typeof (config === null || config === void 0 ? void 0 : config.runtime.router) === "object" ? Boolean((config === null || config === void 0 ? void 0 : config.runtime.router).oldVersion) : false;
|
|
15
15
|
await Promise.all(entrypoints.map(generateEntryCode));
|
|
16
16
|
async function generateEntryCode(entrypoint) {
|
|
17
|
-
const { entryName, isMainEntry, isAutoMount,
|
|
17
|
+
const { entryName, isMainEntry, isAutoMount, pageRoutesEntry, nestedRoutesEntry } = entrypoint;
|
|
18
18
|
const { metaName } = api.useAppContext();
|
|
19
19
|
if (isAutoMount) {
|
|
20
|
-
if (
|
|
20
|
+
if (pageRoutesEntry || nestedRoutesEntry) {
|
|
21
21
|
var _config_output;
|
|
22
22
|
let initialRoutes = [];
|
|
23
23
|
let nestedRoutes = null;
|
|
@@ -18,29 +18,30 @@ const modifyEntrypoints = (entrypoints, config = {}) => {
|
|
|
18
18
|
if (!entrypoint.isAutoMount) {
|
|
19
19
|
return entrypoint;
|
|
20
20
|
}
|
|
21
|
+
if (entrypoint === null || entrypoint === void 0 ? void 0 : entrypoint.isCustomSourceEntry) {
|
|
22
|
+
if (entrypoint.fileSystemRoutes) {
|
|
23
|
+
if (isRouterV5(config)) {
|
|
24
|
+
throw Error("Custom entries with conventional routing not support use react router v5!");
|
|
25
|
+
}
|
|
26
|
+
entrypoint.nestedRoutesEntry = entrypoint.entry;
|
|
27
|
+
}
|
|
28
|
+
return entrypoint;
|
|
29
|
+
}
|
|
21
30
|
const isHasApp = hasApp(entrypoint.absoluteEntryDir);
|
|
22
31
|
if (isHasApp) {
|
|
23
32
|
return entrypoint;
|
|
24
33
|
}
|
|
25
|
-
const isHasNestedRoutes = hasNestedRoutes(entrypoint.absoluteEntryDir);
|
|
26
34
|
const isHasPages = hasPages(entrypoint.absoluteEntryDir);
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
if (entrypoint.fileSystemRoutes && !isRouterV5(config)) {
|
|
31
|
-
entrypoint.nestedRoutesEntry = entrypoint.entry;
|
|
32
|
-
} else if (!entrypoint.fileSystemRoutes) {
|
|
35
|
+
if (isHasPages) {
|
|
36
|
+
entrypoint.pageRoutesEntry = path.join(entrypoint.absoluteEntryDir, PAGES_DIR_NAME);
|
|
33
37
|
entrypoint.fileSystemRoutes = {
|
|
38
|
+
...entrypoint.fileSystemRoutes,
|
|
34
39
|
globalApp: findExists(JS_EXTENSIONS.map((ext) => path.resolve(entrypoint.absoluteEntryDir, `./${PAGES_DIR_NAME}/${FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT}${ext}`)))
|
|
35
40
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
entrypoint.nestedRoutesEntry = path.join(entrypoint.absoluteEntryDir, NESTED_ROUTES_DIR);
|
|
41
|
-
}
|
|
42
|
-
} else {
|
|
43
|
-
throw Error("Custom entries with conventional routing not support use react router v5!");
|
|
41
|
+
}
|
|
42
|
+
const isHasNestedRoutes = hasNestedRoutes(entrypoint.absoluteEntryDir);
|
|
43
|
+
if (isHasNestedRoutes) {
|
|
44
|
+
entrypoint.nestedRoutesEntry = path.join(entrypoint.absoluteEntryDir, NESTED_ROUTES_DIR);
|
|
44
45
|
}
|
|
45
46
|
return entrypoint;
|
|
46
47
|
});
|
|
@@ -70,7 +70,7 @@ async function loadRouteModule(route, routeAssets) {
|
|
|
70
70
|
}
|
|
71
71
|
try {
|
|
72
72
|
await Promise.all(chunkIds.map((chunkId) => {
|
|
73
|
-
return __webpack_chunk_load__ === null || __webpack_chunk_load__ === void 0 ? void 0 : __webpack_chunk_load__(
|
|
73
|
+
return __webpack_chunk_load__ === null || __webpack_chunk_load__ === void 0 ? void 0 : __webpack_chunk_load__(chunkId);
|
|
74
74
|
}));
|
|
75
75
|
} catch (error) {
|
|
76
76
|
console.error(error);
|
|
@@ -12,20 +12,15 @@ import { getGlobalLayoutApp, getGlobalRoutes } from "../../core/context";
|
|
|
12
12
|
import { renderRoutes, urlJoin } from "./utils";
|
|
13
13
|
import { modifyRoutes as modifyRoutesHook } from "./hooks";
|
|
14
14
|
import DeferredDataScripts from "./DeferredDataScripts.node";
|
|
15
|
-
function
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
headers.set(key, values);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return headers;
|
|
15
|
+
function createRemixReuqest(request) {
|
|
16
|
+
const method = "GET";
|
|
17
|
+
const { headers } = request;
|
|
18
|
+
const controller = new AbortController();
|
|
19
|
+
return new Request(request.url, {
|
|
20
|
+
method,
|
|
21
|
+
headers,
|
|
22
|
+
signal: controller.signal
|
|
23
|
+
});
|
|
29
24
|
}
|
|
30
25
|
const routerPlugin = ({ basename = "", routesConfig, createRoutes }) => {
|
|
31
26
|
return {
|
|
@@ -66,7 +61,7 @@ const routerPlugin = ({ basename = "", routesConfig, createRoutes }) => {
|
|
|
66
61
|
const { query } = createStaticHandler(routes, {
|
|
67
62
|
basename: _basename
|
|
68
63
|
});
|
|
69
|
-
const remixRequest = context.ssrContext.request.raw;
|
|
64
|
+
const remixRequest = createRemixReuqest(context.ssrContext.request.raw);
|
|
70
65
|
const end = time();
|
|
71
66
|
const routerContext = await query(remixRequest, {
|
|
72
67
|
requestContext
|
|
@@ -150,7 +145,6 @@ const routerPlugin = ({ basename = "", routesConfig, createRoutes }) => {
|
|
|
150
145
|
const modifyRoutes = () => {
|
|
151
146
|
};
|
|
152
147
|
export {
|
|
153
|
-
createFetchHeaders,
|
|
154
148
|
modifyRoutes,
|
|
155
149
|
routerPlugin
|
|
156
150
|
};
|
|
@@ -17,4 +17,4 @@ export declare function registerPlugin(internalPlugins: Plugin[], runtimeConfig?
|
|
|
17
17
|
pickedContext: import("../context/runtime").TRuntimeContext;
|
|
18
18
|
}, import("../context/runtime").TRuntimeContext>;
|
|
19
19
|
}>;
|
|
20
|
-
export declare function mergeConfig(config: Record<string, any>, ...otherConfig: Record<string, any>[]): any
|
|
20
|
+
export declare function mergeConfig(config: Record<string, any>, ...otherConfig: Record<string, any>[]): Record<string, any>;
|
|
@@ -2,7 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { LoaderResult } from '../../loader/loaderManager';
|
|
3
3
|
import { HandleRequestOptions } from '../requestHandler';
|
|
4
4
|
import { Tracer } from '../tracer';
|
|
5
|
-
|
|
5
|
+
import { SSRConfig } from '../shared';
|
|
6
|
+
export declare const prefetch: (App: React.ReactElement, request: Request, options: HandleRequestOptions, ssrConfig: SSRConfig, { onError, onTiming }: Tracer) => Promise<{
|
|
6
7
|
initialData: Record<string, unknown> | undefined;
|
|
7
8
|
i18nData: any;
|
|
8
9
|
loadersData?: undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type PlainObject = {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
};
|
|
4
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
5
|
+
export declare function merge<T extends PlainObject, U extends PlainObject[]>(target: T, ...sources: U): T & UnionToIntersection<U[number]>;
|
|
6
|
+
export {};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { Plugin } from '../../core';
|
|
2
|
-
import { SSRServerContext } from '../../core/types';
|
|
3
2
|
import type { RouterConfig } from './types';
|
|
4
|
-
export declare function createFetchHeaders(requestHeaders: SSRServerContext['request']['headers']): Headers;
|
|
5
3
|
export declare const routerPlugin: ({ basename, routesConfig, createRoutes, }: RouterConfig) => Plugin;
|
|
6
4
|
export declare const modifyRoutes: () => void;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.56.0",
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=14.17.6"
|
|
21
21
|
},
|
|
@@ -175,8 +175,8 @@
|
|
|
175
175
|
}
|
|
176
176
|
},
|
|
177
177
|
"dependencies": {
|
|
178
|
-
"@babel/core": "^7.
|
|
179
|
-
"@babel/types": "^7.
|
|
178
|
+
"@babel/core": "^7.24.7",
|
|
179
|
+
"@babel/types": "^7.24.7",
|
|
180
180
|
"cookie": "0.5.0",
|
|
181
181
|
"isbot": "3.7.1",
|
|
182
182
|
"@loadable/babel-plugin": "5.15.3",
|
|
@@ -200,18 +200,18 @@
|
|
|
200
200
|
"react-side-effect": "^2.1.1",
|
|
201
201
|
"styled-components": "^5.3.1",
|
|
202
202
|
"@swc/helpers": "0.5.3",
|
|
203
|
-
"@modern-js/
|
|
204
|
-
"@modern-js/
|
|
205
|
-
"@modern-js/utils": "2.
|
|
206
|
-
"@modern-js/runtime-utils": "2.
|
|
207
|
-
"@modern-js/plugin": "2.
|
|
203
|
+
"@modern-js/plugin": "2.56.0",
|
|
204
|
+
"@modern-js/types": "2.56.0",
|
|
205
|
+
"@modern-js/utils": "2.56.0",
|
|
206
|
+
"@modern-js/runtime-utils": "2.56.0",
|
|
207
|
+
"@modern-js/plugin-data-loader": "2.56.0"
|
|
208
208
|
},
|
|
209
209
|
"peerDependencies": {
|
|
210
210
|
"react": ">=17",
|
|
211
211
|
"react-dom": ">=17"
|
|
212
212
|
},
|
|
213
213
|
"devDependencies": {
|
|
214
|
-
"@rsbuild/core": "0.
|
|
214
|
+
"@rsbuild/core": "1.0.1-beta.3",
|
|
215
215
|
"@types/cookie": "0.5.1",
|
|
216
216
|
"@remix-run/web-fetch": "^4.1.3",
|
|
217
217
|
"@testing-library/react": "^13.4.0",
|
|
@@ -226,11 +226,11 @@
|
|
|
226
226
|
"react-dom": "^18",
|
|
227
227
|
"ts-jest": "^29.1.0",
|
|
228
228
|
"typescript": "^5",
|
|
229
|
-
"webpack": "^5.
|
|
230
|
-
"@modern-js/app-tools": "2.
|
|
231
|
-
"@modern-js/core": "2.
|
|
232
|
-
"@scripts/
|
|
233
|
-
"@scripts/
|
|
229
|
+
"webpack": "^5.93.0",
|
|
230
|
+
"@modern-js/app-tools": "2.56.0",
|
|
231
|
+
"@modern-js/core": "2.56.0",
|
|
232
|
+
"@scripts/build": "2.56.0",
|
|
233
|
+
"@scripts/jest-config": "2.56.0"
|
|
234
234
|
},
|
|
235
235
|
"sideEffects": false,
|
|
236
236
|
"publishConfig": {
|