@powersync/nuxt 0.0.0-dev-20260128023420

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.
Files changed (64) hide show
  1. package/LICENSE +201 -0
  2. package/README +374 -0
  3. package/dist/module.d.mts +39 -0
  4. package/dist/module.json +9 -0
  5. package/dist/module.mjs +160 -0
  6. package/dist/runtime/assets/powersync-icon.svg +14 -0
  7. package/dist/runtime/components/BucketsInspectorTab.d.vue.ts +3 -0
  8. package/dist/runtime/components/BucketsInspectorTab.vue +646 -0
  9. package/dist/runtime/components/BucketsInspectorTab.vue.d.ts +3 -0
  10. package/dist/runtime/components/ConfigInspectorTab.d.vue.ts +3 -0
  11. package/dist/runtime/components/ConfigInspectorTab.vue +121 -0
  12. package/dist/runtime/components/ConfigInspectorTab.vue.d.ts +3 -0
  13. package/dist/runtime/components/DataInspectorTab.d.vue.ts +3 -0
  14. package/dist/runtime/components/DataInspectorTab.vue +678 -0
  15. package/dist/runtime/components/DataInspectorTab.vue.d.ts +3 -0
  16. package/dist/runtime/components/LoadingSpinner.d.vue.ts +3 -0
  17. package/dist/runtime/components/LoadingSpinner.vue +12 -0
  18. package/dist/runtime/components/LoadingSpinner.vue.d.ts +3 -0
  19. package/dist/runtime/components/LogsTab.d.vue.ts +3 -0
  20. package/dist/runtime/components/LogsTab.vue +325 -0
  21. package/dist/runtime/components/LogsTab.vue.d.ts +3 -0
  22. package/dist/runtime/components/PowerSyncInstanceTab.d.vue.ts +3 -0
  23. package/dist/runtime/components/PowerSyncInstanceTab.vue +9 -0
  24. package/dist/runtime/components/PowerSyncInstanceTab.vue.d.ts +3 -0
  25. package/dist/runtime/components/SyncStatusTab.d.vue.ts +3 -0
  26. package/dist/runtime/components/SyncStatusTab.vue +272 -0
  27. package/dist/runtime/components/SyncStatusTab.vue.d.ts +3 -0
  28. package/dist/runtime/composables/useDiagnosticsLogger.d.ts +27 -0
  29. package/dist/runtime/composables/useDiagnosticsLogger.js +41 -0
  30. package/dist/runtime/composables/usePowerSyncInspector.d.ts +42 -0
  31. package/dist/runtime/composables/usePowerSyncInspector.js +19 -0
  32. package/dist/runtime/composables/usePowerSyncInspectorDiagnostics.d.ts +153 -0
  33. package/dist/runtime/composables/usePowerSyncInspectorDiagnostics.js +254 -0
  34. package/dist/runtime/composables/usePowerSyncKysely.d.ts +23 -0
  35. package/dist/runtime/composables/usePowerSyncKysely.js +7 -0
  36. package/dist/runtime/index.d.ts +9 -0
  37. package/dist/runtime/layouts/powersync-inspector-layout.d.vue.ts +13 -0
  38. package/dist/runtime/layouts/powersync-inspector-layout.vue +90 -0
  39. package/dist/runtime/layouts/powersync-inspector-layout.vue.d.ts +13 -0
  40. package/dist/runtime/pages/__powersync-inspector.d.vue.ts +3 -0
  41. package/dist/runtime/pages/__powersync-inspector.vue +153 -0
  42. package/dist/runtime/pages/__powersync-inspector.vue.d.ts +3 -0
  43. package/dist/runtime/plugin.client.d.ts +2 -0
  44. package/dist/runtime/plugin.client.js +11 -0
  45. package/dist/runtime/utils/AppSchema.d.ts +27 -0
  46. package/dist/runtime/utils/AppSchema.js +23 -0
  47. package/dist/runtime/utils/DynamicSchemaManager.d.ts +15 -0
  48. package/dist/runtime/utils/DynamicSchemaManager.js +91 -0
  49. package/dist/runtime/utils/JsSchemaGenerator.d.ts +8 -0
  50. package/dist/runtime/utils/JsSchemaGenerator.js +28 -0
  51. package/dist/runtime/utils/NuxtPowerSyncDatabase.d.ts +40 -0
  52. package/dist/runtime/utils/NuxtPowerSyncDatabase.js +117 -0
  53. package/dist/runtime/utils/RecordingStorageAdapter.d.ts +13 -0
  54. package/dist/runtime/utils/RecordingStorageAdapter.js +76 -0
  55. package/dist/runtime/utils/RustClientInterceptor.d.ts +24 -0
  56. package/dist/runtime/utils/RustClientInterceptor.js +102 -0
  57. package/dist/runtime/utils/TokenConnector.d.ts +14 -0
  58. package/dist/runtime/utils/TokenConnector.js +62 -0
  59. package/dist/runtime/utils/addImportsFrom.d.ts +1 -0
  60. package/dist/runtime/utils/addImportsFrom.js +4 -0
  61. package/dist/runtime/utils/index.d.ts +1 -0
  62. package/dist/runtime/utils/index.js +1 -0
  63. package/dist/types.d.mts +9 -0
  64. package/package.json +90 -0
