vite-plugin-dts 1.7.0 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Plugin } from 'vite';
1
+ import * as vite from 'vite';
2
2
  import { ts, Diagnostic } from 'ts-morph';
3
3
 
4
4
  interface TransformWriteFile {
@@ -6,28 +6,169 @@ interface TransformWriteFile {
6
6
  content?: string;
7
7
  }
8
8
  interface PluginOptions {
9
- include?: string | string[];
10
- exclude?: string | string[];
9
+ /**
10
+ * Depends on the root directory
11
+ *
12
+ * Defaults base on your vite config root options
13
+ */
11
14
  root?: string;
15
+ /**
16
+ * Declaration files output directory
17
+ *
18
+ * Can be specified a array to output to multiple directories
19
+ *
20
+ * Defaults base on your vite config output options
21
+ */
12
22
  outputDir?: string | string[];
23
+ /**
24
+ * Manually set the root path of the entry files
25
+ *
26
+ * The output path of each file will be calculated base on it
27
+ *
28
+ * Defaults is the smallest public path for all files
29
+ */
13
30
  entryRoot?: string;
31
+ /**
32
+ * Project init compilerOptions using by ts-morph
33
+ *
34
+ * @default null
35
+ */
14
36
  compilerOptions?: ts.CompilerOptions | null;
37
+ /**
38
+ * Project init tsconfig.json file path by ts-morph
39
+ *
40
+ * Plugin also resolve include and exclude files from tsconfig.json
41
+ *
42
+ * @default 'tsconfig.json'
43
+ */
15
44
  tsConfigFilePath?: string;
45
+ /**
46
+ * Set which paths should exclude when transform aliases
47
+ *
48
+ * If it's regexp, it will test the original import path directly
49
+ *
50
+ * @default []
51
+ */
16
52
  aliasesExclude?: (string | RegExp)[];
53
+ /**
54
+ * Whether transform file name '.vue.d.ts' to '.d.ts'
55
+ *
56
+ * @default false
57
+ */
17
58
  cleanVueFileName?: boolean;
59
+ /**
60
+ * Whether transform dynamic import to static
61
+ *
62
+ * Force true when `rollupTypes` is effective
63
+ *
64
+ * eg. 'import('vue').DefineComponent' to 'import { DefineComponent } from "vue"'
65
+ *
66
+ * @default false
67
+ */
18
68
  staticImport?: boolean;
69
+ /**
70
+ * Manual set include glob
71
+ *
72
+ * Defaults base on your tsconfig.json include option
73
+ */
74
+ include?: string | string[];
75
+ /**
76
+ * Manual set exclude glob
77
+ *
78
+ * Defaults base on your tsconfig.json exclude option, be 'node_module/**' when empty
79
+ */
80
+ exclude?: string | string[];
81
+ /**
82
+ * Do not emit if content of file only includes 'export {}'
83
+ *
84
+ * @default true
85
+ */
19
86
  clearPureImport?: boolean;
87
+ /**
88
+ * Whether generate types entry file
89
+ *
90
+ * When true will from package.json types field if exists or `${outputDir}/index.d.ts`
91
+ *
92
+ * Force true when `rollupTypes` is effective
93
+ *
94
+ * @default false
95
+ */
20
96
  insertTypesEntry?: boolean;
97
+ /**
98
+ * Set to rollup declaration files after emit
99
+ *
100
+ * Power by `@microsoft/api-extractor`, it will start a new program which takes some time
101
+ *
102
+ * @default false
103
+ */
21
104
  rollupTypes?: boolean;
105
+ /**
106
+ * Whether copy .d.ts source files into outputDir
107
+ *
108
+ * @default true
109
+ */
22
110
  copyDtsFiles?: boolean;
111
+ /**
112
+ * Whether emit nothing when has any diagnostic
113
+ *
114
+ * @default false
115
+ */
23
116
  noEmitOnError?: boolean;
117
+ /**
118
+ * Whether skip typescript diagnostics
119
+ *
120
+ * Skip type diagnostics means that type errors will not interrupt the build process
121
+ *
122
+ * But for the source files with type errors will not be emitted
123
+ *
124
+ * @default false
125
+ */
24
126
  skipDiagnostics?: boolean;
127
+ /**
128
+ * Whether log diagnostic informations
129
+ *
130
+ * Not effective when `skipDiagnostics` is true
131
+ *
132
+ * @deprecated
133
+ * @default false
134
+ */
25
135
  logDiagnostics?: boolean;
136
+ /**
137
+ * Customize typescript lib folder path
138
+ *
139
+ * Should pass a relative path to root or a absolute path
140
+ *
141
+ * @default undefined
142
+ */
26
143
  libFolderPath?: string;
144
+ /**
145
+ * After emit diagnostic hook
146
+ *
147
+ * According to the length to judge whether there is any type error
148
+ *
149
+ * @default () => {}
150
+ */
27
151
  afterDiagnostic?: (diagnostics: Diagnostic[]) => void | Promise<void>;
152
+ /**
153
+ * Before declaration file be writed hook
154
+ *
155
+ * You can transform declaration file-path and content through it
156
+ *
157
+ * The file will be skipped when return exact false
158
+ *
159
+ * @default () => {}
160
+ */
28
161
  beforeWriteFile?: (filePath: string, content: string) => void | false | TransformWriteFile;
162
+ /**
163
+ * After build hook
164
+ *
165
+ * It wil be called after all declaration files are written
166
+ *
167
+ * @default () => {}
168
+ */
29
169
  afterBuild?: () => void | Promise<void>;
30
- }
31
- declare function dtsPlugin(options?: PluginOptions): Plugin;
170
+ }
171
+
172
+ declare function dtsPlugin(options?: PluginOptions): vite.Plugin;
32
173
 
33
- export { dtsPlugin as default };
174
+ export { PluginOptions, dtsPlugin as default };