Uh oh!
There was an error while loading. Please reload this page.
working mock test - #39240
Conversation
giltayar
commented
Jul 3, 2021
Looks interesting. Two questions:
|
bmeck
commented
Jul 3, 2021
Per the HTTPS loader PR the actual behavior of
I actually think the problem here is in part my using a MessagePort which wants to asynchronously dispatch events. I generally think we need to move loaders off thread and have faced pushback in the past due to startup penalty of doing so; however, I wrote this with off-thread in mind. Using globals is easier! However, this avoids leaking globals and allows communication to be done in a way that cannot be tampered with or prevented by user code between Loader <-> Preload Code <-> Module Instances. Definitely want to make the API work better so might have to use a different communications API than MessagePort for now. Currently the functions are never passed to the loader via a 1st class reference, they are only passed as a list of exports and the global preload code is managing the first class references. All communication with the loader is done via message ports. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
giltayar
commented
Jul 4, 2021
Yes, but it has enough information to just use
🙏
Of course you're right. And to think I wrote something like this... (well, it was a while ago 😊). So, OK, removing my objection on thread-separated loaders. |
bmeck
commented
Sep 16, 2021
now that consolidation PR is landed, rebasing, looks like we need a slight alteration to handle multiple nesting importMetaCallbacks |
6948c7c to
8eb74efCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
bmeck
commented
Sep 24, 2021
removing draft status since there aren't any pending design comments and hoping to land early next week |
e82f771 to
f584efbComparef584efb to
13ab19eComparenodejs-github-bot
commented
Oct 27, 2021
nodejs-github-bot
commented
Oct 27, 2021
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
Oct 28, 2021
bmeck
commented
Oct 28, 2021
Reading through CI reliability and the failed CI runs, I think the cause for the failures isn't this PR. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Derek Lewis <DerekNonGeneric@inf.is>
Co-authored-by: Geoffrey Booth <456802+GeoffreyBooth@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Geoffrey Booth <456802+GeoffreyBooth@users.noreply.github.com>
nodejs-github-bot
commented
Nov 29, 2021
PR-URL: #39240 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
bmeck
commented
Nov 29, 2021
Landed in 1998e83 |
PR-URL: #39240 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
PR-URL: #39240 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
PR-URL: #39240 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
This PR adds a communications channel for loaders to utilize across global preload code and hooks. It allows communication from the loader directly to references. Currently it is somewhat awkward to use since MessagePort does async events but does solve the global usage in https://dev.to/giltayar/mock-all-you-want-supporting-es-modules-in-the-testdouble-js-mocking-library-3gh1 .
The important bit of this PR is that we add a test for mocking via a reflective API on the main thread.
It does alter the API signature of
getGlobalPreloadCodeand adds a new implicit parameter to change theimport.metainitialization, this can be used to fix the problem with HTTPS imports being done via a loader by allowing a rewrite of theimport.metato the proper value instead of the cache key in the module map.Likely we should iterate on this API since this is more the bare minimum to make things work and not a pleasant API currently.
CC: @nodejs/loaders @giltayar