@rspack/dev-server 0.0.0-20230130020622 → 0.0.0-20230204135256

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.
Files changed (88) hide show
  1. package/CHANGELOG.md +14 -5
  2. package/dist/config.d.ts +19 -28
  3. package/dist/config.d.ts.map +1 -1
  4. package/dist/config.js +0 -143
  5. package/dist/config.js.map +1 -1
  6. package/dist/server.d.ts +10 -15
  7. package/dist/server.d.ts.map +1 -1
  8. package/dist/server.js +105 -224
  9. package/dist/server.js.map +1 -1
  10. package/jest.config.js +3 -1
  11. package/package.json +6 -6
  12. package/src/config.ts +20 -180
  13. package/src/server.ts +120 -255
  14. package/tests/__snapshots__/normalizeOptions.test.ts.snap +177 -17
  15. package/tests/e2e/hot-reaload.test.ts +12 -109
  16. package/tests/e2e-fixtures/react/node_modules/react/LICENSE +21 -0
  17. package/tests/e2e-fixtures/react/node_modules/react/README.md +37 -0
  18. package/tests/e2e-fixtures/react/node_modules/react/cjs/react-jsx-dev-runtime.development.js +1296 -0
  19. package/tests/e2e-fixtures/react/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js +10 -0
  20. package/tests/e2e-fixtures/react/node_modules/react/cjs/react-jsx-dev-runtime.profiling.min.js +10 -0
  21. package/tests/e2e-fixtures/react/node_modules/react/cjs/react-jsx-runtime.development.js +1314 -0
  22. package/tests/e2e-fixtures/react/node_modules/react/cjs/react-jsx-runtime.production.min.js +11 -0
  23. package/tests/e2e-fixtures/react/node_modules/react/cjs/react-jsx-runtime.profiling.min.js +11 -0
  24. package/tests/e2e-fixtures/react/node_modules/react/cjs/react.development.js +2739 -0
  25. package/tests/e2e-fixtures/react/node_modules/react/cjs/react.production.min.js +26 -0
  26. package/tests/e2e-fixtures/react/node_modules/react/cjs/react.shared-subset.development.js +20 -0
  27. package/tests/e2e-fixtures/react/node_modules/react/cjs/react.shared-subset.production.min.js +10 -0
  28. package/tests/e2e-fixtures/react/node_modules/react/index.js +7 -0
  29. package/tests/e2e-fixtures/react/node_modules/react/jsx-dev-runtime.js +7 -0
  30. package/tests/e2e-fixtures/react/node_modules/react/jsx-runtime.js +7 -0
  31. package/tests/e2e-fixtures/react/node_modules/react/package.json +47 -0
  32. package/tests/e2e-fixtures/react/node_modules/react/react.shared-subset.js +7 -0
  33. package/tests/e2e-fixtures/react/node_modules/react/umd/react.development.js +3342 -0
  34. package/tests/e2e-fixtures/react/node_modules/react/umd/react.production.min.js +31 -0
  35. package/tests/e2e-fixtures/react/node_modules/react/umd/react.profiling.min.js +31 -0
  36. package/tests/e2e-fixtures/react/node_modules/react-dom/LICENSE +21 -0
  37. package/tests/e2e-fixtures/react/node_modules/react-dom/README.md +60 -0
  38. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js +7018 -0
  39. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +93 -0
  40. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js +7078 -0
  41. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.min.js +101 -0
  42. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-server.browser.development.js +7003 -0
  43. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js +96 -0
  44. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-server.node.development.js +7059 -0
  45. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-server.node.production.min.js +102 -0
  46. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-test-utils.development.js +1741 -0
  47. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-test-utils.production.min.js +40 -0
  48. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom.development.js +29868 -0
  49. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom.production.min.js +323 -0
  50. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom.profiling.min.js +367 -0
  51. package/tests/e2e-fixtures/react/node_modules/react-dom/client.js +25 -0
  52. package/tests/e2e-fixtures/react/node_modules/react-dom/index.js +38 -0
  53. package/tests/e2e-fixtures/react/node_modules/react-dom/package.json +62 -0
  54. package/tests/e2e-fixtures/react/node_modules/react-dom/profiling.js +38 -0
  55. package/tests/e2e-fixtures/react/node_modules/react-dom/server.browser.js +17 -0
  56. package/tests/e2e-fixtures/react/node_modules/react-dom/server.js +3 -0
  57. package/tests/e2e-fixtures/react/node_modules/react-dom/server.node.js +17 -0
  58. package/tests/e2e-fixtures/react/node_modules/react-dom/test-utils.js +7 -0
  59. package/tests/e2e-fixtures/react/node_modules/react-dom/umd/react-dom-server-legacy.browser.development.js +7015 -0
  60. package/tests/e2e-fixtures/react/node_modules/react-dom/umd/react-dom-server-legacy.browser.production.min.js +75 -0
  61. package/tests/e2e-fixtures/react/node_modules/react-dom/umd/react-dom-server.browser.development.js +7000 -0
  62. package/tests/e2e-fixtures/react/node_modules/react-dom/umd/react-dom-server.browser.production.min.js +76 -0
  63. package/tests/e2e-fixtures/react/node_modules/react-dom/umd/react-dom-test-utils.development.js +1737 -0
  64. package/tests/e2e-fixtures/react/node_modules/react-dom/umd/react-dom-test-utils.production.min.js +33 -0
  65. package/tests/e2e-fixtures/react/node_modules/react-dom/umd/react-dom.development.js +29869 -0
  66. package/tests/e2e-fixtures/react/node_modules/react-dom/umd/react-dom.production.min.js +267 -0
  67. package/tests/e2e-fixtures/react/node_modules/react-dom/umd/react-dom.profiling.min.js +285 -0
  68. package/tests/e2e-fixtures/react/node_modules/scheduler/LICENSE +21 -0
  69. package/tests/e2e-fixtures/react/node_modules/scheduler/README.md +9 -0
  70. package/tests/e2e-fixtures/react/node_modules/scheduler/cjs/scheduler-unstable_mock.development.js +700 -0
  71. package/tests/e2e-fixtures/react/node_modules/scheduler/cjs/scheduler-unstable_mock.production.min.js +20 -0
  72. package/tests/e2e-fixtures/react/node_modules/scheduler/cjs/scheduler-unstable_post_task.development.js +207 -0
  73. package/tests/e2e-fixtures/react/node_modules/scheduler/cjs/scheduler-unstable_post_task.production.min.js +14 -0
  74. package/tests/e2e-fixtures/react/node_modules/scheduler/cjs/scheduler.development.js +634 -0
  75. package/tests/e2e-fixtures/react/node_modules/scheduler/cjs/scheduler.production.min.js +19 -0
  76. package/tests/e2e-fixtures/react/node_modules/scheduler/index.js +7 -0
  77. package/tests/e2e-fixtures/react/node_modules/scheduler/package.json +36 -0
  78. package/tests/e2e-fixtures/react/node_modules/scheduler/umd/scheduler-unstable_mock.development.js +699 -0
  79. package/tests/e2e-fixtures/react/node_modules/scheduler/umd/scheduler-unstable_mock.production.min.js +19 -0
  80. package/tests/e2e-fixtures/react/node_modules/scheduler/umd/scheduler.development.js +152 -0
  81. package/tests/e2e-fixtures/react/node_modules/scheduler/umd/scheduler.production.min.js +146 -0
  82. package/tests/e2e-fixtures/react/node_modules/scheduler/umd/scheduler.profiling.min.js +146 -0
  83. package/tests/e2e-fixtures/react/node_modules/scheduler/unstable_mock.js +7 -0
  84. package/tests/e2e-fixtures/react/node_modules/scheduler/unstable_post_task.js +7 -0
  85. package/tests/e2e-fixtures/react/package.json +2 -0
  86. package/tests/e2e-fixtures/react/webpack.config.js +6 -2
  87. package/tests/normalizeOptions.test.ts +70 -16
  88. package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -1,31 +1,40 @@
