@rsbuild/core 0.5.5 → 0.5.6
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/dist/cli/commands.js +1 -1
- package/dist/cli/prepare.js +1 -1
- package/dist/client/hmr.mjs +45 -30
- package/dist/index.js +1 -1
- package/dist/provider/createContext.js +1 -1
- package/dist/provider/initPlugins.js +12 -0
- package/package.json +2 -2
package/dist/cli/commands.js
CHANGED
|
@@ -39,7 +39,7 @@ const applyServerOptions = (command) => {
|
|
|
39
39
|
command.option("-o --open [url]", "open the page in browser on startup").option("--port <port>", "specify a port number for server to listen").option("--host <host>", "specify the host that the server listens to");
|
|
40
40
|
};
|
|
41
41
|
function runCli() {
|
|
42
|
-
import_commander.program.name("rsbuild").usage("<command> [options]").version("0.5.
|
|
42
|
+
import_commander.program.name("rsbuild").usage("<command> [options]").version("0.5.6");
|
|
43
43
|
const devCommand = import_commander.program.command("dev");
|
|
44
44
|
const buildCommand = import_commander.program.command("build");
|
|
45
45
|
const previewCommand = import_commander.program.command("preview");
|
package/dist/cli/prepare.js
CHANGED
|
@@ -34,7 +34,7 @@ function prepareCli() {
|
|
|
34
34
|
if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
|
|
35
35
|
console.log();
|
|
36
36
|
}
|
|
37
|
-
import_rslog.logger.greet(` ${`Rsbuild v${"0.5.
|
|
37
|
+
import_rslog.logger.greet(` ${`Rsbuild v${"0.5.6"}`}
|
|
38
38
|
`);
|
|
39
39
|
}
|
|
40
40
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/client/hmr.mjs
CHANGED
|
@@ -64,19 +64,18 @@ function _construct(Parent, args, Class) {
|
|
|
64
64
|
}
|
|
65
65
|
return _construct.apply(null, arguments);
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
function _define_property(obj, key, value) {
|
|
68
|
+
if (key in obj) {
|
|
69
|
+
Object.defineProperty(obj, key, {
|
|
70
|
+
value: value,
|
|
71
|
+
enumerable: true,
|
|
72
|
+
configurable: true,
|
|
73
|
+
writable: true
|
|
74
|
+
});
|
|
75
|
+
} else {
|
|
76
|
+
obj[key] = value;
|
|
74
77
|
}
|
|
75
|
-
|
|
76
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
77
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
78
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
79
|
-
return Constructor;
|
|
78
|
+
return obj;
|
|
80
79
|
}
|
|
81
80
|
function _get_prototype_of(o) {
|
|
82
81
|
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
@@ -447,7 +446,7 @@ function linkedText(root, selector, text) {
|
|
|
447
446
|
var frag = text.slice(curIndex);
|
|
448
447
|
el.appendChild(document.createTextNode(frag));
|
|
449
448
|
}
|
|
450
|
-
var overlayTemplate = '\n<style>\n.root {\n position: fixed;\n z-index: 9999;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow-y: scroll;\n margin: 0;\n background: rgba(0, 0, 0, 0.66);\n cursor: pointer;\n}\n
|
|
449
|
+
var overlayTemplate = '\n<style>\n.root {\n position: fixed;\n z-index: 9999;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow-y: scroll;\n margin: 0;\n background: rgba(0, 0, 0, 0.66);\n cursor: pointer;\n}\n.container {\n font-family: Menlo, Consolas, monospace;\n line-height: 1.6;\n width: 800px;\n max-width: 85%;\n color: #d8d8d8;\n margin: 32px auto;\n padding: 32px 40px;\n position: relative;\n background: #181818;\n border-radius: 24px;\n box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);\n overflow: hidden;\n direction: ltr;\n text-align: left;\n box-sizing: border-box;\n cursor: default;\n}\n.title {\n margin: 0 0 20px;\n padding-bottom: 12px;\n font-size: 17px;\n font-weight: 600;\n color: #fc5e5e;\n border-bottom: 2px solid rgba(252,94,94,.66);\n}\n.content {\n margin: 0;\n font-size: 14px;\n font-family: inherit;\n overflow-x: scroll;\n scrollbar-width: none;\n color: #b8b8b8;\n}\n.content::-webkit-scrollbar {\n display: none;\n}\n.file-link {\n cursor: pointer;\n color: #27caca;\n text-decoration: underline;\n &:hover {\n opacity: 0.8;\n }\n &:active {\n opacity: 0.6;\n }\n}\n.close {\n position: absolute;\n top: 27px;\n right: 32px;\n width: 32px;\n height: 32px;\n cursor: pointer;\n}\n.close:hover {\n opacity: 0.8;\n}\n.close:active {\n opacity: 0.6;\n}\n.close:before,\n.close:after {\n position: absolute;\n left: 16px;\n top: 8px;\n content: \' \';\n height: 18px;\n width: 2px;\n border-radius: 4px;\n background-color: #b8b8b8;\n}\n.close:before {\n transform: rotate(45deg);\n}\n.close:after {\n transform: rotate(-45deg);\n}\n.footer {\n font-size: 12px;\n color: #7e6a92;\n margin-top: 20px;\n padding-top: 12px;\n border-top: 2px solid rgba(126,106,146,.6);\n}\n.footer p {\n margin: 4px 0 0;\n}\n.footer span {\n color: #a88dc3;\n}\n</style>\n\n<div class="root">\n <div class="container">\n <div class="close"></div>\n <p class="title">Compilation failed</p>\n <pre class="content"></pre>\n <footer class="footer">\n <p><span>Fix error</span>, click outside, or press Esc to close the overlay.</p>\n <p>Disable overlay by setting Rsbuild\'s <span>dev.client.overlay</span> config to false.<p>\n </footer>\n </div>\n</div>\n';
|
|
451
450
|
var _globalThis_HTMLElement = globalThis.HTMLElement, HTMLElement = _globalThis_HTMLElement === void 0 ? function HTMLElement() {
|
|
452
451
|
"use strict";
|
|
453
452
|
_class_call_check(this, HTMLElement);
|
|
@@ -459,9 +458,31 @@ var ErrorOverlay = /*#__PURE__*/ function(HTMLElement) {
|
|
|
459
458
|
function ErrorOverlay(message) {
|
|
460
459
|
_class_call_check(this, ErrorOverlay);
|
|
461
460
|
var _this;
|
|
461
|
+
var _root_querySelector;
|
|
462
462
|
_this = _super.call(this);
|
|
463
|
+
_define_property(_assert_this_initialized(_this), "close", function() {
|
|
464
|
+
var remove = function() {
|
|
465
|
+
var _this_parentNode;
|
|
466
|
+
return (_this_parentNode = _this.parentNode) === null || _this_parentNode === void 0 ? void 0 : _this_parentNode.removeChild(_assert_this_initialized(_this));
|
|
467
|
+
};
|
|
468
|
+
if (_this.animate) {
|
|
469
|
+
_this.animate([
|
|
470
|
+
{
|
|
471
|
+
opacity: 1
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
opacity: 0
|
|
475
|
+
}
|
|
476
|
+
], {
|
|
477
|
+
duration: 300,
|
|
478
|
+
easing: "ease-out"
|
|
479
|
+
}).addEventListener("finish", remove);
|
|
480
|
+
} else {
|
|
481
|
+
remove();
|
|
482
|
+
}
|
|
483
|
+
});
|
|
463
484
|
if (!_this.attachShadow) {
|
|
464
|
-
console.warn("
|
|
485
|
+
console.warn("[Rsbuild] Current browser version does not support displaying error overlay");
|
|
465
486
|
return _possible_constructor_return(_this);
|
|
466
487
|
}
|
|
467
488
|
var root = _this.attachShadow({
|
|
@@ -469,26 +490,20 @@ var ErrorOverlay = /*#__PURE__*/ function(HTMLElement) {
|
|
|
469
490
|
});
|
|
470
491
|
root.innerHTML = overlayTemplate;
|
|
471
492
|
linkedText(root, ".content", stripAnsi(message.join("/n")).trim());
|
|
472
|
-
root.querySelector(".close").addEventListener("click",
|
|
473
|
-
|
|
474
|
-
});
|
|
475
|
-
_this.addEventListener("click", function() {
|
|
476
|
-
_this.close();
|
|
477
|
-
});
|
|
493
|
+
(_root_querySelector = root.querySelector(".close")) === null || _root_querySelector === void 0 ? void 0 : _root_querySelector.addEventListener("click", _this.close);
|
|
494
|
+
_this.addEventListener("click", _this.close);
|
|
478
495
|
root.querySelector(".container").addEventListener("click", function(e) {
|
|
479
496
|
e.stopPropagation();
|
|
480
497
|
});
|
|
498
|
+
var onEscKeydown = function(e) {
|
|
499
|
+
if (e.key === "Escape" || e.code === "Escape") {
|
|
500
|
+
_this.close();
|
|
501
|
+
}
|
|
502
|
+
document.removeEventListener("keydown", onEscKeydown);
|
|
503
|
+
};
|
|
504
|
+
document.addEventListener("keydown", onEscKeydown);
|
|
481
505
|
return _this;
|
|
482
506
|
}
|
|
483
|
-
_create_class(ErrorOverlay, [
|
|
484
|
-
{
|
|
485
|
-
key: "close",
|
|
486
|
-
value: function close() {
|
|
487
|
-
var _this_parentNode;
|
|
488
|
-
(_this_parentNode = this.parentNode) === null || _this_parentNode === void 0 ? void 0 : _this_parentNode.removeChild(this);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
]);
|
|
492
507
|
return ErrorOverlay;
|
|
493
508
|
}(_wrap_native_super(HTMLElement));
|
|
494
509
|
var overlayId = "rsbuild-error-overlay";
|
|
@@ -498,7 +513,7 @@ if (customElements && !customElements.get(overlayId)) {
|
|
|
498
513
|
var documentAvailable = typeof document !== "undefined";
|
|
499
514
|
function createOverlay(err) {
|
|
500
515
|
if (!documentAvailable) {
|
|
501
|
-
console.info("Failed to display
|
|
516
|
+
console.info("[Rsbuild] Failed to display error overlay as document is not available, you can disable the `dev.client.overlay` option.");
|
|
502
517
|
return;
|
|
503
518
|
}
|
|
504
519
|
clearOverlay();
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,7 @@ var import_config = require("./config");
|
|
|
38
38
|
var import_shared = require("@rsbuild/shared");
|
|
39
39
|
var import_mergeConfig = require("./mergeConfig");
|
|
40
40
|
var import_constants = require("./constants");
|
|
41
|
-
const version = "0.5.
|
|
41
|
+
const version = "0.5.6";
|
|
42
42
|
// Annotate the CommonJS export names for ESM import in node:
|
|
43
43
|
0 && (module.exports = {
|
|
44
44
|
PLUGIN_CSS_NAME,
|
|
@@ -44,7 +44,7 @@ async function createContextByConfig(options, bundlerType, config = {}) {
|
|
|
44
44
|
const context = {
|
|
45
45
|
entry: (0, import_entry.getEntryObject)(config, "web"),
|
|
46
46
|
targets: config.output?.targets || [],
|
|
47
|
-
version: "0.5.
|
|
47
|
+
version: "0.5.6",
|
|
48
48
|
rootPath,
|
|
49
49
|
distPath,
|
|
50
50
|
cachePath,
|
|
@@ -63,11 +63,23 @@ function getPluginAPI({
|
|
|
63
63
|
{}
|
|
64
64
|
);
|
|
65
65
|
};
|
|
66
|
+
const exposed = [];
|
|
67
|
+
const expose = (id, api) => {
|
|
68
|
+
exposed.push({ id, api });
|
|
69
|
+
};
|
|
70
|
+
const useExposed = (id) => {
|
|
71
|
+
const matched = exposed.find((item) => item.id === id);
|
|
72
|
+
if (matched) {
|
|
73
|
+
return matched.api;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
66
76
|
(0, import_shared.onExitProcess)(() => {
|
|
67
77
|
hooks.onExit.call();
|
|
68
78
|
});
|
|
69
79
|
return {
|
|
70
80
|
context: publicContext,
|
|
81
|
+
expose,
|
|
82
|
+
useExposed,
|
|
71
83
|
getHTMLPaths,
|
|
72
84
|
getRsbuildConfig,
|
|
73
85
|
getNormalizedConfig,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"core-js": "~3.36.0",
|
|
58
58
|
"html-webpack-plugin": "npm:html-rspack-plugin@5.6.2",
|
|
59
59
|
"postcss": "^8.4.38",
|
|
60
|
-
"@rsbuild/shared": "0.5.
|
|
60
|
+
"@rsbuild/shared": "0.5.6"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/node": "16.x",
|