@rip-lang/server 0.7.8 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.rip +29 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rip-lang/server",
3
- "version": "0.7.8",
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.rip CHANGED
@@ -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,20 +484,27 @@ class Manager
476
484
  @rollingRestart!.finally => @isRolling = false
477
485
  , 50
478
486
 
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}"
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}"
493
508
 
494
509
  stop: ->
495
510
  for w in @workers