本文整理匯總了TypeScript中source-map.SourceMapGenerator.addMapping方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript SourceMapGenerator.addMapping方法的具體用法?TypeScript SourceMapGenerator.addMapping怎麽用?TypeScript SourceMapGenerator.addMapping使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類source-map.SourceMapGenerator
的用法示例。
在下文中一共展示了SourceMapGenerator.addMapping方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should properly combine mapped characters from same source', () => {
generator.addMapping(
{generated: {line: 1, column: 0}, original: {line: 1, column: 0}, source: './origin-a.ts'});
generator.addMapping(
{generated: {line: 1, column: 1}, original: {line: 1, column: 0}, source: './origin-b.ts'});
generator.addMapping({
generated: {line: 1, column: 2},
original: {line: 10, column: 0},
source: './origin-a.ts'
});
// A => origin-a (1 byte), B => origin-b (two bytes)
const mapPath = writeFile('/test.map', generator.toString());
const inputPath = writeFile('/test.js', `ABB`);
const {sizeResult} = new SizeTracker(inputPath, mapPath);
expect(sizeResult.unmapped).toBe(0);
expect(sizeResult.files).toEqual({
size: 3,
'origin-a.ts': 2,
'origin-b.ts': 1,
});
});