| 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 library pub.barback; | 5 library pub.barback; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:barback/barback.dart'; | 9 import 'package:barback/barback.dart'; |
| 10 import 'package:path/path.dart' as path; | 10 import 'package:path/path.dart' as path; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 '"$key" field must be a string or list, but was "$field".'); | 133 '"$key" field must be a string or list, but was "$field".'); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 var includes = null; | 137 var includes = null; |
| 138 var excludes = null; | 138 var excludes = null; |
| 139 | 139 |
| 140 if (configuration == null) { | 140 if (configuration == null) { |
| 141 configuration = {}; | 141 configuration = {}; |
| 142 } else { | 142 } else { |
| 143 // Don't write to the immutable YAML map. |
| 144 configuration = new Map.from(configuration); |
| 145 |
| 143 // Pull out the exclusions/inclusions. | 146 // Pull out the exclusions/inclusions. |
| 144 includes = parseField("\$include"); | 147 includes = parseField("\$include"); |
| 145 excludes = parseField("\$exclude"); | 148 excludes = parseField("\$exclude"); |
| 146 | 149 |
| 147 // All other keys starting with "$" are unexpected. | 150 // All other keys starting with "$" are unexpected. |
| 148 var reservedKeys = configuration.keys | 151 var reservedKeys = configuration.keys |
| 149 .where((key) => key is String && key.startsWith(r'$')) | 152 .where((key) => key is String && key.startsWith(r'$')) |
| 150 .map((key) => '"$key"'); | 153 .map((key) => '"$key"'); |
| 151 | 154 |
| 152 if (reservedKeys.isNotEmpty) { | 155 if (reservedKeys.isNotEmpty) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 if (parts.length <= index + 1) { | 232 if (parts.length <= index + 1) { |
| 230 throw new FormatException( | 233 throw new FormatException( |
| 231 'Invalid URL path "${url.path}". Expected package name ' | 234 'Invalid URL path "${url.path}". Expected package name ' |
| 232 'after "packages".'); | 235 'after "packages".'); |
| 233 } | 236 } |
| 234 | 237 |
| 235 var package = parts[index + 1]; | 238 var package = parts[index + 1]; |
| 236 var assetPath = path.url.join("lib", path.url.joinAll(parts.skip(index + 2))); | 239 var assetPath = path.url.join("lib", path.url.joinAll(parts.skip(index + 2))); |
| 237 return new AssetId(package, assetPath); | 240 return new AssetId(package, assetPath); |
| 238 } | 241 } |
| OLD | NEW |