@rsbuild/core 0.7.0-beta.1 → 0.7.0-beta.3

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,19 +1,19 @@
1
1
  /******/ (() => { // webpackBootstrap
2
2
  /******/ var __webpack_modules__ = ({
3
3
 
4
- /***/ 7169:
4
+ /***/ 2039:
5
5
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
6
6
 
7
7
  "use strict";
8
8
 
9
9
 
10
- const loader = __nccwpck_require__(6436);
10
+ const loader = __nccwpck_require__(7512);
11
11
  module.exports = loader.default;
12
- module.exports.defaultGetLocalIdent = __nccwpck_require__(809).defaultGetLocalIdent;
12
+ module.exports.defaultGetLocalIdent = __nccwpck_require__(2576).defaultGetLocalIdent;
13
13
 
14
14
  /***/ }),
15
15
 
16
- /***/ 6436:
16
+ /***/ 7512:
17
17
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
18
18
 
19
19
  "use strict";
@@ -26,9 +26,9 @@ exports["default"] = loader;
26
26
  var _postcss = _interopRequireDefault(__nccwpck_require__(977));
27
27
  var _package = _interopRequireDefault(__nccwpck_require__(5446));
28
28
  var _semver = __nccwpck_require__(1280);
29
- var _options = _interopRequireDefault(__nccwpck_require__(5879));
30
- var _plugins = __nccwpck_require__(3069);
31
- var _utils = __nccwpck_require__(809);
29
+ var _options = _interopRequireDefault(__nccwpck_require__(643));
30
+ var _plugins = __nccwpck_require__(7098);
31
+ var _utils = __nccwpck_require__(2576);
32
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
33
  /*
34
34
  MIT License http://www.opensource.org/licenses/mit-license.php
@@ -211,7 +211,7 @@ async function loader(content, map, meta) {
211
211
 
212
212
  /***/ }),
213
213
 
214
- /***/ 3069:
214
+ /***/ 7098:
215
215
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
216
216
 
217
217
  "use strict";
@@ -238,14 +238,14 @@ Object.defineProperty(exports, "urlParser", ({
238
238
  return _postcssUrlParser.default;
239
239
  }
240
240
  }));
241
- var _postcssImportParser = _interopRequireDefault(__nccwpck_require__(7535));
242
- var _postcssIcssParser = _interopRequireDefault(__nccwpck_require__(3088));
243
- var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(6134));
241
+ var _postcssImportParser = _interopRequireDefault(__nccwpck_require__(2006));
242
+ var _postcssIcssParser = _interopRequireDefault(__nccwpck_require__(7307));
243
+ var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(5298));
244
244
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
245
245
 
246
246
  /***/ }),
247
247
 
248
- /***/ 3088:
248
+ /***/ 7307:
249
249
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
250
250
 
251
251
  "use strict";
@@ -256,7 +256,7 @@ Object.defineProperty(exports, "__esModule", ({
256
256
  }));
257
257
  exports["default"] = void 0;
258
258
  var _icssUtils = __nccwpck_require__(3275);
259
- var _utils = __nccwpck_require__(809);
259
+ var _utils = __nccwpck_require__(2576);
260
260
  const plugin = (options = {}) => {
261
261
  return {
262
262
  postcssPlugin: "postcss-icss-parser",
@@ -365,7 +365,7 @@ var _default = exports["default"] = plugin;
365
365
 
366
366
  /***/ }),
367
367
 
368
- /***/ 7535:
368
+ /***/ 2006:
369
369
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
370
370
 
371
371
  "use strict";
@@ -376,7 +376,7 @@ Object.defineProperty(exports, "__esModule", ({
376
376
  }));
377
377
  exports["default"] = void 0;
378
378
  var _postcssValueParser = _interopRequireDefault(__nccwpck_require__(1036));
379
- var _utils = __nccwpck_require__(809);
379
+ var _utils = __nccwpck_require__(2576);
380
380
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
381
381
  function parseNode(atRule, key, options) {
382
382
  // Convert only top-level @import
@@ -654,7 +654,7 @@ var _default = exports["default"] = plugin;
654
654
 
655
655
  /***/ }),
656
656
 
657
- /***/ 6134:
657
+ /***/ 5298:
658
658
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
659
659
 
660
660
  "use strict";
@@ -665,7 +665,7 @@ Object.defineProperty(exports, "__esModule", ({
665
665
  }));
666
666
  exports["default"] = void 0;
