mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
chore: upgrade deno_core to 0.256.0 (#22145)
This commit is contained in:
parent
462ce14a78
commit
d9191db0ce
5 changed files with 56 additions and 79 deletions
12
Cargo.lock
generated
12
Cargo.lock
generated
|
@ -1196,9 +1196,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "deno_core"
|
name = "deno_core"
|
||||||
version = "0.255.0"
|
version = "0.256.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "66349d0fd8e9cad751435b59cf9e09e9fad9433301e9529ca4edf130ea3a06a0"
|
checksum = "cd5997286bcc46199bbae727f43ee65cf4bd073ac2d240a36a6ceae3bfab14ac"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bit-set",
|
"bit-set",
|
||||||
|
@ -1653,9 +1653,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "deno_ops"
|
name = "deno_ops"
|
||||||
version = "0.131.0"
|
version = "0.132.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ee3363343cd15758aa02792e93b53b1def9cf1e8b23dd82bdce0f223e6046e76"
|
checksum = "02163d08afdd6fcf21e37c399c7425987c7170203a853052a800e80c91c2e87b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-rules",
|
"proc-macro-rules",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
@ -5357,9 +5357,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_v8"
|
name = "serde_v8"
|
||||||
version = "0.164.0"
|
version = "0.165.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f96a94476f3d22fe9f70c2d992d020173ccd61ad6fa1b62ed8090abe835c4e9f"
|
checksum = "88862d513bcbc04a7f93b0f454dffd0b01a5c0d8e1964c7532ec55f52b9a6351"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"derive_more",
|
"derive_more",
|
||||||
|
|
|
@ -42,7 +42,7 @@ repository = "https://github.com/denoland/deno"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
deno_ast = { version = "0.32.0", features = ["transpiling"] }
|
deno_ast = { version = "0.32.0", features = ["transpiling"] }
|
||||||
deno_core = { version = "0.255.0" }
|
deno_core = { version = "0.256.0" }
|
||||||
|
|
||||||
deno_bench_util = { version = "0.129.0", path = "./bench_util" }
|
deno_bench_util = { version = "0.129.0", path = "./bench_util" }
|
||||||
deno_lockfile = "0.18.0"
|
deno_lockfile = "0.18.0"
|
||||||
|
|
|
@ -653,16 +653,16 @@ impl ModuleLoader for CliModuleLoader {
|
||||||
maybe_referrer: Option<&ModuleSpecifier>,
|
maybe_referrer: Option<&ModuleSpecifier>,
|
||||||
is_dynamic: bool,
|
is_dynamic: bool,
|
||||||
requested_module_type: RequestedModuleType,
|
requested_module_type: RequestedModuleType,
|
||||||
) -> Pin<Box<deno_core::ModuleSourceFuture>> {
|
) -> deno_core::ModuleLoadResponse {
|
||||||
// NOTE: this block is async only because of `deno_core` interface
|
// NOTE: this block is async only because of `deno_core` interface
|
||||||
// requirements; module was already loaded when constructing module graph
|
// requirements; module was already loaded when constructing module graph
|
||||||
// during call to `prepare_load` so we can load it synchronously.
|
// during call to `prepare_load` so we can load it synchronously.
|
||||||
Box::pin(deno_core::futures::future::ready(self.load_sync(
|
deno_core::ModuleLoadResponse::Sync(self.load_sync(
|
||||||
specifier,
|
specifier,
|
||||||
maybe_referrer,
|
maybe_referrer,
|
||||||
is_dynamic,
|
is_dynamic,
|
||||||
requested_module_type,
|
requested_module_type,
|
||||||
)))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_load(
|
fn prepare_load(
|
||||||
|
|
|
@ -53,7 +53,6 @@ use deno_runtime::permissions::PermissionsContainer;
|
||||||
use deno_runtime::WorkerLogLevel;
|
use deno_runtime::WorkerLogLevel;
|
||||||
use deno_semver::npm::NpmPackageReqReference;
|
use deno_semver::npm::NpmPackageReqReference;
|
||||||
use import_map::parse_from_json;
|
use import_map::parse_from_json;
|
||||||
use std::pin::Pin;
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
@ -150,16 +149,16 @@ impl ModuleLoader for EmbeddedModuleLoader {
|
||||||
maybe_referrer: Option<&ModuleSpecifier>,
|
maybe_referrer: Option<&ModuleSpecifier>,
|
||||||
is_dynamic: bool,
|
is_dynamic: bool,
|
||||||
_requested_module_type: RequestedModuleType,
|
_requested_module_type: RequestedModuleType,
|
||||||
) -> Pin<Box<deno_core::ModuleSourceFuture>> {
|
) -> deno_core::ModuleLoadResponse {
|
||||||
let is_data_uri = get_source_from_data_url(original_specifier).ok();
|
let is_data_uri = get_source_from_data_url(original_specifier).ok();
|
||||||
if let Some((source, _)) = is_data_uri {
|
if let Some((source, _)) = is_data_uri {
|
||||||
return Box::pin(deno_core::futures::future::ready(Ok(
|
return deno_core::ModuleLoadResponse::Sync(Ok(
|
||||||
deno_core::ModuleSource::new(
|
deno_core::ModuleSource::new(
|
||||||
deno_core::ModuleType::JavaScript,
|
deno_core::ModuleType::JavaScript,
|
||||||
ModuleSourceCode::String(source.into()),
|
ModuleSourceCode::String(source.into()),
|
||||||
original_specifier,
|
original_specifier,
|
||||||
),
|
),
|
||||||
)));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
let permissions = if is_dynamic {
|
let permissions = if is_dynamic {
|
||||||
|
@ -175,7 +174,7 @@ impl ModuleLoader for EmbeddedModuleLoader {
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return match result {
|
return match result {
|
||||||
Ok(code_source) => Box::pin(deno_core::futures::future::ready(Ok(
|
Ok(code_source) => deno_core::ModuleLoadResponse::Sync(Ok(
|
||||||
deno_core::ModuleSource::new_with_redirect(
|
deno_core::ModuleSource::new_with_redirect(
|
||||||
match code_source.media_type {
|
match code_source.media_type {
|
||||||
MediaType::Json => ModuleType::Json,
|
MediaType::Json => ModuleType::Json,
|
||||||
|
@ -185,45 +184,48 @@ impl ModuleLoader for EmbeddedModuleLoader {
|
||||||
original_specifier,
|
original_specifier,
|
||||||
&code_source.found_url,
|
&code_source.found_url,
|
||||||
),
|
),
|
||||||
))),
|
)),
|
||||||
Err(err) => Box::pin(deno_core::futures::future::ready(Err(err))),
|
Err(err) => deno_core::ModuleLoadResponse::Sync(Err(err)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let Some(module) =
|
let Some(module) =
|
||||||
self.shared.eszip.get_module(original_specifier.as_str())
|
self.shared.eszip.get_module(original_specifier.as_str())
|
||||||
else {
|
else {
|
||||||
return Box::pin(deno_core::futures::future::ready(Err(type_error(
|
return deno_core::ModuleLoadResponse::Sync(Err(type_error(format!(
|
||||||
format!("Module not found: {}", original_specifier),
|
"Module not found: {}",
|
||||||
|
original_specifier
|
||||||
))));
|
))));
|
||||||
};
|
};
|
||||||
let original_specifier = original_specifier.clone();
|
let original_specifier = original_specifier.clone();
|
||||||
let found_specifier =
|
let found_specifier =
|
||||||
ModuleSpecifier::parse(&module.specifier).expect("invalid url in eszip");
|
ModuleSpecifier::parse(&module.specifier).expect("invalid url in eszip");
|
||||||
|
|
||||||
async move {
|
deno_core::ModuleLoadResponse::Async(
|
||||||
let code = module.source().await.ok_or_else(|| {
|
async move {
|
||||||
type_error(format!("Module not found: {}", original_specifier))
|
let code = module.source().await.ok_or_else(|| {
|
||||||
})?;
|
type_error(format!("Module not found: {}", original_specifier))
|
||||||
let code = arc_u8_to_arc_str(code)
|
})?;
|
||||||
.map_err(|_| type_error("Module source is not utf-8"))?;
|
let code = arc_u8_to_arc_str(code)
|
||||||
Ok(deno_core::ModuleSource::new_with_redirect(
|
.map_err(|_| type_error("Module source is not utf-8"))?;
|
||||||
match module.kind {
|
Ok(deno_core::ModuleSource::new_with_redirect(
|
||||||
eszip::ModuleKind::JavaScript => ModuleType::JavaScript,
|
match module.kind {
|
||||||
eszip::ModuleKind::Json => ModuleType::Json,
|
eszip::ModuleKind::JavaScript => ModuleType::JavaScript,
|
||||||
eszip::ModuleKind::Jsonc => {
|
eszip::ModuleKind::Json => ModuleType::Json,
|
||||||
return Err(type_error("jsonc modules not supported"))
|
eszip::ModuleKind::Jsonc => {
|
||||||
}
|
return Err(type_error("jsonc modules not supported"))
|
||||||
eszip::ModuleKind::OpaqueData => {
|
}
|
||||||
unreachable!();
|
eszip::ModuleKind::OpaqueData => {
|
||||||
}
|
unreachable!();
|
||||||
},
|
}
|
||||||
ModuleSourceCode::String(code.into()),
|
},
|
||||||
&original_specifier,
|
ModuleSourceCode::String(code.into()),
|
||||||
&found_specifier,
|
&original_specifier,
|
||||||
))
|
&found_specifier,
|
||||||
}
|
))
|
||||||
.boxed_local()
|
}
|
||||||
|
.boxed_local(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
use deno_core::error::bad_resource_id;
|
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::op2;
|
use deno_core::op2;
|
||||||
use deno_core::v8;
|
use deno_core::v8;
|
||||||
|
@ -14,7 +13,7 @@ use x509_parser::prelude::*;
|
||||||
|
|
||||||
use digest::Digest;
|
use digest::Digest;
|
||||||
|
|
||||||
struct Certificate {
|
pub(crate) struct Certificate {
|
||||||
_buf: Vec<u8>,
|
_buf: Vec<u8>,
|
||||||
pem: Option<pem::Pem>,
|
pem: Option<pem::Pem>,
|
||||||
cert: X509Certificate<'static>,
|
cert: X509Certificate<'static>,
|
||||||
|
@ -73,20 +72,15 @@ pub fn op_node_x509_parse<'s>(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[op2(fast)]
|
#[op2(fast)]
|
||||||
pub fn op_node_x509_ca(rid: v8::Local<v8::Object>) -> Result<bool, AnyError> {
|
pub fn op_node_x509_ca(#[cppgc] cert: &Certificate) -> Result<bool, AnyError> {
|
||||||
let cert = deno_core::cppgc::unwrap_cppgc_object::<Certificate>(rid)
|
|
||||||
.ok_or_else(bad_resource_id)?;
|
|
||||||
Ok(cert.is_ca())
|
Ok(cert.is_ca())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[op2(fast)]
|
#[op2(fast)]
|
||||||
pub fn op_node_x509_check_email(
|
pub fn op_node_x509_check_email(
|
||||||
rid: v8::Local<v8::Object>,
|
#[cppgc] cert: &Certificate,
|
||||||
#[string] email: &str,
|
#[string] email: &str,
|
||||||
) -> Result<bool, AnyError> {
|
) -> Result<bool, AnyError> {
|
||||||
let cert = deno_core::cppgc::unwrap_cppgc_object::<Certificate>(rid)
|
|
||||||
.ok_or_else(bad_resource_id)?;
|
|
||||||
|
|
||||||
let subject = cert.subject();
|
let subject = cert.subject();
|
||||||
if subject
|
if subject
|
||||||
.iter_email()
|
.iter_email()
|
||||||
|
@ -120,50 +114,40 @@ pub fn op_node_x509_check_email(
|
||||||
#[op2]
|
#[op2]
|
||||||
#[string]
|
#[string]
|
||||||
pub fn op_node_x509_fingerprint(
|
pub fn op_node_x509_fingerprint(
|
||||||
rid: v8::Local<v8::Object>,
|
#[cppgc] cert: &Certificate,
|
||||||
) -> Result<Option<String>, AnyError> {
|
) -> Result<Option<String>, AnyError> {
|
||||||
let cert = deno_core::cppgc::unwrap_cppgc_object::<Certificate>(rid)
|
|
||||||
.ok_or_else(bad_resource_id)?;
|
|
||||||
Ok(cert.fingerprint::<sha1::Sha1>())
|
Ok(cert.fingerprint::<sha1::Sha1>())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[op2]
|
#[op2]
|
||||||
#[string]
|
#[string]
|
||||||
pub fn op_node_x509_fingerprint256(
|
pub fn op_node_x509_fingerprint256(
|
||||||
rid: v8::Local<v8::Object>,
|
#[cppgc] cert: &Certificate,
|
||||||
) -> Result<Option<String>, AnyError> {
|
) -> Result<Option<String>, AnyError> {
|
||||||
let cert = deno_core::cppgc::unwrap_cppgc_object::<Certificate>(rid)
|
|
||||||
.ok_or_else(bad_resource_id)?;
|
|
||||||
Ok(cert.fingerprint::<sha2::Sha256>())
|
Ok(cert.fingerprint::<sha2::Sha256>())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[op2]
|
#[op2]
|
||||||
#[string]
|
#[string]
|
||||||
pub fn op_node_x509_fingerprint512(
|
pub fn op_node_x509_fingerprint512(
|
||||||
rid: v8::Local<v8::Object>,
|
#[cppgc] cert: &Certificate,
|
||||||
) -> Result<Option<String>, AnyError> {
|
) -> Result<Option<String>, AnyError> {
|
||||||
let cert = deno_core::cppgc::unwrap_cppgc_object::<Certificate>(rid)
|
|
||||||
.ok_or_else(bad_resource_id)?;
|
|
||||||
Ok(cert.fingerprint::<sha2::Sha512>())
|
Ok(cert.fingerprint::<sha2::Sha512>())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[op2]
|
#[op2]
|
||||||
#[string]
|
#[string]
|
||||||
pub fn op_node_x509_get_issuer(
|
pub fn op_node_x509_get_issuer(
|
||||||
rid: v8::Local<v8::Object>,
|
#[cppgc] cert: &Certificate,
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let cert = deno_core::cppgc::unwrap_cppgc_object::<Certificate>(rid)
|
|
||||||
.ok_or_else(bad_resource_id)?;
|
|
||||||
Ok(x509name_to_string(cert.issuer(), oid_registry())?)
|
Ok(x509name_to_string(cert.issuer(), oid_registry())?)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[op2]
|
#[op2]
|
||||||
#[string]
|
#[string]
|
||||||
pub fn op_node_x509_get_subject(
|
pub fn op_node_x509_get_subject(
|
||||||
rid: v8::Local<v8::Object>,
|
#[cppgc] cert: &Certificate,
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let cert = deno_core::cppgc::unwrap_cppgc_object::<Certificate>(rid)
|
|
||||||
.ok_or_else(bad_resource_id)?;
|
|
||||||
Ok(x509name_to_string(cert.subject(), oid_registry())?)
|
Ok(x509name_to_string(cert.subject(), oid_registry())?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,30 +214,24 @@ fn x509name_to_string(
|
||||||
#[op2]
|
#[op2]
|
||||||
#[string]
|
#[string]
|
||||||
pub fn op_node_x509_get_valid_from(
|
pub fn op_node_x509_get_valid_from(
|
||||||
rid: v8::Local<v8::Object>,
|
#[cppgc] cert: &Certificate,
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let cert = deno_core::cppgc::unwrap_cppgc_object::<Certificate>(rid)
|
|
||||||
.ok_or_else(bad_resource_id)?;
|
|
||||||
Ok(cert.validity().not_before.to_string())
|
Ok(cert.validity().not_before.to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[op2]
|
#[op2]
|
||||||
#[string]
|
#[string]
|
||||||
pub fn op_node_x509_get_valid_to(
|
pub fn op_node_x509_get_valid_to(
|
||||||
rid: v8::Local<v8::Object>,
|
#[cppgc] cert: &Certificate,
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let cert = deno_core::cppgc::unwrap_cppgc_object::<Certificate>(rid)
|
|
||||||
.ok_or_else(bad_resource_id)?;
|
|
||||||
Ok(cert.validity().not_after.to_string())
|
Ok(cert.validity().not_after.to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[op2]
|
#[op2]
|
||||||
#[string]
|
#[string]
|
||||||
pub fn op_node_x509_get_serial_number(
|
pub fn op_node_x509_get_serial_number(
|
||||||
rid: v8::Local<v8::Object>,
|
#[cppgc] cert: &Certificate,
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let cert = deno_core::cppgc::unwrap_cppgc_object::<Certificate>(rid)
|
|
||||||
.ok_or_else(bad_resource_id)?;
|
|
||||||
let mut s = cert.serial.to_str_radix(16);
|
let mut s = cert.serial.to_str_radix(16);
|
||||||
s.make_ascii_uppercase();
|
s.make_ascii_uppercase();
|
||||||
Ok(s)
|
Ok(s)
|
||||||
|
@ -261,11 +239,8 @@ pub fn op_node_x509_get_serial_number(
|
||||||
|
|
||||||
#[op2(fast)]
|
#[op2(fast)]
|
||||||
pub fn op_node_x509_key_usage(
|
pub fn op_node_x509_key_usage(
|
||||||
rid: v8::Local<v8::Object>,
|
#[cppgc] cert: &Certificate,
|
||||||
) -> Result<u16, AnyError> {
|
) -> Result<u16, AnyError> {
|
||||||
let cert = deno_core::cppgc::unwrap_cppgc_object::<Certificate>(rid)
|
|
||||||
.ok_or_else(bad_resource_id)?;
|
|
||||||
|
|
||||||
let key_usage = cert
|
let key_usage = cert
|
||||||
.extensions()
|
.extensions()
|
||||||
.iter()
|
.iter()
|
||||||
|
|
Loading…
Reference in a new issue