@rsbuild/core 1.1.0 → 1.1.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/compiled/chokidar/index.d.ts +318 -189
- package/compiled/chokidar/index.js +1069 -4439
- package/compiled/chokidar/license +1 -1
- package/compiled/chokidar/package.json +1 -1
- package/compiled/css-loader/index.js +46 -46
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/http-proxy-middleware/index.d.ts +4 -3
- package/compiled/postcss/index.js +120 -114
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-load-config/index.js +10 -10
- package/compiled/postcss-loader/index.js +11 -11
- package/compiled/rsbuild-dev-middleware/index.js +64 -101
- package/compiled/rsbuild-dev-middleware/package.json +1 -1
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/compiled/tinyglobby/index.d.ts +25 -0
- package/compiled/tinyglobby/index.js +2749 -0
- package/compiled/tinyglobby/index1.js +17 -0
- package/compiled/tinyglobby/license +21 -0
- package/compiled/tinyglobby/package.json +1 -0
- package/dist/client/hmr.js +195 -213
- package/dist/client/overlay.js +88 -90
- package/dist/ignoreCssLoader.cjs +43 -29
- package/dist/index.cjs +6931 -13749
- package/dist/index.cjs.LICENSE.txt +13 -0
- package/dist/index.js +6754 -13826
- package/dist/index.js.LICENSE.txt +13 -0
- package/dist/transformLoader.cjs +59 -51
- package/dist/transformRawLoader.cjs +78 -60
- package/dist-types/cli/init.d.ts +2 -1
- package/dist-types/config.d.ts +2 -2
- package/dist-types/configChain.d.ts +1 -1
- package/dist-types/helpers/index.d.ts +3 -1
- package/dist-types/index.d.ts +1 -1
- package/dist-types/internal.d.ts +1 -13
- package/dist-types/logger.d.ts +1 -1
- package/dist-types/plugins/css.d.ts +1 -2
- package/dist-types/plugins/lazyCompilation.d.ts +1 -1
- package/dist-types/provider/createCompiler.d.ts +1 -1
- package/dist-types/provider/helpers.d.ts +12 -0
- package/dist-types/server/compilerDevMiddleware.d.ts +4 -3
- package/dist-types/server/devServer.d.ts +1 -1
- package/dist-types/server/helper.d.ts +1 -0
- package/dist-types/server/httpServer.d.ts +1 -1
- package/dist-types/server/middlewares.d.ts +2 -2
- package/dist-types/server/prodServer.d.ts +1 -1
- package/dist-types/server/restart.d.ts +4 -0
- package/dist-types/server/watchFiles.d.ts +4 -1
- package/dist-types/types/config.d.ts +20 -12
- package/dist-types/types/hooks.d.ts +1 -1
- package/dist-types/types/plugin.d.ts +2 -2
- package/dist-types/types/rsbuild.d.ts +3 -1
- package/dist-types/types/rspack.d.ts +1 -1
- package/dist-types/types/thirdParty.d.ts +1 -1
- package/package.json +15 -14
package/dist/client/overlay.js
CHANGED
|
@@ -1,39 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__hmr__ from "./hmr";
|
|
2
|
+
function _define_property(obj, key, value) {
|
|
3
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
else obj[key] = value;
|
|
10
|
+
return obj;
|
|
11
|
+
}
|
|
4
12
|
function stripAnsi(content) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
].join("|");
|
|
9
|
-
const regex = new RegExp(pattern, "g");
|
|
10
|
-
return content.replace(regex, "");
|
|
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, '');
|
|
11
16
|
}
|
|
12
17
|
function linkedText(root, selector, text) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
const el = root.querySelector(selector);
|
|
19
|
+
const fileRegex = /(?:[a-zA-Z]:\\|\/).*?:\d+:\d+/g;
|
|
20
|
+
let curIndex = 0;
|
|
21
|
+
let match = fileRegex.exec(text);
|
|
22
|
+
while(null !== match){
|
|
23
|
+
const { 0: file, index } = match;
|
|
24
|
+
if (null != index) {
|
|
25
|
+
const frag = text.slice(curIndex, index);
|
|
26
|
+
el.appendChild(document.createTextNode(frag));
|
|
27
|
+
const link = document.createElement('a');
|
|
28
|
+
link.textContent = file;
|
|
29
|
+
link.className = 'file-link';
|
|
30
|
+
link.onclick = ()=>{
|
|
31
|
+
fetch(`/__open-in-editor?file=${encodeURIComponent(file)}`);
|
|
32
|
+
};
|
|
33
|
+
el.appendChild(link);
|
|
34
|
+
curIndex += frag.length + file.length;
|
|
35
|
+
}
|
|
36
|
+
match = fileRegex.exec(text);
|
|
30
37
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const frag = text.slice(curIndex);
|
|
34
|
-
el.appendChild(document.createTextNode(frag));
|
|
38
|
+
const frag = text.slice(curIndex);
|
|
39
|
+
el.appendChild(document.createTextNode(frag));
|
|
35
40
|
}
|
|
36
|
-
|
|
41
|
+
const overlayTemplate = `
|
|
37
42
|
<style>
|
|
38
43
|
.root {
|
|
39
44
|
position: fixed;
|
|
@@ -153,68 +158,61 @@ var overlayTemplate = `
|
|
|
153
158
|
</div>
|
|
154
159
|
</div>
|
|
155
160
|
`;
|
|
156
|
-
|
|
157
|
-
}, customElements } = typeof window
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
161
|
+
const { HTMLElement = class {
|
|
162
|
+
}, customElements } = 'undefined' != typeof window ? window : globalThis;
|
|
163
|
+
class ErrorOverlay extends HTMLElement {
|
|
164
|
+
constructor(message){
|
|
165
|
+
var _root_querySelector;
|
|
166
|
+
super(), _define_property(this, "close", ()=>{
|
|
167
|
+
const remove = ()=>{
|
|
168
|
+
var _this_parentNode;
|
|
169
|
+
return null === (_this_parentNode = this.parentNode) || void 0 === _this_parentNode ? void 0 : _this_parentNode.removeChild(this);
|
|
170
|
+
};
|
|
171
|
+
if (this.animate) this.animate([
|
|
172
|
+
{
|
|
173
|
+
opacity: 1
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
opacity: 0
|
|
177
|
+
}
|
|
178
|
+
], {
|
|
179
|
+
duration: 300,
|
|
180
|
+
easing: 'ease-out'
|
|
181
|
+
}).addEventListener('finish', remove);
|
|
182
|
+
else remove();
|
|
183
|
+
});
|
|
184
|
+
if (!this.attachShadow) {
|
|
185
|
+
console.warn('[Rsbuild] Current browser version does not support displaying error overlay');
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const root = this.attachShadow({
|
|
189
|
+
mode: 'open'
|
|
190
|
+
});
|
|
191
|
+
root.innerHTML = overlayTemplate;
|
|
192
|
+
linkedText(root, '.content', stripAnsi(message.join('\n')).trim());
|
|
193
|
+
null === (_root_querySelector = root.querySelector('.close')) || void 0 === _root_querySelector || _root_querySelector.addEventListener('click', this.close);
|
|
194
|
+
// close overlay when click outside
|
|
195
|
+
this.addEventListener('click', this.close);
|
|
196
|
+
root.querySelector('.container').addEventListener('click', (e)=>{
|
|
197
|
+
e.stopPropagation();
|
|
198
|
+
});
|
|
199
|
+
const onEscKeydown = (e)=>{
|
|
200
|
+
if ('Escape' === e.key || 'Escape' === e.code) this.close();
|
|
201
|
+
document.removeEventListener('keydown', onEscKeydown);
|
|
202
|
+
};
|
|
203
|
+
document.addEventListener('keydown', onEscKeydown);
|
|
185
204
|
}
|
|
186
|
-
const root = this.attachShadow({
|
|
187
|
-
mode: "open"
|
|
188
|
-
});
|
|
189
|
-
root.innerHTML = overlayTemplate;
|
|
190
|
-
linkedText(root, ".content", stripAnsi(message.join("/n")).trim());
|
|
191
|
-
(_root_querySelector = root.querySelector(".close")) === null || _root_querySelector === void 0 ? void 0 : _root_querySelector.addEventListener("click", this.close);
|
|
192
|
-
this.addEventListener("click", this.close);
|
|
193
|
-
root.querySelector(".container").addEventListener("click", (e) => {
|
|
194
|
-
e.stopPropagation();
|
|
195
|
-
});
|
|
196
|
-
const onEscKeydown = (e) => {
|
|
197
|
-
if (e.key === "Escape" || e.code === "Escape") {
|
|
198
|
-
this.close();
|
|
199
|
-
}
|
|
200
|
-
document.removeEventListener("keydown", onEscKeydown);
|
|
201
|
-
};
|
|
202
|
-
document.addEventListener("keydown", onEscKeydown);
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
var overlayId = "rsbuild-error-overlay";
|
|
206
|
-
if (customElements && !customElements.get(overlayId)) {
|
|
207
|
-
customElements.define(overlayId, ErrorOverlay);
|
|
208
205
|
}
|
|
206
|
+
const overlayId = 'rsbuild-error-overlay';
|
|
207
|
+
if (customElements && !customElements.get(overlayId)) customElements.define(overlayId, ErrorOverlay);
|
|
209
208
|
function createOverlay(err) {
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
clearOverlay();
|
|
210
|
+
document.body.appendChild(new ErrorOverlay(err));
|
|
212
211
|
}
|
|
213
212
|
function clearOverlay() {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
registerOverlay(createOverlay, clearOverlay);
|
|
218
|
-
} else {
|
|
219
|
-
console.info("[Rsbuild] Failed to display error overlay as document is not available, you can disable the `dev.client.overlay` option.");
|
|
213
|
+
// use NodeList's forEach api instead of dom.iterable
|
|
214
|
+
// biome-ignore lint/complexity/noForEach: <explanation>
|
|
215
|
+
document.querySelectorAll(overlayId).forEach((n)=>n.close());
|
|
220
216
|
}
|
|
217
|
+
if ('undefined' != typeof document) (0, __WEBPACK_EXTERNAL_MODULE__hmr__.registerOverlay)(createOverlay, clearOverlay);
|
|
218
|
+
else console.info('[Rsbuild] Failed to display error overlay as document is not available, you can disable the `dev.client.overlay` option.');
|
package/dist/ignoreCssLoader.cjs
CHANGED
|
@@ -1,32 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
4
|
+
for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
|
|
5
|
+
enumerable: !0,
|
|
6
|
+
get: definition[key]
|
|
7
|
+
});
|
|
8
|
+
}, __webpack_require__.o = function(obj, prop) {
|
|
9
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
10
|
+
}, __webpack_require__.r = function(exports1) {
|
|
11
|
+
'undefined' != typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
12
|
+
value: 'Module'
|
|
13
|
+
}), Object.defineProperty(exports1, '__esModule', {
|
|
14
|
+
value: !0
|
|
15
|
+
});
|
|
9
16
|
};
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/loader/ignoreCssLoader.ts
|
|
21
|
-
var ignoreCssLoader_exports = {};
|
|
22
|
-
__export(ignoreCssLoader_exports, {
|
|
23
|
-
default: () => ignoreCssLoader_default
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(ignoreCssLoader_exports);
|
|
26
|
-
function ignoreCssLoader_default(source) {
|
|
27
|
-
this?.cacheable(true);
|
|
28
|
-
if (source.includes("___CSS_LOADER_EXPORT___")) {
|
|
29
|
-
return "";
|
|
30
|
-
}
|
|
31
|
-
return source;
|
|
17
|
+
var __webpack_exports__ = {};
|
|
18
|
+
function __WEBPACK_DEFAULT_EXPORT__(source) {
|
|
19
|
+
return (null === this || void 0 === this || this.cacheable(!0), source.includes('___CSS_LOADER_EXPORT___')) ? '' : source;
|
|
32
20
|
}
|
|
21
|
+
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
22
|
+
default: function() {
|
|
23
|
+
return __WEBPACK_DEFAULT_EXPORT__;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
var __webpack_export_target__ = exports;
|
|
27
|
+
for(var i in __webpack_exports__)__webpack_export_target__[i] = __webpack_exports__[i];
|
|
28
|
+
__webpack_exports__.__esModule && Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
29
|
+
value: !0
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
PLUGIN_CSS_NAME,
|
|
35
|
+
PLUGIN_SWC_NAME,
|
|
36
|
+
__internalHelper,
|
|
37
|
+
createRsbuild,
|
|
38
|
+
defineConfig,
|
|
39
|
+
ensureAssetPrefix,
|
|
40
|
+
loadConfig,
|
|
41
|
+
loadEnv,
|
|
42
|
+
logger,
|
|
43
|
+
mergeRsbuildConfig,
|
|
44
|
+
rspack,
|
|
45
|
+
version
|
|
46
|
+
});
|