feat: consume the WEB-03 handoff with output-relative source links #3
No files matched your search
Generated
+1
-1
@@ -11,7 +11,7 @@ checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "marqdo-web-design"
|
name = "marqdo-web-design"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.cflmy.cn/cflmy/marqdo-web-design?rev=2f18dede8540c82611819e2c24a19db138d5ac14#2f18dede8540c82611819e2c24a19db138d5ac14"
|
source = "git+https://git.cflmy.cn/cflmy/marqdo-web-design?rev=1b6607fd3cc09801b4f6eacd2fba547caa0ec637#1b6607fd3cc09801b4f6eacd2fba547caa0ec637"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
]
|
]
|
||||||
|
|||||||
+1
-1
@@ -7,5 +7,5 @@ license = "MIT OR Apache-2.0"
|
|||||||
description = "Offline Web design preview and the unique marqdo web Tool"
|
description = "Offline Web design preview and the unique marqdo web Tool"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
marqdo-web-design = { git = "https://git.cflmy.cn/cflmy/marqdo-web-design", rev = "2f18dede8540c82611819e2c24a19db138d5ac14" }
|
marqdo-web-design = { git = "https://git.cflmy.cn/cflmy/marqdo-web-design", rev = "1b6607fd3cc09801b4f6eacd2fba547caa0ec637" }
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
| 对象 | 身份 |
|
| 对象 | 身份 |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| CLI | 由根固定 `cli/deadf6e` 构建的 `marqdo 3.0.0-rc.4`,SHA-256 `sha256:6ede3b9e...` |
|
| CLI | 由根固定 `cli/deadf6e` 构建的 `marqdo 3.0.0-rc.4`,SHA-256 `sha256:6ede3b9e...` |
|
||||||
| Design 依赖 | `marqdo-web-design@2f18dede8540c82611819e2c24a19db138d5ac14`(`Cargo.lock` 固定 git rev;不是 `../design` 路径依赖) |
|
| Design 依赖 | `marqdo-web-design@1b6607fd3cc09801b4f6eacd2fba547caa0ec637`(WEB-03 handoff/图/切片)(`Cargo.lock` 固定 git rev;不是 `../design` 路径依赖) |
|
||||||
| 平台 | Linux x86_64(本机验证) |
|
| 平台 | Linux x86_64(本机验证) |
|
||||||
|
|
||||||
## 执行
|
## 执行
|
||||||
@@ -33,7 +33,7 @@ MARQDO_BIN=<verified marqdo> scripts/ci.sh
|
|||||||
|
|
||||||
## 未验证 / 后续(不隐藏)
|
## 未验证 / 后续(不隐藏)
|
||||||
|
|
||||||
- 真实浏览器(Playwright/file://)行为、responsive 390px 无横向溢出、按钮实际状态切换的 DOM 断言未执行;当前只有静态制品断言。
|
- WEB-03 交付内容由图/切片/漂移提供,Preview 已验证相对链接;真实浏览器(Playwright/file://)行为、responsive 390px 无横向溢出、按钮实际状态切换的 DOM 断言未执行;当前只有静态制品断言。
|
||||||
- 图片/本地 raster 资产复制、魔数/大小校验、远端图片文本占位尚未实现(当前不渲染图片)。
|
- 图片/本地 raster 资产复制、魔数/大小校验、远端图片文本占位尚未实现(当前不渲染图片)。
|
||||||
- 完整安全负例矩阵(`</script>`/Unicode/双引号 fixture、输出预算边界、超时/进程限制)未系统性覆盖。
|
- 完整安全负例矩阵(`</script>`/Unicode/双引号 fixture、输出预算边界、超时/进程限制)未系统性覆盖。
|
||||||
- 冷安装(root 生态 `web` Tool 与 WEB-05)未开始;WEB-04 生产交付试验未开始。
|
- 冷安装(root 生态 `web` Tool 与 WEB-05)未开始;WEB-04 生产交付试验未开始。
|
||||||
@@ -27,6 +27,16 @@ handoff="$work/handoff.md"
|
|||||||
"$MARQDO_BIN" web handoff tests/fixture/index.mq.md --unit 工作台 --out "$handoff"
|
"$MARQDO_BIN" web handoff tests/fixture/index.mq.md --unit 工作台 --out "$handoff"
|
||||||
test -s "$handoff"
|
test -s "$handoff"
|
||||||
grep -q "Design handoff" "$handoff"
|
grep -q "Design handoff" "$handoff"
|
||||||
|
grep -q "components/nav.mq.md#导航" "$handoff"
|
||||||
|
python3 - "$handoff" <<'PY'
|
||||||
|
import pathlib, sys, re
|
||||||
|
text = pathlib.Path(sys.argv[1]).read_text()
|
||||||
|
assert "](" in text
|
||||||
|
for target in re.findall(r"\]\(([^)]+)\)", text):
|
||||||
|
assert not target.startswith("/"), target
|
||||||
|
assert not target.startswith("file:"), target
|
||||||
|
print("handoff links are relative")
|
||||||
|
PY
|
||||||
if "$MARQDO_BIN" web preview tests/fixture/index.mq.md --unit 工作台 --out "$preview" 2>/dev/null; then
|
if "$MARQDO_BIN" web preview tests/fixture/index.mq.md --unit 工作台 --out "$preview" 2>/dev/null; then
|
||||||
echo "preview overwrote an existing directory" >&2
|
echo "preview overwrote an existing directory" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
+10
-3
@@ -13,7 +13,8 @@ use std::path::{Path, PathBuf};
|
|||||||
use std::process::ExitCode;
|
use std::process::ExitCode;
|
||||||
|
|
||||||
use marqdo_web_design::{
|
use marqdo_web_design::{
|
||||||
handoff, load, ComponentDef, ContentBlock, Design, Error, Instance, LoadConfig, Scenario, Width,
|
handoff_relative_to, load, ComponentDef, ContentBlock, Design, Error, Instance, LoadConfig,
|
||||||
|
Scenario, Width,
|
||||||
};
|
};
|
||||||
|
|
||||||
const CSS: &str = r#"
|
const CSS: &str = r#"
|
||||||
@@ -574,12 +575,18 @@ fn run_handoff(args: &Args) -> ExitCode {
|
|||||||
return ExitCode::from(code);
|
return ExitCode::from(code);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let text = handoff(&design);
|
let out = PathBuf::from(out);
|
||||||
|
let base = out
|
||||||
|
.parent()
|
||||||
|
.filter(|parent| !parent.as_os_str().is_empty())
|
||||||
|
.map(Path::to_path_buf)
|
||||||
|
.unwrap_or_else(|| PathBuf::from("."));
|
||||||
|
let base = base.canonicalize().unwrap_or(base);
|
||||||
|
let text = handoff_relative_to(&design, &base);
|
||||||
if text.len() > 4 * 1024 * 1024 {
|
if text.len() > 4 * 1024 * 1024 {
|
||||||
eprintln!("web handoff: error: handoff exceeds the 4 MiB budget");
|
eprintln!("web handoff: error: handoff exceeds the 4 MiB budget");
|
||||||
return ExitCode::from(2);
|
return ExitCode::from(2);
|
||||||
}
|
}
|
||||||
let out = PathBuf::from(out);
|
|
||||||
if let Some(parent) = out.parent() {
|
if let Some(parent) = out.parent() {
|
||||||
if !parent.as_os_str().is_empty() && !parent.is_dir() {
|
if !parent.as_os_str().is_empty() && !parent.is_dir() {
|
||||||
eprintln!("web handoff: error: output parent is not a directory");
|
eprintln!("web handoff: error: output parent is not a directory");
|
||||||
|
|||||||
Reference in new issue
Block a user