@modern-js/plugin-ssg 2.66.0 → 2.67.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.
|
@@ -21,8 +21,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
22
|
mod
|
|
23
23
|
));
|
|
24
|
-
var
|
|
25
|
-
var
|
|
24
|
+
var import_node_assert = __toESM(require("node:assert"));
|
|
25
|
+
var import_node_http = require("node:http");
|
|
26
26
|
var import_prod_server = require("@modern-js/prod-server");
|
|
27
27
|
var import_portfinder = __toESM(require("portfinder"));
|
|
28
28
|
var import_util = require("../libs/util");
|
|
@@ -48,7 +48,7 @@ process.on("message", async (chunk) => {
|
|
|
48
48
|
plugins: await (0, import_prod_server.loadServerPlugins)(plugins, appContext.appDirectory || distDirectory),
|
|
49
49
|
staticGenerate: true
|
|
50
50
|
};
|
|
51
|
-
(0,
|
|
51
|
+
(0, import_node_assert.default)(process.send, "process.send is not available");
|
|
52
52
|
const sendProcessMessage = process.send.bind(process);
|
|
53
53
|
nodeServer = await (0, import_prod_server.createProdServer)(serverOptions);
|
|
54
54
|
nodeServer.listen(port, async () => {
|
|
@@ -74,17 +74,18 @@ function getHtml(url, port) {
|
|
|
74
74
|
host: `localhost:${port}`
|
|
75
75
|
};
|
|
76
76
|
return new Promise((resolve, reject) => {
|
|
77
|
-
(0,
|
|
77
|
+
(0, import_node_http.request)(url, {
|
|
78
78
|
headers
|
|
79
79
|
}, (res) => {
|
|
80
|
-
|
|
80
|
+
const chunks = [];
|
|
81
81
|
res.on("error", (error) => {
|
|
82
82
|
reject(error);
|
|
83
83
|
});
|
|
84
84
|
res.on("data", (chunk) => {
|
|
85
|
-
|
|
85
|
+
chunks.push(chunk);
|
|
86
86
|
});
|
|
87
87
|
res.on("end", () => {
|
|
88
|
+
const html = Buffer.concat(chunks).toString();
|
|
88
89
|
resolve(html);
|
|
89
90
|
});
|
|
90
91
|
}).end();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
2
|
import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
|
|
3
3
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
4
|
-
import assert from "assert";
|
|
5
|
-
import { request } from "http";
|
|
4
|
+
import assert from "node:assert";
|
|
5
|
+
import { request } from "node:http";
|
|
6
6
|
import { createProdServer, loadServerPlugins } from "@modern-js/prod-server";
|
|
7
7
|
import portfinder from "portfinder";
|
|
8
8
|
import { chunkArray } from "../libs/util";
|
|
@@ -227,14 +227,15 @@ function getHtml(url, port) {
|
|
|
227
227
|
request(url, {
|
|
228
228
|
headers
|
|
229
229
|
}, function(res) {
|
|
230
|
-
var
|
|
230
|
+
var chunks = [];
|
|
231
231
|
res.on("error", function(error) {
|
|
232
232
|
reject(error);
|
|
233
233
|
});
|
|
234
234
|
res.on("data", function(chunk) {
|
|
235
|
-
|
|
235
|
+
chunks.push(chunk);
|
|
236
236
|
});
|
|
237
237
|
res.on("end", function() {
|
|
238
|
+
var html = Buffer.concat(chunks).toString();
|
|
238
239
|
resolve(html);
|
|
239
240
|
});
|
|
240
241
|
}).end();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import assert from "assert";
|
|
2
|
-
import { request } from "http";
|
|
1
|
+
import assert from "node:assert";
|
|
2
|
+
import { request } from "node:http";
|
|
3
3
|
import { createProdServer, loadServerPlugins } from "@modern-js/prod-server";
|
|
4
4
|
import portfinder from "portfinder";
|
|
5
5
|
import { chunkArray } from "../libs/util";
|
|
@@ -54,14 +54,15 @@ function getHtml(url, port) {
|
|
|
54
54
|
request(url, {
|
|
55
55
|
headers
|
|
56
56
|
}, (res) => {
|
|
57
|
-
|
|
57
|
+
const chunks = [];
|
|
58
58
|
res.on("error", (error) => {
|
|
59
59
|
reject(error);
|
|
60
60
|
});
|
|
61
61
|
res.on("data", (chunk) => {
|
|
62
|
-
|
|
62
|
+
chunks.push(chunk);
|
|
63
63
|
});
|
|
64
64
|
res.on("end", () => {
|
|
65
|
+
const html = Buffer.concat(chunks).toString();
|
|
65
66
|
resolve(html);
|
|
66
67
|
});
|
|
67
68
|
}).end();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NodeRequest, NodeResponse } from '@modern-js/types';
|
|
2
2
|
export type Options = {
|
|
3
3
|
url: string;
|
|
4
4
|
headers: {
|
|
@@ -7,4 +7,4 @@ export type Options = {
|
|
|
7
7
|
};
|
|
8
8
|
[propName: string]: any;
|
|
9
9
|
};
|
|
10
|
-
export declare const compile: (requestHandler: (req:
|
|
10
|
+
export declare const compile: (requestHandler: (req: NodeRequest, res: NodeResponse) => void) => (options: Options, extend?: {}) => Promise<string>;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.67.1",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"node-mocks-http": "^1.11.0",
|
|
64
64
|
"normalize-path": "3.0.0",
|
|
65
65
|
"portfinder": "^1.0.28",
|
|
66
|
-
"@modern-js/
|
|
67
|
-
"@modern-js/
|
|
66
|
+
"@modern-js/utils": "2.67.1",
|
|
67
|
+
"@modern-js/prod-server": "2.67.1"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"react-router-dom": ">=5.1.2"
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"react-dom": "^18.3.1",
|
|
83
83
|
"react-router-dom": "6.27.0",
|
|
84
84
|
"typescript": "^5",
|
|
85
|
-
"@modern-js/app-tools": "2.
|
|
86
|
-
"@modern-js/types": "2.
|
|
85
|
+
"@modern-js/app-tools": "2.67.1",
|
|
86
|
+
"@modern-js/types": "2.67.1",
|
|
87
87
|
"@scripts/build": "2.66.0",
|
|
88
88
|
"@scripts/jest-config": "2.66.0"
|
|
89
89
|
},
|