667
667
  var _postcssValueParser = _interopRequireDefault(__nccwpck_require__(1036));
668
- var _utils = __nccwpck_require__(809);
668
+ var _utils = __nccwpck_require__(2576);
669
669
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
670
670
  const isUrlFunc = /url/i;
671
671
  const isImageSetFunc = /^(?:-webkit-)?image-set$/i;
@@ -1017,7 +1017,7 @@ var _default = exports["default"] = plugin;
1017
1017
 
1018
1018
  /***/ }),
1019
1019
 
1020
- /***/ 809:
1020
+ /***/ 2576:
1021
1021
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1022
1022
 
1023
1023
  "use strict";
@@ -7298,7 +7298,7 @@ module.exports = require("util");
7298
7298
 
7299
7299
  /***/ }),
7300
7300
 
7301
- /***/ 5879:
7301
+ /***/ 643:
7302
7302
  /***/ ((module) => {
7303
7303
 
7304
7304
  "use strict";
@@ -7356,7 +7356,7 @@ module.exports = JSON.parse('{"name":"postcss","version":"8.4.38","description":
7356
7356
  /******/ // startup
7357
7357
  /******/ // Load entry module and return exports
7358
7358
  /******/ // This entry module is referenced by other modules so it can't be inlined
7359
- /******/ var __webpack_exports__ = __nccwpck_require__(7169);
7359
+ /******/ var __webpack_exports__ = __nccwpck_require__(2039);
7360
7360
  /******/ module.exports = __webpack_exports__;
7361
7361
  /******/
7362
7362
  /******/ })()
@@ -2,16 +2,16 @@
2
2
  /******/ "use strict";
3
3
  /******/ var __webpack_modules__ = ({
4
4
 
5
- /***/ 218:
5
+ /***/ 583:
6
6
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
7
7
 
8
8
 
9
9
 
10
- module.exports = __nccwpck_require__(499)["default"];
10
+ module.exports = __nccwpck_require__(833)["default"];
11
11
 
12
12
  /***/ }),
13
13
 
14
- /***/ 499:
14
+ /***/ 833:
15
15
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
16
16
 
17
17
  var __webpack_unused_export__;
@@ -22,8 +22,8 @@ __webpack_unused_export__ = ({
22
22
  });
23
23
  exports["default"] = void 0;
24
24
  var _path = _interopRequireDefault(__nccwpck_require__(17));
25
- var _options = _interopRequireDefault(__nccwpck_require__(284));
26
- var _utils = __nccwpck_require__(778);
25
+ var _options = _interopRequireDefault(__nccwpck_require__(570));
26
+ var _utils = __nccwpck_require__(783);
27
27
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28
28
  async function lessLoader(source) {
29
29
  const options = this.getOptions(_options.default);
@@ -122,7 +122,7 @@ var _default = exports["default"] = lessLoader;
122
122
 
123
123
  /***/ }),
124
124
 
125
- /***/ 778:
125
+ /***/ 783:
126
126
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
127
127
 
128
128
 
@@ -358,7 +358,7 @@ module.exports = require("path");
358
358
 
359
359
  /***/ }),
360
360
 
361
- /***/ 284:
361
+ /***/ 570:
362
362
  /***/ ((module) => {
363
363
 
364
364
  module.exports = JSON.parse('{"title":"Less Loader options","type":"object","properties":{"lessOptions":{"description":"Options to pass through to `Less`.","link":"https://github.com/webpack-contrib/less-loader#lessoptions","anyOf":[{"type":"object","additionalProperties":true},{"instanceof":"Function"}]},"additionalData":{"description":"Prepends/Appends `Less` code to the actual entry file.","link":"https://github.com/webpack-contrib/less-loader#additionalData","anyOf":[{"type":"string"},{"instanceof":"Function"}]},"sourceMap":{"description":"Enables/Disables generation of source maps.","link":"https://github.com/webpack-contrib/less-loader#sourcemap","type":"boolean"},"webpackImporter":{"description":"Enables/Disables default `webpack` importer.","link":"https://github.com/webpack-contrib/less-loader#webpackimporter","type":"boolean"},"implementation":{"description":"The implementation of the `Less` to be used.","link":"https://github.com/webpack-contrib/less-loader#implementation","anyOf":[{"type":"string"},{"type":"object"}]},"lessLogAsWarnOrErr":{"description":"Less warnings and errors will be webpack warnings or errors.","link":"https://github.com/webpack-contrib/less-loader#lesslogaswarnorerr","type":"boolean"}},"additionalProperties":false}');
@@ -407,7 +407,7 @@ module.exports = JSON.parse('{"title":"Less Loader options","type":"object","pro
407
407
  /******/ // startup
408
408
  /******/ // Load entry module and return exports
409
409
  /******/ // This entry module used 'module' so it can't be inlined
410
- /******/ var __webpack_exports__ = __nccwpck_require__(218);
410
+ /******/ var __webpack_exports__ = __nccwpck_require__(583);
411
411
  /******/ module.exports = __webpack_exports__;
412
412
  /******/
413
413
  /******/ })()
@@ -7702,17 +7702,17 @@ module.exports.createColors = createColors
7702
7702
 
7703
7703
  /***/ }),
