| 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:html5lib/dom.dart'; | 7 import 'package:html5lib/dom.dart'; |
| 8 import 'package:html5lib/parser.dart' show parseFragment; | 8 import 'package:html5lib/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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 var libraries = []; | 45 var libraries = []; |
| 46 var resources = []; | 46 var resources = []; |
| 47 visitInPostOrder(root, (n) { | 47 visitInPostOrder(root, (n) { |
| 48 if (n is DartSourceNode) libraries.add(n); | 48 if (n is DartSourceNode) libraries.add(n); |
| 49 if (n is ResourceSourceNode) resources.add(n); | 49 if (n is ResourceSourceNode) resources.add(n); |
| 50 }, includeParts: false); | 50 }, includeParts: false); |
| 51 | 51 |
| 52 String mainLibraryName; | 52 String mainLibraryName; |
| 53 var fragment = new DocumentFragment(); | 53 var fragment = new DocumentFragment(); |
| 54 for (var resource in resources) { | 54 for (var resource in resources) { |
| 55 var resourcePath = resourceOutputPath(resource.uri); | 55 var resourcePath = resourceOutputPath(resource.uri, root.uri); |
| 56 if (resource.cachingHash != null) { | 56 if (resource.cachingHash != null) { |
| 57 resourcePath = _addHash(resourcePath, resource.cachingHash); | 57 resourcePath = _addHash(resourcePath, resource.cachingHash); |
| 58 } | 58 } |
| 59 if (path.extension(resourcePath) == '.css') { | 59 if (path.extension(resourcePath) == '.css') { |
| 60 fragment.nodes.add(_cssInclude(resourcePath)); | 60 fragment.nodes.add(_cssInclude(resourcePath)); |
| 61 } else { | 61 } else { |
| 62 fragment.nodes.add(_libraryInclude(resourcePath)); | 62 fragment.nodes.add(_libraryInclude(resourcePath)); |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 if (!options.checkSdk) fragment.nodes.add(_miniMockSdk); | 65 if (!options.checkSdk) fragment.nodes.add(_miniMockSdk); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 /// A script tag with a tiny mock of the core SDK. This is just used for testing | 104 /// A script tag with a tiny mock of the core SDK. This is just used for testing |
| 105 /// some small samples. | 105 /// some small samples. |
| 106 // TODO(sigmund,jmesserly): remove. | 106 // TODO(sigmund,jmesserly): remove. |
| 107 Node get _miniMockSdk => parseFragment(''' | 107 Node get _miniMockSdk => parseFragment(''' |
| 108 <script> | 108 <script> |
| 109 /* placehorder for unimplemented code libraries */ | 109 /* placehorder for unimplemented code libraries */ |
| 110 var math = Math; | 110 var math = Math; |
| 111 var core = { int: { parse: Number }, print: e => console.log(e) }; | 111 var core = { int: { parse: Number }, print: e => console.log(e) }; |
| 112 </script>'''); | 112 </script>'''); |
| 113 final _log = new Logger('dev_compiler.src.codegen.html_codegen'); | 113 final _log = new Logger('dev_compiler.src.codegen.html_codegen'); |
| OLD | NEW |