| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /// Transfomer that combines multiple dart script tags into a single one. | 5 /// Transfomer that combines multiple dart script tags into a single one. |
| 6 library polymer.src.build.script_compactor; | 6 library polymer.src.build.script_compactor; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 | 10 |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 | 445 |
| 446 // Include smoke initialization. | 446 // Include smoke initialization. |
| 447 generator.writeImports(code); | 447 generator.writeImports(code); |
| 448 generator.writeTopLevelDeclarations(code); | 448 generator.writeTopLevelDeclarations(code); |
| 449 code.writeln('\nvoid main() {'); | 449 code.writeln('\nvoid main() {'); |
| 450 code.write(' useGeneratedCode('); | 450 code.write(' useGeneratedCode('); |
| 451 generator.writeStaticConfiguration(code); | 451 generator.writeStaticConfiguration(code); |
| 452 code.writeln(');'); | 452 code.writeln(');'); |
| 453 | 453 |
| 454 if (options.injectBuildLogsInOutput) { | 454 if (options.injectBuildLogsInOutput) { |
| 455 code.writeln(' new LogInjector().injectLogsFromUrl();'); | 455 var buildUrl = "${path.basename(docId.path)}$LOG_EXTENSION"; |
| 456 code.writeln(" new LogInjector().injectLogsFromUrl('$buildUrl');"); |
| 456 } | 457 } |
| 457 | 458 |
| 458 if (experimentalBootstrap) { | 459 if (experimentalBootstrap) { |
| 459 code.write(' startPolymer(['); | 460 code.write(' startPolymer(['); |
| 460 } else { | 461 } else { |
| 461 code.write(' configureForDeployment(['); | 462 code.write(' configureForDeployment(['); |
| 462 } | 463 } |
| 463 | 464 |
| 464 // Include initializers to switch from mirrors_loader to static_loader. | 465 // Include initializers to switch from mirrors_loader to static_loader. |
| 465 if (!initializers.isEmpty) { | 466 if (!initializers.isEmpty) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 484 | 485 |
| 485 // Emit the bootstrap .dart file | 486 // Emit the bootstrap .dart file |
| 486 var srcUrl = path.url.basename(bootstrapId.path); | 487 var srcUrl = path.url.basename(bootstrapId.path); |
| 487 document.body.nodes.add(parseFragment( | 488 document.body.nodes.add(parseFragment( |
| 488 '<script type="application/dart" src="$srcUrl"></script>')); | 489 '<script type="application/dart" src="$srcUrl"></script>')); |
| 489 | 490 |
| 490 // Add the styles for the logger widget. | 491 // Add the styles for the logger widget. |
| 491 if (options.injectBuildLogsInOutput) { | 492 if (options.injectBuildLogsInOutput) { |
| 492 document.head.append(parseFragment( | 493 document.head.append(parseFragment( |
| 493 '<link rel="stylesheet" type="text/css"' | 494 '<link rel="stylesheet" type="text/css"' |
| 494 'href="packages/polymer/src/build/log_injector.css">')); | 495 ' href="packages/polymer/src/build/log_injector.css">')); |
| 495 } | 496 } |
| 496 | 497 |
| 497 transform.addOutput(new Asset.fromString(docId, document.outerHtml)); | 498 transform.addOutput(new Asset.fromString(docId, document.outerHtml)); |
| 498 } | 499 } |
| 499 | 500 |
| 500 _spanForNode(analyzer.Element context, AstNode node) { | 501 _spanForNode(analyzer.Element context, AstNode node) { |
| 501 var file = resolver.getSourceFile(context); | 502 var file = resolver.getSourceFile(context); |
| 502 return file.span(node.offset, node.end); | 503 return file.span(node.offset, node.end); |
| 503 } | 504 } |
| 504 } | 505 } |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 for (var c in combinators) { | 851 for (var c in combinators) { |
| 851 if (c is ShowElementCombinator) { | 852 if (c is ShowElementCombinator) { |
| 852 var show = c.shownNames.toSet(); | 853 var show = c.shownNames.toSet(); |
| 853 elements.retainWhere((e) => show.contains(e.displayName)); | 854 elements.retainWhere((e) => show.contains(e.displayName)); |
| 854 } else if (c is HideElementCombinator) { | 855 } else if (c is HideElementCombinator) { |
| 855 var hide = c.hiddenNames.toSet(); | 856 var hide = c.hiddenNames.toSet(); |
| 856 elements.removeWhere((e) => hide.contains(e.displayName)); | 857 elements.removeWhere((e) => hide.contains(e.displayName)); |
| 857 } | 858 } |
| 858 } | 859 } |
| 859 } | 860 } |
| OLD | NEW |