rust-fetch 0.5.0 → 0.6.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rust-fetch",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -11,6 +11,7 @@
11
11
  },
12
12
  "scripts": {
13
13
  "build": "cd wasm-module && tsc",
14
+ "build:wasm": "cd wasm-module && wasm-pack build --target web",
14
15
  "test": "echo \"Error: no test specified\" && exit 1"
15
16
  },
16
17
  "keywords": [],
package/server.ts CHANGED
@@ -2,13 +2,12 @@ import * as path from 'path';
2
2
  import { readFileSync } from 'fs';
3
3
 
4
4
  import initWasm from 'wasm-module';
5
- const wasmPath = path.join(process.cwd(), 'node_modules', '@asemqaffaf/rust-fetch', 'wasm-module', 'pkg', 'wasm_module_bg.wasm');
5
+ const wasmPath = path.join(process.cwd(), 'node_modules', 'rust-fetch', 'wasm-module', 'pkg', 'wasm_module_bg.wasm');
6
6
  export const wasmBuffer = readFileSync(wasmPath);
7
7
 
8
- (async ()=>{
8
+ (async () => {
9
9
  await initWasm(wasmBuffer);
10
- })()
10
+ })();
11
11
 
12
12
  export default initWasm;
13
13
  export * from 'wasm-module';
14
-
@@ -12,4 +12,4 @@ reqwest = { version = "0.11", features = ["json"] }
12
12
  serde = { version = "1.0", features = ["derive"] }
13
13
  serde_json = "1.0"
14
14
  wasm-bindgen-futures = "0.4"
15
- serde-wasm-bindgen = "0.6"
15
+ serde-wasm-bindgen = "0.6"
@@ -4,6 +4,29 @@ use wasm_bindgen::JsValue;
4
4
  use serde_json::Value;
5
5
  use reqwest::get;
6
6
  use serde_wasm_bindgen::to_value;
7
+ // use wasm_bindgen::prelude::*;
8
+ use wasm_bindgen_futures::future_to_promise;
9
+ // use serde_json::Value;
10
+ // use web_sys::Response;
11
+ use js_sys::Promise;
12
+ use wasm_bindgen_futures::js_sys;
13
+
14
+ #[wasm_bindgen]
15
+ pub fn fetch_wasm_json_new(url: String) -> Promise {
16
+ future_to_promise(async move {
17
+ let response = get(url)
18
+ .await
19
+ .map_err(|e| JsValue::from_str(&e.to_string()))?;
20
+
21
+ let json: Value = response
22
+ .json()
23
+ .await
24
+ .map_err(|e| JsValue::from_str(&e.to_string()))?;
25
+
26
+ serde_wasm_bindgen::to_value(&json)
27
+ .map_err(|e| JsValue::from_str(&e.to_string()))
28
+ })
29
+ }
7
30
 
8
31
  #[wasm_bindgen]
