🎉 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

2
node_modules/unist-util-visit/complex-types.d.ts generated vendored Normal file
View file

@ -0,0 +1,2 @@
// To do: next major: remove this file.
export type {Visitor, BuildVisitor} from './index.js'

9
node_modules/unist-util-visit/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,9 @@
export type {Test} from 'unist-util-is'
export type {
Action,
ActionTuple,
Index,
VisitorResult
} from 'unist-util-visit-parents'
export type {Visitor, BuildVisitor} from './lib/index.js'
export {CONTINUE, EXIT, SKIP, visit} from './lib/index.js'

2
node_modules/unist-util-visit/index.js generated vendored Normal file
View file

@ -0,0 +1,2 @@
// Note: types exported from `index.d.ts`
export {CONTINUE, EXIT, SKIP, visit} from './lib/index.js'

137
node_modules/unist-util-visit/lib/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,137 @@
/**
* Visit nodes.
*
* This algorithm performs *depth-first* *tree traversal* in *preorder*
* (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).
*
* You can choose for which nodes `visitor` is called by passing a `test`.
* For complex tests, you should test yourself in `visitor`, as it will be
* faster and will have improved type information.
*
* Walking the tree is an intensive task.
* Make use of the return values of the visitor when possible.
* Instead of walking a tree multiple times, walk it once, use `unist-util-is`
* to check if a node matches, and then perform different operations.
*
* You can change the tree.
* See `Visitor` for more info.
*
* @param tree
* Tree to traverse.
* @param test
* `unist-util-is`-compatible test
* @param visitor
* Handle each node.
* @param reverse
* Traverse in reverse preorder (NRL) instead of the default preorder (NLR).
* @returns
* Nothing.
*/
export const visit: (<
Tree extends import('unist').Node<import('unist').Data>,
Check extends import('unist-util-is/lib/index.js').Test
>(
tree: Tree,
test: Check,
visitor: BuildVisitor<Tree, Check>,
reverse?: boolean | null | undefined
) => void) &
(<Tree_1 extends import('unist').Node<import('unist').Data>>(
tree: Tree_1,
visitor: BuildVisitor<Tree_1, string>,
reverse?: boolean | null | undefined
) => void)
export type Node = import('unist').Node
export type Parent = import('unist').Parent
export type Test = import('unist-util-is').Test
export type VisitorResult = import('unist-util-visit-parents').VisitorResult
/**
* Check if `Child` can be a child of `Ancestor`.
*
* Returns the ancestor when `Child` can be a child of `Ancestor`, or returns
* `never`.
*/
export type ParentsOf<
Ancestor extends import('unist').Node<import('unist').Data>,
Child extends import('unist').Node<import('unist').Data>
> = Ancestor extends Parent
? Child extends Ancestor['children'][number]
? Ancestor
: never
: never
/**
* Handle a node (matching `test`, if given).
*
* Visitors are free to transform `node`.
* They can also transform `parent`.
*
* Replacing `node` itself, if `SKIP` is not returned, still causes its
* descendants to be walked (which is a bug).
*
* When adding or removing previous siblings of `node` (or next siblings, in
* case of reverse), the `Visitor` should return a new `Index` to specify the
* sibling to traverse after `node` is traversed.
* Adding or removing next siblings of `node` (or previous siblings, in case
* of reverse) is handled as expected without needing to return a new `Index`.
*
* Removing the children property of `parent` still results in them being
* traversed.
*/
export type Visitor<
Visited extends import('unist').Node<
import('unist').Data
> = import('unist').Node<import('unist').Data>,
Ancestor extends import('unist').Parent<
import('unist').Node<import('unist').Data>,
import('unist').Data
> = import('unist').Parent<
import('unist').Node<import('unist').Data>,
import('unist').Data
>
> = (
node: Visited,
index: Visited extends Node ? number | null : never,
parent: Ancestor extends Node ? Ancestor | null : never
) => VisitorResult
/**
* Build a typed `Visitor` function from a node and all possible parents.
*
* It will infer which values are passed as `node` and which as `parent`.
*/
export type BuildVisitorFromMatch<
Visited extends import('unist').Node<import('unist').Data>,
Ancestor extends import('unist').Parent<
import('unist').Node<import('unist').Data>,
import('unist').Data
>
> = Visitor<Visited, ParentsOf<Ancestor, Visited>>
/**
* Build a typed `Visitor` function from a list of descendants and a test.
*
* It will infer which values are passed as `node` and which as `parent`.
*/
export type BuildVisitorFromDescendants<
Descendant extends import('unist').Node<import('unist').Data>,
Check extends import('unist-util-is/lib/index.js').Test
> = BuildVisitorFromMatch<
import('unist-util-visit-parents/complex-types.js').Matches<
Descendant,
Check
>,
Extract<Descendant, Parent>
>
/**
* Build a typed `Visitor` function from a tree and a test.
*
* It will infer which values are passed as `node` and which as `parent`.
*/
export type BuildVisitor<
Tree extends import('unist').Node<
import('unist').Data
> = import('unist').Node<import('unist').Data>,
Check extends import('unist-util-is/lib/index.js').Test = string
> = BuildVisitorFromDescendants<
import('unist-util-visit-parents/complex-types.js').InclusiveDescendant<Tree>,
Check
>
export {CONTINUE, EXIT, SKIP} from 'unist-util-visit-parents'

