Back to Explore

kaelzhang/node-comment-json

GitHub
1 watchersOpen source

Last release:

comment-json is a JavaScript utility for parsing and stringifying JSON that contains comments, while preserving those comments when you save the updated data. It keeps comments even in many “comment everywhere” positions, and its usage matches the built-in JSON object (parse and stringify).

Project status

  • Actively maintained: The repository shows recent activity, with the last upstream push on 2026-04-12, which is about 4 months before today (2026-08-12).
  • Update cadence: Multiple updates occurred in early 2026 (v4.6.1 on 2026-03-02, v4.6.2 on 2026-03-03, then v5.0.0 on 2026-04-12), suggesting an active development period rather than a long freeze.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • 5.0.0

    v5.0.0 changes blank-line handling to be an explicit part of the comment token model, rather than being inferred from token `loc` and prior line-break history. It adds `parse(..., { no_comments, no_blank_lines })` and a new `removeBlankLines()` utility, and updates TypeScript types to reflect the new token union.

    BreakingFeatures
  • 4.6.2

    Release 4.6.2 has no published release notes content (none provided by the publisher). The code changes are primarily internal refactors around type-checking, plus removal of the core-util-is dependency.

  • 4.6.1

    Release 4.6.1 was published on 2026-03-02, but no release notes or change descriptions were provided by the publisher. As a result, there is no documented information here about new features, bug fixes, breaking changes, or dependency updates.

  • 4.5.0

    Release 4.5.0 introduces two new public APIs, moveComments and removeComments, to relocate or delete stored comment metadata. The release notes also mention TypeScript definition improvements and a README update. Code changes include additional type-level modeling of comment prefixes and internal changes to how comment symbol prefixes are categorized and processed.

    Features
  • 4.4.1

    comment-json 4.4.1 primarily adds TC39 proposal-json-parse-with-source behavior to the reviver, enabling parsing of BigInt values via `context.source`. In the actual code, there are additional parsing, error, stringify, and TypeScript typing changes that are not covered in the release notes.

    Features
  • 4.2.2

    Release 4.2.2 is marketed as a minor update focused on TypeScript definition improvements for comment symbol properties. The actual diff shows a broader overhaul of the exported TypeScript typings (replacing many any types with structured unions/classes and changing several function types), plus some runtime behavior changes in comment handling for CommentArray.

    BreakingFeatures
  • 4.1.0

    Release 4.1.0 primarily introduces comment-preserving sorting for CommentArray via CommentArray::sort, and includes a patch labeled as fixing issue #27. The release notes are otherwise very minimal. The code diff, however, shows additional behavioral changes around comment copying and assignment of non-property comments.

    BreakingFeatures
  • 4.0.0

    comment-json 4.0.0 is a major release that changes how comment metadata is represented using Symbol properties, and it makes those Symbol properties non-enumerable so normal Object keys are unaffected. It also changes the placement/meaning of “after” comment symbols, including the removal of the previous after-comma and after (no-prop) forms in favor of after:<prop>. While most of the upgrade guidance focuses on symbol enumerability and using assign instead of object spreading, the code changes also include several parsing and stringifying behavior updates.

    BreakingFeatures
  • 3.0.0

    comment-json 3.0.0 introduces a new comment token type to correctly associate inline comments that appear after a comma. The release notes focus on the behavior change from using the old token placement to the new Symbol key format after-comma:${prop}.

    BreakingFeatures
  • 2.2.0

    Release 2.2.0 adds parsing support for trailing commas in JSON-like input, for both objects and arrays. The accompanying code changes also show some internal parser-state cleanup, plus unrelated test additions for stringify behavior coverage.

    Features
  • 2.1.0

    Release 2.1.0 introduces CommentArray, an Array subclass intended to preserve and move comment tokens when array elements are modified. The documented change focuses on comment handling during array mutations, but the code also adds additional public API surface and changes what types parse() returns for JSON arrays.

    Features
  • 2.0.9

    Release 2.0.9 adds support for JSON comments in all locations and fixes handling of comments inside arrays. It also introduces a breaking change for 1.x users: the return structure of parse() changes because comments are now stored using JavaScript Symbols to avoid key conflicts with normal JSON properties.

    BreakingFeatures