@rsbuild/core 0.3.2 → 0.3.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.
@@ -86,7 +86,7 @@ async function init({
86
86
  }
87
87
  }
88
88
  function runCli() {
89
- import_commander.program.name("rsbuild").usage("<command> [options]").version("0.3.2");
89
+ import_commander.program.name("rsbuild").usage("<command> [options]").version("0.3.3");
90
90
  import_commander.program.command("dev").option("-o --open [url]", "open the page in browser on startup").option(
91
91
  "--port <port>",
92
92
  "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.3.2"}`}
37
+ import_rslog.logger.greet(` ${`Rsbuild v${"0.3.3"}`}
38
38
  `);
39
39
  }
40
40
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.js CHANGED
@@ -38,7 +38,7 @@ var import_createRsbuild = require("./createRsbuild");
38
38
  var import_config = require("./cli/config");
39
39
  var import_shared = require("@rsbuild/shared");
40
40
  var import_constants = require("./constants");
41
- const version = "0.3.2";
41
+ const version = "0.3.3";
42
42
  // Annotate the CommonJS export names for ESM import in node:
43
43
  0 && (module.exports = {
44
44
  PLUGIN_BABEL_NAME,
@@ -26,42 +26,40 @@ var import_shared = require("@rsbuild/shared");
26
26
  const pluginNodeAddons = () => ({
27
27
  name: "rsbuild:node-addons",
28
28
  setup(api) {
29
- api.modifyBundlerChain(
30
- async (chain, { isServer, isServiceWorker, CHAIN_ID }) => {
31
- if (!isServer && !isServiceWorker) {
32
- return;
29
+ api.modifyBundlerChain(async (chain, { isServer, CHAIN_ID }) => {
30
+ if (!isServer) {
31
+ return;
32
+ }
33
+ const getDistName = (resourcePath) => {
34
+ const pkgJSON = (0, import_shared.findUpSync)({
35
+ filename: "package.json",
36
+ cwd: (0, import_path.dirname)(resourcePath)
37
+ });
38
+ if (!pkgJSON) {
39
+ throw new Error(
40
+ `Failed to compile Node.js addons, couldn't find the package.json of ${import_shared.color.yellow(
41
+ resourcePath
42
+ )}.`
43
+ );
33
44
  }
34
- const getDistName = (resourcePath) => {
35
- const pkgJSON = (0, import_shared.findUpSync)({
36
- filename: "package.json",
37
- cwd: (0, import_path.dirname)(resourcePath)
38
- });
39
- if (!pkgJSON) {
40
- throw new Error(
41
- `Failed to compile Node.js addons, couldn't find the package.json of ${import_shared.color.yellow(
42
- resourcePath
43
- )}.`
44
- );
45
+ const getFilename = (resource, pkgName2) => {
46
+ const reg = new RegExp(`node_modules/${pkgName2}/(.+)`);
47
+ const match = resource.match(reg);
48
+ const filename = match?.[1];
49
+ if (!filename) {
50
+ return "[name].[ext]";
45
51
  }
46
- const getFilename = (resource, pkgName2) => {
47
- const reg = new RegExp(`node_modules/${pkgName2}/(.+)`);
48
- const match = resource.match(reg);
49
- const filename = match?.[1];
50
- if (!filename) {
51
- return "[name].[ext]";
52
- }
53
- return `${filename}`;
54
- };
55
- const { name: pkgName } = require(pkgJSON);
56
- const config = api.getNormalizedConfig();
57
- const serverPath = (0, import_shared.getDistPath)(config, "server");
58
- return `${serverPath}/${getFilename(resourcePath, pkgName)}`;
52
+ return `${filename}`;
59
53
  };
60
- chain.module.rule(CHAIN_ID.RULE.NODE).test(/\.node$/).use(CHAIN_ID.USE.NODE).loader((0, import_shared.getSharedPkgCompiledPath)("node-loader")).options({
61
- name: getDistName
62
- });
63
- }
64
- );
54
+ const { name: pkgName } = require(pkgJSON);
55
+ const config = api.getNormalizedConfig();
56
+ const serverPath = (0, import_shared.getDistPath)(config, "server");
57
+ return `${serverPath}/${getFilename(resourcePath, pkgName)}`;
58
+ };
59
+ chain.module.rule(CHAIN_ID.RULE.NODE).test(/\.node$/).use(CHAIN_ID.USE.NODE).loader((0, import_shared.getSharedPkgCompiledPath)("node-loader")).options({
60
+ name: getDistName
61
+ });
62
+ });
65
63
  }
66
64
  });
67
65
  // Annotate the CommonJS export names for ESM import in node:
@@ -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.3.2",
62
+ version: "0.3.3",
63
63
  rootPath,
64
64
  distPath,
65
65
  cachePath,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "bugs": {
@@ -26,10 +26,6 @@
26
26
  "types": "./dist/client/*.d.ts",
27
27
  "default": "./dist/client/*.js"
28
28
  },
29
- "./cli": {
30
- "types": "./dist/cli/commands.d.ts",
31
- "default": "./dist/cli/commands.js"
32
- },
33
29
  "./plugins/*": {
34
30
  "types": "./dist/plugins/*.d.ts",
35
31
  "default": "./dist/plugins/*.js"
@@ -60,8 +56,8 @@
60
56
  "@swc/helpers": "0.5.3",
61
57
  "core-js": "~3.32.2",
62
58
  "html-webpack-plugin": "npm:html-rspack-plugin@5.5.7",
63
- "postcss": "8.4.31",
64
- "@rsbuild/shared": "0.3.2"
59
+ "postcss": "^8.4.33",
60
+ "@rsbuild/shared": "0.3.3"
65
61
  },
66
62
  "devDependencies": {
67
63
  "@types/node": "16.x",