7704
7704
 
7705
- /***/ 9042:
7705
+ /***/ 421:
7706
7706
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
7707
7707
 
7708
7708
  "use strict";
7709
7709
 
7710
7710
 
7711
- module.exports = __nccwpck_require__(5426)["default"];
7711
+ module.exports = __nccwpck_require__(5686)["default"];
7712
7712
 
7713
7713
  /***/ }),
7714
7714
 
7715
- /***/ 5426:
7715
+ /***/ 5686:
7716
7716
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
7717
7717
 
7718
7718
  "use strict";
@@ -7725,8 +7725,8 @@ __webpack_unused_export__ = ({
7725
7725
  exports["default"] = loader;
7726
7726
  var _path = _interopRequireDefault(__nccwpck_require__(1017));
7727
7727
  var _package = _interopRequireDefault(__nccwpck_require__(5446));
7728
- var _options = _interopRequireDefault(__nccwpck_require__(2617));
7729
- var _utils = __nccwpck_require__(9738);
7728
+ var _options = _interopRequireDefault(__nccwpck_require__(3453));
7729
+ var _utils = __nccwpck_require__(2043);
7730
7730
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7731
7731
  let hasExplicitDependencyOnPostCSS = false;
7732
7732
 
@@ -7892,7 +7892,7 @@ async function loader(content, sourceMap, meta) {
7892
7892
 
7893
7893
  /***/ }),
7894
7894
 
7895
- /***/ 9738:
7895
+ /***/ 2043:
7896
7896
  /***/ ((module, exports, __nccwpck_require__) => {
7897
7897
 
7898
7898
  "use strict";
@@ -9143,7 +9143,7 @@ function highlight(code, options = {}) {
9143
9143
 
9144
9144
  /***/ }),
9145
9145
 
9146
- /***/ 2617:
9146
+ /***/ 3453:
9147
9147
  /***/ ((module) => {
9148
9148
 
9149
9149
  "use strict";
@@ -9271,7 +9271,7 @@ module.exports = JSON.parse('{"name":"postcss","version":"8.4.38","description":
9271
9271
  /******/ // startup
9272
9272
  /******/ // Load entry module and return exports
9273
9273
  /******/ // This entry module used 'module' so it can't be inlined
9274
- /******/ var __webpack_exports__ = __nccwpck_require__(9042);
9274
+ /******/ var __webpack_exports__ = __nccwpck_require__(421);
9275
9275
  /******/ module.exports = __webpack_exports__;
9276
9276
  /******/
9277
9277
  /******/ })()
@@ -1,7 +1,7 @@
1
1
  /******/ (() => { // webpackBootstrap
2
2
  /******/ var __webpack_modules__ = ({
3
3
 
4
- /***/ 1797:
4
+ /***/ 1266:
5
5
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
6
6
 
7
7
  "use strict";
@@ -105,7 +105,7 @@ exports.transformFiles = transformFiles;
105
105
 
106
106
  /***/ }),
107
107
 
108
- /***/ 7226:
108
+ /***/ 8391:
109
109
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
110
110
 
111
111
  "use strict";
@@ -116,7 +116,7 @@ const fs_1 = __nccwpck_require__(7147);
116
116
  const path_1 = __nccwpck_require__(1017);
117
117
  const tapable_1 = __nccwpck_require__(4260);
118
118
  const webpack_sources_1 = __nccwpck_require__(5433);
119
- const helpers_1 = __nccwpck_require__(1797);
119
+ const helpers_1 = __nccwpck_require__(1266);
120
120
  const compilerHookMap = new WeakMap();
121
121
  const getCompilerHooks = (compiler) => {
122
122
  let hooks = compilerHookMap.get(compiler);
@@ -7751,7 +7751,7 @@ var exports = __webpack_exports__;
7751
7751
  Object.defineProperty(exports, "__esModule", ({ value: true }));
7752
7752
  exports.RspackManifestPlugin = exports.WebpackManifestPlugin = exports.getCompilerHooks = void 0;
7753
7753
  const path_1 = __nccwpck_require__(1017);
7754
- const hooks_1 = __nccwpck_require__(7226);
7754
+ const hooks_1 = __nccwpck_require__(8391);
7755
7755
  Object.defineProperty(exports, "getCompilerHooks", ({ enumerable: true, get: function () { return hooks_1.getCompilerHooks; } }));
7756
7756
  const emitCountMap = new Map();
7757
7757
  const defaults = {
@@ -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.7.0-beta.1");
42
+ import_commander.program.name("rsbuild").usage("<command> [options]").version("0.7.0-beta.3");
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");
@@ -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_shared.logger.greet(` ${`Rsbuild v${"0.7.0-beta.1"}`}
37
+ import_shared.logger.greet(` ${`Rsbuild v${"0.7.0-beta.3"}`}
38
38
  `);
39
39
  }
40
40
  // Annotate the CommonJS export names for ESM import in node:
@@ -41,7 +41,7 @@ function formatMessage(stats) {
41
41
  let message;
42
42
  if (typeof stats === "object") {
43
43
  const fileName = resolveFileName(stats);
44
- const mainMessage = typeof stats.formatted === "string" ? stats.formatted : stats.message;
44
+ const mainMessage = stats.message;
45
45
  const details = stats.details ? `
46
46
  Details: ${stats.details}
47
47
  ` : "";
@@ -19,7 +19,7 @@ function formatMessage(stats) {
19
19
  let message;
20
20
  if (typeof stats === "object") {
21
21
  const fileName = resolveFileName(stats);
22
- const mainMessage = typeof stats.formatted === "string" ? stats.formatted : stats.message;
22
+ const mainMessage = stats.message;
23
23
  const details = stats.details ? `
24
24
  Details: ${stats.details}
25
25
  ` : "";
@@ -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.7.0-beta.1",
47
+ version: "0.7.0-beta.3",
48
48
  rootPath,
49
49
  distPath,
50
50
  cachePath,
package/dist/index.js CHANGED
@@ -40,7 +40,7 @@ var import_config = require("./config");
40
40
  var import_shared = require("@rsbuild/shared");
41
41
  var import_mergeConfig = require("./mergeConfig");
42
42
  var import_constants = require("./constants");
43
- const version = "0.7.0-beta.1";
43
+ const version = "0.7.0-beta.3";
44
44
  // Annotate the CommonJS export names for ESM import in node:
45
45
  0 && (module.exports = {
46
46
  PLUGIN_CSS_NAME,
@@ -108,7 +108,7 @@ function splitByModule(ctx) {
108
108
  ...userDefinedCacheGroups,
109
109
  // Core group
110
110
  vendors: {
111
- priority: -10,
111
+ priority: -9,
112
112
  test: import_shared.NODE_MODULES_REGEX,
113
113
  name(module2) {
114
114
  return module2 ? getPackageNameFromModulePath(module2.context) : void 0;
@@ -79,7 +79,7 @@ async function createDevServer(options, createDevMiddleware, {
79
79
  devMiddleware
80
80
  });
81
81
  compilerDevMiddleware.init();
82
- outputFileSystem = (0, import_shared.isMultiCompiler)(compiler) ? compiler.compilers[0].outputFileSystem : compiler.outputFileSystem;
82
+ outputFileSystem = ((0, import_shared.isMultiCompiler)(compiler) ? compiler.compilers[0].outputFileSystem : compiler.outputFileSystem) || import_node_fs.default;
83
83
  return {
84
84
  middleware: compilerDevMiddleware.middleware,
85
85
  sockWrite: (...args) => compilerDevMiddleware.sockWrite(...args),
@@ -1,12 +1,10 @@
1
- /// <reference types="node" />
2
- import type fs from 'node:fs';
3
- import type { CompileMiddlewareAPI, DevConfig, Middlewares, ServerConfig, UpgradeEvent } from '@rsbuild/shared';
1
+ import type { CompileMiddlewareAPI, DevConfig, Middlewares, OutputFileSystem, ServerConfig, UpgradeEvent } from '@rsbuild/shared';
4
2
  export type RsbuildDevMiddlewareOptions = {
5
3
  pwd: string;
6
4
  dev: DevConfig;
7
5
  server: ServerConfig;
8
6
  compileMiddlewareAPI?: CompileMiddlewareAPI;
9
- outputFileSystem: typeof fs;
7
+ outputFileSystem: OutputFileSystem;
10
8
  output: {
11
9
  distPath: string;
12
10
  };
@@ -1,6 +1,4 @@
1
- /// <reference types="node" />
2
- import type fs from 'node:fs';
3
- import { type HtmlFallback, type RequestHandler as Middleware } from '@rsbuild/shared';
1
+ import { type HtmlFallback, type RequestHandler as Middleware, type OutputFileSystem } from '@rsbuild/shared';
4
2
  import type Connect from '@rsbuild/shared/connect';
5
3
  export declare const faviconFallbackMiddleware: Middleware;
6
4
  export declare const getRequestLoggerMiddleware: () => Promise<Connect.NextHandleFunction>;
@@ -9,5 +7,5 @@ export declare const getHtmlFallbackMiddleware: (params: {
9
7
  distPath: string;
10
8
  callback?: Middleware;
11
9
  htmlFallback?: HtmlFallback;
12
- outputFileSystem: typeof fs;
10
+ outputFileSystem: OutputFileSystem;
13
11
  }) => Middleware;
@@ -86,7 +86,7 @@ const notFoundMiddleware = (_req, res, _next) => {
86
86
  res.end();
87
87
  };
88
88
  const getHtmlFallbackMiddleware = ({ htmlFallback, distPath, callback, outputFileSystem }) => {
89
- return (req, res, next) => {
89
+ return async (req, res, next) => {
90
90
  if (
91
91
  // Only accept GET or HEAD
92
92
  req.method !== "GET" && req.method !== "HEAD" || // Require Accept header
@@ -106,6 +106,13 @@ const getHtmlFallbackMiddleware = ({ htmlFallback, distPath, callback, outputFil
106
106
  );
107
107
  return next();
108
108
  }
109
+ const isFileExists = async (filePath) => {
110
+ return new Promise((resolve) => {
111
+ outputFileSystem.stat(filePath, (_error, stats) => {
112
+ resolve(stats?.isFile());
113
+ });
114
+ });
115
+ };
109
116
  const rewrite = (newUrl, isFallback = false) => {
110
117
  if (isFallback && (0, import_shared.isDebug)()) {
111
118
  (0, import_shared.debug)(
@@ -125,7 +132,7 @@ const getHtmlFallbackMiddleware = ({ htmlFallback, distPath, callback, outputFil
125
132
  if (pathname.endsWith("/")) {
126
133
  const newUrl = `${pathname}index.html`;
127
134
  const filePath = import_node_path.default.join(distPath, pathname, "index.html");
128
- if (outputFileSystem.existsSync(filePath)) {
135
+ if (await isFileExists(filePath)) {
129
136
  return rewrite(newUrl);
130
137
  }
131
138
  } else if (
@@ -134,12 +141,12 @@ const getHtmlFallbackMiddleware = ({ htmlFallback, distPath, callback, outputFil
134
141
  ) {
135
142
  const newUrl = `${pathname}.html`;
136
143
  const filePath = import_node_path.default.join(distPath, `${pathname}.html`);
137
- if (outputFileSystem.existsSync(filePath)) {
144
+ if (await isFileExists(filePath)) {
138
145
  return rewrite(newUrl);
139
146
  }
140
147
  }
141
148
  if (htmlFallback === "index") {
142
- if (outputFileSystem.existsSync(import_node_path.default.join(distPath, "index.html"))) {
149
+ if (await isFileExists(import_node_path.default.join(distPath, "index.html"))) {
143
150
  return rewrite("/index.html", true);
144
151
  }
145
152
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "0.7.0-beta.1",
3
+ "version": "0.7.0-beta.3",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "bugs": {
@@ -48,12 +48,12 @@
48
48
  "types.d.ts"
49
49
  ],
50
50
  "dependencies": {
51
- "@rspack/core": "0.6.5",
51
+ "@rspack/core": "0.6.5-canary-2456d69-20240515093621",
52
52
  "@swc/helpers": "0.5.3",
53
53
  "core-js": "~3.36.0",
54
54
  "html-webpack-plugin": "npm:html-rspack-plugin@5.7.2",
55
55
  "postcss": "^8.4.38",
56
- "@rsbuild/shared": "0.7.0-beta.1"
56
+ "@rsbuild/shared": "0.7.0-beta.3"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/fs-extra": "^11.0.4",