@wasi-gfx/js-webgpu 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +26 -0
  2. package/dist/index.js +1665 -0
  3. package/package.json +35 -0
  4. package/types/interfaces/wasi-cli-run.d.ts +5 -0
  5. package/types/interfaces/wasi-cli-stdout.d.ts +3 -0
  6. package/types/interfaces/wasi-frame-buffer-frame-buffer.d.ts +21 -0
  7. package/types/interfaces/wasi-graphics-context-graphics-context.d.ts +17 -0
  8. package/types/interfaces/wasi-io-error.d.ts +18 -0
  9. package/types/interfaces/wasi-io-poll.d.ts +43 -0
  10. package/types/interfaces/wasi-io-streams.d.ts +240 -0
  11. package/types/interfaces/wasi-surface-surface.d.ts +400 -0
  12. package/types/interfaces/wasi-webgpu-webgpu.d.ts +1636 -0
  13. package/types/wit.d.ts +10 -0
  14. package/wit/deps/cli/command.wit +7 -0
  15. package/wit/deps/cli/environment.wit +18 -0
  16. package/wit/deps/cli/exit.wit +4 -0
  17. package/wit/deps/cli/imports.wit +20 -0
  18. package/wit/deps/cli/run.wit +4 -0
  19. package/wit/deps/cli/stdio.wit +17 -0
  20. package/wit/deps/cli/terminal.wit +49 -0
  21. package/wit/deps/clocks/monotonic-clock.wit +45 -0
  22. package/wit/deps/clocks/wall-clock.wit +42 -0
  23. package/wit/deps/clocks/world.wit +6 -0
  24. package/wit/deps/filesystem/preopens.wit +8 -0
  25. package/wit/deps/filesystem/types.wit +634 -0
  26. package/wit/deps/filesystem/world.wit +6 -0
  27. package/wit/deps/frame-buffer/frame-buffer.wit +23 -0
  28. package/wit/deps/graphics-context/graphics-context.wit +18 -0
  29. package/wit/deps/io/error.wit +34 -0
  30. package/wit/deps/io/poll.wit +41 -0
  31. package/wit/deps/io/streams.wit +262 -0
  32. package/wit/deps/io/world.wit +6 -0
  33. package/wit/deps/random/insecure-seed.wit +25 -0
  34. package/wit/deps/random/insecure.wit +22 -0
  35. package/wit/deps/random/random.wit +26 -0
  36. package/wit/deps/random/world.wit +7 -0
  37. package/wit/deps/sockets/instance-network.wit +9 -0
  38. package/wit/deps/sockets/ip-name-lookup.wit +51 -0
  39. package/wit/deps/sockets/network.wit +145 -0
  40. package/wit/deps/sockets/tcp-create-socket.wit +27 -0
  41. package/wit/deps/sockets/tcp.wit +353 -0
  42. package/wit/deps/sockets/udp-create-socket.wit +27 -0
  43. package/wit/deps/sockets/udp.wit +266 -0
  44. package/wit/deps/sockets/world.wit +11 -0
  45. package/wit/deps/surface/surface.wit +248 -0
  46. package/wit/deps/webgpu/imports.wit +5 -0
  47. package/wit/deps/webgpu/webgpu.wit +1085 -0
  48. package/wit/deps.lock +51 -0
  49. package/wit/deps.toml +18 -0
  50. package/wit/world.wit +10 -0
