genro-builders-js
Build typed Source trees from JSON grammars and render static HTML, SVG or XML. The generic renderer also supports dialect-defined object output. This package has no DOM, browser subscriptions, server or database dependencies.
Version 0.7.0 targets npm and JSR with the Bag 0.11 contract. Python parity is bounded by
documented differences. Recipes are not implemented.
A builder declares the SourceBag class of its Source in static _sourceClass
(Source class).
import { HtmlBuilder } from '@genro/builders';
const page = new HtmlBuilder();
page.data.setItem('price', 1234.5);
const body = page.root.html().body();
body.h1('Hello');
body.div('^price', {format: '#,##0.00', locale: 'it-IT', mask: '€ %s'});
const html = page.render();
Install and verify
The same package is published on two registries:
- npm:
npm install @genrojs/builders, then import from@genrojs/builders; - JSR:
npx jsr add @genro/builders(orbunx jsr add), then import from@genro/builders.
From a local checkout, run npm install --no-package-lock and npm test.
Node.js 22 or later and Bun are the supported server runtimes. First-party
npm dependencies use verified minimum versions without upper bounds. JSR imports
use verified caret ranges as an owner-approved JSR-only exception: publication
rejects both >= and wildcard constraints. Setup and CI
resolve current releases without a lockfile; use npm update --no-package-lock
to refresh an existing installation. Bag 0.11.0 provides recursive population and
the current Python/JavaScript TYTX format. Consumers must resolve one shared Bag
class and TYTX registry; an older nested Bag copy cannot share the same suffix.
The source imports Bag and TYTX as @genrojs/bag and @genrojs/tytx, the npm
names; jsr.json maps them to jsr:@genro/bag and jsr:@genro/tytx. Each
registry's package therefore depends on one Bag class and one TYTX registry
instance from the same registry.
Deno publication keeps a 24-hour cooldown for external dependencies and exempts
jsr:@genro/* and npm:@genrojs/* to permit verified sequential releases.
Documentation
- Partial collection composition
- Authoring, grammar and API
- Rendering and presentation
- Repository map and development
- Python differences and open points
- 0.1.2 review record
Build the Sphinx manual locally:
python -m pip install -r docs/requirements.txt
python -m sphinx -W --keep-going -n -b html docs build/docs
The manual uses the classic Read the Docs theme. No hosting is configured or implied. See CHANGELOG for the local version change.
Copyright 2025–2026 Softwell S.r.l. Apache-2.0; see LICENSE and NOTICE.
Explicit pointer suffixes and raw HTML
Attributes use explicit ^path:{}px templates or ^path:=!{} expressions.
Ordinary ${name} text remains literal and consumes no helper attributes.
Static expressions return null; a consuming runtime supplies its compiler hook.
Node values never interpolate template tokens; Data pointers and resolvers still resolve normally. This preserves JavaScript template literals in script content.
For HTML output, a node value ending in ::HTML emits raw markup and drops the
suffix. Ordinary text remains escaped. This marker does not enable templates,
does not sanitize markup and does not change attribute escaping. For example,
<b>${name}</b>::HTML emits <b>${name}</b> literally.