182
node_modules/unist-util-visit/lib/index.js generated vendored Normal file
View file

@ -0,0 +1,182 @@
/**
* @typedef {import('unist').Node} Node
* @typedef {import('unist').Parent} Parent
* @typedef {import('unist-util-is').Test} Test
* @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
*/
/**
* Check if `Child` can be a child of `Ancestor`.
*
* Returns the ancestor when `Child` can be a child of `Ancestor`, or returns
* `never`.
*
* @template {Node} Ancestor
* Node type.
* @template {Node} Child
* Node type.
* @typedef {(
* Ancestor extends Parent
* ? Child extends Ancestor['children'][number]
* ? Ancestor
* : never
* : never
* )} ParentsOf
*/
/**
* @template {Node} [Visited=Node]
* Visited node type.
* @template {Parent} [Ancestor=Parent]
* Ancestor type.
* @callback Visitor
* Handle a node (matching `test`, if given).
*
* Visitors are free to transform `node`.
* They can also transform `parent`.
*
* Replacing `node` itself, if `SKIP` is not returned, still causes its
* descendants to be walked (which is a bug).
*
* When adding or removing previous siblings of `node` (or next siblings, in
* case of reverse), the `Visitor` should return a new `Index` to specify the
* sibling to traverse after `node` is traversed.
* Adding or removing next siblings of `node` (or previous siblings, in case
* of reverse) is handled as expected without needing to return a new `Index`.
*
* Removing the children property of `parent` still results in them being
* traversed.
* @param {Visited} node
* Found node.
* @param {Visited extends Node ? number | null : never} index
* Index of `node` in `parent`.
* @param {Ancestor extends Node ? Ancestor | null : never} parent
* Parent of `node`.
* @returns {VisitorResult}
* What to do next.
*
* An `Index` is treated as a tuple of `[CONTINUE, Index]`.
* An `Action` is treated as a tuple of `[Action]`.
*
* Passing a tuple back only makes sense if the `Action` is `SKIP`.
* When the `Action` is `EXIT`, that action can be returned.
* When the `Action` is `CONTINUE`, `Index` can be returned.
*/
/**
* Build a typed `Visitor` function from a node and all possible parents.
*
* It will infer which values are passed as `node` and which as `parent`.
*
* @template {Node} Visited
* Node type.
* @template {Parent} Ancestor
* Parent type.
* @typedef {Visitor<Visited, ParentsOf<Ancestor, Visited>>} BuildVisitorFromMatch
*/
/**
* Build a typed `Visitor` function from a list of descendants and a test.
*
* It will infer which values are passed as `node` and which as `parent`.
*
* @template {Node} Descendant
* Node type.
* @template {Test} Check
* Test type.
* @typedef {(
* BuildVisitorFromMatch<
* import('unist-util-visit-parents/complex-types.js').Matches<Descendant, Check>,
* Extract<Descendant, Parent>
* >
* )} BuildVisitorFromDescendants
*/
/**
* Build a typed `Visitor` function from a tree and a test.
*
* It will infer which values are passed as `node` and which as `parent`.
*
* @template {Node} [Tree=Node]
* Node type.
* @template {Test} [Check=string]
* Test type.
* @typedef {(
* BuildVisitorFromDescendants<
* import('unist-util-visit-parents/complex-types.js').InclusiveDescendant<Tree>,
* Check
* >
* )} BuildVisitor
*/
import {visitParents} from 'unist-util-visit-parents'
/**
* Visit nodes.
*
* This algorithm performs *depth-first* *tree traversal* in *preorder*
* (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).
*
* You can choose for which nodes `visitor` is called by passing a `test`.
* For complex tests, you should test yourself in `visitor`, as it will be
* faster and will have improved type information.
*
* Walking the tree is an intensive task.
* Make use of the return values of the visitor when possible.
* Instead of walking a tree multiple times, walk it once, use `unist-util-is`
* to check if a node matches, and then perform different operations.
*
* You can change the tree.
* See `Visitor` for more info.
*
* @param tree
* Tree to traverse.
* @param test
* `unist-util-is`-compatible test
* @param visitor
* Handle each node.
* @param reverse
* Traverse in reverse preorder (NRL) instead of the default preorder (NLR).
* @returns
* Nothing.
*/
export const visit =
/**
* @type {(
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: BuildVisitor<Tree, Check>, reverse?: boolean | null | undefined) => void) &
* (<Tree extends Node>(tree: Tree, visitor: BuildVisitor<Tree>, reverse?: boolean | null | undefined) => void)
* )}
*/
(
/**
* @param {Node} tree
* @param {Test} test
* @param {Visitor} visitor
* @param {boolean | null | undefined} [reverse]
* @returns {void}
*/
function (tree, test, visitor, reverse) {
if (typeof test === 'function' && typeof visitor !== 'function') {
reverse = visitor
visitor = test
test = null
}
visitParents(tree, test, overload, reverse)
/**
* @param {Node} node
* @param {Array<Parent>} parents
*/
function overload(node, parents) {
const parent = parents[parents.length - 1]
return visitor(
node,
parent ? parent.children.indexOf(node) : null,
parent
)
}
}
)
export {CONTINUE, EXIT, SKIP} from 'unist-util-visit-parents'

