diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2023-05-04 01:44:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-04 02:44:59 +0200 |
commit | 7a8bb3b611f02b272b1c19b6f3d8a85b099ca317 (patch) | |
tree | 04d37bb0f8c3fc719b3494114a054f5439733e7a /core/extensions.rs | |
parent | e3276fbb71093faf4e8850f68ed2e080a9bda222 (diff) |
fix(core): allow esm extensions not included in snapshot (#18980)
Fixes #18979.
This changes the predicate for allowing `ext:` specifier resolution from
`snapshot_loaded_and_not_snapshotting` to `ext_resolution_allowed` which
is only set to true during the extension module loading phase. Module
loaders as used in core
are now declared as `ExtModuleLoader` rather than `dyn ModuleLoader`.
Diffstat (limited to 'core/extensions.rs')
-rw-r--r-- | core/extensions.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/extensions.rs b/core/extensions.rs index a8b52eb3b..ba151da3d 100644 --- a/core/extensions.rs +++ b/core/extensions.rs @@ -471,6 +471,16 @@ impl Extension { pub fn disable(self) -> Self { self.enabled(false) } + + pub(crate) fn find_esm( + &self, + specifier: &str, + ) -> Option<&ExtensionFileSource> { + self + .get_esm_sources()? + .iter() + .find(|s| s.specifier == specifier) + } } // Provides a convenient builder pattern to declare Extensions |