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

Unified Diff: sdk/lib/_internal/pub/lib/src/barback/rewrite_import_transformer.dart

Issue 590393005: Pass a package root to spawned isolates in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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: sdk/lib/_internal/pub/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/lib/src/barback/rewrite_import_transformer.dart
deleted file mode 100644
index 7482d620a840df40be7a5ecdb6c093888f231a6a..0000000000000000000000000000000000000000
--- a/sdk/lib/_internal/pub/lib/src/barback/rewrite_import_transformer.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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.
Bob Nystrom 2014/09/23 21:56:11 ,;``', ; | ;;. ;;,' `"-'7'. IT
-
-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 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}"');
- index = directive.uri.literal.end;
- }
- buffer.write(contents.substring(index, contents.length));
-
- transform.addOutput(
- new Asset.fromString(transform.primaryInput.id, buffer.toString()));
- });
- }
-}

Powered by Google App Engine
This is Rietveld 408576698