feat(dart/transform): Allow absolute urls in templates
Allow `templateUrl` to be specified as an absolute `package:` import.
This commit is contained in:
@ -14,7 +14,8 @@ class XhrImpl implements XHR {
|
||||
XhrImpl(this._reader, this._entryPoint);
|
||||
|
||||
Future<String> get(String url) async {
|
||||
var assetId = uriToAssetId(_entryPoint, url, logger, null);
|
||||
var assetId = uriToAssetId(_entryPoint, url, logger, null /* span */,
|
||||
errorOnAbsolute: false);
|
||||
var templateExists = await _reader.hasInput(assetId);
|
||||
if (!templateExists) {
|
||||
logger.error('Could not read template at uri $url from $_entryPoint');
|
||||
|
@ -113,7 +113,8 @@ Future<Map<UriBasedDirective, String>> _processNgImports(AssetReader reader,
|
||||
.map((UriBasedDirective directive) {
|
||||
var ngDepsUri = _toDepsUri(stringLiteralToString(directive.uri));
|
||||
var spanArg = null;
|
||||
var ngDepsAsset = uriToAssetId(entryPoint, ngDepsUri, logger, spanArg);
|
||||
var ngDepsAsset = uriToAssetId(entryPoint, ngDepsUri, logger, spanArg,
|
||||
errorOnAbsolute: false);
|
||||
if (ngDepsAsset == entryPoint) return nullFuture;
|
||||
return reader.hasInput(ngDepsAsset).then((hasInput) {
|
||||
if (hasInput) {
|
||||
|
@ -37,7 +37,8 @@ Future<Map<String, DirectiveMetadata>> _extractDirectiveMetadataRecursive(
|
||||
if (uri.startsWith('dart:')) return _nullFuture;
|
||||
|
||||
uri = toDepsExtension(uri);
|
||||
var assetId = uriToAssetId(entryPoint, uri, logger, null /* span */);
|
||||
var assetId = uriToAssetId(entryPoint, uri, logger, null /* span */,
|
||||
errorOnAbsolute: false);
|
||||
if (assetId == entryPoint) return _nullFuture;
|
||||
return _extractDirectiveMetadataRecursive(reader, assetId)
|
||||
.then((exportMap) {
|
||||
|
@ -97,8 +97,9 @@ class _ViewDefinitionCreator {
|
||||
var prefix = node.prefix != null && node.prefix.name != null
|
||||
? '${node.prefix.name}'
|
||||
: null;
|
||||
importAssetToPrefix[
|
||||
uriToAssetId(entryPoint, uri, logger, null /* span */)] = prefix;
|
||||
importAssetToPrefix[uriToAssetId(
|
||||
entryPoint, uri, logger, null /* span */,
|
||||
errorOnAbsolute: false)] = prefix;
|
||||
}
|
||||
}
|
||||
return importAssetToPrefix;
|
||||
|
Reference in New Issue
Block a user