| Index: sdk/lib/_internal/pub_generated/lib/src/barback/dart2js_transformer.dart
|
| diff --git a/sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart b/sdk/lib/_internal/pub_generated/lib/src/barback/dart2js_transformer.dart
|
| similarity index 87%
|
| copy from sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart
|
| copy to sdk/lib/_internal/pub_generated/lib/src/barback/dart2js_transformer.dart
|
| index 35740f0e5d25275532effb224178d2a9d78abab5..3910ef8be56924bf5cc542e758c0fb7094c1a166 100644
|
| --- a/sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart
|
| +++ b/sdk/lib/_internal/pub_generated/lib/src/barback/dart2js_transformer.dart
|
| @@ -13,8 +13,7 @@ import 'package:path/path.dart' as path;
|
| import 'package:pool/pool.dart';
|
|
|
| import '../../../../../../../pkg/compiler/lib/compiler.dart' as compiler;
|
| -import '../../../../../../../pkg/compiler/lib/src/dart2js.dart'
|
| - show AbortLeg;
|
| +import '../../../../../../../pkg/compiler/lib/src/dart2js.dart' show AbortLeg;
|
| import '../../../../../../../pkg/compiler/lib/src/io/source_file.dart';
|
| import '../barback.dart';
|
| import '../dart.dart' as dart;
|
| @@ -22,11 +21,19 @@ import '../utils.dart';
|
| import 'asset_environment.dart';
|
|
|
| /// The set of all valid configuration options for this transformer.
|
| -final _validOptions = new Set<String>.from([
|
| - 'commandLineOptions', 'checked', 'csp', 'minify', 'verbose', 'environment',
|
| - 'preserveUris', 'suppressWarnings', 'suppressHints',
|
| - 'suppressPackageWarnings', 'terse'
|
| -]);
|
| +final _validOptions = new Set<String>.from(
|
| + [
|
| + 'commandLineOptions',
|
| + 'checked',
|
| + 'csp',
|
| + 'minify',
|
| + 'verbose',
|
| + 'environment',
|
| + 'preserveUris',
|
| + 'suppressWarnings',
|
| + 'suppressHints',
|
| + 'suppressPackageWarnings',
|
| + 'terse']);
|
|
|
| /// A [Transformer] that uses dart2js's library API to transform Dart
|
| /// entrypoints in "web" to JavaScript.
|
| @@ -45,13 +52,13 @@ class Dart2JSTransformer extends Transformer implements LazyTransformer {
|
| bool get _generateSourceMaps => _settings.mode != BarbackMode.RELEASE;
|
|
|
| Dart2JSTransformer.withSettings(this._environment, this._settings) {
|
| - var invalidOptions = _settings.configuration.keys.toSet()
|
| - .difference(_validOptions);
|
| + var invalidOptions =
|
| + _settings.configuration.keys.toSet().difference(_validOptions);
|
| if (invalidOptions.isEmpty) return;
|
|
|
| - throw new FormatException("Unrecognized dart2js "
|
| - "${pluralize('option', invalidOptions.length)} "
|
| - "${toSentence(invalidOptions.map((option) => '"$option"'))}.");
|
| + throw new FormatException(
|
| + "Unrecognized dart2js " "${pluralize('option', invalidOptions.length)} "
|
| + "${toSentence(invalidOptions.map((option) => '"$option"'))}.");
|
| }
|
|
|
| Dart2JSTransformer(AssetEnvironment environment, BarbackMode mode)
|
| @@ -79,8 +86,8 @@ class Dart2JSTransformer extends Transformer implements LazyTransformer {
|
| var stopwatch = new Stopwatch()..start();
|
| return _doCompilation(transform).then((_) {
|
| stopwatch.stop();
|
| - transform.logger.info("Took ${stopwatch.elapsed} to compile "
|
| - "${transform.primaryInput.id}.");
|
| + transform.logger.info(
|
| + "Took ${stopwatch.elapsed} to compile " "${transform.primaryInput.id}.");
|
| });
|
| });
|
| });
|
| @@ -115,7 +122,9 @@ class Dart2JSTransformer extends Transformer implements LazyTransformer {
|
|
|
| /// Run the dart2js compiler.
|
| Future _doCompilation(Transform transform) {
|
| - var provider = new _BarbackCompilerProvider(_environment, transform,
|
| + var provider = new _BarbackCompilerProvider(
|
| + _environment,
|
| + transform,
|
| generateSourceMaps: _generateSourceMaps);
|
|
|
| // Create a "path" to the entrypoint script. The entrypoint may not actually
|
| @@ -130,12 +139,14 @@ class Dart2JSTransformer extends Transformer implements LazyTransformer {
|
| // make sure paths in errors are mapped to the original source path so they
|
| // can understand them.
|
| return dart.compile(
|
| - entrypoint, provider,
|
| + entrypoint,
|
| + provider,
|
| commandLineOptions: _configCommandLineOptions,
|
| csp: _configBool('csp'),
|
| checked: _configBool('checked'),
|
| minify: _configBool(
|
| - 'minify', defaultsTo: _settings.mode == BarbackMode.RELEASE),
|
| + 'minify',
|
| + defaultsTo: _settings.mode == BarbackMode.RELEASE),
|
| verbose: _configBool('verbose'),
|
| environment: _configEnvironment,
|
| packageRoot: _environment.rootPackage.path("packages"),
|
| @@ -144,7 +155,8 @@ class Dart2JSTransformer extends Transformer implements LazyTransformer {
|
| suppressWarnings: _configBool('suppressWarnings'),
|
| suppressHints: _configBool('suppressHints'),
|
| suppressPackageWarnings: _configBool(
|
| - 'suppressPackageWarnings', defaultsTo: true),
|
| + 'suppressPackageWarnings',
|
| + defaultsTo: true),
|
| terse: _configBool('terse'),
|
| includeSourceMapUrls: _settings.mode != BarbackMode.RELEASE);
|
| }
|
| @@ -158,9 +170,10 @@ class Dart2JSTransformer extends Transformer implements LazyTransformer {
|
| return options;
|
| }
|
|
|
| - throw new FormatException('Invalid value for '
|
| - '\$dart2js.commandLineOptions: ${JSON.encode(options)} (expected list '
|
| - 'of strings).');
|
| + throw new FormatException(
|
| + 'Invalid value for '
|
| + '\$dart2js.commandLineOptions: ${JSON.encode(options)} (expected list '
|
| + 'of strings).');
|
| }
|
|
|
| /// Parses and returns the "environment" configuration option.
|
| @@ -174,8 +187,9 @@ class Dart2JSTransformer extends Transformer implements LazyTransformer {
|
| return environment;
|
| }
|
|
|
| - throw new FormatException('Invalid value for \$dart2js.environment: '
|
| - '${JSON.encode(environment)} (expected map from strings to strings).');
|
| + throw new FormatException(
|
| + 'Invalid value for \$dart2js.environment: '
|
| + '${JSON.encode(environment)} (expected map from strings to strings).');
|
| }
|
|
|
| /// Parses and returns a boolean configuration option.
|
| @@ -185,8 +199,9 @@ class Dart2JSTransformer extends Transformer implements LazyTransformer {
|
| if (!_settings.configuration.containsKey(name)) return defaultsTo;
|
| var value = _settings.configuration[name];
|
| if (value is bool) return value;
|
| - throw new FormatException('Invalid value for \$dart2js.$name: '
|
| - '${JSON.encode(value)} (expected true or false).');
|
| + throw new FormatException(
|
| + 'Invalid value for \$dart2js.$name: '
|
| + '${JSON.encode(value)} (expected true or false).');
|
| }
|
| }
|
|
|
| @@ -256,10 +271,10 @@ class _BarbackCompilerProvider implements dart.CompilerProvider {
|
| // $sdk|lib/lib/...
|
| //
|
| // TODO(rnystrom): Fix this if #17751 is fixed.
|
| - var buildDir = _environment.getSourceDirectoryContaining(
|
| - _transform.primaryInput.id.path);
|
| - _libraryRootPath = _environment.rootPackage.path(
|
| - buildDir, "packages", r"$sdk");
|
| + var buildDir =
|
| + _environment.getSourceDirectoryContaining(_transform.primaryInput.id.path);
|
| + _libraryRootPath =
|
| + _environment.rootPackage.path(buildDir, "packages", r"$sdk");
|
| }
|
|
|
| /// A [CompilerInputProvider] for dart2js.
|
| @@ -315,8 +330,8 @@ class _BarbackCompilerProvider implements dart.CompilerProvider {
|
|
|
| /// A [DiagnosticHandler] for dart2js, loosely based on
|
| /// [FormattingDiagnosticHandler].
|
| - void handleDiagnostic(Uri uri, int begin, int end,
|
| - String message, compiler.Diagnostic kind) {
|
| + void handleDiagnostic(Uri uri, int begin, int end, String message,
|
| + compiler.Diagnostic kind) {
|
| // TODO(ahe): Remove this when source map is handled differently.
|
| if (kind.name == "source map") return;
|
|
|
| @@ -397,8 +412,8 @@ class _BarbackCompilerProvider implements dart.CompilerProvider {
|
| // should be loaded directly from disk.
|
| var sourcePath = path.fromUri(url);
|
| if (_environment.containsPath(sourcePath)) {
|
| - var relative = path.toUri(_environment.rootPackage.relative(sourcePath))
|
| - .toString();
|
| + var relative =
|
| + path.toUri(_environment.rootPackage.relative(sourcePath)).toString();
|
|
|
| return new AssetId(_environment.rootPackage.name, relative);
|
| }
|
|
|