@modern-js/app-tools 2.48.1 → 2.48.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -42,14 +42,16 @@ const builderPluginAdapterSSR = (options) => ({
|
|
42
42
|
setup(api) {
|
43
43
|
const { normalizedConfig } = options;
|
44
44
|
api.modifyRsbuildConfig((config) => {
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
return (0, import_core.mergeRsbuildConfig)(config, {
|
46
|
+
html: {
|
47
|
+
inject: isStreamingSSR(normalizedConfig) ? "body" : void 0
|
48
|
+
},
|
49
|
+
server: {
|
50
|
+
// the http-compression can't handler stream http.
|
51
|
+
// so we disable compress when user use stream ssr temporarily.
|
52
|
+
compress: isStreamingSSR(normalizedConfig) || isSSRPreload(normalizedConfig) ? false : void 0
|
53
|
+
}
|
54
|
+
});
|
53
55
|
});
|
54
56
|
api.modifyBundlerChain(async (chain, { target, isProd, HtmlPlugin: HtmlBundlerPlugin, isServer }) => {
|
55
57
|
const builderConfig = api.getNormalizedConfig();
|
@@ -79,6 +81,11 @@ const builderPluginAdapterSSR = (options) => ({
|
|
79
81
|
});
|
80
82
|
}
|
81
83
|
});
|
84
|
+
const isSSRPreload = (userConfig) => {
|
85
|
+
const { server: { ssr, ssrByEntries } } = userConfig;
|
86
|
+
const checkUsePreload = (ssr2) => typeof ssr2 === "object" && Boolean(ssr2.preload);
|
87
|
+
return checkUsePreload(ssr) || Object.values(ssrByEntries || {}).some((ssr2) => checkUsePreload(ssr2));
|
88
|
+
};
|
82
89
|
const isStreamingSSR = (userConfig) => {
|
83
90
|
const isStreaming = (ssr) => ssr && typeof ssr === "object" && ssr.mode === "stream";
|
84
91
|
const { server } = userConfig;
|
@@ -12,14 +12,16 @@ var builderPluginAdapterSSR = function(options) {
|
|
12
12
|
setup: function setup(api) {
|
13
13
|
var normalizedConfig = options.normalizedConfig;
|
14
14
|
api.modifyRsbuildConfig(function(config) {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
return mergeRsbuildConfig(config, {
|
16
|
+
html: {
|
17
|
+
inject: isStreamingSSR(normalizedConfig) ? "body" : void 0
|
18
|
+
},
|
19
|
+
server: {
|
20
|
+
// the http-compression can't handler stream http.
|
21
|
+
// so we disable compress when user use stream ssr temporarily.
|
22
|
+
compress: isStreamingSSR(normalizedConfig) || isSSRPreload(normalizedConfig) ? false : void 0
|
23
|
+
}
|
24
|
+
});
|
23
25
|
});
|
24
26
|
api.modifyBundlerChain(function() {
|
25
27
|
var _ref = _async_to_generator(function(chain, param) {
|
@@ -75,6 +77,15 @@ var builderPluginAdapterSSR = function(options) {
|
|
75
77
|
}
|
76
78
|
};
|
77
79
|
};
|
80
|
+
var isSSRPreload = function(userConfig) {
|
81
|
+
var _userConfig_server = userConfig.server, ssr = _userConfig_server.ssr, ssrByEntries = _userConfig_server.ssrByEntries;
|
82
|
+
var checkUsePreload = function(ssr2) {
|
83
|
+
return typeof ssr2 === "object" && Boolean(ssr2.preload);
|
84
|
+
};
|
85
|
+
return checkUsePreload(ssr) || Object.values(ssrByEntries || {}).some(function(ssr2) {
|
86
|
+
return checkUsePreload(ssr2);
|
87
|
+
});
|
88
|
+
};
|
78
89
|
var isStreamingSSR = function(userConfig) {
|
79
90
|
var isStreaming = function(ssr) {
|
80
91
|
return ssr && typeof ssr === "object" && ssr.mode === "stream";
|
@@ -9,14 +9,16 @@ const builderPluginAdapterSSR = (options) => ({
|
|
9
9
|
setup(api) {
|
10
10
|
const { normalizedConfig } = options;
|
11
11
|
api.modifyRsbuildConfig((config) => {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
12
|
+
return mergeRsbuildConfig(config, {
|
13
|
+
html: {
|
14
|
+
inject: isStreamingSSR(normalizedConfig) ? "body" : void 0
|
15
|
+
},
|
16
|
+
server: {
|
17
|
+
// the http-compression can't handler stream http.
|
18
|
+
// so we disable compress when user use stream ssr temporarily.
|
19
|
+
compress: isStreamingSSR(normalizedConfig) || isSSRPreload(normalizedConfig) ? false : void 0
|
20
|
+
}
|
21
|
+
});
|
20
22
|
});
|
21
23
|
api.modifyBundlerChain(async (chain, { target, isProd, HtmlPlugin: HtmlBundlerPlugin, isServer }) => {
|
22
24
|
const builderConfig = api.getNormalizedConfig();
|
@@ -46,6 +48,11 @@ const builderPluginAdapterSSR = (options) => ({
|
|
46
48
|
});
|
47
49
|
}
|
48
50
|
});
|
51
|
+
const isSSRPreload = (userConfig) => {
|
52
|
+
const { server: { ssr, ssrByEntries } } = userConfig;
|
53
|
+
const checkUsePreload = (ssr2) => typeof ssr2 === "object" && Boolean(ssr2.preload);
|
54
|
+
return checkUsePreload(ssr) || Object.values(ssrByEntries || {}).some((ssr2) => checkUsePreload(ssr2));
|
55
|
+
};
|
49
56
|
const isStreamingSSR = (userConfig) => {
|
50
57
|
const isStreaming = (ssr) => ssr && typeof ssr === "object" && ssr.mode === "stream";
|
51
58
|
const { server } = userConfig;
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.48.
|
18
|
+
"version": "2.48.3",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -69,37 +69,37 @@
|
|
69
69
|
"@babel/parser": "^7.22.15",
|
70
70
|
"@babel/traverse": "^7.23.2",
|
71
71
|
"@babel/types": "^7.23.0",
|
72
|
-
"@rsbuild/plugin-esbuild": "0.
|
73
|
-
"@rsbuild/plugin-node-polyfill": "0.
|
74
|
-
"@rsbuild/shared": "0.
|
75
|
-
"@rsbuild/core": "0.
|
72
|
+
"@rsbuild/plugin-esbuild": "0.5.1",
|
73
|
+
"@rsbuild/plugin-node-polyfill": "0.5.1",
|
74
|
+
"@rsbuild/shared": "0.5.1",
|
75
|
+
"@rsbuild/core": "0.5.1",
|
76
76
|
"es-module-lexer": "^1.1.0",
|
77
77
|
"esbuild": "0.17.19",
|
78
78
|
"@swc/helpers": "0.5.3",
|
79
|
-
"@modern-js/uni-builder": "2.48.
|
80
|
-
"@modern-js/core": "2.48.
|
81
|
-
"@modern-js/
|
82
|
-
"@modern-js/
|
83
|
-
"@modern-js/plugin
|
84
|
-
"@modern-js/plugin-
|
85
|
-
"@modern-js/
|
86
|
-
"@modern-js/
|
87
|
-
"@modern-js/server": "2.48.
|
88
|
-
"@modern-js/server-utils": "2.48.
|
89
|
-
"@modern-js/
|
90
|
-
"@modern-js/
|
91
|
-
"@modern-js/server-core": "2.48.
|
79
|
+
"@modern-js/uni-builder": "2.48.3",
|
80
|
+
"@modern-js/core": "2.48.3",
|
81
|
+
"@modern-js/node-bundle-require": "2.48.3",
|
82
|
+
"@modern-js/plugin-data-loader": "2.48.3",
|
83
|
+
"@modern-js/plugin": "2.48.3",
|
84
|
+
"@modern-js/plugin-i18n": "2.48.3",
|
85
|
+
"@modern-js/prod-server": "2.48.3",
|
86
|
+
"@modern-js/plugin-lint": "2.48.3",
|
87
|
+
"@modern-js/server": "2.48.3",
|
88
|
+
"@modern-js/server-utils": "2.48.3",
|
89
|
+
"@modern-js/utils": "2.48.3",
|
90
|
+
"@modern-js/types": "2.48.3",
|
91
|
+
"@modern-js/server-core": "2.48.3"
|
92
92
|
},
|
93
93
|
"devDependencies": {
|
94
|
-
"@rsbuild/plugin-swc": "0.
|
94
|
+
"@rsbuild/plugin-swc": "0.5.1",
|
95
95
|
"@types/babel__traverse": "7.18.5",
|
96
96
|
"@types/jest": "^29",
|
97
97
|
"@types/node": "^14",
|
98
98
|
"jest": "^29",
|
99
99
|
"typescript": "^5",
|
100
100
|
"webpack": "^5.89.0",
|
101
|
-
"@scripts/build": "2.48.
|
102
|
-
"@scripts/jest-config": "2.48.
|
101
|
+
"@scripts/build": "2.48.3",
|
102
|
+
"@scripts/jest-config": "2.48.3"
|
103
103
|
},
|
104
104
|
"sideEffects": false,
|
105
105
|
"publishConfig": {
|