@rspack/dev-server 1.0.8 → 1.0.9
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/client/index.js +293 -348
- package/{dist → client/utils}/ansiHTML.js +58 -59
- package/client/utils/reloadApp.js +48 -52
- package/dist/server.d.ts +9 -0
- package/dist/server.js +1 -11
- package/package.json +4 -2
- package/dist/ansiHTML.d.ts +0 -31
package/client/index.js
CHANGED
|
@@ -1,64 +1,61 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
function ownKeys(object, enumerableOnly) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
var keys = Object.keys(object);
|
|
4
|
+
if (Object.getOwnPropertySymbols) {
|
|
5
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
6
|
+
enumerableOnly &&
|
|
7
|
+
(symbols = symbols.filter(function (sym) {
|
|
8
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
9
|
+
})),
|
|
10
|
+
keys.push.apply(keys, symbols);
|
|
11
|
+
}
|
|
12
|
+
return keys;
|
|
12
13
|
}
|
|
13
14
|
function _objectSpread(target) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
target,
|
|
28
|
-
key,
|
|
29
|
-
Object.getOwnPropertyDescriptor(source, key)
|
|
30
|
-
);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
return target;
|
|
15
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
16
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
17
|
+
i % 2
|
|
18
|
+
? ownKeys(Object(source), !0).forEach(function (key) {
|
|
19
|
+
_defineProperty(target, key, source[key]);
|
|
20
|
+
})
|
|
21
|
+
: Object.getOwnPropertyDescriptors
|
|
22
|
+
? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source))
|
|
23
|
+
: ownKeys(Object(source)).forEach(function (key) {
|
|
24
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
34
28
|
}
|
|
35
29
|
function _defineProperty(obj, key, value) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
30
|
+
key = _toPropertyKey(key);
|
|
31
|
+
if (key in obj) {
|
|
32
|
+
Object.defineProperty(obj, key, {
|
|
33
|
+
value: value,
|
|
34
|
+
enumerable: true,
|
|
35
|
+
configurable: true,
|
|
36
|
+
writable: true
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
obj[key] = value;
|
|
41
|
+
}
|
|
42
|
+
return obj;
|
|
48
43
|
}
|
|
49
44
|
function _toPropertyKey(arg) {
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
var key = _toPrimitive(arg, "string");
|
|
46
|
+
return typeof key === "symbol" ? key : String(key);
|
|
52
47
|
}
|
|
53
48
|
function _toPrimitive(input, hint) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
if (typeof input !== "object" || input === null)
|
|
50
|
+
return input;
|
|
51
|
+
var prim = input[Symbol.toPrimitive];
|
|
52
|
+
if (prim !== undefined) {
|
|
53
|
+
var res = prim.call(input, hint || "default");
|
|
54
|
+
if (typeof res !== "object")
|
|
55
|
+
return res;
|
|
56
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
57
|
+
}
|
|
58
|
+
return (hint === "string" ? String : Number)(input);
|
|
62
59
|
}
|
|
63
60
|
/* global __resourceQuery, __webpack_hash__ */
|
|
64
61
|
/// <reference types="webpack/module" />
|
|
@@ -66,19 +63,11 @@ import webpackHotLog from "@rspack/core/hot/log.js";
|
|
|
66
63
|
import stripAnsi from "webpack-dev-server/client/utils/stripAnsi.js";
|
|
67
64
|
import parseURL from "webpack-dev-server/client/utils/parseURL.js";
|
|
68
65
|
import socket from "webpack-dev-server/client/socket.js";
|
|
69
|
-
import {
|
|
70
|
-
|
|
71
|
-
createOverlay
|
|
72
|
-
} from "webpack-dev-server/client/overlay.js";
|
|
73
|
-
import {
|
|
74
|
-
log,
|
|
75
|
-
logEnabledFeatures,
|
|
76
|
-
setLogLevel
|
|
77
|
-
} from "webpack-dev-server/client/utils/log.js";
|
|
66
|
+
import { formatProblem, createOverlay } from "webpack-dev-server/client/overlay.js";
|
|
67
|
+
import { log, logEnabledFeatures, setLogLevel } from "webpack-dev-server/client/utils/log.js";
|
|
78
68
|
import sendMessage from "webpack-dev-server/client/utils/sendMessage.js";
|
|
79
69
|
import reloadApp from "./utils/reloadApp.js";
|
|
80
70
|
import createSocketURL from "webpack-dev-server/client/utils/createSocketURL.js";
|
|
81
|
-
|
|
82
71
|
/**
|
|
83
72
|
* @typedef {Object} Options
|
|
84
73
|
* @property {boolean} hot
|
|
@@ -88,335 +77,291 @@ import createSocketURL from "webpack-dev-server/client/utils/createSocketURL.js"
|
|
|
88
77
|
* @property {string} [logging]
|
|
89
78
|
* @property {number} [reconnect]
|
|
90
79
|
*/
|
|
91
|
-
|
|
92
80
|
/**
|
|
93
81
|
* @typedef {Object} Status
|
|
94
82
|
* @property {boolean} isUnloading
|
|
95
83
|
* @property {string} currentHash
|
|
96
84
|
* @property {string} [previousHash]
|
|
97
85
|
*/
|
|
98
|
-
|
|
99
86
|
/**
|
|
100
87
|
* @type {Status}
|
|
101
88
|
*/
|
|
102
89
|
var status = {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
90
|
+
isUnloading: false,
|
|
91
|
+
// TODO Workaround for webpack v4, `__webpack_hash__` is not replaced without HotModuleReplacement
|
|
92
|
+
// eslint-disable-next-line camelcase
|
|
93
|
+
currentHash: typeof __webpack_hash__ !== "undefined" ? __webpack_hash__ : ""
|
|
107
94
|
};
|
|
108
|
-
|
|
109
95
|
var decodeOverlayOptions = function decodeOverlayOptions(overlayOptions) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
"var callback = ".concat(
|
|
121
|
-
overlayFilterFunctionString,
|
|
122
|
-
"\n return callback(message)"
|
|
123
|
-
)
|
|
124
|
-
);
|
|
125
|
-
overlayOptions[property] = overlayFilterFunction;
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}
|
|
96
|
+
if (typeof overlayOptions === "object") {
|
|
97
|
+
["warnings", "errors", "runtimeErrors"].forEach(function (property) {
|
|
98
|
+
if (typeof overlayOptions[property] === "string") {
|
|
99
|
+
var overlayFilterFunctionString = decodeURIComponent(overlayOptions[property]);
|
|
100
|
+
// eslint-disable-next-line no-new-func
|
|
101
|
+
var overlayFilterFunction = new Function("message", "var callback = ".concat(overlayFilterFunctionString, "\n return callback(message)"));
|
|
102
|
+
overlayOptions[property] = overlayFilterFunction;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
129
106
|
};
|
|
130
|
-
|
|
131
107
|
/** @type {Options} */
|
|
132
108
|
var options = {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
109
|
+
hot: false,
|
|
110
|
+
liveReload: false,
|
|
111
|
+
progress: false,
|
|
112
|
+
overlay: false
|
|
137
113
|
};
|
|
138
114
|
var parsedResourceQuery = parseURL(__resourceQuery);
|
|
139
115
|
var enabledFeatures = {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
116
|
+
"Hot Module Replacement": false,
|
|
117
|
+
"Live Reloading": false,
|
|
118
|
+
Progress: false,
|
|
119
|
+
Overlay: false
|
|
144
120
|
};
|
|
145
121
|
if (parsedResourceQuery.hot === "true") {
|
|
146
|
-
|
|
147
|
-
|
|
122
|
+
options.hot = true;
|
|
123
|
+
enabledFeatures["Hot Module Replacement"] = true;
|
|
148
124
|
}
|
|
149
125
|
if (parsedResourceQuery["live-reload"] === "true") {
|
|
150
|
-
|
|
151
|
-
|
|
126
|
+
options.liveReload = true;
|
|
127
|
+
enabledFeatures["Live Reloading"] = true;
|
|
152
128
|
}
|
|
153
129
|
if (parsedResourceQuery.progress === "true") {
|
|
154
|
-
|
|
155
|
-
|
|
130
|
+
options.progress = true;
|
|
131
|
+
enabledFeatures.Progress = true;
|
|
156
132
|
}
|
|
157
|
-
|
|
158
133
|
if (parsedResourceQuery.overlay) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
decodeOverlayOptions(options.overlay);
|
|
176
|
-
}
|
|
177
|
-
enabledFeatures.Overlay = true;
|
|
134
|
+
try {
|
|
135
|
+
options.overlay = JSON.parse(parsedResourceQuery.overlay);
|
|
136
|
+
}
|
|
137
|
+
catch (e) {
|
|
138
|
+
log.error("Error parsing overlay options from resource query:", e);
|
|
139
|
+
}
|
|
140
|
+
// Fill in default "true" params for partially-specified objects.
|
|
141
|
+
if (typeof options.overlay === "object") {
|
|
142
|
+
options.overlay = _objectSpread({
|
|
143
|
+
errors: true,
|
|
144
|
+
warnings: true,
|
|
145
|
+
runtimeErrors: true
|
|
146
|
+
}, options.overlay);
|
|
147
|
+
decodeOverlayOptions(options.overlay);
|
|
148
|
+
}
|
|
149
|
+
enabledFeatures.Overlay = true;
|
|
178
150
|
}
|
|
179
151
|
if (parsedResourceQuery.logging) {
|
|
180
|
-
|
|
152
|
+
options.logging = parsedResourceQuery.logging;
|
|
181
153
|
}
|
|
182
154
|
if (typeof parsedResourceQuery.reconnect !== "undefined") {
|
|
183
|
-
|
|
155
|
+
options.reconnect = Number(parsedResourceQuery.reconnect);
|
|
184
156
|
}
|
|
185
|
-
|
|
186
157
|
/**
|
|
187
158
|
* @param {string} level
|
|
188
159
|
*/
|
|
189
160
|
function setAllLogLevel(level) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
);
|
|
194
|
-
setLogLevel(level);
|
|
161
|
+
// This is needed because the HMR logger operate separately from dev server logger
|
|
162
|
+
webpackHotLog.setLogLevel(level === "verbose" || level === "log" ? "info" : level);
|
|
163
|
+
setLogLevel(level);
|
|
195
164
|
}
|
|
196
165
|
if (options.logging) {
|
|
197
|
-
|
|
166
|
+
setAllLogLevel(options.logging);
|
|
198
167
|
}
|
|
199
168
|
logEnabledFeatures(enabledFeatures);
|
|
200
169
|
self.addEventListener("beforeunload", function () {
|
|
201
|
-
|
|
170
|
+
status.isUnloading = true;
|
|
202
171
|
});
|
|
203
|
-
var overlay =
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
: {
|
|
217
|
-
send: function send() {}
|
|
218
|
-
};
|
|
172
|
+
var overlay = typeof window !== "undefined"
|
|
173
|
+
? createOverlay(typeof options.overlay === "object"
|
|
174
|
+
? {
|
|
175
|
+
trustedTypesPolicyName: options.overlay.trustedTypesPolicyName,
|
|
176
|
+
catchRuntimeError: options.overlay.runtimeErrors
|
|
177
|
+
}
|
|
178
|
+
: {
|
|
179
|
+
trustedTypesPolicyName: false,
|
|
180
|
+
catchRuntimeError: options.overlay
|
|
181
|
+
})
|
|
182
|
+
: {
|
|
183
|
+
send: function send() { }
|
|
184
|
+
};
|
|
219
185
|
/* Rspack dev server runtime client */
|
|
220
186
|
var onSocketMessage = {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
level: "error",
|
|
400
|
-
messages: _errors
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
},
|
|
405
|
-
/**
|
|
406
|
-
* @param {Error} error
|
|
407
|
-
*/
|
|
408
|
-
error: function error(_error) {
|
|
409
|
-
log.error(_error);
|
|
410
|
-
},
|
|
411
|
-
close: function close() {
|
|
412
|
-
log.info("Disconnected!");
|
|
413
|
-
if (options.overlay) {
|
|
414
|
-
overlay.send({
|
|
415
|
-
type: "DISMISS"
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
sendMessage("Close");
|
|
419
|
-
}
|
|
187
|
+
hot: function hot() {
|
|
188
|
+
if (parsedResourceQuery.hot === "false") {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
options.hot = true;
|
|
192
|
+
},
|
|
193
|
+
liveReload: function liveReload() {
|
|
194
|
+
if (parsedResourceQuery["live-reload"] === "false") {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
options.liveReload = true;
|
|
198
|
+
},
|
|
199
|
+
invalid: function invalid() {
|
|
200
|
+
log.info("App updated. Recompiling...");
|
|
201
|
+
// Fixes #1042. overlay doesn't clear if errors are fixed but warnings remain.
|
|
202
|
+
if (options.overlay) {
|
|
203
|
+
overlay.send({
|
|
204
|
+
type: "DISMISS"
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
sendMessage("Invalid");
|
|
208
|
+
},
|
|
209
|
+
/**
|
|
210
|
+
* @param {string} hash
|
|
211
|
+
*/
|
|
212
|
+
hash: function hash(_hash) {
|
|
213
|
+
status.previousHash = status.currentHash;
|
|
214
|
+
status.currentHash = _hash;
|
|
215
|
+
},
|
|
216
|
+
logging: setAllLogLevel,
|
|
217
|
+
/**
|
|
218
|
+
* @param {boolean} value
|
|
219
|
+
*/
|
|
220
|
+
overlay: function overlay(value) {
|
|
221
|
+
if (typeof document === "undefined") {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
options.overlay = value;
|
|
225
|
+
decodeOverlayOptions(options.overlay);
|
|
226
|
+
},
|
|
227
|
+
/**
|
|
228
|
+
* @param {number} value
|
|
229
|
+
*/
|
|
230
|
+
reconnect: function reconnect(value) {
|
|
231
|
+
if (parsedResourceQuery.reconnect === "false") {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
options.reconnect = value;
|
|
235
|
+
},
|
|
236
|
+
/**
|
|
237
|
+
* @param {boolean} value
|
|
238
|
+
*/
|
|
239
|
+
progress: function progress(value) {
|
|
240
|
+
options.progress = value;
|
|
241
|
+
},
|
|
242
|
+
/**
|
|
243
|
+
* @param {{ pluginName?: string, percent: number, msg: string }} data
|
|
244
|
+
*/
|
|
245
|
+
"progress-update": function progressUpdate(data) {
|
|
246
|
+
if (options.progress) {
|
|
247
|
+
log.info(""
|
|
248
|
+
.concat(data.pluginName ? "[".concat(data.pluginName, "] ") : "")
|
|
249
|
+
.concat(data.percent, "% - ")
|
|
250
|
+
.concat(data.msg, "."));
|
|
251
|
+
}
|
|
252
|
+
sendMessage("Progress", data);
|
|
253
|
+
},
|
|
254
|
+
"still-ok": function stillOk() {
|
|
255
|
+
log.info("Nothing changed.");
|
|
256
|
+
if (options.overlay) {
|
|
257
|
+
overlay.send({
|
|
258
|
+
type: "DISMISS"
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
sendMessage("StillOk");
|
|
262
|
+
},
|
|
263
|
+
ok: function ok() {
|
|
264
|
+
sendMessage("Ok");
|
|
265
|
+
if (options.overlay) {
|
|
266
|
+
overlay.send({
|
|
267
|
+
type: "DISMISS"
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
reloadApp(options, status);
|
|
271
|
+
},
|
|
272
|
+
// TODO: remove in v5 in favor of 'static-changed'
|
|
273
|
+
/**
|
|
274
|
+
* @param {string} file
|
|
275
|
+
*/
|
|
276
|
+
"content-changed": function contentChanged(file) {
|
|
277
|
+
log.info("".concat(file ? '"'.concat(file, '"') : "Content", " from static directory was changed. Reloading..."));
|
|
278
|
+
self.location.reload();
|
|
279
|
+
},
|
|
280
|
+
/**
|
|
281
|
+
* @param {string} file
|
|
282
|
+
*/
|
|
283
|
+
"static-changed": function staticChanged(file) {
|
|
284
|
+
log.info("".concat(file ? '"'.concat(file, '"') : "Content", " from static directory was changed. Reloading..."));
|
|
285
|
+
self.location.reload();
|
|
286
|
+
},
|
|
287
|
+
/**
|
|
288
|
+
* @param {Error[]} warnings
|
|
289
|
+
* @param {any} params
|
|
290
|
+
*/
|
|
291
|
+
warnings: function warnings(_warnings, params) {
|
|
292
|
+
log.warn("Warnings while compiling.");
|
|
293
|
+
var printableWarnings = _warnings.map(function (error) {
|
|
294
|
+
var _formatProblem = formatProblem("warning", error), header = _formatProblem.header, body = _formatProblem.body;
|
|
295
|
+
return "".concat(header, "\n").concat(stripAnsi(body));
|
|
296
|
+
});
|
|
297
|
+
sendMessage("Warnings", printableWarnings);
|
|
298
|
+
for (var i = 0; i < printableWarnings.length; i++) {
|
|
299
|
+
log.warn(printableWarnings[i]);
|
|
300
|
+
}
|
|
301
|
+
var overlayWarningsSetting = typeof options.overlay === "boolean"
|
|
302
|
+
? options.overlay
|
|
303
|
+
: options.overlay && options.overlay.warnings;
|
|
304
|
+
if (overlayWarningsSetting) {
|
|
305
|
+
var warningsToDisplay = typeof overlayWarningsSetting === "function"
|
|
306
|
+
? _warnings.filter(overlayWarningsSetting)
|
|
307
|
+
: _warnings;
|
|
308
|
+
if (warningsToDisplay.length) {
|
|
309
|
+
overlay.send({
|
|
310
|
+
type: "BUILD_ERROR",
|
|
311
|
+
level: "warning",
|
|
312
|
+
messages: _warnings
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if (params && params.preventReloading) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
reloadApp(options, status);
|
|
320
|
+
},
|
|
321
|
+
/**
|
|
322
|
+
* @param {Error[]} errors
|
|
323
|
+
*/
|
|
324
|
+
errors: function errors(_errors) {
|
|
325
|
+
log.error("Errors while compiling. Reload prevented.");
|
|
326
|
+
var printableErrors = _errors.map(function (error) {
|
|
327
|
+
var _formatProblem2 = formatProblem("error", error), header = _formatProblem2.header, body = _formatProblem2.body;
|
|
328
|
+
return "".concat(header, "\n").concat(stripAnsi(body));
|
|
329
|
+
});
|
|
330
|
+
sendMessage("Errors", printableErrors);
|
|
331
|
+
for (var i = 0; i < printableErrors.length; i++) {
|
|
332
|
+
log.error(printableErrors[i]);
|
|
333
|
+
}
|
|
334
|
+
var overlayErrorsSettings = typeof options.overlay === "boolean"
|
|
335
|
+
? options.overlay
|
|
336
|
+
: options.overlay && options.overlay.errors;
|
|
337
|
+
if (overlayErrorsSettings) {
|
|
338
|
+
var errorsToDisplay = typeof overlayErrorsSettings === "function"
|
|
339
|
+
? _errors.filter(overlayErrorsSettings)
|
|
340
|
+
: _errors;
|
|
341
|
+
if (errorsToDisplay.length) {
|
|
342
|
+
overlay.send({
|
|
343
|
+
type: "BUILD_ERROR",
|
|
344
|
+
level: "error",
|
|
345
|
+
messages: _errors
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
/**
|
|
351
|
+
* @param {Error} error
|
|
352
|
+
*/
|
|
353
|
+
error: function error(_error) {
|
|
354
|
+
log.error(_error);
|
|
355
|
+
},
|
|
356
|
+
close: function close() {
|
|
357
|
+
log.info("Disconnected!");
|
|
358
|
+
if (options.overlay) {
|
|
359
|
+
overlay.send({
|
|
360
|
+
type: "DISMISS"
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
sendMessage("Close");
|
|
364
|
+
}
|
|
420
365
|
};
|
|
421
366
|
var socketURL = createSocketURL(parsedResourceQuery);
|
|
422
367
|
socket(socketURL, onSocketMessage, options.reconnect);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
// Reference to https://github.com/sindresorhus/ansi-regex
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
var _regANSI = /(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/;
|
|
3
|
+
var _defColors = {
|
|
6
4
|
reset: ["fff", "000"],
|
|
7
5
|
black: "000",
|
|
8
6
|
red: "ff0000",
|
|
@@ -14,7 +12,7 @@ const _defColors = {
|
|
|
14
12
|
lightgrey: "f0f0f0",
|
|
15
13
|
darkgrey: "888"
|
|
16
14
|
};
|
|
17
|
-
|
|
15
|
+
var _styles = {
|
|
18
16
|
30: "black",
|
|
19
17
|
31: "red",
|
|
20
18
|
32: "green",
|
|
@@ -24,54 +22,54 @@ const _styles = {
|
|
|
24
22
|
36: "cyan",
|
|
25
23
|
37: "lightgrey"
|
|
26
24
|
};
|
|
27
|
-
|
|
25
|
+
var _colorMode = {
|
|
28
26
|
2: "rgb"
|
|
29
27
|
};
|
|
30
|
-
|
|
28
|
+
var _openTags = {
|
|
31
29
|
1: "font-weight:bold",
|
|
32
30
|
2: "opacity:0.5",
|
|
33
31
|
3: "<i>",
|
|
34
32
|
4: "<u>",
|
|
35
33
|
8: "display:none",
|
|
36
34
|
9: "<del>",
|
|
37
|
-
38: (match)
|
|
35
|
+
38: function (match) {
|
|
38
36
|
// color
|
|
39
|
-
|
|
37
|
+
var mode = _colorMode[match[0]];
|
|
40
38
|
if (mode === "rgb") {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
var r = match[1];
|
|
40
|
+
var g = match[2];
|
|
41
|
+
var b = match[3];
|
|
44
42
|
match.advance(4);
|
|
45
|
-
return
|
|
43
|
+
return "color: rgb(".concat(r, ",").concat(g, ",").concat(b, ")");
|
|
46
44
|
}
|
|
47
45
|
},
|
|
48
|
-
48: (match)
|
|
46
|
+
48: function (match) {
|
|
49
47
|
// background color
|
|
50
|
-
|
|
48
|
+
var mode = _colorMode[match[0]];
|
|
51
49
|
if (mode === "rgb") {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
var r = match[1];
|
|
51
|
+
var g = match[2];
|
|
52
|
+
var b = match[3];
|
|
55
53
|
match.advance(4);
|
|
56
|
-
return
|
|
54
|
+
return "background-color: rgb(".concat(r, ",").concat(g, ",").concat(b, ")");
|
|
57
55
|
}
|
|
58
56
|
}
|
|
59
57
|
};
|
|
60
|
-
|
|
58
|
+
var _openTagToCloseTag = {
|
|
61
59
|
3: "23",
|
|
62
60
|
4: "24",
|
|
63
61
|
9: "29"
|
|
64
62
|
};
|
|
65
|
-
|
|
66
|
-
0: ansiCodes
|
|
63
|
+
var _closeTags = {
|
|
64
|
+
0: function (ansiCodes) {
|
|
67
65
|
if (!ansiCodes)
|
|
68
66
|
return "</span>";
|
|
69
67
|
if (!ansiCodes.length)
|
|
70
68
|
return "";
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
var code;
|
|
70
|
+
var ret = "";
|
|
73
71
|
while ((code = ansiCodes.pop())) {
|
|
74
|
-
|
|
72
|
+
var closeTag = _openTagToCloseTag[code];
|
|
75
73
|
if (closeTag) {
|
|
76
74
|
ret += _closeTags[closeTag];
|
|
77
75
|
continue;
|
|
@@ -84,7 +82,8 @@ const _closeTags = {
|
|
|
84
82
|
24: "</u>",
|
|
85
83
|
29: "</del>" // reset delete
|
|
86
84
|
};
|
|
87
|
-
for (
|
|
85
|
+
for (var _i = 0, _a = [21, 22, 27, 28, 39, 49]; _i < _a.length; _i++) {
|
|
86
|
+
var n = _a[_i];
|
|
88
87
|
_closeTags[n] = "</span>";
|
|
89
88
|
}
|
|
90
89
|
/**
|
|
@@ -101,37 +100,38 @@ function normalizeSeq(seq) {
|
|
|
101
100
|
/**
|
|
102
101
|
* Converts text with ANSI color codes to HTML markup.
|
|
103
102
|
*/
|
|
104
|
-
function ansiHTML(text) {
|
|
103
|
+
export default function ansiHTML(text) {
|
|
105
104
|
// Returns the text if the string has no ANSI escape code.
|
|
106
105
|
if (!_regANSI.test(text)) {
|
|
107
106
|
return text;
|
|
108
107
|
}
|
|
109
108
|
// Cache opened sequence.
|
|
110
|
-
|
|
109
|
+
var ansiCodes = [];
|
|
111
110
|
// Replace with markup.
|
|
112
111
|
//@ts-ignore TS1487 error
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
var ret = text.replace(/\033\[(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?m/g, function (m) {
|
|
113
|
+
var _a;
|
|
114
|
+
var match = (_a = m.match(/(;?\d+)/g)) === null || _a === void 0 ? void 0 : _a.map(normalizeSeq);
|
|
115
115
|
Object.defineProperty(match, "advance", {
|
|
116
116
|
value: function (count) {
|
|
117
117
|
this.splice(0, count);
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
var rep = "";
|
|
121
|
+
var seq;
|
|
122
122
|
while ((seq = match[0])) {
|
|
123
123
|
match.advance(1);
|
|
124
124
|
rep += applySeq(seq);
|
|
125
125
|
}
|
|
126
126
|
return rep;
|
|
127
127
|
function applySeq(seq) {
|
|
128
|
-
|
|
128
|
+
var other = _openTags[seq];
|
|
129
129
|
if (other &&
|
|
130
130
|
(other = typeof other === "function" ? other(match) : other)) {
|
|
131
131
|
// If reset signal is encountered, we have to reset everything.
|
|
132
|
-
|
|
132
|
+
var ret_1 = "";
|
|
133
133
|
if (seq === "0") {
|
|
134
|
-
|
|
134
|
+
ret_1 += _closeTags[seq](ansiCodes);
|
|
135
135
|
}
|
|
136
136
|
// If current sequence has been opened, close it.
|
|
137
137
|
if (ansiCodes.indexOf(seq) !== -1) {
|
|
@@ -140,9 +140,9 @@ function ansiHTML(text) {
|
|
|
140
140
|
}
|
|
141
141
|
// Open tag.
|
|
142
142
|
ansiCodes.push(seq);
|
|
143
|
-
return
|
|
143
|
+
return ret_1 + (other[0] === "<" ? other : "<span style=\"".concat(other, ";\">"));
|
|
144
144
|
}
|
|
145
|
-
|
|
145
|
+
var ct = _closeTags[seq];
|
|
146
146
|
if (typeof ct === "function") {
|
|
147
147
|
return ct(ansiCodes);
|
|
148
148
|
}
|
|
@@ -155,22 +155,21 @@ function ansiHTML(text) {
|
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
157
|
// Make sure tags are closed.
|
|
158
|
-
|
|
158
|
+
var l = ansiCodes.length;
|
|
159
159
|
l > 0 && (ret += Array(l + 1).join("</span>"));
|
|
160
160
|
return ret;
|
|
161
161
|
}
|
|
162
|
-
exports.default = ansiHTML;
|
|
163
162
|
/**
|
|
164
163
|
* Customize colors.
|
|
165
164
|
* @param {Object} colors reference to _defColors
|
|
166
165
|
*/
|
|
167
|
-
ansiHTML.setColors = (colors)
|
|
166
|
+
ansiHTML.setColors = function (colors) {
|
|
168
167
|
if (typeof colors !== "object") {
|
|
169
168
|
throw new Error("`colors` parameter must be an Object.");
|
|
170
169
|
}
|
|
171
|
-
|
|
172
|
-
for (
|
|
173
|
-
|
|
170
|
+
var _finalColors = {};
|
|
171
|
+
for (var key in _defColors) {
|
|
172
|
+
var hex = colors.hasOwnProperty(key) ? colors[key] : null;
|
|
174
173
|
if (!hex) {
|
|
175
174
|
_finalColors[key] = _defColors[key];
|
|
176
175
|
continue;
|
|
@@ -181,10 +180,10 @@ ansiHTML.setColors = (colors) => {
|
|
|
181
180
|
}
|
|
182
181
|
if (!Array.isArray(hex) ||
|
|
183
182
|
hex.length === 0 ||
|
|
184
|
-
hex.some(h
|
|
185
|
-
throw new Error(
|
|
183
|
+
hex.some(function (h) { return typeof h !== "string"; })) {
|
|
184
|
+
throw new Error("The value of `".concat(key, "` property must be an Array and each item could only be a hex string, e.g.: FF0000"));
|
|
186
185
|
}
|
|
187
|
-
|
|
186
|
+
var defHexColor = _defColors[key];
|
|
188
187
|
if (!hex[0]) {
|
|
189
188
|
hex[0] = defHexColor[0];
|
|
190
189
|
}
|
|
@@ -195,7 +194,7 @@ ansiHTML.setColors = (colors) => {
|
|
|
195
194
|
hex = hex.slice(0, 2);
|
|
196
195
|
}
|
|
197
196
|
else if (typeof hex !== "string") {
|
|
198
|
-
throw new Error(
|
|
197
|
+
throw new Error("The value of `".concat(key, "` property must be a hex string, e.g.: FF0000"));
|
|
199
198
|
}
|
|
200
199
|
_finalColors[key] = hex;
|
|
201
200
|
}
|
|
@@ -204,7 +203,7 @@ ansiHTML.setColors = (colors) => {
|
|
|
204
203
|
/**
|
|
205
204
|
* Reset colors.
|
|
206
205
|
*/
|
|
207
|
-
ansiHTML.reset = ()
|
|
206
|
+
ansiHTML.reset = function () {
|
|
208
207
|
_setTags(_defColors);
|
|
209
208
|
};
|
|
210
209
|
/**
|
|
@@ -214,10 +213,10 @@ ansiHTML.reset = () => {
|
|
|
214
213
|
ansiHTML.tags = {};
|
|
215
214
|
if (Object.defineProperty) {
|
|
216
215
|
Object.defineProperty(ansiHTML.tags, "open", {
|
|
217
|
-
get: ()
|
|
216
|
+
get: function () { return _openTags; }
|
|
218
217
|
});
|
|
219
218
|
Object.defineProperty(ansiHTML.tags, "close", {
|
|
220
|
-
get: ()
|
|
219
|
+
get: function () { return _closeTags; }
|
|
221
220
|
});
|
|
222
221
|
}
|
|
223
222
|
else {
|
|
@@ -227,17 +226,17 @@ else {
|
|
|
227
226
|
function _setTags(colors) {
|
|
228
227
|
// reset all
|
|
229
228
|
_openTags["0"] =
|
|
230
|
-
|
|
229
|
+
"font-weight:normal;opacity:1;color:#".concat(colors.reset[0], ";background:#").concat(colors.reset[1]);
|
|
231
230
|
// inverse
|
|
232
|
-
_openTags["7"] =
|
|
231
|
+
_openTags["7"] = "color:#".concat(colors.reset[1], ";background:#").concat(colors.reset[0]);
|
|
233
232
|
// dark grey
|
|
234
|
-
_openTags["90"] =
|
|
235
|
-
for (
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
_openTags[code] =
|
|
239
|
-
|
|
240
|
-
_openTags[(codeInt + 10).toString()] =
|
|
233
|
+
_openTags["90"] = "color:#".concat(colors.darkgrey);
|
|
234
|
+
for (var code in _styles) {
|
|
235
|
+
var color = _styles[code];
|
|
236
|
+
var oriColor = colors[color] || "000";
|
|
237
|
+
_openTags[code] = "color:#".concat(oriColor);
|
|
238
|
+
var codeInt = Number.parseInt(code);
|
|
239
|
+
_openTags[(codeInt + 10).toString()] = "background:#".concat(oriColor);
|
|
241
240
|
}
|
|
242
241
|
}
|
|
243
242
|
ansiHTML.reset();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
import hotEmitter from "@rspack/core/hot/emitter.js";
|
|
2
3
|
import { log } from "webpack-dev-server/client/utils/log.js";
|
|
3
|
-
|
|
4
4
|
/** @typedef {import("../index").Options} Options
|
|
5
5
|
/** @typedef {import("../index").Status} Status
|
|
6
6
|
|
|
@@ -9,56 +9,52 @@ import { log } from "webpack-dev-server/client/utils/log.js";
|
|
|
9
9
|
* @param {Status} status
|
|
10
10
|
*/
|
|
11
11
|
function reloadApp(_ref, status) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
12
|
+
var hot = _ref.hot, liveReload = _ref.liveReload;
|
|
13
|
+
if (status.isUnloading) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
var currentHash = status.currentHash, previousHash = status.previousHash;
|
|
17
|
+
var isInitial = currentHash.indexOf(/** @type {string} */ previousHash) >= 0;
|
|
18
|
+
if (isInitial) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @param {Window} rootWindow
|
|
23
|
+
* @param {number} intervalId
|
|
24
|
+
*/
|
|
25
|
+
function applyReload(rootWindow, intervalId) {
|
|
26
|
+
clearInterval(intervalId);
|
|
27
|
+
log.info("App updated. Reloading...");
|
|
28
|
+
rootWindow.location.reload();
|
|
29
|
+
}
|
|
30
|
+
var search = self.location.search.toLowerCase();
|
|
31
|
+
var allowToHot = search.indexOf("webpack-dev-server-hot=false") === -1;
|
|
32
|
+
var allowToLiveReload = search.indexOf("webpack-dev-server-live-reload=false") === -1;
|
|
33
|
+
if (hot && allowToHot) {
|
|
34
|
+
log.info("App hot update...");
|
|
35
|
+
hotEmitter.emit("webpackHotUpdate", status.currentHash);
|
|
36
|
+
if (typeof self !== "undefined" && self.window) {
|
|
37
|
+
// broadcast update to window
|
|
38
|
+
self.postMessage("webpackHotUpdate".concat(status.currentHash), "*");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// allow refreshing the page only if liveReload isn't disabled
|
|
42
|
+
else if (liveReload && allowToLiveReload) {
|
|
43
|
+
var rootWindow = self;
|
|
44
|
+
// use parent window for reload (in case we're in an iframe with no valid src)
|
|
45
|
+
var intervalId = self.setInterval(function () {
|
|
46
|
+
if (rootWindow.location.protocol !== "about:") {
|
|
47
|
+
// reload immediately if protocol is valid
|
|
48
|
+
applyReload(rootWindow, intervalId);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
rootWindow = rootWindow.parent;
|
|
52
|
+
if (rootWindow.parent === rootWindow) {
|
|
53
|
+
// if parent equals current window we've reached the root which would continue forever, so trigger a reload anyways
|
|
54
|
+
applyReload(rootWindow, intervalId);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
63
59
|
}
|
|
64
60
|
export default reloadApp;
|
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
+
/**
|
|
4
|
+
* The following code is modified based on
|
|
5
|
+
* https://github.com/webpack/webpack-dev-server/blob/b0f15ace0123c125d5870609ef4691c141a6d187/lib/Server.js
|
|
6
|
+
*
|
|
7
|
+
* MIT Licensed
|
|
8
|
+
* Author Tobias Koppers @sokra
|
|
9
|
+
* Copyright (c) JS Foundation and other contributors
|
|
10
|
+
* https://github.com/webpack/webpack-dev-server/blob/b0f15ace0123c125d5870609ef4691c141a6d187/LICENSE
|
|
11
|
+
*/
|
|
3
12
|
import type { Server } from "node:http";
|
|
4
13
|
import type { Socket } from "node:net";
|
|
5
14
|
import { type Compiler, MultiCompiler } from "@rspack/core";
|
package/dist/server.js
CHANGED
|
@@ -4,16 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.RspackDevServer = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* The following code is modified based on
|
|
9
|
-
* https://github.com/webpack/webpack-dev-server/blob/b0f15ace0123c125d5870609ef4691c141a6d187/lib/Server.js
|
|
10
|
-
*
|
|
11
|
-
* MIT Licensed
|
|
12
|
-
* Author Tobias Koppers @sokra
|
|
13
|
-
* Copyright (c) JS Foundation and other contributors
|
|
14
|
-
* https://github.com/webpack/webpack-dev-server/blob/b0f15ace0123c125d5870609ef4691c141a6d187/LICENSE
|
|
15
|
-
*/
|
|
16
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
17
7
|
const core_1 = require("@rspack/core");
|
|
18
8
|
const webpack_dev_server_1 = __importDefault(require("webpack-dev-server"));
|
|
19
9
|
// @ts-ignore 'package.json' is not under 'rootDir'
|
|
@@ -57,7 +47,7 @@ class RspackDevServer extends webpack_dev_server_1.default {
|
|
|
57
47
|
"Make sure to disable HMR for production by setting `devServer.hot` to `false` in the configuration.");
|
|
58
48
|
}
|
|
59
49
|
compiler.options.resolve.alias = {
|
|
60
|
-
"ansi-html-community":
|
|
50
|
+
"ansi-html-community": require.resolve("@rspack/dev-server/client/utils/ansiHTML"),
|
|
61
51
|
...compiler.options.resolve.alias
|
|
62
52
|
};
|
|
63
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/dev-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Development server for rspack",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -91,7 +91,9 @@
|
|
|
91
91
|
"@rspack/core": "*"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|
|
94
|
-
"build": "
|
|
94
|
+
"build": "pnpm run build:server && pnpm run build:client",
|
|
95
|
+
"build:server": "tsc -b ./tsconfig.build.json",
|
|
96
|
+
"build:client": "tsc -b ./tsconfig.client.json",
|
|
95
97
|
"dev": "tsc -b -w",
|
|
96
98
|
"lint": "biome check .",
|
|
97
99
|
"lint:write": "biome check . --write",
|
package/dist/ansiHTML.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The following code is modified based on
|
|
3
|
-
* https://github.com/mahdyar/ansi-html-community/blob/b86cc3f1fa1d118477877352f0eafe1a70fd20ab/index.js
|
|
4
|
-
*
|
|
5
|
-
* Supported:
|
|
6
|
-
* - added support for 24-bit RGB colors.
|
|
7
|
-
*
|
|
8
|
-
* Apache 2.0 Licensed
|
|
9
|
-
* Author @Tjatse
|
|
10
|
-
* https://github.com/mahdyar/ansi-html-community/blob/master/LICENSE
|
|
11
|
-
*/
|
|
12
|
-
interface AnsiHtmlTags {
|
|
13
|
-
open: typeof _openTags;
|
|
14
|
-
close: typeof _closeTags;
|
|
15
|
-
}
|
|
16
|
-
type Option<T> = T | null | undefined;
|
|
17
|
-
type Match = {
|
|
18
|
-
advance: (n: number) => void;
|
|
19
|
-
} & Array<string>;
|
|
20
|
-
declare const _openTags: Record<string, string | ((m: Match) => Option<string>)>;
|
|
21
|
-
declare const _closeTags: Record<string, string | ((ansiCodes: Option<Array<string>>) => string)>;
|
|
22
|
-
/**
|
|
23
|
-
* Converts text with ANSI color codes to HTML markup.
|
|
24
|
-
*/
|
|
25
|
-
declare function ansiHTML(text: string): string;
|
|
26
|
-
declare namespace ansiHTML {
|
|
27
|
-
var setColors: (colors: Record<string, string | string[]>) => void;
|
|
28
|
-
var reset: () => void;
|
|
29
|
-
var tags: AnsiHtmlTags;
|
|
30
|
-
}
|
|
31
|
-
export default ansiHTML;
|