@modern-js/server-core 2.58.0 → 2.58.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/dist/cjs/adapters/node/helper/loadConfig.js +3 -1
- package/dist/cjs/plugins/customServer/index.js +6 -3
- package/dist/esm/adapters/node/helper/loadConfig.js +3 -1
- package/dist/esm/plugins/customServer/index.js +5 -2
- package/dist/esm-node/adapters/node/helper/loadConfig.js +3 -1
- package/dist/esm-node/plugins/customServer/index.js +6 -3
- package/package.json +9 -8
|
@@ -34,6 +34,7 @@ __export(loadConfig_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(loadConfig_exports);
|
|
35
35
|
var import_path = __toESM(require("path"));
|
|
36
36
|
var import_utils = require("@modern-js/utils");
|
|
37
|
+
var import_flatted = require("flatted");
|
|
37
38
|
const requireConfig = (serverConfigPath) => {
|
|
38
39
|
if (import_utils.fs.pathExistsSync(serverConfigPath)) {
|
|
39
40
|
return (0, import_utils.compatRequire)(serverConfigPath);
|
|
@@ -75,7 +76,8 @@ function loadServerCliConfig(pwd, defaultConfig = {}) {
|
|
|
75
76
|
dev: {}
|
|
76
77
|
};
|
|
77
78
|
try {
|
|
78
|
-
|
|
79
|
+
const content = import_utils.fs.readFileSync(cliConfigPath, "utf-8");
|
|
80
|
+
cliConfig = (0, import_flatted.parse)(content);
|
|
79
81
|
} catch (_2) {
|
|
80
82
|
}
|
|
81
83
|
const mergedCliConfig = import_utils.lodash.merge(defaultConfig, cliConfig);
|
|
@@ -169,7 +169,7 @@ function isRedirect(headers, code) {
|
|
|
169
169
|
}
|
|
170
170
|
async function createMiddlewareContextFromHono(c) {
|
|
171
171
|
const loaderContext = (0, import_helper.getLoaderCtx)(c);
|
|
172
|
-
|
|
172
|
+
const rawRequest = c.req.raw;
|
|
173
173
|
const method = rawRequest.method.toUpperCase();
|
|
174
174
|
if (![
|
|
175
175
|
"GET",
|
|
@@ -184,11 +184,14 @@ async function createMiddlewareContextFromHono(c) {
|
|
|
184
184
|
method: rawRequest.method
|
|
185
185
|
};
|
|
186
186
|
init.duplex = "half";
|
|
187
|
-
|
|
187
|
+
c.req.raw = new Request(rawRequest.url, init);
|
|
188
188
|
}
|
|
189
189
|
return {
|
|
190
190
|
get request() {
|
|
191
|
-
return
|
|
191
|
+
return c.req.raw;
|
|
192
|
+
},
|
|
193
|
+
set request(request) {
|
|
194
|
+
c.req.raw = request;
|
|
192
195
|
},
|
|
193
196
|
get response() {
|
|
194
197
|
return c.res;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { compatRequire, fs, DEFAULT_SERVER_CONFIG, requireExistModule, ensureAbsolutePath, OUTPUT_CONFIG_FILE, lodash as _ } from "@modern-js/utils";
|
|
3
|
+
import { parse } from "flatted";
|
|
3
4
|
var requireConfig = function(serverConfigPath) {
|
|
4
5
|
if (fs.pathExistsSync(serverConfigPath)) {
|
|
5
6
|
return compatRequire(serverConfigPath);
|
|
@@ -43,7 +44,8 @@ function loadServerCliConfig(pwd) {
|
|
|
43
44
|
dev: {}
|
|
44
45
|
};
|
|
45
46
|
try {
|
|
46
|
-
|
|
47
|
+
var content = fs.readFileSync(cliConfigPath, "utf-8");
|
|
48
|
+
cliConfig = parse(content);
|
|
47
49
|
} catch (_2) {
|
|
48
50
|
}
|
|
49
51
|
var mergedCliConfig = _.merge(defaultConfig, cliConfig);
|
|
@@ -310,14 +310,17 @@ function _createMiddlewareContextFromHono() {
|
|
|
310
310
|
method: rawRequest.method
|
|
311
311
|
};
|
|
312
312
|
init.duplex = "half";
|
|
313
|
-
|
|
313
|
+
c.req.raw = new Request(rawRequest.url, init);
|
|
314
314
|
_state.label = 2;
|
|
315
315
|
case 2:
|
|
316
316
|
return [
|
|
317
317
|
2,
|
|
318
318
|
{
|
|
319
319
|
get request() {
|
|
320
|
-
return
|
|
320
|
+
return c.req.raw;
|
|
321
|
+
},
|
|
322
|
+
set request(request) {
|
|
323
|
+
c.req.raw = request;
|
|
321
324
|
},
|
|
322
325
|
get response() {
|
|
323
326
|
return c.res;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { compatRequire, fs, DEFAULT_SERVER_CONFIG, requireExistModule, ensureAbsolutePath, OUTPUT_CONFIG_FILE, lodash as _ } from "@modern-js/utils";
|
|
3
|
+
import { parse } from "flatted";
|
|
3
4
|
const requireConfig = (serverConfigPath) => {
|
|
4
5
|
if (fs.pathExistsSync(serverConfigPath)) {
|
|
5
6
|
return compatRequire(serverConfigPath);
|
|
@@ -41,7 +42,8 @@ function loadServerCliConfig(pwd, defaultConfig = {}) {
|
|
|
41
42
|
dev: {}
|
|
42
43
|
};
|
|
43
44
|
try {
|
|
44
|
-
|
|
45
|
+
const content = fs.readFileSync(cliConfigPath, "utf-8");
|
|
46
|
+
cliConfig = parse(content);
|
|
45
47
|
} catch (_2) {
|
|
46
48
|
}
|
|
47
49
|
const mergedCliConfig = _.merge(defaultConfig, cliConfig);
|
|
@@ -135,7 +135,7 @@ function isRedirect(headers, code) {
|
|
|
135
135
|
}
|
|
136
136
|
async function createMiddlewareContextFromHono(c) {
|
|
137
137
|
const loaderContext = getLoaderCtx(c);
|
|
138
|
-
|
|
138
|
+
const rawRequest = c.req.raw;
|
|
139
139
|
const method = rawRequest.method.toUpperCase();
|
|
140
140
|
if (![
|
|
141
141
|
"GET",
|
|
@@ -150,11 +150,14 @@ async function createMiddlewareContextFromHono(c) {
|
|
|
150
150
|
method: rawRequest.method
|
|
151
151
|
};
|
|
152
152
|
init.duplex = "half";
|
|
153
|
-
|
|
153
|
+
c.req.raw = new Request(rawRequest.url, init);
|
|
154
154
|
}
|
|
155
155
|
return {
|
|
156
156
|
get request() {
|
|
157
|
-
return
|
|
157
|
+
return c.req.raw;
|
|
158
|
+
},
|
|
159
|
+
set request(request) {
|
|
160
|
+
c.req.raw = request;
|
|
158
161
|
},
|
|
159
162
|
get response() {
|
|
160
163
|
return c.res;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.58.
|
|
18
|
+
"version": "2.58.1",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -48,13 +48,14 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@swc/helpers": "0.5.3",
|
|
50
50
|
"@web-std/fetch": "^4.2.1",
|
|
51
|
-
"@web-std/stream": "^1.0.3",
|
|
52
51
|
"@web-std/file": "^3.0.3",
|
|
52
|
+
"@web-std/stream": "^1.0.3",
|
|
53
|
+
"flatted": "^3.2.9",
|
|
53
54
|
"hono": "^3.12.2",
|
|
54
55
|
"ts-deepmerge": "7.0.0",
|
|
55
|
-
"@modern-js/plugin": "2.58.
|
|
56
|
-
"@modern-js/runtime-utils": "2.58.
|
|
57
|
-
"@modern-js/utils": "2.58.
|
|
56
|
+
"@modern-js/plugin": "2.58.1",
|
|
57
|
+
"@modern-js/runtime-utils": "2.58.1",
|
|
58
|
+
"@modern-js/utils": "2.58.1"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
61
|
"@types/jest": "^29",
|
|
@@ -64,9 +65,9 @@
|
|
|
64
65
|
"jest": "^29",
|
|
65
66
|
"ts-jest": "^29.1.0",
|
|
66
67
|
"typescript": "^5",
|
|
67
|
-
"@modern-js/types": "2.58.
|
|
68
|
-
"@scripts/build": "2.58.
|
|
69
|
-
"@scripts/jest-config": "2.58.
|
|
68
|
+
"@modern-js/types": "2.58.1",
|
|
69
|
+
"@scripts/build": "2.58.1",
|
|
70
|
+
"@scripts/jest-config": "2.58.1"
|
|
70
71
|
},
|
|
71
72
|
"sideEffects": false,
|
|
72
73
|
"publishConfig": {
|