| 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 TransformOptions _parseSettings(BarbackSettings settings) { | 39 TransformOptions _parseSettings(BarbackSettings settings) { |
| 40 var args = settings.configuration; | 40 var args = settings.configuration; |
| 41 bool releaseMode = settings.mode == BarbackMode.RELEASE; | 41 bool releaseMode = settings.mode == BarbackMode.RELEASE; |
| 42 bool jsOption = args['js']; | 42 bool jsOption = args['js']; |
| 43 bool csp = args['csp'] == true; // defaults to false | 43 bool csp = args['csp'] == true; // defaults to false |
| 44 bool lint = args['lint'] != false; // defaults to true | 44 bool lint = args['lint'] != false; // defaults to true |
| 45 bool injectBuildLogs = | 45 bool injectBuildLogs = |
| 46 !releaseMode && args['inject_build_logs_in_output'] != false; | 46 !releaseMode && args['inject_build_logs_in_output'] != false; |
| 47 return new TransformOptions( | 47 return new TransformOptions( |
| 48 entryPoints: _readEntrypoints(args['entry_points']), | 48 entryPoints: readEntrypoints(args['entry_points']), |
| 49 inlineStylesheets: _readInlineStylesheets(args['inline_stylesheets']), | 49 inlineStylesheets: _readInlineStylesheets(args['inline_stylesheets']), |
| 50 directlyIncludeJS: jsOption == null ? releaseMode : jsOption, | 50 directlyIncludeJS: jsOption == null ? releaseMode : jsOption, |
| 51 contentSecurityPolicy: csp, | 51 contentSecurityPolicy: csp, |
| 52 releaseMode: releaseMode, | 52 releaseMode: releaseMode, |
| 53 lint: lint, | 53 lint: lint, |
| 54 injectBuildLogsInOutput: injectBuildLogs); | 54 injectBuildLogsInOutput: injectBuildLogs); |
| 55 } | 55 } |
| 56 | 56 |
| 57 _readEntrypoints(value) { | 57 readEntrypoints(value) { |
| 58 if (value == null) return null; | 58 if (value == null) return null; |
| 59 var entryPoints = []; | 59 var entryPoints = []; |
| 60 bool error; | 60 bool error; |
| 61 if (value is List) { | 61 if (value is List) { |
| 62 entryPoints = value; | 62 entryPoints = value; |
| 63 error = value.any((e) => e is! String); | 63 error = value.any((e) => e is! String); |
| 64 } else if (value is String) { | 64 } else if (value is String) { |
| 65 entryPoints = [value]; | 65 entryPoints = [value]; |
| 66 error = false; | 66 error = false; |
| 67 } else { | 67 } else { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 [new ImportInliner(options)], | 122 [new ImportInliner(options)], |
| 123 [new ObservableTransformer()], | 123 [new ObservableTransformer()], |
| 124 [new ScriptCompactor(options, sdkDir: sdkDir)], | 124 [new ScriptCompactor(options, sdkDir: sdkDir)], |
| 125 [new PolyfillInjector(options)], | 125 [new PolyfillInjector(options)], |
| 126 [new BuildFilter(options)], | 126 [new BuildFilter(options)], |
| 127 [new BuildLogCombiner(options)], | 127 [new BuildLogCombiner(options)], |
| 128 ]); | 128 ]); |
| 129 } | 129 } |
| 130 | 130 |
| 131 final RegExp _PACKAGE_PATH_REGEX = new RegExp(r'packages\/([^\/]+)\/(.*)'); | 131 final RegExp _PACKAGE_PATH_REGEX = new RegExp(r'packages\/([^\/]+)\/(.*)'); |
| OLD | NEW |