@rsbuild/plugin-babel 1.2.0 → 1.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.
@@ -1,6 +1,6 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 482: (module) => {
3
+ 945: (module) => {
4
4
  const STRIP_FILENAME_RE = /^[^:]+: /;
5
5
  const format = (err) => {
6
6
  if (err instanceof SyntaxError) {
@@ -26,7 +26,7 @@
26
26
  }
27
27
  module.exports = LoaderError;
28
28
  },
29
- 686: (module, __unused_webpack_exports, __nccwpck_require__) => {
29
+ 925: (module, __unused_webpack_exports, __nccwpck_require__) => {
30
30
  const os = __nccwpck_require__(857);
31
31
  const path = __nccwpck_require__(928);
32
32
  const zlib = __nccwpck_require__(106);
@@ -34,8 +34,8 @@
34
34
  const { readFile, writeFile, mkdir } = __nccwpck_require__(943);
35
35
  const { sync: findUpSync } = __nccwpck_require__(48);
36
36
  const { env } = process;
37
- const transform = __nccwpck_require__(816);
38
- const serialize = __nccwpck_require__(946);
37
+ const transform = __nccwpck_require__(19);
38
+ const serialize = __nccwpck_require__(473);
39
39
  let defaultCacheDirectory = null;
40
40
  const gunzip = promisify(zlib.gunzip);
41
41
  const gzip = promisify(zlib.gzip);
@@ -174,7 +174,7 @@
174
174
  return os.tmpdir();
175
175
  }
176
176
  },
177
- 688: (module, __unused_webpack_exports, __nccwpck_require__) => {
177
+ 475: (module, __unused_webpack_exports, __nccwpck_require__) => {
178
178
  let babel;
179
179
  try {
180
180
  babel = __nccwpck_require__(571);
@@ -193,10 +193,10 @@
193
193
  );
194
194
  }
195
195
  const { version } = __nccwpck_require__(344);
196
- const cache = __nccwpck_require__(686);
197
- const transform = __nccwpck_require__(816);
198
- const injectCaller = __nccwpck_require__(515);
199
- const schema = __nccwpck_require__(919);
196
+ const cache = __nccwpck_require__(925);
197
+ const transform = __nccwpck_require__(19);
198
+ const injectCaller = __nccwpck_require__(9);
199
+ const schema = __nccwpck_require__(414);
200
200
  const { isAbsolute } = __nccwpck_require__(928);
201
201
  const { promisify } = __nccwpck_require__(23);
202
202
  function subscribe(subscriber, metadata, context) {
@@ -383,7 +383,7 @@
383
383
  return [source, inputSourceMap];
384
384
  }
385
385
  },
386
- 515: (module) => {
386
+ 9: (module) => {
387
387
  module.exports = function injectCaller(opts, target) {
388
388
  return {
389
389
  ...opts,
@@ -400,7 +400,7 @@
400
400
  };
401
401
  };
402
402
  },
403
- 946: (module) => {
403
+ 473: (module) => {
404
404
  var objToString = Object.prototype.toString;
405
405
  var objKeys = Object.getOwnPropertyNames;
406
406
  function serialize(val, isArrayProp) {
@@ -466,10 +466,10 @@
466
466
  }
467
467
  };
468
468
  },
469
- 816: (module, __unused_webpack_exports, __nccwpck_require__) => {
469
+ 19: (module, __unused_webpack_exports, __nccwpck_require__) => {
470
470
  const babel = __nccwpck_require__(571);
471
471
  const { promisify } = __nccwpck_require__(23);
472
- const LoaderError = __nccwpck_require__(482);
472
+ const LoaderError = __nccwpck_require__(945);
473
473
  const babelTransform = babel.transformAsync ?? promisify(babel.transform);
474
474
  module.exports = async function transform(source, options) {
475
475
  let result;
@@ -820,7 +820,7 @@
820
820
  "use strict";
821
821
  module.exports = require("zlib");
822
822
  },
823
- 919: (module) => {
823
+ 414: (module) => {
824
824
  "use strict";
825
825
  module.exports = JSON.parse(
826
826
  '{"title":"Babel Loader options","type":"object","properties":{"cacheDirectory":{"anyOf":[{"type":"boolean"},{"type":"string"}],"default":false},"cacheIdentifier":{"type":"string"},"cacheCompression":{"type":"boolean","default":true},"customize":{"anyOf":[{"type":"null"},{"type":"string"}],"default":null},"metadataSubscribers":{"type":"array"}},"additionalProperties":true}',
@@ -849,6 +849,6 @@
849
849
  }
850
850
  if (typeof __nccwpck_require__ !== "undefined")
851
851
  __nccwpck_require__.ab = __dirname + "/";
852
- var __webpack_exports__ = __nccwpck_require__(688);
852
+ var __webpack_exports__ = __nccwpck_require__(475);
853
853
  module.exports = __webpack_exports__;
854
854
  })();
package/dist/helper.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import type { ChainIdentifier, RspackChain } from '@rsbuild/core';
2
2
  import type { BabelConfigUtils, BabelLoaderOptions, BabelTransformOptions, PluginBabelOptions } from './types.js';
3
- export declare const BABEL_JS_RULE = "babel-js";
3
+ export declare const BABEL_JS_RULE = 'babel-js';
4
4
  export declare const getBabelRuleId: (chain: RspackChain) => string;
5
5
  export declare const castArray: <T>(arr?: T | T[]) => T[];
6
6
  export declare const getBabelUtils: (config: BabelTransformOptions) => BabelConfigUtils;
7
7
  export declare const applyUserBabelConfig: (defaultOptions: BabelLoaderOptions, userBabelConfig?: PluginBabelOptions['babelLoaderOptions'], extraBabelUtils?: Partial<BabelConfigUtils>) => BabelLoaderOptions;
8
- export declare const modifyBabelLoaderOptions: ({ chain, CHAIN_ID, modifier, }: {
8
+ export declare const modifyBabelLoaderOptions: ({ chain, CHAIN_ID, modifier }: {
9
9
  chain: RspackChain;
10
10
  CHAIN_ID: ChainIdentifier;
11
11
  modifier: (config: BabelTransformOptions) => BabelTransformOptions;
package/dist/index.cjs CHANGED
@@ -6,11 +6,14 @@ __webpack_require__.n = (module)=>{
6
6
  return __webpack_require__.d(getter, {
7
7
  a: getter
8
8
  }), getter;
9
- }, __webpack_require__.d = (exports1, definition)=>{
10
- for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
11
- enumerable: !0,
12
- get: definition[key]
13
- });
9
+ }, __webpack_require__.d = (exports1, getters, values)=>{
10
+ var define = (defs, kind)=>{
11
+ for(var key in defs)__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
12
+ enumerable: !0,
13
+ [kind]: defs[key]
14
+ });
15
+ };
16
+ define(getters, "get"), define(values, "value");
14
17
  }, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports1)=>{
15
18
  "u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
16
19
  value: 'Module'
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { getBabelUtils, modifyBabelLoaderOptions } from './helper.js';
2
- export { getDefaultBabelOptions, PLUGIN_BABEL_NAME, pluginBabel, } from './plugin.js';
3
- export type { BabelConfigUtils, BabelTransformOptions, PluginBabelOptions, PresetEnvBuiltIns, PresetEnvOptions, PresetEnvTargets, } from './types.js';
2
+ export { getDefaultBabelOptions, PLUGIN_BABEL_NAME, pluginBabel } from './plugin.js';
3
+ export type { BabelConfigUtils, BabelTransformOptions, PluginBabelOptions, PresetEnvBuiltIns, PresetEnvOptions, PresetEnvTargets } from './types.js';
package/dist/plugin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { NormalizedEnvironmentConfig, RsbuildContext, RsbuildPlugin } from '@rsbuild/core';
2
2
  import type { BabelLoaderOptions, PluginBabelOptions } from './types.js';
3
- export declare const PLUGIN_BABEL_NAME = "rsbuild:babel";
3
+ export declare const PLUGIN_BABEL_NAME = 'rsbuild:babel';
4
4
  export declare function getDefaultBabelOptions(config: NormalizedEnvironmentConfig, context: RsbuildContext): BabelLoaderOptions;
5
5
  export declare const pluginBabel: (options?: PluginBabelOptions) => RsbuildPlugin;
package/dist/types.d.ts CHANGED
@@ -48,50 +48,40 @@ export type BabelConfigUtils = {
48
48
  modifyPresetEnvOptions: (options: PresetEnvOptions) => void;
49
49
  modifyPresetReactOptions: (options: PresetReactOptions) => void;
50
50
  /**
51
- * use `source.include` instead
52
- * @deprecated
53
- */
54
- addIncludes: (includes: RuleCondition) => void;
51
+ * use `source.include` instead
52
+ * @deprecated
53
+ */ addIncludes: (includes: RuleCondition) => void;
55
54
  /**
56
- * use `source.exclude` instead
57
- * @deprecated
58
- */
59
- addExcludes: (excludes: RuleCondition) => void;
55
+ * use `source.exclude` instead
56
+ * @deprecated
57
+ */ addExcludes: (excludes: RuleCondition) => void;
60
58
  };
61
59
  export type BabelLoaderOptions = BabelTransformOptions & {
62
60
  /**
63
- * When set, the given directory will be used to cache the results of the loader.
64
- */
65
- cacheDirectory?: string | boolean;
61
+ * When set, the given directory will be used to cache the results of the loader.
62
+ */ cacheDirectory?: string | boolean;
66
63
  /**
67
- * Can be set to a custom value to force cache busting if the identifier changes.
68
- */
69
- cacheIdentifier?: string;
64
+ * Can be set to a custom value to force cache busting if the identifier changes.
65
+ */ cacheIdentifier?: string;
70
66
  /**
71
- * When set, each Babel transform output will be compressed with Gzip.
72
- */
73
- cacheCompression?: boolean;
67
+ * When set, each Babel transform output will be compressed with Gzip.
68
+ */ cacheCompression?: boolean;
74
69
  /**
75
- * The path of a module that exports a custom callback.
76
- */
77
- customize?: string | null;
70
+ * The path of a module that exports a custom callback.
71
+ */ customize?: string | null;
78
72
  /**
79
- * Takes an array of context function names. E.g.
80
- */
81
- metadataSubscribers?: string[];
73
+ * Takes an array of context function names. E.g.
74
+ */ metadataSubscribers?: string[];
82
75
  };
83
76
  export type PluginBabelOptions = {
84
77
  /**
85
- * Used to specify the files that need to be compiled by Babel.
86
- */
87
- include?: RuleCondition;
78
+ * Used to specify the files that need to be compiled by Babel.
79
+ */ include?: RuleCondition;
88
80
  /**
89
- * Used to specify the files that do not need to be compiled by Babel.
90
- */
91
- exclude?: RuleCondition;
81
+ * Used to specify the files that do not need to be compiled by Babel.
82
+ */ exclude?: RuleCondition;
92
83
  /**
93
- * Options passed to `babel-loader`.
94
- * @see https://github.com/babel/babel-loader
95
- */
96
- babelLoaderOptions?: ConfigChainWithContext<BabelLoaderOptions, BabelConfigUtils>;
84
+ * Options passed to `babel-loader`.
85
+ * @see https://github.com/babel/babel-loader
86
+ */ babelLoaderOptions?: ConfigChainWithContext<BabelLoaderOptions, BabelConfigUtils>;
97
87
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-babel",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Babel plugin for Rsbuild",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,12 +31,12 @@
31
31
  },
32
32
  "devDependencies": {
33
33
  "@rsbuild/core-v1": "npm:@rsbuild/core@^1.7.5",
34
- "@rslib/core": "0.21.5",
34
+ "@rslib/core": "0.22.0",
35
35
  "@types/node": "^24.12.4",
36
36
  "babel-loader": "10.1.1",
37
37
  "prebundle": "1.6.4",
38
38
  "typescript": "^6.0.3",
39
- "@rsbuild/core": "2.0.7",
39
+ "@rsbuild/core": "2.0.9",
40
40
  "@scripts/test-helper": "1.0.0"
41
41
  },
42
42
  "peerDependencies": {