-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
module: ensure successful dynamic import returns the same result #46662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
0f1fe00
3bf7e02
9f36bf7
aabe393
be69edd
dd06864
631d7c6
c279d18
56a8a07
abf105a
00ea14c
a791dc9
3638858
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -44,17 +44,21 @@ class ResolveCache extends SafeMap { | |||||
| ','); | ||||||
| } | ||||||
|
|
||||||
| #getInternalCache(parentURL) { | ||||||
|
aduh95 marked this conversation as resolved.
Outdated
|
||||||
| let internalCache = super.get(parentURL); | ||||||
| if (internalCache == null) { | ||||||
| super.set(parentURL, internalCache = { __proto__: null }); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
And associated changes.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not going to do that in this PR, if
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough. @JakobJingleheimer if you still do a refactor after this, maybe add this to the list of improvements? |
||||||
| } | ||||||
| return internalCache; | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * @param {string} serializedKey | ||||||
| * @param {string} parentURL | ||||||
| * @returns {import('./loader').ModuleExports | Promise<import('./loader').ModuleExports>} | ||||||
| */ | ||||||
| get(serializedKey, parentURL) { | ||||||
| let internalCache = super.get(parentURL); | ||||||
| if (internalCache == null) { | ||||||
| super.set(parentURL, internalCache = { __proto__: null }); | ||||||
| } | ||||||
| return internalCache[serializedKey]; | ||||||
| return this.#getInternalCache(parentURL)[serializedKey]; | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
|
|
@@ -63,20 +67,12 @@ class ResolveCache extends SafeMap { | |||||
| * @param {{ format: string, url: URL['href'] }} result | ||||||
| */ | ||||||
| set(serializedKey, parentURL, result) { | ||||||
| let internalCache = super.get(parentURL); | ||||||
| if (internalCache == null) { | ||||||
| super.set(parentURL, internalCache = { __proto__: null }); | ||||||
| } | ||||||
| internalCache[serializedKey] = result; | ||||||
| this.#getInternalCache(parentURL)[serializedKey] = result; | ||||||
| return this; | ||||||
| } | ||||||
|
|
||||||
| has(serializedKey, parentURL) { | ||||||
| let internalCache = super.get(parentURL); | ||||||
| if (internalCache == null) { | ||||||
| super.set(parentURL, internalCache = { __proto__: null }); | ||||||
| } | ||||||
| return serializedKey in internalCache; | ||||||
| return serializedKey in this.#getInternalCache(parentURL); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.