@rsbuild/core 1.1.13 → 1.2.0-alpha.0

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.
@@ -1,22 +1,22 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 2174: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 5408: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const loader = __nccwpck_require__(7268);
5
+ const loader = __nccwpck_require__(2668);
6
6
  module.exports = loader.default;
7
7
  module.exports.defaultGetLocalIdent =
8
- __nccwpck_require__(8547).defaultGetLocalIdent;
8
+ __nccwpck_require__(9709).defaultGetLocalIdent;
9
9
  },
10
- 7268: (__unused_webpack_module, exports, __nccwpck_require__) => {
10
+ 2668: (__unused_webpack_module, exports, __nccwpck_require__) => {
11
11
  "use strict";
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports["default"] = loader;
14
14
  var _postcss = _interopRequireDefault(__nccwpck_require__(9961));
15
15
  var _package = _interopRequireDefault(__nccwpck_require__(7337));
16
16
  var _semver = { satisfies: () => true };
17
- var _options = _interopRequireDefault(__nccwpck_require__(1538));
18
- var _plugins = __nccwpck_require__(5640);
19
- var _utils = __nccwpck_require__(8547);
17
+ var _options = _interopRequireDefault(__nccwpck_require__(3255));
18
+ var _plugins = __nccwpck_require__(7064);
19
+ var _utils = __nccwpck_require__(9709);
20
20
  function _interopRequireDefault(obj) {
21
21
  return obj && obj.__esModule ? obj : { default: obj };
22
22
  }
@@ -243,7 +243,7 @@
243
243
  callback(null, `${importCode}${moduleCode}${exportCode}`);
244
244
  }
245
245
  },
246
- 5640: (__unused_webpack_module, exports, __nccwpck_require__) => {
246
+ 7064: (__unused_webpack_module, exports, __nccwpck_require__) => {
247
247
  "use strict";
248
248
  Object.defineProperty(exports, "__esModule", { value: true });
249
249
  Object.defineProperty(exports, "icssParser", {
@@ -265,22 +265,22 @@
265
265
  },
266
266
  });
267
267
  var _postcssImportParser = _interopRequireDefault(
268
- __nccwpck_require__(4017),
268
+ __nccwpck_require__(4990),
269
269
  );
270
270
  var _postcssIcssParser = _interopRequireDefault(
271
- __nccwpck_require__(7012),
271
+ __nccwpck_require__(4354),
272
272
  );
273
- var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(2339));
273
+ var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(9215));
274
274
  function _interopRequireDefault(obj) {
275
275
  return obj && obj.__esModule ? obj : { default: obj };
276
276
  }
277
277
  },
