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

vfile

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vfile - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

25

index.js
'use strict';
var path = require('path');
var has = require('has');
var replace = require('replace-ext');
var stringify = require('unist-util-stringify-position');
var buffer = require('is-buffer');
var string = require('x-is-string');
module.exports = VFile;
var own = {}.hasOwnProperty;
var proto = VFile.prototype;

@@ -41,3 +40,3 @@

options = {};
} else if (string(options) || buffer(options)) {
} else if (typeof options === 'string' || buffer(options)) {
options = {contents: options};

@@ -64,3 +63,3 @@ } else if ('message' in options && 'messages' in options) {

if (has(options, prop)) {
if (own.call(options, prop)) {
this[prop] = options[prop];

@@ -95,3 +94,3 @@ }

get: function () {
return string(this.path) ? path.dirname(this.path) : undefined;
return typeof this.path === 'string' ? path.dirname(this.path) : undefined;
},

@@ -107,3 +106,3 @@ set: function (dirname) {

get: function () {
return string(this.path) ? path.basename(this.path) : undefined;
return typeof this.path === 'string' ? path.basename(this.path) : undefined;
},

@@ -120,3 +119,3 @@ set: function (basename) {

get: function () {
return string(this.path) ? path.extname(this.path) : undefined;
return typeof this.path === 'string' ? path.extname(this.path) : undefined;
},

@@ -146,3 +145,3 @@ set: function (extname) {

get: function () {
return string(this.path) ? path.basename(this.path, this.extname) : undefined;
return typeof this.path === 'string' ? path.basename(this.path, this.extname) : undefined;
},

@@ -230,4 +229,10 @@ set: function (stem) {

proto.file = proto.name = proto.reason = proto.message = proto.stack = '';
proto.fatal = proto.column = proto.line = null;
proto.file = '';
proto.name = '';
proto.reason = '';
proto.message = '';
proto.stack = '';
proto.fatal = null;
proto.column = null;
proto.line = null;

@@ -234,0 +239,0 @@ /* Construct a new file message.

{
"name": "vfile",
"version": "2.0.1",
"version": "2.1.0",
"description": "Virtual file format for text processing",

@@ -28,7 +28,5 @@ "license": "MIT",

"dependencies": {
"has": "^1.0.1",
"is-buffer": "^1.1.4",
"replace-ext": "1.0.0",
"unist-util-stringify-position": "^1.0.0",
"x-is-string": "^0.1.0"
"unist-util-stringify-position": "^1.0.0"
},

@@ -42,6 +40,6 @@ "files": [

"nyc": "^10.0.0",
"remark-cli": "^2.0.0",
"remark-preset-wooorm": "^1.0.0",
"remark-cli": "^3.0.0",
"remark-preset-wooorm": "^3.0.0",
"tape": "^4.4.0",
"xo": "^0.17.0"
"xo": "^0.18.0"
},

@@ -66,2 +64,6 @@ "scripts": {

"space": true,
"esnext": false,
"rules": {
"unicorn/no-new-buffer": "off"
},
"ignores": [

@@ -72,4 +74,6 @@ "vfile.js"

"remarkConfig": {
"presets": "wooorm"
"plugins": [
"preset-wooorm"
]
}
}

58

readme.md

@@ -94,21 +94,21 @@ # ![vfile][]

* [`convert-vinyl-to-vfile`](https://github.com/dustinspecker/convert-vinyl-to-vfile)
— Convert from [Vinyl][];
— Convert from [Vinyl][]
* [`is-vfile-message`](https://github.com/shinnn/is-vfile-message)
— Check if a value is a `VFileMessage` object;
— Check if a value is a `VFileMessage` object
* [`to-vfile`](https://github.com/vfile/to-vfile)
— Create a virtual file from a file-path (and optionally read it);
— Create a virtual file from a file-path (and optionally read it)
* [`vfile-find-down`](https://github.com/vfile/vfile-find-down)
— Find files by searching the file system downwards;
— Find files by searching the file system downwards
* [`vfile-find-up`](https://github.com/vfile/vfile-find-up)
— Find files by searching the file system upwards;
— Find files by searching the file system upwards
* [`vfile-location`](https://github.com/vfile/vfile-location)
— Convert between line/column- and range-based locations;
— Convert between line/column- and range-based locations
* [`vfile-statistics`](https://github.com/vfile/vfile-statistics)
— Count messages per category;
— Count messages per category
* [`vfile-messages-to-vscode-diagnostics`](https://github.com/shinnn/vfile-messages-to-vscode-diagnostics)
— Convert to VS Code diagnostics;
— Convert to VS Code diagnostics
* [`vfile-sort`](https://github.com/vfile/vfile-sort)
— Sort messages by line/column;
* [`vfile-to-eslint`](https://github.com/sindresorhus/vfile-to-eslint)
— Convert VFiles to ESLint formatter compatible output.
— Sort messages by line/column
* [`vfile-to-eslint`](https://github.com/vfile/vfile-to-eslint)
— Convert VFiles to ESLint formatter compatible output

@@ -123,7 +123,7 @@ ## Reporters

* [`vfile-reporter`](https://github.com/vfile/vfile-reporter)
— Stylish reporter;
— Stylish reporter
* [`vfile-reporter-json`](https://github.com/vfile/vfile-reporter-json)
— JSON reporter;
* [`vfile-reporter-pretty`](https://github.com/sindresorhus/vfile-reporter-pretty)
— Pretty reporter.
— JSON reporter
* [`vfile-reporter-pretty`](https://github.com/vfile/vfile-reporter-pretty)
— Pretty reporter

@@ -213,8 +213,10 @@ ## API

###### Parameters
* `reason` (`string` or `Error`)
— Reason for message, uses the stack and message of the error if given;
— Reason for message, uses the stack and message of the error if given
* `position` (`Node`, `Location`, or `Position`, optional)
— Place at which the message occurred in `vfile`.
— Place at which the message occurred in `vfile`
* `ruleId` (`string`, optional)
— Category of warning.
— Category of warning

@@ -242,14 +244,14 @@ ###### Returns

* `file` (`string`) — File-path (when the message was triggered);
* `reason` (`string`) — Reason for message;
* `ruleId` (`string?`) — Category of message;
* `source` (`string?`) — Namespace of warning;
* `stack` (`string?`) — Stack of message;
* `file` (`string`) — File-path (when the message was triggered)
* `reason` (`string`) — Reason for message
* `ruleId` (`string?`) — Category of message
* `source` (`string?`) — Namespace of warning
* `stack` (`string?`) — Stack of message
* `fatal` (`boolean?`) — If `true`, marks associated file as no longer
processable;
* `line` (`number?`) — Starting line of error;
* `column` (`number?`) — Starting column of error;
processable
* `line` (`number?`) — Starting line of error
* `column` (`number?`) — Starting column of error
* `location` (`object`) — Full range information, when available. Has
`start` and `end` properties, both set to an object with `line` and
`column`, set to `number?`.
`column`, set to `number?`

@@ -278,3 +280,3 @@ ## License

[unified]: https://github.com/wooorm/unified
[unified]: https://github.com/unifiedjs/unified

@@ -281,0 +283,0 @@ [retext]: https://github.com/wooorm/retext

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