| 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 import 'dart:math' show min, max; | 9 import 'dart:math' show min, max; |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 /// `type="application/dart"` scripts with equivalent *.dart.js files. | 57 /// `type="application/dart"` scripts with equivalent *.dart.js files. |
| 58 /// | 58 /// |
| 59 /// If [contentSecurityPolicy] enabled, this will reference files | 59 /// If [contentSecurityPolicy] enabled, this will reference files |
| 60 /// named *.dart.precompiled.js. | 60 /// named *.dart.precompiled.js. |
| 61 final bool directlyIncludeJS; | 61 final bool directlyIncludeJS; |
| 62 | 62 |
| 63 /// Run transformers to create a releasable app. For example, include the | 63 /// Run transformers to create a releasable app. For example, include the |
| 64 /// minified versions of the polyfills rather than the debug versions. | 64 /// minified versions of the polyfills rather than the debug versions. |
| 65 final bool releaseMode; | 65 final bool releaseMode; |
| 66 | 66 |
| 67 /// True to run liner on all html files before starting other phases. |
| 68 // TODO(jmesserly): instead of this flag, we should only run linter on |
| 69 // reachable (entry point+imported) html if deploying. See dartbug.com/17199. |
| 70 final bool lint; |
| 71 |
| 67 TransformOptions({entryPoints, this.contentSecurityPolicy: false, | 72 TransformOptions({entryPoints, this.contentSecurityPolicy: false, |
| 68 this.directlyIncludeJS: true, this.releaseMode: true}) | 73 this.directlyIncludeJS: true, this.releaseMode: true, this.lint: true}) |
| 69 : entryPoints = entryPoints == null ? null | 74 : entryPoints = entryPoints == null ? null |
| 70 : entryPoints.map(_systemToAssetPath).toList(); | 75 : entryPoints.map(_systemToAssetPath).toList(); |
| 71 | 76 |
| 72 /// Whether an asset with [id] is an entry point HTML file. | 77 /// Whether an asset with [id] is an entry point HTML file. |
| 73 bool isHtmlEntryPoint(AssetId id) { | 78 bool isHtmlEntryPoint(AssetId id) { |
| 74 if (id.extension != '.html') return false; | 79 if (id.extension != '.html') return false; |
| 75 | 80 |
| 76 // Note: [id.path] is a relative path from the root of a package. | 81 // Note: [id.path] is a relative path from the root of a package. |
| 77 if (entryPoints == null) { | 82 if (entryPoints == null) { |
| 78 return id.path.startsWith('web/') || id.path.startsWith('test/'); | 83 return id.path.startsWith('web/') || id.path.startsWith('test/'); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 var scanner = new Scanner(null, reader, errorListener); | 268 var scanner = new Scanner(null, reader, errorListener); |
| 264 var token = scanner.tokenize(); | 269 var token = scanner.tokenize(); |
| 265 var parser = new Parser(null, errorListener); | 270 var parser = new Parser(null, errorListener); |
| 266 return parser.parseCompilationUnit(token); | 271 return parser.parseCompilationUnit(token); |
| 267 } | 272 } |
| 268 | 273 |
| 269 class _ErrorCollector extends AnalysisErrorListener { | 274 class _ErrorCollector extends AnalysisErrorListener { |
| 270 final errors = <AnalysisError>[]; | 275 final errors = <AnalysisError>[]; |
| 271 onError(error) => errors.add(error); | 276 onError(error) => errors.add(error); |
| 272 } | 277 } |
| OLD | NEW |