diff options
author | Bartek Iwańczuk <biwanczuk@gmail.com> | 2023-06-26 13:54:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-26 13:54:10 +0200 |
commit | ad3c494b46c97f0cf91098b7ec2afa576ea7a3dd (patch) | |
tree | 2996e36708b4c726c3b5e99b6fbbd8e63fcc121b /cli | |
parent | c7d38e593f7de66af47321e7463d8c15ae4176f2 (diff) |
Revert "Reland "refactor(core): cleanup feature flags for js source i… (#19611)
…nclusion" (#19519)"
This reverts commit 28a4f3d0f5383695b1d49ccdc8b0f799a715b2c2.
This change causes failures when used outside Deno repo:
```
============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.
Platform: linux x86_64
Version: 1.34.3+b37b286
Args: ["/opt/hostedtoolcache/deno/0.0.0-b37b286f7fa68d5656f7c180f6127bdc38cf2cf5/x64/deno", "test", "--doc", "--unstable", "--allow-all", "--coverage=./cov"]
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Failed to read "/home/runner/work/deno/deno/core/00_primordials.js"
Caused by:
No such file or directory (os error 2)', core/runtime/jsruntime.rs:699:8
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
Diffstat (limited to 'cli')
-rw-r--r-- | cli/Cargo.toml | 8 | ||||
-rw-r--r-- | cli/build.rs | 48 | ||||
-rw-r--r-- | cli/lsp/tsc.rs | 2 | ||||
-rw-r--r-- | cli/ops/mod.rs | 2 | ||||
-rw-r--r-- | cli/tools/bench.rs | 2 | ||||
-rw-r--r-- | cli/tools/test.rs | 2 | ||||
-rw-r--r-- | cli/tsc/mod.rs | 4 |
7 files changed, 36 insertions, 32 deletions
diff --git a/cli/Cargo.toml b/cli/Cargo.toml index f259c702d..bbb7b0236 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -27,8 +27,8 @@ harness = false path = "./bench/lsp_bench_standalone.rs" [build-dependencies] -deno_runtime = { workspace = true, features = ["exclude_js_main_from_snapshot"] } -deno_core = { workspace = true, features = ["runtime_js_sources"] } +deno_runtime = { workspace = true, features = ["snapshot_from_snapshot", "include_js_files_for_snapshotting"] } +deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] } lazy-regex.workspace = true serde.workspace = true serde_json.workspace = true @@ -41,14 +41,14 @@ winres.workspace = true [dependencies] deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "dep_graph", "module_specifier", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] } -deno_core = { workspace = true, features = ["exclude_js_sources"] } +deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] } deno_doc = "=0.63.1" deno_emit = "=0.24.0" deno_graph = "=0.49.0" deno_lint = { version = "=0.47.0", features = ["docs"] } deno_lockfile.workspace = true deno_npm.workspace = true -deno_runtime = { workspace = true, features = ["dont_create_runtime_snapshot"] } +deno_runtime = { workspace = true, features = ["dont_create_runtime_snapshot", "include_js_files_for_snapshotting"] } deno_semver.workspace = true deno_task_shell = "=0.12.0" eszip = "=0.44.0" diff --git a/cli/build.rs b/cli/build.rs index a4893741b..5ff86fa20 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -266,7 +266,11 @@ mod ts { cargo_manifest_dir: env!("CARGO_MANIFEST_DIR"), snapshot_path, startup_snapshot: None, - extensions: vec![deno_tsc::init_ext(op_crate_libs, build_libs, path_dts)], + extensions: vec![deno_tsc::init_ops_and_esm( + op_crate_libs, + build_libs, + path_dts, + )], // NOTE(bartlomieju): Compressing the TSC snapshot in debug build took // ~45s on M1 MacBook Pro; without compression it took ~1s. @@ -318,7 +322,7 @@ deno_core::extension!( customizer = |ext: &mut deno_core::ExtensionBuilder| { ext.esm(vec![ExtensionFileSource { specifier: "ext:cli/runtime/js/99_main.js", - code: ExtensionFileSourceCode::LoadAtRuntime( + code: ExtensionFileSourceCode::LoadedFromFsDuringSnapshot( std::path::PathBuf::from(deno_runtime::js::PATH_FOR_99_MAIN_JS), ), }]); @@ -331,42 +335,42 @@ fn create_cli_snapshot(snapshot_path: PathBuf) -> CreateSnapshotOutput { // `runtime/worker.rs`, `runtime/web_worker.rs` and `runtime/build.rs`! let fs = Arc::new(deno_fs::RealFs); let extensions: Vec<Extension> = vec![ - deno_webidl::deno_webidl::init_ext(), - deno_console::deno_console::init_ext(), - deno_url::deno_url::init_ext(), - deno_web::deno_web::init_ext::<PermissionsContainer>( + deno_webidl::deno_webidl::init_ops(), + deno_console::deno_console::init_ops(), + deno_url::deno_url::init_ops(), + deno_web::deno_web::init_ops::<PermissionsContainer>( deno_web::BlobStore::default(), Default::default(), ), - deno_fetch::deno_fetch::init_ext::<PermissionsContainer>(Default::default()), - deno_cache::deno_cache::init_ext::<SqliteBackedCache>(None), - deno_websocket::deno_websocket::init_ext::<PermissionsContainer>( + deno_fetch::deno_fetch::init_ops::<PermissionsContainer>(Default::default()), + deno_cache::deno_cache::init_ops::<SqliteBackedCache>(None), + deno_websocket::deno_websocket::init_ops::<PermissionsContainer>( "".to_owned(), None, None, ), - deno_webstorage::deno_webstorage::init_ext(None), - deno_crypto::deno_crypto::init_ext(None), - deno_broadcast_channel::deno_broadcast_channel::init_ext( + deno_webstorage::deno_webstorage::init_ops(None), + deno_crypto::deno_crypto::init_ops(None), + deno_broadcast_channel::deno_broadcast_channel::init_ops( deno_broadcast_channel::InMemoryBroadcastChannel::default(), false, // No --unstable. ), - deno_ffi::deno_ffi::init_ext::<PermissionsContainer>(false), - deno_net::deno_net::init_ext::<PermissionsContainer>( + deno_ffi::deno_ffi::init_ops::<PermissionsContainer>(false), + deno_net::deno_net::init_ops::<PermissionsContainer>( None, false, // No --unstable. None, ), - deno_tls::deno_tls::init_ext(), - deno_kv::deno_kv::init_ext( + deno_tls::deno_tls::init_ops(), + deno_kv::deno_kv::init_ops( SqliteDbHandler::<PermissionsContainer>::new(None), false, // No --unstable. ), - deno_napi::deno_napi::init_ext::<PermissionsContainer>(), - deno_http::deno_http::init_ext::<DefaultHttpPropertyExtractor>(), - deno_io::deno_io::init_ext(Default::default()), - deno_fs::deno_fs::init_ext::<PermissionsContainer>(false, fs.clone()), - deno_node::deno_node::init_ext::<PermissionsContainer>(None, fs), - cli::init_ext(), + deno_napi::deno_napi::init_ops::<PermissionsContainer>(), + deno_http::deno_http::init_ops::<DefaultHttpPropertyExtractor>(), + deno_io::deno_io::init_ops(Default::default()), + deno_fs::deno_fs::init_ops::<PermissionsContainer>(false, fs.clone()), + deno_node::deno_node::init_ops::<PermissionsContainer>(None, fs), + cli::init_ops_and_esm(), // NOTE: This needs to be init_ops_and_esm! ]; create_snapshot(CreateSnapshotOptions { diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs index 386126942..66687789b 100644 --- a/cli/lsp/tsc.rs +++ b/cli/lsp/tsc.rs @@ -3236,7 +3236,7 @@ fn op_script_version( /// server. fn js_runtime(performance: Arc<Performance>) -> JsRuntime { JsRuntime::new(RuntimeOptions { - extensions: vec![deno_tsc::init_ext(performance)], + extensions: vec![deno_tsc::init_ops(performance)], startup_snapshot: Some(tsc::compiler_snapshot()), ..Default::default() }) diff --git a/cli/ops/mod.rs b/cli/ops/mod.rs index 3b2cf6346..5066c44b9 100644 --- a/cli/ops/mod.rs +++ b/cli/ops/mod.rs @@ -12,7 +12,7 @@ pub mod bench; pub mod testing; pub fn cli_exts(npm_resolver: Arc<CliNpmResolver>) -> Vec<Extension> { - vec![deno_cli::init_ext(npm_resolver)] + vec![deno_cli::init_ops(npm_resolver)] } deno_core::extension!(deno_cli, diff --git a/cli/tools/bench.rs b/cli/tools/bench.rs index be7bc78ea..f926cec5a 100644 --- a/cli/tools/bench.rs +++ b/cli/tools/bench.rs @@ -447,7 +447,7 @@ async fn bench_specifier( .create_custom_worker( specifier.clone(), PermissionsContainer::new(permissions), - vec![ops::bench::deno_bench::init_ext(sender.clone())], + vec![ops::bench::deno_bench::init_ops(sender.clone())], Default::default(), ) .await?; diff --git a/cli/tools/test.rs b/cli/tools/test.rs index 2daea8aec..dc48ab9e5 100644 --- a/cli/tools/test.rs +++ b/cli/tools/test.rs @@ -936,7 +936,7 @@ pub async fn test_specifier( .create_custom_worker( specifier.clone(), PermissionsContainer::new(permissions), - vec![ops::testing::deno_test::init_ext(sender.clone())], + vec![ops::testing::deno_test::init_ops(sender.clone())], Stdio { stdin: StdioPipe::Inherit, stdout, diff --git a/cli/tsc/mod.rs b/cli/tsc/mod.rs index d6df0ef7e..a4d6640f7 100644 --- a/cli/tsc/mod.rs +++ b/cli/tsc/mod.rs @@ -122,7 +122,7 @@ fn get_asset_texts_from_new_runtime() -> Result<Vec<AssetText>, AnyError> { // the assets are stored within the typescript isolate, so take them out of there let mut runtime = JsRuntime::new(RuntimeOptions { startup_snapshot: Some(compiler_snapshot()), - extensions: vec![deno_cli_tsc::init_ext()], + extensions: vec![deno_cli_tsc::init_ops()], ..Default::default() }); let global = runtime @@ -787,7 +787,7 @@ pub fn exec(request: Request) -> Result<Response, AnyError> { let mut runtime = JsRuntime::new(RuntimeOptions { startup_snapshot: Some(compiler_snapshot()), - extensions: vec![deno_cli_tsc::init_ext( + extensions: vec![deno_cli_tsc::init_ops( request, root_map, remapped_specifiers, |