|
6 | 6 | - [annotate](#annotate)
|
7 | 7 | - [compile](#compile)
|
8 | 8 | - [format](#format)
|
9 |
| -- [TypeAlias](#typealias) |
| 9 | +- [Interface](#interface) |
10 | 10 | - [AnnotateOptions](#annotateoptions)
|
| 11 | + - [CompileOptions](#compileoptions) |
11 | 12 | - [FormatOptions](#formatoptions)
|
| 13 | + - [SFCParseError](#sfcparseerror) |
12 | 14 | - [Enum](#enum)
|
13 | 15 | - [AnnotateWarningCodes](#annotatewarningcodes)
|
14 | 16 | - [CompileErrorCodes](#compileerrorcodes)
|
15 |
| -- [Interface](#interface) |
16 |
| - - [CompileOptions](#compileoptions) |
17 |
| - - [SFCParseError](#sfcparseerror) |
18 | 17 | - [Variable](#variable)
|
19 | 18 | - [DEFAULT_PRETTIER_OPTIONS](#default_prettier_options)
|
20 | 19 | - [Class](#class)
|
@@ -95,81 +94,74 @@ declare function format(source: string, filepath: string, options?: FormatOption
|
95 | 94 | Currently, only i18n custom blocks supporting
|
96 | 95 |
|
97 | 96 |
|
98 |
| -## TypeAlias |
| 97 | +## Interface |
99 | 98 |
|
100 | 99 | ### AnnotateOptions
|
101 | 100 |
|
102 | 101 | Annotate options of [annotate](#annotate) function
|
103 | 102 |
|
104 | 103 | **Signature:**
|
105 | 104 | ```typescript
|
106 |
| -declare type AnnotateOptions = { |
107 |
| - type?: string; |
108 |
| - force?: boolean; |
109 |
| - attrs?: Record<string, any>; |
110 |
| - onWarn?: (code: number, args: Record<string, any>, block: SFCBlock) => void; |
111 |
| -}; |
| 105 | +interface AnnotateOptions |
112 | 106 | ```
|
113 | 107 |
|
114 |
| -### FormatOptions |
115 | 108 |
|
116 |
| -Format options of [format](#format) function |
| 109 | +#### Properties |
| 110 | + |
| 111 | +##### attrs |
| 112 | + |
| 113 | +The Attributes to be annotated on the block tag |
117 | 114 |
|
118 | 115 | **Signature:**
|
119 | 116 | ```typescript
|
120 |
| -declare type FormatOptions = { |
121 |
| - prettier?: Options; |
122 |
| -}; |
| 117 | +attrs?: Record<string, any>; |
123 | 118 | ```
|
124 | 119 |
|
| 120 | +#### Remarks |
125 | 121 |
|
126 |
| -## Enum |
| 122 | +default as `{}` |
127 | 123 |
|
128 |
| -### AnnotateWarningCodes |
| 124 | +##### force |
129 | 125 |
|
130 |
| -Annotate Warning Codes |
| 126 | +Whether to force annotations |
131 | 127 |
|
132 | 128 | **Signature:**
|
133 | 129 | ```typescript
|
134 |
| -declare const enum AnnotateWarningCodes |
| 130 | +force?: boolean; |
135 | 131 | ```
|
136 | 132 |
|
137 |
| -#### Members |
138 |
| - |
139 |
| -| Member | Value| Description | |
140 |
| -| --- | --- | --- | |
141 |
| -| LANG_MISMATCH_IN_ATTR_AND_CONTENT | 4 | Lang mismatch `lang` and block content | |
142 |
| -| LANG_MISMATCH_IN_OPTION_AND_CONTENT | 3 | Lang mismatch option and block content | |
143 |
| -| LANG_MISMATCH_IN_SRC_AND_CONTENT | 2 | Lang mismatch block `src` and block content | |
144 |
| -| NOT_SUPPORTED_TYPE | 1 | Not supported type | |
145 |
| - |
146 | 133 | #### Remarks
|
147 | 134 |
|
148 |
| -The warning codes of [annotate](#annotate) function |
| 135 | +Force annotation of the attribute values of `attrs` option to the block tag. Even if the actual `lang` of the block content in the `lang` attribute is different, it will be enforced if this flag is turned on. default as `false` |
149 | 136 |
|
150 |
| -### CompileErrorCodes |
| 137 | +##### onWarn |
151 | 138 |
|
152 |
| -Compile Error Codes |
| 139 | +The warning handler |
153 | 140 |
|
154 | 141 | **Signature:**
|
155 | 142 | ```typescript
|
156 |
| -declare const enum CompileErrorCodes |
| 143 | +onWarn?: (code: number, args: Record<string, any>, block: SFCBlock) => void; |
157 | 144 | ```
|
158 | 145 |
|
159 |
| -#### Members |
| 146 | +#### Remarks |
160 | 147 |
|
161 |
| -| Member | Value| Description | |
162 |
| -| --- | --- | --- | |
163 |
| -| INTERNAL_COMPILE_ERROR | 3 | Internal compile error | |
164 |
| -| INTERNAL_COMPILE_WARNING | 2 | Internal compile warning | |
165 |
| -| NOT_SUPPORTED_FORMAT | 1 | Not supported format | |
| 148 | +Notify warnings generated by the annotate process |
| 149 | + |
| 150 | +##### type |
| 151 | + |
| 152 | +The type of the block |
| 153 | + |
| 154 | +**Signature:** |
| 155 | +```typescript |
| 156 | +type?: string; |
| 157 | +``` |
166 | 158 |
|
167 | 159 | #### Remarks
|
168 | 160 |
|
169 |
| -The error codes of [compile](#compile) function |
| 161 | +Only `i18n` type is supported, if you don't specify it. If any other type is specified, the function will raise the [SFCAnnotateError](#sfcannotateerror). |
170 | 162 |
|
| 163 | +default as `i18n` |
171 | 164 |
|
172 |
| -## Interface |
173 | 165 |
|
174 | 166 | ### CompileOptions
|
175 | 167 |
|
@@ -219,6 +211,32 @@ onError?: (code: number, source: string, output: string, msg?: string) => void;
|
219 | 211 | ```
|
220 | 212 |
|
221 | 213 |
|
| 214 | +### FormatOptions |
| 215 | + |
| 216 | +Format options of [format](#format) function |
| 217 | + |
| 218 | +**Signature:** |
| 219 | +```typescript |
| 220 | +interface FormatOptions |
| 221 | +``` |
| 222 | + |
| 223 | + |
| 224 | +#### Properties |
| 225 | + |
| 226 | +##### prettier |
| 227 | + |
| 228 | +The prettier options |
| 229 | + |
| 230 | +**Signature:** |
| 231 | +```typescript |
| 232 | +prettier?: Options; |
| 233 | +``` |
| 234 | + |
| 235 | +#### Remarks |
| 236 | + |
| 237 | +The options for formatting the content of `i18n` custom blocks with prettier default as [DEFAULT_PRETTIER_OPTIONS](#default_prettier_options) |
| 238 | + |
| 239 | + |
222 | 240 | ### SFCParseError
|
223 | 241 |
|
224 | 242 | Vue SFC compiler error
|
@@ -255,6 +273,52 @@ filepath: string;
|
255 | 273 |
|
256 | 274 |
|
257 | 275 |
|
| 276 | +## Enum |
| 277 | +
|
| 278 | +### AnnotateWarningCodes |
| 279 | +
|
| 280 | +Annotate Warning Codes |
| 281 | +
|
| 282 | +**Signature:** |
| 283 | +```typescript |
| 284 | +declare const enum AnnotateWarningCodes |
| 285 | +``` |
| 286 | +
|
| 287 | +#### Members |
| 288 | +
|
| 289 | +| Member | Value| Description | |
| 290 | +| --- | --- | --- | |
| 291 | +| LANG_MISMATCH_IN_ATTR_AND_CONTENT | 4 | Lang mismatch `lang` and block content | |
| 292 | +| LANG_MISMATCH_IN_OPTION_AND_CONTENT | 3 | Lang mismatch option and block content | |
| 293 | +| LANG_MISMATCH_IN_SRC_AND_CONTENT | 2 | Lang mismatch block `src` and block content | |
| 294 | +| NOT_SUPPORTED_TYPE | 1 | Not supported type | |
| 295 | +
|
| 296 | +#### Remarks |
| 297 | +
|
| 298 | +The warning codes of [annotate](#annotate) function |
| 299 | +
|
| 300 | +### CompileErrorCodes |
| 301 | +
|
| 302 | +Compile Error Codes |
| 303 | +
|
| 304 | +**Signature:** |
| 305 | +```typescript |
| 306 | +declare const enum CompileErrorCodes |
| 307 | +``` |
| 308 | +
|
| 309 | +#### Members |
| 310 | +
|
| 311 | +| Member | Value| Description | |
| 312 | +| --- | --- | --- | |
| 313 | +| INTERNAL_COMPILE_ERROR | 3 | Internal compile error | |
| 314 | +| INTERNAL_COMPILE_WARNING | 2 | Internal compile warning | |
| 315 | +| NOT_SUPPORTED_FORMAT | 1 | Not supported format | |
| 316 | +
|
| 317 | +#### Remarks |
| 318 | +
|
| 319 | +The error codes of [compile](#compile) function |
| 320 | +
|
| 321 | +
|
258 | 322 | ## Variable
|
259 | 323 |
|
260 | 324 | ### DEFAULT_PRETTIER_OPTIONS
|
|
0 commit comments