@xeplr/monitor 1.0.1 → 1.1.0

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/ui/vite.config.js DELETED
@@ -1,56 +0,0 @@
1
- import { defineConfig, loadEnv } from 'vite'
2
- import react from '@vitejs/plugin-react'
3
-
4
- // EVERY API PREFIX THIS APP CALLS.
5
- //
6
- // A path missing from this list does NOT fail loudly — Vite falls through to
7
- // the SPA and serves index.html, so the fetch succeeds and the JSON parse is
8
- // what breaks: `Unexpected token '<'`. Adding a route to the backend is only
9
- // half of shipping an endpoint; it has to be listed here too.
10
- const API_PATHS = [
11
- '/health',
12
- '/whoami',
13
- // The setup page and its status (@xeplr/setup, served by the API before
14
- // sign-in): App settings asks /setup/status while the app restarts.
15
- '/setup',
16
- // Every data address lives under /api, so a PAGE path and a DATA path can
17
- // never collide. Without that split, adding '/tasks' here shadowed the UI's
18
- // own /tasks page — opening it showed raw JSON instead of the app.
19
- '/api'
20
- ]
21
-
22
- export default defineConfig(({ mode }) => {
23
- // Prefix '' so plain names load, not just VITE_-prefixed ones. These are dev
24
- // server settings, not values shipped to the browser.
25
- const env = loadEnv(mode, process.cwd(), '')
26
-
27
- // NO PORT LITERALS. A hardcoded fallback is a second answer to a question
28
- // .env already answers, and it is the one that wins when the file is missing
29
- // — exactly when you want to be told rather than quietly served elsewhere.
30
- const port = Number(env.UI_PORT)
31
- const authUrl = env.AUTH_URL
32
- const apiUrl = env.API_URL
33
- if (!port || !authUrl || !apiUrl) {
34
- throw new Error('ui/.env must set UI_PORT, AUTH_URL and API_URL')
35
- }
36
-
37
- const proxy = {
38
- // Only the real network calls (/auth/api/*), NOT bare /auth — that prefix
39
- // is also used by client-side routes (/auth/login, /auth/profile), which
40
- // must fall through to Vite's SPA index.html rather than the auth backend.
41
- '/auth/api': authUrl
42
- }
43
- API_PATHS.forEach((p) => { proxy[p] = apiUrl })
44
-
45
- return {
46
- plugins: [react()],
47
- // Force every import to THIS app's copy, so hook-using libraries don't
48
- // load twice and break the rules of hooks in ways that read as impossible.
49
- resolve: { dedupe: ['react', 'react-dom', 'react-router-dom', '@xeplr/ui-table', '@xeplr/ui-utils'] },
50
- // 127.0.0.1, not 'localhost': Node resolves 'localhost' to IPv6 (::1)
51
- // first, so the dev server listened on ::1 alone and a browser going to
52
- // 127.0.0.1 was refused.
53
- server: { host: '127.0.0.1', port, strictPort: true, proxy },
54
- preview: { port, strictPort: true }
55
- }
56
- })
File without changes
File without changes