@rspack/dev-server 0.0.0-20230130151959 → 0.0.0-20230207152928

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 (89) hide show
  1. package/CHANGELOG.md +31 -28
  2. package/LICENSE +1 -1
  3. package/dist/config.d.ts +19 -28
  4. package/dist/config.d.ts.map +1 -1
  5. package/dist/config.js +0 -143
  6. package/dist/config.js.map +1 -1
  7. package/dist/server.d.ts +10 -15
  8. package/dist/server.d.ts.map +1 -1
  9. package/dist/server.js +218 -231
  10. package/dist/server.js.map +1 -1
  11. package/jest.config.js +3 -1
  12. package/package.json +6 -6
  13. package/src/config.ts +20 -180
  14. package/src/server.ts +272 -259
  15. package/tests/__snapshots__/normalizeOptions.test.ts.snap +182 -20
  16. package/tests/e2e/hot-reaload.test.ts +9 -109
  17. package/tests/e2e-fixtures/react/node_modules/react/LICENSE +21 -0
  18. package/tests/e2e-fixtures/react/node_modules/react/README.md +37 -0
  19. package/tests/e2e-fixtures/react/node_modules/react/cjs/react-jsx-dev-runtime.development.js +1296 -0
  20. package/tests/e2e-fixtures/react/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js +10 -0
  21. package/tests/e2e-fixtures/react/node_modules/react/cjs/react-jsx-dev-runtime.profiling.min.js +10 -0
  22. package/tests/e2e-fixtures/react/node_modules/react/cjs/react-jsx-runtime.development.js +1314 -0
  23. package/tests/e2e-fixtures/react/node_modules/react/cjs/react-jsx-runtime.production.min.js +11 -0
  24. package/tests/e2e-fixtures/react/node_modules/react/cjs/react-jsx-runtime.profiling.min.js +11 -0
  25. package/tests/e2e-fixtures/react/node_modules/react/cjs/react.development.js +2739 -0
  26. package/tests/e2e-fixtures/react/node_modules/react/cjs/react.production.min.js +26 -0
  27. package/tests/e2e-fixtures/react/node_modules/react/cjs/react.shared-subset.development.js +20 -0
  28. package/tests/e2e-fixtures/react/node_modules/react/cjs/react.shared-subset.production.min.js +10 -0
  29. package/tests/e2e-fixtures/react/node_modules/react/index.js +7 -0
  30. package/tests/e2e-fixtures/react/node_modules/react/jsx-dev-runtime.js +7 -0
  31. package/tests/e2e-fixtures/react/node_modules/react/jsx-runtime.js +7 -0
  32. package/tests/e2e-fixtures/react/node_modules/react/package.json +47 -0
  33. package/tests/e2e-fixtures/react/node_modules/react/react.shared-subset.js +7 -0
  34. package/tests/e2e-fixtures/react/node_modules/react/umd/react.development.js +3342 -0
  35. package/tests/e2e-fixtures/react/node_modules/react/umd/react.production.min.js +31 -0
  36. package/tests/e2e-fixtures/react/node_modules/react/umd/react.profiling.min.js +31 -0
  37. package/tests/e2e-fixtures/react/node_modules/react-dom/LICENSE +21 -0
  38. package/tests/e2e-fixtures/react/node_modules/react-dom/README.md +60 -0
  39. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js +7018 -0
  40. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +93 -0
  41. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js +7078 -0
  42. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.min.js +101 -0
  43. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-server.browser.development.js +7003 -0
  44. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js +96 -0
  45. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-server.node.development.js +7059 -0
  46. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-server.node.production.min.js +102 -0
  47. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-test-utils.development.js +1741 -0
  48. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom-test-utils.production.min.js +40 -0
  49. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom.development.js +29868 -0
  50. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom.production.min.js +323 -0
  51. package/tests/e2e-fixtures/react/node_modules/react-dom/cjs/react-dom.profiling.min.js +367 -0
  52. package/tests/e2e-fixtures/react/node_modules/react-dom/client.js +25 -0
  53. package/tests/e2e-fixtures/react/node_modules/react-dom/index.js +38 -0
  54. package/tests/e2e-fixtures/react/node_modules/react-dom/package.json +62 -0
  55. package/tests/e2e-fixtures/react/node_modules/react-dom/profiling.js +38 -0
  56. package/tests/e2e-fixtures/react/node_modules/react-dom/server.browser.js +17 -0
  57. package/tests/e2e-fixtures/react/node_modules/react-dom/server.js +3 -0
  58. package/tests/e2e-fixtures/react/node_modules/react-dom/server.node.js +17 -0
  59. package/tests/e2e-fixtures/react/node_modules/react-dom/test-utils.js +7 -0
  60. package/tests/e2e-fixtures/react/node_modules/react-dom/umd/react-dom-server-legacy.browser.development.js +7015 -0
  61. package/tests/e2e-fixtures/react/node_modules/react-dom/umd/react-dom-server-legacy.browser.production.min.js +75 -0
  62. package/tests/e2e-fixtures/react/node_modules/react-dom/umd/react-dom-server.browser.development.js +7000 -0
  63. package/tests/e2e-fixtures/react/node_modules/react-dom/umd/react-dom-server.browser.production.min.js +76 -0
  64. package/tests/e2e-fixtures/react/node_modules/react-dom/umd/react-dom-test-utils.development.js +1737 -0
  65. package/tests/e2e-fixtures/react/node_modules/react-dom/umd/react-dom-test-utils.production.min.js +33 -0
  66. package/tests/e2e-fixtures/react/node_modules/react-dom/umd/react-dom.development.js +29869 -0
  67. package/tests/e2e-fixtures/react/node_modules/react-dom/umd/react-dom.production.min.js +267 -0
  68. package/tests/e2e-fixtures/react/node_modules/react-dom/umd/react-dom.profiling.min.js +285 -0
  69. package/tests/e2e-fixtures/react/node_modules/scheduler/LICENSE +21 -0
  70. package/tests/e2e-fixtures/react/node_modules/scheduler/README.md +9 -0
  71. package/tests/e2e-fixtures/react/node_modules/scheduler/cjs/scheduler-unstable_mock.development.js +700 -0
  72. package/tests/e2e-fixtures/react/node_modules/scheduler/cjs/scheduler-unstable_mock.production.min.js +20 -0
  73. package/tests/e2e-fixtures/react/node_modules/scheduler/cjs/scheduler-unstable_post_task.development.js +207 -0
  74. package/tests/e2e-fixtures/react/node_modules/scheduler/cjs/scheduler-unstable_post_task.production.min.js +14 -0
  75. package/tests/e2e-fixtures/react/node_modules/scheduler/cjs/scheduler.development.js +634 -0
  76. package/tests/e2e-fixtures/react/node_modules/scheduler/cjs/scheduler.production.min.js +19 -0
  77. package/tests/e2e-fixtures/react/node_modules/scheduler/index.js +7 -0
  78. package/tests/e2e-fixtures/react/node_modules/scheduler/package.json +36 -0
  79. package/tests/e2e-fixtures/react/node_modules/scheduler/umd/scheduler-unstable_mock.development.js +699 -0
  80. package/tests/e2e-fixtures/react/node_modules/scheduler/umd/scheduler-unstable_mock.production.min.js +19 -0
  81. package/tests/e2e-fixtures/react/node_modules/scheduler/umd/scheduler.development.js +152 -0
  82. package/tests/e2e-fixtures/react/node_modules/scheduler/umd/scheduler.production.min.js +146 -0
  83. package/tests/e2e-fixtures/react/node_modules/scheduler/umd/scheduler.profiling.min.js +146 -0
  84. package/tests/e2e-fixtures/react/node_modules/scheduler/unstable_mock.js +7 -0
  85. package/tests/e2e-fixtures/react/node_modules/scheduler/unstable_post_task.js +7 -0
  86. package/tests/e2e-fixtures/react/package.json +2 -0
  87. package/tests/e2e-fixtures/react/webpack.config.js +6 -2
  88. package/tests/normalizeOptions.test.ts +58 -16
  89. package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -1,33 +1,36 @@
