Socket
Socket
Sign inDemoInstall

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 6.1.0 to 7.0.0

index.d.ts

12

index.js

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

'use strict'
module.exports = require('./lib/fs')
/**
* @typedef {import('./lib/index.js').Compatible} Compatible
* @typedef {import('./lib/index.js').Callback} Callback
* @typedef {import('./lib/index.js').BufferEncoding} BufferEncoding
* @typedef {import('./lib/index.js').Mode} Mode
* @typedef {import('./lib/index.js').ReadOptions} ReadOptions
* @typedef {import('./lib/index.js').WriteOptions} WriteOptions
*/
export {toVFile} from './lib/index.js'

62

package.json
{
"name": "to-vfile",
"version": "6.1.0",
"version": "7.0.0",
"description": "vfile utility to create a vfile from a filepath",

@@ -28,6 +28,9 @@ "license": "MIT",

],
"sideEffects": false,
"type": "module",
"main": "index.js",
"browser": "lib/core.js",
"types": "index.d.ts",
"files": [
"lib",
"lib/",
"index.d.ts",
"index.js"

@@ -37,29 +40,24 @@ ],

"is-buffer": "^2.0.0",
"vfile": "^4.0.0"
"vfile": "^5.0.0"
},
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^15.0.0",
"prettier": "^1.0.0",
"remark-cli": "^7.0.0",
"remark-preset-wooorm": "^6.0.0",
"tape": "^4.0.0",
"tinyify": "^2.0.0",
"xo": "^0.27.0"
"@types/tape": "^4.0.0",
"c8": "^7.0.0",
"prettier": "^2.0.0",
"remark-cli": "^9.0.0",
"remark-preset-wooorm": "^8.0.0",
"rimraf": "^3.0.0",
"tape": "^5.0.0",
"type-coverage": "^2.0.0",
"typescript": "^4.0.0",
"xo": "^0.39.0"
},
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s toVFile > to-vfile.js",
"build-mangle": "browserify . -s toVFile -p tinyify > to-vfile.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
"prepack": "npm run build && npm run format",
"build": "rimraf \"{lib/**,}*.d.ts\" && tsc && type-coverage",
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"test-api": "node test.js",
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js",
"test": "npm run format && npm run test-coverage"
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"prettier": {

@@ -75,6 +73,6 @@ "tabWidth": 2,

"prettier": true,
"esnext": false,
"ignores": [
"to-vfile.js"
]
"rules": {
"no-var": "off",
"prefer-arrow-callback": "off"
}
},

@@ -85,3 +83,9 @@ "remarkConfig": {

]
},
"typeCoverage": {
"atLeast": 100,
"detail": true,
"strict": true,
"ignoreCatch": true
}
}

@@ -16,2 +16,5 @@ # to-vfile

This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c):
Node 12+ is needed to use it and it must be `import`ed instead of `require`d.
[npm][]:

@@ -23,12 +26,10 @@

> **Note**: the file-system stuff is not available in the browser.
## Use
```js
var vfile = require('to-vfile')
import {toVFile} from 'to-vfile'
console.log(vfile('readme.md'))
console.log(vfile.readSync('.git/HEAD'))
console.log(vfile.readSync('.git/HEAD', 'utf8'))
console.log(toVFile('readme.md'))
console.log(toVFile.readSync('.git/HEAD'))
console.log(toVFile.readSync('.git/HEAD', 'utf8'))
```

@@ -50,3 +51,3 @@

cwd: '/Users/tilde/projects/oss/to-vfile',
contents: <Buffer 72 65 66 3a 20 72 65 66 73 2f 68 65 61 64 73 2f 6d 61 73 74 65 72 0a>
value: <Buffer 72 65 66 3a 20 72 65 66 73 2f 68 65 61 64 73 2f 6d 61 73 74 65 72 0a>
}

@@ -58,3 +59,3 @@ VFile {

cwd: '/Users/tilde/projects/oss/to-vfile',
contents: 'ref: refs/heads/master\n'
value: 'ref: refs/heads/main\n'
}

@@ -65,2 +66,5 @@ ```

This package exports the following identifiers: `toVFile`.
There is no default export.
### `toVFile(options)`

@@ -71,3 +75,3 @@

`Buffer`, in which case it’s treated as `{path: options}` instead of
`{contents: options}`.
`{value: options}`.

@@ -77,3 +81,3 @@ ### `toVFile.read(options[, encoding][, callback])`

Creates a virtual file from options (`toVFile(options)`), reads the file from
the file-system and populates `file.contents` with the result.
the file system and populates `file.value` with the result.
If `encoding` is specified, it’s passed to `fs.readFile`.

@@ -93,3 +97,3 @@ If `callback` is given, invokes it with either an error or the populated virtual

Creates a virtual file from `options` (`toVFile(options)`), writes the file to
the file-system.
the file system.
`fsOptions` are passed to `fs.writeFile`.

@@ -121,5 +125,5 @@ If `callback` is given, invokes it with an error, if any.

[build-badge]: https://img.shields.io/travis/vfile/to-vfile.svg
[build-badge]: https://github.com/vfile/to-vfile/workflows/main/badge.svg
[build]: https://travis-ci.org/vfile/to-vfile
[build]: https://github.com/vfile/to-vfile/actions

@@ -140,15 +144,15 @@ [coverage-badge]: https://img.shields.io/codecov/c/github/vfile/to-vfile.svg

[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
[chat]: https://spectrum.chat/unified/vfile
[chat]: https://github.com/vfile/vfile/discussions
[npm]: https://docs.npmjs.com/cli/install
[contributing]: https://github.com/vfile/.github/blob/master/contributing.md
[contributing]: https://github.com/vfile/.github/blob/HEAD/contributing.md
[support]: https://github.com/vfile/.github/blob/master/support.md
[support]: https://github.com/vfile/.github/blob/HEAD/support.md
[health]: https://github.com/vfile/.github
[coc]: https://github.com/vfile/.github/blob/master/code-of-conduct.md
[coc]: https://github.com/vfile/.github/blob/HEAD/code-of-conduct.md

@@ -155,0 +159,0 @@ [license]: license

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