Re: [w3ctag/design-reviews] Multiple import maps (Issue #980)

> The spec PR seems to be a little out of sync with what you just said (it's written in the usual impenetrable language, so I'm not 100% here) with what you say. It says something about the map being fixed and then propagated throughout each top-level module load.

Good catch. I [removed](https://github.com/whatwg/html/pull/10528/commits/c8694e38ca9e064bae52569b7ce9c658c121f356) that processing model, but left in an inaccurate [note](https://whatpr.org/html/10528/webappapis.html#:~:text=Modules%20further%20down%20the%20tree%20will%20be%20resolved%20using%20a%20copied%20import%20map%20that%20will%20be%20threaded%20through.%20That%20is%20done%20to%20guarantee%20that%20once%20we%20started%20parsing%20a%20module%20graph%2C%20the%20entire%20graph%20would%20be%20resolved%20using%20the%20same%20import%20map.). I'll fix that.



> > > If a mapping is used, but does not resolve successfully (perhaps because no mapping exists) is that a state that needs to persist? Why is that safe?
> 
> I think that you indirectly answered this one with your non-determinism answer. My question, expanded:
> 
> It appears as though there is a requirement that the map, once queried, cannot change. Does that apply only in cases where the query results in a successful resolution, or does it apply in other cases:
> 
> 1. An attempt is made to load "foo" and "foo" doesn't exist in the map.  Does that mean that a future addition to the map cannot add a mapping for "foo"?
> 2. An attempt is made to load "foo" and "foo" exists in the map, but the resolution fails (an HTTP 404 error on the indicated resource, say).  Does that make "foo" available for overriding in a future addition to the map?
> 
> These are not particularly obvious to me from the explanatory material, though I'll admit to not having gone through all of your updated examples.

Good points! The [addition of a module to the resolved module set](https://whatpr.org/html/10528/webappapis.html#add-module-to-resolved-module-set) happens when the [module is resolved](https://whatpr.org/html/10528/webappapis.html#resolve-a-module-specifier), but before any import map rules are applied.
So you're right, and failed resolution attempts would end up preventing future rules from being set for these specifiers.

That doesn't seem like what we'd want here. I'll change the addition to only happen after a successful import map resolution (if any).

At the same time, for 404s, I don't think we should change future resolution for them, as they were properly resolved.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/980#issuecomment-2415676275
You are receiving this because you are subscribed to this thread.

Message ID: <w3ctag/design-reviews/issues/980/2415676275@github.com>

Received on Wednesday, 16 October 2024 03:56:37 UTC