1
1
  # rspack-dev-server
2
2
 
3
- ## 0.0.0-20230130020622
3
+ ## 0.0.0-20230204135256
4
4
 
5
5
  ### Patch Changes
6
6
 
7
7
  - 59edc2cb: fix watch options
8
+ - ac02a096: fix: getRspackMemoryAssets failed to get index.html when request path is /
9
+ feat: extends webpack-dev-server
8
10
  - 290bf7fb: feat: add devServer.historyApiFallback options
11
+ - Updated dependencies [361f9a53]
12
+ - Updated dependencies [ce31cd02]
9
13
  - Updated dependencies [59edc2cb]
10
14
  - Updated dependencies [b77074df]
11
15
  - Updated dependencies [c65ca69e]
12
16
  - Updated dependencies [4de9eea6]
17
+ - Updated dependencies [0bc720c7]
18
+ - Updated dependencies [ac02a096]
13
19
  - Updated dependencies [8a4cb9a3]
14
20
  - Updated dependencies [9c90398a]
15
21
  - Updated dependencies [290bf7fb]
16
22
  - Updated dependencies [86ed1218]
23
+ - Updated dependencies [126b2160]
17
24
  - Updated dependencies [792304dd]
18
25
  - Updated dependencies [6d4f3e62]
19
26
  - Updated dependencies [3fcfa746]
