| 154 | } |
| 155 | |
| 156 | static getShortestUniqueName(url, script) { |
| 157 | const parts = url.split('/'); |
| 158 | const filename = parts[parts.length -1]; |
| 159 | const dict = this._dict ?? (this._dict = new Map()); |
| 160 | const matchingScripts = dict.get(filename); |
| 161 | if (matchingScripts == undefined) { |
| 162 | dict.set(filename, [script]); |
| 163 | return filename; |
| 164 | } |
| 165 | // TODO: find shortest unique substring |
| 166 | // Update all matching scripts to have a unique filename again. |
| 167 | for (let matchingScript of matchingScripts) { |
| 168 | matchingScript.name = script.url |
| 169 | } |
| 170 | matchingScripts.push(script); |
| 171 | return url; |
| 172 | } |
| 173 | |
| 174 | ensureSourceMapCalculated(sourceMapFetchPrefix=undefined) { |
| 175 | if (this._sourceMapState !== "unknown") return; |