@winner-fed/bundler-rsbuild 0.11.19 → 0.11.20-alpha.0

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.
@@ -1,10 +1,16 @@
1
- import { ModifyRsbuildConfigFn, RsbuildConfig } from '@rsbuild/core';
1
+ import { RsbuildConfig, rspack } from '@rsbuild/core';
2
+ import type { MaybePromise } from '@rsbuild/core/dist-types/types';
2
3
  import { Env, IBabelPlugin, IConfig } from '../types';
3
4
  export interface IOpts {
4
5
  cwd?: string;
5
6
  env?: Env;
6
7
  entry?: Record<string, string>;
7
- modifyRsbuildConfig?: ModifyRsbuildConfigFn;
8
+ modifyRsbuildConfig?: {
9
+ (memo: RsbuildConfig, args: {
10
+ env: Env;
11
+ rspack: typeof rspack;
12
+ }): MaybePromise<RsbuildConfig>;
13
+ };
8
14
  userConfig?: IConfig;
9
15
  extraBabelPlugins?: IBabelPlugin[];
10
16
  extraBabelIncludes?: Array<string | RegExp>;
@@ -32,6 +32,7 @@ __export(config_exports, {
32
32
  getRsbuildConfig: () => getRsbuildConfig
33
33
  });
34
34
  module.exports = __toCommonJS(config_exports);
35
+ var import_core = require("@rsbuild/core");
35
36
  var import_plugin_babel = require("@rsbuild/plugin-babel");
36
37
  var import_plugin_less = require("@rsbuild/plugin-less");
37
38
  var import_plugin_node_polyfill = require("@rsbuild/plugin-node-polyfill");
@@ -120,9 +121,13 @@ async function getRsbuildConfig(opts) {
120
121
  }
121
122
  if (opts.modifyRsbuildConfig) {
122
123
  await opts.modifyRsbuildConfig(rsbuildConfig, {
123
- env: opts.env
124
+ env: opts.env,
125
+ rspack: import_core.rspack
124
126
  });
125
127
  }
128
+ if (Object.keys((userConfig == null ? void 0 : userConfig.rsbuild.config) ?? {}).length > 0) {
129
+ return (0, import_core.mergeRsbuildConfig)(rsbuildConfig, userConfig == null ? void 0 : userConfig.rsbuild.config);
130
+ }
126
131
  return rsbuildConfig;
127
132
  }
128
133
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- export type { ConsoleType, ModifyBundlerChainUtils, ModifyRspackConfigUtils, RsbuildConfig, Rspack, RspackChain, } from '@rsbuild/core';
2
- export type { ModifyRsbuildConfigUtils } from '@rsbuild/core/dist-types/types';
1
+ export type { ConsoleType, ModifyBundlerChainUtils, ModifyRspackConfigUtils, RsbuildConfig, Rspack, rspack, RspackChain, } from '@rsbuild/core';
3
2
  export * from './build';
4
3
  export * from './config/config';
5
4
  export * from './constants';
package/dist/types.d.ts CHANGED
@@ -5,7 +5,8 @@
5
5
  * @LastEditTime: 2024-07-16 09:15
6
6
  * @Description: types
7
7
  */
8
- import { Rspack } from '@rsbuild/core';
8
+ import { RsbuildConfig, Rspack, rspack } from '@rsbuild/core';
9
+ import type { MaybePromise } from '@rsbuild/core/dist-types/types';
9
10
  import type { HttpsServerOptions, ProxyOptions } from '@winner-fed/bundler-utils';
10
11
  export declare enum Env {
11
12
  development = "development",
@@ -39,6 +40,15 @@ export interface IConfig {
39
40
  define?: {
40
41
  [key: string]: any;
41
42
  };
43
+ modifyRsbuildConfig?: {
44
+ (memo: RsbuildConfig, args: {
45
+ env: Env;
46
+ rspack: typeof rspack;
47
+ }): MaybePromise<RsbuildConfig>;
48
+ };
49
+ rsbuildConfig?: RsbuildConfig;
50
+ modifyRspackConfig?: Function;
51
+ modifyBundlerChain?: Function;
42
52
  externals?: Record<string, string>;
43
53
  extraBabelPlugins?: IBabelPlugin[];
44
54
  extraBabelPresets?: IBabelPlugin[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@winner-fed/bundler-rsbuild",
3
- "version": "0.11.19",
3
+ "version": "0.11.20-alpha.0",
4
4
  "description": "@winner-fed/bundler-rsbuild",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -9,15 +9,15 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@rsbuild/core": "1.1.6",
12
+ "@rsbuild/core": "1.1.8",
13
13
  "@rsbuild/plugin-babel": "1.0.3",
14
14
  "@rsbuild/plugin-less": "1.1.0",
15
15
  "@rsbuild/plugin-node-polyfill": "1.2.0",
16
16
  "@rsbuild/plugin-sass": "1.1.1",
17
17
  "@rsbuild/plugin-stylus": "1.0.6",
18
18
  "@rsbuild/plugin-type-check": "1.1.0",
19
- "@winner-fed/bundler-utils": "0.11.19",
20
- "@winner-fed/utils": "0.11.19"
19
+ "@winner-fed/utils": "0.11.20-alpha.0",
20
+ "@winner-fed/bundler-utils": "0.11.20-alpha.0"
21
21
  },
22
22
  "publishConfig": {
23
23
  "access": "public"