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

Side by Side Diff: pkg/polymer/lib/transformer.dart

Issue 52853004: Pass in "mode" to transformer plugins. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: "transformer" -> "configuration". Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/barback/test/barback_mode_test.dart ('k') | sdk/lib/_internal/pub/lib/src/barback.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** Transfomer used for pub-serve and pub-deploy. */ 5 /** Transfomer used for pub-serve and pub-deploy. */
6 library polymer.transformer; 6 library polymer.transformer;
7 7
8 import 'package:barback/barback.dart'; 8 import 'package:barback/barback.dart';
9 import 'package:observe/transform.dart'; 9 import 'package:observe/transform.dart';
10 import 'src/build/code_extractor.dart'; 10 import 'src/build/code_extractor.dart';
(...skipping 12 matching lines...) Expand all
23 * 23 *
24 * At the end of these phases, this tranformer produces a single entrypoint HTML 24 * At the end of these phases, this tranformer produces a single entrypoint HTML
25 * file with a single Dart script that can later be compiled with dart2js. 25 * file with a single Dart script that can later be compiled with dart2js.
26 */ 26 */
27 class PolymerTransformerGroup implements TransformerGroup { 27 class PolymerTransformerGroup implements TransformerGroup {
28 final Iterable<Iterable> phases; 28 final Iterable<Iterable> phases;
29 29
30 PolymerTransformerGroup(TransformOptions options) 30 PolymerTransformerGroup(TransformOptions options)
31 : phases = _createDeployPhases(options); 31 : phases = _createDeployPhases(options);
32 32
33 PolymerTransformerGroup.asPlugin(Map args) : this(_parseArgs(args)); 33 PolymerTransformerGroup.asPlugin(BarbackSettings settings)
34 : this(_parseSettings(settings));
34 } 35 }
35 36
36 37 TransformOptions _parseSettings(BarbackSettings settings) {
37 TransformOptions _parseArgs(Map args) { 38 var args = settings.transformer;
38 return new TransformOptions( 39 return new TransformOptions(
39 entryPoints: _readEntrypoints(args['entry_points']), 40 entryPoints: _readEntrypoints(args['entry_points']),
40 directlyIncludeJS: args['js'] != false, // default to true 41 directlyIncludeJS: args['js'] != false, // default to true
41 contentSecurityPolicy: args['csp'] == true); // default to false 42 contentSecurityPolicy: args['csp'] == true); // default to false
42 } 43 }
43 44
44 _readEntrypoints(value) { 45 _readEntrypoints(value) {
45 if (value == null) return null; 46 if (value == null) return null;
46 var entryPoints = []; 47 var entryPoints = [];
47 bool error; 48 bool error;
(...skipping 14 matching lines...) Expand all
62 63
63 List<List<Transformer>> _createDeployPhases(TransformOptions options) { 64 List<List<Transformer>> _createDeployPhases(TransformOptions options) {
64 return [ 65 return [
65 [new InlineCodeExtractor(options)], 66 [new InlineCodeExtractor(options)],
66 [new ObservableTransformer()], 67 [new ObservableTransformer()],
67 [new ImportInliner(options)], 68 [new ImportInliner(options)],
68 [new ScriptCompactor(options)], 69 [new ScriptCompactor(options)],
69 [new PolyfillInjector(options)] 70 [new PolyfillInjector(options)]
70 ]; 71 ];
71 } 72 }
OLDNEW
« no previous file with comments | « pkg/barback/test/barback_mode_test.dart ('k') | sdk/lib/_internal/pub/lib/src/barback.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698