@modern-js/types 1.18.1 → 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 +10 -0
- package/package.json +4 -5
- 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",
|
|
@@ -48,6 +48,5 @@
|
|
|
48
48
|
"scripts": {
|
|
49
49
|
"test": "wireit"
|
|
50
50
|
},
|
|
51
|
-
"main": ""
|
|
52
|
-
"readme": "\n<p align=\"center\">\n <a href=\"https://modernjs.dev\" target=\"blank\"><img src=\"https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png\" width=\"300\" alt=\"Modern.js Logo\" /></a>\n</p>\n<p align=\"center\">\n现代 Web 工程体系\n <br/>\n <a href=\"https://modernjs.dev\" target=\"blank\">\n modernjs.dev\n </a>\n</p>\n<p align=\"center\">\n The meta-framework suite designed from scratch for frontend-focused modern web development\n</p>\n\n# Introduction\n\n> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.\n\n- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)\n\n## Getting Started\n\n- [Quick Start](https://modernjs.dev/docs/start)\n- [Guides](https://modernjs.dev/docs/guides)\n- [API References](https://modernjs.dev/docs/apis)\n\n## Contributing\n\n- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)\n"
|
|
51
|
+
"main": ""
|
|
53
52
|
}
|
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
|
};
|