File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
modules_dart/transform/lib/src/transform Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,20 @@ const ALL_EXTENSIONS = const [
3030 '.dart'
3131];
3232
33+ /// Whether `uri` was created by a transform phase.
34+ ///
35+ /// This may return false positives for problematic inputs.
36+ /// This just tests file extensions known to be created by the transformer, so
37+ /// any files named like transformer outputs will be reported as generated.
38+ bool isGenerated (String uri) {
39+ return const [
40+ DEPS_EXTENSION ,
41+ NON_SHIMMED_STYLESHEET_EXTENSION ,
42+ SHIMMED_STYLESHEET_EXTENSION ,
43+ TEMPLATE_EXTENSION ,
44+ ].any ((ext) => uri.endsWith (ext));
45+ }
46+
3347/// Returns `uri` with its extension updated to [META_EXTENSION] .
3448String toMetaExtension (String uri) =>
3549 _toExtension (uri, ALL_EXTENSIONS , META_EXTENSION );
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ class DeferredRewriter extends Transformer {
2121
2222 @override
2323 bool isPrimary (AssetId id) =>
24- id.extension .endsWith ('dart' ) && ! id.path. endsWith ( DEPS_EXTENSION );
24+ id.extension .endsWith ('dart' ) && _isNotGenerated (id );
2525
2626 @override
2727 Future apply (Transform transform) async {
@@ -36,6 +36,8 @@ class DeferredRewriter extends Transformer {
3636 }
3737}
3838
39+ bool _isNotGenerated (AssetId id) => ! isGenerated (id.path);
40+
3941// Visible for testing
4042Future <String > rewriteDeferredLibraries (AssetReader reader, AssetId id) async {
4143 var rewriter = new Rewriter (id, reader);
You can’t perform that action at this time.
0 commit comments