Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

to-vfile

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

to-vfile - npm Package Compare versions

Comparing version 7.0.0 to 7.1.0

4

lib/index.d.ts

@@ -0,1 +1,2 @@

/// <reference types="node" />
/**

@@ -60,3 +61,3 @@ * Create a virtual file from a description.

*/
export type Compatible = Path | Options | VFile
export type Compatible = Path | URL | Options | VFile
export type Callback = (

@@ -86,2 +87,3 @@ error: NodeJS.ErrnoException | null,

): VFile
import {URL} from 'url'
export {}

@@ -11,3 +11,3 @@ /**

* @typedef {string|Uint8Array} Path Path of the file.
* @typedef {Path|Options|VFile} Compatible Things that can be
* @typedef {Path|URL|Options|VFile} Compatible Things that can be
* passed to the function.

@@ -24,2 +24,3 @@ */

import path from 'path'
import {URL, fileURLToPath} from 'url'
import buffer from 'is-buffer'

@@ -40,2 +41,4 @@ import {VFile} from 'vfile'

options = {path: String(options)}
} else if (options instanceof URL) {
options = {path: fileURLToPath(options)}
}

@@ -42,0 +45,0 @@

{
"name": "to-vfile",
"version": "7.0.0",
"version": "7.1.0",
"description": "vfile utility to create a vfile from a filepath",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -31,2 +31,3 @@ # to-vfile

console.log(toVFile('readme.md'))
console.log(toVFile(new URL('./readme.md', import.meta.url)))
console.log(toVFile.readSync('.git/HEAD'))

@@ -48,2 +49,8 @@ console.log(toVFile.readSync('.git/HEAD', 'utf8'))

messages: [],
history: ['readme.md'],
cwd: '/Users/tilde/projects/oss/to-vfile'
}
VFile {
data: {},
messages: [],
history: ['.git/HEAD'],

@@ -72,3 +79,4 @@ cwd: '/Users/tilde/projects/oss/to-vfile',

`Buffer`, in which case it’s treated as `{path: options}` instead of
`{value: options}`.
`{value: options}`, or when `options` is a WHATWG `URL` object, in which case
it’s treated as `{path: fileURLToPath(options)}`.

@@ -75,0 +83,0 @@ ### `toVFile.read(options[, encoding][, callback])`

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc