orez-sync-cf-host 0.10.1 → 0.10.2
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/vite-wasm-loader.d.ts +6 -2
- package/dist/vite-wasm-loader.js +24 -17
- package/dist/wasm.d.ts +21 -1
- package/dist/wasm.js +37 -5
- package/package.json +2 -2
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type OrezSyncCfHostWasmOptions = {
|
|
3
|
+
noExternal?: string[];
|
|
4
|
+
};
|
|
5
|
+
/** load the sync engine for Vite's Node serve, SSR, and production build paths. */
|
|
6
|
+
export declare function orezSyncCfHostWasm(options?: OrezSyncCfHostWasmOptions): Plugin[];
|
|
7
|
+
export {};
|
package/dist/vite-wasm-loader.js
CHANGED
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
const wasmModuleID = 'orez-sync-cf-host/wasm-module.wasm';
|
|
3
3
|
const resolvedWasmModuleID = `\0${wasmModuleID}`;
|
|
4
|
-
/**
|
|
5
|
-
export function orezSyncCfHostWasm() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return `import { Buffer } from 'node:buffer'
|
|
4
|
+
/** load the sync engine for Vite's Node serve, SSR, and production build paths. */
|
|
5
|
+
export function orezSyncCfHostWasm(options = {}) {
|
|
6
|
+
const noExternal = ['orez-sync-cf-host', ...(options.noExternal ?? [])];
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
name: 'orez-sync-cf-host-wasm',
|
|
10
|
+
enforce: 'pre',
|
|
11
|
+
resolveId(source) {
|
|
12
|
+
return source === wasmModuleID ? resolvedWasmModuleID : null;
|
|
13
|
+
},
|
|
14
|
+
async load(id) {
|
|
15
|
+
if (id !== resolvedWasmModuleID)
|
|
16
|
+
return null;
|
|
17
|
+
const bytes = await readFile(new URL('./generated/sync_wasm_bg.wasm', import.meta.url));
|
|
18
|
+
return `import { Buffer } from 'node:buffer'
|
|
20
19
|
export default new WebAssembly.Module(Buffer.from('${bytes.toString('base64')}', 'base64'))
|
|
21
20
|
`;
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'orez-sync-cf-host-ssr-bundle',
|
|
25
|
+
enforce: 'post',
|
|
26
|
+
config() {
|
|
27
|
+
return { ssr: { noExternal } };
|
|
28
|
+
},
|
|
22
29
|
},
|
|
23
|
-
|
|
30
|
+
];
|
|
24
31
|
}
|
package/dist/wasm.d.ts
CHANGED
|
@@ -1 +1,21 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const engine_apply_snapshot_changes: (db: any, schema: any, generation: string, batch: any) => any;
|
|
2
|
+
export declare const engine_apply_snapshot_page: (db: any, schema: any, generation: string, table: string, rows: any, next_cursor?: string | null | undefined) => any;
|
|
3
|
+
export declare const engine_apply_upstream: (db: any, schema: any, batch: any) => any;
|
|
4
|
+
export declare const engine_assemble_push_response: (results: any) => any;
|
|
5
|
+
export declare const engine_begin_snapshot_generation: (db: any, schema: any, start_watermark: string) => any;
|
|
6
|
+
export declare const engine_compile_query: (schema: any, ast: any, format: any) => any;
|
|
7
|
+
export declare const engine_finalize: (db: any, client_group_id: string, client_id: string, mutation_id: string) => void;
|
|
8
|
+
export declare const engine_finalize_snapshot_generation: (db: any, schema: any, generation: string, watermark: string) => any;
|
|
9
|
+
export declare const engine_handle_pull: (db: any, schema: any, visibility: any, caps: any, retain_changes: string, body: any, user_id: string) => any;
|
|
10
|
+
export declare const engine_handle_query_pull: (db: any, schema: any, retain_changes: string, body: any, user_id: string) => any;
|
|
11
|
+
export declare const engine_init_query_schema: (db: any) => void;
|
|
12
|
+
export declare const engine_init_schema: (db: any, schema: any) => void;
|
|
13
|
+
export declare const engine_invalidate: (db: any) => void;
|
|
14
|
+
export declare const engine_memory_bytes: () => number;
|
|
15
|
+
export declare const engine_preflight: (db: any, client_group_id: string, client_id: string, mutation_id: string, user_id: string) => any;
|
|
16
|
+
export declare const engine_prune: (db: any, retain_changes: string) => void;
|
|
17
|
+
export declare const engine_push_validate: (body: any) => any;
|
|
18
|
+
export declare const engine_read_snapshot_progress: (db: any) => any;
|
|
19
|
+
export declare const engine_record_app_error: (db: any, client_group_id: string, client_id: string, mutation_id: string, user_id: string) => void;
|
|
20
|
+
export declare const engine_state: (db: any) => any;
|
|
21
|
+
export declare const engine_version: () => string;
|
package/dist/wasm.js
CHANGED
|
@@ -1,7 +1,39 @@
|
|
|
1
1
|
import wasmModule from 'orez-sync-cf-host/wasm-module.wasm';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import * as generated from './generated/sync_wasm.js';
|
|
3
|
+
let initialized = false;
|
|
4
|
+
function ensureWasm() {
|
|
5
|
+
if (initialized)
|
|
6
|
+
return;
|
|
7
|
+
if (!(wasmModule instanceof WebAssembly.Module)) {
|
|
8
|
+
throw new TypeError('.wasm import did not resolve to WebAssembly.Module; see the orez-sync-cf-host README Query compiler runtimes matrix');
|
|
9
|
+
}
|
|
10
|
+
generated.initSync({ module: wasmModule });
|
|
11
|
+
initialized = true;
|
|
5
12
|
}
|
|
6
|
-
|
|
7
|
-
|
|
13
|
+
function withWasm(operation) {
|
|
14
|
+
return (...args) => {
|
|
15
|
+
ensureWasm();
|
|
16
|
+
return operation(...args);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export const engine_apply_snapshot_changes = withWasm(generated.engine_apply_snapshot_changes);
|
|
20
|
+
export const engine_apply_snapshot_page = withWasm(generated.engine_apply_snapshot_page);
|
|
21
|
+
export const engine_apply_upstream = withWasm(generated.engine_apply_upstream);
|
|
22
|
+
export const engine_assemble_push_response = withWasm(generated.engine_assemble_push_response);
|
|
23
|
+
export const engine_begin_snapshot_generation = withWasm(generated.engine_begin_snapshot_generation);
|
|
24
|
+
export const engine_compile_query = withWasm(generated.engine_compile_query);
|
|
25
|
+
export const engine_finalize = withWasm(generated.engine_finalize);
|
|
26
|
+
export const engine_finalize_snapshot_generation = withWasm(generated.engine_finalize_snapshot_generation);
|
|
27
|
+
export const engine_handle_pull = withWasm(generated.engine_handle_pull);
|
|
28
|
+
export const engine_handle_query_pull = withWasm(generated.engine_handle_query_pull);
|
|
29
|
+
export const engine_init_query_schema = withWasm(generated.engine_init_query_schema);
|
|
30
|
+
export const engine_init_schema = withWasm(generated.engine_init_schema);
|
|
31
|
+
export const engine_invalidate = withWasm(generated.engine_invalidate);
|
|
32
|
+
export const engine_memory_bytes = withWasm(generated.engine_memory_bytes);
|
|
33
|
+
export const engine_preflight = withWasm(generated.engine_preflight);
|
|
34
|
+
export const engine_prune = withWasm(generated.engine_prune);
|
|
35
|
+
export const engine_push_validate = withWasm(generated.engine_push_validate);
|
|
36
|
+
export const engine_read_snapshot_progress = withWasm(generated.engine_read_snapshot_progress);
|
|
37
|
+
export const engine_record_app_error = withWasm(generated.engine_record_app_error);
|
|
38
|
+
export const engine_state = withWasm(generated.engine_state);
|
|
39
|
+
export const engine_version = withWasm(generated.engine_version);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orez-sync-cf-host",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"typecheck": "bun run build:dist:platform && tsc --noEmit"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"orez-sync-executor": "0.10.
|
|
58
|
+
"orez-sync-executor": "0.10.2"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@cloudflare/workers-types": "4.20260617.1",
|