🎉 initiate project *astro_rewrite*

This commit is contained in:
sindrekjelsrud 2023-07-19 21:31:30 +02:00
parent ffd4d5e86c
commit 2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions

1
node_modules/vfile-message/index.d.ts generated vendored Normal file
View file

@ -0,0 +1 @@
export {VFileMessage} from './lib/index.js'

1
node_modules/vfile-message/index.js generated vendored Normal file
View file

@ -0,0 +1 @@
export {VFileMessage} from './lib/index.js'

125
node_modules/vfile-message/lib/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,125 @@
/**
* Message.
*/
export class VFileMessage extends Error {
/**
* Create a message for `reason` at `place` from `origin`.
*
* When an error is passed in as `reason`, the `stack` is copied.
*
* @param {string | Error | VFileMessage} reason
* Reason for message, uses the stack and message of the error if given.
*
* > 👉 **Note**: you should use markdown.
* @param {Node | NodeLike | Position | Point | null | undefined} [place]
* Place in file where the message occurred.
* @param {string | null | undefined} [origin]
* Place in code where the message originates (example:
* `'my-package:my-rule'` or `'my-rule'`).
* @returns
* Instance of `VFileMessage`.
*/
constructor(
reason: string | Error | VFileMessage,
place?: Node | NodeLike | Position | Point | null | undefined,
origin?: string | null | undefined
)
/**
* Stack of message.
*
* This is used by normal errors to show where something happened in
* programming code, irrelevant for `VFile` messages,
*
* @type {string}
*/
stack: string
/**
* Reason for message.
*
* > 👉 **Note**: you should use markdown.
*
* @type {string}
*/
reason: string
/**
* State of problem.
*
* * `true` marks associated file as no longer processable (error)
* * `false` necessitates a (potential) change (warning)
* * `null | undefined` for things that might not need changing (info)
*
* @type {boolean | null | undefined}
*/
fatal: boolean | null | undefined
/**
* Starting line of error.
*
* @type {number | null}
*/
line: number | null
/**
* Starting column of error.
*
* @type {number | null}
*/
column: number | null
/**
* Full unist position.
*
* @type {Position | null}
*/
position: Position | null
/**
* Namespace of message (example: `'my-package'`).
*
* @type {string | null}
*/
source: string | null
/**
* Category of message (example: `'my-rule'`).
*
* @type {string | null}
*/
ruleId: string | null
/**
* Path of a file (used throughout the `VFile` ecosystem).
*
* @type {string | null}
*/
file: string | null
/**
* Specify the source value thats being reported, which is deemed
* incorrect.
*
* @type {string | null}
*/
actual: string | null
/**
* Suggest acceptable values that can be used instead of `actual`.
*
* @type {Array<string> | null}
*/
expected: Array<string> | null
/**
* Link to docs for the message.
*
* > 👉 **Note**: this must be an absolute URL that can be passed as `x`
* > to `new URL(x)`.
*
* @type {string | null}
*/
url: string | null
/**
* Long form description of the message (you should use markdown).
*
* @type {string | null}
*/
note: string | null
}
export type Node = import('unist').Node
export type Position = import('unist').Position
export type Point = import('unist').Point
export type NodeLike = object & {
type: string
position?: Position | undefined
}

225
node_modules/vfile-message/lib/index.js generated vendored Normal file
View file