9
32
  pub async fn fetch_wasm_json(url: String) -> Result<JsValue, JsValue> {
@@ -1,15 +0,0 @@
1
- {
2
- "name": "wasm-module",
3
- "type": "module",
4
- "version": "0.1.0",
5
- "files": [
6
- "wasm_module_bg.wasm",
7
- "wasm_module.js",
8
- "wasm_module.d.ts"
9
- ],
10
- "main": "wasm_module.js",
11
- "types": "wasm_module.d.ts",
12
- "sideEffects": [
13
- "./snippets/*"
14
- ]
15
- }
@@ -1,51 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- export function greet(name: string): string;
4
- export function fetch_wasm_json(url: string): Promise<any>;
5
- export function fetch_wasm_map(url: string): Promise<any>;
6
- export function fetch_wasm_html(url: string): Promise<string>;
7
- export function fetch_wasm_api(): Promise<any>;
8
- export function add(a: number, b: number): number;
9
-
10
- export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
11
-
12
- export interface InitOutput {
13
- readonly memory: WebAssembly.Memory;
14
- readonly greet: (a: number, b: number) => [number, number];
15
- readonly fetch_wasm_json: (a: number, b: number) => any;
16
- readonly fetch_wasm_map: (a: number, b: number) => any;
17
- readonly fetch_wasm_html: (a: number, b: number) => any;
18
- readonly fetch_wasm_api: () => any;
19
- readonly add: (a: number, b: number) => number;
20
- readonly __wbindgen_exn_store: (a: number) => void;
21
- readonly __externref_table_alloc: () => number;
22
- readonly __wbindgen_export_2: WebAssembly.Table;
23
- readonly __wbindgen_malloc: (a: number, b: number) => number;
24
- readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
25
- readonly __wbindgen_export_5: WebAssembly.Table;
26
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
27
- readonly closure89_externref_shim: (a: number, b: number, c: any) => void;
28
- readonly closure112_externref_shim: (a: number, b: number, c: any, d: any) => void;
29
- readonly __wbindgen_start: () => void;
30
- }
31
-
32
- export type SyncInitInput = BufferSource | WebAssembly.Module;
33
- /**
34
- * Instantiates the given `module`, which can either be bytes or
35
- * a precompiled `WebAssembly.Module`.
36
- *
37
- * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
38
- *
39
- * @returns {InitOutput}
40
- */
41
- export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
42
-
43
- /**
44
- * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
45
- * for everything else, calls `WebAssembly.instantiate` directly.
46
- *
47
- * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
48
- *
49
- * @returns {Promise<InitOutput>}
50
- */
51
- export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
@@ -1,694 +0,0 @@
1
- let wasm;
2
-
3
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
4
-
5
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
6
-
7
- let cachedUint8ArrayMemory0 = null;
8
-
9
- function getUint8ArrayMemory0() {
10
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
11
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
12
- }
13
- return cachedUint8ArrayMemory0;
14
- }
15
-
16
- function getStringFromWasm0(ptr, len) {
17
- ptr = ptr >>> 0;
18
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
19
- }
20
-
21
- function addToExternrefTable0(obj) {
22
- const idx = wasm.__externref_table_alloc();
23
- wasm.__wbindgen_export_2.set(idx, obj);
24
- return idx;
25
- }
26
-
27
- function handleError(f, args) {
28
- try {
29
- return f.apply(this, args);
30
- } catch (e) {
31
- const idx = addToExternrefTable0(e);
32
- wasm.__wbindgen_exn_store(idx);
33
- }
34
- }
35
-
36
- function isLikeNone(x) {
37
- return x === undefined || x === null;
38
- }
39
-
40
- let WASM_VECTOR_LEN = 0;
41
-
42
- const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
43
-
44
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
45
- ? function (arg, view) {
46
- return cachedTextEncoder.encodeInto(arg, view);
47
- }
48
- : function (arg, view) {
49
- const buf = cachedTextEncoder.encode(arg);
50
- view.set(buf);
51
- return {
52
- read: arg.length,
53
- written: buf.length
54
- };
55
- });
56
-
57
- function passStringToWasm0(arg, malloc, realloc) {
58
-
59
- if (realloc === undefined) {
60
- const buf = cachedTextEncoder.encode(arg);
61
- const ptr = malloc(buf.length, 1) >>> 0;
62
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
63
- WASM_VECTOR_LEN = buf.length;
64
- return ptr;
65
- }
66
-
67
- let len = arg.length;
68
- let ptr = malloc(len, 1) >>> 0;
69
-
70
- const mem = getUint8ArrayMemory0();
71
-
72
- let offset = 0;
73
-
74
- for (; offset < len; offset++) {
75
- const code = arg.charCodeAt(offset);
76
- if (code > 0x7F) break;
77
- mem[ptr + offset] = code;
78
- }
79
-
80
- if (offset !== len) {
81
- if (offset !== 0) {
82
- arg = arg.slice(offset);
83
- }
84
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
85
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
86
- const ret = encodeString(arg, view);
87
-
88
- offset += ret.written;
89
- ptr = realloc(ptr, len, offset, 1) >>> 0;
90
- }
91
-
92
- WASM_VECTOR_LEN = offset;
93
- return ptr;
94
- }
95
-
96
- let cachedDataViewMemory0 = null;
97
-
98
- function getDataViewMemory0() {
99
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
100
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
101
- }
102
- return cachedDataViewMemory0;
103
- }
104
-
105
- const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
106
- ? { register: () => {}, unregister: () => {} }
107
- : new FinalizationRegistry(state => {
108
- wasm.__wbindgen_export_5.get(state.dtor)(state.a, state.b)
109
- });
110
-
111
- function makeMutClosure(arg0, arg1, dtor, f) {
112
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
113
- const real = (...args) => {
114
- // First up with a closure we increment the internal reference
115
- // count. This ensures that the Rust closure environment won't
116
- // be deallocated while we're invoking it.
117
- state.cnt++;
118
- const a = state.a;
119
- state.a = 0;
120
- try {
121
- return f(a, state.b, ...args);
122
- } finally {
123
- if (--state.cnt === 0) {
124
- wasm.__wbindgen_export_5.get(state.dtor)(a, state.b);
125
- CLOSURE_DTORS.unregister(state);
126
- } else {
127
- state.a = a;
128
- }
129
- }
130
- };
131
- real.original = state;
132
- CLOSURE_DTORS.register(real, state, state);
133
- return real;
134
- }
135
-
136
- function debugString(val) {
137
- // primitive types
138
- const type = typeof val;
139
- if (type == 'number' || type == 'boolean' || val == null) {
140
- return `${val}`;
141
- }
142
- if (type == 'string') {
143
- return `"${val}"`;
144
- }
145
- if (type == 'symbol') {
146
- const description = val.description;
147
- if (description == null) {
148
- return 'Symbol';
149
- } else {
150
- return `Symbol(${description})`;
151
- }
152
- }
153
- if (type == 'function') {
154
- const name = val.name;
155
- if (typeof name == 'string' && name.length > 0) {
156
- return `Function(${name})`;
157
- } else {
158
- return 'Function';
159
- }
160
- }
161
- // objects
162
- if (Array.isArray(val)) {
163
- const length = val.length;
164
- let debug = '[';
165
- if (length > 0) {
166
- debug += debugString(val[0]);
167
- }
168
- for(let i = 1; i < length; i++) {
169
- debug += ', ' + debugString(val[i]);
170
- }
171
- debug += ']';
172
- return debug;
173
- }
174
- // Test for built-in
175
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
176
- let className;
177
- if (builtInMatches && builtInMatches.length > 1) {
178
- className = builtInMatches[1];
179
- } else {
180
- // Failed to match the standard '[object ClassName]'
181
- return toString.call(val);
182
- }
183
- if (className == 'Object') {
184
- // we're a user defined class or Object
185
- // JSON.stringify avoids problems with cycles, and is generally much
186
- // easier than looping through ownProperties of `val`.
187
- try {
188
- return 'Object(' + JSON.stringify(val) + ')';
189
- } catch (_) {
190
- return 'Object';
191
- }
192
- }
193
- // errors
194
- if (val instanceof Error) {
195
- return `${val.name}: ${val.message}\n${val.stack}`;
196
- }
197
- // TODO we could test for more things here, like `Set`s and `Map`s.
198
- return className;
199
- }
200
- /**
201
- * @param {string} name
202
- * @returns {string}
203
- */
204
- export function greet(name) {
205
- let deferred2_0;
206
- let deferred2_1;
207
- try {
208
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
209
- const len0 = WASM_VECTOR_LEN;
210
- const ret = wasm.greet(ptr0, len0);
211
- deferred2_0 = ret[0];
212
- deferred2_1 = ret[1];
213
- return getStringFromWasm0(ret[0], ret[1]);
214
- } finally {
215
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
216
- }
217
- }
218
-
219
- /**
220
- * @param {string} url
221
- * @returns {Promise<any>}
222
- */
223
- export function fetch_wasm_json(url) {
224
- const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
225
- const len0 = WASM_VECTOR_LEN;
226
- const ret = wasm.fetch_wasm_json(ptr0, len0);
227
- return ret;
228
- }
229
-
230
- /**
231
- * @param {string} url
232
- * @returns {Promise<any>}
233
- */
234
- export function fetch_wasm_map(url) {
235
- const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
236
- const len0 = WASM_VECTOR_LEN;
237
- const ret = wasm.fetch_wasm_map(ptr0, len0);
238
- return ret;
239
- }
240
-
241
- /**
242
- * @param {string} url
243
- * @returns {Promise<string>}
244
- */
245
- export function fetch_wasm_html(url) {
246
- const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
247
- const len0 = WASM_VECTOR_LEN;
248
- const ret = wasm.fetch_wasm_html(ptr0, len0);
249
- return ret;
250
- }
251
-
252
- /**
253
- * @returns {Promise<any>}
254
- */
255
- export function fetch_wasm_api() {
256
- const ret = wasm.fetch_wasm_api();
257
- return ret;
258
- }
259
-
260
- /**
261
- * @param {number} a
262
- * @param {number} b
263
- * @returns {number}
264
- */
265
- export function add(a, b) {
266
- const ret = wasm.add(a, b);
267
- return ret;
268
- }
269
-
270
- function __wbg_adapter_38(arg0, arg1, arg2) {
271
- wasm.closure89_externref_shim(arg0, arg1, arg2);
272
- }
273
-
274
- function __wbg_adapter_117(arg0, arg1, arg2, arg3) {
275
- wasm.closure112_externref_shim(arg0, arg1, arg2, arg3);
276
- }
277
-
278
- const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
279
-
280
- const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
281
-
282
- async function __wbg_load(module, imports) {
283
- if (typeof Response === 'function' && module instanceof Response) {
284
- if (typeof WebAssembly.instantiateStreaming === 'function') {
285
- try {
286
- return await WebAssembly.instantiateStreaming(module, imports);
287
-
288
- } catch (e) {
289
- if (module.headers.get('Content-Type') != 'application/wasm') {
290
- 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);
291
-
292
- } else {
293
- throw e;
294
- }
295
- }
296
- }
297
-
298
- const bytes = await module.arrayBuffer();
299
- return await WebAssembly.instantiate(bytes, imports);
300
-
301
- } else {
302
- const instance = await WebAssembly.instantiate(module, imports);
303
-
304
- if (instance instanceof WebAssembly.Instance) {
305
- return { instance, module };
306
-
307
- } else {
308
- return instance;
309
- }
310
- }
311
- }
312
-
313
- function __wbg_get_imports() {
314
- const imports = {};
315
- imports.wbg = {};
316
- imports.wbg.__wbg_abort_05026c983d86824c = function(arg0) {
317
- arg0.abort();
318
- };
319
- imports.wbg.__wbg_append_72d1635ad8643998 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
320
- arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
321
- }, arguments) };
322
- imports.wbg.__wbg_arrayBuffer_d0ca2ad8bda0039b = function() { return handleError(function (arg0) {
323
- const ret = arg0.arrayBuffer();
324
- return ret;
325
- }, arguments) };
326
- imports.wbg.__wbg_buffer_61b7ce01341d7f88 = function(arg0) {
327
- const ret = arg0.buffer;
328
- return ret;
329
- };
330
- imports.wbg.__wbg_call_500db948e69c7330 = function() { return handleError(function (arg0, arg1, arg2) {
331
- const ret = arg0.call(arg1, arg2);
332
- return ret;
333
- }, arguments) };
334
- imports.wbg.__wbg_call_b0d8e36992d9900d = function() { return handleError(function (arg0, arg1) {
335
- const ret = arg0.call(arg1);
336
- return ret;
337
- }, arguments) };
338
- imports.wbg.__wbg_done_f22c1561fa919baa = function(arg0) {
339
- const ret = arg0.done;
340
- return ret;
341
- };
342
- imports.wbg.__wbg_fetch_229368eecee9d217 = function(arg0, arg1) {
343
- const ret = arg0.fetch(arg1);
344
- return ret;
345
- };
346
- imports.wbg.__wbg_fetch_f1856afdb49415d1 = function(arg0) {
347
- const ret = fetch(arg0);
348
- return ret;
349
- };
350
- imports.wbg.__wbg_get_bbccf8970793c087 = function() { return handleError(function (arg0, arg1) {
351
- const ret = Reflect.get(arg0, arg1);
352
- return ret;
353
- }, arguments) };
354
- imports.wbg.__wbg_has_94c2fc1d261bbfe9 = function() { return handleError(function (arg0, arg1) {
355
- const ret = Reflect.has(arg0, arg1);
356
- return ret;
357
- }, arguments) };
358
- imports.wbg.__wbg_headers_24e3e19fe3f187c0 = function(arg0) {
359
- const ret = arg0.headers;
360
- return ret;
361
- };
362
- imports.wbg.__wbg_instanceof_Response_d3453657e10c4300 = function(arg0) {
363
- let result;
364
- try {
365
- result = arg0 instanceof Response;
366
- } catch (_) {
367
- result = false;
368
- }
369
- const ret = result;
370
- return ret;
371
- };
372
- imports.wbg.__wbg_iterator_23604bb983791576 = function() {
373
- const ret = Symbol.iterator;
374
- return ret;
375
- };
376
- imports.wbg.__wbg_length_65d1cd11729ced11 = function(arg0) {
377
- const ret = arg0.length;
378
- return ret;
379
- };
380
- imports.wbg.__wbg_new_254fa9eac11932ae = function() {
381
- const ret = new Array();
382
- return ret;
383
- };
384
- imports.wbg.__wbg_new_35d748855c4620b9 = function() { return handleError(function () {
385
- const ret = new Headers();
386
- return ret;
387
- }, arguments) };
388
- imports.wbg.__wbg_new_3d446df9155128ef = function(arg0, arg1) {
389
- try {
390
- var state0 = {a: arg0, b: arg1};
391
- var cb0 = (arg0, arg1) => {
392
- const a = state0.a;
393
- state0.a = 0;
394
- try {
395
- return __wbg_adapter_117(a, state0.b, arg0, arg1);
396
- } finally {
397
- state0.a = a;
398
- }
399
- };
400
- const ret = new Promise(cb0);
401
- return ret;
402
- } finally {
403
- state0.a = state0.b = 0;
404
- }
405
- };
406
- imports.wbg.__wbg_new_3ff5b33b1ce712df = function(arg0) {
407
- const ret = new Uint8Array(arg0);
408
- return ret;
409
- };
410
- imports.wbg.__wbg_new_5f48f21d4be11586 = function() { return handleError(function () {
411
- const ret = new AbortController();
412
- return ret;
413
- }, arguments) };
414
- imports.wbg.__wbg_new_688846f374351c92 = function() {
415
- const ret = new Object();
416
- return ret;
417
- };
418
- imports.wbg.__wbg_new_bc96c6a1c0786643 = function() {
419
- const ret = new Map();
420
- return ret;
421
- };
422
- imports.wbg.__wbg_newnoargs_fd9e4bf8be2bc16d = function(arg0, arg1) {
423
- const ret = new Function(getStringFromWasm0(arg0, arg1));
424
- return ret;
425
- };
426
- imports.wbg.__wbg_newwithbyteoffsetandlength_ba35896968751d91 = function(arg0, arg1, arg2) {
427
- const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
428
- return ret;
429
- };
430
- imports.wbg.__wbg_newwithstrandinit_a1f6583f20e4faff = function() { return handleError(function (arg0, arg1, arg2) {
431
- const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
432
- return ret;
433
- }, arguments) };
434
- imports.wbg.__wbg_next_01dd9234a5bf6d05 = function() { return handleError(function (arg0) {
435
- const ret = arg0.next();
436
- return ret;
437
- }, arguments) };
438
- imports.wbg.__wbg_next_137428deb98342b0 = function(arg0) {
439
- const ret = arg0.next;
440
- return ret;
441
- };
442
- imports.wbg.__wbg_queueMicrotask_2181040e064c0dc8 = function(arg0) {
443
- queueMicrotask(arg0);
444
- };
445
- imports.wbg.__wbg_queueMicrotask_ef9ac43769cbcc4f = function(arg0) {
446
- const ret = arg0.queueMicrotask;
447
- return ret;
448
- };
449
- imports.wbg.__wbg_resolve_0bf7c44d641804f9 = function(arg0) {
450
- const ret = Promise.resolve(arg0);
451
- return ret;
452
- };
453
- imports.wbg.__wbg_set_1d80752d0d5f0b21 = function(arg0, arg1, arg2) {
454
- arg0[arg1 >>> 0] = arg2;
455
- };
456
- imports.wbg.__wbg_set_23d69db4e5c66a6e = function(arg0, arg1, arg2) {
457
- arg0.set(arg1, arg2 >>> 0);
458
- };
459
- imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
460
- arg0[arg1] = arg2;
461
- };
462
- imports.wbg.__wbg_set_76818dc3c59a63d5 = function(arg0, arg1, arg2) {
463
- const ret = arg0.set(arg1, arg2);
464
- return ret;
465
- };
466
- imports.wbg.__wbg_setbody_64920df008e48adc = function(arg0, arg1) {
467
- arg0.body = arg1;
468
- };
469
- imports.wbg.__wbg_setcredentials_cfc15e48e3a3a535 = function(arg0, arg1) {
470
- arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
471
- };
472
- imports.wbg.__wbg_setheaders_4c921e8e226bdfa7 = function(arg0, arg1) {
473
- arg0.headers = arg1;
474
- };
475
- imports.wbg.__wbg_setmethod_cfc7f688ba46a6be = function(arg0, arg1, arg2) {
476
- arg0.method = getStringFromWasm0(arg1, arg2);
477
- };
478
- imports.wbg.__wbg_setmode_cd03637eb7da01e0 = function(arg0, arg1) {
479
- arg0.mode = __wbindgen_enum_RequestMode[arg1];
480
- };
481
- imports.wbg.__wbg_setsignal_f766190d206f09e5 = function(arg0, arg1) {
482
- arg0.signal = arg1;
483
- };
484
- imports.wbg.__wbg_signal_1fdadeba2d04660e = function(arg0) {
485
- const ret = arg0.signal;
486
- return ret;
487
- };
488
- imports.wbg.__wbg_static_accessor_GLOBAL_0be7472e492ad3e3 = function() {
489
- const ret = typeof global === 'undefined' ? null : global;
490
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
491
- };
492
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_1a6eb482d12c9bfb = function() {
493
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
494
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
495
- };
496
- imports.wbg.__wbg_static_accessor_SELF_1dc398a895c82351 = function() {
497
- const ret = typeof self === 'undefined' ? null : self;
498
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
499
- };
500
- imports.wbg.__wbg_static_accessor_WINDOW_ae1c80c7eea8d64a = function() {
501
- const ret = typeof window === 'undefined' ? null : window;
502
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
503
- };
504
- imports.wbg.__wbg_status_317f53bc4c7638df = function(arg0) {
505
- const ret = arg0.status;
506
- return ret;
507
- };
508
- imports.wbg.__wbg_stringify_f4f701bc34ceda61 = function() { return handleError(function (arg0) {
509
- const ret = JSON.stringify(arg0);
510
- return ret;
511
- }, arguments) };
512
- imports.wbg.__wbg_text_dfc4cb7631d2eb34 = function() { return handleError(function (arg0) {
513
- const ret = arg0.text();
514
- return ret;
515
- }, arguments) };
516
- imports.wbg.__wbg_then_0438fad860fe38e1 = function(arg0, arg1) {
517
- const ret = arg0.then(arg1);
518
- return ret;
519
- };
520
- imports.wbg.__wbg_then_0ffafeddf0e182a4 = function(arg0, arg1, arg2) {
521
- const ret = arg0.then(arg1, arg2);
522
- return ret;
523
- };
524
- imports.wbg.__wbg_url_5327bc0a41a9b085 = function(arg0, arg1) {
525
- const ret = arg1.url;
526
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
527
- const len1 = WASM_VECTOR_LEN;
528
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
529
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
530
- };
531
- imports.wbg.__wbg_value_4c32fd138a88eee2 = function(arg0) {
532
- const ret = arg0.value;
533
- return ret;
534
- };
535
- imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
536
- const ret = arg0;
537
- return ret;
538
- };
539
- imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
540
- const ret = BigInt.asUintN(64, arg0);
541
- return ret;
542
- };
543
- imports.wbg.__wbindgen_cb_drop = function(arg0) {
544
- const obj = arg0.original;
545
- if (obj.cnt-- == 1) {
546
- obj.a = 0;
547
- return true;
548
- }
549
- const ret = false;
550
- return ret;
551
- };
552
- imports.wbg.__wbindgen_closure_wrapper277 = function(arg0, arg1, arg2) {
553
- const ret = makeMutClosure(arg0, arg1, 90, __wbg_adapter_38);
554
- return ret;
555
- };
556
- imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
557
- const ret = debugString(arg1);
558
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
559
- const len1 = WASM_VECTOR_LEN;
560
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
561
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
562
- };
563
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
564
- const ret = new Error(getStringFromWasm0(arg0, arg1));
565
- return ret;
566
- };
567
- imports.wbg.__wbindgen_init_externref_table = function() {
568
- const table = wasm.__wbindgen_export_2;
569
- const offset = table.grow(4);
570
- table.set(0, undefined);
571
- table.set(offset + 0, undefined);
572
- table.set(offset + 1, null);
573
- table.set(offset + 2, true);
574
- table.set(offset + 3, false);
575
- ;
576
- };
577
- imports.wbg.__wbindgen_is_function = function(arg0) {
578
- const ret = typeof(arg0) === 'function';
579
- return ret;
580
- };
581
- imports.wbg.__wbindgen_is_object = function(arg0) {
582
- const val = arg0;
583
- const ret = typeof(val) === 'object' && val !== null;
584
- return ret;
585
- };
586
- imports.wbg.__wbindgen_is_string = function(arg0) {
587
- const ret = typeof(arg0) === 'string';
588
- return ret;
589
- };
590
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
591
- const ret = arg0 === undefined;
592
- return ret;
593
- };
594
- imports.wbg.__wbindgen_json_parse = function(arg0, arg1) {
595
- const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
596
- return ret;
597
- };
598
- imports.wbg.__wbindgen_memory = function() {
599
- const ret = wasm.memory;
600
- return ret;
601
- };
602
- imports.wbg.__wbindgen_number_new = function(arg0) {
603
- const ret = arg0;
604
- return ret;
605
- };
606
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
607
- const obj = arg1;
608
- const ret = typeof(obj) === 'string' ? obj : undefined;
609
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
610
- var len1 = WASM_VECTOR_LEN;
611
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
612
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
613
- };
614
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
615
- const ret = getStringFromWasm0(arg0, arg1);
616
- return ret;
617
- };
618
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
619
- throw new Error(getStringFromWasm0(arg0, arg1));
620
- };
621
-
622
- return imports;
623
- }
624
-
625
- function __wbg_init_memory(imports, memory) {
626
-
627
- }
628
-
629
- function __wbg_finalize_init(instance, module) {
630
- wasm = instance.exports;
631
- __wbg_init.__wbindgen_wasm_module = module;
632
- cachedDataViewMemory0 = null;
633
- cachedUint8ArrayMemory0 = null;
634
-
635
-
636
- wasm.__wbindgen_start();
637
- return wasm;
638
- }
639
-
640
- function initSync(module) {
641
- if (wasm !== undefined) return wasm;
642
-
643
-
644
- if (typeof module !== 'undefined') {
645
- if (Object.getPrototypeOf(module) === Object.prototype) {
646
- ({module} = module)
647
- } else {
648
- console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
649
- }
650
- }
651
-
652
- const imports = __wbg_get_imports();
653
-
654
- __wbg_init_memory(imports);
655
-
656
- if (!(module instanceof WebAssembly.Module)) {
657
- module = new WebAssembly.Module(module);
658
- }
659
-
660
- const instance = new WebAssembly.Instance(module, imports);
661
-
662
- return __wbg_finalize_init(instance, module);
663
- }
664
-
665
- async function __wbg_init(module_or_path) {
666
- if (wasm !== undefined) return wasm;
667
-
668
-
669
- if (typeof module_or_path !== 'undefined') {
670
- if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
671
- ({module_or_path} = module_or_path)
672
- } else {
673
- console.warn('using deprecated parameters for the initialization function; pass a single object instead')
674
- }
675
- }
676
-
677
- if (typeof module_or_path === 'undefined') {
678
- module_or_path = new URL('wasm_module_bg.wasm', import.meta.url);
679
- }
680
- const imports = __wbg_get_imports();
681
-
682
- if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
683
- module_or_path = fetch(module_or_path);
684
- }
685
-
686
- __wbg_init_memory(imports);
687
-
688
- const { instance, module } = await __wbg_load(await module_or_path, imports);
689
-
690
- return __wbg_finalize_init(instance, module);
691
- }
692
-
693
- export { initSync };
694
- export default __wbg_init;
Binary file
@@ -1,19 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- export const memory: WebAssembly.Memory;
4
- export const greet: (a: number, b: number) => [number, number];
5
- export const fetch_wasm_json: (a: number, b: number) => any;
6
- export const fetch_wasm_map: (a: number, b: number) => any;
7
- export const fetch_wasm_html: (a: number, b: number) => any;
8
- export const fetch_wasm_api: () => any;
9
- export const add: (a: number, b: number) => number;
10
- export const __wbindgen_exn_store: (a: number) => void;
11
- export const __externref_table_alloc: () => number;
12
- export const __wbindgen_export_2: WebAssembly.Table;
13
- export const __wbindgen_malloc: (a: number, b: number) => number;
14
- export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
15
- export const __wbindgen_export_5: WebAssembly.Table;
16
- export const __wbindgen_free: (a: number, b: number, c: number) => void;
17
- export const closure89_externref_shim: (a: number, b: number, c: any) => void;
18
- export const closure112_externref_shim: (a: number, b: number, c: any, d: any) => void;
19
- export const __wbindgen_start: () => void;