@myrialabs/clopen 0.4.12 → 0.4.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.
package/backend/index.ts CHANGED
@@ -8,7 +8,11 @@ if (typeof globalThis.Bun === 'undefined') {
8
8
  process.exit(1);
9
9
  }
10
10
 
11
- // MUST be first import — cleans process.env before any other module reads it
11
+ // MUST be first import — patches Bun's missing node:v8 isBuildingSnapshot before
12
+ // any module (transitively mongodb/bson) loads and crashes at import time.
13
+ import './utils/bun-compat';
14
+
15
+ // Cleans process.env before any other feature module reads it.
12
16
  import { SERVER_ENV } from './utils/env';
13
17
 
14
18
  import { Elysia } from 'elysia';
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Bun compatibility shims — applied as a side effect at process startup.
3
+ *
4
+ * `node:v8` `startupSnapshot.isBuildingSnapshot()` is not implemented in Bun
5
+ * (calling it throws `ERR_NOT_IMPLEMENTED`). `bson` >= 7.3.0 invokes it inside a
6
+ * module-level `static {}` block, so importing `mongodb` crashes the process at
7
+ * load time on Bun — before Clopen can even start.
8
+ *
9
+ * We cannot reliably pin the transitive `bson` for end users: they install via
10
+ * `bun add -g @myrialabs/clopen`, where Clopen is a dependency rather than the
11
+ * root package, so its `overrides`/exact pins are ignored and Bun re-resolves
12
+ * `mongodb`'s `bson: "^7.2.0"` to the newest (broken) version. Instead we
13
+ * neutralize the missing API by replacing the throwing stub with a no-op that
14
+ * reports "not building a snapshot" — always true for a normally-running
15
+ * process, so `bson` skips its snapshot branch and loads cleanly.
16
+ *
17
+ * Import this before any module that (transitively) imports `mongodb`/`bson`.
18
+ */
19
+
20
+ if (typeof globalThis.Bun !== 'undefined') {
21
+ const v8 = (process as { getBuiltinModule?: (name: string) => unknown }).getBuiltinModule?.('v8') as
22
+ | { startupSnapshot?: { isBuildingSnapshot?: () => boolean } }
23
+ | undefined;
24
+
25
+ if (v8?.startupSnapshot && typeof v8.startupSnapshot.isBuildingSnapshot === 'function') {
26
+ try {
27
+ v8.startupSnapshot.isBuildingSnapshot = () => false;
28
+ } catch {
29
+ // Property is non-writable in this runtime — best effort, nothing else to do.
30
+ }
31
+ }
32
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myrialabs/clopen",
3
- "version": "0.4.12",
3
+ "version": "0.4.13",
4
4
  "description": "All-in-one web workspace for AI coding agents — Claude Code, OpenCode, Codex, Copilot, and Qwen Code — with chat, terminal, git, browser preview, database client, checkpoints, and real-time collaboration",
5
5
  "author": "Myria Labs",
6
6
  "license": "MIT",
@@ -109,7 +109,6 @@
109
109
  "@opencode-ai/sdk": "1.15.12",
110
110
  "@qwen-code/sdk": "0.1.7",
111
111
  "@sinclair/typebox": "0.34.48",
112
- "bson": "7.2.0",
113
112
  "bun-pty": "0.4.8",
114
113
  "dompurify": "3.4.9",
115
114
  "elysia": "1.4.27",
@@ -129,8 +128,5 @@
129
128
  "trustedDependencies": [
130
129
  "puppeteer",
131
130
  "sharp"
132
- ],
133
- "overrides": {
134
- "bson": "7.2.0"
135
- }
131
+ ]
136
132
  }