| 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 /// Includes any additional polyfills that may needed by the deployed app. | 5 /// Includes any additional polyfills that may needed by the deployed app. |
| 6 library polymer.src.build.polyfill_injector; | 6 library polymer.src.build.polyfill_injector; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 | 9 |
| 10 import 'package:barback/barback.dart'; | 10 import 'package:barback/barback.dart'; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 /// Only run on entry point .html files. | 27 /// Only run on entry point .html files. |
| 28 // TODO(nweiz): This should just take an AssetId when barback <0.13.0 support | 28 // TODO(nweiz): This should just take an AssetId when barback <0.13.0 support |
| 29 // is dropped. | 29 // is dropped. |
| 30 Future<bool> isPrimary(idOrAsset) { | 30 Future<bool> isPrimary(idOrAsset) { |
| 31 var id = idOrAsset is AssetId ? idOrAsset : idOrAsset.id; | 31 var id = idOrAsset is AssetId ? idOrAsset : idOrAsset.id; |
| 32 return new Future.value(options.isHtmlEntryPoint(id)); | 32 return new Future.value(options.isHtmlEntryPoint(id)); |
| 33 } | 33 } |
| 34 | 34 |
| 35 Future apply(Transform transform) { | 35 Future apply(Transform transform) { |
| 36 var logger = new BuildLogger(transform, | 36 var logger = new BuildLogger(transform, |
| 37 convertErrorsToWarnings: !options.releaseMode); | 37 convertErrorsToWarnings: !options.releaseMode, |
| 38 detailsUri: 'http://goo.gl/5HPeuP'); |
| 38 return readPrimaryAsHtml(transform, logger).then((document) { | 39 return readPrimaryAsHtml(transform, logger).then((document) { |
| 39 bool webComponentsFound = false; | 40 bool webComponentsFound = false; |
| 40 Element dartJs; | 41 Element dartJs; |
| 41 final dartScripts = <Element>[]; | 42 final dartScripts = <Element>[]; |
| 42 | 43 |
| 43 for (var tag in document.querySelectorAll('script')) { | 44 for (var tag in document.querySelectorAll('script')) { |
| 44 var src = tag.attributes['src']; | 45 var src = tag.attributes['src']; |
| 45 if (src != null) { | 46 if (src != null) { |
| 46 var last = src.split('/').last; | 47 var last = src.split('/').last; |
| 47 if (_webComponentsJS.hasMatch(last)) { | 48 if (_webComponentsJS.hasMatch(last)) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 103 } |
| 103 | 104 |
| 104 transform.addOutput( | 105 transform.addOutput( |
| 105 new Asset.fromString(transform.primaryInput.id, document.outerHtml)); | 106 new Asset.fromString(transform.primaryInput.id, document.outerHtml)); |
| 106 }); | 107 }); |
| 107 } | 108 } |
| 108 } | 109 } |
| 109 | 110 |
| 110 final _webComponentsJS = new RegExp(r'platform.*\.js', | 111 final _webComponentsJS = new RegExp(r'platform.*\.js', |
| 111 caseSensitive: false); | 112 caseSensitive: false); |
| OLD | NEW |