@1kbgz/transports 0.3.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.
@@ -0,0 +1,501 @@
1
+ /* @ts-self-types="./transports.d.ts" */
2
+
3
+ /**
4
+ * In-process model store: host / mutate → patch / apply / snapshot.
5
+ */
6
+ export class Store {
7
+ __destroy_into_raw() {
8
+ const ptr = this.__wbg_ptr;
9
+ this.__wbg_ptr = 0;
10
+ StoreFinalization.unregister(this);
11
+ return ptr;
12
+ }
13
+ free() {
14
+ const ptr = this.__destroy_into_raw();
15
+ wasm.__wbg_store_free(ptr, 0);
16
+ }
17
+ /**
18
+ * Apply a JSON patch to a mirrored model; returns whether the id was known.
19
+ * @param {bigint} id
20
+ * @param {string} patch_json
21
+ * @returns {boolean}
22
+ */
23
+ apply(id, patch_json) {
24
+ const ptr0 = passStringToWasm0(patch_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
25
+ const len0 = WASM_VECTOR_LEN;
26
+ const ret = wasm.store_apply(this.__wbg_ptr, id, ptr0, len0);
27
+ if (ret[2]) {
28
+ throw takeFromExternrefTable0(ret[1]);
29
+ }
30
+ return ret[0] !== 0;
31
+ }
32
+ /**
33
+ * Host a model from its JSON; returns the assigned id.
34
+ * @param {string} type_name
35
+ * @param {string} value_json
36
+ * @returns {bigint}
37
+ */
38
+ host(type_name, value_json) {
39
+ const ptr0 = passStringToWasm0(type_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
40
+ const len0 = WASM_VECTOR_LEN;
41
+ const ptr1 = passStringToWasm0(value_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
42
+ const len1 = WASM_VECTOR_LEN;
43
+ const ret = wasm.store_host(this.__wbg_ptr, ptr0, len0, ptr1, len1);
44
+ if (ret[2]) {
45
+ throw takeFromExternrefTable0(ret[1]);
46
+ }
47
+ return BigInt.asUintN(64, ret[0]);
48
+ }
49
+ /**
50
+ * Replace a hosted model from JSON; returns the JSON patch (or `undefined` if id unknown).
51
+ * @param {bigint} id
52
+ * @param {string} value_json
53
+ * @returns {string | undefined}
54
+ */
55
+ mutate(id, value_json) {
56
+ const ptr0 = passStringToWasm0(value_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
57
+ const len0 = WASM_VECTOR_LEN;
58
+ const ret = wasm.store_mutate(this.__wbg_ptr, id, ptr0, len0);
59
+ if (ret[3]) {
60
+ throw takeFromExternrefTable0(ret[2]);
61
+ }
62
+ let v2;
63
+ if (ret[0] !== 0) {
64
+ v2 = getStringFromWasm0(ret[0], ret[1]).slice();
65
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
66
+ }
67
+ return v2;
68
+ }
69
+ constructor() {
70
+ const ret = wasm.store_new();
71
+ this.__wbg_ptr = ret;
72
+ StoreFinalization.register(this, this.__wbg_ptr, this);
73
+ return this;
74
+ }
75
+ /**
76
+ * `{"type_name":..,"rev":..,"value":..}` for a hosted model, or `undefined`.
77
+ * @param {bigint} id
78
+ * @returns {string | undefined}
79
+ */
80
+ snapshot(id) {
81
+ const ret = wasm.store_snapshot(this.__wbg_ptr, id);
82
+ let v1;
83
+ if (ret[0] !== 0) {
84
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
85
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
86
+ }
87
+ return v1;
88
+ }
89
+ }
90
+ if (Symbol.dispose) Store.prototype[Symbol.dispose] = Store.prototype.free;
91
+
92
+ /**
93
+ * Apply a JSON-encoded patch to a JSON-encoded model, returning the JSON-encoded result.
94
+ * @param {string} value
95
+ * @param {string} patch
96
+ * @returns {string}
97
+ */
98
+ export function apply(value, patch) {
99
+ let deferred4_0;
100
+ let deferred4_1;
101
+ try {
102
+ const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
103
+ const len0 = WASM_VECTOR_LEN;
104
+ const ptr1 = passStringToWasm0(patch, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
105
+ const len1 = WASM_VECTOR_LEN;
106
+ const ret = wasm.apply(ptr0, len0, ptr1, len1);
107
+ var ptr3 = ret[0];
108
+ var len3 = ret[1];
109
+ if (ret[3]) {
110
+ ptr3 = 0; len3 = 0;
111
+ throw takeFromExternrefTable0(ret[2]);
112
+ }
113
+ deferred4_0 = ptr3;
114
+ deferred4_1 = len3;
115
+ return getStringFromWasm0(ptr3, len3);
116
+ } finally {
117
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
118
+ }
119
+ }
120
+
121
+ /**
122
+ * Decode codec bytes back to a JSON-encoded model string.
123
+ * @param {Uint8Array} data
124
+ * @returns {string}
125
+ */
126
+ export function decode(data) {
127
+ let deferred3_0;
128
+ let deferred3_1;
129
+ try {
130
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
131
+ const len0 = WASM_VECTOR_LEN;
132
+ const ret = wasm.decode(ptr0, len0);
133
+ var ptr2 = ret[0];
134
+ var len2 = ret[1];
135
+ if (ret[3]) {
136
+ ptr2 = 0; len2 = 0;
137
+ throw takeFromExternrefTable0(ret[2]);
138
+ }
139
+ deferred3_0 = ptr2;
140
+ deferred3_1 = len2;
141
+ return getStringFromWasm0(ptr2, len2);
142
+ } finally {
143
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
144
+ }
145
+ }
146
+
147
+ /**
148
+ * Decode bytes (produced by `codec`'s codec) back to a JSON-encoded model string.
149
+ * @param {Uint8Array} data
150
+ * @param {string} codec
151
+ * @returns {string}
152
+ */
153
+ export function decode_as(data, codec) {
154
+ let deferred4_0;
155
+ let deferred4_1;
156
+ try {
157
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
158
+ const len0 = WASM_VECTOR_LEN;
159
+ const ptr1 = passStringToWasm0(codec, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160
+ const len1 = WASM_VECTOR_LEN;
161
+ const ret = wasm.decode_as(ptr0, len0, ptr1, len1);
162
+ var ptr3 = ret[0];
163
+ var len3 = ret[1];
164
+ if (ret[3]) {
165
+ ptr3 = 0; len3 = 0;
166
+ throw takeFromExternrefTable0(ret[2]);
167
+ }
168
+ deferred4_0 = ptr3;
169
+ deferred4_1 = len3;
170
+ return getStringFromWasm0(ptr3, len3);
171
+ } finally {
172
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
173
+ }
174
+ }
175
+
176
+ /**
177
+ * Diff two JSON-encoded models, returning the JSON-encoded patch.
178
+ * @param {string} old
179
+ * @param {string} _new
180
+ * @returns {string}
181
+ */
182
+ export function diff(old, _new) {
183
+ let deferred4_0;
184
+ let deferred4_1;
185
+ try {
186
+ const ptr0 = passStringToWasm0(old, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
187
+ const len0 = WASM_VECTOR_LEN;
188
+ const ptr1 = passStringToWasm0(_new, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
189
+ const len1 = WASM_VECTOR_LEN;
190
+ const ret = wasm.diff(ptr0, len0, ptr1, len1);
191
+ var ptr3 = ret[0];
192
+ var len3 = ret[1];
193
+ if (ret[3]) {
194
+ ptr3 = 0; len3 = 0;
195
+ throw takeFromExternrefTable0(ret[2]);
196
+ }
197
+ deferred4_0 = ptr3;
198
+ deferred4_1 = len3;
199
+ return getStringFromWasm0(ptr3, len3);
200
+ } finally {
201
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
202
+ }
203
+ }
204
+
205
+ /**
206
+ * Encode a JSON-encoded model to codec bytes (a `Uint8Array` in JS).
207
+ * @param {string} value
208
+ * @returns {Uint8Array}
209
+ */
210
+ export function encode(value) {
211
+ const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
212
+ const len0 = WASM_VECTOR_LEN;
213
+ const ret = wasm.encode(ptr0, len0);
214
+ if (ret[3]) {
215
+ throw takeFromExternrefTable0(ret[2]);
216
+ }
217
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
218
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
219
+ return v2;
220
+ }
221
+
222
+ /**
223
+ * Encode a JSON-encoded model with the codec named by `codec` (e.g. `"application/msgpack"`).
224
+ * @param {string} value
225
+ * @param {string} codec
226
+ * @returns {Uint8Array}
227
+ */
228
+ export function encode_as(value, codec) {
229
+ const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
230
+ const len0 = WASM_VECTOR_LEN;
231
+ const ptr1 = passStringToWasm0(codec, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
232
+ const len1 = WASM_VECTOR_LEN;
233
+ const ret = wasm.encode_as(ptr0, len0, ptr1, len1);
234
+ if (ret[3]) {
235
+ throw takeFromExternrefTable0(ret[2]);
236
+ }
237
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
238
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
239
+ return v3;
240
+ }
241
+
242
+ /**
243
+ * Convert an arbitrary JSON document to MessagePack bytes (a `Uint8Array` in JS).
244
+ * @param {string} json
245
+ * @returns {Uint8Array}
246
+ */
247
+ export function json_to_msgpack(json) {
248
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
249
+ const len0 = WASM_VECTOR_LEN;
250
+ const ret = wasm.json_to_msgpack(ptr0, len0);
251
+ if (ret[3]) {
252
+ throw takeFromExternrefTable0(ret[2]);
253
+ }
254
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
255
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
256
+ return v2;
257
+ }
258
+
259
+ /**
260
+ * Convert MessagePack bytes back to a JSON document.
261
+ * @param {Uint8Array} data
262
+ * @returns {string}
263
+ */
264
+ export function msgpack_to_json(data) {
265
+ let deferred3_0;
266
+ let deferred3_1;
267
+ try {
268
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
269
+ const len0 = WASM_VECTOR_LEN;
270
+ const ret = wasm.msgpack_to_json(ptr0, len0);
271
+ var ptr2 = ret[0];
272
+ var len2 = ret[1];
273
+ if (ret[3]) {
274
+ ptr2 = 0; len2 = 0;
275
+ throw takeFromExternrefTable0(ret[2]);
276
+ }
277
+ deferred3_0 = ptr2;
278
+ deferred3_1 = len2;
279
+ return getStringFromWasm0(ptr2, len2);
280
+ } finally {
281
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
282
+ }
283
+ }
284
+ function __wbg_get_imports() {
285
+ const import0 = {
286
+ __proto__: null,
287
+ __wbg_Error_bce6d499ff0a4aff: function(arg0, arg1) {
288
+ const ret = Error(getStringFromWasm0(arg0, arg1));
289
+ return ret;
290
+ },
291
+ __wbg___wbindgen_throw_9c31b086c2b26051: function(arg0, arg1) {
292
+ throw new Error(getStringFromWasm0(arg0, arg1));
293
+ },
294
+ __wbindgen_init_externref_table: function() {
295
+ const table = wasm.__wbindgen_externrefs;
296
+ const offset = table.grow(4);
297
+ table.set(0, undefined);
298
+ table.set(offset + 0, undefined);
299
+ table.set(offset + 1, null);
300
+ table.set(offset + 2, true);
301
+ table.set(offset + 3, false);
302
+ },
303
+ };
304
+ return {
305
+ __proto__: null,
306
+ "./transports_bg.js": import0,
307
+ };
308
+ }
309
+
310
+ const StoreFinalization = (typeof FinalizationRegistry === 'undefined')
311
+ ? { register: () => {}, unregister: () => {} }
312
+ : new FinalizationRegistry(ptr => wasm.__wbg_store_free(ptr, 1));
313
+
314
+ function getArrayU8FromWasm0(ptr, len) {
315
+ ptr = ptr >>> 0;
316
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
317
+ }
318
+
319
+ function getStringFromWasm0(ptr, len) {
320
+ return decodeText(ptr >>> 0, len);
321
+ }
322
+
323
+ let cachedUint8ArrayMemory0 = null;
324
+ function getUint8ArrayMemory0() {
325
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
326
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
327
+ }
328
+ return cachedUint8ArrayMemory0;
329
+ }
330
+
331
+ function passArray8ToWasm0(arg, malloc) {
332
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
333
+ getUint8ArrayMemory0().set(arg, ptr / 1);
334
+ WASM_VECTOR_LEN = arg.length;
335
+ return ptr;
336
+ }
337
+
338
+ function passStringToWasm0(arg, malloc, realloc) {
339
+ if (realloc === undefined) {
340
+ const buf = cachedTextEncoder.encode(arg);
341
+ const ptr = malloc(buf.length, 1) >>> 0;
342
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
343
+ WASM_VECTOR_LEN = buf.length;
344
+ return ptr;
345
+ }
346
+
347
+ let len = arg.length;
348
+ let ptr = malloc(len, 1) >>> 0;
349
+
350
+ const mem = getUint8ArrayMemory0();
351
+
352
+ let offset = 0;
353
+
354
+ for (; offset < len; offset++) {
355
+ const code = arg.charCodeAt(offset);
356
+ if (code > 0x7F) break;
357
+ mem[ptr + offset] = code;
358
+ }
359
+ if (offset !== len) {
360
+ if (offset !== 0) {
361
+ arg = arg.slice(offset);
362
+ }
363
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
364
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
365
+ const ret = cachedTextEncoder.encodeInto(arg, view);
366
+
367
+ offset += ret.written;
368
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
369
+ }
370
+
371
+ WASM_VECTOR_LEN = offset;
372
+ return ptr;
373
+ }
374
+
375
+ function takeFromExternrefTable0(idx) {
376
+ const value = wasm.__wbindgen_externrefs.get(idx);
377
+ wasm.__externref_table_dealloc(idx);
378
+ return value;
379
+ }
380
+
381
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
382
+ cachedTextDecoder.decode();
383
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
384
+ let numBytesDecoded = 0;
385
+ function decodeText(ptr, len) {
386
+ numBytesDecoded += len;
387
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
388
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
389
+ cachedTextDecoder.decode();
390
+ numBytesDecoded = len;
391
+ }
392
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
393
+ }
394
+
395
+ const cachedTextEncoder = new TextEncoder();
396
+
397
+ if (!('encodeInto' in cachedTextEncoder)) {
398
+ cachedTextEncoder.encodeInto = function (arg, view) {
399
+ const buf = cachedTextEncoder.encode(arg);
400
+ view.set(buf);
401
+ return {
402
+ read: arg.length,
403
+ written: buf.length
404
+ };
405
+ };
406
+ }
407
+
408
+ let WASM_VECTOR_LEN = 0;
409
+
410
+ let wasmModule, wasmInstance, wasm;
411
+ function __wbg_finalize_init(instance, module) {
412
+ wasmInstance = instance;
413
+ wasm = instance.exports;
414
+ wasmModule = module;
415
+ cachedUint8ArrayMemory0 = null;
416
+ wasm.__wbindgen_start();
417
+ return wasm;
418
+ }
419
+
420
+ async function __wbg_load(module, imports) {
421
+ if (typeof Response === 'function' && module instanceof Response) {
422
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
423
+ try {
424
+ return await WebAssembly.instantiateStreaming(module, imports);
425
+ } catch (e) {
426
+ const validResponse = module.ok && expectedResponseType(module.type);
427
+
428
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
429
+ 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);
430
+
431
+ } else { throw e; }
432
+ }
433
+ }
434
+
435
+ const bytes = await module.arrayBuffer();
436
+ return await WebAssembly.instantiate(bytes, imports);
437
+ } else {
438
+ const instance = await WebAssembly.instantiate(module, imports);
439
+
440
+ if (instance instanceof WebAssembly.Instance) {
441
+ return { instance, module };
442
+ } else {
443
+ return instance;
444
+ }
445
+ }
446
+
447
+ function expectedResponseType(type) {
448
+ switch (type) {
449
+ case 'basic': case 'cors': case 'default': return true;
450
+ }
451
+ return false;
452
+ }
453
+ }
454
+
455
+ function initSync(module) {
456
+ if (wasm !== undefined) return wasm;
457
+
458
+
459
+ if (module !== undefined) {
460
+ if (Object.getPrototypeOf(module) === Object.prototype) {
461
+ ({module} = module)
462
+ } else {
463
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
464
+ }
465
+ }
466
+
467
+ const imports = __wbg_get_imports();
468
+ if (!(module instanceof WebAssembly.Module)) {
469
+ module = new WebAssembly.Module(module);
470
+ }
471
+ const instance = new WebAssembly.Instance(module, imports);
472
+ return __wbg_finalize_init(instance, module);
473
+ }
474
+
475
+ async function __wbg_init(module_or_path) {
476
+ if (wasm !== undefined) return wasm;
477
+
478
+
479
+ if (module_or_path !== undefined) {
480
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
481
+ ({module_or_path} = module_or_path)
482
+ } else {
483
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
484
+ }
485
+ }
486
+
487
+ if (module_or_path === undefined) {
488
+ module_or_path = new URL('transports_bg.wasm', import.meta.url);
489
+ }
490
+ const imports = __wbg_get_imports();
491
+
492
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
493
+ module_or_path = fetch(module_or_path);
494
+ }
495
+
496
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
497
+
498
+ return __wbg_finalize_init(instance, module);
499
+ }
500
+
501
+ export { initSync, __wbg_init as default };
Binary file
@@ -0,0 +1,23 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const diff: (a: number, b: number, c: number, d: number) => [number, number, number, number];
5
+ export const apply: (a: number, b: number, c: number, d: number) => [number, number, number, number];
6
+ export const encode: (a: number, b: number) => [number, number, number, number];
7
+ export const decode: (a: number, b: number) => [number, number, number, number];
8
+ export const encode_as: (a: number, b: number, c: number, d: number) => [number, number, number, number];
9
+ export const decode_as: (a: number, b: number, c: number, d: number) => [number, number, number, number];
10
+ export const json_to_msgpack: (a: number, b: number) => [number, number, number, number];
11
+ export const msgpack_to_json: (a: number, b: number) => [number, number, number, number];
12
+ export const __wbg_store_free: (a: number, b: number) => void;
13
+ export const store_new: () => number;
14
+ export const store_host: (a: number, b: number, c: number, d: number, e: number) => [bigint, number, number];
15
+ export const store_snapshot: (a: number, b: bigint) => [number, number];
16
+ export const store_mutate: (a: number, b: bigint, c: number, d: number) => [number, number, number, number];
17
+ export const store_apply: (a: number, b: bigint, c: number, d: number) => [number, number, number];
18
+ export const __wbindgen_externrefs: WebAssembly.Table;
19
+ export const __wbindgen_malloc: (a: number, b: number) => number;
20
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
21
+ export const __externref_table_dealloc: (a: number) => void;
22
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
23
+ export const __wbindgen_start: () => void;
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@1kbgz/transports",
3
+ "version": "0.3.0",
4
+ "description": "Generic communication library",
5
+ "repository": "git@github.com:1kbgz/transports.git",
6
+ "author": "1kbgz <dev@1kbgz.com>",
7
+ "license": "Apache-2.0",
8
+ "type": "module",
9
+ "unpkg": "dist/cdn/index.js",
10
+ "jsdelivr": "dist/cdn/index.js",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/esm/index.d.ts",
14
+ "default": "./dist/esm/index.js"
15
+ },
16
+ "./dist/*": "./dist/*",
17
+ "./package.json": "./package.json"
18
+ },
19
+ "files": [
20
+ "dist/**/*",
21
+ "index.d.ts"
22
+ ],
23
+ "types": "./dist/esm/index.d.ts",
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "devDependencies": {
28
+ "@playwright/test": "^1.60.0",
29
+ "cpy": "^13.2.2",
30
+ "esbuild": "^0.28.0",
31
+ "lightningcss": "^1.29.3",
32
+ "http-server": "^14.1.1",
33
+ "nodemon": "^3.1.14",
34
+ "npm-run-all": "^4.1.5",
35
+ "prettier": "^3.8.3",
36
+ "typescript": "^6.0.3"
37
+ },
38
+ "scripts": {
39
+ "setup": "cargo install -f wasm-bindgen-cli --version 0.2.121 --locked",
40
+ "build:debug": "node build.mjs --debug",
41
+ "build:rust": "cargo build --release --all-features --target wasm32-unknown-unknown",
42
+ "build:wasm-bindgen": "wasm-bindgen ../target/wasm32-unknown-unknown/release/transports.wasm --out-dir ./dist/pkg --target web",
43
+ "build:prod": "node build.mjs",
44
+ "build": "npm-run-all build:rust build:wasm-bindgen build:prod",
45
+ "clean": "rm -rf dist lib playwright-report ../transports/extension",
46
+ "dev": "npm-run-all -p start watch",
47
+ "lint:js": "prettier --check \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"",
48
+ "lint:rust": "cargo clippy --all-features && cargo fmt --all -- --check",
49
+ "lint": "npm-run-all lint:*",
50
+ "fix:js": "prettier --write \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"",
51
+ "fix:rust": "cargo fmt --all",
52
+ "fix": "npm-run-all fix:*",
53
+ "preinstall": "npx only-allow pnpm",
54
+ "start": "http-server -p 3000 -o examples/",
55
+ "start:tests": "http-server -p 3000 ",
56
+ "test:js": "playwright test",
57
+ "test:rust": "cargo test -- --show-output",
58
+ "test": "npm-run-all test:rust test:js",
59
+ "watch": "nodemon --watch src -e ts,css,html --exec \"pnpm build:debug\""
60
+ }
61
+ }