Use shared FigCraft history index codec

This commit is contained in:
Dylan M. Taylor committed 2026-11-13 11:05:37 +00:00
1 parent aa460b6f33
commit 821f9a8631
3 files changed
+8 -8

No files matched your search

Generated
+3 -3
View File
@@ -1029,9 +1029,9 @@ dependencies = [
[[package]]
name = "craft-figcraft-format"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=46bc8d7a0#46bc8d7a0ac906b59ce0c94b074367fd98d84d84"
source = "git+https://github.com/storytold/craft-libs?rev=c1d198925#c1d198925f10a640c4623cf9c1c0f775ff2d972e"
dependencies = [
"craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=46bc8d7a0)",
"craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c1d198925)",
"serde",
"serde_json",
"thiserror 2.0.21",
@@ -1231,7 +1231,7 @@ dependencies = [
[[package]]
name = "craft-zip"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=46bc8d7a0#46bc8d7a0ac906b59ce0c94b074367fd98d84d84"
source = "git+https://github.com/storytold/craft-libs?rev=c1d198925#c1d198925f10a640c4623cf9c1c0f775ff2d972e"
dependencies = [
"flate2",
"thiserror 2.0.21",
+1 -1
View File
@@ -60,7 +60,7 @@ craft-settings = { git = "https://github.com/storytold/craft-libs", rev = "e11f9
# a .fig message onto the REST file JSON, and that JSON's shared helpers. These crates share
# types, so they stay on one rev; they share none with the crates above.
craft-fig = { git = "https://github.com/storytold/craft-libs", rev = "d13ac58a15c45d618f25910772502e38c4ce1d4c" }
craft-figcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "46bc8d7a0" }
craft-figcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "c1d198925" }
craft-figma-rest = { git = "https://github.com/storytold/craft-libs", rev = "d13ac58a15c45d618f25910772502e38c4ce1d4c" }
# foundation
+4 -4
View File
@@ -503,7 +503,7 @@ pub fn save_bytes_with_history(
&mut z,
BRANCH_INDEX,
craft_figcraft_format::Compression::Level(3),
&serde_json::to_vec(&NativeBranchIndex { branches: index }).map_err(io_err)?,
&craft_figcraft_format::write_branch_index(&NativeBranchIndex { branches: index }).map_err(io_err)?,
)?;
}
if let Some(lib) = &doc.published {
@@ -542,7 +542,7 @@ fn put_versions(z: &mut craft_figcraft_format::ArchiveWriter, dir: &str, version
z,
&format!("{dir}/index.json"),
craft_figcraft_format::Compression::Level(3),
&serde_json::to_vec(&NativeVersionIndex { versions: index }).map_err(io_err)?,
&craft_figcraft_format::write_version_index(&NativeVersionIndex { versions: index }).map_err(io_err)?,
)?;
Ok(())
}
@@ -738,7 +738,7 @@ fn read_versions(
}
let index = match unpacked
.read(z, &index_name, MAX_VERSION_INDEX)
.and_then(|b| serde_json::from_slice::<NativeVersionIndex>(&b).map_err(|e| FormatError::Corrupt(e.to_string())))
.and_then(|b| craft_figcraft_format::read_version_index(&b).map_err(|e| FormatError::Corrupt(e.to_string())))
{
Ok(v) => v,
Err(e) => {
@@ -791,7 +791,7 @@ fn read_branches(
}
let index = match unpacked
.read(z, BRANCH_INDEX, MAX_VERSION_INDEX)
.and_then(|b| serde_json::from_slice::<NativeBranchIndex>(&b).map_err(|e| FormatError::Corrupt(e.to_string())))
.and_then(|b| craft_figcraft_format::read_branch_index(&b).map_err(|e| FormatError::Corrupt(e.to_string())))
{
Ok(v) => v,
Err(e) => {