@@ -0,0 +1,160 @@
1
+ import { defineNuxtModule, createResolver, findPath, installModule, addPlugin, addImports, addComponentsDir, addLayout, extendPages } from '@nuxt/kit';
2
+ import { defu } from 'defu';
3
+ import { addImportsFrom } from '../dist/runtime/utils/addImportsFrom.js';
4
+
5
+ function setupDevToolsUI(nuxt) {
6
+ const port = nuxt.options.devServer?.port || 3e3;
7
+ const DEVTOOLS_UI_ROUTE = `http://localhost:${port}/__powersync-inspector`;
8
+ const iconUrl = `http://localhost:${port}/assets/powersync-icon.svg`;
9
+ nuxt.hook("devtools:customTabs", (tabs) => {
10
+ tabs.push({
11
+ // unique identifier
12
+ name: "powersync-inspector",
13
+ // title to display in the tab
14
+ title: "Powersync Inspector",
15
+ // any icon from Iconify, or a URL to an image
16
+ // Using HTTP URL so devtools recognizes it as an image URL
17
+ icon: iconUrl,
18
+ // iframe view
19
+ view: {
20
+ type: "iframe",
21
+ src: DEVTOOLS_UI_ROUTE
22
+ }
23
+ });
24
+ });
25
+ }
26
+
27
+ const module$1 = defineNuxtModule({
28
+ meta: {
29
+ name: "powersync-nuxt",
30
+ configKey: "powersync"
31
+ },
32
+ // Default configuration options of the Nuxt module
33
+ defaults: {
34
+ useDiagnostics: false,
35
+ kysely: false
36
+ },
37
+ async setup(options, nuxt) {
38
+ const resolver = createResolver(import.meta.url);
39
+ nuxt.options.runtimeConfig.public.powerSyncModuleOptions = defu(
40
+ nuxt.options.runtimeConfig.public.powerSyncModuleOptions,
41
+ {
42
+ useDiagnostics: options.useDiagnostics,
43
+ kysely: options.kysely
44
+ }
45
+ );
46
+ if (options.kysely) {
47
+ const kyselyDriverPath = await findPath("@powersync/kysely-driver");
48
+ if (!kyselyDriverPath) {
49
+ throw new Error(
50
+ "[@powersync/nuxt] The `kysely` option requires @powersync/kysely-driver to be installed.\nRun: npm install @powersync/kysely-driver"
51
+ );
52
+ }
53
+ }
54
+ await installModule("@nuxt/devtools-ui-kit");
55
+ await installModule("@vueuse/nuxt");
56
+ addPlugin(resolver.resolve("./runtime/plugin.client"));
57
+ addImports({
58
+ name: "NuxtPowerSyncDatabase",
59
+ from: resolver.resolve(
60
+ "./runtime/utils/NuxtPowerSyncDatabase"
61
+ )
62
+ });
63
+ addImports({
64
+ name: "usePowerSyncInspector",
65
+ from: resolver.resolve("./runtime/composables/usePowerSyncInspector")
66
+ });
67
+ addImports({
68
+ name: "usePowerSyncInspectorDiagnostics",
69
+ from: resolver.resolve(
70
+ "./runtime/composables/usePowerSyncInspectorDiagnostics"
71
+ )
72
+ });
73
+ if (options.kysely) {
74
+ addImports({
75
+ name: "usePowerSyncKysely",
76
+ from: resolver.resolve("./runtime/composables/usePowerSyncKysely")
77
+ });
78
+ }
79
+ addImports({
80
+ name: "useDiagnosticsLogger",
81
+ from: resolver.resolve("./runtime/composables/useDiagnosticsLogger")
82
+ });
83
+ addComponentsDir({
84
+ path: resolver.resolve("runtime/components")
85
+ });
86
+ addLayout(
87
+ resolver.resolve("./runtime/layouts/powersync-inspector-layout.vue"),
88
+ "powersync-inspector-layout"
89
+ );
90
+ extendPages((pages) => {
91
+ pages.push({
92
+ path: "/__powersync-inspector",
93
+ // file: resolver.resolve("#build/pages/__powersync-inspector.vue"),
94
+ file: resolver.resolve("./runtime/pages/__powersync-inspector.vue"),
95
+ name: "Powersync Inspector"
96
+ });
97
+ });
98
+ addImportsFrom([
99
+ "createPowerSyncPlugin",
100
+ "providePowerSync",
101
+ "usePowerSync",
102
+ "usePowerSyncQuery",
103
+ "usePowerSyncStatus",
104
+ "usePowerSyncWatchedQuery",
105
+ "useQuery",
106
+ "useStatus",
107
+ "useWatchedQuerySubscription"
108
+ ], "@powersync/vue");
109
+ nuxt.options.build.transpile = nuxt.options.build.transpile || [];
110
+ nuxt.options.build.transpile.push("reka-ui", "@tanstack/vue-table", "@powersync/web", "@journeyapps/wa-sqlite");
111
+ if (options.kysely) {
112
+ nuxt.options.build.transpile.push("@powersync/kysely-driver");
113
+ }
114
+ nuxt.hooks.hook("prepare:types", ({ references }) => {
115
+ references.push({ types: "@powersync/web" });
116
+ references.push({ types: "@journeyapps/wa-sqlite" });
117
+ if (options.kysely) {
118
+ references.push({ types: "@powersync/kysely-driver" });
119
+ }
120
+ });
121
+ const assetsDir = resolver.resolve("./runtime/assets");
122
+ nuxt.options.vite = nuxt.options.vite || {};
123
+ nuxt.options.vite.resolve = nuxt.options.vite.resolve || {};
124
+ const existingAlias = nuxt.options.vite.resolve.alias || [];
125
+ const aliasArray = Array.isArray(existingAlias) ? [...existingAlias] : Object.entries(existingAlias).map(([find, replacement]) => ({
126
+ find,
127
+ replacement
128
+ }));
129
+ aliasArray.push({
130
+ find: /^\.\/assets\/(.+)$/,
131
+ replacement: `${assetsDir}/$1`
132
+ });
133
+ nuxt.options.vite.resolve.alias = aliasArray;
134
+ nuxt.hook("vite:extendConfig", async (config, { isClient }) => {
135
+ if (!isClient) return;
136
+ const { readFileSync } = await import('node:fs');
137
+ const assetPath = resolver.resolve("./runtime/assets/powersync-icon.svg");
138
+ const vitePlugin = {
139
+ name: "powersync-assets",
140
+ configureServer(server) {
141
+ server.middlewares.use("/assets/powersync-icon.svg", (req, res, next) => {
142
+ try {
143
+ const content = readFileSync(assetPath);
144
+ res.setHeader("Content-Type", "image/svg+xml");
145
+ res.end(content);
146
+ } catch {
147
+ next();
148
+ }
149
+ });
150
+ }
151
+ };
152
+ const plugins = config.plugins || [];
153
+ plugins.push(vitePlugin);
154
+ config.plugins = plugins;
155
+ });
156
+ setupDevToolsUI(nuxt);
157
+ }
158
+ });
159
+
160
+ export { module$1 as default };
@@ -0,0 +1,14 @@
1
+ <svg width="70" height="48" viewBox="0 0 70 48" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M68.3875 25.6594L60.2117 11.8629C59.2046 10.1633 57.344 9.1167 55.3298 9.1167H46.9058C46.1825 9.1167 45.7302 9.87957 46.0919 10.4901L47.9203 13.5763C48.2564 14.1424 48.8764 14.4915 49.5474 14.4915H53.229C54.5716 14.4915 55.8122 15.1896 56.4838 16.3225L62.5595 26.5752C63.2311 27.7081 63.2311 29.1037 62.5595 30.2366L56.4838 40.4893C55.8129 41.6222 54.5716 42.3204 53.229 42.3204H41.0777C39.7351 42.3204 38.4945 41.6222 37.8229 40.4893L24.6813 18.313C24.3196 17.7025 24.7719 16.9402 25.4952 16.9402H29.1761C29.8994 16.9402 30.3516 16.1774 29.99 15.5675L28.1616 12.4813C27.8254 11.9152 27.2055 11.5661 26.5338 11.5661H18.5828C17.9112 11.5661 17.2912 11.9152 16.9551 12.4813L12.9796 19.1903C12.6441 19.7564 12.6441 20.4546 12.9796 21.0213L14.808 24.1075C15.1696 24.7174 16.0734 24.7174 16.4357 24.1075L18.2762 21.0017C18.6379 20.3918 19.5417 20.3918 19.9033 21.0017L34.095 44.9502C35.1021 46.6499 36.9627 47.6964 38.9776 47.6964H55.3291C57.3433 47.6964 59.2039 46.6492 60.2117 44.9502L68.3875 31.1538C69.3946 29.4541 69.3946 27.3603 68.3875 25.6613V25.6594Z" fill="url(#paint0_linear_22_1000)"/>
3
+ <path d="M21.7933 34.935C21.4578 34.3683 20.8372 34.0198 20.1662 34.0198H16.4846C15.142 34.0198 13.9014 33.3217 13.2297 32.1888L7.15412 21.9361C6.48248 20.8032 6.48248 19.4075 7.15412 18.2747L13.2297 8.02196C13.9014 6.88909 15.142 6.19093 16.4846 6.19093H28.6365C29.9791 6.19093 31.2197 6.88909 31.8914 8.02196L45.033 30.1983C45.3946 30.8088 44.9424 31.571 44.2191 31.571H40.5382C39.8149 31.571 39.3626 32.3339 39.7243 32.9438L41.5527 36.03C41.8881 36.5967 42.5088 36.9452 43.1798 36.9452H51.1307C51.8024 36.9452 52.4224 36.5961 52.7578 36.03L56.7333 29.321C57.0695 28.7549 57.0695 28.0567 56.7333 27.49L54.9049 24.4038C54.5433 23.7939 53.6395 23.7939 53.2778 24.4038L51.4374 27.5102C51.0757 28.1201 50.1719 28.1201 49.8096 27.5102L35.6179 3.56238C34.6108 1.8634 32.7502 0.816162 30.736 0.816162H14.3845C12.3702 0.816162 10.5096 1.8634 9.50251 3.56238L1.32675 17.3588C0.31963 19.0578 0.31963 21.1516 1.32675 22.8513L9.50251 36.6477C10.5096 38.3474 12.3709 39.3939 14.3851 39.3939H22.8092C23.5325 39.3939 23.984 38.6311 23.623 38.0212L21.794 34.935H21.7933Z" fill="url(#paint1_linear_22_1000)"/>
4
+ <defs>
5
+ <linearGradient id="paint0_linear_22_1000" x1="17.4274" y1="11.6845" x2="63.6811" y2="39.0946" gradientUnits="userSpaceOnUse">
6
+ <stop stop-color="#0055FF"/>
7
+ <stop offset="1" stop-color="#00D5FF"/>
8
+ </linearGradient>
9
+ <linearGradient id="paint1_linear_22_1000" x1="52.2868" y1="36.8262" x2="6.03308" y2="9.41672" gradientUnits="userSpaceOnUse">
10
+ <stop stop-color="#0055FF"/>
11
+ <stop offset="1" stop-color="#AA00FF"/>
12
+ </linearGradient>
13
+ </defs>
14
+ </svg>
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;