| 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 inlines polymer-element definitions from html imports. | 5 /// Transfomer that inlines polymer-element definitions from html imports. |
| 6 library polymer.src.build.import_inliner; | 6 library polymer.src.build.import_inliner; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'dart:collection' show LinkedHashSet; | 10 import 'dart:collection' show LinkedHashSet; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 inlinedStylesheetIds.add(id); | 146 inlinedStylesheetIds.add(id); |
| 147 return _inlineStylesheet(id, tag); | 147 return _inlineStylesheet(id, tag); |
| 148 } | 148 } |
| 149 }).then((_) => changed); | 149 }).then((_) => changed); |
| 150 } | 150 } |
| 151 | 151 |
| 152 /// To preserve the order of scripts with respect to inlined | 152 /// To preserve the order of scripts with respect to inlined |
| 153 /// link rel=import, we move both of those into the body before we do any | 153 /// link rel=import, we move both of those into the body before we do any |
| 154 /// inlining. We do not start doing this until the first import is found | 154 /// inlining. We do not start doing this until the first import is found |
| 155 /// however, as some scripts do need to be ran in the head to work | 155 /// however, as some scripts do need to be ran in the head to work |
| 156 /// properly (platform.js for instance). | 156 /// properly (webcomponents.js for instance). |
| 157 /// | 157 /// |
| 158 /// Note: we do this for stylesheets as well to preserve ordering with | 158 /// Note: we do this for stylesheets as well to preserve ordering with |
| 159 /// respect to eachother, because stylesheets can be pulled in transitively | 159 /// respect to eachother, because stylesheets can be pulled in transitively |
| 160 /// from imports. | 160 /// from imports. |
| 161 // TODO(jmesserly): vulcanizer doesn't need this because they inline JS | 161 // TODO(jmesserly): vulcanizer doesn't need this because they inline JS |
| 162 // scripts, causing them to be naturally moved as part of the inlining. | 162 // scripts, causing them to be naturally moved as part of the inlining. |
| 163 // Should we do the same? Alternatively could we inline head into head and | 163 // Should we do the same? Alternatively could we inline head into head and |
| 164 // body into body and avoid this whole thing? | 164 // body into body and avoid this whole thing? |
| 165 void _moveHeadToBody(Document doc) { | 165 void _moveHeadToBody(Document doc) { |
| 166 var foundImport = false; | 166 var foundImport = false; |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 /// style tag except these ones. | 560 /// style tag except these ones. |
| 561 const IGNORED_LINKED_STYLE_ATTRS = | 561 const IGNORED_LINKED_STYLE_ATTRS = |
| 562 const ['charset', 'href', 'href-lang', 'rel', 'rev']; | 562 const ['charset', 'href', 'href-lang', 'rel', 'rev']; |
| 563 | 563 |
| 564 /// Global RegExp objects. | 564 /// Global RegExp objects. |
| 565 final _INVALID_LIB_CHARS_REGEX = new RegExp('[^a-z0-9_]'); | 565 final _INVALID_LIB_CHARS_REGEX = new RegExp('[^a-z0-9_]'); |
| 566 final _NUM_REGEX = new RegExp('[0-9]'); | 566 final _NUM_REGEX = new RegExp('[0-9]'); |
| 567 final _BINDING_REGEX = new RegExp(r'(({{.*}})|(\[\[.*\]\]))'); | 567 final _BINDING_REGEX = new RegExp(r'(({{.*}})|(\[\[.*\]\]))'); |
| 568 | 568 |
| 569 _getSpan(SourceFile file, AstNode node) => file.span(node.offset, node.end); | 569 _getSpan(SourceFile file, AstNode node) => file.span(node.offset, node.end); |
| OLD | NEW |