| Index: third_party/pkg/di/lib/transformer/options.dart
|
| diff --git a/third_party/pkg/di/lib/transformer/options.dart b/third_party/pkg/di/lib/transformer/options.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a9d5b17e2c61bbb34fa143dec11e53c5a3d69202
|
| --- /dev/null
|
| +++ b/third_party/pkg/di/lib/transformer/options.dart
|
| @@ -0,0 +1,52 @@
|
| +library di.transformer.options;
|
| +
|
| +import 'dart:async';
|
| +
|
| +import 'package:barback/barback.dart';
|
| +import 'package:code_transformers/resolver.dart';
|
| +
|
| +const List<String> DEFAULT_INJECTABLE_ANNOTATIONS =
|
| + const ['di.annotations.Injectable'];
|
| +
|
| +/// Returns either a bool or a Future<bool> when complete.
|
| +typedef EntryFilter(Asset asset);
|
| +
|
| +/** Options used by DI transformers */
|
| +class TransformOptions {
|
| +
|
| + /**
|
| + * Filter to determine which assets should be modified.
|
| + */
|
| + final EntryFilter entryFilter;
|
| +
|
| + /**
|
| + * List of additional annotations which are used to indicate types as being
|
| + * injectable.
|
| + */
|
| + final List<String> injectableAnnotations;
|
| +
|
| + /**
|
| + * Set of additional types which should be injected.
|
| + */
|
| + final Set<String> injectedTypes;
|
| +
|
| + /**
|
| + * Path to the Dart SDK directory, for resolving Dart libraries.
|
| + */
|
| + final String sdkDirectory;
|
| +
|
| + TransformOptions({EntryFilter entryFilter, String sdkDirectory,
|
| + List<String> injectableAnnotations, List<String> injectedTypes})
|
| + : entryFilter = entryFilter != null ? entryFilter : isPossibleDartEntry,
|
| + sdkDirectory = sdkDirectory,
|
| + injectableAnnotations =
|
| + (injectableAnnotations != null ? injectableAnnotations : [])
|
| + ..addAll(DEFAULT_INJECTABLE_ANNOTATIONS),
|
| + injectedTypes =
|
| + new Set.from(injectedTypes != null ? injectedTypes : []) {
|
| + if (sdkDirectory == null)
|
| + throw new ArgumentError('sdkDirectory must be provided.');
|
| + }
|
| +
|
| + Future<bool> isDartEntry(Asset asset) => new Future.value(entryFilter(asset));
|
| +}
|
|
|