@rsbuild/plugin-babel 0.7.2 → 0.7.4

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/dist/index.cjs CHANGED
@@ -141,10 +141,10 @@ var applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils) =>
141
141
  ...getBabelUtils(defaultOptions),
142
142
  ...extraBabelUtils
143
143
  };
144
- return (0, import_shared.mergeChainedOptions)({
145
- defaults: defaultOptions,
146
- options: userBabelConfig,
147
- utils: babelUtils
144
+ return (0, import_shared.reduceConfigsWithContext)({
145
+ initial: defaultOptions,
146
+ config: userBabelConfig,
147
+ ctx: babelUtils
148
148
  });
149
149
  }
150
150
  return defaultOptions;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ChainedConfigWithUtils, NormalizedConfig, RsbuildContext, RsbuildPlugin, BundlerChain, ChainIdentifier } from '@rsbuild/core';
1
+ import { ConfigChainWithContext, NormalizedConfig, RsbuildContext, RsbuildPlugin, RspackChain, ChainIdentifier } from '@rsbuild/core';
2
2
  import { PluginItem, TransformOptions } from '@babel/core';
3
3
  export { TransformOptions as BabelTransformOptions } from '@babel/core';
4
4
 
@@ -94,7 +94,7 @@ type PluginBabelOptions = {
94
94
  * Options passed to `babel-loader`.
95
95
  * @see https://github.com/babel/babel-loader
96
96
  */
97
- babelLoaderOptions?: ChainedConfigWithUtils<BabelLoaderOptions, BabelConfigUtils>;
97
+ babelLoaderOptions?: ConfigChainWithContext<BabelLoaderOptions, BabelConfigUtils>;
98
98
  };
99
99
 
100
100
  declare const getDefaultBabelOptions: (config: NormalizedConfig, context: RsbuildContext) => BabelLoaderOptions;
@@ -103,7 +103,7 @@ declare const pluginBabel: (options?: PluginBabelOptions) => RsbuildPlugin;
103
103
  declare const getBabelUtils: (config: TransformOptions) => BabelConfigUtils;
104
104
  declare const getUseBuiltIns: (config: NormalizedConfig) => false | "usage" | "entry";
105
105
  declare const modifyBabelLoaderOptions: ({ chain, CHAIN_ID, modifier, }: {
106
- chain: BundlerChain;
106
+ chain: RspackChain;
107
107
  CHAIN_ID: ChainIdentifier;
108
108
  modifier: (config: TransformOptions) => TransformOptions;
109
109
  }) => void;
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
9
9
  throw Error('Dynamic require of "' + x + '" is not supported');
10
10
  });
11
11
 
12
- // ../../node_modules/.pnpm/@modern-js+module-tools@2.50.0_eslint@9.4.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js
12
+ // ../../node_modules/.pnpm/@modern-js+module-tools@2.52.0_eslint@9.4.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js
13
13
  import { fileURLToPath } from "url";
14
14
  import path from "path";
15
15
  var getFilename = () => fileURLToPath(import.meta.url);
@@ -29,7 +29,7 @@ import {
29
29
 
30
30
  // src/helper.ts
31
31
  import { isAbsolute, normalize, sep } from "path";
32
- import { castArray, mergeChainedOptions } from "@rsbuild/shared";
32
+ import { castArray, reduceConfigsWithContext } from "@rsbuild/shared";
33
33
  import upath from "upath";
34
34
  var BABEL_JS_RULE = "babel-js";
35
35
  var normalizeToPosixPath = (p) => upath.normalizeSafe(normalize(p || "")).replace(/^([a-zA-Z]+):/, (_, m) => `/${m.toLowerCase()}`);
@@ -126,10 +126,10 @@ var applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils) =>
126
126
  ...getBabelUtils(defaultOptions),
127
127
  ...extraBabelUtils
128
128
  };
129
- return mergeChainedOptions({
130
- defaults: defaultOptions,
131
- options: userBabelConfig,
132
- utils: babelUtils
129
+ return reduceConfigsWithContext({
130
+ initial: defaultOptions,
131
+ config: userBabelConfig,
132
+ ctx: babelUtils
133
133
  });
134
134
  }
135
135
  return defaultOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-babel",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Babel plugin for Rsbuild",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,18 +29,18 @@
29
29
  "@babel/preset-typescript": "^7.24.6",
30
30
  "@types/babel__core": "^7.20.5",
31
31
  "upath": "2.0.1",
32
- "@rsbuild/shared": "0.7.2"
32
+ "@rsbuild/shared": "0.7.4"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/node": "18.x",
36
36
  "babel-loader": "9.1.3",
37
37
  "prebundle": "1.1.0",
38
38
  "typescript": "^5.4.2",
39
- "@rsbuild/core": "0.7.2",
40
- "@scripts/test-helper": "0.7.2"
39
+ "@rsbuild/core": "0.7.4",
40
+ "@scripts/test-helper": "0.7.4"
41
41
  },
42
42
  "peerDependencies": {
43
- "@rsbuild/core": "^0.7.2"
43
+ "@rsbuild/core": "^0.7.4"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public",