@rip-lang/server 1.1.3 → 1.1.5

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <img src="https://raw.githubusercontent.com/shreeve/rip-lang/main/docs/rip.svg" style="width:50px" /> <br>
1
+ <img src="https://raw.githubusercontent.com/shreeve/rip-lang/main/docs/rip.png" style="width:50px" /> <br>
2
2
 
3
3
  # Rip Server - @rip-lang/server
4
4
 
@@ -455,6 +455,61 @@ The dashboard uses the same mDNS infrastructure as your app, so it's always avai
455
455
 
456
456
  **Changes not triggering reload**: Make sure you're using `-w` flag for directory watching, or touch your entry file manually.
457
457
 
458
+ ## Serving Rip UI Apps
459
+
460
+ Rip Server works seamlessly with [@rip-lang/ui](../ui/README.md) for serving
461
+ reactive web applications with hot reload. The `ripUI` middleware handles
462
+ framework files, page manifests, and SSE hot-reload — rip-server adds HTTPS,
463
+ mDNS, multi-worker load balancing, and rolling restarts on top.
464
+
465
+ ### Example: Rip UI App
466
+
467
+ Create `index.rip`:
468
+
469
+ ```coffee
470
+ import { get, use, start, notFound } from '@rip-lang/api'
471
+ import { ripUI } from '@rip-lang/ui/serve'
472
+
473
+ dir = import.meta.dir
474
+
475
+ use ripUI dir: dir, components: 'pages', includes: ['ui'], watch: true, title: 'My App'
476
+
477
+ get '/css/*', -> @send "#{dir}/css/#{@req.path.slice(5)}"
478
+
479
+ notFound -> @send "#{dir}/index.html", 'text/html; charset=UTF-8'
480
+
481
+ start()
482
+ ```
483
+
484
+ Run it:
485
+
486
+ ```bash
487
+ rip-server -w
488
+ ```
489
+
490
+ This gives you:
491
+
492
+ - **Framework bundle** served at `/rip/rip-ui.min.js`
493
+ - **App bundle** auto-generated at `/{app}/bundle`
494
+ - **Hot reload** via SSE at `/{app}/watch` — save a `.rip` file and the browser
495
+ updates instantly
496
+ - **HTTPS + mDNS** — access at `https://myapp.local`
497
+ - **Multi-worker** — load balanced across CPU cores
498
+ - **Rolling restarts** — zero-downtime file-watch reloading
499
+
500
+ ### How Hot Reload Works with rip-server
501
+
502
+ When running with `-w`, two layers of hot reload work together:
503
+
504
+ 1. **rip-server file watching** (`-w` flag) — watches for `.rip` file changes
505
+ and triggers rolling worker restarts (server-side reload)
506
+ 2. **ripUI SSE watching** (`watch: true`) — watches the `pages/` and `includes`
507
+ directories and notifies connected browsers via SSE (client-side reload)
508
+
509
+ For development, the SSE hot-reload is usually sufficient — it recompiles
510
+ components in the browser without restarting workers. The `-w` flag is useful
511
+ when server-side code changes (routes, middleware, etc.).
512
+
458
513
  ## Comparison with Other Servers
459
514
 
460
515
  | Feature | rip-server | PM2 | Nginx |
@@ -486,5 +541,6 @@ MIT
486
541
  ## Links
487
542
 
488
543
  - [Rip Language](https://github.com/shreeve/rip-lang)
489
- - [@rip-lang/api](../api/README.md)
544
+ - [@rip-lang/api](../api/README.md) — API framework (routing, middleware, `@send`)
545
+ - [@rip-lang/ui](../ui/README.md) — Zero-build reactive web framework
490
546
  - [Report Issues](https://github.com/shreeve/rip-lang/issues)
package/bin/rip-server CHANGED
@@ -1,17 +1,13 @@
1
1
  #!/usr/bin/env bun
2
2
 
3
- import { execSync } from 'child_process';
3
+ import { execFileSync } from 'child_process';
4
4
  import { fileURLToPath } from 'url';
5
5
  import { dirname, join } from 'path';
6
6
 
7
- const __filename = fileURLToPath(import.meta.url);
8
- const __dirname = dirname(__filename);
9
-
10
- const serverRip = join(__dirname, '..', 'server.rip');
11
- const args = process.argv.slice(2).join(' ');
7
+ const serverRip = join(dirname(fileURLToPath(import.meta.url)), '..', 'server.rip');
12
8
 
13
9
  try {
14
- execSync(`rip ${serverRip} ${args}`, { stdio: 'inherit' });
15
- } catch (error) {
16
- process.exit(error.status || 1);
10
+ execFileSync('rip', [serverRip, ...process.argv.slice(2)], { stdio: 'inherit' });
11
+ } catch (e) {
12
+ process.exit(e.status || 1);
17
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rip-lang/server",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Pure Rip application server — multi-worker, hot reload, HTTPS, mDNS",
5
5
  "type": "module",
6
6
  "main": "server.rip",
@@ -38,8 +38,8 @@
38
38
  "author": "Steve Shreeve <steve.shreeve@gmail.com>",
39
39
  "license": "MIT",
40
40
  "dependencies": {
41
- "rip-lang": "^3.0.2",
42
- "@rip-lang/api": "^1.1.2"
41
+ "rip-lang": "^3.9.1",
42
+ "@rip-lang/api": "^1.1.6"
43
43
  },
44
44
  "files": [
45
45
  "bin/",
package/server.rip CHANGED
@@ -690,12 +690,13 @@ class Server
690
690
  # Helper to start server, incrementing port if needed
691
691
  startOnPort = (p, opts = {}) =>
692
692
  port = p
693
- while true
693
+ while port < p + 100
694
694
  try
695
695
  return Bun.serve(Object.assign({ port, idleTimeout: 8, fetch: fetchFn }, opts))
696
696
  catch e
697
697
  throw e unless e?.code is 'EADDRINUSE'
698
698
  port++
699
+ throw new Error "No available port found (tried #{p}–#{p + 99})"
699
700
 
700
701
  if httpOnly
701
702
  if @flags.httpPort is 0
@@ -820,8 +821,6 @@ class Server
820
821
  worker.inflight = 0
821
822
  if @isCurrentVersion(worker)
822
823
  @availableWorkers.push(worker)
823
- # Force array mutation to be visible (workaround for timing issue)
824
- @availableWorkers.length
825
824
 
826
825
  logAccess: (req, res, totalSeconds, workerSeconds) ->
827
826
  if @flags.jsonLogging