本文整理匯總了TypeScript中polymer-analyzer.Analyzer.load方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Analyzer.load方法的具體用法?TypeScript Analyzer.load怎麽用?TypeScript Analyzer.load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類polymer-analyzer.Analyzer
的用法示例。
在下文中一共展示了Analyzer.load方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getExistingSourcemap
export async function getExistingSourcemap(
analyzer: Analyzer, sourceUrl: string, sourceContent: string) {
const sourceMappingUrlParts = sourceContent.match(sourceMappingUrlExpr);
if (sourceMappingUrlParts === null) {
return null;
}
let sourcemap: RawSourceMap;
let mapUrl = sourceUrl;
const inlineSourcemapParts =
sourceMappingUrlParts[1].match(inlineSourceMapExpr);
if (inlineSourcemapParts !== null) {
sourcemap = base64StringToRawSourceMap(inlineSourcemapParts[2]);
} else {
mapUrl = urlLib.resolve(sourceUrl, sourceMappingUrlParts[1].trim());
sourcemap =
JSON.parse(await analyzer.load(mapUrl as ResolvedUrl)) as RawSourceMap;
}
// Rewrite the sources array to be relative to the current URL
if (sourcemap.sources) {
sourcemap.sources =
sourcemap.sources.map((source) => urlLib.resolve(mapUrl, source));
}
return sourcemap;
}
示例2: assertFileEdited
export async function assertFileEdited(
analyzer: Analyzer,
editResult: EditResult,
inputFile: string,
goldenFile: string) {
assert.deepEqual(
editResult.editedFiles.get(analyzer.resolveUrl(inputFile)!),
(await analyzer.load(analyzer.resolveUrl(goldenFile)!)));
}