@rspack/dev-server 2.0.1 → 2.0.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.
- package/package.json +25 -26
- package/client/clients/WebSocketClient.d.ts +0 -17
- package/client/clients/WebSocketClient.js +0 -32
- package/client/index.d.ts +0 -17
- package/client/index.js +0 -356
- package/client/modules/logger/Logger.d.ts +0 -39
- package/client/modules/logger/Logger.js +0 -121
- package/client/modules/logger/createConsoleLogger.d.ts +0 -12
- package/client/modules/logger/createConsoleLogger.js +0 -119
- package/client/modules/logger/index.d.ts +0 -26
- package/client/modules/logger/index.js +0 -32
- package/client/modules/types.d.ts +0 -45
- package/client/modules/types.js +0 -17
- package/client/overlay.d.ts +0 -47
- package/client/overlay.js +0 -454
- package/client/progress.d.ts +0 -11
- package/client/progress.js +0 -197
- package/client/socket.d.ts +0 -15
- package/client/socket.js +0 -34
- package/client/type.d.ts +0 -15
- package/client/type.js +0 -1
- package/client/utils/ansiHTML.d.ts +0 -30
- package/client/utils/ansiHTML.js +0 -195
- package/client/utils/log.d.ts +0 -13
- package/client/utils/log.js +0 -11
- package/client/utils/sendMessage.d.ts +0 -11
- package/client/utils/sendMessage.js +0 -8
- package/dist/0~chokidar.js +0 -1477
- package/dist/0~chokidar.js.LICENSE.txt +0 -1
- package/dist/0~connect-history-api-fallback.js +0 -76
- package/dist/0~connect-next.js +0 -1245
- package/dist/0~connect-next.js.LICENSE.txt +0 -57
- package/dist/0~debug.js +0 -621
- package/dist/0~http-proxy-middleware.js +0 -3807
- package/dist/0~http-proxy-middleware.js.LICENSE.txt +0 -34
- package/dist/0~launch-editor.js +0 -601
- package/dist/0~open.js +0 -555
- package/dist/0~p-retry.js +0 -161
- package/dist/0~serve-static.js +0 -1595
- package/dist/0~serve-static.js.LICENSE.txt +0 -108
- package/dist/198.js +0 -5113
- package/dist/index.d.ts +0 -1008
- package/dist/index.js +0 -1
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
import { type LoggerOptions, type LoggingFunction } from '../types.js';
|
|
11
|
-
declare const _default: ({ level, debug, console, }: LoggerOptions) => LoggingFunction;
|
|
12
|
-
export default _default;
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { LogType } from "../types.js";
|
|
2
|
-
const filterToFunction = (item)=>{
|
|
3
|
-
if ('string' == typeof item) {
|
|
4
|
-
const regExp = new RegExp(`[\\\\/]${item.replace(/[-[\]{}()*+?.\\^$|]/g, '\\$&')}([\\\\/]|$|!|\\?)`);
|
|
5
|
-
return (ident)=>regExp.test(ident);
|
|
6
|
-
}
|
|
7
|
-
if (item && 'object' == typeof item && 'function' == typeof item.test) return (ident)=>item.test(ident);
|
|
8
|
-
if ('function' == typeof item) return item;
|
|
9
|
-
if ('boolean' == typeof item) return ()=>item;
|
|
10
|
-
};
|
|
11
|
-
const LogLevel = {
|
|
12
|
-
none: 6,
|
|
13
|
-
false: 6,
|
|
14
|
-
error: 5,
|
|
15
|
-
warn: 4,
|
|
16
|
-
info: 3,
|
|
17
|
-
log: 2,
|
|
18
|
-
true: 2,
|
|
19
|
-
verbose: 1
|
|
20
|
-
};
|
|
21
|
-
const createConsoleLogger = ({ level = 'info', debug = false, console })=>{
|
|
22
|
-
const debugFilters = 'boolean' == typeof debug ? [
|
|
23
|
-
()=>debug
|
|
24
|
-
] : [
|
|
25
|
-
...Array.isArray(debug) ? debug : [
|
|
26
|
-
debug
|
|
27
|
-
]
|
|
28
|
-
].map(filterToFunction);
|
|
29
|
-
const loglevel = LogLevel[`${level}`] || 0;
|
|
30
|
-
const logger = (name, type, args)=>{
|
|
31
|
-
const labeledArgs = ()=>{
|
|
32
|
-
if (Array.isArray(args)) {
|
|
33
|
-
if (args.length > 0 && 'string' == typeof args[0]) return [
|
|
34
|
-
`[${name}] ${args[0]}`,
|
|
35
|
-
...args.slice(1)
|
|
36
|
-
];
|
|
37
|
-
return [
|
|
38
|
-
`[${name}]`,
|
|
39
|
-
...args
|
|
40
|
-
];
|
|
41
|
-
}
|
|
42
|
-
return [];
|
|
43
|
-
};
|
|
44
|
-
const debug = debugFilters.some((f)=>f(name));
|
|
45
|
-
switch(type){
|
|
46
|
-
case LogType.debug:
|
|
47
|
-
if (!debug) return;
|
|
48
|
-
if ('function' == typeof console.debug) console.debug(...labeledArgs());
|
|
49
|
-
else console.log(...labeledArgs());
|
|
50
|
-
break;
|
|
51
|
-
case LogType.log:
|
|
52
|
-
if (!debug && loglevel > LogLevel.log) return;
|
|
53
|
-
console.log(...labeledArgs());
|
|
54
|
-
break;
|
|
55
|
-
case LogType.info:
|
|
56
|
-
if (!debug && loglevel > LogLevel.info) return;
|
|
57
|
-
console.info(...labeledArgs());
|
|
58
|
-
break;
|
|
59
|
-
case LogType.warn:
|
|
60
|
-
if (!debug && loglevel > LogLevel.warn) return;
|
|
61
|
-
console.warn(...labeledArgs());
|
|
62
|
-
break;
|
|
63
|
-
case LogType.error:
|
|
64
|
-
if (!debug && loglevel > LogLevel.error) return;
|
|
65
|
-
console.error(...labeledArgs());
|
|
66
|
-
break;
|
|
67
|
-
case LogType.trace:
|
|
68
|
-
if (!debug) return;
|
|
69
|
-
console.trace();
|
|
70
|
-
break;
|
|
71
|
-
case LogType.groupCollapsed:
|
|
72
|
-
if (!debug && loglevel > LogLevel.log) return;
|
|
73
|
-
if (!debug && loglevel > LogLevel.verbose) {
|
|
74
|
-
if ('function' == typeof console.groupCollapsed) console.groupCollapsed(...labeledArgs());
|
|
75
|
-
else console.log(...labeledArgs());
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
case LogType.group:
|
|
79
|
-
if (!debug && loglevel > LogLevel.log) return;
|
|
80
|
-
if ('function' == typeof console.group) console.group(...labeledArgs());
|
|
81
|
-
else console.log(...labeledArgs());
|
|
82
|
-
break;
|
|
83
|
-
case LogType.groupEnd:
|
|
84
|
-
if (!debug && loglevel > LogLevel.log) return;
|
|
85
|
-
if ('function' == typeof console.groupEnd) console.groupEnd();
|
|
86
|
-
break;
|
|
87
|
-
case LogType.time:
|
|
88
|
-
{
|
|
89
|
-
if (!debug && loglevel > LogLevel.log) return;
|
|
90
|
-
const [label, start, end] = args;
|
|
91
|
-
const ms = 1000 * start + end / 1000000;
|
|
92
|
-
const msg = `[${name}] ${label}: ${ms} ms`;
|
|
93
|
-
if ('function' == typeof console.logTime) console.logTime(msg);
|
|
94
|
-
else console.log(msg);
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
case LogType.profile:
|
|
98
|
-
if ('function' == typeof console.profile) console.profile(...labeledArgs());
|
|
99
|
-
break;
|
|
100
|
-
case LogType.profileEnd:
|
|
101
|
-
if ('function' == typeof console.profileEnd) console.profileEnd(...labeledArgs());
|
|
102
|
-
break;
|
|
103
|
-
case LogType.clear:
|
|
104
|
-
if (!debug && loglevel > LogLevel.log) return;
|
|
105
|
-
if ('function' == typeof console.clear) console.clear();
|
|
106
|
-
break;
|
|
107
|
-
case LogType.status:
|
|
108
|
-
if (!debug && loglevel > LogLevel.info) return;
|
|
109
|
-
if ('function' == typeof console.status) if (args && 0 !== args.length) console.status(...labeledArgs());
|
|
110
|
-
else console.status();
|
|
111
|
-
else if (args && 0 !== args.length) console.info(...labeledArgs());
|
|
112
|
-
break;
|
|
113
|
-
default:
|
|
114
|
-
throw new Error(`Unexpected LogType ${type}`);
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
return logger;
|
|
118
|
-
};
|
|
119
|
-
export default createConsoleLogger;
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
import { Logger } from './Logger.js';
|
|
11
|
-
import type { LoggerOptions } from '../types.js';
|
|
12
|
-
/**
|
|
13
|
-
* Client stub for tapable SyncBailHook
|
|
14
|
-
*/
|
|
15
|
-
declare class SyncBailHook {
|
|
16
|
-
constructor(_args?: string[]);
|
|
17
|
-
call(_origin?: string, _type?: string, _args?: unknown): undefined;
|
|
18
|
-
}
|
|
19
|
-
export declare const logger: {
|
|
20
|
-
getLogger: (name: string) => Logger;
|
|
21
|
-
configureDefaultLogger: (options: LoggerOptions) => void;
|
|
22
|
-
hooks: {
|
|
23
|
-
log: SyncBailHook;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Logger } from "./Logger.js";
|
|
2
|
-
import createConsoleLogger from "./createConsoleLogger.js";
|
|
3
|
-
class SyncBailHook {
|
|
4
|
-
call(_origin, _type, _args) {}
|
|
5
|
-
constructor(_args){}
|
|
6
|
-
}
|
|
7
|
-
const currentDefaultLoggerOptions = {
|
|
8
|
-
level: 'info',
|
|
9
|
-
debug: false,
|
|
10
|
-
console
|
|
11
|
-
};
|
|
12
|
-
let currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions);
|
|
13
|
-
const configureDefaultLogger = (options)=>{
|
|
14
|
-
Object.assign(currentDefaultLoggerOptions, options);
|
|
15
|
-
currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions);
|
|
16
|
-
};
|
|
17
|
-
const getLogger = (name)=>new Logger((type, args)=>{
|
|
18
|
-
if (void 0 === hooks.log.call(name, type, args)) currentDefaultLogger(name, type, args);
|
|
19
|
-
});
|
|
20
|
-
const hooks = {
|
|
21
|
-
log: new SyncBailHook([
|
|
22
|
-
'origin',
|
|
23
|
-
'type',
|
|
24
|
-
'args'
|
|
25
|
-
])
|
|
26
|
-
};
|
|
27
|
-
const logger = {
|
|
28
|
-
getLogger: getLogger,
|
|
29
|
-
configureDefaultLogger: configureDefaultLogger,
|
|
30
|
-
hooks: hooks
|
|
31
|
-
};
|
|
32
|
-
export { logger };
|
|
@@ -1,45 +0,0 @@
|
|
|
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';
|
package/client/modules/types.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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 };
|
package/client/overlay.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
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
|
-
type OverlayTrustedTypePolicy = {
|
|
35
|
-
createHTML: (value: string) => string;
|
|
36
|
-
};
|
|
37
|
-
declare global {
|
|
38
|
-
interface Window {
|
|
39
|
-
trustedTypes?: {
|
|
40
|
-
createPolicy: (name: string, policy: {
|
|
41
|
-
createHTML: (value: string) => string;
|
|
42
|
-
}) => OverlayTrustedTypePolicy;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
declare const createOverlay: (options: CreateOverlayOptions) => StateMachine;
|
|
47
|
-
export { createOverlay, formatProblem };
|