@spooky-sync/client-svelte 0.0.1-canary.383 → 0.0.1-canary.385

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/AGENTS.md CHANGED
@@ -51,7 +51,7 @@ Provider props: `config` (read once at mount; wrap in `{#key}` to switch databas
51
51
 
52
52
  Without the provider: create `new SyncedDb(config)`, `await db.init()` (e.g. in a SvelteKit `load`), and call `setDbContext(db)` while the root layout initialises.
53
53
 
54
- Vite needs `vite-plugin-wasm`, `vite-plugin-top-level-await`, `build.target: 'esnext'` and `optimizeDeps.exclude: ['@surrealdb/wasm', '@surrealdb/wasm-native', '@sqlite.org/sqlite-wasm']`.
54
+ Vite needs `vite-plugin-wasm`, `build.target: 'esnext'`, `optimizeDeps.exclude: ['@spooky-sync/client-svelte', '@spooky-sync/core', '@spooky-sync/ssp-wasm', '@surrealdb/wasm', '@surrealdb/wasm-native', '@sqlite.org/sqlite-wasm']` and `optimizeDeps.include: ['@spooky-sync/core > pino', '@spooky-sync/core > fast-json-patch']`. Pre-bundled, the client looks for its `.wasm` files and workers in the wrong folder (dev only: a 404 or `expected magic word`); `vite-plugin-top-level-await` is not needed and crashes with current `@swc/core`.
55
55
 
56
56
  ## Key API
57
57
 
package/QUICK_START.md CHANGED
@@ -6,25 +6,36 @@ The same content as the docs' [Svelte guide](https://mono424.github.io/sp00ky/do
6
6
 
7
7
  ```bash
8
8
  pnpm add @spooky-sync/core @spooky-sync/client-svelte
9
- pnpm add -D vite-plugin-wasm vite-plugin-top-level-await
9
+ pnpm add -D vite-plugin-wasm
10
10
  ```
11
11
 
12
12
  ## 2. Configure Vite
13
13
 
14
- The core client loads its engines as WebAssembly. Keep them out of dependency pre-bundling:
14
+ The core client loads its engines as WebAssembly and starts web workers, both found next to its own files. Keep the client's packages out of dependency pre-bundling (pre-bundled, they look in the wrong folder), pre-bundle the core's CommonJS dependencies instead, and build for `esnext`:
15
15
 
16
16
  ```ts
17
17
  // vite.config.ts
18
18
  import { defineConfig } from 'vite';
19
19
  import { svelte } from '@sveltejs/vite-plugin-svelte'; // SvelteKit: sveltekit() from '@sveltejs/kit/vite'
20
20
  import wasm from 'vite-plugin-wasm';
21
- import topLevelAwait from 'vite-plugin-top-level-await';
22
21
 
23
22
  export default defineConfig({
24
- plugins: [svelte(), wasm(), topLevelAwait()],
23
+ plugins: [svelte(), wasm()],
25
24
  optimizeDeps: {
26
- exclude: ['@surrealdb/wasm', '@surrealdb/wasm-native', '@sqlite.org/sqlite-wasm'],
25
+ // Served as is: pre-bundled, these look for their .wasm files and
26
+ // workers in the wrong folder.
27
+ exclude: [
28
+ '@spooky-sync/client-svelte',
29
+ '@spooky-sync/core',
30
+ '@spooky-sync/ssp-wasm',
31
+ '@surrealdb/wasm',
32
+ '@surrealdb/wasm-native',
33
+ '@sqlite.org/sqlite-wasm',
34
+ ],
35
+ // The excluded core's CommonJS dependencies, pre-bundled for it.
36
+ include: ['@spooky-sync/core > pino', '@spooky-sync/core > fast-json-patch'],
27
37
  },
38
+ // The client uses top-level await.
28
39
  build: { target: 'esnext' },
29
40
  });
30
41
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spooky-sync/client-svelte",
3
- "version": "0.0.1-canary.383",
3
+ "version": "0.0.1-canary.385",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Svelte 5 (runes) bindings for the sp00ky local-first sync client",
@@ -51,8 +51,8 @@
51
51
  },
52
52
  "packageManager": "pnpm@9.0.0",
53
53
  "dependencies": {
54
- "@spooky-sync/core": "0.0.1-canary.383",
55
- "@spooky-sync/query-builder": "0.0.1-canary.383",
54
+ "@spooky-sync/core": "0.0.1-canary.385",
55
+ "@spooky-sync/query-builder": "0.0.1-canary.385",
56
56
  "@surrealdb/wasm": "^3.1.0",
57
57
  "surrealdb": "2.1.0"
58
58
  },
@@ -32,7 +32,7 @@ metadata:
32
32
  </Sp00kyProvider>
33
33
  ```
34
34
 
35
- `config` is read once at mount. SvelteKit: `export const ssr = false` in the root `+layout.ts` (the core is browser-only). Vite needs `vite-plugin-wasm`, `vite-plugin-top-level-await`, `build.target: 'esnext'` and `optimizeDeps.exclude: ['@surrealdb/wasm', '@surrealdb/wasm-native', '@sqlite.org/sqlite-wasm']`.
35
+ `config` is read once at mount. SvelteKit: `export const ssr = false` in the root `+layout.ts` (the core is browser-only). Vite needs `vite-plugin-wasm`, `build.target: 'esnext'`, `optimizeDeps.exclude: ['@spooky-sync/client-svelte', '@spooky-sync/core', '@spooky-sync/ssp-wasm', '@surrealdb/wasm', '@surrealdb/wasm-native', '@sqlite.org/sqlite-wasm']` and `optimizeDeps.include: ['@spooky-sync/core > pino', '@spooky-sync/core > fast-json-patch']`. Pre-bundled, the client looks for its `.wasm` files and workers in the wrong folder (dev only: a 404 or `expected magic word`); `vite-plugin-top-level-await` is not needed and crashes with current `@swc/core`.
36
36
 
37
37
  ## Queries
38
38