diff options
| author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2023-07-01 23:14:41 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-02 00:14:41 +0200 |
| commit | 4e2f02639ef2cbcfdd335c4446f6faa6a29ad264 (patch) | |
| tree | ed76c7f0abd3bb8fba967a6a3399d0fb9cd2ce1a /core/runtime/snapshot_util.rs | |
| parent | 6afdcf59b80b4a3ecf60f220ddff14f4309133d0 (diff) | |
refactor(core): don't use extension macro for core js (#19616)
Seems like too much of a special case because `init_cbs()` needs to be
called right after them. Removes the `Extension::is_core` stuff.
Diffstat (limited to 'core/runtime/snapshot_util.rs')
| -rw-r--r-- | core/runtime/snapshot_util.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/core/runtime/snapshot_util.rs b/core/runtime/snapshot_util.rs index 88c273147..e664856c6 100644 --- a/core/runtime/snapshot_util.rs +++ b/core/runtime/snapshot_util.rs @@ -4,9 +4,11 @@ use std::path::Path; use std::path::PathBuf; use std::time::Instant; +use crate::runtime::jsruntime::BUILTIN_SOURCES; use crate::runtime::RuntimeSnapshotOptions; use crate::ExtModuleLoaderCb; use crate::Extension; +use crate::ExtensionFileSourceCode; use crate::JsRuntimeForSnapshot; use crate::RuntimeOptions; use crate::Snapshot; @@ -52,14 +54,19 @@ pub fn create_snapshot( mark = Instant::now(); let mut files_loaded_during_snapshot = vec![]; + for source in &*BUILTIN_SOURCES { + if let ExtensionFileSourceCode::LoadedFromFsDuringSnapshot(path) = + &source.code + { + files_loaded_during_snapshot.push(path.clone()); + } + } for source in js_runtime .extensions() .iter() .flat_map(|e| vec![e.get_esm_sources(), e.get_js_sources()]) .flatten() - .flatten() { - use crate::ExtensionFileSourceCode; if let ExtensionFileSourceCode::LoadedFromFsDuringSnapshot(path) = &source.code { |