22
node_modules/unist-util-visit/license generated vendored Normal file
View file

@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2015 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.

103
node_modules/unist-util-visit/package.json generated vendored Normal file
View file

@ -0,0 +1,103 @@
{
"name": "unist-util-visit",
"version": "4.1.2",
"description": "unist utility to visit nodes",
"license": "MIT",
"keywords": [
"unist",
"unist-util",
"util",
"utility",
"remark",
"retext",
"rehype",
"mdast",
"hast",
"xast",
"nlcst",
"natural",
"language",
"markdown",
"html",
"xml",
"tree",
"ast",
"node",
"visit",
"walk"
],
"repository": "syntax-tree/unist-util-visit",
"bugs": "https://github.com/syntax-tree/unist-util-visit/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)",
"Eugene Sharygin <eush77@gmail.com>",
"Richard Gibson <richard.gibson@gmail.com>"
],
"sideEffects": false,
"type": "module",
"main": "index.js",
"types": "index.d.ts",
"files": [
"lib/",
"complex-types.d.ts",
"index.d.ts",
"index.js"
],
"dependencies": {
"@types/unist": "^2.0.0",
"unist-util-is": "^5.0.0",
"unist-util-visit-parents": "^5.1.1"
},
"devDependencies": {
"@types/node": "^18.0.0",
"c8": "^7.0.0",
"mdast-util-from-markdown": "^1.0.0",
"mdast-util-gfm": "^2.0.0",
"micromark-extension-gfm": "^2.0.0",
"prettier": "^2.0.0",
"remark-cli": "^11.0.0",
"remark-preset-wooorm": "^9.0.0",
"tsd": "^0.25.0",
"type-coverage": "^2.0.0",
"typescript": "^4.7.0",
"xo": "^0.53.0"
},
"scripts": {
"prepack": "npm run build && npm run format",
"build": "tsc --build --clean && tsc --build && tsd && 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,
"rules": {
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/array-type": "off"
}
},
"remarkConfig": {
"plugins": [
"remark-preset-wooorm"
]
},
"typeCoverage": {
"atLeast": 100,
"detail": true,
"strict": true
}
}

