{"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"bugs":{"url":"https://github.com/vfile/vfile-message/issues"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"dependencies":{"@types/unist":"^3.0.0","unist-util-stringify-position":"^4.0.0"},"description":"vfile utility to create a virtual message","devDependencies":{"@types/node":"^24.0.0","c8":"^10.0.0","prettier":"^3.0.0","remark-cli":"^12.0.0","remark-preset-wooorm":"^11.0.0","type-coverage":"^2.0.0","typescript":"^5.0.0","xo":"^1.0.0"},"exports":"./index.js","funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"keywords":["file","message","utility","util","vfile-util","vfile","virtual"],"license":"MIT","name":"vfile-message","prettier":{"bracketSpacing":false,"semi":false,"singleQuote":true,"tabWidth":2,"trailingComma":"none","useTabs":false},"remarkConfig":{"plugins":["remark-preset-wooorm"]},"repository":{"type":"git","url":"git+https://github.com/vfile/vfile-message.git"},"scripts":{"build":"tsc --build --clean && tsc --build && type-coverage","format":"remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix","prepack":"npm run build && npm run format","test-api":"node --conditions development test.js","test-coverage":"c8 --100 --reporter lcov -- npm run test-api","test":"npm run build && npm run format && npm run test-coverage"},"sideEffects":false,"typeCoverage":{"atLeast":100,"ignoreCatch":true},"type":"module","version":"4.0.3","xo":{"prettier":true,"rules":{"prefer-destructuring":"off","unicorn/prefer-at":"off"},"space":true},"_id":"vfile-message@4.0.3","gitHead":"2c782c8580c5b0a14baae19fa8badc628e567461","types":"./index.d.ts","homepage":"https://github.com/vfile/vfile-message#readme","_nodeVersion":"23.9.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==","shasum":"87b44dddd7b70f0641c2e3ed0864ba73e2ea8df4","tarball":"http://registry-npm.ywwl.com/vfile-message/download/vfile-message-4.0.3.tgz","fileCount":7,"unpackedSize":34220,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDxJurhHdEc1yAwJC9wj+C5kPr3JfPL1VjHLl6U1lv5jwIgU9aD048XNc7bGQaLcMUj1fDBKyIy+rBIYRwFVc+4i38="}],"size":6370,"noattachment":false,"key":"/vfile-message/-/vfile-message-4.0.3.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vfile-message_4.0.3_1753542492491_0.06585837674320816"},"_hasShrinkwrap":false,"readme":"# vfile-message\n\n[![Build][badge-build-image]][badge-build-url]\n[![Coverage][badge-coverage-image]][badge-coverage-url]\n[![Downloads][badge-downloads-image]][badge-downloads-url]\n[![Size][badge-size-image]][badge-size-url]\n\nCreate [vfile][github-vfile] messages.\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n  * [`VFileMessage(reason[, options])`](#vfilemessagereason-options)\n  * [`Options`](#options)\n  * [Well-known](#well-known)\n* [Compatibility](#compatibility)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package provides a (lint) message format.\n\n## When should I use this?\n\nIn most cases,\nyou can use `file.message` from `VFile` itself,\nbut in some cases you might not have a file,\nand still want to emit warnings or errors,\nin which case this can be used directly.\n\n## Install\n\nThis package is [ESM only][github-gist-esm].\nIn Node.js (version 16+),\ninstall with [npm][npmjs-install]:\n\n```sh\nnpm install vfile-message\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {VFileMessage} from 'https://esm.sh/vfile-message@4'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {VFileMessage} from 'https://esm.sh/vfile-message@4?bundle'\n</script>\n```\n\n## Use\n\n```js\nimport {VFileMessage} from 'vfile-message'\n\nconst message = new VFileMessage(\n  'Unexpected unknown word `braavo`, did you mean `bravo`?',\n  {place: {column: 8, line: 1}, ruleId: 'typo', source: 'spell'}\n)\n\nconsole.log(message)\n```\n\nYields:\n\n```text\n[1:8: Unexpected unknown word `braavo`, did you mean `bravo`?] {\n  reason: 'Unexpected unknown word `braavo`, did you mean `bravo`?',\n  line: 1,\n  column: 8,\n  ancestors: undefined,\n  cause: undefined,\n  fatal: undefined,\n  place: {line: 1, column: 8},\n  ruleId: 'typo',\n  source: 'spell'\n}\n```\n\n## API\n\nThis package exports the identifier [`VFileMessage`][api-vfile-message].\nThere is no default export.\nIt exports the additional [TypeScript][] type [`Options`][api-options].\n\n### `VFileMessage(reason[, options])`\n\nCreate a message for `reason`.\n\n> 🪦 **Note**: also has obsolete signatures.\n\n###### Parameters\n\n* `reason` (`string`)\n  — reason for message (should use markdown)\n* `options` ([`Options`][api-options], optional)\n  — configuration.\n\n###### Extends\n\n[`Error`][developer-mozilla-error].\n\n###### Returns\n\nInstance of `VFileMessage`.\n\n###### Fields\n\n* `ancestors` ([`Array<Node>`][github-unist-node] or `undefined`)\n  — stack of (inclusive) ancestor nodes surrounding the message\n* `cause` ([`Error`][developer-mozilla-error] or `undefined`)\n  — original error cause of the message\n* `column` (`number` or `undefined`)\n  — starting column of message\n* `fatal` (`boolean` or `undefined`)\n  — state of problem; `true`: error, file not usable; `false`: warning,\n  change may be needed; `undefined`: info, change likely not needed\n* `line` (`number` or `undefined`)\n  — starting line of message\n* `place` ([`Point`][github-unist-point], [`Position`][github-unist-position]\n  or `undefined`)\n  — place of message\n* `reason` (`string`)\n  — reason for message (should use markdown)\n* `ruleId` (`string` or `undefined`, example: `'my-rule'`)\n  — category of message\n* `source` (`string` or `undefined`, example: `'my-package'`)\n  — namespace of message\n\n### `Options`\n\nConfiguration (TypeScript type).\n\n###### Fields\n\n* `ancestors` ([`Array<Node>`][github-unist-node], optional)\n  — stack of (inclusive) ancestor nodes surrounding the message\n* `cause` ([`Error`][developer-mozilla-error], optional)\n  — original error cause of the message\n* `place` ([`Point`][github-unist-point] or [`Position`][github-unist-position],\n  optional)\n  — place of message\n* `ruleId` (`string`, optional, example: `'my-rule'`)\n  — category of message\n* `source` (`string`, optional, , example: `'my-package'`)\n  — namespace of who sent the message\n\n### Well-known\n\nIt’s OK to store custom data directly on the `VFileMessage`, some of those are\nhandled by [utilities][github-vfile-util].\nThe following fields are documented and typed here.\n\n###### Fields\n\n* `actual` (`string`, optional)\n  — specify the source value that’s being reported, which is deemed incorrect\n* `expected` (`Array<string>`, optional)\n  — suggest acceptable values that can be used instead of `actual`\n* `url` (`string`, optional)\n  — link to docs for the message (this must be an absolute URL that can be\n  passed as `x` to `new URL(x)`)\n* `note` (`string`, optional)\n  — long form description of the message (you should use markdown)\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line, `vfile-message@^4`,\ncompatible with Node.js 16.\n\n## Contribute\n\nSee [`contributing.md`][health-contributing] in [`vfile/.github`][health]\nfor ways to get started.\nSee [`support.md`][health-support] for ways to get help.\n\nThis project has a [code of conduct][health-coc].\nBy interacting with this repository,\norganization,\nor community you agree to abide by its terms.\n\n## License\n\n[MIT][file-license] © [Titus Wormer][wooorm]\n\n<!-- Definitions -->\n\n[api-options]: #options\n\n[api-vfile-message]: #vfilemessagereason-options\n\n[badge-build-image]: https://github.com/vfile/vfile-message/workflows/main/badge.svg\n\n[badge-build-url]: https://github.com/vfile/vfile-message/actions\n\n[badge-coverage-image]: https://img.shields.io/codecov/c/github/vfile/vfile-message.svg\n\n[badge-coverage-url]: https://codecov.io/github/vfile/vfile-message\n\n[badge-downloads-image]: https://img.shields.io/npm/dm/vfile-message.svg\n\n[badge-downloads-url]: https://www.npmjs.com/package/vfile-message\n\n[badge-size-image]: https://img.shields.io/bundlejs/size/vfile-message\n\n[badge-size-url]: https://bundlejs.com/?q=vfile-message\n\n[developer-mozilla-error]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\n\n[esmsh]: https://esm.sh\n\n[file-license]: license\n\n[github-gist-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[github-unist-node]: https://github.com/syntax-tree/unist#node\n\n[github-unist-point]: https://github.com/syntax-tree/unist#point\n\n[github-unist-position]: https://github.com/syntax-tree/unist#position\n\n[github-vfile]: https://github.com/vfile/vfile\n\n[github-vfile-util]: https://github.com/vfile/vfile#utilities\n\n[health]: https://github.com/vfile/.github\n\n[health-coc]: https://github.com/vfile/.github/blob/main/code-of-conduct.md\n\n[health-contributing]: https://github.com/vfile/.github/blob/main/contributing.md\n\n[health-support]: https://github.com/vfile/.github/blob/main/support.md\n\n[npmjs-install]: https://docs.npmjs.com/cli/install\n\n[typescript]: https://www.typescriptlang.org\n\n[wooorm]: https://wooorm.com\n","publish_time":1753542492656,"_cnpm_publish_time":1753542492656,"dist-tags":{"latest":"4.0.4"}}