@rsbuild/core 1.4.11 → 1.4.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.
Files changed (35) hide show
  1. package/compiled/css-loader/index.js +18 -18
  2. package/compiled/html-rspack-plugin/index.js +14 -14
  3. package/compiled/launch-editor-middleware/index.js +32 -21
  4. package/compiled/launch-editor-middleware/package.json +1 -1
  5. package/compiled/postcss-load-config/index.js +10 -10
  6. package/compiled/postcss-loader/index.js +6 -6
  7. package/compiled/rsbuild-dev-middleware/index.js +25 -25
  8. package/compiled/rspack-chain/package.json +1 -1
  9. package/compiled/rspack-chain/types/index.d.ts +11 -0
  10. package/compiled/rspack-manifest-plugin/index.js +4 -4
  11. package/compiled/style-loader/index.js +10 -10
  12. package/dist/client/hmr.js +13 -2
  13. package/dist/client/overlay.js +3 -1
  14. package/dist/index.cjs +1322 -217
  15. package/dist/index.js +1304 -209
  16. package/dist/transformLoader.mjs +7 -5
  17. package/dist/transformRawLoader.mjs +7 -5
  18. package/dist-types/configChain.d.ts +1 -1
  19. package/dist-types/constants.d.ts +1 -0
  20. package/dist-types/helpers/index.d.ts +2 -2
  21. package/dist-types/helpers/stats.d.ts +1 -0
  22. package/dist-types/rspack-plugins/RsbuildHtmlPlugin.d.ts +1 -0
  23. package/dist-types/server/compilationMiddleware.d.ts +0 -4
  24. package/dist-types/server/devServer.d.ts +7 -2
  25. package/dist-types/server/historyApiFallback.d.ts +2 -0
  26. package/dist-types/server/socketServer.d.ts +24 -7
  27. package/dist-types/types/config.d.ts +20 -10
  28. package/dist-types/types/hooks.d.ts +1 -1
  29. package/dist-types/types/plugin.d.ts +1 -2
  30. package/package.json +9 -10
  31. package/compiled/connect-history-api-fallback/index.d.ts +0 -1
  32. package/compiled/connect-history-api-fallback/index.js +0 -149
  33. package/compiled/connect-history-api-fallback/license +0 -21
  34. package/compiled/connect-history-api-fallback/package.json +0 -1
  35. package/compiled/rspack-chain/index.js +0 -1769
@@ -1,16 +1,16 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 643: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
- const loader = __nccwpck_require__(213);
4
+ 368: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
+ const loader = __nccwpck_require__(238);
6
6
  module.exports = loader.default;
7
7
  },
8
- 213: (__unused_webpack_module, exports, __nccwpck_require__) => {
8
+ 238: (__unused_webpack_module, exports, __nccwpck_require__) => {
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports["default"] = void 0;
11
11
  var _path = _interopRequireDefault(__nccwpck_require__(928));
12
- var _utils = __nccwpck_require__(800);
13
- var _options = _interopRequireDefault(__nccwpck_require__(419));
12
+ var _utils = __nccwpck_require__(695);
13
+ var _options = _interopRequireDefault(__nccwpck_require__(771));
14
14
  function _interopRequireDefault(obj) {
15
15
  return obj && obj.__esModule ? obj : { default: obj };
16
16
  }
@@ -104,7 +104,7 @@
104
104
  };
105
105
  var _default = (exports["default"] = loader);
106
106
  },
