* Generates a sourcemap object with raw mappings in array form, rather than encoded as a string. * Useful if you need to manipulate the sourcemap further, but most of the time you will use `generateMap` instead.
(options?: SourceMapOptions)
| 335 | * Useful if you need to manipulate the sourcemap further, but most of the time you will use `generateMap` instead. |
| 336 | */ |
| 337 | generateDecodedMap(options?: SourceMapOptions): DecodedSourceMap { |
| 338 | options = options || {} |
| 339 | |
| 340 | const sourceIndex = 0 |
| 341 | const names = Object.keys(this.storedNames) |
| 342 | const mappings = new Mappings(options.hires) |
| 343 | |
| 344 | const locate = getLocator(this.original) |
| 345 | |
| 346 | if (this.intro) { |
| 347 | mappings.advance(this.intro) |
| 348 | } |
| 349 | |
| 350 | this.firstChunk.eachNext((chunk) => { |
| 351 | const loc = locate(chunk.start) |
| 352 | |
| 353 | if (chunk.intro.length) |
| 354 | mappings.advance(chunk.intro) |
| 355 | |
| 356 | if (chunk.edited) { |
| 357 | mappings.addEdit( |
| 358 | sourceIndex, |
| 359 | chunk.content, |
| 360 | loc, |
| 361 | chunk.storeName ? names.indexOf(chunk.original) : -1, |
| 362 | ) |
| 363 | } |
| 364 | else { |
| 365 | mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations) |
| 366 | } |
| 367 | |
| 368 | if (chunk.outro.length) |
| 369 | mappings.advance(chunk.outro) |
| 370 | }) |
| 371 | |
| 372 | if (this.outro) { |
| 373 | mappings.advance(this.outro) |
| 374 | } |
| 375 | |
| 376 | return { |
| 377 | file: options.file ? options.file.split(/[/\\]/).pop() : undefined, |
| 378 | sources: [ |
| 379 | options.source ? getRelativePath(options.file || '', options.source) : options.file || '', |
| 380 | ], |
| 381 | sourcesContent: options.includeContent ? [this.original] : undefined, |
| 382 | names, |
| 383 | mappings: mappings.raw, |
| 384 | x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined, |
| 385 | rangeMappings: mappings.rawRangeMappings, |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | /** |
| 390 | * Generates a version 3 sourcemap. |
no test coverage detected