Skip to content

Bring verified local inline JSON updates to main - #19

Merged
edilec merged 8 commits into
mainfrom
publication/verified-local-2026-09-26
Sep 27, 2026
Merged

edilec merged 8 commits into
mainfrom
publication/verified-local-2026-09-26

Conversation

@KRISHNAMMurarka

Copy link
Copy Markdown
Owner

This replays eight locally verified commits after the existing public main history. Their file trees, messages, author identities, and original dates are preserved. The final tree matches the verified local checkout, and the offline check passed. This uses the required pull-request path; no public history is force-rewritten.

JSON cannot represent undefined, functions or symbols, and JSON.stringify
treats all three identically: omitted from an object, null in an array. That
conflates a representable absence with an unsupported type, and it drops nested
data silently, so embedded page data can be missing fields the author expected.

- Top-level failures now name the category rather than sharing one message.
  A function replacer keeps the generic message, because the original value no
  longer explains the result.
- Add the optional onUnsupported option. 'omit' is the default and preserves
  current behaviour exactly; 'throw' reports the value and its path
  (user.email, items[2].name) instead of dropping it.
- Values are inspected after toJSON and after a function replacer, so a value
  that becomes unrepresentable is reported too.
- onUnsupported: 'throw' rejects an array replacer, which omits properties by
  design and would give the combination a confusing meaning.

The serializer API and all existing behaviour are unchanged.
Existing tests round-trip through JSON.parse, which never exercises the reason
this package escapes < in the first place. Add a fixture that implements the
HTML raw-text end-tag rule -- </script followed by whitespace, / or > -- and
reads the value back out of a rendered page.

Covers nested Unicode (combining marks, astral planes, RTL scripts, U+2028 and
U+2029) and confirms a hostile payload cannot terminate its containing script
element or disturb the markup after it.

The fixture is a test helper implementing one spec rule, not a general HTML
parser, and is not shipped in the package.
Add a supported-values table and an onUnsupported section covering the silent
data loss that the default behaviour inherits from JSON.stringify, and record
the changes in the changelog.
@edilec
edilec merged commit c5812dc into main Sep 27, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants