Chromium Code Reviews| 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 configuration = new Map.from(configuration); | |
|
Bob Nystrom
2014/06/03 00:33:14
Document this.
Also, a nit, but can you add a bla
nweiz
2014/06/03 02:03:21
Done.
| |
| 143 // Pull out the exclusions/inclusions. | 144 // Pull out the exclusions/inclusions. |
| 144 includes = parseField("\$include"); | 145 includes = parseField("\$include"); |
| 145 excludes = parseField("\$exclude"); | 146 excludes = parseField("\$exclude"); |
| 146 | 147 |
| 147 // All other keys starting with "$" are unexpected. | 148 // All other keys starting with "$" are unexpected. |
| 148 var reservedKeys = configuration.keys | 149 var reservedKeys = configuration.keys |
| 149 .where((key) => key is String && key.startsWith(r'$')) | 150 .where((key) => key is String && key.startsWith(r'$')) |
| 150 .map((key) => '"$key"'); | 151 .map((key) => '"$key"'); |
| 151 | 152 |
| 152 if (reservedKeys.isNotEmpty) { | 153 if (reservedKeys.isNotEmpty) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 if (parts.length <= index + 1) { | 230 if (parts.length <= index + 1) { |
| 230 throw new FormatException( | 231 throw new FormatException( |
| 231 'Invalid URL path "${url.path}". Expected package name ' | 232 'Invalid URL path "${url.path}". Expected package name ' |
| 232 'after "packages".'); | 233 'after "packages".'); |
| 233 } | 234 } |
| 234 | 235 |
| 235 var package = parts[index + 1]; | 236 var package = parts[index + 1]; |
| 236 var assetPath = path.url.join("lib", path.url.joinAll(parts.skip(index + 2))); | 237 var assetPath = path.url.join("lib", path.url.joinAll(parts.skip(index + 2))); |
| 237 return new AssetId(package, assetPath); | 238 return new AssetId(package, assetPath); |
| 238 } | 239 } |
| OLD | NEW |