-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtypes.ts
82 lines (74 loc) · 1.9 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import type { CompilerOptions } from 'typescript';
import type { FilterPattern, Plugin } from 'vite';
interface Options {
/**
* Apply the plugin only for serve or build, or on certain conditions.
*/
apply?: Plugin['apply'];
/**
* Enforce plugin invocation tier similar to webpack loaders.
*
* Plugin invocation order:
* - alias resolution
* - `enforce: 'pre'` plugins
* - vite core plugins (esbuild)
* - normal plugins
* - vite build plugins
* - `enforce: 'post'` plugins
* - vite build post plugins
*/
enforce?: Plugin['enforce'];
/**
* Filter when to transpile based on the file code or location.
* If not provided, all code and files will be transpiled.
*/
filter?: {
/**
* Determines which files should be transpiled based on their code.
* If not provided, allows any file code to be transpiled.
*
* @param code the raw code.
* @returns whether to transpile or not.
*/
code?: (code: string) => boolean;
/**
* Determines which files should be transpiled based on their location.
* If not provided, allows any file location be transpiled.
*/
files?: {
/**
* Files to transpile.
* If not provided, matches everything.
*
* Supports globbing.
*/
include?: FilterPattern;
/**
* Files to ignore.
* If not provided, doesn't ignore anything.
*
* Supports globbing.
*/
exclude?: FilterPattern;
};
};
/**
* TypeScript configuration.
*/
tsconfig?: {
/**
* The location of the tsconfig.json file.
* If not provided, the plugin will detect it automatically based on the file location.
*
* Must be absolute.
*/
location?: string;
/**
* Overrides the compiler options found in the tsconfig.json file.
*/
override?: CompilerOptions;
};
}
export type {
Options,
};