@rip-lang/api 0.5.1 → 0.5.2
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 +7 -3
- package/package.json +1 -1
package/api.rip
CHANGED
|
@@ -300,10 +300,14 @@ runHandler = (c, handler) ->
|
|
|
300
300
|
export startHandler = -> fetch
|
|
301
301
|
|
|
302
302
|
export start = (opts = {}) ->
|
|
303
|
-
# Skip if running under rip-server (worker sets these env vars)
|
|
304
|
-
return if process.env.WORKER_ID? or process.env.SOCKET_PATH?
|
|
305
|
-
|
|
306
303
|
handler = startHandler()
|
|
304
|
+
|
|
305
|
+
# If running under rip-server, set global handler and return
|
|
306
|
+
if process.env.WORKER_ID? or process.env.SOCKET_PATH?
|
|
307
|
+
globalThis.__ripHandler = handler
|
|
308
|
+
return handler
|
|
309
|
+
|
|
310
|
+
# Otherwise start standalone server
|
|
307
311
|
host = opts.host or '0.0.0.0'
|
|
308
312
|
port = opts.port or 3000
|
|
309
313
|
server = Bun.serve { hostname: host, port: port, fetch: handler }
|