| OLD | NEW | 
|---|
| 1 // Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library dev_compiler.src.codegen.html_codegen; | 5 library dev_compiler.src.codegen.html_codegen; | 
| 6 | 6 | 
| 7 import 'package:html/dom.dart'; | 7 import 'package:html/dom.dart'; | 
| 8 import 'package:html/parser.dart' show parseFragment; | 8 import 'package:html/parser.dart' show parseFragment; | 
| 9 import 'package:logging/logging.dart' show Logger; | 9 import 'package:logging/logging.dart' show Logger; | 
| 10 import 'package:path/path.dart' as path; | 10 import 'package:path/path.dart' as path; | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
| 33   } | 33   } | 
| 34   scripts.skip(1).forEach((s) { | 34   scripts.skip(1).forEach((s) { | 
| 35     // TODO(sigmund): allow more than one Dart script tags? | 35     // TODO(sigmund): allow more than one Dart script tags? | 
| 36     _log.warning(s.sourceSpan.message( | 36     _log.warning(s.sourceSpan.message( | 
| 37         'unexpected script. Only one Dart script tag allowed ' | 37         'unexpected script. Only one Dart script tag allowed ' | 
| 38         '(see https://github.com/dart-lang/dart-dev-compiler/issues/53).', | 38         '(see https://github.com/dart-lang/dart-dev-compiler/issues/53).', | 
| 39         color: options.useColors ? colorOf('warning') : false)); | 39         color: options.useColors ? colorOf('warning') : false)); | 
| 40     s.remove(); | 40     s.remove(); | 
| 41   }); | 41   }); | 
| 42 | 42 | 
| 43   if (options.outputDart) return '${document.outerHtml}\n'; |  | 
| 44 |  | 
| 45   var libraries = []; | 43   var libraries = []; | 
| 46   var resources = new Set(); | 44   var resources = new Set(); | 
| 47   visitInPostOrder(root, (n) { | 45   visitInPostOrder(root, (n) { | 
| 48     if (n is DartSourceNode) libraries.add(n); | 46     if (n is DartSourceNode) libraries.add(n); | 
| 49     if (n is ResourceSourceNode) resources.add(n); | 47     if (n is ResourceSourceNode) resources.add(n); | 
| 50   }, includeParts: false); | 48   }, includeParts: false); | 
| 51 | 49 | 
| 52   root.htmlResourceNodes.forEach((element, resource) { | 50   root.htmlResourceNodes.forEach((element, resource) { | 
| 53     // Make sure we don't try and add this node again. | 51     // Make sure we don't try and add this node again. | 
| 54     resources.remove(resource); | 52     resources.remove(resource); | 
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 112 | 110 | 
| 113 /// Convert the outputPath to include the hash in it. This function is the | 111 /// Convert the outputPath to include the hash in it. This function is the | 
| 114 /// reverse of what the server does to determine whether a request needs to have | 112 /// reverse of what the server does to determine whether a request needs to have | 
| 115 /// cache headers added to it. | 113 /// cache headers added to it. | 
| 116 _addHash(String outPath, String hash) { | 114 _addHash(String outPath, String hash) { | 
| 117   // (the ____ prefix makes it look better in the web inspector) | 115   // (the ____ prefix makes it look better in the web inspector) | 
| 118   return '$outPath?____cached=$hash'; | 116   return '$outPath?____cached=$hash'; | 
| 119 } | 117 } | 
| 120 | 118 | 
| 121 final _log = new Logger('dev_compiler.src.codegen.html_codegen'); | 119 final _log = new Logger('dev_compiler.src.codegen.html_codegen'); | 
| OLD | NEW | 
|---|