318
node_modules/unist-util-visit/readme.md generated vendored Normal file
View file

@ -0,0 +1,318 @@
# unist-util-visit
[![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]
[unist][] utility to walk the tree.
## Contents
* [What is this?](#what-is-this)
* [When should I use this?](#when-should-i-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`visit(tree[, test], visitor[, reverse])`](#visittree-test-visitor-reverse)
* [`CONTINUE`](#continue)
* [`EXIT`](#exit)
* [`SKIP`](#skip)
* [`Action`](#action)
* [`ActionTuple`](#actiontuple)
* [`BuildVisitor`](#buildvisitor)
* [`Index`](#index)
* [`Test`](#test)
* [`Visitor`](#visitor)
* [`VisitorResult`](#visitorresult)
* [Types](#types)
* [Compatibility](#compatibility)
* [Related](#related)
* [Contribute](#contribute)
* [License](#license)
## What is this?
This is a very important utility for working with unist as it lets you walk the
tree.
## When should I use this?
You can use this utility when you want to walk the tree.
You can use [`unist-util-visit-parents`][vp] if you care about the entire stack
of parents.
## Install
This package is [ESM only][esm].
In Node.js (version 14.14+ and 16.0+), install with [npm][]:
```sh
npm install unist-util-visit
```
In Deno with [`esm.sh`][esmsh]:
```js
import {visit} from 'https://esm.sh/unist-util-visit@4'
```
In browsers with [`esm.sh`][esmsh]:
```html
<script type="module">
import {visit} from 'https://esm.sh/unist-util-visit@4?bundle'
</script>
```
## Use
```js
import {u} from 'unist-builder'
import {visit} from 'unist-util-visit'
const tree = u('tree', [
u('leaf', '1'),
u('node', [u('leaf', '2')]),
u('void'),
u('leaf', '3')
])
visit(tree, 'leaf', (node) => {
console.log(node)
})
```
Yields:
```js
{type: 'leaf', value: '1'}
{type: 'leaf', value: '2'}
{type: 'leaf', value: '3'}
```
## API
This package exports the identifiers [`CONTINUE`][api-continue],
[`EXIT`][api-exit], [`SKIP`][api-skip], and [`visit`][api-visit].
There is no default export.
### `visit(tree[, test], visitor[, reverse])`
This function works exactly the same as [`unist-util-visit-parents`][vp],
but [`Visitor`][api-visitor] has a different signature.
### `CONTINUE`
Continue traversing as normal (`true`).
### `EXIT`
Stop traversing immediately (`false`).
### `SKIP`
Do not traverse this nodes children (`'skip'`).
### `Action`
Union of the action types (TypeScript type).
See [`Action` in `unist-util-visit-parents`][vp-action].
### `ActionTuple`
List with an action and an index (TypeScript type).
See [`ActionTuple` in `unist-util-visit-parents`][vp-actiontuple].
### `BuildVisitor`
Build a typed `Visitor` function from a tree and a test (TypeScript type).
See [`BuildVisitor` in `unist-util-visit-parents`][vp-buildvisitor].
### `Index`
Move to the sibling at `index` next (TypeScript type).
See [`Index` in `unist-util-visit-parents`][vp-index].
### `Test`
[`unist-util-is`][unist-util-is] compatible test (TypeScript type).
### `Visitor`
Handle a node (matching `test`, if given) (TypeScript type).
Visitors are free to transform `node`.
They can also transform `parent`.
Replacing `node` itself, if `SKIP` is not returned, still causes its
descendants to be walked (which is a bug).
When adding or removing previous siblings of `node` (or next siblings, in
case of reverse), the `Visitor` should return a new `Index` to specify the
sibling to traverse after `node` is traversed.
Adding or removing next siblings of `node` (or previous siblings, in case
of reverse) is handled as expected without needing to return a new `Index`.
Removing the children property of `parent` still results in them being
traversed.
###### Parameters
* `node` ([`Node`][node])
— found node
* `index` (`number` or `null`)
— index of `node` in `parent`
* `parent` ([`Node`][node] or `null`)
— parent of `node`
###### Returns
What to do next.
An `Index` is treated as a tuple of `[CONTINUE, Index]`.
An `Action` is treated as a tuple of `[Action]`.
Passing a tuple back only makes sense if the `Action` is `SKIP`.
When the `Action` is `EXIT`, that action can be returned.
When the `Action` is `CONTINUE`, `Index` can be returned.
### `VisitorResult`
Any value that can be returned from a visitor (TypeScript type).
See [`VisitorResult` in `unist-util-visit-parents`][vp-visitorresult].
## Types
This package is fully typed with [TypeScript][].
It exports the additional types [`Action`][api-action],
[`ActionTuple`][api-actiontuple], [`BuildVisitor`][api-buildvisitor],
[`Index`][api-index], [`Test`][api-test], [`Visitor`][api-visitor], and
[`VisitorResult`][api-visitorresult].
## Compatibility
Projects maintained by the unified collective are compatible with all maintained
versions of Node.js.
As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
Our projects sometimes work with older versions, but this is not guaranteed.
## Related
* [`unist-util-visit-parents`][vp]
— walk the tree with a stack of parents
* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter)
— create a new tree with all nodes that pass a test
* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map)
— create a new tree with all nodes mapped by a given function
* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap)
— create a new tree by mapping (to an array) with the given function
* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove)
— remove nodes from a tree that pass a test
* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select)
— select nodes with CSS-like selectors
## Contribute
See [`contributing.md`][contributing] in [`syntax-tree/.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]
<!-- Definition -->
[build-badge]: https://github.com/syntax-tree/unist-util-visit/workflows/main/badge.svg
[build]: https://github.com/syntax-tree/unist-util-visit/actions
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg
[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit
[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit.svg
[downloads]: https://www.npmjs.com/package/unist-util-visit
[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit.svg
[size]: https://bundlephobia.com/result?p=unist-util-visit
[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/syntax-tree/unist/discussions
[npm]: https://docs.npmjs.com/cli/install
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[esmsh]: https://esm.sh
[typescript]: https://www.typescriptlang.org
[license]: license
[author]: https://wooorm.com
[health]: https://github.com/syntax-tree/.github
[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md
[support]: https://github.com/syntax-tree/.github/blob/main/support.md
[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
[unist]: https://github.com/syntax-tree/unist
[node]: https://github.com/syntax-tree/unist#nodes
[unist-util-is]: https://github.com/syntax-tree/unist-util-is
[vp]: https://github.com/syntax-tree/unist-util-visit-parents
[vp-action]: https://github.com/syntax-tree/unist-util-visit-parents#action
[vp-actiontuple]: https://github.com/syntax-tree/unist-util-visit-parents#actiontuple
[vp-buildvisitor]: https://github.com/syntax-tree/unist-util-visit-parents#buildvisitor
[vp-index]: https://github.com/syntax-tree/unist-util-visit-parents#index
[vp-visitorresult]: https://github.com/syntax-tree/unist-util-visit-parents#visitorresult
[api-visit]: #visittree-test-visitor-reverse
[api-continue]: #continue
[api-exit]: #exit
[api-skip]: #skip
[api-action]: #action
[api-actiontuple]: #actiontuple
[api-buildvisitor]: #buildvisitor
[api-index]: #index
[api-test]: #test
[api-visitor]: #visitor
[api-visitorresult]: #visitorresult