Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: pkg/polymer/lib/src/build/common.dart

Issue 151893003: Use a transformer to initialize custom elements and call initMethod. This is the (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/polymer/example/canonicalization3/lib/b.dart ('k') | pkg/polymer/lib/src/build/script_compactor.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..516c02cf3bfcde16f1733cfff64223df2849080a 100644
--- a/pkg/polymer/lib/src/build/common.dart
+++ b/pkg/polymer/lib/src/build/common.dart
@@ -117,13 +117,26 @@ 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 [source] is Dart file (has a .dart extension).
+ */
// TODO(sigmund): delete once this is part of barback (dartbug.com/12610)
AssetId resolve(AssetId source, String url, TransformLogger logger, Span span) {
if (url == null || url == '') return null;
var uri = Uri.parse(url);
var urlBuilder = path.url;
if (uri.host != '' || uri.scheme != '' || urlBuilder.isAbsolute(url)) {
+ if (source.extension == '.dart' && 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;
}
« no previous file with comments | « pkg/polymer/example/canonicalization3/lib/b.dart ('k') | pkg/polymer/lib/src/build/script_compactor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698