1
1
  # rspack-dev-server
2
2
 
3
- ## 0.0.0-20230130151959
4
-
5
- ### Patch Changes
6
-
7
- - 59edc2cb: fix watch options
8
- - 290bf7fb: feat: add devServer.historyApiFallback options
9
- - Updated dependencies [361f9a53]
10
- - Updated dependencies [ce31cd02]
11
- - Updated dependencies [59edc2cb]
12
- - Updated dependencies [b77074df]
13
- - Updated dependencies [c65ca69e]
14
- - Updated dependencies [4de9eea6]
15
- - Updated dependencies [8a4cb9a3]
16
- - Updated dependencies [9c90398a]
17
- - Updated dependencies [290bf7fb]
18
- - Updated dependencies [86ed1218]
19
- - Updated dependencies [792304dd]
20
- - Updated dependencies [6d4f3e62]
21
- - Updated dependencies [3fcfa746]
22
- - Updated dependencies [cb93bb42]
23
- - Updated dependencies [2f4db99e]
24
- - Updated dependencies [5e722adf]
25
- - Updated dependencies [0269ff40]
26
- - Updated dependencies [70586d79]
27
- - @rspack/core@0.0.0-20230130151959
28
- - @rspack/dev-middleware@0.0.0-20230130151959
29
- - @rspack/dev-client@0.0.0-20230130151959
30
- - @rspack/dev-server@0.0.0-20230130151959
3
+ ## 0.0.0-20230207152928
4
+
5
+ ### Patch Changes
6
+
7
+ - 962f8a251: fix: should create different module with different module rule
8
+ - 766c94042: fix rust test
9
+ - Updated dependencies [962f8a251]
10
+ - Updated dependencies [766c94042]
11
+ - @rspack/core@0.0.0-20230207152928
12
+ - @rspack/dev-client@0.0.0-20230207152928
13
+ - @rspack/dev-middleware@0.0.0-20230207152928
14
+ - @rspack/dev-server@0.0.0-20230207152928
15
+
16
+ ## 0.0.22
17
+
18
+ ### Patch Changes
19
+
20
+ - 59edc2cb4: fix watch options
21
+ - ac02a096e: fix: getRspackMemoryAssets failed to get index.html when request path is /
22
+ feat: extends webpack-dev-server
23
+ - 290bf7fb5: feat: add devServer.historyApiFallback options
24
+ - d88ffa666: feat: support devServer.client.webSocketUrl
25
+ - Updated dependencies [ce31cd029]
26
+ - Updated dependencies [59edc2cb4]
27
+ - Updated dependencies [ac02a096e]
28
+ - Updated dependencies [290bf7fb5]
29
+ - Updated dependencies [d88ffa666]
30
+ - Updated dependencies [0269ff40d]
31
+ - @rspack/dev-middleware@0.0.22
32
+ - @rspack/dev-client@0.0.22
33
+ - @rspack/dev-server@0.0.22
31
34
 
