Unify frontmatter imports as import bind:target and drop > imports.
`import json:lib/json.mq.md` binds file libraries; `import fmt:time.format` binds member short names (replaces `> use`). Legacy `> path.mq.md` / `> use` now hard-error with a hint. Migrates repo docs, skills, ext, lib, public, examples, man-test and tests; adds a negative gold and updates view/catalog rendering. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
56b9bfa5a3
commit
ecc92f473a
163 files changed
+577
-593
No files matched your search
+3
-3
@@ -6,14 +6,14 @@ use crate::diagnostics::Span;
|
||||
use crate::formula::Expr as FormulaExpr;
|
||||
use crate::value::CodeBlock;
|
||||
|
||||
/// Frontmatter import: path + library bind name (see `doc/design/module-namespace.md`).
|
||||
/// Frontmatter file import: `import bind:path.mq.md` (see `doc/design/module-namespace.md`).
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Import {
|
||||
pub path: String,
|
||||
pub bind: String,
|
||||
}
|
||||
|
||||
/// Frontmatter `use` / `使用`: bind a short name to a library path (`time.format`).
|
||||
/// Frontmatter short-name bind: `import bind:lib.member` (same keyword as file import).
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Use {
|
||||
pub path: Vec<String>,
|
||||
@@ -199,7 +199,7 @@ pub fn format_ast_dump(path: &str, module: &Module) -> String {
|
||||
let specs: Vec<String> = module
|
||||
.imports
|
||||
.iter()
|
||||
.map(|i| format!("{} as {}", i.path, i.bind))
|
||||
.map(|i| format!("import {}:{}", i.bind, i.path))
|
||||
.collect();
|
||||
out.push_str(&format!("(imports {:?})\n", specs));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user