@thi.ng/wasm-api 0.3.1 → 0.6.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.
- package/CHANGELOG.md +55 -1
- package/README.md +179 -22
- package/api.d.ts +166 -4
- package/api.js +9 -1
- package/bridge.d.ts +102 -6
- package/bridge.js +129 -30
- package/codegen/typescript.d.ts +22 -0
- package/codegen/typescript.js +146 -0
- package/codegen/utils.d.ts +5 -0
- package/codegen/utils.js +7 -0
- package/codegen/zig.d.ts +22 -0
- package/codegen/zig.js +75 -0
- package/codegen.d.ts +16 -0
- package/codegen.js +116 -0
- package/include/wasmapi.h +60 -0
- package/{zig/core.zig → include/wasmapi.zig} +76 -26
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/package.json +28 -7
- package/dev/custom.zig +0 -12
- package/dev/fieldinfo.zig +0 -135
- package/dev/hello.zig +0 -9
- package/dev/zig-cache/o/0fd683610fe16c12563bf410950c8193/builtin.zig +0 -39
- package/dev/zig-cache/o/85202d15b9c43c8c66de01ab98d6eb2c/builtin.zig +0 -39
- package/dev/zig-cache/o/9e1187e9310422c9c2330ebceeaecce7/builtin.zig +0 -39
- package/dev/zig-cache/o/f647d1186cb589536c92b809f6e25f75/builtin.zig +0 -39
- package/test/custom.zig +0 -12
- package/test/zig-cache/o/117d44467ded6ce3864cde3c180ef73c/builtin.zig +0 -39
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const std = @import("std");
|
|
2
|
-
/// Zig version. When writing code that supports multiple versions of Zig, prefer
|
|
3
|
-
/// feature detection (i.e. with `@hasDecl` or `@hasField`) over version checks.
|
|
4
|
-
pub const zig_version = std.SemanticVersion.parse("0.10.0-dev.3034+6fab6c3e4") catch unreachable;
|
|
5
|
-
pub const zig_backend = std.builtin.CompilerBackend.stage1;
|
|
6
|
-
/// Temporary until self-hosted supports the `cpu.arch` value.
|
|
7
|
-
pub const stage2_arch: std.Target.Cpu.Arch = .wasm32;
|
|
8
|
-
|
|
9
|
-
pub const output_mode = std.builtin.OutputMode.Lib;
|
|
10
|
-
pub const link_mode = std.builtin.LinkMode.Dynamic;
|
|
11
|
-
pub const is_test = false;
|
|
12
|
-
pub const single_threaded = true;
|
|
13
|
-
pub const abi = std.Target.Abi.musl;
|
|
14
|
-
pub const cpu: std.Target.Cpu = .{
|
|
15
|
-
.arch = .wasm32,
|
|
16
|
-
.model = &std.Target.wasm.cpu.generic,
|
|
17
|
-
.features = std.Target.wasm.featureSet(&[_]std.Target.wasm.Feature{
|
|
18
|
-
}),
|
|
19
|
-
};
|
|
20
|
-
pub const os = std.Target.Os{
|
|
21
|
-
.tag = .freestanding,
|
|
22
|
-
.version_range = .{ .none = {} },
|
|
23
|
-
};
|
|
24
|
-
pub const target = std.Target{
|
|
25
|
-
.cpu = cpu,
|
|
26
|
-
.os = os,
|
|
27
|
-
.abi = abi,
|
|
28
|
-
};
|
|
29
|
-
pub const object_format = std.Target.ObjectFormat.wasm;
|
|
30
|
-
pub const mode = std.builtin.Mode.ReleaseSmall;
|
|
31
|
-
pub const link_libc = false;
|
|
32
|
-
pub const link_libcpp = false;
|
|
33
|
-
pub const have_error_return_tracing = false;
|
|
34
|
-
pub const valgrind_support = false;
|
|
35
|
-
pub const sanitize_thread = false;
|
|
36
|
-
pub const position_independent_code = true;
|
|
37
|
-
pub const position_independent_executable = false;
|
|
38
|
-
pub const strip_debug_info = true;
|
|
39
|
-
pub const code_model = std.builtin.CodeModel.default;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const std = @import("std");
|
|
2
|
-
/// Zig version. When writing code that supports multiple versions of Zig, prefer
|
|
3
|
-
/// feature detection (i.e. with `@hasDecl` or `@hasField`) over version checks.
|
|
4
|
-
pub const zig_version = std.SemanticVersion.parse("0.10.0-dev.3034+6fab6c3e4") catch unreachable;
|
|
5
|
-
pub const zig_backend = std.builtin.CompilerBackend.stage1;
|
|
6
|
-
/// Temporary until self-hosted supports the `cpu.arch` value.
|
|
7
|
-
pub const stage2_arch: std.Target.Cpu.Arch = .wasm32;
|
|
8
|
-
|
|
9
|
-
pub const output_mode = std.builtin.OutputMode.Lib;
|
|
10
|
-
pub const link_mode = std.builtin.LinkMode.Dynamic;
|
|
11
|
-
pub const is_test = false;
|
|
12
|
-
pub const single_threaded = true;
|
|
13
|
-
pub const abi = std.Target.Abi.musl;
|
|
14
|
-
pub const cpu: std.Target.Cpu = .{
|
|
15
|
-
.arch = .wasm32,
|
|
16
|
-
.model = &std.Target.wasm.cpu.generic,
|
|
17
|
-
.features = std.Target.wasm.featureSet(&[_]std.Target.wasm.Feature{
|
|
18
|
-
}),
|
|
19
|
-
};
|
|
20
|
-
pub const os = std.Target.Os{
|
|
21
|
-
.tag = .freestanding,
|
|
22
|
-
.version_range = .{ .none = {} },
|
|
23
|
-
};
|
|
24
|
-
pub const target = std.Target{
|
|
25
|
-
.cpu = cpu,
|
|
26
|
-
.os = os,
|
|
27
|
-
.abi = abi,
|
|
28
|
-
};
|
|
29
|
-
pub const object_format = std.Target.ObjectFormat.wasm;
|
|
30
|
-
pub const mode = std.builtin.Mode.ReleaseSmall;
|
|
31
|
-
pub const link_libc = false;
|
|
32
|
-
pub const link_libcpp = false;
|
|
33
|
-
pub const have_error_return_tracing = false;
|
|
34
|
-
pub const valgrind_support = false;
|
|
35
|
-
pub const sanitize_thread = false;
|
|
36
|
-
pub const position_independent_code = true;
|
|
37
|
-
pub const position_independent_executable = false;
|
|
38
|
-
pub const strip_debug_info = true;
|
|
39
|
-
pub const code_model = std.builtin.CodeModel.default;
|
package/test/custom.zig
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// Import JS core API
|
|
2
|
-
const js = @import("wasmapi");
|
|
3
|
-
|
|
4
|
-
/// Fill vec2 with random values
|
|
5
|
-
extern fn custom_setVec2(addr: usize) void;
|
|
6
|
-
|
|
7
|
-
export fn test_setVec2() void {
|
|
8
|
-
var foo = [2]f32{ 0, 0 };
|
|
9
|
-
js.printF32Array(foo[0..]);
|
|
10
|
-
custom_setVec2(@ptrToInt(&foo));
|
|
11
|
-
js.printF32Array(foo[0..]);
|
|
12
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const std = @import("std");
|
|
2
|
-
/// Zig version. When writing code that supports multiple versions of Zig, prefer
|
|
3
|
-
/// feature detection (i.e. with `@hasDecl` or `@hasField`) over version checks.
|
|
4
|
-
pub const zig_version = std.SemanticVersion.parse("0.10.0-dev.3034+6fab6c3e4") catch unreachable;
|
|
5
|
-
pub const zig_backend = std.builtin.CompilerBackend.stage1;
|
|
6
|
-
/// Temporary until self-hosted supports the `cpu.arch` value.
|
|
7
|
-
pub const stage2_arch: std.Target.Cpu.Arch = .wasm32;
|
|
8
|
-
|
|
9
|
-
pub const output_mode = std.builtin.OutputMode.Lib;
|
|
10
|
-
pub const link_mode = std.builtin.LinkMode.Dynamic;
|
|
11
|
-
pub const is_test = false;
|
|
12
|
-
pub const single_threaded = true;
|
|
13
|
-
pub const abi = std.Target.Abi.musl;
|
|
14
|
-
pub const cpu: std.Target.Cpu = .{
|
|
15
|
-
.arch = .wasm32,
|
|
16
|
-
.model = &std.Target.wasm.cpu.generic,
|
|
17
|
-
.features = std.Target.wasm.featureSet(&[_]std.Target.wasm.Feature{
|
|
18
|
-
}),
|
|
19
|
-
};
|
|
20
|
-
pub const os = std.Target.Os{
|
|
21
|
-
.tag = .freestanding,
|
|
22
|
-
.version_range = .{ .none = {} },
|
|
23
|
-
};
|
|
24
|
-
pub const target = std.Target{
|
|
25
|
-
.cpu = cpu,
|
|
26
|
-
.os = os,
|
|
27
|
-
.abi = abi,
|
|
28
|
-
};
|
|
29
|
-
pub const object_format = std.Target.ObjectFormat.wasm;
|
|
30
|
-
pub const mode = std.builtin.Mode.ReleaseSmall;
|
|
31
|
-
pub const link_libc = false;
|
|
32
|
-
pub const link_libcpp = false;
|
|
33
|
-
pub const have_error_return_tracing = false;
|
|
34
|
-
pub const valgrind_support = false;
|
|
35
|
-
pub const sanitize_thread = false;
|
|
36
|
-
pub const position_independent_code = true;
|
|
37
|
-
pub const position_independent_executable = false;
|
|
38
|
-
pub const strip_debug_info = true;
|
|
39
|
-
pub const code_model = std.builtin.CodeModel.default;
|