@rip-lang/server 1.3.35 → 1.3.36

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/api.rip CHANGED
@@ -116,7 +116,7 @@ _mimeTypes =
116
116
  '.zip': 'application/zip'
117
117
  '.gz': 'application/gzip'
118
118
  '.wasm': 'application/wasm'
119
- '.rip': 'text/plain; charset=UTF-8'
119
+ '.rip': 'text/x-rip; charset=UTF-8'
120
120
 
121
121
  export mimeType = (path) ->
122
122
  ext = path.substring(path.lastIndexOf('.'))
package/middleware.rip CHANGED
@@ -519,7 +519,7 @@ export serve = (opts = {}) ->
519
519
  # Route: {prefix}/components/* — individual .rip component files
520
520
  get "#{prefix}/components/*", (c) ->
521
521
  name = c.req.path.slice("#{prefix}/components/".length)
522
- c.send "#{routesDir}/#{name}", 'text/plain; charset=UTF-8'
522
+ c.send "#{routesDir}/#{name}", 'text/x-rip; charset=UTF-8'
523
523
 
524
524
  # Route: {prefix}/bundle — all components + app data as JSON (cached + Brotli)
525
525
  bundleCache = { json: null, br: null, etag: null }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rip-lang/server",
3
- "version": "1.3.35",
3
+ "version": "1.3.36",
4
4
  "description": "Pure Rip web framework and application server",
5
5
  "type": "module",
6
6
  "main": "api.rip",
@@ -45,7 +45,7 @@
45
45
  "author": "Steve Shreeve <steve.shreeve@gmail.com>",
46
46
  "license": "MIT",
47
47
  "dependencies": {
48
- "rip-lang": ">=3.13.52"
48
+ "rip-lang": ">=3.13.53"
49
49
  },
50
50
  "files": [
51
51
  "api.rip",
package/server.rip CHANGED
@@ -111,7 +111,7 @@ logAccessJson = (app, req, res, totalSeconds, workerSeconds) ->
111
111
  typeAbbrev =
112
112
  html: 'html', css: 'css', javascript: 'js', json: 'json', plain: 'text'
113
113
  png: 'png', jpeg: 'jpg', gif: 'gif', webp: 'webp', svg: 'svg'
114
- 'svg+xml': 'svg', 'x-icon': 'ico', 'octet-stream': 'bin'
114
+ 'svg+xml': 'svg', 'x-icon': 'ico', 'octet-stream': 'bin', 'x-rip': 'rip'
115
115
 
116
116
  logAccessHuman = (app, req, res, totalSeconds, workerSeconds) ->
117
117
  { timestamp, timezone } = formatTimestamp()
@@ -996,6 +996,14 @@ class Server
996
996
  return new Response('Gateway timeout', { status: 504 })
997
997
  throw err
998
998
 
999
+ processJob: (job, worker) ->
1000
+ @forwardToWorker(job.req, worker)
1001
+ .then((r) -> job.resolve(r))
1002
+ .catch((e) -> job.resolve(if e instanceof Response then e else new Response('Internal error', { status: 500 })))
1003
+ .finally =>
1004
+ @inflightTotal--
1005
+ setImmediate => @drainQueue()
1006
+
999
1007
  drainQueue: ->
1000
1008
  while @inflightTotal < Math.max(1, @sockets.length) and @availableWorkers.length > 0
1001
1009
  job = @queue.shift()
@@ -1008,12 +1016,7 @@ class Server
1008
1016
  unless worker
1009
1017
  @inflightTotal--
1010
1018
  break
1011
- @forwardToWorker(job.req, worker)
1012
- .then((r) -> job.resolve(r))
1013
- .catch((e) -> job.resolve(if e instanceof Response then e else new Response('Internal error', { status: 500 })))
1014
- .finally =>
1015
- @inflightTotal--
1016
- setImmediate => @drainQueue()
1019
+ @processJob(job, worker)
1017
1020
 
1018
1021
  startControl: ->
1019
1022
  ctlPath = getControlSocketPath(@flags.socketPrefix)