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 /cli | |
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 'cli')
-rw-r--r-- | cli/build.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cli/build.rs b/cli/build.rs index 84d8fd549..807009a5d 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -4,10 +4,11 @@ use std::env; use std::path::Path; use std::path::PathBuf; -use deno_core::include_js_files_dir; +use deno_core::include_js_files; use deno_core::snapshot_util::*; use deno_core::Extension; use deno_core::ExtensionFileSource; +use deno_core::ExtensionFileSourceCode; use deno_runtime::deno_cache::SqliteBackedCache; use deno_runtime::permissions::PermissionsContainer; use deno_runtime::*; @@ -17,7 +18,6 @@ mod ts { use crate::deno_webgpu_get_declaration; use deno_core::error::custom_error; use deno_core::error::AnyError; - use deno_core::include_js_files_dir; use deno_core::op; use deno_core::OpState; use deno_runtime::deno_node::SUPPORTED_BUILTIN_NODE_MODULES; @@ -260,7 +260,7 @@ mod ts { op_load::decl(), op_script_version::decl(), ]) - .js(include_js_files_dir! { + .js(include_js_files! { dir "tsc", "00_typescript.js", "99_main_compiler.js", @@ -354,13 +354,15 @@ fn create_cli_snapshot(snapshot_path: PathBuf) { deno_flash::init::<PermissionsContainer>(false), // No --unstable ]; - let mut esm_files = include_js_files_dir!( + let mut esm_files = include_js_files!( dir "js", "40_testing.js", ); esm_files.push(ExtensionFileSource { specifier: "runtime/js/99_main.js".to_string(), - code: deno_runtime::js::SOURCE_CODE_FOR_99_MAIN_JS, + code: ExtensionFileSourceCode::IncludedInBinary( + deno_runtime::js::SOURCE_CODE_FOR_99_MAIN_JS, + ), }); let extensions_with_js = vec![Extension::builder("cli") // FIXME(bartlomieju): information about which extensions were |