windmill-parser-wasm-csharp 1.437.1 → 1.510.1

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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "collaborators": [
5
5
  "Ruben Fiszel <ruben@windmill.dev>"
6
6
  ],
7
- "version": "1.437.1",
7
+ "version": "1.510.1",
8
8
  "files": [
9
9
  "windmill_parser_wasm_bg.wasm",
10
10
  "windmill_parser_wasm.js",
@@ -1,16 +1,12 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * @param {string} code
5
- * @returns {string}
6
- */
7
3
  export function parse_csharp(code: string): string;
8
4
 
9
5
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
10
6
 
11
7
  export interface InitOutput {
12
8
  readonly memory: WebAssembly.Memory;
13
- readonly parse_csharp: (a: number, b: number, c: number) => void;
9
+ readonly parse_csharp: (a: number, b: number) => [number, number];
14
10
  readonly abort: () => void;
15
11
  readonly malloc: (a: number) => number;
16
12
  readonly calloc: (a: number, b: number) => number;
@@ -19,7 +15,7 @@ export interface InitOutput {
19
15
  readonly strncmp: (a: number, b: number, c: number) => number;
20
16
  readonly iswspace: (a: number) => number;
21
17
  readonly iswalnum: (a: number) => number;
22
- readonly clock: () => number;
18
+ readonly clock: () => bigint;
23
19
  readonly isprint: (a: number) => number;
24
20
  readonly fprintf: (a: number, b: number, c: number) => number;
25
21
  readonly fputs: (a: number, b: number) => number;
@@ -31,10 +27,11 @@ export interface InitOutput {
31
27
  readonly clock_gettime: (a: number, b: number) => void;
32
28
  readonly snprintf: () => void;
33
29
  readonly __assert_fail: (a: number, b: number, c: number, d: number) => void;
34
- readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
30
+ readonly __wbindgen_export_0: WebAssembly.Table;
35
31
  readonly __wbindgen_malloc: (a: number, b: number) => number;
36
32
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
37
33
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
34
+ readonly __wbindgen_start: () => void;
38
35
  }
39
36
 
40
37
  export type SyncInitInput = BufferSource | WebAssembly.Module;
@@ -42,18 +39,18 @@ export type SyncInitInput = BufferSource | WebAssembly.Module;
42
39
  * Instantiates the given `module`, which can either be bytes or
43
40
  * a precompiled `WebAssembly.Module`.
44
41
  *
45
- * @param {SyncInitInput} module
42
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
46
43
  *
47
44
  * @returns {InitOutput}
48
45
  */
49
- export function initSync(module: SyncInitInput): InitOutput;
46
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
50
47
 
51
48
  /**
52
49
  * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
53
50
  * for everything else, calls `WebAssembly.instantiate` directly.
54
51
  *
55
- * @param {InitInput | Promise<InitInput>} module_or_path
52
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
56
53
  *
57
54
  * @returns {Promise<InitOutput>}
58
55
  */
59
- export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
56
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
@@ -2,13 +2,13 @@ let wasm;
2
2
 
3
3
  let WASM_VECTOR_LEN = 0;
4
4
 
5
- let cachedUint8Memory0 = null;
5
+ let cachedUint8ArrayMemory0 = null;
6
6
 
7
- function getUint8Memory0() {
8
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
9
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
7
+ function getUint8ArrayMemory0() {
8
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
9
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
10
10
  }
11
- return cachedUint8Memory0;
11
+ return cachedUint8ArrayMemory0;
12
12
  }
13
13
 
14
14
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
@@ -31,7 +31,7 @@ function passStringToWasm0(arg, malloc, realloc) {
31
31
  if (realloc === undefined) {
32
32
  const buf = cachedTextEncoder.encode(arg);
33
33
  const ptr = malloc(buf.length, 1) >>> 0;
34
- getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
34
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
35
35
  WASM_VECTOR_LEN = buf.length;
36
36
  return ptr;
37
37
  }
@@ -39,7 +39,7 @@ function passStringToWasm0(arg, malloc, realloc) {
39
39
  let len = arg.length;
40
40
  let ptr = malloc(len, 1) >>> 0;
41
41
 
42
- const mem = getUint8Memory0();
42
+ const mem = getUint8ArrayMemory0();
43
43
 
44
44
  let offset = 0;
45
45
 
@@ -54,7 +54,7 @@ function passStringToWasm0(arg, malloc, realloc) {
54
54
  arg = arg.slice(offset);
55
55
  }
56
56
  ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
57
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
57
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
58
58
  const ret = encodeString(arg, view);
59
59
 
60
60
  offset += ret.written;
@@ -65,42 +65,29 @@ function passStringToWasm0(arg, malloc, realloc) {
65
65
  return ptr;
66
66
  }
67
67
 
68
- let cachedInt32Memory0 = null;
69
-
70
- function getInt32Memory0() {
71
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
72
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
73
- }
74
- return cachedInt32Memory0;
75
- }
76
-
77
68
  const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
78
69
 
79
70
  if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
80
71
 
81
72
  function getStringFromWasm0(ptr, len) {
82
73
  ptr = ptr >>> 0;
83
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
74
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
84
75
  }
85
76
  /**
86
- * @param {string} code
87
- * @returns {string}
88
- */
77
+ * @param {string} code
78
+ * @returns {string}
79
+ */
89
80
  export function parse_csharp(code) {
90
81
  let deferred2_0;
91
82
  let deferred2_1;
92
83
  try {
93
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
94
84
  const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
95
85
  const len0 = WASM_VECTOR_LEN;
96
- wasm.parse_csharp(retptr, ptr0, len0);
97
- var r0 = getInt32Memory0()[retptr / 4 + 0];
98
- var r1 = getInt32Memory0()[retptr / 4 + 1];
99
- deferred2_0 = r0;
100
- deferred2_1 = r1;
101
- return getStringFromWasm0(r0, r1);
86
+ const ret = wasm.parse_csharp(ptr0, len0);
87
+ deferred2_0 = ret[0];
88
+ deferred2_1 = ret[1];
89
+ return getStringFromWasm0(ret[0], ret[1]);
102
90
  } finally {
103
- wasm.__wbindgen_add_to_stack_pointer(16);
104
91
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
105
92
  }
106
93
  }
@@ -113,7 +100,7 @@ async function __wbg_load(module, imports) {
113
100
 
114
101
  } catch (e) {
115
102
  if (module.headers.get('Content-Type') != 'application/wasm') {
116
- console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
103
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
117
104
 
118
105
  } else {
119
106
  throw e;
@@ -139,27 +126,46 @@ async function __wbg_load(module, imports) {
139
126
  function __wbg_get_imports() {
140
127
  const imports = {};
141
128
  imports.wbg = {};
129
+ imports.wbg.__wbindgen_init_externref_table = function() {
130
+ const table = wasm.__wbindgen_export_0;
131
+ const offset = table.grow(4);
132
+ table.set(0, undefined);
133
+ table.set(offset + 0, undefined);
134
+ table.set(offset + 1, null);
135
+ table.set(offset + 2, true);
136
+ table.set(offset + 3, false);
137
+ ;
138
+ };
142
139
 
143
140
  return imports;
144
141
  }
145
142
 
146
- function __wbg_init_memory(imports, maybe_memory) {
143
+ function __wbg_init_memory(imports, memory) {
147
144
 
148
145
  }
149
146
 
150
147
  function __wbg_finalize_init(instance, module) {
151
148
  wasm = instance.exports;
152
149
  __wbg_init.__wbindgen_wasm_module = module;
153
- cachedInt32Memory0 = null;
154
- cachedUint8Memory0 = null;
150
+ cachedUint8ArrayMemory0 = null;
155
151
 
156
152
 
153
+ wasm.__wbindgen_start();
157
154
  return wasm;
158
155
  }
159
156
 
160
157
  function initSync(module) {
161
158
  if (wasm !== undefined) return wasm;
162
159
 
160
+
161
+ if (typeof module !== 'undefined') {
162
+ if (Object.getPrototypeOf(module) === Object.prototype) {
163
+ ({module} = module)
164
+ } else {
165
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
166
+ }
167
+ }
168
+
163
169
  const imports = __wbg_get_imports();
164
170
 
165
171
  __wbg_init_memory(imports);
@@ -173,24 +179,33 @@ function initSync(module) {
173
179
  return __wbg_finalize_init(instance, module);
174
180
  }
175
181
 
176
- async function __wbg_init(input) {
182
+ async function __wbg_init(module_or_path) {
177
183
  if (wasm !== undefined) return wasm;
178
184
 
179
- if (typeof input === 'undefined') {
180
- input = new URL('windmill_parser_wasm_bg.wasm', import.meta.url);
185
+
186
+ if (typeof module_or_path !== 'undefined') {
187
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
188
+ ({module_or_path} = module_or_path)
189
+ } else {
190
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
191
+ }
192
+ }
193
+
194
+ if (typeof module_or_path === 'undefined') {
195
+ module_or_path = new URL('windmill_parser_wasm_bg.wasm', import.meta.url);
181
196
  }
182
197
  const imports = __wbg_get_imports();
183
198
 
184
- if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
185
- input = fetch(input);
199
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
200
+ module_or_path = fetch(module_or_path);
186
201
  }
187
202
 
188
203
  __wbg_init_memory(imports);
189
204
 
190
- const { instance, module } = await __wbg_load(await input, imports);
205
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
191
206
 
192
207
  return __wbg_finalize_init(instance, module);
193
208
  }
194
209
 
195
- export { initSync }
210
+ export { initSync };
196
211
  export default __wbg_init;
Binary file