@modern-js/runtime 3.2.2 → 3.3.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.
|
@@ -87,7 +87,11 @@ async function generateRoutesForEntry(entrypoint, appContext) {
|
|
|
87
87
|
const generateCode = async (appContext, config, entrypoints, api)=>{
|
|
88
88
|
const { internalDirectory, srcDirectory, internalSrcAlias, packageName } = appContext;
|
|
89
89
|
const hooks = api.getHooks();
|
|
90
|
+
const eagerRouteComponentFilesByEntry = new Map();
|
|
90
91
|
await Promise.all(entrypoints.map(generateEntryCode));
|
|
92
|
+
api.updateAppContext({
|
|
93
|
+
eagerRouteComponentFilesByEntry
|
|
94
|
+
});
|
|
91
95
|
async function generateEntryCode(entrypoint) {
|
|
92
96
|
const { entryName, isMainEntry, isAutoMount, pageRoutesEntry, nestedRoutesEntry } = entrypoint;
|
|
93
97
|
const { metaName } = api.getAppContext();
|
|
@@ -117,6 +121,8 @@ const generateCode = async (appContext, config, entrypoints, api)=>{
|
|
|
117
121
|
entrypoint,
|
|
118
122
|
routes: markedRoutes
|
|
119
123
|
});
|
|
124
|
+
const routeEagerFilesForEntry = (0, utils_namespaceObject.collectRouteComponentFiles)(routes, srcDirectory, internalSrcAlias);
|
|
125
|
+
eagerRouteComponentFilesByEntry.set(entryName, routeEagerFilesForEntry);
|
|
120
126
|
if ('stream' === ssrMode) {
|
|
121
127
|
const hasPageRoute = routes.some((route)=>'type' in route && 'page' === route.type);
|
|
122
128
|
if (hasPageRoute) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { filterRoutesForServer, filterRoutesLoader, fs, getEntryOptions, isUseRsc, isUseSSRBundle, logger, markRoutes } from "@modern-js/utils";
|
|
2
|
+
import { collectRouteComponentFiles, filterRoutesForServer, filterRoutesLoader, fs, getEntryOptions, isUseRsc, isUseSSRBundle, logger, markRoutes } from "@modern-js/utils";
|
|
3
3
|
import { cloneDeep } from "@modern-js/utils/lodash";
|
|
4
4
|
import { ENTRY_POINT_RUNTIME_GLOBAL_CONTEXT_FILE_NAME } from "../../../cli/constants.mjs";
|
|
5
5
|
import { resolveSSRMode } from "../../../cli/ssr/mode.mjs";
|
|
@@ -42,7 +42,11 @@ async function generateRoutesForEntry(entrypoint, appContext) {
|
|
|
42
42
|
const generateCode = async (appContext, config, entrypoints, api)=>{
|
|
43
43
|
const { internalDirectory, srcDirectory, internalSrcAlias, packageName } = appContext;
|
|
44
44
|
const hooks = api.getHooks();
|
|
45
|
+
const eagerRouteComponentFilesByEntry = new Map();
|
|
45
46
|
await Promise.all(entrypoints.map(generateEntryCode));
|
|
47
|
+
api.updateAppContext({
|
|
48
|
+
eagerRouteComponentFilesByEntry
|
|
49
|
+
});
|
|
46
50
|
async function generateEntryCode(entrypoint) {
|
|
47
51
|
const { entryName, isMainEntry, isAutoMount, pageRoutesEntry, nestedRoutesEntry } = entrypoint;
|
|
48
52
|
const { metaName } = api.getAppContext();
|
|
@@ -72,6 +76,8 @@ const generateCode = async (appContext, config, entrypoints, api)=>{
|
|
|
72
76
|
entrypoint,
|
|
73
77
|
routes: markedRoutes
|
|
74
78
|
});
|
|
79
|
+
const routeEagerFilesForEntry = collectRouteComponentFiles(routes, srcDirectory, internalSrcAlias);
|
|
80
|
+
eagerRouteComponentFilesByEntry.set(entryName, routeEagerFilesForEntry);
|
|
75
81
|
if ('stream' === ssrMode) {
|
|
76
82
|
const hasPageRoute = routes.some((route)=>'type' in route && 'page' === route.type);
|
|
77
83
|
if (hasPageRoute) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import { filterRoutesForServer, filterRoutesLoader, fs, getEntryOptions, isUseRsc, isUseSSRBundle, logger, markRoutes } from "@modern-js/utils";
|
|
3
|
+
import { collectRouteComponentFiles, filterRoutesForServer, filterRoutesLoader, fs, getEntryOptions, isUseRsc, isUseSSRBundle, logger, markRoutes } from "@modern-js/utils";
|
|
4
4
|
import { cloneDeep } from "@modern-js/utils/lodash";
|
|
5
5
|
import { ENTRY_POINT_RUNTIME_GLOBAL_CONTEXT_FILE_NAME } from "../../../cli/constants.mjs";
|
|
6
6
|
import { resolveSSRMode } from "../../../cli/ssr/mode.mjs";
|
|
@@ -43,7 +43,11 @@ async function generateRoutesForEntry(entrypoint, appContext) {
|
|
|
43
43
|
const generateCode = async (appContext, config, entrypoints, api)=>{
|
|
44
44
|
const { internalDirectory, srcDirectory, internalSrcAlias, packageName } = appContext;
|
|
45
45
|
const hooks = api.getHooks();
|
|
46
|
+
const eagerRouteComponentFilesByEntry = new Map();
|
|
46
47
|
await Promise.all(entrypoints.map(generateEntryCode));
|
|
48
|
+
api.updateAppContext({
|
|
49
|
+
eagerRouteComponentFilesByEntry
|
|
50
|
+
});
|
|
47
51
|
async function generateEntryCode(entrypoint) {
|
|
48
52
|
const { entryName, isMainEntry, isAutoMount, pageRoutesEntry, nestedRoutesEntry } = entrypoint;
|
|
49
53
|
const { metaName } = api.getAppContext();
|
|
@@ -73,6 +77,8 @@ const generateCode = async (appContext, config, entrypoints, api)=>{
|
|
|
73
77
|
entrypoint,
|
|
74
78
|
routes: markedRoutes
|
|
75
79
|
});
|
|
80
|
+
const routeEagerFilesForEntry = collectRouteComponentFiles(routes, srcDirectory, internalSrcAlias);
|
|
81
|
+
eagerRouteComponentFilesByEntry.set(entryName, routeEagerFilesForEntry);
|
|
76
82
|
if ('stream' === ssrMode) {
|
|
77
83
|
const hasPageRoute = routes.some((route)=>'type' in route && 'page' === route.type);
|
|
78
84
|
if (hasPageRoute) {
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.
|
|
18
|
+
"version": "3.3.0",
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=20"
|
|
21
21
|
},
|
|
@@ -203,9 +203,9 @@
|
|
|
203
203
|
"dependencies": {
|
|
204
204
|
"@loadable/component": "5.16.7",
|
|
205
205
|
"@loadable/server": "5.16.7",
|
|
206
|
-
"@swc/core": "1.15.
|
|
206
|
+
"@swc/core": "1.15.40",
|
|
207
207
|
"@swc/helpers": "^0.5.17",
|
|
208
|
-
"@swc/plugin-loadable-components": "^11.
|
|
208
|
+
"@swc/plugin-loadable-components": "^11.12.0",
|
|
209
209
|
"@types/loadable__component": "^5.13.10",
|
|
210
210
|
"@types/react-helmet": "^6.1.11",
|
|
211
211
|
"cookie": "0.7.2",
|
|
@@ -215,12 +215,12 @@
|
|
|
215
215
|
"isbot": "3.8.0",
|
|
216
216
|
"react-helmet": "^6.1.0",
|
|
217
217
|
"react-is": "^18.3.1",
|
|
218
|
-
"@modern-js/plugin": "3.
|
|
219
|
-
"@modern-js/
|
|
220
|
-
"@modern-js/
|
|
221
|
-
"@modern-js/
|
|
222
|
-
"@modern-js/
|
|
223
|
-
"@modern-js/utils": "3.
|
|
218
|
+
"@modern-js/plugin": "3.3.0",
|
|
219
|
+
"@modern-js/render": "3.3.0",
|
|
220
|
+
"@modern-js/plugin-data-loader": "3.3.0",
|
|
221
|
+
"@modern-js/runtime-utils": "3.3.0",
|
|
222
|
+
"@modern-js/types": "3.3.0",
|
|
223
|
+
"@modern-js/utils": "3.3.0"
|
|
224
224
|
},
|
|
225
225
|
"peerDependencies": {
|
|
226
226
|
"react": ">=17.0.2",
|
|
@@ -229,18 +229,18 @@
|
|
|
229
229
|
"devDependencies": {
|
|
230
230
|
"@remix-run/web-fetch": "^4.1.3",
|
|
231
231
|
"@rsbuild/core": "2.0.10",
|
|
232
|
-
"@rslib/core": "0.
|
|
232
|
+
"@rslib/core": "0.22.0",
|
|
233
233
|
"@testing-library/dom": "^10.4.1",
|
|
234
234
|
"@testing-library/react": "^16.3.2",
|
|
235
235
|
"@types/cookie": "0.6.0",
|
|
236
236
|
"@types/invariant": "^2.2.37",
|
|
237
237
|
"@types/loadable__server": "5.12.11",
|
|
238
238
|
"@types/node": "^20",
|
|
239
|
-
"react": "^19.2.
|
|
240
|
-
"react-dom": "^19.2.
|
|
239
|
+
"react": "^19.2.7",
|
|
240
|
+
"react-dom": "^19.2.7",
|
|
241
241
|
"ts-node": "^10.9.2",
|
|
242
242
|
"typescript": "^5",
|
|
243
|
-
"@modern-js/app-tools": "3.
|
|
243
|
+
"@modern-js/app-tools": "3.3.0",
|
|
244
244
|
"@modern-js/rslib": "2.68.10",
|
|
245
245
|
"@scripts/rstest-config": "2.66.0"
|
|
246
246
|
},
|