@winner-fed/bundler-rsbuild 0.11.20 → 0.11.21

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.
@@ -43,14 +43,16 @@ var import_types = require("../types");
43
43
  var import_devConfig = require("./devConfig");
44
44
  var import_outConfig = require("./outConfig");
45
45
  var import_performanceConfig = require("./performanceConfig");
46
+ var import_resolveConfig = require("./resolveConfig");
46
47
  var import_serverConfig = require("./serverConfig");
47
48
  var import_sourceConfig = require("./sourceConfig");
48
49
  var import_toolsConfig = require("./toolsConfig");
49
50
  async function getRsbuildConfig(opts) {
50
51
  var _a, _b;
51
- const { userConfig } = opts;
52
+ const { userConfig = {} } = opts;
52
53
  const isDev = opts.env === import_types.Env.development;
53
54
  const sourceConfig = (0, import_sourceConfig.getSourceConfig)(opts);
55
+ const resolveConfig = (0, import_resolveConfig.getResolveConfig)(opts);
54
56
  const outConfig = (0, import_outConfig.getOutConfig)(opts);
55
57
  const htmlConfig = {};
56
58
  const devConfig = (0, import_devConfig.getDevConfig)(opts);
@@ -59,6 +61,7 @@ async function getRsbuildConfig(opts) {
59
61
  const performanceConfig = (0, import_performanceConfig.getPerformanceConfig)(opts);
60
62
  let rsbuildConfig = {
61
63
  source: sourceConfig,
64
+ resolve: resolveConfig,
62
65
  output: outConfig,
63
66
  html: htmlConfig,
64
67
  tools: toolsConfig,
@@ -121,11 +124,11 @@ async function getRsbuildConfig(opts) {
121
124
  }
122
125
  if (opts.modifyRsbuildConfig) {
123
126
  await opts.modifyRsbuildConfig(rsbuildConfig, {
124
- env: opts.env,
127
+ env: opts.env || import_types.Env.development,
125
128
  rspack: import_core.rspack
126
129
  });
127
130
  }
128
- if (Object.keys((userConfig == null ? void 0 : userConfig.rsbuild.config) ?? {}).length > 0) {
131
+ if (Object.keys((userConfig == null ? void 0 : userConfig.rsbuild.config) ?? {}).length) {
129
132
  return (0, import_core.mergeRsbuildConfig)(rsbuildConfig, userConfig == null ? void 0 : userConfig.rsbuild.config);
130
133
  }
131
134
  return rsbuildConfig;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * resolveConfig
3
+ * @Author: liwb (lwbhtml@163.com)
4
+ * @Date: 2024-12-06 13:46
5
+ * @LastEditTime: 2024-12-06 13:46
6
+ * @Description: resolveConfig
7
+ */
8
+ import { ResolveConfig } from '@rsbuild/core/dist-types/types';
9
+ import { IConfig } from '../types';
10
+ interface IOpts {
11
+ userConfig: IConfig;
12
+ }
13
+ export declare function getResolveConfig(opts: IOpts): ResolveConfig;
14
+ export {};
@@ -0,0 +1,34 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/config/resolveConfig.ts
20
+ var resolveConfig_exports = {};
21
+ __export(resolveConfig_exports, {
22
+ getResolveConfig: () => getResolveConfig
23
+ });
24
+ module.exports = __toCommonJS(resolveConfig_exports);
25
+ function getResolveConfig(opts) {
26
+ const { userConfig } = opts;
27
+ return {
28
+ alias: userConfig.alias || {}
29
+ };
30
+ }
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ getResolveConfig
34
+ });
@@ -107,7 +107,6 @@ function getSourceConfig(opts) {
107
107
  });
108
108
  }
109
109
  return {
110
- alias: userConfig.alias || {},
111
110
  define: resolveDefine(opts),
112
111
  entry,
113
112
  tsconfigPath,
package/dist/schema.js CHANGED
@@ -98,6 +98,7 @@ function getSchemas() {
98
98
  postcssLoader: ({ zod }) => zod.record(zod.string(), zod.any()),
99
99
  proxy: ({ zod }) => zod.union([zod.record(zod.string(), zod.any()), zod.array(zod.any())]),
100
100
  publicPath: ({ zod }) => zod.string(),
101
+ rsbuildConfig: ({ zod }) => zod.record(zod.string(), zod.any()),
101
102
  sassLoader: ({ zod }) => zod.record(zod.string(), zod.any()),
102
103
  seeOptions: ({ zod }) => zod.object({}),
103
104
  styleLoader: ({ zod }) => zod.record(zod.string(), zod.any()),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@winner-fed/bundler-rsbuild",
3
- "version": "0.11.20",
3
+ "version": "0.11.21",
4
4
  "description": "@winner-fed/bundler-rsbuild",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -16,8 +16,8 @@
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.20",
20
- "@winner-fed/utils": "0.11.20"
19
+ "@winner-fed/bundler-utils": "0.11.21",
20
+ "@winner-fed/utils": "0.11.21"
21
21
  },
22
22
  "publishConfig": {
23
23
  "access": "public"