Chromium Code Reviews| Index: pkg/polymer/lib/src/build/common.dart |
| diff --git a/pkg/polymer/lib/src/build/common.dart b/pkg/polymer/lib/src/build/common.dart |
| index 1b27f55cd2f9e3c1617fdb114aad6fe8342dacf7..85714310c7ad6e7224d554b341513dc33ea69164 100644 |
| --- a/pkg/polymer/lib/src/build/common.dart |
| +++ b/pkg/polymer/lib/src/build/common.dart |
| @@ -117,13 +117,27 @@ abstract class PolymerTransformer { |
| String toString() => 'polymer ($runtimeType)'; |
| } |
| -/** Create an [AssetId] for a [url] seen in the [source] asset. */ |
| +/** |
| + * Create an [AssetId] for a [url] seen in the [source] asset. By default this |
| + * is used to resolve relative urls that occur in HTML assets, including |
| + * cross-package urls of the form "packages/foo/bar.html". Dart-style "package:" |
| + * urls are not resolved unless [allowPackageColonUrls] is set. |
| + */ |
| // TODO(sigmund): delete once this is part of barback (dartbug.com/12610) |
| -AssetId resolve(AssetId source, String url, TransformLogger logger, Span span) { |
| +AssetId resolve(AssetId source, String url, TransformLogger logger, Span span, |
|
Jennifer Messerly
2014/02/03 19:09:32
instead of allowPackageColonUrls, is there a way w
Siggi Cherem (dart-lang)
2014/02/04 00:20:35
We could. This also gave me another idea. I can ch
Jennifer Messerly
2014/02/04 00:37:40
Love it!
|
| + {bool allowPackageColonUrls: false}) { |
| if (url == null || url == '') return null; |
| var uri = Uri.parse(url); |
| var urlBuilder = path.url; |
| if (uri.host != '' || uri.scheme != '' || urlBuilder.isAbsolute(url)) { |
| + if (allowPackageColonUrls && uri.scheme == 'package') { |
| + var index = uri.path.indexOf('/'); |
| + if (index != -1) { |
| + return new AssetId(uri.path.substring(0, index), |
| + 'lib${uri.path.substring(index)}'); |
| + } |
| + } |
| + |
| logger.error('absolute paths not allowed: "$url"', span: span); |
| return null; |
| } |