MCPcopy Create free account
hub / github.com/Rich-Harris/magic-string / generateMap

Method generateMap

src/Bundle.ts:271–286  ·  view source on GitHub ↗
(
    options: BundleSourceMapOptions = {},
  )

Source from the content-addressed store, hash-verified

269 }
270
271 generateMap(
272 options: BundleSourceMapOptions = {},
273 ): Omit<SourceMap, 'sourcesContent'> & { sourcesContent: Array<string | null> } {
274 const encoder = new MappingsEncoder()
275 const mappings = new Mappings(options.hires, encoder)
276 const { names, x_google_ignoreList } = this._generateMappings(mappings)
277
278 // bundle maps always provide sourcesContent, while SourceMap types it as optional
279 return new SourceMap({
280 ...this._mapProperties(options, names, x_google_ignoreList),
281 mappings: encoder.finish(mappings.rawSegments),
282 rangeMappings: mappings.rawRangeMappings,
283 }) as Omit<SourceMap, 'sourcesContent'> & {
284 sourcesContent: Array<string | null>
285 }
286 }
287
288 /** @internal */
289 _generateMappings(mappings: Mappings): { names: string[], x_google_ignoreList: number[] | undefined } {

Callers 7

clone.test.tsFile · 0.45
includeContentFunction · 0.45
clone.test.tsFile · 0.45
mappings.test.tsFile · 0.45

Calls 3

_generateMappingsMethod · 0.95
_mapPropertiesMethod · 0.95
finishMethod · 0.95

Tested by 1

includeContentFunction · 0.36