@ -0,0 +1,225 @@
/**
* @typedef {import('unist').Node} Node
* @typedef {import('unist').Position} Position
* @typedef {import('unist').Point} Point
* @typedef {object & {type: string, position?: Position | undefined}} NodeLike
*/
import {stringifyPosition} from 'unist-util-stringify-position'
/**
* Message.
*/
export class VFileMessage extends Error {
/**
* Create a message for `reason` at `place` from `origin`.
*
* When an error is passed in as `reason`, the `stack` is copied.
*
* @param {string | Error | VFileMessage} reason
* Reason for message, uses the stack and message of the error if given.
*
* > 👉 **Note**: you should use markdown.
* @param {Node | NodeLike | Position | Point | null | undefined} [place]
* Place in file where the message occurred.
* @param {string | null | undefined} [origin]
* Place in code where the message originates (example:
* `'my-package:my-rule'` or `'my-rule'`).
* @returns
* Instance of `VFileMessage`.
*/
// To do: next major: expose `undefined` everywhere instead of `null`.
constructor(reason, place, origin) {
/** @type {[string | null, string | null]} */
const parts = [null, null]
/** @type {Position} */
let position = {
// @ts-expect-error: we always follows the structure of `position`.
start: {line: null, column: null},
// @ts-expect-error: "
end: {line: null, column: null}
}
super()
if (typeof place === 'string') {
origin = place
place = undefined
}
if (typeof origin === 'string') {
const index = origin.indexOf(':')
if (index === -1) {
parts[1] = origin
} else {
parts[0] = origin.slice(0, index)
parts[1] = origin.slice(index + 1)
}
}
if (place) {
// Node.
if ('type' in place || 'position' in place) {
if (place.position) {
// To do: next major: deep clone.
// @ts-expect-error: looks like a position.
position = place.position
}
}
// Position.
else if ('start' in place || 'end' in place) {
// @ts-expect-error: looks like a position.
// To do: next major: deep clone.
position = place
}
// Point.
else if ('line' in place || 'column' in place) {
// To do: next major: deep clone.
position.start = place
}
}
// Fields from `Error`.
/**
* Serialized positional info of error.
*
* On normal errors, this would be something like `ParseError`, buit in
* `VFile` messages we use this space to show where an error happened.
*/
this.name = stringifyPosition(place) || '1:1'
/**
* Reason for message.
*
* @type {string}
*/
this.message = typeof reason === 'object' ? reason.message : reason
/**
* Stack of message.
*
* This is used by normal errors to show where something happened in
* programming code, irrelevant for `VFile` messages,
*
* @type {string}
*/
this.stack = ''
if (typeof reason === 'object' && reason.stack) {
this.stack = reason.stack
}
/**
* Reason for message.
*
* > 👉 **Note**: you should use markdown.
*
* @type {string}
*/
this.reason = this.message
/* eslint-disable no-unused-expressions */
/**
* State of problem.
*
* * `true` marks associated file as no longer processable (error)
* * `false` necessitates a (potential) change (warning)
* * `null | undefined` for things that might not need changing (info)
*
* @type {boolean | null | undefined}
*/
this.fatal
/**
* Starting line of error.
*
* @type {number | null}
*/
this.line = position.start.line
/**
* Starting column of error.
*
* @type {number | null}
*/
this.column = position.start.column
/**
* Full unist position.
*
* @type {Position | null}
*/
this.position = position
/**
* Namespace of message (example: `'my-package'`).
*
* @type {string | null}
*/
this.source = parts[0]
/**
* Category of message (example: `'my-rule'`).
*
* @type {string | null}
*/
this.ruleId = parts[1]
/**
* Path of a file (used throughout the `VFile` ecosystem).
*
* @type {string | null}
*/
this.file
// The following fields are “well known”.
// Not standard.
// Feel free to add other non-standard fields to your messages.
/**
* Specify the source value thats being reported, which is deemed
* incorrect.
*
* @type {string | null}
*/
this.actual
/**
* Suggest acceptable values that can be used instead of `actual`.
*
* @type {Array<string> | null}
*/
this.expected
/**
* Link to docs for the message.
*
* > 👉 **Note**: this must be an absolute URL that can be passed as `x`
* > to `new URL(x)`.
*
* @type {string | null}
*/
this.url
/**
* Long form description of the message (you should use markdown).
*
* @type {string | null}
*/
this.note
/* eslint-enable no-unused-expressions */
}
}
VFileMessage.prototype.file = ''
VFileMessage.prototype.name = ''
VFileMessage.prototype.reason = ''
VFileMessage.prototype.message = ''
VFileMessage.prototype.stack = ''
VFileMessage.prototype.fatal = null
VFileMessage.prototype.column = null
VFileMessage.prototype.line = null
VFileMessage.prototype.source = null
VFileMessage.prototype.ruleId = null
VFileMessage.prototype.position = null

