Skip to content

Commit 7699aa5

Browse files
committed
feat: add jsdoc to options type
1 parent 1471e64 commit 7699aa5

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

src/types.ts

+60
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,77 @@ import type { CompilerOptions } from 'typescript';
22
import type { FilterPattern, Plugin } from 'vite';
33

44
interface Options {
5+
/**
6+
* Apply the plugin only for serve or build, or on certain conditions.
7+
*/
58
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+
*/
622
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+
*/
728
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+
*/
836
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+
*/
942
files?: {
43+
/**
44+
* Files to transpile.
45+
* If not provided, matches everything.
46+
*
47+
* Supports globbing.
48+
*/
1049
include?: FilterPattern;
50+
51+
/**
52+
* Files to ignore.
53+
* If not provided, doesn't ignore anything.
54+
*
55+
* Supports globbing.
56+
*/
1157
exclude?: FilterPattern;
1258
};
1359
};
60+
61+
/**
62+
* TypeScript configuration.
63+
*/
1464
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+
*/
1571
location?: string;
72+
73+
/**
74+
* Overrides the compiler options found in the tsconfig.json file.
75+
*/
1676
override?: CompilerOptions;
1777
};
1878
}

0 commit comments

Comments
 (0)