Skip to content

Commit

Permalink
Merge branch 'main' into remove-deno-seeker
Browse files Browse the repository at this point in the history
  • Loading branch information
iuioiua authored Sep 12, 2024
2 parents ef03b36 + d656a26 commit 26b681d
Show file tree
Hide file tree
Showing 357 changed files with 1,594 additions and 1,514 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[package]
name = "deno"
version = "2.0.0-rc.1"
version = "2.0.0-rc.2"
authors.workspace = true
default-run = "deno"
edition.workspace = true
Expand Down
20 changes: 12 additions & 8 deletions cli/args/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2986,12 +2986,8 @@ The declaration file could be saved and used for typing information.",
)
}

fn upgrade_subcommand() -> Command {
command(
"upgrade",
cstr!("Upgrade deno executable to the given version.
<g>Latest</>
pub static UPGRADE_USAGE: &str = cstr!(
"<g>Latest</>
<bold>deno upgrade</>
<g>Specific version</>
Expand All @@ -3002,15 +2998,23 @@ fn upgrade_subcommand() -> Command {
<g>Channel</>
<bold>deno upgrade</> <p(245)>stable</>
<bold>deno upgrade</> <p(245)>rc</>
<bold>deno upgrade</> <p(245)>canary</>
<bold>deno upgrade</> <p(245)>canary</>"
);

fn upgrade_subcommand() -> Command {
command(
"upgrade",
color_print::cformat!("Upgrade deno executable to the given version.
{}
The version is downloaded from <p(245)>https://dl.deno.land</> and is used to replace the current executable.
If you want to not replace the current Deno executable but instead download an update to a
different location, use the <c>--output</> flag:
<p(245)>deno upgrade --output $HOME/my_deno</>
<y>Read more:</> <c>https://docs.deno.com/go/cmd/upgrade</>"),
<y>Read more:</> <c>https://docs.deno.com/go/cmd/upgrade</>", UPGRADE_USAGE),
UnstableArgsConfig::None,
)
.hide(cfg!(not(feature = "upgrade")))
Expand Down
12 changes: 0 additions & 12 deletions cli/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1596,18 +1596,6 @@ impl CliOptions {
}
});

// TODO(2.0): remove this code and enable these features in `99_main.js` by default.
let future_features = [
deno_runtime::deno_ffi::UNSTABLE_FEATURE_NAME.to_string(),
deno_runtime::deno_fs::UNSTABLE_FEATURE_NAME.to_string(),
deno_runtime::deno_webgpu::UNSTABLE_FEATURE_NAME.to_string(),
];
future_features.iter().for_each(|future_feature| {
if !from_config_file.contains(future_feature) {
from_config_file.push(future_feature.to_string());
}
});

if !from_config_file.is_empty() {
// collect unstable granular flags
let mut all_valid_unstable_flags: Vec<&str> =
Expand Down
13 changes: 0 additions & 13 deletions cli/cache/code_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ impl CodeCache {
data,
));
}

pub fn remove_code_cache(&self, specifier: &str) {
Self::ensure_ok(self.inner.remove_code_cache(specifier))
}
}

impl code_cache::CodeCache for CodeCache {
Expand Down Expand Up @@ -162,15 +158,6 @@ impl CodeCacheInner {
self.conn.execute(sql, params)?;
Ok(())
}

pub fn remove_code_cache(&self, specifier: &str) -> Result<(), AnyError> {
let sql = "
DELETE FROM codecache
WHERE specifier=$1;";
let params = params![specifier];
self.conn.execute(sql, params)?;
Ok(())
}
}

fn serialize_code_cache_type(
Expand Down
7 changes: 0 additions & 7 deletions cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,6 @@ fn get_suggestions_for_terminal_errors(e: &JsError) -> Vec<FixSuggestion> {
"Run again with `--unstable-cron` flag to enable this API.",
),
];
} else if msg.contains("createHttpClient is not a function") {
return vec![
FixSuggestion::info("Deno.createHttpClient() is an unstable API."),
FixSuggestion::hint(
"Run again with `--unstable-http` flag to enable this API.",
),
];
} else if msg.contains("WebSocketStream is not defined") {
return vec![
FixSuggestion::info("new WebSocketStream() is an unstable API."),
Expand Down
28 changes: 0 additions & 28 deletions cli/module_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use std::borrow::Cow;
use std::cell::RefCell;
use std::collections::HashSet;
use std::path::PathBuf;
use std::pin::Pin;
use std::rc::Rc;
Expand Down Expand Up @@ -44,7 +43,6 @@ use deno_core::error::generic_error;
use deno_core::error::AnyError;
use deno_core::futures::future::FutureExt;
use deno_core::futures::Future;
use deno_core::parking_lot::Mutex;
use deno_core::resolve_url;
use deno_core::ModuleCodeString;
use deno_core::ModuleLoader;
Expand Down Expand Up @@ -244,7 +242,6 @@ impl CliModuleLoaderFactory {
emitter: self.shared.emitter.clone(),
parsed_source_cache: self.shared.parsed_source_cache.clone(),
shared: self.shared.clone(),
prevent_v8_code_cache: Default::default(),
})));
ModuleLoaderAndSourceMapGetter {
module_loader: loader,
Expand Down Expand Up @@ -296,10 +293,6 @@ struct CliModuleLoaderInner<TGraphContainer: ModuleGraphContainer> {
emitter: Arc<Emitter>,
parsed_source_cache: Arc<ParsedSourceCache>,
graph_container: TGraphContainer,
// NOTE(bartlomieju): this is temporary, for deprecated import assertions.
// Should be removed in Deno 2.
// Modules stored here should not be V8 code-cached.
prevent_v8_code_cache: Arc<Mutex<HashSet<String>>>,
}

impl<TGraphContainer: ModuleGraphContainer>
Expand Down Expand Up @@ -785,14 +778,6 @@ impl<TGraphContainer: ModuleGraphContainer> ModuleLoader
code_cache: &[u8],
) -> Pin<Box<dyn Future<Output = ()>>> {
if let Some(cache) = self.0.shared.code_cache.as_ref() {
if self
.0
.prevent_v8_code_cache
.lock()
.contains(specifier.as_str())
{
return std::future::ready(()).boxed_local();
}
// This log line is also used by tests.
log::debug!(
"Updating V8 code cache for ES module: {specifier}, [{source_hash:?}]"
Expand All @@ -807,19 +792,6 @@ impl<TGraphContainer: ModuleGraphContainer> ModuleLoader
std::future::ready(()).boxed_local()
}

fn purge_and_prevent_code_cache(&self, specifier: &str) {
if let Some(cache) = self.0.shared.code_cache.as_ref() {
// This log line is also used by tests.
log::debug!("Remove V8 code cache for ES module: {specifier}");
cache.remove_code_cache(specifier);
self
.0
.prevent_v8_code_cache
.lock()
.insert(specifier.to_string());
}
}

fn get_source_map(&self, file_name: &str) -> Option<Vec<u8>> {
let specifier = resolve_url(file_name).ok()?;
match specifier.scheme() {
Expand Down
37 changes: 30 additions & 7 deletions cli/tools/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use crate::args::Flags;
use crate::args::UpgradeFlags;
use crate::args::UPGRADE_USAGE;
use crate::colors;
use crate::factory::CliFactory;
use crate::http_util::HttpClient;
Expand All @@ -15,7 +16,6 @@ use crate::util::progress_bar::ProgressBarStyle;
use crate::version;

use async_trait::async_trait;
use color_print::cstr;
use deno_core::anyhow::bail;
use deno_core::anyhow::Context;
use deno_core::error::AnyError;
Expand All @@ -38,8 +38,6 @@ const RELEASE_URL: &str = "https://github.com/denoland/deno/releases";
const CANARY_URL: &str = "https://dl.deno.land/canary";
const RC_URL: &str = "https://dl.deno.land/release";

static EXAMPLE_USAGE: &str = cstr!("Example usage:\n <p(245)>deno upgrade | deno upgrade 1.46 | deno upgrade canary</>");

pub static ARCHIVE_NAME: Lazy<String> =
Lazy::new(|| format!("deno-{}.zip", env!("TARGET")));

Expand Down Expand Up @@ -625,6 +623,7 @@ impl RequestedVersion {
};
let mut maybe_passed_version = upgrade_flags.version.clone();

// TODO(bartlomieju): prefer flags first? This whole logic could be cleaned up...
if let Some(val) = &upgrade_flags.version_or_hash_or_channel {
if let Ok(channel) = ReleaseChannel::deserialize(&val.to_lowercase()) {
// TODO(bartlomieju): print error if any other flags passed?
Expand All @@ -651,18 +650,19 @@ impl RequestedVersion {
let (channel, passed_version) = if is_canary {
if !re_hash.is_match(&passed_version) {
bail!(
"Invalid commit hash passed ({})\n\n{}",
"Invalid commit hash passed ({})\n\nPass a semver, or a full 40 character git commit hash, or a release channel name.\n\nUsage:\n{}",
colors::gray(passed_version),
EXAMPLE_USAGE
UPGRADE_USAGE
);
}

(ReleaseChannel::Canary, passed_version)
} else {
let Ok(semver) = Version::parse_standard(&passed_version) else {
bail!(
"Invalid version passed ({})\n\n{}",
"Invalid version passed ({})\n\nPass a semver, or a full 40 character git commit hash, or a release channel name.\n\nUsage:\n{}",
colors::gray(passed_version),
EXAMPLE_USAGE
UPGRADE_USAGE
);
};

Expand Down Expand Up @@ -1123,6 +1123,8 @@ mod test {
use std::cell::RefCell;
use std::rc::Rc;

use test_util::assert_contains;

use super::*;

#[test]
Expand Down Expand Up @@ -1221,6 +1223,27 @@ mod test {
"5c69b4861b52ab406e73b9cd85c254f0505cb20f".to_string()
)
);

upgrade_flags.version_or_hash_or_channel =
Some("5c69b4861b52a".to_string());
let err = RequestedVersion::from_upgrade_flags(upgrade_flags.clone())
.unwrap_err()
.to_string();
assert_contains!(err, "Invalid version passed");
assert_contains!(
err,
"Pass a semver, or a full 40 character git commit hash, or a release channel name."
);

upgrade_flags.version_or_hash_or_channel = Some("11.asd.1324".to_string());
let err = RequestedVersion::from_upgrade_flags(upgrade_flags.clone())
.unwrap_err()
.to_string();
assert_contains!(err, "Invalid version passed");
assert_contains!(
err,
"Pass a semver, or a full 40 character git commit hash, or a release channel name."
);
}

#[test]
Expand Down
9 changes: 0 additions & 9 deletions cli/tsc/99_main_compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,15 @@ delete Object.prototype.__proto__;
/** @type {ReadonlySet<string>} */
const unstableDenoProps = new Set([
"AtomicOperation",
"CreateHttpClientOptions",
"DatagramConn",
"HttpClient",
"Kv",
"KvListIterator",
"KvU64",
"UnsafeCallback",
"UnsafePointer",
"UnsafePointerView",
"UnsafeFnPointer",
"UnixConnectOptions",
"UnixListenOptions",
"createHttpClient",
"dlopen",
"listen",
"listenDatagram",
"openKv",
"umask",
]);
const unstableMsgSuggestion =
"If not, try changing the 'lib' compiler option to include 'deno.unstable' " +
Expand Down
Loading

0 comments on commit 26b681d

Please sign in to comment.