tokenrace 0.2.2 → 0.2.3

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/server.js +11 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokenrace",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Monitor en tiempo real para Claude Code",
5
5
  "bin": {
6
6
  "tokenrace": "bin/cli.js"
package/src/server.js CHANGED
@@ -110,13 +110,22 @@ export async function startServer({ port = 1337 } = {}) {
110
110
  app.use(createRouter({ port }))
111
111
 
112
112
  // ── Archivos estáticos (web compilada) ──────────────────────────────────────
113
- // dist/ está en la raíz del proyecto (un nivel arriba de src/)
113
+ // dist/ está en la raíz del proyecto (un nivel arriba de src/).
114
+ // index.html no debe cachearse: referencia bundles con hash que cambian en
115
+ // cada versión; si el navegador lo cachea, sigue mostrando la app vieja.
114
116
  const distPath = path.join(__dirname, '../dist')
115
- app.use(express.static(distPath))
117
+ app.use(express.static(distPath, {
118
+ setHeaders(res, filePath) {
119
+ if (filePath.endsWith('index.html')) {
120
+ res.setHeader('Cache-Control', 'no-cache')
121
+ }
122
+ }
123
+ }))
116
124
 
117
125
  // SPA fallback: cualquier ruta no-API sirve index.html
118
126
  app.get(/^(?!\/api\/)/, (req, res) => {
119
127
  const indexPath = path.join(distPath, 'index.html')
128
+ res.setHeader('Cache-Control', 'no-cache')
120
129
  res.sendFile(indexPath, (err) => {
121
130
  if (err) res.status(404).send('Dashboard no disponible. Ejecuta: npm run build')
122
131
  })