@mirascript/wasm 0.1.1 → 0.1.3
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/lib/wasm.d.ts +37 -37
- package/lib/wasm.js +95 -104
- package/lib/wasm_bg.wasm +0 -0
- package/lib/wasm_bg.wasm.d.ts +29 -29
- package/package.json +2 -2
package/lib/wasm.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
export function
|
|
3
|
+
export function main(): void;
|
|
4
4
|
export function compile(script: string, config: Config): CompileResult;
|
|
5
|
-
export function
|
|
5
|
+
export function compile_buffer(script: Uint8Array, config: Config): CompileResult;
|
|
6
|
+
export function reserved_keywords(): string[];
|
|
6
7
|
export function keywords(): string[];
|
|
7
|
-
export function control_keywords(): string[];
|
|
8
8
|
export function numeric_keywords(): string[];
|
|
9
9
|
export function constant_keywords(): string[];
|
|
10
|
-
export function
|
|
11
|
-
export function
|
|
10
|
+
export function control_keywords(): string[];
|
|
11
|
+
export function get_diagnostic_message(code: DiagnosticCode): string | undefined;
|
|
12
12
|
export enum DiagnosticCode {
|
|
13
13
|
ErrorStart = 1000,
|
|
14
14
|
InternalError = 1001,
|
|
@@ -708,8 +708,8 @@ export class CompileResult {
|
|
|
708
708
|
private constructor();
|
|
709
709
|
free(): void;
|
|
710
710
|
[Symbol.dispose](): void;
|
|
711
|
-
chunk(): Uint8Array | undefined;
|
|
712
711
|
diagnostics(): Uint32Array;
|
|
712
|
+
chunk(): Uint8Array | undefined;
|
|
713
713
|
}
|
|
714
714
|
export class Config {
|
|
715
715
|
free(): void;
|
|
@@ -729,11 +729,11 @@ export class Config {
|
|
|
729
729
|
export class MonacoCompiler {
|
|
730
730
|
free(): void;
|
|
731
731
|
[Symbol.dispose](): void;
|
|
732
|
+
diagnostics(): Uint32Array;
|
|
732
733
|
constructor(input: string, config: Config);
|
|
733
|
-
parse(): boolean;
|
|
734
734
|
emit(): Uint8Array | undefined;
|
|
735
|
+
parse(): boolean;
|
|
735
736
|
format(): string | undefined;
|
|
736
|
-
diagnostics(): Uint32Array;
|
|
737
737
|
}
|
|
738
738
|
|
|
739
739
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
@@ -741,48 +741,48 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
741
741
|
export interface InitOutput {
|
|
742
742
|
readonly memory: WebAssembly.Memory;
|
|
743
743
|
readonly __wbg_compileresult_free: (a: number, b: number) => void;
|
|
744
|
+
readonly __wbg_monacocompiler_free: (a: number, b: number) => void;
|
|
745
|
+
readonly compile: (a: number, b: number, c: number) => number;
|
|
746
|
+
readonly compile_buffer: (a: number, b: number, c: number) => number;
|
|
744
747
|
readonly compileresult_chunk: (a: number, b: number) => void;
|
|
745
748
|
readonly compileresult_diagnostics: (a: number, b: number) => void;
|
|
746
|
-
readonly
|
|
747
|
-
readonly
|
|
749
|
+
readonly constant_keywords: (a: number) => void;
|
|
750
|
+
readonly control_keywords: (a: number) => void;
|
|
748
751
|
readonly get_diagnostic_message: (a: number, b: number) => void;
|
|
749
752
|
readonly keywords: (a: number) => void;
|
|
750
|
-
readonly
|
|
751
|
-
readonly
|
|
752
|
-
readonly constant_keywords: (a: number) => void;
|
|
753
|
-
readonly reserved_keywords: (a: number) => void;
|
|
754
|
-
readonly __wbg_monacocompiler_free: (a: number, b: number) => void;
|
|
755
|
-
readonly monacocompiler_new: (a: number, b: number, c: number) => number;
|
|
756
|
-
readonly monacocompiler_parse: (a: number) => number;
|
|
753
|
+
readonly main: () => void;
|
|
754
|
+
readonly monacocompiler_diagnostics: (a: number, b: number) => void;
|
|
757
755
|
readonly monacocompiler_emit: (a: number, b: number) => void;
|
|
758
756
|
readonly monacocompiler_format: (a: number, b: number) => void;
|
|
759
|
-
readonly
|
|
760
|
-
readonly
|
|
757
|
+
readonly monacocompiler_new: (a: number, b: number, c: number) => number;
|
|
758
|
+
readonly monacocompiler_parse: (a: number) => number;
|
|
759
|
+
readonly numeric_keywords: (a: number) => void;
|
|
760
|
+
readonly reserved_keywords: (a: number) => void;
|
|
761
761
|
readonly __wbg_config_free: (a: number, b: number) => void;
|
|
762
|
+
readonly __wbg_get_config_diagnostic_error: (a: number) => number;
|
|
763
|
+
readonly __wbg_get_config_diagnostic_hint: (a: number) => number;
|
|
764
|
+
readonly __wbg_get_config_diagnostic_info: (a: number) => number;
|
|
765
|
+
readonly __wbg_get_config_diagnostic_other: (a: number) => number;
|
|
766
|
+
readonly __wbg_get_config_diagnostic_position_encoding: (a: number) => number;
|
|
767
|
+
readonly __wbg_get_config_diagnostic_reference: (a: number) => number;
|
|
768
|
+
readonly __wbg_get_config_diagnostic_warning: (a: number) => number;
|
|
769
|
+
readonly __wbg_get_config_input_mode: (a: number) => number;
|
|
762
770
|
readonly __wbg_get_config_track_references: (a: number) => number;
|
|
763
|
-
readonly __wbg_set_config_track_references: (a: number, b: number) => void;
|
|
764
771
|
readonly __wbg_get_config_trivia: (a: number) => number;
|
|
765
|
-
readonly __wbg_set_config_trivia: (a: number, b: number) => void;
|
|
766
|
-
readonly __wbg_get_config_input_mode: (a: number) => number;
|
|
767
|
-
readonly __wbg_set_config_input_mode: (a: number, b: number) => void;
|
|
768
|
-
readonly __wbg_get_config_diagnostic_position_encoding: (a: number) => number;
|
|
769
|
-
readonly __wbg_set_config_diagnostic_position_encoding: (a: number, b: number) => void;
|
|
770
|
-
readonly __wbg_get_config_diagnostic_error: (a: number) => number;
|
|
771
772
|
readonly __wbg_set_config_diagnostic_error: (a: number, b: number) => void;
|
|
772
|
-
readonly __wbg_get_config_diagnostic_warning: (a: number) => number;
|
|
773
|
-
readonly __wbg_set_config_diagnostic_warning: (a: number, b: number) => void;
|
|
774
|
-
readonly __wbg_get_config_diagnostic_info: (a: number) => number;
|
|
775
|
-
readonly __wbg_set_config_diagnostic_info: (a: number, b: number) => void;
|
|
776
|
-
readonly __wbg_get_config_diagnostic_hint: (a: number) => number;
|
|
777
773
|
readonly __wbg_set_config_diagnostic_hint: (a: number, b: number) => void;
|
|
778
|
-
readonly
|
|
779
|
-
readonly __wbg_set_config_diagnostic_reference: (a: number, b: number) => void;
|
|
780
|
-
readonly __wbg_get_config_diagnostic_other: (a: number) => number;
|
|
774
|
+
readonly __wbg_set_config_diagnostic_info: (a: number, b: number) => void;
|
|
781
775
|
readonly __wbg_set_config_diagnostic_other: (a: number, b: number) => void;
|
|
776
|
+
readonly __wbg_set_config_diagnostic_position_encoding: (a: number, b: number) => void;
|
|
777
|
+
readonly __wbg_set_config_diagnostic_reference: (a: number, b: number) => void;
|
|
778
|
+
readonly __wbg_set_config_diagnostic_warning: (a: number, b: number) => void;
|
|
779
|
+
readonly __wbg_set_config_input_mode: (a: number, b: number) => void;
|
|
780
|
+
readonly __wbg_set_config_track_references: (a: number, b: number) => void;
|
|
781
|
+
readonly __wbg_set_config_trivia: (a: number, b: number) => void;
|
|
782
782
|
readonly config_new: () => number;
|
|
783
|
-
readonly
|
|
784
|
-
readonly
|
|
785
|
-
readonly
|
|
783
|
+
readonly __wbindgen_export: (a: number, b: number, c: number) => void;
|
|
784
|
+
readonly __wbindgen_export2: (a: number, b: number) => number;
|
|
785
|
+
readonly __wbindgen_export3: (a: number, b: number, c: number, d: number) => number;
|
|
786
786
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
787
787
|
readonly __wbindgen_start: () => void;
|
|
788
788
|
}
|
package/lib/wasm.js
CHANGED
|
@@ -122,9 +122,8 @@ function takeObject(idx) {
|
|
|
122
122
|
return ret;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
function
|
|
126
|
-
|
|
127
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
125
|
+
export function main() {
|
|
126
|
+
wasm.main();
|
|
128
127
|
}
|
|
129
128
|
|
|
130
129
|
let cachedUint32ArrayMemory0 = null;
|
|
@@ -141,65 +140,48 @@ function getArrayU32FromWasm0(ptr, len) {
|
|
|
141
140
|
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
142
141
|
}
|
|
143
142
|
|
|
144
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
145
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
146
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
147
|
-
WASM_VECTOR_LEN = arg.length;
|
|
148
|
-
return ptr;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
143
|
function _assertClass(instance, klass) {
|
|
152
144
|
if (!(instance instanceof klass)) {
|
|
153
145
|
throw new Error(`expected instance of ${klass.name}`);
|
|
154
146
|
}
|
|
155
147
|
}
|
|
148
|
+
|
|
149
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
150
|
+
ptr = ptr >>> 0;
|
|
151
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
152
|
+
}
|
|
156
153
|
/**
|
|
157
|
-
* @param {
|
|
154
|
+
* @param {string} script
|
|
158
155
|
* @param {Config} config
|
|
159
156
|
* @returns {CompileResult}
|
|
160
157
|
*/
|
|
161
|
-
export function
|
|
162
|
-
const ptr0 =
|
|
158
|
+
export function compile(script, config) {
|
|
159
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
163
160
|
const len0 = WASM_VECTOR_LEN;
|
|
164
161
|
_assertClass(config, Config);
|
|
165
|
-
const ret = wasm.
|
|
162
|
+
const ret = wasm.compile(ptr0, len0, config.__wbg_ptr);
|
|
166
163
|
return CompileResult.__wrap(ret);
|
|
167
164
|
}
|
|
168
165
|
|
|
166
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
167
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
168
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
169
|
+
WASM_VECTOR_LEN = arg.length;
|
|
170
|
+
return ptr;
|
|
171
|
+
}
|
|
169
172
|
/**
|
|
170
|
-
* @param {
|
|
173
|
+
* @param {Uint8Array} script
|
|
171
174
|
* @param {Config} config
|
|
172
175
|
* @returns {CompileResult}
|
|
173
176
|
*/
|
|
174
|
-
export function
|
|
175
|
-
const ptr0 =
|
|
177
|
+
export function compile_buffer(script, config) {
|
|
178
|
+
const ptr0 = passArray8ToWasm0(script, wasm.__wbindgen_export2);
|
|
176
179
|
const len0 = WASM_VECTOR_LEN;
|
|
177
180
|
_assertClass(config, Config);
|
|
178
|
-
const ret = wasm.
|
|
181
|
+
const ret = wasm.compile_buffer(ptr0, len0, config.__wbg_ptr);
|
|
179
182
|
return CompileResult.__wrap(ret);
|
|
180
183
|
}
|
|
181
184
|
|
|
182
|
-
/**
|
|
183
|
-
* @param {DiagnosticCode} code
|
|
184
|
-
* @returns {string | undefined}
|
|
185
|
-
*/
|
|
186
|
-
export function get_diagnostic_message(code) {
|
|
187
|
-
try {
|
|
188
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
189
|
-
wasm.get_diagnostic_message(retptr, code);
|
|
190
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
191
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
192
|
-
let v1;
|
|
193
|
-
if (r0 !== 0) {
|
|
194
|
-
v1 = getStringFromWasm0(r0, r1).slice();
|
|
195
|
-
wasm.__wbindgen_export_0(r0, r1 * 1, 1);
|
|
196
|
-
}
|
|
197
|
-
return v1;
|
|
198
|
-
} finally {
|
|
199
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
185
|
function getArrayJsValueFromWasm0(ptr, len) {
|
|
204
186
|
ptr = ptr >>> 0;
|
|
205
187
|
const mem = getDataViewMemory0();
|
|
@@ -212,14 +194,14 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
212
194
|
/**
|
|
213
195
|
* @returns {string[]}
|
|
214
196
|
*/
|
|
215
|
-
export function
|
|
197
|
+
export function reserved_keywords() {
|
|
216
198
|
try {
|
|
217
199
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
218
|
-
wasm.
|
|
200
|
+
wasm.reserved_keywords(retptr);
|
|
219
201
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
220
202
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
221
203
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
222
|
-
wasm.
|
|
204
|
+
wasm.__wbindgen_export(r0, r1 * 4, 4);
|
|
223
205
|
return v1;
|
|
224
206
|
} finally {
|
|
225
207
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -229,14 +211,14 @@ export function keywords() {
|
|
|
229
211
|
/**
|
|
230
212
|
* @returns {string[]}
|
|
231
213
|
*/
|
|
232
|
-
export function
|
|
214
|
+
export function keywords() {
|
|
233
215
|
try {
|
|
234
216
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
235
|
-
wasm.
|
|
217
|
+
wasm.keywords(retptr);
|
|
236
218
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
237
219
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
238
220
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
239
|
-
wasm.
|
|
221
|
+
wasm.__wbindgen_export(r0, r1 * 4, 4);
|
|
240
222
|
return v1;
|
|
241
223
|
} finally {
|
|
242
224
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -253,7 +235,7 @@ export function numeric_keywords() {
|
|
|
253
235
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
254
236
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
255
237
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
256
|
-
wasm.
|
|
238
|
+
wasm.__wbindgen_export(r0, r1 * 4, 4);
|
|
257
239
|
return v1;
|
|
258
240
|
} finally {
|
|
259
241
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -270,7 +252,7 @@ export function constant_keywords() {
|
|
|
270
252
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
271
253
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
272
254
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
273
|
-
wasm.
|
|
255
|
+
wasm.__wbindgen_export(r0, r1 * 4, 4);
|
|
274
256
|
return v1;
|
|
275
257
|
} finally {
|
|
276
258
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -280,22 +262,39 @@ export function constant_keywords() {
|
|
|
280
262
|
/**
|
|
281
263
|
* @returns {string[]}
|
|
282
264
|
*/
|
|
283
|
-
export function
|
|
265
|
+
export function control_keywords() {
|
|
284
266
|
try {
|
|
285
267
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
286
|
-
wasm.
|
|
268
|
+
wasm.control_keywords(retptr);
|
|
287
269
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
288
270
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
289
271
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
290
|
-
wasm.
|
|
272
|
+
wasm.__wbindgen_export(r0, r1 * 4, 4);
|
|
291
273
|
return v1;
|
|
292
274
|
} finally {
|
|
293
275
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
294
276
|
}
|
|
295
277
|
}
|
|
296
278
|
|
|
297
|
-
|
|
298
|
-
|
|
279
|
+
/**
|
|
280
|
+
* @param {DiagnosticCode} code
|
|
281
|
+
* @returns {string | undefined}
|
|
282
|
+
*/
|
|
283
|
+
export function get_diagnostic_message(code) {
|
|
284
|
+
try {
|
|
285
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
286
|
+
wasm.get_diagnostic_message(retptr, code);
|
|
287
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
288
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
289
|
+
let v1;
|
|
290
|
+
if (r0 !== 0) {
|
|
291
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
292
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
293
|
+
}
|
|
294
|
+
return v1;
|
|
295
|
+
} finally {
|
|
296
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
297
|
+
}
|
|
299
298
|
}
|
|
300
299
|
|
|
301
300
|
/**
|
|
@@ -1028,35 +1027,35 @@ export class CompileResult {
|
|
|
1028
1027
|
wasm.__wbg_compileresult_free(ptr, 0);
|
|
1029
1028
|
}
|
|
1030
1029
|
/**
|
|
1031
|
-
* @returns {
|
|
1030
|
+
* @returns {Uint32Array}
|
|
1032
1031
|
*/
|
|
1033
|
-
|
|
1032
|
+
diagnostics() {
|
|
1034
1033
|
try {
|
|
1035
1034
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1036
|
-
wasm.
|
|
1035
|
+
wasm.compileresult_diagnostics(retptr, this.__wbg_ptr);
|
|
1037
1036
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1038
1037
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1042
|
-
wasm.__wbindgen_export_0(r0, r1 * 1, 1);
|
|
1043
|
-
}
|
|
1038
|
+
var v1 = getArrayU32FromWasm0(r0, r1).slice();
|
|
1039
|
+
wasm.__wbindgen_export(r0, r1 * 4, 4);
|
|
1044
1040
|
return v1;
|
|
1045
1041
|
} finally {
|
|
1046
1042
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1047
1043
|
}
|
|
1048
1044
|
}
|
|
1049
1045
|
/**
|
|
1050
|
-
* @returns {
|
|
1046
|
+
* @returns {Uint8Array | undefined}
|
|
1051
1047
|
*/
|
|
1052
|
-
|
|
1048
|
+
chunk() {
|
|
1053
1049
|
try {
|
|
1054
1050
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1055
|
-
wasm.
|
|
1051
|
+
wasm.compileresult_chunk(retptr, this.__wbg_ptr);
|
|
1056
1052
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1057
1053
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1058
|
-
|
|
1059
|
-
|
|
1054
|
+
let v1;
|
|
1055
|
+
if (r0 !== 0) {
|
|
1056
|
+
v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1057
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1058
|
+
}
|
|
1060
1059
|
return v1;
|
|
1061
1060
|
} finally {
|
|
1062
1061
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -1238,12 +1237,28 @@ export class MonacoCompiler {
|
|
|
1238
1237
|
const ptr = this.__destroy_into_raw();
|
|
1239
1238
|
wasm.__wbg_monacocompiler_free(ptr, 0);
|
|
1240
1239
|
}
|
|
1240
|
+
/**
|
|
1241
|
+
* @returns {Uint32Array}
|
|
1242
|
+
*/
|
|
1243
|
+
diagnostics() {
|
|
1244
|
+
try {
|
|
1245
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1246
|
+
wasm.monacocompiler_diagnostics(retptr, this.__wbg_ptr);
|
|
1247
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1248
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1249
|
+
var v1 = getArrayU32FromWasm0(r0, r1).slice();
|
|
1250
|
+
wasm.__wbindgen_export(r0, r1 * 4, 4);
|
|
1251
|
+
return v1;
|
|
1252
|
+
} finally {
|
|
1253
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1241
1256
|
/**
|
|
1242
1257
|
* @param {string} input
|
|
1243
1258
|
* @param {Config} config
|
|
1244
1259
|
*/
|
|
1245
1260
|
constructor(input, config) {
|
|
1246
|
-
const ptr0 = passStringToWasm0(input, wasm.
|
|
1261
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
1247
1262
|
const len0 = WASM_VECTOR_LEN;
|
|
1248
1263
|
_assertClass(config, Config);
|
|
1249
1264
|
const ret = wasm.monacocompiler_new(ptr0, len0, config.__wbg_ptr);
|
|
@@ -1251,13 +1266,6 @@ export class MonacoCompiler {
|
|
|
1251
1266
|
MonacoCompilerFinalization.register(this, this.__wbg_ptr, this);
|
|
1252
1267
|
return this;
|
|
1253
1268
|
}
|
|
1254
|
-
/**
|
|
1255
|
-
* @returns {boolean}
|
|
1256
|
-
*/
|
|
1257
|
-
parse() {
|
|
1258
|
-
const ret = wasm.monacocompiler_parse(this.__wbg_ptr);
|
|
1259
|
-
return ret !== 0;
|
|
1260
|
-
}
|
|
1261
1269
|
/**
|
|
1262
1270
|
* @returns {Uint8Array | undefined}
|
|
1263
1271
|
*/
|
|
@@ -1270,13 +1278,20 @@ export class MonacoCompiler {
|
|
|
1270
1278
|
let v1;
|
|
1271
1279
|
if (r0 !== 0) {
|
|
1272
1280
|
v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1273
|
-
wasm.
|
|
1281
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1274
1282
|
}
|
|
1275
1283
|
return v1;
|
|
1276
1284
|
} finally {
|
|
1277
1285
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1278
1286
|
}
|
|
1279
1287
|
}
|
|
1288
|
+
/**
|
|
1289
|
+
* @returns {boolean}
|
|
1290
|
+
*/
|
|
1291
|
+
parse() {
|
|
1292
|
+
const ret = wasm.monacocompiler_parse(this.__wbg_ptr);
|
|
1293
|
+
return ret !== 0;
|
|
1294
|
+
}
|
|
1280
1295
|
/**
|
|
1281
1296
|
* @returns {string | undefined}
|
|
1282
1297
|
*/
|
|
@@ -1289,29 +1304,13 @@ export class MonacoCompiler {
|
|
|
1289
1304
|
let v1;
|
|
1290
1305
|
if (r0 !== 0) {
|
|
1291
1306
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1292
|
-
wasm.
|
|
1307
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1293
1308
|
}
|
|
1294
1309
|
return v1;
|
|
1295
1310
|
} finally {
|
|
1296
1311
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1297
1312
|
}
|
|
1298
1313
|
}
|
|
1299
|
-
/**
|
|
1300
|
-
* @returns {Uint32Array}
|
|
1301
|
-
*/
|
|
1302
|
-
diagnostics() {
|
|
1303
|
-
try {
|
|
1304
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1305
|
-
wasm.monacocompiler_diagnostics(retptr, this.__wbg_ptr);
|
|
1306
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1307
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1308
|
-
var v1 = getArrayU32FromWasm0(r0, r1).slice();
|
|
1309
|
-
wasm.__wbindgen_export_0(r0, r1 * 4, 4);
|
|
1310
|
-
return v1;
|
|
1311
|
-
} finally {
|
|
1312
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
1314
|
}
|
|
1316
1315
|
if (Symbol.dispose) MonacoCompiler.prototype[Symbol.dispose] = MonacoCompiler.prototype.free;
|
|
1317
1316
|
|
|
@@ -1353,6 +1352,9 @@ async function __wbg_load(module, imports) {
|
|
|
1353
1352
|
function __wbg_get_imports() {
|
|
1354
1353
|
const imports = {};
|
|
1355
1354
|
imports.wbg = {};
|
|
1355
|
+
imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
|
|
1356
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1357
|
+
};
|
|
1356
1358
|
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
1357
1359
|
let deferred0_0;
|
|
1358
1360
|
let deferred0_1;
|
|
@@ -1361,7 +1363,7 @@ function __wbg_get_imports() {
|
|
|
1361
1363
|
deferred0_1 = arg1;
|
|
1362
1364
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
1363
1365
|
} finally {
|
|
1364
|
-
wasm.
|
|
1366
|
+
wasm.__wbindgen_export(deferred0_0, deferred0_1, 1);
|
|
1365
1367
|
}
|
|
1366
1368
|
};
|
|
1367
1369
|
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
@@ -1370,14 +1372,11 @@ function __wbg_get_imports() {
|
|
|
1370
1372
|
};
|
|
1371
1373
|
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
1372
1374
|
const ret = getObject(arg1).stack;
|
|
1373
|
-
const ptr1 = passStringToWasm0(ret, wasm.
|
|
1375
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
1374
1376
|
const len1 = WASM_VECTOR_LEN;
|
|
1375
1377
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1376
1378
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1377
1379
|
};
|
|
1378
|
-
imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
|
|
1379
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1380
|
-
};
|
|
1381
1380
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
1382
1381
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
1383
1382
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
@@ -1390,10 +1389,6 @@ function __wbg_get_imports() {
|
|
|
1390
1389
|
return imports;
|
|
1391
1390
|
}
|
|
1392
1391
|
|
|
1393
|
-
function __wbg_init_memory(imports, memory) {
|
|
1394
|
-
|
|
1395
|
-
}
|
|
1396
|
-
|
|
1397
1392
|
function __wbg_finalize_init(instance, module) {
|
|
1398
1393
|
wasm = instance.exports;
|
|
1399
1394
|
__wbg_init.__wbindgen_wasm_module = module;
|
|
@@ -1420,8 +1415,6 @@ function initSync(module) {
|
|
|
1420
1415
|
|
|
1421
1416
|
const imports = __wbg_get_imports();
|
|
1422
1417
|
|
|
1423
|
-
__wbg_init_memory(imports);
|
|
1424
|
-
|
|
1425
1418
|
if (!(module instanceof WebAssembly.Module)) {
|
|
1426
1419
|
module = new WebAssembly.Module(module);
|
|
1427
1420
|
}
|
|
@@ -1452,8 +1445,6 @@ async function __wbg_init(module_or_path) {
|
|
|
1452
1445
|
module_or_path = fetch(module_or_path);
|
|
1453
1446
|
}
|
|
1454
1447
|
|
|
1455
|
-
__wbg_init_memory(imports);
|
|
1456
|
-
|
|
1457
1448
|
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
1458
1449
|
|
|
1459
1450
|
return __wbg_finalize_init(instance, module);
|
package/lib/wasm_bg.wasm
CHANGED
|
Binary file
|
package/lib/wasm_bg.wasm.d.ts
CHANGED
|
@@ -2,47 +2,47 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const __wbg_compileresult_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_monacocompiler_free: (a: number, b: number) => void;
|
|
6
|
+
export const compile: (a: number, b: number, c: number) => number;
|
|
7
|
+
export const compile_buffer: (a: number, b: number, c: number) => number;
|
|
5
8
|
export const compileresult_chunk: (a: number, b: number) => void;
|
|
6
9
|
export const compileresult_diagnostics: (a: number, b: number) => void;
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
10
|
+
export const constant_keywords: (a: number) => void;
|
|
11
|
+
export const control_keywords: (a: number) => void;
|
|
9
12
|
export const get_diagnostic_message: (a: number, b: number) => void;
|
|
10
13
|
export const keywords: (a: number) => void;
|
|
11
|
-
export const
|
|
12
|
-
export const
|
|
13
|
-
export const constant_keywords: (a: number) => void;
|
|
14
|
-
export const reserved_keywords: (a: number) => void;
|
|
15
|
-
export const __wbg_monacocompiler_free: (a: number, b: number) => void;
|
|
16
|
-
export const monacocompiler_new: (a: number, b: number, c: number) => number;
|
|
17
|
-
export const monacocompiler_parse: (a: number) => number;
|
|
14
|
+
export const main: () => void;
|
|
15
|
+
export const monacocompiler_diagnostics: (a: number, b: number) => void;
|
|
18
16
|
export const monacocompiler_emit: (a: number, b: number) => void;
|
|
19
17
|
export const monacocompiler_format: (a: number, b: number) => void;
|
|
20
|
-
export const
|
|
21
|
-
export const
|
|
18
|
+
export const monacocompiler_new: (a: number, b: number, c: number) => number;
|
|
19
|
+
export const monacocompiler_parse: (a: number) => number;
|
|
20
|
+
export const numeric_keywords: (a: number) => void;
|
|
21
|
+
export const reserved_keywords: (a: number) => void;
|
|
22
22
|
export const __wbg_config_free: (a: number, b: number) => void;
|
|
23
|
+
export const __wbg_get_config_diagnostic_error: (a: number) => number;
|
|
24
|
+
export const __wbg_get_config_diagnostic_hint: (a: number) => number;
|
|
25
|
+
export const __wbg_get_config_diagnostic_info: (a: number) => number;
|
|
26
|
+
export const __wbg_get_config_diagnostic_other: (a: number) => number;
|
|
27
|
+
export const __wbg_get_config_diagnostic_position_encoding: (a: number) => number;
|
|
28
|
+
export const __wbg_get_config_diagnostic_reference: (a: number) => number;
|
|
29
|
+
export const __wbg_get_config_diagnostic_warning: (a: number) => number;
|
|
30
|
+
export const __wbg_get_config_input_mode: (a: number) => number;
|
|
23
31
|
export const __wbg_get_config_track_references: (a: number) => number;
|
|
24
|
-
export const __wbg_set_config_track_references: (a: number, b: number) => void;
|
|
25
32
|
export const __wbg_get_config_trivia: (a: number) => number;
|
|
26
|
-
export const __wbg_set_config_trivia: (a: number, b: number) => void;
|
|
27
|
-
export const __wbg_get_config_input_mode: (a: number) => number;
|
|
28
|
-
export const __wbg_set_config_input_mode: (a: number, b: number) => void;
|
|
29
|
-
export const __wbg_get_config_diagnostic_position_encoding: (a: number) => number;
|
|
30
|
-
export const __wbg_set_config_diagnostic_position_encoding: (a: number, b: number) => void;
|
|
31
|
-
export const __wbg_get_config_diagnostic_error: (a: number) => number;
|
|
32
33
|
export const __wbg_set_config_diagnostic_error: (a: number, b: number) => void;
|
|
33
|
-
export const __wbg_get_config_diagnostic_warning: (a: number) => number;
|
|
34
|
-
export const __wbg_set_config_diagnostic_warning: (a: number, b: number) => void;
|
|
35
|
-
export const __wbg_get_config_diagnostic_info: (a: number) => number;
|
|
36
|
-
export const __wbg_set_config_diagnostic_info: (a: number, b: number) => void;
|
|
37
|
-
export const __wbg_get_config_diagnostic_hint: (a: number) => number;
|
|
38
34
|
export const __wbg_set_config_diagnostic_hint: (a: number, b: number) => void;
|
|
39
|
-
export const
|
|
40
|
-
export const __wbg_set_config_diagnostic_reference: (a: number, b: number) => void;
|
|
41
|
-
export const __wbg_get_config_diagnostic_other: (a: number) => number;
|
|
35
|
+
export const __wbg_set_config_diagnostic_info: (a: number, b: number) => void;
|
|
42
36
|
export const __wbg_set_config_diagnostic_other: (a: number, b: number) => void;
|
|
37
|
+
export const __wbg_set_config_diagnostic_position_encoding: (a: number, b: number) => void;
|
|
38
|
+
export const __wbg_set_config_diagnostic_reference: (a: number, b: number) => void;
|
|
39
|
+
export const __wbg_set_config_diagnostic_warning: (a: number, b: number) => void;
|
|
40
|
+
export const __wbg_set_config_input_mode: (a: number, b: number) => void;
|
|
41
|
+
export const __wbg_set_config_track_references: (a: number, b: number) => void;
|
|
42
|
+
export const __wbg_set_config_trivia: (a: number, b: number) => void;
|
|
43
43
|
export const config_new: () => number;
|
|
44
|
-
export const
|
|
45
|
-
export const
|
|
46
|
-
export const
|
|
44
|
+
export const __wbindgen_export: (a: number, b: number, c: number) => void;
|
|
45
|
+
export const __wbindgen_export2: (a: number, b: number) => number;
|
|
46
|
+
export const __wbindgen_export3: (a: number, b: number, c: number, d: number) => number;
|
|
47
47
|
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
48
48
|
export const __wbindgen_start: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirascript/wasm",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MiraScript compiler for WebAssembly",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@types/node": "^24.
|
|
19
|
+
"@types/node": "^24.10.0",
|
|
20
20
|
"nodemon": "^3.1.10"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|