diff --git a/lib/index.js b/lib/index.js index 27d09f9..aa0815c 100644 --- a/lib/index.js +++ b/lib/index.js @@ -20,7 +20,7 @@ import fs from 'fs' import path from 'path' -import {URL, fileURLToPath} from 'url' +import {URL} from 'url' import buffer from 'is-buffer' import {VFile} from 'vfile' @@ -34,10 +34,10 @@ import {VFile} from 'vfile' * @returns {VFile} */ export function toVFile(options) { - if (typeof options === 'string' || buffer(options)) { + if (typeof options === 'string' || options instanceof URL) { + options = {path: options} + } else if (buffer(options)) { options = {path: String(options)} - } else if (options instanceof URL) { - options = {path: fileURLToPath(options)} } return looksLikeAVFile(options) ? options : new VFile(options) diff --git a/package.json b/package.json index ffe08c4..4a5a200 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ ], "dependencies": { "is-buffer": "^2.0.0", - "vfile": "^5.0.0" + "vfile": "^5.1.0" }, "devDependencies": { "@types/tape": "^4.0.0",