feat: complete MDX migration, stabilize routing and lead capture
Former-commit-id: ab5cc38c97e5f73d6e821465b90d199fb6e6edc9
This commit is contained in:
1
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/@types/unist
generated
vendored
Symbolic link
1
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/@types/unist
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../@types+unist@2.0.11/node_modules/@types/unist
|
||||
1
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/unist-util-is
generated
vendored
Symbolic link
1
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/unist-util-is
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../../unist-util-is@5.2.1/node_modules/unist-util-is
|
||||
3
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/unist-util-remove/index.d.ts
generated
vendored
Normal file
3
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/unist-util-remove/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export {remove} from './lib/index.js'
|
||||
export type Options = import('./lib/index.js').Options
|
||||
export type RemoveOptions = Options
|
||||
10
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/unist-util-remove/index.js
generated
vendored
Normal file
10
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/unist-util-remove/index.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @typedef {import('./lib/index.js').Options} Options
|
||||
*/
|
||||
|
||||
// To do: next major: remove.
|
||||
/**
|
||||
* @typedef {Options} RemoveOptions
|
||||
*/
|
||||
|
||||
export {remove} from './lib/index.js'
|
||||
40
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/unist-util-remove/lib/index.d.ts
generated
vendored
Normal file
40
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/unist-util-remove/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Change the given `tree` by removing all nodes that pass `test`.
|
||||
*
|
||||
* The tree is walked in preorder (NLR), visiting the node itself, then its
|
||||
* head, etc.
|
||||
*
|
||||
* @param tree
|
||||
* Tree to change.
|
||||
* @param options
|
||||
* Configuration (optional).
|
||||
* @param test
|
||||
* `unist-util-is` compatible test.
|
||||
* @returns
|
||||
* The given `tree` without nodes that pass `test`.
|
||||
*
|
||||
* `null` is returned if `tree` itself didn’t pass the test or is cascaded
|
||||
* away.
|
||||
*/
|
||||
export const remove: (<Tree extends import('unist').Node<import('unist').Data>>(
|
||||
node: Tree,
|
||||
options: Options,
|
||||
test: Test
|
||||
) => Tree | null) &
|
||||
(<Tree_1 extends import('unist').Node<import('unist').Data>>(
|
||||
node: Tree_1,
|
||||
test: Test
|
||||
) => Tree_1 | null)
|
||||
export type Node = import('unist').Node
|
||||
export type Parent = import('unist').Parent
|
||||
export type Test = import('unist-util-is').Test
|
||||
/**
|
||||
* Configuration.
|
||||
*/
|
||||
export type Options = {
|
||||
/**
|
||||
* Whether to drop parent nodes if they had children, but all their children
|
||||
* were filtered out.
|
||||
*/
|
||||
cascade?: boolean | null | undefined
|
||||
}
|
||||
101
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/unist-util-remove/lib/index.js
generated
vendored
Normal file
101
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/unist-util-remove/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* @typedef {import('unist').Node} Node
|
||||
* @typedef {import('unist').Parent} Parent
|
||||
* @typedef {import('unist-util-is').Test} Test
|
||||
*
|
||||
* @typedef Options
|
||||
* Configuration.
|
||||
* @property {boolean | null | undefined} [cascade=true]
|
||||
* Whether to drop parent nodes if they had children, but all their children
|
||||
* were filtered out.
|
||||
*/
|
||||
|
||||
import {convert} from 'unist-util-is'
|
||||
|
||||
/** @type {Array<unknown>} */
|
||||
const empty = []
|
||||
|
||||
/**
|
||||
* Change the given `tree` by removing all nodes that pass `test`.
|
||||
*
|
||||
* The tree is walked in preorder (NLR), visiting the node itself, then its
|
||||
* head, etc.
|
||||
*
|
||||
* @param tree
|
||||
* Tree to change.
|
||||
* @param options
|
||||
* Configuration (optional).
|
||||
* @param test
|
||||
* `unist-util-is` compatible test.
|
||||
* @returns
|
||||
* The given `tree` without nodes that pass `test`.
|
||||
*
|
||||
* `null` is returned if `tree` itself didn’t pass the test or is cascaded
|
||||
* away.
|
||||
*/
|
||||
// To do: next major: don’t return `tree`.
|
||||
export const remove =
|
||||
/**
|
||||
* @type {(
|
||||
* (<Tree extends Node>(node: Tree, options: Options, test: Test) => Tree | null) &
|
||||
* (<Tree extends Node>(node: Tree, test: Test) => Tree | null)
|
||||
* )}
|
||||
*/
|
||||
(
|
||||
/**
|
||||
* @param {Node} tree
|
||||
* @param {Options | null | undefined} [options]
|
||||
* @param {Test | null | undefined} [test]
|
||||
* @returns {Node | null}
|
||||
*/
|
||||
function (tree, options, test) {
|
||||
const is = convert(test || options)
|
||||
const cascade =
|
||||
!options || options.cascade === undefined || options.cascade === null
|
||||
? true
|
||||
: options.cascade
|
||||
|
||||
return preorder(tree)
|
||||
|
||||
/**
|
||||
* Check and remove nodes recursively in preorder.
|
||||
* For each composite node, modify its children array in-place.
|
||||
*
|
||||
* @param {Node} node
|
||||
* @param {number | null | undefined} [index]
|
||||
* @param {Parent | null | undefined} [parent]
|
||||
* @returns {Node | null}
|
||||
*/
|
||||
function preorder(node, index, parent) {
|
||||
/** @type {Array<Node>} */
|
||||
// @ts-expect-error looks like a parent.
|
||||
const children = node.children || empty
|
||||
let childIndex = -1
|
||||
let position = 0
|
||||
|
||||
if (is(node, index, parent)) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (children.length > 0) {
|
||||
// Move all living children to the beginning of the children array.
|
||||
while (++childIndex < children.length) {
|
||||
// @ts-expect-error looks like a parent.
|
||||
if (preorder(children[childIndex], childIndex, node)) {
|
||||
children[position++] = children[childIndex]
|
||||
}
|
||||
}
|
||||
|
||||
// Cascade delete.
|
||||
if (cascade && !position) {
|
||||
return null
|
||||
}
|
||||
|
||||
// Drop other nodes.
|
||||
children.length = position
|
||||
}
|
||||
|
||||
return node
|
||||
}
|
||||
}
|
||||
)
|
||||
21
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/unist-util-remove/license
generated
vendored
Normal file
21
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/unist-util-remove/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Eugene Sharygin
|
||||
|
||||
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.
|
||||
86
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/unist-util-remove/package.json
generated
vendored
Normal file
86
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/unist-util-remove/package.json
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"name": "unist-util-remove",
|
||||
"version": "3.1.1",
|
||||
"description": "unist utility to remove nodes from a tree",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"unist",
|
||||
"unist-util",
|
||||
"util",
|
||||
"utility",
|
||||
"ast",
|
||||
"tree",
|
||||
"node",
|
||||
"cascade",
|
||||
"delete",
|
||||
"mutable",
|
||||
"remove",
|
||||
"squeeze",
|
||||
"strip"
|
||||
],
|
||||
"repository": "syntax-tree/unist-util-remove",
|
||||
"bugs": "https://github.com/syntax-tree/unist-util-remove/issues",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
},
|
||||
"author": "Eugene Sharygin <eush77@gmail.com>",
|
||||
"contributors": [
|
||||
"Eugene Sharygin <eush77@gmail.com>",
|
||||
"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-is": "^5.0.0",
|
||||
"unist-util-visit-parents": "^5.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",
|
||||
"unist-builder": "^3.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
|
||||
}
|
||||
}
|
||||
246
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/unist-util-remove/readme.md
generated
vendored
Normal file
246
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/unist-util-remove/readme.md
generated
vendored
Normal file
@@ -0,0 +1,246 @@
|
||||
# unist-util-remove
|
||||
|
||||
[![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 remove all nodes that pass a test from 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)
|
||||
* [`remove(tree[, options], test)`](#removetree-options-test)
|
||||
* [`Options`](#options)
|
||||
* [Types](#types)
|
||||
* [Compatibility](#compatibility)
|
||||
* [Related](#related)
|
||||
* [Contribute](#contribute)
|
||||
* [License](#license)
|
||||
|
||||
## What is this?
|
||||
|
||||
This is a small utility that helps you clean a tree by removing some stuff.
|
||||
|
||||
## When should I use this?
|
||||
|
||||
You can use this utility to remove things from a tree.
|
||||
This utility is very similar to [`unist-util-filter`][unist-util-filter], which
|
||||
creates a new tree.
|
||||
Modifying a tree like this utility `unist-util-remove` does is much faster on
|
||||
larger documents though.
|
||||
|
||||
You can also walk the tree with [`unist-util-visit`][unist-util-visit] to remove
|
||||
nodes.
|
||||
To create trees, use [`unist-builder`][unist-builder].
|
||||
|
||||
## Install
|
||||
|
||||
This package is [ESM only][esm].
|
||||
In Node.js (version 14.14+ and 16.0+), install with [npm][]:
|
||||
|
||||
```sh
|
||||
npm install unist-util-remove
|
||||
```
|
||||
|
||||
In Deno with [`esm.sh`][esmsh]:
|
||||
|
||||
```js
|
||||
import {remove} from 'https://esm.sh/unist-util-remove@3'
|
||||
```
|
||||
|
||||
In browsers with [`esm.sh`][esmsh]:
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import {remove} from 'https://esm.sh/unist-util-remove@3?bundle'
|
||||
</script>
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```js
|
||||
import {u} from 'unist-builder'
|
||||
import {remove} from 'unist-util-remove'
|
||||
|
||||
const tree = u('root', [
|
||||
u('leaf', '1'),
|
||||
u('parent', [
|
||||
u('leaf', '2'),
|
||||
u('parent', [u('leaf', '3'), u('other', '4')]),
|
||||
u('parent', [u('leaf', '5')])
|
||||
]),
|
||||
u('leaf', '6')
|
||||
])
|
||||
|
||||
// Remove all nodes of type `leaf`.
|
||||
remove(tree, 'leaf')
|
||||
|
||||
console.dir(tree, {depth: null})
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'root',
|
||||
children: [
|
||||
{
|
||||
type: 'parent',
|
||||
children: [{type: 'parent', children: [{type: 'other', value: '4'}]}]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
> 👉 **Note**: the parent of leaf `5` is also removed, `options.cascade` can
|
||||
> change that.
|
||||
|
||||
## API
|
||||
|
||||
This package exports the identifier [`remove`][api-remove].
|
||||
There is no default export.
|
||||
|
||||
### `remove(tree[, options], test)`
|
||||
|
||||
Change the given `tree` by removing all nodes that pass `test`.
|
||||
|
||||
The tree is walked in *[preorder][]* (NLR), visiting the node itself, then its
|
||||
head, etc.
|
||||
|
||||
###### Parameters
|
||||
|
||||
* `tree` ([`Node`][node])
|
||||
— tree to change
|
||||
* `options` ([`Options`][api-options], optional)
|
||||
— configuration
|
||||
* `test` ([`Test`][test], optional)
|
||||
— `unist-util-is` compatible test
|
||||
|
||||
###### Returns
|
||||
|
||||
A changed given `tree`, without nodes that pass `test`.
|
||||
|
||||
`null` is returned if `tree` itself didn’t pass the test or is cascaded away.
|
||||
|
||||
### `Options`
|
||||
|
||||
Configuration (TypeScript type).
|
||||
|
||||
###### Fields
|
||||
|
||||
* `cascade` (`boolean`, default: `true`)
|
||||
— whether to drop parent nodes if they had children, but all their children
|
||||
were filtered out
|
||||
|
||||
## Types
|
||||
|
||||
This package is fully typed with [TypeScript][].
|
||||
It exports the additional type [`Options`][api-options].
|
||||
|
||||
## 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-filter`](https://github.com/syntax-tree/unist-util-filter)
|
||||
— create a new tree with all nodes that pass the given function
|
||||
* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap)
|
||||
— create a new tree by expanding a node into many
|
||||
* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map)
|
||||
— create a new tree by mapping nodes
|
||||
* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select)
|
||||
— select nodes with CSS-like selectors
|
||||
* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit)
|
||||
— walk the tree
|
||||
* [`unist-builder`](https://github.com/syntax-tree/unist-builder)
|
||||
— create trees
|
||||
|
||||
## 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, organisation, or community you agree to
|
||||
abide by its terms.
|
||||
|
||||
## License
|
||||
|
||||
[MIT][license] © Eugene Sharygin
|
||||
|
||||
<!-- Definitions -->
|
||||
|
||||
[build-badge]: https://github.com/syntax-tree/unist-util-filter/workflows/main/badge.svg
|
||||
|
||||
[build]: https://github.com/syntax-tree/unist-util-filter/actions
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-filter.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/syntax-tree/unist-util-filter
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/unist-util-filter.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/unist-util-filter
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-filter.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=unist-util-filter
|
||||
|
||||
[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
|
||||
|
||||
[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#node
|
||||
|
||||
[preorder]: https://github.com/syntax-tree/unist#preorder
|
||||
|
||||
[test]: https://github.com/syntax-tree/unist-util-is#test
|
||||
|
||||
[unist-util-filter]: https://github.com/syntax-tree/unist-util-filter
|
||||
|
||||
[unist-util-visit]: https://github.com/syntax-tree/unist-util-visit
|
||||
|
||||
[unist-builder]: https://github.com/syntax-tree/unist-builder
|
||||
|
||||
[api-remove]: #removetree-options-test
|
||||
|
||||
[api-options]: #options
|
||||
1
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/unist-util-visit-parents
generated
vendored
Symbolic link
1
node_modules/.pnpm/unist-util-remove@3.1.1/node_modules/unist-util-visit-parents
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../../unist-util-visit-parents@5.1.3/node_modules/unist-util-visit-parents
|
||||
Reference in New Issue
Block a user