Skip to content

Commit

Permalink
Merge branch 'main' into fix-readablestream-from
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju committed May 27, 2024
2 parents e55ddb6 + e44c538 commit 7bc3591
Show file tree
Hide file tree
Showing 38 changed files with 414 additions and 214 deletions.
14 changes: 8 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ repository = "https://github.com/denoland/deno"

[workspace.dependencies]
deno_ast = { version = "=0.38.2", features = ["transpiling"] }
deno_core = { version = "0.282.0" }
deno_core = { version = "0.283.0" }

deno_bench_util = { version = "0.147.0", path = "./bench_util" }
deno_lockfile = "0.19.0"
Expand Down Expand Up @@ -174,6 +174,7 @@ tokio = { version = "1.36.0", features = ["full"] }
tokio-metrics = { version = "0.3.0", features = ["rt"] }
tokio-util = "0.7.4"
tower-lsp = { version = "=0.20.0", features = ["proposed"] }
twox-hash = "=1.6.3"
# Upgrading past 2.4.1 may cause WPT failures
url = { version = "< 2.5.0", features = ["serde", "expose_internals"] }
uuid = { version = "1.3.0", features = ["v4"] }
Expand Down
3 changes: 2 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ notify.workspace = true
once_cell.workspace = true
open = "5.0.1"
p256.workspace = true
pathdiff = "0.2.1"
percent-encoding.workspace = true
phf.workspace = true
quick-junit = "^0.3.5"
Expand All @@ -145,7 +146,7 @@ thiserror.workspace = true
tokio.workspace = true
tokio-util.workspace = true
tower-lsp.workspace = true
twox-hash = "=1.6.3"
twox-hash.workspace = true
typed-arena = "=2.0.1"
uuid = { workspace = true, features = ["serde"] }
walkdir = "=2.3.2"
Expand Down
18 changes: 11 additions & 7 deletions cli/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -857,13 +857,17 @@ impl CliOptions {
};

if let Some(env_file_name) = &flags.env_file {
if (from_filename(env_file_name)).is_err() {
log::info!(
"{} The `--env` flag was used, but the dotenv file '{}' was not found.",
colors::yellow("Warning"),
env_file_name
);
}
match from_filename(env_file_name) {
Ok(_) => (),
Err(error) => {
match error {
dotenvy::Error::LineParse(line, index)=> log::info!("{} Parsing failed within the specified environment file: {} at index: {} of the value: {}",colors::yellow("Warning"), env_file_name, index, line),
dotenvy::Error::Io(_)=> log::info!("{} The `--env` flag was used, but the environment file specified '{}' was not found.",colors::yellow("Warning"),env_file_name),
dotenvy::Error::EnvVar(_)=>log::info!("{} One or more of the environment variables isn't present or not unicode within the specified environment file: {}",colors::yellow("Warning"),env_file_name),
_ => log::info!("{} Unknown failure occurred with the specified environment file: {}", colors::yellow("Warning"), env_file_name),
}
}
}
}

let disable_deprecated_api_warning = flags.log_level
Expand Down
31 changes: 15 additions & 16 deletions cli/cache/code_cache.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use deno_ast::ModuleSpecifier;
use deno_core::error::AnyError;
use deno_runtime::code_cache;
use deno_runtime::deno_webstorage::rusqlite::params;
Expand All @@ -21,7 +22,6 @@ pub static CODE_CACHE_DB: CacheDBConfiguration = CacheDBConfiguration {
on_failure: CacheFailure::Blackhole,
};