32
35
  ## 0.0.21
33
36
 
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022-present Rspack
3
+ Copyright (c) 2022-present Rspack Authors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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.ClientConfiguration;
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,CAAC;IAC1C,OAAO,EAAE;QACR,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACD,CAAC;AAEL,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,MAAM,EAAE;QACP,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,KAAK,GAAG,YAAY,CAAC;KAC5B,CAAC;IACF,aAAa,EAAE,EAAE,CAAC;IAClB,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,4BAA4B,CAAC;IAC9C,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,aAAa,CAAC;IACtB,kBAAkB,EAAE,KAAK,GAAG,gCAAgC,CAAC;CAC7D;AAcD,wBAAgB,iBAAi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 -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,MAAA,KAAK,CAAC,OAAO,mCAAI;QAChC,YAAY;QACZ,oBAAoB;QACpB,YAAY;KACZ,CAAC;IACF,OAAO;QACN,GAAG,KAAK;QACR,OAAO;KACP,CAAC;AACH,CAAC;AAED,SAAgB,iBAAiB,CAChC,OAAY,EACZ,eAAwC;;IAExC,MAAM,IAAI,GAAG,IAAI,CAAC;IAClB,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC5B,MAAM,GAAG,GAAG,MAAA,OAAO,CAAC,GAAG,mCAAI,IAAI,CAAC;IAChC,aAAa;IACb,MAAM,SAAS,GACd,MAAA,MAAA,OAAO,CAAC,MAAM,0CAAE,SAAS,mCACzB,cAAI,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpE,IAAI,KAAK,GAAyB,EAAE,CAAC;IACrC,IAAI,CAAA,MAAA,OAAO,CAAC,MAAM,0CAAE,KAAK,MAAK,KAAK,EAAE;QACpC,KAAK,GAAG,KAAK,CAAC;KACd;SAAM,IAAI,CAAA,MAAA,OAAO,CAAC,MAAM,0CAAE,KAAK,MAA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AAO,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,CAAC;AAI5C,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAIlD,qBAAa,eAAgB,SAAQ,gBAAgB;IACpD,OAAO,EAAE,WAAW,CAAC;IACrB,cAAc,EAAE,SAAS,EAAE,CAAC;IAC5B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,UAAU,CAAyB;IAEpC,QAAQ,EAAE,QAAQ,CAAC;IAC1B,eAAe,EAAE,gBAAgB,CAAC,6BAA6B,GAAG,SAAS,CAAC;gBAEhE,QAAQ,EAAE,QAAQ;IAU9B,gBAAgB,CAAC,GAAG,GAAE,GAAQ;IAI9B,sBAAsB;IAiBtB,kBAAkB;IA0BlB,MAAM,CAAC,YAAY,IAAI,MAAM;IAK7B,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI;IAwB3E,kBAAkB,IAAI,MAAM;IAmEtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAwCtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAgC3B,OAAO,CAAC,QA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