@rip-lang/server 0.7.7 → 0.7.9

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.7",
3
+ "version": "0.7.9",
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'
@@ -281,6 +281,13 @@ parseFlags = (argv) ->
281
281
  # Debug mode
282
282
  _debugMode = has('--debug')
283
283
 
284
+ # Watch mode: -w, --watch, -w=glob, --watch=glob
285
+ watchGlob = do ->
286
+ return getKV('-w=') if getKV('-w=')?
287
+ return getKV('--watch=') if getKV('--watch=')?
288
+ return '*.rip' if has('-w') or has('--watch')
289
+ null
290
+
284
291
  httpsPort = do ->
285
292
  kv = getKV('--https-port=')
286
293
  return coerceInt(kv, 443) if kv?
@@ -310,6 +317,7 @@ parseFlags = (argv) ->
310
317
  readTimeoutMs: coerceInt(getKV('--read-timeout-ms='), coerceInt(process.env.RIP_READ_TIMEOUT_MS, 5000))
311
318
  jsonLogging: has('--json-logging')
312
319
  accessLog: not has('--no-access-log')
320
+ watchGlob: watchGlob
313
321
  }
314
322
 
315
323
  # ==============================================================================
@@ -476,6 +484,28 @@ class Manager
476
484
  @rollingRestart!.finally => @isRolling = false
477
485
  , 50
478
486
 
487
+ # Watch files in app directory - touch entry file on changes (opt-in via -w/--watch)
488
+ if @flags.watchGlob
489
+ entryFile = @flags.appEntry
490
+ entryBase = basename(entryFile)
491
+ watchExt = if @flags.watchGlob.startsWith('*.') then @flags.watchGlob.slice(1) else null
492
+ try
493
+ watch @flags.appBaseDir, { recursive: true }, (event, filename) =>
494
+ return unless filename
495
+ # Match by extension (e.g., *.rip) or exact glob
496
+ if watchExt
497
+ return unless filename.endsWith(watchExt)
498
+ else
499
+ return unless filename is @flags.watchGlob or filename.endsWith("/#{@flags.watchGlob}")
500
+ return if filename is entryBase or filename.endsWith("/#{entryBase}")
501
+ try
502
+ now = new Date()
503
+ utimesSync(entryFile, now, now)
504
+ catch
505
+ null
506
+ catch e
507
+ console.warn "rip-server: directory watch failed: #{e.message}"
508
+
479
509
  stop: ->
480
510
  for w in @workers
481
511
  try w.process.kill() catch then null