feat: consume the WEB-03 handoff with output-relative source links

Bump the fixed Design revision to the handoff/graph/slice/drift candidate and
make web handoff use handoff_relative_to with the output directory, so source
links stay relative when the delivery file is written elsewhere. CI asserts the
links are relative (no absolute/file targets) and that sources are present.

Refs cflmy/marqdo-web-preview#1, cflmy/marqdo-web-design#2, cflmy/marqdo#6
This commit was merged in pull request #3.
This commit is contained in:
cflmy committed 2026-11-27 08:57:22 +08:00
1 parent e739f4504a
commit eff273f7f2
5 files changed
+24 -7

No files matched your search

+10 -3
View File
@@ -13,7 +13,8 @@ use std::path::{Path, PathBuf};
use std::process::ExitCode;
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#"
@@ -574,12 +575,18 @@ fn run_handoff(args: &Args) -> ExitCode {
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 {
eprintln!("web handoff: error: handoff exceeds the 4 MiB budget");
return ExitCode::from(2);
}
let out = PathBuf::from(out);
if let Some(parent) = out.parent() {
if !parent.as_os_str().is_empty() && !parent.is_dir() {
eprintln!("web handoff: error: output parent is not a directory");