remove node_modules
This commit is contained in:
parent
e69896481c
commit
163f0a7172
8295 changed files with 3 additions and 1465238 deletions
|
@ -15,6 +15,8 @@ http.createServer(function (req, res) {
|
||||||
})
|
})
|
||||||
|
|
||||||
res.end()
|
res.end()
|
||||||
}).listen(5050)
|
}).listen(5050, "127.0.0.1", () => {
|
||||||
|
console.log(`Server is running on http://"127.0.0.1":5050`)
|
||||||
|
})
|
||||||
|
|
||||||
console.log("running webhook!")
|
console.log("running webhook!")
|
12
node_modules/.bin/acorn
generated
vendored
12
node_modules/.bin/acorn
generated
vendored
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../acorn/bin/acorn" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../acorn/bin/acorn" "$@"
|
|
||||||
fi
|
|
12
node_modules/.bin/detect-libc
generated
vendored
12
node_modules/.bin/detect-libc
generated
vendored
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../detect-libc/bin/detect-libc.js" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../detect-libc/bin/detect-libc.js" "$@"
|
|
||||||
fi
|
|
12
node_modules/.bin/eslint
generated
vendored
12
node_modules/.bin/eslint
generated
vendored
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../eslint/bin/eslint.js" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../eslint/bin/eslint.js" "$@"
|
|
||||||
fi
|
|
12
node_modules/.bin/js-yaml
generated
vendored
12
node_modules/.bin/js-yaml
generated
vendored
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../js-yaml/bin/js-yaml.js" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../js-yaml/bin/js-yaml.js" "$@"
|
|
||||||
fi
|
|
12
node_modules/.bin/mkdirp
generated
vendored
12
node_modules/.bin/mkdirp
generated
vendored
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../mkdirp/bin/cmd.js" "$@"
|
|
||||||
fi
|
|
12
node_modules/.bin/needle
generated
vendored
12
node_modules/.bin/needle
generated
vendored
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../needle/bin/needle" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../needle/bin/needle" "$@"
|
|
||||||
fi
|
|
12
node_modules/.bin/node-pre-gyp
generated
vendored
12
node_modules/.bin/node-pre-gyp
generated
vendored
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../node-pre-gyp/bin/node-pre-gyp" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../node-pre-gyp/bin/node-pre-gyp" "$@"
|
|
||||||
fi
|
|
12
node_modules/.bin/node-which
generated
vendored
12
node_modules/.bin/node-which
generated
vendored
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../which/bin/node-which" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../which/bin/node-which" "$@"
|
|
||||||
fi
|
|
12
node_modules/.bin/npm
generated
vendored
12
node_modules/.bin/npm
generated
vendored
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../npm/bin/npm-cli.js" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../npm/bin/npm-cli.js" "$@"
|
|
||||||
fi
|
|
12
node_modules/.bin/npx
generated
vendored
12
node_modules/.bin/npx
generated
vendored
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../npm/bin/npx-cli.js" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../npm/bin/npx-cli.js" "$@"
|
|
||||||
fi
|
|
12
node_modules/.bin/rc
generated
vendored
12
node_modules/.bin/rc
generated
vendored
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../rc/cli.js" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../rc/cli.js" "$@"
|
|
||||||
fi
|
|
12
node_modules/.bin/rimraf
generated
vendored
12
node_modules/.bin/rimraf
generated
vendored
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../rimraf/bin.js" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../rimraf/bin.js" "$@"
|
|
||||||
fi
|
|
12
node_modules/.bin/semver
generated
vendored
12
node_modules/.bin/semver
generated
vendored
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../semver/bin/semver.js" "$@"
|
|
||||||
fi
|
|
12
node_modules/.bin/uuid
generated
vendored
12
node_modules/.bin/uuid
generated
vendored
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../uuid/dist/bin/uuid" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../uuid/dist/bin/uuid" "$@"
|
|
||||||
fi
|
|
4477
node_modules/.package-lock.json
generated
vendored
4477
node_modules/.package-lock.json
generated
vendored
File diff suppressed because it is too large
Load diff
126
node_modules/@discordjs/builders/CHANGELOG.md
generated
vendored
126
node_modules/@discordjs/builders/CHANGELOG.md
generated
vendored
|
@ -1,126 +0,0 @@
|
||||||
# Changelog
|
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
|
||||||
|
|
||||||
# [0.12.0](https://github.com/discordjs/discord.js/compare/@discordjs/builders@0.11.0...@discordjs/builders@0.12.0) (2021-12-08)
|
|
||||||
|
|
||||||
## Bug Fixes
|
|
||||||
|
|
||||||
- **builders:** Dont export `Button` component stuff twice (#7289) ([86d9d06](https://github.com/discordjs/discord.js/commit/86d9d0674347c08d056cd054cb4ce4253195bf94))
|
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
- **SlashCommandSubcommands:** Updating old links from Discord developer portal (#7224) ([bd7a6f2](https://github.com/discordjs/discord.js/commit/bd7a6f265212624199fb0b2ddc8ece39759c63de))
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- Add components to /builders (#7195) ([2bb40fd](https://github.com/discordjs/discord.js/commit/2bb40fd767cf5918e3ba422ff73082734bfa05b0))
|
|
||||||
|
|
||||||
## Typings
|
|
||||||
|
|
||||||
- Make `required` a boolean (#7307) ([c10afea](https://github.com/discordjs/discord.js/commit/c10afeadc702ab98bec5e077b3b92494a9596f9c))
|
|
||||||
|
|
||||||
# [0.11.0](https://github.com/discordjs/builders/compare/v0.10.0...v0.11.0) (2021-12-29)
|
|
||||||
|
|
||||||
## Bug Fixes
|
|
||||||
|
|
||||||
- **ApplicationCommandOptions:** clean up code for builder options ([#68](https://github.com/discordjs/builders/issues/68)) ([b5d0b15](https://github.com/discordjs/builders/commit/b5d0b157b1262bd01fa011f8e0cf33adb82776e7))
|
|
||||||
|
|
||||||
# [0.10.0](https://github.com/discordjs/builders/compare/v0.9.0...v0.10.0) (2021-12-24)
|
|
||||||
|
|
||||||
## Bug Fixes
|
|
||||||
|
|
||||||
- use zod instead of ow for max/min option validation ([#66](https://github.com/discordjs/builders/issues/66)) ([beb35fb](https://github.com/discordjs/builders/commit/beb35fb1f65bd6be2321e17cc792f67e8615fd48))
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- add max/min option for int and number builder options ([#47](https://github.com/discordjs/builders/issues/47)) ([2e1e860](https://github.com/discordjs/builders/commit/2e1e860b46e3453398b20df63dabb6d4325e32d1))
|
|
||||||
|
|
||||||
# [0.9.0](https://github.com/discordjs/builders/compare/v0.8.2...v0.9.0) (2021-12-02)
|
|
||||||
|
|
||||||
## Bug Fixes
|
|
||||||
|
|
||||||
- replace ow with zod ([#58](https://github.com/discordjs/builders/issues/58)) ([0b6fb81](https://github.com/discordjs/builders/commit/0b6fb8161b858e42781855fb73aaa873fec58160))
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- **SlashCommandBuilder:** add autocomplete ([#53](https://github.com/discordjs/builders/issues/53)) ([05b07a7](https://github.com/discordjs/builders/commit/05b07a7e88848188c27d7380d9f948cba25ef778))
|
|
||||||
|
|
||||||
## [0.8.2](https://github.com/discordjs/builders/compare/v0.8.1...v0.8.2) (2021-10-30)
|
|
||||||
|
|
||||||
## Bug Fixes
|
|
||||||
|
|
||||||
- downgrade ow because of esm issues ([#55](https://github.com/discordjs/builders/issues/55)) ([3722d2c](https://github.com/discordjs/builders/commit/3722d2c1109a7a5c0abad63c1a7eb944df6e46c8))
|
|
||||||
|
|
||||||
## [0.8.1](https://github.com/discordjs/builders/compare/v0.8.0...v0.8.1) (2021-10-29)
|
|
||||||
|
|
||||||
## Bug Fixes
|
|
||||||
|
|
||||||
- documentation ([e33ec8d](https://github.com/discordjs/builders/commit/e33ec8dfd5785312f82e0afb017a3dac614fd71d))
|
|
||||||
|
|
||||||
# [0.7.0](https://github.com/discordjs/builders/compare/v0.6.0...v0.7.0) (2021-10-18)
|
|
||||||
|
|
||||||
## Bug Fixes
|
|
||||||
|
|
||||||
- properly type `toJSON` methods ([#34](https://github.com/discordjs/builders/issues/34)) ([7723ad0](https://github.com/discordjs/builders/commit/7723ad0da169386e638188de220451a97513bc25))
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- **ContextMenus:** add context menu command builder ([#29](https://github.com/discordjs/builders/issues/29)) ([f0641e5](https://github.com/discordjs/builders/commit/f0641e55733de8992600f3082bcf054e6f815cf7))
|
|
||||||
- add support for channel types on channel options ([#41](https://github.com/discordjs/builders/issues/41)) ([f6c187e](https://github.com/discordjs/builders/commit/f6c187e0ad6ebe03e65186ece3e95cb1db5aeb50))
|
|
||||||
|
|
||||||
# [0.6.0](https://github.com/discordjs/builders/compare/v0.5.0...v0.6.0) (2021-08-24)
|
|
||||||
|
|
||||||
## Bug Fixes
|
|
||||||
|
|
||||||
- **SlashCommandBuilder:** allow subcommands and groups to coexist at the root level ([#26](https://github.com/discordjs/builders/issues/26)) ([0be4daf](https://github.com/discordjs/builders/commit/0be4dafdfc0b5747c880be0078c00ada913eb4fb))
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- create `Embed` builder ([#11](https://github.com/discordjs/builders/issues/11)) ([eb942a4](https://github.com/discordjs/builders/commit/eb942a4d1f3bcec9a4e370b6af602a713ad8f9b7))
|
|
||||||
- **SlashCommandBuilder:** create setDefaultPermission function ([#19](https://github.com/discordjs/builders/issues/19)) ([5d53759](https://github.com/discordjs/builders/commit/5d537593937a8da330153ce4711b7d093a80330e))
|
|
||||||
- **SlashCommands:** add number option type ([#23](https://github.com/discordjs/builders/issues/23)) ([1563991](https://github.com/discordjs/builders/commit/1563991d421bb07bf7a412c87e7613692d770f04))
|
|
||||||
|
|
||||||
# [0.5.0](https://github.com/discordjs/builders/compare/v0.3.0...v0.5.0) (2021-08-10)
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- **Formatters:** add `formatEmoji` ([#20](https://github.com/discordjs/builders/issues/20)) ([c3d8bb5](https://github.com/discordjs/builders/commit/c3d8bb5363a1d46b45c0def4277da6921e2ba209))
|
|
||||||
|
|
||||||
# [0.4.0](https://github.com/discordjs/builders/compare/v0.3.0...v0.4.0) (2021-08-05)
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- `sub command` => `subcommand` ([#18](https://github.com/discordjs/builders/pull/18)) ([95599c5](https://github.com/discordjs/builders/commit/95599c5b5366ebd054c4c277c52f1a44cda1209d))
|
|
||||||
|
|
||||||
# [0.3.0](https://github.com/discordjs/builders/compare/v0.2.0...v0.3.0) (2021-08-01)
|
|
||||||
|
|
||||||
## Bug Fixes
|
|
||||||
|
|
||||||
- **Shrug:** Update comment ([#14](https://github.com/discordjs/builders/issues/14)) ([6fa6c40](https://github.com/discordjs/builders/commit/6fa6c405f2ea733811677d3d1bfb1e2806d504d5))
|
|
||||||
- shrug face rendering ([#13](https://github.com/discordjs/builders/issues/13)) ([6ad24ec](https://github.com/discordjs/builders/commit/6ad24ecd96c82b0f576e78e9e53fc7bf9c36ef5d))
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- **formatters:** mentions ([#9](https://github.com/discordjs/builders/issues/9)) ([f83fe99](https://github.com/discordjs/builders/commit/f83fe99b83188ed999845751ffb005c687dbd60a))
|
|
||||||
- **Formatters:** Add a spoiler function ([#16](https://github.com/discordjs/builders/issues/16)) ([c213a6a](https://github.com/discordjs/builders/commit/c213a6abb114f65653017a4edec4bdba2162d771))
|
|
||||||
- **SlashCommands:** add slash command builders ([#3](https://github.com/discordjs/builders/issues/3)) ([6aa3af0](https://github.com/discordjs/builders/commit/6aa3af07b0ee342fff91f080914bb12b3ab773f8))
|
|
||||||
- shrug, tableflip and unflip strings ([#5](https://github.com/discordjs/builders/issues/5)) ([de5fa82](https://github.com/discordjs/builders/commit/de5fa823cd6f1feba5b2d0a63b2cb1761dfd1814))
|
|
||||||
|
|
||||||
# [0.2.0](https://github.com/discordjs/builders/compare/v0.1.1...v0.2.0) (2021-07-03)
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- **Formatters:** added `hyperlink` and `hideLinkEmbed` ([#4](https://github.com/discordjs/builders/issues/4)) ([c532daf](https://github.com/discordjs/builders/commit/c532daf2ba2feae75bf9668f63462e96a5314cff))
|
|
||||||
|
|
||||||
# [0.1.1](https://github.com/discordjs/builders/compare/v0.1.0...v0.1.1) (2021-06-30)
|
|
||||||
|
|
||||||
## Bug Fixes
|
|
||||||
|
|
||||||
- **Deps:** added `tslib` as dependency ([#2](https://github.com/discordjs/builders/issues/2)) ([5576ff3](https://github.com/discordjs/builders/commit/5576ff3b67136b957bed0ab8a4c655d5de322813))
|
|
||||||
|
|
||||||
# 0.1.0 (2021-06-30)
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- added message formatters ([#1](https://github.com/discordjs/builders/issues/1)) ([765e46d](https://github.com/discordjs/builders/commit/765e46dac96c4e49d350243e5fad34c2bc738a7c))
|
|
191
node_modules/@discordjs/builders/LICENSE
generated
vendored
191
node_modules/@discordjs/builders/LICENSE
generated
vendored
|
@ -1,191 +0,0 @@
|
||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
Copyright 2021 Noel Buechler
|
|
||||||
Copyright 2021 Vlad Frangu
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
53
node_modules/@discordjs/builders/README.md
generated
vendored
53
node_modules/@discordjs/builders/README.md
generated
vendored
|
@ -1,53 +0,0 @@
|
||||||
<div align="center">
|
|
||||||
<br />
|
|
||||||
<p>
|
|
||||||
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
|
|
||||||
</p>
|
|
||||||
<br />
|
|
||||||
<p>
|
|
||||||
<a href="https://discord.gg/djs"><img src="https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
|
|
||||||
<a href="https://www.npmjs.com/package/@discordjs/builders"><img src="https://img.shields.io/npm/v/@discordjs/builders.svg?maxAge=3600" alt="npm version" /></a>
|
|
||||||
<a href="https://www.npmjs.com/package/@discordjs/builders"><img src="https://img.shields.io/npm/dt/@discordjs/builders.svg?maxAge=3600" alt="npm downloads" /></a>
|
|
||||||
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/test.yml/badge.svg" alt="Build status" /></a>
|
|
||||||
<a href="https://codecov.io/gh/discordjs/builders"><img src="https://codecov.io/gh/discordjs/builders/branch/main/graph/badge.svg" alt="Code coverage" /></a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
**Node.js 16.9.0 or newer is required.**
|
|
||||||
|
|
||||||
```sh-session
|
|
||||||
npm install @discordjs/builders
|
|
||||||
yarn add @discordjs/builders
|
|
||||||
pnpm add @discordjs/builders
|
|
||||||
```
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
Here are some examples for the builders and utilities you can find in this package:
|
|
||||||
|
|
||||||
- [Slash Command Builders](./docs/examples/Slash%20Command%20Builders.md)
|
|
||||||
|
|
||||||
## Links
|
|
||||||
|
|
||||||
- [Website](https://discord.js.org/) ([source](https://github.com/discordjs/website))
|
|
||||||
- [Documentation](https://discord.js.org/#/docs/builders)
|
|
||||||
- [Guide](https://discordjs.guide/) ([source](https://github.com/discordjs/guide))
|
|
||||||
See also the [Update Guide](https://discordjs.guide/additional-info/changes-in-v13.html), including updated and removed items in the library.
|
|
||||||
- [discord.js Discord server](https://discord.gg/djs)
|
|
||||||
- [Discord API Discord server](https://discord.gg/discord-api)
|
|
||||||
- [GitHub](https://github.com/discordjs/discord.js/tree/main/packages/builders)
|
|
||||||
- [npm](https://www.npmjs.com/package/@discordjs/builders)
|
|
||||||
- [Related libraries](https://discord.com/developers/docs/topics/community-resources#libraries)
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
|
|
||||||
[documentation](https://discord.js.org/#/docs/builders).
|
|
||||||
See [the contribution guide](https://github.com/discordjs/discord.js/blob/main/.github/CONTRIBUTING.md) if you'd like to submit a PR.
|
|
||||||
|
|
||||||
## Help
|
|
||||||
|
|
||||||
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle
|
|
||||||
nudge in the right direction, please don't hesitate to join our official [discord.js Server](https://discord.gg/djs).
|
|
1084
node_modules/@discordjs/builders/dist/index.d.ts
generated
vendored
1084
node_modules/@discordjs/builders/dist/index.d.ts
generated
vendored
File diff suppressed because it is too large
Load diff
4
node_modules/@discordjs/builders/dist/index.js
generated
vendored
4
node_modules/@discordjs/builders/dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
1
node_modules/@discordjs/builders/dist/index.js.map
generated
vendored
1
node_modules/@discordjs/builders/dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
4
node_modules/@discordjs/builders/dist/index.mjs
generated
vendored
4
node_modules/@discordjs/builders/dist/index.mjs
generated
vendored
File diff suppressed because one or more lines are too long
1
node_modules/@discordjs/builders/dist/index.mjs.map
generated
vendored
1
node_modules/@discordjs/builders/dist/index.mjs.map
generated
vendored
File diff suppressed because one or more lines are too long
1
node_modules/@discordjs/builders/docs/README.md
generated
vendored
1
node_modules/@discordjs/builders/docs/README.md
generated
vendored
|
@ -1 +0,0 @@
|
||||||
## [View the documentation here.](https://discord.js.org/#/docs/builders)
|
|
5
node_modules/@discordjs/builders/docs/index.yml
generated
vendored
5
node_modules/@discordjs/builders/docs/index.yml
generated
vendored
|
@ -1,5 +0,0 @@
|
||||||
- name: General
|
|
||||||
files:
|
|
||||||
- name: Welcome
|
|
||||||
id: welcome
|
|
||||||
path: ../../README.md
|
|
88
node_modules/@discordjs/builders/package.json
generated
vendored
88
node_modules/@discordjs/builders/package.json
generated
vendored
|
@ -1,88 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@discordjs/builders",
|
|
||||||
"version": "0.12.0",
|
|
||||||
"description": "A set of builders that you can use when creating your bot",
|
|
||||||
"scripts": {
|
|
||||||
"build": "tsup",
|
|
||||||
"test": "jest --pass-with-no-tests",
|
|
||||||
"lint": "prettier --check . && eslint src __tests__ --ext mjs,js,ts",
|
|
||||||
"format": "prettier --write . && eslint src __tests__ --ext mjs,js,ts --fix",
|
|
||||||
"docs": "typedoc --json docs/typedoc-out.json src/index.ts && node scripts/docs.mjs",
|
|
||||||
"prepublishOnly": "yarn build && yarn lint && yarn test",
|
|
||||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/builders/*'"
|
|
||||||
},
|
|
||||||
"main": "./dist/index.js",
|
|
||||||
"module": "./dist/index.mjs",
|
|
||||||
"types": "./dist/index.d.ts",
|
|
||||||
"exports": {
|
|
||||||
"import": "./dist/index.mjs",
|
|
||||||
"require": "./dist/index.js"
|
|
||||||
},
|
|
||||||
"directories": {
|
|
||||||
"lib": "src",
|
|
||||||
"test": "__tests__"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"dist"
|
|
||||||
],
|
|
||||||
"contributors": [
|
|
||||||
"Vlad Frangu <kingdgrizzle@gmail.com>",
|
|
||||||
"Crawl <icrawltogo@gmail.com>",
|
|
||||||
"Amish Shah <amishshah.2k@gmail.com>",
|
|
||||||
"SpaceEEC <spaceeec@yahoo.com>",
|
|
||||||
"Antonio Roman <kyradiscord@gmail.com>"
|
|
||||||
],
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"keywords": [
|
|
||||||
"discord",
|
|
||||||
"api",
|
|
||||||
"bot",
|
|
||||||
"client",
|
|
||||||
"node",
|
|
||||||
"discordapp",
|
|
||||||
"discordjs"
|
|
||||||
],
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/discordjs/discord.js.git"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/discordjs/discord.js/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://discord.js.org",
|
|
||||||
"dependencies": {
|
|
||||||
"@sindresorhus/is": "^4.3.0",
|
|
||||||
"discord-api-types": "^0.26.1",
|
|
||||||
"ts-mixer": "^6.0.0",
|
|
||||||
"tslib": "^2.3.1",
|
|
||||||
"zod": "^3.11.6"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@babel/core": "^7.16.12",
|
|
||||||
"@babel/plugin-proposal-decorators": "^7.16.5",
|
|
||||||
"@babel/preset-env": "^7.16.11",
|
|
||||||
"@babel/preset-typescript": "^7.16.5",
|
|
||||||
"@discordjs/ts-docgen": "^0.3.4",
|
|
||||||
"@types/jest": "^27.0.3",
|
|
||||||
"@types/node": "^16.11.6",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
|
||||||
"@typescript-eslint/parser": "^5.10.0",
|
|
||||||
"babel-plugin-transform-typescript-metadata": "^0.3.2",
|
|
||||||
"eslint": "^8.7.0",
|
|
||||||
"eslint-config-marine": "^9.3.2",
|
|
||||||
"eslint-config-prettier": "^8.3.0",
|
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
|
||||||
"jest": "^27.4.7",
|
|
||||||
"prettier": "^2.5.1",
|
|
||||||
"standard-version": "^9.3.2",
|
|
||||||
"tsup": "^5.11.11",
|
|
||||||
"typedoc": "^0.22.11",
|
|
||||||
"typescript": "^4.5.5"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=16.9.0"
|
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
}
|
|
||||||
}
|
|
191
node_modules/@discordjs/collection/LICENSE
generated
vendored
191
node_modules/@discordjs/collection/LICENSE
generated
vendored
|
@ -1,191 +0,0 @@
|
||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
Copyright 2015 - 2021 Noel Buechler
|
|
||||||
Copyright 2015 - 2021 Amish Shah
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
46
node_modules/@discordjs/collection/README.md
generated
vendored
46
node_modules/@discordjs/collection/README.md
generated
vendored
|
@ -1,46 +0,0 @@
|
||||||
<div align="center">
|
|
||||||
<br />
|
|
||||||
<p>
|
|
||||||
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
|
|
||||||
</p>
|
|
||||||
<br />
|
|
||||||
<p>
|
|
||||||
<a href="https://discord.gg/djs"><img src="https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
|
|
||||||
<a href="https://www.npmjs.com/package/@discordjs/collection"><img src="https://img.shields.io/npm/v/@discordjs/collection.svg?maxAge=3600" alt="npm version" /></a>
|
|
||||||
<a href="https://www.npmjs.com/package/@discordjs/collection"><img src="https://img.shields.io/npm/dt/@discordjs/collection.svg?maxAge=3600" alt="npm downloads" /></a>
|
|
||||||
<a href="https://github.com/discordjs/collection/actions"><img src="https://github.com/discordjs/collection/workflows/Tests/badge.svg" alt="Build status" /></a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
## About
|
|
||||||
|
|
||||||
`@discordjs/collection` is a powerful utility data structure used in discord.js.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
**Node.js 16.0.0 or newer is required.**
|
|
||||||
|
|
||||||
```sh-session
|
|
||||||
npm install @discordjs/collection
|
|
||||||
yarn add @discordjs/collection
|
|
||||||
pnpm add @discordjs/collection
|
|
||||||
```
|
|
||||||
|
|
||||||
## Links
|
|
||||||
|
|
||||||
- [Website](https://discord.js.org/) ([source](https://github.com/discordjs/website))
|
|
||||||
- [Documentation](https://discord.js.org/#/docs/collection)
|
|
||||||
- [discord.js Discord server](https://discord.gg/djs)
|
|
||||||
- [GitHub](https://github.com/discordjs/collection)
|
|
||||||
- [npm](https://www.npmjs.com/package/@discordjs/collection)
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
|
|
||||||
[documentation](https://discord.js.org/#/docs/collection).
|
|
||||||
See [the contribution guide](https://github.com/discordjs/collection/blob/main/.github/CONTRIBUTING.md) if you'd like to submit a PR.
|
|
||||||
|
|
||||||
## Help
|
|
||||||
|
|
||||||
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle
|
|
||||||
nudge in the right direction, please don't hesitate to join our official [discord.js Server](https://discord.gg/djs).
|
|
381
node_modules/@discordjs/collection/dist/index.d.ts
generated
vendored
381
node_modules/@discordjs/collection/dist/index.d.ts
generated
vendored
|
@ -1,381 +0,0 @@
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
interface CollectionConstructor {
|
|
||||||
new (): Collection<unknown, unknown>;
|
|
||||||
new <K, V>(entries?: ReadonlyArray<readonly [K, V]> | null): Collection<K, V>;
|
|
||||||
new <K, V>(iterable: Iterable<readonly [K, V]>): Collection<K, V>;
|
|
||||||
readonly prototype: Collection<unknown, unknown>;
|
|
||||||
readonly [Symbol.species]: CollectionConstructor;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Separate interface for the constructor so that emitted js does not have a constructor that overwrites itself
|
|
||||||
*
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
interface Collection<K, V> extends Map<K, V> {
|
|
||||||
constructor: CollectionConstructor;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* A Map with additional utility methods. This is used throughout discord.js rather than Arrays for anything that has
|
|
||||||
* an ID, for significantly improved performance and ease-of-use.
|
|
||||||
*/
|
|
||||||
declare class Collection<K, V> extends Map<K, V> {
|
|
||||||
static readonly default: typeof Collection;
|
|
||||||
/**
|
|
||||||
* Obtains the value of the given key if it exists, otherwise sets and returns the value provided by the default value generator.
|
|
||||||
*
|
|
||||||
* @param key The key to get if it exists, or set otherwise
|
|
||||||
* @param defaultValueGenerator A function that generates the default value
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* collection.ensure(guildId, () => defaultGuildConfig);
|
|
||||||
*/
|
|
||||||
ensure(key: K, defaultValueGenerator: (key: K, collection: this) => V): V;
|
|
||||||
/**
|
|
||||||
* Checks if all of the elements exist in the collection.
|
|
||||||
*
|
|
||||||
* @param keys - The keys of the elements to check for
|
|
||||||
*
|
|
||||||
* @returns `true` if all of the elements exist, `false` if at least one does not exist.
|
|
||||||
*/
|
|
||||||
hasAll(...keys: K[]): boolean;
|
|
||||||
/**
|
|
||||||
* Checks if any of the elements exist in the collection.
|
|
||||||
*
|
|
||||||
* @param keys - The keys of the elements to check for
|
|
||||||
*
|
|
||||||
* @returns `true` if any of the elements exist, `false` if none exist.
|
|
||||||
*/
|
|
||||||
hasAny(...keys: K[]): boolean;
|
|
||||||
/**
|
|
||||||
* Obtains the first value(s) in this collection.
|
|
||||||
*
|
|
||||||
* @param amount Amount of values to obtain from the beginning
|
|
||||||
*
|
|
||||||
* @returns A single value if no amount is provided or an array of values, starting from the end if amount is negative
|
|
||||||
*/
|
|
||||||
first(): V | undefined;
|
|
||||||
first(amount: number): V[];
|
|
||||||
/**
|
|
||||||
* Obtains the first key(s) in this collection.
|
|
||||||
*
|
|
||||||
* @param amount Amount of keys to obtain from the beginning
|
|
||||||
*
|
|
||||||
* @returns A single key if no amount is provided or an array of keys, starting from the end if
|
|
||||||
* amount is negative
|
|
||||||
*/
|
|
||||||
firstKey(): K | undefined;
|
|
||||||
firstKey(amount: number): K[];
|
|
||||||
/**
|
|
||||||
* Obtains the last value(s) in this collection.
|
|
||||||
*
|
|
||||||
* @param amount Amount of values to obtain from the end
|
|
||||||
*
|
|
||||||
* @returns A single value if no amount is provided or an array of values, starting from the start if
|
|
||||||
* amount is negative
|
|
||||||
*/
|
|
||||||
last(): V | undefined;
|
|
||||||
last(amount: number): V[];
|
|
||||||
/**
|
|
||||||
* Obtains the last key(s) in this collection.
|
|
||||||
*
|
|
||||||
* @param amount Amount of keys to obtain from the end
|
|
||||||
*
|
|
||||||
* @returns A single key if no amount is provided or an array of keys, starting from the start if
|
|
||||||
* amount is negative
|
|
||||||
*/
|
|
||||||
lastKey(): K | undefined;
|
|
||||||
lastKey(amount: number): K[];
|
|
||||||
/**
|
|
||||||
* Identical to [Array.at()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at).
|
|
||||||
* Returns the item at a given index, allowing for positive and negative integers.
|
|
||||||
* Negative integers count back from the last item in the collection.
|
|
||||||
*
|
|
||||||
* @param index The index of the element to obtain
|
|
||||||
*/
|
|
||||||
at(index: number): V | undefined;
|
|
||||||
/**
|
|
||||||
* Identical to [Array.at()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at).
|
|
||||||
* Returns the key at a given index, allowing for positive and negative integers.
|
|
||||||
* Negative integers count back from the last item in the collection.
|
|
||||||
*
|
|
||||||
* @param index The index of the key to obtain
|
|
||||||
*/
|
|
||||||
keyAt(index: number): K | undefined;
|
|
||||||
/**
|
|
||||||
* Obtains unique random value(s) from this collection.
|
|
||||||
*
|
|
||||||
* @param amount Amount of values to obtain randomly
|
|
||||||
*
|
|
||||||
* @returns A single value if no amount is provided or an array of values
|
|
||||||
*/
|
|
||||||
random(): V | undefined;
|
|
||||||
random(amount: number): V[];
|
|
||||||
/**
|
|
||||||
* Obtains unique random key(s) from this collection.
|
|
||||||
*
|
|
||||||
* @param amount Amount of keys to obtain randomly
|
|
||||||
*
|
|
||||||
* @returns A single key if no amount is provided or an array
|
|
||||||
*/
|
|
||||||
randomKey(): K | undefined;
|
|
||||||
randomKey(amount: number): K[];
|
|
||||||
/**
|
|
||||||
* Identical to [Array.reverse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse)
|
|
||||||
* but returns a Collection instead of an Array.
|
|
||||||
*/
|
|
||||||
reverse(): this;
|
|
||||||
/**
|
|
||||||
* Searches for a single item where the given function returns a truthy value. This behaves like
|
|
||||||
* [Array.find()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
|
|
||||||
* <warn>All collections used in Discord.js are mapped using their `id` property, and if you want to find by id you
|
|
||||||
* should use the `get` method. See
|
|
||||||
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get) for details.</warn>
|
|
||||||
*
|
|
||||||
* @param fn The function to test with (should return boolean)
|
|
||||||
* @param thisArg Value to use as `this` when executing function
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* collection.find(user => user.username === 'Bob');
|
|
||||||
*/
|
|
||||||
find<V2 extends V>(fn: (value: V, key: K, collection: this) => value is V2): V2 | undefined;
|
|
||||||
find(fn: (value: V, key: K, collection: this) => boolean): V | undefined;
|
|
||||||
find<This, V2 extends V>(fn: (this: This, value: V, key: K, collection: this) => value is V2, thisArg: This): V2 | undefined;
|
|
||||||
find<This>(fn: (this: This, value: V, key: K, collection: this) => boolean, thisArg: This): V | undefined;
|
|
||||||
/**
|
|
||||||
* Searches for the key of a single item where the given function returns a truthy value. This behaves like
|
|
||||||
* [Array.findIndex()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex),
|
|
||||||
* but returns the key rather than the positional index.
|
|
||||||
*
|
|
||||||
* @param fn The function to test with (should return boolean)
|
|
||||||
* @param thisArg Value to use as `this` when executing function
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* collection.findKey(user => user.username === 'Bob');
|
|
||||||
*/
|
|
||||||
findKey<K2 extends K>(fn: (value: V, key: K, collection: this) => key is K2): K2 | undefined;
|
|
||||||
findKey(fn: (value: V, key: K, collection: this) => boolean): K | undefined;
|
|
||||||
findKey<This, K2 extends K>(fn: (this: This, value: V, key: K, collection: this) => key is K2, thisArg: This): K2 | undefined;
|
|
||||||
findKey<This>(fn: (this: This, value: V, key: K, collection: this) => boolean, thisArg: This): K | undefined;
|
|
||||||
/**
|
|
||||||
* Removes items that satisfy the provided filter function.
|
|
||||||
*
|
|
||||||
* @param fn Function used to test (should return a boolean)
|
|
||||||
* @param thisArg Value to use as `this` when executing function
|
|
||||||
*
|
|
||||||
* @returns The number of removed entries
|
|
||||||
*/
|
|
||||||
sweep(fn: (value: V, key: K, collection: this) => boolean): number;
|
|
||||||
sweep<T>(fn: (this: T, value: V, key: K, collection: this) => boolean, thisArg: T): number;
|
|
||||||
/**
|
|
||||||
* Identical to
|
|
||||||
* [Array.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),
|
|
||||||
* but returns a Collection instead of an Array.
|
|
||||||
*
|
|
||||||
* @param fn The function to test with (should return boolean)
|
|
||||||
* @param thisArg Value to use as `this` when executing function
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* collection.filter(user => user.username === 'Bob');
|
|
||||||
*/
|
|
||||||
filter<K2 extends K>(fn: (value: V, key: K, collection: this) => key is K2): Collection<K2, V>;
|
|
||||||
filter<V2 extends V>(fn: (value: V, key: K, collection: this) => value is V2): Collection<K, V2>;
|
|
||||||
filter(fn: (value: V, key: K, collection: this) => boolean): Collection<K, V>;
|
|
||||||
filter<This, K2 extends K>(fn: (this: This, value: V, key: K, collection: this) => key is K2, thisArg: This): Collection<K2, V>;
|
|
||||||
filter<This, V2 extends V>(fn: (this: This, value: V, key: K, collection: this) => value is V2, thisArg: This): Collection<K, V2>;
|
|
||||||
filter<This>(fn: (this: This, value: V, key: K, collection: this) => boolean, thisArg: This): Collection<K, V>;
|
|
||||||
/**
|
|
||||||
* Partitions the collection into two collections where the first collection
|
|
||||||
* contains the items that passed and the second contains the items that failed.
|
|
||||||
*
|
|
||||||
* @param fn Function used to test (should return a boolean)
|
|
||||||
* @param thisArg Value to use as `this` when executing function
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* const [big, small] = collection.partition(guild => guild.memberCount > 250);
|
|
||||||
*/
|
|
||||||
partition<K2 extends K>(fn: (value: V, key: K, collection: this) => key is K2): [Collection<K2, V>, Collection<Exclude<K, K2>, V>];
|
|
||||||
partition<V2 extends V>(fn: (value: V, key: K, collection: this) => value is V2): [Collection<K, V2>, Collection<K, Exclude<V, V2>>];
|
|
||||||
partition(fn: (value: V, key: K, collection: this) => boolean): [Collection<K, V>, Collection<K, V>];
|
|
||||||
partition<This, K2 extends K>(fn: (this: This, value: V, key: K, collection: this) => key is K2, thisArg: This): [Collection<K2, V>, Collection<Exclude<K, K2>, V>];
|
|
||||||
partition<This, V2 extends V>(fn: (this: This, value: V, key: K, collection: this) => value is V2, thisArg: This): [Collection<K, V2>, Collection<K, Exclude<V, V2>>];
|
|
||||||
partition<This>(fn: (this: This, value: V, key: K, collection: this) => boolean, thisArg: This): [Collection<K, V>, Collection<K, V>];
|
|
||||||
/**
|
|
||||||
* Maps each item into a Collection, then joins the results into a single Collection. Identical in behavior to
|
|
||||||
* [Array.flatMap()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap).
|
|
||||||
*
|
|
||||||
* @param fn Function that produces a new Collection
|
|
||||||
* @param thisArg Value to use as `this` when executing function
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* collection.flatMap(guild => guild.members.cache);
|
|
||||||
*/
|
|
||||||
flatMap<T>(fn: (value: V, key: K, collection: this) => Collection<K, T>): Collection<K, T>;
|
|
||||||
flatMap<T, This>(fn: (this: This, value: V, key: K, collection: this) => Collection<K, T>, thisArg: This): Collection<K, T>;
|
|
||||||
/**
|
|
||||||
* Maps each item to another value into an array. Identical in behavior to
|
|
||||||
* [Array.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
|
|
||||||
*
|
|
||||||
* @param fn Function that produces an element of the new array, taking three arguments
|
|
||||||
* @param thisArg Value to use as `this` when executing function
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* collection.map(user => user.tag);
|
|
||||||
*/
|
|
||||||
map<T>(fn: (value: V, key: K, collection: this) => T): T[];
|
|
||||||
map<This, T>(fn: (this: This, value: V, key: K, collection: this) => T, thisArg: This): T[];
|
|
||||||
/**
|
|
||||||
* Maps each item to another value into a collection. Identical in behavior to
|
|
||||||
* [Array.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
|
|
||||||
*
|
|
||||||
* @param fn Function that produces an element of the new collection, taking three arguments
|
|
||||||
* @param thisArg Value to use as `this` when executing function
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* collection.mapValues(user => user.tag);
|
|
||||||
*/
|
|
||||||
mapValues<T>(fn: (value: V, key: K, collection: this) => T): Collection<K, T>;
|
|
||||||
mapValues<This, T>(fn: (this: This, value: V, key: K, collection: this) => T, thisArg: This): Collection<K, T>;
|
|
||||||
/**
|
|
||||||
* Checks if there exists an item that passes a test. Identical in behavior to
|
|
||||||
* [Array.some()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some).
|
|
||||||
*
|
|
||||||
* @param fn Function used to test (should return a boolean)
|
|
||||||
* @param thisArg Value to use as `this` when executing function
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* collection.some(user => user.discriminator === '0000');
|
|
||||||
*/
|
|
||||||
some(fn: (value: V, key: K, collection: this) => boolean): boolean;
|
|
||||||
some<T>(fn: (this: T, value: V, key: K, collection: this) => boolean, thisArg: T): boolean;
|
|
||||||
/**
|
|
||||||
* Checks if all items passes a test. Identical in behavior to
|
|
||||||
* [Array.every()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every).
|
|
||||||
*
|
|
||||||
* @param fn Function used to test (should return a boolean)
|
|
||||||
* @param thisArg Value to use as `this` when executing function
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* collection.every(user => !user.bot);
|
|
||||||
*/
|
|
||||||
every<K2 extends K>(fn: (value: V, key: K, collection: this) => key is K2): this is Collection<K2, V>;
|
|
||||||
every<V2 extends V>(fn: (value: V, key: K, collection: this) => value is V2): this is Collection<K, V2>;
|
|
||||||
every(fn: (value: V, key: K, collection: this) => boolean): boolean;
|
|
||||||
every<This, K2 extends K>(fn: (this: This, value: V, key: K, collection: this) => key is K2, thisArg: This): this is Collection<K2, V>;
|
|
||||||
every<This, V2 extends V>(fn: (this: This, value: V, key: K, collection: this) => value is V2, thisArg: This): this is Collection<K, V2>;
|
|
||||||
every<This>(fn: (this: This, value: V, key: K, collection: this) => boolean, thisArg: This): boolean;
|
|
||||||
/**
|
|
||||||
* Applies a function to produce a single value. Identical in behavior to
|
|
||||||
* [Array.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce).
|
|
||||||
*
|
|
||||||
* @param fn Function used to reduce, taking four arguments; `accumulator`, `currentValue`, `currentKey`,
|
|
||||||
* and `collection`
|
|
||||||
* @param initialValue Starting value for the accumulator
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* collection.reduce((acc, guild) => acc + guild.memberCount, 0);
|
|
||||||
*/
|
|
||||||
reduce<T>(fn: (accumulator: T, value: V, key: K, collection: this) => T, initialValue?: T): T;
|
|
||||||
/**
|
|
||||||
* Identical to
|
|
||||||
* [Map.forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/forEach),
|
|
||||||
* but returns the collection instead of undefined.
|
|
||||||
*
|
|
||||||
* @param fn Function to execute for each element
|
|
||||||
* @param thisArg Value to use as `this` when executing function
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* collection
|
|
||||||
* .each(user => console.log(user.username))
|
|
||||||
* .filter(user => user.bot)
|
|
||||||
* .each(user => console.log(user.username));
|
|
||||||
*/
|
|
||||||
each(fn: (value: V, key: K, collection: this) => void): this;
|
|
||||||
each<T>(fn: (this: T, value: V, key: K, collection: this) => void, thisArg: T): this;
|
|
||||||
/**
|
|
||||||
* Runs a function on the collection and returns the collection.
|
|
||||||
*
|
|
||||||
* @param fn Function to execute
|
|
||||||
* @param thisArg Value to use as `this` when executing function
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* collection
|
|
||||||
* .tap(coll => console.log(coll.size))
|
|
||||||
* .filter(user => user.bot)
|
|
||||||
* .tap(coll => console.log(coll.size))
|
|
||||||
*/
|
|
||||||
tap(fn: (collection: this) => void): this;
|
|
||||||
tap<T>(fn: (this: T, collection: this) => void, thisArg: T): this;
|
|
||||||
/**
|
|
||||||
* Creates an identical shallow copy of this collection.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* const newColl = someColl.clone();
|
|
||||||
*/
|
|
||||||
clone(): Collection<K, V>;
|
|
||||||
/**
|
|
||||||
* Combines this collection with others into a new collection. None of the source collections are modified.
|
|
||||||
*
|
|
||||||
* @param collections Collections to merge
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl);
|
|
||||||
*/
|
|
||||||
concat(...collections: Collection<K, V>[]): Collection<K, V>;
|
|
||||||
/**
|
|
||||||
* Checks if this collection shares identical items with another.
|
|
||||||
* This is different to checking for equality using equal-signs, because
|
|
||||||
* the collections may be different objects, but contain the same data.
|
|
||||||
*
|
|
||||||
* @param collection Collection to compare with
|
|
||||||
*
|
|
||||||
* @returns Whether the collections have identical contents
|
|
||||||
*/
|
|
||||||
equals(collection: Collection<K, V>): boolean;
|
|
||||||
/**
|
|
||||||
* The sort method sorts the items of a collection in place and returns it.
|
|
||||||
* The sort is not necessarily stable in Node 10 or older.
|
|
||||||
* The default sort order is according to string Unicode code points.
|
|
||||||
*
|
|
||||||
* @param compareFunction Specifies a function that defines the sort order.
|
|
||||||
* If omitted, the collection is sorted according to each character's Unicode code point value, according to the string conversion of each element.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* collection.sort((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);
|
|
||||||
*/
|
|
||||||
sort(compareFunction?: Comparator<K, V>): this;
|
|
||||||
/**
|
|
||||||
* The intersect method returns a new structure containing items where the keys are present in both original structures.
|
|
||||||
*
|
|
||||||
* @param other The other Collection to filter against
|
|
||||||
*/
|
|
||||||
intersect(other: Collection<K, V>): Collection<K, V>;
|
|
||||||
/**
|
|
||||||
* The difference method returns a new structure containing items where the key is present in one of the original structures but not the other.
|
|
||||||
*
|
|
||||||
* @param other The other Collection to filter against
|
|
||||||
*/
|
|
||||||
difference(other: Collection<K, V>): Collection<K, V>;
|
|
||||||
/**
|
|
||||||
* The sorted method sorts the items of a collection and returns it.
|
|
||||||
* The sort is not necessarily stable in Node 10 or older.
|
|
||||||
* The default sort order is according to string Unicode code points.
|
|
||||||
*
|
|
||||||
* @param compareFunction Specifies a function that defines the sort order.
|
|
||||||
* If omitted, the collection is sorted according to each character's Unicode code point value,
|
|
||||||
* according to the string conversion of each element.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* collection.sorted((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);
|
|
||||||
*/
|
|
||||||
sorted(compareFunction?: Comparator<K, V>): Collection<K, V>;
|
|
||||||
toJSON(): V[];
|
|
||||||
private static defaultSort;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
declare type Comparator<K, V> = (firstValue: V, secondValue: V, firstKey: K, secondKey: K) => number;
|
|
||||||
|
|
||||||
export { Collection, CollectionConstructor, Comparator, Collection as default };
|
|
2
node_modules/@discordjs/collection/dist/index.js
generated
vendored
2
node_modules/@discordjs/collection/dist/index.js
generated
vendored
|
@ -1,2 +0,0 @@
|
||||||
var s=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var b=(l,e,i)=>e in l?s(l,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):l[e]=i;var V=l=>s(l,"__esModule",{value:!0}),h=(l,e)=>s(l,"name",{value:e,configurable:!0});var d=(l,e)=>{for(var i in e)s(l,i,{get:e[i],enumerable:!0})},y=(l,e,i,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of K(e))!p.call(l,n)&&(i||n!=="default")&&s(l,n,{get:()=>e[n],enumerable:!(t=f(e,n))||t.enumerable});return l};var v=(l=>(e,i)=>l&&l.get(e)||(i=y(V({}),e,1),l&&l.set(e,i),i))(typeof WeakMap!="undefined"?new WeakMap:0);var a=(l,e,i)=>(b(l,typeof e!="symbol"?e+"":e,i),i);var T={};d(T,{Collection:()=>c,default:()=>k});var r=class extends Map{ensure(e,i){if(this.has(e))return this.get(e);let t=i(e,this);return this.set(e,t),t}hasAll(...e){return e.every(i=>super.has(i))}hasAny(...e){return e.some(i=>super.has(i))}first(e){if(typeof e=="undefined")return this.values().next().value;if(e<0)return this.last(e*-1);e=Math.min(this.size,e);let i=this.values();return Array.from({length:e},()=>i.next().value)}firstKey(e){if(typeof e=="undefined")return this.keys().next().value;if(e<0)return this.lastKey(e*-1);e=Math.min(this.size,e);let i=this.keys();return Array.from({length:e},()=>i.next().value)}last(e){let i=[...this.values()];return typeof e=="undefined"?i[i.length-1]:e<0?this.first(e*-1):e?i.slice(-e):[]}lastKey(e){let i=[...this.keys()];return typeof e=="undefined"?i[i.length-1]:e<0?this.firstKey(e*-1):e?i.slice(-e):[]}at(e){return e=Math.floor(e),[...this.values()].at(e)}keyAt(e){return e=Math.floor(e),[...this.keys()].at(e)}random(e){let i=[...this.values()];return typeof e=="undefined"?i[Math.floor(Math.random()*i.length)]:!i.length||!e?[]:Array.from({length:Math.min(e,i.length)},()=>i.splice(Math.floor(Math.random()*i.length),1)[0])}randomKey(e){let i=[...this.keys()];return typeof e=="undefined"?i[Math.floor(Math.random()*i.length)]:!i.length||!e?[]:Array.from({length:Math.min(e,i.length)},()=>i.splice(Math.floor(Math.random()*i.length),1)[0])}reverse(){let e=[...this.entries()].reverse();this.clear();for(let[i,t]of e)this.set(i,t);return this}find(e,i){typeof i!="undefined"&&(e=e.bind(i));for(let[t,n]of this)if(e(n,t,this))return n}findKey(e,i){typeof i!="undefined"&&(e=e.bind(i));for(let[t,n]of this)if(e(n,t,this))return t}sweep(e,i){typeof i!="undefined"&&(e=e.bind(i));let t=this.size;for(let[n,o]of this)e(o,n,this)&&this.delete(n);return t-this.size}filter(e,i){typeof i!="undefined"&&(e=e.bind(i));let t=new this.constructor[Symbol.species];for(let[n,o]of this)e(o,n,this)&&t.set(n,o);return t}partition(e,i){typeof i!="undefined"&&(e=e.bind(i));let t=[new this.constructor[Symbol.species],new this.constructor[Symbol.species]];for(let[n,o]of this)e(o,n,this)?t[0].set(n,o):t[1].set(n,o);return t}flatMap(e,i){let t=this.map(e,i);return new this.constructor[Symbol.species]().concat(...t)}map(e,i){typeof i!="undefined"&&(e=e.bind(i));let t=this.entries();return Array.from({length:this.size},()=>{let[n,o]=t.next().value;return e(o,n,this)})}mapValues(e,i){typeof i!="undefined"&&(e=e.bind(i));let t=new this.constructor[Symbol.species];for(let[n,o]of this)t.set(n,e(o,n,this));return t}some(e,i){typeof i!="undefined"&&(e=e.bind(i));for(let[t,n]of this)if(e(n,t,this))return!0;return!1}every(e,i){typeof i!="undefined"&&(e=e.bind(i));for(let[t,n]of this)if(!e(n,t,this))return!1;return!0}reduce(e,i){let t;if(typeof i!="undefined"){t=i;for(let[o,u]of this)t=e(t,u,o,this);return t}let n=!0;for(let[o,u]of this){if(n){t=u,n=!1;continue}t=e(t,u,o,this)}if(n)throw new TypeError("Reduce of empty collection with no initial value");return t}each(e,i){return this.forEach(e,i),this}tap(e,i){return typeof i!="undefined"&&(e=e.bind(i)),e(this),this}clone(){return new this.constructor[Symbol.species](this)}concat(...e){let i=this.clone();for(let t of e)for(let[n,o]of t)i.set(n,o);return i}equals(e){if(!e)return!1;if(this===e)return!0;if(this.size!==e.size)return!1;for(let[i,t]of this)if(!e.has(i)||t!==e.get(i))return!1;return!0}sort(e=r.defaultSort){let i=[...this.entries()];i.sort((t,n)=>e(t[1],n[1],t[0],n[0])),super.clear();for(let[t,n]of i)super.set(t,n);return this}intersect(e){let i=new this.constructor[Symbol.species];for(let[t,n]of e)this.has(t)&&i.set(t,n);return i}difference(e){let i=new this.constructor[Symbol.species];for(let[t,n]of e)this.has(t)||i.set(t,n);for(let[t,n]of this)e.has(t)||i.set(t,n);return i}sorted(e=r.defaultSort){return new this.constructor[Symbol.species](this).sort((i,t,n,o)=>e(i,t,n,o))}toJSON(){return[...this.values()]}static defaultSort(e,i){return Number(e>i)||Number(e===i)-1}},c=r;h(c,"Collection"),a(c,"default",r);var k=c;module.exports=v(T);0&&(module.exports={Collection});
|
|
||||||
//# sourceMappingURL=index.js.map
|
|
1
node_modules/@discordjs/collection/dist/index.js.map
generated
vendored
1
node_modules/@discordjs/collection/dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/@discordjs/collection/dist/index.mjs
generated
vendored
2
node_modules/@discordjs/collection/dist/index.mjs
generated
vendored
|
@ -1,2 +0,0 @@
|
||||||
var u=Object.defineProperty;var f=(o,e,i)=>e in o?u(o,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[e]=i;var h=(o,e)=>u(o,"name",{value:e,configurable:!0});var a=(o,e,i)=>(f(o,typeof e!="symbol"?e+"":e,i),i);var s=class extends Map{ensure(e,i){if(this.has(e))return this.get(e);let t=i(e,this);return this.set(e,t),t}hasAll(...e){return e.every(i=>super.has(i))}hasAny(...e){return e.some(i=>super.has(i))}first(e){if(typeof e=="undefined")return this.values().next().value;if(e<0)return this.last(e*-1);e=Math.min(this.size,e);let i=this.values();return Array.from({length:e},()=>i.next().value)}firstKey(e){if(typeof e=="undefined")return this.keys().next().value;if(e<0)return this.lastKey(e*-1);e=Math.min(this.size,e);let i=this.keys();return Array.from({length:e},()=>i.next().value)}last(e){let i=[...this.values()];return typeof e=="undefined"?i[i.length-1]:e<0?this.first(e*-1):e?i.slice(-e):[]}lastKey(e){let i=[...this.keys()];return typeof e=="undefined"?i[i.length-1]:e<0?this.firstKey(e*-1):e?i.slice(-e):[]}at(e){return e=Math.floor(e),[...this.values()].at(e)}keyAt(e){return e=Math.floor(e),[...this.keys()].at(e)}random(e){let i=[...this.values()];return typeof e=="undefined"?i[Math.floor(Math.random()*i.length)]:!i.length||!e?[]:Array.from({length:Math.min(e,i.length)},()=>i.splice(Math.floor(Math.random()*i.length),1)[0])}randomKey(e){let i=[...this.keys()];return typeof e=="undefined"?i[Math.floor(Math.random()*i.length)]:!i.length||!e?[]:Array.from({length:Math.min(e,i.length)},()=>i.splice(Math.floor(Math.random()*i.length),1)[0])}reverse(){let e=[...this.entries()].reverse();this.clear();for(let[i,t]of e)this.set(i,t);return this}find(e,i){typeof i!="undefined"&&(e=e.bind(i));for(let[t,n]of this)if(e(n,t,this))return n}findKey(e,i){typeof i!="undefined"&&(e=e.bind(i));for(let[t,n]of this)if(e(n,t,this))return t}sweep(e,i){typeof i!="undefined"&&(e=e.bind(i));let t=this.size;for(let[n,l]of this)e(l,n,this)&&this.delete(n);return t-this.size}filter(e,i){typeof i!="undefined"&&(e=e.bind(i));let t=new this.constructor[Symbol.species];for(let[n,l]of this)e(l,n,this)&&t.set(n,l);return t}partition(e,i){typeof i!="undefined"&&(e=e.bind(i));let t=[new this.constructor[Symbol.species],new this.constructor[Symbol.species]];for(let[n,l]of this)e(l,n,this)?t[0].set(n,l):t[1].set(n,l);return t}flatMap(e,i){let t=this.map(e,i);return new this.constructor[Symbol.species]().concat(...t)}map(e,i){typeof i!="undefined"&&(e=e.bind(i));let t=this.entries();return Array.from({length:this.size},()=>{let[n,l]=t.next().value;return e(l,n,this)})}mapValues(e,i){typeof i!="undefined"&&(e=e.bind(i));let t=new this.constructor[Symbol.species];for(let[n,l]of this)t.set(n,e(l,n,this));return t}some(e,i){typeof i!="undefined"&&(e=e.bind(i));for(let[t,n]of this)if(e(n,t,this))return!0;return!1}every(e,i){typeof i!="undefined"&&(e=e.bind(i));for(let[t,n]of this)if(!e(n,t,this))return!1;return!0}reduce(e,i){let t;if(typeof i!="undefined"){t=i;for(let[l,c]of this)t=e(t,c,l,this);return t}let n=!0;for(let[l,c]of this){if(n){t=c,n=!1;continue}t=e(t,c,l,this)}if(n)throw new TypeError("Reduce of empty collection with no initial value");return t}each(e,i){return this.forEach(e,i),this}tap(e,i){return typeof i!="undefined"&&(e=e.bind(i)),e(this),this}clone(){return new this.constructor[Symbol.species](this)}concat(...e){let i=this.clone();for(let t of e)for(let[n,l]of t)i.set(n,l);return i}equals(e){if(!e)return!1;if(this===e)return!0;if(this.size!==e.size)return!1;for(let[i,t]of this)if(!e.has(i)||t!==e.get(i))return!1;return!0}sort(e=s.defaultSort){let i=[...this.entries()];i.sort((t,n)=>e(t[1],n[1],t[0],n[0])),super.clear();for(let[t,n]of i)super.set(t,n);return this}intersect(e){let i=new this.constructor[Symbol.species];for(let[t,n]of e)this.has(t)&&i.set(t,n);return i}difference(e){let i=new this.constructor[Symbol.species];for(let[t,n]of e)this.has(t)||i.set(t,n);for(let[t,n]of this)e.has(t)||i.set(t,n);return i}sorted(e=s.defaultSort){return new this.constructor[Symbol.species](this).sort((i,t,n,l)=>e(i,t,n,l))}toJSON(){return[...this.values()]}static defaultSort(e,i){return Number(e>i)||Number(e===i)-1}},r=s;h(r,"Collection"),a(r,"default",s);var V=r;export{r as Collection,V as default};
|
|
||||||
//# sourceMappingURL=index.mjs.map
|
|
1
node_modules/@discordjs/collection/dist/index.mjs.map
generated
vendored
1
node_modules/@discordjs/collection/dist/index.mjs.map
generated
vendored
File diff suppressed because one or more lines are too long
85
node_modules/@discordjs/collection/package.json
generated
vendored
85
node_modules/@discordjs/collection/package.json
generated
vendored
|
@ -1,85 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@discordjs/collection",
|
|
||||||
"version": "0.4.0",
|
|
||||||
"description": "Utility data structure used in Discord.js",
|
|
||||||
"scripts": {
|
|
||||||
"pretest": "npm run build",
|
|
||||||
"test": "jest --pass-with-no-tests",
|
|
||||||
"test:ci": "jest --no-stack-trace --verbose --pass-with-no-tests",
|
|
||||||
"prebuild": "npm run lint",
|
|
||||||
"build": "tsup",
|
|
||||||
"lint": "eslint src --ext mjs,js,ts",
|
|
||||||
"lint:fix": "eslint src --ext mjs,js,ts --fix",
|
|
||||||
"format": "prettier --write **/*.{ts,js,json,yml,yaml}",
|
|
||||||
"prepare": "is-ci || husky install",
|
|
||||||
"docs": "typedoc --json docs/typedoc-out.json src/index.ts && node scripts/docs.mjs",
|
|
||||||
"prepublishOnly": "npm run lint && npm run test",
|
|
||||||
"release": "standard-version --preset angular"
|
|
||||||
},
|
|
||||||
"main": "./dist/index.js",
|
|
||||||
"module": "./dist/index.mjs",
|
|
||||||
"typings": "./dist/index.d.ts",
|
|
||||||
"exports": {
|
|
||||||
"import": "./dist/index.mjs",
|
|
||||||
"require": "./dist/index.js"
|
|
||||||
},
|
|
||||||
"directories": {
|
|
||||||
"lib": "src",
|
|
||||||
"test": "__tests__"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"dist"
|
|
||||||
],
|
|
||||||
"contributors": [
|
|
||||||
"Crawl <icrawltogo@gmail.com>",
|
|
||||||
"Amish Shah <amishshah.2k@gmail.com>",
|
|
||||||
"SpaceEEC <spaceeec@yahoo.com>",
|
|
||||||
"Vlad Frangu <kingdgrizzle@gmail.com>"
|
|
||||||
],
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"keywords": [
|
|
||||||
"map",
|
|
||||||
"collection",
|
|
||||||
"utility"
|
|
||||||
],
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/discordjs/collection.git"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/discordjs/collection/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/discordjs/collection",
|
|
||||||
"devDependencies": {
|
|
||||||
"@babel/core": "^7.16.5",
|
|
||||||
"@babel/preset-env": "^7.16.5",
|
|
||||||
"@babel/preset-typescript": "^7.16.5",
|
|
||||||
"@commitlint/cli": "^15.0.0",
|
|
||||||
"@commitlint/config-angular": "^15.0.0",
|
|
||||||
"@discordjs/ts-docgen": "^0.3.4",
|
|
||||||
"@types/jest": "^27.0.3",
|
|
||||||
"@types/node": "^16.11.6",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^5.8.0",
|
|
||||||
"@typescript-eslint/parser": "^5.8.0",
|
|
||||||
"eslint": "^8.5.0",
|
|
||||||
"eslint-config-marine": "^9.1.0",
|
|
||||||
"eslint-config-prettier": "^8.3.0",
|
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
|
||||||
"husky": "^7.0.4",
|
|
||||||
"is-ci": "^3.0.1",
|
|
||||||
"jest": "^27.4.5",
|
|
||||||
"lint-staged": "^12.1.4",
|
|
||||||
"prettier": "^2.5.1",
|
|
||||||
"standard-version": "^9.3.2",
|
|
||||||
"tsup": "^5.11.8",
|
|
||||||
"typedoc": "^0.22.10",
|
|
||||||
"typescript": "^4.5.4"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=16.0.0",
|
|
||||||
"npm": ">=7.0.0"
|
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
}
|
|
||||||
}
|
|
68
node_modules/@discordjs/rest/CHANGELOG.md
generated
vendored
68
node_modules/@discordjs/rest/CHANGELOG.md
generated
vendored
|
@ -1,68 +0,0 @@
|
||||||
# Changelog
|
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
|
||||||
|
|
||||||
# [0.3.0](https://github.com/discordjs/discord.js/compare/@discordjs/rest@0.2.0...@discordjs/rest@0.3.0) (2021-12-08)
|
|
||||||
|
|
||||||
## Bug Fixes
|
|
||||||
|
|
||||||
- **rest:** Don't add empty query (#7308) ([d0fa5aa](https://github.com/discordjs/discord.js/commit/d0fa5aaa26d316608120bca3050e14eefbe2f93b))
|
|
||||||
- **rest:** Use http agent when protocol is not https (#7309) ([d8ea572](https://github.com/discordjs/discord.js/commit/d8ea572fb8a51f2f6a902c4926e814017d115708))
|
|
||||||
- `ref` delay for rate limited requests (#7239) ([ed0cfd9](https://github.com/discordjs/discord.js/commit/ed0cfd91edc3a2b23a34a8ecd9db38baa12b52fa))
|
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
- Fix a typo and use milliseconds instead of ms (#7251) ([0dd56af](https://github.com/discordjs/discord.js/commit/0dd56afe1cdf16f1e7d9afe1f8c29c31d1833a25))
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- Rest hash and handler sweeping (#7255) ([3bb4829](https://github.com/discordjs/discord.js/commit/3bb48298004d292214c6cb8f927c2fea78a42952))
|
|
||||||
- Rest docs (#7281) ([9054f2f](https://github.com/discordjs/discord.js/commit/9054f2f7ad7f246431e5f53403535bf301c27a80))
|
|
||||||
|
|
||||||
## Refactor
|
|
||||||
|
|
||||||
- **files:** File data can be much more than buffer (#7238) ([86ab526](https://github.com/discordjs/discord.js/commit/86ab526d493415b14b79b51d08c3677897d219ee))
|
|
||||||
- **rest:** Rename attachment to file (#7199) ([c969cbf](https://github.com/discordjs/discord.js/commit/c969cbf6524093757d47108b6a55e62dcb210e8b))
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
- **voice:** Fix tests ([62c74b8](https://github.com/discordjs/discord.js/commit/62c74b8333066465e5bd295b8b102b35a506751d))
|
|
||||||
|
|
||||||
# [0.2.0-canary.0](https://github.com/discordjs/discord.js-modules/compare/@discordjs/rest@0.1.1-canary.0...@discordjs/rest@0.2.0-canary.0) (2021-12-08)
|
|
||||||
|
|
||||||
## Bug Fixes
|
|
||||||
|
|
||||||
- **CDN#icon:** remove `guild` prefixes ([#67](https://github.com/discordjs/discord.js-modules/issues/67)) ([8882686](https://github.com/discordjs/discord.js-modules/commit/88826869d8ed3695f2b9475bea8d3b851df270bd))
|
|
||||||
- **Cdn:** make parameters immutable ([#84](https://github.com/discordjs/discord.js-modules/issues/84)) ([3105b61](https://github.com/discordjs/discord.js-modules/commit/3105b614da603dd3c8479dea089b5953d3c8b89b))
|
|
||||||
- **CDN:** use correct types ([#86](https://github.com/discordjs/discord.js-modules/issues/86)) ([64b02d4](https://github.com/discordjs/discord.js-modules/commit/64b02d4649a38802dd1a4e7a738ec64c27dea760))
|
|
||||||
- **Rest:** lint errors ([53c0cce](https://github.com/discordjs/discord.js-modules/commit/53c0ccefee80225ca7640cf88f44c68da99f31e7))
|
|
||||||
- use hash instead of animatedHash for default avatar test ([#74](https://github.com/discordjs/discord.js-modules/issues/74)) ([4852838](https://github.com/discordjs/discord.js-modules/commit/485283824cf368874096d59a64131970401218e9))
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- **CDN#guildIcon:** implement dynamic logic ([#53](https://github.com/discordjs/discord.js-modules/issues/53)) ([c4b2803](https://github.com/discordjs/discord.js-modules/commit/c4b280366b0c5920c147126ccb9068f16fc898aa))
|
|
||||||
- **CDN:** add role icon endpoint ([#64](https://github.com/discordjs/discord.js-modules/issues/64)) ([4d7d692](https://github.com/discordjs/discord.js-modules/commit/4d7d692b4954c373941d2d8f3e3335a9a8543220))
|
|
||||||
- **CDN:** add sticker endpoints ([#60](https://github.com/discordjs/discord.js-modules/issues/60)) ([3b714ba](https://github.com/discordjs/discord.js-modules/commit/3b714bada415a7987dd6aa50c938751c66dc05be))
|
|
||||||
- **CDN:** guild member avatars ([#68](https://github.com/discordjs/discord.js-modules/issues/68)) ([90c25ad](https://github.com/discordjs/discord.js-modules/commit/90c25ad4afa5ec5906867f431afcaf11fb56355a))
|
|
||||||
- **Errors:** show data sent when an error occurs ([#72](https://github.com/discordjs/discord.js-modules/issues/72)) ([3e2edc8](https://github.com/discordjs/discord.js-modules/commit/3e2edc8974e2c62c324db0c151da4d34c289c40a))
|
|
||||||
- expose https agent options ([#82](https://github.com/discordjs/discord.js-modules/issues/82)) ([7f1c9be](https://github.com/discordjs/discord.js-modules/commit/7f1c9be817bbc6a4a11a726c952580dd3cb7b149))
|
|
||||||
- **RateLimits:** optionally error on ratelimits ([#77](https://github.com/discordjs/discord.js-modules/issues/77)) ([a371f0b](https://github.com/discordjs/discord.js-modules/commit/a371f0bc6c76cffaf048fd0fbf9c64a6c4d6619e))
|
|
||||||
- **RequestManager:** support setting global headers in options ([#70](https://github.com/discordjs/discord.js-modules/issues/70)) ([d1758c7](https://github.com/discordjs/discord.js-modules/commit/d1758c74b00a3f83c39745cd9af147a7f8f2b12b))
|
|
||||||
- **Requests:** add attachment keys and form data for stickers ([#81](https://github.com/discordjs/discord.js-modules/issues/81)) ([7c2b0c0](https://github.com/discordjs/discord.js-modules/commit/7c2b0c0e432b82776bb57c1708f3be6b4affde56))
|
|
||||||
- **Rest:** add response and request events ([#85](https://github.com/discordjs/discord.js-modules/issues/85)) ([c3aba56](https://github.com/discordjs/discord.js-modules/commit/c3aba567572e73548c38cd7c7f9945e9361833de))
|
|
||||||
- **REST:** change api version to v9 ([#62](https://github.com/discordjs/discord.js-modules/issues/62)) ([4c980e6](https://github.com/discordjs/discord.js-modules/commit/4c980e6ad6c0297519ec0f09ec27953764a4a12d))
|
|
||||||
- **Rest:** improve global rate limit and invalid request tracking ([#51](https://github.com/discordjs/discord.js-modules/issues/51)) ([b73cc06](https://github.com/discordjs/discord.js-modules/commit/b73cc060daa701de71815a824ebaccdc9ebf2859))
|
|
||||||
- **Rest:** use native Node.js AbortController ([#66](https://github.com/discordjs/discord.js-modules/issues/66)) ([3b53910](https://github.com/discordjs/discord.js-modules/commit/3b539102f07c413ffd3ee60718ac8e5a709bdd0e))
|
|
||||||
- **SequentialHandler:** add more info to debug when rate limit was hit ([#78](https://github.com/discordjs/discord.js-modules/issues/78)) ([a4e404b](https://github.com/discordjs/discord.js-modules/commit/a4e404b2e6df625a48176b9f1bfac6cfe86c5d66))
|
|
||||||
|
|
||||||
# [0.1.1-canary.0](https://github.com/discordjs/discord.js-modules/compare/@discordjs/rest@0.1.0-canary.0...@discordjs/rest@0.1.1-canary.0) (2021-08-24)
|
|
||||||
|
|
||||||
## Bug Fixes
|
|
||||||
|
|
||||||
- **Rest:** use reference type for DOM ([#55](https://github.com/discordjs/discord.js-modules/issues/55)) ([07f5aa7](https://github.com/discordjs/discord.js-modules/commit/07f5aa744092c16b0f05b05055e5d4bbd49754e7))
|
|
||||||
|
|
||||||
# 0.1.0-canary.0 (2021-06-29)
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- **rest:** Implement rest module ([#34](https://github.com/discordjs/discord.js-modules/issues/34)) ([6990f0f](https://github.com/discordjs/discord.js-modules/commit/6990f0f7f3ca958a95f9b1b19681b42669743427))
|
|
192
node_modules/@discordjs/rest/LICENSE
generated
vendored
192
node_modules/@discordjs/rest/LICENSE
generated
vendored
|
@ -1,192 +0,0 @@
|
||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
Copyright 2021 Noel Buechler
|
|
||||||
Copyright 2021 Antonio Román
|
|
||||||
Copyright 2021 Vlad Frangu
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
3
node_modules/@discordjs/rest/README.md
generated
vendored
3
node_modules/@discordjs/rest/README.md
generated
vendored
|
@ -1,3 +0,0 @@
|
||||||
# `@discordjs/rest`
|
|
||||||
|
|
||||||
> The REST API module for Discord.js
|
|
8
node_modules/@discordjs/rest/dist/index.d.ts
generated
vendored
8
node_modules/@discordjs/rest/dist/index.d.ts
generated
vendored
|
@ -1,8 +0,0 @@
|
||||||
/// <reference lib="dom" />
|
|
||||||
export * from './lib/CDN';
|
|
||||||
export * from './lib/errors/DiscordAPIError';
|
|
||||||
export * from './lib/errors/HTTPError';
|
|
||||||
export * from './lib/errors/RateLimitError';
|
|
||||||
export * from './lib/RequestManager';
|
|
||||||
export * from './lib/REST';
|
|
||||||
export * from './lib/utils/constants';
|
|
8
node_modules/@discordjs/rest/dist/index.js
generated
vendored
8
node_modules/@discordjs/rest/dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
1
node_modules/@discordjs/rest/dist/index.js.map
generated
vendored
1
node_modules/@discordjs/rest/dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
8
node_modules/@discordjs/rest/dist/index.mjs
generated
vendored
8
node_modules/@discordjs/rest/dist/index.mjs
generated
vendored
File diff suppressed because one or more lines are too long
1
node_modules/@discordjs/rest/dist/index.mjs.map
generated
vendored
1
node_modules/@discordjs/rest/dist/index.mjs.map
generated
vendored
File diff suppressed because one or more lines are too long
163
node_modules/@discordjs/rest/dist/lib/CDN.d.ts
generated
vendored
163
node_modules/@discordjs/rest/dist/lib/CDN.d.ts
generated
vendored
|
@ -1,163 +0,0 @@
|
||||||
import { ImageExtension, ImageSize, StickerExtension } from './utils/constants';
|
|
||||||
/**
|
|
||||||
* The options used for image URLs
|
|
||||||
*/
|
|
||||||
export interface BaseImageURLOptions {
|
|
||||||
/**
|
|
||||||
* The extension to use for the image URL
|
|
||||||
* @default 'webp'
|
|
||||||
*/
|
|
||||||
extension?: ImageExtension;
|
|
||||||
/**
|
|
||||||
* The size specified in the image URL
|
|
||||||
*/
|
|
||||||
size?: ImageSize;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* The options used for image URLs with animated content
|
|
||||||
*/
|
|
||||||
export interface ImageURLOptions extends BaseImageURLOptions {
|
|
||||||
/**
|
|
||||||
* Whether or not to prefer the static version of an image asset.
|
|
||||||
*/
|
|
||||||
forceStatic?: boolean;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* The options to use when making a CDN URL
|
|
||||||
*/
|
|
||||||
export interface MakeURLOptions {
|
|
||||||
/**
|
|
||||||
* The extension to use for the image URL
|
|
||||||
* @default 'webp'
|
|
||||||
*/
|
|
||||||
extension?: string | undefined;
|
|
||||||
/**
|
|
||||||
* The size specified in the image URL
|
|
||||||
*/
|
|
||||||
size?: ImageSize;
|
|
||||||
/**
|
|
||||||
* The allowed extensions that can be used
|
|
||||||
*/
|
|
||||||
allowedExtensions?: ReadonlyArray<string>;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* The CDN link builder
|
|
||||||
*/
|
|
||||||
export declare class CDN {
|
|
||||||
private readonly base;
|
|
||||||
constructor(base?: string);
|
|
||||||
/**
|
|
||||||
* Generates an app asset URL for a client's asset.
|
|
||||||
* @param clientId The client id that has the asset
|
|
||||||
* @param assetHash The hash provided by Discord for this asset
|
|
||||||
* @param options Optional options for the asset
|
|
||||||
*/
|
|
||||||
appAsset(clientId: string, assetHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
||||||
/**
|
|
||||||
* Generates an app icon URL for a client's icon.
|
|
||||||
* @param clientId The client id that has the icon
|
|
||||||
* @param iconHash The hash provided by Discord for this icon
|
|
||||||
* @param options Optional options for the icon
|
|
||||||
*/
|
|
||||||
appIcon(clientId: string, iconHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
||||||
/**
|
|
||||||
* Generates an avatar URL, e.g. for a user or a webhook.
|
|
||||||
* @param id The id that has the icon
|
|
||||||
* @param avatarHash The hash provided by Discord for this avatar
|
|
||||||
* @param options Optional options for the avatar
|
|
||||||
*/
|
|
||||||
avatar(id: string, avatarHash: string, options?: Readonly<ImageURLOptions>): string;
|
|
||||||
/**
|
|
||||||
* Generates a banner URL, e.g. for a user or a guild.
|
|
||||||
* @param id The id that has the banner splash
|
|
||||||
* @param bannerHash The hash provided by Discord for this banner
|
|
||||||
* @param options Optional options for the banner
|
|
||||||
*/
|
|
||||||
banner(id: string, bannerHash: string, options?: Readonly<ImageURLOptions>): string;
|
|
||||||
/**
|
|
||||||
* Generates an icon URL for a channel, e.g. a group DM.
|
|
||||||
* @param channelId The channel id that has the icon
|
|
||||||
* @param iconHash The hash provided by Discord for this channel
|
|
||||||
* @param options Optional options for the icon
|
|
||||||
*/
|
|
||||||
channelIcon(channelId: string, iconHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
||||||
/**
|
|
||||||
* Generates the default avatar URL for a discriminator.
|
|
||||||
* @param discriminator The discriminator modulo 5
|
|
||||||
*/
|
|
||||||
defaultAvatar(discriminator: number): string;
|
|
||||||
/**
|
|
||||||
* Generates a discovery splash URL for a guild's discovery splash.
|
|
||||||
* @param guildId The guild id that has the discovery splash
|
|
||||||
* @param splashHash The hash provided by Discord for this splash
|
|
||||||
* @param options Optional options for the splash
|
|
||||||
*/
|
|
||||||
discoverySplash(guildId: string, splashHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
||||||
/**
|
|
||||||
* Generates an emoji's URL for an emoji.
|
|
||||||
* @param emojiId The emoji id
|
|
||||||
* @param extension The extension of the emoji
|
|
||||||
*/
|
|
||||||
emoji(emojiId: string, extension?: ImageExtension): string;
|
|
||||||
/**
|
|
||||||
* Generates a guild member avatar URL.
|
|
||||||
* @param guildId The id of the guild
|
|
||||||
* @param userId The id of the user
|
|
||||||
* @param avatarHash The hash provided by Discord for this avatar
|
|
||||||
* @param options Optional options for the avatar
|
|
||||||
*/
|
|
||||||
guildMemberAvatar(guildId: string, userId: string, avatarHash: string, options?: Readonly<ImageURLOptions>): string;
|
|
||||||
/**
|
|
||||||
* Generates an icon URL, e.g. for a guild.
|
|
||||||
* @param id The id that has the icon splash
|
|
||||||
* @param iconHash The hash provided by Discord for this icon
|
|
||||||
* @param options Optional options for the icon
|
|
||||||
*/
|
|
||||||
icon(id: string, iconHash: string, options?: Readonly<ImageURLOptions>): string;
|
|
||||||
/**
|
|
||||||
* Generates a URL for the icon of a role
|
|
||||||
* @param roleId The id of the role that has the icon
|
|
||||||
* @param roleIconHash The hash provided by Discord for this role icon
|
|
||||||
* @param options Optional options for the role icon
|
|
||||||
*/
|
|
||||||
roleIcon(roleId: string, roleIconHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
||||||
/**
|
|
||||||
* Generates a guild invite splash URL for a guild's invite splash.
|
|
||||||
* @param guildId The guild id that has the invite splash
|
|
||||||
* @param splashHash The hash provided by Discord for this splash
|
|
||||||
* @param options Optional options for the splash
|
|
||||||
*/
|
|
||||||
splash(guildId: string, splashHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
||||||
/**
|
|
||||||
* Generates a sticker URL.
|
|
||||||
* @param stickerId The sticker id
|
|
||||||
* @param extension The extension of the sticker
|
|
||||||
*/
|
|
||||||
sticker(stickerId: string, extension?: StickerExtension): string;
|
|
||||||
/**
|
|
||||||
* Generates a sticker pack banner URL.
|
|
||||||
* @param bannerId The banner id
|
|
||||||
* @param options Optional options for the banner
|
|
||||||
*/
|
|
||||||
stickerPackBanner(bannerId: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
||||||
/**
|
|
||||||
* Generates a team icon URL for a team's icon.
|
|
||||||
* @param teamId The team id that has the icon
|
|
||||||
* @param iconHash The hash provided by Discord for this icon
|
|
||||||
* @param options Optional options for the icon
|
|
||||||
*/
|
|
||||||
teamIcon(teamId: string, iconHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
||||||
/**
|
|
||||||
* Constructs the URL for the resource, checking whether or not `hash` starts with `a_` if `dynamic` is set to `true`.
|
|
||||||
* @param route The base cdn route
|
|
||||||
* @param hash The hash provided by Discord for this icon
|
|
||||||
* @param options Optional options for the link
|
|
||||||
*/
|
|
||||||
private dynamicMakeURL;
|
|
||||||
/**
|
|
||||||
* Constructs the URL for the resource
|
|
||||||
* @param route The base cdn route
|
|
||||||
* @param options The extension/size options for the link
|
|
||||||
*/
|
|
||||||
private makeURL;
|
|
||||||
}
|
|
237
node_modules/@discordjs/rest/dist/lib/REST.d.ts
generated
vendored
237
node_modules/@discordjs/rest/dist/lib/REST.d.ts
generated
vendored
|
@ -1,237 +0,0 @@
|
||||||
/// <reference types="node" />
|
|
||||||
import { EventEmitter } from 'node:events';
|
|
||||||
import { CDN } from './CDN';
|
|
||||||
import { InternalRequest, RequestData, RequestManager, RouteLike } from './RequestManager';
|
|
||||||
import type { AgentOptions } from 'node:https';
|
|
||||||
import type { RequestInit, Response } from 'node-fetch';
|
|
||||||
import type { HashData } from './RequestManager';
|
|
||||||
import type Collection from '@discordjs/collection';
|
|
||||||
import type { IHandler } from './handlers/IHandler';
|
|
||||||
/**
|
|
||||||
* Options to be passed when creating the REST instance
|
|
||||||
*/
|
|
||||||
export interface RESTOptions {
|
|
||||||
/**
|
|
||||||
* HTTPS Agent options
|
|
||||||
* @default {}
|
|
||||||
*/
|
|
||||||
agent: Omit<AgentOptions, 'keepAlive'>;
|
|
||||||
/**
|
|
||||||
* The base api path, without version
|
|
||||||
* @default 'https://discord.com/api'
|
|
||||||
*/
|
|
||||||
api: string;
|
|
||||||
/**
|
|
||||||
* The cdn path
|
|
||||||
* @default 'https://cdn.discordapp.com'
|
|
||||||
*/
|
|
||||||
cdn: string;
|
|
||||||
/**
|
|
||||||
* Additional headers to send for all API requests
|
|
||||||
* @default {}
|
|
||||||
*/
|
|
||||||
headers: Record<string, string>;
|
|
||||||
/**
|
|
||||||
* The number of invalid REST requests (those that return 401, 403, or 429) in a 10 minute window between emitted warnings (0 for no warnings).
|
|
||||||
* That is, if set to 500, warnings will be emitted at invalid request number 500, 1000, 1500, and so on.
|
|
||||||
* @default 0
|
|
||||||
*/
|
|
||||||
invalidRequestWarningInterval: number;
|
|
||||||
/**
|
|
||||||
* How many requests to allow sending per second (Infinity for unlimited, 50 for the standard global limit used by Discord)
|
|
||||||
* @default 50
|
|
||||||
*/
|
|
||||||
globalRequestsPerSecond: number;
|
|
||||||
/**
|
|
||||||
* The extra offset to add to rate limits in milliseconds
|
|
||||||
* @default 50
|
|
||||||
*/
|
|
||||||
offset: number;
|
|
||||||
/**
|
|
||||||
* Determines how rate limiting and pre-emptive throttling should be handled.
|
|
||||||
* When an array of strings, each element is treated as a prefix for the request route
|
|
||||||
* (e.g. `/channels` to match any route starting with `/channels` such as `/channels/:id/messages`)
|
|
||||||
* for which to throw {@link RateLimitError}s. All other request routes will be queued normally
|
|
||||||
* @default null
|
|
||||||
*/
|
|
||||||
rejectOnRateLimit: string[] | RateLimitQueueFilter | null;
|
|
||||||
/**
|
|
||||||
* The number of retries for errors with the 500 code, or errors
|
|
||||||
* that timeout
|
|
||||||
* @default 3
|
|
||||||
*/
|
|
||||||
retries: number;
|
|
||||||
/**
|
|
||||||
* The time to wait in milliseconds before a request is aborted
|
|
||||||
* @default 15_000
|
|
||||||
*/
|
|
||||||
timeout: number;
|
|
||||||
/**
|
|
||||||
* Extra information to add to the user agent
|
|
||||||
* @default `Node.js ${process.version}`
|
|
||||||
*/
|
|
||||||
userAgentAppendix: string;
|
|
||||||
/**
|
|
||||||
* The version of the API to use
|
|
||||||
* @default '9'
|
|
||||||
*/
|
|
||||||
version: string;
|
|
||||||
/**
|
|
||||||
* The amount of time in milliseconds that passes between each hash sweep. (defaults to 4h)
|
|
||||||
* @default 14_400_000
|
|
||||||
*/
|
|
||||||
hashSweepInterval: number;
|
|
||||||
/**
|
|
||||||
* The maximum amount of time a hash can exist in milliseconds without being hit with a request (defaults to 24h)
|
|
||||||
* @default 86_400_000
|
|
||||||
*/
|
|
||||||
hashLifetime: number;
|
|
||||||
/**
|
|
||||||
* The amount of time in milliseconds that passes between each hash sweep. (defaults to 1h)
|
|
||||||
* @default 3_600_000
|
|
||||||
*/
|
|
||||||
handlerSweepInterval: number;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Data emitted on `RESTEvents.RateLimited`
|
|
||||||
*/
|
|
||||||
export interface RateLimitData {
|
|
||||||
/**
|
|
||||||
* The time, in milliseconds, until the request-lock is reset
|
|
||||||
*/
|
|
||||||
timeToReset: number;
|
|
||||||
/**
|
|
||||||
* The amount of requests we can perform before locking requests
|
|
||||||
*/
|
|
||||||
limit: number;
|
|
||||||
/**
|
|
||||||
* The HTTP method being performed
|
|
||||||
*/
|
|
||||||
method: string;
|
|
||||||
/**
|
|
||||||
* The bucket hash for this request
|
|
||||||
*/
|
|
||||||
hash: string;
|
|
||||||
/**
|
|
||||||
* The full URL for this request
|
|
||||||
*/
|
|
||||||
url: string;
|
|
||||||
/**
|
|
||||||
* The route being hit in this request
|
|
||||||
*/
|
|
||||||
route: string;
|
|
||||||
/**
|
|
||||||
* The major parameter of the route
|
|
||||||
*
|
|
||||||
* For example, in `/channels/x`, this will be `x`.
|
|
||||||
* If there is no major parameter (e.g: `/bot/gateway`) this will be `global`.
|
|
||||||
*/
|
|
||||||
majorParameter: string;
|
|
||||||
/**
|
|
||||||
* Whether the rate limit that was reached was the global limit
|
|
||||||
*/
|
|
||||||
global: boolean;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* A function that determines whether the rate limit hit should throw an Error
|
|
||||||
*/
|
|
||||||
export declare type RateLimitQueueFilter = (rateLimitData: RateLimitData) => boolean | Promise<boolean>;
|
|
||||||
export interface APIRequest {
|
|
||||||
/**
|
|
||||||
* The HTTP method used in this request
|
|
||||||
*/
|
|
||||||
method: string;
|
|
||||||
/**
|
|
||||||
* The full path used to make the request
|
|
||||||
*/
|
|
||||||
path: RouteLike;
|
|
||||||
/**
|
|
||||||
* The API route identifying the ratelimit for this request
|
|
||||||
*/
|
|
||||||
route: string;
|
|
||||||
/**
|
|
||||||
* Additional HTTP options for this request
|
|
||||||
*/
|
|
||||||
options: RequestInit;
|
|
||||||
/**
|
|
||||||
* The data that was used to form the body of this request
|
|
||||||
*/
|
|
||||||
data: Pick<InternalRequest, 'files' | 'body'>;
|
|
||||||
/**
|
|
||||||
* The number of times this request has been attempted
|
|
||||||
*/
|
|
||||||
retries: number;
|
|
||||||
}
|
|
||||||
export interface InvalidRequestWarningData {
|
|
||||||
/**
|
|
||||||
* Number of invalid requests that have been made in the window
|
|
||||||
*/
|
|
||||||
count: number;
|
|
||||||
/**
|
|
||||||
* Time in milliseconds remaining before the count resets
|
|
||||||
*/
|
|
||||||
remainingTime: number;
|
|
||||||
}
|
|
||||||
export interface RestEvents {
|
|
||||||
invalidRequestWarning: [invalidRequestInfo: InvalidRequestWarningData];
|
|
||||||
restDebug: [info: string];
|
|
||||||
rateLimited: [rateLimitInfo: RateLimitData];
|
|
||||||
request: [request: APIRequest];
|
|
||||||
response: [request: APIRequest, response: Response];
|
|
||||||
newListener: [name: string, listener: (...args: any) => void];
|
|
||||||
removeListener: [name: string, listener: (...args: any) => void];
|
|
||||||
hashSweep: [sweptHashes: Collection<string, HashData>];
|
|
||||||
handlerSweep: [sweptHandlers: Collection<string, IHandler>];
|
|
||||||
}
|
|
||||||
export interface REST {
|
|
||||||
on: (<K extends keyof RestEvents>(event: K, listener: (...args: RestEvents[K]) => void) => this) & (<S extends string | symbol>(event: Exclude<S, keyof RestEvents>, listener: (...args: any[]) => void) => this);
|
|
||||||
once: (<K extends keyof RestEvents>(event: K, listener: (...args: RestEvents[K]) => void) => this) & (<S extends string | symbol>(event: Exclude<S, keyof RestEvents>, listener: (...args: any[]) => void) => this);
|
|
||||||
emit: (<K extends keyof RestEvents>(event: K, ...args: RestEvents[K]) => boolean) & (<S extends string | symbol>(event: Exclude<S, keyof RestEvents>, ...args: any[]) => boolean);
|
|
||||||
off: (<K extends keyof RestEvents>(event: K, listener: (...args: RestEvents[K]) => void) => this) & (<S extends string | symbol>(event: Exclude<S, keyof RestEvents>, listener: (...args: any[]) => void) => this);
|
|
||||||
removeAllListeners: (<K extends keyof RestEvents>(event?: K) => this) & (<S extends string | symbol>(event?: Exclude<S, keyof RestEvents>) => this);
|
|
||||||
}
|
|
||||||
export declare class REST extends EventEmitter {
|
|
||||||
readonly cdn: CDN;
|
|
||||||
readonly requestManager: RequestManager;
|
|
||||||
constructor(options?: Partial<RESTOptions>);
|
|
||||||
/**
|
|
||||||
* Sets the authorization token that should be used for requests
|
|
||||||
* @param token The authorization token to use
|
|
||||||
*/
|
|
||||||
setToken(token: string): this;
|
|
||||||
/**
|
|
||||||
* Runs a get request from the api
|
|
||||||
* @param fullRoute The full route to query
|
|
||||||
* @param options Optional request options
|
|
||||||
*/
|
|
||||||
get(fullRoute: RouteLike, options?: RequestData): Promise<unknown>;
|
|
||||||
/**
|
|
||||||
* Runs a delete request from the api
|
|
||||||
* @param fullRoute The full route to query
|
|
||||||
* @param options Optional request options
|
|
||||||
*/
|
|
||||||
delete(fullRoute: RouteLike, options?: RequestData): Promise<unknown>;
|
|
||||||
/**
|
|
||||||
* Runs a post request from the api
|
|
||||||
* @param fullRoute The full route to query
|
|
||||||
* @param options Optional request options
|
|
||||||
*/
|
|
||||||
post(fullRoute: RouteLike, options?: RequestData): Promise<unknown>;
|
|
||||||
/**
|
|
||||||
* Runs a put request from the api
|
|
||||||
* @param fullRoute The full route to query
|
|
||||||
* @param options Optional request options
|
|
||||||
*/
|
|
||||||
put(fullRoute: RouteLike, options?: RequestData): Promise<unknown>;
|
|
||||||
/**
|
|
||||||
* Runs a patch request from the api
|
|
||||||
* @param fullRoute The full route to query
|
|
||||||
* @param options Optional request options
|
|
||||||
*/
|
|
||||||
patch(fullRoute: RouteLike, options?: RequestData): Promise<unknown>;
|
|
||||||
/**
|
|
||||||
* Runs a request from the api
|
|
||||||
* @param options Request options
|
|
||||||
*/
|
|
||||||
request(options: InternalRequest): Promise<unknown>;
|
|
||||||
}
|
|
199
node_modules/@discordjs/rest/dist/lib/RequestManager.d.ts
generated
vendored
199
node_modules/@discordjs/rest/dist/lib/RequestManager.d.ts
generated
vendored
|
@ -1,199 +0,0 @@
|
||||||
/// <reference types="node" />
|
|
||||||
import Collection from '@discordjs/collection';
|
|
||||||
import { EventEmitter } from 'node:events';
|
|
||||||
import type { BodyInit } from 'node-fetch';
|
|
||||||
import type { IHandler } from './handlers/IHandler';
|
|
||||||
import type { RESTOptions, RestEvents } from './REST';
|
|
||||||
/**
|
|
||||||
* Represents a file to be added to the request
|
|
||||||
*/
|
|
||||||
export interface RawFile {
|
|
||||||
/**
|
|
||||||
* The name of the file
|
|
||||||
*/
|
|
||||||
fileName: string;
|
|
||||||
/**
|
|
||||||
* An explicit key to use for key of the formdata field for this file.
|
|
||||||
* When not provided, the index of the file in the files array is used in the form `files[${index}]`.
|
|
||||||
* If you wish to alter the placeholder snowflake, you must provide this property in the same form (`files[${placeholder}]`)
|
|
||||||
*/
|
|
||||||
key?: string;
|
|
||||||
/**
|
|
||||||
* The actual data for the file
|
|
||||||
*/
|
|
||||||
fileData: string | number | boolean | Buffer;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Represents possible data to be given to an endpoint
|
|
||||||
*/
|
|
||||||
export interface RequestData {
|
|
||||||
/**
|
|
||||||
* Whether to append JSON data to form data instead of `payload_json` when sending files
|
|
||||||
*/
|
|
||||||
appendToFormData?: boolean;
|
|
||||||
/**
|
|
||||||
* If this request needs the `Authorization` header
|
|
||||||
* @default true
|
|
||||||
*/
|
|
||||||
auth?: boolean;
|
|
||||||
/**
|
|
||||||
* The authorization prefix to use for this request, useful if you use this with bearer tokens
|
|
||||||
* @default 'Bot'
|
|
||||||
*/
|
|
||||||
authPrefix?: 'Bot' | 'Bearer';
|
|
||||||
/**
|
|
||||||
* The body to send to this request.
|
|
||||||
* If providing as BodyInit, set `passThroughBody: true`
|
|
||||||
*/
|
|
||||||
body?: BodyInit | unknown;
|
|
||||||
/**
|
|
||||||
* Files to be attached to this request
|
|
||||||
*/
|
|
||||||
files?: RawFile[] | undefined;
|
|
||||||
/**
|
|
||||||
* Additional headers to add to this request
|
|
||||||
*/
|
|
||||||
headers?: Record<string, string>;
|
|
||||||
/**
|
|
||||||
* Whether to pass-through the body property directly to `fetch()`.
|
|
||||||
* <warn>This only applies when files is NOT present</warn>
|
|
||||||
*/
|
|
||||||
passThroughBody?: boolean;
|
|
||||||
/**
|
|
||||||
* Query string parameters to append to the called endpoint
|
|
||||||
*/
|
|
||||||
query?: URLSearchParams;
|
|
||||||
/**
|
|
||||||
* Reason to show in the audit logs
|
|
||||||
*/
|
|
||||||
reason?: string;
|
|
||||||
/**
|
|
||||||
* If this request should be versioned
|
|
||||||
* @default true
|
|
||||||
*/
|
|
||||||
versioned?: boolean;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Possible headers for an API call
|
|
||||||
*/
|
|
||||||
export interface RequestHeaders {
|
|
||||||
Authorization?: string;
|
|
||||||
'User-Agent': string;
|
|
||||||
'X-Audit-Log-Reason'?: string;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Possible API methods to be used when doing requests
|
|
||||||
*/
|
|
||||||
export declare const enum RequestMethod {
|
|
||||||
Delete = "delete",
|
|
||||||
Get = "get",
|
|
||||||
Patch = "patch",
|
|
||||||
Post = "post",
|
|
||||||
Put = "put"
|
|
||||||
}
|
|
||||||
export declare type RouteLike = `/${string}`;
|
|
||||||
/**
|
|
||||||
* Internal request options
|
|
||||||
*
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
export interface InternalRequest extends RequestData {
|
|
||||||
method: RequestMethod;
|
|
||||||
fullRoute: RouteLike;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Parsed route data for an endpoint
|
|
||||||
*
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
export interface RouteData {
|
|
||||||
majorParameter: string;
|
|
||||||
bucketRoute: string;
|
|
||||||
original: RouteLike;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Represents a hash and its associated fields
|
|
||||||
*
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
export interface HashData {
|
|
||||||
value: string;
|
|
||||||
lastAccess: number;
|
|
||||||
}
|
|
||||||
export interface RequestManager {
|
|
||||||
on: (<K extends keyof RestEvents>(event: K, listener: (...args: RestEvents[K]) => void) => this) & (<S extends string | symbol>(event: Exclude<S, keyof RestEvents>, listener: (...args: any[]) => void) => this);
|
|
||||||
once: (<K extends keyof RestEvents>(event: K, listener: (...args: RestEvents[K]) => void) => this) & (<S extends string | symbol>(event: Exclude<S, keyof RestEvents>, listener: (...args: any[]) => void) => this);
|
|
||||||
emit: (<K extends keyof RestEvents>(event: K, ...args: RestEvents[K]) => boolean) & (<S extends string | symbol>(event: Exclude<S, keyof RestEvents>, ...args: any[]) => boolean);
|
|
||||||
off: (<K extends keyof RestEvents>(event: K, listener: (...args: RestEvents[K]) => void) => this) & (<S extends string | symbol>(event: Exclude<S, keyof RestEvents>, listener: (...args: any[]) => void) => this);
|
|
||||||
removeAllListeners: (<K extends keyof RestEvents>(event?: K) => this) & (<S extends string | symbol>(event?: Exclude<S, keyof RestEvents>) => this);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Represents the class that manages handlers for endpoints
|
|
||||||
*/
|
|
||||||
export declare class RequestManager extends EventEmitter {
|
|
||||||
#private;
|
|
||||||
/**
|
|
||||||
* The number of requests remaining in the global bucket
|
|
||||||
*/
|
|
||||||
globalRemaining: number;
|
|
||||||
/**
|
|
||||||
* The promise used to wait out the global rate limit
|
|
||||||
*/
|
|
||||||
globalDelay: Promise<void> | null;
|
|
||||||
/**
|
|
||||||
* The timestamp at which the global bucket resets
|
|
||||||
*/
|
|
||||||
globalReset: number;
|
|
||||||
/**
|
|
||||||
* API bucket hashes that are cached from provided routes
|
|
||||||
*/
|
|
||||||
readonly hashes: Collection<string, HashData>;
|
|
||||||
/**
|
|
||||||
* Request handlers created from the bucket hash and the major parameters
|
|
||||||
*/
|
|
||||||
readonly handlers: Collection<string, IHandler>;
|
|
||||||
private hashTimer;
|
|
||||||
private handlerTimer;
|
|
||||||
private agent;
|
|
||||||
readonly options: RESTOptions;
|
|
||||||
constructor(options: Partial<RESTOptions>);
|
|
||||||
private setupSweepers;
|
|
||||||
/**
|
|
||||||
* Sets the authorization token that should be used for requests
|
|
||||||
* @param token The authorization token to use
|
|
||||||
*/
|
|
||||||
setToken(token: string): this;
|
|
||||||
/**
|
|
||||||
* Queues a request to be sent
|
|
||||||
* @param request All the information needed to make a request
|
|
||||||
* @returns The response from the api request
|
|
||||||
*/
|
|
||||||
queueRequest(request: InternalRequest): Promise<unknown>;
|
|
||||||
/**
|
|
||||||
* Creates a new rate limit handler from a hash, based on the hash and the major parameter
|
|
||||||
* @param hash The hash for the route
|
|
||||||
* @param majorParameter The major parameter for this handler
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
private createHandler;
|
|
||||||
/**
|
|
||||||
* Formats the request data to a usable format for fetch
|
|
||||||
* @param request The request data
|
|
||||||
*/
|
|
||||||
private resolveRequest;
|
|
||||||
/**
|
|
||||||
* Stops the hash sweeping interval
|
|
||||||
*/
|
|
||||||
clearHashSweeper(): void;
|
|
||||||
/**
|
|
||||||
* Stops the request handler sweeping interval
|
|
||||||
*/
|
|
||||||
clearHandlerSweeper(): void;
|
|
||||||
/**
|
|
||||||
* Generates route data for an endpoint:method
|
|
||||||
* @param endpoint The raw endpoint to generalize
|
|
||||||
* @param method The HTTP method this endpoint is called without
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
private static generateRouteData;
|
|
||||||
}
|
|
52
node_modules/@discordjs/rest/dist/lib/errors/DiscordAPIError.d.ts
generated
vendored
52
node_modules/@discordjs/rest/dist/lib/errors/DiscordAPIError.d.ts
generated
vendored
|
@ -1,52 +0,0 @@
|
||||||
import type { InternalRequest, RawFile } from '../RequestManager';
|
|
||||||
interface DiscordErrorFieldInformation {
|
|
||||||
code: string;
|
|
||||||
message: string;
|
|
||||||
}
|
|
||||||
interface DiscordErrorGroupWrapper {
|
|
||||||
_errors: DiscordError[];
|
|
||||||
}
|
|
||||||
declare type DiscordError = DiscordErrorGroupWrapper | DiscordErrorFieldInformation | {
|
|
||||||
[k: string]: DiscordError;
|
|
||||||
} | string;
|
|
||||||
export interface DiscordErrorData {
|
|
||||||
code: number;
|
|
||||||
message: string;
|
|
||||||
errors?: DiscordError;
|
|
||||||
}
|
|
||||||
export interface OAuthErrorData {
|
|
||||||
error: string;
|
|
||||||
error_description?: string;
|
|
||||||
}
|
|
||||||
export interface RequestBody {
|
|
||||||
files: RawFile[] | undefined;
|
|
||||||
json: unknown | undefined;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Represents an API error returned by Discord
|
|
||||||
* @extends Error
|
|
||||||
*/
|
|
||||||
export declare class DiscordAPIError extends Error {
|
|
||||||
rawError: DiscordErrorData | OAuthErrorData;
|
|
||||||
code: number | string;
|
|
||||||
status: number;
|
|
||||||
method: string;
|
|
||||||
url: string;
|
|
||||||
requestBody: RequestBody;
|
|
||||||
/**
|
|
||||||
* @param rawError The error reported by Discord
|
|
||||||
* @param code The error code reported by Discord
|
|
||||||
* @param status The status code of the response
|
|
||||||
* @param method The method of the request that erred
|
|
||||||
* @param url The url of the request that erred
|
|
||||||
* @param bodyData The unparsed data for the request that errored
|
|
||||||
*/
|
|
||||||
constructor(rawError: DiscordErrorData | OAuthErrorData, code: number | string, status: number, method: string, url: string, bodyData: Pick<InternalRequest, 'files' | 'body'>);
|
|
||||||
/**
|
|
||||||
* The name of the error
|
|
||||||
*/
|
|
||||||
get name(): string;
|
|
||||||
private static getMessage;
|
|
||||||
private static flattenDiscordError;
|
|
||||||
}
|
|
||||||
export {};
|
|
21
node_modules/@discordjs/rest/dist/lib/errors/HTTPError.d.ts
generated
vendored
21
node_modules/@discordjs/rest/dist/lib/errors/HTTPError.d.ts
generated
vendored
|
@ -1,21 +0,0 @@
|
||||||
import type { InternalRequest } from '../RequestManager';
|
|
||||||
import type { RequestBody } from './DiscordAPIError';
|
|
||||||
/**
|
|
||||||
* Represents a HTTP error
|
|
||||||
*/
|
|
||||||
export declare class HTTPError extends Error {
|
|
||||||
name: string;
|
|
||||||
status: number;
|
|
||||||
method: string;
|
|
||||||
url: string;
|
|
||||||
requestBody: RequestBody;
|
|
||||||
/**
|
|
||||||
* @param message The error message
|
|
||||||
* @param name The name of the error
|
|
||||||
* @param status The status code of the response
|
|
||||||
* @param method The method of the request that erred
|
|
||||||
* @param url The url of the request that erred
|
|
||||||
* @param bodyData The unparsed data for the request that errored
|
|
||||||
*/
|
|
||||||
constructor(message: string, name: string, status: number, method: string, url: string, bodyData: Pick<InternalRequest, 'files' | 'body'>);
|
|
||||||
}
|
|
16
node_modules/@discordjs/rest/dist/lib/errors/RateLimitError.d.ts
generated
vendored
16
node_modules/@discordjs/rest/dist/lib/errors/RateLimitError.d.ts
generated
vendored
|
@ -1,16 +0,0 @@
|
||||||
import type { RateLimitData } from '../REST';
|
|
||||||
export declare class RateLimitError extends Error implements RateLimitData {
|
|
||||||
timeToReset: number;
|
|
||||||
limit: number;
|
|
||||||
method: string;
|
|
||||||
hash: string;
|
|
||||||
url: string;
|
|
||||||
route: string;
|
|
||||||
majorParameter: string;
|
|
||||||
global: boolean;
|
|
||||||
constructor({ timeToReset, limit, method, hash, url, route, majorParameter, global }: RateLimitData);
|
|
||||||
/**
|
|
||||||
* The name of the error
|
|
||||||
*/
|
|
||||||
get name(): string;
|
|
||||||
}
|
|
7
node_modules/@discordjs/rest/dist/lib/handlers/IHandler.d.ts
generated
vendored
7
node_modules/@discordjs/rest/dist/lib/handlers/IHandler.d.ts
generated
vendored
|
@ -1,7 +0,0 @@
|
||||||
import type { RequestInit } from 'node-fetch';
|
|
||||||
import type { InternalRequest, RouteData } from '../RequestManager';
|
|
||||||
export interface IHandler {
|
|
||||||
queueRequest: (routeId: RouteData, url: string, options: RequestInit, bodyData: Pick<InternalRequest, 'files' | 'body'>) => Promise<unknown>;
|
|
||||||
readonly inactive: boolean;
|
|
||||||
readonly id: string;
|
|
||||||
}
|
|
82
node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.d.ts
generated
vendored
82
node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.d.ts
generated
vendored
|
@ -1,82 +0,0 @@
|
||||||
import { RequestInit } from 'node-fetch';
|
|
||||||
import type { InternalRequest, RequestManager, RouteData } from '../RequestManager';
|
|
||||||
/**
|
|
||||||
* The structure used to handle requests for a given bucket
|
|
||||||
*/
|
|
||||||
export declare class SequentialHandler {
|
|
||||||
#private;
|
|
||||||
private readonly manager;
|
|
||||||
private readonly hash;
|
|
||||||
private readonly majorParameter;
|
|
||||||
/**
|
|
||||||
* The unique id of the handler
|
|
||||||
*/
|
|
||||||
readonly id: string;
|
|
||||||
/**
|
|
||||||
* The time this rate limit bucket will reset
|
|
||||||
*/
|
|
||||||
private reset;
|
|
||||||
/**
|
|
||||||
* The remaining requests that can be made before we are rate limited
|
|
||||||
*/
|
|
||||||
private remaining;
|
|
||||||
/**
|
|
||||||
* The total number of requests that can be made before we are rate limited
|
|
||||||
*/
|
|
||||||
private limit;
|
|
||||||
/**
|
|
||||||
* @param manager The request manager
|
|
||||||
* @param hash The hash that this RequestHandler handles
|
|
||||||
* @param majorParameter The major parameter for this handler
|
|
||||||
*/
|
|
||||||
constructor(manager: RequestManager, hash: string, majorParameter: string);
|
|
||||||
/**
|
|
||||||
* If the bucket is currently inactive (no pending requests)
|
|
||||||
*/
|
|
||||||
get inactive(): boolean;
|
|
||||||
/**
|
|
||||||
* If the rate limit bucket is currently limited by the global limit
|
|
||||||
*/
|
|
||||||
private get globalLimited();
|
|
||||||
/**
|
|
||||||
* If the rate limit bucket is currently limited by its limit
|
|
||||||
*/
|
|
||||||
private get localLimited();
|
|
||||||
/**
|
|
||||||
* If the rate limit bucket is currently limited
|
|
||||||
*/
|
|
||||||
private get limited();
|
|
||||||
/**
|
|
||||||
* The time until queued requests can continue
|
|
||||||
*/
|
|
||||||
private get timeToReset();
|
|
||||||
/**
|
|
||||||
* Emits a debug message
|
|
||||||
* @param message The message to debug
|
|
||||||
*/
|
|
||||||
private debug;
|
|
||||||
/**
|
|
||||||
* Delay all requests for the specified amount of time, handling global rate limits
|
|
||||||
* @param time The amount of time to delay all requests for
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
private globalDelayFor;
|
|
||||||
private onRateLimit;
|
|
||||||
/**
|
|
||||||
* Queues a request to be sent
|
|
||||||
* @param routeId The generalized api route with literal ids for major parameters
|
|
||||||
* @param url The url to do the request on
|
|
||||||
* @param options All the information needed to make a request
|
|
||||||
* @param bodyData The data that was used to form the body, passed to any errors generated and for determining whether to sublimit
|
|
||||||
*/
|
|
||||||
queueRequest(routeId: RouteData, url: string, options: RequestInit, bodyData: Pick<InternalRequest, 'files' | 'body'>): Promise<unknown>;
|
|
||||||
/**
|
|
||||||
* The method that actually makes the request to the api, and updates info about the bucket accordingly
|
|
||||||
* @param routeId The generalized api route with literal ids for major parameters
|
|
||||||
* @param url The fully resolved url to make the request to
|
|
||||||
* @param options The node-fetch options needed to make the request
|
|
||||||
* @param bodyData The data that was used to form the body, passed to any errors generated
|
|
||||||
* @param retries The number of retries this request has already attempted (recursion)
|
|
||||||
*/
|
|
||||||
private runRequest;
|
|
||||||
}
|
|
21
node_modules/@discordjs/rest/dist/lib/utils/constants.d.ts
generated
vendored
21
node_modules/@discordjs/rest/dist/lib/utils/constants.d.ts
generated
vendored
|
@ -1,21 +0,0 @@
|
||||||
import type { RESTOptions } from '../REST';
|
|
||||||
export declare const DefaultUserAgent: string;
|
|
||||||
export declare const DefaultRestOptions: Required<RESTOptions>;
|
|
||||||
/**
|
|
||||||
* The events that the REST manager emits
|
|
||||||
*/
|
|
||||||
export declare const enum RESTEvents {
|
|
||||||
Debug = "restDebug",
|
|
||||||
InvalidRequestWarning = "invalidRequestWarning",
|
|
||||||
RateLimited = "rateLimited",
|
|
||||||
Request = "request",
|
|
||||||
Response = "response",
|
|
||||||
HashSweep = "hashSweep",
|
|
||||||
HandlerSweep = "handlerSweep"
|
|
||||||
}
|
|
||||||
export declare const ALLOWED_EXTENSIONS: readonly ["webp", "png", "jpg", "jpeg", "gif"];
|
|
||||||
export declare const ALLOWED_STICKER_EXTENSIONS: readonly ["png", "json"];
|
|
||||||
export declare const ALLOWED_SIZES: readonly [16, 32, 64, 128, 256, 512, 1024, 2048, 4096];
|
|
||||||
export declare type ImageExtension = typeof ALLOWED_EXTENSIONS[number];
|
|
||||||
export declare type StickerExtension = typeof ALLOWED_STICKER_EXTENSIONS[number];
|
|
||||||
export declare type ImageSize = typeof ALLOWED_SIZES[number];
|
|
14
node_modules/@discordjs/rest/dist/lib/utils/utils.d.ts
generated
vendored
14
node_modules/@discordjs/rest/dist/lib/utils/utils.d.ts
generated
vendored
|
@ -1,14 +0,0 @@
|
||||||
import type { Response } from 'node-fetch';
|
|
||||||
/**
|
|
||||||
* Converts the response to usable data
|
|
||||||
* @param res The node-fetch response
|
|
||||||
*/
|
|
||||||
export declare function parseResponse(res: Response): Promise<unknown>;
|
|
||||||
/**
|
|
||||||
* Check whether a request falls under a sublimit
|
|
||||||
* @param bucketRoute The buckets route identifier
|
|
||||||
* @param body The options provided as JSON data
|
|
||||||
* @param method The HTTP method that will be used to make the request
|
|
||||||
* @returns Whether the request falls under a sublimit
|
|
||||||
*/
|
|
||||||
export declare function hasSublimit(bucketRoute: string, body?: unknown, method?: string): boolean;
|
|
1
node_modules/@discordjs/rest/docs/README.md
generated
vendored
1
node_modules/@discordjs/rest/docs/README.md
generated
vendored
|
@ -1 +0,0 @@
|
||||||
## [View the documentation here.](https://discord.js.org/#/docs/rest)
|
|
5
node_modules/@discordjs/rest/docs/index.yml
generated
vendored
5
node_modules/@discordjs/rest/docs/index.yml
generated
vendored
|
@ -1,5 +0,0 @@
|
||||||
- name: General
|
|
||||||
files:
|
|
||||||
- name: Welcome
|
|
||||||
id: welcome
|
|
||||||
path: ../../README.md
|
|
22
node_modules/@discordjs/rest/node_modules/node-fetch/LICENSE.md
generated
vendored
22
node_modules/@discordjs/rest/node_modules/node-fetch/LICENSE.md
generated
vendored
|
@ -1,22 +0,0 @@
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2016 David Frank
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
590
node_modules/@discordjs/rest/node_modules/node-fetch/README.md
generated
vendored
590
node_modules/@discordjs/rest/node_modules/node-fetch/README.md
generated
vendored
|
@ -1,590 +0,0 @@
|
||||||
node-fetch
|
|
||||||
==========
|
|
||||||
|
|
||||||
[![npm version][npm-image]][npm-url]
|
|
||||||
[![build status][travis-image]][travis-url]
|
|
||||||
[![coverage status][codecov-image]][codecov-url]
|
|
||||||
[![install size][install-size-image]][install-size-url]
|
|
||||||
[![Discord][discord-image]][discord-url]
|
|
||||||
|
|
||||||
A light-weight module that brings `window.fetch` to Node.js
|
|
||||||
|
|
||||||
(We are looking for [v2 maintainers and collaborators](https://github.com/bitinn/node-fetch/issues/567))
|
|
||||||
|
|
||||||
[![Backers][opencollective-image]][opencollective-url]
|
|
||||||
|
|
||||||
<!-- TOC -->
|
|
||||||
|
|
||||||
- [Motivation](#motivation)
|
|
||||||
- [Features](#features)
|
|
||||||
- [Difference from client-side fetch](#difference-from-client-side-fetch)
|
|
||||||
- [Installation](#installation)
|
|
||||||
- [Loading and configuring the module](#loading-and-configuring-the-module)
|
|
||||||
- [Common Usage](#common-usage)
|
|
||||||
- [Plain text or HTML](#plain-text-or-html)
|
|
||||||
- [JSON](#json)
|
|
||||||
- [Simple Post](#simple-post)
|
|
||||||
- [Post with JSON](#post-with-json)
|
|
||||||
- [Post with form parameters](#post-with-form-parameters)
|
|
||||||
- [Handling exceptions](#handling-exceptions)
|
|
||||||
- [Handling client and server errors](#handling-client-and-server-errors)
|
|
||||||
- [Advanced Usage](#advanced-usage)
|
|
||||||
- [Streams](#streams)
|
|
||||||
- [Buffer](#buffer)
|
|
||||||
- [Accessing Headers and other Meta data](#accessing-headers-and-other-meta-data)
|
|
||||||
- [Extract Set-Cookie Header](#extract-set-cookie-header)
|
|
||||||
- [Post data using a file stream](#post-data-using-a-file-stream)
|
|
||||||
- [Post with form-data (detect multipart)](#post-with-form-data-detect-multipart)
|
|
||||||
- [Request cancellation with AbortSignal](#request-cancellation-with-abortsignal)
|
|
||||||
- [API](#api)
|
|
||||||
- [fetch(url[, options])](#fetchurl-options)
|
|
||||||
- [Options](#options)
|
|
||||||
- [Class: Request](#class-request)
|
|
||||||
- [Class: Response](#class-response)
|
|
||||||
- [Class: Headers](#class-headers)
|
|
||||||
- [Interface: Body](#interface-body)
|
|
||||||
- [Class: FetchError](#class-fetcherror)
|
|
||||||
- [License](#license)
|
|
||||||
- [Acknowledgement](#acknowledgement)
|
|
||||||
|
|
||||||
<!-- /TOC -->
|
|
||||||
|
|
||||||
## Motivation
|
|
||||||
|
|
||||||
Instead of implementing `XMLHttpRequest` in Node.js to run browser-specific [Fetch polyfill](https://github.com/github/fetch), why not go from native `http` to `fetch` API directly? Hence, `node-fetch`, minimal code for a `window.fetch` compatible API on Node.js runtime.
|
|
||||||
|
|
||||||
See Matt Andrews' [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) or Leonardo Quixada's [cross-fetch](https://github.com/lquixada/cross-fetch) for isomorphic usage (exports `node-fetch` for server-side, `whatwg-fetch` for client-side).
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- Stay consistent with `window.fetch` API.
|
|
||||||
- Make conscious trade-off when following [WHATWG fetch spec][whatwg-fetch] and [stream spec](https://streams.spec.whatwg.org/) implementation details, document known differences.
|
|
||||||
- Use native promise but allow substituting it with [insert your favorite promise library].
|
|
||||||
- Use native Node streams for body on both request and response.
|
|
||||||
- Decode content encoding (gzip/deflate) properly and convert string output (such as `res.text()` and `res.json()`) to UTF-8 automatically.
|
|
||||||
- Useful extensions such as timeout, redirect limit, response size limit, [explicit errors](ERROR-HANDLING.md) for troubleshooting.
|
|
||||||
|
|
||||||
## Difference from client-side fetch
|
|
||||||
|
|
||||||
- See [Known Differences](LIMITS.md) for details.
|
|
||||||
- If you happen to use a missing feature that `window.fetch` offers, feel free to open an issue.
|
|
||||||
- Pull requests are welcomed too!
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
Current stable release (`2.x`)
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install node-fetch
|
|
||||||
```
|
|
||||||
|
|
||||||
## Loading and configuring the module
|
|
||||||
We suggest you load the module via `require` until the stabilization of ES modules in node:
|
|
||||||
```js
|
|
||||||
const fetch = require('node-fetch');
|
|
||||||
```
|
|
||||||
|
|
||||||
If you are using a Promise library other than native, set it through `fetch.Promise`:
|
|
||||||
```js
|
|
||||||
const Bluebird = require('bluebird');
|
|
||||||
|
|
||||||
fetch.Promise = Bluebird;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Common Usage
|
|
||||||
|
|
||||||
NOTE: The documentation below is up-to-date with `2.x` releases; see the [`1.x` readme](https://github.com/bitinn/node-fetch/blob/1.x/README.md), [changelog](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) and [2.x upgrade guide](UPGRADE-GUIDE.md) for the differences.
|
|
||||||
|
|
||||||
#### Plain text or HTML
|
|
||||||
```js
|
|
||||||
fetch('https://github.com/')
|
|
||||||
.then(res => res.text())
|
|
||||||
.then(body => console.log(body));
|
|
||||||
```
|
|
||||||
|
|
||||||
#### JSON
|
|
||||||
|
|
||||||
```js
|
|
||||||
|
|
||||||
fetch('https://api.github.com/users/github')
|
|
||||||
.then(res => res.json())
|
|
||||||
.then(json => console.log(json));
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Simple Post
|
|
||||||
```js
|
|
||||||
fetch('https://httpbin.org/post', { method: 'POST', body: 'a=1' })
|
|
||||||
.then(res => res.json()) // expecting a json response
|
|
||||||
.then(json => console.log(json));
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Post with JSON
|
|
||||||
|
|
||||||
```js
|
|
||||||
const body = { a: 1 };
|
|
||||||
|
|
||||||
fetch('https://httpbin.org/post', {
|
|
||||||
method: 'post',
|
|
||||||
body: JSON.stringify(body),
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
})
|
|
||||||
.then(res => res.json())
|
|
||||||
.then(json => console.log(json));
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Post with form parameters
|
|
||||||
`URLSearchParams` is available in Node.js as of v7.5.0. See [official documentation](https://nodejs.org/api/url.html#url_class_urlsearchparams) for more usage methods.
|
|
||||||
|
|
||||||
NOTE: The `Content-Type` header is only set automatically to `x-www-form-urlencoded` when an instance of `URLSearchParams` is given as such:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const { URLSearchParams } = require('url');
|
|
||||||
|
|
||||||
const params = new URLSearchParams();
|
|
||||||
params.append('a', 1);
|
|
||||||
|
|
||||||
fetch('https://httpbin.org/post', { method: 'POST', body: params })
|
|
||||||
.then(res => res.json())
|
|
||||||
.then(json => console.log(json));
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Handling exceptions
|
|
||||||
NOTE: 3xx-5xx responses are *NOT* exceptions and should be handled in `then()`; see the next section for more information.
|
|
||||||
|
|
||||||
Adding a catch to the fetch promise chain will catch *all* exceptions, such as errors originating from node core libraries, network errors and operational errors, which are instances of FetchError. See the [error handling document](ERROR-HANDLING.md) for more details.
|
|
||||||
|
|
||||||
```js
|
|
||||||
fetch('https://domain.invalid/')
|
|
||||||
.catch(err => console.error(err));
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Handling client and server errors
|
|
||||||
It is common to create a helper function to check that the response contains no client (4xx) or server (5xx) error responses:
|
|
||||||
|
|
||||||
```js
|
|
||||||
function checkStatus(res) {
|
|
||||||
if (res.ok) { // res.status >= 200 && res.status < 300
|
|
||||||
return res;
|
|
||||||
} else {
|
|
||||||
throw MyCustomError(res.statusText);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fetch('https://httpbin.org/status/400')
|
|
||||||
.then(checkStatus)
|
|
||||||
.then(res => console.log('will not get here...'))
|
|
||||||
```
|
|
||||||
|
|
||||||
## Advanced Usage
|
|
||||||
|
|
||||||
#### Streams
|
|
||||||
The "Node.js way" is to use streams when possible:
|
|
||||||
|
|
||||||
```js
|
|
||||||
fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png')
|
|
||||||
.then(res => {
|
|
||||||
const dest = fs.createWriteStream('./octocat.png');
|
|
||||||
res.body.pipe(dest);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Buffer
|
|
||||||
If you prefer to cache binary data in full, use buffer(). (NOTE: `buffer()` is a `node-fetch`-only API)
|
|
||||||
|
|
||||||
```js
|
|
||||||
const fileType = require('file-type');
|
|
||||||
|
|
||||||
fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png')
|
|
||||||
.then(res => res.buffer())
|
|
||||||
.then(buffer => fileType(buffer))
|
|
||||||
.then(type => { /* ... */ });
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Accessing Headers and other Meta data
|
|
||||||
```js
|
|
||||||
fetch('https://github.com/')
|
|
||||||
.then(res => {
|
|
||||||
console.log(res.ok);
|
|
||||||
console.log(res.status);
|
|
||||||
console.log(res.statusText);
|
|
||||||
console.log(res.headers.raw());
|
|
||||||
console.log(res.headers.get('content-type'));
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Extract Set-Cookie Header
|
|
||||||
|
|
||||||
Unlike browsers, you can access raw `Set-Cookie` headers manually using `Headers.raw()`. This is a `node-fetch` only API.
|
|
||||||
|
|
||||||
```js
|
|
||||||
fetch(url).then(res => {
|
|
||||||
// returns an array of values, instead of a string of comma-separated values
|
|
||||||
console.log(res.headers.raw()['set-cookie']);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Post data using a file stream
|
|
||||||
|
|
||||||
```js
|
|
||||||
const { createReadStream } = require('fs');
|
|
||||||
|
|
||||||
const stream = createReadStream('input.txt');
|
|
||||||
|
|
||||||
fetch('https://httpbin.org/post', { method: 'POST', body: stream })
|
|
||||||
.then(res => res.json())
|
|
||||||
.then(json => console.log(json));
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Post with form-data (detect multipart)
|
|
||||||
|
|
||||||
```js
|
|
||||||
const FormData = require('form-data');
|
|
||||||
|
|
||||||
const form = new FormData();
|
|
||||||
form.append('a', 1);
|
|
||||||
|
|
||||||
fetch('https://httpbin.org/post', { method: 'POST', body: form })
|
|
||||||
.then(res => res.json())
|
|
||||||
.then(json => console.log(json));
|
|
||||||
|
|
||||||
// OR, using custom headers
|
|
||||||
// NOTE: getHeaders() is non-standard API
|
|
||||||
|
|
||||||
const form = new FormData();
|
|
||||||
form.append('a', 1);
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
method: 'POST',
|
|
||||||
body: form,
|
|
||||||
headers: form.getHeaders()
|
|
||||||
}
|
|
||||||
|
|
||||||
fetch('https://httpbin.org/post', options)
|
|
||||||
.then(res => res.json())
|
|
||||||
.then(json => console.log(json));
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Request cancellation with AbortSignal
|
|
||||||
|
|
||||||
> NOTE: You may cancel streamed requests only on Node >= v8.0.0
|
|
||||||
|
|
||||||
You may cancel requests with `AbortController`. A suggested implementation is [`abort-controller`](https://www.npmjs.com/package/abort-controller).
|
|
||||||
|
|
||||||
An example of timing out a request after 150ms could be achieved as the following:
|
|
||||||
|
|
||||||
```js
|
|
||||||
import AbortController from 'abort-controller';
|
|
||||||
|
|
||||||
const controller = new AbortController();
|
|
||||||
const timeout = setTimeout(
|
|
||||||
() => { controller.abort(); },
|
|
||||||
150,
|
|
||||||
);
|
|
||||||
|
|
||||||
fetch(url, { signal: controller.signal })
|
|
||||||
.then(res => res.json())
|
|
||||||
.then(
|
|
||||||
data => {
|
|
||||||
useData(data)
|
|
||||||
},
|
|
||||||
err => {
|
|
||||||
if (err.name === 'AbortError') {
|
|
||||||
// request was aborted
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.finally(() => {
|
|
||||||
clearTimeout(timeout);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
See [test cases](https://github.com/bitinn/node-fetch/blob/master/test/test.js) for more examples.
|
|
||||||
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
### fetch(url[, options])
|
|
||||||
|
|
||||||
- `url` A string representing the URL for fetching
|
|
||||||
- `options` [Options](#fetch-options) for the HTTP(S) request
|
|
||||||
- Returns: <code>Promise<[Response](#class-response)></code>
|
|
||||||
|
|
||||||
Perform an HTTP(S) fetch.
|
|
||||||
|
|
||||||
`url` should be an absolute url, such as `https://example.com/`. A path-relative URL (`/file/under/root`) or protocol-relative URL (`//can-be-http-or-https.com/`) will result in a rejected `Promise`.
|
|
||||||
|
|
||||||
<a id="fetch-options"></a>
|
|
||||||
### Options
|
|
||||||
|
|
||||||
The default values are shown after each option key.
|
|
||||||
|
|
||||||
```js
|
|
||||||
{
|
|
||||||
// These properties are part of the Fetch Standard
|
|
||||||
method: 'GET',
|
|
||||||
headers: {}, // request headers. format is the identical to that accepted by the Headers constructor (see below)
|
|
||||||
body: null, // request body. can be null, a string, a Buffer, a Blob, or a Node.js Readable stream
|
|
||||||
redirect: 'follow', // set to `manual` to extract redirect headers, `error` to reject redirect
|
|
||||||
signal: null, // pass an instance of AbortSignal to optionally abort requests
|
|
||||||
|
|
||||||
// The following properties are node-fetch extensions
|
|
||||||
follow: 20, // maximum redirect count. 0 to not follow redirect
|
|
||||||
timeout: 0, // req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies). Signal is recommended instead.
|
|
||||||
compress: true, // support gzip/deflate content encoding. false to disable
|
|
||||||
size: 0, // maximum response body size in bytes. 0 to disable
|
|
||||||
agent: null // http(s).Agent instance or function that returns an instance (see below)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
##### Default Headers
|
|
||||||
|
|
||||||
If no values are set, the following request headers will be sent automatically:
|
|
||||||
|
|
||||||
Header | Value
|
|
||||||
------------------- | --------------------------------------------------------
|
|
||||||
`Accept-Encoding` | `gzip,deflate` _(when `options.compress === true`)_
|
|
||||||
`Accept` | `*/*`
|
|
||||||
`Connection` | `close` _(when no `options.agent` is present)_
|
|
||||||
`Content-Length` | _(automatically calculated, if possible)_
|
|
||||||
`Transfer-Encoding` | `chunked` _(when `req.body` is a stream)_
|
|
||||||
`User-Agent` | `node-fetch/1.0 (+https://github.com/bitinn/node-fetch)`
|
|
||||||
|
|
||||||
Note: when `body` is a `Stream`, `Content-Length` is not set automatically.
|
|
||||||
|
|
||||||
##### Custom Agent
|
|
||||||
|
|
||||||
The `agent` option allows you to specify networking related options which are out of the scope of Fetch, including and not limited to the following:
|
|
||||||
|
|
||||||
- Support self-signed certificate
|
|
||||||
- Use only IPv4 or IPv6
|
|
||||||
- Custom DNS Lookup
|
|
||||||
|
|
||||||
See [`http.Agent`](https://nodejs.org/api/http.html#http_new_agent_options) for more information.
|
|
||||||
|
|
||||||
In addition, the `agent` option accepts a function that returns `http`(s)`.Agent` instance given current [URL](https://nodejs.org/api/url.html), this is useful during a redirection chain across HTTP and HTTPS protocol.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const httpAgent = new http.Agent({
|
|
||||||
keepAlive: true
|
|
||||||
});
|
|
||||||
const httpsAgent = new https.Agent({
|
|
||||||
keepAlive: true
|
|
||||||
});
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
agent: function (_parsedURL) {
|
|
||||||
if (_parsedURL.protocol == 'http:') {
|
|
||||||
return httpAgent;
|
|
||||||
} else {
|
|
||||||
return httpsAgent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
<a id="class-request"></a>
|
|
||||||
### Class: Request
|
|
||||||
|
|
||||||
An HTTP(S) request containing information about URL, method, headers, and the body. This class implements the [Body](#iface-body) interface.
|
|
||||||
|
|
||||||
Due to the nature of Node.js, the following properties are not implemented at this moment:
|
|
||||||
|
|
||||||
- `type`
|
|
||||||
- `destination`
|
|
||||||
- `referrer`
|
|
||||||
- `referrerPolicy`
|
|
||||||
- `mode`
|
|
||||||
- `credentials`
|
|
||||||
- `cache`
|
|
||||||
- `integrity`
|
|
||||||
- `keepalive`
|
|
||||||
|
|
||||||
The following node-fetch extension properties are provided:
|
|
||||||
|
|
||||||
- `follow`
|
|
||||||
- `compress`
|
|
||||||
- `counter`
|
|
||||||
- `agent`
|
|
||||||
|
|
||||||
See [options](#fetch-options) for exact meaning of these extensions.
|
|
||||||
|
|
||||||
#### new Request(input[, options])
|
|
||||||
|
|
||||||
<small>*(spec-compliant)*</small>
|
|
||||||
|
|
||||||
- `input` A string representing a URL, or another `Request` (which will be cloned)
|
|
||||||
- `options` [Options][#fetch-options] for the HTTP(S) request
|
|
||||||
|
|
||||||
Constructs a new `Request` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request).
|
|
||||||
|
|
||||||
In most cases, directly `fetch(url, options)` is simpler than creating a `Request` object.
|
|
||||||
|
|
||||||
<a id="class-response"></a>
|
|
||||||
### Class: Response
|
|
||||||
|
|
||||||
An HTTP(S) response. This class implements the [Body](#iface-body) interface.
|
|
||||||
|
|
||||||
The following properties are not implemented in node-fetch at this moment:
|
|
||||||
|
|
||||||
- `Response.error()`
|
|
||||||
- `Response.redirect()`
|
|
||||||
- `type`
|
|
||||||
- `trailer`
|
|
||||||
|
|
||||||
#### new Response([body[, options]])
|
|
||||||
|
|
||||||
<small>*(spec-compliant)*</small>
|
|
||||||
|
|
||||||
- `body` A `String` or [`Readable` stream][node-readable]
|
|
||||||
- `options` A [`ResponseInit`][response-init] options dictionary
|
|
||||||
|
|
||||||
Constructs a new `Response` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response).
|
|
||||||
|
|
||||||
Because Node.js does not implement service workers (for which this class was designed), one rarely has to construct a `Response` directly.
|
|
||||||
|
|
||||||
#### response.ok
|
|
||||||
|
|
||||||
<small>*(spec-compliant)*</small>
|
|
||||||
|
|
||||||
Convenience property representing if the request ended normally. Will evaluate to true if the response status was greater than or equal to 200 but smaller than 300.
|
|
||||||
|
|
||||||
#### response.redirected
|
|
||||||
|
|
||||||
<small>*(spec-compliant)*</small>
|
|
||||||
|
|
||||||
Convenience property representing if the request has been redirected at least once. Will evaluate to true if the internal redirect counter is greater than 0.
|
|
||||||
|
|
||||||
<a id="class-headers"></a>
|
|
||||||
### Class: Headers
|
|
||||||
|
|
||||||
This class allows manipulating and iterating over a set of HTTP headers. All methods specified in the [Fetch Standard][whatwg-fetch] are implemented.
|
|
||||||
|
|
||||||
#### new Headers([init])
|
|
||||||
|
|
||||||
<small>*(spec-compliant)*</small>
|
|
||||||
|
|
||||||
- `init` Optional argument to pre-fill the `Headers` object
|
|
||||||
|
|
||||||
Construct a new `Headers` object. `init` can be either `null`, a `Headers` object, an key-value map object or any iterable object.
|
|
||||||
|
|
||||||
```js
|
|
||||||
// Example adapted from https://fetch.spec.whatwg.org/#example-headers-class
|
|
||||||
|
|
||||||
const meta = {
|
|
||||||
'Content-Type': 'text/xml',
|
|
||||||
'Breaking-Bad': '<3'
|
|
||||||
};
|
|
||||||
const headers = new Headers(meta);
|
|
||||||
|
|
||||||
// The above is equivalent to
|
|
||||||
const meta = [
|
|
||||||
[ 'Content-Type', 'text/xml' ],
|
|
||||||
[ 'Breaking-Bad', '<3' ]
|
|
||||||
];
|
|
||||||
const headers = new Headers(meta);
|
|
||||||
|
|
||||||
// You can in fact use any iterable objects, like a Map or even another Headers
|
|
||||||
const meta = new Map();
|
|
||||||
meta.set('Content-Type', 'text/xml');
|
|
||||||
meta.set('Breaking-Bad', '<3');
|
|
||||||
const headers = new Headers(meta);
|
|
||||||
const copyOfHeaders = new Headers(headers);
|
|
||||||
```
|
|
||||||
|
|
||||||
<a id="iface-body"></a>
|
|
||||||
### Interface: Body
|
|
||||||
|
|
||||||
`Body` is an abstract interface with methods that are applicable to both `Request` and `Response` classes.
|
|
||||||
|
|
||||||
The following methods are not yet implemented in node-fetch at this moment:
|
|
||||||
|
|
||||||
- `formData()`
|
|
||||||
|
|
||||||
#### body.body
|
|
||||||
|
|
||||||
<small>*(deviation from spec)*</small>
|
|
||||||
|
|
||||||
* Node.js [`Readable` stream][node-readable]
|
|
||||||
|
|
||||||
Data are encapsulated in the `Body` object. Note that while the [Fetch Standard][whatwg-fetch] requires the property to always be a WHATWG `ReadableStream`, in node-fetch it is a Node.js [`Readable` stream][node-readable].
|
|
||||||
|
|
||||||
#### body.bodyUsed
|
|
||||||
|
|
||||||
<small>*(spec-compliant)*</small>
|
|
||||||
|
|
||||||
* `Boolean`
|
|
||||||
|
|
||||||
A boolean property for if this body has been consumed. Per the specs, a consumed body cannot be used again.
|
|
||||||
|
|
||||||
#### body.arrayBuffer()
|
|
||||||
#### body.blob()
|
|
||||||
#### body.json()
|
|
||||||
#### body.text()
|
|
||||||
|
|
||||||
<small>*(spec-compliant)*</small>
|
|
||||||
|
|
||||||
* Returns: <code>Promise</code>
|
|
||||||
|
|
||||||
Consume the body and return a promise that will resolve to one of these formats.
|
|
||||||
|
|
||||||
#### body.buffer()
|
|
||||||
|
|
||||||
<small>*(node-fetch extension)*</small>
|
|
||||||
|
|
||||||
* Returns: <code>Promise<Buffer></code>
|
|
||||||
|
|
||||||
Consume the body and return a promise that will resolve to a Buffer.
|
|
||||||
|
|
||||||
#### body.textConverted()
|
|
||||||
|
|
||||||
<small>*(node-fetch extension)*</small>
|
|
||||||
|
|
||||||
* Returns: <code>Promise<String></code>
|
|
||||||
|
|
||||||
Identical to `body.text()`, except instead of always converting to UTF-8, encoding sniffing will be performed and text converted to UTF-8 if possible.
|
|
||||||
|
|
||||||
(This API requires an optional dependency of the npm package [encoding](https://www.npmjs.com/package/encoding), which you need to install manually. `webpack` users may see [a warning message](https://github.com/bitinn/node-fetch/issues/412#issuecomment-379007792) due to this optional dependency.)
|
|
||||||
|
|
||||||
<a id="class-fetcherror"></a>
|
|
||||||
### Class: FetchError
|
|
||||||
|
|
||||||
<small>*(node-fetch extension)*</small>
|
|
||||||
|
|
||||||
An operational error in the fetching process. See [ERROR-HANDLING.md][] for more info.
|
|
||||||
|
|
||||||
<a id="class-aborterror"></a>
|
|
||||||
### Class: AbortError
|
|
||||||
|
|
||||||
<small>*(node-fetch extension)*</small>
|
|
||||||
|
|
||||||
An Error thrown when the request is aborted in response to an `AbortSignal`'s `abort` event. It has a `name` property of `AbortError`. See [ERROR-HANDLING.MD][] for more info.
|
|
||||||
|
|
||||||
## Acknowledgement
|
|
||||||
|
|
||||||
Thanks to [github/fetch](https://github.com/github/fetch) for providing a solid implementation reference.
|
|
||||||
|
|
||||||
`node-fetch` v1 was maintained by [@bitinn](https://github.com/bitinn); v2 was maintained by [@TimothyGu](https://github.com/timothygu), [@bitinn](https://github.com/bitinn) and [@jimmywarting](https://github.com/jimmywarting); v2 readme is written by [@jkantr](https://github.com/jkantr).
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
MIT
|
|
||||||
|
|
||||||
[npm-image]: https://flat.badgen.net/npm/v/node-fetch
|
|
||||||
[npm-url]: https://www.npmjs.com/package/node-fetch
|
|
||||||
[travis-image]: https://flat.badgen.net/travis/bitinn/node-fetch
|
|
||||||
[travis-url]: https://travis-ci.org/bitinn/node-fetch
|
|
||||||
[codecov-image]: https://flat.badgen.net/codecov/c/github/bitinn/node-fetch/master
|
|
||||||
[codecov-url]: https://codecov.io/gh/bitinn/node-fetch
|
|
||||||
[install-size-image]: https://flat.badgen.net/packagephobia/install/node-fetch
|
|
||||||
[install-size-url]: https://packagephobia.now.sh/result?p=node-fetch
|
|
||||||
[discord-image]: https://img.shields.io/discord/619915844268326952?color=%237289DA&label=Discord&style=flat-square
|
|
||||||
[discord-url]: https://discord.gg/Zxbndcm
|
|
||||||
[opencollective-image]: https://opencollective.com/node-fetch/backers.svg
|
|
||||||
[opencollective-url]: https://opencollective.com/node-fetch
|
|
||||||
[whatwg-fetch]: https://fetch.spec.whatwg.org/
|
|
||||||
[response-init]: https://fetch.spec.whatwg.org/#responseinit
|
|
||||||
[node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams
|
|
||||||
[mdn-headers]: https://developer.mozilla.org/en-US/docs/Web/API/Headers
|
|
||||||
[LIMITS.md]: https://github.com/bitinn/node-fetch/blob/master/LIMITS.md
|
|
||||||
[ERROR-HANDLING.md]: https://github.com/bitinn/node-fetch/blob/master/ERROR-HANDLING.md
|
|
||||||
[UPGRADE-GUIDE.md]: https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md
|
|
25
node_modules/@discordjs/rest/node_modules/node-fetch/browser.js
generated
vendored
25
node_modules/@discordjs/rest/node_modules/node-fetch/browser.js
generated
vendored
|
@ -1,25 +0,0 @@
|
||||||
"use strict";
|
|
||||||
|
|
||||||
// ref: https://github.com/tc39/proposal-global
|
|
||||||
var getGlobal = function () {
|
|
||||||
// the only reliable means to get the global object is
|
|
||||||
// `Function('return this')()`
|
|
||||||
// However, this causes CSP violations in Chrome apps.
|
|
||||||
if (typeof self !== 'undefined') { return self; }
|
|
||||||
if (typeof window !== 'undefined') { return window; }
|
|
||||||
if (typeof global !== 'undefined') { return global; }
|
|
||||||
throw new Error('unable to locate global object');
|
|
||||||
}
|
|
||||||
|
|
||||||
var global = getGlobal();
|
|
||||||
|
|
||||||
module.exports = exports = global.fetch;
|
|
||||||
|
|
||||||
// Needed for TypeScript and Webpack.
|
|
||||||
if (global.fetch) {
|
|
||||||
exports.default = global.fetch.bind(global);
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.Headers = global.Headers;
|
|
||||||
exports.Request = global.Request;
|
|
||||||
exports.Response = global.Response;
|
|
1688
node_modules/@discordjs/rest/node_modules/node-fetch/lib/index.es.js
generated
vendored
1688
node_modules/@discordjs/rest/node_modules/node-fetch/lib/index.es.js
generated
vendored
File diff suppressed because it is too large
Load diff
1697
node_modules/@discordjs/rest/node_modules/node-fetch/lib/index.js
generated
vendored
1697
node_modules/@discordjs/rest/node_modules/node-fetch/lib/index.js
generated
vendored
File diff suppressed because it is too large
Load diff
1686
node_modules/@discordjs/rest/node_modules/node-fetch/lib/index.mjs
generated
vendored
1686
node_modules/@discordjs/rest/node_modules/node-fetch/lib/index.mjs
generated
vendored
File diff suppressed because it is too large
Load diff
76
node_modules/@discordjs/rest/node_modules/node-fetch/package.json
generated
vendored
76
node_modules/@discordjs/rest/node_modules/node-fetch/package.json
generated
vendored
|
@ -1,76 +0,0 @@
|
||||||
{
|
|
||||||
"name": "node-fetch",
|
|
||||||
"version": "2.6.7",
|
|
||||||
"description": "A light-weight module that brings window.fetch to node.js",
|
|
||||||
"main": "lib/index.js",
|
|
||||||
"browser": "./browser.js",
|
|
||||||
"module": "lib/index.mjs",
|
|
||||||
"files": [
|
|
||||||
"lib/index.js",
|
|
||||||
"lib/index.mjs",
|
|
||||||
"lib/index.es.js",
|
|
||||||
"browser.js"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": "4.x || >=6.0.0"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"build": "cross-env BABEL_ENV=rollup rollup -c",
|
|
||||||
"prepare": "npm run build",
|
|
||||||
"test": "cross-env BABEL_ENV=test mocha --require babel-register --throw-deprecation test/test.js",
|
|
||||||
"report": "cross-env BABEL_ENV=coverage nyc --reporter lcov --reporter text mocha -R spec test/test.js",
|
|
||||||
"coverage": "cross-env BABEL_ENV=coverage nyc --reporter json --reporter text mocha -R spec test/test.js && codecov -f coverage/coverage-final.json"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/bitinn/node-fetch.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"fetch",
|
|
||||||
"http",
|
|
||||||
"promise"
|
|
||||||
],
|
|
||||||
"author": "David Frank",
|
|
||||||
"license": "MIT",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/bitinn/node-fetch/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/bitinn/node-fetch",
|
|
||||||
"dependencies": {
|
|
||||||
"whatwg-url": "^5.0.0"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"encoding": "^0.1.0"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"encoding": {
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@ungap/url-search-params": "^0.1.2",
|
|
||||||
"abort-controller": "^1.1.0",
|
|
||||||
"abortcontroller-polyfill": "^1.3.0",
|
|
||||||
"babel-core": "^6.26.3",
|
|
||||||
"babel-plugin-istanbul": "^4.1.6",
|
|
||||||
"babel-preset-env": "^1.6.1",
|
|
||||||
"babel-register": "^6.16.3",
|
|
||||||
"chai": "^3.5.0",
|
|
||||||
"chai-as-promised": "^7.1.1",
|
|
||||||
"chai-iterator": "^1.1.1",
|
|
||||||
"chai-string": "~1.3.0",
|
|
||||||
"codecov": "3.3.0",
|
|
||||||
"cross-env": "^5.2.0",
|
|
||||||
"form-data": "^2.3.3",
|
|
||||||
"is-builtin-module": "^1.0.0",
|
|
||||||
"mocha": "^5.0.0",
|
|
||||||
"nyc": "11.9.0",
|
|
||||||
"parted": "^0.1.1",
|
|
||||||
"promise": "^8.0.3",
|
|
||||||
"resumer": "0.0.0",
|
|
||||||
"rollup": "^0.63.4",
|
|
||||||
"rollup-plugin-babel": "^3.0.7",
|
|
||||||
"string-to-arraybuffer": "^1.0.2",
|
|
||||||
"teeny-request": "3.7.0"
|
|
||||||
}
|
|
||||||
}
|
|
89
node_modules/@discordjs/rest/package.json
generated
vendored
89
node_modules/@discordjs/rest/package.json
generated
vendored
|
@ -1,89 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@discordjs/rest",
|
|
||||||
"version": "0.3.0",
|
|
||||||
"description": "The REST API for discord.js",
|
|
||||||
"scripts": {
|
|
||||||
"build": "tsup && tsc --emitDeclarationOnly --incremental",
|
|
||||||
"test": "jest --pass-with-no-tests --collect-coverage",
|
|
||||||
"lint": "prettier --check . && eslint src __tests__ --ext mjs,js,ts",
|
|
||||||
"format": "prettier --write . && eslint src __tests__ --ext mjs,js,ts --fix",
|
|
||||||
"docs": "typedoc --json docs/typedoc-out.json src/index.ts && node scripts/docs.mjs",
|
|
||||||
"prepublishOnly": "yarn build && yarn lint && yarn test",
|
|
||||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/rest/*'"
|
|
||||||
},
|
|
||||||
"main": "./dist/index.js",
|
|
||||||
"module": "./dist/index.mjs",
|
|
||||||
"typings": "./dist/index.d.ts",
|
|
||||||
"exports": {
|
|
||||||
"import": "./dist/index.mjs",
|
|
||||||
"require": "./dist/index.js"
|
|
||||||
},
|
|
||||||
"directories": {
|
|
||||||
"lib": "src",
|
|
||||||
"test": "__tests__"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"dist"
|
|
||||||
],
|
|
||||||
"contributors": [
|
|
||||||
"Crawl <icrawltogo@gmail.com>",
|
|
||||||
"Amish Shah <amishshah.2k@gmail.com>",
|
|
||||||
"SpaceEEC <spaceeec@yahoo.com>",
|
|
||||||
"Vlad Frangu <kingdgrizzle@gmail.com>",
|
|
||||||
"Antonio Roman <kyradiscord@gmail.com>"
|
|
||||||
],
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"keywords": [
|
|
||||||
"discord",
|
|
||||||
"api",
|
|
||||||
"rest",
|
|
||||||
"discordapp",
|
|
||||||
"discordjs"
|
|
||||||
],
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/discordjs/discord.js.git"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/discordjs/discord.js/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://discord.js.org",
|
|
||||||
"dependencies": {
|
|
||||||
"@discordjs/collection": "^0.4.0",
|
|
||||||
"@sapphire/async-queue": "^1.1.9",
|
|
||||||
"@sapphire/snowflake": "^3.0.1",
|
|
||||||
"discord-api-types": "^0.26.1",
|
|
||||||
"form-data": "^4.0.0",
|
|
||||||
"node-fetch": "^2.6.5",
|
|
||||||
"tslib": "^2.3.1"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@babel/core": "^7.16.12",
|
|
||||||
"@babel/plugin-proposal-decorators": "^7.16.7",
|
|
||||||
"@babel/preset-env": "^7.16.11",
|
|
||||||
"@babel/preset-typescript": "^7.16.7",
|
|
||||||
"@discordjs/ts-docgen": "^0.3.4",
|
|
||||||
"@types/jest": "^27.4.0",
|
|
||||||
"@types/node-fetch": "^2.5.10",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
|
||||||
"@typescript-eslint/parser": "^5.10.0",
|
|
||||||
"babel-plugin-const-enum": "^1.2.0",
|
|
||||||
"babel-plugin-transform-typescript-metadata": "^0.3.2",
|
|
||||||
"eslint": "^8.7.0",
|
|
||||||
"eslint-config-marine": "^9.3.2",
|
|
||||||
"eslint-config-prettier": "^8.3.0",
|
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
|
||||||
"jest": "^27.4.7",
|
|
||||||
"nock": "^13.2.2",
|
|
||||||
"prettier": "^2.5.1",
|
|
||||||
"tsup": "^5.11.11",
|
|
||||||
"typedoc": "^0.22.11",
|
|
||||||
"typescript": "^4.5.5"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=16.9.0"
|
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
}
|
|
||||||
}
|
|
21
node_modules/@eslint/eslintrc/LICENSE
generated
vendored
21
node_modules/@eslint/eslintrc/LICENSE
generated
vendored
|
@ -1,21 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2020 ESLint
|
|
||||||
|
|
||||||
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.
|
|
61
node_modules/@eslint/eslintrc/README.md
generated
vendored
61
node_modules/@eslint/eslintrc/README.md
generated
vendored
|
@ -1,61 +0,0 @@
|
||||||
# ESLintRC Library
|
|
||||||
|
|
||||||
This repository contains the legacy ESLintRC configuration file format for ESLint.
|
|
||||||
|
|
||||||
**Note:** This package is not intended for use outside of the ESLint ecosystem. It is ESLint-specific and not intended for use in other programs.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
You can install the package as follows:
|
|
||||||
|
|
||||||
```
|
|
||||||
npm install @eslint/eslintrc --save-dev
|
|
||||||
|
|
||||||
# or
|
|
||||||
|
|
||||||
yarn add @eslint/eslintrc -D
|
|
||||||
```
|
|
||||||
|
|
||||||
## Future Usage
|
|
||||||
|
|
||||||
**Note:** This package is not intended for public use at this time. The following is an example of how it will be used in the future.
|
|
||||||
|
|
||||||
The primary class in this package is `FlatCompat`, which is a utility to translate ESLintRC-style configs into flat configs. Here's how you use it inside of your `eslint.config.js` file:
|
|
||||||
|
|
||||||
```js
|
|
||||||
import { FlatCompat } from "@eslint/eslintrc";
|
|
||||||
|
|
||||||
const compat = new FlatCompat();
|
|
||||||
|
|
||||||
export default [
|
|
||||||
|
|
||||||
// mimic ESLintRC-style extends
|
|
||||||
compat.extends("standard", "example"),
|
|
||||||
|
|
||||||
// mimic environments
|
|
||||||
compat.env({
|
|
||||||
es2020: true,
|
|
||||||
node: true
|
|
||||||
}),
|
|
||||||
|
|
||||||
// mimic plugins
|
|
||||||
compat.plugins("airbnb", "react"),
|
|
||||||
|
|
||||||
// translate an entire config
|
|
||||||
compat.config({
|
|
||||||
plugins: ["airbnb", "react"],
|
|
||||||
extends: "standard",
|
|
||||||
env: {
|
|
||||||
es2020: true,
|
|
||||||
node: true
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
semi: "error"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
];
|
|
||||||
```
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
MIT License
|
|
79
node_modules/@eslint/eslintrc/conf/config-schema.js
generated
vendored
79
node_modules/@eslint/eslintrc/conf/config-schema.js
generated
vendored
|
@ -1,79 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview Defines a schema for configs.
|
|
||||||
* @author Sylvan Mably
|
|
||||||
*/
|
|
||||||
|
|
||||||
const baseConfigProperties = {
|
|
||||||
$schema: { type: "string" },
|
|
||||||
env: { type: "object" },
|
|
||||||
extends: { $ref: "#/definitions/stringOrStrings" },
|
|
||||||
globals: { type: "object" },
|
|
||||||
overrides: {
|
|
||||||
type: "array",
|
|
||||||
items: { $ref: "#/definitions/overrideConfig" },
|
|
||||||
additionalItems: false
|
|
||||||
},
|
|
||||||
parser: { type: ["string", "null"] },
|
|
||||||
parserOptions: { type: "object" },
|
|
||||||
plugins: { type: "array" },
|
|
||||||
processor: { type: "string" },
|
|
||||||
rules: { type: "object" },
|
|
||||||
settings: { type: "object" },
|
|
||||||
noInlineConfig: { type: "boolean" },
|
|
||||||
reportUnusedDisableDirectives: { type: "boolean" },
|
|
||||||
|
|
||||||
ecmaFeatures: { type: "object" } // deprecated; logs a warning when used
|
|
||||||
};
|
|
||||||
|
|
||||||
const configSchema = {
|
|
||||||
definitions: {
|
|
||||||
stringOrStrings: {
|
|
||||||
oneOf: [
|
|
||||||
{ type: "string" },
|
|
||||||
{
|
|
||||||
type: "array",
|
|
||||||
items: { type: "string" },
|
|
||||||
additionalItems: false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
stringOrStringsRequired: {
|
|
||||||
oneOf: [
|
|
||||||
{ type: "string" },
|
|
||||||
{
|
|
||||||
type: "array",
|
|
||||||
items: { type: "string" },
|
|
||||||
additionalItems: false,
|
|
||||||
minItems: 1
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
// Config at top-level.
|
|
||||||
objectConfig: {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
root: { type: "boolean" },
|
|
||||||
ignorePatterns: { $ref: "#/definitions/stringOrStrings" },
|
|
||||||
...baseConfigProperties
|
|
||||||
},
|
|
||||||
additionalProperties: false
|
|
||||||
},
|
|
||||||
|
|
||||||
// Config in `overrides`.
|
|
||||||
overrideConfig: {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
excludedFiles: { $ref: "#/definitions/stringOrStrings" },
|
|
||||||
files: { $ref: "#/definitions/stringOrStringsRequired" },
|
|
||||||
...baseConfigProperties
|
|
||||||
},
|
|
||||||
required: ["files"],
|
|
||||||
additionalProperties: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
$ref: "#/definitions/objectConfig"
|
|
||||||
};
|
|
||||||
|
|
||||||
export default configSchema;
|
|
179
node_modules/@eslint/eslintrc/conf/environments.js
generated
vendored
179
node_modules/@eslint/eslintrc/conf/environments.js
generated
vendored
|
@ -1,179 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview Defines environment settings and globals.
|
|
||||||
* @author Elan Shanker
|
|
||||||
*/
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Requirements
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
import globals from "globals";
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Helpers
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the object that has difference.
|
|
||||||
* @param {Record<string,boolean>} current The newer object.
|
|
||||||
* @param {Record<string,boolean>} prev The older object.
|
|
||||||
* @returns {Record<string,boolean>} The difference object.
|
|
||||||
*/
|
|
||||||
function getDiff(current, prev) {
|
|
||||||
const retv = {};
|
|
||||||
|
|
||||||
for (const [key, value] of Object.entries(current)) {
|
|
||||||
if (!Object.hasOwnProperty.call(prev, key)) {
|
|
||||||
retv[key] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return retv;
|
|
||||||
}
|
|
||||||
|
|
||||||
const newGlobals2015 = getDiff(globals.es2015, globals.es5); // 19 variables such as Promise, Map, ...
|
|
||||||
const newGlobals2017 = {
|
|
||||||
Atomics: false,
|
|
||||||
SharedArrayBuffer: false
|
|
||||||
};
|
|
||||||
const newGlobals2020 = {
|
|
||||||
BigInt: false,
|
|
||||||
BigInt64Array: false,
|
|
||||||
BigUint64Array: false,
|
|
||||||
globalThis: false
|
|
||||||
};
|
|
||||||
|
|
||||||
const newGlobals2021 = {
|
|
||||||
AggregateError: false,
|
|
||||||
FinalizationRegistry: false,
|
|
||||||
WeakRef: false
|
|
||||||
};
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Public Interface
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/** @type {Map<string, import("../lib/shared/types").Environment>} */
|
|
||||||
export default new Map(Object.entries({
|
|
||||||
|
|
||||||
// Language
|
|
||||||
builtin: {
|
|
||||||
globals: globals.es5
|
|
||||||
},
|
|
||||||
es6: {
|
|
||||||
globals: newGlobals2015,
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: 6
|
|
||||||
}
|
|
||||||
},
|
|
||||||
es2015: {
|
|
||||||
globals: newGlobals2015,
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: 6
|
|
||||||
}
|
|
||||||
},
|
|
||||||
es2017: {
|
|
||||||
globals: { ...newGlobals2015, ...newGlobals2017 },
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: 8
|
|
||||||
}
|
|
||||||
},
|
|
||||||
es2020: {
|
|
||||||
globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020 },
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: 11
|
|
||||||
}
|
|
||||||
},
|
|
||||||
es2021: {
|
|
||||||
globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 },
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: 12
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// Platforms
|
|
||||||
browser: {
|
|
||||||
globals: globals.browser
|
|
||||||
},
|
|
||||||
node: {
|
|
||||||
globals: globals.node,
|
|
||||||
parserOptions: {
|
|
||||||
ecmaFeatures: {
|
|
||||||
globalReturn: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"shared-node-browser": {
|
|
||||||
globals: globals["shared-node-browser"]
|
|
||||||
},
|
|
||||||
worker: {
|
|
||||||
globals: globals.worker
|
|
||||||
},
|
|
||||||
serviceworker: {
|
|
||||||
globals: globals.serviceworker
|
|
||||||
},
|
|
||||||
|
|
||||||
// Frameworks
|
|
||||||
commonjs: {
|
|
||||||
globals: globals.commonjs,
|
|
||||||
parserOptions: {
|
|
||||||
ecmaFeatures: {
|
|
||||||
globalReturn: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
amd: {
|
|
||||||
globals: globals.amd
|
|
||||||
},
|
|
||||||
mocha: {
|
|
||||||
globals: globals.mocha
|
|
||||||
},
|
|
||||||
jasmine: {
|
|
||||||
globals: globals.jasmine
|
|
||||||
},
|
|
||||||
jest: {
|
|
||||||
globals: globals.jest
|
|
||||||
},
|
|
||||||
phantomjs: {
|
|
||||||
globals: globals.phantomjs
|
|
||||||
},
|
|
||||||
jquery: {
|
|
||||||
globals: globals.jquery
|
|
||||||
},
|
|
||||||
qunit: {
|
|
||||||
globals: globals.qunit
|
|
||||||
},
|
|
||||||
prototypejs: {
|
|
||||||
globals: globals.prototypejs
|
|
||||||
},
|
|
||||||
shelljs: {
|
|
||||||
globals: globals.shelljs
|
|
||||||
},
|
|
||||||
meteor: {
|
|
||||||
globals: globals.meteor
|
|
||||||
},
|
|
||||||
mongo: {
|
|
||||||
globals: globals.mongo
|
|
||||||
},
|
|
||||||
protractor: {
|
|
||||||
globals: globals.protractor
|
|
||||||
},
|
|
||||||
applescript: {
|
|
||||||
globals: globals.applescript
|
|
||||||
},
|
|
||||||
nashorn: {
|
|
||||||
globals: globals.nashorn
|
|
||||||
},
|
|
||||||
atomtest: {
|
|
||||||
globals: globals.atomtest
|
|
||||||
},
|
|
||||||
embertest: {
|
|
||||||
globals: globals.embertest
|
|
||||||
},
|
|
||||||
webextensions: {
|
|
||||||
globals: globals.webextensions
|
|
||||||
},
|
|
||||||
greasemonkey: {
|
|
||||||
globals: globals.greasemonkey
|
|
||||||
}
|
|
||||||
}));
|
|
12
node_modules/@eslint/eslintrc/conf/eslint-all.cjs
generated
vendored
12
node_modules/@eslint/eslintrc/conf/eslint-all.cjs
generated
vendored
|
@ -1,12 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview Stub eslint:all config
|
|
||||||
* @author Nicholas C. Zakas
|
|
||||||
*/
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
settings: {
|
|
||||||
"eslint:all": true
|
|
||||||
}
|
|
||||||
};
|
|
12
node_modules/@eslint/eslintrc/conf/eslint-recommended.cjs
generated
vendored
12
node_modules/@eslint/eslintrc/conf/eslint-recommended.cjs
generated
vendored
|
@ -1,12 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview Stub eslint:recommended config
|
|
||||||
* @author Nicholas C. Zakas
|
|
||||||
*/
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
settings: {
|
|
||||||
"eslint:recommended": true
|
|
||||||
}
|
|
||||||
};
|
|
1068
node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs
generated
vendored
1068
node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs
generated
vendored
File diff suppressed because it is too large
Load diff
1
node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map
generated
vendored
1
node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map
generated
vendored
File diff suppressed because one or more lines are too long
4236
node_modules/@eslint/eslintrc/dist/eslintrc.cjs
generated
vendored
4236
node_modules/@eslint/eslintrc/dist/eslintrc.cjs
generated
vendored
File diff suppressed because it is too large
Load diff
1
node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map
generated
vendored
1
node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map
generated
vendored
File diff suppressed because one or more lines are too long
520
node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js
generated
vendored
520
node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js
generated
vendored
|
@ -1,520 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview `CascadingConfigArrayFactory` class.
|
|
||||||
*
|
|
||||||
* `CascadingConfigArrayFactory` class has a responsibility:
|
|
||||||
*
|
|
||||||
* 1. Handles cascading of config files.
|
|
||||||
*
|
|
||||||
* It provides two methods:
|
|
||||||
*
|
|
||||||
* - `getConfigArrayForFile(filePath)`
|
|
||||||
* Get the corresponded configuration of a given file. This method doesn't
|
|
||||||
* throw even if the given file didn't exist.
|
|
||||||
* - `clearCache()`
|
|
||||||
* Clear the internal cache. You have to call this method when
|
|
||||||
* `additionalPluginPool` was updated if `baseConfig` or `cliConfig` depends
|
|
||||||
* on the additional plugins. (`CLIEngine#addPlugin()` method calls this.)
|
|
||||||
*
|
|
||||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
||||||
*/
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Requirements
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
import os from "os";
|
|
||||||
import path from "path";
|
|
||||||
import ConfigValidator from "./shared/config-validator.js";
|
|
||||||
import { emitDeprecationWarning } from "./shared/deprecation-warnings.js";
|
|
||||||
import { ConfigArrayFactory } from "./config-array-factory.js";
|
|
||||||
import { ConfigArray, ConfigDependency, IgnorePattern } from "./config-array/index.js";
|
|
||||||
import debugOrig from "debug";
|
|
||||||
|
|
||||||
const debug = debugOrig("eslintrc:cascading-config-array-factory");
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Helpers
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Define types for VSCode IntelliSense.
|
|
||||||
/** @typedef {import("./shared/types").ConfigData} ConfigData */
|
|
||||||
/** @typedef {import("./shared/types").Parser} Parser */
|
|
||||||
/** @typedef {import("./shared/types").Plugin} Plugin */
|
|
||||||
/** @typedef {import("./shared/types").Rule} Rule */
|
|
||||||
/** @typedef {ReturnType<ConfigArrayFactory["create"]>} ConfigArray */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} CascadingConfigArrayFactoryOptions
|
|
||||||
* @property {Map<string,Plugin>} [additionalPluginPool] The map for additional plugins.
|
|
||||||
* @property {ConfigData} [baseConfig] The config by `baseConfig` option.
|
|
||||||
* @property {ConfigData} [cliConfig] The config by CLI options (`--env`, `--global`, `--ignore-pattern`, `--parser`, `--parser-options`, `--plugin`, and `--rule`). CLI options overwrite the setting in config files.
|
|
||||||
* @property {string} [cwd] The base directory to start lookup.
|
|
||||||
* @property {string} [ignorePath] The path to the alternative file of `.eslintignore`.
|
|
||||||
* @property {string[]} [rulePaths] The value of `--rulesdir` option.
|
|
||||||
* @property {string} [specificConfigPath] The value of `--config` option.
|
|
||||||
* @property {boolean} [useEslintrc] if `false` then it doesn't load config files.
|
|
||||||
* @property {Function} loadRules The function to use to load rules.
|
|
||||||
* @property {Map<string,Rule>} builtInRules The rules that are built in to ESLint.
|
|
||||||
* @property {Object} [resolver=ModuleResolver] The module resolver object.
|
|
||||||
* @property {string} eslintAllPath The path to the definitions for eslint:all.
|
|
||||||
* @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} CascadingConfigArrayFactoryInternalSlots
|
|
||||||
* @property {ConfigArray} baseConfigArray The config array of `baseConfig` option.
|
|
||||||
* @property {ConfigData} baseConfigData The config data of `baseConfig` option. This is used to reset `baseConfigArray`.
|
|
||||||
* @property {ConfigArray} cliConfigArray The config array of CLI options.
|
|
||||||
* @property {ConfigData} cliConfigData The config data of CLI options. This is used to reset `cliConfigArray`.
|
|
||||||
* @property {ConfigArrayFactory} configArrayFactory The factory for config arrays.
|
|
||||||
* @property {Map<string, ConfigArray>} configCache The cache from directory paths to config arrays.
|
|
||||||
* @property {string} cwd The base directory to start lookup.
|
|
||||||
* @property {WeakMap<ConfigArray, ConfigArray>} finalizeCache The cache from config arrays to finalized config arrays.
|
|
||||||
* @property {string} [ignorePath] The path to the alternative file of `.eslintignore`.
|
|
||||||
* @property {string[]|null} rulePaths The value of `--rulesdir` option. This is used to reset `baseConfigArray`.
|
|
||||||
* @property {string|null} specificConfigPath The value of `--config` option. This is used to reset `cliConfigArray`.
|
|
||||||
* @property {boolean} useEslintrc if `false` then it doesn't load config files.
|
|
||||||
* @property {Function} loadRules The function to use to load rules.
|
|
||||||
* @property {Map<string,Rule>} builtInRules The rules that are built in to ESLint.
|
|
||||||
* @property {Object} [resolver=ModuleResolver] The module resolver object.
|
|
||||||
* @property {string} eslintAllPath The path to the definitions for eslint:all.
|
|
||||||
* @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @type {WeakMap<CascadingConfigArrayFactory, CascadingConfigArrayFactoryInternalSlots>} */
|
|
||||||
const internalSlotsMap = new WeakMap();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the config array from `baseConfig` and `rulePaths`.
|
|
||||||
* @param {CascadingConfigArrayFactoryInternalSlots} slots The slots.
|
|
||||||
* @returns {ConfigArray} The config array of the base configs.
|
|
||||||
*/
|
|
||||||
function createBaseConfigArray({
|
|
||||||
configArrayFactory,
|
|
||||||
baseConfigData,
|
|
||||||
rulePaths,
|
|
||||||
cwd,
|
|
||||||
loadRules
|
|
||||||
}) {
|
|
||||||
const baseConfigArray = configArrayFactory.create(
|
|
||||||
baseConfigData,
|
|
||||||
{ name: "BaseConfig" }
|
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create the config array element for the default ignore patterns.
|
|
||||||
* This element has `ignorePattern` property that ignores the default
|
|
||||||
* patterns in the current working directory.
|
|
||||||
*/
|
|
||||||
baseConfigArray.unshift(configArrayFactory.create(
|
|
||||||
{ ignorePatterns: IgnorePattern.DefaultPatterns },
|
|
||||||
{ name: "DefaultIgnorePattern" }
|
|
||||||
)[0]);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Load rules `--rulesdir` option as a pseudo plugin.
|
|
||||||
* Use a pseudo plugin to define rules of `--rulesdir`, so we can validate
|
|
||||||
* the rule's options with only information in the config array.
|
|
||||||
*/
|
|
||||||
if (rulePaths && rulePaths.length > 0) {
|
|
||||||
baseConfigArray.push({
|
|
||||||
type: "config",
|
|
||||||
name: "--rulesdir",
|
|
||||||
filePath: "",
|
|
||||||
plugins: {
|
|
||||||
"": new ConfigDependency({
|
|
||||||
definition: {
|
|
||||||
rules: rulePaths.reduce(
|
|
||||||
(map, rulesPath) => Object.assign(
|
|
||||||
map,
|
|
||||||
loadRules(rulesPath, cwd)
|
|
||||||
),
|
|
||||||
{}
|
|
||||||
)
|
|
||||||
},
|
|
||||||
filePath: "",
|
|
||||||
id: "",
|
|
||||||
importerName: "--rulesdir",
|
|
||||||
importerPath: ""
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return baseConfigArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the config array from CLI options.
|
|
||||||
* @param {CascadingConfigArrayFactoryInternalSlots} slots The slots.
|
|
||||||
* @returns {ConfigArray} The config array of the base configs.
|
|
||||||
*/
|
|
||||||
function createCLIConfigArray({
|
|
||||||
cliConfigData,
|
|
||||||
configArrayFactory,
|
|
||||||
cwd,
|
|
||||||
ignorePath,
|
|
||||||
specificConfigPath
|
|
||||||
}) {
|
|
||||||
const cliConfigArray = configArrayFactory.create(
|
|
||||||
cliConfigData,
|
|
||||||
{ name: "CLIOptions" }
|
|
||||||
);
|
|
||||||
|
|
||||||
cliConfigArray.unshift(
|
|
||||||
...(ignorePath
|
|
||||||
? configArrayFactory.loadESLintIgnore(ignorePath)
|
|
||||||
: configArrayFactory.loadDefaultESLintIgnore())
|
|
||||||
);
|
|
||||||
|
|
||||||
if (specificConfigPath) {
|
|
||||||
cliConfigArray.unshift(
|
|
||||||
...configArrayFactory.loadFile(
|
|
||||||
specificConfigPath,
|
|
||||||
{ name: "--config", basePath: cwd }
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return cliConfigArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The error type when there are files matched by a glob, but all of them have been ignored.
|
|
||||||
*/
|
|
||||||
class ConfigurationNotFoundError extends Error {
|
|
||||||
|
|
||||||
// eslint-disable-next-line jsdoc/require-description
|
|
||||||
/**
|
|
||||||
* @param {string} directoryPath The directory path.
|
|
||||||
*/
|
|
||||||
constructor(directoryPath) {
|
|
||||||
super(`No ESLint configuration found in ${directoryPath}.`);
|
|
||||||
this.messageTemplate = "no-config-found";
|
|
||||||
this.messageData = { directoryPath };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class provides the functionality that enumerates every file which is
|
|
||||||
* matched by given glob patterns and that configuration.
|
|
||||||
*/
|
|
||||||
class CascadingConfigArrayFactory {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize this enumerator.
|
|
||||||
* @param {CascadingConfigArrayFactoryOptions} options The options.
|
|
||||||
*/
|
|
||||||
constructor({
|
|
||||||
additionalPluginPool = new Map(),
|
|
||||||
baseConfig: baseConfigData = null,
|
|
||||||
cliConfig: cliConfigData = null,
|
|
||||||
cwd = process.cwd(),
|
|
||||||
ignorePath,
|
|
||||||
resolvePluginsRelativeTo,
|
|
||||||
rulePaths = [],
|
|
||||||
specificConfigPath = null,
|
|
||||||
useEslintrc = true,
|
|
||||||
builtInRules = new Map(),
|
|
||||||
loadRules,
|
|
||||||
resolver,
|
|
||||||
eslintRecommendedPath,
|
|
||||||
eslintAllPath
|
|
||||||
} = {}) {
|
|
||||||
const configArrayFactory = new ConfigArrayFactory({
|
|
||||||
additionalPluginPool,
|
|
||||||
cwd,
|
|
||||||
resolvePluginsRelativeTo,
|
|
||||||
builtInRules,
|
|
||||||
resolver,
|
|
||||||
eslintRecommendedPath,
|
|
||||||
eslintAllPath
|
|
||||||
});
|
|
||||||
|
|
||||||
internalSlotsMap.set(this, {
|
|
||||||
baseConfigArray: createBaseConfigArray({
|
|
||||||
baseConfigData,
|
|
||||||
configArrayFactory,
|
|
||||||
cwd,
|
|
||||||
rulePaths,
|
|
||||||
loadRules,
|
|
||||||
resolver
|
|
||||||
}),
|
|
||||||
baseConfigData,
|
|
||||||
cliConfigArray: createCLIConfigArray({
|
|
||||||
cliConfigData,
|
|
||||||
configArrayFactory,
|
|
||||||
cwd,
|
|
||||||
ignorePath,
|
|
||||||
specificConfigPath
|
|
||||||
}),
|
|
||||||
cliConfigData,
|
|
||||||
configArrayFactory,
|
|
||||||
configCache: new Map(),
|
|
||||||
cwd,
|
|
||||||
finalizeCache: new WeakMap(),
|
|
||||||
ignorePath,
|
|
||||||
rulePaths,
|
|
||||||
specificConfigPath,
|
|
||||||
useEslintrc,
|
|
||||||
builtInRules,
|
|
||||||
loadRules
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The path to the current working directory.
|
|
||||||
* This is used by tests.
|
|
||||||
* @type {string}
|
|
||||||
*/
|
|
||||||
get cwd() {
|
|
||||||
const { cwd } = internalSlotsMap.get(this);
|
|
||||||
|
|
||||||
return cwd;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the config array of a given file.
|
|
||||||
* If `filePath` was not given, it returns the config which contains only
|
|
||||||
* `baseConfigData` and `cliConfigData`.
|
|
||||||
* @param {string} [filePath] The file path to a file.
|
|
||||||
* @param {Object} [options] The options.
|
|
||||||
* @param {boolean} [options.ignoreNotFoundError] If `true` then it doesn't throw `ConfigurationNotFoundError`.
|
|
||||||
* @returns {ConfigArray} The config array of the file.
|
|
||||||
*/
|
|
||||||
getConfigArrayForFile(filePath, { ignoreNotFoundError = false } = {}) {
|
|
||||||
const {
|
|
||||||
baseConfigArray,
|
|
||||||
cliConfigArray,
|
|
||||||
cwd
|
|
||||||
} = internalSlotsMap.get(this);
|
|
||||||
|
|
||||||
if (!filePath) {
|
|
||||||
return new ConfigArray(...baseConfigArray, ...cliConfigArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
const directoryPath = path.dirname(path.resolve(cwd, filePath));
|
|
||||||
|
|
||||||
debug(`Load config files for ${directoryPath}.`);
|
|
||||||
|
|
||||||
return this._finalizeConfigArray(
|
|
||||||
this._loadConfigInAncestors(directoryPath),
|
|
||||||
directoryPath,
|
|
||||||
ignoreNotFoundError
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the config data to override all configs.
|
|
||||||
* Require to call `clearCache()` method after this method is called.
|
|
||||||
* @param {ConfigData} configData The config data to override all configs.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
setOverrideConfig(configData) {
|
|
||||||
const slots = internalSlotsMap.get(this);
|
|
||||||
|
|
||||||
slots.cliConfigData = configData;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear config cache.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
clearCache() {
|
|
||||||
const slots = internalSlotsMap.get(this);
|
|
||||||
|
|
||||||
slots.baseConfigArray = createBaseConfigArray(slots);
|
|
||||||
slots.cliConfigArray = createCLIConfigArray(slots);
|
|
||||||
slots.configCache.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load and normalize config files from the ancestor directories.
|
|
||||||
* @param {string} directoryPath The path to a leaf directory.
|
|
||||||
* @param {boolean} configsExistInSubdirs `true` if configurations exist in subdirectories.
|
|
||||||
* @returns {ConfigArray} The loaded config.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_loadConfigInAncestors(directoryPath, configsExistInSubdirs = false) {
|
|
||||||
const {
|
|
||||||
baseConfigArray,
|
|
||||||
configArrayFactory,
|
|
||||||
configCache,
|
|
||||||
cwd,
|
|
||||||
useEslintrc
|
|
||||||
} = internalSlotsMap.get(this);
|
|
||||||
|
|
||||||
if (!useEslintrc) {
|
|
||||||
return baseConfigArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
let configArray = configCache.get(directoryPath);
|
|
||||||
|
|
||||||
// Hit cache.
|
|
||||||
if (configArray) {
|
|
||||||
debug(`Cache hit: ${directoryPath}.`);
|
|
||||||
return configArray;
|
|
||||||
}
|
|
||||||
debug(`No cache found: ${directoryPath}.`);
|
|
||||||
|
|
||||||
const homePath = os.homedir();
|
|
||||||
|
|
||||||
// Consider this is root.
|
|
||||||
if (directoryPath === homePath && cwd !== homePath) {
|
|
||||||
debug("Stop traversing because of considered root.");
|
|
||||||
if (configsExistInSubdirs) {
|
|
||||||
const filePath = ConfigArrayFactory.getPathToConfigFileInDirectory(directoryPath);
|
|
||||||
|
|
||||||
if (filePath) {
|
|
||||||
emitDeprecationWarning(
|
|
||||||
filePath,
|
|
||||||
"ESLINT_PERSONAL_CONFIG_SUPPRESS"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this._cacheConfig(directoryPath, baseConfigArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the config on this directory.
|
|
||||||
try {
|
|
||||||
configArray = configArrayFactory.loadInDirectory(directoryPath);
|
|
||||||
} catch (error) {
|
|
||||||
/* istanbul ignore next */
|
|
||||||
if (error.code === "EACCES") {
|
|
||||||
debug("Stop traversing because of 'EACCES' error.");
|
|
||||||
return this._cacheConfig(directoryPath, baseConfigArray);
|
|
||||||
}
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (configArray.length > 0 && configArray.isRoot()) {
|
|
||||||
debug("Stop traversing because of 'root:true'.");
|
|
||||||
configArray.unshift(...baseConfigArray);
|
|
||||||
return this._cacheConfig(directoryPath, configArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load from the ancestors and merge it.
|
|
||||||
const parentPath = path.dirname(directoryPath);
|
|
||||||
const parentConfigArray = parentPath && parentPath !== directoryPath
|
|
||||||
? this._loadConfigInAncestors(
|
|
||||||
parentPath,
|
|
||||||
configsExistInSubdirs || configArray.length > 0
|
|
||||||
)
|
|
||||||
: baseConfigArray;
|
|
||||||
|
|
||||||
if (configArray.length > 0) {
|
|
||||||
configArray.unshift(...parentConfigArray);
|
|
||||||
} else {
|
|
||||||
configArray = parentConfigArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cache and return.
|
|
||||||
return this._cacheConfig(directoryPath, configArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Freeze and cache a given config.
|
|
||||||
* @param {string} directoryPath The path to a directory as a cache key.
|
|
||||||
* @param {ConfigArray} configArray The config array as a cache value.
|
|
||||||
* @returns {ConfigArray} The `configArray` (frozen).
|
|
||||||
*/
|
|
||||||
_cacheConfig(directoryPath, configArray) {
|
|
||||||
const { configCache } = internalSlotsMap.get(this);
|
|
||||||
|
|
||||||
Object.freeze(configArray);
|
|
||||||
configCache.set(directoryPath, configArray);
|
|
||||||
|
|
||||||
return configArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finalize a given config array.
|
|
||||||
* Concatenate `--config` and other CLI options.
|
|
||||||
* @param {ConfigArray} configArray The parent config array.
|
|
||||||
* @param {string} directoryPath The path to the leaf directory to find config files.
|
|
||||||
* @param {boolean} ignoreNotFoundError If `true` then it doesn't throw `ConfigurationNotFoundError`.
|
|
||||||
* @returns {ConfigArray} The loaded config.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_finalizeConfigArray(configArray, directoryPath, ignoreNotFoundError) {
|
|
||||||
const {
|
|
||||||
cliConfigArray,
|
|
||||||
configArrayFactory,
|
|
||||||
finalizeCache,
|
|
||||||
useEslintrc,
|
|
||||||
builtInRules
|
|
||||||
} = internalSlotsMap.get(this);
|
|
||||||
|
|
||||||
let finalConfigArray = finalizeCache.get(configArray);
|
|
||||||
|
|
||||||
if (!finalConfigArray) {
|
|
||||||
finalConfigArray = configArray;
|
|
||||||
|
|
||||||
// Load the personal config if there are no regular config files.
|
|
||||||
if (
|
|
||||||
useEslintrc &&
|
|
||||||
configArray.every(c => !c.filePath) &&
|
|
||||||
cliConfigArray.every(c => !c.filePath) // `--config` option can be a file.
|
|
||||||
) {
|
|
||||||
const homePath = os.homedir();
|
|
||||||
|
|
||||||
debug("Loading the config file of the home directory:", homePath);
|
|
||||||
|
|
||||||
const personalConfigArray = configArrayFactory.loadInDirectory(
|
|
||||||
homePath,
|
|
||||||
{ name: "PersonalConfig" }
|
|
||||||
);
|
|
||||||
|
|
||||||
if (
|
|
||||||
personalConfigArray.length > 0 &&
|
|
||||||
!directoryPath.startsWith(homePath)
|
|
||||||
) {
|
|
||||||
const lastElement =
|
|
||||||
personalConfigArray[personalConfigArray.length - 1];
|
|
||||||
|
|
||||||
emitDeprecationWarning(
|
|
||||||
lastElement.filePath,
|
|
||||||
"ESLINT_PERSONAL_CONFIG_LOAD"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
finalConfigArray = finalConfigArray.concat(personalConfigArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply CLI options.
|
|
||||||
if (cliConfigArray.length > 0) {
|
|
||||||
finalConfigArray = finalConfigArray.concat(cliConfigArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate rule settings and environments.
|
|
||||||
const validator = new ConfigValidator({
|
|
||||||
builtInRules
|
|
||||||
});
|
|
||||||
|
|
||||||
validator.validateConfigArray(finalConfigArray);
|
|
||||||
|
|
||||||
// Cache it.
|
|
||||||
Object.freeze(finalConfigArray);
|
|
||||||
finalizeCache.set(configArray, finalConfigArray);
|
|
||||||
|
|
||||||
debug(
|
|
||||||
"Configuration was determined: %o on %s",
|
|
||||||
finalConfigArray,
|
|
||||||
directoryPath
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// At least one element (the default ignore patterns) exists.
|
|
||||||
if (!ignoreNotFoundError && useEslintrc && finalConfigArray.length <= 1) {
|
|
||||||
throw new ConfigurationNotFoundError(directoryPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
return finalConfigArray;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Public Interface
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export { CascadingConfigArrayFactory };
|
|
1103
node_modules/@eslint/eslintrc/lib/config-array-factory.js
generated
vendored
1103
node_modules/@eslint/eslintrc/lib/config-array-factory.js
generated
vendored
File diff suppressed because it is too large
Load diff
523
node_modules/@eslint/eslintrc/lib/config-array/config-array.js
generated
vendored
523
node_modules/@eslint/eslintrc/lib/config-array/config-array.js
generated
vendored
|
@ -1,523 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview `ConfigArray` class.
|
|
||||||
*
|
|
||||||
* `ConfigArray` class expresses the full of a configuration. It has the entry
|
|
||||||
* config file, base config files that were extended, loaded parsers, and loaded
|
|
||||||
* plugins.
|
|
||||||
*
|
|
||||||
* `ConfigArray` class provides three properties and two methods.
|
|
||||||
*
|
|
||||||
* - `pluginEnvironments`
|
|
||||||
* - `pluginProcessors`
|
|
||||||
* - `pluginRules`
|
|
||||||
* The `Map` objects that contain the members of all plugins that this
|
|
||||||
* config array contains. Those map objects don't have mutation methods.
|
|
||||||
* Those keys are the member ID such as `pluginId/memberName`.
|
|
||||||
* - `isRoot()`
|
|
||||||
* If `true` then this configuration has `root:true` property.
|
|
||||||
* - `extractConfig(filePath)`
|
|
||||||
* Extract the final configuration for a given file. This means merging
|
|
||||||
* every config array element which that `criteria` property matched. The
|
|
||||||
* `filePath` argument must be an absolute path.
|
|
||||||
*
|
|
||||||
* `ConfigArrayFactory` provides the loading logic of config files.
|
|
||||||
*
|
|
||||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
||||||
*/
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Requirements
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
import { ExtractedConfig } from "./extracted-config.js";
|
|
||||||
import { IgnorePattern } from "./ignore-pattern.js";
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Helpers
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Define types for VSCode IntelliSense.
|
|
||||||
/** @typedef {import("../../shared/types").Environment} Environment */
|
|
||||||
/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */
|
|
||||||
/** @typedef {import("../../shared/types").RuleConf} RuleConf */
|
|
||||||
/** @typedef {import("../../shared/types").Rule} Rule */
|
|
||||||
/** @typedef {import("../../shared/types").Plugin} Plugin */
|
|
||||||
/** @typedef {import("../../shared/types").Processor} Processor */
|
|
||||||
/** @typedef {import("./config-dependency").DependentParser} DependentParser */
|
|
||||||
/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */
|
|
||||||
/** @typedef {import("./override-tester")["OverrideTester"]} OverrideTester */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} ConfigArrayElement
|
|
||||||
* @property {string} name The name of this config element.
|
|
||||||
* @property {string} filePath The path to the source file of this config element.
|
|
||||||
* @property {InstanceType<OverrideTester>|null} criteria The tester for the `files` and `excludedFiles` of this config element.
|
|
||||||
* @property {Record<string, boolean>|undefined} env The environment settings.
|
|
||||||
* @property {Record<string, GlobalConf>|undefined} globals The global variable settings.
|
|
||||||
* @property {IgnorePattern|undefined} ignorePattern The ignore patterns.
|
|
||||||
* @property {boolean|undefined} noInlineConfig The flag that disables directive comments.
|
|
||||||
* @property {DependentParser|undefined} parser The parser loader.
|
|
||||||
* @property {Object|undefined} parserOptions The parser options.
|
|
||||||
* @property {Record<string, DependentPlugin>|undefined} plugins The plugin loaders.
|
|
||||||
* @property {string|undefined} processor The processor name to refer plugin's processor.
|
|
||||||
* @property {boolean|undefined} reportUnusedDisableDirectives The flag to report unused `eslint-disable` comments.
|
|
||||||
* @property {boolean|undefined} root The flag to express root.
|
|
||||||
* @property {Record<string, RuleConf>|undefined} rules The rule settings
|
|
||||||
* @property {Object|undefined} settings The shared settings.
|
|
||||||
* @property {"config" | "ignore" | "implicit-processor"} type The element type.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} ConfigArrayInternalSlots
|
|
||||||
* @property {Map<string, ExtractedConfig>} cache The cache to extract configs.
|
|
||||||
* @property {ReadonlyMap<string, Environment>|null} envMap The map from environment ID to environment definition.
|
|
||||||
* @property {ReadonlyMap<string, Processor>|null} processorMap The map from processor ID to environment definition.
|
|
||||||
* @property {ReadonlyMap<string, Rule>|null} ruleMap The map from rule ID to rule definition.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @type {WeakMap<ConfigArray, ConfigArrayInternalSlots>} */
|
|
||||||
const internalSlotsMap = new class extends WeakMap {
|
|
||||||
get(key) {
|
|
||||||
let value = super.get(key);
|
|
||||||
|
|
||||||
if (!value) {
|
|
||||||
value = {
|
|
||||||
cache: new Map(),
|
|
||||||
envMap: null,
|
|
||||||
processorMap: null,
|
|
||||||
ruleMap: null
|
|
||||||
};
|
|
||||||
super.set(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the indices which are matched to a given file.
|
|
||||||
* @param {ConfigArrayElement[]} elements The elements.
|
|
||||||
* @param {string} filePath The path to a target file.
|
|
||||||
* @returns {number[]} The indices.
|
|
||||||
*/
|
|
||||||
function getMatchedIndices(elements, filePath) {
|
|
||||||
const indices = [];
|
|
||||||
|
|
||||||
for (let i = elements.length - 1; i >= 0; --i) {
|
|
||||||
const element = elements[i];
|
|
||||||
|
|
||||||
if (!element.criteria || (filePath && element.criteria.test(filePath))) {
|
|
||||||
indices.push(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return indices;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if a value is a non-null object.
|
|
||||||
* @param {any} x The value to check.
|
|
||||||
* @returns {boolean} `true` if the value is a non-null object.
|
|
||||||
*/
|
|
||||||
function isNonNullObject(x) {
|
|
||||||
return typeof x === "object" && x !== null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Merge two objects.
|
|
||||||
*
|
|
||||||
* Assign every property values of `y` to `x` if `x` doesn't have the property.
|
|
||||||
* If `x`'s property value is an object, it does recursive.
|
|
||||||
* @param {Object} target The destination to merge
|
|
||||||
* @param {Object|undefined} source The source to merge.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
function mergeWithoutOverwrite(target, source) {
|
|
||||||
if (!isNonNullObject(source)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const key of Object.keys(source)) {
|
|
||||||
if (key === "__proto__") {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isNonNullObject(target[key])) {
|
|
||||||
mergeWithoutOverwrite(target[key], source[key]);
|
|
||||||
} else if (target[key] === void 0) {
|
|
||||||
if (isNonNullObject(source[key])) {
|
|
||||||
target[key] = Array.isArray(source[key]) ? [] : {};
|
|
||||||
mergeWithoutOverwrite(target[key], source[key]);
|
|
||||||
} else if (source[key] !== void 0) {
|
|
||||||
target[key] = source[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The error for plugin conflicts.
|
|
||||||
*/
|
|
||||||
class PluginConflictError extends Error {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize this error object.
|
|
||||||
* @param {string} pluginId The plugin ID.
|
|
||||||
* @param {{filePath:string, importerName:string}[]} plugins The resolved plugins.
|
|
||||||
*/
|
|
||||||
constructor(pluginId, plugins) {
|
|
||||||
super(`Plugin "${pluginId}" was conflicted between ${plugins.map(p => `"${p.importerName}"`).join(" and ")}.`);
|
|
||||||
this.messageTemplate = "plugin-conflict";
|
|
||||||
this.messageData = { pluginId, plugins };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Merge plugins.
|
|
||||||
* `target`'s definition is prior to `source`'s.
|
|
||||||
* @param {Record<string, DependentPlugin>} target The destination to merge
|
|
||||||
* @param {Record<string, DependentPlugin>|undefined} source The source to merge.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
function mergePlugins(target, source) {
|
|
||||||
if (!isNonNullObject(source)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const key of Object.keys(source)) {
|
|
||||||
if (key === "__proto__") {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const targetValue = target[key];
|
|
||||||
const sourceValue = source[key];
|
|
||||||
|
|
||||||
// Adopt the plugin which was found at first.
|
|
||||||
if (targetValue === void 0) {
|
|
||||||
if (sourceValue.error) {
|
|
||||||
throw sourceValue.error;
|
|
||||||
}
|
|
||||||
target[key] = sourceValue;
|
|
||||||
} else if (sourceValue.filePath !== targetValue.filePath) {
|
|
||||||
throw new PluginConflictError(key, [
|
|
||||||
{
|
|
||||||
filePath: targetValue.filePath,
|
|
||||||
importerName: targetValue.importerName
|
|
||||||
},
|
|
||||||
{
|
|
||||||
filePath: sourceValue.filePath,
|
|
||||||
importerName: sourceValue.importerName
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Merge rule configs.
|
|
||||||
* `target`'s definition is prior to `source`'s.
|
|
||||||
* @param {Record<string, Array>} target The destination to merge
|
|
||||||
* @param {Record<string, RuleConf>|undefined} source The source to merge.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
function mergeRuleConfigs(target, source) {
|
|
||||||
if (!isNonNullObject(source)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const key of Object.keys(source)) {
|
|
||||||
if (key === "__proto__") {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const targetDef = target[key];
|
|
||||||
const sourceDef = source[key];
|
|
||||||
|
|
||||||
// Adopt the rule config which was found at first.
|
|
||||||
if (targetDef === void 0) {
|
|
||||||
if (Array.isArray(sourceDef)) {
|
|
||||||
target[key] = [...sourceDef];
|
|
||||||
} else {
|
|
||||||
target[key] = [sourceDef];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If the first found rule config is severity only and the current rule
|
|
||||||
* config has options, merge the severity and the options.
|
|
||||||
*/
|
|
||||||
} else if (
|
|
||||||
targetDef.length === 1 &&
|
|
||||||
Array.isArray(sourceDef) &&
|
|
||||||
sourceDef.length >= 2
|
|
||||||
) {
|
|
||||||
targetDef.push(...sourceDef.slice(1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the extracted config.
|
|
||||||
* @param {ConfigArray} instance The config elements.
|
|
||||||
* @param {number[]} indices The indices to use.
|
|
||||||
* @returns {ExtractedConfig} The extracted config.
|
|
||||||
*/
|
|
||||||
function createConfig(instance, indices) {
|
|
||||||
const config = new ExtractedConfig();
|
|
||||||
const ignorePatterns = [];
|
|
||||||
|
|
||||||
// Merge elements.
|
|
||||||
for (const index of indices) {
|
|
||||||
const element = instance[index];
|
|
||||||
|
|
||||||
// Adopt the parser which was found at first.
|
|
||||||
if (!config.parser && element.parser) {
|
|
||||||
if (element.parser.error) {
|
|
||||||
throw element.parser.error;
|
|
||||||
}
|
|
||||||
config.parser = element.parser;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adopt the processor which was found at first.
|
|
||||||
if (!config.processor && element.processor) {
|
|
||||||
config.processor = element.processor;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adopt the noInlineConfig which was found at first.
|
|
||||||
if (config.noInlineConfig === void 0 && element.noInlineConfig !== void 0) {
|
|
||||||
config.noInlineConfig = element.noInlineConfig;
|
|
||||||
config.configNameOfNoInlineConfig = element.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adopt the reportUnusedDisableDirectives which was found at first.
|
|
||||||
if (config.reportUnusedDisableDirectives === void 0 && element.reportUnusedDisableDirectives !== void 0) {
|
|
||||||
config.reportUnusedDisableDirectives = element.reportUnusedDisableDirectives;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Collect ignorePatterns
|
|
||||||
if (element.ignorePattern) {
|
|
||||||
ignorePatterns.push(element.ignorePattern);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Merge others.
|
|
||||||
mergeWithoutOverwrite(config.env, element.env);
|
|
||||||
mergeWithoutOverwrite(config.globals, element.globals);
|
|
||||||
mergeWithoutOverwrite(config.parserOptions, element.parserOptions);
|
|
||||||
mergeWithoutOverwrite(config.settings, element.settings);
|
|
||||||
mergePlugins(config.plugins, element.plugins);
|
|
||||||
mergeRuleConfigs(config.rules, element.rules);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the predicate function for ignore patterns.
|
|
||||||
if (ignorePatterns.length > 0) {
|
|
||||||
config.ignores = IgnorePattern.createIgnore(ignorePatterns.reverse());
|
|
||||||
}
|
|
||||||
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Collect definitions.
|
|
||||||
* @template T, U
|
|
||||||
* @param {string} pluginId The plugin ID for prefix.
|
|
||||||
* @param {Record<string,T>} defs The definitions to collect.
|
|
||||||
* @param {Map<string, U>} map The map to output.
|
|
||||||
* @param {function(T): U} [normalize] The normalize function for each value.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
function collect(pluginId, defs, map, normalize) {
|
|
||||||
if (defs) {
|
|
||||||
const prefix = pluginId && `${pluginId}/`;
|
|
||||||
|
|
||||||
for (const [key, value] of Object.entries(defs)) {
|
|
||||||
map.set(
|
|
||||||
`${prefix}${key}`,
|
|
||||||
normalize ? normalize(value) : value
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Normalize a rule definition.
|
|
||||||
* @param {Function|Rule} rule The rule definition to normalize.
|
|
||||||
* @returns {Rule} The normalized rule definition.
|
|
||||||
*/
|
|
||||||
function normalizePluginRule(rule) {
|
|
||||||
return typeof rule === "function" ? { create: rule } : rule;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete the mutation methods from a given map.
|
|
||||||
* @param {Map<any, any>} map The map object to delete.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
function deleteMutationMethods(map) {
|
|
||||||
Object.defineProperties(map, {
|
|
||||||
clear: { configurable: true, value: void 0 },
|
|
||||||
delete: { configurable: true, value: void 0 },
|
|
||||||
set: { configurable: true, value: void 0 }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array.
|
|
||||||
* @param {ConfigArrayElement[]} elements The config elements.
|
|
||||||
* @param {ConfigArrayInternalSlots} slots The internal slots.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
function initPluginMemberMaps(elements, slots) {
|
|
||||||
const processed = new Set();
|
|
||||||
|
|
||||||
slots.envMap = new Map();
|
|
||||||
slots.processorMap = new Map();
|
|
||||||
slots.ruleMap = new Map();
|
|
||||||
|
|
||||||
for (const element of elements) {
|
|
||||||
if (!element.plugins) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const [pluginId, value] of Object.entries(element.plugins)) {
|
|
||||||
const plugin = value.definition;
|
|
||||||
|
|
||||||
if (!plugin || processed.has(pluginId)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
processed.add(pluginId);
|
|
||||||
|
|
||||||
collect(pluginId, plugin.environments, slots.envMap);
|
|
||||||
collect(pluginId, plugin.processors, slots.processorMap);
|
|
||||||
collect(pluginId, plugin.rules, slots.ruleMap, normalizePluginRule);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteMutationMethods(slots.envMap);
|
|
||||||
deleteMutationMethods(slots.processorMap);
|
|
||||||
deleteMutationMethods(slots.ruleMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array.
|
|
||||||
* @param {ConfigArray} instance The config elements.
|
|
||||||
* @returns {ConfigArrayInternalSlots} The extracted config.
|
|
||||||
*/
|
|
||||||
function ensurePluginMemberMaps(instance) {
|
|
||||||
const slots = internalSlotsMap.get(instance);
|
|
||||||
|
|
||||||
if (!slots.ruleMap) {
|
|
||||||
initPluginMemberMaps(instance, slots);
|
|
||||||
}
|
|
||||||
|
|
||||||
return slots;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Public Interface
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Config Array.
|
|
||||||
*
|
|
||||||
* `ConfigArray` instance contains all settings, parsers, and plugins.
|
|
||||||
* You need to call `ConfigArray#extractConfig(filePath)` method in order to
|
|
||||||
* extract, merge and get only the config data which is related to an arbitrary
|
|
||||||
* file.
|
|
||||||
* @extends {Array<ConfigArrayElement>}
|
|
||||||
*/
|
|
||||||
class ConfigArray extends Array {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the plugin environments.
|
|
||||||
* The returned map cannot be mutated.
|
|
||||||
* @type {ReadonlyMap<string, Environment>} The plugin environments.
|
|
||||||
*/
|
|
||||||
get pluginEnvironments() {
|
|
||||||
return ensurePluginMemberMaps(this).envMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the plugin processors.
|
|
||||||
* The returned map cannot be mutated.
|
|
||||||
* @type {ReadonlyMap<string, Processor>} The plugin processors.
|
|
||||||
*/
|
|
||||||
get pluginProcessors() {
|
|
||||||
return ensurePluginMemberMaps(this).processorMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the plugin rules.
|
|
||||||
* The returned map cannot be mutated.
|
|
||||||
* @returns {ReadonlyMap<string, Rule>} The plugin rules.
|
|
||||||
*/
|
|
||||||
get pluginRules() {
|
|
||||||
return ensurePluginMemberMaps(this).ruleMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if this config has `root` flag.
|
|
||||||
* @returns {boolean} `true` if this config array is root.
|
|
||||||
*/
|
|
||||||
isRoot() {
|
|
||||||
for (let i = this.length - 1; i >= 0; --i) {
|
|
||||||
const root = this[i].root;
|
|
||||||
|
|
||||||
if (typeof root === "boolean") {
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extract the config data which is related to a given file.
|
|
||||||
* @param {string} filePath The absolute path to the target file.
|
|
||||||
* @returns {ExtractedConfig} The extracted config data.
|
|
||||||
*/
|
|
||||||
extractConfig(filePath) {
|
|
||||||
const { cache } = internalSlotsMap.get(this);
|
|
||||||
const indices = getMatchedIndices(this, filePath);
|
|
||||||
const cacheKey = indices.join(",");
|
|
||||||
|
|
||||||
if (!cache.has(cacheKey)) {
|
|
||||||
cache.set(cacheKey, createConfig(this, indices));
|
|
||||||
}
|
|
||||||
|
|
||||||
return cache.get(cacheKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if a given path is an additional lint target.
|
|
||||||
* @param {string} filePath The absolute path to the target file.
|
|
||||||
* @returns {boolean} `true` if the file is an additional lint target.
|
|
||||||
*/
|
|
||||||
isAdditionalTargetPath(filePath) {
|
|
||||||
for (const { criteria, type } of this) {
|
|
||||||
if (
|
|
||||||
type === "config" &&
|
|
||||||
criteria &&
|
|
||||||
!criteria.endsWithWildcard &&
|
|
||||||
criteria.test(filePath)
|
|
||||||
) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the used extracted configs.
|
|
||||||
* CLIEngine will use this method to collect used deprecated rules.
|
|
||||||
* @param {ConfigArray} instance The config array object to get.
|
|
||||||
* @returns {ExtractedConfig[]} The used extracted configs.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
function getUsedExtractedConfigs(instance) {
|
|
||||||
const { cache } = internalSlotsMap.get(instance);
|
|
||||||
|
|
||||||
return Array.from(cache.values());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export {
|
|
||||||
ConfigArray,
|
|
||||||
getUsedExtractedConfigs
|
|
||||||
};
|
|
115
node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js
generated
vendored
115
node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js
generated
vendored
|
@ -1,115 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview `ConfigDependency` class.
|
|
||||||
*
|
|
||||||
* `ConfigDependency` class expresses a loaded parser or plugin.
|
|
||||||
*
|
|
||||||
* If the parser or plugin was loaded successfully, it has `definition` property
|
|
||||||
* and `filePath` property. Otherwise, it has `error` property.
|
|
||||||
*
|
|
||||||
* When `JSON.stringify()` converted a `ConfigDependency` object to a JSON, it
|
|
||||||
* omits `definition` property.
|
|
||||||
*
|
|
||||||
* `ConfigArrayFactory` creates `ConfigDependency` objects when it loads parsers
|
|
||||||
* or plugins.
|
|
||||||
*
|
|
||||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
||||||
*/
|
|
||||||
|
|
||||||
import util from "util";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The class is to store parsers or plugins.
|
|
||||||
* This class hides the loaded object from `JSON.stringify()` and `console.log`.
|
|
||||||
* @template T
|
|
||||||
*/
|
|
||||||
class ConfigDependency {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize this instance.
|
|
||||||
* @param {Object} data The dependency data.
|
|
||||||
* @param {T} [data.definition] The dependency if the loading succeeded.
|
|
||||||
* @param {Error} [data.error] The error object if the loading failed.
|
|
||||||
* @param {string} [data.filePath] The actual path to the dependency if the loading succeeded.
|
|
||||||
* @param {string} data.id The ID of this dependency.
|
|
||||||
* @param {string} data.importerName The name of the config file which loads this dependency.
|
|
||||||
* @param {string} data.importerPath The path to the config file which loads this dependency.
|
|
||||||
*/
|
|
||||||
constructor({
|
|
||||||
definition = null,
|
|
||||||
error = null,
|
|
||||||
filePath = null,
|
|
||||||
id,
|
|
||||||
importerName,
|
|
||||||
importerPath
|
|
||||||
}) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The loaded dependency if the loading succeeded.
|
|
||||||
* @type {T|null}
|
|
||||||
*/
|
|
||||||
this.definition = definition;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The error object if the loading failed.
|
|
||||||
* @type {Error|null}
|
|
||||||
*/
|
|
||||||
this.error = error;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The loaded dependency if the loading succeeded.
|
|
||||||
* @type {string|null}
|
|
||||||
*/
|
|
||||||
this.filePath = filePath;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The ID of this dependency.
|
|
||||||
* @type {string}
|
|
||||||
*/
|
|
||||||
this.id = id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The name of the config file which loads this dependency.
|
|
||||||
* @type {string}
|
|
||||||
*/
|
|
||||||
this.importerName = importerName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The path to the config file which loads this dependency.
|
|
||||||
* @type {string}
|
|
||||||
*/
|
|
||||||
this.importerPath = importerPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line jsdoc/require-description
|
|
||||||
/**
|
|
||||||
* @returns {Object} a JSON compatible object.
|
|
||||||
*/
|
|
||||||
toJSON() {
|
|
||||||
const obj = this[util.inspect.custom]();
|
|
||||||
|
|
||||||
// Display `error.message` (`Error#message` is unenumerable).
|
|
||||||
if (obj.error instanceof Error) {
|
|
||||||
obj.error = { ...obj.error, message: obj.error.message };
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line jsdoc/require-description
|
|
||||||
/**
|
|
||||||
* @returns {Object} an object to display by `console.log()`.
|
|
||||||
*/
|
|
||||||
[util.inspect.custom]() {
|
|
||||||
const {
|
|
||||||
definition: _ignore, // eslint-disable-line no-unused-vars
|
|
||||||
...obj
|
|
||||||
} = this;
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @typedef {ConfigDependency<import("../../shared/types").Parser>} DependentParser */
|
|
||||||
/** @typedef {ConfigDependency<import("../../shared/types").Plugin>} DependentPlugin */
|
|
||||||
|
|
||||||
export { ConfigDependency };
|
|
145
node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js
generated
vendored
145
node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js
generated
vendored
|
@ -1,145 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview `ExtractedConfig` class.
|
|
||||||
*
|
|
||||||
* `ExtractedConfig` class expresses a final configuration for a specific file.
|
|
||||||
*
|
|
||||||
* It provides one method.
|
|
||||||
*
|
|
||||||
* - `toCompatibleObjectAsConfigFileContent()`
|
|
||||||
* Convert this configuration to the compatible object as the content of
|
|
||||||
* config files. It converts the loaded parser and plugins to strings.
|
|
||||||
* `CLIEngine#getConfigForFile(filePath)` method uses this method.
|
|
||||||
*
|
|
||||||
* `ConfigArray#extractConfig(filePath)` creates a `ExtractedConfig` instance.
|
|
||||||
*
|
|
||||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { IgnorePattern } from "./ignore-pattern.js";
|
|
||||||
|
|
||||||
// For VSCode intellisense
|
|
||||||
/** @typedef {import("../../shared/types").ConfigData} ConfigData */
|
|
||||||
/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */
|
|
||||||
/** @typedef {import("../../shared/types").SeverityConf} SeverityConf */
|
|
||||||
/** @typedef {import("./config-dependency").DependentParser} DependentParser */
|
|
||||||
/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if `xs` starts with `ys`.
|
|
||||||
* @template T
|
|
||||||
* @param {T[]} xs The array to check.
|
|
||||||
* @param {T[]} ys The array that may be the first part of `xs`.
|
|
||||||
* @returns {boolean} `true` if `xs` starts with `ys`.
|
|
||||||
*/
|
|
||||||
function startsWith(xs, ys) {
|
|
||||||
return xs.length >= ys.length && ys.every((y, i) => y === xs[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The class for extracted config data.
|
|
||||||
*/
|
|
||||||
class ExtractedConfig {
|
|
||||||
constructor() {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The config name what `noInlineConfig` setting came from.
|
|
||||||
* @type {string}
|
|
||||||
*/
|
|
||||||
this.configNameOfNoInlineConfig = "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Environments.
|
|
||||||
* @type {Record<string, boolean>}
|
|
||||||
*/
|
|
||||||
this.env = {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Global variables.
|
|
||||||
* @type {Record<string, GlobalConf>}
|
|
||||||
*/
|
|
||||||
this.globals = {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The glob patterns that ignore to lint.
|
|
||||||
* @type {(((filePath:string, dot?:boolean) => boolean) & { basePath:string; patterns:string[] }) | undefined}
|
|
||||||
*/
|
|
||||||
this.ignores = void 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The flag that disables directive comments.
|
|
||||||
* @type {boolean|undefined}
|
|
||||||
*/
|
|
||||||
this.noInlineConfig = void 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parser definition.
|
|
||||||
* @type {DependentParser|null}
|
|
||||||
*/
|
|
||||||
this.parser = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Options for the parser.
|
|
||||||
* @type {Object}
|
|
||||||
*/
|
|
||||||
this.parserOptions = {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Plugin definitions.
|
|
||||||
* @type {Record<string, DependentPlugin>}
|
|
||||||
*/
|
|
||||||
this.plugins = {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Processor ID.
|
|
||||||
* @type {string|null}
|
|
||||||
*/
|
|
||||||
this.processor = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The flag that reports unused `eslint-disable` directive comments.
|
|
||||||
* @type {boolean|undefined}
|
|
||||||
*/
|
|
||||||
this.reportUnusedDisableDirectives = void 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rule settings.
|
|
||||||
* @type {Record<string, [SeverityConf, ...any[]]>}
|
|
||||||
*/
|
|
||||||
this.rules = {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shared settings.
|
|
||||||
* @type {Object}
|
|
||||||
*/
|
|
||||||
this.settings = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert this config to the compatible object as a config file content.
|
|
||||||
* @returns {ConfigData} The converted object.
|
|
||||||
*/
|
|
||||||
toCompatibleObjectAsConfigFileContent() {
|
|
||||||
const {
|
|
||||||
/* eslint-disable no-unused-vars */
|
|
||||||
configNameOfNoInlineConfig: _ignore1,
|
|
||||||
processor: _ignore2,
|
|
||||||
/* eslint-enable no-unused-vars */
|
|
||||||
ignores,
|
|
||||||
...config
|
|
||||||
} = this;
|
|
||||||
|
|
||||||
config.parser = config.parser && config.parser.filePath;
|
|
||||||
config.plugins = Object.keys(config.plugins).filter(Boolean).reverse();
|
|
||||||
config.ignorePatterns = ignores ? ignores.patterns : [];
|
|
||||||
|
|
||||||
// Strip the default patterns from `ignorePatterns`.
|
|
||||||
if (startsWith(config.ignorePatterns, IgnorePattern.DefaultPatterns)) {
|
|
||||||
config.ignorePatterns =
|
|
||||||
config.ignorePatterns.slice(IgnorePattern.DefaultPatterns.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { ExtractedConfig };
|
|
238
node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js
generated
vendored
238
node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js
generated
vendored
|
@ -1,238 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview `IgnorePattern` class.
|
|
||||||
*
|
|
||||||
* `IgnorePattern` class has the set of glob patterns and the base path.
|
|
||||||
*
|
|
||||||
* It provides two static methods.
|
|
||||||
*
|
|
||||||
* - `IgnorePattern.createDefaultIgnore(cwd)`
|
|
||||||
* Create the default predicate function.
|
|
||||||
* - `IgnorePattern.createIgnore(ignorePatterns)`
|
|
||||||
* Create the predicate function from multiple `IgnorePattern` objects.
|
|
||||||
*
|
|
||||||
* It provides two properties and a method.
|
|
||||||
*
|
|
||||||
* - `patterns`
|
|
||||||
* The glob patterns that ignore to lint.
|
|
||||||
* - `basePath`
|
|
||||||
* The base path of the glob patterns. If absolute paths existed in the
|
|
||||||
* glob patterns, those are handled as relative paths to the base path.
|
|
||||||
* - `getPatternsRelativeTo(basePath)`
|
|
||||||
* Get `patterns` as modified for a given base path. It modifies the
|
|
||||||
* absolute paths in the patterns as prepending the difference of two base
|
|
||||||
* paths.
|
|
||||||
*
|
|
||||||
* `ConfigArrayFactory` creates `IgnorePattern` objects when it processes
|
|
||||||
* `ignorePatterns` properties.
|
|
||||||
*
|
|
||||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
||||||
*/
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Requirements
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
import assert from "assert";
|
|
||||||
import path from "path";
|
|
||||||
import ignore from "ignore";
|
|
||||||
import debugOrig from "debug";
|
|
||||||
|
|
||||||
const debug = debugOrig("eslintrc:ignore-pattern");
|
|
||||||
|
|
||||||
/** @typedef {ReturnType<import("ignore").default>} Ignore */
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Helpers
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the path to the common ancestor directory of given paths.
|
|
||||||
* @param {string[]} sourcePaths The paths to calculate the common ancestor.
|
|
||||||
* @returns {string} The path to the common ancestor directory.
|
|
||||||
*/
|
|
||||||
function getCommonAncestorPath(sourcePaths) {
|
|
||||||
let result = sourcePaths[0];
|
|
||||||
|
|
||||||
for (let i = 1; i < sourcePaths.length; ++i) {
|
|
||||||
const a = result;
|
|
||||||
const b = sourcePaths[i];
|
|
||||||
|
|
||||||
// Set the shorter one (it's the common ancestor if one includes the other).
|
|
||||||
result = a.length < b.length ? a : b;
|
|
||||||
|
|
||||||
// Set the common ancestor.
|
|
||||||
for (let j = 0, lastSepPos = 0; j < a.length && j < b.length; ++j) {
|
|
||||||
if (a[j] !== b[j]) {
|
|
||||||
result = a.slice(0, lastSepPos);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (a[j] === path.sep) {
|
|
||||||
lastSepPos = j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let resolvedResult = result || path.sep;
|
|
||||||
|
|
||||||
// if Windows common ancestor is root of drive must have trailing slash to be absolute.
|
|
||||||
if (resolvedResult && resolvedResult.endsWith(":") && process.platform === "win32") {
|
|
||||||
resolvedResult += path.sep;
|
|
||||||
}
|
|
||||||
return resolvedResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make relative path.
|
|
||||||
* @param {string} from The source path to get relative path.
|
|
||||||
* @param {string} to The destination path to get relative path.
|
|
||||||
* @returns {string} The relative path.
|
|
||||||
*/
|
|
||||||
function relative(from, to) {
|
|
||||||
const relPath = path.relative(from, to);
|
|
||||||
|
|
||||||
if (path.sep === "/") {
|
|
||||||
return relPath;
|
|
||||||
}
|
|
||||||
return relPath.split(path.sep).join("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the trailing slash if existed.
|
|
||||||
* @param {string} filePath The path to check.
|
|
||||||
* @returns {string} The trailing slash if existed.
|
|
||||||
*/
|
|
||||||
function dirSuffix(filePath) {
|
|
||||||
const isDir = (
|
|
||||||
filePath.endsWith(path.sep) ||
|
|
||||||
(process.platform === "win32" && filePath.endsWith("/"))
|
|
||||||
);
|
|
||||||
|
|
||||||
return isDir ? "/" : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
const DefaultPatterns = Object.freeze(["/**/node_modules/*"]);
|
|
||||||
const DotPatterns = Object.freeze([".*", "!.eslintrc.*", "!../"]);
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Public
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class IgnorePattern {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default patterns.
|
|
||||||
* @type {string[]}
|
|
||||||
*/
|
|
||||||
static get DefaultPatterns() {
|
|
||||||
return DefaultPatterns;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the default predicate function.
|
|
||||||
* @param {string} cwd The current working directory.
|
|
||||||
* @returns {((filePath:string, dot:boolean) => boolean) & {basePath:string; patterns:string[]}}
|
|
||||||
* The preficate function.
|
|
||||||
* The first argument is an absolute path that is checked.
|
|
||||||
* The second argument is the flag to not ignore dotfiles.
|
|
||||||
* If the predicate function returned `true`, it means the path should be ignored.
|
|
||||||
*/
|
|
||||||
static createDefaultIgnore(cwd) {
|
|
||||||
return this.createIgnore([new IgnorePattern(DefaultPatterns, cwd)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the predicate function from multiple `IgnorePattern` objects.
|
|
||||||
* @param {IgnorePattern[]} ignorePatterns The list of ignore patterns.
|
|
||||||
* @returns {((filePath:string, dot?:boolean) => boolean) & {basePath:string; patterns:string[]}}
|
|
||||||
* The preficate function.
|
|
||||||
* The first argument is an absolute path that is checked.
|
|
||||||
* The second argument is the flag to not ignore dotfiles.
|
|
||||||
* If the predicate function returned `true`, it means the path should be ignored.
|
|
||||||
*/
|
|
||||||
static createIgnore(ignorePatterns) {
|
|
||||||
debug("Create with: %o", ignorePatterns);
|
|
||||||
|
|
||||||
const basePath = getCommonAncestorPath(ignorePatterns.map(p => p.basePath));
|
|
||||||
const patterns = [].concat(
|
|
||||||
...ignorePatterns.map(p => p.getPatternsRelativeTo(basePath))
|
|
||||||
);
|
|
||||||
const ig = ignore().add([...DotPatterns, ...patterns]);
|
|
||||||
const dotIg = ignore().add(patterns);
|
|
||||||
|
|
||||||
debug(" processed: %o", { basePath, patterns });
|
|
||||||
|
|
||||||
return Object.assign(
|
|
||||||
(filePath, dot = false) => {
|
|
||||||
assert(path.isAbsolute(filePath), "'filePath' should be an absolute path.");
|
|
||||||
const relPathRaw = relative(basePath, filePath);
|
|
||||||
const relPath = relPathRaw && (relPathRaw + dirSuffix(filePath));
|
|
||||||
const adoptedIg = dot ? dotIg : ig;
|
|
||||||
const result = relPath !== "" && adoptedIg.ignores(relPath);
|
|
||||||
|
|
||||||
debug("Check", { filePath, dot, relativePath: relPath, result });
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
{ basePath, patterns }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize a new `IgnorePattern` instance.
|
|
||||||
* @param {string[]} patterns The glob patterns that ignore to lint.
|
|
||||||
* @param {string} basePath The base path of `patterns`.
|
|
||||||
*/
|
|
||||||
constructor(patterns, basePath) {
|
|
||||||
assert(path.isAbsolute(basePath), "'basePath' should be an absolute path.");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The glob patterns that ignore to lint.
|
|
||||||
* @type {string[]}
|
|
||||||
*/
|
|
||||||
this.patterns = patterns;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base path of `patterns`.
|
|
||||||
* @type {string}
|
|
||||||
*/
|
|
||||||
this.basePath = basePath;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If `true` then patterns which don't start with `/` will match the paths to the outside of `basePath`. Defaults to `false`.
|
|
||||||
*
|
|
||||||
* It's set `true` for `.eslintignore`, `package.json`, and `--ignore-path` for backward compatibility.
|
|
||||||
* It's `false` as-is for `ignorePatterns` property in config files.
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
this.loose = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get `patterns` as modified for a given base path. It modifies the
|
|
||||||
* absolute paths in the patterns as prepending the difference of two base
|
|
||||||
* paths.
|
|
||||||
* @param {string} newBasePath The base path.
|
|
||||||
* @returns {string[]} Modifired patterns.
|
|
||||||
*/
|
|
||||||
getPatternsRelativeTo(newBasePath) {
|
|
||||||
assert(path.isAbsolute(newBasePath), "'newBasePath' should be an absolute path.");
|
|
||||||
const { basePath, loose, patterns } = this;
|
|
||||||
|
|
||||||
if (newBasePath === basePath) {
|
|
||||||
return patterns;
|
|
||||||
}
|
|
||||||
const prefix = `/${relative(newBasePath, basePath)}`;
|
|
||||||
|
|
||||||
return patterns.map(pattern => {
|
|
||||||
const negative = pattern.startsWith("!");
|
|
||||||
const head = negative ? "!" : "";
|
|
||||||
const body = negative ? pattern.slice(1) : pattern;
|
|
||||||
|
|
||||||
if (body.startsWith("/") || body.startsWith("../")) {
|
|
||||||
return `${head}${prefix}${body}`;
|
|
||||||
}
|
|
||||||
return loose ? pattern : `${head}${prefix}/**/${body}`;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { IgnorePattern };
|
|
19
node_modules/@eslint/eslintrc/lib/config-array/index.js
generated
vendored
19
node_modules/@eslint/eslintrc/lib/config-array/index.js
generated
vendored
|
@ -1,19 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview `ConfigArray` class.
|
|
||||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { ConfigArray, getUsedExtractedConfigs } from "./config-array.js";
|
|
||||||
import { ConfigDependency } from "./config-dependency.js";
|
|
||||||
import { ExtractedConfig } from "./extracted-config.js";
|
|
||||||
import { IgnorePattern } from "./ignore-pattern.js";
|
|
||||||
import { OverrideTester } from "./override-tester.js";
|
|
||||||
|
|
||||||
export {
|
|
||||||
ConfigArray,
|
|
||||||
ConfigDependency,
|
|
||||||
ExtractedConfig,
|
|
||||||
IgnorePattern,
|
|
||||||
OverrideTester,
|
|
||||||
getUsedExtractedConfigs
|
|
||||||
};
|
|
225
node_modules/@eslint/eslintrc/lib/config-array/override-tester.js
generated
vendored
225
node_modules/@eslint/eslintrc/lib/config-array/override-tester.js
generated
vendored
|
@ -1,225 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview `OverrideTester` class.
|
|
||||||
*
|
|
||||||
* `OverrideTester` class handles `files` property and `excludedFiles` property
|
|
||||||
* of `overrides` config.
|
|
||||||
*
|
|
||||||
* It provides one method.
|
|
||||||
*
|
|
||||||
* - `test(filePath)`
|
|
||||||
* Test if a file path matches the pair of `files` property and
|
|
||||||
* `excludedFiles` property. The `filePath` argument must be an absolute
|
|
||||||
* path.
|
|
||||||
*
|
|
||||||
* `ConfigArrayFactory` creates `OverrideTester` objects when it processes
|
|
||||||
* `overrides` properties.
|
|
||||||
*
|
|
||||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
||||||
*/
|
|
||||||
|
|
||||||
import assert from "assert";
|
|
||||||
import path from "path";
|
|
||||||
import util from "util";
|
|
||||||
import minimatch from "minimatch";
|
|
||||||
|
|
||||||
const { Minimatch } = minimatch;
|
|
||||||
|
|
||||||
const minimatchOpts = { dot: true, matchBase: true };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} Pattern
|
|
||||||
* @property {InstanceType<Minimatch>[] | null} includes The positive matchers.
|
|
||||||
* @property {InstanceType<Minimatch>[] | null} excludes The negative matchers.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Normalize a given pattern to an array.
|
|
||||||
* @param {string|string[]|undefined} patterns A glob pattern or an array of glob patterns.
|
|
||||||
* @returns {string[]|null} Normalized patterns.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
function normalizePatterns(patterns) {
|
|
||||||
if (Array.isArray(patterns)) {
|
|
||||||
return patterns.filter(Boolean);
|
|
||||||
}
|
|
||||||
if (typeof patterns === "string" && patterns) {
|
|
||||||
return [patterns];
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the matchers of given patterns.
|
|
||||||
* @param {string[]} patterns The patterns.
|
|
||||||
* @returns {InstanceType<Minimatch>[] | null} The matchers.
|
|
||||||
*/
|
|
||||||
function toMatcher(patterns) {
|
|
||||||
if (patterns.length === 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return patterns.map(pattern => {
|
|
||||||
if (/^\.[/\\]/u.test(pattern)) {
|
|
||||||
return new Minimatch(
|
|
||||||
pattern.slice(2),
|
|
||||||
|
|
||||||
// `./*.js` should not match with `subdir/foo.js`
|
|
||||||
{ ...minimatchOpts, matchBase: false }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return new Minimatch(pattern, minimatchOpts);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert a given matcher to string.
|
|
||||||
* @param {Pattern} matchers The matchers.
|
|
||||||
* @returns {string} The string expression of the matcher.
|
|
||||||
*/
|
|
||||||
function patternToJson({ includes, excludes }) {
|
|
||||||
return {
|
|
||||||
includes: includes && includes.map(m => m.pattern),
|
|
||||||
excludes: excludes && excludes.map(m => m.pattern)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The class to test given paths are matched by the patterns.
|
|
||||||
*/
|
|
||||||
class OverrideTester {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a tester with given criteria.
|
|
||||||
* If there are no criteria, returns `null`.
|
|
||||||
* @param {string|string[]} files The glob patterns for included files.
|
|
||||||
* @param {string|string[]} excludedFiles The glob patterns for excluded files.
|
|
||||||
* @param {string} basePath The path to the base directory to test paths.
|
|
||||||
* @returns {OverrideTester|null} The created instance or `null`.
|
|
||||||
*/
|
|
||||||
static create(files, excludedFiles, basePath) {
|
|
||||||
const includePatterns = normalizePatterns(files);
|
|
||||||
const excludePatterns = normalizePatterns(excludedFiles);
|
|
||||||
let endsWithWildcard = false;
|
|
||||||
|
|
||||||
if (includePatterns.length === 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rejects absolute paths or relative paths to parents.
|
|
||||||
for (const pattern of includePatterns) {
|
|
||||||
if (path.isAbsolute(pattern) || pattern.includes("..")) {
|
|
||||||
throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`);
|
|
||||||
}
|
|
||||||
if (pattern.endsWith("*")) {
|
|
||||||
endsWithWildcard = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (const pattern of excludePatterns) {
|
|
||||||
if (path.isAbsolute(pattern) || pattern.includes("..")) {
|
|
||||||
throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const includes = toMatcher(includePatterns);
|
|
||||||
const excludes = toMatcher(excludePatterns);
|
|
||||||
|
|
||||||
return new OverrideTester(
|
|
||||||
[{ includes, excludes }],
|
|
||||||
basePath,
|
|
||||||
endsWithWildcard
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Combine two testers by logical and.
|
|
||||||
* If either of the testers was `null`, returns the other tester.
|
|
||||||
* The `basePath` property of the two must be the same value.
|
|
||||||
* @param {OverrideTester|null} a A tester.
|
|
||||||
* @param {OverrideTester|null} b Another tester.
|
|
||||||
* @returns {OverrideTester|null} Combined tester.
|
|
||||||
*/
|
|
||||||
static and(a, b) {
|
|
||||||
if (!b) {
|
|
||||||
return a && new OverrideTester(
|
|
||||||
a.patterns,
|
|
||||||
a.basePath,
|
|
||||||
a.endsWithWildcard
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (!a) {
|
|
||||||
return new OverrideTester(
|
|
||||||
b.patterns,
|
|
||||||
b.basePath,
|
|
||||||
b.endsWithWildcard
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.strictEqual(a.basePath, b.basePath);
|
|
||||||
return new OverrideTester(
|
|
||||||
a.patterns.concat(b.patterns),
|
|
||||||
a.basePath,
|
|
||||||
a.endsWithWildcard || b.endsWithWildcard
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize this instance.
|
|
||||||
* @param {Pattern[]} patterns The matchers.
|
|
||||||
* @param {string} basePath The base path.
|
|
||||||
* @param {boolean} endsWithWildcard If `true` then a pattern ends with `*`.
|
|
||||||
*/
|
|
||||||
constructor(patterns, basePath, endsWithWildcard = false) {
|
|
||||||
|
|
||||||
/** @type {Pattern[]} */
|
|
||||||
this.patterns = patterns;
|
|
||||||
|
|
||||||
/** @type {string} */
|
|
||||||
this.basePath = basePath;
|
|
||||||
|
|
||||||
/** @type {boolean} */
|
|
||||||
this.endsWithWildcard = endsWithWildcard;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test if a given path is matched or not.
|
|
||||||
* @param {string} filePath The absolute path to the target file.
|
|
||||||
* @returns {boolean} `true` if the path was matched.
|
|
||||||
*/
|
|
||||||
test(filePath) {
|
|
||||||
if (typeof filePath !== "string" || !path.isAbsolute(filePath)) {
|
|
||||||
throw new Error(`'filePath' should be an absolute path, but got ${filePath}.`);
|
|
||||||
}
|
|
||||||
const relativePath = path.relative(this.basePath, filePath);
|
|
||||||
|
|
||||||
return this.patterns.every(({ includes, excludes }) => (
|
|
||||||
(!includes || includes.some(m => m.match(relativePath))) &&
|
|
||||||
(!excludes || !excludes.some(m => m.match(relativePath)))
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line jsdoc/require-description
|
|
||||||
/**
|
|
||||||
* @returns {Object} a JSON compatible object.
|
|
||||||
*/
|
|
||||||
toJSON() {
|
|
||||||
if (this.patterns.length === 1) {
|
|
||||||
return {
|
|
||||||
...patternToJson(this.patterns[0]),
|
|
||||||
basePath: this.basePath
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
AND: this.patterns.map(patternToJson),
|
|
||||||
basePath: this.basePath
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line jsdoc/require-description
|
|
||||||
/**
|
|
||||||
* @returns {Object} an object to display by `console.log()`.
|
|
||||||
*/
|
|
||||||
[util.inspect.custom]() {
|
|
||||||
return this.toJSON();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { OverrideTester };
|
|
310
node_modules/@eslint/eslintrc/lib/flat-compat.js
generated
vendored
310
node_modules/@eslint/eslintrc/lib/flat-compat.js
generated
vendored
|
@ -1,310 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview Compatibility class for flat config.
|
|
||||||
* @author Nicholas C. Zakas
|
|
||||||
*/
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Requirements
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
import path from "path";
|
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
import createDebug from "debug";
|
|
||||||
|
|
||||||
import { ConfigArrayFactory } from "./config-array-factory.js";
|
|
||||||
import environments from "../conf/environments.js";
|
|
||||||
|
|
||||||
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Helpers
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/** @typedef {import("../../shared/types").Environment} Environment */
|
|
||||||
/** @typedef {import("../../shared/types").Processor} Processor */
|
|
||||||
|
|
||||||
const debug = createDebug("eslintrc:flat-compat");
|
|
||||||
const cafactory = Symbol("cafactory");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Translates an ESLintRC-style config object into a flag-config-style config
|
|
||||||
* object.
|
|
||||||
* @param {Object} eslintrcConfig An ESLintRC-style config object.
|
|
||||||
* @param {Object} options Options to help translate the config.
|
|
||||||
* @param {string} options.resolveConfigRelativeTo To the directory to resolve
|
|
||||||
* configs from.
|
|
||||||
* @param {string} options.resolvePluginsRelativeTo The directory to resolve
|
|
||||||
* plugins from.
|
|
||||||
* @param {ReadOnlyMap<string,Environment>} options.pluginEnvironments A map of plugin environment
|
|
||||||
* names to objects.
|
|
||||||
* @param {ReadOnlyMap<string,Processor>} options.pluginProcessors A map of plugin processor
|
|
||||||
* names to objects.
|
|
||||||
* @returns {Object} A flag-config-style config object.
|
|
||||||
*/
|
|
||||||
function translateESLintRC(eslintrcConfig, {
|
|
||||||
resolveConfigRelativeTo,
|
|
||||||
resolvePluginsRelativeTo,
|
|
||||||
pluginEnvironments,
|
|
||||||
pluginProcessors
|
|
||||||
}) {
|
|
||||||
|
|
||||||
const flatConfig = {};
|
|
||||||
const configs = [];
|
|
||||||
const languageOptions = {};
|
|
||||||
const linterOptions = {};
|
|
||||||
const keysToCopy = ["settings", "rules", "processor"];
|
|
||||||
const languageOptionsKeysToCopy = ["globals", "parser", "parserOptions"];
|
|
||||||
const linterOptionsKeysToCopy = ["noInlineConfig", "reportUnusedDisableDirectives"];
|
|
||||||
|
|
||||||
// check for special settings for eslint:all and eslint:recommended:
|
|
||||||
if (eslintrcConfig.settings) {
|
|
||||||
if (eslintrcConfig.settings["eslint:all"] === true) {
|
|
||||||
return ["eslint:all"];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eslintrcConfig.settings["eslint:recommended"] === true) {
|
|
||||||
return ["eslint:recommended"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy over simple translations
|
|
||||||
for (const key of keysToCopy) {
|
|
||||||
if (key in eslintrcConfig && typeof eslintrcConfig[key] !== "undefined") {
|
|
||||||
flatConfig[key] = eslintrcConfig[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy over languageOptions
|
|
||||||
for (const key of languageOptionsKeysToCopy) {
|
|
||||||
if (key in eslintrcConfig && typeof eslintrcConfig[key] !== "undefined") {
|
|
||||||
|
|
||||||
// create the languageOptions key in the flat config
|
|
||||||
flatConfig.languageOptions = languageOptions;
|
|
||||||
|
|
||||||
if (key === "parser") {
|
|
||||||
debug(`Resolving parser '${languageOptions[key]}' relative to ${resolveConfigRelativeTo}`);
|
|
||||||
|
|
||||||
if (eslintrcConfig[key].error) {
|
|
||||||
throw eslintrcConfig[key].error;
|
|
||||||
}
|
|
||||||
|
|
||||||
languageOptions[key] = eslintrcConfig[key].definition;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// clone any object values that are in the eslintrc config
|
|
||||||
if (eslintrcConfig[key] && typeof eslintrcConfig[key] === "object") {
|
|
||||||
languageOptions[key] = {
|
|
||||||
...eslintrcConfig[key]
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
languageOptions[key] = eslintrcConfig[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy over linterOptions
|
|
||||||
for (const key of linterOptionsKeysToCopy) {
|
|
||||||
if (key in eslintrcConfig && typeof eslintrcConfig[key] !== "undefined") {
|
|
||||||
flatConfig.linterOptions = linterOptions;
|
|
||||||
linterOptions[key] = eslintrcConfig[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// move ecmaVersion a level up
|
|
||||||
if (languageOptions.parserOptions) {
|
|
||||||
|
|
||||||
if ("ecmaVersion" in languageOptions.parserOptions) {
|
|
||||||
languageOptions.ecmaVersion = languageOptions.parserOptions.ecmaVersion;
|
|
||||||
delete languageOptions.parserOptions.ecmaVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("sourceType" in languageOptions.parserOptions) {
|
|
||||||
languageOptions.sourceType = languageOptions.parserOptions.sourceType;
|
|
||||||
delete languageOptions.parserOptions.sourceType;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check to see if we even need parserOptions anymore and remove it if not
|
|
||||||
if (Object.keys(languageOptions.parserOptions).length === 0) {
|
|
||||||
delete languageOptions.parserOptions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// overrides
|
|
||||||
if (eslintrcConfig.criteria) {
|
|
||||||
flatConfig.files = [absoluteFilePath => eslintrcConfig.criteria.test(absoluteFilePath)];
|
|
||||||
}
|
|
||||||
|
|
||||||
// translate plugins
|
|
||||||
if (eslintrcConfig.plugins && typeof eslintrcConfig.plugins === "object") {
|
|
||||||
debug(`Translating plugins: ${eslintrcConfig.plugins}`);
|
|
||||||
|
|
||||||
flatConfig.plugins = {};
|
|
||||||
|
|
||||||
for (const pluginName of Object.keys(eslintrcConfig.plugins)) {
|
|
||||||
|
|
||||||
debug(`Translating plugin: ${pluginName}`);
|
|
||||||
debug(`Resolving plugin '${pluginName} relative to ${resolvePluginsRelativeTo}`);
|
|
||||||
|
|
||||||
const { definition: plugin, error } = eslintrcConfig.plugins[pluginName];
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
|
|
||||||
flatConfig.plugins[pluginName] = plugin;
|
|
||||||
|
|
||||||
// create a config for any processors
|
|
||||||
if (plugin.processors) {
|
|
||||||
for (const processorName of Object.keys(plugin.processors)) {
|
|
||||||
if (processorName.startsWith(".")) {
|
|
||||||
debug(`Assigning processor: ${pluginName}/${processorName}`);
|
|
||||||
|
|
||||||
configs.unshift({
|
|
||||||
files: [`**/*${processorName}`],
|
|
||||||
processor: pluginProcessors.get(`${pluginName}/${processorName}`)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// translate env - must come after plugins
|
|
||||||
if (eslintrcConfig.env && typeof eslintrcConfig.env === "object") {
|
|
||||||
for (const envName of Object.keys(eslintrcConfig.env)) {
|
|
||||||
|
|
||||||
// only add environments that are true
|
|
||||||
if (eslintrcConfig.env[envName]) {
|
|
||||||
debug(`Translating environment: ${envName}`);
|
|
||||||
|
|
||||||
if (environments.has(envName)) {
|
|
||||||
|
|
||||||
// built-in environments should be defined first
|
|
||||||
configs.unshift(...translateESLintRC(environments.get(envName), {
|
|
||||||
resolveConfigRelativeTo,
|
|
||||||
resolvePluginsRelativeTo
|
|
||||||
}));
|
|
||||||
} else if (pluginEnvironments.has(envName)) {
|
|
||||||
|
|
||||||
// if the environment comes from a plugin, it should come after the plugin config
|
|
||||||
configs.push(...translateESLintRC(pluginEnvironments.get(envName), {
|
|
||||||
resolveConfigRelativeTo,
|
|
||||||
resolvePluginsRelativeTo
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// only add if there are actually keys in the config
|
|
||||||
if (Object.keys(flatConfig).length > 0) {
|
|
||||||
configs.push(flatConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
return configs;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Exports
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A compatibility class for working with configs.
|
|
||||||
*/
|
|
||||||
class FlatCompat {
|
|
||||||
|
|
||||||
constructor({
|
|
||||||
baseDirectory = process.cwd(),
|
|
||||||
resolvePluginsRelativeTo = baseDirectory
|
|
||||||
} = {}) {
|
|
||||||
this.baseDirectory = baseDirectory;
|
|
||||||
this.resolvePluginsRelativeTo = resolvePluginsRelativeTo;
|
|
||||||
this[cafactory] = new ConfigArrayFactory({
|
|
||||||
cwd: baseDirectory,
|
|
||||||
resolvePluginsRelativeTo,
|
|
||||||
eslintAllPath: path.resolve(dirname, "../conf/eslint-all.cjs"),
|
|
||||||
eslintRecommendedPath: path.resolve(dirname, "../conf/eslint-recommended.cjs")
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Translates an ESLintRC-style config into a flag-config-style config.
|
|
||||||
* @param {Object} eslintrcConfig The ESLintRC-style config object.
|
|
||||||
* @returns {Object} A flag-config-style config object.
|
|
||||||
*/
|
|
||||||
config(eslintrcConfig) {
|
|
||||||
const eslintrcArray = this[cafactory].create(eslintrcConfig, {
|
|
||||||
basePath: this.baseDirectory
|
|
||||||
});
|
|
||||||
|
|
||||||
const flatArray = [];
|
|
||||||
let hasIgnorePatterns = false;
|
|
||||||
|
|
||||||
eslintrcArray.forEach(configData => {
|
|
||||||
if (configData.type === "config") {
|
|
||||||
hasIgnorePatterns = hasIgnorePatterns || configData.ignorePattern;
|
|
||||||
flatArray.push(...translateESLintRC(configData, {
|
|
||||||
resolveConfigRelativeTo: path.join(this.baseDirectory, "__placeholder.js"),
|
|
||||||
resolvePluginsRelativeTo: path.join(this.resolvePluginsRelativeTo, "__placeholder.js"),
|
|
||||||
pluginEnvironments: eslintrcArray.pluginEnvironments,
|
|
||||||
pluginProcessors: eslintrcArray.pluginProcessors
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// combine ignorePatterns to emulate ESLintRC behavior better
|
|
||||||
if (hasIgnorePatterns) {
|
|
||||||
flatArray.unshift({
|
|
||||||
ignores: [filePath => {
|
|
||||||
|
|
||||||
// Compute the final config for this file.
|
|
||||||
// This filters config array elements by `files`/`excludedFiles` then merges the elements.
|
|
||||||
const finalConfig = eslintrcArray.extractConfig(filePath);
|
|
||||||
|
|
||||||
// Test the `ignorePattern` properties of the final config.
|
|
||||||
return Boolean(finalConfig.ignores) && finalConfig.ignores(filePath);
|
|
||||||
}]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return flatArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Translates the `env` section of an ESLintRC-style config.
|
|
||||||
* @param {Object} envConfig The `env` section of an ESLintRC config.
|
|
||||||
* @returns {Object} A flag-config object representing the environments.
|
|
||||||
*/
|
|
||||||
env(envConfig) {
|
|
||||||
return this.config({
|
|
||||||
env: envConfig
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Translates the `extends` section of an ESLintRC-style config.
|
|
||||||
* @param {...string} configsToExtend The names of the configs to load.
|
|
||||||
* @returns {Object} A flag-config object representing the config.
|
|
||||||
*/
|
|
||||||
extends(...configsToExtend) {
|
|
||||||
return this.config({
|
|
||||||
extends: configsToExtend
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Translates the `plugins` section of an ESLintRC-style config.
|
|
||||||
* @param {...string} plugins The names of the plugins to load.
|
|
||||||
* @returns {Object} A flag-config object representing the plugins.
|
|
||||||
*/
|
|
||||||
plugins(...plugins) {
|
|
||||||
return this.config({
|
|
||||||
plugins
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { FlatCompat };
|
|
29
node_modules/@eslint/eslintrc/lib/index-universal.js
generated
vendored
29
node_modules/@eslint/eslintrc/lib/index-universal.js
generated
vendored
|
@ -1,29 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview Package exports for @eslint/eslintrc
|
|
||||||
* @author Nicholas C. Zakas
|
|
||||||
*/
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Requirements
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
import * as ConfigOps from "./shared/config-ops.js";
|
|
||||||
import ConfigValidator from "./shared/config-validator.js";
|
|
||||||
import * as naming from "./shared/naming.js";
|
|
||||||
import environments from "../conf/environments.js";
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Exports
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
const Legacy = {
|
|
||||||
environments,
|
|
||||||
|
|
||||||
// shared
|
|
||||||
ConfigOps,
|
|
||||||
ConfigValidator,
|
|
||||||
naming
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
Legacy
|
|
||||||
};
|
|
56
node_modules/@eslint/eslintrc/lib/index.js
generated
vendored
56
node_modules/@eslint/eslintrc/lib/index.js
generated
vendored
|
@ -1,56 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview Package exports for @eslint/eslintrc
|
|
||||||
* @author Nicholas C. Zakas
|
|
||||||
*/
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Requirements
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
import {
|
|
||||||
ConfigArrayFactory,
|
|
||||||
createContext as createConfigArrayFactoryContext
|
|
||||||
} from "./config-array-factory.js";
|
|
||||||
|
|
||||||
import { CascadingConfigArrayFactory } from "./cascading-config-array-factory.js";
|
|
||||||
import * as ModuleResolver from "./shared/relative-module-resolver.js";
|
|
||||||
import { ConfigArray, getUsedExtractedConfigs } from "./config-array/index.js";
|
|
||||||
import { ConfigDependency } from "./config-array/config-dependency.js";
|
|
||||||
import { ExtractedConfig } from "./config-array/extracted-config.js";
|
|
||||||
import { IgnorePattern } from "./config-array/ignore-pattern.js";
|
|
||||||
import { OverrideTester } from "./config-array/override-tester.js";
|
|
||||||
import * as ConfigOps from "./shared/config-ops.js";
|
|
||||||
import ConfigValidator from "./shared/config-validator.js";
|
|
||||||
import * as naming from "./shared/naming.js";
|
|
||||||
import { FlatCompat } from "./flat-compat.js";
|
|
||||||
import environments from "../conf/environments.js";
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Exports
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
const Legacy = {
|
|
||||||
ConfigArray,
|
|
||||||
createConfigArrayFactoryContext,
|
|
||||||
CascadingConfigArrayFactory,
|
|
||||||
ConfigArrayFactory,
|
|
||||||
ConfigDependency,
|
|
||||||
ExtractedConfig,
|
|
||||||
IgnorePattern,
|
|
||||||
OverrideTester,
|
|
||||||
getUsedExtractedConfigs,
|
|
||||||
environments,
|
|
||||||
|
|
||||||
// shared
|
|
||||||
ConfigOps,
|
|
||||||
ConfigValidator,
|
|
||||||
ModuleResolver,
|
|
||||||
naming
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
|
|
||||||
Legacy,
|
|
||||||
|
|
||||||
FlatCompat
|
|
||||||
|
|
||||||
};
|
|
191
node_modules/@eslint/eslintrc/lib/shared/ajv.js
generated
vendored
191
node_modules/@eslint/eslintrc/lib/shared/ajv.js
generated
vendored
|
@ -1,191 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview The instance of Ajv validator.
|
|
||||||
* @author Evgeny Poberezkin
|
|
||||||
*/
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Requirements
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
import Ajv from "ajv";
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Helpers
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copied from ajv/lib/refs/json-schema-draft-04.json
|
|
||||||
* The MIT License (MIT)
|
|
||||||
* Copyright (c) 2015-2017 Evgeny Poberezkin
|
|
||||||
*/
|
|
||||||
const metaSchema = {
|
|
||||||
id: "http://json-schema.org/draft-04/schema#",
|
|
||||||
$schema: "http://json-schema.org/draft-04/schema#",
|
|
||||||
description: "Core schema meta-schema",
|
|
||||||
definitions: {
|
|
||||||
schemaArray: {
|
|
||||||
type: "array",
|
|
||||||
minItems: 1,
|
|
||||||
items: { $ref: "#" }
|
|
||||||
},
|
|
||||||
positiveInteger: {
|
|
||||||
type: "integer",
|
|
||||||
minimum: 0
|
|
||||||
},
|
|
||||||
positiveIntegerDefault0: {
|
|
||||||
allOf: [{ $ref: "#/definitions/positiveInteger" }, { default: 0 }]
|
|
||||||
},
|
|
||||||
simpleTypes: {
|
|
||||||
enum: ["array", "boolean", "integer", "null", "number", "object", "string"]
|
|
||||||
},
|
|
||||||
stringArray: {
|
|
||||||
type: "array",
|
|
||||||
items: { type: "string" },
|
|
||||||
minItems: 1,
|
|
||||||
uniqueItems: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: "string"
|
|
||||||
},
|
|
||||||
$schema: {
|
|
||||||
type: "string"
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
type: "string"
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
type: "string"
|
|
||||||
},
|
|
||||||
default: { },
|
|
||||||
multipleOf: {
|
|
||||||
type: "number",
|
|
||||||
minimum: 0,
|
|
||||||
exclusiveMinimum: true
|
|
||||||
},
|
|
||||||
maximum: {
|
|
||||||
type: "number"
|
|
||||||
},
|
|
||||||
exclusiveMaximum: {
|
|
||||||
type: "boolean",
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
minimum: {
|
|
||||||
type: "number"
|
|
||||||
},
|
|
||||||
exclusiveMinimum: {
|
|
||||||
type: "boolean",
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
maxLength: { $ref: "#/definitions/positiveInteger" },
|
|
||||||
minLength: { $ref: "#/definitions/positiveIntegerDefault0" },
|
|
||||||
pattern: {
|
|
||||||
type: "string",
|
|
||||||
format: "regex"
|
|
||||||
},
|
|
||||||
additionalItems: {
|
|
||||||
anyOf: [
|
|
||||||
{ type: "boolean" },
|
|
||||||
{ $ref: "#" }
|
|
||||||
],
|
|
||||||
default: { }
|
|
||||||
},
|
|
||||||
items: {
|
|
||||||
anyOf: [
|
|
||||||
{ $ref: "#" },
|
|
||||||
{ $ref: "#/definitions/schemaArray" }
|
|
||||||
],
|
|
||||||
default: { }
|
|
||||||
},
|
|
||||||
maxItems: { $ref: "#/definitions/positiveInteger" },
|
|
||||||
minItems: { $ref: "#/definitions/positiveIntegerDefault0" },
|
|
||||||
uniqueItems: {
|
|
||||||
type: "boolean",
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
maxProperties: { $ref: "#/definitions/positiveInteger" },
|
|
||||||
minProperties: { $ref: "#/definitions/positiveIntegerDefault0" },
|
|
||||||
required: { $ref: "#/definitions/stringArray" },
|
|
||||||
additionalProperties: {
|
|
||||||
anyOf: [
|
|
||||||
{ type: "boolean" },
|
|
||||||
{ $ref: "#" }
|
|
||||||
],
|
|
||||||
default: { }
|
|
||||||
},
|
|
||||||
definitions: {
|
|
||||||
type: "object",
|
|
||||||
additionalProperties: { $ref: "#" },
|
|
||||||
default: { }
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
type: "object",
|
|
||||||
additionalProperties: { $ref: "#" },
|
|
||||||
default: { }
|
|
||||||
},
|
|
||||||
patternProperties: {
|
|
||||||
type: "object",
|
|
||||||
additionalProperties: { $ref: "#" },
|
|
||||||
default: { }
|
|
||||||
},
|
|
||||||
dependencies: {
|
|
||||||
type: "object",
|
|
||||||
additionalProperties: {
|
|
||||||
anyOf: [
|
|
||||||
{ $ref: "#" },
|
|
||||||
{ $ref: "#/definitions/stringArray" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
enum: {
|
|
||||||
type: "array",
|
|
||||||
minItems: 1,
|
|
||||||
uniqueItems: true
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
anyOf: [
|
|
||||||
{ $ref: "#/definitions/simpleTypes" },
|
|
||||||
{
|
|
||||||
type: "array",
|
|
||||||
items: { $ref: "#/definitions/simpleTypes" },
|
|
||||||
minItems: 1,
|
|
||||||
uniqueItems: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
format: { type: "string" },
|
|
||||||
allOf: { $ref: "#/definitions/schemaArray" },
|
|
||||||
anyOf: { $ref: "#/definitions/schemaArray" },
|
|
||||||
oneOf: { $ref: "#/definitions/schemaArray" },
|
|
||||||
not: { $ref: "#" }
|
|
||||||
},
|
|
||||||
dependencies: {
|
|
||||||
exclusiveMaximum: ["maximum"],
|
|
||||||
exclusiveMinimum: ["minimum"]
|
|
||||||
},
|
|
||||||
default: { }
|
|
||||||
};
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Public Interface
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export default (additionalOptions = {}) => {
|
|
||||||
const ajv = new Ajv({
|
|
||||||
meta: false,
|
|
||||||
useDefaults: true,
|
|
||||||
validateSchema: false,
|
|
||||||
missingRefs: "ignore",
|
|
||||||
verbose: true,
|
|
||||||
schemaId: "auto",
|
|
||||||
...additionalOptions
|
|
||||||
});
|
|
||||||
|
|
||||||
ajv.addMetaSchema(metaSchema);
|
|
||||||
// eslint-disable-next-line no-underscore-dangle
|
|
||||||
ajv._opts.defaultMeta = metaSchema.id;
|
|
||||||
|
|
||||||
return ajv;
|
|
||||||
};
|
|
135
node_modules/@eslint/eslintrc/lib/shared/config-ops.js
generated
vendored
135
node_modules/@eslint/eslintrc/lib/shared/config-ops.js
generated
vendored
|
@ -1,135 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview Config file operations. This file must be usable in the browser,
|
|
||||||
* so no Node-specific code can be here.
|
|
||||||
* @author Nicholas C. Zakas
|
|
||||||
*/
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Private
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
const RULE_SEVERITY_STRINGS = ["off", "warn", "error"],
|
|
||||||
RULE_SEVERITY = RULE_SEVERITY_STRINGS.reduce((map, value, index) => {
|
|
||||||
map[value] = index;
|
|
||||||
return map;
|
|
||||||
}, {}),
|
|
||||||
VALID_SEVERITIES = [0, 1, 2, "off", "warn", "error"];
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Public Interface
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Normalizes the severity value of a rule's configuration to a number
|
|
||||||
* @param {(number|string|[number, ...*]|[string, ...*])} ruleConfig A rule's configuration value, generally
|
|
||||||
* received from the user. A valid config value is either 0, 1, 2, the string "off" (treated the same as 0),
|
|
||||||
* the string "warn" (treated the same as 1), the string "error" (treated the same as 2), or an array
|
|
||||||
* whose first element is one of the above values. Strings are matched case-insensitively.
|
|
||||||
* @returns {(0|1|2)} The numeric severity value if the config value was valid, otherwise 0.
|
|
||||||
*/
|
|
||||||
function getRuleSeverity(ruleConfig) {
|
|
||||||
const severityValue = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;
|
|
||||||
|
|
||||||
if (severityValue === 0 || severityValue === 1 || severityValue === 2) {
|
|
||||||
return severityValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof severityValue === "string") {
|
|
||||||
return RULE_SEVERITY[severityValue.toLowerCase()] || 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts old-style severity settings (0, 1, 2) into new-style
|
|
||||||
* severity settings (off, warn, error) for all rules. Assumption is that severity
|
|
||||||
* values have already been validated as correct.
|
|
||||||
* @param {Object} config The config object to normalize.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
function normalizeToStrings(config) {
|
|
||||||
|
|
||||||
if (config.rules) {
|
|
||||||
Object.keys(config.rules).forEach(ruleId => {
|
|
||||||
const ruleConfig = config.rules[ruleId];
|
|
||||||
|
|
||||||
if (typeof ruleConfig === "number") {
|
|
||||||
config.rules[ruleId] = RULE_SEVERITY_STRINGS[ruleConfig] || RULE_SEVERITY_STRINGS[0];
|
|
||||||
} else if (Array.isArray(ruleConfig) && typeof ruleConfig[0] === "number") {
|
|
||||||
ruleConfig[0] = RULE_SEVERITY_STRINGS[ruleConfig[0]] || RULE_SEVERITY_STRINGS[0];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines if the severity for the given rule configuration represents an error.
|
|
||||||
* @param {int|string|Array} ruleConfig The configuration for an individual rule.
|
|
||||||
* @returns {boolean} True if the rule represents an error, false if not.
|
|
||||||
*/
|
|
||||||
function isErrorSeverity(ruleConfig) {
|
|
||||||
return getRuleSeverity(ruleConfig) === 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether a given config has valid severity or not.
|
|
||||||
* @param {number|string|Array} ruleConfig The configuration for an individual rule.
|
|
||||||
* @returns {boolean} `true` if the configuration has valid severity.
|
|
||||||
*/
|
|
||||||
function isValidSeverity(ruleConfig) {
|
|
||||||
let severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;
|
|
||||||
|
|
||||||
if (typeof severity === "string") {
|
|
||||||
severity = severity.toLowerCase();
|
|
||||||
}
|
|
||||||
return VALID_SEVERITIES.indexOf(severity) !== -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether every rule of a given config has valid severity or not.
|
|
||||||
* @param {Object} config The configuration for rules.
|
|
||||||
* @returns {boolean} `true` if the configuration has valid severity.
|
|
||||||
*/
|
|
||||||
function isEverySeverityValid(config) {
|
|
||||||
return Object.keys(config).every(ruleId => isValidSeverity(config[ruleId]));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Normalizes a value for a global in a config
|
|
||||||
* @param {(boolean|string|null)} configuredValue The value given for a global in configuration or in
|
|
||||||
* a global directive comment
|
|
||||||
* @returns {("readable"|"writeable"|"off")} The value normalized as a string
|
|
||||||
* @throws Error if global value is invalid
|
|
||||||
*/
|
|
||||||
function normalizeConfigGlobal(configuredValue) {
|
|
||||||
switch (configuredValue) {
|
|
||||||
case "off":
|
|
||||||
return "off";
|
|
||||||
|
|
||||||
case true:
|
|
||||||
case "true":
|
|
||||||
case "writeable":
|
|
||||||
case "writable":
|
|
||||||
return "writable";
|
|
||||||
|
|
||||||
case null:
|
|
||||||
case false:
|
|
||||||
case "false":
|
|
||||||
case "readable":
|
|
||||||
case "readonly":
|
|
||||||
return "readonly";
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new Error(`'${configuredValue}' is not a valid configuration for a global (use 'readonly', 'writable', or 'off')`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
|
||||||
getRuleSeverity,
|
|
||||||
normalizeToStrings,
|
|
||||||
isErrorSeverity,
|
|
||||||
isValidSeverity,
|
|
||||||
isEverySeverityValid,
|
|
||||||
normalizeConfigGlobal
|
|
||||||
};
|
|
325
node_modules/@eslint/eslintrc/lib/shared/config-validator.js
generated
vendored
325
node_modules/@eslint/eslintrc/lib/shared/config-validator.js
generated
vendored
|
@ -1,325 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview Validates configs.
|
|
||||||
* @author Brandon Mills
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* eslint class-methods-use-this: "off" */
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Requirements
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
import util from "util";
|
|
||||||
import * as ConfigOps from "./config-ops.js";
|
|
||||||
import { emitDeprecationWarning } from "./deprecation-warnings.js";
|
|
||||||
import ajvOrig from "./ajv.js";
|
|
||||||
import configSchema from "../../conf/config-schema.js";
|
|
||||||
import BuiltInEnvironments from "../../conf/environments.js";
|
|
||||||
|
|
||||||
const ajv = ajvOrig();
|
|
||||||
|
|
||||||
const ruleValidators = new WeakMap();
|
|
||||||
const noop = Function.prototype;
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Private
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
let validateSchema;
|
|
||||||
const severityMap = {
|
|
||||||
error: 2,
|
|
||||||
warn: 1,
|
|
||||||
off: 0
|
|
||||||
};
|
|
||||||
|
|
||||||
const validated = new WeakSet();
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Exports
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export default class ConfigValidator {
|
|
||||||
constructor({ builtInRules = new Map() } = {}) {
|
|
||||||
this.builtInRules = builtInRules;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a complete options schema for a rule.
|
|
||||||
* @param {{create: Function, schema: (Array|null)}} rule A new-style rule object
|
|
||||||
* @returns {Object} JSON Schema for the rule's options.
|
|
||||||
*/
|
|
||||||
getRuleOptionsSchema(rule) {
|
|
||||||
if (!rule) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const schema = rule.schema || rule.meta && rule.meta.schema;
|
|
||||||
|
|
||||||
// Given a tuple of schemas, insert warning level at the beginning
|
|
||||||
if (Array.isArray(schema)) {
|
|
||||||
if (schema.length) {
|
|
||||||
return {
|
|
||||||
type: "array",
|
|
||||||
items: schema,
|
|
||||||
minItems: 0,
|
|
||||||
maxItems: schema.length
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
type: "array",
|
|
||||||
minItems: 0,
|
|
||||||
maxItems: 0
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Given a full schema, leave it alone
|
|
||||||
return schema || null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid.
|
|
||||||
* @param {options} options The given options for the rule.
|
|
||||||
* @returns {number|string} The rule's severity value
|
|
||||||
*/
|
|
||||||
validateRuleSeverity(options) {
|
|
||||||
const severity = Array.isArray(options) ? options[0] : options;
|
|
||||||
const normSeverity = typeof severity === "string" ? severityMap[severity.toLowerCase()] : severity;
|
|
||||||
|
|
||||||
if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) {
|
|
||||||
return normSeverity;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Error(`\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${util.inspect(severity).replace(/'/gu, "\"").replace(/\n/gu, "")}').\n`);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates the non-severity options passed to a rule, based on its schema.
|
|
||||||
* @param {{create: Function}} rule The rule to validate
|
|
||||||
* @param {Array} localOptions The options for the rule, excluding severity
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
validateRuleSchema(rule, localOptions) {
|
|
||||||
if (!ruleValidators.has(rule)) {
|
|
||||||
const schema = this.getRuleOptionsSchema(rule);
|
|
||||||
|
|
||||||
if (schema) {
|
|
||||||
ruleValidators.set(rule, ajv.compile(schema));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const validateRule = ruleValidators.get(rule);
|
|
||||||
|
|
||||||
if (validateRule) {
|
|
||||||
validateRule(localOptions);
|
|
||||||
if (validateRule.errors) {
|
|
||||||
throw new Error(validateRule.errors.map(
|
|
||||||
error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n`
|
|
||||||
).join(""));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates a rule's options against its schema.
|
|
||||||
* @param {{create: Function}|null} rule The rule that the config is being validated for
|
|
||||||
* @param {string} ruleId The rule's unique name.
|
|
||||||
* @param {Array|number} options The given options for the rule.
|
|
||||||
* @param {string|null} source The name of the configuration source to report in any errors. If null or undefined,
|
|
||||||
* no source is prepended to the message.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
validateRuleOptions(rule, ruleId, options, source = null) {
|
|
||||||
try {
|
|
||||||
const severity = this.validateRuleSeverity(options);
|
|
||||||
|
|
||||||
if (severity !== 0) {
|
|
||||||
this.validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
const enhancedMessage = `Configuration for rule "${ruleId}" is invalid:\n${err.message}`;
|
|
||||||
|
|
||||||
if (typeof source === "string") {
|
|
||||||
throw new Error(`${source}:\n\t${enhancedMessage}`);
|
|
||||||
} else {
|
|
||||||
throw new Error(enhancedMessage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates an environment object
|
|
||||||
* @param {Object} environment The environment config object to validate.
|
|
||||||
* @param {string} source The name of the configuration source to report in any errors.
|
|
||||||
* @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
validateEnvironment(
|
|
||||||
environment,
|
|
||||||
source,
|
|
||||||
getAdditionalEnv = noop
|
|
||||||
) {
|
|
||||||
|
|
||||||
// not having an environment is ok
|
|
||||||
if (!environment) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.keys(environment).forEach(id => {
|
|
||||||
const env = getAdditionalEnv(id) || BuiltInEnvironments.get(id) || null;
|
|
||||||
|
|
||||||
if (!env) {
|
|
||||||
const message = `${source}:\n\tEnvironment key "${id}" is unknown\n`;
|
|
||||||
|
|
||||||
throw new Error(message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates a rules config object
|
|
||||||
* @param {Object} rulesConfig The rules config object to validate.
|
|
||||||
* @param {string} source The name of the configuration source to report in any errors.
|
|
||||||
* @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
validateRules(
|
|
||||||
rulesConfig,
|
|
||||||
source,
|
|
||||||
getAdditionalRule = noop
|
|
||||||
) {
|
|
||||||
if (!rulesConfig) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.keys(rulesConfig).forEach(id => {
|
|
||||||
const rule = getAdditionalRule(id) || this.builtInRules.get(id) || null;
|
|
||||||
|
|
||||||
this.validateRuleOptions(rule, id, rulesConfig[id], source);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates a `globals` section of a config file
|
|
||||||
* @param {Object} globalsConfig The `globals` section
|
|
||||||
* @param {string|null} source The name of the configuration source to report in the event of an error.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
validateGlobals(globalsConfig, source = null) {
|
|
||||||
if (!globalsConfig) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.entries(globalsConfig)
|
|
||||||
.forEach(([configuredGlobal, configuredValue]) => {
|
|
||||||
try {
|
|
||||||
ConfigOps.normalizeConfigGlobal(configuredValue);
|
|
||||||
} catch (err) {
|
|
||||||
throw new Error(`ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\n${err.message}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate `processor` configuration.
|
|
||||||
* @param {string|undefined} processorName The processor name.
|
|
||||||
* @param {string} source The name of config file.
|
|
||||||
* @param {function(id:string): Processor} getProcessor The getter of defined processors.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
validateProcessor(processorName, source, getProcessor) {
|
|
||||||
if (processorName && !getProcessor(processorName)) {
|
|
||||||
throw new Error(`ESLint configuration of processor in '${source}' is invalid: '${processorName}' was not found.`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Formats an array of schema validation errors.
|
|
||||||
* @param {Array} errors An array of error messages to format.
|
|
||||||
* @returns {string} Formatted error message
|
|
||||||
*/
|
|
||||||
formatErrors(errors) {
|
|
||||||
return errors.map(error => {
|
|
||||||
if (error.keyword === "additionalProperties") {
|
|
||||||
const formattedPropertyPath = error.dataPath.length ? `${error.dataPath.slice(1)}.${error.params.additionalProperty}` : error.params.additionalProperty;
|
|
||||||
|
|
||||||
return `Unexpected top-level property "${formattedPropertyPath}"`;
|
|
||||||
}
|
|
||||||
if (error.keyword === "type") {
|
|
||||||
const formattedField = error.dataPath.slice(1);
|
|
||||||
const formattedExpectedType = Array.isArray(error.schema) ? error.schema.join("/") : error.schema;
|
|
||||||
const formattedValue = JSON.stringify(error.data);
|
|
||||||
|
|
||||||
return `Property "${formattedField}" is the wrong type (expected ${formattedExpectedType} but got \`${formattedValue}\`)`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const field = error.dataPath[0] === "." ? error.dataPath.slice(1) : error.dataPath;
|
|
||||||
|
|
||||||
return `"${field}" ${error.message}. Value: ${JSON.stringify(error.data)}`;
|
|
||||||
}).map(message => `\t- ${message}.\n`).join("");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates the top level properties of the config object.
|
|
||||||
* @param {Object} config The config object to validate.
|
|
||||||
* @param {string} source The name of the configuration source to report in any errors.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
validateConfigSchema(config, source = null) {
|
|
||||||
validateSchema = validateSchema || ajv.compile(configSchema);
|
|
||||||
|
|
||||||
if (!validateSchema(config)) {
|
|
||||||
throw new Error(`ESLint configuration in ${source} is invalid:\n${this.formatErrors(validateSchema.errors)}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Object.hasOwnProperty.call(config, "ecmaFeatures")) {
|
|
||||||
emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates an entire config object.
|
|
||||||
* @param {Object} config The config object to validate.
|
|
||||||
* @param {string} source The name of the configuration source to report in any errors.
|
|
||||||
* @param {function(ruleId:string): Object} [getAdditionalRule] A map from strings to loaded rules.
|
|
||||||
* @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded envs.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
validate(config, source, getAdditionalRule, getAdditionalEnv) {
|
|
||||||
this.validateConfigSchema(config, source);
|
|
||||||
this.validateRules(config.rules, source, getAdditionalRule);
|
|
||||||
this.validateEnvironment(config.env, source, getAdditionalEnv);
|
|
||||||
this.validateGlobals(config.globals, source);
|
|
||||||
|
|
||||||
for (const override of config.overrides || []) {
|
|
||||||
this.validateRules(override.rules, source, getAdditionalRule);
|
|
||||||
this.validateEnvironment(override.env, source, getAdditionalEnv);
|
|
||||||
this.validateGlobals(config.globals, source);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate config array object.
|
|
||||||
* @param {ConfigArray} configArray The config array to validate.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
validateConfigArray(configArray) {
|
|
||||||
const getPluginEnv = Map.prototype.get.bind(configArray.pluginEnvironments);
|
|
||||||
const getPluginProcessor = Map.prototype.get.bind(configArray.pluginProcessors);
|
|
||||||
const getPluginRule = Map.prototype.get.bind(configArray.pluginRules);
|
|
||||||
|
|
||||||
// Validate.
|
|
||||||
for (const element of configArray) {
|
|
||||||
if (validated.has(element)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
validated.add(element);
|
|
||||||
|
|
||||||
this.validateEnvironment(element.env, element.name, getPluginEnv);
|
|
||||||
this.validateGlobals(element.globals, element.name);
|
|
||||||
this.validateProcessor(element.processor, element.name, getPluginProcessor);
|
|
||||||
this.validateRules(element.rules, element.name, getPluginRule);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
63
node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js
generated
vendored
63
node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js
generated
vendored
|
@ -1,63 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview Provide the function that emits deprecation warnings.
|
|
||||||
* @author Toru Nagashima <http://github.com/mysticatea>
|
|
||||||
*/
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Requirements
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
import path from "path";
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Private
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Defitions for deprecation warnings.
|
|
||||||
const deprecationWarningMessages = {
|
|
||||||
ESLINT_LEGACY_ECMAFEATURES:
|
|
||||||
"The 'ecmaFeatures' config file property is deprecated and has no effect.",
|
|
||||||
ESLINT_PERSONAL_CONFIG_LOAD:
|
|
||||||
"'~/.eslintrc.*' config files have been deprecated. " +
|
|
||||||
"Please use a config file per project or the '--config' option.",
|
|
||||||
ESLINT_PERSONAL_CONFIG_SUPPRESS:
|
|
||||||
"'~/.eslintrc.*' config files have been deprecated. " +
|
|
||||||
"Please remove it or add 'root:true' to the config files in your " +
|
|
||||||
"projects in order to avoid loading '~/.eslintrc.*' accidentally."
|
|
||||||
};
|
|
||||||
|
|
||||||
const sourceFileErrorCache = new Set();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted
|
|
||||||
* for each unique file path, but repeated invocations with the same file path have no effect.
|
|
||||||
* No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active.
|
|
||||||
* @param {string} source The name of the configuration source to report the warning for.
|
|
||||||
* @param {string} errorCode The warning message to show.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
function emitDeprecationWarning(source, errorCode) {
|
|
||||||
const cacheKey = JSON.stringify({ source, errorCode });
|
|
||||||
|
|
||||||
if (sourceFileErrorCache.has(cacheKey)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sourceFileErrorCache.add(cacheKey);
|
|
||||||
|
|
||||||
const rel = path.relative(process.cwd(), source);
|
|
||||||
const message = deprecationWarningMessages[errorCode];
|
|
||||||
|
|
||||||
process.emitWarning(
|
|
||||||
`${message} (found in "${rel}")`,
|
|
||||||
"DeprecationWarning",
|
|
||||||
errorCode
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Public Interface
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export {
|
|
||||||
emitDeprecationWarning
|
|
||||||
};
|
|
96
node_modules/@eslint/eslintrc/lib/shared/naming.js
generated
vendored
96
node_modules/@eslint/eslintrc/lib/shared/naming.js
generated
vendored
|
@ -1,96 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview Common helpers for naming of plugins, formatters and configs
|
|
||||||
*/
|
|
||||||
|
|
||||||
const NAMESPACE_REGEX = /^@.*\//iu;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Brings package name to correct format based on prefix
|
|
||||||
* @param {string} name The name of the package.
|
|
||||||
* @param {string} prefix Can be either "eslint-plugin", "eslint-config" or "eslint-formatter"
|
|
||||||
* @returns {string} Normalized name of the package
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
function normalizePackageName(name, prefix) {
|
|
||||||
let normalizedName = name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On Windows, name can come in with Windows slashes instead of Unix slashes.
|
|
||||||
* Normalize to Unix first to avoid errors later on.
|
|
||||||
* https://github.com/eslint/eslint/issues/5644
|
|
||||||
*/
|
|
||||||
if (normalizedName.includes("\\")) {
|
|
||||||
normalizedName = normalizedName.replace(/\\/gu, "/");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (normalizedName.charAt(0) === "@") {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* it's a scoped package
|
|
||||||
* package name is the prefix, or just a username
|
|
||||||
*/
|
|
||||||
const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`, "u"),
|
|
||||||
scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`, "u");
|
|
||||||
|
|
||||||
if (scopedPackageShortcutRegex.test(normalizedName)) {
|
|
||||||
normalizedName = normalizedName.replace(scopedPackageShortcutRegex, `$1/${prefix}`);
|
|
||||||
} else if (!scopedPackageNameRegex.test(normalizedName.split("/")[1])) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* for scoped packages, insert the prefix after the first / unless
|
|
||||||
* the path is already @scope/eslint or @scope/eslint-xxx-yyy
|
|
||||||
*/
|
|
||||||
normalizedName = normalizedName.replace(/^@([^/]+)\/(.*)$/u, `@$1/${prefix}-$2`);
|
|
||||||
}
|
|
||||||
} else if (!normalizedName.startsWith(`${prefix}-`)) {
|
|
||||||
normalizedName = `${prefix}-${normalizedName}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return normalizedName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the prefix from a fullname.
|
|
||||||
* @param {string} fullname The term which may have the prefix.
|
|
||||||
* @param {string} prefix The prefix to remove.
|
|
||||||
* @returns {string} The term without prefix.
|
|
||||||
*/
|
|
||||||
function getShorthandName(fullname, prefix) {
|
|
||||||
if (fullname[0] === "@") {
|
|
||||||
let matchResult = new RegExp(`^(@[^/]+)/${prefix}$`, "u").exec(fullname);
|
|
||||||
|
|
||||||
if (matchResult) {
|
|
||||||
return matchResult[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
matchResult = new RegExp(`^(@[^/]+)/${prefix}-(.+)$`, "u").exec(fullname);
|
|
||||||
if (matchResult) {
|
|
||||||
return `${matchResult[1]}/${matchResult[2]}`;
|
|
||||||
}
|
|
||||||
} else if (fullname.startsWith(`${prefix}-`)) {
|
|
||||||
return fullname.slice(prefix.length + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return fullname;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the scope (namespace) of a term.
|
|
||||||
* @param {string} term The term which may have the namespace.
|
|
||||||
* @returns {string} The namespace of the term if it has one.
|
|
||||||
*/
|
|
||||||
function getNamespaceFromTerm(term) {
|
|
||||||
const match = term.match(NAMESPACE_REGEX);
|
|
||||||
|
|
||||||
return match ? match[0] : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Public Interface
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export {
|
|
||||||
normalizePackageName,
|
|
||||||
getShorthandName,
|
|
||||||
getNamespaceFromTerm
|
|
||||||
};
|
|
42
node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js
generated
vendored
42
node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js
generated
vendored
|
@ -1,42 +0,0 @@
|
||||||
/**
|
|
||||||
* Utility for resolving a module relative to another module
|
|
||||||
* @author Teddy Katz
|
|
||||||
*/
|
|
||||||
|
|
||||||
import Module from "module";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* `Module.createRequire` is added in v12.2.0. It supports URL as well.
|
|
||||||
* We only support the case where the argument is a filepath, not a URL.
|
|
||||||
*/
|
|
||||||
const createRequire = Module.createRequire;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resolves a Node module relative to another module
|
|
||||||
* @param {string} moduleName The name of a Node module, or a path to a Node module.
|
|
||||||
* @param {string} relativeToPath An absolute path indicating the module that `moduleName` should be resolved relative to. This must be
|
|
||||||
* a file rather than a directory, but the file need not actually exist.
|
|
||||||
* @returns {string} The absolute path that would result from calling `require.resolve(moduleName)` in a file located at `relativeToPath`
|
|
||||||
*/
|
|
||||||
function resolve(moduleName, relativeToPath) {
|
|
||||||
try {
|
|
||||||
return createRequire(relativeToPath).resolve(moduleName);
|
|
||||||
} catch (error) {
|
|
||||||
|
|
||||||
// This `if` block is for older Node.js than 12.0.0. We can remove this block in the future.
|
|
||||||
if (
|
|
||||||
typeof error === "object" &&
|
|
||||||
error !== null &&
|
|
||||||
error.code === "MODULE_NOT_FOUND" &&
|
|
||||||
!error.requireStack &&
|
|
||||||
error.message.includes(moduleName)
|
|
||||||
) {
|
|
||||||
error.message += `\nRequire stack:\n- ${relativeToPath}`;
|
|
||||||
}
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
|
||||||
resolve
|
|
||||||
};
|
|
149
node_modules/@eslint/eslintrc/lib/shared/types.js
generated
vendored
149
node_modules/@eslint/eslintrc/lib/shared/types.js
generated
vendored
|
@ -1,149 +0,0 @@
|
||||||
/**
|
|
||||||
* @fileoverview Define common types for input completion.
|
|
||||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @type {any} */
|
|
||||||
export default {};
|
|
||||||
|
|
||||||
/** @typedef {boolean | "off" | "readable" | "readonly" | "writable" | "writeable"} GlobalConf */
|
|
||||||
/** @typedef {0 | 1 | 2 | "off" | "warn" | "error"} SeverityConf */
|
|
||||||
/** @typedef {SeverityConf | [SeverityConf, ...any[]]} RuleConf */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} EcmaFeatures
|
|
||||||
* @property {boolean} [globalReturn] Enabling `return` statements at the top-level.
|
|
||||||
* @property {boolean} [jsx] Enabling JSX syntax.
|
|
||||||
* @property {boolean} [impliedStrict] Enabling strict mode always.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} ParserOptions
|
|
||||||
* @property {EcmaFeatures} [ecmaFeatures] The optional features.
|
|
||||||
* @property {3|5|6|7|8|9|10|11|12|2015|2016|2017|2018|2019|2020|2021} [ecmaVersion] The ECMAScript version (or revision number).
|
|
||||||
* @property {"script"|"module"} [sourceType] The source code type.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} ConfigData
|
|
||||||
* @property {Record<string, boolean>} [env] The environment settings.
|
|
||||||
* @property {string | string[]} [extends] The path to other config files or the package name of shareable configs.
|
|
||||||
* @property {Record<string, GlobalConf>} [globals] The global variable settings.
|
|
||||||
* @property {string | string[]} [ignorePatterns] The glob patterns that ignore to lint.
|
|
||||||
* @property {boolean} [noInlineConfig] The flag that disables directive comments.
|
|
||||||
* @property {OverrideConfigData[]} [overrides] The override settings per kind of files.
|
|
||||||
* @property {string} [parser] The path to a parser or the package name of a parser.
|
|
||||||
* @property {ParserOptions} [parserOptions] The parser options.
|
|
||||||
* @property {string[]} [plugins] The plugin specifiers.
|
|
||||||
* @property {string} [processor] The processor specifier.
|
|
||||||
* @property {boolean} [reportUnusedDisableDirectives] The flag to report unused `eslint-disable` comments.
|
|
||||||
* @property {boolean} [root] The root flag.
|
|
||||||
* @property {Record<string, RuleConf>} [rules] The rule settings.
|
|
||||||
* @property {Object} [settings] The shared settings.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} OverrideConfigData
|
|
||||||
* @property {Record<string, boolean>} [env] The environment settings.
|
|
||||||
* @property {string | string[]} [excludedFiles] The glob pattarns for excluded files.
|
|
||||||
* @property {string | string[]} [extends] The path to other config files or the package name of shareable configs.
|
|
||||||
* @property {string | string[]} files The glob patterns for target files.
|
|
||||||
* @property {Record<string, GlobalConf>} [globals] The global variable settings.
|
|
||||||
* @property {boolean} [noInlineConfig] The flag that disables directive comments.
|
|
||||||
* @property {OverrideConfigData[]} [overrides] The override settings per kind of files.
|
|
||||||
* @property {string} [parser] The path to a parser or the package name of a parser.
|
|
||||||
* @property {ParserOptions} [parserOptions] The parser options.
|
|
||||||
* @property {string[]} [plugins] The plugin specifiers.
|
|
||||||
* @property {string} [processor] The processor specifier.
|
|
||||||
* @property {boolean} [reportUnusedDisableDirectives] The flag to report unused `eslint-disable` comments.
|
|
||||||
* @property {Record<string, RuleConf>} [rules] The rule settings.
|
|
||||||
* @property {Object} [settings] The shared settings.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} ParseResult
|
|
||||||
* @property {Object} ast The AST.
|
|
||||||
* @property {ScopeManager} [scopeManager] The scope manager of the AST.
|
|
||||||
* @property {Record<string, any>} [services] The services that the parser provides.
|
|
||||||
* @property {Record<string, string[]>} [visitorKeys] The visitor keys of the AST.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} Parser
|
|
||||||
* @property {(text:string, options:ParserOptions) => Object} parse The definition of global variables.
|
|
||||||
* @property {(text:string, options:ParserOptions) => ParseResult} [parseForESLint] The parser options that will be enabled under this environment.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} Environment
|
|
||||||
* @property {Record<string, GlobalConf>} [globals] The definition of global variables.
|
|
||||||
* @property {ParserOptions} [parserOptions] The parser options that will be enabled under this environment.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} LintMessage
|
|
||||||
* @property {number} column The 1-based column number.
|
|
||||||
* @property {number} [endColumn] The 1-based column number of the end location.
|
|
||||||
* @property {number} [endLine] The 1-based line number of the end location.
|
|
||||||
* @property {boolean} fatal If `true` then this is a fatal error.
|
|
||||||
* @property {{range:[number,number], text:string}} [fix] Information for autofix.
|
|
||||||
* @property {number} line The 1-based line number.
|
|
||||||
* @property {string} message The error message.
|
|
||||||
* @property {string|null} ruleId The ID of the rule which makes this message.
|
|
||||||
* @property {0|1|2} severity The severity of this message.
|
|
||||||
* @property {Array<{desc?: string, messageId?: string, fix: {range: [number, number], text: string}}>} [suggestions] Information for suggestions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} SuggestionResult
|
|
||||||
* @property {string} desc A short description.
|
|
||||||
* @property {string} [messageId] Id referencing a message for the description.
|
|
||||||
* @property {{ text: string, range: number[] }} fix fix result info
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} Processor
|
|
||||||
* @property {(text:string, filename:string) => Array<string | { text:string, filename:string }>} [preprocess] The function to extract code blocks.
|
|
||||||
* @property {(messagesList:LintMessage[][], filename:string) => LintMessage[]} [postprocess] The function to merge messages.
|
|
||||||
* @property {boolean} [supportsAutofix] If `true` then it means the processor supports autofix.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} RuleMetaDocs
|
|
||||||
* @property {string} category The category of the rule.
|
|
||||||
* @property {string} description The description of the rule.
|
|
||||||
* @property {boolean} recommended If `true` then the rule is included in `eslint:recommended` preset.
|
|
||||||
* @property {string} url The URL of the rule documentation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} RuleMeta
|
|
||||||
* @property {boolean} [deprecated] If `true` then the rule has been deprecated.
|
|
||||||
* @property {RuleMetaDocs} docs The document information of the rule.
|
|
||||||
* @property {"code"|"whitespace"} [fixable] The autofix type.
|
|
||||||
* @property {Record<string,string>} [messages] The messages the rule reports.
|
|
||||||
* @property {string[]} [replacedBy] The IDs of the alternative rules.
|
|
||||||
* @property {Array|Object} schema The option schema of the rule.
|
|
||||||
* @property {"problem"|"suggestion"|"layout"} type The rule type.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} Rule
|
|
||||||
* @property {Function} create The factory of the rule.
|
|
||||||
* @property {RuleMeta} meta The meta data of the rule.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} Plugin
|
|
||||||
* @property {Record<string, ConfigData>} [configs] The definition of plugin configs.
|
|
||||||
* @property {Record<string, Environment>} [environments] The definition of plugin environments.
|
|
||||||
* @property {Record<string, Processor>} [processors] The definition of plugin processors.
|
|
||||||
* @property {Record<string, Function | Rule>} [rules] The definition of plugin rules.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Information of deprecated rules.
|
|
||||||
* @typedef {Object} DeprecatedRuleInfo
|
|
||||||
* @property {string} ruleId The rule ID.
|
|
||||||
* @property {string[]} replacedBy The rule IDs that replace this deprecated rule.
|
|
||||||
*/
|
|
19
node_modules/@eslint/eslintrc/node_modules/ignore/CHANGELOG.md
generated
vendored
19
node_modules/@eslint/eslintrc/node_modules/ignore/CHANGELOG.md
generated
vendored
|
@ -1,19 +0,0 @@
|
||||||
# `node-ignore` 4 ChangeLog
|
|
||||||
|
|
||||||
# 4.x
|
|
||||||
|
|
||||||
## 2018-06-22, Version 4.0.0
|
|
||||||
|
|
||||||
- **SEMVER-MAJOR**: Drop support for node < 6 by default.
|
|
||||||
- **FEATURE**: supports the missing character ranges and sets, such as `*.[a-z]` and `*.[jJ][pP][gG]`
|
|
||||||
- **FEATURE**: new option: `ignorecase` to make `ignore` case sensitive.
|
|
||||||
- **FEATURE**: supports question mark which matches a single character.
|
|
||||||
- **PATCH**: fixes typescript declaration.
|
|
||||||
|
|
||||||
## ~ 2018-08-09, Version 4.0.1 - 4.0.5
|
|
||||||
|
|
||||||
- **PATCH**: updates README.md about frequent asked quesions from github issues.
|
|
||||||
|
|
||||||
## 2018-08-12, Version 4.0.6
|
|
||||||
|
|
||||||
- **PATCH**: `Object.prototype` methods will not ruin the result any more.
|
|
21
node_modules/@eslint/eslintrc/node_modules/ignore/LICENSE-MIT
generated
vendored
21
node_modules/@eslint/eslintrc/node_modules/ignore/LICENSE-MIT
generated
vendored
|
@ -1,21 +0,0 @@
|
||||||
Copyright (c) 2013 Kael Zhang <i@kael.me>, contributors
|
|
||||||
http://kael.me/
|
|
||||||
|
|
||||||
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.
|
|
307
node_modules/@eslint/eslintrc/node_modules/ignore/README.md
generated
vendored
307
node_modules/@eslint/eslintrc/node_modules/ignore/README.md
generated
vendored
|
@ -1,307 +0,0 @@
|
||||||
<table><thead>
|
|
||||||
<tr>
|
|
||||||
<th>Linux</th>
|
|
||||||
<th>OS X</th>
|
|
||||||
<th>Windows</th>
|
|
||||||
<th>Coverage</th>
|
|
||||||
<th>Downloads</th>
|
|
||||||
</tr>
|
|
||||||
</thead><tbody><tr>
|
|
||||||
<td colspan="2" align="center">
|
|
||||||
<a href="https://travis-ci.org/kaelzhang/node-ignore">
|
|
||||||
<img
|
|
||||||
src="https://travis-ci.org/kaelzhang/node-ignore.svg?branch=master"
|
|
||||||
alt="Build Status" /></a>
|
|
||||||
</td>
|
|
||||||
<td align="center">
|
|
||||||
<a href="https://ci.appveyor.com/project/kaelzhang/node-ignore">
|
|
||||||
<img
|
|
||||||
src="https://ci.appveyor.com/api/projects/status/github/kaelzhang/node-ignore?branch=master&svg=true"
|
|
||||||
alt="Windows Build Status" /></a>
|
|
||||||
</td>
|
|
||||||
<td align="center">
|
|
||||||
<a href="https://codecov.io/gh/kaelzhang/node-ignore">
|
|
||||||
<img
|
|
||||||
src="https://codecov.io/gh/kaelzhang/node-ignore/branch/master/graph/badge.svg"
|
|
||||||
alt="Coverage Status" /></a>
|
|
||||||
</td>
|
|
||||||
<td align="center">
|
|
||||||
<a href="https://www.npmjs.org/package/ignore">
|
|
||||||
<img
|
|
||||||
src="http://img.shields.io/npm/dm/ignore.svg"
|
|
||||||
alt="npm module downloads per month" /></a>
|
|
||||||
</td>
|
|
||||||
</tr></tbody></table>
|
|
||||||
|
|
||||||
# ignore
|
|
||||||
|
|
||||||
`ignore` is a manager, filter and parser which implemented in pure JavaScript according to the .gitignore [spec](http://git-scm.com/docs/gitignore).
|
|
||||||
|
|
||||||
Pay attention that [`minimatch`](https://www.npmjs.org/package/minimatch) does not work in the gitignore way. To filter filenames according to .gitignore file, I recommend this module.
|
|
||||||
|
|
||||||
##### Tested on
|
|
||||||
|
|
||||||
- Linux + Node: `0.8` - `7.x`
|
|
||||||
- Windows + Node: `0.10` - `7.x`, node < `0.10` is not tested due to the lack of support of appveyor.
|
|
||||||
|
|
||||||
Actually, `ignore` does not rely on any versions of node specially.
|
|
||||||
|
|
||||||
Since `4.0.0`, ignore will no longer support `node < 6` by default, to use in node < 6, `require('ignore/legacy')`. For details, see [CHANGELOG](https://github.com/kaelzhang/node-ignore/blob/master/CHANGELOG.md).
|
|
||||||
|
|
||||||
## Table Of Main Contents
|
|
||||||
|
|
||||||
- [Usage](#usage)
|
|
||||||
- [`Pathname` Conventions](#pathname-conventions)
|
|
||||||
- [Guide for 2.x -> 3.x](#upgrade-2x---3x)
|
|
||||||
- [Guide for 3.x -> 4.x](#upgrade-3x---4x)
|
|
||||||
- See Also:
|
|
||||||
- [`glob-gitignore`](https://www.npmjs.com/package/glob-gitignore) matches files using patterns and filters them according to gitignore rules.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```js
|
|
||||||
import ignore from 'ignore'
|
|
||||||
const ig = ignore().add(['.abc/*', '!.abc/d/'])
|
|
||||||
```
|
|
||||||
|
|
||||||
### Filter the given paths
|
|
||||||
|
|
||||||
```js
|
|
||||||
const paths = [
|
|
||||||
'.abc/a.js', // filtered out
|
|
||||||
'.abc/d/e.js' // included
|
|
||||||
]
|
|
||||||
|
|
||||||
ig.filter(paths) // ['.abc/d/e.js']
|
|
||||||
ig.ignores('.abc/a.js') // true
|
|
||||||
```
|
|
||||||
|
|
||||||
### As the filter function
|
|
||||||
|
|
||||||
```js
|
|
||||||
paths.filter(ig.createFilter()); // ['.abc/d/e.js']
|
|
||||||
```
|
|
||||||
|
|
||||||
### Win32 paths will be handled
|
|
||||||
|
|
||||||
```js
|
|
||||||
ig.filter(['.abc\\a.js', '.abc\\d\\e.js'])
|
|
||||||
// if the code above runs on windows, the result will be
|
|
||||||
// ['.abc\\d\\e.js']
|
|
||||||
```
|
|
||||||
|
|
||||||
## Why another ignore?
|
|
||||||
|
|
||||||
- `ignore` is a standalone module, and is much simpler so that it could easy work with other programs, unlike [isaacs](https://npmjs.org/~isaacs)'s [fstream-ignore](https://npmjs.org/package/fstream-ignore) which must work with the modules of the fstream family.
|
|
||||||
|
|
||||||
- `ignore` only contains utility methods to filter paths according to the specified ignore rules, so
|
|
||||||
- `ignore` never try to find out ignore rules by traversing directories or fetching from git configurations.
|
|
||||||
- `ignore` don't cares about sub-modules of git projects.
|
|
||||||
|
|
||||||
- Exactly according to [gitignore man page](http://git-scm.com/docs/gitignore), fixes some known matching issues of fstream-ignore, such as:
|
|
||||||
- '`/*.js`' should only match '`a.js`', but not '`abc/a.js`'.
|
|
||||||
- '`**/foo`' should match '`foo`' anywhere.
|
|
||||||
- Prevent re-including a file if a parent directory of that file is excluded.
|
|
||||||
- Handle trailing whitespaces:
|
|
||||||
- `'a '`(one space) should not match `'a '`(two spaces).
|
|
||||||
- `'a \ '` matches `'a '`
|
|
||||||
- All test cases are verified with the result of `git check-ignore`.
|
|
||||||
|
|
||||||
# Methods
|
|
||||||
|
|
||||||
## .add(pattern: string | Ignore): this
|
|
||||||
## .add(patterns: Array<string | Ignore>): this
|
|
||||||
|
|
||||||
- **pattern** `String | Ignore` An ignore pattern string, or the `Ignore` instance
|
|
||||||
- **patterns** `Array<String | Ignore>` Array of ignore patterns.
|
|
||||||
|
|
||||||
Adds a rule or several rules to the current manager.
|
|
||||||
|
|
||||||
Returns `this`
|
|
||||||
|
|
||||||
Notice that a line starting with `'#'`(hash) is treated as a comment. Put a backslash (`'\'`) in front of the first hash for patterns that begin with a hash, if you want to ignore a file with a hash at the beginning of the filename.
|
|
||||||
|
|
||||||
```js
|
|
||||||
ignore().add('#abc').ignores('#abc') // false
|
|
||||||
ignore().add('\#abc').ignores('#abc') // true
|
|
||||||
```
|
|
||||||
|
|
||||||
`pattern` could either be a line of ignore pattern or a string of multiple ignore patterns, which means we could just `ignore().add()` the content of a ignore file:
|
|
||||||
|
|
||||||
```js
|
|
||||||
ignore()
|
|
||||||
.add(fs.readFileSync(filenameOfGitignore).toString())
|
|
||||||
.filter(filenames)
|
|
||||||
```
|
|
||||||
|
|
||||||
`pattern` could also be an `ignore` instance, so that we could easily inherit the rules of another `Ignore` instance.
|
|
||||||
|
|
||||||
## <strike>.addIgnoreFile(path)</strike>
|
|
||||||
|
|
||||||
REMOVED in `3.x` for now.
|
|
||||||
|
|
||||||
To upgrade `ignore@2.x` up to `3.x`, use
|
|
||||||
|
|
||||||
```js
|
|
||||||
import fs from 'fs'
|
|
||||||
|
|
||||||
if (fs.existsSync(filename)) {
|
|
||||||
ignore().add(fs.readFileSync(filename).toString())
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
instead.
|
|
||||||
|
|
||||||
## .filter(paths: Array<Pathname>): Array<Pathname>
|
|
||||||
|
|
||||||
```ts
|
|
||||||
type Pathname = string
|
|
||||||
```
|
|
||||||
|
|
||||||
Filters the given array of pathnames, and returns the filtered array.
|
|
||||||
|
|
||||||
- **paths** `Array.<Pathname>` The array of `pathname`s to be filtered.
|
|
||||||
|
|
||||||
### `Pathname` Conventions:
|
|
||||||
|
|
||||||
#### 1. `Pathname` should be a `path.relative()`d pathname
|
|
||||||
|
|
||||||
`Pathname` should be a string that have been `path.join()`ed, or the return value of `path.relative()` to the current directory.
|
|
||||||
|
|
||||||
```js
|
|
||||||
// WRONG
|
|
||||||
ig.ignores('./abc')
|
|
||||||
|
|
||||||
// WRONG, for it will never happen.
|
|
||||||
// If the gitignore rule locates at the root directory,
|
|
||||||
// `'/abc'` should be changed to `'abc'`.
|
|
||||||
// ```
|
|
||||||
// path.relative('/', '/abc') -> 'abc'
|
|
||||||
// ```
|
|
||||||
ig.ignores('/abc')
|
|
||||||
|
|
||||||
// Right
|
|
||||||
ig.ignores('abc')
|
|
||||||
|
|
||||||
// Right
|
|
||||||
ig.ignores(path.join('./abc')) // path.join('./abc') -> 'abc'
|
|
||||||
```
|
|
||||||
|
|
||||||
In other words, each `Pathname` here should be a relative path to the directory of the gitignore rules.
|
|
||||||
|
|
||||||
Suppose the dir structure is:
|
|
||||||
|
|
||||||
```
|
|
||||||
/path/to/your/repo
|
|
||||||
|-- a
|
|
||||||
| |-- a.js
|
|
||||||
|
|
|
||||||
|-- .b
|
|
||||||
|
|
|
||||||
|-- .c
|
|
||||||
|-- .DS_store
|
|
||||||
```
|
|
||||||
|
|
||||||
Then the `paths` might be like this:
|
|
||||||
|
|
||||||
```js
|
|
||||||
[
|
|
||||||
'a/a.js'
|
|
||||||
'.b',
|
|
||||||
'.c/.DS_store'
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
Usually, you could use [`glob`](http://npmjs.org/package/glob) with `option.mark = true` to fetch the structure of the current directory:
|
|
||||||
|
|
||||||
```js
|
|
||||||
import glob from 'glob'
|
|
||||||
|
|
||||||
glob('**', {
|
|
||||||
// Adds a / character to directory matches.
|
|
||||||
mark: true
|
|
||||||
}, (err, files) => {
|
|
||||||
if (err) {
|
|
||||||
return console.error(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
let filtered = ignore().add(patterns).filter(files)
|
|
||||||
console.log(filtered)
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 2. filenames and dirnames
|
|
||||||
|
|
||||||
`node-ignore` does NO `fs.stat` during path matching, so for the example below:
|
|
||||||
|
|
||||||
```js
|
|
||||||
ig.add('config/')
|
|
||||||
|
|
||||||
// `ig` does NOT know if 'config' is a normal file, directory or something
|
|
||||||
ig.ignores('config') // And it returns `false`
|
|
||||||
|
|
||||||
ig.ignores('config/') // returns `true`
|
|
||||||
```
|
|
||||||
|
|
||||||
Specially for people who develop some library based on `node-ignore`, it is important to understand that.
|
|
||||||
|
|
||||||
## .ignores(pathname: Pathname): boolean
|
|
||||||
|
|
||||||
> new in 3.2.0
|
|
||||||
|
|
||||||
Returns `Boolean` whether `pathname` should be ignored.
|
|
||||||
|
|
||||||
```js
|
|
||||||
ig.ignores('.abc/a.js') // true
|
|
||||||
```
|
|
||||||
|
|
||||||
## .createFilter()
|
|
||||||
|
|
||||||
Creates a filter function which could filter an array of paths with `Array.prototype.filter`.
|
|
||||||
|
|
||||||
Returns `function(path)` the filter function.
|
|
||||||
|
|
||||||
## `options.ignorecase` since 4.0.0
|
|
||||||
|
|
||||||
Similar as the `core.ignorecase` option of [git-config](https://git-scm.com/docs/git-config), `node-ignore` will be case insensitive if `options.ignorecase` is set to `true` (default value), otherwise case sensitive.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const ig = ignore({
|
|
||||||
ignorecase: false
|
|
||||||
})
|
|
||||||
|
|
||||||
ig.add('*.png')
|
|
||||||
|
|
||||||
ig.ignores('*.PNG') // false
|
|
||||||
```
|
|
||||||
|
|
||||||
****
|
|
||||||
|
|
||||||
# Upgrade Guide
|
|
||||||
|
|
||||||
## Upgrade 2.x -> 3.x
|
|
||||||
|
|
||||||
- All `options` of 2.x are unnecessary and removed, so just remove them.
|
|
||||||
- `ignore()` instance is no longer an [`EventEmitter`](nodejs.org/api/events.html), and all events are unnecessary and removed.
|
|
||||||
- `.addIgnoreFile()` is removed, see the [.addIgnoreFile](#addignorefilepath) section for details.
|
|
||||||
|
|
||||||
## Upgrade 3.x -> 4.x
|
|
||||||
|
|
||||||
Since `4.0.0`, `ignore` will no longer support node < 6, to use `ignore` in node < 6:
|
|
||||||
|
|
||||||
```js
|
|
||||||
var ignore = require('ignore/legacy')
|
|
||||||
```
|
|
||||||
|
|
||||||
****
|
|
||||||
|
|
||||||
# Collaborators
|
|
||||||
|
|
||||||
- [@whitecolor](https://github.com/whitecolor) *Alex*
|
|
||||||
- [@SamyPesse](https://github.com/SamyPesse) *Samy Pessé*
|
|
||||||
- [@azproduction](https://github.com/azproduction) *Mikhail Davydov*
|
|
||||||
- [@TrySound](https://github.com/TrySound) *Bogdan Chadkin*
|
|
||||||
- [@JanMattner](https://github.com/JanMattner) *Jan Mattner*
|
|
||||||
- [@ntwb](https://github.com/ntwb) *Stephen Edgar*
|
|
||||||
- [@kasperisager](https://github.com/kasperisager) *Kasper Isager*
|
|
||||||
- [@sandersn](https://github.com/sandersn) *Nathan Shively-Sanders*
|
|
45
node_modules/@eslint/eslintrc/node_modules/ignore/index.d.ts
generated
vendored
45
node_modules/@eslint/eslintrc/node_modules/ignore/index.d.ts
generated
vendored
|
@ -1,45 +0,0 @@
|
||||||
interface Ignore {
|
|
||||||
/**
|
|
||||||
* Adds a rule rules to the current manager.
|
|
||||||
* @param {string | Ignore} pattern
|
|
||||||
* @returns IgnoreBase
|
|
||||||
*/
|
|
||||||
add(pattern: string | Ignore): Ignore
|
|
||||||
/**
|
|
||||||
* Adds several rules to the current manager.
|
|
||||||
* @param {string[]} patterns
|
|
||||||
* @returns IgnoreBase
|
|
||||||
*/
|
|
||||||
add(patterns: (string | Ignore)[]): Ignore
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filters the given array of pathnames, and returns the filtered array.
|
|
||||||
* NOTICE that each path here should be a relative path to the root of your repository.
|
|
||||||
* @param paths the array of paths to be filtered.
|
|
||||||
* @returns The filtered array of paths
|
|
||||||
*/
|
|
||||||
filter(paths: string[]): string[]
|
|
||||||
/**
|
|
||||||
* Creates a filter function which could filter
|
|
||||||
* an array of paths with Array.prototype.filter.
|
|
||||||
*/
|
|
||||||
createFilter(): (path: string) => boolean
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns Boolean whether pathname should be ignored.
|
|
||||||
* @param {string} pathname a path to check
|
|
||||||
* @returns boolean
|
|
||||||
*/
|
|
||||||
ignores(pathname: string): boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Options {
|
|
||||||
ignorecase?: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates new ignore manager.
|
|
||||||
*/
|
|
||||||
declare function ignore(options?: Options): Ignore
|
|
||||||
|
|
||||||
export default ignore
|
|
463
node_modules/@eslint/eslintrc/node_modules/ignore/index.js
generated
vendored
463
node_modules/@eslint/eslintrc/node_modules/ignore/index.js
generated
vendored
|
@ -1,463 +0,0 @@
|
||||||
// A simple implementation of make-array
|
|
||||||
function make_array (subject) {
|
|
||||||
return Array.isArray(subject)
|
|
||||||
? subject
|
|
||||||
: [subject]
|
|
||||||
}
|
|
||||||
|
|
||||||
const REGEX_BLANK_LINE = /^\s+$/
|
|
||||||
const REGEX_LEADING_EXCAPED_EXCLAMATION = /^\\!/
|
|
||||||
const REGEX_LEADING_EXCAPED_HASH = /^\\#/
|
|
||||||
const SLASH = '/'
|
|
||||||
const KEY_IGNORE = typeof Symbol !== 'undefined'
|
|
||||||
? Symbol.for('node-ignore')
|
|
||||||
/* istanbul ignore next */
|
|
||||||
: 'node-ignore'
|
|
||||||
|
|
||||||
const define = (object, key, value) =>
|
|
||||||
Object.defineProperty(object, key, {value})
|
|
||||||
|
|
||||||
const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g
|
|
||||||
|
|
||||||
// Sanitize the range of a regular expression
|
|
||||||
// The cases are complicated, see test cases for details
|
|
||||||
const sanitizeRange = range => range.replace(
|
|
||||||
REGEX_REGEXP_RANGE,
|
|
||||||
(match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0)
|
|
||||||
? match
|
|
||||||
// Invalid range (out of order) which is ok for gitignore rules but
|
|
||||||
// fatal for JavaScript regular expression, so eliminate it.
|
|
||||||
: ''
|
|
||||||
)
|
|
||||||
|
|
||||||
// > If the pattern ends with a slash,
|
|
||||||
// > it is removed for the purpose of the following description,
|
|
||||||
// > but it would only find a match with a directory.
|
|
||||||
// > In other words, foo/ will match a directory foo and paths underneath it,
|
|
||||||
// > but will not match a regular file or a symbolic link foo
|
|
||||||
// > (this is consistent with the way how pathspec works in general in Git).
|
|
||||||
// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'
|
|
||||||
// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call
|
|
||||||
// you could use option `mark: true` with `glob`
|
|
||||||
|
|
||||||
// '`foo/`' should not continue with the '`..`'
|
|
||||||
const DEFAULT_REPLACER_PREFIX = [
|
|
||||||
|
|
||||||
// > Trailing spaces are ignored unless they are quoted with backslash ("\")
|
|
||||||
[
|
|
||||||
// (a\ ) -> (a )
|
|
||||||
// (a ) -> (a)
|
|
||||||
// (a \ ) -> (a )
|
|
||||||
/\\?\s+$/,
|
|
||||||
match => match.indexOf('\\') === 0
|
|
||||||
? ' '
|
|
||||||
: ''
|
|
||||||
],
|
|
||||||
|
|
||||||
// replace (\ ) with ' '
|
|
||||||
[
|
|
||||||
/\\\s/g,
|
|
||||||
() => ' '
|
|
||||||
],
|
|
||||||
|
|
||||||
// Escape metacharacters
|
|
||||||
// which is written down by users but means special for regular expressions.
|
|
||||||
|
|
||||||
// > There are 12 characters with special meanings:
|
|
||||||
// > - the backslash \,
|
|
||||||
// > - the caret ^,
|
|
||||||
// > - the dollar sign $,
|
|
||||||
// > - the period or dot .,
|
|
||||||
// > - the vertical bar or pipe symbol |,
|
|
||||||
// > - the question mark ?,
|
|
||||||
// > - the asterisk or star *,
|
|
||||||
// > - the plus sign +,
|
|
||||||
// > - the opening parenthesis (,
|
|
||||||
// > - the closing parenthesis ),
|
|
||||||
// > - and the opening square bracket [,
|
|
||||||
// > - the opening curly brace {,
|
|
||||||
// > These special characters are often called "metacharacters".
|
|
||||||
[
|
|
||||||
/[\\^$.|*+(){]/g,
|
|
||||||
match => `\\${match}`
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
|
||||||
// > [abc] matches any character inside the brackets
|
|
||||||
// > (in this case a, b, or c);
|
|
||||||
/\[([^\]/]*)($|\])/g,
|
|
||||||
(match, p1, p2) => p2 === ']'
|
|
||||||
? `[${sanitizeRange(p1)}]`
|
|
||||||
: `\\${match}`
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
|
||||||
// > a question mark (?) matches a single character
|
|
||||||
/(?!\\)\?/g,
|
|
||||||
() => '[^/]'
|
|
||||||
],
|
|
||||||
|
|
||||||
// leading slash
|
|
||||||
[
|
|
||||||
|
|
||||||
// > A leading slash matches the beginning of the pathname.
|
|
||||||
// > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
|
|
||||||
// A leading slash matches the beginning of the pathname
|
|
||||||
/^\//,
|
|
||||||
() => '^'
|
|
||||||
],
|
|
||||||
|
|
||||||
// replace special metacharacter slash after the leading slash
|
|
||||||
[
|
|
||||||
/\//g,
|
|
||||||
() => '\\/'
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
|
||||||
// > A leading "**" followed by a slash means match in all directories.
|
|
||||||
// > For example, "**/foo" matches file or directory "foo" anywhere,
|
|
||||||
// > the same as pattern "foo".
|
|
||||||
// > "**/foo/bar" matches file or directory "bar" anywhere that is directly
|
|
||||||
// > under directory "foo".
|
|
||||||
// Notice that the '*'s have been replaced as '\\*'
|
|
||||||
/^\^*\\\*\\\*\\\//,
|
|
||||||
|
|
||||||
// '**/foo' <-> 'foo'
|
|
||||||
() => '^(?:.*\\/)?'
|
|
||||||
]
|
|
||||||
]
|
|
||||||
|
|
||||||
const DEFAULT_REPLACER_SUFFIX = [
|
|
||||||
// starting
|
|
||||||
[
|
|
||||||
// there will be no leading '/'
|
|
||||||
// (which has been replaced by section "leading slash")
|
|
||||||
// If starts with '**', adding a '^' to the regular expression also works
|
|
||||||
/^(?=[^^])/,
|
|
||||||
function startingReplacer () {
|
|
||||||
return !/\/(?!$)/.test(this)
|
|
||||||
// > If the pattern does not contain a slash /,
|
|
||||||
// > Git treats it as a shell glob pattern
|
|
||||||
// Actually, if there is only a trailing slash,
|
|
||||||
// git also treats it as a shell glob pattern
|
|
||||||
? '(?:^|\\/)'
|
|
||||||
|
|
||||||
// > Otherwise, Git treats the pattern as a shell glob suitable for
|
|
||||||
// > consumption by fnmatch(3)
|
|
||||||
: '^'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
// two globstars
|
|
||||||
[
|
|
||||||
// Use lookahead assertions so that we could match more than one `'/**'`
|
|
||||||
/\\\/\\\*\\\*(?=\\\/|$)/g,
|
|
||||||
|
|
||||||
// Zero, one or several directories
|
|
||||||
// should not use '*', or it will be replaced by the next replacer
|
|
||||||
|
|
||||||
// Check if it is not the last `'/**'`
|
|
||||||
(match, index, str) => index + 6 < str.length
|
|
||||||
|
|
||||||
// case: /**/
|
|
||||||
// > A slash followed by two consecutive asterisks then a slash matches
|
|
||||||
// > zero or more directories.
|
|
||||||
// > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.
|
|
||||||
// '/**/'
|
|
||||||
? '(?:\\/[^\\/]+)*'
|
|
||||||
|
|
||||||
// case: /**
|
|
||||||
// > A trailing `"/**"` matches everything inside.
|
|
||||||
|
|
||||||
// #21: everything inside but it should not include the current folder
|
|
||||||
: '\\/.+'
|
|
||||||
],
|
|
||||||
|
|
||||||
// intermediate wildcards
|
|
||||||
[
|
|
||||||
// Never replace escaped '*'
|
|
||||||
// ignore rule '\*' will match the path '*'
|
|
||||||
|
|
||||||
// 'abc.*/' -> go
|
|
||||||
// 'abc.*' -> skip this rule
|
|
||||||
/(^|[^\\]+)\\\*(?=.+)/g,
|
|
||||||
|
|
||||||
// '*.js' matches '.js'
|
|
||||||
// '*.js' doesn't match 'abc'
|
|
||||||
(match, p1) => `${p1}[^\\/]*`
|
|
||||||
],
|
|
||||||
|
|
||||||
// trailing wildcard
|
|
||||||
[
|
|
||||||
/(\^|\\\/)?\\\*$/,
|
|
||||||
(match, p1) => {
|
|
||||||
const prefix = p1
|
|
||||||
// '\^':
|
|
||||||
// '/*' does not match ''
|
|
||||||
// '/*' does not match everything
|
|
||||||
|
|
||||||
// '\\\/':
|
|
||||||
// 'abc/*' does not match 'abc/'
|
|
||||||
? `${p1}[^/]+`
|
|
||||||
|
|
||||||
// 'a*' matches 'a'
|
|
||||||
// 'a*' matches 'aa'
|
|
||||||
: '[^/]*'
|
|
||||||
|
|
||||||
return `${prefix}(?=$|\\/$)`
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
|
||||||
// unescape
|
|
||||||
/\\\\\\/g,
|
|
||||||
() => '\\'
|
|
||||||
]
|
|
||||||
]
|
|
||||||
|
|
||||||
const POSITIVE_REPLACERS = [
|
|
||||||
...DEFAULT_REPLACER_PREFIX,
|
|
||||||
|
|
||||||
// 'f'
|
|
||||||
// matches
|
|
||||||
// - /f(end)
|
|
||||||
// - /f/
|
|
||||||
// - (start)f(end)
|
|
||||||
// - (start)f/
|
|
||||||
// doesn't match
|
|
||||||
// - oof
|
|
||||||
// - foo
|
|
||||||
// pseudo:
|
|
||||||
// -> (^|/)f(/|$)
|
|
||||||
|
|
||||||
// ending
|
|
||||||
[
|
|
||||||
// 'js' will not match 'js.'
|
|
||||||
// 'ab' will not match 'abc'
|
|
||||||
/(?:[^*/])$/,
|
|
||||||
|
|
||||||
// 'js*' will not match 'a.js'
|
|
||||||
// 'js/' will not match 'a.js'
|
|
||||||
// 'js' will match 'a.js' and 'a.js/'
|
|
||||||
match => `${match}(?=$|\\/)`
|
|
||||||
],
|
|
||||||
|
|
||||||
...DEFAULT_REPLACER_SUFFIX
|
|
||||||
]
|
|
||||||
|
|
||||||
const NEGATIVE_REPLACERS = [
|
|
||||||
...DEFAULT_REPLACER_PREFIX,
|
|
||||||
|
|
||||||
// #24, #38
|
|
||||||
// The MISSING rule of [gitignore docs](https://git-scm.com/docs/gitignore)
|
|
||||||
// A negative pattern without a trailing wildcard should not
|
|
||||||
// re-include the things inside that directory.
|
|
||||||
|
|
||||||
// eg:
|
|
||||||
// ['node_modules/*', '!node_modules']
|
|
||||||
// should ignore `node_modules/a.js`
|
|
||||||
[
|
|
||||||
/(?:[^*])$/,
|
|
||||||
match => `${match}(?=$|\\/$)`
|
|
||||||
],
|
|
||||||
|
|
||||||
...DEFAULT_REPLACER_SUFFIX
|
|
||||||
]
|
|
||||||
|
|
||||||
// A simple cache, because an ignore rule only has only one certain meaning
|
|
||||||
const cache = Object.create(null)
|
|
||||||
|
|
||||||
// @param {pattern}
|
|
||||||
const make_regex = (pattern, negative, ignorecase) => {
|
|
||||||
const r = cache[pattern]
|
|
||||||
if (r) {
|
|
||||||
return r
|
|
||||||
}
|
|
||||||
|
|
||||||
const replacers = negative
|
|
||||||
? NEGATIVE_REPLACERS
|
|
||||||
: POSITIVE_REPLACERS
|
|
||||||
|
|
||||||
const source = replacers.reduce(
|
|
||||||
(prev, current) => prev.replace(current[0], current[1].bind(pattern)),
|
|
||||||
pattern
|
|
||||||
)
|
|
||||||
|
|
||||||
return cache[pattern] = ignorecase
|
|
||||||
? new RegExp(source, 'i')
|
|
||||||
: new RegExp(source)
|
|
||||||
}
|
|
||||||
|
|
||||||
// > A blank line matches no files, so it can serve as a separator for readability.
|
|
||||||
const checkPattern = pattern => pattern
|
|
||||||
&& typeof pattern === 'string'
|
|
||||||
&& !REGEX_BLANK_LINE.test(pattern)
|
|
||||||
|
|
||||||
// > A line starting with # serves as a comment.
|
|
||||||
&& pattern.indexOf('#') !== 0
|
|
||||||
|
|
||||||
const createRule = (pattern, ignorecase) => {
|
|
||||||
const origin = pattern
|
|
||||||
let negative = false
|
|
||||||
|
|
||||||
// > An optional prefix "!" which negates the pattern;
|
|
||||||
if (pattern.indexOf('!') === 0) {
|
|
||||||
negative = true
|
|
||||||
pattern = pattern.substr(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
pattern = pattern
|
|
||||||
// > Put a backslash ("\") in front of the first "!" for patterns that
|
|
||||||
// > begin with a literal "!", for example, `"\!important!.txt"`.
|
|
||||||
.replace(REGEX_LEADING_EXCAPED_EXCLAMATION, '!')
|
|
||||||
// > Put a backslash ("\") in front of the first hash for patterns that
|
|
||||||
// > begin with a hash.
|
|
||||||
.replace(REGEX_LEADING_EXCAPED_HASH, '#')
|
|
||||||
|
|
||||||
const regex = make_regex(pattern, negative, ignorecase)
|
|
||||||
|
|
||||||
return {
|
|
||||||
origin,
|
|
||||||
pattern,
|
|
||||||
negative,
|
|
||||||
regex
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class IgnoreBase {
|
|
||||||
constructor ({
|
|
||||||
ignorecase = true
|
|
||||||
} = {}) {
|
|
||||||
this._rules = []
|
|
||||||
this._ignorecase = ignorecase
|
|
||||||
define(this, KEY_IGNORE, true)
|
|
||||||
this._initCache()
|
|
||||||
}
|
|
||||||
|
|
||||||
_initCache () {
|
|
||||||
this._cache = Object.create(null)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @param {Array.<string>|string|Ignore} pattern
|
|
||||||
add (pattern) {
|
|
||||||
this._added = false
|
|
||||||
|
|
||||||
if (typeof pattern === 'string') {
|
|
||||||
pattern = pattern.split(/\r?\n/g)
|
|
||||||
}
|
|
||||||
|
|
||||||
make_array(pattern).forEach(this._addPattern, this)
|
|
||||||
|
|
||||||
// Some rules have just added to the ignore,
|
|
||||||
// making the behavior changed.
|
|
||||||
if (this._added) {
|
|
||||||
this._initCache()
|
|
||||||
}
|
|
||||||
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
// legacy
|
|
||||||
addPattern (pattern) {
|
|
||||||
return this.add(pattern)
|
|
||||||
}
|
|
||||||
|
|
||||||
_addPattern (pattern) {
|
|
||||||
// #32
|
|
||||||
if (pattern && pattern[KEY_IGNORE]) {
|
|
||||||
this._rules = this._rules.concat(pattern._rules)
|
|
||||||
this._added = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (checkPattern(pattern)) {
|
|
||||||
const rule = createRule(pattern, this._ignorecase)
|
|
||||||
this._added = true
|
|
||||||
this._rules.push(rule)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
filter (paths) {
|
|
||||||
return make_array(paths).filter(path => this._filter(path))
|
|
||||||
}
|
|
||||||
|
|
||||||
createFilter () {
|
|
||||||
return path => this._filter(path)
|
|
||||||
}
|
|
||||||
|
|
||||||
ignores (path) {
|
|
||||||
return !this._filter(path)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @returns `Boolean` true if the `path` is NOT ignored
|
|
||||||
_filter (path, slices) {
|
|
||||||
if (!path) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (path in this._cache) {
|
|
||||||
return this._cache[path]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!slices) {
|
|
||||||
// path/to/a.js
|
|
||||||
// ['path', 'to', 'a.js']
|
|
||||||
slices = path.split(SLASH)
|
|
||||||
}
|
|
||||||
|
|
||||||
slices.pop()
|
|
||||||
|
|
||||||
return this._cache[path] = slices.length
|
|
||||||
// > It is not possible to re-include a file if a parent directory of
|
|
||||||
// > that file is excluded.
|
|
||||||
// If the path contains a parent directory, check the parent first
|
|
||||||
? this._filter(slices.join(SLASH) + SLASH, slices)
|
|
||||||
&& this._test(path)
|
|
||||||
|
|
||||||
// Or only test the path
|
|
||||||
: this._test(path)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @returns {Boolean} true if a file is NOT ignored
|
|
||||||
_test (path) {
|
|
||||||
// Explicitly define variable type by setting matched to `0`
|
|
||||||
let matched = 0
|
|
||||||
|
|
||||||
this._rules.forEach(rule => {
|
|
||||||
// if matched = true, then we only test negative rules
|
|
||||||
// if matched = false, then we test non-negative rules
|
|
||||||
if (!(matched ^ rule.negative)) {
|
|
||||||
matched = rule.negative ^ rule.regex.test(path)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return !matched
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Windows
|
|
||||||
// --------------------------------------------------------------
|
|
||||||
/* istanbul ignore if */
|
|
||||||
if (
|
|
||||||
// Detect `process` so that it can run in browsers.
|
|
||||||
typeof process !== 'undefined'
|
|
||||||
&& (
|
|
||||||
process.env && process.env.IGNORE_TEST_WIN32
|
|
||||||
|| process.platform === 'win32'
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
const filter = IgnoreBase.prototype._filter
|
|
||||||
|
|
||||||
/* eslint no-control-regex: "off" */
|
|
||||||
const make_posix = str => /^\\\\\?\\/.test(str)
|
|
||||||
|| /[^\x00-\x80]+/.test(str)
|
|
||||||
? str
|
|
||||||
: str.replace(/\\/g, '/')
|
|
||||||
|
|
||||||
IgnoreBase.prototype._filter = function filterWin32 (path, slices) {
|
|
||||||
path = make_posix(path)
|
|
||||||
return filter.call(this, path, slices)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = options => new IgnoreBase(options)
|
|
466
node_modules/@eslint/eslintrc/node_modules/ignore/legacy.js
generated
vendored
466
node_modules/@eslint/eslintrc/node_modules/ignore/legacy.js
generated
vendored
|
@ -1,466 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
||||||
|
|
||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
||||||
|
|
||||||
// A simple implementation of make-array
|
|
||||||
function make_array(subject) {
|
|
||||||
return Array.isArray(subject) ? subject : [subject];
|
|
||||||
}
|
|
||||||
|
|
||||||
var REGEX_BLANK_LINE = /^\s+$/;
|
|
||||||
var REGEX_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
|
|
||||||
var REGEX_LEADING_EXCAPED_HASH = /^\\#/;
|
|
||||||
var SLASH = '/';
|
|
||||||
var KEY_IGNORE = typeof Symbol !== 'undefined' ? Symbol.for('node-ignore')
|
|
||||||
/* istanbul ignore next */
|
|
||||||
: 'node-ignore';
|
|
||||||
|
|
||||||
var define = function define(object, key, value) {
|
|
||||||
return Object.defineProperty(object, key, { value });
|
|
||||||
};
|
|
||||||
|
|
||||||
var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
|
|
||||||
|
|
||||||
// Sanitize the range of a regular expression
|
|
||||||
// The cases are complicated, see test cases for details
|
|
||||||
var sanitizeRange = function sanitizeRange(range) {
|
|
||||||
return range.replace(REGEX_REGEXP_RANGE, function (match, from, to) {
|
|
||||||
return from.charCodeAt(0) <= to.charCodeAt(0) ? match
|
|
||||||
// Invalid range (out of order) which is ok for gitignore rules but
|
|
||||||
// fatal for JavaScript regular expression, so eliminate it.
|
|
||||||
: '';
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// > If the pattern ends with a slash,
|
|
||||||
// > it is removed for the purpose of the following description,
|
|
||||||
// > but it would only find a match with a directory.
|
|
||||||
// > In other words, foo/ will match a directory foo and paths underneath it,
|
|
||||||
// > but will not match a regular file or a symbolic link foo
|
|
||||||
// > (this is consistent with the way how pathspec works in general in Git).
|
|
||||||
// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'
|
|
||||||
// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call
|
|
||||||
// you could use option `mark: true` with `glob`
|
|
||||||
|
|
||||||
// '`foo/`' should not continue with the '`..`'
|
|
||||||
var DEFAULT_REPLACER_PREFIX = [
|
|
||||||
|
|
||||||
// > Trailing spaces are ignored unless they are quoted with backslash ("\")
|
|
||||||
[
|
|
||||||
// (a\ ) -> (a )
|
|
||||||
// (a ) -> (a)
|
|
||||||
// (a \ ) -> (a )
|
|
||||||
/\\?\s+$/, function (match) {
|
|
||||||
return match.indexOf('\\') === 0 ? ' ' : '';
|
|
||||||
}],
|
|
||||||
|
|
||||||
// replace (\ ) with ' '
|
|
||||||
[/\\\s/g, function () {
|
|
||||||
return ' ';
|
|
||||||
}],
|
|
||||||
|
|
||||||
// Escape metacharacters
|
|
||||||
// which is written down by users but means special for regular expressions.
|
|
||||||
|
|
||||||
// > There are 12 characters with special meanings:
|
|
||||||
// > - the backslash \,
|
|
||||||
// > - the caret ^,
|
|
||||||
// > - the dollar sign $,
|
|
||||||
// > - the period or dot .,
|
|
||||||
// > - the vertical bar or pipe symbol |,
|
|
||||||
// > - the question mark ?,
|
|
||||||
// > - the asterisk or star *,
|
|
||||||
// > - the plus sign +,
|
|
||||||
// > - the opening parenthesis (,
|
|
||||||
// > - the closing parenthesis ),
|
|
||||||
// > - and the opening square bracket [,
|
|
||||||
// > - the opening curly brace {,
|
|
||||||
// > These special characters are often called "metacharacters".
|
|
||||||
[/[\\^$.|*+(){]/g, function (match) {
|
|
||||||
return `\\${match}`;
|
|
||||||
}], [
|
|
||||||
// > [abc] matches any character inside the brackets
|
|
||||||
// > (in this case a, b, or c);
|
|
||||||
/\[([^\]/]*)($|\])/g, function (match, p1, p2) {
|
|
||||||
return p2 === ']' ? `[${sanitizeRange(p1)}]` : `\\${match}`;
|
|
||||||
}], [
|
|
||||||
// > a question mark (?) matches a single character
|
|
||||||
/(?!\\)\?/g, function () {
|
|
||||||
return '[^/]';
|
|
||||||
}],
|
|
||||||
|
|
||||||
// leading slash
|
|
||||||
[
|
|
||||||
|
|
||||||
// > A leading slash matches the beginning of the pathname.
|
|
||||||
// > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
|
|
||||||
// A leading slash matches the beginning of the pathname
|
|
||||||
/^\//, function () {
|
|
||||||
return '^';
|
|
||||||
}],
|
|
||||||
|
|
||||||
// replace special metacharacter slash after the leading slash
|
|
||||||
[/\//g, function () {
|
|
||||||
return '\\/';
|
|
||||||
}], [
|
|
||||||
// > A leading "**" followed by a slash means match in all directories.
|
|
||||||
// > For example, "**/foo" matches file or directory "foo" anywhere,
|
|
||||||
// > the same as pattern "foo".
|
|
||||||
// > "**/foo/bar" matches file or directory "bar" anywhere that is directly
|
|
||||||
// > under directory "foo".
|
|
||||||
// Notice that the '*'s have been replaced as '\\*'
|
|
||||||
/^\^*\\\*\\\*\\\//,
|
|
||||||
|
|
||||||
// '**/foo' <-> 'foo'
|
|
||||||
function () {
|
|
||||||
return '^(?:.*\\/)?';
|
|
||||||
}]];
|
|
||||||
|
|
||||||
var DEFAULT_REPLACER_SUFFIX = [
|
|
||||||
// starting
|
|
||||||
[
|
|
||||||
// there will be no leading '/'
|
|
||||||
// (which has been replaced by section "leading slash")
|
|
||||||
// If starts with '**', adding a '^' to the regular expression also works
|
|
||||||
/^(?=[^^])/, function startingReplacer() {
|
|
||||||
return !/\/(?!$)/.test(this)
|
|
||||||
// > If the pattern does not contain a slash /,
|
|
||||||
// > Git treats it as a shell glob pattern
|
|
||||||
// Actually, if there is only a trailing slash,
|
|
||||||
// git also treats it as a shell glob pattern
|
|
||||||
? '(?:^|\\/)'
|
|
||||||
|
|
||||||
// > Otherwise, Git treats the pattern as a shell glob suitable for
|
|
||||||
// > consumption by fnmatch(3)
|
|
||||||
: '^';
|
|
||||||
}],
|
|
||||||
|
|
||||||
// two globstars
|
|
||||||
[
|
|
||||||
// Use lookahead assertions so that we could match more than one `'/**'`
|
|
||||||
/\\\/\\\*\\\*(?=\\\/|$)/g,
|
|
||||||
|
|
||||||
// Zero, one or several directories
|
|
||||||
// should not use '*', or it will be replaced by the next replacer
|
|
||||||
|
|
||||||
// Check if it is not the last `'/**'`
|
|
||||||
function (match, index, str) {
|
|
||||||
return index + 6 < str.length
|
|
||||||
|
|
||||||
// case: /**/
|
|
||||||
// > A slash followed by two consecutive asterisks then a slash matches
|
|
||||||
// > zero or more directories.
|
|
||||||
// > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.
|
|
||||||
// '/**/'
|
|
||||||
? '(?:\\/[^\\/]+)*'
|
|
||||||
|
|
||||||
// case: /**
|
|
||||||
// > A trailing `"/**"` matches everything inside.
|
|
||||||
|
|
||||||
// #21: everything inside but it should not include the current folder
|
|
||||||
: '\\/.+';
|
|
||||||
}],
|
|
||||||
|
|
||||||
// intermediate wildcards
|
|
||||||
[
|
|
||||||
// Never replace escaped '*'
|
|
||||||
// ignore rule '\*' will match the path '*'
|
|
||||||
|
|
||||||
// 'abc.*/' -> go
|
|
||||||
// 'abc.*' -> skip this rule
|
|
||||||
/(^|[^\\]+)\\\*(?=.+)/g,
|
|
||||||
|
|
||||||
// '*.js' matches '.js'
|
|
||||||
// '*.js' doesn't match 'abc'
|
|
||||||
function (match, p1) {
|
|
||||||
return `${p1}[^\\/]*`;
|
|
||||||
}],
|
|
||||||
|
|
||||||
// trailing wildcard
|
|
||||||
[/(\^|\\\/)?\\\*$/, function (match, p1) {
|
|
||||||
var prefix = p1
|
|
||||||
// '\^':
|
|
||||||
// '/*' does not match ''
|
|
||||||
// '/*' does not match everything
|
|
||||||
|
|
||||||
// '\\\/':
|
|
||||||
// 'abc/*' does not match 'abc/'
|
|
||||||
? `${p1}[^/]+`
|
|
||||||
|
|
||||||
// 'a*' matches 'a'
|
|
||||||
// 'a*' matches 'aa'
|
|
||||||
: '[^/]*';
|
|
||||||
|
|
||||||
return `${prefix}(?=$|\\/$)`;
|
|
||||||
}], [
|
|
||||||
// unescape
|
|
||||||
/\\\\\\/g, function () {
|
|
||||||
return '\\';
|
|
||||||
}]];
|
|
||||||
|
|
||||||
var POSITIVE_REPLACERS = [].concat(DEFAULT_REPLACER_PREFIX, [
|
|
||||||
|
|
||||||
// 'f'
|
|
||||||
// matches
|
|
||||||
// - /f(end)
|
|
||||||
// - /f/
|
|
||||||
// - (start)f(end)
|
|
||||||
// - (start)f/
|
|
||||||
// doesn't match
|
|
||||||
// - oof
|
|
||||||
// - foo
|
|
||||||
// pseudo:
|
|
||||||
// -> (^|/)f(/|$)
|
|
||||||
|
|
||||||
// ending
|
|
||||||
[
|
|
||||||
// 'js' will not match 'js.'
|
|
||||||
// 'ab' will not match 'abc'
|
|
||||||
/(?:[^*/])$/,
|
|
||||||
|
|
||||||
// 'js*' will not match 'a.js'
|
|
||||||
// 'js/' will not match 'a.js'
|
|
||||||
// 'js' will match 'a.js' and 'a.js/'
|
|
||||||
function (match) {
|
|
||||||
return `${match}(?=$|\\/)`;
|
|
||||||
}]], DEFAULT_REPLACER_SUFFIX);
|
|
||||||
|
|
||||||
var NEGATIVE_REPLACERS = [].concat(DEFAULT_REPLACER_PREFIX, [
|
|
||||||
|
|
||||||
// #24, #38
|
|
||||||
// The MISSING rule of [gitignore docs](https://git-scm.com/docs/gitignore)
|
|
||||||
// A negative pattern without a trailing wildcard should not
|
|
||||||
// re-include the things inside that directory.
|
|
||||||
|
|
||||||
// eg:
|
|
||||||
// ['node_modules/*', '!node_modules']
|
|
||||||
// should ignore `node_modules/a.js`
|
|
||||||
[/(?:[^*])$/, function (match) {
|
|
||||||
return `${match}(?=$|\\/$)`;
|
|
||||||
}]], DEFAULT_REPLACER_SUFFIX);
|
|
||||||
|
|
||||||
// A simple cache, because an ignore rule only has only one certain meaning
|
|
||||||
var cache = Object.create(null);
|
|
||||||
|
|
||||||
// @param {pattern}
|
|
||||||
var make_regex = function make_regex(pattern, negative, ignorecase) {
|
|
||||||
var r = cache[pattern];
|
|
||||||
if (r) {
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
var replacers = negative ? NEGATIVE_REPLACERS : POSITIVE_REPLACERS;
|
|
||||||
|
|
||||||
var source = replacers.reduce(function (prev, current) {
|
|
||||||
return prev.replace(current[0], current[1].bind(pattern));
|
|
||||||
}, pattern);
|
|
||||||
|
|
||||||
return cache[pattern] = ignorecase ? new RegExp(source, 'i') : new RegExp(source);
|
|
||||||
};
|
|
||||||
|
|
||||||
// > A blank line matches no files, so it can serve as a separator for readability.
|
|
||||||
var checkPattern = function checkPattern(pattern) {
|
|
||||||
return pattern && typeof pattern === 'string' && !REGEX_BLANK_LINE.test(pattern)
|
|
||||||
|
|
||||||
// > A line starting with # serves as a comment.
|
|
||||||
&& pattern.indexOf('#') !== 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
var createRule = function createRule(pattern, ignorecase) {
|
|
||||||
var origin = pattern;
|
|
||||||
var negative = false;
|
|
||||||
|
|
||||||
// > An optional prefix "!" which negates the pattern;
|
|
||||||
if (pattern.indexOf('!') === 0) {
|
|
||||||
negative = true;
|
|
||||||
pattern = pattern.substr(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
pattern = pattern
|
|
||||||
// > Put a backslash ("\") in front of the first "!" for patterns that
|
|
||||||
// > begin with a literal "!", for example, `"\!important!.txt"`.
|
|
||||||
.replace(REGEX_LEADING_EXCAPED_EXCLAMATION, '!')
|
|
||||||
// > Put a backslash ("\") in front of the first hash for patterns that
|
|
||||||
// > begin with a hash.
|
|
||||||
.replace(REGEX_LEADING_EXCAPED_HASH, '#');
|
|
||||||
|
|
||||||
var regex = make_regex(pattern, negative, ignorecase);
|
|
||||||
|
|
||||||
return {
|
|
||||||
origin,
|
|
||||||
pattern,
|
|
||||||
negative,
|
|
||||||
regex
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
var IgnoreBase = function () {
|
|
||||||
function IgnoreBase() {
|
|
||||||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
||||||
_ref$ignorecase = _ref.ignorecase,
|
|
||||||
ignorecase = _ref$ignorecase === undefined ? true : _ref$ignorecase;
|
|
||||||
|
|
||||||
_classCallCheck(this, IgnoreBase);
|
|
||||||
|
|
||||||
this._rules = [];
|
|
||||||
this._ignorecase = ignorecase;
|
|
||||||
define(this, KEY_IGNORE, true);
|
|
||||||
this._initCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
_createClass(IgnoreBase, [{
|
|
||||||
key: '_initCache',
|
|
||||||
value: function _initCache() {
|
|
||||||
this._cache = Object.create(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// @param {Array.<string>|string|Ignore} pattern
|
|
||||||
|
|
||||||
}, {
|
|
||||||
key: 'add',
|
|
||||||
value: function add(pattern) {
|
|
||||||
this._added = false;
|
|
||||||
|
|
||||||
if (typeof pattern === 'string') {
|
|
||||||
pattern = pattern.split(/\r?\n/g);
|
|
||||||
}
|
|
||||||
|
|
||||||
make_array(pattern).forEach(this._addPattern, this);
|
|
||||||
|
|
||||||
// Some rules have just added to the ignore,
|
|
||||||
// making the behavior changed.
|
|
||||||
if (this._added) {
|
|
||||||
this._initCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// legacy
|
|
||||||
|
|
||||||
}, {
|
|
||||||
key: 'addPattern',
|
|
||||||
value: function addPattern(pattern) {
|
|
||||||
return this.add(pattern);
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
key: '_addPattern',
|
|
||||||
value: function _addPattern(pattern) {
|
|
||||||
// #32
|
|
||||||
if (pattern && pattern[KEY_IGNORE]) {
|
|
||||||
this._rules = this._rules.concat(pattern._rules);
|
|
||||||
this._added = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (checkPattern(pattern)) {
|
|
||||||
var rule = createRule(pattern, this._ignorecase);
|
|
||||||
this._added = true;
|
|
||||||
this._rules.push(rule);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
key: 'filter',
|
|
||||||
value: function filter(paths) {
|
|
||||||
var _this = this;
|
|
||||||
|
|
||||||
return make_array(paths).filter(function (path) {
|
|
||||||
return _this._filter(path);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
key: 'createFilter',
|
|
||||||
value: function createFilter() {
|
|
||||||
var _this2 = this;
|
|
||||||
|
|
||||||
return function (path) {
|
|
||||||
return _this2._filter(path);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
key: 'ignores',
|
|
||||||
value: function ignores(path) {
|
|
||||||
return !this._filter(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
// @returns `Boolean` true if the `path` is NOT ignored
|
|
||||||
|
|
||||||
}, {
|
|
||||||
key: '_filter',
|
|
||||||
value: function _filter(path, slices) {
|
|
||||||
if (!path) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (path in this._cache) {
|
|
||||||
return this._cache[path];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!slices) {
|
|
||||||
// path/to/a.js
|
|
||||||
// ['path', 'to', 'a.js']
|
|
||||||
slices = path.split(SLASH);
|
|
||||||
}
|
|
||||||
|
|
||||||
slices.pop();
|
|
||||||
|
|
||||||
return this._cache[path] = slices.length
|
|
||||||
// > It is not possible to re-include a file if a parent directory of
|
|
||||||
// > that file is excluded.
|
|
||||||
// If the path contains a parent directory, check the parent first
|
|
||||||
? this._filter(slices.join(SLASH) + SLASH, slices) && this._test(path)
|
|
||||||
|
|
||||||
// Or only test the path
|
|
||||||
: this._test(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
// @returns {Boolean} true if a file is NOT ignored
|
|
||||||
|
|
||||||
}, {
|
|
||||||
key: '_test',
|
|
||||||
value: function _test(path) {
|
|
||||||
// Explicitly define variable type by setting matched to `0`
|
|
||||||
var matched = 0;
|
|
||||||
|
|
||||||
this._rules.forEach(function (rule) {
|
|
||||||
// if matched = true, then we only test negative rules
|
|
||||||
// if matched = false, then we test non-negative rules
|
|
||||||
if (!(matched ^ rule.negative)) {
|
|
||||||
matched = rule.negative ^ rule.regex.test(path);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return !matched;
|
|
||||||
}
|
|
||||||
}]);
|
|
||||||
|
|
||||||
return IgnoreBase;
|
|
||||||
}();
|
|
||||||
|
|
||||||
// Windows
|
|
||||||
// --------------------------------------------------------------
|
|
||||||
/* istanbul ignore if */
|
|
||||||
|
|
||||||
|
|
||||||
if (
|
|
||||||
// Detect `process` so that it can run in browsers.
|
|
||||||
typeof process !== 'undefined' && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === 'win32')) {
|
|
||||||
var filter = IgnoreBase.prototype._filter;
|
|
||||||
|
|
||||||
/* eslint no-control-regex: "off" */
|
|
||||||
var make_posix = function make_posix(str) {
|
|
||||||
return (/^\\\\\?\\/.test(str) || /[^\x00-\x80]+/.test(str) ? str : str.replace(/\\/g, '/')
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
IgnoreBase.prototype._filter = function filterWin32(path, slices) {
|
|
||||||
path = make_posix(path);
|
|
||||||
return filter.call(this, path, slices);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = function (options) {
|
|
||||||
return new IgnoreBase(options);
|
|
||||||
};
|
|
64
node_modules/@eslint/eslintrc/node_modules/ignore/package.json
generated
vendored
64
node_modules/@eslint/eslintrc/node_modules/ignore/package.json
generated
vendored
|
@ -1,64 +0,0 @@
|
||||||
{
|
|
||||||
"name": "ignore",
|
|
||||||
"version": "4.0.6",
|
|
||||||
"description": "Ignore is a manager and filter for .gitignore rules.",
|
|
||||||
"files": [
|
|
||||||
"legacy.js",
|
|
||||||
"index.js",
|
|
||||||
"index.d.ts",
|
|
||||||
"LICENSE-MIT"
|
|
||||||
],
|
|
||||||
"scripts": {
|
|
||||||
"prepublish": "npm run build",
|
|
||||||
"build": "babel -o legacy.js index.js",
|
|
||||||
"test:lint": "eslint .",
|
|
||||||
"test:tsc": "tsc ./test/ts/simple.ts",
|
|
||||||
"test:git": "tap test/git-check-ignore.js",
|
|
||||||
"test:ignore": "tap test/ignore.js --coverage",
|
|
||||||
"test-no-cov": "npm run test:lint && npm run test:tsc && tap test/*.js --coverage",
|
|
||||||
"test": "npm run test-no-cov",
|
|
||||||
"posttest": "tap --coverage-report=html && codecov"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git@github.com:kaelzhang/node-ignore.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"ignore",
|
|
||||||
".gitignore",
|
|
||||||
"gitignore",
|
|
||||||
"npmignore",
|
|
||||||
"rules",
|
|
||||||
"manager",
|
|
||||||
"filter",
|
|
||||||
"regexp",
|
|
||||||
"regex",
|
|
||||||
"fnmatch",
|
|
||||||
"glob",
|
|
||||||
"asterisks",
|
|
||||||
"regular-expression"
|
|
||||||
],
|
|
||||||
"author": "kael",
|
|
||||||
"license": "MIT",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/kaelzhang/node-ignore/issues"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"babel-cli": "^6.26.0",
|
|
||||||
"babel-preset-env": "^1.7.0",
|
|
||||||
"codecov": "^3.0.4",
|
|
||||||
"eslint": "^5.3.0",
|
|
||||||
"eslint-config-ostai": "^1.3.2",
|
|
||||||
"eslint-plugin-import": "^2.13.0",
|
|
||||||
"mkdirp": "^0.5.1",
|
|
||||||
"pre-suf": "^1.1.0",
|
|
||||||
"rimraf": "^2.6.2",
|
|
||||||
"spawn-sync": "^2.0.0",
|
|
||||||
"tap": "^12.0.1",
|
|
||||||
"tmp": "0.0.33",
|
|
||||||
"typescript": "^3.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 4"
|
|
||||||
}
|
|
||||||
}
|
|
81
node_modules/@eslint/eslintrc/package.json
generated
vendored
81
node_modules/@eslint/eslintrc/package.json
generated
vendored
|
@ -1,81 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@eslint/eslintrc",
|
|
||||||
"version": "1.0.5",
|
|
||||||
"description": "The legacy ESLintRC config file format for ESLint",
|
|
||||||
"type": "module",
|
|
||||||
"main": "./dist/eslintrc.cjs",
|
|
||||||
"exports": {
|
|
||||||
".": {
|
|
||||||
"import": "./lib/index.js",
|
|
||||||
"require": "./dist/eslintrc.cjs"
|
|
||||||
},
|
|
||||||
"./package.json": "./package.json",
|
|
||||||
"./universal": {
|
|
||||||
"import": "./lib/index-universal.js",
|
|
||||||
"require": "./dist/eslintrc-universal.cjs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"lib",
|
|
||||||
"conf",
|
|
||||||
"LICENSE",
|
|
||||||
"dist",
|
|
||||||
"universal.js"
|
|
||||||
],
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"prepare": "npm run build",
|
|
||||||
"build": "rollup -c",
|
|
||||||
"lint": "eslint . --report-unused-disable-directives",
|
|
||||||
"fix": "npm run lint -- --fix",
|
|
||||||
"test": "mocha -R progress -c 'tests/lib/*.cjs' && c8 mocha -R progress -c 'tests/lib/**/*.js'",
|
|
||||||
"generate-release": "eslint-generate-release",
|
|
||||||
"generate-alpharelease": "eslint-generate-prerelease alpha",
|
|
||||||
"generate-betarelease": "eslint-generate-prerelease beta",
|
|
||||||
"generate-rcrelease": "eslint-generate-prerelease rc",
|
|
||||||
"publish-release": "eslint-publish-release"
|
|
||||||
},
|
|
||||||
"repository": "eslint/eslintrc",
|
|
||||||
"keywords": [
|
|
||||||
"ESLint",
|
|
||||||
"ESLintRC",
|
|
||||||
"Configuration"
|
|
||||||
],
|
|
||||||
"author": "Nicholas C. Zakas",
|
|
||||||
"license": "MIT",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/eslint/eslintrc/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/eslint/eslintrc#readme",
|
|
||||||
"devDependencies": {
|
|
||||||
"c8": "^7.7.3",
|
|
||||||
"chai": "^4.3.4",
|
|
||||||
"eslint": "^7.31.0",
|
|
||||||
"eslint-config-eslint": "^7.0.0",
|
|
||||||
"eslint-plugin-jsdoc": "^35.4.1",
|
|
||||||
"eslint-plugin-node": "^11.1.0",
|
|
||||||
"eslint-release": "^3.2.0",
|
|
||||||
"fs-teardown": "^0.1.3",
|
|
||||||
"mocha": "^9.0.3",
|
|
||||||
"rollup": "^2.54.0",
|
|
||||||
"shelljs": "^0.8.4",
|
|
||||||
"sinon": "^11.1.2",
|
|
||||||
"temp-dir": "^2.0.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"ajv": "^6.12.4",
|
|
||||||
"debug": "^4.3.2",
|
|
||||||
"espree": "^9.2.0",
|
|
||||||
"globals": "^13.9.0",
|
|
||||||
"ignore": "^4.0.6",
|
|
||||||
"import-fresh": "^3.2.1",
|
|
||||||
"js-yaml": "^4.1.0",
|
|
||||||
"minimatch": "^3.0.4",
|
|
||||||
"strip-json-comments": "^3.1.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
9
node_modules/@eslint/eslintrc/universal.js
generated
vendored
9
node_modules/@eslint/eslintrc/universal.js
generated
vendored
|
@ -1,9 +0,0 @@
|
||||||
// Jest (and probably some other runtimes with custom implementations of
|
|
||||||
// `require`) doesn't support `exports` in `package.json`, so this file is here
|
|
||||||
// to help them load this module. Note that it is also `.js` and not `.cjs` for
|
|
||||||
// the same reason - `cjs` files requires to be loaded with an extension, but
|
|
||||||
// since Jest doesn't respect `module` outside of ESM mode it still works in
|
|
||||||
// this case (and the `require` in _this_ file does specify the extension).
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
module.exports = require("./dist/eslintrc-universal.cjs");
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue