21
21
* [ ` jsx ` ] ( #jsx )
22
22
* [ ` Handler ` ] ( #handler )
23
23
* [ ` Handlers ` ] ( #handlers )
24
+ * [ ` Map ` ] ( #map )
24
25
* [ ` Options ` ] ( #options )
25
26
* [ ` Result ` ] ( #result )
26
27
* [ ` State ` ] ( #state )
@@ -101,7 +102,7 @@ Yields:
101
102
102
103
## API
103
104
104
- This package exports the identifiers [ ` jsx ` ] [ jsx ] and [ ` toJs ` ] [ tojs ] .
105
+ This package exports the identifiers [ ` jsx ` ] [ api- jsx] and [ ` toJs ` ] [ api-to-js ] .
105
106
There is no default export.
106
107
107
108
### ` toJs(tree[, options]) `
@@ -112,16 +113,17 @@ Serialize an estree as JavaScript.
112
113
113
114
* ` tree ` ([ ` Program ` ] [ program ] )
114
115
— estree
115
- * ` options ` ([ ` Options ` ] [ options ] )
116
+ * ` options ` ([ ` Options ` ] [ api- options] )
116
117
— configuration
117
118
118
119
###### Returns
119
120
120
- Result, optionally with source map ([ ` Result ` ] [ result ] ).
121
+ Result, optionally with source map ([ ` Result ` ] [ api- result] ).
121
122
122
123
### ` jsx `
123
124
124
- Map of handlers to handle the nodes of JSX extensions in JavaScript ([ ` Handlers ` ] [ handlers ] ).
125
+ Map of handlers to handle the nodes of JSX extensions in JavaScript
126
+ ([ ` Handlers ` ] [ api-handlers ] ).
125
127
126
128
### ` Handler `
127
129
@@ -133,7 +135,7 @@ Handle a particular node (TypeScript type).
133
135
— ` astring ` generator
134
136
* ` node ` ([ ` Node ` ] [ node ] )
135
137
— node to serialize
136
- * ` state ` ([ ` State ` ] [ state ] )
138
+ * ` state ` ([ ` State ` ] [ api- state] )
137
139
— info passed around
138
140
139
141
###### Returns
@@ -150,6 +152,10 @@ Handlers of nodes (TypeScript type).
150
152
type Handlers = Partial <Record <Node [' type' ], Handler >>
151
153
` ` `
152
154
155
+ ### ` Map `
156
+
157
+ Raw source map from ` source -map ` (TypeScript type).
158
+
153
159
### ` Options `
154
160
155
161
Configuration (TypeScript type).
@@ -160,7 +166,7 @@ Configuration (TypeScript type).
160
166
— generate a source map with this class
161
167
* ` filePath ` ( ` string ` )
162
168
— path to original input file
163
- * ` handlers ` ([ ` Handlers ` ][handlers])
169
+ * ` handlers ` ([ ` Handlers ` ][api- handlers])
164
170
— extra handlers
165
171
166
172
### ` Result `
@@ -171,7 +177,7 @@ Result (TypeScript type).
171
177
172
178
* ` value ` ( ` string ` )
173
179
— serialized JavaScript
174
- * ` map ` ( ` object ` or ` undefined ` )
180
+ * ` map ` ([ ` Map ` ][api-map] or ` undefined ` )
175
181
— source map as (parsed) JSON
176
182
177
183
### ` State `
@@ -307,8 +313,12 @@ Yields:
307
313
## Types
308
314
309
315
This package is fully typed with [ TypeScript] [ ] .
310
- It exports the additional types [ ` Handler ` ] [ handler ] , [ ` Handlers ` ] [ handlers ] ,
311
- [ ` Options ` ] [ options ] , [ ` Result ` ] [ result ] , and ` State ` .
316
+ It exports the additional types [ ` Handler ` ] [ api-handler ] ,
317
+ [ ` Handlers ` ] [ api-handlers ] ,
318
+ [ ` Map ` ] [ api-map ] ,
319
+ [ ` Options ` ] [ api-options ] ,
320
+ [ ` Result ` ] [ api-result ] , and
321
+ [ ` State ` ] [ api-state ] .
312
322
313
323
## Compatibility
314
324
@@ -393,16 +403,18 @@ abide by its terms.
393
403
394
404
[ source-map ] : https://github.com/mozilla/source-map
395
405
396
- [ jsx ] : #jsx
406
+ [ api-jsx ] : #jsx
407
+
408
+ [ api-to-js ] : #tojstree-options
397
409
398
- [ tojs ] : #tojstree-options
410
+ [ api-handler ] : #handler
399
411
400
- [ handler ] : #handler
412
+ [ api-handlers ] : #handlers
401
413
402
- [ handlers ] : #handlers
414
+ [ api-map ] : #map
403
415
404
- [ options ] : #options
416
+ [ api- options] : #options
405
417
406
- [ state ] : #state
418
+ [ api- state] : #state
407
419
408
- [ result ] : #result
420
+ [ api- result] : #result
0 commit comments