mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
refactor: cleanup unstable checks for WebGPU, FFI and FS APIs (#25586)
Continuation of work in #25488. --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
This commit is contained in:
parent
b0265eaf8f
commit
9e8f84214f
12 changed files with 152 additions and 137 deletions
|
@ -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() {
|
if !from_config_file.is_empty() {
|
||||||
// collect unstable granular flags
|
// collect unstable granular flags
|
||||||
let mut all_valid_unstable_flags: Vec<&str> =
|
let mut all_valid_unstable_flags: Vec<&str> =
|
||||||
|
|
|
@ -36,17 +36,11 @@ delete Object.prototype.__proto__;
|
||||||
"Kv",
|
"Kv",
|
||||||
"KvListIterator",
|
"KvListIterator",
|
||||||
"KvU64",
|
"KvU64",
|
||||||
"UnsafeCallback",
|
|
||||||
"UnsafePointer",
|
|
||||||
"UnsafePointerView",
|
|
||||||
"UnsafeFnPointer",
|
|
||||||
"UnixConnectOptions",
|
"UnixConnectOptions",
|
||||||
"UnixListenOptions",
|
"UnixListenOptions",
|
||||||
"dlopen",
|
|
||||||
"listen",
|
"listen",
|
||||||
"listenDatagram",
|
"listenDatagram",
|
||||||
"openKv",
|
"openKv",
|
||||||
"umask",
|
|
||||||
]);
|
]);
|
||||||
const unstableMsgSuggestion =
|
const unstableMsgSuggestion =
|
||||||
"If not, try changing the 'lib' compiler option to include 'deno.unstable' " +
|
"If not, try changing the 'lib' compiler option to include 'deno.unstable' " +
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
use crate::callback::PtrSymbol;
|
use crate::callback::PtrSymbol;
|
||||||
use crate::check_unstable;
|
|
||||||
use crate::dlfcn::DynamicLibraryResource;
|
use crate::dlfcn::DynamicLibraryResource;
|
||||||
use crate::ir::*;
|
use crate::ir::*;
|
||||||
use crate::symbol::NativeType;
|
use crate::symbol::NativeType;
|
||||||
|
@ -285,7 +284,6 @@ pub fn op_ffi_call_ptr_nonblocking<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(&state.borrow(), "Deno.UnsafeFnPointer#call");
|
|
||||||
{
|
{
|
||||||
let mut state = state.borrow_mut();
|
let mut state = state.borrow_mut();
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
|
@ -383,7 +381,6 @@ pub fn op_ffi_call_ptr<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(&state.borrow(), "Deno.UnsafeFnPointer#call");
|
|
||||||
{
|
{
|
||||||
let mut state = state.borrow_mut();
|
let mut state = state.borrow_mut();
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
|
|
|
@ -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 crate::check_unstable;
|
|
||||||
use crate::symbol::NativeType;
|
use crate::symbol::NativeType;
|
||||||
use crate::FfiPermissions;
|
use crate::FfiPermissions;
|
||||||
use crate::ForeignFunction;
|
use crate::ForeignFunction;
|
||||||
|
@ -557,7 +556,6 @@ pub fn op_ffi_unsafe_callback_create<FP, 'scope>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafeCallback");
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
|
|
@ -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 crate::check_unstable;
|
|
||||||
use crate::ir::out_buffer_as_ptr;
|
use crate::ir::out_buffer_as_ptr;
|
||||||
use crate::symbol::NativeType;
|
use crate::symbol::NativeType;
|
||||||
use crate::symbol::Symbol;
|
use crate::symbol::Symbol;
|
||||||
|
@ -124,7 +123,6 @@ where
|
||||||
{
|
{
|
||||||
let path = args.path;
|
let path = args.path;
|
||||||
|
|
||||||
check_unstable(state, "Deno.dlopen");
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(Some(&PathBuf::from(&path)))?;
|
permissions.check_partial(Some(&PathBuf::from(&path)))?;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// 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::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::OpState;
|
|
||||||
|
|
||||||
use std::mem::size_of;
|
use std::mem::size_of;
|
||||||
use std::os::raw::c_char;
|
use std::os::raw::c_char;
|
||||||
|
@ -41,14 +40,6 @@ const _: () = {
|
||||||
|
|
||||||
pub const UNSTABLE_FEATURE_NAME: &str = "ffi";
|
pub const UNSTABLE_FEATURE_NAME: &str = "ffi";
|
||||||
|
|
||||||
fn check_unstable(state: &OpState, api_name: &str) {
|
|
||||||
// TODO(bartlomieju): replace with `state.feature_checker.check_or_exit`
|
|
||||||
// once we phase out `check_or_exit_with_legacy_fallback`
|
|
||||||
state
|
|
||||||
.feature_checker
|
|
||||||
.check_or_exit_with_legacy_fallback(UNSTABLE_FEATURE_NAME, api_name)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait FfiPermissions {
|
pub trait FfiPermissions {
|
||||||
fn check_partial(&mut self, path: Option<&Path>) -> Result<(), AnyError>;
|
fn check_partial(&mut self, path: Option<&Path>) -> Result<(), AnyError>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 crate::check_unstable;
|
|
||||||
use crate::FfiPermissions;
|
use crate::FfiPermissions;
|
||||||
use deno_core::error::range_error;
|
use deno_core::error::range_error;
|
||||||
use deno_core::error::type_error;
|
use deno_core::error::type_error;
|
||||||
|
@ -21,7 +20,6 @@ pub fn op_ffi_ptr_create<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointer#create");
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -37,7 +35,6 @@ pub fn op_ffi_ptr_equals<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointer#equals");
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -52,7 +49,6 @@ pub fn op_ffi_ptr_of<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointer#of");
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -67,7 +63,6 @@ pub fn op_ffi_ptr_of_exact<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointer#of");
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -89,7 +84,6 @@ pub fn op_ffi_ptr_offset<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointer#offset");
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -120,7 +114,6 @@ pub fn op_ffi_ptr_value<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointer#value");
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -138,8 +131,6 @@ pub fn op_ffi_get_buf<FP, 'scope>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointerView#getArrayBuffer");
|
|
||||||
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -172,8 +163,6 @@ pub fn op_ffi_buf_copy_into<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointerView#copyInto");
|
|
||||||
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -205,8 +194,6 @@ pub fn op_ffi_cstr_read<FP, 'scope>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointerView#getCString");
|
|
||||||
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -233,8 +220,6 @@ pub fn op_ffi_read_bool<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointerView#getBool");
|
|
||||||
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -255,8 +240,6 @@ pub fn op_ffi_read_u8<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointerView#getUint8");
|
|
||||||
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -279,8 +262,6 @@ pub fn op_ffi_read_i8<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointerView#getInt8");
|
|
||||||
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -303,8 +284,6 @@ pub fn op_ffi_read_u16<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointerView#getUint16");
|
|
||||||
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -327,8 +306,6 @@ pub fn op_ffi_read_i16<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointerView#getInt16");
|
|
||||||
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -351,8 +328,6 @@ pub fn op_ffi_read_u32<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointerView#getUint32");
|
|
||||||
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -373,8 +348,6 @@ pub fn op_ffi_read_i32<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointerView#getInt32");
|
|
||||||
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -398,8 +371,6 @@ pub fn op_ffi_read_u64<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointerView#getBigUint64");
|
|
||||||
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -426,8 +397,6 @@ pub fn op_ffi_read_i64<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointerView#getBigInt64");
|
|
||||||
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -451,8 +420,6 @@ pub fn op_ffi_read_f32<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointerView#getFloat32");
|
|
||||||
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -473,8 +440,6 @@ pub fn op_ffi_read_f64<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointerView#getFloat64");
|
|
||||||
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
@ -495,8 +460,6 @@ pub fn op_ffi_read_ptr<FP>(
|
||||||
where
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.UnsafePointerView#getPointer");
|
|
||||||
|
|
||||||
let permissions = state.borrow_mut::<FP>();
|
let permissions = state.borrow_mut::<FP>();
|
||||||
permissions.check_partial(None)?;
|
permissions.check_partial(None)?;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ pub use crate::sync::MaybeSync;
|
||||||
use crate::ops::*;
|
use crate::ops::*;
|
||||||
|
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::OpState;
|
|
||||||
use deno_io::fs::FsError;
|
use deno_io::fs::FsError;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
@ -167,15 +166,6 @@ impl FsPermissions for deno_permissions::PermissionsContainer {
|
||||||
|
|
||||||
pub const UNSTABLE_FEATURE_NAME: &str = "fs";
|
pub const UNSTABLE_FEATURE_NAME: &str = "fs";
|
||||||
|
|
||||||
/// Helper for checking unstable features. Used for sync ops.
|
|
||||||
fn check_unstable(state: &OpState, api_name: &str) {
|
|
||||||
// TODO(bartlomieju): replace with `state.feature_checker.check_or_exit`
|
|
||||||
// once we phase out `check_or_exit_with_legacy_fallback`
|
|
||||||
state
|
|
||||||
.feature_checker
|
|
||||||
.check_or_exit_with_legacy_fallback(UNSTABLE_FEATURE_NAME, api_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
deno_core::extension!(deno_fs,
|
deno_core::extension!(deno_fs,
|
||||||
deps = [ deno_web ],
|
deps = [ deno_web ],
|
||||||
parameters = [P: FsPermissions],
|
parameters = [P: FsPermissions],
|
||||||
|
|
|
@ -26,7 +26,6 @@ use rand::thread_rng;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::check_unstable;
|
|
||||||
use crate::interface::AccessCheckFn;
|
use crate::interface::AccessCheckFn;
|
||||||
use crate::interface::FileSystemRc;
|
use crate::interface::FileSystemRc;
|
||||||
use crate::interface::FsDirEntry;
|
use crate::interface::FsDirEntry;
|
||||||
|
@ -121,7 +120,6 @@ pub fn op_fs_umask(
|
||||||
) -> Result<u32, AnyError>
|
) -> Result<u32, AnyError>
|
||||||
where
|
where
|
||||||
{
|
{
|
||||||
check_unstable(state, "Deno.umask");
|
|
||||||
state.borrow::<FileSystemRc>().umask(mask).context("umask")
|
state.borrow::<FileSystemRc>().umask(mask).context("umask")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -403,13 +403,6 @@ pub fn op_webgpu_request_adapter(
|
||||||
) -> Result<GpuAdapterResOrErr, AnyError> {
|
) -> Result<GpuAdapterResOrErr, AnyError> {
|
||||||
let mut state = state.borrow_mut();
|
let mut state = state.borrow_mut();
|
||||||
|
|
||||||
// TODO(bartlomieju): replace with `state.feature_checker.check_or_exit`
|
|
||||||
// once we phase out `check_or_exit_with_legacy_fallback`
|
|
||||||
state.feature_checker.check_or_exit_with_legacy_fallback(
|
|
||||||
UNSTABLE_FEATURE_NAME,
|
|
||||||
"navigator.gpu.requestAdapter",
|
|
||||||
);
|
|
||||||
|
|
||||||
let backends = std::env::var("DENO_WEBGPU_BACKEND").map_or_else(
|
let backends = std::env::var("DENO_WEBGPU_BACKEND").map_or_else(
|
||||||
|_| wgpu_types::Backends::all(),
|
|_| wgpu_types::Backends::all(),
|
||||||
|s| wgpu_core::instance::parse_backends_from_comma_list(&s),
|
|s| wgpu_core::instance::parse_backends_from_comma_list(&s),
|
||||||
|
|
|
@ -126,6 +126,12 @@ const denoNs = {
|
||||||
uid: os.uid,
|
uid: os.uid,
|
||||||
Command: process.Command,
|
Command: process.Command,
|
||||||
ChildProcess: process.ChildProcess,
|
ChildProcess: process.ChildProcess,
|
||||||
|
dlopen: ffi.dlopen,
|
||||||
|
UnsafeCallback: ffi.UnsafeCallback,
|
||||||
|
UnsafePointer: ffi.UnsafePointer,
|
||||||
|
UnsafePointerView: ffi.UnsafePointerView,
|
||||||
|
UnsafeFnPointer: ffi.UnsafeFnPointer,
|
||||||
|
umask: fs.umask,
|
||||||
httpClient: httpClient.httpClient,
|
httpClient: httpClient.httpClient,
|
||||||
createHttpClient: httpClient.createHttpClient,
|
createHttpClient: httpClient.createHttpClient,
|
||||||
};
|
};
|
||||||
|
@ -154,17 +160,9 @@ denoNsUnstableById[unstableIds.cron] = {
|
||||||
cron: cron.cron,
|
cron: cron.cron,
|
||||||
};
|
};
|
||||||
|
|
||||||
denoNsUnstableById[unstableIds.ffi] = {
|
denoNsUnstableById[unstableIds.ffi] = {};
|
||||||
dlopen: ffi.dlopen,
|
|
||||||
UnsafeCallback: ffi.UnsafeCallback,
|
|
||||||
UnsafePointer: ffi.UnsafePointer,
|
|
||||||
UnsafePointerView: ffi.UnsafePointerView,
|
|
||||||
UnsafeFnPointer: ffi.UnsafeFnPointer,
|
|
||||||
};
|
|
||||||
|
|
||||||
denoNsUnstableById[unstableIds.fs] = {
|
denoNsUnstableById[unstableIds.fs] = {};
|
||||||
umask: fs.umask,
|
|
||||||
};
|
|
||||||
|
|
||||||
denoNsUnstableById[unstableIds.http] = {
|
denoNsUnstableById[unstableIds.http] = {
|
||||||
HttpClient: httpClient.HttpClient,
|
HttpClient: httpClient.HttpClient,
|
||||||
|
|
|
@ -145,6 +145,148 @@ const windowOrWorkerGlobalScope = {
|
||||||
structuredClone: core.propWritable(messagePort.structuredClone),
|
structuredClone: core.propWritable(messagePort.structuredClone),
|
||||||
// Branding as a WebIDL object
|
// Branding as a WebIDL object
|
||||||
[webidl.brand]: core.propNonEnumerable(webidl.brand),
|
[webidl.brand]: core.propNonEnumerable(webidl.brand),
|
||||||
|
GPU: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPU, loadWebGPU),
|
||||||
|
GPUAdapter: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUAdapter,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUAdapterInfo: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUAdapterInfo,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUBuffer: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUBuffer,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUBufferUsage: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUBufferUsage,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUCanvasContext: core.propNonEnumerable(webgpuSurface.GPUCanvasContext),
|
||||||
|
GPUColorWrite: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUColorWrite,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUCommandBuffer: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUCommandBuffer,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUCommandEncoder: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUCommandEncoder,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUComputePassEncoder: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUComputePassEncoder,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUComputePipeline: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUComputePipeline,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUDevice: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUDevice,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUDeviceLostInfo: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUDeviceLostInfo,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUError: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUError,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUBindGroup: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUBindGroup,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUBindGroupLayout: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUBindGroupLayout,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUInternalError: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUInternalError,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUPipelineError: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUPipelineError,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUUncapturedErrorEvent: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUUncapturedErrorEvent,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUPipelineLayout: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUPipelineLayout,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUQueue: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUQueue,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUQuerySet: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUQuerySet,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUMapMode: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUMapMode,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUOutOfMemoryError: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUOutOfMemoryError,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPURenderBundle: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPURenderBundle,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPURenderBundleEncoder: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPURenderBundleEncoder,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPURenderPassEncoder: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPURenderPassEncoder,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPURenderPipeline: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPURenderPipeline,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUSampler: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUSampler,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUShaderModule: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUShaderModule,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUShaderStage: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUShaderStage,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUSupportedFeatures: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUSupportedFeatures,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUSupportedLimits: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUSupportedLimits,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUTexture: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUTexture,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUTextureView: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUTextureView,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUTextureUsage: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUTextureUsage,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
|
GPUValidationError: core.propNonEnumerableLazyLoaded(
|
||||||
|
(webgpu) => webgpu.GPUValidationError,
|
||||||
|
loadWebGPU,
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
const unstableForWindowOrWorkerGlobalScope = { __proto__: null };
|
const unstableForWindowOrWorkerGlobalScope = { __proto__: null };
|
||||||
|
@ -155,42 +297,7 @@ unstableForWindowOrWorkerGlobalScope[unstableIds.net] = {
|
||||||
WebSocketStream: core.propNonEnumerable(webSocketStream.WebSocketStream),
|
WebSocketStream: core.propNonEnumerable(webSocketStream.WebSocketStream),
|
||||||
WebSocketError: core.propNonEnumerable(webSocketStream.WebSocketError),
|
WebSocketError: core.propNonEnumerable(webSocketStream.WebSocketError),
|
||||||
};
|
};
|
||||||
// deno-fmt-ignore
|
|
||||||
unstableForWindowOrWorkerGlobalScope[unstableIds.webgpu] = {
|
unstableForWindowOrWorkerGlobalScope[unstableIds.webgpu] = {};
|
||||||
GPU: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPU, loadWebGPU),
|
|
||||||
GPUAdapter: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUAdapter, loadWebGPU),
|
|
||||||
GPUAdapterInfo: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUAdapterInfo, loadWebGPU),
|
|
||||||
GPUSupportedLimits: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUSupportedLimits, loadWebGPU),
|
|
||||||
GPUSupportedFeatures: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUSupportedFeatures, loadWebGPU),
|
|
||||||
GPUDeviceLostInfo: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUDeviceLostInfo, loadWebGPU),
|
|
||||||
GPUDevice: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUDevice, loadWebGPU),
|
|
||||||
GPUQueue: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUQueue, loadWebGPU),
|
|
||||||
GPUBuffer: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUBuffer, loadWebGPU),
|
|
||||||
GPUBufferUsage: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUBufferUsage, loadWebGPU),
|
|
||||||
GPUMapMode: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUMapMode, loadWebGPU),
|
|
||||||
GPUTextureUsage: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUTextureUsage, loadWebGPU),
|
|
||||||
GPUTexture: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUTexture, loadWebGPU),
|
|
||||||
GPUTextureView: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUTextureView, loadWebGPU),
|
|
||||||
GPUSampler: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUSampler, loadWebGPU),
|
|
||||||
GPUBindGroupLayout: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUBindGroupLayout, loadWebGPU),
|
|
||||||
GPUPipelineLayout: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUPipelineLayout, loadWebGPU),
|
|
||||||
GPUBindGroup: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUBindGroup, loadWebGPU),
|
|
||||||
GPUShaderModule: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUShaderModule, loadWebGPU),
|
|
||||||
GPUShaderStage: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUShaderStage, loadWebGPU),
|
|
||||||
GPUComputePipeline: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUComputePipeline, loadWebGPU),
|
|
||||||
GPURenderPipeline: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPURenderPipeline, loadWebGPU),
|
|
||||||
GPUColorWrite: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUColorWrite, loadWebGPU),
|
|
||||||
GPUCommandEncoder: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUCommandEncoder, loadWebGPU),
|
|
||||||
GPURenderPassEncoder: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPURenderPassEncoder, loadWebGPU),
|
|
||||||
GPUComputePassEncoder: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUComputePassEncoder, loadWebGPU),
|
|
||||||
GPUCommandBuffer: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUCommandBuffer, loadWebGPU),
|
|
||||||
GPURenderBundleEncoder: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPURenderBundleEncoder, loadWebGPU),
|
|
||||||
GPURenderBundle: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPURenderBundle, loadWebGPU),
|
|
||||||
GPUQuerySet: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUQuerySet, loadWebGPU),
|
|
||||||
GPUError: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUError, loadWebGPU),
|
|
||||||
GPUValidationError: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUValidationError, loadWebGPU),
|
|
||||||
GPUOutOfMemoryError: core.propNonEnumerableLazyLoaded((webgpu) => webgpu.GPUOutOfMemoryError, loadWebGPU),
|
|
||||||
GPUCanvasContext: core.propNonEnumerable(webgpuSurface.GPUCanvasContext),
|
|
||||||
};
|
|
||||||
|
|
||||||
export { unstableForWindowOrWorkerGlobalScope, windowOrWorkerGlobalScope };
|
export { unstableForWindowOrWorkerGlobalScope, windowOrWorkerGlobalScope };
|
||||||
|
|
Loading…
Reference in a new issue