{"id":28608228,"url":"https://github.com/vfile/vfile-message","last_synced_at":"2025-06-11T21:40:39.823Z","repository":{"id":26841394,"uuid":"111026968","full_name":"vfile/vfile-message","owner":"vfile","description":"utility to create a vfile message","archived":false,"fork":false,"pushed_at":"2023-07-07T10:15:12.000Z","size":136,"stargazers_count":10,"open_issues_count":1,"forks_count":2,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-06-01T12:58:25.781Z","etag":null,"topics":["file","message","vfile","vfile-util","virtual"],"latest_commit_sha":null,"homepage":"https://unifiedjs.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vfile.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"unifiedjs","open_collective":"unified"}},"created_at":"2017-11-16T21:59:37.000Z","updated_at":"2023-05-09T08:46:23.000Z","dependencies_parsed_at":"2024-06-18T15:29:53.628Z","dependency_job_id":"c1d636c8-b859-4570-9940-8b9ebff81a66","html_url":"https://github.com/vfile/vfile-message","commit_stats":{"total_commits":111,"total_committers":4,"mean_commits":27.75,"dds":0.05405405405405406,"last_synced_commit":"69c314c3ba039047969df57ce2283addf4e54ec4"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/vfile/vfile-message","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfile%2Fvfile-message","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfile%2Fvfile-message/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfile%2Fvfile-message/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfile%2Fvfile-message/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vfile","download_url":"https://codeload.github.com/vfile/vfile-message/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfile%2Fvfile-message/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259346986,"owners_count":22843814,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file","message","vfile","vfile-util","virtual"],"created_at":"2025-06-11T21:40:24.446Z","updated_at":"2025-06-11T21:40:39.816Z","avatar_url":"https://github.com/vfile.png","language":"JavaScript","funding_links":["https://github.com/sponsors/unifiedjs","https://opencollective.com/unified"],"categories":[],"sub_categories":[],"readme":"# vfile-message\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\nCreate [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*   [Types](#types)\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, you can use `file.message` from `VFile` itself, but in some\ncases you might not have a file, and still want to emit warnings or errors,\nin which case this can be used directly.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\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\u003cscript type=\"module\"\u003e\n  import {VFileMessage} from 'https://esm.sh/vfile-message@4?bundle'\n\u003c/script\u003e\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  {source: 'spell', ruleId: 'typo', place: {line: 1, column: 8}}\n)\n\nconsole.log(message)\n```\n\nYields:\n\n```txt\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.\n\n### `VFileMessage(reason[, options])`\n\nCreate a message for `reason`.\n\n\u003e 🪦 **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`][mdn-error].\n\n###### Returns\n\nInstance of `VFileMessage`.\n\n###### Fields\n\n*   `ancestors` ([`Array\u003cNode\u003e`][unist-node] or `undefined`)\n    — stack of (inclusive) ancestor nodes surrounding the message\n*   `cause` ([`Error`][mdn-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`][unist-point], [`Position`][unist-position] 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\u003cNode\u003e`][unist-node], optional)\n    — stack of (inclusive) ancestor nodes surrounding the message\n*   `cause` ([`Error`][mdn-error], optional)\n    — original error cause of the message\n*   `place` ([`Point`][unist-point] or [`Position`][unist-position], 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][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\u003cstring\u003e`, 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## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type [`Options`][api-options].\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`][contributing] in [`vfile/.github`][health] for ways to\nget started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n\u003c!-- Definitions --\u003e\n\n[build-badge]: https://github.com/vfile/vfile-message/workflows/main/badge.svg\n\n[build]: https://github.com/vfile/vfile-message/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/vfile/vfile-message.svg\n\n[coverage]: https://codecov.io/github/vfile/vfile-message\n\n[downloads-badge]: https://img.shields.io/npm/dm/vfile-message.svg\n\n[downloads]: https://www.npmjs.com/package/vfile-message\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size\u0026query=$.size.compressedSize\u0026url=https://deno.bundlejs.com/?q=vfile-message\n\n[size]: https://bundlejs.com/?q=vfile-message\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/vfile/vfile/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[contributing]: https://github.com/vfile/.github/blob/main/contributing.md\n\n[support]: https://github.com/vfile/.github/blob/main/support.md\n\n[health]: https://github.com/vfile/.github\n\n[coc]: https://github.com/vfile/.github/blob/main/code-of-conduct.md\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[mdn-error]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\n\n[unist-node]: https://github.com/syntax-tree/unist#node\n\n[unist-point]: https://github.com/syntax-tree/unist#point\n\n[unist-position]: https://github.com/syntax-tree/unist#position\n\n[vfile]: https://github.com/vfile/vfile\n\n[util]: https://github.com/vfile/vfile#utilities\n\n[api-options]: #options\n\n[api-vfile-message]: #vfilemessagereason-options\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvfile%2Fvfile-message","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvfile%2Fvfile-message","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvfile%2Fvfile-message/lists"}