Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Unified Diff: third_party/pkg/di/lib/transformer/options.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));
+}
« no previous file with comments | « third_party/pkg/di/lib/transformer/injector_generator.dart ('k') | third_party/pkg/di/lib/transformer/refactor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698