Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/@babel/generator/lib/generators/modules.js
rd565449 r0c6b92a 32 32 this.space(); 33 33 } 34 this.print(node.imported , node);34 this.print(node.imported); 35 35 if (node.local && node.local.name !== node.imported.name) { 36 36 this.space(); 37 37 this.word("as"); 38 38 this.space(); 39 this.print(node.local , node);39 this.print(node.local); 40 40 } 41 41 } 42 42 function ImportDefaultSpecifier(node) { 43 this.print(node.local , node);43 this.print(node.local); 44 44 } 45 45 function ExportDefaultSpecifier(node) { 46 this.print(node.exported , node);46 this.print(node.exported); 47 47 } 48 48 function ExportSpecifier(node) { … … 51 51 this.space(); 52 52 } 53 this.print(node.local , node);53 this.print(node.local); 54 54 if (node.exported && node.local.name !== node.exported.name) { 55 55 this.space(); 56 56 this.word("as"); 57 57 this.space(); 58 this.print(node.exported , node);58 this.print(node.exported); 59 59 } 60 60 } … … 64 64 this.word("as"); 65 65 this.space(); 66 this.print(node.exported , node);66 this.print(node.exported); 67 67 } 68 68 let warningShown = false; 69 function _printAttributes(node ) {69 function _printAttributes(node, hasPreviousBrace) { 70 70 const { 71 71 importAttributesKeyword … … 89 89 this.space(); 90 90 if (!useAssertKeyword && importAttributesKeyword !== "with") { 91 this.printList(attributes || assertions , node);91 this.printList(attributes || assertions); 92 92 return; 93 93 } 94 this.tokenChar(123); 95 this.space(); 96 this.printList(attributes || assertions, node); 97 this.space(); 98 this.tokenChar(125); 94 const occurrenceCount = hasPreviousBrace ? 1 : 0; 95 this.token("{", null, occurrenceCount); 96 this.space(); 97 this.printList(attributes || assertions, { 98 printTrailingSeparator: this.shouldPrintTrailingComma("}") 99 }); 100 this.space(); 101 this.token("}", null, occurrenceCount); 99 102 } 100 103 function ExportAllDeclaration(node) { … … 111 114 this.space(); 112 115 if ((_node$attributes = node.attributes) != null && _node$attributes.length || (_node$assertions = node.assertions) != null && _node$assertions.length) { 113 this.print(node.source, node,true);114 this.space(); 115 this._printAttributes(node );116 this.print(node.source, true); 117 this.space(); 118 this._printAttributes(node, false); 116 119 } else { 117 this.print(node.source , node);120 this.print(node.source); 118 121 } 119 122 this.semicolon(); … … 121 124 function maybePrintDecoratorsBeforeExport(printer, node) { 122 125 if (isClassDeclaration(node.declaration) && printer._shouldPrintDecoratorsBeforeExport(node)) { 123 printer.printJoin(node.declaration.decorators , node);126 printer.printJoin(node.declaration.decorators); 124 127 } 125 128 } … … 130 133 if (node.declaration) { 131 134 const declar = node.declaration; 132 this.print(declar , node);135 this.print(declar); 133 136 if (!isStatement(declar)) this.semicolon(); 134 137 } else { … … 143 146 if (isExportDefaultSpecifier(first) || isExportNamespaceSpecifier(first)) { 144 147 hasSpecial = true; 145 this.print(specifiers.shift() , node);148 this.print(specifiers.shift()); 146 149 if (specifiers.length) { 147 150 this.tokenChar(44); … … 152 155 } 153 156 } 157 let hasBrace = false; 154 158 if (specifiers.length || !specifiers.length && !hasSpecial) { 159 hasBrace = true; 155 160 this.tokenChar(123); 156 161 if (specifiers.length) { 157 162 this.space(); 158 this.printList(specifiers, node); 163 this.printList(specifiers, { 164 printTrailingSeparator: this.shouldPrintTrailingComma("}") 165 }); 159 166 this.space(); 160 167 } … … 167 174 this.space(); 168 175 if ((_node$attributes2 = node.attributes) != null && _node$attributes2.length || (_node$assertions2 = node.assertions) != null && _node$assertions2.length) { 169 this.print(node.source, node,true);170 this.space(); 171 this._printAttributes(node );176 this.print(node.source, true); 177 this.space(); 178 this._printAttributes(node, hasBrace); 172 179 } else { 173 this.print(node.source , node);180 this.print(node.source); 174 181 } 175 182 } … … 186 193 this.tokenContext |= _index.TokenContext.exportDefault; 187 194 const declar = node.declaration; 188 this.print(declar , node);195 this.print(declar); 189 196 if (!isStatement(declar)) this.semicolon(); 190 197 } … … 212 219 const first = specifiers[0]; 213 220 if (isImportDefaultSpecifier(first) || isImportNamespaceSpecifier(first)) { 214 this.print(specifiers.shift() , node);221 this.print(specifiers.shift()); 215 222 if (specifiers.length) { 216 223 this.tokenChar(44); … … 221 228 } 222 229 } 230 let hasBrace = false; 223 231 if (specifiers.length) { 232 hasBrace = true; 224 233 this.tokenChar(123); 225 234 this.space(); 226 this.printList(specifiers, node); 235 this.printList(specifiers, { 236 printTrailingSeparator: this.shouldPrintTrailingComma("}") 237 }); 227 238 this.space(); 228 239 this.tokenChar(125); 229 240 } else if (isTypeKind && !hasSpecifiers) { 241 hasBrace = true; 230 242 this.tokenChar(123); 231 243 this.tokenChar(125); … … 237 249 } 238 250 if ((_node$attributes3 = node.attributes) != null && _node$attributes3.length || (_node$assertions3 = node.assertions) != null && _node$assertions3.length) { 239 this.print(node.source, node,true);240 this.space(); 241 this._printAttributes(node );251 this.print(node.source, true); 252 this.space(); 253 this._printAttributes(node, hasBrace); 242 254 } else { 243 this.print(node.source , node);255 this.print(node.source); 244 256 } 245 257 this.semicolon(); … … 256 268 this.word("as"); 257 269 this.space(); 258 this.print(node.local , node);270 this.print(node.local); 259 271 } 260 272 function ImportExpression(node) { … … 265 277 } 266 278 this.tokenChar(40); 267 this.print(node.source , node);279 this.print(node.source); 268 280 if (node.options != null) { 269 281 this.tokenChar(44); 270 282 this.space(); 271 this.print(node.options , node);283 this.print(node.options); 272 284 } 273 285 this.tokenChar(41);
Note:
See TracChangeset
for help on using the changeset viewer.