| 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 combines multiple dart script tags into a single one. */ | 5 /** Transfomer that combines multiple dart script tags into a single one. */ |
| 6 library polymer.src.transform.script_compactor; | 6 library polymer.src.transform.script_compactor; |
| 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 29 matching lines...) Expand all Loading... |
| 40 bool changed = false; | 40 bool changed = false; |
| 41 var dartLoaderTag = null; | 41 var dartLoaderTag = null; |
| 42 for (var tag in document.queryAll('script')) { | 42 for (var tag in document.queryAll('script')) { |
| 43 var src = tag.attributes['src']; | 43 var src = tag.attributes['src']; |
| 44 if (src != null) { | 44 if (src != null) { |
| 45 if (src == 'packages/polymer/boot.js') { | 45 if (src == 'packages/polymer/boot.js') { |
| 46 tag.remove(); | 46 tag.remove(); |
| 47 continue; | 47 continue; |
| 48 } | 48 } |
| 49 var last = src.split('/').last; | 49 var last = src.split('/').last; |
| 50 if (last == 'dart.js' || last == 'testing.js') { | 50 if (last == 'dart.js') { |
| 51 dartLoaderTag = tag; | 51 dartLoaderTag = tag; |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 if (tag.attributes['type'] != 'application/dart') continue; | 54 if (tag.attributes['type'] != 'application/dart') continue; |
| 55 tag.remove(); | 55 tag.remove(); |
| 56 changed = true; | 56 changed = true; |
| 57 if (src == null) { | 57 if (src == null) { |
| 58 logger.warning('unexpected script without a src url. The ' | 58 logger.warning('unexpected script without a src url. The ' |
| 59 'ScriptCompactor transformer should run after running the ' | 59 'ScriptCompactor transformer should run after running the ' |
| 60 'InlineCodeExtractor', tag.sourceSpan); | 60 'InlineCodeExtractor', tag.sourceSpan); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 void main() { | 116 void main() { |
| 117 initPolymer([ | 117 initPolymer([ |
| 118 """; | 118 """; |
| 119 | 119 |
| 120 // TODO(sigmund): investigate alternative to get the baseUri (dartbug.com/12612) | 120 // TODO(sigmund): investigate alternative to get the baseUri (dartbug.com/12612) |
| 121 const _mainSuffix = """ | 121 const _mainSuffix = """ |
| 122 ], currentMirrorSystem().isolate.rootLibrary.uri.toString()); | 122 ], currentMirrorSystem().isolate.rootLibrary.uri.toString()); |
| 123 } | 123 } |
| 124 """; | 124 """; |
| OLD | NEW |