@rip-lang/server 0.7.6 → 0.7.8

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": "@rip-lang/server",
3
- "version": "0.7.6",
3
+ "version": "0.7.8",
4
4
  "description": "Pure Rip application server — multi-worker, hot reload, HTTPS, mDNS",
5
5
  "type": "module",
6
6
  "main": "server.rip",
package/server.html CHANGED
@@ -32,7 +32,7 @@
32
32
  </div>
33
33
  <div>
34
34
  <h1 class="text-2xl font-bold text-gray-900">Rip Server</h1>
35
- <p class="text-sm text-gray-600">Multi-worker runtime</p>
35
+ <p class="text-sm text-gray-600">Multi-worker mode</p>
36
36
  </div>
37
37
  </div>
38
38
  <div class="flex items-center space-x-2">
package/server.rip CHANGED
@@ -12,7 +12,7 @@
12
12
  # bun server.rip list # List registered hosts
13
13
  # ==============================================================================
14
14
 
15
- import { existsSync, statSync, readFileSync, writeFileSync, unlinkSync, mkdirSync } from 'node:fs'
15
+ import { existsSync, statSync, readFileSync, writeFileSync, unlinkSync, mkdirSync, watch, utimesSync } from 'node:fs'
16
16
  import { basename, dirname, isAbsolute, join, resolve } from 'node:path'
17
17
  import { homedir, cpus, networkInterfaces } from 'node:os'
18
18
  import { X509Certificate } from 'node:crypto'
@@ -476,6 +476,21 @@ class Manager
476
476
  @rollingRestart!.finally => @isRolling = false
477
477
  , 50
478
478
 
479
+ # Watch all .rip files in app directory - touch entry file on changes
480
+ entryFile = @flags.appEntry
481
+ entryBase = basename(entryFile)
482
+ try
483
+ watch @flags.appBaseDir, { recursive: true }, (event, filename) =>
484
+ return unless filename?.endsWith('.rip')
485
+ return if filename is entryBase or filename.endsWith("/#{entryBase}")
486
+ try
487
+ now = new Date()
488
+ utimesSync(entryFile, now, now)
489
+ catch
490
+ null
491
+ catch e
492
+ console.warn "rip-server: directory watch failed: #{e.message}"
493
+
479
494
  stop: ->
480
495
  for w in @workers
481
496
  try w.process.kill() catch then null
@@ -615,6 +630,11 @@ class Server
615
630
  @httpsActive = false
616
631
  @hostRegistry = new Set(['localhost', '127.0.0.1', 'rip.local'])
617
632
  @mdnsProcesses = new Map()
633
+ try
634
+ pkg = JSON.parse(readFileSync(import.meta.dir + '/package.json', 'utf8'))
635
+ @serverVersion = pkg.version
636
+ catch
637
+ @serverVersion = 'unknown'
618
638
 
619
639
  for alias in @flags.appAliases
620
640
  host = if alias.includes('.') then alias else "#{alias}.local"
@@ -729,8 +749,10 @@ class Server
729
749
  uptime = Math.floor((nowMs() - @startedAt) / 1000)
730
750
  healthy = @sockets.length > 0
731
751
  hosts = Array.from(@hostRegistry.values())
752
+ version = @serverVersion
732
753
  body = JSON.stringify
733
754
  status: if healthy then 'healthy' else 'degraded'
755
+ version: version
734
756
  app: @flags.appName
735
757
  workers: @sockets.length
736
758
  ports: { http: @flags.httpPort or undefined, https: @flags.httpsPort or undefined }