@@ -62,7 +62,7 @@ development, and have guaranteed support for fragments.
6262## Install
6363
6464This package is [ ESM only] [ esm ] .
65- In Node.js (version 14.14+ and 16.0 +), install with [ npm] [ ] :
65+ In Node.js (version 16 +), install with [ npm] [ ] :
6666
6767``` sh
6868npm install hast-util-to-jsx-runtime
@@ -85,10 +85,10 @@ In browsers with [`esm.sh`][esmsh]:
8585## Use
8686
8787``` js
88- import {Fragment , jsx , jsxs } from ' react/jsx-runtime'
89- import {renderToStaticMarkup } from ' react-dom/server'
9088import {h } from ' hastscript'
9189import {toJsxRuntime } from ' hast-util-to-jsx-runtime'
90+ import {Fragment , jsx , jsxs } from ' react/jsx-runtime'
91+ import {renderToStaticMarkup } from ' react-dom/server'
9292
9393const tree = h (' h1' , ' Hello, world!' )
9494
@@ -185,10 +185,10 @@ Configuration (TypeScript type).
185185 — static JSX
186186* ` jsxDEV ` ([ ` JsxDev ` ] [ api-jsx-dev ] , required in development)
187187 — development JSX
188- * ` development ` (` boolean ` , default: ` false ` )
189- — whether to use ` jsxDEV ` when on or ` jsx ` and ` jsxs ` when off
190188* ` components ` ([ ` Partial<Components> ` ] [ api-components ] , optional)
191189 — components to use
190+ * ` development ` (` boolean ` , default: ` false ` )
191+ — whether to use ` jsxDEV ` when on or ` jsx ` and ` jsxs ` when off
192192* ` elementAttributeNameCase `
193193 ([ ` ElementAttributeNameCase ` ] [ api-element-attribute-name-case ] ,
194194 default: ` 'react' ` )
@@ -232,10 +232,10 @@ type Components = {
232232type ExtraProps = {node? : Element | undefined }
233233
234234type Component <ComponentProps > =
235- // Function component:
236- | ((props : ComponentProps ) => JSX .Element | string | null | undefined )
237235 // Class component:
238236 | (new (props : ComponentProps ) => JSX .ElementClass )
237+ // Function component:
238+ | ((props : ComponentProps ) => JSX .Element | string | null | undefined )
239239` ` `
240240
241241### ` ElementAttributeNameCase `
@@ -248,7 +248,7 @@ React casing is for example `className`, `strokeLinecap`, `xmlLang`.
248248###### Type
249249
250250` ` ` ts
251- type ElementAttributeNameCase = ' react ' | ' html '
251+ type ElementAttributeNameCase = ' html ' | ' react '
252252` ` `
253253
254254### ` Fragment `
@@ -313,12 +313,12 @@ import type {Element} from 'hast'
313313
314314type Props = {
315315 [prop : string ]:
316- | Element // For `node`.
317316 | Array <JSX .Element | string | null | undefined > // For `children`.
318317 | Record <string , string > // For `style`.
319- | string
320- | number
318+ | Element // For `node`.
321319 | boolean
320+ | number
321+ | string
322322 | undefined
323323 children: Array <JSX .Element | string | null | undefined > | undefined
324324 node? : Element | undefined
@@ -331,12 +331,12 @@ Info about source (TypeScript type).
331331
332332###### Fields
333333
334+ * ` columnNumber ` ( ` number ` or ` undefined ` )
335+ — column where thing starts (0-indexed)
334336* ` fileName ` ( ` string ` or ` undefined ` )
335337 — name of source file
336338* ` lineNumber ` ( ` number ` or ` undefined ` )
337339 — line where thing starts (1-indexed)
338- * ` columnNumber ` ( ` number ` or ` undefined ` )
339- — column where thing starts (0-indexed)
340340
341341### ` Space `
342342
@@ -364,7 +364,7 @@ DOM casing is for example `backgroundColor` and `WebkitLineClamp`.
364364###### Type
365365
366366` ` ` ts
367- type StylePropertyNameCase = ' dom ' | ' css '
367+ type StylePropertyNameCase = ' css ' | ' dom '
368368` ` `
369369
370370## Examples
@@ -376,10 +376,10 @@ type StylePropertyNameCase = 'dom' | 'css'
376376In Node.js, do:
377377
378378` ` ` js
379- import {Fragment , jsx , jsxs } from ' preact/jsx-runtime'
380- import {render } from ' preact-render-to-string'
381379import {h } from ' hastscript'
382380import {toJsxRuntime } from ' hast-util-to-jsx-runtime'
381+ import {Fragment , jsx , jsxs } from ' preact/jsx-runtime'
382+ import {render } from ' preact-render-to-string'
383383
384384const result = render (
385385 toJsxRuntime (h (' h1' , ' hi!' ), {
@@ -402,10 +402,10 @@ Yields:
402402In a browser, do:
403403
404404``` js
405- import {Fragment , jsx , jsxs } from ' https://esm.sh/preact@10/jsx-runtime'
406- import {render } from ' https://esm.sh/preact@10'
407405import {h } from ' https://esm.sh/hastscript@7'
408406import {toJsxRuntime } from ' https://esm.sh/hast-util-to-jsx-runtime@1'
407+ import {Fragment , jsx , jsxs } from ' https://esm.sh/preact@10/jsx-runtime'
408+ import {render } from ' https://esm.sh/preact@10'
409409
410410render (
411411 toJsxRuntime (h (' h1' , ' hi!' ), {
@@ -425,10 +425,10 @@ render(
425425In Node.js, do:
426426
427427``` js
428- import {Fragment , jsx , jsxs } from ' vue/jsx-runtime' // Available since `vue@^3.3.0-alpha.6`.
429428import serverRenderer from ' @vue/server-renderer'
430429import {h } from ' hastscript'
431430import {toJsxRuntime } from ' hast-util-to-jsx-runtime'
431+ import {Fragment , jsx , jsxs } from ' vue/jsx-runtime' // Available since `vue@^3.3.0-alpha.6`.
432432
433433console .log (
434434 await serverRenderer .renderToString (
@@ -451,10 +451,10 @@ Yields:
451451In a browser, do:
452452
453453``` js
454- import {createApp } from ' https://esm.sh/vue@3'
455- import {Fragment , jsx , jsxs } from ' https://esm.sh/vue-jsx-runtime@0.1/jsx-runtime'
456454import {h } from ' https://esm.sh/hastscript@7'
457455import {toJsxRuntime } from ' https://esm.sh/hast-util-to-jsx-runtime@1'
456+ import {createApp } from ' https://esm.sh/vue@3'
457+ import {Fragment , jsx , jsxs } from ' https://esm.sh/vue-jsx-runtime@0.1/jsx-runtime'
458458
459459createApp (Component).mount (' #root' )
460460
@@ -476,9 +476,9 @@ function Component() {
476476In Node.js, do:
477477
478478``` js
479- import {Fragment , jsx , jsxs } from ' solid-jsx/jsx-runtime'
480479import {h } from ' hastscript'
481480import {toJsxRuntime } from ' hast-util-to-jsx-runtime'
481+ import {Fragment , jsx , jsxs } from ' solid-jsx/jsx-runtime'
482482
483483console .log (
484484 toJsxRuntime (h (' h1' , ' hi!' ), {
@@ -500,10 +500,10 @@ Yields:
500500In a browser, do:
501501
502502``` js
503- import {Fragment , jsx , jsxs } from ' https://esm.sh/solid-js@1/h/jsx-runtime'
504- import {render } from ' https://esm.sh/solid-js@1/web'
505503import {h } from ' https://esm.sh/hastscript@7'
506504import {toJsxRuntime } from ' https://esm.sh/hast-util-to-jsx-runtime@1'
505+ import {Fragment , jsx , jsxs } from ' https://esm.sh/solid-js@1/h/jsx-runtime'
506+ import {render } from ' https://esm.sh/solid-js@1/web'
507507
508508render (Component, document .getElementById (' root' ))
509509
@@ -549,12 +549,17 @@ followed by browsers such as Chrome, Firefox, and Safari.
549549## Types
550550
551551This package is fully typed with [ TypeScript] [ ] .
552- It exports the additional types [ ` Components ` ] [ api-components ] ,
552+ It exports the additional types
553+ [ ` Components ` ] [ api-components ] ,
553554[ ` ElementAttributeNameCase ` ] [ api-element-attribute-name-case ] ,
554- [ ` Fragment ` ] [ api-fragment ] , [ ` Jsx ` ] [ api-jsx ] , [ ` JsxDev ` ] [ api-jsx-dev ] ,
555- [ ` Options ` ] [ api-options ] , [ ` Props ` ] [ api-props ] , [ ` Source ` ] [ api-source ] ,
556- [ ` Space ` ] [ api-Space ] ,
557- and [ ` StylePropertyNameCase ` ] [ api-style-property-name-case ] .
555+ [ ` Fragment ` ] [ api-fragment ] ,
556+ [ ` Jsx ` ] [ api-jsx ] ,
557+ [ ` JsxDev ` ] [ api-jsx-dev ] ,
558+ [ ` Options ` ] [ api-options ] ,
559+ [ ` Props ` ] [ api-props ] ,
560+ [ ` Source ` ] [ api-source ] ,
561+ [ ` Space ` ] [ api-Space ] , and
562+ [ ` StylePropertyNameCase ` ] [ api-style-property-name-case ] .
558563
559564The function ` toJsxRuntime ` returns a ` JSX.Element ` , which means that the JSX
560565namespace has to by typed.
@@ -563,10 +568,13 @@ Typically this is done by installing your frameworks types (e.g.,
563568
564569## Compatibility
565570
566- Projects maintained by the unified collective are compatible with all maintained
571+ Projects maintained by the unified collective are compatible with maintained
567572versions of Node.js.
568- As of now, that is Node.js 14.14+ and 16.0+.
569- Our projects sometimes work with older versions, but this is not guaranteed.
573+
574+ When we cut a new major release, we drop support for unmaintained versions of
575+ Node.
576+ This means we try to keep the current release line,
577+ ` hast-util-to-jsx-runtime@^1 ` , compatible with Node.js 12.
570578
571579## Security
572580
@@ -610,9 +618,9 @@ abide by its terms.
610618
611619[ downloads ] : https://www.npmjs.com/package/hast-util-to-jsx-runtime
612620
613- [ size-badge ] : https://img.shields.io/bundlephobia/minzip/ hast-util-to-jsx-runtime.svg
621+ [ size-badge ] : https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q= hast-util-to-jsx-runtime
614622
615- [ size ] : https://bundlephobia .com/result?p =hast-util-to-jsx-runtime
623+ [ size ] : https://bundlejs .com/?q =hast-util-to-jsx-runtime
616624
617625[ sponsors-badge ] : https://opencollective.com/unified/sponsors/badge.svg
618626
0 commit comments