@modern-js/server 2.23.1 → 2.24.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/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @modern-js/server
2
2
 
3
+ ## 2.24.1
4
+
5
+ ### Patch Changes
6
+
7
+ - @modern-js/prod-server@2.24.1
8
+ - @modern-js/server-utils@2.24.1
9
+ - @modern-js/types@2.24.1
10
+ - @modern-js/utils@2.24.1
11
+
12
+ ## 2.24.0
13
+
14
+ ### Patch Changes
15
+
16
+ - 8c9923f: fix(dev-server): streaming ssr fail when dev mode, because `http-compression` can't handler stream http
17
+ fix(dev-server): streaming ssr 在开发模式失败, 因为 `http-compression` 不能处理 stream http
18
+ - 0424a2d: fix: should not invoke onServerChange when `-server-loader.js` file change
19
+ fix: 不应该在 `-server-loader.js` 变化时触发 onServerChange
20
+ - Updated dependencies [c882fbd]
21
+ - Updated dependencies [36f5bdf]
22
+ - Updated dependencies [4a82c3b]
23
+ - @modern-js/types@2.24.0
24
+ - @modern-js/utils@2.24.0
25
+ - @modern-js/server-utils@2.24.0
26
+ - @modern-js/prod-server@2.24.0
27
+
3
28
  ## 2.23.1
4
29
 
5
30
  ### Patch Changes
@@ -81,7 +81,10 @@ class ModernDevServer extends _prodserver.ModernServer {
81
81
  }
82
82
  async applyDefaultMiddlewares(app) {
83
83
  const { pwd, dev, devMiddleware } = this;
84
- if (dev.compress) {
84
+ const isUseStreamingSSR = (routes) => {
85
+ return routes === null || routes === void 0 ? void 0 : routes.some((r) => r.isStream === true);
86
+ };
87
+ if (!isUseStreamingSSR(this.getRoutes()) && dev.compress) {
85
88
  const { default: compression } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("http-compression")));
86
89
  this.addHandler((ctx, next) => {
87
90
  compression({
@@ -283,6 +286,7 @@ class ModernDevServer extends _prodserver.ModernServer {
283
286
  watcher.listen(defaultWatchedPaths, watchOptions, (filepath, event) => {
284
287
  if (filepath.includes("-server-loaders.js")) {
285
288
  delete require.cache[filepath];
289
+ return;
286
290
  } else {
287
291
  watcher.updateDepTree();
288
292
  watcher.cleanDepCache(filepath);
@@ -177,12 +177,17 @@ export var ModernDevServer = /* @__PURE__ */ function(ModernServer2) {
177
177
  value: function applyDefaultMiddlewares(app) {
178
178
  var _this = this;
179
179
  return _async_to_generator(function() {
180
- var pwd, dev, devMiddleware, _ref, compression, proxyHandlers, _ref1, connectHistoryApiFallback, historyApiFallbackMiddleware;
180
+ var pwd, dev, devMiddleware, isUseStreamingSSR, _ref, compression, proxyHandlers, _ref1, connectHistoryApiFallback, historyApiFallbackMiddleware;
181
181
  return _ts_generator(this, function(_state) {
182
182
  switch (_state.label) {
183
183
  case 0:
184
184
  pwd = _this.pwd, dev = _this.dev, devMiddleware = _this.devMiddleware;
185
- if (!dev.compress)
185
+ isUseStreamingSSR = function(routes) {
186
+ return routes === null || routes === void 0 ? void 0 : routes.some(function(r) {
187
+ return r.isStream === true;
188
+ });
189
+ };
190
+ if (!(!isUseStreamingSSR(_this.getRoutes()) && dev.compress))
186
191
  return [
187
192
  3,
188
193
  2
@@ -577,6 +582,7 @@ export var ModernDevServer = /* @__PURE__ */ function(ModernServer2) {
577
582
  watcher.listen(defaultWatchedPaths, watchOptions, function(filepath, event) {
578
583
  if (filepath.includes("-server-loaders.js")) {
579
584
  delete require.cache[filepath];
585
+ return;
580
586
  } else {
581
587
  watcher.updateDepTree();
582
588
  watcher.cleanDepCache(filepath);
@@ -69,7 +69,10 @@ export class ModernDevServer extends ModernServer {
69
69
  }
70
70
  async applyDefaultMiddlewares(app) {
71
71
  const { pwd, dev, devMiddleware } = this;
72
- if (dev.compress) {
72
+ const isUseStreamingSSR = (routes) => {
73
+ return routes === null || routes === void 0 ? void 0 : routes.some((r) => r.isStream === true);
74
+ };
75
+ if (!isUseStreamingSSR(this.getRoutes()) && dev.compress) {
73
76
  const { default: compression } = await import("http-compression");
74
77
  this.addHandler((ctx, next) => {
75
78
  compression({
@@ -271,6 +274,7 @@ export class ModernDevServer extends ModernServer {
271
274
  watcher.listen(defaultWatchedPaths, watchOptions, (filepath, event) => {
272
275
  if (filepath.includes("-server-loaders.js")) {
273
276
  delete require.cache[filepath];
277
+ return;
274
278
  } else {
275
279
  watcher.updateDepTree();
276
280
  watcher.cleanDepCache(filepath);
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.23.1",
18
+ "version": "2.24.1",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -47,10 +47,10 @@
47
47
  "minimatch": "^3.0.4",
48
48
  "path-to-regexp": "^6.2.0",
49
49
  "ws": "^8.2.0",
50
- "@modern-js/prod-server": "2.23.1",
51
- "@modern-js/server-utils": "2.23.1",
52
- "@modern-js/types": "2.23.1",
53
- "@modern-js/utils": "2.23.1"
50
+ "@modern-js/prod-server": "2.24.1",
51
+ "@modern-js/server-utils": "2.24.1",
52
+ "@modern-js/types": "2.24.1",
53
+ "@modern-js/utils": "2.24.1"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/connect-history-api-fallback": "^1.3.5",
@@ -65,9 +65,9 @@
65
65
  "typescript": "^5",
66
66
  "webpack": "^5.82.1",
67
67
  "websocket": "^1",
68
- "@modern-js/server-core": "2.23.1",
69
- "@scripts/jest-config": "2.23.1",
70
- "@scripts/build": "2.23.1"
68
+ "@modern-js/server-core": "2.24.1",
69
+ "@scripts/build": "2.24.1",
70
+ "@scripts/jest-config": "2.24.1"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "devcert": "^1.0.0",