This commit is contained in:
21
node_modules/react-markdown/license
generated
vendored
Normal file
21
node_modules/react-markdown/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Espen Hovlandsdal
|
||||
|
||||
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.
|
||||
9
node_modules/react-markdown/node_modules/bail/index.js
generated
vendored
Normal file
9
node_modules/react-markdown/node_modules/bail/index.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = bail
|
||||
|
||||
function bail(err) {
|
||||
if (err) {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
22
node_modules/react-markdown/node_modules/bail/license
generated
vendored
Normal file
22
node_modules/react-markdown/node_modules/bail/license
generated
vendored
Normal 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.
|
||||
72
node_modules/react-markdown/node_modules/bail/package.json
generated
vendored
Normal file
72
node_modules/react-markdown/node_modules/bail/package.json
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"name": "bail",
|
||||
"version": "1.0.5",
|
||||
"description": "Throw a given error",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"fail",
|
||||
"bail",
|
||||
"throw",
|
||||
"callback",
|
||||
"error"
|
||||
],
|
||||
"repository": "wooorm/bail",
|
||||
"bugs": "https://github.com/wooorm/bail/issues",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wooorm"
|
||||
},
|
||||
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
||||
"contributors": [
|
||||
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
||||
],
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"browserify": "^16.0.0",
|
||||
"nyc": "^15.0.0",
|
||||
"prettier": "^1.0.0",
|
||||
"remark-cli": "^7.0.0",
|
||||
"remark-preset-wooorm": "^6.0.0",
|
||||
"tape": "^4.0.0",
|
||||
"tinyify": "^2.0.0",
|
||||
"xo": "^0.25.0"
|
||||
},
|
||||
"scripts": {
|
||||
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
|
||||
"build-bundle": "browserify index.js -s bail -o bail.js",
|
||||
"build-mangle": "browserify index.js -s bail -p tinyify -o bail.min.js",
|
||||
"build": "npm run build-bundle && npm run build-mangle",
|
||||
"test-api": "node test",
|
||||
"test-coverage": "nyc --reporter lcov tape test.js",
|
||||
"test": "npm run format && npm run build && npm run test-coverage"
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false,
|
||||
"ignores": [
|
||||
"bail.js"
|
||||
]
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
},
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
"lines": 100,
|
||||
"functions": 100,
|
||||
"branches": 100
|
||||
}
|
||||
}
|
||||
84
node_modules/react-markdown/node_modules/bail/readme.md
generated
vendored
Normal file
84
node_modules/react-markdown/node_modules/bail/readme.md
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
# bail
|
||||
|
||||
[![Build][build-badge]][build]
|
||||
[![Coverage][coverage-badge]][coverage]
|
||||
[![Downloads][downloads-badge]][downloads]
|
||||
[![Size][size-badge]][size]
|
||||
|
||||
:warning: Throw a given error.
|
||||
|
||||
## Install
|
||||
|
||||
[npm][]:
|
||||
|
||||
```sh
|
||||
npm install bail
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```js
|
||||
var bail = require('bail')
|
||||
|
||||
bail()
|
||||
|
||||
bail(new Error('failure'))
|
||||
// Error: failure
|
||||
// at repl:1:6
|
||||
// at REPLServer.defaultEval (repl.js:154:27)
|
||||
// …
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `bail([err])`
|
||||
|
||||
Throw a given error.
|
||||
|
||||
###### Parameters
|
||||
|
||||
* `err` (`Error?`) — Optional error.
|
||||
|
||||
###### Throws
|
||||
|
||||
* `Error` — Given error, if any.
|
||||
|
||||
## Related
|
||||
|
||||
* [`noop`][noop]
|
||||
* [`noop2`][noop2]
|
||||
* [`noop3`][noop3]
|
||||
|
||||
## License
|
||||
|
||||
[MIT][license] © [Titus Wormer][author]
|
||||
|
||||
<!-- Definitions -->
|
||||
|
||||
[build-badge]: https://img.shields.io/travis/wooorm/bail.svg
|
||||
|
||||
[build]: https://travis-ci.org/wooorm/bail
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/bail.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/wooorm/bail
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/bail.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/bail
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/bail.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=bail
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[noop]: https://www.npmjs.com/package/noop
|
||||
|
||||
[noop2]: https://www.npmjs.com/package/noop2
|
||||
|
||||
[noop3]: https://www.npmjs.com/package/noop3
|
||||
29
node_modules/react-markdown/node_modules/is-plain-obj/index.d.ts
generated
vendored
Normal file
29
node_modules/react-markdown/node_modules/is-plain-obj/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
Check if a value is a plain object.
|
||||
|
||||
An object is plain if it's created by either `{}`, `new Object()`, or `Object.create(null)`.
|
||||
|
||||
@example
|
||||
```
|
||||
import isPlainObject = require('is-plain-obj');
|
||||
|
||||
isPlainObject({foo: 'bar'});
|
||||
//=> true
|
||||
|
||||
isPlainObject(new Object());
|
||||
//=> true
|
||||
|
||||
isPlainObject(Object.create(null));
|
||||
//=> true
|
||||
|
||||
isPlainObject([1, 2, 3]);
|
||||
//=> false
|
||||
|
||||
class Unicorn {}
|
||||
isPlainObject(new Unicorn());
|
||||
//=> false
|
||||
```
|
||||
*/
|
||||
declare function isPlainObj(value: unknown): value is object;
|
||||
|
||||
export = isPlainObj;
|
||||
10
node_modules/react-markdown/node_modules/is-plain-obj/index.js
generated
vendored
Normal file
10
node_modules/react-markdown/node_modules/is-plain-obj/index.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = value => {
|
||||
if (Object.prototype.toString.call(value) !== '[object Object]') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const prototype = Object.getPrototypeOf(value);
|
||||
return prototype === null || prototype === Object.prototype;
|
||||
};
|
||||
9
node_modules/react-markdown/node_modules/is-plain-obj/license
generated
vendored
Normal file
9
node_modules/react-markdown/node_modules/is-plain-obj/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
||||
38
node_modules/react-markdown/node_modules/is-plain-obj/package.json
generated
vendored
Normal file
38
node_modules/react-markdown/node_modules/is-plain-obj/package.json
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "is-plain-obj",
|
||||
"version": "2.1.0",
|
||||
"description": "Check if a value is a plain object",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/is-plain-obj",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"object",
|
||||
"is",
|
||||
"check",
|
||||
"test",
|
||||
"type",
|
||||
"plain",
|
||||
"vanilla",
|
||||
"pure",
|
||||
"simple"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
54
node_modules/react-markdown/node_modules/is-plain-obj/readme.md
generated
vendored
Normal file
54
node_modules/react-markdown/node_modules/is-plain-obj/readme.md
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
# is-plain-obj [](https://travis-ci.org/sindresorhus/is-plain-obj)
|
||||
|
||||
> Check if a value is a plain object
|
||||
|
||||
An object is plain if it's created by either `{}`, `new Object()`, or `Object.create(null)`.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install is-plain-obj
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const isPlainObject = require('is-plain-obj');
|
||||
|
||||
isPlainObject({foo: 'bar'});
|
||||
//=> true
|
||||
|
||||
isPlainObject(new Object());
|
||||
//=> true
|
||||
|
||||
isPlainObject(Object.create(null));
|
||||
//=> true
|
||||
|
||||
isPlainObject([1, 2, 3]);
|
||||
//=> false
|
||||
|
||||
class Unicorn {}
|
||||
isPlainObject(new Unicorn());
|
||||
//=> false
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [is-obj](https://github.com/sindresorhus/is-obj) - Check if a value is an object
|
||||
- [is](https://github.com/sindresorhus/is) - Type check values
|
||||
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-is-plain-obj?utm_source=npm-is-plain-obj&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
47
node_modules/react-markdown/node_modules/mdast-util-definitions/index.js
generated
vendored
Normal file
47
node_modules/react-markdown/node_modules/mdast-util-definitions/index.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
'use strict'
|
||||
|
||||
var visit = require('unist-util-visit')
|
||||
|
||||
module.exports = getDefinitionFactory
|
||||
|
||||
var own = {}.hasOwnProperty
|
||||
|
||||
// Get a definition in `node` by `identifier`.
|
||||
function getDefinitionFactory(node, options) {
|
||||
return getterFactory(gather(node, options))
|
||||
}
|
||||
|
||||
// Gather all definitions in `node`
|
||||
function gather(node) {
|
||||
var cache = {}
|
||||
|
||||
if (!node || !node.type) {
|
||||
throw new Error('mdast-util-definitions expected node')
|
||||
}
|
||||
|
||||
visit(node, 'definition', ondefinition)
|
||||
|
||||
return cache
|
||||
|
||||
function ondefinition(definition) {
|
||||
var id = normalise(definition.identifier)
|
||||
if (!own.call(cache, id)) {
|
||||
cache[id] = definition
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Factory to get a node from the given definition-cache.
|
||||
function getterFactory(cache) {
|
||||
return getter
|
||||
|
||||
// Get a node from the bound definition-cache.
|
||||
function getter(identifier) {
|
||||
var id = identifier && normalise(identifier)
|
||||
return id && own.call(cache, id) ? cache[id] : null
|
||||
}
|
||||
}
|
||||
|
||||
function normalise(identifier) {
|
||||
return identifier.toUpperCase()
|
||||
}
|
||||
22
node_modules/react-markdown/node_modules/mdast-util-definitions/license
generated
vendored
Normal file
22
node_modules/react-markdown/node_modules/mdast-util-definitions/license
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2015-2016 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.
|
||||
87
node_modules/react-markdown/node_modules/mdast-util-definitions/package.json
generated
vendored
Normal file
87
node_modules/react-markdown/node_modules/mdast-util-definitions/package.json
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"name": "mdast-util-definitions",
|
||||
"version": "4.0.0",
|
||||
"description": "mdast utility to find definition nodes in a tree",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"unist",
|
||||
"mdast",
|
||||
"mdast-util",
|
||||
"util",
|
||||
"utility",
|
||||
"markdown",
|
||||
"tree",
|
||||
"node",
|
||||
"definition",
|
||||
"find",
|
||||
"cache"
|
||||
],
|
||||
"repository": "syntax-tree/mdast-util-definitions",
|
||||
"bugs": "https://github.com/syntax-tree/mdast-util-definitions/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)"
|
||||
],
|
||||
"types": "types/index.d.ts",
|
||||
"files": [
|
||||
"types",
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"unist-util-visit": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mdast": "^3.0.0",
|
||||
"browserify": "^16.0.0",
|
||||
"dtslint": "^4.0.0",
|
||||
"nyc": "^15.0.0",
|
||||
"prettier": "^2.0.0",
|
||||
"remark": "^12.0.0",
|
||||
"remark-cli": "^8.0.0",
|
||||
"remark-preset-wooorm": "^7.0.0",
|
||||
"tape": "^5.0.0",
|
||||
"tinyify": "^3.0.0",
|
||||
"xo": "^0.33.0"
|
||||
},
|
||||
"scripts": {
|
||||
"format": "remark . -qfo && prettier . --write && xo --fix --ignore types",
|
||||
"build-bundle": "browserify . -s mdastUtilDefinitions > mdast-util-definitions.js",
|
||||
"build-mangle": "browserify . -s mdastUtilDefinitions -p tinyify > mdast-util-definitions.min.js",
|
||||
"build": "npm run build-bundle && npm run build-mangle",
|
||||
"test-api": "node test",
|
||||
"test-coverage": "nyc --reporter lcov tape test.js",
|
||||
"test-types": "dtslint types",
|
||||
"test": "npm run format && npm run build && npm run test-coverage && npm run test-types"
|
||||
},
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
"lines": 100,
|
||||
"functions": 100,
|
||||
"branches": 100
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false,
|
||||
"ignore": [
|
||||
"types",
|
||||
"mdast-util-definitions.js"
|
||||
]
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
}
|
||||
}
|
||||
149
node_modules/react-markdown/node_modules/mdast-util-definitions/readme.md
generated
vendored
Normal file
149
node_modules/react-markdown/node_modules/mdast-util-definitions/readme.md
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
# mdast-util-definitions
|
||||
|
||||
[![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]
|
||||
|
||||
[**mdast**][mdast] utility to get definitions by `identifier`.
|
||||
|
||||
Supports funky keys, like `__proto__` or `toString`.
|
||||
|
||||
## Install
|
||||
|
||||
[npm][]:
|
||||
|
||||
```sh
|
||||
npm install mdast-util-definitions
|
||||
```
|
||||
|
||||
[npm][] with [TypeScript][] support:
|
||||
|
||||
```sh
|
||||
npm install mdast-util-definitions @types/mdast
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```js
|
||||
var remark = require('remark')
|
||||
var definitions = require('mdast-util-definitions')
|
||||
|
||||
var ast = remark().parse('[example]: https://example.com "Example"')
|
||||
|
||||
var definition = definitions(ast)
|
||||
|
||||
definition('example')
|
||||
// => {type: 'definition', 'title': 'Example', ...}
|
||||
|
||||
definition('foo')
|
||||
// => null
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `definitions(tree)`
|
||||
|
||||
Create a cache of all [definition][]s in [`tree`][node].
|
||||
|
||||
Uses CommonMark precedence: prefers the first definitions for duplicate
|
||||
definitions.
|
||||
|
||||
###### Returns
|
||||
|
||||
[`Function`][fn-definition]
|
||||
|
||||
### `definition(identifier)`
|
||||
|
||||
###### Parameters
|
||||
|
||||
* `identifier` (`string`) — [Identifier][] of [definition][].
|
||||
|
||||
###### Returns
|
||||
|
||||
[`Node?`][node] — [Definition][], if found.
|
||||
|
||||
## Security
|
||||
|
||||
Use of `mdast-util-definitions` does not involve [**hast**][hast] or user
|
||||
content so there are no openings for [cross-site scripting (XSS)][xss] attacks.
|
||||
|
||||
Additionally, safe guards are in place to protect against prototype poisoning.
|
||||
|
||||
## Related
|
||||
|
||||
* [`unist-util-index`](https://github.com/syntax-tree/unist-util-index)
|
||||
— index property values or computed keys to nodes
|
||||
|
||||
## Contribute
|
||||
|
||||
See [`contributing.md` in `syntax-tree/.github`][contributing] 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://img.shields.io/travis/syntax-tree/mdast-util-definitions.svg
|
||||
|
||||
[build]: https://travis-ci.org/syntax-tree/mdast-util-definitions
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-definitions.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/syntax-tree/mdast-util-definitions
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-definitions.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/mdast-util-definitions
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/mdast-util-definitions.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=mdast-util-definitions
|
||||
|
||||
[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
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[typescript]: https://www.typescriptlang.org/
|
||||
|
||||
[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
|
||||
|
||||
[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md
|
||||
|
||||
[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md
|
||||
|
||||
[mdast]: https://github.com/syntax-tree/mdast
|
||||
|
||||
[node]: https://github.com/syntax-tree/unist#node
|
||||
|
||||
[fn-definition]: #definitionidentifier
|
||||
|
||||
[definition]: https://github.com/syntax-tree/mdast#definition
|
||||
|
||||
[identifier]: https://github.com/syntax-tree/mdast#association
|
||||
|
||||
[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
|
||||
|
||||
[hast]: https://github.com/syntax-tree/hast
|
||||
17
node_modules/react-markdown/node_modules/mdast-util-definitions/types/index.d.ts
generated
vendored
Normal file
17
node_modules/react-markdown/node_modules/mdast-util-definitions/types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// Minimum TypeScript Version: 3.2
|
||||
import {Node} from 'unist'
|
||||
import {Definition} from 'mdast'
|
||||
|
||||
declare namespace definitions {
|
||||
/**
|
||||
* @param identifier [Identifier](https://github.com/syntax-tree/mdast#association) of [definition](https://github.com/syntax-tree/mdast#definition).
|
||||
*/
|
||||
type DefinitionCache = (identifier: string) => Definition | null
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a cache of all [definition](https://github.com/syntax-tree/mdast#definition)s in [`node`](https://github.com/syntax-tree/unist#node).
|
||||
*/
|
||||
declare function definitions(node: Node): definitions.DefinitionCache
|
||||
|
||||
export = definitions
|
||||
10
node_modules/react-markdown/node_modules/mdast-util-definitions/types/mdast-util-definitions-tests.ts
generated
vendored
Normal file
10
node_modules/react-markdown/node_modules/mdast-util-definitions/types/mdast-util-definitions-tests.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import remark = require('remark')
|
||||
import definitions = require('mdast-util-definitions')
|
||||
|
||||
const ast = remark().parse('[example]: https://example.com "Example"')
|
||||
|
||||
const definition = definitions(ast)
|
||||
|
||||
definition('example')
|
||||
|
||||
definition('foo')
|
||||
10
node_modules/react-markdown/node_modules/mdast-util-definitions/types/tsconfig.json
generated
vendored
Normal file
10
node_modules/react-markdown/node_modules/mdast-util-definitions/types/tsconfig.json
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es2015"],
|
||||
"strict": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"mdast-util-definitions": ["index.d.ts"]
|
||||
}
|
||||
}
|
||||
}
|
||||
8
node_modules/react-markdown/node_modules/mdast-util-definitions/types/tslint.json
generated
vendored
Normal file
8
node_modules/react-markdown/node_modules/mdast-util-definitions/types/tslint.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "dtslint/dtslint.json",
|
||||
"rules": {
|
||||
"no-redundant-jsdoc": false,
|
||||
"semicolon": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
2
node_modules/react-markdown/node_modules/mdast-util-to-hast/index.js
generated
vendored
Normal file
2
node_modules/react-markdown/node_modules/mdast-util-to-hast/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
'use strict'
|
||||
module.exports = require('./lib')
|
||||
36
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/all.js
generated
vendored
Normal file
36
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/all.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = all
|
||||
|
||||
var one = require('./one')
|
||||
|
||||
function all(h, parent) {
|
||||
var nodes = parent.children || []
|
||||
var length = nodes.length
|
||||
var values = []
|
||||
var index = -1
|
||||
var result
|
||||
var head
|
||||
|
||||
while (++index < length) {
|
||||
result = one(h, nodes[index], parent)
|
||||
|
||||
if (result) {
|
||||
if (index && nodes[index - 1].type === 'break') {
|
||||
if (result.value) {
|
||||
result.value = result.value.replace(/^\s+/, '')
|
||||
}
|
||||
|
||||
head = result.children && result.children[0]
|
||||
|
||||
if (head && head.value) {
|
||||
head.value = head.value.replace(/^\s+/, '')
|
||||
}
|
||||
}
|
||||
|
||||
values = values.concat(result)
|
||||
}
|
||||
}
|
||||
|
||||
return values
|
||||
}
|
||||
67
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/footer.js
generated
vendored
Normal file
67
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/footer.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = generateFootnotes
|
||||
|
||||
var thematicBreak = require('./handlers/thematic-break')
|
||||
var list = require('./handlers/list')
|
||||
var wrap = require('./wrap')
|
||||
|
||||
function generateFootnotes(h) {
|
||||
var footnoteById = h.footnoteById
|
||||
var footnoteOrder = h.footnoteOrder
|
||||
var length = footnoteOrder.length
|
||||
var index = -1
|
||||
var listItems = []
|
||||
var def
|
||||
var backReference
|
||||
var content
|
||||
var tail
|
||||
|
||||
while (++index < length) {
|
||||
def = footnoteById[footnoteOrder[index].toUpperCase()]
|
||||
|
||||
if (!def) {
|
||||
continue
|
||||
}
|
||||
|
||||
content = def.children.concat()
|
||||
tail = content[content.length - 1]
|
||||
backReference = {
|
||||
type: 'link',
|
||||
url: '#fnref-' + def.identifier,
|
||||
data: {hProperties: {className: ['footnote-backref']}},
|
||||
children: [{type: 'text', value: '↩'}]
|
||||
}
|
||||
|
||||
if (!tail || tail.type !== 'paragraph') {
|
||||
tail = {type: 'paragraph', children: []}
|
||||
content.push(tail)
|
||||
}
|
||||
|
||||
tail.children.push(backReference)
|
||||
|
||||
listItems.push({
|
||||
type: 'listItem',
|
||||
data: {hProperties: {id: 'fn-' + def.identifier}},
|
||||
children: content,
|
||||
position: def.position
|
||||
})
|
||||
}
|
||||
|
||||
if (listItems.length === 0) {
|
||||
return null
|
||||
}
|
||||
|
||||
return h(
|
||||
null,
|
||||
'div',
|
||||
{className: ['footnotes']},
|
||||
wrap(
|
||||
[
|
||||
thematicBreak(h),
|
||||
list(h, {type: 'list', ordered: true, children: listItems})
|
||||
],
|
||||
true
|
||||
)
|
||||
)
|
||||
}
|
||||
10
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/blockquote.js
generated
vendored
Normal file
10
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/blockquote.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = blockquote
|
||||
|
||||
var wrap = require('../wrap')
|
||||
var all = require('../all')
|
||||
|
||||
function blockquote(h, node) {
|
||||
return h(node, 'blockquote', wrap(all(h, node), true))
|
||||
}
|
||||
9
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/break.js
generated
vendored
Normal file
9
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/break.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = hardBreak
|
||||
|
||||
var u = require('unist-builder')
|
||||
|
||||
function hardBreak(h, node) {
|
||||
return [h(node, 'br'), u('text', '\n')]
|
||||
}
|
||||
26
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/code.js
generated
vendored
Normal file
26
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/code.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = code
|
||||
|
||||
var u = require('unist-builder')
|
||||
|
||||
function code(h, node) {
|
||||
var value = node.value ? node.value + '\n' : ''
|
||||
// To do: next major, use `node.lang` w/o regex, the splitting’s been going
|
||||
// on for years in remark now.
|
||||
var lang = node.lang && node.lang.match(/^[^ \t]+(?=[ \t]|$)/)
|
||||
var props = {}
|
||||
var code
|
||||
|
||||
if (lang) {
|
||||
props.className = ['language-' + lang]
|
||||
}
|
||||
|
||||
code = h(node, 'code', props, [u('text', value)])
|
||||
|
||||
if (node.meta) {
|
||||
code.data = {meta: node.meta}
|
||||
}
|
||||
|
||||
return h(node.position, 'pre', [code])
|
||||
}
|
||||
9
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/delete.js
generated
vendored
Normal file
9
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/delete.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = strikethrough
|
||||
|
||||
var all = require('../all')
|
||||
|
||||
function strikethrough(h, node) {
|
||||
return h(node, 'del', all(h, node))
|
||||
}
|
||||
9
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/emphasis.js
generated
vendored
Normal file
9
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/emphasis.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = emphasis
|
||||
|
||||
var all = require('../all')
|
||||
|
||||
function emphasis(h, node) {
|
||||
return h(node, 'em', all(h, node))
|
||||
}
|
||||
20
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js
generated
vendored
Normal file
20
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = footnoteReference
|
||||
|
||||
var u = require('unist-builder')
|
||||
|
||||
function footnoteReference(h, node) {
|
||||
var footnoteOrder = h.footnoteOrder
|
||||
var identifier = String(node.identifier)
|
||||
|
||||
if (footnoteOrder.indexOf(identifier) === -1) {
|
||||
footnoteOrder.push(identifier)
|
||||
}
|
||||
|
||||
return h(node.position, 'sup', {id: 'fnref-' + identifier}, [
|
||||
h(node, 'a', {href: '#fn-' + identifier, className: ['footnote-ref']}, [
|
||||
u('text', node.label || identifier)
|
||||
])
|
||||
])
|
||||
}
|
||||
34
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/footnote.js
generated
vendored
Normal file
34
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/footnote.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = footnote
|
||||
|
||||
var footnoteReference = require('./footnote-reference')
|
||||
|
||||
function footnote(h, node) {
|
||||
var footnoteById = h.footnoteById
|
||||
var footnoteOrder = h.footnoteOrder
|
||||
var identifier = 1
|
||||
|
||||
while (identifier in footnoteById) {
|
||||
identifier++
|
||||
}
|
||||
|
||||
identifier = String(identifier)
|
||||
|
||||
// No need to check if `identifier` exists in `footnoteOrder`, it’s guaranteed
|
||||
// to not exist because we just generated it.
|
||||
footnoteOrder.push(identifier)
|
||||
|
||||
footnoteById[identifier] = {
|
||||
type: 'footnoteDefinition',
|
||||
identifier: identifier,
|
||||
children: [{type: 'paragraph', children: node.children}],
|
||||
position: node.position
|
||||
}
|
||||
|
||||
return footnoteReference(h, {
|
||||
type: 'footnoteReference',
|
||||
identifier: identifier,
|
||||
position: node.position
|
||||
})
|
||||
}
|
||||
9
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/heading.js
generated
vendored
Normal file
9
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/heading.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = heading
|
||||
|
||||
var all = require('../all')
|
||||
|
||||
function heading(h, node) {
|
||||
return h(node, 'h' + node.depth, all(h, node))
|
||||
}
|
||||
10
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/html.js
generated
vendored
Normal file
10
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/html.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = html
|
||||
|
||||
var u = require('unist-builder')
|
||||
|
||||
// Return either a `raw` node in dangerous mode, otherwise nothing.
|
||||
function html(h, node) {
|
||||
return h.dangerous ? h.augment(node, u('raw', node.value)) : null
|
||||
}
|
||||
23
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/image-reference.js
generated
vendored
Normal file
23
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/image-reference.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = imageReference
|
||||
|
||||
var normalize = require('mdurl/encode')
|
||||
var revert = require('../revert')
|
||||
|
||||
function imageReference(h, node) {
|
||||
var def = h.definition(node.identifier)
|
||||
var props
|
||||
|
||||
if (!def) {
|
||||
return revert(h, node)
|
||||
}
|
||||
|
||||
props = {src: normalize(def.url || ''), alt: node.alt}
|
||||
|
||||
if (def.title !== null && def.title !== undefined) {
|
||||
props.title = def.title
|
||||
}
|
||||
|
||||
return h(node, 'img', props)
|
||||
}
|
||||
15
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/image.js
generated
vendored
Normal file
15
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/image.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict'
|
||||
|
||||
var normalize = require('mdurl/encode')
|
||||
|
||||
module.exports = image
|
||||
|
||||
function image(h, node) {
|
||||
var props = {src: normalize(node.url), alt: node.alt}
|
||||
|
||||
if (node.title !== null && node.title !== undefined) {
|
||||
props.title = node.title
|
||||
}
|
||||
|
||||
return h(node, 'img', props)
|
||||
}
|
||||
35
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/index.js
generated
vendored
Normal file
35
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/index.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = {
|
||||
blockquote: require('./blockquote'),
|
||||
break: require('./break'),
|
||||
code: require('./code'),
|
||||
delete: require('./delete'),
|
||||
emphasis: require('./emphasis'),
|
||||
footnoteReference: require('./footnote-reference'),
|
||||
footnote: require('./footnote'),
|
||||
heading: require('./heading'),
|
||||
html: require('./html'),
|
||||
imageReference: require('./image-reference'),
|
||||
image: require('./image'),
|
||||
inlineCode: require('./inline-code'),
|
||||
linkReference: require('./link-reference'),
|
||||
link: require('./link'),
|
||||
listItem: require('./list-item'),
|
||||
list: require('./list'),
|
||||
paragraph: require('./paragraph'),
|
||||
root: require('./root'),
|
||||
strong: require('./strong'),
|
||||
table: require('./table'),
|
||||
text: require('./text'),
|
||||
thematicBreak: require('./thematic-break'),
|
||||
toml: ignore,
|
||||
yaml: ignore,
|
||||
definition: ignore,
|
||||
footnoteDefinition: ignore
|
||||
}
|
||||
|
||||
// Return nothing for nodes that are ignored.
|
||||
function ignore() {
|
||||
return null
|
||||
}
|
||||
10
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/inline-code.js
generated
vendored
Normal file
10
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/inline-code.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = inlineCode
|
||||
|
||||
var u = require('unist-builder')
|
||||
|
||||
function inlineCode(h, node) {
|
||||
var value = node.value.replace(/\r?\n|\r/g, ' ')
|
||||
return h(node, 'code', [u('text', value)])
|
||||
}
|
||||
24
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/link-reference.js
generated
vendored
Normal file
24
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/link-reference.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = linkReference
|
||||
|
||||
var normalize = require('mdurl/encode')
|
||||
var revert = require('../revert')
|
||||
var all = require('../all')
|
||||
|
||||
function linkReference(h, node) {
|
||||
var def = h.definition(node.identifier)
|
||||
var props
|
||||
|
||||
if (!def) {
|
||||
return revert(h, node)
|
||||
}
|
||||
|
||||
props = {href: normalize(def.url || '')}
|
||||
|
||||
if (def.title !== null && def.title !== undefined) {
|
||||
props.title = def.title
|
||||
}
|
||||
|
||||
return h(node, 'a', props, all(h, node))
|
||||
}
|
||||
16
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/link.js
generated
vendored
Normal file
16
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/link.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict'
|
||||
|
||||
var normalize = require('mdurl/encode')
|
||||
var all = require('../all')
|
||||
|
||||
module.exports = link
|
||||
|
||||
function link(h, node) {
|
||||
var props = {href: normalize(node.url)}
|
||||
|
||||
if (node.title !== null && node.title !== undefined) {
|
||||
props.title = node.title
|
||||
}
|
||||
|
||||
return h(node, 'a', props, all(h, node))
|
||||
}
|
||||
86
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/list-item.js
generated
vendored
Normal file
86
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/list-item.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = listItem
|
||||
|
||||
var u = require('unist-builder')
|
||||
var all = require('../all')
|
||||
|
||||
function listItem(h, node, parent) {
|
||||
var result = all(h, node)
|
||||
var head = result[0]
|
||||
var loose = parent ? listLoose(parent) : listItemLoose(node)
|
||||
var props = {}
|
||||
var wrapped = []
|
||||
var length
|
||||
var index
|
||||
var child
|
||||
|
||||
if (typeof node.checked === 'boolean') {
|
||||
if (!head || head.tagName !== 'p') {
|
||||
head = h(null, 'p', [])
|
||||
result.unshift(head)
|
||||
}
|
||||
|
||||
if (head.children.length > 0) {
|
||||
head.children.unshift(u('text', ' '))
|
||||
}
|
||||
|
||||
head.children.unshift(
|
||||
h(null, 'input', {
|
||||
type: 'checkbox',
|
||||
checked: node.checked,
|
||||
disabled: true
|
||||
})
|
||||
)
|
||||
|
||||
// According to github-markdown-css, this class hides bullet.
|
||||
// See: <https://github.com/sindresorhus/github-markdown-css>.
|
||||
props.className = ['task-list-item']
|
||||
}
|
||||
|
||||
length = result.length
|
||||
index = -1
|
||||
|
||||
while (++index < length) {
|
||||
child = result[index]
|
||||
|
||||
// Add eols before nodes, except if this is a loose, first paragraph.
|
||||
if (loose || index !== 0 || child.tagName !== 'p') {
|
||||
wrapped.push(u('text', '\n'))
|
||||
}
|
||||
|
||||
if (child.tagName === 'p' && !loose) {
|
||||
wrapped = wrapped.concat(child.children)
|
||||
} else {
|
||||
wrapped.push(child)
|
||||
}
|
||||
}
|
||||
|
||||
// Add a final eol.
|
||||
if (length && (loose || child.tagName !== 'p')) {
|
||||
wrapped.push(u('text', '\n'))
|
||||
}
|
||||
|
||||
return h(node, 'li', props, wrapped)
|
||||
}
|
||||
|
||||
function listLoose(node) {
|
||||
var loose = node.spread
|
||||
var children = node.children
|
||||
var length = children.length
|
||||
var index = -1
|
||||
|
||||
while (!loose && ++index < length) {
|
||||
loose = listItemLoose(children[index])
|
||||
}
|
||||
|
||||
return loose
|
||||
}
|
||||
|
||||
function listItemLoose(node) {
|
||||
var spread = node.spread
|
||||
|
||||
return spread === undefined || spread === null
|
||||
? node.children.length > 1
|
||||
: spread
|
||||
}
|
||||
34
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/list.js
generated
vendored
Normal file
34
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/list.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = list
|
||||
|
||||
var wrap = require('../wrap')
|
||||
var all = require('../all')
|
||||
|
||||
function list(h, node) {
|
||||
var props = {}
|
||||
var name = node.ordered ? 'ol' : 'ul'
|
||||
var items
|
||||
var index = -1
|
||||
var length
|
||||
|
||||
if (typeof node.start === 'number' && node.start !== 1) {
|
||||
props.start = node.start
|
||||
}
|
||||
|
||||
items = all(h, node)
|
||||
length = items.length
|
||||
|
||||
// Like GitHub, add a class for custom styling.
|
||||
while (++index < length) {
|
||||
if (
|
||||
items[index].properties.className &&
|
||||
items[index].properties.className.indexOf('task-list-item') !== -1
|
||||
) {
|
||||
props.className = ['contains-task-list']
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return h(node, name, props, wrap(items, true))
|
||||
}
|
||||
9
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/paragraph.js
generated
vendored
Normal file
9
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/paragraph.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = paragraph
|
||||
|
||||
var all = require('../all')
|
||||
|
||||
function paragraph(h, node) {
|
||||
return h(node, 'p', all(h, node))
|
||||
}
|
||||
11
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/root.js
generated
vendored
Normal file
11
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/root.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = root
|
||||
|
||||
var u = require('unist-builder')
|
||||
var wrap = require('../wrap')
|
||||
var all = require('../all')
|
||||
|
||||
function root(h, node) {
|
||||
return h.augment(node, u('root', wrap(all(h, node))))
|
||||
}
|
||||
9
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/strong.js
generated
vendored
Normal file
9
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/strong.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = strong
|
||||
|
||||
var all = require('../all')
|
||||
|
||||
function strong(h, node) {
|
||||
return h(node, 'strong', all(h, node))
|
||||
}
|
||||
54
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/table.js
generated
vendored
Normal file
54
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/table.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = table
|
||||
|
||||
var position = require('unist-util-position')
|
||||
var wrap = require('../wrap')
|
||||
var all = require('../all')
|
||||
|
||||
function table(h, node) {
|
||||
var rows = node.children
|
||||
var index = rows.length
|
||||
var align = node.align || []
|
||||
var alignLength = align.length
|
||||
var result = []
|
||||
var pos
|
||||
var row
|
||||
var out
|
||||
var name
|
||||
var cell
|
||||
|
||||
while (index--) {
|
||||
row = rows[index].children
|
||||
name = index === 0 ? 'th' : 'td'
|
||||
pos = alignLength || row.length
|
||||
out = []
|
||||
|
||||
while (pos--) {
|
||||
cell = row[pos]
|
||||
out[pos] = h(cell, name, {align: align[pos]}, cell ? all(h, cell) : [])
|
||||
}
|
||||
|
||||
result[index] = h(rows[index], 'tr', wrap(out, true))
|
||||
}
|
||||
|
||||
return h(
|
||||
node,
|
||||
'table',
|
||||
wrap(
|
||||
[h(result[0].position, 'thead', wrap([result[0]], true))].concat(
|
||||
result[1]
|
||||
? h(
|
||||
{
|
||||
start: position.start(result[1]),
|
||||
end: position.end(result[result.length - 1])
|
||||
},
|
||||
'tbody',
|
||||
wrap(result.slice(1), true)
|
||||
)
|
||||
: []
|
||||
),
|
||||
true
|
||||
)
|
||||
)
|
||||
}
|
||||
12
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/text.js
generated
vendored
Normal file
12
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/text.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = text
|
||||
|
||||
var u = require('unist-builder')
|
||||
|
||||
function text(h, node) {
|
||||
return h.augment(
|
||||
node,
|
||||
u('text', String(node.value).replace(/[ \t]*(\r?\n|\r)[ \t]*/g, '$1'))
|
||||
)
|
||||
}
|
||||
7
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js
generated
vendored
Normal file
7
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = thematicBreak
|
||||
|
||||
function thematicBreak(h, node) {
|
||||
return h(node, 'hr')
|
||||
}
|
||||
130
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/index.js
generated
vendored
Normal file
130
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = toHast
|
||||
|
||||
var u = require('unist-builder')
|
||||
var visit = require('unist-util-visit')
|
||||
var position = require('unist-util-position')
|
||||
var generated = require('unist-util-generated')
|
||||
var definitions = require('mdast-util-definitions')
|
||||
var one = require('./one')
|
||||
var footer = require('./footer')
|
||||
var handlers = require('./handlers')
|
||||
|
||||
var own = {}.hasOwnProperty
|
||||
|
||||
var deprecationWarningIssued = false
|
||||
|
||||
// Factory to transform.
|
||||
function factory(tree, options) {
|
||||
var settings = options || {}
|
||||
|
||||
// Issue a warning if the deprecated tag 'allowDangerousHTML' is used
|
||||
if (settings.allowDangerousHTML !== undefined && !deprecationWarningIssued) {
|
||||
deprecationWarningIssued = true
|
||||
console.warn(
|
||||
'mdast-util-to-hast: deprecation: `allowDangerousHTML` is nonstandard, use `allowDangerousHtml` instead'
|
||||
)
|
||||
}
|
||||
|
||||
var dangerous = settings.allowDangerousHtml || settings.allowDangerousHTML
|
||||
var footnoteById = {}
|
||||
|
||||
h.dangerous = dangerous
|
||||
h.definition = definitions(tree)
|
||||
h.footnoteById = footnoteById
|
||||
h.footnoteOrder = []
|
||||
h.augment = augment
|
||||
h.handlers = Object.assign({}, handlers, settings.handlers)
|
||||
h.unknownHandler = settings.unknownHandler
|
||||
h.passThrough = settings.passThrough
|
||||
|
||||
visit(tree, 'footnoteDefinition', onfootnotedefinition)
|
||||
|
||||
return h
|
||||
|
||||
// Finalise the created `right`, a hast node, from `left`, an mdast node.
|
||||
function augment(left, right) {
|
||||
var data
|
||||
var ctx
|
||||
|
||||
// Handle `data.hName`, `data.hProperties, `data.hChildren`.
|
||||
if (left && left.data) {
|
||||
data = left.data
|
||||
|
||||
if (data.hName) {
|
||||
if (right.type !== 'element') {
|
||||
right = {
|
||||
type: 'element',
|
||||
tagName: '',
|
||||
properties: {},
|
||||
children: []
|
||||
}
|
||||
}
|
||||
|
||||
right.tagName = data.hName
|
||||
}
|
||||
|
||||
if (right.type === 'element' && data.hProperties) {
|
||||
right.properties = Object.assign({}, right.properties, data.hProperties)
|
||||
}
|
||||
|
||||
if (right.children && data.hChildren) {
|
||||
right.children = data.hChildren
|
||||
}
|
||||
}
|
||||
|
||||
ctx = left && left.position ? left : {position: left}
|
||||
|
||||
if (!generated(ctx)) {
|
||||
right.position = {
|
||||
start: position.start(ctx),
|
||||
end: position.end(ctx)
|
||||
}
|
||||
}
|
||||
|
||||
return right
|
||||
}
|
||||
|
||||
// Create an element for `node`.
|
||||
function h(node, tagName, props, children) {
|
||||
if (
|
||||
(children === undefined || children === null) &&
|
||||
typeof props === 'object' &&
|
||||
'length' in props
|
||||
) {
|
||||
children = props
|
||||
props = {}
|
||||
}
|
||||
|
||||
return augment(node, {
|
||||
type: 'element',
|
||||
tagName: tagName,
|
||||
properties: props || {},
|
||||
children: children || []
|
||||
})
|
||||
}
|
||||
|
||||
function onfootnotedefinition(definition) {
|
||||
var id = String(definition.identifier).toUpperCase()
|
||||
|
||||
// Mimick CM behavior of link definitions.
|
||||
// See: <https://github.com/syntax-tree/mdast-util-definitions/blob/8290999/index.js#L26>.
|
||||
if (!own.call(footnoteById, id)) {
|
||||
footnoteById[id] = definition
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Transform `tree`, which is an mdast node, to a hast node.
|
||||
function toHast(tree, options) {
|
||||
var h = factory(tree, options)
|
||||
var node = one(h, tree)
|
||||
var foot = footer(h)
|
||||
|
||||
if (foot) {
|
||||
node.children = node.children.concat(u('text', '\n'), foot)
|
||||
}
|
||||
|
||||
return node
|
||||
}
|
||||
65
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/one.js
generated
vendored
Normal file
65
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/one.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = one
|
||||
|
||||
var u = require('unist-builder')
|
||||
var all = require('./all')
|
||||
|
||||
var own = {}.hasOwnProperty
|
||||
|
||||
// Transform an unknown node.
|
||||
function unknown(h, node) {
|
||||
if (text(node)) {
|
||||
return h.augment(node, u('text', node.value))
|
||||
}
|
||||
|
||||
return h(node, 'div', all(h, node))
|
||||
}
|
||||
|
||||
// Visit a node.
|
||||
function one(h, node, parent) {
|
||||
var type = node && node.type
|
||||
var fn
|
||||
|
||||
// Fail on non-nodes.
|
||||
if (!type) {
|
||||
throw new Error('Expected node, got `' + node + '`')
|
||||
}
|
||||
|
||||
if (own.call(h.handlers, type)) {
|
||||
fn = h.handlers[type]
|
||||
} else if (h.passThrough && h.passThrough.indexOf(type) > -1) {
|
||||
fn = returnNode
|
||||
} else {
|
||||
fn = h.unknownHandler
|
||||
}
|
||||
|
||||
return (typeof fn === 'function' ? fn : unknown)(h, node, parent)
|
||||
}
|
||||
|
||||
// Check if the node should be renderered as a text node.
|
||||
function text(node) {
|
||||
var data = node.data || {}
|
||||
|
||||
if (
|
||||
own.call(data, 'hName') ||
|
||||
own.call(data, 'hProperties') ||
|
||||
own.call(data, 'hChildren')
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
return 'value' in node
|
||||
}
|
||||
|
||||
function returnNode(h, node) {
|
||||
var clone
|
||||
|
||||
if (node.children) {
|
||||
clone = Object.assign({}, node)
|
||||
clone.children = all(h, node)
|
||||
return clone
|
||||
}
|
||||
|
||||
return node
|
||||
}
|
||||
44
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/revert.js
generated
vendored
Normal file
44
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/revert.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = revert
|
||||
|
||||
var u = require('unist-builder')
|
||||
var all = require('./all')
|
||||
|
||||
// Return the content of a reference without definition as Markdown.
|
||||
function revert(h, node) {
|
||||
var subtype = node.referenceType
|
||||
var suffix = ']'
|
||||
var contents
|
||||
var head
|
||||
var tail
|
||||
|
||||
if (subtype === 'collapsed') {
|
||||
suffix += '[]'
|
||||
} else if (subtype === 'full') {
|
||||
suffix += '[' + (node.label || node.identifier) + ']'
|
||||
}
|
||||
|
||||
if (node.type === 'imageReference') {
|
||||
return u('text', '![' + node.alt + suffix)
|
||||
}
|
||||
|
||||
contents = all(h, node)
|
||||
head = contents[0]
|
||||
|
||||
if (head && head.type === 'text') {
|
||||
head.value = '[' + head.value
|
||||
} else {
|
||||
contents.unshift(u('text', '['))
|
||||
}
|
||||
|
||||
tail = contents[contents.length - 1]
|
||||
|
||||
if (tail && tail.type === 'text') {
|
||||
tail.value += suffix
|
||||
} else {
|
||||
contents.push(u('text', suffix))
|
||||
}
|
||||
|
||||
return contents
|
||||
}
|
||||
31
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/wrap.js
generated
vendored
Normal file
31
node_modules/react-markdown/node_modules/mdast-util-to-hast/lib/wrap.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = wrap
|
||||
|
||||
var u = require('unist-builder')
|
||||
|
||||
// Wrap `nodes` with line feeds between each entry.
|
||||
// Optionally adds line feeds at the start and end.
|
||||
function wrap(nodes, loose) {
|
||||
var result = []
|
||||
var index = -1
|
||||
var length = nodes.length
|
||||
|
||||
if (loose) {
|
||||
result.push(u('text', '\n'))
|
||||
}
|
||||
|
||||
while (++index < length) {
|
||||
if (index) {
|
||||
result.push(u('text', '\n'))
|
||||
}
|
||||
|
||||
result.push(nodes[index])
|
||||
}
|
||||
|
||||
if (loose && nodes.length > 0) {
|
||||
result.push(u('text', '\n'))
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
22
node_modules/react-markdown/node_modules/mdast-util-to-hast/license
generated
vendored
Normal file
22
node_modules/react-markdown/node_modules/mdast-util-to-hast/license
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2016 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.
|
||||
95
node_modules/react-markdown/node_modules/mdast-util-to-hast/package.json
generated
vendored
Normal file
95
node_modules/react-markdown/node_modules/mdast-util-to-hast/package.json
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
{
|
||||
"name": "mdast-util-to-hast",
|
||||
"version": "10.2.0",
|
||||
"description": "mdast utility to transform to hast",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"unist",
|
||||
"mdast",
|
||||
"mdast-util",
|
||||
"hast",
|
||||
"hast-util",
|
||||
"util",
|
||||
"utility",
|
||||
"markdown",
|
||||
"html"
|
||||
],
|
||||
"repository": "syntax-tree/mdast-util-to-hast",
|
||||
"bugs": "https://github.com/syntax-tree/mdast-util-to-hast/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)"
|
||||
],
|
||||
"files": [
|
||||
"lib",
|
||||
"index.js",
|
||||
"types/index.d.ts"
|
||||
],
|
||||
"types": "types/index.d.ts",
|
||||
"dependencies": {
|
||||
"@types/mdast": "^3.0.0",
|
||||
"@types/unist": "^2.0.0",
|
||||
"mdast-util-definitions": "^4.0.0",
|
||||
"mdurl": "^1.0.0",
|
||||
"unist-builder": "^2.0.0",
|
||||
"unist-util-generated": "^1.0.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^17.0.0",
|
||||
"dtslint": "^4.0.0",
|
||||
"nyc": "^15.0.0",
|
||||
"prettier": "^2.0.0",
|
||||
"remark-cli": "^9.0.0",
|
||||
"remark-preset-wooorm": "^8.0.0",
|
||||
"tape": "^5.0.0",
|
||||
"tinyify": "^3.0.0",
|
||||
"xo": "^0.37.0"
|
||||
},
|
||||
"scripts": {
|
||||
"format": "remark . -qfo && prettier -w . --loglevel warn && xo --fix",
|
||||
"build-bundle": "browserify index.js -s mdastUtilToHast -o mdast-util-to-hast.js",
|
||||
"build-mangle": "browserify index.js -s mdastUtilToHast -o mdast-util-to-hast.min.js -p tinyify",
|
||||
"build": "npm run build-bundle && npm run build-mangle",
|
||||
"test-api": "node test",
|
||||
"test-coverage": "nyc --reporter lcov tape test/index.js",
|
||||
"test-types": "dtslint types",
|
||||
"test": "npm run format && npm run build && npm run test-coverage && npm run test-types"
|
||||
},
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
"lines": 100,
|
||||
"functions": 100,
|
||||
"branches": 100
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false,
|
||||
"ignores": [
|
||||
"**/*.ts",
|
||||
"mdast-util-to-hast.js"
|
||||
],
|
||||
"rules": {
|
||||
"unicorn/explicit-length-check": "off",
|
||||
"unicorn/prefer-includes": "off"
|
||||
}
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
}
|
||||
}
|
||||
402
node_modules/react-markdown/node_modules/mdast-util-to-hast/readme.md
generated
vendored
Normal file
402
node_modules/react-markdown/node_modules/mdast-util-to-hast/readme.md
generated
vendored
Normal file
@@ -0,0 +1,402 @@
|
||||
# mdast-util-to-hast
|
||||
|
||||
[![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]
|
||||
|
||||
[**mdast**][mdast] utility to transform to [**hast**][hast].
|
||||
|
||||
> **Note**: You probably want to use [`remark-rehype`][remark-rehype].
|
||||
|
||||
## Install
|
||||
|
||||
[npm][]:
|
||||
|
||||
```sh
|
||||
npm install mdast-util-to-hast
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
Say we have the following `example.md`:
|
||||
|
||||
```markdown
|
||||
## Hello **World**!
|
||||
```
|
||||
|
||||
…and next to it, `example.js`:
|
||||
|
||||
```js
|
||||
var inspect = require('unist-util-inspect')
|
||||
var unified = require('unified')
|
||||
var parse = require('remark-parse')
|
||||
var vfile = require('to-vfile')
|
||||
var toHast = require('mdast-util-to-hast')
|
||||
|
||||
var tree = unified()
|
||||
.use(parse)
|
||||
.parse(vfile.readSync('example.md'))
|
||||
|
||||
console.log(inspect(toHast(tree)))
|
||||
```
|
||||
|
||||
Which when running with `node example` yields:
|
||||
|
||||
```txt
|
||||
root[1] (1:1-2:1, 0-20)
|
||||
└─ element[3] (1:1-1:20, 0-19) [tagName="h2"]
|
||||
├─ text: "Hello " (1:4-1:10, 3-9)
|
||||
├─ element[1] (1:10-1:19, 9-18) [tagName="strong"]
|
||||
│ └─ text: "World" (1:12-1:17, 11-16)
|
||||
└─ text: "!" (1:19-1:20, 18-19)
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `toHast(node[, options])`
|
||||
|
||||
Transform the given [mdast][] [tree][] to a [hast][] [tree][].
|
||||
|
||||
##### Options
|
||||
|
||||
###### `options.allowDangerousHtml`
|
||||
|
||||
Whether to allow [`html`][mdast-html] nodes and inject them as raw HTML
|
||||
(`boolean`, default: `false`).
|
||||
Only do this when using [`hast-util-to-html`][to-html]
|
||||
([`rehype-stringify`][rehype-stringify]) or [`hast-util-raw`][raw]
|
||||
([`rehype-raw`][rehype-raw]) later: `raw` nodes are not a standard part of
|
||||
[hast][].
|
||||
|
||||
###### `options.handlers`
|
||||
|
||||
Object mapping [mdast][] [nodes][mdast-node] to functions handling them.
|
||||
Take a look at [`lib/handlers/`][handlers] for examples.
|
||||
|
||||
###### `options.passThrough`
|
||||
|
||||
List of custom mdast node types to pass through (keep) in hast
|
||||
(`Array.<string>`, default: `[]`).
|
||||
If the passed through nodes have children, those children are expected to be
|
||||
mdast and will be handled.
|
||||
|
||||
###### `options.unknownHandler`
|
||||
|
||||
Handler for unknown nodes (that aren’t in `handlers` or `passThrough`).
|
||||
|
||||
Default behavior:
|
||||
|
||||
* Unknown nodes with [`children`][child] are transformed to `div` elements
|
||||
* Unknown nodes with `value` are transformed to [`text`][hast-text] nodes
|
||||
|
||||
##### Returns
|
||||
|
||||
[`HastNode`][hast-node].
|
||||
|
||||
##### Notes
|
||||
|
||||
* [`yaml`][mdast-yaml] and `toml` nodes are ignored (created by
|
||||
[`remark-frontmatter`][remark-frontmatter])
|
||||
* [`html`][mdast-html] nodes are ignored if `allowDangerousHtml` is `false`
|
||||
* [`position`][position]s are properly patched
|
||||
* [`node.data.hName`][hname] configures the hast element’s tag-name
|
||||
* [`node.data.hProperties`][hproperties] is mixed into the hast element’s
|
||||
properties
|
||||
* [`node.data.hChildren`][hchildren] configures the hast element’s children
|
||||
* GFM (and this project) uses the obsolete `align` attribute on `td` and `th`
|
||||
elements; combine this utility with
|
||||
[`@mapbox/hast-util-table-cell-style`][hast-util-table-cell-style]
|
||||
to use `style` instead
|
||||
|
||||
##### Examples
|
||||
|
||||
###### `hName`
|
||||
|
||||
`node.data.hName` sets the tag-name of an element.
|
||||
The following [mdast][]:
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'strong',
|
||||
data: {hName: 'b'},
|
||||
children: [{type: 'text', value: 'Alpha'}]
|
||||
}
|
||||
```
|
||||
|
||||
Yields, in [hast][]:
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'element',
|
||||
tagName: 'b',
|
||||
properties: {},
|
||||
children: [{type: 'text', value: 'Alpha'}]
|
||||
}
|
||||
```
|
||||
|
||||
###### `hProperties`
|
||||
|
||||
`node.data.hProperties` in sets the properties of an element.
|
||||
The following [mdast][]:
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'image',
|
||||
src: 'circle.svg',
|
||||
alt: 'Big red circle on a black background',
|
||||
title: null
|
||||
data: {hProperties: {className: ['responsive']}}
|
||||
}
|
||||
```
|
||||
|
||||
Yields, in [hast][]:
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'element',
|
||||
tagName: 'img',
|
||||
properties: {
|
||||
src: 'circle.svg',
|
||||
alt: 'Big red circle on a black background',
|
||||
className: ['responsive']
|
||||
},
|
||||
children: []
|
||||
}
|
||||
```
|
||||
|
||||
###### `hChildren`
|
||||
|
||||
`node.data.hChildren` sets the children of an element.
|
||||
The following [mdast][]:
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'code',
|
||||
lang: 'js',
|
||||
data: {
|
||||
hChildren: [
|
||||
{
|
||||
type: 'element',
|
||||
tagName: 'span',
|
||||
properties: {className: ['hljs-meta']},
|
||||
children: [{type: 'text', value: '"use strict"'}]
|
||||
},
|
||||
{type: 'text', value: ';'}
|
||||
]
|
||||
},
|
||||
value: '"use strict";'
|
||||
}
|
||||
```
|
||||
|
||||
Yields, in [hast][] (**note**: the `pre` and `language-js` class are normal
|
||||
`mdast-util-to-hast` functionality):
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'element',
|
||||
tagName: 'pre',
|
||||
properties: {},
|
||||
children: [{
|
||||
type: 'element',
|
||||
tagName: 'code',
|
||||
properties: {className: ['language-js']},
|
||||
children: [
|
||||
{
|
||||
type: 'element',
|
||||
tagName: 'span',
|
||||
properties: {className: ['hljs-meta']},
|
||||
children: [{type: 'text', value: '"use strict"'}]
|
||||
},
|
||||
{type: 'text', value: ';'}
|
||||
]
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
## Security
|
||||
|
||||
Use of `mdast-util-to-hast` can open you up to a
|
||||
[cross-site scripting (XSS)][xss] attack.
|
||||
Embedded hast properties (`hName`, `hProperties`, `hChildren`), custom handlers,
|
||||
and the `allowDangerousHtml` option all provide openings.
|
||||
|
||||
The following example shows how a script is injected where a benign code block
|
||||
is expected with embedded hast properties:
|
||||
|
||||
```js
|
||||
var code = {type: 'code', value: 'alert(1)'}
|
||||
|
||||
code.data = {hName: 'script'}
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```html
|
||||
<script>alert(1)</script>
|
||||
```
|
||||
|
||||
The following example shows how an image is changed to fail loading and
|
||||
therefore run code in a browser.
|
||||
|
||||
```js
|
||||
var image = {type: 'image', url: 'existing.png'}
|
||||
|
||||
image.data = {hProperties: {src: 'missing', onError: 'alert(2)'}}
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```html
|
||||
<img src="missing" onerror="alert(2)">
|
||||
```
|
||||
|
||||
The following example shows the default handling of embedded HTML:
|
||||
|
||||
```markdown
|
||||
# Hello
|
||||
|
||||
<script>alert(3)</script>
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```html
|
||||
<h1>Hello</h1>
|
||||
```
|
||||
|
||||
Passing `allowDangerousHtml: true` to `mdast-util-to-hast` is typically still
|
||||
not enough to run unsafe code:
|
||||
|
||||
```html
|
||||
<h1>Hello</h1>
|
||||
<script>alert(3)</script>
|
||||
```
|
||||
|
||||
If `allowDangerousHtml: true` is also given to `hast-util-to-html` (or
|
||||
`rehype-stringify`), the unsafe code runs:
|
||||
|
||||
```html
|
||||
<h1>Hello</h1>
|
||||
<script>alert(3)</script>
|
||||
```
|
||||
|
||||
Use [`hast-util-sanitize`][sanitize] to make the hast tree safe.
|
||||
|
||||
## Related
|
||||
|
||||
* [`mdast-util-to-nlcst`](https://github.com/syntax-tree/mdast-util-to-nlcst)
|
||||
— transform mdast to nlcst
|
||||
* [`hast-util-to-mdast`](https://github.com/syntax-tree/hast-util-to-mdast)
|
||||
— transform hast to mdast
|
||||
* [`hast-util-to-xast`](https://github.com/syntax-tree/hast-util-to-xast)
|
||||
— transform hast to xast
|
||||
* [`hast-util-sanitize`](https://github.com/syntax-tree/hast-util-sanitize)
|
||||
— sanitize hast nodes
|
||||
* [`remark-rehype`](https://github.com/remarkjs/remark-rehype)
|
||||
— rehype support for remark
|
||||
* [`rehype-remark`](https://github.com/rehypejs/rehype-remark)
|
||||
— remark support for rehype
|
||||
|
||||
## Contribute
|
||||
|
||||
See [`contributing.md` in `syntax-tree/.github`][contributing] 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/syntax-tree/mdast-util-to-hast/workflows/main/badge.svg
|
||||
|
||||
[build]: https://github.com/syntax-tree/mdast-util-to-hast/actions
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-to-hast.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/syntax-tree/mdast-util-to-hast
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-to-hast.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/mdast-util-to-hast
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/mdast-util-to-hast.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=mdast-util-to-hast
|
||||
|
||||
[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
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
|
||||
|
||||
[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md
|
||||
|
||||
[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md
|
||||
|
||||
[position]: https://github.com/syntax-tree/unist#positional-information
|
||||
|
||||
[tree]: https://github.com/syntax-tree/unist#tree
|
||||
|
||||
[child]: https://github.com/syntax-tree/unist#child
|
||||
|
||||
[mdast]: https://github.com/syntax-tree/mdast
|
||||
|
||||
[mdast-node]: https://github.com/syntax-tree/mdast#nodes
|
||||
|
||||
[mdast-yaml]: https://github.com/syntax-tree/mdast#yaml
|
||||
|
||||
[mdast-html]: https://github.com/syntax-tree/mdast#html
|
||||
|
||||
[hast-util-table-cell-style]: https://github.com/mapbox/hast-util-table-cell-style
|
||||
|
||||
[hast]: https://github.com/syntax-tree/hast
|
||||
|
||||
[hast-text]: https://github.com/syntax-tree/hast#text
|
||||
|
||||
[hast-node]: https://github.com/syntax-tree/hast#nodes
|
||||
|
||||
[to-html]: https://github.com/syntax-tree/hast-util-to-html
|
||||
|
||||
[raw]: https://github.com/syntax-tree/hast-util-raw
|
||||
|
||||
[sanitize]: https://github.com/syntax-tree/hast-util-sanitize
|
||||
|
||||
[remark-rehype]: https://github.com/remarkjs/remark-rehype
|
||||
|
||||
[remark-frontmatter]: https://github.com/remarkjs/remark-frontmatter
|
||||
|
||||
[rehype-raw]: https://github.com/rehypejs/rehype-raw
|
||||
|
||||
[rehype-stringify]: https://github.com/rehypejs/rehype/tree/HEAD/packages/rehype-stringify
|
||||
|
||||
[handlers]: lib/handlers
|
||||
|
||||
[hname]: #hname
|
||||
|
||||
[hproperties]: #hproperties
|
||||
|
||||
[hchildren]: #hchildren
|
||||
|
||||
[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
|
||||
73
node_modules/react-markdown/node_modules/mdast-util-to-hast/types/index.d.ts
generated
vendored
Normal file
73
node_modules/react-markdown/node_modules/mdast-util-to-hast/types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
// Minimum TypeScript Version: 3.2
|
||||
import {Definition} from 'mdast'
|
||||
import {DefinitionCache} from 'mdast-util-definitions'
|
||||
import {Node} from 'unist'
|
||||
|
||||
declare namespace toHast {
|
||||
interface H {
|
||||
dangerous?: boolean
|
||||
definition: DefinitionCache
|
||||
footnoteById: Definition
|
||||
footnoteOrder: string[]
|
||||
handlers: Handlers
|
||||
unknownHandler: Handler
|
||||
(node: Node, tagName: string, props?: object, children?: Node[]): Node
|
||||
augment(left: Node, right: Node): Node
|
||||
}
|
||||
|
||||
type Handler = (h: H, node: Node) => any
|
||||
|
||||
interface Handlers {
|
||||
[type: string]: Handler
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Whether to allow [`html`](https://github.com/syntax-tree/mdast#html) nodes and inject them as raw HTML
|
||||
*
|
||||
* Only do this when using [`hast-util-to-html`](https://github.com/syntax-tree/hast-util-to-html)
|
||||
* ([`rehype-stringify`](https://github.com/rehypejs/rehype/tree/HEAD/packages/rehype-stringify)) or
|
||||
* [`hast-util-raw`](https://github.com/syntax-tree/hast-util-raw)
|
||||
* ([`rehype-raw`](https://github.com/rehypejs/rehype-raw)) later: `raw` nodes are not a standard part of
|
||||
* [hast](https://github.com/syntax-tree/hast).
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
allowDangerousHtml?: boolean
|
||||
|
||||
/**
|
||||
* Object mapping [mdast](https://github.com/syntax-tree/mdast)
|
||||
* [nodes](https://github.com/syntax-tree/mdast#nodes) to functions handling them.
|
||||
* Take a look at
|
||||
* [`lib/handlers/`](https://github.com/syntax-tree/mdast-util-to-hast/blob/HEAD/lib/handlers)
|
||||
* for examples.
|
||||
*/
|
||||
handlers?: Handlers
|
||||
|
||||
/**
|
||||
* List of custom mdast node types to pass through (keep) in hast.
|
||||
* If the passed through nodes have children, those children are expected to
|
||||
* be mdast and will be handled.
|
||||
*/
|
||||
passThrough?: string[]
|
||||
|
||||
/**
|
||||
* Handler for all unknown nodes.
|
||||
*
|
||||
* Default behavior:
|
||||
*
|
||||
* * Unknown nodes with [`children`][child] are transformed to `div` elements
|
||||
* * Unknown nodes with `value` are transformed to [`text`][hast-text] nodes
|
||||
*/
|
||||
unknownHandler?: Handler
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform the given [mdast](https://github.com/syntax-tree/mdast)
|
||||
* [tree](https://github.com/syntax-tree/unist#tree) to a
|
||||
* [hast](https://github.com/syntax-tree/hast) [tree](https://github.com/syntax-tree/unist#tree).
|
||||
*/
|
||||
declare function toHast(node: Node, options?: toHast.Options): Node
|
||||
|
||||
export = toHast
|
||||
21
node_modules/react-markdown/node_modules/react-is/LICENSE
generated
vendored
Normal file
21
node_modules/react-markdown/node_modules/react-is/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Facebook, Inc. and its affiliates.
|
||||
|
||||
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.
|
||||
104
node_modules/react-markdown/node_modules/react-is/README.md
generated
vendored
Normal file
104
node_modules/react-markdown/node_modules/react-is/README.md
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
# `react-is`
|
||||
|
||||
This package allows you to test arbitrary values and see if they're a particular React element type.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
# Yarn
|
||||
yarn add react-is
|
||||
|
||||
# NPM
|
||||
npm install react-is
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Determining if a Component is Valid
|
||||
|
||||
```js
|
||||
import React from "react";
|
||||
import * as ReactIs from "react-is";
|
||||
|
||||
class ClassComponent extends React.Component {
|
||||
render() {
|
||||
return React.createElement("div");
|
||||
}
|
||||
}
|
||||
|
||||
const FunctionComponent = () => React.createElement("div");
|
||||
|
||||
const ForwardRefComponent = React.forwardRef((props, ref) =>
|
||||
React.createElement(Component, { forwardedRef: ref, ...props })
|
||||
);
|
||||
|
||||
const Context = React.createContext(false);
|
||||
|
||||
ReactIs.isValidElementType("div"); // true
|
||||
ReactIs.isValidElementType(ClassComponent); // true
|
||||
ReactIs.isValidElementType(FunctionComponent); // true
|
||||
ReactIs.isValidElementType(ForwardRefComponent); // true
|
||||
ReactIs.isValidElementType(Context.Provider); // true
|
||||
ReactIs.isValidElementType(Context.Consumer); // true
|
||||
ReactIs.isValidElementType(React.createFactory("div")); // true
|
||||
```
|
||||
|
||||
### Determining an Element's Type
|
||||
|
||||
#### Context
|
||||
|
||||
```js
|
||||
import React from "react";
|
||||
import * as ReactIs from 'react-is';
|
||||
|
||||
const ThemeContext = React.createContext("blue");
|
||||
|
||||
ReactIs.isContextConsumer(<ThemeContext.Consumer />); // true
|
||||
ReactIs.isContextProvider(<ThemeContext.Provider />); // true
|
||||
ReactIs.typeOf(<ThemeContext.Provider />) === ReactIs.ContextProvider; // true
|
||||
ReactIs.typeOf(<ThemeContext.Consumer />) === ReactIs.ContextConsumer; // true
|
||||
```
|
||||
|
||||
#### Element
|
||||
|
||||
```js
|
||||
import React from "react";
|
||||
import * as ReactIs from 'react-is';
|
||||
|
||||
ReactIs.isElement(<div />); // true
|
||||
ReactIs.typeOf(<div />) === ReactIs.Element; // true
|
||||
```
|
||||
|
||||
#### Fragment
|
||||
|
||||
```js
|
||||
import React from "react";
|
||||
import * as ReactIs from 'react-is';
|
||||
|
||||
ReactIs.isFragment(<></>); // true
|
||||
ReactIs.typeOf(<></>) === ReactIs.Fragment; // true
|
||||
```
|
||||
|
||||
#### Portal
|
||||
|
||||
```js
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import * as ReactIs from 'react-is';
|
||||
|
||||
const div = document.createElement("div");
|
||||
const portal = ReactDOM.createPortal(<div />, div);
|
||||
|
||||
ReactIs.isPortal(portal); // true
|
||||
ReactIs.typeOf(portal) === ReactIs.Portal; // true
|
||||
```
|
||||
|
||||
#### StrictMode
|
||||
|
||||
```js
|
||||
import React from "react";
|
||||
import * as ReactIs from 'react-is';
|
||||
|
||||
ReactIs.isStrictMode(<React.StrictMode />); // true
|
||||
ReactIs.typeOf(<React.StrictMode />) === ReactIs.StrictMode; // true
|
||||
```
|
||||
8
node_modules/react-markdown/node_modules/react-is/build-info.json
generated
vendored
Normal file
8
node_modules/react-markdown/node_modules/react-is/build-info.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"branch": "pull/21051",
|
||||
"buildNumber": "287151",
|
||||
"checksum": "94f5c65",
|
||||
"commit": "12adaffef",
|
||||
"environment": "ci",
|
||||
"reactVersion": "17.0.0-12adaffef"
|
||||
}
|
||||
226
node_modules/react-markdown/node_modules/react-is/cjs/react-is.development.js
generated
vendored
Normal file
226
node_modules/react-markdown/node_modules/react-is/cjs/react-is.development.js
generated
vendored
Normal file
@@ -0,0 +1,226 @@
|
||||
/** @license React v17.0.2
|
||||
* react-is.development.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// ATTENTION
|
||||
// When adding new symbols to this file,
|
||||
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
||||
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
||||
// nor polyfill, then a plain number is used for performance.
|
||||
var REACT_ELEMENT_TYPE = 0xeac7;
|
||||
var REACT_PORTAL_TYPE = 0xeaca;
|
||||
var REACT_FRAGMENT_TYPE = 0xeacb;
|
||||
var REACT_STRICT_MODE_TYPE = 0xeacc;
|
||||
var REACT_PROFILER_TYPE = 0xead2;
|
||||
var REACT_PROVIDER_TYPE = 0xeacd;
|
||||
var REACT_CONTEXT_TYPE = 0xeace;
|
||||
var REACT_FORWARD_REF_TYPE = 0xead0;
|
||||
var REACT_SUSPENSE_TYPE = 0xead1;
|
||||
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
|
||||
var REACT_MEMO_TYPE = 0xead3;
|
||||
var REACT_LAZY_TYPE = 0xead4;
|
||||
var REACT_BLOCK_TYPE = 0xead9;
|
||||
var REACT_SERVER_BLOCK_TYPE = 0xeada;
|
||||
var REACT_FUNDAMENTAL_TYPE = 0xead5;
|
||||
var REACT_SCOPE_TYPE = 0xead7;
|
||||
var REACT_OPAQUE_ID_TYPE = 0xeae0;
|
||||
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
|
||||
var REACT_OFFSCREEN_TYPE = 0xeae2;
|
||||
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
|
||||
|
||||
if (typeof Symbol === 'function' && Symbol.for) {
|
||||
var symbolFor = Symbol.for;
|
||||
REACT_ELEMENT_TYPE = symbolFor('react.element');
|
||||
REACT_PORTAL_TYPE = symbolFor('react.portal');
|
||||
REACT_FRAGMENT_TYPE = symbolFor('react.fragment');
|
||||
REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
|
||||
REACT_PROFILER_TYPE = symbolFor('react.profiler');
|
||||
REACT_PROVIDER_TYPE = symbolFor('react.provider');
|
||||
REACT_CONTEXT_TYPE = symbolFor('react.context');
|
||||
REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
|
||||
REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
|
||||
REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
|
||||
REACT_MEMO_TYPE = symbolFor('react.memo');
|
||||
REACT_LAZY_TYPE = symbolFor('react.lazy');
|
||||
REACT_BLOCK_TYPE = symbolFor('react.block');
|
||||
REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
|
||||
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
|
||||
REACT_SCOPE_TYPE = symbolFor('react.scope');
|
||||
REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
|
||||
REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
|
||||
REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
|
||||
REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
|
||||
}
|
||||
|
||||
// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
|
||||
|
||||
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
||||
|
||||
function isValidElementType(type) {
|
||||
if (typeof type === 'string' || typeof type === 'function') {
|
||||
return true;
|
||||
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
||||
|
||||
|
||||
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeof type === 'object' && type !== null) {
|
||||
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function typeOf(object) {
|
||||
if (typeof object === 'object' && object !== null) {
|
||||
var $$typeof = object.$$typeof;
|
||||
|
||||
switch ($$typeof) {
|
||||
case REACT_ELEMENT_TYPE:
|
||||
var type = object.type;
|
||||
|
||||
switch (type) {
|
||||
case REACT_FRAGMENT_TYPE:
|
||||
case REACT_PROFILER_TYPE:
|
||||
case REACT_STRICT_MODE_TYPE:
|
||||
case REACT_SUSPENSE_TYPE:
|
||||
case REACT_SUSPENSE_LIST_TYPE:
|
||||
return type;
|
||||
|
||||
default:
|
||||
var $$typeofType = type && type.$$typeof;
|
||||
|
||||
switch ($$typeofType) {
|
||||
case REACT_CONTEXT_TYPE:
|
||||
case REACT_FORWARD_REF_TYPE:
|
||||
case REACT_LAZY_TYPE:
|
||||
case REACT_MEMO_TYPE:
|
||||
case REACT_PROVIDER_TYPE:
|
||||
return $$typeofType;
|
||||
|
||||
default:
|
||||
return $$typeof;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
case REACT_PORTAL_TYPE:
|
||||
return $$typeof;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
var ContextConsumer = REACT_CONTEXT_TYPE;
|
||||
var ContextProvider = REACT_PROVIDER_TYPE;
|
||||
var Element = REACT_ELEMENT_TYPE;
|
||||
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
||||
var Fragment = REACT_FRAGMENT_TYPE;
|
||||
var Lazy = REACT_LAZY_TYPE;
|
||||
var Memo = REACT_MEMO_TYPE;
|
||||
var Portal = REACT_PORTAL_TYPE;
|
||||
var Profiler = REACT_PROFILER_TYPE;
|
||||
var StrictMode = REACT_STRICT_MODE_TYPE;
|
||||
var Suspense = REACT_SUSPENSE_TYPE;
|
||||
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
||||
var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
|
||||
|
||||
function isAsyncMode(object) {
|
||||
{
|
||||
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
||||
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
||||
|
||||
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
function isConcurrentMode(object) {
|
||||
{
|
||||
if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
|
||||
hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
|
||||
|
||||
console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
function isContextConsumer(object) {
|
||||
return typeOf(object) === REACT_CONTEXT_TYPE;
|
||||
}
|
||||
function isContextProvider(object) {
|
||||
return typeOf(object) === REACT_PROVIDER_TYPE;
|
||||
}
|
||||
function isElement(object) {
|
||||
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
||||
}
|
||||
function isForwardRef(object) {
|
||||
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
||||
}
|
||||
function isFragment(object) {
|
||||
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
||||
}
|
||||
function isLazy(object) {
|
||||
return typeOf(object) === REACT_LAZY_TYPE;
|
||||
}
|
||||
function isMemo(object) {
|
||||
return typeOf(object) === REACT_MEMO_TYPE;
|
||||
}
|
||||
function isPortal(object) {
|
||||
return typeOf(object) === REACT_PORTAL_TYPE;
|
||||
}
|
||||
function isProfiler(object) {
|
||||
return typeOf(object) === REACT_PROFILER_TYPE;
|
||||
}
|
||||
function isStrictMode(object) {
|
||||
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
||||
}
|
||||
function isSuspense(object) {
|
||||
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
||||
}
|
||||
|
||||
exports.ContextConsumer = ContextConsumer;
|
||||
exports.ContextProvider = ContextProvider;
|
||||
exports.Element = Element;
|
||||
exports.ForwardRef = ForwardRef;
|
||||
exports.Fragment = Fragment;
|
||||
exports.Lazy = Lazy;
|
||||
exports.Memo = Memo;
|
||||
exports.Portal = Portal;
|
||||
exports.Profiler = Profiler;
|
||||
exports.StrictMode = StrictMode;
|
||||
exports.Suspense = Suspense;
|
||||
exports.isAsyncMode = isAsyncMode;
|
||||
exports.isConcurrentMode = isConcurrentMode;
|
||||
exports.isContextConsumer = isContextConsumer;
|
||||
exports.isContextProvider = isContextProvider;
|
||||
exports.isElement = isElement;
|
||||
exports.isForwardRef = isForwardRef;
|
||||
exports.isFragment = isFragment;
|
||||
exports.isLazy = isLazy;
|
||||
exports.isMemo = isMemo;
|
||||
exports.isPortal = isPortal;
|
||||
exports.isProfiler = isProfiler;
|
||||
exports.isStrictMode = isStrictMode;
|
||||
exports.isSuspense = isSuspense;
|
||||
exports.isValidElementType = isValidElementType;
|
||||
exports.typeOf = typeOf;
|
||||
})();
|
||||
}
|
||||
14
node_modules/react-markdown/node_modules/react-is/cjs/react-is.production.min.js
generated
vendored
Normal file
14
node_modules/react-markdown/node_modules/react-is/cjs/react-is.production.min.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/** @license React v17.0.2
|
||||
* react-is.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
'use strict';var b=60103,c=60106,d=60107,e=60108,f=60114,g=60109,h=60110,k=60112,l=60113,m=60120,n=60115,p=60116,q=60121,r=60122,u=60117,v=60129,w=60131;
|
||||
if("function"===typeof Symbol&&Symbol.for){var x=Symbol.for;b=x("react.element");c=x("react.portal");d=x("react.fragment");e=x("react.strict_mode");f=x("react.profiler");g=x("react.provider");h=x("react.context");k=x("react.forward_ref");l=x("react.suspense");m=x("react.suspense_list");n=x("react.memo");p=x("react.lazy");q=x("react.block");r=x("react.server.block");u=x("react.fundamental");v=x("react.debug_trace_mode");w=x("react.legacy_hidden")}
|
||||
function y(a){if("object"===typeof a&&null!==a){var t=a.$$typeof;switch(t){case b:switch(a=a.type,a){case d:case f:case e:case l:case m:return a;default:switch(a=a&&a.$$typeof,a){case h:case k:case p:case n:case g:return a;default:return t}}case c:return t}}}var z=g,A=b,B=k,C=d,D=p,E=n,F=c,G=f,H=e,I=l;exports.ContextConsumer=h;exports.ContextProvider=z;exports.Element=A;exports.ForwardRef=B;exports.Fragment=C;exports.Lazy=D;exports.Memo=E;exports.Portal=F;exports.Profiler=G;exports.StrictMode=H;
|
||||
exports.Suspense=I;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return y(a)===h};exports.isContextProvider=function(a){return y(a)===g};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return y(a)===k};exports.isFragment=function(a){return y(a)===d};exports.isLazy=function(a){return y(a)===p};exports.isMemo=function(a){return y(a)===n};
|
||||
exports.isPortal=function(a){return y(a)===c};exports.isProfiler=function(a){return y(a)===f};exports.isStrictMode=function(a){return y(a)===e};exports.isSuspense=function(a){return y(a)===l};exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===f||a===v||a===e||a===l||a===m||a===w||"object"===typeof a&&null!==a&&(a.$$typeof===p||a.$$typeof===n||a.$$typeof===g||a.$$typeof===h||a.$$typeof===k||a.$$typeof===u||a.$$typeof===q||a[0]===r)?!0:!1};
|
||||
exports.typeOf=y;
|
||||
7
node_modules/react-markdown/node_modules/react-is/index.js
generated
vendored
Normal file
7
node_modules/react-markdown/node_modules/react-is/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./cjs/react-is.production.min.js');
|
||||
} else {
|
||||
module.exports = require('./cjs/react-is.development.js');
|
||||
}
|
||||
27
node_modules/react-markdown/node_modules/react-is/package.json
generated
vendored
Normal file
27
node_modules/react-markdown/node_modules/react-is/package.json
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "react-is",
|
||||
"version": "17.0.2",
|
||||
"description": "Brand checking of React Elements.",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/react.git",
|
||||
"directory": "packages/react-is"
|
||||
},
|
||||
"keywords": [
|
||||
"react"
|
||||
],
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/facebook/react/issues"
|
||||
},
|
||||
"homepage": "https://reactjs.org/",
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"build-info.json",
|
||||
"index.js",
|
||||
"cjs/",
|
||||
"umd/"
|
||||
]
|
||||
}
|
||||
225
node_modules/react-markdown/node_modules/react-is/umd/react-is.development.js
generated
vendored
Normal file
225
node_modules/react-markdown/node_modules/react-is/umd/react-is.development.js
generated
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
/** @license React v17.0.2
|
||||
* react-is.development.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(global = global || self, factory(global.ReactIs = {}));
|
||||
}(this, (function (exports) { 'use strict';
|
||||
|
||||
// ATTENTION
|
||||
// When adding new symbols to this file,
|
||||
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
||||
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
||||
// nor polyfill, then a plain number is used for performance.
|
||||
var REACT_ELEMENT_TYPE = 0xeac7;
|
||||
var REACT_PORTAL_TYPE = 0xeaca;
|
||||
var REACT_FRAGMENT_TYPE = 0xeacb;
|
||||
var REACT_STRICT_MODE_TYPE = 0xeacc;
|
||||
var REACT_PROFILER_TYPE = 0xead2;
|
||||
var REACT_PROVIDER_TYPE = 0xeacd;
|
||||
var REACT_CONTEXT_TYPE = 0xeace;
|
||||
var REACT_FORWARD_REF_TYPE = 0xead0;
|
||||
var REACT_SUSPENSE_TYPE = 0xead1;
|
||||
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
|
||||
var REACT_MEMO_TYPE = 0xead3;
|
||||
var REACT_LAZY_TYPE = 0xead4;
|
||||
var REACT_BLOCK_TYPE = 0xead9;
|
||||
var REACT_SERVER_BLOCK_TYPE = 0xeada;
|
||||
var REACT_FUNDAMENTAL_TYPE = 0xead5;
|
||||
var REACT_SCOPE_TYPE = 0xead7;
|
||||
var REACT_OPAQUE_ID_TYPE = 0xeae0;
|
||||
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
|
||||
var REACT_OFFSCREEN_TYPE = 0xeae2;
|
||||
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
|
||||
|
||||
if (typeof Symbol === 'function' && Symbol.for) {
|
||||
var symbolFor = Symbol.for;
|
||||
REACT_ELEMENT_TYPE = symbolFor('react.element');
|
||||
REACT_PORTAL_TYPE = symbolFor('react.portal');
|
||||
REACT_FRAGMENT_TYPE = symbolFor('react.fragment');
|
||||
REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
|
||||
REACT_PROFILER_TYPE = symbolFor('react.profiler');
|
||||
REACT_PROVIDER_TYPE = symbolFor('react.provider');
|
||||
REACT_CONTEXT_TYPE = symbolFor('react.context');
|
||||
REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
|
||||
REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
|
||||
REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
|
||||
REACT_MEMO_TYPE = symbolFor('react.memo');
|
||||
REACT_LAZY_TYPE = symbolFor('react.lazy');
|
||||
REACT_BLOCK_TYPE = symbolFor('react.block');
|
||||
REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
|
||||
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
|
||||
REACT_SCOPE_TYPE = symbolFor('react.scope');
|
||||
REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
|
||||
REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
|
||||
REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
|
||||
REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
|
||||
}
|
||||
|
||||
// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
|
||||
|
||||
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
||||
|
||||
function isValidElementType(type) {
|
||||
if (typeof type === 'string' || typeof type === 'function') {
|
||||
return true;
|
||||
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
||||
|
||||
|
||||
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeof type === 'object' && type !== null) {
|
||||
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function typeOf(object) {
|
||||
if (typeof object === 'object' && object !== null) {
|
||||
var $$typeof = object.$$typeof;
|
||||
|
||||
switch ($$typeof) {
|
||||
case REACT_ELEMENT_TYPE:
|
||||
var type = object.type;
|
||||
|
||||
switch (type) {
|
||||
case REACT_FRAGMENT_TYPE:
|
||||
case REACT_PROFILER_TYPE:
|
||||
case REACT_STRICT_MODE_TYPE:
|
||||
case REACT_SUSPENSE_TYPE:
|
||||
case REACT_SUSPENSE_LIST_TYPE:
|
||||
return type;
|
||||
|
||||
default:
|
||||
var $$typeofType = type && type.$$typeof;
|
||||
|
||||
switch ($$typeofType) {
|
||||
case REACT_CONTEXT_TYPE:
|
||||
case REACT_FORWARD_REF_TYPE:
|
||||
case REACT_LAZY_TYPE:
|
||||
case REACT_MEMO_TYPE:
|
||||
case REACT_PROVIDER_TYPE:
|
||||
return $$typeofType;
|
||||
|
||||
default:
|
||||
return $$typeof;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
case REACT_PORTAL_TYPE:
|
||||
return $$typeof;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
var ContextConsumer = REACT_CONTEXT_TYPE;
|
||||
var ContextProvider = REACT_PROVIDER_TYPE;
|
||||
var Element = REACT_ELEMENT_TYPE;
|
||||
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
||||
var Fragment = REACT_FRAGMENT_TYPE;
|
||||
var Lazy = REACT_LAZY_TYPE;
|
||||
var Memo = REACT_MEMO_TYPE;
|
||||
var Portal = REACT_PORTAL_TYPE;
|
||||
var Profiler = REACT_PROFILER_TYPE;
|
||||
var StrictMode = REACT_STRICT_MODE_TYPE;
|
||||
var Suspense = REACT_SUSPENSE_TYPE;
|
||||
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
||||
var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
|
||||
|
||||
function isAsyncMode(object) {
|
||||
{
|
||||
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
||||
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
||||
|
||||
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
function isConcurrentMode(object) {
|
||||
{
|
||||
if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
|
||||
hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
|
||||
|
||||
console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
function isContextConsumer(object) {
|
||||
return typeOf(object) === REACT_CONTEXT_TYPE;
|
||||
}
|
||||
function isContextProvider(object) {
|
||||
return typeOf(object) === REACT_PROVIDER_TYPE;
|
||||
}
|
||||
function isElement(object) {
|
||||
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
||||
}
|
||||
function isForwardRef(object) {
|
||||
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
||||
}
|
||||
function isFragment(object) {
|
||||
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
||||
}
|
||||
function isLazy(object) {
|
||||
return typeOf(object) === REACT_LAZY_TYPE;
|
||||
}
|
||||
function isMemo(object) {
|
||||
return typeOf(object) === REACT_MEMO_TYPE;
|
||||
}
|
||||
function isPortal(object) {
|
||||
return typeOf(object) === REACT_PORTAL_TYPE;
|
||||
}
|
||||
function isProfiler(object) {
|
||||
return typeOf(object) === REACT_PROFILER_TYPE;
|
||||
}
|
||||
function isStrictMode(object) {
|
||||
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
||||
}
|
||||
function isSuspense(object) {
|
||||
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
||||
}
|
||||
|
||||
exports.ContextConsumer = ContextConsumer;
|
||||
exports.ContextProvider = ContextProvider;
|
||||
exports.Element = Element;
|
||||
exports.ForwardRef = ForwardRef;
|
||||
exports.Fragment = Fragment;
|
||||
exports.Lazy = Lazy;
|
||||
exports.Memo = Memo;
|
||||
exports.Portal = Portal;
|
||||
exports.Profiler = Profiler;
|
||||
exports.StrictMode = StrictMode;
|
||||
exports.Suspense = Suspense;
|
||||
exports.isAsyncMode = isAsyncMode;
|
||||
exports.isConcurrentMode = isConcurrentMode;
|
||||
exports.isContextConsumer = isContextConsumer;
|
||||
exports.isContextProvider = isContextProvider;
|
||||
exports.isElement = isElement;
|
||||
exports.isForwardRef = isForwardRef;
|
||||
exports.isFragment = isFragment;
|
||||
exports.isLazy = isLazy;
|
||||
exports.isMemo = isMemo;
|
||||
exports.isPortal = isPortal;
|
||||
exports.isProfiler = isProfiler;
|
||||
exports.isStrictMode = isStrictMode;
|
||||
exports.isSuspense = isSuspense;
|
||||
exports.isValidElementType = isValidElementType;
|
||||
exports.typeOf = typeOf;
|
||||
|
||||
})));
|
||||
14
node_modules/react-markdown/node_modules/react-is/umd/react-is.production.min.js
generated
vendored
Normal file
14
node_modules/react-markdown/node_modules/react-is/umd/react-is.production.min.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/** @license React v17.0.2
|
||||
* react-is.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
(function(){'use strict';(function(b,d){"object"===typeof exports&&"undefined"!==typeof module?d(exports):"function"===typeof define&&define.amd?define(["exports"],d):(b=b||self,d(b.ReactIs={}))})(this,function(b){function d(a){if("object"===typeof a&&null!==a){var b=a.$$typeof;switch(b){case q:switch(a=a.type,a){case e:case f:case g:case h:case t:return a;default:switch(a=a&&a.$$typeof,a){case k:case l:case m:case n:case p:return a;default:return b}}case r:return b}}}var q=60103,r=60106,e=60107,g=60108,f=60114,
|
||||
p=60109,k=60110,l=60112,h=60113,t=60120,n=60115,m=60116,u=60121,v=60122,w=60117,x=60129,y=60131;if("function"===typeof Symbol&&Symbol.for){var c=Symbol.for;q=c("react.element");r=c("react.portal");e=c("react.fragment");g=c("react.strict_mode");f=c("react.profiler");p=c("react.provider");k=c("react.context");l=c("react.forward_ref");h=c("react.suspense");t=c("react.suspense_list");n=c("react.memo");m=c("react.lazy");u=c("react.block");v=c("react.server.block");w=c("react.fundamental");x=c("react.debug_trace_mode");
|
||||
y=c("react.legacy_hidden")}b.ContextConsumer=k;b.ContextProvider=p;b.Element=q;b.ForwardRef=l;b.Fragment=e;b.Lazy=m;b.Memo=n;b.Portal=r;b.Profiler=f;b.StrictMode=g;b.Suspense=h;b.isAsyncMode=function(a){return!1};b.isConcurrentMode=function(a){return!1};b.isContextConsumer=function(a){return d(a)===k};b.isContextProvider=function(a){return d(a)===p};b.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===q};b.isForwardRef=function(a){return d(a)===l};b.isFragment=function(a){return d(a)===
|
||||
e};b.isLazy=function(a){return d(a)===m};b.isMemo=function(a){return d(a)===n};b.isPortal=function(a){return d(a)===r};b.isProfiler=function(a){return d(a)===f};b.isStrictMode=function(a){return d(a)===g};b.isSuspense=function(a){return d(a)===h};b.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===f||a===x||a===g||a===h||a===t||a===y||"object"===typeof a&&null!==a&&(a.$$typeof===m||a.$$typeof===n||a.$$typeof===p||a.$$typeof===k||a.$$typeof===l||a.$$typeof===
|
||||
w||a.$$typeof===u||a[0]===v)?!0:!1};b.typeOf=d});
|
||||
})();
|
||||
24
node_modules/react-markdown/node_modules/remark-parse/index.js
generated
vendored
Normal file
24
node_modules/react-markdown/node_modules/remark-parse/index.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = parse
|
||||
|
||||
var fromMarkdown = require('mdast-util-from-markdown')
|
||||
|
||||
function parse(options) {
|
||||
var self = this
|
||||
|
||||
this.Parser = parse
|
||||
|
||||
function parse(doc) {
|
||||
return fromMarkdown(
|
||||
doc,
|
||||
Object.assign({}, self.data('settings'), options, {
|
||||
// Note: these options are not in the readme.
|
||||
// The goal is for them to be set by plugins on `data` instead of being
|
||||
// passed by users.
|
||||
extensions: self.data('micromarkExtensions') || [],
|
||||
mdastExtensions: self.data('fromMarkdownExtensions') || []
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
46
node_modules/react-markdown/node_modules/remark-parse/package.json
generated
vendored
Normal file
46
node_modules/react-markdown/node_modules/remark-parse/package.json
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "remark-parse",
|
||||
"version": "9.0.0",
|
||||
"description": "remark plugin to parse Markdown",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"unified",
|
||||
"remark",
|
||||
"remark-plugin",
|
||||
"plugin",
|
||||
"markdown",
|
||||
"mdast",
|
||||
"abstract",
|
||||
"syntax",
|
||||
"tree",
|
||||
"ast",
|
||||
"parse"
|
||||
],
|
||||
"types": "types/index.d.ts",
|
||||
"homepage": "https://remark.js.org",
|
||||
"repository": "https://github.com/remarkjs/remark/tree/main/packages/remark-parse",
|
||||
"bugs": "https://github.com/remarkjs/remark/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>",
|
||||
"Junyoung Choi <fluke8259@gmail.com>",
|
||||
"Elijah Hamovitz <elijahhamovitz@gmail.com>",
|
||||
"Ika <ikatyang@gmail.com>"
|
||||
],
|
||||
"files": [
|
||||
"index.js",
|
||||
"types/index.d.ts"
|
||||
],
|
||||
"dependencies": {
|
||||
"mdast-util-from-markdown": "^0.8.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape test.js"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
197
node_modules/react-markdown/node_modules/remark-parse/readme.md
generated
vendored
Normal file
197
node_modules/react-markdown/node_modules/remark-parse/readme.md
generated
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
# remark-parse
|
||||
|
||||
[![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]
|
||||
|
||||
[Parser][] for [**unified**][unified].
|
||||
Parses Markdown to [**mdast**][mdast] syntax trees.
|
||||
Built on [`micromark`][micromark] and
|
||||
[`mdast-util-from-markdown`][from-markdown].
|
||||
Used in the [**remark** processor][remark] but can be used on its own as well.
|
||||
Can be [extended][extend] to change how Markdown is parsed.
|
||||
|
||||
## Install
|
||||
|
||||
[npm][]:
|
||||
|
||||
```sh
|
||||
npm install remark-parse
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```js
|
||||
var unified = require('unified')
|
||||
var createStream = require('unified-stream')
|
||||
var markdown = require('remark-parse')
|
||||
var remark2rehype = require('remark-rehype')
|
||||
var html = require('rehype-stringify')
|
||||
|
||||
var processor = unified().use(markdown).use(remark2rehype).use(html)
|
||||
|
||||
process.stdin.pipe(createStream(processor)).pipe(process.stdout)
|
||||
```
|
||||
|
||||
[See **unified** for more examples »][unified]
|
||||
|
||||
## API
|
||||
|
||||
[See **unified** for API docs »][unified]
|
||||
|
||||
### `processor().use(parse)`
|
||||
|
||||
Configure the `processor` to read Markdown as input and process
|
||||
[**mdast**][mdast] syntax trees.
|
||||
|
||||
## Extending the parser
|
||||
|
||||
See [`micromark`][micromark] and [`mdast-util-from-markdown`][from-markdown].
|
||||
Then create a wrapper plugin such as [`remark-gfm`][gfm].
|
||||
|
||||
## Security
|
||||
|
||||
As Markdown is sometimes used for HTML, and improper use of HTML can open you up
|
||||
to a [cross-site scripting (XSS)][xss] attack, use of remark can also be unsafe.
|
||||
When going to HTML, use remark in combination with the [**rehype**][rehype]
|
||||
ecosystem, and use [`rehype-sanitize`][sanitize] to make the tree safe.
|
||||
|
||||
Use of remark plugins could also open you up to other attacks.
|
||||
Carefully assess each plugin and the risks involved in using them.
|
||||
|
||||
## Contribute
|
||||
|
||||
See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways
|
||||
to get started.
|
||||
See [`support.md`][support] for ways to get help.
|
||||
Ideas for new plugins and tools can be posted in [`remarkjs/ideas`][ideas].
|
||||
|
||||
A curated list of awesome remark resources can be found in [**awesome
|
||||
remark**][awesome].
|
||||
|
||||
This project has a [code of conduct][coc].
|
||||
By interacting with this repository, organization, or community you agree to
|
||||
abide by its terms.
|
||||
|
||||
## Sponsor
|
||||
|
||||
Support this effort and give back by sponsoring on [OpenCollective][collective]!
|
||||
|
||||
<!--lint ignore no-html-->
|
||||
|
||||
<table>
|
||||
<tr valign="middle">
|
||||
<td width="20%" align="center" colspan="2">
|
||||
<a href="https://www.gatsbyjs.org">Gatsby</a> 🥇<br><br>
|
||||
<a href="https://www.gatsbyjs.org"><img src="https://avatars1.githubusercontent.com/u/12551863?s=256&v=4" width="128"></a>
|
||||
</td>
|
||||
<td width="20%" align="center" colspan="2">
|
||||
<a href="https://vercel.com">Vercel</a> 🥇<br><br>
|
||||
<a href="https://vercel.com"><img src="https://avatars1.githubusercontent.com/u/14985020?s=256&v=4" width="128"></a>
|
||||
</td>
|
||||
<td width="20%" align="center" colspan="2">
|
||||
<a href="https://www.netlify.com">Netlify</a><br><br>
|
||||
<!--OC has a sharper image-->
|
||||
<a href="https://www.netlify.com"><img src="https://images.opencollective.com/netlify/4087de2/logo/256.png" width="128"></a>
|
||||
</td>
|
||||
<td width="10%" align="center">
|
||||
<a href="https://www.holloway.com">Holloway</a><br><br>
|
||||
<a href="https://www.holloway.com"><img src="https://avatars1.githubusercontent.com/u/35904294?s=128&v=4" width="64"></a>
|
||||
</td>
|
||||
<td width="10%" align="center">
|
||||
<a href="https://themeisle.com">ThemeIsle</a><br><br>
|
||||
<a href="https://themeisle.com"><img src="https://avatars1.githubusercontent.com/u/58979018?s=128&v=4" width="64"></a>
|
||||
</td>
|
||||
<td width="10%" align="center">
|
||||
<a href="https://boosthub.io">Boost Hub</a><br><br>
|
||||
<a href="https://boosthub.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a>
|
||||
</td>
|
||||
<td width="10%" align="center">
|
||||
<a href="https://expo.io">Expo</a><br><br>
|
||||
<a href="https://expo.io"><img src="https://avatars1.githubusercontent.com/u/12504344?s=128&v=4" width="64"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="middle">
|
||||
<td width="100%" align="center" colspan="10">
|
||||
<br>
|
||||
<a href="https://opencollective.com/unified"><strong>You?</strong></a>
|
||||
<br><br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## License
|
||||
|
||||
[MIT][license] © [Titus Wormer][author]
|
||||
|
||||
<!-- Definitions -->
|
||||
|
||||
[build-badge]: https://img.shields.io/travis/remarkjs/remark.svg
|
||||
|
||||
[build]: https://travis-ci.org/remarkjs/remark
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/remarkjs/remark
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/remark-parse.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/remark-parse
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-parse.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=remark-parse
|
||||
|
||||
[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/remarkjs/remark/discussions
|
||||
|
||||
[health]: https://github.com/remarkjs/.github
|
||||
|
||||
[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md
|
||||
|
||||
[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md
|
||||
|
||||
[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md
|
||||
|
||||
[ideas]: https://github.com/remarkjs/ideas
|
||||
|
||||
[awesome]: https://github.com/remarkjs/awesome-remark
|
||||
|
||||
[license]: https://github.com/remarkjs/remark/blob/main/license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[unified]: https://github.com/unifiedjs/unified
|
||||
|
||||
[remark]: https://github.com/remarkjs/remark/tree/main/packages/remark
|
||||
|
||||
[mdast]: https://github.com/syntax-tree/mdast
|
||||
|
||||
[parser]: https://github.com/unifiedjs/unified#processorparser
|
||||
|
||||
[extend]: #extending-the-parser
|
||||
|
||||
[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
|
||||
|
||||
[rehype]: https://github.com/rehypejs/rehype
|
||||
|
||||
[sanitize]: https://github.com/rehypejs/rehype-sanitize
|
||||
|
||||
[micromark]: https://github.com/micromark/micromark
|
||||
|
||||
[from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown
|
||||
|
||||
[gfm]: https://github.com/remarkjs/remark-gfm
|
||||
14
node_modules/react-markdown/node_modules/remark-parse/types/index.d.ts
generated
vendored
Normal file
14
node_modules/react-markdown/node_modules/remark-parse/types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
// TypeScript Version: 3.0
|
||||
|
||||
import {Plugin} from 'unified'
|
||||
import {Options} from 'mdast-util-from-markdown'
|
||||
|
||||
declare namespace remarkParse {
|
||||
interface Parse extends Plugin<[RemarkParseOptions?]> {}
|
||||
|
||||
type RemarkParseOptions = Options
|
||||
}
|
||||
|
||||
declare const remarkParse: remarkParse.Parse
|
||||
|
||||
export = remarkParse
|
||||
43
node_modules/react-markdown/node_modules/remark-rehype/index.js
generated
vendored
Normal file
43
node_modules/react-markdown/node_modules/remark-rehype/index.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
'use strict'
|
||||
|
||||
var mdast2hast = require('mdast-util-to-hast')
|
||||
|
||||
module.exports = remark2rehype
|
||||
|
||||
// Attacher.
|
||||
// If a destination is given, runs the destination with the new hast tree
|
||||
// (bridge mode).
|
||||
// Without destination, returns the tree: further plugins run on that tree
|
||||
// (mutate mode).
|
||||
function remark2rehype(destination, options) {
|
||||
if (destination && !destination.process) {
|
||||
options = destination
|
||||
destination = null
|
||||
}
|
||||
|
||||
return destination ? bridge(destination, options) : mutate(options)
|
||||
}
|
||||
|
||||
// Bridge mode.
|
||||
// Runs the destination with the new hast tree.
|
||||
function bridge(destination, options) {
|
||||
return transformer
|
||||
|
||||
function transformer(node, file, next) {
|
||||
destination.run(mdast2hast(node, options), file, done)
|
||||
|
||||
function done(error) {
|
||||
next(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Mutate-mode.
|
||||
// Further transformers run on the hast tree.
|
||||
function mutate(options) {
|
||||
return transformer
|
||||
|
||||
function transformer(node) {
|
||||
return mdast2hast(node, options)
|
||||
}
|
||||
}
|
||||
22
node_modules/react-markdown/node_modules/remark-rehype/license
generated
vendored
Normal file
22
node_modules/react-markdown/node_modules/remark-rehype/license
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2016 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.
|
||||
88
node_modules/react-markdown/node_modules/remark-rehype/package.json
generated
vendored
Normal file
88
node_modules/react-markdown/node_modules/remark-rehype/package.json
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
{
|
||||
"name": "remark-rehype",
|
||||
"version": "8.1.0",
|
||||
"description": "remark plugin to transform to rehype",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"unified",
|
||||
"remark",
|
||||
"rehype",
|
||||
"remark-plugin",
|
||||
"rehype-plugin",
|
||||
"plugin",
|
||||
"html",
|
||||
"hast",
|
||||
"mdast",
|
||||
"markdown"
|
||||
],
|
||||
"repository": "remarkjs/remark-rehype",
|
||||
"bugs": "https://github.com/remarkjs/remark-rehype/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)",
|
||||
"John Otander <johnotander@gmail.com> (https://johno.com)"
|
||||
],
|
||||
"files": [
|
||||
"index.js",
|
||||
"types/index.d.ts"
|
||||
],
|
||||
"types": "types/index.d.ts",
|
||||
"dependencies": {
|
||||
"mdast-util-to-hast": "^10.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^17.0.0",
|
||||
"dtslint": "^4.0.0",
|
||||
"nyc": "^15.0.0",
|
||||
"prettier": "^2.0.0",
|
||||
"rehype-stringify": "^8.0.0",
|
||||
"remark-cli": "^9.0.0",
|
||||
"remark-parse": "^9.0.0",
|
||||
"remark-preset-wooorm": "^8.0.0",
|
||||
"remark-stringify": "^9.0.0",
|
||||
"tape": "^5.0.0",
|
||||
"tinyify": "^3.0.0",
|
||||
"unified": "^9.0.0",
|
||||
"xo": "^0.38.0"
|
||||
},
|
||||
"scripts": {
|
||||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
|
||||
"build-bundle": "browserify . -s remarkRehype > remark-rehype.js",
|
||||
"build-mangle": "browserify . -s remarkRehype -p tinyify > remark-rehype.min.js",
|
||||
"build": "npm run build-bundle && npm run build-mangle",
|
||||
"test-api": "node test",
|
||||
"test-coverage": "nyc --reporter lcov tape test.js",
|
||||
"test-types": "dtslint types",
|
||||
"test": "npm run format && npm run build && npm run test-coverage && npm run test-types"
|
||||
},
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
"lines": 100,
|
||||
"functions": 100,
|
||||
"branches": 100
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false,
|
||||
"ignores": [
|
||||
"remark-rehype.js"
|
||||
]
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
}
|
||||
}
|
||||
203
node_modules/react-markdown/node_modules/remark-rehype/readme.md
generated
vendored
Normal file
203
node_modules/react-markdown/node_modules/remark-rehype/readme.md
generated
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
# remark-rehype
|
||||
|
||||
[![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]
|
||||
|
||||
[**remark**][remark] plugin to bridge or mutate to [**rehype**][rehype].
|
||||
|
||||
> Note: `remark-rehype` doesn’t deal with HTML inside the Markdown.
|
||||
> You’ll need [`rehype-raw`][raw] if you’re planning on doing that.
|
||||
|
||||
## Note!
|
||||
|
||||
This plugin is ready for the new parser in remark
|
||||
([`remarkjs/remark#536`](https://github.com/remarkjs/remark/pull/536)).
|
||||
The current and previous versions of the plugin work with the current and
|
||||
previous versions of remark.
|
||||
|
||||
## Install
|
||||
|
||||
[npm][]:
|
||||
|
||||
```sh
|
||||
npm install remark-rehype
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
Say we have the following file, `example.md`:
|
||||
|
||||
```markdown
|
||||
# Hello world
|
||||
|
||||
> Block quote.
|
||||
|
||||
Some _emphasis_, **importance**, and `code`.
|
||||
```
|
||||
|
||||
And our script, `example.js`, looks as follows:
|
||||
|
||||
```js
|
||||
var vfile = require('to-vfile')
|
||||
var report = require('vfile-reporter')
|
||||
var unified = require('unified')
|
||||
var markdown = require('remark-parse')
|
||||
var remark2rehype = require('remark-rehype')
|
||||
var doc = require('rehype-document')
|
||||
var format = require('rehype-format')
|
||||
var html = require('rehype-stringify')
|
||||
|
||||
unified()
|
||||
.use(markdown)
|
||||
.use(remark2rehype)
|
||||
.use(doc)
|
||||
.use(format)
|
||||
.use(html)
|
||||
.process(vfile.readSync('example.md'), function (err, file) {
|
||||
console.error(report(err || file))
|
||||
console.log(String(file))
|
||||
})
|
||||
```
|
||||
|
||||
Now, running `node example` yields:
|
||||
|
||||
```html
|
||||
example.md: no issues found
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>example</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello world</h1>
|
||||
<blockquote>
|
||||
<p>Block quote.</p>
|
||||
</blockquote>
|
||||
<p>Some <em>emphasis</em>, <strong>importance</strong>, and <code>code</code>.</p>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `origin.use(remark2rehype[, destination][, options])`
|
||||
|
||||
[**remark**][remark] ([**mdast**][mdast]) plugin to bridge or mutate to
|
||||
[**rehype**][rehype] ([**hast**][hast]).
|
||||
|
||||
###### `destination`
|
||||
|
||||
If a [`Unified`][processor] processor is given, runs the destination processor
|
||||
with the new hast tree, then, after running discards that tree and continues on
|
||||
running the origin processor with the original tree ([*bridge mode*][bridge]).
|
||||
Otherwise, passes the tree to further plugins (*mutate mode*).
|
||||
|
||||
###### `options`
|
||||
|
||||
Passed to [`mdast-util-to-hast`][to-hast].
|
||||
|
||||
## Security
|
||||
|
||||
Use of `remark-rehype` can open you up to a [cross-site scripting (XSS)][xss]
|
||||
attack.
|
||||
Embedded [**hast**][hast] properties (`hName`, `hProperties`, `hChildren`),
|
||||
custom handlers, and the `allowDangerousHtml` option all provide openings.
|
||||
Use [`rehype-sanitize`][sanitize] to make the tree safe.
|
||||
|
||||
## Related
|
||||
|
||||
* [`rehype-raw`][raw]
|
||||
— Properly deal with HTML in Markdown (used after `remark-rehype`)
|
||||
* [`rehype-sanitize`][sanitize]
|
||||
— Sanitize HTML
|
||||
* [`rehype-remark`](https://github.com/rehypejs/rehype-remark)
|
||||
— Transform HTML ([hast][]) to Markdown ([mdast][])
|
||||
* [`rehype-retext`](https://github.com/rehypejs/rehype-retext)
|
||||
— Transform HTML ([hast][]) to natural language ([nlcst][])
|
||||
* [`remark-retext`](https://github.com/remarkjs/remark-retext)
|
||||
— Transform Markdown ([mdast][]) to natural language ([nlcst][])
|
||||
|
||||
## Contribute
|
||||
|
||||
See [`contributing.md`][contributing] in [`remarkjs/.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/remarkjs/remark-rehype/workflows/main/badge.svg
|
||||
|
||||
[build]: https://github.com/remarkjs/remark-rehype/actions
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-rehype.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/remarkjs/remark-rehype
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/remark-rehype.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/remark-rehype
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-rehype.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=remark-rehype
|
||||
|
||||
[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/remarkjs/remark/discussions
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[health]: https://github.com/remarkjs/.github
|
||||
|
||||
[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md
|
||||
|
||||
[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md
|
||||
|
||||
[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[processor]: https://github.com/unifiedjs/unified#processor
|
||||
|
||||
[bridge]: https://github.com/unifiedjs/unified#processing-between-syntaxes
|
||||
|
||||
[remark]: https://github.com/remarkjs/remark
|
||||
|
||||
[rehype]: https://github.com/rehypejs/rehype
|
||||
|
||||
[raw]: https://github.com/rehypejs/rehype-raw
|
||||
|
||||
[sanitize]: https://github.com/rehypejs/rehype-sanitize
|
||||
|
||||
[mdast]: https://github.com/syntax-tree/mdast
|
||||
|
||||
[hast]: https://github.com/syntax-tree/hast
|
||||
|
||||
[nlcst]: https://github.com/syntax-tree/nlcst
|
||||
|
||||
[to-hast]: https://github.com/syntax-tree/mdast-util-to-hast#tohastnode-options
|
||||
|
||||
[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
|
||||
7
node_modules/react-markdown/node_modules/remark-rehype/types/index.d.ts
generated
vendored
Normal file
7
node_modules/react-markdown/node_modules/remark-rehype/types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Minimum TypeScript Version: 3.2
|
||||
import {Plugin, Processor} from 'unified'
|
||||
import {Options} from 'mdast-util-to-hast'
|
||||
|
||||
declare const remark2rehype: Plugin<[Options?] | [Processor?, Options?]>
|
||||
|
||||
export = remark2rehype
|
||||
74
node_modules/react-markdown/node_modules/trough/index.js
generated
vendored
Normal file
74
node_modules/react-markdown/node_modules/trough/index.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
'use strict'
|
||||
|
||||
var wrap = require('./wrap.js')
|
||||
|
||||
module.exports = trough
|
||||
|
||||
trough.wrap = wrap
|
||||
|
||||
var slice = [].slice
|
||||
|
||||
// Create new middleware.
|
||||
function trough() {
|
||||
var fns = []
|
||||
var middleware = {}
|
||||
|
||||
middleware.run = run
|
||||
middleware.use = use
|
||||
|
||||
return middleware
|
||||
|
||||
// Run `fns`. Last argument must be a completion handler.
|
||||
function run() {
|
||||
var index = -1
|
||||
var input = slice.call(arguments, 0, -1)
|
||||
var done = arguments[arguments.length - 1]
|
||||
|
||||
if (typeof done !== 'function') {
|
||||
throw new Error('Expected function as last argument, not ' + done)
|
||||
}
|
||||
|
||||
next.apply(null, [null].concat(input))
|
||||
|
||||
// Run the next `fn`, if any.
|
||||
function next(err) {
|
||||
var fn = fns[++index]
|
||||
var params = slice.call(arguments, 0)
|
||||
var values = params.slice(1)
|
||||
var length = input.length
|
||||
var pos = -1
|
||||
|
||||
if (err) {
|
||||
done(err)
|
||||
return
|
||||
}
|
||||
|
||||
// Copy non-nully input into values.
|
||||
while (++pos < length) {
|
||||
if (values[pos] === null || values[pos] === undefined) {
|
||||
values[pos] = input[pos]
|
||||
}
|
||||
}
|
||||
|
||||
input = values
|
||||
|
||||
// Next or done.
|
||||
if (fn) {
|
||||
wrap(fn, next).apply(null, input)
|
||||
} else {
|
||||
done.apply(null, [null].concat(input))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add `fn` to the list.
|
||||
function use(fn) {
|
||||
if (typeof fn !== 'function') {
|
||||
throw new Error('Expected `fn` to be a function, not ' + fn)
|
||||
}
|
||||
|
||||
fns.push(fn)
|
||||
|
||||
return middleware
|
||||
}
|
||||
}
|
||||
21
node_modules/react-markdown/node_modules/trough/license
generated
vendored
Normal file
21
node_modules/react-markdown/node_modules/trough/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2016 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.
|
||||
75
node_modules/react-markdown/node_modules/trough/package.json
generated
vendored
Normal file
75
node_modules/react-markdown/node_modules/trough/package.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"name": "trough",
|
||||
"version": "1.0.5",
|
||||
"description": "Middleware: a channel used to convey a liquid",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"middleware",
|
||||
"ware"
|
||||
],
|
||||
"repository": "wooorm/trough",
|
||||
"bugs": "https://github.com/wooorm/trough/issues",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wooorm"
|
||||
},
|
||||
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
||||
"contributors": [
|
||||
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
||||
],
|
||||
"files": [
|
||||
"index.js",
|
||||
"wrap.js"
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"browserify": "^16.0.0",
|
||||
"nyc": "^15.0.0",
|
||||
"prettier": "^1.0.0",
|
||||
"remark-cli": "^7.0.0",
|
||||
"remark-preset-wooorm": "^6.0.0",
|
||||
"tape": "^4.0.0",
|
||||
"tinyify": "^2.0.0",
|
||||
"xo": "^0.25.0"
|
||||
},
|
||||
"scripts": {
|
||||
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
|
||||
"build-bundle": "browserify index.js -s trough > trough.js",
|
||||
"build-mangle": "browserify index.js -s trough -p tinyify > trough.min.js",
|
||||
"build": "npm run build-bundle && npm run build-mangle",
|
||||
"test-api": "node test",
|
||||
"test-coverage": "nyc --reporter lcov tape test.js",
|
||||
"test": "npm run format && npm run build && npm run test-coverage"
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false,
|
||||
"rules": {
|
||||
"unicorn/prefer-reflect-apply": "off",
|
||||
"unicorn/prefer-type-error": "off",
|
||||
"guard-for-in": "off"
|
||||
},
|
||||
"ignores": [
|
||||
"trough.js"
|
||||
]
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
},
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
"lines": 100,
|
||||
"functions": 100,
|
||||
"branches": 100
|
||||
}
|
||||
}
|
||||
330
node_modules/react-markdown/node_modules/trough/readme.md
generated
vendored
Normal file
330
node_modules/react-markdown/node_modules/trough/readme.md
generated
vendored
Normal file
@@ -0,0 +1,330 @@
|
||||
# trough
|
||||
|
||||
[![Build][build-badge]][build]
|
||||
[![Coverage][coverage-badge]][coverage]
|
||||
[![Downloads][downloads-badge]][downloads]
|
||||
[![Size][size-badge]][size]
|
||||
|
||||
> **trough** /trôf/ — a channel used to convey a liquid.
|
||||
|
||||
`trough` is like [`ware`][ware] with less sugar, and middleware functions can
|
||||
change the input of the next.
|
||||
|
||||
## Install
|
||||
|
||||
[npm][]:
|
||||
|
||||
```sh
|
||||
npm install trough
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```js
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
var trough = require('trough')
|
||||
|
||||
var pipeline = trough()
|
||||
.use(function(fileName) {
|
||||
console.log('Checking… ' + fileName)
|
||||
})
|
||||
.use(function(fileName) {
|
||||
return path.join(process.cwd(), fileName)
|
||||
})
|
||||
.use(function(filePath, next) {
|
||||
fs.stat(filePath, function(err, stats) {
|
||||
next(err, {filePath, stats})
|
||||
})
|
||||
})
|
||||
.use(function(ctx, next) {
|
||||
if (ctx.stats.isFile()) {
|
||||
fs.readFile(ctx.filePath, next)
|
||||
} else {
|
||||
next(new Error('Expected file'))
|
||||
}
|
||||
})
|
||||
|
||||
pipeline.run('readme.md', console.log)
|
||||
pipeline.run('node_modules', console.log)
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```txt
|
||||
Checking… readme.md
|
||||
Checking… node_modules
|
||||
Error: Expected file
|
||||
at ~/example.js:21:12
|
||||
at wrapped (~/node_modules/trough/index.js:93:19)
|
||||
at next (~/node_modules/trough/index.js:56:24)
|
||||
at done (~/node_modules/trough/index.js:124:12)
|
||||
at ~/node_modules/example.js:14:7
|
||||
at FSReqWrap.oncomplete (fs.js:153:5)
|
||||
null <Buffer 23 20 74 72 6f 75 67 68 20 5b 21 5b 42 75 69 6c 64 20 53 74 61 74 75 73 5d 5b 74 72 61 76 69 73 2d 62 61 64 67 65 5d 5d 5b 74 72 61 76 69 73 5d 20 5b ... >
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `trough()`
|
||||
|
||||
Create a new [`Trough`][trough].
|
||||
|
||||
#### `trough.wrap(middleware, callback[, …input])`
|
||||
|
||||
Call `middleware` with all input.
|
||||
If `middleware` accepts more arguments than given in input, and extra `done`
|
||||
function is passed in after the input when calling it.
|
||||
It must be called.
|
||||
|
||||
The first value in `input` is called the main input value.
|
||||
All other input values are called the rest input values.
|
||||
The values given to `callback` are the input values, merged with every non-nully
|
||||
output value.
|
||||
|
||||
* If `middleware` throws an error, returns a promise that is rejected, or
|
||||
calls the given `done` function with an error, `callback` is invoked with
|
||||
that error
|
||||
* If `middleware` returns a value or returns a promise that is resolved, that
|
||||
value is the main output value
|
||||
* If `middleware` calls `done`, all non-nully values except for the first one
|
||||
(the error) overwrite the output values
|
||||
|
||||
### `Trough`
|
||||
|
||||
A pipeline.
|
||||
|
||||
#### `Trough#run([input…, ]done)`
|
||||
|
||||
Run the pipeline (all [`use()`][use]d middleware).
|
||||
Invokes [`done`][done] on completion with either an error or the output of the
|
||||
last middleware.
|
||||
|
||||
> Note!
|
||||
> as the length of input defines whether [async][] functions get a `next`
|
||||
> function, it’s recommended to keep `input` at one value normally.
|
||||
|
||||
##### `function done(err?, [output…])`
|
||||
|
||||
The final handler passed to [`run()`][run], invoked with an error if a
|
||||
[middleware function][fn] rejected, passed, or threw one, or the output of the
|
||||
last middleware function.
|
||||
|
||||
#### `Trough#use(fn)`
|
||||
|
||||
Add `fn`, a [middleware function][fn], to the pipeline.
|
||||
|
||||
##### `function fn([input…, ][next])`
|
||||
|
||||
A middleware function invoked with the output of its predecessor.
|
||||
|
||||
###### Synchronous
|
||||
|
||||
If `fn` returns or throws an error, the pipeline fails and `done` is invoked
|
||||
with that error.
|
||||
|
||||
If `fn` returns a value (neither `null` nor `undefined`), the first `input` of
|
||||
the next function is set to that value (all other `input` is passed through).
|
||||
|
||||
The following example shows how returning an error stops the pipeline:
|
||||
|
||||
```js
|
||||
var trough = require('trough')
|
||||
|
||||
trough()
|
||||
.use(function(val) {
|
||||
return new Error('Got: ' + val)
|
||||
})
|
||||
.run('some value', console.log)
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```txt
|
||||
Error: Got: some value
|
||||
at ~/example.js:5:12
|
||||
…
|
||||
```
|
||||
|
||||
The following example shows how throwing an error stops the pipeline:
|
||||
|
||||
```js
|
||||
var trough = require('trough')
|
||||
|
||||
trough()
|
||||
.use(function(val) {
|
||||
throw new Error('Got: ' + val)
|
||||
})
|
||||
.run('more value', console.log)
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```txt
|
||||
Error: Got: more value
|
||||
at ~/example.js:5:11
|
||||
…
|
||||
```
|
||||
|
||||
The following example shows how the first output can be modified:
|
||||
|
||||
```js
|
||||
var trough = require('trough')
|
||||
|
||||
trough()
|
||||
.use(function(val) {
|
||||
return 'even ' + val
|
||||
})
|
||||
.run('more value', 'untouched', console.log)
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```txt
|
||||
null 'even more value' 'untouched'
|
||||
```
|
||||
|
||||
###### Promise
|
||||
|
||||
If `fn` returns a promise, and that promise rejects, the pipeline fails and
|
||||
`done` is invoked with the rejected value.
|
||||
|
||||
If `fn` returns a promise, and that promise resolves with a value (neither
|
||||
`null` nor `undefined`), the first `input` of the next function is set to that
|
||||
value (all other `input` is passed through).
|
||||
|
||||
The following example shows how rejecting a promise stops the pipeline:
|
||||
|
||||
```js
|
||||
var trough = require('trough')
|
||||
|
||||
trough()
|
||||
.use(function(val) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
reject('Got: ' + val)
|
||||
})
|
||||
})
|
||||
.run('val', console.log)
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```txt
|
||||
Got: val
|
||||
```
|
||||
|
||||
The following example shows how the input isn’t touched by resolving to `null`.
|
||||
|
||||
```js
|
||||
var trough = require('trough')
|
||||
|
||||
trough()
|
||||
.use(function() {
|
||||
return new Promise(function(resolve) {
|
||||
setTimeout(function() {
|
||||
resolve(null)
|
||||
}, 100)
|
||||
})
|
||||
})
|
||||
.run('Input', console.log)
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```txt
|
||||
null 'Input'
|
||||
```
|
||||
|
||||
###### Asynchronous
|
||||
|
||||
If `fn` accepts one more argument than the given `input`, a `next` function is
|
||||
given (after the input). `next` must be called, but doesn’t have to be called
|
||||
async.
|
||||
|
||||
If `next` is given a value (neither `null` nor `undefined`) as its first
|
||||
argument, the pipeline fails and `done` is invoked with that value.
|
||||
|
||||
If `next` is given no value (either `null` or `undefined`) as the first
|
||||
argument, all following non-nully values change the input of the following
|
||||
function, and all nully values default to the `input`.
|
||||
|
||||
The following example shows how passing a first argument stops the pipeline:
|
||||
|
||||
```js
|
||||
var trough = require('trough')
|
||||
|
||||
trough()
|
||||
.use(function(val, next) {
|
||||
next(new Error('Got: ' + val))
|
||||
})
|
||||
.run('val', console.log)
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```txt
|
||||
Error: Got: val
|
||||
at ~/example.js:5:10
|
||||
```
|
||||
|
||||
The following example shows how more values than the input are passed.
|
||||
|
||||
```js
|
||||
var trough = require('trough')
|
||||
|
||||
trough()
|
||||
.use(function(val, next) {
|
||||
setTimeout(function() {
|
||||
next(null, null, 'values')
|
||||
}, 100)
|
||||
})
|
||||
.run('some', console.log)
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```txt
|
||||
null 'some' 'values'
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT][license] © [Titus Wormer][author]
|
||||
|
||||
<!-- Definitions -->
|
||||
|
||||
[build-badge]: https://img.shields.io/travis/wooorm/trough.svg
|
||||
|
||||
[build]: https://travis-ci.org/wooorm/trough
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/trough.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/wooorm/trough
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/trough.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/trough
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/trough.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=trough
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[ware]: https://github.com/segmentio/ware
|
||||
|
||||
[trough]: #trough-1
|
||||
|
||||
[use]: #troughusefn
|
||||
|
||||
[run]: #troughruninput-done
|
||||
|
||||
[fn]: #function-fninput-next
|
||||
|
||||
[done]: #function-doneerr-output
|
||||
|
||||
[async]: #asynchronous
|
||||
64
node_modules/react-markdown/node_modules/trough/wrap.js
generated
vendored
Normal file
64
node_modules/react-markdown/node_modules/trough/wrap.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
'use strict'
|
||||
|
||||
var slice = [].slice
|
||||
|
||||
module.exports = wrap
|
||||
|
||||
// Wrap `fn`.
|
||||
// Can be sync or async; return a promise, receive a completion handler, return
|
||||
// new values and errors.
|
||||
function wrap(fn, callback) {
|
||||
var invoked
|
||||
|
||||
return wrapped
|
||||
|
||||
function wrapped() {
|
||||
var params = slice.call(arguments, 0)
|
||||
var callback = fn.length > params.length
|
||||
var result
|
||||
|
||||
if (callback) {
|
||||
params.push(done)
|
||||
}
|
||||
|
||||
try {
|
||||
result = fn.apply(null, params)
|
||||
} catch (error) {
|
||||
// Well, this is quite the pickle.
|
||||
// `fn` received a callback and invoked it (thus continuing the pipeline),
|
||||
// but later also threw an error.
|
||||
// We’re not about to restart the pipeline again, so the only thing left
|
||||
// to do is to throw the thing instead.
|
||||
if (callback && invoked) {
|
||||
throw error
|
||||
}
|
||||
|
||||
return done(error)
|
||||
}
|
||||
|
||||
if (!callback) {
|
||||
if (result && typeof result.then === 'function') {
|
||||
result.then(then, done)
|
||||
} else if (result instanceof Error) {
|
||||
done(result)
|
||||
} else {
|
||||
then(result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Invoke `next`, only once.
|
||||
function done() {
|
||||
if (!invoked) {
|
||||
invoked = true
|
||||
|
||||
callback.apply(null, arguments)
|
||||
}
|
||||
}
|
||||
|
||||
// Invoke `done` with one value.
|
||||
// Tracks if an error is passed, too.
|
||||
function then(value) {
|
||||
done(null, value)
|
||||
}
|
||||
}
|
||||
460
node_modules/react-markdown/node_modules/unified/index.js
generated
vendored
Normal file
460
node_modules/react-markdown/node_modules/unified/index.js
generated
vendored
Normal file
@@ -0,0 +1,460 @@
|
||||
'use strict'
|
||||
|
||||
var bail = require('bail')
|
||||
var buffer = require('is-buffer')
|
||||
var extend = require('extend')
|
||||
var plain = require('is-plain-obj')
|
||||
var trough = require('trough')
|
||||
var vfile = require('vfile')
|
||||
|
||||
// Expose a frozen processor.
|
||||
module.exports = unified().freeze()
|
||||
|
||||
var slice = [].slice
|
||||
var own = {}.hasOwnProperty
|
||||
|
||||
// Process pipeline.
|
||||
var pipeline = trough()
|
||||
.use(pipelineParse)
|
||||
.use(pipelineRun)
|
||||
.use(pipelineStringify)
|
||||
|
||||
function pipelineParse(p, ctx) {
|
||||
ctx.tree = p.parse(ctx.file)
|
||||
}
|
||||
|
||||
function pipelineRun(p, ctx, next) {
|
||||
p.run(ctx.tree, ctx.file, done)
|
||||
|
||||
function done(error, tree, file) {
|
||||
if (error) {
|
||||
next(error)
|
||||
} else {
|
||||
ctx.tree = tree
|
||||
ctx.file = file
|
||||
next()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function pipelineStringify(p, ctx) {
|
||||
var result = p.stringify(ctx.tree, ctx.file)
|
||||
|
||||
if (result === undefined || result === null) {
|
||||
// Empty.
|
||||
} else if (typeof result === 'string' || buffer(result)) {
|
||||
if ('value' in ctx.file) {
|
||||
ctx.file.value = result
|
||||
}
|
||||
|
||||
ctx.file.contents = result
|
||||
} else {
|
||||
ctx.file.result = result
|
||||
}
|
||||
}
|
||||
|
||||
// Function to create the first processor.
|
||||
function unified() {
|
||||
var attachers = []
|
||||
var transformers = trough()
|
||||
var namespace = {}
|
||||
var freezeIndex = -1
|
||||
var frozen
|
||||
|
||||
// Data management.
|
||||
processor.data = data
|
||||
|
||||
// Lock.
|
||||
processor.freeze = freeze
|
||||
|
||||
// Plugins.
|
||||
processor.attachers = attachers
|
||||
processor.use = use
|
||||
|
||||
// API.
|
||||
processor.parse = parse
|
||||
processor.stringify = stringify
|
||||
processor.run = run
|
||||
processor.runSync = runSync
|
||||
processor.process = process
|
||||
processor.processSync = processSync
|
||||
|
||||
// Expose.
|
||||
return processor
|
||||
|
||||
// Create a new processor based on the processor in the current scope.
|
||||
function processor() {
|
||||
var destination = unified()
|
||||
var index = -1
|
||||
|
||||
while (++index < attachers.length) {
|
||||
destination.use.apply(null, attachers[index])
|
||||
}
|
||||
|
||||
destination.data(extend(true, {}, namespace))
|
||||
|
||||
return destination
|
||||
}
|
||||
|
||||
// Freeze: used to signal a processor that has finished configuration.
|
||||
//
|
||||
// For example, take unified itself: it’s frozen.
|
||||
// Plugins should not be added to it.
|
||||
// Rather, it should be extended, by invoking it, before modifying it.
|
||||
//
|
||||
// In essence, always invoke this when exporting a processor.
|
||||
function freeze() {
|
||||
var values
|
||||
var transformer
|
||||
|
||||
if (frozen) {
|
||||
return processor
|
||||
}
|
||||
|
||||
while (++freezeIndex < attachers.length) {
|
||||
values = attachers[freezeIndex]
|
||||
|
||||
if (values[1] === false) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (values[1] === true) {
|
||||
values[1] = undefined
|
||||
}
|
||||
|
||||
transformer = values[0].apply(processor, values.slice(1))
|
||||
|
||||
if (typeof transformer === 'function') {
|
||||
transformers.use(transformer)
|
||||
}
|
||||
}
|
||||
|
||||
frozen = true
|
||||
freezeIndex = Infinity
|
||||
|
||||
return processor
|
||||
}
|
||||
|
||||
// Data management.
|
||||
// Getter / setter for processor-specific informtion.
|
||||
function data(key, value) {
|
||||
if (typeof key === 'string') {
|
||||
// Set `key`.
|
||||
if (arguments.length === 2) {
|
||||
assertUnfrozen('data', frozen)
|
||||
namespace[key] = value
|
||||
return processor
|
||||
}
|
||||
|
||||
// Get `key`.
|
||||
return (own.call(namespace, key) && namespace[key]) || null
|
||||
}
|
||||
|
||||
// Set space.
|
||||
if (key) {
|
||||
assertUnfrozen('data', frozen)
|
||||
namespace = key
|
||||
return processor
|
||||
}
|
||||
|
||||
// Get space.
|
||||
return namespace
|
||||
}
|
||||
|
||||
// Plugin management.
|
||||
//
|
||||
// Pass it:
|
||||
// * an attacher and options,
|
||||
// * a preset,
|
||||
// * a list of presets, attachers, and arguments (list of attachers and
|
||||
// options).
|
||||
function use(value) {
|
||||
var settings
|
||||
|
||||
assertUnfrozen('use', frozen)
|
||||
|
||||
if (value === null || value === undefined) {
|
||||
// Empty.
|
||||
} else if (typeof value === 'function') {
|
||||
addPlugin.apply(null, arguments)
|
||||
} else if (typeof value === 'object') {
|
||||
if ('length' in value) {
|
||||
addList(value)
|
||||
} else {
|
||||
addPreset(value)
|
||||
}
|
||||
} else {
|
||||
throw new Error('Expected usable value, not `' + value + '`')
|
||||
}
|
||||
|
||||
if (settings) {
|
||||
namespace.settings = extend(namespace.settings || {}, settings)
|
||||
}
|
||||
|
||||
return processor
|
||||
|
||||
function addPreset(result) {
|
||||
addList(result.plugins)
|
||||
|
||||
if (result.settings) {
|
||||
settings = extend(settings || {}, result.settings)
|
||||
}
|
||||
}
|
||||
|
||||
function add(value) {
|
||||
if (typeof value === 'function') {
|
||||
addPlugin(value)
|
||||
} else if (typeof value === 'object') {
|
||||
if ('length' in value) {
|
||||
addPlugin.apply(null, value)
|
||||
} else {
|
||||
addPreset(value)
|
||||
}
|
||||
} else {
|
||||
throw new Error('Expected usable value, not `' + value + '`')
|
||||
}
|
||||
}
|
||||
|
||||
function addList(plugins) {
|
||||
var index = -1
|
||||
|
||||
if (plugins === null || plugins === undefined) {
|
||||
// Empty.
|
||||
} else if (typeof plugins === 'object' && 'length' in plugins) {
|
||||
while (++index < plugins.length) {
|
||||
add(plugins[index])
|
||||
}
|
||||
} else {
|
||||
throw new Error('Expected a list of plugins, not `' + plugins + '`')
|
||||
}
|
||||
}
|
||||
|
||||
function addPlugin(plugin, value) {
|
||||
var entry = find(plugin)
|
||||
|
||||
if (entry) {
|
||||
if (plain(entry[1]) && plain(value)) {
|
||||
value = extend(true, entry[1], value)
|
||||
}
|
||||
|
||||
entry[1] = value
|
||||
} else {
|
||||
attachers.push(slice.call(arguments))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function find(plugin) {
|
||||
var index = -1
|
||||
|
||||
while (++index < attachers.length) {
|
||||
if (attachers[index][0] === plugin) {
|
||||
return attachers[index]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Parse a file (in string or vfile representation) into a unist node using
|
||||
// the `Parser` on the processor.
|
||||
function parse(doc) {
|
||||
var file = vfile(doc)
|
||||
var Parser
|
||||
|
||||
freeze()
|
||||
Parser = processor.Parser
|
||||
assertParser('parse', Parser)
|
||||
|
||||
if (newable(Parser, 'parse')) {
|
||||
return new Parser(String(file), file).parse()
|
||||
}
|
||||
|
||||
return Parser(String(file), file) // eslint-disable-line new-cap
|
||||
}
|
||||
|
||||
// Run transforms on a unist node representation of a file (in string or
|
||||
// vfile representation), async.
|
||||
function run(node, file, cb) {
|
||||
assertNode(node)
|
||||
freeze()
|
||||
|
||||
if (!cb && typeof file === 'function') {
|
||||
cb = file
|
||||
file = null
|
||||
}
|
||||
|
||||
if (!cb) {
|
||||
return new Promise(executor)
|
||||
}
|
||||
|
||||
executor(null, cb)
|
||||
|
||||
function executor(resolve, reject) {
|
||||
transformers.run(node, vfile(file), done)
|
||||
|
||||
function done(error, tree, file) {
|
||||
tree = tree || node
|
||||
if (error) {
|
||||
reject(error)
|
||||
} else if (resolve) {
|
||||
resolve(tree)
|
||||
} else {
|
||||
cb(null, tree, file)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Run transforms on a unist node representation of a file (in string or
|
||||
// vfile representation), sync.
|
||||
function runSync(node, file) {
|
||||
var result
|
||||
var complete
|
||||
|
||||
run(node, file, done)
|
||||
|
||||
assertDone('runSync', 'run', complete)
|
||||
|
||||
return result
|
||||
|
||||
function done(error, tree) {
|
||||
complete = true
|
||||
result = tree
|
||||
bail(error)
|
||||
}
|
||||
}
|
||||
|
||||
// Stringify a unist node representation of a file (in string or vfile
|
||||
// representation) into a string using the `Compiler` on the processor.
|
||||
function stringify(node, doc) {
|
||||
var file = vfile(doc)
|
||||
var Compiler
|
||||
|
||||
freeze()
|
||||
Compiler = processor.Compiler
|
||||
assertCompiler('stringify', Compiler)
|
||||
assertNode(node)
|
||||
|
||||
if (newable(Compiler, 'compile')) {
|
||||
return new Compiler(node, file).compile()
|
||||
}
|
||||
|
||||
return Compiler(node, file) // eslint-disable-line new-cap
|
||||
}
|
||||
|
||||
// Parse a file (in string or vfile representation) into a unist node using
|
||||
// the `Parser` on the processor, then run transforms on that node, and
|
||||
// compile the resulting node using the `Compiler` on the processor, and
|
||||
// store that result on the vfile.
|
||||
function process(doc, cb) {
|
||||
freeze()
|
||||
assertParser('process', processor.Parser)
|
||||
assertCompiler('process', processor.Compiler)
|
||||
|
||||
if (!cb) {
|
||||
return new Promise(executor)
|
||||
}
|
||||
|
||||
executor(null, cb)
|
||||
|
||||
function executor(resolve, reject) {
|
||||
var file = vfile(doc)
|
||||
|
||||
pipeline.run(processor, {file: file}, done)
|
||||
|
||||
function done(error) {
|
||||
if (error) {
|
||||
reject(error)
|
||||
} else if (resolve) {
|
||||
resolve(file)
|
||||
} else {
|
||||
cb(null, file)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Process the given document (in string or vfile representation), sync.
|
||||
function processSync(doc) {
|
||||
var file
|
||||
var complete
|
||||
|
||||
freeze()
|
||||
assertParser('processSync', processor.Parser)
|
||||
assertCompiler('processSync', processor.Compiler)
|
||||
file = vfile(doc)
|
||||
|
||||
process(file, done)
|
||||
|
||||
assertDone('processSync', 'process', complete)
|
||||
|
||||
return file
|
||||
|
||||
function done(error) {
|
||||
complete = true
|
||||
bail(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if `value` is a constructor.
|
||||
function newable(value, name) {
|
||||
return (
|
||||
typeof value === 'function' &&
|
||||
value.prototype &&
|
||||
// A function with keys in its prototype is probably a constructor.
|
||||
// Classes’ prototype methods are not enumerable, so we check if some value
|
||||
// exists in the prototype.
|
||||
(keys(value.prototype) || name in value.prototype)
|
||||
)
|
||||
}
|
||||
|
||||
// Check if `value` is an object with keys.
|
||||
function keys(value) {
|
||||
var key
|
||||
for (key in value) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// Assert a parser is available.
|
||||
function assertParser(name, Parser) {
|
||||
if (typeof Parser !== 'function') {
|
||||
throw new Error('Cannot `' + name + '` without `Parser`')
|
||||
}
|
||||
}
|
||||
|
||||
// Assert a compiler is available.
|
||||
function assertCompiler(name, Compiler) {
|
||||
if (typeof Compiler !== 'function') {
|
||||
throw new Error('Cannot `' + name + '` without `Compiler`')
|
||||
}
|
||||
}
|
||||
|
||||
// Assert the processor is not frozen.
|
||||
function assertUnfrozen(name, frozen) {
|
||||
if (frozen) {
|
||||
throw new Error(
|
||||
'Cannot invoke `' +
|
||||
name +
|
||||
'` on a frozen processor.\nCreate a new processor first, by invoking it: use `processor()` instead of `processor`.'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Assert `node` is a unist node.
|
||||
function assertNode(node) {
|
||||
if (!node || typeof node.type !== 'string') {
|
||||
throw new Error('Expected node, got `' + node + '`')
|
||||
}
|
||||
}
|
||||
|
||||
// Assert that `complete` is `true`.
|
||||
function assertDone(name, asyncName, complete) {
|
||||
if (!complete) {
|
||||
throw new Error(
|
||||
'`' + name + '` finished async. Use `' + asyncName + '` instead'
|
||||
)
|
||||
}
|
||||
}
|
||||
21
node_modules/react-markdown/node_modules/unified/license
generated
vendored
Normal file
21
node_modules/react-markdown/node_modules/unified/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
(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.
|
||||
114
node_modules/react-markdown/node_modules/unified/package.json
generated
vendored
Normal file
114
node_modules/react-markdown/node_modules/unified/package.json
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
{
|
||||
"name": "unified",
|
||||
"version": "9.2.2",
|
||||
"description": "Interface for parsing, inspecting, transforming, and serializing content through syntax trees",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"unified",
|
||||
"process",
|
||||
"parse",
|
||||
"transform",
|
||||
"compile",
|
||||
"stringify",
|
||||
"serialize",
|
||||
"ast",
|
||||
"cst",
|
||||
"syntax",
|
||||
"tree",
|
||||
"content",
|
||||
"rehype",
|
||||
"retext",
|
||||
"remark"
|
||||
],
|
||||
"homepage": "https://unifiedjs.com",
|
||||
"repository": "unifiedjs/unified",
|
||||
"bugs": "https://github.com/unifiedjs/unified/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)",
|
||||
"Junyoung Choi <fluke8259@gmail.com>",
|
||||
"Hernan Rajchert <hrajchert@gmail.com>",
|
||||
"Christian Murphy <christian.murphy.42@gmail.com>",
|
||||
"Vse Mozhet Byt <vsemozhetbyt@gmail.com>",
|
||||
"Richard Littauer <richard.littauer@gmail.com>"
|
||||
],
|
||||
"types": "types/ts3.4/index.d.ts",
|
||||
"typesVersions": {
|
||||
">=4.0": {
|
||||
"types/ts3.4/*": [
|
||||
"types/ts4.0/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"types/ts3.4/index.d.ts",
|
||||
"types/ts4.0/index.d.ts",
|
||||
"index.js",
|
||||
"lib"
|
||||
],
|
||||
"dependencies": {
|
||||
"bail": "^1.0.0",
|
||||
"extend": "^3.0.0",
|
||||
"is-buffer": "^2.0.0",
|
||||
"is-plain-obj": "^2.0.0",
|
||||
"trough": "^1.0.0",
|
||||
"vfile": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vfile5": "npm:vfile@5",
|
||||
"browserify": "^17.0.0",
|
||||
"c8": "^7.0.0",
|
||||
"dtslint": "^4.0.0",
|
||||
"prettier": "^2.0.0",
|
||||
"remark-cli": "^9.0.0",
|
||||
"remark-preset-wooorm": "^8.0.0",
|
||||
"tape": "^5.0.0",
|
||||
"tinyify": "^3.0.0",
|
||||
"xo": "^0.38.0"
|
||||
},
|
||||
"scripts": {
|
||||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
|
||||
"build-bundle": "browserify index.js -s unified -o unified.js",
|
||||
"build-mangle": "browserify index.js -s unified -p tinyify -o unified.min.js",
|
||||
"build": "npm run build-bundle && npm run build-mangle",
|
||||
"test-api": "node test",
|
||||
"test-coverage": "c8 --check-coverage --lines 100 --functions 100 --branches 100 --reporter lcov tape test",
|
||||
"test-types": "npm run test-types-3.4 && npm run test-types-4.0",
|
||||
"test-types-3.4": "dtslint types/ts3.4",
|
||||
"test-types-4.0": "dtslint types/ts4.0",
|
||||
"test": "npm run format && npm run build && npm run test-coverage && npm run test-types"
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false,
|
||||
"rules": {
|
||||
"guard-for-in": "off",
|
||||
"no-unreachable-loop": "off",
|
||||
"unicorn/prefer-number-properties": "off",
|
||||
"unicorn/prefer-optional-catch-binding": "off",
|
||||
"unicorn/prefer-reflect-apply": "off",
|
||||
"unicorn/prefer-type-error": "off"
|
||||
},
|
||||
"ignores": [
|
||||
"types",
|
||||
"unified.js"
|
||||
]
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
}
|
||||
}
|
||||
1386
node_modules/react-markdown/node_modules/unified/readme.md
generated
vendored
Normal file
1386
node_modules/react-markdown/node_modules/unified/readme.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
407
node_modules/react-markdown/node_modules/unified/types/ts3.4/index.d.ts
generated
vendored
Normal file
407
node_modules/react-markdown/node_modules/unified/types/ts3.4/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,407 @@
|
||||
// TypeScript Version: 3.4
|
||||
|
||||
import {Node} from 'unist'
|
||||
import {VFile, VFileCompatible} from 'vfile'
|
||||
|
||||
declare namespace unified {
|
||||
/**
|
||||
* Processor allows plugins, parsers, and compilers to be chained together to transform content.
|
||||
*
|
||||
* @typeParam P Processor settings. Useful when packaging unified with a preset parser and compiler.
|
||||
*/
|
||||
interface Processor<P = Settings> extends FrozenProcessor<P> {
|
||||
/**
|
||||
* Configure the processor to use a plugin and optionally configure that plugin with options.
|
||||
*
|
||||
* @param plugin unified plugin
|
||||
* @param settings Configuration for plugin
|
||||
* @typeParam S Plugin settings
|
||||
* @returns The processor on which use is invoked
|
||||
*/
|
||||
use<S extends any[] = [Settings?]>(
|
||||
plugin: Plugin<S, P>,
|
||||
...settings: S
|
||||
): Processor<P>
|
||||
|
||||
/**
|
||||
* Configure the processor with a preset to use
|
||||
*
|
||||
* @param preset `Object` with an plugins (set to list), and/or an optional settings object
|
||||
*/
|
||||
use<S extends any[] = [Settings?]>(preset: Preset<S, P>): Processor<P>
|
||||
|
||||
/**
|
||||
* Configure using a tuple of plugin and setting(s)
|
||||
*
|
||||
* @param pluginTuple pairs, plugin and settings in an array
|
||||
* @typeParam S Plugin settings
|
||||
*/
|
||||
use<S extends any[] = [Settings?]>(
|
||||
pluginTuple: PluginTuple<S, P>
|
||||
): Processor<P>
|
||||
|
||||
/**
|
||||
* A list of plugins and presets to be applied to processor
|
||||
*
|
||||
* @param list List of plugins, presets, and pairs
|
||||
*/
|
||||
use(list: PluggableList<P>): Processor<P>
|
||||
|
||||
/**
|
||||
* Configuration passed to a frozen processor
|
||||
*
|
||||
* @param processorSettings Settings passed to processor
|
||||
*/
|
||||
use(processorSettings: ProcessorSettings<P>): Processor<P>
|
||||
}
|
||||
|
||||
/**
|
||||
* A frozen processor is just like a regular processor, except no additional plugins can be added.
|
||||
* A frozen processor can be created by calling `.freeze()` on a processor.
|
||||
*
|
||||
* See `Processor`.
|
||||
*/
|
||||
interface FrozenProcessor<P = Settings> {
|
||||
/**
|
||||
* Clone current processor
|
||||
*
|
||||
* @returns New unfrozen processor which is configured to function the same as its ancestor.
|
||||
* But when the descendant processor is configured in the future it does not affect the ancestral processor.
|
||||
*/
|
||||
(): Processor<P>
|
||||
|
||||
/**
|
||||
* Parse text to a syntax tree.
|
||||
*
|
||||
* @param file VFile or anything which can be given to vfile()
|
||||
* @returns Syntax tree representation of input.
|
||||
*/
|
||||
parse(file: VFileCompatible): Node
|
||||
|
||||
/**
|
||||
* Function handling the parsing of text to a syntax tree.
|
||||
* Used in the parse phase in the process and invoked with a `string` and `VFile` representation of the document to parse.
|
||||
*
|
||||
* `Parser` can be a normal function in which case it must return a `Node`: the syntax tree representation of the given file.
|
||||
*
|
||||
* `Parser` can also be a constructor function (a function with keys in its `prototype`) in which case it’s invoked with `new`.
|
||||
* Instances must have a parse method which is invoked without arguments and must return a `Node`.
|
||||
*/
|
||||
Parser: ParserConstructor | ParserFunction
|
||||
|
||||
/**
|
||||
* Compile a syntax tree to text.
|
||||
*
|
||||
* @param node unist node
|
||||
* @param file `VFile` or anything which can be given to `vfile()`
|
||||
* @returns String representation of the syntax tree file
|
||||
*/
|
||||
stringify(node: Node, file?: VFileCompatible): string
|
||||
|
||||
/**
|
||||
* Function handling the compilation of syntax tree to a text.
|
||||
* Used in the stringify phase in the process and invoked with a `Node` and `VFile` representation of the document to stringify.
|
||||
*
|
||||
* `Compiler` can be a normal function in which case it must return a `string`: the text representation of the given syntax tree.
|
||||
*
|
||||
* `Compiler` can also be a constructor function (a function with keys in its `prototype`) in which case it’s invoked with `new`.
|
||||
* Instances must have a `compile` method which is invoked without arguments and must return a `string`.
|
||||
*/
|
||||
Compiler: CompilerConstructor | CompilerFunction
|
||||
|
||||
/**
|
||||
* Transform a syntax tree by applying plugins to it.
|
||||
*
|
||||
* @param node Node to transform
|
||||
* @returns `Promise` if `done` is not given. Rejected with an error, or resolved with the resulting syntax tree.
|
||||
*/
|
||||
run(node: Node): Promise<Node>
|
||||
|
||||
/**
|
||||
* Transform a syntax tree by applying plugins to it.
|
||||
*
|
||||
* @param node Node to transform
|
||||
* @param file `VFile` or anything which can be given to `vfile()`
|
||||
* @returns `Promise` if `done` is not given. Rejected with an error, or resolved with the resulting syntax tree.
|
||||
*/
|
||||
run(node: Node, file: VFileCompatible): Promise<Node>
|
||||
|
||||
/**
|
||||
* Transform a syntax tree by applying plugins to it.
|
||||
*
|
||||
* @param node Node to transform
|
||||
* @param done Invoked when transformation is complete.
|
||||
*/
|
||||
run(node: Node, done: RunCallback): void
|
||||
|
||||
/**
|
||||
* Transform a syntax tree by applying plugins to it.
|
||||
*
|
||||
* @param node Node to transform
|
||||
* @param file `VFile` or anything which can be given to `vfile()`
|
||||
* @param done Invoked when transformation is complete.
|
||||
*/
|
||||
run(node: Node, file: VFileCompatible, done: RunCallback): void
|
||||
|
||||
/**
|
||||
* Transform a syntax tree by applying plugins to it.
|
||||
*
|
||||
* If asynchronous plugins are configured an error is thrown.
|
||||
*
|
||||
* @param node Node to transform
|
||||
* @param file `VFile` or anything which can be given to `vfile()`
|
||||
* @returns The given syntax tree.
|
||||
*/
|
||||
runSync(node: Node, file?: VFileCompatible): Node
|
||||
|
||||
/**
|
||||
* Process the given representation of a file as configured on the processor. The process invokes `parse`, `run`, and `stringify` internally.
|
||||
* @param file `VFile` or anything which can be given to `vfile()`
|
||||
* @returns `Promise` if `done` is not given.
|
||||
* Rejected with an error or resolved with the resulting file.
|
||||
*/
|
||||
process(file: VFileCompatible): Promise<VFile>
|
||||
|
||||
/**
|
||||
* Process the given representation of a file as configured on the processor. The process invokes `parse`, `run`, and `stringify` internally.
|
||||
* @param file `VFile` or anything which can be given to `vfile()`
|
||||
* @param done Invoked when the process is complete. Invoked with a fatal error, if any, and the VFile.
|
||||
*/
|
||||
process(file: VFileCompatible, done: ProcessCallback): void
|
||||
|
||||
/**
|
||||
* Process the given representation of a file as configured on the processor. The process invokes `parse`, `run`, and `stringify` internally.
|
||||
*
|
||||
* If asynchronous plugins are configured an error is thrown.
|
||||
*
|
||||
* @param file `VFile` or anything which can be given to `vfile()`
|
||||
* @returns Virtual file with modified contents.
|
||||
*/
|
||||
processSync(file: VFileCompatible): VFile
|
||||
|
||||
/**
|
||||
* Get or set information in an in-memory key-value store accessible to all phases of the process.
|
||||
* An example is a list of HTML elements which are self-closing, which is needed when parsing, transforming, and compiling HTML.
|
||||
*
|
||||
* @returns key-value store object
|
||||
*/
|
||||
data(): {[key: string]: unknown}
|
||||
|
||||
/**
|
||||
* @param key Identifier
|
||||
* @returns If getting, the value at key
|
||||
*/
|
||||
data(key: string): unknown
|
||||
|
||||
/**
|
||||
* @param value Value to set. Omit if getting key
|
||||
* @returns If setting, the processor on which data is invoked
|
||||
*/
|
||||
data(key: string, value: any): Processor<P>
|
||||
|
||||
/**
|
||||
* Freeze a processor. Frozen processors are meant to be extended and not to be configured or processed directly.
|
||||
*
|
||||
* Once a processor is frozen it cannot be unfrozen. New processors functioning just like it can be created by invoking the processor.
|
||||
*
|
||||
* It’s possible to freeze processors explicitly, by calling `.freeze()`, but `.parse()`, `.run()`, `.stringify()`, and `.process()` call `.freeze()` to freeze a processor too.
|
||||
*
|
||||
* @returns The processor on which freeze is invoked.
|
||||
*/
|
||||
freeze(): FrozenProcessor<P>
|
||||
}
|
||||
|
||||
/**
|
||||
* A Plugin (Attacher) is the thing passed to `use`.
|
||||
* It configures the processor and in turn can receive options.
|
||||
*
|
||||
* Attachers can configure processors, such as by interacting with parsers and compilers, linking them to other processors, or by specifying how the syntax tree is handled.
|
||||
*
|
||||
* @param settings Configuration
|
||||
* @typeParam S Plugin settings
|
||||
* @typeParam P Processor settings
|
||||
* @returns Optional Transformer.
|
||||
*/
|
||||
type Plugin<S extends any[] = [Settings?], P = Settings> = Attacher<S, P>
|
||||
|
||||
/**
|
||||
* Configuration passed to a Plugin or Processor
|
||||
*/
|
||||
interface Settings {
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
/**
|
||||
* Presets provide a potentially sharable way to configure processors.
|
||||
* They can contain multiple plugins and optionally settings as well.
|
||||
*
|
||||
* @typeParam P Processor settings
|
||||
*/
|
||||
interface Preset<S = Settings, P = Settings> {
|
||||
plugins: PluggableList<P>
|
||||
settings?: Settings
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings can be passed directly to the processor
|
||||
*
|
||||
* @typeParam P Settings applied to a processor. Useful when packaging unified with a preset parser and compiler.
|
||||
*/
|
||||
interface ProcessorSettings<P = Settings> {
|
||||
settings: P
|
||||
}
|
||||
|
||||
/**
|
||||
* A pairing of a plugin with its settings
|
||||
*
|
||||
* @typeParam S Plugin settings
|
||||
* @typeParam P Processor settings
|
||||
*/
|
||||
type PluginTuple<S extends any[] = [Settings?], P = Settings> = [
|
||||
Plugin<S, P>,
|
||||
/**
|
||||
* NOTE: ideally this would be S instead of any[]
|
||||
* As of TypeScript 3.5.2 generic tuples cannot be spread
|
||||
* See: https://github.com/microsoft/TypeScript/issues/26113
|
||||
*/
|
||||
...any[]
|
||||
]
|
||||
|
||||
/**
|
||||
* A union of the different ways to add plugins to unified
|
||||
*
|
||||
* @typeParam S Plugin settings
|
||||
* @typeParam P Processor settings
|
||||
*/
|
||||
type Pluggable<S extends any[] = [Settings?], P = Settings> =
|
||||
| Plugin<S, P>
|
||||
| Preset<S, P>
|
||||
| PluginTuple<S, P>
|
||||
|
||||
/**
|
||||
* A list of plugins and presets
|
||||
*
|
||||
* @typeParam P Processor settings
|
||||
*/
|
||||
type PluggableList<P = Settings> = Array<Pluggable<[any?], P>>
|
||||
|
||||
/**
|
||||
* An attacher is the thing passed to `use`.
|
||||
* It configures the processor and in turn can receive options.
|
||||
*
|
||||
* Attachers can configure processors, such as by interacting with parsers and compilers, linking them to other processors, or by specifying how the syntax tree is handled.
|
||||
*
|
||||
* @param settings Configuration
|
||||
* @typeParam S Plugin settings
|
||||
* @typeParam P Processor settings
|
||||
* @returns Optional Transformer.
|
||||
*/
|
||||
type Attacher<S extends any[] = [Settings?], P = Settings> = (
|
||||
this: Processor<P>,
|
||||
...settings: S
|
||||
) => Transformer | void
|
||||
|
||||
/**
|
||||
* Transformers modify the syntax tree or metadata of a file. A transformer is a function which is invoked each time a file is passed through the transform phase.
|
||||
* If an error occurs (either because it’s thrown, returned, rejected, or passed to `next`), the process stops.
|
||||
*
|
||||
* The transformation process in unified is handled by `trough`, see it’s documentation for the exact semantics of transformers.
|
||||
*
|
||||
* @param node Node or tree to be transformed
|
||||
* @param file File associated with node or tree
|
||||
* @param next If the signature of a transformer includes `next` (third argument), the function may finish asynchronous, and must invoke `next()`.
|
||||
* @returns
|
||||
* - `void` — If nothing is returned, the next transformer keeps using same tree.
|
||||
* - `Error` — Can be returned to stop the process
|
||||
* - `Node` — Can be returned and results in further transformations and `stringify`s to be performed on the new tree
|
||||
* - `Promise` — If a promise is returned, the function is asynchronous, and must be resolved (optionally with a `Node`) or rejected (optionally with an `Error`)
|
||||
*/
|
||||
type Transformer = (
|
||||
node: Node,
|
||||
file: VFile,
|
||||
next?: (
|
||||
error: Error | null,
|
||||
tree: Node,
|
||||
file: VFile
|
||||
) => Record<string, unknown>
|
||||
) => Error | Node | Promise<Node> | void | Promise<void>
|
||||
|
||||
/**
|
||||
* Transform file contents into an AST
|
||||
*/
|
||||
interface Parser {
|
||||
/**
|
||||
* Transform file contents into an AST
|
||||
*
|
||||
* @returns Parsed AST node/tree
|
||||
*/
|
||||
parse(): Node
|
||||
}
|
||||
|
||||
/**
|
||||
* A constructor function (a function with keys in its `prototype`) or class that implements a
|
||||
* `parse` method.
|
||||
*/
|
||||
type ParserConstructor = new (text: string, file: VFile) => Parser
|
||||
|
||||
/**
|
||||
* Transform file contents into an AST
|
||||
*
|
||||
* @param text Text to transform into AST node(s)
|
||||
* @param file File associated with text
|
||||
* @returns Parsed AST node/tree
|
||||
*/
|
||||
type ParserFunction = (text: string, file: VFile) => Node
|
||||
|
||||
/**
|
||||
* Transform an AST node/tree into text
|
||||
*/
|
||||
interface Compiler {
|
||||
/**
|
||||
* Transform an AST node/tree into text
|
||||
*
|
||||
* @returns Compiled text
|
||||
*/
|
||||
compile(): string
|
||||
}
|
||||
|
||||
/**
|
||||
* A constructor function (a function with keys in its `prototype`) or class that implements a
|
||||
* `compile` method.
|
||||
*/
|
||||
type CompilerConstructor = new (node: Node, file: VFile) => Compiler
|
||||
|
||||
/**
|
||||
* Transform an AST node/tree into text
|
||||
*
|
||||
* @param node Node/tree to be stringified
|
||||
* @param file File associated with node
|
||||
* @returns Compiled text
|
||||
*/
|
||||
type CompilerFunction = (node: Node, file: VFile) => string
|
||||
|
||||
/**
|
||||
* Access results from transforms
|
||||
*
|
||||
* @param error Error if any occurred
|
||||
* @param node Transformed AST tree/node
|
||||
* @param vfile File associated with node
|
||||
*/
|
||||
type RunCallback = (error: Error | null, node: Node, file: VFile) => void
|
||||
|
||||
/**
|
||||
* Access results from transforms
|
||||
*
|
||||
* @param error Error if any occurred
|
||||
* @param vfile File with updated content
|
||||
*/
|
||||
type ProcessCallback = (error: Error | null, file: VFile) => void
|
||||
}
|
||||
|
||||
/**
|
||||
* Unified processor allows plugins, parsers, and compilers to be chained together to transform content.
|
||||
*
|
||||
* @typeParam P Processor settings. Useful when packaging unified with a preset parser and compiler.
|
||||
*/
|
||||
declare function unified<P = unified.Settings>(): unified.Processor<P>
|
||||
export = unified
|
||||
402
node_modules/react-markdown/node_modules/unified/types/ts4.0/index.d.ts
generated
vendored
Normal file
402
node_modules/react-markdown/node_modules/unified/types/ts4.0/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,402 @@
|
||||
// TypeScript Version: 4.0
|
||||
|
||||
import {Node} from 'unist'
|
||||
import {VFile, VFileCompatible} from 'vfile'
|
||||
|
||||
declare namespace unified {
|
||||
/**
|
||||
* Processor allows plugins, parsers, and compilers to be chained together to transform content.
|
||||
*
|
||||
* @typeParam P Processor settings. Useful when packaging unified with a preset parser and compiler.
|
||||
*/
|
||||
interface Processor<P = Settings> extends FrozenProcessor<P> {
|
||||
/**
|
||||
* Configure the processor to use a plugin and optionally configure that plugin with options.
|
||||
*
|
||||
* @param plugin unified plugin
|
||||
* @param settings Configuration for plugin
|
||||
* @typeParam S Plugin settings
|
||||
* @returns The processor on which use is invoked
|
||||
*/
|
||||
use<S extends any[] = [Settings?]>(
|
||||
plugin: Plugin<S, P>,
|
||||
...settings: S
|
||||
): Processor<P>
|
||||
|
||||
/**
|
||||
* Configure the processor with a preset to use
|
||||
*
|
||||
* @param preset `Object` with an plugins (set to list), and/or an optional settings object
|
||||
*/
|
||||
use<S extends any[] = [Settings?]>(preset: Preset<S, P>): Processor<P>
|
||||
|
||||
/**
|
||||
* Configure using a tuple of plugin and setting(s)
|
||||
*
|
||||
* @param pluginTuple pairs, plugin and settings in an array
|
||||
* @typeParam S Plugin settings
|
||||
*/
|
||||
use<S extends any[] = [Settings?]>(
|
||||
pluginTuple: PluginTuple<S, P>
|
||||
): Processor<P>
|
||||
|
||||
/**
|
||||
* A list of plugins and presets to be applied to processor
|
||||
*
|
||||
* @param list List of plugins, presets, and pairs
|
||||
*/
|
||||
use(list: PluggableList<P>): Processor<P>
|
||||
|
||||
/**
|
||||
* Configuration passed to a frozen processor
|
||||
*
|
||||
* @param processorSettings Settings passed to processor
|
||||
*/
|
||||
use(processorSettings: ProcessorSettings<P>): Processor<P>
|
||||
}
|
||||
|
||||
/**
|
||||
* A frozen processor is just like a regular processor, except no additional plugins can be added.
|
||||
* A frozen processor can be created by calling `.freeze()` on a processor.
|
||||
*
|
||||
* See `Processor`.
|
||||
*/
|
||||
interface FrozenProcessor<P = Settings> {
|
||||
/**
|
||||
* Clone current processor
|
||||
*
|
||||
* @returns New unfrozen processor which is configured to function the same as its ancestor.
|
||||
* But when the descendant processor is configured in the future it does not affect the ancestral processor.
|
||||
*/
|
||||
(): Processor<P>
|
||||
|
||||
/**
|
||||
* Parse text to a syntax tree.
|
||||
*
|
||||
* @param file VFile or anything which can be given to vfile()
|
||||
* @returns Syntax tree representation of input.
|
||||
*/
|
||||
parse(file: VFileCompatible): Node
|
||||
|
||||
/**
|
||||
* Function handling the parsing of text to a syntax tree.
|
||||
* Used in the parse phase in the process and invoked with a `string` and `VFile` representation of the document to parse.
|
||||
*
|
||||
* `Parser` can be a normal function in which case it must return a `Node`: the syntax tree representation of the given file.
|
||||
*
|
||||
* `Parser` can also be a constructor function (a function with keys in its `prototype`) in which case it’s invoked with `new`.
|
||||
* Instances must have a parse method which is invoked without arguments and must return a `Node`.
|
||||
*/
|
||||
Parser: ParserConstructor | ParserFunction
|
||||
|
||||
/**
|
||||
* Compile a syntax tree to text.
|
||||
*
|
||||
* @param node unist node
|
||||
* @param file `VFile` or anything which can be given to `vfile()`
|
||||
* @returns String representation of the syntax tree file
|
||||
*/
|
||||
stringify(node: Node, file?: VFileCompatible): string
|
||||
|
||||
/**
|
||||
* Function handling the compilation of syntax tree to a text.
|
||||
* Used in the stringify phase in the process and invoked with a `Node` and `VFile` representation of the document to stringify.
|
||||
*
|
||||
* `Compiler` can be a normal function in which case it must return a `string`: the text representation of the given syntax tree.
|
||||
*
|
||||
* `Compiler` can also be a constructor function (a function with keys in its `prototype`) in which case it’s invoked with `new`.
|
||||
* Instances must have a `compile` method which is invoked without arguments and must return a `string`.
|
||||
*/
|
||||
Compiler: CompilerConstructor | CompilerFunction
|
||||
|
||||
/**
|
||||
* Transform a syntax tree by applying plugins to it.
|
||||
*
|
||||
* @param node Node to transform
|
||||
* @returns `Promise` if `done` is not given. Rejected with an error, or resolved with the resulting syntax tree.
|
||||
*/
|
||||
run(node: Node): Promise<Node>
|
||||
|
||||
/**
|
||||
* Transform a syntax tree by applying plugins to it.
|
||||
*
|
||||
* @param node Node to transform
|
||||
* @param file `VFile` or anything which can be given to `vfile()`
|
||||
* @returns `Promise` if `done` is not given. Rejected with an error, or resolved with the resulting syntax tree.
|
||||
*/
|
||||
run(node: Node, file: VFileCompatible): Promise<Node>
|
||||
|
||||
/**
|
||||
* Transform a syntax tree by applying plugins to it.
|
||||
*
|
||||
* @param node Node to transform
|
||||
* @param done Invoked when transformation is complete.
|
||||
*/
|
||||
run(node: Node, done: RunCallback): void
|
||||
|
||||
/**
|
||||
* Transform a syntax tree by applying plugins to it.
|
||||
*
|
||||
* @param node Node to transform
|
||||
* @param file `VFile` or anything which can be given to `vfile()`
|
||||
* @param done Invoked when transformation is complete.
|
||||
*/
|
||||
run(node: Node, file: VFileCompatible, done: RunCallback): void
|
||||
|
||||
/**
|
||||
* Transform a syntax tree by applying plugins to it.
|
||||
*
|
||||
* If asynchronous plugins are configured an error is thrown.
|
||||
*
|
||||
* @param node Node to transform
|
||||
* @param file `VFile` or anything which can be given to `vfile()`
|
||||
* @returns The given syntax tree.
|
||||
*/
|
||||
runSync(node: Node, file?: VFileCompatible): Node
|
||||
|
||||
/**
|
||||
* Process the given representation of a file as configured on the processor. The process invokes `parse`, `run`, and `stringify` internally.
|
||||
* @param file `VFile` or anything which can be given to `vfile()`
|
||||
* @returns `Promise` if `done` is not given.
|
||||
* Rejected with an error or resolved with the resulting file.
|
||||
*/
|
||||
process(file: VFileCompatible): Promise<VFile>
|
||||
|
||||
/**
|
||||
* Process the given representation of a file as configured on the processor. The process invokes `parse`, `run`, and `stringify` internally.
|
||||
* @param file `VFile` or anything which can be given to `vfile()`
|
||||
* @param done Invoked when the process is complete. Invoked with a fatal error, if any, and the VFile.
|
||||
*/
|
||||
process(file: VFileCompatible, done: ProcessCallback): void
|
||||
|
||||
/**
|
||||
* Process the given representation of a file as configured on the processor. The process invokes `parse`, `run`, and `stringify` internally.
|
||||
*
|
||||
* If asynchronous plugins are configured an error is thrown.
|
||||
*
|
||||
* @param file `VFile` or anything which can be given to `vfile()`
|
||||
* @returns Virtual file with modified contents.
|
||||
*/
|
||||
processSync(file: VFileCompatible): VFile
|
||||
|
||||
/**
|
||||
* Get or set information in an in-memory key-value store accessible to all phases of the process.
|
||||
* An example is a list of HTML elements which are self-closing, which is needed when parsing, transforming, and compiling HTML.
|
||||
*
|
||||
* @returns key-value store object
|
||||
*/
|
||||
data(): {[key: string]: unknown}
|
||||
|
||||
/**
|
||||
* @param key Identifier
|
||||
* @returns If getting, the value at key
|
||||
*/
|
||||
data(key: string): unknown
|
||||
|
||||
/**
|
||||
* @param value Value to set. Omit if getting key
|
||||
* @returns If setting, the processor on which data is invoked
|
||||
*/
|
||||
data(key: string, value: any): Processor<P>
|
||||
|
||||
/**
|
||||
* Freeze a processor. Frozen processors are meant to be extended and not to be configured or processed directly.
|
||||
*
|
||||
* Once a processor is frozen it cannot be unfrozen. New processors functioning just like it can be created by invoking the processor.
|
||||
*
|
||||
* It’s possible to freeze processors explicitly, by calling `.freeze()`, but `.parse()`, `.run()`, `.stringify()`, and `.process()` call `.freeze()` to freeze a processor too.
|
||||
*
|
||||
* @returns The processor on which freeze is invoked.
|
||||
*/
|
||||
freeze(): FrozenProcessor<P>
|
||||
}
|
||||
|
||||
/**
|
||||
* A Plugin (Attacher) is the thing passed to `use`.
|
||||
* It configures the processor and in turn can receive options.
|
||||
*
|
||||
* Attachers can configure processors, such as by interacting with parsers and compilers, linking them to other processors, or by specifying how the syntax tree is handled.
|
||||
*
|
||||
* @param settings Configuration
|
||||
* @typeParam S Plugin settings
|
||||
* @typeParam P Processor settings
|
||||
* @returns Optional Transformer.
|
||||
*/
|
||||
type Plugin<S extends any[] = [Settings?], P = Settings> = Attacher<S, P>
|
||||
|
||||
/**
|
||||
* Configuration passed to a Plugin or Processor
|
||||
*/
|
||||
interface Settings {
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
/**
|
||||
* Presets provide a potentially sharable way to configure processors.
|
||||
* They can contain multiple plugins and optionally settings as well.
|
||||
*
|
||||
* @typeParam P Processor settings
|
||||
*/
|
||||
interface Preset<S = Settings, P = Settings> {
|
||||
plugins: PluggableList<P>
|
||||
settings?: Settings
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings can be passed directly to the processor
|
||||
*
|
||||
* @typeParam P Settings applied to a processor. Useful when packaging unified with a preset parser and compiler.
|
||||
*/
|
||||
interface ProcessorSettings<P = Settings> {
|
||||
settings: P
|
||||
}
|
||||
|
||||
/**
|
||||
* A pairing of a plugin with its settings
|
||||
*
|
||||
* @typeParam S Plugin settings
|
||||
* @typeParam P Processor settings
|
||||
*/
|
||||
type PluginTuple<S extends any[] = [Settings?], P = Settings> = [
|
||||
Plugin<S, P>,
|
||||
...S
|
||||
]
|
||||
|
||||
/**
|
||||
* A union of the different ways to add plugins to unified
|
||||
*
|
||||
* @typeParam S Plugin settings
|
||||
* @typeParam P Processor settings
|
||||
*/
|
||||
type Pluggable<S extends any[] = [Settings?], P = Settings> =
|
||||
| Plugin<S, P>
|
||||
| Preset<S, P>
|
||||
| PluginTuple<S, P>
|
||||
|
||||
/**
|
||||
* A list of plugins and presets
|
||||
*
|
||||
* @typeParam P Processor settings
|
||||
*/
|
||||
type PluggableList<P = Settings> = Array<Pluggable<any[], P>>
|
||||
|
||||
/**
|
||||
* An attacher is the thing passed to `use`.
|
||||
* It configures the processor and in turn can receive options.
|
||||
*
|
||||
* Attachers can configure processors, such as by interacting with parsers and compilers, linking them to other processors, or by specifying how the syntax tree is handled.
|
||||
*
|
||||
* @param settings Configuration
|
||||
* @typeParam S Plugin settings
|
||||
* @typeParam P Processor settings
|
||||
* @returns Optional Transformer.
|
||||
*/
|
||||
type Attacher<S extends any[] = [Settings?], P = Settings> = (
|
||||
this: Processor<P>,
|
||||
...settings: S
|
||||
) => Transformer | void
|
||||
|
||||
/**
|
||||
* Transformers modify the syntax tree or metadata of a file. A transformer is a function which is invoked each time a file is passed through the transform phase.
|
||||
* If an error occurs (either because it’s thrown, returned, rejected, or passed to `next`), the process stops.
|
||||
*
|
||||
* The transformation process in unified is handled by `trough`, see it’s documentation for the exact semantics of transformers.
|
||||
*
|
||||
* @param node Node or tree to be transformed
|
||||
* @param file File associated with node or tree
|
||||
* @param next If the signature of a transformer includes `next` (third argument), the function may finish asynchronous, and must invoke `next()`.
|
||||
* @returns
|
||||
* - `void` — If nothing is returned, the next transformer keeps using same tree.
|
||||
* - `Error` — Can be returned to stop the process
|
||||
* - `Node` — Can be returned and results in further transformations and `stringify`s to be performed on the new tree
|
||||
* - `Promise` — If a promise is returned, the function is asynchronous, and must be resolved (optionally with a `Node`) or rejected (optionally with an `Error`)
|
||||
*/
|
||||
type Transformer = (
|
||||
node: Node,
|
||||
file: VFile,
|
||||
next?: (
|
||||
error: Error | null,
|
||||
tree: Node,
|
||||
file: VFile
|
||||
) => Record<string, unknown>
|
||||
) => Error | Node | Promise<Node> | void | Promise<void>
|
||||
|
||||
/**
|
||||
* Transform file contents into an AST
|
||||
*/
|
||||
interface Parser {
|
||||
/**
|
||||
* Transform file contents into an AST
|
||||
*
|
||||
* @returns Parsed AST node/tree
|
||||
*/
|
||||
parse(): Node
|
||||
}
|
||||
|
||||
/**
|
||||
* A constructor function (a function with keys in its `prototype`) or class that implements a
|
||||
* `parse` method.
|
||||
*/
|
||||
type ParserConstructor = new (text: string, file: VFile) => Parser
|
||||
|
||||
/**
|
||||
* Transform file contents into an AST
|
||||
*
|
||||
* @param text Text to transform into AST node(s)
|
||||
* @param file File associated with text
|
||||
* @returns Parsed AST node/tree
|
||||
*/
|
||||
type ParserFunction = (text: string, file: VFile) => Node
|
||||
|
||||
/**
|
||||
* Transform an AST node/tree into text
|
||||
*/
|
||||
interface Compiler {
|
||||
/**
|
||||
* Transform an AST node/tree into text
|
||||
*
|
||||
* @returns Compiled text
|
||||
*/
|
||||
compile(): string
|
||||
}
|
||||
|
||||
/**
|
||||
* A constructor function (a function with keys in its `prototype`) or class that implements a
|
||||
* `compile` method.
|
||||
*/
|
||||
type CompilerConstructor = new (node: Node, file: VFile) => Compiler
|
||||
|
||||
/**
|
||||
* Transform an AST node/tree into text
|
||||
*
|
||||
* @param node Node/tree to be stringified
|
||||
* @param file File associated with node
|
||||
* @returns Compiled text
|
||||
*/
|
||||
type CompilerFunction = (node: Node, file: VFile) => string
|
||||
|
||||
/**
|
||||
* Access results from transforms
|
||||
*
|
||||
* @param error Error if any occurred
|
||||
* @param node Transformed AST tree/node
|
||||
* @param vfile File associated with node
|
||||
*/
|
||||
type RunCallback = (error: Error | null, node: Node, file: VFile) => void
|
||||
|
||||
/**
|
||||
* Access results from transforms
|
||||
*
|
||||
* @param error Error if any occurred
|
||||
* @param vfile File with updated content
|
||||
*/
|
||||
type ProcessCallback = (error: Error | null, file: VFile) => void
|
||||
}
|
||||
|
||||
/**
|
||||
* Unified processor allows plugins, parsers, and compilers to be chained together to transform content.
|
||||
*
|
||||
* @typeParam P Processor settings. Useful when packaging unified with a preset parser and compiler.
|
||||
*/
|
||||
declare function unified<P = unified.Settings>(): unified.Processor<P>
|
||||
export = unified
|
||||
25
node_modules/react-markdown/node_modules/unist-builder/index.js
generated
vendored
Normal file
25
node_modules/react-markdown/node_modules/unist-builder/index.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = u
|
||||
|
||||
function u(type, props, value) {
|
||||
var node
|
||||
|
||||
if (
|
||||
(value === null || value === undefined) &&
|
||||
(typeof props !== 'object' || Array.isArray(props))
|
||||
) {
|
||||
value = props
|
||||
props = {}
|
||||
}
|
||||
|
||||
node = Object.assign({type: String(type)}, props)
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
node.children = value
|
||||
} else if (value !== null && value !== undefined) {
|
||||
node.value = String(value)
|
||||
}
|
||||
|
||||
return node
|
||||
}
|
||||
21
node_modules/react-markdown/node_modules/unist-builder/license
generated
vendored
Normal file
21
node_modules/react-markdown/node_modules/unist-builder/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 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.
|
||||
79
node_modules/react-markdown/node_modules/unist-builder/package.json
generated
vendored
Normal file
79
node_modules/react-markdown/node_modules/unist-builder/package.json
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"name": "unist-builder",
|
||||
"version": "2.0.3",
|
||||
"description": "unist utility to create a new trees with a nice syntax",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"unist",
|
||||
"unist-util",
|
||||
"util",
|
||||
"utility",
|
||||
"tree",
|
||||
"ast",
|
||||
"build",
|
||||
"builder",
|
||||
"create",
|
||||
"dsl",
|
||||
"hyperscript",
|
||||
"sugar",
|
||||
"syntax"
|
||||
],
|
||||
"repository": "syntax-tree/unist-builder",
|
||||
"bugs": "https://github.com/syntax-tree/unist-builder/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)",
|
||||
"Christian Murphy <christian.murphy.42@gmail.com>"
|
||||
],
|
||||
"files": [
|
||||
"index.js",
|
||||
"types/index.d.ts"
|
||||
],
|
||||
"types": "types/index.d.ts",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@types/mdast": "^3.0.0",
|
||||
"dtslint": "^3.0.0",
|
||||
"nyc": "^15.0.0",
|
||||
"prettier": "^1.0.0",
|
||||
"remark-cli": "^7.0.0",
|
||||
"remark-preset-wooorm": "^6.0.0",
|
||||
"tape": "^4.0.0",
|
||||
"xo": "^0.26.0"
|
||||
},
|
||||
"scripts": {
|
||||
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
|
||||
"test-api": "node test",
|
||||
"test-coverage": "nyc --reporter lcov tape test.js",
|
||||
"test-types": "dtslint types",
|
||||
"test": "npm run format && npm run test-coverage && npm run test-types"
|
||||
},
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
"lines": 100,
|
||||
"functions": 100,
|
||||
"branches": 100
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
}
|
||||
}
|
||||
165
node_modules/react-markdown/node_modules/unist-builder/readme.md
generated
vendored
Normal file
165
node_modules/react-markdown/node_modules/unist-builder/readme.md
generated
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
# unist-builder
|
||||
|
||||
[![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**][unist] utility to create a new [tree][]s with [hyperscript][]-like
|
||||
syntax.
|
||||
|
||||
## Install
|
||||
|
||||
[npm][]:
|
||||
|
||||
```bash
|
||||
npm install unist-builder
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```js
|
||||
var u = require('unist-builder')
|
||||
|
||||
var tree = u('root', [
|
||||
u('subtree', {id: 1}),
|
||||
u('subtree', {id: 2}, [
|
||||
u('node', [u('leaf', 'leaf 1'), u('leaf', 'leaf 2')]),
|
||||
u('leaf', {id: 3}, 'leaf 3'),
|
||||
u('void', {id: 4})
|
||||
])
|
||||
])
|
||||
|
||||
console.dir(tree, {depth: null})
|
||||
```
|
||||
|
||||
results in the following tree:
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'root',
|
||||
children: [
|
||||
{type: 'subtree', id: 1},
|
||||
{
|
||||
type: 'subtree',
|
||||
id: 2,
|
||||
children: [
|
||||
{
|
||||
type: 'node',
|
||||
children: [
|
||||
{type: 'leaf', value: 'leaf 1'},
|
||||
{type: 'leaf', value: 'leaf 2'}
|
||||
]
|
||||
},
|
||||
{type: 'leaf', id: 3, value: 'leaf 3'},
|
||||
{type: 'void', id: 4}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `u(type[, props][, children|value])`
|
||||
|
||||
Creates a node from `props`, `children`, and optionally `value`.
|
||||
|
||||
###### Signatures
|
||||
|
||||
* `u(type[, props], children)` — create a [parent][]
|
||||
* `u(type[, props], value)` — create a [literal][]
|
||||
* `u(type[, props])` — create a void node
|
||||
|
||||
###### Parameters
|
||||
|
||||
* `type` (`string`) — node [type][]
|
||||
* `props` (`Object`) — other values assigned to `node`
|
||||
* `children` ([`Array.<Node>`][node]) — children of `node`
|
||||
* `value` (`*`) — value of `node` (cast to string)
|
||||
|
||||
###### Returns
|
||||
|
||||
[`Node`][node].
|
||||
|
||||
## Related
|
||||
|
||||
* [`unist-builder-blueprint`](https://github.com/syntax-tree/unist-builder-blueprint)
|
||||
— Convert unist trees to `unist-builder` notation
|
||||
* [`hastscript`](https://github.com/syntax-tree/hastscript)
|
||||
— Create [hast][] elements
|
||||
* [`xastscript`](https://github.com/syntax-tree/xastscript)
|
||||
— Create [xast][] elements
|
||||
|
||||
## Contribute
|
||||
|
||||
See [`contributing.md` in `syntax-tree/.github`][contributing] 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] © Eugene Sharygin
|
||||
|
||||
<!-- Definitions -->
|
||||
|
||||
[build-badge]: https://img.shields.io/travis/syntax-tree/unist-builder.svg
|
||||
|
||||
[build]: https://travis-ci.org/syntax-tree/unist-builder
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-builder.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/syntax-tree/unist-builder
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/unist-builder.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/unist-builder
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-builder.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=unist-builder
|
||||
|
||||
[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-spectrum-7b16ff.svg
|
||||
|
||||
[chat]: https://spectrum.chat/unified/syntax-tree
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[license]: license
|
||||
|
||||
[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md
|
||||
|
||||
[support]: https://github.com/syntax-tree/.github/blob/master/support.md
|
||||
|
||||
[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md
|
||||
|
||||
[unist]: https://github.com/syntax-tree/unist
|
||||
|
||||
[hast]: https://github.com/syntax-tree/hast
|
||||
|
||||
[xast]: https://github.com/syntax-tree/xast
|
||||
|
||||
[hyperscript]: https://github.com/dominictarr/hyperscript
|
||||
|
||||
[node]: https://github.com/syntax-tree/unist#node
|
||||
|
||||
[tree]: https://github.com/syntax-tree/unist#tree
|
||||
|
||||
[parent]: https://github.com/syntax-tree/unist#parent
|
||||
|
||||
[literal]: https://github.com/syntax-tree/unist#literal
|
||||
|
||||
[type]: https://github.com/syntax-tree/unist#type
|
||||
78
node_modules/react-markdown/node_modules/unist-builder/types/index.d.ts
generated
vendored
Normal file
78
node_modules/react-markdown/node_modules/unist-builder/types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
// TypeScript Version: 3.5
|
||||
|
||||
import {Node} from 'unist'
|
||||
|
||||
// NOTE: namespace is needed to use `export = unistBuilder`
|
||||
declare namespace unistBuilder {}
|
||||
|
||||
// NOTE: the order of the unistBuilder overloads is important.
|
||||
// Looking at the generics' "extends" left to right.
|
||||
// It should go from more specific types higher in the file, to more broad types lower in the file.
|
||||
|
||||
/**
|
||||
* Creates a node, with a given type
|
||||
*
|
||||
* @param type type of node
|
||||
*/
|
||||
declare function unistBuilder<T extends string>(type: T): {type: T}
|
||||
|
||||
/**
|
||||
* Creates a node, with type and value
|
||||
*
|
||||
* @param type type of node
|
||||
* @param value value property of node
|
||||
*/
|
||||
declare function unistBuilder<T extends string>(
|
||||
type: T,
|
||||
value: string
|
||||
): {type: T; value: string}
|
||||
|
||||
/**
|
||||
* Creates a node, with type, props, and value
|
||||
*
|
||||
* @param type type of node
|
||||
* @param props additional properties for node
|
||||
* @param value value property of node
|
||||
*/
|
||||
declare function unistBuilder<T extends string, P extends {}>(
|
||||
type: T,
|
||||
props: P,
|
||||
value: string
|
||||
): {type: T; value: string} & P
|
||||
|
||||
/**
|
||||
* Creates a node, with type and children
|
||||
*
|
||||
* @param type type of node
|
||||
* @param children child nodes of the current node
|
||||
*/
|
||||
declare function unistBuilder<T extends string, C extends Node[]>(
|
||||
type: T,
|
||||
children: C
|
||||
): {type: T; children: C}
|
||||
|
||||
/**
|
||||
* Creates a node, with type, props, and children
|
||||
*
|
||||
* @param type type of node
|
||||
* @param props additional properties for node
|
||||
* @param children child nodes of the current node
|
||||
*/
|
||||
declare function unistBuilder<T extends string, P extends {}, C extends Node[]>(
|
||||
type: T,
|
||||
props: P,
|
||||
children: C
|
||||
): {type: T; children: C} & P
|
||||
|
||||
/**
|
||||
* Creates a node, with type and props
|
||||
*
|
||||
* @param type type of node
|
||||
* @param props additional properties for node
|
||||
*/
|
||||
declare function unistBuilder<T extends string, P extends {}>(
|
||||
type: T,
|
||||
props: P
|
||||
): {type: T} & P
|
||||
|
||||
export = unistBuilder
|
||||
4
node_modules/react-markdown/node_modules/unist-util-visit-parents/color.browser.js
generated
vendored
Normal file
4
node_modules/react-markdown/node_modules/unist-util-visit-parents/color.browser.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = identity
|
||||
function identity(d) {
|
||||
return d
|
||||
}
|
||||
4
node_modules/react-markdown/node_modules/unist-util-visit-parents/color.js
generated
vendored
Normal file
4
node_modules/react-markdown/node_modules/unist-util-visit-parents/color.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = color
|
||||
function color(d) {
|
||||
return '\u001B[33m' + d + '\u001B[39m'
|
||||
}
|
||||
93
node_modules/react-markdown/node_modules/unist-util-visit-parents/index.js
generated
vendored
Normal file
93
node_modules/react-markdown/node_modules/unist-util-visit-parents/index.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = visitParents
|
||||
|
||||
var convert = require('unist-util-is/convert')
|
||||
var color = require('./color')
|
||||
|
||||
var CONTINUE = true
|
||||
var SKIP = 'skip'
|
||||
var EXIT = false
|
||||
|
||||
visitParents.CONTINUE = CONTINUE
|
||||
visitParents.SKIP = SKIP
|
||||
visitParents.EXIT = EXIT
|
||||
|
||||
function visitParents(tree, test, visitor, reverse) {
|
||||
var step
|
||||
var is
|
||||
|
||||
if (typeof test === 'function' && typeof visitor !== 'function') {
|
||||
reverse = visitor
|
||||
visitor = test
|
||||
test = null
|
||||
}
|
||||
|
||||
is = convert(test)
|
||||
step = reverse ? -1 : 1
|
||||
|
||||
factory(tree, null, [])()
|
||||
|
||||
function factory(node, index, parents) {
|
||||
var value = typeof node === 'object' && node !== null ? node : {}
|
||||
var name
|
||||
|
||||
if (typeof value.type === 'string') {
|
||||
name =
|
||||
typeof value.tagName === 'string'
|
||||
? value.tagName
|
||||
: typeof value.name === 'string'
|
||||
? value.name
|
||||
: undefined
|
||||
|
||||
visit.displayName =
|
||||
'node (' + color(value.type + (name ? '<' + name + '>' : '')) + ')'
|
||||
}
|
||||
|
||||
return visit
|
||||
|
||||
function visit() {
|
||||
var grandparents = parents.concat(node)
|
||||
var result = []
|
||||
var subresult
|
||||
var offset
|
||||
|
||||
if (!test || is(node, index, parents[parents.length - 1] || null)) {
|
||||
result = toResult(visitor(node, parents))
|
||||
|
||||
if (result[0] === EXIT) {
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
if (node.children && result[0] !== SKIP) {
|
||||
offset = (reverse ? node.children.length : -1) + step
|
||||
|
||||
while (offset > -1 && offset < node.children.length) {
|
||||
subresult = factory(node.children[offset], offset, grandparents)()
|
||||
|
||||
if (subresult[0] === EXIT) {
|
||||
return subresult
|
||||
}
|
||||
|
||||
offset =
|
||||
typeof subresult[1] === 'number' ? subresult[1] : offset + step
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toResult(value) {
|
||||
if (value !== null && typeof value === 'object' && 'length' in value) {
|
||||
return value
|
||||
}
|
||||
|
||||
if (typeof value === 'number') {
|
||||
return [CONTINUE, value]
|
||||
}
|
||||
|
||||
return [value]
|
||||
}
|
||||
22
node_modules/react-markdown/node_modules/unist-util-visit-parents/license
generated
vendored
Normal file
22
node_modules/react-markdown/node_modules/unist-util-visit-parents/license
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2016 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.
|
||||
104
node_modules/react-markdown/node_modules/unist-util-visit-parents/package.json
generated
vendored
Normal file
104
node_modules/react-markdown/node_modules/unist-util-visit-parents/package.json
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
{
|
||||
"name": "unist-util-visit-parents",
|
||||
"version": "3.1.1",
|
||||
"description": "unist utility to recursively walk over nodes, with ancestral information",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"unist",
|
||||
"unist-util",
|
||||
"util",
|
||||
"utility",
|
||||
"tree",
|
||||
"ast",
|
||||
"visit",
|
||||
"traverse",
|
||||
"walk",
|
||||
"check",
|
||||
"parent",
|
||||
"parents"
|
||||
],
|
||||
"repository": "syntax-tree/unist-util-visit-parents",
|
||||
"bugs": "https://github.com/syntax-tree/unist-util-visit-parents/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)"
|
||||
],
|
||||
"browser": {
|
||||
"./color.js": "./color.browser.js"
|
||||
},
|
||||
"react-native": {
|
||||
"./color.js": "./color.browser.js"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"color.js",
|
||||
"color.browser.js",
|
||||
"types/index.d.ts"
|
||||
],
|
||||
"types": "types/index.d.ts",
|
||||
"dependencies": {
|
||||
"@types/unist": "^2.0.0",
|
||||
"unist-util-is": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^17.0.0",
|
||||
"dtslint": "^4.0.0",
|
||||
"nyc": "^15.0.0",
|
||||
"prettier": "^2.0.0",
|
||||
"remark": "^13.0.0",
|
||||
"remark-cli": "^9.0.0",
|
||||
"remark-gfm": "^1.0.0",
|
||||
"remark-preset-wooorm": "^8.0.0",
|
||||
"strip-ansi": "^6.0.0",
|
||||
"tape": "^5.0.0",
|
||||
"tinyify": "^3.0.0",
|
||||
"typescript": "^4.0.0",
|
||||
"unified": "^9.0.0",
|
||||
"xo": "^0.34.0"
|
||||
},
|
||||
"scripts": {
|
||||
"format": "remark . -qfo && prettier . --write && xo --fix",
|
||||
"build-bundle": "browserify index.js -s unistUtilVisitParents > unist-util-visit-parents.js",
|
||||
"build-mangle": "browserify index.js -s unistUtilVisitParents -p tinyify > unist-util-visit-parents.min.js",
|
||||
"build": "npm run build-bundle && npm run build-mangle",
|
||||
"test-api": "node test",
|
||||
"test-coverage": "nyc --reporter lcov tape test.js",
|
||||
"test-types": "dtslint types",
|
||||
"test": "npm run format && npm run build && npm run test-coverage && npm run test-types"
|
||||
},
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
"lines": 100,
|
||||
"functions": 100,
|
||||
"branches": 100
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false,
|
||||
"rules": {
|
||||
"unicorn/prefer-set-has": "off",
|
||||
"unicorn/prefer-reflect-apply": "off"
|
||||
},
|
||||
"ignores": [
|
||||
"types/",
|
||||
"unist-util-visit-parents.js"
|
||||
]
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
}
|
||||
}
|
||||
233
node_modules/react-markdown/node_modules/unist-util-visit-parents/readme.md
generated
vendored
Normal file
233
node_modules/react-markdown/node_modules/unist-util-visit-parents/readme.md
generated
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
# unist-util-visit-parents
|
||||
|
||||
[![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**][unist] utility to visit nodes, with ancestral information.
|
||||
|
||||
## Install
|
||||
|
||||
[npm][]:
|
||||
|
||||
```sh
|
||||
npm install unist-util-visit-parents
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```js
|
||||
var remark = require('remark')
|
||||
var visit = require('unist-util-visit-parents')
|
||||
|
||||
var tree = remark.parse('Some _emphasis_, **importance**, and `code`.')
|
||||
|
||||
visit(tree, 'strong', visitor)
|
||||
|
||||
function visitor(node, ancestors) {
|
||||
console.log(ancestors)
|
||||
}
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```js
|
||||
[ { type: 'root', children: [ [Object] ] },
|
||||
{ type: 'paragraph',
|
||||
children:
|
||||
[ [Object],
|
||||
[Object],
|
||||
[Object],
|
||||
[Object],
|
||||
[Object],
|
||||
[Object],
|
||||
[Object] ] } ]
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `visit(tree[, test], visitor[, reverse])`
|
||||
|
||||
Visit nodes ([*inclusive descendants*][descendant] of [`tree`][tree]), with
|
||||
ancestral information.
|
||||
Optionally filtering nodes.
|
||||
Optionally in reverse.
|
||||
|
||||
This algorithm performs [*depth-first*][depth-first]
|
||||
[*tree traversal*][tree-traversal] in [*preorder*][preorder] (**NLR**), or
|
||||
if `reverse` is given, in *reverse preorder* (**NRL**).
|
||||
|
||||
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 with different `test`s, walk it once
|
||||
without a test, and use [`unist-util-is`][is] to check if a node matches a test,
|
||||
and then perform different operations.
|
||||
|
||||
###### Parameters
|
||||
|
||||
* `tree` ([`Node`][node]) — [Tree][] to traverse
|
||||
* `test` ([`Test`][is], optional) — [`is`][is]-compatible test (such as a
|
||||
[type][])
|
||||
* `visitor` ([Function][visitor]) — Function invoked when a node is found
|
||||
that passes `test`
|
||||
* `reverse` (`boolean`, default: `false`) — The tree is traversed in
|
||||
[preorder][] (NLR), visiting the node itself, then its [head][], etc.
|
||||
When `reverse` is passed, the tree is traversed in reverse preorder (NRL):
|
||||
the node itself is visited, then its [tail][], etc.
|
||||
|
||||
#### `next? = visitor(node, ancestors)`
|
||||
|
||||
Invoked when a node (matching `test`, if given) is found.
|
||||
|
||||
Visitors are free to transform `node`.
|
||||
They can also transform the [parent][] of node (the last of `ancestors`).
|
||||
Replacing `node` itself, if `visit.SKIP` is not returned, still causes its
|
||||
[descendant][]s to be visited.
|
||||
If adding or removing previous [sibling][]s (or next siblings, in case of
|
||||
`reverse`) of `node`, `visitor` should return a new [`index`][index] (`number`)
|
||||
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 an ancestor still results in them being
|
||||
traversed.
|
||||
|
||||
###### Parameters
|
||||
|
||||
* `node` ([`Node`][node]) — Found node
|
||||
* `ancestors` (`Array.<Node>`) — [Ancestor][]s of `node`
|
||||
|
||||
##### Returns
|
||||
|
||||
The return value can have the following forms:
|
||||
|
||||
* [`index`][index] (`number`) — Treated as a tuple of `[CONTINUE, index]`
|
||||
* `action` (`*`) — Treated as a tuple of `[action]`
|
||||
* `tuple` (`Array.<*>`) — List with one or two values, the first an `action`,
|
||||
the second and `index`.
|
||||
Note that passing a tuple only makes sense if the `action` is `SKIP`.
|
||||
If the `action` is `EXIT`, that action can be returned.
|
||||
If the `action` is `CONTINUE`, `index` can be returned.
|
||||
|
||||
###### `action`
|
||||
|
||||
An action can have the following values:
|
||||
|
||||
* `visit.EXIT` (`false`) — Stop traversing immediately
|
||||
* `visit.CONTINUE` (`true`) — Continue traversing as normal (same behaviour
|
||||
as not returning anything)
|
||||
* `visit.SKIP` (`'skip'`) — Do not traverse this node’s children; continue
|
||||
with the specified index
|
||||
|
||||
###### `index`
|
||||
|
||||
[`index`][index] (`number`) — Move to the sibling at `index` next (after `node`
|
||||
itself is completely traversed).
|
||||
Useful if mutating the tree, such as removing the node the visitor is currently
|
||||
on, or any of its previous siblings (or next siblings, in case of `reverse`)
|
||||
Results less than `0` or greater than or equal to `children.length` stop
|
||||
traversing the parent
|
||||
|
||||
## Related
|
||||
|
||||
* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit)
|
||||
— Like `visit-parents`, but with one parent
|
||||
* [`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` in `syntax-tree/.github`][contributing] 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://img.shields.io/travis/syntax-tree/unist-util-visit-parents.svg
|
||||
|
||||
[build]: https://travis-ci.org/syntax-tree/unist-util-visit-parents
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit-parents.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit-parents
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit-parents.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/unist-util-visit-parents
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit-parents.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=unist-util-visit-parents
|
||||
|
||||
[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
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[unist]: https://github.com/syntax-tree/unist
|
||||
|
||||
[node]: https://github.com/syntax-tree/unist#node
|
||||
|
||||
[visitor]: #next--visitornode-ancestors
|
||||
|
||||
[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
|
||||
|
||||
[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md
|
||||
|
||||
[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md
|
||||
|
||||
[is]: https://github.com/syntax-tree/unist-util-is
|
||||
|
||||
[depth-first]: https://github.com/syntax-tree/unist#depth-first-traversal
|
||||
|
||||
[tree-traversal]: https://github.com/syntax-tree/unist#tree-traversal
|
||||
|
||||
[preorder]: https://github.com/syntax-tree/unist#preorder
|
||||
|
||||
[descendant]: https://github.com/syntax-tree/unist#descendant
|
||||
|
||||
[head]: https://github.com/syntax-tree/unist#head
|
||||
|
||||
[tail]: https://github.com/syntax-tree/unist#tail
|
||||
|
||||
[parent]: https://github.com/syntax-tree/unist#parent-1
|
||||
|
||||
[sibling]: https://github.com/syntax-tree/unist#sibling
|
||||
|
||||
[index]: https://github.com/syntax-tree/unist#index
|
||||
|
||||
[ancestor]: https://github.com/syntax-tree/unist#ancestor
|
||||
|
||||
[tree]: https://github.com/syntax-tree/unist#tree
|
||||
|
||||
[type]: https://github.com/syntax-tree/unist#type
|
||||
111
node_modules/react-markdown/node_modules/unist-util-visit-parents/types/index.d.ts
generated
vendored
Normal file
111
node_modules/react-markdown/node_modules/unist-util-visit-parents/types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
// TypeScript Version: 3.5
|
||||
|
||||
import {Node, Parent} from 'unist'
|
||||
import {Test} from 'unist-util-is'
|
||||
|
||||
declare namespace visitParents {
|
||||
/**
|
||||
* Continue traversing as normal
|
||||
*/
|
||||
type Continue = true
|
||||
|
||||
/**
|
||||
* Do not traverse this node’s children
|
||||
*/
|
||||
type Skip = 'skip'
|
||||
|
||||
/**
|
||||
* Stop traversing immediately
|
||||
*/
|
||||
type Exit = false
|
||||
|
||||
/**
|
||||
* Union of the action types
|
||||
*/
|
||||
type Action = Continue | Skip | Exit
|
||||
|
||||
/**
|
||||
* List with one or two values, the first an action, the second an index.
|
||||
*/
|
||||
type ActionTuple = [Action, Index]
|
||||
|
||||
/**
|
||||
* Move to the sibling at index next (after node itself is completely traversed).
|
||||
* Useful if mutating the tree, such as removing the node the visitor is currently on,
|
||||
* or any of its previous siblings (or next siblings, in case of reverse)
|
||||
* Results less than 0 or greater than or equal to children.length stop traversing the parent
|
||||
*/
|
||||
type Index = number
|
||||
|
||||
/**
|
||||
* Invoked when a node (matching test, if given) is found.
|
||||
* Visitors are free to transform node.
|
||||
* They can also transform the parent of node (the last of ancestors).
|
||||
* Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited.
|
||||
* If adding or removing previous siblings (or next siblings, in case of reverse) of node,
|
||||
* visitor should return a new index (number) 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 an ancestor still results in them being traversed.
|
||||
*
|
||||
* @param node Found node
|
||||
* @param ancestors Ancestors of node
|
||||
* @paramType V node type found
|
||||
* @returns
|
||||
* When Action is passed, treated as a tuple of [Action]
|
||||
* When Index is passed, treated as a tuple of [CONTINUE, Index]
|
||||
* When ActionTuple is passed,
|
||||
* Note that passing a tuple only makes sense if the action is SKIP.
|
||||
* If the action is EXIT, that action can be returned.
|
||||
* If the action is CONTINUE, index can be returned.
|
||||
*/
|
||||
type Visitor<V extends Node> = (
|
||||
node: V,
|
||||
ancestors: Node[]
|
||||
) => void | Action | Index | ActionTuple
|
||||
}
|
||||
|
||||
declare const visitParents: {
|
||||
/**
|
||||
* Visit children of tree which pass a test
|
||||
*
|
||||
* @param tree abstract syntax tree to visit
|
||||
* @param test test node
|
||||
* @param visitor function to run for each node
|
||||
* @param reverse visit the tree in reverse, defaults to false
|
||||
* @typeParam T tree node
|
||||
* @typeParam V node type found
|
||||
*/
|
||||
<V extends Node>(
|
||||
tree: Node,
|
||||
test: Test<V> | Array<Test<any>>,
|
||||
visitor: visitParents.Visitor<V>,
|
||||
reverse?: boolean
|
||||
): void
|
||||
|
||||
/**
|
||||
* Visit children of a tree
|
||||
*
|
||||
* @param tree abstract syntax tree to visit
|
||||
* @param visitor function to run for each node
|
||||
* @param reverse visit the tree in reverse, defaults to false
|
||||
*/
|
||||
(tree: Node, visitor: visitParents.Visitor<Node>, reverse?: boolean): void
|
||||
|
||||
/**
|
||||
* Continue traversing as normal
|
||||
*/
|
||||
CONTINUE: visitParents.Continue
|
||||
|
||||
/**
|
||||
* Do not traverse this node’s children
|
||||
*/
|
||||
SKIP: visitParents.Skip
|
||||
|
||||
/**
|
||||
* Stop traversing immediately
|
||||
*/
|
||||
EXIT: visitParents.Exit
|
||||
}
|
||||
|
||||
export = visitParents
|
||||
29
node_modules/react-markdown/node_modules/unist-util-visit/index.js
generated
vendored
Normal file
29
node_modules/react-markdown/node_modules/unist-util-visit/index.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = visit
|
||||
|
||||
var visitParents = require('unist-util-visit-parents')
|
||||
|
||||
var CONTINUE = visitParents.CONTINUE
|
||||
var SKIP = visitParents.SKIP
|
||||
var EXIT = visitParents.EXIT
|
||||
|
||||
visit.CONTINUE = CONTINUE
|
||||
visit.SKIP = SKIP
|
||||
visit.EXIT = EXIT
|
||||
|
||||
function visit(tree, test, visitor, reverse) {
|
||||
if (typeof test === 'function' && typeof visitor !== 'function') {
|
||||
reverse = visitor
|
||||
visitor = test
|
||||
test = null
|
||||
}
|
||||
|
||||
visitParents(tree, test, overload, reverse)
|
||||
|
||||
function overload(node, parents) {
|
||||
var parent = parents[parents.length - 1]
|
||||
var index = parent ? parent.children.indexOf(node) : null
|
||||
return visitor(node, index, parent)
|
||||
}
|
||||
}
|
||||
22
node_modules/react-markdown/node_modules/unist-util-visit/license
generated
vendored
Normal file
22
node_modules/react-markdown/node_modules/unist-util-visit/license
generated
vendored
Normal 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.
|
||||
105
node_modules/react-markdown/node_modules/unist-util-visit/package.json
generated
vendored
Normal file
105
node_modules/react-markdown/node_modules/unist-util-visit/package.json
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
{
|
||||
"name": "unist-util-visit",
|
||||
"version": "2.0.3",
|
||||
"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>"
|
||||
],
|
||||
"files": [
|
||||
"index.js",
|
||||
"types/index.d.ts"
|
||||
],
|
||||
"types": "types/index.d.ts",
|
||||
"dependencies": {
|
||||
"@types/unist": "^2.0.0",
|
||||
"unist-util-is": "^4.0.0",
|
||||
"unist-util-visit-parents": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^16.0.0",
|
||||
"dtslint": "^3.0.0",
|
||||
"nyc": "^15.0.0",
|
||||
"prettier": "^2.0.0",
|
||||
"remark": "^12.0.0",
|
||||
"remark-cli": "^8.0.0",
|
||||
"remark-preset-wooorm": "^7.0.0",
|
||||
"tape": "^5.0.0",
|
||||
"tinyify": "^2.0.0",
|
||||
"typescript": "^3.0.0",
|
||||
"unified": "^9.0.0",
|
||||
"xo": "^0.32.0"
|
||||
},
|
||||
"scripts": {
|
||||
"format": "remark . -qfo && prettier . --write && xo --fix",
|
||||
"build-bundle": "browserify . -s unistUtilVisit > unist-util-visit.js",
|
||||
"build-mangle": "browserify . -s unistUtilVisit -p tinyify > unist-util-visit.min.js",
|
||||
"build": "npm run build-bundle && npm run build-mangle",
|
||||
"test-api": "node test",
|
||||
"test-coverage": "nyc --reporter lcov tape test.js",
|
||||
"test-types": "dtslint types",
|
||||
"test": "npm run format && npm run build && npm run test-coverage && npm run test-types"
|
||||
},
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
"lines": 100,
|
||||
"functions": 100,
|
||||
"branches": 100
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false,
|
||||
"rules": {
|
||||
"unicorn/prefer-set-has": "off"
|
||||
},
|
||||
"ignores": [
|
||||
"unist-util-visit.js",
|
||||
"types"
|
||||
]
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
}
|
||||
}
|
||||
136
node_modules/react-markdown/node_modules/unist-util-visit/readme.md
generated
vendored
Normal file
136
node_modules/react-markdown/node_modules/unist-util-visit/readme.md
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
# 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**][unist] utility to visit nodes.
|
||||
|
||||
## Install
|
||||
|
||||
[npm][]:
|
||||
|
||||
```sh
|
||||
npm install unist-util-visit
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```js
|
||||
var u = require('unist-builder')
|
||||
var visit = require('unist-util-visit')
|
||||
|
||||
var tree = u('tree', [
|
||||
u('leaf', '1'),
|
||||
u('node', [u('leaf', '2')]),
|
||||
u('void'),
|
||||
u('leaf', '3')
|
||||
])
|
||||
|
||||
visit(tree, 'leaf', function(node) {
|
||||
console.log(node)
|
||||
})
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```js
|
||||
{ type: 'leaf', value: '1' }
|
||||
{ type: 'leaf', value: '2' }
|
||||
{ type: 'leaf', value: '3' }
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `visit(tree[, test], visitor[, reverse])`
|
||||
|
||||
This function works exactly the same as [`unist-util-visit-parents`][vp],
|
||||
but `visitor` has a different signature.
|
||||
|
||||
#### `next? = visitor(node, index, parent)`
|
||||
|
||||
Instead of being passed an array of ancestors, `visitor` is invoked with the
|
||||
node’s [`index`][index] and its [`parent`][parent].
|
||||
|
||||
Otherwise the same as [`unist-util-visit-parents`][vp].
|
||||
|
||||
## Related
|
||||
|
||||
* [`unist-util-visit-parents`][vp]
|
||||
— Like `visit`, but 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` in `syntax-tree/.github`][contributing] 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://img.shields.io/travis/syntax-tree/unist-util-visit.svg
|
||||
|
||||
[build]: https://travis-ci.org/syntax-tree/unist-util-visit
|
||||
|
||||
[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-spectrum-7b16ff.svg
|
||||
|
||||
[chat]: https://spectrum.chat/unified/syntax-tree
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
|
||||
|
||||
[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md
|
||||
|
||||
[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md
|
||||
|
||||
[unist]: https://github.com/syntax-tree/unist
|
||||
|
||||
[vp]: https://github.com/syntax-tree/unist-util-visit-parents
|
||||
|
||||
[index]: https://github.com/syntax-tree/unist#index
|
||||
|
||||
[parent]: https://github.com/syntax-tree/unist#parent-1
|
||||
88
node_modules/react-markdown/node_modules/unist-util-visit/types/index.d.ts
generated
vendored
Normal file
88
node_modules/react-markdown/node_modules/unist-util-visit/types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
// TypeScript Version: 3.5
|
||||
|
||||
import {Node, Parent} from 'unist'
|
||||
import {Test} from 'unist-util-is'
|
||||
import {
|
||||
Action,
|
||||
ActionTuple,
|
||||
Continue,
|
||||
Exit,
|
||||
Index,
|
||||
Skip
|
||||
} from 'unist-util-visit-parents'
|
||||
|
||||
declare namespace visit {
|
||||
/**
|
||||
* Invoked when a node (matching test, if given) is found.
|
||||
* Visitors are free to transform node.
|
||||
* They can also transform the parent of node.
|
||||
* Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited.
|
||||
* If adding or removing previous siblings (or next siblings, in case of reverse) of node,
|
||||
* visitor should return a new index (number) 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 the parent still result in them being traversed.
|
||||
*
|
||||
* @param node Found node
|
||||
* @param index Position of found node within Parent
|
||||
* @param parent Parent of found node
|
||||
* @paramType V node type found
|
||||
* @returns
|
||||
* When Action is passed, treated as a tuple of [Action]
|
||||
* When Index is passed, treated as a tuple of [CONTINUE, Index]
|
||||
* When ActionTuple is passed,
|
||||
* Note that passing a tuple only makes sense if the action is SKIP.
|
||||
* If the action is EXIT, that action can be returned.
|
||||
* If the action is CONTINUE, index can be returned.
|
||||
*/
|
||||
type Visitor<V extends Node> = (
|
||||
node: V,
|
||||
index: number,
|
||||
parent: Parent | undefined
|
||||
) => void | Action | Index | ActionTuple
|
||||
}
|
||||
|
||||
declare const visit: {
|
||||
/**
|
||||
* Visit children of tree which pass a test
|
||||
*
|
||||
* @param tree abstract syntax tree to visit
|
||||
* @param test test node
|
||||
* @param visitor function to run for each node
|
||||
* @param reverse visit the tree in reverse, defaults to false
|
||||
* @typeParam T tree node
|
||||
* @typeParam V node type found
|
||||
*/
|
||||
<V extends Node>(
|
||||
tree: Node,
|
||||
test: Test<V> | Array<Test<any>>,
|
||||
visitor: visit.Visitor<V>,
|
||||
reverse?: boolean
|
||||
): void
|
||||
|
||||
/**
|
||||
* Visit children of a tree
|
||||
*
|
||||
* @param tree abstract syntax tree to visit
|
||||
* @param visitor function to run for each node
|
||||
* @param reverse visit the tree in reverse, defaults to false
|
||||
*/
|
||||
(tree: Node, visitor: visit.Visitor<Node>, reverse?: boolean): void
|
||||
|
||||
/**
|
||||
* Continue traversing as normal
|
||||
*/
|
||||
CONTINUE: Continue
|
||||
|
||||
/**
|
||||
* Do not traverse this node’s children
|
||||
*/
|
||||
SKIP: Skip
|
||||
|
||||
/**
|
||||
* Stop traversing immediately
|
||||
*/
|
||||
EXIT: Exit
|
||||
}
|
||||
|
||||
export = visit
|
||||
238
node_modules/react-markdown/package.json
generated
vendored
Normal file
238
node_modules/react-markdown/package.json
generated
vendored
Normal file
@@ -0,0 +1,238 @@
|
||||
{
|
||||
"name": "react-markdown",
|
||||
"version": "6.0.3",
|
||||
"description": "Render Markdown as React components",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"remark",
|
||||
"unified",
|
||||
"markdown",
|
||||
"commonmark",
|
||||
"gfm",
|
||||
"ast",
|
||||
"react",
|
||||
"react-component",
|
||||
"component"
|
||||
],
|
||||
"repository": "remarkjs/react-markdown",
|
||||
"bugs": "https://github.com/remarkjs/react-markdown/issues",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
},
|
||||
"author": "Espen Hovlandsdal <espen@hovlandsdal.com>",
|
||||
"contributors": [
|
||||
"Espen Hovlandsdal <espen@hovlandsdal.com>",
|
||||
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
||||
"Thomas Lindstrøm <t@hom.as>",
|
||||
"Fabian Irsara <info@fabianirsara.com>",
|
||||
"René Kooi <renee@kooi.me>",
|
||||
"Nicolas Venegas <nvenegas@atlassian.com>",
|
||||
"Christian Murphy <christian.murphy.42@gmail.com>",
|
||||
"Linus Unnebäck <linus@folkdatorn.se>",
|
||||
"Peng Guanwen <pg999w@outlook.com>",
|
||||
"mudrz <mudrz@outlook.com>",
|
||||
"Jesse Pinho <jesse@jessepinho.com>",
|
||||
"Florentin Luca Rieger <florentin.rieger@gmail.com>",
|
||||
"Frank <frankieali4@gmail.com>",
|
||||
"Igor Kamyshev <garik.novel@gmail.com>",
|
||||
"Jack Williams <jsw547@gmail.com>",
|
||||
"Jakub Chrzanowski <jakub@chrzanowski.info>",
|
||||
"Jeremy Moseley <jeremy@jeremymoseley.net>",
|
||||
"Kelvin Chan <kchan@securitycompass.com>",
|
||||
"Kohei Asai <me@axross.io>",
|
||||
"Marshall Smith <marshall@radialdevgroup.com>",
|
||||
"Nathan Bierema <nbierema@gmail.com>",
|
||||
"Petr Gazarov <petrgazarov@gmail.com>",
|
||||
"Phil Rajchgot <tophil@outlook.com>",
|
||||
"Rasmus Eneman <rasmus@eneman.eu>",
|
||||
"Riku Rouvila <riku.rouvila@gmail.com>",
|
||||
"Robin Wieruch <wrobin@gmx.net>",
|
||||
"Rostyslav Melnychuk <blackswordgc@gmail.com>",
|
||||
"Ted Piotrowski <tppiotrowski@gmail.com>",
|
||||
"Thibaud Courtoison <do.not.press.enter@gmail.com>",
|
||||
"Tiago Roldão <focus5.6@gmail.com>",
|
||||
"cerkiewny <mstarzycki@gmail.com>",
|
||||
"evoye <rosej@gmx.net>",
|
||||
"gRoberts84 <gavin@gav-roberts.co.uk>",
|
||||
"Alexander Wallin <office@alexanderwallin.com>",
|
||||
"vanchagreen <vanchagreen@gmail.com>",
|
||||
"Alexander Wong <admin@alexander-wong.com>",
|
||||
"André Staltz <andre@staltz.com>",
|
||||
"Angus MacIsaac <angus.macisaac@busbud.com>",
|
||||
"Beau Roberts <beau.roberts@autodesk.com>",
|
||||
"Charlie Chen <doveccl@live.com>",
|
||||
"Christoph Werner <christoph@codepunkt.de>",
|
||||
"Danny <dannyharding10@gmail.com>",
|
||||
"Dennis S <denis.s@svsg.co>",
|
||||
"Evan Hensleigh <futuraprime@gmail.com>"
|
||||
],
|
||||
"types": "src/react-markdown.d.ts",
|
||||
"main": "src/react-markdown.js",
|
||||
"unpkg": "react-markdown.min.js",
|
||||
"files": [
|
||||
"src/",
|
||||
"react-markdown.min.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/hast": "^2.0.0",
|
||||
"@types/unist": "^2.0.3",
|
||||
"comma-separated-tokens": "^1.0.0",
|
||||
"prop-types": "^15.7.2",
|
||||
"property-information": "^5.3.0",
|
||||
"react-is": "^17.0.0",
|
||||
"remark-parse": "^9.0.0",
|
||||
"remark-rehype": "^8.0.0",
|
||||
"space-separated-tokens": "^1.1.0",
|
||||
"style-to-object": "^0.3.0",
|
||||
"unified": "^9.0.0",
|
||||
"unist-util-visit": "^2.0.0",
|
||||
"vfile": "^4.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": ">=16",
|
||||
"react": ">=16"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.0.0",
|
||||
"@babel/preset-env": "^7.0.0",
|
||||
"@babel/preset-react": "^7.0.0",
|
||||
"@matejmazur/react-katex": "^3.0.0",
|
||||
"@rollup/plugin-babel": "^5.0.0",
|
||||
"@rollup/plugin-commonjs": "^19.0.0",
|
||||
"@rollup/plugin-json": "^4.0.0",
|
||||
"@rollup/plugin-node-resolve": "^13.0.0",
|
||||
"@testing-library/react": "^12.0.0",
|
||||
"@types/jest": "^26.0.0",
|
||||
"@types/react": "^17.0.0",
|
||||
"@types/react-dom": "^17.0.0",
|
||||
"@types/react-is": "^17.0.0",
|
||||
"@types/react-test-renderer": "^17.0.0",
|
||||
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
||||
"eslint-config-xo-react": "^0.25.0",
|
||||
"eslint-plugin-es": "^4.0.0",
|
||||
"eslint-plugin-react": "^7.0.0",
|
||||
"eslint-plugin-react-hooks": "^4.0.0",
|
||||
"eslint-plugin-security": "^1.0.0",
|
||||
"jest": "^27.0.0",
|
||||
"katex": "^0.13.0",
|
||||
"npm-run-all": "^4.0.0",
|
||||
"prettier": "^2.0.0",
|
||||
"react": "^17.0.0",
|
||||
"react-dom": "^17.0.0",
|
||||
"react-test-renderer": "^17.0.0",
|
||||
"rehype-raw": "^5.0.0",
|
||||
"remark-cli": "^9.0.0",
|
||||
"remark-gfm": "^1.0.0",
|
||||
"remark-math": "^4.0.0",
|
||||
"remark-preset-wooorm": "^8.0.0",
|
||||
"remark-toc": "^7.0.0",
|
||||
"rimraf": "^3.0.0",
|
||||
"rollup": "^2.0.0",
|
||||
"rollup-plugin-node-polyfills": "^0.2.0",
|
||||
"rollup-plugin-terser": "^7.0.0",
|
||||
"type-coverage": "^2.0.0",
|
||||
"typescript": "^4.0.0",
|
||||
"uglify-js": "^3.0.0",
|
||||
"xo": "^0.38.0"
|
||||
},
|
||||
"scripts": {
|
||||
"prepack": "npm run build && npm run format",
|
||||
"build:ts": "rimraf \"{src/**,test/**,}.d.ts\" && tsc && type-coverage",
|
||||
"build:umd": "rollup --silent -c",
|
||||
"build:umdcheck": "printf 'ES5? ' && uglifyjs react-markdown.min.js > /dev/null && echo 'Yes'",
|
||||
"build": "run-s build:*",
|
||||
"format": "remark . -qfo --ignore-pattern test/ && prettier . -w --loglevel warn && xo --fix",
|
||||
"test": "run-s build format test:*",
|
||||
"test:unit": "jest --coverage"
|
||||
},
|
||||
"browserslist": "> 0.25%, not dead",
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm",
|
||||
[
|
||||
"gfm",
|
||||
{
|
||||
"tablePipeAlign": false
|
||||
}
|
||||
],
|
||||
[
|
||||
"lint-table-pipe-alignment",
|
||||
false
|
||||
],
|
||||
[
|
||||
"lint-no-html",
|
||||
false
|
||||
]
|
||||
]
|
||||
},
|
||||
"jest": {
|
||||
"testEnvironment": "jsdom",
|
||||
"coverageThreshold": {
|
||||
"global": {
|
||||
"branches": 100,
|
||||
"functions": 100,
|
||||
"lines": 100,
|
||||
"statements": 100
|
||||
}
|
||||
}
|
||||
},
|
||||
"typeCoverage": {
|
||||
"atLeast": 100,
|
||||
"detail": true,
|
||||
"strict": true,
|
||||
"ignoreCatch": true,
|
||||
"#": "below is ignored because some proptypes will `any`",
|
||||
"ignoreFiles": [
|
||||
"src/react-markdown.d.ts"
|
||||
]
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false,
|
||||
"extends": "xo-react",
|
||||
"envs": [
|
||||
"shared-node-browser"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"src/**/*.js"
|
||||
],
|
||||
"extends": [
|
||||
"plugin:es/restrict-to-es2015",
|
||||
"plugin:security/recommended"
|
||||
],
|
||||
"rules": {
|
||||
"capitalized-comments": "off",
|
||||
"complexity": "off",
|
||||
"security/detect-object-injection": "off",
|
||||
"unicorn/prefer-number-properties": "off",
|
||||
"unicorn/prefer-optional-catch-binding": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"envs": [
|
||||
"jest"
|
||||
],
|
||||
"files": [
|
||||
"test/**/*.js"
|
||||
],
|
||||
"rules": {
|
||||
"react/no-children-prop": 0,
|
||||
"react/display-name": 0,
|
||||
"no-nested-ternary": 0,
|
||||
"react/prop-types": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
12
node_modules/react-markdown/react-markdown.min.js
generated
vendored
Normal file
12
node_modules/react-markdown/react-markdown.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user