windmill-parser-wasm-csharp 1.437.1 → 1.880.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.880.1",
8
8
  "files": [
9
9
  "windmill_parser_wasm_bg.wasm",
10
10
  "windmill_parser_wasm.js",
@@ -1,40 +1,37 @@
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];
10
+ readonly __assert_fail: (a: number, b: number, c: number, d: number) => void;
14
11
  readonly abort: () => void;
15
- readonly malloc: (a: number) => number;
16
12
  readonly calloc: (a: number, b: number) => number;
17
- readonly realloc: (a: number, b: number) => number;
18
- readonly free: (a: number) => void;
19
- readonly strncmp: (a: number, b: number, c: number) => number;
20
- readonly iswspace: (a: number) => number;
21
- readonly iswalnum: (a: number) => number;
22
- readonly clock: () => number;
23
- readonly isprint: (a: number) => number;
13
+ readonly clock: () => bigint;
14
+ readonly clock_gettime: (a: number, b: number) => void;
15
+ readonly fclose: (a: number) => number;
16
+ readonly fdopen: (a: number, b: number) => number;
24
17
  readonly fprintf: (a: number, b: number, c: number) => number;
25
- readonly fputs: (a: number, b: number) => number;
26
18
  readonly fputc: (a: number, b: number) => number;
27
- readonly fdopen: (a: number, b: number) => number;
28
- readonly fclose: (a: number) => number;
19
+ readonly fputs: (a: number, b: number) => number;
20
+ readonly free: (a: number) => void;
29
21
  readonly fwrite: (a: number, b: number, c: number, d: number) => number;
30
- readonly vsnprintf: (a: number, b: number, c: number, d: number) => number;
31
- readonly clock_gettime: (a: number, b: number) => void;
22
+ readonly isprint: (a: number) => number;
23
+ readonly iswalnum: (a: number) => number;
24
+ readonly iswspace: (a: number) => number;
25
+ readonly malloc: (a: number) => number;
26
+ readonly realloc: (a: number, b: number) => number;
32
27
  readonly snprintf: () => void;
33
- readonly __assert_fail: (a: number, b: number, c: number, d: number) => void;
34
- readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
28
+ readonly strncmp: (a: number, b: number, c: number) => number;
29
+ readonly vsnprintf: (a: number, b: number, c: number, d: 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,46 +65,47 @@ function passStringToWasm0(arg, malloc, realloc) {
65
65
  return ptr;
66
66
  }
67
67
 
68
- let cachedInt32Memory0 = null;
68
+ let cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
69
69
 
70
- function getInt32Memory0() {
71
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
72
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
70
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
71
+
72
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
73
+ let numBytesDecoded = 0;
74
+ function decodeText(ptr, len) {
75
+ numBytesDecoded += len;
76
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
77
+ cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
78
+ cachedTextDecoder.decode();
79
+ numBytesDecoded = len;
73
80
  }
74
- return cachedInt32Memory0;
81
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
75
82
  }
76
83
 
77
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
78
-
79
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
80
-
81
84
  function getStringFromWasm0(ptr, len) {
82
85
  ptr = ptr >>> 0;
83
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
86
+ return decodeText(ptr, len);
84
87
  }
85
88
  /**
86
- * @param {string} code
87
- * @returns {string}
88
- */
89
+ * @param {string} code
90
+ * @returns {string}
91
+ */
89
92
  export function parse_csharp(code) {
90
93
  let deferred2_0;
91
94
  let deferred2_1;
92
95
  try {
93
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
94
96
  const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
95
97
  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);
98
+ const ret = wasm.parse_csharp(ptr0, len0);
99
+ deferred2_0 = ret[0];
100
+ deferred2_1 = ret[1];
101
+ return getStringFromWasm0(ret[0], ret[1]);
102
102
  } finally {
103
- wasm.__wbindgen_add_to_stack_pointer(16);
104
103
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
105
104
  }
106
105
  }
107
106
 
107
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
108
+
108
109
  async function __wbg_load(module, imports) {
109
110
  if (typeof Response === 'function' && module instanceof Response) {
110
111
  if (typeof WebAssembly.instantiateStreaming === 'function') {
@@ -112,8 +113,10 @@ async function __wbg_load(module, imports) {
112
113
  return await WebAssembly.instantiateStreaming(module, imports);
113
114
 
114
115
  } catch (e) {
115
- 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);
116
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
117
+
118
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
119
+ 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
120
 
118
121
  } else {
119
122
  throw e;
@@ -139,27 +142,46 @@ async function __wbg_load(module, imports) {
139
142
  function __wbg_get_imports() {
140
143
  const imports = {};
141
144
  imports.wbg = {};
145
+ imports.wbg.__wbindgen_init_externref_table = function() {
146
+ const table = wasm.__wbindgen_export_0;
147
+ const offset = table.grow(4);
148
+ table.set(0, undefined);
149
+ table.set(offset + 0, undefined);
150
+ table.set(offset + 1, null);
151
+ table.set(offset + 2, true);
152
+ table.set(offset + 3, false);
153
+ ;
154
+ };
142
155
 
143
156
  return imports;
144
157
  }
145
158
 
146
- function __wbg_init_memory(imports, maybe_memory) {
159
+ function __wbg_init_memory(imports, memory) {
147
160
 
148
161
  }
149
162
 
150
163
  function __wbg_finalize_init(instance, module) {
151
164
  wasm = instance.exports;
152
165
  __wbg_init.__wbindgen_wasm_module = module;
153
- cachedInt32Memory0 = null;
154
- cachedUint8Memory0 = null;
166
+ cachedUint8ArrayMemory0 = null;
155
167
 
156
168
 
169
+ wasm.__wbindgen_start();
157
170
  return wasm;
158
171
  }
159
172
 
160
173
  function initSync(module) {
161
174
  if (wasm !== undefined) return wasm;
162
175
 
176
+
177
+ if (typeof module !== 'undefined') {
178
+ if (Object.getPrototypeOf(module) === Object.prototype) {
179
+ ({module} = module)
180
+ } else {
181
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
182
+ }
183
+ }
184
+
163
185
  const imports = __wbg_get_imports();
164
186
 
165
187
  __wbg_init_memory(imports);
@@ -173,24 +195,33 @@ function initSync(module) {
173
195
  return __wbg_finalize_init(instance, module);
174
196
  }
175
197
 
176
- async function __wbg_init(input) {
198
+ async function __wbg_init(module_or_path) {
177
199
  if (wasm !== undefined) return wasm;
178
200
 
179
- if (typeof input === 'undefined') {
180
- input = new URL('windmill_parser_wasm_bg.wasm', import.meta.url);
201
+
202
+ if (typeof module_or_path !== 'undefined') {
203
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
204
+ ({module_or_path} = module_or_path)
205
+ } else {
206
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
207
+ }
208
+ }
209
+
210
+ if (typeof module_or_path === 'undefined') {
211
+ module_or_path = new URL('windmill_parser_wasm_bg.wasm', import.meta.url);
181
212
  }
182
213
  const imports = __wbg_get_imports();
183
214
 
184
- if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
185
- input = fetch(input);
215
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
216
+ module_or_path = fetch(module_or_path);
186
217
  }
187
218
 
188
219
  __wbg_init_memory(imports);
189
220
 
190
- const { instance, module } = await __wbg_load(await input, imports);
221
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
191
222
 
192
223
  return __wbg_finalize_init(instance, module);
193
224
  }
194
225
 
195
- export { initSync }
226
+ export { initSync };
196
227
  export default __wbg_init;
Binary file