@pylonsync/create-pylon 0.3.181 → 0.3.182
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pylonsync/create-pylon",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.182",
|
|
4
4
|
"description": "Scaffold a new Pylon app — realtime backend + web/mobile/expo frontends in one command. Run via `npm create @pylonsync/pylon@latest`.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -2,22 +2,37 @@ import { defineConfig, type ProxyOptions } from "vite";
|
|
|
2
2
|
import react from "@vitejs/plugin-react";
|
|
3
3
|
import tailwindcss from "@tailwindcss/vite";
|
|
4
4
|
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
|
|
5
|
+
// Pylon dev exposes TWO ports:
|
|
6
|
+
// :4321 → HTTP (functions, entity CRUD, /api/sync/pull, /api/auth/*)
|
|
7
|
+
// :4322 → dedicated WebSocket listener with TCP read timeouts set
|
|
8
|
+
// on the raw socket. Broadcasts flow immediately because
|
|
9
|
+
// the reader thread's mutex is released every 200ms by the
|
|
10
|
+
// kernel-level read timeout — no client keepalive ping
|
|
11
|
+
// needed to break the wedge.
|
|
12
|
+
//
|
|
13
|
+
// We route the WS upgrade to :4322 and everything else to :4321. The
|
|
14
|
+
// HTTP-multiplexed `/api/sync/ws` on :4321 also works (and is the
|
|
15
|
+
// production fallback for proxies that can't forward to a secondary
|
|
16
|
+
// port), but it can't set stream-level timeouts because tiny_http's
|
|
17
|
+
// `CustomStream` hides the underlying TcpStream — so broadcasts there
|
|
18
|
+
// are latency-bounded by the client SDK's 200ms keepalive ping.
|
|
19
|
+
const PYLON_HTTP_TARGET = process.env.PYLON_TARGET ?? "http://localhost:4321";
|
|
20
|
+
const PYLON_WS_TARGET = process.env.PYLON_WS_TARGET ?? "ws://localhost:4322";
|
|
11
21
|
|
|
12
22
|
const proxyConfig: Record<string, string | ProxyOptions> = {
|
|
13
|
-
//
|
|
23
|
+
// WebSocket sync: forward upgrade to the dedicated :4322 listener.
|
|
24
|
+
// Must come BEFORE the catch-all /api entry so this more-specific
|
|
25
|
+
// path wins for WS connections. The dedicated listener handshakes
|
|
26
|
+
// on any path so we don't bother rewriting.
|
|
27
|
+
"/api/sync/ws": {
|
|
28
|
+
target: PYLON_WS_TARGET,
|
|
29
|
+
ws: true,
|
|
30
|
+
changeOrigin: true,
|
|
31
|
+
},
|
|
32
|
+
// HTTP — /api/auth/*, /api/fn/*, /api/sync/pull, /api/entities/*, etc.
|
|
14
33
|
"/api": {
|
|
15
|
-
target:
|
|
34
|
+
target: PYLON_HTTP_TARGET,
|
|
16
35
|
changeOrigin: true,
|
|
17
|
-
// Vite's http-proxy needs ws:true for the WebSocket upgrade
|
|
18
|
-
// to propagate. Without it `/api/sync/ws` 404s and db.useQuery
|
|
19
|
-
// hangs in a "connecting" state forever.
|
|
20
|
-
ws: true,
|
|
21
36
|
},
|
|
22
37
|
};
|
|
23
38
|
|