Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: WebIDL derive macro #1003

Merged
merged 35 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
147fd07
feat: WebIDL derive macro
crowlKats Dec 16, 2024
fd612c1
address comments
crowlKats Dec 16, 2024
fdfe35d
fix
crowlKats Dec 16, 2024
23505c1
implement integers
crowlKats Dec 17, 2024
2f7dc35
fmt
crowlKats Dec 17, 2024
ec09ee6
handle options and fix various issues
crowlKats Dec 17, 2024
bdf6b39
Fixes
littledivy Dec 26, 2024
4081ace
Lint
littledivy Dec 26, 2024
edb414a
Use it
littledivy Dec 26, 2024
e6ef338
perf
crowlKats Dec 30, 2024
faf9bbe
fmt
crowlKats Dec 30, 2024
9b8ef38
eternals!
crowlKats Dec 31, 2024
413aadd
cleanup eternals, and add more converters
crowlKats Dec 31, 2024
137c071
fixes and implement enum converters
crowlKats Dec 31, 2024
07035da
lint
crowlKats Dec 31, 2024
c2d58ff
fix
crowlKats Dec 31, 2024
69774cd
properly handle all number types (except size and 128)
crowlKats Jan 1, 2025
cfd7dfd
add bypass to better_alternative_exists
crowlKats Jan 1, 2025
cf5aedc
cleanup
crowlKats Jan 1, 2025
4da8f0a
deref bytestring
crowlKats Jan 1, 2025
22c1f6e
handle proxy
crowlKats Jan 1, 2025
1a98743
fix
crowlKats Jan 1, 2025
5e326d7
Merge branch 'main' into webidl-converters
crowlKats Jan 1, 2025
e1a9245
macro tests
crowlKats Jan 1, 2025
84229d2
fix
crowlKats Jan 1, 2025
f6ae464
fix
crowlKats Jan 1, 2025
95c2564
fmt
crowlKats Jan 2, 2025
04c8370
change error message
crowlKats Jan 2, 2025
d9ab4d2
add more tests and update test expectation
crowlKats Jan 2, 2025
e94c2c6
more tests
crowlKats Jan 2, 2025
e07d1d3
cleanup and more tests
crowlKats Jan 2, 2025
666f4db
fix
crowlKats Jan 2, 2025
ce9c21e
fix miri for webidl tests
crowlKats Jan 2, 2025
4ce8132
Merge branch 'main' into webidl-converters
crowlKats Jan 2, 2025
21b1cd0
fix
crowlKats Jan 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 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 @@ -28,7 +28,7 @@ serde_v8 = { version = "0.236.0", path = "./serde_v8" }
deno_ast = { version = "=0.40.0", features = ["transpiling"] }
deno_core_icudata = "0.74.0"
deno_unsync = "0.4.1"
v8 = { version = "130.0.2", default-features = false }
v8 = { version = "130.0.4", default-features = false }

anyhow = "1"
bencher = "0.1"
Expand All @@ -40,6 +40,7 @@ cooked-waker = "5"
criterion = "0.5"
fastrand = "2"
futures = "0.3.21"
indexmap = "2.1.0"
libc = "0.2.126"
memoffset = ">=0.9"
num-bigint = { version = "0.4", features = ["rand"] }
Expand Down
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ deno_core_icudata = { workspace = true, optional = true }
deno_ops.workspace = true
deno_unsync.workspace = true
futures.workspace = true
indexmap = "2.1.0"
indexmap.workspace = true
libc.workspace = true
memoffset.workspace = true
parking_lot.workspace = true
Expand Down
9 changes: 8 additions & 1 deletion core/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,14 @@ impl std::error::Error for CustomError {}
/// If this error was crated with `custom_error()`, return the specified error
/// class name. In all other cases this function returns `None`.
pub fn get_custom_error_class(error: &Error) -> Option<&'static str> {
error.downcast_ref::<CustomError>().map(|e| e.class)
error
.downcast_ref::<CustomError>()
.map(|e| e.class)
.or_else(|| {
error
.downcast_ref::<crate::webidl::WebIdlError>()
.map(|_| "TypeError")
})
}

/// A wrapper around `anyhow::Error` that implements `std::error::Error`
Expand Down
5 changes: 3 additions & 2 deletions core/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ mod runtime;
mod source_map;
mod tasks;
mod web_timeout;
pub mod webidl;

// Re-exports
pub use anyhow;
pub use deno_ops::op2;
pub use deno_ops::WebIDL;
pub use deno_unsync as unsync;
pub use futures;
pub use parking_lot;
Expand All @@ -51,8 +54,6 @@ pub use sourcemap;
pub use url;
pub use v8;

pub use deno_ops::op2;

pub use crate::async_cancel::CancelFuture;
pub use crate::async_cancel::CancelHandle;
pub use crate::async_cancel::CancelTryFuture;
Expand Down
2 changes: 1 addition & 1 deletion core/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub mod ops_rust_to_v8;
mod setup;
mod snapshot;
pub mod stats;
pub(crate) mod v8_static_strings;
pub mod v8_static_strings;

#[cfg(all(test, not(miri)))]
mod tests;
Expand Down
3 changes: 2 additions & 1 deletion core/runtime/v8_static_strings.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
#[macro_export]
macro_rules! v8_static_strings {
($($ident:ident = $str:literal),* $(,)?) => {
$(
Expand All @@ -7,7 +8,7 @@ macro_rules! v8_static_strings {
};
}

pub(crate) use v8_static_strings;
pub use v8_static_strings;

v8_static_strings!(
BUILD_CUSTOM_ERROR = "buildCustomError",
Expand Down
Loading
Loading