@livestore/devtools-vite 0.3.0-dev.4 → 0.3.0-dev.40
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 +17 -0
- package/dist/devtools-bundle/data-grid-overlay-editor-CgH6-SGv.js +103 -0
- package/dist/devtools-bundle/devtools-react-bundle-1K1hg3N1.js +137759 -0
- package/dist/devtools-bundle/devtools-vite.css +1 -0
- package/dist/devtools-bundle/index-DyO0wANa.js +44 -0
- package/dist/devtools-bundle/index.js +4 -0
- package/dist/devtools-bundle/mod-2ScWT2NO.js +368 -0
- package/dist/devtools-bundle/number-overlay-editor-BDglymMb.js +596 -0
- package/dist/empty-module.d.ts +3 -0
- package/dist/empty-module.d.ts.map +1 -0
- package/dist/empty-module.js +3 -0
- package/dist/empty-module.js.map +1 -0
- package/dist/plugin.d.ts +28 -5
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +200 -48
- package/dist/plugin.js.map +1 -1
- package/dist/vite-path.d.ts +5 -0
- package/dist/vite-path.d.ts.map +1 -0
- package/dist/vite-path.js +6 -0
- package/dist/vite-path.js.map +1 -0
- package/dist/vite-path.test.d.ts +2 -0
- package/dist/vite-path.test.d.ts.map +1 -0
- package/dist/vite-path.test.js +14 -0
- package/dist/vite-path.test.js.map +1 -0
- package/package.json +8 -19
- package/dist/.tsbuildinfo +0 -1
- package/dist/devtools.d.ts +0 -2
- package/dist/devtools.d.ts.map +0 -1
- package/dist/devtools.js +0 -2
- package/dist/devtools.js.map +0 -1
- package/index.css +0 -1
- package/src/devtools.ts +0 -1
- package/src/plugin.ts +0 -112
- package/tsconfig.json +0 -12
package/dist/plugin.js
CHANGED
|
@@ -1,52 +1,207 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
1
|
import path from 'node:path';
|
|
2
|
+
import { Devtools } from '@livestore/common';
|
|
3
|
+
import { Schema } from '@livestore/utils/effect';
|
|
4
|
+
import { getMountPath } from './vite-path.js';
|
|
5
|
+
const IS_LOCAL_PREVIEW = process.env.LSD_DEVTOOLS_LOCAL_PREVIEW !== undefined;
|
|
6
|
+
export const PluginOptions = Schema.Struct({
|
|
7
|
+
/**
|
|
8
|
+
* The path to the schema file. The schema file needs to export the schema as `export const schema`.
|
|
9
|
+
* Path needs to be relative to the Vite `root`.
|
|
10
|
+
*
|
|
11
|
+
* Example:
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { devtoolsVitePlugin } from '@livestore/devtools-vite'
|
|
14
|
+
*
|
|
15
|
+
* devtoolsVitePlugin({
|
|
16
|
+
* schemaPath: './src/db/schema/index.ts'
|
|
17
|
+
* // ...
|
|
18
|
+
* })
|
|
19
|
+
*
|
|
20
|
+
* If your app uses multiple schemas, you can provide an array of schema paths.
|
|
21
|
+
* ```ts
|
|
22
|
+
* devtoolsVitePlugin({
|
|
23
|
+
* schemaPath: ['./src/db/schema/index.ts', './src/db/schema2/index.ts']
|
|
24
|
+
* // ...
|
|
25
|
+
* })
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
schemaPath: Schema.Union(Schema.String, Schema.Array(Schema.String)),
|
|
29
|
+
license: Schema.optional(Schema.String),
|
|
30
|
+
/**
|
|
31
|
+
* Where to serve the devtools UI.
|
|
32
|
+
*
|
|
33
|
+
* @default '/_livestore'
|
|
34
|
+
*/
|
|
35
|
+
mode: Schema.optional(Devtools.DevtoolsMode),
|
|
36
|
+
path: Schema.optional(Schema.String),
|
|
37
|
+
experimental: Schema.optional(Schema.Struct({
|
|
38
|
+
continueOnError: Schema.optional(Schema.Boolean),
|
|
39
|
+
})),
|
|
40
|
+
});
|
|
41
|
+
const pluginName = '@livestore/devtools-vite';
|
|
3
42
|
export const livestoreDevtoolsPlugin = (options) => {
|
|
43
|
+
const result = Schema.validateEither(PluginOptions)(options);
|
|
44
|
+
if (result._tag === 'Left') {
|
|
45
|
+
console.error(`[@livestore/devtools-vite] Invalid options: ${result.left}`);
|
|
46
|
+
return {
|
|
47
|
+
name: pluginName,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
4
50
|
return {
|
|
5
|
-
name:
|
|
51
|
+
name: pluginName,
|
|
6
52
|
// `vite dev` support
|
|
7
|
-
configureServer: (server) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
53
|
+
configureServer: async (server) => {
|
|
54
|
+
const mountPath = getMountPath({ path: options.path, base: server.config.base });
|
|
55
|
+
// console.debug('[livestore-devtools-vite]', {
|
|
56
|
+
// 'server.config.base': server.config.base,
|
|
57
|
+
// mountPath,
|
|
58
|
+
// })
|
|
59
|
+
const schemaPathsInput = Array.isArray(options.schemaPath) ? options.schemaPath : [options.schemaPath];
|
|
60
|
+
const schemaPaths = schemaPathsInput.map((schemaPath) => path.isAbsolute(schemaPath) ? schemaPath : path.resolve(path.join(server.config.root, schemaPath)));
|
|
61
|
+
for (const schemaPath of schemaPaths) {
|
|
62
|
+
try {
|
|
63
|
+
const schemaExports = await server.ssrLoadModule(schemaPath);
|
|
64
|
+
if (!('schema' in schemaExports)) {
|
|
65
|
+
console.error(`\
|
|
66
|
+
[@livestore/devtools-vite] Could not find an export named \`schema\` in the provided schema file.
|
|
67
|
+
Please make sure to export the schema from your schema file like this: \`export const schema = ...\`.
|
|
68
|
+
|
|
69
|
+
Found exports: ${Object.keys(schemaExports).join(', ')}
|
|
70
|
+
Resolved schema path: ${schemaPath}
|
|
71
|
+
`);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.error(`[@livestore/devtools-vite] Error loading schema file ${schemaPath}`, error);
|
|
77
|
+
if (options.experimental?.continueOnError !== true) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
let bundlePath;
|
|
83
|
+
let cssPath;
|
|
84
|
+
// Allows for loading the devtools via Vite without having to build the bundle
|
|
85
|
+
// Simply set `LSD_DEVTOOLS_LOCAL_PREVIEW=1` when running `pnpm dev` in the app
|
|
86
|
+
if (IS_LOCAL_PREVIEW) {
|
|
87
|
+
cssPath = path.resolve(import.meta.dirname, '..', '..', 'devtools-react', 'src', 'index.css');
|
|
88
|
+
bundlePath = path.join(import.meta.dirname, '..', 'devtools-react-bundle.ts');
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
// Make sure to run `pnpm build` before to generate the bundle
|
|
92
|
+
const bundleDir = path.join(import.meta.dirname, '..', 'dist', 'devtools-bundle');
|
|
93
|
+
bundlePath = path.resolve(bundleDir, 'index.js');
|
|
94
|
+
cssPath = path.resolve(bundleDir, 'devtools-vite.css');
|
|
95
|
+
}
|
|
96
|
+
const hasWebAdapterDep = await server
|
|
97
|
+
.ssrLoadModule('@livestore/adapter-web')
|
|
98
|
+
.then(() => true)
|
|
99
|
+
.catch(() => false);
|
|
100
|
+
const template = makeIndexHtml({
|
|
101
|
+
schemaPaths,
|
|
102
|
+
bundlePath,
|
|
103
|
+
cssPath,
|
|
104
|
+
mountPath,
|
|
105
|
+
mode: options.mode,
|
|
106
|
+
hasWebAdapterDep,
|
|
107
|
+
});
|
|
108
|
+
const html = await server.transformIndexHtml(mountPath, template);
|
|
109
|
+
server.middlewares.use(mountPath, async (req, res, next) => {
|
|
110
|
+
if (req.url === undefined) {
|
|
111
|
+
next();
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const url = new URL(req.url, typeof server.config.server.host === 'string' ? server.config.server.host : 'http://localhost');
|
|
115
|
+
// console.log('livestore-devtools-vite:req', url)
|
|
116
|
+
// Forward all Vite requests to Vite
|
|
117
|
+
if (url.pathname.startsWith('/@') === false) {
|
|
118
|
+
res.setHeader('Content-Type', 'text/html');
|
|
119
|
+
// Remove line that contains `vinxi/runtime`
|
|
120
|
+
const trimmedHtml = html
|
|
121
|
+
.split('\n')
|
|
122
|
+
.filter((line) => !line.includes('vinxi/runtime'))
|
|
123
|
+
.join('\n');
|
|
124
|
+
res.end(trimmedHtml);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
next();
|
|
128
|
+
}
|
|
13
129
|
});
|
|
14
130
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
config.build = {};
|
|
131
|
+
config: async (config, env) => {
|
|
132
|
+
if (config.optimizeDeps === undefined) {
|
|
133
|
+
config.optimizeDeps = {};
|
|
19
134
|
}
|
|
20
|
-
if (config.
|
|
21
|
-
config.
|
|
135
|
+
if (config.optimizeDeps.exclude === undefined) {
|
|
136
|
+
config.optimizeDeps.exclude = [];
|
|
22
137
|
}
|
|
23
|
-
if (
|
|
24
|
-
config.
|
|
25
|
-
|
|
26
|
-
}
|
|
138
|
+
if (env.command === 'serve') {
|
|
139
|
+
if (config.define === undefined) {
|
|
140
|
+
config.define = {};
|
|
141
|
+
}
|
|
142
|
+
const mountPath = getMountPath({ path: options.path, base: config.base ?? '/' });
|
|
143
|
+
config.define['LIVESTORE_DEVTOOLS_PATH'] = `'${mountPath}'`;
|
|
27
144
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
writeBundle: (_) => {
|
|
35
|
-
fs.renameSync(path.join(_.dir, 'virtual:_devtools.html'), path.join(_.dir, '_devtools.html'));
|
|
36
|
-
},
|
|
37
|
-
resolveId: (id) => {
|
|
38
|
-
if (id === 'virtual:_devtools.html') {
|
|
39
|
-
return id;
|
|
145
|
+
const toAdd = ['@livestore/devtools-vite', '@livestore/wa-sqlite'];
|
|
146
|
+
for (const dep of toAdd) {
|
|
147
|
+
if (!config.optimizeDeps.exclude.includes(dep)) {
|
|
148
|
+
config.optimizeDeps.exclude.push(dep);
|
|
149
|
+
}
|
|
40
150
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
151
|
+
if (IS_LOCAL_PREVIEW) {
|
|
152
|
+
console.debug(`[@livestore/devtools-vite] Using local preview`);
|
|
153
|
+
if (config.resolve === undefined) {
|
|
154
|
+
config.resolve = {};
|
|
155
|
+
}
|
|
156
|
+
if (config.resolve.alias === undefined) {
|
|
157
|
+
config.resolve.alias = {};
|
|
158
|
+
}
|
|
159
|
+
const emptyModulePath = path.resolve(import.meta.dirname, '..', 'src', 'empty-module.ts');
|
|
160
|
+
// @ts-expect-error needed for `glide-data-grid`
|
|
161
|
+
config.resolve.alias['react-responsive-carousel'] = emptyModulePath;
|
|
162
|
+
// @ts-expect-error needed for `glide-data-grid`
|
|
163
|
+
config.resolve.alias['marked'] = emptyModulePath;
|
|
45
164
|
}
|
|
165
|
+
return config;
|
|
46
166
|
},
|
|
167
|
+
// `vite build` support below
|
|
168
|
+
// TODO maybe bring back at some point
|
|
169
|
+
// config: (config) => {
|
|
170
|
+
// if (config.build === undefined) {
|
|
171
|
+
// config.build = {}
|
|
172
|
+
// }
|
|
173
|
+
// if (config.build.rollupOptions === undefined) {
|
|
174
|
+
// config.build.rollupOptions = {}
|
|
175
|
+
// }
|
|
176
|
+
// if (config.build.rollupOptions.input === undefined) {
|
|
177
|
+
// config.build.rollupOptions.input = {
|
|
178
|
+
// main: path.resolve('./index.html'),
|
|
179
|
+
// }
|
|
180
|
+
// }
|
|
181
|
+
// if (isRecord(config.build.rollupOptions.input)) {
|
|
182
|
+
// config.build.rollupOptions.input.devtools = 'virtual:_devtools.html'
|
|
183
|
+
// // config.build.rollupOptions.input.devtools = '_devtools.html'
|
|
184
|
+
// }
|
|
185
|
+
// return config
|
|
186
|
+
// },
|
|
187
|
+
// writeBundle: (_) => {
|
|
188
|
+
// fs.renameSync(path.join(_.dir!, 'virtual:_devtools.html'), path.join(_.dir!, '_devtools.html'))
|
|
189
|
+
// },
|
|
190
|
+
// resolveId: (id) => {
|
|
191
|
+
// if (id === 'virtual:_devtools.html') {
|
|
192
|
+
// return id
|
|
193
|
+
// }
|
|
194
|
+
// },
|
|
195
|
+
// load: (id) => {
|
|
196
|
+
// if (id === 'virtual:_devtools.html') {
|
|
197
|
+
// return makeIndexHtml({ schemaPath: options.schemaPath })
|
|
198
|
+
// }
|
|
199
|
+
// },
|
|
47
200
|
};
|
|
48
201
|
};
|
|
49
|
-
const makeIndexHtml = ({
|
|
202
|
+
const makeIndexHtml = ({ schemaPaths, bundlePath, cssPath, mountPath, mode, hasWebAdapterDep, }) => {
|
|
203
|
+
// `sharedWorker` is only needed for @livestore/adapter-web
|
|
204
|
+
// We're trying to import it dynamically for the web-adapter and fallback to the bundled one if it fails
|
|
50
205
|
return /*html*/ `
|
|
51
206
|
<!doctype html>
|
|
52
207
|
<html lang="en">
|
|
@@ -59,25 +214,22 @@ const makeIndexHtml = ({ schemaPath }) => {
|
|
|
59
214
|
<body>
|
|
60
215
|
<div id="root"></div>
|
|
61
216
|
<script type="module">
|
|
62
|
-
|
|
63
|
-
// as it's not a direct dependency of the Vite setup of a plugin user
|
|
64
|
-
import '@livestore/devtools-vite/index.css'
|
|
65
|
-
import { mountDevtools } from '@livestore/devtools-vite/devtools'
|
|
66
|
-
import sharedWorker from '@livestore/web/shared-worker?sharedworker'
|
|
67
|
-
import { schema } from '${path.resolve(schemaPath)}'
|
|
217
|
+
import '${cssPath}'
|
|
68
218
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
219
|
+
import { run } from '${bundlePath}'
|
|
220
|
+
${schemaPaths.map((schemaPath, index) => ` import { schema as schema${index} } from '${schemaPath}'`).join('\n')}
|
|
221
|
+
${hasWebAdapterDep ? 'import sharedWorker from "@livestore/adapter-web/shared-worker?sharedworker"' : 'const sharedWorker = undefined'}
|
|
222
|
+
|
|
223
|
+
run({
|
|
224
|
+
schemas: [${schemaPaths.map((_schemaPath, index) => `schema${index}`).join(', ')}],
|
|
73
225
|
license: ${process.env.LSD_LICENSE} ? '${process.env.LSD_LICENSE}' : undefined,
|
|
74
|
-
|
|
75
|
-
|
|
226
|
+
mode: ${mode ? Schema.encodeSync(Schema.parseJson(Devtools.DevtoolsMode))(mode) : undefined},
|
|
227
|
+
sharedWorker,
|
|
228
|
+
mountPath: '${mountPath}',
|
|
76
229
|
})
|
|
77
230
|
</script>
|
|
78
231
|
</body>
|
|
79
232
|
</html>
|
|
80
233
|
`;
|
|
81
234
|
};
|
|
82
|
-
const isRecord = (value) => typeof value === 'object' && value !== null;
|
|
83
235
|
//# sourceMappingURL=plugin.js.map
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAGhD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,0BAA0B,KAAK,SAAS,CAAA;AAE7E,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACpE,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACvC;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC;IAC5C,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,YAAY,EAAE,MAAM,CAAC,QAAQ,CAC3B,MAAM,CAAC,MA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,EACP,SAAS,EACT,IAAI,EACJ,gBAAgB,GAQjB,EAAE,EAAE;IACH,2DAA2D;IAC3D,wGAAwG;IACxG,OAAO,QAAQ,CAAC;;;;;;;;;;;;gBAYF,OAAO;;6BAEM,UAAU;EACrC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE,CAAC,kCAAkC,KAAK,YAAY,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC7G,gBAAgB,CAAC,CAAC,CAAC,8EAA8E,CAAC,CAAC,CAAC,gCAAgC;;;oBAGxH,WAAW,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE,CAAC,SAAS,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;mBACrE,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW;gBACxD,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;;sBAE7E,SAAS;;;;;EAK7B,CAAA;AACF,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-path.d.ts","sourceRoot":"","sources":["../src/vite-path.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,YAAY,GAAI,8BAA8B;IAAE,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,KAAG,MAGvG,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-path.js","sourceRoot":"","sources":["../src/vite-path.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAA8C,EAAU,EAAE;IAC/G,MAAM,QAAQ,GAAG,YAAY,IAAI,aAAa,CAAA;IAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAClC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-path.test.d.ts","sourceRoot":"","sources":["../src/vite-path.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { getMountPath } from './vite-path.js';
|
|
3
|
+
describe('getMountPath', () => {
|
|
4
|
+
it('default vite / node adapter case', () => {
|
|
5
|
+
expect(getMountPath({ path: undefined, base: '/' })).toEqual('/_livestore');
|
|
6
|
+
});
|
|
7
|
+
it('Tanstack Start case', () => {
|
|
8
|
+
expect(getMountPath({ path: undefined, base: '/_build' })).toEqual('/_build/_livestore');
|
|
9
|
+
});
|
|
10
|
+
it('Tanstack Start case', () => {
|
|
11
|
+
expect(getMountPath({ path: '/_livestore', base: '/_build' })).toEqual('/_build/_livestore');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=vite-path.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-path.test.js","sourceRoot":"","sources":["../src/vite-path.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;IAC7E,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;QAC7B,MAAM,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAA;IAC1F,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;QAC7B,MAAM,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAA;IAC9F,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,32 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livestore/devtools-vite",
|
|
3
|
-
"version": "0.3.0-dev.
|
|
3
|
+
"version": "0.3.0-dev.40",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/plugin.d.ts",
|
|
8
8
|
"default": "./dist/plugin.js"
|
|
9
9
|
},
|
|
10
|
-
"./
|
|
11
|
-
"types": "./dist/devtools.d.ts",
|
|
12
|
-
"default": "./dist/devtools.js"
|
|
13
|
-
},
|
|
14
|
-
"./index.css": {
|
|
15
|
-
"default": "./index.css"
|
|
16
|
-
}
|
|
10
|
+
"./build": "./build.ts"
|
|
17
11
|
},
|
|
18
12
|
"dependencies": {
|
|
19
|
-
"@livestore/
|
|
20
|
-
"@livestore/web": "0.3.0-dev.4"
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"vite": "^5.4.10"
|
|
24
|
-
},
|
|
25
|
-
"publishConfig": {
|
|
26
|
-
"access": "public"
|
|
13
|
+
"@livestore/adapter-web": "0.3.0-dev.40"
|
|
27
14
|
},
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"vite": "~6.2.1"
|
|
31
20
|
}
|
|
32
21
|
}
|