@supacloud/lite 0.3.0 → 0.5.1

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/LICENSES/BUN-1.3.14-RUNTIME-NOTICES.txt +78 -0
  3. package/LICENSES/CHOWNR-BLUEOAK-1.0.0.txt +63 -0
  4. package/LICENSES/FS-MINIPASS-ISC.txt +15 -0
  5. package/LICENSES/MINIPASS-BLUEOAK-1.0.0.txt +55 -0
  6. package/LICENSES/MINIZLIB-MIT.txt +26 -0
  7. package/LICENSES/NODE-TAR-BLUEOAK-1.0.0.txt +55 -0
  8. package/LICENSES/YALLIST-BLUEOAK-1.0.0.txt +63 -0
  9. package/README.md +74 -4
  10. package/RELEASING.md +14 -1
  11. package/THIRD_PARTY_NOTICES.md +38 -2
  12. package/dist/cli.js +541 -108
  13. package/dist/index.d.ts +1 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +525 -99
  16. package/dist/launcher.cjs +35 -0
  17. package/dist/snapshot.d.ts.map +1 -1
  18. package/dist/standalone-assets-protocol.d.ts +13 -0
  19. package/dist/standalone-assets-protocol.d.ts.map +1 -0
  20. package/dist/vendor/tinbase/auth/handler.d.ts +4 -0
  21. package/dist/vendor/tinbase/auth/handler.d.ts.map +1 -1
  22. package/dist/vendor/tinbase/db/data-dir-lock.d.ts +18 -0
  23. package/dist/vendor/tinbase/db/data-dir-lock.d.ts.map +1 -0
  24. package/dist/vendor/tinbase/db/database.d.ts +5 -1
  25. package/dist/vendor/tinbase/db/database.d.ts.map +1 -1
  26. package/dist/vendor/tinbase/db/emulated.d.ts +1 -1
  27. package/dist/vendor/tinbase/db/emulated.d.ts.map +1 -1
  28. package/dist/vendor/tinbase/db/pglite-engine.d.ts.map +1 -1
  29. package/dist/vendor/tinbase/functions/handler.d.ts +3 -1
  30. package/dist/vendor/tinbase/functions/handler.d.ts.map +1 -1
  31. package/dist/vendor/tinbase/functions/pgredis.d.ts +26 -0
  32. package/dist/vendor/tinbase/functions/pgredis.d.ts.map +1 -0
  33. package/dist/vendor/tinbase/index.d.ts +1 -0
  34. package/dist/vendor/tinbase/index.d.ts.map +1 -1
  35. package/dist/vendor/tinbase/retention/service.d.ts.map +1 -1
  36. package/package.json +11 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.1](https://github.com/zuohuadong/supacloud/compare/supacloud-lite-v0.5.0...supacloud-lite-v0.5.1) (2026-07-30)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * make Lite Windows shutdown verification reliable ([#650](https://github.com/zuohuadong/supacloud/issues/650)) ([c208006](https://github.com/zuohuadong/supacloud/commit/c208006aa49839562dda5b0fe1419f183ceb5b12))
9
+ * stabilize Lite shutdown and Studio interactions ([a4d6f19](https://github.com/zuohuadong/supacloud/commit/a4d6f19db6c4aa71702fccec83bfbdd2a0c8b2b1))
10
+
11
+ ## [0.5.0](https://github.com/zuohuadong/supacloud/compare/supacloud-lite-v0.4.0...supacloud-lite-v0.5.0) (2026-07-29)
12
+
13
+
14
+ ### Features
15
+
16
+ * **lite:** build standalone single-file binaries with embedded PGlite assets ([#644](https://github.com/zuohuadong/supacloud/issues/644)) ([50da574](https://github.com/zuohuadong/supacloud/commit/50da574a4643fba9d5027464b501e18afe79926b))
17
+
18
+ ## [0.4.0](https://github.com/zuohuadong/supacloud/compare/supacloud-lite-v0.3.0...supacloud-lite-v0.4.0) (2026-07-29)
19
+
20
+
21
+ ### Features
22
+
23
+ * **lite:** align auth queue and cache compatibility ([f6efcd3](https://github.com/zuohuadong/supacloud/commit/f6efcd3168392f96b36ad4a9b89fafd379f523a4))
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * resolve remaining reported runtime and console issues ([5fda9f0](https://github.com/zuohuadong/supacloud/commit/5fda9f0960fe7c1a03765f69cc59ebe847016a2c))
29
+ * resolve reported console and Lite issues ([781fba4](https://github.com/zuohuadong/supacloud/commit/781fba47412ed44272dc355d484c9d2c283151c9))
30
+
3
31
  ## [0.3.0](https://github.com/zuohuadong/supacloud/compare/supacloud-lite-v0.2.0...supacloud-lite-v0.3.0) (2026-07-28)
4
32
 
5
33
 
@@ -0,0 +1,78 @@
1
+ ---
2
+ title: License
3
+ description: License for Bun
4
+ ---
5
+
6
+ Bun itself is MIT-licensed.
7
+
8
+ ## JavaScriptCore
9
+
10
+ Bun statically links JavaScriptCore (and WebKit) which is LGPL-2 licensed. WebCore files from WebKit are also licensed under LGPL2. Per LGPL2:
11
+
12
+ > (1) If you statically link against an LGPL'd library, you must also provide your application in an object (not necessarily source) format, so that a user has the opportunity to modify the library and relink the application.
13
+
14
+ You can find the patched version of WebKit used by Bun here: https://github.com/oven-sh/webkit. If you would like to relink Bun with changes:
15
+
16
+ - `git submodule update --init --recursive`
17
+ - `make jsc`
18
+ - `zig build`
19
+
20
+ This compiles JavaScriptCore, compiles Bun's `.cpp` bindings for JavaScriptCore (which are the object files using JavaScriptCore) and outputs a new `bun` binary with your changes.
21
+
22
+ ## Linked libraries
23
+
24
+ Bun statically links these libraries:
25
+
26
+ | Library | License |
27
+ | ------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
28
+ | [`boringssl`](https://boringssl.googlesource.com/boringssl/) | [several licenses](https://boringssl.googlesource.com/boringssl/+/refs/heads/master/LICENSE) |
29
+ | [`brotli`](https://github.com/google/brotli) | MIT |
30
+ | [`libarchive`](https://github.com/libarchive/libarchive) | [several licenses](https://github.com/libarchive/libarchive/blob/master/COPYING) |
31
+ | [`lol-html`](https://github.com/cloudflare/lol-html/tree/master/c-api) | BSD 3-Clause |
32
+ | [`mimalloc`](https://github.com/microsoft/mimalloc) | MIT |
33
+ | [`picohttp`](https://github.com/h2o/picohttpparser) | dual-licensed under the Perl License or the MIT License |
34
+ | [`zstd`](https://github.com/facebook/zstd) | dual-licensed under the BSD License or GPLv2 license |
35
+ | [`simdutf`](https://github.com/simdutf/simdutf) | Apache 2.0 |
36
+ | [`tinycc`](https://github.com/tinycc/tinycc) | LGPL v2.1 |
37
+ | [`uSockets`](https://github.com/uNetworking/uSockets) | Apache 2.0 |
38
+ | [`zlib-ng`](https://github.com/zlib-ng/zlib-ng) | zlib |
39
+ | [`c-ares`](https://github.com/c-ares/c-ares) | MIT licensed |
40
+ | [`libicu`](https://github.com/unicode-org/icu) 72 | [license here](https://github.com/unicode-org/icu/blob/main/icu4c/LICENSE) |
41
+ | [`libbase64`](https://github.com/aklomp/base64/blob/master/LICENSE) | BSD 2-Clause |
42
+ | [`libuv`](https://github.com/libuv/libuv) (on Windows) | MIT |
43
+ | [`libdeflate`](https://github.com/ebiggers/libdeflate) | MIT |
44
+ | A fork of [`uWebsockets`](https://github.com/jarred-sumner/uwebsockets) | Apache 2.0 licensed |
45
+ | Parts of [Tigerbeetle's IO code](https://github.com/tigerbeetle/tigerbeetle/blob/532c8b70b9142c17e07737ab6d3da68d7500cbca/src/io/windows.zig#L1) | Apache 2.0 licensed |
46
+
47
+ ## Polyfills
48
+
49
+ For compatibility reasons, the following packages are embedded into Bun's binary and injected if imported.
50
+
51
+ | Package | License |
52
+ | ------------------------------------------------------------------------ | ------- |
53
+ | [`assert`](https://npmjs.com/package/assert) | MIT |
54
+ | [`browserify-zlib`](https://npmjs.com/package/browserify-zlib) | MIT |
55
+ | [`buffer`](https://npmjs.com/package/buffer) | MIT |
56
+ | [`constants-browserify`](https://npmjs.com/package/constants-browserify) | MIT |
57
+ | [`crypto-browserify`](https://npmjs.com/package/crypto-browserify) | MIT |
58
+ | [`domain-browser`](https://npmjs.com/package/domain-browser) | MIT |
59
+ | [`events`](https://npmjs.com/package/events) | MIT |
60
+ | [`https-browserify`](https://npmjs.com/package/https-browserify) | MIT |
61
+ | [`os-browserify`](https://npmjs.com/package/os-browserify) | MIT |
62
+ | [`path-browserify`](https://npmjs.com/package/path-browserify) | MIT |
63
+ | [`process`](https://npmjs.com/package/process) | MIT |
64
+ | [`punycode`](https://npmjs.com/package/punycode) | MIT |
65
+ | [`querystring-es3`](https://npmjs.com/package/querystring-es3) | MIT |
66
+ | [`stream-browserify`](https://npmjs.com/package/stream-browserify) | MIT |
67
+ | [`stream-http`](https://npmjs.com/package/stream-http) | MIT |
68
+ | [`string_decoder`](https://npmjs.com/package/string_decoder) | MIT |
69
+ | [`timers-browserify`](https://npmjs.com/package/timers-browserify) | MIT |
70
+ | [`tty-browserify`](https://npmjs.com/package/tty-browserify) | MIT |
71
+ | [`url`](https://npmjs.com/package/url) | MIT |
72
+ | [`util`](https://npmjs.com/package/util) | MIT |
73
+ | [`vm-browserify`](https://npmjs.com/package/vm-browserify) | MIT |
74
+
75
+ ## Additional credits
76
+
77
+ - Bun's JS transpiler, CSS lexer, and Node.js module resolver source code is a Zig port of [@evanw](https://github.com/evanw)’s [esbuild](https://github.com/evanw/esbuild) project.
78
+ - Credit to [@kipply](https://github.com/kipply) for the name "Bun"!
@@ -0,0 +1,63 @@
1
+ All packages under `src/` are licensed according to the terms in
2
+ their respective `LICENSE` or `LICENSE.md` files.
3
+
4
+ The remainder of this project is licensed under the Blue Oak
5
+ Model License, as follows:
6
+
7
+ -----
8
+
9
+ # Blue Oak Model License
10
+
11
+ Version 1.0.0
12
+
13
+ ## Purpose
14
+
15
+ This license gives everyone as much permission to work with
16
+ this software as possible, while protecting contributors
17
+ from liability.
18
+
19
+ ## Acceptance
20
+
21
+ In order to receive this license, you must agree to its
22
+ rules. The rules of this license are both obligations
23
+ under that agreement and conditions to your license.
24
+ You must not do anything with this software that triggers
25
+ a rule that you cannot or will not follow.
26
+
27
+ ## Copyright
28
+
29
+ Each contributor licenses you to do everything with this
30
+ software that would otherwise infringe that contributor's
31
+ copyright in it.
32
+
33
+ ## Notices
34
+
35
+ You must ensure that everyone who gets a copy of
36
+ any part of this software from you, with or without
37
+ changes, also gets the text of this license or a link to
38
+ <https://blueoakcouncil.org/license/1.0.0>.
39
+
40
+ ## Excuse
41
+
42
+ If anyone notifies you in writing that you have not
43
+ complied with [Notices](#notices), you can keep your
44
+ license by taking all practical steps to comply within 30
45
+ days after the notice. If you do not do so, your license
46
+ ends immediately.
47
+
48
+ ## Patent
49
+
50
+ Each contributor licenses you to do everything with this
51
+ software that would otherwise infringe any patent claims
52
+ they can license or become able to license.
53
+
54
+ ## Reliability
55
+
56
+ No contributor can revoke this license.
57
+
58
+ ## No Liability
59
+
60
+ ***As far as the law allows, this software comes as is,
61
+ without any warranty or condition, and no contributor
62
+ will be liable to anyone for any damages related to this
63
+ software or this license, under any kind of legal claim.***
@@ -0,0 +1,15 @@
1
+ The ISC License
2
+
3
+ Copyright (c) Isaac Z. Schlueter and Contributors
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15
+ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,55 @@
1
+ # Blue Oak Model License
2
+
3
+ Version 1.0.0
4
+
5
+ ## Purpose
6
+
7
+ This license gives everyone as much permission to work with
8
+ this software as possible, while protecting contributors
9
+ from liability.
10
+
11
+ ## Acceptance
12
+
13
+ In order to receive this license, you must agree to its
14
+ rules. The rules of this license are both obligations
15
+ under that agreement and conditions to your license.
16
+ You must not do anything with this software that triggers
17
+ a rule that you cannot or will not follow.
18
+
19
+ ## Copyright
20
+
21
+ Each contributor licenses you to do everything with this
22
+ software that would otherwise infringe that contributor's
23
+ copyright in it.
24
+
25
+ ## Notices
26
+
27
+ You must ensure that everyone who gets a copy of
28
+ any part of this software from you, with or without
29
+ changes, also gets the text of this license or a link to
30
+ <https://blueoakcouncil.org/license/1.0.0>.
31
+
32
+ ## Excuse
33
+
34
+ If anyone notifies you in writing that you have not
35
+ complied with [Notices](#notices), you can keep your
36
+ license by taking all practical steps to comply within 30
37
+ days after the notice. If you do not do so, your license
38
+ ends immediately.
39
+
40
+ ## Patent
41
+
42
+ Each contributor licenses you to do everything with this
43
+ software that would otherwise infringe any patent claims
44
+ they can license or become able to license.
45
+
46
+ ## Reliability
47
+
48
+ No contributor can revoke this license.
49
+
50
+ ## No Liability
51
+
52
+ ***As far as the law allows, this software comes as is,
53
+ without any warranty or condition, and no contributor
54
+ will be liable to anyone for any damages related to this
55
+ software or this license, under any kind of legal claim.***
@@ -0,0 +1,26 @@
1
+ Minizlib was created by Isaac Z. Schlueter.
2
+ It is a derivative work of the Node.js project.
3
+
4
+ """
5
+ Copyright (c) 2017-2023 Isaac Z. Schlueter and Contributors
6
+ Copyright (c) 2017-2023 Node.js contributors. All rights reserved.
7
+ Copyright (c) 2017-2023 Joyent, Inc. and other Node contributors. All rights reserved.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a
10
+ copy of this software and associated documentation files (the "Software"),
11
+ to deal in the Software without restriction, including without limitation
12
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
13
+ and/or sell copies of the Software, and to permit persons to whom the
14
+ Software is furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
+ """
@@ -0,0 +1,55 @@
1
+ # Blue Oak Model License
2
+
3
+ Version 1.0.0
4
+
5
+ ## Purpose
6
+
7
+ This license gives everyone as much permission to work with
8
+ this software as possible, while protecting contributors
9
+ from liability.
10
+
11
+ ## Acceptance
12
+
13
+ In order to receive this license, you must agree to its
14
+ rules. The rules of this license are both obligations
15
+ under that agreement and conditions to your license.
16
+ You must not do anything with this software that triggers
17
+ a rule that you cannot or will not follow.
18
+
19
+ ## Copyright
20
+
21
+ Each contributor licenses you to do everything with this
22
+ software that would otherwise infringe that contributor's
23
+ copyright in it.
24
+
25
+ ## Notices
26
+
27
+ You must ensure that everyone who gets a copy of
28
+ any part of this software from you, with or without
29
+ changes, also gets the text of this license or a link to
30
+ <https://blueoakcouncil.org/license/1.0.0>.
31
+
32
+ ## Excuse
33
+
34
+ If anyone notifies you in writing that you have not
35
+ complied with [Notices](#notices), you can keep your
36
+ license by taking all practical steps to comply within 30
37
+ days after the notice. If you do not do so, your license
38
+ ends immediately.
39
+
40
+ ## Patent
41
+
42
+ Each contributor licenses you to do everything with this
43
+ software that would otherwise infringe any patent claims
44
+ they can license or become able to license.
45
+
46
+ ## Reliability
47
+
48
+ No contributor can revoke this license.
49
+
50
+ ## No Liability
51
+
52
+ ***As far as the law allows, this software comes as is,
53
+ without any warranty or condition, and no contributor
54
+ will be liable to anyone for any damages related to this
55
+ software or this license, under any kind of legal claim.***
@@ -0,0 +1,63 @@
1
+ All packages under `src/` are licensed according to the terms in
2
+ their respective `LICENSE` or `LICENSE.md` files.
3
+
4
+ The remainder of this project is licensed under the Blue Oak
5
+ Model License, as follows:
6
+
7
+ -----
8
+
9
+ # Blue Oak Model License
10
+
11
+ Version 1.0.0
12
+
13
+ ## Purpose
14
+
15
+ This license gives everyone as much permission to work with
16
+ this software as possible, while protecting contributors
17
+ from liability.
18
+
19
+ ## Acceptance
20
+
21
+ In order to receive this license, you must agree to its
22
+ rules. The rules of this license are both obligations
23
+ under that agreement and conditions to your license.
24
+ You must not do anything with this software that triggers
25
+ a rule that you cannot or will not follow.
26
+
27
+ ## Copyright
28
+
29
+ Each contributor licenses you to do everything with this
30
+ software that would otherwise infringe that contributor's
31
+ copyright in it.
32
+
33
+ ## Notices
34
+
35
+ You must ensure that everyone who gets a copy of
36
+ any part of this software from you, with or without
37
+ changes, also gets the text of this license or a link to
38
+ <https://blueoakcouncil.org/license/1.0.0>.
39
+
40
+ ## Excuse
41
+
42
+ If anyone notifies you in writing that you have not
43
+ complied with [Notices](#notices), you can keep your
44
+ license by taking all practical steps to comply within 30
45
+ days after the notice. If you do not do so, your license
46
+ ends immediately.
47
+
48
+ ## Patent
49
+
50
+ Each contributor licenses you to do everything with this
51
+ software that would otherwise infringe any patent claims
52
+ they can license or become able to license.
53
+
54
+ ## Reliability
55
+
56
+ No contributor can revoke this license.
57
+
58
+ ## No Liability
59
+
60
+ ***As far as the law allows, this software comes as is,
61
+ without any warranty or condition, and no contributor
62
+ will be liable to anyone for any damages related to this
63
+ software or this license, under any kind of legal claim.***
package/README.md CHANGED
@@ -6,7 +6,7 @@ V1 的目标不是复刻完整 Supabase 平台控制面,而是让现有应用
6
6
 
7
7
  ## 状态
8
8
 
9
- - 运行时:Bun 1.3+
9
+ - 运行时:npm 包需要 Bun 1.3+;单二进制发行版已内嵌 Bun 和 PGlite 资源
10
10
  - 数据库:PGlite 0.5.4
11
11
  - 项目模型:单进程、单项目,内部 project ref 固定为 `local`
12
12
  - 客户端:直接使用官方 `@supabase/supabase-js`
@@ -21,6 +21,15 @@ bun add @supacloud/lite
21
21
  bunx supacloud-lite start
22
22
  ```
23
23
 
24
+ 也可以从 GitHub Release 下载当前平台的 `supacloud-lite-*` 单二进制。该文件不需要预装 Bun、Node、npm 或 Docker:
25
+
26
+ ```bash
27
+ chmod +x ./supacloud-lite-linux-x64
28
+ ./supacloud-lite-linux-x64 start --project-dir /path/to/project
29
+ ```
30
+
31
+ 单二进制仍读取项目的 `supabase/` 目录,并在项目外部写入 `.supacloud-lite/` 持久化状态;它不包含 Web 控制台或 Supabase Studio。Linux x64/arm64、macOS x64/arm64 和 Windows x64 分别使用独立产物,不能跨操作系统或 CPU 架构混用。
32
+
24
33
  获取匿名 key:
25
34
 
26
35
  ```bash
@@ -123,9 +132,22 @@ S3 模式下 `db reset` 会被拒绝,因为 Lite 不能把数据库元数据
123
132
 
124
133
  网络暴露时必须提供足够强的 JWT secret 和独立 vault key。默认生成的密钥适合单机项目;不要把 `.supacloud-lite/secrets.json` 提交到版本库。
125
134
 
135
+ ## Windows 内嵌终端排障
136
+
137
+ Lite 需要 Bun 读取已安装的 `dist/cli.js`、项目配置和 PGlite WASM 文件。若在 TRAE 等 IDE 内嵌 PowerShell 中出现 `EPERM reading`,先在同一终端运行最小文件读取测试:
138
+
139
+ ```powershell
140
+ Set-Content .\bun-read-test.js 'console.log("ok")'
141
+ bun .\bun-read-test.js
142
+ ```
143
+
144
+ 如果这个不含 Lite 的命令也返回 `EPERM`,故障发生在 Bun 启动应用之前,Lite 无法在应用代码内绕过宿主终端的文件访问限制。请切换到系统 PowerShell 或 Windows Terminal;随后升级到当前稳定版 Bun,并检查 IDE 沙箱、终端隔离和安全软件策略。`node` 能读取同一文件不代表 Bun 进程获得了相同的宿主权限。修复环境后再运行 `npx supacloud-lite --help` 验证。
145
+
146
+ 若最小测试成功而 Lite 仍失败,请保留完整错误、`bun --version`、终端类型和项目路径,再提交 Lite 问题。不要为绕过 `EPERM` 放宽项目目录的全局 ACL。
147
+
126
148
  ## 升级、快照与恢复
127
149
 
128
- 生产或持久化环境升级时,先更新项目锁定的 npm 依赖,再运行 Lite 的受控升级命令:
150
+ 生产或持久化环境升级时,必须先停止当前 Lite 进程。npm 安装先更新项目锁定的依赖,再运行受控升级命令:
129
151
 
130
152
  ```bash
131
153
  # 明确指定目标版本;不要在生产启动命令中隐式使用 @latest
@@ -135,7 +157,15 @@ bun add @supacloud/lite@0.2.0
135
157
  bunx supacloud-lite upgrade
136
158
  ```
137
159
 
138
- `upgrade` 不会自行修改 `package.json` 或联网更新 npm 包。它使用当前项目已经安装并锁定的 Lite 版本,默认把升级前快照写入 `.supacloud-lite/backups/pre-upgrade-<timestamp>.tar.gz`,快照成功后才执行 migrations。升级失败时,快照会保留,并打印恢复命令。
160
+ 单二进制安装需要先下载并校验候选文件,再由候选二进制迁移现有项目:
161
+
162
+ ```bash
163
+ ./supacloud-lite-new version
164
+ ./supacloud-lite-new upgrade --project-dir /path/to/project
165
+ ./supacloud-lite-new start --project-dir /path/to/project
166
+ ```
167
+
168
+ 替换程序文件与数据库迁移是两个独立动作。`upgrade` 不会联网、自我替换二进制或修改 `package.json`;它默认先把升级前快照写入 `.supacloud-lite/backups/pre-upgrade-<timestamp>.tar.gz`,快照成功后才执行尚未记录的 migrations 和 seed。升级失败时快照会保留,并打印恢复命令。需要回滚时,停止候选进程,用升级前快照恢复状态,再重新启动上一个已验证版本。
139
169
 
140
170
  也可以单独创建可移植快照:
141
171
 
@@ -185,6 +215,8 @@ S3 模式的快照只包含数据库中的 Storage 元数据和密钥,不复
185
215
  | `supabase.storage` | 已验证核心 | 覆盖上传下载、列表、删除、TUS/RLS、远端 S3 驱动,以及 Bun.Image 的 `contain`/`fill`、格式和质量变换子集;`cover` 明确不支持 |
186
216
  | `supabase.channel()` | 已验证核心 | 自动测试覆盖 `postgres_changes`、DELETE RLS 隔离和事件快照校验;Broadcast、Presence 属于实验性兼容 |
187
217
  | `supabase.functions.invoke()` | 已验证核心 | 自动测试覆盖 Bun.build、`Deno.serve()`、公开函数和同进程重启 |
218
+ | Supabase Queues / PGMQ | 已验证核心 | 提供 `pgmq_public` 的 `send`、`send_batch`、`read`、`pop`、`archive`、`delete` RPC;队列数据持久化在同一 PGlite 项目中 |
219
+ | Edge Functions `SupaCloud.pgredis` | 已验证核心 | 提供单项目持久 KV、TTL、原子 `getset`/`getdel`;绑定只在当前函数请求内可用 |
188
220
  | Supabase migrations | 支持 | 按文件名排序,记录到 `supabase_migrations` |
189
221
  | PostgreSQL RLS | 支持 | 使用 `anon`、`authenticated`、`service_role` 数据库角色执行 |
190
222
  | PostgREST 完整线协议 | 部分支持 | 目标是常用 `supabase-js` 行为,不承诺所有 PostgREST 边角行为 |
@@ -205,6 +237,44 @@ RLS 表的 Realtime DELETE 无法在行删除后安全重放 SELECT policy,因
205
237
 
206
238
  Lite 使用 Bun 原生 bcrypt,并兼容验证常见 GoTrue bcrypt 密码散列,因此经过映射的 `auth.users` 用户可保留密码。Auth 表结构、identity、refresh token 和 provider metadata 仍需通过受控迁移脚本转换;不要直接覆盖整个 `auth` schema。迁移后必须抽样验证登录,并为无法识别的散列准备密码重置流程。
207
239
 
240
+ ## 队列与 Edge 缓存
241
+
242
+ Lite 在同一个 PGlite 数据库中提供 Supabase Queues 的公开 RPC façade。应用可以直接使用官方客户端的
243
+ `supabase.schema('pgmq_public').rpc(...)`,无需额外的队列进程:
244
+
245
+ ```sql
246
+ -- 队列创建属于管理操作,应放在项目 migration 中,而不是匿名请求路径。
247
+ select pgmq.create('emails');
248
+ ```
249
+
250
+ ```ts
251
+ const queues = supabase.schema('pgmq_public')
252
+ const { data: ids } = await queues.rpc('send_batch', {
253
+ queue_name: 'emails',
254
+ messages: [{ to: 'user@example.com' }],
255
+ sleep_seconds: 0,
256
+ })
257
+ const { data: messages } = await queues.rpc('read', {
258
+ queue_name: 'emails',
259
+ sleep_seconds: 60,
260
+ n: 10,
261
+ })
262
+ ```
263
+
264
+ Lite 的 `pgmq` 模拟层还提供 `set_vt`,支持直接 SQL 调整可见性超时。消息按 PGMQ 语义至少投递一次;`pop` 会立即删除消息,`archive` 是确认路径。队列创建、指标、purge、设置和管理 API 不属于 Lite 的公开 RPC façade,仍需由项目 SQL 或完整 SupaCloud 控制面处理。
265
+ 队列名遵循标准版的 1-128 位小写字母、数字、下划线和短横线规则,并且必须以字母或数字开头;Lite 会安全映射超出 PostgreSQL 63-byte 标识符上限的名称,避免截断后串队。默认 Data API 暴露 `public` 和 `pgmq_public`;如果显式设置 `dbSchemas`,Lite 会严格使用该列表,需要队列 RPC 时应把 `pgmq_public` 明确加入。
266
+
267
+ Edge Function 内可使用 `globalThis.SupaCloud.pgredis`:
268
+
269
+ ```ts
270
+ const cache = globalThis.SupaCloud.pgredis
271
+ await cache.set('welcome:user:42', { rendered: true }, 60_000)
272
+ const value = await cache.get<{ rendered: boolean }>('welcome:user:42')
273
+ ```
274
+
275
+ 缓存实现使用项目自己的 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 协议、队列或限流能力。
276
+ Lite 的缓存调用是进程内数据库操作,不具备标准版跨进程 HTTP binding 的超时和请求中止传播;不要在同一 JavaScript 进程中混合加载 Lite 与标准 Edge Runtime,两者都拥有全局 `SupaCloud` binding,Lite 检测到已有其他实现时会拒绝启动。
277
+
208
278
  ## 多项目
209
279
 
210
280
  V1 不在一个进程内复用多个 PGlite 项目。需要多个项目时,为每个项目配置独立的工作目录、端口和 `.supacloud-lite` 状态目录,并用进程管理器分别启动。这样可保持数据库、JWT、Storage 和 Realtime 的故障域隔离。
@@ -213,7 +283,7 @@ V1 不在一个进程内复用多个 PGlite 项目。需要多个项目时,为
213
283
 
214
284
  PGlite 是 WebAssembly PostgreSQL,不是 SQLite。它换来了 PostgreSQL SQL、角色、RLS 和 Supabase 迁移兼容性,但内存占用通常高于 PocketBase/SQLite。生产部署前应按真实 schema、并发和 Realtime 负载做容量测试。
215
285
 
216
- 当前 npm 包依赖 PGlite WASM 资源,不承诺 Bun `--compile` 单文件二进制可直接携带全部资源。V1 推荐通过 Bun + npm 包部署。
286
+ npm 包继续通过依赖目录加载 PGlite。GitHub Release 的平台单二进制则内嵌 Bun、PGlite JS、核心 WASM/data Lite 使用的 contrib 扩展;启动时会把扩展压缩包释放到受限的临时目录,PGlite 初始化完成后立即清理。项目配置、Functions、数据库、对象存储和密钥仍保持外置。
217
287
 
218
288
  ## API
219
289
 
package/RELEASING.md CHANGED
@@ -19,4 +19,17 @@ bun run check
19
19
  bun audit --audit-level high
20
20
  ```
21
21
 
22
- `bun run check` 会构建包、执行真实 `supabase-js` 集成测试、生成 npm tarball、在临时消费者项目中安装 tarball,并验证 CLI、公开 API、PGlite WASM 和版本一致性。
22
+ `bun run check` 会构建包、执行真实 `supabase-js` 集成测试、生成 npm tarball、在临时消费者项目中安装 tarball,并验证 npm CLI、公开 API、PGlite WASM 和版本一致性。它还会构建 host 单二进制,在不含 Bun/Node/npm 的 `PATH` 下验证 Functions、PGlite contrib 扩展、持久数据升级、升级前快照和恢复。
23
+
24
+ ## Standalone binaries
25
+
26
+ 本地构建当前平台:
27
+
28
+ ```bash
29
+ bun run build:standalone:host
30
+ bun run test:standalone
31
+ ```
32
+
33
+ Release workflow 为 Linux x64 baseline/arm64、macOS x64/arm64 和 Windows x64 baseline 构建独立产物。Linux x64 产物必须在发布 runner 上完成真实黑盒测试;其他交叉编译产物在具备对应原生 runner 前只视为已构建,不能替代平台验收。
34
+
35
+ Lite release 会同时上传 `SHA256SUMS`、项目自身的 `SUPACLOUD-LITE-APACHE-2.0.txt`、`THIRD_PARTY_NOTICES.md` 和 `LICENSES/*.txt`,并为发布资产生成 provenance。正式对外分发 macOS 或 Windows 产物前,还应按项目发布策略完成代码签名;构建成功不代表已经签名或公证。
@@ -27,6 +27,42 @@ SupaCloud Lite 使用 ElectricSQL PGlite 作为嵌入式 PostgreSQL 引擎。
27
27
 
28
28
  SupaCloud Lite 使用 `tar` 作为跨平台流式快照归档依赖,避免把完整 PGlite 数据目录加载到内存。
29
29
 
30
- - License: ISC
30
+ - Version: 7.5.22
31
+ - License: BlueOak-1.0.0
31
32
  - Upstream: `https://github.com/isaacs/node-tar`
32
- - Distribution: 作为独立 npm 依赖安装,许可证随依赖包分发
33
+ - Local license copy: `LICENSES/NODE-TAR-BLUEOAK-1.0.0.txt`
34
+ - Distribution: npm 模式作为独立依赖安装;单二进制模式编入可执行文件
35
+
36
+ ### node-tar runtime dependencies
37
+
38
+ 单二进制会连同 `tar` 实际使用的完整运行时依赖树一起编入可执行文件:
39
+
40
+ | Package | Version | License | Upstream | Local license copy |
41
+ | --- | --- | --- | --- | --- |
42
+ | `@isaacs/fs-minipass` | 4.0.1 | ISC | `https://github.com/npm/fs-minipass` | `LICENSES/FS-MINIPASS-ISC.txt` |
43
+ | `chownr` | 3.0.0 | BlueOak-1.0.0 | `https://github.com/isaacs/chownr` | `LICENSES/CHOWNR-BLUEOAK-1.0.0.txt` |
44
+ | `minipass` | 7.1.3 | BlueOak-1.0.0 | `https://github.com/isaacs/minipass` | `LICENSES/MINIPASS-BLUEOAK-1.0.0.txt` |
45
+ | `minizlib` | 3.1.0 | MIT | `https://github.com/isaacs/minizlib` | `LICENSES/MINIZLIB-MIT.txt` |
46
+ | `yallist` | 5.0.0 | BlueOak-1.0.0 | `https://github.com/isaacs/yallist` | `LICENSES/YALLIST-BLUEOAK-1.0.0.txt` |
47
+
48
+ ## Bun runtime
49
+
50
+ SupaCloud Lite 单二进制由 Bun 1.3.14 编译并内嵌 Bun runtime,最终用户无需另外安装 Bun、Node.js 或 npm。
51
+
52
+ - Version: 1.3.14
53
+ - Bun license: MIT
54
+ - Upstream: `https://github.com/oven-sh/bun`
55
+ - Local runtime notice: `LICENSES/BUN-1.3.14-RUNTIME-NOTICES.txt`
56
+ - Notice source: Bun 1.3.14 `docs/project/license.mdx` 的逐字副本
57
+ - Linked-library coverage: JavaScriptCore/WebKit、`boringssl`、`brotli`、`libarchive`、`lol-html`、`mimalloc`、`picohttp`、`zstd`、`simdutf`、`tinycc`、`uSockets`、`zlib-ng`、`c-ares`、`libicu` 72、`libbase64`、Windows 上的 `libuv`、`libdeflate`、uWebSockets fork 和 Tigerbeetle IO 代码
58
+ - Polyfill coverage: `assert`、`browserify-zlib`、`buffer`、`constants-browserify`、`crypto-browserify`、`domain-browser`、`events`、`https-browserify`、`os-browserify`、`path-browserify`、`process`、`punycode`、`querystring-es3`、`stream-browserify`、`stream-http`、`string_decoder`、`timers-browserify`、`tty-browserify`、`url`、`util`、`vm-browserify`
59
+
60
+ Bun runtime notice 包含 JavaScriptCore/WebKit 的 LGPL-2 说明、静态链接库许可证链接及内嵌 polyfill 许可证清单;发布资产按原文分发,不以本摘要替代。
61
+
62
+ ## Standalone release license bundle
63
+
64
+ GitHub Release 在校验和与 provenance 生成前同时加入以下许可证资产:
65
+
66
+ - SupaCloud Lite 自身 Apache-2.0 许可证:从 `LICENSE` 复制为 `SUPACLOUD-LITE-APACHE-2.0.txt`
67
+ - 本文件:`THIRD_PARTY_NOTICES.md`
68
+ - `LICENSES/*.txt` 下的全部第三方许可证及 runtime notices