MCPcopy
hub / github.com/rollup/rollup / collapseSourcemap

Function collapseSourcemap

src/utils/collapseSourcemaps.ts:246–266  ·  view source on GitHub ↗
(
	id: string,
	originalCode: string,
	originalSourcemap: ExistingDecodedSourceMap | null,
	sourcemapChain: readonly DecodedSourceMapOrMissing[],
	log: LogHandler
)

Source from the content-addressed store, hash-verified

244}
245
246export function collapseSourcemap(
247 id: string,
248 originalCode: string,
249 originalSourcemap: ExistingDecodedSourceMap | null,
250 sourcemapChain: readonly DecodedSourceMapOrMissing[],
251 log: LogHandler
252): ExistingDecodedSourceMap | null {
253 if (sourcemapChain.length === 0) {
254 return originalSourcemap;
255 }
256
257 const source = getCollapsedSourcemap(
258 id,
259 originalCode,
260 originalSourcemap,
261 sourcemapChain,
262 getLinkMap(log)
263 ) as Link;
264 const map = source.traceMappings();
265 return decodedSourcemap({ version: 3, ...map });
266}

Callers 1

getCombinedSourcemapFunction · 0.90

Calls 4

decodedSourcemapFunction · 0.90
getCollapsedSourcemapFunction · 0.85
getLinkMapFunction · 0.85
traceMappingsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…