@modern-js/app-tools 2.48.2 → 2.48.4

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
- if (isStreamingSSR(normalizedConfig)) {
46
- return (0, import_core.mergeRsbuildConfig)(config, {
47
- html: {
48
- inject: "body"
49
- }
50
- });
51
- }
52
- return config;
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
- if (isStreamingSSR(normalizedConfig)) {
16
- return mergeRsbuildConfig(config, {
17
- html: {
18
- inject: "body"
19
- }
20
- });
21
- }
22
- return config;
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
- if (isStreamingSSR(normalizedConfig)) {
13
- return mergeRsbuildConfig(config, {
14
- html: {
15
- inject: "body"
16
- }
17
- });
18
- }
19
- return config;
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/lib/types.d.ts CHANGED
@@ -61,6 +61,11 @@ declare module '*.svg' {
61
61
  export default content;
62
62
  }
63
63
 
64
+ declare module '*.svg?react' {
65
+ const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
66
+ export default ReactComponent;
67
+ }
68
+
64
69
  declare module '*.bmp?inline' {
65
70
  const src: string;
66
71
  export default src;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.48.2",
18
+ "version": "2.48.4",
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.4.15",
73
- "@rsbuild/plugin-node-polyfill": "0.4.15",
74
- "@rsbuild/shared": "0.4.15",
75
- "@rsbuild/core": "0.4.15",
72
+ "@rsbuild/plugin-esbuild": "0.5.4",
73
+ "@rsbuild/plugin-node-polyfill": "0.5.4",
74
+ "@rsbuild/shared": "0.5.4",
75
+ "@rsbuild/core": "0.5.4",
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.2",
80
- "@modern-js/node-bundle-require": "2.48.2",
81
- "@modern-js/plugin-data-loader": "2.48.2",
82
- "@modern-js/plugin-i18n": "2.48.2",
83
- "@modern-js/plugin": "2.48.2",
84
- "@modern-js/plugin-lint": "2.48.2",
85
- "@modern-js/prod-server": "2.48.2",
86
- "@modern-js/server": "2.48.2",
87
- "@modern-js/server-utils": "2.48.2",
88
- "@modern-js/types": "2.48.2",
89
- "@modern-js/utils": "2.48.2",
90
- "@modern-js/server-core": "2.48.2",
91
- "@modern-js/core": "2.48.2"
79
+ "@modern-js/uni-builder": "2.48.4",
80
+ "@modern-js/core": "2.48.4",
81
+ "@modern-js/node-bundle-require": "2.48.4",
82
+ "@modern-js/plugin": "2.48.4",
83
+ "@modern-js/plugin-data-loader": "2.48.4",
84
+ "@modern-js/plugin-i18n": "2.48.4",
85
+ "@modern-js/plugin-lint": "2.48.4",
86
+ "@modern-js/server": "2.48.4",
87
+ "@modern-js/types": "2.48.4",
88
+ "@modern-js/server-utils": "2.48.4",
89
+ "@modern-js/prod-server": "2.48.4",
90
+ "@modern-js/utils": "2.48.4",
91
+ "@modern-js/server-core": "2.48.4"
92
92
  },
93
93
  "devDependencies": {
94
- "@rsbuild/plugin-swc": "0.4.15",
94
+ "@rsbuild/plugin-swc": "0.5.4",
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
- "webpack": "^5.89.0",
101
- "@scripts/build": "2.48.2",
102
- "@scripts/jest-config": "2.48.2"
100
+ "webpack": "^5.91.0",
101
+ "@scripts/build": "2.48.4",
102
+ "@scripts/jest-config": "2.48.4"
103
103
  },
104
104
  "sideEffects": false,
105
105
  "publishConfig": {