| Index: sdk/lib/_internal/pub/lib/src/barback.dart
|
| diff --git a/sdk/lib/_internal/pub/lib/src/barback.dart b/sdk/lib/_internal/pub/lib/src/barback.dart
|
| index 5c99bfa06503de7eee9f432512bc5cd978a1c557..1c703566cb96b003d3db6cc0ca2537600658766b 100644
|
| --- a/sdk/lib/_internal/pub/lib/src/barback.dart
|
| +++ b/sdk/lib/_internal/pub/lib/src/barback.dart
|
| @@ -251,66 +251,3 @@ AssetId specialUrlToId(Uri url) {
|
| var assetPath = path.url.join("lib", path.url.joinAll(parts.skip(index + 2)));
|
| return new AssetId(package, assetPath);
|
| }
|
| -
|
| -/// Converts [id] to a "servable path" for that asset.
|
| -///
|
| -/// This is the root relative URL that could be used to request that asset from
|
| -/// pub serve. It's also the relative path that the asset will be output to by
|
| -/// pub build (except this always returns a path using URL separators).
|
| -///
|
| -/// [entrypoint] is the name of the entrypoint package.
|
| -///
|
| -/// Examples (where [entrypoint] is "myapp"):
|
| -///
|
| -/// myapp|web/index.html -> /index.html
|
| -/// myapp|lib/lib.dart -> /packages/myapp/lib.dart
|
| -/// foo|lib/foo.dart -> /packages/foo/foo.dart
|
| -/// foo|asset/foo.png -> /assets/foo/foo.png
|
| -/// myapp|test/main.dart -> ERROR
|
| -/// foo|web/
|
| -///
|
| -/// Throws a [FormatException] if [id] is not a valid public asset.
|
| -// TODO(rnystrom): Get rid of [useWebAsRoot] once pub serve also serves out of
|
| -// the package root directory.
|
| -String idtoUrlPath(String entrypoint, AssetId id, {bool useWebAsRoot: true}) {
|
| - var parts = path.url.split(id.path);
|
| -
|
| - if (parts.length < 2) {
|
| - throw new FormatException(
|
| - "Can not serve assets from top-level directory.");
|
| - }
|
| -
|
| - // Map "asset" and "lib" to their shared directories.
|
| - var dir = parts[0];
|
| - var rest = parts.skip(1);
|
| -
|
| - if (dir == "asset") {
|
| - return path.url.join("/", "assets", id.package, path.url.joinAll(rest));
|
| - }
|
| -
|
| - if (dir == "lib") {
|
| - return path.url.join("/", "packages", id.package, path.url.joinAll(rest));
|
| - }
|
| -
|
| - if (useWebAsRoot) {
|
| - if (dir != "web") {
|
| - throw new FormatException('Cannot access assets from "$dir".');
|
| - }
|
| -
|
| - if (id.package != entrypoint) {
|
| - throw new FormatException(
|
| - 'Cannot access "web" directory of non-root packages.');
|
| - }
|
| -
|
| - return path.url.join("/", path.url.joinAll(rest));
|
| - }
|
| -
|
| - if (id.package != entrypoint) {
|
| - throw new FormatException(
|
| - 'Can only access "lib" and "asset" directories of non-entrypoint '
|
| - 'packages.');
|
| - }
|
| -
|
| - // Allow any path in the entrypoint package.
|
| - return path.url.join("/", path.url.joinAll(parts));
|
| -}
|
|
|