@@ -6,6 +6,7 @@ import 'dart:async';
6
6
import 'dart:convert' ;
7
7
8
8
import 'package:analyzer/analyzer.dart' ;
9
+ import 'package:async/async.dart' ;
9
10
import 'package:barback/barback.dart' ;
10
11
import 'package:collection/collection.dart' ;
11
12
import 'package:path/path.dart' as p;
@@ -161,7 +162,8 @@ class Dart2JSTransformer extends Transformer implements LazyTransformer {
161
162
suppressPackageWarnings:
162
163
_configBool ('suppressPackageWarnings' , defaultsTo: true ),
163
164
terse: _configBool ('terse' ),
164
- includeSourceMapUrls: _generateSourceMaps);
165
+ includeSourceMapUrls: _generateSourceMaps,
166
+ platformBinaries: provider.libraryRoot.resolve ('lib/_internal/' ).path);
165
167
}
166
168
167
169
/// Parses and returns the "commandLineOptions" configuration option.
@@ -280,7 +282,7 @@ class _BarbackCompilerProvider implements dart.CompilerProvider {
280
282
}
281
283
282
284
/// A [CompilerInputProvider] for dart2js.
283
- Future <String > provideInput (Uri resourceUri) {
285
+ Future /* <String | List<int>> */ provideInput (Uri resourceUri) {
284
286
// We only expect to get absolute "file:" URLs from dart2js.
285
287
assert (resourceUri.isAbsolute);
286
288
assert (resourceUri.scheme == "file" );
@@ -391,11 +393,17 @@ class _BarbackCompilerProvider implements dart.CompilerProvider {
391
393
}
392
394
}
393
395
394
- Future < String > _readResource (Uri url) {
396
+ Future _readResource (Uri url) {
395
397
return new Future .sync (() {
396
398
// Find the corresponding asset in barback.
397
399
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
+ }
399
407
400
408
// Don't allow arbitrary file paths that point to things not in packages.
401
409
// Doing so won't work in Dartium.
0 commit comments