@rspack/dev-server 2.0.0-beta.1 → 2.0.0-beta.3

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 (44) hide show
  1. package/README.md +4 -3
  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 +241 -290
  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/type.d.ts +15 -0
  21. package/client/type.js +0 -0
  22. package/client/utils/ansiHTML.d.ts +30 -0
  23. package/client/utils/ansiHTML.js +106 -153
  24. package/client/utils/log.d.ts +13 -0
  25. package/client/utils/log.js +7 -17
  26. package/client/utils/sendMessage.d.ts +11 -0
  27. package/client/utils/sendMessage.js +6 -15
  28. package/dist/0~launch-editor.js +618 -0
  29. package/dist/0~open.js +547 -0
  30. package/dist/0~p-retry.js +158 -0
  31. package/dist/131.js +1402 -0
  32. package/dist/getPort.d.ts +4 -1
  33. package/dist/index.js +1 -5
  34. package/dist/rslib-runtime.js +66 -0
  35. package/dist/server.d.ts +10 -9
  36. package/dist/servers/WebsocketServer.d.ts +8 -1
  37. package/dist/types.d.ts +16 -14
  38. package/package.json +62 -65
  39. package/dist/config.js +0 -2
  40. package/dist/getPort.js +0 -141
  41. package/dist/server.js +0 -1971
  42. package/dist/servers/BaseServer.js +0 -20
  43. package/dist/servers/WebsocketServer.js +0 -72
  44. 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 };