@@ -47,7 +47,7 @@ This is used in [MDX][].
47
47
## Install
48
48
49
49
This package is [ ESM only] [ esm ] .
50
- In Node.js (version 14.14+ and 16.0 +), install with [ npm] [ ] :
50
+ In Node.js (version 16 +), install with [ npm] [ ] :
51
51
52
52
``` sh
53
53
npm install hast-util-to-estree
@@ -95,9 +95,9 @@ Say our module `example.html` contains:
95
95
96
96
``` js
97
97
import fs from ' node:fs/promises'
98
+ import {jsx , toJs } from ' estree-util-to-js'
98
99
import {fromHtml } from ' hast-util-from-html'
99
100
import {toEstree } from ' hast-util-to-estree'
100
- import {jsx , toJs } from ' estree-util-to-js'
101
101
102
102
const hast = fromHtml (await fs .readFile (' example.html' ))
103
103
@@ -285,28 +285,28 @@ Info passed around about the current state (TypeScript type).
285
285
286
286
###### Fields
287
287
288
- * ` schema ` ([ ` Schema ` ][schema])
289
- — current schema
288
+ * ` all ` ( ` (node : HastParent ) => EstreeJsxChild | undefined ` )
289
+ — transform children of a hast parent to estree
290
+ * ` comments ` ( ` Array <EstreeComment >` )
291
+ — list of estree comments
292
+ * ` createJsxAttributeName ` ( ` (name : string ) => EstreeJsxAttributeName ` )
293
+ — create a JSX attribute name
294
+ * ` createJsxElementName ` ( ` (name : string ) => EstreeJsxElementName ` )
295
+ — create a JSX attribute name
290
296
* ` elementAttributeNameCase `
291
297
([ ` ElementAttributeNameCase ` ][api-element-attribute-name-case])
292
298
— casing to use for attribute names
293
- * ` comments ` ( ` Array <EstreeComment >` )
294
- — list of estree comments
295
299
* ` esm ` ( ` Array <EstreeNode >` )
296
300
— list of top-level estree nodes
297
301
* ` handle ` ( ` (node : HastNode ) => EstreeJsxChild | undefined ` )
298
302
— transform a hast node to estree
299
- * ` handle ` ( ` (node : HastParent ) => EstreeJsxChild | undefined ` )
300
- — transform children of a hast parent to estree
301
- * ` patch ` ( ` (from : HastNode , to : EstreeNode ) => undefined ` )
302
- — take positional info from ` from ` (use ` inherit ` if you also want data)
303
303
* ` inherit ` ( ` (from : HastNode , to : EstreeNode ) => undefined ` )
304
304
— take positional info and data from ` from ` (use ` patch ` if you don’t want
305
305
data)
306
- * ` createJsxAttributeName ` ( ` (name : string ) => EstreeJsxAttributeName ` )
307
- — create a JSX attribute name
308
- * ` createJsxElementName ` ( ` ( name : string ) => EstreeJsxElementName ` )
309
- — create a JSX attribute name
306
+ * ` patch ` ( ` (from : HastNode , to : EstreeNode ) => undefined ` )
307
+ — take positional info from ` from ` (use ` inherit ` if you also want data)
308
+ * ` schema ` ([ ` Schema ` ][schema] )
309
+ — current schema
310
310
311
311
### ` StylePropertyNameCase `
312
312
@@ -318,7 +318,7 @@ DOM casing is for example `backgroundColor` and `WebkitLineClamp`.
318
318
###### Type
319
319
320
320
` ` ` ts
321
- type StylePropertyNameCase = ' dom ' | ' css '
321
+ type StylePropertyNameCase = ' css ' | ' dom '
322
322
` ` `
323
323
324
324
## Types
@@ -332,10 +332,13 @@ It exports the additional types
332
332
333
333
## Compatibility
334
334
335
- Projects maintained by the unified collective are compatible with all maintained
335
+ Projects maintained by the unified collective are compatible with maintained
336
336
versions of Node.js.
337
- As of now, that is Node.js 14.14+ and 16.0+.
338
- Our projects sometimes work with older versions, but this is not guaranteed.
337
+
338
+ When we cut a new major release, we drop support for unmaintained versions of
339
+ Node.
340
+ This means we try to keep the current release line, ` hast -util -to -estree @^2 ` ,
341
+ compatible with Node.js 12.
339
342
340
343
## Security
341
344
@@ -344,12 +347,12 @@ It’s not safe.
344
347
345
348
## Related
346
349
350
+ * [ ` estree -util -build -jsx ` ][build-jsx]
351
+ — transform JSX to function calls
347
352
* [ ` hastscript ` ][hastscript]
348
353
— hyperscript compatible interface for creating nodes
349
354
* [ ` hast -util -from -dom ` ](https://github.com/syntax-tree/hast-util-from-dom)
350
355
— transform a DOM tree to hast
351
- * [ ` estree -util -build -jsx ` ][build-jsx]
352
- — transform JSX to function calls
353
356
354
357
## Contribute
355
358
@@ -379,9 +382,9 @@ abide by its terms.
379
382
380
383
[downloads]: https://www.npmjs.com/package/hast-util-to-estree
381
384
382
- [size-badge]: https://img.shields.io/bundlephobia/minzip/ hast-util-to-estree.svg
385
+ [size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q= hast-util-to-estree
383
386
384
- [size]: https://bundlephobia .com/result?p =hast-util-to-estree
387
+ [size]: https://bundlejs .com/?q =hast-util-to-estree
385
388
386
389
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
387
390
0 commit comments