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