@peerbit/riblt 1.1.0 → 1.2.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/dist/index.d.ts CHANGED
@@ -1,72 +1,5 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- export class DecoderWrapper {
4
- free(): void;
5
- add_symbol(symbol: bigint): void;
6
- try_decode(): void;
7
- add_coded_symbol(coded_symbol_js: any): void;
8
- get_local_symbols(): Array<any>;
9
- get_remote_symbols(): Array<any>;
10
- constructor();
11
- reset(): void;
12
- decoded(): boolean;
13
- }
14
- export class EncoderWrapper {
15
- free(): void;
16
- add_symbol(symbol: bigint): void;
17
- to_decoder(): DecoderWrapper;
18
- produce_next_coded_symbol(): any;
19
- constructor();
20
- clone(): EncoderWrapper;
21
- reset(): void;
22
- }
1
+ import type { InitOutput } from "./rateless_iblt.js";
23
2
 
24
- export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
3
+ export { DecoderWrapper, EncoderWrapper, initSync } from "./rateless_iblt.js";
25
4
 
26
- export interface InitOutput {
27
- readonly memory: WebAssembly.Memory;
28
- readonly __wbg_decoderwrapper_free: (a: number, b: number) => void;
29
- readonly __wbg_encoderwrapper_free: (a: number, b: number) => void;
30
- readonly decoderwrapper_add_coded_symbol: (a: number, b: any) => void;
31
- readonly decoderwrapper_add_symbol: (a: number, b: bigint) => void;
32
- readonly decoderwrapper_decoded: (a: number) => number;
33
- readonly decoderwrapper_get_local_symbols: (a: number) => any;
34
- readonly decoderwrapper_get_remote_symbols: (a: number) => any;
35
- readonly decoderwrapper_new: () => number;
36
- readonly decoderwrapper_reset: (a: number) => void;
37
- readonly decoderwrapper_try_decode: (a: number) => [number, number];
38
- readonly encoderwrapper_add_symbol: (a: number, b: bigint) => void;
39
- readonly encoderwrapper_clone: (a: number) => number;
40
- readonly encoderwrapper_new: () => number;
41
- readonly encoderwrapper_produce_next_coded_symbol: (a: number) => any;
42
- readonly encoderwrapper_reset: (a: number) => void;
43
- readonly encoderwrapper_to_decoder: (a: number) => number;
44
- readonly __wbindgen_exn_store: (a: number) => void;
45
- readonly __externref_table_alloc: () => number;
46
- readonly __wbindgen_export_2: WebAssembly.Table;
47
- readonly __wbindgen_malloc: (a: number, b: number) => number;
48
- readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
49
- readonly __externref_table_dealloc: (a: number) => void;
50
- readonly __wbindgen_start: () => void;
51
- }
52
-
53
- export type SyncInitInput = BufferSource | WebAssembly.Module;
54
- /**
55
- * Instantiates the given `module`, which can either be bytes or
56
- * a precompiled `WebAssembly.Module`.
57
- *
58
- * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
59
- *
60
- * @returns {InitOutput}
61
- */
62
- export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
63
-
64
- /**
65
- * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
66
- * for everything else, calls `WebAssembly.instantiate` directly.
67
- *
68
- * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
69
- *
70
- * @returns {Promise<InitOutput>}
71
- */
72
- export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
5
+ export declare const ready: Promise<InitOutput>;
package/dist/index.js CHANGED
@@ -1,3 +1,2 @@
1
- import "./wasm-init.js";
2
-
1
+ export { ready } from "./wasm-init.js";
3
2
  export { DecoderWrapper, EncoderWrapper, initSync } from "./rateless_iblt.js";
Binary file
@@ -1,4 +1,6 @@
1
1
  // nothing to do since 'fetch' works as expected in the browser
2
2
  import init from "./rateless_iblt.js";
3
3
 
4
- await init(new URL("/peerbit/riblt/rateless_iblt_bg.wasm", import.meta.url));
4
+ export const ready = init(
5
+ new URL("/peerbit/riblt/rateless_iblt_bg.wasm", import.meta.url),
6
+ );
package/dist/wasm-init.js CHANGED
@@ -14,4 +14,4 @@ globalThis.fetch = async (url, options) => {
14
14
  return defaultFetch(url, options);
15
15
  };
16
16
 
17
- await init();
17
+ export const ready = init();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peerbit/riblt",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Riblt",
5
5
  "sideEffects": [
6
6
  "./dist/wasm-init.js",
@@ -59,7 +59,7 @@
59
59
  "benchmark": "cargo bench",
60
60
  "clean": "cargo clear",
61
61
  "cp-src-js": "shx cp -r ./src_js/* ./dist",
62
- "build": "wasm-pack build --target web --out-dir dist --out-name rateless_iblt && shx rm -rf ./dist/.gitignore && shx rm -rf ./dist/package.json && npm run cp-src-js && shx cp ./dist/rateless_iblt.d.ts ./dist/index.d.ts && shx mkdir -p ./dist/assets/riblt && shx cp ./dist/rateless_iblt_bg.wasm ./dist/assets/riblt/",
62
+ "build": "wasm-pack build --target web --out-dir dist --out-name rateless_iblt && shx rm -rf ./dist/.gitignore && shx rm -rf ./dist/package.json && npm run cp-src-js && shx mkdir -p ./dist/assets/riblt && shx cp ./dist/rateless_iblt_bg.wasm ./dist/assets/riblt/",
63
63
  "test": "cargo test && aegir test",
64
64
  "lint": "cargo fmt"
65
65
  }