|
4 | 4 | * @typedef {import('unist').Point} Point |
5 | 5 | * @typedef {import('mdast').Content} Content |
6 | 6 | * @typedef {import('vfile').VFile} VFile |
7 | | - * @typedef {import('vfile-location').Location} LocationInterface |
| 7 | + * @typedef {ReturnType<import('vfile-location').location>} Location |
8 | 8 | * @typedef {{ |
9 | 9 | * parse(nodes: Node[]): Node |
10 | 10 | * tokenizeSource(value: string): Node |
|
19 | 19 | * |
20 | 20 | * @typedef Context |
21 | 21 | * @property {string} doc |
22 | | - * @property {LocationInterface} location |
| 22 | + * @property {Location} place |
23 | 23 | * @property {ParserInstance} parser |
24 | 24 | * @property {Array.<string>} ignore |
25 | 25 | * @property {Array.<string>} source |
|
28 | 28 | import repeat from 'repeat-string' |
29 | 29 | import {toString} from 'nlcst-to-string' |
30 | 30 | import {pointStart, pointEnd} from 'unist-util-position' |
31 | | -import vfileLocation from 'vfile-location' |
| 31 | +import {location} from 'vfile-location' |
32 | 32 |
|
33 | 33 | /** |
34 | 34 | * Transform a `tree` in mdast to nlcst. |
@@ -73,7 +73,7 @@ export function toNlcst(tree, file, Parser, options = {}) { |
73 | 73 | one( |
74 | 74 | { |
75 | 75 | doc: String(file), |
76 | | - location: vfileLocation(file), |
| 76 | + place: location(file), |
77 | 77 | parser, |
78 | 78 | ignore: [].concat( |
79 | 79 | 'table', |
@@ -210,8 +210,8 @@ function patch(config, nodes, offset) { |
210 | 210 | end = start + toString(node).length |
211 | 211 |
|
212 | 212 | node.position = { |
213 | | - start: config.location.toPoint(start), |
214 | | - end: config.location.toPoint(end) |
| 213 | + start: config.place.toPoint(start), |
| 214 | + end: config.place.toPoint(end) |
215 | 215 | } |
216 | 216 |
|
217 | 217 | start = end |
|
0 commit comments