@tsdoctor/snapshot 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { hashContent } from "./content-hash.js";
2
- import { Store } from "@effected/store";
3
2
  import { Context, Data, Effect, Layer, Option } from "effect";
3
+ import { Store } from "@effected/store";
4
4
 
5
5
  //#region src/SnapshotService.ts
6
6
  /**
package/content-hash.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import { createHash } from "node:crypto";
2
+ import { JsoncFingerprint } from "@effected/jsonc";
3
+ import { Result } from "effect";
2
4
 
3
5
  //#region src/content-hash.ts
4
6
  /**
@@ -154,8 +156,9 @@ function hashFrontmatter(frontmatter) {
154
156
  if (TIMESTAMP_KEYS.has(key)) continue;
155
157
  filtered[key] = stripTimestamps(frontmatter[key]);
156
158
  }
157
- const json = JSON.stringify(filtered);
158
- return createHash("sha256").update(json).digest("hex");
159
+ const canonical = JsoncFingerprint.canonicalizeResult(filtered);
160
+ if (Result.isFailure(canonical)) throw new Error(`Frontmatter cannot be canonicalized for hashing: ${canonical.failure.message}`);
161
+ return createHash("sha256").update(canonical.success).digest("hex");
159
162
  }
160
163
 
161
164
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsdoctor/snapshot",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "private": false,
5
5
  "description": "Incremental-build snapshot tracking for static documentation pipelines: a schema-versioned SQLite store of per-file content hashes and timestamps, built on @effected/store, plus the pure SHA-256 content-hashing helpers that feed it.",
6
6
  "keywords": [
@@ -37,7 +37,8 @@
37
37
  "./package.json": "./package.json"
38
38
  },
39
39
  "peerDependencies": {
40
- "@effected/store": "^0.5.0",
40
+ "@effected/jsonc": "^0.8.0",
41
+ "@effected/store": "^0.6.0",
41
42
  "effect": "4.0.0-rc.109"
42
43
  },
43
44
  "engines": {