Index: sdk/lib/_internal/pub_generated/lib/src/barback/rewrite_import_transformer.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/barback/rewrite_import_transformer.dart b/sdk/lib/_internal/pub_generated/lib/src/barback/rewrite_import_transformer.dart |
similarity index 56% |
copy from sdk/lib/_internal/pub/lib/src/barback/rewrite_import_transformer.dart |
copy to sdk/lib/_internal/pub_generated/lib/src/barback/rewrite_import_transformer.dart |
index 7482d620a840df40be7a5ecdb6c093888f231a6a..bea129efbedb2acd2bd9960cac5ea6294d512c49 100644 |
--- a/sdk/lib/_internal/pub/lib/src/barback/rewrite_import_transformer.dart |
+++ b/sdk/lib/_internal/pub_generated/lib/src/barback/rewrite_import_transformer.dart |
@@ -1,38 +1,24 @@ |
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
-// for details. All rights reserved. Use of this source code is governed by a |
-// BSD-style license that can be found in the LICENSE file. |
- |
library pub.rewrite_import_transformer; |
- |
import 'dart:async'; |
- |
import 'package:barback/barback.dart'; |
- |
import '../dart.dart'; |
- |
-/// A transformer used internally to rewrite "package:" imports so they point to |
-/// the barback server rather than to pub's package root. |
class RewriteImportTransformer extends Transformer { |
String get allowedExtensions => '.dart'; |
- |
Future apply(Transform transform) { |
return transform.primaryInput.readAsString().then((contents) { |
- var directives = parseImportsAndExports(contents, |
- name: transform.primaryInput.id.toString()); |
- |
+ var directives = |
+ parseImportsAndExports(contents, name: transform.primaryInput.id.toString()); |
var buffer = new StringBuffer(); |
var index = 0; |
for (var directive in directives) { |
var uri = Uri.parse(directive.uri.stringValue); |
if (uri.scheme != 'package') continue; |
- |
buffer |
- ..write(contents.substring(index, directive.uri.literal.offset)) |
- ..write('"/packages/${uri.path}"'); |
+ ..write(contents.substring(index, directive.uri.literal.offset)) |
+ ..write('"/packages/${uri.path}"'); |
index = directive.uri.literal.end; |
} |
buffer.write(contents.substring(index, contents.length)); |
- |
transform.addOutput( |
new Asset.fromString(transform.primaryInput.id, buffer.toString())); |
}); |