1 | import { Plugin, PluginContext, TransformPluginContext } from 'rollup';
|
2 | import { FilterPattern, CreateFilter } from '@rollup/pluginutils';
|
3 | import * as babelCore from '@babel/core';
|
4 |
|
5 | export interface RollupBabelInputPluginOptions
|
6 | extends Omit<babelCore.TransformOptions, 'include' | 'exclude'> {
|
7 | |
8 |
|
9 |
|
10 |
|
11 | include?: FilterPattern;
|
12 | |
13 |
|
14 |
|
15 |
|
16 | exclude?: FilterPattern;
|
17 | |
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | filter?: ReturnType<CreateFilter>;
|
27 | |
28 |
|
29 |
|
30 |
|
31 | extensions?: string[];
|
32 | |
33 |
|
34 |
|
35 |
|
36 | babelHelpers?: 'bundled' | 'runtime' | 'inline' | 'external';
|
37 | |
38 |
|
39 |
|
40 |
|
41 | skipPreflightCheck?: boolean;
|
42 | }
|
43 |
|
44 | export interface RollupBabelOutputPluginOptions
|
45 | extends Omit<babelCore.TransformOptions, 'include' | 'exclude'> {
|
46 | |
47 |
|
48 |
|
49 |
|
50 | allowAllFormats?: boolean;
|
51 | }
|
52 |
|
53 | export type RollupBabelCustomInputPluginOptions = (
|
54 | options: RollupBabelInputPluginOptions & Record<string, any>
|
55 | ) => {
|
56 | customOptions: Record<string, any>;
|
57 | pluginOptions: RollupBabelInputPluginOptions;
|
58 | };
|
59 | export type RollupBabelCustomOutputPluginOptions = (
|
60 | options: RollupBabelOutputPluginOptions & Record<string, any>
|
61 | ) => {
|
62 | customOptions: Record<string, any>;
|
63 | pluginOptions: RollupBabelOutputPluginOptions;
|
64 | };
|
65 | export interface RollupBabelCustomPluginConfigOptions {
|
66 | code: string;
|
67 | customOptions: Record<string, any>;
|
68 | }
|
69 | export interface RollupBabelCustomPluginResultOptions {
|
70 | code: string;
|
71 | customOptions: Record<string, any>;
|
72 | config: babelCore.PartialConfig;
|
73 | transformOptions: babelCore.TransformOptions;
|
74 | }
|
75 | export type RollupBabelCustomInputPluginConfig = (
|
76 | this: TransformPluginContext,
|
77 | cfg: babelCore.PartialConfig,
|
78 | options: RollupBabelCustomPluginConfigOptions
|
79 | ) => babelCore.TransformOptions;
|
80 | export type RollupBabelCustomInputPluginResult = (
|
81 | this: TransformPluginContext,
|
82 | result: babelCore.BabelFileResult,
|
83 | options: RollupBabelCustomPluginResultOptions
|
84 | ) => babelCore.BabelFileResult;
|
85 | export type RollupBabelCustomOutputPluginConfig = (
|
86 | this: PluginContext,
|
87 | cfg: babelCore.PartialConfig,
|
88 | options: RollupBabelCustomPluginConfigOptions
|
89 | ) => babelCore.TransformOptions;
|
90 | export type RollupBabelCustomOutputPluginResult = (
|
91 | this: PluginContext,
|
92 | result: babelCore.BabelFileResult,
|
93 | options: RollupBabelCustomPluginResultOptions
|
94 | ) => babelCore.BabelFileResult;
|
95 | export interface RollupBabelCustomInputPlugin {
|
96 | options?: RollupBabelCustomInputPluginOptions;
|
97 | config?: RollupBabelCustomInputPluginConfig;
|
98 | result?: RollupBabelCustomInputPluginResult;
|
99 | }
|
100 | export interface RollupBabelCustomOutputPlugin {
|
101 | options?: RollupBabelCustomOutputPluginOptions;
|
102 | config?: RollupBabelCustomOutputPluginConfig;
|
103 | result?: RollupBabelCustomOutputPluginResult;
|
104 | }
|
105 | export type RollupBabelCustomInputPluginBuilder = (
|
106 | babel: typeof babelCore
|
107 | ) => RollupBabelCustomInputPlugin;
|
108 | export type RollupBabelCustomOutputPluginBuilder = (
|
109 | babel: typeof babelCore
|
110 | ) => RollupBabelCustomOutputPlugin;
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 | export function getBabelInputPlugin(options?: RollupBabelInputPluginOptions): Plugin;
|
118 | export function getBabelOutputPlugin(options?: RollupBabelOutputPluginOptions): Plugin;
|
119 |
|
120 | export function createBabelInputPluginFactory(
|
121 | customCallback?: RollupBabelCustomInputPluginBuilder
|
122 | ): typeof getBabelInputPlugin;
|
123 | export function createBabelOutputPluginFactory(
|
124 | customCallback?: RollupBabelCustomOutputPluginBuilder
|
125 | ): typeof getBabelOutputPlugin;
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 | export function babel(options?: RollupBabelInputPluginOptions): Plugin;
|
133 | export default babel;
|