Skip to content

Commit 113b818

Browse files
committed
wip: support warning in codegen logger
1 parent 89f11a5 commit 113b818

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

packages/codegen/src/logger/logger.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ describe('createLogger', () => {
2626
start: { line: 1, column: 2 },
2727
length: 3,
2828
},
29+
{ text: 'text4', category: 'warning' },
2930
];
3031
logger.logDiagnostics(diagnostics);
3132
expect(stripVTControlCharacters(stderrWriteSpy.mock.lastCall![0] as string)).toMatchInlineSnapshot(`
@@ -35,6 +36,8 @@ describe('createLogger', () => {
3536
3637
a.module.css(1,2): error: text3
3738
39+
warning: text4
40+
3841
"
3942
`);
4043
});

packages/core/src/diagnostic.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ function convertErrorCategory(category: DiagnosticCategory): ts.DiagnosticCatego
1111
switch (category) {
1212
case 'error':
1313
return ts.DiagnosticCategory.Error;
14+
case 'warning':
15+
return ts.DiagnosticCategory.Warning;
1416
default:
1517
throw new Error(`Unknown category: ${String(category)}`);
1618
}

packages/core/src/type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export interface ExportBuilder {
151151
clearCache(): void;
152152
}
153153

154-
export type DiagnosticCategory = 'error';
154+
export type DiagnosticCategory = 'error' | 'warning';
155155

156156
export interface DiagnosticSourceFile {
157157
fileName: string;

0 commit comments

Comments
 (0)