@rsbuild/core 0.2.0 → 0.2.1

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.
package/bin/rsbuild.js CHANGED
@@ -3,10 +3,12 @@ const { prepareCli } = require('../dist/cli/prepare');
3
3
 
4
4
  async function main() {
5
5
  prepareCli();
6
+
6
7
  try {
7
8
  const { runCli } = require('../dist/cli/commands');
8
9
  runCli();
9
10
  } catch (err) {
11
+ const { logger } = require('@rsbuild/shared/rslog');
10
12
  logger.error(err);
11
13
  }
12
14
  }
@@ -84,7 +84,7 @@ async function init({
84
84
  }
85
85
  }
86
86
  function runCli() {
87
- import_commander.program.name("rsbuild").usage("<command> [options]").version("0.2.0");
87
+ import_commander.program.name("rsbuild").usage("<command> [options]").version("0.2.1");
88
88
  import_commander.program.command("dev").option("--open", "open the page in browser on startup").option(
89
89
  "--port <port>",
90
90
  "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.0"}`}
37
+ import_rslog.logger.greet(` ${`Rsbuild v${"0.2.1"}`}
38
38
  `);
39
39
  }
40
40
  // Annotate the CommonJS export names for ESM import in node:
@@ -102,7 +102,8 @@ async function createCompiler({
102
102
  }
103
103
  if ((0, import_shared.isDev)()) {
104
104
  await context.hooks.onDevCompileDoneHook.call({
105
- isFirstCompile
105
+ isFirstCompile,
106
+ stats
106
107
  });
107
108
  }
108
109
  isCompiling = false;
@@ -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.0",
62
+ version: "0.2.1",
63
63
  rootPath,
64
64
  distPath,
65
65
  cachePath,
@@ -1,14 +1,12 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  import type { Server } from 'http';
4
- import { EventEmitter } from 'events';
5
3
  import type { RsbuildDevMiddlewareOptions, DevMiddlewareAPI, DevMiddleware as CustomDevMiddleware } from '@rsbuild/shared';
6
4
  type Options = {
7
5
  publicPaths: string[];
8
6
  dev: RsbuildDevMiddlewareOptions['dev'];
9
7
  devMiddleware?: CustomDevMiddleware;
10
8
  };
11
- export default class DevMiddleware extends EventEmitter {
9
+ export default class DevMiddleware {
12
10
  middleware?: DevMiddlewareAPI;
13
11
  private devOptions;
14
12
  private devMiddleware?;
@@ -31,7 +31,6 @@ __export(compiler_dev_middleware_exports, {
31
31
  default: () => DevMiddleware
32
32
  });
33
33
  module.exports = __toCommonJS(compiler_dev_middleware_exports);
34
- var import_events = require("events");
35
34
  var import_socketServer = __toESM(require("./socketServer"));
36
35
  const noop = () => {
37
36
  };
@@ -43,9 +42,8 @@ function getHMRClientPath(client) {
43
42
  const clientEntry = `${require.resolve("@rsbuild/core/client/hmr")}?${host}${path}${port}${protocol}`;
44
43
  return clientEntry;
45
44
  }
46
- class DevMiddleware extends import_events.EventEmitter {
45
+ class DevMiddleware {
47
46
  constructor({ dev, devMiddleware, publicPaths }) {
48
- super();
49
47
  this.devOptions = dev;
50
48
  this.publicPaths = publicPaths;
51
49
  this.socketServer = new import_socketServer.default(dev);
@@ -77,7 +75,6 @@ class DevMiddleware extends import_events.EventEmitter {
77
75
  },
78
76
  onDone: (stats) => {
79
77
  this.socketServer.updateStats(stats);
80
- this.emit("change", stats);
81
78
  }
82
79
  };
83
80
  const enableHMR = this.devOptions.hmr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
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.0"
63
+ "@rsbuild/shared": "0.2.1"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@types/node": "16.x",