@modern-js/plugin-ssg 2.6.0 → 2.7.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @modern-js/plugin-ssg
2
2
 
3
+ ## 2.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - dcad887024: feat: support deferred data for streaming ssr
8
+ feat: 流式渲染支持 deferred data
9
+
10
+ ### Patch Changes
11
+
12
+ - 0de9e61292: fix: ssg error reporting inaccuracy problem
13
+
14
+ fix: 修复 ssg 报错不准确的问题
15
+
16
+ - Updated dependencies [0f15fc597c]
17
+ - Updated dependencies [dcad887024]
18
+ - Updated dependencies [a4672f7c16]
19
+ - Updated dependencies [7fff9020e1]
20
+ - Updated dependencies [84bfb439b8]
21
+ - @modern-js/utils@2.7.0
22
+
3
23
  ## 2.6.0
4
24
 
5
25
  ### Patch Changes
@@ -36,6 +36,7 @@ var import_utils = require("@modern-js/utils");
36
36
  var import_util = require("../libs/util");
37
37
  var import_consts = require("./consts");
38
38
  const createServer = (api, ssgRoutes, pageRoutes, apiRoutes, options, appDirectory) => new Promise((resolve, reject) => {
39
+ var _a, _b;
39
40
  const entries = ssgRoutes.map((route) => route.entryName);
40
41
  const backup = (0, import_util.openRouteSSR)(pageRoutes, entries);
41
42
  const total = backup.concat(apiRoutes);
@@ -69,7 +70,7 @@ const createServer = (api, ssgRoutes, pageRoutes, apiRoutes, options, appDirecto
69
70
  resolve(htmlAry);
70
71
  }
71
72
  });
