-
Notifications
You must be signed in to change notification settings - Fork 45
Implementation feedback #24
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
Comments
Note #25 is the only critical bug from the process. |
@guybedford this a very valuable feedback. I did a first pass, and fixed some of the cosmetics in PR #26, waiting for @dherman for the heavy stuff. Here are the details:
PR.
PR, renamed to
this one is for @dherman.
I haven't see
PR
the call to
Not sure about this one. @dherman
PR
maybe
PR
all the above is for @dherman
PR |
OK, I started by merging Caridy's PR (thanks Caridy!). Now attempting to make this a task list so I can track my progress:
Fixed by Caridy.
Fixed by Caridy and renamed again in 0916391.
Discussed and resolved below.
No, it's a Source Text Module Record property but I got the name wrong. Fixed in 8758a8a.
Fixed by Caridy.
No, as Caridy explained.
Yeah, seems fine. You can always propagate earlier stage data via metadata. Fixed in fe60901.
Fixed by Caridy.
Defined in de47c19.
Partially fixed by Caridy; needs fix to issue #25.
It's ModuleEvaluation. Fixed in 0a90264.
An instance is either a factory function or a module instance object. The first half of Link() executes all the factory functions, so all we have left are module instance objects.
Confirm. The point of the stage argument is to say you are only requesting it run to a certain point. This gives programmers control over both side effects and performance (e.g. for pre-fetching).
Filed these two as a separate issue #31.
Fixed by Caridy. |
…e previous hook results, stash them in metadata (see issue #24)
@guybedford See the question ^^ |
PS thank you for this detailed review! |
@dherman sure, glad to be able to help! The issue I was referring to in 4.1.5 4 was that // in one scope
entry.instantiate = new Promise(...);
// in another scope
entry.instantiateResolve(value); The only way to resolve a promise from outside its scope of creation is to store the resolve function itself on the entry as above. The suggestion was a code reworking to avoid the need to do this, but it's a code detail not a spec detail so may be irrelevant to the spec. |
@guybedford The reason that has to be exposed is for L.p.provide. Essentially we want to allow frameworks that configure the loader to race it. For example if you have a package already loaded that may provide the source, you can provide it early and race the pre-existing fetch promise. |
@dherman right thanks ok, so this affects all fulfill handlers equally not just that one, and is a key part of the mechanism. I'll fix the implementation this side to handle store all the |
I've got a working implementation at https://github.com/ModuleLoader/es6-module-loader/blob/1.0/src/loader.js (PR ModuleLoader/es-module-loader#317).
Here are some notes of the minor corrections from the process:
return entry.module
in 4.2.3 at the instantiate promise return and a Promise.resolve in the last line of 4.1.4.Surely we just need source and not payload?
_depEntry_ = ensureRegistered(loader, depKey, metadata); if _depEntry_.[[state]] is "ready" then use _depEntry_ for _dep_
Otherwise requestInstantiate throws if the module is already defined
Resolve is not defined?
I also implemented the metadata piping. Having metadata available as soon as the resolve hook runs would really be the ideal here, but does mean that the first resolution takes precedence, which I know may not be ideal for the spec process.
To describe the implementation (for what its worth):
If it would help to provide any of the above as a PR I'd be more than happy to assist, but would rather have the suggestions reviewed at a higher level first.
The text was updated successfully, but these errors were encountered: