@calcit/procs 0.12.44 → 0.12.45
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/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/build.rs
CHANGED
|
@@ -23,6 +23,8 @@ pub struct CodeEntry {
|
|
|
23
23
|
pub doc: String,
|
|
24
24
|
#[serde(default)]
|
|
25
25
|
pub examples: Vec<Cirru>,
|
|
26
|
+
#[serde(default)]
|
|
27
|
+
pub tags: Vec<String>,
|
|
26
28
|
pub code: Cirru,
|
|
27
29
|
#[serde(default)]
|
|
28
30
|
pub schema: Option<Edn>,
|
|
@@ -261,6 +263,32 @@ fn validate_schema_edn_no_legacy_quotes(value: &Edn, owner: &str) -> Result<(),
|
|
|
261
263
|
walk(value, owner, &mut path)
|
|
262
264
|
}
|
|
263
265
|
|
|
266
|
+
fn parse_tags_from_edn(value: &Edn, owner: &str) -> Result<Vec<String>, String> {
|
|
267
|
+
match value {
|
|
268
|
+
Edn::Set(set) => {
|
|
269
|
+
let mut tags = Vec::with_capacity(set.0.len());
|
|
270
|
+
for item in &set.0 {
|
|
271
|
+
match item {
|
|
272
|
+
Edn::Tag(tag) => tags.push(format!(":{}", tag.ref_str())),
|
|
273
|
+
other => {
|
|
274
|
+
return Err(format!(
|
|
275
|
+
"{owner}: CodeEntry.tags expects tag items, got {}",
|
|
276
|
+
format_edn_preview(other)
|
|
277
|
+
));
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
tags.sort();
|
|
282
|
+
tags.dedup();
|
|
283
|
+
Ok(tags)
|
|
284
|
+
}
|
|
285
|
+
other => Err(format!(
|
|
286
|
+
"{owner}: CodeEntry.tags expects a hashset, got {}",
|
|
287
|
+
format_edn_preview(other)
|
|
288
|
+
)),
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
264
292
|
fn parse_code_entry(edn: Edn, owner: &str) -> Result<CodeEntry, String> {
|
|
265
293
|
let record: EdnRecordView = match edn {
|
|
266
294
|
Edn::Record(r) => r,
|
|
@@ -268,12 +296,14 @@ fn parse_code_entry(edn: Edn, owner: &str) -> Result<CodeEntry, String> {
|
|
|
268
296
|
};
|
|
269
297
|
let mut doc = String::new();
|
|
270
298
|
let mut examples: Vec<Cirru> = vec![];
|
|
299
|
+
let mut tags: Vec<String> = Vec::new();
|
|
271
300
|
let mut code: Option<Cirru> = None;
|
|
272
301
|
let mut schema: Option<Edn> = None;
|
|
273
302
|
for (key, value) in &record.pairs {
|
|
274
303
|
match key.arc_str().as_ref() {
|
|
275
304
|
"doc" => doc = from_edn(value.clone()).map_err(|e| format!("{owner}: invalid `:doc`: {e}"))?,
|
|
276
305
|
"examples" => examples = from_edn(value.clone()).map_err(|e| format!("{owner}: invalid `:examples`: {e}"))?,
|
|
306
|
+
"tags" => tags = parse_tags_from_edn(value, owner)?,
|
|
277
307
|
"code" => code = Some(from_edn(value.clone()).map_err(|e| format!("{owner}: invalid `:code`: {e}"))?),
|
|
278
308
|
"schema" => {
|
|
279
309
|
if !matches!(value, Edn::Nil) {
|
|
@@ -286,6 +316,7 @@ fn parse_code_entry(edn: Edn, owner: &str) -> Result<CodeEntry, String> {
|
|
|
286
316
|
Ok(CodeEntry {
|
|
287
317
|
doc,
|
|
288
318
|
examples,
|
|
319
|
+
tags,
|
|
289
320
|
code: code.ok_or_else(|| format!("{owner}: missing `:code` field in CodeEntry"))?,
|
|
290
321
|
schema,
|
|
291
322
|
})
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# &get-def-doc / &get-def-schema
|
|
2
|
+
|
|
3
|
+
- 新增 `&get-def-doc`、`&get-def-schema` 内置函数,参数为 `ns/def` 字符串或 symbol。
|
|
4
|
+
- Rust/eval 运行时通过 `program::lookup_def_doc` / `lookup_def_schema` 读取已加载定义的 `:doc` 与 `:schema`。
|
|
5
|
+
- `snapshot::schema_annotation_to_edn` 统一 schema 转 EDN。
|
|
6
|
+
- calcit-js 标记为 unavailable,不生成 def-meta 注册表,避免 js-out 膨胀。
|
|
7
|
+
- 测试:`calcit/test-def-meta.cirru`,仅在 `inside-eval:` 下运行。
|
package/lib/calcit.procs.mjs
CHANGED
|
@@ -2147,5 +2147,7 @@ export let gensym = unavailableProc;
|
|
|
2147
2147
|
export let macroexpand = unavailableProc;
|
|
2148
2148
|
export let macroexpand_all = unavailableProc;
|
|
2149
2149
|
export let _$n_get_calcit_running_mode = unavailableProc;
|
|
2150
|
+
export let _$n_get_def_doc = unavailableProc;
|
|
2151
|
+
export let _$n_get_def_schema = unavailableProc;
|
|
2150
2152
|
// already handled in code emitter
|
|
2151
2153
|
export let raise = unavailableProc;
|
package/lib/package.json
CHANGED
package/package.json
CHANGED
package/ts-src/calcit.procs.mts
CHANGED
|
@@ -2278,6 +2278,8 @@ export let gensym = unavailableProc;
|
|
|
2278
2278
|
export let macroexpand = unavailableProc;
|
|
2279
2279
|
export let macroexpand_all = unavailableProc;
|
|
2280
2280
|
export let _$n_get_calcit_running_mode = unavailableProc;
|
|
2281
|
+
export let _$n_get_def_doc = unavailableProc;
|
|
2282
|
+
export let _$n_get_def_schema = unavailableProc;
|
|
2281
2283
|
|
|
2282
2284
|
// already handled in code emitter
|
|
2283
2285
|
export let raise = unavailableProc;
|