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 | 10 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 /// | 244 /// |
245 /// This transformer assumes that all script tags point to external files. To | 245 /// This transformer assumes that all script tags point to external files. To |
246 /// support script tags with inlined code, use this transformer after running | 246 /// support script tags with inlined code, use this transformer after running |
247 /// [InlineCodeExtractor] on an earlier phase. | 247 /// [InlineCodeExtractor] on an earlier phase. |
248 class ImportInliner extends Transformer { | 248 class ImportInliner extends Transformer { |
249 final TransformOptions options; | 249 final TransformOptions options; |
250 | 250 |
251 ImportInliner(this.options); | 251 ImportInliner(this.options); |
252 | 252 |
253 /// Only run on entry point .html files. | 253 /// Only run on entry point .html files. |
254 Future<bool> isPrimary(Asset input) => | 254 Future<bool> isPrimary(AssetId id) => |
255 new Future.value(options.isHtmlEntryPoint(input.id)); | 255 new Future.value(options.isHtmlEntryPoint(id)); |
256 | 256 |
257 Future apply(Transform transform) => | 257 Future apply(Transform transform) => |
258 new _HtmlInliner(options, transform).apply(); | 258 new _HtmlInliner(options, transform).apply(); |
259 } | 259 } |
260 | 260 |
261 const TYPE_DART = 'application/dart'; | 261 const TYPE_DART = 'application/dart'; |
262 const TYPE_JS = 'text/javascript'; | 262 const TYPE_JS = 'text/javascript'; |
263 | 263 |
264 /// Internally adjusts urls in the html that we are about to inline. | 264 /// Internally adjusts urls in the html that we are about to inline. |
265 class _UrlNormalizer extends TreeVisitor { | 265 class _UrlNormalizer extends TreeVisitor { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 'formaction', // in button, input | 384 'formaction', // in button, input |
385 'href', // in a, area, link, base, command | 385 'href', // in a, area, link, base, command |
386 'icon', // in command | 386 'icon', // in command |
387 'manifest', // in html | 387 'manifest', // in html |
388 'poster', // in video | 388 'poster', // in video |
389 'src', // in audio, embed, iframe, img, input, script, source, track, | 389 'src', // in audio, embed, iframe, img, input, script, source, track, |
390 // video | 390 // video |
391 ]; | 391 ]; |
392 | 392 |
393 _getSpan(SourceFile file, AstNode node) => file.span(node.offset, node.end); | 393 _getSpan(SourceFile file, AstNode node) => file.span(node.offset, node.end); |
OLD | NEW |