107
- 458: (module) => {
107
+ 425: (module) => {
108
108
  function isEqualLocals(a, b, isNamedExport) {
109
109
  if ((!a && b) || (a && !b)) {
110
110
  return false;
@@ -130,7 +130,7 @@
130
130
  }
131
131
  module.exports = isEqualLocals;
132
132
  },
133
- 800: (__unused_webpack_module, exports, __nccwpck_require__) => {
133
+ 695: (__unused_webpack_module, exports, __nccwpck_require__) => {
134
134
  Object.defineProperty(exports, "__esModule", { value: true });
135
135
  exports.getExportLazyStyleCode = getExportLazyStyleCode;
136
136
  exports.getExportStyleCode = getExportStyleCode;
@@ -151,7 +151,7 @@
151
151
  exports.getdomAPI = getdomAPI;
152
152
  exports.stringifyRequest = stringifyRequest;
153
153
  var _path = _interopRequireDefault(__nccwpck_require__(928));
154
- var _isEqualLocals = _interopRequireDefault(__nccwpck_require__(458));
154
+ var _isEqualLocals = _interopRequireDefault(__nccwpck_require__(425));
155
155
  function _interopRequireDefault(obj) {
156
156
  return obj && obj.__esModule ? obj : { default: obj };
157
157
  }
@@ -394,7 +394,7 @@
394
394
  928: (module) => {
395
395
  module.exports = require("path");
396
396
  },
397
- 419: (module) => {
397
+ 771: (module) => {
398
398
  module.exports = JSON.parse(
399
399
  '{"title":"Style Loader options","type":"object","properties":{"injectType":{"description":"Allows to setup how styles will be injected into DOM.","link":"https://github.com/webpack-contrib/style-loader#injecttype","enum":["styleTag","singletonStyleTag","autoStyleTag","lazyStyleTag","lazySingletonStyleTag","lazyAutoStyleTag","linkTag"]},"attributes":{"description":"Adds custom attributes to tag.","link":"https://github.com/webpack-contrib/style-loader#attributes","type":"object"},"insert":{"description":"Inserts `<style>`/`<link>` at the given position.","link":"https://github.com/webpack-contrib/style-loader#insert","anyOf":[{"type":"string"},{"instanceof":"Function"}]},"base":{"description":"Sets module ID base for DLLPlugin.","link":"https://github.com/webpack-contrib/style-loader#base","type":"number"},"esModule":{"description":"Use the ES modules syntax.","link":"https://github.com/webpack-contrib/css-loader#esmodule","type":"boolean"},"styleTagTransform":{"description":"Transform tag and css when insert \'style\' tag into the DOM","link":"https://github.com/webpack-contrib/style-loader#styleTagTransform","anyOf":[{"type":"string"},{"instanceof":"Function"}]}},"additionalProperties":false}',
400
400
  );
@@ -422,6 +422,6 @@
422
422
  }
423
423
  if (typeof __nccwpck_require__ !== "undefined")
424
424
  __nccwpck_require__.ab = __dirname + "/";
425
- var __webpack_exports__ = __nccwpck_require__(643);
425
+ var __webpack_exports__ = __nccwpck_require__(368);
426
426
  module.exports = __webpack_exports__;
427
427
  })();
@@ -19,7 +19,7 @@ function formatURL(config) {
19
19
  return `${protocol}${colon}//${hostname}:${port}${pathname}?token=${RSBUILD_WEB_SOCKET_TOKEN}`;
20
20
  }
21
21
  let isFirstCompilation = true;
22
- let lastCompilationHash = null;
22
+ let lastCompilationHash;
23
23
  let hasCompileErrors = false;
24
24
  function clearOutdatedErrors() {
25
25
  if (console.clear && hasCompileErrors) console.clear();
@@ -74,15 +74,25 @@ function tryApplyUpdates() {
74
74
  if (!isUpdateAvailable()) return;
75
75
  if (import.meta.webpackHot) {
76
76
  if ('idle' !== import.meta.webpackHot.status()) return;
77
- import.meta.webpackHot.check(true).then((updatedModules)=>handleApplyUpdates(null, updatedModules), (err)=>handleApplyUpdates(err, null));
77
+ import.meta.webpackHot.check(true).then((updatedModules)=>{
78
+ handleApplyUpdates(null, updatedModules);
79
+ }, (err)=>{
80
+ handleApplyUpdates(err, null);
81
+ });
78
82
  return;
79
83
  }
80
84
  reloadPage();
81
85
  }
82
86
  let connection = null;
83
87
  let reconnectCount = 0;
88
+ let pingIntervalId;
84
89
  function onOpen() {
85
90
  console.info('[HMR] connected.');
91
+ pingIntervalId = setInterval(()=>{
92
+ if (connection && connection.readyState === connection.OPEN) connection.send(JSON.stringify({
93
+ type: 'ping'
94
+ }));
95
+ }, 30000);
86
96
  }
87
97
  function onMessage(e) {
88
98
  const message = JSON.parse(e.data);
@@ -135,6 +145,7 @@ function connect() {
135
145
  if (!fallback) connection.addEventListener('error', onError);
136
146
  }
137
147
  function removeListeners() {
148
+ clearInterval(pingIntervalId);
138
149
  if (connection) {
139
150
  connection.removeEventListener('open', onOpen);
140
151
  connection.removeEventListener('close', onClose);
@@ -62,7 +62,9 @@ function createOverlay(html) {
62
62
  document.body.appendChild(new ErrorOverlay(html));
63
63
  }
64
64
  function clearOverlay() {
65
- document.querySelectorAll(overlayId).forEach((n)=>n.close(true));
65
+ document.querySelectorAll(overlayId).forEach((n)=>{
66
+ n.close(true);
67
+ });
66
68
  }
67
69
  if ('undefined' != typeof document) registerOverlay(createOverlay, clearOverlay);
68
70
  else console.info('[Rsbuild] Failed to display error overlay as document is not available, you can disable the `dev.client.overlay` option.');