refactor(compiler): remove asset: urls

These urls were just relicts from Dart.
This commit is contained in:
Tobias Bosch
2016-11-15 10:14:01 -08:00
committed by Chuck Jazdzewski
parent 24099bdbd2
commit 484119e59f
12 changed files with 23 additions and 99 deletions

View File

@ -6,30 +6,9 @@
* found in the LICENSE file at https://angular.io/license
*/
// asset:<package-name>/<realm>/<path-to-module>
const _ASSET_URL_RE = /asset:([^\/]+)\/([^\/]+)\/(.+)/;
/**
* Interface that defines how import statements should be generated.
*/
export abstract class ImportGenerator {
static parseAssetUrl(url: string): AssetUrl { return AssetUrl.parse(url); }
abstract getImportPath(moduleUrlStr: string, importedUrlStr: string): string;
}
export class AssetUrl {
static parse(url: string, allowNonMatching: boolean = true): AssetUrl {
const match = url.match(_ASSET_URL_RE);
if (match !== null) {
return new AssetUrl(match[1], match[2], match[3]);
}
if (allowNonMatching) {
return null;
}
throw new Error(`Url ${url} is not a valid asset: url`);
}
constructor(public packageName: string, public firstLevelDir: string, public modulePath: string) {
}
}

View File

@ -14,7 +14,7 @@ import {AbstractEmitterVisitor, CATCH_ERROR_VAR, CATCH_STACK_VAR, EmitterVisitor
import * as o from './output_ast';
import {ImportGenerator} from './path_util';
const _debugModuleUrl = 'asset://debug/lib';
const _debugModuleUrl = '/debug/lib';
export function debugOutputAstAsTypeScript(ast: o.Statement | o.Expression | o.Type | any[]):
string {