@livestore/devtools-expo 0.3.0-dev.17 → 0.3.0-dev.19
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/dist/.tsbuildinfo +1 -1
- package/dist/metro-config.cjs +13 -5
- package/dist/metro-config.cjs.map +1 -1
- package/dist/metro-config.d.cts +1 -0
- package/dist/metro-config.d.cts.map +1 -1
- package/package.json +7 -7
- package/src/metro-config.cts +15 -8
- package/src/types.d.ts +3 -0
- package/tmp/pack.tgz +0 -0
- package/webui/index.html +1 -1
package/dist/metro-config.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports, unicorn/prefer-module
|
|
4
|
-
const {
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports, unicorn/prefer-module, @typescript-eslint/consistent-type-imports
|
|
4
|
+
const { Effect } = require('@livestore/utils/effect');
|
|
5
5
|
/**
|
|
6
6
|
* Patches the Metro config to add a middleware via `config.server.enhanceMiddleware`.
|
|
7
7
|
*/
|
|
@@ -14,7 +14,7 @@ const addLiveStoreDevtoolsMiddleware = (config, options) => {
|
|
|
14
14
|
const previousEnhanceMiddleware = config.server.enhanceMiddleware;
|
|
15
15
|
const enhanceMiddleware = (metroMiddleware, server) => {
|
|
16
16
|
const enhancedMiddleware = previousEnhanceMiddleware(metroMiddleware, server);
|
|
17
|
-
return (req, res, next) => req.url?.startsWith('/
|
|
17
|
+
return (req, res, next) => req.url?.startsWith('/_livestore')
|
|
18
18
|
? viteMiddleware(req, res, () => enhancedMiddleware(req, res, next))
|
|
19
19
|
: enhancedMiddleware(req, res, next);
|
|
20
20
|
};
|
|
@@ -23,9 +23,17 @@ const addLiveStoreDevtoolsMiddleware = (config, options) => {
|
|
|
23
23
|
const makeLiveStoreDevtoolsMiddleware = (options) => {
|
|
24
24
|
// TODO Once Expo supports proper ESM, we can make this a static import
|
|
25
25
|
// const viteServerPromise = makeViteServer(options)
|
|
26
|
-
const viteServerPromise = import('@livestore/adapter-node/devtools').then(({ makeViteServer }) => makeViteServer({
|
|
26
|
+
const viteServerPromise = import('@livestore/adapter-node/devtools').then(({ makeViteServer }) => makeViteServer({
|
|
27
|
+
...options,
|
|
28
|
+
mode: {
|
|
29
|
+
_tag: 'expo',
|
|
30
|
+
storeId: options.storeId ?? 'default',
|
|
31
|
+
clientId: options.clientId ?? 'expo',
|
|
32
|
+
sessionId: options.sessionId ?? 'expo',
|
|
33
|
+
},
|
|
34
|
+
}).pipe(Effect.runPromise));
|
|
27
35
|
const middleware = async (req, res, next) => {
|
|
28
|
-
if (req.url?.startsWith('/
|
|
36
|
+
if (req.url?.startsWith('/_livestore') == false) {
|
|
29
37
|
return next();
|
|
30
38
|
}
|
|
31
39
|
const viteServer = await viteServerPromise;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metro-config.cjs","sourceRoot":"","sources":["../src/metro-config.cts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"metro-config.cjs","sourceRoot":"","sources":["../src/metro-config.cts"],"names":[],"mappings":";;AAEA,oIAAoI;AACpI,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,yBAAyB,CAA6C,CAAA;AAMjG;;GAEG;AACH,MAAM,8BAA8B,GAAG,CAAC,MAAgC,EAAE,OAAgB,EAAE,EAAE;IAC5F,kCAAkC;IAClC,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAC5C,OAAM;IACR,CAAC;IAED,MAAM,cAAc,GAAG,+BAA+B,CAAC,OAAO,CAAC,CAAA;IAE/D,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC,iBAGjC,CAAA;IAEf,MAAM,iBAAiB,GAAG,CAAC,eAA2B,EAAE,MAAW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AE1C,OAAO,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;IAC/C,CAAC,CAAA;IAED,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA;AAOD,iDAAiD;AACjD,MAAM,CAAC,OAAO,GAAG;IACf,8BAA8B;IAC9B,+BAA+B;CAChC,CAAA"}
|
package/dist/metro-config.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metro-config.d.cts","sourceRoot":"","sources":["../src/metro-config.cts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAA;AAKtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAO,KAAK,EAAc,OAAO,EAAE,MAAM,YAAY,CAAA;AAErD;;GAEG;AACH,QAAA,MAAM,8BAA8B,GAAI,QAAQ,WAAW,CAAC,WAAW,CAAC,EAAE,SAAS,OAAO,SAuBzF,CAAA;AAED,QAAA,MAAM,+BAA+B,GAAI,SAAS,OAAO,
|
|
1
|
+
{"version":3,"file":"metro-config.d.cts","sourceRoot":"","sources":["../src/metro-config.cts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAA;AAKtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAO,KAAK,EAAc,OAAO,EAAE,MAAM,YAAY,CAAA;AAErD;;GAEG;AACH,QAAA,MAAM,8BAA8B,GAAI,QAAQ,WAAW,CAAC,WAAW,CAAC,EAAE,SAAS,OAAO,SAuBzF,CAAA;AAED,QAAA,MAAM,+BAA+B,GAAI,SAAS,OAAO,WAexB,IAAI,CAAC,eAAe,OAAO,IAAI,CAAC,cAAc,QAAQ,MAAM,IAAI,kBAWhG,CAAA;AAED,0CAA0C;AAC1C,KAAK,WAAW,CAAC,CAAC,IAAI;IACpB,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC5C,CAAA;AAQD,YAAY,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,CAAA;AAC/E,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livestore/devtools-expo",
|
|
3
|
-
"version": "0.3.0-dev.
|
|
3
|
+
"version": "0.3.0-dev.19",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"types": "./dist/index.d.cts",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@livestore/devtools-vite": "0.3.0-dev.
|
|
7
|
+
"@livestore/devtools-vite": "0.3.0-dev.19",
|
|
8
8
|
"@livestore/wa-sqlite": "1.0.5-dev.2",
|
|
9
9
|
"vite": "6.1.0",
|
|
10
10
|
"ws": "8.18.0",
|
|
11
|
-
"@livestore/
|
|
12
|
-
"@livestore/adapter-web": "0.3.0-dev.
|
|
13
|
-
"@livestore/
|
|
11
|
+
"@livestore/adapter-node": "0.3.0-dev.19",
|
|
12
|
+
"@livestore/adapter-web": "0.3.0-dev.19",
|
|
13
|
+
"@livestore/utils": "0.3.0-dev.19"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/node": "^22.10.10",
|
|
17
17
|
"@types/ws": "^8.5.12",
|
|
18
|
-
"expo": "^52.0.
|
|
18
|
+
"expo": "^52.0.37"
|
|
19
19
|
},
|
|
20
20
|
"main": "./dist/index.cjs",
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"expo": "~52.0.
|
|
22
|
+
"expo": "~52.0.37"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|
package/src/metro-config.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type * as http from 'node:http'
|
|
2
2
|
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports, unicorn/prefer-module
|
|
4
|
-
const {
|
|
5
|
-
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports, unicorn/prefer-module, @typescript-eslint/consistent-type-imports
|
|
4
|
+
const { Effect } = require('@livestore/utils/effect') as typeof import('@livestore/utils/effect')
|
|
5
|
+
|
|
6
6
|
import type { MetroConfig } from 'expo/metro-config'
|
|
7
7
|
|
|
8
8
|
import type { Middleware, Options } from './types.js'
|
|
@@ -27,7 +27,7 @@ const addLiveStoreDevtoolsMiddleware = (config: MutableDeep<MetroConfig>, option
|
|
|
27
27
|
const enhancedMiddleware = previousEnhanceMiddleware(metroMiddleware, server)
|
|
28
28
|
|
|
29
29
|
return (req, res, next) =>
|
|
30
|
-
req.url?.startsWith('/
|
|
30
|
+
req.url?.startsWith('/_livestore')
|
|
31
31
|
? viteMiddleware(req, res, () => enhancedMiddleware(req, res, next))
|
|
32
32
|
: enhancedMiddleware(req, res, next)
|
|
33
33
|
}
|
|
@@ -39,13 +39,19 @@ const makeLiveStoreDevtoolsMiddleware = (options: Options) => {
|
|
|
39
39
|
// TODO Once Expo supports proper ESM, we can make this a static import
|
|
40
40
|
// const viteServerPromise = makeViteServer(options)
|
|
41
41
|
const viteServerPromise = import('@livestore/adapter-node/devtools').then(({ makeViteServer }) =>
|
|
42
|
-
makeViteServer({
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
makeViteServer({
|
|
43
|
+
...options,
|
|
44
|
+
mode: {
|
|
45
|
+
_tag: 'expo',
|
|
46
|
+
storeId: options.storeId ?? 'default',
|
|
47
|
+
clientId: options.clientId ?? 'expo',
|
|
48
|
+
sessionId: options.sessionId ?? 'expo',
|
|
49
|
+
},
|
|
50
|
+
}).pipe(Effect.runPromise),
|
|
45
51
|
)
|
|
46
52
|
|
|
47
53
|
const middleware = async (req: http.IncomingMessage, res: http.ServerResponse, next: () => void) => {
|
|
48
|
-
if (req.url?.startsWith('/
|
|
54
|
+
if (req.url?.startsWith('/_livestore') == false) {
|
|
49
55
|
return next()
|
|
50
56
|
}
|
|
51
57
|
|
|
@@ -69,3 +75,4 @@ module.exports = {
|
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
export type { addLiveStoreDevtoolsMiddleware, makeLiveStoreDevtoolsMiddleware }
|
|
78
|
+
export type { Options } from './types.js'
|
package/src/types.d.ts
CHANGED
package/tmp/pack.tgz
ADDED
|
Binary file
|
package/webui/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>LiveStore DevTools Redirect</title>
|
|
7
7
|
<script>
|
|
8
8
|
const currentUrl = new URL(window.location.href);
|
|
9
|
-
const redirectUrl = `http://localhost:${currentUrl.port}/
|
|
9
|
+
const redirectUrl = `http://localhost:${currentUrl.port}/_livestore`;
|
|
10
10
|
window.location.href = redirectUrl;
|
|
11
11
|
</script>
|
|
12
12
|
</head>
|