diff --git a/tools/node_modules/eslint-plugin-markdown/lib/processor.js b/tools/node_modules/eslint-plugin-markdown/lib/processor.js index 94cf816dc913d9..a79f24356f7847 100644 --- a/tools/node_modules/eslint-plugin-markdown/lib/processor.js +++ b/tools/node_modules/eslint-plugin-markdown/lib/processor.js @@ -11,8 +11,12 @@ * @property {string} [lang] * * @typedef {Object} RangeMap - * @property {number} js - * @property {number} md + * @property {number} indent Number of code block indent characters trimmed from + * the beginning of the line during extraction. + * @property {number} js Offset from the start of the code block's range in the + * extracted JS. + * @property {number} md Offset from the start of the code block's range in the + * original Markdown. * * @typedef {Object} BlockBase * @property {string} baseIndentText @@ -24,8 +28,7 @@ "use strict"; -const unified = require("unified"); -const remarkParse = require("remark-parse"); +const parse = require("mdast-util-from-markdown"); const UNSATISFIABLE_RULES = [ "eol-last", // The Markdown parser strips trailing newlines in code fences @@ -33,8 +36,6 @@ const UNSATISFIABLE_RULES = [ ]; const SUPPORTS_AUTOFIX = true; -const markdown = unified().use(remarkParse); - /** * @type {Map} */ @@ -152,7 +153,7 @@ function getBlockRangeMap(text, node, comments) { /* * The parser sets the fenced code block's start offset to wherever content * should normally begin (typically the first column of the line, but more - * inside a list item, for example). The code block's opening fance may be + * inside a list item, for example). The code block's opening fence may be * further indented by up to three characters. If the code block has * additional indenting, the opening fence's first backtick may be up to * three whitespace characters after the start offset. @@ -187,6 +188,7 @@ function getBlockRangeMap(text, node, comments) { * last range that matches, skipping this initialization entry. */ const rangeMap = [{ + indent: baseIndent, js: 0, md: 0 }]; @@ -215,6 +217,7 @@ function getBlockRangeMap(text, node, comments) { const trimLength = Math.min(baseIndent, leadingWhitespaceLength); rangeMap.push({ + indent: trimLength, js: jsOffset, // Advance `trimLength` character from the beginning of the Markdown @@ -239,7 +242,7 @@ function getBlockRangeMap(text, node, comments) { * @returns {Array<{ filename: string, text: string }>} Source code blocks to lint. */ function preprocess(text, filename) { - const ast = markdown.parse(text); + const ast = parse(text); const blocks = []; blocksCache.set(filename, blocks); @@ -327,7 +330,7 @@ function adjustBlock(block) { const out = { line: lineInCode + blockStart, - column: message.column + block.position.indent[lineInCode - 1] - 1 + column: message.column + block.rangeMap[lineInCode].indent }; if (Number.isInteger(message.endLine)) { diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/LICENSE b/tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/LICENSE new file mode 100644 index 00000000000000..4b1ad51b2f0efc --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. All rights reserved. + + 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 diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/README.md b/tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/README.md new file mode 100644 index 00000000000000..5c0a337afcdefa --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/mdast` + +# Summary +This package contains type definitions for Mdast (https://github.com/syntax-tree/mdast). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast + +Additional Details + * Last updated: Sat, 07 Sep 2019 00:45:19 GMT + * Dependencies: @types/unist + * Global values: none + +# Credits +These definitions were written by Jun Lu . diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/package.json new file mode 100644 index 00000000000000..23e52f45be668e --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/package.json @@ -0,0 +1,26 @@ +{ + "name": "@types/mdast", + "version": "3.0.3", + "description": "TypeScript definitions for Mdast", + "license": "MIT", + "contributors": [ + { + "name": "Jun Lu", + "url": "https://github.com/lujun2", + "githubUsername": "lujun2" + } + ], + "main": "", + "types": "index", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/mdast" + }, + "scripts": {}, + "dependencies": { + "@types/unist": "*" + }, + "typesPublisherContentHash": "14d7fdbd7f31ef3975bd5e967ada84235c102b1be369cba397ced8b95ebe4e57", + "typeScriptVersion": "3.0" +} \ No newline at end of file diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/@types/unist/LICENSE b/tools/node_modules/eslint-plugin-markdown/node_modules/@types/unist/LICENSE new file mode 100644 index 00000000000000..4b1ad51b2f0efc --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/@types/unist/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. All rights reserved. + + 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 diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/@types/unist/README.md b/tools/node_modules/eslint-plugin-markdown/node_modules/@types/unist/README.md new file mode 100644 index 00000000000000..a15402a4524206 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/@types/unist/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/unist` + +# Summary +This package contains type definitions for non-npm package Unist ( https://github.com/syntax-tree/unist ). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist + +Additional Details + * Last updated: Thu, 14 Feb 2019 18:10:46 GMT + * Dependencies: none + * Global values: none + +# Credits +These definitions were written by bizen241 , Jun Lu , Hernan Rajchert , Titus Wormer , Junyoung Choi . diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/@types/unist/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/@types/unist/package.json new file mode 100644 index 00000000000000..78fa62811fa768 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/@types/unist/package.json @@ -0,0 +1,43 @@ +{ + "name": "@types/unist", + "version": "2.0.3", + "description": "TypeScript definitions for non-npm package Unist", + "license": "MIT", + "contributors": [ + { + "name": "bizen241", + "url": "https://github.com/bizen241", + "githubUsername": "bizen241" + }, + { + "name": "Jun Lu", + "url": "https://github.com/lujun2", + "githubUsername": "lujun2" + }, + { + "name": "Hernan Rajchert", + "url": "https://github.com/hrajchert", + "githubUsername": "hrajchert" + }, + { + "name": "Titus Wormer", + "url": "https://github.com/wooorm", + "githubUsername": "wooorm" + }, + { + "name": "Junyoung Choi", + "url": "https://github.com/rokt33r", + "githubUsername": "rokt33r" + } + ], + "main": "", + "types": "index", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "555fe20f164ccded02a3f69d8b45c8c9d2ec6fd53844a7c7858a3001c281bc9b", + "typeScriptVersion": "3.0" +} \ No newline at end of file diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/bail/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/bail/index.js deleted file mode 100644 index ef5e8807adf193..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/bail/index.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict' - -module.exports = bail - -function bail(err) { - if (err) { - throw err - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/bail/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/bail/package.json deleted file mode 100644 index 8f8539d32b89b6..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/bail/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "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 (https://wooorm.com)", - "contributors": [ - "Titus Wormer (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 - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/bail/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/bail/readme.md deleted file mode 100644 index 8e7b0863c01d2b..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/bail/readme.md +++ /dev/null @@ -1,84 +0,0 @@ -# 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] - - - -[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 diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/collapse-white-space/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/collapse-white-space/index.js deleted file mode 100644 index 93d546695c7ae7..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/collapse-white-space/index.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict' - -module.exports = collapse - -// `collapse(' \t\nbar \nbaz\t') // ' bar baz '` -function collapse(value) { - return String(value).replace(/\s+/g, ' ') -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/collapse-white-space/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/collapse-white-space/package.json deleted file mode 100644 index 6c9e8f348f4bc1..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/collapse-white-space/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "collapse-white-space", - "version": "1.0.6", - "description": "Replace multiple white-space characters with a single space", - "license": "MIT", - "keywords": [ - "collapse", - "white", - "space" - ], - "repository": "wooorm/collapse-white-space", - "bugs": "https://github.com/wooorm/collapse-white-space/issues", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - }, - "author": "Titus Wormer (https://wooorm.com)", - "contributors": [ - "Titus Wormer (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 . -s collapseWhiteSpace -o collapse-white-space.js", - "build-mangle": "browserify . -s collapseWhiteSpace -p tinyify -o collapse-white-space.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": [ - "collapse-white-space.js" - ] - }, - "remarkConfig": { - "plugins": [ - "preset-wooorm" - ] - }, - "nyc": { - "check-coverage": true, - "lines": 100, - "functions": 100, - "branches": 100 - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/collapse-white-space/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/collapse-white-space/readme.md deleted file mode 100644 index 5154c9fedc3024..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/collapse-white-space/readme.md +++ /dev/null @@ -1,58 +0,0 @@ -# collapse-white-space - -[![Build][build-badge]][build] -[![Coverage][coverage-badge]][coverage] -[![Downloads][downloads-badge]][downloads] -[![Size][size-badge]][size] - -Replace multiple whitespace characters with a single space. - -## Install - -[npm][]: - -```sh -npm install collapse-white-space -``` - -## Use - -```js -var collapse = require('collapse-white-space') - -collapse('\tfoo \n\tbar \t\r\nbaz') //=> ' foo bar baz' -``` - -## API - -### `collapse(value)` - -Replace multiple whitespace characters in value with a single space. - -## License - -[MIT][license] © [Titus Wormer][author] - - - -[build-badge]: https://img.shields.io/travis/wooorm/collapse-white-space.svg - -[build]: https://travis-ci.org/wooorm/collapse-white-space - -[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/collapse-white-space.svg - -[coverage]: https://codecov.io/github/wooorm/collapse-white-space - -[downloads-badge]: https://img.shields.io/npm/dm/collapse-white-space.svg - -[downloads]: https://www.npmjs.com/package/collapse-white-space - -[size-badge]: https://img.shields.io/bundlephobia/minzip/collapse-white-space.svg - -[size]: https://bundlephobia.com/result?p=collapse-white-space - -[npm]: https://docs.npmjs.com/cli/install - -[license]: license - -[author]: https://wooorm.com diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/debug/LICENSE b/tools/node_modules/eslint-plugin-markdown/node_modules/debug/LICENSE new file mode 100644 index 00000000000000..658c933d28255e --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/debug/LICENSE @@ -0,0 +1,19 @@ +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk + +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. + diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/debug/README.md b/tools/node_modules/eslint-plugin-markdown/node_modules/debug/README.md new file mode 100644 index 00000000000000..88dae35d9fc958 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/debug/README.md @@ -0,0 +1,455 @@ +# debug +[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +screen shot 2017-08-08 at 12 53 04 pm +screen shot 2017-08-08 at 12 53 38 pm +screen shot 2017-08-08 at 12 53 25 pm + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + + + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + + + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + + + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +`disable()` + +Will disable all namespaces. The functions returns the namespaces currently +enabled (and skipped). This can be useful if you want to disable debugging +temporarily without knowing what was enabled to begin with. + +For example: + +```js +let debug = require('debug'); +debug.enable('foo:*,-foo:bar'); +let namespaces = debug.disable(); +debug.enable(namespaces); +``` + +Note: There is no guarantee that the string will be identical to the initial +enable string, but semantically they will be identical. + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> + +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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/debug/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/debug/package.json new file mode 100644 index 00000000000000..da809d2b8d28b2 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/debug/package.json @@ -0,0 +1,59 @@ +{ + "name": "debug", + "version": "4.3.1", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "description": "small debugging utility", + "keywords": [ + "debug", + "log", + "debugger" + ], + "files": [ + "src", + "LICENSE", + "README.md" + ], + "author": "TJ Holowaychuk ", + "contributors": [ + "Nathan Rajlich (http://n8.io)", + "Andrew Rhyne ", + "Josh Junon " + ], + "license": "MIT", + "scripts": { + "lint": "xo", + "test": "npm run test:node && npm run test:browser && npm run lint", + "test:node": "istanbul cover _mocha -- test.js", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls" + }, + "dependencies": { + "ms": "2.1.2" + }, + "devDependencies": { + "brfs": "^2.0.1", + "browserify": "^16.2.3", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.1.4", + "karma-browserify": "^6.0.0", + "karma-chrome-launcher": "^2.2.0", + "karma-mocha": "^1.3.0", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "xo": "^0.23.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + }, + "main": "./src/index.js", + "browser": "./src/browser.js", + "engines": { + "node": ">=6.0" + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/debug/src/browser.js b/tools/node_modules/eslint-plugin-markdown/node_modules/debug/src/browser.js new file mode 100644 index 00000000000000..cd0fc35d1ee11e --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/debug/src/browser.js @@ -0,0 +1,269 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/debug/src/common.js b/tools/node_modules/eslint-plugin-markdown/node_modules/debug/src/common.js new file mode 100644 index 00000000000000..392a8e005a063a --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/debug/src/common.js @@ -0,0 +1,261 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/debug/src/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/debug/src/index.js new file mode 100644 index 00000000000000..bf4c57f259df2e --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/debug/src/node.js b/tools/node_modules/eslint-plugin-markdown/node_modules/debug/src/node.js new file mode 100644 index 00000000000000..79bc085cb0230c --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/debug/src/node.js @@ -0,0 +1,263 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/extend/.jscs.json b/tools/node_modules/eslint-plugin-markdown/node_modules/extend/.jscs.json deleted file mode 100644 index 3cce01d7832943..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/extend/.jscs.json +++ /dev/null @@ -1,175 +0,0 @@ -{ - "es3": true, - - "additionalRules": [], - - "requireSemicolons": true, - - "disallowMultipleSpaces": true, - - "disallowIdentifierNames": [], - - "requireCurlyBraces": { - "allExcept": [], - "keywords": ["if", "else", "for", "while", "do", "try", "catch"] - }, - - "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], - - "disallowSpaceAfterKeywords": [], - - "disallowSpaceBeforeComma": true, - "disallowSpaceAfterComma": false, - "disallowSpaceBeforeSemicolon": true, - - "disallowNodeTypes": [ - "DebuggerStatement", - "LabeledStatement", - "SwitchCase", - "SwitchStatement", - "WithStatement" - ], - - "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, - - "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, - "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, - "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, - "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, - "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, - - "requireSpaceBetweenArguments": true, - - "disallowSpacesInsideParentheses": true, - - "disallowSpacesInsideArrayBrackets": true, - - "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, - - "disallowSpaceAfterObjectKeys": true, - - "requireCommaBeforeLineBreak": true, - - "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], - "requireSpaceAfterPrefixUnaryOperators": [], - - "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], - "requireSpaceBeforePostfixUnaryOperators": [], - - "disallowSpaceBeforeBinaryOperators": [], - "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], - - "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], - "disallowSpaceAfterBinaryOperators": [], - - "disallowImplicitTypeConversion": ["binary", "string"], - - "disallowKeywords": ["with", "eval"], - - "requireKeywordsOnNewLine": [], - "disallowKeywordsOnNewLine": ["else"], - - "requireLineFeedAtFileEnd": true, - - "disallowTrailingWhitespace": true, - - "disallowTrailingComma": true, - - "excludeFiles": ["node_modules/**", "vendor/**"], - - "disallowMultipleLineStrings": true, - - "requireDotNotation": { "allExcept": ["keywords"] }, - - "requireParenthesesAroundIIFE": true, - - "validateLineBreaks": "LF", - - "validateQuoteMarks": { - "escape": true, - "mark": "'" - }, - - "disallowOperatorBeforeLineBreak": [], - - "requireSpaceBeforeKeywords": [ - "do", - "for", - "if", - "else", - "switch", - "case", - "try", - "catch", - "finally", - "while", - "with", - "return" - ], - - "validateAlignedFunctionParameters": { - "lineBreakAfterOpeningBraces": true, - "lineBreakBeforeClosingBraces": true - }, - - "requirePaddingNewLinesBeforeExport": true, - - "validateNewlineAfterArrayElements": { - "maximum": 6 - }, - - "requirePaddingNewLinesAfterUseStrict": true, - - "disallowArrowFunctions": true, - - "disallowMultiLineTernary": true, - - "validateOrderInObjectKeys": false, - - "disallowIdenticalDestructuringNames": true, - - "disallowNestedTernaries": { "maxLevel": 1 }, - - "requireSpaceAfterComma": { "allExcept": ["trailing"] }, - "requireAlignedMultilineParams": false, - - "requireSpacesInGenerator": { - "afterStar": true - }, - - "disallowSpacesInGenerator": { - "beforeStar": true - }, - - "disallowVar": false, - - "requireArrayDestructuring": false, - - "requireEnhancedObjectLiterals": false, - - "requireObjectDestructuring": false, - - "requireEarlyReturn": false, - - "requireCapitalizedConstructorsNew": { - "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] - }, - - "requireImportAlphabetized": false, - - "requireSpaceBeforeObjectValues": true, - "requireSpaceBeforeDestructuredValues": true, - - "disallowSpacesInsideTemplateStringPlaceholders": true, - - "disallowArrayDestructuringReturn": false, - - "requireNewlineBeforeSingleStatementsInIf": false, - - "disallowUnusedVariables": true, - - "requireSpacesInsideImportedObjectBraces": true, - - "requireUseStrict": true -} - diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/extend/LICENSE b/tools/node_modules/eslint-plugin-markdown/node_modules/extend/LICENSE deleted file mode 100644 index e16d6a56ca64e2..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/extend/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Stefan Thomas - -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. - diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/extend/README.md b/tools/node_modules/eslint-plugin-markdown/node_modules/extend/README.md deleted file mode 100644 index 5b8249aa95e5d3..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/extend/README.md +++ /dev/null @@ -1,81 +0,0 @@ -[![Build Status][travis-svg]][travis-url] -[![dependency status][deps-svg]][deps-url] -[![dev dependency status][dev-deps-svg]][dev-deps-url] - -# extend() for Node.js [![Version Badge][npm-version-png]][npm-url] - -`node-extend` is a port of the classic extend() method from jQuery. It behaves as you expect. It is simple, tried and true. - -Notes: - -* Since Node.js >= 4, - [`Object.assign`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) - now offers the same functionality natively (but without the "deep copy" option). - See [ECMAScript 2015 (ES6) in Node.js](https://nodejs.org/en/docs/es6). -* Some native implementations of `Object.assign` in both Node.js and many - browsers (since NPM modules are for the browser too) may not be fully - spec-compliant. - Check [`object.assign`](https://www.npmjs.com/package/object.assign) module for - a compliant candidate. - -## Installation - -This package is available on [npm][npm-url] as: `extend` - -``` sh -npm install extend -``` - -## Usage - -**Syntax:** extend **(** [`deep`], `target`, `object1`, [`objectN`] **)** - -*Extend one object with one or more others, returning the modified object.* - -**Example:** - -``` js -var extend = require('extend'); -extend(targetObject, object1, object2); -``` - -Keep in mind that the target object will be modified, and will be returned from extend(). - -If a boolean true is specified as the first argument, extend performs a deep copy, recursively copying any objects it finds. Otherwise, the copy will share structure with the original object(s). -Undefined properties are not copied. However, properties inherited from the object's prototype will be copied over. -Warning: passing `false` as the first argument is not supported. - -### Arguments - -* `deep` *Boolean* (optional) -If set, the merge becomes recursive (i.e. deep copy). -* `target` *Object* -The object to extend. -* `object1` *Object* -The object that will be merged into the first. -* `objectN` *Object* (Optional) -More objects to merge into the first. - -## License - -`node-extend` is licensed under the [MIT License][mit-license-url]. - -## Acknowledgements - -All credit to the jQuery authors for perfecting this amazing utility. - -Ported to Node.js by [Stefan Thomas][github-justmoon] with contributions by [Jonathan Buchanan][github-insin] and [Jordan Harband][github-ljharb]. - -[travis-svg]: https://travis-ci.org/justmoon/node-extend.svg -[travis-url]: https://travis-ci.org/justmoon/node-extend -[npm-url]: https://npmjs.org/package/extend -[mit-license-url]: http://opensource.org/licenses/MIT -[github-justmoon]: https://github.com/justmoon -[github-insin]: https://github.com/insin -[github-ljharb]: https://github.com/ljharb -[npm-version-png]: http://versionbadg.es/justmoon/node-extend.svg -[deps-svg]: https://david-dm.org/justmoon/node-extend.svg -[deps-url]: https://david-dm.org/justmoon/node-extend -[dev-deps-svg]: https://david-dm.org/justmoon/node-extend/dev-status.svg -[dev-deps-url]: https://david-dm.org/justmoon/node-extend#info=devDependencies - diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/extend/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/extend/index.js deleted file mode 100644 index 2aa3faae68c43e..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/extend/index.js +++ /dev/null @@ -1,117 +0,0 @@ -'use strict'; - -var hasOwn = Object.prototype.hasOwnProperty; -var toStr = Object.prototype.toString; -var defineProperty = Object.defineProperty; -var gOPD = Object.getOwnPropertyDescriptor; - -var isArray = function isArray(arr) { - if (typeof Array.isArray === 'function') { - return Array.isArray(arr); - } - - return toStr.call(arr) === '[object Array]'; -}; - -var isPlainObject = function isPlainObject(obj) { - if (!obj || toStr.call(obj) !== '[object Object]') { - return false; - } - - var hasOwnConstructor = hasOwn.call(obj, 'constructor'); - var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); - // Not own constructor property must be Object - if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - var key; - for (key in obj) { /**/ } - - return typeof key === 'undefined' || hasOwn.call(obj, key); -}; - -// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target -var setProperty = function setProperty(target, options) { - if (defineProperty && options.name === '__proto__') { - defineProperty(target, options.name, { - enumerable: true, - configurable: true, - value: options.newValue, - writable: true - }); - } else { - target[options.name] = options.newValue; - } -}; - -// Return undefined instead of __proto__ if '__proto__' is not an own property -var getProperty = function getProperty(obj, name) { - if (name === '__proto__') { - if (!hasOwn.call(obj, name)) { - return void 0; - } else if (gOPD) { - // In early versions of node, obj['__proto__'] is buggy when obj has - // __proto__ as an own property. Object.getOwnPropertyDescriptor() works. - return gOPD(obj, name).value; - } - } - - return obj[name]; -}; - -module.exports = function extend() { - var options, name, src, copy, copyIsArray, clone; - var target = arguments[0]; - var i = 1; - var length = arguments.length; - var deep = false; - - // Handle a deep copy situation - if (typeof target === 'boolean') { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - if (target == null || (typeof target !== 'object' && typeof target !== 'function')) { - target = {}; - } - - for (; i < length; ++i) { - options = arguments[i]; - // Only deal with non-null/undefined values - if (options != null) { - // Extend the base object - for (name in options) { - src = getProperty(target, name); - copy = getProperty(options, name); - - // Prevent never-ending loop - if (target !== copy) { - // Recurse if we're merging plain objects or arrays - if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { - if (copyIsArray) { - copyIsArray = false; - clone = src && isArray(src) ? src : []; - } else { - clone = src && isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - setProperty(target, { name: name, newValue: extend(deep, clone, copy) }); - - // Don't bring in undefined values - } else if (typeof copy !== 'undefined') { - setProperty(target, { name: name, newValue: copy }); - } - } - } - } - } - - // Return the modified object - return target; -}; diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/extend/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/extend/package.json deleted file mode 100644 index 85279f78054e5c..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/extend/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "extend", - "author": "Stefan Thomas (http://www.justmoon.net)", - "version": "3.0.2", - "description": "Port of jQuery.extend for node.js and the browser", - "main": "index", - "scripts": { - "pretest": "npm run lint", - "test": "npm run tests-only", - "posttest": "npm run coverage-quiet", - "tests-only": "node test", - "coverage": "covert test/index.js", - "coverage-quiet": "covert test/index.js --quiet", - "lint": "npm run jscs && npm run eslint", - "jscs": "jscs *.js */*.js", - "eslint": "eslint *.js */*.js" - }, - "contributors": [ - { - "name": "Jordan Harband", - "url": "https://github.com/ljharb" - } - ], - "keywords": [ - "extend", - "clone", - "merge" - ], - "repository": { - "type": "git", - "url": "https://github.com/justmoon/node-extend.git" - }, - "dependencies": {}, - "devDependencies": { - "@ljharb/eslint-config": "^12.2.1", - "covert": "^1.1.0", - "eslint": "^4.19.1", - "jscs": "^3.0.7", - "tape": "^4.9.1" - }, - "license": "MIT" -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/inherits/LICENSE b/tools/node_modules/eslint-plugin-markdown/node_modules/inherits/LICENSE deleted file mode 100644 index dea3013d6710ee..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/inherits/LICENSE +++ /dev/null @@ -1,16 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. - diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/inherits/README.md b/tools/node_modules/eslint-plugin-markdown/node_modules/inherits/README.md deleted file mode 100644 index b1c56658557b81..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/inherits/README.md +++ /dev/null @@ -1,42 +0,0 @@ -Browser-friendly inheritance fully compatible with standard node.js -[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). - -This package exports standard `inherits` from node.js `util` module in -node environment, but also provides alternative browser-friendly -implementation through [browser -field](https://gist.github.com/shtylman/4339901). Alternative -implementation is a literal copy of standard one located in standalone -module to avoid requiring of `util`. It also has a shim for old -browsers with no `Object.create` support. - -While keeping you sure you are using standard `inherits` -implementation in node.js environment, it allows bundlers such as -[browserify](https://github.com/substack/node-browserify) to not -include full `util` package to your client code if all you need is -just `inherits` function. It worth, because browser shim for `util` -package is large and `inherits` is often the single function you need -from it. - -It's recommended to use this package instead of -`require('util').inherits` for any code that has chances to be used -not only in node.js but in browser too. - -## usage - -```js -var inherits = require('inherits'); -// then use exactly as the standard one -``` - -## note on version ~1.0 - -Version ~1.0 had completely different motivation and is not compatible -neither with 2.0 nor with standard node.js `inherits`. - -If you are using version ~1.0 and planning to switch to ~2.0, be -careful: - -* new version uses `super_` instead of `super` for referencing - superclass -* new version overwrites current prototype while old one preserves any - existing fields on it diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/inherits/inherits.js b/tools/node_modules/eslint-plugin-markdown/node_modules/inherits/inherits.js deleted file mode 100644 index f71f2d93294a67..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/inherits/inherits.js +++ /dev/null @@ -1,9 +0,0 @@ -try { - var util = require('util'); - /* istanbul ignore next */ - if (typeof util.inherits !== 'function') throw ''; - module.exports = util.inherits; -} catch (e) { - /* istanbul ignore next */ - module.exports = require('./inherits_browser.js'); -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/inherits/inherits_browser.js b/tools/node_modules/eslint-plugin-markdown/node_modules/inherits/inherits_browser.js deleted file mode 100644 index 86bbb3dc29e484..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/inherits/inherits_browser.js +++ /dev/null @@ -1,27 +0,0 @@ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }) - } - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/inherits/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/inherits/package.json deleted file mode 100644 index 37b4366b83e63e..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/inherits/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "inherits", - "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", - "version": "2.0.4", - "keywords": [ - "inheritance", - "class", - "klass", - "oop", - "object-oriented", - "inherits", - "browser", - "browserify" - ], - "main": "./inherits.js", - "browser": "./inherits_browser.js", - "repository": "git://github.com/isaacs/inherits", - "license": "ISC", - "scripts": { - "test": "tap" - }, - "devDependencies": { - "tap": "^14.2.4" - }, - "files": [ - "inherits.js", - "inherits_browser.js" - ] -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/is-buffer/LICENSE b/tools/node_modules/eslint-plugin-markdown/node_modules/is-buffer/LICENSE deleted file mode 100644 index 0c068ceecbd48f..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/is-buffer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Feross Aboukhadijeh - -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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/is-buffer/README.md b/tools/node_modules/eslint-plugin-markdown/node_modules/is-buffer/README.md deleted file mode 100644 index cce0a8cf924d8c..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/is-buffer/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# is-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] - -[travis-image]: https://img.shields.io/travis/feross/is-buffer/master.svg -[travis-url]: https://travis-ci.org/feross/is-buffer -[npm-image]: https://img.shields.io/npm/v/is-buffer.svg -[npm-url]: https://npmjs.org/package/is-buffer -[downloads-image]: https://img.shields.io/npm/dm/is-buffer.svg -[downloads-url]: https://npmjs.org/package/is-buffer -[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg -[standard-url]: https://standardjs.com - -#### Determine if an object is a [`Buffer`](http://nodejs.org/api/buffer.html) (including the [browserify Buffer](https://github.com/feross/buffer)) - -[![saucelabs][saucelabs-image]][saucelabs-url] - -[saucelabs-image]: https://saucelabs.com/browser-matrix/is-buffer.svg -[saucelabs-url]: https://saucelabs.com/u/is-buffer - -## Why not use `Buffer.isBuffer`? - -This module lets you check if an object is a `Buffer` without using `Buffer.isBuffer` (which includes the whole [buffer](https://github.com/feross/buffer) module in [browserify](http://browserify.org/)). - -It's future-proof and works in node too! - -## install - -```bash -npm install is-buffer -``` - -## usage - -```js -var isBuffer = require('is-buffer') - -isBuffer(new Buffer(4)) // true - -isBuffer(undefined) // false -isBuffer(null) // false -isBuffer('') // false -isBuffer(true) // false -isBuffer(false) // false -isBuffer(0) // false -isBuffer(1) // false -isBuffer(1.0) // false -isBuffer('string') // false -isBuffer({}) // false -isBuffer(function foo () {}) // false -``` - -## license - -MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org). diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/is-buffer/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/is-buffer/index.js deleted file mode 100644 index 9cce396594f605..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/is-buffer/index.js +++ /dev/null @@ -1,21 +0,0 @@ -/*! - * Determine if an object is a Buffer - * - * @author Feross Aboukhadijeh - * @license MIT - */ - -// The _isBuffer check is for Safari 5-7 support, because it's missing -// Object.prototype.constructor. Remove this eventually -module.exports = function (obj) { - return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) -} - -function isBuffer (obj) { - return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) -} - -// For Node v0.10 support. Remove this eventually. -function isSlowBuffer (obj) { - return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/is-buffer/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/is-buffer/package.json deleted file mode 100644 index ea12137a63cf0f..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/is-buffer/package.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "is-buffer", - "description": "Determine if an object is a Buffer", - "version": "1.1.6", - "author": { - "name": "Feross Aboukhadijeh", - "email": "feross@feross.org", - "url": "http://feross.org/" - }, - "bugs": { - "url": "https://github.com/feross/is-buffer/issues" - }, - "dependencies": {}, - "devDependencies": { - "standard": "*", - "tape": "^4.0.0", - "zuul": "^3.0.0" - }, - "keywords": [ - "buffer", - "buffers", - "type", - "core buffer", - "browser buffer", - "browserify", - "typed array", - "uint32array", - "int16array", - "int32array", - "float32array", - "float64array", - "browser", - "arraybuffer", - "dataview" - ], - "license": "MIT", - "main": "index.js", - "repository": { - "type": "git", - "url": "git://github.com/feross/is-buffer.git" - }, - "scripts": { - "test": "standard && npm run test-node && npm run test-browser", - "test-browser": "zuul -- test/*.js", - "test-browser-local": "zuul --local -- test/*.js", - "test-node": "tape test/*.js" - }, - "testling": { - "files": "test/*.js" - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/is-plain-obj/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/is-plain-obj/index.js deleted file mode 100644 index 0d1ba9eeb89723..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/is-plain-obj/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; -var toString = Object.prototype.toString; - -module.exports = function (x) { - var prototype; - return toString.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); -}; diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/is-plain-obj/license b/tools/node_modules/eslint-plugin-markdown/node_modules/is-plain-obj/license deleted file mode 100644 index 654d0bfe943437..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/is-plain-obj/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/is-plain-obj/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/is-plain-obj/package.json deleted file mode 100644 index d331f6e8169900..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/is-plain-obj/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "is-plain-obj", - "version": "1.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": ">=0.10.0" - }, - "scripts": { - "test": "node test.js" - }, - "files": [ - "index.js" - ], - "keywords": [ - "obj", - "object", - "is", - "check", - "test", - "type", - "plain", - "vanilla", - "pure", - "simple" - ], - "devDependencies": { - "ava": "0.0.4" - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/is-plain-obj/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/is-plain-obj/readme.md deleted file mode 100644 index 269e56aeff0646..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/is-plain-obj/readme.md +++ /dev/null @@ -1,35 +0,0 @@ -# is-plain-obj [![Build Status](https://travis-ci.org/sindresorhus/is-plain-obj.svg?branch=master)](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 --save is-plain-obj -``` - - -## Usage - -```js -var isPlainObj = require('is-plain-obj'); - -isPlainObj({foo: 'bar'}); -//=> true - -isPlainObj([1, 2, 3]); -//=> false -``` - - -## Related - -- [is-obj](https://github.com/sindresorhus/is-obj) - Check if a value is an object - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/is-whitespace-character/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/is-whitespace-character/index.js deleted file mode 100644 index 801c19f0d8df82..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/is-whitespace-character/index.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict' - -module.exports = whitespace - -var fromCode = String.fromCharCode -var re = /\s/ - -// Check if the given character code, or the character code at the first -// character, is a whitespace character. -function whitespace(character) { - return re.test( - typeof character === 'number' ? fromCode(character) : character.charAt(0) - ) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/is-whitespace-character/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/is-whitespace-character/package.json deleted file mode 100644 index d6b35d9a0b5df4..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/is-whitespace-character/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "is-whitespace-character", - "version": "1.0.4", - "description": "Check if a character is a whitespace character", - "license": "MIT", - "keywords": [ - "string", - "character", - "char", - "code", - "whitespace", - "white", - "space" - ], - "repository": "wooorm/is-whitespace-character", - "bugs": "https://github.com/wooorm/is-whitespace-character/issues", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - }, - "author": "Titus Wormer (https://wooorm.com)", - "contributors": [ - "Titus Wormer (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 . -s isWhitespaceCharacter -o is-whitespace-character.js", - "build-mangle": "browserify . -s isWhitespaceCharacter -p tinyify -o is-whitespace-character.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": [ - "is-whitespace-character.js" - ] - }, - "nyc": { - "check-coverage": true, - "lines": 100, - "functions": 100, - "branches": 100 - }, - "remarkConfig": { - "plugins": [ - "preset-wooorm" - ] - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/is-whitespace-character/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/is-whitespace-character/readme.md deleted file mode 100644 index 34d4f343c86adf..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/is-whitespace-character/readme.md +++ /dev/null @@ -1,74 +0,0 @@ -# is-whitespace-character - -[![Build][build-badge]][build] -[![Coverage][coverage-badge]][coverage] -[![Downloads][downloads-badge]][downloads] -[![Size][size-badge]][size] - -Check if a character is a whitespace character: `\s`, which equals all Unicode -Space Separators (including `[ \t\v\f]`), the BOM (`\uFEFF`), and line -terminator (`[\n\r\u2028\u2029]`). - -## Install - -[npm][]: - -```sh -npm install is-whitespace-character -``` - -## Use - -```js -var whitespace = require('is-whitespace-character') - -whitespace(' ') // => true -whitespace('\n') // => true -whitespace('\uFEFF') // => true -whitespace('_') // => false -whitespace('a') // => false -whitespace('💩') // => false -``` - -## API - -### `whitespaceCharacter(character|code)` - -Check whether the given character code (`number`), or the character code at the -first position (`string`), is a whitespace character. - -## Related - -* [`is-alphabetical`](https://github.com/wooorm/is-alphabetical) -* [`is-alphanumerical`](https://github.com/wooorm/is-alphanumerical) -* [`is-decimal`](https://github.com/wooorm/is-decimal) -* [`is-hexadecimal`](https://github.com/wooorm/is-hexadecimal) -* [`is-word-character`](https://github.com/wooorm/is-word-character) - -## License - -[MIT][license] © [Titus Wormer][author] - - - -[build-badge]: https://img.shields.io/travis/wooorm/is-whitespace-character.svg - -[build]: https://travis-ci.org/wooorm/is-whitespace-character - -[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/is-whitespace-character.svg - -[coverage]: https://codecov.io/github/wooorm/is-whitespace-character - -[downloads-badge]: https://img.shields.io/npm/dm/is-whitespace-character.svg - -[downloads]: https://www.npmjs.com/package/is-whitespace-character - -[size-badge]: https://img.shields.io/bundlephobia/minzip/is-whitespace-character.svg - -[size]: https://bundlephobia.com/result?p=is-whitespace-character - -[npm]: https://docs.npmjs.com/cli/install - -[license]: license - -[author]: https://wooorm.com diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/is-word-character/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/is-word-character/index.js deleted file mode 100644 index 8c3537f99568c3..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/is-word-character/index.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict' - -module.exports = wordCharacter - -var fromCode = String.fromCharCode -var re = /\w/ - -// Check if the given character code, or the character code at the first -// character, is a word character. -function wordCharacter(character) { - return re.test( - typeof character === 'number' ? fromCode(character) : character.charAt(0) - ) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/is-word-character/license b/tools/node_modules/eslint-plugin-markdown/node_modules/is-word-character/license deleted file mode 100644 index 8d8660d36ef2ec..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/is-word-character/license +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2016 Titus Wormer - -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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/is-word-character/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/is-word-character/package.json deleted file mode 100644 index 42c262cf64fa63..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/is-word-character/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "is-word-character", - "version": "1.0.4", - "description": "Check if a character is a word character", - "license": "MIT", - "keywords": [ - "string", - "character", - "char", - "code", - "word" - ], - "repository": "wooorm/is-word-character", - "bugs": "https://github.com/wooorm/is-word-character/issues", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - }, - "author": "Titus Wormer (https://wooorm.com)", - "contributors": [ - "Titus Wormer (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 . -s isWordCharacter -o is-word-character.js", - "build-mangle": "browserify . -s isWordCharacter -p tinyify -o is-word-character.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": [ - "is-word-character.js" - ] - }, - "nyc": { - "check-coverage": true, - "lines": 100, - "functions": 100, - "branches": 100 - }, - "remarkConfig": { - "plugins": [ - "preset-wooorm" - ] - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/is-word-character/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/is-word-character/readme.md deleted file mode 100644 index 3c88ce976e3da2..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/is-word-character/readme.md +++ /dev/null @@ -1,72 +0,0 @@ -# is-word-character - -[![Build][build-badge]][build] -[![Coverage][coverage-badge]][coverage] -[![Downloads][downloads-badge]][downloads] -[![Size][size-badge]][size] - -Check if a character is a word character (`\w`, which equals `[a-zA-Z0-9_]`). - -## Install - -[npm][]: - -```sh -npm install is-word-character -``` - -## Use - -```js -var wordCharacter = require('is-word-character') - -wordCharacter('a') // => true -wordCharacter('Z') // => true -wordCharacter('0') // => true -wordCharacter('_') // => true -wordCharacter(' ') // => false -wordCharacter('💩') // => false -``` - -## API - -### `wordCharacter(character|code)` - -Check whether the given character code (`number`), or the character code at the -first position (`string`), is a word character. - -## Related - -* [`is-alphabetical`](https://github.com/wooorm/is-alphabetical) -* [`is-alphanumerical`](https://github.com/wooorm/is-alphanumerical) -* [`is-decimal`](https://github.com/wooorm/is-decimal) -* [`is-hexadecimal`](https://github.com/wooorm/is-hexadecimal) -* [`is-whitespace-character`](https://github.com/wooorm/is-whitespace-character) - -## License - -[MIT][license] © [Titus Wormer][author] - - - -[build-badge]: https://img.shields.io/travis/wooorm/is-word-character.svg - -[build]: https://travis-ci.org/wooorm/is-word-character - -[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/is-word-character.svg - -[coverage]: https://codecov.io/github/wooorm/is-word-character - -[downloads-badge]: https://img.shields.io/npm/dm/is-word-character.svg - -[downloads]: https://www.npmjs.com/package/is-word-character - -[size-badge]: https://img.shields.io/bundlephobia/minzip/is-word-character.svg - -[size]: https://bundlephobia.com/result?p=is-word-character - -[npm]: https://docs.npmjs.com/cli/install - -[license]: license - -[author]: https://wooorm.com diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/markdown-escapes/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/markdown-escapes/index.js deleted file mode 100644 index f8bea48eacca65..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/markdown-escapes/index.js +++ /dev/null @@ -1,57 +0,0 @@ -'use strict' - -module.exports = escapes - -var defaults = [ - '\\', - '`', - '*', - '{', - '}', - '[', - ']', - '(', - ')', - '#', - '+', - '-', - '.', - '!', - '_', - '>' -] - -var gfm = defaults.concat(['~', '|']) - -var commonmark = gfm.concat([ - '\n', - '"', - '$', - '%', - '&', - "'", - ',', - '/', - ':', - ';', - '<', - '=', - '?', - '@', - '^' -]) - -escapes.default = defaults -escapes.gfm = gfm -escapes.commonmark = commonmark - -// Get markdown escapes. -function escapes(options) { - var settings = options || {} - - if (settings.commonmark) { - return commonmark - } - - return settings.gfm ? gfm : defaults -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/markdown-escapes/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/markdown-escapes/package.json deleted file mode 100644 index 7f94d86ad7acc9..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/markdown-escapes/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "markdown-escapes", - "version": "1.0.4", - "description": "List of escapable characters in markdown", - "license": "MIT", - "keywords": [ - "markdown", - "escape", - "pedantic", - "gfm", - "commonmark" - ], - "repository": "wooorm/markdown-escapes", - "bugs": "https://github.com/wooorm/markdown-escapes/issues", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - }, - "author": "Titus Wormer (https://wooorm.com)", - "contributors": [ - "Titus Wormer (https://wooorm.com)" - ], - "files": [ - "index.js" - ], - "dependencies": {}, - "devDependencies": { - "browserify": "^16.0.0", - "nyc": "^14.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 . -s markdownEscapes -o markdown-escapes.js", - "build-mangle": "browserify . -s markdownEscapes -p tinyify -o markdown-escapes.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" - }, - "remarkConfig": { - "plugins": [ - "preset-wooorm" - ] - }, - "prettier": { - "tabWidth": 2, - "useTabs": false, - "singleQuote": true, - "bracketSpacing": false, - "semi": false, - "trailingComma": "none" - }, - "xo": { - "prettier": true, - "esnext": false, - "ignores": [ - "markdown-escapes.js" - ] - }, - "nyc": { - "check-coverage": true, - "lines": 100, - "functions": 100, - "branches": 100 - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/markdown-escapes/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/markdown-escapes/readme.md deleted file mode 100644 index a7404526114d3d..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/markdown-escapes/readme.md +++ /dev/null @@ -1,80 +0,0 @@ -# markdown-escapes - -[![Build][build-badge]][build] -[![Coverage][coverage-badge]][coverage] -[![Downloads][downloads-badge]][downloads] -[![Size][size-badge]][size] - -List of escapable characters in markdown. - -## Install - -[npm][]: - -```sh -npm install markdown-escapes -``` - -## Use - -```js -var escapes = require('markdown-escapes'); - -// Access by property: -escapes.commonmark; //=> ['\\', '`', ..., '@', '^'] - -// Access by options object: -escapes({gfm: true}); //=> ['\\', '`', ..., '~', '|'] -``` - -## API - -### `escapes([options])` - -Get escapes. -Supports `options.commonmark` and `options.gfm`, which when `true` returns the -extra escape characters supported by those flavors. - -###### Returns - -`Array.`. - -### `escapes.default` - -List of default escapable characters. - -### `escapes.gfm` - -List of escapable characters in GFM (which includes all `default`s). - -### `escapes.commonmark` - -List of escapable characters in CommonMark (which includes all `gfm`s). - -## License - -[MIT][license] © [Titus Wormer][author] - - - -[build-badge]: https://img.shields.io/travis/wooorm/markdown-escapes.svg - -[build]: https://travis-ci.org/wooorm/markdown-escapes - -[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/markdown-escapes.svg - -[coverage]: https://codecov.io/github/wooorm/markdown-escapes - -[downloads-badge]: https://img.shields.io/npm/dm/markdown-escapes.svg - -[downloads]: https://www.npmjs.com/package/markdown-escapes - -[size-badge]: https://img.shields.io/bundlephobia/minzip/markdown-escapes.svg - -[size]: https://bundlephobia.com/result?p=markdown-escapes - -[npm]: https://docs.npmjs.com/cli/install - -[license]: license - -[author]: https://wooorm.com diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-from-markdown/dist/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-from-markdown/dist/index.js new file mode 100644 index 00000000000000..c34f023f456fa7 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-from-markdown/dist/index.js @@ -0,0 +1,823 @@ +'use strict' + +module.exports = fromMarkdown + +// These three are compiled away in the `dist/` + +var toString = require('mdast-util-to-string') +var assign = require('micromark/dist/constant/assign') +var own = require('micromark/dist/constant/has-own-property') +var normalizeIdentifier = require('micromark/dist/util/normalize-identifier') +var safeFromInt = require('micromark/dist/util/safe-from-int') +var parser = require('micromark/dist/parse') +var preprocessor = require('micromark/dist/preprocess') +var postprocess = require('micromark/dist/postprocess') +var decode = require('parse-entities/decode-entity') +var stringifyPosition = require('unist-util-stringify-position') + +function fromMarkdown(value, encoding, options) { + if (typeof encoding !== 'string') { + options = encoding + encoding = undefined + } + + return compiler(options)( + postprocess( + parser(options).document().write(preprocessor()(value, encoding, true)) + ) + ) +} + +// Note this compiler only understand complete buffering, not streaming. +function compiler(options) { + var settings = options || {} + var config = configure( + { + transforms: [], + canContainEols: [ + 'emphasis', + 'fragment', + 'heading', + 'paragraph', + 'strong' + ], + + enter: { + autolink: opener(link), + autolinkProtocol: onenterdata, + autolinkEmail: onenterdata, + atxHeading: opener(heading), + blockQuote: opener(blockQuote), + characterEscape: onenterdata, + characterReference: onenterdata, + codeFenced: opener(codeFlow), + codeFencedFenceInfo: buffer, + codeFencedFenceMeta: buffer, + codeIndented: opener(codeFlow, buffer), + codeText: opener(codeText, buffer), + codeTextData: onenterdata, + data: onenterdata, + codeFlowValue: onenterdata, + definition: opener(definition), + definitionDestinationString: buffer, + definitionLabelString: buffer, + definitionTitleString: buffer, + emphasis: opener(emphasis), + hardBreakEscape: opener(hardBreak), + hardBreakTrailing: opener(hardBreak), + htmlFlow: opener(html, buffer), + htmlFlowData: onenterdata, + htmlText: opener(html, buffer), + htmlTextData: onenterdata, + image: opener(image), + label: buffer, + link: opener(link), + listItem: opener(listItem), + listItemValue: onenterlistitemvalue, + listOrdered: opener(list, onenterlistordered), + listUnordered: opener(list), + paragraph: opener(paragraph), + reference: onenterreference, + referenceString: buffer, + resourceDestinationString: buffer, + resourceTitleString: buffer, + setextHeading: opener(heading), + strong: opener(strong), + thematicBreak: opener(thematicBreak) + }, + + exit: { + atxHeading: closer(), + atxHeadingSequence: onexitatxheadingsequence, + autolink: closer(), + autolinkEmail: onexitautolinkemail, + autolinkProtocol: onexitautolinkprotocol, + blockQuote: closer(), + characterEscapeValue: onexitdata, + characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, + characterReferenceMarkerNumeric: onexitcharacterreferencemarker, + characterReferenceValue: onexitcharacterreferencevalue, + codeFenced: closer(onexitcodefenced), + codeFencedFence: onexitcodefencedfence, + codeFencedFenceInfo: onexitcodefencedfenceinfo, + codeFencedFenceMeta: onexitcodefencedfencemeta, + codeFlowValue: onexitdata, + codeIndented: closer(onexitcodeindented), + codeText: closer(onexitcodetext), + codeTextData: onexitdata, + data: onexitdata, + definition: closer(), + definitionDestinationString: onexitdefinitiondestinationstring, + definitionLabelString: onexitdefinitionlabelstring, + definitionTitleString: onexitdefinitiontitlestring, + emphasis: closer(), + hardBreakEscape: closer(onexithardbreak), + hardBreakTrailing: closer(onexithardbreak), + htmlFlow: closer(onexithtmlflow), + htmlFlowData: onexitdata, + htmlText: closer(onexithtmltext), + htmlTextData: onexitdata, + image: closer(onexitimage), + label: onexitlabel, + labelText: onexitlabeltext, + lineEnding: onexitlineending, + link: closer(onexitlink), + listItem: closer(), + listOrdered: closer(), + listUnordered: closer(), + paragraph: closer(), + referenceString: onexitreferencestring, + resourceDestinationString: onexitresourcedestinationstring, + resourceTitleString: onexitresourcetitlestring, + resource: onexitresource, + setextHeading: closer(onexitsetextheading), + setextHeadingLineSequence: onexitsetextheadinglinesequence, + setextHeadingText: onexitsetextheadingtext, + strong: closer(), + thematicBreak: closer() + } + }, + + settings.mdastExtensions || [] + ) + + var data = {} + + return compile + + function compile(events) { + var tree = {type: 'root', children: []} + var stack = [tree] + var tokenStack = [] + var listStack = [] + var index = -1 + var handler + var listStart + + var context = { + stack: stack, + tokenStack: tokenStack, + config: config, + enter: enter, + exit: exit, + buffer: buffer, + resume: resume, + setData: setData, + getData: getData + } + + while (++index < events.length) { + // We preprocess lists to add `listItem` tokens, and to infer whether + // items the list itself are spread out. + if ( + events[index][1].type === 'listOrdered' || + events[index][1].type === 'listUnordered' + ) { + if (events[index][0] === 'enter') { + listStack.push(index) + } else { + listStart = listStack.pop(index) + index = prepareList(events, listStart, index) + } + } + } + + index = -1 + + while (++index < events.length) { + handler = config[events[index][0]] + + if (own.call(handler, events[index][1].type)) { + handler[events[index][1].type].call( + assign({sliceSerialize: events[index][2].sliceSerialize}, context), + events[index][1] + ) + } + } + + if (tokenStack.length) { + throw new Error( + 'Cannot close document, a token (`' + + tokenStack[tokenStack.length - 1].type + + '`, ' + + stringifyPosition({ + start: tokenStack[tokenStack.length - 1].start, + end: tokenStack[tokenStack.length - 1].end + }) + + ') is still open' + ) + } + + // Figure out `root` position. + tree.position = { + start: point( + events.length ? events[0][1].start : {line: 1, column: 1, offset: 0} + ), + + end: point( + events.length + ? events[events.length - 2][1].end + : {line: 1, column: 1, offset: 0} + ) + } + + index = -1 + while (++index < config.transforms.length) { + tree = config.transforms[index](tree) || tree + } + + return tree + } + + function prepareList(events, start, length) { + var index = start - 1 + var containerBalance = -1 + var listSpread = false + var listItem + var tailIndex + var lineIndex + var tailEvent + var event + var firstBlankLineIndex + var atMarker + + while (++index <= length) { + event = events[index] + + if ( + event[1].type === 'listUnordered' || + event[1].type === 'listOrdered' || + event[1].type === 'blockQuote' + ) { + if (event[0] === 'enter') { + containerBalance++ + } else { + containerBalance-- + } + + atMarker = undefined + } else if (event[1].type === 'lineEndingBlank') { + if (event[0] === 'enter') { + if ( + listItem && + !atMarker && + !containerBalance && + !firstBlankLineIndex + ) { + firstBlankLineIndex = index + } + + atMarker = undefined + } + } else if ( + event[1].type === 'linePrefix' || + event[1].type === 'listItemValue' || + event[1].type === 'listItemMarker' || + event[1].type === 'listItemPrefix' || + event[1].type === 'listItemPrefixWhitespace' + ) { + // Empty. + } else { + atMarker = undefined + } + + if ( + (!containerBalance && + event[0] === 'enter' && + event[1].type === 'listItemPrefix') || + (containerBalance === -1 && + event[0] === 'exit' && + (event[1].type === 'listUnordered' || + event[1].type === 'listOrdered')) + ) { + if (listItem) { + tailIndex = index + lineIndex = undefined + + while (tailIndex--) { + tailEvent = events[tailIndex] + + if ( + tailEvent[1].type === 'lineEnding' || + tailEvent[1].type === 'lineEndingBlank' + ) { + if (tailEvent[0] === 'exit') continue + + if (lineIndex) { + events[lineIndex][1].type = 'lineEndingBlank' + listSpread = true + } + + tailEvent[1].type = 'lineEnding' + lineIndex = tailIndex + } else if ( + tailEvent[1].type === 'linePrefix' || + tailEvent[1].type === 'blockQuotePrefix' || + tailEvent[1].type === 'blockQuotePrefixWhitespace' || + tailEvent[1].type === 'blockQuoteMarker' || + tailEvent[1].type === 'listItemIndent' + ) { + // Empty + } else { + break + } + } + + if ( + firstBlankLineIndex && + (!lineIndex || firstBlankLineIndex < lineIndex) + ) { + listItem._spread = true + } + + // Fix position. + listItem.end = point( + lineIndex ? events[lineIndex][1].start : event[1].end + ) + + events.splice(lineIndex || index, 0, ['exit', listItem, event[2]]) + index++ + length++ + } + + // Create a new list item. + if (event[1].type === 'listItemPrefix') { + listItem = { + type: 'listItem', + _spread: false, + start: point(event[1].start) + } + + events.splice(index, 0, ['enter', listItem, event[2]]) + index++ + length++ + firstBlankLineIndex = undefined + atMarker = true + } + } + } + + events[start][1]._spread = listSpread + return length + } + + function setData(key, value) { + data[key] = value + } + + function getData(key) { + return data[key] + } + + function point(d) { + return {line: d.line, column: d.column, offset: d.offset} + } + + function opener(create, and) { + return open + + function open(token) { + enter.call(this, create(token), token) + if (and) and.call(this, token) + } + } + + function buffer() { + this.stack.push({type: 'fragment', children: []}) + } + + function enter(node, token) { + this.stack[this.stack.length - 1].children.push(node) + this.stack.push(node) + this.tokenStack.push(token) + node.position = {start: point(token.start)} + return node + } + + function closer(and) { + return close + + function close(token) { + if (and) and.call(this, token) + exit.call(this, token) + } + } + + function exit(token) { + var node = this.stack.pop() + var open = this.tokenStack.pop() + + if (!open) { + throw new Error( + 'Cannot close `' + + token.type + + '` (' + + stringifyPosition({start: token.start, end: token.end}) + + '): it’s not open' + ) + } else if (open.type !== token.type) { + throw new Error( + 'Cannot close `' + + token.type + + '` (' + + stringifyPosition({start: token.start, end: token.end}) + + '): a different token (`' + + open.type + + '`, ' + + stringifyPosition({start: open.start, end: open.end}) + + ') is open' + ) + } + + node.position.end = point(token.end) + return node + } + + function resume() { + return toString(this.stack.pop()) + } + + // + // Handlers. + // + + function onenterlistordered() { + setData('expectingFirstListItemValue', true) + } + + function onenterlistitemvalue(token) { + if (getData('expectingFirstListItemValue')) { + this.stack[this.stack.length - 2].start = parseInt( + this.sliceSerialize(token), + 10 + ) + + setData('expectingFirstListItemValue') + } + } + + function onexitcodefencedfenceinfo() { + var data = this.resume() + this.stack[this.stack.length - 1].lang = data + } + + function onexitcodefencedfencemeta() { + var data = this.resume() + this.stack[this.stack.length - 1].meta = data + } + + function onexitcodefencedfence() { + // Exit if this is the closing fence. + if (getData('flowCodeInside')) return + this.buffer() + setData('flowCodeInside', true) + } + + function onexitcodefenced() { + var data = this.resume() + this.stack[this.stack.length - 1].value = data.replace( + /^(\r?\n|\r)|(\r?\n|\r)$/g, + '' + ) + + setData('flowCodeInside') + } + + function onexitcodeindented() { + var data = this.resume() + this.stack[this.stack.length - 1].value = data + } + + function onexitdefinitionlabelstring(token) { + // Discard label, use the source content instead. + var label = this.resume() + this.stack[this.stack.length - 1].label = label + this.stack[this.stack.length - 1].identifier = normalizeIdentifier( + this.sliceSerialize(token) + ).toLowerCase() + } + + function onexitdefinitiontitlestring() { + var data = this.resume() + this.stack[this.stack.length - 1].title = data + } + + function onexitdefinitiondestinationstring() { + var data = this.resume() + this.stack[this.stack.length - 1].url = data + } + + function onexitatxheadingsequence(token) { + if (!this.stack[this.stack.length - 1].depth) { + this.stack[this.stack.length - 1].depth = this.sliceSerialize( + token + ).length + } + } + + function onexitsetextheadingtext() { + setData('setextHeadingSlurpLineEnding', true) + } + + function onexitsetextheadinglinesequence(token) { + this.stack[this.stack.length - 1].depth = + this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2 + } + + function onexitsetextheading() { + setData('setextHeadingSlurpLineEnding') + } + + function onenterdata(token) { + var siblings = this.stack[this.stack.length - 1].children + var tail = siblings[siblings.length - 1] + + if (!tail || tail.type !== 'text') { + // Add a new text node. + tail = text() + tail.position = {start: point(token.start)} + this.stack[this.stack.length - 1].children.push(tail) + } + + this.stack.push(tail) + } + + function onexitdata(token) { + var tail = this.stack.pop() + tail.value += this.sliceSerialize(token) + tail.position.end = point(token.end) + } + + function onexitlineending(token) { + var context = this.stack[this.stack.length - 1] + + // If we’re at a hard break, include the line ending in there. + if (getData('atHardBreak')) { + context.children[context.children.length - 1].position.end = point( + token.end + ) + + setData('atHardBreak') + return + } + + if ( + !getData('setextHeadingSlurpLineEnding') && + config.canContainEols.indexOf(context.type) > -1 + ) { + onenterdata.call(this, token) + onexitdata.call(this, token) + } + } + + function onexithardbreak() { + setData('atHardBreak', true) + } + + function onexithtmlflow() { + var data = this.resume() + this.stack[this.stack.length - 1].value = data + } + + function onexithtmltext() { + var data = this.resume() + this.stack[this.stack.length - 1].value = data + } + + function onexitcodetext() { + var data = this.resume() + this.stack[this.stack.length - 1].value = data + } + + function onexitlink() { + var context = this.stack[this.stack.length - 1] + + // To do: clean. + if (getData('inReference')) { + context.type += 'Reference' + context.referenceType = getData('referenceType') || 'shortcut' + delete context.url + delete context.title + } else { + delete context.identifier + delete context.label + delete context.referenceType + } + + setData('referenceType') + } + + function onexitimage() { + var context = this.stack[this.stack.length - 1] + + // To do: clean. + if (getData('inReference')) { + context.type += 'Reference' + context.referenceType = getData('referenceType') || 'shortcut' + delete context.url + delete context.title + } else { + delete context.identifier + delete context.label + delete context.referenceType + } + + setData('referenceType') + } + + function onexitlabeltext(token) { + this.stack[this.stack.length - 2].identifier = normalizeIdentifier( + this.sliceSerialize(token) + ).toLowerCase() + } + + function onexitlabel() { + var fragment = this.stack[this.stack.length - 1] + var value = this.resume() + + this.stack[this.stack.length - 1].label = value + + // Assume a reference. + setData('inReference', true) + + if (this.stack[this.stack.length - 1].type === 'link') { + this.stack[this.stack.length - 1].children = fragment.children + } else { + this.stack[this.stack.length - 1].alt = value + } + } + + function onexitresourcedestinationstring() { + var data = this.resume() + this.stack[this.stack.length - 1].url = data + } + + function onexitresourcetitlestring() { + var data = this.resume() + this.stack[this.stack.length - 1].title = data + } + + function onexitresource() { + setData('inReference') + } + + function onenterreference() { + setData('referenceType', 'collapsed') + } + + function onexitreferencestring(token) { + var label = this.resume() + this.stack[this.stack.length - 1].label = label + this.stack[this.stack.length - 1].identifier = normalizeIdentifier( + this.sliceSerialize(token) + ).toLowerCase() + setData('referenceType', 'full') + } + + function onexitcharacterreferencemarker(token) { + setData('characterReferenceType', token.type) + } + + function onexitcharacterreferencevalue(token) { + var data = this.sliceSerialize(token) + var type = getData('characterReferenceType') + var value + var tail + + if (type) { + value = safeFromInt( + data, + type === 'characterReferenceMarkerNumeric' ? 10 : 16 + ) + + setData('characterReferenceType') + } else { + value = decode(data) + } + + tail = this.stack.pop() + tail.value += value + tail.position.end = point(token.end) + } + + function onexitautolinkprotocol(token) { + onexitdata.call(this, token) + this.stack[this.stack.length - 1].url = this.sliceSerialize(token) + } + + function onexitautolinkemail(token) { + onexitdata.call(this, token) + this.stack[this.stack.length - 1].url = + 'mailto:' + this.sliceSerialize(token) + } + + // + // Creaters. + // + + function blockQuote() { + return {type: 'blockquote', children: []} + } + + function codeFlow() { + return {type: 'code', lang: null, meta: null, value: ''} + } + + function codeText() { + return {type: 'inlineCode', value: ''} + } + + function definition() { + return { + type: 'definition', + identifier: '', + label: null, + title: null, + url: '' + } + } + + function emphasis() { + return {type: 'emphasis', children: []} + } + + function heading() { + return {type: 'heading', depth: undefined, children: []} + } + + function hardBreak() { + return {type: 'break'} + } + + function html() { + return {type: 'html', value: ''} + } + + function image() { + return {type: 'image', title: null, url: '', alt: null} + } + + function link() { + return {type: 'link', title: null, url: '', children: []} + } + + function list(token) { + return { + type: 'list', + ordered: token.type === 'listOrdered', + start: null, + spread: token._spread, + children: [] + } + } + + function listItem(token) { + return { + type: 'listItem', + spread: token._spread, + checked: null, + children: [] + } + } + + function paragraph() { + return {type: 'paragraph', children: []} + } + + function strong() { + return {type: 'strong', children: []} + } + + function text() { + return {type: 'text', value: ''} + } + + function thematicBreak() { + return {type: 'thematicBreak'} + } +} + +function configure(config, extensions) { + var index = -1 + + while (++index < extensions.length) { + extension(config, extensions[index]) + } + + return config +} + +function extension(config, extension) { + var key + var left + + for (key in extension) { + left = own.call(config, key) ? config[key] : (config[key] = {}) + + if (key === 'canContainEols' || key === 'transforms') { + config[key] = [].concat(left, extension[key]) + } else { + Object.assign(left, extension[key]) + } + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-from-markdown/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-from-markdown/index.js new file mode 100644 index 00000000000000..2b74f75ae99432 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-from-markdown/index.js @@ -0,0 +1,3 @@ +'use strict' + +module.exports = require('./dist') diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-from-markdown/lib/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-from-markdown/lib/index.js new file mode 100644 index 00000000000000..1e2e7806c09075 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-from-markdown/lib/index.js @@ -0,0 +1,819 @@ +'use strict' + +module.exports = fromMarkdown + +// These three are compiled away in the `dist/` +var codes = require('micromark/dist/character/codes') +var constants = require('micromark/dist/constant/constants') +var types = require('micromark/dist/constant/types') + +var toString = require('mdast-util-to-string') +var assign = require('micromark/dist/constant/assign') +var own = require('micromark/dist/constant/has-own-property') +var normalizeIdentifier = require('micromark/dist/util/normalize-identifier') +var safeFromInt = require('micromark/dist/util/safe-from-int') +var parser = require('micromark/dist/parse') +var preprocessor = require('micromark/dist/preprocess') +var postprocess = require('micromark/dist/postprocess') +var decode = require('parse-entities/decode-entity') +var stringifyPosition = require('unist-util-stringify-position') + +function fromMarkdown(value, encoding, options) { + if (typeof encoding !== 'string') { + options = encoding + encoding = undefined + } + + return compiler(options)( + postprocess( + parser(options).document().write(preprocessor()(value, encoding, true)) + ) + ) +} + +// Note this compiler only understand complete buffering, not streaming. +function compiler(options) { + var settings = options || {} + var config = configure( + { + transforms: [], + canContainEols: [ + 'emphasis', + 'fragment', + 'heading', + 'paragraph', + 'strong' + ], + enter: { + autolink: opener(link), + autolinkProtocol: onenterdata, + autolinkEmail: onenterdata, + atxHeading: opener(heading), + blockQuote: opener(blockQuote), + characterEscape: onenterdata, + characterReference: onenterdata, + codeFenced: opener(codeFlow), + codeFencedFenceInfo: buffer, + codeFencedFenceMeta: buffer, + codeIndented: opener(codeFlow, buffer), + codeText: opener(codeText, buffer), + codeTextData: onenterdata, + data: onenterdata, + codeFlowValue: onenterdata, + definition: opener(definition), + definitionDestinationString: buffer, + definitionLabelString: buffer, + definitionTitleString: buffer, + emphasis: opener(emphasis), + hardBreakEscape: opener(hardBreak), + hardBreakTrailing: opener(hardBreak), + htmlFlow: opener(html, buffer), + htmlFlowData: onenterdata, + htmlText: opener(html, buffer), + htmlTextData: onenterdata, + image: opener(image), + label: buffer, + link: opener(link), + listItem: opener(listItem), + listItemValue: onenterlistitemvalue, + listOrdered: opener(list, onenterlistordered), + listUnordered: opener(list), + paragraph: opener(paragraph), + reference: onenterreference, + referenceString: buffer, + resourceDestinationString: buffer, + resourceTitleString: buffer, + setextHeading: opener(heading), + strong: opener(strong), + thematicBreak: opener(thematicBreak) + }, + exit: { + atxHeading: closer(), + atxHeadingSequence: onexitatxheadingsequence, + autolink: closer(), + autolinkEmail: onexitautolinkemail, + autolinkProtocol: onexitautolinkprotocol, + blockQuote: closer(), + characterEscapeValue: onexitdata, + characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, + characterReferenceMarkerNumeric: onexitcharacterreferencemarker, + characterReferenceValue: onexitcharacterreferencevalue, + codeFenced: closer(onexitcodefenced), + codeFencedFence: onexitcodefencedfence, + codeFencedFenceInfo: onexitcodefencedfenceinfo, + codeFencedFenceMeta: onexitcodefencedfencemeta, + codeFlowValue: onexitdata, + codeIndented: closer(onexitcodeindented), + codeText: closer(onexitcodetext), + codeTextData: onexitdata, + data: onexitdata, + definition: closer(), + definitionDestinationString: onexitdefinitiondestinationstring, + definitionLabelString: onexitdefinitionlabelstring, + definitionTitleString: onexitdefinitiontitlestring, + emphasis: closer(), + hardBreakEscape: closer(onexithardbreak), + hardBreakTrailing: closer(onexithardbreak), + htmlFlow: closer(onexithtmlflow), + htmlFlowData: onexitdata, + htmlText: closer(onexithtmltext), + htmlTextData: onexitdata, + image: closer(onexitimage), + label: onexitlabel, + labelText: onexitlabeltext, + lineEnding: onexitlineending, + link: closer(onexitlink), + listItem: closer(), + listOrdered: closer(), + listUnordered: closer(), + paragraph: closer(), + referenceString: onexitreferencestring, + resourceDestinationString: onexitresourcedestinationstring, + resourceTitleString: onexitresourcetitlestring, + resource: onexitresource, + setextHeading: closer(onexitsetextheading), + setextHeadingLineSequence: onexitsetextheadinglinesequence, + setextHeadingText: onexitsetextheadingtext, + strong: closer(), + thematicBreak: closer() + } + }, + settings.mdastExtensions || [] + ) + + var data = {} + + return compile + + function compile(events) { + var tree = {type: 'root', children: []} + var stack = [tree] + var tokenStack = [] + var listStack = [] + var index = -1 + var handler + var listStart + + var context = { + stack: stack, + tokenStack: tokenStack, + config: config, + enter: enter, + exit: exit, + buffer: buffer, + resume: resume, + setData: setData, + getData: getData + } + + while (++index < events.length) { + // We preprocess lists to add `listItem` tokens, and to infer whether + // items the list itself are spread out. + if ( + events[index][1].type === types.listOrdered || + events[index][1].type === types.listUnordered + ) { + if (events[index][0] === 'enter') { + listStack.push(index) + } else { + listStart = listStack.pop(index) + index = prepareList(events, listStart, index) + } + } + } + + index = -1 + + while (++index < events.length) { + handler = config[events[index][0]] + + if (own.call(handler, events[index][1].type)) { + handler[events[index][1].type].call( + assign({sliceSerialize: events[index][2].sliceSerialize}, context), + events[index][1] + ) + } + } + + if (tokenStack.length) { + throw new Error( + 'Cannot close document, a token (`' + + tokenStack[tokenStack.length - 1].type + + '`, ' + + stringifyPosition({ + start: tokenStack[tokenStack.length - 1].start, + end: tokenStack[tokenStack.length - 1].end + }) + + ') is still open' + ) + } + + // Figure out `root` position. + tree.position = { + start: point( + events.length ? events[0][1].start : {line: 1, column: 1, offset: 0} + ), + end: point( + events.length + ? events[events.length - 2][1].end + : {line: 1, column: 1, offset: 0} + ) + } + + index = -1 + while (++index < config.transforms.length) { + tree = config.transforms[index](tree) || tree + } + + return tree + } + + function prepareList(events, start, length) { + var index = start - 1 + var containerBalance = -1 + var listSpread = false + var listItem + var tailIndex + var lineIndex + var tailEvent + var event + var firstBlankLineIndex + var atMarker + + while (++index <= length) { + event = events[index] + + if ( + event[1].type === types.listUnordered || + event[1].type === types.listOrdered || + event[1].type === types.blockQuote + ) { + if (event[0] === 'enter') { + containerBalance++ + } else { + containerBalance-- + } + + atMarker = undefined + } else if (event[1].type === types.lineEndingBlank) { + if (event[0] === 'enter') { + if ( + listItem && + !atMarker && + !containerBalance && + !firstBlankLineIndex + ) { + firstBlankLineIndex = index + } + + atMarker = undefined + } + } else if ( + event[1].type === types.linePrefix || + event[1].type === types.listItemValue || + event[1].type === types.listItemMarker || + event[1].type === types.listItemPrefix || + event[1].type === types.listItemPrefixWhitespace + ) { + // Empty. + } else { + atMarker = undefined + } + + if ( + (!containerBalance && + event[0] === 'enter' && + event[1].type === types.listItemPrefix) || + (containerBalance === -1 && + event[0] === 'exit' && + (event[1].type === types.listUnordered || + event[1].type === types.listOrdered)) + ) { + if (listItem) { + tailIndex = index + lineIndex = undefined + + while (tailIndex--) { + tailEvent = events[tailIndex] + + if ( + tailEvent[1].type === types.lineEnding || + tailEvent[1].type === types.lineEndingBlank + ) { + if (tailEvent[0] === 'exit') continue + + if (lineIndex) { + events[lineIndex][1].type = types.lineEndingBlank + listSpread = true + } + + tailEvent[1].type = types.lineEnding + lineIndex = tailIndex + } else if ( + tailEvent[1].type === types.linePrefix || + tailEvent[1].type === types.blockQuotePrefix || + tailEvent[1].type === types.blockQuotePrefixWhitespace || + tailEvent[1].type === types.blockQuoteMarker || + tailEvent[1].type === types.listItemIndent + ) { + // Empty + } else { + break + } + } + + if ( + firstBlankLineIndex && + (!lineIndex || firstBlankLineIndex < lineIndex) + ) { + listItem._spread = true + } + + // Fix position. + listItem.end = point( + lineIndex ? events[lineIndex][1].start : event[1].end + ) + + events.splice(lineIndex || index, 0, ['exit', listItem, event[2]]) + index++ + length++ + } + + // Create a new list item. + if (event[1].type === types.listItemPrefix) { + listItem = { + type: 'listItem', + _spread: false, + start: point(event[1].start) + } + events.splice(index, 0, ['enter', listItem, event[2]]) + index++ + length++ + firstBlankLineIndex = undefined + atMarker = true + } + } + } + + events[start][1]._spread = listSpread + return length + } + + function setData(key, value) { + data[key] = value + } + + function getData(key) { + return data[key] + } + + function point(d) { + return {line: d.line, column: d.column, offset: d.offset} + } + + function opener(create, and) { + return open + + function open(token) { + enter.call(this, create(token), token) + if (and) and.call(this, token) + } + } + + function buffer() { + this.stack.push({type: 'fragment', children: []}) + } + + function enter(node, token) { + this.stack[this.stack.length - 1].children.push(node) + this.stack.push(node) + this.tokenStack.push(token) + node.position = {start: point(token.start)} + return node + } + + function closer(and) { + return close + + function close(token) { + if (and) and.call(this, token) + exit.call(this, token) + } + } + + function exit(token) { + var node = this.stack.pop() + var open = this.tokenStack.pop() + + if (!open) { + throw new Error( + 'Cannot close `' + + token.type + + '` (' + + stringifyPosition({start: token.start, end: token.end}) + + '): it’s not open' + ) + } else if (open.type !== token.type) { + throw new Error( + 'Cannot close `' + + token.type + + '` (' + + stringifyPosition({start: token.start, end: token.end}) + + '): a different token (`' + + open.type + + '`, ' + + stringifyPosition({start: open.start, end: open.end}) + + ') is open' + ) + } + + node.position.end = point(token.end) + return node + } + + function resume() { + return toString(this.stack.pop()) + } + + // + // Handlers. + // + + function onenterlistordered() { + setData('expectingFirstListItemValue', true) + } + + function onenterlistitemvalue(token) { + if (getData('expectingFirstListItemValue')) { + this.stack[this.stack.length - 2].start = parseInt( + this.sliceSerialize(token), + constants.numericBaseDecimal + ) + setData('expectingFirstListItemValue') + } + } + + function onexitcodefencedfenceinfo() { + var data = this.resume() + this.stack[this.stack.length - 1].lang = data + } + + function onexitcodefencedfencemeta() { + var data = this.resume() + this.stack[this.stack.length - 1].meta = data + } + + function onexitcodefencedfence() { + // Exit if this is the closing fence. + if (getData('flowCodeInside')) return + this.buffer() + setData('flowCodeInside', true) + } + + function onexitcodefenced() { + var data = this.resume() + this.stack[this.stack.length - 1].value = data.replace( + /^(\r?\n|\r)|(\r?\n|\r)$/g, + '' + ) + setData('flowCodeInside') + } + + function onexitcodeindented() { + var data = this.resume() + this.stack[this.stack.length - 1].value = data + } + + function onexitdefinitionlabelstring(token) { + // Discard label, use the source content instead. + var label = this.resume() + this.stack[this.stack.length - 1].label = label + this.stack[this.stack.length - 1].identifier = normalizeIdentifier( + this.sliceSerialize(token) + ).toLowerCase() + } + + function onexitdefinitiontitlestring() { + var data = this.resume() + this.stack[this.stack.length - 1].title = data + } + + function onexitdefinitiondestinationstring() { + var data = this.resume() + this.stack[this.stack.length - 1].url = data + } + + function onexitatxheadingsequence(token) { + if (!this.stack[this.stack.length - 1].depth) { + this.stack[this.stack.length - 1].depth = this.sliceSerialize( + token + ).length + } + } + + function onexitsetextheadingtext() { + setData('setextHeadingSlurpLineEnding', true) + } + + function onexitsetextheadinglinesequence(token) { + this.stack[this.stack.length - 1].depth = + this.sliceSerialize(token).charCodeAt(0) === codes.equalsTo ? 1 : 2 + } + + function onexitsetextheading() { + setData('setextHeadingSlurpLineEnding') + } + + function onenterdata(token) { + var siblings = this.stack[this.stack.length - 1].children + var tail = siblings[siblings.length - 1] + + if (!tail || tail.type !== 'text') { + // Add a new text node. + tail = text() + tail.position = {start: point(token.start)} + this.stack[this.stack.length - 1].children.push(tail) + } + + this.stack.push(tail) + } + + function onexitdata(token) { + var tail = this.stack.pop() + tail.value += this.sliceSerialize(token) + tail.position.end = point(token.end) + } + + function onexitlineending(token) { + var context = this.stack[this.stack.length - 1] + + // If we’re at a hard break, include the line ending in there. + if (getData('atHardBreak')) { + context.children[context.children.length - 1].position.end = point( + token.end + ) + setData('atHardBreak') + return + } + + if ( + !getData('setextHeadingSlurpLineEnding') && + config.canContainEols.indexOf(context.type) > -1 + ) { + onenterdata.call(this, token) + onexitdata.call(this, token) + } + } + + function onexithardbreak() { + setData('atHardBreak', true) + } + + function onexithtmlflow() { + var data = this.resume() + this.stack[this.stack.length - 1].value = data + } + + function onexithtmltext() { + var data = this.resume() + this.stack[this.stack.length - 1].value = data + } + + function onexitcodetext() { + var data = this.resume() + this.stack[this.stack.length - 1].value = data + } + + function onexitlink() { + var context = this.stack[this.stack.length - 1] + + // To do: clean. + if (getData('inReference')) { + context.type += 'Reference' + context.referenceType = getData('referenceType') || 'shortcut' + delete context.url + delete context.title + } else { + delete context.identifier + delete context.label + delete context.referenceType + } + + setData('referenceType') + } + + function onexitimage() { + var context = this.stack[this.stack.length - 1] + + // To do: clean. + if (getData('inReference')) { + context.type += 'Reference' + context.referenceType = getData('referenceType') || 'shortcut' + delete context.url + delete context.title + } else { + delete context.identifier + delete context.label + delete context.referenceType + } + + setData('referenceType') + } + + function onexitlabeltext(token) { + this.stack[this.stack.length - 2].identifier = normalizeIdentifier( + this.sliceSerialize(token) + ).toLowerCase() + } + + function onexitlabel() { + var fragment = this.stack[this.stack.length - 1] + var value = this.resume() + + this.stack[this.stack.length - 1].label = value + + // Assume a reference. + setData('inReference', true) + + if (this.stack[this.stack.length - 1].type === 'link') { + this.stack[this.stack.length - 1].children = fragment.children + } else { + this.stack[this.stack.length - 1].alt = value + } + } + + function onexitresourcedestinationstring() { + var data = this.resume() + this.stack[this.stack.length - 1].url = data + } + + function onexitresourcetitlestring() { + var data = this.resume() + this.stack[this.stack.length - 1].title = data + } + + function onexitresource() { + setData('inReference') + } + + function onenterreference() { + setData('referenceType', 'collapsed') + } + + function onexitreferencestring(token) { + var label = this.resume() + this.stack[this.stack.length - 1].label = label + this.stack[this.stack.length - 1].identifier = normalizeIdentifier( + this.sliceSerialize(token) + ).toLowerCase() + setData('referenceType', 'full') + } + + function onexitcharacterreferencemarker(token) { + setData('characterReferenceType', token.type) + } + + function onexitcharacterreferencevalue(token) { + var data = this.sliceSerialize(token) + var type = getData('characterReferenceType') + var value + var tail + + if (type) { + value = safeFromInt( + data, + type === types.characterReferenceMarkerNumeric + ? constants.numericBaseDecimal + : constants.numericBaseHexadecimal + ) + setData('characterReferenceType') + } else { + value = decode(data) + } + + tail = this.stack.pop() + tail.value += value + tail.position.end = point(token.end) + } + + function onexitautolinkprotocol(token) { + onexitdata.call(this, token) + this.stack[this.stack.length - 1].url = this.sliceSerialize(token) + } + + function onexitautolinkemail(token) { + onexitdata.call(this, token) + this.stack[this.stack.length - 1].url = + 'mailto:' + this.sliceSerialize(token) + } + + // + // Creaters. + // + + function blockQuote() { + return {type: 'blockquote', children: []} + } + + function codeFlow() { + return {type: 'code', lang: null, meta: null, value: ''} + } + + function codeText() { + return {type: 'inlineCode', value: ''} + } + + function definition() { + return { + type: 'definition', + identifier: '', + label: null, + title: null, + url: '' + } + } + + function emphasis() { + return {type: 'emphasis', children: []} + } + + function heading() { + return {type: 'heading', depth: undefined, children: []} + } + + function hardBreak() { + return {type: 'break'} + } + + function html() { + return {type: 'html', value: ''} + } + + function image() { + return {type: 'image', title: null, url: '', alt: null} + } + + function link() { + return {type: 'link', title: null, url: '', children: []} + } + + function list(token) { + return { + type: 'list', + ordered: token.type === 'listOrdered', + start: null, + spread: token._spread, + children: [] + } + } + + function listItem(token) { + return { + type: 'listItem', + spread: token._spread, + checked: null, + children: [] + } + } + + function paragraph() { + return {type: 'paragraph', children: []} + } + + function strong() { + return {type: 'strong', children: []} + } + + function text() { + return {type: 'text', value: ''} + } + + function thematicBreak() { + return {type: 'thematicBreak'} + } +} + +function configure(config, extensions) { + var index = -1 + + while (++index < extensions.length) { + extension(config, extensions[index]) + } + + return config +} + +function extension(config, extension) { + var key + var left + + for (key in extension) { + left = own.call(config, key) ? config[key] : (config[key] = {}) + + if (key === 'canContainEols' || key === 'transforms') { + config[key] = [].concat(left, extension[key]) + } else { + Object.assign(left, extension[key]) + } + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/collapse-white-space/license b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-from-markdown/license similarity index 94% rename from tools/node_modules/eslint-plugin-markdown/node_modules/collapse-white-space/license rename to tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-from-markdown/license index 32e7a3d93ca5a2..39372356c47d0f 100644 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/collapse-white-space/license +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-from-markdown/license @@ -1,6 +1,6 @@ (The MIT License) -Copyright (c) 2015 Titus Wormer +Copyright (c) 2020 Titus Wormer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-from-markdown/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-from-markdown/package.json new file mode 100644 index 00000000000000..b17e76df3f7162 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-from-markdown/package.json @@ -0,0 +1,109 @@ +{ + "name": "mdast-util-from-markdown", + "version": "0.8.5", + "description": "mdast utility to parse markdown", + "license": "MIT", + "keywords": [ + "unist", + "mdast", + "mdast-util", + "util", + "utility", + "markdown", + "markup", + "parse", + "syntax", + "tree", + "ast" + ], + "repository": "syntax-tree/mdast-util-from-markdown", + "bugs": "https://github.com/syntax-tree/mdast-util-from-markdown/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "files": [ + "dist/", + "lib/", + "index.js", + "types/index.d.ts" + ], + "types": "types", + "dependencies": { + "@types/mdast": "^3.0.0", + "mdast-util-to-string": "^2.0.0", + "micromark": "~2.11.0", + "parse-entities": "^2.0.0", + "unist-util-stringify-position": "^2.0.0" + }, + "devDependencies": { + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "babel-plugin-inline-constants": "^1.0.0", + "browserify": "^17.0.0", + "commonmark.json": "^0.29.0", + "dtslint": "^4.0.0", + "gzip-size-cli": "^4.0.0", + "hast-util-to-html": "^7.0.0", + "mdast-util-to-hast": "^10.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "rehype-parse": "^7.0.0", + "rehype-stringify": "^8.0.0", + "remark-cli": "^9.0.0", + "remark-preset-wooorm": "^8.0.0", + "tape": "^5.0.0", + "tinyify": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.37.0" + }, + "scripts": { + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "generate-dist": "babel lib/ --out-dir dist/ --quiet --retain-lines; prettier dist/ --loglevel error --write", + "generate-size": "browserify . -p tinyify -s mdast-util-from-markdown -o mdast-util-from-markdown.min.js; gzip-size mdast-util-from-markdown.min.js --raw", + "generate": "npm run generate-dist && npm run generate-size", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test/index.js", + "test-types": "dtslint types", + "test": "npm run format && npm run generate && 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": { + "complexity": "off", + "guard-for-in": "off", + "unicorn/explicit-length-check": "off", + "unicorn/no-array-callback-reference": "off", + "unicorn/prefer-includes": "off", + "unicorn/prefer-number-properties": "off", + "unicorn/prefer-optional-catch-binding": "off" + }, + "ignores": [ + "types/" + ] + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-from-markdown/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-from-markdown/readme.md new file mode 100644 index 00000000000000..30362141dc2e08 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-from-markdown/readme.md @@ -0,0 +1,206 @@ +# mdast-util-from-markdown + +[![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][]** utility to parse markdown. + +## Install + +[npm][]: + +```sh +npm install mdast-util-from-markdown +``` + +## Use + +Say we have the following markdown file, `example.md`: + +```markdown +## Hello, *World*! +``` + +And our script, `example.js`, looks as follows: + +```js +var fs = require('fs') +var fromMarkdown = require('mdast-util-from-markdown') + +var doc = fs.readFileSync('example.md') + +var tree = fromMarkdown(doc) + +console.log(tree) +``` + +Now, running `node example` yields (positional info removed for brevity): + +```js +{ + type: 'root', + children: [ + { + type: 'heading', + depth: 2, + children: [ + {type: 'text', value: 'Hello, '}, + { + type: 'emphasis', + children: [{type: 'text', value: 'World'}] + }, + {type: 'text', value: '!'} + ] + } + ] +} +``` + +## API + +### `fromMarkdown(doc[, encoding][, options])` + +Parse markdown to a **[mdast][]** tree. + +##### Parameters + +###### `doc` + +Value to parse (`string` or [`Buffer`][buffer]). + +###### `encoding` + +[Character encoding][encoding] to understand `doc` as when it’s a +[`Buffer`][buffer] (`string`, default: `'utf8'`). + +###### `options.extensions` + +Array of syntax extensions (`Array.`, default: `[]`). +Passed to [`micromark` as `extensions`][micromark-extensions]. + +###### `options.mdastExtensions` + +Array of mdast extensions (`Array.`, default: `[]`). + +##### Returns + +[`Root`][root]. + +## List of extensions + +* [`syntax-tree/mdast-util-directive`](https://github.com/syntax-tree/mdast-util-directive) + — parse directives +* [`syntax-tree/mdast-util-footnote`](https://github.com/syntax-tree/mdast-util-footnote) + — parse footnotes +* [`syntax-tree/mdast-util-frontmatter`](https://github.com/syntax-tree/mdast-util-frontmatter) + — parse frontmatter (YAML, TOML, more) +* [`syntax-tree/mdast-util-gfm`](https://github.com/syntax-tree/mdast-util-gfm) + — parse GFM +* [`syntax-tree/mdast-util-gfm-autolink-literal`](https://github.com/syntax-tree/mdast-util-gfm-autolink-literal) + — parse GFM autolink literals +* [`syntax-tree/mdast-util-gfm-strikethrough`](https://github.com/syntax-tree/mdast-util-gfm-strikethrough) + — parse GFM strikethrough +* [`syntax-tree/mdast-util-gfm-table`](https://github.com/syntax-tree/mdast-util-gfm-table) + — parse GFM tables +* [`syntax-tree/mdast-util-gfm-task-list-item`](https://github.com/syntax-tree/mdast-util-gfm-task-list-item) + — parse GFM task list items +* [`syntax-tree/mdast-util-math`](https://github.com/syntax-tree/mdast-util-math) + — parse math +* [`syntax-tree/mdast-util-mdx`](https://github.com/syntax-tree/mdast-util-mdx) + — parse MDX or MDX.js +* [`syntax-tree/mdast-util-mdx-expression`](https://github.com/syntax-tree/mdast-util-mdx-expression) + — parse MDX or MDX.js expressions +* [`syntax-tree/mdast-util-mdx-jsx`](https://github.com/syntax-tree/mdast-util-mdx-jsx) + — parse MDX or MDX.js JSX +* [`syntax-tree/mdast-util-mdxjs-esm`](https://github.com/syntax-tree/mdast-util-mdxjs-esm) + — parse MDX.js ESM + +## 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 `mdast-util-from-markdown` +can also be unsafe. +When going to HTML, use this utility in combination with +[`hast-util-sanitize`][sanitize] to make the tree safe. + +## Related + +* [`micromark/micromark`](https://github.com/micromark/micromark) + — the smallest commonmark-compliant markdown parser that exists +* [`remarkjs/remark`](https://github.com/remarkjs/remark) + — markdown processor powered by plugins +* [`syntax-tree/mdast-util-to-markdown`](https://github.com/syntax-tree/mdast-util-to-markdown) + — serialize mdast to markdown + +## 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] + + + +[build-badge]: https://github.com/syntax-tree/mdast-util-from-markdown/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/mdast-util-from-markdown/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-from-markdown.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-from-markdown + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-from-markdown.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-from-markdown + +[size-badge]: https://img.shields.io/bundlephobia/minzip/mdast-util-from-markdown.svg + +[size]: https://bundlephobia.com/result?p=mdast-util-from-markdown + +[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 + +[mdast]: https://github.com/syntax-tree/mdast + +[root]: https://github.com/syntax-tree/mdast#root + +[encoding]: https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings + +[buffer]: https://nodejs.org/api/buffer.html + +[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[sanitize]: https://github.com/syntax-tree/hast-util-sanitize + +[micromark-extensions]: https://github.com/micromark/micromark#optionsextensions diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-to-string/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-to-string/index.js new file mode 100644 index 00000000000000..0ae5f1dbdb3cfc --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-to-string/index.js @@ -0,0 +1,29 @@ +'use strict' + +module.exports = toString + +// Get the text content of a node. +// Prefer the node’s plain-text fields, otherwise serialize its children, +// and if the given value is an array, serialize the nodes in it. +function toString(node) { + return ( + (node && + (node.value || + node.alt || + node.title || + ('children' in node && all(node.children)) || + ('length' in node && all(node)))) || + '' + ) +} + +function all(values) { + var result = [] + var index = -1 + + while (++index < values.length) { + result[index] = toString(values[index]) + } + + return result.join('') +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/bail/license b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-to-string/license similarity index 100% rename from tools/node_modules/eslint-plugin-markdown/node_modules/bail/license rename to tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-to-string/license diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/trim-trailing-lines/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-to-string/package.json similarity index 57% rename from tools/node_modules/eslint-plugin-markdown/node_modules/trim-trailing-lines/package.json rename to tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-to-string/package.json index 861198394c3220..124287e2978476 100644 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/trim-trailing-lines/package.json +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-to-string/package.json @@ -1,31 +1,37 @@ { - "name": "trim-trailing-lines", - "version": "1.1.4", - "description": "Remove final line feeds from a string", + "name": "mdast-util-to-string", + "version": "2.0.0", + "description": "mdast utility to get the plain text content of a node", "license": "MIT", "keywords": [ - "trim", - "final", - "line", - "newline", - "characters" + "unist", + "mdast", + "mdast-util", + "util", + "utility", + "markdown", + "node", + "string", + "serialize" ], - "repository": "wooorm/trim-trailing-lines", - "bugs": "https://github.com/wooorm/trim-trailing-lines/issues", + "repository": "syntax-tree/mdast-util-to-string", + "bugs": "https://github.com/syntax-tree/mdast-util-to-string/issues", "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" + "type": "opencollective", + "url": "https://opencollective.com/unified" }, "author": "Titus Wormer (https://wooorm.com)", "contributors": [ "Titus Wormer (https://wooorm.com)" ], "files": [ - "index.js" + "index.js", + "types/index.d.ts" ], - "dependencies": {}, + "types": "types/index.d.ts", "devDependencies": { "browserify": "^17.0.0", + "dtslint": "^4.0.0", "nyc": "^15.0.0", "prettier": "^2.0.0", "remark-cli": "^9.0.0", @@ -36,18 +42,13 @@ }, "scripts": { "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", - "build-bundle": "browserify . -s trimTrailingLines -o trim-trailing-lines.js", - "build-mangle": "browserify . -s trimTrailingLines -p tinyify -o trim-trailing-lines.min.js", + "build-bundle": "browserify . -s mdastUtilToString -o mdast-util-to-string.js", + "build-mangle": "browserify . -s mdastUtilToString -o mdast-util-to-string.min.js -p tinyify", "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" - }, - "nyc": { - "check-coverage": true, - "lines": 100, - "functions": 100, - "branches": 100 + "test-types": "dtslint types", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types" }, "prettier": { "tabWidth": 2, @@ -60,10 +61,17 @@ "xo": { "prettier": true, "esnext": false, - "ignores": [ - "trim-trailing-lines.js" + "ignore": [ + "mdast-util-to-string.js", + "types/test.ts" ] }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, "remarkConfig": { "plugins": [ "preset-wooorm" diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-to-string/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-to-string/readme.md new file mode 100644 index 00000000000000..2b7f1a0ed03ad5 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/mdast-util-to-string/readme.md @@ -0,0 +1,127 @@ +# mdast-util-to-string + +[![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][]** utility to get the plain text content of a node. + +## Install + +[npm][]: + +```sh +npm install mdast-util-to-string +``` + +## Use + +```js +var unified = require('unified') +var parse = require('remark-parse') +var toString = require('mdast-util-to-string') + +var tree = unified() + .use(parse) + .parse('Some _emphasis_, **importance**, and `code`.') + +console.log(toString(tree)) // => 'Some emphasis, importance, and code.' +``` + +## API + +### `toString(node)` + +Get the text content of a [node][] or list of nodes. + +The algorithm checks `value` of `node`, then `alt`, and finally `title`. +If no value is found, the algorithm checks the children of `node` and joins them +(without spaces or newlines). + +> This is not a markdown to plain-text library. +> Use [`strip-markdown`][strip-markdown] for that. + +## Security + +Use of `mdast-util-to-string` does not involve **[hast][]**, user content, or +change the tree, so there are no openings for [cross-site scripting (XSS)][xss] +attacks. + +## Related + +* [`nlcst-to-string`](https://github.com/syntax-tree/nlcst-to-string) + — Get text content in nlcst +* [`hast-util-to-string`](https://github.com/wooorm/rehype-minify/tree/HEAD/packages/hast-util-to-string) + — Get text content in hast +* [`hast-util-to-text`](https://github.com/syntax-tree/hast-util-to-text) + — Get text content in hast according to the `innerText` algorithm +* [`hast-util-from-string`](https://github.com/wooorm/rehype-minify/tree/HEAD/packages/hast-util-from-string) + — Set text content in hast + +## 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] + + + +[build-badge]: https://github.com/syntax-tree/mdast-util-to-string/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/mdast-util-to-string/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-to-string.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-to-string + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-to-string.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-to-string + +[size-badge]: https://img.shields.io/bundlephobia/minzip/mdast-util-to-string.svg + +[size]: https://bundlephobia.com/result?p=mdast-util-to-string + +[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 + +[mdast]: https://github.com/syntax-tree/mdast + +[node]: https://github.com/syntax-tree/mdast#nodes + +[strip-markdown]: https://github.com/remarkjs/strip-markdown + +[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[hast]: https://github.com/syntax-tree/hast diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/buffer.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/buffer.js new file mode 100644 index 00000000000000..2b74f75ae99432 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/buffer.js @@ -0,0 +1,3 @@ +'use strict' + +module.exports = require('./dist') diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/buffer.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/buffer.mjs new file mode 100644 index 00000000000000..9b91a071fdaca6 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/buffer.mjs @@ -0,0 +1 @@ +export {default} from './dist/index.js' diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-alpha.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-alpha.js new file mode 100644 index 00000000000000..4e5b20d20b9315 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-alpha.js @@ -0,0 +1,7 @@ +'use strict' + +var regexCheck = require('../util/regex-check.js') + +var asciiAlpha = regexCheck(/[A-Za-z]/) + +module.exports = asciiAlpha diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-alphanumeric.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-alphanumeric.js new file mode 100644 index 00000000000000..4ab360273aa25e --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-alphanumeric.js @@ -0,0 +1,7 @@ +'use strict' + +var regexCheck = require('../util/regex-check.js') + +var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/) + +module.exports = asciiAlphanumeric diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-atext.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-atext.js new file mode 100644 index 00000000000000..8962f996ede7ef --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-atext.js @@ -0,0 +1,7 @@ +'use strict' + +var regexCheck = require('../util/regex-check.js') + +var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/) + +module.exports = asciiAtext diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-control.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-control.js new file mode 100644 index 00000000000000..604ed1f2c66ee7 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-control.js @@ -0,0 +1,12 @@ +'use strict' + +// Note: EOF is seen as ASCII control here, because `null < 32 == true`. +function asciiControl(code) { + return ( + // Special whitespace codes (which have negative values), C0 and Control + // character DEL + code < 32 || code === 127 + ) +} + +module.exports = asciiControl diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-digit.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-digit.js new file mode 100644 index 00000000000000..da614c4e409dd3 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-digit.js @@ -0,0 +1,7 @@ +'use strict' + +var regexCheck = require('../util/regex-check.js') + +var asciiDigit = regexCheck(/\d/) + +module.exports = asciiDigit diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-hex-digit.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-hex-digit.js new file mode 100644 index 00000000000000..a0e7af43edd1b7 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-hex-digit.js @@ -0,0 +1,7 @@ +'use strict' + +var regexCheck = require('../util/regex-check.js') + +var asciiHexDigit = regexCheck(/[\dA-Fa-f]/) + +module.exports = asciiHexDigit diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-punctuation.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-punctuation.js new file mode 100644 index 00000000000000..596b45a5eb084b --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/ascii-punctuation.js @@ -0,0 +1,7 @@ +'use strict' + +var regexCheck = require('../util/regex-check.js') + +var asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/) + +module.exports = asciiPunctuation diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/codes.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/codes.js new file mode 100644 index 00000000000000..01ea00a654b709 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/codes.js @@ -0,0 +1,257 @@ +'use strict' + +// This module is compiled away! +// +// micromark works based on character codes. +// This module contains constants for the ASCII block and the replacement +// character. +// A couple of them are handled in a special way, such as the line endings +// (CR, LF, and CR+LF, commonly known as end-of-line: EOLs), the tab (horizontal +// tab) and its expansion based on what column it’s at (virtual space), +// and the end-of-file (eof) character. +// As values are preprocessed before handling them, the actual characters LF, +// CR, HT, and NUL (which is present as the replacement character), are +// guaranteed to not exist. +// +// Unicode basic latin block. +var codes = { + carriageReturn: -5, + lineFeed: -4, + carriageReturnLineFeed: -3, + horizontalTab: -2, + virtualSpace: -1, + eof: null, + nul: 0, + soh: 1, + stx: 2, + etx: 3, + eot: 4, + enq: 5, + ack: 6, + bel: 7, + bs: 8, + ht: 9, + // `\t` + lf: 10, + // `\n` + vt: 11, + // `\v` + ff: 12, + // `\f` + cr: 13, + // `\r` + so: 14, + si: 15, + dle: 16, + dc1: 17, + dc2: 18, + dc3: 19, + dc4: 20, + nak: 21, + syn: 22, + etb: 23, + can: 24, + em: 25, + sub: 26, + esc: 27, + fs: 28, + gs: 29, + rs: 30, + us: 31, + space: 32, + exclamationMark: 33, + // `!` + quotationMark: 34, + // `"` + numberSign: 35, + // `#` + dollarSign: 36, + // `$` + percentSign: 37, + // `%` + ampersand: 38, + // `&` + apostrophe: 39, + // `'` + leftParenthesis: 40, + // `(` + rightParenthesis: 41, + // `)` + asterisk: 42, + // `*` + plusSign: 43, + // `+` + comma: 44, + // `,` + dash: 45, + // `-` + dot: 46, + // `.` + slash: 47, + // `/` + digit0: 48, + // `0` + digit1: 49, + // `1` + digit2: 50, + // `2` + digit3: 51, + // `3` + digit4: 52, + // `4` + digit5: 53, + // `5` + digit6: 54, + // `6` + digit7: 55, + // `7` + digit8: 56, + // `8` + digit9: 57, + // `9` + colon: 58, + // `:` + semicolon: 59, + // `;` + lessThan: 60, + // `<` + equalsTo: 61, + // `=` + greaterThan: 62, + // `>` + questionMark: 63, + // `?` + atSign: 64, + // `@` + uppercaseA: 65, + // `A` + uppercaseB: 66, + // `B` + uppercaseC: 67, + // `C` + uppercaseD: 68, + // `D` + uppercaseE: 69, + // `E` + uppercaseF: 70, + // `F` + uppercaseG: 71, + // `G` + uppercaseH: 72, + // `H` + uppercaseI: 73, + // `I` + uppercaseJ: 74, + // `J` + uppercaseK: 75, + // `K` + uppercaseL: 76, + // `L` + uppercaseM: 77, + // `M` + uppercaseN: 78, + // `N` + uppercaseO: 79, + // `O` + uppercaseP: 80, + // `P` + uppercaseQ: 81, + // `Q` + uppercaseR: 82, + // `R` + uppercaseS: 83, + // `S` + uppercaseT: 84, + // `T` + uppercaseU: 85, + // `U` + uppercaseV: 86, + // `V` + uppercaseW: 87, + // `W` + uppercaseX: 88, + // `X` + uppercaseY: 89, + // `Y` + uppercaseZ: 90, + // `Z` + leftSquareBracket: 91, + // `[` + backslash: 92, + // `\` + rightSquareBracket: 93, + // `]` + caret: 94, + // `^` + underscore: 95, + // `_` + graveAccent: 96, + // `` ` `` + lowercaseA: 97, + // `a` + lowercaseB: 98, + // `b` + lowercaseC: 99, + // `c` + lowercaseD: 100, + // `d` + lowercaseE: 101, + // `e` + lowercaseF: 102, + // `f` + lowercaseG: 103, + // `g` + lowercaseH: 104, + // `h` + lowercaseI: 105, + // `i` + lowercaseJ: 106, + // `j` + lowercaseK: 107, + // `k` + lowercaseL: 108, + // `l` + lowercaseM: 109, + // `m` + lowercaseN: 110, + // `n` + lowercaseO: 111, + // `o` + lowercaseP: 112, + // `p` + lowercaseQ: 113, + // `q` + lowercaseR: 114, + // `r` + lowercaseS: 115, + // `s` + lowercaseT: 116, + // `t` + lowercaseU: 117, + // `u` + lowercaseV: 118, + // `v` + lowercaseW: 119, + // `w` + lowercaseX: 120, + // `x` + lowercaseY: 121, + // `y` + lowercaseZ: 122, + // `z` + leftCurlyBrace: 123, + // `{` + verticalBar: 124, + // `|` + rightCurlyBrace: 125, + // `}` + tilde: 126, + // `~` + del: 127, + // Unicode Specials block. + byteOrderMarker: 65279, + // Unicode Specials block. + replacementCharacter: 65533 // `�` +} + +module.exports = codes diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/markdown-line-ending-or-space.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/markdown-line-ending-or-space.js new file mode 100644 index 00000000000000..d78d17d1df30c9 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/markdown-line-ending-or-space.js @@ -0,0 +1,7 @@ +'use strict' + +function markdownLineEndingOrSpace(code) { + return code < 0 || code === 32 +} + +module.exports = markdownLineEndingOrSpace diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/markdown-line-ending.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/markdown-line-ending.js new file mode 100644 index 00000000000000..5893934c321a6c --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/markdown-line-ending.js @@ -0,0 +1,7 @@ +'use strict' + +function markdownLineEnding(code) { + return code < -2 +} + +module.exports = markdownLineEnding diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/markdown-space.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/markdown-space.js new file mode 100644 index 00000000000000..e1b907b3009212 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/markdown-space.js @@ -0,0 +1,7 @@ +'use strict' + +function markdownSpace(code) { + return code === -2 || code === -1 || code === 32 +} + +module.exports = markdownSpace diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/unicode-punctuation.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/unicode-punctuation.js new file mode 100644 index 00000000000000..eea51658c743c6 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/unicode-punctuation.js @@ -0,0 +1,10 @@ +'use strict' + +var unicodePunctuationRegex = require('../constant/unicode-punctuation-regex.js') +var regexCheck = require('../util/regex-check.js') + +// In fact adds to the bundle size. + +var unicodePunctuation = regexCheck(unicodePunctuationRegex) + +module.exports = unicodePunctuation diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/unicode-whitespace.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/unicode-whitespace.js new file mode 100644 index 00000000000000..b09537ea087786 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/unicode-whitespace.js @@ -0,0 +1,7 @@ +'use strict' + +var regexCheck = require('../util/regex-check.js') + +var unicodeWhitespace = regexCheck(/\s/) + +module.exports = unicodeWhitespace diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/values.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/values.js new file mode 100644 index 00000000000000..cd1794fd97342a --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/character/values.js @@ -0,0 +1,111 @@ +'use strict' + +// This module is compiled away! +// +// While micromark works based on character codes, this module includes the +// string versions of ’em. +// The C0 block, except for LF, CR, HT, and w/ the replacement character added, +// are available here. +var values = { + ht: '\t', + lf: '\n', + cr: '\r', + space: ' ', + exclamationMark: '!', + quotationMark: '"', + numberSign: '#', + dollarSign: '$', + percentSign: '%', + ampersand: '&', + apostrophe: "'", + leftParenthesis: '(', + rightParenthesis: ')', + asterisk: '*', + plusSign: '+', + comma: ',', + dash: '-', + dot: '.', + slash: '/', + digit0: '0', + digit1: '1', + digit2: '2', + digit3: '3', + digit4: '4', + digit5: '5', + digit6: '6', + digit7: '7', + digit8: '8', + digit9: '9', + colon: ':', + semicolon: ';', + lessThan: '<', + equalsTo: '=', + greaterThan: '>', + questionMark: '?', + atSign: '@', + uppercaseA: 'A', + uppercaseB: 'B', + uppercaseC: 'C', + uppercaseD: 'D', + uppercaseE: 'E', + uppercaseF: 'F', + uppercaseG: 'G', + uppercaseH: 'H', + uppercaseI: 'I', + uppercaseJ: 'J', + uppercaseK: 'K', + uppercaseL: 'L', + uppercaseM: 'M', + uppercaseN: 'N', + uppercaseO: 'O', + uppercaseP: 'P', + uppercaseQ: 'Q', + uppercaseR: 'R', + uppercaseS: 'S', + uppercaseT: 'T', + uppercaseU: 'U', + uppercaseV: 'V', + uppercaseW: 'W', + uppercaseX: 'X', + uppercaseY: 'Y', + uppercaseZ: 'Z', + leftSquareBracket: '[', + backslash: '\\', + rightSquareBracket: ']', + caret: '^', + underscore: '_', + graveAccent: '`', + lowercaseA: 'a', + lowercaseB: 'b', + lowercaseC: 'c', + lowercaseD: 'd', + lowercaseE: 'e', + lowercaseF: 'f', + lowercaseG: 'g', + lowercaseH: 'h', + lowercaseI: 'i', + lowercaseJ: 'j', + lowercaseK: 'k', + lowercaseL: 'l', + lowercaseM: 'm', + lowercaseN: 'n', + lowercaseO: 'o', + lowercaseP: 'p', + lowercaseQ: 'q', + lowercaseR: 'r', + lowercaseS: 's', + lowercaseT: 't', + lowercaseU: 'u', + lowercaseV: 'v', + lowercaseW: 'w', + lowercaseX: 'x', + lowercaseY: 'y', + lowercaseZ: 'z', + leftCurlyBrace: '{', + verticalBar: '|', + rightCurlyBrace: '}', + tilde: '~', + replacementCharacter: '�' +} + +module.exports = values diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/compile/html.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/compile/html.js new file mode 100644 index 00000000000000..b6170ef506fd97 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/compile/html.js @@ -0,0 +1,787 @@ +'use strict' + +var decodeEntity = require('parse-entities/decode-entity.js') +var assign = require('../constant/assign.js') +var hasOwnProperty = require('../constant/has-own-property.js') +var combineHtmlExtensions = require('../util/combine-html-extensions.js') +var chunkedPush = require('../util/chunked-push.js') +var miniflat = require('../util/miniflat.js') +var normalizeIdentifier = require('../util/normalize-identifier.js') +var normalizeUri = require('../util/normalize-uri.js') +var safeFromInt = require('../util/safe-from-int.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var decodeEntity__default = /*#__PURE__*/ _interopDefaultLegacy(decodeEntity) + +// While micromark is a lexer/tokenizer, the common case of going from markdown +// dealt with. +// Technically, we can skip `>` and `"` in many cases, but CM includes them. + +var characterReferences = { + '"': 'quot', + '&': 'amp', + '<': 'lt', + '>': 'gt' +} // These two are allowlists of essentially safe protocols for full URLs in +// respectively the `href` (on ``) and `src` (on ``) attributes. +// They are based on what is allowed on GitHub, +// + +var protocolHref = /^(https?|ircs?|mailto|xmpp)$/i +var protocolSrc = /^https?$/i + +function compileHtml(options) { + // Configuration. + // Includes `htmlExtensions` (an array of extensions), `defaultLineEnding` (a + // preferred EOL), `allowDangerousProtocol` (whether to allow potential + // dangerous protocols), and `allowDangerousHtml` (whether to allow potential + // dangerous HTML). + var settings = options || {} // Tags is needed because according to markdown, links and emphasis and + // whatnot can exist in images, however, as HTML doesn’t allow content in + // images, the tags are ignored in the `alt` attribute, but the content + // remains. + + var tags = true // An object to track identifiers to media (URLs and titles) defined with + // definitions. + + var definitions = {} // A lot of the handlers need to capture some of the output data, modify it + // somehow, and then deal with it. + // We do that by tracking a stack of buffers, that can be opened (with + // `buffer`) and closed (with `resume`) to access them. + + var buffers = [[]] // As we can have links in images and the other way around, where the deepest + // ones are closed first, we need to track which one we’re in. + + var mediaStack = [] // Same for tightness, which is specific to lists. + // We need to track if we’re currently in a tight or loose container. + + var tightStack = [] + var defaultHandlers = { + enter: { + blockQuote: onenterblockquote, + codeFenced: onentercodefenced, + codeFencedFenceInfo: buffer, + codeFencedFenceMeta: buffer, + codeIndented: onentercodeindented, + codeText: onentercodetext, + content: onentercontent, + definition: onenterdefinition, + definitionDestinationString: onenterdefinitiondestinationstring, + definitionLabelString: buffer, + definitionTitleString: buffer, + emphasis: onenteremphasis, + htmlFlow: onenterhtmlflow, + htmlText: onenterhtml, + image: onenterimage, + label: buffer, + link: onenterlink, + listItemMarker: onenterlistitemmarker, + listItemValue: onenterlistitemvalue, + listOrdered: onenterlistordered, + listUnordered: onenterlistunordered, + paragraph: onenterparagraph, + reference: buffer, + resource: onenterresource, + resourceDestinationString: onenterresourcedestinationstring, + resourceTitleString: buffer, + setextHeading: onentersetextheading, + strong: onenterstrong + }, + exit: { + atxHeading: onexitatxheading, + atxHeadingSequence: onexitatxheadingsequence, + autolinkEmail: onexitautolinkemail, + autolinkProtocol: onexitautolinkprotocol, + blockQuote: onexitblockquote, + characterEscapeValue: onexitdata, + characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, + characterReferenceMarkerNumeric: onexitcharacterreferencemarker, + characterReferenceValue: onexitcharacterreferencevalue, + codeFenced: onexitflowcode, + codeFencedFence: onexitcodefencedfence, + codeFencedFenceInfo: onexitcodefencedfenceinfo, + codeFencedFenceMeta: resume, + codeFlowValue: onexitcodeflowvalue, + codeIndented: onexitflowcode, + codeText: onexitcodetext, + codeTextData: onexitdata, + data: onexitdata, + definition: onexitdefinition, + definitionDestinationString: onexitdefinitiondestinationstring, + definitionLabelString: onexitdefinitionlabelstring, + definitionTitleString: onexitdefinitiontitlestring, + emphasis: onexitemphasis, + hardBreakEscape: onexithardbreak, + hardBreakTrailing: onexithardbreak, + htmlFlow: onexithtml, + htmlFlowData: onexitdata, + htmlText: onexithtml, + htmlTextData: onexitdata, + image: onexitmedia, + label: onexitlabel, + labelText: onexitlabeltext, + lineEnding: onexitlineending, + link: onexitmedia, + listOrdered: onexitlistordered, + listUnordered: onexitlistunordered, + paragraph: onexitparagraph, + reference: resume, + referenceString: onexitreferencestring, + resource: resume, + resourceDestinationString: onexitresourcedestinationstring, + resourceTitleString: onexitresourcetitlestring, + setextHeading: onexitsetextheading, + setextHeadingLineSequence: onexitsetextheadinglinesequence, + setextHeadingText: onexitsetextheadingtext, + strong: onexitstrong, + thematicBreak: onexitthematicbreak + } + } // Combine the HTML extensions with the default handlers. + // An HTML extension is an object whose fields are either `enter` or `exit` + // (reflecting whether a token is entered or exited). + // The values at such objects are names of tokens mapping to handlers. + // Handlers are called, respectively when a token is opener or closed, with + // that token, and a context as `this`. + + var handlers = combineHtmlExtensions( + [defaultHandlers].concat(miniflat(settings.htmlExtensions)) + ) // Handlers do often need to keep track of some state. + // That state is provided here as a key-value store (an object). + + var data = { + tightStack: tightStack + } // The context for handlers references a couple of useful functions. + // In handlers from extensions, those can be accessed at `this`. + // For the handlers here, they can be accessed directly. + + var context = { + lineEndingIfNeeded: lineEndingIfNeeded, + options: settings, + encode: encode, + raw: raw, + tag: tag, + buffer: buffer, + resume: resume, + setData: setData, + getData: getData + } // Generally, micromark copies line endings (`'\r'`, `'\n'`, `'\r\n'`) in the + // markdown document over to the compiled HTML. + // In some cases, such as `> a`, CommonMark requires that extra line endings + // are added: `
\n

a

\n
`. + // This variable hold the default line ending when given (or `undefined`), + // and in the latter case will be updated to the first found line ending if + // there is one. + + var lineEndingStyle = settings.defaultLineEnding // Return the function that handles a slice of events. + + return compile // Deal w/ a slice of events. + // Return either the empty string if there’s nothing of note to return, or the + // result when done. + + function compile(events) { + // As definitions can come after references, we need to figure out the media + // (urls and titles) defined by them before handling the references. + // So, we do sort of what HTML does: put metadata at the start (in head), and + // then put content after (`body`). + var head = [] + var body = [] + var index + var start + var listStack + var handler + var result + index = -1 + start = 0 + listStack = [] + + while (++index < events.length) { + // Figure out the line ending style used in the document. + if ( + !lineEndingStyle && + (events[index][1].type === 'lineEnding' || + events[index][1].type === 'lineEndingBlank') + ) { + lineEndingStyle = events[index][2].sliceSerialize(events[index][1]) + } // Preprocess lists to infer whether the list is loose or not. + + if ( + events[index][1].type === 'listOrdered' || + events[index][1].type === 'listUnordered' + ) { + if (events[index][0] === 'enter') { + listStack.push(index) + } else { + prepareList(events.slice(listStack.pop(), index)) + } + } // Move definitions to the front. + + if (events[index][1].type === 'definition') { + if (events[index][0] === 'enter') { + body = chunkedPush(body, events.slice(start, index)) + start = index + } else { + head = chunkedPush(head, events.slice(start, index + 1)) + start = index + 1 + } + } + } + + head = chunkedPush(head, body) + head = chunkedPush(head, events.slice(start)) + result = head + index = -1 // Handle the start of the document, if defined. + + if (handlers.enter.null) { + handlers.enter.null.call(context) + } // Handle all events. + + while (++index < events.length) { + handler = handlers[result[index][0]] + + if (hasOwnProperty.call(handler, result[index][1].type)) { + handler[result[index][1].type].call( + assign( + { + sliceSerialize: result[index][2].sliceSerialize + }, + context + ), + result[index][1] + ) + } + } // Handle the end of the document, if defined. + + if (handlers.exit.null) { + handlers.exit.null.call(context) + } + + return buffers[0].join('') + } // Figure out whether lists are loose or not. + + function prepareList(slice) { + var length = slice.length - 1 // Skip close. + + var index = 0 // Skip open. + + var containerBalance = 0 + var loose + var atMarker + var event + + while (++index < length) { + event = slice[index] + + if (event[1]._container) { + atMarker = undefined + + if (event[0] === 'enter') { + containerBalance++ + } else { + containerBalance-- + } + } else if (event[1].type === 'listItemPrefix') { + if (event[0] === 'exit') { + atMarker = true + } + } else if (event[1].type === 'linePrefix'); + else if (event[1].type === 'lineEndingBlank') { + if (event[0] === 'enter' && !containerBalance) { + if (atMarker) { + atMarker = undefined + } else { + loose = true + } + } + } else { + atMarker = undefined + } + } + + slice[0][1]._loose = loose + } // Set data into the key-value store. + + function setData(key, value) { + data[key] = value + } // Get data from the key-value store. + + function getData(key) { + return data[key] + } // Capture some of the output data. + + function buffer() { + buffers.push([]) + } // Stop capturing and access the output data. + + function resume() { + return buffers.pop().join('') + } // Output (parts of) HTML tags. + + function tag(value) { + if (!tags) return + setData('lastWasTag', true) + buffers[buffers.length - 1].push(value) + } // Output raw data. + + function raw(value) { + setData('lastWasTag') + buffers[buffers.length - 1].push(value) + } // Output an extra line ending. + + function lineEnding() { + raw(lineEndingStyle || '\n') + } // Output an extra line ending if the previous value wasn’t EOF/EOL. + + function lineEndingIfNeeded() { + var buffer = buffers[buffers.length - 1] + var slice = buffer[buffer.length - 1] + var previous = slice ? slice.charCodeAt(slice.length - 1) : null + + if (previous === 10 || previous === 13 || previous === null) { + return + } + + lineEnding() + } // Make a value safe for injection in HTML (except w/ `ignoreEncode`). + + function encode(value) { + return getData('ignoreEncode') ? value : value.replace(/["&<>]/g, replace) + + function replace(value) { + return '&' + characterReferences[value] + ';' + } + } // Make a value safe for injection as a URL. + // This does encode unsafe characters with percent-encoding, skipping already + // encoded sequences (`normalizeUri`). + // Further unsafe characters are encoded as character references (`encode`). + // Finally, if the URL includes an unknown protocol (such as a dangerous + // example, `javascript:`), the value is ignored. + + function url(url, protocol) { + var value = encode(normalizeUri(url || '')) + var colon = value.indexOf(':') + var questionMark = value.indexOf('?') + var numberSign = value.indexOf('#') + var slash = value.indexOf('/') + + if ( + settings.allowDangerousProtocol || // If there is no protocol, it’s relative. + colon < 0 || // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol. + (slash > -1 && colon > slash) || + (questionMark > -1 && colon > questionMark) || + (numberSign > -1 && colon > numberSign) || // It is a protocol, it should be allowed. + protocol.test(value.slice(0, colon)) + ) { + return value + } + + return '' + } // + // Handlers. + // + + function onenterlistordered(token) { + tightStack.push(!token._loose) + lineEndingIfNeeded() + tag('') + } else { + onexitlistitem() + } + + lineEndingIfNeeded() + tag('
  • ') + setData('expectFirstItem') // “Hack” to prevent a line ending from showing up if the item is empty. + + setData('lastWasTag') + } + + function onexitlistordered() { + onexitlistitem() + tightStack.pop() + lineEnding() + tag('') + } + + function onexitlistunordered() { + onexitlistitem() + tightStack.pop() + lineEnding() + tag('') + } + + function onexitlistitem() { + if (getData('lastWasTag') && !getData('slurpAllLineEndings')) { + lineEndingIfNeeded() + } + + tag('
  • ') + setData('slurpAllLineEndings') + } + + function onenterblockquote() { + tightStack.push(false) + lineEndingIfNeeded() + tag('
    ') + } + + function onexitblockquote() { + tightStack.pop() + lineEndingIfNeeded() + tag('
    ') + setData('slurpAllLineEndings') + } + + function onenterparagraph() { + if (!tightStack[tightStack.length - 1]) { + lineEndingIfNeeded() + tag('

    ') + } + + setData('slurpAllLineEndings') + } + + function onexitparagraph() { + if (tightStack[tightStack.length - 1]) { + setData('slurpAllLineEndings', true) + } else { + tag('

    ') + } + } + + function onentercodefenced() { + lineEndingIfNeeded() + tag('
    ')
    +      setData('fencedCodeInside', true)
    +      setData('slurpOneLineEnding', true)
    +    }
    +
    +    setData('fencesCount', getData('fencesCount') + 1)
    +  }
    +
    +  function onentercodeindented() {
    +    lineEndingIfNeeded()
    +    tag('
    ')
    +  }
    +
    +  function onexitflowcode() {
    +    // Send an extra line feed if we saw data.
    +    if (getData('flowCodeSeenData')) lineEndingIfNeeded()
    +    tag('
    ') + if (getData('fencesCount') < 2) lineEndingIfNeeded() + setData('flowCodeSeenData') + setData('fencesCount') + setData('slurpOneLineEnding') + } + + function onenterimage() { + mediaStack.push({ + image: true + }) + tags = undefined // Disallow tags. + } + + function onenterlink() { + mediaStack.push({}) + } + + function onexitlabeltext(token) { + mediaStack[mediaStack.length - 1].labelId = this.sliceSerialize(token) + } + + function onexitlabel() { + mediaStack[mediaStack.length - 1].label = resume() + } + + function onexitreferencestring(token) { + mediaStack[mediaStack.length - 1].referenceId = this.sliceSerialize(token) + } + + function onenterresource() { + buffer() // We can have line endings in the resource, ignore them. + + mediaStack[mediaStack.length - 1].destination = '' + } + + function onenterresourcedestinationstring() { + buffer() // Ignore encoding the result, as we’ll first percent encode the url and + // encode manually after. + + setData('ignoreEncode', true) + } + + function onexitresourcedestinationstring() { + mediaStack[mediaStack.length - 1].destination = resume() + setData('ignoreEncode') + } + + function onexitresourcetitlestring() { + mediaStack[mediaStack.length - 1].title = resume() + } + + function onexitmedia() { + var index = mediaStack.length - 1 // Skip current. + + var media = mediaStack[index] + var context = + media.destination === undefined + ? definitions[normalizeIdentifier(media.referenceId || media.labelId)] + : media + tags = true + + while (index--) { + if (mediaStack[index].image) { + tags = undefined + break + } + } + + if (media.image) { + tag('')
+      raw(media.label)
+      tag('') + } else { + tag('>') + raw(media.label) + tag('
    ') + } + + mediaStack.pop() + } + + function onenterdefinition() { + buffer() + mediaStack.push({}) + } + + function onexitdefinitionlabelstring(token) { + // Discard label, use the source content instead. + resume() + mediaStack[mediaStack.length - 1].labelId = this.sliceSerialize(token) + } + + function onenterdefinitiondestinationstring() { + buffer() + setData('ignoreEncode', true) + } + + function onexitdefinitiondestinationstring() { + mediaStack[mediaStack.length - 1].destination = resume() + setData('ignoreEncode') + } + + function onexitdefinitiontitlestring() { + mediaStack[mediaStack.length - 1].title = resume() + } + + function onexitdefinition() { + var id = normalizeIdentifier(mediaStack[mediaStack.length - 1].labelId) + resume() + + if (!hasOwnProperty.call(definitions, id)) { + definitions[id] = mediaStack[mediaStack.length - 1] + } + + mediaStack.pop() + } + + function onentercontent() { + setData('slurpAllLineEndings', true) + } + + function onexitatxheadingsequence(token) { + // Exit for further sequences. + if (getData('headingRank')) return + setData('headingRank', this.sliceSerialize(token).length) + lineEndingIfNeeded() + tag('') + } + + function onentersetextheading() { + buffer() + setData('slurpAllLineEndings') + } + + function onexitsetextheadingtext() { + setData('slurpAllLineEndings', true) + } + + function onexitatxheading() { + tag('') + setData('headingRank') + } + + function onexitsetextheadinglinesequence(token) { + setData( + 'headingRank', + this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2 + ) + } + + function onexitsetextheading() { + var value = resume() + lineEndingIfNeeded() + tag('') + raw(value) + tag('') + setData('slurpAllLineEndings') + setData('headingRank') + } + + function onexitdata(token) { + raw(encode(this.sliceSerialize(token))) + } + + function onexitlineending(token) { + if (getData('slurpAllLineEndings')) { + return + } + + if (getData('slurpOneLineEnding')) { + setData('slurpOneLineEnding') + return + } + + if (getData('inCodeText')) { + raw(' ') + return + } + + raw(encode(this.sliceSerialize(token))) + } + + function onexitcodeflowvalue(token) { + raw(encode(this.sliceSerialize(token))) + setData('flowCodeSeenData', true) + } + + function onexithardbreak() { + tag('
    ') + } + + function onenterhtmlflow() { + lineEndingIfNeeded() + onenterhtml() + } + + function onexithtml() { + setData('ignoreEncode') + } + + function onenterhtml() { + if (settings.allowDangerousHtml) { + setData('ignoreEncode', true) + } + } + + function onenteremphasis() { + tag('') + } + + function onenterstrong() { + tag('') + } + + function onentercodetext() { + setData('inCodeText', true) + tag('') + } + + function onexitcodetext() { + setData('inCodeText') + tag('') + } + + function onexitemphasis() { + tag('') + } + + function onexitstrong() { + tag('') + } + + function onexitthematicbreak() { + lineEndingIfNeeded() + tag('
    ') + } + + function onexitcharacterreferencemarker(token) { + setData('characterReferenceType', token.type) + } + + function onexitcharacterreferencevalue(token) { + var value = this.sliceSerialize(token) + value = getData('characterReferenceType') + ? safeFromInt( + value, + getData('characterReferenceType') === + 'characterReferenceMarkerNumeric' + ? 10 + : 16 + ) + : decodeEntity__default['default'](value) + raw(encode(value)) + setData('characterReferenceType') + } + + function onexitautolinkprotocol(token) { + var uri = this.sliceSerialize(token) + tag('') + raw(encode(uri)) + tag('') + } + + function onexitautolinkemail(token) { + var uri = this.sliceSerialize(token) + tag('') + raw(encode(uri)) + tag('') + } +} + +module.exports = compileHtml diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/assign.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/assign.js new file mode 100644 index 00000000000000..b6ae48a0903c93 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/assign.js @@ -0,0 +1,5 @@ +'use strict' + +var assign = Object.assign + +module.exports = assign diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/constants.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/constants.js new file mode 100644 index 00000000000000..88772494881ca7 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/constants.js @@ -0,0 +1,71 @@ +'use strict' + +// This module is compiled away! +// +// Parsing markdown comes with a couple of constants, such as minimum or maximum +// sizes of certain sequences. +// Additionally, there are a couple symbols used inside micromark. +// These are all defined here, but compiled away by scripts. +var constants = { + attentionSideBefore: 1, + // Symbol to mark an attention sequence as before content: `*a` + attentionSideAfter: 2, + // Symbol to mark an attention sequence as after content: `a*` + atxHeadingOpeningFenceSizeMax: 6, + // 6 number signs is fine, 7 isn’t. + autolinkDomainSizeMax: 63, + // 63 characters is fine, 64 is too many. + autolinkSchemeSizeMax: 32, + // 32 characters is fine, 33 is too many. + cdataOpeningString: 'CDATA[', + // And preceded by `` + htmlComment: 2, + // Symbol for `` + htmlInstruction: 3, + // Symbol for `` + htmlDeclaration: 4, + // Symbol for `` + htmlCdata: 5, + // Symbol for `` + htmlBasic: 6, + // Symbol for `` + htmlRawSizeMax: 8, + // Length of `textarea`. + linkResourceDestinationBalanceMax: 3, + // See: + linkReferenceSizeMax: 999, + // See: + listItemValueSizeMax: 10, + // See: + numericBaseDecimal: 10, + numericBaseHexadecimal: 0x10, + tabSize: 4, + // Tabs have a hard-coded size of 4, per CommonMark. + thematicBreakMarkerCountMin: 3, + // At least 3 asterisks, dashes, or underscores are needed. + v8MaxSafeChunkSize: 10000 // V8 (and potentially others) have problems injecting giant arrays into other arrays, hence we operate in chunks. +} + +module.exports = constants diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/from-char-code.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/from-char-code.js new file mode 100644 index 00000000000000..232eac74053d18 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/from-char-code.js @@ -0,0 +1,5 @@ +'use strict' + +var fromCharCode = String.fromCharCode + +module.exports = fromCharCode diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/has-own-property.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/has-own-property.js new file mode 100644 index 00000000000000..aa9197cd2593d1 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/has-own-property.js @@ -0,0 +1,5 @@ +'use strict' + +var own = {}.hasOwnProperty + +module.exports = own diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/html-block-names.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/html-block-names.js new file mode 100644 index 00000000000000..9b5ada73f0671a --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/html-block-names.js @@ -0,0 +1,69 @@ +'use strict' + +// This module is copied from . +var basics = [ + 'address', + 'article', + 'aside', + 'base', + 'basefont', + 'blockquote', + 'body', + 'caption', + 'center', + 'col', + 'colgroup', + 'dd', + 'details', + 'dialog', + 'dir', + 'div', + 'dl', + 'dt', + 'fieldset', + 'figcaption', + 'figure', + 'footer', + 'form', + 'frame', + 'frameset', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'head', + 'header', + 'hr', + 'html', + 'iframe', + 'legend', + 'li', + 'link', + 'main', + 'menu', + 'menuitem', + 'nav', + 'noframes', + 'ol', + 'optgroup', + 'option', + 'p', + 'param', + 'section', + 'source', + 'summary', + 'table', + 'tbody', + 'td', + 'tfoot', + 'th', + 'thead', + 'title', + 'tr', + 'track', + 'ul' +] + +module.exports = basics diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/html-raw-names.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/html-raw-names.js new file mode 100644 index 00000000000000..c22a3954291f82 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/html-raw-names.js @@ -0,0 +1,6 @@ +'use strict' + +// This module is copied from . +var raws = ['pre', 'script', 'style', 'textarea'] + +module.exports = raws diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/splice.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/splice.js new file mode 100644 index 00000000000000..8917210ac71670 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/splice.js @@ -0,0 +1,5 @@ +'use strict' + +var splice = [].splice + +module.exports = splice diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/types.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/types.js new file mode 100644 index 00000000000000..b4e8787fb94154 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/types.js @@ -0,0 +1,357 @@ +'use strict' + +// This module is compiled away! +// +// Here is the list of all types of tokens exposed by micromark, with a short +// explanation of what they include and where they are found. +// In picking names, generally, the rule is to be as explicit as possible +// instead of reusing names. +// For example, there is a `definitionDestination` and a `resourceDestination`, +// instead of one shared name. +var types = { + // Generic type for data, such as in a title, a destination, etc. + data: 'data', + // Generic type for syntactic whitespace (tabs, virtual spaces, spaces). + // Such as, between a fenced code fence and an info string. + whitespace: 'whitespace', + // Generic type for line endings (line feed, carriage return, carriage return + + // line feed). + lineEnding: 'lineEnding', + // A line ending, but ending a blank line. + lineEndingBlank: 'lineEndingBlank', + // Generic type for whitespace (tabs, virtual spaces, spaces) at the start of a + // line. + linePrefix: 'linePrefix', + // Generic type for whitespace (tabs, virtual spaces, spaces) at the end of a + // line. + lineSuffix: 'lineSuffix', + // Whole ATX heading: + // + // ```markdown + // # + // ## Alpha + // ### Bravo ### + // ``` + // + // Includes `atxHeadingSequence`, `whitespace`, `atxHeadingText`. + atxHeading: 'atxHeading', + // Sequence of number signs in an ATX heading (`###`). + atxHeadingSequence: 'atxHeadingSequence', + // Content in an ATX heading (`alpha`). + // Includes text. + atxHeadingText: 'atxHeadingText', + // Whole autolink (`` or ``) + // Includes `autolinkMarker` and `autolinkProtocol` or `autolinkEmail`. + autolink: 'autolink', + // Email autolink w/o markers (`admin@example.com`) + autolinkEmail: 'autolinkEmail', + // Marker around an `autolinkProtocol` or `autolinkEmail` (`<` or `>`). + autolinkMarker: 'autolinkMarker', + // Protocol autolink w/o markers (`https://example.com`) + autolinkProtocol: 'autolinkProtocol', + // A whole character escape (`\-`). + // Includes `escapeMarker` and `characterEscapeValue`. + characterEscape: 'characterEscape', + // The escaped character (`-`). + characterEscapeValue: 'characterEscapeValue', + // A whole character reference (`&`, `≠`, or `𝌆`). + // Includes `characterReferenceMarker`, an optional + // `characterReferenceMarkerNumeric`, in which case an optional + // `characterReferenceMarkerHexadecimal`, and a `characterReferenceValue`. + characterReference: 'characterReference', + // The start or end marker (`&` or `;`). + characterReferenceMarker: 'characterReferenceMarker', + // Mark reference as numeric (`#`). + characterReferenceMarkerNumeric: 'characterReferenceMarkerNumeric', + // Mark reference as numeric (`x` or `X`). + characterReferenceMarkerHexadecimal: 'characterReferenceMarkerHexadecimal', + // Value of character reference w/o markers (`amp`, `8800`, or `1D306`). + characterReferenceValue: 'characterReferenceValue', + // Whole fenced code: + // + // ````markdown + // ```js + // alert(1) + // ``` + // ```` + codeFenced: 'codeFenced', + // A fenced code fence, including whitespace, sequence, info, and meta + // (` ```js `). + codeFencedFence: 'codeFencedFence', + // Sequence of grave accent or tilde characters (` ``` `) in a fence. + codeFencedFenceSequence: 'codeFencedFenceSequence', + // Info word (`js`) in a fence. + // Includes string. + codeFencedFenceInfo: 'codeFencedFenceInfo', + // Meta words (`highlight="1"`) in a fence. + // Includes string. + codeFencedFenceMeta: 'codeFencedFenceMeta', + // A line of code. + codeFlowValue: 'codeFlowValue', + // Whole indented code: + // + // ```markdown + // alert(1) + // ``` + // + // Includes `lineEnding`, `linePrefix`, and `codeFlowValue`. + codeIndented: 'codeIndented', + // A text code (``` `alpha` ```). + // Includes `codeTextSequence`, `codeTextData`, `lineEnding`, and can include + // `codeTextPadding`. + codeText: 'codeText', + codeTextData: 'codeTextData', + // A space or line ending right after or before a tick. + codeTextPadding: 'codeTextPadding', + // A text code fence (` `` `). + codeTextSequence: 'codeTextSequence', + // Whole content: + // + // ```markdown + // [a]: b + // c + // = + // d + // ``` + // + // Includes `paragraph` and `definition`. + content: 'content', + // Whole definition: + // + // ```markdown + // [micromark]: https://github.com/micromark/micromark + // ``` + // + // Includes `definitionLabel`, `definitionMarker`, `whitespace`, + // `definitionDestination`, and optionally `lineEnding` and `definitionTitle`. + definition: 'definition', + // Destination of a definition (`https://github.com/micromark/micromark` or + // ``). + // Includes `definitionDestinationLiteral` or `definitionDestinationRaw`. + definitionDestination: 'definitionDestination', + // Enclosed destination of a definition + // (``). + // Includes `definitionDestinationLiteralMarker` and optionally + // `definitionDestinationString`. + definitionDestinationLiteral: 'definitionDestinationLiteral', + // Markers of an enclosed definition destination (`<` or `>`). + definitionDestinationLiteralMarker: 'definitionDestinationLiteralMarker', + // Unenclosed destination of a definition + // (`https://github.com/micromark/micromark`). + // Includes `definitionDestinationString`. + definitionDestinationRaw: 'definitionDestinationRaw', + // Text in an destination (`https://github.com/micromark/micromark`). + // Includes string. + definitionDestinationString: 'definitionDestinationString', + // Label of a definition (`[micromark]`). + // Includes `definitionLabelMarker` and `definitionLabelString`. + definitionLabel: 'definitionLabel', + // Markers of a definition label (`[` or `]`). + definitionLabelMarker: 'definitionLabelMarker', + // Value of a definition label (`micromark`). + // Includes string. + definitionLabelString: 'definitionLabelString', + // Marker between a label and a destination (`:`). + definitionMarker: 'definitionMarker', + // Title of a definition (`"x"`, `'y'`, or `(z)`). + // Includes `definitionTitleMarker` and optionally `definitionTitleString`. + definitionTitle: 'definitionTitle', + // Marker around a title of a definition (`"`, `'`, `(`, or `)`). + definitionTitleMarker: 'definitionTitleMarker', + // Data without markers in a title (`z`). + // Includes string. + definitionTitleString: 'definitionTitleString', + // Emphasis (`*alpha*`). + // Includes `emphasisSequence` and `emphasisText`. + emphasis: 'emphasis', + // Sequence of emphasis markers (`*` or `_`). + emphasisSequence: 'emphasisSequence', + // Emphasis text (`alpha`). + // Includes text. + emphasisText: 'emphasisText', + // The character escape marker (`\`). + escapeMarker: 'escapeMarker', + // A hard break created with a backslash (`\\n`). + // Includes `escapeMarker` (does not include the line ending) + hardBreakEscape: 'hardBreakEscape', + // A hard break created with trailing spaces (` \n`). + // Does not include the line ending. + hardBreakTrailing: 'hardBreakTrailing', + // Flow HTML: + // + // ```markdown + //
    b`). + // Includes `lineEnding`, `htmlTextData`. + htmlText: 'htmlText', + htmlTextData: 'htmlTextData', + // Whole image (`![alpha](bravo)`, `![alpha][bravo]`, `![alpha][]`, or + // `![alpha]`). + // Includes `label` and an optional `resource` or `reference`. + image: 'image', + // Whole link label (`[*alpha*]`). + // Includes `labelLink` or `labelImage`, `labelText`, and `labelEnd`. + label: 'label', + // Text in an label (`*alpha*`). + // Includes text. + labelText: 'labelText', + // Start a link label (`[`). + // Includes a `labelMarker`. + labelLink: 'labelLink', + // Start an image label (`![`). + // Includes `labelImageMarker` and `labelMarker`. + labelImage: 'labelImage', + // Marker of a label (`[` or `]`). + labelMarker: 'labelMarker', + // Marker to start an image (`!`). + labelImageMarker: 'labelImageMarker', + // End a label (`]`). + // Includes `labelMarker`. + labelEnd: 'labelEnd', + // Whole link (`[alpha](bravo)`, `[alpha][bravo]`, `[alpha][]`, or `[alpha]`). + // Includes `label` and an optional `resource` or `reference`. + link: 'link', + // Whole paragraph: + // + // ```markdown + // alpha + // bravo. + // ``` + // + // Includes text. + paragraph: 'paragraph', + // A reference (`[alpha]` or `[]`). + // Includes `referenceMarker` and an optional `referenceString`. + reference: 'reference', + // A reference marker (`[` or `]`). + referenceMarker: 'referenceMarker', + // Reference text (`alpha`). + // Includes string. + referenceString: 'referenceString', + // A resource (`(https://example.com "alpha")`). + // Includes `resourceMarker`, an optional `resourceDestination` with an optional + // `whitespace` and `resourceTitle`. + resource: 'resource', + // A resource destination (`https://example.com`). + // Includes `resourceDestinationLiteral` or `resourceDestinationRaw`. + resourceDestination: 'resourceDestination', + // A literal resource destination (``). + // Includes `resourceDestinationLiteralMarker` and optionally + // `resourceDestinationString`. + resourceDestinationLiteral: 'resourceDestinationLiteral', + // A resource destination marker (`<` or `>`). + resourceDestinationLiteralMarker: 'resourceDestinationLiteralMarker', + // A raw resource destination (`https://example.com`). + // Includes `resourceDestinationString`. + resourceDestinationRaw: 'resourceDestinationRaw', + // Resource destination text (`https://example.com`). + // Includes string. + resourceDestinationString: 'resourceDestinationString', + // A resource marker (`(` or `)`). + resourceMarker: 'resourceMarker', + // A resource title (`"alpha"`, `'alpha'`, or `(alpha)`). + // Includes `resourceTitleMarker` and optionally `resourceTitleString`. + resourceTitle: 'resourceTitle', + // A resource title marker (`"`, `'`, `(`, or `)`). + resourceTitleMarker: 'resourceTitleMarker', + // Resource destination title (`alpha`). + // Includes string. + resourceTitleString: 'resourceTitleString', + // Whole setext heading: + // + // ```markdown + // alpha + // bravo + // ===== + // ``` + // + // Includes `setextHeadingText`, `lineEnding`, `linePrefix`, and + // `setextHeadingLine`. + setextHeading: 'setextHeading', + // Content in a setext heading (`alpha\nbravo`). + // Includes text. + setextHeadingText: 'setextHeadingText', + // Underline in a setext heading, including whitespace suffix (`==`). + // Includes `setextHeadingLineSequence`. + setextHeadingLine: 'setextHeadingLine', + // Sequence of equals or dash characters in underline in a setext heading (`-`). + setextHeadingLineSequence: 'setextHeadingLineSequence', + // Strong (`**alpha**`). + // Includes `strongSequence` and `strongText`. + strong: 'strong', + // Sequence of strong markers (`**` or `__`). + strongSequence: 'strongSequence', + // Strong text (`alpha`). + // Includes text. + strongText: 'strongText', + // Whole thematic break: + // + // ```markdown + // * * * + // ``` + // + // Includes `thematicBreakSequence` and `whitespace`. + thematicBreak: 'thematicBreak', + // A sequence of one or more thematic break markers (`***`). + thematicBreakSequence: 'thematicBreakSequence', + // Whole block quote: + // + // ```markdown + // > a + // > + // > b + // ``` + // + // Includes `blockQuotePrefix` and flow. + blockQuote: 'blockQuote', + // The `>` or `> ` of a block quote. + blockQuotePrefix: 'blockQuotePrefix', + // The `>` of a block quote prefix. + blockQuoteMarker: 'blockQuoteMarker', + // The optional ` ` of a block quote prefix. + blockQuotePrefixWhitespace: 'blockQuotePrefixWhitespace', + // Whole unordered list: + // + // ```markdown + // - a + // b + // ``` + // + // Includes `listItemPrefix`, flow, and optionally `listItemIndent` on further + // lines. + listOrdered: 'listOrdered', + // Whole ordered list: + // + // ```markdown + // 1. a + // b + // ``` + // + // Includes `listItemPrefix`, flow, and optionally `listItemIndent` on further + // lines. + listUnordered: 'listUnordered', + // The indent of further list item lines. + listItemIndent: 'listItemIndent', + // A marker, as in, `*`, `+`, `-`, `.`, or `)`. + listItemMarker: 'listItemMarker', + // The thing that starts a list item, such as `1. `. + // Includes `listItemValue` if ordered, `listItemMarker`, and + // `listItemPrefixWhitespace` (unless followed by a line ending). + listItemPrefix: 'listItemPrefix', + // The whitespace after a marker. + listItemPrefixWhitespace: 'listItemPrefixWhitespace', + // The numerical value of an ordered item. + listItemValue: 'listItemValue', + // Internal types used for subtokenizers, compiled away + chunkContent: 'chunkContent', + chunkFlow: 'chunkFlow', + chunkText: 'chunkText', + chunkString: 'chunkString' +} + +module.exports = types diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/unicode-punctuation-regex.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/unicode-punctuation-regex.js new file mode 100644 index 00000000000000..6d25ee4bae5ef2 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constant/unicode-punctuation-regex.js @@ -0,0 +1,11 @@ +'use strict' + +// This module is generated by `script/`. +// +// CommonMark handles attention (emphasis, strong) markers based on what comes +// before or after them. +// One such difference is if those characters are Unicode punctuation. +// This script is generated from the Unicode data. +var unicodePunctuation = /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/ + +module.exports = unicodePunctuation diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constructs.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constructs.js new file mode 100644 index 00000000000000..adcc84a44b390a --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/constructs.js @@ -0,0 +1,127 @@ +'use strict' + +Object.defineProperty(exports, '__esModule', {value: true}) + +var text$1 = require('./initialize/text.js') +var attention = require('./tokenize/attention.js') +var autolink = require('./tokenize/autolink.js') +var blockQuote = require('./tokenize/block-quote.js') +var characterEscape = require('./tokenize/character-escape.js') +var characterReference = require('./tokenize/character-reference.js') +var codeFenced = require('./tokenize/code-fenced.js') +var codeIndented = require('./tokenize/code-indented.js') +var codeText = require('./tokenize/code-text.js') +var definition = require('./tokenize/definition.js') +var hardBreakEscape = require('./tokenize/hard-break-escape.js') +var headingAtx = require('./tokenize/heading-atx.js') +var htmlFlow = require('./tokenize/html-flow.js') +var htmlText = require('./tokenize/html-text.js') +var labelEnd = require('./tokenize/label-end.js') +var labelStartImage = require('./tokenize/label-start-image.js') +var labelStartLink = require('./tokenize/label-start-link.js') +var lineEnding = require('./tokenize/line-ending.js') +var list = require('./tokenize/list.js') +var setextUnderline = require('./tokenize/setext-underline.js') +var thematicBreak = require('./tokenize/thematic-break.js') + +var document = { + 42: list, + // Asterisk + 43: list, + // Plus sign + 45: list, + // Dash + 48: list, + // 0 + 49: list, + // 1 + 50: list, + // 2 + 51: list, + // 3 + 52: list, + // 4 + 53: list, + // 5 + 54: list, + // 6 + 55: list, + // 7 + 56: list, + // 8 + 57: list, + // 9 + 62: blockQuote // Greater than +} +var contentInitial = { + 91: definition // Left square bracket +} +var flowInitial = { + '-2': codeIndented, + // Horizontal tab + '-1': codeIndented, + // Virtual space + 32: codeIndented // Space +} +var flow = { + 35: headingAtx, + // Number sign + 42: thematicBreak, + // Asterisk + 45: [setextUnderline, thematicBreak], + // Dash + 60: htmlFlow, + // Less than + 61: setextUnderline, + // Equals to + 95: thematicBreak, + // Underscore + 96: codeFenced, + // Grave accent + 126: codeFenced // Tilde +} +var string = { + 38: characterReference, + // Ampersand + 92: characterEscape // Backslash +} +var text = { + '-5': lineEnding, + // Carriage return + '-4': lineEnding, + // Line feed + '-3': lineEnding, + // Carriage return + line feed + 33: labelStartImage, + // Exclamation mark + 38: characterReference, + // Ampersand + 42: attention, + // Asterisk + 60: [autolink, htmlText], + // Less than + 91: labelStartLink, + // Left square bracket + 92: [hardBreakEscape, characterEscape], + // Backslash + 93: labelEnd, + // Right square bracket + 95: attention, + // Underscore + 96: codeText // Grave accent +} +var insideSpan = { + null: [attention, text$1.resolver] +} +var disable = { + null: [] +} + +exports.contentInitial = contentInitial +exports.disable = disable +exports.document = document +exports.flow = flow +exports.flowInitial = flowInitial +exports.insideSpan = insideSpan +exports.string = string +exports.text = text diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/index.js new file mode 100644 index 00000000000000..8b289a298f114b --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/index.js @@ -0,0 +1,21 @@ +'use strict' + +var html = require('./compile/html.js') +var parse = require('./parse.js') +var postprocess = require('./postprocess.js') +var preprocess = require('./preprocess.js') + +function buffer(value, encoding, options) { + if (typeof encoding !== 'string') { + options = encoding + encoding = undefined + } + + return html(options)( + postprocess( + parse(options).document().write(preprocess()(value, encoding, true)) + ) + ) +} + +module.exports = buffer diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/initialize/content.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/initialize/content.js new file mode 100644 index 00000000000000..546aafece686a0 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/initialize/content.js @@ -0,0 +1,69 @@ +'use strict' + +Object.defineProperty(exports, '__esModule', {value: true}) + +var markdownLineEnding = require('../character/markdown-line-ending.js') +var factorySpace = require('../tokenize/factory-space.js') + +var tokenize = initializeContent + +function initializeContent(effects) { + var contentStart = effects.attempt( + this.parser.constructs.contentInitial, + afterContentStartConstruct, + paragraphInitial + ) + var previous + return contentStart + + function afterContentStartConstruct(code) { + if (code === null) { + effects.consume(code) + return + } + + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return factorySpace(effects, contentStart, 'linePrefix') + } + + function paragraphInitial(code) { + effects.enter('paragraph') + return lineStart(code) + } + + function lineStart(code) { + var token = effects.enter('chunkText', { + contentType: 'text', + previous: previous + }) + + if (previous) { + previous.next = token + } + + previous = token + return data(code) + } + + function data(code) { + if (code === null) { + effects.exit('chunkText') + effects.exit('paragraph') + effects.consume(code) + return + } + + if (markdownLineEnding(code)) { + effects.consume(code) + effects.exit('chunkText') + return lineStart + } // Data. + + effects.consume(code) + return data + } +} + +exports.tokenize = tokenize diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/initialize/document.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/initialize/document.js new file mode 100644 index 00000000000000..fa357fc3d4aff5 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/initialize/document.js @@ -0,0 +1,237 @@ +'use strict' + +Object.defineProperty(exports, '__esModule', {value: true}) + +var markdownLineEnding = require('../character/markdown-line-ending.js') +var factorySpace = require('../tokenize/factory-space.js') +var partialBlankLine = require('../tokenize/partial-blank-line.js') + +var tokenize = initializeDocument +var containerConstruct = { + tokenize: tokenizeContainer +} +var lazyFlowConstruct = { + tokenize: tokenizeLazyFlow +} + +function initializeDocument(effects) { + var self = this + var stack = [] + var continued = 0 + var inspectConstruct = { + tokenize: tokenizeInspect, + partial: true + } + var inspectResult + var childFlow + var childToken + return start + + function start(code) { + if (continued < stack.length) { + self.containerState = stack[continued][1] + return effects.attempt( + stack[continued][0].continuation, + documentContinue, + documentContinued + )(code) + } + + return documentContinued(code) + } + + function documentContinue(code) { + continued++ + return start(code) + } + + function documentContinued(code) { + // If we’re in a concrete construct (such as when expecting another line of + // HTML, or we resulted in lazy content), we can immediately start flow. + if (inspectResult && inspectResult.flowContinue) { + return flowStart(code) + } + + self.interrupt = + childFlow && + childFlow.currentConstruct && + childFlow.currentConstruct.interruptible + self.containerState = {} + return effects.attempt( + containerConstruct, + containerContinue, + flowStart + )(code) + } + + function containerContinue(code) { + stack.push([self.currentConstruct, self.containerState]) + self.containerState = undefined + return documentContinued(code) + } + + function flowStart(code) { + if (code === null) { + exitContainers(0, true) + effects.consume(code) + return + } + + childFlow = childFlow || self.parser.flow(self.now()) + effects.enter('chunkFlow', { + contentType: 'flow', + previous: childToken, + _tokenizer: childFlow + }) + return flowContinue(code) + } + + function flowContinue(code) { + if (code === null) { + continueFlow(effects.exit('chunkFlow')) + return flowStart(code) + } + + if (markdownLineEnding(code)) { + effects.consume(code) + continueFlow(effects.exit('chunkFlow')) + return effects.check(inspectConstruct, documentAfterPeek) + } + + effects.consume(code) + return flowContinue + } + + function documentAfterPeek(code) { + exitContainers( + inspectResult.continued, + inspectResult && inspectResult.flowEnd + ) + continued = 0 + return start(code) + } + + function continueFlow(token) { + if (childToken) childToken.next = token + childToken = token + childFlow.lazy = inspectResult && inspectResult.lazy + childFlow.defineSkip(token.start) + childFlow.write(self.sliceStream(token)) + } + + function exitContainers(size, end) { + var index = stack.length // Close the flow. + + if (childFlow && end) { + childFlow.write([null]) + childToken = childFlow = undefined + } // Exit open containers. + + while (index-- > size) { + self.containerState = stack[index][1] + stack[index][0].exit.call(self, effects) + } + + stack.length = size + } + + function tokenizeInspect(effects, ok) { + var subcontinued = 0 + inspectResult = {} + return inspectStart + + function inspectStart(code) { + if (subcontinued < stack.length) { + self.containerState = stack[subcontinued][1] + return effects.attempt( + stack[subcontinued][0].continuation, + inspectContinue, + inspectLess + )(code) + } // If we’re continued but in a concrete flow, we can’t have more + // containers. + + if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) { + inspectResult.flowContinue = true + return inspectDone(code) + } + + self.interrupt = + childFlow.currentConstruct && childFlow.currentConstruct.interruptible + self.containerState = {} + return effects.attempt( + containerConstruct, + inspectFlowEnd, + inspectDone + )(code) + } + + function inspectContinue(code) { + subcontinued++ + return self.containerState._closeFlow + ? inspectFlowEnd(code) + : inspectStart(code) + } + + function inspectLess(code) { + if (childFlow.currentConstruct && childFlow.currentConstruct.lazy) { + // Maybe another container? + self.containerState = {} + return effects.attempt( + containerConstruct, + inspectFlowEnd, // Maybe flow, or a blank line? + effects.attempt( + lazyFlowConstruct, + inspectFlowEnd, + effects.check(partialBlankLine, inspectFlowEnd, inspectLazy) + ) + )(code) + } // Otherwise we’re interrupting. + + return inspectFlowEnd(code) + } + + function inspectLazy(code) { + // Act as if all containers are continued. + subcontinued = stack.length + inspectResult.lazy = true + inspectResult.flowContinue = true + return inspectDone(code) + } // We’re done with flow if we have more containers, or an interruption. + + function inspectFlowEnd(code) { + inspectResult.flowEnd = true + return inspectDone(code) + } + + function inspectDone(code) { + inspectResult.continued = subcontinued + self.interrupt = self.containerState = undefined + return ok(code) + } + } +} + +function tokenizeContainer(effects, ok, nok) { + return factorySpace( + effects, + effects.attempt(this.parser.constructs.document, ok, nok), + 'linePrefix', + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + ) +} + +function tokenizeLazyFlow(effects, ok, nok) { + return factorySpace( + effects, + effects.lazy(this.parser.constructs.flow, ok, nok), + 'linePrefix', + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + ) +} + +exports.tokenize = tokenize diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/initialize/flow.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/initialize/flow.js new file mode 100644 index 00000000000000..0b7813c8927fcd --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/initialize/flow.js @@ -0,0 +1,60 @@ +'use strict' + +Object.defineProperty(exports, '__esModule', {value: true}) + +var content = require('../tokenize/content.js') +var factorySpace = require('../tokenize/factory-space.js') +var partialBlankLine = require('../tokenize/partial-blank-line.js') + +var tokenize = initializeFlow + +function initializeFlow(effects) { + var self = this + var initial = effects.attempt( + // Try to parse a blank line. + partialBlankLine, + atBlankEnding, // Try to parse initial flow (essentially, only code). + effects.attempt( + this.parser.constructs.flowInitial, + afterConstruct, + factorySpace( + effects, + effects.attempt( + this.parser.constructs.flow, + afterConstruct, + effects.attempt(content, afterConstruct) + ), + 'linePrefix' + ) + ) + ) + return initial + + function atBlankEnding(code) { + if (code === null) { + effects.consume(code) + return + } + + effects.enter('lineEndingBlank') + effects.consume(code) + effects.exit('lineEndingBlank') + self.currentConstruct = undefined + return initial + } + + function afterConstruct(code) { + if (code === null) { + effects.consume(code) + return + } + + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + self.currentConstruct = undefined + return initial + } +} + +exports.tokenize = tokenize diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/initialize/text.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/initialize/text.js new file mode 100644 index 00000000000000..d0d460f4c0e860 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/initialize/text.js @@ -0,0 +1,201 @@ +'use strict' + +Object.defineProperty(exports, '__esModule', {value: true}) + +var assign = require('../constant/assign.js') +var shallow = require('../util/shallow.js') + +var text = initializeFactory('text') +var string = initializeFactory('string') +var resolver = { + resolveAll: createResolver() +} + +function initializeFactory(field) { + return { + tokenize: initializeText, + resolveAll: createResolver( + field === 'text' ? resolveAllLineSuffixes : undefined + ) + } + + function initializeText(effects) { + var self = this + var constructs = this.parser.constructs[field] + var text = effects.attempt(constructs, start, notText) + return start + + function start(code) { + return atBreak(code) ? text(code) : notText(code) + } + + function notText(code) { + if (code === null) { + effects.consume(code) + return + } + + effects.enter('data') + effects.consume(code) + return data + } + + function data(code) { + if (atBreak(code)) { + effects.exit('data') + return text(code) + } // Data. + + effects.consume(code) + return data + } + + function atBreak(code) { + var list = constructs[code] + var index = -1 + + if (code === null) { + return true + } + + if (list) { + while (++index < list.length) { + if ( + !list[index].previous || + list[index].previous.call(self, self.previous) + ) { + return true + } + } + } + } + } +} + +function createResolver(extraResolver) { + return resolveAllText + + function resolveAllText(events, context) { + var index = -1 + var enter // A rather boring computation (to merge adjacent `data` events) which + // improves mm performance by 29%. + + while (++index <= events.length) { + if (enter === undefined) { + if (events[index] && events[index][1].type === 'data') { + enter = index + index++ + } + } else if (!events[index] || events[index][1].type !== 'data') { + // Don’t do anything if there is one data token. + if (index !== enter + 2) { + events[enter][1].end = events[index - 1][1].end + events.splice(enter + 2, index - enter - 2) + index = enter + 2 + } + + enter = undefined + } + } + + return extraResolver ? extraResolver(events, context) : events + } +} // A rather ugly set of instructions which again looks at chunks in the input +// stream. +// The reason to do this here is that it is *much* faster to parse in reverse. +// And that we can’t hook into `null` to split the line suffix before an EOF. +// To do: figure out if we can make this into a clean utility, or even in core. +// As it will be useful for GFMs literal autolink extension (and maybe even +// tables?) + +function resolveAllLineSuffixes(events, context) { + var eventIndex = -1 + var chunks + var data + var chunk + var index + var bufferIndex + var size + var tabs + var token + + while (++eventIndex <= events.length) { + if ( + (eventIndex === events.length || + events[eventIndex][1].type === 'lineEnding') && + events[eventIndex - 1][1].type === 'data' + ) { + data = events[eventIndex - 1][1] + chunks = context.sliceStream(data) + index = chunks.length + bufferIndex = -1 + size = 0 + tabs = undefined + + while (index--) { + chunk = chunks[index] + + if (typeof chunk === 'string') { + bufferIndex = chunk.length + + while (chunk.charCodeAt(bufferIndex - 1) === 32) { + size++ + bufferIndex-- + } + + if (bufferIndex) break + bufferIndex = -1 + } // Number + else if (chunk === -2) { + tabs = true + size++ + } else if (chunk === -1); + else { + // Replacement character, exit. + index++ + break + } + } + + if (size) { + token = { + type: + eventIndex === events.length || tabs || size < 2 + ? 'lineSuffix' + : 'hardBreakTrailing', + start: { + line: data.end.line, + column: data.end.column - size, + offset: data.end.offset - size, + _index: data.start._index + index, + _bufferIndex: index + ? bufferIndex + : data.start._bufferIndex + bufferIndex + }, + end: shallow(data.end) + } + data.end = shallow(token.start) + + if (data.start.offset === data.end.offset) { + assign(data, token) + } else { + events.splice( + eventIndex, + 0, + ['enter', token, context], + ['exit', token, context] + ) + eventIndex += 2 + } + } + + eventIndex++ + } + } + + return events +} + +exports.resolver = resolver +exports.string = string +exports.text = text diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/parse.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/parse.js new file mode 100644 index 00000000000000..9482300adce474 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/parse.js @@ -0,0 +1,36 @@ +'use strict' + +var content = require('./initialize/content.js') +var document = require('./initialize/document.js') +var flow = require('./initialize/flow.js') +var text = require('./initialize/text.js') +var combineExtensions = require('./util/combine-extensions.js') +var createTokenizer = require('./util/create-tokenizer.js') +var miniflat = require('./util/miniflat.js') +var constructs = require('./constructs.js') + +function parse(options) { + var settings = options || {} + var parser = { + defined: [], + constructs: combineExtensions( + [constructs].concat(miniflat(settings.extensions)) + ), + content: create(content), + document: create(document), + flow: create(flow), + string: create(text.string), + text: create(text.text) + } + return parser + + function create(initializer) { + return creator + + function creator(from) { + return createTokenizer(parser, initializer, from) + } + } +} + +module.exports = parse diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/postprocess.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/postprocess.js new file mode 100644 index 00000000000000..842f8ce8bfc64d --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/postprocess.js @@ -0,0 +1,13 @@ +'use strict' + +var subtokenize = require('./util/subtokenize.js') + +function postprocess(events) { + while (!subtokenize(events)) { + // Empty + } + + return events +} + +module.exports = postprocess diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/preprocess.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/preprocess.js new file mode 100644 index 00000000000000..b7186454e72bde --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/preprocess.js @@ -0,0 +1,87 @@ +'use strict' + +var search = /[\0\t\n\r]/g + +function preprocess() { + var start = true + var column = 1 + var buffer = '' + var atCarriageReturn + return preprocessor + + function preprocessor(value, encoding, end) { + var chunks = [] + var match + var next + var startPosition + var endPosition + var code + value = buffer + value.toString(encoding) + startPosition = 0 + buffer = '' + + if (start) { + if (value.charCodeAt(0) === 65279) { + startPosition++ + } + + start = undefined + } + + while (startPosition < value.length) { + search.lastIndex = startPosition + match = search.exec(value) + endPosition = match ? match.index : value.length + code = value.charCodeAt(endPosition) + + if (!match) { + buffer = value.slice(startPosition) + break + } + + if (code === 10 && startPosition === endPosition && atCarriageReturn) { + chunks.push(-3) + atCarriageReturn = undefined + } else { + if (atCarriageReturn) { + chunks.push(-5) + atCarriageReturn = undefined + } + + if (startPosition < endPosition) { + chunks.push(value.slice(startPosition, endPosition)) + column += endPosition - startPosition + } + + if (code === 0) { + chunks.push(65533) + column++ + } else if (code === 9) { + next = Math.ceil(column / 4) * 4 + chunks.push(-2) + + while (column++ < next) chunks.push(-1) + } else if (code === 10) { + chunks.push(-4) + column = 1 + } // Must be carriage return. + else { + atCarriageReturn = true + column = 1 + } + } + + startPosition = endPosition + 1 + } + + if (end) { + if (atCarriageReturn) chunks.push(-5) + if (buffer) chunks.push(buffer) + chunks.push(null) + } + + return chunks + } +} + +module.exports = preprocess diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/stream.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/stream.js new file mode 100644 index 00000000000000..c26d4d3b5f14f9 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/stream.js @@ -0,0 +1,103 @@ +'use strict' + +var events = require('events') +var html = require('./compile/html.js') +var parse = require('./parse.js') +var postprocess = require('./postprocess.js') +var preprocess = require('./preprocess.js') + +function stream(options) { + var preprocess$1 = preprocess() + var tokenize = parse(options).document().write + var compile = html(options) + var emitter = new events.EventEmitter() + var ended + emitter.writable = emitter.readable = true + emitter.write = write + emitter.end = end + emitter.pipe = pipe + return emitter // Write a chunk into memory. + + function write(chunk, encoding, callback) { + if (typeof encoding === 'function') { + callback = encoding + encoding = undefined + } + + if (ended) { + throw new Error('Did not expect `write` after `end`') + } + + tokenize(preprocess$1(chunk || '', encoding)) + + if (callback) { + callback() + } // Signal succesful write. + + return true + } // End the writing. + // Passes all arguments to a final `write`. + + function end(chunk, encoding, callback) { + write(chunk, encoding, callback) + emitter.emit( + 'data', + compile(postprocess(tokenize(preprocess$1('', encoding, true)))) + ) + emitter.emit('end') + ended = true + return true + } // Pipe the processor into a writable stream. + // Basically `Stream#pipe`, but inlined and simplified to keep the bundled + // size down. + // See: . + + function pipe(dest, options) { + emitter.on('data', ondata) + emitter.on('error', onerror) + emitter.on('end', cleanup) + emitter.on('close', cleanup) // If the `end` option is not supplied, `dest.end()` will be called when the + // `end` or `close` events are received. + + if (!dest._isStdio && (!options || options.end !== false)) { + emitter.on('end', onend) + } + + dest.on('error', onerror) + dest.on('close', cleanup) + dest.emit('pipe', emitter) + return dest // End destination. + + function onend() { + if (dest.end) { + dest.end() + } + } // Handle data. + + function ondata(chunk) { + if (dest.writable) { + dest.write(chunk) + } + } // Clean listeners. + + function cleanup() { + emitter.removeListener('data', ondata) + emitter.removeListener('end', onend) + emitter.removeListener('error', onerror) + emitter.removeListener('end', cleanup) + emitter.removeListener('close', cleanup) + dest.removeListener('error', onerror) + dest.removeListener('close', cleanup) + } // Close dangling pipes and handle unheard errors. + + function onerror(error) { + cleanup() + + if (!emitter.listenerCount('error')) { + throw error // Unhandled stream error in pipe. + } + } + } +} + +module.exports = stream diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/attention.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/attention.js new file mode 100644 index 00000000000000..b34be6f204f4ea --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/attention.js @@ -0,0 +1,186 @@ +'use strict' + +var chunkedPush = require('../util/chunked-push.js') +var chunkedSplice = require('../util/chunked-splice.js') +var classifyCharacter = require('../util/classify-character.js') +var movePoint = require('../util/move-point.js') +var resolveAll = require('../util/resolve-all.js') +var shallow = require('../util/shallow.js') + +var attention = { + name: 'attention', + tokenize: tokenizeAttention, + resolveAll: resolveAllAttention +} + +function resolveAllAttention(events, context) { + var index = -1 + var open + var group + var text + var openingSequence + var closingSequence + var use + var nextEvents + var offset // Walk through all events. + // + // Note: performance of this is fine on an mb of normal markdown, but it’s + // a bottleneck for malicious stuff. + + while (++index < events.length) { + // Find a token that can close. + if ( + events[index][0] === 'enter' && + events[index][1].type === 'attentionSequence' && + events[index][1]._close + ) { + open = index // Now walk back to find an opener. + + while (open--) { + // Find a token that can open the closer. + if ( + events[open][0] === 'exit' && + events[open][1].type === 'attentionSequence' && + events[open][1]._open && // If the markers are the same: + context.sliceSerialize(events[open][1]).charCodeAt(0) === + context.sliceSerialize(events[index][1]).charCodeAt(0) + ) { + // If the opening can close or the closing can open, + // and the close size *is not* a multiple of three, + // but the sum of the opening and closing size *is* multiple of three, + // then don’t match. + if ( + (events[open][1]._close || events[index][1]._open) && + (events[index][1].end.offset - events[index][1].start.offset) % 3 && + !( + (events[open][1].end.offset - + events[open][1].start.offset + + events[index][1].end.offset - + events[index][1].start.offset) % + 3 + ) + ) { + continue + } // Number of markers to use from the sequence. + + use = + events[open][1].end.offset - events[open][1].start.offset > 1 && + events[index][1].end.offset - events[index][1].start.offset > 1 + ? 2 + : 1 + openingSequence = { + type: use > 1 ? 'strongSequence' : 'emphasisSequence', + start: movePoint(shallow(events[open][1].end), -use), + end: shallow(events[open][1].end) + } + closingSequence = { + type: use > 1 ? 'strongSequence' : 'emphasisSequence', + start: shallow(events[index][1].start), + end: movePoint(shallow(events[index][1].start), use) + } + text = { + type: use > 1 ? 'strongText' : 'emphasisText', + start: shallow(events[open][1].end), + end: shallow(events[index][1].start) + } + group = { + type: use > 1 ? 'strong' : 'emphasis', + start: shallow(openingSequence.start), + end: shallow(closingSequence.end) + } + events[open][1].end = shallow(openingSequence.start) + events[index][1].start = shallow(closingSequence.end) + nextEvents = [] // If there are more markers in the opening, add them before. + + if (events[open][1].end.offset - events[open][1].start.offset) { + nextEvents = chunkedPush(nextEvents, [ + ['enter', events[open][1], context], + ['exit', events[open][1], context] + ]) + } // Opening. + + nextEvents = chunkedPush(nextEvents, [ + ['enter', group, context], + ['enter', openingSequence, context], + ['exit', openingSequence, context], + ['enter', text, context] + ]) // Between. + + nextEvents = chunkedPush( + nextEvents, + resolveAll( + context.parser.constructs.insideSpan.null, + events.slice(open + 1, index), + context + ) + ) // Closing. + + nextEvents = chunkedPush(nextEvents, [ + ['exit', text, context], + ['enter', closingSequence, context], + ['exit', closingSequence, context], + ['exit', group, context] + ]) // If there are more markers in the closing, add them after. + + if (events[index][1].end.offset - events[index][1].start.offset) { + offset = 2 + nextEvents = chunkedPush(nextEvents, [ + ['enter', events[index][1], context], + ['exit', events[index][1], context] + ]) + } else { + offset = 0 + } + + chunkedSplice(events, open - 1, index - open + 3, nextEvents) + index = open + nextEvents.length - offset - 2 + break + } + } + } + } // Remove remaining sequences. + + index = -1 + + while (++index < events.length) { + if (events[index][1].type === 'attentionSequence') { + events[index][1].type = 'data' + } + } + + return events +} + +function tokenizeAttention(effects, ok) { + var before = classifyCharacter(this.previous) + var marker + return start + + function start(code) { + effects.enter('attentionSequence') + marker = code + return sequence(code) + } + + function sequence(code) { + var token + var after + var open + var close + + if (code === marker) { + effects.consume(code) + return sequence + } + + token = effects.exit('attentionSequence') + after = classifyCharacter(code) + open = !after || (after === 2 && before) + close = !before || (before === 2 && after) + token._open = marker === 42 ? open : open && (before || !close) + token._close = marker === 42 ? close : close && (after || !open) + return ok(code) + } +} + +module.exports = attention diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/autolink.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/autolink.js new file mode 100644 index 00000000000000..d235d5f46d821e --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/autolink.js @@ -0,0 +1,125 @@ +'use strict' + +var asciiAlpha = require('../character/ascii-alpha.js') +var asciiAlphanumeric = require('../character/ascii-alphanumeric.js') +var asciiAtext = require('../character/ascii-atext.js') +var asciiControl = require('../character/ascii-control.js') + +var autolink = { + name: 'autolink', + tokenize: tokenizeAutolink +} + +function tokenizeAutolink(effects, ok, nok) { + var size = 1 + return start + + function start(code) { + effects.enter('autolink') + effects.enter('autolinkMarker') + effects.consume(code) + effects.exit('autolinkMarker') + effects.enter('autolinkProtocol') + return open + } + + function open(code) { + if (asciiAlpha(code)) { + effects.consume(code) + return schemeOrEmailAtext + } + + return asciiAtext(code) ? emailAtext(code) : nok(code) + } + + function schemeOrEmailAtext(code) { + return code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code) + ? schemeInsideOrEmailAtext(code) + : emailAtext(code) + } + + function schemeInsideOrEmailAtext(code) { + if (code === 58) { + effects.consume(code) + return urlInside + } + + if ( + (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && + size++ < 32 + ) { + effects.consume(code) + return schemeInsideOrEmailAtext + } + + return emailAtext(code) + } + + function urlInside(code) { + if (code === 62) { + effects.exit('autolinkProtocol') + return end(code) + } + + if (code === 32 || code === 60 || asciiControl(code)) { + return nok(code) + } + + effects.consume(code) + return urlInside + } + + function emailAtext(code) { + if (code === 64) { + effects.consume(code) + size = 0 + return emailAtSignOrDot + } + + if (asciiAtext(code)) { + effects.consume(code) + return emailAtext + } + + return nok(code) + } + + function emailAtSignOrDot(code) { + return asciiAlphanumeric(code) ? emailLabel(code) : nok(code) + } + + function emailLabel(code) { + if (code === 46) { + effects.consume(code) + size = 0 + return emailAtSignOrDot + } + + if (code === 62) { + // Exit, then change the type. + effects.exit('autolinkProtocol').type = 'autolinkEmail' + return end(code) + } + + return emailValue(code) + } + + function emailValue(code) { + if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) { + effects.consume(code) + return code === 45 ? emailValue : emailLabel + } + + return nok(code) + } + + function end(code) { + effects.enter('autolinkMarker') + effects.consume(code) + effects.exit('autolinkMarker') + effects.exit('autolink') + return ok + } +} + +module.exports = autolink diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/block-quote.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/block-quote.js new file mode 100644 index 00000000000000..b3090ca23892d3 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/block-quote.js @@ -0,0 +1,67 @@ +'use strict' + +var markdownSpace = require('../character/markdown-space.js') +var factorySpace = require('./factory-space.js') + +var blockQuote = { + name: 'blockQuote', + tokenize: tokenizeBlockQuoteStart, + continuation: { + tokenize: tokenizeBlockQuoteContinuation + }, + exit: exit +} + +function tokenizeBlockQuoteStart(effects, ok, nok) { + var self = this + return start + + function start(code) { + if (code === 62) { + if (!self.containerState.open) { + effects.enter('blockQuote', { + _container: true + }) + self.containerState.open = true + } + + effects.enter('blockQuotePrefix') + effects.enter('blockQuoteMarker') + effects.consume(code) + effects.exit('blockQuoteMarker') + return after + } + + return nok(code) + } + + function after(code) { + if (markdownSpace(code)) { + effects.enter('blockQuotePrefixWhitespace') + effects.consume(code) + effects.exit('blockQuotePrefixWhitespace') + effects.exit('blockQuotePrefix') + return ok + } + + effects.exit('blockQuotePrefix') + return ok(code) + } +} + +function tokenizeBlockQuoteContinuation(effects, ok, nok) { + return factorySpace( + effects, + effects.attempt(blockQuote, ok, nok), + 'linePrefix', + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + ) +} + +function exit(effects) { + effects.exit('blockQuote') +} + +module.exports = blockQuote diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/character-escape.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/character-escape.js new file mode 100644 index 00000000000000..dcad7353cd01ad --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/character-escape.js @@ -0,0 +1,34 @@ +'use strict' + +var asciiPunctuation = require('../character/ascii-punctuation.js') + +var characterEscape = { + name: 'characterEscape', + tokenize: tokenizeCharacterEscape +} + +function tokenizeCharacterEscape(effects, ok, nok) { + return start + + function start(code) { + effects.enter('characterEscape') + effects.enter('escapeMarker') + effects.consume(code) + effects.exit('escapeMarker') + return open + } + + function open(code) { + if (asciiPunctuation(code)) { + effects.enter('characterEscapeValue') + effects.consume(code) + effects.exit('characterEscapeValue') + effects.exit('characterEscape') + return ok + } + + return nok(code) + } +} + +module.exports = characterEscape diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/character-reference.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/character-reference.js new file mode 100644 index 00000000000000..101027dbde4120 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/character-reference.js @@ -0,0 +1,94 @@ +'use strict' + +var decodeEntity = require('parse-entities/decode-entity.js') +var asciiAlphanumeric = require('../character/ascii-alphanumeric.js') +var asciiDigit = require('../character/ascii-digit.js') +var asciiHexDigit = require('../character/ascii-hex-digit.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var decodeEntity__default = /*#__PURE__*/ _interopDefaultLegacy(decodeEntity) + +var characterReference = { + name: 'characterReference', + tokenize: tokenizeCharacterReference +} + +function tokenizeCharacterReference(effects, ok, nok) { + var self = this + var size = 0 + var max + var test + return start + + function start(code) { + effects.enter('characterReference') + effects.enter('characterReferenceMarker') + effects.consume(code) + effects.exit('characterReferenceMarker') + return open + } + + function open(code) { + if (code === 35) { + effects.enter('characterReferenceMarkerNumeric') + effects.consume(code) + effects.exit('characterReferenceMarkerNumeric') + return numeric + } + + effects.enter('characterReferenceValue') + max = 31 + test = asciiAlphanumeric + return value(code) + } + + function numeric(code) { + if (code === 88 || code === 120) { + effects.enter('characterReferenceMarkerHexadecimal') + effects.consume(code) + effects.exit('characterReferenceMarkerHexadecimal') + effects.enter('characterReferenceValue') + max = 6 + test = asciiHexDigit + return value + } + + effects.enter('characterReferenceValue') + max = 7 + test = asciiDigit + return value(code) + } + + function value(code) { + var token + + if (code === 59 && size) { + token = effects.exit('characterReferenceValue') + + if ( + test === asciiAlphanumeric && + !decodeEntity__default['default'](self.sliceSerialize(token)) + ) { + return nok(code) + } + + effects.enter('characterReferenceMarker') + effects.consume(code) + effects.exit('characterReferenceMarker') + effects.exit('characterReference') + return ok + } + + if (test(code) && size++ < max) { + effects.consume(code) + return value + } + + return nok(code) + } +} + +module.exports = characterReference diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/code-fenced.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/code-fenced.js new file mode 100644 index 00000000000000..16f8894704a385 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/code-fenced.js @@ -0,0 +1,176 @@ +'use strict' + +var markdownLineEnding = require('../character/markdown-line-ending.js') +var markdownLineEndingOrSpace = require('../character/markdown-line-ending-or-space.js') +var prefixSize = require('../util/prefix-size.js') +var factorySpace = require('./factory-space.js') + +var codeFenced = { + name: 'codeFenced', + tokenize: tokenizeCodeFenced, + concrete: true +} + +function tokenizeCodeFenced(effects, ok, nok) { + var self = this + var closingFenceConstruct = { + tokenize: tokenizeClosingFence, + partial: true + } + var initialPrefix = prefixSize(this.events, 'linePrefix') + var sizeOpen = 0 + var marker + return start + + function start(code) { + effects.enter('codeFenced') + effects.enter('codeFencedFence') + effects.enter('codeFencedFenceSequence') + marker = code + return sequenceOpen(code) + } + + function sequenceOpen(code) { + if (code === marker) { + effects.consume(code) + sizeOpen++ + return sequenceOpen + } + + effects.exit('codeFencedFenceSequence') + return sizeOpen < 3 + ? nok(code) + : factorySpace(effects, infoOpen, 'whitespace')(code) + } + + function infoOpen(code) { + if (code === null || markdownLineEnding(code)) { + return openAfter(code) + } + + effects.enter('codeFencedFenceInfo') + effects.enter('chunkString', { + contentType: 'string' + }) + return info(code) + } + + function info(code) { + if (code === null || markdownLineEndingOrSpace(code)) { + effects.exit('chunkString') + effects.exit('codeFencedFenceInfo') + return factorySpace(effects, infoAfter, 'whitespace')(code) + } + + if (code === 96 && code === marker) return nok(code) + effects.consume(code) + return info + } + + function infoAfter(code) { + if (code === null || markdownLineEnding(code)) { + return openAfter(code) + } + + effects.enter('codeFencedFenceMeta') + effects.enter('chunkString', { + contentType: 'string' + }) + return meta(code) + } + + function meta(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit('chunkString') + effects.exit('codeFencedFenceMeta') + return openAfter(code) + } + + if (code === 96 && code === marker) return nok(code) + effects.consume(code) + return meta + } + + function openAfter(code) { + effects.exit('codeFencedFence') + return self.interrupt ? ok(code) : content(code) + } + + function content(code) { + if (code === null) { + return after(code) + } + + if (markdownLineEnding(code)) { + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return effects.attempt( + closingFenceConstruct, + after, + initialPrefix + ? factorySpace(effects, content, 'linePrefix', initialPrefix + 1) + : content + ) + } + + effects.enter('codeFlowValue') + return contentContinue(code) + } + + function contentContinue(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit('codeFlowValue') + return content(code) + } + + effects.consume(code) + return contentContinue + } + + function after(code) { + effects.exit('codeFenced') + return ok(code) + } + + function tokenizeClosingFence(effects, ok, nok) { + var size = 0 + return factorySpace( + effects, + closingSequenceStart, + 'linePrefix', + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + ) + + function closingSequenceStart(code) { + effects.enter('codeFencedFence') + effects.enter('codeFencedFenceSequence') + return closingSequence(code) + } + + function closingSequence(code) { + if (code === marker) { + effects.consume(code) + size++ + return closingSequence + } + + if (size < sizeOpen) return nok(code) + effects.exit('codeFencedFenceSequence') + return factorySpace(effects, closingSequenceEnd, 'whitespace')(code) + } + + function closingSequenceEnd(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit('codeFencedFence') + return ok(code) + } + + return nok(code) + } + } +} + +module.exports = codeFenced diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/code-indented.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/code-indented.js new file mode 100644 index 00000000000000..604f094dbc7a38 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/code-indented.js @@ -0,0 +1,72 @@ +'use strict' + +var markdownLineEnding = require('../character/markdown-line-ending.js') +var chunkedSplice = require('../util/chunked-splice.js') +var prefixSize = require('../util/prefix-size.js') +var factorySpace = require('./factory-space.js') + +var codeIndented = { + name: 'codeIndented', + tokenize: tokenizeCodeIndented, + resolve: resolveCodeIndented +} +var indentedContentConstruct = { + tokenize: tokenizeIndentedContent, + partial: true +} + +function resolveCodeIndented(events, context) { + var code = { + type: 'codeIndented', + start: events[0][1].start, + end: events[events.length - 1][1].end + } + chunkedSplice(events, 0, 0, [['enter', code, context]]) + chunkedSplice(events, events.length, 0, [['exit', code, context]]) + return events +} + +function tokenizeCodeIndented(effects, ok, nok) { + return effects.attempt(indentedContentConstruct, afterPrefix, nok) + + function afterPrefix(code) { + if (code === null) { + return ok(code) + } + + if (markdownLineEnding(code)) { + return effects.attempt(indentedContentConstruct, afterPrefix, ok)(code) + } + + effects.enter('codeFlowValue') + return content(code) + } + + function content(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit('codeFlowValue') + return afterPrefix(code) + } + + effects.consume(code) + return content + } +} + +function tokenizeIndentedContent(effects, ok, nok) { + var self = this + return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1) + + function afterPrefix(code) { + if (markdownLineEnding(code)) { + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1) + } + + return prefixSize(self.events, 'linePrefix') < 4 ? nok(code) : ok(code) + } +} + +module.exports = codeIndented diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/code-text.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/code-text.js new file mode 100644 index 00000000000000..d4a8fbe31c0bf8 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/code-text.js @@ -0,0 +1,162 @@ +'use strict' + +var markdownLineEnding = require('../character/markdown-line-ending.js') + +var codeText = { + name: 'codeText', + tokenize: tokenizeCodeText, + resolve: resolveCodeText, + previous: previous +} + +function resolveCodeText(events) { + var tailExitIndex = events.length - 4 + var headEnterIndex = 3 + var index + var enter // If we start and end with an EOL or a space. + + if ( + (events[headEnterIndex][1].type === 'lineEnding' || + events[headEnterIndex][1].type === 'space') && + (events[tailExitIndex][1].type === 'lineEnding' || + events[tailExitIndex][1].type === 'space') + ) { + index = headEnterIndex // And we have data. + + while (++index < tailExitIndex) { + if (events[index][1].type === 'codeTextData') { + // Then we have padding. + events[tailExitIndex][1].type = events[headEnterIndex][1].type = + 'codeTextPadding' + headEnterIndex += 2 + tailExitIndex -= 2 + break + } + } + } // Merge adjacent spaces and data. + + index = headEnterIndex - 1 + tailExitIndex++ + + while (++index <= tailExitIndex) { + if (enter === undefined) { + if (index !== tailExitIndex && events[index][1].type !== 'lineEnding') { + enter = index + } + } else if ( + index === tailExitIndex || + events[index][1].type === 'lineEnding' + ) { + events[enter][1].type = 'codeTextData' + + if (index !== enter + 2) { + events[enter][1].end = events[index - 1][1].end + events.splice(enter + 2, index - enter - 2) + tailExitIndex -= index - enter - 2 + index = enter + 2 + } + + enter = undefined + } + } + + return events +} + +function previous(code) { + // If there is a previous code, there will always be a tail. + return ( + code !== 96 || + this.events[this.events.length - 1][1].type === 'characterEscape' + ) +} + +function tokenizeCodeText(effects, ok, nok) { + var sizeOpen = 0 + var size + var token + return start + + function start(code) { + effects.enter('codeText') + effects.enter('codeTextSequence') + return openingSequence(code) + } + + function openingSequence(code) { + if (code === 96) { + effects.consume(code) + sizeOpen++ + return openingSequence + } + + effects.exit('codeTextSequence') + return gap(code) + } + + function gap(code) { + // EOF. + if (code === null) { + return nok(code) + } // Closing fence? + // Could also be data. + + if (code === 96) { + token = effects.enter('codeTextSequence') + size = 0 + return closingSequence(code) + } // Tabs don’t work, and virtual spaces don’t make sense. + + if (code === 32) { + effects.enter('space') + effects.consume(code) + effects.exit('space') + return gap + } + + if (markdownLineEnding(code)) { + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return gap + } // Data. + + effects.enter('codeTextData') + return data(code) + } // In code. + + function data(code) { + if ( + code === null || + code === 32 || + code === 96 || + markdownLineEnding(code) + ) { + effects.exit('codeTextData') + return gap(code) + } + + effects.consume(code) + return data + } // Closing fence. + + function closingSequence(code) { + // More. + if (code === 96) { + effects.consume(code) + size++ + return closingSequence + } // Done! + + if (size === sizeOpen) { + effects.exit('codeTextSequence') + effects.exit('codeText') + return ok(code) + } // More or less accents: mark as data. + + token.type = 'codeTextData' + return data(code) + } +} + +module.exports = codeText diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/content.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/content.js new file mode 100644 index 00000000000000..e1a712eb8ba112 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/content.js @@ -0,0 +1,99 @@ +'use strict' + +var markdownLineEnding = require('../character/markdown-line-ending.js') +var prefixSize = require('../util/prefix-size.js') +var subtokenize = require('../util/subtokenize.js') +var factorySpace = require('./factory-space.js') + +// No name because it must not be turned off. +var content = { + tokenize: tokenizeContent, + resolve: resolveContent, + interruptible: true, + lazy: true +} +var continuationConstruct = { + tokenize: tokenizeContinuation, + partial: true +} // Content is transparent: it’s parsed right now. That way, definitions are also +// parsed right now: before text in paragraphs (specifically, media) are parsed. + +function resolveContent(events) { + subtokenize(events) + return events +} + +function tokenizeContent(effects, ok) { + var previous + return start + + function start(code) { + effects.enter('content') + previous = effects.enter('chunkContent', { + contentType: 'content' + }) + return data(code) + } + + function data(code) { + if (code === null) { + return contentEnd(code) + } + + if (markdownLineEnding(code)) { + return effects.check( + continuationConstruct, + contentContinue, + contentEnd + )(code) + } // Data. + + effects.consume(code) + return data + } + + function contentEnd(code) { + effects.exit('chunkContent') + effects.exit('content') + return ok(code) + } + + function contentContinue(code) { + effects.consume(code) + effects.exit('chunkContent') + previous = previous.next = effects.enter('chunkContent', { + contentType: 'content', + previous: previous + }) + return data + } +} + +function tokenizeContinuation(effects, ok, nok) { + var self = this + return startLookahead + + function startLookahead(code) { + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return factorySpace(effects, prefixed, 'linePrefix') + } + + function prefixed(code) { + if (code === null || markdownLineEnding(code)) { + return nok(code) + } + + if ( + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 || + prefixSize(self.events, 'linePrefix') < 4 + ) { + return effects.interrupt(self.parser.constructs.flow, nok, ok)(code) + } + + return ok(code) + } +} + +module.exports = content diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/definition.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/definition.js new file mode 100644 index 00000000000000..21505d8943ab5d --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/definition.js @@ -0,0 +1,115 @@ +'use strict' + +var markdownLineEnding = require('../character/markdown-line-ending.js') +var markdownLineEndingOrSpace = require('../character/markdown-line-ending-or-space.js') +var normalizeIdentifier = require('../util/normalize-identifier.js') +var factoryDestination = require('./factory-destination.js') +var factoryLabel = require('./factory-label.js') +var factorySpace = require('./factory-space.js') +var factoryWhitespace = require('./factory-whitespace.js') +var factoryTitle = require('./factory-title.js') + +var definition = { + name: 'definition', + tokenize: tokenizeDefinition +} +var titleConstruct = { + tokenize: tokenizeTitle, + partial: true +} + +function tokenizeDefinition(effects, ok, nok) { + var self = this + var identifier + return start + + function start(code) { + effects.enter('definition') + return factoryLabel.call( + self, + effects, + labelAfter, + nok, + 'definitionLabel', + 'definitionLabelMarker', + 'definitionLabelString' + )(code) + } + + function labelAfter(code) { + identifier = normalizeIdentifier( + self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) + ) + + if (code === 58) { + effects.enter('definitionMarker') + effects.consume(code) + effects.exit('definitionMarker') // Note: blank lines can’t exist in content. + + return factoryWhitespace( + effects, + factoryDestination( + effects, + effects.attempt( + titleConstruct, + factorySpace(effects, after, 'whitespace'), + factorySpace(effects, after, 'whitespace') + ), + nok, + 'definitionDestination', + 'definitionDestinationLiteral', + 'definitionDestinationLiteralMarker', + 'definitionDestinationRaw', + 'definitionDestinationString' + ) + ) + } + + return nok(code) + } + + function after(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit('definition') + + if (self.parser.defined.indexOf(identifier) < 0) { + self.parser.defined.push(identifier) + } + + return ok(code) + } + + return nok(code) + } +} + +function tokenizeTitle(effects, ok, nok) { + return start + + function start(code) { + return markdownLineEndingOrSpace(code) + ? factoryWhitespace(effects, before)(code) + : nok(code) + } + + function before(code) { + if (code === 34 || code === 39 || code === 40) { + return factoryTitle( + effects, + factorySpace(effects, after, 'whitespace'), + nok, + 'definitionTitle', + 'definitionTitleMarker', + 'definitionTitleString' + )(code) + } + + return nok(code) + } + + function after(code) { + return code === null || markdownLineEnding(code) ? ok(code) : nok(code) + } +} + +module.exports = definition diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/factory-destination.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/factory-destination.js new file mode 100644 index 00000000000000..1572025cffdddd --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/factory-destination.js @@ -0,0 +1,131 @@ +'use strict' + +var asciiControl = require('../character/ascii-control.js') +var markdownLineEndingOrSpace = require('../character/markdown-line-ending-or-space.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') + +// eslint-disable-next-line max-params +function destinationFactory( + effects, + ok, + nok, + type, + literalType, + literalMarkerType, + rawType, + stringType, + max +) { + var limit = max || Infinity + var balance = 0 + return start + + function start(code) { + if (code === 60) { + effects.enter(type) + effects.enter(literalType) + effects.enter(literalMarkerType) + effects.consume(code) + effects.exit(literalMarkerType) + return destinationEnclosedBefore + } + + if (asciiControl(code) || code === 41) { + return nok(code) + } + + effects.enter(type) + effects.enter(rawType) + effects.enter(stringType) + effects.enter('chunkString', { + contentType: 'string' + }) + return destinationRaw(code) + } + + function destinationEnclosedBefore(code) { + if (code === 62) { + effects.enter(literalMarkerType) + effects.consume(code) + effects.exit(literalMarkerType) + effects.exit(literalType) + effects.exit(type) + return ok + } + + effects.enter(stringType) + effects.enter('chunkString', { + contentType: 'string' + }) + return destinationEnclosed(code) + } + + function destinationEnclosed(code) { + if (code === 62) { + effects.exit('chunkString') + effects.exit(stringType) + return destinationEnclosedBefore(code) + } + + if (code === null || code === 60 || markdownLineEnding(code)) { + return nok(code) + } + + effects.consume(code) + return code === 92 ? destinationEnclosedEscape : destinationEnclosed + } + + function destinationEnclosedEscape(code) { + if (code === 60 || code === 62 || code === 92) { + effects.consume(code) + return destinationEnclosed + } + + return destinationEnclosed(code) + } + + function destinationRaw(code) { + if (code === 40) { + if (++balance > limit) return nok(code) + effects.consume(code) + return destinationRaw + } + + if (code === 41) { + if (!balance--) { + effects.exit('chunkString') + effects.exit(stringType) + effects.exit(rawType) + effects.exit(type) + return ok(code) + } + + effects.consume(code) + return destinationRaw + } + + if (code === null || markdownLineEndingOrSpace(code)) { + if (balance) return nok(code) + effects.exit('chunkString') + effects.exit(stringType) + effects.exit(rawType) + effects.exit(type) + return ok(code) + } + + if (asciiControl(code)) return nok(code) + effects.consume(code) + return code === 92 ? destinationRawEscape : destinationRaw + } + + function destinationRawEscape(code) { + if (code === 40 || code === 41 || code === 92) { + effects.consume(code) + return destinationRaw + } + + return destinationRaw(code) + } +} + +module.exports = destinationFactory diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/factory-label.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/factory-label.js new file mode 100644 index 00000000000000..500c95a8f7f53e --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/factory-label.js @@ -0,0 +1,88 @@ +'use strict' + +var markdownLineEnding = require('../character/markdown-line-ending.js') +var markdownSpace = require('../character/markdown-space.js') + +// eslint-disable-next-line max-params +function labelFactory(effects, ok, nok, type, markerType, stringType) { + var self = this + var size = 0 + var data + return start + + function start(code) { + effects.enter(type) + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + effects.enter(stringType) + return atBreak + } + + function atBreak(code) { + if ( + code === null || + code === 91 || + (code === 93 && !data) || + /* c8 ignore next */ + (code === 94 && + /* c8 ignore next */ + !size && + /* c8 ignore next */ + '_hiddenFootnoteSupport' in self.parser.constructs) || + size > 999 + ) { + return nok(code) + } + + if (code === 93) { + effects.exit(stringType) + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + effects.exit(type) + return ok + } + + if (markdownLineEnding(code)) { + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return atBreak + } + + effects.enter('chunkString', { + contentType: 'string' + }) + return label(code) + } + + function label(code) { + if ( + code === null || + code === 91 || + code === 93 || + markdownLineEnding(code) || + size++ > 999 + ) { + effects.exit('chunkString') + return atBreak(code) + } + + effects.consume(code) + data = data || !markdownSpace(code) + return code === 92 ? labelEscape : label + } + + function labelEscape(code) { + if (code === 91 || code === 92 || code === 93) { + effects.consume(code) + size++ + return label + } + + return label(code) + } +} + +module.exports = labelFactory diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/factory-space.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/factory-space.js new file mode 100644 index 00000000000000..b1026df91f2674 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/factory-space.js @@ -0,0 +1,30 @@ +'use strict' + +var markdownSpace = require('../character/markdown-space.js') + +function spaceFactory(effects, ok, type, max) { + var limit = max ? max - 1 : Infinity + var size = 0 + return start + + function start(code) { + if (markdownSpace(code)) { + effects.enter(type) + return prefix(code) + } + + return ok(code) + } + + function prefix(code) { + if (markdownSpace(code) && size++ < limit) { + effects.consume(code) + return prefix + } + + effects.exit(type) + return ok(code) + } +} + +module.exports = spaceFactory diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/factory-title.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/factory-title.js new file mode 100644 index 00000000000000..6b3d05456e44f4 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/factory-title.js @@ -0,0 +1,75 @@ +'use strict' + +var markdownLineEnding = require('../character/markdown-line-ending.js') +var factorySpace = require('./factory-space.js') + +function titleFactory(effects, ok, nok, type, markerType, stringType) { + var marker + return start + + function start(code) { + effects.enter(type) + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + marker = code === 40 ? 41 : code + return atFirstTitleBreak + } + + function atFirstTitleBreak(code) { + if (code === marker) { + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + effects.exit(type) + return ok + } + + effects.enter(stringType) + return atTitleBreak(code) + } + + function atTitleBreak(code) { + if (code === marker) { + effects.exit(stringType) + return atFirstTitleBreak(marker) + } + + if (code === null) { + return nok(code) + } // Note: blank lines can’t exist in content. + + if (markdownLineEnding(code)) { + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return factorySpace(effects, atTitleBreak, 'linePrefix') + } + + effects.enter('chunkString', { + contentType: 'string' + }) + return title(code) + } + + function title(code) { + if (code === marker || code === null || markdownLineEnding(code)) { + effects.exit('chunkString') + return atTitleBreak(code) + } + + effects.consume(code) + return code === 92 ? titleEscape : title + } + + function titleEscape(code) { + if (code === marker || code === 92) { + effects.consume(code) + return title + } + + return title(code) + } +} + +module.exports = titleFactory diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/factory-whitespace.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/factory-whitespace.js new file mode 100644 index 00000000000000..8141e961d3cce9 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/factory-whitespace.js @@ -0,0 +1,32 @@ +'use strict' + +var markdownLineEnding = require('../character/markdown-line-ending.js') +var markdownSpace = require('../character/markdown-space.js') +var factorySpace = require('./factory-space.js') + +function whitespaceFactory(effects, ok) { + var seen + return start + + function start(code) { + if (markdownLineEnding(code)) { + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + seen = true + return start + } + + if (markdownSpace(code)) { + return factorySpace( + effects, + start, + seen ? 'linePrefix' : 'lineSuffix' + )(code) + } + + return ok(code) + } +} + +module.exports = whitespaceFactory diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/hard-break-escape.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/hard-break-escape.js new file mode 100644 index 00000000000000..bb49becb517fbe --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/hard-break-escape.js @@ -0,0 +1,31 @@ +'use strict' + +var markdownLineEnding = require('../character/markdown-line-ending.js') + +var hardBreakEscape = { + name: 'hardBreakEscape', + tokenize: tokenizeHardBreakEscape +} + +function tokenizeHardBreakEscape(effects, ok, nok) { + return start + + function start(code) { + effects.enter('hardBreakEscape') + effects.enter('escapeMarker') + effects.consume(code) + return open + } + + function open(code) { + if (markdownLineEnding(code)) { + effects.exit('escapeMarker') + effects.exit('hardBreakEscape') + return ok(code) + } + + return nok(code) + } +} + +module.exports = hardBreakEscape diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/heading-atx.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/heading-atx.js new file mode 100644 index 00000000000000..8d8514ba03b68e --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/heading-atx.js @@ -0,0 +1,129 @@ +'use strict' + +var markdownLineEnding = require('../character/markdown-line-ending.js') +var markdownLineEndingOrSpace = require('../character/markdown-line-ending-or-space.js') +var markdownSpace = require('../character/markdown-space.js') +var chunkedSplice = require('../util/chunked-splice.js') +var factorySpace = require('./factory-space.js') + +var headingAtx = { + name: 'headingAtx', + tokenize: tokenizeHeadingAtx, + resolve: resolveHeadingAtx +} + +function resolveHeadingAtx(events, context) { + var contentEnd = events.length - 2 + var contentStart = 3 + var content + var text // Prefix whitespace, part of the opening. + + if (events[contentStart][1].type === 'whitespace') { + contentStart += 2 + } // Suffix whitespace, part of the closing. + + if ( + contentEnd - 2 > contentStart && + events[contentEnd][1].type === 'whitespace' + ) { + contentEnd -= 2 + } + + if ( + events[contentEnd][1].type === 'atxHeadingSequence' && + (contentStart === contentEnd - 1 || + (contentEnd - 4 > contentStart && + events[contentEnd - 2][1].type === 'whitespace')) + ) { + contentEnd -= contentStart + 1 === contentEnd ? 2 : 4 + } + + if (contentEnd > contentStart) { + content = { + type: 'atxHeadingText', + start: events[contentStart][1].start, + end: events[contentEnd][1].end + } + text = { + type: 'chunkText', + start: events[contentStart][1].start, + end: events[contentEnd][1].end, + contentType: 'text' + } + chunkedSplice(events, contentStart, contentEnd - contentStart + 1, [ + ['enter', content, context], + ['enter', text, context], + ['exit', text, context], + ['exit', content, context] + ]) + } + + return events +} + +function tokenizeHeadingAtx(effects, ok, nok) { + var self = this + var size = 0 + return start + + function start(code) { + effects.enter('atxHeading') + effects.enter('atxHeadingSequence') + return fenceOpenInside(code) + } + + function fenceOpenInside(code) { + if (code === 35 && size++ < 6) { + effects.consume(code) + return fenceOpenInside + } + + if (code === null || markdownLineEndingOrSpace(code)) { + effects.exit('atxHeadingSequence') + return self.interrupt ? ok(code) : headingBreak(code) + } + + return nok(code) + } + + function headingBreak(code) { + if (code === 35) { + effects.enter('atxHeadingSequence') + return sequence(code) + } + + if (code === null || markdownLineEnding(code)) { + effects.exit('atxHeading') + return ok(code) + } + + if (markdownSpace(code)) { + return factorySpace(effects, headingBreak, 'whitespace')(code) + } + + effects.enter('atxHeadingText') + return data(code) + } + + function sequence(code) { + if (code === 35) { + effects.consume(code) + return sequence + } + + effects.exit('atxHeadingSequence') + return headingBreak(code) + } + + function data(code) { + if (code === null || code === 35 || markdownLineEndingOrSpace(code)) { + effects.exit('atxHeadingText') + return headingBreak(code) + } + + effects.consume(code) + return data + } +} + +module.exports = headingAtx diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/html-flow.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/html-flow.js new file mode 100644 index 00000000000000..dc604bf71b4298 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/html-flow.js @@ -0,0 +1,486 @@ +'use strict' + +var asciiAlpha = require('../character/ascii-alpha.js') +var asciiAlphanumeric = require('../character/ascii-alphanumeric.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var markdownLineEndingOrSpace = require('../character/markdown-line-ending-or-space.js') +var markdownSpace = require('../character/markdown-space.js') +var fromCharCode = require('../constant/from-char-code.js') +var htmlBlockNames = require('../constant/html-block-names.js') +var htmlRawNames = require('../constant/html-raw-names.js') +var partialBlankLine = require('./partial-blank-line.js') + +var htmlFlow = { + name: 'htmlFlow', + tokenize: tokenizeHtmlFlow, + resolveTo: resolveToHtmlFlow, + concrete: true +} +var nextBlankConstruct = { + tokenize: tokenizeNextBlank, + partial: true +} + +function resolveToHtmlFlow(events) { + var index = events.length + + while (index--) { + if (events[index][0] === 'enter' && events[index][1].type === 'htmlFlow') { + break + } + } + + if (index > 1 && events[index - 2][1].type === 'linePrefix') { + // Add the prefix start to the HTML token. + events[index][1].start = events[index - 2][1].start // Add the prefix start to the HTML line token. + + events[index + 1][1].start = events[index - 2][1].start // Remove the line prefix. + + events.splice(index - 2, 2) + } + + return events +} + +function tokenizeHtmlFlow(effects, ok, nok) { + var self = this + var kind + var startTag + var buffer + var index + var marker + return start + + function start(code) { + effects.enter('htmlFlow') + effects.enter('htmlFlowData') + effects.consume(code) + return open + } + + function open(code) { + if (code === 33) { + effects.consume(code) + return declarationStart + } + + if (code === 47) { + effects.consume(code) + return tagCloseStart + } + + if (code === 63) { + effects.consume(code) + kind = 3 // While we’re in an instruction instead of a declaration, we’re on a `?` + // right now, so we do need to search for `>`, similar to declarations. + + return self.interrupt ? ok : continuationDeclarationInside + } + + if (asciiAlpha(code)) { + effects.consume(code) + buffer = fromCharCode(code) + startTag = true + return tagName + } + + return nok(code) + } + + function declarationStart(code) { + if (code === 45) { + effects.consume(code) + kind = 2 + return commentOpenInside + } + + if (code === 91) { + effects.consume(code) + kind = 5 + buffer = 'CDATA[' + index = 0 + return cdataOpenInside + } + + if (asciiAlpha(code)) { + effects.consume(code) + kind = 4 + return self.interrupt ? ok : continuationDeclarationInside + } + + return nok(code) + } + + function commentOpenInside(code) { + if (code === 45) { + effects.consume(code) + return self.interrupt ? ok : continuationDeclarationInside + } + + return nok(code) + } + + function cdataOpenInside(code) { + if (code === buffer.charCodeAt(index++)) { + effects.consume(code) + return index === buffer.length + ? self.interrupt + ? ok + : continuation + : cdataOpenInside + } + + return nok(code) + } + + function tagCloseStart(code) { + if (asciiAlpha(code)) { + effects.consume(code) + buffer = fromCharCode(code) + return tagName + } + + return nok(code) + } + + function tagName(code) { + if ( + code === null || + code === 47 || + code === 62 || + markdownLineEndingOrSpace(code) + ) { + if ( + code !== 47 && + startTag && + htmlRawNames.indexOf(buffer.toLowerCase()) > -1 + ) { + kind = 1 + return self.interrupt ? ok(code) : continuation(code) + } + + if (htmlBlockNames.indexOf(buffer.toLowerCase()) > -1) { + kind = 6 + + if (code === 47) { + effects.consume(code) + return basicSelfClosing + } + + return self.interrupt ? ok(code) : continuation(code) + } + + kind = 7 // Do not support complete HTML when interrupting. + + return self.interrupt + ? nok(code) + : startTag + ? completeAttributeNameBefore(code) + : completeClosingTagAfter(code) + } + + if (code === 45 || asciiAlphanumeric(code)) { + effects.consume(code) + buffer += fromCharCode(code) + return tagName + } + + return nok(code) + } + + function basicSelfClosing(code) { + if (code === 62) { + effects.consume(code) + return self.interrupt ? ok : continuation + } + + return nok(code) + } + + function completeClosingTagAfter(code) { + if (markdownSpace(code)) { + effects.consume(code) + return completeClosingTagAfter + } + + return completeEnd(code) + } + + function completeAttributeNameBefore(code) { + if (code === 47) { + effects.consume(code) + return completeEnd + } + + if (code === 58 || code === 95 || asciiAlpha(code)) { + effects.consume(code) + return completeAttributeName + } + + if (markdownSpace(code)) { + effects.consume(code) + return completeAttributeNameBefore + } + + return completeEnd(code) + } + + function completeAttributeName(code) { + if ( + code === 45 || + code === 46 || + code === 58 || + code === 95 || + asciiAlphanumeric(code) + ) { + effects.consume(code) + return completeAttributeName + } + + return completeAttributeNameAfter(code) + } + + function completeAttributeNameAfter(code) { + if (code === 61) { + effects.consume(code) + return completeAttributeValueBefore + } + + if (markdownSpace(code)) { + effects.consume(code) + return completeAttributeNameAfter + } + + return completeAttributeNameBefore(code) + } + + function completeAttributeValueBefore(code) { + if ( + code === null || + code === 60 || + code === 61 || + code === 62 || + code === 96 + ) { + return nok(code) + } + + if (code === 34 || code === 39) { + effects.consume(code) + marker = code + return completeAttributeValueQuoted + } + + if (markdownSpace(code)) { + effects.consume(code) + return completeAttributeValueBefore + } + + marker = undefined + return completeAttributeValueUnquoted(code) + } + + function completeAttributeValueQuoted(code) { + if (code === marker) { + effects.consume(code) + return completeAttributeValueQuotedAfter + } + + if (code === null || markdownLineEnding(code)) { + return nok(code) + } + + effects.consume(code) + return completeAttributeValueQuoted + } + + function completeAttributeValueUnquoted(code) { + if ( + code === null || + code === 34 || + code === 39 || + code === 60 || + code === 61 || + code === 62 || + code === 96 || + markdownLineEndingOrSpace(code) + ) { + return completeAttributeNameAfter(code) + } + + effects.consume(code) + return completeAttributeValueUnquoted + } + + function completeAttributeValueQuotedAfter(code) { + if (code === 47 || code === 62 || markdownSpace(code)) { + return completeAttributeNameBefore(code) + } + + return nok(code) + } + + function completeEnd(code) { + if (code === 62) { + effects.consume(code) + return completeAfter + } + + return nok(code) + } + + function completeAfter(code) { + if (markdownSpace(code)) { + effects.consume(code) + return completeAfter + } + + return code === null || markdownLineEnding(code) + ? continuation(code) + : nok(code) + } + + function continuation(code) { + if (code === 45 && kind === 2) { + effects.consume(code) + return continuationCommentInside + } + + if (code === 60 && kind === 1) { + effects.consume(code) + return continuationRawTagOpen + } + + if (code === 62 && kind === 4) { + effects.consume(code) + return continuationClose + } + + if (code === 63 && kind === 3) { + effects.consume(code) + return continuationDeclarationInside + } + + if (code === 93 && kind === 5) { + effects.consume(code) + return continuationCharacterDataInside + } + + if (markdownLineEnding(code) && (kind === 6 || kind === 7)) { + return effects.check( + nextBlankConstruct, + continuationClose, + continuationAtLineEnding + )(code) + } + + if (code === null || markdownLineEnding(code)) { + return continuationAtLineEnding(code) + } + + effects.consume(code) + return continuation + } + + function continuationAtLineEnding(code) { + effects.exit('htmlFlowData') + return htmlContinueStart(code) + } + + function htmlContinueStart(code) { + if (code === null) { + return done(code) + } + + if (markdownLineEnding(code)) { + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return htmlContinueStart + } + + effects.enter('htmlFlowData') + return continuation(code) + } + + function continuationCommentInside(code) { + if (code === 45) { + effects.consume(code) + return continuationDeclarationInside + } + + return continuation(code) + } + + function continuationRawTagOpen(code) { + if (code === 47) { + effects.consume(code) + buffer = '' + return continuationRawEndTag + } + + return continuation(code) + } + + function continuationRawEndTag(code) { + if (code === 62 && htmlRawNames.indexOf(buffer.toLowerCase()) > -1) { + effects.consume(code) + return continuationClose + } + + if (asciiAlpha(code) && buffer.length < 8) { + effects.consume(code) + buffer += fromCharCode(code) + return continuationRawEndTag + } + + return continuation(code) + } + + function continuationCharacterDataInside(code) { + if (code === 93) { + effects.consume(code) + return continuationDeclarationInside + } + + return continuation(code) + } + + function continuationDeclarationInside(code) { + if (code === 62) { + effects.consume(code) + return continuationClose + } + + return continuation(code) + } + + function continuationClose(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit('htmlFlowData') + return done(code) + } + + effects.consume(code) + return continuationClose + } + + function done(code) { + effects.exit('htmlFlow') + return ok(code) + } +} + +function tokenizeNextBlank(effects, ok, nok) { + return start + + function start(code) { + effects.exit('htmlFlowData') + effects.enter('lineEndingBlank') + effects.consume(code) + effects.exit('lineEndingBlank') + return effects.attempt(partialBlankLine, ok, nok) + } +} + +module.exports = htmlFlow diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/html-text.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/html-text.js new file mode 100644 index 00000000000000..92d1eeeccdfc8e --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/html-text.js @@ -0,0 +1,435 @@ +'use strict' + +var asciiAlpha = require('../character/ascii-alpha.js') +var asciiAlphanumeric = require('../character/ascii-alphanumeric.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var markdownLineEndingOrSpace = require('../character/markdown-line-ending-or-space.js') +var markdownSpace = require('../character/markdown-space.js') +var factorySpace = require('./factory-space.js') + +var htmlText = { + name: 'htmlText', + tokenize: tokenizeHtmlText +} + +function tokenizeHtmlText(effects, ok, nok) { + var self = this + var marker + var buffer + var index + var returnState + return start + + function start(code) { + effects.enter('htmlText') + effects.enter('htmlTextData') + effects.consume(code) + return open + } + + function open(code) { + if (code === 33) { + effects.consume(code) + return declarationOpen + } + + if (code === 47) { + effects.consume(code) + return tagCloseStart + } + + if (code === 63) { + effects.consume(code) + return instruction + } + + if (asciiAlpha(code)) { + effects.consume(code) + return tagOpen + } + + return nok(code) + } + + function declarationOpen(code) { + if (code === 45) { + effects.consume(code) + return commentOpen + } + + if (code === 91) { + effects.consume(code) + buffer = 'CDATA[' + index = 0 + return cdataOpen + } + + if (asciiAlpha(code)) { + effects.consume(code) + return declaration + } + + return nok(code) + } + + function commentOpen(code) { + if (code === 45) { + effects.consume(code) + return commentStart + } + + return nok(code) + } + + function commentStart(code) { + if (code === null || code === 62) { + return nok(code) + } + + if (code === 45) { + effects.consume(code) + return commentStartDash + } + + return comment(code) + } + + function commentStartDash(code) { + if (code === null || code === 62) { + return nok(code) + } + + return comment(code) + } + + function comment(code) { + if (code === null) { + return nok(code) + } + + if (code === 45) { + effects.consume(code) + return commentClose + } + + if (markdownLineEnding(code)) { + returnState = comment + return atLineEnding(code) + } + + effects.consume(code) + return comment + } + + function commentClose(code) { + if (code === 45) { + effects.consume(code) + return end + } + + return comment(code) + } + + function cdataOpen(code) { + if (code === buffer.charCodeAt(index++)) { + effects.consume(code) + return index === buffer.length ? cdata : cdataOpen + } + + return nok(code) + } + + function cdata(code) { + if (code === null) { + return nok(code) + } + + if (code === 93) { + effects.consume(code) + return cdataClose + } + + if (markdownLineEnding(code)) { + returnState = cdata + return atLineEnding(code) + } + + effects.consume(code) + return cdata + } + + function cdataClose(code) { + if (code === 93) { + effects.consume(code) + return cdataEnd + } + + return cdata(code) + } + + function cdataEnd(code) { + if (code === 62) { + return end(code) + } + + if (code === 93) { + effects.consume(code) + return cdataEnd + } + + return cdata(code) + } + + function declaration(code) { + if (code === null || code === 62) { + return end(code) + } + + if (markdownLineEnding(code)) { + returnState = declaration + return atLineEnding(code) + } + + effects.consume(code) + return declaration + } + + function instruction(code) { + if (code === null) { + return nok(code) + } + + if (code === 63) { + effects.consume(code) + return instructionClose + } + + if (markdownLineEnding(code)) { + returnState = instruction + return atLineEnding(code) + } + + effects.consume(code) + return instruction + } + + function instructionClose(code) { + return code === 62 ? end(code) : instruction(code) + } + + function tagCloseStart(code) { + if (asciiAlpha(code)) { + effects.consume(code) + return tagClose + } + + return nok(code) + } + + function tagClose(code) { + if (code === 45 || asciiAlphanumeric(code)) { + effects.consume(code) + return tagClose + } + + return tagCloseBetween(code) + } + + function tagCloseBetween(code) { + if (markdownLineEnding(code)) { + returnState = tagCloseBetween + return atLineEnding(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagCloseBetween + } + + return end(code) + } + + function tagOpen(code) { + if (code === 45 || asciiAlphanumeric(code)) { + effects.consume(code) + return tagOpen + } + + if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { + return tagOpenBetween(code) + } + + return nok(code) + } + + function tagOpenBetween(code) { + if (code === 47) { + effects.consume(code) + return end + } + + if (code === 58 || code === 95 || asciiAlpha(code)) { + effects.consume(code) + return tagOpenAttributeName + } + + if (markdownLineEnding(code)) { + returnState = tagOpenBetween + return atLineEnding(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagOpenBetween + } + + return end(code) + } + + function tagOpenAttributeName(code) { + if ( + code === 45 || + code === 46 || + code === 58 || + code === 95 || + asciiAlphanumeric(code) + ) { + effects.consume(code) + return tagOpenAttributeName + } + + return tagOpenAttributeNameAfter(code) + } + + function tagOpenAttributeNameAfter(code) { + if (code === 61) { + effects.consume(code) + return tagOpenAttributeValueBefore + } + + if (markdownLineEnding(code)) { + returnState = tagOpenAttributeNameAfter + return atLineEnding(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagOpenAttributeNameAfter + } + + return tagOpenBetween(code) + } + + function tagOpenAttributeValueBefore(code) { + if ( + code === null || + code === 60 || + code === 61 || + code === 62 || + code === 96 + ) { + return nok(code) + } + + if (code === 34 || code === 39) { + effects.consume(code) + marker = code + return tagOpenAttributeValueQuoted + } + + if (markdownLineEnding(code)) { + returnState = tagOpenAttributeValueBefore + return atLineEnding(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagOpenAttributeValueBefore + } + + effects.consume(code) + marker = undefined + return tagOpenAttributeValueUnquoted + } + + function tagOpenAttributeValueQuoted(code) { + if (code === marker) { + effects.consume(code) + return tagOpenAttributeValueQuotedAfter + } + + if (code === null) { + return nok(code) + } + + if (markdownLineEnding(code)) { + returnState = tagOpenAttributeValueQuoted + return atLineEnding(code) + } + + effects.consume(code) + return tagOpenAttributeValueQuoted + } + + function tagOpenAttributeValueQuotedAfter(code) { + if (code === 62 || code === 47 || markdownLineEndingOrSpace(code)) { + return tagOpenBetween(code) + } + + return nok(code) + } + + function tagOpenAttributeValueUnquoted(code) { + if ( + code === null || + code === 34 || + code === 39 || + code === 60 || + code === 61 || + code === 96 + ) { + return nok(code) + } + + if (code === 62 || markdownLineEndingOrSpace(code)) { + return tagOpenBetween(code) + } + + effects.consume(code) + return tagOpenAttributeValueUnquoted + } // We can’t have blank lines in content, so no need to worry about empty + // tokens. + + function atLineEnding(code) { + effects.exit('htmlTextData') + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return factorySpace( + effects, + afterPrefix, + 'linePrefix', + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + ) + } + + function afterPrefix(code) { + effects.enter('htmlTextData') + return returnState(code) + } + + function end(code) { + if (code === 62) { + effects.consume(code) + effects.exit('htmlTextData') + effects.exit('htmlText') + return ok + } + + return nok(code) + } +} + +module.exports = htmlText diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/label-end.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/label-end.js new file mode 100644 index 00000000000000..9e8ffce8c8a13c --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/label-end.js @@ -0,0 +1,330 @@ +'use strict' + +var markdownLineEndingOrSpace = require('../character/markdown-line-ending-or-space.js') +var chunkedPush = require('../util/chunked-push.js') +var chunkedSplice = require('../util/chunked-splice.js') +var normalizeIdentifier = require('../util/normalize-identifier.js') +var resolveAll = require('../util/resolve-all.js') +var shallow = require('../util/shallow.js') +var factoryDestination = require('./factory-destination.js') +var factoryLabel = require('./factory-label.js') +var factoryTitle = require('./factory-title.js') +var factoryWhitespace = require('./factory-whitespace.js') + +var labelEnd = { + name: 'labelEnd', + tokenize: tokenizeLabelEnd, + resolveTo: resolveToLabelEnd, + resolveAll: resolveAllLabelEnd +} +var resourceConstruct = { + tokenize: tokenizeResource +} +var fullReferenceConstruct = { + tokenize: tokenizeFullReference +} +var collapsedReferenceConstruct = { + tokenize: tokenizeCollapsedReference +} + +function resolveAllLabelEnd(events) { + var index = -1 + var token + + while (++index < events.length) { + token = events[index][1] + + if ( + !token._used && + (token.type === 'labelImage' || + token.type === 'labelLink' || + token.type === 'labelEnd') + ) { + // Remove the marker. + events.splice(index + 1, token.type === 'labelImage' ? 4 : 2) + token.type = 'data' + index++ + } + } + + return events +} + +function resolveToLabelEnd(events, context) { + var index = events.length + var offset = 0 + var group + var label + var text + var token + var open + var close + var media // Find an opening. + + while (index--) { + token = events[index][1] + + if (open) { + // If we see another link, or inactive link label, we’ve been here before. + if ( + token.type === 'link' || + (token.type === 'labelLink' && token._inactive) + ) { + break + } // Mark other link openings as inactive, as we can’t have links in + // links. + + if (events[index][0] === 'enter' && token.type === 'labelLink') { + token._inactive = true + } + } else if (close) { + if ( + events[index][0] === 'enter' && + (token.type === 'labelImage' || token.type === 'labelLink') && + !token._balanced + ) { + open = index + + if (token.type !== 'labelLink') { + offset = 2 + break + } + } + } else if (token.type === 'labelEnd') { + close = index + } + } + + group = { + type: events[open][1].type === 'labelLink' ? 'link' : 'image', + start: shallow(events[open][1].start), + end: shallow(events[events.length - 1][1].end) + } + label = { + type: 'label', + start: shallow(events[open][1].start), + end: shallow(events[close][1].end) + } + text = { + type: 'labelText', + start: shallow(events[open + offset + 2][1].end), + end: shallow(events[close - 2][1].start) + } + media = [ + ['enter', group, context], + ['enter', label, context] + ] // Opening marker. + + media = chunkedPush(media, events.slice(open + 1, open + offset + 3)) // Text open. + + media = chunkedPush(media, [['enter', text, context]]) // Between. + + media = chunkedPush( + media, + resolveAll( + context.parser.constructs.insideSpan.null, + events.slice(open + offset + 4, close - 3), + context + ) + ) // Text close, marker close, label close. + + media = chunkedPush(media, [ + ['exit', text, context], + events[close - 2], + events[close - 1], + ['exit', label, context] + ]) // Reference, resource, or so. + + media = chunkedPush(media, events.slice(close + 1)) // Media close. + + media = chunkedPush(media, [['exit', group, context]]) + chunkedSplice(events, open, events.length, media) + return events +} + +function tokenizeLabelEnd(effects, ok, nok) { + var self = this + var index = self.events.length + var labelStart + var defined // Find an opening. + + while (index--) { + if ( + (self.events[index][1].type === 'labelImage' || + self.events[index][1].type === 'labelLink') && + !self.events[index][1]._balanced + ) { + labelStart = self.events[index][1] + break + } + } + + return start + + function start(code) { + if (!labelStart) { + return nok(code) + } // It’s a balanced bracket, but contains a link. + + if (labelStart._inactive) return balanced(code) + defined = + self.parser.defined.indexOf( + normalizeIdentifier( + self.sliceSerialize({ + start: labelStart.end, + end: self.now() + }) + ) + ) > -1 + effects.enter('labelEnd') + effects.enter('labelMarker') + effects.consume(code) + effects.exit('labelMarker') + effects.exit('labelEnd') + return afterLabelEnd + } + + function afterLabelEnd(code) { + // Resource: `[asd](fgh)`. + if (code === 40) { + return effects.attempt( + resourceConstruct, + ok, + defined ? ok : balanced + )(code) + } // Collapsed (`[asd][]`) or full (`[asd][fgh]`) reference? + + if (code === 91) { + return effects.attempt( + fullReferenceConstruct, + ok, + defined + ? effects.attempt(collapsedReferenceConstruct, ok, balanced) + : balanced + )(code) + } // Shortcut reference: `[asd]`? + + return defined ? ok(code) : balanced(code) + } + + function balanced(code) { + labelStart._balanced = true + return nok(code) + } +} + +function tokenizeResource(effects, ok, nok) { + return start + + function start(code) { + effects.enter('resource') + effects.enter('resourceMarker') + effects.consume(code) + effects.exit('resourceMarker') + return factoryWhitespace(effects, open) + } + + function open(code) { + if (code === 41) { + return end(code) + } + + return factoryDestination( + effects, + destinationAfter, + nok, + 'resourceDestination', + 'resourceDestinationLiteral', + 'resourceDestinationLiteralMarker', + 'resourceDestinationRaw', + 'resourceDestinationString', + 3 + )(code) + } + + function destinationAfter(code) { + return markdownLineEndingOrSpace(code) + ? factoryWhitespace(effects, between)(code) + : end(code) + } + + function between(code) { + if (code === 34 || code === 39 || code === 40) { + return factoryTitle( + effects, + factoryWhitespace(effects, end), + nok, + 'resourceTitle', + 'resourceTitleMarker', + 'resourceTitleString' + )(code) + } + + return end(code) + } + + function end(code) { + if (code === 41) { + effects.enter('resourceMarker') + effects.consume(code) + effects.exit('resourceMarker') + effects.exit('resource') + return ok + } + + return nok(code) + } +} + +function tokenizeFullReference(effects, ok, nok) { + var self = this + return start + + function start(code) { + return factoryLabel.call( + self, + effects, + afterLabel, + nok, + 'reference', + 'referenceMarker', + 'referenceString' + )(code) + } + + function afterLabel(code) { + return self.parser.defined.indexOf( + normalizeIdentifier( + self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) + ) + ) < 0 + ? nok(code) + : ok(code) + } +} + +function tokenizeCollapsedReference(effects, ok, nok) { + return start + + function start(code) { + effects.enter('reference') + effects.enter('referenceMarker') + effects.consume(code) + effects.exit('referenceMarker') + return open + } + + function open(code) { + if (code === 93) { + effects.enter('referenceMarker') + effects.consume(code) + effects.exit('referenceMarker') + effects.exit('reference') + return ok + } + + return nok(code) + } +} + +module.exports = labelEnd diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/label-start-image.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/label-start-image.js new file mode 100644 index 00000000000000..90bc3d90dd5a88 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/label-start-image.js @@ -0,0 +1,46 @@ +'use strict' + +var labelEnd = require('./label-end.js') + +var labelStartImage = { + name: 'labelStartImage', + tokenize: tokenizeLabelStartImage, + resolveAll: labelEnd.resolveAll +} + +function tokenizeLabelStartImage(effects, ok, nok) { + var self = this + return start + + function start(code) { + effects.enter('labelImage') + effects.enter('labelImageMarker') + effects.consume(code) + effects.exit('labelImageMarker') + return open + } + + function open(code) { + if (code === 91) { + effects.enter('labelMarker') + effects.consume(code) + effects.exit('labelMarker') + effects.exit('labelImage') + return after + } + + return nok(code) + } + + function after(code) { + /* c8 ignore next */ + return code === 94 && + /* c8 ignore next */ + '_hiddenFootnoteSupport' in self.parser.constructs + ? /* c8 ignore next */ + nok(code) + : ok(code) + } +} + +module.exports = labelStartImage diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/label-start-link.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/label-start-link.js new file mode 100644 index 00000000000000..22942059979103 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/label-start-link.js @@ -0,0 +1,35 @@ +'use strict' + +var labelEnd = require('./label-end.js') + +var labelStartLink = { + name: 'labelStartLink', + tokenize: tokenizeLabelStartLink, + resolveAll: labelEnd.resolveAll +} + +function tokenizeLabelStartLink(effects, ok, nok) { + var self = this + return start + + function start(code) { + effects.enter('labelLink') + effects.enter('labelMarker') + effects.consume(code) + effects.exit('labelMarker') + effects.exit('labelLink') + return after + } + + function after(code) { + /* c8 ignore next */ + return code === 94 && + /* c8 ignore next */ + '_hiddenFootnoteSupport' in self.parser.constructs + ? /* c8 ignore next */ + nok(code) + : ok(code) + } +} + +module.exports = labelStartLink diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/line-ending.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/line-ending.js new file mode 100644 index 00000000000000..d381f6dc895088 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/line-ending.js @@ -0,0 +1,21 @@ +'use strict' + +var factorySpace = require('./factory-space.js') + +var lineEnding = { + name: 'lineEnding', + tokenize: tokenizeLineEnding +} + +function tokenizeLineEnding(effects, ok) { + return start + + function start(code) { + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return factorySpace(effects, ok, 'linePrefix') + } +} + +module.exports = lineEnding diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/list.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/list.js new file mode 100644 index 00000000000000..21f14c37b2db87 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/list.js @@ -0,0 +1,214 @@ +'use strict' + +var asciiDigit = require('../character/ascii-digit.js') +var markdownSpace = require('../character/markdown-space.js') +var prefixSize = require('../util/prefix-size.js') +var sizeChunks = require('../util/size-chunks.js') +var factorySpace = require('./factory-space.js') +var partialBlankLine = require('./partial-blank-line.js') +var thematicBreak = require('./thematic-break.js') + +var list = { + name: 'list', + tokenize: tokenizeListStart, + continuation: { + tokenize: tokenizeListContinuation + }, + exit: tokenizeListEnd +} +var listItemPrefixWhitespaceConstruct = { + tokenize: tokenizeListItemPrefixWhitespace, + partial: true +} +var indentConstruct = { + tokenize: tokenizeIndent, + partial: true +} + +function tokenizeListStart(effects, ok, nok) { + var self = this + var initialSize = prefixSize(self.events, 'linePrefix') + var size = 0 + return start + + function start(code) { + var kind = + self.containerState.type || + (code === 42 || code === 43 || code === 45 + ? 'listUnordered' + : 'listOrdered') + + if ( + kind === 'listUnordered' + ? !self.containerState.marker || code === self.containerState.marker + : asciiDigit(code) + ) { + if (!self.containerState.type) { + self.containerState.type = kind + effects.enter(kind, { + _container: true + }) + } + + if (kind === 'listUnordered') { + effects.enter('listItemPrefix') + return code === 42 || code === 45 + ? effects.check(thematicBreak, nok, atMarker)(code) + : atMarker(code) + } + + if (!self.interrupt || code === 49) { + effects.enter('listItemPrefix') + effects.enter('listItemValue') + return inside(code) + } + } + + return nok(code) + } + + function inside(code) { + if (asciiDigit(code) && ++size < 10) { + effects.consume(code) + return inside + } + + if ( + (!self.interrupt || size < 2) && + (self.containerState.marker + ? code === self.containerState.marker + : code === 41 || code === 46) + ) { + effects.exit('listItemValue') + return atMarker(code) + } + + return nok(code) + } + + function atMarker(code) { + effects.enter('listItemMarker') + effects.consume(code) + effects.exit('listItemMarker') + self.containerState.marker = self.containerState.marker || code + return effects.check( + partialBlankLine, // Can’t be empty when interrupting. + self.interrupt ? nok : onBlank, + effects.attempt( + listItemPrefixWhitespaceConstruct, + endOfPrefix, + otherPrefix + ) + ) + } + + function onBlank(code) { + self.containerState.initialBlankLine = true + initialSize++ + return endOfPrefix(code) + } + + function otherPrefix(code) { + if (markdownSpace(code)) { + effects.enter('listItemPrefixWhitespace') + effects.consume(code) + effects.exit('listItemPrefixWhitespace') + return endOfPrefix + } + + return nok(code) + } + + function endOfPrefix(code) { + self.containerState.size = + initialSize + sizeChunks(self.sliceStream(effects.exit('listItemPrefix'))) + return ok(code) + } +} + +function tokenizeListContinuation(effects, ok, nok) { + var self = this + self.containerState._closeFlow = undefined + return effects.check(partialBlankLine, onBlank, notBlank) + + function onBlank(code) { + self.containerState.furtherBlankLines = + self.containerState.furtherBlankLines || + self.containerState.initialBlankLine // We have a blank line. + // Still, try to consume at most the items size. + + return factorySpace( + effects, + ok, + 'listItemIndent', + self.containerState.size + 1 + )(code) + } + + function notBlank(code) { + if (self.containerState.furtherBlankLines || !markdownSpace(code)) { + self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined + return notInCurrentItem(code) + } + + self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined + return effects.attempt(indentConstruct, ok, notInCurrentItem)(code) + } + + function notInCurrentItem(code) { + // While we do continue, we signal that the flow should be closed. + self.containerState._closeFlow = true // As we’re closing flow, we’re no longer interrupting. + + self.interrupt = undefined + return factorySpace( + effects, + effects.attempt(list, ok, nok), + 'linePrefix', + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + )(code) + } +} + +function tokenizeIndent(effects, ok, nok) { + var self = this + return factorySpace( + effects, + afterPrefix, + 'listItemIndent', + self.containerState.size + 1 + ) + + function afterPrefix(code) { + return prefixSize(self.events, 'listItemIndent') === + self.containerState.size + ? ok(code) + : nok(code) + } +} + +function tokenizeListEnd(effects) { + effects.exit(this.containerState.type) +} + +function tokenizeListItemPrefixWhitespace(effects, ok, nok) { + var self = this + return factorySpace( + effects, + afterPrefix, + 'listItemPrefixWhitespace', + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + 1 + ) + + function afterPrefix(code) { + return markdownSpace(code) || + !prefixSize(self.events, 'listItemPrefixWhitespace') + ? nok(code) + : ok(code) + } +} + +module.exports = list diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/partial-blank-line.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/partial-blank-line.js new file mode 100644 index 00000000000000..b5207df20695d9 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/partial-blank-line.js @@ -0,0 +1,19 @@ +'use strict' + +var markdownLineEnding = require('../character/markdown-line-ending.js') +var factorySpace = require('./factory-space.js') + +var partialBlankLine = { + tokenize: tokenizePartialBlankLine, + partial: true +} + +function tokenizePartialBlankLine(effects, ok, nok) { + return factorySpace(effects, afterWhitespace, 'linePrefix') + + function afterWhitespace(code) { + return code === null || markdownLineEnding(code) ? ok(code) : nok(code) + } +} + +module.exports = partialBlankLine diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/setext-underline.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/setext-underline.js new file mode 100644 index 00000000000000..4f2770707ca986 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/setext-underline.js @@ -0,0 +1,117 @@ +'use strict' + +var markdownLineEnding = require('../character/markdown-line-ending.js') +var shallow = require('../util/shallow.js') +var factorySpace = require('./factory-space.js') + +var setextUnderline = { + name: 'setextUnderline', + tokenize: tokenizeSetextUnderline, + resolveTo: resolveToSetextUnderline +} + +function resolveToSetextUnderline(events, context) { + var index = events.length + var content + var text + var definition + var heading // Find the opening of the content. + // It’ll always exist: we don’t tokenize if it isn’t there. + + while (index--) { + if (events[index][0] === 'enter') { + if (events[index][1].type === 'content') { + content = index + break + } + + if (events[index][1].type === 'paragraph') { + text = index + } + } // Exit + else { + if (events[index][1].type === 'content') { + // Remove the content end (if needed we’ll add it later) + events.splice(index, 1) + } + + if (!definition && events[index][1].type === 'definition') { + definition = index + } + } + } + + heading = { + type: 'setextHeading', + start: shallow(events[text][1].start), + end: shallow(events[events.length - 1][1].end) + } // Change the paragraph to setext heading text. + + events[text][1].type = 'setextHeadingText' // If we have definitions in the content, we’ll keep on having content, + // but we need move it. + + if (definition) { + events.splice(text, 0, ['enter', heading, context]) + events.splice(definition + 1, 0, ['exit', events[content][1], context]) + events[content][1].end = shallow(events[definition][1].end) + } else { + events[content][1] = heading + } // Add the heading exit at the end. + + events.push(['exit', heading, context]) + return events +} + +function tokenizeSetextUnderline(effects, ok, nok) { + var self = this + var index = self.events.length + var marker + var paragraph // Find an opening. + + while (index--) { + // Skip enter/exit of line ending, line prefix, and content. + // We can now either have a definition or a paragraph. + if ( + self.events[index][1].type !== 'lineEnding' && + self.events[index][1].type !== 'linePrefix' && + self.events[index][1].type !== 'content' + ) { + paragraph = self.events[index][1].type === 'paragraph' + break + } + } + + return start + + function start(code) { + if (!self.lazy && (self.interrupt || paragraph)) { + effects.enter('setextHeadingLine') + effects.enter('setextHeadingLineSequence') + marker = code + return closingSequence(code) + } + + return nok(code) + } + + function closingSequence(code) { + if (code === marker) { + effects.consume(code) + return closingSequence + } + + effects.exit('setextHeadingLineSequence') + return factorySpace(effects, closingSequenceEnd, 'lineSuffix')(code) + } + + function closingSequenceEnd(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit('setextHeadingLine') + return ok(code) + } + + return nok(code) + } +} + +module.exports = setextUnderline diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/thematic-break.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/thematic-break.js new file mode 100644 index 00000000000000..3abbe554e45181 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/tokenize/thematic-break.js @@ -0,0 +1,53 @@ +'use strict' + +var markdownLineEnding = require('../character/markdown-line-ending.js') +var markdownSpace = require('../character/markdown-space.js') +var factorySpace = require('./factory-space.js') + +var thematicBreak = { + name: 'thematicBreak', + tokenize: tokenizeThematicBreak +} + +function tokenizeThematicBreak(effects, ok, nok) { + var size = 0 + var marker + return start + + function start(code) { + effects.enter('thematicBreak') + marker = code + return atBreak(code) + } + + function atBreak(code) { + if (code === marker) { + effects.enter('thematicBreakSequence') + return sequence(code) + } + + if (markdownSpace(code)) { + return factorySpace(effects, atBreak, 'whitespace')(code) + } + + if (size < 3 || (code !== null && !markdownLineEnding(code))) { + return nok(code) + } + + effects.exit('thematicBreak') + return ok(code) + } + + function sequence(code) { + if (code === marker) { + effects.consume(code) + size++ + return sequence + } + + effects.exit('thematicBreakSequence') + return atBreak(code) + } +} + +module.exports = thematicBreak diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/chunked-push.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/chunked-push.js new file mode 100644 index 00000000000000..77689779959fbb --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/chunked-push.js @@ -0,0 +1,14 @@ +'use strict' + +var chunkedSplice = require('./chunked-splice.js') + +function chunkedPush(list, items) { + if (list.length) { + chunkedSplice(list, list.length, 0, items) + return list + } + + return items +} + +module.exports = chunkedPush diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/chunked-splice.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/chunked-splice.js new file mode 100644 index 00000000000000..99525d76a242bb --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/chunked-splice.js @@ -0,0 +1,38 @@ +'use strict' + +var splice = require('../constant/splice.js') + +// causes a stack overflow in V8 when trying to insert 100k items for instance. + +function chunkedSplice(list, start, remove, items) { + var end = list.length + var chunkStart = 0 + var parameters // Make start between zero and `end` (included). + + if (start < 0) { + start = -start > end ? 0 : end + start + } else { + start = start > end ? end : start + } + + remove = remove > 0 ? remove : 0 // No need to chunk the items if there’s only a couple (10k) items. + + if (items.length < 10000) { + parameters = Array.from(items) + parameters.unshift(start, remove) + splice.apply(list, parameters) + } else { + // Delete `remove` items starting from `start` + if (remove) splice.apply(list, [start, remove]) // Insert the items in chunks to not cause stack overflows. + + while (chunkStart < items.length) { + parameters = items.slice(chunkStart, chunkStart + 10000) + parameters.unshift(start, 0) + splice.apply(list, parameters) + chunkStart += 10000 + start += 10000 + } + } +} + +module.exports = chunkedSplice diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/classify-character.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/classify-character.js new file mode 100644 index 00000000000000..9d3b21b96a1acd --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/classify-character.js @@ -0,0 +1,25 @@ +'use strict' + +var markdownLineEndingOrSpace = require('../character/markdown-line-ending-or-space.js') +var unicodePunctuation = require('../character/unicode-punctuation.js') +var unicodeWhitespace = require('../character/unicode-whitespace.js') + +// Classify whether a character is unicode whitespace, unicode punctuation, or +// anything else. +// Used for attention (emphasis, strong), whose sequences can open or close +// based on the class of surrounding characters. +function classifyCharacter(code) { + if ( + code === null || + markdownLineEndingOrSpace(code) || + unicodeWhitespace(code) + ) { + return 1 + } + + if (unicodePunctuation(code)) { + return 2 + } +} + +module.exports = classifyCharacter diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/combine-extensions.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/combine-extensions.js new file mode 100644 index 00000000000000..a6f8f347b8d3bd --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/combine-extensions.js @@ -0,0 +1,49 @@ +'use strict' + +var hasOwnProperty = require('../constant/has-own-property.js') +var chunkedSplice = require('./chunked-splice.js') +var miniflat = require('./miniflat.js') + +function combineExtensions(extensions) { + var all = {} + var index = -1 + + while (++index < extensions.length) { + extension(all, extensions[index]) + } + + return all +} + +function extension(all, extension) { + var hook + var left + var right + var code + + for (hook in extension) { + left = hasOwnProperty.call(all, hook) ? all[hook] : (all[hook] = {}) + right = extension[hook] + + for (code in right) { + left[code] = constructs( + miniflat(right[code]), + hasOwnProperty.call(left, code) ? left[code] : [] + ) + } + } +} + +function constructs(list, existing) { + var index = -1 + var before = [] + + while (++index < list.length) { + ;(list[index].add === 'after' ? existing : before).push(list[index]) + } + + chunkedSplice(existing, 0, 0, before) + return existing +} + +module.exports = combineExtensions diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/combine-html-extensions.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/combine-html-extensions.js new file mode 100644 index 00000000000000..c54258783a7c09 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/combine-html-extensions.js @@ -0,0 +1,34 @@ +'use strict' + +var hasOwnProperty = require('../constant/has-own-property.js') + +function combineHtmlExtensions(extensions) { + var handlers = {} + var index = -1 + + while (++index < extensions.length) { + extension(handlers, extensions[index]) + } + + return handlers +} + +function extension(handlers, extension) { + var hook + var left + var right + var type + + for (hook in extension) { + left = hasOwnProperty.call(handlers, hook) + ? handlers[hook] + : (handlers[hook] = {}) + right = extension[hook] + + for (type in right) { + left[type] = right[type] + } + } +} + +module.exports = combineHtmlExtensions diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/create-tokenizer.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/create-tokenizer.js new file mode 100644 index 00000000000000..9051658c83c3f8 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/create-tokenizer.js @@ -0,0 +1,316 @@ +'use strict' + +var assign = require('../constant/assign.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var chunkedPush = require('./chunked-push.js') +var chunkedSplice = require('./chunked-splice.js') +var miniflat = require('./miniflat.js') +var resolveAll = require('./resolve-all.js') +var serializeChunks = require('./serialize-chunks.js') +var shallow = require('./shallow.js') +var sliceChunks = require('./slice-chunks.js') + +// Create a tokenizer. +// Tokenizers deal with one type of data (e.g., containers, flow, text). +// The parser is the object dealing with it all. +// `initialize` works like other constructs, except that only its `tokenize` +// function is used, in which case it doesn’t receive an `ok` or `nok`. +// `from` can be given to set the point before the first character, although +// when further lines are indented, they must be set with `defineSkip`. +function createTokenizer(parser, initialize, from) { + var point = from + ? shallow(from) + : { + line: 1, + column: 1, + offset: 0 + } + var columnStart = {} + var resolveAllConstructs = [] + var chunks = [] + var stack = [] + + var effects = { + consume: consume, + enter: enter, + exit: exit, + attempt: constructFactory(onsuccessfulconstruct), + check: constructFactory(onsuccessfulcheck), + interrupt: constructFactory(onsuccessfulcheck, { + interrupt: true + }), + lazy: constructFactory(onsuccessfulcheck, { + lazy: true + }) + } // State and tools for resolving and serializing. + + var context = { + previous: null, + events: [], + parser: parser, + sliceStream: sliceStream, + sliceSerialize: sliceSerialize, + now: now, + defineSkip: skip, + write: write + } // The state function. + + var state = initialize.tokenize.call(context, effects) // Track which character we expect to be consumed, to catch bugs. + + if (initialize.resolveAll) { + resolveAllConstructs.push(initialize) + } // Store where we are in the input stream. + + point._index = 0 + point._bufferIndex = -1 + return context + + function write(slice) { + chunks = chunkedPush(chunks, slice) + main() // Exit if we’re not done, resolve might change stuff. + + if (chunks[chunks.length - 1] !== null) { + return [] + } + + addResult(initialize, 0) // Otherwise, resolve, and exit. + + context.events = resolveAll(resolveAllConstructs, context.events, context) + return context.events + } // + // Tools. + // + + function sliceSerialize(token) { + return serializeChunks(sliceStream(token)) + } + + function sliceStream(token) { + return sliceChunks(chunks, token) + } + + function now() { + return shallow(point) + } + + function skip(value) { + columnStart[value.line] = value.column + accountForPotentialSkip() + } // + // State management. + // + // Main loop (note that `_index` and `_bufferIndex` in `point` are modified by + // `consume`). + // Here is where we walk through the chunks, which either include strings of + // several characters, or numerical character codes. + // The reason to do this in a loop instead of a call is so the stack can + // drain. + + function main() { + var chunkIndex + var chunk + + while (point._index < chunks.length) { + chunk = chunks[point._index] // If we’re in a buffer chunk, loop through it. + + if (typeof chunk === 'string') { + chunkIndex = point._index + + if (point._bufferIndex < 0) { + point._bufferIndex = 0 + } + + while ( + point._index === chunkIndex && + point._bufferIndex < chunk.length + ) { + go(chunk.charCodeAt(point._bufferIndex)) + } + } else { + go(chunk) + } + } + } // Deal with one code. + + function go(code) { + state = state(code) + } // Move a character forward. + + function consume(code) { + if (markdownLineEnding(code)) { + point.line++ + point.column = 1 + point.offset += code === -3 ? 2 : 1 + accountForPotentialSkip() + } else if (code !== -1) { + point.column++ + point.offset++ + } // Not in a string chunk. + + if (point._bufferIndex < 0) { + point._index++ + } else { + point._bufferIndex++ // At end of string chunk. + + if (point._bufferIndex === chunks[point._index].length) { + point._bufferIndex = -1 + point._index++ + } + } // Expose the previous character. + + context.previous = code // Mark as consumed. + } // Start a token. + + function enter(type, fields) { + var token = fields || {} + token.type = type + token.start = now() + context.events.push(['enter', token, context]) + stack.push(token) + return token + } // Stop a token. + + function exit(type) { + var token = stack.pop() + token.end = now() + context.events.push(['exit', token, context]) + return token + } // Use results. + + function onsuccessfulconstruct(construct, info) { + addResult(construct, info.from) + } // Discard results. + + function onsuccessfulcheck(construct, info) { + info.restore() + } // Factory to attempt/check/interrupt. + + function constructFactory(onreturn, fields) { + return hook // Handle either an object mapping codes to constructs, a list of + // constructs, or a single construct. + + function hook(constructs, returnState, bogusState) { + var listOfConstructs + var constructIndex + var currentConstruct + var info + return constructs.tokenize || 'length' in constructs + ? handleListOfConstructs(miniflat(constructs)) + : handleMapOfConstructs + + function handleMapOfConstructs(code) { + if (code in constructs || null in constructs) { + return handleListOfConstructs( + constructs.null + ? /* c8 ignore next */ + miniflat(constructs[code]).concat(miniflat(constructs.null)) + : constructs[code] + )(code) + } + + return bogusState(code) + } + + function handleListOfConstructs(list) { + listOfConstructs = list + constructIndex = 0 + return handleConstruct(list[constructIndex]) + } + + function handleConstruct(construct) { + return start + + function start(code) { + // To do: not nede to store if there is no bogus state, probably? + // Currently doesn’t work because `inspect` in document does a check + // w/o a bogus, which doesn’t make sense. But it does seem to help perf + // by not storing. + info = store() + currentConstruct = construct + + if (!construct.partial) { + context.currentConstruct = construct + } + + if ( + construct.name && + context.parser.constructs.disable.null.indexOf(construct.name) > -1 + ) { + return nok() + } + + return construct.tokenize.call( + fields ? assign({}, context, fields) : context, + effects, + ok, + nok + )(code) + } + } + + function ok(code) { + onreturn(currentConstruct, info) + return returnState + } + + function nok(code) { + info.restore() + + if (++constructIndex < listOfConstructs.length) { + return handleConstruct(listOfConstructs[constructIndex]) + } + + return bogusState + } + } + } + + function addResult(construct, from) { + if (construct.resolveAll && resolveAllConstructs.indexOf(construct) < 0) { + resolveAllConstructs.push(construct) + } + + if (construct.resolve) { + chunkedSplice( + context.events, + from, + context.events.length - from, + construct.resolve(context.events.slice(from), context) + ) + } + + if (construct.resolveTo) { + context.events = construct.resolveTo(context.events, context) + } + } + + function store() { + var startPoint = now() + var startPrevious = context.previous + var startCurrentConstruct = context.currentConstruct + var startEventsIndex = context.events.length + var startStack = Array.from(stack) + return { + restore: restore, + from: startEventsIndex + } + + function restore() { + point = startPoint + context.previous = startPrevious + context.currentConstruct = startCurrentConstruct + context.events.length = startEventsIndex + stack = startStack + accountForPotentialSkip() + } + } + + function accountForPotentialSkip() { + if (point.line in columnStart && point.column < 2) { + point.column = columnStart[point.line] + point.offset += columnStart[point.line] - 1 + } + } +} + +module.exports = createTokenizer diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/miniflat.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/miniflat.js new file mode 100644 index 00000000000000..39c5dd4f6435fc --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/miniflat.js @@ -0,0 +1,11 @@ +'use strict' + +function miniflat(value) { + return value === null || value === undefined + ? [] + : 'length' in value + ? value + : [value] +} + +module.exports = miniflat diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/move-point.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/move-point.js new file mode 100644 index 00000000000000..63c69a2b4144d4 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/move-point.js @@ -0,0 +1,12 @@ +'use strict' + +// chunks (replacement characters, tabs, or line endings). + +function movePoint(point, offset) { + point.column += offset + point.offset += offset + point._bufferIndex += offset + return point +} + +module.exports = movePoint diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/normalize-identifier.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/normalize-identifier.js new file mode 100644 index 00000000000000..f063213454473e --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/normalize-identifier.js @@ -0,0 +1,18 @@ +'use strict' + +function normalizeIdentifier(value) { + return ( + value // Collapse Markdown whitespace. + .replace(/[\t\n\r ]+/g, ' ') // Trim. + .replace(/^ | $/g, '') // Some characters are considered “uppercase”, but if their lowercase + // counterpart is uppercased will result in a different uppercase + // character. + // Hence, to get that form, we perform both lower- and uppercase. + // Upper case makes sure keys will not interact with default prototypal + // methods: no object method is uppercase. + .toLowerCase() + .toUpperCase() + ) +} + +module.exports = normalizeIdentifier diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/normalize-uri.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/normalize-uri.js new file mode 100644 index 00000000000000..8a19ace27737a2 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/normalize-uri.js @@ -0,0 +1,62 @@ +'use strict' + +var asciiAlphanumeric = require('../character/ascii-alphanumeric.js') +var fromCharCode = require('../constant/from-char-code.js') + +// encoded sequences. + +function normalizeUri(value) { + var index = -1 + var result = [] + var start = 0 + var skip = 0 + var code + var next + var replace + + while (++index < value.length) { + code = value.charCodeAt(index) // A correct percent encoded value. + + if ( + code === 37 && + asciiAlphanumeric(value.charCodeAt(index + 1)) && + asciiAlphanumeric(value.charCodeAt(index + 2)) + ) { + skip = 2 + } // ASCII. + else if (code < 128) { + if (!/[!#$&-;=?-Z_a-z~]/.test(fromCharCode(code))) { + replace = fromCharCode(code) + } + } // Astral. + else if (code > 55295 && code < 57344) { + next = value.charCodeAt(index + 1) // A correct surrogate pair. + + if (code < 56320 && next > 56319 && next < 57344) { + replace = fromCharCode(code, next) + skip = 1 + } // Lone surrogate. + else { + replace = '\uFFFD' + } + } // Unicode. + else { + replace = fromCharCode(code) + } + + if (replace) { + result.push(value.slice(start, index), encodeURIComponent(replace)) + start = index + skip + 1 + replace = undefined + } + + if (skip) { + index += skip + skip = 0 + } + } + + return result.join('') + value.slice(start) +} + +module.exports = normalizeUri diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/prefix-size.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/prefix-size.js new file mode 100644 index 00000000000000..a560e3e83a9215 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/prefix-size.js @@ -0,0 +1,11 @@ +'use strict' + +var sizeChunks = require('./size-chunks.js') + +function prefixSize(events, type) { + var tail = events[events.length - 1] + if (!tail || tail[1].type !== type) return 0 + return sizeChunks(tail[2].sliceStream(tail[1])) +} + +module.exports = prefixSize diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/regex-check.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/regex-check.js new file mode 100644 index 00000000000000..b879f444f34ea5 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/regex-check.js @@ -0,0 +1,13 @@ +'use strict' + +var fromCharCode = require('../constant/from-char-code.js') + +function regexCheck(regex) { + return check + + function check(code) { + return regex.test(fromCharCode(code)) + } +} + +module.exports = regexCheck diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/resolve-all.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/resolve-all.js new file mode 100644 index 00000000000000..3e8d76b4a460a2 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/resolve-all.js @@ -0,0 +1,20 @@ +'use strict' + +function resolveAll(constructs, events, context) { + var called = [] + var index = -1 + var resolve + + while (++index < constructs.length) { + resolve = constructs[index].resolveAll + + if (resolve && called.indexOf(resolve) < 0) { + events = resolve(events, context) + called.push(resolve) + } + } + + return events +} + +module.exports = resolveAll diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/safe-from-int.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/safe-from-int.js new file mode 100644 index 00000000000000..08dcac944cc9ed --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/safe-from-int.js @@ -0,0 +1,26 @@ +'use strict' + +var fromCharCode = require('../constant/from-char-code.js') + +function safeFromInt(value, base) { + var code = parseInt(value, base) + + if ( + // C0 except for HT, LF, FF, CR, space + code < 9 || + code === 11 || + (code > 13 && code < 32) || // Control character (DEL) of the basic block and C1 controls. + (code > 126 && code < 160) || // Lone high surrogates and low surrogates. + (code > 55295 && code < 57344) || // Noncharacters. + (code > 64975 && code < 65008) || + (code & 65535) === 65535 || + (code & 65535) === 65534 || // Out of range + code > 1114111 + ) { + return '\uFFFD' + } + + return fromCharCode(code) +} + +module.exports = safeFromInt diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/serialize-chunks.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/serialize-chunks.js new file mode 100644 index 00000000000000..48d9e24f51630a --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/serialize-chunks.js @@ -0,0 +1,40 @@ +'use strict' + +var fromCharCode = require('../constant/from-char-code.js') + +function serializeChunks(chunks) { + var index = -1 + var result = [] + var chunk + var value + var atTab + + while (++index < chunks.length) { + chunk = chunks[index] + + if (typeof chunk === 'string') { + value = chunk + } else if (chunk === -5) { + value = '\r' + } else if (chunk === -4) { + value = '\n' + } else if (chunk === -3) { + value = '\r' + '\n' + } else if (chunk === -2) { + value = '\t' + } else if (chunk === -1) { + if (atTab) continue + value = ' ' + } else { + // Currently only replacement character. + value = fromCharCode(chunk) + } + + atTab = chunk === -2 + result.push(value) + } + + return result.join('') +} + +module.exports = serializeChunks diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/shallow.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/shallow.js new file mode 100644 index 00000000000000..f980ab99e4c090 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/shallow.js @@ -0,0 +1,9 @@ +'use strict' + +var assign = require('../constant/assign.js') + +function shallow(object) { + return assign({}, object) +} + +module.exports = shallow diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/size-chunks.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/size-chunks.js new file mode 100644 index 00000000000000..85bacf0d4f9f22 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/size-chunks.js @@ -0,0 +1,16 @@ +'use strict' + +// Counts tabs based on their expanded size, and CR+LF as one character. + +function sizeChunks(chunks) { + var index = -1 + var size = 0 + + while (++index < chunks.length) { + size += typeof chunks[index] === 'string' ? chunks[index].length : 1 + } + + return size +} + +module.exports = sizeChunks diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/slice-chunks.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/slice-chunks.js new file mode 100644 index 00000000000000..a1ad9289c19f19 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/slice-chunks.js @@ -0,0 +1,27 @@ +'use strict' + +function sliceChunks(chunks, token) { + var startIndex = token.start._index + var startBufferIndex = token.start._bufferIndex + var endIndex = token.end._index + var endBufferIndex = token.end._bufferIndex + var view + + if (startIndex === endIndex) { + view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)] + } else { + view = chunks.slice(startIndex, endIndex) + + if (startBufferIndex > -1) { + view[0] = view[0].slice(startBufferIndex) + } + + if (endBufferIndex > 0) { + view.push(chunks[endIndex].slice(0, endBufferIndex)) + } + } + + return view +} + +module.exports = sliceChunks diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/subtokenize.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/subtokenize.js new file mode 100644 index 00000000000000..dd960c6ee4f621 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/dist/util/subtokenize.js @@ -0,0 +1,199 @@ +'use strict' + +var assign = require('../constant/assign.js') +var chunkedSplice = require('./chunked-splice.js') +var shallow = require('./shallow.js') + +function subtokenize(events) { + var jumps = {} + var index = -1 + var event + var lineIndex + var otherIndex + var otherEvent + var parameters + var subevents + var more + + while (++index < events.length) { + while (index in jumps) { + index = jumps[index] + } + + event = events[index] // Add a hook for the GFM tasklist extension, which needs to know if text + // is in the first content of a list item. + + if ( + index && + event[1].type === 'chunkFlow' && + events[index - 1][1].type === 'listItemPrefix' + ) { + subevents = event[1]._tokenizer.events + otherIndex = 0 + + if ( + otherIndex < subevents.length && + subevents[otherIndex][1].type === 'lineEndingBlank' + ) { + otherIndex += 2 + } + + if ( + otherIndex < subevents.length && + subevents[otherIndex][1].type === 'content' + ) { + while (++otherIndex < subevents.length) { + if (subevents[otherIndex][1].type === 'content') { + break + } + + if (subevents[otherIndex][1].type === 'chunkText') { + subevents[otherIndex][1].isInFirstContentOfListItem = true + otherIndex++ + } + } + } + } // Enter. + + if (event[0] === 'enter') { + if (event[1].contentType) { + assign(jumps, subcontent(events, index)) + index = jumps[index] + more = true + } + } // Exit. + else if (event[1]._container || event[1]._movePreviousLineEndings) { + otherIndex = index + lineIndex = undefined + + while (otherIndex--) { + otherEvent = events[otherIndex] + + if ( + otherEvent[1].type === 'lineEnding' || + otherEvent[1].type === 'lineEndingBlank' + ) { + if (otherEvent[0] === 'enter') { + if (lineIndex) { + events[lineIndex][1].type = 'lineEndingBlank' + } + + otherEvent[1].type = 'lineEnding' + lineIndex = otherIndex + } + } else { + break + } + } + + if (lineIndex) { + // Fix position. + event[1].end = shallow(events[lineIndex][1].start) // Switch container exit w/ line endings. + + parameters = events.slice(lineIndex, index) + parameters.unshift(event) + chunkedSplice(events, lineIndex, index - lineIndex + 1, parameters) + } + } + } + + return !more +} + +function subcontent(events, eventIndex) { + var token = events[eventIndex][1] + var context = events[eventIndex][2] + var startPosition = eventIndex - 1 + var startPositions = [] + var tokenizer = + token._tokenizer || context.parser[token.contentType](token.start) + var childEvents = tokenizer.events + var jumps = [] + var gaps = {} + var stream + var previous + var index + var entered + var end + var adjust // Loop forward through the linked tokens to pass them in order to the + // subtokenizer. + + while (token) { + // Find the position of the event for this token. + while (events[++startPosition][1] !== token) { + // Empty. + } + + startPositions.push(startPosition) + + if (!token._tokenizer) { + stream = context.sliceStream(token) + + if (!token.next) { + stream.push(null) + } + + if (previous) { + tokenizer.defineSkip(token.start) + } + + if (token.isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = true + } + + tokenizer.write(stream) + + if (token.isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = undefined + } + } // Unravel the next token. + + previous = token + token = token.next + } // Now, loop back through all events (and linked tokens), to figure out which + // parts belong where. + + token = previous + index = childEvents.length + + while (index--) { + // Make sure we’ve at least seen something (final eol is part of the last + // token). + if (childEvents[index][0] === 'enter') { + entered = true + } else if ( + // Find a void token that includes a break. + entered && + childEvents[index][1].type === childEvents[index - 1][1].type && + childEvents[index][1].start.line !== childEvents[index][1].end.line + ) { + add(childEvents.slice(index + 1, end)) + // Help GC. + token._tokenizer = token.next = undefined + token = token.previous + end = index + 1 + } + } + + // Help GC. + tokenizer.events = token._tokenizer = token.next = undefined // Do head: + + add(childEvents.slice(0, end)) + index = -1 + adjust = 0 + + while (++index < jumps.length) { + gaps[adjust + jumps[index][0]] = adjust + jumps[index][1] + adjust += jumps[index][1] - jumps[index][0] - 1 + } + + return gaps + + function add(slice) { + var start = startPositions.pop() + jumps.unshift([start, start + slice.length - 1]) + chunkedSplice(events, start, 2, slice) + } +} + +module.exports = subtokenize diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/index.js new file mode 100644 index 00000000000000..bb7c67d973d210 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/index.js @@ -0,0 +1,3 @@ +'use strict' + +module.exports = require('./buffer.js') diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/index.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/index.mjs new file mode 100644 index 00000000000000..2e841cc14a7222 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/index.mjs @@ -0,0 +1 @@ +export {default} from './buffer.mjs' diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-alpha.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-alpha.js new file mode 100644 index 00000000000000..4e5b20d20b9315 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-alpha.js @@ -0,0 +1,7 @@ +'use strict' + +var regexCheck = require('../util/regex-check.js') + +var asciiAlpha = regexCheck(/[A-Za-z]/) + +module.exports = asciiAlpha diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-alpha.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-alpha.mjs new file mode 100644 index 00000000000000..f6f3aaba7417be --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-alpha.mjs @@ -0,0 +1,3 @@ +import check from '../util/regex-check.mjs' + +export default check(/[A-Za-z]/) diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-alphanumeric.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-alphanumeric.js new file mode 100644 index 00000000000000..4ab360273aa25e --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-alphanumeric.js @@ -0,0 +1,7 @@ +'use strict' + +var regexCheck = require('../util/regex-check.js') + +var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/) + +module.exports = asciiAlphanumeric diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-alphanumeric.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-alphanumeric.mjs new file mode 100644 index 00000000000000..efed7145656d29 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-alphanumeric.mjs @@ -0,0 +1,3 @@ +import check from '../util/regex-check.mjs' + +export default check(/[\dA-Za-z]/) diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-atext.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-atext.js new file mode 100644 index 00000000000000..8962f996ede7ef --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-atext.js @@ -0,0 +1,7 @@ +'use strict' + +var regexCheck = require('../util/regex-check.js') + +var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/) + +module.exports = asciiAtext diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-atext.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-atext.mjs new file mode 100644 index 00000000000000..56b84c42e82240 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-atext.mjs @@ -0,0 +1,3 @@ +import check from '../util/regex-check.mjs' + +export default check(/[#-'*+\--9=?A-Z^-~]/) diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-control.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-control.js new file mode 100644 index 00000000000000..c134a613fe725a --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-control.js @@ -0,0 +1,14 @@ +'use strict' + +var codes = require('./codes.js') + +// Note: EOF is seen as ASCII control here, because `null < 32 == true`. +function asciiControl(code) { + return ( + // Special whitespace codes (which have negative values), C0 and Control + // character DEL + code < codes.space || code === codes.del + ) +} + +module.exports = asciiControl diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-control.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-control.mjs new file mode 100644 index 00000000000000..0824191947a4cf --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-control.mjs @@ -0,0 +1,12 @@ +export default asciiControl + +import codes from './codes.mjs' + +// Note: EOF is seen as ASCII control here, because `null < 32 == true`. +function asciiControl(code) { + return ( + // Special whitespace codes (which have negative values), C0 and Control + // character DEL + code < codes.space || code === codes.del + ) +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-digit.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-digit.js new file mode 100644 index 00000000000000..da614c4e409dd3 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-digit.js @@ -0,0 +1,7 @@ +'use strict' + +var regexCheck = require('../util/regex-check.js') + +var asciiDigit = regexCheck(/\d/) + +module.exports = asciiDigit diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-digit.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-digit.mjs new file mode 100644 index 00000000000000..ec3b6e11dbb432 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-digit.mjs @@ -0,0 +1,3 @@ +import check from '../util/regex-check.mjs' + +export default check(/\d/) diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-hex-digit.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-hex-digit.js new file mode 100644 index 00000000000000..a0e7af43edd1b7 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-hex-digit.js @@ -0,0 +1,7 @@ +'use strict' + +var regexCheck = require('../util/regex-check.js') + +var asciiHexDigit = regexCheck(/[\dA-Fa-f]/) + +module.exports = asciiHexDigit diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-hex-digit.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-hex-digit.mjs new file mode 100644 index 00000000000000..3eabedbf786c09 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-hex-digit.mjs @@ -0,0 +1,3 @@ +import check from '../util/regex-check.mjs' + +export default check(/[\dA-Fa-f]/) diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-punctuation.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-punctuation.js new file mode 100644 index 00000000000000..596b45a5eb084b --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-punctuation.js @@ -0,0 +1,7 @@ +'use strict' + +var regexCheck = require('../util/regex-check.js') + +var asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/) + +module.exports = asciiPunctuation diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-punctuation.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-punctuation.mjs new file mode 100644 index 00000000000000..d8308f1139e4fd --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/ascii-punctuation.mjs @@ -0,0 +1,3 @@ +import check from '../util/regex-check.mjs' + +export default check(/[!-/:-@[-`{-~]/) diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/codes.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/codes.js new file mode 100644 index 00000000000000..46ab818040f06d --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/codes.js @@ -0,0 +1,158 @@ +'use strict' + +// This module is compiled away! +// +// micromark works based on character codes. +// This module contains constants for the ASCII block and the replacement +// character. +// A couple of them are handled in a special way, such as the line endings +// (CR, LF, and CR+LF, commonly known as end-of-line: EOLs), the tab (horizontal +// tab) and its expansion based on what column it’s at (virtual space), +// and the end-of-file (eof) character. +// As values are preprocessed before handling them, the actual characters LF, +// CR, HT, and NUL (which is present as the replacement character), are +// guaranteed to not exist. +// +// Unicode basic latin block. +var codes = { + carriageReturn: -5, + lineFeed: -4, + carriageReturnLineFeed: -3, + horizontalTab: -2, + virtualSpace: -1, + eof: null, + nul: 0, + soh: 1, + stx: 2, + etx: 3, + eot: 4, + enq: 5, + ack: 6, + bel: 7, + bs: 8, + ht: 9, // `\t` + lf: 10, // `\n` + vt: 11, // `\v` + ff: 12, // `\f` + cr: 13, // `\r` + so: 14, + si: 15, + dle: 16, + dc1: 17, + dc2: 18, + dc3: 19, + dc4: 20, + nak: 21, + syn: 22, + etb: 23, + can: 24, + em: 25, + sub: 26, + esc: 27, + fs: 28, + gs: 29, + rs: 30, + us: 31, + space: 32, + exclamationMark: 33, // `!` + quotationMark: 34, // `"` + numberSign: 35, // `#` + dollarSign: 36, // `$` + percentSign: 37, // `%` + ampersand: 38, // `&` + apostrophe: 39, // `'` + leftParenthesis: 40, // `(` + rightParenthesis: 41, // `)` + asterisk: 42, // `*` + plusSign: 43, // `+` + comma: 44, // `,` + dash: 45, // `-` + dot: 46, // `.` + slash: 47, // `/` + digit0: 48, // `0` + digit1: 49, // `1` + digit2: 50, // `2` + digit3: 51, // `3` + digit4: 52, // `4` + digit5: 53, // `5` + digit6: 54, // `6` + digit7: 55, // `7` + digit8: 56, // `8` + digit9: 57, // `9` + colon: 58, // `:` + semicolon: 59, // `;` + lessThan: 60, // `<` + equalsTo: 61, // `=` + greaterThan: 62, // `>` + questionMark: 63, // `?` + atSign: 64, // `@` + uppercaseA: 65, // `A` + uppercaseB: 66, // `B` + uppercaseC: 67, // `C` + uppercaseD: 68, // `D` + uppercaseE: 69, // `E` + uppercaseF: 70, // `F` + uppercaseG: 71, // `G` + uppercaseH: 72, // `H` + uppercaseI: 73, // `I` + uppercaseJ: 74, // `J` + uppercaseK: 75, // `K` + uppercaseL: 76, // `L` + uppercaseM: 77, // `M` + uppercaseN: 78, // `N` + uppercaseO: 79, // `O` + uppercaseP: 80, // `P` + uppercaseQ: 81, // `Q` + uppercaseR: 82, // `R` + uppercaseS: 83, // `S` + uppercaseT: 84, // `T` + uppercaseU: 85, // `U` + uppercaseV: 86, // `V` + uppercaseW: 87, // `W` + uppercaseX: 88, // `X` + uppercaseY: 89, // `Y` + uppercaseZ: 90, // `Z` + leftSquareBracket: 91, // `[` + backslash: 92, // `\` + rightSquareBracket: 93, // `]` + caret: 94, // `^` + underscore: 95, // `_` + graveAccent: 96, // `` ` `` + lowercaseA: 97, // `a` + lowercaseB: 98, // `b` + lowercaseC: 99, // `c` + lowercaseD: 100, // `d` + lowercaseE: 101, // `e` + lowercaseF: 102, // `f` + lowercaseG: 103, // `g` + lowercaseH: 104, // `h` + lowercaseI: 105, // `i` + lowercaseJ: 106, // `j` + lowercaseK: 107, // `k` + lowercaseL: 108, // `l` + lowercaseM: 109, // `m` + lowercaseN: 110, // `n` + lowercaseO: 111, // `o` + lowercaseP: 112, // `p` + lowercaseQ: 113, // `q` + lowercaseR: 114, // `r` + lowercaseS: 115, // `s` + lowercaseT: 116, // `t` + lowercaseU: 117, // `u` + lowercaseV: 118, // `v` + lowercaseW: 119, // `w` + lowercaseX: 120, // `x` + lowercaseY: 121, // `y` + lowercaseZ: 122, // `z` + leftCurlyBrace: 123, // `{` + verticalBar: 124, // `|` + rightCurlyBrace: 125, // `}` + tilde: 126, // `~` + del: 127, + // Unicode Specials block. + byteOrderMarker: 65279, + // Unicode Specials block. + replacementCharacter: 65533 // `�` +} + +module.exports = codes diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/codes.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/codes.mjs new file mode 100644 index 00000000000000..7503f4728e2c9f --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/codes.mjs @@ -0,0 +1,154 @@ +// This module is compiled away! +// +// micromark works based on character codes. +// This module contains constants for the ASCII block and the replacement +// character. +// A couple of them are handled in a special way, such as the line endings +// (CR, LF, and CR+LF, commonly known as end-of-line: EOLs), the tab (horizontal +// tab) and its expansion based on what column it’s at (virtual space), +// and the end-of-file (eof) character. +// As values are preprocessed before handling them, the actual characters LF, +// CR, HT, and NUL (which is present as the replacement character), are +// guaranteed to not exist. +// +// Unicode basic latin block. +export default { + carriageReturn: -5, + lineFeed: -4, + carriageReturnLineFeed: -3, + horizontalTab: -2, + virtualSpace: -1, + eof: null, + nul: 0, + soh: 1, + stx: 2, + etx: 3, + eot: 4, + enq: 5, + ack: 6, + bel: 7, + bs: 8, + ht: 9, // `\t` + lf: 10, // `\n` + vt: 11, // `\v` + ff: 12, // `\f` + cr: 13, // `\r` + so: 14, + si: 15, + dle: 16, + dc1: 17, + dc2: 18, + dc3: 19, + dc4: 20, + nak: 21, + syn: 22, + etb: 23, + can: 24, + em: 25, + sub: 26, + esc: 27, + fs: 28, + gs: 29, + rs: 30, + us: 31, + space: 32, + exclamationMark: 33, // `!` + quotationMark: 34, // `"` + numberSign: 35, // `#` + dollarSign: 36, // `$` + percentSign: 37, // `%` + ampersand: 38, // `&` + apostrophe: 39, // `'` + leftParenthesis: 40, // `(` + rightParenthesis: 41, // `)` + asterisk: 42, // `*` + plusSign: 43, // `+` + comma: 44, // `,` + dash: 45, // `-` + dot: 46, // `.` + slash: 47, // `/` + digit0: 48, // `0` + digit1: 49, // `1` + digit2: 50, // `2` + digit3: 51, // `3` + digit4: 52, // `4` + digit5: 53, // `5` + digit6: 54, // `6` + digit7: 55, // `7` + digit8: 56, // `8` + digit9: 57, // `9` + colon: 58, // `:` + semicolon: 59, // `;` + lessThan: 60, // `<` + equalsTo: 61, // `=` + greaterThan: 62, // `>` + questionMark: 63, // `?` + atSign: 64, // `@` + uppercaseA: 65, // `A` + uppercaseB: 66, // `B` + uppercaseC: 67, // `C` + uppercaseD: 68, // `D` + uppercaseE: 69, // `E` + uppercaseF: 70, // `F` + uppercaseG: 71, // `G` + uppercaseH: 72, // `H` + uppercaseI: 73, // `I` + uppercaseJ: 74, // `J` + uppercaseK: 75, // `K` + uppercaseL: 76, // `L` + uppercaseM: 77, // `M` + uppercaseN: 78, // `N` + uppercaseO: 79, // `O` + uppercaseP: 80, // `P` + uppercaseQ: 81, // `Q` + uppercaseR: 82, // `R` + uppercaseS: 83, // `S` + uppercaseT: 84, // `T` + uppercaseU: 85, // `U` + uppercaseV: 86, // `V` + uppercaseW: 87, // `W` + uppercaseX: 88, // `X` + uppercaseY: 89, // `Y` + uppercaseZ: 90, // `Z` + leftSquareBracket: 91, // `[` + backslash: 92, // `\` + rightSquareBracket: 93, // `]` + caret: 94, // `^` + underscore: 95, // `_` + graveAccent: 96, // `` ` `` + lowercaseA: 97, // `a` + lowercaseB: 98, // `b` + lowercaseC: 99, // `c` + lowercaseD: 100, // `d` + lowercaseE: 101, // `e` + lowercaseF: 102, // `f` + lowercaseG: 103, // `g` + lowercaseH: 104, // `h` + lowercaseI: 105, // `i` + lowercaseJ: 106, // `j` + lowercaseK: 107, // `k` + lowercaseL: 108, // `l` + lowercaseM: 109, // `m` + lowercaseN: 110, // `n` + lowercaseO: 111, // `o` + lowercaseP: 112, // `p` + lowercaseQ: 113, // `q` + lowercaseR: 114, // `r` + lowercaseS: 115, // `s` + lowercaseT: 116, // `t` + lowercaseU: 117, // `u` + lowercaseV: 118, // `v` + lowercaseW: 119, // `w` + lowercaseX: 120, // `x` + lowercaseY: 121, // `y` + lowercaseZ: 122, // `z` + leftCurlyBrace: 123, // `{` + verticalBar: 124, // `|` + rightCurlyBrace: 125, // `}` + tilde: 126, // `~` + del: 127, + // Unicode Specials block. + byteOrderMarker: 65279, + // Unicode Specials block. + replacementCharacter: 65533 // `�` +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/markdown-line-ending-or-space.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/markdown-line-ending-or-space.js new file mode 100644 index 00000000000000..2b6ffb9b595100 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/markdown-line-ending-or-space.js @@ -0,0 +1,9 @@ +'use strict' + +var codes = require('./codes.js') + +function markdownLineEndingOrSpace(code) { + return code < codes.nul || code === codes.space +} + +module.exports = markdownLineEndingOrSpace diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/markdown-line-ending-or-space.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/markdown-line-ending-or-space.mjs new file mode 100644 index 00000000000000..6e27e03752b3dd --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/markdown-line-ending-or-space.mjs @@ -0,0 +1,7 @@ +export default markdownLineEndingOrSpace + +import codes from './codes.mjs' + +function markdownLineEndingOrSpace(code) { + return code < codes.nul || code === codes.space +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/markdown-line-ending.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/markdown-line-ending.js new file mode 100644 index 00000000000000..05032eefc5325f --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/markdown-line-ending.js @@ -0,0 +1,9 @@ +'use strict' + +var codes = require('./codes.js') + +function markdownLineEnding(code) { + return code < codes.horizontalTab +} + +module.exports = markdownLineEnding diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/markdown-line-ending.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/markdown-line-ending.mjs new file mode 100644 index 00000000000000..63c1b71c077447 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/markdown-line-ending.mjs @@ -0,0 +1,7 @@ +export default markdownLineEnding + +import codes from './codes.mjs' + +function markdownLineEnding(code) { + return code < codes.horizontalTab +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/markdown-space.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/markdown-space.js new file mode 100644 index 00000000000000..6273782f9d195f --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/markdown-space.js @@ -0,0 +1,13 @@ +'use strict' + +var codes = require('./codes.js') + +function markdownSpace(code) { + return ( + code === codes.horizontalTab || + code === codes.virtualSpace || + code === codes.space + ) +} + +module.exports = markdownSpace diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/markdown-space.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/markdown-space.mjs new file mode 100644 index 00000000000000..03b72a18fe9e36 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/markdown-space.mjs @@ -0,0 +1,11 @@ +export default markdownSpace + +import codes from './codes.mjs' + +function markdownSpace(code) { + return ( + code === codes.horizontalTab || + code === codes.virtualSpace || + code === codes.space + ) +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/unicode-punctuation.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/unicode-punctuation.js new file mode 100644 index 00000000000000..ae28b173101749 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/unicode-punctuation.js @@ -0,0 +1,10 @@ +'use strict' + +var unicodePunctuationRegex = require('../constant/unicode-punctuation-regex.js') +var regexCheck = require('../util/regex-check.js') + +// Size note: removing ASCII from the regex and using `ascii-punctuation` here +// In fact adds to the bundle size. +var unicodePunctuation = regexCheck(unicodePunctuationRegex) + +module.exports = unicodePunctuation diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/unicode-punctuation.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/unicode-punctuation.mjs new file mode 100644 index 00000000000000..037f7f9bea4029 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/unicode-punctuation.mjs @@ -0,0 +1,6 @@ +import unicodePunctuation from '../constant/unicode-punctuation-regex.mjs' +import check from '../util/regex-check.mjs' + +// Size note: removing ASCII from the regex and using `ascii-punctuation` here +// In fact adds to the bundle size. +export default check(unicodePunctuation) diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/unicode-whitespace.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/unicode-whitespace.js new file mode 100644 index 00000000000000..b09537ea087786 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/unicode-whitespace.js @@ -0,0 +1,7 @@ +'use strict' + +var regexCheck = require('../util/regex-check.js') + +var unicodeWhitespace = regexCheck(/\s/) + +module.exports = unicodeWhitespace diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/unicode-whitespace.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/unicode-whitespace.mjs new file mode 100644 index 00000000000000..5a7a530ac73b11 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/unicode-whitespace.mjs @@ -0,0 +1,3 @@ +import check from '../util/regex-check.mjs' + +export default check(/\s/) diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/values.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/values.js new file mode 100644 index 00000000000000..cd1794fd97342a --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/values.js @@ -0,0 +1,111 @@ +'use strict' + +// This module is compiled away! +// +// While micromark works based on character codes, this module includes the +// string versions of ’em. +// The C0 block, except for LF, CR, HT, and w/ the replacement character added, +// are available here. +var values = { + ht: '\t', + lf: '\n', + cr: '\r', + space: ' ', + exclamationMark: '!', + quotationMark: '"', + numberSign: '#', + dollarSign: '$', + percentSign: '%', + ampersand: '&', + apostrophe: "'", + leftParenthesis: '(', + rightParenthesis: ')', + asterisk: '*', + plusSign: '+', + comma: ',', + dash: '-', + dot: '.', + slash: '/', + digit0: '0', + digit1: '1', + digit2: '2', + digit3: '3', + digit4: '4', + digit5: '5', + digit6: '6', + digit7: '7', + digit8: '8', + digit9: '9', + colon: ':', + semicolon: ';', + lessThan: '<', + equalsTo: '=', + greaterThan: '>', + questionMark: '?', + atSign: '@', + uppercaseA: 'A', + uppercaseB: 'B', + uppercaseC: 'C', + uppercaseD: 'D', + uppercaseE: 'E', + uppercaseF: 'F', + uppercaseG: 'G', + uppercaseH: 'H', + uppercaseI: 'I', + uppercaseJ: 'J', + uppercaseK: 'K', + uppercaseL: 'L', + uppercaseM: 'M', + uppercaseN: 'N', + uppercaseO: 'O', + uppercaseP: 'P', + uppercaseQ: 'Q', + uppercaseR: 'R', + uppercaseS: 'S', + uppercaseT: 'T', + uppercaseU: 'U', + uppercaseV: 'V', + uppercaseW: 'W', + uppercaseX: 'X', + uppercaseY: 'Y', + uppercaseZ: 'Z', + leftSquareBracket: '[', + backslash: '\\', + rightSquareBracket: ']', + caret: '^', + underscore: '_', + graveAccent: '`', + lowercaseA: 'a', + lowercaseB: 'b', + lowercaseC: 'c', + lowercaseD: 'd', + lowercaseE: 'e', + lowercaseF: 'f', + lowercaseG: 'g', + lowercaseH: 'h', + lowercaseI: 'i', + lowercaseJ: 'j', + lowercaseK: 'k', + lowercaseL: 'l', + lowercaseM: 'm', + lowercaseN: 'n', + lowercaseO: 'o', + lowercaseP: 'p', + lowercaseQ: 'q', + lowercaseR: 'r', + lowercaseS: 's', + lowercaseT: 't', + lowercaseU: 'u', + lowercaseV: 'v', + lowercaseW: 'w', + lowercaseX: 'x', + lowercaseY: 'y', + lowercaseZ: 'z', + leftCurlyBrace: '{', + verticalBar: '|', + rightCurlyBrace: '}', + tilde: '~', + replacementCharacter: '�' +} + +module.exports = values diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/values.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/values.mjs new file mode 100644 index 00000000000000..bc0be3fee93306 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/character/values.mjs @@ -0,0 +1,107 @@ +// This module is compiled away! +// +// While micromark works based on character codes, this module includes the +// string versions of ’em. +// The C0 block, except for LF, CR, HT, and w/ the replacement character added, +// are available here. +export default { + ht: '\t', + lf: '\n', + cr: '\r', + space: ' ', + exclamationMark: '!', + quotationMark: '"', + numberSign: '#', + dollarSign: '$', + percentSign: '%', + ampersand: '&', + apostrophe: "'", + leftParenthesis: '(', + rightParenthesis: ')', + asterisk: '*', + plusSign: '+', + comma: ',', + dash: '-', + dot: '.', + slash: '/', + digit0: '0', + digit1: '1', + digit2: '2', + digit3: '3', + digit4: '4', + digit5: '5', + digit6: '6', + digit7: '7', + digit8: '8', + digit9: '9', + colon: ':', + semicolon: ';', + lessThan: '<', + equalsTo: '=', + greaterThan: '>', + questionMark: '?', + atSign: '@', + uppercaseA: 'A', + uppercaseB: 'B', + uppercaseC: 'C', + uppercaseD: 'D', + uppercaseE: 'E', + uppercaseF: 'F', + uppercaseG: 'G', + uppercaseH: 'H', + uppercaseI: 'I', + uppercaseJ: 'J', + uppercaseK: 'K', + uppercaseL: 'L', + uppercaseM: 'M', + uppercaseN: 'N', + uppercaseO: 'O', + uppercaseP: 'P', + uppercaseQ: 'Q', + uppercaseR: 'R', + uppercaseS: 'S', + uppercaseT: 'T', + uppercaseU: 'U', + uppercaseV: 'V', + uppercaseW: 'W', + uppercaseX: 'X', + uppercaseY: 'Y', + uppercaseZ: 'Z', + leftSquareBracket: '[', + backslash: '\\', + rightSquareBracket: ']', + caret: '^', + underscore: '_', + graveAccent: '`', + lowercaseA: 'a', + lowercaseB: 'b', + lowercaseC: 'c', + lowercaseD: 'd', + lowercaseE: 'e', + lowercaseF: 'f', + lowercaseG: 'g', + lowercaseH: 'h', + lowercaseI: 'i', + lowercaseJ: 'j', + lowercaseK: 'k', + lowercaseL: 'l', + lowercaseM: 'm', + lowercaseN: 'n', + lowercaseO: 'o', + lowercaseP: 'p', + lowercaseQ: 'q', + lowercaseR: 'r', + lowercaseS: 's', + lowercaseT: 't', + lowercaseU: 'u', + lowercaseV: 'v', + lowercaseW: 'w', + lowercaseX: 'x', + lowercaseY: 'y', + lowercaseZ: 'z', + leftCurlyBrace: '{', + verticalBar: '|', + rightCurlyBrace: '}', + tilde: '~', + replacementCharacter: '�' +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/compile/html.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/compile/html.js new file mode 100644 index 00000000000000..ab6874b3cdfc27 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/compile/html.js @@ -0,0 +1,810 @@ +'use strict' + +var decodeEntity = require('parse-entities/decode-entity.js') +var codes = require('../character/codes.js') +var assign = require('../constant/assign.js') +var constants = require('../constant/constants.js') +var hasOwnProperty = require('../constant/has-own-property.js') +var types = require('../constant/types.js') +var combineHtmlExtensions = require('../util/combine-html-extensions.js') +var chunkedPush = require('../util/chunked-push.js') +var miniflat = require('../util/miniflat.js') +var normalizeIdentifier = require('../util/normalize-identifier.js') +var normalizeUri = require('../util/normalize-uri.js') +var safeFromInt = require('../util/safe-from-int.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var decodeEntity__default = /*#__PURE__*/ _interopDefaultLegacy(decodeEntity) + +// While micromark is a lexer/tokenizer, the common case of going from markdown + +// This ensures that certain characters which have special meaning in HTML are +// dealt with. +// Technically, we can skip `>` and `"` in many cases, but CM includes them. +var characterReferences = {'"': 'quot', '&': 'amp', '<': 'lt', '>': 'gt'} + +// These two are allowlists of essentially safe protocols for full URLs in +// respectively the `href` (on ``) and `src` (on ``) attributes. +// They are based on what is allowed on GitHub, +// +var protocolHref = /^(https?|ircs?|mailto|xmpp)$/i +var protocolSrc = /^https?$/i + +function compileHtml(options) { + // Configuration. + // Includes `htmlExtensions` (an array of extensions), `defaultLineEnding` (a + // preferred EOL), `allowDangerousProtocol` (whether to allow potential + // dangerous protocols), and `allowDangerousHtml` (whether to allow potential + // dangerous HTML). + var settings = options || {} + // Tags is needed because according to markdown, links and emphasis and + // whatnot can exist in images, however, as HTML doesn’t allow content in + // images, the tags are ignored in the `alt` attribute, but the content + // remains. + var tags = true + // An object to track identifiers to media (URLs and titles) defined with + // definitions. + var definitions = {} + // A lot of the handlers need to capture some of the output data, modify it + // somehow, and then deal with it. + // We do that by tracking a stack of buffers, that can be opened (with + // `buffer`) and closed (with `resume`) to access them. + var buffers = [[]] + // As we can have links in images and the other way around, where the deepest + // ones are closed first, we need to track which one we’re in. + var mediaStack = [] + // Same for tightness, which is specific to lists. + // We need to track if we’re currently in a tight or loose container. + var tightStack = [] + + var defaultHandlers = { + enter: { + blockQuote: onenterblockquote, + codeFenced: onentercodefenced, + codeFencedFenceInfo: buffer, + codeFencedFenceMeta: buffer, + codeIndented: onentercodeindented, + codeText: onentercodetext, + content: onentercontent, + definition: onenterdefinition, + definitionDestinationString: onenterdefinitiondestinationstring, + definitionLabelString: buffer, + definitionTitleString: buffer, + emphasis: onenteremphasis, + htmlFlow: onenterhtmlflow, + htmlText: onenterhtml, + image: onenterimage, + label: buffer, + link: onenterlink, + listItemMarker: onenterlistitemmarker, + listItemValue: onenterlistitemvalue, + listOrdered: onenterlistordered, + listUnordered: onenterlistunordered, + paragraph: onenterparagraph, + reference: buffer, + resource: onenterresource, + resourceDestinationString: onenterresourcedestinationstring, + resourceTitleString: buffer, + setextHeading: onentersetextheading, + strong: onenterstrong + }, + exit: { + atxHeading: onexitatxheading, + atxHeadingSequence: onexitatxheadingsequence, + autolinkEmail: onexitautolinkemail, + autolinkProtocol: onexitautolinkprotocol, + blockQuote: onexitblockquote, + characterEscapeValue: onexitdata, + characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, + characterReferenceMarkerNumeric: onexitcharacterreferencemarker, + characterReferenceValue: onexitcharacterreferencevalue, + codeFenced: onexitflowcode, + codeFencedFence: onexitcodefencedfence, + codeFencedFenceInfo: onexitcodefencedfenceinfo, + codeFencedFenceMeta: resume, + codeFlowValue: onexitcodeflowvalue, + codeIndented: onexitflowcode, + codeText: onexitcodetext, + codeTextData: onexitdata, + data: onexitdata, + definition: onexitdefinition, + definitionDestinationString: onexitdefinitiondestinationstring, + definitionLabelString: onexitdefinitionlabelstring, + definitionTitleString: onexitdefinitiontitlestring, + emphasis: onexitemphasis, + hardBreakEscape: onexithardbreak, + hardBreakTrailing: onexithardbreak, + htmlFlow: onexithtml, + htmlFlowData: onexitdata, + htmlText: onexithtml, + htmlTextData: onexitdata, + image: onexitmedia, + label: onexitlabel, + labelText: onexitlabeltext, + lineEnding: onexitlineending, + link: onexitmedia, + listOrdered: onexitlistordered, + listUnordered: onexitlistunordered, + paragraph: onexitparagraph, + reference: resume, + referenceString: onexitreferencestring, + resource: resume, + resourceDestinationString: onexitresourcedestinationstring, + resourceTitleString: onexitresourcetitlestring, + setextHeading: onexitsetextheading, + setextHeadingLineSequence: onexitsetextheadinglinesequence, + setextHeadingText: onexitsetextheadingtext, + strong: onexitstrong, + thematicBreak: onexitthematicbreak + } + } + + // Combine the HTML extensions with the default handlers. + // An HTML extension is an object whose fields are either `enter` or `exit` + // (reflecting whether a token is entered or exited). + // The values at such objects are names of tokens mapping to handlers. + // Handlers are called, respectively when a token is opener or closed, with + // that token, and a context as `this`. + var handlers = combineHtmlExtensions( + [defaultHandlers].concat(miniflat(settings.htmlExtensions)) + ) + + // Handlers do often need to keep track of some state. + // That state is provided here as a key-value store (an object). + var data = {tightStack: tightStack} + + // The context for handlers references a couple of useful functions. + // In handlers from extensions, those can be accessed at `this`. + // For the handlers here, they can be accessed directly. + var context = { + lineEndingIfNeeded: lineEndingIfNeeded, + options: settings, + encode: encode, + raw: raw, + tag: tag, + buffer: buffer, + resume: resume, + setData: setData, + getData: getData + } + + // Generally, micromark copies line endings (`'\r'`, `'\n'`, `'\r\n'`) in the + // markdown document over to the compiled HTML. + // In some cases, such as `> a`, CommonMark requires that extra line endings + // are added: `
    \n

    a

    \n
    `. + // This variable hold the default line ending when given (or `undefined`), + // and in the latter case will be updated to the first found line ending if + // there is one. + var lineEndingStyle = settings.defaultLineEnding + + // Return the function that handles a slice of events. + return compile + + // Deal w/ a slice of events. + // Return either the empty string if there’s nothing of note to return, or the + // result when done. + function compile(events) { + // As definitions can come after references, we need to figure out the media + // (urls and titles) defined by them before handling the references. + // So, we do sort of what HTML does: put metadata at the start (in head), and + // then put content after (`body`). + var head = [] + var body = [] + var index + var start + var listStack + var handler + var result + + index = -1 + start = 0 + listStack = [] + + while (++index < events.length) { + // Figure out the line ending style used in the document. + if ( + !lineEndingStyle && + (events[index][1].type === types.lineEnding || + events[index][1].type === types.lineEndingBlank) + ) { + lineEndingStyle = events[index][2].sliceSerialize(events[index][1]) + } + + // Preprocess lists to infer whether the list is loose or not. + if ( + events[index][1].type === types.listOrdered || + events[index][1].type === types.listUnordered + ) { + if (events[index][0] === 'enter') { + listStack.push(index) + } else { + prepareList(events.slice(listStack.pop(), index)) + } + } + + // Move definitions to the front. + if (events[index][1].type === types.definition) { + if (events[index][0] === 'enter') { + body = chunkedPush(body, events.slice(start, index)) + start = index + } else { + head = chunkedPush(head, events.slice(start, index + 1)) + start = index + 1 + } + } + } + + head = chunkedPush(head, body) + head = chunkedPush(head, events.slice(start)) + result = head + index = -1 + + // Handle the start of the document, if defined. + if (handlers.enter.null) { + handlers.enter.null.call(context) + } + + // Handle all events. + while (++index < events.length) { + handler = handlers[result[index][0]] + + if (hasOwnProperty.call(handler, result[index][1].type)) { + handler[result[index][1].type].call( + assign({sliceSerialize: result[index][2].sliceSerialize}, context), + result[index][1] + ) + } + } + + // Handle the end of the document, if defined. + if (handlers.exit.null) { + handlers.exit.null.call(context) + } + + return buffers[0].join('') + } + + // Figure out whether lists are loose or not. + function prepareList(slice) { + var length = slice.length - 1 // Skip close. + var index = 0 // Skip open. + var containerBalance = 0 + var loose + var atMarker + var event + + while (++index < length) { + event = slice[index] + + if (event[1]._container) { + atMarker = undefined + + if (event[0] === 'enter') { + containerBalance++ + } else { + containerBalance-- + } + } else if (event[1].type === types.listItemPrefix) { + if (event[0] === 'exit') { + atMarker = true + } + } else if (event[1].type === types.linePrefix); + else if (event[1].type === types.lineEndingBlank) { + if (event[0] === 'enter' && !containerBalance) { + if (atMarker) { + atMarker = undefined + } else { + loose = true + } + } + } else { + atMarker = undefined + } + } + + slice[0][1]._loose = loose + } + + // Set data into the key-value store. + function setData(key, value) { + data[key] = value + } + + // Get data from the key-value store. + function getData(key) { + return data[key] + } + + // Capture some of the output data. + function buffer() { + buffers.push([]) + } + + // Stop capturing and access the output data. + function resume() { + return buffers.pop().join('') + } + + // Output (parts of) HTML tags. + function tag(value) { + if (!tags) return + setData('lastWasTag', true) + buffers[buffers.length - 1].push(value) + } + + // Output raw data. + function raw(value) { + setData('lastWasTag') + buffers[buffers.length - 1].push(value) + } + + // Output an extra line ending. + function lineEnding() { + raw(lineEndingStyle || '\n') + } + + // Output an extra line ending if the previous value wasn’t EOF/EOL. + function lineEndingIfNeeded() { + var buffer = buffers[buffers.length - 1] + var slice = buffer[buffer.length - 1] + var previous = slice ? slice.charCodeAt(slice.length - 1) : codes.eof + + if ( + previous === codes.lf || + previous === codes.cr || + previous === codes.eof + ) { + return + } + + lineEnding() + } + + // Make a value safe for injection in HTML (except w/ `ignoreEncode`). + function encode(value) { + return getData('ignoreEncode') ? value : value.replace(/["&<>]/g, replace) + function replace(value) { + return '&' + characterReferences[value] + ';' + } + } + + // Make a value safe for injection as a URL. + // This does encode unsafe characters with percent-encoding, skipping already + // encoded sequences (`normalizeUri`). + // Further unsafe characters are encoded as character references (`encode`). + // Finally, if the URL includes an unknown protocol (such as a dangerous + // example, `javascript:`), the value is ignored. + function url(url, protocol) { + var value = encode(normalizeUri(url || '')) + var colon = value.indexOf(':') + var questionMark = value.indexOf('?') + var numberSign = value.indexOf('#') + var slash = value.indexOf('/') + + if ( + settings.allowDangerousProtocol || + // If there is no protocol, it’s relative. + colon < 0 || + // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol. + (slash > -1 && colon > slash) || + (questionMark > -1 && colon > questionMark) || + (numberSign > -1 && colon > numberSign) || + // It is a protocol, it should be allowed. + protocol.test(value.slice(0, colon)) + ) { + return value + } + + return '' + } + + // + // Handlers. + // + + function onenterlistordered(token) { + tightStack.push(!token._loose) + lineEndingIfNeeded() + tag('') + } else { + onexitlistitem() + } + + lineEndingIfNeeded() + tag('
  • ') + setData('expectFirstItem') + // “Hack” to prevent a line ending from showing up if the item is empty. + setData('lastWasTag') + } + + function onexitlistordered() { + onexitlistitem() + tightStack.pop() + lineEnding() + tag('') + } + + function onexitlistunordered() { + onexitlistitem() + tightStack.pop() + lineEnding() + tag('') + } + + function onexitlistitem() { + if (getData('lastWasTag') && !getData('slurpAllLineEndings')) { + lineEndingIfNeeded() + } + + tag('
  • ') + setData('slurpAllLineEndings') + } + + function onenterblockquote() { + tightStack.push(false) + lineEndingIfNeeded() + tag('
    ') + } + + function onexitblockquote() { + tightStack.pop() + lineEndingIfNeeded() + tag('
    ') + setData('slurpAllLineEndings') + } + + function onenterparagraph() { + if (!tightStack[tightStack.length - 1]) { + lineEndingIfNeeded() + tag('

    ') + } + + setData('slurpAllLineEndings') + } + + function onexitparagraph() { + if (tightStack[tightStack.length - 1]) { + setData('slurpAllLineEndings', true) + } else { + tag('

    ') + } + } + + function onentercodefenced() { + lineEndingIfNeeded() + tag('
    ')
    +      setData('fencedCodeInside', true)
    +      setData('slurpOneLineEnding', true)
    +    }
    +
    +    setData('fencesCount', getData('fencesCount') + 1)
    +  }
    +
    +  function onentercodeindented() {
    +    lineEndingIfNeeded()
    +    tag('
    ')
    +  }
    +
    +  function onexitflowcode() {
    +    // Send an extra line feed if we saw data.
    +    if (getData('flowCodeSeenData')) lineEndingIfNeeded()
    +    tag('
    ') + if (getData('fencesCount') < 2) lineEndingIfNeeded() + setData('flowCodeSeenData') + setData('fencesCount') + setData('slurpOneLineEnding') + } + + function onenterimage() { + mediaStack.push({image: true}) + tags = undefined // Disallow tags. + } + + function onenterlink() { + mediaStack.push({}) + } + + function onexitlabeltext(token) { + mediaStack[mediaStack.length - 1].labelId = this.sliceSerialize(token) + } + + function onexitlabel() { + mediaStack[mediaStack.length - 1].label = resume() + } + + function onexitreferencestring(token) { + mediaStack[mediaStack.length - 1].referenceId = this.sliceSerialize(token) + } + + function onenterresource() { + buffer() // We can have line endings in the resource, ignore them. + mediaStack[mediaStack.length - 1].destination = '' + } + + function onenterresourcedestinationstring() { + buffer() + // Ignore encoding the result, as we’ll first percent encode the url and + // encode manually after. + setData('ignoreEncode', true) + } + + function onexitresourcedestinationstring() { + mediaStack[mediaStack.length - 1].destination = resume() + setData('ignoreEncode') + } + + function onexitresourcetitlestring() { + mediaStack[mediaStack.length - 1].title = resume() + } + + function onexitmedia() { + var index = mediaStack.length - 1 // Skip current. + var media = mediaStack[index] + var context = + media.destination === undefined + ? definitions[normalizeIdentifier(media.referenceId || media.labelId)] + : media + + tags = true + + while (index--) { + if (mediaStack[index].image) { + tags = undefined + break + } + } + + if (media.image) { + tag('')
+      raw(media.label)
+      tag('') + } else { + tag('>') + raw(media.label) + tag('
    ') + } + + mediaStack.pop() + } + + function onenterdefinition() { + buffer() + mediaStack.push({}) + } + + function onexitdefinitionlabelstring(token) { + // Discard label, use the source content instead. + resume() + mediaStack[mediaStack.length - 1].labelId = this.sliceSerialize(token) + } + + function onenterdefinitiondestinationstring() { + buffer() + setData('ignoreEncode', true) + } + + function onexitdefinitiondestinationstring() { + mediaStack[mediaStack.length - 1].destination = resume() + setData('ignoreEncode') + } + + function onexitdefinitiontitlestring() { + mediaStack[mediaStack.length - 1].title = resume() + } + + function onexitdefinition() { + var id = normalizeIdentifier(mediaStack[mediaStack.length - 1].labelId) + + resume() + + if (!hasOwnProperty.call(definitions, id)) { + definitions[id] = mediaStack[mediaStack.length - 1] + } + + mediaStack.pop() + } + + function onentercontent() { + setData('slurpAllLineEndings', true) + } + + function onexitatxheadingsequence(token) { + // Exit for further sequences. + if (getData('headingRank')) return + setData('headingRank', this.sliceSerialize(token).length) + lineEndingIfNeeded() + tag('') + } + + function onentersetextheading() { + buffer() + setData('slurpAllLineEndings') + } + + function onexitsetextheadingtext() { + setData('slurpAllLineEndings', true) + } + + function onexitatxheading() { + tag('') + setData('headingRank') + } + + function onexitsetextheadinglinesequence(token) { + setData( + 'headingRank', + this.sliceSerialize(token).charCodeAt(0) === codes.equalsTo ? 1 : 2 + ) + } + + function onexitsetextheading() { + var value = resume() + lineEndingIfNeeded() + tag('') + raw(value) + tag('') + setData('slurpAllLineEndings') + setData('headingRank') + } + + function onexitdata(token) { + raw(encode(this.sliceSerialize(token))) + } + + function onexitlineending(token) { + if (getData('slurpAllLineEndings')) { + return + } + + if (getData('slurpOneLineEnding')) { + setData('slurpOneLineEnding') + return + } + + if (getData('inCodeText')) { + raw(' ') + return + } + + raw(encode(this.sliceSerialize(token))) + } + + function onexitcodeflowvalue(token) { + raw(encode(this.sliceSerialize(token))) + setData('flowCodeSeenData', true) + } + + function onexithardbreak() { + tag('
    ') + } + + function onenterhtmlflow() { + lineEndingIfNeeded() + onenterhtml() + } + + function onexithtml() { + setData('ignoreEncode') + } + + function onenterhtml() { + if (settings.allowDangerousHtml) { + setData('ignoreEncode', true) + } + } + + function onenteremphasis() { + tag('') + } + + function onenterstrong() { + tag('') + } + + function onentercodetext() { + setData('inCodeText', true) + tag('') + } + + function onexitcodetext() { + setData('inCodeText') + tag('') + } + + function onexitemphasis() { + tag('') + } + + function onexitstrong() { + tag('') + } + + function onexitthematicbreak() { + lineEndingIfNeeded() + tag('
    ') + } + + function onexitcharacterreferencemarker(token) { + setData('characterReferenceType', token.type) + } + + function onexitcharacterreferencevalue(token) { + var value = this.sliceSerialize(token) + + value = getData('characterReferenceType') + ? safeFromInt( + value, + getData('characterReferenceType') === + types.characterReferenceMarkerNumeric + ? constants.numericBaseDecimal + : constants.numericBaseHexadecimal + ) + : decodeEntity__default['default'](value) + + raw(encode(value)) + setData('characterReferenceType') + } + + function onexitautolinkprotocol(token) { + var uri = this.sliceSerialize(token) + tag('') + raw(encode(uri)) + tag('') + } + + function onexitautolinkemail(token) { + var uri = this.sliceSerialize(token) + tag('') + raw(encode(uri)) + tag('') + } +} + +module.exports = compileHtml diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/compile/html.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/compile/html.mjs new file mode 100644 index 00000000000000..3cfbe1a6511b60 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/compile/html.mjs @@ -0,0 +1,813 @@ +// While micromark is a lexer/tokenizer, the common case of going from markdown +// to html is currently built in as this module, even though the parts can be +// used separately to build ASTs, CSTs, or many other output formats. +// +// Having an HTML compiler built in is useful because it allows us to check for +// compliancy to CommonMark, the de facto norm of markdown, specified in roughly +// 600 input/output cases. +// +// This module has an interface which accepts lists of events instead of the +// whole at once, however, because markdown can’t be truly streaming, we buffer +// events before processing and outputting the final result. + +export default compileHtml + +import decodeEntity from 'parse-entities/decode-entity.js' +import codes from '../character/codes.mjs' +import assign from '../constant/assign.mjs' +import constants from '../constant/constants.mjs' +import own from '../constant/has-own-property.mjs' +import types from '../constant/types.mjs' +import combineHtmlExtensions from '../util/combine-html-extensions.mjs' +import chunkedPush from '../util/chunked-push.mjs' +import miniflat from '../util/miniflat.mjs' +import normalizeIdentifier from '../util/normalize-identifier.mjs' +import normalizeUri from '../util/normalize-uri.mjs' +import safeFromInt from '../util/safe-from-int.mjs' + +// This ensures that certain characters which have special meaning in HTML are +// dealt with. +// Technically, we can skip `>` and `"` in many cases, but CM includes them. +var characterReferences = {'"': 'quot', '&': 'amp', '<': 'lt', '>': 'gt'} + +// These two are allowlists of essentially safe protocols for full URLs in +// respectively the `href` (on ``) and `src` (on ``) attributes. +// They are based on what is allowed on GitHub, +// +var protocolHref = /^(https?|ircs?|mailto|xmpp)$/i +var protocolSrc = /^https?$/i + +function compileHtml(options) { + // Configuration. + // Includes `htmlExtensions` (an array of extensions), `defaultLineEnding` (a + // preferred EOL), `allowDangerousProtocol` (whether to allow potential + // dangerous protocols), and `allowDangerousHtml` (whether to allow potential + // dangerous HTML). + var settings = options || {} + // Tags is needed because according to markdown, links and emphasis and + // whatnot can exist in images, however, as HTML doesn’t allow content in + // images, the tags are ignored in the `alt` attribute, but the content + // remains. + var tags = true + // An object to track identifiers to media (URLs and titles) defined with + // definitions. + var definitions = {} + // A lot of the handlers need to capture some of the output data, modify it + // somehow, and then deal with it. + // We do that by tracking a stack of buffers, that can be opened (with + // `buffer`) and closed (with `resume`) to access them. + var buffers = [[]] + // As we can have links in images and the other way around, where the deepest + // ones are closed first, we need to track which one we’re in. + var mediaStack = [] + // Same for tightness, which is specific to lists. + // We need to track if we’re currently in a tight or loose container. + var tightStack = [] + + var defaultHandlers = { + enter: { + blockQuote: onenterblockquote, + codeFenced: onentercodefenced, + codeFencedFenceInfo: buffer, + codeFencedFenceMeta: buffer, + codeIndented: onentercodeindented, + codeText: onentercodetext, + content: onentercontent, + definition: onenterdefinition, + definitionDestinationString: onenterdefinitiondestinationstring, + definitionLabelString: buffer, + definitionTitleString: buffer, + emphasis: onenteremphasis, + htmlFlow: onenterhtmlflow, + htmlText: onenterhtml, + image: onenterimage, + label: buffer, + link: onenterlink, + listItemMarker: onenterlistitemmarker, + listItemValue: onenterlistitemvalue, + listOrdered: onenterlistordered, + listUnordered: onenterlistunordered, + paragraph: onenterparagraph, + reference: buffer, + resource: onenterresource, + resourceDestinationString: onenterresourcedestinationstring, + resourceTitleString: buffer, + setextHeading: onentersetextheading, + strong: onenterstrong + }, + exit: { + atxHeading: onexitatxheading, + atxHeadingSequence: onexitatxheadingsequence, + autolinkEmail: onexitautolinkemail, + autolinkProtocol: onexitautolinkprotocol, + blockQuote: onexitblockquote, + characterEscapeValue: onexitdata, + characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, + characterReferenceMarkerNumeric: onexitcharacterreferencemarker, + characterReferenceValue: onexitcharacterreferencevalue, + codeFenced: onexitflowcode, + codeFencedFence: onexitcodefencedfence, + codeFencedFenceInfo: onexitcodefencedfenceinfo, + codeFencedFenceMeta: resume, + codeFlowValue: onexitcodeflowvalue, + codeIndented: onexitflowcode, + codeText: onexitcodetext, + codeTextData: onexitdata, + data: onexitdata, + definition: onexitdefinition, + definitionDestinationString: onexitdefinitiondestinationstring, + definitionLabelString: onexitdefinitionlabelstring, + definitionTitleString: onexitdefinitiontitlestring, + emphasis: onexitemphasis, + hardBreakEscape: onexithardbreak, + hardBreakTrailing: onexithardbreak, + htmlFlow: onexithtml, + htmlFlowData: onexitdata, + htmlText: onexithtml, + htmlTextData: onexitdata, + image: onexitmedia, + label: onexitlabel, + labelText: onexitlabeltext, + lineEnding: onexitlineending, + link: onexitmedia, + listOrdered: onexitlistordered, + listUnordered: onexitlistunordered, + paragraph: onexitparagraph, + reference: resume, + referenceString: onexitreferencestring, + resource: resume, + resourceDestinationString: onexitresourcedestinationstring, + resourceTitleString: onexitresourcetitlestring, + setextHeading: onexitsetextheading, + setextHeadingLineSequence: onexitsetextheadinglinesequence, + setextHeadingText: onexitsetextheadingtext, + strong: onexitstrong, + thematicBreak: onexitthematicbreak + } + } + + // Combine the HTML extensions with the default handlers. + // An HTML extension is an object whose fields are either `enter` or `exit` + // (reflecting whether a token is entered or exited). + // The values at such objects are names of tokens mapping to handlers. + // Handlers are called, respectively when a token is opener or closed, with + // that token, and a context as `this`. + var handlers = combineHtmlExtensions( + [defaultHandlers].concat(miniflat(settings.htmlExtensions)) + ) + + // Handlers do often need to keep track of some state. + // That state is provided here as a key-value store (an object). + var data = {tightStack: tightStack} + + // The context for handlers references a couple of useful functions. + // In handlers from extensions, those can be accessed at `this`. + // For the handlers here, they can be accessed directly. + var context = { + lineEndingIfNeeded: lineEndingIfNeeded, + options: settings, + encode: encode, + raw: raw, + tag: tag, + buffer: buffer, + resume: resume, + setData: setData, + getData: getData + } + + // Generally, micromark copies line endings (`'\r'`, `'\n'`, `'\r\n'`) in the + // markdown document over to the compiled HTML. + // In some cases, such as `> a`, CommonMark requires that extra line endings + // are added: `
    \n

    a

    \n
    `. + // This variable hold the default line ending when given (or `undefined`), + // and in the latter case will be updated to the first found line ending if + // there is one. + var lineEndingStyle = settings.defaultLineEnding + + // Return the function that handles a slice of events. + return compile + + // Deal w/ a slice of events. + // Return either the empty string if there’s nothing of note to return, or the + // result when done. + function compile(events) { + // As definitions can come after references, we need to figure out the media + // (urls and titles) defined by them before handling the references. + // So, we do sort of what HTML does: put metadata at the start (in head), and + // then put content after (`body`). + var head = [] + var body = [] + var index + var start + var listStack + var handler + var result + + index = -1 + start = 0 + listStack = [] + + while (++index < events.length) { + // Figure out the line ending style used in the document. + if ( + !lineEndingStyle && + (events[index][1].type === types.lineEnding || + events[index][1].type === types.lineEndingBlank) + ) { + lineEndingStyle = events[index][2].sliceSerialize(events[index][1]) + } + + // Preprocess lists to infer whether the list is loose or not. + if ( + events[index][1].type === types.listOrdered || + events[index][1].type === types.listUnordered + ) { + if (events[index][0] === 'enter') { + listStack.push(index) + } else { + prepareList(events.slice(listStack.pop(), index)) + } + } + + // Move definitions to the front. + if (events[index][1].type === types.definition) { + if (events[index][0] === 'enter') { + body = chunkedPush(body, events.slice(start, index)) + start = index + } else { + head = chunkedPush(head, events.slice(start, index + 1)) + start = index + 1 + } + } + } + + head = chunkedPush(head, body) + head = chunkedPush(head, events.slice(start)) + result = head + index = -1 + + // Handle the start of the document, if defined. + if (handlers.enter.null) { + handlers.enter.null.call(context) + } + + // Handle all events. + while (++index < events.length) { + handler = handlers[result[index][0]] + + if (own.call(handler, result[index][1].type)) { + handler[result[index][1].type].call( + assign({sliceSerialize: result[index][2].sliceSerialize}, context), + result[index][1] + ) + } + } + + // Handle the end of the document, if defined. + if (handlers.exit.null) { + handlers.exit.null.call(context) + } + + return buffers[0].join('') + } + + // Figure out whether lists are loose or not. + function prepareList(slice) { + var length = slice.length - 1 // Skip close. + var index = 0 // Skip open. + var containerBalance = 0 + var loose + var atMarker + var event + + while (++index < length) { + event = slice[index] + + if (event[1]._container) { + atMarker = undefined + + if (event[0] === 'enter') { + containerBalance++ + } else { + containerBalance-- + } + } else if (event[1].type === types.listItemPrefix) { + if (event[0] === 'exit') { + atMarker = true + } + } else if (event[1].type === types.linePrefix) { + // Ignore + } else if (event[1].type === types.lineEndingBlank) { + if (event[0] === 'enter' && !containerBalance) { + if (atMarker) { + atMarker = undefined + } else { + loose = true + } + } + } else { + atMarker = undefined + } + } + + slice[0][1]._loose = loose + } + + // Set data into the key-value store. + function setData(key, value) { + data[key] = value + } + + // Get data from the key-value store. + function getData(key) { + return data[key] + } + + // Capture some of the output data. + function buffer() { + buffers.push([]) + } + + // Stop capturing and access the output data. + function resume() { + return buffers.pop().join('') + } + + // Output (parts of) HTML tags. + function tag(value) { + if (!tags) return + setData('lastWasTag', true) + buffers[buffers.length - 1].push(value) + } + + // Output raw data. + function raw(value) { + setData('lastWasTag') + buffers[buffers.length - 1].push(value) + } + + // Output an extra line ending. + function lineEnding() { + raw(lineEndingStyle || '\n') + } + + // Output an extra line ending if the previous value wasn’t EOF/EOL. + function lineEndingIfNeeded() { + var buffer = buffers[buffers.length - 1] + var slice = buffer[buffer.length - 1] + var previous = slice ? slice.charCodeAt(slice.length - 1) : codes.eof + + if ( + previous === codes.lf || + previous === codes.cr || + previous === codes.eof + ) { + return + } + + lineEnding() + } + + // Make a value safe for injection in HTML (except w/ `ignoreEncode`). + function encode(value) { + return getData('ignoreEncode') ? value : value.replace(/["&<>]/g, replace) + function replace(value) { + return '&' + characterReferences[value] + ';' + } + } + + // Make a value safe for injection as a URL. + // This does encode unsafe characters with percent-encoding, skipping already + // encoded sequences (`normalizeUri`). + // Further unsafe characters are encoded as character references (`encode`). + // Finally, if the URL includes an unknown protocol (such as a dangerous + // example, `javascript:`), the value is ignored. + function url(url, protocol) { + var value = encode(normalizeUri(url || '')) + var colon = value.indexOf(':') + var questionMark = value.indexOf('?') + var numberSign = value.indexOf('#') + var slash = value.indexOf('/') + + if ( + settings.allowDangerousProtocol || + // If there is no protocol, it’s relative. + colon < 0 || + // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol. + (slash > -1 && colon > slash) || + (questionMark > -1 && colon > questionMark) || + (numberSign > -1 && colon > numberSign) || + // It is a protocol, it should be allowed. + protocol.test(value.slice(0, colon)) + ) { + return value + } + + return '' + } + + // + // Handlers. + // + + function onenterlistordered(token) { + tightStack.push(!token._loose) + lineEndingIfNeeded() + tag('') + } else { + onexitlistitem() + } + + lineEndingIfNeeded() + tag('
  • ') + setData('expectFirstItem') + // “Hack” to prevent a line ending from showing up if the item is empty. + setData('lastWasTag') + } + + function onexitlistordered() { + onexitlistitem() + tightStack.pop() + lineEnding() + tag('') + } + + function onexitlistunordered() { + onexitlistitem() + tightStack.pop() + lineEnding() + tag('') + } + + function onexitlistitem() { + if (getData('lastWasTag') && !getData('slurpAllLineEndings')) { + lineEndingIfNeeded() + } + + tag('
  • ') + setData('slurpAllLineEndings') + } + + function onenterblockquote() { + tightStack.push(false) + lineEndingIfNeeded() + tag('
    ') + } + + function onexitblockquote() { + tightStack.pop() + lineEndingIfNeeded() + tag('
    ') + setData('slurpAllLineEndings') + } + + function onenterparagraph() { + if (!tightStack[tightStack.length - 1]) { + lineEndingIfNeeded() + tag('

    ') + } + + setData('slurpAllLineEndings') + } + + function onexitparagraph() { + if (tightStack[tightStack.length - 1]) { + setData('slurpAllLineEndings', true) + } else { + tag('

    ') + } + } + + function onentercodefenced() { + lineEndingIfNeeded() + tag('
    ')
    +      setData('fencedCodeInside', true)
    +      setData('slurpOneLineEnding', true)
    +    }
    +
    +    setData('fencesCount', getData('fencesCount') + 1)
    +  }
    +
    +  function onentercodeindented() {
    +    lineEndingIfNeeded()
    +    tag('
    ')
    +  }
    +
    +  function onexitflowcode() {
    +    // Send an extra line feed if we saw data.
    +    if (getData('flowCodeSeenData')) lineEndingIfNeeded()
    +    tag('
    ') + if (getData('fencesCount') < 2) lineEndingIfNeeded() + setData('flowCodeSeenData') + setData('fencesCount') + setData('slurpOneLineEnding') + } + + function onenterimage() { + mediaStack.push({image: true}) + tags = undefined // Disallow tags. + } + + function onenterlink() { + mediaStack.push({}) + } + + function onexitlabeltext(token) { + mediaStack[mediaStack.length - 1].labelId = this.sliceSerialize(token) + } + + function onexitlabel() { + mediaStack[mediaStack.length - 1].label = resume() + } + + function onexitreferencestring(token) { + mediaStack[mediaStack.length - 1].referenceId = this.sliceSerialize(token) + } + + function onenterresource() { + buffer() // We can have line endings in the resource, ignore them. + mediaStack[mediaStack.length - 1].destination = '' + } + + function onenterresourcedestinationstring() { + buffer() + // Ignore encoding the result, as we’ll first percent encode the url and + // encode manually after. + setData('ignoreEncode', true) + } + + function onexitresourcedestinationstring() { + mediaStack[mediaStack.length - 1].destination = resume() + setData('ignoreEncode') + } + + function onexitresourcetitlestring() { + mediaStack[mediaStack.length - 1].title = resume() + } + + function onexitmedia() { + var index = mediaStack.length - 1 // Skip current. + var media = mediaStack[index] + var context = + media.destination === undefined + ? definitions[normalizeIdentifier(media.referenceId || media.labelId)] + : media + + tags = true + + while (index--) { + if (mediaStack[index].image) { + tags = undefined + break + } + } + + if (media.image) { + tag('')
+      raw(media.label)
+      tag('') + } else { + tag('>') + raw(media.label) + tag('
    ') + } + + mediaStack.pop() + } + + function onenterdefinition() { + buffer() + mediaStack.push({}) + } + + function onexitdefinitionlabelstring(token) { + // Discard label, use the source content instead. + resume() + mediaStack[mediaStack.length - 1].labelId = this.sliceSerialize(token) + } + + function onenterdefinitiondestinationstring() { + buffer() + setData('ignoreEncode', true) + } + + function onexitdefinitiondestinationstring() { + mediaStack[mediaStack.length - 1].destination = resume() + setData('ignoreEncode') + } + + function onexitdefinitiontitlestring() { + mediaStack[mediaStack.length - 1].title = resume() + } + + function onexitdefinition() { + var id = normalizeIdentifier(mediaStack[mediaStack.length - 1].labelId) + + resume() + + if (!own.call(definitions, id)) { + definitions[id] = mediaStack[mediaStack.length - 1] + } + + mediaStack.pop() + } + + function onentercontent() { + setData('slurpAllLineEndings', true) + } + + function onexitatxheadingsequence(token) { + // Exit for further sequences. + if (getData('headingRank')) return + setData('headingRank', this.sliceSerialize(token).length) + lineEndingIfNeeded() + tag('') + } + + function onentersetextheading() { + buffer() + setData('slurpAllLineEndings') + } + + function onexitsetextheadingtext() { + setData('slurpAllLineEndings', true) + } + + function onexitatxheading() { + tag('') + setData('headingRank') + } + + function onexitsetextheadinglinesequence(token) { + setData( + 'headingRank', + this.sliceSerialize(token).charCodeAt(0) === codes.equalsTo ? 1 : 2 + ) + } + + function onexitsetextheading() { + var value = resume() + lineEndingIfNeeded() + tag('') + raw(value) + tag('') + setData('slurpAllLineEndings') + setData('headingRank') + } + + function onexitdata(token) { + raw(encode(this.sliceSerialize(token))) + } + + function onexitlineending(token) { + if (getData('slurpAllLineEndings')) { + return + } + + if (getData('slurpOneLineEnding')) { + setData('slurpOneLineEnding') + return + } + + if (getData('inCodeText')) { + raw(' ') + return + } + + raw(encode(this.sliceSerialize(token))) + } + + function onexitcodeflowvalue(token) { + raw(encode(this.sliceSerialize(token))) + setData('flowCodeSeenData', true) + } + + function onexithardbreak() { + tag('
    ') + } + + function onenterhtmlflow() { + lineEndingIfNeeded() + onenterhtml() + } + + function onexithtml() { + setData('ignoreEncode') + } + + function onenterhtml() { + if (settings.allowDangerousHtml) { + setData('ignoreEncode', true) + } + } + + function onenteremphasis() { + tag('') + } + + function onenterstrong() { + tag('') + } + + function onentercodetext() { + setData('inCodeText', true) + tag('') + } + + function onexitcodetext() { + setData('inCodeText') + tag('') + } + + function onexitemphasis() { + tag('') + } + + function onexitstrong() { + tag('') + } + + function onexitthematicbreak() { + lineEndingIfNeeded() + tag('
    ') + } + + function onexitcharacterreferencemarker(token) { + setData('characterReferenceType', token.type) + } + + function onexitcharacterreferencevalue(token) { + var value = this.sliceSerialize(token) + + value = getData('characterReferenceType') + ? safeFromInt( + value, + getData('characterReferenceType') === + types.characterReferenceMarkerNumeric + ? constants.numericBaseDecimal + : constants.numericBaseHexadecimal + ) + : decodeEntity(value) + + raw(encode(value)) + setData('characterReferenceType') + } + + function onexitautolinkprotocol(token) { + var uri = this.sliceSerialize(token) + tag('') + raw(encode(uri)) + tag('') + } + + function onexitautolinkemail(token) { + var uri = this.sliceSerialize(token) + tag('') + raw(encode(uri)) + tag('') + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/assign.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/assign.js new file mode 100644 index 00000000000000..b6ae48a0903c93 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/assign.js @@ -0,0 +1,5 @@ +'use strict' + +var assign = Object.assign + +module.exports = assign diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/assign.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/assign.mjs new file mode 100644 index 00000000000000..8cfbca32c571ef --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/assign.mjs @@ -0,0 +1 @@ +export default Object.assign diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/constants.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/constants.js new file mode 100644 index 00000000000000..cd75c0718a9783 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/constants.js @@ -0,0 +1,45 @@ +'use strict' + +// This module is compiled away! +// +// Parsing markdown comes with a couple of constants, such as minimum or maximum +// sizes of certain sequences. +// Additionally, there are a couple symbols used inside micromark. +// These are all defined here, but compiled away by scripts. +var constants = { + attentionSideBefore: 1, // Symbol to mark an attention sequence as before content: `*a` + attentionSideAfter: 2, // Symbol to mark an attention sequence as after content: `a*` + atxHeadingOpeningFenceSizeMax: 6, // 6 number signs is fine, 7 isn’t. + autolinkDomainSizeMax: 63, // 63 characters is fine, 64 is too many. + autolinkSchemeSizeMax: 32, // 32 characters is fine, 33 is too many. + cdataOpeningString: 'CDATA[', // And preceded by `` + htmlComment: 2, // Symbol for `` + htmlInstruction: 3, // Symbol for `` + htmlDeclaration: 4, // Symbol for `` + htmlCdata: 5, // Symbol for `` + htmlBasic: 6, // Symbol for `` + htmlRawSizeMax: 8, // Length of `textarea`. + linkResourceDestinationBalanceMax: 3, // See: + linkReferenceSizeMax: 999, // See: + listItemValueSizeMax: 10, // See: + numericBaseDecimal: 10, + numericBaseHexadecimal: 0x10, + tabSize: 4, // Tabs have a hard-coded size of 4, per CommonMark. + thematicBreakMarkerCountMin: 3, // At least 3 asterisks, dashes, or underscores are needed. + v8MaxSafeChunkSize: 10000 // V8 (and potentially others) have problems injecting giant arrays into other arrays, hence we operate in chunks. +} + +module.exports = constants diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/constants.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/constants.mjs new file mode 100644 index 00000000000000..65db9017671d09 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/constants.mjs @@ -0,0 +1,41 @@ +// This module is compiled away! +// +// Parsing markdown comes with a couple of constants, such as minimum or maximum +// sizes of certain sequences. +// Additionally, there are a couple symbols used inside micromark. +// These are all defined here, but compiled away by scripts. +export default { + attentionSideBefore: 1, // Symbol to mark an attention sequence as before content: `*a` + attentionSideAfter: 2, // Symbol to mark an attention sequence as after content: `a*` + atxHeadingOpeningFenceSizeMax: 6, // 6 number signs is fine, 7 isn’t. + autolinkDomainSizeMax: 63, // 63 characters is fine, 64 is too many. + autolinkSchemeSizeMax: 32, // 32 characters is fine, 33 is too many. + cdataOpeningString: 'CDATA[', // And preceded by `` + htmlComment: 2, // Symbol for `` + htmlInstruction: 3, // Symbol for `` + htmlDeclaration: 4, // Symbol for `` + htmlCdata: 5, // Symbol for `` + htmlBasic: 6, // Symbol for `` + htmlRawSizeMax: 8, // Length of `textarea`. + linkResourceDestinationBalanceMax: 3, // See: + linkReferenceSizeMax: 999, // See: + listItemValueSizeMax: 10, // See: + numericBaseDecimal: 10, + numericBaseHexadecimal: 0x10, + tabSize: 4, // Tabs have a hard-coded size of 4, per CommonMark. + thematicBreakMarkerCountMin: 3, // At least 3 asterisks, dashes, or underscores are needed. + v8MaxSafeChunkSize: 10000 // V8 (and potentially others) have problems injecting giant arrays into other arrays, hence we operate in chunks. +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/from-char-code.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/from-char-code.js new file mode 100644 index 00000000000000..232eac74053d18 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/from-char-code.js @@ -0,0 +1,5 @@ +'use strict' + +var fromCharCode = String.fromCharCode + +module.exports = fromCharCode diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/from-char-code.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/from-char-code.mjs new file mode 100644 index 00000000000000..0476a76366caff --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/from-char-code.mjs @@ -0,0 +1 @@ +export default String.fromCharCode diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/has-own-property.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/has-own-property.js new file mode 100644 index 00000000000000..aa9197cd2593d1 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/has-own-property.js @@ -0,0 +1,5 @@ +'use strict' + +var own = {}.hasOwnProperty + +module.exports = own diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/has-own-property.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/has-own-property.mjs new file mode 100644 index 00000000000000..1da16d6dd42e4e --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/has-own-property.mjs @@ -0,0 +1 @@ +export default {}.hasOwnProperty diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/html-block-names.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/html-block-names.js new file mode 100644 index 00000000000000..9b5ada73f0671a --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/html-block-names.js @@ -0,0 +1,69 @@ +'use strict' + +// This module is copied from . +var basics = [ + 'address', + 'article', + 'aside', + 'base', + 'basefont', + 'blockquote', + 'body', + 'caption', + 'center', + 'col', + 'colgroup', + 'dd', + 'details', + 'dialog', + 'dir', + 'div', + 'dl', + 'dt', + 'fieldset', + 'figcaption', + 'figure', + 'footer', + 'form', + 'frame', + 'frameset', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'head', + 'header', + 'hr', + 'html', + 'iframe', + 'legend', + 'li', + 'link', + 'main', + 'menu', + 'menuitem', + 'nav', + 'noframes', + 'ol', + 'optgroup', + 'option', + 'p', + 'param', + 'section', + 'source', + 'summary', + 'table', + 'tbody', + 'td', + 'tfoot', + 'th', + 'thead', + 'title', + 'tr', + 'track', + 'ul' +] + +module.exports = basics diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/block-elements.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/html-block-names.mjs similarity index 87% rename from tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/block-elements.js rename to tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/html-block-names.mjs index c73efac9bb2786..8d974d8f35cbd0 100644 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/block-elements.js +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/html-block-names.mjs @@ -1,6 +1,5 @@ -'use strict' - -module.exports = [ +// This module is copied from . +export default [ 'address', 'article', 'aside', @@ -34,7 +33,6 @@ module.exports = [ 'h6', 'head', 'header', - 'hgroup', 'hr', 'html', 'iframe', @@ -44,7 +42,6 @@ module.exports = [ 'main', 'menu', 'menuitem', - 'meta', 'nav', 'noframes', 'ol', @@ -52,10 +49,8 @@ module.exports = [ 'option', 'p', 'param', - 'pre', 'section', 'source', - 'title', 'summary', 'table', 'tbody', diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/html-raw-names.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/html-raw-names.js new file mode 100644 index 00000000000000..c22a3954291f82 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/html-raw-names.js @@ -0,0 +1,6 @@ +'use strict' + +// This module is copied from . +var raws = ['pre', 'script', 'style', 'textarea'] + +module.exports = raws diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/html-raw-names.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/html-raw-names.mjs new file mode 100644 index 00000000000000..2da5febe3f80fb --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/html-raw-names.mjs @@ -0,0 +1,2 @@ +// This module is copied from . +export default ['pre', 'script', 'style', 'textarea'] diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/splice.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/splice.js new file mode 100644 index 00000000000000..8917210ac71670 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/splice.js @@ -0,0 +1,5 @@ +'use strict' + +var splice = [].splice + +module.exports = splice diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/splice.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/splice.mjs new file mode 100644 index 00000000000000..482404ddf7a96e --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/splice.mjs @@ -0,0 +1 @@ +export default [].splice diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/types.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/types.js new file mode 100644 index 00000000000000..11d9e4ed1dda90 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/types.js @@ -0,0 +1,452 @@ +'use strict' + +// This module is compiled away! +// +// Here is the list of all types of tokens exposed by micromark, with a short +// explanation of what they include and where they are found. +// In picking names, generally, the rule is to be as explicit as possible +// instead of reusing names. +// For example, there is a `definitionDestination` and a `resourceDestination`, +// instead of one shared name. + +var types = { + // Generic type for data, such as in a title, a destination, etc. + data: 'data', + + // Generic type for syntactic whitespace (tabs, virtual spaces, spaces). + // Such as, between a fenced code fence and an info string. + whitespace: 'whitespace', + + // Generic type for line endings (line feed, carriage return, carriage return + + // line feed). + lineEnding: 'lineEnding', + + // A line ending, but ending a blank line. + lineEndingBlank: 'lineEndingBlank', + + // Generic type for whitespace (tabs, virtual spaces, spaces) at the start of a + // line. + linePrefix: 'linePrefix', + + // Generic type for whitespace (tabs, virtual spaces, spaces) at the end of a + // line. + lineSuffix: 'lineSuffix', + + // Whole ATX heading: + // + // ```markdown + // # + // ## Alpha + // ### Bravo ### + // ``` + // + // Includes `atxHeadingSequence`, `whitespace`, `atxHeadingText`. + atxHeading: 'atxHeading', + + // Sequence of number signs in an ATX heading (`###`). + atxHeadingSequence: 'atxHeadingSequence', + + // Content in an ATX heading (`alpha`). + // Includes text. + atxHeadingText: 'atxHeadingText', + + // Whole autolink (`` or ``) + // Includes `autolinkMarker` and `autolinkProtocol` or `autolinkEmail`. + autolink: 'autolink', + + // Email autolink w/o markers (`admin@example.com`) + autolinkEmail: 'autolinkEmail', + + // Marker around an `autolinkProtocol` or `autolinkEmail` (`<` or `>`). + autolinkMarker: 'autolinkMarker', + + // Protocol autolink w/o markers (`https://example.com`) + autolinkProtocol: 'autolinkProtocol', + + // A whole character escape (`\-`). + // Includes `escapeMarker` and `characterEscapeValue`. + characterEscape: 'characterEscape', + + // The escaped character (`-`). + characterEscapeValue: 'characterEscapeValue', + + // A whole character reference (`&`, `≠`, or `𝌆`). + // Includes `characterReferenceMarker`, an optional + // `characterReferenceMarkerNumeric`, in which case an optional + // `characterReferenceMarkerHexadecimal`, and a `characterReferenceValue`. + characterReference: 'characterReference', + + // The start or end marker (`&` or `;`). + characterReferenceMarker: 'characterReferenceMarker', + + // Mark reference as numeric (`#`). + characterReferenceMarkerNumeric: 'characterReferenceMarkerNumeric', + + // Mark reference as numeric (`x` or `X`). + characterReferenceMarkerHexadecimal: 'characterReferenceMarkerHexadecimal', + + // Value of character reference w/o markers (`amp`, `8800`, or `1D306`). + characterReferenceValue: 'characterReferenceValue', + + // Whole fenced code: + // + // ````markdown + // ```js + // alert(1) + // ``` + // ```` + codeFenced: 'codeFenced', + + // A fenced code fence, including whitespace, sequence, info, and meta + // (` ```js `). + codeFencedFence: 'codeFencedFence', + + // Sequence of grave accent or tilde characters (` ``` `) in a fence. + codeFencedFenceSequence: 'codeFencedFenceSequence', + + // Info word (`js`) in a fence. + // Includes string. + codeFencedFenceInfo: 'codeFencedFenceInfo', + + // Meta words (`highlight="1"`) in a fence. + // Includes string. + codeFencedFenceMeta: 'codeFencedFenceMeta', + + // A line of code. + codeFlowValue: 'codeFlowValue', + + // Whole indented code: + // + // ```markdown + // alert(1) + // ``` + // + // Includes `lineEnding`, `linePrefix`, and `codeFlowValue`. + codeIndented: 'codeIndented', + + // A text code (``` `alpha` ```). + // Includes `codeTextSequence`, `codeTextData`, `lineEnding`, and can include + // `codeTextPadding`. + codeText: 'codeText', + + codeTextData: 'codeTextData', + + // A space or line ending right after or before a tick. + codeTextPadding: 'codeTextPadding', + + // A text code fence (` `` `). + codeTextSequence: 'codeTextSequence', + + // Whole content: + // + // ```markdown + // [a]: b + // c + // = + // d + // ``` + // + // Includes `paragraph` and `definition`. + content: 'content', + // Whole definition: + // + // ```markdown + // [micromark]: https://github.com/micromark/micromark + // ``` + // + // Includes `definitionLabel`, `definitionMarker`, `whitespace`, + // `definitionDestination`, and optionally `lineEnding` and `definitionTitle`. + definition: 'definition', + + // Destination of a definition (`https://github.com/micromark/micromark` or + // ``). + // Includes `definitionDestinationLiteral` or `definitionDestinationRaw`. + definitionDestination: 'definitionDestination', + + // Enclosed destination of a definition + // (``). + // Includes `definitionDestinationLiteralMarker` and optionally + // `definitionDestinationString`. + definitionDestinationLiteral: 'definitionDestinationLiteral', + + // Markers of an enclosed definition destination (`<` or `>`). + definitionDestinationLiteralMarker: 'definitionDestinationLiteralMarker', + + // Unenclosed destination of a definition + // (`https://github.com/micromark/micromark`). + // Includes `definitionDestinationString`. + definitionDestinationRaw: 'definitionDestinationRaw', + + // Text in an destination (`https://github.com/micromark/micromark`). + // Includes string. + definitionDestinationString: 'definitionDestinationString', + + // Label of a definition (`[micromark]`). + // Includes `definitionLabelMarker` and `definitionLabelString`. + definitionLabel: 'definitionLabel', + + // Markers of a definition label (`[` or `]`). + definitionLabelMarker: 'definitionLabelMarker', + + // Value of a definition label (`micromark`). + // Includes string. + definitionLabelString: 'definitionLabelString', + + // Marker between a label and a destination (`:`). + definitionMarker: 'definitionMarker', + + // Title of a definition (`"x"`, `'y'`, or `(z)`). + // Includes `definitionTitleMarker` and optionally `definitionTitleString`. + definitionTitle: 'definitionTitle', + + // Marker around a title of a definition (`"`, `'`, `(`, or `)`). + definitionTitleMarker: 'definitionTitleMarker', + + // Data without markers in a title (`z`). + // Includes string. + definitionTitleString: 'definitionTitleString', + + // Emphasis (`*alpha*`). + // Includes `emphasisSequence` and `emphasisText`. + emphasis: 'emphasis', + + // Sequence of emphasis markers (`*` or `_`). + emphasisSequence: 'emphasisSequence', + + // Emphasis text (`alpha`). + // Includes text. + emphasisText: 'emphasisText', + + // The character escape marker (`\`). + escapeMarker: 'escapeMarker', + + // A hard break created with a backslash (`\\n`). + // Includes `escapeMarker` (does not include the line ending) + hardBreakEscape: 'hardBreakEscape', + + // A hard break created with trailing spaces (` \n`). + // Does not include the line ending. + hardBreakTrailing: 'hardBreakTrailing', + + // Flow HTML: + // + // ```markdown + //
    b`). + // Includes `lineEnding`, `htmlTextData`. + htmlText: 'htmlText', + + htmlTextData: 'htmlTextData', + + // Whole image (`![alpha](bravo)`, `![alpha][bravo]`, `![alpha][]`, or + // `![alpha]`). + // Includes `label` and an optional `resource` or `reference`. + image: 'image', + + // Whole link label (`[*alpha*]`). + // Includes `labelLink` or `labelImage`, `labelText`, and `labelEnd`. + label: 'label', + + // Text in an label (`*alpha*`). + // Includes text. + labelText: 'labelText', + + // Start a link label (`[`). + // Includes a `labelMarker`. + labelLink: 'labelLink', + + // Start an image label (`![`). + // Includes `labelImageMarker` and `labelMarker`. + labelImage: 'labelImage', + + // Marker of a label (`[` or `]`). + labelMarker: 'labelMarker', + + // Marker to start an image (`!`). + labelImageMarker: 'labelImageMarker', + + // End a label (`]`). + // Includes `labelMarker`. + labelEnd: 'labelEnd', + + // Whole link (`[alpha](bravo)`, `[alpha][bravo]`, `[alpha][]`, or `[alpha]`). + // Includes `label` and an optional `resource` or `reference`. + link: 'link', + + // Whole paragraph: + // + // ```markdown + // alpha + // bravo. + // ``` + // + // Includes text. + paragraph: 'paragraph', + + // A reference (`[alpha]` or `[]`). + // Includes `referenceMarker` and an optional `referenceString`. + reference: 'reference', + + // A reference marker (`[` or `]`). + referenceMarker: 'referenceMarker', + + // Reference text (`alpha`). + // Includes string. + referenceString: 'referenceString', + + // A resource (`(https://example.com "alpha")`). + // Includes `resourceMarker`, an optional `resourceDestination` with an optional + // `whitespace` and `resourceTitle`. + resource: 'resource', + + // A resource destination (`https://example.com`). + // Includes `resourceDestinationLiteral` or `resourceDestinationRaw`. + resourceDestination: 'resourceDestination', + + // A literal resource destination (``). + // Includes `resourceDestinationLiteralMarker` and optionally + // `resourceDestinationString`. + resourceDestinationLiteral: 'resourceDestinationLiteral', + + // A resource destination marker (`<` or `>`). + resourceDestinationLiteralMarker: 'resourceDestinationLiteralMarker', + + // A raw resource destination (`https://example.com`). + // Includes `resourceDestinationString`. + resourceDestinationRaw: 'resourceDestinationRaw', + + // Resource destination text (`https://example.com`). + // Includes string. + resourceDestinationString: 'resourceDestinationString', + + // A resource marker (`(` or `)`). + resourceMarker: 'resourceMarker', + + // A resource title (`"alpha"`, `'alpha'`, or `(alpha)`). + // Includes `resourceTitleMarker` and optionally `resourceTitleString`. + resourceTitle: 'resourceTitle', + + // A resource title marker (`"`, `'`, `(`, or `)`). + resourceTitleMarker: 'resourceTitleMarker', + + // Resource destination title (`alpha`). + // Includes string. + resourceTitleString: 'resourceTitleString', + + // Whole setext heading: + // + // ```markdown + // alpha + // bravo + // ===== + // ``` + // + // Includes `setextHeadingText`, `lineEnding`, `linePrefix`, and + // `setextHeadingLine`. + setextHeading: 'setextHeading', + + // Content in a setext heading (`alpha\nbravo`). + // Includes text. + setextHeadingText: 'setextHeadingText', + + // Underline in a setext heading, including whitespace suffix (`==`). + // Includes `setextHeadingLineSequence`. + setextHeadingLine: 'setextHeadingLine', + + // Sequence of equals or dash characters in underline in a setext heading (`-`). + setextHeadingLineSequence: 'setextHeadingLineSequence', + + // Strong (`**alpha**`). + // Includes `strongSequence` and `strongText`. + strong: 'strong', + + // Sequence of strong markers (`**` or `__`). + strongSequence: 'strongSequence', + + // Strong text (`alpha`). + // Includes text. + strongText: 'strongText', + + // Whole thematic break: + // + // ```markdown + // * * * + // ``` + // + // Includes `thematicBreakSequence` and `whitespace`. + thematicBreak: 'thematicBreak', + + // A sequence of one or more thematic break markers (`***`). + thematicBreakSequence: 'thematicBreakSequence', + + // Whole block quote: + // + // ```markdown + // > a + // > + // > b + // ``` + // + // Includes `blockQuotePrefix` and flow. + blockQuote: 'blockQuote', + // The `>` or `> ` of a block quote. + blockQuotePrefix: 'blockQuotePrefix', + // The `>` of a block quote prefix. + blockQuoteMarker: 'blockQuoteMarker', + // The optional ` ` of a block quote prefix. + blockQuotePrefixWhitespace: 'blockQuotePrefixWhitespace', + + // Whole unordered list: + // + // ```markdown + // - a + // b + // ``` + // + // Includes `listItemPrefix`, flow, and optionally `listItemIndent` on further + // lines. + listOrdered: 'listOrdered', + + // Whole ordered list: + // + // ```markdown + // 1. a + // b + // ``` + // + // Includes `listItemPrefix`, flow, and optionally `listItemIndent` on further + // lines. + listUnordered: 'listUnordered', + + // The indent of further list item lines. + listItemIndent: 'listItemIndent', + + // A marker, as in, `*`, `+`, `-`, `.`, or `)`. + listItemMarker: 'listItemMarker', + + // The thing that starts a list item, such as `1. `. + // Includes `listItemValue` if ordered, `listItemMarker`, and + // `listItemPrefixWhitespace` (unless followed by a line ending). + listItemPrefix: 'listItemPrefix', + + // The whitespace after a marker. + listItemPrefixWhitespace: 'listItemPrefixWhitespace', + + // The numerical value of an ordered item. + listItemValue: 'listItemValue', + + // Internal types used for subtokenizers, compiled away + chunkContent: 'chunkContent', + chunkFlow: 'chunkFlow', + chunkText: 'chunkText', + chunkString: 'chunkString' +} + +module.exports = types diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/types.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/types.mjs new file mode 100644 index 00000000000000..d39d97900104af --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/types.mjs @@ -0,0 +1,448 @@ +// This module is compiled away! +// +// Here is the list of all types of tokens exposed by micromark, with a short +// explanation of what they include and where they are found. +// In picking names, generally, the rule is to be as explicit as possible +// instead of reusing names. +// For example, there is a `definitionDestination` and a `resourceDestination`, +// instead of one shared name. + +export default { + // Generic type for data, such as in a title, a destination, etc. + data: 'data', + + // Generic type for syntactic whitespace (tabs, virtual spaces, spaces). + // Such as, between a fenced code fence and an info string. + whitespace: 'whitespace', + + // Generic type for line endings (line feed, carriage return, carriage return + + // line feed). + lineEnding: 'lineEnding', + + // A line ending, but ending a blank line. + lineEndingBlank: 'lineEndingBlank', + + // Generic type for whitespace (tabs, virtual spaces, spaces) at the start of a + // line. + linePrefix: 'linePrefix', + + // Generic type for whitespace (tabs, virtual spaces, spaces) at the end of a + // line. + lineSuffix: 'lineSuffix', + + // Whole ATX heading: + // + // ```markdown + // # + // ## Alpha + // ### Bravo ### + // ``` + // + // Includes `atxHeadingSequence`, `whitespace`, `atxHeadingText`. + atxHeading: 'atxHeading', + + // Sequence of number signs in an ATX heading (`###`). + atxHeadingSequence: 'atxHeadingSequence', + + // Content in an ATX heading (`alpha`). + // Includes text. + atxHeadingText: 'atxHeadingText', + + // Whole autolink (`` or ``) + // Includes `autolinkMarker` and `autolinkProtocol` or `autolinkEmail`. + autolink: 'autolink', + + // Email autolink w/o markers (`admin@example.com`) + autolinkEmail: 'autolinkEmail', + + // Marker around an `autolinkProtocol` or `autolinkEmail` (`<` or `>`). + autolinkMarker: 'autolinkMarker', + + // Protocol autolink w/o markers (`https://example.com`) + autolinkProtocol: 'autolinkProtocol', + + // A whole character escape (`\-`). + // Includes `escapeMarker` and `characterEscapeValue`. + characterEscape: 'characterEscape', + + // The escaped character (`-`). + characterEscapeValue: 'characterEscapeValue', + + // A whole character reference (`&`, `≠`, or `𝌆`). + // Includes `characterReferenceMarker`, an optional + // `characterReferenceMarkerNumeric`, in which case an optional + // `characterReferenceMarkerHexadecimal`, and a `characterReferenceValue`. + characterReference: 'characterReference', + + // The start or end marker (`&` or `;`). + characterReferenceMarker: 'characterReferenceMarker', + + // Mark reference as numeric (`#`). + characterReferenceMarkerNumeric: 'characterReferenceMarkerNumeric', + + // Mark reference as numeric (`x` or `X`). + characterReferenceMarkerHexadecimal: 'characterReferenceMarkerHexadecimal', + + // Value of character reference w/o markers (`amp`, `8800`, or `1D306`). + characterReferenceValue: 'characterReferenceValue', + + // Whole fenced code: + // + // ````markdown + // ```js + // alert(1) + // ``` + // ```` + codeFenced: 'codeFenced', + + // A fenced code fence, including whitespace, sequence, info, and meta + // (` ```js `). + codeFencedFence: 'codeFencedFence', + + // Sequence of grave accent or tilde characters (` ``` `) in a fence. + codeFencedFenceSequence: 'codeFencedFenceSequence', + + // Info word (`js`) in a fence. + // Includes string. + codeFencedFenceInfo: 'codeFencedFenceInfo', + + // Meta words (`highlight="1"`) in a fence. + // Includes string. + codeFencedFenceMeta: 'codeFencedFenceMeta', + + // A line of code. + codeFlowValue: 'codeFlowValue', + + // Whole indented code: + // + // ```markdown + // alert(1) + // ``` + // + // Includes `lineEnding`, `linePrefix`, and `codeFlowValue`. + codeIndented: 'codeIndented', + + // A text code (``` `alpha` ```). + // Includes `codeTextSequence`, `codeTextData`, `lineEnding`, and can include + // `codeTextPadding`. + codeText: 'codeText', + + codeTextData: 'codeTextData', + + // A space or line ending right after or before a tick. + codeTextPadding: 'codeTextPadding', + + // A text code fence (` `` `). + codeTextSequence: 'codeTextSequence', + + // Whole content: + // + // ```markdown + // [a]: b + // c + // = + // d + // ``` + // + // Includes `paragraph` and `definition`. + content: 'content', + // Whole definition: + // + // ```markdown + // [micromark]: https://github.com/micromark/micromark + // ``` + // + // Includes `definitionLabel`, `definitionMarker`, `whitespace`, + // `definitionDestination`, and optionally `lineEnding` and `definitionTitle`. + definition: 'definition', + + // Destination of a definition (`https://github.com/micromark/micromark` or + // ``). + // Includes `definitionDestinationLiteral` or `definitionDestinationRaw`. + definitionDestination: 'definitionDestination', + + // Enclosed destination of a definition + // (``). + // Includes `definitionDestinationLiteralMarker` and optionally + // `definitionDestinationString`. + definitionDestinationLiteral: 'definitionDestinationLiteral', + + // Markers of an enclosed definition destination (`<` or `>`). + definitionDestinationLiteralMarker: 'definitionDestinationLiteralMarker', + + // Unenclosed destination of a definition + // (`https://github.com/micromark/micromark`). + // Includes `definitionDestinationString`. + definitionDestinationRaw: 'definitionDestinationRaw', + + // Text in an destination (`https://github.com/micromark/micromark`). + // Includes string. + definitionDestinationString: 'definitionDestinationString', + + // Label of a definition (`[micromark]`). + // Includes `definitionLabelMarker` and `definitionLabelString`. + definitionLabel: 'definitionLabel', + + // Markers of a definition label (`[` or `]`). + definitionLabelMarker: 'definitionLabelMarker', + + // Value of a definition label (`micromark`). + // Includes string. + definitionLabelString: 'definitionLabelString', + + // Marker between a label and a destination (`:`). + definitionMarker: 'definitionMarker', + + // Title of a definition (`"x"`, `'y'`, or `(z)`). + // Includes `definitionTitleMarker` and optionally `definitionTitleString`. + definitionTitle: 'definitionTitle', + + // Marker around a title of a definition (`"`, `'`, `(`, or `)`). + definitionTitleMarker: 'definitionTitleMarker', + + // Data without markers in a title (`z`). + // Includes string. + definitionTitleString: 'definitionTitleString', + + // Emphasis (`*alpha*`). + // Includes `emphasisSequence` and `emphasisText`. + emphasis: 'emphasis', + + // Sequence of emphasis markers (`*` or `_`). + emphasisSequence: 'emphasisSequence', + + // Emphasis text (`alpha`). + // Includes text. + emphasisText: 'emphasisText', + + // The character escape marker (`\`). + escapeMarker: 'escapeMarker', + + // A hard break created with a backslash (`\\n`). + // Includes `escapeMarker` (does not include the line ending) + hardBreakEscape: 'hardBreakEscape', + + // A hard break created with trailing spaces (` \n`). + // Does not include the line ending. + hardBreakTrailing: 'hardBreakTrailing', + + // Flow HTML: + // + // ```markdown + //
    b`). + // Includes `lineEnding`, `htmlTextData`. + htmlText: 'htmlText', + + htmlTextData: 'htmlTextData', + + // Whole image (`![alpha](bravo)`, `![alpha][bravo]`, `![alpha][]`, or + // `![alpha]`). + // Includes `label` and an optional `resource` or `reference`. + image: 'image', + + // Whole link label (`[*alpha*]`). + // Includes `labelLink` or `labelImage`, `labelText`, and `labelEnd`. + label: 'label', + + // Text in an label (`*alpha*`). + // Includes text. + labelText: 'labelText', + + // Start a link label (`[`). + // Includes a `labelMarker`. + labelLink: 'labelLink', + + // Start an image label (`![`). + // Includes `labelImageMarker` and `labelMarker`. + labelImage: 'labelImage', + + // Marker of a label (`[` or `]`). + labelMarker: 'labelMarker', + + // Marker to start an image (`!`). + labelImageMarker: 'labelImageMarker', + + // End a label (`]`). + // Includes `labelMarker`. + labelEnd: 'labelEnd', + + // Whole link (`[alpha](bravo)`, `[alpha][bravo]`, `[alpha][]`, or `[alpha]`). + // Includes `label` and an optional `resource` or `reference`. + link: 'link', + + // Whole paragraph: + // + // ```markdown + // alpha + // bravo. + // ``` + // + // Includes text. + paragraph: 'paragraph', + + // A reference (`[alpha]` or `[]`). + // Includes `referenceMarker` and an optional `referenceString`. + reference: 'reference', + + // A reference marker (`[` or `]`). + referenceMarker: 'referenceMarker', + + // Reference text (`alpha`). + // Includes string. + referenceString: 'referenceString', + + // A resource (`(https://example.com "alpha")`). + // Includes `resourceMarker`, an optional `resourceDestination` with an optional + // `whitespace` and `resourceTitle`. + resource: 'resource', + + // A resource destination (`https://example.com`). + // Includes `resourceDestinationLiteral` or `resourceDestinationRaw`. + resourceDestination: 'resourceDestination', + + // A literal resource destination (``). + // Includes `resourceDestinationLiteralMarker` and optionally + // `resourceDestinationString`. + resourceDestinationLiteral: 'resourceDestinationLiteral', + + // A resource destination marker (`<` or `>`). + resourceDestinationLiteralMarker: 'resourceDestinationLiteralMarker', + + // A raw resource destination (`https://example.com`). + // Includes `resourceDestinationString`. + resourceDestinationRaw: 'resourceDestinationRaw', + + // Resource destination text (`https://example.com`). + // Includes string. + resourceDestinationString: 'resourceDestinationString', + + // A resource marker (`(` or `)`). + resourceMarker: 'resourceMarker', + + // A resource title (`"alpha"`, `'alpha'`, or `(alpha)`). + // Includes `resourceTitleMarker` and optionally `resourceTitleString`. + resourceTitle: 'resourceTitle', + + // A resource title marker (`"`, `'`, `(`, or `)`). + resourceTitleMarker: 'resourceTitleMarker', + + // Resource destination title (`alpha`). + // Includes string. + resourceTitleString: 'resourceTitleString', + + // Whole setext heading: + // + // ```markdown + // alpha + // bravo + // ===== + // ``` + // + // Includes `setextHeadingText`, `lineEnding`, `linePrefix`, and + // `setextHeadingLine`. + setextHeading: 'setextHeading', + + // Content in a setext heading (`alpha\nbravo`). + // Includes text. + setextHeadingText: 'setextHeadingText', + + // Underline in a setext heading, including whitespace suffix (`==`). + // Includes `setextHeadingLineSequence`. + setextHeadingLine: 'setextHeadingLine', + + // Sequence of equals or dash characters in underline in a setext heading (`-`). + setextHeadingLineSequence: 'setextHeadingLineSequence', + + // Strong (`**alpha**`). + // Includes `strongSequence` and `strongText`. + strong: 'strong', + + // Sequence of strong markers (`**` or `__`). + strongSequence: 'strongSequence', + + // Strong text (`alpha`). + // Includes text. + strongText: 'strongText', + + // Whole thematic break: + // + // ```markdown + // * * * + // ``` + // + // Includes `thematicBreakSequence` and `whitespace`. + thematicBreak: 'thematicBreak', + + // A sequence of one or more thematic break markers (`***`). + thematicBreakSequence: 'thematicBreakSequence', + + // Whole block quote: + // + // ```markdown + // > a + // > + // > b + // ``` + // + // Includes `blockQuotePrefix` and flow. + blockQuote: 'blockQuote', + // The `>` or `> ` of a block quote. + blockQuotePrefix: 'blockQuotePrefix', + // The `>` of a block quote prefix. + blockQuoteMarker: 'blockQuoteMarker', + // The optional ` ` of a block quote prefix. + blockQuotePrefixWhitespace: 'blockQuotePrefixWhitespace', + + // Whole unordered list: + // + // ```markdown + // - a + // b + // ``` + // + // Includes `listItemPrefix`, flow, and optionally `listItemIndent` on further + // lines. + listOrdered: 'listOrdered', + + // Whole ordered list: + // + // ```markdown + // 1. a + // b + // ``` + // + // Includes `listItemPrefix`, flow, and optionally `listItemIndent` on further + // lines. + listUnordered: 'listUnordered', + + // The indent of further list item lines. + listItemIndent: 'listItemIndent', + + // A marker, as in, `*`, `+`, `-`, `.`, or `)`. + listItemMarker: 'listItemMarker', + + // The thing that starts a list item, such as `1. `. + // Includes `listItemValue` if ordered, `listItemMarker`, and + // `listItemPrefixWhitespace` (unless followed by a line ending). + listItemPrefix: 'listItemPrefix', + + // The whitespace after a marker. + listItemPrefixWhitespace: 'listItemPrefixWhitespace', + + // The numerical value of an ordered item. + listItemValue: 'listItemValue', + + // Internal types used for subtokenizers, compiled away + chunkContent: 'chunkContent', + chunkFlow: 'chunkFlow', + chunkText: 'chunkText', + chunkString: 'chunkString' +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/unicode-punctuation-regex.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/unicode-punctuation-regex.js new file mode 100644 index 00000000000000..6d25ee4bae5ef2 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/unicode-punctuation-regex.js @@ -0,0 +1,11 @@ +'use strict' + +// This module is generated by `script/`. +// +// CommonMark handles attention (emphasis, strong) markers based on what comes +// before or after them. +// One such difference is if those characters are Unicode punctuation. +// This script is generated from the Unicode data. +var unicodePunctuation = /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/ + +module.exports = unicodePunctuation diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/unicode-punctuation-regex.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/unicode-punctuation-regex.mjs new file mode 100644 index 00000000000000..3b6ac3f16c20ad --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constant/unicode-punctuation-regex.mjs @@ -0,0 +1,7 @@ +// This module is generated by `script/`. +// +// CommonMark handles attention (emphasis, strong) markers based on what comes +// before or after them. +// One such difference is if those characters are Unicode punctuation. +// This script is generated from the Unicode data. +export default /[!-/:-@[-`{-~\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/ diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constructs.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constructs.js new file mode 100644 index 00000000000000..d9e5ae1b529247 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constructs.js @@ -0,0 +1,98 @@ +'use strict' + +Object.defineProperty(exports, '__esModule', {value: true}) + +var text$1 = require('./initialize/text.js') +var attention = require('./tokenize/attention.js') +var autolink = require('./tokenize/autolink.js') +var blockQuote = require('./tokenize/block-quote.js') +var characterEscape = require('./tokenize/character-escape.js') +var characterReference = require('./tokenize/character-reference.js') +var codeFenced = require('./tokenize/code-fenced.js') +var codeIndented = require('./tokenize/code-indented.js') +var codeText = require('./tokenize/code-text.js') +var definition = require('./tokenize/definition.js') +var hardBreakEscape = require('./tokenize/hard-break-escape.js') +var headingAtx = require('./tokenize/heading-atx.js') +var htmlFlow = require('./tokenize/html-flow.js') +var htmlText = require('./tokenize/html-text.js') +var labelEnd = require('./tokenize/label-end.js') +var labelStartImage = require('./tokenize/label-start-image.js') +var labelStartLink = require('./tokenize/label-start-link.js') +var lineEnding = require('./tokenize/line-ending.js') +var list = require('./tokenize/list.js') +var setextUnderline = require('./tokenize/setext-underline.js') +var thematicBreak = require('./tokenize/thematic-break.js') + +var document = { + 42: list, // Asterisk + 43: list, // Plus sign + 45: list, // Dash + 48: list, // 0 + 49: list, // 1 + 50: list, // 2 + 51: list, // 3 + 52: list, // 4 + 53: list, // 5 + 54: list, // 6 + 55: list, // 7 + 56: list, // 8 + 57: list, // 9 + 62: blockQuote // Greater than +} + +var contentInitial = { + 91: definition // Left square bracket +} + +var flowInitial = { + '-2': codeIndented, // Horizontal tab + '-1': codeIndented, // Virtual space + 32: codeIndented // Space +} + +var flow = { + 35: headingAtx, // Number sign + 42: thematicBreak, // Asterisk + 45: [setextUnderline, thematicBreak], // Dash + 60: htmlFlow, // Less than + 61: setextUnderline, // Equals to + 95: thematicBreak, // Underscore + 96: codeFenced, // Grave accent + 126: codeFenced // Tilde +} + +var string = { + 38: characterReference, // Ampersand + 92: characterEscape // Backslash +} + +var text = { + '-5': lineEnding, // Carriage return + '-4': lineEnding, // Line feed + '-3': lineEnding, // Carriage return + line feed + 33: labelStartImage, // Exclamation mark + 38: characterReference, // Ampersand + 42: attention, // Asterisk + 60: [autolink, htmlText], // Less than + 91: labelStartLink, // Left square bracket + 92: [hardBreakEscape, characterEscape], // Backslash + 93: labelEnd, // Right square bracket + 95: attention, // Underscore + 96: codeText // Grave accent +} + +var insideSpan = { + null: [attention, text$1.resolver] +} + +var disable = {null: []} + +exports.contentInitial = contentInitial +exports.disable = disable +exports.document = document +exports.flow = flow +exports.flowInitial = flowInitial +exports.insideSpan = insideSpan +exports.string = string +exports.text = text diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constructs.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constructs.mjs new file mode 100644 index 00000000000000..e52c3df34974f6 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/constructs.mjs @@ -0,0 +1,85 @@ +import {resolver as resolveText} from './initialize/text.mjs' +import attention from './tokenize/attention.mjs' +import autolink from './tokenize/autolink.mjs' +import blockQuote from './tokenize/block-quote.mjs' +import characterEscape from './tokenize/character-escape.mjs' +import characterReference from './tokenize/character-reference.mjs' +import codeFenced from './tokenize/code-fenced.mjs' +import codeIndented from './tokenize/code-indented.mjs' +import codeText from './tokenize/code-text.mjs' +import definition from './tokenize/definition.mjs' +import hardBreakEscape from './tokenize/hard-break-escape.mjs' +import headingAtx from './tokenize/heading-atx.mjs' +import htmlFlow from './tokenize/html-flow.mjs' +import htmlText from './tokenize/html-text.mjs' +import labelEnd from './tokenize/label-end.mjs' +import labelImage from './tokenize/label-start-image.mjs' +import labelLink from './tokenize/label-start-link.mjs' +import lineEnding from './tokenize/line-ending.mjs' +import list from './tokenize/list.mjs' +import setextUnderline from './tokenize/setext-underline.mjs' +import thematicBreak from './tokenize/thematic-break.mjs' + +export var document = { + 42: list, // Asterisk + 43: list, // Plus sign + 45: list, // Dash + 48: list, // 0 + 49: list, // 1 + 50: list, // 2 + 51: list, // 3 + 52: list, // 4 + 53: list, // 5 + 54: list, // 6 + 55: list, // 7 + 56: list, // 8 + 57: list, // 9 + 62: blockQuote // Greater than +} + +export var contentInitial = { + 91: definition // Left square bracket +} + +export var flowInitial = { + '-2': codeIndented, // Horizontal tab + '-1': codeIndented, // Virtual space + 32: codeIndented // Space +} + +export var flow = { + 35: headingAtx, // Number sign + 42: thematicBreak, // Asterisk + 45: [setextUnderline, thematicBreak], // Dash + 60: htmlFlow, // Less than + 61: setextUnderline, // Equals to + 95: thematicBreak, // Underscore + 96: codeFenced, // Grave accent + 126: codeFenced // Tilde +} + +export var string = { + 38: characterReference, // Ampersand + 92: characterEscape // Backslash +} + +export var text = { + '-5': lineEnding, // Carriage return + '-4': lineEnding, // Line feed + '-3': lineEnding, // Carriage return + line feed + 33: labelImage, // Exclamation mark + 38: characterReference, // Ampersand + 42: attention, // Asterisk + 60: [autolink, htmlText], // Less than + 91: labelLink, // Left square bracket + 92: [hardBreakEscape, characterEscape], // Backslash + 93: labelEnd, // Right square bracket + 95: attention, // Underscore + 96: codeText // Grave accent +} + +export var insideSpan = { + null: [attention, resolveText] +} + +export var disable = {null: []} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/index.js new file mode 100644 index 00000000000000..8b289a298f114b --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/index.js @@ -0,0 +1,21 @@ +'use strict' + +var html = require('./compile/html.js') +var parse = require('./parse.js') +var postprocess = require('./postprocess.js') +var preprocess = require('./preprocess.js') + +function buffer(value, encoding, options) { + if (typeof encoding !== 'string') { + options = encoding + encoding = undefined + } + + return html(options)( + postprocess( + parse(options).document().write(preprocess()(value, encoding, true)) + ) + ) +} + +module.exports = buffer diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/index.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/index.mjs new file mode 100644 index 00000000000000..2f8db57c394435 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/index.mjs @@ -0,0 +1,19 @@ +export default buffer + +import compiler from './compile/html.mjs' +import parser from './parse.mjs' +import postprocess from './postprocess.mjs' +import preprocessor from './preprocess.mjs' + +function buffer(value, encoding, options) { + if (typeof encoding !== 'string') { + options = encoding + encoding = undefined + } + + return compiler(options)( + postprocess( + parser(options).document().write(preprocessor()(value, encoding, true)) + ) + ) +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/content.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/content.js new file mode 100644 index 00000000000000..75922234a36bf2 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/content.js @@ -0,0 +1,91 @@ +'use strict' + +Object.defineProperty(exports, '__esModule', {value: true}) + +var assert = require('assert') +var codes = require('../character/codes.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var constants = require('../constant/constants.js') +var types = require('../constant/types.js') +var factorySpace = require('../tokenize/factory-space.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +var tokenize = initializeContent + +function initializeContent(effects) { + var contentStart = effects.attempt( + this.parser.constructs.contentInitial, + afterContentStartConstruct, + paragraphInitial + ) + var previous + + return contentStart + + function afterContentStartConstruct(code) { + assert__default['default']( + code === codes.eof || markdownLineEnding(code), + 'expected eol or eof' + ) + + if (code === codes.eof) { + effects.consume(code) + return + } + + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return factorySpace(effects, contentStart, types.linePrefix) + } + + function paragraphInitial(code) { + assert__default['default']( + code !== codes.eof && !markdownLineEnding(code), + 'expected anything other than a line ending or EOF' + ) + effects.enter(types.paragraph) + return lineStart(code) + } + + function lineStart(code) { + var token = effects.enter(types.chunkText, { + contentType: constants.contentTypeText, + previous: previous + }) + + if (previous) { + previous.next = token + } + + previous = token + + return data(code) + } + + function data(code) { + if (code === codes.eof) { + effects.exit(types.chunkText) + effects.exit(types.paragraph) + effects.consume(code) + return + } + + if (markdownLineEnding(code)) { + effects.consume(code) + effects.exit(types.chunkText) + return lineStart + } + + // Data. + effects.consume(code) + return data + } +} + +exports.tokenize = tokenize diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/content.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/content.mjs new file mode 100644 index 00000000000000..73a9c41311a261 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/content.mjs @@ -0,0 +1,79 @@ +export var tokenize = initializeContent + +import assert from 'assert' +import codes from '../character/codes.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import constants from '../constant/constants.mjs' +import types from '../constant/types.mjs' +import spaceFactory from '../tokenize/factory-space.mjs' + +function initializeContent(effects) { + var contentStart = effects.attempt( + this.parser.constructs.contentInitial, + afterContentStartConstruct, + paragraphInitial + ) + var previous + + return contentStart + + function afterContentStartConstruct(code) { + assert( + code === codes.eof || markdownLineEnding(code), + 'expected eol or eof' + ) + + if (code === codes.eof) { + effects.consume(code) + return + } + + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return spaceFactory(effects, contentStart, types.linePrefix) + } + + function paragraphInitial(code) { + assert( + code !== codes.eof && !markdownLineEnding(code), + 'expected anything other than a line ending or EOF' + ) + effects.enter(types.paragraph) + return lineStart(code) + } + + function lineStart(code) { + var token = effects.enter(types.chunkText, { + contentType: constants.contentTypeText, + previous: previous + }) + + if (previous) { + previous.next = token + } + + previous = token + + return data(code) + } + + function data(code) { + if (code === codes.eof) { + effects.exit(types.chunkText) + effects.exit(types.paragraph) + effects.consume(code) + return + } + + if (markdownLineEnding(code)) { + effects.consume(code) + effects.exit(types.chunkText) + return lineStart + } + + // Data. + effects.consume(code) + return data + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/document.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/document.js new file mode 100644 index 00000000000000..fae240f744bf70 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/document.js @@ -0,0 +1,245 @@ +'use strict' + +Object.defineProperty(exports, '__esModule', {value: true}) + +var codes = require('../character/codes.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var constants = require('../constant/constants.js') +var types = require('../constant/types.js') +var factorySpace = require('../tokenize/factory-space.js') +var partialBlankLine = require('../tokenize/partial-blank-line.js') + +var tokenize = initializeDocument + +var containerConstruct = {tokenize: tokenizeContainer} +var lazyFlowConstruct = {tokenize: tokenizeLazyFlow} + +function initializeDocument(effects) { + var self = this + var stack = [] + var continued = 0 + var inspectConstruct = {tokenize: tokenizeInspect, partial: true} + var inspectResult + var childFlow + var childToken + + return start + + function start(code) { + if (continued < stack.length) { + self.containerState = stack[continued][1] + return effects.attempt( + stack[continued][0].continuation, + documentContinue, + documentContinued + )(code) + } + + return documentContinued(code) + } + + function documentContinue(code) { + continued++ + return start(code) + } + + function documentContinued(code) { + // If we’re in a concrete construct (such as when expecting another line of + // HTML, or we resulted in lazy content), we can immediately start flow. + if (inspectResult && inspectResult.flowContinue) { + return flowStart(code) + } + + self.interrupt = + childFlow && + childFlow.currentConstruct && + childFlow.currentConstruct.interruptible + self.containerState = {} + return effects.attempt( + containerConstruct, + containerContinue, + flowStart + )(code) + } + + function containerContinue(code) { + stack.push([self.currentConstruct, self.containerState]) + self.containerState = undefined + return documentContinued(code) + } + + function flowStart(code) { + if (code === codes.eof) { + exitContainers(0, true) + effects.consume(code) + return + } + + childFlow = childFlow || self.parser.flow(self.now()) + + effects.enter(types.chunkFlow, { + contentType: constants.contentTypeFlow, + previous: childToken, + _tokenizer: childFlow + }) + + return flowContinue(code) + } + + function flowContinue(code) { + if (code === codes.eof) { + continueFlow(effects.exit(types.chunkFlow)) + return flowStart(code) + } + + if (markdownLineEnding(code)) { + effects.consume(code) + continueFlow(effects.exit(types.chunkFlow)) + return effects.check(inspectConstruct, documentAfterPeek) + } + + effects.consume(code) + return flowContinue + } + + function documentAfterPeek(code) { + exitContainers( + inspectResult.continued, + inspectResult && inspectResult.flowEnd + ) + continued = 0 + return start(code) + } + + function continueFlow(token) { + if (childToken) childToken.next = token + childToken = token + childFlow.lazy = inspectResult && inspectResult.lazy + childFlow.defineSkip(token.start) + childFlow.write(self.sliceStream(token)) + } + + function exitContainers(size, end) { + var index = stack.length + + // Close the flow. + if (childFlow && end) { + childFlow.write([codes.eof]) + childToken = childFlow = undefined + } + + // Exit open containers. + while (index-- > size) { + self.containerState = stack[index][1] + stack[index][0].exit.call(self, effects) + } + + stack.length = size + } + + function tokenizeInspect(effects, ok) { + var subcontinued = 0 + + inspectResult = {} + + return inspectStart + + function inspectStart(code) { + if (subcontinued < stack.length) { + self.containerState = stack[subcontinued][1] + return effects.attempt( + stack[subcontinued][0].continuation, + inspectContinue, + inspectLess + )(code) + } + + // If we’re continued but in a concrete flow, we can’t have more + // containers. + if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) { + inspectResult.flowContinue = true + return inspectDone(code) + } + + self.interrupt = + childFlow.currentConstruct && childFlow.currentConstruct.interruptible + self.containerState = {} + return effects.attempt( + containerConstruct, + inspectFlowEnd, + inspectDone + )(code) + } + + function inspectContinue(code) { + subcontinued++ + return self.containerState._closeFlow + ? inspectFlowEnd(code) + : inspectStart(code) + } + + function inspectLess(code) { + if (childFlow.currentConstruct && childFlow.currentConstruct.lazy) { + // Maybe another container? + self.containerState = {} + return effects.attempt( + containerConstruct, + inspectFlowEnd, + // Maybe flow, or a blank line? + effects.attempt( + lazyFlowConstruct, + inspectFlowEnd, + effects.check(partialBlankLine, inspectFlowEnd, inspectLazy) + ) + )(code) + } + + // Otherwise we’re interrupting. + return inspectFlowEnd(code) + } + + function inspectLazy(code) { + // Act as if all containers are continued. + subcontinued = stack.length + inspectResult.lazy = true + inspectResult.flowContinue = true + return inspectDone(code) + } + + // We’re done with flow if we have more containers, or an interruption. + function inspectFlowEnd(code) { + inspectResult.flowEnd = true + return inspectDone(code) + } + + function inspectDone(code) { + inspectResult.continued = subcontinued + self.interrupt = self.containerState = undefined + return ok(code) + } + } +} + +function tokenizeContainer(effects, ok, nok) { + return factorySpace( + effects, + effects.attempt(this.parser.constructs.document, ok, nok), + types.linePrefix, + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : constants.tabSize + ) +} + +function tokenizeLazyFlow(effects, ok, nok) { + return factorySpace( + effects, + effects.lazy(this.parser.constructs.flow, ok, nok), + types.linePrefix, + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : constants.tabSize + ) +} + +exports.tokenize = tokenize diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/document.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/document.mjs new file mode 100644 index 00000000000000..9b084f3cd571fd --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/document.mjs @@ -0,0 +1,239 @@ +export var tokenize = initializeDocument + +import codes from '../character/codes.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import constants from '../constant/constants.mjs' +import types from '../constant/types.mjs' +import spaceFactory from '../tokenize/factory-space.mjs' +import blank from '../tokenize/partial-blank-line.mjs' + +var containerConstruct = {tokenize: tokenizeContainer} +var lazyFlowConstruct = {tokenize: tokenizeLazyFlow} + +function initializeDocument(effects) { + var self = this + var stack = [] + var continued = 0 + var inspectConstruct = {tokenize: tokenizeInspect, partial: true} + var inspectResult + var childFlow + var childToken + + return start + + function start(code) { + if (continued < stack.length) { + self.containerState = stack[continued][1] + return effects.attempt( + stack[continued][0].continuation, + documentContinue, + documentContinued + )(code) + } + + return documentContinued(code) + } + + function documentContinue(code) { + continued++ + return start(code) + } + + function documentContinued(code) { + // If we’re in a concrete construct (such as when expecting another line of + // HTML, or we resulted in lazy content), we can immediately start flow. + if (inspectResult && inspectResult.flowContinue) { + return flowStart(code) + } + + self.interrupt = + childFlow && + childFlow.currentConstruct && + childFlow.currentConstruct.interruptible + self.containerState = {} + return effects.attempt( + containerConstruct, + containerContinue, + flowStart + )(code) + } + + function containerContinue(code) { + stack.push([self.currentConstruct, self.containerState]) + self.containerState = undefined + return documentContinued(code) + } + + function flowStart(code) { + if (code === codes.eof) { + exitContainers(0, true) + effects.consume(code) + return + } + + childFlow = childFlow || self.parser.flow(self.now()) + + effects.enter(types.chunkFlow, { + contentType: constants.contentTypeFlow, + previous: childToken, + _tokenizer: childFlow + }) + + return flowContinue(code) + } + + function flowContinue(code) { + if (code === codes.eof) { + continueFlow(effects.exit(types.chunkFlow)) + return flowStart(code) + } + + if (markdownLineEnding(code)) { + effects.consume(code) + continueFlow(effects.exit(types.chunkFlow)) + return effects.check(inspectConstruct, documentAfterPeek) + } + + effects.consume(code) + return flowContinue + } + + function documentAfterPeek(code) { + exitContainers( + inspectResult.continued, + inspectResult && inspectResult.flowEnd + ) + continued = 0 + return start(code) + } + + function continueFlow(token) { + if (childToken) childToken.next = token + childToken = token + childFlow.lazy = inspectResult && inspectResult.lazy + childFlow.defineSkip(token.start) + childFlow.write(self.sliceStream(token)) + } + + function exitContainers(size, end) { + var index = stack.length + + // Close the flow. + if (childFlow && end) { + childFlow.write([codes.eof]) + childToken = childFlow = undefined + } + + // Exit open containers. + while (index-- > size) { + self.containerState = stack[index][1] + stack[index][0].exit.call(self, effects) + } + + stack.length = size + } + + function tokenizeInspect(effects, ok) { + var subcontinued = 0 + + inspectResult = {} + + return inspectStart + + function inspectStart(code) { + if (subcontinued < stack.length) { + self.containerState = stack[subcontinued][1] + return effects.attempt( + stack[subcontinued][0].continuation, + inspectContinue, + inspectLess + )(code) + } + + // If we’re continued but in a concrete flow, we can’t have more + // containers. + if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) { + inspectResult.flowContinue = true + return inspectDone(code) + } + + self.interrupt = + childFlow.currentConstruct && childFlow.currentConstruct.interruptible + self.containerState = {} + return effects.attempt( + containerConstruct, + inspectFlowEnd, + inspectDone + )(code) + } + + function inspectContinue(code) { + subcontinued++ + return self.containerState._closeFlow + ? inspectFlowEnd(code) + : inspectStart(code) + } + + function inspectLess(code) { + if (childFlow.currentConstruct && childFlow.currentConstruct.lazy) { + // Maybe another container? + self.containerState = {} + return effects.attempt( + containerConstruct, + inspectFlowEnd, + // Maybe flow, or a blank line? + effects.attempt( + lazyFlowConstruct, + inspectFlowEnd, + effects.check(blank, inspectFlowEnd, inspectLazy) + ) + )(code) + } + + // Otherwise we’re interrupting. + return inspectFlowEnd(code) + } + + function inspectLazy(code) { + // Act as if all containers are continued. + subcontinued = stack.length + inspectResult.lazy = true + inspectResult.flowContinue = true + return inspectDone(code) + } + + // We’re done with flow if we have more containers, or an interruption. + function inspectFlowEnd(code) { + inspectResult.flowEnd = true + return inspectDone(code) + } + + function inspectDone(code) { + inspectResult.continued = subcontinued + self.interrupt = self.containerState = undefined + return ok(code) + } + } +} + +function tokenizeContainer(effects, ok, nok) { + return spaceFactory( + effects, + effects.attempt(this.parser.constructs.document, ok, nok), + types.linePrefix, + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : constants.tabSize + ) +} + +function tokenizeLazyFlow(effects, ok, nok) { + return spaceFactory( + effects, + effects.lazy(this.parser.constructs.flow, ok, nok), + types.linePrefix, + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : constants.tabSize + ) +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/flow.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/flow.js new file mode 100644 index 00000000000000..2d71db26e6fe8a --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/flow.js @@ -0,0 +1,82 @@ +'use strict' + +Object.defineProperty(exports, '__esModule', {value: true}) + +var assert = require('assert') +var codes = require('../character/codes.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var types = require('../constant/types.js') +var content = require('../tokenize/content.js') +var factorySpace = require('../tokenize/factory-space.js') +var partialBlankLine = require('../tokenize/partial-blank-line.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +var tokenize = initializeFlow + +function initializeFlow(effects) { + var self = this + var initial = effects.attempt( + // Try to parse a blank line. + partialBlankLine, + atBlankEnding, + // Try to parse initial flow (essentially, only code). + effects.attempt( + this.parser.constructs.flowInitial, + afterConstruct, + factorySpace( + effects, + effects.attempt( + this.parser.constructs.flow, + afterConstruct, + effects.attempt(content, afterConstruct) + ), + types.linePrefix + ) + ) + ) + + return initial + + function atBlankEnding(code) { + assert__default['default']( + code === codes.eof || markdownLineEnding(code), + 'expected eol or eof' + ) + + if (code === codes.eof) { + effects.consume(code) + return + } + + effects.enter(types.lineEndingBlank) + effects.consume(code) + effects.exit(types.lineEndingBlank) + self.currentConstruct = undefined + return initial + } + + function afterConstruct(code) { + assert__default['default']( + code === codes.eof || markdownLineEnding(code), + 'expected eol or eof' + ) + + if (code === codes.eof) { + effects.consume(code) + return + } + + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + self.currentConstruct = undefined + return initial + } +} + +exports.tokenize = tokenize diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/flow.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/flow.mjs new file mode 100644 index 00000000000000..2f4b905d90ba47 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/flow.mjs @@ -0,0 +1,70 @@ +export var tokenize = initializeFlow + +import assert from 'assert' +import codes from '../character/codes.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import types from '../constant/types.mjs' +import content from '../tokenize/content.mjs' +import spaceFactory from '../tokenize/factory-space.mjs' +import blank from '../tokenize/partial-blank-line.mjs' + +function initializeFlow(effects) { + var self = this + var initial = effects.attempt( + // Try to parse a blank line. + blank, + atBlankEnding, + // Try to parse initial flow (essentially, only code). + effects.attempt( + this.parser.constructs.flowInitial, + afterConstruct, + spaceFactory( + effects, + effects.attempt( + this.parser.constructs.flow, + afterConstruct, + effects.attempt(content, afterConstruct) + ), + types.linePrefix + ) + ) + ) + + return initial + + function atBlankEnding(code) { + assert( + code === codes.eof || markdownLineEnding(code), + 'expected eol or eof' + ) + + if (code === codes.eof) { + effects.consume(code) + return + } + + effects.enter(types.lineEndingBlank) + effects.consume(code) + effects.exit(types.lineEndingBlank) + self.currentConstruct = undefined + return initial + } + + function afterConstruct(code) { + assert( + code === codes.eof || markdownLineEnding(code), + 'expected eol or eof' + ) + + if (code === codes.eof) { + effects.consume(code) + return + } + + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + self.currentConstruct = undefined + return initial + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/text.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/text.js new file mode 100644 index 00000000000000..10274966ed3ead --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/text.js @@ -0,0 +1,210 @@ +'use strict' + +Object.defineProperty(exports, '__esModule', {value: true}) + +var codes = require('../character/codes.js') +var assign = require('../constant/assign.js') +var constants = require('../constant/constants.js') +var types = require('../constant/types.js') +var shallow = require('../util/shallow.js') + +var text = initializeFactory('text') +var string = initializeFactory('string') +var resolver = {resolveAll: createResolver()} + +function initializeFactory(field) { + return { + tokenize: initializeText, + resolveAll: createResolver( + field === 'text' ? resolveAllLineSuffixes : undefined + ) + } + + function initializeText(effects) { + var self = this + var constructs = this.parser.constructs[field] + var text = effects.attempt(constructs, start, notText) + + return start + + function start(code) { + return atBreak(code) ? text(code) : notText(code) + } + + function notText(code) { + if (code === codes.eof) { + effects.consume(code) + return + } + + effects.enter(types.data) + effects.consume(code) + return data + } + + function data(code) { + if (atBreak(code)) { + effects.exit(types.data) + return text(code) + } + + // Data. + effects.consume(code) + return data + } + + function atBreak(code) { + var list = constructs[code] + var index = -1 + + if (code === codes.eof) { + return true + } + + if (list) { + while (++index < list.length) { + if ( + !list[index].previous || + list[index].previous.call(self, self.previous) + ) { + return true + } + } + } + } + } +} + +function createResolver(extraResolver) { + return resolveAllText + + function resolveAllText(events, context) { + var index = -1 + var enter + + // A rather boring computation (to merge adjacent `data` events) which + // improves mm performance by 29%. + while (++index <= events.length) { + if (enter === undefined) { + if (events[index] && events[index][1].type === types.data) { + enter = index + index++ + } + } else if (!events[index] || events[index][1].type !== types.data) { + // Don’t do anything if there is one data token. + if (index !== enter + 2) { + events[enter][1].end = events[index - 1][1].end + events.splice(enter + 2, index - enter - 2) + index = enter + 2 + } + + enter = undefined + } + } + + return extraResolver ? extraResolver(events, context) : events + } +} + +// A rather ugly set of instructions which again looks at chunks in the input +// stream. +// The reason to do this here is that it is *much* faster to parse in reverse. +// And that we can’t hook into `null` to split the line suffix before an EOF. +// To do: figure out if we can make this into a clean utility, or even in core. +// As it will be useful for GFMs literal autolink extension (and maybe even +// tables?) +function resolveAllLineSuffixes(events, context) { + var eventIndex = -1 + var chunks + var data + var chunk + var index + var bufferIndex + var size + var tabs + var token + + while (++eventIndex <= events.length) { + if ( + (eventIndex === events.length || + events[eventIndex][1].type === types.lineEnding) && + events[eventIndex - 1][1].type === types.data + ) { + data = events[eventIndex - 1][1] + chunks = context.sliceStream(data) + index = chunks.length + bufferIndex = -1 + size = 0 + tabs = undefined + + while (index--) { + chunk = chunks[index] + + if (typeof chunk === 'string') { + bufferIndex = chunk.length + + while (chunk.charCodeAt(bufferIndex - 1) === codes.space) { + size++ + bufferIndex-- + } + + if (bufferIndex) break + bufferIndex = -1 + } + // Number + else if (chunk === codes.horizontalTab) { + tabs = true + size++ + } else if (chunk === codes.virtualSpace); + else { + // Replacement character, exit. + index++ + break + } + } + + if (size) { + token = { + type: + eventIndex === events.length || + tabs || + size < constants.hardBreakPrefixSizeMin + ? types.lineSuffix + : types.hardBreakTrailing, + start: { + line: data.end.line, + column: data.end.column - size, + offset: data.end.offset - size, + _index: data.start._index + index, + _bufferIndex: index + ? bufferIndex + : data.start._bufferIndex + bufferIndex + }, + end: shallow(data.end) + } + + data.end = shallow(token.start) + + if (data.start.offset === data.end.offset) { + assign(data, token) + } else { + events.splice( + eventIndex, + 0, + ['enter', token, context], + ['exit', token, context] + ) + eventIndex += 2 + } + } + + eventIndex++ + } + } + + return events +} + +exports.resolver = resolver +exports.string = string +exports.text = text diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/text.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/text.mjs new file mode 100644 index 00000000000000..8e1bca1fb4237b --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/initialize/text.mjs @@ -0,0 +1,203 @@ +export var text = initializeFactory('text') +export var string = initializeFactory('string') +export var resolver = {resolveAll: createResolver()} + +import codes from '../character/codes.mjs' +import assign from '../constant/assign.mjs' +import constants from '../constant/constants.mjs' +import types from '../constant/types.mjs' +import shallow from '../util/shallow.mjs' + +function initializeFactory(field) { + return { + tokenize: initializeText, + resolveAll: createResolver( + field === 'text' ? resolveAllLineSuffixes : undefined + ) + } + + function initializeText(effects) { + var self = this + var constructs = this.parser.constructs[field] + var text = effects.attempt(constructs, start, notText) + + return start + + function start(code) { + return atBreak(code) ? text(code) : notText(code) + } + + function notText(code) { + if (code === codes.eof) { + effects.consume(code) + return + } + + effects.enter(types.data) + effects.consume(code) + return data + } + + function data(code) { + if (atBreak(code)) { + effects.exit(types.data) + return text(code) + } + + // Data. + effects.consume(code) + return data + } + + function atBreak(code) { + var list = constructs[code] + var index = -1 + + if (code === codes.eof) { + return true + } + + if (list) { + while (++index < list.length) { + if ( + !list[index].previous || + list[index].previous.call(self, self.previous) + ) { + return true + } + } + } + } + } +} + +function createResolver(extraResolver) { + return resolveAllText + + function resolveAllText(events, context) { + var index = -1 + var enter + + // A rather boring computation (to merge adjacent `data` events) which + // improves mm performance by 29%. + while (++index <= events.length) { + if (enter === undefined) { + if (events[index] && events[index][1].type === types.data) { + enter = index + index++ + } + } else if (!events[index] || events[index][1].type !== types.data) { + // Don’t do anything if there is one data token. + if (index !== enter + 2) { + events[enter][1].end = events[index - 1][1].end + events.splice(enter + 2, index - enter - 2) + index = enter + 2 + } + + enter = undefined + } + } + + return extraResolver ? extraResolver(events, context) : events + } +} + +// A rather ugly set of instructions which again looks at chunks in the input +// stream. +// The reason to do this here is that it is *much* faster to parse in reverse. +// And that we can’t hook into `null` to split the line suffix before an EOF. +// To do: figure out if we can make this into a clean utility, or even in core. +// As it will be useful for GFMs literal autolink extension (and maybe even +// tables?) +function resolveAllLineSuffixes(events, context) { + var eventIndex = -1 + var chunks + var data + var chunk + var index + var bufferIndex + var size + var tabs + var token + + while (++eventIndex <= events.length) { + if ( + (eventIndex === events.length || + events[eventIndex][1].type === types.lineEnding) && + events[eventIndex - 1][1].type === types.data + ) { + data = events[eventIndex - 1][1] + chunks = context.sliceStream(data) + index = chunks.length + bufferIndex = -1 + size = 0 + tabs = undefined + + while (index--) { + chunk = chunks[index] + + if (typeof chunk === 'string') { + bufferIndex = chunk.length + + while (chunk.charCodeAt(bufferIndex - 1) === codes.space) { + size++ + bufferIndex-- + } + + if (bufferIndex) break + bufferIndex = -1 + } + // Number + else if (chunk === codes.horizontalTab) { + tabs = true + size++ + } else if (chunk === codes.virtualSpace) { + // Empty + } else { + // Replacement character, exit. + index++ + break + } + } + + if (size) { + token = { + type: + eventIndex === events.length || + tabs || + size < constants.hardBreakPrefixSizeMin + ? types.lineSuffix + : types.hardBreakTrailing, + start: { + line: data.end.line, + column: data.end.column - size, + offset: data.end.offset - size, + _index: data.start._index + index, + _bufferIndex: index + ? bufferIndex + : data.start._bufferIndex + bufferIndex + }, + end: shallow(data.end) + } + + data.end = shallow(token.start) + + if (data.start.offset === data.end.offset) { + assign(data, token) + } else { + events.splice( + eventIndex, + 0, + ['enter', token, context], + ['exit', token, context] + ) + eventIndex += 2 + } + } + + eventIndex++ + } + } + + return events +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/parse.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/parse.js new file mode 100644 index 00000000000000..aad11f9ee75e08 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/parse.js @@ -0,0 +1,36 @@ +'use strict' + +var content = require('./initialize/content.js') +var document = require('./initialize/document.js') +var flow = require('./initialize/flow.js') +var text = require('./initialize/text.js') +var combineExtensions = require('./util/combine-extensions.js') +var createTokenizer = require('./util/create-tokenizer.js') +var miniflat = require('./util/miniflat.js') +var constructs = require('./constructs.js') + +function parse(options) { + var settings = options || {} + var parser = { + defined: [], + constructs: combineExtensions( + [constructs].concat(miniflat(settings.extensions)) + ), + content: create(content), + document: create(document), + flow: create(flow), + string: create(text.string), + text: create(text.text) + } + + return parser + + function create(initializer) { + return creator + function creator(from) { + return createTokenizer(parser, initializer, from) + } + } +} + +module.exports = parse diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/parse.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/parse.mjs new file mode 100644 index 00000000000000..a4ca9ac681a3f5 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/parse.mjs @@ -0,0 +1,34 @@ +export default parse + +import * as initializeContent from './initialize/content.mjs' +import * as initializeDocument from './initialize/document.mjs' +import * as initializeFlow from './initialize/flow.mjs' +import * as initializeText from './initialize/text.mjs' +import combineExtensions from './util/combine-extensions.mjs' +import createTokenizer from './util/create-tokenizer.mjs' +import miniflat from './util/miniflat.mjs' +import * as constructs from './constructs.mjs' + +function parse(options) { + var settings = options || {} + var parser = { + defined: [], + constructs: combineExtensions( + [constructs].concat(miniflat(settings.extensions)) + ), + content: create(initializeContent), + document: create(initializeDocument), + flow: create(initializeFlow), + string: create(initializeText.string), + text: create(initializeText.text) + } + + return parser + + function create(initializer) { + return creator + function creator(from) { + return createTokenizer(parser, initializer, from) + } + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/postprocess.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/postprocess.js new file mode 100644 index 00000000000000..842f8ce8bfc64d --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/postprocess.js @@ -0,0 +1,13 @@ +'use strict' + +var subtokenize = require('./util/subtokenize.js') + +function postprocess(events) { + while (!subtokenize(events)) { + // Empty + } + + return events +} + +module.exports = postprocess diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/postprocess.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/postprocess.mjs new file mode 100644 index 00000000000000..f32e378d3f98e9 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/postprocess.mjs @@ -0,0 +1,11 @@ +export default postprocess + +import subtokenize from './util/subtokenize.mjs' + +function postprocess(events) { + while (!subtokenize(events)) { + // Empty + } + + return events +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/preprocess.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/preprocess.js new file mode 100644 index 00000000000000..caf9c07059f3a4 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/preprocess.js @@ -0,0 +1,96 @@ +'use strict' + +var codes = require('./character/codes.js') +var constants = require('./constant/constants.js') + +var search = /[\0\t\n\r]/g + +function preprocess() { + var start = true + var column = 1 + var buffer = '' + var atCarriageReturn + + return preprocessor + + function preprocessor(value, encoding, end) { + var chunks = [] + var match + var next + var startPosition + var endPosition + var code + + value = buffer + value.toString(encoding) + startPosition = 0 + buffer = '' + + if (start) { + if (value.charCodeAt(0) === codes.byteOrderMarker) { + startPosition++ + } + + start = undefined + } + + while (startPosition < value.length) { + search.lastIndex = startPosition + match = search.exec(value) + endPosition = match ? match.index : value.length + code = value.charCodeAt(endPosition) + + if (!match) { + buffer = value.slice(startPosition) + break + } + + if ( + code === codes.lf && + startPosition === endPosition && + atCarriageReturn + ) { + chunks.push(codes.carriageReturnLineFeed) + atCarriageReturn = undefined + } else { + if (atCarriageReturn) { + chunks.push(codes.carriageReturn) + atCarriageReturn = undefined + } + + if (startPosition < endPosition) { + chunks.push(value.slice(startPosition, endPosition)) + column += endPosition - startPosition + } + + if (code === codes.nul) { + chunks.push(codes.replacementCharacter) + column++ + } else if (code === codes.ht) { + next = Math.ceil(column / constants.tabSize) * constants.tabSize + chunks.push(codes.horizontalTab) + while (column++ < next) chunks.push(codes.virtualSpace) + } else if (code === codes.lf) { + chunks.push(codes.lineFeed) + column = 1 + } + // Must be carriage return. + else { + atCarriageReturn = true + column = 1 + } + } + + startPosition = endPosition + 1 + } + + if (end) { + if (atCarriageReturn) chunks.push(codes.carriageReturn) + if (buffer) chunks.push(buffer) + chunks.push(codes.eof) + } + + return chunks + } +} + +module.exports = preprocess diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/preprocess.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/preprocess.mjs new file mode 100644 index 00000000000000..4413159d36cd9a --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/preprocess.mjs @@ -0,0 +1,94 @@ +export default preprocess + +import codes from './character/codes.mjs' +import constants from './constant/constants.mjs' + +var search = /[\0\t\n\r]/g + +function preprocess() { + var start = true + var column = 1 + var buffer = '' + var atCarriageReturn + + return preprocessor + + function preprocessor(value, encoding, end) { + var chunks = [] + var match + var next + var startPosition + var endPosition + var code + + value = buffer + value.toString(encoding) + startPosition = 0 + buffer = '' + + if (start) { + if (value.charCodeAt(0) === codes.byteOrderMarker) { + startPosition++ + } + + start = undefined + } + + while (startPosition < value.length) { + search.lastIndex = startPosition + match = search.exec(value) + endPosition = match ? match.index : value.length + code = value.charCodeAt(endPosition) + + if (!match) { + buffer = value.slice(startPosition) + break + } + + if ( + code === codes.lf && + startPosition === endPosition && + atCarriageReturn + ) { + chunks.push(codes.carriageReturnLineFeed) + atCarriageReturn = undefined + } else { + if (atCarriageReturn) { + chunks.push(codes.carriageReturn) + atCarriageReturn = undefined + } + + if (startPosition < endPosition) { + chunks.push(value.slice(startPosition, endPosition)) + column += endPosition - startPosition + } + + if (code === codes.nul) { + chunks.push(codes.replacementCharacter) + column++ + } else if (code === codes.ht) { + next = Math.ceil(column / constants.tabSize) * constants.tabSize + chunks.push(codes.horizontalTab) + while (column++ < next) chunks.push(codes.virtualSpace) + } else if (code === codes.lf) { + chunks.push(codes.lineFeed) + column = 1 + } + // Must be carriage return. + else { + atCarriageReturn = true + column = 1 + } + } + + startPosition = endPosition + 1 + } + + if (end) { + if (atCarriageReturn) chunks.push(codes.carriageReturn) + if (buffer) chunks.push(buffer) + chunks.push(codes.eof) + } + + return chunks + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/stream.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/stream.js new file mode 100644 index 00000000000000..07fb675b62665f --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/stream.js @@ -0,0 +1,119 @@ +'use strict' + +var events = require('events') +var html = require('./compile/html.js') +var parse = require('./parse.js') +var postprocess = require('./postprocess.js') +var preprocess = require('./preprocess.js') + +function stream(options) { + var preprocess$1 = preprocess() + var tokenize = parse(options).document().write + var compile = html(options) + var emitter = new events.EventEmitter() + var ended + + emitter.writable = emitter.readable = true + emitter.write = write + emitter.end = end + emitter.pipe = pipe + + return emitter + + // Write a chunk into memory. + function write(chunk, encoding, callback) { + if (typeof encoding === 'function') { + callback = encoding + encoding = undefined + } + + if (ended) { + throw new Error('Did not expect `write` after `end`') + } + + tokenize(preprocess$1(chunk || '', encoding)) + + if (callback) { + callback() + } + + // Signal succesful write. + return true + } + + // End the writing. + // Passes all arguments to a final `write`. + function end(chunk, encoding, callback) { + write(chunk, encoding, callback) + + emitter.emit( + 'data', + compile(postprocess(tokenize(preprocess$1('', encoding, true)))) + ) + + emitter.emit('end') + ended = true + return true + } + + // Pipe the processor into a writable stream. + // Basically `Stream#pipe`, but inlined and simplified to keep the bundled + // size down. + // See: . + function pipe(dest, options) { + emitter.on('data', ondata) + emitter.on('error', onerror) + emitter.on('end', cleanup) + emitter.on('close', cleanup) + + // If the `end` option is not supplied, `dest.end()` will be called when the + // `end` or `close` events are received. + if (!dest._isStdio && (!options || options.end !== false)) { + emitter.on('end', onend) + } + + dest.on('error', onerror) + dest.on('close', cleanup) + + dest.emit('pipe', emitter) + + return dest + + // End destination. + function onend() { + if (dest.end) { + dest.end() + } + } + + // Handle data. + function ondata(chunk) { + if (dest.writable) { + dest.write(chunk) + } + } + + // Clean listeners. + function cleanup() { + emitter.removeListener('data', ondata) + emitter.removeListener('end', onend) + emitter.removeListener('error', onerror) + emitter.removeListener('end', cleanup) + emitter.removeListener('close', cleanup) + + dest.removeListener('error', onerror) + dest.removeListener('close', cleanup) + } + + // Close dangling pipes and handle unheard errors. + function onerror(error) { + cleanup() + + if (!emitter.listenerCount('error')) { + throw error // Unhandled stream error in pipe. + } + } + } +} + +module.exports = stream diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/stream.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/stream.mjs new file mode 100644 index 00000000000000..d00c74a89ba3b6 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/stream.mjs @@ -0,0 +1,117 @@ +export default stream + +import {EventEmitter} from 'events' +import compiler from './compile/html.mjs' +import parser from './parse.mjs' +import postprocess from './postprocess.mjs' +import preprocessor from './preprocess.mjs' + +function stream(options) { + var preprocess = preprocessor() + var tokenize = parser(options).document().write + var compile = compiler(options) + var emitter = new EventEmitter() + var ended + + emitter.writable = emitter.readable = true + emitter.write = write + emitter.end = end + emitter.pipe = pipe + + return emitter + + // Write a chunk into memory. + function write(chunk, encoding, callback) { + if (typeof encoding === 'function') { + callback = encoding + encoding = undefined + } + + if (ended) { + throw new Error('Did not expect `write` after `end`') + } + + tokenize(preprocess(chunk || '', encoding)) + + if (callback) { + callback() + } + + // Signal succesful write. + return true + } + + // End the writing. + // Passes all arguments to a final `write`. + function end(chunk, encoding, callback) { + write(chunk, encoding, callback) + + emitter.emit( + 'data', + compile(postprocess(tokenize(preprocess('', encoding, true)))) + ) + + emitter.emit('end') + ended = true + return true + } + + // Pipe the processor into a writable stream. + // Basically `Stream#pipe`, but inlined and simplified to keep the bundled + // size down. + // See: . + function pipe(dest, options) { + emitter.on('data', ondata) + emitter.on('error', onerror) + emitter.on('end', cleanup) + emitter.on('close', cleanup) + + // If the `end` option is not supplied, `dest.end()` will be called when the + // `end` or `close` events are received. + if (!dest._isStdio && (!options || options.end !== false)) { + emitter.on('end', onend) + } + + dest.on('error', onerror) + dest.on('close', cleanup) + + dest.emit('pipe', emitter) + + return dest + + // End destination. + function onend() { + if (dest.end) { + dest.end() + } + } + + // Handle data. + function ondata(chunk) { + if (dest.writable) { + dest.write(chunk) + } + } + + // Clean listeners. + function cleanup() { + emitter.removeListener('data', ondata) + emitter.removeListener('end', onend) + emitter.removeListener('error', onerror) + emitter.removeListener('end', cleanup) + emitter.removeListener('close', cleanup) + + dest.removeListener('error', onerror) + dest.removeListener('close', cleanup) + } + + // Close dangling pipes and handle unheard errors. + function onerror(error) { + cleanup() + + if (!emitter.listenerCount('error')) { + throw error // Unhandled stream error in pipe. + } + } + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/attention.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/attention.js new file mode 100644 index 00000000000000..b38970d99e077a --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/attention.js @@ -0,0 +1,216 @@ +'use strict' + +var assert = require('assert') +var codes = require('../character/codes.js') +var constants = require('../constant/constants.js') +var types = require('../constant/types.js') +var chunkedPush = require('../util/chunked-push.js') +var chunkedSplice = require('../util/chunked-splice.js') +var classifyCharacter = require('../util/classify-character.js') +var movePoint = require('../util/move-point.js') +var resolveAll = require('../util/resolve-all.js') +var shallow = require('../util/shallow.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +var attention = { + name: 'attention', + tokenize: tokenizeAttention, + resolveAll: resolveAllAttention +} + +// Take all events and resolve attention to emphasis or strong. +function resolveAllAttention(events, context) { + var index = -1 + var open + var group + var text + var openingSequence + var closingSequence + var use + var nextEvents + var offset + + // Walk through all events. + // + // Note: performance of this is fine on an mb of normal markdown, but it’s + // a bottleneck for malicious stuff. + while (++index < events.length) { + // Find a token that can close. + if ( + events[index][0] === 'enter' && + events[index][1].type === 'attentionSequence' && + events[index][1]._close + ) { + open = index + + // Now walk back to find an opener. + while (open--) { + // Find a token that can open the closer. + if ( + events[open][0] === 'exit' && + events[open][1].type === 'attentionSequence' && + events[open][1]._open && + // If the markers are the same: + context.sliceSerialize(events[open][1]).charCodeAt(0) === + context.sliceSerialize(events[index][1]).charCodeAt(0) + ) { + // If the opening can close or the closing can open, + // and the close size *is not* a multiple of three, + // but the sum of the opening and closing size *is* multiple of three, + // then don’t match. + if ( + (events[open][1]._close || events[index][1]._open) && + (events[index][1].end.offset - events[index][1].start.offset) % 3 && + !( + (events[open][1].end.offset - + events[open][1].start.offset + + events[index][1].end.offset - + events[index][1].start.offset) % + 3 + ) + ) { + continue + } + + // Number of markers to use from the sequence. + use = + events[open][1].end.offset - events[open][1].start.offset > 1 && + events[index][1].end.offset - events[index][1].start.offset > 1 + ? 2 + : 1 + + openingSequence = { + type: use > 1 ? types.strongSequence : types.emphasisSequence, + start: movePoint(shallow(events[open][1].end), -use), + end: shallow(events[open][1].end) + } + closingSequence = { + type: use > 1 ? types.strongSequence : types.emphasisSequence, + start: shallow(events[index][1].start), + end: movePoint(shallow(events[index][1].start), use) + } + text = { + type: use > 1 ? types.strongText : types.emphasisText, + start: shallow(events[open][1].end), + end: shallow(events[index][1].start) + } + group = { + type: use > 1 ? types.strong : types.emphasis, + start: shallow(openingSequence.start), + end: shallow(closingSequence.end) + } + + events[open][1].end = shallow(openingSequence.start) + events[index][1].start = shallow(closingSequence.end) + + nextEvents = [] + + // If there are more markers in the opening, add them before. + if (events[open][1].end.offset - events[open][1].start.offset) { + nextEvents = chunkedPush(nextEvents, [ + ['enter', events[open][1], context], + ['exit', events[open][1], context] + ]) + } + + // Opening. + nextEvents = chunkedPush(nextEvents, [ + ['enter', group, context], + ['enter', openingSequence, context], + ['exit', openingSequence, context], + ['enter', text, context] + ]) + + // Between. + nextEvents = chunkedPush( + nextEvents, + resolveAll( + context.parser.constructs.insideSpan.null, + events.slice(open + 1, index), + context + ) + ) + + // Closing. + nextEvents = chunkedPush(nextEvents, [ + ['exit', text, context], + ['enter', closingSequence, context], + ['exit', closingSequence, context], + ['exit', group, context] + ]) + + // If there are more markers in the closing, add them after. + if (events[index][1].end.offset - events[index][1].start.offset) { + offset = 2 + nextEvents = chunkedPush(nextEvents, [ + ['enter', events[index][1], context], + ['exit', events[index][1], context] + ]) + } else { + offset = 0 + } + + chunkedSplice(events, open - 1, index - open + 3, nextEvents) + + index = open + nextEvents.length - offset - 2 + break + } + } + } + } + + // Remove remaining sequences. + index = -1 + + while (++index < events.length) { + if (events[index][1].type === 'attentionSequence') { + events[index][1].type = 'data' + } + } + + return events +} + +function tokenizeAttention(effects, ok) { + var before = classifyCharacter(this.previous) + var marker + + return start + + function start(code) { + assert__default['default']( + code === codes.asterisk || code === codes.underscore, + 'expected asterisk or underscore' + ) + effects.enter('attentionSequence') + marker = code + return sequence(code) + } + + function sequence(code) { + var token + var after + var open + var close + + if (code === marker) { + effects.consume(code) + return sequence + } + + token = effects.exit('attentionSequence') + after = classifyCharacter(code) + open = !after || (after === constants.characterGroupPunctuation && before) + close = !before || (before === constants.characterGroupPunctuation && after) + token._open = marker === codes.asterisk ? open : open && (before || !close) + token._close = marker === codes.asterisk ? close : close && (after || !open) + return ok(code) + } +} + +module.exports = attention diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/attention.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/attention.mjs new file mode 100644 index 00000000000000..a3c81460f9a79e --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/attention.mjs @@ -0,0 +1,207 @@ +var attention = { + name: 'attention', + tokenize: tokenizeAttention, + resolveAll: resolveAllAttention +} +export default attention + +import assert from 'assert' +import codes from '../character/codes.mjs' +import constants from '../constant/constants.mjs' +import types from '../constant/types.mjs' +import chunkedPush from '../util/chunked-push.mjs' +import chunkedSplice from '../util/chunked-splice.mjs' +import classifyCharacter from '../util/classify-character.mjs' +import movePoint from '../util/move-point.mjs' +import resolveAll from '../util/resolve-all.mjs' +import shallow from '../util/shallow.mjs' + +// Take all events and resolve attention to emphasis or strong. +function resolveAllAttention(events, context) { + var index = -1 + var open + var group + var text + var openingSequence + var closingSequence + var use + var nextEvents + var offset + + // Walk through all events. + // + // Note: performance of this is fine on an mb of normal markdown, but it’s + // a bottleneck for malicious stuff. + while (++index < events.length) { + // Find a token that can close. + if ( + events[index][0] === 'enter' && + events[index][1].type === 'attentionSequence' && + events[index][1]._close + ) { + open = index + + // Now walk back to find an opener. + while (open--) { + // Find a token that can open the closer. + if ( + events[open][0] === 'exit' && + events[open][1].type === 'attentionSequence' && + events[open][1]._open && + // If the markers are the same: + context.sliceSerialize(events[open][1]).charCodeAt(0) === + context.sliceSerialize(events[index][1]).charCodeAt(0) + ) { + // If the opening can close or the closing can open, + // and the close size *is not* a multiple of three, + // but the sum of the opening and closing size *is* multiple of three, + // then don’t match. + if ( + (events[open][1]._close || events[index][1]._open) && + (events[index][1].end.offset - events[index][1].start.offset) % 3 && + !( + (events[open][1].end.offset - + events[open][1].start.offset + + events[index][1].end.offset - + events[index][1].start.offset) % + 3 + ) + ) { + continue + } + + // Number of markers to use from the sequence. + use = + events[open][1].end.offset - events[open][1].start.offset > 1 && + events[index][1].end.offset - events[index][1].start.offset > 1 + ? 2 + : 1 + + openingSequence = { + type: use > 1 ? types.strongSequence : types.emphasisSequence, + start: movePoint(shallow(events[open][1].end), -use), + end: shallow(events[open][1].end) + } + closingSequence = { + type: use > 1 ? types.strongSequence : types.emphasisSequence, + start: shallow(events[index][1].start), + end: movePoint(shallow(events[index][1].start), use) + } + text = { + type: use > 1 ? types.strongText : types.emphasisText, + start: shallow(events[open][1].end), + end: shallow(events[index][1].start) + } + group = { + type: use > 1 ? types.strong : types.emphasis, + start: shallow(openingSequence.start), + end: shallow(closingSequence.end) + } + + events[open][1].end = shallow(openingSequence.start) + events[index][1].start = shallow(closingSequence.end) + + nextEvents = [] + + // If there are more markers in the opening, add them before. + if (events[open][1].end.offset - events[open][1].start.offset) { + nextEvents = chunkedPush(nextEvents, [ + ['enter', events[open][1], context], + ['exit', events[open][1], context] + ]) + } + + // Opening. + nextEvents = chunkedPush(nextEvents, [ + ['enter', group, context], + ['enter', openingSequence, context], + ['exit', openingSequence, context], + ['enter', text, context] + ]) + + // Between. + nextEvents = chunkedPush( + nextEvents, + resolveAll( + context.parser.constructs.insideSpan.null, + events.slice(open + 1, index), + context + ) + ) + + // Closing. + nextEvents = chunkedPush(nextEvents, [ + ['exit', text, context], + ['enter', closingSequence, context], + ['exit', closingSequence, context], + ['exit', group, context] + ]) + + // If there are more markers in the closing, add them after. + if (events[index][1].end.offset - events[index][1].start.offset) { + offset = 2 + nextEvents = chunkedPush(nextEvents, [ + ['enter', events[index][1], context], + ['exit', events[index][1], context] + ]) + } else { + offset = 0 + } + + chunkedSplice(events, open - 1, index - open + 3, nextEvents) + + index = open + nextEvents.length - offset - 2 + break + } + } + } + } + + // Remove remaining sequences. + index = -1 + + while (++index < events.length) { + if (events[index][1].type === 'attentionSequence') { + events[index][1].type = 'data' + } + } + + return events +} + +function tokenizeAttention(effects, ok) { + var before = classifyCharacter(this.previous) + var marker + + return start + + function start(code) { + assert( + code === codes.asterisk || code === codes.underscore, + 'expected asterisk or underscore' + ) + effects.enter('attentionSequence') + marker = code + return sequence(code) + } + + function sequence(code) { + var token + var after + var open + var close + + if (code === marker) { + effects.consume(code) + return sequence + } + + token = effects.exit('attentionSequence') + after = classifyCharacter(code) + open = !after || (after === constants.characterGroupPunctuation && before) + close = !before || (before === constants.characterGroupPunctuation && after) + token._open = marker === codes.asterisk ? open : open && (before || !close) + token._close = marker === codes.asterisk ? close : close && (after || !open) + return ok(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/autolink.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/autolink.js new file mode 100644 index 00000000000000..037280bbd2ced2 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/autolink.js @@ -0,0 +1,147 @@ +'use strict' + +var assert = require('assert') +var asciiAlpha = require('../character/ascii-alpha.js') +var asciiAlphanumeric = require('../character/ascii-alphanumeric.js') +var asciiAtext = require('../character/ascii-atext.js') +var asciiControl = require('../character/ascii-control.js') +var codes = require('../character/codes.js') +var constants = require('../constant/constants.js') +var types = require('../constant/types.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +var autolink = { + name: 'autolink', + tokenize: tokenizeAutolink +} + +function tokenizeAutolink(effects, ok, nok) { + var size = 1 + + return start + + function start(code) { + assert__default['default'](code === codes.lessThan, 'expected `<`') + effects.enter(types.autolink) + effects.enter(types.autolinkMarker) + effects.consume(code) + effects.exit(types.autolinkMarker) + effects.enter(types.autolinkProtocol) + return open + } + + function open(code) { + if (asciiAlpha(code)) { + effects.consume(code) + return schemeOrEmailAtext + } + + return asciiAtext(code) ? emailAtext(code) : nok(code) + } + + function schemeOrEmailAtext(code) { + return code === codes.plusSign || + code === codes.dash || + code === codes.dot || + asciiAlphanumeric(code) + ? schemeInsideOrEmailAtext(code) + : emailAtext(code) + } + + function schemeInsideOrEmailAtext(code) { + if (code === codes.colon) { + effects.consume(code) + return urlInside + } + + if ( + (code === codes.plusSign || + code === codes.dash || + code === codes.dot || + asciiAlphanumeric(code)) && + size++ < constants.autolinkSchemeSizeMax + ) { + effects.consume(code) + return schemeInsideOrEmailAtext + } + + return emailAtext(code) + } + + function urlInside(code) { + if (code === codes.greaterThan) { + effects.exit(types.autolinkProtocol) + return end(code) + } + + if (code === codes.space || code === codes.lessThan || asciiControl(code)) { + return nok(code) + } + + effects.consume(code) + return urlInside + } + + function emailAtext(code) { + if (code === codes.atSign) { + effects.consume(code) + size = 0 + return emailAtSignOrDot + } + + if (asciiAtext(code)) { + effects.consume(code) + return emailAtext + } + + return nok(code) + } + + function emailAtSignOrDot(code) { + return asciiAlphanumeric(code) ? emailLabel(code) : nok(code) + } + + function emailLabel(code) { + if (code === codes.dot) { + effects.consume(code) + size = 0 + return emailAtSignOrDot + } + + if (code === codes.greaterThan) { + // Exit, then change the type. + effects.exit(types.autolinkProtocol).type = types.autolinkEmail + return end(code) + } + + return emailValue(code) + } + + function emailValue(code) { + if ( + (code === codes.dash || asciiAlphanumeric(code)) && + size++ < constants.autolinkDomainSizeMax + ) { + effects.consume(code) + return code === codes.dash ? emailValue : emailLabel + } + + return nok(code) + } + + function end(code) { + assert__default['default'].equal(code, codes.greaterThan, 'expected `>`') + effects.enter(types.autolinkMarker) + effects.consume(code) + effects.exit(types.autolinkMarker) + effects.exit(types.autolink) + return ok + } +} + +module.exports = autolink diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/autolink.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/autolink.mjs new file mode 100644 index 00000000000000..890cd6c468144a --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/autolink.mjs @@ -0,0 +1,138 @@ +var autolink = { + name: 'autolink', + tokenize: tokenizeAutolink +} +export default autolink + +import assert from 'assert' +import asciiAlpha from '../character/ascii-alpha.mjs' +import asciiAlphanumeric from '../character/ascii-alphanumeric.mjs' +import asciiAtext from '../character/ascii-atext.mjs' +import asciiControl from '../character/ascii-control.mjs' +import codes from '../character/codes.mjs' +import constants from '../constant/constants.mjs' +import types from '../constant/types.mjs' + +function tokenizeAutolink(effects, ok, nok) { + var size = 1 + + return start + + function start(code) { + assert(code === codes.lessThan, 'expected `<`') + effects.enter(types.autolink) + effects.enter(types.autolinkMarker) + effects.consume(code) + effects.exit(types.autolinkMarker) + effects.enter(types.autolinkProtocol) + return open + } + + function open(code) { + if (asciiAlpha(code)) { + effects.consume(code) + return schemeOrEmailAtext + } + + return asciiAtext(code) ? emailAtext(code) : nok(code) + } + + function schemeOrEmailAtext(code) { + return code === codes.plusSign || + code === codes.dash || + code === codes.dot || + asciiAlphanumeric(code) + ? schemeInsideOrEmailAtext(code) + : emailAtext(code) + } + + function schemeInsideOrEmailAtext(code) { + if (code === codes.colon) { + effects.consume(code) + return urlInside + } + + if ( + (code === codes.plusSign || + code === codes.dash || + code === codes.dot || + asciiAlphanumeric(code)) && + size++ < constants.autolinkSchemeSizeMax + ) { + effects.consume(code) + return schemeInsideOrEmailAtext + } + + return emailAtext(code) + } + + function urlInside(code) { + if (code === codes.greaterThan) { + effects.exit(types.autolinkProtocol) + return end(code) + } + + if (code === codes.space || code === codes.lessThan || asciiControl(code)) { + return nok(code) + } + + effects.consume(code) + return urlInside + } + + function emailAtext(code) { + if (code === codes.atSign) { + effects.consume(code) + size = 0 + return emailAtSignOrDot + } + + if (asciiAtext(code)) { + effects.consume(code) + return emailAtext + } + + return nok(code) + } + + function emailAtSignOrDot(code) { + return asciiAlphanumeric(code) ? emailLabel(code) : nok(code) + } + + function emailLabel(code) { + if (code === codes.dot) { + effects.consume(code) + size = 0 + return emailAtSignOrDot + } + + if (code === codes.greaterThan) { + // Exit, then change the type. + effects.exit(types.autolinkProtocol).type = types.autolinkEmail + return end(code) + } + + return emailValue(code) + } + + function emailValue(code) { + if ( + (code === codes.dash || asciiAlphanumeric(code)) && + size++ < constants.autolinkDomainSizeMax + ) { + effects.consume(code) + return code === codes.dash ? emailValue : emailLabel + } + + return nok(code) + } + + function end(code) { + assert.equal(code, codes.greaterThan, 'expected `>`') + effects.enter(types.autolinkMarker) + effects.consume(code) + effects.exit(types.autolinkMarker) + effects.exit(types.autolink) + return ok + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/block-quote.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/block-quote.js new file mode 100644 index 00000000000000..66f58d0715314b --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/block-quote.js @@ -0,0 +1,67 @@ +'use strict' + +var codes = require('../character/codes.js') +var markdownSpace = require('../character/markdown-space.js') +var constants = require('../constant/constants.js') +var types = require('../constant/types.js') +var factorySpace = require('./factory-space.js') + +var blockQuote = { + name: 'blockQuote', + tokenize: tokenizeBlockQuoteStart, + continuation: {tokenize: tokenizeBlockQuoteContinuation}, + exit: exit +} + +function tokenizeBlockQuoteStart(effects, ok, nok) { + var self = this + + return start + + function start(code) { + if (code === codes.greaterThan) { + if (!self.containerState.open) { + effects.enter(types.blockQuote, {_container: true}) + self.containerState.open = true + } + + effects.enter(types.blockQuotePrefix) + effects.enter(types.blockQuoteMarker) + effects.consume(code) + effects.exit(types.blockQuoteMarker) + return after + } + + return nok(code) + } + + function after(code) { + if (markdownSpace(code)) { + effects.enter(types.blockQuotePrefixWhitespace) + effects.consume(code) + effects.exit(types.blockQuotePrefixWhitespace) + effects.exit(types.blockQuotePrefix) + return ok + } + + effects.exit(types.blockQuotePrefix) + return ok(code) + } +} + +function tokenizeBlockQuoteContinuation(effects, ok, nok) { + return factorySpace( + effects, + effects.attempt(blockQuote, ok, nok), + types.linePrefix, + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : constants.tabSize + ) +} + +function exit(effects) { + effects.exit(types.blockQuote) +} + +module.exports = blockQuote diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/block-quote.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/block-quote.mjs new file mode 100644 index 00000000000000..cf215ba60297ee --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/block-quote.mjs @@ -0,0 +1,64 @@ +var blockQuote = { + name: 'blockQuote', + tokenize: tokenizeBlockQuoteStart, + continuation: {tokenize: tokenizeBlockQuoteContinuation}, + exit: exit +} +export default blockQuote + +import codes from '../character/codes.mjs' +import markdownSpace from '../character/markdown-space.mjs' +import constants from '../constant/constants.mjs' +import types from '../constant/types.mjs' +import spaceFactory from './factory-space.mjs' + +function tokenizeBlockQuoteStart(effects, ok, nok) { + var self = this + + return start + + function start(code) { + if (code === codes.greaterThan) { + if (!self.containerState.open) { + effects.enter(types.blockQuote, {_container: true}) + self.containerState.open = true + } + + effects.enter(types.blockQuotePrefix) + effects.enter(types.blockQuoteMarker) + effects.consume(code) + effects.exit(types.blockQuoteMarker) + return after + } + + return nok(code) + } + + function after(code) { + if (markdownSpace(code)) { + effects.enter(types.blockQuotePrefixWhitespace) + effects.consume(code) + effects.exit(types.blockQuotePrefixWhitespace) + effects.exit(types.blockQuotePrefix) + return ok + } + + effects.exit(types.blockQuotePrefix) + return ok(code) + } +} + +function tokenizeBlockQuoteContinuation(effects, ok, nok) { + return spaceFactory( + effects, + effects.attempt(blockQuote, ok, nok), + types.linePrefix, + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : constants.tabSize + ) +} + +function exit(effects) { + effects.exit(types.blockQuote) +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/character-escape.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/character-escape.js new file mode 100644 index 00000000000000..2c796400033887 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/character-escape.js @@ -0,0 +1,44 @@ +'use strict' + +var assert = require('assert') +var asciiPunctuation = require('../character/ascii-punctuation.js') +var codes = require('../character/codes.js') +var types = require('../constant/types.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +var characterEscape = { + name: 'characterEscape', + tokenize: tokenizeCharacterEscape +} + +function tokenizeCharacterEscape(effects, ok, nok) { + return start + + function start(code) { + assert__default['default'](code === codes.backslash, 'expected `\\`') + effects.enter(types.characterEscape) + effects.enter(types.escapeMarker) + effects.consume(code) + effects.exit(types.escapeMarker) + return open + } + + function open(code) { + if (asciiPunctuation(code)) { + effects.enter(types.characterEscapeValue) + effects.consume(code) + effects.exit(types.characterEscapeValue) + effects.exit(types.characterEscape) + return ok + } + + return nok(code) + } +} + +module.exports = characterEscape diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/character-escape.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/character-escape.mjs new file mode 100644 index 00000000000000..fae1f771082a34 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/character-escape.mjs @@ -0,0 +1,35 @@ +var characterEscape = { + name: 'characterEscape', + tokenize: tokenizeCharacterEscape +} +export default characterEscape + +import assert from 'assert' +import asciiPunctuation from '../character/ascii-punctuation.mjs' +import codes from '../character/codes.mjs' +import types from '../constant/types.mjs' + +function tokenizeCharacterEscape(effects, ok, nok) { + return start + + function start(code) { + assert(code === codes.backslash, 'expected `\\`') + effects.enter(types.characterEscape) + effects.enter(types.escapeMarker) + effects.consume(code) + effects.exit(types.escapeMarker) + return open + } + + function open(code) { + if (asciiPunctuation(code)) { + effects.enter(types.characterEscapeValue) + effects.consume(code) + effects.exit(types.characterEscapeValue) + effects.exit(types.characterEscape) + return ok + } + + return nok(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/character-reference.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/character-reference.js new file mode 100644 index 00000000000000..0f3966c6d77b4b --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/character-reference.js @@ -0,0 +1,101 @@ +'use strict' + +var assert = require('assert') +var decodeEntity = require('parse-entities/decode-entity.js') +var asciiAlphanumeric = require('../character/ascii-alphanumeric.js') +var asciiDigit = require('../character/ascii-digit.js') +var asciiHexDigit = require('../character/ascii-hex-digit.js') +var codes = require('../character/codes.js') +var constants = require('../constant/constants.js') +var types = require('../constant/types.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) +var decodeEntity__default = /*#__PURE__*/ _interopDefaultLegacy(decodeEntity) + +var characterReference = { + name: 'characterReference', + tokenize: tokenizeCharacterReference +} + +function tokenizeCharacterReference(effects, ok, nok) { + var self = this + var size = 0 + var max + var test + + return start + + function start(code) { + assert__default['default'](code === codes.ampersand, 'expected `&`') + effects.enter(types.characterReference) + effects.enter(types.characterReferenceMarker) + effects.consume(code) + effects.exit(types.characterReferenceMarker) + return open + } + + function open(code) { + if (code === codes.numberSign) { + effects.enter(types.characterReferenceMarkerNumeric) + effects.consume(code) + effects.exit(types.characterReferenceMarkerNumeric) + return numeric + } + + effects.enter(types.characterReferenceValue) + max = constants.characterReferenceNamedSizeMax + test = asciiAlphanumeric + return value(code) + } + + function numeric(code) { + if (code === codes.uppercaseX || code === codes.lowercaseX) { + effects.enter(types.characterReferenceMarkerHexadecimal) + effects.consume(code) + effects.exit(types.characterReferenceMarkerHexadecimal) + effects.enter(types.characterReferenceValue) + max = constants.characterReferenceHexadecimalSizeMax + test = asciiHexDigit + return value + } + + effects.enter(types.characterReferenceValue) + max = constants.characterReferenceDecimalSizeMax + test = asciiDigit + return value(code) + } + + function value(code) { + var token + + if (code === codes.semicolon && size) { + token = effects.exit(types.characterReferenceValue) + + if ( + test === asciiAlphanumeric && + !decodeEntity__default['default'](self.sliceSerialize(token)) + ) { + return nok(code) + } + + effects.enter(types.characterReferenceMarker) + effects.consume(code) + effects.exit(types.characterReferenceMarker) + effects.exit(types.characterReference) + return ok + } + + if (test(code) && size++ < max) { + effects.consume(code) + return value + } + + return nok(code) + } +} + +module.exports = characterReference diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/character-reference.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/character-reference.mjs new file mode 100644 index 00000000000000..eb76075a6dacaa --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/character-reference.mjs @@ -0,0 +1,88 @@ +var characterReference = { + name: 'characterReference', + tokenize: tokenizeCharacterReference +} +export default characterReference + +import assert from 'assert' +import decode from 'parse-entities/decode-entity.js' +import asciiAlphanumeric from '../character/ascii-alphanumeric.mjs' +import asciiDigit from '../character/ascii-digit.mjs' +import asciiHexDigit from '../character/ascii-hex-digit.mjs' +import codes from '../character/codes.mjs' +import constants from '../constant/constants.mjs' +import types from '../constant/types.mjs' + +function tokenizeCharacterReference(effects, ok, nok) { + var self = this + var size = 0 + var max + var test + + return start + + function start(code) { + assert(code === codes.ampersand, 'expected `&`') + effects.enter(types.characterReference) + effects.enter(types.characterReferenceMarker) + effects.consume(code) + effects.exit(types.characterReferenceMarker) + return open + } + + function open(code) { + if (code === codes.numberSign) { + effects.enter(types.characterReferenceMarkerNumeric) + effects.consume(code) + effects.exit(types.characterReferenceMarkerNumeric) + return numeric + } + + effects.enter(types.characterReferenceValue) + max = constants.characterReferenceNamedSizeMax + test = asciiAlphanumeric + return value(code) + } + + function numeric(code) { + if (code === codes.uppercaseX || code === codes.lowercaseX) { + effects.enter(types.characterReferenceMarkerHexadecimal) + effects.consume(code) + effects.exit(types.characterReferenceMarkerHexadecimal) + effects.enter(types.characterReferenceValue) + max = constants.characterReferenceHexadecimalSizeMax + test = asciiHexDigit + return value + } + + effects.enter(types.characterReferenceValue) + max = constants.characterReferenceDecimalSizeMax + test = asciiDigit + return value(code) + } + + function value(code) { + var token + + if (code === codes.semicolon && size) { + token = effects.exit(types.characterReferenceValue) + + if (test === asciiAlphanumeric && !decode(self.sliceSerialize(token))) { + return nok(code) + } + + effects.enter(types.characterReferenceMarker) + effects.consume(code) + effects.exit(types.characterReferenceMarker) + effects.exit(types.characterReference) + return ok + } + + if (test(code) && size++ < max) { + effects.consume(code) + return value + } + + return nok(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/code-fenced.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/code-fenced.js new file mode 100644 index 00000000000000..f73583584c37cc --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/code-fenced.js @@ -0,0 +1,185 @@ +'use strict' + +var assert = require('assert') +var codes = require('../character/codes.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var markdownLineEndingOrSpace = require('../character/markdown-line-ending-or-space.js') +var constants = require('../constant/constants.js') +var types = require('../constant/types.js') +var prefixSize = require('../util/prefix-size.js') +var factorySpace = require('./factory-space.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +var codeFenced = { + name: 'codeFenced', + tokenize: tokenizeCodeFenced, + concrete: true +} + +function tokenizeCodeFenced(effects, ok, nok) { + var self = this + var closingFenceConstruct = {tokenize: tokenizeClosingFence, partial: true} + var initialPrefix = prefixSize(this.events, types.linePrefix) + var sizeOpen = 0 + var marker + + return start + + function start(code) { + assert__default['default']( + code === codes.graveAccent || code === codes.tilde, + 'expected `` ` `` or `~`' + ) + effects.enter(types.codeFenced) + effects.enter(types.codeFencedFence) + effects.enter(types.codeFencedFenceSequence) + marker = code + return sequenceOpen(code) + } + + function sequenceOpen(code) { + if (code === marker) { + effects.consume(code) + sizeOpen++ + return sequenceOpen + } + + effects.exit(types.codeFencedFenceSequence) + return sizeOpen < constants.codeFencedSequenceSizeMin + ? nok(code) + : factorySpace(effects, infoOpen, types.whitespace)(code) + } + + function infoOpen(code) { + if (code === codes.eof || markdownLineEnding(code)) { + return openAfter(code) + } + + effects.enter(types.codeFencedFenceInfo) + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return info(code) + } + + function info(code) { + if (code === codes.eof || markdownLineEndingOrSpace(code)) { + effects.exit(types.chunkString) + effects.exit(types.codeFencedFenceInfo) + return factorySpace(effects, infoAfter, types.whitespace)(code) + } + + if (code === codes.graveAccent && code === marker) return nok(code) + effects.consume(code) + return info + } + + function infoAfter(code) { + if (code === codes.eof || markdownLineEnding(code)) { + return openAfter(code) + } + + effects.enter(types.codeFencedFenceMeta) + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return meta(code) + } + + function meta(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.chunkString) + effects.exit(types.codeFencedFenceMeta) + return openAfter(code) + } + + if (code === codes.graveAccent && code === marker) return nok(code) + effects.consume(code) + return meta + } + + function openAfter(code) { + effects.exit(types.codeFencedFence) + return self.interrupt ? ok(code) : content(code) + } + + function content(code) { + if (code === codes.eof) { + return after(code) + } + + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return effects.attempt( + closingFenceConstruct, + after, + initialPrefix + ? factorySpace(effects, content, types.linePrefix, initialPrefix + 1) + : content + ) + } + + effects.enter(types.codeFlowValue) + return contentContinue(code) + } + + function contentContinue(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.codeFlowValue) + return content(code) + } + + effects.consume(code) + return contentContinue + } + + function after(code) { + effects.exit(types.codeFenced) + return ok(code) + } + + function tokenizeClosingFence(effects, ok, nok) { + var size = 0 + + return factorySpace( + effects, + closingSequenceStart, + types.linePrefix, + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : constants.tabSize + ) + + function closingSequenceStart(code) { + effects.enter(types.codeFencedFence) + effects.enter(types.codeFencedFenceSequence) + return closingSequence(code) + } + + function closingSequence(code) { + if (code === marker) { + effects.consume(code) + size++ + return closingSequence + } + + if (size < sizeOpen) return nok(code) + effects.exit(types.codeFencedFenceSequence) + return factorySpace(effects, closingSequenceEnd, types.whitespace)(code) + } + + function closingSequenceEnd(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.codeFencedFence) + return ok(code) + } + + return nok(code) + } + } +} + +module.exports = codeFenced diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/code-fenced.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/code-fenced.mjs new file mode 100644 index 00000000000000..14f83b1fdd470a --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/code-fenced.mjs @@ -0,0 +1,176 @@ +var codeFenced = { + name: 'codeFenced', + tokenize: tokenizeCodeFenced, + concrete: true +} +export default codeFenced + +import assert from 'assert' +import codes from '../character/codes.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import markdownLineEndingOrSpace from '../character/markdown-line-ending-or-space.mjs' +import constants from '../constant/constants.mjs' +import types from '../constant/types.mjs' +import prefixSize from '../util/prefix-size.mjs' +import spaceFactory from './factory-space.mjs' + +function tokenizeCodeFenced(effects, ok, nok) { + var self = this + var closingFenceConstruct = {tokenize: tokenizeClosingFence, partial: true} + var initialPrefix = prefixSize(this.events, types.linePrefix) + var sizeOpen = 0 + var marker + + return start + + function start(code) { + assert( + code === codes.graveAccent || code === codes.tilde, + 'expected `` ` `` or `~`' + ) + effects.enter(types.codeFenced) + effects.enter(types.codeFencedFence) + effects.enter(types.codeFencedFenceSequence) + marker = code + return sequenceOpen(code) + } + + function sequenceOpen(code) { + if (code === marker) { + effects.consume(code) + sizeOpen++ + return sequenceOpen + } + + effects.exit(types.codeFencedFenceSequence) + return sizeOpen < constants.codeFencedSequenceSizeMin + ? nok(code) + : spaceFactory(effects, infoOpen, types.whitespace)(code) + } + + function infoOpen(code) { + if (code === codes.eof || markdownLineEnding(code)) { + return openAfter(code) + } + + effects.enter(types.codeFencedFenceInfo) + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return info(code) + } + + function info(code) { + if (code === codes.eof || markdownLineEndingOrSpace(code)) { + effects.exit(types.chunkString) + effects.exit(types.codeFencedFenceInfo) + return spaceFactory(effects, infoAfter, types.whitespace)(code) + } + + if (code === codes.graveAccent && code === marker) return nok(code) + effects.consume(code) + return info + } + + function infoAfter(code) { + if (code === codes.eof || markdownLineEnding(code)) { + return openAfter(code) + } + + effects.enter(types.codeFencedFenceMeta) + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return meta(code) + } + + function meta(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.chunkString) + effects.exit(types.codeFencedFenceMeta) + return openAfter(code) + } + + if (code === codes.graveAccent && code === marker) return nok(code) + effects.consume(code) + return meta + } + + function openAfter(code) { + effects.exit(types.codeFencedFence) + return self.interrupt ? ok(code) : content(code) + } + + function content(code) { + if (code === codes.eof) { + return after(code) + } + + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return effects.attempt( + closingFenceConstruct, + after, + initialPrefix + ? spaceFactory(effects, content, types.linePrefix, initialPrefix + 1) + : content + ) + } + + effects.enter(types.codeFlowValue) + return contentContinue(code) + } + + function contentContinue(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.codeFlowValue) + return content(code) + } + + effects.consume(code) + return contentContinue + } + + function after(code) { + effects.exit(types.codeFenced) + return ok(code) + } + + function tokenizeClosingFence(effects, ok, nok) { + var size = 0 + + return spaceFactory( + effects, + closingSequenceStart, + types.linePrefix, + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : constants.tabSize + ) + + function closingSequenceStart(code) { + effects.enter(types.codeFencedFence) + effects.enter(types.codeFencedFenceSequence) + return closingSequence(code) + } + + function closingSequence(code) { + if (code === marker) { + effects.consume(code) + size++ + return closingSequence + } + + if (size < sizeOpen) return nok(code) + effects.exit(types.codeFencedFenceSequence) + return spaceFactory(effects, closingSequenceEnd, types.whitespace)(code) + } + + function closingSequenceEnd(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.codeFencedFence) + return ok(code) + } + + return nok(code) + } + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/code-indented.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/code-indented.js new file mode 100644 index 00000000000000..8725366d26fd4e --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/code-indented.js @@ -0,0 +1,91 @@ +'use strict' + +var codes = require('../character/codes.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var constants = require('../constant/constants.js') +var types = require('../constant/types.js') +var chunkedSplice = require('../util/chunked-splice.js') +var prefixSize = require('../util/prefix-size.js') +var factorySpace = require('./factory-space.js') + +var codeIndented = { + name: 'codeIndented', + tokenize: tokenizeCodeIndented, + resolve: resolveCodeIndented +} + +var indentedContentConstruct = { + tokenize: tokenizeIndentedContent, + partial: true +} + +function resolveCodeIndented(events, context) { + var code = { + type: types.codeIndented, + start: events[0][1].start, + end: events[events.length - 1][1].end + } + + chunkedSplice(events, 0, 0, [['enter', code, context]]) + chunkedSplice(events, events.length, 0, [['exit', code, context]]) + + return events +} + +function tokenizeCodeIndented(effects, ok, nok) { + return effects.attempt(indentedContentConstruct, afterPrefix, nok) + + function afterPrefix(code) { + if (code === codes.eof) { + return ok(code) + } + + if (markdownLineEnding(code)) { + return effects.attempt(indentedContentConstruct, afterPrefix, ok)(code) + } + + effects.enter(types.codeFlowValue) + return content(code) + } + + function content(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.codeFlowValue) + return afterPrefix(code) + } + + effects.consume(code) + return content + } +} + +function tokenizeIndentedContent(effects, ok, nok) { + var self = this + + return factorySpace( + effects, + afterPrefix, + types.linePrefix, + constants.tabSize + 1 + ) + + function afterPrefix(code) { + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return factorySpace( + effects, + afterPrefix, + types.linePrefix, + constants.tabSize + 1 + ) + } + + return prefixSize(self.events, types.linePrefix) < constants.tabSize + ? nok(code) + : ok(code) + } +} + +module.exports = codeIndented diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/code-indented.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/code-indented.mjs new file mode 100644 index 00000000000000..91919141418475 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/code-indented.mjs @@ -0,0 +1,88 @@ +var codeIndented = { + name: 'codeIndented', + tokenize: tokenizeCodeIndented, + resolve: resolveCodeIndented +} +export default codeIndented + +import codes from '../character/codes.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import constants from '../constant/constants.mjs' +import types from '../constant/types.mjs' +import chunkedSplice from '../util/chunked-splice.mjs' +import prefixSize from '../util/prefix-size.mjs' +import spaceFactory from './factory-space.mjs' + +var indentedContentConstruct = { + tokenize: tokenizeIndentedContent, + partial: true +} + +function resolveCodeIndented(events, context) { + var code = { + type: types.codeIndented, + start: events[0][1].start, + end: events[events.length - 1][1].end + } + + chunkedSplice(events, 0, 0, [['enter', code, context]]) + chunkedSplice(events, events.length, 0, [['exit', code, context]]) + + return events +} + +function tokenizeCodeIndented(effects, ok, nok) { + return effects.attempt(indentedContentConstruct, afterPrefix, nok) + + function afterPrefix(code) { + if (code === codes.eof) { + return ok(code) + } + + if (markdownLineEnding(code)) { + return effects.attempt(indentedContentConstruct, afterPrefix, ok)(code) + } + + effects.enter(types.codeFlowValue) + return content(code) + } + + function content(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.codeFlowValue) + return afterPrefix(code) + } + + effects.consume(code) + return content + } +} + +function tokenizeIndentedContent(effects, ok, nok) { + var self = this + + return spaceFactory( + effects, + afterPrefix, + types.linePrefix, + constants.tabSize + 1 + ) + + function afterPrefix(code) { + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return spaceFactory( + effects, + afterPrefix, + types.linePrefix, + constants.tabSize + 1 + ) + } + + return prefixSize(self.events, types.linePrefix) < constants.tabSize + ? nok(code) + : ok(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/code-text.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/code-text.js new file mode 100644 index 00000000000000..0eb1db81f1bb0f --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/code-text.js @@ -0,0 +1,191 @@ +'use strict' + +var assert = require('assert') +var codes = require('../character/codes.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var types = require('../constant/types.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +var codeText = { + name: 'codeText', + tokenize: tokenizeCodeText, + resolve: resolveCodeText, + previous: previous +} + +function resolveCodeText(events) { + var tailExitIndex = events.length - 4 + var headEnterIndex = 3 + var index + var enter + + // If we start and end with an EOL or a space. + if ( + (events[headEnterIndex][1].type === types.lineEnding || + events[headEnterIndex][1].type === 'space') && + (events[tailExitIndex][1].type === types.lineEnding || + events[tailExitIndex][1].type === 'space') + ) { + index = headEnterIndex + + // And we have data. + while (++index < tailExitIndex) { + if (events[index][1].type === types.codeTextData) { + // Then we have padding. + events[tailExitIndex][1].type = events[headEnterIndex][1].type = + types.codeTextPadding + headEnterIndex += 2 + tailExitIndex -= 2 + break + } + } + } + + // Merge adjacent spaces and data. + index = headEnterIndex - 1 + tailExitIndex++ + + while (++index <= tailExitIndex) { + if (enter === undefined) { + if ( + index !== tailExitIndex && + events[index][1].type !== types.lineEnding + ) { + enter = index + } + } else if ( + index === tailExitIndex || + events[index][1].type === types.lineEnding + ) { + events[enter][1].type = types.codeTextData + + if (index !== enter + 2) { + events[enter][1].end = events[index - 1][1].end + events.splice(enter + 2, index - enter - 2) + tailExitIndex -= index - enter - 2 + index = enter + 2 + } + + enter = undefined + } + } + + return events +} + +function previous(code) { + // If there is a previous code, there will always be a tail. + return ( + code !== codes.graveAccent || + this.events[this.events.length - 1][1].type === types.characterEscape + ) +} + +function tokenizeCodeText(effects, ok, nok) { + var self = this + var sizeOpen = 0 + var size + var token + + return start + + function start(code) { + assert__default['default'](code === codes.graveAccent, 'expected `` ` ``') + assert__default['default']( + previous.call(self, self.previous), + 'expected correct previous' + ) + effects.enter(types.codeText) + effects.enter(types.codeTextSequence) + return openingSequence(code) + } + + function openingSequence(code) { + if (code === codes.graveAccent) { + effects.consume(code) + sizeOpen++ + return openingSequence + } + + effects.exit(types.codeTextSequence) + return gap(code) + } + + function gap(code) { + // EOF. + if (code === codes.eof) { + return nok(code) + } + + // Closing fence? + // Could also be data. + if (code === codes.graveAccent) { + token = effects.enter(types.codeTextSequence) + size = 0 + return closingSequence(code) + } + + // Tabs don’t work, and virtual spaces don’t make sense. + if (code === codes.space) { + effects.enter('space') + effects.consume(code) + effects.exit('space') + return gap + } + + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return gap + } + + // Data. + effects.enter(types.codeTextData) + return data(code) + } + + // In code. + function data(code) { + if ( + code === codes.eof || + code === codes.space || + code === codes.graveAccent || + markdownLineEnding(code) + ) { + effects.exit(types.codeTextData) + return gap(code) + } + + effects.consume(code) + return data + } + + // Closing fence. + function closingSequence(code) { + // More. + if (code === codes.graveAccent) { + effects.consume(code) + size++ + return closingSequence + } + + // Done! + if (size === sizeOpen) { + effects.exit(types.codeTextSequence) + effects.exit(types.codeText) + return ok(code) + } + + // More or less accents: mark as data. + token.type = types.codeTextData + return data(code) + } +} + +module.exports = codeText diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/code-text.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/code-text.mjs new file mode 100644 index 00000000000000..7c44b65949bb8c --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/code-text.mjs @@ -0,0 +1,179 @@ +var codeText = { + name: 'codeText', + tokenize: tokenizeCodeText, + resolve: resolveCodeText, + previous: previous +} +export default codeText + +import assert from 'assert' +import codes from '../character/codes.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import types from '../constant/types.mjs' + +function resolveCodeText(events) { + var tailExitIndex = events.length - 4 + var headEnterIndex = 3 + var index + var enter + + // If we start and end with an EOL or a space. + if ( + (events[headEnterIndex][1].type === types.lineEnding || + events[headEnterIndex][1].type === 'space') && + (events[tailExitIndex][1].type === types.lineEnding || + events[tailExitIndex][1].type === 'space') + ) { + index = headEnterIndex + + // And we have data. + while (++index < tailExitIndex) { + if (events[index][1].type === types.codeTextData) { + // Then we have padding. + events[tailExitIndex][1].type = events[headEnterIndex][1].type = + types.codeTextPadding + headEnterIndex += 2 + tailExitIndex -= 2 + break + } + } + } + + // Merge adjacent spaces and data. + index = headEnterIndex - 1 + tailExitIndex++ + + while (++index <= tailExitIndex) { + if (enter === undefined) { + if ( + index !== tailExitIndex && + events[index][1].type !== types.lineEnding + ) { + enter = index + } + } else if ( + index === tailExitIndex || + events[index][1].type === types.lineEnding + ) { + events[enter][1].type = types.codeTextData + + if (index !== enter + 2) { + events[enter][1].end = events[index - 1][1].end + events.splice(enter + 2, index - enter - 2) + tailExitIndex -= index - enter - 2 + index = enter + 2 + } + + enter = undefined + } + } + + return events +} + +function previous(code) { + // If there is a previous code, there will always be a tail. + return ( + code !== codes.graveAccent || + this.events[this.events.length - 1][1].type === types.characterEscape + ) +} + +function tokenizeCodeText(effects, ok, nok) { + var self = this + var sizeOpen = 0 + var size + var token + + return start + + function start(code) { + assert(code === codes.graveAccent, 'expected `` ` ``') + assert(previous.call(self, self.previous), 'expected correct previous') + effects.enter(types.codeText) + effects.enter(types.codeTextSequence) + return openingSequence(code) + } + + function openingSequence(code) { + if (code === codes.graveAccent) { + effects.consume(code) + sizeOpen++ + return openingSequence + } + + effects.exit(types.codeTextSequence) + return gap(code) + } + + function gap(code) { + // EOF. + if (code === codes.eof) { + return nok(code) + } + + // Closing fence? + // Could also be data. + if (code === codes.graveAccent) { + token = effects.enter(types.codeTextSequence) + size = 0 + return closingSequence(code) + } + + // Tabs don’t work, and virtual spaces don’t make sense. + if (code === codes.space) { + effects.enter('space') + effects.consume(code) + effects.exit('space') + return gap + } + + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return gap + } + + // Data. + effects.enter(types.codeTextData) + return data(code) + } + + // In code. + function data(code) { + if ( + code === codes.eof || + code === codes.space || + code === codes.graveAccent || + markdownLineEnding(code) + ) { + effects.exit(types.codeTextData) + return gap(code) + } + + effects.consume(code) + return data + } + + // Closing fence. + function closingSequence(code) { + // More. + if (code === codes.graveAccent) { + effects.consume(code) + size++ + return closingSequence + } + + // Done! + if (size === sizeOpen) { + effects.exit(types.codeTextSequence) + effects.exit(types.codeText) + return ok(code) + } + + // More or less accents: mark as data. + token.type = types.codeTextData + return data(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/content.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/content.js new file mode 100644 index 00000000000000..cb763ec50f7514 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/content.js @@ -0,0 +1,121 @@ +'use strict' + +var assert = require('assert') +var codes = require('../character/codes.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var constants = require('../constant/constants.js') +var types = require('../constant/types.js') +var prefixSize = require('../util/prefix-size.js') +var subtokenize = require('../util/subtokenize.js') +var factorySpace = require('./factory-space.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +// No name because it must not be turned off. +var content = { + tokenize: tokenizeContent, + resolve: resolveContent, + interruptible: true, + lazy: true +} + +var continuationConstruct = {tokenize: tokenizeContinuation, partial: true} + +// Content is transparent: it’s parsed right now. That way, definitions are also +// parsed right now: before text in paragraphs (specifically, media) are parsed. +function resolveContent(events) { + subtokenize(events) + return events +} + +function tokenizeContent(effects, ok) { + var previous + + return start + + function start(code) { + assert__default['default']( + code !== codes.eof && !markdownLineEnding(code), + 'expected no eof or eol' + ) + + effects.enter(types.content) + previous = effects.enter(types.chunkContent, { + contentType: constants.contentTypeContent + }) + return data(code) + } + + function data(code) { + if (code === codes.eof) { + return contentEnd(code) + } + + if (markdownLineEnding(code)) { + return effects.check( + continuationConstruct, + contentContinue, + contentEnd + )(code) + } + + // Data. + effects.consume(code) + return data + } + + function contentEnd(code) { + effects.exit(types.chunkContent) + effects.exit(types.content) + return ok(code) + } + + function contentContinue(code) { + assert__default['default'](markdownLineEnding(code), 'expected eol') + effects.consume(code) + effects.exit(types.chunkContent) + previous = previous.next = effects.enter(types.chunkContent, { + contentType: constants.contentTypeContent, + previous: previous + }) + return data + } +} + +function tokenizeContinuation(effects, ok, nok) { + var self = this + + return startLookahead + + function startLookahead(code) { + assert__default['default']( + markdownLineEnding(code), + 'expected a line ending' + ) + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return factorySpace(effects, prefixed, types.linePrefix) + } + + function prefixed(code) { + if (code === codes.eof || markdownLineEnding(code)) { + return nok(code) + } + + if ( + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 || + prefixSize(self.events, types.linePrefix) < constants.tabSize + ) { + return effects.interrupt(self.parser.constructs.flow, nok, ok)(code) + } + + return ok(code) + } +} + +module.exports = content diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/content.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/content.mjs new file mode 100644 index 00000000000000..ca9c2e15b610a4 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/content.mjs @@ -0,0 +1,109 @@ +// No name because it must not be turned off. +var content = { + tokenize: tokenizeContent, + resolve: resolveContent, + interruptible: true, + lazy: true +} +export default content + +import assert from 'assert' +import codes from '../character/codes.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import constants from '../constant/constants.mjs' +import types from '../constant/types.mjs' +import prefixSize from '../util/prefix-size.mjs' +import subtokenize from '../util/subtokenize.mjs' +import spaceFactory from './factory-space.mjs' + +var continuationConstruct = {tokenize: tokenizeContinuation, partial: true} + +// Content is transparent: it’s parsed right now. That way, definitions are also +// parsed right now: before text in paragraphs (specifically, media) are parsed. +function resolveContent(events) { + subtokenize(events) + return events +} + +function tokenizeContent(effects, ok) { + var previous + + return start + + function start(code) { + assert( + code !== codes.eof && !markdownLineEnding(code), + 'expected no eof or eol' + ) + + effects.enter(types.content) + previous = effects.enter(types.chunkContent, { + contentType: constants.contentTypeContent + }) + return data(code) + } + + function data(code) { + if (code === codes.eof) { + return contentEnd(code) + } + + if (markdownLineEnding(code)) { + return effects.check( + continuationConstruct, + contentContinue, + contentEnd + )(code) + } + + // Data. + effects.consume(code) + return data + } + + function contentEnd(code) { + effects.exit(types.chunkContent) + effects.exit(types.content) + return ok(code) + } + + function contentContinue(code) { + assert(markdownLineEnding(code), 'expected eol') + effects.consume(code) + effects.exit(types.chunkContent) + previous = previous.next = effects.enter(types.chunkContent, { + contentType: constants.contentTypeContent, + previous: previous + }) + return data + } +} + +function tokenizeContinuation(effects, ok, nok) { + var self = this + + return startLookahead + + function startLookahead(code) { + assert(markdownLineEnding(code), 'expected a line ending') + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return spaceFactory(effects, prefixed, types.linePrefix) + } + + function prefixed(code) { + if (code === codes.eof || markdownLineEnding(code)) { + return nok(code) + } + + if ( + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 || + prefixSize(self.events, types.linePrefix) < constants.tabSize + ) { + return effects.interrupt(self.parser.constructs.flow, nok, ok)(code) + } + + return ok(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/definition.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/definition.js new file mode 100644 index 00000000000000..c4604d578372e3 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/definition.js @@ -0,0 +1,129 @@ +'use strict' + +var assert = require('assert') +var codes = require('../character/codes.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var markdownLineEndingOrSpace = require('../character/markdown-line-ending-or-space.js') +var types = require('../constant/types.js') +var normalizeIdentifier = require('../util/normalize-identifier.js') +var factoryDestination = require('./factory-destination.js') +var factoryLabel = require('./factory-label.js') +var factorySpace = require('./factory-space.js') +var factoryWhitespace = require('./factory-whitespace.js') +var factoryTitle = require('./factory-title.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +var definition = { + name: 'definition', + tokenize: tokenizeDefinition +} + +var titleConstruct = {tokenize: tokenizeTitle, partial: true} + +function tokenizeDefinition(effects, ok, nok) { + var self = this + var identifier + + return start + + function start(code) { + assert__default['default'](code === codes.leftSquareBracket, 'expected `[`') + effects.enter(types.definition) + return factoryLabel.call( + self, + effects, + labelAfter, + nok, + types.definitionLabel, + types.definitionLabelMarker, + types.definitionLabelString + )(code) + } + + function labelAfter(code) { + identifier = normalizeIdentifier( + self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) + ) + + if (code === codes.colon) { + effects.enter(types.definitionMarker) + effects.consume(code) + effects.exit(types.definitionMarker) + + // Note: blank lines can’t exist in content. + return factoryWhitespace( + effects, + factoryDestination( + effects, + effects.attempt( + titleConstruct, + factorySpace(effects, after, types.whitespace), + factorySpace(effects, after, types.whitespace) + ), + nok, + types.definitionDestination, + types.definitionDestinationLiteral, + types.definitionDestinationLiteralMarker, + types.definitionDestinationRaw, + types.definitionDestinationString + ) + ) + } + + return nok(code) + } + + function after(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.definition) + + if (self.parser.defined.indexOf(identifier) < 0) { + self.parser.defined.push(identifier) + } + + return ok(code) + } + + return nok(code) + } +} + +function tokenizeTitle(effects, ok, nok) { + return start + + function start(code) { + return markdownLineEndingOrSpace(code) + ? factoryWhitespace(effects, before)(code) + : nok(code) + } + + function before(code) { + if ( + code === codes.quotationMark || + code === codes.apostrophe || + code === codes.leftParenthesis + ) { + return factoryTitle( + effects, + factorySpace(effects, after, types.whitespace), + nok, + types.definitionTitle, + types.definitionTitleMarker, + types.definitionTitleString + )(code) + } + + return nok(code) + } + + function after(code) { + return code === codes.eof || markdownLineEnding(code) ? ok(code) : nok(code) + } +} + +module.exports = definition diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/definition.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/definition.mjs new file mode 100644 index 00000000000000..5cc0dde8066d9e --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/definition.mjs @@ -0,0 +1,120 @@ +var definition = { + name: 'definition', + tokenize: tokenizeDefinition +} +export default definition + +import assert from 'assert' +import codes from '../character/codes.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import markdownLineEndingOrSpace from '../character/markdown-line-ending-or-space.mjs' +import types from '../constant/types.mjs' +import normalizeIdentifier from '../util/normalize-identifier.mjs' +import destinationFactory from './factory-destination.mjs' +import labelFactory from './factory-label.mjs' +import spaceFactory from './factory-space.mjs' +import whitespaceFactory from './factory-whitespace.mjs' +import titleFactory from './factory-title.mjs' + +var titleConstruct = {tokenize: tokenizeTitle, partial: true} + +function tokenizeDefinition(effects, ok, nok) { + var self = this + var identifier + + return start + + function start(code) { + assert(code === codes.leftSquareBracket, 'expected `[`') + effects.enter(types.definition) + return labelFactory.call( + self, + effects, + labelAfter, + nok, + types.definitionLabel, + types.definitionLabelMarker, + types.definitionLabelString + )(code) + } + + function labelAfter(code) { + identifier = normalizeIdentifier( + self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) + ) + + if (code === codes.colon) { + effects.enter(types.definitionMarker) + effects.consume(code) + effects.exit(types.definitionMarker) + + // Note: blank lines can’t exist in content. + return whitespaceFactory( + effects, + destinationFactory( + effects, + effects.attempt( + titleConstruct, + spaceFactory(effects, after, types.whitespace), + spaceFactory(effects, after, types.whitespace) + ), + nok, + types.definitionDestination, + types.definitionDestinationLiteral, + types.definitionDestinationLiteralMarker, + types.definitionDestinationRaw, + types.definitionDestinationString + ) + ) + } + + return nok(code) + } + + function after(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.definition) + + if (self.parser.defined.indexOf(identifier) < 0) { + self.parser.defined.push(identifier) + } + + return ok(code) + } + + return nok(code) + } +} + +function tokenizeTitle(effects, ok, nok) { + return start + + function start(code) { + return markdownLineEndingOrSpace(code) + ? whitespaceFactory(effects, before)(code) + : nok(code) + } + + function before(code) { + if ( + code === codes.quotationMark || + code === codes.apostrophe || + code === codes.leftParenthesis + ) { + return titleFactory( + effects, + spaceFactory(effects, after, types.whitespace), + nok, + types.definitionTitle, + types.definitionTitleMarker, + types.definitionTitleString + )(code) + } + + return nok(code) + } + + function after(code) { + return code === codes.eof || markdownLineEnding(code) ? ok(code) : nok(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-destination.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-destination.js new file mode 100644 index 00000000000000..d746cd01d2395d --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-destination.js @@ -0,0 +1,145 @@ +'use strict' + +var asciiControl = require('../character/ascii-control.js') +var codes = require('../character/codes.js') +var markdownLineEndingOrSpace = require('../character/markdown-line-ending-or-space.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var constants = require('../constant/constants.js') +var types = require('../constant/types.js') + +// eslint-disable-next-line max-params +function destinationFactory( + effects, + ok, + nok, + type, + literalType, + literalMarkerType, + rawType, + stringType, + max +) { + var limit = max || Infinity + var balance = 0 + + return start + + function start(code) { + if (code === codes.lessThan) { + effects.enter(type) + effects.enter(literalType) + effects.enter(literalMarkerType) + effects.consume(code) + effects.exit(literalMarkerType) + return destinationEnclosedBefore + } + + if (asciiControl(code) || code === codes.rightParenthesis) { + return nok(code) + } + + effects.enter(type) + effects.enter(rawType) + effects.enter(stringType) + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return destinationRaw(code) + } + + function destinationEnclosedBefore(code) { + if (code === codes.greaterThan) { + effects.enter(literalMarkerType) + effects.consume(code) + effects.exit(literalMarkerType) + effects.exit(literalType) + effects.exit(type) + return ok + } + + effects.enter(stringType) + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return destinationEnclosed(code) + } + + function destinationEnclosed(code) { + if (code === codes.greaterThan) { + effects.exit(types.chunkString) + effects.exit(stringType) + return destinationEnclosedBefore(code) + } + + if ( + code === codes.eof || + code === codes.lessThan || + markdownLineEnding(code) + ) { + return nok(code) + } + + effects.consume(code) + return code === codes.backslash + ? destinationEnclosedEscape + : destinationEnclosed + } + + function destinationEnclosedEscape(code) { + if ( + code === codes.lessThan || + code === codes.greaterThan || + code === codes.backslash + ) { + effects.consume(code) + return destinationEnclosed + } + + return destinationEnclosed(code) + } + + function destinationRaw(code) { + if (code === codes.leftParenthesis) { + if (++balance > limit) return nok(code) + effects.consume(code) + return destinationRaw + } + + if (code === codes.rightParenthesis) { + if (!balance--) { + effects.exit(types.chunkString) + effects.exit(stringType) + effects.exit(rawType) + effects.exit(type) + return ok(code) + } + + effects.consume(code) + return destinationRaw + } + + if (code === codes.eof || markdownLineEndingOrSpace(code)) { + if (balance) return nok(code) + effects.exit(types.chunkString) + effects.exit(stringType) + effects.exit(rawType) + effects.exit(type) + return ok(code) + } + + if (asciiControl(code)) return nok(code) + effects.consume(code) + return code === codes.backslash ? destinationRawEscape : destinationRaw + } + + function destinationRawEscape(code) { + if ( + code === codes.leftParenthesis || + code === codes.rightParenthesis || + code === codes.backslash + ) { + effects.consume(code) + return destinationRaw + } + + return destinationRaw(code) + } +} + +module.exports = destinationFactory diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-destination.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-destination.mjs new file mode 100644 index 00000000000000..be8cf2bd89b17c --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-destination.mjs @@ -0,0 +1,143 @@ +export default destinationFactory + +import asciiControl from '../character/ascii-control.mjs' +import codes from '../character/codes.mjs' +import markdownLineEndingOrSpace from '../character/markdown-line-ending-or-space.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import constants from '../constant/constants.mjs' +import types from '../constant/types.mjs' + +// eslint-disable-next-line max-params +function destinationFactory( + effects, + ok, + nok, + type, + literalType, + literalMarkerType, + rawType, + stringType, + max +) { + var limit = max || Infinity + var balance = 0 + + return start + + function start(code) { + if (code === codes.lessThan) { + effects.enter(type) + effects.enter(literalType) + effects.enter(literalMarkerType) + effects.consume(code) + effects.exit(literalMarkerType) + return destinationEnclosedBefore + } + + if (asciiControl(code) || code === codes.rightParenthesis) { + return nok(code) + } + + effects.enter(type) + effects.enter(rawType) + effects.enter(stringType) + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return destinationRaw(code) + } + + function destinationEnclosedBefore(code) { + if (code === codes.greaterThan) { + effects.enter(literalMarkerType) + effects.consume(code) + effects.exit(literalMarkerType) + effects.exit(literalType) + effects.exit(type) + return ok + } + + effects.enter(stringType) + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return destinationEnclosed(code) + } + + function destinationEnclosed(code) { + if (code === codes.greaterThan) { + effects.exit(types.chunkString) + effects.exit(stringType) + return destinationEnclosedBefore(code) + } + + if ( + code === codes.eof || + code === codes.lessThan || + markdownLineEnding(code) + ) { + return nok(code) + } + + effects.consume(code) + return code === codes.backslash + ? destinationEnclosedEscape + : destinationEnclosed + } + + function destinationEnclosedEscape(code) { + if ( + code === codes.lessThan || + code === codes.greaterThan || + code === codes.backslash + ) { + effects.consume(code) + return destinationEnclosed + } + + return destinationEnclosed(code) + } + + function destinationRaw(code) { + if (code === codes.leftParenthesis) { + if (++balance > limit) return nok(code) + effects.consume(code) + return destinationRaw + } + + if (code === codes.rightParenthesis) { + if (!balance--) { + effects.exit(types.chunkString) + effects.exit(stringType) + effects.exit(rawType) + effects.exit(type) + return ok(code) + } + + effects.consume(code) + return destinationRaw + } + + if (code === codes.eof || markdownLineEndingOrSpace(code)) { + if (balance) return nok(code) + effects.exit(types.chunkString) + effects.exit(stringType) + effects.exit(rawType) + effects.exit(type) + return ok(code) + } + + if (asciiControl(code)) return nok(code) + effects.consume(code) + return code === codes.backslash ? destinationRawEscape : destinationRaw + } + + function destinationRawEscape(code) { + if ( + code === codes.leftParenthesis || + code === codes.rightParenthesis || + code === codes.backslash + ) { + effects.consume(code) + return destinationRaw + } + + return destinationRaw(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-label.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-label.js new file mode 100644 index 00000000000000..64d96d78eae094 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-label.js @@ -0,0 +1,102 @@ +'use strict' + +var assert = require('assert') +var codes = require('../character/codes.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var markdownSpace = require('../character/markdown-space.js') +var constants = require('../constant/constants.js') +var types = require('../constant/types.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +// eslint-disable-next-line max-params +function labelFactory(effects, ok, nok, type, markerType, stringType) { + var self = this + var size = 0 + var data + + return start + + function start(code) { + assert__default['default'](code === codes.leftSquareBracket, 'expected `[`') + effects.enter(type) + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + effects.enter(stringType) + return atBreak + } + + function atBreak(code) { + if ( + code === codes.eof || + code === codes.leftSquareBracket || + (code === codes.rightSquareBracket && !data) || + /* c8 ignore next */ + (code === codes.caret && + /* c8 ignore next */ + !size && + /* c8 ignore next */ + '_hiddenFootnoteSupport' in self.parser.constructs) || + size > constants.linkReferenceSizeMax + ) { + return nok(code) + } + + if (code === codes.rightSquareBracket) { + effects.exit(stringType) + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + effects.exit(type) + return ok + } + + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return atBreak + } + + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return label(code) + } + + function label(code) { + if ( + code === codes.eof || + code === codes.leftSquareBracket || + code === codes.rightSquareBracket || + markdownLineEnding(code) || + size++ > constants.linkReferenceSizeMax + ) { + effects.exit(types.chunkString) + return atBreak(code) + } + + effects.consume(code) + data = data || !markdownSpace(code) + return code === codes.backslash ? labelEscape : label + } + + function labelEscape(code) { + if ( + code === codes.leftSquareBracket || + code === codes.backslash || + code === codes.rightSquareBracket + ) { + effects.consume(code) + size++ + return label + } + + return label(code) + } +} + +module.exports = labelFactory diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-label.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-label.mjs new file mode 100644 index 00000000000000..eccdbd5b38ee3d --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-label.mjs @@ -0,0 +1,94 @@ +export default labelFactory + +import assert from 'assert' +import codes from '../character/codes.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import markdownSpace from '../character/markdown-space.mjs' +import constants from '../constant/constants.mjs' +import types from '../constant/types.mjs' + +// eslint-disable-next-line max-params +function labelFactory(effects, ok, nok, type, markerType, stringType) { + var self = this + var size = 0 + var data + + return start + + function start(code) { + assert(code === codes.leftSquareBracket, 'expected `[`') + effects.enter(type) + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + effects.enter(stringType) + return atBreak + } + + function atBreak(code) { + if ( + code === codes.eof || + code === codes.leftSquareBracket || + (code === codes.rightSquareBracket && !data) || + /* c8 ignore next */ + (code === codes.caret && + /* c8 ignore next */ + !size && + /* c8 ignore next */ + '_hiddenFootnoteSupport' in self.parser.constructs) || + size > constants.linkReferenceSizeMax + ) { + return nok(code) + } + + if (code === codes.rightSquareBracket) { + effects.exit(stringType) + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + effects.exit(type) + return ok + } + + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return atBreak + } + + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return label(code) + } + + function label(code) { + if ( + code === codes.eof || + code === codes.leftSquareBracket || + code === codes.rightSquareBracket || + markdownLineEnding(code) || + size++ > constants.linkReferenceSizeMax + ) { + effects.exit(types.chunkString) + return atBreak(code) + } + + effects.consume(code) + data = data || !markdownSpace(code) + return code === codes.backslash ? labelEscape : label + } + + function labelEscape(code) { + if ( + code === codes.leftSquareBracket || + code === codes.backslash || + code === codes.rightSquareBracket + ) { + effects.consume(code) + size++ + return label + } + + return label(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-space.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-space.js new file mode 100644 index 00000000000000..d907c5dca8ee94 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-space.js @@ -0,0 +1,31 @@ +'use strict' + +var markdownSpace = require('../character/markdown-space.js') + +function spaceFactory(effects, ok, type, max) { + var limit = max ? max - 1 : Infinity + var size = 0 + + return start + + function start(code) { + if (markdownSpace(code)) { + effects.enter(type) + return prefix(code) + } + + return ok(code) + } + + function prefix(code) { + if (markdownSpace(code) && size++ < limit) { + effects.consume(code) + return prefix + } + + effects.exit(type) + return ok(code) + } +} + +module.exports = spaceFactory diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-space.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-space.mjs new file mode 100644 index 00000000000000..9668400d30f44d --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-space.mjs @@ -0,0 +1,29 @@ +export default spaceFactory + +import markdownSpace from '../character/markdown-space.mjs' + +function spaceFactory(effects, ok, type, max) { + var limit = max ? max - 1 : Infinity + var size = 0 + + return start + + function start(code) { + if (markdownSpace(code)) { + effects.enter(type) + return prefix(code) + } + + return ok(code) + } + + function prefix(code) { + if (markdownSpace(code) && size++ < limit) { + effects.consume(code) + return prefix + } + + effects.exit(type) + return ok(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-title.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-title.js new file mode 100644 index 00000000000000..a5d6349b9cec29 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-title.js @@ -0,0 +1,92 @@ +'use strict' + +var assert = require('assert') +var codes = require('../character/codes.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var constants = require('../constant/constants.js') +var types = require('../constant/types.js') +var factorySpace = require('./factory-space.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +// eslint-disable-next-line max-params +function titleFactory(effects, ok, nok, type, markerType, stringType) { + var marker + + return start + + function start(code) { + assert__default['default']( + code === codes.quotationMark || + code === codes.apostrophe || + code === codes.leftParenthesis, + 'expected `"`, `\'`, or `(`' + ) + effects.enter(type) + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + marker = code === codes.leftParenthesis ? codes.rightParenthesis : code + return atFirstTitleBreak + } + + function atFirstTitleBreak(code) { + if (code === marker) { + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + effects.exit(type) + return ok + } + + effects.enter(stringType) + return atTitleBreak(code) + } + + function atTitleBreak(code) { + if (code === marker) { + effects.exit(stringType) + return atFirstTitleBreak(marker) + } + + if (code === codes.eof) { + return nok(code) + } + + // Note: blank lines can’t exist in content. + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return factorySpace(effects, atTitleBreak, types.linePrefix) + } + + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return title(code) + } + + function title(code) { + if (code === marker || code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.chunkString) + return atTitleBreak(code) + } + + effects.consume(code) + return code === codes.backslash ? titleEscape : title + } + + function titleEscape(code) { + if (code === marker || code === codes.backslash) { + effects.consume(code) + return title + } + + return title(code) + } +} + +module.exports = titleFactory diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-title.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-title.mjs new file mode 100644 index 00000000000000..5ac4405e4a7f3b --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-title.mjs @@ -0,0 +1,84 @@ +export default titleFactory + +import assert from 'assert' +import codes from '../character/codes.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import constants from '../constant/constants.mjs' +import types from '../constant/types.mjs' +import spaceFactory from './factory-space.mjs' + +// eslint-disable-next-line max-params +function titleFactory(effects, ok, nok, type, markerType, stringType) { + var marker + + return start + + function start(code) { + assert( + code === codes.quotationMark || + code === codes.apostrophe || + code === codes.leftParenthesis, + 'expected `"`, `\'`, or `(`' + ) + effects.enter(type) + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + marker = code === codes.leftParenthesis ? codes.rightParenthesis : code + return atFirstTitleBreak + } + + function atFirstTitleBreak(code) { + if (code === marker) { + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + effects.exit(type) + return ok + } + + effects.enter(stringType) + return atTitleBreak(code) + } + + function atTitleBreak(code) { + if (code === marker) { + effects.exit(stringType) + return atFirstTitleBreak(marker) + } + + if (code === codes.eof) { + return nok(code) + } + + // Note: blank lines can’t exist in content. + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return spaceFactory(effects, atTitleBreak, types.linePrefix) + } + + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return title(code) + } + + function title(code) { + if (code === marker || code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.chunkString) + return atTitleBreak(code) + } + + effects.consume(code) + return code === codes.backslash ? titleEscape : title + } + + function titleEscape(code) { + if (code === marker || code === codes.backslash) { + effects.consume(code) + return title + } + + return title(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-whitespace.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-whitespace.js new file mode 100644 index 00000000000000..ae0ce966794469 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-whitespace.js @@ -0,0 +1,34 @@ +'use strict' + +var markdownLineEnding = require('../character/markdown-line-ending.js') +var markdownSpace = require('../character/markdown-space.js') +var types = require('../constant/types.js') +var factorySpace = require('./factory-space.js') + +function whitespaceFactory(effects, ok) { + var seen + + return start + + function start(code) { + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + seen = true + return start + } + + if (markdownSpace(code)) { + return factorySpace( + effects, + start, + seen ? types.linePrefix : types.lineSuffix + )(code) + } + + return ok(code) + } +} + +module.exports = whitespaceFactory diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-whitespace.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-whitespace.mjs new file mode 100644 index 00000000000000..8bea8fd224b019 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/factory-whitespace.mjs @@ -0,0 +1,32 @@ +export default whitespaceFactory + +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import markdownSpace from '../character/markdown-space.mjs' +import types from '../constant/types.mjs' +import spaceFactory from './factory-space.mjs' + +function whitespaceFactory(effects, ok) { + var seen + + return start + + function start(code) { + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + seen = true + return start + } + + if (markdownSpace(code)) { + return spaceFactory( + effects, + start, + seen ? types.linePrefix : types.lineSuffix + )(code) + } + + return ok(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/hard-break-escape.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/hard-break-escape.js new file mode 100644 index 00000000000000..38955ecabc898e --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/hard-break-escape.js @@ -0,0 +1,41 @@ +'use strict' + +var assert = require('assert') +var codes = require('../character/codes.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var types = require('../constant/types.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +var hardBreakEscape = { + name: 'hardBreakEscape', + tokenize: tokenizeHardBreakEscape +} + +function tokenizeHardBreakEscape(effects, ok, nok) { + return start + + function start(code) { + assert__default['default'](code === codes.backslash, 'expected `\\`') + effects.enter(types.hardBreakEscape) + effects.enter(types.escapeMarker) + effects.consume(code) + return open + } + + function open(code) { + if (markdownLineEnding(code)) { + effects.exit(types.escapeMarker) + effects.exit(types.hardBreakEscape) + return ok(code) + } + + return nok(code) + } +} + +module.exports = hardBreakEscape diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/hard-break-escape.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/hard-break-escape.mjs new file mode 100644 index 00000000000000..0b23062d17d420 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/hard-break-escape.mjs @@ -0,0 +1,32 @@ +var hardBreakEscape = { + name: 'hardBreakEscape', + tokenize: tokenizeHardBreakEscape +} +export default hardBreakEscape + +import assert from 'assert' +import codes from '../character/codes.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import types from '../constant/types.mjs' + +function tokenizeHardBreakEscape(effects, ok, nok) { + return start + + function start(code) { + assert(code === codes.backslash, 'expected `\\`') + effects.enter(types.hardBreakEscape) + effects.enter(types.escapeMarker) + effects.consume(code) + return open + } + + function open(code) { + if (markdownLineEnding(code)) { + effects.exit(types.escapeMarker) + effects.exit(types.hardBreakEscape) + return ok(code) + } + + return nok(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/heading-atx.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/heading-atx.js new file mode 100644 index 00000000000000..a3bfd060948d2a --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/heading-atx.js @@ -0,0 +1,151 @@ +'use strict' + +var assert = require('assert') +var codes = require('../character/codes.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var markdownLineEndingOrSpace = require('../character/markdown-line-ending-or-space.js') +var markdownSpace = require('../character/markdown-space.js') +var constants = require('../constant/constants.js') +var types = require('../constant/types.js') +var chunkedSplice = require('../util/chunked-splice.js') +var factorySpace = require('./factory-space.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +var headingAtx = { + name: 'headingAtx', + tokenize: tokenizeHeadingAtx, + resolve: resolveHeadingAtx +} + +function resolveHeadingAtx(events, context) { + var contentEnd = events.length - 2 + var contentStart = 3 + var content + var text + + // Prefix whitespace, part of the opening. + if (events[contentStart][1].type === types.whitespace) { + contentStart += 2 + } + + // Suffix whitespace, part of the closing. + if ( + contentEnd - 2 > contentStart && + events[contentEnd][1].type === types.whitespace + ) { + contentEnd -= 2 + } + + if ( + events[contentEnd][1].type === types.atxHeadingSequence && + (contentStart === contentEnd - 1 || + (contentEnd - 4 > contentStart && + events[contentEnd - 2][1].type === types.whitespace)) + ) { + contentEnd -= contentStart + 1 === contentEnd ? 2 : 4 + } + + if (contentEnd > contentStart) { + content = { + type: types.atxHeadingText, + start: events[contentStart][1].start, + end: events[contentEnd][1].end + } + text = { + type: types.chunkText, + start: events[contentStart][1].start, + end: events[contentEnd][1].end, + contentType: constants.contentTypeText + } + + chunkedSplice(events, contentStart, contentEnd - contentStart + 1, [ + ['enter', content, context], + ['enter', text, context], + ['exit', text, context], + ['exit', content, context] + ]) + } + + return events +} + +function tokenizeHeadingAtx(effects, ok, nok) { + var self = this + var size = 0 + + return start + + function start(code) { + assert__default['default'](code === codes.numberSign, 'expected `#`') + effects.enter(types.atxHeading) + effects.enter(types.atxHeadingSequence) + return fenceOpenInside(code) + } + + function fenceOpenInside(code) { + if ( + code === codes.numberSign && + size++ < constants.atxHeadingOpeningFenceSizeMax + ) { + effects.consume(code) + return fenceOpenInside + } + + if (code === codes.eof || markdownLineEndingOrSpace(code)) { + effects.exit(types.atxHeadingSequence) + return self.interrupt ? ok(code) : headingBreak(code) + } + + return nok(code) + } + + function headingBreak(code) { + if (code === codes.numberSign) { + effects.enter(types.atxHeadingSequence) + return sequence(code) + } + + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.atxHeading) + return ok(code) + } + + if (markdownSpace(code)) { + return factorySpace(effects, headingBreak, types.whitespace)(code) + } + + effects.enter(types.atxHeadingText) + return data(code) + } + + function sequence(code) { + if (code === codes.numberSign) { + effects.consume(code) + return sequence + } + + effects.exit(types.atxHeadingSequence) + return headingBreak(code) + } + + function data(code) { + if ( + code === codes.eof || + code === codes.numberSign || + markdownLineEndingOrSpace(code) + ) { + effects.exit(types.atxHeadingText) + return headingBreak(code) + } + + effects.consume(code) + return data + } +} + +module.exports = headingAtx diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/heading-atx.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/heading-atx.mjs new file mode 100644 index 00000000000000..1a5ed07f42cbe0 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/heading-atx.mjs @@ -0,0 +1,142 @@ +var headingAtx = { + name: 'headingAtx', + tokenize: tokenizeHeadingAtx, + resolve: resolveHeadingAtx +} +export default headingAtx + +import assert from 'assert' +import codes from '../character/codes.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import markdownLineEndingOrSpace from '../character/markdown-line-ending-or-space.mjs' +import markdownSpace from '../character/markdown-space.mjs' +import constants from '../constant/constants.mjs' +import types from '../constant/types.mjs' +import chunkedSplice from '../util/chunked-splice.mjs' +import spaceFactory from './factory-space.mjs' + +function resolveHeadingAtx(events, context) { + var contentEnd = events.length - 2 + var contentStart = 3 + var content + var text + + // Prefix whitespace, part of the opening. + if (events[contentStart][1].type === types.whitespace) { + contentStart += 2 + } + + // Suffix whitespace, part of the closing. + if ( + contentEnd - 2 > contentStart && + events[contentEnd][1].type === types.whitespace + ) { + contentEnd -= 2 + } + + if ( + events[contentEnd][1].type === types.atxHeadingSequence && + (contentStart === contentEnd - 1 || + (contentEnd - 4 > contentStart && + events[contentEnd - 2][1].type === types.whitespace)) + ) { + contentEnd -= contentStart + 1 === contentEnd ? 2 : 4 + } + + if (contentEnd > contentStart) { + content = { + type: types.atxHeadingText, + start: events[contentStart][1].start, + end: events[contentEnd][1].end + } + text = { + type: types.chunkText, + start: events[contentStart][1].start, + end: events[contentEnd][1].end, + contentType: constants.contentTypeText + } + + chunkedSplice(events, contentStart, contentEnd - contentStart + 1, [ + ['enter', content, context], + ['enter', text, context], + ['exit', text, context], + ['exit', content, context] + ]) + } + + return events +} + +function tokenizeHeadingAtx(effects, ok, nok) { + var self = this + var size = 0 + + return start + + function start(code) { + assert(code === codes.numberSign, 'expected `#`') + effects.enter(types.atxHeading) + effects.enter(types.atxHeadingSequence) + return fenceOpenInside(code) + } + + function fenceOpenInside(code) { + if ( + code === codes.numberSign && + size++ < constants.atxHeadingOpeningFenceSizeMax + ) { + effects.consume(code) + return fenceOpenInside + } + + if (code === codes.eof || markdownLineEndingOrSpace(code)) { + effects.exit(types.atxHeadingSequence) + return self.interrupt ? ok(code) : headingBreak(code) + } + + return nok(code) + } + + function headingBreak(code) { + if (code === codes.numberSign) { + effects.enter(types.atxHeadingSequence) + return sequence(code) + } + + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.atxHeading) + return ok(code) + } + + if (markdownSpace(code)) { + return spaceFactory(effects, headingBreak, types.whitespace)(code) + } + + effects.enter(types.atxHeadingText) + return data(code) + } + + function sequence(code) { + if (code === codes.numberSign) { + effects.consume(code) + return sequence + } + + effects.exit(types.atxHeadingSequence) + return headingBreak(code) + } + + function data(code) { + if ( + code === codes.eof || + code === codes.numberSign || + markdownLineEndingOrSpace(code) + ) { + effects.exit(types.atxHeadingText) + return headingBreak(code) + } + + effects.consume(code) + return data + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/html-flow.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/html-flow.js new file mode 100644 index 00000000000000..c6a894ff9c00bc --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/html-flow.js @@ -0,0 +1,513 @@ +'use strict' + +var assert = require('assert') +var asciiAlpha = require('../character/ascii-alpha.js') +var asciiAlphanumeric = require('../character/ascii-alphanumeric.js') +var codes = require('../character/codes.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var markdownLineEndingOrSpace = require('../character/markdown-line-ending-or-space.js') +var markdownSpace = require('../character/markdown-space.js') +var constants = require('../constant/constants.js') +var fromCharCode = require('../constant/from-char-code.js') +var htmlBlockNames = require('../constant/html-block-names.js') +var htmlRawNames = require('../constant/html-raw-names.js') +var types = require('../constant/types.js') +var partialBlankLine = require('./partial-blank-line.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +var htmlFlow = { + name: 'htmlFlow', + tokenize: tokenizeHtmlFlow, + resolveTo: resolveToHtmlFlow, + concrete: true +} + +var nextBlankConstruct = {tokenize: tokenizeNextBlank, partial: true} + +function resolveToHtmlFlow(events) { + var index = events.length + + while (index--) { + if ( + events[index][0] === 'enter' && + events[index][1].type === types.htmlFlow + ) { + break + } + } + + if (index > 1 && events[index - 2][1].type === types.linePrefix) { + // Add the prefix start to the HTML token. + events[index][1].start = events[index - 2][1].start + // Add the prefix start to the HTML line token. + events[index + 1][1].start = events[index - 2][1].start + // Remove the line prefix. + events.splice(index - 2, 2) + } + + return events +} + +function tokenizeHtmlFlow(effects, ok, nok) { + var self = this + var kind + var startTag + var buffer + var index + var marker + + return start + + function start(code) { + assert__default['default'](code === codes.lessThan, 'expected `<`') + effects.enter(types.htmlFlow) + effects.enter(types.htmlFlowData) + effects.consume(code) + return open + } + + function open(code) { + if (code === codes.exclamationMark) { + effects.consume(code) + return declarationStart + } + + if (code === codes.slash) { + effects.consume(code) + return tagCloseStart + } + + if (code === codes.questionMark) { + effects.consume(code) + kind = constants.htmlInstruction + // While we’re in an instruction instead of a declaration, we’re on a `?` + // right now, so we do need to search for `>`, similar to declarations. + return self.interrupt ? ok : continuationDeclarationInside + } + + if (asciiAlpha(code)) { + effects.consume(code) + buffer = fromCharCode(code) + startTag = true + return tagName + } + + return nok(code) + } + + function declarationStart(code) { + if (code === codes.dash) { + effects.consume(code) + kind = constants.htmlComment + return commentOpenInside + } + + if (code === codes.leftSquareBracket) { + effects.consume(code) + kind = constants.htmlCdata + buffer = constants.cdataOpeningString + index = 0 + return cdataOpenInside + } + + if (asciiAlpha(code)) { + effects.consume(code) + kind = constants.htmlDeclaration + return self.interrupt ? ok : continuationDeclarationInside + } + + return nok(code) + } + + function commentOpenInside(code) { + if (code === codes.dash) { + effects.consume(code) + return self.interrupt ? ok : continuationDeclarationInside + } + + return nok(code) + } + + function cdataOpenInside(code) { + if (code === buffer.charCodeAt(index++)) { + effects.consume(code) + return index === buffer.length + ? self.interrupt + ? ok + : continuation + : cdataOpenInside + } + + return nok(code) + } + + function tagCloseStart(code) { + if (asciiAlpha(code)) { + effects.consume(code) + buffer = fromCharCode(code) + return tagName + } + + return nok(code) + } + + function tagName(code) { + if ( + code === codes.eof || + code === codes.slash || + code === codes.greaterThan || + markdownLineEndingOrSpace(code) + ) { + if ( + code !== codes.slash && + startTag && + htmlRawNames.indexOf(buffer.toLowerCase()) > -1 + ) { + kind = constants.htmlRaw + return self.interrupt ? ok(code) : continuation(code) + } + + if (htmlBlockNames.indexOf(buffer.toLowerCase()) > -1) { + kind = constants.htmlBasic + + if (code === codes.slash) { + effects.consume(code) + return basicSelfClosing + } + + return self.interrupt ? ok(code) : continuation(code) + } + + kind = constants.htmlComplete + // Do not support complete HTML when interrupting. + return self.interrupt + ? nok(code) + : startTag + ? completeAttributeNameBefore(code) + : completeClosingTagAfter(code) + } + + if (code === codes.dash || asciiAlphanumeric(code)) { + effects.consume(code) + buffer += fromCharCode(code) + return tagName + } + + return nok(code) + } + + function basicSelfClosing(code) { + if (code === codes.greaterThan) { + effects.consume(code) + return self.interrupt ? ok : continuation + } + + return nok(code) + } + + function completeClosingTagAfter(code) { + if (markdownSpace(code)) { + effects.consume(code) + return completeClosingTagAfter + } + + return completeEnd(code) + } + + function completeAttributeNameBefore(code) { + if (code === codes.slash) { + effects.consume(code) + return completeEnd + } + + if (code === codes.colon || code === codes.underscore || asciiAlpha(code)) { + effects.consume(code) + return completeAttributeName + } + + if (markdownSpace(code)) { + effects.consume(code) + return completeAttributeNameBefore + } + + return completeEnd(code) + } + + function completeAttributeName(code) { + if ( + code === codes.dash || + code === codes.dot || + code === codes.colon || + code === codes.underscore || + asciiAlphanumeric(code) + ) { + effects.consume(code) + return completeAttributeName + } + + return completeAttributeNameAfter(code) + } + + function completeAttributeNameAfter(code) { + if (code === codes.equalsTo) { + effects.consume(code) + return completeAttributeValueBefore + } + + if (markdownSpace(code)) { + effects.consume(code) + return completeAttributeNameAfter + } + + return completeAttributeNameBefore(code) + } + + function completeAttributeValueBefore(code) { + if ( + code === codes.eof || + code === codes.lessThan || + code === codes.equalsTo || + code === codes.greaterThan || + code === codes.graveAccent + ) { + return nok(code) + } + + if (code === codes.quotationMark || code === codes.apostrophe) { + effects.consume(code) + marker = code + return completeAttributeValueQuoted + } + + if (markdownSpace(code)) { + effects.consume(code) + return completeAttributeValueBefore + } + + marker = undefined + return completeAttributeValueUnquoted(code) + } + + function completeAttributeValueQuoted(code) { + if (code === marker) { + effects.consume(code) + return completeAttributeValueQuotedAfter + } + + if (code === codes.eof || markdownLineEnding(code)) { + return nok(code) + } + + effects.consume(code) + return completeAttributeValueQuoted + } + + function completeAttributeValueUnquoted(code) { + if ( + code === codes.eof || + code === codes.quotationMark || + code === codes.apostrophe || + code === codes.lessThan || + code === codes.equalsTo || + code === codes.greaterThan || + code === codes.graveAccent || + markdownLineEndingOrSpace(code) + ) { + return completeAttributeNameAfter(code) + } + + effects.consume(code) + return completeAttributeValueUnquoted + } + + function completeAttributeValueQuotedAfter(code) { + if ( + code === codes.slash || + code === codes.greaterThan || + markdownSpace(code) + ) { + return completeAttributeNameBefore(code) + } + + return nok(code) + } + + function completeEnd(code) { + if (code === codes.greaterThan) { + effects.consume(code) + return completeAfter + } + + return nok(code) + } + + function completeAfter(code) { + if (markdownSpace(code)) { + effects.consume(code) + return completeAfter + } + + return code === codes.eof || markdownLineEnding(code) + ? continuation(code) + : nok(code) + } + + function continuation(code) { + if (code === codes.dash && kind === constants.htmlComment) { + effects.consume(code) + return continuationCommentInside + } + + if (code === codes.lessThan && kind === constants.htmlRaw) { + effects.consume(code) + return continuationRawTagOpen + } + + if (code === codes.greaterThan && kind === constants.htmlDeclaration) { + effects.consume(code) + return continuationClose + } + + if (code === codes.questionMark && kind === constants.htmlInstruction) { + effects.consume(code) + return continuationDeclarationInside + } + + if (code === codes.rightSquareBracket && kind === constants.htmlCdata) { + effects.consume(code) + return continuationCharacterDataInside + } + + if ( + markdownLineEnding(code) && + (kind === constants.htmlBasic || kind === constants.htmlComplete) + ) { + return effects.check( + nextBlankConstruct, + continuationClose, + continuationAtLineEnding + )(code) + } + + if (code === codes.eof || markdownLineEnding(code)) { + return continuationAtLineEnding(code) + } + + effects.consume(code) + return continuation + } + + function continuationAtLineEnding(code) { + effects.exit(types.htmlFlowData) + return htmlContinueStart(code) + } + + function htmlContinueStart(code) { + if (code === codes.eof) { + return done(code) + } + + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return htmlContinueStart + } + + effects.enter(types.htmlFlowData) + return continuation(code) + } + + function continuationCommentInside(code) { + if (code === codes.dash) { + effects.consume(code) + return continuationDeclarationInside + } + + return continuation(code) + } + + function continuationRawTagOpen(code) { + if (code === codes.slash) { + effects.consume(code) + buffer = '' + return continuationRawEndTag + } + + return continuation(code) + } + + function continuationRawEndTag(code) { + if ( + code === codes.greaterThan && + htmlRawNames.indexOf(buffer.toLowerCase()) > -1 + ) { + effects.consume(code) + return continuationClose + } + + if (asciiAlpha(code) && buffer.length < constants.htmlRawSizeMax) { + effects.consume(code) + buffer += fromCharCode(code) + return continuationRawEndTag + } + + return continuation(code) + } + + function continuationCharacterDataInside(code) { + if (code === codes.rightSquareBracket) { + effects.consume(code) + return continuationDeclarationInside + } + + return continuation(code) + } + + function continuationDeclarationInside(code) { + if (code === codes.greaterThan) { + effects.consume(code) + return continuationClose + } + + return continuation(code) + } + + function continuationClose(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.htmlFlowData) + return done(code) + } + + effects.consume(code) + return continuationClose + } + + function done(code) { + effects.exit(types.htmlFlow) + return ok(code) + } +} + +function tokenizeNextBlank(effects, ok, nok) { + return start + + function start(code) { + assert__default['default']( + markdownLineEnding(code), + 'expected a line ending' + ) + effects.exit(types.htmlFlowData) + effects.enter(types.lineEndingBlank) + effects.consume(code) + effects.exit(types.lineEndingBlank) + return effects.attempt(partialBlankLine, ok, nok) + } +} + +module.exports = htmlFlow diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/html-flow.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/html-flow.mjs new file mode 100644 index 00000000000000..5dda6d749339b7 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/html-flow.mjs @@ -0,0 +1,498 @@ +var htmlFlow = { + name: 'htmlFlow', + tokenize: tokenizeHtmlFlow, + resolveTo: resolveToHtmlFlow, + concrete: true +} +export default htmlFlow + +import assert from 'assert' +import asciiAlpha from '../character/ascii-alpha.mjs' +import asciiAlphanumeric from '../character/ascii-alphanumeric.mjs' +import codes from '../character/codes.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import markdownLineEndingOrSpace from '../character/markdown-line-ending-or-space.mjs' +import markdownSpace from '../character/markdown-space.mjs' +import constants from '../constant/constants.mjs' +import fromCharCode from '../constant/from-char-code.mjs' +import basics from '../constant/html-block-names.mjs' +import raws from '../constant/html-raw-names.mjs' +import types from '../constant/types.mjs' +import blank from './partial-blank-line.mjs' + +var nextBlankConstruct = {tokenize: tokenizeNextBlank, partial: true} + +function resolveToHtmlFlow(events) { + var index = events.length + + while (index--) { + if ( + events[index][0] === 'enter' && + events[index][1].type === types.htmlFlow + ) { + break + } + } + + if (index > 1 && events[index - 2][1].type === types.linePrefix) { + // Add the prefix start to the HTML token. + events[index][1].start = events[index - 2][1].start + // Add the prefix start to the HTML line token. + events[index + 1][1].start = events[index - 2][1].start + // Remove the line prefix. + events.splice(index - 2, 2) + } + + return events +} + +function tokenizeHtmlFlow(effects, ok, nok) { + var self = this + var kind + var startTag + var buffer + var index + var marker + + return start + + function start(code) { + assert(code === codes.lessThan, 'expected `<`') + effects.enter(types.htmlFlow) + effects.enter(types.htmlFlowData) + effects.consume(code) + return open + } + + function open(code) { + if (code === codes.exclamationMark) { + effects.consume(code) + return declarationStart + } + + if (code === codes.slash) { + effects.consume(code) + return tagCloseStart + } + + if (code === codes.questionMark) { + effects.consume(code) + kind = constants.htmlInstruction + // While we’re in an instruction instead of a declaration, we’re on a `?` + // right now, so we do need to search for `>`, similar to declarations. + return self.interrupt ? ok : continuationDeclarationInside + } + + if (asciiAlpha(code)) { + effects.consume(code) + buffer = fromCharCode(code) + startTag = true + return tagName + } + + return nok(code) + } + + function declarationStart(code) { + if (code === codes.dash) { + effects.consume(code) + kind = constants.htmlComment + return commentOpenInside + } + + if (code === codes.leftSquareBracket) { + effects.consume(code) + kind = constants.htmlCdata + buffer = constants.cdataOpeningString + index = 0 + return cdataOpenInside + } + + if (asciiAlpha(code)) { + effects.consume(code) + kind = constants.htmlDeclaration + return self.interrupt ? ok : continuationDeclarationInside + } + + return nok(code) + } + + function commentOpenInside(code) { + if (code === codes.dash) { + effects.consume(code) + return self.interrupt ? ok : continuationDeclarationInside + } + + return nok(code) + } + + function cdataOpenInside(code) { + if (code === buffer.charCodeAt(index++)) { + effects.consume(code) + return index === buffer.length + ? self.interrupt + ? ok + : continuation + : cdataOpenInside + } + + return nok(code) + } + + function tagCloseStart(code) { + if (asciiAlpha(code)) { + effects.consume(code) + buffer = fromCharCode(code) + return tagName + } + + return nok(code) + } + + function tagName(code) { + if ( + code === codes.eof || + code === codes.slash || + code === codes.greaterThan || + markdownLineEndingOrSpace(code) + ) { + if ( + code !== codes.slash && + startTag && + raws.indexOf(buffer.toLowerCase()) > -1 + ) { + kind = constants.htmlRaw + return self.interrupt ? ok(code) : continuation(code) + } + + if (basics.indexOf(buffer.toLowerCase()) > -1) { + kind = constants.htmlBasic + + if (code === codes.slash) { + effects.consume(code) + return basicSelfClosing + } + + return self.interrupt ? ok(code) : continuation(code) + } + + kind = constants.htmlComplete + // Do not support complete HTML when interrupting. + return self.interrupt + ? nok(code) + : startTag + ? completeAttributeNameBefore(code) + : completeClosingTagAfter(code) + } + + if (code === codes.dash || asciiAlphanumeric(code)) { + effects.consume(code) + buffer += fromCharCode(code) + return tagName + } + + return nok(code) + } + + function basicSelfClosing(code) { + if (code === codes.greaterThan) { + effects.consume(code) + return self.interrupt ? ok : continuation + } + + return nok(code) + } + + function completeClosingTagAfter(code) { + if (markdownSpace(code)) { + effects.consume(code) + return completeClosingTagAfter + } + + return completeEnd(code) + } + + function completeAttributeNameBefore(code) { + if (code === codes.slash) { + effects.consume(code) + return completeEnd + } + + if (code === codes.colon || code === codes.underscore || asciiAlpha(code)) { + effects.consume(code) + return completeAttributeName + } + + if (markdownSpace(code)) { + effects.consume(code) + return completeAttributeNameBefore + } + + return completeEnd(code) + } + + function completeAttributeName(code) { + if ( + code === codes.dash || + code === codes.dot || + code === codes.colon || + code === codes.underscore || + asciiAlphanumeric(code) + ) { + effects.consume(code) + return completeAttributeName + } + + return completeAttributeNameAfter(code) + } + + function completeAttributeNameAfter(code) { + if (code === codes.equalsTo) { + effects.consume(code) + return completeAttributeValueBefore + } + + if (markdownSpace(code)) { + effects.consume(code) + return completeAttributeNameAfter + } + + return completeAttributeNameBefore(code) + } + + function completeAttributeValueBefore(code) { + if ( + code === codes.eof || + code === codes.lessThan || + code === codes.equalsTo || + code === codes.greaterThan || + code === codes.graveAccent + ) { + return nok(code) + } + + if (code === codes.quotationMark || code === codes.apostrophe) { + effects.consume(code) + marker = code + return completeAttributeValueQuoted + } + + if (markdownSpace(code)) { + effects.consume(code) + return completeAttributeValueBefore + } + + marker = undefined + return completeAttributeValueUnquoted(code) + } + + function completeAttributeValueQuoted(code) { + if (code === marker) { + effects.consume(code) + return completeAttributeValueQuotedAfter + } + + if (code === codes.eof || markdownLineEnding(code)) { + return nok(code) + } + + effects.consume(code) + return completeAttributeValueQuoted + } + + function completeAttributeValueUnquoted(code) { + if ( + code === codes.eof || + code === codes.quotationMark || + code === codes.apostrophe || + code === codes.lessThan || + code === codes.equalsTo || + code === codes.greaterThan || + code === codes.graveAccent || + markdownLineEndingOrSpace(code) + ) { + return completeAttributeNameAfter(code) + } + + effects.consume(code) + return completeAttributeValueUnquoted + } + + function completeAttributeValueQuotedAfter(code) { + if ( + code === codes.slash || + code === codes.greaterThan || + markdownSpace(code) + ) { + return completeAttributeNameBefore(code) + } + + return nok(code) + } + + function completeEnd(code) { + if (code === codes.greaterThan) { + effects.consume(code) + return completeAfter + } + + return nok(code) + } + + function completeAfter(code) { + if (markdownSpace(code)) { + effects.consume(code) + return completeAfter + } + + return code === codes.eof || markdownLineEnding(code) + ? continuation(code) + : nok(code) + } + + function continuation(code) { + if (code === codes.dash && kind === constants.htmlComment) { + effects.consume(code) + return continuationCommentInside + } + + if (code === codes.lessThan && kind === constants.htmlRaw) { + effects.consume(code) + return continuationRawTagOpen + } + + if (code === codes.greaterThan && kind === constants.htmlDeclaration) { + effects.consume(code) + return continuationClose + } + + if (code === codes.questionMark && kind === constants.htmlInstruction) { + effects.consume(code) + return continuationDeclarationInside + } + + if (code === codes.rightSquareBracket && kind === constants.htmlCdata) { + effects.consume(code) + return continuationCharacterDataInside + } + + if ( + markdownLineEnding(code) && + (kind === constants.htmlBasic || kind === constants.htmlComplete) + ) { + return effects.check( + nextBlankConstruct, + continuationClose, + continuationAtLineEnding + )(code) + } + + if (code === codes.eof || markdownLineEnding(code)) { + return continuationAtLineEnding(code) + } + + effects.consume(code) + return continuation + } + + function continuationAtLineEnding(code) { + effects.exit(types.htmlFlowData) + return htmlContinueStart(code) + } + + function htmlContinueStart(code) { + if (code === codes.eof) { + return done(code) + } + + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return htmlContinueStart + } + + effects.enter(types.htmlFlowData) + return continuation(code) + } + + function continuationCommentInside(code) { + if (code === codes.dash) { + effects.consume(code) + return continuationDeclarationInside + } + + return continuation(code) + } + + function continuationRawTagOpen(code) { + if (code === codes.slash) { + effects.consume(code) + buffer = '' + return continuationRawEndTag + } + + return continuation(code) + } + + function continuationRawEndTag(code) { + if (code === codes.greaterThan && raws.indexOf(buffer.toLowerCase()) > -1) { + effects.consume(code) + return continuationClose + } + + if (asciiAlpha(code) && buffer.length < constants.htmlRawSizeMax) { + effects.consume(code) + buffer += fromCharCode(code) + return continuationRawEndTag + } + + return continuation(code) + } + + function continuationCharacterDataInside(code) { + if (code === codes.rightSquareBracket) { + effects.consume(code) + return continuationDeclarationInside + } + + return continuation(code) + } + + function continuationDeclarationInside(code) { + if (code === codes.greaterThan) { + effects.consume(code) + return continuationClose + } + + return continuation(code) + } + + function continuationClose(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.htmlFlowData) + return done(code) + } + + effects.consume(code) + return continuationClose + } + + function done(code) { + effects.exit(types.htmlFlow) + return ok(code) + } +} + +function tokenizeNextBlank(effects, ok, nok) { + return start + + function start(code) { + assert(markdownLineEnding(code), 'expected a line ending') + effects.exit(types.htmlFlowData) + effects.enter(types.lineEndingBlank) + effects.consume(code) + effects.exit(types.lineEndingBlank) + return effects.attempt(blank, ok, nok) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/html-text.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/html-text.js new file mode 100644 index 00000000000000..eda4db2d07b2d2 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/html-text.js @@ -0,0 +1,458 @@ +'use strict' + +var assert = require('assert') +var asciiAlpha = require('../character/ascii-alpha.js') +var asciiAlphanumeric = require('../character/ascii-alphanumeric.js') +var codes = require('../character/codes.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var markdownLineEndingOrSpace = require('../character/markdown-line-ending-or-space.js') +var markdownSpace = require('../character/markdown-space.js') +var constants = require('../constant/constants.js') +var types = require('../constant/types.js') +var factorySpace = require('./factory-space.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +var htmlText = { + name: 'htmlText', + tokenize: tokenizeHtmlText +} + +function tokenizeHtmlText(effects, ok, nok) { + var self = this + var marker + var buffer + var index + var returnState + + return start + + function start(code) { + assert__default['default'](code === codes.lessThan, 'expected `<`') + effects.enter(types.htmlText) + effects.enter(types.htmlTextData) + effects.consume(code) + return open + } + + function open(code) { + if (code === codes.exclamationMark) { + effects.consume(code) + return declarationOpen + } + + if (code === codes.slash) { + effects.consume(code) + return tagCloseStart + } + + if (code === codes.questionMark) { + effects.consume(code) + return instruction + } + + if (asciiAlpha(code)) { + effects.consume(code) + return tagOpen + } + + return nok(code) + } + + function declarationOpen(code) { + if (code === codes.dash) { + effects.consume(code) + return commentOpen + } + + if (code === codes.leftSquareBracket) { + effects.consume(code) + buffer = constants.cdataOpeningString + index = 0 + return cdataOpen + } + + if (asciiAlpha(code)) { + effects.consume(code) + return declaration + } + + return nok(code) + } + + function commentOpen(code) { + if (code === codes.dash) { + effects.consume(code) + return commentStart + } + + return nok(code) + } + + function commentStart(code) { + if (code === codes.eof || code === codes.greaterThan) { + return nok(code) + } + + if (code === codes.dash) { + effects.consume(code) + return commentStartDash + } + + return comment(code) + } + + function commentStartDash(code) { + if (code === codes.eof || code === codes.greaterThan) { + return nok(code) + } + + return comment(code) + } + + function comment(code) { + if (code === codes.eof) { + return nok(code) + } + + if (code === codes.dash) { + effects.consume(code) + return commentClose + } + + if (markdownLineEnding(code)) { + returnState = comment + return atLineEnding(code) + } + + effects.consume(code) + return comment + } + + function commentClose(code) { + if (code === codes.dash) { + effects.consume(code) + return end + } + + return comment(code) + } + + function cdataOpen(code) { + if (code === buffer.charCodeAt(index++)) { + effects.consume(code) + return index === buffer.length ? cdata : cdataOpen + } + + return nok(code) + } + + function cdata(code) { + if (code === codes.eof) { + return nok(code) + } + + if (code === codes.rightSquareBracket) { + effects.consume(code) + return cdataClose + } + + if (markdownLineEnding(code)) { + returnState = cdata + return atLineEnding(code) + } + + effects.consume(code) + return cdata + } + + function cdataClose(code) { + if (code === codes.rightSquareBracket) { + effects.consume(code) + return cdataEnd + } + + return cdata(code) + } + + function cdataEnd(code) { + if (code === codes.greaterThan) { + return end(code) + } + + if (code === codes.rightSquareBracket) { + effects.consume(code) + return cdataEnd + } + + return cdata(code) + } + + function declaration(code) { + if (code === codes.eof || code === codes.greaterThan) { + return end(code) + } + + if (markdownLineEnding(code)) { + returnState = declaration + return atLineEnding(code) + } + + effects.consume(code) + return declaration + } + + function instruction(code) { + if (code === codes.eof) { + return nok(code) + } + + if (code === codes.questionMark) { + effects.consume(code) + return instructionClose + } + + if (markdownLineEnding(code)) { + returnState = instruction + return atLineEnding(code) + } + + effects.consume(code) + return instruction + } + + function instructionClose(code) { + return code === codes.greaterThan ? end(code) : instruction(code) + } + + function tagCloseStart(code) { + if (asciiAlpha(code)) { + effects.consume(code) + return tagClose + } + + return nok(code) + } + + function tagClose(code) { + if (code === codes.dash || asciiAlphanumeric(code)) { + effects.consume(code) + return tagClose + } + + return tagCloseBetween(code) + } + + function tagCloseBetween(code) { + if (markdownLineEnding(code)) { + returnState = tagCloseBetween + return atLineEnding(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagCloseBetween + } + + return end(code) + } + + function tagOpen(code) { + if (code === codes.dash || asciiAlphanumeric(code)) { + effects.consume(code) + return tagOpen + } + + if ( + code === codes.slash || + code === codes.greaterThan || + markdownLineEndingOrSpace(code) + ) { + return tagOpenBetween(code) + } + + return nok(code) + } + + function tagOpenBetween(code) { + if (code === codes.slash) { + effects.consume(code) + return end + } + + if (code === codes.colon || code === codes.underscore || asciiAlpha(code)) { + effects.consume(code) + return tagOpenAttributeName + } + + if (markdownLineEnding(code)) { + returnState = tagOpenBetween + return atLineEnding(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagOpenBetween + } + + return end(code) + } + + function tagOpenAttributeName(code) { + if ( + code === codes.dash || + code === codes.dot || + code === codes.colon || + code === codes.underscore || + asciiAlphanumeric(code) + ) { + effects.consume(code) + return tagOpenAttributeName + } + + return tagOpenAttributeNameAfter(code) + } + + function tagOpenAttributeNameAfter(code) { + if (code === codes.equalsTo) { + effects.consume(code) + return tagOpenAttributeValueBefore + } + + if (markdownLineEnding(code)) { + returnState = tagOpenAttributeNameAfter + return atLineEnding(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagOpenAttributeNameAfter + } + + return tagOpenBetween(code) + } + + function tagOpenAttributeValueBefore(code) { + if ( + code === codes.eof || + code === codes.lessThan || + code === codes.equalsTo || + code === codes.greaterThan || + code === codes.graveAccent + ) { + return nok(code) + } + + if (code === codes.quotationMark || code === codes.apostrophe) { + effects.consume(code) + marker = code + return tagOpenAttributeValueQuoted + } + + if (markdownLineEnding(code)) { + returnState = tagOpenAttributeValueBefore + return atLineEnding(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagOpenAttributeValueBefore + } + + effects.consume(code) + marker = undefined + return tagOpenAttributeValueUnquoted + } + + function tagOpenAttributeValueQuoted(code) { + if (code === marker) { + effects.consume(code) + return tagOpenAttributeValueQuotedAfter + } + + if (code === codes.eof) { + return nok(code) + } + + if (markdownLineEnding(code)) { + returnState = tagOpenAttributeValueQuoted + return atLineEnding(code) + } + + effects.consume(code) + return tagOpenAttributeValueQuoted + } + + function tagOpenAttributeValueQuotedAfter(code) { + if ( + code === codes.greaterThan || + code === codes.slash || + markdownLineEndingOrSpace(code) + ) { + return tagOpenBetween(code) + } + + return nok(code) + } + + function tagOpenAttributeValueUnquoted(code) { + if ( + code === codes.eof || + code === codes.quotationMark || + code === codes.apostrophe || + code === codes.lessThan || + code === codes.equalsTo || + code === codes.graveAccent + ) { + return nok(code) + } + + if (code === codes.greaterThan || markdownLineEndingOrSpace(code)) { + return tagOpenBetween(code) + } + + effects.consume(code) + return tagOpenAttributeValueUnquoted + } + + // We can’t have blank lines in content, so no need to worry about empty + // tokens. + function atLineEnding(code) { + assert__default['default'](returnState, 'expected return state') + assert__default['default'](markdownLineEnding(code), 'expected eol') + effects.exit(types.htmlTextData) + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return factorySpace( + effects, + afterPrefix, + types.linePrefix, + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : constants.tabSize + ) + } + + function afterPrefix(code) { + effects.enter(types.htmlTextData) + return returnState(code) + } + + function end(code) { + if (code === codes.greaterThan) { + effects.consume(code) + effects.exit(types.htmlTextData) + effects.exit(types.htmlText) + return ok + } + + return nok(code) + } +} + +module.exports = htmlText diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/html-text.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/html-text.mjs new file mode 100644 index 00000000000000..2f571a0f4f936d --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/html-text.mjs @@ -0,0 +1,449 @@ +var htmlText = { + name: 'htmlText', + tokenize: tokenizeHtmlText +} +export default htmlText + +import assert from 'assert' +import asciiAlpha from '../character/ascii-alpha.mjs' +import asciiAlphanumeric from '../character/ascii-alphanumeric.mjs' +import codes from '../character/codes.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import markdownLineEndingOrSpace from '../character/markdown-line-ending-or-space.mjs' +import markdownSpace from '../character/markdown-space.mjs' +import constants from '../constant/constants.mjs' +import types from '../constant/types.mjs' +import spaceFactory from './factory-space.mjs' + +function tokenizeHtmlText(effects, ok, nok) { + var self = this + var marker + var buffer + var index + var returnState + + return start + + function start(code) { + assert(code === codes.lessThan, 'expected `<`') + effects.enter(types.htmlText) + effects.enter(types.htmlTextData) + effects.consume(code) + return open + } + + function open(code) { + if (code === codes.exclamationMark) { + effects.consume(code) + return declarationOpen + } + + if (code === codes.slash) { + effects.consume(code) + return tagCloseStart + } + + if (code === codes.questionMark) { + effects.consume(code) + return instruction + } + + if (asciiAlpha(code)) { + effects.consume(code) + return tagOpen + } + + return nok(code) + } + + function declarationOpen(code) { + if (code === codes.dash) { + effects.consume(code) + return commentOpen + } + + if (code === codes.leftSquareBracket) { + effects.consume(code) + buffer = constants.cdataOpeningString + index = 0 + return cdataOpen + } + + if (asciiAlpha(code)) { + effects.consume(code) + return declaration + } + + return nok(code) + } + + function commentOpen(code) { + if (code === codes.dash) { + effects.consume(code) + return commentStart + } + + return nok(code) + } + + function commentStart(code) { + if (code === codes.eof || code === codes.greaterThan) { + return nok(code) + } + + if (code === codes.dash) { + effects.consume(code) + return commentStartDash + } + + return comment(code) + } + + function commentStartDash(code) { + if (code === codes.eof || code === codes.greaterThan) { + return nok(code) + } + + return comment(code) + } + + function comment(code) { + if (code === codes.eof) { + return nok(code) + } + + if (code === codes.dash) { + effects.consume(code) + return commentClose + } + + if (markdownLineEnding(code)) { + returnState = comment + return atLineEnding(code) + } + + effects.consume(code) + return comment + } + + function commentClose(code) { + if (code === codes.dash) { + effects.consume(code) + return end + } + + return comment(code) + } + + function cdataOpen(code) { + if (code === buffer.charCodeAt(index++)) { + effects.consume(code) + return index === buffer.length ? cdata : cdataOpen + } + + return nok(code) + } + + function cdata(code) { + if (code === codes.eof) { + return nok(code) + } + + if (code === codes.rightSquareBracket) { + effects.consume(code) + return cdataClose + } + + if (markdownLineEnding(code)) { + returnState = cdata + return atLineEnding(code) + } + + effects.consume(code) + return cdata + } + + function cdataClose(code) { + if (code === codes.rightSquareBracket) { + effects.consume(code) + return cdataEnd + } + + return cdata(code) + } + + function cdataEnd(code) { + if (code === codes.greaterThan) { + return end(code) + } + + if (code === codes.rightSquareBracket) { + effects.consume(code) + return cdataEnd + } + + return cdata(code) + } + + function declaration(code) { + if (code === codes.eof || code === codes.greaterThan) { + return end(code) + } + + if (markdownLineEnding(code)) { + returnState = declaration + return atLineEnding(code) + } + + effects.consume(code) + return declaration + } + + function instruction(code) { + if (code === codes.eof) { + return nok(code) + } + + if (code === codes.questionMark) { + effects.consume(code) + return instructionClose + } + + if (markdownLineEnding(code)) { + returnState = instruction + return atLineEnding(code) + } + + effects.consume(code) + return instruction + } + + function instructionClose(code) { + return code === codes.greaterThan ? end(code) : instruction(code) + } + + function tagCloseStart(code) { + if (asciiAlpha(code)) { + effects.consume(code) + return tagClose + } + + return nok(code) + } + + function tagClose(code) { + if (code === codes.dash || asciiAlphanumeric(code)) { + effects.consume(code) + return tagClose + } + + return tagCloseBetween(code) + } + + function tagCloseBetween(code) { + if (markdownLineEnding(code)) { + returnState = tagCloseBetween + return atLineEnding(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagCloseBetween + } + + return end(code) + } + + function tagOpen(code) { + if (code === codes.dash || asciiAlphanumeric(code)) { + effects.consume(code) + return tagOpen + } + + if ( + code === codes.slash || + code === codes.greaterThan || + markdownLineEndingOrSpace(code) + ) { + return tagOpenBetween(code) + } + + return nok(code) + } + + function tagOpenBetween(code) { + if (code === codes.slash) { + effects.consume(code) + return end + } + + if (code === codes.colon || code === codes.underscore || asciiAlpha(code)) { + effects.consume(code) + return tagOpenAttributeName + } + + if (markdownLineEnding(code)) { + returnState = tagOpenBetween + return atLineEnding(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagOpenBetween + } + + return end(code) + } + + function tagOpenAttributeName(code) { + if ( + code === codes.dash || + code === codes.dot || + code === codes.colon || + code === codes.underscore || + asciiAlphanumeric(code) + ) { + effects.consume(code) + return tagOpenAttributeName + } + + return tagOpenAttributeNameAfter(code) + } + + function tagOpenAttributeNameAfter(code) { + if (code === codes.equalsTo) { + effects.consume(code) + return tagOpenAttributeValueBefore + } + + if (markdownLineEnding(code)) { + returnState = tagOpenAttributeNameAfter + return atLineEnding(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagOpenAttributeNameAfter + } + + return tagOpenBetween(code) + } + + function tagOpenAttributeValueBefore(code) { + if ( + code === codes.eof || + code === codes.lessThan || + code === codes.equalsTo || + code === codes.greaterThan || + code === codes.graveAccent + ) { + return nok(code) + } + + if (code === codes.quotationMark || code === codes.apostrophe) { + effects.consume(code) + marker = code + return tagOpenAttributeValueQuoted + } + + if (markdownLineEnding(code)) { + returnState = tagOpenAttributeValueBefore + return atLineEnding(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagOpenAttributeValueBefore + } + + effects.consume(code) + marker = undefined + return tagOpenAttributeValueUnquoted + } + + function tagOpenAttributeValueQuoted(code) { + if (code === marker) { + effects.consume(code) + return tagOpenAttributeValueQuotedAfter + } + + if (code === codes.eof) { + return nok(code) + } + + if (markdownLineEnding(code)) { + returnState = tagOpenAttributeValueQuoted + return atLineEnding(code) + } + + effects.consume(code) + return tagOpenAttributeValueQuoted + } + + function tagOpenAttributeValueQuotedAfter(code) { + if ( + code === codes.greaterThan || + code === codes.slash || + markdownLineEndingOrSpace(code) + ) { + return tagOpenBetween(code) + } + + return nok(code) + } + + function tagOpenAttributeValueUnquoted(code) { + if ( + code === codes.eof || + code === codes.quotationMark || + code === codes.apostrophe || + code === codes.lessThan || + code === codes.equalsTo || + code === codes.graveAccent + ) { + return nok(code) + } + + if (code === codes.greaterThan || markdownLineEndingOrSpace(code)) { + return tagOpenBetween(code) + } + + effects.consume(code) + return tagOpenAttributeValueUnquoted + } + + // We can’t have blank lines in content, so no need to worry about empty + // tokens. + function atLineEnding(code) { + assert(returnState, 'expected return state') + assert(markdownLineEnding(code), 'expected eol') + effects.exit(types.htmlTextData) + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return spaceFactory( + effects, + afterPrefix, + types.linePrefix, + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : constants.tabSize + ) + } + + function afterPrefix(code) { + effects.enter(types.htmlTextData) + return returnState(code) + } + + function end(code) { + if (code === codes.greaterThan) { + effects.consume(code) + effects.exit(types.htmlTextData) + effects.exit(types.htmlText) + return ok + } + + return nok(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/label-end.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/label-end.js new file mode 100644 index 00000000000000..51ee2366c81d10 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/label-end.js @@ -0,0 +1,374 @@ +'use strict' + +var assert = require('assert') +var codes = require('../character/codes.js') +var markdownLineEndingOrSpace = require('../character/markdown-line-ending-or-space.js') +var constants = require('../constant/constants.js') +var types = require('../constant/types.js') +var chunkedPush = require('../util/chunked-push.js') +var chunkedSplice = require('../util/chunked-splice.js') +var normalizeIdentifier = require('../util/normalize-identifier.js') +var resolveAll = require('../util/resolve-all.js') +var shallow = require('../util/shallow.js') +var factoryDestination = require('./factory-destination.js') +var factoryLabel = require('./factory-label.js') +var factoryTitle = require('./factory-title.js') +var factoryWhitespace = require('./factory-whitespace.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +var labelEnd = { + name: 'labelEnd', + tokenize: tokenizeLabelEnd, + resolveTo: resolveToLabelEnd, + resolveAll: resolveAllLabelEnd +} + +var resourceConstruct = {tokenize: tokenizeResource} +var fullReferenceConstruct = {tokenize: tokenizeFullReference} +var collapsedReferenceConstruct = {tokenize: tokenizeCollapsedReference} + +function resolveAllLabelEnd(events) { + var index = -1 + var token + + while (++index < events.length) { + token = events[index][1] + + if ( + !token._used && + (token.type === types.labelImage || + token.type === types.labelLink || + token.type === types.labelEnd) + ) { + // Remove the marker. + events.splice(index + 1, token.type === types.labelImage ? 4 : 2) + token.type = types.data + index++ + } + } + + return events +} + +function resolveToLabelEnd(events, context) { + var index = events.length + var offset = 0 + var group + var label + var text + var token + var open + var close + var media + + // Find an opening. + while (index--) { + token = events[index][1] + + if (open) { + // If we see another link, or inactive link label, we’ve been here before. + if ( + token.type === types.link || + (token.type === types.labelLink && token._inactive) + ) { + break + } + + // Mark other link openings as inactive, as we can’t have links in + // links. + if (events[index][0] === 'enter' && token.type === types.labelLink) { + token._inactive = true + } + } else if (close) { + if ( + events[index][0] === 'enter' && + (token.type === types.labelImage || token.type === types.labelLink) && + !token._balanced + ) { + open = index + + if (token.type !== types.labelLink) { + offset = 2 + break + } + } + } else if (token.type === types.labelEnd) { + close = index + } + } + + group = { + type: events[open][1].type === types.labelLink ? types.link : types.image, + start: shallow(events[open][1].start), + end: shallow(events[events.length - 1][1].end) + } + + label = { + type: types.label, + start: shallow(events[open][1].start), + end: shallow(events[close][1].end) + } + + text = { + type: types.labelText, + start: shallow(events[open + offset + 2][1].end), + end: shallow(events[close - 2][1].start) + } + + media = [ + ['enter', group, context], + ['enter', label, context] + ] + + // Opening marker. + media = chunkedPush(media, events.slice(open + 1, open + offset + 3)) + + // Text open. + media = chunkedPush(media, [['enter', text, context]]) + + // Between. + media = chunkedPush( + media, + resolveAll( + context.parser.constructs.insideSpan.null, + events.slice(open + offset + 4, close - 3), + context + ) + ) + + // Text close, marker close, label close. + media = chunkedPush(media, [ + ['exit', text, context], + events[close - 2], + events[close - 1], + ['exit', label, context] + ]) + + // Reference, resource, or so. + media = chunkedPush(media, events.slice(close + 1)) + + // Media close. + media = chunkedPush(media, [['exit', group, context]]) + + chunkedSplice(events, open, events.length, media) + + return events +} + +function tokenizeLabelEnd(effects, ok, nok) { + var self = this + var index = self.events.length + var labelStart + var defined + + // Find an opening. + while (index--) { + if ( + (self.events[index][1].type === types.labelImage || + self.events[index][1].type === types.labelLink) && + !self.events[index][1]._balanced + ) { + labelStart = self.events[index][1] + break + } + } + + return start + + function start(code) { + assert__default['default']( + code === codes.rightSquareBracket, + 'expected `]`' + ) + + if (!labelStart) { + return nok(code) + } + + // It’s a balanced bracket, but contains a link. + if (labelStart._inactive) return balanced(code) + defined = + self.parser.defined.indexOf( + normalizeIdentifier( + self.sliceSerialize({start: labelStart.end, end: self.now()}) + ) + ) > -1 + effects.enter(types.labelEnd) + effects.enter(types.labelMarker) + effects.consume(code) + effects.exit(types.labelMarker) + effects.exit(types.labelEnd) + return afterLabelEnd + } + + function afterLabelEnd(code) { + // Resource: `[asd](fgh)`. + if (code === codes.leftParenthesis) { + return effects.attempt( + resourceConstruct, + ok, + defined ? ok : balanced + )(code) + } + + // Collapsed (`[asd][]`) or full (`[asd][fgh]`) reference? + if (code === codes.leftSquareBracket) { + return effects.attempt( + fullReferenceConstruct, + ok, + defined + ? effects.attempt(collapsedReferenceConstruct, ok, balanced) + : balanced + )(code) + } + + // Shortcut reference: `[asd]`? + return defined ? ok(code) : balanced(code) + } + + function balanced(code) { + labelStart._balanced = true + return nok(code) + } +} + +function tokenizeResource(effects, ok, nok) { + return start + + function start(code) { + assert__default['default'].equal( + code, + codes.leftParenthesis, + 'expected left paren' + ) + effects.enter(types.resource) + effects.enter(types.resourceMarker) + effects.consume(code) + effects.exit(types.resourceMarker) + return factoryWhitespace(effects, open) + } + + function open(code) { + if (code === codes.rightParenthesis) { + return end(code) + } + + return factoryDestination( + effects, + destinationAfter, + nok, + types.resourceDestination, + types.resourceDestinationLiteral, + types.resourceDestinationLiteralMarker, + types.resourceDestinationRaw, + types.resourceDestinationString, + constants.linkResourceDestinationBalanceMax + )(code) + } + + function destinationAfter(code) { + return markdownLineEndingOrSpace(code) + ? factoryWhitespace(effects, between)(code) + : end(code) + } + + function between(code) { + if ( + code === codes.quotationMark || + code === codes.apostrophe || + code === codes.leftParenthesis + ) { + return factoryTitle( + effects, + factoryWhitespace(effects, end), + nok, + types.resourceTitle, + types.resourceTitleMarker, + types.resourceTitleString + )(code) + } + + return end(code) + } + + function end(code) { + if (code === codes.rightParenthesis) { + effects.enter(types.resourceMarker) + effects.consume(code) + effects.exit(types.resourceMarker) + effects.exit(types.resource) + return ok + } + + return nok(code) + } +} + +function tokenizeFullReference(effects, ok, nok) { + var self = this + + return start + + function start(code) { + assert__default['default'].equal( + code, + codes.leftSquareBracket, + 'expected left bracket' + ) + return factoryLabel.call( + self, + effects, + afterLabel, + nok, + types.reference, + types.referenceMarker, + types.referenceString + )(code) + } + + function afterLabel(code) { + return self.parser.defined.indexOf( + normalizeIdentifier( + self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) + ) + ) < 0 + ? nok(code) + : ok(code) + } +} + +function tokenizeCollapsedReference(effects, ok, nok) { + return start + + function start(code) { + assert__default['default'].equal( + code, + codes.leftSquareBracket, + 'expected left bracket' + ) + effects.enter(types.reference) + effects.enter(types.referenceMarker) + effects.consume(code) + effects.exit(types.referenceMarker) + return open + } + + function open(code) { + if (code === codes.rightSquareBracket) { + effects.enter(types.referenceMarker) + effects.consume(code) + effects.exit(types.referenceMarker) + effects.exit(types.reference) + return ok + } + + return nok(code) + } +} + +module.exports = labelEnd diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/label-end.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/label-end.mjs new file mode 100644 index 00000000000000..16beeb0782df37 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/label-end.mjs @@ -0,0 +1,350 @@ +var labelEnd = { + name: 'labelEnd', + tokenize: tokenizeLabelEnd, + resolveTo: resolveToLabelEnd, + resolveAll: resolveAllLabelEnd +} +export default labelEnd + +import assert from 'assert' +import codes from '../character/codes.mjs' +import markdownLineEndingOrSpace from '../character/markdown-line-ending-or-space.mjs' +import constants from '../constant/constants.mjs' +import types from '../constant/types.mjs' +import chunkedPush from '../util/chunked-push.mjs' +import chunkedSplice from '../util/chunked-splice.mjs' +import normalizeIdentifier from '../util/normalize-identifier.mjs' +import resolveAll from '../util/resolve-all.mjs' +import shallow from '../util/shallow.mjs' +import destinationFactory from './factory-destination.mjs' +import labelFactory from './factory-label.mjs' +import titleFactory from './factory-title.mjs' +import whitespaceFactory from './factory-whitespace.mjs' + +var resourceConstruct = {tokenize: tokenizeResource} +var fullReferenceConstruct = {tokenize: tokenizeFullReference} +var collapsedReferenceConstruct = {tokenize: tokenizeCollapsedReference} + +function resolveAllLabelEnd(events) { + var index = -1 + var token + + while (++index < events.length) { + token = events[index][1] + + if ( + !token._used && + (token.type === types.labelImage || + token.type === types.labelLink || + token.type === types.labelEnd) + ) { + // Remove the marker. + events.splice(index + 1, token.type === types.labelImage ? 4 : 2) + token.type = types.data + index++ + } + } + + return events +} + +function resolveToLabelEnd(events, context) { + var index = events.length + var offset = 0 + var group + var label + var text + var token + var open + var close + var media + + // Find an opening. + while (index--) { + token = events[index][1] + + if (open) { + // If we see another link, or inactive link label, we’ve been here before. + if ( + token.type === types.link || + (token.type === types.labelLink && token._inactive) + ) { + break + } + + // Mark other link openings as inactive, as we can’t have links in + // links. + if (events[index][0] === 'enter' && token.type === types.labelLink) { + token._inactive = true + } + } else if (close) { + if ( + events[index][0] === 'enter' && + (token.type === types.labelImage || token.type === types.labelLink) && + !token._balanced + ) { + open = index + + if (token.type !== types.labelLink) { + offset = 2 + break + } + } + } else if (token.type === types.labelEnd) { + close = index + } + } + + group = { + type: events[open][1].type === types.labelLink ? types.link : types.image, + start: shallow(events[open][1].start), + end: shallow(events[events.length - 1][1].end) + } + + label = { + type: types.label, + start: shallow(events[open][1].start), + end: shallow(events[close][1].end) + } + + text = { + type: types.labelText, + start: shallow(events[open + offset + 2][1].end), + end: shallow(events[close - 2][1].start) + } + + media = [ + ['enter', group, context], + ['enter', label, context] + ] + + // Opening marker. + media = chunkedPush(media, events.slice(open + 1, open + offset + 3)) + + // Text open. + media = chunkedPush(media, [['enter', text, context]]) + + // Between. + media = chunkedPush( + media, + resolveAll( + context.parser.constructs.insideSpan.null, + events.slice(open + offset + 4, close - 3), + context + ) + ) + + // Text close, marker close, label close. + media = chunkedPush(media, [ + ['exit', text, context], + events[close - 2], + events[close - 1], + ['exit', label, context] + ]) + + // Reference, resource, or so. + media = chunkedPush(media, events.slice(close + 1)) + + // Media close. + media = chunkedPush(media, [['exit', group, context]]) + + chunkedSplice(events, open, events.length, media) + + return events +} + +function tokenizeLabelEnd(effects, ok, nok) { + var self = this + var index = self.events.length + var labelStart + var defined + + // Find an opening. + while (index--) { + if ( + (self.events[index][1].type === types.labelImage || + self.events[index][1].type === types.labelLink) && + !self.events[index][1]._balanced + ) { + labelStart = self.events[index][1] + break + } + } + + return start + + function start(code) { + assert(code === codes.rightSquareBracket, 'expected `]`') + + if (!labelStart) { + return nok(code) + } + + // It’s a balanced bracket, but contains a link. + if (labelStart._inactive) return balanced(code) + defined = + self.parser.defined.indexOf( + normalizeIdentifier( + self.sliceSerialize({start: labelStart.end, end: self.now()}) + ) + ) > -1 + effects.enter(types.labelEnd) + effects.enter(types.labelMarker) + effects.consume(code) + effects.exit(types.labelMarker) + effects.exit(types.labelEnd) + return afterLabelEnd + } + + function afterLabelEnd(code) { + // Resource: `[asd](fgh)`. + if (code === codes.leftParenthesis) { + return effects.attempt( + resourceConstruct, + ok, + defined ? ok : balanced + )(code) + } + + // Collapsed (`[asd][]`) or full (`[asd][fgh]`) reference? + if (code === codes.leftSquareBracket) { + return effects.attempt( + fullReferenceConstruct, + ok, + defined + ? effects.attempt(collapsedReferenceConstruct, ok, balanced) + : balanced + )(code) + } + + // Shortcut reference: `[asd]`? + return defined ? ok(code) : balanced(code) + } + + function balanced(code) { + labelStart._balanced = true + return nok(code) + } +} + +function tokenizeResource(effects, ok, nok) { + return start + + function start(code) { + assert.equal(code, codes.leftParenthesis, 'expected left paren') + effects.enter(types.resource) + effects.enter(types.resourceMarker) + effects.consume(code) + effects.exit(types.resourceMarker) + return whitespaceFactory(effects, open) + } + + function open(code) { + if (code === codes.rightParenthesis) { + return end(code) + } + + return destinationFactory( + effects, + destinationAfter, + nok, + types.resourceDestination, + types.resourceDestinationLiteral, + types.resourceDestinationLiteralMarker, + types.resourceDestinationRaw, + types.resourceDestinationString, + constants.linkResourceDestinationBalanceMax + )(code) + } + + function destinationAfter(code) { + return markdownLineEndingOrSpace(code) + ? whitespaceFactory(effects, between)(code) + : end(code) + } + + function between(code) { + if ( + code === codes.quotationMark || + code === codes.apostrophe || + code === codes.leftParenthesis + ) { + return titleFactory( + effects, + whitespaceFactory(effects, end), + nok, + types.resourceTitle, + types.resourceTitleMarker, + types.resourceTitleString + )(code) + } + + return end(code) + } + + function end(code) { + if (code === codes.rightParenthesis) { + effects.enter(types.resourceMarker) + effects.consume(code) + effects.exit(types.resourceMarker) + effects.exit(types.resource) + return ok + } + + return nok(code) + } +} + +function tokenizeFullReference(effects, ok, nok) { + var self = this + + return start + + function start(code) { + assert.equal(code, codes.leftSquareBracket, 'expected left bracket') + return labelFactory.call( + self, + effects, + afterLabel, + nok, + types.reference, + types.referenceMarker, + types.referenceString + )(code) + } + + function afterLabel(code) { + return self.parser.defined.indexOf( + normalizeIdentifier( + self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) + ) + ) < 0 + ? nok(code) + : ok(code) + } +} + +function tokenizeCollapsedReference(effects, ok, nok) { + return start + + function start(code) { + assert.equal(code, codes.leftSquareBracket, 'expected left bracket') + effects.enter(types.reference) + effects.enter(types.referenceMarker) + effects.consume(code) + effects.exit(types.referenceMarker) + return open + } + + function open(code) { + if (code === codes.rightSquareBracket) { + effects.enter(types.referenceMarker) + effects.consume(code) + effects.exit(types.referenceMarker) + effects.exit(types.reference) + return ok + } + + return nok(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/label-start-image.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/label-start-image.js new file mode 100644 index 00000000000000..727a4687bbe5bc --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/label-start-image.js @@ -0,0 +1,56 @@ +'use strict' + +var labelEnd = require('./label-end.js') +var assert = require('assert') +var codes = require('../character/codes.js') +var types = require('../constant/types.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +var labelStartImage = { + name: 'labelStartImage', + tokenize: tokenizeLabelStartImage, + resolveAll: labelEnd.resolveAll +} + +function tokenizeLabelStartImage(effects, ok, nok) { + var self = this + + return start + + function start(code) { + assert__default['default'](code === codes.exclamationMark, 'expected `!`') + effects.enter(types.labelImage) + effects.enter(types.labelImageMarker) + effects.consume(code) + effects.exit(types.labelImageMarker) + return open + } + + function open(code) { + if (code === codes.leftSquareBracket) { + effects.enter(types.labelMarker) + effects.consume(code) + effects.exit(types.labelMarker) + effects.exit(types.labelImage) + return after + } + + return nok(code) + } + + function after(code) { + /* c8 ignore next */ + return code === codes.caret && + /* c8 ignore next */ + '_hiddenFootnoteSupport' in self.parser.constructs + ? /* c8 ignore next */ nok(code) + : ok(code) + } +} + +module.exports = labelStartImage diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/label-start-image.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/label-start-image.mjs new file mode 100644 index 00000000000000..a5bef6e88ac600 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/label-start-image.mjs @@ -0,0 +1,48 @@ +import labelEnd from './label-end.mjs' + +var labelStartImage = { + name: 'labelStartImage', + tokenize: tokenizeLabelStartImage, + resolveAll: labelEnd.resolveAll +} +export default labelStartImage + +import assert from 'assert' +import codes from '../character/codes.mjs' +import types from '../constant/types.mjs' + +function tokenizeLabelStartImage(effects, ok, nok) { + var self = this + + return start + + function start(code) { + assert(code === codes.exclamationMark, 'expected `!`') + effects.enter(types.labelImage) + effects.enter(types.labelImageMarker) + effects.consume(code) + effects.exit(types.labelImageMarker) + return open + } + + function open(code) { + if (code === codes.leftSquareBracket) { + effects.enter(types.labelMarker) + effects.consume(code) + effects.exit(types.labelMarker) + effects.exit(types.labelImage) + return after + } + + return nok(code) + } + + function after(code) { + /* c8 ignore next */ + return code === codes.caret && + /* c8 ignore next */ + '_hiddenFootnoteSupport' in self.parser.constructs + ? /* c8 ignore next */ nok(code) + : ok(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/label-start-link.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/label-start-link.js new file mode 100644 index 00000000000000..a31a1a3d6f3b74 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/label-start-link.js @@ -0,0 +1,46 @@ +'use strict' + +var labelEnd = require('./label-end.js') +var assert = require('assert') +var codes = require('../character/codes.js') +var types = require('../constant/types.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +var labelStartLink = { + name: 'labelStartLink', + tokenize: tokenizeLabelStartLink, + resolveAll: labelEnd.resolveAll +} + +function tokenizeLabelStartLink(effects, ok, nok) { + var self = this + + return start + + function start(code) { + assert__default['default'](code === codes.leftSquareBracket, 'expected `[`') + effects.enter(types.labelLink) + effects.enter(types.labelMarker) + effects.consume(code) + effects.exit(types.labelMarker) + effects.exit(types.labelLink) + return after + } + + function after(code) { + /* c8 ignore next */ + return code === codes.caret && + /* c8 ignore next */ + '_hiddenFootnoteSupport' in self.parser.constructs + ? /* c8 ignore next */ + nok(code) + : ok(code) + } +} + +module.exports = labelStartLink diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/label-start-link.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/label-start-link.mjs new file mode 100644 index 00000000000000..7e92c6d1afd035 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/label-start-link.mjs @@ -0,0 +1,38 @@ +import labelEnd from './label-end.mjs' + +var labelStartLink = { + name: 'labelStartLink', + tokenize: tokenizeLabelStartLink, + resolveAll: labelEnd.resolveAll +} +export default labelStartLink + +import assert from 'assert' +import codes from '../character/codes.mjs' +import types from '../constant/types.mjs' + +function tokenizeLabelStartLink(effects, ok, nok) { + var self = this + + return start + + function start(code) { + assert(code === codes.leftSquareBracket, 'expected `[`') + effects.enter(types.labelLink) + effects.enter(types.labelMarker) + effects.consume(code) + effects.exit(types.labelMarker) + effects.exit(types.labelLink) + return after + } + + function after(code) { + /* c8 ignore next */ + return code === codes.caret && + /* c8 ignore next */ + '_hiddenFootnoteSupport' in self.parser.constructs + ? /* c8 ignore next */ + nok(code) + : ok(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/line-ending.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/line-ending.js new file mode 100644 index 00000000000000..e56215c9b889e4 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/line-ending.js @@ -0,0 +1,31 @@ +'use strict' + +var assert = require('assert') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var types = require('../constant/types.js') +var factorySpace = require('./factory-space.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +var lineEnding = { + name: 'lineEnding', + tokenize: tokenizeLineEnding +} + +function tokenizeLineEnding(effects, ok) { + return start + + function start(code) { + assert__default['default'](markdownLineEnding(code), 'expected eol') + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return factorySpace(effects, ok, types.linePrefix) + } +} + +module.exports = lineEnding diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/line-ending.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/line-ending.mjs new file mode 100644 index 00000000000000..63029268f175e6 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/line-ending.mjs @@ -0,0 +1,22 @@ +var lineEnding = { + name: 'lineEnding', + tokenize: tokenizeLineEnding +} +export default lineEnding + +import assert from 'assert' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import types from '../constant/types.mjs' +import spaceFactory from './factory-space.mjs' + +function tokenizeLineEnding(effects, ok) { + return start + + function start(code) { + assert(markdownLineEnding(code), 'expected eol') + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return spaceFactory(effects, ok, types.linePrefix) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/list.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/list.js new file mode 100644 index 00000000000000..44f7615f5266e0 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/list.js @@ -0,0 +1,219 @@ +'use strict' + +var asciiDigit = require('../character/ascii-digit.js') +var codes = require('../character/codes.js') +var markdownSpace = require('../character/markdown-space.js') +var constants = require('../constant/constants.js') +var types = require('../constant/types.js') +var prefixSize = require('../util/prefix-size.js') +var sizeChunks = require('../util/size-chunks.js') +var factorySpace = require('./factory-space.js') +var partialBlankLine = require('./partial-blank-line.js') +var thematicBreak = require('./thematic-break.js') + +var list = { + name: 'list', + tokenize: tokenizeListStart, + continuation: {tokenize: tokenizeListContinuation}, + exit: tokenizeListEnd +} + +var listItemPrefixWhitespaceConstruct = { + tokenize: tokenizeListItemPrefixWhitespace, + partial: true +} +var indentConstruct = {tokenize: tokenizeIndent, partial: true} + +function tokenizeListStart(effects, ok, nok) { + var self = this + var initialSize = prefixSize(self.events, types.linePrefix) + var size = 0 + + return start + + function start(code) { + var kind = + self.containerState.type || + (code === codes.asterisk || code === codes.plusSign || code === codes.dash + ? types.listUnordered + : types.listOrdered) + + if ( + kind === types.listUnordered + ? !self.containerState.marker || code === self.containerState.marker + : asciiDigit(code) + ) { + if (!self.containerState.type) { + self.containerState.type = kind + effects.enter(kind, {_container: true}) + } + + if (kind === types.listUnordered) { + effects.enter(types.listItemPrefix) + return code === codes.asterisk || code === codes.dash + ? effects.check(thematicBreak, nok, atMarker)(code) + : atMarker(code) + } + + if (!self.interrupt || code === codes.digit1) { + effects.enter(types.listItemPrefix) + effects.enter(types.listItemValue) + return inside(code) + } + } + + return nok(code) + } + + function inside(code) { + if (asciiDigit(code) && ++size < constants.listItemValueSizeMax) { + effects.consume(code) + return inside + } + + if ( + (!self.interrupt || size < 2) && + (self.containerState.marker + ? code === self.containerState.marker + : code === codes.rightParenthesis || code === codes.dot) + ) { + effects.exit(types.listItemValue) + return atMarker(code) + } + + return nok(code) + } + + function atMarker(code) { + effects.enter(types.listItemMarker) + effects.consume(code) + effects.exit(types.listItemMarker) + self.containerState.marker = self.containerState.marker || code + return effects.check( + partialBlankLine, + // Can’t be empty when interrupting. + self.interrupt ? nok : onBlank, + effects.attempt( + listItemPrefixWhitespaceConstruct, + endOfPrefix, + otherPrefix + ) + ) + } + + function onBlank(code) { + self.containerState.initialBlankLine = true + initialSize++ + return endOfPrefix(code) + } + + function otherPrefix(code) { + if (markdownSpace(code)) { + effects.enter(types.listItemPrefixWhitespace) + effects.consume(code) + effects.exit(types.listItemPrefixWhitespace) + return endOfPrefix + } + + return nok(code) + } + + function endOfPrefix(code) { + self.containerState.size = + initialSize + + sizeChunks(self.sliceStream(effects.exit(types.listItemPrefix))) + return ok(code) + } +} + +function tokenizeListContinuation(effects, ok, nok) { + var self = this + + self.containerState._closeFlow = undefined + + return effects.check(partialBlankLine, onBlank, notBlank) + + function onBlank(code) { + self.containerState.furtherBlankLines = + self.containerState.furtherBlankLines || + self.containerState.initialBlankLine + + // We have a blank line. + // Still, try to consume at most the items size. + return factorySpace( + effects, + ok, + types.listItemIndent, + self.containerState.size + 1 + )(code) + } + + function notBlank(code) { + if (self.containerState.furtherBlankLines || !markdownSpace(code)) { + self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined + return notInCurrentItem(code) + } + + self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined + return effects.attempt(indentConstruct, ok, notInCurrentItem)(code) + } + + function notInCurrentItem(code) { + // While we do continue, we signal that the flow should be closed. + self.containerState._closeFlow = true + // As we’re closing flow, we’re no longer interrupting. + self.interrupt = undefined + return factorySpace( + effects, + effects.attempt(list, ok, nok), + types.linePrefix, + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : constants.tabSize + )(code) + } +} + +function tokenizeIndent(effects, ok, nok) { + var self = this + + return factorySpace( + effects, + afterPrefix, + types.listItemIndent, + self.containerState.size + 1 + ) + + function afterPrefix(code) { + return prefixSize(self.events, types.listItemIndent) === + self.containerState.size + ? ok(code) + : nok(code) + } +} + +function tokenizeListEnd(effects) { + effects.exit(this.containerState.type) +} + +function tokenizeListItemPrefixWhitespace(effects, ok, nok) { + var self = this + + return factorySpace( + effects, + afterPrefix, + types.listItemPrefixWhitespace, + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : constants.tabSize + 1 + ) + + function afterPrefix(code) { + return markdownSpace(code) || + !prefixSize(self.events, types.listItemPrefixWhitespace) + ? nok(code) + : ok(code) + } +} + +module.exports = list diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/list.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/list.mjs new file mode 100644 index 00000000000000..017a6eabac97d0 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/list.mjs @@ -0,0 +1,216 @@ +var list = { + name: 'list', + tokenize: tokenizeListStart, + continuation: {tokenize: tokenizeListContinuation}, + exit: tokenizeListEnd +} +export default list + +import asciiDigit from '../character/ascii-digit.mjs' +import codes from '../character/codes.mjs' +import markdownSpace from '../character/markdown-space.mjs' +import constants from '../constant/constants.mjs' +import types from '../constant/types.mjs' +import prefixSize from '../util/prefix-size.mjs' +import sizeChunks from '../util/size-chunks.mjs' +import spaceFactory from './factory-space.mjs' +import blank from './partial-blank-line.mjs' +import thematicBreak from './thematic-break.mjs' + +var listItemPrefixWhitespaceConstruct = { + tokenize: tokenizeListItemPrefixWhitespace, + partial: true +} +var indentConstruct = {tokenize: tokenizeIndent, partial: true} + +function tokenizeListStart(effects, ok, nok) { + var self = this + var initialSize = prefixSize(self.events, types.linePrefix) + var size = 0 + + return start + + function start(code) { + var kind = + self.containerState.type || + (code === codes.asterisk || code === codes.plusSign || code === codes.dash + ? types.listUnordered + : types.listOrdered) + + if ( + kind === types.listUnordered + ? !self.containerState.marker || code === self.containerState.marker + : asciiDigit(code) + ) { + if (!self.containerState.type) { + self.containerState.type = kind + effects.enter(kind, {_container: true}) + } + + if (kind === types.listUnordered) { + effects.enter(types.listItemPrefix) + return code === codes.asterisk || code === codes.dash + ? effects.check(thematicBreak, nok, atMarker)(code) + : atMarker(code) + } + + if (!self.interrupt || code === codes.digit1) { + effects.enter(types.listItemPrefix) + effects.enter(types.listItemValue) + return inside(code) + } + } + + return nok(code) + } + + function inside(code) { + if (asciiDigit(code) && ++size < constants.listItemValueSizeMax) { + effects.consume(code) + return inside + } + + if ( + (!self.interrupt || size < 2) && + (self.containerState.marker + ? code === self.containerState.marker + : code === codes.rightParenthesis || code === codes.dot) + ) { + effects.exit(types.listItemValue) + return atMarker(code) + } + + return nok(code) + } + + function atMarker(code) { + effects.enter(types.listItemMarker) + effects.consume(code) + effects.exit(types.listItemMarker) + self.containerState.marker = self.containerState.marker || code + return effects.check( + blank, + // Can’t be empty when interrupting. + self.interrupt ? nok : onBlank, + effects.attempt( + listItemPrefixWhitespaceConstruct, + endOfPrefix, + otherPrefix + ) + ) + } + + function onBlank(code) { + self.containerState.initialBlankLine = true + initialSize++ + return endOfPrefix(code) + } + + function otherPrefix(code) { + if (markdownSpace(code)) { + effects.enter(types.listItemPrefixWhitespace) + effects.consume(code) + effects.exit(types.listItemPrefixWhitespace) + return endOfPrefix + } + + return nok(code) + } + + function endOfPrefix(code) { + self.containerState.size = + initialSize + + sizeChunks(self.sliceStream(effects.exit(types.listItemPrefix))) + return ok(code) + } +} + +function tokenizeListContinuation(effects, ok, nok) { + var self = this + + self.containerState._closeFlow = undefined + + return effects.check(blank, onBlank, notBlank) + + function onBlank(code) { + self.containerState.furtherBlankLines = + self.containerState.furtherBlankLines || + self.containerState.initialBlankLine + + // We have a blank line. + // Still, try to consume at most the items size. + return spaceFactory( + effects, + ok, + types.listItemIndent, + self.containerState.size + 1 + )(code) + } + + function notBlank(code) { + if (self.containerState.furtherBlankLines || !markdownSpace(code)) { + self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined + return notInCurrentItem(code) + } + + self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined + return effects.attempt(indentConstruct, ok, notInCurrentItem)(code) + } + + function notInCurrentItem(code) { + // While we do continue, we signal that the flow should be closed. + self.containerState._closeFlow = true + // As we’re closing flow, we’re no longer interrupting. + self.interrupt = undefined + return spaceFactory( + effects, + effects.attempt(list, ok, nok), + types.linePrefix, + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : constants.tabSize + )(code) + } +} + +function tokenizeIndent(effects, ok, nok) { + var self = this + + return spaceFactory( + effects, + afterPrefix, + types.listItemIndent, + self.containerState.size + 1 + ) + + function afterPrefix(code) { + return prefixSize(self.events, types.listItemIndent) === + self.containerState.size + ? ok(code) + : nok(code) + } +} + +function tokenizeListEnd(effects) { + effects.exit(this.containerState.type) +} + +function tokenizeListItemPrefixWhitespace(effects, ok, nok) { + var self = this + + return spaceFactory( + effects, + afterPrefix, + types.listItemPrefixWhitespace, + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : constants.tabSize + 1 + ) + + function afterPrefix(code) { + return markdownSpace(code) || + !prefixSize(self.events, types.listItemPrefixWhitespace) + ? nok(code) + : ok(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/partial-blank-line.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/partial-blank-line.js new file mode 100644 index 00000000000000..073824b3b6a18f --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/partial-blank-line.js @@ -0,0 +1,21 @@ +'use strict' + +var codes = require('../character/codes.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var types = require('../constant/types.js') +var factorySpace = require('./factory-space.js') + +var partialBlankLine = { + tokenize: tokenizePartialBlankLine, + partial: true +} + +function tokenizePartialBlankLine(effects, ok, nok) { + return factorySpace(effects, afterWhitespace, types.linePrefix) + + function afterWhitespace(code) { + return code === codes.eof || markdownLineEnding(code) ? ok(code) : nok(code) + } +} + +module.exports = partialBlankLine diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/partial-blank-line.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/partial-blank-line.mjs new file mode 100644 index 00000000000000..de85658576fea3 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/partial-blank-line.mjs @@ -0,0 +1,18 @@ +var partialBlankLine = { + tokenize: tokenizePartialBlankLine, + partial: true +} +export default partialBlankLine + +import codes from '../character/codes.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import types from '../constant/types.mjs' +import spaceFactory from './factory-space.mjs' + +function tokenizePartialBlankLine(effects, ok, nok) { + return spaceFactory(effects, afterWhitespace, types.linePrefix) + + function afterWhitespace(code) { + return code === codes.eof || markdownLineEnding(code) ? ok(code) : nok(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/setext-underline.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/setext-underline.js new file mode 100644 index 00000000000000..9ac1e5c4e951c9 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/setext-underline.js @@ -0,0 +1,138 @@ +'use strict' + +var assert = require('assert') +var codes = require('../character/codes.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var types = require('../constant/types.js') +var shallow = require('../util/shallow.js') +var factorySpace = require('./factory-space.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +var setextUnderline = { + name: 'setextUnderline', + tokenize: tokenizeSetextUnderline, + resolveTo: resolveToSetextUnderline +} + +function resolveToSetextUnderline(events, context) { + var index = events.length + var content + var text + var definition + var heading + + // Find the opening of the content. + // It’ll always exist: we don’t tokenize if it isn’t there. + while (index--) { + if (events[index][0] === 'enter') { + if (events[index][1].type === types.content) { + content = index + break + } + + if (events[index][1].type === types.paragraph) { + text = index + } + } + // Exit + else { + if (events[index][1].type === types.content) { + // Remove the content end (if needed we’ll add it later) + events.splice(index, 1) + } + + if (!definition && events[index][1].type === types.definition) { + definition = index + } + } + } + + heading = { + type: types.setextHeading, + start: shallow(events[text][1].start), + end: shallow(events[events.length - 1][1].end) + } + + // Change the paragraph to setext heading text. + events[text][1].type = types.setextHeadingText + + // If we have definitions in the content, we’ll keep on having content, + // but we need move it. + if (definition) { + events.splice(text, 0, ['enter', heading, context]) + events.splice(definition + 1, 0, ['exit', events[content][1], context]) + events[content][1].end = shallow(events[definition][1].end) + } else { + events[content][1] = heading + } + + // Add the heading exit at the end. + events.push(['exit', heading, context]) + + return events +} + +function tokenizeSetextUnderline(effects, ok, nok) { + var self = this + var index = self.events.length + var marker + var paragraph + + // Find an opening. + while (index--) { + // Skip enter/exit of line ending, line prefix, and content. + // We can now either have a definition or a paragraph. + if ( + self.events[index][1].type !== types.lineEnding && + self.events[index][1].type !== types.linePrefix && + self.events[index][1].type !== types.content + ) { + paragraph = self.events[index][1].type === types.paragraph + break + } + } + + return start + + function start(code) { + assert__default['default']( + code === codes.dash || code === codes.equalsTo, + 'expected `=` or `-`' + ) + + if (!self.lazy && (self.interrupt || paragraph)) { + effects.enter(types.setextHeadingLine) + effects.enter(types.setextHeadingLineSequence) + marker = code + return closingSequence(code) + } + + return nok(code) + } + + function closingSequence(code) { + if (code === marker) { + effects.consume(code) + return closingSequence + } + + effects.exit(types.setextHeadingLineSequence) + return factorySpace(effects, closingSequenceEnd, types.lineSuffix)(code) + } + + function closingSequenceEnd(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.setextHeadingLine) + return ok(code) + } + + return nok(code) + } +} + +module.exports = setextUnderline diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/setext-underline.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/setext-underline.mjs new file mode 100644 index 00000000000000..6724846b688806 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/setext-underline.mjs @@ -0,0 +1,129 @@ +var setextUnderline = { + name: 'setextUnderline', + tokenize: tokenizeSetextUnderline, + resolveTo: resolveToSetextUnderline +} +export default setextUnderline + +import assert from 'assert' +import codes from '../character/codes.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import types from '../constant/types.mjs' +import shallow from '../util/shallow.mjs' +import spaceFactory from './factory-space.mjs' + +function resolveToSetextUnderline(events, context) { + var index = events.length + var content + var text + var definition + var heading + + // Find the opening of the content. + // It’ll always exist: we don’t tokenize if it isn’t there. + while (index--) { + if (events[index][0] === 'enter') { + if (events[index][1].type === types.content) { + content = index + break + } + + if (events[index][1].type === types.paragraph) { + text = index + } + } + // Exit + else { + if (events[index][1].type === types.content) { + // Remove the content end (if needed we’ll add it later) + events.splice(index, 1) + } + + if (!definition && events[index][1].type === types.definition) { + definition = index + } + } + } + + heading = { + type: types.setextHeading, + start: shallow(events[text][1].start), + end: shallow(events[events.length - 1][1].end) + } + + // Change the paragraph to setext heading text. + events[text][1].type = types.setextHeadingText + + // If we have definitions in the content, we’ll keep on having content, + // but we need move it. + if (definition) { + events.splice(text, 0, ['enter', heading, context]) + events.splice(definition + 1, 0, ['exit', events[content][1], context]) + events[content][1].end = shallow(events[definition][1].end) + } else { + events[content][1] = heading + } + + // Add the heading exit at the end. + events.push(['exit', heading, context]) + + return events +} + +function tokenizeSetextUnderline(effects, ok, nok) { + var self = this + var index = self.events.length + var marker + var paragraph + + // Find an opening. + while (index--) { + // Skip enter/exit of line ending, line prefix, and content. + // We can now either have a definition or a paragraph. + if ( + self.events[index][1].type !== types.lineEnding && + self.events[index][1].type !== types.linePrefix && + self.events[index][1].type !== types.content + ) { + paragraph = self.events[index][1].type === types.paragraph + break + } + } + + return start + + function start(code) { + assert( + code === codes.dash || code === codes.equalsTo, + 'expected `=` or `-`' + ) + + if (!self.lazy && (self.interrupt || paragraph)) { + effects.enter(types.setextHeadingLine) + effects.enter(types.setextHeadingLineSequence) + marker = code + return closingSequence(code) + } + + return nok(code) + } + + function closingSequence(code) { + if (code === marker) { + effects.consume(code) + return closingSequence + } + + effects.exit(types.setextHeadingLineSequence) + return spaceFactory(effects, closingSequenceEnd, types.lineSuffix)(code) + } + + function closingSequenceEnd(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.setextHeadingLine) + return ok(code) + } + + return nok(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/thematic-break.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/thematic-break.js new file mode 100644 index 00000000000000..a927a51cb17c22 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/thematic-break.js @@ -0,0 +1,74 @@ +'use strict' + +var assert = require('assert') +var codes = require('../character/codes.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var markdownSpace = require('../character/markdown-space.js') +var constants = require('../constant/constants.js') +var types = require('../constant/types.js') +var factorySpace = require('./factory-space.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +var thematicBreak = { + name: 'thematicBreak', + tokenize: tokenizeThematicBreak +} + +function tokenizeThematicBreak(effects, ok, nok) { + var size = 0 + var marker + + return start + + function start(code) { + assert__default['default']( + code === codes.asterisk || + code === codes.dash || + code === codes.underscore, + 'expected `*`, `-`, or `_`' + ) + + effects.enter(types.thematicBreak) + marker = code + return atBreak(code) + } + + function atBreak(code) { + if (code === marker) { + effects.enter(types.thematicBreakSequence) + return sequence(code) + } + + if (markdownSpace(code)) { + return factorySpace(effects, atBreak, types.whitespace)(code) + } + + if ( + size < constants.thematicBreakMarkerCountMin || + (code !== codes.eof && !markdownLineEnding(code)) + ) { + return nok(code) + } + + effects.exit(types.thematicBreak) + return ok(code) + } + + function sequence(code) { + if (code === marker) { + effects.consume(code) + size++ + return sequence + } + + effects.exit(types.thematicBreakSequence) + return atBreak(code) + } +} + +module.exports = thematicBreak diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/thematic-break.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/thematic-break.mjs new file mode 100644 index 00000000000000..58c4d7824de8cd --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/tokenize/thematic-break.mjs @@ -0,0 +1,65 @@ +var thematicBreak = { + name: 'thematicBreak', + tokenize: tokenizeThematicBreak +} +export default thematicBreak + +import assert from 'assert' +import codes from '../character/codes.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import markdownSpace from '../character/markdown-space.mjs' +import constants from '../constant/constants.mjs' +import types from '../constant/types.mjs' +import spaceFactory from './factory-space.mjs' + +function tokenizeThematicBreak(effects, ok, nok) { + var size = 0 + var marker + + return start + + function start(code) { + assert( + code === codes.asterisk || + code === codes.dash || + code === codes.underscore, + 'expected `*`, `-`, or `_`' + ) + + effects.enter(types.thematicBreak) + marker = code + return atBreak(code) + } + + function atBreak(code) { + if (code === marker) { + effects.enter(types.thematicBreakSequence) + return sequence(code) + } + + if (markdownSpace(code)) { + return spaceFactory(effects, atBreak, types.whitespace)(code) + } + + if ( + size < constants.thematicBreakMarkerCountMin || + (code !== codes.eof && !markdownLineEnding(code)) + ) { + return nok(code) + } + + effects.exit(types.thematicBreak) + return ok(code) + } + + function sequence(code) { + if (code === marker) { + effects.consume(code) + size++ + return sequence + } + + effects.exit(types.thematicBreakSequence) + return atBreak(code) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/chunked-push.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/chunked-push.js new file mode 100644 index 00000000000000..77689779959fbb --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/chunked-push.js @@ -0,0 +1,14 @@ +'use strict' + +var chunkedSplice = require('./chunked-splice.js') + +function chunkedPush(list, items) { + if (list.length) { + chunkedSplice(list, list.length, 0, items) + return list + } + + return items +} + +module.exports = chunkedPush diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/chunked-push.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/chunked-push.mjs new file mode 100644 index 00000000000000..3c84d8b7e17d5b --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/chunked-push.mjs @@ -0,0 +1,12 @@ +export default chunkedPush + +import chunkedSplice from './chunked-splice.mjs' + +function chunkedPush(list, items) { + if (list.length) { + chunkedSplice(list, list.length, 0, items) + return list + } + + return items +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/chunked-splice.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/chunked-splice.js new file mode 100644 index 00000000000000..5a3246d8bc350d --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/chunked-splice.js @@ -0,0 +1,46 @@ +'use strict' + +var constants = require('../constant/constants.js') +var splice = require('../constant/splice.js') + +// `Array#splice` takes all items to be inserted as individual argument which +// causes a stack overflow in V8 when trying to insert 100k items for instance. +function chunkedSplice(list, start, remove, items) { + var end = list.length + var chunkStart = 0 + var parameters + + // Make start between zero and `end` (included). + if (start < 0) { + start = -start > end ? 0 : end + start + } else { + start = start > end ? end : start + } + + remove = remove > 0 ? remove : 0 + + // No need to chunk the items if there’s only a couple (10k) items. + if (items.length < constants.v8MaxSafeChunkSize) { + parameters = Array.from(items) + parameters.unshift(start, remove) + splice.apply(list, parameters) + } else { + // Delete `remove` items starting from `start` + if (remove) splice.apply(list, [start, remove]) + + // Insert the items in chunks to not cause stack overflows. + while (chunkStart < items.length) { + parameters = items.slice( + chunkStart, + chunkStart + constants.v8MaxSafeChunkSize + ) + parameters.unshift(start, 0) + splice.apply(list, parameters) + + chunkStart += constants.v8MaxSafeChunkSize + start += constants.v8MaxSafeChunkSize + } + } +} + +module.exports = chunkedSplice diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/chunked-splice.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/chunked-splice.mjs new file mode 100644 index 00000000000000..0bda9533bbaf91 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/chunked-splice.mjs @@ -0,0 +1,44 @@ +export default chunkedSplice + +import constants from '../constant/constants.mjs' +import splice from '../constant/splice.mjs' + +// `Array#splice` takes all items to be inserted as individual argument which +// causes a stack overflow in V8 when trying to insert 100k items for instance. +function chunkedSplice(list, start, remove, items) { + var end = list.length + var chunkStart = 0 + var parameters + + // Make start between zero and `end` (included). + if (start < 0) { + start = -start > end ? 0 : end + start + } else { + start = start > end ? end : start + } + + remove = remove > 0 ? remove : 0 + + // No need to chunk the items if there’s only a couple (10k) items. + if (items.length < constants.v8MaxSafeChunkSize) { + parameters = Array.from(items) + parameters.unshift(start, remove) + splice.apply(list, parameters) + } else { + // Delete `remove` items starting from `start` + if (remove) splice.apply(list, [start, remove]) + + // Insert the items in chunks to not cause stack overflows. + while (chunkStart < items.length) { + parameters = items.slice( + chunkStart, + chunkStart + constants.v8MaxSafeChunkSize + ) + parameters.unshift(start, 0) + splice.apply(list, parameters) + + chunkStart += constants.v8MaxSafeChunkSize + start += constants.v8MaxSafeChunkSize + } + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/classify-character.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/classify-character.js new file mode 100644 index 00000000000000..3c73c41f57f5f4 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/classify-character.js @@ -0,0 +1,27 @@ +'use strict' + +var codes = require('../character/codes.js') +var markdownLineEndingOrSpace = require('../character/markdown-line-ending-or-space.js') +var unicodePunctuation = require('../character/unicode-punctuation.js') +var unicodeWhitespace = require('../character/unicode-whitespace.js') +var constants = require('../constant/constants.js') + +// Classify whether a character is unicode whitespace, unicode punctuation, or +// anything else. +// Used for attention (emphasis, strong), whose sequences can open or close +// based on the class of surrounding characters. +function classifyCharacter(code) { + if ( + code === codes.eof || + markdownLineEndingOrSpace(code) || + unicodeWhitespace(code) + ) { + return constants.characterGroupWhitespace + } + + if (unicodePunctuation(code)) { + return constants.characterGroupPunctuation + } +} + +module.exports = classifyCharacter diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/classify-character.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/classify-character.mjs new file mode 100644 index 00000000000000..f701c8e0d02315 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/classify-character.mjs @@ -0,0 +1,25 @@ +export default classifyCharacter + +import codes from '../character/codes.mjs' +import markdownLineEndingOrSpace from '../character/markdown-line-ending-or-space.mjs' +import unicodePunctuation from '../character/unicode-punctuation.mjs' +import unicodeWhitespace from '../character/unicode-whitespace.mjs' +import constants from '../constant/constants.mjs' + +// Classify whether a character is unicode whitespace, unicode punctuation, or +// anything else. +// Used for attention (emphasis, strong), whose sequences can open or close +// based on the class of surrounding characters. +function classifyCharacter(code) { + if ( + code === codes.eof || + markdownLineEndingOrSpace(code) || + unicodeWhitespace(code) + ) { + return constants.characterGroupWhitespace + } + + if (unicodePunctuation(code)) { + return constants.characterGroupPunctuation + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/combine-extensions.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/combine-extensions.js new file mode 100644 index 00000000000000..830ec3bf258683 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/combine-extensions.js @@ -0,0 +1,50 @@ +'use strict' + +var hasOwnProperty = require('../constant/has-own-property.js') +var chunkedSplice = require('./chunked-splice.js') +var miniflat = require('./miniflat.js') + +// Combine several syntax extensions into one. +function combineExtensions(extensions) { + var all = {} + var index = -1 + + while (++index < extensions.length) { + extension(all, extensions[index]) + } + + return all +} + +function extension(all, extension) { + var hook + var left + var right + var code + + for (hook in extension) { + left = hasOwnProperty.call(all, hook) ? all[hook] : (all[hook] = {}) + right = extension[hook] + + for (code in right) { + left[code] = constructs( + miniflat(right[code]), + hasOwnProperty.call(left, code) ? left[code] : [] + ) + } + } +} + +function constructs(list, existing) { + var index = -1 + var before = [] + + while (++index < list.length) { + ;(list[index].add === 'after' ? existing : before).push(list[index]) + } + + chunkedSplice(existing, 0, 0, before) + return existing +} + +module.exports = combineExtensions diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/combine-extensions.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/combine-extensions.mjs new file mode 100644 index 00000000000000..605652a8c8296e --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/combine-extensions.mjs @@ -0,0 +1,48 @@ +export default combineExtensions + +import own from '../constant/has-own-property.mjs' +import chunkedSplice from './chunked-splice.mjs' +import miniflat from './miniflat.mjs' + +// Combine several syntax extensions into one. +function combineExtensions(extensions) { + var all = {} + var index = -1 + + while (++index < extensions.length) { + extension(all, extensions[index]) + } + + return all +} + +function extension(all, extension) { + var hook + var left + var right + var code + + for (hook in extension) { + left = own.call(all, hook) ? all[hook] : (all[hook] = {}) + right = extension[hook] + + for (code in right) { + left[code] = constructs( + miniflat(right[code]), + own.call(left, code) ? left[code] : [] + ) + } + } +} + +function constructs(list, existing) { + var index = -1 + var before = [] + + while (++index < list.length) { + ;(list[index].add === 'after' ? existing : before).push(list[index]) + } + + chunkedSplice(existing, 0, 0, before) + return existing +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/combine-html-extensions.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/combine-html-extensions.js new file mode 100644 index 00000000000000..c4fdadaf070721 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/combine-html-extensions.js @@ -0,0 +1,35 @@ +'use strict' + +var hasOwnProperty = require('../constant/has-own-property.js') + +// Combine several HTML extensions into one. +function combineHtmlExtensions(extensions) { + var handlers = {} + var index = -1 + + while (++index < extensions.length) { + extension(handlers, extensions[index]) + } + + return handlers +} + +function extension(handlers, extension) { + var hook + var left + var right + var type + + for (hook in extension) { + left = hasOwnProperty.call(handlers, hook) + ? handlers[hook] + : (handlers[hook] = {}) + right = extension[hook] + + for (type in right) { + left[type] = right[type] + } + } +} + +module.exports = combineHtmlExtensions diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/combine-html-extensions.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/combine-html-extensions.mjs new file mode 100644 index 00000000000000..d7e54e75dc5388 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/combine-html-extensions.mjs @@ -0,0 +1,31 @@ +export default combineHtmlExtensions + +import own from '../constant/has-own-property.mjs' + +// Combine several HTML extensions into one. +function combineHtmlExtensions(extensions) { + var handlers = {} + var index = -1 + + while (++index < extensions.length) { + extension(handlers, extensions[index]) + } + + return handlers +} + +function extension(handlers, extension) { + var hook + var left + var right + var type + + for (hook in extension) { + left = own.call(handlers, hook) ? handlers[hook] : (handlers[hook] = {}) + right = extension[hook] + + for (type in right) { + left[type] = right[type] + } + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/create-tokenizer.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/create-tokenizer.js new file mode 100644 index 00000000000000..dac8901405bccc --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/create-tokenizer.js @@ -0,0 +1,440 @@ +'use strict' + +var assert = require('assert') +var createDebug = require('debug') +var assign = require('../constant/assign.js') +var codes = require('../character/codes.js') +var markdownLineEnding = require('../character/markdown-line-ending.js') +var chunkedPush = require('./chunked-push.js') +var chunkedSplice = require('./chunked-splice.js') +var miniflat = require('./miniflat.js') +var resolveAll = require('./resolve-all.js') +var serializeChunks = require('./serialize-chunks.js') +var shallow = require('./shallow.js') +var sliceChunks = require('./slice-chunks.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) +var createDebug__default = /*#__PURE__*/ _interopDefaultLegacy(createDebug) + +var debug = createDebug__default['default']('micromark') + +// Create a tokenizer. +// Tokenizers deal with one type of data (e.g., containers, flow, text). +// The parser is the object dealing with it all. +// `initialize` works like other constructs, except that only its `tokenize` +// function is used, in which case it doesn’t receive an `ok` or `nok`. +// `from` can be given to set the point before the first character, although +// when further lines are indented, they must be set with `defineSkip`. +function createTokenizer(parser, initialize, from) { + var point = from ? shallow(from) : {line: 1, column: 1, offset: 0} + var columnStart = {} + var resolveAllConstructs = [] + var chunks = [] + var stack = [] + var consumed = true + + // Tools used for tokenizing. + var effects = { + consume: consume, + enter: enter, + exit: exit, + attempt: constructFactory(onsuccessfulconstruct), + check: constructFactory(onsuccessfulcheck), + interrupt: constructFactory(onsuccessfulcheck, {interrupt: true}), + lazy: constructFactory(onsuccessfulcheck, {lazy: true}) + } + + // State and tools for resolving and serializing. + var context = { + previous: codes.eof, + events: [], + parser: parser, + sliceStream: sliceStream, + sliceSerialize: sliceSerialize, + now: now, + defineSkip: skip, + write: write + } + + // The state function. + var state = initialize.tokenize.call(context, effects) + + // Track which character we expect to be consumed, to catch bugs. + var expectedCode + + if (initialize.resolveAll) { + resolveAllConstructs.push(initialize) + } + + // Store where we are in the input stream. + point._index = 0 + point._bufferIndex = -1 + + return context + + function write(slice) { + chunks = chunkedPush(chunks, slice) + + main() + + // Exit if we’re not done, resolve might change stuff. + if (chunks[chunks.length - 1] !== codes.eof) { + return [] + } + + addResult(initialize, 0) + + // Otherwise, resolve, and exit. + context.events = resolveAll(resolveAllConstructs, context.events, context) + + return context.events + } + + // + // Tools. + // + + function sliceSerialize(token) { + return serializeChunks(sliceStream(token)) + } + + function sliceStream(token) { + return sliceChunks(chunks, token) + } + + function now() { + return shallow(point) + } + + function skip(value) { + columnStart[value.line] = value.column + accountForPotentialSkip() + debug('position: define skip: `%j`', point) + } + + // + // State management. + // + + // Main loop (note that `_index` and `_bufferIndex` in `point` are modified by + // `consume`). + // Here is where we walk through the chunks, which either include strings of + // several characters, or numerical character codes. + // The reason to do this in a loop instead of a call is so the stack can + // drain. + function main() { + var chunkIndex + var chunk + + while (point._index < chunks.length) { + chunk = chunks[point._index] + + // If we’re in a buffer chunk, loop through it. + if (typeof chunk === 'string') { + chunkIndex = point._index + + if (point._bufferIndex < 0) { + point._bufferIndex = 0 + } + + while ( + point._index === chunkIndex && + point._bufferIndex < chunk.length + ) { + go(chunk.charCodeAt(point._bufferIndex)) + } + } else { + go(chunk) + } + } + } + + // Deal with one code. + function go(code) { + assert__default['default'].equal( + consumed, + true, + 'expected character to be consumed' + ) + consumed = undefined + debug('main: passing `%s` to %s', code, state.name) + expectedCode = code + state = state(code) + } + + // Move a character forward. + function consume(code) { + assert__default['default'].equal( + code, + expectedCode, + 'expected given code to equal expected code' + ) + + debug('consume: `%s`', code) + + assert__default['default'].equal( + consumed, + undefined, + 'expected code to not have been consumed' + ) + assert__default['default']( + code === null + ? !context.events.length || + context.events[context.events.length - 1][0] === 'exit' + : context.events[context.events.length - 1][0] === 'enter', + 'expected last token to be open' + ) + + if (markdownLineEnding(code)) { + point.line++ + point.column = 1 + point.offset += code === codes.carriageReturnLineFeed ? 2 : 1 + accountForPotentialSkip() + debug('position: after eol: `%j`', point) + } else if (code !== codes.virtualSpace) { + point.column++ + point.offset++ + } + + // Not in a string chunk. + if (point._bufferIndex < 0) { + point._index++ + } else { + point._bufferIndex++ + + // At end of string chunk. + if (point._bufferIndex === chunks[point._index].length) { + point._bufferIndex = -1 + point._index++ + } + } + + // Expose the previous character. + context.previous = code + + // Mark as consumed. + consumed = true + } + + // Start a token. + function enter(type, fields) { + var token = fields || {} + token.type = type + token.start = now() + + assert__default['default'].equal( + typeof type, + 'string', + 'expected string type' + ) + assert__default['default'].notEqual( + type.length, + 0, + 'expected non-empty string' + ) + debug('enter: `%s`', type) + + context.events.push(['enter', token, context]) + + stack.push(token) + + return token + } + + // Stop a token. + function exit(type) { + assert__default['default'].equal( + typeof type, + 'string', + 'expected string type' + ) + assert__default['default'].notEqual( + type.length, + 0, + 'expected non-empty string' + ) + assert__default['default'].notEqual( + stack.length, + 0, + 'cannot close w/o open tokens' + ) + + var token = stack.pop() + token.end = now() + + assert__default['default'].equal( + type, + token.type, + 'expected exit token to match current token' + ) + + assert__default['default']( + !( + token.start._index === token.end._index && + token.start._bufferIndex === token.end._bufferIndex + ), + 'expected non-empty token (`' + type + '`)' + ) + + debug('exit: `%s`', token.type) + context.events.push(['exit', token, context]) + + return token + } + + // Use results. + function onsuccessfulconstruct(construct, info) { + addResult(construct, info.from) + } + + // Discard results. + function onsuccessfulcheck(construct, info) { + info.restore() + } + + // Factory to attempt/check/interrupt. + function constructFactory(onreturn, fields) { + return hook + + // Handle either an object mapping codes to constructs, a list of + // constructs, or a single construct. + function hook(constructs, returnState, bogusState) { + var listOfConstructs + var constructIndex + var currentConstruct + var info + + return constructs.tokenize || 'length' in constructs + ? handleListOfConstructs(miniflat(constructs)) + : handleMapOfConstructs + + function handleMapOfConstructs(code) { + if (code in constructs || codes.eof in constructs) { + return handleListOfConstructs( + constructs.null + ? /* c8 ignore next */ + miniflat(constructs[code]).concat(miniflat(constructs.null)) + : constructs[code] + )(code) + } + + return bogusState(code) + } + + function handleListOfConstructs(list) { + listOfConstructs = list + constructIndex = 0 + return handleConstruct(list[constructIndex]) + } + + function handleConstruct(construct) { + return start + + function start(code) { + // To do: not nede to store if there is no bogus state, probably? + // Currently doesn’t work because `inspect` in document does a check + // w/o a bogus, which doesn’t make sense. But it does seem to help perf + // by not storing. + info = store() + currentConstruct = construct + + if (!construct.partial) { + context.currentConstruct = construct + } + + if ( + construct.name && + context.parser.constructs.disable.null.indexOf(construct.name) > -1 + ) { + return nok(code) + } + + return construct.tokenize.call( + fields ? assign({}, context, fields) : context, + effects, + ok, + nok + )(code) + } + } + + function ok(code) { + assert__default['default'].equal(code, expectedCode, 'expected code') + consumed = true + onreturn(currentConstruct, info) + return returnState + } + + function nok(code) { + assert__default['default'].equal(code, expectedCode, 'expected code') + consumed = true + info.restore() + + if (++constructIndex < listOfConstructs.length) { + return handleConstruct(listOfConstructs[constructIndex]) + } + + return bogusState + } + } + } + + function addResult(construct, from) { + if (construct.resolveAll && resolveAllConstructs.indexOf(construct) < 0) { + resolveAllConstructs.push(construct) + } + + if (construct.resolve) { + chunkedSplice( + context.events, + from, + context.events.length - from, + construct.resolve(context.events.slice(from), context) + ) + } + + if (construct.resolveTo) { + context.events = construct.resolveTo(context.events, context) + } + + assert__default['default']( + construct.partial || + !context.events.length || + context.events[context.events.length - 1][0] === 'exit', + 'expected last token to end' + ) + } + + function store() { + var startPoint = now() + var startPrevious = context.previous + var startCurrentConstruct = context.currentConstruct + var startEventsIndex = context.events.length + var startStack = Array.from(stack) + + return {restore: restore, from: startEventsIndex} + + function restore() { + point = startPoint + context.previous = startPrevious + context.currentConstruct = startCurrentConstruct + context.events.length = startEventsIndex + stack = startStack + accountForPotentialSkip() + debug('position: restore: `%j`', point) + } + } + + function accountForPotentialSkip() { + if (point.line in columnStart && point.column < 2) { + point.column = columnStart[point.line] + point.offset += columnStart[point.line] - 1 + } + } +} + +module.exports = createTokenizer diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/create-tokenizer.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/create-tokenizer.mjs new file mode 100644 index 00000000000000..6e8808ea767bd8 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/create-tokenizer.mjs @@ -0,0 +1,399 @@ +export default createTokenizer + +import assert from 'assert' +import createDebug from 'debug' +import assign from '../constant/assign.mjs' +import codes from '../character/codes.mjs' +import markdownLineEnding from '../character/markdown-line-ending.mjs' +import chunkedPush from './chunked-push.mjs' +import chunkedSplice from './chunked-splice.mjs' +import miniflat from './miniflat.mjs' +import resolveAll from './resolve-all.mjs' +import serializeChunks from './serialize-chunks.mjs' +import shallow from './shallow.mjs' +import sliceChunks from './slice-chunks.mjs' + +var debug = createDebug('micromark') + +// Create a tokenizer. +// Tokenizers deal with one type of data (e.g., containers, flow, text). +// The parser is the object dealing with it all. +// `initialize` works like other constructs, except that only its `tokenize` +// function is used, in which case it doesn’t receive an `ok` or `nok`. +// `from` can be given to set the point before the first character, although +// when further lines are indented, they must be set with `defineSkip`. +function createTokenizer(parser, initialize, from) { + var point = from ? shallow(from) : {line: 1, column: 1, offset: 0} + var columnStart = {} + var resolveAllConstructs = [] + var chunks = [] + var stack = [] + var consumed = true + + // Tools used for tokenizing. + var effects = { + consume: consume, + enter: enter, + exit: exit, + attempt: constructFactory(onsuccessfulconstruct), + check: constructFactory(onsuccessfulcheck), + interrupt: constructFactory(onsuccessfulcheck, {interrupt: true}), + lazy: constructFactory(onsuccessfulcheck, {lazy: true}) + } + + // State and tools for resolving and serializing. + var context = { + previous: codes.eof, + events: [], + parser: parser, + sliceStream: sliceStream, + sliceSerialize: sliceSerialize, + now: now, + defineSkip: skip, + write: write + } + + // The state function. + var state = initialize.tokenize.call(context, effects) + + // Track which character we expect to be consumed, to catch bugs. + var expectedCode + + if (initialize.resolveAll) { + resolveAllConstructs.push(initialize) + } + + // Store where we are in the input stream. + point._index = 0 + point._bufferIndex = -1 + + return context + + function write(slice) { + chunks = chunkedPush(chunks, slice) + + main() + + // Exit if we’re not done, resolve might change stuff. + if (chunks[chunks.length - 1] !== codes.eof) { + return [] + } + + addResult(initialize, 0) + + // Otherwise, resolve, and exit. + context.events = resolveAll(resolveAllConstructs, context.events, context) + + return context.events + } + + // + // Tools. + // + + function sliceSerialize(token) { + return serializeChunks(sliceStream(token)) + } + + function sliceStream(token) { + return sliceChunks(chunks, token) + } + + function now() { + return shallow(point) + } + + function skip(value) { + columnStart[value.line] = value.column + accountForPotentialSkip() + debug('position: define skip: `%j`', point) + } + + // + // State management. + // + + // Main loop (note that `_index` and `_bufferIndex` in `point` are modified by + // `consume`). + // Here is where we walk through the chunks, which either include strings of + // several characters, or numerical character codes. + // The reason to do this in a loop instead of a call is so the stack can + // drain. + function main() { + var chunkIndex + var chunk + + while (point._index < chunks.length) { + chunk = chunks[point._index] + + // If we’re in a buffer chunk, loop through it. + if (typeof chunk === 'string') { + chunkIndex = point._index + + if (point._bufferIndex < 0) { + point._bufferIndex = 0 + } + + while ( + point._index === chunkIndex && + point._bufferIndex < chunk.length + ) { + go(chunk.charCodeAt(point._bufferIndex)) + } + } else { + go(chunk) + } + } + } + + // Deal with one code. + function go(code) { + assert.equal(consumed, true, 'expected character to be consumed') + consumed = undefined + debug('main: passing `%s` to %s', code, state.name) + expectedCode = code + state = state(code) + } + + // Move a character forward. + function consume(code) { + assert.equal( + code, + expectedCode, + 'expected given code to equal expected code' + ) + + debug('consume: `%s`', code) + + assert.equal(consumed, undefined, 'expected code to not have been consumed') + assert( + code === null + ? !context.events.length || + context.events[context.events.length - 1][0] === 'exit' + : context.events[context.events.length - 1][0] === 'enter', + 'expected last token to be open' + ) + + if (markdownLineEnding(code)) { + point.line++ + point.column = 1 + point.offset += code === codes.carriageReturnLineFeed ? 2 : 1 + accountForPotentialSkip() + debug('position: after eol: `%j`', point) + } else if (code !== codes.virtualSpace) { + point.column++ + point.offset++ + } + + // Not in a string chunk. + if (point._bufferIndex < 0) { + point._index++ + } else { + point._bufferIndex++ + + // At end of string chunk. + if (point._bufferIndex === chunks[point._index].length) { + point._bufferIndex = -1 + point._index++ + } + } + + // Expose the previous character. + context.previous = code + + // Mark as consumed. + consumed = true + } + + // Start a token. + function enter(type, fields) { + var token = fields || {} + token.type = type + token.start = now() + + assert.equal(typeof type, 'string', 'expected string type') + assert.notEqual(type.length, 0, 'expected non-empty string') + debug('enter: `%s`', type) + + context.events.push(['enter', token, context]) + + stack.push(token) + + return token + } + + // Stop a token. + function exit(type) { + assert.equal(typeof type, 'string', 'expected string type') + assert.notEqual(type.length, 0, 'expected non-empty string') + assert.notEqual(stack.length, 0, 'cannot close w/o open tokens') + + var token = stack.pop() + token.end = now() + + assert.equal(type, token.type, 'expected exit token to match current token') + + assert( + !( + token.start._index === token.end._index && + token.start._bufferIndex === token.end._bufferIndex + ), + 'expected non-empty token (`' + type + '`)' + ) + + debug('exit: `%s`', token.type) + context.events.push(['exit', token, context]) + + return token + } + + // Use results. + function onsuccessfulconstruct(construct, info) { + addResult(construct, info.from) + } + + // Discard results. + function onsuccessfulcheck(construct, info) { + info.restore() + } + + // Factory to attempt/check/interrupt. + function constructFactory(onreturn, fields) { + return hook + + // Handle either an object mapping codes to constructs, a list of + // constructs, or a single construct. + function hook(constructs, returnState, bogusState) { + var listOfConstructs + var constructIndex + var currentConstruct + var info + + return constructs.tokenize || 'length' in constructs + ? handleListOfConstructs(miniflat(constructs)) + : handleMapOfConstructs + + function handleMapOfConstructs(code) { + if (code in constructs || codes.eof in constructs) { + return handleListOfConstructs( + constructs.null + ? /* c8 ignore next */ + miniflat(constructs[code]).concat(miniflat(constructs.null)) + : constructs[code] + )(code) + } + + return bogusState(code) + } + + function handleListOfConstructs(list) { + listOfConstructs = list + constructIndex = 0 + return handleConstruct(list[constructIndex]) + } + + function handleConstruct(construct) { + return start + + function start(code) { + // To do: not nede to store if there is no bogus state, probably? + // Currently doesn’t work because `inspect` in document does a check + // w/o a bogus, which doesn’t make sense. But it does seem to help perf + // by not storing. + info = store() + currentConstruct = construct + + if (!construct.partial) { + context.currentConstruct = construct + } + + if ( + construct.name && + context.parser.constructs.disable.null.indexOf(construct.name) > -1 + ) { + return nok(code) + } + + return construct.tokenize.call( + fields ? assign({}, context, fields) : context, + effects, + ok, + nok + )(code) + } + } + + function ok(code) { + assert.equal(code, expectedCode, 'expected code') + consumed = true + onreturn(currentConstruct, info) + return returnState + } + + function nok(code) { + assert.equal(code, expectedCode, 'expected code') + consumed = true + info.restore() + + if (++constructIndex < listOfConstructs.length) { + return handleConstruct(listOfConstructs[constructIndex]) + } + + return bogusState + } + } + } + + function addResult(construct, from) { + if (construct.resolveAll && resolveAllConstructs.indexOf(construct) < 0) { + resolveAllConstructs.push(construct) + } + + if (construct.resolve) { + chunkedSplice( + context.events, + from, + context.events.length - from, + construct.resolve(context.events.slice(from), context) + ) + } + + if (construct.resolveTo) { + context.events = construct.resolveTo(context.events, context) + } + + assert( + construct.partial || + !context.events.length || + context.events[context.events.length - 1][0] === 'exit', + 'expected last token to end' + ) + } + + function store() { + var startPoint = now() + var startPrevious = context.previous + var startCurrentConstruct = context.currentConstruct + var startEventsIndex = context.events.length + var startStack = Array.from(stack) + + return {restore: restore, from: startEventsIndex} + + function restore() { + point = startPoint + context.previous = startPrevious + context.currentConstruct = startCurrentConstruct + context.events.length = startEventsIndex + stack = startStack + accountForPotentialSkip() + debug('position: restore: `%j`', point) + } + } + + function accountForPotentialSkip() { + if (point.line in columnStart && point.column < 2) { + point.column = columnStart[point.line] + point.offset += columnStart[point.line] - 1 + } + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/miniflat.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/miniflat.js new file mode 100644 index 00000000000000..39c5dd4f6435fc --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/miniflat.js @@ -0,0 +1,11 @@ +'use strict' + +function miniflat(value) { + return value === null || value === undefined + ? [] + : 'length' in value + ? value + : [value] +} + +module.exports = miniflat diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/miniflat.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/miniflat.mjs new file mode 100644 index 00000000000000..7fad196c63931d --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/miniflat.mjs @@ -0,0 +1,9 @@ +export default miniflat + +function miniflat(value) { + return value === null || value === undefined + ? [] + : 'length' in value + ? value + : [value] +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/move-point.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/move-point.js new file mode 100644 index 00000000000000..830807fbba5f73 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/move-point.js @@ -0,0 +1,12 @@ +'use strict' + +// Note! `move` only works inside lines! It’s not possible to move past other +// chunks (replacement characters, tabs, or line endings). +function movePoint(point, offset) { + point.column += offset + point.offset += offset + point._bufferIndex += offset + return point +} + +module.exports = movePoint diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/move-point.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/move-point.mjs new file mode 100644 index 00000000000000..8192df49aa6048 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/move-point.mjs @@ -0,0 +1,10 @@ +export default movePoint + +// Note! `move` only works inside lines! It’s not possible to move past other +// chunks (replacement characters, tabs, or line endings). +function movePoint(point, offset) { + point.column += offset + point.offset += offset + point._bufferIndex += offset + return point +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/normalize-identifier.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/normalize-identifier.js new file mode 100644 index 00000000000000..0d9d7c0e18d7f8 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/normalize-identifier.js @@ -0,0 +1,23 @@ +'use strict' + +var values = require('../character/values.js') + +function normalizeIdentifier(value) { + return ( + value + // Collapse Markdown whitespace. + .replace(/[\t\n\r ]+/g, values.space) + // Trim. + .replace(/^ | $/g, '') + // Some characters are considered “uppercase”, but if their lowercase + // counterpart is uppercased will result in a different uppercase + // character. + // Hence, to get that form, we perform both lower- and uppercase. + // Upper case makes sure keys will not interact with default prototypal + // methods: no object method is uppercase. + .toLowerCase() + .toUpperCase() + ) +} + +module.exports = normalizeIdentifier diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/normalize-identifier.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/normalize-identifier.mjs new file mode 100644 index 00000000000000..2a383ae1156464 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/normalize-identifier.mjs @@ -0,0 +1,21 @@ +export default normalizeIdentifier + +import values from '../character/values.mjs' + +function normalizeIdentifier(value) { + return ( + value + // Collapse Markdown whitespace. + .replace(/[\t\n\r ]+/g, values.space) + // Trim. + .replace(/^ | $/g, '') + // Some characters are considered “uppercase”, but if their lowercase + // counterpart is uppercased will result in a different uppercase + // character. + // Hence, to get that form, we perform both lower- and uppercase. + // Upper case makes sure keys will not interact with default prototypal + // methods: no object method is uppercase. + .toLowerCase() + .toUpperCase() + ) +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/normalize-uri.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/normalize-uri.js new file mode 100644 index 00000000000000..e4a07c1df66bba --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/normalize-uri.js @@ -0,0 +1,70 @@ +'use strict' + +var asciiAlphanumeric = require('../character/ascii-alphanumeric.js') +var codes = require('../character/codes.js') +var values = require('../character/values.js') +var fromCharCode = require('../constant/from-char-code.js') + +// Encode unsafe characters with percent-encoding, skipping already +// encoded sequences. +function normalizeUri(value) { + var index = -1 + var result = [] + var start = 0 + var skip = 0 + var code + var next + var replace + + while (++index < value.length) { + code = value.charCodeAt(index) + + // A correct percent encoded value. + if ( + code === codes.percentSign && + asciiAlphanumeric(value.charCodeAt(index + 1)) && + asciiAlphanumeric(value.charCodeAt(index + 2)) + ) { + skip = 2 + } + // ASCII. + else if (code < 128) { + if (!/[!#$&-;=?-Z_a-z~]/.test(fromCharCode(code))) { + replace = fromCharCode(code) + } + } + // Astral. + else if (code > 55295 && code < 57344) { + next = value.charCodeAt(index + 1) + + // A correct surrogate pair. + if (code < 56320 && next > 56319 && next < 57344) { + replace = fromCharCode(code, next) + skip = 1 + } + // Lone surrogate. + else { + replace = values.replacementCharacter + } + } + // Unicode. + else { + replace = fromCharCode(code) + } + + if (replace) { + result.push(value.slice(start, index), encodeURIComponent(replace)) + start = index + skip + 1 + replace = undefined + } + + if (skip) { + index += skip + skip = 0 + } + } + + return result.join('') + value.slice(start) +} + +module.exports = normalizeUri diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/normalize-uri.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/normalize-uri.mjs new file mode 100644 index 00000000000000..3102243354dab5 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/normalize-uri.mjs @@ -0,0 +1,68 @@ +export default normalizeUri + +import asciiAlphanumeric from '../character/ascii-alphanumeric.mjs' +import codes from '../character/codes.mjs' +import values from '../character/values.mjs' +import fromCharCode from '../constant/from-char-code.mjs' + +// Encode unsafe characters with percent-encoding, skipping already +// encoded sequences. +function normalizeUri(value) { + var index = -1 + var result = [] + var start = 0 + var skip = 0 + var code + var next + var replace + + while (++index < value.length) { + code = value.charCodeAt(index) + + // A correct percent encoded value. + if ( + code === codes.percentSign && + asciiAlphanumeric(value.charCodeAt(index + 1)) && + asciiAlphanumeric(value.charCodeAt(index + 2)) + ) { + skip = 2 + } + // ASCII. + else if (code < 128) { + if (!/[!#$&-;=?-Z_a-z~]/.test(fromCharCode(code))) { + replace = fromCharCode(code) + } + } + // Astral. + else if (code > 55295 && code < 57344) { + next = value.charCodeAt(index + 1) + + // A correct surrogate pair. + if (code < 56320 && next > 56319 && next < 57344) { + replace = fromCharCode(code, next) + skip = 1 + } + // Lone surrogate. + else { + replace = values.replacementCharacter + } + } + // Unicode. + else { + replace = fromCharCode(code) + } + + if (replace) { + result.push(value.slice(start, index), encodeURIComponent(replace)) + start = index + skip + 1 + replace = undefined + } + + if (skip) { + index += skip + skip = 0 + } + } + + return result.join('') + value.slice(start) +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/prefix-size.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/prefix-size.js new file mode 100644 index 00000000000000..a560e3e83a9215 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/prefix-size.js @@ -0,0 +1,11 @@ +'use strict' + +var sizeChunks = require('./size-chunks.js') + +function prefixSize(events, type) { + var tail = events[events.length - 1] + if (!tail || tail[1].type !== type) return 0 + return sizeChunks(tail[2].sliceStream(tail[1])) +} + +module.exports = prefixSize diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/prefix-size.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/prefix-size.mjs new file mode 100644 index 00000000000000..473e18a29c22d2 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/prefix-size.mjs @@ -0,0 +1,9 @@ +export default prefixSize + +import sizeChunks from './size-chunks.mjs' + +function prefixSize(events, type) { + var tail = events[events.length - 1] + if (!tail || tail[1].type !== type) return 0 + return sizeChunks(tail[2].sliceStream(tail[1])) +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/regex-check.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/regex-check.js new file mode 100644 index 00000000000000..895772e67d9219 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/regex-check.js @@ -0,0 +1,12 @@ +'use strict' + +var fromCharCode = require('../constant/from-char-code.js') + +function regexCheck(regex) { + return check + function check(code) { + return regex.test(fromCharCode(code)) + } +} + +module.exports = regexCheck diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/regex-check.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/regex-check.mjs new file mode 100644 index 00000000000000..f4bc0fd61ab00a --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/regex-check.mjs @@ -0,0 +1,10 @@ +export default regexCheck + +import fromCharCode from '../constant/from-char-code.mjs' + +function regexCheck(regex) { + return check + function check(code) { + return regex.test(fromCharCode(code)) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/resolve-all.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/resolve-all.js new file mode 100644 index 00000000000000..3e8d76b4a460a2 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/resolve-all.js @@ -0,0 +1,20 @@ +'use strict' + +function resolveAll(constructs, events, context) { + var called = [] + var index = -1 + var resolve + + while (++index < constructs.length) { + resolve = constructs[index].resolveAll + + if (resolve && called.indexOf(resolve) < 0) { + events = resolve(events, context) + called.push(resolve) + } + } + + return events +} + +module.exports = resolveAll diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/resolve-all.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/resolve-all.mjs new file mode 100644 index 00000000000000..1a70eebe9bef2f --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/resolve-all.mjs @@ -0,0 +1,18 @@ +export default resolveAll + +function resolveAll(constructs, events, context) { + var called = [] + var index = -1 + var resolve + + while (++index < constructs.length) { + resolve = constructs[index].resolveAll + + if (resolve && called.indexOf(resolve) < 0) { + events = resolve(events, context) + called.push(resolve) + } + } + + return events +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/safe-from-int.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/safe-from-int.js new file mode 100644 index 00000000000000..e5e642892abb1c --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/safe-from-int.js @@ -0,0 +1,32 @@ +'use strict' + +var codes = require('../character/codes.js') +var values = require('../character/values.js') +var fromCharCode = require('../constant/from-char-code.js') + +function safeFromInt(value, base) { + var code = parseInt(value, base) + + if ( + // C0 except for HT, LF, FF, CR, space + code < codes.ht || + code === codes.vt || + (code > codes.cr && code < codes.space) || + // Control character (DEL) of the basic block and C1 controls. + (code > codes.tilde && code < 160) || + // Lone high surrogates and low surrogates. + (code > 55295 && code < 57344) || + // Noncharacters. + (code > 64975 && code < 65008) || + (code & 65535) === 65535 || + (code & 65535) === 65534 || + // Out of range + code > 1114111 + ) { + return values.replacementCharacter + } + + return fromCharCode(code) +} + +module.exports = safeFromInt diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/safe-from-int.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/safe-from-int.mjs new file mode 100644 index 00000000000000..e218d4715685b8 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/safe-from-int.mjs @@ -0,0 +1,30 @@ +export default safeFromInt + +import codes from '../character/codes.mjs' +import values from '../character/values.mjs' +import fromCharCode from '../constant/from-char-code.mjs' + +function safeFromInt(value, base) { + var code = parseInt(value, base) + + if ( + // C0 except for HT, LF, FF, CR, space + code < codes.ht || + code === codes.vt || + (code > codes.cr && code < codes.space) || + // Control character (DEL) of the basic block and C1 controls. + (code > codes.tilde && code < 160) || + // Lone high surrogates and low surrogates. + (code > 55295 && code < 57344) || + // Noncharacters. + (code > 64975 && code < 65008) || + (code & 65535) === 65535 || + (code & 65535) === 65534 || + // Out of range + code > 1114111 + ) { + return values.replacementCharacter + } + + return fromCharCode(code) +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/serialize-chunks.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/serialize-chunks.js new file mode 100644 index 00000000000000..4d01d915561ee5 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/serialize-chunks.js @@ -0,0 +1,54 @@ +'use strict' + +var assert = require('assert') +var codes = require('../character/codes.js') +var values = require('../character/values.js') +var fromCharCode = require('../constant/from-char-code.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +function serializeChunks(chunks) { + var index = -1 + var result = [] + var chunk + var value + var atTab + + while (++index < chunks.length) { + chunk = chunks[index] + + if (typeof chunk === 'string') { + value = chunk + } else if (chunk === codes.carriageReturn) { + value = values.cr + } else if (chunk === codes.lineFeed) { + value = values.lf + } else if (chunk === codes.carriageReturnLineFeed) { + value = values.cr + values.lf + } else if (chunk === codes.horizontalTab) { + value = values.ht + } else if (chunk === codes.virtualSpace) { + if (atTab) continue + value = values.space + } else { + assert__default['default'].equal( + typeof chunk, + 'number', + 'expected number' + ) + // Currently only replacement character. + value = fromCharCode(chunk) + } + + atTab = chunk === codes.horizontalTab + result.push(value) + } + + return result.join('') +} + +module.exports = serializeChunks diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/serialize-chunks.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/serialize-chunks.mjs new file mode 100644 index 00000000000000..42ab3a9a6b3ad6 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/serialize-chunks.mjs @@ -0,0 +1,42 @@ +export default serializeChunks + +import assert from 'assert' +import codes from '../character/codes.mjs' +import values from '../character/values.mjs' +import fromCharCode from '../constant/from-char-code.mjs' + +function serializeChunks(chunks) { + var index = -1 + var result = [] + var chunk + var value + var atTab + + while (++index < chunks.length) { + chunk = chunks[index] + + if (typeof chunk === 'string') { + value = chunk + } else if (chunk === codes.carriageReturn) { + value = values.cr + } else if (chunk === codes.lineFeed) { + value = values.lf + } else if (chunk === codes.carriageReturnLineFeed) { + value = values.cr + values.lf + } else if (chunk === codes.horizontalTab) { + value = values.ht + } else if (chunk === codes.virtualSpace) { + if (atTab) continue + value = values.space + } else { + assert.equal(typeof chunk, 'number', 'expected number') + // Currently only replacement character. + value = fromCharCode(chunk) + } + + atTab = chunk === codes.horizontalTab + result.push(value) + } + + return result.join('') +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/shallow.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/shallow.js new file mode 100644 index 00000000000000..f980ab99e4c090 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/shallow.js @@ -0,0 +1,9 @@ +'use strict' + +var assign = require('../constant/assign.js') + +function shallow(object) { + return assign({}, object) +} + +module.exports = shallow diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/shallow.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/shallow.mjs new file mode 100644 index 00000000000000..e121ccaa4a1095 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/shallow.mjs @@ -0,0 +1,7 @@ +export default shallow + +import assign from '../constant/assign.mjs' + +function shallow(object) { + return assign({}, object) +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/size-chunks.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/size-chunks.js new file mode 100644 index 00000000000000..6b2f5ec792e12a --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/size-chunks.js @@ -0,0 +1,16 @@ +'use strict' + +// Measure the number of character codes in chunks. +// Counts tabs based on their expanded size, and CR+LF as one character. +function sizeChunks(chunks) { + var index = -1 + var size = 0 + + while (++index < chunks.length) { + size += typeof chunks[index] === 'string' ? chunks[index].length : 1 + } + + return size +} + +module.exports = sizeChunks diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/size-chunks.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/size-chunks.mjs new file mode 100644 index 00000000000000..d3305bbb61b8c3 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/size-chunks.mjs @@ -0,0 +1,14 @@ +export default sizeChunks + +// Measure the number of character codes in chunks. +// Counts tabs based on their expanded size, and CR+LF as one character. +function sizeChunks(chunks) { + var index = -1 + var size = 0 + + while (++index < chunks.length) { + size += typeof chunks[index] === 'string' ? chunks[index].length : 1 + } + + return size +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/slice-chunks.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/slice-chunks.js new file mode 100644 index 00000000000000..b52c8dcc9ee186 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/slice-chunks.js @@ -0,0 +1,43 @@ +'use strict' + +var assert = require('assert') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +function sliceChunks(chunks, token) { + var startIndex = token.start._index + var startBufferIndex = token.start._bufferIndex + var endIndex = token.end._index + var endBufferIndex = token.end._bufferIndex + var view + + if (startIndex === endIndex) { + assert__default['default']( + endBufferIndex > -1, + 'expected non-negative end buffer index' + ) + assert__default['default']( + startBufferIndex > -1, + 'expected non-negative start buffer index' + ) + view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)] + } else { + view = chunks.slice(startIndex, endIndex) + + if (startBufferIndex > -1) { + view[0] = view[0].slice(startBufferIndex) + } + + if (endBufferIndex > 0) { + view.push(chunks[endIndex].slice(0, endBufferIndex)) + } + } + + return view +} + +module.exports = sliceChunks diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/slice-chunks.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/slice-chunks.mjs new file mode 100644 index 00000000000000..987bbe1db526d9 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/slice-chunks.mjs @@ -0,0 +1,29 @@ +export default sliceChunks + +import assert from 'assert' + +function sliceChunks(chunks, token) { + var startIndex = token.start._index + var startBufferIndex = token.start._bufferIndex + var endIndex = token.end._index + var endBufferIndex = token.end._bufferIndex + var view + + if (startIndex === endIndex) { + assert(endBufferIndex > -1, 'expected non-negative end buffer index') + assert(startBufferIndex > -1, 'expected non-negative start buffer index') + view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)] + } else { + view = chunks.slice(startIndex, endIndex) + + if (startBufferIndex > -1) { + view[0] = view[0].slice(startBufferIndex) + } + + if (endBufferIndex > 0) { + view.push(chunks[endIndex].slice(0, endBufferIndex)) + } + } + + return view +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/subtokenize.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/subtokenize.js new file mode 100644 index 00000000000000..9e7648c00fe79f --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/subtokenize.js @@ -0,0 +1,219 @@ +'use strict' + +var assert = require('assert') +var codes = require('../character/codes.js') +var assign = require('../constant/assign.js') +var types = require('../constant/types.js') +var chunkedSplice = require('./chunked-splice.js') +var shallow = require('./shallow.js') + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert) + +function subtokenize(events) { + var jumps = {} + var index = -1 + var event + var lineIndex + var otherIndex + var otherEvent + var parameters + var subevents + var more + + while (++index < events.length) { + while (index in jumps) { + index = jumps[index] + } + + event = events[index] + + // Add a hook for the GFM tasklist extension, which needs to know if text + // is in the first content of a list item. + if ( + index && + event[1].type === types.chunkFlow && + events[index - 1][1].type === types.listItemPrefix + ) { + subevents = event[1]._tokenizer.events + otherIndex = 0 + + if ( + otherIndex < subevents.length && + subevents[otherIndex][1].type === types.lineEndingBlank + ) { + otherIndex += 2 + } + + if ( + otherIndex < subevents.length && + subevents[otherIndex][1].type === types.content + ) { + while (++otherIndex < subevents.length) { + if (subevents[otherIndex][1].type === types.content) { + break + } + + if (subevents[otherIndex][1].type === types.chunkText) { + subevents[otherIndex][1].isInFirstContentOfListItem = true + otherIndex++ + } + } + } + } + + // Enter. + if (event[0] === 'enter') { + if (event[1].contentType) { + assign(jumps, subcontent(events, index)) + index = jumps[index] + more = true + } + } + // Exit. + else if (event[1]._container || event[1]._movePreviousLineEndings) { + otherIndex = index + lineIndex = undefined + + while (otherIndex--) { + otherEvent = events[otherIndex] + + if ( + otherEvent[1].type === types.lineEnding || + otherEvent[1].type === types.lineEndingBlank + ) { + if (otherEvent[0] === 'enter') { + if (lineIndex) { + events[lineIndex][1].type = types.lineEndingBlank + } + + otherEvent[1].type = types.lineEnding + lineIndex = otherIndex + } + } else { + break + } + } + + if (lineIndex) { + // Fix position. + event[1].end = shallow(events[lineIndex][1].start) + + // Switch container exit w/ line endings. + parameters = events.slice(lineIndex, index) + parameters.unshift(event) + chunkedSplice(events, lineIndex, index - lineIndex + 1, parameters) + } + } + } + + return !more +} + +function subcontent(events, eventIndex) { + var token = events[eventIndex][1] + var context = events[eventIndex][2] + var startPosition = eventIndex - 1 + var startPositions = [] + var tokenizer = + token._tokenizer || context.parser[token.contentType](token.start) + var childEvents = tokenizer.events + var jumps = [] + var gaps = {} + var stream + var previous + var index + var entered + var end + var adjust + + // Loop forward through the linked tokens to pass them in order to the + // subtokenizer. + while (token) { + // Find the position of the event for this token. + while (events[++startPosition][1] !== token) { + // Empty. + } + + startPositions.push(startPosition) + + if (!token._tokenizer) { + stream = context.sliceStream(token) + + if (!token.next) { + stream.push(codes.eof) + } + + if (previous) { + tokenizer.defineSkip(token.start) + } + + if (token.isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = true + } + + tokenizer.write(stream) + + if (token.isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = undefined + } + } + + // Unravel the next token. + previous = token + token = token.next + } + + // Now, loop back through all events (and linked tokens), to figure out which + // parts belong where. + token = previous + index = childEvents.length + + while (index--) { + // Make sure we’ve at least seen something (final eol is part of the last + // token). + if (childEvents[index][0] === 'enter') { + entered = true + } else if ( + // Find a void token that includes a break. + entered && + childEvents[index][1].type === childEvents[index - 1][1].type && + childEvents[index][1].start.line !== childEvents[index][1].end.line + ) { + add(childEvents.slice(index + 1, end)) + assert__default['default'](token.previous, 'expected a previous token') + // Help GC. + token._tokenizer = token.next = undefined + token = token.previous + end = index + 1 + } + } + + assert__default['default'](!token.previous, 'expected no previous token') + // Help GC. + tokenizer.events = token._tokenizer = token.next = undefined + + // Do head: + add(childEvents.slice(0, end)) + + index = -1 + adjust = 0 + + while (++index < jumps.length) { + gaps[adjust + jumps[index][0]] = adjust + jumps[index][1] + adjust += jumps[index][1] - jumps[index][0] - 1 + } + + return gaps + + function add(slice) { + var start = startPositions.pop() + jumps.unshift([start, start + slice.length - 1]) + chunkedSplice(events, start, 2, slice) + } +} + +module.exports = subtokenize diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/subtokenize.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/subtokenize.mjs new file mode 100644 index 00000000000000..7844130de419d2 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/lib/util/subtokenize.mjs @@ -0,0 +1,211 @@ +export default subtokenize + +import assert from 'assert' +import codes from '../character/codes.mjs' +import assign from '../constant/assign.mjs' +import types from '../constant/types.mjs' +import chunkedSplice from './chunked-splice.mjs' +import shallow from './shallow.mjs' + +function subtokenize(events) { + var jumps = {} + var index = -1 + var event + var lineIndex + var otherIndex + var otherEvent + var parameters + var subevents + var more + + while (++index < events.length) { + while (index in jumps) { + index = jumps[index] + } + + event = events[index] + + // Add a hook for the GFM tasklist extension, which needs to know if text + // is in the first content of a list item. + if ( + index && + event[1].type === types.chunkFlow && + events[index - 1][1].type === types.listItemPrefix + ) { + subevents = event[1]._tokenizer.events + otherIndex = 0 + + if ( + otherIndex < subevents.length && + subevents[otherIndex][1].type === types.lineEndingBlank + ) { + otherIndex += 2 + } + + if ( + otherIndex < subevents.length && + subevents[otherIndex][1].type === types.content + ) { + while (++otherIndex < subevents.length) { + if (subevents[otherIndex][1].type === types.content) { + break + } + + if (subevents[otherIndex][1].type === types.chunkText) { + subevents[otherIndex][1].isInFirstContentOfListItem = true + otherIndex++ + } + } + } + } + + // Enter. + if (event[0] === 'enter') { + if (event[1].contentType) { + assign(jumps, subcontent(events, index)) + index = jumps[index] + more = true + } + } + // Exit. + else if (event[1]._container || event[1]._movePreviousLineEndings) { + otherIndex = index + lineIndex = undefined + + while (otherIndex--) { + otherEvent = events[otherIndex] + + if ( + otherEvent[1].type === types.lineEnding || + otherEvent[1].type === types.lineEndingBlank + ) { + if (otherEvent[0] === 'enter') { + if (lineIndex) { + events[lineIndex][1].type = types.lineEndingBlank + } + + otherEvent[1].type = types.lineEnding + lineIndex = otherIndex + } + } else { + break + } + } + + if (lineIndex) { + // Fix position. + event[1].end = shallow(events[lineIndex][1].start) + + // Switch container exit w/ line endings. + parameters = events.slice(lineIndex, index) + parameters.unshift(event) + chunkedSplice(events, lineIndex, index - lineIndex + 1, parameters) + } + } + } + + return !more +} + +function subcontent(events, eventIndex) { + var token = events[eventIndex][1] + var context = events[eventIndex][2] + var startPosition = eventIndex - 1 + var startPositions = [] + var tokenizer = + token._tokenizer || context.parser[token.contentType](token.start) + var childEvents = tokenizer.events + var jumps = [] + var gaps = {} + var stream + var previous + var index + var entered + var end + var adjust + + // Loop forward through the linked tokens to pass them in order to the + // subtokenizer. + while (token) { + // Find the position of the event for this token. + while (events[++startPosition][1] !== token) { + // Empty. + } + + startPositions.push(startPosition) + + if (!token._tokenizer) { + stream = context.sliceStream(token) + + if (!token.next) { + stream.push(codes.eof) + } + + if (previous) { + tokenizer.defineSkip(token.start) + } + + if (token.isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = true + } + + tokenizer.write(stream) + + if (token.isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = undefined + } + } + + // Unravel the next token. + previous = token + token = token.next + } + + // Now, loop back through all events (and linked tokens), to figure out which + // parts belong where. + token = previous + index = childEvents.length + + while (index--) { + // Make sure we’ve at least seen something (final eol is part of the last + // token). + if (childEvents[index][0] === 'enter') { + entered = true + } else if ( + // Find a void token that includes a break. + entered && + childEvents[index][1].type === childEvents[index - 1][1].type && + childEvents[index][1].start.line !== childEvents[index][1].end.line + ) { + add(childEvents.slice(index + 1, end)) + assert(token.previous, 'expected a previous token') + // Help GC. + token._tokenizer = token.next = undefined + token = token.previous + end = index + 1 + } + } + + assert(!token.previous, 'expected no previous token') + // Help GC. + tokenizer.events = token._tokenizer = token.next = undefined + + // Do head: + add(childEvents.slice(0, end)) + + index = -1 + adjust = 0 + + while (++index < jumps.length) { + gaps[adjust + jumps[index][0]] = adjust + jumps[index][1] + adjust += jumps[index][1] - jumps[index][0] - 1 + } + + return gaps + + function add(slice) { + var start = startPositions.pop() + jumps.unshift([start, start + slice.length - 1]) + chunkedSplice(events, start, 2, slice) + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/markdown-escapes/license b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/license similarity index 94% rename from tools/node_modules/eslint-plugin-markdown/node_modules/markdown-escapes/license rename to tools/node_modules/eslint-plugin-markdown/node_modules/micromark/license index 8d8660d36ef2ec..39372356c47d0f 100644 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/markdown-escapes/license +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/license @@ -1,6 +1,6 @@ (The MIT License) -Copyright (c) 2016 Titus Wormer +Copyright (c) 2020 Titus Wormer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/package.json new file mode 100644 index 00000000000000..b1b3941c2d1cd0 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/package.json @@ -0,0 +1,208 @@ +{ + "name": "micromark", + "version": "2.11.4", + "description": "small commonmark compliant markdown parser with positional info and concrete tokens", + "license": "MIT", + "keywords": [ + "commonmark", + "compiler", + "gfm", + "html", + "lexer", + "markdown", + "markup", + "md", + "unified", + "parse", + "parser", + "plugin", + "process", + "remark", + "render", + "renderer", + "token", + "tokenizer" + ], + "repository": "micromark/micromark", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)", + "Bogdan Chadkin ", + "Christian Murphy ", + "Marouane Fazouane ", + "John Otander (https://johno.com)", + "Stephan Schneider ", + "Victor Felder (https://draft.li)", + "Mudit Ameta (https://mudit.xyz)", + "Merlijn Vos " + ], + "files": [ + "dist/", + "lib/", + "buffer.d.ts", + "buffer.js", + "buffer.mjs", + "index.js", + "index.mjs", + "index.d.ts", + "stream.d.ts", + "stream.js", + "stream.mjs" + ], + "main": "./index.js", + "types": "index.d.ts", + "dependencies": { + "debug": "^4.0.0", + "parse-entities": "^2.0.0" + }, + "devDependencies": { + "@babel/core": "^7.0.0", + "@rollup/plugin-babel": "^5.0.0", + "@rollup/plugin-commonjs": "^17.0.0", + "@rollup/plugin-node-resolve": "^11.0.0", + "@types/events": "^3.0.0", + "@unicode/unicode-13.0.0": "^1.0.0", + "babel-plugin-inline-constants": "^1.0.0", + "babel-plugin-unassert": "^3.0.0", + "babel-plugin-undebug": "^1.0.0", + "c8": "^7.0.0", + "character-entities": "^1.0.0", + "commonmark.json": "^0.29.0", + "concat-stream": "^2.0.0", + "cross-env": "^7.0.0", + "dtslint": "^4.0.0", + "eslint-plugin-es": "^4.0.0", + "eslint-plugin-security": "^1.0.0", + "esm": "^3.0.0", + "glob": "^7.0.0", + "gzip-size-cli": "^4.0.0", + "jsfuzz": "1.0.14", + "ms": "^2.0.0", + "patch-package": "^6.0.0", + "prettier": "^2.0.0", + "regenerate": "^1.0.0", + "remark-cli": "^9.0.0", + "remark-preset-wooorm": "^8.0.0", + "resolve-from": "^5.0.0", + "rollup": "^2.0.0", + "rollup-plugin-terser": "^7.0.0", + "tape": "^5.0.0", + "xo": "^0.37.0" + }, + "scripts": { + "generate-lib-types": "node --experimental-modules script/generate-constant-typings.mjs", + "generate-lib-expressions": "node --experimental-modules script/generate-expressions.mjs", + "generate-lib-cjs": "rollup -c --silent", + "generate-lib": "npm run generate-lib-types && npm run generate-lib-expressions && npm run generate-lib-cjs", + "generate-dist-types": "node --experimental-modules script/copy-dict.mjs", + "generate-dist-js": "cross-env BUILD=dist rollup -c --silent", + "generate-dist": "npm run generate-dist-types && npm run generate-dist-js", + "generate-size": "cross-env BUILD=size rollup -c --silent && gzip-size micromark.min.js && gzip-size --raw micromark.min.js", + "generate": "npm run generate-lib && npm run generate-dist && npm run generate-size", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "pretest-fuzz": "patch-package --patch-dir script/patches && node script/generate-fixtures.mjs", + "test-fuzz": "cross-env NODE_OPTIONS=\"-r esm\" timeout 15m jsfuzz test/fuzz.js test/fixtures", + "test-api": "node --experimental-modules test/index.mjs", + "test-coverage": "c8 --check-coverage --lines 100 --functions 100 --branches 100 --reporter lcov node --experimental-modules test/index.mjs", + "test-types": "dtslint .", + "test": "npm run generate && npm run format && npm run test-coverage && npm run test-types" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "esnext": false, + "extensions": [ + "mjs" + ], + "prettier": true, + "envs": [ + "shared-node-browser" + ], + "rules": { + "import/extensions": [ + "error", + "always" + ] + }, + "overrides": [ + { + "files": [ + "lib/**/*.{js,mjs}" + ], + "plugin": [ + "es" + ], + "extends": [ + "plugin:es/no-new-in-es2015", + "plugin:security/recommended" + ], + "rules": { + "complexity": "off", + "es/no-array-from": "off", + "es/no-object-assign": "off", + "es/no-modules": "off", + "import/no-mutable-exports": "off", + "import/no-anonymous-default-export": "off", + "guard-for-in": "off", + "max-depth": "off", + "no-multi-assign": "off", + "no-unmodified-loop-condition": "off", + "security/detect-object-injection": "off", + "unicorn/explicit-length-check": "off", + "unicorn/prefer-includes": "off", + "unicorn/prefer-number-properties": "off" + } + }, + { + "files": [ + "**/*.d.ts" + ], + "rules": { + "import/extensions": [ + "error", + "never" + ] + } + }, + { + "files": [ + "test/**/*.{js,mjs}" + ], + "rules": { + "import/no-unassigned-import": "off" + } + } + ], + "ignores": [ + "dist/", + "lib/**/*.js", + "micromark.test.ts" + ] + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm", + [ + "lint-no-html", + false + ] + ] + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/readme.md new file mode 100644 index 00000000000000..db7931df812739 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/readme.md @@ -0,0 +1,737 @@ +

    + micromark +

    + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +The smallest CommonMark compliant markdown parser with positional info and +concrete tokens. + +* [x] **[compliant][commonmark]** (100% to CommonMark) +* [x] **[extensions][]** ([GFM][], [directives][], [footnotes][], + [frontmatter][], [math][], [MDX.js][mdxjs]) +* [x] **[safe][security]** (by default) +* [x] **[small][size]** (smallest CM parser that exists) +* [x] **[robust][test]** (1800+ tests, 100% coverage, fuzz testing) + +## Intro + +micromark is a long awaited markdown parser. +It uses a [state machine][cmsm] to parse the entirety of markdown into concrete +tokens. +It’s the smallest 100% [CommonMark][] compliant markdown parser in JavaScript. +It was made to replace the internals of [`remark-parse`][remark-parse], the most +[popular][] markdown parser. +Its API compiles to HTML, but its parts are made to be used separately, so as to +generate syntax trees ([`mdast-util-from-markdown`][from-markdown]) or compile +to other output formats. +It’s in open beta: up next are [CMSM][] and CSTs. + +* for updates, see [Twitter][] +* for more about us, see [`unifiedjs.com`][site] +* for questions, see [Discussions][chat] +* to help, see [contribute][] or [sponsor][] below + +## Contents + +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`micromark(doc[, encoding][, options])`](#micromarkdoc-encoding-options) + * [`micromarkStream(options?)`](#micromarkstreamoptions) +* [Extensions](#extensions) + * [`SyntaxExtension`](#syntaxextension) + * [`HtmlExtension`](#htmlextension) + * [List of extensions](#list-of-extensions) +* [Syntax tree](#syntax-tree) +* [CommonMark](#commonmark) +* [Grammar](#grammar) +* [Test](#test) +* [Size & debug](#size--debug) +* [Comparison](#comparison) +* [Version](#version) +* [Security](#security) +* [Contribute](#contribute) +* [Sponsor](#sponsor) +* [Origin story](#origin-story) +* [License](#license) + +## Install + +[npm][]: + +```sh +npm install micromark +``` + +## Use + +Typical use (buffering): + +```js +var micromark = require('micromark') + +console.log(micromark('## Hello, *world*!')) +``` + +Yields: + +```html +

    Hello, world!

    +``` + +The same can be done with ESM (in Node 10+, browsers that support it, or with a +bundler), in an `example.mjs` file, like so: + +```js +import micromark from 'micromark' + +console.log(micromark('## Hello, *world*!')) +``` + +You can pass extensions (in this case [`micromark-extension-gfm`][gfm]): + +```js +var micromark = require('micromark') +var gfmSyntax = require('micromark-extension-gfm') +var gfmHtml = require('micromark-extension-gfm/html') + +var doc = '* [x] contact@example.com ~~strikethrough~~' + +var result = micromark(doc, { + extensions: [gfmSyntax()], + htmlExtensions: [gfmHtml] +}) + +console.log(result) +``` + +Yields: + +```html + +``` + +Streaming interface: + +```js +var fs = require('fs') +var micromarkStream = require('micromark/stream') + +fs.createReadStream('example.md') + .on('error', handleError) + .pipe(micromarkStream()) + .pipe(process.stdout) + +function handleError(err) { + // Handle your error here! + throw err +} +``` + +## API + +This section documents the API. +The parts can be used separately, but this isn’t documented yet. + +### `micromark(doc[, encoding][, options])` + +Compile markdown to HTML. + +##### Parameters + +###### `doc` + +Markdown to parse (`string` or `Buffer`) + +###### `encoding` + +[Character encoding][encoding] to understand `doc` as when it’s a +[`Buffer`][buffer] (`string`, default: `'utf8'`). + +###### `options.defaultLineEnding` + +Value to use for line endings not in `doc` (`string`, default: first line +ending or `'\n'`). + +Generally, micromark copies line endings (`'\r'`, `'\n'`, `'\r\n'`) in the +markdown document over to the compiled HTML. +In some cases, such as `> a`, CommonMark requires that extra line endings are +added: `
    \n

    a

    \n
    `. + +###### `options.allowDangerousHtml` + +Whether to allow embedded HTML (`boolean`, default: `false`). + +###### `options.allowDangerousProtocol` + +Whether to allow potentially dangerous protocols in links and images (`boolean`, +default: `false`). +URLs relative to the current protocol are always allowed (such as, `image.jpg`). +For links, the allowed protocols are `http`, `https`, `irc`, `ircs`, `mailto`, +and `xmpp`. +For images, the allowed protocols are `http` and `https`. + +###### `options.extensions` + +Array of syntax extensions ([`Array.`][syntax-extension], +default: `[]`). + +###### `options.htmlExtensions` + +Array of HTML extensions ([`Array.`][html-extension], default: +`[]`). + +##### Returns + +`string` — Compiled HTML. + +### `micromarkStream(options?)` + +Streaming interface of micromark. +Compiles markdown to HTML. +`options` are the same as the buffering API above. +Available at `require('micromark/stream')`. +Note that some of the work to parse markdown can be done streaming, but in the +end buffering is required. + +micromark does not handle errors for you, so you must handle errors on whatever +streams you pipe into it. +As markdown does not know errors, `micromark` itself does not emit errors. + +## Extensions + +There are two types of extensions for micromark: +[`SyntaxExtension`][syntax-extension] and [`HtmlExtension`][html-extension]. +They can be passed in [`extensions`][option-extensions] or +[`htmlExtensions`][option-htmlextensions], respectively. + +### `SyntaxExtension` + +A syntax extension is an object whose fields are the names of hooks, referring +to where constructs “hook” into. +`content` (a block of, well, content: definitions and paragraphs), `document` +(containers such as block quotes and lists), `flow` (block constructs such as +ATX and setext headings, HTML, indented and fenced code, thematic breaks), +`string` (things that work in a few places such as destinations, fenced code +info, etc: character escapes and -references), or `text` (rich inline text: +autolinks, character escapes and -references, code, hard breaks, HTML, images, +links, emphasis, strong). + +The fields at such objects are character codes, mapping to constructs as values. +The built in [constructs][] are an extension. +See it and the [existing extensions][extensions] for inspiration. + +### `HtmlExtension` + +An HTML extension is an object whose fields are either `enter` or `exit` +(reflecting whether a token is entered or exited). +The values at such objects are names of tokens mapping to handlers. +See the [existing extensions][extensions] for inspiration. + +### List of extensions + +* [`micromark/micromark-extension-directive`][directives] + — support directives (generic extensions) +* [`micromark/micromark-extension-footnote`][footnotes] + — support footnotes +* [`micromark/micromark-extension-frontmatter`][frontmatter] + — support frontmatter (YAML, TOML, etc) +* [`micromark/micromark-extension-gfm`][gfm] + — support GFM (GitHub Flavored Markdown) +* [`micromark/micromark-extension-gfm-autolink-literal`](https://github.com/micromark/micromark-extension-gfm-autolink-literal) + — support GFM autolink literals +* [`micromark/micromark-extension-gfm-strikethrough`](https://github.com/micromark/micromark-extension-gfm-strikethrough) + — support GFM strikethrough +* [`micromark/micromark-extension-gfm-table`](https://github.com/micromark/micromark-extension-gfm-table) + — support GFM tables +* [`micromark/micromark-extension-gfm-tagfilter`](https://github.com/micromark/micromark-extension-gfm-tagfilter) + — support GFM tagfilter +* [`micromark/micromark-extension-gfm-task-list-item`](https://github.com/micromark/micromark-extension-gfm-task-list-item) + — support GFM tasklists +* [`micromark/micromark-extension-math`][math] + — support math +* [`micromark/micromark-extension-mdx`](https://github.com/micromark/micromark-extension-mdx) + — support MDX +* [`micromark/micromark-extension-mdxjs`][mdxjs] + — support MDX.js +* [`micromark/micromark-extension-mdx-expression`](https://github.com/micromark/micromark-extension-mdx-expression) + — support MDX (or MDX.js) expressions +* [`micromark/micromark-extension-mdx-jsx`](https://github.com/micromark/micromark-extension-mdx-jsx) + — support MDX (or MDX.js) JSX +* [`micromark/micromark-extension-mdx-md`](https://github.com/micromark/micromark-extension-mdx-md) + — support misc MDX changes +* [`micromark/micromark-extension-mdxjs-esm`](https://github.com/micromark/micromark-extension-mdxjs-esm) + — support MDX.js import/exports + +## Syntax tree + +A higher level project, [`mdast-util-from-markdown`][from-markdown], can give +you an AST. + +```js +var fromMarkdown = require('mdast-util-from-markdown') + +var result = fromMarkdown('## Hello, *world*!') + +console.log(result.children[0]) +``` + +Yields: + +```js +{ + type: 'heading', + depth: 2, + children: [ + {type: 'text', value: 'Hello, ', position: [Object]}, + {type: 'emphasis', children: [Array], position: [Object]}, + {type: 'text', value: '!', position: [Object]} + ], + position: { + start: {line: 1, column: 1, offset: 0}, + end: {line: 1, column: 19, offset: 18} + } +} +``` + +Another level up is [**remark**][remark], which provides a nice interface and +hundreds of plugins. + +## CommonMark + +The first definition of “Markdown” gave several examples of how it worked, +showing input Markdown and output HTML, and came with a reference implementation +(`Markdown.pl`). +When new implementations followed, they mostly followed the first definition, +but deviated from the first implementation, and added extensions, thus making +the format a family of formats. + +Some years later, an attempt was made to standardize the differences between +implementations, by specifying how several edge cases should be handled, through +more input and output examples. +This is known as [CommonMark][commonmark-spec], and many implementations now +work towards some degree of CommonMark compliancy. +Still, CommonMark describes what the output in HTML should be given some +input, which leaves many edge cases up for debate, and does not answer what +should happen for other output formats. + +micromark passes all tests from CommonMark and has many more tests to match the +CommonMark reference parsers. +Finally, it comes with [CMSM][], which describes how to parse markup, instead +of documenting input and output examples. + +## Grammar + +The syntax of markdown can be described in Backus–Naur form (BNF) as: + +```bnf +markdown = .* +``` + +No, that’s not a [typo](http://trevorjim.com/a-specification-for-markdown/): +markdown has no syntax errors; anything thrown at it renders *something*. + +## Test + +micromark is tested with the \~650 CommonMark tests and more than 1.2k extra +tests confirmed with CM reference parsers. +These tests reach all branches in the code, thus this project has 100% coverage. +Finally, we use fuzz testing to ensure micromark is stable, reliable, and +secure. + +To build, format, and test the codebase, use `$ npm test` after clone and +install. +The `$ npm run test-api` and `$ npm run test-coverage` scripts check the unit +tests and their coverage, respectively. +The `$ npm run test-types` script checks TypeScript definitions. + +The `$ npm run test-fuzz` script does fuzz testing for 15 minutes. +The timeout is provided by GNU coreutils **timeout(1)**, which might not be +available on your system. +Either install it or remove it from the script. + +## Size & debug + +micromark is really small. +A ton of time went into making sure it minifies well, by the way code is written +but also through custom build scripts to pre-evaluate certain expressions. +Furthermore, care went into making it compress well with GZip and Brotli. + +Normally, you’ll use the pre-evaluated version of micromark, which is published +in the `dist/` folder and has entries in the root. +While developing or debugging, you can switch to use the source, which is +published in the `lib/` folder, and comes instrumented with assertions and debug +messages. +To see debug messages, run your script with a `DEBUG` env variable, such as with +`DEBUG="micromark" node script.js`. + +To generate the codebase, use `$ npm run generate` after clone and install. +The `$ npm run generate-dist` script specifically takes `lib/` and generates +`dist/`. +The `$ npm run generate-size` script checks the bundle size of `dist/`. + +## Comparison + +There are many other markdown parsers out there, and maybe they’re better suited +to your use case! +Here is a short comparison of a couple of ’em in JavaScript. +Note that this list is made by the folks who make `micromark` and `remark`, so +there is some bias. + +**Note**: these are, in fact, not really comparable: micromark (and remark) +focus on completely different things than other markdown parsers do. +Sure, you can generate HTML from markdown with them, but micromark (and remark) +are created for (abstract or concrete) syntax trees—to inspect, transform, and +generate content, so that you can make things like [MDX][], [Prettier][], or +[Gatsby][]. + +###### micromark + +micromark can be used in two different ways. +It can either be used, optionally with existing extensions, to get HTML pretty +easily. +Or, it can give tremendous power, such as access to all tokens with positional +info, at the cost of being hard to get into. +It’s super small, pretty fast, and has 100% CommonMark compliance. +It has syntax extensions, such as supporting 100% GFM compliance (with +`micromark-extension-gfm`), but they’re rather complex to write. +It’s the newest parser on the block. + +If you’re looking for fine grained control, use micromark. + +###### remark + +[remark][] is the most popular markdown parser. +It’s built on top of `micromark` and boasts syntax trees. +For an analogy, it’s like if Babel, ESLint, and more, were one project. +It supports the syntax extensions that micromark has (so it’s 100% CM compliant +and can be 100% GFM compliant), but most of the work is done in plugins that +transform or inspect the tree. +Transforming the tree is relatively easy: it’s a JSON object that can be +manipulated directly. +remark is stable, widely used, and extremely powerful for handling complex data. + +If you’re looking to inspect or transform lots of content, use [remark][]. + +###### marked + +[marked][] is the oldest markdown parser on the block. +It’s been around for ages, is battle tested, small, popular, and has a bunch of +extensions, but doesn’t match CommonMark or GFM, and is unsafe by default. + +If you have markdown you trust and want to turn it into HTML without a fuss, use +[marked][]. + +###### markdown-it + +[markdown-it][] is a good, stable, and essentially CommonMark compliant markdown +parser, with (optional) support for some GFM features as well. +It’s used a lot as a direct dependency in packages, but is rather big. +It shines at syntax extensions, where you want to support not just markdown, but +*your* (company’s) version of markdown. + +If you’re in Node and have CommonMark-compliant (or funky) markdown and want to +turn it into HTML, use [markdown-it][]. + +###### Others + +There are lots of other markdown parsers! +Some say they’re small, or fast, or that they’re CommonMark compliant — but +that’s not always true. +This list is not supposed to be exhaustive. +This list of markdown parsers is a snapshot in time of why (not) to use +(alternatives to) `micromark`: they’re all good choices, depending on what your +goals are. + +## Version + +The open beta of micromark starts at version `2.0.0` (there was a different +package published on npm as `micromark` before). +micromark will adhere to semver at `3.0.0`. +Use tilde ranges for now: `"micromark": "~2.10.1"`. + +## Security + +The typical security aspect discussed for markdown is [cross-site scripting +(XSS)][xss] attacks. +It’s safe to compile markdown to HTML if it does not include embedded HTML nor +uses dangerous protocols in links (such as `javascript:` or `data:`). +micromark is safe by default when embedded HTML or dangerous protocols are used +too, as it encodes or drops them. +Turning on the `allowDangerousHtml` or `allowDangerousProtocol` options for +user-provided markdown opens you up to XSS attacks. + +Another aspect is DDoS attacks. +For example, an attacker could throw a 100mb file at micromark, in which case +the JavaScript engine will run out of memory and crash. +It is also possible to crash micromark with smaller payloads, notably when +thousands of links, images, emphasis, or strong are opened but not closed. +It is wise to cap the accepted size of input (500kb can hold a big book) and to +process content in a different thread or worker so that it can be stopped when +needed. + +Using extensions might also be unsafe, refer to their documentation for more +information. + +For more information on markdown sanitation, see +[`improper-markup-sanitization.md`][improper] by [**@chalker**][chalker]. + +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## Sponsor + +Support this effort and give back by sponsoring on [OpenCollective][]! + + + + + + + + + + + + + + + + + +
    +
    + Salesforce 🏅

    + +
    + Gatsby 🥇

    + +
    + Vercel 🥇

    + +
    + Netlify

    + + +
    + Holloway

    + +
    + ThemeIsle

    + +
    + Boost Hub

    + +
    + Expo

    + +
    +
    + You? +

    +
    + +## Origin story + +Over the summer of 2018, micromark was planned, and the idea shared in August +with a couple of friends and potential sponsors. +The problem I (**[@wooorm][]**) had was that issues were piling up in remark and +other repos, but my day job (teaching) was fun, fulfilling, and deserved time +too. +It was getting hard to combine the two. +The thought was to feed two birds with one scone: fix the issues in remark with +a new markdown parser (codename marydown) while being financially supported by +sponsors building fancy stuff on top, such as Gatsby, Contentful, and Vercel +(ZEIT at the time). +**[@johno][]** was making MDX on top of remark at the time (important historical +note: several other folks were working on JSX + markdown too). +We bundled our strengths: MDX was getting some traction and we thought together +we could perhaps make something sustainable. + +In November 2018, we launched with the idea for micromark to solve all existing +bugs, sustaining the existing hundreds of projects, and furthering the exciting +high-level project MDX. +We pushed a single name: unified (which back then was a small but essential +part of the chain). +Gatsby and Vercel were immediate sponsors. +We didn’t know whether it would work, and it worked. +But now you have a new problem: you are getting some financial support (much +more than other open source projects) but it’s not enough money for rent, and +too much money to print stickers with. +You still have your job and issues are still piling up. + +At the start of summer 2019, after a couple months of saving up donations, I +quit my job and worked on unified through fall. +That got the number of open issues down significantly and set up a strong +governance and maintenance system for the collective. +But when the time came to work on micromark, the money was gone again, so I +contracted through winter 2019, and in spring 2020 I could do about half open +source, half contracting. +One of the contracting gigs was to write a new MDX parser, for which I also +documented how to do that with a state machine [in prose][mdx-cmsm]. +That gave me the insight into how the same could be done for markdown: I drafted +[CMSM][], which was some of the core ideas for micromark, but in prose. + +In May 2020, Salesforce reached out: they saw the bugs in remark, how micromark +could help, and the initial work on CMSM. +And they had thousands of Markdown files. +In a for open source uncharacteristic move, they decided to fund my work on +micromark. +A large part of what maintaining open source means, is putting out fires, +triaging issues, and making sure users and sponsors are happy, so it was +amazing to get several months to just focus and make something new. +I remember feeling that this project would probably be the hardest thing I’d +work on: yeah, parsers are pretty difficult, but markdown is on another level. +Markdown is such a giant stack of edge cases on edge cases on even more +weirdness, what a mess. +On August 20, 2020, I released [2.0.0][200], the first working version of +micromark. +And it’s hard to describe how that moment felt. +It was great. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark.svg + +[downloads]: https://www.npmjs.com/package/micromark + +[bundle-size-badge]: https://img.shields.io/bundlephobia/minzip/micromark.svg + +[bundle-size]: https://bundlephobia.com/result?p=micromark + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[securitymd]: https://github.com/micromark/.github/blob/HEAD/security.md + +[contributing]: https://github.com/micromark/.github/blob/HEAD/contributing.md + +[support]: https://github.com/micromark/.github/blob/HEAD/support.md + +[coc]: https://github.com/micromark/.github/blob/HEAD/code-of-conduct.md + +[twitter]: https://twitter.com/unifiedjs + +[remark]: https://github.com/remarkjs/remark + +[site]: https://unifiedjs.com + +[contribute]: #contribute + +[encoding]: https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings + +[buffer]: https://nodejs.org/api/buffer.html + +[commonmark-spec]: https://commonmark.org + +[popular]: https://www.npmtrends.com/remark-parse-vs-marked-vs-markdown-it + +[remark-parse]: https://unifiedjs.com/explore/package/remark-parse/ + +[improper]: https://github.com/ChALkeR/notes/blob/master/Improper-markup-sanitization.md + +[chalker]: https://github.com/ChALkeR + +[cmsm]: https://github.com/micromark/common-markup-state-machine + +[mdx-cmsm]: https://github.com/micromark/mdx-state-machine + +[from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown + +[directives]: https://github.com/micromark/micromark-extension-directive + +[footnotes]: https://github.com/micromark/micromark-extension-footnote + +[frontmatter]: https://github.com/micromark/micromark-extension-frontmatter + +[gfm]: https://github.com/micromark/micromark-extension-gfm + +[math]: https://github.com/micromark/micromark-extension-math + +[mdxjs]: https://github.com/micromark/micromark-extension-mdxjs + +[constructs]: lib/constructs.mjs + +[extensions]: #list-of-extensions + +[syntax-extension]: #syntaxextension + +[html-extension]: #htmlextension + +[option-extensions]: #optionsextensions + +[option-htmlextensions]: #optionshtmlextensions + +[marked]: https://github.com/markedjs/marked + +[markdown-it]: https://github.com/markdown-it/markdown-it + +[mdx]: https://github.com/mdx-js/mdx + +[prettier]: https://github.com/prettier/prettier + +[gatsby]: https://github.com/gatsbyjs/gatsby + +[commonmark]: #commonmark + +[size]: #size--debug + +[test]: #test + +[security]: #security + +[sponsor]: #sponsor + +[@wooorm]: https://github.com/wooorm + +[@johno]: https://github.com/johno + +[200]: https://github.com/micromark/micromark/releases/tag/2.0.0 diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/stream.js b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/stream.js new file mode 100644 index 00000000000000..e90ff8f6c656ef --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/stream.js @@ -0,0 +1,3 @@ +'use strict' + +module.exports = require('./dist/stream.js') diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/stream.mjs b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/stream.mjs new file mode 100644 index 00000000000000..e33b22880b736b --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/micromark/stream.mjs @@ -0,0 +1 @@ +export {default} from './dist/stream.js' diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/ms/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/ms/index.js new file mode 100644 index 00000000000000..c4498bcc212589 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/replace-ext/LICENSE b/tools/node_modules/eslint-plugin-markdown/node_modules/ms/license.md old mode 100755 new mode 100644 similarity index 89% rename from tools/node_modules/eslint-plugin-markdown/node_modules/replace-ext/LICENSE rename to tools/node_modules/eslint-plugin-markdown/node_modules/ms/license.md index fd38d69351565d..69b61253a38926 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/replace-ext/LICENSE +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/ms/license.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 Blaine Bublitz , Eric Schoffstall and other contributors +Copyright (c) 2016 Zeit, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/ms/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/ms/package.json new file mode 100644 index 00000000000000..eea666e1fb03d6 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/ms/package.json @@ -0,0 +1,37 @@ +{ + "name": "ms", + "version": "2.1.2", + "description": "Tiny millisecond conversion utility", + "repository": "zeit/ms", + "main": "./index", + "files": [ + "index.js" + ], + "scripts": { + "precommit": "lint-staged", + "lint": "eslint lib/* bin/*", + "test": "mocha tests.js" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "license": "MIT", + "devDependencies": { + "eslint": "4.12.1", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1" + } +} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/ms/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/ms/readme.md new file mode 100644 index 00000000000000..9a1996b17e0de6 --- /dev/null +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/ms/readme.md @@ -0,0 +1,60 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/parse-entities/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/parse-entities/index.js index 1606d02f6590c5..106d6d86d4ce5e 100644 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/parse-entities/index.js +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/parse-entities/index.js @@ -30,15 +30,15 @@ var defaults = { // Characters. var tab = 9 // '\t' var lineFeed = 10 // '\n' -var formFeed = 12 // '\f' +var formFeed = 12 // '\f' var space = 32 // ' ' -var ampersand = 38 // '&' -var semicolon = 59 // ';' -var lessThan = 60 // '<' -var equalsTo = 61 // '=' -var numberSign = 35 // '#' -var uppercaseX = 88 // 'X' -var lowercaseX = 120 // 'x' +var ampersand = 38 // '&' +var semicolon = 59 // ';' +var lessThan = 60 // '<' +var equalsTo = 61 // '=' +var numberSign = 35 // '#' +var uppercaseX = 88 // 'X' +var lowercaseX = 120 // 'x' var replacementCharacter = 65533 // '�' // Reference types. @@ -160,7 +160,8 @@ function parse(value, settings) { // Wrap `handleWarning`. warning = handleWarning ? parseError : noop - // Ensure the algorithm walks over the first character and the end (inclusive). + // Ensure the algorithm walks over the first character and the end + // (inclusive). index-- length++ @@ -393,7 +394,7 @@ function parse(value, settings) { } } - // Return the reduced nodes, and any possible warnings. + // Return the reduced nodes. return result.join('') // Get current position. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/parse-entities/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/parse-entities/package.json index a5e1bc46f6a9ba..60e191fff0a2fc 100644 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/parse-entities/package.json +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/parse-entities/package.json @@ -1,6 +1,6 @@ { "name": "parse-entities", - "version": "1.2.2", + "version": "2.0.0", "description": "Parse HTML character references: fast, spec-compliant, positional information", "license": "MIT", "keywords": [ @@ -13,6 +13,10 @@ ], "repository": "wooorm/parse-entities", "bugs": "https://github.com/wooorm/parse-entities/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, "author": "Titus Wormer (https://wooorm.com)", "contributors": [ "Titus Wormer (https://wooorm.com)" @@ -26,8 +30,10 @@ "files": [ "index.js", "decode-entity.js", - "decode-entity.browser.js" + "decode-entity.browser.js", + "types/index.d.ts" ], + "types": "types/index.d.ts", "dependencies": { "character-entities": "^1.0.0", "character-entities-legacy": "^1.0.0", @@ -38,24 +44,26 @@ }, "devDependencies": { "browserify": "^16.0.0", - "nyc": "^14.0.0", - "prettier": "^1.12.1", - "remark-cli": "^6.0.0", - "remark-preset-wooorm": "^4.0.0", - "tape": "^4.2.0", + "dtslint": "^2.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", "tape-run": "^6.0.0", - "tinyify": "^2.4.3", - "xo": "^0.24.0" + "tinyify": "^2.0.0", + "xo": "^0.25.0" }, "scripts": { - "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "format": "remark . -qfo && prettier --write \"**/*.{js,ts}\" && xo --fix", "build-bundle": "browserify . -s parseEntities > parse-entities.js", "build-mangle": "browserify . -s parseEntities -p tinyify > parse-entities.min.js", "build": "npm run build-bundle && npm run build-mangle", "test-api": "node test", "test-coverage": "nyc --reporter lcov tape test.js", "test-browser": "browserify test.js | tape-run", - "test": "npm run format && npm run build && npm run test-coverage && npm run test-browser" + "test-types": "dtslint types", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types" }, "nyc": { "check-coverage": true, diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/parse-entities/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/parse-entities/readme.md index e9cc0f037ff16f..5ca60e7a87b9a8 100644 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/parse-entities/readme.md +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/parse-entities/readme.md @@ -8,15 +8,15 @@ Parse HTML character references: fast, spec-compliant, positional information. -## Installation +## Install [npm][]: -```bash +```sh npm install parse-entities ``` -## Usage +## Use ```js var decode = require('parse-entities') diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/index.js deleted file mode 100644 index 39cc24a23aecd1..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/index.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict' - -var unherit = require('unherit') -var xtend = require('xtend') -var Parser = require('./lib/parser.js') - -module.exports = parse -parse.Parser = Parser - -function parse(options) { - var settings = this.data('settings') - var Local = unherit(Parser) - - Local.prototype.options = xtend(Local.prototype.options, settings, options) - - this.Parser = Local -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/decode.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/decode.js deleted file mode 100644 index 3a1edc0be754cd..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/decode.js +++ /dev/null @@ -1,58 +0,0 @@ -'use strict' - -var xtend = require('xtend') -var entities = require('parse-entities') - -module.exports = factory - -// Factory to create an entity decoder. -function factory(ctx) { - decoder.raw = decodeRaw - - return decoder - - // Normalize `position` to add an `indent`. - function normalize(position) { - var offsets = ctx.offset - var line = position.line - var result = [] - - while (++line) { - if (!(line in offsets)) { - break - } - - result.push((offsets[line] || 0) + 1) - } - - return {start: position, indent: result} - } - - // Decode `value` (at `position`) into text-nodes. - function decoder(value, position, handler) { - entities(value, { - position: normalize(position), - warning: handleWarning, - text: handler, - reference: handler, - textContext: ctx, - referenceContext: ctx - }) - } - - // Decode `value` (at `position`) into a string. - function decodeRaw(value, position, options) { - return entities( - value, - xtend(options, {position: normalize(position), warning: handleWarning}) - ) - } - - // Handle a warning. - // See for the warnings. - function handleWarning(reason, position, code) { - if (code !== 3) { - ctx.file.message(reason, position) - } - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/defaults.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/defaults.js deleted file mode 100644 index 7776e3c0889d85..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/defaults.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict' - -module.exports = { - position: true, - gfm: true, - commonmark: false, - footnotes: false, - pedantic: false, - blocks: require('./block-elements') -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/break.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/break.js deleted file mode 100644 index f5479e7c6e74ef..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/break.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict' - -module.exports = locate - -function locate(value, fromIndex) { - var index = value.indexOf('\n', fromIndex) - - while (index > fromIndex) { - if (value.charAt(index - 1) !== ' ') { - break - } - - index-- - } - - return index -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/code-inline.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/code-inline.js deleted file mode 100644 index 241971709e4b66..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/code-inline.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict' - -module.exports = locate - -function locate(value, fromIndex) { - return value.indexOf('`', fromIndex) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/delete.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/delete.js deleted file mode 100644 index 18b2f6305bb565..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/delete.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict' - -module.exports = locate - -function locate(value, fromIndex) { - return value.indexOf('~~', fromIndex) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/emphasis.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/emphasis.js deleted file mode 100644 index afec4ff893e28e..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/emphasis.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict' - -module.exports = locate - -function locate(value, fromIndex) { - var asterisk = value.indexOf('*', fromIndex) - var underscore = value.indexOf('_', fromIndex) - - if (underscore === -1) { - return asterisk - } - - if (asterisk === -1) { - return underscore - } - - return underscore < asterisk ? underscore : asterisk -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/escape.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/escape.js deleted file mode 100644 index 9f61acff23ad54..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/escape.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict' - -module.exports = locate - -function locate(value, fromIndex) { - return value.indexOf('\\', fromIndex) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/link.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/link.js deleted file mode 100644 index df7b33bcfbe307..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/link.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict' - -module.exports = locate - -function locate(value, fromIndex) { - var link = value.indexOf('[', fromIndex) - var image = value.indexOf('![', fromIndex) - - if (image === -1) { - return link - } - - // Link can never be `-1` if an image is found, so we don’t need to check - // for that :) - return link < image ? link : image -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/strong.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/strong.js deleted file mode 100644 index 44b95cd02082ef..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/strong.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict' - -module.exports = locate - -function locate(value, fromIndex) { - var asterisk = value.indexOf('**', fromIndex) - var underscore = value.indexOf('__', fromIndex) - - if (underscore === -1) { - return asterisk - } - - if (asterisk === -1) { - return underscore - } - - return underscore < asterisk ? underscore : asterisk -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/tag.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/tag.js deleted file mode 100644 index 6a5d210b49109b..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/tag.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict' - -module.exports = locate - -function locate(value, fromIndex) { - return value.indexOf('<', fromIndex) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/url.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/url.js deleted file mode 100644 index e5bf5bfa4c469b..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/locate/url.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict' - -module.exports = locate - -var protocols = ['https://', 'http://', 'mailto:'] - -function locate(value, fromIndex) { - var length = protocols.length - var index = -1 - var min = -1 - var position - - if (!this.options.gfm) { - return -1 - } - - while (++index < length) { - position = value.indexOf(protocols[index], fromIndex) - - if (position !== -1 && (position < min || min === -1)) { - min = position - } - } - - return min -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/parse.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/parse.js deleted file mode 100644 index 59aac694bceebd..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/parse.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict' - -var xtend = require('xtend') -var removePosition = require('unist-util-remove-position') - -module.exports = parse - -var lineFeed = '\n' -var lineBreaksExpression = /\r\n|\r/g - -// Parse the bound file. -function parse() { - var self = this - var value = String(self.file) - var start = {line: 1, column: 1, offset: 0} - var content = xtend(start) - var node - - // Clean non-unix newlines: `\r\n` and `\r` are all changed to `\n`. - // This should not affect positional information. - value = value.replace(lineBreaksExpression, lineFeed) - - // BOM. - if (value.charCodeAt(0) === 0xfeff) { - value = value.slice(1) - - content.column++ - content.offset++ - } - - node = { - type: 'root', - children: self.tokenizeBlock(value, content), - position: {start: start, end: self.eof || xtend(start)} - } - - if (!self.options.position) { - removePosition(node, true) - } - - return node -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/parser.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/parser.js deleted file mode 100644 index 4add90e01e891a..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/parser.js +++ /dev/null @@ -1,149 +0,0 @@ -'use strict' - -var xtend = require('xtend') -var toggle = require('state-toggle') -var vfileLocation = require('vfile-location') -var unescape = require('./unescape') -var decode = require('./decode') -var tokenizer = require('./tokenizer') - -module.exports = Parser - -function Parser(doc, file) { - this.file = file - this.offset = {} - this.options = xtend(this.options) - this.setOptions({}) - - this.inList = false - this.inBlock = false - this.inLink = false - this.atStart = true - - this.toOffset = vfileLocation(file).toOffset - this.unescape = unescape(this, 'escape') - this.decode = decode(this) -} - -var proto = Parser.prototype - -// Expose core. -proto.setOptions = require('./set-options') -proto.parse = require('./parse') - -// Expose `defaults`. -proto.options = require('./defaults') - -// Enter and exit helpers. -proto.exitStart = toggle('atStart', true) -proto.enterList = toggle('inList', false) -proto.enterLink = toggle('inLink', false) -proto.enterBlock = toggle('inBlock', false) - -// Nodes that can interupt a paragraph: -// -// ```markdown -// A paragraph, followed by a thematic break. -// ___ -// ``` -// -// In the above example, the thematic break “interupts” the paragraph. -proto.interruptParagraph = [ - ['thematicBreak'], - ['atxHeading'], - ['fencedCode'], - ['blockquote'], - ['html'], - ['setextHeading', {commonmark: false}], - ['definition', {commonmark: false}], - ['footnote', {commonmark: false}] -] - -// Nodes that can interupt a list: -// -// ```markdown -// - One -// ___ -// ``` -// -// In the above example, the thematic break “interupts” the list. -proto.interruptList = [ - ['atxHeading', {pedantic: false}], - ['fencedCode', {pedantic: false}], - ['thematicBreak', {pedantic: false}], - ['definition', {commonmark: false}], - ['footnote', {commonmark: false}] -] - -// Nodes that can interupt a blockquote: -// -// ```markdown -// > A paragraph. -// ___ -// ``` -// -// In the above example, the thematic break “interupts” the blockquote. -proto.interruptBlockquote = [ - ['indentedCode', {commonmark: true}], - ['fencedCode', {commonmark: true}], - ['atxHeading', {commonmark: true}], - ['setextHeading', {commonmark: true}], - ['thematicBreak', {commonmark: true}], - ['html', {commonmark: true}], - ['list', {commonmark: true}], - ['definition', {commonmark: false}], - ['footnote', {commonmark: false}] -] - -// Handlers. -proto.blockTokenizers = { - newline: require('./tokenize/newline'), - indentedCode: require('./tokenize/code-indented'), - fencedCode: require('./tokenize/code-fenced'), - blockquote: require('./tokenize/blockquote'), - atxHeading: require('./tokenize/heading-atx'), - thematicBreak: require('./tokenize/thematic-break'), - list: require('./tokenize/list'), - setextHeading: require('./tokenize/heading-setext'), - html: require('./tokenize/html-block'), - footnote: require('./tokenize/footnote-definition'), - definition: require('./tokenize/definition'), - table: require('./tokenize/table'), - paragraph: require('./tokenize/paragraph') -} - -proto.inlineTokenizers = { - escape: require('./tokenize/escape'), - autoLink: require('./tokenize/auto-link'), - url: require('./tokenize/url'), - html: require('./tokenize/html-inline'), - link: require('./tokenize/link'), - reference: require('./tokenize/reference'), - strong: require('./tokenize/strong'), - emphasis: require('./tokenize/emphasis'), - deletion: require('./tokenize/delete'), - code: require('./tokenize/code-inline'), - break: require('./tokenize/break'), - text: require('./tokenize/text') -} - -// Expose precedence. -proto.blockMethods = keys(proto.blockTokenizers) -proto.inlineMethods = keys(proto.inlineTokenizers) - -// Tokenizers. -proto.tokenizeBlock = tokenizer('block') -proto.tokenizeInline = tokenizer('inline') -proto.tokenizeFactory = tokenizer - -// Get all keys in `value`. -function keys(value) { - var result = [] - var key - - for (key in value) { - result.push(key) - } - - return result -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/set-options.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/set-options.js deleted file mode 100644 index 5877099e393cb5..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/set-options.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict' - -var xtend = require('xtend') -var escapes = require('markdown-escapes') -var defaults = require('./defaults') - -module.exports = setOptions - -function setOptions(options) { - var self = this - var current = self.options - var key - var value - - if (options == null) { - options = {} - } else if (typeof options === 'object') { - options = xtend(options) - } else { - throw new Error('Invalid value `' + options + '` for setting `options`') - } - - for (key in defaults) { - value = options[key] - - if (value == null) { - value = current[key] - } - - if ( - (key !== 'blocks' && typeof value !== 'boolean') || - (key === 'blocks' && typeof value !== 'object') - ) { - throw new Error( - 'Invalid value `' + value + '` for setting `options.' + key + '`' - ) - } - - options[key] = value - } - - self.options = options - self.escape = escapes(options) - - return self -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/auto-link.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/auto-link.js deleted file mode 100644 index f5bcb8900a701a..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/auto-link.js +++ /dev/null @@ -1,133 +0,0 @@ -'use strict' - -var whitespace = require('is-whitespace-character') -var decode = require('parse-entities') -var locate = require('../locate/tag') - -module.exports = autoLink -autoLink.locator = locate -autoLink.notInLink = true - -var lessThan = '<' -var greaterThan = '>' -var atSign = '@' -var slash = '/' -var mailto = 'mailto:' -var mailtoLength = mailto.length - -function autoLink(eat, value, silent) { - var self = this - var subvalue = '' - var length = value.length - var index = 0 - var queue = '' - var hasAtCharacter = false - var link = '' - var character - var now - var content - var tokenizers - var exit - - if (value.charAt(0) !== lessThan) { - return - } - - index++ - subvalue = lessThan - - while (index < length) { - character = value.charAt(index) - - if ( - whitespace(character) || - character === greaterThan || - character === atSign || - (character === ':' && value.charAt(index + 1) === slash) - ) { - break - } - - queue += character - index++ - } - - if (!queue) { - return - } - - link += queue - queue = '' - - character = value.charAt(index) - link += character - index++ - - if (character === atSign) { - hasAtCharacter = true - } else { - if (character !== ':' || value.charAt(index + 1) !== slash) { - return - } - - link += slash - index++ - } - - while (index < length) { - character = value.charAt(index) - - if (whitespace(character) || character === greaterThan) { - break - } - - queue += character - index++ - } - - character = value.charAt(index) - - if (!queue || character !== greaterThan) { - return - } - - /* istanbul ignore if - never used (yet) */ - if (silent) { - return true - } - - link += queue - content = link - subvalue += link + character - now = eat.now() - now.column++ - now.offset++ - - if (hasAtCharacter) { - if (link.slice(0, mailtoLength).toLowerCase() === mailto) { - content = content.slice(mailtoLength) - now.column += mailtoLength - now.offset += mailtoLength - } else { - link = mailto + link - } - } - - // Temporarily remove all tokenizers except text in autolinks. - tokenizers = self.inlineTokenizers - self.inlineTokenizers = {text: tokenizers.text} - - exit = self.enterLink() - - content = self.tokenizeInline(content, now) - - self.inlineTokenizers = tokenizers - exit() - - return eat(subvalue)({ - type: 'link', - title: null, - url: decode(link, {nonTerminated: false}), - children: content - }) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/blockquote.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/blockquote.js deleted file mode 100644 index 2960e85afaa644..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/blockquote.js +++ /dev/null @@ -1,124 +0,0 @@ -'use strict' - -var trim = require('trim') -var interrupt = require('../util/interrupt') - -module.exports = blockquote - -var lineFeed = '\n' -var tab = '\t' -var space = ' ' -var greaterThan = '>' - -function blockquote(eat, value, silent) { - var self = this - var offsets = self.offset - var tokenizers = self.blockTokenizers - var interruptors = self.interruptBlockquote - var now = eat.now() - var currentLine = now.line - var length = value.length - var values = [] - var contents = [] - var indents = [] - var add - var index = 0 - var character - var rest - var nextIndex - var content - var line - var startIndex - var prefixed - var exit - - while (index < length) { - character = value.charAt(index) - - if (character !== space && character !== tab) { - break - } - - index++ - } - - if (value.charAt(index) !== greaterThan) { - return - } - - if (silent) { - return true - } - - index = 0 - - while (index < length) { - nextIndex = value.indexOf(lineFeed, index) - startIndex = index - prefixed = false - - if (nextIndex === -1) { - nextIndex = length - } - - while (index < length) { - character = value.charAt(index) - - if (character !== space && character !== tab) { - break - } - - index++ - } - - if (value.charAt(index) === greaterThan) { - index++ - prefixed = true - - if (value.charAt(index) === space) { - index++ - } - } else { - index = startIndex - } - - content = value.slice(index, nextIndex) - - if (!prefixed && !trim(content)) { - index = startIndex - break - } - - if (!prefixed) { - rest = value.slice(index) - - // Check if the following code contains a possible block. - if (interrupt(interruptors, tokenizers, self, [eat, rest, true])) { - break - } - } - - line = startIndex === index ? content : value.slice(startIndex, nextIndex) - - indents.push(index - startIndex) - values.push(line) - contents.push(content) - - index = nextIndex + 1 - } - - index = -1 - length = indents.length - add = eat(values.join(lineFeed)) - - while (++index < length) { - offsets[currentLine] = (offsets[currentLine] || 0) + indents[index] - currentLine++ - } - - exit = self.enterBlock() - contents = self.tokenizeBlock(contents.join(lineFeed), now) - exit() - - return add({type: 'blockquote', children: contents}) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/break.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/break.js deleted file mode 100644 index b68ca6d7e2a47e..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/break.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict' - -var locate = require('../locate/break') - -module.exports = hardBreak -hardBreak.locator = locate - -var space = ' ' -var lineFeed = '\n' -var minBreakLength = 2 - -function hardBreak(eat, value, silent) { - var length = value.length - var index = -1 - var queue = '' - var character - - while (++index < length) { - character = value.charAt(index) - - if (character === lineFeed) { - if (index < minBreakLength) { - return - } - - /* istanbul ignore if - never used (yet) */ - if (silent) { - return true - } - - queue += character - - return eat(queue)({type: 'break'}) - } - - if (character !== space) { - return - } - - queue += character - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/code-fenced.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/code-fenced.js deleted file mode 100644 index e690814f9c61f4..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/code-fenced.js +++ /dev/null @@ -1,253 +0,0 @@ -'use strict' - -module.exports = fencedCode - -var lineFeed = '\n' -var tab = '\t' -var space = ' ' -var tilde = '~' -var graveAccent = '`' - -var minFenceCount = 3 -var tabSize = 4 - -function fencedCode(eat, value, silent) { - var self = this - var gfm = self.options.gfm - var length = value.length + 1 - var index = 0 - var subvalue = '' - var fenceCount - var marker - var character - var flag - var lang - var meta - var queue - var content - var exdentedContent - var closing - var exdentedClosing - var indent - var now - - if (!gfm) { - return - } - - // Eat initial spacing. - while (index < length) { - character = value.charAt(index) - - if (character !== space && character !== tab) { - break - } - - subvalue += character - index++ - } - - indent = index - - // Eat the fence. - character = value.charAt(index) - - if (character !== tilde && character !== graveAccent) { - return - } - - index++ - marker = character - fenceCount = 1 - subvalue += character - - while (index < length) { - character = value.charAt(index) - - if (character !== marker) { - break - } - - subvalue += character - fenceCount++ - index++ - } - - if (fenceCount < minFenceCount) { - return - } - - // Eat spacing before flag. - while (index < length) { - character = value.charAt(index) - - if (character !== space && character !== tab) { - break - } - - subvalue += character - index++ - } - - // Eat flag. - flag = '' - queue = '' - - while (index < length) { - character = value.charAt(index) - - if ( - character === lineFeed || - (marker === graveAccent && character === marker) - ) { - break - } - - if (character === space || character === tab) { - queue += character - } else { - flag += queue + character - queue = '' - } - - index++ - } - - character = value.charAt(index) - - if (character && character !== lineFeed) { - return - } - - if (silent) { - return true - } - - now = eat.now() - now.column += subvalue.length - now.offset += subvalue.length - - subvalue += flag - flag = self.decode.raw(self.unescape(flag), now) - - if (queue) { - subvalue += queue - } - - queue = '' - closing = '' - exdentedClosing = '' - content = '' - exdentedContent = '' - var skip = true - - // Eat content. - while (index < length) { - character = value.charAt(index) - content += closing - exdentedContent += exdentedClosing - closing = '' - exdentedClosing = '' - - if (character !== lineFeed) { - content += character - exdentedClosing += character - index++ - continue - } - - // The first line feed is ignored. Others aren’t. - if (skip) { - subvalue += character - skip = false - } else { - closing += character - exdentedClosing += character - } - - queue = '' - index++ - - while (index < length) { - character = value.charAt(index) - - if (character !== space) { - break - } - - queue += character - index++ - } - - closing += queue - exdentedClosing += queue.slice(indent) - - if (queue.length >= tabSize) { - continue - } - - queue = '' - - while (index < length) { - character = value.charAt(index) - - if (character !== marker) { - break - } - - queue += character - index++ - } - - closing += queue - exdentedClosing += queue - - if (queue.length < fenceCount) { - continue - } - - queue = '' - - while (index < length) { - character = value.charAt(index) - - if (character !== space && character !== tab) { - break - } - - closing += character - exdentedClosing += character - index++ - } - - if (!character || character === lineFeed) { - break - } - } - - subvalue += content + closing - - // Get lang and meta from the flag. - index = -1 - length = flag.length - - while (++index < length) { - character = flag.charAt(index) - - if (character === space || character === tab) { - if (!lang) { - lang = flag.slice(0, index) - } - } else if (lang) { - meta = flag.slice(index) - break - } - } - - return eat(subvalue)({ - type: 'code', - lang: lang || flag || null, - meta: meta || null, - value: exdentedContent - }) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/code-indented.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/code-indented.js deleted file mode 100644 index 53a666fb6def8a..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/code-indented.js +++ /dev/null @@ -1,98 +0,0 @@ -'use strict' - -var repeat = require('repeat-string') -var trim = require('trim-trailing-lines') - -module.exports = indentedCode - -var lineFeed = '\n' -var tab = '\t' -var space = ' ' - -var tabSize = 4 -var codeIndent = repeat(space, tabSize) - -function indentedCode(eat, value, silent) { - var index = -1 - var length = value.length - var subvalue = '' - var content = '' - var subvalueQueue = '' - var contentQueue = '' - var character - var blankQueue - var indent - - while (++index < length) { - character = value.charAt(index) - - if (indent) { - indent = false - - subvalue += subvalueQueue - content += contentQueue - subvalueQueue = '' - contentQueue = '' - - if (character === lineFeed) { - subvalueQueue = character - contentQueue = character - } else { - subvalue += character - content += character - - while (++index < length) { - character = value.charAt(index) - - if (!character || character === lineFeed) { - contentQueue = character - subvalueQueue = character - break - } - - subvalue += character - content += character - } - } - } else if ( - character === space && - value.charAt(index + 1) === character && - value.charAt(index + 2) === character && - value.charAt(index + 3) === character - ) { - subvalueQueue += codeIndent - index += 3 - indent = true - } else if (character === tab) { - subvalueQueue += character - indent = true - } else { - blankQueue = '' - - while (character === tab || character === space) { - blankQueue += character - character = value.charAt(++index) - } - - if (character !== lineFeed) { - break - } - - subvalueQueue += blankQueue + character - contentQueue += character - } - } - - if (content) { - if (silent) { - return true - } - - return eat(subvalue)({ - type: 'code', - lang: null, - meta: null, - value: trim(content) - }) - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/code-inline.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/code-inline.js deleted file mode 100644 index 66da0f35488e8f..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/code-inline.js +++ /dev/null @@ -1,109 +0,0 @@ -'use strict' - -var locate = require('../locate/code-inline') - -module.exports = inlineCode -inlineCode.locator = locate - -var lineFeed = 10 // '\n' -var space = 32 // ' ' -var graveAccent = 96 // '`' - -function inlineCode(eat, value, silent) { - var length = value.length - var index = 0 - var openingFenceEnd - var closingFenceStart - var closingFenceEnd - var code - var next - var found - - while (index < length) { - if (value.charCodeAt(index) !== graveAccent) { - break - } - - index++ - } - - if (index === 0 || index === length) { - return - } - - openingFenceEnd = index - next = value.charCodeAt(index) - - while (index < length) { - code = next - next = value.charCodeAt(index + 1) - - if (code === graveAccent) { - if (closingFenceStart === undefined) { - closingFenceStart = index - } - - closingFenceEnd = index + 1 - - if ( - next !== graveAccent && - closingFenceEnd - closingFenceStart === openingFenceEnd - ) { - found = true - break - } - } else if (closingFenceStart !== undefined) { - closingFenceStart = undefined - closingFenceEnd = undefined - } - - index++ - } - - if (!found) { - return - } - - /* istanbul ignore if - never used (yet) */ - if (silent) { - return true - } - - // Remove the initial and final space (or line feed), iff they exist and there - // are non-space characters in the content. - index = openingFenceEnd - length = closingFenceStart - code = value.charCodeAt(index) - next = value.charCodeAt(length - 1) - found = false - - if ( - length - index > 2 && - (code === space || code === lineFeed) && - (next === space || next === lineFeed) - ) { - index++ - length-- - - while (index < length) { - code = value.charCodeAt(index) - - if (code !== space && code !== lineFeed) { - found = true - break - } - - index++ - } - - if (found === true) { - openingFenceEnd++ - closingFenceStart-- - } - } - - return eat(value.slice(0, closingFenceEnd))({ - type: 'inlineCode', - value: value.slice(openingFenceEnd, closingFenceStart) - }) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/definition.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/definition.js deleted file mode 100644 index ec56f0c41a595e..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/definition.js +++ /dev/null @@ -1,273 +0,0 @@ -'use strict' - -var whitespace = require('is-whitespace-character') -var normalize = require('../util/normalize') - -module.exports = definition - -var quotationMark = '"' -var apostrophe = "'" -var backslash = '\\' -var lineFeed = '\n' -var tab = '\t' -var space = ' ' -var leftSquareBracket = '[' -var rightSquareBracket = ']' -var leftParenthesis = '(' -var rightParenthesis = ')' -var colon = ':' -var lessThan = '<' -var greaterThan = '>' - -function definition(eat, value, silent) { - var self = this - var commonmark = self.options.commonmark - var index = 0 - var length = value.length - var subvalue = '' - var beforeURL - var beforeTitle - var queue - var character - var test - var identifier - var url - var title - - while (index < length) { - character = value.charAt(index) - - if (character !== space && character !== tab) { - break - } - - subvalue += character - index++ - } - - character = value.charAt(index) - - if (character !== leftSquareBracket) { - return - } - - index++ - subvalue += character - queue = '' - - while (index < length) { - character = value.charAt(index) - - if (character === rightSquareBracket) { - break - } else if (character === backslash) { - queue += character - index++ - character = value.charAt(index) - } - - queue += character - index++ - } - - if ( - !queue || - value.charAt(index) !== rightSquareBracket || - value.charAt(index + 1) !== colon - ) { - return - } - - identifier = queue - subvalue += queue + rightSquareBracket + colon - index = subvalue.length - queue = '' - - while (index < length) { - character = value.charAt(index) - - if (character !== tab && character !== space && character !== lineFeed) { - break - } - - subvalue += character - index++ - } - - character = value.charAt(index) - queue = '' - beforeURL = subvalue - - if (character === lessThan) { - index++ - - while (index < length) { - character = value.charAt(index) - - if (!isEnclosedURLCharacter(character)) { - break - } - - queue += character - index++ - } - - character = value.charAt(index) - - if (character === isEnclosedURLCharacter.delimiter) { - subvalue += lessThan + queue + character - index++ - } else { - if (commonmark) { - return - } - - index -= queue.length + 1 - queue = '' - } - } - - if (!queue) { - while (index < length) { - character = value.charAt(index) - - if (!isUnclosedURLCharacter(character)) { - break - } - - queue += character - index++ - } - - subvalue += queue - } - - if (!queue) { - return - } - - url = queue - queue = '' - - while (index < length) { - character = value.charAt(index) - - if (character !== tab && character !== space && character !== lineFeed) { - break - } - - queue += character - index++ - } - - character = value.charAt(index) - test = null - - if (character === quotationMark) { - test = quotationMark - } else if (character === apostrophe) { - test = apostrophe - } else if (character === leftParenthesis) { - test = rightParenthesis - } - - if (!test) { - queue = '' - index = subvalue.length - } else if (queue) { - subvalue += queue + character - index = subvalue.length - queue = '' - - while (index < length) { - character = value.charAt(index) - - if (character === test) { - break - } - - if (character === lineFeed) { - index++ - character = value.charAt(index) - - if (character === lineFeed || character === test) { - return - } - - queue += lineFeed - } - - queue += character - index++ - } - - character = value.charAt(index) - - if (character !== test) { - return - } - - beforeTitle = subvalue - subvalue += queue + character - index++ - title = queue - queue = '' - } else { - return - } - - while (index < length) { - character = value.charAt(index) - - if (character !== tab && character !== space) { - break - } - - subvalue += character - index++ - } - - character = value.charAt(index) - - if (!character || character === lineFeed) { - if (silent) { - return true - } - - beforeURL = eat(beforeURL).test().end - url = self.decode.raw(self.unescape(url), beforeURL, {nonTerminated: false}) - - if (title) { - beforeTitle = eat(beforeTitle).test().end - title = self.decode.raw(self.unescape(title), beforeTitle) - } - - return eat(subvalue)({ - type: 'definition', - identifier: normalize(identifier), - label: identifier, - title: title || null, - url: url - }) - } -} - -// Check if `character` can be inside an enclosed URI. -function isEnclosedURLCharacter(character) { - return ( - character !== greaterThan && - character !== leftSquareBracket && - character !== rightSquareBracket - ) -} - -isEnclosedURLCharacter.delimiter = greaterThan - -// Check if `character` can be inside an unclosed URI. -function isUnclosedURLCharacter(character) { - return ( - character !== leftSquareBracket && - character !== rightSquareBracket && - !whitespace(character) - ) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/delete.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/delete.js deleted file mode 100644 index 3513634b9557d9..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/delete.js +++ /dev/null @@ -1,60 +0,0 @@ -'use strict' - -var whitespace = require('is-whitespace-character') -var locate = require('../locate/delete') - -module.exports = strikethrough -strikethrough.locator = locate - -var tilde = '~' -var fence = '~~' - -function strikethrough(eat, value, silent) { - var self = this - var character = '' - var previous = '' - var preceding = '' - var subvalue = '' - var index - var length - var now - - if ( - !self.options.gfm || - value.charAt(0) !== tilde || - value.charAt(1) !== tilde || - whitespace(value.charAt(2)) - ) { - return - } - - index = 1 - length = value.length - now = eat.now() - now.column += 2 - now.offset += 2 - - while (++index < length) { - character = value.charAt(index) - - if ( - character === tilde && - previous === tilde && - (!preceding || !whitespace(preceding)) - ) { - /* istanbul ignore if - never used (yet) */ - if (silent) { - return true - } - - return eat(fence + subvalue + fence)({ - type: 'delete', - children: self.tokenizeInline(subvalue, now) - }) - } - - subvalue += previous - preceding = previous - previous = character - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/emphasis.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/emphasis.js deleted file mode 100644 index 2cbfd314a3f2a9..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/emphasis.js +++ /dev/null @@ -1,86 +0,0 @@ -'use strict' - -var trim = require('trim') -var word = require('is-word-character') -var whitespace = require('is-whitespace-character') -var locate = require('../locate/emphasis') - -module.exports = emphasis -emphasis.locator = locate - -var asterisk = '*' -var underscore = '_' -var backslash = '\\' - -function emphasis(eat, value, silent) { - var self = this - var index = 0 - var character = value.charAt(index) - var now - var pedantic - var marker - var queue - var subvalue - var length - var prev - - if (character !== asterisk && character !== underscore) { - return - } - - pedantic = self.options.pedantic - subvalue = character - marker = character - length = value.length - index++ - queue = '' - character = '' - - if (pedantic && whitespace(value.charAt(index))) { - return - } - - while (index < length) { - prev = character - character = value.charAt(index) - - if (character === marker && (!pedantic || !whitespace(prev))) { - character = value.charAt(++index) - - if (character !== marker) { - if (!trim(queue) || prev === marker) { - return - } - - if (!pedantic && marker === underscore && word(character)) { - queue += marker - continue - } - - /* istanbul ignore if - never used (yet) */ - if (silent) { - return true - } - - now = eat.now() - now.column++ - now.offset++ - - return eat(subvalue + queue + marker)({ - type: 'emphasis', - children: self.tokenizeInline(queue, now) - }) - } - - queue += marker - } - - if (!pedantic && character === backslash) { - queue += character - character = value.charAt(++index) - } - - queue += character - index++ - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/escape.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/escape.js deleted file mode 100644 index 1cac3532aa2c63..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/escape.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict' - -var locate = require('../locate/escape') - -module.exports = escape -escape.locator = locate - -var lineFeed = '\n' -var backslash = '\\' - -function escape(eat, value, silent) { - var self = this - var character - var node - - if (value.charAt(0) === backslash) { - character = value.charAt(1) - - if (self.escape.indexOf(character) !== -1) { - /* istanbul ignore if - never used (yet) */ - if (silent) { - return true - } - - if (character === lineFeed) { - node = {type: 'break'} - } else { - node = {type: 'text', value: character} - } - - return eat(backslash + character)(node) - } - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/footnote-definition.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/footnote-definition.js deleted file mode 100644 index 62d8ce7b2c967d..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/footnote-definition.js +++ /dev/null @@ -1,186 +0,0 @@ -'use strict' - -var whitespace = require('is-whitespace-character') -var normalize = require('../util/normalize') - -module.exports = footnoteDefinition -footnoteDefinition.notInList = true -footnoteDefinition.notInBlock = true - -var backslash = '\\' -var lineFeed = '\n' -var tab = '\t' -var space = ' ' -var leftSquareBracket = '[' -var rightSquareBracket = ']' -var caret = '^' -var colon = ':' - -var EXPRESSION_INITIAL_TAB = /^( {4}|\t)?/gm - -function footnoteDefinition(eat, value, silent) { - var self = this - var offsets = self.offset - var index - var length - var subvalue - var now - var currentLine - var content - var queue - var subqueue - var character - var identifier - var add - var exit - - if (!self.options.footnotes) { - return - } - - index = 0 - length = value.length - subvalue = '' - now = eat.now() - currentLine = now.line - - while (index < length) { - character = value.charAt(index) - - if (!whitespace(character)) { - break - } - - subvalue += character - index++ - } - - if ( - value.charAt(index) !== leftSquareBracket || - value.charAt(index + 1) !== caret - ) { - return - } - - subvalue += leftSquareBracket + caret - index = subvalue.length - queue = '' - - while (index < length) { - character = value.charAt(index) - - if (character === rightSquareBracket) { - break - } else if (character === backslash) { - queue += character - index++ - character = value.charAt(index) - } - - queue += character - index++ - } - - if ( - !queue || - value.charAt(index) !== rightSquareBracket || - value.charAt(index + 1) !== colon - ) { - return - } - - if (silent) { - return true - } - - identifier = queue - subvalue += queue + rightSquareBracket + colon - index = subvalue.length - - while (index < length) { - character = value.charAt(index) - - if (character !== tab && character !== space) { - break - } - - subvalue += character - index++ - } - - now.column += subvalue.length - now.offset += subvalue.length - queue = '' - content = '' - subqueue = '' - - while (index < length) { - character = value.charAt(index) - - if (character === lineFeed) { - subqueue = character - index++ - - while (index < length) { - character = value.charAt(index) - - if (character !== lineFeed) { - break - } - - subqueue += character - index++ - } - - queue += subqueue - subqueue = '' - - while (index < length) { - character = value.charAt(index) - - if (character !== space) { - break - } - - subqueue += character - index++ - } - - if (subqueue.length === 0) { - break - } - - queue += subqueue - } - - if (queue) { - content += queue - queue = '' - } - - content += character - index++ - } - - subvalue += content - - content = content.replace(EXPRESSION_INITIAL_TAB, function(line) { - offsets[currentLine] = (offsets[currentLine] || 0) + line.length - currentLine++ - - return '' - }) - - add = eat(subvalue) - - exit = self.enterBlock() - content = self.tokenizeBlock(content, now) - exit() - - return add({ - type: 'footnoteDefinition', - identifier: normalize(identifier), - label: identifier, - children: content - }) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/heading-atx.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/heading-atx.js deleted file mode 100644 index dfa2849fb77e9b..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/heading-atx.js +++ /dev/null @@ -1,135 +0,0 @@ -'use strict' - -module.exports = atxHeading - -var lineFeed = '\n' -var tab = '\t' -var space = ' ' -var numberSign = '#' - -var maxFenceCount = 6 - -function atxHeading(eat, value, silent) { - var self = this - var pedantic = self.options.pedantic - var length = value.length + 1 - var index = -1 - var now = eat.now() - var subvalue = '' - var content = '' - var character - var queue - var depth - - // Eat initial spacing. - while (++index < length) { - character = value.charAt(index) - - if (character !== space && character !== tab) { - index-- - break - } - - subvalue += character - } - - // Eat hashes. - depth = 0 - - while (++index <= length) { - character = value.charAt(index) - - if (character !== numberSign) { - index-- - break - } - - subvalue += character - depth++ - } - - if (depth > maxFenceCount) { - return - } - - if (!depth || (!pedantic && value.charAt(index + 1) === numberSign)) { - return - } - - length = value.length + 1 - - // Eat intermediate white-space. - queue = '' - - while (++index < length) { - character = value.charAt(index) - - if (character !== space && character !== tab) { - index-- - break - } - - queue += character - } - - // Exit when not in pedantic mode without spacing. - if (!pedantic && queue.length === 0 && character && character !== lineFeed) { - return - } - - if (silent) { - return true - } - - // Eat content. - subvalue += queue - queue = '' - content = '' - - while (++index < length) { - character = value.charAt(index) - - if (!character || character === lineFeed) { - break - } - - if (character !== space && character !== tab && character !== numberSign) { - content += queue + character - queue = '' - continue - } - - while (character === space || character === tab) { - queue += character - character = value.charAt(++index) - } - - // `#` without a queue is part of the content. - if (!pedantic && content && !queue && character === numberSign) { - content += character - continue - } - - while (character === numberSign) { - queue += character - character = value.charAt(++index) - } - - while (character === space || character === tab) { - queue += character - character = value.charAt(++index) - } - - index-- - } - - now.column += subvalue.length - now.offset += subvalue.length - subvalue += content + queue - - return eat(subvalue)({ - type: 'heading', - depth: depth, - children: self.tokenizeInline(content, now) - }) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/heading-setext.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/heading-setext.js deleted file mode 100644 index 1427623458c8b0..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/heading-setext.js +++ /dev/null @@ -1,102 +0,0 @@ -'use strict' - -module.exports = setextHeading - -var lineFeed = '\n' -var tab = '\t' -var space = ' ' -var equalsTo = '=' -var dash = '-' - -var maxIndent = 3 - -var equalsToDepth = 1 -var dashDepth = 2 - -function setextHeading(eat, value, silent) { - var self = this - var now = eat.now() - var length = value.length - var index = -1 - var subvalue = '' - var content - var queue - var character - var marker - var depth - - // Eat initial indentation. - while (++index < length) { - character = value.charAt(index) - - if (character !== space || index >= maxIndent) { - index-- - break - } - - subvalue += character - } - - // Eat content. - content = '' - queue = '' - - while (++index < length) { - character = value.charAt(index) - - if (character === lineFeed) { - index-- - break - } - - if (character === space || character === tab) { - queue += character - } else { - content += queue + character - queue = '' - } - } - - now.column += subvalue.length - now.offset += subvalue.length - subvalue += content + queue - - // Ensure the content is followed by a newline and a valid marker. - character = value.charAt(++index) - marker = value.charAt(++index) - - if (character !== lineFeed || (marker !== equalsTo && marker !== dash)) { - return - } - - subvalue += character - - // Eat Setext-line. - queue = marker - depth = marker === equalsTo ? equalsToDepth : dashDepth - - while (++index < length) { - character = value.charAt(index) - - if (character !== marker) { - if (character !== lineFeed) { - return - } - - index-- - break - } - - queue += character - } - - if (silent) { - return true - } - - return eat(subvalue + queue)({ - type: 'heading', - depth: depth, - children: self.tokenizeInline(content, now) - }) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/html-block.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/html-block.js deleted file mode 100644 index 149a71860f0460..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/html-block.js +++ /dev/null @@ -1,111 +0,0 @@ -'use strict' - -var openCloseTag = require('../util/html').openCloseTag - -module.exports = blockHtml - -var tab = '\t' -var space = ' ' -var lineFeed = '\n' -var lessThan = '<' - -var rawOpenExpression = /^<(script|pre|style)(?=(\s|>|$))/i -var rawCloseExpression = /<\/(script|pre|style)>/i -var commentOpenExpression = /^/ -var instructionOpenExpression = /^<\?/ -var instructionCloseExpression = /\?>/ -var directiveOpenExpression = /^/ -var cdataOpenExpression = /^/ -var elementCloseExpression = /^$/ -var otherElementOpenExpression = new RegExp(openCloseTag.source + '\\s*$') - -function blockHtml(eat, value, silent) { - var self = this - var blocks = self.options.blocks.join('|') - var elementOpenExpression = new RegExp( - '^|$))', - 'i' - ) - var length = value.length - var index = 0 - var next - var line - var offset - var character - var count - var sequence - var subvalue - - var sequences = [ - [rawOpenExpression, rawCloseExpression, true], - [commentOpenExpression, commentCloseExpression, true], - [instructionOpenExpression, instructionCloseExpression, true], - [directiveOpenExpression, directiveCloseExpression, true], - [cdataOpenExpression, cdataCloseExpression, true], - [elementOpenExpression, elementCloseExpression, true], - [otherElementOpenExpression, elementCloseExpression, false] - ] - - // Eat initial spacing. - while (index < length) { - character = value.charAt(index) - - if (character !== tab && character !== space) { - break - } - - index++ - } - - if (value.charAt(index) !== lessThan) { - return - } - - next = value.indexOf(lineFeed, index + 1) - next = next === -1 ? length : next - line = value.slice(index, next) - offset = -1 - count = sequences.length - - while (++offset < count) { - if (sequences[offset][0].test(line)) { - sequence = sequences[offset] - break - } - } - - if (!sequence) { - return - } - - if (silent) { - return sequence[2] - } - - index = next - - if (!sequence[1].test(line)) { - while (index < length) { - next = value.indexOf(lineFeed, index + 1) - next = next === -1 ? length : next - line = value.slice(index + 1, next) - - if (sequence[1].test(line)) { - if (line) { - index = next - } - - break - } - - index = next - } - } - - subvalue = value.slice(0, index) - - return eat(subvalue)({type: 'html', value: subvalue}) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/html-inline.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/html-inline.js deleted file mode 100644 index cca4fb40a36341..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/html-inline.js +++ /dev/null @@ -1,59 +0,0 @@ -'use strict' - -var alphabetical = require('is-alphabetical') -var locate = require('../locate/tag') -var tag = require('../util/html').tag - -module.exports = inlineHTML -inlineHTML.locator = locate - -var lessThan = '<' -var questionMark = '?' -var exclamationMark = '!' -var slash = '/' - -var htmlLinkOpenExpression = /^/i - -function inlineHTML(eat, value, silent) { - var self = this - var length = value.length - var character - var subvalue - - if (value.charAt(0) !== lessThan || length < 3) { - return - } - - character = value.charAt(1) - - if ( - !alphabetical(character) && - character !== questionMark && - character !== exclamationMark && - character !== slash - ) { - return - } - - subvalue = value.match(tag) - - if (!subvalue) { - return - } - - /* istanbul ignore if - not used yet. */ - if (silent) { - return true - } - - subvalue = subvalue[0] - - if (!self.inLink && htmlLinkOpenExpression.test(subvalue)) { - self.inLink = true - } else if (self.inLink && htmlLinkCloseExpression.test(subvalue)) { - self.inLink = false - } - - return eat(subvalue)({type: 'html', value: subvalue}) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/link.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/link.js deleted file mode 100644 index ab4d3fa3c5af54..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/link.js +++ /dev/null @@ -1,381 +0,0 @@ -'use strict' - -var whitespace = require('is-whitespace-character') -var locate = require('../locate/link') - -module.exports = link -link.locator = locate - -var lineFeed = '\n' -var exclamationMark = '!' -var quotationMark = '"' -var apostrophe = "'" -var leftParenthesis = '(' -var rightParenthesis = ')' -var lessThan = '<' -var greaterThan = '>' -var leftSquareBracket = '[' -var backslash = '\\' -var rightSquareBracket = ']' -var graveAccent = '`' - -function link(eat, value, silent) { - var self = this - var subvalue = '' - var index = 0 - var character = value.charAt(0) - var pedantic = self.options.pedantic - var commonmark = self.options.commonmark - var gfm = self.options.gfm - var closed - var count - var opening - var beforeURL - var beforeTitle - var subqueue - var hasMarker - var isImage - var content - var marker - var length - var title - var depth - var queue - var url - var now - var exit - var node - - // Detect whether this is an image. - if (character === exclamationMark) { - isImage = true - subvalue = character - character = value.charAt(++index) - } - - // Eat the opening. - if (character !== leftSquareBracket) { - return - } - - // Exit when this is a link and we’re already inside a link. - if (!isImage && self.inLink) { - return - } - - subvalue += character - queue = '' - index++ - - // Eat the content. - length = value.length - now = eat.now() - depth = 0 - - now.column += index - now.offset += index - - while (index < length) { - character = value.charAt(index) - subqueue = character - - if (character === graveAccent) { - // Inline-code in link content. - count = 1 - - while (value.charAt(index + 1) === graveAccent) { - subqueue += character - index++ - count++ - } - - if (!opening) { - opening = count - } else if (count >= opening) { - opening = 0 - } - } else if (character === backslash) { - // Allow brackets to be escaped. - index++ - subqueue += value.charAt(index) - } else if ((!opening || gfm) && character === leftSquareBracket) { - // In GFM mode, brackets in code still count. In all other modes, - // they don’t. - depth++ - } else if ((!opening || gfm) && character === rightSquareBracket) { - if (depth) { - depth-- - } else { - // Allow white-space between content and url in GFM mode. - if (!pedantic) { - while (index < length) { - character = value.charAt(index + 1) - - if (!whitespace(character)) { - break - } - - subqueue += character - index++ - } - } - - if (value.charAt(index + 1) !== leftParenthesis) { - return - } - - subqueue += leftParenthesis - closed = true - index++ - - break - } - } - - queue += subqueue - subqueue = '' - index++ - } - - // Eat the content closing. - if (!closed) { - return - } - - content = queue - subvalue += queue + subqueue - index++ - - // Eat white-space. - while (index < length) { - character = value.charAt(index) - - if (!whitespace(character)) { - break - } - - subvalue += character - index++ - } - - // Eat the URL. - character = value.charAt(index) - queue = '' - beforeURL = subvalue - - if (character === lessThan) { - index++ - beforeURL += lessThan - - while (index < length) { - character = value.charAt(index) - - if (character === greaterThan) { - break - } - - if (commonmark && character === lineFeed) { - return - } - - queue += character - index++ - } - - if (value.charAt(index) !== greaterThan) { - return - } - - subvalue += lessThan + queue + greaterThan - url = queue - index++ - } else { - character = null - subqueue = '' - - while (index < length) { - character = value.charAt(index) - - if ( - subqueue && - (character === quotationMark || - character === apostrophe || - (commonmark && character === leftParenthesis)) - ) { - break - } - - if (whitespace(character)) { - if (!pedantic) { - break - } - - subqueue += character - } else { - if (character === leftParenthesis) { - depth++ - } else if (character === rightParenthesis) { - if (depth === 0) { - break - } - - depth-- - } - - queue += subqueue - subqueue = '' - - if (character === backslash) { - queue += backslash - character = value.charAt(++index) - } - - queue += character - } - - index++ - } - - subvalue += queue - url = queue - index = subvalue.length - } - - // Eat white-space. - queue = '' - - while (index < length) { - character = value.charAt(index) - - if (!whitespace(character)) { - break - } - - queue += character - index++ - } - - character = value.charAt(index) - subvalue += queue - - // Eat the title. - if ( - queue && - (character === quotationMark || - character === apostrophe || - (commonmark && character === leftParenthesis)) - ) { - index++ - subvalue += character - queue = '' - marker = character === leftParenthesis ? rightParenthesis : character - beforeTitle = subvalue - - // In commonmark-mode, things are pretty easy: the marker cannot occur - // inside the title. Non-commonmark does, however, support nested - // delimiters. - if (commonmark) { - while (index < length) { - character = value.charAt(index) - - if (character === marker) { - break - } - - if (character === backslash) { - queue += backslash - character = value.charAt(++index) - } - - index++ - queue += character - } - - character = value.charAt(index) - - if (character !== marker) { - return - } - - title = queue - subvalue += queue + character - index++ - - while (index < length) { - character = value.charAt(index) - - if (!whitespace(character)) { - break - } - - subvalue += character - index++ - } - } else { - subqueue = '' - - while (index < length) { - character = value.charAt(index) - - if (character === marker) { - if (hasMarker) { - queue += marker + subqueue - subqueue = '' - } - - hasMarker = true - } else if (!hasMarker) { - queue += character - } else if (character === rightParenthesis) { - subvalue += queue + marker + subqueue - title = queue - break - } else if (whitespace(character)) { - subqueue += character - } else { - queue += marker + subqueue + character - subqueue = '' - hasMarker = false - } - - index++ - } - } - } - - if (value.charAt(index) !== rightParenthesis) { - return - } - - /* istanbul ignore if - never used (yet) */ - if (silent) { - return true - } - - subvalue += rightParenthesis - - url = self.decode.raw(self.unescape(url), eat(beforeURL).test().end, { - nonTerminated: false - }) - - if (title) { - beforeTitle = eat(beforeTitle).test().end - title = self.decode.raw(self.unescape(title), beforeTitle) - } - - node = { - type: isImage ? 'image' : 'link', - title: title || null, - url: url - } - - if (isImage) { - node.alt = self.decode.raw(self.unescape(content), now) || null - } else { - exit = self.enterLink() - node.children = self.tokenizeInline(content, now) - exit() - } - - return eat(subvalue)(node) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/list.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/list.js deleted file mode 100644 index 3eef0d668f0c2c..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/list.js +++ /dev/null @@ -1,451 +0,0 @@ -'use strict' - -var trim = require('trim') -var repeat = require('repeat-string') -var decimal = require('is-decimal') -var getIndent = require('../util/get-indentation') -var removeIndent = require('../util/remove-indentation') -var interrupt = require('../util/interrupt') - -module.exports = list - -var asterisk = '*' -var underscore = '_' -var plusSign = '+' -var dash = '-' -var dot = '.' -var space = ' ' -var lineFeed = '\n' -var tab = '\t' -var rightParenthesis = ')' -var lowercaseX = 'x' - -var tabSize = 4 -var looseListItemExpression = /\n\n(?!\s*$)/ -var taskItemExpression = /^\[([ \t]|x|X)][ \t]/ -var bulletExpression = /^([ \t]*)([*+-]|\d+[.)])( {1,4}(?! )| |\t|$|(?=\n))([^\n]*)/ -var pedanticBulletExpression = /^([ \t]*)([*+-]|\d+[.)])([ \t]+)/ -var initialIndentExpression = /^( {1,4}|\t)?/gm - -function list(eat, value, silent) { - var self = this - var commonmark = self.options.commonmark - var pedantic = self.options.pedantic - var tokenizers = self.blockTokenizers - var interuptors = self.interruptList - var index = 0 - var length = value.length - var start = null - var size = 0 - var queue - var ordered - var character - var marker - var nextIndex - var startIndex - var prefixed - var currentMarker - var content - var line - var prevEmpty - var empty - var items - var allLines - var emptyLines - var item - var enterTop - var exitBlockquote - var spread = false - var node - var now - var end - var indented - - while (index < length) { - character = value.charAt(index) - - if (character === tab) { - size += tabSize - (size % tabSize) - } else if (character === space) { - size++ - } else { - break - } - - index++ - } - - if (size >= tabSize) { - return - } - - character = value.charAt(index) - - if (character === asterisk || character === plusSign || character === dash) { - marker = character - ordered = false - } else { - ordered = true - queue = '' - - while (index < length) { - character = value.charAt(index) - - if (!decimal(character)) { - break - } - - queue += character - index++ - } - - character = value.charAt(index) - - if ( - !queue || - !(character === dot || (commonmark && character === rightParenthesis)) - ) { - return - } - - start = parseInt(queue, 10) - marker = character - } - - character = value.charAt(++index) - - if ( - character !== space && - character !== tab && - (pedantic || (character !== lineFeed && character !== '')) - ) { - return - } - - if (silent) { - return true - } - - index = 0 - items = [] - allLines = [] - emptyLines = [] - - while (index < length) { - nextIndex = value.indexOf(lineFeed, index) - startIndex = index - prefixed = false - indented = false - - if (nextIndex === -1) { - nextIndex = length - } - - end = index + tabSize - size = 0 - - while (index < length) { - character = value.charAt(index) - - if (character === tab) { - size += tabSize - (size % tabSize) - } else if (character === space) { - size++ - } else { - break - } - - index++ - } - - if (size >= tabSize) { - indented = true - } - - if (item && size >= item.indent) { - indented = true - } - - character = value.charAt(index) - currentMarker = null - - if (!indented) { - if ( - character === asterisk || - character === plusSign || - character === dash - ) { - currentMarker = character - index++ - size++ - } else { - queue = '' - - while (index < length) { - character = value.charAt(index) - - if (!decimal(character)) { - break - } - - queue += character - index++ - } - - character = value.charAt(index) - index++ - - if ( - queue && - (character === dot || (commonmark && character === rightParenthesis)) - ) { - currentMarker = character - size += queue.length + 1 - } - } - - if (currentMarker) { - character = value.charAt(index) - - if (character === tab) { - size += tabSize - (size % tabSize) - index++ - } else if (character === space) { - end = index + tabSize - - while (index < end) { - if (value.charAt(index) !== space) { - break - } - - index++ - size++ - } - - if (index === end && value.charAt(index) === space) { - index -= tabSize - 1 - size -= tabSize - 1 - } - } else if (character !== lineFeed && character !== '') { - currentMarker = null - } - } - } - - if (currentMarker) { - if (!pedantic && marker !== currentMarker) { - break - } - - prefixed = true - } else { - if (!commonmark && !indented && value.charAt(startIndex) === space) { - indented = true - } else if (commonmark && item) { - indented = size >= item.indent || size > tabSize - } - - prefixed = false - index = startIndex - } - - line = value.slice(startIndex, nextIndex) - content = startIndex === index ? line : value.slice(index, nextIndex) - - if ( - currentMarker === asterisk || - currentMarker === underscore || - currentMarker === dash - ) { - if (tokenizers.thematicBreak.call(self, eat, line, true)) { - break - } - } - - prevEmpty = empty - empty = !prefixed && !trim(content).length - - if (indented && item) { - item.value = item.value.concat(emptyLines, line) - allLines = allLines.concat(emptyLines, line) - emptyLines = [] - } else if (prefixed) { - if (emptyLines.length !== 0) { - spread = true - item.value.push('') - item.trail = emptyLines.concat() - } - - item = { - value: [line], - indent: size, - trail: [] - } - - items.push(item) - allLines = allLines.concat(emptyLines, line) - emptyLines = [] - } else if (empty) { - if (prevEmpty && !commonmark) { - break - } - - emptyLines.push(line) - } else { - if (prevEmpty) { - break - } - - if (interrupt(interuptors, tokenizers, self, [eat, line, true])) { - break - } - - item.value = item.value.concat(emptyLines, line) - allLines = allLines.concat(emptyLines, line) - emptyLines = [] - } - - index = nextIndex + 1 - } - - node = eat(allLines.join(lineFeed)).reset({ - type: 'list', - ordered: ordered, - start: start, - spread: spread, - children: [] - }) - - enterTop = self.enterList() - exitBlockquote = self.enterBlock() - index = -1 - length = items.length - - while (++index < length) { - item = items[index].value.join(lineFeed) - now = eat.now() - - eat(item)(listItem(self, item, now), node) - - item = items[index].trail.join(lineFeed) - - if (index !== length - 1) { - item += lineFeed - } - - eat(item) - } - - enterTop() - exitBlockquote() - - return node -} - -function listItem(ctx, value, position) { - var offsets = ctx.offset - var fn = ctx.options.pedantic ? pedanticListItem : normalListItem - var checked = null - var task - var indent - - value = fn.apply(null, arguments) - - if (ctx.options.gfm) { - task = value.match(taskItemExpression) - - if (task) { - indent = task[0].length - checked = task[1].toLowerCase() === lowercaseX - offsets[position.line] += indent - value = value.slice(indent) - } - } - - return { - type: 'listItem', - spread: looseListItemExpression.test(value), - checked: checked, - children: ctx.tokenizeBlock(value, position) - } -} - -// Create a list-item using overly simple mechanics. -function pedanticListItem(ctx, value, position) { - var offsets = ctx.offset - var line = position.line - - // Remove the list-item’s bullet. - value = value.replace(pedanticBulletExpression, replacer) - - // The initial line was also matched by the below, so we reset the `line`. - line = position.line - - return value.replace(initialIndentExpression, replacer) - - // A simple replacer which removed all matches, and adds their length to - // `offset`. - function replacer($0) { - offsets[line] = (offsets[line] || 0) + $0.length - line++ - - return '' - } -} - -// Create a list-item using sane mechanics. -function normalListItem(ctx, value, position) { - var offsets = ctx.offset - var line = position.line - var max - var bullet - var rest - var lines - var trimmedLines - var index - var length - - // Remove the list-item’s bullet. - value = value.replace(bulletExpression, replacer) - - lines = value.split(lineFeed) - - trimmedLines = removeIndent(value, getIndent(max).indent).split(lineFeed) - - // We replaced the initial bullet with something else above, which was used - // to trick `removeIndentation` into removing some more characters when - // possible. However, that could result in the initial line to be stripped - // more than it should be. - trimmedLines[0] = rest - - offsets[line] = (offsets[line] || 0) + bullet.length - line++ - - index = 0 - length = lines.length - - while (++index < length) { - offsets[line] = - (offsets[line] || 0) + lines[index].length - trimmedLines[index].length - line++ - } - - return trimmedLines.join(lineFeed) - - /* eslint-disable-next-line max-params */ - function replacer($0, $1, $2, $3, $4) { - bullet = $1 + $2 + $3 - rest = $4 - - // Make sure that the first nine numbered list items can indent with an - // extra space. That is, when the bullet did not receive an extra final - // space. - if (Number($2) < 10 && bullet.length % 2 === 1) { - $2 = space + $2 - } - - max = $1 + repeat(space, $2.length) + $3 - - return max + rest - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/newline.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/newline.js deleted file mode 100644 index 680020cf09f47d..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/newline.js +++ /dev/null @@ -1,48 +0,0 @@ -'use strict' - -var whitespace = require('is-whitespace-character') - -module.exports = newline - -var lineFeed = '\n' - -function newline(eat, value, silent) { - var character = value.charAt(0) - var length - var subvalue - var queue - var index - - if (character !== lineFeed) { - return - } - - /* istanbul ignore if - never used (yet) */ - if (silent) { - return true - } - - index = 1 - length = value.length - subvalue = character - queue = '' - - while (index < length) { - character = value.charAt(index) - - if (!whitespace(character)) { - break - } - - queue += character - - if (character === lineFeed) { - subvalue += queue - queue = '' - } - - index++ - } - - eat(subvalue) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/paragraph.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/paragraph.js deleted file mode 100644 index 13db0ff4065cde..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/paragraph.js +++ /dev/null @@ -1,117 +0,0 @@ -'use strict' - -var trim = require('trim') -var decimal = require('is-decimal') -var trimTrailingLines = require('trim-trailing-lines') -var interrupt = require('../util/interrupt') - -module.exports = paragraph - -var tab = '\t' -var lineFeed = '\n' -var space = ' ' - -var tabSize = 4 - -// Tokenise paragraph. -function paragraph(eat, value, silent) { - var self = this - var settings = self.options - var commonmark = settings.commonmark - var gfm = settings.gfm - var tokenizers = self.blockTokenizers - var interruptors = self.interruptParagraph - var index = value.indexOf(lineFeed) - var length = value.length - var position - var subvalue - var character - var size - var now - - while (index < length) { - // Eat everything if there’s no following newline. - if (index === -1) { - index = length - break - } - - // Stop if the next character is NEWLINE. - if (value.charAt(index + 1) === lineFeed) { - break - } - - // In commonmark-mode, following indented lines are part of the paragraph. - if (commonmark) { - size = 0 - position = index + 1 - - while (position < length) { - character = value.charAt(position) - - if (character === tab) { - size = tabSize - break - } else if (character === space) { - size++ - } else { - break - } - - position++ - } - - if (size >= tabSize && character !== lineFeed) { - index = value.indexOf(lineFeed, index + 1) - continue - } - } - - subvalue = value.slice(index + 1) - - // Check if the following code contains a possible block. - if (interrupt(interruptors, tokenizers, self, [eat, subvalue, true])) { - break - } - - // Break if the following line starts a list, when already in a list, or - // when in commonmark, or when in gfm mode and the bullet is *not* numeric. - if ( - tokenizers.list.call(self, eat, subvalue, true) && - (self.inList || - commonmark || - (gfm && !decimal(trim.left(subvalue).charAt(0)))) - ) { - break - } - - position = index - index = value.indexOf(lineFeed, index + 1) - - if (index !== -1 && trim(value.slice(position, index)) === '') { - index = position - break - } - } - - subvalue = value.slice(0, index) - - if (trim(subvalue) === '') { - eat(subvalue) - - return null - } - - /* istanbul ignore if - never used (yet) */ - if (silent) { - return true - } - - now = eat.now() - subvalue = trimTrailingLines(subvalue) - - return eat(subvalue)({ - type: 'paragraph', - children: self.tokenizeInline(subvalue, now) - }) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/reference.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/reference.js deleted file mode 100644 index fdf753f73198e8..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/reference.js +++ /dev/null @@ -1,221 +0,0 @@ -'use strict' - -var whitespace = require('is-whitespace-character') -var locate = require('../locate/link') -var normalize = require('../util/normalize') - -module.exports = reference -reference.locator = locate - -var link = 'link' -var image = 'image' -var footnote = 'footnote' -var shortcut = 'shortcut' -var collapsed = 'collapsed' -var full = 'full' -var space = ' ' -var exclamationMark = '!' -var leftSquareBracket = '[' -var backslash = '\\' -var rightSquareBracket = ']' -var caret = '^' - -function reference(eat, value, silent) { - var self = this - var commonmark = self.options.commonmark - var footnotes = self.options.footnotes - var character = value.charAt(0) - var index = 0 - var length = value.length - var subvalue = '' - var intro = '' - var type = link - var referenceType = shortcut - var content - var identifier - var now - var node - var exit - var queue - var bracketed - var depth - - // Check whether we’re eating an image. - if (character === exclamationMark) { - type = image - intro = character - character = value.charAt(++index) - } - - if (character !== leftSquareBracket) { - return - } - - index++ - intro += character - queue = '' - - // Check whether we’re eating a footnote. - if (footnotes && value.charAt(index) === caret) { - // Exit if `![^` is found, so the `!` will be seen as text after this, - // and we’ll enter this function again when `[^` is found. - if (type === image) { - return - } - - intro += caret - index++ - type = footnote - } - - // Eat the text. - depth = 0 - - while (index < length) { - character = value.charAt(index) - - if (character === leftSquareBracket) { - bracketed = true - depth++ - } else if (character === rightSquareBracket) { - if (!depth) { - break - } - - depth-- - } - - if (character === backslash) { - queue += backslash - character = value.charAt(++index) - } - - queue += character - index++ - } - - subvalue = queue - content = queue - character = value.charAt(index) - - if (character !== rightSquareBracket) { - return - } - - index++ - subvalue += character - queue = '' - - if (!commonmark) { - // The original markdown syntax definition explicitly allows for whitespace - // between the link text and link label; commonmark departs from this, in - // part to improve support for shortcut reference links - while (index < length) { - character = value.charAt(index) - - if (!whitespace(character)) { - break - } - - queue += character - index++ - } - } - - character = value.charAt(index) - - // Inline footnotes cannot have a label. - // If footnotes are enabled, link labels cannot start with a caret. - if ( - type !== footnote && - character === leftSquareBracket && - (!footnotes || value.charAt(index + 1) !== caret) - ) { - identifier = '' - queue += character - index++ - - while (index < length) { - character = value.charAt(index) - - if (character === leftSquareBracket || character === rightSquareBracket) { - break - } - - if (character === backslash) { - identifier += backslash - character = value.charAt(++index) - } - - identifier += character - index++ - } - - character = value.charAt(index) - - if (character === rightSquareBracket) { - referenceType = identifier ? full : collapsed - queue += identifier + character - index++ - } else { - identifier = '' - } - - subvalue += queue - queue = '' - } else { - if (!content) { - return - } - - identifier = content - } - - // Brackets cannot be inside the identifier. - if (referenceType !== full && bracketed) { - return - } - - subvalue = intro + subvalue - - if (type === link && self.inLink) { - return null - } - - /* istanbul ignore if - never used (yet) */ - if (silent) { - return true - } - - if (type === footnote && content.indexOf(space) !== -1) { - return eat(subvalue)({ - type: footnote, - children: this.tokenizeInline(content, eat.now()) - }) - } - - now = eat.now() - now.column += intro.length - now.offset += intro.length - identifier = referenceType === full ? identifier : content - - node = { - type: type + 'Reference', - identifier: normalize(identifier), - label: identifier - } - - if (type === link || type === image) { - node.referenceType = referenceType - } - - if (type === link) { - exit = self.enterLink() - node.children = self.tokenizeInline(content, now) - exit() - } else if (type === image) { - node.alt = self.decode.raw(self.unescape(content), now) || null - } - - return eat(subvalue)(node) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/strong.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/strong.js deleted file mode 100644 index 3e36462a774aa2..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/strong.js +++ /dev/null @@ -1,85 +0,0 @@ -'use strict' - -var trim = require('trim') -var whitespace = require('is-whitespace-character') -var locate = require('../locate/strong') - -module.exports = strong -strong.locator = locate - -var backslash = '\\' -var asterisk = '*' -var underscore = '_' - -function strong(eat, value, silent) { - var self = this - var index = 0 - var character = value.charAt(index) - var now - var pedantic - var marker - var queue - var subvalue - var length - var prev - - if ( - (character !== asterisk && character !== underscore) || - value.charAt(++index) !== character - ) { - return - } - - pedantic = self.options.pedantic - marker = character - subvalue = marker + marker - length = value.length - index++ - queue = '' - character = '' - - if (pedantic && whitespace(value.charAt(index))) { - return - } - - while (index < length) { - prev = character - character = value.charAt(index) - - if ( - character === marker && - value.charAt(index + 1) === marker && - (!pedantic || !whitespace(prev)) - ) { - character = value.charAt(index + 2) - - if (character !== marker) { - if (!trim(queue)) { - return - } - - /* istanbul ignore if - never used (yet) */ - if (silent) { - return true - } - - now = eat.now() - now.column += 2 - now.offset += 2 - - return eat(subvalue + queue + subvalue)({ - type: 'strong', - children: self.tokenizeInline(queue, now) - }) - } - } - - if (!pedantic && character === backslash) { - queue += character - character = value.charAt(++index) - } - - queue += character - index++ - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/table.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/table.js deleted file mode 100644 index ba165d78e8336c..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/table.js +++ /dev/null @@ -1,232 +0,0 @@ -'use strict' - -var whitespace = require('is-whitespace-character') - -module.exports = table - -var tab = '\t' -var lineFeed = '\n' -var space = ' ' -var dash = '-' -var colon = ':' -var backslash = '\\' -var verticalBar = '|' - -var minColumns = 1 -var minRows = 2 - -var left = 'left' -var center = 'center' -var right = 'right' - -function table(eat, value, silent) { - var self = this - var index - var alignments - var alignment - var subvalue - var row - var length - var lines - var queue - var character - var hasDash - var align - var cell - var preamble - var now - var position - var lineCount - var line - var rows - var table - var lineIndex - var pipeIndex - var first - - // Exit when not in gfm-mode. - if (!self.options.gfm) { - return - } - - // Get the rows. - // Detecting tables soon is hard, so there are some checks for performance - // here, such as the minimum number of rows, and allowed characters in the - // alignment row. - index = 0 - lineCount = 0 - length = value.length + 1 - lines = [] - - while (index < length) { - lineIndex = value.indexOf(lineFeed, index) - pipeIndex = value.indexOf(verticalBar, index + 1) - - if (lineIndex === -1) { - lineIndex = value.length - } - - if (pipeIndex === -1 || pipeIndex > lineIndex) { - if (lineCount < minRows) { - return - } - - break - } - - lines.push(value.slice(index, lineIndex)) - lineCount++ - index = lineIndex + 1 - } - - // Parse the alignment row. - subvalue = lines.join(lineFeed) - alignments = lines.splice(1, 1)[0] || [] - index = 0 - length = alignments.length - lineCount-- - alignment = false - align = [] - - while (index < length) { - character = alignments.charAt(index) - - if (character === verticalBar) { - hasDash = null - - if (alignment === false) { - if (first === false) { - return - } - } else { - align.push(alignment) - alignment = false - } - - first = false - } else if (character === dash) { - hasDash = true - alignment = alignment || null - } else if (character === colon) { - if (alignment === left) { - alignment = center - } else if (hasDash && alignment === null) { - alignment = right - } else { - alignment = left - } - } else if (!whitespace(character)) { - return - } - - index++ - } - - if (alignment !== false) { - align.push(alignment) - } - - // Exit when without enough columns. - if (align.length < minColumns) { - return - } - - /* istanbul ignore if - never used (yet) */ - if (silent) { - return true - } - - // Parse the rows. - position = -1 - rows = [] - - table = eat(subvalue).reset({type: 'table', align: align, children: rows}) - - while (++position < lineCount) { - line = lines[position] - row = {type: 'tableRow', children: []} - - // Eat a newline character when this is not the first row. - if (position) { - eat(lineFeed) - } - - // Eat the row. - eat(line).reset(row, table) - - length = line.length + 1 - index = 0 - queue = '' - cell = '' - preamble = true - - while (index < length) { - character = line.charAt(index) - - if (character === tab || character === space) { - if (cell) { - queue += character - } else { - eat(character) - } - - index++ - continue - } - - if (character === '' || character === verticalBar) { - if (preamble) { - eat(character) - } else { - if ((cell || character) && !preamble) { - subvalue = cell - - if (queue.length > 1) { - if (character) { - subvalue += queue.slice(0, queue.length - 1) - queue = queue.charAt(queue.length - 1) - } else { - subvalue += queue - queue = '' - } - } - - now = eat.now() - - eat(subvalue)( - {type: 'tableCell', children: self.tokenizeInline(cell, now)}, - row - ) - } - - eat(queue + character) - - queue = '' - cell = '' - } - } else { - if (queue) { - cell += queue - queue = '' - } - - cell += character - - if (character === backslash && index !== length - 2) { - cell += line.charAt(index + 1) - index++ - } - } - - preamble = false - index++ - } - - // Eat the alignment row. - if (!position) { - eat(lineFeed + alignments) - } - } - - return table -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/text.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/text.js deleted file mode 100644 index c9085ee3011d0e..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/text.js +++ /dev/null @@ -1,57 +0,0 @@ -'use strict' - -module.exports = text - -function text(eat, value, silent) { - var self = this - var methods - var tokenizers - var index - var length - var subvalue - var position - var tokenizer - var name - var min - var now - - /* istanbul ignore if - never used (yet) */ - if (silent) { - return true - } - - methods = self.inlineMethods - length = methods.length - tokenizers = self.inlineTokenizers - index = -1 - min = value.length - - while (++index < length) { - name = methods[index] - - if (name === 'text' || !tokenizers[name]) { - continue - } - - tokenizer = tokenizers[name].locator - - if (!tokenizer) { - eat.file.fail('Missing locator: `' + name + '`') - } - - position = tokenizer.call(self, value, 1) - - if (position !== -1 && position < min) { - min = position - } - } - - subvalue = value.slice(0, min) - now = eat.now() - - self.decode(subvalue, now, handler) - - function handler(content, position, source) { - eat(source || content)({type: 'text', value: content}) - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/thematic-break.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/thematic-break.js deleted file mode 100644 index 6844c8c705af8c..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/thematic-break.js +++ /dev/null @@ -1,70 +0,0 @@ -'use strict' - -module.exports = thematicBreak - -var tab = '\t' -var lineFeed = '\n' -var space = ' ' -var asterisk = '*' -var dash = '-' -var underscore = '_' - -var maxCount = 3 - -function thematicBreak(eat, value, silent) { - var index = -1 - var length = value.length + 1 - var subvalue = '' - var character - var marker - var markerCount - var queue - - while (++index < length) { - character = value.charAt(index) - - if (character !== tab && character !== space) { - break - } - - subvalue += character - } - - if ( - character !== asterisk && - character !== dash && - character !== underscore - ) { - return - } - - marker = character - subvalue += character - markerCount = 1 - queue = '' - - while (++index < length) { - character = value.charAt(index) - - if (character === marker) { - markerCount++ - subvalue += queue + marker - queue = '' - } else if (character === space) { - queue += character - } else if ( - markerCount >= maxCount && - (!character || character === lineFeed) - ) { - subvalue += queue - - if (silent) { - return true - } - - return eat(subvalue)({type: 'thematicBreak'}) - } else { - return - } - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/url.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/url.js deleted file mode 100644 index 92d1c6229bb27c..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenize/url.js +++ /dev/null @@ -1,153 +0,0 @@ -'use strict' - -var decode = require('parse-entities') -var whitespace = require('is-whitespace-character') -var locate = require('../locate/url') - -module.exports = url -url.locator = locate -url.notInLink = true - -var quotationMark = '"' -var apostrophe = "'" -var leftParenthesis = '(' -var rightParenthesis = ')' -var comma = ',' -var dot = '.' -var colon = ':' -var semicolon = ';' -var lessThan = '<' -var atSign = '@' -var leftSquareBracket = '[' -var rightSquareBracket = ']' - -var http = 'http://' -var https = 'https://' -var mailto = 'mailto:' - -var protocols = [http, https, mailto] - -var protocolsLength = protocols.length - -function url(eat, value, silent) { - var self = this - var subvalue - var content - var character - var index - var position - var protocol - var match - var length - var queue - var parenCount - var nextCharacter - var tokenizers - var exit - - if (!self.options.gfm) { - return - } - - subvalue = '' - index = -1 - - while (++index < protocolsLength) { - protocol = protocols[index] - match = value.slice(0, protocol.length) - - if (match.toLowerCase() === protocol) { - subvalue = match - break - } - } - - if (!subvalue) { - return - } - - index = subvalue.length - length = value.length - queue = '' - parenCount = 0 - - while (index < length) { - character = value.charAt(index) - - if (whitespace(character) || character === lessThan) { - break - } - - if ( - character === dot || - character === comma || - character === colon || - character === semicolon || - character === quotationMark || - character === apostrophe || - character === rightParenthesis || - character === rightSquareBracket - ) { - nextCharacter = value.charAt(index + 1) - - if (!nextCharacter || whitespace(nextCharacter)) { - break - } - } - - if (character === leftParenthesis || character === leftSquareBracket) { - parenCount++ - } - - if (character === rightParenthesis || character === rightSquareBracket) { - parenCount-- - - if (parenCount < 0) { - break - } - } - - queue += character - index++ - } - - if (!queue) { - return - } - - subvalue += queue - content = subvalue - - if (protocol === mailto) { - position = queue.indexOf(atSign) - - if (position === -1 || position === length - 1) { - return - } - - content = content.slice(mailto.length) - } - - /* istanbul ignore if - never used (yet) */ - if (silent) { - return true - } - - exit = self.enterLink() - - // Temporarily remove all tokenizers except text in url. - tokenizers = self.inlineTokenizers - self.inlineTokenizers = {text: tokenizers.text} - - content = self.tokenizeInline(content, eat.now()) - - self.inlineTokenizers = tokenizers - exit() - - return eat(subvalue)({ - type: 'link', - title: null, - url: decode(subvalue, {nonTerminated: false}), - children: content - }) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenizer.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenizer.js deleted file mode 100644 index a4e2b4cf965090..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/tokenizer.js +++ /dev/null @@ -1,314 +0,0 @@ -'use strict' - -module.exports = factory - -// Construct a tokenizer. This creates both `tokenizeInline` and `tokenizeBlock`. -function factory(type) { - return tokenize - - // Tokenizer for a bound `type`. - function tokenize(value, location) { - var self = this - var offset = self.offset - var tokens = [] - var methods = self[type + 'Methods'] - var tokenizers = self[type + 'Tokenizers'] - var line = location.line - var column = location.column - var index - var length - var method - var name - var matched - var valueLength - - // Trim white space only lines. - if (!value) { - return tokens - } - - // Expose on `eat`. - eat.now = now - eat.file = self.file - - // Sync initial offset. - updatePosition('') - - // Iterate over `value`, and iterate over all tokenizers. When one eats - // something, re-iterate with the remaining value. If no tokenizer eats, - // something failed (should not happen) and an exception is thrown. - while (value) { - index = -1 - length = methods.length - matched = false - - while (++index < length) { - name = methods[index] - method = tokenizers[name] - - if ( - method && - /* istanbul ignore next */ (!method.onlyAtStart || self.atStart) && - (!method.notInList || !self.inList) && - (!method.notInBlock || !self.inBlock) && - (!method.notInLink || !self.inLink) - ) { - valueLength = value.length - - method.apply(self, [eat, value]) - - matched = valueLength !== value.length - - if (matched) { - break - } - } - } - - /* istanbul ignore if */ - if (!matched) { - self.file.fail(new Error('Infinite loop'), eat.now()) - } - } - - self.eof = now() - - return tokens - - // Update line, column, and offset based on `value`. - function updatePosition(subvalue) { - var lastIndex = -1 - var index = subvalue.indexOf('\n') - - while (index !== -1) { - line++ - lastIndex = index - index = subvalue.indexOf('\n', index + 1) - } - - if (lastIndex === -1) { - column += subvalue.length - } else { - column = subvalue.length - lastIndex - } - - if (line in offset) { - if (lastIndex !== -1) { - column += offset[line] - } else if (column <= offset[line]) { - column = offset[line] + 1 - } - } - } - - // Get offset. Called before the first character is eaten to retrieve the - // range’s offsets. - function getOffset() { - var indentation = [] - var pos = line + 1 - - // Done. Called when the last character is eaten to retrieve the range’s - // offsets. - return function() { - var last = line + 1 - - while (pos < last) { - indentation.push((offset[pos] || 0) + 1) - - pos++ - } - - return indentation - } - } - - // Get the current position. - function now() { - var pos = {line: line, column: column} - - pos.offset = self.toOffset(pos) - - return pos - } - - // Store position information for a node. - function Position(start) { - this.start = start - this.end = now() - } - - // Throw when a value is incorrectly eaten. This shouldn’t happen but will - // throw on new, incorrect rules. - function validateEat(subvalue) { - /* istanbul ignore if */ - if (value.slice(0, subvalue.length) !== subvalue) { - // Capture stack-trace. - self.file.fail( - new Error( - 'Incorrectly eaten value: please report this warning on https://git.io/vg5Ft' - ), - now() - ) - } - } - - // Mark position and patch `node.position`. - function position() { - var before = now() - - return update - - // Add the position to a node. - function update(node, indent) { - var prev = node.position - var start = prev ? prev.start : before - var combined = [] - var n = prev && prev.end.line - var l = before.line - - node.position = new Position(start) - - // If there was already a `position`, this node was merged. Fixing - // `start` wasn’t hard, but the indent is different. Especially - // because some information, the indent between `n` and `l` wasn’t - // tracked. Luckily, that space is (should be?) empty, so we can - // safely check for it now. - if (prev && indent && prev.indent) { - combined = prev.indent - - if (n < l) { - while (++n < l) { - combined.push((offset[n] || 0) + 1) - } - - combined.push(before.column) - } - - indent = combined.concat(indent) - } - - node.position.indent = indent || [] - - return node - } - } - - // Add `node` to `parent`s children or to `tokens`. Performs merges where - // possible. - function add(node, parent) { - var children = parent ? parent.children : tokens - var prev = children[children.length - 1] - var fn - - if ( - prev && - node.type === prev.type && - (node.type === 'text' || node.type === 'blockquote') && - mergeable(prev) && - mergeable(node) - ) { - fn = node.type === 'text' ? mergeText : mergeBlockquote - node = fn.call(self, prev, node) - } - - if (node !== prev) { - children.push(node) - } - - if (self.atStart && tokens.length !== 0) { - self.exitStart() - } - - return node - } - - // Remove `subvalue` from `value`. `subvalue` must be at the start of - // `value`. - function eat(subvalue) { - var indent = getOffset() - var pos = position() - var current = now() - - validateEat(subvalue) - - apply.reset = reset - reset.test = test - apply.test = test - - value = value.slice(subvalue.length) - - updatePosition(subvalue) - - indent = indent() - - return apply - - // Add the given arguments, add `position` to the returned node, and - // return the node. - function apply(node, parent) { - return pos(add(pos(node), parent), indent) - } - - // Functions just like apply, but resets the content: the line and - // column are reversed, and the eaten value is re-added. This is - // useful for nodes with a single type of content, such as lists and - // tables. See `apply` above for what parameters are expected. - function reset() { - var node = apply.apply(null, arguments) - - line = current.line - column = current.column - value = subvalue + value - - return node - } - - // Test the position, after eating, and reverse to a not-eaten state. - function test() { - var result = pos({}) - - line = current.line - column = current.column - value = subvalue + value - - return result.position - } - } - } -} - -// Check whether a node is mergeable with adjacent nodes. -function mergeable(node) { - var start - var end - - if (node.type !== 'text' || !node.position) { - return true - } - - start = node.position.start - end = node.position.end - - // Only merge nodes which occupy the same size as their `value`. - return ( - start.line !== end.line || end.column - start.column === node.value.length - ) -} - -// Merge two text nodes: `node` into `prev`. -function mergeText(prev, node) { - prev.value += node.value - - return prev -} - -// Merge two blockquotes: `node` into `prev`, unless in CommonMark or gfm modes. -function mergeBlockquote(prev, node) { - if (this.options.commonmark || this.options.gfm) { - return node - } - - prev.children = prev.children.concat(node.children) - - return prev -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/unescape.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/unescape.js deleted file mode 100644 index 90cdb74c09925b..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/unescape.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict' - -module.exports = factory - -var backslash = '\\' - -// Factory to de-escape a value, based on a list at `key` in `ctx`. -function factory(ctx, key) { - return unescape - - // De-escape a string using the expression at `key` in `ctx`. - function unescape(value) { - var prev = 0 - var index = value.indexOf(backslash) - var escape = ctx[key] - var queue = [] - var character - - while (index !== -1) { - queue.push(value.slice(prev, index)) - prev = index + 1 - character = value.charAt(prev) - - // If the following character is not a valid escape, add the slash. - if (!character || escape.indexOf(character) === -1) { - queue.push(backslash) - } - - index = value.indexOf(backslash, prev + 1) - } - - queue.push(value.slice(prev)) - - return queue.join('') - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/util/get-indentation.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/util/get-indentation.js deleted file mode 100644 index 5ab3efd73f7d00..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/util/get-indentation.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict' - -module.exports = indentation - -var tab = '\t' -var space = ' ' - -var spaceSize = 1 -var tabSize = 4 - -// Gets indentation information for a line. -function indentation(value) { - var index = 0 - var indent = 0 - var character = value.charAt(index) - var stops = {} - var size - - while (character === tab || character === space) { - size = character === tab ? tabSize : spaceSize - - indent += size - - if (size > 1) { - indent = Math.floor(indent / size) * size - } - - stops[indent] = index - character = value.charAt(++index) - } - - return {indent: indent, stops: stops} -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/util/html.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/util/html.js deleted file mode 100644 index 49b7a38fca1746..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/util/html.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict' - -var attributeName = '[a-zA-Z_:][a-zA-Z0-9:._-]*' -var unquoted = '[^"\'=<>`\\u0000-\\u0020]+' -var singleQuoted = "'[^']*'" -var doubleQuoted = '"[^"]*"' -var attributeValue = - '(?:' + unquoted + '|' + singleQuoted + '|' + doubleQuoted + ')' -var attribute = - '(?:\\s+' + attributeName + '(?:\\s*=\\s*' + attributeValue + ')?)' -var openTag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>' -var closeTag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>' -var comment = '|' -var processing = '<[?].*?[?]>' -var declaration = ']*>' -var cdata = '' - -exports.openCloseTag = new RegExp('^(?:' + openTag + '|' + closeTag + ')') - -exports.tag = new RegExp( - '^(?:' + - openTag + - '|' + - closeTag + - '|' + - comment + - '|' + - processing + - '|' + - declaration + - '|' + - cdata + - ')' -) diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/util/interrupt.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/util/interrupt.js deleted file mode 100644 index e707c8b13c394d..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/util/interrupt.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict' - -module.exports = interrupt - -function interrupt(interruptors, tokenizers, ctx, params) { - var length = interruptors.length - var index = -1 - var interruptor - var config - - while (++index < length) { - interruptor = interruptors[index] - config = interruptor[1] || {} - - if ( - config.pedantic !== undefined && - config.pedantic !== ctx.options.pedantic - ) { - continue - } - - if ( - config.commonmark !== undefined && - config.commonmark !== ctx.options.commonmark - ) { - continue - } - - if (tokenizers[interruptor[0]].apply(ctx, params)) { - return true - } - } - - return false -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/util/is-markdown-whitespace-character.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/util/is-markdown-whitespace-character.js deleted file mode 100644 index ff6f4bbd4b91ed..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/util/is-markdown-whitespace-character.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' - -module.exports = whitespace - -var tab = 9 // '\t' -var lineFeed = 10 // '\n' -var lineTabulation = 11 // '\v' -var formFeed = 12 // '\f' -var carriageReturn = 13 // '\r' -var space = 32 // ' ' - -function whitespace(char) { - /* istanbul ignore next - `number` handling for future */ - var code = typeof char === 'number' ? char : char.charCodeAt(0) - - switch (code) { - case tab: - case lineFeed: - case lineTabulation: - case formFeed: - case carriageReturn: - case space: - return true - default: - return false - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/util/normalize.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/util/normalize.js deleted file mode 100644 index 7057c0a1e5e737..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/util/normalize.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict' - -var collapseWhiteSpace = require('collapse-white-space') - -module.exports = normalize - -// Normalize an identifier. Collapses multiple white space characters into a -// single space, and removes casing. -function normalize(value) { - return collapseWhiteSpace(value).toLowerCase() -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/util/remove-indentation.js b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/util/remove-indentation.js deleted file mode 100644 index 06b6a781dfd61f..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/lib/util/remove-indentation.js +++ /dev/null @@ -1,77 +0,0 @@ -'use strict' - -var trim = require('trim') -var repeat = require('repeat-string') -var getIndent = require('./get-indentation') - -module.exports = indentation - -var tab = '\t' -var lineFeed = '\n' -var space = ' ' -var exclamationMark = '!' - -// Remove the minimum indent from every line in `value`. Supports both tab, -// spaced, and mixed indentation (as well as possible). -function indentation(value, maximum) { - var values = value.split(lineFeed) - var position = values.length + 1 - var minIndent = Infinity - var matrix = [] - var index - var indentation - var stops - var padding - - values.unshift(repeat(space, maximum) + exclamationMark) - - while (position--) { - indentation = getIndent(values[position]) - - matrix[position] = indentation.stops - - if (trim(values[position]).length === 0) { - continue - } - - if (indentation.indent) { - if (indentation.indent > 0 && indentation.indent < minIndent) { - minIndent = indentation.indent - } - } else { - minIndent = Infinity - - break - } - } - - if (minIndent !== Infinity) { - position = values.length - - while (position--) { - stops = matrix[position] - index = minIndent - - while (index && !(index in stops)) { - index-- - } - - if ( - trim(values[position]).length !== 0 && - minIndent && - index !== minIndent - ) { - padding = tab - } else { - padding = '' - } - - values[position] = - padding + values[position].slice(index in stops ? stops[index] + 1 : 0) - } - } - - values.shift() - - return values.join(lineFeed) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/package.json deleted file mode 100644 index e5fc0656ccf665..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "remark-parse", - "version": "7.0.2", - "description": "remark plugin to parse Markdown", - "license": "MIT", - "keywords": [ - "unified", - "remark", - "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/master/packages/remark-parse", - "bugs": "https://github.com/remarkjs/remark/issues", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - }, - "author": "Titus Wormer (https://wooorm.com)", - "contributors": [ - "Titus Wormer (https://wooorm.com)", - "Eugene Sharygin ", - "Junyoung Choi ", - "Elijah Hamovitz ", - "Ika " - ], - "files": [ - "index.js", - "lib", - "types/index.d.ts" - ], - "dependencies": { - "collapse-white-space": "^1.0.2", - "is-alphabetical": "^1.0.0", - "is-decimal": "^1.0.0", - "is-whitespace-character": "^1.0.0", - "is-word-character": "^1.0.0", - "markdown-escapes": "^1.0.0", - "parse-entities": "^1.1.0", - "repeat-string": "^1.5.4", - "state-toggle": "^1.0.0", - "trim": "0.0.1", - "trim-trailing-lines": "^1.0.0", - "unherit": "^1.0.4", - "unist-util-remove-position": "^1.0.0", - "vfile-location": "^2.0.0", - "xtend": "^4.0.1" - }, - "scripts": { - "test": "tape test.js" - }, - "xo": false -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/readme.md deleted file mode 100644 index f9d1e8ae5751a4..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/remark-parse/readme.md +++ /dev/null @@ -1,597 +0,0 @@ -# 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. -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. - -## Sponsors - - - - - - - - - - - -
    - -

    🥇 - ZEIT -
    - -

    🥇 - Gatsby -
    - -

    🥇 - Netlify -
    - -

    - Holloway -
    -



    - You? -
    - -[**Read more about the unified collective on Medium »**][announcement] - -## 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, {commonmark: true}) - .use(remark2rehype) - .use(html) - -process.stdin.pipe(createStream(processor)).pipe(process.stdout) -``` - -[See **unified** for more examples »][unified] - -## Table of Contents - -* [API](#api) - * [`processor().use(parse[, options])`](#processoruseparse-options) - * [`parse.Parser`](#parseparser) -* [Extending the Parser](#extending-the-parser) - * [`Parser#blockTokenizers`](#parserblocktokenizers) - * [`Parser#blockMethods`](#parserblockmethods) - * [`Parser#inlineTokenizers`](#parserinlinetokenizers) - * [`Parser#inlineMethods`](#parserinlinemethods) - * [`function tokenizer(eat, value, silent)`](#function-tokenizereat-value-silent) - * [`tokenizer.locator(value, fromIndex)`](#tokenizerlocatorvalue-fromindex) - * [`eat(subvalue)`](#eatsubvalue) - * [`add(node[, parent])`](#addnode-parent) - * [`add.test()`](#addtest) - * [`add.reset(node[, parent])`](#addresetnode-parent) - * [Turning off a tokenizer](#turning-off-a-tokenizer) -* [Security](#security) -* [Contribute](#contribute) -* [License](#license) - -## API - -[See **unified** for API docs »][unified] - -### `processor().use(parse[, options])` - -Configure the `processor` to read Markdown as input and process -[**mdast**][mdast] syntax trees. - -##### `options` - -Options can be passed directly, or passed later through -[`processor.data()`][data]. - -###### `options.gfm` - -GFM mode (`boolean`, default: `true`). - -```markdown -hello ~~hi~~ world -``` - -Turns on: - -* [Fenced code blocks](https://help.github.com/articles/creating-and-highlighting-code-blocks#fenced-code-blocks) -* [Autolinking of URLs](https://help.github.com/articles/autolinked-references-and-urls) -* [Deletions (strikethrough)](https://help.github.com/articles/basic-writing-and-formatting-syntax#styling-text) -* [Task lists](https://help.github.com/articles/basic-writing-and-formatting-syntax#task-lists) -* [Tables](https://help.github.com/articles/organizing-information-with-tables) - -###### `options.commonmark` - -CommonMark mode (`boolean`, default: `false`). - -```markdown -This is a paragraph - and this is also part of the preceding paragraph. -``` - -Allows: - -* Empty lines to split blockquotes -* Parentheses (`(` and `)`) around link and image titles -* Any escaped [ASCII punctuation][escapes] character -* Closing parenthesis (`)`) as an ordered list marker -* URL definitions (and footnotes, when enabled) in blockquotes - -Disallows: - -* Indented code blocks directly following a paragraph -* ATX headings (`# Hash headings`) without spacing after opening hashes or and - before closing hashes -* Setext headings (`Underline headings\n---`) when following a paragraph -* Newlines in link and image titles -* White space in link and image URLs in auto-links (links in brackets, `<` and - `>`) -* Lazy blockquote continuation, lines not preceded by a greater than character - (`>`), for lists, code, and thematic breaks - -###### `options.footnotes` - -Footnotes mode (`boolean`, default: `false`). - -```markdown -Something something[^or something?]. - -And something else[^1]. - -[^1]: This reference footnote contains a paragraph... - - * ...and a list -``` - -Enables reference footnotes and inline footnotes. -Both are wrapped in square brackets and preceded by a caret (`^`), and can be -referenced from inside other footnotes. - -###### `options.pedantic` - -Pedantic mode (`boolean`, default: `false`). - -```markdown -Check out some_file_name.txt -``` - -Turns on: - -* Emphasis (`_alpha_`) and importance (`__bravo__`) with underscores in words -* Unordered lists with different markers (`*`, `-`, `+`) -* If `commonmark` is also turned on, ordered lists with different markers - (`.`, `)`) -* And removes less spaces in list items (at most four, instead of the whole - indent) - -###### `options.blocks` - -Blocks (`Array.`, default: list of [block HTML elements][blocks]). - -```markdown -foo - -``` - -Defines which HTML elements are seen as block level. - -### `parse.Parser` - -Access to the [parser][], if you need it. - -## Extending the Parser - -Typically, using [*transformers*][transformer] to manipulate a syntax tree -produces the desired output. -Sometimes, such as when introducing new syntactic entities with a certain -precedence, interfacing with the parser is necessary. - -If the `remark-parse` plugin is used, it adds a [`Parser`][parser] constructor -function to the `processor`. -Other plugins can add tokenizers to its prototype to change how Markdown is -parsed. - -The below plugin adds a [tokenizer][] for at-mentions. - -```js -module.exports = mentions - -function mentions() { - var Parser = this.Parser - var tokenizers = Parser.prototype.inlineTokenizers - var methods = Parser.prototype.inlineMethods - - // Add an inline tokenizer (defined in the following example). - tokenizers.mention = tokenizeMention - - // Run it just before `text`. - methods.splice(methods.indexOf('text'), 0, 'mention') -} -``` - -### `Parser#blockTokenizers` - -Map of names to [tokenizer][]s (`Object.`). -These tokenizers (such as `fencedCode`, `table`, and `paragraph`) eat from the -start of a value to a line ending. - -See `#blockMethods` below for a list of methods that are included by default. - -### `Parser#blockMethods` - -List of `blockTokenizers` names (`Array.`). -Specifies the order in which tokenizers run. - -Precedence of default block methods is as follows: - - - -* `newline` -* `indentedCode` -* `fencedCode` -* `blockquote` -* `atxHeading` -* `thematicBreak` -* `list` -* `setextHeading` -* `html` -* `footnote` -* `definition` -* `table` -* `paragraph` - - - -### `Parser#inlineTokenizers` - -Map of names to [tokenizer][]s (`Object.`). -These tokenizers (such as `url`, `reference`, and `emphasis`) eat from the start -of a value. -To increase performance, they depend on [locator][]s. - -See `#inlineMethods` below for a list of methods that are included by default. - -### `Parser#inlineMethods` - -List of `inlineTokenizers` names (`Array.`). -Specifies the order in which tokenizers run. - -Precedence of default inline methods is as follows: - - - -* `escape` -* `autoLink` -* `url` -* `html` -* `link` -* `reference` -* `strong` -* `emphasis` -* `deletion` -* `code` -* `break` -* `text` - - - -### `function tokenizer(eat, value, silent)` - -There are two types of tokenizers: block level and inline level. -Both are functions, and work the same, but inline tokenizers must have a -[locator][]. - -The following example shows an inline tokenizer that is added by the mentions -plugin above. - -```js -tokenizeMention.notInLink = true -tokenizeMention.locator = locateMention - -function tokenizeMention(eat, value, silent) { - var match = /^@(\w+)/.exec(value) - - if (match) { - if (silent) { - return true - } - - return eat(match[0])({ - type: 'link', - url: 'https://social-network/' + match[1], - children: [{type: 'text', value: match[0]}] - }) - } -} -``` - -Tokenizers *test* whether a document starts with a certain syntactic entity. -In *silent* mode, they return whether that test passes. -In *normal* mode, they consume that token, a process which is called “eating”. - -Locators enable inline tokenizers to function faster by providing where the next -entity may occur. - -###### Signatures - -* `Node? = tokenizer(eat, value)` -* `boolean? = tokenizer(eat, value, silent)` - -###### Parameters - -* `eat` ([`Function`][eat]) — Eat, when applicable, an entity -* `value` (`string`) — Value which may start an entity -* `silent` (`boolean`, optional) — Whether to detect or consume - -###### Properties - -* `locator` ([`Function`][locator]) — Required for inline tokenizers -* `onlyAtStart` (`boolean`) — Whether nodes can only be found at the beginning - of the document -* `notInBlock` (`boolean`) — Whether nodes cannot be in blockquotes, lists, or - footnote definitions -* `notInList` (`boolean`) — Whether nodes cannot be in lists -* `notInLink` (`boolean`) — Whether nodes cannot be in links - -###### Returns - -* `boolean?`, in *silent* mode — whether a node can be found at the start of - `value` -* [`Node?`][node], In *normal* mode — If it can be found at the start of - `value` - -### `tokenizer.locator(value, fromIndex)` - -Locators are required for inline tokenizers. -Their role is to keep parsing performant. - -The following example shows a locator that is added by the mentions tokenizer -above. - -```js -function locateMention(value, fromIndex) { - return value.indexOf('@', fromIndex) -} -``` - -Locators enable inline tokenizers to function faster by providing information on -where the next entity *may* occur. -Locators may be wrong, it’s OK if there actually isn’t a node to be found at the -index they return. - -###### Parameters - -* `value` (`string`) — Value which may contain an entity -* `fromIndex` (`number`) — Position to start searching at - -###### Returns - -`number` — Index at which an entity may start, and `-1` otherwise. - -### `eat(subvalue)` - -```js -var add = eat('foo') -``` - -Eat `subvalue`, which is a string at the start of the [tokenized][tokenizer] -`value`. - -###### Parameters - -* `subvalue` (`string`) - Value to eat - -###### Returns - -[`add`][add]. - -### `add(node[, parent])` - -```js -var add = eat('foo') - -add({type: 'text', value: 'foo'}) -``` - -Add [positional information][position] to `node` and add `node` to `parent`. - -###### Parameters - -* `node` ([`Node`][node]) - Node to patch position on and to add -* `parent` ([`Parent`][parent], optional) - Place to add `node` to in the - syntax tree. - Defaults to the currently processed node - -###### Returns - -[`Node`][node] — The given `node`. - -### `add.test()` - -Get the [positional information][position] that would be patched on `node` by -`add`. - -###### Returns - -[`Position`][position]. - -### `add.reset(node[, parent])` - -`add`, but resets the internal position. -Useful for example in lists, where the same content is first eaten for a list, -and later for list items. - -###### Parameters - -* `node` ([`Node`][node]) - Node to patch position on and insert -* `parent` ([`Node`][node], optional) - Place to add `node` to in - the syntax tree. - Defaults to the currently processed node - -###### Returns - -[`Node`][node] — The given node. - -### Turning off a tokenizer - -In some situations, you may want to turn off a tokenizer to avoid parsing that -syntactic feature. - -Preferably, use the [`remark-disable-tokenizers`][remark-disable-tokenizers] -plugin to turn off tokenizers. - -Alternatively, this can be done by replacing the tokenizer from -`blockTokenizers` (or `blockMethods`) or `inlineTokenizers` (or -`inlineMethods`). - -The following example turns off indented code blocks: - -```js -remarkParse.Parser.prototype.blockTokenizers.indentedCode = indentedCode - -function indentedCode() { - return true -} -``` - -## 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, organisation, or community you agree to -abide by its terms. - -## License - -[MIT][license] © [Titus Wormer][author] - - - -[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/join%20the%20community-on%20spectrum-7b16ff.svg - -[chat]: https://spectrum.chat/unified/remark - -[health]: https://github.com/remarkjs/.github - -[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md - -[support]: https://github.com/remarkjs/.github/blob/master/support.md - -[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md - -[ideas]: https://github.com/remarkjs/ideas - -[awesome]: https://github.com/remarkjs/awesome-remark - -[license]: https://github.com/remarkjs/remark/blob/master/license - -[author]: https://wooorm.com - -[npm]: https://docs.npmjs.com/cli/install - -[unified]: https://github.com/unifiedjs/unified - -[data]: https://github.com/unifiedjs/unified#processordatakey-value - -[remark]: https://github.com/remarkjs/remark/tree/master/packages/remark - -[blocks]: https://github.com/remarkjs/remark/blob/master/packages/remark-parse/lib/block-elements.js - -[mdast]: https://github.com/syntax-tree/mdast - -[escapes]: https://spec.commonmark.org/0.29/#backslash-escapes - -[node]: https://github.com/syntax-tree/unist#node - -[parent]: https://github.com/syntax-tree/unist#parent - -[position]: https://github.com/syntax-tree/unist#position - -[parser]: https://github.com/unifiedjs/unified#processorparser - -[transformer]: https://github.com/unifiedjs/unified#function-transformernode-file-next - -[extend]: #extending-the-parser - -[tokenizer]: #function-tokenizereat-value-silent - -[locator]: #tokenizerlocatorvalue-fromindex - -[eat]: #eatsubvalue - -[add]: #addnode-parent - -[announcement]: https://medium.com/unifiedjs/collectively-evolving-through-crowdsourcing-22c359ea95cc - -[remark-disable-tokenizers]: https://github.com/zestedesavoir/zmarkdown/tree/master/packages/remark-disable-tokenizers - -[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting - -[rehype]: https://github.com/rehypejs/rehype - -[sanitize]: https://github.com/rehypejs/rehype-sanitize diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/repeat-string/LICENSE b/tools/node_modules/eslint-plugin-markdown/node_modules/repeat-string/LICENSE deleted file mode 100644 index 39245ac1c60613..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/repeat-string/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2016, Jon Schlinkert. - -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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/repeat-string/README.md b/tools/node_modules/eslint-plugin-markdown/node_modules/repeat-string/README.md deleted file mode 100644 index aaa5e91c7a7f91..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/repeat-string/README.md +++ /dev/null @@ -1,136 +0,0 @@ -# repeat-string [![NPM version](https://img.shields.io/npm/v/repeat-string.svg?style=flat)](https://www.npmjs.com/package/repeat-string) [![NPM monthly downloads](https://img.shields.io/npm/dm/repeat-string.svg?style=flat)](https://npmjs.org/package/repeat-string) [![NPM total downloads](https://img.shields.io/npm/dt/repeat-string.svg?style=flat)](https://npmjs.org/package/repeat-string) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/repeat-string.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/repeat-string) - -> Repeat the given string n times. Fastest implementation for repeating a string. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save repeat-string -``` - -## Usage - -### [repeat](index.js#L41) - -Repeat the given `string` the specified `number` of times. - -**Example:** - -**Example** - -```js -var repeat = require('repeat-string'); -repeat('A', 5); -//=> AAAAA -``` - -**Params** - -* `string` **{String}**: The string to repeat -* `number` **{Number}**: The number of times to repeat the string -* `returns` **{String}**: Repeated string - -## Benchmarks - -Repeat string is significantly faster than the native method (which is itself faster than [repeating](https://github.com/sindresorhus/repeating)): - -```sh -# 2x -repeat-string █████████████████████████ (26,953,977 ops/sec) -repeating █████████ (9,855,695 ops/sec) -native ██████████████████ (19,453,895 ops/sec) - -# 3x -repeat-string █████████████████████████ (19,445,252 ops/sec) -repeating ███████████ (8,661,565 ops/sec) -native ████████████████████ (16,020,598 ops/sec) - -# 10x -repeat-string █████████████████████████ (23,792,521 ops/sec) -repeating █████████ (8,571,332 ops/sec) -native ███████████████ (14,582,955 ops/sec) - -# 50x -repeat-string █████████████████████████ (23,640,179 ops/sec) -repeating █████ (5,505,509 ops/sec) -native ██████████ (10,085,557 ops/sec) - -# 250x -repeat-string █████████████████████████ (23,489,618 ops/sec) -repeating ████ (3,962,937 ops/sec) -native ████████ (7,724,892 ops/sec) - -# 2000x -repeat-string █████████████████████████ (20,315,172 ops/sec) -repeating ████ (3,297,079 ops/sec) -native ███████ (6,203,331 ops/sec) - -# 20000x -repeat-string █████████████████████████ (23,382,915 ops/sec) -repeating ███ (2,980,058 ops/sec) -native █████ (5,578,808 ops/sec) -``` - -**Run the benchmarks** - -Install dev dependencies: - -```sh -npm i -d && node benchmark -``` - -## About - -### Related projects - -[repeat-element](https://www.npmjs.com/package/repeat-element): Create an array by repeating the given value n times. | [homepage](https://github.com/jonschlinkert/repeat-element "Create an array by repeating the given value n times.") - -### Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -### Contributors - -| **Commits** | **Contributor**
    | -| --- | --- | -| 51 | [jonschlinkert](https://github.com/jonschlinkert) | -| 2 | [LinusU](https://github.com/LinusU) | -| 2 | [tbusser](https://github.com/tbusser) | -| 1 | [doowb](https://github.com/doowb) | -| 1 | [wooorm](https://github.com/wooorm) | - -### Building docs - -_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_ - -To generate the readme and API documentation with [verb](https://github.com/verbose/verb): - -```sh -$ npm install -g verb verb-generate-readme && verb -``` - -### Running tests - -Install dev dependencies: - -```sh -$ npm install -d && npm test -``` - -### Author - -**Jon Schlinkert** - -* [github/jonschlinkert](https://github.com/jonschlinkert) -* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) - -### License - -Copyright © 2016, [Jon Schlinkert](http://github.com/jonschlinkert). -Released under the [MIT license](https://github.com/jonschlinkert/repeat-string/blob/master/LICENSE). - -*** - -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on October 23, 2016._ \ No newline at end of file diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/repeat-string/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/repeat-string/index.js deleted file mode 100644 index 4459afd8016e31..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/repeat-string/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/*! - * repeat-string - * - * Copyright (c) 2014-2015, Jon Schlinkert. - * Licensed under the MIT License. - */ - -'use strict'; - -/** - * Results cache - */ - -var res = ''; -var cache; - -/** - * Expose `repeat` - */ - -module.exports = repeat; - -/** - * Repeat the given `string` the specified `number` - * of times. - * - * **Example:** - * - * ```js - * var repeat = require('repeat-string'); - * repeat('A', 5); - * //=> AAAAA - * ``` - * - * @param {String} `string` The string to repeat - * @param {Number} `number` The number of times to repeat the string - * @return {String} Repeated string - * @api public - */ - -function repeat(str, num) { - if (typeof str !== 'string') { - throw new TypeError('expected a string'); - } - - // cover common, quick use cases - if (num === 1) return str; - if (num === 2) return str + str; - - var max = str.length * num; - if (cache !== str || typeof cache === 'undefined') { - cache = str; - res = ''; - } else if (res.length >= max) { - return res.substr(0, max); - } - - while (max > res.length && num > 1) { - if (num & 1) { - res += str; - } - - num >>= 1; - str += str; - } - - res += str; - res = res.substr(0, max); - return res; -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/repeat-string/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/repeat-string/package.json deleted file mode 100644 index 09f889299b6683..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/repeat-string/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "repeat-string", - "description": "Repeat the given string n times. Fastest implementation for repeating a string.", - "version": "1.6.1", - "homepage": "https://github.com/jonschlinkert/repeat-string", - "author": "Jon Schlinkert (http://github.com/jonschlinkert)", - "contributors": [ - "Brian Woodward (https://github.com/doowb)", - "Jon Schlinkert (http://twitter.com/jonschlinkert)", - "Linus Unnebäck (http://linus.unnebäck.se)", - "Thijs Busser (http://tbusser.net)", - "Titus (wooorm.com)" - ], - "repository": "jonschlinkert/repeat-string", - "bugs": { - "url": "https://github.com/jonschlinkert/repeat-string/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10" - }, - "scripts": { - "test": "mocha" - }, - "devDependencies": { - "ansi-cyan": "^0.1.1", - "benchmarked": "^0.2.5", - "gulp-format-md": "^0.1.11", - "isobject": "^2.1.0", - "mocha": "^3.1.2", - "repeating": "^3.0.0", - "text-table": "^0.2.0", - "yargs-parser": "^4.0.2" - }, - "keywords": [ - "fast", - "fastest", - "fill", - "left", - "left-pad", - "multiple", - "pad", - "padding", - "repeat", - "repeating", - "repetition", - "right", - "right-pad", - "string", - "times" - ], - "verb": { - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "related": { - "list": [ - "repeat-element" - ] - }, - "helpers": [ - "./benchmark/helper.js" - ], - "reflinks": [ - "verb" - ] - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/replace-ext/README.md b/tools/node_modules/eslint-plugin-markdown/node_modules/replace-ext/README.md deleted file mode 100644 index 8775983b7834d5..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/replace-ext/README.md +++ /dev/null @@ -1,50 +0,0 @@ -

    - - - -

    - -# replace-ext - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] - -Replaces a file extension with another one. - -## Usage - -```js -var replaceExt = require('replace-ext'); - -var path = '/some/dir/file.js'; -var newPath = replaceExt(path, '.coffee'); - -console.log(newPath); // /some/dir/file.coffee -``` - -## API - -### `replaceExt(path, extension)` - -Replaces the extension from `path` with `extension` and returns the updated path string. - -Does not replace the extension if `path` is not a string or is empty. - -## License - -MIT - -[downloads-image]: http://img.shields.io/npm/dm/replace-ext.svg -[npm-url]: https://www.npmjs.com/package/replace-ext -[npm-image]: http://img.shields.io/npm/v/replace-ext.svg - -[travis-url]: https://travis-ci.org/gulpjs/replace-ext -[travis-image]: http://img.shields.io/travis/gulpjs/replace-ext.svg?label=travis-ci - -[appveyor-url]: https://ci.appveyor.com/project/gulpjs/replace-ext -[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/replace-ext.svg?label=appveyor - -[coveralls-url]: https://coveralls.io/r/gulpjs/replace-ext -[coveralls-image]: http://img.shields.io/coveralls/gulpjs/replace-ext/master.svg - -[gitter-url]: https://gitter.im/gulpjs/gulp -[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/replace-ext/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/replace-ext/index.js deleted file mode 100644 index 7cb7789e280723..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/replace-ext/index.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -var path = require('path'); - -function replaceExt(npath, ext) { - if (typeof npath !== 'string') { - return npath; - } - - if (npath.length === 0) { - return npath; - } - - var nFileName = path.basename(npath, path.extname(npath)) + ext; - return path.join(path.dirname(npath), nFileName); -} - -module.exports = replaceExt; diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/replace-ext/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/replace-ext/package.json deleted file mode 100644 index 27dbe31042d0ff..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/replace-ext/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "replace-ext", - "version": "1.0.0", - "description": "Replaces a file extension with another one", - "author": "Gulp Team (http://gulpjs.com/)", - "contributors": [ - "Eric Schoffstall ", - "Blaine Bublitz " - ], - "repository": "gulpjs/replace-ext", - "license": "MIT", - "engines": { - "node": ">= 0.10" - }, - "main": "index.js", - "files": [ - "LICENSE", - "index.js" - ], - "scripts": { - "lint": "eslint . && jscs index.js test/", - "pretest": "npm run lint", - "test": "mocha --async-only", - "cover": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly", - "coveralls": "npm run cover && istanbul-coveralls" - }, - "dependencies": {}, - "devDependencies": { - "eslint": "^1.10.3", - "eslint-config-gulp": "^2.0.0", - "expect": "^1.16.0", - "istanbul": "^0.4.3", - "istanbul-coveralls": "^1.0.3", - "jscs": "^2.3.5", - "jscs-preset-gulp": "^1.0.0", - "mocha": "^2.4.5" - }, - "keywords": [ - "gulp", - "extensions", - "filepath", - "basename" - ] -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/state-toggle/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/state-toggle/index.js deleted file mode 100644 index aceee00d1db789..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/state-toggle/index.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict' - -module.exports = factory - -// Construct a state `toggler`: a function which inverses `property` in context -// based on its current value. -// The by `toggler` returned function restores that value. -function factory(key, state, ctx) { - return enter - - function enter() { - var context = ctx || this - var current = context[key] - - context[key] = !state - - return exit - - function exit() { - context[key] = current - } - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/state-toggle/license b/tools/node_modules/eslint-plugin-markdown/node_modules/state-toggle/license deleted file mode 100644 index 8d8660d36ef2ec..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/state-toggle/license +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2016 Titus Wormer - -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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/state-toggle/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/state-toggle/package.json deleted file mode 100644 index 1111db063669a9..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/state-toggle/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "state-toggle", - "version": "1.0.3", - "description": "Enter/exit a state", - "license": "MIT", - "keywords": [ - "enter", - "exit", - "state" - ], - "repository": "wooorm/state-toggle", - "bugs": "https://github.com/wooorm/state-toggle/issues", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - }, - "author": "Titus Wormer (https://wooorm.com)", - "contributors": [ - "Titus Wormer (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 . -s stateToggle -o state-toggle.js", - "build-mangle": "browserify . -s stateToggle -p tinyify -o state-toggle.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": [ - "state-toggle.js" - ] - }, - "remarkConfig": { - "plugins": [ - "preset-wooorm" - ] - }, - "nyc": { - "check-coverage": true, - "lines": 100, - "functions": 100, - "branches": 100 - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/state-toggle/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/state-toggle/readme.md deleted file mode 100644 index 9fcca1e5ef6ddb..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/state-toggle/readme.md +++ /dev/null @@ -1,95 +0,0 @@ -# state-toggle - -[![Build][build-badge]][build] -[![Coverage][coverage-badge]][coverage] -[![Downloads][downloads-badge]][downloads] -[![Size][size-badge]][size] - -Enter/exit a state. - -## Install - -[npm][]: - -```sh -npm install state-toggle -``` - -## Use - -```js -var toggle = require('state-toggle') - -var ctx = {on: false} -var enter = toggle('on', ctx.on, ctx) -var exit - -// Entering: -exit = enter() -console.log(ctx.on) // => true - -// Exiting: -exit() -console.log(ctx.on) // => false -``` - -## API - -### `toggle(key, initial[, ctx])` - -Create a toggle, which when entering toggles `key` on `ctx` (or `this`, if `ctx` -is not given) to `!initial`, and when exiting, sets `key` on the context back to -the value it had before entering. - -###### Returns - -`Function` — [`enter`][enter]. - -### `enter()` - -Enter the state. - -###### Context - -If no `ctx` was given to `toggle`, the context object (`this`) of `enter()` is -used to toggle. - -###### Returns - -`Function` — [`exit`][exit]. - -### `exit()` - -Exit the state, reverting `key` to the value it had before entering. - -## License - -[MIT][license] © [Titus Wormer][author] - - - -[build-badge]: https://img.shields.io/travis/wooorm/state-toggle.svg - -[build]: https://travis-ci.org/wooorm/state-toggle - -[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/state-toggle.svg - -[coverage]: https://codecov.io/github/wooorm/state-toggle - -[downloads-badge]: https://img.shields.io/npm/dm/state-toggle.svg - -[downloads]: https://www.npmjs.com/package/state-toggle - -[size-badge]: https://img.shields.io/bundlephobia/minzip/state-toggle.svg - -[size]: https://bundlephobia.com/result?p=state-toggle - -[npm]: https://docs.npmjs.com/cli/install - -[license]: license - -[author]: https://wooorm.com - -[enter]: #enter - -[exit]: #exit diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/trim-trailing-lines/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/trim-trailing-lines/index.js deleted file mode 100644 index eff85c6baedffb..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/trim-trailing-lines/index.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict' - -module.exports = trimTrailingLines - -// Remove final newline characters from `value`. -function trimTrailingLines(value) { - return String(value).replace(/\n+$/, '') -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/trim-trailing-lines/license b/tools/node_modules/eslint-plugin-markdown/node_modules/trim-trailing-lines/license deleted file mode 100644 index 611b67581bb8e2..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/trim-trailing-lines/license +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2015 Titus Wormer - -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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/trim-trailing-lines/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/trim-trailing-lines/readme.md deleted file mode 100644 index a9c1f441b84262..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/trim-trailing-lines/readme.md +++ /dev/null @@ -1,68 +0,0 @@ -# trim-trailing-lines - -[![Build][build-badge]][build] -[![Coverage][coverage-badge]][coverage] -[![Downloads][downloads-badge]][downloads] -[![Size][size-badge]][size] - -Remove final line feeds from a string. - -## Install - -[npm][]: - -```sh -npm install trim-trailing-lines -``` - -## Use - -```js -var trimTrailingLines = require('trim-trailing-lines') - -trimTrailingLines('foo\nbar') // => 'foo\nbar' -trimTrailingLines('foo\nbar\n') // => 'foo\nbar' -trimTrailingLines('foo\nbar\n\n') // => 'foo\nbar' -``` - -## API - -### `trimTrailingLines(value)` - -Remove final line feed characters from `value`. - -###### Parameters - -* `value` (`string`) — Value with trailing line feeds, coerced to string. - -###### Returns - -`string` — Value without trailing newlines. - -## License - -[MIT][license] © [Titus Wormer][author] - - - -[build-badge]: https://img.shields.io/travis/wooorm/trim-trailing-lines.svg - -[build]: https://travis-ci.org/wooorm/trim-trailing-lines - -[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/trim-trailing-lines.svg - -[coverage]: https://codecov.io/github/wooorm/trim-trailing-lines - -[downloads-badge]: https://img.shields.io/npm/dm/trim-trailing-lines.svg - -[downloads]: https://www.npmjs.com/package/trim-trailing-lines - -[size-badge]: https://img.shields.io/bundlephobia/minzip/trim-trailing-lines.svg - -[size]: https://bundlephobia.com/result?p=trim-trailing-lines - -[npm]: https://docs.npmjs.com/cli/install - -[license]: license - -[author]: https://wooorm.com diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/trim/Makefile b/tools/node_modules/eslint-plugin-markdown/node_modules/trim/Makefile deleted file mode 100644 index 4e9c8d36ebcd2f..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/trim/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --require should \ - --reporter spec - -.PHONY: test \ No newline at end of file diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/trim/Readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/trim/Readme.md deleted file mode 100644 index 3460f523fbe8ac..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/trim/Readme.md +++ /dev/null @@ -1,69 +0,0 @@ - -# trim - - Trims string whitespace. - -## Installation - -``` -$ npm install trim -$ component install component/trim -``` - -## API - - - [trim(str)](#trimstr) - - [.left(str)](#leftstr) - - [.right(str)](#rightstr) - - - -### trim(str) -should trim leading / trailing whitespace. - -```js -trim(' foo bar ').should.equal('foo bar'); -trim('\n\n\nfoo bar\n\r\n\n').should.equal('foo bar'); -``` - - -### .left(str) -should trim leading whitespace. - -```js -trim.left(' foo bar ').should.equal('foo bar '); -``` - - -### .right(str) -should trim trailing whitespace. - -```js -trim.right(' foo bar ').should.equal(' foo bar'); -``` - - -## License - -(The MIT License) - -Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca> - -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. \ No newline at end of file diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/trim/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/trim/index.js deleted file mode 100644 index 640c24cf302e60..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/trim/index.js +++ /dev/null @@ -1,14 +0,0 @@ - -exports = module.exports = trim; - -function trim(str){ - return str.replace(/^\s*|\s*$/g, ''); -} - -exports.left = function(str){ - return str.replace(/^\s*/, ''); -}; - -exports.right = function(str){ - return str.replace(/\s*$/, ''); -}; diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/trim/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/trim/package.json deleted file mode 100644 index 64ee5c69d84c32..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/trim/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "trim", - "version": "0.0.1", - "description": "Trim string whitespace", - "keywords": ["string", "trim"], - "author": "TJ Holowaychuk ", - "dependencies": {}, - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "main": "index", - "component": { - "scripts": { - "trim/index.js": "index.js" - } - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/trough/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/trough/index.js deleted file mode 100644 index 2b73d868056525..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/trough/index.js +++ /dev/null @@ -1,74 +0,0 @@ -'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 - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/trough/license b/tools/node_modules/eslint-plugin-markdown/node_modules/trough/license deleted file mode 100644 index 3f0166f62b10c0..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/trough/license +++ /dev/null @@ -1,21 +0,0 @@ -(The MIT License) - -Copyright (c) 2016 Titus Wormer - -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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/trough/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/trough/package.json deleted file mode 100644 index cbf7782f89a445..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/trough/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "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 (https://wooorm.com)", - "contributors": [ - "Titus Wormer (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 - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/trough/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/trough/readme.md deleted file mode 100644 index ce3d38bca9a2bf..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/trough/readme.md +++ /dev/null @@ -1,330 +0,0 @@ -# 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 -``` - -## 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] - - - -[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 diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/trough/wrap.js b/tools/node_modules/eslint-plugin-markdown/node_modules/trough/wrap.js deleted file mode 100644 index cf568c07adfa34..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/trough/wrap.js +++ /dev/null @@ -1,64 +0,0 @@ -'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) - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unherit/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/unherit/index.js deleted file mode 100644 index 32ead7770fa2c9..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unherit/index.js +++ /dev/null @@ -1,45 +0,0 @@ -'use strict' - -var xtend = require('xtend') -var inherits = require('inherits') - -module.exports = unherit - -// Create a custom constructor which can be modified without affecting the -// original class. -function unherit(Super) { - var result - var key - var value - - inherits(Of, Super) - inherits(From, Of) - - // Clone values. - result = Of.prototype - - for (key in result) { - value = result[key] - - if (value && typeof value === 'object') { - result[key] = 'concat' in value ? value.concat() : xtend(value) - } - } - - return Of - - // Constructor accepting a single argument, which itself is an `arguments` - // object. - function From(parameters) { - return Super.apply(this, parameters) - } - - // Constructor accepting variadic arguments. - function Of() { - if (!(this instanceof Of)) { - return new From(arguments) - } - - return Super.apply(this, arguments) - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unherit/license b/tools/node_modules/eslint-plugin-markdown/node_modules/unherit/license deleted file mode 100644 index f3722d94b38121..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unherit/license +++ /dev/null @@ -1,21 +0,0 @@ -(The MIT License) - -Copyright (c) 2015 Titus Wormer - -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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unherit/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/unherit/package.json deleted file mode 100644 index 445a500650255e..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unherit/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "unherit", - "version": "1.1.3", - "description": "Clone a constructor without affecting the super-class", - "license": "MIT", - "keywords": [ - "clone", - "super", - "class", - "constructor" - ], - "repository": "wooorm/unherit", - "bugs": "https://github.com/wooorm/unherit/issues", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - }, - "author": "Titus Wormer (https://wooorm.com)", - "contributors": [ - "Titus Wormer (https://wooorm.com)" - ], - "files": [ - "index.js" - ], - "dependencies": { - "inherits": "^2.0.0", - "xtend": "^4.0.0" - }, - "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 . -s unherit -o unherit.js", - "build-mangle": "browserify . -s unherit -p tinyify -o unherit.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", - "guard-for-in": "off" - }, - "ignores": [ - "unherit.js" - ] - }, - "remarkConfig": { - "plugins": [ - "preset-wooorm" - ] - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unherit/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/unherit/readme.md deleted file mode 100644 index bf679597d89d50..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unherit/readme.md +++ /dev/null @@ -1,79 +0,0 @@ -# unherit - -[![Build][build-badge]][build] -[![Coverage][coverage-badge]][coverage] -[![Downloads][downloads-badge]][downloads] -[![Size][size-badge]][size] - -Create a custom constructor which can be modified without affecting the original -class. - -## Install - -[npm][]: - -```sh -npm install unherit -``` - -## Use - -```js -var EventEmitter = require('events').EventEmitter -var unherit = require('unherit') - -// Create a private class which acts just like `EventEmitter`. -var Emitter = unherit(EventEmitter) - -Emitter.prototype.defaultMaxListeners = 0 -// Now, all instances of `Emitter` have no maximum listeners, without affecting -// other `EventEmitter`s. - -new Emitter().defaultMaxListeners === 0 // => true -new EventEmitter().defaultMaxListeners === undefined // => true -new Emitter() instanceof EventEmitter // => true -``` - -## API - -### `unherit(Super)` - -Create a custom constructor which can be modified without affecting the original -class. - -###### Parameters - -* `Super` (`Function`) — Super-class - -###### Returns - -`Function` — Constructor acting like `Super`, which can be modified without -affecting the original class. - -## License - -[MIT][license] © [Titus Wormer][author] - - - -[build-badge]: https://img.shields.io/travis/wooorm/unherit.svg - -[build]: https://travis-ci.org/wooorm/unherit - -[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/unherit.svg - -[coverage]: https://codecov.io/github/wooorm/unherit - -[downloads-badge]: https://img.shields.io/npm/dm/unherit.svg - -[downloads]: https://www.npmjs.com/package/unherit - -[size-badge]: https://img.shields.io/bundlephobia/minzip/unherit.svg - -[size]: https://bundlephobia.com/result?p=unherit - -[npm]: https://docs.npmjs.com/cli/install - -[license]: license - -[author]: https://wooorm.com diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unified/LICENSE b/tools/node_modules/eslint-plugin-markdown/node_modules/unified/LICENSE deleted file mode 100644 index f3722d94b38121..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unified/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -(The MIT License) - -Copyright (c) 2015 Titus Wormer - -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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unified/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/unified/index.js deleted file mode 100644 index b8f9011d1701b9..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unified/index.js +++ /dev/null @@ -1,466 +0,0 @@ -'use strict' - -/* Dependencies. */ -var extend = require('extend') -var bail = require('bail') -var vfile = require('vfile') -var trough = require('trough') -var string = require('x-is-string') -var plain = require('is-plain-obj') - -/* 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(err, tree, file) { - if (err) { - next(err) - } else { - ctx.tree = tree - ctx.file = file - next() - } - } -} - -function pipelineStringify(p, ctx) { - ctx.file.contents = p.stringify(ctx.tree, ctx.file) -} - -/* Function to create the first processor. */ -function unified() { - var attachers = [] - var transformers = trough() - var namespace = {} - var frozen = false - var freezeIndex = -1 - - /* Data management. */ - processor.data = data - - /* Lock. */ - processor.freeze = freeze - - /* Plug-ins. */ - 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 length = attachers.length - var index = -1 - - while (++index < 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. - * Plug-ins 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 plugin - var options - var transformer - - if (frozen) { - return processor - } - - while (++freezeIndex < attachers.length) { - values = attachers[freezeIndex] - plugin = values[0] - options = values[1] - transformer = null - - if (options === false) { - continue - } - - if (options === true) { - values[1] = undefined - } - - transformer = plugin.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 (string(key)) { - /* 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 - } - - /* Plug-in 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 length - var index - - if (plugins === null || plugins === undefined) { - /* Empty */ - } else if (typeof plugins === 'object' && 'length' in plugins) { - length = plugins.length - index = -1 - - while (++index < 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(entry[1], value) - } - - entry[1] = value - } else { - attachers.push(slice.call(arguments)) - } - } - } - - function find(plugin) { - var length = attachers.length - var index = -1 - var entry - - while (++index < length) { - entry = attachers[index] - - if (entry[0] === plugin) { - return entry - } - } - } - - /* 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)) { - 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(err, tree, file) { - tree = tree || node - if (err) { - reject(err) - } 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 complete = false - var result - - run(node, file, done) - - assertDone('runSync', 'run', complete) - - return result - - function done(err, tree) { - complete = true - bail(err) - result = tree - } - } - - /* 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)) { - 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(err) { - if (err) { - reject(err) - } else if (resolve) { - resolve(file) - } else { - cb(null, file) - } - } - } - } - - /* Process the given document (in string or VFile - * representation), sync. */ - function processSync(doc) { - var complete = false - var file - - freeze() - assertParser('processSync', processor.Parser) - assertCompiler('processSync', processor.Compiler) - file = vfile(doc) - - process(file, done) - - assertDone('processSync', 'process', complete) - - return file - - function done(err) { - complete = true - bail(err) - } - } -} - -/* Check if `func` is a constructor. */ -function newable(value) { - return typeof value === 'function' && keys(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`.' - ].join('') - ) - } -} - -/* Assert `node` is a Unist node. */ -function assertNode(node) { - if (!node || !string(node.type)) { - 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' - ) - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unified/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/unified/package.json deleted file mode 100644 index 21777216934520..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unified/package.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "name": "unified", - "version": "6.2.0", - "description": "Pluggable text processing interface", - "license": "MIT", - "keywords": [ - "process", - "parse", - "transform", - "compile", - "stringify", - "rehype", - "retext", - "remark" - ], - "repository": "unifiedjs/unified", - "bugs": "https://github.com/unifiedjs/unified/issues", - "author": "Titus Wormer (http://wooorm.com)", - "contributors": [ - "Titus Wormer (http://wooorm.com)" - ], - "files": [ - "index.js", - "lib" - ], - "dependencies": { - "bail": "^1.0.0", - "extend": "^3.0.0", - "is-plain-obj": "^1.1.0", - "trough": "^1.0.0", - "vfile": "^2.0.0", - "x-is-string": "^0.1.0" - }, - "devDependencies": { - "browserify": "^16.0.0", - "esmangle": "^1.0.0", - "nyc": "^11.0.0", - "prettier": "^1.12.1", - "remark-cli": "^5.0.0", - "remark-preset-wooorm": "^4.0.0", - "tape": "^4.4.0", - "xo": "^0.20.0" - }, - "scripts": { - "format": "remark . -qfo && prettier --write '**/*.js' && xo --fix", - "build-bundle": "browserify index.js -s unified > unified.js", - "build-mangle": "esmangle unified.js > unified.min.js", - "build": "npm run build-bundle && npm run build-mangle", - "test-api": "node test", - "test-coverage": "nyc --reporter lcov tape test", - "test": "npm run format && npm run build && npm run test-coverage" - }, - "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": { - "guard-for-in": "off", - "no-var": "off", - "object-shorthand": "off", - "prefer-arrow-callback": "off", - "unicorn/prefer-type-error": "off" - }, - "ignores": [ - "unified.js" - ] - }, - "remarkConfig": { - "plugins": [ - "preset-wooorm" - ] - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unified/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/unified/readme.md deleted file mode 100644 index e979e0b3629447..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unified/readme.md +++ /dev/null @@ -1,993 +0,0 @@ -# ![unified][logo] - -[![Build Status][travis-badge]][travis] -[![Coverage Status][codecov-badge]][codecov] -[![Chat][chat-badge]][chat] - -**unified** is an interface for processing text using syntax trees. It’s what -powers [**remark**][remark], [**retext**][retext], and [**rehype**][rehype], -but it also allows for processing between multiple syntaxes. - -The website for **unified**, [`unifiedjs.github.io`][site], provides a less -technical and more practical introduction to unified. Make sure to visit it -and try its introductory [Guides][]. - -## Installation - -[npm][]: - -```bash -npm install unified -``` - -## Usage - -```js -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') -var report = require('vfile-reporter') - -unified() - .use(markdown) - .use(remark2rehype) - .use(doc) - .use(format) - .use(html) - .process('# Hello world!', function(err, file) { - console.error(report(err || file)) - console.log(String(file)) - }) -``` - -Yields: - -```html -no issues found - - - - - - - -

    Hello world!

    - - -``` - -## Table of Contents - -* [Description](#description) -* [API](#api) - * [processor()](#processor) - * [processor.use(plugin\[, options\])](#processoruseplugin-options) - * [processor.parse(file|value)](#processorparsefilevalue) - * [processor.stringify(node\[, file\])](#processorstringifynode-file) - * [processor.run(node\[, file\]\[, done\])](#processorrunnode-file-done) - * [processor.runSync(node\[, file\])](#processorrunsyncnode-file) - * [processor.process(file|value\[, done\])](#processorprocessfilevalue-done) - * [processor.processSync(file|value)](#processorprocesssyncfilevalue) - * [processor.data(key\[, value\])](#processordatakey-value) - * [processor.freeze()](#processorfreeze) -* [Plugin](#plugin) - * [function attacher(\[options\])](#function-attacheroptions) - * [function transformer(node, file\[, next\])](#function-transformernode-file-next) -* [Preset](#preset) -* [Contribute](#contribute) -* [Acknowledgments](#acknowledgments) -* [License](#license) - -## Description - -**unified** is an interface for processing text using syntax trees. Syntax -trees are a representation understandable to programs. Those programs, called -[**plugin**][plugin]s, take these trees and modify them, amongst other things. -To get to the syntax tree from input text there’s a [**parser**][parser]. To -get from that back to text there’s a [**compiler**][compiler]. This is the -[**process**][process] of a **processor**. - -```ascii -| ....................... process() ......................... | -| ......... parse() ..... | run() | ..... stringify() ....... | - - +--------+ +----------+ -Input ->- | Parser | ->- Syntax Tree ->- | Compiler | ->- Output - +--------+ | +----------+ - X - | - +--------------+ - | Transformers | - +--------------+ -``` - -###### Processors - -Every processor implements another processor. To create a new processor invoke -another processor. This creates a processor that 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. - -When processors are exposed from a module (for example, unified itself) they -should not be configured directly, as that would change their behaviour for all -module users. Those processors are [**frozen**][freeze] and they should be -invoked to create a new processor before they are used. - -###### Node - -The syntax trees used in **unified** are [**Unist**][unist] nodes: plain -JavaScript objects with a `type` property. The semantics of those `type`s are -defined by other projects. - -There are several [utilities][unist-utilities] for working with these nodes. - -###### List of Processors - -The following projects process different syntax trees. They parse text to -their respective syntax tree and they compile their syntax trees back to text. -These processors can be used as-is, or their parsers and compilers can be mixed -and matched with **unified** and other plugins to process between different -syntaxes. - -* [**rehype**][rehype] ([**HAST**][hast]) — HTML -* [**remark**][remark] ([**MDAST**][mdast]) — Markdown -* [**retext**][retext] ([**NLCST**][nlcst]) — Natural language - -###### List of Plugins - -The below plugins work with **unified**, unrelated to what flavour the syntax -tree is in: - -* [`unified-diff`](https://github.com/unifiedjs/unified-diff) - — Ignore messages for unchanged lines in Travis - -See [**remark**][remark-plugins], [**rehype**][rehype-plugins], and -[**retext**][retext-plugins] for lists of their plugins. - -###### File - -When processing documents metadata is often gathered about that document. -[**VFile**][vfile] is a virtual file format which stores data and handles -metadata and messages for **unified** and its plugins. - -There are several [utilities][vfile-utilities] for working with these files. - -###### Configuration - -To configure a processor invoke its [`use`][use] method, supply it a -[**plugin**][plugin], and optionally settings. - -###### Integrations - -**unified** can integrate with the file-system through -[`unified-engine`][engine]. On top of that, CLI apps can be created with -[`unified-args`][args], Gulp plugins with [`unified-engine-gulp`][gulp], and -Atom Linters with [`unified-engine-atom`][atom]. - -A streaming interface is provided through [`unified-stream`][stream]. - -###### Programming interface - -The API gives access to processing metadata (such as lint messages) and -supports multiple passed through files: - -```js -var unified = require('unified') -var markdown = require('remark-parse') -var styleGuide = require('remark-preset-lint-markdown-style-guide') -var remark2retext = require('remark-retext') -var english = require('retext-english') -var equality = require('retext-equality') -var remark2rehype = require('remark-rehype') -var html = require('rehype-stringify') -var report = require('vfile-reporter') - -unified() - .use(markdown) - .use(styleGuide) - .use( - remark2retext, - unified() - .use(english) - .use(equality) - ) - .use(remark2rehype) - .use(html) - .process('*Emphasis* and _importance_, you guys!', function(err, file) { - console.error(report(err || file)) - console.log(String(file)) - }) -``` - -Yields: - -```txt - 1:16-1:28 warning Emphasis should use `*` as a marker emphasis-marker remark-lint - 1:34-1:38 warning `guys` may be insensitive, use `people`, `persons`, `folks` instead gals-men retext-equality - -⚠ 2 warnings -

    Emphasis and importance, you guys!

    -``` - -###### Processing between syntaxes - -The processors can be combined in two modes. - -**Bridge** mode transforms the syntax tree from one flavour (the origin) to -another (the destination). Then, transformations are applied on that tree. -Finally, the origin processor continues transforming the original syntax tree. - -**Mutate** mode also transforms the syntax tree from one flavour to another. -But then the origin processor continues transforming the destination syntax -tree. - -In the previous example (“Programming interface”), `remark-retext` is used in -bridge mode: the origin syntax tree is kept after retext is done; whereas -`remark-rehype` is used in mutate mode: it sets a new syntax tree and discards -the original. - -* [`remark-retext`][remark-retext] -* [`remark-rehype`][remark-rehype] -* [`rehype-retext`][rehype-retext] -* [`rehype-remark`][rehype-remark] - -## API - -### `processor()` - -Object describing how to process text. - -###### Returns - -`Function` — New [**unfrozen**][freeze] 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. - -###### Example - -The following example shows how a new processor can be created (from the remark -processor) and linked to **stdin**(4) and **stdout**(4). - -```js -var remark = require('remark') -var concat = require('concat-stream') - -process.stdin.pipe(concat(onconcat)) - -function onconcat(buf) { - var doc = remark() - .processSync(buf) - .toString() - - process.stdout.write(doc) -} -``` - -### `processor.use(plugin[, options])` - -Configure the processor to use a [**plugin**][plugin] and optionally configure -that plugin with options. - -###### Signatures - -* `processor.use(plugin[, options])` -* `processor.use(preset)` -* `processor.use(list)` - -###### Parameters - -* `plugin` ([`Plugin`][plugin]) -* `options` (`*`, optional) — Configuration for `plugin` -* `preset` (`Object`) — Object with an optional `plugins` (set to `list`), - and/or an optional `settings` object -* `list` (`Array`) — List of plugins, presets, and pairs (`plugin` and - `options` in an array) - -###### Returns - -`processor` — The processor on which `use` is invoked. - -###### Note - -`use` cannot be called on [frozen][freeze] processors. Invoke the processor -first to create a new unfrozen processor. - -###### Example - -There are many ways to pass plugins to `.use()`. The below example gives an -overview. - -```js -var unified = require('unified') - -unified() - // Plugin with options: - .use(plugin, {}) - // Plugins: - .use([plugin, pluginB]) - // Two plugins, the second with options: - .use([plugin, [pluginB, {}]]) - // Preset with plugins and settings: - .use({plugins: [plugin, [pluginB, {}]], settings: {position: false}}) - // Settings only: - .use({settings: {position: false}}) - -function plugin() {} -function pluginB() {} -``` - -### `processor.parse(file|value)` - -Parse text to a syntax tree. - -###### Parameters - -* `file` ([`VFile`][file]) - — Or anything which can be given to `vfile()` - -###### Returns - -[`Node`][node] — Syntax tree representation of input. - -###### Note - -`parse` [freezes][freeze] the processor if not already frozen. - -#### `processor.Parser` - -Function handling the parsing of text to a syntax tree. Used in the -[**parse**][parse] phase in the process and invoked with a `string` and -[`VFile`][file] representation of the document to parse. - -`Parser` can be a normal function in which case it must return a -[`Node`][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`][node]. - -### `processor.stringify(node[, file])` - -Compile a syntax tree to text. - -###### Parameters - -* `node` ([`Node`][node]) -* `file` ([`VFile`][file], optional); - — Or anything which can be given to `vfile()` - -###### Returns - -`string` — String representation of the syntax tree file. - -###### Note - -`stringify` [freezes][freeze] the processor if not already frozen. - -#### `processor.Compiler` - -Function handling the compilation of syntax tree to a text. Used in the -[**stringify**][stringify] phase in the process and invoked with a -[`Node`][node] and [`VFile`][file] 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`. - -### `processor.run(node[, file][, done])` - -Transform a syntax tree by applying [**plugin**][plugin]s to it. - -###### Parameters - -* `node` ([`Node`][node]) -* `file` ([`VFile`][file], optional) - — Or anything which can be given to `vfile()` -* `done` ([`Function`][run-done], optional) - -###### Returns - -[`Promise`][promise] if `done` is not given. Rejected with an error, or -resolved with the resulting syntax tree. - -###### Note - -`run` [freezes][freeze] the processor if not already frozen. - -##### `function done(err[, node, file])` - -Invoked when transformation is complete. Either invoked with an error or a -syntax tree and a file. - -###### Parameters - -* `err` (`Error`) — Fatal error -* `node` ([`Node`][node]) -* `file` ([`VFile`][file]) - -### `processor.runSync(node[, file])` - -Transform a syntax tree by applying [**plugin**][plugin]s to it. - -If asynchronous [**plugin**][plugin]s are configured an error is thrown. - -###### Parameters - -* `node` ([`Node`][node]) -* `file` ([`VFile`][file], optional) - — Or anything which can be given to `vfile()` - -###### Returns - -[`Node`][node] — The given syntax tree. - -###### Note - -`runSync` [freezes][freeze] the processor if not already frozen. - -### `processor.process(file|value[, done])` - -Process the given representation of a file as configured on the processor. The -process invokes `parse`, `run`, and `stringify` internally. - -###### Parameters - -* `file` ([`VFile`][file]) -* `value` (`string`) — String representation of a file -* `done` ([`Function`][process-done], optional) - -###### Returns - -[`Promise`][promise] if `done` is not given. Rejected with an error or -resolved with the resulting file. - -###### Note - -`process` [freezes][freeze] the processor if not already frozen. - -#### `function done(err, file)` - -Invoked when the process is complete. Invoked with a fatal error, if any, and -the [`VFile`][file]. - -###### Parameters - -* `err` (`Error`, optional) — Fatal error -* `file` ([`VFile`][file]) - -###### Example - -```js -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('# Hello world!') - .then( - function(file) { - console.log(String(file)) - }, - function(err) { - console.error(String(err)) - } - ) -``` - -Yields: - -```html - - - - - - - -

    Hello world!

    - - -``` - -### `processor.processSync(file|value)` - -Process the given representation of a file as configured on the processor. The -process invokes `parse`, `run`, and `stringify` internally. - -If asynchronous [**plugin**][plugin]s are configured an error is thrown. - -###### Parameters - -* `file` ([`VFile`][file]) -* `value` (`string`) — String representation of a file - -###### Returns - -[`VFile`][file] — Virtual file with modified [`contents`][vfile-contents]. - -###### Note - -`processSync` [freezes][freeze] the processor if not already frozen. - -###### Example - -```js -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') - -var processor = unified() - .use(markdown) - .use(remark2rehype) - .use(doc) - .use(format) - .use(html) - -console.log(processor.processSync('# Hello world!').toString()) -``` - -Yields: - -```html - - - - - - - -

    Hello world!

    - - -``` - -### `processor.data(key[, value])` - -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. - -###### Parameters - -* `key` (`string`) — Identifier -* `value` (`*`, optional) — Value to set. Omit if getting `key` - -###### Returns - -* `processor` — If setting, the processor on which `data` is invoked -* `*` — If getting, the value at `key` - -###### Note - -Setting information with `data` cannot occur on [frozen][freeze] processors. -Invoke the processor first to create a new unfrozen processor. - -###### Example - -The following example show how to get and set information: - -```js -var unified = require('unified') - -console.log( - unified() - .data('alpha', 'bravo') - .data('alpha') -) -``` - -Yields: - -```txt -bravo -``` - -### `processor.freeze()` - -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()`][parse], [`.run()`][run], [`.stringify()`][stringify], and -[`.process()`][process] call `.freeze()` to freeze a processor too. - -###### Returns - -`Processor` — The processor on which `freeze` is invoked. - -###### Example - -The following example, `index.js`, shows how [**rehype**][rehype] prevents -extensions to itself: - -```js -var unified = require('unified') -var parse = require('rehype-parse') -var stringify = require('rehype-stringify') - -module.exports = unified() - .use(parse) - .use(stringify) - .freeze() -``` - -The below example, `a.js`, shows how that processor can be used and configured. - -```js -var rehype = require('rehype') -var format = require('rehype-format') -// ... - -rehype() - .use(format) - // ... -``` - -The below example, `b.js`, shows a similar looking example which operates on -the frozen [**rehype**][rehype] interface. If this behaviour was allowed it -would result in unexpected behaviour so an error is thrown. **This is -invalid**: - -```js -var rehype = require('rehype') -var format = require('rehype-format') -// ... - -rehype - .use(format) - // ... -``` - -Yields: - -```txt -~/node_modules/unified/index.js:440 - throw new Error( - ^ - -Error: Cannot invoke `use` on a frozen processor. -Create a new processor first, by invoking it: use `processor()` instead of `processor`. - at assertUnfrozen (~/node_modules/unified/index.js:440:11) - at Function.use (~/node_modules/unified/index.js:172:5) - at Object. (~/b.js:6:4) -``` - -## `Plugin` - -**unified** plugins change the way the applied-on processor works in the -following ways: - -* They modify the [**processor**][processor]: such as changing the parser, - the compiler, or linking it to other processors -* They transform [**syntax tree**][node] representation of files -* They modify metadata of files - -Plugins are a concept. They materialise as [`attacher`][attacher]s. - -###### Example - -`move.js`: - -```js -module.exports = move - -function move(options) { - var expected = (options || {}).extname - - if (!expected) { - throw new Error('Missing `extname` in options') - } - - return transformer - - function transformer(tree, file) { - if (file.extname && file.extname !== expected) { - file.extname = expected - } - } -} -``` - -`index.js`: - -```js -var unified = require('unified') -var parse = require('remark-parse') -var remark2rehype = require('remark-rehype') -var stringify = require('rehype-stringify') -var vfile = require('to-vfile') -var report = require('vfile-reporter') -var move = require('./move') - -unified() - .use(parse) - .use(remark2rehype) - .use(move, {extname: '.html'}) - .use(stringify) - .process(vfile.readSync('index.md'), function(err, file) { - console.error(report(err || file)) - if (file) { - vfile.writeSync(file) // Written to `index.html`. - } - }) -``` - -### `function attacher([options])` - -An attacher is the thing passed to [`use`][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. - -###### Context - -The context object is set to the invoked on [`processor`][processor]. - -###### Parameters - -* `options` (`*`, optional) — Configuration - -###### Returns - -[`transformer`][transformer] — Optional. - -###### Note - -Attachers are invoked when the processor is [frozen][freeze]: either when -`.freeze()` is called explicitly, or when [`.parse()`][parse], [`.run()`][run], -[`.stringify()`][stringify], or [`.process()`][process] is called for the first -time. - -### `function transformer(node, file[, next])` - -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`][next]), the process stops. - -The transformation process in **unified** is handled by [`trough`][trough], see -it’s documentation for the exact semantics of transformers. - -###### Parameters - -* `node` ([`Node`][node]) -* `file` ([`VFile`][file]) -* `next` ([`Function`][next], optional) - -###### Returns - -* `Error` — Can be returned to stop the process -* [`Node`][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`][node]) or rejected - (optionally with an `Error`) - -#### `function next(err[, tree[, file]])` - -If the signature of a transformer includes `next` (third argument), the -function **may** finish asynchronous, and **must** invoke `next()`. - -###### Parameters - -* `err` (`Error`, optional) — Stop the process -* `node` ([`Node`][node], optional) — New syntax tree -* `file` ([`VFile`][file], optional) — New virtual file - -## `Preset` - -Presets provide a potentially sharable way to configure processors. They can -contain multiple plugins and optionally settings as well. - -###### Example - -`preset.js`: - -```js -exports.settings = {bullet: '*', fences: true} - -exports.plugins = [ - require('remark-preset-lint-recommended'), - require('remark-comment-config'), - require('remark-preset-lint-markdown-style-guide'), - [require('remark-toc'), {maxDepth: 3, tight: true}], - require('remark-github') -] -``` - -`index.js`: - -```js -var remark = require('remark') -var vfile = require('to-vfile') -var report = require('vfile-reporter') -var preset = require('./preset') - -remark() - .use(preset) - .process(vfile.readSync('index.md'), function(err, file) { - console.error(report(err || file)) - - if (file) { - vfile.writeSync(file) - } - }) -``` - -## Contribute - -**unified** is built by people just like you! Check out -[`contributing.md`][contributing] for ways to get started. - -This project has a [Code of Conduct][coc]. By interacting with this repository, -organisation, or community you agree to abide by its terms. - -Want to chat with the community and contributors? Join us in [Gitter][chat]! - -Have an idea for a cool new utility or tool? That’s great! If you want -feedback, help, or just to share it with the world you can do so by creating -an issue in the [`unifiedjs/ideas`][ideas] repository! - -## Acknowledgments - -Preliminary work for unified was done [in 2014][preliminary] for -[**retext**][retext] and inspired by [`ware`][ware]. Further incubation -happened in [**remark**][remark]. The project was finally [externalised][] -in 2015 and [published][] as `unified`. The project was authored by -[**@wooorm**](https://github.com/wooorm). - -Although `unified` since moved it’s plugin architecture to [`trough`][trough], -thanks to [**@calvinfo**](https://github.com/calvinfo), -[**@ianstormtaylor**](https://github.com/ianstormtaylor), and others for their -work on [`ware`][ware], which was a huge initial inspiration. - -## License - -[MIT][license] © [Titus Wormer][author] - - - -[logo]: https://cdn.rawgit.com/unifiedjs/unified/0cd3a41/logo.svg - -[travis-badge]: https://img.shields.io/travis/unifiedjs/unified.svg - -[travis]: https://travis-ci.org/unifiedjs/unified - -[codecov-badge]: https://img.shields.io/codecov/c/github/unifiedjs/unified.svg - -[codecov]: https://codecov.io/github/unifiedjs/unified - -[chat-badge]: https://img.shields.io/gitter/room/unifiedjs/Lobby.svg - -[chat]: https://gitter.im/unifiedjs/Lobby - -[npm]: https://docs.npmjs.com/cli/install - -[license]: LICENSE - -[author]: http://wooorm.com - -[site]: https://unifiedjs.github.io - -[guides]: https://unifiedjs.github.io/#guides - -[rehype]: https://github.com/rehypejs/rehype - -[remark]: https://github.com/remarkjs/remark - -[retext]: https://github.com/retextjs/retext - -[hast]: https://github.com/syntax-tree/hast - -[mdast]: https://github.com/syntax-tree/mdast - -[nlcst]: https://github.com/syntax-tree/nlcst - -[unist]: https://github.com/syntax-tree/unist - -[engine]: https://github.com/unifiedjs/unified-engine - -[args]: https://github.com/unifiedjs/unified-args - -[gulp]: https://github.com/unifiedjs/unified-engine-gulp - -[atom]: https://github.com/unifiedjs/unified-engine-atom - -[remark-rehype]: https://github.com/remarkjs/remark-rehype - -[remark-retext]: https://github.com/remarkjs/remark-retext - -[rehype-retext]: https://github.com/rehypejs/rehype-retext - -[rehype-remark]: https://github.com/rehypejs/rehype-remark - -[unist-utilities]: https://github.com/syntax-tree/unist#list-of-utilities - -[vfile]: https://github.com/vfile/vfile - -[vfile-contents]: https://github.com/vfile/vfile#vfilecontents - -[vfile-utilities]: https://github.com/vfile/vfile#related-tools - -[file]: #file - -[node]: #node - -[processor]: #processor - -[process]: #processorprocessfilevalue-done - -[parse]: #processorparsefilevalue - -[parser]: #processorparser - -[stringify]: #processorstringifynode-file - -[run]: #processorrunnode-file-done - -[compiler]: #processorcompiler - -[use]: #processoruseplugin-options - -[attacher]: #function-attacheroptions - -[transformer]: #function-transformernode-file-next - -[next]: #function-nexterr-tree-file - -[freeze]: #processorfreeze - -[plugin]: #plugin - -[run-done]: #function-doneerr-node-file - -[process-done]: #function-doneerr-file - -[trough]: https://github.com/wooorm/trough#function-fninput-next - -[promise]: https://developer.mozilla.org/Web/JavaScript/Reference/Global_Objects/Promise - -[remark-plugins]: https://github.com/remarkjs/remark/blob/master/doc/plugins.md#list-of-plugins - -[rehype-plugins]: https://github.com/rehypejs/rehype/blob/master/doc/plugins.md#list-of-plugins - -[retext-plugins]: https://github.com/retextjs/retext/blob/master/doc/plugins.md#list-of-plugins - -[stream]: https://github.com/unifiedjs/unified-stream - -[contributing]: contributing.md - -[coc]: code-of-conduct.md - -[ideas]: https://github.com/unifiedjs/ideas - -[preliminary]: https://github.com/retextjs/retext/commit/8fcb1f#diff-168726dbe96b3ce427e7fedce31bb0bc - -[externalised]: https://github.com/remarkjs/remark/commit/9892ec#diff-168726dbe96b3ce427e7fedce31bb0bc - -[published]: https://github.com/unifiedjs/unified/commit/2ba1cf - -[ware]: https://github.com/segmentio/ware diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-is/convert.js b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-is/convert.js deleted file mode 100644 index f92f34f1051b25..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-is/convert.js +++ /dev/null @@ -1,87 +0,0 @@ -'use strict' - -module.exports = convert - -function convert(test) { - if (typeof test === 'string') { - return typeFactory(test) - } - - if (test === null || test === undefined) { - return ok - } - - if (typeof test === 'object') { - return ('length' in test ? anyFactory : matchesFactory)(test) - } - - if (typeof test === 'function') { - return test - } - - throw new Error('Expected function, string, or object as test') -} - -function convertAll(tests) { - var results = [] - var length = tests.length - var index = -1 - - while (++index < length) { - results[index] = convert(tests[index]) - } - - return results -} - -// Utility assert each property in `test` is represented in `node`, and each -// values are strictly equal. -function matchesFactory(test) { - return matches - - function matches(node) { - var key - - for (key in test) { - if (node[key] !== test[key]) { - return false - } - } - - return true - } -} - -function anyFactory(tests) { - var checks = convertAll(tests) - var length = checks.length - - return matches - - function matches() { - var index = -1 - - while (++index < length) { - if (checks[index].apply(this, arguments)) { - return true - } - } - - return false - } -} - -// Utility to convert a string into a function which checks a given node’s type -// for said string. -function typeFactory(test) { - return type - - function type(node) { - return Boolean(node && node.type === test) - } -} - -// Utility to return true. -function ok() { - return true -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-is/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-is/index.js deleted file mode 100644 index f18d416e08d214..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-is/index.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict' - -var convert = require('./convert') - -module.exports = is - -is.convert = convert - -// Assert if `test` passes for `node`. -// When a `parent` node is known the `index` of node should also be given. -// eslint-disable-next-line max-params -function is(node, test, index, parent, context) { - var hasParent = parent !== null && parent !== undefined - var hasIndex = index !== null && index !== undefined - var check = convert(test) - - if ( - hasIndex && - (typeof index !== 'number' || index < 0 || index === Infinity) - ) { - throw new Error('Expected positive finite index or child node') - } - - if (hasParent && (!is(parent) || !parent.children)) { - throw new Error('Expected parent node') - } - - if (!node || !node.type || typeof node.type !== 'string') { - return false - } - - if (hasParent !== hasIndex) { - throw new Error('Expected both parent and index') - } - - return Boolean(check.call(context, node, index, parent)) -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-is/license b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-is/license deleted file mode 100644 index cfa79e66cfc072..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-is/license +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT license) - -Copyright (c) 2015 Titus Wormer - -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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-is/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-is/package.json deleted file mode 100644 index 25193acddd8a0d..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-is/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "unist-util-is", - "version": "3.0.0", - "description": "Utility to check if a node passes a test", - "license": "MIT", - "keywords": [ - "unist", - "node", - "is", - "equal", - "test", - "type", - "util", - "utility" - ], - "repository": "syntax-tree/unist-util-is", - "bugs": "https://github.com/syntax-tree/unist-util-is/issues", - "author": "Titus Wormer (https://wooorm.com)", - "contributors": [ - "Titus Wormer (https://wooorm.com)" - ], - "files": [ - "index.js", - "convert.js" - ], - "dependencies": {}, - "devDependencies": { - "browserify": "^16.0.0", - "nyc": "^14.0.0", - "prettier": "^1.0.0", - "remark-cli": "^6.0.0", - "remark-preset-wooorm": "^5.0.0", - "tape": "^4.0.0", - "tinyify": "^2.0.0", - "xo": "^0.24.0" - }, - "scripts": { - "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", - "build-bundle": "browserify . -s unistUtilIs > unist-util-is.js", - "build-mangle": "browserify . -s unistUtilIs -p tinyify > unist-util-is.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-type-error": "off" - }, - "ignore": [ - "unist-util-is.js" - ] - }, - "nyc": { - "check-coverage": true, - "lines": 100, - "functions": 100, - "branches": 100 - }, - "remarkConfig": { - "plugins": [ - "preset-wooorm" - ] - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-is/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-is/readme.md deleted file mode 100644 index 7d53629aba87db..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-is/readme.md +++ /dev/null @@ -1,202 +0,0 @@ -# unist-util-is - -[![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 check if a node passes a test. - -## Install - -[npm][]: - -```sh -npm install unist-util-is -``` - -## Usage - -```js -var is = require('unist-util-is') - -var node = {type: 'strong'} -var parent = {type: 'paragraph', children: [node]} - -function test(node, n) { - return n === 5 -} - -is() // => false -is({children: []}) // => false -is(node) // => true -is(node, 'strong') // => true -is(node, 'emphasis') // => false - -is(node, node) // => true -is(parent, {type: 'paragraph'}) // => true -is(parent, {type: 'strong'}) // => false - -is(node, test) // => false -is(node, test, 4, parent) // => false -is(node, test, 5, parent) // => true -``` - -## API - -### `is(node[, test[, index, parent[, context]]])` - -###### Parameters - -* `node` ([`Node`][node]) — Node to check. -* `test` ([`Function`][test], `string`, `Object`, or `Array.`, optional) - — When not given, checks if `node` is a [`Node`][node]. - When `string`, works like passing `node => node.type === test`. - When `array`, checks if any one of the subtests pass. - When `object`, checks that all keys in `test` are in `node`, - and that they have strictly equal values -* `index` (`number`, optional) — [Index][] of `node` in `parent` -* `parent` ([`Node`][node], optional) — [Parent][] of `node` -* `context` (`*`, optional) — Context object to invoke `test` with - -###### Returns - -`boolean` — Whether `test` passed *and* `node` is a [`Node`][node] (object with -`type` set to a non-empty `string`). - -#### `function test(node[, index, parent])` - -###### Parameters - -* `node` ([`Node`][node]) — Node to check -* `index` (`number?`) — [Index][] of `node` in `parent` -* `parent` ([`Node?`][node]) — [Parent][] of `node` - -###### Context - -`*` — The to `is` given `context`. - -###### Returns - -`boolean?` — Whether `node` matches. - -### `is.convert(test)` - -Create a test function from `test`, that can later be called with a `node`, -`index`, and `parent`. -Useful if you’re going to test many nodes, for example when creating a utility -where something else passes an is-compatible test. - -Can also be accessed with `require('unist-util-is/convert')`. - -For example: - -```js -var u = require('unist-builder') -var convert = require('unist-util-is/convert') - -var test = convert('leaf') - -var tree = u('tree', [ - u('node', [u('leaf', '1')]), - u('leaf', '2'), - u('node', [u('leaf', '3'), u('leaf', '4')]), - u('leaf', '5') -]) - -var leafs = tree.children.filter((child, index) => test(child, index, tree)) - -console.log(leafs) -``` - -Yields: - -```js -[({type: 'leaf', value: '2'}, {type: 'leaf', value: '5'})] -``` - -## Related - -* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after) - — Find a node after another node -* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) - — Find a node before another node -* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after) - — Find all nodes after another node -* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before) - — Find all nodes before another node -* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between) - — Find all nodes between two nodes -* [`unist-util-find`](https://github.com/blahah/unist-util-find) - — Find nodes matching a predicate -* [`unist-util-filter`](https://github.com/eush77/unist-util-filter) - — Create a new tree with nodes that pass a check -* [`unist-util-remove`](https://github.com/eush77/unist-util-remove) - — Remove nodes from tree - -## 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, organisation, or community you agree to -abide by its terms. - -## License - -[MIT][license] © [Titus Wormer][author] - - - -[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-is.svg - -[build]: https://travis-ci.org/syntax-tree/unist-util-is - -[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-is.svg - -[coverage]: https://codecov.io/github/syntax-tree/unist-util-is - -[downloads-badge]: https://img.shields.io/npm/dm/unist-util-is.svg - -[downloads]: https://www.npmjs.com/package/unist-util-is - -[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-is.svg - -[size]: https://bundlephobia.com/result?p=unist-util-is - -[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/join%20the%20community-on%20spectrum-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/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 - -[node]: https://github.com/syntax-tree/unist#node - -[parent]: https://github.com/syntax-tree/unist#parent-1 - -[index]: https://github.com/syntax-tree/unist#index - -[test]: #function-testnode-index-parent diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-remove-position/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-remove-position/index.js deleted file mode 100644 index 096395981793d9..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-remove-position/index.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict' - -var visit = require('unist-util-visit') - -module.exports = removePosition - -function removePosition(node, force) { - visit(node, force ? hard : soft) - return node -} - -function hard(node) { - delete node.position -} - -function soft(node) { - node.position = undefined -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-remove-position/license b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-remove-position/license deleted file mode 100644 index 8d8660d36ef2ec..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-remove-position/license +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2016 Titus Wormer - -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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-remove-position/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-remove-position/package.json deleted file mode 100644 index e1166471c37d6e..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-remove-position/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "unist-util-remove-position", - "version": "1.1.4", - "description": "Remove `position`s from a unist tree", - "license": "MIT", - "keywords": [ - "unist", - "utility", - "remove", - "position", - "location" - ], - "repository": "syntax-tree/unist-util-remove-position", - "bugs": "https://github.com/syntax-tree/unist-util-remove-position/issues", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - }, - "author": "Titus Wormer (https://wooorm.com)", - "contributors": [ - "Titus Wormer (https://wooorm.com)" - ], - "files": [ - "index.js" - ], - "dependencies": { - "unist-util-visit": "^1.1.0" - }, - "devDependencies": { - "browserify": "^16.0.0", - "nyc": "^14.0.0", - "prettier": "^1.0.0", - "remark": "^11.0.0", - "remark-cli": "^7.0.0", - "remark-preset-wooorm": "^6.0.0", - "tape": "^4.0.0", - "tinyify": "^2.0.0", - "unist-builder": "^2.0.0", - "xo": "^0.25.0" - }, - "scripts": { - "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", - "build-bundle": "browserify . -s unistUtilRemovePosition > unist-util-remove-position.js", - "build-mangle": "browserify . -s unistUtilRemovePosition -p tinyify > unist-util-remove-position.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": [ - "unist-util-remove-position.js" - ] - }, - "nyc": { - "check-coverage": true, - "lines": 100, - "functions": 100, - "branches": 100 - }, - "remarkConfig": { - "plugins": [ - "preset-wooorm" - ] - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-remove-position/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-remove-position/readme.md deleted file mode 100644 index e79ed14b35084f..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-remove-position/readme.md +++ /dev/null @@ -1,131 +0,0 @@ -# unist-util-remove-position - -[![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 remove [`position`][position]s from tree. - -## Install - -[npm][]: - -```sh -npm install unist-util-remove-position -``` - -## Usage - -```js -var remark = require('remark') -var removePosition = require('unist-util-remove-position') - -var tree = remark().parse('Some _emphasis_, **importance**, and `code`.') - -removePosition(tree, true) - -console.dir(tree, {depth: null}) -``` - -Yields: - -```js -{ - type: 'root', - children: [ - { - type: 'paragraph', - children: [ - { type: 'text', value: 'Some ' }, - { - type: 'emphasis', - children: [ { type: 'text', value: 'emphasis' } ] - }, - { type: 'text', value: ', ' }, - { - type: 'strong', - children: [ { type: 'text', value: 'importance' } ] - }, - { type: 'text', value: ', and ' }, - { type: 'inlineCode', value: 'code' }, - { type: 'text', value: '.' } - ] - } - ] -} -``` - -## API - -### `removePosition(node[, force])` - -Remove [`position`][position]s from [`node`][node]. -If `force` is given, uses `delete`, otherwise, sets `position`s to `undefined`. - -###### Returns - -The given `node`. - -## 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, organisation, or community you agree to -abide by its terms. - -## License - -[MIT][license] © [Titus Wormer][author] - - - -[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-remove-position.svg - -[build]: https://travis-ci.org/syntax-tree/unist-util-remove-position - -[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-remove-position.svg - -[coverage]: https://codecov.io/github/syntax-tree/unist-util-remove-position - -[downloads-badge]: https://img.shields.io/npm/dm/unist-util-remove-position.svg - -[downloads]: https://www.npmjs.com/package/unist-util-remove-position - -[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-remove-position.svg - -[size]: https://bundlephobia.com/result?p=unist-util-remove-position - -[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/join%20the%20community-on%20spectrum-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/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 - -[position]: https://github.com/syntax-tree/unist#position - -[node]: https://github.com/syntax-tree/unist#node diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-stringify-position/LICENSE b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-stringify-position/LICENSE deleted file mode 100644 index 8d8660d36ef2ec..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-stringify-position/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2016 Titus Wormer - -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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-stringify-position/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-stringify-position/index.js index 3be1e14276cf79..3d78a4442f72be 100644 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-stringify-position/index.js +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-stringify-position/index.js @@ -5,28 +5,28 @@ var own = {}.hasOwnProperty module.exports = stringify function stringify(value) { - /* Nothing. */ + // Nothing. if (!value || typeof value !== 'object') { - return null + return '' } - /* Node. */ + // Node. if (own.call(value, 'position') || own.call(value, 'type')) { return position(value.position) } - /* Position. */ + // Position. if (own.call(value, 'start') || own.call(value, 'end')) { return position(value) } - /* Point. */ + // Point. if (own.call(value, 'line') || own.call(value, 'column')) { return point(value) } - /* ? */ - return null + // ? + return '' } function point(point) { diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/is-whitespace-character/license b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-stringify-position/license similarity index 100% rename from tools/node_modules/eslint-plugin-markdown/node_modules/is-whitespace-character/license rename to tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-stringify-position/license diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-stringify-position/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-stringify-position/package.json index 2e20b672051031..0f35015de95ea2 100644 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-stringify-position/package.json +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-stringify-position/package.json @@ -1,47 +1,59 @@ { "name": "unist-util-stringify-position", - "version": "1.1.2", - "description": "Stringify a Unist node, position, or point", + "version": "2.0.3", + "description": "unist utility to serialize a node, position, or point as a human readable location", "license": "MIT", "keywords": [ "unist", + "unist-util", + "util", + "utility", "position", "location", "point", "node", "stringify", - "tostring", - "util", - "utility" + "tostring" ], "repository": "syntax-tree/unist-util-stringify-position", "bugs": "https://github.com/syntax-tree/unist-util-stringify-position/issues", - "author": "Titus Wormer (http://wooorm.com)", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", "contributors": [ - "Titus Wormer (http://wooorm.com)" + "Titus Wormer (https://wooorm.com)" ], + "types": "types/index.d.ts", "files": [ + "types/index.d.ts", "index.js" ], - "dependencies": {}, + "dependencies": { + "@types/unist": "^2.0.2" + }, "devDependencies": { "browserify": "^16.0.0", - "esmangle": "^1.0.0", - "nyc": "^11.0.0", - "prettier": "^1.12.1", - "remark-cli": "^5.0.0", - "remark-preset-wooorm": "^4.0.0", - "tape": "^4.5.1", - "xo": "^0.20.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", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "xo": "^0.27.0" }, "scripts": { - "format": "remark . -qfo && prettier --write '**/*.js' && xo --fix", - "build-bundle": "browserify index.js --no-builtins -s unistUtilStringifyPosition > unist-util-stringify-position.js", - "build-mangle": "esmangle unist-util-stringify-position.js > unist-util-stringify-position.min.js", + "format": "remark . -qfo && prettier --write \"**/*.{js,ts}\" && xo --fix", + "build-bundle": "browserify . -s unistUtilStringifyPosition > unist-util-stringify-position.js", + "build-mangle": "browserify . -s unistUtilStringifyPosition -p tinyify > unist-util-stringify-position.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" + "test-types": "dtslint types", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types" }, "nyc": { "check-coverage": true, @@ -60,11 +72,6 @@ "xo": { "prettier": true, "esnext": false, - "rules": { - "guard-for-in": "off", - "no-var": "off", - "prefer-arrow-callback": "off" - }, "ignores": [ "unist-util-stringify-position.js" ] diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-stringify-position/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-stringify-position/readme.md index 85c753b5e1b47d..bb565149bb3815 100644 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-stringify-position/readme.md +++ b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-stringify-position/readme.md @@ -1,28 +1,33 @@ -# unist-util-stringify-position [![Build Status][build-badge]][build-page] [![Coverage Status][coverage-badge]][coverage-page] +# unist-util-stringify-position -Stringify a [**Unist**][unist] [`Position`][position] or [`Point`][point]. +[![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] -## Installation +[**unist**][unist] utility to pretty print the positional information of a node. + +## Install [npm][]: -```bash +```sh npm install unist-util-stringify-position ``` -## Usage +## Use -```javascript +```js var stringify = require('unist-util-stringify-position') // Point stringify({line: 2, column: 3}) // => '2:3' // Position -stringify({ - start: {line: 2}, - end: {line: 3} -}) // => '2:1-3:1' +stringify({start: {line: 2}, end: {line: 3}}) // => '2:1-3:1' // Node stringify({ @@ -39,8 +44,8 @@ stringify({ ### `stringifyPosition(node|position|point)` -Stringify one point, a position (start and end points), or -a node’s position. +Stringify one [point][], a [position][] (start and end [point][]s), or a node’s +[positional information][positional-information]. ###### Parameters @@ -53,19 +58,32 @@ a node’s position. ###### Returns -`string?` — A range `ls:cs-le:ce` (when given `node` or -`position`) or a point `l:c` (when given `point`), where `l` stands -for line, `c` for column, `s` for `start`, and `e` for -end. `null` is returned if the given value is neither `node`, +`string?` — A range `ls:cs-le:ce` (when given `node` or `position`) or a point +`l:c` (when given `point`), where `l` stands for line, `c` for column, `s` for +`start`, and `e` for end. +An empty string (`''`) is returned if the given value is neither `node`, `position`, nor `point`. +## Related + +* [`unist-util-generated`](https://github.com/syntax-tree/unist-util-generated) + — Check if a node is generated +* [`unist-util-position`](https://github.com/syntax-tree/unist-util-position) + — Get positional info of nodes +* [`unist-util-remove-position`](https://github.com/syntax-tree/unist-util-remove-position) + — Remove positional info from trees +* [`unist-util-source`](https://github.com/syntax-tree/unist-util-source) + — Get the source of a value (node or position) in a file + ## Contribute -See [`contributing.md` in `syntax-tree/unist`][contributing] for ways to get +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get started. +See [`support.md`][support] for ways to get help. -This organisation has a [Code of Conduct][coc]. By interacting with this -repository, organisation, or community you agree to abide by its terms. +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. ## License @@ -75,17 +93,41 @@ repository, organisation, or community you agree to abide by its terms. [build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-stringify-position.svg -[build-page]: https://travis-ci.org/syntax-tree/unist-util-stringify-position +[build]: https://travis-ci.org/syntax-tree/unist-util-stringify-position [coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-stringify-position.svg -[coverage-page]: https://codecov.io/github/syntax-tree/unist-util-stringify-position?branch=master +[coverage]: https://codecov.io/github/syntax-tree/unist-util-stringify-position + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-stringify-position.svg + +[downloads]: https://www.npmjs.com/package/unist-util-stringify-position + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-stringify-position.svg + +[size]: https://bundlephobia.com/result?p=unist-util-stringify-position + +[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 +[license]: license -[author]: http://wooorm.com +[author]: https://wooorm.com + +[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 @@ -95,6 +137,4 @@ repository, organisation, or community you agree to abide by its terms. [point]: https://github.com/syntax-tree/unist#point -[contributing]: https://github.com/syntax-tree/unist/blob/master/contributing.md - -[coc]: https://github.com/syntax-tree/unist/blob/master/code-of-conduct.md +[positional-information]: https://github.com/syntax-tree/unist#positional-information diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit-parents/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit-parents/index.js deleted file mode 100644 index c72635924f86d1..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit-parents/index.js +++ /dev/null @@ -1,78 +0,0 @@ -'use strict' - -module.exports = visitParents - -var convert = require('unist-util-is/convert') - -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 is - - if (typeof test === 'function' && typeof visitor !== 'function') { - reverse = visitor - visitor = test - test = null - } - - is = convert(test) - - one(tree, null, []) - - // Visit a single node. - function one(node, index, parents) { - var result = [] - var subresult - - 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) { - subresult = toResult(all(node.children, parents.concat(node))) - return subresult[0] === EXIT ? subresult : result - } - - return result - } - - // Visit children in `parent`. - function all(children, parents) { - var min = -1 - var step = reverse ? -1 : 1 - var index = (reverse ? children.length : min) + step - var result - - while (index > min && index < children.length) { - result = one(children[index], index, parents) - - if (result[0] === EXIT) { - return result - } - - index = typeof result[1] === 'number' ? result[1] : index + step - } - } -} - -function toResult(value) { - if (value !== null && typeof value === 'object' && 'length' in value) { - return value - } - - if (typeof value === 'number') { - return [CONTINUE, value] - } - - return [value] -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit-parents/license b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit-parents/license deleted file mode 100644 index 8d8660d36ef2ec..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit-parents/license +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2016 Titus Wormer - -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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit-parents/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit-parents/package.json deleted file mode 100644 index 26e187202d145b..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit-parents/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "unist-util-visit-parents", - "version": "2.1.2", - "description": "Recursively walk over unist nodes, with ancestral information", - "license": "MIT", - "keywords": [ - "unist", - "walk", - "util", - "utility" - ], - "repository": "syntax-tree/unist-util-visit-parents", - "bugs": "https://github.com/syntax-tree/unist-util-visit-parents/issues", - "author": "Titus Wormer (https://wooorm.com)", - "contributors": [ - "Titus Wormer (https://wooorm.com)" - ], - "files": [ - "index.js" - ], - "dependencies": { - "unist-util-is": "^3.0.0" - }, - "devDependencies": { - "browserify": "^16.0.0", - "nyc": "^14.0.0", - "prettier": "^1.0.0", - "remark": "^10.0.0", - "remark-cli": "^6.0.0", - "remark-preset-wooorm": "^5.0.0", - "tape": "^4.0.0", - "tinyify": "^2.0.0", - "xo": "^0.24.0" - }, - "scripts": { - "format": "remark . -qfo && prettier --write \"**/*.js\" && 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": "npm run format && npm run build && npm run test-coverage" - }, - "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": [ - "unist-util-visit-parents.js" - ] - }, - "remarkConfig": { - "plugins": [ - "preset-wooorm" - ] - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit-parents/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit-parents/readme.md deleted file mode 100644 index ec7efc7bd03402..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit-parents/readme.md +++ /dev/null @@ -1,218 +0,0 @@ -# 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 -``` - -## Usage - -```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. - -###### 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 walked in [preorder][] - (NLR), visiting the node itself, then its [head][], etc. - When `reverse` is passed, the tree is stilled walked in preorder, but now - in NRL (the node itself, 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 parent still results in them being -traversed. - -###### Parameters - -* `node` ([`Node`][node]) — Found node -* `ancestors` (`Array.`) — [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/eush77/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 provided function and - then flattening -* [`unist-util-remove`](https://github.com/eush77/unist-util-remove) - — Remove nodes from a tree that pass a test -* [`unist-util-select`](https://github.com/eush77/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, organisation, or community you agree to -abide by its terms. - -## License - -[MIT][license] © [Titus Wormer][author] - - - -[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/join%20the%20community-on%20spectrum-7b16ff.svg - -[chat]: https://spectrum.chat/unified/syntax-tree - -[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/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 - -[is]: https://github.com/syntax-tree/unist-util-is - -[preorder]: https://www.geeksforgeeks.org/tree-traversals-inorder-preorder-and-postorder/ - -[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 diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit/index.js deleted file mode 100644 index 39970e7debaa49..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit/index.js +++ /dev/null @@ -1,29 +0,0 @@ -'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) - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit/license b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit/license deleted file mode 100644 index 32e7a3d93ca5a2..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit/license +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2015 Titus Wormer - -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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit/package.json deleted file mode 100644 index 44b8bd4897b398..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit/package.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "name": "unist-util-visit", - "version": "1.4.1", - "description": "Recursively walk over unist nodes", - "license": "MIT", - "keywords": [ - "unist", - "remark", - "markdown", - "retext", - "natural", - "language", - "node", - "visit", - "walk", - "util", - "utility" - ], - "repository": "syntax-tree/unist-util-visit", - "bugs": "https://github.com/syntax-tree/unist-util-visit/issues", - "author": "Titus Wormer (https://wooorm.com)", - "contributors": [ - "Titus Wormer (https://wooorm.com)", - "Eugene Sharygin ", - "Richard Gibson " - ], - "files": [ - "index.js" - ], - "dependencies": { - "unist-util-visit-parents": "^2.0.0" - }, - "devDependencies": { - "browserify": "^16.0.0", - "nyc": "^14.0.0", - "prettier": "^1.0.0", - "remark": "^10.0.0", - "remark-cli": "^6.0.0", - "remark-preset-wooorm": "^5.0.0", - "tape": "^4.0.0", - "tinyify": "^2.0.0", - "xo": "^0.24.0" - }, - "scripts": { - "format": "remark . -qfo && prettier --write \"**/*.js\" && 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": "npm run format && npm run build && npm run test-coverage" - }, - "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": [ - "unist-util-visit.js" - ] - }, - "remarkConfig": { - "plugins": [ - "preset-wooorm" - ] - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit/readme.md deleted file mode 100644 index 25808a27a543e5..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/unist-util-visit/readme.md +++ /dev/null @@ -1,121 +0,0 @@ -# unist-util-visit - -[![Build][build-badge]][build] -[![Coverage][coverage-badge]][coverage] -[![Downloads][downloads-badge]][downloads] -[![Size][size-badge]][size] - -[**unist**][unist] utility to visit nodes. - -## Install - -[npm][]: - -```bash -npm install unist-util-visit -``` - -## Usage - -```javascript -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/eush77/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-remove`](https://github.com/eush77/unist-util-remove) - — Remove nodes from a tree that pass a test -* [`unist-util-select`](https://github.com/eush77/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, organisation, or community you agree to -abide by its terms. - -## License - -[MIT][license] © [Titus Wormer][author] - - - -[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 - -[npm]: https://docs.npmjs.com/cli/install - -[license]: license - -[author]: https://wooorm.com - -[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 - -[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 diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-location/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-location/index.js deleted file mode 100644 index 2d7c21c1808b7f..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-location/index.js +++ /dev/null @@ -1,74 +0,0 @@ -'use strict' - -module.exports = factory - -function factory(file) { - var contents = indices(String(file)) - - return { - toPosition: offsetToPositionFactory(contents), - toOffset: positionToOffsetFactory(contents) - } -} - -// Factory to get the line and column-based `position` for `offset` in the bound -// indices. -function offsetToPositionFactory(indices) { - return offsetToPosition - - // Get the line and column-based `position` for `offset` in the bound indices. - function offsetToPosition(offset) { - var index = -1 - var length = indices.length - - if (offset < 0) { - return {} - } - - while (++index < length) { - if (indices[index] > offset) { - return { - line: index + 1, - column: offset - (indices[index - 1] || 0) + 1, - offset: offset - } - } - } - - return {} - } -} - -// Factory to get the `offset` for a line and column-based `position` in the -// bound indices. -function positionToOffsetFactory(indices) { - return positionToOffset - - // Get the `offset` for a line and column-based `position` in the bound - // indices. - function positionToOffset(position) { - var line = position && position.line - var column = position && position.column - - if (!isNaN(line) && !isNaN(column) && line - 1 in indices) { - return (indices[line - 2] || 0) + column - 1 || 0 - } - - return -1 - } -} - -// Get indices of line-breaks in `value`. -function indices(value) { - var result = [] - var index = value.indexOf('\n') - - while (index !== -1) { - result.push(index + 1) - index = value.indexOf('\n', index + 1) - } - - result.push(value.length + 1) - - return result -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-location/license b/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-location/license deleted file mode 100644 index 8d8660d36ef2ec..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-location/license +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2016 Titus Wormer - -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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-location/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-location/package.json deleted file mode 100644 index f66857cf1c9cec..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-location/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "vfile-location", - "version": "2.0.6", - "description": "Convert between positions (line and column-based) and offsets (range-based) locations in a virtual file", - "license": "MIT", - "keywords": [ - "remark", - "comment", - "message", - "marker", - "control" - ], - "repository": "vfile/vfile-location", - "bugs": "https://github.com/vfile/vfile-location/issues", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - }, - "author": "Titus Wormer (https://wooorm.com)", - "contributors": [ - "Titus Wormer (https://wooorm.com)" - ], - "files": [ - "index.js" - ], - "dependencies": {}, - "devDependencies": { - "browserify": "^16.0.0", - "nyc": "^14.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", - "vfile": "^4.0.0", - "xo": "^0.25.0" - }, - "scripts": { - "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", - "build-bundle": "browserify . -s vfileLocation > vfile-location.js", - "build-mangle": "browserify . -s vfileLocation -p tinyify > vfile-location.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" - }, - "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": [ - "vfile-location.js" - ] - }, - "remarkConfig": { - "plugins": [ - "preset-wooorm" - ] - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-location/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-location/readme.md deleted file mode 100644 index aa126a3fe3978d..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-location/readme.md +++ /dev/null @@ -1,115 +0,0 @@ -# vfile-location - -[![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] - -Convert between positions (line and column-based) and offsets (range-based) -locations in a [virtual file][vfile]. - -## Install - -[npm][]: - -```sh -npm install vfile-location -``` - -## Usage - -```js -var vfile = require('vfile') -var vfileLocation = require('vfile-location') - -var location = vfileLocation(vfile('foo\nbar\nbaz')) - -var offset = location.toOffset({line: 3, column: 3}) // => 10 -location.toPosition(offset) // => {line: 3, column: 3, offset: 10} -``` - -## API - -### `location = vfileLocation(doc)` - -Get transform functions for the given `doc` (`string`) or [`file`][vfile]. - -Returns an object with [`toOffset`][to-offset] and [`toPosition`][to-position]. - -### `location.toOffset(position)` - -Get the `offset` (`number`) for a line and column-based [`position`][position] -in the bound file. -Returns `-1` when given invalid or out of bounds input. - -### `location.toPosition(offset)` - -Get the line and column-based [`position`][position] for `offset` in the bound -file. - -## Contribute - -See [`contributing.md`][contributing] in [`vfile/.github`][health] for ways to -get started. -See [`support.md`][support] for ways to get help. - -This project has a [Code of Conduct][coc]. -By interacting with this repository, organisation, or community you agree to -abide by its terms. - -## License - -[MIT][license] © [Titus Wormer][author] - - - -[build-badge]: https://img.shields.io/travis/vfile/vfile-location.svg - -[build]: https://travis-ci.org/vfile/vfile-location - -[coverage-badge]: https://img.shields.io/codecov/c/github/vfile/vfile-location.svg - -[coverage]: https://codecov.io/github/vfile/vfile-location - -[downloads-badge]: https://img.shields.io/npm/dm/vfile-location.svg - -[downloads]: https://www.npmjs.com/package/vfile-location - -[size-badge]: https://img.shields.io/bundlephobia/minzip/vfile-location.svg - -[size]: https://bundlephobia.com/result?p=vfile-location - -[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/join%20the%20community-on%20spectrum-7b16ff.svg - -[chat]: https://spectrum.chat/unified/vfile - -[npm]: https://docs.npmjs.com/cli/install - -[contributing]: https://github.com/vfile/.github/blob/master/contributing.md - -[support]: https://github.com/vfile/.github/blob/master/support.md - -[health]: https://github.com/vfile/.github - -[coc]: https://github.com/vfile/.github/blob/master/code-of-conduct.md - -[license]: license - -[author]: https://wooorm.com - -[vfile]: https://github.com/vfile/vfile - -[to-offset]: #locationtooffsetposition - -[to-position]: #locationtopositionoffset - -[position]: https://github.com/syntax-tree/unist#position diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-message/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-message/index.js deleted file mode 100644 index c913753249edad..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-message/index.js +++ /dev/null @@ -1,94 +0,0 @@ -'use strict' - -var stringify = require('unist-util-stringify-position') - -module.exports = VMessage - -// Inherit from `Error#`. -function VMessagePrototype() {} -VMessagePrototype.prototype = Error.prototype -VMessage.prototype = new VMessagePrototype() - -// Message properties. -var proto = VMessage.prototype - -proto.file = '' -proto.name = '' -proto.reason = '' -proto.message = '' -proto.stack = '' -proto.fatal = null -proto.column = null -proto.line = null - -// Construct a new VMessage. -// -// Note: We cannot invoke `Error` on the created context, as that adds readonly -// `line` and `column` attributes on Safari 9, thus throwing and failing the -// data. -function VMessage(reason, position, origin) { - var parts - var range - var location - - if (typeof position === 'string') { - origin = position - position = null - } - - parts = parseOrigin(origin) - range = stringify(position) || '1:1' - - location = { - start: {line: null, column: null}, - end: {line: null, column: null} - } - - // Node. - if (position && position.position) { - position = position.position - } - - if (position) { - // Position. - if (position.start) { - location = position - position = position.start - } else { - // Point. - location.start = position - } - } - - if (reason.stack) { - this.stack = reason.stack - reason = reason.message - } - - this.message = reason - this.name = range - this.reason = reason - this.line = position ? position.line : null - this.column = position ? position.column : null - this.location = location - this.source = parts[0] - this.ruleId = parts[1] -} - -function parseOrigin(origin) { - var result = [null, null] - var index - - if (typeof origin === 'string') { - index = origin.indexOf(':') - - if (index === -1) { - result[1] = origin - } else { - result[0] = origin.slice(0, index) - result[1] = origin.slice(index + 1) - } - } - - return result -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-message/license b/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-message/license deleted file mode 100644 index 045ffe0e075da4..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-message/license +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2017 Titus Wormer - -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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-message/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-message/package.json deleted file mode 100644 index 7396bb68e54f70..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-message/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "vfile-message", - "version": "1.1.1", - "description": "Create a virtual message", - "license": "MIT", - "keywords": [ - "vfile", - "virtual", - "message" - ], - "repository": "vfile/vfile-message", - "bugs": "https://github.com/vfile/vfile-message/issues", - "author": "Titus Wormer (https://wooorm.com)", - "contributors": [ - "Titus Wormer (https://wooorm.com)" - ], - "files": [ - "index.js" - ], - "dependencies": { - "unist-util-stringify-position": "^1.1.1" - }, - "devDependencies": { - "browserify": "^16.0.0", - "nyc": "^13.0.0", - "prettier": "^1.12.1", - "remark-cli": "^6.0.0", - "remark-preset-wooorm": "^4.0.0", - "tape": "^4.0.0", - "tinyify": "^2.4.3", - "xo": "^0.23.0" - }, - "scripts": { - "format": "remark . -qfo && prettier --write '**/*.js' && xo --fix", - "build-bundle": "browserify . -s vfileMessage > vfile-message.js", - "build-mangle": "browserify . -s vfileMessage -p tinyify > vfile-message.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" - }, - "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": { - "no-var": "off", - "prefer-arrow-callback": "off", - "object-shorthand": "off" - }, - "ignores": [ - "vfile-message.js" - ] - }, - "remarkConfig": { - "plugins": [ - "preset-wooorm" - ] - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-message/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-message/readme.md deleted file mode 100644 index 0c88353a53c9cf..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile-message/readme.md +++ /dev/null @@ -1,194 +0,0 @@ -# vfile-message - -[![Build][build-badge]][build] -[![Coverage][coverage-badge]][coverage] -[![Downloads][downloads-badge]][downloads] -[![Chat][chat-badge]][chat] - -Create [vfile][] messages. - -## Installation - -[npm][]: - -```bash -npm install vfile-message -``` - -## Usage - -```js -var VMessage = require('vfile-message') - -var message = new VMessage( - '`braavo` is misspelt; did you mean `bravo`?', - {line: 1, column: 8}, - 'spell:typo' -) - -console.log(message) -``` - -Yields: - -```js -{ [1:8: `braavo` is misspelt; did you mean `bravo`?] - reason: '`braavo` is misspelt; did you mean `bravo`?', - fatal: null, - line: 1, - column: 8, - location: - { start: { line: 1, column: 8 }, - end: { line: null, column: null } }, - source: 'spell', - ruleId: 'typo' } -``` - -## API - -### `VMessage(reason[, position][, origin])` - -Constructor of a message for `reason` at `position` from `origin`. When -an error is passed in as `reason`, copies the stack. - -##### Parameters - -###### `reason` - -Reason for message (`string` or `Error`). Uses the stack and message of the -error if given. - -###### `position` - -Place at which the message occurred in a file ([`Node`][node], -[`Position`][position], or [`Point`][point], optional). - -###### `origin` - -Place in code the message originates from (`string`, optional). - -Can either be the [`ruleId`][ruleid] (`'rule'`), or a string with both a -[`source`][source] and a [`ruleId`][ruleid] delimited with a colon -(`'source:rule'`). - -##### Extends - -[`Error`][error]. - -##### Returns - -An instance of itself. - -##### Properties - -###### `reason` - -Reason for message (`string`). - -###### `fatal` - -If `true`, marks associated file as no longer processable (`boolean?`). If -`false`, necessitates a (potential) change. The value can also be `null` or -`undefined`. - -###### `line` - -Starting line of error (`number?`). - -###### `column` - -Starting column of error (`number?`). - -###### `location` - -Full range information, when available ([`Position`][position]). Has `start` -and `end` properties, both set to an object with `line` and `column`, set to -`number?`. - -###### `source` - -Namespace of warning (`string?`). - -###### `ruleId` - -Category of message (`string?`). - -###### `stack` - -Stack of message (`string?`). - -##### Custom properties - -It’s OK to store custom data directly on the `VMessage`, some of those are -handled by [utilities][util]. - -###### `file` - -You may add a `file` property with a path of a file (used throughout the -[**VFile**][vfile] ecosystem). - -###### `note` - -You may add a `note` property with a long form description of the message -(supported by [`vfile-reporter`][reporter]). - -###### `url` - -You may add a `url` property with a link to documentation for the message. - -## Contribute - -See [`contributing.md` in `vfile/vfile`][contributing] for ways to get started. - -This organisation has a [Code of Conduct][coc]. By interacting with this -repository, organisation, or community you agree to abide by its terms. - -## License - -[MIT][license] © [Titus Wormer][author] - - - -[build-badge]: https://img.shields.io/travis/vfile/vfile-message.svg - -[build]: https://travis-ci.org/vfile/vfile-message - -[coverage-badge]: https://img.shields.io/codecov/c/github/vfile/vfile-message.svg - -[coverage]: https://codecov.io/github/vfile/vfile-message - -[downloads-badge]: https://img.shields.io/npm/dm/vfile-message.svg - -[downloads]: https://www.npmjs.com/package/vfile-message - -[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg - -[chat]: https://spectrum.chat/unified/vfile - -[npm]: https://docs.npmjs.com/cli/install - -[license]: license - -[author]: https://wooorm.com - -[error]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error - -[node]: https://github.com/syntax-tree/unist#node - -[position]: https://github.com/syntax-tree/unist#position - -[point]: https://github.com/syntax-tree/unist#point - -[vfile]: https://github.com/vfile/vfile - -[contributing]: https://github.com/vfile/vfile/blob/master/contributing.md - -[coc]: https://github.com/vfile/vfile/blob/master/code-of-conduct.md - -[util]: https://github.com/vfile/vfile#utilities - -[reporter]: https://github.com/vfile/vfile-reporter - -[ruleid]: #ruleid - -[source]: #source diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile/LICENSE b/tools/node_modules/eslint-plugin-markdown/node_modules/vfile/LICENSE deleted file mode 100644 index f3722d94b38121..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -(The MIT License) - -Copyright (c) 2015 Titus Wormer - -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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile/core.js b/tools/node_modules/eslint-plugin-markdown/node_modules/vfile/core.js deleted file mode 100644 index 2d88a333993a08..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile/core.js +++ /dev/null @@ -1,169 +0,0 @@ -'use strict'; - -var path = require('path'); -var replace = require('replace-ext'); -var buffer = require('is-buffer'); - -module.exports = VFile; - -var own = {}.hasOwnProperty; -var proto = VFile.prototype; - -proto.toString = toString; - -/* Order of setting (least specific to most), we need this because - * otherwise `{stem: 'a', path: '~/b.js'}` would throw, as a path - * is needed before a stem can be set. */ -var order = [ - 'history', - 'path', - 'basename', - 'stem', - 'extname', - 'dirname' -]; - -/* Construct a new file. */ -function VFile(options) { - var prop; - var index; - var length; - - if (!options) { - options = {}; - } else if (typeof options === 'string' || buffer(options)) { - options = {contents: options}; - } else if ('message' in options && 'messages' in options) { - return options; - } - - if (!(this instanceof VFile)) { - return new VFile(options); - } - - this.data = {}; - this.messages = []; - this.history = []; - this.cwd = process.cwd(); - - /* Set path related properties in the correct order. */ - index = -1; - length = order.length; - - while (++index < length) { - prop = order[index]; - - if (own.call(options, prop)) { - this[prop] = options[prop]; - } - } - - /* Set non-path related properties. */ - for (prop in options) { - if (order.indexOf(prop) === -1) { - this[prop] = options[prop]; - } - } -} - -/* Access full path (`~/index.min.js`). */ -Object.defineProperty(proto, 'path', { - get: function () { - return this.history[this.history.length - 1]; - }, - set: function (path) { - assertNonEmpty(path, 'path'); - - if (path !== this.path) { - this.history.push(path); - } - } -}); - -/* Access parent path (`~`). */ -Object.defineProperty(proto, 'dirname', { - get: function () { - return typeof this.path === 'string' ? path.dirname(this.path) : undefined; - }, - set: function (dirname) { - assertPath(this.path, 'dirname'); - this.path = path.join(dirname || '', this.basename); - } -}); - -/* Access basename (`index.min.js`). */ -Object.defineProperty(proto, 'basename', { - get: function () { - return typeof this.path === 'string' ? path.basename(this.path) : undefined; - }, - set: function (basename) { - assertNonEmpty(basename, 'basename'); - assertPart(basename, 'basename'); - this.path = path.join(this.dirname || '', basename); - } -}); - -/* Access extname (`.js`). */ -Object.defineProperty(proto, 'extname', { - get: function () { - return typeof this.path === 'string' ? path.extname(this.path) : undefined; - }, - set: function (extname) { - var ext = extname || ''; - - assertPart(ext, 'extname'); - assertPath(this.path, 'extname'); - - if (ext) { - if (ext.charAt(0) !== '.') { - throw new Error('`extname` must start with `.`'); - } - - if (ext.indexOf('.', 1) !== -1) { - throw new Error('`extname` cannot contain multiple dots'); - } - } - - this.path = replace(this.path, ext); - } -}); - -/* Access stem (`index.min`). */ -Object.defineProperty(proto, 'stem', { - get: function () { - return typeof this.path === 'string' ? path.basename(this.path, this.extname) : undefined; - }, - set: function (stem) { - assertNonEmpty(stem, 'stem'); - assertPart(stem, 'stem'); - this.path = path.join(this.dirname || '', stem + (this.extname || '')); - } -}); - -/* Get the value of the file. */ -function toString(encoding) { - var value = this.contents || ''; - return buffer(value) ? value.toString(encoding) : String(value); -} - -/* Assert that `part` is not a path (i.e., does - * not contain `path.sep`). */ -function assertPart(part, name) { - if (part.indexOf(path.sep) !== -1) { - throw new Error('`' + name + '` cannot be a path: did not expect `' + path.sep + '`'); - } -} - -/* Assert that `part` is not empty. */ -function assertNonEmpty(part, name) { - if (!part) { - throw new Error('`' + name + '` cannot be empty'); - } -} - -/* Assert `path` exists. */ -function assertPath(path, name) { - if (!path) { - throw new Error('Setting `' + name + '` requires `path` to be set too'); - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/vfile/index.js deleted file mode 100644 index 9b3c7e0d10e109..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile/index.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; - -var VMessage = require('vfile-message'); -var VFile = require('./core.js'); - -module.exports = VFile; - -var proto = VFile.prototype; - -proto.message = message; -proto.info = info; -proto.fail = fail; - -/* Slight backwards compatibility. Remove in the future. */ -proto.warn = message; - -/* Create a message with `reason` at `position`. - * When an error is passed in as `reason`, copies the stack. */ -function message(reason, position, origin) { - var filePath = this.path; - var message = new VMessage(reason, position, origin); - - if (filePath) { - message.name = filePath + ':' + message.name; - message.file = filePath; - } - - message.fatal = false; - - this.messages.push(message); - - return message; -} - -/* Fail. Creates a vmessage, associates it with the file, - * and throws it. */ -function fail() { - var message = this.message.apply(this, arguments); - - message.fatal = true; - - throw message; -} - -/* Info. Creates a vmessage, associates it with the file, - * and marks the fatality as null. */ -function info() { - var message = this.message.apply(this, arguments); - - message.fatal = null; - - return message; -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/vfile/package.json deleted file mode 100644 index aba5f34dd9d5ab..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "name": "vfile", - "version": "2.3.0", - "description": "Virtual file format for text processing", - "license": "MIT", - "keywords": [ - "virtual", - "file", - "text", - "processing", - "message", - "warning", - "error", - "remark", - "retext" - ], - "repository": "vfile/vfile", - "bugs": "https://github.com/vfile/vfile/issues", - "author": "Titus Wormer (http://wooorm.com)", - "contributors": [ - "Titus Wormer (http://wooorm.com)", - "Brendan Abbott ", - "Denys Dovhan ", - "Kyle Mathews ", - "Shinnosuke Watanabe ", - "Sindre Sorhus " - ], - "files": [ - "core.js", - "index.js" - ], - "dependencies": { - "is-buffer": "^1.1.4", - "replace-ext": "1.0.0", - "unist-util-stringify-position": "^1.0.0", - "vfile-message": "^1.0.0" - }, - "devDependencies": { - "browserify": "^14.0.0", - "esmangle": "^1.0.0", - "nyc": "^11.0.0", - "remark-cli": "^4.0.0", - "remark-preset-wooorm": "^3.0.0", - "tape": "^4.4.0", - "xo": "^0.18.0" - }, - "scripts": { - "build-md": "remark . -qfo", - "build-bundle": "browserify index.js -s VFile > vfile.js", - "build-mangle": "esmangle vfile.js > vfile.min.js", - "build": "npm run build-md && npm run build-bundle && npm run build-mangle", - "lint": "xo", - "test-api": "node test", - "test-coverage": "nyc --reporter lcov tape test.js", - "test": "npm run build && npm run lint && npm run test-coverage" - }, - "nyc": { - "check-coverage": true, - "lines": 100, - "functions": 100, - "branches": 100 - }, - "xo": { - "space": true, - "esnext": false, - "rules": { - "unicorn/no-new-buffer": "off" - }, - "ignores": [ - "vfile.js" - ] - }, - "remarkConfig": { - "plugins": [ - "preset-wooorm" - ] - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile/readme.md b/tools/node_modules/eslint-plugin-markdown/node_modules/vfile/readme.md deleted file mode 100644 index 1488031d7edd0a..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/vfile/readme.md +++ /dev/null @@ -1,285 +0,0 @@ -# ![vfile][] - -[![Build Status][build-badge]][build-status] -[![Coverage Status][coverage-badge]][coverage-status] - -**VFile** is a virtual file format used by [**unified**][unified], -a text processing umbrella (it powers [**retext**][retext] for -natural language, [**remark**][remark] for markdown, and -[**rehype**][rehype] for HTML). Each processors that parse, transform, -and compile text, and need a virtual representation of files and a -place to store [messages][] about them. Plus, they work in the browser. -**VFile** provides these requirements at a small size, in IE 9 and up. - -> **VFile** is different from the excellent [**vinyl**][vinyl] -> in that it has a smaller API, a smaller size, and focuses on -> [messages][]. - -VFile can be used anywhere where files need a lightweight representation. -For example, it’s used in: - -* [`documentation`](https://github.com/documentationjs/documentation) - — The documentation system for modern JavaScript -* [`weh`](https://github.com/wehjs/weh) - — Declarative small site generator -* [`geojsonhint`](https://github.com/mapbox/geojsonhint) - — Complete, fast, standards-based validation for geojson - -## Installation - -[npm][]: - -```bash -npm install vfile -``` - -## Table of Contents - -* [Usage](#usage) -* [Utilities](#utilities) -* [Reporters](#reporters) -* [API](#api) - * [VFile(\[options\])](#vfileoptions) - * [vfile.contents](#vfilecontents) - * [vfile.cwd](#vfilecwd) - * [vfile.path](#vfilepath) - * [vfile.basename](#vfilebasename) - * [vfile.stem](#vfilestem) - * [vfile.extname](#vfileextname) - * [vfile.dirname](#vfiledirname) - * [vfile.history](#vfilehistory) - * [vfile.messages](#vfilemessages) - * [vfile.data](#vfiledata) - * [VFile#toString(\[encoding\])](#vfiletostringencoding) - * [VFile#message(reason\[, position\]\[, origin\])](#vfilemessagereason-position-origin) - * [VFile#info(reason\[, position\]\[, origin\])](#vfileinforeason-position-origin) - * [VFile#fail(reason\[, position\]\[, origin\])](#vfilefailreason-position-origin) -* [License](#license) - -## Usage - -```js -var vfile = require('vfile'); - -var file = vfile({path: '~/example.txt', contents: 'Alpha *braavo* charlie.'}); - -file.path; //=> '~/example.txt' -file.dirname; //=> '~' - -file.extname = '.md'; - -file.basename; //=> 'example.md' - -file.basename = 'index.text'; - -file.history; //=> ['~/example.txt', '~/example.md', '~/index.text'] - -file.message('`braavo` is misspelt; did you mean `bravo`?', {line: 1, column: 8}); - -console.log(file.messages); -``` - -Yields: - -```js -[ { [~/index.text:1:8: `braavo` is misspelt; did you mean `bravo`?] - message: '`braavo` is misspelt; did you mean `bravo`?', - name: '~/index.text:1:8', - file: '~/index.text', - reason: '`braavo` is misspelt; did you mean `bravo`?', - line: 1, - column: 8, - location: { start: [Object], end: [Object] }, - ruleId: null, - source: null, - fatal: false } ] -``` - -## Utilities - -The following list of projects includes tools for working with virtual -files. See [**Unist**][unist] for projects working with nodes. - -* [`convert-vinyl-to-vfile`](https://github.com/dustinspecker/convert-vinyl-to-vfile) - — Convert from [Vinyl][] -* [`is-vfile-message`](https://github.com/shinnn/is-vfile-message) - — Check if a value is a `VMessage` object -* [`to-vfile`](https://github.com/vfile/to-vfile) - — Create a virtual file from a file-path (and optionally read it) -* [`vfile-find-down`](https://github.com/vfile/vfile-find-down) - — Find files by searching the file system downwards -* [`vfile-find-up`](https://github.com/vfile/vfile-find-up) - — Find files by searching the file system upwards -* [`vfile-location`](https://github.com/vfile/vfile-location) - — Convert between line/column- and range-based locations -* [`vfile-statistics`](https://github.com/vfile/vfile-statistics) - — Count messages per category -* [`vfile-messages-to-vscode-diagnostics`](https://github.com/shinnn/vfile-messages-to-vscode-diagnostics) - — Convert to VS Code diagnostics -* [`vfile-sort`](https://github.com/vfile/vfile-sort) - — Sort messages by line/column -* [`vfile-to-eslint`](https://github.com/vfile/vfile-to-eslint) - — Convert VFiles to ESLint formatter compatible output - -## Reporters - -The following list of projects show linting results for given virtual files. -Reporters _must_ accept `Array.` as their first argument, and return -`string`. Reporters _may_ accept other values too, in which case it’s suggested -to stick to `vfile-reporter`s interface. - -* [`vfile-reporter`][reporter] - — Stylish reporter -* [`vfile-reporter-json`](https://github.com/vfile/vfile-reporter-json) - — JSON reporter -* [`vfile-reporter-pretty`](https://github.com/vfile/vfile-reporter-pretty) - — Pretty reporter - -## API - -### `VFile([options])` - -Create a new virtual file. If `options` is `string` or `Buffer`, treats -it as `{contents: options}`. If `options` is a `VFile`, returns it. -All other options are set on the newly created `vfile`. - -Path related properties are set in the following order (least specific -to most specific): `history`, `path`, `basename`, `stem`, `extname`, -`dirname`. - -It’s not possible to set either `dirname` or `extname` without setting -either `history`, `path`, `basename`, or `stem` as well. - -###### Example - -```js -vfile(); -vfile('console.log("alpha");'); -vfile(Buffer.from('exit 1')); -vfile({path: path.join(__dirname, 'readme.md')}); -vfile({stem: 'readme', extname: '.md', dirname: __dirname}); -vfile({other: 'properties', are: 'copied', ov: {e: 'r'}}); -``` - -### `vfile.contents` - -`Buffer`, `string`, `null` — Raw value. - -### `vfile.cwd` - -`string` — Base of `path`. Defaults to `process.cwd()`. - -### `vfile.path` - -`string?` — Path of `vfile`. Cannot be nullified. - -### `vfile.basename` - -`string?` — Current name (including extension) of `vfile`. Cannot -contain path separators. Cannot be nullified either (use -`file.path = file.dirname` instead). - -### `vfile.stem` - -`string?` — Name (without extension) of `vfile`. Cannot be nullified, -and cannot contain path separators. - -### `vfile.extname` - -`string?` — Extension (with dot) of `vfile`. Cannot be set if -there’s no `path` yet and cannot contain path separators. - -### `vfile.dirname` - -`string?` — Path to parent directory of `vfile`. Cannot be set if -there’s no `path` yet. - -### `vfile.history` - -`Array.` — List of file-paths the file moved between. - -### `vfile.messages` - -[`Array.`][message] — List of messages associated with the file. - -### `vfile.data` - -`Object` — Place to store custom information. It’s OK to store custom -data directly on the `vfile`, moving it to `data` gives a _little_ more -privacy. - -### `VFile#toString([encoding])` - -Convert contents of `vfile` to string. If `contents` is a buffer, -`encoding` is used to stringify buffers (default: `'utf8'`). - -### `VFile#message(reason[, position][, origin])` - -Associates a message with the file, where `fatal` is set to `false`. -Constructs a new [`VMessage`][vmessage] and adds it to -[`vfile.messages`][messages]. - -##### Returns - -[`VMessage`][vmessage]. - -### `VFile#info(reason[, position][, origin])` - -Associates an informational message with the file, where `fatal` is set to -`null`. Calls [`#message()`][message] internally. - -##### Returns - -[`VMessage`][vmessage]. - -### `VFile#fail(reason[, position][, origin])` - -Associates a fatal message with the file, then immediately throws it. -Note: fatal errors mean a file is no longer processable. -Calls [`#message()`][message] internally. - -##### Throws - -[`VMessage`][vmessage]. - -## License - -[MIT][license] © [Titus Wormer][author] - - - -[build-badge]: https://img.shields.io/travis/vfile/vfile.svg - -[build-status]: https://travis-ci.org/vfile/vfile - -[coverage-badge]: https://img.shields.io/codecov/c/github/vfile/vfile.svg - -[coverage-status]: https://codecov.io/github/vfile/vfile - -[npm]: https://docs.npmjs.com/cli/install - -[license]: LICENSE - -[author]: http://wooorm.com - -[vfile]: https://cdn.rawgit.com/vfile/vfile/f65510e/logo.svg - -[unified]: https://github.com/unifiedjs/unified - -[retext]: https://github.com/wooorm/retext - -[remark]: https://github.com/wooorm/remark - -[rehype]: https://github.com/wooorm/rehype - -[vinyl]: https://github.com/gulpjs/vinyl - -[unist]: https://github.com/syntax-tree/unist#list-of-utilities - -[reporter]: https://github.com/vfile/vfile-reporter - -[vmessage]: https://github.com/vfile/vfile-message - -[messages]: #vfilemessages - -[message]: #vfilemessagereason-position-origin diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/x-is-string/LICENCE b/tools/node_modules/eslint-plugin-markdown/node_modules/x-is-string/LICENCE deleted file mode 100644 index 0d0834052f3c54..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/x-is-string/LICENCE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2014 Matt-Esch. - -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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/x-is-string/README.md b/tools/node_modules/eslint-plugin-markdown/node_modules/x-is-string/README.md deleted file mode 100644 index 99977d475ac91e..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/x-is-string/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# x-is-string - -Simple string test - -## Example - -```js -var isString = require("x-is-string") - -isString("hello") -// -> true - -isString("") -// -> true - -isString(new String("things")) -// -> true - -isString(1) -// -> false - -isString(true) -// -> false - -isString(new Date()) -// -> false - -isString({}) -// -> false - -isString(null) -// -> false - -isString(undefined) -// -> false -``` - -## Installation - -`npm install x-is-string` - -## Contributors - - - Matt-Esch - -## MIT Licenced \ No newline at end of file diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/x-is-string/index.js b/tools/node_modules/eslint-plugin-markdown/node_modules/x-is-string/index.js deleted file mode 100644 index 090130d4ce4026..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/x-is-string/index.js +++ /dev/null @@ -1,7 +0,0 @@ -var toString = Object.prototype.toString - -module.exports = isString - -function isString(obj) { - return toString.call(obj) === "[object String]" -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/x-is-string/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/x-is-string/package.json deleted file mode 100644 index ea267ce35112e1..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/x-is-string/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "x-is-string", - "version": "0.1.0", - "description": "Simple string test", - "keywords": [], - "author": "Matt-Esch ", - "repository": "git://github.com/Matt-Esch/x-is-string.git", - "main": "index", - "homepage": "https://github.com/Matt-Esch/x-is-string", - "contributors": [ - { - "name": "Matt-Esch" - } - ], - "bugs": { - "url": "https://github.com/Matt-Esch/x-is-string/issues", - "email": "matt@mattesch.info" - }, - "dependencies": {}, - "devDependencies": { - "tape": "^2.12.2" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/Matt-Esch/x-is-string/raw/master/LICENSE" - } - ], - "scripts": { - "test": "node ./test/index.js", - "start": "node ./index.js", - "watch": "nodemon -w ./index.js index.js", - "travis-test": "istanbul cover ./test/index.js && ((cat coverage/lcov.info | coveralls) || exit 0)", - "cover": "istanbul cover --report none --print detail ./test/index.js", - "view-cover": "istanbul report html && google-chrome ./coverage/index.html", - "test-browser": "testem-browser ./test/browser/index.js", - "testem": "testem-both -b=./test/browser/index.js" - }, - "testling": { - "files": "test/index.js", - "browsers": [ - "ie/8..latest", - "firefox/16..latest", - "firefox/nightly", - "chrome/22..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/xtend/LICENSE b/tools/node_modules/eslint-plugin-markdown/node_modules/xtend/LICENSE deleted file mode 100644 index 0099f4f6c77f40..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/xtend/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) -Copyright (c) 2012-2014 Raynos. - -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. diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/xtend/README.md b/tools/node_modules/eslint-plugin-markdown/node_modules/xtend/README.md deleted file mode 100644 index 4a2703cff276b1..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/xtend/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# xtend - -[![browser support][3]][4] - -[![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges) - -Extend like a boss - -xtend is a basic utility library which allows you to extend an object by appending all of the properties from each object in a list. When there are identical properties, the right-most property takes precedence. - -## Examples - -```js -var extend = require("xtend") - -// extend returns a new object. Does not mutate arguments -var combination = extend({ - a: "a", - b: "c" -}, { - b: "b" -}) -// { a: "a", b: "b" } -``` - -## Stability status: Locked - -## MIT Licensed - - - [3]: http://ci.testling.com/Raynos/xtend.png - [4]: http://ci.testling.com/Raynos/xtend diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/xtend/immutable.js b/tools/node_modules/eslint-plugin-markdown/node_modules/xtend/immutable.js deleted file mode 100644 index 94889c9de11a18..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/xtend/immutable.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = extend - -var hasOwnProperty = Object.prototype.hasOwnProperty; - -function extend() { - var target = {} - - for (var i = 0; i < arguments.length; i++) { - var source = arguments[i] - - for (var key in source) { - if (hasOwnProperty.call(source, key)) { - target[key] = source[key] - } - } - } - - return target -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/xtend/mutable.js b/tools/node_modules/eslint-plugin-markdown/node_modules/xtend/mutable.js deleted file mode 100644 index 72debede6ca585..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/xtend/mutable.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = extend - -var hasOwnProperty = Object.prototype.hasOwnProperty; - -function extend(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] - - for (var key in source) { - if (hasOwnProperty.call(source, key)) { - target[key] = source[key] - } - } - } - - return target -} diff --git a/tools/node_modules/eslint-plugin-markdown/node_modules/xtend/package.json b/tools/node_modules/eslint-plugin-markdown/node_modules/xtend/package.json deleted file mode 100644 index f7a39d10af5f5e..00000000000000 --- a/tools/node_modules/eslint-plugin-markdown/node_modules/xtend/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "xtend", - "version": "4.0.2", - "description": "extend like a boss", - "keywords": [ - "extend", - "merge", - "options", - "opts", - "object", - "array" - ], - "author": "Raynos ", - "repository": "git://github.com/Raynos/xtend.git", - "main": "immutable", - "scripts": { - "test": "node test" - }, - "dependencies": {}, - "devDependencies": { - "tape": "~1.1.0" - }, - "homepage": "https://github.com/Raynos/xtend", - "contributors": [ - { - "name": "Jake Verbaten" - }, - { - "name": "Matt Esch" - } - ], - "bugs": { - "url": "https://github.com/Raynos/xtend/issues", - "email": "raynos2@gmail.com" - }, - "license": "MIT", - "testling": { - "files": "test.js", - "browsers": [ - "ie/7..latest", - "firefox/16..latest", - "firefox/nightly", - "chrome/22..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest" - ] - }, - "engines": { - "node": ">=0.4" - } -} diff --git a/tools/node_modules/eslint-plugin-markdown/package.json b/tools/node_modules/eslint-plugin-markdown/package.json index ab5f376e690980..2742d65e81549e 100644 --- a/tools/node_modules/eslint-plugin-markdown/package.json +++ b/tools/node_modules/eslint-plugin-markdown/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-markdown", - "version": "2.1.0", + "version": "2.2.0", "description": "An ESLint plugin to lint JavaScript in Markdown code fences.", "license": "MIT", "author": { @@ -47,8 +47,7 @@ "nyc": "^14.1.1" }, "dependencies": { - "remark-parse": "^7.0.0", - "unified": "^6.1.2" + "mdast-util-from-markdown": "^0.8.5" }, "peerDependencies": { "eslint": ">=6.0.0" diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md index 544da51ebcd1eb..438a087ff23432 100644 --- a/tools/node_modules/eslint/README.md +++ b/tools/node_modules/eslint/README.md @@ -223,11 +223,6 @@ Nicholas C. Zakas Brandon Mills
    - -
    -Toru Nagashima -
    -
    Milos Djermanovic diff --git a/tools/node_modules/eslint/lib/linter/linter.js b/tools/node_modules/eslint/lib/linter/linter.js index bdc6c1b1d01672..e94b507b5dd30a 100644 --- a/tools/node_modules/eslint/lib/linter/linter.js +++ b/tools/node_modules/eslint/lib/linter/linter.js @@ -444,7 +444,7 @@ function normalizeEcmaVersion(ecmaVersion) { return ecmaVersion >= 2015 ? ecmaVersion - 2009 : ecmaVersion; } -const eslintEnvPattern = /\/\*\s*eslint-env\s(.+?)\*\//gu; +const eslintEnvPattern = /\/\*\s*eslint-env\s(.+?)\*\//gsu; /** * Checks whether or not there is a comment which has "eslint-env *" in a given text. @@ -828,9 +828,10 @@ const BASE_TRAVERSAL_CONTEXT = Object.freeze( * @param {string} filename The reported filename of the code * @param {boolean} disableFixes If true, it doesn't make `fix` properties. * @param {string | undefined} cwd cwd of the cli + * @param {string} physicalFilename The full path of the file on disk without any code block information * @returns {Problem[]} An array of reported problems */ -function runRules(sourceCode, configuredRules, ruleMapper, parserOptions, parserName, settings, filename, disableFixes, cwd) { +function runRules(sourceCode, configuredRules, ruleMapper, parserOptions, parserName, settings, filename, disableFixes, cwd, physicalFilename) { const emitter = createEmitter(); const nodeQueue = []; let currentNode = sourceCode.ast; @@ -859,6 +860,7 @@ function runRules(sourceCode, configuredRules, ruleMapper, parserOptions, parser getDeclaredVariables: sourceCode.scopeManager.getDeclaredVariables.bind(sourceCode.scopeManager), getCwd: () => cwd, getFilename: () => filename, + getPhysicalFilename: () => physicalFilename || filename, getScope: () => getScope(sourceCode.scopeManager, currentNode), getSourceCode: () => sourceCode, markVariableAsUsed: name => markVariableAsUsed(sourceCode.scopeManager, currentNode, parserOptions, name), @@ -1181,7 +1183,8 @@ class Linter { settings, options.filename, options.disableFixes, - slots.cwd + slots.cwd, + providedOptions.physicalFilename ); } catch (err) { err.message += `\nOccurred while linting ${options.filename}`; @@ -1284,6 +1287,7 @@ class Linter { _verifyWithProcessor(textOrSourceCode, config, options, configForRecursive) { const filename = options.filename || ""; const filenameToExpose = normalizeFilename(filename); + const physicalFilename = options.physicalFilename || filenameToExpose; const text = ensureText(textOrSourceCode); const preprocess = options.preprocess || (rawText => [rawText]); @@ -1316,7 +1320,7 @@ class Linter { return this._verifyWithConfigArray( blockText, configForRecursive, - { ...options, filename: blockName } + { ...options, filename: blockName, physicalFilename } ); } @@ -1324,7 +1328,7 @@ class Linter { return this._verifyWithoutProcessors( blockText, config, - { ...options, filename: blockName } + { ...options, filename: blockName, physicalFilename } ); }); diff --git a/tools/node_modules/eslint/lib/rules/arrow-body-style.js b/tools/node_modules/eslint/lib/rules/arrow-body-style.js index b2167fde77bc7e..5b8a5f0116717a 100644 --- a/tools/node_modules/eslint/lib/rules/arrow-body-style.js +++ b/tools/node_modules/eslint/lib/rules/arrow-body-style.js @@ -87,17 +87,17 @@ module.exports = { } /** - * Gets the closing parenthesis which is the pair of the given opening parenthesis. - * @param {Token} token The opening parenthesis token to get. + * Gets the closing parenthesis by the given node. + * @param {ASTNode} node first node after an opening parenthesis. * @returns {Token} The found closing parenthesis token. */ - function findClosingParen(token) { - let node = sourceCode.getNodeByRangeIndex(token.range[0]); + function findClosingParen(node) { + let nodeToCheck = node; - while (!astUtils.isParenthesised(sourceCode, node)) { - node = node.parent; + while (!astUtils.isParenthesised(sourceCode, nodeToCheck)) { + nodeToCheck = nodeToCheck.parent; } - return sourceCode.getTokenAfter(node); + return sourceCode.getTokenAfter(nodeToCheck); } /** @@ -226,12 +226,22 @@ module.exports = { const arrowToken = sourceCode.getTokenBefore(arrowBody, astUtils.isArrowToken); const [firstTokenAfterArrow, secondTokenAfterArrow] = sourceCode.getTokensAfter(arrowToken, { count: 2 }); const lastToken = sourceCode.getLastToken(node); - const isParenthesisedObjectLiteral = + + let parenthesisedObjectLiteral = null; + + if ( astUtils.isOpeningParenToken(firstTokenAfterArrow) && - astUtils.isOpeningBraceToken(secondTokenAfterArrow); + astUtils.isOpeningBraceToken(secondTokenAfterArrow) + ) { + const braceNode = sourceCode.getNodeByRangeIndex(secondTokenAfterArrow.range[0]); + + if (braceNode.type === "ObjectExpression") { + parenthesisedObjectLiteral = braceNode; + } + } // If the value is object literal, remove parentheses which were forced by syntax. - if (isParenthesisedObjectLiteral) { + if (parenthesisedObjectLiteral) { const openingParenToken = firstTokenAfterArrow; const openingBraceToken = secondTokenAfterArrow; @@ -247,7 +257,7 @@ module.exports = { } // Closing paren for the object doesn't have to be lastToken, e.g.: () => ({}).foo() - fixes.push(fixer.remove(findClosingParen(openingBraceToken))); + fixes.push(fixer.remove(findClosingParen(parenthesisedObjectLiteral))); fixes.push(fixer.insertTextAfter(lastToken, "}")); } else { diff --git a/tools/node_modules/eslint/lib/rules/no-duplicate-imports.js b/tools/node_modules/eslint/lib/rules/no-duplicate-imports.js index 7218dc64add343..cc3da1d5a68080 100644 --- a/tools/node_modules/eslint/lib/rules/no-duplicate-imports.js +++ b/tools/node_modules/eslint/lib/rules/no-duplicate-imports.js @@ -4,92 +4,225 @@ */ "use strict"; +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const NAMED_TYPES = ["ImportSpecifier", "ExportSpecifier"]; +const NAMESPACE_TYPES = [ + "ImportNamespaceSpecifier", + "ExportNamespaceSpecifier" +]; + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ /** - * Returns the name of the module imported or re-exported. + * Check if an import/export type belongs to (ImportSpecifier|ExportSpecifier) or (ImportNamespaceSpecifier|ExportNamespaceSpecifier). + * @param {string} importExportType An import/export type to check. + * @param {string} type Can be "named" or "namespace" + * @returns {boolean} True if import/export type belongs to (ImportSpecifier|ExportSpecifier) or (ImportNamespaceSpecifier|ExportNamespaceSpecifier) and false if it doesn't. + */ +function isImportExportSpecifier(importExportType, type) { + const arrayToCheck = type === "named" ? NAMED_TYPES : NAMESPACE_TYPES; + + return arrayToCheck.includes(importExportType); +} + +/** + * Return the type of (import|export). * @param {ASTNode} node A node to get. - * @returns {string} the name of the module, or empty string if no name. + * @returns {string} The type of the (import|export). */ -function getValue(node) { - if (node && node.source && node.source.value) { - return node.source.value.trim(); +function getImportExportType(node) { + if (node.specifiers && node.specifiers.length > 0) { + const nodeSpecifiers = node.specifiers; + const index = nodeSpecifiers.findIndex( + ({ type }) => + isImportExportSpecifier(type, "named") || + isImportExportSpecifier(type, "namespace") + ); + const i = index > -1 ? index : 0; + + return nodeSpecifiers[i].type; } + if (node.type === "ExportAllDeclaration") { + if (node.exported) { + return "ExportNamespaceSpecifier"; + } + return "ExportAll"; + } + return "SideEffectImport"; +} - return ""; +/** + * Returns a boolean indicates if two (import|export) can be merged + * @param {ASTNode} node1 A node to check. + * @param {ASTNode} node2 A node to check. + * @returns {boolean} True if two (import|export) can be merged, false if they can't. + */ +function isImportExportCanBeMerged(node1, node2) { + const importExportType1 = getImportExportType(node1); + const importExportType2 = getImportExportType(node2); + + if ( + (importExportType1 === "ExportAll" && + importExportType2 !== "ExportAll" && + importExportType2 !== "SideEffectImport") || + (importExportType1 !== "ExportAll" && + importExportType1 !== "SideEffectImport" && + importExportType2 === "ExportAll") + ) { + return false; + } + if ( + (isImportExportSpecifier(importExportType1, "namespace") && + isImportExportSpecifier(importExportType2, "named")) || + (isImportExportSpecifier(importExportType2, "namespace") && + isImportExportSpecifier(importExportType1, "named")) + ) { + return false; + } + return true; } /** - * Checks if the name of the import or export exists in the given array, and reports if so. - * @param {RuleContext} context The ESLint rule context object. - * @param {ASTNode} node A node to get. - * @param {string} value The name of the imported or exported module. - * @param {string[]} array The array containing other imports or exports in the file. - * @param {string} messageId A messageId to be reported after the name of the module - * - * @returns {void} No return value + * Returns a boolean if we should report (import|export). + * @param {ASTNode} node A node to be reported or not. + * @param {[ASTNode]} previousNodes An array contains previous nodes of the module imported or exported. + * @returns {boolean} True if the (import|export) should be reported. */ -function checkAndReport(context, node, value, array, messageId) { - if (array.indexOf(value) !== -1) { - context.report({ - node, - messageId, - data: { - module: value - } - }); +function shouldReportImportExport(node, previousNodes) { + let i = 0; + + while (i < previousNodes.length) { + if (isImportExportCanBeMerged(node, previousNodes[i])) { + return true; + } + i++; } + return false; } /** - * @callback nodeCallback - * @param {ASTNode} node A node to handle. + * Returns array contains only nodes with declarations types equal to type. + * @param {[{node: ASTNode, declarationType: string}]} nodes An array contains objects, each object contains a node and a declaration type. + * @param {string} type Declaration type. + * @returns {[ASTNode]} An array contains only nodes with declarations types equal to type. + */ +function getNodesByDeclarationType(nodes, type) { + return nodes + .filter(({ declarationType }) => declarationType === type) + .map(({ node }) => node); +} + +/** + * Returns the name of the module imported or re-exported. + * @param {ASTNode} node A node to get. + * @returns {string} The name of the module, or empty string if no name. */ +function getModule(node) { + if (node && node.source && node.source.value) { + return node.source.value.trim(); + } + return ""; +} /** - * Returns a function handling the imports of a given file + * Checks if the (import|export) can be merged with at least one import or one export, and reports if so. * @param {RuleContext} context The ESLint rule context object. + * @param {ASTNode} node A node to get. + * @param {Map} modules A Map object contains as a key a module name and as value an array contains objects, each object contains a node and a declaration type. + * @param {string} declarationType A declaration type can be an import or export. * @param {boolean} includeExports Whether or not to check for exports in addition to imports. - * @param {string[]} importsInFile The array containing other imports in the file. - * @param {string[]} exportsInFile The array containing other exports in the file. - * - * @returns {nodeCallback} A function passed to ESLint to handle the statement. + * @returns {void} No return value. */ -function handleImports(context, includeExports, importsInFile, exportsInFile) { - return function(node) { - const value = getValue(node); +function checkAndReport( + context, + node, + modules, + declarationType, + includeExports +) { + const module = getModule(node); - if (value) { - checkAndReport(context, node, value, importsInFile, "import"); + if (modules.has(module)) { + const previousNodes = modules.get(module); + const messagesIds = []; + const importNodes = getNodesByDeclarationType(previousNodes, "import"); + let exportNodes; + if (includeExports) { + exportNodes = getNodesByDeclarationType(previousNodes, "export"); + } + if (declarationType === "import") { + if (shouldReportImportExport(node, importNodes)) { + messagesIds.push("import"); + } if (includeExports) { - checkAndReport(context, node, value, exportsInFile, "importAs"); + if (shouldReportImportExport(node, exportNodes)) { + messagesIds.push("importAs"); + } + } + } else if (declarationType === "export") { + if (shouldReportImportExport(node, exportNodes)) { + messagesIds.push("export"); + } + if (shouldReportImportExport(node, importNodes)) { + messagesIds.push("exportAs"); } - - importsInFile.push(value); } - }; + messagesIds.forEach(messageId => + context.report({ + node, + messageId, + data: { + module + } + })); + } } /** - * Returns a function handling the exports of a given file + * @callback nodeCallback + * @param {ASTNode} node A node to handle. + */ + +/** + * Returns a function handling the (imports|exports) of a given file * @param {RuleContext} context The ESLint rule context object. - * @param {string[]} importsInFile The array containing other imports in the file. - * @param {string[]} exportsInFile The array containing other exports in the file. - * + * @param {Map} modules A Map object contains as a key a module name and as value an array contains objects, each object contains a node and a declaration type. + * @param {string} declarationType A declaration type can be an import or export. + * @param {boolean} includeExports Whether or not to check for exports in addition to imports. * @returns {nodeCallback} A function passed to ESLint to handle the statement. */ -function handleExports(context, importsInFile, exportsInFile) { +function handleImportsExports( + context, + modules, + declarationType, + includeExports +) { return function(node) { - const value = getValue(node); + const module = getModule(node); + + if (module) { + checkAndReport( + context, + node, + modules, + declarationType, + includeExports + ); + const currentNode = { node, declarationType }; + let nodes = [currentNode]; - if (value) { - checkAndReport(context, node, value, exportsInFile, "export"); - checkAndReport(context, node, value, importsInFile, "exportAs"); + if (modules.has(module)) { + const previousNodes = modules.get(module); - exportsInFile.push(value); + nodes = [...previousNodes, currentNode]; + } + modules.set(module, nodes); } }; } @@ -105,16 +238,19 @@ module.exports = { url: "https://eslint.org/docs/rules/no-duplicate-imports" }, - schema: [{ - type: "object", - properties: { - includeExports: { - type: "boolean", - default: false - } - }, - additionalProperties: false - }], + schema: [ + { + type: "object", + properties: { + includeExports: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + messages: { import: "'{{module}}' import is duplicated.", importAs: "'{{module}}' import is duplicated as export.", @@ -125,18 +261,30 @@ module.exports = { create(context) { const includeExports = (context.options[0] || {}).includeExports, - importsInFile = [], - exportsInFile = []; - + modules = new Map(); const handlers = { - ImportDeclaration: handleImports(context, includeExports, importsInFile, exportsInFile) + ImportDeclaration: handleImportsExports( + context, + modules, + "import", + includeExports + ) }; if (includeExports) { - handlers.ExportNamedDeclaration = handleExports(context, importsInFile, exportsInFile); - handlers.ExportAllDeclaration = handleExports(context, importsInFile, exportsInFile); + handlers.ExportNamedDeclaration = handleImportsExports( + context, + modules, + "export", + includeExports + ); + handlers.ExportAllDeclaration = handleImportsExports( + context, + modules, + "export", + includeExports + ); } - return handlers; } }; diff --git a/tools/node_modules/eslint/lib/rules/no-implicit-coercion.js b/tools/node_modules/eslint/lib/rules/no-implicit-coercion.js index b9bb4548986c9d..993b8d1f1c8d44 100644 --- a/tools/node_modules/eslint/lib/rules/no-implicit-coercion.js +++ b/tools/node_modules/eslint/lib/rules/no-implicit-coercion.js @@ -109,6 +109,20 @@ function getNonNumericOperand(node) { return null; } +/** + * Checks whether an expression evaluates to a string. + * @param {ASTNode} node node that represents the expression to check. + * @returns {boolean} Whether or not the expression evaluates to a string. + */ +function isStringType(node) { + return astUtils.isStringLiteral(node) || + ( + node.type === "CallExpression" && + node.callee.type === "Identifier" && + node.callee.name === "String" + ); +} + /** * Checks whether a node is an empty string literal or not. * @param {ASTNode} node The node to check. @@ -126,8 +140,8 @@ function isEmptyString(node) { */ function isConcatWithEmptyString(node) { return node.operator === "+" && ( - (isEmptyString(node.left) && !astUtils.isStringLiteral(node.right)) || - (isEmptyString(node.right) && !astUtils.isStringLiteral(node.left)) + (isEmptyString(node.left) && !isStringType(node.right)) || + (isEmptyString(node.right) && !isStringType(node.left)) ); } @@ -332,6 +346,11 @@ module.exports = { return; } + // if the expression is already a string, then this isn't a coercion + if (isStringType(node.expressions[0])) { + return; + } + const code = sourceCode.getText(node.expressions[0]); const recommendation = `String(${code})`; diff --git a/tools/node_modules/eslint/lib/rules/no-unused-vars.js b/tools/node_modules/eslint/lib/rules/no-unused-vars.js index adf465905c2f81..f04818f8e9d597 100644 --- a/tools/node_modules/eslint/lib/rules/no-unused-vars.js +++ b/tools/node_modules/eslint/lib/rules/no-unused-vars.js @@ -449,18 +449,24 @@ module.exports = { return ref.isRead() && ( // self update. e.g. `a += 1`, `a++` - (// in RHS of an assignment for itself. e.g. `a = a + 1` - (( + ( + ( parent.type === "AssignmentExpression" && - isUnusedExpression(parent) && - parent.left === id + parent.left === id && + isUnusedExpression(parent) ) || + ( + parent.type === "UpdateExpression" && + isUnusedExpression(parent) + ) + ) || + + // in RHS of an assignment for itself. e.g. `a = a + 1` ( - parent.type === "UpdateExpression" && - isUnusedExpression(parent) - ) || rhsNode && - isInside(id, rhsNode) && - !isInsideOfStorableFunction(id, rhsNode))) + rhsNode && + isInside(id, rhsNode) && + !isInsideOfStorableFunction(id, rhsNode) + ) ); } diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/globals/globals.json b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/globals/globals.json deleted file mode 100644 index b85dc3f80d5148..00000000000000 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/globals/globals.json +++ /dev/null @@ -1,1586 +0,0 @@ -{ - "builtin": { - "Array": false, - "ArrayBuffer": false, - "Atomics": false, - "BigInt": false, - "BigInt64Array": false, - "BigUint64Array": false, - "Boolean": false, - "constructor": false, - "DataView": false, - "Date": false, - "decodeURI": false, - "decodeURIComponent": false, - "encodeURI": false, - "encodeURIComponent": false, - "Error": false, - "escape": false, - "eval": false, - "EvalError": false, - "Float32Array": false, - "Float64Array": false, - "Function": false, - "globalThis": false, - "hasOwnProperty": false, - "Infinity": false, - "Int16Array": false, - "Int32Array": false, - "Int8Array": false, - "isFinite": false, - "isNaN": false, - "isPrototypeOf": false, - "JSON": false, - "Map": false, - "Math": false, - "NaN": false, - "Number": false, - "Object": false, - "parseFloat": false, - "parseInt": false, - "Promise": false, - "propertyIsEnumerable": false, - "Proxy": false, - "RangeError": false, - "ReferenceError": false, - "Reflect": false, - "RegExp": false, - "Set": false, - "SharedArrayBuffer": false, - "String": false, - "Symbol": false, - "SyntaxError": false, - "toLocaleString": false, - "toString": false, - "TypeError": false, - "Uint16Array": false, - "Uint32Array": false, - "Uint8Array": false, - "Uint8ClampedArray": false, - "undefined": false, - "unescape": false, - "URIError": false, - "valueOf": false, - "WeakMap": false, - "WeakSet": false - }, - "es5": { - "Array": false, - "Boolean": false, - "constructor": false, - "Date": false, - "decodeURI": false, - "decodeURIComponent": false, - "encodeURI": false, - "encodeURIComponent": false, - "Error": false, - "escape": false, - "eval": false, - "EvalError": false, - "Function": false, - "hasOwnProperty": false, - "Infinity": false, - "isFinite": false, - "isNaN": false, - "isPrototypeOf": false, - "JSON": false, - "Math": false, - "NaN": false, - "Number": false, - "Object": false, - "parseFloat": false, - "parseInt": false, - "propertyIsEnumerable": false, - "RangeError": false, - "ReferenceError": false, - "RegExp": false, - "String": false, - "SyntaxError": false, - "toLocaleString": false, - "toString": false, - "TypeError": false, - "undefined": false, - "unescape": false, - "URIError": false, - "valueOf": false - }, - "es2015": { - "Array": false, - "ArrayBuffer": false, - "Boolean": false, - "constructor": false, - "DataView": false, - "Date": false, - "decodeURI": false, - "decodeURIComponent": false, - "encodeURI": false, - "encodeURIComponent": false, - "Error": false, - "escape": false, - "eval": false, - "EvalError": false, - "Float32Array": false, - "Float64Array": false, - "Function": false, - "hasOwnProperty": false, - "Infinity": false, - "Int16Array": false, - "Int32Array": false, - "Int8Array": false, - "isFinite": false, - "isNaN": false, - "isPrototypeOf": false, - "JSON": false, - "Map": false, - "Math": false, - "NaN": false, - "Number": false, - "Object": false, - "parseFloat": false, - "parseInt": false, - "Promise": false, - "propertyIsEnumerable": false, - "Proxy": false, - "RangeError": false, - "ReferenceError": false, - "Reflect": false, - "RegExp": false, - "Set": false, - "String": false, - "Symbol": false, - "SyntaxError": false, - "toLocaleString": false, - "toString": false, - "TypeError": false, - "Uint16Array": false, - "Uint32Array": false, - "Uint8Array": false, - "Uint8ClampedArray": false, - "undefined": false, - "unescape": false, - "URIError": false, - "valueOf": false, - "WeakMap": false, - "WeakSet": false - }, - "es2017": { - "Array": false, - "ArrayBuffer": false, - "Atomics": false, - "Boolean": false, - "constructor": false, - "DataView": false, - "Date": false, - "decodeURI": false, - "decodeURIComponent": false, - "encodeURI": false, - "encodeURIComponent": false, - "Error": false, - "escape": false, - "eval": false, - "EvalError": false, - "Float32Array": false, - "Float64Array": false, - "Function": false, - "hasOwnProperty": false, - "Infinity": false, - "Int16Array": false, - "Int32Array": false, - "Int8Array": false, - "isFinite": false, - "isNaN": false, - "isPrototypeOf": false, - "JSON": false, - "Map": false, - "Math": false, - "NaN": false, - "Number": false, - "Object": false, - "parseFloat": false, - "parseInt": false, - "Promise": false, - "propertyIsEnumerable": false, - "Proxy": false, - "RangeError": false, - "ReferenceError": false, - "Reflect": false, - "RegExp": false, - "Set": false, - "SharedArrayBuffer": false, - "String": false, - "Symbol": false, - "SyntaxError": false, - "toLocaleString": false, - "toString": false, - "TypeError": false, - "Uint16Array": false, - "Uint32Array": false, - "Uint8Array": false, - "Uint8ClampedArray": false, - "undefined": false, - "unescape": false, - "URIError": false, - "valueOf": false, - "WeakMap": false, - "WeakSet": false - }, - "browser": { - "AbortController": false, - "AbortSignal": false, - "addEventListener": false, - "alert": false, - "AnalyserNode": false, - "Animation": false, - "AnimationEffectReadOnly": false, - "AnimationEffectTiming": false, - "AnimationEffectTimingReadOnly": false, - "AnimationEvent": false, - "AnimationPlaybackEvent": false, - "AnimationTimeline": false, - "applicationCache": false, - "ApplicationCache": false, - "ApplicationCacheErrorEvent": false, - "atob": false, - "Attr": false, - "Audio": false, - "AudioBuffer": false, - "AudioBufferSourceNode": false, - "AudioContext": false, - "AudioDestinationNode": false, - "AudioListener": false, - "AudioNode": false, - "AudioParam": false, - "AudioProcessingEvent": false, - "AudioScheduledSourceNode": false, - "AudioWorkletGlobalScope ": false, - "AudioWorkletNode": false, - "AudioWorkletProcessor": false, - "BarProp": false, - "BaseAudioContext": false, - "BatteryManager": false, - "BeforeUnloadEvent": false, - "BiquadFilterNode": false, - "Blob": false, - "BlobEvent": false, - "blur": false, - "BroadcastChannel": false, - "btoa": false, - "BudgetService": false, - "ByteLengthQueuingStrategy": false, - "Cache": false, - "caches": false, - "CacheStorage": false, - "cancelAnimationFrame": false, - "cancelIdleCallback": false, - "CanvasCaptureMediaStreamTrack": false, - "CanvasGradient": false, - "CanvasPattern": false, - "CanvasRenderingContext2D": false, - "ChannelMergerNode": false, - "ChannelSplitterNode": false, - "CharacterData": false, - "clearInterval": false, - "clearTimeout": false, - "clientInformation": false, - "ClipboardEvent": false, - "close": false, - "closed": false, - "CloseEvent": false, - "Comment": false, - "CompositionEvent": false, - "confirm": false, - "console": false, - "ConstantSourceNode": false, - "ConvolverNode": false, - "CountQueuingStrategy": false, - "createImageBitmap": false, - "Credential": false, - "CredentialsContainer": false, - "crypto": false, - "Crypto": false, - "CryptoKey": false, - "CSS": false, - "CSSConditionRule": false, - "CSSFontFaceRule": false, - "CSSGroupingRule": false, - "CSSImportRule": false, - "CSSKeyframeRule": false, - "CSSKeyframesRule": false, - "CSSMediaRule": false, - "CSSNamespaceRule": false, - "CSSPageRule": false, - "CSSRule": false, - "CSSRuleList": false, - "CSSStyleDeclaration": false, - "CSSStyleRule": false, - "CSSStyleSheet": false, - "CSSSupportsRule": false, - "CustomElementRegistry": false, - "customElements": false, - "CustomEvent": false, - "DataTransfer": false, - "DataTransferItem": false, - "DataTransferItemList": false, - "defaultstatus": false, - "defaultStatus": false, - "DelayNode": false, - "DeviceMotionEvent": false, - "DeviceOrientationEvent": false, - "devicePixelRatio": false, - "dispatchEvent": false, - "document": false, - "Document": false, - "DocumentFragment": false, - "DocumentType": false, - "DOMError": false, - "DOMException": false, - "DOMImplementation": false, - "DOMMatrix": false, - "DOMMatrixReadOnly": false, - "DOMParser": false, - "DOMPoint": false, - "DOMPointReadOnly": false, - "DOMQuad": false, - "DOMRect": false, - "DOMRectReadOnly": false, - "DOMStringList": false, - "DOMStringMap": false, - "DOMTokenList": false, - "DragEvent": false, - "DynamicsCompressorNode": false, - "Element": false, - "ErrorEvent": false, - "event": false, - "Event": false, - "EventSource": false, - "EventTarget": false, - "external": false, - "fetch": false, - "File": false, - "FileList": false, - "FileReader": false, - "find": false, - "focus": false, - "FocusEvent": false, - "FontFace": false, - "FontFaceSetLoadEvent": false, - "FormData": false, - "frameElement": false, - "frames": false, - "GainNode": false, - "Gamepad": false, - "GamepadButton": false, - "GamepadEvent": false, - "getComputedStyle": false, - "getSelection": false, - "HashChangeEvent": false, - "Headers": false, - "history": false, - "History": false, - "HTMLAllCollection": false, - "HTMLAnchorElement": false, - "HTMLAreaElement": false, - "HTMLAudioElement": false, - "HTMLBaseElement": false, - "HTMLBodyElement": false, - "HTMLBRElement": false, - "HTMLButtonElement": false, - "HTMLCanvasElement": false, - "HTMLCollection": false, - "HTMLContentElement": false, - "HTMLDataElement": false, - "HTMLDataListElement": false, - "HTMLDetailsElement": false, - "HTMLDialogElement": false, - "HTMLDirectoryElement": false, - "HTMLDivElement": false, - "HTMLDListElement": false, - "HTMLDocument": false, - "HTMLElement": false, - "HTMLEmbedElement": false, - "HTMLFieldSetElement": false, - "HTMLFontElement": false, - "HTMLFormControlsCollection": false, - "HTMLFormElement": false, - "HTMLFrameElement": false, - "HTMLFrameSetElement": false, - "HTMLHeadElement": false, - "HTMLHeadingElement": false, - "HTMLHRElement": false, - "HTMLHtmlElement": false, - "HTMLIFrameElement": false, - "HTMLImageElement": false, - "HTMLInputElement": false, - "HTMLLabelElement": false, - "HTMLLegendElement": false, - "HTMLLIElement": false, - "HTMLLinkElement": false, - "HTMLMapElement": false, - "HTMLMarqueeElement": false, - "HTMLMediaElement": false, - "HTMLMenuElement": false, - "HTMLMetaElement": false, - "HTMLMeterElement": false, - "HTMLModElement": false, - "HTMLObjectElement": false, - "HTMLOListElement": false, - "HTMLOptGroupElement": false, - "HTMLOptionElement": false, - "HTMLOptionsCollection": false, - "HTMLOutputElement": false, - "HTMLParagraphElement": false, - "HTMLParamElement": false, - "HTMLPictureElement": false, - "HTMLPreElement": false, - "HTMLProgressElement": false, - "HTMLQuoteElement": false, - "HTMLScriptElement": false, - "HTMLSelectElement": false, - "HTMLShadowElement": false, - "HTMLSlotElement": false, - "HTMLSourceElement": false, - "HTMLSpanElement": false, - "HTMLStyleElement": false, - "HTMLTableCaptionElement": false, - "HTMLTableCellElement": false, - "HTMLTableColElement": false, - "HTMLTableElement": false, - "HTMLTableRowElement": false, - "HTMLTableSectionElement": false, - "HTMLTemplateElement": false, - "HTMLTextAreaElement": false, - "HTMLTimeElement": false, - "HTMLTitleElement": false, - "HTMLTrackElement": false, - "HTMLUListElement": false, - "HTMLUnknownElement": false, - "HTMLVideoElement": false, - "IDBCursor": false, - "IDBCursorWithValue": false, - "IDBDatabase": false, - "IDBFactory": false, - "IDBIndex": false, - "IDBKeyRange": false, - "IDBObjectStore": false, - "IDBOpenDBRequest": false, - "IDBRequest": false, - "IDBTransaction": false, - "IDBVersionChangeEvent": false, - "IdleDeadline": false, - "IIRFilterNode": false, - "Image": false, - "ImageBitmap": false, - "ImageBitmapRenderingContext": false, - "ImageCapture": false, - "ImageData": false, - "indexedDB": false, - "innerHeight": false, - "innerWidth": false, - "InputEvent": false, - "IntersectionObserver": false, - "IntersectionObserverEntry": false, - "Intl": false, - "isSecureContext": false, - "KeyboardEvent": false, - "KeyframeEffect": false, - "KeyframeEffectReadOnly": false, - "length": false, - "localStorage": false, - "location": true, - "Location": false, - "locationbar": false, - "matchMedia": false, - "MediaDeviceInfo": false, - "MediaDevices": false, - "MediaElementAudioSourceNode": false, - "MediaEncryptedEvent": false, - "MediaError": false, - "MediaKeyMessageEvent": false, - "MediaKeySession": false, - "MediaKeyStatusMap": false, - "MediaKeySystemAccess": false, - "MediaList": false, - "MediaQueryList": false, - "MediaQueryListEvent": false, - "MediaRecorder": false, - "MediaSettingsRange": false, - "MediaSource": false, - "MediaStream": false, - "MediaStreamAudioDestinationNode": false, - "MediaStreamAudioSourceNode": false, - "MediaStreamEvent": false, - "MediaStreamTrack": false, - "MediaStreamTrackEvent": false, - "menubar": false, - "MessageChannel": false, - "MessageEvent": false, - "MessagePort": false, - "MIDIAccess": false, - "MIDIConnectionEvent": false, - "MIDIInput": false, - "MIDIInputMap": false, - "MIDIMessageEvent": false, - "MIDIOutput": false, - "MIDIOutputMap": false, - "MIDIPort": false, - "MimeType": false, - "MimeTypeArray": false, - "MouseEvent": false, - "moveBy": false, - "moveTo": false, - "MutationEvent": false, - "MutationObserver": false, - "MutationRecord": false, - "name": false, - "NamedNodeMap": false, - "NavigationPreloadManager": false, - "navigator": false, - "Navigator": false, - "NetworkInformation": false, - "Node": false, - "NodeFilter": false, - "NodeIterator": false, - "NodeList": false, - "Notification": false, - "OfflineAudioCompletionEvent": false, - "OfflineAudioContext": false, - "offscreenBuffering": false, - "OffscreenCanvas": true, - "onabort": true, - "onafterprint": true, - "onanimationend": true, - "onanimationiteration": true, - "onanimationstart": true, - "onappinstalled": true, - "onauxclick": true, - "onbeforeinstallprompt": true, - "onbeforeprint": true, - "onbeforeunload": true, - "onblur": true, - "oncancel": true, - "oncanplay": true, - "oncanplaythrough": true, - "onchange": true, - "onclick": true, - "onclose": true, - "oncontextmenu": true, - "oncuechange": true, - "ondblclick": true, - "ondevicemotion": true, - "ondeviceorientation": true, - "ondeviceorientationabsolute": true, - "ondrag": true, - "ondragend": true, - "ondragenter": true, - "ondragleave": true, - "ondragover": true, - "ondragstart": true, - "ondrop": true, - "ondurationchange": true, - "onemptied": true, - "onended": true, - "onerror": true, - "onfocus": true, - "ongotpointercapture": true, - "onhashchange": true, - "oninput": true, - "oninvalid": true, - "onkeydown": true, - "onkeypress": true, - "onkeyup": true, - "onlanguagechange": true, - "onload": true, - "onloadeddata": true, - "onloadedmetadata": true, - "onloadstart": true, - "onlostpointercapture": true, - "onmessage": true, - "onmessageerror": true, - "onmousedown": true, - "onmouseenter": true, - "onmouseleave": true, - "onmousemove": true, - "onmouseout": true, - "onmouseover": true, - "onmouseup": true, - "onmousewheel": true, - "onoffline": true, - "ononline": true, - "onpagehide": true, - "onpageshow": true, - "onpause": true, - "onplay": true, - "onplaying": true, - "onpointercancel": true, - "onpointerdown": true, - "onpointerenter": true, - "onpointerleave": true, - "onpointermove": true, - "onpointerout": true, - "onpointerover": true, - "onpointerup": true, - "onpopstate": true, - "onprogress": true, - "onratechange": true, - "onrejectionhandled": true, - "onreset": true, - "onresize": true, - "onscroll": true, - "onsearch": true, - "onseeked": true, - "onseeking": true, - "onselect": true, - "onstalled": true, - "onstorage": true, - "onsubmit": true, - "onsuspend": true, - "ontimeupdate": true, - "ontoggle": true, - "ontransitionend": true, - "onunhandledrejection": true, - "onunload": true, - "onvolumechange": true, - "onwaiting": true, - "onwheel": true, - "open": false, - "openDatabase": false, - "opener": false, - "Option": false, - "origin": false, - "OscillatorNode": false, - "outerHeight": false, - "outerWidth": false, - "PageTransitionEvent": false, - "pageXOffset": false, - "pageYOffset": false, - "PannerNode": false, - "parent": false, - "Path2D": false, - "PaymentAddress": false, - "PaymentRequest": false, - "PaymentRequestUpdateEvent": false, - "PaymentResponse": false, - "performance": false, - "Performance": false, - "PerformanceEntry": false, - "PerformanceLongTaskTiming": false, - "PerformanceMark": false, - "PerformanceMeasure": false, - "PerformanceNavigation": false, - "PerformanceNavigationTiming": false, - "PerformanceObserver": false, - "PerformanceObserverEntryList": false, - "PerformancePaintTiming": false, - "PerformanceResourceTiming": false, - "PerformanceTiming": false, - "PeriodicWave": false, - "Permissions": false, - "PermissionStatus": false, - "personalbar": false, - "PhotoCapabilities": false, - "Plugin": false, - "PluginArray": false, - "PointerEvent": false, - "PopStateEvent": false, - "postMessage": false, - "Presentation": false, - "PresentationAvailability": false, - "PresentationConnection": false, - "PresentationConnectionAvailableEvent": false, - "PresentationConnectionCloseEvent": false, - "PresentationConnectionList": false, - "PresentationReceiver": false, - "PresentationRequest": false, - "print": false, - "ProcessingInstruction": false, - "ProgressEvent": false, - "PromiseRejectionEvent": false, - "prompt": false, - "PushManager": false, - "PushSubscription": false, - "PushSubscriptionOptions": false, - "queueMicrotask": false, - "RadioNodeList": false, - "Range": false, - "ReadableStream": false, - "registerProcessor": false, - "RemotePlayback": false, - "removeEventListener": false, - "Request": false, - "requestAnimationFrame": false, - "requestIdleCallback": false, - "resizeBy": false, - "ResizeObserver": false, - "ResizeObserverEntry": false, - "resizeTo": false, - "Response": false, - "RTCCertificate": false, - "RTCDataChannel": false, - "RTCDataChannelEvent": false, - "RTCDtlsTransport": false, - "RTCIceCandidate": false, - "RTCIceGatherer": false, - "RTCIceTransport": false, - "RTCPeerConnection": false, - "RTCPeerConnectionIceEvent": false, - "RTCRtpContributingSource": false, - "RTCRtpReceiver": false, - "RTCRtpSender": false, - "RTCSctpTransport": false, - "RTCSessionDescription": false, - "RTCStatsReport": false, - "RTCTrackEvent": false, - "screen": false, - "Screen": false, - "screenLeft": false, - "ScreenOrientation": false, - "screenTop": false, - "screenX": false, - "screenY": false, - "ScriptProcessorNode": false, - "scroll": false, - "scrollbars": false, - "scrollBy": false, - "scrollTo": false, - "scrollX": false, - "scrollY": false, - "SecurityPolicyViolationEvent": false, - "Selection": false, - "self": false, - "ServiceWorker": false, - "ServiceWorkerContainer": false, - "ServiceWorkerRegistration": false, - "sessionStorage": false, - "setInterval": false, - "setTimeout": false, - "ShadowRoot": false, - "SharedWorker": false, - "SourceBuffer": false, - "SourceBufferList": false, - "speechSynthesis": false, - "SpeechSynthesisEvent": false, - "SpeechSynthesisUtterance": false, - "StaticRange": false, - "status": false, - "statusbar": false, - "StereoPannerNode": false, - "stop": false, - "Storage": false, - "StorageEvent": false, - "StorageManager": false, - "styleMedia": false, - "StyleSheet": false, - "StyleSheetList": false, - "SubtleCrypto": false, - "SVGAElement": false, - "SVGAngle": false, - "SVGAnimatedAngle": false, - "SVGAnimatedBoolean": false, - "SVGAnimatedEnumeration": false, - "SVGAnimatedInteger": false, - "SVGAnimatedLength": false, - "SVGAnimatedLengthList": false, - "SVGAnimatedNumber": false, - "SVGAnimatedNumberList": false, - "SVGAnimatedPreserveAspectRatio": false, - "SVGAnimatedRect": false, - "SVGAnimatedString": false, - "SVGAnimatedTransformList": false, - "SVGAnimateElement": false, - "SVGAnimateMotionElement": false, - "SVGAnimateTransformElement": false, - "SVGAnimationElement": false, - "SVGCircleElement": false, - "SVGClipPathElement": false, - "SVGComponentTransferFunctionElement": false, - "SVGDefsElement": false, - "SVGDescElement": false, - "SVGDiscardElement": false, - "SVGElement": false, - "SVGEllipseElement": false, - "SVGFEBlendElement": false, - "SVGFEColorMatrixElement": false, - "SVGFEComponentTransferElement": false, - "SVGFECompositeElement": false, - "SVGFEConvolveMatrixElement": false, - "SVGFEDiffuseLightingElement": false, - "SVGFEDisplacementMapElement": false, - "SVGFEDistantLightElement": false, - "SVGFEDropShadowElement": false, - "SVGFEFloodElement": false, - "SVGFEFuncAElement": false, - "SVGFEFuncBElement": false, - "SVGFEFuncGElement": false, - "SVGFEFuncRElement": false, - "SVGFEGaussianBlurElement": false, - "SVGFEImageElement": false, - "SVGFEMergeElement": false, - "SVGFEMergeNodeElement": false, - "SVGFEMorphologyElement": false, - "SVGFEOffsetElement": false, - "SVGFEPointLightElement": false, - "SVGFESpecularLightingElement": false, - "SVGFESpotLightElement": false, - "SVGFETileElement": false, - "SVGFETurbulenceElement": false, - "SVGFilterElement": false, - "SVGForeignObjectElement": false, - "SVGGElement": false, - "SVGGeometryElement": false, - "SVGGradientElement": false, - "SVGGraphicsElement": false, - "SVGImageElement": false, - "SVGLength": false, - "SVGLengthList": false, - "SVGLinearGradientElement": false, - "SVGLineElement": false, - "SVGMarkerElement": false, - "SVGMaskElement": false, - "SVGMatrix": false, - "SVGMetadataElement": false, - "SVGMPathElement": false, - "SVGNumber": false, - "SVGNumberList": false, - "SVGPathElement": false, - "SVGPatternElement": false, - "SVGPoint": false, - "SVGPointList": false, - "SVGPolygonElement": false, - "SVGPolylineElement": false, - "SVGPreserveAspectRatio": false, - "SVGRadialGradientElement": false, - "SVGRect": false, - "SVGRectElement": false, - "SVGScriptElement": false, - "SVGSetElement": false, - "SVGStopElement": false, - "SVGStringList": false, - "SVGStyleElement": false, - "SVGSVGElement": false, - "SVGSwitchElement": false, - "SVGSymbolElement": false, - "SVGTextContentElement": false, - "SVGTextElement": false, - "SVGTextPathElement": false, - "SVGTextPositioningElement": false, - "SVGTitleElement": false, - "SVGTransform": false, - "SVGTransformList": false, - "SVGTSpanElement": false, - "SVGUnitTypes": false, - "SVGUseElement": false, - "SVGViewElement": false, - "TaskAttributionTiming": false, - "Text": false, - "TextDecoder": false, - "TextEncoder": false, - "TextEvent": false, - "TextMetrics": false, - "TextTrack": false, - "TextTrackCue": false, - "TextTrackCueList": false, - "TextTrackList": false, - "TimeRanges": false, - "toolbar": false, - "top": false, - "Touch": false, - "TouchEvent": false, - "TouchList": false, - "TrackEvent": false, - "TransitionEvent": false, - "TreeWalker": false, - "UIEvent": false, - "URL": false, - "URLSearchParams": false, - "ValidityState": false, - "visualViewport": false, - "VisualViewport": false, - "VTTCue": false, - "WaveShaperNode": false, - "WebAssembly": false, - "WebGL2RenderingContext": false, - "WebGLActiveInfo": false, - "WebGLBuffer": false, - "WebGLContextEvent": false, - "WebGLFramebuffer": false, - "WebGLProgram": false, - "WebGLQuery": false, - "WebGLRenderbuffer": false, - "WebGLRenderingContext": false, - "WebGLSampler": false, - "WebGLShader": false, - "WebGLShaderPrecisionFormat": false, - "WebGLSync": false, - "WebGLTexture": false, - "WebGLTransformFeedback": false, - "WebGLUniformLocation": false, - "WebGLVertexArrayObject": false, - "WebSocket": false, - "WheelEvent": false, - "window": false, - "Window": false, - "Worker": false, - "WritableStream": false, - "XMLDocument": false, - "XMLHttpRequest": false, - "XMLHttpRequestEventTarget": false, - "XMLHttpRequestUpload": false, - "XMLSerializer": false, - "XPathEvaluator": false, - "XPathExpression": false, - "XPathResult": false, - "XSLTProcessor": false - }, - "worker": { - "addEventListener": false, - "applicationCache": false, - "atob": false, - "Blob": false, - "BroadcastChannel": false, - "btoa": false, - "Cache": false, - "caches": false, - "clearInterval": false, - "clearTimeout": false, - "close": true, - "console": false, - "fetch": false, - "FileReaderSync": false, - "FormData": false, - "Headers": false, - "IDBCursor": false, - "IDBCursorWithValue": false, - "IDBDatabase": false, - "IDBFactory": false, - "IDBIndex": false, - "IDBKeyRange": false, - "IDBObjectStore": false, - "IDBOpenDBRequest": false, - "IDBRequest": false, - "IDBTransaction": false, - "IDBVersionChangeEvent": false, - "ImageData": false, - "importScripts": true, - "indexedDB": false, - "location": false, - "MessageChannel": false, - "MessagePort": false, - "name": false, - "navigator": false, - "Notification": false, - "onclose": true, - "onconnect": true, - "onerror": true, - "onlanguagechange": true, - "onmessage": true, - "onoffline": true, - "ononline": true, - "onrejectionhandled": true, - "onunhandledrejection": true, - "performance": false, - "Performance": false, - "PerformanceEntry": false, - "PerformanceMark": false, - "PerformanceMeasure": false, - "PerformanceNavigation": false, - "PerformanceResourceTiming": false, - "PerformanceTiming": false, - "postMessage": true, - "Promise": false, - "queueMicrotask": false, - "removeEventListener": false, - "Request": false, - "Response": false, - "self": true, - "ServiceWorkerRegistration": false, - "setInterval": false, - "setTimeout": false, - "TextDecoder": false, - "TextEncoder": false, - "URL": false, - "URLSearchParams": false, - "WebSocket": false, - "Worker": false, - "WorkerGlobalScope": false, - "XMLHttpRequest": false - }, - "node": { - "__dirname": false, - "__filename": false, - "Buffer": false, - "clearImmediate": false, - "clearInterval": false, - "clearTimeout": false, - "console": false, - "exports": true, - "global": false, - "Intl": false, - "module": false, - "process": false, - "queueMicrotask": false, - "require": false, - "setImmediate": false, - "setInterval": false, - "setTimeout": false, - "TextDecoder": false, - "TextEncoder": false, - "URL": false, - "URLSearchParams": false - }, - "nodeBuiltin": { - "Buffer": false, - "clearImmediate": false, - "clearInterval": false, - "clearTimeout": false, - "console": false, - "global": false, - "Intl": false, - "process": false, - "queueMicrotask": false, - "setImmediate": false, - "setInterval": false, - "setTimeout": false, - "TextDecoder": false, - "TextEncoder": false, - "URL": false, - "URLSearchParams": false - }, - "commonjs": { - "exports": true, - "global": false, - "module": false, - "require": false - }, - "amd": { - "define": false, - "require": false - }, - "mocha": { - "after": false, - "afterEach": false, - "before": false, - "beforeEach": false, - "context": false, - "describe": false, - "it": false, - "mocha": false, - "run": false, - "setup": false, - "specify": false, - "suite": false, - "suiteSetup": false, - "suiteTeardown": false, - "teardown": false, - "test": false, - "xcontext": false, - "xdescribe": false, - "xit": false, - "xspecify": false - }, - "jasmine": { - "afterAll": false, - "afterEach": false, - "beforeAll": false, - "beforeEach": false, - "describe": false, - "expect": false, - "expectAsync": false, - "fail": false, - "fdescribe": false, - "fit": false, - "it": false, - "jasmine": false, - "pending": false, - "runs": false, - "spyOn": false, - "spyOnAllFunctions": false, - "spyOnProperty": false, - "waits": false, - "waitsFor": false, - "xdescribe": false, - "xit": false - }, - "jest": { - "afterAll": false, - "afterEach": false, - "beforeAll": false, - "beforeEach": false, - "describe": false, - "expect": false, - "fdescribe": false, - "fit": false, - "it": false, - "jest": false, - "pit": false, - "require": false, - "test": false, - "xdescribe": false, - "xit": false, - "xtest": false - }, - "qunit": { - "asyncTest": false, - "deepEqual": false, - "equal": false, - "expect": false, - "module": false, - "notDeepEqual": false, - "notEqual": false, - "notOk": false, - "notPropEqual": false, - "notStrictEqual": false, - "ok": false, - "propEqual": false, - "QUnit": false, - "raises": false, - "start": false, - "stop": false, - "strictEqual": false, - "test": false, - "throws": false - }, - "phantomjs": { - "console": true, - "exports": true, - "phantom": true, - "require": true, - "WebPage": true - }, - "couch": { - "emit": false, - "exports": false, - "getRow": false, - "log": false, - "module": false, - "provides": false, - "require": false, - "respond": false, - "send": false, - "start": false, - "sum": false - }, - "rhino": { - "defineClass": false, - "deserialize": false, - "gc": false, - "help": false, - "importClass": false, - "importPackage": false, - "java": false, - "load": false, - "loadClass": false, - "Packages": false, - "print": false, - "quit": false, - "readFile": false, - "readUrl": false, - "runCommand": false, - "seal": false, - "serialize": false, - "spawn": false, - "sync": false, - "toint32": false, - "version": false - }, - "nashorn": { - "__DIR__": false, - "__FILE__": false, - "__LINE__": false, - "com": false, - "edu": false, - "exit": false, - "java": false, - "Java": false, - "javafx": false, - "JavaImporter": false, - "javax": false, - "JSAdapter": false, - "load": false, - "loadWithNewGlobal": false, - "org": false, - "Packages": false, - "print": false, - "quit": false - }, - "wsh": { - "ActiveXObject": true, - "CollectGarbage": true, - "Debug": true, - "Enumerator": true, - "GetObject": true, - "RuntimeObject": true, - "ScriptEngine": true, - "ScriptEngineBuildVersion": true, - "ScriptEngineMajorVersion": true, - "ScriptEngineMinorVersion": true, - "VBArray": true, - "WScript": true, - "WSH": true, - "XDomainRequest": true - }, - "jquery": { - "$": false, - "jQuery": false - }, - "yui": { - "YAHOO": false, - "YAHOO_config": false, - "YUI": false, - "YUI_config": false - }, - "shelljs": { - "cat": false, - "cd": false, - "chmod": false, - "config": false, - "cp": false, - "dirs": false, - "echo": false, - "env": false, - "error": false, - "exec": false, - "exit": false, - "find": false, - "grep": false, - "ln": false, - "ls": false, - "mkdir": false, - "mv": false, - "popd": false, - "pushd": false, - "pwd": false, - "rm": false, - "sed": false, - "set": false, - "target": false, - "tempdir": false, - "test": false, - "touch": false, - "which": false - }, - "prototypejs": { - "$": false, - "$$": false, - "$A": false, - "$break": false, - "$continue": false, - "$F": false, - "$H": false, - "$R": false, - "$w": false, - "Abstract": false, - "Ajax": false, - "Autocompleter": false, - "Builder": false, - "Class": false, - "Control": false, - "Draggable": false, - "Draggables": false, - "Droppables": false, - "Effect": false, - "Element": false, - "Enumerable": false, - "Event": false, - "Field": false, - "Form": false, - "Hash": false, - "Insertion": false, - "ObjectRange": false, - "PeriodicalExecuter": false, - "Position": false, - "Prototype": false, - "Scriptaculous": false, - "Selector": false, - "Sortable": false, - "SortableObserver": false, - "Sound": false, - "Template": false, - "Toggle": false, - "Try": false - }, - "meteor": { - "_": false, - "$": false, - "Accounts": false, - "AccountsClient": false, - "AccountsCommon": false, - "AccountsServer": false, - "App": false, - "Assets": false, - "Blaze": false, - "check": false, - "Cordova": false, - "DDP": false, - "DDPRateLimiter": false, - "DDPServer": false, - "Deps": false, - "EJSON": false, - "Email": false, - "HTTP": false, - "Log": false, - "Match": false, - "Meteor": false, - "Mongo": false, - "MongoInternals": false, - "Npm": false, - "Package": false, - "Plugin": false, - "process": false, - "Random": false, - "ReactiveDict": false, - "ReactiveVar": false, - "Router": false, - "ServiceConfiguration": false, - "Session": false, - "share": false, - "Spacebars": false, - "Template": false, - "Tinytest": false, - "Tracker": false, - "UI": false, - "Utils": false, - "WebApp": false, - "WebAppInternals": false - }, - "mongo": { - "_isWindows": false, - "_rand": false, - "BulkWriteResult": false, - "cat": false, - "cd": false, - "connect": false, - "db": false, - "getHostName": false, - "getMemInfo": false, - "hostname": false, - "ISODate": false, - "listFiles": false, - "load": false, - "ls": false, - "md5sumFile": false, - "mkdir": false, - "Mongo": false, - "NumberInt": false, - "NumberLong": false, - "ObjectId": false, - "PlanCache": false, - "print": false, - "printjson": false, - "pwd": false, - "quit": false, - "removeFile": false, - "rs": false, - "sh": false, - "UUID": false, - "version": false, - "WriteResult": false - }, - "applescript": { - "$": false, - "Application": false, - "Automation": false, - "console": false, - "delay": false, - "Library": false, - "ObjC": false, - "ObjectSpecifier": false, - "Path": false, - "Progress": false, - "Ref": false - }, - "serviceworker": { - "addEventListener": false, - "applicationCache": false, - "atob": false, - "Blob": false, - "BroadcastChannel": false, - "btoa": false, - "Cache": false, - "caches": false, - "CacheStorage": false, - "clearInterval": false, - "clearTimeout": false, - "Client": false, - "clients": false, - "Clients": false, - "close": true, - "console": false, - "ExtendableEvent": false, - "ExtendableMessageEvent": false, - "fetch": false, - "FetchEvent": false, - "FileReaderSync": false, - "FormData": false, - "Headers": false, - "IDBCursor": false, - "IDBCursorWithValue": false, - "IDBDatabase": false, - "IDBFactory": false, - "IDBIndex": false, - "IDBKeyRange": false, - "IDBObjectStore": false, - "IDBOpenDBRequest": false, - "IDBRequest": false, - "IDBTransaction": false, - "IDBVersionChangeEvent": false, - "ImageData": false, - "importScripts": false, - "indexedDB": false, - "location": false, - "MessageChannel": false, - "MessagePort": false, - "name": false, - "navigator": false, - "Notification": false, - "onclose": true, - "onconnect": true, - "onerror": true, - "onfetch": true, - "oninstall": true, - "onlanguagechange": true, - "onmessage": true, - "onmessageerror": true, - "onnotificationclick": true, - "onnotificationclose": true, - "onoffline": true, - "ononline": true, - "onpush": true, - "onpushsubscriptionchange": true, - "onrejectionhandled": true, - "onsync": true, - "onunhandledrejection": true, - "performance": false, - "Performance": false, - "PerformanceEntry": false, - "PerformanceMark": false, - "PerformanceMeasure": false, - "PerformanceNavigation": false, - "PerformanceResourceTiming": false, - "PerformanceTiming": false, - "postMessage": true, - "Promise": false, - "queueMicrotask": false, - "registration": false, - "removeEventListener": false, - "Request": false, - "Response": false, - "self": false, - "ServiceWorker": false, - "ServiceWorkerContainer": false, - "ServiceWorkerGlobalScope": false, - "ServiceWorkerMessageEvent": false, - "ServiceWorkerRegistration": false, - "setInterval": false, - "setTimeout": false, - "skipWaiting": false, - "TextDecoder": false, - "TextEncoder": false, - "URL": false, - "URLSearchParams": false, - "WebSocket": false, - "WindowClient": false, - "Worker": false, - "WorkerGlobalScope": false, - "XMLHttpRequest": false - }, - "atomtest": { - "advanceClock": false, - "fakeClearInterval": false, - "fakeClearTimeout": false, - "fakeSetInterval": false, - "fakeSetTimeout": false, - "resetTimeouts": false, - "waitsForPromise": false - }, - "embertest": { - "andThen": false, - "click": false, - "currentPath": false, - "currentRouteName": false, - "currentURL": false, - "fillIn": false, - "find": false, - "findAll": false, - "findWithAssert": false, - "keyEvent": false, - "pauseTest": false, - "resumeTest": false, - "triggerEvent": false, - "visit": false, - "wait": false - }, - "protractor": { - "$": false, - "$$": false, - "browser": false, - "by": false, - "By": false, - "DartObject": false, - "element": false, - "protractor": false - }, - "shared-node-browser": { - "clearInterval": false, - "clearTimeout": false, - "console": false, - "setInterval": false, - "setTimeout": false, - "URL": false, - "URLSearchParams": false - }, - "webextensions": { - "browser": false, - "chrome": false, - "opr": false - }, - "greasemonkey": { - "cloneInto": false, - "createObjectIn": false, - "exportFunction": false, - "GM": false, - "GM_addStyle": false, - "GM_deleteValue": false, - "GM_getResourceText": false, - "GM_getResourceURL": false, - "GM_getValue": false, - "GM_info": false, - "GM_listValues": false, - "GM_log": false, - "GM_openInTab": false, - "GM_registerMenuCommand": false, - "GM_setClipboard": false, - "GM_setValue": false, - "GM_xmlhttpRequest": false, - "unsafeWindow": false - }, - "devtools": { - "$": false, - "$_": false, - "$$": false, - "$0": false, - "$1": false, - "$2": false, - "$3": false, - "$4": false, - "$x": false, - "chrome": false, - "clear": false, - "copy": false, - "debug": false, - "dir": false, - "dirxml": false, - "getEventListeners": false, - "inspect": false, - "keys": false, - "monitor": false, - "monitorEvents": false, - "profile": false, - "profileEnd": false, - "queryObjects": false, - "table": false, - "undebug": false, - "unmonitor": false, - "unmonitorEvents": false, - "values": false - } -} diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/globals/index.js b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/globals/index.js deleted file mode 100644 index a951582e4176e8..00000000000000 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/globals/index.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -module.exports = require('./globals.json'); diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/globals/license b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/globals/license deleted file mode 100644 index fa7ceba3eb4a96..00000000000000 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/globals/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (https://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. diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/globals/package.json b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/globals/package.json deleted file mode 100644 index 1569748ef90c16..00000000000000 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/globals/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "globals", - "version": "12.4.0", - "description": "Global identifiers from different JavaScript environments", - "license": "MIT", - "repository": "sindresorhus/globals", - "funding": "https://github.com/sponsors/sindresorhus", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava" - }, - "files": [ - "index.js", - "index.d.ts", - "globals.json" - ], - "keywords": [ - "globals", - "global", - "identifiers", - "variables", - "vars", - "jshint", - "eslint", - "environments" - ], - "dependencies": { - "type-fest": "^0.8.1" - }, - "devDependencies": { - "ava": "^2.2.0", - "tsd": "^0.9.0", - "xo": "^0.25.3" - }, - "xo": { - "ignores": [ - "get-browser-globals.js" - ] - }, - "tsd": { - "compilerOptions": { - "resolveJsonModule": true - } - } -} diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/globals/readme.md b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/globals/readme.md deleted file mode 100644 index fdcfa087ab1107..00000000000000 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/globals/readme.md +++ /dev/null @@ -1,56 +0,0 @@ -# globals [![Build Status](https://travis-ci.org/sindresorhus/globals.svg?branch=master)](https://travis-ci.org/sindresorhus/globals) - -> Global identifiers from different JavaScript environments - -Extracted from [JSHint](https://github.com/jshint/jshint/blob/3a8efa979dbb157bfb5c10b5826603a55a33b9ad/src/vars.js) and [ESLint](https://github.com/eslint/eslint/blob/b648406218f8a2d7302b98f5565e23199f44eb31/conf/environments.json) and merged. - -It's just a [JSON file](globals.json), so use it in whatever environment you like. - -**This module [no longer accepts](https://github.com/sindresorhus/globals/issues/82) new environments. If you need it for ESLint, just [create a plugin](http://eslint.org/docs/developer-guide/working-with-plugins#environments-in-plugins).** - -## Install - -``` -$ npm install globals -``` - -## Usage - -```js -const globals = require('globals'); - -console.log(globals.browser); -/* -{ - addEventListener: false, - applicationCache: false, - ArrayBuffer: false, - atob: false, - … -} -*/ -``` - -Each global is given a value of `true` or `false`. A value of `true` indicates that the variable may be overwritten. A value of `false` indicates that the variable should be considered read-only. This information is used by static analysis tools to flag incorrect behavior. We assume all variables should be `false` unless we hear otherwise. - -For Node.js this package provides two sets of globals: - -- `globals.nodeBuiltin`: Globals available to all code running in Node.js. - These will usually be available as properties on the `global` object and include `process`, `Buffer`, but not CommonJS arguments like `require`. - See: https://nodejs.org/api/globals.html -- `globals.node`: A combination of the globals from `nodeBuiltin` plus all CommonJS arguments ("CommonJS module scope"). - See: https://nodejs.org/api/modules.html#modules_the_module_scope - -When analyzing code that is known to run outside of a CommonJS wrapper, for example, JavaScript modules, `nodeBuiltin` can find accidental CommonJS references. - ---- - -
    - - Get professional support for this package with a Tidelift subscription - -
    - - Tidelift helps make open source sustainable for maintainers while giving companies
    assurances about security, maintenance, and licensing for their dependencies. -
    -
    diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/type-fest/license b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/type-fest/license deleted file mode 100644 index e7af2f77107d73..00000000000000 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/type-fest/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (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. diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/type-fest/package.json b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/type-fest/package.json deleted file mode 100644 index ea6621129dc660..00000000000000 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/type-fest/package.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "type-fest", - "version": "0.8.1", - "description": "A collection of essential TypeScript types", - "license": "(MIT OR CC0-1.0)", - "repository": "sindresorhus/type-fest", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && tsd" - }, - "files": [ - "index.d.ts", - "source" - ], - "keywords": [ - "typescript", - "ts", - "types", - "utility", - "util", - "utilities", - "omit", - "merge", - "json" - ], - "devDependencies": { - "@sindresorhus/tsconfig": "^0.4.0", - "@typescript-eslint/eslint-plugin": "^2.2.0", - "@typescript-eslint/parser": "^2.2.0", - "eslint-config-xo-typescript": "^0.18.0", - "tsd": "^0.7.3", - "xo": "^0.24.0" - }, - "xo": { - "extends": "xo-typescript", - "extensions": [ - "ts" - ], - "rules": { - "import/no-unresolved": "off", - "@typescript-eslint/indent": "off" - } - } -} diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/type-fest/readme.md b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/type-fest/readme.md deleted file mode 100644 index 1824bdabedecaa..00000000000000 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/type-fest/readme.md +++ /dev/null @@ -1,635 +0,0 @@ -
    -
    -
    - type-fest -
    -
    - A collection of essential TypeScript types -
    -
    -
    -
    -
    - -[![Build Status](https://travis-ci.com/sindresorhus/type-fest.svg?branch=master)](https://travis-ci.com/sindresorhus/type-fest) -[![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) - - -Many of the types here should have been built-in. You can help by suggesting some of them to the [TypeScript project](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). - -Either add this package as a dependency or copy-paste the needed types. No credit required. 👌 - -PR welcome for additional commonly needed types and docs improvements. Read the [contributing guidelines](.github/contributing.md) first. - - -## Install - -``` -$ npm install type-fest -``` - -*Requires TypeScript >=3.2* - - -## Usage - -```ts -import {Except} from 'type-fest'; - -type Foo = { - unicorn: string; - rainbow: boolean; -}; - -type FooWithoutRainbow = Except; -//=> {unicorn: string} -``` - - -## API - -Click the type names for complete docs. - -### Basic - -- [`Primitive`](source/basic.d.ts) - Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive). -- [`Class`](source/basic.d.ts) - Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes). -- [`TypedArray`](source/basic.d.ts) - Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`. -- [`JsonObject`](source/basic.d.ts) - Matches a JSON object. -- [`JsonArray`](source/basic.d.ts) - Matches a JSON array. -- [`JsonValue`](source/basic.d.ts) - Matches any valid JSON value. -- [`ObservableLike`](source/basic.d.ts) - Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable). - -### Utilities - -- [`Except`](source/except.d.ts) - Create a type from an object type without certain keys. This is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). -- [`Mutable`](source/mutable.d.ts) - Convert an object with `readonly` keys into a mutable object. The inverse of `Readonly`. -- [`Merge`](source/merge.d.ts) - Merge two types into a new type. Keys of the second type overrides keys of the first type. -- [`MergeExclusive`](source/merge-exclusive.d.ts) - Create a type that has mutually exclusive keys. -- [`RequireAtLeastOne`](source/require-at-least-one.d.ts) - Create a type that requires at least one of the given keys. -- [`RequireExactlyOne`](source/require-one.d.ts) - Create a type that requires exactly a single key of the given keys and disallows more. -- [`PartialDeep`](source/partial-deep.d.ts) - Create a deeply optional version of another type. Use [`Partial`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) if you only need one level deep. -- [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of an `object`/`Map`/`Set`/`Array` type. Use [`Readonly`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) if you only need one level deep. -- [`LiteralUnion`](source/literal-union.d.ts) - Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. Workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). -- [`Promisable`](source/promisable.d.ts) - Create a type that represents either the value or the value wrapped in `PromiseLike`. -- [`Opaque`](source/opaque.d.ts) - Create an [opaque type](https://codemix.com/opaque-types-in-javascript/). -- [`SetOptional`](source/set-optional.d.ts) - Create a type that makes the given keys optional. -- [`SetRequired`](source/set-required.d.ts) - Create a type that makes the given keys required. - -### Miscellaneous - -- [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). - - -## Declined types - -*If we decline a type addition, we will make sure to document the better solution here.* - -- [`Diff` and `Spread`](https://github.com/sindresorhus/type-fest/pull/7) - The PR author didn't provide any real-world use-cases and the PR went stale. If you think this type is useful, provide some real-world use-cases and we might reconsider. -- [`Dictionary`](https://github.com/sindresorhus/type-fest/issues/33) - You only save a few characters (`Dictionary` vs `Record`) from [`Record`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434), which is more flexible and well-known. Also, you shouldn't use an object as a dictionary. We have `Map` in JavaScript now. - - -## Tips - -### Built-in types - -There are many advanced types most users don't know about. - -- [`Partial`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) - Make all properties in `T` optional. -
    - - Example - - - [Playground](https://typescript-play.js.org/?target=6#code/KYOwrgtgBAMg9gcxsAbsANlA3gKClAeQDMiAaPKAEWACMwFz8BRAJxbhcagDEBDAF17ocAXxw4AliH7AWRXgGNgUAHJwAJsADCcEEQkJsFXgAcTK3hGAAuKAGd+LKQgDcFEx363wEGrLf46IjIaOi28EioGG5iOArovHZ2qhrAAIJmAEJgEuiaLEb4Jk4oAsoKuvoIYCwCErq2apo6egZQALyF+FCm5pY2UABETelmg1xFnrYAzAAM8xNQQZGh4cFR6AB0xEQUIm4UFa0IABRHVbYACrws-BJCADwjLVUAfACUXfhEHFBnug4oABrYAATygcCIhBoACtgAp+JsQaC7P9ju9Prhut0joCwCZ1GUAGpCMDKTrnAwAbWRPWSyMhKWalQMAF0Dtj8BIoSd8YSZCT0GSOu1OmAQJp9CBgOpPkc7uBgBzOfwABYSOybSnVWp3XQ0sF04FgxnPFkIVkdKB84mkpUUfCxbEsYD8GogKBqjUBKBiWIAen9UGut3u6CeqReBlePXQQQA7skwMl+HAoMU4CgJJoISB0ODeOmbvwIVC1cAcIGmdpzVApDI5IpgJscNL49WMiZsrl8id3lrzScsD0zBYrLZBgAVOCUOCdwa+95uIA) - - ```ts - interface NodeConfig { - appName: string; - port: number; - } - - class NodeAppBuilder { - private configuration: NodeConfig = { - appName: 'NodeApp', - port: 3000 - }; - - config(config: Partial) { - type NodeConfigKey = keyof NodeConfig; - - for (const key of Object.keys(config) as NodeConfigKey[]) { - const updateValue = config[key]; - - if (updateValue === undefined) { - continue; - } - - this.configuration[key] = updateValue; - } - - return this; - } - } - - // `Partial`` allows us to provide only a part of the - // NodeConfig interface. - new NodeAppBuilder().config({appName: 'ToDoApp'}); - ``` -
    - -- [`Required`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1408-L1413) - Make all properties in `T` required. -
    - - Example - - - [Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgGED21VQGJZwC2wA3gFCjXAzFJgA2A-AFzADOUckA5gNxUaIYjA4ckvGG07c+g6gF8KQkAgCuEFFDA5O6gEbEwUbLm2ESwABQIixACJIoSdgCUYAR3Vg4MACYAPGYuFvYAfACU5Ko0APRxwADKMBD+wFAAFuh2Vv7OSBlYGdmc8ABu8LHKsRyGxqY4oQT21pTCIHQMjOwA5DAAHgACxAAOjDAAdChYxL0ANLHUouKSMH0AEmAAhJhY6ozpAJ77GTCMjMCiV0ToSAb7UJPPC9WRgrEJwAAqR6MwSRQPFGUFocDgRHYxnEfGAowh-zgUCOwF6KwkUl6tXqJhCeEsxDaS1AXSYfUGI3GUxmc0WSneQA) - - ```ts - interface ContactForm { - email?: string; - message?: string; - } - - function submitContactForm(formData: Required) { - // Send the form data to the server. - } - - submitContactForm({ - email: 'ex@mple.com', - message: 'Hi! Could you tell me more about…', - }); - - // TypeScript error: missing property 'message' - submitContactForm({ - email: 'ex@mple.com', - }); - ``` -
    - -- [`Readonly`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) - Make all properties in `T` readonly. -
    - - Example - - - [Playground](https://typescript-play.js.org/?target=6#code/AQ4UwOwVwW2AZA9gc3mAbmANsA3gKFCOAHkAzMgGkOJABEwAjKZa2kAUQCcvEu32AMQCGAF2FYBIAL4BufDRABLCKLBcywgMZgEKZOoDCiCGSXI8i4hGEwwALmABnUVxXJ57YFgzZHSVF8sT1BpBSItLGEnJz1kAy5LLy0TM2RHACUwYQATEywATwAeAITjU3MAPnkrCJMXLigtUT4AClxgGztKbyDgaX99I1TzAEokr1BRAAslJwA6FIqLAF48TtswHp9MHDla9hJGACswZvmyLjAwAC8wVpm5xZHkUZDaMKIwqyWXYCW0oN4sNlsA1h0ug5gAByACyBQAggAHJHQ7ZBIFoXbzBjMCz7OoQP5YIaJNYQMAAdziCVaALGNSIAHomcAACoFJFgADKWjcSNEwG4vC4ji0wggEEQguiTnMEGALWAV1yAFp8gVgEjeFyuKICvMrCTgVxnst5jtsGC4ljsPNhXxGaAWcAAOq6YRXYDCRg+RWIcA5JSC+kWdCepQ+v3RYCU3RInzRMCGwlpC19NYBW1Ye08R1AA) - - ```ts - enum LogLevel { - Off, - Debug, - Error, - Fatal - }; - - interface LoggerConfig { - name: string; - level: LogLevel; - } - - class Logger { - config: Readonly; - - constructor({name, level}: LoggerConfig) { - this.config = {name, level}; - Object.freeze(this.config); - } - } - - const config: LoggerConfig = { - name: 'MyApp', - level: LogLevel.Debug - }; - - const logger = new Logger(config); - - // TypeScript Error: cannot assign to read-only property. - logger.config.level = LogLevel.Error; - - // We are able to edit config variable as we please. - config.level = LogLevel.Error; - ``` -
    - -- [`Pick`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1422-L1427) - From `T`, pick a set of properties whose keys are in the union `K`. -
    - - Example - - - [Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgEE5TCgNugN4BQoZwOUBAXMAM5RyQDmA3KeSFABYCuAtgCMISMHloMmENh04oA9tBjQJjFuzIBfYrOAB6PcADCcGElh1gEGAHcKATwAO6ebyjB5CTNlwFwSxFR0BX5HeToYABNgBDh5fm8cfBg6AHIKG3ldA2BHOOcfFNpUygJ0pAhokr4hETFUgDpswywkggAFUwA3MFtgAF5gQgowKhhVKTYKGuFRcXo1aVZgbTIoJ3RW3xhOmB6+wfbcAGsAHi3kgBpgEtGy4AAfG54BWfqAPnZm4AAlZUj4MAkMA8GAGB4vEgfMlLLw6CwPBA8PYRmMgZVgAC6CgmI4cIommQELwICh8RBgKZKvALh1ur0bHQABR5PYMui0Wk7em2ADaAF0AJS0AASABUALIAGQAogR+Mp3CROCAFBBwVC2ikBpj5CgBIqGjizLA5TAFdAmalImAuqlBRoVQh5HBgEy1eDWfs7J5cjzGYKhroVfpDEhHM4MV6GRR5NN0JrtnRg6BVirTFBeHAKYmYY6QNpdB73LmCJZBlSAXAubtvczeSmQMNSuMbmKNgBlHFgPEUNwusBIPAAQlS1xetTmxT0SDoESgdD0C4aACtHMwxytLrohawgA) - - ```ts - interface Article { - title: string; - thumbnail: string; - content: string; - } - - // Creates new type out of the `Article` interface composed - // from the Articles' two properties: `title` and `thumbnail`. - // `ArticlePreview = {title: string; thumbnail: string}` - type ArticlePreview = Pick; - - // Render a list of articles using only title and description. - function renderArticlePreviews(previews: ArticlePreview[]): HTMLElement { - const articles = document.createElement('div'); - - for (const preview of previews) { - // Append preview to the articles. - } - - return articles; - } - - const articles = renderArticlePreviews([ - { - title: 'TypeScript tutorial!', - thumbnail: '/assets/ts.jpg' - } - ]); - ``` -
    - -- [`Record`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434) - Construct a type with a set of properties `K` of type `T`. -
    - - Example - - - [Playground](https://typescript-play.js.org/?target=6#code/AQ4ejYAUHsGcCWAXBMB2dgwGbAKYC2ADgDYwCeeemCaWArgE7ADGMxAhmuQHQBQoYEnJE8wALKEARnkaxEKdMAC8wAOS0kstGuAAfdQBM8ANzxlRjXQbVaWACwC0JPB0NqA3HwGgIwAJJoWozYHCxixnAsjAhStADmwESMMJYo1Fi4HMCIaPEu+MRklHj8gpqyoeHAAKJFFFTAAN4+giDYCIxwSAByHAR4AFw5SDF5Xm2gJBzdfQPD3WPxE5PAlBxdAPLYNQAelgh4aOHDaPQEMowrIAC+3oJ+AMKMrlrAXFhSAFZ4LEhC9g4-0BmA4JBISXgiCkBQABpILrJ5MhUGhYcATGD6Bk4Hh-jNgABrPDkOBlXyQAAq9ngYmJpOAAHcEOCRjAXqwYODfoo6DhakUSph+Uh7GI4P0xER4Cj0OSQGwMP8tP1hgAlX7swwAHgRl2RvIANALSA08ABtAC6AD4VM1Wm0Kow0MMrYaHYJjGYLLJXZb3at1HYnC43Go-QHQDcvA6-JsmEJXARgCDgMYWAhjIYhDAU+YiMAAFIwex0ZmilMITCGF79TLAGRsAgJYAAZRwSEZGzEABFTOZUrJ5Yn+jwnWgeER6HB7AAKJrADpdXqS4ZqYultTG6azVfqHswPBbtauLY7fayQ7HIbAAAMwBuAEoYw9IBq2Ixs9h2eFMOQYPQObALQKJgggABeYhghCIpikkKRpOQRIknAsZUiIeCttECBEP8NSMCkjDDAARMGziuIYxHwYOjDCMBmDNnAuTxA6irdCOBB1Lh5Dqpqn66tISIykawBnOCtqqC0gbjqc9DgpGkxegOliyfJDrRkAA) - - ```ts - // Positions of employees in our company. - type MemberPosition = 'intern' | 'developer' | 'tech-lead'; - - // Interface describing properties of a single employee. - interface Employee { - firstName: string; - lastName: string; - yearsOfExperience: number; - } - - // Create an object that has all possible `MemberPosition` values set as keys. - // Those keys will store a collection of Employees of the same position. - const team: Record = { - intern: [], - developer: [], - 'tech-lead': [], - }; - - // Our team has decided to help John with his dream of becoming Software Developer. - team.intern.push({ - firstName: 'John', - lastName: 'Doe', - yearsOfExperience: 0 - }); - - // `Record` forces you to initialize all of the property keys. - // TypeScript Error: "tech-lead" property is missing - const teamEmpty: Record = { - intern: null, - developer: null, - }; - ``` -
    - -- [`Exclude`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1436-L1439) - Exclude from `T` those types that are assignable to `U`. -
    - - Example - - - [Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgMrQG7QMIHsQzADmyA3gFDLIAOuUYAXMiAK4A2byAPsgM5hRQJHqwC2AI2gBucgF9y5MAE9qKAEoQAjiwj8AEnBAATNtGQBeZAAooWphu26wAGmS3e93bRC8IASgsAPmRDJRlyAHoI5ABRAA8ENhYjFFYOZGVVZBgoXFFkAAM0zh5+QRBhZhYJaAKAOkjogEkQZAQ4X2QAdwALCFbaemRgXmQtFjhOMFwq9K6ULuB0lk6U+HYwZAxJnQaYFhAEMGB8ZCIIMAAFOjAANR2IK0HGWISklIAedCgsKDwCYgAbQA5M9gQBdVzFQJ+JhiSRQMiUYYwayZCC4VHPCzmSzAspCYEBWxgFhQAZwKC+FpgJ43VwARgADH4ZFQSWSBjcZPJyPtDsdTvxKWBvr8rD1DCZoJ5HPopaYoK4EPhCEQmGKcKriLCtrhgEYkVQVT5Nr4fmZLLZtMBbFZgT0wGBqES6ghbHBIJqoBKFdBWQpjfh+DQbhY2tqiHVsbjLMVkAB+ZAAZiZaeQTHOVxu9ySjxNaujNwDVHNvzqbBGkBAdPoAfkQA) - - ```ts - interface ServerConfig { - port: null | string | number; - } - - type RequestHandler = (request: Request, response: Response) => void; - - // Exclude `null` type from `null | string | number`. - // In case the port is equal to `null`, we will use default value. - function getPortValue(port: Exclude): number { - if (typeof port === 'string') { - return parseInt(port, 10); - } - - return port; - } - - function startServer(handler: RequestHandler, config: ServerConfig): void { - const server = require('http').createServer(handler); - - const port = config.port === null ? 3000 : getPortValue(config.port); - server.listen(port); - } - ``` -
    - -- [`Extract`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1441-L1444) - Extract from `T` those types that are assignable to `U`. -
    - - Example - - - [Playground](https://typescript-play.js.org/?target=6#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXzSwEdkQBJYACgEoAueVZAWwCMQYBuAKDDwGcM8MgBF4AXngBlAJ6scESgHIRi6ty5ZUGdoihgEABXZ888AN5d48ANoiAuvUat23K6ihMQ9ATE0BzV3goPy8GZjZOLgBfLi4Aejj4AEEICBwAdz54MAALKFQQ+BxEeAAHY1NgKAwoIKy0grr4DByEUpgccpgMaXgAaxBerCzi+B9-ZulygDouFHRsU1z8kKMYE1RhaqgAHkt4AHkWACt4EAAPbVRgLLWNgBp9gGlBs8uQa6yAUUuYPQwdgNpKM7nh7mMML4CgA+R5WABqUAgpDeVxuhxO1he0jsXGh8EoOBO9COx3BQPo2PBADckaR6IjkSA6PBqTgsMBzPsicdrEC7OJWXSQNwYvFEgAVTS9JLXODpeDpKBZFg4GCoWa8VACIJykAKiQWKy2YQOAioYikCg0OEMDyhRSy4DyxS24KhAAMjyi6gS8AAwjh5OD0iBFHAkJoEOksC1mnkMJq8gUQKDNttKPlnfrwYp3J5XfBHXqoKpfYkAOI4ansTxaeDADmoRSCCBYAbxhC6TDx6rwYHIRX5bScjA4bLJwoDmDwDkfbA9JMrVMVdM1TN69LgkTgwgkchUahqIA) - - ```ts - declare function uniqueId(): number; - - const ID = Symbol('ID'); - - interface Person { - [ID]: number; - name: string; - age: number; - } - - // Allows changing the person data as long as the property key is of string type. - function changePersonData< - Obj extends Person, - Key extends Extract, - Value extends Obj[Key] - > (obj: Obj, key: Key, value: Value): void { - obj[key] = value; - } - - // Tiny Andrew was born. - const andrew = { - [ID]: uniqueId(), - name: 'Andrew', - age: 0, - }; - - // Cool, we're fine with that. - changePersonData(andrew, 'name', 'Pony'); - - // Goverment didn't like the fact that you wanted to change your identity. - changePersonData(andrew, ID, uniqueId()); - ``` -
    - -- [`NonNullable`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1446-L1449) - Exclude `null` and `undefined` from `T`. -
    - - Example - - Works with strictNullChecks set to true. (Read more here) - - [Playground](https://typescript-play.js.org/?target=6#code/C4TwDgpgBACg9gJ2AOQK4FsBGEFQLxQDOwCAlgHYDmUAPlORtrnQwDasDcAUFwPQBU-WAEMkUOADMowqAGNWwwoSgATCBIqlgpOOSjAAFsOBRSy1IQgr9cKJlSlW1mZYQA3HFH68u8xcoBlHA8EACEHJ08Aby4oKDBUTFZSWXjEFEYcAEIALihkXTR2YSSIAB54JDQsHAA+blj4xOTUsHSACkMzPKD3HHDHNQQAGjSkPMqMmoQASh7g-oihqBi4uNIpdraxPAI2VhmVxrX9AzMAOm2ppnwoAA4ABifuE4BfKAhWSyOTuK7CS7pao3AhXF5rV48E4ICDAVAIPT-cGQyG+XTEIgLMJLTx7CAAdygvRCA0iCHaMwarhJOIQjUBSHaACJHk8mYdeLwxtdcVAAOSsh58+lXdr7Dlcq7A3n3J4PEUdADMcspUE53OluAIUGVTx46oAKuAIAFZGQwCYAKIIBCILjUxaDHAMnla+iodjcIA) - - ```ts - type PortNumber = string | number | null; - - /** Part of a class definition that is used to build a server */ - class ServerBuilder { - portNumber!: NonNullable; - - port(this: ServerBuilder, port: PortNumber): ServerBuilder { - if (port == null) { - this.portNumber = 8000; - } else { - this.portNumber = port; - } - - return this; - } - } - - const serverBuilder = new ServerBuilder(); - - serverBuilder - .port('8000') // portNumber = '8000' - .port(null) // portNumber = 8000 - .port(3000); // portNumber = 3000 - - // TypeScript error - serverBuilder.portNumber = null; - ``` -
    - -- [`Parameters`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1451-L1454) - Obtain the parameters of a function type in a tuple. -
    - - Example - - - [Playground](https://typescript-play.js.org/?target=6#code/GYVwdgxgLglg9mABAZwBYmMANgUwBQxgAOIUAXIgIZgCeA2gLoCUFAbnDACaIDeAUIkQB6IYgCypSlBxUATrMo1ECsJzgBbLEoipqAc0J7EMKMgDkiHLnU4wp46pwAPHMgB0fAL58+oSLARECEosLAA5ABUYG2QAHgAxJGdpVWREPDdMylk9ZApqemZEAF4APipacrw-CApEgBogkKwAYThwckQwEHUAIxxZJl4BYVEImiIZKF0oZRwiWVdbeygJmThgOYgcGFYcbhqApCJsyhtpWXcR1cnEePBoeDAABVPzgbTixFeFd8uEsClADcIxGiygIFkSEOT3SmTc2VydQeRx+ZxwF2QQ34gkEwDgsnSuFmMBKiAADEDjIhYk1Qm0OlSYABqZnYka4xA1DJZHJYkGc7yCbyeRA+CAIZCzNAYbA4CIAdxg2zJwVCkWirjwMswuEaACYmCCgA) - - ```ts - function shuffle(input: any[]): void { - // Mutate array randomly changing its' elements indexes. - } - - function callNTimes any> (func: Fn, callCount: number) { - // Type that represents the type of the received function parameters. - type FunctionParameters = Parameters; - - return function (...args: FunctionParameters) { - for (let i = 0; i < callCount; i++) { - func(...args); - } - } - } - - const shuffleTwice = callNTimes(shuffle, 2); - ``` -
    - -- [`ConstructorParameters`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1456-L1459) - Obtain the parameters of a constructor function type in a tuple. -
    - - Example - - - [Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECCBOAXAlqApgWQPYBM0mgG8AoaaFRENALmgkXmQDsBzAblOmCycTV4D8teo1YdO3JiICuwRFngAKClWENmLAJRFOZRAAtkEAHQq00ALzlklNBzIBfYk+KhIMAJJTEYJsDQAwmDA+mgAPAAq0GgAHnxMODCKTGgA7tCKxllg8CwQtL4AngDaALraFgB80EWa1SRkAA6MAG5gfNAB4FABPDJyCrQR9tDNyG0dwMGhtBhgjWEiGgA00F70vv4RhY3hEZXVVinpc42KmuJkkv3y8Bly8EPaDWTkhiZd7r3e8LK3llwGCMXGQWGhEOsfH5zJlsrl8p0+gw-goAAo5MAAW3BaHgEEilU0tEhmzQ212BJ0ry4SOg+kg+gBBiMximIGA0nAfAQLGk2N4EAAEgzYcYcnkLsRdDTvNEYkYUKwSdCme9WdM0MYwYhFPSIPpJdTkAAzDKxBUaZX+aAAQgsVmkCTQxuYaBw2ng4Ok8CYcotSu8pMur09iG9vuObxZnx6SN+AyUWTF8MN0CcZE4Ywm5jZHK5aB5fP4iCFIqT4oRRTKRLo6lYVNeAHpG50wOzOe1zHr9NLQ+HoABybsD4HOKXXRA1JCoKhBELmI5pNaB6Fz0KKBAodDYPAgSUTmqYsAALx4m5nC6nW9nGq14KtaEUA9gR9PvuNCjQ9BgACNvcwNBtAcLiAA) - - ```ts - class ArticleModel { - title: string; - content?: string; - - constructor(title: string) { - this.title = title; - } - } - - class InstanceCache any)> { - private ClassConstructor: T; - private cache: Map> = new Map(); - - constructor (ctr: T) { - this.ClassConstructor = ctr; - } - - getInstance (...args: ConstructorParameters): InstanceType { - const hash = this.calculateArgumentsHash(...args); - - const existingInstance = this.cache.get(hash); - if (existingInstance !== undefined) { - return existingInstance; - } - - return new this.ClassConstructor(...args); - } - - private calculateArgumentsHash(...args: any[]): string { - // Calculate hash. - return 'hash'; - } - } - - const articleCache = new InstanceCache(ArticleModel); - const amazonArticle = articleCache.getInstance('Amazon forests burining!'); - ``` -
    - -- [`ReturnType`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1461-L1464) – Obtain the return type of a function type. -
    - - Example - - - [Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA) - - ```ts - /** Provides every element of the iterable `iter` into the `callback` function and stores the results in an array. */ - function mapIter< - Elem, - Func extends (elem: Elem) => any, - Ret extends ReturnType - >(iter: Iterable, callback: Func): Ret[] { - const mapped: Ret[] = []; - - for (const elem of iter) { - mapped.push(callback(elem)); - } - - return mapped; - } - - const setObject: Set = new Set(); - const mapObject: Map = new Map(); - - mapIter(setObject, (value: string) => value.indexOf('Foo')); // number[] - - mapIter(mapObject, ([key, value]: [number, string]) => { - return key % 2 === 0 ? value : 'Odd'; - }); // string[] - ``` -
    - -- [`InstanceType`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1466-L1469) – Obtain the instance type of a constructor function type. -
    - - Example - - - [Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA) - - ```ts - class IdleService { - doNothing (): void {} - } - - class News { - title: string; - content: string; - - constructor(title: string, content: string) { - this.title = title; - this.content = content; - } - } - - const instanceCounter: Map = new Map(); - - interface Constructor { - new(...args: any[]): any; - } - - // Keep track how many instances of `Constr` constructor have been created. - function getInstance< - Constr extends Constructor, - Args extends ConstructorParameters - >(constructor: Constr, ...args: Args): InstanceType { - let count = instanceCounter.get(constructor) || 0; - - const instance = new constructor(...args); - - instanceCounter.set(constructor, count + 1); - - console.log(`Created ${count + 1} instances of ${Constr.name} class`); - - return instance; - } - - - const idleService = getInstance(IdleService); - // Will log: `Created 1 instances of IdleService class` - const newsEntry = getInstance(News, 'New ECMAScript proposals!', 'Last month...'); - // Will log: `Created 1 instances of News class` - ``` -
    - -- [`Omit`](https://github.com/microsoft/TypeScript/blob/71af02f7459dc812e85ac31365bfe23daf14b4e4/src/lib/es5.d.ts#L1446) – Constructs a type by picking all properties from T and then removing K. -
    - - Example - - - [Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgIImAWzgG2QbwChlks4BzCAVShwC5kBnMKUcgbmKYAcIFgIjBs1YgOXMpSFMWbANoBdTiW5woFddwAW0kfKWEAvoUIB6U8gDCUCHEiNkICAHdkYAJ69kz4GC3JcPG4oAHteKDABBxCYNAxsPFBIWEQUCAAPJG4wZABySUFcgJAAEzMLXNV1ck0dIuCw6EjBADpy5AB1FAQ4EGQAV0YUP2AHDy8wEOQbUugmBLwtEIA3OcmQnEjuZBgQqE7gAGtgZAhwKHdkHFGwNvGUdDIcAGUliIBJEF3kAF5kAHlML4ADyPBIAGjyBUYRQAPnkqho4NoYQA+TiEGD9EAISIhPozErQMG4AASK2gn2+AApek9pCSXm8wFSQooAJQMUkAFQAsgAZACiOAgmDOOSIJAQ+OYyGl4DgoDmf2QJRCCH6YvALQQNjsEGFovF1NyJWAy1y7OUyHMyE+yRAuFImG4Iq1YDswHxbRINjA-SgfXlHqVUE4xiAA) - - ```ts - interface Animal { - imageUrl: string; - species: string; - images: string[]; - paragraphs: string[]; - } - - // Creates new type with all properties of the `Animal` interface - // except 'images' and 'paragraphs' properties. We can use this - // type to render small hover tooltip for a wiki entry list. - type AnimalShortInfo = Omit; - - function renderAnimalHoverInfo (animals: AnimalShortInfo[]): HTMLElement { - const container = document.createElement('div'); - // Internal implementation. - return container; - } - ``` -
    - -You can find some examples in the [TypeScript docs](https://www.typescriptlang.org/docs/handbook/advanced-types.html#predefined-conditional-types). - - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Jarek Radosz](https://github.com/CvX) -- [Dimitri Benin](https://github.com/BendingBender) - - -## License - -(MIT OR CC0-1.0) - - ---- - -
    - - Get professional support for this package with a Tidelift subscription - -
    - - Tidelift helps make open source sustainable for maintainers while giving companies
    assurances about security, maintenance, and licensing for their dependencies. -
    -
    diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/package.json b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/package.json index a75ea6c9b63d71..e79857f5553e99 100644 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/package.json +++ b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/package.json @@ -1,6 +1,6 @@ { "name": "@eslint/eslintrc", - "version": "0.4.1", + "version": "0.4.2", "description": "The legacy ESLintRC config file format for ESLint", "main": "lib/index.js", "files": [ @@ -50,7 +50,7 @@ "ajv": "^6.12.4", "debug": "^4.1.1", "espree": "^7.3.0", - "globals": "^12.1.0", + "globals": "^13.9.0", "ignore": "^4.0.6", "import-fresh": "^3.2.1", "js-yaml": "^3.13.1", diff --git a/tools/node_modules/eslint/node_modules/globals/globals.json b/tools/node_modules/eslint/node_modules/globals/globals.json index c132603f96a2e0..1119914e203e2c 100644 --- a/tools/node_modules/eslint/node_modules/globals/globals.json +++ b/tools/node_modules/eslint/node_modules/globals/globals.json @@ -478,6 +478,7 @@ "DOMPointReadOnly": false, "DOMQuad": false, "DOMRect": false, + "DOMRectList": false, "DOMRectReadOnly": false, "DOMStringList": false, "DOMStringMap": false, diff --git a/tools/node_modules/eslint/node_modules/globals/package.json b/tools/node_modules/eslint/node_modules/globals/package.json index d00a83296e08fc..66d027e5f30e8c 100644 --- a/tools/node_modules/eslint/node_modules/globals/package.json +++ b/tools/node_modules/eslint/node_modules/globals/package.json @@ -1,6 +1,6 @@ { "name": "globals", - "version": "13.8.0", + "version": "13.9.0", "description": "Global identifiers from different JavaScript environments", "license": "MIT", "repository": "sindresorhus/globals", diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/README.md b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/README.md index 269f2605db654a..f1ff6731d37e2d 100644 --- a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/README.md +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/README.md @@ -6,7 +6,7 @@ The fastest JSON validator for Node.js and browser. -Supports JSON Schema draft-06/07/2019-09/2020-12 (draft-04 is supported in [version 6](https://github.com/ajv-validator/ajv/tree/v6)) and JSON Type Definition [RFC8927](https://datatracker.ietf.org/doc/rfc8927/). +Supports JSON Schema draft-04/06/07/2019-09/2020-12 ([draft-04 support](https://ajv.js.org/json-schema.html#draft-04) requires ajv-draft-04 package) and JSON Type Definition [RFC8927](https://datatracker.ietf.org/doc/rfc8927/). [![build](https://github.com/ajv-validator/ajv/workflows/build/badge.svg)](https://github.com/ajv-validator/ajv/actions?query=workflow%3Abuild) [![npm](https://img.shields.io/npm/v/ajv.svg)](https://www.npmjs.com/package/ajv) diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/jtd/parse.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/jtd/parse.js index 8fa6f31aa77566..1eeb1be39d9e62 100644 --- a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/jtd/parse.js +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/jtd/parse.js @@ -244,9 +244,18 @@ function parseType(cxt) { parseNumber(cxt); break; default: { - const [min, max, maxDigits] = type_1.intRange[schema.type]; - parseNumber(cxt, maxDigits); - gen.if(codegen_1._ `${data} < ${min} || ${data} > ${max}`, () => parsingError(cxt, codegen_1.str `integer out of range`)); + const t = schema.type; + if (!self.opts.int32range && (t === "int32" || t === "uint32")) { + parseNumber(cxt, 16); // 2 ** 53 - max safe integer + if (t === "uint32") { + gen.if(codegen_1._ `${data} < 0`, () => parsingError(cxt, codegen_1.str `integer out of range`)); + } + } + else { + const [min, max, maxDigits] = type_1.intRange[t]; + parseNumber(cxt, maxDigits); + gen.if(codegen_1._ `${data} < ${min} || ${data} > ${max}`, () => parsingError(cxt, codegen_1.str `integer out of range`)); + } } } } diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/core.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/core.js index 8f4156e1307f1d..eb1af0979d3615 100644 --- a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/core.js +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/core.js @@ -60,7 +60,7 @@ const deprecatedOptions = { const MAX_EXPRESSION = 200; // eslint-disable-next-line complexity function requiredOptions(o) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w; + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x; const s = o.strict; const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize; const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0; @@ -81,6 +81,7 @@ function requiredOptions(o) { validateSchema: (_u = o.validateSchema) !== null && _u !== void 0 ? _u : true, validateFormats: (_v = o.validateFormats) !== null && _v !== void 0 ? _v : true, unicodeRegExp: (_w = o.unicodeRegExp) !== null && _w !== void 0 ? _w : true, + int32range: (_x = o.int32range) !== null && _x !== void 0 ? _x : true, }; } class Ajv { diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js index ff68c82e1061ec..c54747b35bbedb 100644 --- a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js @@ -11,10 +11,13 @@ const def = { code(cxt) { const { gen, schema, data, parentSchema, it } = cxt; const { opts } = it; - const patterns = code_1.schemaProperties(it, schema); - // TODO mark properties matching patterns with always valid schemas as evaluated - if (patterns.length === 0) + const patterns = code_1.allSchemaProperties(schema); + const alwaysValidPatterns = patterns.filter((p) => util_1.alwaysValidSchema(it, schema[p])); + if (patterns.length === 0 || + (alwaysValidPatterns.length === patterns.length && + (!it.opts.unevaluated || it.props === true))) { return; + } const checkProperties = opts.strictSchema && !opts.allowMatchingProperties && parentSchema.properties; const valid = gen.name("valid"); if (it.props !== true && !(it.props instanceof codegen_1.Name)) { @@ -46,16 +49,19 @@ const def = { function validateProperties(pat) { gen.forIn("key", data, (key) => { gen.if(codegen_1._ `${code_1.usePattern(cxt, pat)}.test(${key})`, () => { - cxt.subschema({ - keyword: "patternProperties", - schemaProp: pat, - dataProp: key, - dataPropType: util_2.Type.Str, - }, valid); + const alwaysValid = alwaysValidPatterns.includes(pat); + if (!alwaysValid) { + cxt.subschema({ + keyword: "patternProperties", + schemaProp: pat, + dataProp: key, + dataPropType: util_2.Type.Str, + }, valid); + } if (it.opts.unevaluated && props !== true) { gen.assign(codegen_1._ `${props}[${key}]`, true); } - else if (!it.allErrors) { + else if (!alwaysValid && !it.allErrors) { // can short-circuit if `unevaluatedProperties` is not supported (opts.next === false) // or if all properties were evaluated (props === true) gen.if(codegen_1.not(valid), () => gen.break()); diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/type.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/type.js index 9bdfa012e908d2..428bddbc432f06 100644 --- a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/type.js +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/type.js @@ -34,7 +34,7 @@ const def = { error, code(cxt) { metadata_1.checkMetadata(cxt); - const { data, schema, parentSchema } = cxt; + const { data, schema, parentSchema, it } = cxt; let cond; switch (schema) { case "boolean": @@ -50,8 +50,16 @@ const def = { cond = codegen_1._ `typeof ${data} == "number"`; break; default: { - const [min, max] = exports.intRange[schema]; - cond = codegen_1._ `typeof ${data} == "number" && isFinite(${data}) && ${data} >= ${min} && ${data} <= ${max} && !(${data} % 1)`; + const sch = schema; + cond = codegen_1._ `typeof ${data} == "number" && isFinite(${data}) && !(${data} % 1)`; + if (!it.opts.int32range && (sch === "int32" || sch === "uint32")) { + if (sch === "uint32") + cond = codegen_1._ `${cond} && ${data} >= 0`; + } + else { + const [min, max] = exports.intRange[sch]; + cond = codegen_1._ `${cond} && ${data} >= ${min} && ${data} <= ${max}`; + } } } cxt.pass(parentSchema.nullable ? codegen_1.or(codegen_1._ `${data} === null`, cond) : cond); diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/package.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/package.json index 0c913147f4db42..357ede01961155 100644 --- a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/package.json +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/package.json @@ -1,6 +1,6 @@ { "name": "ajv", - "version": "8.5.0", + "version": "8.6.0", "description": "Another JSON Schema Validator", "main": "dist/ajv.js", "types": "dist/ajv.d.ts", @@ -64,7 +64,7 @@ }, "devDependencies": { "@ajv-validator/config": "^0.3.0", - "@rollup/plugin-commonjs": "^18.0.0", + "@rollup/plugin-commonjs": "^19.0.0", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^13.0.0", "@rollup/plugin-typescript": "^8.2.1", @@ -91,14 +91,14 @@ "karma": "^6.0.0", "karma-chrome-launcher": "^3.0.0", "karma-mocha": "^2.0.0", - "lint-staged": "^10.2.11", + "lint-staged": "^11.0.0", "mocha": "^8.0.1", "node-fetch": "^2.6.1", "nyc": "^15.0.0", - "prettier": "^2.0.5", + "prettier": "^2.3.1", "rollup": "^2.44.0", "rollup-plugin-terser": "^7.0.2", - "ts-node": "^9.0.0", + "ts-node": "^10.0.0", "tsify": "^5.0.2", "typescript": "^4.2.0", "vuepress": "^1.8.2" diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index 77016c21db43e7..601033eb44e5da 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -1,6 +1,6 @@ { "name": "eslint", - "version": "7.27.0", + "version": "7.28.0", "author": "Nicholas C. Zakas ", "description": "An AST-based pattern checker for JavaScript.", "bin": { @@ -44,7 +44,7 @@ "bugs": "https://github.com/eslint/eslint/issues/", "dependencies": { "@babel/code-frame": "7.12.11", - "@eslint/eslintrc": "^0.4.1", + "@eslint/eslintrc": "^0.4.2", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -61,7 +61,7 @@ "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.0.0", + "glob-parent": "^5.1.2", "globals": "^13.6.0", "ignore": "^4.0.6", "import-fresh": "^3.0.0", @@ -95,7 +95,7 @@ "ejs": "^3.0.2", "eslint": "file:.", "eslint-config-eslint": "file:packages/eslint-config-eslint", - "eslint-plugin-eslint-plugin": "^2.2.1", + "eslint-plugin-eslint-plugin": "^3.0.3", "eslint-plugin-internal-rules": "file:tools/internal-rules", "eslint-plugin-jsdoc": "^25.4.3", "eslint-plugin-node": "^11.1.0",