Skip to content

Releases: davesnx/html_of_jsx

0.1.0

Choose a tag to compare

@davesnx davesnx released this 05 Aug 11:46

CHANGES:

  • [BREAKING] Component invocations now group multiple children with JSX.list, so components receive JSX.element for both single and multiple children. JSX.fragment now accepts JSX.element to follow the same convention. (@davesnx)
  • [BREAKING] Renamed JSX.stringf -> JSX.format (@davesnx)
  • Massive PPX compile-time improvement: the HTML attribute database is now built once instead of being reconstructed on every attribute lookup (6-8x faster on attribute-heavy files) (@davesnx)
  • Fix escaping of constant JSX.string children inside fragments: <> {JSX.string("<script>")} </> was inlined without HTML-encoding (@davesnx)
  • [BREAKING] Fix ill-typed generated code for optional booleanish attributes (e.g. ?spellcheck) when the static optimization is disabled (@davesnx)
  • Fragments now use the same optimized buffer codegen as elements: constant children collapse at compile time and dynamic children are spliced into a single buffer instead of allocating a JSX.list (@davesnx)
  • JSX.render_streaming now streams for real: chunks are emitted incrementally every ?chunk_size bytes (default 4096) instead of buffering the whole document (@davesnx)
  • JSX.escape copies runs of clean characters in bulk instead of char-by-char after the first escape; JSX.render returns clean strings and int/float elements without buffer copies (@davesnx)
  • The unoptimized attribute path (-disable-static-opt or fallback) no longer allocates Some/filter_map wrappers when no optional attribute is present (@davesnx)
  • Benchmarks: scenarios now construct elements inside the timed function (several scenarios previously measured rendering of a prebuilt static string, i.e. a no-op); added a large-mixed compile-time fixture that guards against PPX attribute-lookup regressions (@davesnx)
  • Add zero-copy fast path in JSX.render: Unsafe/Null/String elements skip the intermediate buffer entirely, making rendering of fully optimized trees free (@davesnx)
  • PPX buffer splicing: nested JSX elements now write directly into the parent's buffer instead of materializing an intermediate buffer and string per element, cutting render time up to ~50% and allocations up to ~60% on dynamic pages (@davesnx)

0.0.9

Choose a tag to compare

@davesnx davesnx released this 14 Apr 08:50

CHANGES:

  • Fix data-attributes being rendered as data_-attributes (@davesnx)
  • Add JSX.pp for pretty-printing HTML with indentation, powered by pretty_expressive (@davesnx)
  • Add JSX.stringf for escaped Printf-style text formatting and teach the PPX to optimize literal-only stringf calls at compile time (@davesnx)
  • Improve runtime render speed in JSX.write by replacing iterator-heavy paths with direct recursion and indexed array traversal (@davesnx)
  • Reduce default render buffer sizes (1024 -> 256) and improve PPX-generated buffer capacity estimation for dynamic/optional attribute code paths (@davesnx)
  • Add a compile-time fast path for static HTML escaping in ppx/static_analysis.ml to avoid buffer work when no escaping is required (@davesnx)
  • Extend static optimization coverage for dynamic attributes: elements with dynamic attrs and dynamic string/mixed children now generate buffer-based optimized code instead of falling back to JSX.node (@davesnx)

0.0.8

Choose a tag to compare

@davesnx davesnx released this 24 Feb 00:37

CHANGES

  • Remove temporal string on each JSX.escape, and make escape faster (#9c64ba4)
  • Skip escape for Int/Float attribute values (#8e8cf26)
  • Adds JSX.array (#3154012)
  • Add Polyvariant attribute type for type-safe enumerated HTML attributes (e.g. target, loading, dir, role, ARIA attributes, SVG attributes)
  • Add polyvariant validation test suite (keyword escaping, identifier validity, consistency checks)

Before (any string accepted, typos slip through silently):

<a href="/" target="blanked" />
<img src="cat.png" loading="lzy" />

After (only valid values compile):

<a href="/" target=`_blank />
<img src="cat.png" loading=`lazy_ />
<a href="/" target=`_bogus />  (* compile error! *)
Error: This expression has type [> `_bogus ]
       but an expression was expected of type
         [ `_blank | `_parent | `_self | `_top ]
       The second variant type does not allow tag(s) `_bogus
  • Create html_of_jsx.htmx library with script and extension support
<head>
  <Htmx version="2.0.4" />
  <Htmx.Extensions.SSE version="2.2.2" />
  <Htmx.Extensions.WS version="2.2.0" />
</head>

0.0.7

Choose a tag to compare

@davesnx davesnx released this 08 Dec 08:40
ac435d2

CHANGES:

  • Static HTML optimization: elements with static content are now pre-rendered at compile time for ~10x faster rendering (@davesnx)
  • Add -disable-static-opt flag to disable static HTML optimization (use JSX.node for all elements) (@davesnx)
  • [BREAKING] Remove JSX.Debug module (the opaque JSX.element type is no longer inspectable) (@davesnx)

0.0.6

Choose a tag to compare

@davesnx davesnx released this 14 Oct 23:31
0d29b55

CHANGES:

0.0.5

Choose a tag to compare

@davesnx davesnx released this 04 Aug 19:07
f755078

0.0.4

Choose a tag to compare

@davesnx davesnx released this 26 Jun 10:28
b6c86c9
  • [BREAKING] Handle HTML encoding for ' (@davesnx)
  • Handle HTML encoding for " (from &#34; to &quot;) (@davesnx)
  • Improved performance of JSX.render (@davesnx)
  • [BREAKING] Remove Fragment in favor of JSX.list (@davesnx)
  • Remove unused Component (unit -> element) since it isn't needed (@davesnx)
  • [BREAKING] Change attributes representation (@andreypopp)
  • [BREAKING] Remove melange dependency (@andreypopp)
  • [BREAKING] Lower the OCaml bound to 4.14 (@davesnx)
  • Make lib wrapped (@andreypopp)

0.0.3

Choose a tag to compare

@davesnx davesnx released this 07 Jun 10:03
773029d
  • [BREAKING] Html_of_jsx.render lives under JSX.render (removing the Html_of_jsx module entirely)
  • [BREAKING] Module Jsx is turned into JSX
  • [BREAKING] dune's library is now html_of_jsx instead of (html_of_jsx.lib)
  • [BREAKING] JSX.element is opaque (can't see the type from outside), but we have a JSX.Debug module to inspect and re-construct JSX.element (cc @leostera)
  • Improved performance of JSX.render

0.0.2

Choose a tag to compare

@davesnx davesnx released this 26 Apr 16:03
01b3eab
  • Add Jsx.unsafe to allow unsafe HTML as children
  • Fix HTML attributes formatting (charset, autocomplete, tabindex, inputmode, etc...)
  • Enable HTMX attributes via html_of_jsx.ppx -htmx

0.0.1

Choose a tag to compare

@davesnx davesnx released this 10 Feb 15:57
f0556ed
  • First working version of the ppx and library
  • Supports most of features from JSX (uppercase components, fragments, optional attributes, punning)
  • but with a few improvements (lowercase components, no need to add annotations)
  • No React idioms (no className, no htmlFor, no onChange, etc...)
  • Type-safe, validates attributes and their types (it can be better thought)
  • Minimal
    • Html_of_jsx.render to render an element to HTML
    • Jsx.* to construct DOM Elements and DOM nodes (Jsx.text, Jsx.int, Jsx.null, Jsx.list)
  • Works with Reason and mlx
  • Supports some htmx under the ppx (html_of_jsx.ppx -htmx)