@onda-lang/wasm-compiler 0.5.4 → 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/dist/build.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
- "ondaVersion": "0.5.4",
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": 6441305,
10
- "outputBytes": 4878025
9
+ "inputBytes": 7708408,
10
+ "outputBytes": 5773425
11
11
  }
12
12
  }
@@ -15,12 +15,25 @@ 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
- `compile_project_to_mir_messagepack(entryPath, sourcesJson, sampleRate, blockSize)` return compact
19
- schema-versioned bytes. JSON variants with the same names ending in `_json` remain available for
20
- inspection and tooling. Project compilation accepts a JSON object of project-relative paths to
21
- source strings, resolving imports and includes entirely in memory. Paths cannot escape the virtual
22
- project root. `mir_schema_version()` exposes the producer version for integration checks.
23
- Compilation failures reject with a JSON-encoded array of structured diagnostics.
18
+ `compile_source_workspace_to_mir_messagepack(entryPath, sourcesJson, sampleRate, blockSize)` return a
19
+ `FrontendMessagePackCompilation` containing compact schema-versioned bytes plus the ordered
20
+ contributing project paths. JSON variants return the equivalent `FrontendJsonCompilation` for
21
+ inspection and tooling. Both result types expose the source list and exact portable source image.
22
+ Workspace
23
+ compilation accepts a JSON object of project-relative paths to source strings, resolving imports and
24
+ includes entirely in memory. Paths cannot escape the virtual project root. Embedded
25
+ standard-library modules are omitted from the source manifest. `mir_schema_version()` exposes the
26
+ producer version for integration checks. Compilation failures reject with a JSON-encoded object
27
+ containing structured diagnostics, the partially resolved source list, and unresolved
28
+ non-standard-library candidates which a host may watch for creation.
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.
24
37
 
25
38
  The current producer and `packages/onda_binaryen_web` both use the current MIR schema. The browser playground
26
39
  under `examples/web/onda_wasm_playground` passes the generated MessagePack directly to the explicitly
@@ -52,4 +65,4 @@ compile/render measurements are documented in
52
65
  Application consumers should normally install
53
66
  [`@onda-lang/wasm-compiler`](../../packages/onda_wasm_compiler/README.md), which packages this
54
67
  frontend Wasm with the compatible Binaryen backend, verifies their MIR schema handshake, and
55
- provides typed source/project APIs plus the `onda-wasm` CLI.
68
+ provides typed source-workspace and project-image APIs plus the `onda-wasm` CLI.
@@ -1,6 +1,24 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
+ export class FrontendJsonCompilation {
5
+ private constructor();
6
+ free(): void;
7
+ [Symbol.dispose](): void;
8
+ source_files_json(): string;
9
+ source_image_json(): string;
10
+ take_mir(): string;
11
+ }
12
+
13
+ export class FrontendMessagePackCompilation {
14
+ private constructor();
15
+ free(): void;
16
+ [Symbol.dispose](): void;
17
+ source_files_json(): string;
18
+ source_image_json(): string;
19
+ take_mir(): Uint8Array;
20
+ }
21
+
4
22
  /**
5
23
  * Stateful `onda lsp` server for browser Worker transports.
6
24
  */
@@ -16,33 +34,126 @@ export class OndaLsp {
16
34
  set_analysis_options(sample_rate: number, block_size: number): void;
17
35
  }
18
36
 
19
- export function compile_project_to_mir_json(entry_path: string, sources_json: string, sample_rate: number, block_size: number): string;
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;
76
+
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;
20
80
 
21
- export function compile_project_to_mir_messagepack(entry_path: string, sources_json: string, sample_rate: number, block_size: number): Uint8Array;
81
+ export function compile_source_workspace_to_mir_messagepack(entry_path: string, sources_json: string, sample_rate: number, block_size: number): FrontendMessagePackCompilation;
22
82
 
23
- export function compile_to_mir_json(source: string, sample_rate: number, block_size: number): string;
83
+ export function compile_to_mir_json(source: string, sample_rate: number, block_size: number): FrontendJsonCompilation;
24
84
 
25
- export function compile_to_mir_messagepack(source: string, sample_rate: number, block_size: number): Uint8Array;
85
+ export function compile_to_mir_messagepack(source: string, sample_rate: number, block_size: number): FrontendMessagePackCompilation;
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;
26
98
 
27
99
  export function mir_schema_version(): number;
28
100
 
101
+ export function project_image_format_version(): number;
102
+
29
103
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
30
104
 
31
105
  export interface InitOutput {
32
106
  readonly memory: WebAssembly.Memory;
107
+ readonly __wbg_frontendjsoncompilation_free: (a: number, b: number) => void;
108
+ readonly __wbg_frontendmessagepackcompilation_free: (a: number, b: number) => void;
33
109
  readonly __wbg_ondalsp_free: (a: number, b: number) => void;
34
- readonly compile_project_to_mir_json: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
35
- readonly compile_project_to_mir_messagepack: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
36
- readonly compile_to_mir_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
37
- readonly compile_to_mir_messagepack: (a: number, b: number, c: number, d: number) => [number, number, number, number];
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];
118
+ readonly compile_to_mir_json: (a: number, b: number, c: number, d: number) => [number, number, number];
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];
124
+ readonly frontendjsoncompilation_source_files_json: (a: number) => [number, number];
125
+ readonly frontendjsoncompilation_source_image_json: (a: number) => [number, number];
126
+ readonly frontendjsoncompilation_take_mir: (a: number) => [number, number];
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];
38
131
  readonly mir_schema_version: () => number;
39
132
  readonly ondalsp_handle_message: (a: number, b: number, c: number) => [number, number, number, number];
40
133
  readonly ondalsp_new: () => number;
41
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;
152
+ readonly frontendmessagepackcompilation_take_mir: (a: number) => [number, number];
42
153
  readonly __wbindgen_externrefs: WebAssembly.Table;
43
154
  readonly __wbindgen_malloc: (a: number, b: number) => number;
44
- readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
45
155
  readonly __externref_table_dealloc: (a: number) => void;
156
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
46
157
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
47
158
  readonly __wbindgen_start: () => void;
48
159
  }