spine-framework 0.1.12 → 0.1.13

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.
@@ -24,21 +24,7 @@ for (let i = 0; i < args.length; i++) {
24
24
  if (args[i] === '--service-role-key' && args[i + 1]) childEnv.SUPABASE_SERVICE_ROLE_KEY = args[++i]
25
25
  }
26
26
 
27
- // On Node < 22, supabase-js Realtime crashes if WebSocket is not globally available.
28
- // Polyfill it via a small inline require so every createClient() call across all
29
- // _shared modules finds a valid WebSocket constructor at module load time.
30
- const wsPolyfillPath = resolve(pkgRoot, 'node_modules/ws')
31
- const wsPolyfillExists = fs.existsSync(wsPolyfillPath)
32
- if (wsPolyfillExists && !childEnv.SUPABASE_WS_PATCHED) {
33
- const major = parseInt(process.version.replace('v', '').split('.')[0], 10)
34
- if (major < 22) {
35
- const wsShimPath = resolve(pkgRoot, 'bin/ws-shim.cjs')
36
- childEnv.NODE_OPTIONS = `--require ${wsShimPath}${childEnv.NODE_OPTIONS ? ' ' + childEnv.NODE_OPTIONS : ''}`
37
- childEnv.SUPABASE_WS_PATCHED = '1'
38
- }
39
- }
40
-
41
- const entry = resolve(pkgRoot, '.framework/cli/index.ts')
27
+ const entry = resolve(pkgRoot, 'bin/ws-shim.ts')
42
28
 
43
29
  // Find tsx: prefer consuming project's copy, fall back to our own
44
30
  const tsxPaths = [
package/bin/ws-shim.ts ADDED
@@ -0,0 +1,10 @@
1
+ // Entry point for the CLI on Node < 22.
2
+ // Sets globalThis.WebSocket before any supabase-js module is imported,
3
+ // preventing the "Node.js 20 detected without native WebSocket" crash.
4
+ import { WebSocket } from 'ws'
5
+ if (typeof globalThis.WebSocket === 'undefined') {
6
+ ;(globalThis as any).WebSocket = WebSocket
7
+ }
8
+
9
+ // Now import the real CLI — all supabase createClient() calls happen after this point
10
+ await import('../.framework/cli/index.ts')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spine-framework",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "private": false,
5
5
  "description": "Spine — enterprise application framework built on Supabase + Netlify + React",
6
6
  "type": "module",