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

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

Issue 47933006: Build fixes: adds arguments to the pub-build plugin to configure whether 'js' (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 17 matching lines...) Expand all
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(Map args) : this(_parseArgs(args));
34 } 34 }
35 35
36 36
37 TransformOptions _parseArgs(Map args) { 37 TransformOptions _parseArgs(Map args) {
38 var entryPoints; 38 return new TransformOptions(
39 if (args.containsKey('entry_points')) { 39 entryPoints: _readEntrypoints(args['entry_points']),
40 entryPoints = []; 40 directlyIncludeJS: args['js'] != false, // default to true
Jennifer Messerly 2013/10/29 02:15:35 shouldn't args populate this so it's always be tru
41 var value = args['entry_points']; 41 contentSecurityPolicy: args['csp'] == true); // default to false
42 bool error; 42 }
43 if (value is List) {
44 entryPoints = value;
45 error = value.any((e) => e is! String);
46 } else if (value is String) {
47 entryPoints = [value];
48 error = false;
49 } else {
50 error = true;
51 }
52 43
53 if (error) { 44 _readEntrypoints(value) {
54 print('Invalid value for "entry_points" in the polymer transformer.'); 45 if (value == null) return null;
55 } 46 var entryPoints = [];
47 bool error;
48 if (value is List) {
49 entryPoints = value;
50 error = value.any((e) => e is! String);
51 } else if (value is String) {
52 entryPoints = [value];
53 error = false;
54 } else {
55 error = true;
56 } 56 }
57 return new TransformOptions(entryPoints: entryPoints); 57 if (error) {
58 print('Invalid value for "entry_points" in the polymer transformer.');
59 }
60 return entryPoints;
58 } 61 }
59 62
60 List<List<Transformer>> _createDeployPhases(TransformOptions options) { 63 List<List<Transformer>> _createDeployPhases(TransformOptions options) {
61 return [ 64 return [
62 [new InlineCodeExtractor(options)], 65 [new InlineCodeExtractor(options)],
63 [new ObservableTransformer()], 66 [new ObservableTransformer()],
64 [new ImportInliner(options)], 67 [new ImportInliner(options)],
65 [new ScriptCompactor(options)], 68 [new ScriptCompactor(options)],
66 [new PolyfillInjector(options)] 69 [new PolyfillInjector(options)]
67 ]; 70 ];
68 } 71 }
OLDNEW
« no previous file with comments | « pkg/polymer/lib/src/build/script_compactor.dart ('k') | pkg/polymer/test/build/all_phases_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698