@rspack/dev-server 1.2.1 → 2.0.0-beta.2

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 (47) hide show
  1. package/README.md +17 -17
  2. package/client/clients/WebSocketClient.d.ts +17 -0
  3. package/client/clients/WebSocketClient.js +28 -28
  4. package/client/index.d.ts +17 -0
  5. package/client/index.js +224 -363
  6. package/client/modules/logger/Logger.d.ts +40 -0
  7. package/client/modules/logger/Logger.js +123 -0
  8. package/client/modules/logger/createConsoleLogger.d.ts +12 -0
  9. package/client/modules/logger/createConsoleLogger.js +119 -0
  10. package/client/modules/logger/index.d.ts +18 -0
  11. package/client/modules/logger/index.js +20 -712
  12. package/client/modules/types.d.ts +45 -0
  13. package/client/modules/types.js +17 -0
  14. package/client/overlay.d.ts +44 -0
  15. package/client/overlay.js +243 -292
  16. package/client/progress.d.ts +11 -0
  17. package/client/progress.js +178 -111
  18. package/client/socket.d.ts +15 -0
  19. package/client/socket.js +19 -46
  20. package/client/utils/ansiHTML.d.ts +30 -0
  21. package/client/utils/ansiHTML.js +98 -145
  22. package/client/utils/log.d.ts +13 -0
  23. package/client/utils/log.js +7 -17
  24. package/{dist/servers/SockJSServer.d.ts → client/utils/sendMessage.d.ts} +2 -1
  25. package/client/utils/sendMessage.js +6 -15
  26. package/dist/0~launch-editor.js +618 -0
  27. package/dist/0~open.js +547 -0
  28. package/dist/0~p-retry.js +158 -0
  29. package/dist/131.js +1398 -0
  30. package/dist/config.d.ts +1 -3
  31. package/dist/getPort.d.ts +4 -1
  32. package/dist/index.js +1 -5
  33. package/dist/rslib-runtime.js +66 -0
  34. package/dist/server.d.ts +7 -18
  35. package/dist/servers/WebsocketServer.d.ts +8 -1
  36. package/dist/types.d.ts +14 -29
  37. package/package.json +74 -103
  38. package/client/clients/SockJSClient.js +0 -34
  39. package/client/modules/sockjs-client/index.js +0 -4506
  40. package/dist/config.js +0 -2
  41. package/dist/getPort.js +0 -131
  42. package/dist/options.json +0 -1034
  43. package/dist/server.js +0 -2222
  44. package/dist/servers/BaseServer.js +0 -20
  45. package/dist/servers/SockJSServer.js +0 -110
  46. package/dist/servers/WebsocketServer.js +0 -72
  47. package/dist/types.js +0 -5
@@ -0,0 +1,45 @@
1
+ import type { FilterTypes } from '@rspack/core';
2
+ export type EXPECTED_ANY = any;
3
+ export type FilterFunction = (item: string) => boolean;
4
+ export type LoggingFunction = (value: string, type: LogTypeEnum, args?: Args) => void;
5
+ export type LoggerConsole = {
6
+ clear: () => void;
7
+ trace: () => void;
8
+ info: (...args: Args) => void;
9
+ log: (...args: Args) => void;
10
+ warn: (...args: Args) => void;
11
+ error: (...args: Args) => void;
12
+ debug?: (...args: Args) => void;
13
+ group?: (...args: Args) => void;
14
+ groupCollapsed?: (...args: Args) => void;
15
+ groupEnd?: (...args: Args) => void;
16
+ status?: (...args: Args) => void;
17
+ profile?: (...args: Args) => void;
18
+ profileEnd?: (...args: Args) => void;
19
+ logTime?: (...args: Args) => void;
20
+ };
21
+ export type LoggerOptions = {
22
+ level: false | true | 'none' | 'error' | 'warn' | 'info' | 'log' | 'verbose';
23
+ debug: FilterTypes | boolean;
24
+ console: LoggerConsole;
25
+ };
26
+ export declare const LogType: Readonly<{
27
+ error: "error";
28
+ warn: "warn";
29
+ info: "info";
30
+ log: "log";
31
+ debug: "debug";
32
+ trace: "trace";
33
+ group: "group";
34
+ groupCollapsed: "groupCollapsed";
35
+ groupEnd: "groupEnd";
36
+ profile: "profile";
37
+ profileEnd: "profileEnd";
38
+ time: "time";
39
+ clear: "clear";
40
+ status: "status";
41
+ }>;
42
+ export type LogTypeEnum = (typeof LogType)[keyof typeof LogType];
43
+ export type TimersMap = Map<string | undefined, [number, number]>;
44
+ export type Args = EXPECTED_ANY[];
45
+ export type { FilterItemTypes } from '@rspack/core';
@@ -0,0 +1,17 @@
1
+ const LogType = Object.freeze({
2
+ error: 'error',
3
+ warn: 'warn',
4
+ info: 'info',
5
+ log: 'log',
6
+ debug: 'debug',
7
+ trace: 'trace',
8
+ group: 'group',
9
+ groupCollapsed: 'groupCollapsed',
10
+ groupEnd: 'groupEnd',
11
+ profile: 'profile',
12
+ profileEnd: 'profileEnd',
13
+ time: 'time',
14
+ clear: 'clear',
15
+ status: 'status'
16
+ });
17
+ export { LogType };
@@ -0,0 +1,44 @@
1
+ /**
2
+ * The following code is modified based on
3
+ * https://github.com/webpack/webpack-dev-server
4
+ *
5
+ * MIT Licensed
6
+ * Author Tobias Koppers @sokra
7
+ * Copyright (c) JS Foundation and other contributors
8
+ * https://github.com/webpack/webpack-dev-server/blob/main/LICENSE
9
+ */
10
+ type Message = Error & {
11
+ file?: string;
12
+ moduleName?: string;
13
+ moduleIdentifier?: string;
14
+ loc?: string;
15
+ message?: string;
16
+ stack?: string | string[];
17
+ };
18
+ type Event = {
19
+ type: string;
20
+ } & Record<string, any>;
21
+ type StateMachine = {
22
+ send: (event: Event) => void;
23
+ };
24
+ declare const formatProblem: (type: "warning" | "error", item: string | Message) => {
25
+ header: string;
26
+ body: string;
27
+ };
28
+ type CreateOverlayOptions = {
29
+ /** Trusted types policy name. If false, disables trusted types. */
30
+ trustedTypesPolicyName?: false | string;
31
+ /** Runtime error catcher. If boolean, enables/disables catching. If function, handles the error. */
32
+ catchRuntimeError?: boolean | ((error: Error) => void);
33
+ };
34
+ declare global {
35
+ interface Window {
36
+ trustedTypes?: {
37
+ createPolicy: (name: string, policy: {
38
+ createHTML: (value: string) => string;
39
+ }) => TrustedTypePolicy;
40
+ };
41
+ }
42
+ }
43
+ declare const createOverlay: (options: CreateOverlayOptions) => StateMachine;
44
+ export { createOverlay, formatProblem };