@@ -29,56 +29,59 @@ test('markdown -> mdast', (t) => {
2929 type : 'Program' ,
3030 start : 0 ,
3131 end : 17 ,
32- loc : { start : { line : 1 , column : 0 } , end : { line : 1 , column : 17 } } ,
3332 body : [
3433 {
3534 type : 'ImportDeclaration' ,
3635 start : 0 ,
3736 end : 17 ,
38- loc : {
39- start : { line : 1 , column : 0 } ,
40- end : { line : 1 , column : 17 }
41- } ,
4237 specifiers : [
4338 {
4439 type : 'ImportDefaultSpecifier' ,
4540 start : 7 ,
4641 end : 8 ,
47- loc : {
48- start : { line : 1 , column : 7 } ,
49- end : { line : 1 , column : 8 }
50- } ,
5142 local : {
5243 type : 'Identifier' ,
5344 start : 7 ,
5445 end : 8 ,
46+ name : 'a' ,
5547 loc : {
56- start : { line : 1 , column : 7 } ,
57- end : { line : 1 , column : 8 }
48+ start : { line : 1 , column : 7 , offset : 7 } ,
49+ end : { line : 1 , column : 8 , offset : 8 }
5850 } ,
59- name : 'a' ,
6051 range : [ 7 , 8 ]
6152 } ,
53+ loc : {
54+ start : { line : 1 , column : 7 , offset : 7 } ,
55+ end : { line : 1 , column : 8 , offset : 8 }
56+ } ,
6257 range : [ 7 , 8 ]
6358 }
6459 ] ,
6560 source : {
6661 type : 'Literal' ,
6762 start : 14 ,
6863 end : 17 ,
69- loc : {
70- start : { line : 1 , column : 14 } ,
71- end : { line : 1 , column : 17 }
72- } ,
7364 value : 'b' ,
7465 raw : '"b"' ,
66+ loc : {
67+ start : { line : 1 , column : 14 , offset : 14 } ,
68+ end : { line : 1 , column : 17 , offset : 17 }
69+ } ,
7570 range : [ 14 , 17 ]
7671 } ,
72+ loc : {
73+ start : { line : 1 , column : 0 , offset : 0 } ,
74+ end : { line : 1 , column : 17 , offset : 17 }
75+ } ,
7776 range : [ 0 , 17 ]
7877 }
7978 ] ,
8079 sourceType : 'module' ,
8180 comments : [ ] ,
81+ loc : {
82+ start : { line : 1 , column : 0 , offset : 0 } ,
83+ end : { line : 1 , column : 17 , offset : 17 }
84+ } ,
8285 range : [ 0 , 17 ]
8386 }
8487 }
@@ -157,8 +160,8 @@ test('markdown -> mdast', (t) => {
157160 value : 1 ,
158161 raw : '1' ,
159162 loc : {
160- start : { line : 1 , column : 1 } ,
161- end : { line : 1 , column : 2 }
163+ start : { line : 1 , column : 1 , offset : 1 } ,
164+ end : { line : 1 , column : 2 , offset : 2 }
162165 } ,
163166 range : [ 1 , 2 ]
164167 } ,
@@ -170,26 +173,32 @@ test('markdown -> mdast', (t) => {
170173 value : 1 ,
171174 raw : '1' ,
172175 loc : {
173- start : { line : 1 , column : 5 } ,
174- end : { line : 1 , column : 6 }
176+ start : { line : 1 , column : 5 , offset : 5 } ,
177+ end : { line : 1 , column : 6 , offset : 6 }
175178 } ,
176179 range : [ 5 , 6 ]
177180 } ,
178181 loc : {
179- start : { line : 1 , column : 1 } ,
180- end : { line : 1 , column : 6 }
182+ start : { line : 1 , column : 1 , offset : 1 } ,
183+ end : { line : 1 , column : 6 , offset : 6 }
181184 } ,
182185 range : [ 1 , 6 ]
183186 } ,
184187 start : 1 ,
185188 end : 6 ,
186- loc : { start : { line : 1 , column : 1 } , end : { line : 1 , column : 6 } } ,
189+ loc : {
190+ start : { line : 1 , column : 1 , offset : 1 } ,
191+ end : { line : 1 , column : 6 , offset : 6 }
192+ } ,
187193 range : [ 1 , 6 ]
188194 }
189195 ] ,
190196 sourceType : 'module' ,
191197 comments : [ ] ,
192- loc : { start : { line : 1 , column : 1 } , end : { line : 1 , column : 6 } } ,
198+ loc : {
199+ start : { line : 1 , column : 1 , offset : 1 } ,
200+ end : { line : 1 , column : 6 , offset : 6 }
201+ } ,
193202 range : [ 1 , 6 ]
194203 }
195204 }
@@ -207,11 +216,7 @@ test('markdown -> mdast', (t) => {
207216 JSON . parse (
208217 JSON . stringify (
209218 fromMarkdown (
210- `<Stuff>
211- {{
212- template: /* Comment */ '',
213- }}
214- </Stuff>` ,
219+ "<Stuff>\n {{\n template: /* Comment */ '',\n }}\n</Stuff>" ,
215220 {
216221 extensions : [ mdxjs ( ) ] ,
217222 mdastExtensions : [ mdxFromMarkdown ( ) ]
@@ -260,8 +265,8 @@ test('markdown -> mdast', (t) => {
260265 end : 25 ,
261266 name : 'template' ,
262267 loc : {
263- start : { line : 3 , column : 4 } ,
264- end : { line : 3 , column : 12 }
268+ start : { line : 3 , column : 4 , offset : 17 } ,
269+ end : { line : 3 , column : 12 , offset : 25 }
265270 } ,
266271 range : [ 17 , 25 ]
267272 } ,
@@ -272,30 +277,30 @@ test('markdown -> mdast', (t) => {
272277 value : '' ,
273278 raw : "''" ,
274279 loc : {
275- start : { line : 3 , column : 28 } ,
276- end : { line : 3 , column : 30 }
280+ start : { line : 3 , column : 28 , offset : 41 } ,
281+ end : { line : 3 , column : 30 , offset : 43 }
277282 } ,
278283 range : [ 41 , 43 ]
279284 } ,
280285 kind : 'init' ,
281286 loc : {
282- start : { line : 3 , column : 4 } ,
283- end : { line : 3 , column : 30 }
287+ start : { line : 3 , column : 4 , offset : 17 } ,
288+ end : { line : 3 , column : 30 , offset : 43 }
284289 } ,
285290 range : [ 17 , 43 ]
286291 }
287292 ] ,
288293 loc : {
289- start : { line : 2 , column : 3 } ,
290- end : { line : 4 , column : 3 }
294+ start : { line : 2 , column : 3 , offset : 11 } ,
295+ end : { line : 4 , column : 3 , offset : 48 }
291296 } ,
292297 range : [ 11 , 48 ]
293298 } ,
294299 start : 11 ,
295300 end : 48 ,
296301 loc : {
297- start : { line : 2 , column : 3 } ,
298- end : { line : 4 , column : 3 }
302+ start : { line : 2 , column : 3 , offset : 11 } ,
303+ end : { line : 4 , column : 3 , offset : 48 }
299304 } ,
300305 range : [ 11 , 48 ]
301306 }
@@ -308,15 +313,15 @@ test('markdown -> mdast', (t) => {
308313 start : 27 ,
309314 end : 40 ,
310315 loc : {
311- start : { line : 3 , column : 14 } ,
312- end : { line : 3 , column : 27 }
316+ start : { line : 3 , column : 14 , offset : 27 } ,
317+ end : { line : 3 , column : 27 , offset : 40 }
313318 } ,
314319 range : [ 27 , 40 ]
315320 }
316321 ] ,
317322 loc : {
318- start : { line : 2 , column : 3 } ,
319- end : { line : 4 , column : 3 }
323+ start : { line : 2 , column : 3 , offset : 11 } ,
324+ end : { line : 4 , column : 3 , offset : 48 }
320325 } ,
321326 range : [ 11 , 48 ]
322327 }
@@ -340,12 +345,10 @@ test('markdown -> mdast', (t) => {
340345 t . deepEqual (
341346 JSON . parse (
342347 JSON . stringify (
343- fromMarkdown (
344- `export let a = 'a'
345-
346- export let b = 'b'` ,
347- { extensions : [ mdxjs ( ) ] , mdastExtensions : [ mdxFromMarkdown ( ) ] }
348- )
348+ fromMarkdown ( "export let a = 'a'\n\nexport let b = 'b'" , {
349+ extensions : [ mdxjs ( ) ] ,
350+ mdastExtensions : [ mdxFromMarkdown ( ) ]
351+ } )
349352 )
350353 ) ,
351354 {
@@ -383,8 +386,8 @@ export let b = 'b'`,
383386 end : 12 ,
384387 name : 'a' ,
385388 loc : {
386- start : { line : 1 , column : 11 } ,
387- end : { line : 1 , column : 12 }
389+ start : { line : 1 , column : 11 , offset : 11 } ,
390+ end : { line : 1 , column : 12 , offset : 12 }
388391 } ,
389392 range : [ 11 , 12 ]
390393 } ,
@@ -395,39 +398,39 @@ export let b = 'b'`,
395398 value : 'a' ,
396399 raw : "'a'" ,
397400 loc : {
398- start : { line : 1 , column : 15 } ,
399- end : { line : 1 , column : 18 }
401+ start : { line : 1 , column : 15 , offset : 15 } ,
402+ end : { line : 1 , column : 18 , offset : 18 }
400403 } ,
401404 range : [ 15 , 18 ]
402405 } ,
403406 loc : {
404- start : { line : 1 , column : 11 } ,
405- end : { line : 1 , column : 18 }
407+ start : { line : 1 , column : 11 , offset : 11 } ,
408+ end : { line : 1 , column : 18 , offset : 18 }
406409 } ,
407410 range : [ 11 , 18 ]
408411 }
409412 ] ,
410413 kind : 'let' ,
411414 loc : {
412- start : { line : 1 , column : 7 } ,
413- end : { line : 1 , column : 18 }
415+ start : { line : 1 , column : 7 , offset : 7 } ,
416+ end : { line : 1 , column : 18 , offset : 18 }
414417 } ,
415418 range : [ 7 , 18 ]
416419 } ,
417420 specifiers : [ ] ,
418421 source : null ,
419422 loc : {
420- start : { line : 1 , column : 0 } ,
421- end : { line : 1 , column : 18 }
423+ start : { line : 1 , column : 0 , offset : 0 } ,
424+ end : { line : 1 , column : 18 , offset : 18 }
422425 } ,
423426 range : [ 0 , 18 ]
424427 }
425428 ] ,
426429 sourceType : 'module' ,
427430 comments : [ ] ,
428431 loc : {
429- start : { line : 1 , column : 0 } ,
430- end : { line : 1 , column : 18 }
432+ start : { line : 1 , column : 0 , offset : 0 } ,
433+ end : { line : 1 , column : 18 , offset : 18 }
431434 } ,
432435 range : [ 0 , 18 ]
433436 }
@@ -465,8 +468,8 @@ export let b = 'b'`,
465468 end : 32 ,
466469 name : 'b' ,
467470 loc : {
468- start : { line : 3 , column : 11 } ,
469- end : { line : 3 , column : 12 }
471+ start : { line : 3 , column : 11 , offset : 31 } ,
472+ end : { line : 3 , column : 12 , offset : 32 }
470473 } ,
471474 range : [ 31 , 32 ]
472475 } ,
@@ -477,39 +480,39 @@ export let b = 'b'`,
477480 value : 'b' ,
478481 raw : "'b'" ,
479482 loc : {
480- start : { line : 3 , column : 15 } ,
481- end : { line : 3 , column : 18 }
483+ start : { line : 3 , column : 15 , offset : 35 } ,
484+ end : { line : 3 , column : 18 , offset : 38 }
482485 } ,
483486 range : [ 35 , 38 ]
484487 } ,
485488 loc : {
486- start : { line : 3 , column : 11 } ,
487- end : { line : 3 , column : 18 }
489+ start : { line : 3 , column : 11 , offset : 31 } ,
490+ end : { line : 3 , column : 18 , offset : 38 }
488491 } ,
489492 range : [ 31 , 38 ]
490493 }
491494 ] ,
492495 kind : 'let' ,
493496 loc : {
494- start : { line : 3 , column : 7 } ,
495- end : { line : 3 , column : 18 }
497+ start : { line : 3 , column : 7 , offset : 27 } ,
498+ end : { line : 3 , column : 18 , offset : 38 }
496499 } ,
497500 range : [ 27 , 38 ]
498501 } ,
499502 specifiers : [ ] ,
500503 source : null ,
501504 loc : {
502- start : { line : 3 , column : 0 } ,
503- end : { line : 3 , column : 18 }
505+ start : { line : 3 , column : 0 , offset : 20 } ,
506+ end : { line : 3 , column : 18 , offset : 38 }
504507 } ,
505508 range : [ 20 , 38 ]
506509 }
507510 ] ,
508511 sourceType : 'module' ,
509512 comments : [ ] ,
510513 loc : {
511- start : { line : 3 , column : 0 } ,
512- end : { line : 3 , column : 18 }
514+ start : { line : 3 , column : 0 , offset : 20 } ,
515+ end : { line : 3 , column : 18 , offset : 38 }
513516 } ,
514517 range : [ 20 , 38 ]
515518 }
0 commit comments