@rsbuild/plugin-babel 0.2.11 → 0.2.13

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.d.ts CHANGED
@@ -1,3 +1,79 @@
1
- export { pluginBabel } from './plugin';
2
- export { getBabelUtils, getUseBuiltIns, modifyBabelLoaderOptions, } from './helper';
3
- export type { PresetEnvOptions, PresetEnvTargets, PresetEnvBuiltIns, BabelConfigUtils, BabelTransformOptions, PluginBabelOptions, } from './types';
1
+ import { RsbuildPlugin } from '@rsbuild/core';
2
+ import { ChainedConfigWithUtils, NormalizedConfig, BundlerChain, ChainIdentifier } from '@rsbuild/shared';
3
+ import { PluginItem, TransformOptions } from '@babel/core';
4
+ export { TransformOptions as BabelTransformOptions } from '@babel/core';
5
+
6
+ type PresetEnvTargets = string | string[] | Record<string, string>;
7
+ type PresetEnvBuiltIns = 'usage' | 'entry' | false;
8
+ type PresetEnvOptions = {
9
+ targets?: PresetEnvTargets;
10
+ bugfixes?: boolean;
11
+ spec?: boolean;
12
+ loose?: boolean;
13
+ modules?: 'amd' | 'umd' | 'systemjs' | 'commonjs' | 'cjs' | 'auto' | false;
14
+ debug?: boolean;
15
+ include?: string[];
16
+ exclude?: string[];
17
+ useBuiltIns?: PresetEnvBuiltIns;
18
+ corejs?: string | {
19
+ version: string;
20
+ proposals: boolean;
21
+ };
22
+ forceAllTransforms?: boolean;
23
+ configPath?: string;
24
+ ignoreBrowserslistConfig?: boolean;
25
+ browserslistEnv?: string;
26
+ shippedProposals?: boolean;
27
+ };
28
+ interface SharedBabelPresetReactOptions {
29
+ development?: boolean;
30
+ throwIfNamespace?: boolean;
31
+ }
32
+ interface AutomaticRuntimePresetReactOptions extends SharedBabelPresetReactOptions {
33
+ runtime?: 'automatic';
34
+ importSource?: string;
35
+ }
36
+ interface ClassicRuntimePresetReactOptions extends SharedBabelPresetReactOptions {
37
+ runtime?: 'classic';
38
+ pragma?: string;
39
+ pragmaFrag?: string;
40
+ useBuiltIns?: boolean;
41
+ useSpread?: boolean;
42
+ }
43
+ type PresetReactOptions = AutomaticRuntimePresetReactOptions | ClassicRuntimePresetReactOptions;
44
+ type RuleCondition = string | RegExp | (string | RegExp)[];
45
+ type BabelConfigUtils = {
46
+ addPlugins: (plugins: PluginItem[]) => void;
47
+ addPresets: (presets: PluginItem[]) => void;
48
+ removePlugins: (plugins: string | string[]) => void;
49
+ removePresets: (presets: string | string[]) => void;
50
+ modifyPresetEnvOptions: (options: PresetEnvOptions) => void;
51
+ modifyPresetReactOptions: (options: PresetReactOptions) => void;
52
+ /**
53
+ * use `source.include` instead
54
+ * @deprecated
55
+ */
56
+ addIncludes: (includes: RuleCondition) => void;
57
+ /**
58
+ * use `source.exclude` instead
59
+ * @deprecated
60
+ */
61
+ addExcludes: (excludes: RuleCondition) => void;
62
+ };
63
+ type PluginBabelOptions = {
64
+ include?: RuleCondition;
65
+ exclude?: RuleCondition;
66
+ babelLoaderOptions?: ChainedConfigWithUtils<TransformOptions, BabelConfigUtils>;
67
+ };
68
+
69
+ declare const pluginBabel: (options?: PluginBabelOptions) => RsbuildPlugin;
70
+
71
+ declare const getBabelUtils: (config: TransformOptions) => BabelConfigUtils;
72
+ declare const getUseBuiltIns: (config: NormalizedConfig) => false | "usage" | "entry";
73
+ declare const modifyBabelLoaderOptions: ({ chain, CHAIN_ID, modifier, }: {
74
+ chain: BundlerChain;
75
+ CHAIN_ID: ChainIdentifier;
76
+ modifier: (config: TransformOptions) => TransformOptions;
77
+ }) => void;
78
+
79
+ export { BabelConfigUtils, PluginBabelOptions, PresetEnvBuiltIns, PresetEnvOptions, PresetEnvTargets, getBabelUtils, getUseBuiltIns, modifyBabelLoaderOptions, pluginBabel };
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
6
6
  throw Error('Dynamic require of "' + x + '" is not supported');
7
7
  });
8
8
 
9
- // ../../node_modules/.pnpm/@modern-js+module-tools@2.43.0_typescript@5.3.2/node_modules/@modern-js/module-tools/shims/esm.js
9
+ // ../../node_modules/.pnpm/@modern-js+module-tools@2.44.0_typescript@5.3.2/node_modules/@modern-js/module-tools/shims/esm.js
10
10
  import { fileURLToPath } from "url";
11
11
  import path from "path";
12
12
  var getFilename = () => fileURLToPath(import.meta.url);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-babel",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "description": "Babel plugin for Rsbuild",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,13 +27,13 @@
