UNPKG

1.44 kBTypeScriptView Raw
1import { FilterPattern } from '@rollup/pluginutils';
2import { Plugin } from 'rollup';
3
4type Replacement = string | ((id: string) => string);
5
6export interface RollupReplaceOptions {
7 /**
8 * All other options are treated as `string: replacement` replacers,
9 * or `string: (id) => replacement` functions.
10 */
11 [str: string]:
12 | Replacement
13 | RollupReplaceOptions['include']
14 | RollupReplaceOptions['values']
15 | RollupReplaceOptions['preventAssignment'];
16
17 /**
18 * A minimatch pattern, or array of patterns, of files that should be
19 * processed by this plugin (if omitted, all files are included by default)
20 */
21 include?: FilterPattern;
22 /**
23 * Files that should be excluded, if `include` is otherwise too permissive.
24 */
25 exclude?: FilterPattern;
26 /**
27 * If false, skips source map generation. This will improve performance.
28 * @default true
29 */
30 sourceMap?: boolean;
31 /**
32 * To replace every occurrence of `<@foo@>` instead of every occurrence
33 * of `foo`, supply delimiters
34 */
35 delimiters?: [string, string];
36 /**
37 * Prevents replacing strings where they are followed by a single equals
38 * sign.
39 */
40 preventAssignment?: boolean;
41 /**
42 * You can separate values to replace from other options.
43 */
44 values?: { [str: string]: Replacement };
45}
46
47/**
48 * Replace strings in files while bundling them.
49 */
50export default function replace(options?: RollupReplaceOptions): Plugin;
51
\No newline at end of file