@rivetkit/rivetkit-wasm 0.0.0-pr.4860.b5fe23b → 0.0.0-pr.4880.34d3f72
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/index.d.ts +2 -83
- package/package.json +15 -5
- package/pkg/rivetkit_wasm.d.ts +9 -7
- package/pkg/rivetkit_wasm.js +52 -37
- package/pkg/rivetkit_wasm_bg.wasm +0 -0
- package/pkg/rivetkit_wasm_bg.wasm.d.ts +6 -5
- package/scripts/build.mjs +20 -3
- package/scripts/check-package.mjs +32 -0
- package/pkg/package.json +0 -19
package/index.d.ts
CHANGED
|
@@ -1,83 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
endpoint: string;
|
|
4
|
-
token?: string;
|
|
5
|
-
namespace: string;
|
|
6
|
-
poolName: string;
|
|
7
|
-
engineBinaryPath?: string;
|
|
8
|
-
handleInspectorHttpInRuntime?: boolean;
|
|
9
|
-
serverlessBasePath?: string;
|
|
10
|
-
serverlessPackageVersion: string;
|
|
11
|
-
serverlessClientEndpoint?: string;
|
|
12
|
-
serverlessClientNamespace?: string;
|
|
13
|
-
serverlessClientToken?: string;
|
|
14
|
-
serverlessValidateEndpoint: boolean;
|
|
15
|
-
serverlessMaxStartPayloadBytes: number;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface ActorConfig {
|
|
19
|
-
name?: string;
|
|
20
|
-
icon?: string;
|
|
21
|
-
hasDatabase?: boolean;
|
|
22
|
-
remoteSqlite?: boolean;
|
|
23
|
-
hasState?: boolean;
|
|
24
|
-
canHibernateWebsocket?: boolean;
|
|
25
|
-
stateSaveIntervalMs?: number;
|
|
26
|
-
createStateTimeoutMs?: number;
|
|
27
|
-
onCreateTimeoutMs?: number;
|
|
28
|
-
createVarsTimeoutMs?: number;
|
|
29
|
-
createConnStateTimeoutMs?: number;
|
|
30
|
-
onBeforeConnectTimeoutMs?: number;
|
|
31
|
-
onConnectTimeoutMs?: number;
|
|
32
|
-
onMigrateTimeoutMs?: number;
|
|
33
|
-
onWakeTimeoutMs?: number;
|
|
34
|
-
onBeforeActorStartTimeoutMs?: number;
|
|
35
|
-
actionTimeoutMs?: number;
|
|
36
|
-
onRequestTimeoutMs?: number;
|
|
37
|
-
sleepTimeoutMs?: number;
|
|
38
|
-
noSleep?: boolean;
|
|
39
|
-
sleepGracePeriodMs?: number;
|
|
40
|
-
connectionLivenessTimeoutMs?: number;
|
|
41
|
-
connectionLivenessIntervalMs?: number;
|
|
42
|
-
maxQueueSize?: number;
|
|
43
|
-
maxQueueMessageSize?: number;
|
|
44
|
-
maxIncomingMessageSize?: number;
|
|
45
|
-
maxOutgoingMessageSize?: number;
|
|
46
|
-
preloadMaxWorkflowBytes?: number;
|
|
47
|
-
preloadMaxConnectionsBytes?: number;
|
|
48
|
-
actions?: Array<{ name: string }>;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export class CoreRegistry {
|
|
52
|
-
constructor();
|
|
53
|
-
register(name: string, factory: ActorFactory): void;
|
|
54
|
-
serve(config: ServeConfig): Promise<void>;
|
|
55
|
-
shutdown(): Promise<void>;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export class ActorFactory {
|
|
59
|
-
constructor(callbacks: unknown, config?: ActorConfig | null);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export class CancellationToken {
|
|
63
|
-
constructor();
|
|
64
|
-
aborted(): boolean;
|
|
65
|
-
cancel(): void;
|
|
66
|
-
onCancelled(callback: () => void): void;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export class ActorContext {
|
|
70
|
-
constructor();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export class ConnHandle {}
|
|
74
|
-
|
|
75
|
-
export class WebSocketHandle {}
|
|
76
|
-
|
|
77
|
-
export function bridgeRivetErrorPrefix(): string;
|
|
78
|
-
export function roundTripBytes(bytes: Uint8Array): Uint8Array;
|
|
79
|
-
export function uint8ArrayFromBytes(bytes: Uint8Array): Uint8Array;
|
|
80
|
-
export function awaitPromise<T>(promise: Promise<T>): Promise<T>;
|
|
81
|
-
|
|
82
|
-
declare const init: (input?: RequestInfo | URL | Response | BufferSource | WebAssembly.Module) => Promise<void>;
|
|
83
|
-
export default init;
|
|
1
|
+
export * from "./pkg/rivetkit_wasm.js";
|
|
2
|
+
export { default } from "./pkg/rivetkit_wasm.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rivetkit/rivetkit-wasm",
|
|
3
|
-
"version": "0.0.0-pr.
|
|
3
|
+
"version": "0.0.0-pr.4880.34d3f72",
|
|
4
4
|
"description": "WebAssembly bindings for RivetKit core on edge JavaScript runtimes",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -10,23 +10,33 @@
|
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./index.d.ts",
|
|
12
12
|
"default": "./index.js"
|
|
13
|
+
},
|
|
14
|
+
"./rivetkit_wasm_bg.wasm": {
|
|
15
|
+
"default": "./pkg/rivetkit_wasm_bg.wasm"
|
|
13
16
|
}
|
|
14
17
|
},
|
|
15
18
|
"files": [
|
|
16
19
|
"index.js",
|
|
17
20
|
"index.d.ts",
|
|
18
|
-
"pkg
|
|
21
|
+
"pkg/rivetkit_wasm.js",
|
|
22
|
+
"pkg/rivetkit_wasm.d.ts",
|
|
23
|
+
"pkg/rivetkit_wasm_bg.wasm",
|
|
24
|
+
"pkg/rivetkit_wasm_bg.wasm.d.ts",
|
|
19
25
|
"package.json",
|
|
20
|
-
"scripts/build.mjs"
|
|
26
|
+
"scripts/build.mjs",
|
|
27
|
+
"scripts/check-package.mjs"
|
|
21
28
|
],
|
|
22
29
|
"scripts": {
|
|
23
30
|
"build": "node scripts/build.mjs",
|
|
24
31
|
"build:cloudflare": "node scripts/build.mjs --target bundler --out-dir pkg-cloudflare",
|
|
25
32
|
"build:deno": "node scripts/build.mjs --target web --out-dir pkg-deno",
|
|
33
|
+
"check:package": "node scripts/check-package.mjs",
|
|
26
34
|
"check-types": "tsc --noEmit",
|
|
27
|
-
"check:wasm": "cargo check -p rivetkit-wasm --target wasm32-unknown-unknown"
|
|
35
|
+
"check:wasm": "cargo check -p rivetkit-wasm --target wasm32-unknown-unknown",
|
|
36
|
+
"prepack": "node scripts/build.mjs"
|
|
28
37
|
},
|
|
29
38
|
"devDependencies": {
|
|
30
|
-
"typescript": "^5.9.2"
|
|
39
|
+
"typescript": "^5.9.2",
|
|
40
|
+
"wasm-pack": "0.14.0"
|
|
31
41
|
}
|
|
32
42
|
}
|
package/pkg/rivetkit_wasm.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
export function uint8ArrayFromBytes(bytes: Uint8Array): Uint8Array;
|
|
4
|
+
export function roundTripBytes(bytes: Uint8Array): Uint8Array;
|
|
3
5
|
export function start(): void;
|
|
4
6
|
export function awaitPromise(promise: Promise<any>): Promise<any>;
|
|
5
|
-
export function roundTripBytes(bytes: Uint8Array): Uint8Array;
|
|
6
7
|
export function bridgeRivetErrorPrefix(): string;
|
|
7
|
-
export function uint8ArrayFromBytes(bytes: Uint8Array): Uint8Array;
|
|
8
8
|
export class ActorContext {
|
|
9
9
|
free(): void;
|
|
10
10
|
keepAwake(promise: Promise<any>): Promise<any>;
|
|
@@ -65,6 +65,7 @@ export class ConnHandle {
|
|
|
65
65
|
}
|
|
66
66
|
export class CoreRegistry {
|
|
67
67
|
free(): void;
|
|
68
|
+
handleServerlessRequest(req: any, on_stream_event: Function, cancel_token: CancellationToken, config: any): Promise<any>;
|
|
68
69
|
constructor();
|
|
69
70
|
serve(config: any): Promise<void>;
|
|
70
71
|
register(name: string, factory: ActorFactory): void;
|
|
@@ -172,6 +173,7 @@ export interface InitOutput {
|
|
|
172
173
|
readonly actorcontext_state: (a: number) => [number, number];
|
|
173
174
|
readonly actorcontext_takePendingHibernationChanges: (a: number) => any;
|
|
174
175
|
readonly actorcontext_verifyInspectorAuth: (a: number, b: number, c: number) => any;
|
|
176
|
+
readonly actorcontext_waitUntil: (a: number, b: any) => void;
|
|
175
177
|
readonly actorfactory_new: (a: any, b: any) => [number, number, number];
|
|
176
178
|
readonly awaitPromise: (a: any) => any;
|
|
177
179
|
readonly bridgeRivetErrorPrefix: () => [number, number];
|
|
@@ -186,6 +188,7 @@ export interface InitOutput {
|
|
|
186
188
|
readonly connhandle_send: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
187
189
|
readonly connhandle_setState: (a: number, b: number, c: number) => void;
|
|
188
190
|
readonly connhandle_state: (a: number) => [number, number];
|
|
191
|
+
readonly coreregistry_handleServerlessRequest: (a: number, b: any, c: any, d: number, e: any) => any;
|
|
189
192
|
readonly coreregistry_new: () => number;
|
|
190
193
|
readonly coreregistry_register: (a: number, b: number, c: number, d: number) => [number, number];
|
|
191
194
|
readonly coreregistry_serve: (a: number, b: any) => any;
|
|
@@ -227,11 +230,10 @@ export interface InitOutput {
|
|
|
227
230
|
readonly websockethandle_send: (a: number, b: number, c: number, d: number) => [number, number];
|
|
228
231
|
readonly websockethandle_setEventCallback: (a: number, b: any) => void;
|
|
229
232
|
readonly start: () => void;
|
|
230
|
-
readonly actorcontext_waitUntil: (a: number, b: any) => void;
|
|
231
233
|
readonly actorcontext_queue: (a: number) => number;
|
|
232
234
|
readonly actorcontext_schedule: (a: number) => number;
|
|
233
|
-
readonly __wbg_schedule_free: (a: number, b: number) => void;
|
|
234
235
|
readonly __wbg_queue_free: (a: number, b: number) => void;
|
|
236
|
+
readonly __wbg_schedule_free: (a: number, b: number) => void;
|
|
235
237
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
236
238
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
237
239
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
@@ -240,9 +242,9 @@ export interface InitOutput {
|
|
|
240
242
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
241
243
|
readonly __wbindgen_export_6: WebAssembly.Table;
|
|
242
244
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
243
|
-
readonly
|
|
244
|
-
readonly
|
|
245
|
-
readonly
|
|
245
|
+
readonly closure1557_externref_shim: (a: number, b: number, c: any) => void;
|
|
246
|
+
readonly closure1760_externref_shim: (a: number, b: number, c: any) => void;
|
|
247
|
+
readonly closure1979_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
246
248
|
readonly __wbindgen_start: () => void;
|
|
247
249
|
}
|
|
248
250
|
|
package/pkg/rivetkit_wasm.js
CHANGED
|
@@ -221,17 +221,14 @@ function _assertClass(instance, klass) {
|
|
|
221
221
|
throw new Error(`expected instance of ${klass.name}`);
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
|
|
225
|
-
export function start() {
|
|
226
|
-
wasm.start();
|
|
227
|
-
}
|
|
228
|
-
|
|
229
224
|
/**
|
|
230
|
-
* @param {
|
|
231
|
-
* @returns {
|
|
225
|
+
* @param {Uint8Array} bytes
|
|
226
|
+
* @returns {Uint8Array}
|
|
232
227
|
*/
|
|
233
|
-
export function
|
|
234
|
-
const
|
|
228
|
+
export function uint8ArrayFromBytes(bytes) {
|
|
229
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
230
|
+
const len0 = WASM_VECTOR_LEN;
|
|
231
|
+
const ret = wasm.uint8ArrayFromBytes(ptr0, len0);
|
|
235
232
|
return ret;
|
|
236
233
|
}
|
|
237
234
|
|
|
@@ -248,6 +245,19 @@ export function roundTripBytes(bytes) {
|
|
|
248
245
|
return v2;
|
|
249
246
|
}
|
|
250
247
|
|
|
248
|
+
export function start() {
|
|
249
|
+
wasm.start();
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* @param {Promise<any>} promise
|
|
254
|
+
* @returns {Promise<any>}
|
|
255
|
+
*/
|
|
256
|
+
export function awaitPromise(promise) {
|
|
257
|
+
const ret = wasm.awaitPromise(promise);
|
|
258
|
+
return ret;
|
|
259
|
+
}
|
|
260
|
+
|
|
251
261
|
/**
|
|
252
262
|
* @returns {string}
|
|
253
263
|
*/
|
|
@@ -264,27 +274,16 @@ export function bridgeRivetErrorPrefix() {
|
|
|
264
274
|
}
|
|
265
275
|
}
|
|
266
276
|
|
|
267
|
-
/**
|
|
268
|
-
* @param {Uint8Array} bytes
|
|
269
|
-
* @returns {Uint8Array}
|
|
270
|
-
*/
|
|
271
|
-
export function uint8ArrayFromBytes(bytes) {
|
|
272
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
273
|
-
const len0 = WASM_VECTOR_LEN;
|
|
274
|
-
const ret = wasm.uint8ArrayFromBytes(ptr0, len0);
|
|
275
|
-
return ret;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
277
|
function __wbg_adapter_46(arg0, arg1, arg2) {
|
|
279
|
-
wasm.
|
|
278
|
+
wasm.closure1557_externref_shim(arg0, arg1, arg2);
|
|
280
279
|
}
|
|
281
280
|
|
|
282
281
|
function __wbg_adapter_55(arg0, arg1, arg2) {
|
|
283
|
-
wasm.
|
|
282
|
+
wasm.closure1760_externref_shim(arg0, arg1, arg2);
|
|
284
283
|
}
|
|
285
284
|
|
|
286
|
-
function
|
|
287
|
-
wasm.
|
|
285
|
+
function __wbg_adapter_223(arg0, arg1, arg2, arg3) {
|
|
286
|
+
wasm.closure1979_externref_shim(arg0, arg1, arg2, arg3);
|
|
288
287
|
}
|
|
289
288
|
|
|
290
289
|
const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
|
|
@@ -768,6 +767,18 @@ export class CoreRegistry {
|
|
|
768
767
|
const ptr = this.__destroy_into_raw();
|
|
769
768
|
wasm.__wbg_coreregistry_free(ptr, 0);
|
|
770
769
|
}
|
|
770
|
+
/**
|
|
771
|
+
* @param {any} req
|
|
772
|
+
* @param {Function} on_stream_event
|
|
773
|
+
* @param {CancellationToken} cancel_token
|
|
774
|
+
* @param {any} config
|
|
775
|
+
* @returns {Promise<any>}
|
|
776
|
+
*/
|
|
777
|
+
handleServerlessRequest(req, on_stream_event, cancel_token, config) {
|
|
778
|
+
_assertClass(cancel_token, CancellationToken);
|
|
779
|
+
const ret = wasm.coreregistry_handleServerlessRequest(this.__wbg_ptr, req, on_stream_event, cancel_token.__wbg_ptr, config);
|
|
780
|
+
return ret;
|
|
781
|
+
}
|
|
771
782
|
constructor() {
|
|
772
783
|
const ret = wasm.coreregistry_new();
|
|
773
784
|
this.__wbg_ptr = ret >>> 0;
|
|
@@ -1369,6 +1380,10 @@ function __wbg_get_imports() {
|
|
|
1369
1380
|
const ret = ActorContext.__wrap(arg0);
|
|
1370
1381
|
return ret;
|
|
1371
1382
|
};
|
|
1383
|
+
imports.wbg.__wbg_buffer_09165b52af8c5237 = function(arg0) {
|
|
1384
|
+
const ret = arg0.buffer;
|
|
1385
|
+
return ret;
|
|
1386
|
+
};
|
|
1372
1387
|
imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
|
|
1373
1388
|
const ret = arg0.buffer;
|
|
1374
1389
|
return ret;
|
|
@@ -1540,7 +1555,7 @@ function __wbg_get_imports() {
|
|
|
1540
1555
|
const a = state0.a;
|
|
1541
1556
|
state0.a = 0;
|
|
1542
1557
|
try {
|
|
1543
|
-
return
|
|
1558
|
+
return __wbg_adapter_223(a, state0.b, arg0, arg1);
|
|
1544
1559
|
} finally {
|
|
1545
1560
|
state0.a = a;
|
|
1546
1561
|
}
|
|
@@ -1652,8 +1667,8 @@ function __wbg_get_imports() {
|
|
|
1652
1667
|
const ret = Promise.resolve(arg0);
|
|
1653
1668
|
return ret;
|
|
1654
1669
|
};
|
|
1655
|
-
imports.wbg.
|
|
1656
|
-
arg0.send(
|
|
1670
|
+
imports.wbg.__wbg_send_7c4769e24cf1d784 = function() { return handleError(function (arg0, arg1) {
|
|
1671
|
+
arg0.send(arg1);
|
|
1657
1672
|
}, arguments) };
|
|
1658
1673
|
imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
|
|
1659
1674
|
arg0[arg1 >>> 0] = arg2;
|
|
@@ -1752,24 +1767,24 @@ function __wbg_get_imports() {
|
|
|
1752
1767
|
const ret = false;
|
|
1753
1768
|
return ret;
|
|
1754
1769
|
};
|
|
1755
|
-
imports.wbg.
|
|
1756
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1770
|
+
imports.wbg.__wbindgen_closure_wrapper3631 = function(arg0, arg1, arg2) {
|
|
1771
|
+
const ret = makeMutClosure(arg0, arg1, 1558, __wbg_adapter_46);
|
|
1757
1772
|
return ret;
|
|
1758
1773
|
};
|
|
1759
|
-
imports.wbg.
|
|
1760
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1774
|
+
imports.wbg.__wbindgen_closure_wrapper3633 = function(arg0, arg1, arg2) {
|
|
1775
|
+
const ret = makeMutClosure(arg0, arg1, 1558, __wbg_adapter_46);
|
|
1761
1776
|
return ret;
|
|
1762
1777
|
};
|
|
1763
|
-
imports.wbg.
|
|
1764
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1778
|
+
imports.wbg.__wbindgen_closure_wrapper3635 = function(arg0, arg1, arg2) {
|
|
1779
|
+
const ret = makeMutClosure(arg0, arg1, 1558, __wbg_adapter_46);
|
|
1765
1780
|
return ret;
|
|
1766
1781
|
};
|
|
1767
|
-
imports.wbg.
|
|
1768
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1782
|
+
imports.wbg.__wbindgen_closure_wrapper3637 = function(arg0, arg1, arg2) {
|
|
1783
|
+
const ret = makeMutClosure(arg0, arg1, 1558, __wbg_adapter_46);
|
|
1769
1784
|
return ret;
|
|
1770
1785
|
};
|
|
1771
|
-
imports.wbg.
|
|
1772
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1786
|
+
imports.wbg.__wbindgen_closure_wrapper4230 = function(arg0, arg1, arg2) {
|
|
1787
|
+
const ret = makeMutClosure(arg0, arg1, 1761, __wbg_adapter_55);
|
|
1773
1788
|
return ret;
|
|
1774
1789
|
};
|
|
1775
1790
|
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
|
Binary file
|
|
@@ -40,6 +40,7 @@ export const actorcontext_sql: (a: number) => number;
|
|
|
40
40
|
export const actorcontext_state: (a: number) => [number, number];
|
|
41
41
|
export const actorcontext_takePendingHibernationChanges: (a: number) => any;
|
|
42
42
|
export const actorcontext_verifyInspectorAuth: (a: number, b: number, c: number) => any;
|
|
43
|
+
export const actorcontext_waitUntil: (a: number, b: any) => void;
|
|
43
44
|
export const actorfactory_new: (a: any, b: any) => [number, number, number];
|
|
44
45
|
export const awaitPromise: (a: any) => any;
|
|
45
46
|
export const bridgeRivetErrorPrefix: () => [number, number];
|
|
@@ -54,6 +55,7 @@ export const connhandle_params: (a: number) => [number, number];
|
|
|
54
55
|
export const connhandle_send: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
55
56
|
export const connhandle_setState: (a: number, b: number, c: number) => void;
|
|
56
57
|
export const connhandle_state: (a: number) => [number, number];
|
|
58
|
+
export const coreregistry_handleServerlessRequest: (a: number, b: any, c: any, d: number, e: any) => any;
|
|
57
59
|
export const coreregistry_new: () => number;
|
|
58
60
|
export const coreregistry_register: (a: number, b: number, c: number, d: number) => [number, number];
|
|
59
61
|
export const coreregistry_serve: (a: number, b: any) => any;
|
|
@@ -95,11 +97,10 @@ export const websockethandle_close: (a: number, b: number, c: number, d: number)
|
|
|
95
97
|
export const websockethandle_send: (a: number, b: number, c: number, d: number) => [number, number];
|
|
96
98
|
export const websockethandle_setEventCallback: (a: number, b: any) => void;
|
|
97
99
|
export const start: () => void;
|
|
98
|
-
export const actorcontext_waitUntil: (a: number, b: any) => void;
|
|
99
100
|
export const actorcontext_queue: (a: number) => number;
|
|
100
101
|
export const actorcontext_schedule: (a: number) => number;
|
|
101
|
-
export const __wbg_schedule_free: (a: number, b: number) => void;
|
|
102
102
|
export const __wbg_queue_free: (a: number, b: number) => void;
|
|
103
|
+
export const __wbg_schedule_free: (a: number, b: number) => void;
|
|
103
104
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
104
105
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
105
106
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
@@ -108,7 +109,7 @@ export const __wbindgen_export_4: WebAssembly.Table;
|
|
|
108
109
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
109
110
|
export const __wbindgen_export_6: WebAssembly.Table;
|
|
110
111
|
export const __externref_table_dealloc: (a: number) => void;
|
|
111
|
-
export const
|
|
112
|
-
export const
|
|
113
|
-
export const
|
|
112
|
+
export const closure1557_externref_shim: (a: number, b: number, c: any) => void;
|
|
113
|
+
export const closure1760_externref_shim: (a: number, b: number, c: any) => void;
|
|
114
|
+
export const closure1979_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
114
115
|
export const __wbindgen_start: () => void;
|
package/scripts/build.mjs
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { execFileSync } from "node:child_process";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
4
5
|
import { dirname, join } from "node:path";
|
|
5
6
|
import { fileURLToPath } from "node:url";
|
|
6
7
|
|
|
7
8
|
const packageDir = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
8
9
|
const pkgDir = join(packageDir, "pkg");
|
|
10
|
+
const require = createRequire(import.meta.url);
|
|
11
|
+
|
|
12
|
+
function resolveWasmPackBin() {
|
|
13
|
+
try {
|
|
14
|
+
const packageJsonPath = require.resolve("wasm-pack/package.json", {
|
|
15
|
+
paths: [packageDir],
|
|
16
|
+
});
|
|
17
|
+
return join(dirname(packageJsonPath), "run.js");
|
|
18
|
+
} catch (err) {
|
|
19
|
+
throw new Error(
|
|
20
|
+
"Missing pinned wasm-pack dependency. Run pnpm install before building @rivetkit/rivetkit-wasm.",
|
|
21
|
+
{ cause: err },
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
9
25
|
|
|
10
26
|
if (["1", "true"].includes(process.env.SKIP_WASM_BUILD ?? "")) {
|
|
11
27
|
const hasPkg = existsSync(join(pkgDir, "rivetkit_wasm.js"));
|
|
@@ -33,7 +49,6 @@ if (!outDir) {
|
|
|
33
49
|
}
|
|
34
50
|
|
|
35
51
|
const cmd = [
|
|
36
|
-
"wasm-pack",
|
|
37
52
|
"build",
|
|
38
53
|
"--target",
|
|
39
54
|
target,
|
|
@@ -43,5 +58,7 @@ const cmd = [
|
|
|
43
58
|
"rivetkit_wasm",
|
|
44
59
|
];
|
|
45
60
|
|
|
46
|
-
|
|
47
|
-
|
|
61
|
+
const wasmPackBin = resolveWasmPackBin();
|
|
62
|
+
|
|
63
|
+
console.log(`[rivetkit-wasm/build] running: wasm-pack ${cmd.join(" ")}`);
|
|
64
|
+
execFileSync(process.execPath, [wasmPackBin, ...cmd], { stdio: "inherit" });
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
|
|
4
|
+
const requiredFiles = new Set([
|
|
5
|
+
"index.js",
|
|
6
|
+
"index.d.ts",
|
|
7
|
+
"pkg/rivetkit_wasm.js",
|
|
8
|
+
"pkg/rivetkit_wasm.d.ts",
|
|
9
|
+
"pkg/rivetkit_wasm_bg.wasm",
|
|
10
|
+
"pkg/rivetkit_wasm_bg.wasm.d.ts",
|
|
11
|
+
"package.json",
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
const output = execFileSync(
|
|
15
|
+
"npm",
|
|
16
|
+
["pack", "--json", "--dry-run", "--ignore-scripts"],
|
|
17
|
+
{
|
|
18
|
+
encoding: "utf8",
|
|
19
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
20
|
+
},
|
|
21
|
+
);
|
|
22
|
+
const [pack] = JSON.parse(output);
|
|
23
|
+
const publishedFiles = new Set(
|
|
24
|
+
pack.files.map((file) => file.path.replace(/\\/g, "/")),
|
|
25
|
+
);
|
|
26
|
+
const missingFiles = [...requiredFiles].filter((file) => !publishedFiles.has(file));
|
|
27
|
+
|
|
28
|
+
if (missingFiles.length > 0) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
`@rivetkit/rivetkit-wasm package is missing required files: ${missingFiles.join(", ")}`,
|
|
31
|
+
);
|
|
32
|
+
}
|
package/pkg/package.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "rivetkit-wasm",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"collaborators": [
|
|
5
|
-
"Rivet Gaming, LLC <developer@rivet.gg>"
|
|
6
|
-
],
|
|
7
|
-
"version": "2.3.0-rc.4",
|
|
8
|
-
"license": "Apache-2.0",
|
|
9
|
-
"files": [
|
|
10
|
-
"rivetkit_wasm_bg.wasm",
|
|
11
|
-
"rivetkit_wasm.js",
|
|
12
|
-
"rivetkit_wasm.d.ts"
|
|
13
|
-
],
|
|
14
|
-
"main": "rivetkit_wasm.js",
|
|
15
|
-
"types": "rivetkit_wasm.d.ts",
|
|
16
|
-
"sideEffects": [
|
|
17
|
-
"./snippets/*"
|
|
18
|
-
]
|
|
19
|
-
}
|