22
node_modules/vfile-message/license generated vendored Normal file
View file

@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2017 Titus Wormer <tituswormer@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

78
node_modules/vfile-message/package.json generated vendored Normal file
View file

@ -0,0 +1,78 @@
{
"name": "vfile-message",
"version": "3.1.4",
"description": "vfile utility to create a virtual message",
"license": "MIT",
"keywords": [
"vfile",
"vfile-util",
"util",
"utility",
"virtual",
"file",
"message"
],
"repository": "vfile/vfile-message",
"bugs": "https://github.com/vfile/vfile-message/issues",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
},
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"sideEffects": false,
"type": "module",
"main": "index.js",
"types": "index.d.ts",
"files": [
"lib/",
"index.d.ts",
"index.js"
],
"dependencies": {
"@types/unist": "^2.0.0",
"unist-util-stringify-position": "^3.0.0"
},
"devDependencies": {
"@types/node": "^18.0.0",
"c8": "^7.0.0",
"prettier": "^2.0.0",
"remark-cli": "^11.0.0",
"remark-preset-wooorm": "^9.0.0",
"type-coverage": "^2.0.0",
"typescript": "^4.0.0",
"xo": "^0.53.0"
},
"scripts": {
"prepack": "npm run build && npm run format",
"build": "tsc --build --clean && tsc --build && type-coverage",
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"test-api": "node --conditions development test.js",
"test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api",
"test": "npm run build && npm run format && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
},
"xo": {
"prettier": true
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"typeCoverage": {
"atLeast": 100,
"detail": true,
"strict": true,
"ignoreCatch": true
}
}

244
node_modules/vfile-message/readme.md generated vendored Normal file
View file

