本文整理匯總了TypeScript中polymer-analyzer.PackageUrlResolver類的典型用法代碼示例。如果您正苦於以下問題:TypeScript PackageUrlResolver類的具體用法?TypeScript PackageUrlResolver怎麽用?TypeScript PackageUrlResolver使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了PackageUrlResolver類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: configureAnalyzer
/**
* Configure a basic analyzer instance for the workspace.
*/
function configureAnalyzer(options: WorkspaceConversionSettings) {
const workspaceDir = options.workspaceDir;
const urlResolver = new PackageUrlResolver({packageDir: workspaceDir});
const urlLoader = new InMemoryOverlayUrlLoader(new FsUrlLoader(workspaceDir));
for (const [url, contents] of polymerFileOverrides) {
urlLoader.urlContentsMap.set(
urlResolver.resolve(`polymer/${url}` as ResolvedUrl)!, contents);
}
return new Analyzer({
urlLoader,
urlResolver,
});
}
示例2: inMemoryAnalyzer
export function inMemoryAnalyzer(files: {[key: string]: string}): Analyzer {
const inMemoryLoader = new InMemoryOverlayUrlLoader();
const urlResolver = new PackageUrlResolver({packageDir: '/memory/'});
for (const packageUrl in files) {
if (!files.hasOwnProperty(packageUrl)) {
continue;
}
const content = files[packageUrl];
const resolvedUrl = urlResolver.resolve(packageUrl as PackageRelativeUrl)!;
inMemoryLoader.urlContentsMap.set(resolvedUrl, heredoc`${content}`);
}
const analyzer = new Analyzer({urlLoader: inMemoryLoader, urlResolver});
return analyzer;
}