@rsbuild/core 0.5.0 → 0.5.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.
@@ -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.5.0");
42
+ import_commander.program.name("rsbuild").usage("<command> [options]").version("0.5.1");
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.5.0"}`}
37
+ import_rslog.logger.greet(` ${`Rsbuild v${"0.5.1"}`}
38
38
  `);
39
39
  }
40
40
  // Annotate the CommonJS export names for ESM import in node:
package/dist/config.d.ts CHANGED
@@ -16,7 +16,7 @@ export declare function defineConfig(config: RsbuildConfigSyncFn): RsbuildConfig
16
16
  export declare function defineConfig(config: RsbuildConfigAsyncFn): RsbuildConfigAsyncFn;
17
17
  export declare function defineConfig(config: RsbuildConfigExport): RsbuildConfigExport;
18
18
  export declare function watchFiles(files: string[]): Promise<void>;
19
- export declare function loadConfig({ cwd, path, envMode, }: {
19
+ export declare function loadConfig({ cwd, path, envMode, }?: {
20
20
  cwd?: string;
21
21
  path?: string;
22
22
  envMode?: string;
package/dist/config.js CHANGED
@@ -92,7 +92,7 @@ async function loadConfig({
92
92
  cwd = process.cwd(),
93
93
  path,
94
94
  envMode
95
- }) {
95
+ } = {}) {
96
96
  const configFilePath = resolveConfigPath(cwd, path);
97
97
  if (!configFilePath) {
98
98
  return {
@@ -1,2 +1,2 @@
1
1
  import { type RsbuildInstance, type CreateRsbuildOptions } from '@rsbuild/shared';
2
- export declare function createRsbuild(options: CreateRsbuildOptions): Promise<RsbuildInstance>;
2
+ export declare function createRsbuild(options?: CreateRsbuildOptions): Promise<RsbuildInstance>;
@@ -38,7 +38,7 @@ const getRspackProvider = async () => {
38
38
  const { rspackProvider } = await Promise.resolve().then(() => __toESM(require("./provider")));
39
39
  return rspackProvider;
40
40
  };
41
- async function createRsbuild(options) {
41
+ async function createRsbuild(options = {}) {
42
42
  const { rsbuildConfig = {} } = options;
43
43
  const provider = rsbuildConfig.provider || await getRspackProvider();
44
44
  const rsbuildOptions = {
package/dist/index.js CHANGED
@@ -38,7 +38,7 @@ var import_config = require("./config");
38
38
  var import_shared = require("@rsbuild/shared");
39
39
  var import_mergeConfig = require("./mergeConfig");
40
40
  var import_constants = require("./constants");
41
- const version = "0.5.0";
41
+ const version = "0.5.1";
42
42
  // Annotate the CommonJS export names for ESM import in node:
43
43
  0 && (module.exports = {
44
44
  PLUGIN_CSS_NAME,
@@ -32,7 +32,7 @@ __export(networkPerformance_exports, {
32
32
  });
33
33
  module.exports = __toCommonJS(networkPerformance_exports);
34
34
  const pluginNetworkPerformance = () => ({
35
- name: "plugin-network-performance",
35
+ name: "rsbuild:network-performance",
36
36
  setup(api) {
37
37
  api.modifyBundlerChain(
38
38
  async (chain, { CHAIN_ID, isServer, isWebWorker, isServiceWorker }) => {
@@ -32,7 +32,7 @@ __export(preloadOrPrefetch_exports, {
32
32
  });
33
33
  module.exports = __toCommonJS(preloadOrPrefetch_exports);
34
34
  const pluginPreloadOrPrefetch = () => ({
35
- name: "plugin-preload-or-prefetch",
35
+ name: "rsbuild:preload-prefetch",
36
36
  setup(api) {
37
37
  api.modifyBundlerChain(
38
38
  async (chain, { CHAIN_ID, isServer, isWebWorker, isServiceWorker }) => {
@@ -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.5.0",
47
+ version: "0.5.1",
48
48
  rootPath,
49
49
  distPath,
50
50
  cachePath,
@@ -11,3 +11,4 @@ export { setHTMLPlugin, getHTMLPlugin } from './htmlPluginUtil';
11
11
  export { formatStats } from './shared';
12
12
  export { getChainUtils } from './rspackConfig';
13
13
  export { applySwcDecoratorConfig } from './plugins/swc';
14
+ export { getDevMiddleware } from './devMiddleware';
@@ -26,6 +26,7 @@ __export(provider_exports, {
26
26
  createPublicContext: () => import_createContext.createPublicContext,
27
27
  formatStats: () => import_shared.formatStats,
28
28
  getChainUtils: () => import_rspackConfig.getChainUtils,
29
+ getDevMiddleware: () => import_devMiddleware.getDevMiddleware,
29
30
  getHTMLPlugin: () => import_htmlPluginUtil.getHTMLPlugin,
30
31
  getPluginAPI: () => import_initPlugins.getPluginAPI,
31
32
  initHooks: () => import_initHooks.initHooks,
@@ -46,6 +47,7 @@ var import_htmlPluginUtil = require("./htmlPluginUtil");
46
47
  var import_shared = require("./shared");
47
48
  var import_rspackConfig = require("./rspackConfig");
48
49
  var import_swc = require("./plugins/swc");
50
+ var import_devMiddleware = require("./devMiddleware");
49
51
  // Annotate the CommonJS export names for ESM import in node:
50
52
  0 && (module.exports = {
51
53
  applyBaseCSSRule,
@@ -56,6 +58,7 @@ var import_swc = require("./plugins/swc");
56
58
  createPublicContext,
57
59
  formatStats,
58
60
  getChainUtils,
61
+ getDevMiddleware,
59
62
  getHTMLPlugin,
60
63
  getPluginAPI,
61
64
  initHooks,
@@ -23,18 +23,10 @@ __export(transition_exports, {
23
23
  module.exports = __toCommonJS(transition_exports);
24
24
  const pluginTransition = () => ({
25
25
  name: "rsbuild:transition",
26
- setup(api) {
26
+ setup() {
27
27
  var _a;
28
28
  process.env.RSPACK_CONFIG_VALIDATE = "loose-silent";
29
29
  (_a = process.env).WATCHPACK_WATCHER_LIMIT || (_a.WATCHPACK_WATCHER_LIMIT = "20");
30
- api.modifyRspackConfig((config, { isProd }) => {
31
- var _a2;
32
- if (isProd) {
33
- config.experiments || (config.experiments = {});
34
- (_a2 = config.experiments).rspackFuture || (_a2.rspackFuture = {});
35
- config.experiments.rspackFuture.newTreeshaking = true;
36
- }
37
- });
38
30
  }
39
31
  });
40
32
  // Annotate the CommonJS export names for ESM import in node:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "bugs": {
@@ -52,12 +52,12 @@
52
52
  "types.d.ts"
53
53
  ],
54
54
  "dependencies": {
55
- "@rspack/core": "0.5.7",
55
+ "@rspack/core": "0.5.8",
56
56
  "@swc/helpers": "0.5.3",
57
57
  "core-js": "~3.36.0",
58
58
  "html-webpack-plugin": "npm:html-rspack-plugin@5.6.2",
59
59
  "postcss": "^8.4.33",
60
- "@rsbuild/shared": "0.5.0"
60
+ "@rsbuild/shared": "0.5.1"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/node": "16.x",