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