(source: Source)
| 662 | } |
| 663 | |
| 664 | private async _addSource(source: Source) { |
| 665 | // todo: we should allow the same source at multiple uri's if their scripts |
| 666 | // have different executionContextId. We only really need the overwrite |
| 667 | // behavior in Node for tools that transpile sources inline. |
| 668 | const existingByUrl = source.url && this._sourceByOriginalUrl.get(source.url); |
| 669 | if (existingByUrl && !isOriginalSourceOf(existingByUrl, source)) { |
| 670 | this.removeSource(existingByUrl, true); |
| 671 | } |
| 672 | |
| 673 | this._sourceByOriginalUrl.set(source.url, source); |
| 674 | this._sourceByReference.set(source.sourceReference, source); |
| 675 | if (source instanceof SourceFromMap) { |
| 676 | this._sourceMapSourcesByUrl.set(source.url, source); |
| 677 | } |
| 678 | |
| 679 | // Some builds, like the Vue starter, generate 'metadata' files for compiled |
| 680 | // files with query strings appended to deduplicate them, or nested inside |
| 681 | // of internal prefixes. If we see a duplicate entries for an absolute path, |
| 682 | // take the shorter of them. |
| 683 | const existingByPath = this._sourceByAbsolutePath.get(source.absolutePath); |
| 684 | if ( |
| 685 | existingByPath === undefined |
| 686 | || existingByPath.url.length >= source.url.length |
| 687 | || isOriginalSourceOf(existingByPath, source) |
| 688 | ) { |
| 689 | this._sourceByAbsolutePath.set(source.absolutePath, source); |
| 690 | } |
| 691 | |
| 692 | this.scriptSkipper.initializeSkippingValueForSource(source); |
| 693 | if (!source.sendLazy) { |
| 694 | this.emitLoadedSource(source); |
| 695 | } |
| 696 | |
| 697 | if (isSourceWithSourceMap(source)) { |
| 698 | this._finishAddSourceWithSourceMap(source); |
| 699 | } else if (isSourceWithWasm(source)) { |
| 700 | this._finishAddSourceWithWasm(source as WasmSource); |
| 701 | } |
| 702 | } |
| 703 | |
| 704 | private async _finishAddSourceWithWasm(compiled: WasmSource) { |
| 705 | const symbols = await this.wasmSymbols.loadWasmSymbols(compiled.event); |
no test coverage detected