72
- cp.stderr.on("data", (chunk) => {
73
+ (_a = cp.stderr) == null ? void 0 : _a.on("data", (chunk) => {
73
74
  const str = chunk.toString();
74
75
  if (str.includes("Error")) {
75
76
  import_utils.logger.error(str);
@@ -79,7 +80,7 @@ const createServer = (api, ssgRoutes, pageRoutes, apiRoutes, options, appDirecto
79
80
  import_utils.logger.info(str.replace(/[^\S\n]+/g, " "));
80
81
  }
81
82
  });
82
- cp.stdout.on("data", (chunk) => {
83
+ (_b = cp.stdout) == null ? void 0 : _b.on("data", (chunk) => {
83
84
  const str = chunk.toString();
84
85
  if (str.includes("Error")) {
85
86
  import_utils.logger.error(str);
@@ -72,6 +72,6 @@ process.on("message", async (chunk) => {
72
72
  });
73
73
  } catch (e) {
74
74
  modernServer == null ? void 0 : modernServer.close();
75
- throw e;
75
+ process.stderr.write(e instanceof Error ? e.stack : e.toString());
76
76
  }
77
77
  });
@@ -5,6 +5,7 @@ import { openRouteSSR } from "../libs/util";
5
5
  import { CLOSE_SIGN } from "./consts";
6
6
  var createServer = function(api, ssgRoutes, pageRoutes, apiRoutes, options, appDirectory) {
7
7
  return new Promise(function(resolve, reject) {
8
+ var _cp_stderr, _cp_stdout;
8
9
  var entries = ssgRoutes.map(function(route) {
9
10
  return route.entryName;
10
11
  });
@@ -38,7 +39,7 @@ var createServer = function(api, ssgRoutes, pageRoutes, apiRoutes, options, appD
38
39
  resolve(htmlAry);
39
40
  }
40
41
  });
41
- cp.stderr.on("data", function(chunk) {
42
+ (_cp_stderr = cp.stderr) === null || _cp_stderr === void 0 ? void 0 : _cp_stderr.on("data", function(chunk) {
42
43
  var str = chunk.toString();
43
44
  if (str.includes("Error")) {
44
45
  logger.error(str);
@@ -48,7 +49,7 @@ var createServer = function(api, ssgRoutes, pageRoutes, apiRoutes, options, appD
48
49
  logger.info(str.replace(/[^\S\n]+/g, " "));
49
50
  }
50
51
  });
51
- cp.stdout.on("data", function(chunk) {
52
+ (_cp_stdout = cp.stdout) === null || _cp_stdout === void 0 ? void 0 : _cp_stdout.on("data", function(chunk) {
52
53
  var str = chunk.toString();
53
54
  if (str.includes("Error")) {
54
55
  logger.error(str);
@@ -27,6 +27,13 @@ function _asyncToGenerator(fn) {
27
27
  });
28
28
  };
29
29
  }
30
+ function _instanceof(left, right) {
31
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
32
+ return !!right[Symbol.hasInstance](left);
33
+ } else {
34
+ return left instanceof right;
35
+ }
36
+ }
30
37
  var __generator = this && this.__generator || function(thisArg, body) {
31
38
  var f, y, t, g, _ = {
32
39
  label: 0,
@@ -212,7 +219,11 @@ process.on("message", function() {
212
219
  case 4:
213
220
  e = _state.sent();
214
221
  modernServer === null || modernServer === void 0 ? void 0 : modernServer.close();
215
- throw e;
222
+ process.stderr.write(_instanceof(e, Error) ? e.stack : e.toString());
223
+ return [
224
+ 3,
225
+ 5
226
+ ];
216
227
  case 5:
217
228
  return [
218
229
  2
@@ -4,6 +4,7 @@ import { logger } from "@modern-js/utils";
4
4
  import { openRouteSSR } from "../libs/util";
5
5
  import { CLOSE_SIGN } from "./consts";
6
6
  const createServer = (api, ssgRoutes, pageRoutes, apiRoutes, options, appDirectory) => new Promise((resolve, reject) => {
7
+ var _a, _b;
7
8
  const entries = ssgRoutes.map((route) => route.entryName);
8
9
  const backup = openRouteSSR(pageRoutes, entries);
9
10
  const total = backup.concat(apiRoutes);
@@ -37,7 +38,7 @@ const createServer = (api, ssgRoutes, pageRoutes, apiRoutes, options, appDirecto
37
38
  resolve(htmlAry);
38
39
  }
39
40
  });
40
- cp.stderr.on("data", (chunk) => {
41
+ (_a = cp.stderr) == null ? void 0 : _a.on("data", (chunk) => {
41
42
  const str = chunk.toString();
42
43
  if (str.includes("Error")) {
43
44
  logger.error(str);
@@ -47,7 +48,7 @@ const createServer = (api, ssgRoutes, pageRoutes, apiRoutes, options, appDirecto
47
48
  logger.info(str.replace(/[^\S\n]+/g, " "));
48
49
  }
49
50
  });
50
- cp.stdout.on("data", (chunk) => {
51
+ (_b = cp.stdout) == null ? void 0 : _b.on("data", (chunk) => {
51
52
  const str = chunk.toString();
52
53
  if (str.includes("Error")) {
53
54
  logger.error(str);
@@ -50,6 +50,6 @@ process.on("message", async (chunk) => {
50
50
  });
51
51
  } catch (e) {
52
52
  modernServer == null ? void 0 : modernServer.close();
53
- throw e;
53
+ process.stderr.write(e instanceof Error ? e.stack : e.toString());
54
54
  }
55
55
  });
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.6.0",
14
+ "version": "2.7.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/cjs/index.js",
@@ -57,7 +57,7 @@
57
57
  "node-mocks-http": "^1.10.1",
58
58
  "normalize-path": "^3.0.0",
59
59
  "portfinder": "^1.0.28",
60
- "@modern-js/utils": "2.6.0"
60
+ "@modern-js/utils": "2.7.0"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "react-router-dom": ">=5.1.2"
@@ -72,13 +72,13 @@
72
72
  "@types/node": "^14",
73
73
  "jest": "^27",
74
74
  "react": "^18",
75
- "react-router-dom": "^6.6.0",
75
+ "react-router-dom": "^6.8.1",
76
76
  "typescript": "^4",
77
- "@modern-js/app-tools": "2.6.0",
78
- "@modern-js/prod-server": "2.6.0",
79
- "@modern-js/types": "2.6.0",
80
- "@scripts/build": "2.6.0",
81
- "@scripts/jest-config": "2.6.0"
77
+ "@modern-js/app-tools": "2.7.0",
78
+ "@modern-js/prod-server": "2.7.0",
79
+ "@modern-js/types": "2.7.0",
80
+ "@scripts/jest-config": "2.7.0",
81
+ "@scripts/build": "2.7.0"
82
82
  },
83
83
  "sideEffects": false,
84
84
  "publishConfig": {