diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-02-20 01:11:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-20 01:11:56 +0100 |
commit | a1cd2a5915c13f6a9b8eafa3807e143a02616bc1 (patch) | |
tree | f99a6983e790797abb143d333ca3551d0b414552 /core/runtime.rs | |
parent | a01af067d79e78ea8e2c21cf0ef92d86d425f8eb (diff) |
refactor(core): definition of "ExtensionFileSource" (#17823)
This commit changes definition of "ExtensionFileSource", by changing
"code" field to being "ExtensionFileSourceCode" enum. Currently the enum
has only a single variant "IncludedInBinary". It is done in preparation
to allow embedders to decide if they want to include the source code in the
binary when snapshotting (in most cases they shouldn't do that).
In the follow up commit we'll add more variants to
"ExtensionFileSourceCode".
"include_js_files_dir!" macro was removed in favor "include_js_files!"
macro which can now accept "dir" option.
Diffstat (limited to 'core/runtime.rs')
-rw-r--r-- | core/runtime.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/runtime.rs b/core/runtime.rs index 25a09e85e..ae2b0489b 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -21,6 +21,7 @@ use crate::source_map::SourceMapCache; use crate::source_map::SourceMapGetter; use crate::Extension; use crate::ExtensionFileSource; +use crate::ExtensionFileSourceCode; use crate::NoopModuleLoader; use crate::OpMiddlewareFn; use crate::OpResult; @@ -868,11 +869,14 @@ impl JsRuntime { { let js_files = ext.get_js_sources(); for file_source in js_files { + let ExtensionFileSourceCode::IncludedInBinary(code) = + file_source.code; + // TODO(@AaronO): use JsRuntime::execute_static() here to move src off heap realm.execute_script( self.v8_isolate(), &file_source.specifier, - file_source.code, + code, )?; } } |