@calcit/procs 0.12.26 → 0.12.29

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
@@ -29,7 +29,6 @@ calcit.core 内部定义了 `map/filter/each/any?/every?/find/find-index` 等 HO
29
29
  ### `src/codegen/emit_wasm/sets.rs`
30
30
 
31
31
  新增:
32
-
33
32
  - **`emit_set_intersection`** — `&set:intersection a b`:返回两集合共有元素。逻辑与 `emit_set_difference` 对称,条件取反(`I32Ne` 代替 `I32Eq`)。
34
33
 
35
34
  ### `src/codegen/emit_wasm/lists.rs`
@@ -39,7 +38,6 @@ calcit.core 内部定义了 `map/filter/each/any?/every?/find/find-index` 等 HO
39
38
  ### `src/codegen/emit_wasm.rs`
40
39
 
41
40
  **`emit_call_expr` 的 `calcit.core` 拦截块** 新增:
42
-
43
41
  ```rust
44
42
  "map" if args_list.len() == 2 => return emit_map(ctx, &args_list),
45
43
  "map-indexed" if args_list.len() == 2 => return emit_map_indexed(ctx, &args_list),
@@ -54,13 +52,11 @@ calcit.core 内部定义了 `map/filter/each/any?/every?/find/find-index` 等 HO
54
52
  ```
55
53
 
56
54
  **`emit_proc_call`** 新增:
57
-
58
55
  ```rust
59
56
  CalcitProc::NativeSetIntersection => emit_set_intersection(ctx, args),
60
57
  ```
61
58
 
62
59
  **`emit_call_spread`** 新增 `Calcit::Proc` arm:
63
-
64
60
  ```rust
65
61
  Calcit::Proc(proc) => emit_call_spread_args_as_regular(ctx, proc, call_args),
66
62
  ```
@@ -12,7 +12,6 @@
12
12
  Added `emit_enum_tuple_new` for the `%::` proc (enum variant constructor).
13
13
 
14
14
  Key insight: `%::` always has the form `(%:: enum_class tag payload...)` where:
15
-
16
15
  - `enum_class` (args[0]) is for type-checking only — **ignored in WASM**
17
16
  - `tag` (args[1]) is the actual variant tag (Calcit::Tag)
18
17
  - `payload` (args[2..]) are the values
@@ -28,7 +27,6 @@ Memory layout is identical to `::` tuples: `[count:f64][tag_id:f64][payload...]`
28
27
  **File**: `src/codegen/emit_wasm/records.rs`
29
28
 
30
29
  Extended `emit_tuple_new` to accept `Calcit::Bool` as the tag field:
31
-
32
30
  - `true` → `1.0`
33
31
  - `false` → `0.0`
34
32
 
@@ -41,12 +39,10 @@ Extended `emit_tuple_new` to accept `Calcit::Bool` as the tag field:
41
39
  **File**: `src/codegen/emit_wasm/strings.rs`, `src/codegen/emit_wasm.rs`
42
40
 
43
41
  Added two new pub functions:
44
-
45
42
  - `emit_str_variadic(ctx, args)`: `(str a b c ...)` → left-fold of string concat
46
43
  - `emit_str_spaced(ctx, args)`: `(str-spaced a b c ...)` → join with space separator
47
44
 
48
45
  Private helper:
49
-
50
46
  - `concat_two_i32_ptrs(ctx, ptr_a, ptr_b)`: concatenates two strings from i32 ptr locals
51
47
 
52
48
  **Key technique**: `emit_turn_string` converts any f64 value to a string, then `concat_two_i32_ptrs` combines them without re-emitting expressions.
@@ -54,7 +50,6 @@ Private helper:
54
50
  For `str-spaced`, the space character is allocated dynamically (1-byte string with 0x20 written via `I32Store8`) to avoid depending on the string pool.
55
51
 
56
52
  **Intercept added in `emit_call_expr`** for `calcit.core` namespace:
