@rsbuild/core 0.2.4 → 0.2.5

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.
@@ -83,7 +83,7 @@ async function init({
83
83
  }
84
84
  }
85
85
  function runCli() {
86
- import_commander.program.name("rsbuild").usage("<command> [options]").version("0.2.4");
86
+ import_commander.program.name("rsbuild").usage("<command> [options]").version("0.2.5");
87
87
  import_commander.program.command("dev").option("--open", "open the page in browser on startup").option(
88
88
  "--port <port>",
89
89
  "specify a port number for Rsbuild Server to listen"
@@ -34,7 +34,7 @@ function prepareCli() {
34
34
  if (!npm_execpath || npm_execpath.includes("npx-cli.js")) {
35
35
  console.log();
36
36
  }
37
- import_rslog.logger.greet(` ${`Rsbuild v${"0.2.4"}`}
37
+ import_rslog.logger.greet(` ${`Rsbuild v${"0.2.5"}`}
38
38
  `);
39
39
  }
40
40
  // Annotate the CommonJS export names for ESM import in node:
@@ -225,7 +225,7 @@ const pluginHtml = () => ({
225
225
  }
226
226
  const title = getTitle(entryName, config);
227
227
  if (title) {
228
- htmlInfo.title = title;
228
+ pluginOptions.title = title;
229
229
  }
230
230
  const favicon = getFavicon(entryName, config);
231
231
  if (favicon) {
@@ -59,7 +59,7 @@ function createContextByConfig(options, bundlerType, config = {}) {
59
59
  const context = {
60
60
  entry: config.source?.entry || getDefaultEntry(rootPath),
61
61
  targets: config.output?.targets || [],
62
- version: "0.2.4",
62
+ version: "0.2.5",
63
63
  rootPath,
64
64
  distPath,
65
65
  cachePath,
@@ -45,6 +45,7 @@ function pluginSass() {
45
45
  const { excludes, options } = (0, import_shared.getSassLoaderOptions)(
46
46
  config.tools.sass,
47
47
  // source-maps required for loaders preceding resolve-url-loader
48
+ // otherwise the resolve-url-loader will throw an error
48
49
  true
49
50
  );
50
51
  const rule = chain.module.rule(utils.CHAIN_ID.RULE.SASS).test(import_shared.SASS_REGEX);
@@ -32,7 +32,7 @@ __export(HtmlAppIconPlugin_exports, {
32
32
  });
33
33
  module.exports = __toCommonJS(HtmlAppIconPlugin_exports);
34
34
  var import_fs = __toESM(require("fs"));
35
- var import_path = __toESM(require("path"));
35
+ var import_path = require("path");
36
36
  var import_html_webpack_plugin = __toESM(require("html-webpack-plugin"));
37
37
  var import_webpack_sources = __toESM(require("@rsbuild/shared/webpack-sources"));
38
38
  var import_shared = require("@rsbuild/shared");
@@ -48,22 +48,19 @@ class HtmlAppIconPlugin {
48
48
  `[${this.name}] Can not find the app icon, please check if the '${this.iconPath}' file exists'.`
49
49
  );
50
50
  }
51
- const iconRelativePath = import_path.default.join(
52
- this.distDir,
53
- import_path.default.basename(this.iconPath)
54
- );
51
+ const iconRelativePath = import_path.posix.join(this.distDir, (0, import_path.basename)(this.iconPath));
55
52
  compiler.hooks.compilation.tap(this.name, (compilation) => {
56
53
  import_html_webpack_plugin.default.getHooks(compilation).alterAssetTagGroups.tap(
57
54
  this.name,
58
55
  (data) => {
59
- const { publicPath } = compiler.options.output;
56
+ const publicPath = (0, import_shared.getPublicPathFromCompiler)(compiler);
60
57
  data.headTags.unshift({
61
58
  tagName: "link",
62
59
  voidTag: true,
63
60
  attributes: {
64
61
  rel: "apple-touch-icon",
65
62
  sizes: "180*180",
66
- href: `${publicPath}${iconRelativePath}`
63
+ href: (0, import_shared.withPublicPath)(iconRelativePath, publicPath)
67
64
  },
68
65
  meta: {}
69
66
  });
@@ -1,6 +1,5 @@
1
1
  import type { Compiler } from '@rspack/core';
2
2
  export type HtmlInfo = {
3
- title?: string;
4
3
  favicon?: string;
5
4
  templateContent?: string;
6
5
  };
@@ -40,8 +40,7 @@ class HtmlBasicPlugin {
40
40
  this.options = options;
41
41
  }
42
42
  apply(compiler) {
43
- const addTitleTag = (headTags, entryName) => {
44
- const { title } = this.options.info[entryName];
43
+ const addTitleTag = (headTags, title) => {
45
44
  if (title) {
46
45
  headTags.unshift({
47
46
  tagName: "title",
@@ -77,7 +76,7 @@ class HtmlBasicPlugin {
77
76
  const { headTags } = data;
78
77
  const { templateContent } = this.options.info[entryName];
79
78
  if (!hasTitle(templateContent)) {
80
- addTitleTag(headTags, entryName);
79
+ addTitleTag(headTags, data.plugin.options?.title);
81
80
  }
82
81
  addFavicon(headTags, entryName);
83
82
  return data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Unleash the power of Rspack with the out-of-the-box build tool.",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "bugs": {
@@ -60,7 +60,7 @@
60
60
  "core-js": "~3.32.2",
61
61
  "html-webpack-plugin": "npm:html-rspack-plugin@5.5.7",
62
62
  "postcss": "8.4.31",
63
- "@rsbuild/shared": "0.2.4"
63
+ "@rsbuild/shared": "0.2.5"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@types/node": "16.x",