From 914b08fc19e5c7268e7b04a216337e765d6a06e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 20 Feb 2023 21:45:34 +0100 Subject: build: add "include_js_files_for_snapshotting" Cargo feature (#17826) This allows to not include source code into the binary (because it will already be included in the V8 snapshot). Nothing changes for the embedders - everything should still build the same. This commit brings the binary size from 87Mb to 82Mb on M1. Alternative to https://github.com/denoland/deno/pull/17820 and https://github.com/denoland/deno/pull/17653 --------- Co-authored-by: Leo Kettmeir --- core/modules.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'core/modules.rs') diff --git a/core/modules.rs b/core/modules.rs index 43dabf411..f1d4273e8 100644 --- a/core/modules.rs +++ b/core/modules.rs @@ -3,7 +3,6 @@ use crate::bindings; use crate::error::generic_error; use crate::extensions::ExtensionFileSource; -use crate::extensions::ExtensionFileSourceCode; use crate::module_specifier::ModuleSpecifier; use crate::resolve_import; use crate::resolve_url; @@ -403,10 +402,9 @@ impl ModuleLoader for InternalModuleLoader { let result = if let Some(load_callback) = &self.maybe_load_callback { load_callback(file_source) } else { - match file_source.code { - ExtensionFileSourceCode::IncludedInBinary(code) => { - Ok(code.to_string()) - } + match file_source.code.load() { + Ok(code) => Ok(code), + Err(err) => return futures::future::err(err).boxed_local(), } }; -- cgit v1.2.3