Index: sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart b/sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart |
index 7f81922b5f78020802bc81e1730fcecbe4be3bda..70b6151f0bc974da8b6e2d15327e03617d77969b 100644 |
--- a/sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart |
+++ b/sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart |
@@ -34,9 +34,15 @@ Future<Set> loadTransformers(BuildEnvironment environment, |
var baseUrl = transformerServer.url; |
var uri = '$baseUrl/packages/${id.package}/$path'; |
- var code = 'import "$uri";\n' + |
- readAsset(p.join("dart", "transformer_isolate.dart")) |
- .replaceAll('<<URL_BASE>>', baseUrl); |
+ var code = """ |
+ import 'dart:isolate'; |
+ |
+ import '$uri'; |
+ |
+ import r'$baseUrl/packages/\$pub/transformer_isolate.dart'; |
+ |
+ void main(_, SendPort replyTo) => loadTransformers(replyTo); |
+ """; |
log.fine("Loading transformers from $assetId"); |
var port = new ReceivePort(); |
@@ -60,7 +66,7 @@ Future<Set> loadTransformers(BuildEnvironment environment, |
if (error.type != 'IsolateSpawnException') throw error; |
// TODO(nweiz): don't parse this as a string once issues 12617 and 12689 |
// are fixed. |
- if (!error.message.split('\n')[1].startsWith('import "$uri";')) { |
+ if (!error.message.split('\n')[1].endsWith("import '$uri';")) { |
throw error; |
} |
@@ -148,6 +154,11 @@ Map _serializeTransform(Transform transform) { |
return null; |
} |
+ if (message['type'] == 'consumePrimary') { |
+ transform.consumePrimary(); |
+ return null; |
+ } |
+ |
assert(message['type'] == 'log'); |
var method; |
if (message['level'] == 'Info') { |