@modern-js/types 1.19.0 → 1.20.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 +8 -0
- package/package.json +3 -3
- package/server/devServer.d.ts +34 -3
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.20.0",
|
|
15
15
|
"types": "./index.d.ts",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": "./index.d.ts",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@scripts/build": "1.
|
|
25
|
-
"@scripts/jest-config": "1.
|
|
24
|
+
"@scripts/build": "1.20.0",
|
|
25
|
+
"@scripts/jest-config": "1.20.0",
|
|
26
26
|
"@types/jest": "^27",
|
|
27
27
|
"@types/node": "^14",
|
|
28
28
|
"http-proxy-middleware": "^2.0.4",
|
package/server/devServer.d.ts
CHANGED
|
@@ -9,15 +9,19 @@ export type RequestHandler = (
|
|
|
9
9
|
next: NextFunction,
|
|
10
10
|
) => void;
|
|
11
11
|
|
|
12
|
+
export type ExposeServerApis = {
|
|
13
|
+
sockWrite: (
|
|
14
|
+
type: string,
|
|
15
|
+
data?: string | boolean | Record<string, any>,
|
|
16
|
+
) => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
12
19
|
export type DevServerOptions = {
|
|
13
20
|
/** config of hmr client. */
|
|
14
21
|
client?: {
|
|
15
22
|
path?: string;
|
|
16
23
|
port?: string;
|
|
17
24
|
host?: string;
|
|
18
|
-
logging?: string;
|
|
19
|
-
overlay?: boolean;
|
|
20
|
-
progress?: boolean;
|
|
21
25
|
};
|
|
22
26
|
devMiddleware?: {
|
|
23
27
|
writeToDisk: boolean | ((filename: string) => boolean);
|
|
@@ -26,6 +30,19 @@ export type DevServerOptions = {
|
|
|
26
30
|
headers?: Record<string, string>;
|
|
27
31
|
before?: RequestHandler[];
|
|
28
32
|
after?: RequestHandler[];
|
|
33
|
+
/** Provides the ability to execute a custom function and apply custom middlewares */
|
|
34
|
+
setupMiddlewares?: Array<
|
|
35
|
+
(
|
|
36
|
+
/** Order: `devServer.before` => `unshift` => internal middlewares => `push` => `devServer.after` */
|
|
37
|
+
middlewares: {
|
|
38
|
+
/** Use the `unshift` method if you want to run a middleware before all other middlewares */
|
|
39
|
+
unshift: (...handlers: RequestHandler[]) => void;
|
|
40
|
+
/** Use the `push` method if you want to run a middleware after all other middlewares */
|
|
41
|
+
push: (...handlers: RequestHandler[]) => void;
|
|
42
|
+
},
|
|
43
|
+
server: ExposeServerApis,
|
|
44
|
+
) => void
|
|
45
|
+
>;
|
|
29
46
|
/** Whether to watch files change. */
|
|
30
47
|
watch?: boolean;
|
|
31
48
|
/** Whether to enable hot reload. */
|
|
@@ -34,5 +51,19 @@ export type DevServerOptions = {
|
|
|
34
51
|
liveReload?: boolean;
|
|
35
52
|
/** Whether to enable https. */
|
|
36
53
|
https?: DevServerHttpsOptions;
|
|
54
|
+
/** see https://github.com/bripkens/connect-history-api-fallback */
|
|
55
|
+
historyApiFallback?:
|
|
56
|
+
| boolean
|
|
57
|
+
| {
|
|
58
|
+
index?: string;
|
|
59
|
+
verbose?: boolean;
|
|
60
|
+
logger?: typeof console.log;
|
|
61
|
+
htmlAcceptHeaders?: string[];
|
|
62
|
+
disableDotRule?: true;
|
|
63
|
+
rewrites?: Array<{
|
|
64
|
+
from: RegExp;
|
|
65
|
+
to: string | RegExp | function;
|
|
66
|
+
}>;
|
|
67
|
+
};
|
|
37
68
|
[propName: string]: any;
|
|
38
69
|
};
|