@onda-lang/wasm-compiler 0.6.0 → 0.7.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/README.md +52 -3
- package/bin/onda-wasm.js +1 -1
- package/dist/backend/constants.js +1 -1
- package/dist/backend/index.js +2427 -342
- package/dist/build.json +3 -3
- package/dist/frontend/README.md +12 -3
- package/dist/frontend/onda_compiler_web.d.ts +94 -5
- package/dist/frontend/onda_compiler_web.js +442 -4
- package/dist/frontend/onda_compiler_web_bg.wasm +0 -0
- package/dist/frontend/onda_compiler_web_bg.wasm.d.ts +34 -3
- package/dist/frontend/package.json +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/src/index.d.ts +106 -3
- package/src/index.js +400 -19
- package/src/worker.js +58 -3
package/dist/build.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"ondaVersion": "0.
|
|
2
|
+
"ondaVersion": "0.7.0",
|
|
3
3
|
"binaryenVersion": "130.0.0",
|
|
4
4
|
"frontendPackage": "onda_compiler_web",
|
|
5
5
|
"frontendOptimization": {
|
|
6
6
|
"tool": "wasm-opt",
|
|
7
7
|
"binaryenVersion": "130.0.0",
|
|
8
8
|
"optimizeLevel": 4,
|
|
9
|
-
"inputBytes":
|
|
10
|
-
"outputBytes":
|
|
9
|
+
"inputBytes": 7708408,
|
|
10
|
+
"outputBytes": 5773425
|
|
11
11
|
}
|
|
12
12
|
}
|
package/dist/frontend/README.md
CHANGED
|
@@ -15,10 +15,11 @@ The package build runs `wasm-pack --release` and then the workspace-pinned Binar
|
|
|
15
15
|
optimizer so every local, CI, website, and npm build uses the same Binaryen release.
|
|
16
16
|
|
|
17
17
|
The production exports `compile_to_mir_messagepack(source, sampleRate, blockSize)` and
|
|
18
|
-
`
|
|
18
|
+
`compile_source_workspace_to_mir_messagepack(entryPath, sourcesJson, sampleRate, blockSize)` return a
|
|
19
19
|
`FrontendMessagePackCompilation` containing compact schema-versioned bytes plus the ordered
|
|
20
20
|
contributing project paths. JSON variants return the equivalent `FrontendJsonCompilation` for
|
|
21
|
-
inspection and tooling. Both result types expose
|
|
21
|
+
inspection and tooling. Both result types expose the source list and exact portable source image.
|
|
22
|
+
Workspace
|
|
22
23
|
compilation accepts a JSON object of project-relative paths to source strings, resolving imports and
|
|
23
24
|
includes entirely in memory. Paths cannot escape the virtual project root. Embedded
|
|
24
25
|
standard-library modules are omitted from the source manifest. `mir_schema_version()` exposes the
|
|
@@ -26,6 +27,14 @@ producer version for integration checks. Compilation failures reject with a JSON
|
|
|
26
27
|
containing structured diagnostics, the partially resolved source list, and unresolved
|
|
27
28
|
non-standard-library candidates which a host may watch for creation.
|
|
28
29
|
|
|
30
|
+
The Wasm surface also builds, loads, inspects, compiles, and materializes canonical `ProjectImage`
|
|
31
|
+
values, encodes/decodes every `.ondabuffer` primitive type, and decodes WAV files through the same
|
|
32
|
+
canonical buffer path as native hosts. These operations directly use `onda_project`, matching the
|
|
33
|
+
C API's bytes, digests, validation, and format capability values. Materialization publishes
|
|
34
|
+
`code/main.onda`, preserves meaningful source paths below `code/`, and writes typed assets below
|
|
35
|
+
`assets/`. Input file sets may contain `.ondaproject` manifests in any directory when the host
|
|
36
|
+
explicitly selects the one to load.
|
|
37
|
+
|
|
29
38
|
The current producer and `packages/onda_binaryen_web` both use the current MIR schema. The browser playground
|
|
30
39
|
under `examples/web/onda_wasm_playground` passes the generated MessagePack directly to the explicitly
|
|
31
40
|
trusted Onda-producer entry point in the Binaryen.js backend and runs the resulting DSP Wasm in an
|
|
@@ -56,4 +65,4 @@ compile/render measurements are documented in
|
|
|
56
65
|
Application consumers should normally install
|
|
57
66
|
[`@onda-lang/wasm-compiler`](../../packages/onda_wasm_compiler/README.md), which packages this
|
|
58
67
|
frontend Wasm with the compatible Binaryen backend, verifies their MIR schema handshake, and
|
|
59
|
-
provides typed source
|
|
68
|
+
provides typed source-workspace and project-image APIs plus the `onda-wasm` CLI.
|
|
@@ -6,6 +6,7 @@ export class FrontendJsonCompilation {
|
|
|
6
6
|
free(): void;
|
|
7
7
|
[Symbol.dispose](): void;
|
|
8
8
|
source_files_json(): string;
|
|
9
|
+
source_image_json(): string;
|
|
9
10
|
take_mir(): string;
|
|
10
11
|
}
|
|
11
12
|
|
|
@@ -14,6 +15,7 @@ export class FrontendMessagePackCompilation {
|
|
|
14
15
|
free(): void;
|
|
15
16
|
[Symbol.dispose](): void;
|
|
16
17
|
source_files_json(): string;
|
|
18
|
+
source_image_json(): string;
|
|
17
19
|
take_mir(): Uint8Array;
|
|
18
20
|
}
|
|
19
21
|
|
|
@@ -32,16 +34,72 @@ export class OndaLsp {
|
|
|
32
34
|
set_analysis_options(sample_rate: number, block_size: number): void;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
|
-
export
|
|
37
|
+
export class WebDecodedBufferAsset {
|
|
38
|
+
private constructor();
|
|
39
|
+
free(): void;
|
|
40
|
+
[Symbol.dispose](): void;
|
|
41
|
+
canonical_payload(): Uint8Array;
|
|
42
|
+
channels(): number;
|
|
43
|
+
element(): string;
|
|
44
|
+
frames(): number;
|
|
45
|
+
sample_rate(): number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export class WebMaterializedProjectBuilder {
|
|
49
|
+
free(): void;
|
|
50
|
+
[Symbol.dispose](): void;
|
|
51
|
+
add_file(path: string, bytes: Uint8Array): void;
|
|
52
|
+
constructor();
|
|
53
|
+
select_project(manifest_path: string): void;
|
|
54
|
+
serialize(): Uint8Array;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export class WebProjectImageBuilder {
|
|
58
|
+
free(): void;
|
|
59
|
+
[Symbol.dispose](): void;
|
|
60
|
+
add_buffer(name: string, ondabuffer_bytes: Uint8Array): void;
|
|
61
|
+
constructor(source_image_json: string);
|
|
62
|
+
serialize(): Uint8Array;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export class WebProjectMaterializationPlan {
|
|
66
|
+
private constructor();
|
|
67
|
+
free(): void;
|
|
68
|
+
[Symbol.dispose](): void;
|
|
69
|
+
directories_json(): string;
|
|
70
|
+
file_bytes(index: number): Uint8Array | undefined;
|
|
71
|
+
file_count(): number;
|
|
72
|
+
file_path(index: number): string | undefined;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function buffer_asset_format_version(): number;
|
|
36
76
|
|
|
37
|
-
export function
|
|
77
|
+
export function compile_project_image_to_mir_messagepack(image_bytes: Uint8Array, sample_rate: number, block_size: number): FrontendMessagePackCompilation;
|
|
78
|
+
|
|
79
|
+
export function compile_source_workspace_to_mir_json(entry_path: string, sources_json: string, sample_rate: number, block_size: number): FrontendJsonCompilation;
|
|
80
|
+
|
|
81
|
+
export function compile_source_workspace_to_mir_messagepack(entry_path: string, sources_json: string, sample_rate: number, block_size: number): FrontendMessagePackCompilation;
|
|
38
82
|
|
|
39
83
|
export function compile_to_mir_json(source: string, sample_rate: number, block_size: number): FrontendJsonCompilation;
|
|
40
84
|
|
|
41
85
|
export function compile_to_mir_messagepack(source: string, sample_rate: number, block_size: number): FrontendMessagePackCompilation;
|
|
42
86
|
|
|
87
|
+
export function current_stdlib_digest(): string;
|
|
88
|
+
|
|
89
|
+
export function decode_buffer_asset(ondabuffer_bytes: Uint8Array): WebDecodedBufferAsset;
|
|
90
|
+
|
|
91
|
+
export function decode_buffer_file(bytes: Uint8Array, path: string): WebDecodedBufferAsset;
|
|
92
|
+
|
|
93
|
+
export function encode_buffer_asset(element: string, frames: number, channels: number, sample_rate: number, canonical_payload: Uint8Array): Uint8Array;
|
|
94
|
+
|
|
95
|
+
export function inspect_project_image(image_bytes: Uint8Array): string;
|
|
96
|
+
|
|
97
|
+
export function materialize_project_image(image_bytes: Uint8Array, asset_file_names_json: string): WebProjectMaterializationPlan;
|
|
98
|
+
|
|
43
99
|
export function mir_schema_version(): number;
|
|
44
100
|
|
|
101
|
+
export function project_image_format_version(): number;
|
|
102
|
+
|
|
45
103
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
46
104
|
|
|
47
105
|
export interface InitOutput {
|
|
@@ -49,22 +107,53 @@ export interface InitOutput {
|
|
|
49
107
|
readonly __wbg_frontendjsoncompilation_free: (a: number, b: number) => void;
|
|
50
108
|
readonly __wbg_frontendmessagepackcompilation_free: (a: number, b: number) => void;
|
|
51
109
|
readonly __wbg_ondalsp_free: (a: number, b: number) => void;
|
|
52
|
-
readonly
|
|
53
|
-
readonly
|
|
110
|
+
readonly __wbg_webdecodedbufferasset_free: (a: number, b: number) => void;
|
|
111
|
+
readonly __wbg_webmaterializedprojectbuilder_free: (a: number, b: number) => void;
|
|
112
|
+
readonly __wbg_webprojectimagebuilder_free: (a: number, b: number) => void;
|
|
113
|
+
readonly __wbg_webprojectmaterializationplan_free: (a: number, b: number) => void;
|
|
114
|
+
readonly buffer_asset_format_version: () => number;
|
|
115
|
+
readonly compile_project_image_to_mir_messagepack: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
116
|
+
readonly compile_source_workspace_to_mir_json: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
117
|
+
readonly compile_source_workspace_to_mir_messagepack: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
54
118
|
readonly compile_to_mir_json: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
55
119
|
readonly compile_to_mir_messagepack: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
120
|
+
readonly current_stdlib_digest: () => [number, number];
|
|
121
|
+
readonly decode_buffer_asset: (a: number, b: number) => [number, number, number];
|
|
122
|
+
readonly decode_buffer_file: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
123
|
+
readonly encode_buffer_asset: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
|
|
56
124
|
readonly frontendjsoncompilation_source_files_json: (a: number) => [number, number];
|
|
125
|
+
readonly frontendjsoncompilation_source_image_json: (a: number) => [number, number];
|
|
57
126
|
readonly frontendjsoncompilation_take_mir: (a: number) => [number, number];
|
|
58
127
|
readonly frontendmessagepackcompilation_source_files_json: (a: number) => [number, number];
|
|
128
|
+
readonly frontendmessagepackcompilation_source_image_json: (a: number) => [number, number];
|
|
129
|
+
readonly inspect_project_image: (a: number, b: number) => [number, number, number, number];
|
|
130
|
+
readonly materialize_project_image: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
59
131
|
readonly mir_schema_version: () => number;
|
|
60
132
|
readonly ondalsp_handle_message: (a: number, b: number, c: number) => [number, number, number, number];
|
|
61
133
|
readonly ondalsp_new: () => number;
|
|
62
134
|
readonly ondalsp_set_analysis_options: (a: number, b: number, c: number) => [number, number];
|
|
135
|
+
readonly webdecodedbufferasset_canonical_payload: (a: number) => [number, number];
|
|
136
|
+
readonly webdecodedbufferasset_channels: (a: number) => number;
|
|
137
|
+
readonly webdecodedbufferasset_element: (a: number) => [number, number];
|
|
138
|
+
readonly webdecodedbufferasset_frames: (a: number) => number;
|
|
139
|
+
readonly webdecodedbufferasset_sample_rate: (a: number) => number;
|
|
140
|
+
readonly webmaterializedprojectbuilder_add_file: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
141
|
+
readonly webmaterializedprojectbuilder_new: () => number;
|
|
142
|
+
readonly webmaterializedprojectbuilder_select_project: (a: number, b: number, c: number) => [number, number];
|
|
143
|
+
readonly webmaterializedprojectbuilder_serialize: (a: number) => [number, number, number, number];
|
|
144
|
+
readonly webprojectimagebuilder_add_buffer: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
145
|
+
readonly webprojectimagebuilder_new: (a: number, b: number) => [number, number, number];
|
|
146
|
+
readonly webprojectimagebuilder_serialize: (a: number) => [number, number, number, number];
|
|
147
|
+
readonly webprojectmaterializationplan_directories_json: (a: number) => [number, number];
|
|
148
|
+
readonly webprojectmaterializationplan_file_bytes: (a: number, b: number) => [number, number];
|
|
149
|
+
readonly webprojectmaterializationplan_file_count: (a: number) => number;
|
|
150
|
+
readonly webprojectmaterializationplan_file_path: (a: number, b: number) => [number, number];
|
|
151
|
+
readonly project_image_format_version: () => number;
|
|
63
152
|
readonly frontendmessagepackcompilation_take_mir: (a: number) => [number, number];
|
|
64
153
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
65
154
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
66
|
-
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
67
155
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
156
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
68
157
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
69
158
|
readonly __wbindgen_start: () => void;
|
|
70
159
|
}
|