Revert "fix(url_resolver): in Dart make package urls relative to AppRootUrl"

This reverts commit 469afda53e.
This commit is contained in:
Misko Hevery
2015-07-27 14:15:02 -07:00
parent 30bd2a3fc7
commit a2bb81c406
18 changed files with 33 additions and 58 deletions
@@ -1,15 +1,9 @@
library angular2.src.services.url_resolver;
import 'package:angular2/di.dart' show Injectable;
import 'package:angular2/src/services/app_root_url.dart' show AppRootUrl;
@Injectable()
class UrlResolver {
final AppRootUrl _appRootUrl;
UrlResolver(this._appRootUrl);
/**
* Resolves the `url` given the `baseUrl`:
* - when the `url` is null, the `baseUrl` is returned,
@@ -26,8 +20,7 @@ class UrlResolver {
Uri uri = Uri.parse(url);
if (uri.scheme == 'package') {
var maybeSlash = _appRootUrl.value.endsWith('/') ? '' : '/';
return '${_appRootUrl.value}${maybeSlash}packages/${uri.path}';
return '/packages/${uri.path}';
}
if (uri.isAbsolute) return uri.toString();
@@ -7,7 +7,6 @@ import {
normalizeBlank
} from 'angular2/src/facade/lang';
import {ListWrapper} from 'angular2/src/facade/collection';
import {AppRootUrl} from 'angular2/src/services/app_root_url';
/**
* Used by the {@link Compiler} when resolving HTML and CSS template URLs.
@@ -18,8 +17,6 @@ import {AppRootUrl} from 'angular2/src/services/app_root_url';
*/
@Injectable()
export class UrlResolver {
constructor(_: AppRootUrl) {}
/**
* Resolves the `url` given the `baseUrl`:
* - when the `url` is null, the `baseUrl` is returned,
@@ -12,7 +12,6 @@ import 'package:angular2/src/render/dom/compiler/style_url_resolver.dart';
import 'package:angular2/src/render/dom/compiler/view_loader.dart';
import 'package:angular2/src/render/xhr.dart' show XHR;
import 'package:angular2/src/reflection/reflection.dart';
import 'package:angular2/src/services/app_root_url.dart';
import 'package:angular2/src/services/url_resolver.dart';
import 'package:angular2/src/transform/common/asset_reader.dart';
import 'package:angular2/src/transform/common/xhr_impl.dart';
@@ -86,7 +85,7 @@ class _TemplateExtractor {
_TemplateExtractor(XHR xhr)
: _factory = new CompileStepFactory(new ng.Parser(new ng.Lexer())) {
var urlResolver = new UrlResolver(new AppRootUrl(''));
var urlResolver = new UrlResolver();
var styleUrlResolver = new StyleUrlResolver(urlResolver);
var styleInliner = new StyleInliner(xhr, styleUrlResolver, urlResolver);