@modern-js/prod-server 1.1.3 → 1.1.4
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 +10 -0
- package/dist/js/modern/libs/context/context.js +1 -1
- package/dist/js/modern/libs/proxy.js +2 -2
- package/dist/js/modern/server/modern-server.js +2 -2
- package/dist/js/node/libs/context/context.js +1 -1
- package/dist/js/node/libs/proxy.js +2 -2
- package/dist/js/node/server/modern-server.js +2 -2
- package/package.json +4 -5
- package/src/libs/context/context.ts +1 -1
- package/src/libs/proxy.ts +2 -2
- package/src/server/modern-server.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @modern-js/prod-server
|
|
2
2
|
|
|
3
|
+
## 1.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 69a728375: fix: remove exports.jsnext:source after publish
|
|
8
|
+
- Updated dependencies [cd7346b0d]
|
|
9
|
+
- Updated dependencies [69a728375]
|
|
10
|
+
- @modern-js/utils@1.7.2
|
|
11
|
+
- @modern-js/server-core@1.3.4
|
|
12
|
+
|
|
3
13
|
## 1.1.3
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -121,7 +121,7 @@ export class ModernServerContext {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
set path(p) {
|
|
124
|
-
const url = new URL(this.req.url, this.origin); // this should never
|
|
124
|
+
const url = new URL(this.req.url, this.origin); // this should never happened
|
|
125
125
|
|
|
126
126
|
if (!url || !p) {
|
|
127
127
|
return;
|
|
@@ -10,8 +10,8 @@ export const createProxyHandler = proxyOptions => {
|
|
|
10
10
|
// or an object in the form of { source: ProxyDetail }
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
const middlewares =
|
|
13
|
+
const formattedProxy = formatProxyOptions(proxyOptions);
|
|
14
|
+
const middlewares = formattedProxy.map(option => {
|
|
15
15
|
const middleware = createProxyMiddleware(option.context, option); // eslint-disable-next-line consistent-return
|
|
16
16
|
|
|
17
17
|
return async (ctx, next) => {
|
|
@@ -294,7 +294,7 @@ export class ModernServer {
|
|
|
294
294
|
} = context;
|
|
295
295
|
|
|
296
296
|
if (!this.frameAPIHandler) {
|
|
297
|
-
throw new Error('can not found api
|
|
297
|
+
throw new Error('can not found api handler');
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
await this.frameAPIHandler(req, res);
|
|
@@ -555,7 +555,7 @@ export class ModernServer {
|
|
|
555
555
|
const route = matched.generate(context.url);
|
|
556
556
|
const {
|
|
557
557
|
entryName
|
|
558
|
-
} = route; // check entryName,
|
|
558
|
+
} = route; // check entryName, avoid matched '/' route
|
|
559
559
|
|
|
560
560
|
if (entryName === status.toString() || entryName === '_error') {
|
|
561
561
|
try {
|
|
@@ -132,7 +132,7 @@ class ModernServerContext {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
set path(p) {
|
|
135
|
-
const url = new _url.URL(this.req.url, this.origin); // this should never
|
|
135
|
+
const url = new _url.URL(this.req.url, this.origin); // this should never happened
|
|
136
136
|
|
|
137
137
|
if (!url || !p) {
|
|
138
138
|
return;
|
|
@@ -20,8 +20,8 @@ const createProxyHandler = proxyOptions => {
|
|
|
20
20
|
// or an object in the form of { source: ProxyDetail }
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
const
|
|
24
|
-
const middlewares =
|
|
23
|
+
const formattedProxy = (0, _utils.formatProxyOptions)(proxyOptions);
|
|
24
|
+
const middlewares = formattedProxy.map(option => {
|
|
25
25
|
const middleware = (0, _httpProxyMiddleware.createProxyMiddleware)(option.context, option); // eslint-disable-next-line consistent-return
|
|
26
26
|
|
|
27
27
|
return async (ctx, next) => {
|
|
@@ -327,7 +327,7 @@ class ModernServer {
|
|
|
327
327
|
} = context;
|
|
328
328
|
|
|
329
329
|
if (!this.frameAPIHandler) {
|
|
330
|
-
throw new Error('can not found api
|
|
330
|
+
throw new Error('can not found api handler');
|
|
331
331
|
}
|
|
332
332
|
|
|
333
333
|
await this.frameAPIHandler(req, res);
|
|
@@ -589,7 +589,7 @@ class ModernServer {
|
|
|
589
589
|
const route = matched.generate(context.url);
|
|
590
590
|
const {
|
|
591
591
|
entryName
|
|
592
|
-
} = route; // check entryName,
|
|
592
|
+
} = route; // check entryName, avoid matched '/' route
|
|
593
593
|
|
|
594
594
|
if (entryName === status.toString() || entryName === '_error') {
|
|
595
595
|
try {
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.1.
|
|
14
|
+
"version": "1.1.4",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@modern-js/utils": "^1.7.
|
|
31
|
+
"@modern-js/utils": "^1.7.2",
|
|
32
32
|
"@babel/compat-data": "^7.17.0",
|
|
33
|
-
"@modern-js/server-core": "^1.3.
|
|
33
|
+
"@modern-js/server-core": "^1.3.4",
|
|
34
34
|
"axios": "^0.24.0",
|
|
35
35
|
"compare-versions": "^3.6.0",
|
|
36
36
|
"cookie": "^0.4.2",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@modern-js/types": "1.5.2",
|
|
47
|
-
"@modern-js/core": "1.10.
|
|
47
|
+
"@modern-js/core": "1.10.1",
|
|
48
48
|
"@scripts/jest-config": "0.0.0",
|
|
49
49
|
"@scripts/build": "0.0.0",
|
|
50
50
|
"@types/cookie": "^0.4.1",
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"@types/node": "^14",
|
|
55
55
|
"@types/serve-static": "^1.13.10",
|
|
56
56
|
"@types/ua-parser-js": "^0.7.36",
|
|
57
|
-
"del-cli": "^4.0.1",
|
|
58
57
|
"jest": "^27",
|
|
59
58
|
"node-mocks-http": "^1.11.0",
|
|
60
59
|
"portfinder": "^1.0.28",
|
|
@@ -125,7 +125,7 @@ export class ModernServerContext implements ModernServerContextInterface {
|
|
|
125
125
|
|
|
126
126
|
public set path(p) {
|
|
127
127
|
const url = new URL(this.req.url!, this.origin);
|
|
128
|
-
// this should never
|
|
128
|
+
// this should never happened
|
|
129
129
|
if (!url || !p) {
|
|
130
130
|
return;
|
|
131
131
|
}
|
package/src/libs/proxy.ts
CHANGED
|
@@ -14,9 +14,9 @@ export const createProxyHandler = (proxyOptions?: BffProxyOptions) => {
|
|
|
14
14
|
|
|
15
15
|
// If it is not an array, it may be an object that uses the context attribute
|
|
16
16
|
// or an object in the form of { source: ProxyDetail }
|
|
17
|
-
const
|
|
17
|
+
const formattedProxy = formatProxyOptions(proxyOptions);
|
|
18
18
|
|
|
19
|
-
const middlewares =
|
|
19
|
+
const middlewares = formattedProxy.map(option => {
|
|
20
20
|
const middleware = createProxyMiddleware(option.context!, option);
|
|
21
21
|
|
|
22
22
|
// eslint-disable-next-line consistent-return
|
|
@@ -349,7 +349,7 @@ export class ModernServer implements ModernServerInterface {
|
|
|
349
349
|
const { req, res } = context;
|
|
350
350
|
|
|
351
351
|
if (!this.frameAPIHandler) {
|
|
352
|
-
throw new Error('can not found api
|
|
352
|
+
throw new Error('can not found api handler');
|
|
353
353
|
}
|
|
354
354
|
|
|
355
355
|
await this.frameAPIHandler(req, res);
|
|
@@ -596,7 +596,7 @@ export class ModernServer implements ModernServerInterface {
|
|
|
596
596
|
if (matched) {
|
|
597
597
|
const route = matched.generate(context.url);
|
|
598
598
|
const { entryName } = route;
|
|
599
|
-
// check entryName,
|
|
599
|
+
// check entryName, avoid matched '/' route
|
|
600
600
|
if (entryName === status.toString() || entryName === '_error') {
|
|
601
601
|
try {
|
|
602
602
|
const file = await this.routeRenderHandler({
|