|
7 | 7 | ArrayTypeNode, |
8 | 8 | ArrowFunction, |
9 | 9 | AsExpression, |
10 | | - AssertClause, |
11 | | - AssertEntry, |
12 | 10 | AwaitExpression, |
13 | 11 | base64encode, |
14 | 12 | BigIntLiteral, |
@@ -191,6 +189,8 @@ import { |
191 | 189 | Identifier, |
192 | 190 | idText, |
193 | 191 | IfStatement, |
| 192 | + ImportAttribute, |
| 193 | + ImportAttributes, |
194 | 194 | ImportClause, |
195 | 195 | ImportDeclaration, |
196 | 196 | ImportEqualsDeclaration, |
@@ -2055,10 +2055,10 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri |
2055 | 2055 | return emitNamedExports(node as NamedExports); |
2056 | 2056 | case SyntaxKind.ExportSpecifier: |
2057 | 2057 | return emitExportSpecifier(node as ExportSpecifier); |
2058 | | - case SyntaxKind.AssertClause: |
2059 | | - return emitAssertClause(node as AssertClause); |
2060 | | - case SyntaxKind.AssertEntry: |
2061 | | - return emitAssertEntry(node as AssertEntry); |
| 2058 | + case SyntaxKind.ImportAttributes: |
| 2059 | + return emitImportAttributes(node as ImportAttributes); |
| 2060 | + case SyntaxKind.ImportAttribute: |
| 2061 | + return emitImportAttribute(node as ImportAttribute); |
2062 | 2062 | case SyntaxKind.MissingDeclaration: |
2063 | 2063 | return; |
2064 | 2064 |
|
@@ -2948,16 +2948,16 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri |
2948 | 2948 | writeKeyword("import"); |
2949 | 2949 | writePunctuation("("); |
2950 | 2950 | emit(node.argument); |
2951 | | - if (node.assertions) { |
| 2951 | + if (node.attributes) { |
2952 | 2952 | writePunctuation(","); |
2953 | 2953 | writeSpace(); |
2954 | 2954 | writePunctuation("{"); |
2955 | 2955 | writeSpace(); |
2956 | | - writeKeyword("assert"); |
| 2956 | + writeKeyword(node.attributes.token === SyntaxKind.AssertKeyword ? "assert" : "with"); |
2957 | 2957 | writePunctuation(":"); |
2958 | 2958 | writeSpace(); |
2959 | | - const elements = node.assertions.assertClause.elements; |
2960 | | - emitList(node.assertions.assertClause, elements, ListFormat.ImportClauseEntries); |
| 2959 | + const elements = node.attributes.elements; |
| 2960 | + emitList(node.attributes, elements, ListFormat.ImportAttributes); |
2961 | 2961 | writeSpace(); |
2962 | 2962 | writePunctuation("}"); |
2963 | 2963 | } |
@@ -4003,8 +4003,8 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri |
4003 | 4003 | writeSpace(); |
4004 | 4004 | } |
4005 | 4005 | emitExpression(node.moduleSpecifier); |
4006 | | - if (node.assertClause) { |
4007 | | - emitWithLeadingSpace(node.assertClause); |
| 4006 | + if (node.attributes) { |
| 4007 | + emitWithLeadingSpace(node.attributes); |
4008 | 4008 | } |
4009 | 4009 | writeTrailingSemicolon(); |
4010 | 4010 | } |
@@ -4078,20 +4078,20 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri |
4078 | 4078 | writeSpace(); |
4079 | 4079 | emitExpression(node.moduleSpecifier); |
4080 | 4080 | } |
4081 | | - if (node.assertClause) { |
4082 | | - emitWithLeadingSpace(node.assertClause); |
| 4081 | + if (node.attributes) { |
| 4082 | + emitWithLeadingSpace(node.attributes); |
4083 | 4083 | } |
4084 | 4084 | writeTrailingSemicolon(); |
4085 | 4085 | } |
4086 | 4086 |
|
4087 | | - function emitAssertClause(node: AssertClause) { |
4088 | | - emitTokenWithComment(SyntaxKind.AssertKeyword, node.pos, writeKeyword, node); |
| 4087 | + function emitImportAttributes(node: ImportAttributes) { |
| 4088 | + emitTokenWithComment(node.token, node.pos, writeKeyword, node); |
4089 | 4089 | writeSpace(); |
4090 | 4090 | const elements = node.elements; |
4091 | | - emitList(node, elements, ListFormat.ImportClauseEntries); |
| 4091 | + emitList(node, elements, ListFormat.ImportAttributes); |
4092 | 4092 | } |
4093 | 4093 |
|
4094 | | - function emitAssertEntry(node: AssertEntry) { |
| 4094 | + function emitImportAttribute(node: ImportAttribute) { |
4095 | 4095 | emit(node.name); |
4096 | 4096 | writePunctuation(":"); |
4097 | 4097 | writeSpace(); |
|
0 commit comments