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 24 matching lines...) Expand all Loading... |
35 bool experimentalBootstrap = false; | 35 bool experimentalBootstrap = false; |
36 | 36 |
37 /// The number of extracted inline Dart scripts. Used as a counter to give | 37 /// The number of extracted inline Dart scripts. Used as a counter to give |
38 /// unique-ish filenames. | 38 /// unique-ish filenames. |
39 int inlineScriptCounter = 0; | 39 int inlineScriptCounter = 0; |
40 | 40 |
41 _HtmlInliner(TransformOptions options, Transform transform) | 41 _HtmlInliner(TransformOptions options, Transform transform) |
42 : options = options, | 42 : options = options, |
43 transform = transform, | 43 transform = transform, |
44 logger = new BuildLogger(transform, | 44 logger = new BuildLogger(transform, |
45 convertErrorsToWarnings: !options.releaseMode), | 45 convertErrorsToWarnings: !options.releaseMode, |
| 46 detailsUri: 'http://goo.gl/5HPeuP'), |
46 docId = transform.primaryInput.id; | 47 docId = transform.primaryInput.id; |
47 | 48 |
48 Future apply() { | 49 Future apply() { |
49 seen.add(docId); | 50 seen.add(docId); |
50 | 51 |
51 Document document; | 52 Document document; |
52 bool changed = false; | 53 bool changed = false; |
53 | 54 |
54 return readPrimaryAsHtml(transform, logger).then((doc) { | 55 return readPrimaryAsHtml(transform, logger).then((doc) { |
55 document = doc; | 56 document = doc; |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 /// style tag except these ones. | 524 /// style tag except these ones. |
524 const IGNORED_LINKED_STYLE_ATTRS = | 525 const IGNORED_LINKED_STYLE_ATTRS = |
525 const ['charset', 'href', 'href-lang', 'rel', 'rev']; | 526 const ['charset', 'href', 'href-lang', 'rel', 'rev']; |
526 | 527 |
527 /// Global RegExp objects. | 528 /// Global RegExp objects. |
528 final _INVALID_LIB_CHARS_REGEX = new RegExp('[^a-z0-9_]'); | 529 final _INVALID_LIB_CHARS_REGEX = new RegExp('[^a-z0-9_]'); |
529 final _NUM_REGEX = new RegExp('[0-9]'); | 530 final _NUM_REGEX = new RegExp('[0-9]'); |
530 final _BINDING_REGEX = new RegExp(r'(({{.*}})|(\[\[.*\]\]))'); | 531 final _BINDING_REGEX = new RegExp(r'(({{.*}})|(\[\[.*\]\]))'); |
531 | 532 |
532 _getSpan(SourceFile file, AstNode node) => file.span(node.offset, node.end); | 533 _getSpan(SourceFile file, AstNode node) => file.span(node.offset, node.end); |
OLD | NEW |