@@ -6,6 +6,7 @@ import 'dart:async';
66import 'dart:convert' ;
77
88import 'package:analyzer/analyzer.dart' ;
9+ import 'package:async/async.dart' ;
910import 'package:barback/barback.dart' ;
1011import 'package:collection/collection.dart' ;
1112import 'package:path/path.dart' as p;
@@ -161,7 +162,8 @@ class Dart2JSTransformer extends Transformer implements LazyTransformer {
161162 suppressPackageWarnings:
162163 _configBool ('suppressPackageWarnings' , defaultsTo: true ),
163164 terse: _configBool ('terse' ),
164- includeSourceMapUrls: _generateSourceMaps);
165+ includeSourceMapUrls: _generateSourceMaps,
166+ platformBinaries: provider.libraryRoot.resolve ('lib/_internal/' ).path);
165167 }
166168
167169 /// Parses and returns the "commandLineOptions" configuration option.
@@ -280,7 +282,7 @@ class _BarbackCompilerProvider implements dart.CompilerProvider {
280282 }
281283
282284 /// A [CompilerInputProvider] for dart2js.
283- Future <String > provideInput (Uri resourceUri) {
285+ Future /* <String | List<int>> */ provideInput (Uri resourceUri) {
284286 // We only expect to get absolute "file:" URLs from dart2js.
285287 assert (resourceUri.isAbsolute);
286288 assert (resourceUri.scheme == "file" );
@@ -391,11 +393,17 @@ class _BarbackCompilerProvider implements dart.CompilerProvider {
391393 }
392394 }
393395
394- Future < String > _readResource (Uri url) {
396+ Future _readResource (Uri url) {
395397 return new Future .sync (() {
396398 // Find the corresponding asset in barback.
397399 var id = _sourceUrlToId (url);
398- if (id != null ) return _transform.readInputAsString (id);
400+ if (id != null ) {
401+ if (id.extension == '.dill' ) {
402+ return collectBytes (_transform.readInput (id));
403+ } else {
404+ return _transform.readInputAsString (id);
405+ }
406+ }
399407
400408 // Don't allow arbitrary file paths that point to things not in packages.
401409 // Doing so won't work in Dartium.
0 commit comments