npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kyneta/compiler

v1.8.0

Published

Incremental view maintenance compiler for structured deltas

Readme

@kyneta/compiler

Target-agnostic incremental view maintenance compiler for structured deltas. Takes TypeScript source with builder patterns over Changefeed-emitting state and produces a classified IR annotated with incremental strategies.

The compiler never references DOM, HTML, or any rendering vocabulary — rendering targets consume the IR and produce target-specific output.

Used primarily by @kyneta/cast web framework to build SSR and live DOM sync with automatic reactive dependency awareness.

Install

npm install @kyneta/compiler

Overview

The compiler is a functor from TypeScript ASTs to annotated IR. Rendering targets are natural transformations from that IR to target-specific effects.

TypeScript source → parse → analyze (AST → IR) → Annotated IR → rendering target
  1. Parse — Find builder calls in TypeScript source via regex pre-scan + ts-morph
  2. Analyze — Transform AST into IR nodes with binding-time classification, delta kinds, and dependency extraction
  3. Consume — Walk the IR or extract templates for code generation

Exports

. (core)

The main export provides the full analysis pipeline and IR types:

  • analyzeSourceFile / analyzeBuilder — AST → IR analysis
  • parseSource / findBuilderCalls — Source parsing and builder detection
  • IR types — BuilderNode, ElementNode, ContentNode, ConditionalNode, LoopNode, StatementNode, BindingNode, LabeledBlockNode
  • ExpressionIR — Structured expression trees with auto-read insertion, binding expansion, and dependency derivation as structural folds
  • buildExpressionIR — Single-pass AST → ExpressionIR tree builder
  • walkIR / extractTemplate — Generator-based IR walker and template extraction with walk planning
  • classifyDependencies — Dependency classification into "item", "external", or "structural"
  • detectFilterPattern — Six-criteria filter pattern recognition for list optimizations
  • Reactive detection — isChangefeedType, getDeltaKind, resolveReactiveImports

./transforms

Optional IR→IR pipeline transforms for rendering targets:

  • dissolveConditionals(builder) — Replaces structurally-identical conditional branches with merged children containing ternary expressions. Eliminates conditional regions when branches differ only in values.
  • filterTargetBlocks(builder, target) — Resolves client: / server: labeled blocks by stripping or unwrapping them based on the rendering target.

Key Concepts

Binding-Time Analysis

The compiler classifies every value by when it becomes known:

| Binding Time | When Known | Example | |---|---|---| | literal | Compile time | "Hello", 42 | | render | Render time | props.name, someVar | | reactive | Runtime (varies) | doc.count, recipe.name |

Delta Kind

For reactive dependencies, the compiler tracks the kind of structured change the source provides — replace, text, sequence, map, tree, or increment. This is orthogonal to binding time: all reactive values change at runtime, but they differ in how much structural information accompanies the notification.

ExpressionIR

Expressions are represented as typed trees (RefReadNode, MethodCallNode, TernaryNode, etc.) rather than strings. This enables:

  • Auto-read insertion — recipe.name.toLowerCase() becomes recipe.name().toLowerCase() via RefReadNode
  • Binding expansion — Variable bindings carry their full expression tree for inline re-evaluation
  • Dependency extraction — A fold over the tree, not string parsing

Bare-Ref Developer Experience

Developers write natural TypeScript — recipe.name.toLowerCase() — and the compiler detects that recipe.name is a Changefeed, inserts the read boundary, and classifies dependencies. No special syntax required.

Cross-Package Position

@kyneta/schema       →  CHANGEFEED protocol, delta types
    ↓
@kyneta/compiler     →  AST → IR analysis, IR transforms
    ↓
@kyneta/cast         →  IR → DOM/HTML codegen, runtime, build plugins

The compiler depends on @kyneta/schema for the CHANGEFEED symbol and change types used in reactive detection, and on ts-morph for TypeScript AST analysis.

Peer Dependencies

| Package | Version | |---------|---------| | @kyneta/schema | >=0.0.1 |

License

MIT