20
27
  - Updated dependencies [cb93bb42]
28
+ - Updated dependencies [6b95cf27]
21
29
  - Updated dependencies [2f4db99e]
30
+ - Updated dependencies [82ae10ca]
22
31
  - Updated dependencies [5e722adf]
23
32
  - Updated dependencies [0269ff40]
24
33
  - Updated dependencies [70586d79]
25
- - @rspack/core@0.0.0-20230130020622
26
- - @rspack/dev-client@0.0.0-20230130020622
27
- - @rspack/dev-middleware@0.0.0-20230130020622
28
- - @rspack/dev-server@0.0.0-20230130020622
34
+ - @rspack/core@0.0.0-20230204135256
35
+ - @rspack/dev-middleware@0.0.0-20230204135256
36
+ - @rspack/dev-client@0.0.0-20230204135256
37
+ - @rspack/dev-server@0.0.0-20230204135256
29
38
 
30
39
  ## 0.0.21
31
40
 
package/dist/config.d.ts CHANGED
@@ -1,33 +1,24 @@
1
- import type { Dev, RspackOptionsNormalized } from "@rspack/core";
2
- import type { WatchOptions } from "chokidar";
3
- import type { Options as ConnectHistoryApiFallbackOptions } from "connect-history-api-fallback";
4
- import { ProxyOptions, ClientOptions } from "@rspack/core/src/config/devServer";
5
- declare type WebSocketServerConfiguration = false | {
6
- type: "sockjs" | "ws" | string | Function;
7
- options: {
8
- protocol?: string;
9
- host?: string;
10
- port?: number;
11
- prefix?: string;
12
- path?: string;
13
- };
14
- };
15
- export interface ResolvedDev {
16
- host: string;
1
+ import WebpackDevServer from "webpack-dev-server";
2
+ import type { DevServer } from "@rspack/core";
3
+ export type { DevServer };
4
+ export interface ResolvedDevServer extends DevServer {
17
5
  port: number | string;
18
- static: {
19
- directory: string;
20
- watch: false | WatchOptions;
21
- };
22
- devMiddleware: {};
6
+ static: false | Array<WebpackDevServer.NormalizedStatic>;
7
+ devMiddleware: DevServer["devMiddleware"];
23
8
  hot: boolean;
24
- open: boolean;
9
+ open: WebpackDevServer.Open[];
10
+ magicHtml: boolean;
25
11
  liveReload: boolean;
26
- webSocketServer: WebSocketServerConfiguration;
27
- proxy: ProxyOptions;
28
- client: ClientOptions;
29
- historyApiFallback: false | ConnectHistoryApiFallbackOptions;
12
+ webSocketServer: false | WebpackDevServer.WebSocketServerConfiguration;
13
+ proxy: WebpackDevServer.ProxyConfigArray;
14
+ client: WebpackDevServer.Configuration["client"];
15
+ allowedHosts: "auto" | string[] | "all";
16
+ bonjour: false | Record<string, never> | WebpackDevServer.BonjourOptions;
17
+ compress: boolean;
18
+ historyApiFallback: false | WebpackDevServer.ConnectHistoryApiFallbackOptions;
19
+ server: WebpackDevServer.ServerConfiguration;
20
+ ipc: string | undefined;
21
+ setupExitSignals: boolean;
22
+ watchFiles: WebpackDevServer.WatchFiles[];
30
23
  }
31
- export declare function resolveDevOptions(options: Dev, compilerOptions: RspackOptionsNormalized): ResolvedDev;
32
- export {};
33
24
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,OAAO,IAAI,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAEhG,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEhF,aAAK,4BAA4B,GAC9B,KAAK,GACL;IACA,IAAI,EAAE,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ,CAA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,gBAAgB,CAAC,IAAI,EAAE,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,KAAK,GAAG,gBAAgB,CAAC,4BAA4B,CAAC;IACvE,KAAK,EAAE,gBAAgB,CAAC,gBAAgB,CAAC;IACzC,MAAM,EAAE,gBAAgB,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACjD,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,KAAK,CAAC;IACxC,OAAO,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,gBAAgB,CAAC,cAAc,CAAC;IACzE,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,KAAK,GAAG,gBAAgB,CAAC,gCAAgC,CAAC;IAC9E,MAAM,EAAE,gBAAgB,CAAC,mBAAmB,CAAC;IAC7C,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,gBAAgB,CAAC,UAAU,EAAE,CAAC;CAC1C"}
package/dist/config.js CHANGED
@@ -1,146 +1,3 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.resolveDevOptions = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- function resolveStaticWatchOptions(watch = {}) {
9
- var _a;
10
- const ignored = (_a = watch.ignored) !== null && _a !== void 0 ? _a : [
11
- "**/dist/**",
12
- "**/node_modules/**",
13
- "**/.git/**"
14
- ];
15
- return {
16
- ...watch,
17
- ignored
18
- };
19
- }
20
- function resolveDevOptions(options, compilerOptions) {
21
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
22
- const open = true;
23
- const proxy = options.proxy;
24
- const hot = (_a = options.hot) !== null && _a !== void 0 ? _a : true;
25
- // --- static
26
- const directory = (_c = (_b = options.static) === null || _b === void 0 ? void 0 : _b.directory) !== null && _c !== void 0 ? _c : path_1.default.resolve(compilerOptions.context, compilerOptions.output.path);
27
- let watch = {};
28
- if (((_d = options.static) === null || _d === void 0 ? void 0 : _d.watch) === false) {
29
- watch = false;
30
- }
31
- else if (((_e = options.static) === null || _e === void 0 ? void 0 : _e.watch) === true) {
32
- watch = resolveStaticWatchOptions({});
33
- }
34
- else if ((_f = options.static) === null || _f === void 0 ? void 0 : _f.watch) {
35
- watch = (_g = options.static) === null || _g === void 0 ? void 0 : _g.watch;
36
- }
37
- // ---
38
- const devMiddleware = (_h = options.devMiddleware) !== null && _h !== void 0 ? _h : {};
39
- const liveReload = (_j = options.liveReload) !== null && _j !== void 0 ? _j : true;
40
- if (typeof options.client === "undefined" ||
41
- (typeof options.client === "object" && options.client !== null)) {
42
- if (!options.client) {
43
- options.client = {};
44
- }
45
- if (typeof options.client.webSocketURL === "undefined") {
46
- options.client.webSocketURL = {};
47
- }
48
- else if (typeof options.client.webSocketURL === "string") {
49
- const parsedURL = new URL(options.client.webSocketURL);
50
- options.client.webSocketURL = {
51
- protocol: parsedURL.protocol,
52
- hostname: parsedURL.hostname,
53
- port: parsedURL.port.length > 0 ? Number(parsedURL.port) : "",
54
- pathname: parsedURL.pathname,
55
- username: parsedURL.username,
56
- password: parsedURL.password
57
- };
58
- }
59
- else if (typeof options.client.webSocketURL.port === "string") {
60
- options.client.webSocketURL.port = Number(options.client.webSocketURL.port);
61
- }
62
- // Enable client overlay by default
63
- if (typeof options.client.overlay === "undefined") {
64
- options.client.overlay = true;
65
- }
66
- else if (typeof options.client.overlay !== "boolean") {
67
- options.client.overlay = {
68
- errors: true,
69
- warnings: true,
70
- ...options.client.overlay
71
- };
72
- }
73
- if (typeof options.client.reconnect === "undefined") {
74
- options.client.reconnect = 10;
75
- }
76
- else if (options.client.reconnect === true) {
77
- options.client.reconnect = Infinity;
78
- }
79
- else if (options.client.reconnect === false) {
80
- options.client.reconnect = 0;
81
- }
82
- // Respect infrastructureLogging.level
83
- if (typeof options.client.logging === "undefined") {
84
- options.client.logging = compilerOptions.infrastructureLogging
85
- ? compilerOptions.infrastructureLogging.level
86
- : "info";
87
- }
88
- }
89
- const defaultWebSocketServerType = "ws";
90
- const defaultWebSocketServerOptions = { path: "/ws" };
91
- let webSocketServer;
92
- if (typeof options.webSocketServer === "undefined") {
93
- webSocketServer = {
94
- type: defaultWebSocketServerType,
95
- options: defaultWebSocketServerOptions
96
- };
97
- }
98
- else if (typeof options.webSocketServer === "boolean" &&
99
- !options.webSocketServer) {
100
- webSocketServer = false;
101
- }
102
- else if (typeof options.webSocketServer === "string" ||
103
- typeof options.webSocketServer === "function") {
104
- webSocketServer = {
105
- type: options.webSocketServer,
106
- options: defaultWebSocketServerOptions
107
- };
108
- }
109
- else {
110
- const { port } = options.webSocketServer.options;
111
- webSocketServer = {
112
- type: options.webSocketServer.type || defaultWebSocketServerType,
113
- options: {
114
- ...defaultWebSocketServerOptions,
115
- ...options.webSocketServer.options,
116
- port: typeof port === "string" ? Number(port) : port
117
- }
118
- };
119
- }
120
- let historyApiFallback;
121
- if (typeof options.historyApiFallback === "undefined") {
122
- historyApiFallback = false;
123
- }
124
- else if (typeof options.historyApiFallback === "boolean" &&
125
- options.historyApiFallback) {
126
- historyApiFallback = {};
127
- }
128
- return {
129
- host: options.host,
130
- port: options.port ? Number(options.port) : undefined,
131
- static: {
132
- directory,
133
- watch
134
- },
135
- devMiddleware,
136
- open,
137
- hot,
138
- liveReload,
139
- webSocketServer,
140
- proxy,
141
- client: options.client,
142
- historyApiFallback
143
- };
144
- }
145
- exports.resolveDevOptions = resolveDevOptions;
146
3
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;AAGA,gDAAwB;AAiCxB,SAAS,yBAAyB,CAAC,QAAsB,EAAE;;IAC1D,MAAM,OAAO,GAAG,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7B,OAAO,EAAE,6BAA6B;SACtC,CAAC;KACF;SAAM;QACN,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC;QACjD,eAAe,GAAG;YACjB,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,IAAI,IAAI,0BAA0B;YAChE,OAAO,EAAE;gBACR,GAAG,6BAA6B;gBAChC,GAAG,OAAO,CAAC,eAAe,CAAC,OAAO;gBAClC,IAAI,EAAE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;aACpD;SACD,CAAC;KACF;IAED,IAAI,kBAAqD,CAAC;IAC1D,IAAI,OAAO,OAAO,CAAC,kBAAkB,KAAK,WAAW,EAAE;QACtD,kBAAkB,GAAG,KAAK,CAAC;KAC3B;SAAM,IACN,OAAO,OAAO,CAAC,kBAAkB,KAAK,SAAS;QAC/C,OAAO,CAAC,kBAAkB,EACzB;QACD,kBAAkB,GAAG,EAAE,CAAC;KACxB;IAED,OAAO;QACN,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;QACrD,MAAM,EAAE;YACP,SAAS;YACT,KAAK;SACL;QACD,aAAa;QACb,IAAI;QACJ,GAAG;QACH,UAAU;QACV,eAAe;QACf,KAAK;QACL,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,kBAAkB;KAClB,CAAC;AACH,CAAC;AAzID,8CAyIC"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":""}
package/dist/server.d.ts CHANGED
@@ -1,33 +1,28 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
- import type { Compiler, Dev } from "@rspack/core";
3
+ import { Compiler, MultiCompiler } from "@rspack/core";
4
4
  import type { Socket } from "net";
