@modern-js/prod-server 1.1.9 → 1.1.10-beta.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.
|
@@ -127,14 +127,24 @@ export class Server {
|
|
|
127
127
|
}));
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
listen(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
listener
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
listen(options, listener) {
|
|
131
|
+
if (typeof options === 'object') {
|
|
132
|
+
this.app.listen(options, () => {
|
|
133
|
+
if (listener) {
|
|
134
|
+
listener();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
this.server.onListening(this.app);
|
|
138
|
+
});
|
|
139
|
+
} else {
|
|
140
|
+
this.app.listen(process.env.PORT || options || 8080, () => {
|
|
141
|
+
if (listener) {
|
|
142
|
+
listener();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
this.server.onListening(this.app);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
138
148
|
}
|
|
139
149
|
|
|
140
150
|
getRequestHandler() {
|
|
@@ -147,14 +147,24 @@ class Server {
|
|
|
147
147
|
}));
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
listen(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
listener
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
150
|
+
listen(options, listener) {
|
|
151
|
+
if (typeof options === 'object') {
|
|
152
|
+
this.app.listen(options, () => {
|
|
153
|
+
if (listener) {
|
|
154
|
+
listener();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
this.server.onListening(this.app);
|
|
158
|
+
});
|
|
159
|
+
} else {
|
|
160
|
+
this.app.listen(process.env.PORT || options || 8080, () => {
|
|
161
|
+
if (listener) {
|
|
162
|
+
listener();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
this.server.onListening(this.app);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
158
168
|
}
|
|
159
169
|
|
|
160
170
|
getRequestHandler() {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
3
|
+
import type { ListenOptions } from 'net';
|
|
2
4
|
import { ModernServerOptions, ServerConstructor } from '../type';
|
|
3
5
|
export declare class Server {
|
|
4
6
|
options: ModernServerOptions;
|
|
@@ -39,7 +41,7 @@ export declare class Server {
|
|
|
39
41
|
|
|
40
42
|
private initConfig;
|
|
41
43
|
close(): Promise<void>;
|
|
42
|
-
listen
|
|
44
|
+
listen<T extends number | ListenOptions | undefined>(options: T, listener: any): void;
|
|
43
45
|
getRequestHandler(): (req: IncomingMessage, res: ServerResponse, next?: () => void) => void;
|
|
44
46
|
private createHookRunner;
|
|
45
47
|
private injectContext;
|
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.10-beta.0",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@modern-js/utils": "^1.7.
|
|
31
|
+
"@modern-js/utils": "^1.7.11",
|
|
32
32
|
"@babel/compat-data": "^7.17.10",
|
|
33
33
|
"@modern-js/server-core": "^1.4.0",
|
|
34
34
|
"axios": "^0.24.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@modern-js/types": "1.5.5",
|
|
47
|
-
"@modern-js/core": "1.12.
|
|
47
|
+
"@modern-js/core": "1.12.4",
|
|
48
48
|
"@scripts/jest-config": "0.0.0",
|
|
49
49
|
"@scripts/build": "0.0.0",
|
|
50
50
|
"@types/cookie": "^0.4.1",
|
|
@@ -67,7 +67,8 @@
|
|
|
67
67
|
},
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public",
|
|
70
|
-
"registry": "https://registry.npmjs.org/"
|
|
70
|
+
"registry": "https://registry.npmjs.org/",
|
|
71
|
+
"types": "./dist/types/index.d.ts"
|
|
71
72
|
},
|
|
72
73
|
"wireit": {
|
|
73
74
|
"build": {
|