@spooky-sync/client-react 0.0.1-canary.383 → 0.0.1-canary.384
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 +1 -1
- package/QUICK_START.md +16 -5
- package/package.json +3 -3
- package/skills/sp00ky-react/SKILL.md +1 -1
package/AGENTS.md
CHANGED
|
@@ -36,7 +36,7 @@ export const dbConfig: SyncedDbConfig<typeof schema> = {
|
|
|
36
36
|
|
|
37
37
|
Provider props: `config` (read once at mount; remount with a new `key` to switch databases), `fallback`, `preload` (awaited before children render, best-effort), `onReady`, `onError`. The client is created in an effect, so server renders show the fallback. A client that was handed to the tree is deliberately not closed on unmount; one whose init outlived the provider is.
|
|
38
38
|
|
|
39
|
-
Vite needs `vite-plugin-wasm`, `
|
|
39
|
+
Vite needs `vite-plugin-wasm`, `build.target: 'esnext'`, `optimizeDeps.exclude: ['@spooky-sync/client-react', '@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`.
|
|
40
40
|
|
|
41
41
|
## Key API
|
|
42
42
|
|
package/QUICK_START.md
CHANGED
|
@@ -6,25 +6,36 @@ The same content as the docs' [React guide](https://mono424.github.io/sp00ky/doc
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
pnpm add @spooky-sync/core @spooky-sync/client-react
|
|
9
|
-
pnpm add -D vite-plugin-wasm
|
|
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
|
|
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 react from '@vitejs/plugin-react';
|
|
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: [react(), wasm()
|
|
23
|
+
plugins: [react(), wasm()],
|
|
25
24
|
optimizeDeps: {
|
|
26
|
-
|
|
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-react',
|
|
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-react",
|
|
3
|
-
"version": "0.0.1-canary.
|
|
3
|
+
"version": "0.0.1-canary.384",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "React 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.
|
|
55
|
-
"@spooky-sync/query-builder": "0.0.1-canary.
|
|
54
|
+
"@spooky-sync/core": "0.0.1-canary.384",
|
|
55
|
+
"@spooky-sync/query-builder": "0.0.1-canary.384",
|
|
56
56
|
"@surrealdb/wasm": "^3.1.0",
|
|
57
57
|
"surrealdb": "2.1.0"
|
|
58
58
|
},
|
|
@@ -27,7 +27,7 @@ import { Sp00kyProvider } from '@spooky-sync/client-react';
|
|
|
27
27
|
</Sp00kyProvider>
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
`config` is read once at mount. Vite needs `vite-plugin-wasm`, `
|
|
30
|
+
`config` is read once at mount. Vite needs `vite-plugin-wasm`, `build.target: 'esnext'`, `optimizeDeps.exclude: ['@spooky-sync/client-react', '@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`.
|
|
31
31
|
|
|
32
32
|
## Queries
|
|
33
33
|
|