5
5
  import type { FSWatcher, WatchOptions } from "chokidar";
6
6
  import type { Server } from "http";
7
- import type { ResolvedDev } from "./config";
8
7
  import WebpackDevServer from "webpack-dev-server";
8
+ import type { ResolvedDevServer, DevServer } from "./config";
9
9
  export declare class RspackDevServer extends WebpackDevServer {
10
- options: ResolvedDev;
10
+ /**
11
+ * resolved after `normalizedOptions`
12
+ */
13
+ options: ResolvedDevServer;
11
14
  staticWatchers: FSWatcher[];
12
15
  sockets: Socket[];
13
16
  server: Server;
14
- private middleware;
15
- compiler: Compiler;
17
+ compiler: Compiler | MultiCompiler;
16
18
  webSocketServer: WebpackDevServer.WebSocketServerImplementation | undefined;
17
- constructor(compiler: Compiler);
18
- normalizeOptions(dev?: Dev): ResolvedDev;
19
- rewriteCompilerOptions(): void;
20
- addAdditionEntires(): void;
21
- static findCacheDir(): string;
19
+ constructor(options: DevServer, compiler: Compiler | MultiCompiler);
20
+ addAdditionEntires(compiler: Compiler): void;
22
21
  watchFiles(watchPath: string | string[], watchOptions?: WatchOptions): void;
23
22
  getClientTransport(): string;
24
- start(): Promise<void>;
25
- stop(): Promise<void>;
26
- private setupApp;
27
- private setupWatchStaticFiles;
23
+ initialize(): Promise<void>;
28
24
  private setupDevMiddleware;
29
25
  private setupMiddlewares;
30
- private createServer;
31
26
  private setupHooks;
32
27
  }
33
28
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAClC,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,C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