@saykit/format-json 0.7.0 → 0.9.0

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,12 +1,5 @@
1
1
  import { generateHash } from "@saykit/config/features/messages";
2
2
  //#region src/formatter.ts
3
- /**
4
- * Derive a catalogue key the same way the runtime and the rest of SayKit do:
5
- * an explicit id when present, otherwise a stable hash of the message and its
6
- * context. Keying by the raw message text instead would not match the hashed
7
- * key the runtime looks up, and would collide for same-text/different-context
8
- * messages.
9
- */
10
3
  function messageKey(message) {
11
4
  return message.id ?? generateHash(message.message, message.context);
12
5
  }
@@ -15,7 +8,6 @@ const REFERENCES_FIELD = "x-saykit-references";
15
8
  function isRecord(value) {
16
9
  return typeof value === "object" && value !== null && !Array.isArray(value);
17
10
  }
18
- /** Build the metadata attributes shared by the ARB and WebExtension layouts. */
19
11
  function toAttributes(message, options) {
20
12
  const attributes = {};
21
13
  if (message.comments.length) attributes.description = message.comments.join("\n");
@@ -28,7 +20,6 @@ function toAttributes(message, options) {
28
20
  }
29
21
  return attributes;
30
22
  }
31
- /** Reconstruct a {@link Message} from a key, its value, and optional metadata. */
32
23
  function toMessage(key, value, attributes) {
33
24
  const description = attributes && typeof attributes.description === "string" ? attributes.description : "";
34
25
  const context = attributes && typeof attributes[CONTEXT_FIELD] === "string" ? attributes[CONTEXT_FIELD] : void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saykit/format-json",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "JSON file formatter for saykit",
5
5
  "keywords": [
6
6
  "formatter",
@@ -34,7 +34,7 @@
34
34
  "provenance": true
35
35
  },
36
36
  "devDependencies": {
37
- "@saykit/config": "^0.7.0"
37
+ "@saykit/config": "^0.9.0"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@saykit/config": "*"