| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 | 94 |
| 95 _addScriptFirst(urlSegment) { | 95 _addScriptFirst(urlSegment) { |
| 96 document.head.nodes.insert(0, parseFragment( | 96 document.head.nodes.insert(0, parseFragment( |
| 97 '<script src="packages/$urlSegment"></script>\n')); | 97 '<script src="packages/$urlSegment"></script>\n')); |
| 98 } | 98 } |
| 99 | 99 |
| 100 var suffix = options.releaseMode ? '.js' : '.concat.js'; | 100 var suffix = options.releaseMode ? '.js' : '.concat.js'; |
| 101 if (!dartSupportFound) _addScriptFirst('web_components/dart_support.js'); | 101 if (!dartSupportFound) _addScriptFirst('web_components/dart_support.js'); |
| 102 // platform.js should come before all other scripts. | 102 // platform.js should come before all other scripts. |
| 103 if (!platformJsFound) _addScriptFirst('web_components/platform$suffix'); | 103 if (!platformJsFound && options.injectPlatformJs) { |
| 104 _addScriptFirst('web_components/platform$suffix'); |
| 105 } |
| 104 | 106 |
| 105 transform.addOutput( | 107 transform.addOutput( |
| 106 new Asset.fromString(transform.primaryInput.id, document.outerHtml)); | 108 new Asset.fromString(transform.primaryInput.id, document.outerHtml)); |
| 107 }); | 109 }); |
| 108 } | 110 } |
| 109 } | 111 } |
| 110 | 112 |
| 111 final _platformJS = new RegExp(r'platform.*\.js', caseSensitive: false); | 113 final _platformJS = new RegExp(r'platform.*\.js', caseSensitive: false); |
| 112 final _dartSupportJS = new RegExp(r'dart_support.js', caseSensitive: false); | 114 final _dartSupportJS = new RegExp(r'dart_support.js', caseSensitive: false); |
| OLD | NEW |