@rsbuild/core 0.6.13 → 0.6.14

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.
@@ -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.6.13");
42
+ import_commander.program.name("rsbuild").usage("<command> [options]").version("0.6.14");
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_rslog.logger.greet(` ${`Rsbuild v${"0.6.13"}`}
37
+ import_rslog.logger.greet(` ${`Rsbuild v${"0.6.14"}`}
38
38
  `);
39
39
  }
40
40
  // Annotate the CommonJS export names for ESM import in node:
@@ -22,17 +22,19 @@ __export(format_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(format_exports);
24
24
  function resolveFileName(stats) {
25
- const regex = /(?:\!|^)([^!]+)$/;
26
- const fileName = stats.moduleIdentifier?.match(regex)?.at(-1) ?? "";
27
- return fileName ? (
28
- // add default column add lines for linking
29
- `File: ${fileName}:1:1
30
- `
31
- ) : (
32
- // fallback to moduleName if moduleIdentifier parse failed
33
- `File: ${stats.moduleName}
34
- `
35
- );
25
+ if (stats.moduleIdentifier) {
26
+ const regex = /(?:\!|^)([^!]+)$/;
27
+ const matched = stats.moduleIdentifier.match(regex);
28
+ if (matched) {
29
+ const fileName = matched.pop();
30
+ if (fileName) {
31
+ return `File: ${fileName}:1:1
32
+ `;
33
+ }
34
+ }
35
+ }
36
+ return `File: ${stats.moduleName}
37
+ `;
36
38
  }
37
39
  function formatMessage(stats) {
38
40
  let lines = [];
@@ -1,11 +1,17 @@
1
1
  // src/client/format.ts
2
2
  function resolveFileName(stats) {
3
- var _stats_moduleIdentifier_match, _stats_moduleIdentifier;
4
- const regex = /(?:\!|^)([^!]+)$/;
5
- var _stats_moduleIdentifier_match_at;
6
- const fileName = (_stats_moduleIdentifier_match_at = (_stats_moduleIdentifier = stats.moduleIdentifier) === null || _stats_moduleIdentifier === void 0 ? void 0 : (_stats_moduleIdentifier_match = _stats_moduleIdentifier.match(regex)) === null || _stats_moduleIdentifier_match === void 0 ? void 0 : _stats_moduleIdentifier_match.at(-1)) !== null && _stats_moduleIdentifier_match_at !== void 0 ? _stats_moduleIdentifier_match_at : "";
7
- return fileName ? `File: ${fileName}:1:1
8
- ` : `File: ${stats.moduleName}
3
+ if (stats.moduleIdentifier) {
4
+ const regex = /(?:\!|^)([^!]+)$/;
5
+ const matched = stats.moduleIdentifier.match(regex);
6
+ if (matched) {
7
+ const fileName = matched.pop();
8
+ if (fileName) {
9
+ return `File: ${fileName}:1:1
10
+ `;
11
+ }
12
+ }
13
+ }
14
+ return `File: ${stats.moduleName}
9
15
  `;
10
16
  }
11
17
  function formatMessage(stats) {
@@ -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.6.13",
47
+ version: "0.6.14",
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.6.13";
43
+ const version = "0.6.14";
44
44
  // Annotate the CommonJS export names for ESM import in node:
45
45
  0 && (module.exports = {
46
46
  PLUGIN_CSS_NAME,
@@ -135,13 +135,22 @@ function getTemplateParameters(entryName, config, assetPrefix) {
135
135
  };
136
136
  }
137
137
  function getChunks(entryName, entryValue) {
138
- if ((0, import_shared.isPlainObject)(entryValue)) {
139
- const { dependOn } = entryValue;
140
- if (Array.isArray(dependOn)) {
141
- return [...dependOn, entryName];
138
+ const chunks = [entryName];
139
+ for (const item of entryValue) {
140
+ if (!(0, import_shared.isPlainObject)(item)) {
141
+ continue;
142
+ }
143
+ const { dependOn } = item;
144
+ if (!dependOn) {
145
+ continue;
146
+ }
147
+ if (typeof dependOn === "string") {
148
+ chunks.unshift(dependOn);
149
+ } else {
150
+ chunks.unshift(...dependOn);
142
151
  }
143
152
  }
144
- return [entryName];
153
+ return chunks;
145
154
  }
146
155
  const getTagConfig = (api) => {
147
156
  const config = api.getNormalizedConfig();
@@ -176,7 +185,7 @@ const pluginHtml = (modifyTagsFn) => ({
176
185
  const entryValue = entries[entryName].values();
177
186
  const chunks = getChunks(
178
187
  entryName,
179
- // @ts-expect-error EntryDescription type mismatch
188
+ // EntryDescription type is different between webpack and Rspack
180
189
  entryValue
181
190
  );
182
191
  const inject = getInject(entryName, config);
@@ -203,6 +212,9 @@ const pluginHtml = (modifyTagsFn) => ({
203
212
  templateParameters,
204
213
  scriptLoading: config.html.scriptLoading
205
214
  };
215
+ if (chunks.length > 1) {
216
+ pluginOptions.chunksSortMode = "manual";
217
+ }
206
218
  const htmlInfo = {};
207
219
  htmlInfoMap[entryName] = htmlInfo;
208
220
  if (templateContent) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "0.6.13",
3
+ "version": "0.6.14",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "bugs": {
@@ -53,7 +53,7 @@
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.6.13"
56
+ "@rsbuild/shared": "0.6.14"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/node": "18.x",