| 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 /** Common methods used by transfomers. */ | 5 /** Common methods used by transfomers. */ |
| 6 library polymer.src.build.common; | 6 library polymer.src.build.common; |
| 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 10 matching lines...) Expand all Loading... |
| 21 {bool checkDocType: true}) { | 21 {bool checkDocType: true}) { |
| 22 // TODO(jmesserly): make HTTP encoding configurable | 22 // TODO(jmesserly): make HTTP encoding configurable |
| 23 var parser = new HtmlParser(contents, encoding: 'utf8', generateSpans: true, | 23 var parser = new HtmlParser(contents, encoding: 'utf8', generateSpans: true, |
| 24 sourceUrl: sourcePath); | 24 sourceUrl: sourcePath); |
| 25 var document = parser.parse(); | 25 var document = parser.parse(); |
| 26 | 26 |
| 27 // Note: errors aren't fatal in HTML (unless strict mode is on). | 27 // Note: errors aren't fatal in HTML (unless strict mode is on). |
| 28 // So just print them as warnings. | 28 // So just print them as warnings. |
| 29 for (var e in parser.errors) { | 29 for (var e in parser.errors) { |
| 30 if (checkDocType || e.errorCode != 'expected-doctype-but-got-start-tag') { | 30 if (checkDocType || e.errorCode != 'expected-doctype-but-got-start-tag') { |
| 31 logger.warning(e.message, e.span); | 31 logger.warning(e.message, span: e.span); |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 return document; | 34 return document; |
| 35 } | 35 } |
| 36 | 36 |
| 37 /** Additional options used by polymer transformers */ | 37 /** Additional options used by polymer transformers */ |
| 38 class TransformOptions { | 38 class TransformOptions { |
| 39 String currentPackage; | 39 String currentPackage; |
| 40 List<String> entryPoints; | 40 List<String> entryPoints; |
| 41 | 41 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 return builder.relative(builder.join('/', id.path), | 153 return builder.relative(builder.join('/', id.path), |
| 154 from: builder.join('/', builder.dirname(sourceId.path))); | 154 from: builder.join('/', builder.dirname(sourceId.path))); |
| 155 } | 155 } |
| 156 | 156 |
| 157 | 157 |
| 158 /** Convert system paths to asset paths (asset paths are posix style). */ | 158 /** Convert system paths to asset paths (asset paths are posix style). */ |
| 159 String _systemToAssetPath(String assetPath) { | 159 String _systemToAssetPath(String assetPath) { |
| 160 if (path.Style.platform != path.Style.windows) return assetPath; | 160 if (path.Style.platform != path.Style.windows) return assetPath; |
| 161 return path.posix.joinAll(path.split(assetPath)); | 161 return path.posix.joinAll(path.split(assetPath)); |
| 162 } | 162 } |
| OLD | NEW |