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