Skip to content

v2.1.0

Latest

Choose a tag to compare

@github-actions github-actions released this 17 Nov 23:47
· 3 commits to main since this release
Immutable release. Only release title and notes can be modified.

Hey y'all!

json-as 2.1.0 is here! This release brings access-based lazy parsing, faster generated serializers, cleaner editor completions, and fixes across parser analysis, source bindings, and output ownership.

Breaking changes

  • Lazy now means access specialization. @json and @json({ lazy }) decode the fields the program needs and scan past fields proven unused. Full reads and uncertain uses keep eager behavior, without deferred getters or typed-field source ranges.
  • Removed JSON.Lazy<T>, instance-field @lazy / @eager, and the "auto", "all", "none", and "strategic" class modes. Use plain field types and { lazy } or { nolazy } instead. AssemblyScript's built-in module/static @lazy is unchanged.
  • JSON_LAZY=false replaces the old access-specialization and strategic-laziness flags. Whole-object serialization retains every field it emits and writes current values; typed fields no longer forward saved source slices. Dynamic JSON.Value, JSON.Obj, JSON.Arr, and JSON.Raw keep their existing source-backed behavior.

See the 2.1 upgrade guide for migration details.

What’s new

  • Added compile-time field selection at eligible visible parse sites, with conservative eager handling for escaped objects, side effects, uncertain bindings, and analysis limits. (#252)
  • Added @json({ nolazy }) and @json({ lazy: false }) as eager controls for a class and its descendants, including benchmark models.
  • Hid internal runtime helpers from JSON. editor completions while preserving calls from generated AssemblyScript code, including optimized builds. The public entry points remain JSON.parse, JSON.stringify, and JSON.validate.

Performance

  • Improved numeric-row batching, integer formatting, string reservations, literal stores, Unicode scanning, and SIMD escape handling. Generated writers retain bounds, owning output, callback, and GC safeguards.
  • Moved more decisions into the transform, including verified float-array metadata and generated serializer proofs. Unknown or redirected runtime bindings retain conservative paths.
  • Updated the benchmark charts. Classic deserialization now compares JavaScript, NAIVE, SWAR, SIMD, and simdjson owning structs. The published captures retain their original source and hardware metadata; retired deferred-field results are identified separately.

Fixes

  • Fixed access tracking through conditional assignments, loops, globals, helper defaults, argument evaluation, rest parameters, templates, void, and hoisted bindings.
  • Preserved resolved type identity for generic targets and scalar aliases, including strict validation when an unread field has an incompatible JSON value.
  • Bounded control-flow paths and helper expansion so difficult analysis falls back to eager parsing instead of consuming excessive compilation resources.
  • Preserved application bindings and allocation hooks in generated writers, and retained snapshot Map iteration when callbacks can mutate the collection.
  • Refreshed reviewed runtime fingerprints after formatting-only changes. CI now checks them before the transform suites, and packed-consumer failures report null diagnostics without masking the original error.
  • Restored explicit compiler-warning exceptions instead of suppressing every warning with an empty list. AS201 remains enabled, with native, WASI, and test-build regression coverage.

Testing

  • The release workflow gates this GitHub release on all eight hosted test shards, including transform regressions, slow/fast parsing, strict parsing, npm/pnpm packed consumers, and package-content checks.
  • Local validation includes the three-backend runtime suite, optimized lazy/API and helper-reachability checks, source/AST guards, and installed consumers across compiler runtimes.
  • Lint and license-header checks remain enabled.

As always, try it, break it, and tell us what feels rough!

Join the AssemblyScript Discord or open an issue with feedback. I'd love to hear how 2.1 works for you 😄

Full Changelog: v2.0.0...v2.1.0