@rsbuild/core 1.1.11 → 1.1.13
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/compiled/chokidar/index.d.ts +24 -6
- package/compiled/chokidar/index.js +16 -13
- package/compiled/chokidar/package.json +1 -1
- package/compiled/jiti/index.js +56 -31
- package/compiled/jiti/package.json +1 -1
- package/compiled/postcss-load-config/index.js +10 -10
- package/compiled/rspack-manifest-plugin/index.d.ts +1 -1
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/compiled/rspack-manifest-plugin/package.json +1 -1
- package/dist/client/hmr.js +8 -69
- package/dist/client/overlay.js +7 -12
- package/dist/index.cjs +167 -80
- package/dist/index.js +164 -77
- package/dist-types/helpers/index.d.ts +2 -0
- package/dist-types/server/ansiHTML.d.ts +12 -0
- package/dist-types/server/helper.d.ts +6 -0
- package/package.json +5 -5
- /package/dist-types/{client → helpers}/format.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"jiti","version":"1.21.
|
|
1
|
+
{"name":"jiti","version":"1.21.7","license":"MIT","types":"index.d.ts","type":"commonjs"}
|
|
@@ -368,12 +368,12 @@
|
|
|
368
368
|
};
|
|
369
369
|
};
|
|
370
370
|
},
|
|
371
|
-
|
|
371
|
+
124: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
372
372
|
const { resolve } = __nccwpck_require__(411);
|
|
373
373
|
const config = __nccwpck_require__(245);
|
|
374
|
-
const loadOptions = __nccwpck_require__(
|
|
375
|
-
const loadPlugins = __nccwpck_require__(
|
|
376
|
-
const req = __nccwpck_require__(
|
|
374
|
+
const loadOptions = __nccwpck_require__(256);
|
|
375
|
+
const loadPlugins = __nccwpck_require__(356);
|
|
376
|
+
const req = __nccwpck_require__(146);
|
|
377
377
|
const interopRequireDefault = (obj) =>
|
|
378
378
|
obj && obj.__esModule ? obj : { default: obj };
|
|
379
379
|
async function processResult(ctx, result) {
|
|
@@ -487,8 +487,8 @@
|
|
|
487
487
|
* @requires ./plugins
|
|
488
488
|
*/ module.exports = rc;
|
|
489
489
|
},
|
|
490
|
-
|
|
491
|
-
const req = __nccwpck_require__(
|
|
490
|
+
256: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
491
|
+
const req = __nccwpck_require__(146);
|
|
492
492
|
async function options(config, file) {
|
|
493
493
|
if (config.parser && typeof config.parser === "string") {
|
|
494
494
|
try {
|
|
@@ -521,8 +521,8 @@
|
|
|
521
521
|
}
|
|
522
522
|
module.exports = options;
|
|
523
523
|
},
|
|
524
|
-
|
|
525
|
-
const req = __nccwpck_require__(
|
|
524
|
+
356: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
525
|
+
const req = __nccwpck_require__(146);
|
|
526
526
|
async function load(plugin, options, file) {
|
|
527
527
|
try {
|
|
528
528
|
if (
|
|
@@ -577,7 +577,7 @@
|
|
|
577
577
|
}
|
|
578
578
|
module.exports = plugins;
|
|
579
579
|
},
|
|
580
|
-
|
|
580
|
+
146: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
581
581
|
const { createRequire } = __nccwpck_require__(33);
|
|
582
582
|
const { pathToFileURL } = __nccwpck_require__(41);
|
|
583
583
|
const TS_EXT_RE = /\.[mc]?ts$/;
|
|
@@ -734,6 +734,6 @@
|
|
|
734
734
|
})();
|
|
735
735
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
736
736
|
__nccwpck_require__.ab = __dirname + "/";
|
|
737
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
737
|
+
var __webpack_exports__ = __nccwpck_require__(124);
|
|
738
738
|
module.exports = __webpack_exports__;
|
|
739
739
|
})();
|
|
@@ -41,4 +41,4 @@ declare class WebpackManifestPlugin implements RspackPluginInstance {
|
|
|
41
41
|
|
|
42
42
|
declare const RspackManifestPlugin: typeof WebpackManifestPlugin;
|
|
43
43
|
|
|
44
|
-
export { type EmitCountMap, type InternalOptions, type Manifest, type ManifestPluginOptions, RspackManifestPlugin, WebpackManifestPlugin, getCompilerHooks };
|
|
44
|
+
export { type EmitCountMap, type FileDescriptor, type InternalOptions, type Manifest, type ManifestPluginOptions, RspackManifestPlugin, WebpackManifestPlugin, getCompilerHooks };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
|
|
4
|
+
699: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.transformFiles =
|
|
7
7
|
exports.reduceChunk =
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
.map(standardizeFilePaths);
|
|
121
121
|
exports.transformFiles = transformFiles;
|
|
122
122
|
},
|
|
123
|
-
|
|
123
|
+
586: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
124
124
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
125
125
|
exports.normalModuleLoaderHook =
|
|
126
126
|
exports.getCompilerHooks =
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
const fs_1 = __nccwpck_require__(147);
|
|
131
131
|
const path_1 = __nccwpck_require__(17);
|
|
132
132
|
const lite_tapable_1 = __nccwpck_require__(348);
|
|
133
|
-
const helpers_1 = __nccwpck_require__(
|
|
133
|
+
const helpers_1 = __nccwpck_require__(699);
|
|
134
134
|
const compilerHookMap = new WeakMap();
|
|
135
135
|
const getCompilerHooks = (compiler) => {
|
|
136
136
|
let hooks = compilerHookMap.get(compiler);
|
|
@@ -312,7 +312,7 @@
|
|
|
312
312
|
exports.getCompilerHooks =
|
|
313
313
|
void 0;
|
|
314
314
|
const path_1 = __nccwpck_require__(17);
|
|
315
|
-
const hooks_1 = __nccwpck_require__(
|
|
315
|
+
const hooks_1 = __nccwpck_require__(586);
|
|
316
316
|
Object.defineProperty(exports, "getCompilerHooks", {
|
|
317
317
|
enumerable: true,
|
|
318
318
|
get: function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"rspack-manifest-plugin","author":"Dane Thurber <dane.thurber@gmail.com>","version":"5.0.
|
|
1
|
+
{"name":"rspack-manifest-plugin","author":"Dane Thurber <dane.thurber@gmail.com>","version":"5.0.3","license":"MIT","types":"index.d.ts","type":"commonjs"}
|
package/dist/client/hmr.js
CHANGED
|
@@ -1,58 +1,3 @@
|
|
|
1
|
-
function resolveFileName(stats) {
|
|
2
|
-
if (stats.moduleIdentifier) {
|
|
3
|
-
const regex = /(?:\!|^)([^!]+)$/;
|
|
4
|
-
const matched = stats.moduleIdentifier.match(regex);
|
|
5
|
-
if (matched) {
|
|
6
|
-
const fileName = matched.pop();
|
|
7
|
-
if (fileName) return `File: ${fileName}:1:1\n`;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
const file = stats.file || stats.moduleName;
|
|
11
|
-
return file ? `File: ${file}\n` : '';
|
|
12
|
-
}
|
|
13
|
-
function resolveModuleTrace(stats) {
|
|
14
|
-
let traceStr = '';
|
|
15
|
-
if (stats.moduleTrace) {
|
|
16
|
-
for (const trace of stats.moduleTrace)if (trace.originName) traceStr += `\n @ ${trace.originName}`;
|
|
17
|
-
}
|
|
18
|
-
return traceStr;
|
|
19
|
-
}
|
|
20
|
-
function hintUnknownFiles(message) {
|
|
21
|
-
const hint = 'You may need an appropriate loader to handle this file type.';
|
|
22
|
-
if (-1 === message.indexOf(hint)) return message;
|
|
23
|
-
if (/File: .+\.s(c|a)ss/.test(message)) return message.replace(hint, 'To enable support for Sass, use "@rsbuild/plugin-sass".');
|
|
24
|
-
if (/File: .+\.less/.test(message)) return message.replace(hint, 'To enable support for Less, use "@rsbuild/plugin-less".');
|
|
25
|
-
if (/File: .+\.styl(us)?/.test(message)) return message.replace(hint, 'To enable support for Stylus, use "@rsbuild/plugin-stylus".');
|
|
26
|
-
return message;
|
|
27
|
-
}
|
|
28
|
-
function formatMessage(stats, verbose) {
|
|
29
|
-
let lines = [];
|
|
30
|
-
let message;
|
|
31
|
-
if ('object' == typeof stats) {
|
|
32
|
-
const fileName = resolveFileName(stats);
|
|
33
|
-
const mainMessage = stats.message;
|
|
34
|
-
const details = verbose && stats.details ? `\nDetails: ${stats.details}\n` : '';
|
|
35
|
-
const stack = verbose && stats.stack ? `\n${stats.stack}` : '';
|
|
36
|
-
const moduleTrace = resolveModuleTrace(stats);
|
|
37
|
-
message = `${fileName}${mainMessage}${details}${stack}${moduleTrace}`;
|
|
38
|
-
} else message = stats;
|
|
39
|
-
message = hintUnknownFiles(message);
|
|
40
|
-
lines = message.split('\n');
|
|
41
|
-
lines = lines.filter((line, index, arr)=>0 === index || '' !== line.trim() || line.trim() !== arr[index - 1].trim());
|
|
42
|
-
message = lines.join('\n');
|
|
43
|
-
const innerError = '-- inner error --';
|
|
44
|
-
if (!verbose && message.includes(innerError)) message = message.split(innerError)[0];
|
|
45
|
-
return message.trim();
|
|
46
|
-
}
|
|
47
|
-
function formatStatsMessages(stats, verbose) {
|
|
48
|
-
var _stats_errors, _stats_warnings;
|
|
49
|
-
const formattedErrors = (null === (_stats_errors = stats.errors) || void 0 === _stats_errors ? void 0 : _stats_errors.map((error)=>formatMessage(error, verbose))) || [];
|
|
50
|
-
const formattedWarnings = (null === (_stats_warnings = stats.warnings) || void 0 === _stats_warnings ? void 0 : _stats_warnings.map((warning)=>formatMessage(warning, verbose))) || [];
|
|
51
|
-
return {
|
|
52
|
-
errors: formattedErrors,
|
|
53
|
-
warnings: formattedWarnings
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
1
|
const compilationId = RSBUILD_COMPILATION_NAME;
|
|
57
2
|
const config = RSBUILD_CLIENT_CONFIG;
|
|
58
3
|
function formatURL(param) {
|
|
@@ -88,34 +33,28 @@ function handleSuccess() {
|
|
|
88
33
|
hasCompileErrors = false;
|
|
89
34
|
if (isHotUpdate) tryApplyUpdates();
|
|
90
35
|
}
|
|
91
|
-
function handleWarnings(
|
|
36
|
+
function handleWarnings(param) {
|
|
37
|
+
let { text } = param;
|
|
92
38
|
clearOutdatedErrors();
|
|
93
39
|
const isHotUpdate = !isFirstCompilation;
|
|
94
40
|
isFirstCompilation = false;
|
|
95
41
|
hasCompileErrors = false;
|
|
96
|
-
|
|
97
|
-
warnings,
|
|
98
|
-
errors: []
|
|
99
|
-
});
|
|
100
|
-
for(let i = 0; i < formatted.warnings.length; i++){
|
|
42
|
+
for(let i = 0; i < text.length; i++){
|
|
101
43
|
if (5 === i) {
|
|
102
44
|
console.warn('There were more warnings in other files, you can find a complete log in the terminal.');
|
|
103
45
|
break;
|
|
104
46
|
}
|
|
105
|
-
console.warn(
|
|
47
|
+
console.warn(text[i]);
|
|
106
48
|
}
|
|
107
49
|
if (isHotUpdate) tryApplyUpdates();
|
|
108
50
|
}
|
|
109
|
-
function handleErrors(
|
|
51
|
+
function handleErrors(param) {
|
|
52
|
+
let { text, html } = param;
|
|
110
53
|
clearOutdatedErrors();
|
|
111
54
|
isFirstCompilation = false;
|
|
112
55
|
hasCompileErrors = true;
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
warnings: []
|
|
116
|
-
});
|
|
117
|
-
for (const error of formatted.errors)console.error(error);
|
|
118
|
-
if (createOverlay) createOverlay(formatted.errors);
|
|
56
|
+
for (const error of text)console.error(error);
|
|
57
|
+
if (createOverlay) createOverlay(html);
|
|
119
58
|
}
|
|
120
59
|
const isUpdateAvailable = ()=>lastCompilationHash !== __webpack_hash__;
|
|
121
60
|
function tryApplyUpdates() {
|
package/dist/client/overlay.js
CHANGED
|
@@ -9,11 +9,6 @@ function _define_property(obj, key, value) {
|
|
|
9
9
|
else obj[key] = value;
|
|
10
10
|
return obj;
|
|
11
11
|
}
|
|
12
|
-
function stripAnsi(content) {
|
|
13
|
-
const pattern = "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))";
|
|
14
|
-
const regex = new RegExp(pattern, 'g');
|
|
15
|
-
return content.replace(regex, '');
|
|
16
|
-
}
|
|
17
12
|
function linkedText(root, selector, text) {
|
|
18
13
|
const el = root.querySelector(selector);
|
|
19
14
|
const fileRegex = /(?:[a-zA-Z]:\\|\/).*?:\d+:\d+/g;
|
|
@@ -23,7 +18,7 @@ function linkedText(root, selector, text) {
|
|
|
23
18
|
const { 0: file, index } = match;
|
|
24
19
|
if (null != index) {
|
|
25
20
|
const frag = text.slice(curIndex, index);
|
|
26
|
-
el.
|
|
21
|
+
el.insertAdjacentHTML('beforeend', frag);
|
|
27
22
|
const link = document.createElement('a');
|
|
28
23
|
link.textContent = file;
|
|
29
24
|
link.className = 'file-link';
|
|
@@ -36,7 +31,7 @@ function linkedText(root, selector, text) {
|
|
|
36
31
|
match = fileRegex.exec(text);
|
|
37
32
|
}
|
|
38
33
|
const frag = text.slice(curIndex);
|
|
39
|
-
el.
|
|
34
|
+
el.insertAdjacentHTML('beforeend', frag);
|
|
40
35
|
}
|
|
41
36
|
const overlayTemplate = `
|
|
42
37
|
<style>
|
|
@@ -75,7 +70,7 @@ const overlayTemplate = `
|
|
|
75
70
|
padding-bottom: 12px;
|
|
76
71
|
font-size: 17px;
|
|
77
72
|
font-weight: 600;
|
|
78
|
-
color: #
|
|
73
|
+
color: #fb6a6a;
|
|
79
74
|
border-bottom: 2px solid rgba(252,94,94,.66);
|
|
80
75
|
}
|
|
81
76
|
.content {
|
|
@@ -84,15 +79,15 @@ const overlayTemplate = `
|
|
|
84
79
|
font-family: inherit;
|
|
85
80
|
overflow-x: scroll;
|
|
86
81
|
scrollbar-width: none;
|
|
87
|
-
color: #b8b8b8;
|
|
88
82
|
}
|
|
89
83
|
.content::-webkit-scrollbar {
|
|
90
84
|
display: none;
|
|
91
85
|
}
|
|
92
86
|
.file-link {
|
|
93
87
|
cursor: pointer;
|
|
94
|
-
color: #
|
|
88
|
+
color: #6eecf7;
|
|
95
89
|
text-decoration: underline;
|
|
90
|
+
text-underline-offset: 3px;
|
|
96
91
|
&:hover {
|
|
97
92
|
opacity: 0.8;
|
|
98
93
|
}
|
|
@@ -149,7 +144,7 @@ const overlayTemplate = `
|
|
|
149
144
|
<div class="root">
|
|
150
145
|
<div class="container">
|
|
151
146
|
<div class="close"></div>
|
|
152
|
-
<p class="title">
|
|
147
|
+
<p class="title">Build failed</p>
|
|
153
148
|
<pre class="content"></pre>
|
|
154
149
|
<footer class="footer">
|
|
155
150
|
<p><span>Fix error</span>, click outside, or press Esc to close the overlay.</p>
|
|
@@ -189,7 +184,7 @@ class ErrorOverlay extends HTMLElement {
|
|
|
189
184
|
mode: 'open'
|
|
190
185
|
});
|
|
191
186
|
root.innerHTML = overlayTemplate;
|
|
192
|
-
linkedText(root, '.content',
|
|
187
|
+
linkedText(root, '.content', message.join('\n\n').trim());
|
|
193
188
|
null === (_root_querySelector = root.querySelector('.close')) || void 0 === _root_querySelector || _root_querySelector.addEventListener('click', this.close);
|
|
194
189
|
this.addEventListener('click', this.close);
|
|
195
190
|
root.querySelector('.container').addEventListener('click', (e)=>{
|