rust-fetch 0.7.2 → 1.0.0
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/README.md +192 -0
- package/package.json +28 -27
- package/rust_fetch.d.ts +106 -0
- package/{wasm-module/pkg/wasm_module.js → rust_fetch.js} +247 -39
- package/rust_fetch_bg.wasm +0 -0
- package/client.ts +0 -14
- package/rust-fetch-package/Cargo.toml +0 -13
- package/rust-fetch-package/src/lib.rs +0 -14
- package/server.ts +0 -13
- package/tsconfig.json +0 -111
- package/wasm-module/Cargo.lock +0 -1387
- package/wasm-module/Cargo.toml +0 -15
- package/wasm-module/client.d.ts +0 -4
- package/wasm-module/client.js +0 -37
- package/wasm-module/pkg/package.json +0 -15
- package/wasm-module/pkg/wasm_module.d.ts +0 -53
- package/wasm-module/pkg/wasm_module_bg.wasm +0 -0
- package/wasm-module/pkg/wasm_module_bg.wasm.d.ts +0 -20
- package/wasm-module/server.d.ts +0 -4
- package/wasm-module/server.js +0 -80
- package/wasm-module/src/greetings/mod.rs +0 -7
- package/wasm-module/src/http/mod.rs +0 -86
- package/wasm-module/src/lib.rs +0 -10
- package/wasm-module/src/math/mod.rs +0 -7
|
@@ -198,58 +198,91 @@ function debugString(val) {
|
|
|
198
198
|
return className;
|
|
199
199
|
}
|
|
200
200
|
/**
|
|
201
|
-
*
|
|
202
|
-
* @
|
|
201
|
+
* Simple fetch function for JSON data
|
|
202
|
+
* @param {string} url
|
|
203
|
+
* @returns {Promise<any>}
|
|
203
204
|
*/
|
|
204
|
-
export function
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
205
|
+
export function fetch_json(url) {
|
|
206
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
207
|
+
const len0 = WASM_VECTOR_LEN;
|
|
208
|
+
const ret = wasm.fetch_json(ptr0, len0);
|
|
209
|
+
return ret;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Fetch JSON data and return as a Promise
|
|
214
|
+
* @param {string} url
|
|
215
|
+
* @returns {Promise<any>}
|
|
216
|
+
*/
|
|
217
|
+
export function fetch_json_promise(url) {
|
|
218
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
219
|
+
const len0 = WASM_VECTOR_LEN;
|
|
220
|
+
const ret = wasm.fetch_json_promise(ptr0, len0);
|
|
221
|
+
return ret;
|
|
217
222
|
}
|
|
218
223
|
|
|
219
224
|
/**
|
|
225
|
+
* Simple fetch function for text/HTML data
|
|
220
226
|
* @param {string} url
|
|
221
|
-
* @returns {Promise<
|
|
227
|
+
* @returns {Promise<string>}
|
|
222
228
|
*/
|
|
223
|
-
export function
|
|
229
|
+
export function fetch_text(url) {
|
|
224
230
|
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
225
231
|
const len0 = WASM_VECTOR_LEN;
|
|
226
|
-
const ret = wasm.
|
|
232
|
+
const ret = wasm.fetch_text(ptr0, len0);
|
|
227
233
|
return ret;
|
|
228
234
|
}
|
|
229
235
|
|
|
230
236
|
/**
|
|
237
|
+
* Advanced fetch function with full options
|
|
231
238
|
* @param {string} url
|
|
239
|
+
* @param {string} method
|
|
240
|
+
* @param {any} headers
|
|
241
|
+
* @param {string | undefined} [body]
|
|
232
242
|
* @returns {Promise<any>}
|
|
233
243
|
*/
|
|
234
|
-
export function
|
|
244
|
+
export function fetch_with_options(url, method, headers, body) {
|
|
235
245
|
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
236
246
|
const len0 = WASM_VECTOR_LEN;
|
|
237
|
-
const
|
|
247
|
+
const ptr1 = passStringToWasm0(method, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
248
|
+
const len1 = WASM_VECTOR_LEN;
|
|
249
|
+
var ptr2 = isLikeNone(body) ? 0 : passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
250
|
+
var len2 = WASM_VECTOR_LEN;
|
|
251
|
+
const ret = wasm.fetch_with_options(ptr0, len0, ptr1, len1, headers, ptr2, len2);
|
|
238
252
|
return ret;
|
|
239
253
|
}
|
|
240
254
|
|
|
255
|
+
function takeFromExternrefTable0(idx) {
|
|
256
|
+
const value = wasm.__wbindgen_export_4.get(idx);
|
|
257
|
+
wasm.__externref_table_dealloc(idx);
|
|
258
|
+
return value;
|
|
259
|
+
}
|
|
241
260
|
/**
|
|
261
|
+
* Create a configured HTTP client (exported for advanced use)
|
|
262
|
+
* @returns {WasmClient}
|
|
263
|
+
*/
|
|
264
|
+
export function create_client() {
|
|
265
|
+
const ret = wasm.create_client();
|
|
266
|
+
if (ret[2]) {
|
|
267
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
268
|
+
}
|
|
269
|
+
return WasmClient.__wrap(ret[0]);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Fetch JSON data (deprecated, use fetch_json instead)
|
|
242
274
|
* @param {string} url
|
|
243
275
|
* @returns {Promise<any>}
|
|
244
276
|
*/
|
|
245
|
-
export function
|
|
277
|
+
export function fetch_wasm_json(url) {
|
|
246
278
|
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
247
279
|
const len0 = WASM_VECTOR_LEN;
|
|
248
|
-
const ret = wasm.
|
|
280
|
+
const ret = wasm.fetch_wasm_json(ptr0, len0);
|
|
249
281
|
return ret;
|
|
250
282
|
}
|
|
251
283
|
|
|
252
284
|
/**
|
|
285
|
+
* Fetch HTML data (deprecated, use fetch_text instead)
|
|
253
286
|
* @param {string} url
|
|
254
287
|
* @returns {Promise<string>}
|
|
255
288
|
*/
|
|
@@ -261,35 +294,105 @@ export function fetch_wasm_html(url) {
|
|
|
261
294
|
}
|
|
262
295
|
|
|
263
296
|
/**
|
|
297
|
+
* Fetch data and return as map (deprecated, use fetch_json instead)
|
|
298
|
+
* @param {string} url
|
|
264
299
|
* @returns {Promise<any>}
|
|
265
300
|
*/
|
|
266
|
-
export function
|
|
267
|
-
const
|
|
301
|
+
export function fetch_wasm_map(url) {
|
|
302
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
303
|
+
const len0 = WASM_VECTOR_LEN;
|
|
304
|
+
const ret = wasm.fetch_wasm_map(ptr0, len0);
|
|
268
305
|
return ret;
|
|
269
306
|
}
|
|
270
307
|
|
|
271
308
|
/**
|
|
272
|
-
*
|
|
273
|
-
* @param {
|
|
274
|
-
* @returns {
|
|
309
|
+
* Fetch API data (deprecated, use fetch_json instead)
|
|
310
|
+
* @param {string} url
|
|
311
|
+
* @returns {Promise<any>}
|
|
275
312
|
*/
|
|
276
|
-
export function
|
|
277
|
-
const
|
|
313
|
+
export function fetch_wasm_api(url) {
|
|
314
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
315
|
+
const len0 = WASM_VECTOR_LEN;
|
|
316
|
+
const ret = wasm.fetch_wasm_api(ptr0, len0);
|
|
278
317
|
return ret;
|
|
279
318
|
}
|
|
280
319
|
|
|
281
|
-
function
|
|
282
|
-
wasm.
|
|
320
|
+
function __wbg_adapter_52(arg0, arg1, arg2) {
|
|
321
|
+
wasm.closure243_externref_shim(arg0, arg1, arg2);
|
|
283
322
|
}
|
|
284
323
|
|
|
285
|
-
function
|
|
286
|
-
wasm.
|
|
324
|
+
function __wbg_adapter_159(arg0, arg1, arg2, arg3) {
|
|
325
|
+
wasm.closure265_externref_shim(arg0, arg1, arg2, arg3);
|
|
287
326
|
}
|
|
288
327
|
|
|
289
328
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
290
329
|
|
|
291
330
|
const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
|
|
292
331
|
|
|
332
|
+
const WasmClientFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
333
|
+
? { register: () => {}, unregister: () => {} }
|
|
334
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmclient_free(ptr >>> 0, 1));
|
|
335
|
+
/**
|
|
336
|
+
* WASM bindings for the client
|
|
337
|
+
*/
|
|
338
|
+
export class WasmClient {
|
|
339
|
+
|
|
340
|
+
static __wrap(ptr) {
|
|
341
|
+
ptr = ptr >>> 0;
|
|
342
|
+
const obj = Object.create(WasmClient.prototype);
|
|
343
|
+
obj.__wbg_ptr = ptr;
|
|
344
|
+
WasmClientFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
345
|
+
return obj;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
__destroy_into_raw() {
|
|
349
|
+
const ptr = this.__wbg_ptr;
|
|
350
|
+
this.__wbg_ptr = 0;
|
|
351
|
+
WasmClientFinalization.unregister(this);
|
|
352
|
+
return ptr;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
free() {
|
|
356
|
+
const ptr = this.__destroy_into_raw();
|
|
357
|
+
wasm.__wbg_wasmclient_free(ptr, 0);
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Create a new client
|
|
361
|
+
*/
|
|
362
|
+
constructor() {
|
|
363
|
+
const ret = wasm.wasmclient_new();
|
|
364
|
+
if (ret[2]) {
|
|
365
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
366
|
+
}
|
|
367
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
368
|
+
WasmClientFinalization.register(this, this.__wbg_ptr, this);
|
|
369
|
+
return this;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Make a GET request
|
|
373
|
+
* @param {string} url
|
|
374
|
+
* @returns {Promise<any>}
|
|
375
|
+
*/
|
|
376
|
+
get(url) {
|
|
377
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
378
|
+
const len0 = WASM_VECTOR_LEN;
|
|
379
|
+
const ret = wasm.wasmclient_get(this.__wbg_ptr, ptr0, len0);
|
|
380
|
+
return ret;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Make a POST request with JSON body
|
|
384
|
+
* @param {string} url
|
|
385
|
+
* @param {any} body
|
|
386
|
+
* @returns {Promise<any>}
|
|
387
|
+
*/
|
|
388
|
+
post_json(url, body) {
|
|
389
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
390
|
+
const len0 = WASM_VECTOR_LEN;
|
|
391
|
+
const ret = wasm.wasmclient_post_json(this.__wbg_ptr, ptr0, len0, body);
|
|
392
|
+
return ret;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
293
396
|
async function __wbg_load(module, imports) {
|
|
294
397
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
295
398
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
@@ -357,6 +460,10 @@ function __wbg_get_imports() {
|
|
|
357
460
|
const ret = arg0.done;
|
|
358
461
|
return ret;
|
|
359
462
|
};
|
|
463
|
+
imports.wbg.__wbg_entries_4f2bb9b0d701c0f6 = function(arg0) {
|
|
464
|
+
const ret = Object.entries(arg0);
|
|
465
|
+
return ret;
|
|
466
|
+
};
|
|
360
467
|
imports.wbg.__wbg_fetch_229368eecee9d217 = function(arg0, arg1) {
|
|
361
468
|
const ret = arg0.fetch(arg1);
|
|
362
469
|
return ret;
|
|
@@ -365,6 +472,14 @@ function __wbg_get_imports() {
|
|
|
365
472
|
const ret = fetch(arg0);
|
|
366
473
|
return ret;
|
|
367
474
|
};
|
|
475
|
+
imports.wbg.__wbg_from_d68eaa96dba25449 = function(arg0) {
|
|
476
|
+
const ret = Array.from(arg0);
|
|
477
|
+
return ret;
|
|
478
|
+
};
|
|
479
|
+
imports.wbg.__wbg_get_9aa3dff3f0266054 = function(arg0, arg1) {
|
|
480
|
+
const ret = arg0[arg1 >>> 0];
|
|
481
|
+
return ret;
|
|
482
|
+
};
|
|
368
483
|
imports.wbg.__wbg_get_bbccf8970793c087 = function() { return handleError(function (arg0, arg1) {
|
|
369
484
|
const ret = Reflect.get(arg0, arg1);
|
|
370
485
|
return ret;
|
|
@@ -377,6 +492,26 @@ function __wbg_get_imports() {
|
|
|
377
492
|
const ret = arg0.headers;
|
|
378
493
|
return ret;
|
|
379
494
|
};
|
|
495
|
+
imports.wbg.__wbg_instanceof_ArrayBuffer_670ddde44cdb2602 = function(arg0) {
|
|
496
|
+
let result;
|
|
497
|
+
try {
|
|
498
|
+
result = arg0 instanceof ArrayBuffer;
|
|
499
|
+
} catch (_) {
|
|
500
|
+
result = false;
|
|
501
|
+
}
|
|
502
|
+
const ret = result;
|
|
503
|
+
return ret;
|
|
504
|
+
};
|
|
505
|
+
imports.wbg.__wbg_instanceof_Map_98ecb30afec5acdb = function(arg0) {
|
|
506
|
+
let result;
|
|
507
|
+
try {
|
|
508
|
+
result = arg0 instanceof Map;
|
|
509
|
+
} catch (_) {
|
|
510
|
+
result = false;
|
|
511
|
+
}
|
|
512
|
+
const ret = result;
|
|
513
|
+
return ret;
|
|
514
|
+
};
|
|
380
515
|
imports.wbg.__wbg_instanceof_Response_d3453657e10c4300 = function(arg0) {
|
|
381
516
|
let result;
|
|
382
517
|
try {
|
|
@@ -387,6 +522,34 @@ function __wbg_get_imports() {
|
|
|
387
522
|
const ret = result;
|
|
388
523
|
return ret;
|
|
389
524
|
};
|
|
525
|
+
imports.wbg.__wbg_instanceof_Uint8Array_28af5bc19d6acad8 = function(arg0) {
|
|
526
|
+
let result;
|
|
527
|
+
try {
|
|
528
|
+
result = arg0 instanceof Uint8Array;
|
|
529
|
+
} catch (_) {
|
|
530
|
+
result = false;
|
|
531
|
+
}
|
|
532
|
+
const ret = result;
|
|
533
|
+
return ret;
|
|
534
|
+
};
|
|
535
|
+
imports.wbg.__wbg_instanceof_Window_d2514c6a7ee7ba60 = function(arg0) {
|
|
536
|
+
let result;
|
|
537
|
+
try {
|
|
538
|
+
result = arg0 instanceof Window;
|
|
539
|
+
} catch (_) {
|
|
540
|
+
result = false;
|
|
541
|
+
}
|
|
542
|
+
const ret = result;
|
|
543
|
+
return ret;
|
|
544
|
+
};
|
|
545
|
+
imports.wbg.__wbg_isArray_1ba11a930108ec51 = function(arg0) {
|
|
546
|
+
const ret = Array.isArray(arg0);
|
|
547
|
+
return ret;
|
|
548
|
+
};
|
|
549
|
+
imports.wbg.__wbg_isSafeInteger_12f5549b2fca23f4 = function(arg0) {
|
|
550
|
+
const ret = Number.isSafeInteger(arg0);
|
|
551
|
+
return ret;
|
|
552
|
+
};
|
|
390
553
|
imports.wbg.__wbg_iterator_23604bb983791576 = function() {
|
|
391
554
|
const ret = Symbol.iterator;
|
|
392
555
|
return ret;
|
|
@@ -395,6 +558,10 @@ function __wbg_get_imports() {
|
|
|
395
558
|
const ret = arg0.length;
|
|
396
559
|
return ret;
|
|
397
560
|
};
|
|
561
|
+
imports.wbg.__wbg_length_d65cf0786bfc5739 = function(arg0) {
|
|
562
|
+
const ret = arg0.length;
|
|
563
|
+
return ret;
|
|
564
|
+
};
|
|
398
565
|
imports.wbg.__wbg_new_254fa9eac11932ae = function() {
|
|
399
566
|
const ret = new Array();
|
|
400
567
|
return ret;
|
|
@@ -410,7 +577,7 @@ function __wbg_get_imports() {
|
|
|
410
577
|
const a = state0.a;
|
|
411
578
|
state0.a = 0;
|
|
412
579
|
try {
|
|
413
|
-
return
|
|
580
|
+
return __wbg_adapter_159(a, state0.b, arg0, arg1);
|
|
414
581
|
} finally {
|
|
415
582
|
state0.a = a;
|
|
416
583
|
}
|
|
@@ -468,6 +635,10 @@ function __wbg_get_imports() {
|
|
|
468
635
|
const ret = Promise.resolve(arg0);
|
|
469
636
|
return ret;
|
|
470
637
|
};
|
|
638
|
+
imports.wbg.__wbg_setTimeout_8d2afdcdb34b4e5a = function() { return handleError(function (arg0, arg1, arg2) {
|
|
639
|
+
const ret = arg0.setTimeout(arg1, arg2);
|
|
640
|
+
return ret;
|
|
641
|
+
}, arguments) };
|
|
471
642
|
imports.wbg.__wbg_set_1d80752d0d5f0b21 = function(arg0, arg1, arg2) {
|
|
472
643
|
arg0[arg1 >>> 0] = arg2;
|
|
473
644
|
};
|
|
@@ -477,6 +648,10 @@ function __wbg_get_imports() {
|
|
|
477
648
|
imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
478
649
|
arg0[arg1] = arg2;
|
|
479
650
|
};
|
|
651
|
+
imports.wbg.__wbg_set_4e647025551483bd = function() { return handleError(function (arg0, arg1, arg2) {
|
|
652
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
653
|
+
return ret;
|
|
654
|
+
}, arguments) };
|
|
480
655
|
imports.wbg.__wbg_set_76818dc3c59a63d5 = function(arg0, arg1, arg2) {
|
|
481
656
|
const ret = arg0.set(arg1, arg2);
|
|
482
657
|
return ret;
|
|
@@ -558,6 +733,17 @@ function __wbg_get_imports() {
|
|
|
558
733
|
const ret = BigInt.asUintN(64, arg0);
|
|
559
734
|
return ret;
|
|
560
735
|
};
|
|
736
|
+
imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
|
|
737
|
+
const v = arg1;
|
|
738
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
739
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
740
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
741
|
+
};
|
|
742
|
+
imports.wbg.__wbindgen_boolean_get = function(arg0) {
|
|
743
|
+
const v = arg0;
|
|
744
|
+
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
|
|
745
|
+
return ret;
|
|
746
|
+
};
|
|
561
747
|
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
562
748
|
const obj = arg0.original;
|
|
563
749
|
if (obj.cnt-- == 1) {
|
|
@@ -567,8 +753,8 @@ function __wbg_get_imports() {
|
|
|
567
753
|
const ret = false;
|
|
568
754
|
return ret;
|
|
569
755
|
};
|
|
570
|
-
imports.wbg.
|
|
571
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
756
|
+
imports.wbg.__wbindgen_closure_wrapper1685 = function(arg0, arg1, arg2) {
|
|
757
|
+
const ret = makeMutClosure(arg0, arg1, 244, __wbg_adapter_52);
|
|
572
758
|
return ret;
|
|
573
759
|
};
|
|
574
760
|
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
|
@@ -582,6 +768,10 @@ function __wbg_get_imports() {
|
|
|
582
768
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
583
769
|
return ret;
|
|
584
770
|
};
|
|
771
|
+
imports.wbg.__wbindgen_in = function(arg0, arg1) {
|
|
772
|
+
const ret = arg0 in arg1;
|
|
773
|
+
return ret;
|
|
774
|
+
};
|
|
585
775
|
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
586
776
|
const table = wasm.__wbindgen_export_4;
|
|
587
777
|
const offset = table.grow(4);
|
|
@@ -592,10 +782,18 @@ function __wbg_get_imports() {
|
|
|
592
782
|
table.set(offset + 3, false);
|
|
593
783
|
;
|
|
594
784
|
};
|
|
785
|
+
imports.wbg.__wbindgen_is_bigint = function(arg0) {
|
|
786
|
+
const ret = typeof(arg0) === 'bigint';
|
|
787
|
+
return ret;
|
|
788
|
+
};
|
|
595
789
|
imports.wbg.__wbindgen_is_function = function(arg0) {
|
|
596
790
|
const ret = typeof(arg0) === 'function';
|
|
597
791
|
return ret;
|
|
598
792
|
};
|
|
793
|
+
imports.wbg.__wbindgen_is_null = function(arg0) {
|
|
794
|
+
const ret = arg0 === null;
|
|
795
|
+
return ret;
|
|
796
|
+
};
|
|
599
797
|
imports.wbg.__wbindgen_is_object = function(arg0) {
|
|
600
798
|
const val = arg0;
|
|
601
799
|
const ret = typeof(val) === 'object' && val !== null;
|
|
@@ -609,14 +807,24 @@ function __wbg_get_imports() {
|
|
|
609
807
|
const ret = arg0 === undefined;
|
|
610
808
|
return ret;
|
|
611
809
|
};
|
|
612
|
-
imports.wbg.
|
|
613
|
-
const ret =
|
|
810
|
+
imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
|
|
811
|
+
const ret = arg0 === arg1;
|
|
812
|
+
return ret;
|
|
813
|
+
};
|
|
814
|
+
imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
|
|
815
|
+
const ret = arg0 == arg1;
|
|
614
816
|
return ret;
|
|
615
817
|
};
|
|
616
818
|
imports.wbg.__wbindgen_memory = function() {
|
|
617
819
|
const ret = wasm.memory;
|
|
618
820
|
return ret;
|
|
619
821
|
};
|
|
822
|
+
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
823
|
+
const obj = arg1;
|
|
824
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
825
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
826
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
827
|
+
};
|
|
620
828
|
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
621
829
|
const ret = arg0;
|
|
622
830
|
return ret;
|
|
@@ -693,7 +901,7 @@ async function __wbg_init(module_or_path) {
|
|
|
693
901
|
}
|
|
694
902
|
|
|
695
903
|
if (typeof module_or_path === 'undefined') {
|
|
696
|
-
module_or_path = new URL('
|
|
904
|
+
module_or_path = new URL('rust_fetch_bg.wasm', import.meta.url);
|
|
697
905
|
}
|
|
698
906
|
const imports = __wbg_get_imports();
|
|
699
907
|
|
|
Binary file
|
package/client.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import initWasm from 'wasm-module';
|
|
2
|
-
|
|
3
|
-
const wasmPromise = initWasm();
|
|
4
|
-
|
|
5
|
-
export const initializeWasm = async () => {
|
|
6
|
-
await wasmPromise;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
(async () => {
|
|
10
|
-
initializeWasm();
|
|
11
|
-
})();
|
|
12
|
-
|
|
13
|
-
export default initWasm;
|
|
14
|
-
export * from 'wasm-module';
|
package/server.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as path from 'path';
|
|
2
|
-
import { readFileSync } from 'fs';
|
|
3
|
-
|
|
4
|
-
import initWasm from 'wasm-module';
|
|
5
|
-
const wasmPath = path.join(process.cwd(), 'node_modules', 'rust-fetch', 'wasm-module', 'pkg', 'wasm_module_bg.wasm');
|
|
6
|
-
export const wasmBuffer = readFileSync(wasmPath);
|
|
7
|
-
|
|
8
|
-
(async () => {
|
|
9
|
-
await initWasm(wasmBuffer);
|
|
10
|
-
})();
|
|
11
|
-
|
|
12
|
-
export default initWasm;
|
|
13
|
-
export * from 'wasm-module';
|
package/tsconfig.json
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
-
|
|
5
|
-
/* Projects */
|
|
6
|
-
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
-
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
-
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
-
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
-
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
-
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
-
|
|
13
|
-
/* Language and Environment */
|
|
14
|
-
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
-
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
-
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
-
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
18
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
20
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
22
|
-
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
23
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
-
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
|
-
|
|
27
|
-
/* Modules */
|
|
28
|
-
"module": "NodeNext", /* Specify what module code is generated. */
|
|
29
|
-
"rootDir": "./", /* Specify the root folder within your source files. */
|
|
30
|
-
"moduleResolution": "NodeNext", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
31
|
-
"baseUrl": ".", /* Specify the base directory to resolve non-relative module names. */
|
|
32
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
|
-
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
-
"types": ["node"], /* Specify type package names to be included without being referenced in a source file. */
|
|
36
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
37
|
-
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
|
-
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
39
|
-
// "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */
|
|
40
|
-
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
41
|
-
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
42
|
-
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
43
|
-
// "noUncheckedSideEffectImports": true, /* Check side effect imports. */
|
|
44
|
-
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
45
|
-
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
46
|
-
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
47
|
-
|
|
48
|
-
/* JavaScript Support */
|
|
49
|
-
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
50
|
-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
51
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
52
|
-
|
|
53
|
-
/* Emit */
|
|
54
|
-
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
55
|
-
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
56
|
-
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
57
|
-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
58
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
59
|
-
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
60
|
-
// "outFile": "./dist", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
61
|
-
"outDir": "wasm-module", /* Specify an output folder for all emitted files. */
|
|
62
|
-
// "removeComments": true, /* Disable emitting comments. */
|
|
63
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
64
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
65
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
66
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
67
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
68
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
69
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
70
|
-
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
71
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
72
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
73
|
-
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
74
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
75
|
-
|
|
76
|
-
/* Interop Constraints */
|
|
77
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
78
|
-
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
79
|
-
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
|
|
80
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
81
|
-
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
82
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
83
|
-
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
84
|
-
|
|
85
|
-
/* Type Checking */
|
|
86
|
-
"strict": true, /* Enable all strict type-checking options. */
|
|
87
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
88
|
-
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
89
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
90
|
-
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
91
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
92
|
-
// "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
|
|
93
|
-
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
94
|
-
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
95
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
96
|
-
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
97
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
98
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
99
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
100
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
101
|
-
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
102
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
103
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
104
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
105
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
106
|
-
|
|
107
|
-
/* Completeness */
|
|
108
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
109
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
110
|
-
}
|
|
111
|
-
}
|