@glyphjs/ir
v0.6.0
Published
IR utilities: validation, diffing, patching, migration
Maintainers
Readme
@glyphjs/ir
IR (Intermediate Representation) utilities for Glyph JS: validation, diffing, patching, and migration.
Install
pnpm add @glyphjs/irUsage
import { validateIR, diffIR, applyPatch, createEmptyIR } from '@glyphjs/ir';
// Create a blank document
const doc = createEmptyIR();
// Validate an IR document
const diagnostics = validateIR(doc);
// Diff two IR documents
const patch = diffIR(oldDoc, newDoc);
// Apply a patch
const updated = applyPatch(oldDoc, patch);API
validateIR(ir)-- validate an IR document and return diagnosticsdiffIR(a, b)-- compute a patch that transformsaintobapplyPatch(ir, patch)-- apply a patch to an IR documentcomposePatch(a, b)-- compose two patches into oneregisterMigration(migration)/migrateIR(ir)-- version migration supportgenerateBlockId()/generateDocumentId()-- deterministic ID generationcreateEmptyIR()-- factory for a blank IR document
Docs
https://github.com/VledicFranco/glyphjs
