@modern-js/server-core 3.0.0-alpha.0 → 3.0.0-alpha.1
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/adapters/node/plugins/resource.js +2 -3
- package/dist/cjs/plugins/render/render.js +1 -1
- package/dist/esm/adapters/node/plugins/resource.mjs +2 -3
- package/dist/esm/plugins/render/render.mjs +1 -1
- package/dist/esm-node/adapters/node/plugins/resource.mjs +2 -3
- package/dist/esm-node/plugins/render/render.mjs +1 -1
- package/dist/types/adapters/node/plugins/resource.d.ts +1 -1
- package/package.json +8 -8
|
@@ -131,13 +131,12 @@ async function getRscSSRManifest(pwd) {
|
|
|
131
131
|
const rscSSRManifest = await (0, utils_namespaceObject.compatibleRequire)(external_path_default().join(pwd, 'react-ssr-manifest.json')).catch((_)=>void 0);
|
|
132
132
|
return rscSSRManifest;
|
|
133
133
|
}
|
|
134
|
-
const injectRscManifestPlugin = ()=>({
|
|
134
|
+
const injectRscManifestPlugin = (enableRsc)=>({
|
|
135
135
|
name: '@modern-js/plugin-inject-rsc-manifest',
|
|
136
136
|
setup (api) {
|
|
137
137
|
api.onPrepare(()=>{
|
|
138
138
|
const { middlewares, distDirectory: pwd } = api.getServerContext();
|
|
139
|
-
|
|
140
|
-
if (!config.server?.rsc) return;
|
|
139
|
+
if (!enableRsc) return;
|
|
141
140
|
middlewares.push({
|
|
142
141
|
name: 'inject-rsc-manifest',
|
|
143
142
|
handler: async (c, next)=>{
|
|
@@ -241,7 +241,7 @@ var __webpack_exports__ = {};
|
|
|
241
241
|
}
|
|
242
242
|
async function csrRender(request, options) {
|
|
243
243
|
const { html, rscClientManifest } = options;
|
|
244
|
-
if (!rscClientManifest || process.env.MODERN_DISABLE_INJECT_RSC_DATA) return new Response(html, {
|
|
244
|
+
if (!rscClientManifest || process.env.MODERN_DISABLE_INJECT_RSC_DATA || !options.routeInfo.isRSC) return new Response(html, {
|
|
245
245
|
status: 200,
|
|
246
246
|
headers: new Headers({
|
|
247
247
|
'content-type': 'text/html; charset=UTF-8',
|
|
@@ -85,13 +85,12 @@ async function getRscSSRManifest(pwd) {
|
|
|
85
85
|
const rscSSRManifest = await compatibleRequire(path.join(pwd, 'react-ssr-manifest.json')).catch((_)=>void 0);
|
|
86
86
|
return rscSSRManifest;
|
|
87
87
|
}
|
|
88
|
-
const injectRscManifestPlugin = ()=>({
|
|
88
|
+
const injectRscManifestPlugin = (enableRsc)=>({
|
|
89
89
|
name: '@modern-js/plugin-inject-rsc-manifest',
|
|
90
90
|
setup (api) {
|
|
91
91
|
api.onPrepare(()=>{
|
|
92
92
|
const { middlewares, distDirectory: pwd } = api.getServerContext();
|
|
93
|
-
|
|
94
|
-
if (!config.server?.rsc) return;
|
|
93
|
+
if (!enableRsc) return;
|
|
95
94
|
middlewares.push({
|
|
96
95
|
name: 'inject-rsc-manifest',
|
|
97
96
|
handler: async (c, next)=>{
|
|
@@ -214,7 +214,7 @@ function injectFallbackReasonToHtml({ html, reason, framework }) {
|
|
|
214
214
|
}
|
|
215
215
|
async function csrRender(request, options) {
|
|
216
216
|
const { html, rscClientManifest } = options;
|
|
217
|
-
if (!rscClientManifest || process.env.MODERN_DISABLE_INJECT_RSC_DATA) return new Response(html, {
|
|
217
|
+
if (!rscClientManifest || process.env.MODERN_DISABLE_INJECT_RSC_DATA || !options.routeInfo.isRSC) return new Response(html, {
|
|
218
218
|
status: 200,
|
|
219
219
|
headers: new Headers({
|
|
220
220
|
'content-type': 'text/html; charset=UTF-8',
|
|
@@ -85,13 +85,12 @@ async function getRscSSRManifest(pwd) {
|
|
|
85
85
|
const rscSSRManifest = await compatibleRequire(path.join(pwd, 'react-ssr-manifest.json')).catch((_)=>void 0);
|
|
86
86
|
return rscSSRManifest;
|
|
87
87
|
}
|
|
88
|
-
const injectRscManifestPlugin = ()=>({
|
|
88
|
+
const injectRscManifestPlugin = (enableRsc)=>({
|
|
89
89
|
name: '@modern-js/plugin-inject-rsc-manifest',
|
|
90
90
|
setup (api) {
|
|
91
91
|
api.onPrepare(()=>{
|
|
92
92
|
const { middlewares, distDirectory: pwd } = api.getServerContext();
|
|
93
|
-
|
|
94
|
-
if (!config.server?.rsc) return;
|
|
93
|
+
if (!enableRsc) return;
|
|
95
94
|
middlewares.push({
|
|
96
95
|
name: 'inject-rsc-manifest',
|
|
97
96
|
handler: async (c, next)=>{
|
|
@@ -214,7 +214,7 @@ function injectFallbackReasonToHtml({ html, reason, framework }) {
|
|
|
214
214
|
}
|
|
215
215
|
async function csrRender(request, options) {
|
|
216
216
|
const { html, rscClientManifest } = options;
|
|
217
|
-
if (!rscClientManifest || process.env.MODERN_DISABLE_INJECT_RSC_DATA) return new Response(html, {
|
|
217
|
+
if (!rscClientManifest || process.env.MODERN_DISABLE_INJECT_RSC_DATA || !options.routeInfo.isRSC) return new Response(html, {
|
|
218
218
|
status: 200,
|
|
219
219
|
headers: new Headers({
|
|
220
220
|
'content-type': 'text/html; charset=UTF-8',
|
|
@@ -7,5 +7,5 @@ export declare function injectServerManifest(pwd: string, routes?: ServerRoute[]
|
|
|
7
7
|
export declare function getRscServerManifest(pwd: string): Promise<any>;
|
|
8
8
|
export declare function getClientManifest(pwd: string): Promise<any>;
|
|
9
9
|
export declare function getRscSSRManifest(pwd: string): Promise<any>;
|
|
10
|
-
export declare const injectRscManifestPlugin: () => ServerPlugin;
|
|
10
|
+
export declare const injectRscManifestPlugin: (enableRsc: boolean) => ServerPlugin;
|
|
11
11
|
export declare const injectResourcePlugin: () => ServerPlugin;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.0.0-alpha.
|
|
18
|
+
"version": "3.0.0-alpha.1",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -62,20 +62,20 @@
|
|
|
62
62
|
"flatted": "^3.3.3",
|
|
63
63
|
"hono": "^4.10.4",
|
|
64
64
|
"ts-deepmerge": "7.0.3",
|
|
65
|
-
"@modern-js/plugin": "3.0.0-alpha.
|
|
66
|
-
"@modern-js/runtime-utils": "3.0.0-alpha.
|
|
67
|
-
"@modern-js/utils": "3.0.0-alpha.
|
|
65
|
+
"@modern-js/plugin": "3.0.0-alpha.1",
|
|
66
|
+
"@modern-js/runtime-utils": "3.0.0-alpha.1",
|
|
67
|
+
"@modern-js/utils": "3.0.0-alpha.1"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@rslib/core": "0.
|
|
70
|
+
"@rslib/core": "0.19.1",
|
|
71
71
|
"@types/cloneable-readable": "^2.0.3",
|
|
72
72
|
"@types/merge-deep": "^3.0.3",
|
|
73
73
|
"@types/node": "^20",
|
|
74
74
|
"http-proxy-middleware": "^2.0.9",
|
|
75
75
|
"typescript": "^5",
|
|
76
|
-
"@modern-js/types": "3.0.0-alpha.
|
|
77
|
-
"@
|
|
78
|
-
"@
|
|
76
|
+
"@modern-js/types": "3.0.0-alpha.1",
|
|
77
|
+
"@scripts/rstest-config": "2.66.0",
|
|
78
|
+
"@modern-js/rslib": "2.68.10"
|
|
79
79
|
},
|
|
80
80
|
"sideEffects": false,
|
|
81
81
|
"publishConfig": {
|