| Index: pkg/observe/lib/transformer.dart
|
| diff --git a/pkg/observe/lib/transformer.dart b/pkg/observe/lib/transformer.dart
|
| index 2c5a17e2b475b49f2cba2f803b2da414f57efc16..0b49a187d30234c8547b97310342756cbd707072 100644
|
| --- a/pkg/observe/lib/transformer.dart
|
| +++ b/pkg/observe/lib/transformer.dart
|
| @@ -45,22 +45,18 @@ class ObservableTransformer extends Transformer {
|
| return files;
|
| }
|
|
|
| - Future<bool> isPrimary(Asset input) {
|
| - if (input.id.extension != '.dart' ||
|
| - (_files != null && !_files.contains(input.id.path))) {
|
| - return new Future.value(false);
|
| - }
|
| - // Note: technically we should parse the file to find accurately the
|
| - // observable annotation, but that seems expensive. It would require almost
|
| - // as much work as applying the transform. We rather have some false
|
| - // positives here, and then generate no outputs when we apply this
|
| - // transform.
|
| - return input.readAsString().then(
|
| - (c) => c.contains("@observable") || c.contains("@published"));
|
| - }
|
| + Future<bool> isPrimary(AssetId id) => new Future.value(
|
| + id.extension != '.dart' || (_files != null && !_files.contains(id.path)));
|
|
|
| Future apply(Transform transform) {
|
| return transform.primaryInput.readAsString().then((content) {
|
| + // Do a quick string check to determine if this is this file even
|
| + // plausibly might need to be transformed. If not, we can avoid an
|
| + // expensive parse.
|
| + if (!content.contains("@observable") && !content.contains("@published")) {
|
| + return;
|
| + }
|
| +
|
| var id = transform.primaryInput.id;
|
| // TODO(sigmund): improve how we compute this url
|
| var url = id.path.startsWith('lib/')
|
|
|