| 79 | const btoa = /* #__PURE__ */ getBtoa() |
| 80 | |
| 81 | export default class SourceMap { |
| 82 | declare version: number |
| 83 | declare file: string | undefined |
| 84 | declare sources: string[] |
| 85 | declare sourcesContent: Array<string | null> | undefined |
| 86 | declare names: string[] |
| 87 | declare mappings: string |
| 88 | declare x_google_ignoreList: number[] | undefined |
| 89 | declare debugId: string | undefined |
| 90 | declare rangeMappings: string | undefined |
| 91 | |
| 92 | constructor(properties: DecodedSourceMap) { |
| 93 | this.version = 3 |
| 94 | this.file = properties.file |
| 95 | this.sources = properties.sources |
| 96 | this.sourcesContent = properties.sourcesContent |
| 97 | this.names = properties.names |
| 98 | this.mappings = encode(properties.mappings) |
| 99 | if (typeof properties.x_google_ignoreList !== 'undefined') { |
| 100 | this.x_google_ignoreList = properties.x_google_ignoreList |
| 101 | } |
| 102 | if (typeof properties.debugId !== 'undefined') { |
| 103 | this.debugId = properties.debugId |
| 104 | } |
| 105 | if (typeof properties.rangeMappings !== 'undefined') { |
| 106 | let shouldOutputRangeMapping = false |
| 107 | for (const line of properties.rangeMappings) { |
| 108 | if (line.length !== 0) { |
| 109 | shouldOutputRangeMapping = true |
| 110 | break |
| 111 | } |
| 112 | } |
| 113 | if (shouldOutputRangeMapping) { |
| 114 | this.rangeMappings = encodeRangeMappings(properties.rangeMappings) |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * Returns the equivalent of `JSON.stringify(map)` |
| 121 | */ |
| 122 | toString(): string { |
| 123 | return JSON.stringify(this) |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Returns a DataURI containing the sourcemap. Useful for doing this sort of thing: |
| 128 | * `generateMap(options?: SourceMapOptions): SourceMap;` |
| 129 | */ |
| 130 | toUrl(): string { |
| 131 | return `data:application/json;charset=utf-8;base64,${btoa(this.toString())}` |
| 132 | } |
| 133 | } |
nothing calls this directly
no outgoing calls
no test coverage detected