#[derive(Clone)]
pub struct CodeCache {
inner: CodeCacheInner,
}
Expand Down Expand Up @@ -52,28 +52,28 @@ impl CodeCache {

pub fn get_sync(
&self,
specifier: &str,
specifier: &ModuleSpecifier,
code_cache_type: code_cache::CodeCacheType,
source_hash: &str,
source_hash: u64,
) -> Option<Vec<u8>> {
Self::ensure_ok(self.inner.get_sync(
specifier,
specifier.as_str(),
code_cache_type,
source_hash,
&source_hash.to_string(),
))
}

pub fn set_sync(
&self,
specifier: &str,
specifier: &ModuleSpecifier,
code_cache_type: code_cache::CodeCacheType,
source_hash: &str,
source_hash: u64,
data: &[u8],
) {
Self::ensure_ok(self.inner.set_sync(
specifier,
specifier.as_str(),
code_cache_type,
source_hash,
&source_hash.to_string(),
data,
));
}
Expand All @@ -82,25 +82,24 @@ impl CodeCache {
impl code_cache::CodeCache for CodeCache {
fn get_sync(
&self,
specifier: &str,
specifier: &ModuleSpecifier,
code_cache_type: code_cache::CodeCacheType,
source_hash: &str,
source_hash: u64,
) -> Option<Vec<u8>> {
self.get_sync(specifier, code_cache_type, source_hash)
}

fn set_sync(
&self,
specifier: &str,
specifier: ModuleSpecifier,
code_cache_type: code_cache::CodeCacheType,
source_hash: &str,
source_hash: u64,
data: &[u8],
) {
self.set_sync(specifier, code_cache_type, source_hash, data);
self.set_sync(&specifier, code_cache_type, source_hash, data);
}
}

#[derive(Clone)]
struct CodeCacheInner {
conn: CacheDB,
}
Expand Down Expand Up @@ -135,7 +134,7 @@ impl CodeCacheInner {
&self,
specifier: &str,
code_cache_type: code_cache::CodeCacheType,
source_hash: &str,
source_hash: &str, // use string because sqlite doesn't have a u64 type
data: &[u8],
) -> Result<(), AnyError> {
let sql = "
Expand Down
17 changes: 0 additions & 17 deletions cli/cache/module_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,6 @@ impl ModuleInfoCache {
}
}

pub fn get_module_source_hash(
&self,
specifier: &ModuleSpecifier,
media_type: MediaType,
) -> Result<Option<ModuleInfoCacheSourceHash>, AnyError> {
let query = "SELECT source_hash FROM moduleinfocache WHERE specifier=?1 AND media_type=?2";
let res = self.conn.query_row(
query,
params![specifier.as_str(), serialize_media_type(media_type)],
|row| {
let source_hash: String = row.get(0)?;
Ok(ModuleInfoCacheSourceHash(source_hash))
},
)?;
Ok(res)
}

pub fn get_module_info(
&self,
specifier: &ModuleSpecifier,
Expand Down
1 change: 0 additions & 1 deletion cli/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,6 @@ impl CliFactory {
},
self.emitter()?.clone(),
self.main_module_graph_container().await?.clone(),
self.module_info_cache()?.clone(),
self.module_load_preparer().await?.clone(),
cli_node_resolver.clone(),
NpmModuleLoader::new(
Expand Down
29 changes: 5 additions & 24 deletions cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ use deno_runtime::fmt_errors::format_js_error;
use deno_runtime::tokio_util::create_and_run_current_thread_with_maybe_metrics;
use deno_terminal::colors;
use factory::CliFactory;
use std::borrow::Cow;
use std::env;
use std::env::current_exe;
use std::future::Future;
use std::path::PathBuf;

Expand Down Expand Up @@ -331,29 +329,12 @@ pub fn main() {
);

let args: Vec<_> = env::args_os().collect();
let current_exe_path = current_exe().unwrap();
let maybe_standalone = match standalone::extract_standalone(
&current_exe_path,
Cow::Borrowed(&args),
) {
Ok(standalone) => standalone,
Err(err) => exit_for_error(err),
};

let future = async move {
match maybe_standalone {
Some(future) => {
let (metadata, eszip) = future.await?;
standalone::run(eszip, metadata).await
}
None => {
// NOTE(lucacasonato): due to new PKU feature introduced in V8 11.6 we need to
// initialize the V8 platform on a parent thread of all threads that will spawn
// V8 isolates.
let flags = resolve_flags_and_init(args)?;
run_subcommand(flags).await
}
}
// NOTE(lucacasonato): due to new PKU feature introduced in V8 11.6 we need to
// initialize the V8 platform on a parent thread of all threads that will spawn
// V8 isolates.
let flags = resolve_flags_and_init(args)?;
run_subcommand(flags).await
};

match create_and_run_current_thread_with_maybe_metrics(future) {
Expand Down
Loading

0 comments on commit 7bc3591

Please sign in to comment.