alinea
Version:
[](https://npmjs.org/package/alinea) [](https://packagephobia.com/result?p=alinea)
21 lines (19 loc) • 1.14 kB
JavaScript
import {
e
} from "../../chunks/chunk-YHFRTBNP.js";
import "../../chunks/chunk-U5RRZUYZ.js";
// src/backend/util/ContentHash.ts
var xxHash = e();
async function createFileHash(data) {
const { h32Raw } = await xxHash;
return h32Raw(data).toString(16).padStart(8, "0");
}
async function createRowHash(entry) {
const { create32 } = await e();
const hash = create32().update(`entryId ${entry.entryId}`).update(`phase ${entry.phase}`).update(`title ${entry.title}`).update(`type ${entry.type}`).update(`seeded ${entry.seeded}`).update(`workspace ${entry.workspace}`).update(`root ${entry.root}`).update(`level ${entry.level}`).update(`filePath ${entry.filePath}`).update(`parentDir ${entry.parentDir}`).update(`childrenDir ${entry.childrenDir}`).update(`index ${entry.index}`).update(`parent ${entry.parent}`).update(`i18nId ${entry.i18nId}`).update(`locale ${entry.locale}`).update(`fileHash ${entry.fileHash}`).update(`active ${entry.active}`).update(`main ${entry.main}`).update(`path ${entry.path}`).update(`url ${entry.url}`);
return hash.digest().toString(16).padStart(8, "0");
}
export {
createFileHash,
createRowHash
};