| 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 /// Logic to validate that developers are correctly using Polymer constructs. | 5 /// Logic to validate that developers are correctly using Polymer constructs. |
| 6 /// This is mainly used to produce warnings for feedback in the editor. | 6 /// This is mainly used to produce warnings for feedback in the editor. |
| 7 library polymer.src.build.linter; | 7 library polymer.src.build.linter; |
| 8 | 8 |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'dart:convert'; | 10 import 'dart:convert'; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 Future apply(Transform transform) { | 35 Future apply(Transform transform) { |
| 36 var seen = new Set<AssetId>(); | 36 var seen = new Set<AssetId>(); |
| 37 var primary = transform.primaryInput; | 37 var primary = transform.primaryInput; |
| 38 var id = primary.id; | 38 var id = primary.id; |
| 39 transform.addOutput(primary); // this phase is analysis only | 39 transform.addOutput(primary); // this phase is analysis only |
| 40 seen.add(id); | 40 seen.add(id); |
| 41 bool isEntryPoint = options.isHtmlEntryPoint(id); | 41 bool isEntryPoint = options.isHtmlEntryPoint(id); |
| 42 | 42 |
| 43 var logger = new BuildLogger(transform, | 43 var logger = new BuildLogger(transform, |
| 44 convertErrorsToWarnings: !options.releaseMode); | 44 convertErrorsToWarnings: !options.releaseMode, |
| 45 detailsUri: 'http://goo.gl/5HPeuP'); |
| 45 | 46 |
| 46 return readPrimaryAsHtml(transform, logger).then((document) { | 47 return readPrimaryAsHtml(transform, logger).then((document) { |
| 47 return _collectElements(document, id, transform, logger, seen) | 48 return _collectElements(document, id, transform, logger, seen) |
| 48 .then((elements) { | 49 .then((elements) { |
| 49 new _LinterVisitor(id, logger, elements, isEntryPoint).run(document); | 50 new _LinterVisitor(id, logger, elements, isEntryPoint).run(document); |
| 50 | 51 |
| 51 // Write out the logs collected by our [BuildLogger]. | 52 // Write out the logs collected by our [BuildLogger]. |
| 52 if (options.injectBuildLogsInOutput && logger is BuildLogger) { | 53 if (options.injectBuildLogsInOutput && logger is BuildLogger) { |
| 53 return (logger as BuildLogger).writeOutput(); | 54 return (logger as BuildLogger).writeOutput(); |
| 54 } | 55 } |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 } else if (segments.length > 2) { | 436 } else if (segments.length > 2) { |
| 436 // web/a/foo.html => ../packages/ | 437 // web/a/foo.html => ../packages/ |
| 437 upDirCount = segments.length - 2; | 438 upDirCount = segments.length - 2; |
| 438 } | 439 } |
| 439 var reachOutPrefix = '../' * upDirCount; | 440 var reachOutPrefix = '../' * upDirCount; |
| 440 return USE_POLYMER_HTML.create({'reachOutPrefix': reachOutPrefix}); | 441 return USE_POLYMER_HTML.create({'reachOutPrefix': reachOutPrefix}); |
| 441 } | 442 } |
| 442 | 443 |
| 443 const List<String> INTERNALLY_DEFINED_ELEMENTS = | 444 const List<String> INTERNALLY_DEFINED_ELEMENTS = |
| 444 const ['auto-binding-dart', 'polymer-element']; | 445 const ['auto-binding-dart', 'polymer-element']; |
| OLD | NEW |