@supacloud/lite 0.8.2 → 0.8.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.8.4](https://github.com/vibeunion/supacloud/compare/supacloud-lite-v0.8.3...supacloud-lite-v0.8.4) (2026-08-16)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * migrate repository references to vibeunion org ([#933](https://github.com/vibeunion/supacloud/issues/933)) ([642e14f](https://github.com/vibeunion/supacloud/commit/642e14fa6284be97ab6e964d726f9ffcf7ebf4af))
9
+
10
+ ## [0.8.3](https://github.com/zuohuadong/supacloud/compare/supacloud-lite-v0.8.2...supacloud-lite-v0.8.3) (2026-08-15)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **lite:** detect glibc in standalone runtime ([#925](https://github.com/zuohuadong/supacloud/issues/925)) ([c18f0f6](https://github.com/zuohuadong/supacloud/commit/c18f0f6ee86e488a7c603e13416e794060f2012d))
16
+
3
17
  ## [0.8.2](https://github.com/zuohuadong/supacloud/compare/supacloud-lite-v0.8.1...supacloud-lite-v0.8.2) (2026-08-15)
4
18
 
5
19
 
package/README.md CHANGED
@@ -250,7 +250,7 @@ S3 模式的快照只包含数据库中的 Storage 元数据和密钥,不复
250
250
  | `supabase.storage` | 已验证核心 | 覆盖上传下载、列表、删除、TUS/RLS、远端 S3 驱动,以及 Bun.Image 的 `contain`/`fill`、格式和质量变换子集;`cover` 明确不支持 |
251
251
  | `supabase.channel()` | 已验证核心 | 自动测试覆盖 `postgres_changes`、DELETE RLS 隔离和事件快照校验;Broadcast、Presence 属于实验性兼容 |
252
252
  | `supabase.functions.invoke()` | 已验证核心 | 自动测试覆盖 Bun.build、`Deno.serve()`、公开函数和同进程重启 |
253
- | Supabase Queues / PGMQ | 已验证核心 | 提供 `pgmq_public` 的 `send`、`send_batch`、`read`、`pop`、`archive`、`delete` RPC;队列数据持久化在同一 PGlite 项目中 |
253
+ | Supabase Queues / PGMQ | 已验证核心 | 提供 `pgmq_public` 的 `send`、`send_batch`、`read`、`pop`、`archive`、`delete` RPC;队列数据持久化在项目数据库(PGlite native PostgreSQL)中 |
254
254
  | Edge Functions `SupaCloud.pgredis` | 已验证核心 | 提供单项目持久 KV、TTL、原子 `getset`/`getdel`;绑定只在当前函数请求内可用 |
255
255
  | Supabase migrations | 支持 | 按文件名排序,记录到 `supabase_migrations` |
256
256
  | PostgreSQL RLS | 支持 | 使用 `anon`、`authenticated`、`service_role` 数据库角色执行 |
@@ -274,7 +274,7 @@ Lite 使用 Bun 原生 bcrypt,并兼容验证常见 GoTrue bcrypt 密码散列
274
274
 
275
275
  ### 队列与 Edge 缓存
276
276
 
277
- Lite 在同一个 PGlite 数据库中提供 Supabase Queues 的公开 RPC façade。应用可以直接使用官方客户端的
277
+ Lite 在项目数据库(PGlite native PostgreSQL)中提供 Supabase Queues 的公开 RPC façade。应用可以直接使用官方客户端的
278
278
  `supabase.schema('pgmq_public').rpc(...)`,无需额外的队列进程:
279
279
 
280
280
  ```sql
@@ -296,8 +296,9 @@ const { data: messages } = await queues.rpc('read', {
296
296
  })
297
297
  ```
298
298
 
299
- Lite 的 `pgmq` 模拟层还提供 `set_vt`,支持直接 SQL 调整可见性超时。消息按 PGMQ 语义至少投递一次;`pop` 会立即删除消息,`archive` 是确认路径。队列创建、指标、purge、设置和管理 API 不属于 Lite 的公开 RPC façade,仍需由项目 SQL 或完整 SupaCloud 控制面处理。
299
+ Lite 的 `pgmq` 模拟层还提供 `set_vt`,支持直接 SQL 调整可见性超时。消息按 PGMQ 语义至少投递一次;`pop` 会立即删除消息,`archive` 是确认路径。`sleep_seconds` 和 visibility timeout 只控制消息何时可再次领取,不是消息 TTL;Lite/PGMQ 不提供逐消息到期删除语义。队列创建、指标、purge、设置和管理 API 不属于 Lite 的公开 RPC façade,仍需由项目 SQL 或完整 SupaCloud 控制面处理。
300
300
  队列名遵循标准版的 1-128 位小写字母、数字、下划线和短横线规则,并且必须以字母或数字开头;Lite 会安全映射超出 PostgreSQL 63-byte 标识符上限的名称,避免截断后串队。默认 Data API 暴露 `public` 和 `pgmq_public`;如果显式设置 `dbSchemas`,Lite 会严格使用该列表,需要队列 RPC 时应把 `pgmq_public` 明确加入。
301
+ Durable workflow 的 run、step、event 和内部队列也保存在同一项目数据库中,可跨进程重启恢复;内部 workflow 队列不会通过 `pgmq_public` 暴露给 Data API 角色。Workflow 提供重试、取消和 dead-letter 失败原语,但不会自动执行 Saga 补偿;补偿步骤及其幂等性仍由应用工作流显式定义。
301
302
 
302
303
  Edge Function 内可使用 `globalThis.SupaCloud.pgredis`:
303
304
 
@@ -307,7 +308,7 @@ await cache.set('welcome:user:42', { rendered: true }, 60_000)
307
308
  const value = await cache.get<{ rendered: boolean }>('welcome:user:42')
308
309
  ```
309
310
 
310
- 缓存实现使用项目自己的 PGlite 表,支持 `get`、`set`、`delete`、`ttl`、原子 `getset` 和原子 `getdel`。默认边界与标准版一致:key 最长 512 个字符、JSON 值最大 1,048,576 bytes、TTL 最大 31,536,000,000ms。有 TTL 的值在读取时会惰性清理,Lite 的 retention sweeper 还会周期性删除过期行;文件数据库会跨重启保留缓存,`--memory` 数据库则随进程退出丢失。绑定按函数请求和项目隔离,函数返回后启动的 detached Promise 不能继续访问它;Lite 不提供跨项目共享、Redis 协议、队列或限流能力。
311
+ 缓存实现使用项目自己的 PGlite 表,支持 `get`、`set`、`delete`、`ttl`、原子 `getset` 和原子 `getdel`。这里的 TTL 只作用于 pgredis 缓存键,不会改变消息队列的生命周期。默认边界与标准版一致:key 最长 512 个字符、JSON 值最大 1,048,576 bytes、TTL 最大 31,536,000,000ms。有 TTL 的值在读取时会惰性清理,Lite 的 retention sweeper 还会周期性删除过期行;文件数据库会跨重启保留缓存,`--memory` 数据库则随进程退出丢失。绑定按函数请求和项目隔离,函数返回后启动的 detached Promise 不能继续访问它;Lite 不提供跨项目共享、Redis 协议、队列或限流能力。
311
312
  Lite 的缓存调用是进程内数据库操作,不具备标准版跨进程 HTTP binding 的超时和请求中止传播;不要在同一 JavaScript 进程中混合加载 Lite 与标准 Edge Runtime,两者都拥有全局 `SupaCloud` binding,Lite 检测到已有其他实现时会拒绝启动。
312
313
 
313
314
  ### 多项目
@@ -591,7 +592,7 @@ In-memory databases have no persistable data, so `snapshot` and `upgrade` reject
591
592
  | `supabase.storage` | Verified core | Covers upload/download, list, delete, TUS/RLS, remote S3 driver, and a subset of Bun.Image `contain`/`fill`, format, and quality transforms; `cover` is explicitly unsupported |
592
593
  | `supabase.channel()` | Verified core | Automated tests cover `postgres_changes`, DELETE RLS isolation, and event snapshot validation; Broadcast and Presence are experimentally compatible |
593
594
  | `supabase.functions.invoke()` | Verified core | Automated tests cover Bun.build, `Deno.serve()`, public functions, and in-process restart |
594
- | Supabase Queues / PGMQ | Verified core | Provides `send`, `send_batch`, `read`, `pop`, `archive`, and `delete` RPCs for `pgmq_public`; queue data is persisted in the same PGlite project |
595
+ | Supabase Queues / PGMQ | Verified core | Provides `send`, `send_batch`, `read`, `pop`, `archive`, and `delete` RPCs for `pgmq_public`; queue data is persisted in the project database (PGlite or native PostgreSQL) |
595
596
  | Edge Functions `SupaCloud.pgredis` | Verified core | Provides single-project persistent KV, TTL, and atomic `getset`/`getdel`; the binding is only available within the current function request |
596
597
  | Supabase migrations | Supported | Sorted by filename, recorded in `supabase_migrations` |
597
598
  | PostgreSQL RLS | Supported | Executed using the `anon`, `authenticated`, and `service_role` database roles |
@@ -615,7 +616,7 @@ Lite uses Bun's native bcrypt and is compatible with validating common GoTrue bc
615
616
 
616
617
  ### Queues and Edge Cache
617
618
 
618
- Lite provides a public RPC façade for Supabase Queues within the same PGlite database. Applications can directly use the official client's
619
+ Lite provides a public RPC façade for Supabase Queues in the project database (PGlite or native PostgreSQL). Applications can directly use the official client's
619
620
  `supabase.schema('pgmq_public').rpc(...)` without an additional queue process:
620
621
 
621
622
  ```sql
@@ -637,8 +638,9 @@ const { data: messages } = await queues.rpc('read', {
637
638
  })
638
639
  ```
639
640
 
640
- Lite's `pgmq` emulation layer also provides `set_vt`, allowing direct SQL adjustment of visibility timeouts. Messages are delivered at least once according to PGMQ semantics; `pop` deletes the message immediately, and `archive` is the acknowledgment path. Queue creation, metrics, purge, settings, and management APIs are not part of Lite's public RPC façade and must still be handled by project SQL or the full SupaCloud control plane.
641
+ Lite's `pgmq` emulation layer also provides `set_vt`, allowing direct SQL adjustment of visibility timeouts. Messages are delivered at least once according to PGMQ semantics; `pop` deletes the message immediately, and `archive` is the acknowledgment path. `sleep_seconds` and visibility timeouts only control when a message can be claimed again; they are not message TTLs, and Lite/PGMQ does not provide per-message expiry deletion semantics. Queue creation, metrics, purge, settings, and management APIs are not part of Lite's public RPC façade and must still be handled by project SQL or the full SupaCloud control plane.
641
642
  Queue names follow the standard 1-128 character lowercase letter, digit, underscore, and hyphen rule, and must start with a letter or digit; Lite safely maps names that exceed PostgreSQL's 63-byte identifier limit to avoid cross-queue collisions after truncation. The default Data API exposes `public` and `pgmq_public`; if `dbSchemas` is set explicitly, Lite uses that list strictly, and `pgmq_public` should be explicitly included when queue RPCs are needed.
643
+ Durable workflow runs, steps, events, and the internal queue are stored in the same project database and survive process restarts. Data API roles cannot access the internal workflow queue through `pgmq_public`. Workflow retry, cancellation, and dead-letter operations are failure primitives, not automatic Saga compensation; applications must define compensation steps and their idempotency explicitly.
642
644
 
643
645
  Within an Edge Function, you can use `globalThis.SupaCloud.pgredis`:
644
646
 
@@ -648,7 +650,7 @@ await cache.set('welcome:user:42', { rendered: true }, 60_000)
648
650
  const value = await cache.get<{ rendered: boolean }>('welcome:user:42')
649
651
  ```
650
652
 
651
- The cache implementation uses the project's own PGlite tables and supports `get`, `set`, `delete`, `ttl`, atomic `getset`, and atomic `getdel`. The default boundaries are consistent with the standard version: keys up to 512 characters, JSON values up to 1,048,576 bytes, and TTLs up to 31,536,000,000ms. Values with a TTL are lazily cleaned up on read, and Lite's retention sweeper periodically deletes expired rows; the file database retains the cache across restarts, while the `--memory` database loses it when the process exits. The binding is isolated by function request and by project; detached Promises started after the function returns cannot continue to access it; Lite does not provide cross-project sharing, a Redis protocol, queues, or rate-limiting capabilities.
653
+ The cache implementation uses the project's own PGlite tables and supports `get`, `set`, `delete`, `ttl`, atomic `getset`, and atomic `getdel`. This TTL applies only to pgredis cache keys and does not change queue message lifecycles. The default boundaries are consistent with the standard version: keys up to 512 characters, JSON values up to 1,048,576 bytes, and TTLs up to 31,536,000,000ms. Values with a TTL are lazily cleaned up on read, and Lite's retention sweeper periodically deletes expired rows; the file database retains the cache across restarts, while the `--memory` database loses it when the process exits. The binding is isolated by function request and by project; detached Promises started after the function returns cannot continue to access it; Lite does not provide cross-project sharing, a Redis protocol, queues, or rate-limiting capabilities.
652
654
  Lite's cache calls are in-process database operations and do not have the timeout and request-abort propagation of the standard version's cross-process HTTP binding; do not mix loading Lite and the standard Edge Runtime in the same JavaScript process, as both own the global `SupaCloud` binding, and Lite will refuse to start if it detects that another implementation is already present.
653
655
 
654
656
  ### Multiple Projects
package/RELEASING.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  1. 在合并 Release Please 创建的 `supacloud-lite-v0.1.0` release 前,在 GitHub `npm-publish` environment 中临时配置 `NPM_BOOTSTRAP_TOKEN`;token 必须要求 2FA 并限制到该包。
8
8
  2. 合并 release,让同一次 `Release Please` workflow 运行使用该 token 完成首次发布;如果发布 job 失败,使用该次 workflow 的 **Re-run failed jobs**,不要等待下一次 release。
9
- 3. 在 npm 包设置中配置 Trusted Publisher:user `zuohuadong`、repository `supacloud`、workflow `release-please.yml`、environment `npm-publish`,并将 allowed action 限制为 `npm publish`。
9
+ 3. 在 npm 包设置中配置 Trusted Publisher:organization `vibeunion`、repository `supacloud`、workflow `release-please.yml`、environment `npm-publish`,并将 allowed action 限制为 `npm publish`。
10
10
  4. 删除 `NPM_BOOTSTRAP_TOKEN`。后续发布由 npm OIDC Trusted Publishing 完成。
11
11
 
12
12
  ## Verification
package/dist/cli.js CHANGED
@@ -8,7 +8,7 @@ import { dirname as dirname7, join as join10, resolve as resolve4 } from "path";
8
8
  // package.json
9
9
  var package_default = {
10
10
  name: "@supacloud/lite",
11
- version: "0.8.2",
11
+ version: "0.8.4",
12
12
  description: "Bun-native, single-project Supabase-compatible backend powered by PGlite or native PostgreSQL",
13
13
  type: "module",
14
14
  license: "Apache-2.0",
@@ -35,6 +35,7 @@ var package_default = {
35
35
  build: "bun run build:js && bun run build:types",
36
36
  "build:js": "bun run clean && bun build src/index.ts --target=bun --format=esm --outdir=dist --external @electric-sql/pglite --external tar && bun build src/cli.ts --target=bun --format=esm --outdir=dist --external @electric-sql/pglite --external tar && bun run scripts/build-launcher.ts",
37
37
  "build:standalone:host": "bun run scripts/build-standalone.ts host",
38
+ "build:standalone:linux-x64": "bun run scripts/build-standalone.ts linux-x64",
38
39
  "build:standalone:linux": "bun run scripts/build-standalone.ts linux-x64 linux-arm64",
39
40
  "build:standalone:macos": "bun run scripts/build-standalone.ts macos-x64 macos-arm64",
40
41
  "build:standalone:windows": "bun run scripts/build-standalone.ts windows-x64",
@@ -45,12 +46,13 @@ var package_default = {
45
46
  dev: "bun run src/cli.ts start",
46
47
  start: "bun run src/cli.ts start",
47
48
  test: "bun test --timeout 20000",
48
- "test:native": "SUPACLOUD_LITE_TEST_NATIVE=1 bun test test/native-engine.test.ts --timeout 180000",
49
+ "test:native": "SUPACLOUD_LITE_TEST_NATIVE=1 bun test test/native-engine.test.ts test/qauth-workflow-matrix.test.ts --timeout 180000",
49
50
  parity: "bun run parity/harness.ts",
50
51
  "parity:native": "SUPACLOUD_LITE_TEST_NATIVE=1 bun run parity/harness.ts --engine native",
51
52
  "check:native": "bun run test:native && bun run parity:native",
52
53
  "test:package": "bun run scripts/package-smoke.ts",
53
54
  "test:standalone": "bun run scripts/standalone-smoke.ts",
55
+ "test:standalone:native": "bun run scripts/standalone-native-smoke.ts",
54
56
  prepack: "bun run build",
55
57
  typecheck: "bun x tsc --noEmit -p tsconfig.json"
56
58
  },
@@ -72,7 +74,7 @@ var package_default = {
72
74
  },
73
75
  repository: {
74
76
  type: "git",
75
- url: "git+https://github.com/zuohuadong/supacloud.git",
77
+ url: "git+https://github.com/vibeunion/supacloud.git",
76
78
  directory: "packages/supacloud-lite"
77
79
  },
78
80
  keywords: [
@@ -10256,7 +10258,7 @@ import { tmpdir as tmpdir2 } from "os";
10256
10258
  import { dirname as dirname2, join as join2 } from "path";
10257
10259
 
10258
10260
  // src/runtime/node/native/engine.ts
10259
- import { execFileSync, spawn } from "child_process";
10261
+ import { execFileSync, spawn, spawnSync } from "child_process";
10260
10262
  import { createHash as createHash2, randomBytes as randomBytes2 } from "crypto";
10261
10263
  import { appendFileSync, chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync } from "fs";
10262
10264
  import { writeFile } from "fs/promises";
@@ -10798,16 +10800,45 @@ function toPgArrayLiteral(array) {
10798
10800
  var DEFAULT_PG_VERSION = "17.7.0";
10799
10801
  var POSTGRES_MIRROR_URL_ERROR = "SUPACLOUD_LITE_POSTGRES_MIRROR must be an absolute HTTPS URL or a loopback HTTP URL";
10800
10802
  var NATIVE_POSTGRES_MAJOR = DEFAULT_PG_VERSION.split(".")[0];
10803
+ var GLIBC_DYNAMIC_LOADERS = {
10804
+ x64: [
10805
+ "/lib64/ld-linux-x86-64.so.2",
10806
+ "/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2"
10807
+ ],
10808
+ arm64: [
10809
+ "/lib/ld-linux-aarch64.so.1",
10810
+ "/lib64/ld-linux-aarch64.so.1",
10811
+ "/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1"
10812
+ ]
10813
+ };
10801
10814
  function isNativeEngineSupported() {
10802
10815
  return (process.platform === "darwin" || process.platform === "linux") && (process.arch === "arm64" || process.arch === "x64") && (process.platform !== "linux" || isGlibcLinux());
10803
10816
  }
10804
10817
  function isGlibcLinux() {
10805
- try {
10806
- const version = execFileSync("ldd", ["--version"], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
10807
- return /glibc|gnu libc/i.test(version);
10808
- } catch {
10809
- return false;
10810
- }
10818
+ const runtimeEvidence = {
10819
+ runtimeVersion: reportedGlibcVersion(),
10820
+ dynamicLoaderPresent: glibcDynamicLoaderPresent()
10821
+ };
10822
+ return isGlibcRuntime(runtimeEvidence) || isGlibcRuntime({ ...runtimeEvidence, lddVersion: lddVersion() });
10823
+ }
10824
+ function isGlibcRuntime(evidence) {
10825
+ return Boolean(evidence.runtimeVersion?.trim()) || evidence.dynamicLoaderPresent || /glibc|gnu libc/i.test(evidence.lddVersion ?? "");
10826
+ }
10827
+ function reportedGlibcVersion() {
10828
+ const report = process.report?.getReport();
10829
+ const runtimeVersion = report?.header?.glibcVersionRuntime;
10830
+ return typeof runtimeVersion === "string" ? runtimeVersion : undefined;
10831
+ }
10832
+ function glibcDynamicLoaderPresent() {
10833
+ const loaderPaths = process.arch === "x64" ? GLIBC_DYNAMIC_LOADERS.x64 : process.arch === "arm64" ? GLIBC_DYNAMIC_LOADERS.arm64 : [];
10834
+ return loaderPaths.some((loaderPath) => existsSync(loaderPath));
10835
+ }
10836
+ function lddVersion() {
10837
+ const command = spawnSync("ldd", ["--version"], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
10838
+ if (command.error || command.status !== 0)
10839
+ return;
10840
+ return `${command.stdout}
10841
+ ${command.stderr}`.trim();
10811
10842
  }
10812
10843
  function target() {
10813
10844
  const arch = process.arch === "arm64" ? "aarch64" : process.arch === "x64" ? "x86_64" : null;
package/dist/index.js CHANGED
@@ -85,7 +85,7 @@ function randomToken(bytes = 32) {
85
85
  // package.json
86
86
  var package_default = {
87
87
  name: "@supacloud/lite",
88
- version: "0.8.2",
88
+ version: "0.8.4",
89
89
  description: "Bun-native, single-project Supabase-compatible backend powered by PGlite or native PostgreSQL",
90
90
  type: "module",
91
91
  license: "Apache-2.0",
@@ -112,6 +112,7 @@ var package_default = {
112
112
  build: "bun run build:js && bun run build:types",
113
113
  "build:js": "bun run clean && bun build src/index.ts --target=bun --format=esm --outdir=dist --external @electric-sql/pglite --external tar && bun build src/cli.ts --target=bun --format=esm --outdir=dist --external @electric-sql/pglite --external tar && bun run scripts/build-launcher.ts",
114
114
  "build:standalone:host": "bun run scripts/build-standalone.ts host",
115
+ "build:standalone:linux-x64": "bun run scripts/build-standalone.ts linux-x64",
115
116
  "build:standalone:linux": "bun run scripts/build-standalone.ts linux-x64 linux-arm64",
116
117
  "build:standalone:macos": "bun run scripts/build-standalone.ts macos-x64 macos-arm64",
117
118
  "build:standalone:windows": "bun run scripts/build-standalone.ts windows-x64",
@@ -122,12 +123,13 @@ var package_default = {
122
123
  dev: "bun run src/cli.ts start",
123
124
  start: "bun run src/cli.ts start",
124
125
  test: "bun test --timeout 20000",
125
- "test:native": "SUPACLOUD_LITE_TEST_NATIVE=1 bun test test/native-engine.test.ts --timeout 180000",
126
+ "test:native": "SUPACLOUD_LITE_TEST_NATIVE=1 bun test test/native-engine.test.ts test/qauth-workflow-matrix.test.ts --timeout 180000",
126
127
  parity: "bun run parity/harness.ts",
127
128
  "parity:native": "SUPACLOUD_LITE_TEST_NATIVE=1 bun run parity/harness.ts --engine native",
128
129
  "check:native": "bun run test:native && bun run parity:native",
129
130
  "test:package": "bun run scripts/package-smoke.ts",
130
131
  "test:standalone": "bun run scripts/standalone-smoke.ts",
132
+ "test:standalone:native": "bun run scripts/standalone-native-smoke.ts",
131
133
  prepack: "bun run build",
132
134
  typecheck: "bun x tsc --noEmit -p tsconfig.json"
133
135
  },
@@ -149,7 +151,7 @@ var package_default = {
149
151
  },
150
152
  repository: {
151
153
  type: "git",
152
- url: "git+https://github.com/zuohuadong/supacloud.git",
154
+ url: "git+https://github.com/vibeunion/supacloud.git",
153
155
  directory: "packages/supacloud-lite"
154
156
  },
155
157
  keywords: [
@@ -10269,7 +10271,7 @@ async function serveBun(backend, opts = {}) {
10269
10271
  };
10270
10272
  }
10271
10273
  // src/runtime/node/native/engine.ts
10272
- import { execFileSync, spawn } from "child_process";
10274
+ import { execFileSync, spawn, spawnSync } from "child_process";
10273
10275
  import { createHash as createHash2, randomBytes as randomBytes2 } from "crypto";
10274
10276
  import { appendFileSync, chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync } from "fs";
10275
10277
  import { writeFile as writeFile2 } from "fs/promises";
@@ -10811,16 +10813,45 @@ function toPgArrayLiteral(array) {
10811
10813
  var DEFAULT_PG_VERSION = "17.7.0";
10812
10814
  var POSTGRES_MIRROR_URL_ERROR = "SUPACLOUD_LITE_POSTGRES_MIRROR must be an absolute HTTPS URL or a loopback HTTP URL";
10813
10815
  var NATIVE_POSTGRES_MAJOR = DEFAULT_PG_VERSION.split(".")[0];
10816
+ var GLIBC_DYNAMIC_LOADERS = {
10817
+ x64: [
10818
+ "/lib64/ld-linux-x86-64.so.2",
10819
+ "/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2"
10820
+ ],
10821
+ arm64: [
10822
+ "/lib/ld-linux-aarch64.so.1",
10823
+ "/lib64/ld-linux-aarch64.so.1",
10824
+ "/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1"
10825
+ ]
10826
+ };
10814
10827
  function isNativeEngineSupported() {
10815
10828
  return (process.platform === "darwin" || process.platform === "linux") && (process.arch === "arm64" || process.arch === "x64") && (process.platform !== "linux" || isGlibcLinux());
10816
10829
  }
10817
10830
  function isGlibcLinux() {
10818
- try {
10819
- const version = execFileSync("ldd", ["--version"], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
10820
- return /glibc|gnu libc/i.test(version);
10821
- } catch {
10822
- return false;
10823
- }
10831
+ const runtimeEvidence = {
10832
+ runtimeVersion: reportedGlibcVersion(),
10833
+ dynamicLoaderPresent: glibcDynamicLoaderPresent()
10834
+ };
10835
+ return isGlibcRuntime(runtimeEvidence) || isGlibcRuntime({ ...runtimeEvidence, lddVersion: lddVersion() });
10836
+ }
10837
+ function isGlibcRuntime(evidence) {
10838
+ return Boolean(evidence.runtimeVersion?.trim()) || evidence.dynamicLoaderPresent || /glibc|gnu libc/i.test(evidence.lddVersion ?? "");
10839
+ }
10840
+ function reportedGlibcVersion() {
10841
+ const report = process.report?.getReport();
10842
+ const runtimeVersion = report?.header?.glibcVersionRuntime;
10843
+ return typeof runtimeVersion === "string" ? runtimeVersion : undefined;
10844
+ }
10845
+ function glibcDynamicLoaderPresent() {
10846
+ const loaderPaths = process.arch === "x64" ? GLIBC_DYNAMIC_LOADERS.x64 : process.arch === "arm64" ? GLIBC_DYNAMIC_LOADERS.arm64 : [];
10847
+ return loaderPaths.some((loaderPath) => existsSync(loaderPath));
10848
+ }
10849
+ function lddVersion() {
10850
+ const command = spawnSync("ldd", ["--version"], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
10851
+ if (command.error || command.status !== 0)
10852
+ return;
10853
+ return `${command.stdout}
10854
+ ${command.stderr}`.trim();
10824
10855
  }
10825
10856
  function target() {
10826
10857
  const arch = process.arch === "arm64" ? "aarch64" : process.arch === "x64" ? "x86_64" : null;
@@ -1,5 +1,10 @@
1
1
  import type { DbEngine } from '../../db/engine.js';
2
2
  export declare const NATIVE_POSTGRES_MAJOR: string;
3
+ export interface GlibcRuntimeEvidence {
4
+ runtimeVersion?: string;
5
+ dynamicLoaderPresent: boolean;
6
+ lddVersion?: string;
7
+ }
3
8
  /** Options for {@link createNativeEngine}. */
4
9
  export interface NativeEngineOptions {
5
10
  /** Postgres data directory (created + initdb'd if missing). */
@@ -14,6 +19,7 @@ export interface NativeEngineOptions {
14
19
  downloadMirror?: string;
15
20
  }
16
21
  export declare function isNativeEngineSupported(): boolean;
22
+ export declare function isGlibcRuntime(evidence: GlibcRuntimeEvidence): boolean;
17
23
  /** Download + unpack Postgres binaries if not already cached (concurrency-safe). Returns the install dir. */
18
24
  export declare function ensurePostgres(version?: string, cacheDir?: string, log?: (m: string) => void, downloadMirror?: string): Promise<string>;
19
25
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../../../src/runtime/node/native/engine.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAOlD,eAAO,MAAM,qBAAqB,QAAoC,CAAA;AAEtE,8CAA8C;AAC9C,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAA;IACf,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,sEAAsE;IACtE,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3B,2FAA2F;IAC3F,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,wBAAgB,uBAAuB,IAAI,OAAO,CAIjD;AA6DD,6GAA6G;AAC7G,wBAAsB,cAAc,CAClC,OAAO,SAAqB,EAC5B,QAAQ,CAAC,EAAE,MAAM,EACjB,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,EACzB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,MAAM,CAAC,CA4CjB;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAG/F;AAkDD;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiFrF"}
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../../../src/runtime/node/native/engine.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAOlD,eAAO,MAAM,qBAAqB,QAAoC,CAAA;AActE,MAAM,WAAW,oBAAoB;IACnC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,oBAAoB,EAAE,OAAO,CAAA;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,8CAA8C;AAC9C,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAA;IACf,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,sEAAsE;IACtE,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3B,2FAA2F;IAC3F,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,wBAAgB,uBAAuB,IAAI,OAAO,CAIjD;AAUD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,oBAAoB,GAAG,OAAO,CAItE;AAuED,6GAA6G;AAC7G,wBAAsB,cAAc,CAClC,OAAO,SAAqB,EAC5B,QAAQ,CAAC,EAAE,MAAM,EACjB,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,EACzB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,MAAM,CAAC,CA4CjB;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAG/F;AAkDD;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiFrF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/lite",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "Bun-native, single-project Supabase-compatible backend powered by PGlite or native PostgreSQL",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -27,6 +27,7 @@
27
27
  "build": "bun run build:js && bun run build:types",
28
28
  "build:js": "bun run clean && bun build src/index.ts --target=bun --format=esm --outdir=dist --external @electric-sql/pglite --external tar && bun build src/cli.ts --target=bun --format=esm --outdir=dist --external @electric-sql/pglite --external tar && bun run scripts/build-launcher.ts",
29
29
  "build:standalone:host": "bun run scripts/build-standalone.ts host",
30
+ "build:standalone:linux-x64": "bun run scripts/build-standalone.ts linux-x64",
30
31
  "build:standalone:linux": "bun run scripts/build-standalone.ts linux-x64 linux-arm64",
31
32
  "build:standalone:macos": "bun run scripts/build-standalone.ts macos-x64 macos-arm64",
32
33
  "build:standalone:windows": "bun run scripts/build-standalone.ts windows-x64",
@@ -37,12 +38,13 @@
37
38
  "dev": "bun run src/cli.ts start",
38
39
  "start": "bun run src/cli.ts start",
39
40
  "test": "bun test --timeout 20000",
40
- "test:native": "SUPACLOUD_LITE_TEST_NATIVE=1 bun test test/native-engine.test.ts --timeout 180000",
41
+ "test:native": "SUPACLOUD_LITE_TEST_NATIVE=1 bun test test/native-engine.test.ts test/qauth-workflow-matrix.test.ts --timeout 180000",
41
42
  "parity": "bun run parity/harness.ts",
42
43
  "parity:native": "SUPACLOUD_LITE_TEST_NATIVE=1 bun run parity/harness.ts --engine native",
43
44
  "check:native": "bun run test:native && bun run parity:native",
44
45
  "test:package": "bun run scripts/package-smoke.ts",
45
46
  "test:standalone": "bun run scripts/standalone-smoke.ts",
47
+ "test:standalone:native": "bun run scripts/standalone-native-smoke.ts",
46
48
  "prepack": "bun run build",
47
49
  "typecheck": "bun x tsc --noEmit -p tsconfig.json"
48
50
  },
@@ -64,7 +66,7 @@
64
66
  },
65
67
  "repository": {
66
68
  "type": "git",
67
- "url": "git+https://github.com/zuohuadong/supacloud.git",
69
+ "url": "git+https://github.com/vibeunion/supacloud.git",
68
70
  "directory": "packages/supacloud-lite"
69
71
  },
70
72
  "keywords": [