278
- 7012: (__unused_webpack_module, exports, __nccwpck_require__) => {
278
+ 4354: (__unused_webpack_module, exports, __nccwpck_require__) => {
279
279
  "use strict";
280
280
  Object.defineProperty(exports, "__esModule", { value: true });
281
281
  exports["default"] = void 0;
282
282
  var _icssUtils = __nccwpck_require__(4508);
283
- var _utils = __nccwpck_require__(8547);
283
+ var _utils = __nccwpck_require__(9709);
284
284
  const plugin = (options = {}) => ({
285
285
  postcssPlugin: "postcss-icss-parser",
286
286
  async OnceExit(root) {
@@ -379,14 +379,14 @@
379
379
  plugin.postcss = true;
380
380
  var _default = (exports["default"] = plugin);
381
381
  },
382
- 4017: (__unused_webpack_module, exports, __nccwpck_require__) => {
382
+ 4990: (__unused_webpack_module, exports, __nccwpck_require__) => {
383
383
  "use strict";
384
384
  Object.defineProperty(exports, "__esModule", { value: true });
385
385
  exports["default"] = void 0;
386
386
  var _postcssValueParser = _interopRequireDefault(
387
387
  __nccwpck_require__(7555),
388
388
  );
389
- var _utils = __nccwpck_require__(8547);
389
+ var _utils = __nccwpck_require__(9709);
390
390
  function _interopRequireDefault(obj) {
391
391
  return obj && obj.__esModule ? obj : { default: obj };
392
392
  }
@@ -691,14 +691,14 @@
691
691
  plugin.postcss = true;
692
692
  var _default = (exports["default"] = plugin);
693
693
  },
694
- 2339: (__unused_webpack_module, exports, __nccwpck_require__) => {
694
+ 9215: (__unused_webpack_module, exports, __nccwpck_require__) => {
695
695
  "use strict";
696
696
  Object.defineProperty(exports, "__esModule", { value: true });
697
697
  exports["default"] = void 0;
698
698
  var _postcssValueParser = _interopRequireDefault(
699
699
  __nccwpck_require__(7555),
700
700
  );
701
- var _utils = __nccwpck_require__(8547);
701
+ var _utils = __nccwpck_require__(9709);
702
702
  function _interopRequireDefault(obj) {
703
703
  return obj && obj.__esModule ? obj : { default: obj };
704
704
  }
@@ -1041,7 +1041,7 @@
1041
1041
  plugin.postcss = true;
1042
1042
  var _default = (exports["default"] = plugin);
1043
1043
  },
1044
- 8547: (__unused_webpack_module, exports, __nccwpck_require__) => {
1044
+ 9709: (__unused_webpack_module, exports, __nccwpck_require__) => {
1045
1045
  "use strict";
1046
1046
  Object.defineProperty(exports, "__esModule", { value: true });
1047
1047
  exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;
@@ -7968,7 +7968,7 @@
7968
7968
  "use strict";
7969
7969
  module.exports = require("util");
7970
7970
  },
7971
- 1538: (module) => {
7971
+ 3255: (module) => {
7972
7972
  "use strict";
7973
7973
  module.exports = JSON.parse(
7974
7974
  '{"title":"CSS Loader options","additionalProperties":false,"properties":{"url":{"description":"Allows to enables/disables `url()`/`image-set()` functions handling.","link":"https://github.com/webpack-contrib/css-loader#url","anyOf":[{"type":"boolean"},{"type":"object","properties":{"filter":{"instanceof":"Function"}},"additionalProperties":false}]},"import":{"description":"Allows to enables/disables `@import` at-rules handling.","link":"https://github.com/webpack-contrib/css-loader#import","anyOf":[{"type":"boolean"},{"type":"object","properties":{"filter":{"instanceof":"Function"}},"additionalProperties":false}]},"modules":{"description":"Allows to enable/disable CSS Modules or ICSS and setup configuration.","link":"https://github.com/webpack-contrib/css-loader#modules","anyOf":[{"type":"boolean"},{"enum":["local","global","pure","icss"]},{"type":"object","additionalProperties":false,"properties":{"auto":{"description":"Allows auto enable CSS modules based on filename.","link":"https://github.com/webpack-contrib/css-loader#auto","anyOf":[{"instanceof":"RegExp"},{"instanceof":"Function"},{"type":"boolean"}]},"mode":{"description":"Setup `mode` option.","link":"https://github.com/webpack-contrib/css-loader#mode","anyOf":[{"enum":["local","global","pure","icss"]},{"instanceof":"Function"}]},"localIdentName":{"description":"Allows to configure the generated local ident name.","link":"https://github.com/webpack-contrib/css-loader#localidentname","type":"string","minLength":1},"localIdentContext":{"description":"Allows to redefine basic loader context for local ident name.","link":"https://github.com/webpack-contrib/css-loader#localidentcontext","type":"string","minLength":1},"localIdentHashSalt":{"description":"Allows to add custom hash to generate more unique classes.","link":"https://github.com/webpack-contrib/css-loader#localidenthashsalt","type":"string","minLength":1},"localIdentHashFunction":{"description":"Allows to specify hash function to generate classes.","link":"https://github.com/webpack-contrib/css-loader#localidenthashfunction","type":"string","minLength":1},"localIdentHashDigest":{"description":"Allows to specify hash digest to generate classes.","link":"https://github.com/webpack-contrib/css-loader#localidenthashdigest","type":"string","minLength":1},"localIdentHashDigestLength":{"description":"Allows to specify hash digest length to generate classes.","link":"https://github.com/webpack-contrib/css-loader#localidenthashdigestlength","type":"number"},"hashStrategy":{"description":"Allows to specify should localName be used when computing the hash.","link":"https://github.com/webpack-contrib/css-loader#hashstrategy","enum":["resource-path-and-local-name","minimal-subset"]},"localIdentRegExp":{"description":"Allows to specify custom RegExp for local ident name.","link":"https://github.com/webpack-contrib/css-loader#localidentregexp","anyOf":[{"type":"string","minLength":1},{"instanceof":"RegExp"}]},"getLocalIdent":{"description":"Allows to specify a function to generate the classname.","link":"https://github.com/webpack-contrib/css-loader#getlocalident","instanceof":"Function"},"namedExport":{"description":"Enables/disables ES modules named export for locals.","link":"https://github.com/webpack-contrib/css-loader#namedexport","type":"boolean"},"exportGlobals":{"description":"Allows to export names from global class or id, so you can use that as local name.","link":"https://github.com/webpack-contrib/css-loader#exportglobals","type":"boolean"},"exportLocalsConvention":{"description":"Style of exported classnames.","link":"https://github.com/webpack-contrib/css-loader#localsconvention","anyOf":[{"enum":["asIs","as-is","camelCase","camel-case","camelCaseOnly","camel-case-only","dashes","dashesOnly","dashes-only"]},{"instanceof":"Function"}]},"exportOnlyLocals":{"description":"Export only locals.","link":"https://github.com/webpack-contrib/css-loader#exportonlylocals","type":"boolean"},"getJSON":{"description":"Allows outputting of CSS modules mapping through a callback.","link":"https://github.com/webpack-contrib/css-loader#getJSON","instanceof":"Function"}}}]},"sourceMap":{"description":"Allows to enable/disable source maps.","link":"https://github.com/webpack-contrib/css-loader#sourcemap","type":"boolean"},"importLoaders":{"description":"Allows enables/disables or setups number of loaders applied before CSS loader for `@import`/CSS Modules and ICSS imports.","link":"https://github.com/webpack-contrib/css-loader#importloaders","anyOf":[{"type":"boolean"},{"type":"string"},{"type":"integer"}]},"esModule":{"description":"Use the ES modules syntax.","link":"https://github.com/webpack-contrib/css-loader#esmodule","type":"boolean"},"exportType":{"description":"Allows exporting styles as array with modules, string or constructable stylesheet (i.e. `CSSStyleSheet`).","link":"https://github.com/webpack-contrib/css-loader#exporttype","enum":["array","string","css-style-sheet"]}},"type":"object"}',
@@ -8003,6 +8003,6 @@
8003
8003
  }
8004
8004
  if (typeof __nccwpck_require__ !== "undefined")
8005
8005
  __nccwpck_require__.ab = __dirname + "/";
8006
- var __webpack_exports__ = __nccwpck_require__(2174);
8006
+ var __webpack_exports__ = __nccwpck_require__(5408);
8007
8007
  module.exports = __webpack_exports__;
8008
8008
  })();
@@ -1,8 +1,8 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 815: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 374: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const { HtmlWebpackChildCompiler } = __nccwpck_require__(573);
5
+ const { HtmlWebpackChildCompiler } = __nccwpck_require__(744);
6
6
  const compilerMap = new WeakMap();
7
7
  class CachedChildCompilation {
8
8
  constructor(compiler) {
@@ -304,7 +304,7 @@
304
304
  }
305
305
  module.exports = { CachedChildCompilation };
306
306
  },
307
- 573: (module) => {
307
+ 744: (module) => {
308
308
  "use strict";
309
309
  class HtmlWebpackChildCompiler {
310
310
  constructor(templates) {
@@ -473,7 +473,7 @@
473
473
  }
474
474
  module.exports = { HtmlWebpackChildCompiler };
475
475
  },
476
- 987: (module) => {
476
+ 48: (module) => {
477
477
  "use strict";
478
478
  module.exports = {};
479
479
  module.exports.none = (chunks) => chunks;
@@ -492,7 +492,7 @@
492
492
  };
493
493
  module.exports.auto = module.exports.none;
494
494
  },
495
- 866: (module) => {
495
+ 796: (module) => {
496
496
  "use strict";
497
497
  module.exports = function (err) {
498
498
  return {
@@ -513,7 +513,7 @@
513
513
  };
514
514
  };
515
515
  },
516
- 58: (module, __unused_webpack_exports, __nccwpck_require__) => {
516
+ 894: (module, __unused_webpack_exports, __nccwpck_require__) => {
517
517
  "use strict";
518
518
  const { AsyncSeriesWaterfallHook } = __nccwpck_require__(348);
519
519
  const htmlWebpackPluginHooksMap = new WeakMap();
@@ -539,7 +539,7 @@
539
539
  }
540
540
  module.exports = { getHtmlRspackPluginHooks };
541
541
  },
542
- 961: (module) => {
542
+ 104: (module) => {
543
543
  const voidTags = [
544
544
  "area",
545
545
  "base",
@@ -607,19 +607,19 @@
607
607
  htmlTagObjectToString,
608
608
  };
609
609
  },
610
- 918: (module, __unused_webpack_exports, __nccwpck_require__) => {
610
+ 729: (module, __unused_webpack_exports, __nccwpck_require__) => {
611
611
  "use strict";
612
612
  const promisify = __nccwpck_require__(837).promisify;
613
613
  const vm = __nccwpck_require__(144);
614
614
  const fs = __nccwpck_require__(147);
615
615
  const path = __nccwpck_require__(17);
616
- const { CachedChildCompilation } = __nccwpck_require__(815);
616
+ const { CachedChildCompilation } = __nccwpck_require__(374);
617
617
  const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
618
- __nccwpck_require__(961);
619
- const prettyError = __nccwpck_require__(866);
620
- const chunkSorter = __nccwpck_require__(987);
618
+ __nccwpck_require__(104);
619
+ const prettyError = __nccwpck_require__(796);
620
+ const chunkSorter = __nccwpck_require__(48);
621
621
  const getHtmlRspackPluginHooks =
622
- __nccwpck_require__(58).getHtmlRspackPluginHooks;
622
+ __nccwpck_require__(894).getHtmlRspackPluginHooks;
623
623
  class HtmlRspackPlugin {
624
624
  constructor(userOptions = {}) {
625
625
  this.version = HtmlRspackPlugin.version;
@@ -1578,6 +1578,6 @@
1578
1578
  }
1579
1579
  if (typeof __nccwpck_require__ !== "undefined")
1580
1580
  __nccwpck_require__.ab = __dirname + "/";
1581
- var __webpack_exports__ = __nccwpck_require__(918);
1581
+ var __webpack_exports__ = __nccwpck_require__(729);
1582
1582
  module.exports = __webpack_exports__;
1583
1583
  })();
@@ -1,17 +1,17 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 184: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
- module.exports = __nccwpck_require__(526)["default"];
4
+ 956: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
+ module.exports = __nccwpck_require__(95)["default"];
6
6
  },
7
- 526: (__unused_webpack_module, exports, __nccwpck_require__) => {
7
+ 95: (__unused_webpack_module, exports, __nccwpck_require__) => {
8
8
  var __webpack_unused_export__;
9
9
  __webpack_unused_export__ = { value: true };
10
10
  exports["default"] = loader;
11
11
  var _path = _interopRequireDefault(__nccwpck_require__(17));
12
12
  var _package = _interopRequireDefault(__nccwpck_require__(337));
13
- var _options = _interopRequireDefault(__nccwpck_require__(612));
14
- var _utils = __nccwpck_require__(922);
13
+ var _options = _interopRequireDefault(__nccwpck_require__(728));
14
+ var _utils = __nccwpck_require__(619);
15
15
  function _interopRequireDefault(obj) {
16
16
  return obj && obj.__esModule ? obj : { default: obj };
17
17
  }
@@ -189,7 +189,7 @@
189
189
  callback(null, result.css, map, { ast });
190
190
  }
191
191
  },
192
- 922: (module, exports, __nccwpck_require__) => {
192
+ 619: (module, exports, __nccwpck_require__) => {
193
193
  module = __nccwpck_require__.nmd(module);
194
194
  Object.defineProperty(exports, "__esModule", { value: true });
195
195
  exports.exec = exec;
@@ -691,7 +691,7 @@
691
691
  310: (module) => {
692
692
  module.exports = require("url");
693
693
  },
694
- 612: (module) => {
694
+ 728: (module) => {
695
695
  module.exports = JSON.parse(
696
696
  '{"title":"PostCSS Loader options","type":"object","properties":{"postcssOptions":{"description":"Options to pass through to `Postcss`.","link":"https://github.com/webpack-contrib/postcss-loader#postcssOptions","anyOf":[{"type":"object","additionalProperties":true,"properties":{"config":{"description":"Allows to specify PostCSS config path.","link":"https://github.com/webpack-contrib/postcss-loader#config","anyOf":[{"description":"Allows to specify the path to the configuration file","type":"string"},{"description":"Enables/Disables autoloading config","type":"boolean"}]}}},{"instanceof":"Function"}]},"execute":{"description":"Enables/Disables PostCSS parser support in \'CSS-in-JS\'.","link":"https://github.com/webpack-contrib/postcss-loader#execute","type":"boolean"},"sourceMap":{"description":"Enables/Disables generation of source maps.","link":"https://github.com/webpack-contrib/postcss-loader#sourcemap","type":"boolean"},"implementation":{"description":"The implementation of postcss to use, instead of the locally installed version","link":"https://github.com/webpack-contrib/postcss-loader#implementation","anyOf":[{"type":"string"},{"instanceof":"Function"}]}},"additionalProperties":false}',
697
697
  );
@@ -736,6 +736,6 @@
736
736
  })();
737
737
  if (typeof __nccwpck_require__ !== "undefined")
738
738
  __nccwpck_require__.ab = __dirname + "/";
739
- var __webpack_exports__ = __nccwpck_require__(184);
739
+ var __webpack_exports__ = __nccwpck_require__(956);
740
740
  module.exports = __webpack_exports__;
741
741
  })();
@@ -1,7 +1,7 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 699: (__unused_webpack_module, exports, __nccwpck_require__) => {
4
+ 273: (__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
- 586: (__unused_webpack_module, exports, __nccwpck_require__) => {
123
+ 903: (__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__(699);
133
+ const helpers_1 = __nccwpck_require__(273);
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__(586);
315
+ const hooks_1 = __nccwpck_require__(903);
316
316
  Object.defineProperty(exports, "getCompilerHooks", {
317
317
  enumerable: true,
318
318
  get: function () {
@@ -9,155 +9,10 @@ function _define_property(obj, key, value) {
9
9
  else obj[key] = value;
10
10
  return obj;
11
11
  }
12
- function linkedText(root, selector, text) {
13
- const el = root.querySelector(selector);
14
- const fileRegex = /(?:[a-zA-Z]:\\|\/).*?:\d+:\d+/g;
15
- let curIndex = 0;
16
- let match = fileRegex.exec(text);
17
- while(null !== match){
18
- const { 0: file, index } = match;
19
- if (null != index) {
20
- const frag = text.slice(curIndex, index);
21
- el.insertAdjacentHTML('beforeend', frag);
22
- const link = document.createElement('a');
23
- link.textContent = file;
24
- link.className = 'file-link';
25
- link.onclick = ()=>{
26
- fetch(`/__open-in-editor?file=${encodeURIComponent(file)}`);
27
- };
28
- el.appendChild(link);
29
- curIndex += frag.length + file.length;
30
- }
31
- match = fileRegex.exec(text);
32
- }
33
- const frag = text.slice(curIndex);
34
- el.insertAdjacentHTML('beforeend', frag);
35
- }
36
- const overlayTemplate = `
37
- <style>
38
- .root {
39
- position: fixed;
40
- z-index: 9999;
41
- top: 0;
42
- left: 0;
43
- width: 100%;
44
- height: 100%;
45
- overflow-y: scroll;
46
- margin: 0;
47
- background: rgba(0, 0, 0, 0.66);
48
- cursor: pointer;
49
- }
50
- .container {
51
- font-family: Menlo, Consolas, monospace;
52
- line-height: 1.6;
53
- width: 960px;
54
- max-width: 85%;
55
- color: #d8d8d8;
56
- margin: 32px auto;
57
- padding: 32px 40px;
58
- position: relative;
59
- background: #181818;
60
- border-radius: 24px;
61
- box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);
62
- overflow: hidden;
63
- direction: ltr;
64
- text-align: left;
65
- box-sizing: border-box;
66
- cursor: default;
67
- }
68
- .title {
69
- margin: 0 0 20px;
70
- padding-bottom: 12px;
71
- font-size: 17px;
72
- font-weight: 600;
73
- color: #fb6a6a;
74
- border-bottom: 2px solid rgba(252,94,94,.66);
75
- }
76
- .content {
77
- margin: 0;
78
- font-size: 14px;
79
- font-family: inherit;
80
- overflow-x: scroll;
81
- scrollbar-width: none;
82
- }
83
- .content::-webkit-scrollbar {
84
- display: none;
85
- }
86
- .file-link {
87
- cursor: pointer;
88
- color: #6eecf7;
89
- text-decoration: underline;
90
- text-underline-offset: 3px;
91
- &:hover {
92
- opacity: 0.8;
93
- }
94
- &:active {
95
- opacity: 0.6;
96
- }
97
- }
98
- .close {
99
- position: absolute;
100
- top: 27px;
101
- right: 32px;
102
- width: 32px;
103
- height: 32px;
104
- cursor: pointer;
105
- }
106
- .close:hover {
107
- opacity: 0.8;
108
- }
109
- .close:active {
110
- opacity: 0.6;
111
- }
112
- .close:before,
113
- .close:after {
114
- position: absolute;
115
- left: 16px;
116
- top: 8px;
117
- content: ' ';
118
- height: 18px;
119
- width: 2px;
120
- border-radius: 4px;
121
- background-color: #b8b8b8;
122
- }
123
- .close:before {
124
- transform: rotate(45deg);
125
- }
126
- .close:after {
127
- transform: rotate(-45deg);
128
- }
129
- .footer {
130
- font-size: 12px;
131
- color: #7e6a92;
132
- margin-top: 20px;
133
- padding-top: 12px;
134
- border-top: 2px solid rgba(126,106,146,.6);
135
- }
136
- .footer p {
137
- margin: 4px 0 0;
138
- }
139
- .footer span {
140
- color: #a88dc3;
141
- }
142
- </style>
143
-
144
- <div class="root">
145
- <div class="container">
146
- <div class="close"></div>
147
- <p class="title">Build failed</p>
148
- <pre class="content"></pre>
149
- <footer class="footer">
150
- <p><span>Fix error</span>, click outside, or press Esc to close the overlay.</p>
151
- <p>Disable overlay by setting Rsbuild's <span>dev.client.overlay</span> config to false.<p>
152
- </footer>
153
- </div>
154
- </div>
155
- `;
156
12
  const { HTMLElement = class {
157
13
  }, customElements } = 'undefined' != typeof window ? window : globalThis;
158
14
  class ErrorOverlay extends HTMLElement {
159
- constructor(message){
160
- var _root_querySelector;
15
+ constructor(html){
161
16
  super(), _define_property(this, "close", ()=>{
162
17
  const remove = ()=>{
163
18
  var _this_parentNode;
@@ -183,11 +38,14 @@ class ErrorOverlay extends HTMLElement {
183
38
  const root = this.attachShadow({
184
39
  mode: 'open'
185
40
  });
186
- root.innerHTML = overlayTemplate;
187
- linkedText(root, '.content', message.join('\n\n').trim());
188
- null === (_root_querySelector = root.querySelector('.close')) || void 0 === _root_querySelector || _root_querySelector.addEventListener('click', this.close);
41
+ root.innerHTML = html;
42
+ root.querySelector('.close').addEventListener('click', this.close);
189
43
  this.addEventListener('click', this.close);
190
44
  root.querySelector('.container').addEventListener('click', (e)=>{
45
+ if (e.target) {
46
+ const { file } = e.target.dataset;
47
+ if (file) fetch(`/__open-in-editor?file=${encodeURIComponent(file)}`);
48
+ }
191
49
  e.stopPropagation();
192
50
  });
193
51
  const onEscKeydown = (e)=>{
@@ -199,9 +57,9 @@ class ErrorOverlay extends HTMLElement {
199
57
  }
200
58
  const overlayId = 'rsbuild-error-overlay';
201
59
  if (customElements && !customElements.get(overlayId)) customElements.define(overlayId, ErrorOverlay);
202
- function createOverlay(err) {
60
+ function createOverlay(html) {
203
61
  clearOverlay();
204
- document.body.appendChild(new ErrorOverlay(err));
62
+ document.body.appendChild(new ErrorOverlay(html));
205
63
  }
206
64
  function clearOverlay() {
207
65
  document.querySelectorAll(overlayId).forEach((n)=>n.close());