| OLD | NEW |
| 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/transformer.dart'; | 9 import 'package:observe/transformer.dart'; |
| 10 import 'package:path/path.dart' as path; | 10 import 'package:path/path.dart' as path; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 } | 38 } |
| 39 | 39 |
| 40 TransformOptions _parseSettings(BarbackSettings settings) { | 40 TransformOptions _parseSettings(BarbackSettings settings) { |
| 41 var args = settings.configuration; | 41 var args = settings.configuration; |
| 42 bool releaseMode = settings.mode == BarbackMode.RELEASE; | 42 bool releaseMode = settings.mode == BarbackMode.RELEASE; |
| 43 bool jsOption = args['js']; | 43 bool jsOption = args['js']; |
| 44 bool csp = args['csp'] == true; // defaults to false | 44 bool csp = args['csp'] == true; // defaults to false |
| 45 bool lint = args['lint'] != false; // defaults to true | 45 bool lint = args['lint'] != false; // defaults to true |
| 46 bool injectBuildLogs = | 46 bool injectBuildLogs = |
| 47 !releaseMode && args['inject_build_logs_in_output'] != false; | 47 !releaseMode && args['inject_build_logs_in_output'] != false; |
| 48 bool injectPlatformJs = args['inject_platform_js'] != false; |
| 48 return new TransformOptions( | 49 return new TransformOptions( |
| 49 entryPoints: readEntrypoints(args['entry_points']), | 50 entryPoints: readEntrypoints(args['entry_points']), |
| 50 inlineStylesheets: _readInlineStylesheets(args['inline_stylesheets']), | 51 inlineStylesheets: _readInlineStylesheets(args['inline_stylesheets']), |
| 51 directlyIncludeJS: jsOption == null ? releaseMode : jsOption, | 52 directlyIncludeJS: jsOption == null ? releaseMode : jsOption, |
| 52 contentSecurityPolicy: csp, | 53 contentSecurityPolicy: csp, |
| 53 releaseMode: releaseMode, | 54 releaseMode: releaseMode, |
| 54 lint: lint, | 55 lint: lint, |
| 55 injectBuildLogsInOutput: injectBuildLogs); | 56 injectBuildLogsInOutput: injectBuildLogs, |
| 57 injectPlatformJs: injectPlatformJs); |
| 56 } | 58 } |
| 57 | 59 |
| 58 readEntrypoints(value) { | 60 readEntrypoints(value) { |
| 59 if (value == null) return null; | 61 if (value == null) return null; |
| 60 var entryPoints = []; | 62 var entryPoints = []; |
| 61 bool error; | 63 bool error; |
| 62 if (value is List) { | 64 if (value is List) { |
| 63 entryPoints = value; | 65 entryPoints = value; |
| 64 error = value.any((e) => e is! String); | 66 error = value.any((e) => e is! String); |
| 65 } else if (value is String) { | 67 } else if (value is String) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 [new BuildFilter(options)], | 129 [new BuildFilter(options)], |
| 128 [new BuildLogCombiner(options)], | 130 [new BuildLogCombiner(options)], |
| 129 ]); | 131 ]); |
| 130 if (!options.releaseMode) { | 132 if (!options.releaseMode) { |
| 131 phases.add([new IndexPageBuilder(options)]); | 133 phases.add([new IndexPageBuilder(options)]); |
| 132 } | 134 } |
| 133 return phases; | 135 return phases; |
| 134 } | 136 } |
| 135 | 137 |
| 136 final RegExp _PACKAGE_PATH_REGEX = new RegExp(r'packages\/([^\/]+)\/(.*)'); | 138 final RegExp _PACKAGE_PATH_REGEX = new RegExp(r'packages\/([^\/]+)\/(.*)'); |
| OLD | NEW |