You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
19 KiB
JavaScript
25 lines
19 KiB
JavaScript
|
9 months ago
|
"use strict";
|
||
|
|
/*
|
||
|
|
* ATTENTION: An "eval-source-map" devtool has been used.
|
||
|
|
* This devtool is neither made for production nor for readable output files.
|
||
|
|
* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
|
||
|
|
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
||
|
|
* or disable the default devtool with "devtool: false".
|
||
|
|
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
||
|
|
*/
|
||
|
|
exports.id = "vendor-chunks/vfile-message";
|
||
|
|
exports.ids = ["vendor-chunks/vfile-message"];
|
||
|
|
exports.modules = {
|
||
|
|
|
||
|
|
/***/ "(ssr)/./node_modules/vfile-message/lib/index.js":
|
||
|
|
/*!*************************************************!*\
|
||
|
|
!*** ./node_modules/vfile-message/lib/index.js ***!
|
||
|
|
\*************************************************/
|
||
|
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
|
|
||
|
|
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ VFileMessage: () => (/* binding */ VFileMessage)\n/* harmony export */ });\n/* harmony import */ var unist_util_stringify_position__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! unist-util-stringify-position */ \"(ssr)/./node_modules/unist-util-stringify-position/lib/index.js\");\n/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Position} Position\n * @typedef {import('unist').Point} Point\n * @typedef {object & {type: string, position?: Position | undefined}} NodeLike\n */ \n/**\n * Message.\n */ class VFileMessage extends Error {\n /**\n * Create a message for `reason` at `place` from `origin`.\n *\n * When an error is passed in as `reason`, the `stack` is copied.\n *\n * @param {string | Error | VFileMessage} reason\n * Reason for message, uses the stack and message of the error if given.\n *\n * > 👉 **Note**: you should use markdown.\n * @param {Node | NodeLike | Position | Point | null | undefined} [place]\n * Place in file where the message occurred.\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns\n * Instance of `VFileMessage`.\n */ // To do: next major: expose `undefined` everywhere instead of `null`.\n constructor(reason, place, origin){\n /** @type {[string | null, string | null]} */ const parts = [\n null,\n null\n ];\n /** @type {Position} */ let position = {\n // @ts-expect-error: we always follows the structure of `position`.\n start: {\n line: null,\n column: null\n },\n // @ts-expect-error: \"\n end: {\n line: null,\n column: null\n }\n };\n super();\n if (typeof place === \"string\") {\n origin = place;\n place = undefined;\n }\n if (typeof origin === \"string\") {\n const index = origin.indexOf(\":\");\n if (index === -1) {\n parts[1] = origin;\n } else {\n parts[0] = origin.slice(0, index);\n parts[1] = origin.slice(index + 1);\n }\n }\n if (place) {\n // Node.\n if (\"type\" in place || \"position\" in place) {\n if (place.position) {\n // To do: next major: deep clone.\n // @ts-expect-error: looks like a position.\n position = place.position;\n }\n } else if (\"start\" in place || \"end\" in place) {\n // @ts-expect-error: looks like a position.\n // To do: next major: deep clone.\n position = place;\n } else if (\"line\" in place || \"column\" in place) {\n // To do: next major: deep clone.\n position.start = place;\n }\n }\n // Fields from `Error`.\n /**\n * Serialized positional info of error.\n *\n * On normal errors, this would be something like `ParseError`, buit in\n * `VFile` messages we use this space to show where an error happened.\n */ this.name = (0,unist_util_stringify_position__WEBPACK_IMPORTED_MODULE_0__.stringifyPosition)(place) || \"1:1\";\n /**\n * Reason for message.\n *\n * @type {string}\n */ this.message = typeof reason === \"object\" ? reason.message : reason;\n /**\n * Stack of message.\n *\n * This is used by normal errors to show where something happened in\n * programming code, irrelevant for `VFile` messages,\n *\n * @type {string}\n */ this.stack = \"\";\n if (typeof reason === \"object\" && reason.stack) {\n this.stack = reason.stack;\n }\n /**\n * Reason for messag
|
||
|
|
|
||
|
|
/***/ })
|
||
|
|
|
||
|
|
};
|
||
|
|
;
|