| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Review requested:
|
Sorry, something went wrong.
Codecov Report❌ Patch coverage is 77.21519% with 18 lines in your changes missing coverage. Please review.
@@ Coverage Diff @@
## main #58886 +/- ##
==========================================
- Coverage 90.10% 90.08% -0.03%
==========================================
Files 640 640
Lines 188493 188502 +9
Branches 36971 36977 +6
==========================================
- Hits 169843 169805 -38
- Misses 11358 11428 +70
+ Partials 7292 7269 -23
... and 44 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
Sorry, something went wrong.
That's not how I interpret the spec, AFAICT the spec says nothing about what the behavior should if they are different. If specifier and/or moduleRequest is different, the return value may or may not be different – e.g. import('fs') === import('node:fs'). |
Sorry, something went wrong.
The spec didn't say the two specifier may be mapped to a single module. The issue is that, if a loader resolves a single specifier with different import attributes, to two modules, the current implementation take the latter because the cache is keyed by specifier only. If a loader interprets additional attributes, like: import * as secret1 from 'a-json-package' with { type: 'json', integrity: 'frozen' };
import * as secret2 from 'a-json-package' with { type: 'json' };This will be problematic because both namespaces secret1 and secret2 refer to the same mutable second resolution result. This is linked in https://github.com/tc39/proposal-import-attributes?tab=readme-ov-file#how-would-this-proposal-work-with-caching that the attributes should be part of the module cache key. |
Sorry, something went wrong.
There was a problem hiding this comment.
This definitely better aligns with the specification, thanks for doing this work.
Sorry, something went wrong.
There was a problem hiding this comment.
I wasn't aware of a convention to import Module instead of module here. What makes Module different from other core libs here? Seems it should use the same casing unless there is a good reason.
Sorry, something went wrong.
There was a problem hiding this comment.
It's just my preference lasted from CJS that to prevent name collision with CJS module.
Sorry, something went wrong.
There was a problem hiding this comment.
In node:module, module.exports = Module, so the default export is also the Module constructor.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
|
@aduh95 @guybedford @joyeecheung updated PR to use hash+equality caching. PTAL again, thanks! |
Sorry, something went wrong.
Sorry, something went wrong.
|
I think we might still be able to avoid the extra string storage & transcoding with cppgc-managed wrappers; but that's probably a task for another PR. |
Sorry, something went wrong.
Sorry, something went wrong.
When a module is being statically linked with module requests, if two module requests with a same specifier but different attributes are resolved to two modules, the module requests should be linked to these two modules.
Sorry, something went wrong.
When a module is being statically linked with module requests, if two module requests with a same specifier but different attributes are resolved to two modules, the module requests should be linked to these two modules. PR-URL: #58886 Refs: https://tc39.es/ecma262/#sec-HostLoadImportedModule Refs: https://github.com/tc39/proposal-import-attributes?tab=readme-ov-file#how-would-this-proposal-work-with-caching Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
|
This doesn't land cleanly on v22.x-staging |
Sorry, something went wrong.
When a module is being statically linked with module requests, if two module requests with a same specifier but different attributes are resolved to two modules, the module requests should be linked to these two modules. PR-URL: #58886 Backport-PR-URL: #60000 Refs: https://tc39.es/ecma262/#sec-HostLoadImportedModule Refs: https://github.com/tc39/proposal-import-attributes?tab=readme-ov-file#how-would-this-proposal-work-with-caching Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
| Back | FazBrowse Home | New Git URL |
When a module is being statically linked with module requests, if two
module requests with a same specifier but different attributes are
resolved to two modules, the module requests should be linked to these
two modules.
For example,
should result in two different module instances, if the second import
is been evaluated as a CommonJS/ESM module by a loader.
ECMA-262 requires that in HostLoadImportedModule, if the operation is called
multiple times with two (referrer, moduleRequest) pairs, it should return the same
result. But if the moduleRequest is different, and the module loader resolves to
different module instances, it should return different module instances.
Refs: https://tc39.es/ecma262/#sec-HostLoadImportedModule
Refs: https://github.com/tc39/proposal-import-attributes?tab=readme-ov-file#how-would-this-proposal-work-with-caching