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 'package:barback/barback.dart'; | 7 import 'package:barback/barback.dart'; |
8 import 'package:path/path.dart' as p; | 8 import 'package:path/path.dart' as p; |
9 | 9 |
10 import 'version.dart'; | 10 import 'version.dart'; |
(...skipping 20 matching lines...) Expand all Loading... |
31 /// because most barback features need additional serialization code to be fully | 31 /// because most barback features need additional serialization code to be fully |
32 /// supported in pub, even if they're otherwise backwards-compatible. | 32 /// supported in pub, even if they're otherwise backwards-compatible. |
33 /// | 33 /// |
34 /// Whenever a new minor or patch version of barback is published, this *must* | 34 /// Whenever a new minor or patch version of barback is published, this *must* |
35 /// be incremented to synchronize with that. See the barback [compatibility | 35 /// be incremented to synchronize with that. See the barback [compatibility |
36 /// documentation][compat] for details on the relationship between this | 36 /// documentation][compat] for details on the relationship between this |
37 /// constraint and barback's version. | 37 /// constraint and barback's version. |
38 /// | 38 /// |
39 /// [compat]: https://gist.github.com/nex3/10942218 | 39 /// [compat]: https://gist.github.com/nex3/10942218 |
40 final pubConstraints = { | 40 final pubConstraints = { |
41 "barback": new VersionConstraint.parse(">=0.13.0 <0.14.2"), | 41 "barback": new VersionConstraint.parse(">=0.13.0 <0.14.3"), |
42 "source_maps": new VersionConstraint.parse(">=0.9.0 <0.10.0"), | 42 "source_span": new VersionConstraint.parse(">=1.0.0 <2.0.0"), |
43 "stack_trace": new VersionConstraint.parse(">=0.9.1 <2.0.0") | 43 "stack_trace": new VersionConstraint.parse(">=0.9.1 <2.0.0") |
44 }; | 44 }; |
45 | 45 |
46 /// Converts [id] to a "package:" URI. | 46 /// Converts [id] to a "package:" URI. |
47 /// | 47 /// |
48 /// This will throw an [ArgumentError] if [id] doesn't represent a library in | 48 /// This will throw an [ArgumentError] if [id] doesn't represent a library in |
49 /// `lib/`. | 49 /// `lib/`. |
50 Uri idToPackageUri(AssetId id) { | 50 Uri idToPackageUri(AssetId id) { |
51 if (!id.path.startsWith('lib/')) { | 51 if (!id.path.startsWith('lib/')) { |
52 throw new ArgumentError("Asset id $id doesn't identify a library."); | 52 throw new ArgumentError("Asset id $id doesn't identify a library."); |
(...skipping 28 matching lines...) Expand all Loading... |
81 if (parts.length <= index + 1) { | 81 if (parts.length <= index + 1) { |
82 throw new FormatException( | 82 throw new FormatException( |
83 'Invalid URL path "${url.path}". Expected package name ' | 83 'Invalid URL path "${url.path}". Expected package name ' |
84 'after "packages".'); | 84 'after "packages".'); |
85 } | 85 } |
86 | 86 |
87 var package = parts[index + 1]; | 87 var package = parts[index + 1]; |
88 var assetPath = p.url.join("lib", p.url.joinAll(parts.skip(index + 2))); | 88 var assetPath = p.url.join("lib", p.url.joinAll(parts.skip(index + 2))); |
89 return new AssetId(package, assetPath); | 89 return new AssetId(package, assetPath); |
90 } | 90 } |
OLD | NEW |