57
-
58
53
  ```rust
59
54
  "str" if !args_list.is_empty() => return emit_str_variadic(ctx, &args_list),
60
55
  "str-spaced" if !args_list.is_empty() => return emit_str_spaced(ctx, &args_list),
@@ -0,0 +1,7 @@
1
+ - Fixed WASM `&str:nth` to return a one-character string or nil, matching native Calcit semantics.
2
+ - Added string-content-aware `=` handling in WASM while keeping `identical?` as raw-value equality.
3
+ - Inlined imported top-level value defs in WASM so string constants like `dictionary` are usable at runtime.
4
+ - Fixed `nil?` lowering in WASM to match the backend's nil representation.
5
+ - Corrected `&map:diff-new` argument semantics in WASM codegen.
6
+ - Updated WASM tests/docs to match current `&str:nth` semantics.
7
+ - Validated with `cargo clippy -- -D warnings`, `yarn compile`, `cargo test`, and `yarn check-all` before bumping version to `0.12.26`.
@@ -0,0 +1,14 @@
1
+ # 发布流程规范与加速
2
+
3
+ ## 本次改动
4
+
5
+ - 更新 `Agents.md`:新增"发布流程规范"章节,记录版本升级、PR/tag 习惯、crates.io 加速措施
6
+ - 更新 `.github/workflows/publish.yaml`:加入两项加速
7
+ 1. `CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse`:加速 crates.io index 查找(分钟级 → 秒级)
8
+ 2. `cargo publish --no-verify`:跳过发布前重复的编译验证,因为本地和 PR CI 已跑过
9
+
10
+ ## 关键规范
11
+
12
+ - 版本升级:`Cargo.toml` 和 `package.json` 两边同步改,再更新 `Cargo.lock`/`yarn.lock`
13
+ - Tag 格式:`0.12.27`(无 `v` 前缀),与 commit 一起打,message 注明版本号
14
+ - 分支开发,不自动合并;本地测试全过 → push PR → Actions 全过 → 手动合并
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.12.26",
3
+ "version": "0.12.29",
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.26",
3
+ "version": "0.12.29",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^25.0.9",
@@ -1,38 +0,0 @@
1
- # v0.12.26 WASM 改进总结
2
-
3
- ## 修改概要
4
-
5
- ### 1. 修复 `&>=` / `&<=` / `&>` / `&<` 在 WASM 中的 nil=0 碰撞问题
6
-
7
- **问题**:Calcit WASM 运行时用 `0.0` 表示 nil,而 `calcit.core/&>=` 等内部函数在比较前会调用 `number? x`,但 `number? 0` 返回 false(因为 nil=0),导致 `assert` trap。
8
-
9
- **修复**(`src/codegen/emit_wasm.rs`):在 `calcit.core` 导入分支拦截 `&>=`、`&<=`、`&>`、`&<`,直接 emit `F64Ge`/`F64Le`/`F64Gt`/`F64Lt` 指令,绕过 nil 检查。
10
-
11
- ### 2. 修复字符串相等性(`NativeEquals` / `Identical`)
12
-
13
- **问题**:`NativeEquals` 使用 `F64Eq` 比较指针,两个内容相同的字符串因指针不同而判断不相等。
14
-
15
- **修复**(`src/codegen/emit_wasm.rs`):改用 `__rt_generic_eq` 运行时函数,进行字节内容比较。
16
-
17
- ### 3. 修复 `&map:diff-new` 参数顺序
18
-
19
- **问题**:实现代码注释写的 "b = args[0], a = args[1]",但实际语义应为 "a = args[0], b = args[1]",返回 b 中不在 a 里的条目。测试用例 `(&map:diff-new {:a 1 :b 2} {:b 3 :c 4 :d 5})` 期望 2,但因参数顺序错误返回 1。
20
-
21
- **修复**(`src/codegen/emit_wasm/maps.rs`):调换 `a` 和 `b` 的赋值顺序,使 `a=args[0]`,`b=args[1]`(迭代 b,检查 a)。
22
-
23
- ### 4. 修复 test-wasm.mjs 字符串测试期望值
24
-
25
- **问题**:`test-str-nth` 和 `test-str-first` 的测试期望 byte 数值(101, 104),但 `&str:nth`/`&str:first` 正确返回 1-char 字符串堆指针。
26
-
27
- **修复**(`scripts/test-wasm.mjs`):添加 `readStr` 和 `checkStr` 辅助函数,改用字符串内容比较替代数值比较。
28
-
29
- ### 5. Clippy 告警修复
30
-
31
- **修复**(`src/codegen/emit_wasm/runtime.rs`):为 `build_rt_hash_f64` 添加 `#[allow(dead_code)]`;为 `build_rt_generic_compare`、`build_rt_generic_eq`、`build_rt_hash_f64_semantic` 添加 `#[allow(clippy::vec_init_then_push)]`。
32
-
33
- ## 知识点
34
-
35
- - WASM nil=0.0 的约束:所有核心函数如果对入参用 `number?` 进行断言,当传入 0 时会 trap。应直接 emit 低级指令绕过。
36
- - 字符串比较应使用 `__rt_generic_eq` 而非 `F64Eq`(指针比较)。
37
- - `&str:nth`/`&str:first` 返回 1-char 字符串(堆指针),不是 char code;test 脚本需用 `readStr` 读取内容比较。
38
- - `&map:diff-new a b` 语义:返回 b 中不在 a 里的条目;参数顺序为 (a, b)。