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(core) deno_core::extension! macro to simplify extension registration #18210

Merged
merged 50 commits into from
Mar 17, 2023
Merged
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
1e33059
WIP: deno_core::ops!
mmastrac Mar 14, 2023
dd7f871
WIP extension
mmastrac Mar 15, 2023
782225d
WIP extension: napi
mmastrac Mar 15, 2023
ea04949
WIP: deno_websocket extension!
mmastrac Mar 15, 2023
ad224fb
WIP: extension! for deno_webidl and core
mmastrac Mar 15, 2023
910aaa6
Move state into the macro (though it could still live externally)
mmastrac Mar 15, 2023
e543288
Call the state initialization closure using the config fields
mmastrac Mar 15, 2023
f82ff1e
extension! for deno_bench, remove requirement for Default for now
mmastrac Mar 15, 2023
9b3180a
extension! for deno_console and deno_url
mmastrac Mar 15, 2023
0ed5c8c
extension! for deno_cli, deno_test, deno_tsc
mmastrac Mar 15, 2023
c55fda0
extension! for deno_broadcast_channel (required making Config object …
mmastrac Mar 15, 2023
702cfda
extension! for cache, crypto, ffi, webgpu
mmastrac Mar 15, 2023
df0112b
extension! deno_fetch, deno_flash, deno_bench and some internal exten…
mmastrac Mar 16, 2023
c846913
Move ops out of function
mmastrac Mar 16, 2023
81dc32a
Refactor extension! macro slightly
mmastrac Mar 16, 2023
d78cfb8
extension! for cli/build
mmastrac Mar 16, 2023
07044e7
Restore old init_ops/init_ops_and_esm names
mmastrac Mar 16, 2023
2f90862
extension! for webgpu and webgpu_surface
mmastrac Mar 16, 2023
5076f04
ops -> ops_fn
mmastrac Mar 16, 2023
c72730e
extension! deno_fs
mmastrac Mar 16, 2023
4c6f23d
extension! deno_io and deno_http
mmastrac Mar 16, 2023
34150ac
extension! for deno_net, deno_node, deno_load_loading
mmastrac Mar 16, 2023
a563d9e
Update runtime/build and cli/build
mmastrac Mar 16, 2023
37c43fa
extension! deno_tls, deno_web, runtime
mmastrac Mar 16, 2023
fa0eb50
extension! for various deno_* extensions
mmastrac Mar 16, 2023
c7b55b3
Rework extension! to use a struct
mmastrac Mar 16, 2023
0ed4b23
Update tests to use extension! macro
mmastrac Mar 16, 2023
38a0666
Merge branch 'main' into ops_extension
mmastrac Mar 16, 2023
7eb8eb5
Restore extensions after merge conflict
mmastrac Mar 16, 2023
d7bc1e5
Fold ops! into extension!
mmastrac Mar 16, 2023
80b04ca
Trailing comma
mmastrac Mar 16, 2023
4a1ad1d
Fix typo (moved code)
mmastrac Mar 16, 2023
661566d
Add customizer as a 'last resort' and implement extension! for cli
mmastrac Mar 16, 2023
6b39e21
Remove redundant clones
mmastrac Mar 16, 2023
993aa0f
Add deps for deno_fs
mmastrac Mar 16, 2023
6ef38e5
[ci]
mmastrac Mar 16, 2023
bbe8890
Merge branch 'main' into ops_extension
bartlomieju Mar 16, 2023
044c1b7
Add docs for extension!
mmastrac Mar 16, 2023
c16b4ea
Merge branch 'ops_extension' of https://github.com/mmastrac/deno into…
mmastrac Mar 16, 2023
dca0405
One last merge fix
mmastrac Mar 16, 2023
bb7a5fc
Missed deps for deno_websocket
mmastrac Mar 17, 2023
c4fb235
cargo fmt
mmastrac Mar 17, 2023
9983941
Merge branch 'main' into ops_extension
mmastrac Mar 17, 2023
f300f6a
Restore missing comment
mmastrac Mar 17, 2023
9a90368
Slighly cleaner approach for runtime_main extension
mmastrac Mar 17, 2023
3e03787
Construct vector in-place rather than using push
mmastrac Mar 17, 2023
ff419ae
Merge branch 'main' into ops_extension
mmastrac Mar 17, 2023
b009d64
Construct vec! in-place and avoid push
mmastrac Mar 17, 2023
93a9367
Merge branch 'main' of https://github.com/denoland/deno into ops_exte…
mmastrac Mar 17, 2023
0727418
Missed #[inline] on two functions
mmastrac Mar 17, 2023
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
Prev Previous commit
Missed #[inline] on two functions
  • Loading branch information
mmastrac committed Mar 17, 2023
commit 07274188e54b833f7cd6746c4f9f9523741a30fe
2 changes: 2 additions & 0 deletions core/extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ macro_rules! extension {
}

impl $name {
#[inline(always)]
fn ext() -> $crate::ExtensionBuilder {
$crate::Extension::builder_with_deps(stringify!($name), &[ $( $( stringify!($dep) ),* )? ])
}
Expand Down Expand Up @@ -296,6 +297,7 @@ macro_rules! extension {
/// Call a function of |state, ...| using the fields of this configuration structure.
#[allow(dead_code)]
#[doc(hidden)]
#[inline(always)]
fn call_callback<F: Fn(&mut $crate::OpState, $( $( $config_type ),* )?)>(self, state: &mut $crate::OpState, f: F) {
f(state, $( $( self. $config_id ),* )? )
}
Expand Down