@webhandle/external-resource-manager 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -39,6 +39,11 @@ export default class ExternalResourceManager {
|
|
|
39
39
|
* of the URLs we've already rendered here.
|
|
40
40
|
*/
|
|
41
41
|
alreadyRenderedUrls = new Set()
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* To make sure we don't provide a resource twice, track which ones we've already provided.
|
|
45
|
+
*/
|
|
46
|
+
alreadyProvidedNames = new Set()
|
|
42
47
|
|
|
43
48
|
constructor(options) {
|
|
44
49
|
Object.assign(this, options)
|
|
@@ -9,8 +9,13 @@ export default function createImportmapGenerator(webhandle) {
|
|
|
9
9
|
if(resource.rendered) {
|
|
10
10
|
continue
|
|
11
11
|
}
|
|
12
|
-
found = true
|
|
13
12
|
|
|
13
|
+
if(manager.alreadyProvidedNames.has('module:' + resource.name)) {
|
|
14
|
+
resource.rendered = true
|
|
15
|
+
continue
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
found = true
|
|
14
19
|
if(resource.data && !resource.url) {
|
|
15
20
|
let content = `export default ${JSON.stringify(resource.data)}`
|
|
16
21
|
let url = `data:text/javascript,${content}`
|
|
@@ -28,6 +33,7 @@ export default function createImportmapGenerator(webhandle) {
|
|
|
28
33
|
}
|
|
29
34
|
if (resource.mimeType === 'application/javascript' && resource.resourceType === 'module') {
|
|
30
35
|
imports[resource.name] = vrsc + resource.url
|
|
36
|
+
manager.alreadyProvidedNames.add('module:' + resource.name)
|
|
31
37
|
}
|
|
32
38
|
}
|
|
33
39
|
|