package/types/wit.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ // world wasi-gfx:js-webgpu/imports@0.1.0
2
+ export type * as WasiCliStdout020 from './interfaces/wasi-cli-stdout.js'; // import wasi:cli/stdout@0.2.0
3
+ export type * as WasiFrameBufferFrameBuffer001 from './interfaces/wasi-frame-buffer-frame-buffer.js'; // import wasi:frame-buffer/frame-buffer@0.0.1
4
+ export type * as WasiGraphicsContextGraphicsContext001 from './interfaces/wasi-graphics-context-graphics-context.js'; // import wasi:graphics-context/graphics-context@0.0.1
5
+ export type * as WasiIoError020 from './interfaces/wasi-io-error.js'; // import wasi:io/error@0.2.0
6
+ export type * as WasiIoPoll020 from './interfaces/wasi-io-poll.js'; // import wasi:io/poll@0.2.0
7
+ export type * as WasiIoStreams020 from './interfaces/wasi-io-streams.js'; // import wasi:io/streams@0.2.0
8
+ export type * as WasiSurfaceSurface001 from './interfaces/wasi-surface-surface.js'; // import wasi:surface/surface@0.0.1
9
+ export type * as WasiWebgpuWebgpu001 from './interfaces/wasi-webgpu-webgpu.js'; // import wasi:webgpu/webgpu@0.0.1
10
+ export * as run from './interfaces/wasi-cli-run.js'; // export wasi:cli/run@0.2.0
@@ -0,0 +1,7 @@
1
+ package wasi:cli@0.2.0;
2
+
3
+ world command {
4
+ include imports;
5
+
6
+ export run;
7
+ }
@@ -0,0 +1,18 @@
1
+ interface environment {
2
+ /// Get the POSIX-style environment variables.
3
+ ///
4
+ /// Each environment variable is provided as a pair of string variable names
5
+ /// and string value.
6
+ ///
7
+ /// Morally, these are a value import, but until value imports are available
8
+ /// in the component model, this import function should return the same
9
+ /// values each time it is called.
10
+ get-environment: func() -> list<tuple<string, string>>;
11
+
12
+ /// Get the POSIX-style arguments to the program.
13
+ get-arguments: func() -> list<string>;
14
+
15
+ /// Return a path that programs should use as their initial current working
16
+ /// directory, interpreting `.` as shorthand for this.
17
+ initial-cwd: func() -> option<string>;
18
+ }
@@ -0,0 +1,4 @@
1
+ interface exit {
2
+ /// Exit the current instance and any linked instances.
3
+ exit: func(status: result);
4
+ }
@@ -0,0 +1,20 @@
1
+ package wasi:cli@0.2.0;
2
+
3
+ world imports {
4
+ include wasi:clocks/imports@0.2.0;
5
+ include wasi:filesystem/imports@0.2.0;
6
+ include wasi:sockets/imports@0.2.0;
7
+ include wasi:random/imports@0.2.0;
8
+ include wasi:io/imports@0.2.0;
9
+
10
+ import environment;
11
+ import exit;
12
+ import stdin;
13
+ import stdout;
14
+ import stderr;
15
+ import terminal-input;
16
+ import terminal-output;
17
+ import terminal-stdin;
18
+ import terminal-stdout;
19
+ import terminal-stderr;
20
+ }
@@ -0,0 +1,4 @@
1
+ interface run {
2
+ /// Run the program.
3
+ run: func() -> result;
4
+ }
@@ -0,0 +1,17 @@
1
+ interface stdin {
2
+ use wasi:io/streams@0.2.0.{input-stream};
3
+
4
+ get-stdin: func() -> input-stream;
5
+ }
6
+
7
+ interface stdout {
8
+ use wasi:io/streams@0.2.0.{output-stream};
9
+
10
+ get-stdout: func() -> output-stream;
11
+ }
12
+
13
+ interface stderr {
14
+ use wasi:io/streams@0.2.0.{output-stream};
15
+
16
+ get-stderr: func() -> output-stream;
17
+ }
@@ -0,0 +1,49 @@
1
+ /// Terminal input.
2
+ ///
3
+ /// In the future, this may include functions for disabling echoing,
4
+ /// disabling input buffering so that keyboard events are sent through
5
+ /// immediately, querying supported features, and so on.
6
+ interface terminal-input {
7
+ /// The input side of a terminal.
8
+ resource terminal-input;
9
+ }
10
+
11
+ /// Terminal output.
12
+ ///
13
+ /// In the future, this may include functions for querying the terminal
14
+ /// size, being notified of terminal size changes, querying supported
15
+ /// features, and so on.
16
+ interface terminal-output {
17
+ /// The output side of a terminal.
18
+ resource terminal-output;
19
+ }
20
+
21
+ /// An interface providing an optional `terminal-input` for stdin as a
22
+ /// link-time authority.
23
+ interface terminal-stdin {
24
+ use terminal-input.{terminal-input};
25
+
26
+ /// If stdin is connected to a terminal, return a `terminal-input` handle
27
+ /// allowing further interaction with it.
28
+ get-terminal-stdin: func() -> option<terminal-input>;
29
+ }
30
+
31
+ /// An interface providing an optional `terminal-output` for stdout as a
32
+ /// link-time authority.
33
+ interface terminal-stdout {
34
+ use terminal-output.{terminal-output};
35
+
36
+ /// If stdout is connected to a terminal, return a `terminal-output` handle
37
+ /// allowing further interaction with it.
38
+ get-terminal-stdout: func() -> option<terminal-output>;
39
+ }
40
+
41
+ /// An interface providing an optional `terminal-output` for stderr as a
42
+ /// link-time authority.
43
+ interface terminal-stderr {
44
+ use terminal-output.{terminal-output};
45
+
46
+ /// If stderr is connected to a terminal, return a `terminal-output` handle
47
+ /// allowing further interaction with it.
48
+ get-terminal-stderr: func() -> option<terminal-output>;
49
+ }
@@ -0,0 +1,45 @@
1
+ package wasi:clocks@0.2.0;
2
+ /// WASI Monotonic Clock is a clock API intended to let users measure elapsed
3
+ /// time.
4
+ ///
5
+ /// It is intended to be portable at least between Unix-family platforms and
6
+ /// Windows.
7
+ ///
8
+ /// A monotonic clock is a clock which has an unspecified initial value, and
9
+ /// successive reads of the clock will produce non-decreasing values.
10
+ ///
11
+ /// It is intended for measuring elapsed time.
12
+ interface monotonic-clock {
13
+ use wasi:io/poll@0.2.0.{pollable};
14
+
15
+ /// An instant in time, in nanoseconds. An instant is relative to an
16
+ /// unspecified initial value, and can only be compared to instances from
17
+ /// the same monotonic-clock.
18
+ type instant = u64;
19
+
20
+ /// A duration of time, in nanoseconds.
21
+ type duration = u64;
22
+
23
+ /// Read the current value of the clock.
24
+ ///
25
+ /// The clock is monotonic, therefore calling this function repeatedly will
26
+ /// produce a sequence of non-decreasing values.
27
+ now: func() -> instant;
28
+
29
+ /// Query the resolution of the clock. Returns the duration of time
30
+ /// corresponding to a clock tick.
31
+ resolution: func() -> duration;
32
+
33
+ /// Create a `pollable` which will resolve once the specified instant
34
+ /// occured.
35
+ subscribe-instant: func(
36
+ when: instant,
37
+ ) -> pollable;
38
+
39
+ /// Create a `pollable` which will resolve once the given duration has
40
+ /// elapsed, starting at the time at which this function was called.
41
+ /// occured.
42
+ subscribe-duration: func(
43
+ when: duration,
44
+ ) -> pollable;
45
+ }
@@ -0,0 +1,42 @@
1
+ package wasi:clocks@0.2.0;
2
+ /// WASI Wall Clock is a clock API intended to let users query the current
3
+ /// time. The name "wall" makes an analogy to a "clock on the wall", which
4
+ /// is not necessarily monotonic as it may be reset.
5
+ ///
6
+ /// It is intended to be portable at least between Unix-family platforms and
7
+ /// Windows.
8
+ ///
9
+ /// A wall clock is a clock which measures the date and time according to
10
+ /// some external reference.
11
+ ///
12
+ /// External references may be reset, so this clock is not necessarily
13
+ /// monotonic, making it unsuitable for measuring elapsed time.
14
+ ///
15
+ /// It is intended for reporting the current date and time for humans.
16
+ interface wall-clock {
17
+ /// A time and date in seconds plus nanoseconds.
18
+ record datetime {
19
+ seconds: u64,
20
+ nanoseconds: u32,
21
+ }
22
+
23
+ /// Read the current value of the clock.
24
+ ///
25
+ /// This clock is not monotonic, therefore calling this function repeatedly
26
+ /// will not necessarily produce a sequence of non-decreasing values.
27
+ ///
28
+ /// The returned timestamps represent the number of seconds since
29
+ /// 1970-01-01T00:00:00Z, also known as [POSIX's Seconds Since the Epoch],
30
+ /// also known as [Unix Time].
31
+ ///
32
+ /// The nanoseconds field of the output is always less than 1000000000.
33
+ ///
34
+ /// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
35
+ /// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
36
+ now: func() -> datetime;
37
+
38
+ /// Query the resolution of the clock.
39
+ ///
40
+ /// The nanoseconds field of the output is always less than 1000000000.
41
+ resolution: func() -> datetime;
42
+ }
@@ -0,0 +1,6 @@
1
+ package wasi:clocks@0.2.0;
2
+
3
+ world imports {
4
+ import monotonic-clock;
5
+ import wall-clock;
6
+ }
@@ -0,0 +1,8 @@
1
+ package wasi:filesystem@0.2.0;
2
+
3
+ interface preopens {
4
+ use types.{descriptor};
5
+
6
+ /// Return the set of preopened directories, and their path.
7
+ get-directories: func() -> list<tuple<descriptor, string>>;
8
+ }