* 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)
| 242 | * Useful if you need to manipulate the sourcemap further, but most of the time you will use `generateMap` instead. |
| 243 | */ |
| 244 | generateDecodedMap(options?: SourceMapOptions): DecodedSourceMap { |
| 245 | options = options || {} |
| 246 | |
| 247 | const sourceIndex = 0 |
| 248 | const names = Object.keys(this.storedNames) |
| 249 | const mappings = new Mappings(options.hires) |
| 250 | |
| 251 | const locate = getLocator(this.original) |
| 252 | |
| 253 | if (this.intro) { |
| 254 | mappings.advance(this.intro) |
| 255 | } |
| 256 | |
| 257 | this.firstChunk.eachNext((chunk) => { |
| 258 | const loc = locate(chunk.start) |
| 259 | |
| 260 | if (chunk.intro.length) |
| 261 | mappings.advance(chunk.intro) |
| 262 | |
| 263 | if (chunk.edited) { |
| 264 | mappings.addEdit( |
| 265 | sourceIndex, |
| 266 | chunk.content, |
| 267 | loc, |
| 268 | chunk.storeName ? names.indexOf(chunk.original) : -1, |
| 269 | ) |
| 270 | } |
| 271 | else { |
| 272 | mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations) |
| 273 | } |
| 274 | |
| 275 | if (chunk.outro.length) |
| 276 | mappings.advance(chunk.outro) |
| 277 | }) |
| 278 | |
| 279 | if (this.outro) { |
| 280 | mappings.advance(this.outro) |
| 281 | } |
| 282 | |
| 283 | return { |
| 284 | file: options.file ? options.file.split(/[/\\]/).pop() : undefined, |
| 285 | sources: [ |
| 286 | options.source ? getRelativePath(options.file || '', options.source) : options.file || '', |
| 287 | ], |
| 288 | sourcesContent: options.includeContent ? [this.original] : undefined, |
| 289 | names, |
| 290 | mappings: mappings.raw, |
| 291 | x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined, |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | /** |
| 296 | * Generates a version 3 sourcemap. |
no test coverage detected