@ -0,0 +1,244 @@
# vfile-message
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
[![Sponsors][sponsors-badge]][collective]
[![Backers][backers-badge]][collective]
[![Chat][chat-badge]][chat]
Create [vfile][] messages.
## Contents
* [What is this?](#what-is-this)
* [When should I use this?](#when-should-i-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`VFileMessage(reason[, place][, origin])`](#vfilemessagereason-place-origin)
* [Well-known](#well-known)
* [Types](#types)
* [Compatibility](#compatibility)
* [Contribute](#contribute)
* [License](#license)
## What is this?
This package provides a (lint) message format.
## When should I use this?
In most cases, you can use `file.message` from `VFile` itself, but in some
cases you might not have a file, and still want to emit warnings or errors,
in which case this can be used directly.
## Install
This package is [ESM only][esm].
In Node.js (version 14.14+ and 16.0+), install with [npm][]:
```sh
npm install vfile-message
```
In Deno with [`esm.sh`][esmsh]:
```js
import {VFileMessage} from 'https://esm.sh/vfile-message@3'
```
In browsers with [`esm.sh`][esmsh]:
```html
<script type="module">
import {VFileMessage} from 'https://esm.sh/vfile-message@3?bundle'
</script>
```
## Use
```js
import {VFileMessage} from 'vfile-message'
const message = new VFileMessage(
'Unexpected unknown word `braavo`, did you mean `bravo`?',
{line: 1, column: 8},
'spell:typo'
)
console.log(message)
```
Yields:
```txt
[1:8: Unexpected unknown word `braavo`, did you mean `bravo`?] {
reason: 'Unexpected unknown word `braavo`, did you mean `bravo`?',
line: 1,
column: 8,
source: 'spell',
ruleId: 'typo',
position: {start: {line: 1, column: 8}, end: {line: null, column: null}}
}
```
## API
This package exports the identifier [`VFileMessage`][api-vfile-message].
There is no default export.
### `VFileMessage(reason[, place][, origin])`
Create a message for `reason` at `place` from `origin`.
When an error is passed in as `reason`, the `stack` is copied.
###### Parameters
* `reason` (`string` or `Error`)
— reason for message, uses the stack and message of the error if given
* `place` ([`Node`][node], [`Position`][position], or [`Point`][point],
optional)
— place in file where the message occurred
* `origin` (`string`, optional)
— place in code where the message originates (example:
`'my-package:my-rule'` or `'my-rule'`)
###### Extends
[`Error`][error].
###### Returns
Instance of `VFileMessage`.
###### Fields
* `reason` (`string`)
— reason for message (you should use markdown)
* `fatal` (`boolean | null | undefined`)
— state of problem; `true` marks associated file as no longer processable
(error); `false` necessitates a (potential) change (warning);
`null | undefined` for things that might not need changing (info)
* `line` (`number | null`)
— starting line of error
* `column` (`number | null`)
— starting column of error
* `position` ([`Position | null`][position])
— full unist position
* `source` (`string | null`, example: `'my-package'`)
— namespace of message
* `ruleId` (`string | null`, example: `'my-rule'`)
— category of message
* `stack` (`string | null`)
— stack of message in code
* `file` (`string | null`)
— path of a file (used throughout the `VFile` ecosystem)
### Well-known
Its OK to store custom data directly on the `VFileMessage`, some of those are
handled by [utilities][util].
The following fields are documented and typed here.
###### Fields
* `actual` (`string | null`)
— specify the source value thats being reported, which is deemed incorrect
* `expected` (`Array<string> | null`)
— suggest acceptable values that can be used instead of `actual`
* `url` (`string | null`)
— link to docs for the message (this must be an absolute URL that can be
passed as `x` to `new URL(x)`)
* `note` (`string | null`)
— long form description of the message (you should use markdown)
## Types
This package is fully typed with [TypeScript][].
It exports no additional types.
## Compatibility
Projects maintained by the unified collective are compatible with all maintained
versions of Node.js.
As of now, that is Node.js 14.14+ and 16.0+.
Our projects sometimes work with older versions, but this is not guaranteed.
## Contribute
See [`contributing.md`][contributing] in [`vfile/.github`][health] for ways to
get started.
See [`support.md`][support] for ways to get help.
This project has a [code of conduct][coc].
By interacting with this repository, organization, or community you agree to
abide by its terms.
## License
[MIT][license] © [Titus Wormer][author]
<!-- Definitions -->
[build-badge]: https://github.com/vfile/vfile-message/workflows/main/badge.svg
[build]: https://github.com/vfile/vfile-message/actions
[coverage-badge]: https://img.shields.io/codecov/c/github/vfile/vfile-message.svg
[coverage]: https://codecov.io/github/vfile/vfile-message
[downloads-badge]: https://img.shields.io/npm/dm/vfile-message.svg
[downloads]: https://www.npmjs.com/package/vfile-message
[size-badge]: https://img.shields.io/bundlephobia/minzip/vfile-message.svg
[size]: https://bundlephobia.com/result?p=vfile-message
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
[collective]: https://opencollective.com/unified
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
[chat]: https://github.com/vfile/vfile/discussions
[npm]: https://docs.npmjs.com/cli/install
[contributing]: https://github.com/vfile/.github/blob/main/contributing.md
[support]: https://github.com/vfile/.github/blob/main/support.md
[health]: https://github.com/vfile/.github
[coc]: https://github.com/vfile/.github/blob/main/code-of-conduct.md
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[esmsh]: https://esm.sh
[typescript]: https://www.typescriptlang.org
[license]: license
[author]: https://wooorm.com
[error]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error
[node]: https://github.com/syntax-tree/unist#node
[position]: https://github.com/syntax-tree/unist#position
[point]: https://github.com/syntax-tree/unist#point
[vfile]: https://github.com/vfile/vfile
[util]: https://github.com/vfile/vfile#utilities
[api-vfile-message]: #vfilemessagereason-place-origin