File tree Expand file tree Collapse file tree 7 files changed +61
-16
lines changed Expand file tree Collapse file tree 7 files changed +61
-16
lines changed Original file line number Diff line number Diff line change @@ -1815,7 +1815,6 @@ type DevToolPosition = "inline-" | "hidden-" | "eval-" | "";
1815
1815
1816
1816
// @public (undocumented)
1817
1817
interface Diagnostic {
1818
- // (undocumented)
1819
1818
file?: string;
1820
1819
// (undocumented)
1821
1820
help?: string;
Original file line number Diff line number Diff line change @@ -112,10 +112,13 @@ export interface Diagnostic {
112
112
sourceCode ?: string ;
113
113
/**
114
114
* Location to the source code.
115
- *
116
115
* If `sourceCode` is not provided, location will be omitted.
117
116
*/
118
117
location ?: DiagnosticLocation ;
118
+ /**
119
+ * Optional filename to show.
120
+ * If provided, it becomes the `StatsError.file` value in stats.
121
+ */
119
122
file ?: string ;
120
123
severity : "error" | "warning" ;
121
124
}
Original file line number Diff line number Diff line change @@ -185,8 +185,25 @@ export type KnownStatsError = {
185
185
chunkName ?: string ;
186
186
chunkEntry ?: boolean ;
187
187
chunkInitial ?: boolean ;
188
+ /**
189
+ * A custom filename associated with this error/warning.
190
+ */
188
191
file ?: string ;
192
+ /**
193
+ * The identifier of the module related to this error/warning.
194
+ * Usually an absolute path, may include inline loader requests.
195
+ * @example
196
+ * - `/path/to/project/src/index.js`
197
+ * - `!builtin:react-refresh-loader!/path/to/project/src/index.css`
198
+ */
189
199
moduleIdentifier ?: string ;
200
+ /**
201
+ * The readable name of the module related to this error/warning.
202
+ * Usually a relative path, no inline loader requests.
203
+ * @example
204
+ * - `"./src/index.js"`
205
+ * - `"./src/index.css"`
206
+ */
190
207
moduleName ?: string ;
191
208
loc ?: string ;
192
209
chunkId ?: string | number ;
Original file line number Diff line number Diff line change @@ -315,16 +315,27 @@ Each error or warning object represents an error/warning thrown during the build
315
315
type StatsError = {
316
316
// Visual message of the error/warning
317
317
message: string ;
318
- // Related source file
318
+ // A custom filename associated with this error/warning.
319
319
file? : string ;
320
320
// Detail info of the error/warning
321
321
details? : string ;
322
322
// Stack info of the error/warning
323
323
stack? : string ;
324
-
325
- // Unique identifier of the module where the error/warning occurs
324
+ /**
325
+ * The identifier of the module related to this error/warning.
326
+ * Usually an absolute path, may include inline loader requests.
327
+ * @example
328
+ * - `/path/to/project/src/index.js`
329
+ * - `!builtin:react-refresh-loader!/path/to/project/src/index.css`
330
+ */
326
331
moduleIdentifier? : string ;
327
- // Relative path of the module where the error/warning occurs
332
+ /**
333
+ * The readable name of the module related to this error/warning.
334
+ * Usually a relative path, no inline loader requests.
335
+ * @example
336
+ * - `"./src/index.js"`
337
+ * - `"./src/index.css"`
338
+ */
328
339
moduleName? : string ;
329
340
// ID of the module where the error/warning occurs
330
341
moduleId? : string ;
Original file line number Diff line number Diff line change @@ -221,10 +221,13 @@ interface Diagnostic {
221
221
sourceCode? : string ;
222
222
/**
223
223
* Location to the source code.
224
- *
225
224
* If `sourceCode` is not provided, location will be omitted.
226
225
*/
227
226
location? : DiagnosticLocation ;
227
+ /**
228
+ * Optional filename to show.
229
+ * If provided, it becomes the `StatsError.file` value in stats.
230
+ */
228
231
file? : string ;
229
232
severity: ' error' | ' warning' ;
230
233
}
Original file line number Diff line number Diff line change @@ -317,18 +317,27 @@ type StatsChunkGroup = {
317
317
type StatsError = {
318
318
// 错误/警告的可视化提示信息
319
319
message: string ;
320
- // 相关资源文件
320
+ // 与此错误/警告关联的自定义文件名
321
321
file? : string ;
322
322
// 错误/警告的明细信息
323
323
details? : string ;
324
324
// 错误/警告的栈信息
325
325
stack? : string ;
326
-
327
- // 发生错误/警告的模块唯一标识
326
+ /**
327
+ * 与此错误/警告相关的模块标识符
328
+ * 通常是绝对路径,可能包含内联的 loader request
329
+ * @example
330
+ * - `/path/to/project/src/index.js`
331
+ * - `!builtin:react-refresh-loader!/path/to/project/src/index.css`
332
+ */
328
333
moduleIdentifier? : string ;
329
- // 发生错误/警告的模块相对路径
330
- moduleName? : string ;
331
- // 发生错误/警告的模块 ID
334
+ /**
335
+ * 与此错误/警告相关的模块可读名称
336
+ * 通常是相对路径,不包含内联的 loader request
337
+ * @example
338
+ * - `"./src/index.js"`
339
+ * - `"./src/index.css"`
340
+ */
332
341
moduleId? : string ;
333
342
// 错误/警告的模块引用路径
334
343
moduleTrace: Array <JsStatsModuleTrace >;
Original file line number Diff line number Diff line change @@ -211,11 +211,14 @@ interface Diagnostic {
211
211
help? : string ;
212
212
sourceCode? : string ;
213
213
/**
214
- * Location to the source code.
215
- *
216
- * If `sourceCode` is not provided, location will be omitted.
214
+ * 源代码的位置信息
215
+ * 如果未提供 `sourceCode`,则位置信息将被省略
217
216
*/
218
217
location? : DiagnosticLocation ;
218
+ /**
219
+ * 可选展示的文件名
220
+ * 如果设置,它将成为 stats 中的 `StatsError.file` 值
221
+ */
219
222
file? : string ;
220
223
severity: ' error' | ' warning' ;
221
224
}
You can’t perform that action at this time.
0 commit comments