@calcit/procs 0.12.21 → 0.12.24

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.
Binary file
package/README.md CHANGED
@@ -29,12 +29,19 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
29
29
  cargo install calcit
30
30
  ```
31
31
 
32
- 3 binaries are installed:
32
+ 4 binaries are installed:
33
33
 
34
34
  - `calcit`, the runtime and js compiler
35
+ - `cr-wasm`, standalone WASM codegen tool
35
36
  - `caps`, for downloading dependencies declared in `deps.cirru`
36
37
  - `bundle_calcit`, bundle code if you don't want to use Calcit Editor
37
38
 
39
+ When installing from source, explicitly include both runners:
40
+
41
+ ```bash
42
+ cargo install --path . --bin cr --bin cr-wasm --bin caps --bin bundle_calcit
43
+ ```
44
+
38
45
  To use Calcit in GitHub Actions, try [setup-cr](https://github.com/calcit-lang/setup-cr).
39
46
 
40
47
  ### Usage
@@ -163,6 +170,8 @@ cargo run --bin cr -- calcit/test.cirru -1 js && yarn try-js
163
170
  cargo run --bin cr -- eval 'range 100'
164
171
 
165
172
  cr compact.cirru -1 ir # compiles intermediate representation into program-ir.cirru
173
+
174
+ cr-wasm calcit/test-wasm.cirru # compile standalone wasm target to js-out/program.wasm
166
175
  ```
167
176
 
