@powersync/nuxt 0.0.0-dev-20260225163712 → 0.0.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/README.md CHANGED
@@ -28,11 +28,9 @@ This module re-exports all `@powersync/vue` composables. With **npm** (v7+), ins
28
28
  ```bash
29
29
  # Using npm
30
30
  npm install @powersync/nuxt
31
- npm install --save-dev vite-plugin-top-level-await vite-plugin-wasm
32
31
 
33
32
  # Using pnpm (peer deps are not auto-installed)
34
33
  pnpm add @powersync/nuxt @powersync/vue @powersync/web
35
- pnpm add -D vite-plugin-top-level-await vite-plugin-wasm
36
34
  ```
37
35
 
38
36
  > [!NOTE]
@@ -45,21 +43,17 @@ For a complete working app, see the [Nuxt + Supabase Todo List demo](https://git
45
43
  1. Add `@powersync/nuxt` to the `modules` section of `nuxt.config.ts`:
46
44
 
47
45
  ```typescript
48
- import wasm from 'vite-plugin-wasm'
49
-
50
46
  export default defineNuxtConfig({
51
47
  modules: ['@powersync/nuxt'],
52
48
  vite: {
53
49
  optimizeDeps: {
54
- exclude: ['@journeyapps/wa-sqlite', '@powersync/web'],
55
- include: ['@powersync/web > js-logger'], // <-- Include `js-logger` when it isn't installed and imported.
50
+ exclude: ['@powersync/web']
56
51
  },
57
52
  worker: {
58
- format: 'es',
59
- plugins: () => [wasm()],
60
- },
61
- },
62
- })
53
+ format: 'es'
54
+ }
55
+ }
56
+ });
63
57
  ```
64
58
 
65
59
  > [!WARNING]
@@ -68,29 +62,29 @@ export default defineNuxtConfig({
68
62
  2. Create a PowerSync plugin (e.g., `plugins/powersync.client.ts`):
69
63
 
70
64
  ```typescript
71
- import { NuxtPowerSyncDatabase } from '@powersync/nuxt'
72
- import { createPowerSyncPlugin } from '@powersync/nuxt'
73
- import { AppSchema } from '~/powersync/AppSchema'
74
- import { PowerSyncConnector } from '~/powersync/PowerSyncConnector'
65
+ import { NuxtPowerSyncDatabase } from '@powersync/nuxt';
66
+ import { createPowerSyncPlugin } from '@powersync/nuxt';
67
+ import { AppSchema } from '~/powersync/AppSchema';
68
+ import { PowerSyncConnector } from '~/powersync/PowerSyncConnector';
75
69
 
76
70
  export default defineNuxtPlugin({
77
71
  async setup(nuxtApp) {
78
72
  const db = new NuxtPowerSyncDatabase({
79
73
  database: {
80
- dbFilename: 'your-db-filename.sqlite',
74
+ dbFilename: 'your-db-filename.sqlite'
81
75
  },
82
- schema: AppSchema,
83
- })
76
+ schema: AppSchema
77
+ });
84
78
 
85
- const connector = new PowerSyncConnector()
79
+ const connector = new PowerSyncConnector();
86
80
 
87
- await db.init()
88
- await db.connect(connector)
81
+ await db.init();
82
+ await db.connect(connector);
89
83
 
90
- const plugin = createPowerSyncPlugin({ database: db })
91
- nuxtApp.vueApp.use(plugin)
92
- },
93
- })
84
+ const plugin = createPowerSyncPlugin({ database: db });
85
+ nuxtApp.vueApp.use(plugin);
86
+ }
87
+ });
94
88
  ```
95
89
 
96
90
  At this point, you're all set to use the module composables. The module automatically exposes all `@powersync/vue` composables, so you can use them directly:
@@ -108,13 +102,13 @@ This guide will walk you through the steps to set up PowerSync in your Nuxt proj
108
102
  Create a file called `AppSchema.ts` and add your schema to it.
109
103
 
110
104
  ```typescript
111
- import { column, Schema, Table } from '@powersync/web'
105
+ import { column, Schema, Table } from '@powersync/web';
112
106
 
113
107
  const lists = new Table({
114
108
  created_at: column.text,
115
109
  name: column.text,
116
- owner_id: column.text,
117
- })
110
+ owner_id: column.text
111
+ });
118
112
 
119
113
  const todos = new Table(
120
114
  {
@@ -124,20 +118,20 @@ const todos = new Table(
124
118
  description: column.text,
125
119
  created_by: column.text,
126
120
  completed_by: column.text,
127
- completed: column.integer,
121
+ completed: column.integer
128
122
  },
129
- { indexes: { list: ['list_id'] } },
130
- )
123
+ { indexes: { list: ['list_id'] } }
124
+ );
131
125
 
132
126
  export const AppSchema = new Schema({
133
127
  todos,
134
- lists,
135
- })
128
+ lists
129
+ });
136
130
 
137
131
  // For types
138
- export type Database = (typeof AppSchema)['types']
139
- export type TodoRecord = Database['todos']
140
- export type ListRecord = Database['lists']
132
+ export type Database = (typeof AppSchema)['types'];
133
+ export type TodoRecord = Database['todos'];
134
+ export type ListRecord = Database['lists'];
141
135
  ```
142
136
 
143
137
  > **Tip**: Learn more about how to create your schema [here](https://docs.powersync.com/client-sdk-references/javascript-web#1-define-the-schema).
@@ -147,7 +141,7 @@ export type ListRecord = Database['lists']
147
141
  Create a file called `PowerSyncConnector.ts` and add your connector to it.
148
142
 
149
143
  ```typescript
150
- import { UpdateType, type PowerSyncBackendConnector } from '@powersync/web'
144
+ import { UpdateType, type PowerSyncBackendConnector } from '@powersync/web';
151
145
 
152
146
  export class PowerSyncConnector implements PowerSyncBackendConnector {
153
147
  async fetchCredentials() {
@@ -159,8 +153,8 @@ export class PowerSyncConnector implements PowerSyncBackendConnector {
159
153
  return {
160
154
  endpoint: '[Your PowerSync instance URL or self-hosted endpoint]',
161
155
  // Use a development token (see Authentication Setup https://docs.powersync.com/installation/authentication-setup/development-tokens) to get up and running quickly
162
- token: 'An authentication token',
163
- }
156
+ token: 'An authentication token'
157
+ };
164
158
  }
165
159
 
166
160
  async uploadData(db: any) {
@@ -169,7 +163,7 @@ export class PowerSyncConnector implements PowerSyncBackendConnector {
169
163
 
170
164
  // See example implementation here: https://docs.powersync.com/client-sdk-references/javascript-web#3-integrate-with-your-backend
171
165
  // see demos here: https://github.com/powersync-ja/powersync-js/tree/main/demos
172
- return
166
+ return;
173
167
  }
174
168
  }
175
169
  ```
@@ -181,30 +175,30 @@ export class PowerSyncConnector implements PowerSyncBackendConnector {
181
175
  Finally, putting everything together, create a [plugin](https://nuxt.com/docs/4.x/guide/directory-structure/app/plugins) called `powersync.client.ts` to setup PowerSync.
182
176
 
183
177
  ```typescript
184
- import { createPowerSyncPlugin } from '@powersync/nuxt'
185
- import { NuxtPowerSyncDatabase } from '@powersync/nuxt'
186
- import { AppSchema } from '~/powersync/AppSchema'
187
- import { PowerSyncConnector } from '~/powersync/PowerSyncConnector'
178
+ import { createPowerSyncPlugin } from '@powersync/nuxt';
179
+ import { NuxtPowerSyncDatabase } from '@powersync/nuxt';
180
+ import { AppSchema } from '~/powersync/AppSchema';
181
+ import { PowerSyncConnector } from '~/powersync/PowerSyncConnector';
188
182
 
189
183
  export default defineNuxtPlugin({
190
184
  async setup(nuxtApp) {
191
185
  const db = new NuxtPowerSyncDatabase({
192
186
  database: {
193
- dbFilename: 'a-db-name.sqlite',
187
+ dbFilename: 'a-db-name.sqlite'
194
188
  },
195
- schema: AppSchema,
196
- })
189
+ schema: AppSchema
190
+ });
197
191
 
198
- const connector = new PowerSyncConnector()
192
+ const connector = new PowerSyncConnector();
199
193
 
200
- await db.init()
201
- await db.connect(connector)
194
+ await db.init();
195
+ await db.connect(connector);
202
196
 
203
- const plugin = createPowerSyncPlugin({ database: db })
197
+ const plugin = createPowerSyncPlugin({ database: db });
204
198
 
205
- nuxtApp.vueApp.use(plugin)
206
- },
207
- })
199
+ nuxtApp.vueApp.use(plugin);
200
+ }
201
+ });
208
202
  ```
209
203
 
210
204
  ### Kysely ORM (Optional)
@@ -216,6 +210,7 @@ Install the driver:
216
210
  ```
217
211
  pnpm add @powersync/kysely-driver
218
212
  ```
213
+
219
214
  In your existing `nuxt.config.ts`, set:
220
215
 
221
216
  ```typescript
@@ -226,28 +221,26 @@ export default defineNuxtConfig({
226
221
  },
227
222
  vite: {
228
223
  optimizeDeps: {
229
- exclude: ['@journeyapps/wa-sqlite', '@powersync/web'],
230
- include: ['@powersync/web > js-logger'],
224
+ exclude: ['@powersync/web']
231
225
  },
232
226
  worker: {
233
- format: 'es',
234
- plugins: () => [wasm()],
235
- },
236
- },
237
- })
227
+ format: 'es'
228
+ }
229
+ }
230
+ });
238
231
  ```
239
232
 
240
233
  When enabled, the module exposes `usePowerSyncKysely`. Use your schema’s `Database` type to get proper typings:
241
234
 
242
235
  ```typescript
243
- import { usePowerSyncKysely } from '@powersync/nuxt'
244
- import { type Database } from '../powersync/AppSchema'
236
+ import { usePowerSyncKysely } from '@powersync/nuxt';
237
+ import { type Database } from '../powersync/AppSchema';
245
238
 
246
239
  // In your component or composable
247
- const db = usePowerSyncKysely<Database>()
240
+ const db = usePowerSyncKysely<Database>();
248
241
 
249
242
  // Use the db object to interact with the database
250
- const users = await db.selectFrom('users').selectAll().execute()
243
+ const users = await db.selectFrom('users').selectAll().execute();
251
244
  ```
252
245
 
253
246
  ### Enabling Diagnostics
@@ -260,28 +253,26 @@ To enable the PowerSync Inspector with diagnostics capabilities:
260
253
  export default defineNuxtConfig({
261
254
  modules: ['@powersync/nuxt'],
262
255
  powersync: {
263
- useDiagnostics: true, // <- Add this
256
+ useDiagnostics: true // <- Add this
264
257
  },
265
258
  vite: {
266
259
  optimizeDeps: {
267
- exclude: ['@journeyapps/wa-sqlite', '@powersync/web'],
268
- include: ['@powersync/web > js-logger'],
260
+ exclude: ['@powersync/web']
269
261
  },
270
262
  worker: {
271
- format: 'es',
272
- plugins: () => [wasm()],
273
- },
274
- },
275
- })
263
+ format: 'es'
264
+ }
265
+ }
266
+ });
276
267
  ```
277
268
 
278
269
  When `useDiagnostics: true` is set, `NuxtPowerSyncDatabase` automatically:
270
+
279
271
  - Extend your schema with diagnostics schema
280
272
  - Sets up diagnostics recording
281
273
  - Stores the connector internally (accessible via diagnostics)
282
274
  - Configures logging for diagnostics
283
275
 
284
-
285
276
  2. **Accessing PowerSync Inspector**:
286
277
 
287
278
  Once diagnostics are enabled, you can access the [PowerSync Inspector](#powersync-inspector):
@@ -289,8 +280,6 @@ Once diagnostics are enabled, you can access the [PowerSync Inspector](#powersyn
289
280
  - **Via Nuxt Devtools**: Open Devtools and look for the PowerSync tab
290
281
  - **Direct URL**: `http://localhost:3000/__powersync-inspector`
291
282
 
292
-
293
-
294
283
  ## PowerSync Inspector
295
284
 
296
285
  PowerSync Inspector is a tool that helps inspect and diagnose the state of your PowerSync client directly from your app in real-time.
@@ -310,6 +299,7 @@ Once setup, the inspector can be accessed on the `http://localhost:3000/__powers
310
299
  #### Sync Status
311
300
 
312
301
  The `Sync Status` tab provides a real-time view of the sync status of your PowerSync client, including:
302
+
313
303
  - Connection status
314
304
  - Sync progress
315
305
  - Upload queue statistics
@@ -341,8 +331,8 @@ To fix this, you can add the following to your `nuxt.config.ts`:
341
331
  export default defineNuxtConfig({
342
332
  unocss: {
343
333
  autoImport: false
344
- },
345
- })
334
+ }
335
+ });
346
336
  ```
347
337
 
348
338
  ## Development
@@ -368,23 +358,21 @@ Don't forget to add a watcher for the module for hot reloading.
368
358
  Example (in your nuxt app):
369
359
 
370
360
  ```typescript
371
- import { defineNuxtConfig } from 'nuxt/config'
361
+ import { defineNuxtConfig } from 'nuxt/config';
372
362
 
373
363
  export default defineNuxtConfig({
374
364
  modules: ['../../my-location/@powersync/nuxt/src/*'],
375
- watch: ['../../my-location/@powersync/nuxt/src/*'],
376
- })
365
+ watch: ['../../my-location/@powersync/nuxt/src/*']
366
+ });
377
367
  ```
378
368
 
379
369
  <!-- Badges -->
370
+
380
371
  [npm-version-src]: https://img.shields.io/npm/v/@powersync/nuxt/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
381
372
  [npm-version-href]: https://npmjs.com/package/@powersync/nuxt
382
-
383
373
  [npm-downloads-src]: https://img.shields.io/npm/dm/@powersync/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D
384
374
  [npm-downloads-href]: https://npmjs.com/package/@powersync/nuxt
385
-
386
375
  [license-src]: https://img.shields.io/npm/l/@powersync/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D
387
376
  [license-href]: https://npmjs.com/package/@powersync/nuxt
388
-
389
377
  [nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
390
378
  [nuxt-href]: https://nuxt.com
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "powersync-nuxt",
3
3
  "configKey": "powersync",
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -100,7 +100,12 @@ const module$1 = defineNuxtModule({
100
100
  "usePowerSyncWatchedQuery",
101
101
  "useQuery",
102
102
  "useStatus",
103
- "useWatchedQuerySubscription"
103
+ "useWatchedQuerySubscription",
104
+ "useSyncStream",
105
+ {
106
+ name: "AdditionalOptions",
107
+ type: true
108
+ }
104
109
  ],
105
110
  "@powersync/vue"
106
111
  );
@@ -1 +1,6 @@
1
- export declare const addImportsFrom: (names: string[], from: string) => void;
1
+ interface ImportDefinition {
2
+ name: string;
3
+ type: boolean;
4
+ }
5
+ export declare const addImportsFrom: (names: (string | ImportDefinition)[], from: string) => void;
6
+ export {};
@@ -1,4 +1,10 @@
1
1
  import { addImports } from "@nuxt/kit";
2
2
  export const addImportsFrom = (names, from) => {
3
- addImports(names.map((name) => ({ name, from })));
3
+ addImports(
4
+ names.map((name) => ({
5
+ name: typeof name === "string" ? name : name.name,
6
+ type: typeof name === "string" ? false : name.type,
7
+ from
8
+ }))
9
+ );
4
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powersync/nuxt",
3
- "version": "0.0.0-dev-20260225163712",
3
+ "version": "0.0.2",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -52,9 +52,9 @@
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@journeyapps/wa-sqlite": "^1.2.6",
55
- "@powersync/vue": "0.4.2",
56
- "@powersync/kysely-driver": "1.3.3",
57
- "@powersync/web": "0.0.0-dev-20260225163712"
55
+ "@powersync/kysely-driver": "^1.3.3",
56
+ "@powersync/vue": "^0.5.0",
57
+ "@powersync/web": "^1.34.0"
58
58
  },
59
59
  "peerDependenciesMeta": {
60
60
  "@powersync/kysely-driver": {
@@ -74,8 +74,8 @@
74
74
  "vue": "^3.5.20",
75
75
  "vue-tsc": "^3.0.8",
76
76
  "@powersync/kysely-driver": "1.3.3",
77
- "@powersync/vue": "0.4.2",
78
- "@powersync/web": "0.0.0-dev-20260225163712"
77
+ "@powersync/web": "1.34.0",
78
+ "@powersync/vue": "0.5.0"
79
79
  },
80
80
  "scripts": {
81
81
  "prebuild": "nuxt-module-build prepare",