windmill-parser-wasm-py-imports 1.659.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 ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "windmill-parser-wasm-py-imports",
3
+ "type": "module",
4
+ "collaborators": [
5
+ "Ruben Fiszel <ruben@windmill.dev>"
6
+ ],
7
+ "version": "1.659.1",
8
+ "files": [
9
+ "windmill_parser_wasm_bg.wasm",
10
+ "windmill_parser_wasm.js",
11
+ "windmill_parser_wasm.d.ts"
12
+ ],
13
+ "main": "windmill_parser_wasm.js",
14
+ "types": "windmill_parser_wasm.d.ts",
15
+ "sideEffects": [
16
+ "./snippets/*"
17
+ ]
18
+ }
@@ -0,0 +1,42 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Parse Python imports and return relative imports resolved to absolute Windmill paths.
5
+ * Throws JS error on parse failure.
6
+ */
7
+ export function parse_py_relative_imports(code: string, path: string): string[];
8
+
9
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
10
+
11
+ export interface InitOutput {
12
+ readonly memory: WebAssembly.Memory;
13
+ readonly parse_py_relative_imports: (a: number, b: number, c: number, d: number) => [number, number, number, number];
14
+ readonly __wbindgen_export_0: WebAssembly.Table;
15
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
16
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
17
+ readonly __externref_table_dealloc: (a: number) => void;
18
+ readonly __externref_drop_slice: (a: number, b: number) => void;
19
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
20
+ readonly __wbindgen_start: () => void;
21
+ }
22
+
23
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
24
+ /**
25
+ * Instantiates the given `module`, which can either be bytes or
26
+ * a precompiled `WebAssembly.Module`.
27
+ *
28
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
29
+ *
30
+ * @returns {InitOutput}
31
+ */
32
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
33
+
34
+ /**
35
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
36
+ * for everything else, calls `WebAssembly.instantiate` directly.
37
+ *
38
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
39
+ *
40
+ * @returns {Promise<InitOutput>}
41
+ */
42
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
@@ -0,0 +1,261 @@
1
+ let wasm;
2
+
3
+ let cachedUint8ArrayMemory0 = null;
4
+
5
+ function getUint8ArrayMemory0() {
6
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
7
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
8
+ }
9
+ return cachedUint8ArrayMemory0;
10
+ }
11
+
12
+ let cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
13
+
14
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
15
+
16
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
17
+ let numBytesDecoded = 0;
18
+ function decodeText(ptr, len) {
19
+ numBytesDecoded += len;
20
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
21
+ cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
22
+ cachedTextDecoder.decode();
23
+ numBytesDecoded = len;
24
+ }
25
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
26
+ }
27
+
28
+ function getStringFromWasm0(ptr, len) {
29
+ ptr = ptr >>> 0;
30
+ return decodeText(ptr, len);
31
+ }
32
+
33
+ let WASM_VECTOR_LEN = 0;
34
+
35
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
36
+
37
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
38
+ ? function (arg, view) {
39
+ return cachedTextEncoder.encodeInto(arg, view);
40
+ }
41
+ : function (arg, view) {
42
+ const buf = cachedTextEncoder.encode(arg);
43
+ view.set(buf);
44
+ return {
45
+ read: arg.length,
46
+ written: buf.length
47
+ };
48
+ });
49
+
50
+ function passStringToWasm0(arg, malloc, realloc) {
51
+
52
+ if (realloc === undefined) {
53
+ const buf = cachedTextEncoder.encode(arg);
54
+ const ptr = malloc(buf.length, 1) >>> 0;
55
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
56
+ WASM_VECTOR_LEN = buf.length;
57
+ return ptr;
58
+ }
59
+
60
+ let len = arg.length;
61
+ let ptr = malloc(len, 1) >>> 0;
62
+
63
+ const mem = getUint8ArrayMemory0();
64
+
65
+ let offset = 0;
66
+
67
+ for (; offset < len; offset++) {
68
+ const code = arg.charCodeAt(offset);
69
+ if (code > 0x7F) break;
70
+ mem[ptr + offset] = code;
71
+ }
72
+
73
+ if (offset !== len) {
74
+ if (offset !== 0) {
75
+ arg = arg.slice(offset);
76
+ }
77
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
78
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
79
+ const ret = encodeString(arg, view);
80
+
81
+ offset += ret.written;
82
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
83
+ }
84
+
85
+ WASM_VECTOR_LEN = offset;
86
+ return ptr;
87
+ }
88
+
89
+ function takeFromExternrefTable0(idx) {
90
+ const value = wasm.__wbindgen_export_0.get(idx);
91
+ wasm.__externref_table_dealloc(idx);
92
+ return value;
93
+ }
94
+
95
+ let cachedDataViewMemory0 = null;
96
+
97
+ function getDataViewMemory0() {
98
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
99
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
100
+ }
101
+ return cachedDataViewMemory0;
102
+ }
103
+
104
+ function getArrayJsValueFromWasm0(ptr, len) {
105
+ ptr = ptr >>> 0;
106
+ const mem = getDataViewMemory0();
107
+ const result = [];
108
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
109
+ result.push(wasm.__wbindgen_export_0.get(mem.getUint32(i, true)));
110
+ }
111
+ wasm.__externref_drop_slice(ptr, len);
112
+ return result;
113
+ }
114
+ /**
115
+ * Parse Python imports and return relative imports resolved to absolute Windmill paths.
116
+ * Throws JS error on parse failure.
117
+ * @param {string} code
118
+ * @param {string} path
119
+ * @returns {string[]}
120
+ */
121
+ export function parse_py_relative_imports(code, path) {
122
+ const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
123
+ const len0 = WASM_VECTOR_LEN;
124
+ const ptr1 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
125
+ const len1 = WASM_VECTOR_LEN;
126
+ const ret = wasm.parse_py_relative_imports(ptr0, len0, ptr1, len1);
127
+ if (ret[3]) {
128
+ throw takeFromExternrefTable0(ret[2]);
129
+ }
130
+ var v3 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
131
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
132
+ return v3;
133
+ }
134
+
135
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
136
+
137
+ async function __wbg_load(module, imports) {
138
+ if (typeof Response === 'function' && module instanceof Response) {
139
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
140
+ try {
141
+ return await WebAssembly.instantiateStreaming(module, imports);
142
+
143
+ } catch (e) {
144
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
145
+
146
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
147
+ 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);
148
+
149
+ } else {
150
+ throw e;
151
+ }
152
+ }
153
+ }
154
+
155
+ const bytes = await module.arrayBuffer();
156
+ return await WebAssembly.instantiate(bytes, imports);
157
+
158
+ } else {
159
+ const instance = await WebAssembly.instantiate(module, imports);
160
+
161
+ if (instance instanceof WebAssembly.Instance) {
162
+ return { instance, module };
163
+
164
+ } else {
165
+ return instance;
166
+ }
167
+ }
168
+ }
169
+
170
+ function __wbg_get_imports() {
171
+ const imports = {};
172
+ imports.wbg = {};
173
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
174
+ // Cast intrinsic for `Ref(String) -> Externref`.
175
+ const ret = getStringFromWasm0(arg0, arg1);
176
+ return ret;
177
+ };
178
+ imports.wbg.__wbindgen_init_externref_table = function() {
179
+ const table = wasm.__wbindgen_export_0;
180
+ const offset = table.grow(4);
181
+ table.set(0, undefined);
182
+ table.set(offset + 0, undefined);
183
+ table.set(offset + 1, null);
184
+ table.set(offset + 2, true);
185
+ table.set(offset + 3, false);
186
+ ;
187
+ };
188
+
189
+ return imports;
190
+ }
191
+
192
+ function __wbg_init_memory(imports, memory) {
193
+
194
+ }
195
+
196
+ function __wbg_finalize_init(instance, module) {
197
+ wasm = instance.exports;
198
+ __wbg_init.__wbindgen_wasm_module = module;
199
+ cachedDataViewMemory0 = null;
200
+ cachedUint8ArrayMemory0 = null;
201
+
202
+
203
+ wasm.__wbindgen_start();
204
+ return wasm;
205
+ }
206
+
207
+ function initSync(module) {
208
+ if (wasm !== undefined) return wasm;
209
+
210
+
211
+ if (typeof module !== 'undefined') {
212
+ if (Object.getPrototypeOf(module) === Object.prototype) {
213
+ ({module} = module)
214
+ } else {
215
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
216
+ }
217
+ }
218
+
219
+ const imports = __wbg_get_imports();
220
+
221
+ __wbg_init_memory(imports);
222
+
223
+ if (!(module instanceof WebAssembly.Module)) {
224
+ module = new WebAssembly.Module(module);
225
+ }
226
+
227
+ const instance = new WebAssembly.Instance(module, imports);
228
+
229
+ return __wbg_finalize_init(instance, module);
230
+ }
231
+
232
+ async function __wbg_init(module_or_path) {
233
+ if (wasm !== undefined) return wasm;
234
+
235
+
236
+ if (typeof module_or_path !== 'undefined') {
237
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
238
+ ({module_or_path} = module_or_path)
239
+ } else {
240
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
241
+ }
242
+ }
243
+
244
+ if (typeof module_or_path === 'undefined') {
245
+ module_or_path = new URL('windmill_parser_wasm_bg.wasm', import.meta.url);
246
+ }
247
+ const imports = __wbg_get_imports();
248
+
249
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
250
+ module_or_path = fetch(module_or_path);
251
+ }
252
+
253
+ __wbg_init_memory(imports);
254
+
255
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
256
+
257
+ return __wbg_finalize_init(instance, module);
258
+ }
259
+
260
+ export { initSync };
261
+ export default __wbg_init;
Binary file