168
177
  - [Cirru Parser](https://github.com/Cirru/parser.rs) for indentation-based syntax parsing.
@@ -0,0 +1,18 @@
1
+ # 2026-04-18 20:41 CR WASM Split and Runtime Stability
2
+
3
+ ## 关键修改
4
+
5
+ - 将 `cr wasm` 拆分为独立二进制 `cr-wasm`,避免主 `cr` 命令体积和职责继续膨胀。
6
+ - `calcit` 的 WASM 相关验证脚本和 CI 调整为优先走 `cr-wasm`。
7
+ - 修复 `emit_wasm` 中 map/set/tuple 相关回归点,恢复 `yarn check-all` 的可通过性。
8
+ - 修复 `recollect` 在 Rust 运行时下的 `patch-map` 路径,避免本地变量解析异常导致测试阻断。
9
+ - 将 `recollect` 的 wasm 测试分为核心 smoke(阻断)与扩展 probes(非阻断),保证 wasm 独立验证但不影响 rust/js 主链路。
10
+ - 版本提升到 patch:`0.12.22`。
11
+
12
+ ## 经验与注意事项
13
+
14
+ - 对 `compact.cirru` 的修改必须通过 `cr edit`/`cr tree` 完成,避免文本直接编辑破坏结构。
15
+ - 在多项目联动(calcit + recollect)场景下,发布前验证至少应覆盖:
16
+ - calcit: `yarn check-all`
17
+ - recollect: `yarn test:cr`、`yarn test:js`、`yarn test:wasm`
18
+ - macOS 上遇到 `iconv` 链接问题时,需带 `SDKROOT` 执行构建命令进行最终回归确认。
@@ -0,0 +1,13 @@
1
+ # 2026-04-18 20:45 v0.12.23 CI WASM Fix
2
+
3
+ ## 变更摘要
4
+
5
+ - 解决 GitHub Actions `try wasm` 步骤失败(exit 127)的问题。
6
+ - 原因:workflow 直接调用 `./target/debug/cr-wasm`,但未提前构建二进制。
7
+ - 修复:在 `.github/workflows/test.yaml` 的 wasm 步骤中先执行 `cargo build --bin cr-wasm`,再运行 `scripts/test-wasm.sh`。
8
+ - 版本升级:`0.12.22` -> `0.12.23`(`Cargo.toml` 与 `package.json` 同步)。
9
+
10
+ ## 验证
11
+
12
+ - 本地 `cargo check` 通过。
13
+ - 后续以推送后的 Actions `Test` 工作流成功作为发布门禁,再创建 GitHub Release。
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.12.21",
3
+ "version": "0.12.24",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^25.0.9",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.12.21",
3
+ "version": "0.12.24",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^25.0.9",
@@ -222,6 +222,58 @@ WASM GC proposal(2024 年起 V8/SpiderMonkey 已发布)提供:
222
222
  2. **中期**: 路径二的子集 — 从纯数值计算函数开始,生成 WASM 模块作为 JS codegen 的"加速岛"(hot island),由 JS 运行时按需调用
223
223
  3. **远期**: 路径三 — 随 WASM GC 工具链成熟,逐步扩展可编译子集
224
224
 
225
+ ## 2026-04 进展状态
226
+
227
+ 当前项目已经不再停留在“可行性评估”阶段,而是进入“持续补齐子集能力”的实施阶段:
228
+
229
+ - `src/codegen/emit_wasm.rs` 已落地,并拆分出 `runtime.rs`、`methods.rs`、`records.rs` 子模块维护。
230
+ - `yarn check-all` 已纳入 WASM 验证,当前会编译 `calcit/test-wasm.cirru` 并通过 `scripts/test-wasm.mjs` 做 Node.js 侧断言。
231
+ - 发布版本 `0.12.21` 已覆盖 BufList、基础 map/set/list/tuple/record 操作、若干动态方法分派、host println/logging 等运行时能力。
232
+ - `recollect` 已可在已发布的 `setup-cr` 工具链上启用 WASM 回归测试,但仍有更高层 API 与应用侧依赖未覆盖。
233
+
234
+ 可以更直白地估计当前距离:
235
+
236
+ - 距离“底层运行时对子集集合操作足够稳固”大约还剩 `30%`。
237
+ - 距离“`calcit.core` 高频 helper 在真实下游项目里不需要大面积绕开”大约还剩 `50%`。
238
+ - 距离“Respo/recollect 这类应用侧流程可稳定跑通”大约还剩 `75%`。
239
+
240
+ 这意味着近期重点不再是“证明能不能做”,而是“持续缩小尚未支持的语言与运行时边界”。
241
+
242
+ ## 近期计划细化
243
+
244
+ ### P0: 消除被下游真实项目阻塞的运行时缺口
245
+
246
+ 优先级依据不是抽象完整性,而是下游项目是否真实卡住:
247
+
248
+ 1. 继续补动态 method/runtime 缺口。
249
+ - `.contains?`、`.includes?`、`.empty` 已开始在 direct method path 上落地,但 `calcit.core` wrapper 侧仍有 skip 项,需要继续把 lowering 对齐到底。
250
+ - 当前仍缺 `.min`、`.max` 等集合方法的稳定支持。
251
+ - 这些能力会直接影响 `calcit.core` 高层 helper 在 WASM 下的可用性。
252
+
253
+ 2. 继续补充 `calcit.core` 常见高阶路径。
254
+ - `foldl`、`foldl-shortcut`、`foldr-shortcut`、`sort`、`&call-spread` 仍是大量跳过项的源头。
255
+ - 这部分不是为了追求“理论完备”,而是为了减少真实项目中被迫绕开 core helper 的情况。
256
+
257
+ 3. 持续扩大 `test-wasm.cirru` 的下游回归覆盖。
258
+ - 每补一个能力,都应优先加一个最小但能锁定语义边界的 WASM 用例。
259
+ - 需要优先覆盖下游真实依赖的模式,而不是只补纯数值 demo。
260
+
261
+ ### P1: 以 recollect 为代表补 API 级验证
262
+
263
+ `recollect` 已经证明当前 WASM 子集可支撑一部分 diff/patch 逻辑,因此下一阶段应显式面向下游 API:
264
+
265
+ 1. 用 API parity fixtures 覆盖 `diff-twig` / `patch-twig`。
266
+ 2. 增加 record-heavy / map-heavy / nested tree 场景。
267
+ 3. 把“当前可运行”和“仍 blocked”的场景分开记录,避免 roadmap 只剩模糊叙述。
268
+
269
+ ### P2: 推进解释器到 wasm32 的基础编译检查
270
+
271
+ 路径一仍值得保留,但它的短期目标应更具体:
272
+
273
+ 1. 先跑通 `cargo build --target wasm32-unknown-unknown --lib`。
274
+ 2. 把剩余链接错误收敛成明确的 `cfg` 门控清单。
275
+ 3. 把解释器路径与 AOT 路径共享的可复用运行时能力整理出来,避免两条线重复补洞。
276
+
225
277
  ## 验证第一步
226
278
 
227
279
  ```bash