Skip to content

Commit 003821f

Browse files
committed
Update vfile-location
1 parent 7ae0fcc commit 003821f

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import location from 'vfile-location'
1+
import {location} from 'vfile-location'
22

33
var search = /\r?\n|\r/g
44

55
/**
66
* @param {import('unist').Node|import('unist').Position} value Value to get
7-
* @param {import('vfile').VFile|string} file File in which `value` exists
7+
* @param {import('vfile').VFile|import('vfile').VFileValue} file File in which `value` exists
88
* @returns {string|null}
99
*/
1010
export function source(value, file) {

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
],
3333
"dependencies": {
3434
"@types/unist": "^2.0.0",
35-
"vfile": "^4.0.0",
36-
"vfile-location": "^3.0.0"
35+
"vfile": "^5.0.0",
36+
"vfile-location": "^4.0.0"
3737
},
3838
"devDependencies": {
3939
"@types/tape": "^4.0.0",

readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ Say we have the following file, `example.md`:
3333
And our script, `example.js`, looks as follows:
3434

3535
```js
36-
import vfile from 'to-vfile'
36+
import {toVFile} from 'to-vfile'
3737
import unified from 'unified'
3838
import remarkParse from 'remark-parse'
3939
import {source} from 'unist-util-source'
4040

41-
var file = vfile.readSync('example.md')
41+
var file = toVFile.readSync('example.md')
4242
var tree = unified()
4343
.use(remarkParse)
4444
.parse(file)

test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import test from 'tape'
2-
import vfile from 'vfile'
32
import remark from 'remark'
3+
import {VFile} from 'vfile'
44
import {source} from './index.js'
55

66
test('unist-util-source', function (t) {
7-
var file = vfile('> + **[Hello](./example)**\n> world.')
7+
var file = new VFile('> + **[Hello](./example)**\n> world.')
88
var node = remark().parse(file)
99

1010
t.equal(source(node, file), '> + **[Hello](./example)**\n> world.', 'root')
@@ -38,22 +38,22 @@ test('unist-util-source', function (t) {
3838

3939
t.equal(source(null, file), null, 'missing')
4040

41-
file = vfile('a\r\nb')
41+
file = new VFile('a\r\nb')
4242
node = remark().parse(file).children[0]
4343

4444
t.equal(source(node, file), 'a\r\nb', 'cr + lf')
4545

46-
file = vfile('a\rb')
46+
file = new VFile('a\rb')
4747
node = remark().parse(file).children[0]
4848

4949
t.equal(source(node, file), 'a\rb', 'cr')
5050

51-
file = vfile('a\n')
51+
file = new VFile('a\n')
5252
node = remark().parse(file)
5353

5454
t.equal(source(node, file), 'a\n', 'eof eol')
5555

56-
file = vfile('a\n\rb')
56+
file = new VFile('a\n\rb')
5757
node = remark().parse(file)
5858

5959
t.equal(source(node, file), 'a\n\rb', 'blank lines')

0 commit comments

Comments
 (0)