summaryrefslogtreecommitdiff
path: root/cli/tsc
diff options
context:
space:
mode:
authorLeo Kettmeir <crowlkats@toaxl.com>2024-09-10 05:04:59 -0700
committerGitHub <noreply@github.com>2024-09-10 05:04:59 -0700
commitc2f97494f770dc36c0cacdb839f953b00e916e2c (patch)
tree8c2fb1d138760202dd4d15b3008b69115940d0e7 /cli/tsc
parent9a169e3cf11cccec0dd1a6acbfdba927d99658f5 (diff)
refactor: move WebGPU, FFI and FS typings from unstable to stable (#25488)
Closes #25377
Diffstat (limited to 'cli/tsc')
-rw-r--r--cli/tsc/dts/lib.deno.ns.d.ts689
-rw-r--r--cli/tsc/dts/lib.deno.unstable.d.ts804
-rw-r--r--cli/tsc/dts/lib.deno_webgpu.d.ts691
3 files changed, 829 insertions, 1355 deletions
diff --git a/cli/tsc/dts/lib.deno.ns.d.ts b/cli/tsc/dts/lib.deno.ns.d.ts
index adda5791b..1cf6667b1 100644
--- a/cli/tsc/dts/lib.deno.ns.d.ts
+++ b/cli/tsc/dts/lib.deno.ns.d.ts
@@ -4556,6 +4556,24 @@ declare namespace Deno {
mtime: number | Date,
): Promise<void>;
+ /** Retrieve the process umask. If `mask` is provided, sets the process umask.
+ * This call always returns what the umask was before the call.
+ *
+ * ```ts
+ * console.log(Deno.umask()); // e.g. 18 (0o022)
+ * const prevUmaskValue = Deno.umask(0o077); // e.g. 18 (0o022)
+ * console.log(Deno.umask()); // e.g. 63 (0o077)
+ * ```
+ *
+ * This API is under consideration to determine if permissions are required to
+ * call it.
+ *
+ * *Note*: This API is not implemented on Windows
+ *
+ * @category File System
+ */
+ export function umask(mask?: number): number;
+
/** The object that is returned from a {@linkcode Deno.upgradeWebSocket}
* request.
*
@@ -5395,4 +5413,675 @@ declare namespace Deno {
& (ServeTcpOptions | (ServeTcpOptions & TlsCertifiedKeyOptions))
& ServeInit<Deno.NetAddr>,
): HttpServer<Deno.NetAddr>;
+
+ /** All plain number types for interfacing with foreign functions.
+ *
+ * @category FFI
+ */
+ export type NativeNumberType =
+ | "u8"
+ | "i8"
+ | "u16"
+ | "i16"
+ | "u32"
+ | "i32"
+ | "f32"
+ | "f64";
+
+ /** All BigInt number types for interfacing with foreign functions.
+ *
+ * @category FFI
+ */
+ export type NativeBigIntType =
+ | "u64"
+ | "i64"
+ | "usize"
+ | "isize";
+
+ /** The native boolean type for interfacing to foreign functions.
+ *
+ * @category FFI
+ */
+ export type NativeBooleanType = "bool";
+
+ /** The native pointer type for interfacing to foreign functions.
+ *
+ * @category FFI
+ */
+ export type NativePointerType = "pointer";
+
+ /** The native buffer type for interfacing to foreign functions.
+ *
+ * @category FFI
+ */
+ export type NativeBufferType = "buffer";
+
+ /** The native function type for interfacing with foreign functions.
+ *
+ * @category FFI
+ */
+ export type NativeFunctionType = "function";
+
+ /** The native void type for interfacing with foreign functions.
+ *
+ * @category FFI
+ */
+ export type NativeVoidType = "void";
+
+ /** The native struct type for interfacing with foreign functions.
+ *
+ * @category FFI
+ */
+ export type NativeStructType = { readonly struct: readonly NativeType[] };
+
+ /**
+ * @category FFI
+ */
+ export const brand: unique symbol;
+
+ /**
+ * @category FFI
+ */
+ export type NativeU8Enum<T extends number> = "u8" & { [brand]: T };
+ /**
+ * @category FFI
+ */
+ export type NativeI8Enum<T extends number> = "i8" & { [brand]: T };
+ /**
+ * @category FFI
+ */
+ export type NativeU16Enum<T extends number> = "u16" & { [brand]: T };
+ /**
+ * @category FFI
+ */
+ export type NativeI16Enum<T extends number> = "i16" & { [brand]: T };
+ /**
+ * @category FFI
+ */
+ export type NativeU32Enum<T extends number> = "u32" & { [brand]: T };
+ /**
+ * @category FFI
+ */
+ export type NativeI32Enum<T extends number> = "i32" & { [brand]: T };
+ /**
+ * @category FFI
+ */
+ export type NativeTypedPointer<T extends PointerObject> = "pointer" & {
+ [brand]: T;
+ };
+ /**
+ * @category FFI
+ */
+ export type NativeTypedFunction<T extends UnsafeCallbackDefinition> =
+ & "function"
+ & {
+ [brand]: T;
+ };
+
+ /** All supported types for interfacing with foreign functions.
+ *
+ * @category FFI
+ */
+ export type NativeType =
+ | NativeNumberType
+ | NativeBigIntType
+ | NativeBooleanType
+ | NativePointerType
+ | NativeBufferType
+ | NativeFunctionType
+ | NativeStructType;
+
+ /** @category FFI
+ */
+ export type NativeResultType = NativeType | NativeVoidType;
+
+ /** Type conversion for foreign symbol parameters and unsafe callback return
+ * types.
+ *
+ * @category FFI
+ */
+ export type ToNativeType<T extends NativeType = NativeType> = T extends
+ NativeStructType ? BufferSource
+ : T extends NativeNumberType ? T extends NativeU8Enum<infer U> ? U
+ : T extends NativeI8Enum<infer U> ? U
+ : T extends NativeU16Enum<infer U> ? U
+ : T extends NativeI16Enum<infer U> ? U
+ : T extends NativeU32Enum<infer U> ? U
+ : T extends NativeI32Enum<infer U> ? U
+ : number
+ : T extends NativeBigIntType ? bigint
+ : T extends NativeBooleanType ? boolean
+ : T extends NativePointerType
+ ? T extends NativeTypedPointer<infer U> ? U | null : PointerValue
+ : T extends NativeFunctionType
+ ? T extends NativeTypedFunction<infer U> ? PointerValue<U> | null
+ : PointerValue
+ : T extends NativeBufferType ? BufferSource | null
+ : never;
+
+ /** Type conversion for unsafe callback return types.
+ *
+ * @category FFI
+ */
+ export type ToNativeResultType<
+ T extends NativeResultType = NativeResultType,
+ > = T extends NativeStructType ? BufferSource
+ : T extends NativeNumberType ? T extends NativeU8Enum<infer U> ? U
+ : T extends NativeI8Enum<infer U> ? U
+ : T extends NativeU16Enum<infer U> ? U
+ : T extends NativeI16Enum<infer U> ? U
+ : T extends NativeU32Enum<infer U> ? U
+ : T extends NativeI32Enum<infer U> ? U
+ : number
+ : T extends NativeBigIntType ? bigint
+ : T extends NativeBooleanType ? boolean
+ : T extends NativePointerType
+ ? T extends NativeTypedPointer<infer U> ? U | null : PointerValue
+ : T extends NativeFunctionType
+ ? T extends NativeTypedFunction<infer U> ? PointerObject<U> | null
+ : PointerValue
+ : T extends NativeBufferType ? BufferSource | null
+ : T extends NativeVoidType ? void
+ : never;
+
+ /** A utility type for conversion of parameter types of foreign functions.
+ *
+ * @category FFI
+ */
+ export type ToNativeParameterTypes<T extends readonly NativeType[]> =
+ //
+ [(T[number])[]] extends [T] ? ToNativeType<T[number]>[]
+ : [readonly (T[number])[]] extends [T]
+ ? readonly ToNativeType<T[number]>[]
+ : T extends readonly [...NativeType[]] ? {
+ [K in keyof T]: ToNativeType<T[K]>;
+ }
+ : never;
+
+ /** Type conversion for foreign symbol return types and unsafe callback
+ * parameters.
+ *
+ * @category FFI
+ */
+ export type FromNativeType<T extends NativeType = NativeType> = T extends
+ NativeStructType ? Uint8Array
+ : T extends NativeNumberType ? T extends NativeU8Enum<infer U> ? U
+ : T extends NativeI8Enum<infer U> ? U
+ : T extends NativeU16Enum<infer U> ? U
+ : T extends NativeI16Enum<infer U> ? U
+ : T extends NativeU32Enum<infer U> ? U
+ : T extends NativeI32Enum<infer U> ? U
+ : number
+ : T extends NativeBigIntType ? bigint
+ : T extends NativeBooleanType ? boolean
+ : T extends NativePointerType
+ ? T extends NativeTypedPointer<infer U> ? U | null : PointerValue
+ : T extends NativeBufferType ? PointerValue
+ : T extends NativeFunctionType
+ ? T extends NativeTypedFunction<infer U> ? PointerObject<U> | null
+ : PointerValue
+ : never;
+
+ /** Type conversion for foreign symbol return types.
+ *
+ * @category FFI
+ */
+ export type FromNativeResultType<
+ T extends NativeResultType = NativeResultType,
+ > = T extends NativeStructType ? Uint8Array
+ : T extends NativeNumberType ? T extends NativeU8Enum<infer U> ? U
+ : T extends NativeI8Enum<infer U> ? U
+ : T extends NativeU16Enum<infer U> ? U
+ : T extends NativeI16Enum<infer U> ? U
+ : T extends NativeU32Enum<infer U> ? U
+ : T extends NativeI32Enum<infer U> ? U
+ : number
+ : T extends NativeBigIntType ? bigint
+ : T extends NativeBooleanType ? boolean
+ : T extends NativePointerType
+ ? T extends NativeTypedPointer<infer U> ? U | null : PointerValue
+ : T extends NativeBufferType ? PointerValue
+ : T extends NativeFunctionType
+ ? T extends NativeTypedFunction<infer U> ? PointerObject<U> | null
+ : PointerValue
+ : T extends NativeVoidType ? void
+ : never;
+
+ /** @category FFI
+ */
+ export type FromNativeParameterTypes<
+ T extends readonly NativeType[],
+ > =
+ //
+ [(T[number])[]] extends [T] ? FromNativeType<T[number]>[]
+ : [readonly (T[number])[]] extends [T]
+ ? readonly FromNativeType<T[number]>[]
+ : T extends readonly [...NativeType[]] ? {
+ [K in keyof T]: FromNativeType<T[K]>;
+ }
+ : never;
+
+ /** The interface for a foreign function as defined by its parameter and result
+ * types.
+ *
+ * @category FFI
+ */
+ export interface ForeignFunction<
+ Parameters extends readonly NativeType[] = readonly NativeType[],
+ Result extends NativeResultType = NativeResultType,
+ NonBlocking extends boolean = boolean,
+ > {
+ /** Name of the symbol.
+ *
+ * Defaults to the key name in symbols object. */
+ name?: string;
+ /** The parameters of the foreign function. */
+ parameters: Parameters;
+ /** The result (return value) of the foreign function. */
+ result: Result;
+ /** When `true`, function calls will run on a dedicated blocking thread and
+ * will return a `Promise` resolving to the `result`. */
+ nonblocking?: NonBlocking;
+ /** When `true`, dlopen will not fail if the symbol is not found.
+ * Instead, the symbol will be set to `null`.
+ *
+ * @default {false} */
+ optional?: boolean;
+ }
+
+ /** @category FFI
+ */
+ export interface ForeignStatic<Type extends NativeType = NativeType> {
+ /** Name of the symbol, defaults to the key name in symbols object. */
+ name?: string;
+ /** The type of the foreign static value. */
+ type: Type;
+ /** When `true`, dlopen will not fail if the symbol is not found.
+ * Instead, the symbol will be set to `null`.
+ *
+ * @default {false} */
+ optional?: boolean;
+ }
+
+ /** A foreign library interface descriptor.
+ *
+ * @category FFI
+ */
+ export interface ForeignLibraryInterface {
+ [name: string]: ForeignFunction | ForeignStatic;
+ }
+
+ /** A utility type that infers a foreign symbol.
+ *
+ * @category FFI
+ */
+ export type StaticForeignSymbol<T extends ForeignFunction | ForeignStatic> =
+ T extends ForeignFunction ? FromForeignFunction<T>
+ : T extends ForeignStatic ? FromNativeType<T["type"]>
+ : never;
+
+ /** @category FFI
+ */
+ export type FromForeignFunction<T extends ForeignFunction> =
+ T["parameters"] extends readonly [] ? () => StaticForeignSymbolReturnType<T>
+ : (
+ ...args: ToNativeParameterTypes<T["parameters"]>
+ ) => StaticForeignSymbolReturnType<T>;
+
+ /** @category FFI
+ */
+ export type StaticForeignSymbolReturnType<T extends ForeignFunction> =
+ ConditionalAsync<T["nonblocking"], FromNativeResultType<T["result"]>>;
+
+ /** @category FFI
+ */
+ export type ConditionalAsync<IsAsync extends boolean | undefined, T> =
+ IsAsync extends true ? Promise<T> : T;
+
+ /** A utility type that infers a foreign library interface.
+ *
+ * @category FFI
+ */
+ export type StaticForeignLibraryInterface<T extends ForeignLibraryInterface> =
+ {
+ [K in keyof T]: T[K]["optional"] extends true
+ ? StaticForeignSymbol<T[K]> | null
+ : StaticForeignSymbol<T[K]>;
+ };
+
+ /** A non-null pointer, represented as an object
+ * at runtime. The object's prototype is `null`
+ * and cannot be changed. The object cannot be
+ * assigned to either and is thus entirely read-only.
+ *
+ * To interact with memory through a pointer use the
+ * {@linkcode UnsafePointerView} class. To create a
+ * pointer from an address or the get the address of
+ * a pointer use the static methods of the
+ * {@linkcode UnsafePointer} class.
+ *
+ * @category FFI
+ */
+ export type PointerObject<T = unknown> = { [brand]: T };
+
+ /** Pointers are represented either with a {@linkcode PointerObject}
+ * object or a `null` if the pointer is null.
+ *
+ * @category FFI
+ */
+ export type PointerValue<T = unknown> = null | PointerObject<T>;
+
+ /** A collection of static functions for interacting with pointer objects.
+ *
+ * @category FFI
+ */
+ export class UnsafePointer {
+ /** Create a pointer from a numeric value. This one is <i>really</i> dangerous! */
+ static create<T = unknown>(value: bigint): PointerValue<T>;
+ /** Returns `true` if the two pointers point to the same address. */
+ static equals<T = unknown>(a: PointerValue<T>, b: PointerValue<T>): boolean;
+ /** Return the direct memory pointer to the typed array in memory. */
+ static of<T = unknown>(
+ value: Deno.UnsafeCallback | BufferSource,
+ ): PointerValue<T>;
+ /** Return a new pointer offset from the original by `offset` bytes. */
+ static offset<T = unknown>(
+ value: PointerObject,
+ offset: number,
+ ): PointerValue<T>;
+ /** Get the numeric value of a pointer */
+ static value(value: PointerValue): bigint;
+ }
+
+ /** An unsafe pointer view to a memory location as specified by the `pointer`
+ * value. The `UnsafePointerView` API follows the standard built in interface
+ * {@linkcode DataView} for accessing the underlying types at an memory
+ * location (numbers, strings and raw bytes).
+ *
+ * @category FFI
+ */
+ export class UnsafePointerView {
+ constructor(pointer: PointerObject);
+
+ pointer: PointerObject;
+
+ /** Gets a boolean at the specified byte offset from the pointer. */
+ getBool(offset?: number): boolean;
+ /** Gets an unsigned 8-bit integer at the specified byte offset from the
+ * pointer. */
+ getUint8(offset?: number): number;
+ /** Gets a signed 8-bit integer at the specified byte offset from the
+ * pointer. */
+ getInt8(offset?: number): number;
+ /** Gets an unsigned 16-bit integer at the specified byte offset from the
+ * pointer. */
+ getUint16(offset?: number): number;
+ /** Gets a signed 16-bit integer at the specified byte offset from the
+ * pointer. */
+ getInt16(offset?: number): number;
+ /** Gets an unsigned 32-bit integer at the specified byte offset from the
+ * pointer. */
+ getUint32(offset?: number): number;
+ /** Gets a signed 32-bit integer at the specified byte offset from the
+ * pointer. */
+ getInt32(offset?: number): number;
+ /** Gets an unsigned 64-bit integer at the specified byte offset from the
+ * pointer. */
+ getBigUint64(offset?: number): bigint;
+ /** Gets a signed 64-bit integer at the specified byte offset from the
+ * pointer. */
+ getBigInt64(offset?: number): bigint;
+ /** Gets a signed 32-bit float at the specified byte offset from the
+ * pointer. */
+ getFloat32(offset?: number): number;
+ /** Gets a signed 64-bit float at the specified byte offset from the
+ * pointer. */
+ getFloat64(offset?: number): number;
+ /** Gets a pointer at the specified byte offset from the pointer */
+ getPointer<T = unknown>(offset?: number): PointerValue<T>;
+ /** Gets a C string (`null` terminated string) at the specified byte offset
+ * from the pointer. */
+ getCString(offset?: number): string;
+ /** Gets a C string (`null` terminated string) at the specified byte offset
+ * from the specified pointer. */
+ static getCString(
+ pointer: PointerObject,
+ offset?: number,
+ ): string;
+ /** Gets an `ArrayBuffer` of length `byteLength` at the specified byte
+ * offset from the pointer. */
+ getArrayBuffer(byteLength: number, offset?: number): ArrayBuffer;
+ /** Gets an `ArrayBuffer` of length `byteLength` at the specified byte
+ * offset from the specified pointer. */
+ static getArrayBuffer(
+ pointer: PointerObject,
+ byteLength: number,
+ offset?: number,
+ ): ArrayBuffer;
+ /** Copies the memory of the pointer into a typed array.
+ *
+ * Length is determined from the typed array's `byteLength`.
+ *
+ * Also takes optional byte offset from the pointer. */
+ copyInto(destination: BufferSource, offset?: number): void;
+ /** Copies the memory of the specified pointer into a typed array.
+ *
+ * Length is determined from the typed array's `byteLength`.
+ *
+ * Also takes optional byte offset from the pointer. */
+ static copyInto(
+ pointer: PointerObject,
+ destination: BufferSource,
+ offset?: number,
+ ): void;
+ }
+
+ /** An unsafe pointer to a function, for calling functions that are not present
+ * as symbols.
+ *
+ * @category FFI
+ */
+ export class UnsafeFnPointer<const Fn extends ForeignFunction> {
+ /** The pointer to the function. */
+ pointer: PointerObject<Fn>;
+ /** The definition of the function. */
+ definition: Fn;
+
+ constructor(pointer: PointerObject<NoInfer<Fn>>, definition: Fn);
+ /** @deprecated Properly type {@linkcode pointer} using {@linkcode NativeTypedFunction} or {@linkcode UnsafeCallbackDefinition} types. */
+ constructor(pointer: PointerObject, definition: Fn);
+
+ /** Call the foreign function. */
+ call: FromForeignFunction<Fn>;
+ }
+
+ /** Definition of a unsafe callback function.
+ *
+ * @category FFI
+ */
+ export interface UnsafeCallbackDefinition<
+ Parameters extends readonly NativeType[] = readonly NativeType[],
+ Result extends NativeResultType = NativeResultType,
+ > {
+ /** The parameters of the callbacks. */
+ parameters: Parameters;
+ /** The current result of the callback. */
+ result: Result;
+ }
+
+ /** An unsafe callback function.
+ *
+ * @category FFI
+ */
+ export type UnsafeCallbackFunction<
+ Parameters extends readonly NativeType[] = readonly NativeType[],
+ Result extends NativeResultType = NativeResultType,
+ > = Parameters extends readonly [] ? () => ToNativeResultType<Result> : (
+ ...args: FromNativeParameterTypes<Parameters>
+ ) => ToNativeResultType<Result>;
+
+ /** An unsafe function pointer for passing JavaScript functions as C function
+ * pointers to foreign function calls.
+ *
+ * The function pointer remains valid until the `close()` method is called.
+ *
+ * All `UnsafeCallback` are always thread safe in that they can be called from
+ * foreign threads without crashing. However, they do not wake up the Deno event
+ * loop by default.
+ *
+ * If a callback is to be called from foreign threads, use the `threadSafe()`
+ * static constructor or explicitly call `ref()` to have the callback wake up
+ * the Deno event loop when called from foreign threads. This also stops
+ * Deno's process from exiting while the callback still exists and is not
+ * unref'ed.
+ *
+ * Use `deref()` to then allow Deno's process to exit. Calling `deref()` on
+ * a ref'ed callback does not stop it from waking up the Deno event loop when
+ * called from foreign threads.
+ *
+ * @category FFI
+ */
+ export class UnsafeCallback<
+ const Definition extends UnsafeCallbackDefinition =
+ UnsafeCallbackDefinition,
+ > {
+ constructor(
+ definition: Definition,
+ callback: UnsafeCallbackFunction<
+ Definition["parameters"],
+ Definition["result"]
+ >,
+ );
+
+ /** The pointer to the unsafe callback. */
+ readonly pointer: PointerObject<Definition>;
+ /** The definition of the unsafe callback. */
+ readonly definition: Definition;
+ /** The callback function. */
+ readonly callback: UnsafeCallbackFunction<
+ Definition["parameters"],
+ Definition["result"]
+ >;
+
+ /**
+ * Creates an {@linkcode UnsafeCallback} and calls `ref()` once to allow it to
+ * wake up the Deno event loop when called from foreign threads.
+ *
+ * This also stops Deno's process from exiting while the callback still
+ * exists and is not unref'ed.
+ */
+ static threadSafe<
+ Definition extends UnsafeCallbackDefinition = UnsafeCallbackDefinition,
+ >(
+ definition: Definition,
+ callback: UnsafeCallbackFunction<
+ Definition["parameters"],
+ Definition["result"]
+ >,
+ ): UnsafeCallback<Definition>;
+
+ /**
+ * Increments the callback's reference counting and returns the new
+ * reference count.
+ *
+ * After `ref()` has been called, the callback always wakes up the
+ * Deno event loop when called from foreign threads.
+ *
+ * If the callback's reference count is non-zero, it keeps Deno's
+ * process from exiting.
+ */
+ ref(): number;
+
+ /**
+ * Decrements the callback's reference counting and returns the new
+ * reference count.
+ *
+ * Calling `unref()` does not stop a callback from waking up the Deno
+ * event loop when called from foreign threads.
+ *
+ * If the callback's reference counter is zero, it no longer keeps
+ * Deno's process from exiting.
+ */
+ unref(): number;
+
+ /**
+ * Removes the C function pointer associated with this instance.
+ *
+ * Continuing to use the instance or the C function pointer after closing
+ * the `UnsafeCallback` will lead to errors and crashes.
+ *
+ * Calling this method sets the callback's reference counting to zero,
+ * stops the callback from waking up the Deno event loop when called from
+ * foreign threads and no longer keeps Deno's process from exiting.
+ */
+ close(): void;
+ }
+
+ /** A dynamic library resource. Use {@linkcode Deno.dlopen} to load a dynamic
+ * library and return this interface.
+ *
+ * @category FFI
+ */
+ export interface DynamicLibrary<S extends ForeignLibraryInterface> {
+ /** All of the registered library along with functions for calling them. */
+ symbols: StaticForeignLibraryInterface<S>;
+ /** Removes the pointers associated with the library symbols.
+ *
+ * Continuing to use symbols that are part of the library will lead to
+ * errors and crashes.
+ *
+ * Calling this method will also immediately set any references to zero and
+ * will no longer keep Deno's process from exiting.
+ */
+ close(): void;
+ }
+
+ /** Opens an external dynamic library and registers symbols, making foreign
+ * functions available to be called.
+ *
+ * Requires `allow-ffi` permission. Loading foreign dynamic libraries can in
+ * theory bypass all of the sandbox permissions. While it is a separate
+ * permission users should acknowledge in practice that is effectively the
+ * same as running with the `allow-all` permission.
+ *
+ * @example Given a C library which exports a foreign function named `add()`
+ *
+ * ```ts
+ * // Determine library extension based on
+ * // your OS.
+ * let libSuffix = "";
+ * switch (Deno.build.os) {
+ * case "windows":
+ * libSuffix = "dll";
+ * break;
+ * case "darwin":
+ * libSuffix = "dylib";
+ * break;
+ * default:
+ * libSuffix = "so";
+ * break;
+ * }
+ *
+ * const libName = `./libadd.${libSuffix}`;
+ * // Open library and define exported symbols
+ * const dylib = Deno.dlopen(
+ * libName,
+ * {
+ * "add": { parameters: ["isize", "isize"], result: "isize" },
+ * } as const,
+ * );
+ *
+ * // Call the symbol `add`
+ * const result = dylib.symbols.add(35n, 34n); // 69n
+ *
+ * console.log(`Result from external addition of 35 and 34: ${result}`);
+ * ```
+ *
+ * @tags allow-ffi
+ * @category FFI
+ */
+ export function dlopen<const S extends ForeignLibraryInterface>(
+ filename: string | URL,
+ symbols: S,
+ ): DynamicLibrary<S>;
}
diff --git a/cli/tsc/dts/lib.deno.unstable.d.ts b/cli/tsc/dts/lib.deno.unstable.d.ts
index 7185b8b5a..b826aa1f7 100644
--- a/cli/tsc/dts/lib.deno.unstable.d.ts
+++ b/cli/tsc/dts/lib.deno.unstable.d.ts
@@ -3,7 +3,6 @@
/// <reference no-default-lib="true" />
/// <reference lib="deno.ns" />
/// <reference lib="deno.broadcast_channel" />
-/// <reference lib="deno.webgpu" />
/// <reference lib="esnext" />
/// <reference lib="es2022.intl" />
@@ -12,809 +11,6 @@ declare namespace Deno {
/** **UNSTABLE**: New API, yet to be vetted.
*
- * Retrieve the process umask. If `mask` is provided, sets the process umask.
- * This call always returns what the umask was before the call.
- *
- * ```ts
- * console.log(Deno.umask()); // e.g. 18 (0o022)
- * const prevUmaskValue = Deno.umask(0o077); // e.g. 18 (0o022)
- * console.log(Deno.umask()); // e.g. 63 (0o077)
- * ```
- *
- * This API is under consideration to determine if permissions are required to
- * call it.
- *
- * *Note*: This API is not implemented on Windows
- *
- * @category File System
- * @experimental
- */
- export function umask(mask?: number): number;
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * All plain number types for interfacing with foreign functions.
- *
- * @category FFI
- * @experimental
- */
- export type NativeNumberType =
- | "u8"
- | "i8"
- | "u16"
- | "i16"
- | "u32"
- | "i32"
- | "f32"
- | "f64";
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * All BigInt number types for interfacing with foreign functions.
- *
- * @category FFI
- * @experimental
- */
- export type NativeBigIntType =
- | "u64"
- | "i64"
- | "usize"
- | "isize";
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * The native boolean type for interfacing to foreign functions.
- *
- * @category FFI
- * @experimental
- */
- export type NativeBooleanType = "bool";
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * The native pointer type for interfacing to foreign functions.
- *
- * @category FFI
- * @experimental
- */
- export type NativePointerType = "pointer";
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * The native buffer type for interfacing to foreign functions.
- *
- * @category FFI
- * @experimental
- */
- export type NativeBufferType = "buffer";
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * The native function type for interfacing with foreign functions.
- *
- * @category FFI
- * @experimental
- */
- export type NativeFunctionType = "function";
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * The native void type for interfacing with foreign functions.
- *
- * @category FFI
- * @experimental
- */
- export type NativeVoidType = "void";
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * The native struct type for interfacing with foreign functions.
- *
- * @category FFI
- * @experimental
- */
- export type NativeStructType = { readonly struct: readonly NativeType[] };
-
- /**
- * @category FFI
- * @experimental
- */
- export const brand: unique symbol;
-
- /**
- * @category FFI
- * @experimental
- */
- export type NativeU8Enum<T extends number> = "u8" & { [brand]: T };
- /**
- * @category FFI
- * @experimental
- */
- export type NativeI8Enum<T extends number> = "i8" & { [brand]: T };
- /**
- * @category FFI
- * @experimental
- */
- export type NativeU16Enum<T extends number> = "u16" & { [brand]: T };
- /**
- * @category FFI
- * @experimental
- */
- export type NativeI16Enum<T extends number> = "i16" & { [brand]: T };
- /**
- * @category FFI
- * @experimental
- */
- export type NativeU32Enum<T extends number> = "u32" & { [brand]: T };
- /**
- * @category FFI
- * @experimental
- */
- export type NativeI32Enum<T extends number> = "i32" & { [brand]: T };
- /**
- * @category FFI
- * @experimental
- */
- export type NativeTypedPointer<T extends PointerObject> = "pointer" & {
- [brand]: T;
- };
- /**
- * @category FFI
- * @experimental
- */
- export type NativeTypedFunction<T extends UnsafeCallbackDefinition> =
- & "function"
- & {
- [brand]: T;
- };
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * All supported types for interfacing with foreign functions.
- *
- * @category FFI
- * @experimental
- */
- export type NativeType =
- | NativeNumberType
- | NativeBigIntType
- | NativeBooleanType
- | NativePointerType
- | NativeBufferType
- | NativeFunctionType
- | NativeStructType;
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * @category FFI
- * @experimental
- */
- export type NativeResultType = NativeType | NativeVoidType;
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * Type conversion for foreign symbol parameters and unsafe callback return
- * types.
- *
- * @category FFI
- * @experimental
- */
- export type ToNativeType<T extends NativeType = NativeType> = T extends
- NativeStructType ? BufferSource
- : T extends NativeNumberType ? T extends NativeU8Enum<infer U> ? U
- : T extends NativeI8Enum<infer U> ? U
- : T extends NativeU16Enum<infer U> ? U
- : T extends NativeI16Enum<infer U> ? U
- : T extends NativeU32Enum<infer U> ? U
- : T extends NativeI32Enum<infer U> ? U
- : number
- : T extends NativeBigIntType ? bigint
- : T extends NativeBooleanType ? boolean
- : T extends NativePointerType
- ? T extends NativeTypedPointer<infer U> ? U | null : PointerValue
- : T extends NativeFunctionType
- ? T extends NativeTypedFunction<infer U> ? PointerValue<U> | null
- : PointerValue
- : T extends NativeBufferType ? BufferSource | null
- : never;
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * Type conversion for unsafe callback return types.
- *
- * @category FFI
- * @experimental
- */
- export type ToNativeResultType<
- T extends NativeResultType = NativeResultType,
- > = T extends NativeStructType ? BufferSource
- : T extends NativeNumberType ? T extends NativeU8Enum<infer U> ? U
- : T extends NativeI8Enum<infer U> ? U
- : T extends NativeU16Enum<infer U> ? U
- : T extends NativeI16Enum<infer U> ? U
- : T extends NativeU32Enum<infer U> ? U
- : T extends NativeI32Enum<infer U> ? U
- : number
- : T extends NativeBigIntType ? bigint
- : T extends NativeBooleanType ? boolean
- : T extends NativePointerType
- ? T extends NativeTypedPointer<infer U> ? U | null : PointerValue
- : T extends NativeFunctionType
- ? T extends NativeTypedFunction<infer U> ? PointerObject<U> | null
- : PointerValue
- : T extends NativeBufferType ? BufferSource | null
- : T extends NativeVoidType ? void
- : never;
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * A utility type for conversion of parameter types of foreign functions.
- *
- * @category FFI
- * @experimental
- */
- export type ToNativeParameterTypes<T extends readonly NativeType[]> =
- //
- [(T[number])[]] extends [T] ? ToNativeType<T[number]>[]
- : [readonly (T[number])[]] extends [T]
- ? readonly ToNativeType<T[number]>[]
- : T extends readonly [...NativeType[]] ? {
- [K in keyof T]: ToNativeType<T[K]>;
- }
- : never;
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * Type conversion for foreign symbol return types and unsafe callback
- * parameters.
- *
- * @category FFI
- * @experimental
- */
- export type FromNativeType<T extends NativeType = NativeType> = T extends
- NativeStructType ? Uint8Array
- : T extends NativeNumberType ? T extends NativeU8Enum<infer U> ? U
- : T extends NativeI8Enum<infer U> ? U
- : T extends NativeU16Enum<infer U> ? U
- : T extends NativeI16Enum<infer U> ? U
- : T extends NativeU32Enum<infer U> ? U
- : T extends NativeI32Enum<infer U> ? U
- : number
- : T extends NativeBigIntType ? bigint
- : T extends NativeBooleanType ? boolean
- : T extends NativePointerType
- ? T extends NativeTypedPointer<infer U> ? U | null : PointerValue
- : T extends NativeBufferType ? PointerValue
- : T extends NativeFunctionType
- ? T extends NativeTypedFunction<infer U> ? PointerObject<U> | null
- : PointerValue
- : never;
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * Type conversion for foreign symbol return types.
- *
- * @category FFI
- * @experimental
- */
- export type FromNativeResultType<
- T extends NativeResultType = NativeResultType,
- > = T extends NativeStructType ? Uint8Array
- : T extends NativeNumberType ? T extends NativeU8Enum<infer U> ? U
- : T extends NativeI8Enum<infer U> ? U
- : T extends NativeU16Enum<infer U> ? U
- : T extends NativeI16Enum<infer U> ? U
- : T extends NativeU32Enum<infer U> ? U
- : T extends NativeI32Enum<infer U> ? U
- : number
- : T extends NativeBigIntType ? bigint
- : T extends NativeBooleanType ? boolean
- : T extends NativePointerType
- ? T extends NativeTypedPointer<infer U> ? U | null : PointerValue
- : T extends NativeBufferType ? PointerValue
- : T extends NativeFunctionType
- ? T extends NativeTypedFunction<infer U> ? PointerObject<U> | null
- : PointerValue
- : T extends NativeVoidType ? void
- : never;
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * @category FFI
- * @experimental
- */
- export type FromNativeParameterTypes<
- T extends readonly NativeType[],
- > =
- //
- [(T[number])[]] extends [T] ? FromNativeType<T[number]>[]
- : [readonly (T[number])[]] extends [T]
- ? readonly FromNativeType<T[number]>[]
- : T extends readonly [...NativeType[]] ? {
- [K in keyof T]: FromNativeType<T[K]>;
- }
- : never;
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * The interface for a foreign function as defined by its parameter and result
- * types.
- *
- * @category FFI
- * @experimental
- */
- export interface ForeignFunction<
- Parameters extends readonly NativeType[] = readonly NativeType[],
- Result extends NativeResultType = NativeResultType,
- NonBlocking extends boolean = boolean,
- > {
- /** Name of the symbol.
- *
- * Defaults to the key name in symbols object. */
- name?: string;
- /** The parameters of the foreign function. */
- parameters: Parameters;
- /** The result (return value) of the foreign function. */
- result: Result;
- /** When `true`, function calls will run on a dedicated blocking thread and
- * will return a `Promise` resolving to the `result`. */
- nonblocking?: NonBlocking;
- /** When `true`, dlopen will not fail if the symbol is not found.
- * Instead, the symbol will be set to `null`.
- *
- * @default {false} */
- optional?: boolean;
- }
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * @category FFI
- * @experimental
- */
- export interface ForeignStatic<Type extends NativeType = NativeType> {
- /** Name of the symbol, defaults to the key name in symbols object. */
- name?: string;
- /** The type of the foreign static value. */
- type: Type;
- /** When `true`, dlopen will not fail if the symbol is not found.
- * Instead, the symbol will be set to `null`.
- *
- * @default {false} */
- optional?: boolean;
- }
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * A foreign library interface descriptor.
- *
- * @category FFI
- * @experimental
- */
- export interface ForeignLibraryInterface {
- [name: string]: ForeignFunction | ForeignStatic;
- }
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * A utility type that infers a foreign symbol.
- *
- * @category FFI
- * @experimental
- */
- export type StaticForeignSymbol<T extends ForeignFunction | ForeignStatic> =
- T extends ForeignFunction ? FromForeignFunction<T>
- : T extends ForeignStatic ? FromNativeType<T["type"]>
- : never;
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * @category FFI
- * @experimental
- */
- export type FromForeignFunction<T extends ForeignFunction> =
- T["parameters"] extends readonly [] ? () => StaticForeignSymbolReturnType<T>
- : (
- ...args: ToNativeParameterTypes<T["parameters"]>
- ) => StaticForeignSymbolReturnType<T>;
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * @category FFI
- * @experimental
- */
- export type StaticForeignSymbolReturnType<T extends ForeignFunction> =
- ConditionalAsync<T["nonblocking"], FromNativeResultType<T["result"]>>;
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * @category FFI
- * @experimental
- */
- export type ConditionalAsync<IsAsync extends boolean | undefined, T> =
- IsAsync extends true ? Promise<T> : T;
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * A utility type that infers a foreign library interface.
- *
- * @category FFI
- * @experimental
- */
- export type StaticForeignLibraryInterface<T extends ForeignLibraryInterface> =
- {
- [K in keyof T]: T[K]["optional"] extends true
- ? StaticForeignSymbol<T[K]> | null
- : StaticForeignSymbol<T[K]>;
- };
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * A non-null pointer, represented as an object
- * at runtime. The object's prototype is `null`
- * and cannot be changed. The object cannot be
- * assigned to either and is thus entirely read-only.
- *
- * To interact with memory through a pointer use the
- * {@linkcode UnsafePointerView} class. To create a
- * pointer from an address or the get the address of
- * a pointer use the static methods of the
- * {@linkcode UnsafePointer} class.
- *
- * @category FFI
- * @experimental
- */
- export type PointerObject<T = unknown> = { [brand]: T };
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * Pointers are represented either with a {@linkcode PointerObject}
- * object or a `null` if the pointer is null.
- *
- * @category FFI
- * @experimental
- */
- export type PointerValue<T = unknown> = null | PointerObject<T>;
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * A collection of static functions for interacting with pointer objects.
- *
- * @category FFI
- * @experimental
- */
- export class UnsafePointer {
- /** Create a pointer from a numeric value. This one is <i>really</i> dangerous! */
- static create<T = unknown>(value: bigint): PointerValue<T>;
- /** Returns `true` if the two pointers point to the same address. */
- static equals<T = unknown>(a: PointerValue<T>, b: PointerValue<T>): boolean;
- /** Return the direct memory pointer to the typed array in memory. */
- static of<T = unknown>(
- value: Deno.UnsafeCallback | BufferSource,
- ): PointerValue<T>;
- /** Return a new pointer offset from the original by `offset` bytes. */
- static offset<T = unknown>(
- value: PointerObject,
- offset: number,
- ): PointerValue<T>;
- /** Get the numeric value of a pointer */
- static value(value: PointerValue): bigint;
- }
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * An unsafe pointer view to a memory location as specified by the `pointer`
- * value. The `UnsafePointerView` API follows the standard built in interface
- * {@linkcode DataView} for accessing the underlying types at an memory
- * location (numbers, strings and raw bytes).
- *
- * @category FFI
- * @experimental
- */
- export class UnsafePointerView {
- constructor(pointer: PointerObject);
-
- pointer: PointerObject;
-
- /** Gets a boolean at the specified byte offset from the pointer. */
- getBool(offset?: number): boolean;
- /** Gets an unsigned 8-bit integer at the specified byte offset from the
- * pointer. */
- getUint8(offset?: number): number;
- /** Gets a signed 8-bit integer at the specified byte offset from the
- * pointer. */
- getInt8(offset?: number): number;
- /** Gets an unsigned 16-bit integer at the specified byte offset from the
- * pointer. */
- getUint16(offset?: number): number;
- /** Gets a signed 16-bit integer at the specified byte offset from the
- * pointer. */
- getInt16(offset?: number): number;
- /** Gets an unsigned 32-bit integer at the specified byte offset from the
- * pointer. */
- getUint32(offset?: number): number;
- /** Gets a signed 32-bit integer at the specified byte offset from the
- * pointer. */
- getInt32(offset?: number): number;
- /** Gets an unsigned 64-bit integer at the specified byte offset from the
- * pointer. */
- getBigUint64(offset?: number): bigint;
- /** Gets a signed 64-bit integer at the specified byte offset from the
- * pointer. */
- getBigInt64(offset?: number): bigint;
- /** Gets a signed 32-bit float at the specified byte offset from the
- * pointer. */
- getFloat32(offset?: number): number;
- /** Gets a signed 64-bit float at the specified byte offset from the
- * pointer. */
- getFloat64(offset?: number): number;
- /** Gets a pointer at the specified byte offset from the pointer */
- getPointer<T = unknown>(offset?: number): PointerValue<T>;
- /** Gets a C string (`null` terminated string) at the specified byte offset
- * from the pointer. */
- getCString(offset?: number): string;
- /** Gets a C string (`null` terminated string) at the specified byte offset
- * from the specified pointer. */
- static getCString(
- pointer: PointerObject,
- offset?: number,
- ): string;
- /** Gets an `ArrayBuffer` of length `byteLength` at the specified byte
- * offset from the pointer. */
- getArrayBuffer(byteLength: number, offset?: number): ArrayBuffer;
- /** Gets an `ArrayBuffer` of length `byteLength` at the specified byte
- * offset from the specified pointer. */
- static getArrayBuffer(
- pointer: PointerObject,
- byteLength: number,
- offset?: number,
- ): ArrayBuffer;
- /** Copies the memory of the pointer into a typed array.
- *
- * Length is determined from the typed array's `byteLength`.
- *
- * Also takes optional byte offset from the pointer. */
- copyInto(destination: BufferSource, offset?: number): void;
- /** Copies the memory of the specified pointer into a typed array.
- *
- * Length is determined from the typed array's `byteLength`.
- *
- * Also takes optional byte offset from the pointer. */
- static copyInto(
- pointer: PointerObject,
- destination: BufferSource,
- offset?: number,
- ): void;
- }
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * An unsafe pointer to a function, for calling functions that are not present
- * as symbols.
- *
- * @category FFI
- * @experimental
- */
- export class UnsafeFnPointer<const Fn extends ForeignFunction> {
- /** The pointer to the function. */
- pointer: PointerObject<Fn>;
- /** The definition of the function. */
- definition: Fn;
-
- constructor(pointer: PointerObject<NoInfer<Fn>>, definition: Fn);
- /** @deprecated Properly type {@linkcode pointer} using {@linkcode NativeTypedFunction} or {@linkcode UnsafeCallbackDefinition} types. */
- constructor(pointer: PointerObject, definition: Fn);
-
- /** Call the foreign function. */
- call: FromForeignFunction<Fn>;
- }
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * Definition of a unsafe callback function.
- *
- * @category FFI
- * @experimental
- */
- export interface UnsafeCallbackDefinition<
- Parameters extends readonly NativeType[] = readonly NativeType[],
- Result extends NativeResultType = NativeResultType,
- > {
- /** The parameters of the callbacks. */
- parameters: Parameters;
- /** The current result of the callback. */
- result: Result;
- }
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * An unsafe callback function.
- *
- * @category FFI
- * @experimental
- */
- export type UnsafeCallbackFunction<
- Parameters extends readonly NativeType[] = readonly NativeType[],
- Result extends NativeResultType = NativeResultType,
- > = Parameters extends readonly [] ? () => ToNativeResultType<Result> : (
- ...args: FromNativeParameterTypes<Parameters>
- ) => ToNativeResultType<Result>;
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * An unsafe function pointer for passing JavaScript functions as C function
- * pointers to foreign function calls.
- *
- * The function pointer remains valid until the `close()` method is called.
- *
- * All `UnsafeCallback` are always thread safe in that they can be called from
- * foreign threads without crashing. However, they do not wake up the Deno event
- * loop by default.
- *
- * If a callback is to be called from foreign threads, use the `threadSafe()`
- * static constructor or explicitly call `ref()` to have the callback wake up
- * the Deno event loop when called from foreign threads. This also stops
- * Deno's process from exiting while the callback still exists and is not
- * unref'ed.
- *
- * Use `deref()` to then allow Deno's process to exit. Calling `deref()` on
- * a ref'ed callback does not stop it from waking up the Deno event loop when
- * called from foreign threads.
- *
- * @category FFI
- * @experimental
- */
- export class UnsafeCallback<
- const Definition extends UnsafeCallbackDefinition =
- UnsafeCallbackDefinition,
- > {
- constructor(
- definition: Definition,
- callback: UnsafeCallbackFunction<
- Definition["parameters"],
- Definition["result"]
- >,
- );
-
- /** The pointer to the unsafe callback. */
- readonly pointer: PointerObject<Definition>;
- /** The definition of the unsafe callback. */
- readonly definition: Definition;
- /** The callback function. */
- readonly callback: UnsafeCallbackFunction<
- Definition["parameters"],
- Definition["result"]
- >;
-
- /**
- * Creates an {@linkcode UnsafeCallback} and calls `ref()` once to allow it to
- * wake up the Deno event loop when called from foreign threads.
- *
- * This also stops Deno's process from exiting while the callback still
- * exists and is not unref'ed.
- */
- static threadSafe<
- Definition extends UnsafeCallbackDefinition = UnsafeCallbackDefinition,
- >(
- definition: Definition,
- callback: UnsafeCallbackFunction<
- Definition["parameters"],
- Definition["result"]
- >,
- ): UnsafeCallback<Definition>;
-
- /**
- * Increments the callback's reference counting and returns the new
- * reference count.
- *
- * After `ref()` has been called, the callback always wakes up the
- * Deno event loop when called from foreign threads.
- *
- * If the callback's reference count is non-zero, it keeps Deno's
- * process from exiting.
- */
- ref(): number;
-
- /**
- * Decrements the callback's reference counting and returns the new
- * reference count.
- *
- * Calling `unref()` does not stop a callback from waking up the Deno
- * event loop when called from foreign threads.
- *
- * If the callback's reference counter is zero, it no longer keeps
- * Deno's process from exiting.
- */
- unref(): number;
-
- /**
- * Removes the C function pointer associated with this instance.
- *
- * Continuing to use the instance or the C function pointer after closing
- * the `UnsafeCallback` will lead to errors and crashes.
- *
- * Calling this method sets the callback's reference counting to zero,
- * stops the callback from waking up the Deno event loop when called from
- * foreign threads and no longer keeps Deno's process from exiting.
- */
- close(): void;
- }
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * A dynamic library resource. Use {@linkcode Deno.dlopen} to load a dynamic
- * library and return this interface.
- *
- * @category FFI
- * @experimental
- */
- export interface DynamicLibrary<S extends ForeignLibraryInterface> {
- /** All of the registered library along with functions for calling them. */
- symbols: StaticForeignLibraryInterface<S>;
- /** Removes the pointers associated with the library symbols.
- *
- * Continuing to use symbols that are part of the library will lead to
- * errors and crashes.
- *
- * Calling this method will also immediately set any references to zero and
- * will no longer keep Deno's process from exiting.
- */
- close(): void;
- }
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
- * Opens an external dynamic library and registers symbols, making foreign
- * functions available to be called.
- *
- * Requires `allow-ffi` permission. Loading foreign dynamic libraries can in
- * theory bypass all of the sandbox permissions. While it is a separate
- * permission users should acknowledge in practice that is effectively the
- * same as running with the `allow-all` permission.
- *
- * @example Given a C library which exports a foreign function named `add()`
- *
- * ```ts
- * // Determine library extension based on
- * // your OS.
- * let libSuffix = "";
- * switch (Deno.build.os) {
- * case "windows":
- * libSuffix = "dll";
- * break;
- * case "darwin":
- * libSuffix = "dylib";
- * break;
- * default:
- * libSuffix = "so";
- * break;
- * }
- *
- * const libName = `./libadd.${libSuffix}`;
- * // Open library and define exported symbols
- * const dylib = Deno.dlopen(
- * libName,
- * {
- * "add": { parameters: ["isize", "isize"], result: "isize" },
- * } as const,
- * );
- *
- * // Call the symbol `add`
- * const result = dylib.symbols.add(35n, 34n); // 69n
- *
- * console.log(`Result from external addition of 35 and 34: ${result}`);
- * ```
- *
- * @tags allow-ffi
- * @category FFI
- * @experimental
- */
- export function dlopen<const S extends ForeignLibraryInterface>(
- filename: string | URL,
- symbols: S,
- ): DynamicLibrary<S>;
-
- /** **UNSTABLE**: New API, yet to be vetted.
- *
* Creates a presentable WebGPU surface from given window and
* display handles.
*
diff --git a/cli/tsc/dts/lib.deno_webgpu.d.ts b/cli/tsc/dts/lib.deno_webgpu.d.ts
index 944af0e4c..fc2676b2e 100644
--- a/cli/tsc/dts/lib.deno_webgpu.d.ts
+++ b/cli/tsc/dts/lib.deno_webgpu.d.ts
@@ -5,26 +5,17 @@
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUObjectBase {
label: string;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUObjectDescriptorBase {
label?: string;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUSupportedLimits {
maxTextureDimension1D?: number;
maxTextureDimension2D?: number;
@@ -58,10 +49,7 @@ declare class GPUSupportedLimits {
maxComputeWorkgroupsPerDimension?: number;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUSupportedFeatures {
forEach(
callbackfn: (
@@ -79,10 +67,7 @@ declare class GPUSupportedFeatures {
values(): IterableIterator<GPUFeatureName>;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUAdapterInfo {
readonly vendor: string;
readonly architecture: string;
@@ -90,10 +75,7 @@ declare class GPUAdapterInfo {
readonly description: string;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPU {
requestAdapter(
options?: GPURequestAdapterOptions,
@@ -101,25 +83,16 @@ declare class GPU {
getPreferredCanvasFormat(): GPUTextureFormat;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPURequestAdapterOptions {
powerPreference?: GPUPowerPreference;
forceFallbackAdapter?: boolean;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUPowerPreference = "low-power" | "high-performance";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUAdapter {
readonly features: GPUSupportedFeatures;
readonly limits: GPUSupportedLimits;
@@ -129,19 +102,13 @@ declare class GPUAdapter {
requestDevice(descriptor?: GPUDeviceDescriptor): Promise<GPUDevice>;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUDeviceDescriptor extends GPUObjectDescriptorBase {
requiredFeatures?: GPUFeatureName[];
requiredLimits?: Record<string, number>;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUFeatureName =
| "depth-clip-control"
| "depth32float-stencil8"
@@ -169,10 +136,7 @@ declare type GPUFeatureName =
| "shader-float64"
| "vertex-attribute-64bit";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUDevice extends EventTarget implements GPUObjectBase {
label: string;
@@ -222,10 +186,7 @@ declare class GPUDevice extends EventTarget implements GPUObjectBase {
createQuerySet(descriptor: GPUQuerySetDescriptor): GPUQuerySet;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUBuffer implements GPUObjectBase {
label: string;
@@ -244,38 +205,23 @@ declare class GPUBuffer implements GPUObjectBase {
destroy(): undefined;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUBufferMapState = "unmapped" | "pending" | "mapped";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUBufferDescriptor extends GPUObjectDescriptorBase {
size: number;
usage: GPUBufferUsageFlags;
mappedAtCreation?: boolean;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUBufferUsageFlags = number;
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUFlagsConstant = number;
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUBufferUsage {
static MAP_READ: 0x0001;
static MAP_WRITE: 0x0002;
@@ -289,25 +235,16 @@ declare class GPUBufferUsage {
static QUERY_RESOLVE: 0x0200;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUMapModeFlags = number;
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUMapMode {
static READ: 0x0001;
static WRITE: 0x0002;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUTexture implements GPUObjectBase {
label: string;
@@ -324,10 +261,7 @@ declare class GPUTexture implements GPUObjectBase {
readonly usage: GPUFlagsConstant;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUTextureDescriptor extends GPUObjectDescriptorBase {
size: GPUExtent3D;
mipLevelCount?: number;
@@ -338,22 +272,13 @@ declare interface GPUTextureDescriptor extends GPUObjectDescriptorBase {
viewFormats?: GPUTextureFormat[];
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUTextureDimension = "1d" | "2d" | "3d";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUTextureUsageFlags = number;
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUTextureUsage {
static COPY_SRC: 0x01;
static COPY_DST: 0x02;
@@ -362,18 +287,12 @@ declare class GPUTextureUsage {
static RENDER_ATTACHMENT: 0x10;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUTextureView implements GPUObjectBase {
label: string;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUTextureViewDescriptor extends GPUObjectDescriptorBase {
format?: GPUTextureFormat;
dimension?: GPUTextureViewDimension;
@@ -384,10 +303,7 @@ declare interface GPUTextureViewDescriptor extends GPUObjectDescriptorBase {
arrayLayerCount?: number;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUTextureViewDimension =
| "1d"
| "2d"
@@ -396,16 +312,10 @@ declare type GPUTextureViewDimension =
| "cube-array"
| "3d";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUTextureAspect = "all" | "stencil-only" | "depth-only";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUTextureFormat =
| "r8unorm"
| "r8snorm"
@@ -503,18 +413,12 @@ declare type GPUTextureFormat =
| "astc-12x12-unorm"
| "astc-12x12-unorm-srgb";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUSampler implements GPUObjectBase {
label: string;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUSamplerDescriptor extends GPUObjectDescriptorBase {
addressModeU?: GPUAddressMode;
addressModeV?: GPUAddressMode;
@@ -528,28 +432,16 @@ declare interface GPUSamplerDescriptor extends GPUObjectDescriptorBase {
maxAnisotropy?: number;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUAddressMode = "clamp-to-edge" | "repeat" | "mirror-repeat";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUFilterMode = "nearest" | "linear";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUMipmapFilterMode = "nearest" | "linear";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUCompareFunction =
| "never"
| "less"
@@ -560,26 +452,17 @@ declare type GPUCompareFunction =
| "greater-equal"
| "always";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUBindGroupLayout implements GPUObjectBase {
label: string;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUBindGroupLayoutDescriptor extends GPUObjectDescriptorBase {
entries: GPUBindGroupLayoutEntry[];
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUBindGroupLayoutEntry {
binding: number;
visibility: GPUShaderStageFlags;
@@ -590,69 +473,45 @@ declare interface GPUBindGroupLayoutEntry {
storageTexture?: GPUStorageTextureBindingLayout;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUShaderStageFlags = number;
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUShaderStage {
static VERTEX: 0x1;
static FRAGMENT: 0x2;
static COMPUTE: 0x4;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUBufferBindingLayout {
type?: GPUBufferBindingType;
hasDynamicOffset?: boolean;
minBindingSize?: number;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUBufferBindingType = "uniform" | "storage" | "read-only-storage";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUSamplerBindingLayout {
type?: GPUSamplerBindingType;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUSamplerBindingType =
| "filtering"
| "non-filtering"
| "comparison";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUTextureBindingLayout {
sampleType?: GPUTextureSampleType;
viewDimension?: GPUTextureViewDimension;
multisampled?: boolean;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUTextureSampleType =
| "float"
| "unfilterable-float"
@@ -660,96 +519,63 @@ declare type GPUTextureSampleType =
| "sint"
| "uint";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUStorageTextureAccess =
| "write-only"
| "read-only"
| "read-write";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUStorageTextureBindingLayout {
access: GPUStorageTextureAccess;
format: GPUTextureFormat;
viewDimension?: GPUTextureViewDimension;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUBindGroup implements GPUObjectBase {
label: string;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUBindGroupDescriptor extends GPUObjectDescriptorBase {
layout: GPUBindGroupLayout;
entries: GPUBindGroupEntry[];
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUBindingResource =
| GPUSampler
| GPUTextureView
| GPUBufferBinding;
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUBindGroupEntry {
binding: number;
resource: GPUBindingResource;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUBufferBinding {
buffer: GPUBuffer;
offset?: number;
size?: number;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUPipelineLayout implements GPUObjectBase {
label: string;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUPipelineLayoutDescriptor extends GPUObjectDescriptorBase {
bindGroupLayouts: GPUBindGroupLayout[];
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUCompilationMessageType = "error" | "warning" | "info";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUCompilationMessage {
readonly message: string;
readonly type: GPUCompilationMessageType;
@@ -757,120 +583,84 @@ declare interface GPUCompilationMessage {
readonly linePos: number;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUCompilationInfo {
readonly messages: ReadonlyArray<GPUCompilationMessage>;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUPipelineError extends DOMException {
constructor(message?: string, options?: GPUPipelineErrorInit);
readonly reason: GPUPipelineErrorReason;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUPipelineErrorInit {
reason: GPUPipelineErrorReason;
}
/**
* @category GPU
- * @experimental
+ * @
*/
declare type GPUPipelineErrorReason = "validation" | "internal";
/**
* @category GPU
- * @experimental
+ * @
*/
declare class GPUShaderModule implements GPUObjectBase {
label: string;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUShaderModuleDescriptor extends GPUObjectDescriptorBase {
code: string;
sourceMap?: any;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUAutoLayoutMode = "auto";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUPipelineDescriptorBase extends GPUObjectDescriptorBase {
layout: GPUPipelineLayout | GPUAutoLayoutMode;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUPipelineBase {
getBindGroupLayout(index: number): GPUBindGroupLayout;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUProgrammableStage {
module: GPUShaderModule;
entryPoint?: string;
constants?: Record<string, number>;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUComputePipeline implements GPUObjectBase, GPUPipelineBase {
label: string;
getBindGroupLayout(index: number): GPUBindGroupLayout;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUComputePipelineDescriptor
extends GPUPipelineDescriptorBase {
compute: GPUProgrammableStage;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPURenderPipeline implements GPUObjectBase, GPUPipelineBase {
label: string;
getBindGroupLayout(index: number): GPUBindGroupLayout;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPURenderPipelineDescriptor
extends GPUPipelineDescriptorBase {
vertex: GPUVertexState;
@@ -880,10 +670,7 @@ declare interface GPURenderPipelineDescriptor
fragment?: GPUFragmentState;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUPrimitiveState {
topology?: GPUPrimitiveTopology;
stripIndexFormat?: GPUIndexFormat;
@@ -892,10 +679,7 @@ declare interface GPUPrimitiveState {
unclippedDepth?: boolean;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUPrimitiveTopology =
| "point-list"
| "line-list"
@@ -903,40 +687,25 @@ declare type GPUPrimitiveTopology =
| "triangle-list"
| "triangle-strip";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUFrontFace = "ccw" | "cw";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUCullMode = "none" | "front" | "back";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUMultisampleState {
count?: number;
mask?: number;
alphaToCoverageEnabled?: boolean;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUFragmentState extends GPUProgrammableStage {
targets: (GPUColorTargetState | null)[];
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUColorTargetState {
format: GPUTextureFormat;
@@ -944,25 +713,16 @@ declare interface GPUColorTargetState {
writeMask?: GPUColorWriteFlags;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUBlendState {
color: GPUBlendComponent;
alpha: GPUBlendComponent;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUColorWriteFlags = number;
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUColorWrite {
static RED: 0x1;
static GREEN: 0x2;
@@ -971,20 +731,14 @@ declare class GPUColorWrite {
static ALL: 0xF;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUBlendComponent {
operation?: GPUBlendOperation;
srcFactor?: GPUBlendFactor;
dstFactor?: GPUBlendFactor;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUBlendFactor =
| "zero"
| "one"
@@ -1000,10 +754,7 @@ declare type GPUBlendFactor =
| "constant"
| "one-minus-constant";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUBlendOperation =
| "add"
| "subtract"
@@ -1011,10 +762,7 @@ declare type GPUBlendOperation =
| "min"
| "max";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUDepthStencilState {
format: GPUTextureFormat;
@@ -1032,10 +780,7 @@ declare interface GPUDepthStencilState {
depthBiasClamp?: number;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUStencilFaceState {
compare?: GPUCompareFunction;
failOp?: GPUStencilOperation;
@@ -1043,10 +788,7 @@ declare interface GPUStencilFaceState {
passOp?: GPUStencilOperation;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUStencilOperation =
| "keep"
| "zero"
@@ -1057,16 +799,10 @@ declare type GPUStencilOperation =
| "increment-wrap"
| "decrement-wrap";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUIndexFormat = "uint16" | "uint32";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUVertexFormat =
| "uint8x2"
| "uint8x4"
@@ -1100,34 +836,22 @@ declare type GPUVertexFormat =
| "sint32x4"
| "unorm10-10-10-2";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUVertexStepMode = "vertex" | "instance";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUVertexState extends GPUProgrammableStage {
buffers?: (GPUVertexBufferLayout | null)[];
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUVertexBufferLayout {
arrayStride: number;
stepMode?: GPUVertexStepMode;
attributes: GPUVertexAttribute[];
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUVertexAttribute {
format: GPUVertexFormat;
offset: number;
@@ -1135,34 +859,22 @@ declare interface GPUVertexAttribute {
shaderLocation: number;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUImageDataLayout {
offset?: number;
bytesPerRow?: number;
rowsPerImage?: number;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUCommandBuffer implements GPUObjectBase {
label: string;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUCommandBufferDescriptor extends GPUObjectDescriptorBase {}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUCommandEncoder implements GPUObjectBase {
label: string;
@@ -1220,24 +932,15 @@ declare class GPUCommandEncoder implements GPUObjectBase {
finish(descriptor?: GPUCommandBufferDescriptor): GPUCommandBuffer;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUCommandEncoderDescriptor extends GPUObjectDescriptorBase {}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUImageCopyBuffer extends GPUImageDataLayout {
buffer: GPUBuffer;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUImageCopyTexture {
texture: GPUTexture;
mipLevel?: number;
@@ -1245,10 +948,7 @@ declare interface GPUImageCopyTexture {
aspect?: GPUTextureAspect;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUProgrammablePassEncoder {
setBindGroup(
index: number,
@@ -1269,10 +969,7 @@ declare interface GPUProgrammablePassEncoder {
insertDebugMarker(markerLabel: string): undefined;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUComputePassEncoder
implements GPUObjectBase, GPUProgrammablePassEncoder {
label: string;
@@ -1301,28 +998,19 @@ declare class GPUComputePassEncoder
end(): undefined;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUComputePassTimestampWrites {
querySet: GPUQuerySet;
beginningOfPassWriteIndex?: number;
endOfPassWriteIndex?: number;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUComputePassDescriptor extends GPUObjectDescriptorBase {
timestampWrites?: GPUComputePassTimestampWrites;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPURenderEncoderBase {
setPipeline(pipeline: GPURenderPipeline): undefined;
@@ -1360,10 +1048,7 @@ declare interface GPURenderEncoderBase {
): undefined;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPURenderPassEncoder
implements GPUObjectBase, GPUProgrammablePassEncoder, GPURenderEncoderBase {
label: string;
@@ -1440,20 +1125,14 @@ declare class GPURenderPassEncoder
end(): undefined;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPURenderPassTimestampWrites {
querySet: GPUQuerySet;
beginningOfPassWriteIndex?: number;
endOfPassWriteIndex?: number;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPURenderPassDescriptor extends GPUObjectDescriptorBase {
colorAttachments: (GPURenderPassColorAttachment | null)[];
depthStencilAttachment?: GPURenderPassDepthStencilAttachment;
@@ -1461,10 +1140,7 @@ declare interface GPURenderPassDescriptor extends GPUObjectDescriptorBase {
timestampWrites?: GPURenderPassTimestampWrites;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPURenderPassColorAttachment {
view: GPUTextureView;
resolveTarget?: GPUTextureView;
@@ -1476,7 +1152,7 @@ declare interface GPURenderPassColorAttachment {
/**
* @category GPU
- * @experimental
+ * @
*/
declare interface GPURenderPassDepthStencilAttachment {
view: GPUTextureView;
@@ -1492,36 +1168,21 @@ declare interface GPURenderPassDepthStencilAttachment {
stencilReadOnly?: boolean;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPULoadOp = "load" | "clear";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUStoreOp = "store" | "discard";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPURenderBundle implements GPUObjectBase {
label: string;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPURenderBundleEncoder
implements GPUObjectBase, GPUProgrammablePassEncoder, GPURenderEncoderBase {
label: string;
@@ -1575,29 +1236,20 @@ declare class GPURenderBundleEncoder
finish(descriptor?: GPURenderBundleDescriptor): GPURenderBundle;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPURenderPassLayout extends GPUObjectDescriptorBase {
colorFormats: (GPUTextureFormat | null)[];
depthStencilFormat?: GPUTextureFormat;
sampleCount?: number;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPURenderBundleEncoderDescriptor extends GPURenderPassLayout {
depthReadOnly?: boolean;
stencilReadOnly?: boolean;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUQueue implements GPUObjectBase {
label: string;
@@ -1621,10 +1273,7 @@ declare class GPUQueue implements GPUObjectBase {
): undefined;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUQuerySet implements GPUObjectBase {
label: string;
@@ -1634,78 +1283,48 @@ declare class GPUQuerySet implements GPUObjectBase {
readonly count: number;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUQuerySetDescriptor extends GPUObjectDescriptorBase {
type: GPUQueryType;
count: number;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUQueryType = "occlusion" | "timestamp";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUDeviceLostReason = "destroyed";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUDeviceLostInfo {
readonly reason: GPUDeviceLostReason;
readonly message: string;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUError {
readonly message: string;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUOutOfMemoryError extends GPUError {
constructor(message: string);
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUValidationError extends GPUError {
constructor(message: string);
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUInternalError extends GPUError {
constructor(message: string);
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUErrorFilter = "out-of-memory" | "validation" | "internal";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare class GPUUncapturedErrorEvent extends Event {
constructor(
type: string,
@@ -1715,18 +1334,12 @@ declare class GPUUncapturedErrorEvent extends Event {
readonly error: GPUError;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUUncapturedErrorEventInit extends EventInit {
error: GPUError;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUColorDict {
r: number;
g: number;
@@ -1734,54 +1347,33 @@ declare interface GPUColorDict {
a: number;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUColor = number[] | GPUColorDict;
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUOrigin3DDict {
x?: number;
y?: number;
z?: number;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUOrigin3D = number[] | GPUOrigin3DDict;
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUExtent3DDict {
width: number;
height?: number;
depthOrArrayLayers?: number;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUExtent3D = number[] | GPUExtent3DDict;
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare type GPUCanvasAlphaMode = "opaque" | "premultiplied";
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUCanvasConfiguration {
device: GPUDevice;
format: GPUTextureFormat;
@@ -1792,10 +1384,7 @@ declare interface GPUCanvasConfiguration {
width: number;
height: number;
}
-/**
- * @category GPU
- * @experimental
- */
+/** @category GPU */
declare interface GPUCanvasContext {
configure(configuration: GPUCanvasConfiguration): undefined;
unconfigure(): undefined;