27
27
  "@babel/preset-typescript": "^7.23.2",
28
28
  "@types/babel__core": "^7.20.3",
29
29
  "upath": "2.0.1",
30
- "@rsbuild/shared": "0.2.11"
30
+ "@rsbuild/shared": "0.2.13"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "16.x",
34
34
  "typescript": "^5.3.0",
35
- "@rsbuild/core": "0.2.11",
36
- "@rsbuild/test-helper": "0.2.11"
35
+ "@rsbuild/test-helper": "0.2.13",
36
+ "@rsbuild/core": "0.2.13"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public",
package/dist/helper.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import { type BundlerChain, type ChainIdentifier, type NormalizedConfig } from '@rsbuild/shared';
2
- import type { BabelConfigUtils, BabelTransformOptions, PluginBabelOptions } from './types';
3
- export declare const BABEL_JS_RULE = "babel-js";
4
- export declare const getBabelUtils: (config: BabelTransformOptions) => BabelConfigUtils;
5
- export declare const applyUserBabelConfig: (defaultOptions: BabelTransformOptions, userBabelConfig?: PluginBabelOptions['babelLoaderOptions'], extraBabelUtils?: Partial<BabelConfigUtils>) => BabelTransformOptions;
6
- export declare const getUseBuiltIns: (config: NormalizedConfig) => false | "usage" | "entry";
7
- export declare const modifyBabelLoaderOptions: ({ chain, CHAIN_ID, modifier, }: {
8
- chain: BundlerChain;
9
- CHAIN_ID: ChainIdentifier;
10
- modifier: (config: BabelTransformOptions) => BabelTransformOptions;
11
- }) => void;
package/dist/plugin.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import type { RsbuildPlugin } from '@rsbuild/core';
2
- import type { PluginBabelOptions } from './types';
3
- /**
4
- * The `@babel/preset-typescript` default options.
5
- */
6
- export declare const DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: {
7
- allowNamespaces: boolean;
8
- allExtensions: boolean;
9
- allowDeclareFields: boolean;
10
- optimizeConstEnums: boolean;
11
- isTSX: boolean;
12
- };
13
- export declare const pluginBabel: (options?: PluginBabelOptions) => RsbuildPlugin;
package/dist/types.d.ts DELETED
@@ -1,65 +0,0 @@
1
- import type { ChainedConfigWithUtils } from '@rsbuild/shared';
2
- import type { PluginItem as BabelPlugin, TransformOptions as BabelTransformOptions } from '@babel/core';
3
- export type { BabelPlugin, BabelTransformOptions };
4
- export type PresetEnvTargets = string | string[] | Record<string, string>;
5
- export type PresetEnvBuiltIns = 'usage' | 'entry' | false;
6
- export type PresetEnvOptions = {
7
- targets?: PresetEnvTargets;
8
- bugfixes?: boolean;
9
- spec?: boolean;
10
- loose?: boolean;
11
- modules?: 'amd' | 'umd' | 'systemjs' | 'commonjs' | 'cjs' | 'auto' | false;
12
- debug?: boolean;
13
- include?: string[];
14
- exclude?: string[];
15
- useBuiltIns?: PresetEnvBuiltIns;
16
- corejs?: string | {
17
- version: string;
18
- proposals: boolean;
19
- };
20
- forceAllTransforms?: boolean;
21
- configPath?: string;
22
- ignoreBrowserslistConfig?: boolean;
23
- browserslistEnv?: string;
24
- shippedProposals?: boolean;
25
- };
26
- export interface SharedBabelPresetReactOptions {
27
- development?: boolean;
28
- throwIfNamespace?: boolean;
29
- }
30
- export interface AutomaticRuntimePresetReactOptions extends SharedBabelPresetReactOptions {
31
- runtime?: 'automatic';
32
- importSource?: string;
33
- }
34
- export interface ClassicRuntimePresetReactOptions extends SharedBabelPresetReactOptions {
35
- runtime?: 'classic';
36
- pragma?: string;
37
- pragmaFrag?: string;
38
- useBuiltIns?: boolean;
39
- useSpread?: boolean;
40
- }
41
- export type PresetReactOptions = AutomaticRuntimePresetReactOptions | ClassicRuntimePresetReactOptions;
42
- export type RuleCondition = string | RegExp | (string | RegExp)[];
43
- export type BabelConfigUtils = {
44
- addPlugins: (plugins: BabelPlugin[]) => void;
45
- addPresets: (presets: BabelPlugin[]) => void;
46
- removePlugins: (plugins: string | string[]) => void;
47
- removePresets: (presets: string | string[]) => void;
48
- modifyPresetEnvOptions: (options: PresetEnvOptions) => void;
49
- modifyPresetReactOptions: (options: PresetReactOptions) => void;
50
- /**
51
- * use `source.include` instead
52
- * @deprecated
53
- */
54
- addIncludes: (includes: RuleCondition) => void;
55
- /**
56
- * use `source.exclude` instead
57
- * @deprecated
58
- */
59
- addExcludes: (excludes: RuleCondition) => void;
60
- };
61
- export type PluginBabelOptions = {
62
- include?: RuleCondition;
63
- exclude?: RuleCondition;
64
- babelLoaderOptions?: ChainedConfigWithUtils<BabelTransformOptions, BabelConfigUtils>;
65
- };