build: update npm install command to use --legacy-peer-deps
This change modifies the build scripts to use --legacy-peer-deps flag when installing npm dependencies to resolve potential peer dependency conflicts during the build process. The change is applied to both bash (build.sh) and batch (build.bat) build scripts.
This commit is contained in:
@@ -4,7 +4,7 @@ echo 🚀 Iniciando o processo de build...
|
||||
REM Passo 1: Build do Frontend (React)
|
||||
echo 📦 Instalando dependências do frontend...
|
||||
cd frontend
|
||||
call npm install
|
||||
call npm install --legacy-peer-deps
|
||||
|
||||
echo 🔨 Construindo o frontend para produção...
|
||||
call npm run build
|
||||
|
||||
2
build.sh
2
build.sh
@@ -5,7 +5,7 @@ echo "🚀 Iniciando o processo de build..."
|
||||
# Passo 1: Build do Frontend (React)
|
||||
echo "📦 Instalando dependências do frontend..."
|
||||
cd frontend
|
||||
npm install
|
||||
npm install --legacy-peer-deps
|
||||
|
||||
echo "🔨 Construindo o frontend para produção..."
|
||||
npx tsc && npm run build
|
||||
|
||||
16
frontend/node_modules/.bin/rimraf
generated
vendored
Normal file
16
frontend/node_modules/.bin/rimraf
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../rimraf/bin.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../rimraf/bin.js" "$@"
|
||||
fi
|
||||
17
frontend/node_modules/.bin/rimraf.cmd
generated
vendored
Normal file
17
frontend/node_modules/.bin/rimraf.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\rimraf\bin.js" %*
|
||||
28
frontend/node_modules/.bin/rimraf.ps1
generated
vendored
Normal file
28
frontend/node_modules/.bin/rimraf.ps1
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../rimraf/bin.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../rimraf/bin.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
503
frontend/node_modules/.package-lock.json
generated
vendored
503
frontend/node_modules/.package-lock.json
generated
vendored
@@ -866,82 +866,17 @@
|
||||
"node": "^12.0.0 || ^14.0.0 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/config-array": {
|
||||
"version": "0.21.1",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz",
|
||||
"integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@eslint/object-schema": "^2.1.7",
|
||||
"debug": "^4.3.1",
|
||||
"minimatch": "^3.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/config-array/node_modules/brace-expansion": {
|
||||
"version": "1.1.12",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
|
||||
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/config-array/node_modules/minimatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/config-helpers": {
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz",
|
||||
"integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@eslint/core": "^0.17.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/core": {
|
||||
"version": "0.17.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz",
|
||||
"integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@types/json-schema": "^7.0.15"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/eslintrc": {
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz",
|
||||
"integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==",
|
||||
"version": "2.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz",
|
||||
"integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ajv": "^6.12.4",
|
||||
"debug": "^4.3.2",
|
||||
"espree": "^10.0.1",
|
||||
"globals": "^14.0.0",
|
||||
"espree": "^9.6.0",
|
||||
"globals": "^13.19.0",
|
||||
"ignore": "^5.2.0",
|
||||
"import-fresh": "^3.2.1",
|
||||
"js-yaml": "^4.1.0",
|
||||
@@ -949,7 +884,7 @@
|
||||
"strip-json-comments": "^3.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/eslint"
|
||||
@@ -990,64 +925,53 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/js": {
|
||||
"version": "9.39.1",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.1.tgz",
|
||||
"integrity": "sha512-S26Stp4zCy88tH94QbBv3XCuzRQiZ9yXofEILmglYTh/Ug/a9/umqvgFtYBAo3Lp0nsI/5/qH1CCrbdK3AP1Tw==",
|
||||
"version": "8.57.1",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz",
|
||||
"integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://eslint.org/donate"
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/object-schema": {
|
||||
"version": "2.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz",
|
||||
"integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/plugin-kit": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz",
|
||||
"integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==",
|
||||
"node_modules/@humanwhocodes/config-array": {
|
||||
"version": "0.13.0",
|
||||
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz",
|
||||
"integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==",
|
||||
"deprecated": "Use @eslint/config-array instead",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@eslint/core": "^0.17.0",
|
||||
"levn": "^0.4.1"
|
||||
"@humanwhocodes/object-schema": "^2.0.3",
|
||||
"debug": "^4.3.1",
|
||||
"minimatch": "^3.0.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
"node": ">=10.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanfs/core": {
|
||||
"version": "0.19.1",
|
||||
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
|
||||
"integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==",
|
||||
"node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": {
|
||||
"version": "1.1.12",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
|
||||
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=18.18.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanfs/node": {
|
||||
"version": "0.16.7",
|
||||
"resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz",
|
||||
"integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@humanfs/core": "^0.19.1",
|
||||
"@humanwhocodes/retry": "^0.4.0"
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanwhocodes/config-array/node_modules/minimatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.18.0"
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanwhocodes/module-importer": {
|
||||
@@ -1064,19 +988,13 @@
|
||||
"url": "https://github.com/sponsors/nzakas"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanwhocodes/retry": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz",
|
||||
"integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==",
|
||||
"node_modules/@humanwhocodes/object-schema": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz",
|
||||
"integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==",
|
||||
"deprecated": "Use @eslint/object-schema instead",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=18.18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/nzakas"
|
||||
}
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/@jridgewell/gen-mapping": {
|
||||
"version": "0.3.13",
|
||||
@@ -1701,13 +1619,6 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/json-schema": {
|
||||
"version": "7.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
|
||||
"integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/prop-types": {
|
||||
"version": "15.7.15",
|
||||
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz",
|
||||
@@ -1971,6 +1882,13 @@
|
||||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/@ungap/structured-clone": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz",
|
||||
"integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/@vitejs/plugin-react": {
|
||||
"version": "4.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz",
|
||||
@@ -2032,6 +1950,16 @@
|
||||
"url": "https://github.com/sponsors/epoberezkin"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-regex": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
@@ -2400,6 +2328,19 @@
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/doctrine": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
|
||||
"integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"esutils": "^2.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/dunder-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
@@ -2529,63 +2470,60 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint": {
|
||||
"version": "9.39.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.1.tgz",
|
||||
"integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==",
|
||||
"version": "8.57.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz",
|
||||
"integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==",
|
||||
"deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.8.0",
|
||||
"@eslint-community/regexpp": "^4.12.1",
|
||||
"@eslint/config-array": "^0.21.1",
|
||||
"@eslint/config-helpers": "^0.4.2",
|
||||
"@eslint/core": "^0.17.0",
|
||||
"@eslint/eslintrc": "^3.3.1",
|
||||
"@eslint/js": "9.39.1",
|
||||
"@eslint/plugin-kit": "^0.4.1",
|
||||
"@humanfs/node": "^0.16.6",
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.6.1",
|
||||
"@eslint/eslintrc": "^2.1.4",
|
||||
"@eslint/js": "8.57.1",
|
||||
"@humanwhocodes/config-array": "^0.13.0",
|
||||
"@humanwhocodes/module-importer": "^1.0.1",
|
||||
"@humanwhocodes/retry": "^0.4.2",
|
||||
"@types/estree": "^1.0.6",
|
||||
"@nodelib/fs.walk": "^1.2.8",
|
||||
"@ungap/structured-clone": "^1.2.0",
|
||||
"ajv": "^6.12.4",
|
||||
"chalk": "^4.0.0",
|
||||
"cross-spawn": "^7.0.6",
|
||||
"cross-spawn": "^7.0.2",
|
||||
"debug": "^4.3.2",
|
||||
"doctrine": "^3.0.0",
|
||||
"escape-string-regexp": "^4.0.0",
|
||||
"eslint-scope": "^8.4.0",
|
||||
"eslint-visitor-keys": "^4.2.1",
|
||||
"espree": "^10.4.0",
|
||||
"esquery": "^1.5.0",
|
||||
"eslint-scope": "^7.2.2",
|
||||
"eslint-visitor-keys": "^3.4.3",
|
||||
"espree": "^9.6.1",
|
||||
"esquery": "^1.4.2",
|
||||
"esutils": "^2.0.2",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"file-entry-cache": "^8.0.0",
|
||||
"file-entry-cache": "^6.0.1",
|
||||
"find-up": "^5.0.0",
|
||||
"glob-parent": "^6.0.2",
|
||||
"globals": "^13.19.0",
|
||||
"graphemer": "^1.4.0",
|
||||
"ignore": "^5.2.0",
|
||||
"imurmurhash": "^0.1.4",
|
||||
"is-glob": "^4.0.0",
|
||||
"is-path-inside": "^3.0.3",
|
||||
"js-yaml": "^4.1.0",
|
||||
"json-stable-stringify-without-jsonify": "^1.0.1",
|
||||
"levn": "^0.4.1",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"minimatch": "^3.1.2",
|
||||
"natural-compare": "^1.4.0",
|
||||
"optionator": "^0.9.3"
|
||||
"optionator": "^0.9.3",
|
||||
"strip-ansi": "^6.0.1",
|
||||
"text-table": "^0.2.0"
|
||||
},
|
||||
"bin": {
|
||||
"eslint": "bin/eslint.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://eslint.org/donate"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"jiti": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"jiti": {
|
||||
"optional": true
|
||||
}
|
||||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-react-hooks": {
|
||||
@@ -2612,9 +2550,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-scope": {
|
||||
"version": "8.4.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz",
|
||||
"integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==",
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz",
|
||||
"integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
@@ -2622,7 +2560,7 @@
|
||||
"estraverse": "^5.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/eslint"
|
||||
@@ -2652,19 +2590,6 @@
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint/node_modules/eslint-visitor-keys": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",
|
||||
"integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint/node_modules/ignore": {
|
||||
"version": "5.3.2",
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
|
||||
@@ -2689,31 +2614,18 @@
|
||||
}
|
||||
},
|
||||
"node_modules/espree": {
|
||||
"version": "10.4.0",
|
||||
"resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz",
|
||||
"integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==",
|
||||
"version": "9.6.1",
|
||||
"resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz",
|
||||
"integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"acorn": "^8.15.0",
|
||||
"acorn": "^8.9.0",
|
||||
"acorn-jsx": "^5.3.2",
|
||||
"eslint-visitor-keys": "^4.2.1"
|
||||
"eslint-visitor-keys": "^3.4.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/espree/node_modules/eslint-visitor-keys": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",
|
||||
"integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/eslint"
|
||||
@@ -2827,16 +2739,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/file-entry-cache": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz",
|
||||
"integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==",
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
|
||||
"integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"flat-cache": "^4.0.0"
|
||||
"flat-cache": "^3.0.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
"node": "^10.12.0 || >=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/fill-range": {
|
||||
@@ -2870,17 +2782,18 @@
|
||||
}
|
||||
},
|
||||
"node_modules/flat-cache": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz",
|
||||
"integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==",
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz",
|
||||
"integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"flatted": "^3.2.9",
|
||||
"keyv": "^4.5.4"
|
||||
"keyv": "^4.5.3",
|
||||
"rimraf": "^3.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
"node": "^10.12.0 || >=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/flatted": {
|
||||
@@ -2926,6 +2839,13 @@
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||
@@ -2998,6 +2918,28 @@
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/glob": {
|
||||
"version": "7.2.3",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
||||
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
||||
"deprecated": "Glob versions prior to v9 are no longer supported",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.1.1",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/glob-parent": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
|
||||
@@ -3011,14 +2953,41 @@
|
||||
"node": ">=10.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/globals": {
|
||||
"version": "14.0.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
|
||||
"integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
|
||||
"node_modules/glob/node_modules/brace-expansion": {
|
||||
"version": "1.1.12",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
|
||||
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/glob/node_modules/minimatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/globals": {
|
||||
"version": "13.24.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz",
|
||||
"integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"type-fest": "^0.20.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
@@ -3129,6 +3098,25 @@
|
||||
"node": ">=0.8.19"
|
||||
}
|
||||
},
|
||||
"node_modules/inflight": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
|
||||
"deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"once": "^1.3.0",
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/is-extglob": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
||||
@@ -3162,6 +3150,16 @@
|
||||
"node": ">=0.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/is-path-inside": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz",
|
||||
"integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/isexe": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||
@@ -3423,6 +3421,16 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/optionator": {
|
||||
"version": "0.9.4",
|
||||
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
|
||||
@@ -3496,6 +3504,16 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/path-key": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
|
||||
@@ -4276,6 +4294,23 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/rimraf": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
||||
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
||||
"deprecated": "Rimraf versions prior to v4 are no longer supported",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"glob": "^7.1.3"
|
||||
},
|
||||
"bin": {
|
||||
"rimraf": "bin.js"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.53.2.tgz",
|
||||
@@ -4412,6 +4447,19 @@
|
||||
"integrity": "sha512-u/1tdPl4yQnPBjnVrmdLo9gtuLvELKsAoRapekWggdiQNvvvum+jYF329d84NAa660KQw7pB2n36KrIKVoXa3A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/strip-ansi": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^5.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-json-comments": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
|
||||
@@ -4444,6 +4492,13 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/text-table": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
|
||||
"integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/throttle-debounce": {
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-5.0.2.tgz",
|
||||
@@ -4498,6 +4553,19 @@
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/type-fest": {
|
||||
"version": "0.20.2",
|
||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz",
|
||||
"integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==",
|
||||
"dev": true,
|
||||
"license": "(MIT OR CC0-1.0)",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.9.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
|
||||
@@ -4639,6 +4707,13 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/yallist": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
|
||||
|
||||
1539
frontend/node_modules/@eslint/config-array/dist/cjs/index.cjs
generated
vendored
1539
frontend/node_modules/@eslint/config-array/dist/cjs/index.cjs
generated
vendored
File diff suppressed because it is too large
Load Diff
145
frontend/node_modules/@eslint/config-array/dist/cjs/index.d.cts
generated
vendored
145
frontend/node_modules/@eslint/config-array/dist/cjs/index.d.cts
generated
vendored
@@ -1,145 +0,0 @@
|
||||
export { ObjectSchema } from "@eslint/object-schema";
|
||||
export type PropertyDefinition = $eslintobjectschema.PropertyDefinition;
|
||||
export type ObjectDefinition = $eslintobjectschema.ObjectDefinition;
|
||||
export type ConfigObject = $typests.ConfigObject;
|
||||
export type IMinimatchStatic = minimatch.IMinimatchStatic;
|
||||
export type IMinimatch = minimatch.IMinimatch;
|
||||
export type ObjectSchemaInstance = ObjectSchema;
|
||||
/**
|
||||
* Represents an array of config objects and provides method for working with
|
||||
* those config objects.
|
||||
*/
|
||||
export class ConfigArray extends Array<any> {
|
||||
/**
|
||||
* Creates a new instance of ConfigArray.
|
||||
* @param {Iterable|Function|Object} configs An iterable yielding config
|
||||
* objects, or a config function, or a config object.
|
||||
* @param {Object} options The options for the ConfigArray.
|
||||
* @param {string} [options.basePath="/"] The absolute path of the config file directory.
|
||||
* Defaults to `"/"`.
|
||||
* @param {boolean} [options.normalized=false] Flag indicating if the
|
||||
* configs have already been normalized.
|
||||
* @param {Object} [options.schema] The additional schema
|
||||
* definitions to use for the ConfigArray schema.
|
||||
* @param {Array<string>} [options.extraConfigTypes] List of config types supported.
|
||||
* @throws {TypeError} When the `basePath` is not a non-empty string,
|
||||
*/
|
||||
constructor(configs: Iterable<any> | Function | any, { basePath, normalized, schema: customSchema, extraConfigTypes, }?: {
|
||||
basePath?: string;
|
||||
normalized?: boolean;
|
||||
schema?: any;
|
||||
extraConfigTypes?: Array<string>;
|
||||
});
|
||||
/**
|
||||
* The path of the config file that this array was loaded from.
|
||||
* This is used to calculate filename matches.
|
||||
* @property basePath
|
||||
* @type {string}
|
||||
*/
|
||||
basePath: string;
|
||||
/**
|
||||
* The supported config types.
|
||||
* @type {Array<string>}
|
||||
*/
|
||||
extraConfigTypes: Array<string>;
|
||||
/**
|
||||
* Returns the `files` globs from every config object in the array.
|
||||
* This can be used to determine which files will be matched by a
|
||||
* config array or to use as a glob pattern when no patterns are provided
|
||||
* for a command line interface.
|
||||
* @returns {Array<string|Function>} An array of matchers.
|
||||
*/
|
||||
get files(): Array<string | Function>;
|
||||
/**
|
||||
* Returns ignore matchers that should always be ignored regardless of
|
||||
* the matching `files` fields in any configs. This is necessary to mimic
|
||||
* the behavior of things like .gitignore and .eslintignore, allowing a
|
||||
* globbing operation to be faster.
|
||||
* @returns {Object[]} An array of config objects representing global ignores.
|
||||
*/
|
||||
get ignores(): any[];
|
||||
/**
|
||||
* Indicates if the config array has been normalized.
|
||||
* @returns {boolean} True if the config array is normalized, false if not.
|
||||
*/
|
||||
isNormalized(): boolean;
|
||||
/**
|
||||
* Normalizes a config array by flattening embedded arrays and executing
|
||||
* config functions.
|
||||
* @param {Object} [context] The context object for config functions.
|
||||
* @returns {Promise<ConfigArray>} The current ConfigArray instance.
|
||||
*/
|
||||
normalize(context?: any): Promise<ConfigArray>;
|
||||
/**
|
||||
* Normalizes a config array by flattening embedded arrays and executing
|
||||
* config functions.
|
||||
* @param {Object} [context] The context object for config functions.
|
||||
* @returns {ConfigArray} The current ConfigArray instance.
|
||||
*/
|
||||
normalizeSync(context?: any): ConfigArray;
|
||||
/**
|
||||
* Returns the config object for a given file path and a status that can be used to determine why a file has no config.
|
||||
* @param {string} filePath The path of a file to get a config for.
|
||||
* @returns {{ config?: Object, status: "ignored"|"external"|"unconfigured"|"matched" }}
|
||||
* An object with an optional property `config` and property `status`.
|
||||
* `config` is the config object for the specified file as returned by {@linkcode ConfigArray.getConfig},
|
||||
* `status` a is one of the constants returned by {@linkcode ConfigArray.getConfigStatus}.
|
||||
*/
|
||||
getConfigWithStatus(filePath: string): {
|
||||
config?: any;
|
||||
status: "ignored" | "external" | "unconfigured" | "matched";
|
||||
};
|
||||
/**
|
||||
* Returns the config object for a given file path.
|
||||
* @param {string} filePath The path of a file to get a config for.
|
||||
* @returns {Object|undefined} The config object for this file or `undefined`.
|
||||
*/
|
||||
getConfig(filePath: string): any | undefined;
|
||||
/**
|
||||
* Determines whether a file has a config or why it doesn't.
|
||||
* @param {string} filePath The path of the file to check.
|
||||
* @returns {"ignored"|"external"|"unconfigured"|"matched"} One of the following values:
|
||||
* * `"ignored"`: the file is ignored
|
||||
* * `"external"`: the file is outside the base path
|
||||
* * `"unconfigured"`: the file is not matched by any config
|
||||
* * `"matched"`: the file has a matching config
|
||||
*/
|
||||
getConfigStatus(filePath: string): "ignored" | "external" | "unconfigured" | "matched";
|
||||
/**
|
||||
* Determines if the given filepath is ignored based on the configs.
|
||||
* @param {string} filePath The path of a file to check.
|
||||
* @returns {boolean} True if the path is ignored, false if not.
|
||||
* @deprecated Use `isFileIgnored` instead.
|
||||
*/
|
||||
isIgnored(filePath: string): boolean;
|
||||
/**
|
||||
* Determines if the given filepath is ignored based on the configs.
|
||||
* @param {string} filePath The path of a file to check.
|
||||
* @returns {boolean} True if the path is ignored, false if not.
|
||||
*/
|
||||
isFileIgnored(filePath: string): boolean;
|
||||
/**
|
||||
* Determines if the given directory is ignored based on the configs.
|
||||
* This checks only default `ignores` that don't have `files` in the
|
||||
* same config. A pattern such as `/foo` be considered to ignore the directory
|
||||
* while a pattern such as `/foo/**` is not considered to ignore the
|
||||
* directory because it is matching files.
|
||||
* @param {string} directoryPath The path of a directory to check.
|
||||
* @returns {boolean} True if the directory is ignored, false if not. Will
|
||||
* return true for any directory that is not inside of `basePath`.
|
||||
* @throws {Error} When the `ConfigArray` is not normalized.
|
||||
*/
|
||||
isDirectoryIgnored(directoryPath: string): boolean;
|
||||
#private;
|
||||
}
|
||||
export namespace ConfigArraySymbol {
|
||||
let isNormalized: symbol;
|
||||
let configCache: symbol;
|
||||
let schema: symbol;
|
||||
let finalizeConfig: symbol;
|
||||
let preprocessConfig: symbol;
|
||||
}
|
||||
import type * as $eslintobjectschema from "@eslint/object-schema";
|
||||
import type * as $typests from "./types.cts";
|
||||
import minimatch from 'minimatch';
|
||||
import { ObjectSchema } from '@eslint/object-schema';
|
||||
1336
frontend/node_modules/@eslint/config-array/dist/cjs/std__path/posix.cjs
generated
vendored
1336
frontend/node_modules/@eslint/config-array/dist/cjs/std__path/posix.cjs
generated
vendored
File diff suppressed because it is too large
Load Diff
1678
frontend/node_modules/@eslint/config-array/dist/cjs/std__path/windows.cjs
generated
vendored
1678
frontend/node_modules/@eslint/config-array/dist/cjs/std__path/windows.cjs
generated
vendored
File diff suppressed because it is too large
Load Diff
29
frontend/node_modules/@eslint/config-array/dist/cjs/types.cts
generated
vendored
29
frontend/node_modules/@eslint/config-array/dist/cjs/types.cts
generated
vendored
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* @fileoverview Types for the config-array package.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
export interface ConfigObject {
|
||||
/**
|
||||
* The base path for files and ignores.
|
||||
*/
|
||||
basePath?: string;
|
||||
|
||||
/**
|
||||
* The files to include.
|
||||
*/
|
||||
files?: string[];
|
||||
|
||||
/**
|
||||
* The files to exclude.
|
||||
*/
|
||||
ignores?: string[];
|
||||
|
||||
/**
|
||||
* The name of the config object.
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
// may also have any number of other properties
|
||||
[key: string]: unknown;
|
||||
}
|
||||
145
frontend/node_modules/@eslint/config-array/dist/esm/index.d.ts
generated
vendored
145
frontend/node_modules/@eslint/config-array/dist/esm/index.d.ts
generated
vendored
@@ -1,145 +0,0 @@
|
||||
export { ObjectSchema } from "@eslint/object-schema";
|
||||
export type PropertyDefinition = $eslintobjectschema.PropertyDefinition;
|
||||
export type ObjectDefinition = $eslintobjectschema.ObjectDefinition;
|
||||
export type ConfigObject = $typests.ConfigObject;
|
||||
export type IMinimatchStatic = minimatch.IMinimatchStatic;
|
||||
export type IMinimatch = minimatch.IMinimatch;
|
||||
export type ObjectSchemaInstance = ObjectSchema;
|
||||
/**
|
||||
* Represents an array of config objects and provides method for working with
|
||||
* those config objects.
|
||||
*/
|
||||
export class ConfigArray extends Array<any> {
|
||||
/**
|
||||
* Creates a new instance of ConfigArray.
|
||||
* @param {Iterable|Function|Object} configs An iterable yielding config
|
||||
* objects, or a config function, or a config object.
|
||||
* @param {Object} options The options for the ConfigArray.
|
||||
* @param {string} [options.basePath="/"] The absolute path of the config file directory.
|
||||
* Defaults to `"/"`.
|
||||
* @param {boolean} [options.normalized=false] Flag indicating if the
|
||||
* configs have already been normalized.
|
||||
* @param {Object} [options.schema] The additional schema
|
||||
* definitions to use for the ConfigArray schema.
|
||||
* @param {Array<string>} [options.extraConfigTypes] List of config types supported.
|
||||
* @throws {TypeError} When the `basePath` is not a non-empty string,
|
||||
*/
|
||||
constructor(configs: Iterable<any> | Function | any, { basePath, normalized, schema: customSchema, extraConfigTypes, }?: {
|
||||
basePath?: string;
|
||||
normalized?: boolean;
|
||||
schema?: any;
|
||||
extraConfigTypes?: Array<string>;
|
||||
});
|
||||
/**
|
||||
* The path of the config file that this array was loaded from.
|
||||
* This is used to calculate filename matches.
|
||||
* @property basePath
|
||||
* @type {string}
|
||||
*/
|
||||
basePath: string;
|
||||
/**
|
||||
* The supported config types.
|
||||
* @type {Array<string>}
|
||||
*/
|
||||
extraConfigTypes: Array<string>;
|
||||
/**
|
||||
* Returns the `files` globs from every config object in the array.
|
||||
* This can be used to determine which files will be matched by a
|
||||
* config array or to use as a glob pattern when no patterns are provided
|
||||
* for a command line interface.
|
||||
* @returns {Array<string|Function>} An array of matchers.
|
||||
*/
|
||||
get files(): Array<string | Function>;
|
||||
/**
|
||||
* Returns ignore matchers that should always be ignored regardless of
|
||||
* the matching `files` fields in any configs. This is necessary to mimic
|
||||
* the behavior of things like .gitignore and .eslintignore, allowing a
|
||||
* globbing operation to be faster.
|
||||
* @returns {Object[]} An array of config objects representing global ignores.
|
||||
*/
|
||||
get ignores(): any[];
|
||||
/**
|
||||
* Indicates if the config array has been normalized.
|
||||
* @returns {boolean} True if the config array is normalized, false if not.
|
||||
*/
|
||||
isNormalized(): boolean;
|
||||
/**
|
||||
* Normalizes a config array by flattening embedded arrays and executing
|
||||
* config functions.
|
||||
* @param {Object} [context] The context object for config functions.
|
||||
* @returns {Promise<ConfigArray>} The current ConfigArray instance.
|
||||
*/
|
||||
normalize(context?: any): Promise<ConfigArray>;
|
||||
/**
|
||||
* Normalizes a config array by flattening embedded arrays and executing
|
||||
* config functions.
|
||||
* @param {Object} [context] The context object for config functions.
|
||||
* @returns {ConfigArray} The current ConfigArray instance.
|
||||
*/
|
||||
normalizeSync(context?: any): ConfigArray;
|
||||
/**
|
||||
* Returns the config object for a given file path and a status that can be used to determine why a file has no config.
|
||||
* @param {string} filePath The path of a file to get a config for.
|
||||
* @returns {{ config?: Object, status: "ignored"|"external"|"unconfigured"|"matched" }}
|
||||
* An object with an optional property `config` and property `status`.
|
||||
* `config` is the config object for the specified file as returned by {@linkcode ConfigArray.getConfig},
|
||||
* `status` a is one of the constants returned by {@linkcode ConfigArray.getConfigStatus}.
|
||||
*/
|
||||
getConfigWithStatus(filePath: string): {
|
||||
config?: any;
|
||||
status: "ignored" | "external" | "unconfigured" | "matched";
|
||||
};
|
||||
/**
|
||||
* Returns the config object for a given file path.
|
||||
* @param {string} filePath The path of a file to get a config for.
|
||||
* @returns {Object|undefined} The config object for this file or `undefined`.
|
||||
*/
|
||||
getConfig(filePath: string): any | undefined;
|
||||
/**
|
||||
* Determines whether a file has a config or why it doesn't.
|
||||
* @param {string} filePath The path of the file to check.
|
||||
* @returns {"ignored"|"external"|"unconfigured"|"matched"} One of the following values:
|
||||
* * `"ignored"`: the file is ignored
|
||||
* * `"external"`: the file is outside the base path
|
||||
* * `"unconfigured"`: the file is not matched by any config
|
||||
* * `"matched"`: the file has a matching config
|
||||
*/
|
||||
getConfigStatus(filePath: string): "ignored" | "external" | "unconfigured" | "matched";
|
||||
/**
|
||||
* Determines if the given filepath is ignored based on the configs.
|
||||
* @param {string} filePath The path of a file to check.
|
||||
* @returns {boolean} True if the path is ignored, false if not.
|
||||
* @deprecated Use `isFileIgnored` instead.
|
||||
*/
|
||||
isIgnored(filePath: string): boolean;
|
||||
/**
|
||||
* Determines if the given filepath is ignored based on the configs.
|
||||
* @param {string} filePath The path of a file to check.
|
||||
* @returns {boolean} True if the path is ignored, false if not.
|
||||
*/
|
||||
isFileIgnored(filePath: string): boolean;
|
||||
/**
|
||||
* Determines if the given directory is ignored based on the configs.
|
||||
* This checks only default `ignores` that don't have `files` in the
|
||||
* same config. A pattern such as `/foo` be considered to ignore the directory
|
||||
* while a pattern such as `/foo/**` is not considered to ignore the
|
||||
* directory because it is matching files.
|
||||
* @param {string} directoryPath The path of a directory to check.
|
||||
* @returns {boolean} True if the directory is ignored, false if not. Will
|
||||
* return true for any directory that is not inside of `basePath`.
|
||||
* @throws {Error} When the `ConfigArray` is not normalized.
|
||||
*/
|
||||
isDirectoryIgnored(directoryPath: string): boolean;
|
||||
#private;
|
||||
}
|
||||
export namespace ConfigArraySymbol {
|
||||
let isNormalized: symbol;
|
||||
let configCache: symbol;
|
||||
let schema: symbol;
|
||||
let finalizeConfig: symbol;
|
||||
let preprocessConfig: symbol;
|
||||
}
|
||||
import type * as $eslintobjectschema from "@eslint/object-schema";
|
||||
import type * as $typests from "./types.ts";
|
||||
import minimatch from 'minimatch';
|
||||
import { ObjectSchema } from '@eslint/object-schema';
|
||||
1514
frontend/node_modules/@eslint/config-array/dist/esm/index.js
generated
vendored
1514
frontend/node_modules/@eslint/config-array/dist/esm/index.js
generated
vendored
File diff suppressed because it is too large
Load Diff
1314
frontend/node_modules/@eslint/config-array/dist/esm/std__path/posix.js
generated
vendored
1314
frontend/node_modules/@eslint/config-array/dist/esm/std__path/posix.js
generated
vendored
File diff suppressed because it is too large
Load Diff
1656
frontend/node_modules/@eslint/config-array/dist/esm/std__path/windows.js
generated
vendored
1656
frontend/node_modules/@eslint/config-array/dist/esm/std__path/windows.js
generated
vendored
File diff suppressed because it is too large
Load Diff
23
frontend/node_modules/@eslint/config-array/dist/esm/types.d.ts
generated
vendored
23
frontend/node_modules/@eslint/config-array/dist/esm/types.d.ts
generated
vendored
@@ -1,23 +0,0 @@
|
||||
/**
|
||||
* @fileoverview Types for the config-array package.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
export interface ConfigObject {
|
||||
/**
|
||||
* The base path for files and ignores.
|
||||
*/
|
||||
basePath?: string;
|
||||
/**
|
||||
* The files to include.
|
||||
*/
|
||||
files?: string[];
|
||||
/**
|
||||
* The files to exclude.
|
||||
*/
|
||||
ignores?: string[];
|
||||
/**
|
||||
* The name of the config object.
|
||||
*/
|
||||
name?: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
29
frontend/node_modules/@eslint/config-array/dist/esm/types.ts
generated
vendored
29
frontend/node_modules/@eslint/config-array/dist/esm/types.ts
generated
vendored
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* @fileoverview Types for the config-array package.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
export interface ConfigObject {
|
||||
/**
|
||||
* The base path for files and ignores.
|
||||
*/
|
||||
basePath?: string;
|
||||
|
||||
/**
|
||||
* The files to include.
|
||||
*/
|
||||
files?: string[];
|
||||
|
||||
/**
|
||||
* The files to exclude.
|
||||
*/
|
||||
ignores?: string[];
|
||||
|
||||
/**
|
||||
* The name of the config object.
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
// may also have any number of other properties
|
||||
[key: string]: unknown;
|
||||
}
|
||||
64
frontend/node_modules/@eslint/config-array/package.json
generated
vendored
64
frontend/node_modules/@eslint/config-array/package.json
generated
vendored
@@ -1,64 +0,0 @@
|
||||
{
|
||||
"name": "@eslint/config-array",
|
||||
"version": "0.21.1",
|
||||
"description": "General purpose glob-based configuration matching.",
|
||||
"author": "Nicholas C. Zakas",
|
||||
"type": "module",
|
||||
"main": "dist/esm/index.js",
|
||||
"types": "dist/esm/index.d.ts",
|
||||
"exports": {
|
||||
"require": {
|
||||
"types": "./dist/cjs/index.d.cts",
|
||||
"default": "./dist/cjs/index.cjs"
|
||||
},
|
||||
"import": {
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/eslint/rewrite.git",
|
||||
"directory": "packages/config-array"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/eslint/rewrite/issues"
|
||||
},
|
||||
"homepage": "https://github.com/eslint/rewrite/tree/main/packages/config-array#readme",
|
||||
"scripts": {
|
||||
"build:dedupe-types": "node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js",
|
||||
"build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts",
|
||||
"build:std__path": "rollup -c rollup.std__path-config.js && node fix-std__path-imports",
|
||||
"build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts && npm run build:std__path",
|
||||
"pretest": "npm run build",
|
||||
"test": "mocha \"tests/**/*.test.js\"",
|
||||
"test:coverage": "c8 npm test",
|
||||
"test:jsr": "npx jsr@latest publish --dry-run",
|
||||
"test:types": "tsc -p tests/types/tsconfig.json"
|
||||
},
|
||||
"keywords": [
|
||||
"configuration",
|
||||
"configarray",
|
||||
"config file"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@eslint/object-schema": "^2.1.7",
|
||||
"debug": "^4.3.1",
|
||||
"minimatch": "^3.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jsr/std__path": "^1.0.4",
|
||||
"@types/minimatch": "^3.0.5",
|
||||
"rollup-plugin-copy": "^3.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
}
|
||||
}
|
||||
201
frontend/node_modules/@eslint/config-helpers/LICENSE
generated
vendored
201
frontend/node_modules/@eslint/config-helpers/LICENSE
generated
vendored
@@ -1,201 +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
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
||||
97
frontend/node_modules/@eslint/config-helpers/README.md
generated
vendored
97
frontend/node_modules/@eslint/config-helpers/README.md
generated
vendored
@@ -1,97 +0,0 @@
|
||||
# @eslint/config-helpers
|
||||
|
||||
## Description
|
||||
|
||||
Helper utilities for creating ESLint configuration.
|
||||
|
||||
## Installation
|
||||
|
||||
For Node.js and compatible runtimes:
|
||||
|
||||
```shell
|
||||
npm install @eslint/config-helpers
|
||||
# or
|
||||
yarn add @eslint/config-helpers
|
||||
# or
|
||||
pnpm install @eslint/config-helpers
|
||||
# or
|
||||
bun add @eslint/config-helpers
|
||||
```
|
||||
|
||||
For Deno:
|
||||
|
||||
```shell
|
||||
deno add @eslint/config-helpers
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### `defineConfig()`
|
||||
|
||||
The `defineConfig()` function allows you to specify an ESLint configuration with full type checking and additional capabilities, such as `extends`. Here's an example:
|
||||
|
||||
```js
|
||||
// eslint.config.js
|
||||
import { defineConfig } from "@eslint/config-helpers";
|
||||
import js from "@eslint/js";
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
files: ["src/**/*.js"],
|
||||
plugins: { js },
|
||||
extends: ["js/recommended"],
|
||||
rules: {
|
||||
semi: "error",
|
||||
"prefer-const": "error",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["test/**/*.js"],
|
||||
rules: {
|
||||
"no-console": "off",
|
||||
},
|
||||
},
|
||||
]);
|
||||
```
|
||||
|
||||
### `globalIgnores()`
|
||||
|
||||
The `globalIgnores()` function allows you to specify patterns for files and directories that should be globally ignored by ESLint. This is useful for excluding files that you don't want to lint, such as build directories or third-party libraries. Here's an example:
|
||||
|
||||
```js
|
||||
// eslint.config.js
|
||||
import { defineConfig, globalIgnores } from "@eslint/config-helpers";
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
files: ["src/**/*.js"],
|
||||
rules: {
|
||||
semi: "error",
|
||||
"prefer-const": "error",
|
||||
},
|
||||
},
|
||||
globalIgnores(["node_modules/", "dist/", "coverage/"]),
|
||||
]);
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Apache 2.0
|
||||
|
||||
<!-- NOTE: This section is autogenerated. Do not manually edit.-->
|
||||
<!--sponsorsstart-->
|
||||
|
||||
## Sponsors
|
||||
|
||||
The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)
|
||||
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
|
||||
|
||||
<h3>Platinum Sponsors</h3>
|
||||
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
|
||||
<p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a> <a href="https://shopify.engineering/"><img src="https://avatars.githubusercontent.com/u/8085" alt="Shopify" height="96"></a></p><h3>Silver Sponsors</h3>
|
||||
<p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/e6d15e1/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301" alt="American Express" height="64"></a> <a href="https://stackblitz.com"><img src="https://avatars.githubusercontent.com/u/28635252" alt="StackBlitz" height="64"></a></p><h3>Bronze Sponsors</h3>
|
||||
<p><a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://sentry.io"><img src="https://github.com/getsentry.png" alt="Sentry" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="LambdaTest" height="32"></a></p>
|
||||
<h3>Technology Sponsors</h3>
|
||||
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.
|
||||
<p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p>
|
||||
<!--sponsorsend-->
|
||||
588
frontend/node_modules/@eslint/config-helpers/dist/cjs/index.cjs
generated
vendored
588
frontend/node_modules/@eslint/config-helpers/dist/cjs/index.cjs
generated
vendored
@@ -1,588 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @fileoverview defineConfig helper
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Type Definitions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/** @import * as $eslintcore from "@eslint/core"; */
|
||||
/** @typedef {$eslintcore.ConfigObject} Config */
|
||||
/** @typedef {$eslintcore.LegacyConfigObject} LegacyConfig */
|
||||
/** @typedef {$eslintcore.Plugin} Plugin */
|
||||
/** @typedef {$eslintcore.RuleConfig} RuleConfig */
|
||||
/** @import * as $typests from "./types.ts"; */
|
||||
/** @typedef {$typests.ExtendsElement} ExtendsElement */
|
||||
/** @typedef {$typests.SimpleExtendsElement} SimpleExtendsElement */
|
||||
/** @typedef {$typests.ConfigWithExtends} ConfigWithExtends */
|
||||
/** @typedef {$typests.InfiniteArray<Config>} InfiniteConfigArray */
|
||||
/** @typedef {$typests.ConfigWithExtendsArray} ConfigWithExtendsArray */
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const eslintrcKeys = [
|
||||
"env",
|
||||
"extends",
|
||||
"globals",
|
||||
"ignorePatterns",
|
||||
"noInlineConfig",
|
||||
"overrides",
|
||||
"parser",
|
||||
"parserOptions",
|
||||
"reportUnusedDisableDirectives",
|
||||
"root",
|
||||
];
|
||||
|
||||
const allowedGlobalIgnoreKeys = new Set(["basePath", "ignores", "name"]);
|
||||
|
||||
/**
|
||||
* Gets the name of a config object.
|
||||
* @param {Config} config The config object.
|
||||
* @param {string} indexPath The index path of the config object.
|
||||
* @return {string} The name of the config object.
|
||||
*/
|
||||
function getConfigName(config, indexPath) {
|
||||
if (config.name) {
|
||||
return config.name;
|
||||
}
|
||||
|
||||
return `UserConfig${indexPath}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of an extension.
|
||||
* @param {SimpleExtendsElement} extension The extension.
|
||||
* @param {string} indexPath The index of the extension.
|
||||
* @return {string} The name of the extension.
|
||||
*/
|
||||
function getExtensionName(extension, indexPath) {
|
||||
if (typeof extension === "string") {
|
||||
return extension;
|
||||
}
|
||||
|
||||
if (extension.name) {
|
||||
return extension.name;
|
||||
}
|
||||
|
||||
return `ExtendedConfig${indexPath}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a config object is a legacy config.
|
||||
* @param {Config|LegacyConfig} config The config object to check.
|
||||
* @return {config is LegacyConfig} `true` if the config object is a legacy config.
|
||||
*/
|
||||
function isLegacyConfig(config) {
|
||||
// eslintrc's plugins must be an array; while flat config's must be an object.
|
||||
if (Array.isArray(config.plugins)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const key of eslintrcKeys) {
|
||||
if (key in config) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a config object is a global ignores config.
|
||||
* @param {Config} config The config object to check.
|
||||
* @return {boolean} `true` if the config object is a global ignores config.
|
||||
*/
|
||||
function isGlobalIgnores(config) {
|
||||
return Object.keys(config).every(key => allowedGlobalIgnoreKeys.has(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a plugin member ID (rule, processor, etc.) and returns
|
||||
* the namespace and member name.
|
||||
* @param {string} id The ID to parse.
|
||||
* @returns {{namespace:string, name:string}} The namespace and member name.
|
||||
*/
|
||||
function getPluginMember(id) {
|
||||
const firstSlashIndex = id.indexOf("/");
|
||||
|
||||
if (firstSlashIndex === -1) {
|
||||
return { namespace: "", name: id };
|
||||
}
|
||||
|
||||
let namespace = id.slice(0, firstSlashIndex);
|
||||
|
||||
/*
|
||||
* Special cases:
|
||||
* 1. The namespace is `@`, that means it's referring to the
|
||||
* core plugin so `@` is the full namespace.
|
||||
* 2. The namespace starts with `@`, that means it's referring to
|
||||
* an npm scoped package. That means the namespace is the scope
|
||||
* and the package name (i.e., `@eslint/core`).
|
||||
*/
|
||||
if (namespace[0] === "@" && namespace !== "@") {
|
||||
const secondSlashIndex = id.indexOf("/", firstSlashIndex + 1);
|
||||
if (secondSlashIndex !== -1) {
|
||||
namespace = id.slice(0, secondSlashIndex);
|
||||
return { namespace, name: id.slice(secondSlashIndex + 1) };
|
||||
}
|
||||
}
|
||||
|
||||
const name = id.slice(firstSlashIndex + 1);
|
||||
|
||||
return { namespace, name };
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes the plugin config by replacing the namespace with the plugin namespace.
|
||||
* @param {string} userNamespace The namespace of the plugin.
|
||||
* @param {Plugin} plugin The plugin config object.
|
||||
* @param {Config} config The config object to normalize.
|
||||
* @return {Config} The normalized config object.
|
||||
*/
|
||||
function normalizePluginConfig(userNamespace, plugin, config) {
|
||||
const pluginNamespace = plugin.meta?.namespace;
|
||||
|
||||
// don't do anything if the plugin doesn't have a namespace or rules
|
||||
if (
|
||||
!pluginNamespace ||
|
||||
pluginNamespace === userNamespace ||
|
||||
(!config.rules && !config.processor && !config.language)
|
||||
) {
|
||||
return config;
|
||||
}
|
||||
|
||||
const result = { ...config };
|
||||
|
||||
// update the rules
|
||||
if (result.rules) {
|
||||
const ruleIds = Object.keys(result.rules);
|
||||
|
||||
/** @type {Record<string,RuleConfig|undefined>} */
|
||||
const newRules = {};
|
||||
|
||||
for (let i = 0; i < ruleIds.length; i++) {
|
||||
const ruleId = ruleIds[i];
|
||||
const { namespace: ruleNamespace, name: ruleName } =
|
||||
getPluginMember(ruleId);
|
||||
|
||||
if (ruleNamespace === pluginNamespace) {
|
||||
newRules[`${userNamespace}/${ruleName}`] = result.rules[ruleId];
|
||||
} else {
|
||||
newRules[ruleId] = result.rules[ruleId];
|
||||
}
|
||||
}
|
||||
|
||||
result.rules = newRules;
|
||||
}
|
||||
|
||||
// update the processor
|
||||
|
||||
if (typeof result.processor === "string") {
|
||||
const { namespace: processorNamespace, name: processorName } =
|
||||
getPluginMember(result.processor);
|
||||
|
||||
if (processorNamespace) {
|
||||
if (processorNamespace === pluginNamespace) {
|
||||
result.processor = `${userNamespace}/${processorName}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update the language
|
||||
if (typeof result.language === "string") {
|
||||
const { namespace: languageNamespace, name: languageName } =
|
||||
getPluginMember(result.language);
|
||||
|
||||
if (languageNamespace === pluginNamespace) {
|
||||
result.language = `${userNamespace}/${languageName}`;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deeply normalizes a plugin config, traversing recursively into an arrays.
|
||||
* @param {string} userPluginNamespace The namespace of the plugin.
|
||||
* @param {Plugin} plugin The plugin object.
|
||||
* @param {Config|LegacyConfig|(Config|LegacyConfig)[]} pluginConfig The plugin config to normalize.
|
||||
* @param {string} pluginConfigName The name of the plugin config.
|
||||
* @return {InfiniteConfigArray} The normalized plugin config.
|
||||
* @throws {TypeError} If the plugin config is a legacy config.
|
||||
*/
|
||||
function deepNormalizePluginConfig(
|
||||
userPluginNamespace,
|
||||
plugin,
|
||||
pluginConfig,
|
||||
pluginConfigName,
|
||||
) {
|
||||
// if it's an array then it's definitely a new config
|
||||
if (Array.isArray(pluginConfig)) {
|
||||
return pluginConfig.map(pluginSubConfig =>
|
||||
deepNormalizePluginConfig(
|
||||
userPluginNamespace,
|
||||
plugin,
|
||||
pluginSubConfig,
|
||||
pluginConfigName,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// if it's a legacy config, throw an error
|
||||
if (isLegacyConfig(pluginConfig)) {
|
||||
throw new TypeError(
|
||||
`Plugin config "${pluginConfigName}" is an eslintrc config and cannot be used in this context.`,
|
||||
);
|
||||
}
|
||||
|
||||
return normalizePluginConfig(userPluginNamespace, plugin, pluginConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a plugin config by name in the given config.
|
||||
* @param {Config} config The config object.
|
||||
* @param {string} pluginConfigName The name of the plugin config.
|
||||
* @return {InfiniteConfigArray} The plugin config.
|
||||
* @throws {TypeError} If the plugin config is not found or is a legacy config.
|
||||
*/
|
||||
function findPluginConfig(config, pluginConfigName) {
|
||||
const { namespace: userPluginNamespace, name: configName } =
|
||||
getPluginMember(pluginConfigName);
|
||||
const plugin = config.plugins?.[userPluginNamespace];
|
||||
|
||||
if (!plugin) {
|
||||
throw new TypeError(`Plugin "${userPluginNamespace}" not found.`);
|
||||
}
|
||||
|
||||
const directConfig = plugin.configs?.[configName];
|
||||
|
||||
// Prefer direct config, but fall back to flat config if available
|
||||
if (directConfig) {
|
||||
// Arrays are always flat configs, and non-legacy configs can be used directly
|
||||
if (Array.isArray(directConfig) || !isLegacyConfig(directConfig)) {
|
||||
return deepNormalizePluginConfig(
|
||||
userPluginNamespace,
|
||||
plugin,
|
||||
directConfig,
|
||||
pluginConfigName,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// If it's a legacy config, or the config does not exist => look for the flat version
|
||||
const flatConfig = plugin.configs?.[`flat/${configName}`];
|
||||
if (
|
||||
flatConfig &&
|
||||
(Array.isArray(flatConfig) || !isLegacyConfig(flatConfig))
|
||||
) {
|
||||
return deepNormalizePluginConfig(
|
||||
userPluginNamespace,
|
||||
plugin,
|
||||
flatConfig,
|
||||
pluginConfigName,
|
||||
);
|
||||
}
|
||||
|
||||
// If we get here, then the config was either not found or is a legacy config
|
||||
const message =
|
||||
directConfig || flatConfig
|
||||
? `Plugin config "${configName}" in plugin "${userPluginNamespace}" is an eslintrc config and cannot be used in this context.`
|
||||
: `Plugin config "${configName}" not found in plugin "${userPluginNamespace}".`;
|
||||
throw new TypeError(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flattens an array while keeping track of the index path.
|
||||
* @param {any[]} configList The array to traverse.
|
||||
* @param {string} indexPath The index path of the value in a multidimensional array.
|
||||
* @return {IterableIterator<{indexPath:string, value:any}>} The flattened list of values.
|
||||
*/
|
||||
function* flatTraverse(configList, indexPath = "") {
|
||||
for (let i = 0; i < configList.length; i++) {
|
||||
const newIndexPath = indexPath ? `${indexPath}[${i}]` : `[${i}]`;
|
||||
|
||||
// if it's an array then traverse it as well
|
||||
if (Array.isArray(configList[i])) {
|
||||
yield* flatTraverse(configList[i], newIndexPath);
|
||||
continue;
|
||||
}
|
||||
|
||||
yield { indexPath: newIndexPath, value: configList[i] };
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extends a list of config files by creating every combination of base and extension files.
|
||||
* @param {(string|string[])[]} [baseFiles] The base files.
|
||||
* @param {(string|string[])[]} [extensionFiles] The extension files.
|
||||
* @return {(string|string[])[]} The extended files.
|
||||
*/
|
||||
function extendConfigFiles(baseFiles = [], extensionFiles = []) {
|
||||
if (!extensionFiles.length) {
|
||||
return baseFiles.concat();
|
||||
}
|
||||
|
||||
if (!baseFiles.length) {
|
||||
return extensionFiles.concat();
|
||||
}
|
||||
|
||||
/** @type {(string|string[])[]} */
|
||||
const result = [];
|
||||
|
||||
for (const baseFile of baseFiles) {
|
||||
for (const extensionFile of extensionFiles) {
|
||||
/*
|
||||
* Each entry can be a string or array of strings. The end result
|
||||
* needs to be an array of strings, so we need to be sure to include
|
||||
* all of the items when there's an array.
|
||||
*/
|
||||
|
||||
const entry = [];
|
||||
|
||||
if (Array.isArray(baseFile)) {
|
||||
entry.push(...baseFile);
|
||||
} else {
|
||||
entry.push(baseFile);
|
||||
}
|
||||
|
||||
if (Array.isArray(extensionFile)) {
|
||||
entry.push(...extensionFile);
|
||||
} else {
|
||||
entry.push(extensionFile);
|
||||
}
|
||||
|
||||
result.push(entry);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extends a config object with another config object.
|
||||
* @param {Config} baseConfig The base config object.
|
||||
* @param {string} baseConfigName The name of the base config object.
|
||||
* @param {Config} extension The extension config object.
|
||||
* @param {string} extensionName The index of the extension config object.
|
||||
* @return {Config} The extended config object.
|
||||
*/
|
||||
function extendConfig(baseConfig, baseConfigName, extension, extensionName) {
|
||||
const result = { ...extension };
|
||||
|
||||
// for global ignores there is no further work to be done, we just keep everything
|
||||
if (!isGlobalIgnores(extension)) {
|
||||
// for files we need to create every combination of base and extension files
|
||||
if (baseConfig.files) {
|
||||
result.files = extendConfigFiles(baseConfig.files, extension.files);
|
||||
}
|
||||
|
||||
// for ignores we just concatenation the extension ignores onto the base ignores
|
||||
if (baseConfig.ignores) {
|
||||
result.ignores = baseConfig.ignores.concat(extension.ignores ?? []);
|
||||
}
|
||||
}
|
||||
|
||||
result.name = `${baseConfigName} > ${extensionName}`;
|
||||
|
||||
// @ts-ignore -- ESLint types aren't updated yet
|
||||
if (baseConfig.basePath) {
|
||||
// @ts-ignore -- ESLint types aren't updated yet
|
||||
result.basePath = baseConfig.basePath;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes a list of extends elements.
|
||||
* @param {ConfigWithExtends} config The config object.
|
||||
* @param {WeakMap<Config, string>} configNames The map of config objects to their names.
|
||||
* @return {Config[]} The flattened list of config objects.
|
||||
* @throws {TypeError} If the `extends` property is not an array or if nested `extends` is found.
|
||||
*/
|
||||
function processExtends(config, configNames) {
|
||||
if (!config.extends) {
|
||||
return [config];
|
||||
}
|
||||
|
||||
if (!Array.isArray(config.extends)) {
|
||||
throw new TypeError("The `extends` property must be an array.");
|
||||
}
|
||||
|
||||
const {
|
||||
/** @type {Config[]} */
|
||||
extends: extendsList,
|
||||
|
||||
/** @type {Config} */
|
||||
...configObject
|
||||
} = config;
|
||||
|
||||
const extensionNames = new WeakMap();
|
||||
|
||||
// replace strings with the actual configs
|
||||
const objectExtends = extendsList.map(extendsElement => {
|
||||
if (typeof extendsElement === "string") {
|
||||
const pluginConfig = findPluginConfig(config, extendsElement);
|
||||
|
||||
// assign names
|
||||
if (Array.isArray(pluginConfig)) {
|
||||
pluginConfig.forEach((pluginConfigElement, index) => {
|
||||
extensionNames.set(
|
||||
pluginConfigElement,
|
||||
`${extendsElement}[${index}]`,
|
||||
);
|
||||
});
|
||||
} else {
|
||||
extensionNames.set(pluginConfig, extendsElement);
|
||||
}
|
||||
|
||||
return pluginConfig;
|
||||
}
|
||||
|
||||
return /** @type {Config} */ (extendsElement);
|
||||
});
|
||||
|
||||
const result = [];
|
||||
|
||||
for (const { indexPath, value: extendsElement } of flatTraverse(
|
||||
objectExtends,
|
||||
)) {
|
||||
const extension = /** @type {Config} */ (extendsElement);
|
||||
|
||||
if ("basePath" in extension) {
|
||||
throw new TypeError("'basePath' in `extends` is not allowed.");
|
||||
}
|
||||
|
||||
if ("extends" in extension) {
|
||||
throw new TypeError("Nested 'extends' is not allowed.");
|
||||
}
|
||||
|
||||
const baseConfigName = /** @type {string} */ (configNames.get(config));
|
||||
const extensionName =
|
||||
extensionNames.get(extendsElement) ??
|
||||
getExtensionName(extendsElement, indexPath);
|
||||
|
||||
result.push(
|
||||
extendConfig(
|
||||
configObject,
|
||||
baseConfigName,
|
||||
extension,
|
||||
extensionName,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* If the base config object has only `ignores` and `extends`, then
|
||||
* removing `extends` turns it into a global ignores, which is not what
|
||||
* we want. So we need to check if the base config object is a global ignores
|
||||
* and if so, we don't add it to the array.
|
||||
*
|
||||
* (The other option would be to add a `files` entry, but that would result
|
||||
* in a config that didn't actually do anything because there are no
|
||||
* other keys in the config.)
|
||||
*/
|
||||
if (!isGlobalIgnores(configObject)) {
|
||||
result.push(configObject);
|
||||
}
|
||||
|
||||
return result.flat();
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes a list of config objects and arrays.
|
||||
* @param {ConfigWithExtends[]} configList The list of config objects and arrays.
|
||||
* @param {WeakMap<Config, string>} configNames The map of config objects to their names.
|
||||
* @return {Config[]} The flattened list of config objects.
|
||||
*/
|
||||
function processConfigList(configList, configNames) {
|
||||
return configList.flatMap(config => processExtends(config, configNames));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Helper function to define a config array.
|
||||
* @param {ConfigWithExtendsArray} args The arguments to the function.
|
||||
* @returns {Config[]} The config array.
|
||||
* @throws {TypeError} If no arguments are provided or if an argument is not an object.
|
||||
*/
|
||||
function defineConfig(...args) {
|
||||
const configNames = new WeakMap();
|
||||
const configs = [];
|
||||
|
||||
if (args.length === 0) {
|
||||
throw new TypeError("Expected one or more arguments.");
|
||||
}
|
||||
|
||||
// first flatten the list of configs and get the names
|
||||
for (const { indexPath, value } of flatTraverse(args)) {
|
||||
if (typeof value !== "object" || value === null) {
|
||||
throw new TypeError(
|
||||
`Expected an object but received ${String(value)}.`,
|
||||
);
|
||||
}
|
||||
|
||||
const config = /** @type {ConfigWithExtends} */ (value);
|
||||
|
||||
// save config name for easy reference later
|
||||
configNames.set(config, getConfigName(config, indexPath));
|
||||
configs.push(config);
|
||||
}
|
||||
|
||||
return processConfigList(configs, configNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* @fileoverview Global ignores helper function.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Type Definitions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
let globalIgnoreCount = 0;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Creates a global ignores config with the given patterns.
|
||||
* @param {string[]} ignorePatterns The ignore patterns.
|
||||
* @param {string} [name] The name of the global ignores config.
|
||||
* @returns {Config} The global ignores config.
|
||||
* @throws {TypeError} If ignorePatterns is not an array or if it is empty.
|
||||
*/
|
||||
function globalIgnores(ignorePatterns, name) {
|
||||
if (!Array.isArray(ignorePatterns)) {
|
||||
throw new TypeError("ignorePatterns must be an array");
|
||||
}
|
||||
|
||||
if (ignorePatterns.length === 0) {
|
||||
throw new TypeError("ignorePatterns must contain at least one pattern");
|
||||
}
|
||||
|
||||
const id = globalIgnoreCount++;
|
||||
|
||||
return {
|
||||
name: name || `globalIgnores ${id}`,
|
||||
ignores: ignorePatterns,
|
||||
};
|
||||
}
|
||||
|
||||
exports.defineConfig = defineConfig;
|
||||
exports.globalIgnores = globalIgnores;
|
||||
26
frontend/node_modules/@eslint/config-helpers/dist/cjs/index.d.cts
generated
vendored
26
frontend/node_modules/@eslint/config-helpers/dist/cjs/index.d.cts
generated
vendored
@@ -1,26 +0,0 @@
|
||||
export type Config = $eslintcore.ConfigObject;
|
||||
export type LegacyConfig = $eslintcore.LegacyConfigObject;
|
||||
export type Plugin = $eslintcore.Plugin;
|
||||
export type RuleConfig = $eslintcore.RuleConfig;
|
||||
export type ExtendsElement = $typests.ExtendsElement;
|
||||
export type SimpleExtendsElement = $typests.SimpleExtendsElement;
|
||||
export type ConfigWithExtends = $typests.ConfigWithExtends;
|
||||
export type InfiniteConfigArray = $typests.InfiniteArray<Config>;
|
||||
export type ConfigWithExtendsArray = $typests.ConfigWithExtendsArray;
|
||||
/**
|
||||
* Helper function to define a config array.
|
||||
* @param {ConfigWithExtendsArray} args The arguments to the function.
|
||||
* @returns {Config[]} The config array.
|
||||
* @throws {TypeError} If no arguments are provided or if an argument is not an object.
|
||||
*/
|
||||
export function defineConfig(...args: ConfigWithExtendsArray): Config[];
|
||||
/**
|
||||
* Creates a global ignores config with the given patterns.
|
||||
* @param {string[]} ignorePatterns The ignore patterns.
|
||||
* @param {string} [name] The name of the global ignores config.
|
||||
* @returns {Config} The global ignores config.
|
||||
* @throws {TypeError} If ignorePatterns is not an array or if it is empty.
|
||||
*/
|
||||
export function globalIgnores(ignorePatterns: string[], name?: string): Config;
|
||||
import type * as $eslintcore from "@eslint/core";
|
||||
import type * as $typests from "./types.cts";
|
||||
29
frontend/node_modules/@eslint/config-helpers/dist/cjs/types.cts
generated
vendored
29
frontend/node_modules/@eslint/config-helpers/dist/cjs/types.cts
generated
vendored
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* @fileoverview Types for this package.
|
||||
*/
|
||||
|
||||
import type { ConfigObject } from "@eslint/core";
|
||||
|
||||
/**
|
||||
* Infinite array type.
|
||||
*/
|
||||
export type InfiniteArray<T> = T | InfiniteArray<T>[];
|
||||
|
||||
/**
|
||||
* The type of array element in the `extends` property after flattening.
|
||||
*/
|
||||
export type SimpleExtendsElement = string | ConfigObject;
|
||||
|
||||
/**
|
||||
* The type of array element in the `extends` property before flattening.
|
||||
*/
|
||||
export type ExtendsElement = SimpleExtendsElement | InfiniteArray<ConfigObject>;
|
||||
|
||||
/**
|
||||
* Config with extends. Valid only inside of `defineConfig()`.
|
||||
*/
|
||||
export interface ConfigWithExtends extends ConfigObject {
|
||||
extends?: ExtendsElement[];
|
||||
}
|
||||
|
||||
export type ConfigWithExtendsArray = InfiniteArray<ConfigWithExtends>[];
|
||||
26
frontend/node_modules/@eslint/config-helpers/dist/esm/index.d.ts
generated
vendored
26
frontend/node_modules/@eslint/config-helpers/dist/esm/index.d.ts
generated
vendored
@@ -1,26 +0,0 @@
|
||||
export type Config = $eslintcore.ConfigObject;
|
||||
export type LegacyConfig = $eslintcore.LegacyConfigObject;
|
||||
export type Plugin = $eslintcore.Plugin;
|
||||
export type RuleConfig = $eslintcore.RuleConfig;
|
||||
export type ExtendsElement = $typests.ExtendsElement;
|
||||
export type SimpleExtendsElement = $typests.SimpleExtendsElement;
|
||||
export type ConfigWithExtends = $typests.ConfigWithExtends;
|
||||
export type InfiniteConfigArray = $typests.InfiniteArray<Config>;
|
||||
export type ConfigWithExtendsArray = $typests.ConfigWithExtendsArray;
|
||||
/**
|
||||
* Helper function to define a config array.
|
||||
* @param {ConfigWithExtendsArray} args The arguments to the function.
|
||||
* @returns {Config[]} The config array.
|
||||
* @throws {TypeError} If no arguments are provided or if an argument is not an object.
|
||||
*/
|
||||
export function defineConfig(...args: ConfigWithExtendsArray): Config[];
|
||||
/**
|
||||
* Creates a global ignores config with the given patterns.
|
||||
* @param {string[]} ignorePatterns The ignore patterns.
|
||||
* @param {string} [name] The name of the global ignores config.
|
||||
* @returns {Config} The global ignores config.
|
||||
* @throws {TypeError} If ignorePatterns is not an array or if it is empty.
|
||||
*/
|
||||
export function globalIgnores(ignorePatterns: string[], name?: string): Config;
|
||||
import type * as $eslintcore from "@eslint/core";
|
||||
import type * as $typests from "./types.ts";
|
||||
586
frontend/node_modules/@eslint/config-helpers/dist/esm/index.js
generated
vendored
586
frontend/node_modules/@eslint/config-helpers/dist/esm/index.js
generated
vendored
@@ -1,586 +0,0 @@
|
||||
// @ts-self-types="./index.d.ts"
|
||||
/**
|
||||
* @fileoverview defineConfig helper
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Type Definitions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/** @import * as $eslintcore from "@eslint/core"; */
|
||||
/** @typedef {$eslintcore.ConfigObject} Config */
|
||||
/** @typedef {$eslintcore.LegacyConfigObject} LegacyConfig */
|
||||
/** @typedef {$eslintcore.Plugin} Plugin */
|
||||
/** @typedef {$eslintcore.RuleConfig} RuleConfig */
|
||||
/** @import * as $typests from "./types.ts"; */
|
||||
/** @typedef {$typests.ExtendsElement} ExtendsElement */
|
||||
/** @typedef {$typests.SimpleExtendsElement} SimpleExtendsElement */
|
||||
/** @typedef {$typests.ConfigWithExtends} ConfigWithExtends */
|
||||
/** @typedef {$typests.InfiniteArray<Config>} InfiniteConfigArray */
|
||||
/** @typedef {$typests.ConfigWithExtendsArray} ConfigWithExtendsArray */
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const eslintrcKeys = [
|
||||
"env",
|
||||
"extends",
|
||||
"globals",
|
||||
"ignorePatterns",
|
||||
"noInlineConfig",
|
||||
"overrides",
|
||||
"parser",
|
||||
"parserOptions",
|
||||
"reportUnusedDisableDirectives",
|
||||
"root",
|
||||
];
|
||||
|
||||
const allowedGlobalIgnoreKeys = new Set(["basePath", "ignores", "name"]);
|
||||
|
||||
/**
|
||||
* Gets the name of a config object.
|
||||
* @param {Config} config The config object.
|
||||
* @param {string} indexPath The index path of the config object.
|
||||
* @return {string} The name of the config object.
|
||||
*/
|
||||
function getConfigName(config, indexPath) {
|
||||
if (config.name) {
|
||||
return config.name;
|
||||
}
|
||||
|
||||
return `UserConfig${indexPath}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of an extension.
|
||||
* @param {SimpleExtendsElement} extension The extension.
|
||||
* @param {string} indexPath The index of the extension.
|
||||
* @return {string} The name of the extension.
|
||||
*/
|
||||
function getExtensionName(extension, indexPath) {
|
||||
if (typeof extension === "string") {
|
||||
return extension;
|
||||
}
|
||||
|
||||
if (extension.name) {
|
||||
return extension.name;
|
||||
}
|
||||
|
||||
return `ExtendedConfig${indexPath}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a config object is a legacy config.
|
||||
* @param {Config|LegacyConfig} config The config object to check.
|
||||
* @return {config is LegacyConfig} `true` if the config object is a legacy config.
|
||||
*/
|
||||
function isLegacyConfig(config) {
|
||||
// eslintrc's plugins must be an array; while flat config's must be an object.
|
||||
if (Array.isArray(config.plugins)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const key of eslintrcKeys) {
|
||||
if (key in config) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a config object is a global ignores config.
|
||||
* @param {Config} config The config object to check.
|
||||
* @return {boolean} `true` if the config object is a global ignores config.
|
||||
*/
|
||||
function isGlobalIgnores(config) {
|
||||
return Object.keys(config).every(key => allowedGlobalIgnoreKeys.has(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a plugin member ID (rule, processor, etc.) and returns
|
||||
* the namespace and member name.
|
||||
* @param {string} id The ID to parse.
|
||||
* @returns {{namespace:string, name:string}} The namespace and member name.
|
||||
*/
|
||||
function getPluginMember(id) {
|
||||
const firstSlashIndex = id.indexOf("/");
|
||||
|
||||
if (firstSlashIndex === -1) {
|
||||
return { namespace: "", name: id };
|
||||
}
|
||||
|
||||
let namespace = id.slice(0, firstSlashIndex);
|
||||
|
||||
/*
|
||||
* Special cases:
|
||||
* 1. The namespace is `@`, that means it's referring to the
|
||||
* core plugin so `@` is the full namespace.
|
||||
* 2. The namespace starts with `@`, that means it's referring to
|
||||
* an npm scoped package. That means the namespace is the scope
|
||||
* and the package name (i.e., `@eslint/core`).
|
||||
*/
|
||||
if (namespace[0] === "@" && namespace !== "@") {
|
||||
const secondSlashIndex = id.indexOf("/", firstSlashIndex + 1);
|
||||
if (secondSlashIndex !== -1) {
|
||||
namespace = id.slice(0, secondSlashIndex);
|
||||
return { namespace, name: id.slice(secondSlashIndex + 1) };
|
||||
}
|
||||
}
|
||||
|
||||
const name = id.slice(firstSlashIndex + 1);
|
||||
|
||||
return { namespace, name };
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes the plugin config by replacing the namespace with the plugin namespace.
|
||||
* @param {string} userNamespace The namespace of the plugin.
|
||||
* @param {Plugin} plugin The plugin config object.
|
||||
* @param {Config} config The config object to normalize.
|
||||
* @return {Config} The normalized config object.
|
||||
*/
|
||||
function normalizePluginConfig(userNamespace, plugin, config) {
|
||||
const pluginNamespace = plugin.meta?.namespace;
|
||||
|
||||
// don't do anything if the plugin doesn't have a namespace or rules
|
||||
if (
|
||||
!pluginNamespace ||
|
||||
pluginNamespace === userNamespace ||
|
||||
(!config.rules && !config.processor && !config.language)
|
||||
) {
|
||||
return config;
|
||||
}
|
||||
|
||||
const result = { ...config };
|
||||
|
||||
// update the rules
|
||||
if (result.rules) {
|
||||
const ruleIds = Object.keys(result.rules);
|
||||
|
||||
/** @type {Record<string,RuleConfig|undefined>} */
|
||||
const newRules = {};
|
||||
|
||||
for (let i = 0; i < ruleIds.length; i++) {
|
||||
const ruleId = ruleIds[i];
|
||||
const { namespace: ruleNamespace, name: ruleName } =
|
||||
getPluginMember(ruleId);
|
||||
|
||||
if (ruleNamespace === pluginNamespace) {
|
||||
newRules[`${userNamespace}/${ruleName}`] = result.rules[ruleId];
|
||||
} else {
|
||||
newRules[ruleId] = result.rules[ruleId];
|
||||
}
|
||||
}
|
||||
|
||||
result.rules = newRules;
|
||||
}
|
||||
|
||||
// update the processor
|
||||
|
||||
if (typeof result.processor === "string") {
|
||||
const { namespace: processorNamespace, name: processorName } =
|
||||
getPluginMember(result.processor);
|
||||
|
||||
if (processorNamespace) {
|
||||
if (processorNamespace === pluginNamespace) {
|
||||
result.processor = `${userNamespace}/${processorName}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update the language
|
||||
if (typeof result.language === "string") {
|
||||
const { namespace: languageNamespace, name: languageName } =
|
||||
getPluginMember(result.language);
|
||||
|
||||
if (languageNamespace === pluginNamespace) {
|
||||
result.language = `${userNamespace}/${languageName}`;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deeply normalizes a plugin config, traversing recursively into an arrays.
|
||||
* @param {string} userPluginNamespace The namespace of the plugin.
|
||||
* @param {Plugin} plugin The plugin object.
|
||||
* @param {Config|LegacyConfig|(Config|LegacyConfig)[]} pluginConfig The plugin config to normalize.
|
||||
* @param {string} pluginConfigName The name of the plugin config.
|
||||
* @return {InfiniteConfigArray} The normalized plugin config.
|
||||
* @throws {TypeError} If the plugin config is a legacy config.
|
||||
*/
|
||||
function deepNormalizePluginConfig(
|
||||
userPluginNamespace,
|
||||
plugin,
|
||||
pluginConfig,
|
||||
pluginConfigName,
|
||||
) {
|
||||
// if it's an array then it's definitely a new config
|
||||
if (Array.isArray(pluginConfig)) {
|
||||
return pluginConfig.map(pluginSubConfig =>
|
||||
deepNormalizePluginConfig(
|
||||
userPluginNamespace,
|
||||
plugin,
|
||||
pluginSubConfig,
|
||||
pluginConfigName,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// if it's a legacy config, throw an error
|
||||
if (isLegacyConfig(pluginConfig)) {
|
||||
throw new TypeError(
|
||||
`Plugin config "${pluginConfigName}" is an eslintrc config and cannot be used in this context.`,
|
||||
);
|
||||
}
|
||||
|
||||
return normalizePluginConfig(userPluginNamespace, plugin, pluginConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a plugin config by name in the given config.
|
||||
* @param {Config} config The config object.
|
||||
* @param {string} pluginConfigName The name of the plugin config.
|
||||
* @return {InfiniteConfigArray} The plugin config.
|
||||
* @throws {TypeError} If the plugin config is not found or is a legacy config.
|
||||
*/
|
||||
function findPluginConfig(config, pluginConfigName) {
|
||||
const { namespace: userPluginNamespace, name: configName } =
|
||||
getPluginMember(pluginConfigName);
|
||||
const plugin = config.plugins?.[userPluginNamespace];
|
||||
|
||||
if (!plugin) {
|
||||
throw new TypeError(`Plugin "${userPluginNamespace}" not found.`);
|
||||
}
|
||||
|
||||
const directConfig = plugin.configs?.[configName];
|
||||
|
||||
// Prefer direct config, but fall back to flat config if available
|
||||
if (directConfig) {
|
||||
// Arrays are always flat configs, and non-legacy configs can be used directly
|
||||
if (Array.isArray(directConfig) || !isLegacyConfig(directConfig)) {
|
||||
return deepNormalizePluginConfig(
|
||||
userPluginNamespace,
|
||||
plugin,
|
||||
directConfig,
|
||||
pluginConfigName,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// If it's a legacy config, or the config does not exist => look for the flat version
|
||||
const flatConfig = plugin.configs?.[`flat/${configName}`];
|
||||
if (
|
||||
flatConfig &&
|
||||
(Array.isArray(flatConfig) || !isLegacyConfig(flatConfig))
|
||||
) {
|
||||
return deepNormalizePluginConfig(
|
||||
userPluginNamespace,
|
||||
plugin,
|
||||
flatConfig,
|
||||
pluginConfigName,
|
||||
);
|
||||
}
|
||||
|
||||
// If we get here, then the config was either not found or is a legacy config
|
||||
const message =
|
||||
directConfig || flatConfig
|
||||
? `Plugin config "${configName}" in plugin "${userPluginNamespace}" is an eslintrc config and cannot be used in this context.`
|
||||
: `Plugin config "${configName}" not found in plugin "${userPluginNamespace}".`;
|
||||
throw new TypeError(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flattens an array while keeping track of the index path.
|
||||
* @param {any[]} configList The array to traverse.
|
||||
* @param {string} indexPath The index path of the value in a multidimensional array.
|
||||
* @return {IterableIterator<{indexPath:string, value:any}>} The flattened list of values.
|
||||
*/
|
||||
function* flatTraverse(configList, indexPath = "") {
|
||||
for (let i = 0; i < configList.length; i++) {
|
||||
const newIndexPath = indexPath ? `${indexPath}[${i}]` : `[${i}]`;
|
||||
|
||||
// if it's an array then traverse it as well
|
||||
if (Array.isArray(configList[i])) {
|
||||
yield* flatTraverse(configList[i], newIndexPath);
|
||||
continue;
|
||||
}
|
||||
|
||||
yield { indexPath: newIndexPath, value: configList[i] };
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extends a list of config files by creating every combination of base and extension files.
|
||||
* @param {(string|string[])[]} [baseFiles] The base files.
|
||||
* @param {(string|string[])[]} [extensionFiles] The extension files.
|
||||
* @return {(string|string[])[]} The extended files.
|
||||
*/
|
||||
function extendConfigFiles(baseFiles = [], extensionFiles = []) {
|
||||
if (!extensionFiles.length) {
|
||||
return baseFiles.concat();
|
||||
}
|
||||
|
||||
if (!baseFiles.length) {
|
||||
return extensionFiles.concat();
|
||||
}
|
||||
|
||||
/** @type {(string|string[])[]} */
|
||||
const result = [];
|
||||
|
||||
for (const baseFile of baseFiles) {
|
||||
for (const extensionFile of extensionFiles) {
|
||||
/*
|
||||
* Each entry can be a string or array of strings. The end result
|
||||
* needs to be an array of strings, so we need to be sure to include
|
||||
* all of the items when there's an array.
|
||||
*/
|
||||
|
||||
const entry = [];
|
||||
|
||||
if (Array.isArray(baseFile)) {
|
||||
entry.push(...baseFile);
|
||||
} else {
|
||||
entry.push(baseFile);
|
||||
}
|
||||
|
||||
if (Array.isArray(extensionFile)) {
|
||||
entry.push(...extensionFile);
|
||||
} else {
|
||||
entry.push(extensionFile);
|
||||
}
|
||||
|
||||
result.push(entry);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extends a config object with another config object.
|
||||
* @param {Config} baseConfig The base config object.
|
||||
* @param {string} baseConfigName The name of the base config object.
|
||||
* @param {Config} extension The extension config object.
|
||||
* @param {string} extensionName The index of the extension config object.
|
||||
* @return {Config} The extended config object.
|
||||
*/
|
||||
function extendConfig(baseConfig, baseConfigName, extension, extensionName) {
|
||||
const result = { ...extension };
|
||||
|
||||
// for global ignores there is no further work to be done, we just keep everything
|
||||
if (!isGlobalIgnores(extension)) {
|
||||
// for files we need to create every combination of base and extension files
|
||||
if (baseConfig.files) {
|
||||
result.files = extendConfigFiles(baseConfig.files, extension.files);
|
||||
}
|
||||
|
||||
// for ignores we just concatenation the extension ignores onto the base ignores
|
||||
if (baseConfig.ignores) {
|
||||
result.ignores = baseConfig.ignores.concat(extension.ignores ?? []);
|
||||
}
|
||||
}
|
||||
|
||||
result.name = `${baseConfigName} > ${extensionName}`;
|
||||
|
||||
// @ts-ignore -- ESLint types aren't updated yet
|
||||
if (baseConfig.basePath) {
|
||||
// @ts-ignore -- ESLint types aren't updated yet
|
||||
result.basePath = baseConfig.basePath;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes a list of extends elements.
|
||||
* @param {ConfigWithExtends} config The config object.
|
||||
* @param {WeakMap<Config, string>} configNames The map of config objects to their names.
|
||||
* @return {Config[]} The flattened list of config objects.
|
||||
* @throws {TypeError} If the `extends` property is not an array or if nested `extends` is found.
|
||||
*/
|
||||
function processExtends(config, configNames) {
|
||||
if (!config.extends) {
|
||||
return [config];
|
||||
}
|
||||
|
||||
if (!Array.isArray(config.extends)) {
|
||||
throw new TypeError("The `extends` property must be an array.");
|
||||
}
|
||||
|
||||
const {
|
||||
/** @type {Config[]} */
|
||||
extends: extendsList,
|
||||
|
||||
/** @type {Config} */
|
||||
...configObject
|
||||
} = config;
|
||||
|
||||
const extensionNames = new WeakMap();
|
||||
|
||||
// replace strings with the actual configs
|
||||
const objectExtends = extendsList.map(extendsElement => {
|
||||
if (typeof extendsElement === "string") {
|
||||
const pluginConfig = findPluginConfig(config, extendsElement);
|
||||
|
||||
// assign names
|
||||
if (Array.isArray(pluginConfig)) {
|
||||
pluginConfig.forEach((pluginConfigElement, index) => {
|
||||
extensionNames.set(
|
||||
pluginConfigElement,
|
||||
`${extendsElement}[${index}]`,
|
||||
);
|
||||
});
|
||||
} else {
|
||||
extensionNames.set(pluginConfig, extendsElement);
|
||||
}
|
||||
|
||||
return pluginConfig;
|
||||
}
|
||||
|
||||
return /** @type {Config} */ (extendsElement);
|
||||
});
|
||||
|
||||
const result = [];
|
||||
|
||||
for (const { indexPath, value: extendsElement } of flatTraverse(
|
||||
objectExtends,
|
||||
)) {
|
||||
const extension = /** @type {Config} */ (extendsElement);
|
||||
|
||||
if ("basePath" in extension) {
|
||||
throw new TypeError("'basePath' in `extends` is not allowed.");
|
||||
}
|
||||
|
||||
if ("extends" in extension) {
|
||||
throw new TypeError("Nested 'extends' is not allowed.");
|
||||
}
|
||||
|
||||
const baseConfigName = /** @type {string} */ (configNames.get(config));
|
||||
const extensionName =
|
||||
extensionNames.get(extendsElement) ??
|
||||
getExtensionName(extendsElement, indexPath);
|
||||
|
||||
result.push(
|
||||
extendConfig(
|
||||
configObject,
|
||||
baseConfigName,
|
||||
extension,
|
||||
extensionName,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* If the base config object has only `ignores` and `extends`, then
|
||||
* removing `extends` turns it into a global ignores, which is not what
|
||||
* we want. So we need to check if the base config object is a global ignores
|
||||
* and if so, we don't add it to the array.
|
||||
*
|
||||
* (The other option would be to add a `files` entry, but that would result
|
||||
* in a config that didn't actually do anything because there are no
|
||||
* other keys in the config.)
|
||||
*/
|
||||
if (!isGlobalIgnores(configObject)) {
|
||||
result.push(configObject);
|
||||
}
|
||||
|
||||
return result.flat();
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes a list of config objects and arrays.
|
||||
* @param {ConfigWithExtends[]} configList The list of config objects and arrays.
|
||||
* @param {WeakMap<Config, string>} configNames The map of config objects to their names.
|
||||
* @return {Config[]} The flattened list of config objects.
|
||||
*/
|
||||
function processConfigList(configList, configNames) {
|
||||
return configList.flatMap(config => processExtends(config, configNames));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Helper function to define a config array.
|
||||
* @param {ConfigWithExtendsArray} args The arguments to the function.
|
||||
* @returns {Config[]} The config array.
|
||||
* @throws {TypeError} If no arguments are provided or if an argument is not an object.
|
||||
*/
|
||||
function defineConfig(...args) {
|
||||
const configNames = new WeakMap();
|
||||
const configs = [];
|
||||
|
||||
if (args.length === 0) {
|
||||
throw new TypeError("Expected one or more arguments.");
|
||||
}
|
||||
|
||||
// first flatten the list of configs and get the names
|
||||
for (const { indexPath, value } of flatTraverse(args)) {
|
||||
if (typeof value !== "object" || value === null) {
|
||||
throw new TypeError(
|
||||
`Expected an object but received ${String(value)}.`,
|
||||
);
|
||||
}
|
||||
|
||||
const config = /** @type {ConfigWithExtends} */ (value);
|
||||
|
||||
// save config name for easy reference later
|
||||
configNames.set(config, getConfigName(config, indexPath));
|
||||
configs.push(config);
|
||||
}
|
||||
|
||||
return processConfigList(configs, configNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* @fileoverview Global ignores helper function.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Type Definitions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
let globalIgnoreCount = 0;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Creates a global ignores config with the given patterns.
|
||||
* @param {string[]} ignorePatterns The ignore patterns.
|
||||
* @param {string} [name] The name of the global ignores config.
|
||||
* @returns {Config} The global ignores config.
|
||||
* @throws {TypeError} If ignorePatterns is not an array or if it is empty.
|
||||
*/
|
||||
function globalIgnores(ignorePatterns, name) {
|
||||
if (!Array.isArray(ignorePatterns)) {
|
||||
throw new TypeError("ignorePatterns must be an array");
|
||||
}
|
||||
|
||||
if (ignorePatterns.length === 0) {
|
||||
throw new TypeError("ignorePatterns must contain at least one pattern");
|
||||
}
|
||||
|
||||
const id = globalIgnoreCount++;
|
||||
|
||||
return {
|
||||
name: name || `globalIgnores ${id}`,
|
||||
ignores: ignorePatterns,
|
||||
};
|
||||
}
|
||||
|
||||
export { defineConfig, globalIgnores };
|
||||
23
frontend/node_modules/@eslint/config-helpers/dist/esm/types.d.ts
generated
vendored
23
frontend/node_modules/@eslint/config-helpers/dist/esm/types.d.ts
generated
vendored
@@ -1,23 +0,0 @@
|
||||
/**
|
||||
* @fileoverview Types for this package.
|
||||
*/
|
||||
import type { ConfigObject } from "@eslint/core";
|
||||
/**
|
||||
* Infinite array type.
|
||||
*/
|
||||
export type InfiniteArray<T> = T | InfiniteArray<T>[];
|
||||
/**
|
||||
* The type of array element in the `extends` property after flattening.
|
||||
*/
|
||||
export type SimpleExtendsElement = string | ConfigObject;
|
||||
/**
|
||||
* The type of array element in the `extends` property before flattening.
|
||||
*/
|
||||
export type ExtendsElement = SimpleExtendsElement | InfiniteArray<ConfigObject>;
|
||||
/**
|
||||
* Config with extends. Valid only inside of `defineConfig()`.
|
||||
*/
|
||||
export interface ConfigWithExtends extends ConfigObject {
|
||||
extends?: ExtendsElement[];
|
||||
}
|
||||
export type ConfigWithExtendsArray = InfiniteArray<ConfigWithExtends>[];
|
||||
29
frontend/node_modules/@eslint/config-helpers/dist/esm/types.ts
generated
vendored
29
frontend/node_modules/@eslint/config-helpers/dist/esm/types.ts
generated
vendored
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* @fileoverview Types for this package.
|
||||
*/
|
||||
|
||||
import type { ConfigObject } from "@eslint/core";
|
||||
|
||||
/**
|
||||
* Infinite array type.
|
||||
*/
|
||||
export type InfiniteArray<T> = T | InfiniteArray<T>[];
|
||||
|
||||
/**
|
||||
* The type of array element in the `extends` property after flattening.
|
||||
*/
|
||||
export type SimpleExtendsElement = string | ConfigObject;
|
||||
|
||||
/**
|
||||
* The type of array element in the `extends` property before flattening.
|
||||
*/
|
||||
export type ExtendsElement = SimpleExtendsElement | InfiniteArray<ConfigObject>;
|
||||
|
||||
/**
|
||||
* Config with extends. Valid only inside of `defineConfig()`.
|
||||
*/
|
||||
export interface ConfigWithExtends extends ConfigObject {
|
||||
extends?: ExtendsElement[];
|
||||
}
|
||||
|
||||
export type ConfigWithExtendsArray = InfiniteArray<ConfigWithExtends>[];
|
||||
60
frontend/node_modules/@eslint/config-helpers/package.json
generated
vendored
60
frontend/node_modules/@eslint/config-helpers/package.json
generated
vendored
@@ -1,60 +0,0 @@
|
||||
{
|
||||
"name": "@eslint/config-helpers",
|
||||
"version": "0.4.2",
|
||||
"description": "Helper utilities for creating ESLint configuration",
|
||||
"type": "module",
|
||||
"main": "dist/esm/index.js",
|
||||
"types": "dist/esm/index.d.ts",
|
||||
"exports": {
|
||||
"require": {
|
||||
"types": "./dist/cjs/index.d.cts",
|
||||
"default": "./dist/cjs/index.cjs"
|
||||
},
|
||||
"import": {
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"directories": {
|
||||
"test": "tests"
|
||||
},
|
||||
"scripts": {
|
||||
"build:dedupe-types": "node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js",
|
||||
"build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts",
|
||||
"build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts",
|
||||
"test": "mocha \"tests/**/*.test.js\"",
|
||||
"test:coverage": "c8 npm test",
|
||||
"test:jsr": "npx jsr@latest publish --dry-run",
|
||||
"test:pnpm": "cd tests/pnpm && pnpm install && pnpm exec tsc",
|
||||
"test:types": "tsc -p tests/types/tsconfig.json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/eslint/rewrite.git",
|
||||
"directory": "packages/config-helpers"
|
||||
},
|
||||
"keywords": [
|
||||
"eslint"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/eslint/rewrite/issues"
|
||||
},
|
||||
"homepage": "https://github.com/eslint/rewrite/tree/main/packages/config-helpers#readme",
|
||||
"dependencies": {
|
||||
"@eslint/core": "^0.17.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^9.27.0",
|
||||
"rollup-plugin-copy": "^3.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
}
|
||||
}
|
||||
201
frontend/node_modules/@eslint/core/LICENSE
generated
vendored
201
frontend/node_modules/@eslint/core/LICENSE
generated
vendored
@@ -1,201 +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
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
||||
29
frontend/node_modules/@eslint/core/README.md
generated
vendored
29
frontend/node_modules/@eslint/core/README.md
generated
vendored
@@ -1,29 +0,0 @@
|
||||
# ESLint Core
|
||||
|
||||
## Overview
|
||||
|
||||
This package is the future home of the rewritten, runtime-agnostic ESLint core.
|
||||
|
||||
Right now, it exports the core types necessary to implement language plugins.
|
||||
|
||||
## License
|
||||
|
||||
Apache 2.0
|
||||
|
||||
<!-- NOTE: This section is autogenerated. Do not manually edit.-->
|
||||
<!--sponsorsstart-->
|
||||
|
||||
## Sponsors
|
||||
|
||||
The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)
|
||||
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
|
||||
|
||||
<h3>Platinum Sponsors</h3>
|
||||
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
|
||||
<p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a> <a href="https://shopify.engineering/"><img src="https://avatars.githubusercontent.com/u/8085" alt="Shopify" height="96"></a></p><h3>Silver Sponsors</h3>
|
||||
<p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/e6d15e1/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301" alt="American Express" height="64"></a> <a href="https://stackblitz.com"><img src="https://avatars.githubusercontent.com/u/28635252" alt="StackBlitz" height="64"></a></p><h3>Bronze Sponsors</h3>
|
||||
<p><a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://sentry.io"><img src="https://github.com/getsentry.png" alt="Sentry" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="LambdaTest" height="32"></a></p>
|
||||
<h3>Technology Sponsors</h3>
|
||||
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.
|
||||
<p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p>
|
||||
<!--sponsorsend-->
|
||||
1179
frontend/node_modules/@eslint/core/dist/cjs/types.d.cts
generated
vendored
1179
frontend/node_modules/@eslint/core/dist/cjs/types.d.cts
generated
vendored
File diff suppressed because it is too large
Load Diff
1179
frontend/node_modules/@eslint/core/dist/esm/types.d.ts
generated
vendored
1179
frontend/node_modules/@eslint/core/dist/esm/types.d.ts
generated
vendored
File diff suppressed because it is too large
Load Diff
49
frontend/node_modules/@eslint/core/package.json
generated
vendored
49
frontend/node_modules/@eslint/core/package.json
generated
vendored
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"name": "@eslint/core",
|
||||
"version": "0.17.0",
|
||||
"description": "Runtime-agnostic core of ESLint",
|
||||
"type": "module",
|
||||
"types": "./dist/esm/types.d.ts",
|
||||
"exports": {
|
||||
"types": {
|
||||
"import": "./dist/esm/types.d.ts",
|
||||
"require": "./dist/cjs/types.d.cts"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"build:cts": "node -e \"fs.cpSync('dist/esm/types.d.ts', 'dist/cjs/types.d.cts')\"",
|
||||
"build": "tsc && npm run build:cts",
|
||||
"test:jsr": "npx jsr@latest publish --dry-run",
|
||||
"test:types": "tsc -p tests/types/tsconfig.json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/eslint/rewrite.git",
|
||||
"directory": "packages/core"
|
||||
},
|
||||
"keywords": [
|
||||
"eslint",
|
||||
"core"
|
||||
],
|
||||
"author": "Nicholas C. Zakas",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/eslint/rewrite/issues"
|
||||
},
|
||||
"homepage": "https://github.com/eslint/rewrite/tree/main/packages/core#readme",
|
||||
"dependencies": {
|
||||
"@types/json-schema": "^7.0.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"json-schema": "^0.4.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
}
|
||||
}
|
||||
41
frontend/node_modules/@eslint/eslintrc/README.md
generated
vendored
41
frontend/node_modules/@eslint/eslintrc/README.md
generated
vendored
@@ -8,14 +8,12 @@ This repository contains the legacy ESLintRC configuration file format for ESLin
|
||||
|
||||
You can install the package as follows:
|
||||
|
||||
```shell
|
||||
npm install @eslint/eslintrc -D
|
||||
```
|
||||
npm install @eslint/eslintrc --save-dev
|
||||
|
||||
# or
|
||||
|
||||
yarn add @eslint/eslintrc -D
|
||||
# or
|
||||
pnpm install @eslint/eslintrc -D
|
||||
# or
|
||||
bun install @eslint/eslintrc -D
|
||||
```
|
||||
|
||||
## Usage (ESM)
|
||||
@@ -35,14 +33,14 @@ const __dirname = path.dirname(__filename);
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: __dirname, // optional; default: process.cwd()
|
||||
resolvePluginsRelativeTo: __dirname, // optional
|
||||
recommendedConfig: js.configs.recommended, // optional unless you're using "eslint:recommended"
|
||||
allConfig: js.configs.all, // optional unless you're using "eslint:all"
|
||||
recommendedConfig: js.configs.recommended, // optional
|
||||
allConfig: js.configs.all, // optional
|
||||
});
|
||||
|
||||
export default [
|
||||
|
||||
// mimic ESLintRC-style extends
|
||||
...compat.extends("standard", "example", "plugin:react/recommended"),
|
||||
...compat.extends("standard", "example"),
|
||||
|
||||
// mimic environments
|
||||
...compat.env({
|
||||
@@ -51,11 +49,11 @@ export default [
|
||||
}),
|
||||
|
||||
// mimic plugins
|
||||
...compat.plugins("jsx-a11y", "react"),
|
||||
...compat.plugins("airbnb", "react"),
|
||||
|
||||
// translate an entire config
|
||||
...compat.config({
|
||||
plugins: ["jsx-a11y", "react"],
|
||||
plugins: ["airbnb", "react"],
|
||||
extends: "standard",
|
||||
env: {
|
||||
es2020: true,
|
||||
@@ -79,14 +77,14 @@ const js = require("@eslint/js");
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: __dirname, // optional; default: process.cwd()
|
||||
resolvePluginsRelativeTo: __dirname, // optional
|
||||
recommendedConfig: js.configs.recommended, // optional unless using "eslint:recommended"
|
||||
allConfig: js.configs.all, // optional unless using "eslint:all"
|
||||
recommendedConfig: js.configs.recommended, // optional
|
||||
allConfig: js.configs.all, // optional
|
||||
});
|
||||
|
||||
module.exports = [
|
||||
|
||||
// mimic ESLintRC-style extends
|
||||
...compat.extends("standard", "example", "plugin:react/recommended"),
|
||||
...compat.extends("standard", "example"),
|
||||
|
||||
// mimic environments
|
||||
...compat.env({
|
||||
@@ -95,11 +93,11 @@ module.exports = [
|
||||
}),
|
||||
|
||||
// mimic plugins
|
||||
...compat.plugins("jsx-a11y", "react"),
|
||||
...compat.plugins("airbnb", "react"),
|
||||
|
||||
// translate an entire config
|
||||
...compat.config({
|
||||
plugins: ["jsx-a11y", "react"],
|
||||
plugins: ["airbnb", "react"],
|
||||
extends: "standard",
|
||||
env: {
|
||||
es2020: true,
|
||||
@@ -112,17 +110,6 @@ module.exports = [
|
||||
];
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**TypeError: Missing parameter 'recommendedConfig' in FlatCompat constructor**
|
||||
|
||||
The `recommendedConfig` option is required when any config uses `eslint:recommended`, including any config in an `extends` clause. To fix this, follow the example above using `@eslint/js` to provide the `eslint:recommended` config.
|
||||
|
||||
**TypeError: Missing parameter 'allConfig' in FlatCompat constructor**
|
||||
|
||||
The `allConfig` option is required when any config uses `eslint:all`, including any config in an `extends` clause. To fix this, follow the example above using `@eslint/js` to provide the `eslint:all` config.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT License
|
||||
|
||||
2
frontend/node_modules/@eslint/eslintrc/conf/environments.js
generated
vendored
2
frontend/node_modules/@eslint/eslintrc/conf/environments.js
generated
vendored
@@ -23,7 +23,7 @@ function getDiff(current, prev) {
|
||||
const retv = {};
|
||||
|
||||
for (const [key, value] of Object.entries(current)) {
|
||||
if (!Object.hasOwn(prev, key)) {
|
||||
if (!Object.hasOwnProperty.call(prev, key)) {
|
||||
retv[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
170
frontend/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs
generated
vendored
170
frontend/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs
generated
vendored
@@ -2,8 +2,8 @@
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var util = require('node:util');
|
||||
var path = require('node:path');
|
||||
var util = require('util');
|
||||
var path = require('path');
|
||||
var Ajv = require('ajv');
|
||||
var globals = require('globals');
|
||||
|
||||
@@ -29,7 +29,7 @@ const RULE_SEVERITY_STRINGS = ["off", "warn", "error"],
|
||||
map[value] = index;
|
||||
return map;
|
||||
}, {}),
|
||||
VALID_SEVERITIES = new Set([0, 1, 2, "off", "warn", "error"]);
|
||||
VALID_SEVERITIES = [0, 1, 2, "off", "warn", "error"];
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
@@ -99,7 +99,7 @@ function isValidSeverity(ruleConfig) {
|
||||
if (typeof severity === "string") {
|
||||
severity = severity.toLowerCase();
|
||||
}
|
||||
return VALID_SEVERITIES.has(severity);
|
||||
return VALID_SEVERITIES.indexOf(severity) !== -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -381,69 +381,12 @@ var ajvOrig = (additionalOptions = {}) => {
|
||||
});
|
||||
|
||||
ajv.addMetaSchema(metaSchema);
|
||||
// eslint-disable-next-line no-underscore-dangle -- part of the API
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
ajv._opts.defaultMeta = metaSchema.id;
|
||||
|
||||
return ajv;
|
||||
};
|
||||
|
||||
/**
|
||||
* @fileoverview Applies default rule options
|
||||
* @author JoshuaKGoldberg
|
||||
*/
|
||||
|
||||
/**
|
||||
* Check if the variable contains an object strictly rejecting arrays
|
||||
* @param {unknown} value an object
|
||||
* @returns {boolean} Whether value is an object
|
||||
*/
|
||||
function isObjectNotArray(value) {
|
||||
return typeof value === "object" && value !== null && !Array.isArray(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deeply merges second on top of first, creating a new {} object if needed.
|
||||
* @param {T} first Base, default value.
|
||||
* @param {U} second User-specified value.
|
||||
* @returns {T | U | (T & U)} Merged equivalent of second on top of first.
|
||||
*/
|
||||
function deepMergeObjects(first, second) {
|
||||
if (second === void 0) {
|
||||
return first;
|
||||
}
|
||||
|
||||
if (!isObjectNotArray(first) || !isObjectNotArray(second)) {
|
||||
return second;
|
||||
}
|
||||
|
||||
const result = { ...first, ...second };
|
||||
|
||||
for (const key of Object.keys(second)) {
|
||||
if (Object.prototype.propertyIsEnumerable.call(first, key)) {
|
||||
result[key] = deepMergeObjects(first[key], second[key]);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deeply merges second on top of first, creating a new [] array if needed.
|
||||
* @param {T[] | undefined} first Base, default values.
|
||||
* @param {U[] | undefined} second User-specified values.
|
||||
* @returns {(T | U | (T & U))[]} Merged equivalent of second on top of first.
|
||||
*/
|
||||
function deepMergeArrays(first, second) {
|
||||
if (!first || !second) {
|
||||
return second || first || [];
|
||||
}
|
||||
|
||||
return [
|
||||
...first.map((value, i) => deepMergeObjects(value, second[i])),
|
||||
...second.slice(first.length)
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @fileoverview Defines a schema for configs.
|
||||
* @author Sylvan Mably
|
||||
@@ -541,7 +484,7 @@ function getDiff(current, prev) {
|
||||
const retv = {};
|
||||
|
||||
for (const [key, value] of Object.entries(current)) {
|
||||
if (!Object.hasOwn(prev, key)) {
|
||||
if (!Object.hasOwnProperty.call(prev, key)) {
|
||||
retv[key] = value;
|
||||
}
|
||||
}
|
||||
@@ -754,20 +697,10 @@ const severityMap = {
|
||||
|
||||
const validated = new WeakSet();
|
||||
|
||||
// JSON schema that disallows passing any options
|
||||
const noOptionsSchema = Object.freeze({
|
||||
type: "array",
|
||||
minItems: 0,
|
||||
maxItems: 0
|
||||
});
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Validator for configuration objects.
|
||||
*/
|
||||
class ConfigValidator {
|
||||
constructor({ builtInRules = new Map() } = {}) {
|
||||
this.builtInRules = builtInRules;
|
||||
@@ -775,36 +708,17 @@ class ConfigValidator {
|
||||
|
||||
/**
|
||||
* Gets a complete options schema for a rule.
|
||||
* @param {Rule} rule A rule object
|
||||
* @throws {TypeError} If `meta.schema` is specified but is not an array, object or `false`.
|
||||
* @returns {Object|null} JSON Schema for the rule's options.
|
||||
* `null` if rule wasn't passed or its `meta.schema` is `false`.
|
||||
* @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;
|
||||
}
|
||||
|
||||
if (!rule.meta) {
|
||||
return { ...noOptionsSchema }; // default if `meta.schema` is not specified
|
||||
}
|
||||
const schema = rule.schema || rule.meta && rule.meta.schema;
|
||||
|
||||
const schema = rule.meta.schema;
|
||||
|
||||
if (typeof schema === "undefined") {
|
||||
return { ...noOptionsSchema }; // default if `meta.schema` is not specified
|
||||
}
|
||||
|
||||
// `schema:false` is an allowed explicit opt-out of options validation for the rule
|
||||
if (schema === false) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (typeof schema !== "object" || schema === null) {
|
||||
throw new TypeError("Rule's `meta.schema` must be an array or object");
|
||||
}
|
||||
|
||||
// ESLint-specific array form needs to be converted into a valid JSON Schema definition
|
||||
// Given a tuple of schemas, insert warning level at the beginning
|
||||
if (Array.isArray(schema)) {
|
||||
if (schema.length) {
|
||||
return {
|
||||
@@ -814,20 +728,22 @@ class ConfigValidator {
|
||||
maxItems: schema.length
|
||||
};
|
||||
}
|
||||
return {
|
||||
type: "array",
|
||||
minItems: 0,
|
||||
maxItems: 0
|
||||
};
|
||||
|
||||
// `schema:[]` is an explicit way to specify that the rule does not accept any options
|
||||
return { ...noOptionsSchema };
|
||||
}
|
||||
|
||||
// `schema:<object>` is assumed to be a valid JSON Schema definition
|
||||
return schema;
|
||||
// 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
|
||||
* @throws {Error} If the severity is invalid.
|
||||
*/
|
||||
validateRuleSeverity(options) {
|
||||
const severity = Array.isArray(options) ? options[0] : options;
|
||||
@@ -846,32 +762,20 @@ class ConfigValidator {
|
||||
* @param {{create: Function}} rule The rule to validate
|
||||
* @param {Array} localOptions The options for the rule, excluding severity
|
||||
* @returns {void}
|
||||
* @throws {Error} If the options are invalid.
|
||||
*/
|
||||
validateRuleSchema(rule, localOptions) {
|
||||
if (!ruleValidators.has(rule)) {
|
||||
try {
|
||||
const schema = this.getRuleOptionsSchema(rule);
|
||||
const schema = this.getRuleOptionsSchema(rule);
|
||||
|
||||
if (schema) {
|
||||
ruleValidators.set(rule, ajv.compile(schema));
|
||||
}
|
||||
} catch (err) {
|
||||
const errorWithCode = new Error(err.message, { cause: err });
|
||||
|
||||
errorWithCode.code = "ESLINT_INVALID_RULE_OPTIONS_SCHEMA";
|
||||
|
||||
throw errorWithCode;
|
||||
if (schema) {
|
||||
ruleValidators.set(rule, ajv.compile(schema));
|
||||
}
|
||||
}
|
||||
|
||||
const validateRule = ruleValidators.get(rule);
|
||||
|
||||
if (validateRule) {
|
||||
const mergedOptions = deepMergeArrays(rule.meta?.defaultOptions, localOptions);
|
||||
|
||||
validateRule(mergedOptions);
|
||||
|
||||
validateRule(localOptions);
|
||||
if (validateRule.errors) {
|
||||
throw new Error(validateRule.errors.map(
|
||||
error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n`
|
||||
@@ -888,7 +792,6 @@ class ConfigValidator {
|
||||
* @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}
|
||||
* @throws {Error} If the options are invalid.
|
||||
*/
|
||||
validateRuleOptions(rule, ruleId, options, source = null) {
|
||||
try {
|
||||
@@ -898,21 +801,13 @@ class ConfigValidator {
|
||||
this.validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []);
|
||||
}
|
||||
} catch (err) {
|
||||
let enhancedMessage = err.code === "ESLINT_INVALID_RULE_OPTIONS_SCHEMA"
|
||||
? `Error while processing options validation schema of rule '${ruleId}': ${err.message}`
|
||||
: `Configuration for rule "${ruleId}" is invalid:\n${err.message}`;
|
||||
const enhancedMessage = `Configuration for rule "${ruleId}" is invalid:\n${err.message}`;
|
||||
|
||||
if (typeof source === "string") {
|
||||
enhancedMessage = `${source}:\n\t${enhancedMessage}`;
|
||||
throw new Error(`${source}:\n\t${enhancedMessage}`);
|
||||
} else {
|
||||
throw new Error(enhancedMessage);
|
||||
}
|
||||
|
||||
const enhancedError = new Error(enhancedMessage, { cause: err });
|
||||
|
||||
if (err.code) {
|
||||
enhancedError.code = err.code;
|
||||
}
|
||||
|
||||
throw enhancedError;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -920,9 +815,8 @@ class ConfigValidator {
|
||||
* 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 {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded environments.
|
||||
* @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the environment is invalid.
|
||||
*/
|
||||
validateEnvironment(
|
||||
environment,
|
||||
@@ -950,7 +844,7 @@ class ConfigValidator {
|
||||
* 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 {(ruleId:string) => Object} getAdditionalRule A map from strings to loaded rules
|
||||
* @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules
|
||||
* @returns {void}
|
||||
*/
|
||||
validateRules(
|
||||
@@ -994,9 +888,8 @@ class ConfigValidator {
|
||||
* Validate `processor` configuration.
|
||||
* @param {string|undefined} processorName The processor name.
|
||||
* @param {string} source The name of config file.
|
||||
* @param {(id:string) => Processor} getProcessor The getter of defined processors.
|
||||
* @param {function(id:string): Processor} getProcessor The getter of defined processors.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the processor is invalid.
|
||||
*/
|
||||
validateProcessor(processorName, source, getProcessor) {
|
||||
if (processorName && !getProcessor(processorName)) {
|
||||
@@ -1035,7 +928,6 @@ class ConfigValidator {
|
||||
* @param {Object} config The config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the config is invalid.
|
||||
*/
|
||||
validateConfigSchema(config, source = null) {
|
||||
validateSchema = validateSchema || ajv.compile(configSchema);
|
||||
@@ -1044,7 +936,7 @@ class ConfigValidator {
|
||||
throw new Error(`ESLint configuration in ${source} is invalid:\n${this.formatErrors(validateSchema.errors)}`);
|
||||
}
|
||||
|
||||
if (Object.hasOwn(config, "ecmaFeatures")) {
|
||||
if (Object.hasOwnProperty.call(config, "ecmaFeatures")) {
|
||||
emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES");
|
||||
}
|
||||
}
|
||||
@@ -1053,8 +945,8 @@ class ConfigValidator {
|
||||
* 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 {(ruleId:string) => Object} [getAdditionalRule] A map from strings to loaded rules.
|
||||
* @param {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded envs.
|
||||
* @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) {
|
||||
|
||||
2
frontend/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map
generated
vendored
2
frontend/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map
generated
vendored
File diff suppressed because one or more lines are too long
250
frontend/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
generated
vendored
250
frontend/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
generated
vendored
@@ -3,18 +3,18 @@
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var debugOrig = require('debug');
|
||||
var fs = require('node:fs');
|
||||
var fs = require('fs');
|
||||
var importFresh = require('import-fresh');
|
||||
var Module = require('node:module');
|
||||
var path = require('node:path');
|
||||
var Module = require('module');
|
||||
var path = require('path');
|
||||
var stripComments = require('strip-json-comments');
|
||||
var assert = require('node:assert');
|
||||
var assert = require('assert');
|
||||
var ignore = require('ignore');
|
||||
var util = require('node:util');
|
||||
var util = require('util');
|
||||
var minimatch = require('minimatch');
|
||||
var Ajv = require('ajv');
|
||||
var globals = require('globals');
|
||||
var os = require('node:os');
|
||||
var os = require('os');
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
||||
|
||||
@@ -142,9 +142,6 @@ const DotPatterns = Object.freeze([".*", "!.eslintrc.*", "!../"]);
|
||||
// Public
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Represents a set of glob patterns to ignore against a base path.
|
||||
*/
|
||||
class IgnorePattern {
|
||||
|
||||
/**
|
||||
@@ -181,7 +178,9 @@ class IgnorePattern {
|
||||
debug$3("Create with: %o", ignorePatterns);
|
||||
|
||||
const basePath = getCommonAncestorPath(ignorePatterns.map(p => p.basePath));
|
||||
const patterns = ignorePatterns.flatMap(p => p.getPatternsRelativeTo(basePath));
|
||||
const patterns = [].concat(
|
||||
...ignorePatterns.map(p => p.getPatternsRelativeTo(basePath))
|
||||
);
|
||||
const ig = ignore__default["default"]({ allowRelativePaths: true }).add([...DotPatterns, ...patterns]);
|
||||
const dotIg = ignore__default["default"]({ allowRelativePaths: true }).add(patterns);
|
||||
|
||||
@@ -381,10 +380,10 @@ class ExtractedConfig {
|
||||
*/
|
||||
toCompatibleObjectAsConfigFileContent() {
|
||||
const {
|
||||
/* eslint-disable no-unused-vars -- needed to make `config` correct */
|
||||
/* eslint-disable no-unused-vars */
|
||||
configNameOfNoInlineConfig: _ignore1,
|
||||
processor: _ignore2,
|
||||
/* eslint-enable no-unused-vars -- needed to make `config` correct */
|
||||
/* eslint-enable no-unused-vars */
|
||||
ignores,
|
||||
...config
|
||||
} = this;
|
||||
@@ -576,7 +575,6 @@ class PluginConflictError extends Error {
|
||||
* @param {Record<string, DependentPlugin>} target The destination to merge
|
||||
* @param {Record<string, DependentPlugin>|undefined} source The source to merge.
|
||||
* @returns {void}
|
||||
* @throws {PluginConflictError} When a plugin was conflicted.
|
||||
*/
|
||||
function mergePlugins(target, source) {
|
||||
if (!isNonNullObject(source)) {
|
||||
@@ -657,7 +655,6 @@ function mergeRuleConfigs(target, source) {
|
||||
* @param {ConfigArray} instance The config elements.
|
||||
* @param {number[]} indices The indices to use.
|
||||
* @returns {ExtractedConfig} The extracted config.
|
||||
* @throws {Error} When a plugin is conflicted.
|
||||
*/
|
||||
function createConfig(instance, indices) {
|
||||
const config = new ExtractedConfig();
|
||||
@@ -719,18 +716,31 @@ function createConfig(instance, indices) {
|
||||
* @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) {
|
||||
function collect(pluginId, defs, map, normalize) {
|
||||
if (defs) {
|
||||
const prefix = pluginId && `${pluginId}/`;
|
||||
|
||||
for (const [key, value] of Object.entries(defs)) {
|
||||
map.set(`${prefix}${key}`, value);
|
||||
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.
|
||||
@@ -772,7 +782,7 @@ function initPluginMemberMaps(elements, slots) {
|
||||
|
||||
collect(pluginId, plugin.environments, slots.envMap);
|
||||
collect(pluginId, plugin.processors, slots.processorMap);
|
||||
collect(pluginId, plugin.rules, slots.ruleMap);
|
||||
collect(pluginId, plugin.rules, slots.ruleMap, normalizePluginRule);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -991,8 +1001,8 @@ class ConfigDependency {
|
||||
this.importerPath = importerPath;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* Converts this instance to a JSON compatible object.
|
||||
* @returns {Object} a JSON compatible object.
|
||||
*/
|
||||
toJSON() {
|
||||
@@ -1006,14 +1016,14 @@ class ConfigDependency {
|
||||
return obj;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* Custom inspect method for Node.js `console.log()`.
|
||||
* @returns {Object} an object to display by `console.log()`.
|
||||
*/
|
||||
[util__default["default"].inspect.custom]() {
|
||||
const {
|
||||
definition: _ignore1, // eslint-disable-line no-unused-vars -- needed to make `obj` correct
|
||||
original: _ignore2, // eslint-disable-line no-unused-vars -- needed to make `obj` correct
|
||||
definition: _ignore1, // eslint-disable-line no-unused-vars
|
||||
original: _ignore2, // eslint-disable-line no-unused-vars
|
||||
...obj
|
||||
} = this;
|
||||
|
||||
@@ -1112,7 +1122,6 @@ class OverrideTester {
|
||||
* @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`.
|
||||
* @throws {Error} When invalid patterns are given.
|
||||
*/
|
||||
static create(files, excludedFiles, basePath) {
|
||||
const includePatterns = normalizePatterns(files);
|
||||
@@ -1202,7 +1211,6 @@ class OverrideTester {
|
||||
* 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.
|
||||
* @throws {Error} When invalid `filePath` is given.
|
||||
*/
|
||||
test(filePath) {
|
||||
if (typeof filePath !== "string" || !path__default["default"].isAbsolute(filePath)) {
|
||||
@@ -1216,8 +1224,8 @@ class OverrideTester {
|
||||
));
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* Converts this instance to a JSON compatible object.
|
||||
* @returns {Object} a JSON compatible object.
|
||||
*/
|
||||
toJSON() {
|
||||
@@ -1233,8 +1241,8 @@ class OverrideTester {
|
||||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* Custom inspect method for Node.js `console.log()`.
|
||||
* @returns {Object} an object to display by `console.log()`.
|
||||
*/
|
||||
[util__default["default"].inspect.custom]() {
|
||||
@@ -1262,7 +1270,7 @@ const RULE_SEVERITY_STRINGS = ["off", "warn", "error"],
|
||||
map[value] = index;
|
||||
return map;
|
||||
}, {}),
|
||||
VALID_SEVERITIES = new Set([0, 1, 2, "off", "warn", "error"]);
|
||||
VALID_SEVERITIES = [0, 1, 2, "off", "warn", "error"];
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
@@ -1332,7 +1340,7 @@ function isValidSeverity(ruleConfig) {
|
||||
if (typeof severity === "string") {
|
||||
severity = severity.toLowerCase();
|
||||
}
|
||||
return VALID_SEVERITIES.has(severity);
|
||||
return VALID_SEVERITIES.indexOf(severity) !== -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1614,69 +1622,12 @@ var ajvOrig = (additionalOptions = {}) => {
|
||||
});
|
||||
|
||||
ajv.addMetaSchema(metaSchema);
|
||||
// eslint-disable-next-line no-underscore-dangle -- part of the API
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
ajv._opts.defaultMeta = metaSchema.id;
|
||||
|
||||
return ajv;
|
||||
};
|
||||
|
||||
/**
|
||||
* @fileoverview Applies default rule options
|
||||
* @author JoshuaKGoldberg
|
||||
*/
|
||||
|
||||
/**
|
||||
* Check if the variable contains an object strictly rejecting arrays
|
||||
* @param {unknown} value an object
|
||||
* @returns {boolean} Whether value is an object
|
||||
*/
|
||||
function isObjectNotArray(value) {
|
||||
return typeof value === "object" && value !== null && !Array.isArray(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deeply merges second on top of first, creating a new {} object if needed.
|
||||
* @param {T} first Base, default value.
|
||||
* @param {U} second User-specified value.
|
||||
* @returns {T | U | (T & U)} Merged equivalent of second on top of first.
|
||||
*/
|
||||
function deepMergeObjects(first, second) {
|
||||
if (second === void 0) {
|
||||
return first;
|
||||
}
|
||||
|
||||
if (!isObjectNotArray(first) || !isObjectNotArray(second)) {
|
||||
return second;
|
||||
}
|
||||
|
||||
const result = { ...first, ...second };
|
||||
|
||||
for (const key of Object.keys(second)) {
|
||||
if (Object.prototype.propertyIsEnumerable.call(first, key)) {
|
||||
result[key] = deepMergeObjects(first[key], second[key]);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deeply merges second on top of first, creating a new [] array if needed.
|
||||
* @param {T[] | undefined} first Base, default values.
|
||||
* @param {U[] | undefined} second User-specified values.
|
||||
* @returns {(T | U | (T & U))[]} Merged equivalent of second on top of first.
|
||||
*/
|
||||
function deepMergeArrays(first, second) {
|
||||
if (!first || !second) {
|
||||
return second || first || [];
|
||||
}
|
||||
|
||||
return [
|
||||
...first.map((value, i) => deepMergeObjects(value, second[i])),
|
||||
...second.slice(first.length)
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @fileoverview Defines a schema for configs.
|
||||
* @author Sylvan Mably
|
||||
@@ -1774,7 +1725,7 @@ function getDiff(current, prev) {
|
||||
const retv = {};
|
||||
|
||||
for (const [key, value] of Object.entries(current)) {
|
||||
if (!Object.hasOwn(prev, key)) {
|
||||
if (!Object.hasOwnProperty.call(prev, key)) {
|
||||
retv[key] = value;
|
||||
}
|
||||
}
|
||||
@@ -1987,20 +1938,10 @@ const severityMap = {
|
||||
|
||||
const validated = new WeakSet();
|
||||
|
||||
// JSON schema that disallows passing any options
|
||||
const noOptionsSchema = Object.freeze({
|
||||
type: "array",
|
||||
minItems: 0,
|
||||
maxItems: 0
|
||||
});
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Validator for configuration objects.
|
||||
*/
|
||||
class ConfigValidator {
|
||||
constructor({ builtInRules = new Map() } = {}) {
|
||||
this.builtInRules = builtInRules;
|
||||
@@ -2008,36 +1949,17 @@ class ConfigValidator {
|
||||
|
||||
/**
|
||||
* Gets a complete options schema for a rule.
|
||||
* @param {Rule} rule A rule object
|
||||
* @throws {TypeError} If `meta.schema` is specified but is not an array, object or `false`.
|
||||
* @returns {Object|null} JSON Schema for the rule's options.
|
||||
* `null` if rule wasn't passed or its `meta.schema` is `false`.
|
||||
* @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;
|
||||
}
|
||||
|
||||
if (!rule.meta) {
|
||||
return { ...noOptionsSchema }; // default if `meta.schema` is not specified
|
||||
}
|
||||
const schema = rule.schema || rule.meta && rule.meta.schema;
|
||||
|
||||
const schema = rule.meta.schema;
|
||||
|
||||
if (typeof schema === "undefined") {
|
||||
return { ...noOptionsSchema }; // default if `meta.schema` is not specified
|
||||
}
|
||||
|
||||
// `schema:false` is an allowed explicit opt-out of options validation for the rule
|
||||
if (schema === false) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (typeof schema !== "object" || schema === null) {
|
||||
throw new TypeError("Rule's `meta.schema` must be an array or object");
|
||||
}
|
||||
|
||||
// ESLint-specific array form needs to be converted into a valid JSON Schema definition
|
||||
// Given a tuple of schemas, insert warning level at the beginning
|
||||
if (Array.isArray(schema)) {
|
||||
if (schema.length) {
|
||||
return {
|
||||
@@ -2047,20 +1969,22 @@ class ConfigValidator {
|
||||
maxItems: schema.length
|
||||
};
|
||||
}
|
||||
return {
|
||||
type: "array",
|
||||
minItems: 0,
|
||||
maxItems: 0
|
||||
};
|
||||
|
||||
// `schema:[]` is an explicit way to specify that the rule does not accept any options
|
||||
return { ...noOptionsSchema };
|
||||
}
|
||||
|
||||
// `schema:<object>` is assumed to be a valid JSON Schema definition
|
||||
return schema;
|
||||
// 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
|
||||
* @throws {Error} If the severity is invalid.
|
||||
*/
|
||||
validateRuleSeverity(options) {
|
||||
const severity = Array.isArray(options) ? options[0] : options;
|
||||
@@ -2079,32 +2003,20 @@ class ConfigValidator {
|
||||
* @param {{create: Function}} rule The rule to validate
|
||||
* @param {Array} localOptions The options for the rule, excluding severity
|
||||
* @returns {void}
|
||||
* @throws {Error} If the options are invalid.
|
||||
*/
|
||||
validateRuleSchema(rule, localOptions) {
|
||||
if (!ruleValidators.has(rule)) {
|
||||
try {
|
||||
const schema = this.getRuleOptionsSchema(rule);
|
||||
const schema = this.getRuleOptionsSchema(rule);
|
||||
|
||||
if (schema) {
|
||||
ruleValidators.set(rule, ajv.compile(schema));
|
||||
}
|
||||
} catch (err) {
|
||||
const errorWithCode = new Error(err.message, { cause: err });
|
||||
|
||||
errorWithCode.code = "ESLINT_INVALID_RULE_OPTIONS_SCHEMA";
|
||||
|
||||
throw errorWithCode;
|
||||
if (schema) {
|
||||
ruleValidators.set(rule, ajv.compile(schema));
|
||||
}
|
||||
}
|
||||
|
||||
const validateRule = ruleValidators.get(rule);
|
||||
|
||||
if (validateRule) {
|
||||
const mergedOptions = deepMergeArrays(rule.meta?.defaultOptions, localOptions);
|
||||
|
||||
validateRule(mergedOptions);
|
||||
|
||||
validateRule(localOptions);
|
||||
if (validateRule.errors) {
|
||||
throw new Error(validateRule.errors.map(
|
||||
error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n`
|
||||
@@ -2121,7 +2033,6 @@ class ConfigValidator {
|
||||
* @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}
|
||||
* @throws {Error} If the options are invalid.
|
||||
*/
|
||||
validateRuleOptions(rule, ruleId, options, source = null) {
|
||||
try {
|
||||
@@ -2131,21 +2042,13 @@ class ConfigValidator {
|
||||
this.validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []);
|
||||
}
|
||||
} catch (err) {
|
||||
let enhancedMessage = err.code === "ESLINT_INVALID_RULE_OPTIONS_SCHEMA"
|
||||
? `Error while processing options validation schema of rule '${ruleId}': ${err.message}`
|
||||
: `Configuration for rule "${ruleId}" is invalid:\n${err.message}`;
|
||||
const enhancedMessage = `Configuration for rule "${ruleId}" is invalid:\n${err.message}`;
|
||||
|
||||
if (typeof source === "string") {
|
||||
enhancedMessage = `${source}:\n\t${enhancedMessage}`;
|
||||
throw new Error(`${source}:\n\t${enhancedMessage}`);
|
||||
} else {
|
||||
throw new Error(enhancedMessage);
|
||||
}
|
||||
|
||||
const enhancedError = new Error(enhancedMessage, { cause: err });
|
||||
|
||||
if (err.code) {
|
||||
enhancedError.code = err.code;
|
||||
}
|
||||
|
||||
throw enhancedError;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2153,9 +2056,8 @@ class ConfigValidator {
|
||||
* 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 {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded environments.
|
||||
* @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the environment is invalid.
|
||||
*/
|
||||
validateEnvironment(
|
||||
environment,
|
||||
@@ -2183,7 +2085,7 @@ class ConfigValidator {
|
||||
* 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 {(ruleId:string) => Object} getAdditionalRule A map from strings to loaded rules
|
||||
* @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules
|
||||
* @returns {void}
|
||||
*/
|
||||
validateRules(
|
||||
@@ -2227,9 +2129,8 @@ class ConfigValidator {
|
||||
* Validate `processor` configuration.
|
||||
* @param {string|undefined} processorName The processor name.
|
||||
* @param {string} source The name of config file.
|
||||
* @param {(id:string) => Processor} getProcessor The getter of defined processors.
|
||||
* @param {function(id:string): Processor} getProcessor The getter of defined processors.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the processor is invalid.
|
||||
*/
|
||||
validateProcessor(processorName, source, getProcessor) {
|
||||
if (processorName && !getProcessor(processorName)) {
|
||||
@@ -2268,7 +2169,6 @@ class ConfigValidator {
|
||||
* @param {Object} config The config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the config is invalid.
|
||||
*/
|
||||
validateConfigSchema(config, source = null) {
|
||||
validateSchema = validateSchema || ajv.compile(configSchema);
|
||||
@@ -2277,7 +2177,7 @@ class ConfigValidator {
|
||||
throw new Error(`ESLint configuration in ${source} is invalid:\n${this.formatErrors(validateSchema.errors)}`);
|
||||
}
|
||||
|
||||
if (Object.hasOwn(config, "ecmaFeatures")) {
|
||||
if (Object.hasOwnProperty.call(config, "ecmaFeatures")) {
|
||||
emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES");
|
||||
}
|
||||
}
|
||||
@@ -2286,8 +2186,8 @@ class ConfigValidator {
|
||||
* 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 {(ruleId:string) => Object} [getAdditionalRule] A map from strings to loaded rules.
|
||||
* @param {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded envs.
|
||||
* @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) {
|
||||
@@ -2440,7 +2340,6 @@ const createRequire = Module__default["default"].createRequire;
|
||||
* @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`
|
||||
* @throws {Error} When the module cannot be resolved.
|
||||
*/
|
||||
function resolve(moduleName, relativeToPath) {
|
||||
try {
|
||||
@@ -2701,7 +2600,7 @@ function loadPackageJSONConfigFile(filePath) {
|
||||
try {
|
||||
const packageData = loadJSONConfigFile(filePath);
|
||||
|
||||
if (!Object.hasOwn(packageData, "eslintConfig")) {
|
||||
if (!Object.hasOwnProperty.call(packageData, "eslintConfig")) {
|
||||
throw Object.assign(
|
||||
new Error("package.json file doesn't have 'eslintConfig' field."),
|
||||
{ code: "ESLINT_CONFIG_FIELD_NOT_FOUND" }
|
||||
@@ -2720,7 +2619,6 @@ function loadPackageJSONConfigFile(filePath) {
|
||||
* Loads a `.eslintignore` from a file.
|
||||
* @param {string} filePath The filename to load.
|
||||
* @returns {string[]} The ignore patterns from the file.
|
||||
* @throws {Error} If the file cannot be read.
|
||||
* @private
|
||||
*/
|
||||
function loadESLintIgnoreFile(filePath) {
|
||||
@@ -2793,7 +2691,7 @@ function loadConfigFile(filePath) {
|
||||
function writeDebugLogForLoading(request, relativeTo, filePath) {
|
||||
/* istanbul ignore next */
|
||||
if (debug$2.enabled) {
|
||||
let nameAndVersion = null; // eslint-disable-line no-useless-assignment -- known bug in the rule
|
||||
let nameAndVersion = null;
|
||||
|
||||
try {
|
||||
const packageJsonPath = resolve(
|
||||
@@ -2958,7 +2856,6 @@ class ConfigArrayFactory {
|
||||
* @param {Object} [options] The options.
|
||||
* @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.
|
||||
* @param {string} [options.name] The config name.
|
||||
* @throws {Error} If the config file is invalid.
|
||||
* @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.
|
||||
*/
|
||||
loadInDirectory(directoryPath, { basePath, name } = {}) {
|
||||
@@ -3044,7 +2941,6 @@ class ConfigArrayFactory {
|
||||
/**
|
||||
* Load `.eslintignore` file in the current working directory.
|
||||
* @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.
|
||||
* @throws {Error} If the ignore file is invalid.
|
||||
*/
|
||||
loadDefaultESLintIgnore() {
|
||||
const slots = internalSlotsMap$1.get(this);
|
||||
@@ -3057,7 +2953,7 @@ class ConfigArrayFactory {
|
||||
if (fs__default["default"].existsSync(packageJsonPath)) {
|
||||
const data = loadJSONConfigFile(packageJsonPath);
|
||||
|
||||
if (Object.hasOwn(data, "eslintIgnore")) {
|
||||
if (Object.hasOwnProperty.call(data, "eslintIgnore")) {
|
||||
if (!Array.isArray(data.eslintIgnore)) {
|
||||
throw new Error("Package.json eslintIgnore property requires an array of paths");
|
||||
}
|
||||
@@ -3246,7 +3142,6 @@ class ConfigArrayFactory {
|
||||
* @param {string} extendName The name of a base config.
|
||||
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
|
||||
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
|
||||
* @throws {Error} If the extended config file can't be loaded.
|
||||
* @private
|
||||
*/
|
||||
_loadExtends(extendName, ctx) {
|
||||
@@ -3270,7 +3165,6 @@ class ConfigArrayFactory {
|
||||
* @param {string} extendName The name of a base config.
|
||||
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
|
||||
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
|
||||
* @throws {Error} If the extended config file can't be loaded.
|
||||
* @private
|
||||
*/
|
||||
_loadExtendedBuiltInConfig(extendName, ctx) {
|
||||
@@ -3320,7 +3214,6 @@ class ConfigArrayFactory {
|
||||
* @param {string} extendName The name of a base config.
|
||||
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
|
||||
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
|
||||
* @throws {Error} If the extended config file can't be loaded.
|
||||
* @private
|
||||
*/
|
||||
_loadExtendedPluginConfig(extendName, ctx) {
|
||||
@@ -3358,7 +3251,6 @@ class ConfigArrayFactory {
|
||||
* @param {string} extendName The name of a base config.
|
||||
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
|
||||
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
|
||||
* @throws {Error} If the extended config file can't be loaded.
|
||||
* @private
|
||||
*/
|
||||
_loadExtendedShareableConfig(extendName, ctx) {
|
||||
@@ -3780,7 +3672,7 @@ function createCLIConfigArray({
|
||||
*/
|
||||
class ConfigurationNotFoundError extends Error {
|
||||
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* @param {string} directoryPath The directory path.
|
||||
*/
|
||||
@@ -3932,7 +3824,6 @@ class CascadingConfigArrayFactory {
|
||||
* @param {string} directoryPath The path to a leaf directory.
|
||||
* @param {boolean} configsExistInSubdirs `true` if configurations exist in subdirectories.
|
||||
* @returns {ConfigArray} The loaded config.
|
||||
* @throws {Error} If a config file is invalid.
|
||||
* @private
|
||||
*/
|
||||
_loadConfigInAncestors(directoryPath, configsExistInSubdirs = false) {
|
||||
@@ -4034,7 +3925,6 @@ class CascadingConfigArrayFactory {
|
||||
* @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.
|
||||
* @throws {Error} If a config file is invalid.
|
||||
* @private
|
||||
*/
|
||||
_finalizeConfigArray(configArray, directoryPath, ignoreNotFoundError) {
|
||||
@@ -4071,7 +3961,7 @@ class CascadingConfigArrayFactory {
|
||||
!directoryPath.startsWith(homePath)
|
||||
) {
|
||||
const lastElement =
|
||||
personalConfigArray.at(-1);
|
||||
personalConfigArray[personalConfigArray.length - 1];
|
||||
|
||||
emitDeprecationWarning(
|
||||
lastElement.filePath,
|
||||
@@ -4143,7 +4033,6 @@ const cafactory = Symbol("cafactory");
|
||||
* @param {ReadOnlyMap<string,Processor>} options.pluginProcessors A map of plugin processor
|
||||
* names to objects.
|
||||
* @returns {Object} A flag-config-style config object.
|
||||
* @throws {Error} If a plugin or environment cannot be resolved.
|
||||
*/
|
||||
function translateESLintRC(eslintrcConfig, {
|
||||
resolveConfigRelativeTo,
|
||||
@@ -4326,7 +4215,7 @@ class FlatCompat {
|
||||
this[cafactory] = new ConfigArrayFactory({
|
||||
cwd: baseDirectory,
|
||||
resolvePluginsRelativeTo,
|
||||
getEslintAllConfig() {
|
||||
getEslintAllConfig: () => {
|
||||
|
||||
if (!allConfig) {
|
||||
throw new TypeError("Missing parameter 'allConfig' in FlatCompat constructor.");
|
||||
@@ -4334,7 +4223,7 @@ class FlatCompat {
|
||||
|
||||
return allConfig;
|
||||
},
|
||||
getEslintRecommendedConfig() {
|
||||
getEslintRecommendedConfig: () => {
|
||||
|
||||
if (!recommendedConfig) {
|
||||
throw new TypeError("Missing parameter 'recommendedConfig' in FlatCompat constructor.");
|
||||
@@ -4442,7 +4331,6 @@ const Legacy = {
|
||||
OverrideTester,
|
||||
getUsedExtractedConfigs,
|
||||
environments,
|
||||
loadConfigFile,
|
||||
|
||||
// shared
|
||||
ConfigOps,
|
||||
|
||||
2
frontend/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map
generated
vendored
2
frontend/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map
generated
vendored
File diff suppressed because one or more lines are too long
76
frontend/node_modules/@eslint/eslintrc/dist/eslintrc.d.cts
generated
vendored
76
frontend/node_modules/@eslint/eslintrc/dist/eslintrc.d.cts
generated
vendored
@@ -1,76 +0,0 @@
|
||||
/**
|
||||
* @fileoverview This file contains the core types for ESLint. It was initially extracted
|
||||
* from the `@types/eslint__eslintrc` package.
|
||||
*/
|
||||
|
||||
/*
|
||||
* MIT License
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
import type { Linter } from "eslint";
|
||||
|
||||
/**
|
||||
* A compatibility class for working with configs.
|
||||
*/
|
||||
export class FlatCompat {
|
||||
constructor({
|
||||
baseDirectory,
|
||||
resolvePluginsRelativeTo,
|
||||
recommendedConfig,
|
||||
allConfig,
|
||||
}?: {
|
||||
/**
|
||||
* default: process.cwd()
|
||||
*/
|
||||
baseDirectory?: string;
|
||||
resolvePluginsRelativeTo?: string;
|
||||
recommendedConfig?: Linter.LegacyConfig;
|
||||
allConfig?: Linter.LegacyConfig;
|
||||
});
|
||||
|
||||
/**
|
||||
* Translates an ESLintRC-style config into a flag-config-style config.
|
||||
* @param eslintrcConfig The ESLintRC-style config object.
|
||||
* @returns A flag-config-style config object.
|
||||
*/
|
||||
config(eslintrcConfig: Linter.LegacyConfig): Linter.Config[];
|
||||
|
||||
/**
|
||||
* Translates the `env` section of an ESLintRC-style config.
|
||||
* @param envConfig The `env` section of an ESLintRC config.
|
||||
* @returns An array of flag-config objects representing the environments.
|
||||
*/
|
||||
env(envConfig: { [name: string]: boolean }): Linter.Config[];
|
||||
|
||||
/**
|
||||
* Translates the `extends` section of an ESLintRC-style config.
|
||||
* @param configsToExtend The names of the configs to load.
|
||||
* @returns An array of flag-config objects representing the config.
|
||||
*/
|
||||
extends(...configsToExtend: string[]): Linter.Config[];
|
||||
|
||||
/**
|
||||
* Translates the `plugins` section of an ESLintRC-style config.
|
||||
* @param plugins The names of the plugins to load.
|
||||
* @returns An array of flag-config objects representing the plugins.
|
||||
*/
|
||||
plugins(...plugins: string[]): Linter.Config[];
|
||||
}
|
||||
10
frontend/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js
generated
vendored
10
frontend/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js
generated
vendored
@@ -23,8 +23,8 @@
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
import debugOrig from "debug";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
|
||||
import { ConfigArrayFactory } from "./config-array-factory.js";
|
||||
import {
|
||||
@@ -193,7 +193,7 @@ function createCLIConfigArray({
|
||||
*/
|
||||
class ConfigurationNotFoundError extends Error {
|
||||
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* @param {string} directoryPath The directory path.
|
||||
*/
|
||||
@@ -345,7 +345,6 @@ class CascadingConfigArrayFactory {
|
||||
* @param {string} directoryPath The path to a leaf directory.
|
||||
* @param {boolean} configsExistInSubdirs `true` if configurations exist in subdirectories.
|
||||
* @returns {ConfigArray} The loaded config.
|
||||
* @throws {Error} If a config file is invalid.
|
||||
* @private
|
||||
*/
|
||||
_loadConfigInAncestors(directoryPath, configsExistInSubdirs = false) {
|
||||
@@ -447,7 +446,6 @@ class CascadingConfigArrayFactory {
|
||||
* @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.
|
||||
* @throws {Error} If a config file is invalid.
|
||||
* @private
|
||||
*/
|
||||
_finalizeConfigArray(configArray, directoryPath, ignoreNotFoundError) {
|
||||
@@ -484,7 +482,7 @@ class CascadingConfigArrayFactory {
|
||||
!directoryPath.startsWith(homePath)
|
||||
) {
|
||||
const lastElement =
|
||||
personalConfigArray.at(-1);
|
||||
personalConfigArray[personalConfigArray.length - 1];
|
||||
|
||||
emitDeprecationWarning(
|
||||
lastElement.filePath,
|
||||
|
||||
25
frontend/node_modules/@eslint/eslintrc/lib/config-array-factory.js
generated
vendored
25
frontend/node_modules/@eslint/eslintrc/lib/config-array-factory.js
generated
vendored
@@ -39,10 +39,10 @@
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
import debugOrig from "debug";
|
||||
import fs from "node:fs";
|
||||
import fs from "fs";
|
||||
import importFresh from "import-fresh";
|
||||
import { createRequire } from "node:module";
|
||||
import path from "node:path";
|
||||
import { createRequire } from "module";
|
||||
import path from "path";
|
||||
import stripComments from "strip-json-comments";
|
||||
|
||||
import {
|
||||
@@ -254,7 +254,7 @@ function loadPackageJSONConfigFile(filePath) {
|
||||
try {
|
||||
const packageData = loadJSONConfigFile(filePath);
|
||||
|
||||
if (!Object.hasOwn(packageData, "eslintConfig")) {
|
||||
if (!Object.hasOwnProperty.call(packageData, "eslintConfig")) {
|
||||
throw Object.assign(
|
||||
new Error("package.json file doesn't have 'eslintConfig' field."),
|
||||
{ code: "ESLINT_CONFIG_FIELD_NOT_FOUND" }
|
||||
@@ -273,7 +273,6 @@ function loadPackageJSONConfigFile(filePath) {
|
||||
* Loads a `.eslintignore` from a file.
|
||||
* @param {string} filePath The filename to load.
|
||||
* @returns {string[]} The ignore patterns from the file.
|
||||
* @throws {Error} If the file cannot be read.
|
||||
* @private
|
||||
*/
|
||||
function loadESLintIgnoreFile(filePath) {
|
||||
@@ -346,7 +345,7 @@ function loadConfigFile(filePath) {
|
||||
function writeDebugLogForLoading(request, relativeTo, filePath) {
|
||||
/* istanbul ignore next */
|
||||
if (debug.enabled) {
|
||||
let nameAndVersion = null; // eslint-disable-line no-useless-assignment -- known bug in the rule
|
||||
let nameAndVersion = null;
|
||||
|
||||
try {
|
||||
const packageJsonPath = ModuleResolver.resolve(
|
||||
@@ -511,7 +510,6 @@ class ConfigArrayFactory {
|
||||
* @param {Object} [options] The options.
|
||||
* @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.
|
||||
* @param {string} [options.name] The config name.
|
||||
* @throws {Error} If the config file is invalid.
|
||||
* @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.
|
||||
*/
|
||||
loadInDirectory(directoryPath, { basePath, name } = {}) {
|
||||
@@ -597,7 +595,6 @@ class ConfigArrayFactory {
|
||||
/**
|
||||
* Load `.eslintignore` file in the current working directory.
|
||||
* @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.
|
||||
* @throws {Error} If the ignore file is invalid.
|
||||
*/
|
||||
loadDefaultESLintIgnore() {
|
||||
const slots = internalSlotsMap.get(this);
|
||||
@@ -610,7 +607,7 @@ class ConfigArrayFactory {
|
||||
if (fs.existsSync(packageJsonPath)) {
|
||||
const data = loadJSONConfigFile(packageJsonPath);
|
||||
|
||||
if (Object.hasOwn(data, "eslintIgnore")) {
|
||||
if (Object.hasOwnProperty.call(data, "eslintIgnore")) {
|
||||
if (!Array.isArray(data.eslintIgnore)) {
|
||||
throw new Error("Package.json eslintIgnore property requires an array of paths");
|
||||
}
|
||||
@@ -799,7 +796,6 @@ class ConfigArrayFactory {
|
||||
* @param {string} extendName The name of a base config.
|
||||
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
|
||||
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
|
||||
* @throws {Error} If the extended config file can't be loaded.
|
||||
* @private
|
||||
*/
|
||||
_loadExtends(extendName, ctx) {
|
||||
@@ -823,7 +819,6 @@ class ConfigArrayFactory {
|
||||
* @param {string} extendName The name of a base config.
|
||||
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
|
||||
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
|
||||
* @throws {Error} If the extended config file can't be loaded.
|
||||
* @private
|
||||
*/
|
||||
_loadExtendedBuiltInConfig(extendName, ctx) {
|
||||
@@ -873,7 +868,6 @@ class ConfigArrayFactory {
|
||||
* @param {string} extendName The name of a base config.
|
||||
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
|
||||
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
|
||||
* @throws {Error} If the extended config file can't be loaded.
|
||||
* @private
|
||||
*/
|
||||
_loadExtendedPluginConfig(extendName, ctx) {
|
||||
@@ -911,7 +905,6 @@ class ConfigArrayFactory {
|
||||
* @param {string} extendName The name of a base config.
|
||||
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
|
||||
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
|
||||
* @throws {Error} If the extended config file can't be loaded.
|
||||
* @private
|
||||
*/
|
||||
_loadExtendedShareableConfig(extendName, ctx) {
|
||||
@@ -1155,8 +1148,4 @@ class ConfigArrayFactory {
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
ConfigArrayFactory,
|
||||
createContext,
|
||||
loadConfigFile
|
||||
};
|
||||
export { ConfigArrayFactory, createContext };
|
||||
|
||||
21
frontend/node_modules/@eslint/eslintrc/lib/config-array/config-array.js
generated
vendored
21
frontend/node_modules/@eslint/eslintrc/lib/config-array/config-array.js
generated
vendored
@@ -178,7 +178,6 @@ class PluginConflictError extends Error {
|
||||
* @param {Record<string, DependentPlugin>} target The destination to merge
|
||||
* @param {Record<string, DependentPlugin>|undefined} source The source to merge.
|
||||
* @returns {void}
|
||||
* @throws {PluginConflictError} When a plugin was conflicted.
|
||||
*/
|
||||
function mergePlugins(target, source) {
|
||||
if (!isNonNullObject(source)) {
|
||||
@@ -259,7 +258,6 @@ function mergeRuleConfigs(target, source) {
|
||||
* @param {ConfigArray} instance The config elements.
|
||||
* @param {number[]} indices The indices to use.
|
||||
* @returns {ExtractedConfig} The extracted config.
|
||||
* @throws {Error} When a plugin is conflicted.
|
||||
*/
|
||||
function createConfig(instance, indices) {
|
||||
const config = new ExtractedConfig();
|
||||
@@ -321,18 +319,31 @@ function createConfig(instance, indices) {
|
||||
* @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) {
|
||||
function collect(pluginId, defs, map, normalize) {
|
||||
if (defs) {
|
||||
const prefix = pluginId && `${pluginId}/`;
|
||||
|
||||
for (const [key, value] of Object.entries(defs)) {
|
||||
map.set(`${prefix}${key}`, value);
|
||||
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.
|
||||
@@ -374,7 +385,7 @@ function initPluginMemberMaps(elements, slots) {
|
||||
|
||||
collect(pluginId, plugin.environments, slots.envMap);
|
||||
collect(pluginId, plugin.processors, slots.processorMap);
|
||||
collect(pluginId, plugin.rules, slots.ruleMap);
|
||||
collect(pluginId, plugin.rules, slots.ruleMap, normalizePluginRule);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
10
frontend/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js
generated
vendored
10
frontend/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js
generated
vendored
@@ -15,7 +15,7 @@
|
||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||
*/
|
||||
|
||||
import util from "node:util";
|
||||
import util from "util";
|
||||
|
||||
/**
|
||||
* The class is to store parsers or plugins.
|
||||
@@ -88,8 +88,8 @@ class ConfigDependency {
|
||||
this.importerPath = importerPath;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* Converts this instance to a JSON compatible object.
|
||||
* @returns {Object} a JSON compatible object.
|
||||
*/
|
||||
toJSON() {
|
||||
@@ -103,14 +103,14 @@ class ConfigDependency {
|
||||
return obj;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* Custom inspect method for Node.js `console.log()`.
|
||||
* @returns {Object} an object to display by `console.log()`.
|
||||
*/
|
||||
[util.inspect.custom]() {
|
||||
const {
|
||||
definition: _ignore1, // eslint-disable-line no-unused-vars -- needed to make `obj` correct
|
||||
original: _ignore2, // eslint-disable-line no-unused-vars -- needed to make `obj` correct
|
||||
definition: _ignore1, // eslint-disable-line no-unused-vars
|
||||
original: _ignore2, // eslint-disable-line no-unused-vars
|
||||
...obj
|
||||
} = this;
|
||||
|
||||
|
||||
4
frontend/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js
generated
vendored
4
frontend/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js
generated
vendored
@@ -120,10 +120,10 @@ class ExtractedConfig {
|
||||
*/
|
||||
toCompatibleObjectAsConfigFileContent() {
|
||||
const {
|
||||
/* eslint-disable no-unused-vars -- needed to make `config` correct */
|
||||
/* eslint-disable no-unused-vars */
|
||||
configNameOfNoInlineConfig: _ignore1,
|
||||
processor: _ignore2,
|
||||
/* eslint-enable no-unused-vars -- needed to make `config` correct */
|
||||
/* eslint-enable no-unused-vars */
|
||||
ignores,
|
||||
...config
|
||||
} = this;
|
||||
|
||||
11
frontend/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js
generated
vendored
11
frontend/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js
generated
vendored
@@ -32,8 +32,8 @@
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
import assert from "node:assert";
|
||||
import path from "node:path";
|
||||
import assert from "assert";
|
||||
import path from "path";
|
||||
import ignore from "ignore";
|
||||
import debugOrig from "debug";
|
||||
|
||||
@@ -117,9 +117,6 @@ const DotPatterns = Object.freeze([".*", "!.eslintrc.*", "!../"]);
|
||||
// Public
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Represents a set of glob patterns to ignore against a base path.
|
||||
*/
|
||||
class IgnorePattern {
|
||||
|
||||
/**
|
||||
@@ -156,7 +153,9 @@ class IgnorePattern {
|
||||
debug("Create with: %o", ignorePatterns);
|
||||
|
||||
const basePath = getCommonAncestorPath(ignorePatterns.map(p => p.basePath));
|
||||
const patterns = ignorePatterns.flatMap(p => p.getPatternsRelativeTo(basePath));
|
||||
const patterns = [].concat(
|
||||
...ignorePatterns.map(p => p.getPatternsRelativeTo(basePath))
|
||||
);
|
||||
const ig = ignore({ allowRelativePaths: true }).add([...DotPatterns, ...patterns]);
|
||||
const dotIg = ignore({ allowRelativePaths: true }).add(patterns);
|
||||
|
||||
|
||||
12
frontend/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js
generated
vendored
12
frontend/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js
generated
vendored
@@ -17,9 +17,9 @@
|
||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||
*/
|
||||
|
||||
import assert from "node:assert";
|
||||
import path from "node:path";
|
||||
import util from "node:util";
|
||||
import assert from "assert";
|
||||
import path from "path";
|
||||
import util from "util";
|
||||
import minimatch from "minimatch";
|
||||
|
||||
const { Minimatch } = minimatch;
|
||||
@@ -94,7 +94,6 @@ class OverrideTester {
|
||||
* @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`.
|
||||
* @throws {Error} When invalid patterns are given.
|
||||
*/
|
||||
static create(files, excludedFiles, basePath) {
|
||||
const includePatterns = normalizePatterns(files);
|
||||
@@ -184,7 +183,6 @@ class OverrideTester {
|
||||
* 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.
|
||||
* @throws {Error} When invalid `filePath` is given.
|
||||
*/
|
||||
test(filePath) {
|
||||
if (typeof filePath !== "string" || !path.isAbsolute(filePath)) {
|
||||
@@ -198,8 +196,8 @@ class OverrideTester {
|
||||
));
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* Converts this instance to a JSON compatible object.
|
||||
* @returns {Object} a JSON compatible object.
|
||||
*/
|
||||
toJSON() {
|
||||
@@ -215,8 +213,8 @@ class OverrideTester {
|
||||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* Custom inspect method for Node.js `console.log()`.
|
||||
* @returns {Object} an object to display by `console.log()`.
|
||||
*/
|
||||
[util.inspect.custom]() {
|
||||
|
||||
7
frontend/node_modules/@eslint/eslintrc/lib/flat-compat.js
generated
vendored
7
frontend/node_modules/@eslint/eslintrc/lib/flat-compat.js
generated
vendored
@@ -8,7 +8,7 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
import createDebug from "debug";
|
||||
import path from "node:path";
|
||||
import path from "path";
|
||||
|
||||
import environments from "../conf/environments.js";
|
||||
import { ConfigArrayFactory } from "./config-array-factory.js";
|
||||
@@ -37,7 +37,6 @@ const cafactory = Symbol("cafactory");
|
||||
* @param {ReadOnlyMap<string,Processor>} options.pluginProcessors A map of plugin processor
|
||||
* names to objects.
|
||||
* @returns {Object} A flag-config-style config object.
|
||||
* @throws {Error} If a plugin or environment cannot be resolved.
|
||||
*/
|
||||
function translateESLintRC(eslintrcConfig, {
|
||||
resolveConfigRelativeTo,
|
||||
@@ -220,7 +219,7 @@ class FlatCompat {
|
||||
this[cafactory] = new ConfigArrayFactory({
|
||||
cwd: baseDirectory,
|
||||
resolvePluginsRelativeTo,
|
||||
getEslintAllConfig() {
|
||||
getEslintAllConfig: () => {
|
||||
|
||||
if (!allConfig) {
|
||||
throw new TypeError("Missing parameter 'allConfig' in FlatCompat constructor.");
|
||||
@@ -228,7 +227,7 @@ class FlatCompat {
|
||||
|
||||
return allConfig;
|
||||
},
|
||||
getEslintRecommendedConfig() {
|
||||
getEslintRecommendedConfig: () => {
|
||||
|
||||
if (!recommendedConfig) {
|
||||
throw new TypeError("Missing parameter 'recommendedConfig' in FlatCompat constructor.");
|
||||
|
||||
4
frontend/node_modules/@eslint/eslintrc/lib/index.js
generated
vendored
4
frontend/node_modules/@eslint/eslintrc/lib/index.js
generated
vendored
@@ -8,8 +8,7 @@
|
||||
|
||||
import {
|
||||
ConfigArrayFactory,
|
||||
createContext as createConfigArrayFactoryContext,
|
||||
loadConfigFile
|
||||
createContext as createConfigArrayFactoryContext
|
||||
} from "./config-array-factory.js";
|
||||
|
||||
import { CascadingConfigArrayFactory } from "./cascading-config-array-factory.js";
|
||||
@@ -40,7 +39,6 @@ const Legacy = {
|
||||
OverrideTester,
|
||||
getUsedExtractedConfigs,
|
||||
environments,
|
||||
loadConfigFile,
|
||||
|
||||
// shared
|
||||
ConfigOps,
|
||||
|
||||
2
frontend/node_modules/@eslint/eslintrc/lib/shared/ajv.js
generated
vendored
2
frontend/node_modules/@eslint/eslintrc/lib/shared/ajv.js
generated
vendored
@@ -184,7 +184,7 @@ export default (additionalOptions = {}) => {
|
||||
});
|
||||
|
||||
ajv.addMetaSchema(metaSchema);
|
||||
// eslint-disable-next-line no-underscore-dangle -- part of the API
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
ajv._opts.defaultMeta = metaSchema.id;
|
||||
|
||||
return ajv;
|
||||
|
||||
4
frontend/node_modules/@eslint/eslintrc/lib/shared/config-ops.js
generated
vendored
4
frontend/node_modules/@eslint/eslintrc/lib/shared/config-ops.js
generated
vendored
@@ -13,7 +13,7 @@ const RULE_SEVERITY_STRINGS = ["off", "warn", "error"],
|
||||
map[value] = index;
|
||||
return map;
|
||||
}, {}),
|
||||
VALID_SEVERITIES = new Set([0, 1, 2, "off", "warn", "error"]);
|
||||
VALID_SEVERITIES = [0, 1, 2, "off", "warn", "error"];
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
@@ -83,7 +83,7 @@ function isValidSeverity(ruleConfig) {
|
||||
if (typeof severity === "string") {
|
||||
severity = severity.toLowerCase();
|
||||
}
|
||||
return VALID_SEVERITIES.has(severity);
|
||||
return VALID_SEVERITIES.indexOf(severity) !== -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
112
frontend/node_modules/@eslint/eslintrc/lib/shared/config-validator.js
generated
vendored
112
frontend/node_modules/@eslint/eslintrc/lib/shared/config-validator.js
generated
vendored
@@ -3,23 +3,16 @@
|
||||
* @author Brandon Mills
|
||||
*/
|
||||
|
||||
/* eslint class-methods-use-this: "off" -- not needed in this file */
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Typedefs
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @typedef {import("../shared/types").Rule} Rule */
|
||||
/* eslint class-methods-use-this: "off" */
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
import util from "node:util";
|
||||
import util from "util";
|
||||
import * as ConfigOps from "./config-ops.js";
|
||||
import { emitDeprecationWarning } from "./deprecation-warnings.js";
|
||||
import ajvOrig from "./ajv.js";
|
||||
import { deepMergeArrays } from "./deep-merge-arrays.js";
|
||||
import configSchema from "../../conf/config-schema.js";
|
||||
import BuiltInEnvironments from "../../conf/environments.js";
|
||||
|
||||
@@ -40,20 +33,10 @@ const severityMap = {
|
||||
|
||||
const validated = new WeakSet();
|
||||
|
||||
// JSON schema that disallows passing any options
|
||||
const noOptionsSchema = Object.freeze({
|
||||
type: "array",
|
||||
minItems: 0,
|
||||
maxItems: 0
|
||||
});
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Validator for configuration objects.
|
||||
*/
|
||||
export default class ConfigValidator {
|
||||
constructor({ builtInRules = new Map() } = {}) {
|
||||
this.builtInRules = builtInRules;
|
||||
@@ -61,36 +44,17 @@ export default class ConfigValidator {
|
||||
|
||||
/**
|
||||
* Gets a complete options schema for a rule.
|
||||
* @param {Rule} rule A rule object
|
||||
* @throws {TypeError} If `meta.schema` is specified but is not an array, object or `false`.
|
||||
* @returns {Object|null} JSON Schema for the rule's options.
|
||||
* `null` if rule wasn't passed or its `meta.schema` is `false`.
|
||||
* @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;
|
||||
}
|
||||
|
||||
if (!rule.meta) {
|
||||
return { ...noOptionsSchema }; // default if `meta.schema` is not specified
|
||||
}
|
||||
const schema = rule.schema || rule.meta && rule.meta.schema;
|
||||
|
||||
const schema = rule.meta.schema;
|
||||
|
||||
if (typeof schema === "undefined") {
|
||||
return { ...noOptionsSchema }; // default if `meta.schema` is not specified
|
||||
}
|
||||
|
||||
// `schema:false` is an allowed explicit opt-out of options validation for the rule
|
||||
if (schema === false) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (typeof schema !== "object" || schema === null) {
|
||||
throw new TypeError("Rule's `meta.schema` must be an array or object");
|
||||
}
|
||||
|
||||
// ESLint-specific array form needs to be converted into a valid JSON Schema definition
|
||||
// Given a tuple of schemas, insert warning level at the beginning
|
||||
if (Array.isArray(schema)) {
|
||||
if (schema.length) {
|
||||
return {
|
||||
@@ -100,20 +64,22 @@ export default class ConfigValidator {
|
||||
maxItems: schema.length
|
||||
};
|
||||
}
|
||||
return {
|
||||
type: "array",
|
||||
minItems: 0,
|
||||
maxItems: 0
|
||||
};
|
||||
|
||||
// `schema:[]` is an explicit way to specify that the rule does not accept any options
|
||||
return { ...noOptionsSchema };
|
||||
}
|
||||
|
||||
// `schema:<object>` is assumed to be a valid JSON Schema definition
|
||||
return schema;
|
||||
// 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
|
||||
* @throws {Error} If the severity is invalid.
|
||||
*/
|
||||
validateRuleSeverity(options) {
|
||||
const severity = Array.isArray(options) ? options[0] : options;
|
||||
@@ -132,32 +98,20 @@ export default class ConfigValidator {
|
||||
* @param {{create: Function}} rule The rule to validate
|
||||
* @param {Array} localOptions The options for the rule, excluding severity
|
||||
* @returns {void}
|
||||
* @throws {Error} If the options are invalid.
|
||||
*/
|
||||
validateRuleSchema(rule, localOptions) {
|
||||
if (!ruleValidators.has(rule)) {
|
||||
try {
|
||||
const schema = this.getRuleOptionsSchema(rule);
|
||||
const schema = this.getRuleOptionsSchema(rule);
|
||||
|
||||
if (schema) {
|
||||
ruleValidators.set(rule, ajv.compile(schema));
|
||||
}
|
||||
} catch (err) {
|
||||
const errorWithCode = new Error(err.message, { cause: err });
|
||||
|
||||
errorWithCode.code = "ESLINT_INVALID_RULE_OPTIONS_SCHEMA";
|
||||
|
||||
throw errorWithCode;
|
||||
if (schema) {
|
||||
ruleValidators.set(rule, ajv.compile(schema));
|
||||
}
|
||||
}
|
||||
|
||||
const validateRule = ruleValidators.get(rule);
|
||||
|
||||
if (validateRule) {
|
||||
const mergedOptions = deepMergeArrays(rule.meta?.defaultOptions, localOptions);
|
||||
|
||||
validateRule(mergedOptions);
|
||||
|
||||
validateRule(localOptions);
|
||||
if (validateRule.errors) {
|
||||
throw new Error(validateRule.errors.map(
|
||||
error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n`
|
||||
@@ -174,7 +128,6 @@ export default class ConfigValidator {
|
||||
* @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}
|
||||
* @throws {Error} If the options are invalid.
|
||||
*/
|
||||
validateRuleOptions(rule, ruleId, options, source = null) {
|
||||
try {
|
||||
@@ -184,21 +137,13 @@ export default class ConfigValidator {
|
||||
this.validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []);
|
||||
}
|
||||
} catch (err) {
|
||||
let enhancedMessage = err.code === "ESLINT_INVALID_RULE_OPTIONS_SCHEMA"
|
||||
? `Error while processing options validation schema of rule '${ruleId}': ${err.message}`
|
||||
: `Configuration for rule "${ruleId}" is invalid:\n${err.message}`;
|
||||
const enhancedMessage = `Configuration for rule "${ruleId}" is invalid:\n${err.message}`;
|
||||
|
||||
if (typeof source === "string") {
|
||||
enhancedMessage = `${source}:\n\t${enhancedMessage}`;
|
||||
throw new Error(`${source}:\n\t${enhancedMessage}`);
|
||||
} else {
|
||||
throw new Error(enhancedMessage);
|
||||
}
|
||||
|
||||
const enhancedError = new Error(enhancedMessage, { cause: err });
|
||||
|
||||
if (err.code) {
|
||||
enhancedError.code = err.code;
|
||||
}
|
||||
|
||||
throw enhancedError;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,9 +151,8 @@ export default class ConfigValidator {
|
||||
* 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 {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded environments.
|
||||
* @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the environment is invalid.
|
||||
*/
|
||||
validateEnvironment(
|
||||
environment,
|
||||
@@ -236,7 +180,7 @@ export default class ConfigValidator {
|
||||
* 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 {(ruleId:string) => Object} getAdditionalRule A map from strings to loaded rules
|
||||
* @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules
|
||||
* @returns {void}
|
||||
*/
|
||||
validateRules(
|
||||
@@ -280,9 +224,8 @@ export default class ConfigValidator {
|
||||
* Validate `processor` configuration.
|
||||
* @param {string|undefined} processorName The processor name.
|
||||
* @param {string} source The name of config file.
|
||||
* @param {(id:string) => Processor} getProcessor The getter of defined processors.
|
||||
* @param {function(id:string): Processor} getProcessor The getter of defined processors.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the processor is invalid.
|
||||
*/
|
||||
validateProcessor(processorName, source, getProcessor) {
|
||||
if (processorName && !getProcessor(processorName)) {
|
||||
@@ -321,7 +264,6 @@ export default class ConfigValidator {
|
||||
* @param {Object} config The config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the config is invalid.
|
||||
*/
|
||||
validateConfigSchema(config, source = null) {
|
||||
validateSchema = validateSchema || ajv.compile(configSchema);
|
||||
@@ -330,7 +272,7 @@ export default class ConfigValidator {
|
||||
throw new Error(`ESLint configuration in ${source} is invalid:\n${this.formatErrors(validateSchema.errors)}`);
|
||||
}
|
||||
|
||||
if (Object.hasOwn(config, "ecmaFeatures")) {
|
||||
if (Object.hasOwnProperty.call(config, "ecmaFeatures")) {
|
||||
emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES");
|
||||
}
|
||||
}
|
||||
@@ -339,8 +281,8 @@ export default class ConfigValidator {
|
||||
* 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 {(ruleId:string) => Object} [getAdditionalRule] A map from strings to loaded rules.
|
||||
* @param {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded envs.
|
||||
* @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) {
|
||||
|
||||
58
frontend/node_modules/@eslint/eslintrc/lib/shared/deep-merge-arrays.js
generated
vendored
58
frontend/node_modules/@eslint/eslintrc/lib/shared/deep-merge-arrays.js
generated
vendored
@@ -1,58 +0,0 @@
|
||||
/**
|
||||
* @fileoverview Applies default rule options
|
||||
* @author JoshuaKGoldberg
|
||||
*/
|
||||
|
||||
/**
|
||||
* Check if the variable contains an object strictly rejecting arrays
|
||||
* @param {unknown} value an object
|
||||
* @returns {boolean} Whether value is an object
|
||||
*/
|
||||
function isObjectNotArray(value) {
|
||||
return typeof value === "object" && value !== null && !Array.isArray(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deeply merges second on top of first, creating a new {} object if needed.
|
||||
* @param {T} first Base, default value.
|
||||
* @param {U} second User-specified value.
|
||||
* @returns {T | U | (T & U)} Merged equivalent of second on top of first.
|
||||
*/
|
||||
function deepMergeObjects(first, second) {
|
||||
if (second === void 0) {
|
||||
return first;
|
||||
}
|
||||
|
||||
if (!isObjectNotArray(first) || !isObjectNotArray(second)) {
|
||||
return second;
|
||||
}
|
||||
|
||||
const result = { ...first, ...second };
|
||||
|
||||
for (const key of Object.keys(second)) {
|
||||
if (Object.prototype.propertyIsEnumerable.call(first, key)) {
|
||||
result[key] = deepMergeObjects(first[key], second[key]);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deeply merges second on top of first, creating a new [] array if needed.
|
||||
* @param {T[] | undefined} first Base, default values.
|
||||
* @param {U[] | undefined} second User-specified values.
|
||||
* @returns {(T | U | (T & U))[]} Merged equivalent of second on top of first.
|
||||
*/
|
||||
function deepMergeArrays(first, second) {
|
||||
if (!first || !second) {
|
||||
return second || first || [];
|
||||
}
|
||||
|
||||
return [
|
||||
...first.map((value, i) => deepMergeObjects(value, second[i])),
|
||||
...second.slice(first.length)
|
||||
];
|
||||
}
|
||||
|
||||
export { deepMergeArrays };
|
||||
2
frontend/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js
generated
vendored
2
frontend/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js
generated
vendored
@@ -7,7 +7,7 @@
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
import path from "node:path";
|
||||
import path from "path";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Private
|
||||
|
||||
3
frontend/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js
generated
vendored
3
frontend/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js
generated
vendored
@@ -3,7 +3,7 @@
|
||||
* @author Teddy Katz
|
||||
*/
|
||||
|
||||
import Module from "node:module";
|
||||
import Module from "module";
|
||||
|
||||
/*
|
||||
* `Module.createRequire` is added in v12.2.0. It supports URL as well.
|
||||
@@ -17,7 +17,6 @@ const createRequire = Module.createRequire;
|
||||
* @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`
|
||||
* @throws {Error} When the module cannot be resolved.
|
||||
*/
|
||||
function resolve(moduleName, relativeToPath) {
|
||||
try {
|
||||
|
||||
76
frontend/node_modules/@eslint/eslintrc/lib/types/index.d.ts
generated
vendored
76
frontend/node_modules/@eslint/eslintrc/lib/types/index.d.ts
generated
vendored
@@ -1,76 +0,0 @@
|
||||
/**
|
||||
* @fileoverview This file contains the core types for ESLint. It was initially extracted
|
||||
* from the `@types/eslint__eslintrc` package.
|
||||
*/
|
||||
|
||||
/*
|
||||
* MIT License
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
import type { Linter } from "eslint";
|
||||
|
||||
/**
|
||||
* A compatibility class for working with configs.
|
||||
*/
|
||||
export class FlatCompat {
|
||||
constructor({
|
||||
baseDirectory,
|
||||
resolvePluginsRelativeTo,
|
||||
recommendedConfig,
|
||||
allConfig,
|
||||
}?: {
|
||||
/**
|
||||
* default: process.cwd()
|
||||
*/
|
||||
baseDirectory?: string;
|
||||
resolvePluginsRelativeTo?: string;
|
||||
recommendedConfig?: Linter.LegacyConfig;
|
||||
allConfig?: Linter.LegacyConfig;
|
||||
});
|
||||
|
||||
/**
|
||||
* Translates an ESLintRC-style config into a flag-config-style config.
|
||||
* @param eslintrcConfig The ESLintRC-style config object.
|
||||
* @returns A flag-config-style config object.
|
||||
*/
|
||||
config(eslintrcConfig: Linter.LegacyConfig): Linter.Config[];
|
||||
|
||||
/**
|
||||
* Translates the `env` section of an ESLintRC-style config.
|
||||
* @param envConfig The `env` section of an ESLintRC config.
|
||||
* @returns An array of flag-config objects representing the environments.
|
||||
*/
|
||||
env(envConfig: { [name: string]: boolean }): Linter.Config[];
|
||||
|
||||
/**
|
||||
* Translates the `extends` section of an ESLintRC-style config.
|
||||
* @param configsToExtend The names of the configs to load.
|
||||
* @returns An array of flag-config objects representing the config.
|
||||
*/
|
||||
extends(...configsToExtend: string[]): Linter.Config[];
|
||||
|
||||
/**
|
||||
* Translates the `plugins` section of an ESLintRC-style config.
|
||||
* @param plugins The names of the plugins to load.
|
||||
* @returns An array of flag-config objects representing the plugins.
|
||||
*/
|
||||
plugins(...plugins: string[]): Linter.Config[];
|
||||
}
|
||||
28
frontend/node_modules/@eslint/eslintrc/package.json
generated
vendored
28
frontend/node_modules/@eslint/eslintrc/package.json
generated
vendored
@@ -1,15 +1,13 @@
|
||||
{
|
||||
"name": "@eslint/eslintrc",
|
||||
"version": "3.3.1",
|
||||
"version": "2.1.4",
|
||||
"description": "The legacy ESLintRC config file format for ESLint",
|
||||
"type": "module",
|
||||
"main": "./dist/eslintrc.cjs",
|
||||
"types": "./dist/eslintrc.d.cts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./lib/index.js",
|
||||
"require": "./dist/eslintrc.cjs",
|
||||
"types": "./lib/types/index.d.ts"
|
||||
"require": "./dist/eslintrc.cjs"
|
||||
},
|
||||
"./package.json": "./package.json",
|
||||
"./universal": {
|
||||
@@ -28,7 +26,7 @@
|
||||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c && node -e \"fs.copyFileSync('./lib/types/index.d.ts', './dist/eslintrc.d.cts')\"",
|
||||
"build": "rollup -c",
|
||||
"lint": "eslint . --report-unused-disable-directives",
|
||||
"lint:fix": "npm run lint -- --fix",
|
||||
"prepare": "npm run build",
|
||||
@@ -37,8 +35,7 @@
|
||||
"release:generate:beta": "eslint-generate-prerelease beta",
|
||||
"release:generate:rc": "eslint-generate-prerelease rc",
|
||||
"release:publish": "eslint-publish-release",
|
||||
"test": "mocha -R progress -c 'tests/lib/*.cjs' && c8 mocha -R progress -c 'tests/lib/**/*.js'",
|
||||
"test:types": "tsc -p tests/lib/types/tsconfig.json"
|
||||
"test": "mocha -R progress -c 'tests/lib/*.cjs' && c8 mocha -R progress -c 'tests/lib/**/*.js'"
|
||||
},
|
||||
"repository": "eslint/eslintrc",
|
||||
"funding": "https://opencollective.com/eslint",
|
||||
@@ -56,22 +53,23 @@
|
||||
"devDependencies": {
|
||||
"c8": "^7.7.3",
|
||||
"chai": "^4.3.4",
|
||||
"eslint": "^9.20.1",
|
||||
"eslint-config-eslint": "^11.0.0",
|
||||
"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.70.1",
|
||||
"shelljs": "^0.8.5",
|
||||
"shelljs": "^0.8.4",
|
||||
"sinon": "^11.1.2",
|
||||
"temp-dir": "^2.0.0",
|
||||
"typescript": "^5.7.3"
|
||||
"temp-dir": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ajv": "^6.12.4",
|
||||
"debug": "^4.3.2",
|
||||
"espree": "^10.0.1",
|
||||
"globals": "^14.0.0",
|
||||
"espree": "^9.6.0",
|
||||
"globals": "^13.19.0",
|
||||
"ignore": "^5.2.0",
|
||||
"import-fresh": "^3.2.1",
|
||||
"js-yaml": "^4.1.0",
|
||||
@@ -79,6 +77,6 @@
|
||||
"strip-json-comments": "^3.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
3
frontend/node_modules/@eslint/eslintrc/universal.js
generated
vendored
3
frontend/node_modules/@eslint/eslintrc/universal.js
generated
vendored
@@ -1,5 +1,3 @@
|
||||
/* global module, require -- required for CJS file */
|
||||
|
||||
// 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
|
||||
@@ -7,4 +5,5 @@
|
||||
// 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");
|
||||
|
||||
100
frontend/node_modules/@eslint/js/README.md
generated
vendored
100
frontend/node_modules/@eslint/js/README.md
generated
vendored
@@ -1,54 +1,20 @@
|
||||
[](https://www.npmjs.com/package/@eslint/js)
|
||||
[](https://www.npmjs.com/package/@eslint/js)
|
||||
[](https://github.com/eslint/eslint/actions)
|
||||
<br>
|
||||
[](https://opencollective.com/eslint)
|
||||
[](https://opencollective.com/eslint)
|
||||
|
||||
# ESLint JavaScript Plugin
|
||||
|
||||
[Website](https://eslint.org) |
|
||||
[Configure ESLint](https://eslint.org/docs/latest/use/configure) |
|
||||
[Rules](https://eslint.org/docs/rules/) |
|
||||
[Contribute to ESLint](https://eslint.org/docs/latest/contribute) |
|
||||
[Report Bugs](https://eslint.org/docs/latest/contribute/report-bugs) |
|
||||
[Code of Conduct](https://eslint.org/conduct) |
|
||||
[X](https://x.com/geteslint) |
|
||||
[Discord](https://eslint.org/chat) |
|
||||
[Mastodon](https://fosstodon.org/@eslint) |
|
||||
[Bluesky](https://bsky.app/profile/eslint.org)
|
||||
[Website](https://eslint.org) | [Configure ESLint](https://eslint.org/docs/latest/use/configure) | [Rules](https://eslint.org/docs/rules/) | [Contributing](https://eslint.org/docs/latest/contribute) | [Twitter](https://twitter.com/geteslint) | [Chatroom](https://eslint.org/chat)
|
||||
|
||||
The beginnings of separating out JavaScript-specific functionality from ESLint.
|
||||
|
||||
Right now, this plugin contains two configurations:
|
||||
|
||||
- `recommended` - enables the rules recommended by the ESLint team (the replacement for `"eslint:recommended"`)
|
||||
- `all` - enables all ESLint rules (the replacement for `"eslint:all"`)
|
||||
* `recommended` - enables the rules recommended by the ESLint team (the replacement for `"eslint:recommended"`)
|
||||
* `all` - enables all ESLint rules (the replacement for `"eslint:all"`)
|
||||
|
||||
## Installation
|
||||
|
||||
You can install ESLint using npm or other package managers:
|
||||
|
||||
```shell
|
||||
npm install eslint -D
|
||||
# or
|
||||
yarn add eslint -D
|
||||
# or
|
||||
pnpm install eslint -D
|
||||
# or
|
||||
bun add eslint -D
|
||||
```
|
||||
|
||||
Then install this plugin:
|
||||
|
||||
```shell
|
||||
npm install @eslint/js -D
|
||||
# or
|
||||
yarn add @eslint/js -D
|
||||
# or
|
||||
pnpm install @eslint/js -D
|
||||
# or
|
||||
bun add @eslint/js -D
|
||||
```
|
||||
|
||||
## Usage
|
||||
@@ -56,46 +22,34 @@ bun add @eslint/js -D
|
||||
Use in your `eslint.config.js` file anytime you want to extend one of the configs:
|
||||
|
||||
```js
|
||||
import { defineConfig } from "eslint/config";
|
||||
import js from "@eslint/js";
|
||||
|
||||
export default defineConfig([
|
||||
// apply recommended rules to JS files
|
||||
{
|
||||
name: "your-project/recommended-rules",
|
||||
files: ["**/*.js"],
|
||||
plugins: {
|
||||
js,
|
||||
},
|
||||
extends: ["js/recommended"],
|
||||
},
|
||||
export default [
|
||||
|
||||
// apply recommended rules to JS files with an override
|
||||
{
|
||||
name: "your-project/recommended-rules-with-override",
|
||||
files: ["**/*.js"],
|
||||
plugins: {
|
||||
js,
|
||||
},
|
||||
extends: ["js/recommended"],
|
||||
rules: {
|
||||
"no-unused-vars": "warn",
|
||||
},
|
||||
},
|
||||
// apply recommended rules to JS files
|
||||
{
|
||||
files: ["**/*.js"],
|
||||
rules: js.configs.recommended.rules
|
||||
},
|
||||
|
||||
// apply all rules to JS files
|
||||
{
|
||||
name: "your-project/all-rules",
|
||||
files: ["**/*.js"],
|
||||
plugins: {
|
||||
js,
|
||||
},
|
||||
extends: ["js/all"],
|
||||
rules: {
|
||||
"no-unused-vars": "warn",
|
||||
},
|
||||
},
|
||||
]);
|
||||
// apply recommended rules to JS files with an override
|
||||
{
|
||||
files: ["**/*.js"],
|
||||
rules: {
|
||||
...js.configs.recommended.rules,
|
||||
"no-unused-vars": "warn"
|
||||
}
|
||||
},
|
||||
|
||||
// apply all rules to JS files
|
||||
{
|
||||
files: ["**/*.js"],
|
||||
rules: {
|
||||
...js.configs.all.rules,
|
||||
"no-unused-vars": "warn"
|
||||
}
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
13
frontend/node_modules/@eslint/js/package.json
generated
vendored
13
frontend/node_modules/@eslint/js/package.json
generated
vendored
@@ -1,18 +1,13 @@
|
||||
{
|
||||
"name": "@eslint/js",
|
||||
"version": "9.39.1",
|
||||
"version": "8.57.1",
|
||||
"description": "ESLint JavaScript language implementation",
|
||||
"funding": "https://eslint.org/donate",
|
||||
"main": "./src/index.js",
|
||||
"types": "./types/index.d.ts",
|
||||
"scripts": {
|
||||
"test:types": "tsc -p tests/types/tsconfig.json"
|
||||
},
|
||||
"scripts": {},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"src",
|
||||
"types"
|
||||
"src"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
@@ -31,6 +26,6 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
18
frontend/node_modules/@eslint/js/src/configs/eslint-all.js
generated
vendored
18
frontend/node_modules/@eslint/js/src/configs/eslint-all.js
generated
vendored
@@ -4,16 +4,10 @@
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* IMPORTANT!
|
||||
*
|
||||
* We cannot add a "name" property to this object because it's still used in eslintrc
|
||||
* which doesn't support the "name" property. If we add a "name" property, it will
|
||||
* cause an error.
|
||||
*/
|
||||
/* eslint quote-props: off -- autogenerated so don't lint */
|
||||
|
||||
module.exports = Object.freeze({
|
||||
rules: Object.freeze({
|
||||
"rules": {
|
||||
"accessor-pairs": "error",
|
||||
"array-callback-return": "error",
|
||||
"arrow-body-style": "error",
|
||||
@@ -42,6 +36,7 @@ module.exports = Object.freeze({
|
||||
"id-length": "error",
|
||||
"id-match": "error",
|
||||
"init-declarations": "error",
|
||||
"line-comment-position": "error",
|
||||
"logical-assignment-operators": "error",
|
||||
"max-classes-per-file": "error",
|
||||
"max-depth": "error",
|
||||
@@ -50,6 +45,7 @@ module.exports = Object.freeze({
|
||||
"max-nested-callbacks": "error",
|
||||
"max-params": "error",
|
||||
"max-statements": "error",
|
||||
"multiline-comment-style": "error",
|
||||
"new-cap": "error",
|
||||
"no-alert": "error",
|
||||
"no-array-constructor": "error",
|
||||
@@ -118,6 +114,7 @@ module.exports = Object.freeze({
|
||||
"no-new": "error",
|
||||
"no-new-func": "error",
|
||||
"no-new-native-nonconstructor": "error",
|
||||
"no-new-symbol": "error",
|
||||
"no-new-wrappers": "error",
|
||||
"no-nonoctal-decimal-escape": "error",
|
||||
"no-obj-calls": "error",
|
||||
@@ -149,7 +146,6 @@ module.exports = Object.freeze({
|
||||
"no-ternary": "error",
|
||||
"no-this-before-super": "error",
|
||||
"no-throw-literal": "error",
|
||||
"no-unassigned-vars": "error",
|
||||
"no-undef": "error",
|
||||
"no-undef-init": "error",
|
||||
"no-undefined": "error",
|
||||
@@ -167,7 +163,6 @@ module.exports = Object.freeze({
|
||||
"no-unused-private-class-members": "error",
|
||||
"no-unused-vars": "error",
|
||||
"no-use-before-define": "error",
|
||||
"no-useless-assignment": "error",
|
||||
"no-useless-backreference": "error",
|
||||
"no-useless-call": "error",
|
||||
"no-useless-catch": "error",
|
||||
@@ -197,7 +192,6 @@ module.exports = Object.freeze({
|
||||
"prefer-rest-params": "error",
|
||||
"prefer-spread": "error",
|
||||
"prefer-template": "error",
|
||||
"preserve-caught-error": "error",
|
||||
"radix": "error",
|
||||
"require-atomic-updates": "error",
|
||||
"require-await": "error",
|
||||
@@ -213,5 +207,5 @@ module.exports = Object.freeze({
|
||||
"valid-typeof": "error",
|
||||
"vars-on-top": "error",
|
||||
"yoda": "error"
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
27
frontend/node_modules/@eslint/js/src/configs/eslint-recommended.js
generated
vendored
27
frontend/node_modules/@eslint/js/src/configs/eslint-recommended.js
generated
vendored
@@ -1,17 +1,14 @@
|
||||
/*
|
||||
* WARNING: This file is autogenerated using the tools/update-eslint-recommended.js
|
||||
* script. Do not edit manually.
|
||||
/**
|
||||
* @fileoverview Configuration applied when a user configuration extends from
|
||||
* eslint:recommended.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* IMPORTANT!
|
||||
*
|
||||
* We cannot add a "name" property to this object because it's still used in eslintrc
|
||||
* which doesn't support the "name" property. If we add a "name" property, it will
|
||||
* cause an error.
|
||||
*/
|
||||
/* eslint sort-keys: ["error", "asc"] -- Long, so make more readable */
|
||||
|
||||
/** @type {import("../lib/shared/types").ConfigData} */
|
||||
module.exports = Object.freeze({
|
||||
rules: Object.freeze({
|
||||
"constructor-super": "error",
|
||||
@@ -23,7 +20,6 @@ module.exports = Object.freeze({
|
||||
"no-compare-neg-zero": "error",
|
||||
"no-cond-assign": "error",
|
||||
"no-const-assign": "error",
|
||||
"no-constant-binary-expression": "error",
|
||||
"no-constant-condition": "error",
|
||||
"no-control-regex": "error",
|
||||
"no-debugger": "error",
|
||||
@@ -36,18 +32,20 @@ module.exports = Object.freeze({
|
||||
"no-empty": "error",
|
||||
"no-empty-character-class": "error",
|
||||
"no-empty-pattern": "error",
|
||||
"no-empty-static-block": "error",
|
||||
"no-ex-assign": "error",
|
||||
"no-extra-boolean-cast": "error",
|
||||
"no-extra-semi": "error",
|
||||
"no-fallthrough": "error",
|
||||
"no-func-assign": "error",
|
||||
"no-global-assign": "error",
|
||||
"no-import-assign": "error",
|
||||
"no-inner-declarations": "error",
|
||||
"no-invalid-regexp": "error",
|
||||
"no-irregular-whitespace": "error",
|
||||
"no-loss-of-precision": "error",
|
||||
"no-misleading-character-class": "error",
|
||||
"no-new-native-nonconstructor": "error",
|
||||
"no-mixed-spaces-and-tabs": "error",
|
||||
"no-new-symbol": "error",
|
||||
"no-nonoctal-decimal-escape": "error",
|
||||
"no-obj-calls": "error",
|
||||
"no-octal": "error",
|
||||
@@ -66,7 +64,6 @@ module.exports = Object.freeze({
|
||||
"no-unsafe-negation": "error",
|
||||
"no-unsafe-optional-chaining": "error",
|
||||
"no-unused-labels": "error",
|
||||
"no-unused-private-class-members": "error",
|
||||
"no-unused-vars": "error",
|
||||
"no-useless-backreference": "error",
|
||||
"no-useless-catch": "error",
|
||||
@@ -75,5 +72,5 @@ module.exports = Object.freeze({
|
||||
"require-yield": "error",
|
||||
"use-isnan": "error",
|
||||
"valid-typeof": "error"
|
||||
}),
|
||||
})
|
||||
});
|
||||
|
||||
14
frontend/node_modules/@eslint/js/src/index.js
generated
vendored
14
frontend/node_modules/@eslint/js/src/index.js
generated
vendored
@@ -5,19 +5,13 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const { name, version } = require("../package.json");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
name,
|
||||
version,
|
||||
},
|
||||
configs: {
|
||||
all: require("./configs/eslint-all"),
|
||||
recommended: require("./configs/eslint-recommended"),
|
||||
},
|
||||
configs: {
|
||||
all: require("./configs/eslint-all"),
|
||||
recommended: require("./configs/eslint-recommended")
|
||||
}
|
||||
};
|
||||
|
||||
14
frontend/node_modules/@eslint/js/types/index.d.ts
generated
vendored
14
frontend/node_modules/@eslint/js/types/index.d.ts
generated
vendored
@@ -1,14 +0,0 @@
|
||||
import type { Linter } from "eslint";
|
||||
|
||||
declare const js: {
|
||||
readonly meta: {
|
||||
readonly name: string;
|
||||
readonly version: string;
|
||||
};
|
||||
readonly configs: {
|
||||
readonly recommended: { readonly rules: Readonly<Linter.RulesRecord> };
|
||||
readonly all: { readonly rules: Readonly<Linter.RulesRecord> };
|
||||
};
|
||||
};
|
||||
|
||||
export = js;
|
||||
201
frontend/node_modules/@eslint/object-schema/LICENSE
generated
vendored
201
frontend/node_modules/@eslint/object-schema/LICENSE
generated
vendored
@@ -1,201 +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
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
||||
242
frontend/node_modules/@eslint/object-schema/README.md
generated
vendored
242
frontend/node_modules/@eslint/object-schema/README.md
generated
vendored
@@ -1,242 +0,0 @@
|
||||
# ObjectSchema Package
|
||||
|
||||
## Overview
|
||||
|
||||
A JavaScript object merge/validation utility where you can define a different merge and validation strategy for each key. This is helpful when you need to validate complex data structures and then merge them in a way that is more complex than `Object.assign()`. This is used in the [`@eslint/config-array`](https://npmjs.com/package/@eslint/config-array) package but can also be used on its own.
|
||||
|
||||
## Installation
|
||||
|
||||
For Node.js and compatible runtimes:
|
||||
|
||||
```shell
|
||||
npm install @eslint/object-schema
|
||||
# or
|
||||
yarn add @eslint/object-schema
|
||||
# or
|
||||
pnpm install @eslint/object-schema
|
||||
# or
|
||||
bun add @eslint/object-schema
|
||||
```
|
||||
|
||||
For Deno:
|
||||
|
||||
```shell
|
||||
deno add @eslint/object-schema
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Import the `ObjectSchema` constructor:
|
||||
|
||||
```js
|
||||
// using ESM
|
||||
import { ObjectSchema } from "@eslint/object-schema";
|
||||
|
||||
// using CommonJS
|
||||
const { ObjectSchema } = require("@eslint/object-schema");
|
||||
|
||||
const schema = new ObjectSchema({
|
||||
// define a definition for the "downloads" key
|
||||
downloads: {
|
||||
required: true,
|
||||
merge(value1, value2) {
|
||||
return value1 + value2;
|
||||
},
|
||||
validate(value) {
|
||||
if (typeof value !== "number") {
|
||||
throw new Error("Expected downloads to be a number.");
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
// define a strategy for the "versions" key
|
||||
version: {
|
||||
required: true,
|
||||
merge(value1, value2) {
|
||||
return value1.concat(value2);
|
||||
},
|
||||
validate(value) {
|
||||
if (!Array.isArray(value)) {
|
||||
throw new Error("Expected versions to be an array.");
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const record1 = {
|
||||
downloads: 25,
|
||||
versions: ["v1.0.0", "v1.1.0", "v1.2.0"],
|
||||
};
|
||||
|
||||
const record2 = {
|
||||
downloads: 125,
|
||||
versions: ["v2.0.0", "v2.1.0", "v3.0.0"],
|
||||
};
|
||||
|
||||
// make sure the records are valid
|
||||
schema.validate(record1);
|
||||
schema.validate(record2);
|
||||
|
||||
// merge together (schema.merge() accepts any number of objects)
|
||||
const result = schema.merge(record1, record2);
|
||||
|
||||
// result looks like this:
|
||||
|
||||
const result = {
|
||||
downloads: 75,
|
||||
versions: ["v1.0.0", "v1.1.0", "v1.2.0", "v2.0.0", "v2.1.0", "v3.0.0"],
|
||||
};
|
||||
```
|
||||
|
||||
## Tips and Tricks
|
||||
|
||||
### Named merge strategies
|
||||
|
||||
Instead of specifying a `merge()` method, you can specify one of the following strings to use a default merge strategy:
|
||||
|
||||
- `"assign"` - use `Object.assign()` to merge the two values into one object.
|
||||
- `"overwrite"` - the second value always replaces the first.
|
||||
- `"replace"` - the second value replaces the first if the second is not `undefined`.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
const schema = new ObjectSchema({
|
||||
name: {
|
||||
merge: "replace",
|
||||
validate() {},
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
### Named validation strategies
|
||||
|
||||
Instead of specifying a `validate()` method, you can specify one of the following strings to use a default validation strategy:
|
||||
|
||||
- `"array"` - value must be an array.
|
||||
- `"boolean"` - value must be a boolean.
|
||||
- `"number"` - value must be a number.
|
||||
- `"object"` - value must be an object.
|
||||
- `"object?"` - value must be an object or null.
|
||||
- `"string"` - value must be a string.
|
||||
- `"string!"` - value must be a non-empty string.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
const schema = new ObjectSchema({
|
||||
name: {
|
||||
merge: "replace",
|
||||
validate: "string",
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
### Subschemas
|
||||
|
||||
If you are defining a key that is, itself, an object, you can simplify the process by using a subschema. Instead of defining `merge()` and `validate()`, assign a `schema` key that contains a schema definition, like this:
|
||||
|
||||
```js
|
||||
const schema = new ObjectSchema({
|
||||
name: {
|
||||
schema: {
|
||||
first: {
|
||||
merge: "replace",
|
||||
validate: "string",
|
||||
},
|
||||
last: {
|
||||
merge: "replace",
|
||||
validate: "string",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
schema.validate({
|
||||
name: {
|
||||
first: "n",
|
||||
last: "z",
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
### Remove Keys During Merge
|
||||
|
||||
If the merge strategy for a key returns `undefined`, then the key will not appear in the final object. For example:
|
||||
|
||||
```js
|
||||
const schema = new ObjectSchema({
|
||||
date: {
|
||||
merge() {
|
||||
return undefined;
|
||||
},
|
||||
validate(value) {
|
||||
Date.parse(value); // throws an error when invalid
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const object1 = { date: "5/5/2005" };
|
||||
const object2 = { date: "6/6/2006" };
|
||||
|
||||
const result = schema.merge(object1, object2);
|
||||
|
||||
console.log("date" in result); // false
|
||||
```
|
||||
|
||||
### Requiring Another Key Be Present
|
||||
|
||||
If you'd like the presence of one key to require the presence of another key, you can use the `requires` property to specify an array of other properties that any key requires. For example:
|
||||
|
||||
```js
|
||||
const schema = new ObjectSchema();
|
||||
|
||||
const schema = new ObjectSchema({
|
||||
date: {
|
||||
merge() {
|
||||
return undefined;
|
||||
},
|
||||
validate(value) {
|
||||
Date.parse(value); // throws an error when invalid
|
||||
},
|
||||
},
|
||||
time: {
|
||||
requires: ["date"],
|
||||
merge(first, second) {
|
||||
return second;
|
||||
},
|
||||
validate(value) {
|
||||
// ...
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// throws error: Key "time" requires keys "date"
|
||||
schema.validate({
|
||||
time: "13:45",
|
||||
});
|
||||
```
|
||||
|
||||
In this example, even though `date` is an optional key, it is required to be present whenever `time` is present.
|
||||
|
||||
## License
|
||||
|
||||
Apache 2.0
|
||||
|
||||
<!-- NOTE: This section is autogenerated. Do not manually edit.-->
|
||||
<!--sponsorsstart-->
|
||||
|
||||
## Sponsors
|
||||
|
||||
The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)
|
||||
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
|
||||
|
||||
<h3>Platinum Sponsors</h3>
|
||||
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
|
||||
<p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a> <a href="https://shopify.engineering/"><img src="https://avatars.githubusercontent.com/u/8085" alt="Shopify" height="96"></a></p><h3>Silver Sponsors</h3>
|
||||
<p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/e6d15e1/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301" alt="American Express" height="64"></a> <a href="https://stackblitz.com"><img src="https://avatars.githubusercontent.com/u/28635252" alt="StackBlitz" height="64"></a></p><h3>Bronze Sponsors</h3>
|
||||
<p><a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://sentry.io"><img src="https://github.com/getsentry.png" alt="Sentry" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="LambdaTest" height="32"></a></p>
|
||||
<h3>Technology Sponsors</h3>
|
||||
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.
|
||||
<p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p>
|
||||
<!--sponsorsend-->
|
||||
457
frontend/node_modules/@eslint/object-schema/dist/cjs/index.cjs
generated
vendored
457
frontend/node_modules/@eslint/object-schema/dist/cjs/index.cjs
generated
vendored
@@ -1,457 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @fileoverview Merge Strategy
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Class
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Container class for several different merge strategies.
|
||||
*/
|
||||
class MergeStrategy {
|
||||
/**
|
||||
* Merges two keys by overwriting the first with the second.
|
||||
* @param {*} value1 The value from the first object key.
|
||||
* @param {*} value2 The value from the second object key.
|
||||
* @returns {*} The second value.
|
||||
*/
|
||||
static overwrite(value1, value2) {
|
||||
return value2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges two keys by replacing the first with the second only if the
|
||||
* second is defined.
|
||||
* @param {*} value1 The value from the first object key.
|
||||
* @param {*} value2 The value from the second object key.
|
||||
* @returns {*} The second value if it is defined.
|
||||
*/
|
||||
static replace(value1, value2) {
|
||||
if (typeof value2 !== "undefined") {
|
||||
return value2;
|
||||
}
|
||||
|
||||
return value1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges two properties by assigning properties from the second to the first.
|
||||
* @param {*} value1 The value from the first object key.
|
||||
* @param {*} value2 The value from the second object key.
|
||||
* @returns {*} A new object containing properties from both value1 and
|
||||
* value2.
|
||||
*/
|
||||
static assign(value1, value2) {
|
||||
return Object.assign({}, value1, value2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @fileoverview Validation Strategy
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Class
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Container class for several different validation strategies.
|
||||
*/
|
||||
class ValidationStrategy {
|
||||
/**
|
||||
* Validates that a value is an array.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static array(value) {
|
||||
if (!Array.isArray(value)) {
|
||||
throw new TypeError("Expected an array.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that a value is a boolean.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static boolean(value) {
|
||||
if (typeof value !== "boolean") {
|
||||
throw new TypeError("Expected a Boolean.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that a value is a number.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static number(value) {
|
||||
if (typeof value !== "number") {
|
||||
throw new TypeError("Expected a number.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that a value is a object.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static object(value) {
|
||||
if (!value || typeof value !== "object") {
|
||||
throw new TypeError("Expected an object.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that a value is a object or null.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static "object?"(value) {
|
||||
if (typeof value !== "object") {
|
||||
throw new TypeError("Expected an object or null.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that a value is a string.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static string(value) {
|
||||
if (typeof value !== "string") {
|
||||
throw new TypeError("Expected a string.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that a value is a non-empty string.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static "string!"(value) {
|
||||
if (typeof value !== "string" || value.length === 0) {
|
||||
throw new TypeError("Expected a non-empty string.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @fileoverview Object Schema
|
||||
*/
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Types
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/** @import * as $typests from "./types.ts"; */
|
||||
/** @typedef {$typests.ObjectDefinition} ObjectDefinition */
|
||||
/** @typedef {$typests.PropertyDefinition} PropertyDefinition */
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Private
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Validates a schema strategy.
|
||||
* @param {string} name The name of the key this strategy is for.
|
||||
* @param {PropertyDefinition} definition The strategy for the object key.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} When the strategy is missing a name.
|
||||
* @throws {TypeError} When the strategy is missing a merge() method.
|
||||
* @throws {TypeError} When the strategy is missing a validate() method.
|
||||
*/
|
||||
function validateDefinition(name, definition) {
|
||||
let hasSchema = false;
|
||||
if (definition.schema) {
|
||||
if (typeof definition.schema === "object") {
|
||||
hasSchema = true;
|
||||
} else {
|
||||
throw new TypeError("Schema must be an object.");
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof definition.merge === "string") {
|
||||
if (!(definition.merge in MergeStrategy)) {
|
||||
throw new TypeError(
|
||||
`Definition for key "${name}" missing valid merge strategy.`,
|
||||
);
|
||||
}
|
||||
} else if (!hasSchema && typeof definition.merge !== "function") {
|
||||
throw new TypeError(
|
||||
`Definition for key "${name}" must have a merge property.`,
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof definition.validate === "string") {
|
||||
if (!(definition.validate in ValidationStrategy)) {
|
||||
throw new TypeError(
|
||||
`Definition for key "${name}" missing valid validation strategy.`,
|
||||
);
|
||||
}
|
||||
} else if (!hasSchema && typeof definition.validate !== "function") {
|
||||
throw new TypeError(
|
||||
`Definition for key "${name}" must have a validate() method.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Errors
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Error when an unexpected key is found.
|
||||
*/
|
||||
class UnexpectedKeyError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} key The key that was unexpected.
|
||||
*/
|
||||
constructor(key) {
|
||||
super(`Unexpected key "${key}" found.`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Error when a required key is missing.
|
||||
*/
|
||||
class MissingKeyError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} key The key that was missing.
|
||||
*/
|
||||
constructor(key) {
|
||||
super(`Missing required key "${key}".`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Error when a key requires other keys that are missing.
|
||||
*/
|
||||
class MissingDependentKeysError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} key The key that was unexpected.
|
||||
* @param {Array<string>} requiredKeys The keys that are required.
|
||||
*/
|
||||
constructor(key, requiredKeys) {
|
||||
super(`Key "${key}" requires keys "${requiredKeys.join('", "')}".`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper error for errors occuring during a merge or validate operation.
|
||||
*/
|
||||
class WrapperError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} key The object key causing the error.
|
||||
* @param {Error} source The source error.
|
||||
*/
|
||||
constructor(key, source) {
|
||||
super(`Key "${key}": ${source.message}`, { cause: source });
|
||||
|
||||
// copy over custom properties that aren't represented
|
||||
for (const sourceKey of Object.keys(source)) {
|
||||
if (!(sourceKey in this)) {
|
||||
this[sourceKey] = source[sourceKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Main
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Represents an object validation/merging schema.
|
||||
*/
|
||||
class ObjectSchema {
|
||||
/**
|
||||
* Track all definitions in the schema by key.
|
||||
* @type {Map<string, PropertyDefinition>}
|
||||
*/
|
||||
#definitions = new Map();
|
||||
|
||||
/**
|
||||
* Separately track any keys that are required for faster validtion.
|
||||
* @type {Map<string, PropertyDefinition>}
|
||||
*/
|
||||
#requiredKeys = new Map();
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {ObjectDefinition} definitions The schema definitions.
|
||||
* @throws {Error} When the definitions are missing or invalid.
|
||||
*/
|
||||
constructor(definitions) {
|
||||
if (!definitions) {
|
||||
throw new Error("Schema definitions missing.");
|
||||
}
|
||||
|
||||
// add in all strategies
|
||||
for (const key of Object.keys(definitions)) {
|
||||
validateDefinition(key, definitions[key]);
|
||||
|
||||
// normalize merge and validate methods if subschema is present
|
||||
if (typeof definitions[key].schema === "object") {
|
||||
const schema = new ObjectSchema(definitions[key].schema);
|
||||
definitions[key] = {
|
||||
...definitions[key],
|
||||
merge(first = {}, second = {}) {
|
||||
return schema.merge(first, second);
|
||||
},
|
||||
validate(value) {
|
||||
ValidationStrategy.object(value);
|
||||
schema.validate(value);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// normalize the merge method in case there's a string
|
||||
if (typeof definitions[key].merge === "string") {
|
||||
definitions[key] = {
|
||||
...definitions[key],
|
||||
merge: MergeStrategy[
|
||||
/** @type {string} */ (definitions[key].merge)
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
// normalize the validate method in case there's a string
|
||||
if (typeof definitions[key].validate === "string") {
|
||||
definitions[key] = {
|
||||
...definitions[key],
|
||||
validate:
|
||||
ValidationStrategy[
|
||||
/** @type {string} */ (definitions[key].validate)
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
this.#definitions.set(key, definitions[key]);
|
||||
|
||||
if (definitions[key].required) {
|
||||
this.#requiredKeys.set(key, definitions[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a strategy has been registered for the given object key.
|
||||
* @param {string} key The object key to find a strategy for.
|
||||
* @returns {boolean} True if the key has a strategy registered, false if not.
|
||||
*/
|
||||
hasKey(key) {
|
||||
return this.#definitions.has(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges objects together to create a new object comprised of the keys
|
||||
* of the all objects. Keys are merged based on the each key's merge
|
||||
* strategy.
|
||||
* @param {...Object} objects The objects to merge.
|
||||
* @returns {Object} A new object with a mix of all objects' keys.
|
||||
* @throws {TypeError} If any object is invalid.
|
||||
*/
|
||||
merge(...objects) {
|
||||
// double check arguments
|
||||
if (objects.length < 2) {
|
||||
throw new TypeError("merge() requires at least two arguments.");
|
||||
}
|
||||
|
||||
if (
|
||||
objects.some(
|
||||
object => object === null || typeof object !== "object",
|
||||
)
|
||||
) {
|
||||
throw new TypeError("All arguments must be objects.");
|
||||
}
|
||||
|
||||
return objects.reduce((result, object) => {
|
||||
this.validate(object);
|
||||
|
||||
for (const [key, strategy] of this.#definitions) {
|
||||
try {
|
||||
if (key in result || key in object) {
|
||||
const merge = /** @type {Function} */ (strategy.merge);
|
||||
const value = merge.call(
|
||||
this,
|
||||
result[key],
|
||||
object[key],
|
||||
);
|
||||
if (value !== undefined) {
|
||||
result[key] = value;
|
||||
}
|
||||
}
|
||||
} catch (ex) {
|
||||
throw new WrapperError(key, ex);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}, {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates an object's keys based on the validate strategy for each key.
|
||||
* @param {Object} object The object to validate.
|
||||
* @returns {void}
|
||||
* @throws {Error} When the object is invalid.
|
||||
*/
|
||||
validate(object) {
|
||||
// check existing keys first
|
||||
for (const key of Object.keys(object)) {
|
||||
// check to see if the key is defined
|
||||
if (!this.hasKey(key)) {
|
||||
throw new UnexpectedKeyError(key);
|
||||
}
|
||||
|
||||
// validate existing keys
|
||||
const definition = this.#definitions.get(key);
|
||||
|
||||
// first check to see if any other keys are required
|
||||
if (Array.isArray(definition.requires)) {
|
||||
if (
|
||||
!definition.requires.every(otherKey => otherKey in object)
|
||||
) {
|
||||
throw new MissingDependentKeysError(
|
||||
key,
|
||||
definition.requires,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// now apply remaining validation strategy
|
||||
try {
|
||||
const validate = /** @type {Function} */ (definition.validate);
|
||||
validate.call(definition, object[key]);
|
||||
} catch (ex) {
|
||||
throw new WrapperError(key, ex);
|
||||
}
|
||||
}
|
||||
|
||||
// ensure required keys aren't missing
|
||||
for (const [key] of this.#requiredKeys) {
|
||||
if (!(key in object)) {
|
||||
throw new MissingKeyError(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.MergeStrategy = MergeStrategy;
|
||||
exports.ObjectSchema = ObjectSchema;
|
||||
exports.ValidationStrategy = ValidationStrategy;
|
||||
125
frontend/node_modules/@eslint/object-schema/dist/cjs/index.d.cts
generated
vendored
125
frontend/node_modules/@eslint/object-schema/dist/cjs/index.d.cts
generated
vendored
@@ -1,125 +0,0 @@
|
||||
export type ObjectDefinition = $typests.ObjectDefinition;
|
||||
export type PropertyDefinition = $typests.PropertyDefinition;
|
||||
/**
|
||||
* @fileoverview Merge Strategy
|
||||
*/
|
||||
/**
|
||||
* Container class for several different merge strategies.
|
||||
*/
|
||||
export class MergeStrategy {
|
||||
/**
|
||||
* Merges two keys by overwriting the first with the second.
|
||||
* @param {*} value1 The value from the first object key.
|
||||
* @param {*} value2 The value from the second object key.
|
||||
* @returns {*} The second value.
|
||||
*/
|
||||
static overwrite(value1: any, value2: any): any;
|
||||
/**
|
||||
* Merges two keys by replacing the first with the second only if the
|
||||
* second is defined.
|
||||
* @param {*} value1 The value from the first object key.
|
||||
* @param {*} value2 The value from the second object key.
|
||||
* @returns {*} The second value if it is defined.
|
||||
*/
|
||||
static replace(value1: any, value2: any): any;
|
||||
/**
|
||||
* Merges two properties by assigning properties from the second to the first.
|
||||
* @param {*} value1 The value from the first object key.
|
||||
* @param {*} value2 The value from the second object key.
|
||||
* @returns {*} A new object containing properties from both value1 and
|
||||
* value2.
|
||||
*/
|
||||
static assign(value1: any, value2: any): any;
|
||||
}
|
||||
/**
|
||||
* Represents an object validation/merging schema.
|
||||
*/
|
||||
export class ObjectSchema {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {ObjectDefinition} definitions The schema definitions.
|
||||
* @throws {Error} When the definitions are missing or invalid.
|
||||
*/
|
||||
constructor(definitions: ObjectDefinition);
|
||||
/**
|
||||
* Determines if a strategy has been registered for the given object key.
|
||||
* @param {string} key The object key to find a strategy for.
|
||||
* @returns {boolean} True if the key has a strategy registered, false if not.
|
||||
*/
|
||||
hasKey(key: string): boolean;
|
||||
/**
|
||||
* Merges objects together to create a new object comprised of the keys
|
||||
* of the all objects. Keys are merged based on the each key's merge
|
||||
* strategy.
|
||||
* @param {...Object} objects The objects to merge.
|
||||
* @returns {Object} A new object with a mix of all objects' keys.
|
||||
* @throws {TypeError} If any object is invalid.
|
||||
*/
|
||||
merge(...objects: any[]): any;
|
||||
/**
|
||||
* Validates an object's keys based on the validate strategy for each key.
|
||||
* @param {Object} object The object to validate.
|
||||
* @returns {void}
|
||||
* @throws {Error} When the object is invalid.
|
||||
*/
|
||||
validate(object: any): void;
|
||||
#private;
|
||||
}
|
||||
/**
|
||||
* @fileoverview Validation Strategy
|
||||
*/
|
||||
/**
|
||||
* Container class for several different validation strategies.
|
||||
*/
|
||||
export class ValidationStrategy {
|
||||
/**
|
||||
* Validates that a value is an array.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static array(value: any): void;
|
||||
/**
|
||||
* Validates that a value is a boolean.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static boolean(value: any): void;
|
||||
/**
|
||||
* Validates that a value is a number.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static number(value: any): void;
|
||||
/**
|
||||
* Validates that a value is a object.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static object(value: any): void;
|
||||
/**
|
||||
* Validates that a value is a object or null.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static "object?"(value: any): void;
|
||||
/**
|
||||
* Validates that a value is a string.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static string(value: any): void;
|
||||
/**
|
||||
* Validates that a value is a non-empty string.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static "string!"(value: any): void;
|
||||
}
|
||||
import type * as $typests from "./types.cts";
|
||||
57
frontend/node_modules/@eslint/object-schema/dist/cjs/types.cts
generated
vendored
57
frontend/node_modules/@eslint/object-schema/dist/cjs/types.cts
generated
vendored
@@ -1,57 +0,0 @@
|
||||
/**
|
||||
* @fileoverview Types for object-schema package.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Built-in validation strategies.
|
||||
*/
|
||||
export type BuiltInValidationStrategy =
|
||||
| "array"
|
||||
| "boolean"
|
||||
| "number"
|
||||
| "object"
|
||||
| "object?"
|
||||
| "string"
|
||||
| "string!";
|
||||
|
||||
/**
|
||||
* Built-in merge strategies.
|
||||
*/
|
||||
export type BuiltInMergeStrategy = "assign" | "overwrite" | "replace";
|
||||
|
||||
/**
|
||||
* Property definition.
|
||||
*/
|
||||
export interface PropertyDefinition {
|
||||
/**
|
||||
* Indicates if the property is required.
|
||||
*/
|
||||
required: boolean;
|
||||
|
||||
/**
|
||||
* The other properties that must be present when this property is used.
|
||||
*/
|
||||
requires?: string[];
|
||||
|
||||
/**
|
||||
* The strategy to merge the property.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/eslint/rewrite/pull/90#discussion_r1687206213
|
||||
merge: BuiltInMergeStrategy | ((target: any, source: any) => any);
|
||||
|
||||
/**
|
||||
* The strategy to validate the property.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/eslint/rewrite/pull/90#discussion_r1687206213
|
||||
validate: BuiltInValidationStrategy | ((value: any) => void);
|
||||
|
||||
/**
|
||||
* The schema for the object value of this property.
|
||||
*/
|
||||
schema?: ObjectDefinition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Object definition.
|
||||
*/
|
||||
export type ObjectDefinition = Record<string, PropertyDefinition>;
|
||||
125
frontend/node_modules/@eslint/object-schema/dist/esm/index.d.ts
generated
vendored
125
frontend/node_modules/@eslint/object-schema/dist/esm/index.d.ts
generated
vendored
@@ -1,125 +0,0 @@
|
||||
export type ObjectDefinition = $typests.ObjectDefinition;
|
||||
export type PropertyDefinition = $typests.PropertyDefinition;
|
||||
/**
|
||||
* @fileoverview Merge Strategy
|
||||
*/
|
||||
/**
|
||||
* Container class for several different merge strategies.
|
||||
*/
|
||||
export class MergeStrategy {
|
||||
/**
|
||||
* Merges two keys by overwriting the first with the second.
|
||||
* @param {*} value1 The value from the first object key.
|
||||
* @param {*} value2 The value from the second object key.
|
||||
* @returns {*} The second value.
|
||||
*/
|
||||
static overwrite(value1: any, value2: any): any;
|
||||
/**
|
||||
* Merges two keys by replacing the first with the second only if the
|
||||
* second is defined.
|
||||
* @param {*} value1 The value from the first object key.
|
||||
* @param {*} value2 The value from the second object key.
|
||||
* @returns {*} The second value if it is defined.
|
||||
*/
|
||||
static replace(value1: any, value2: any): any;
|
||||
/**
|
||||
* Merges two properties by assigning properties from the second to the first.
|
||||
* @param {*} value1 The value from the first object key.
|
||||
* @param {*} value2 The value from the second object key.
|
||||
* @returns {*} A new object containing properties from both value1 and
|
||||
* value2.
|
||||
*/
|
||||
static assign(value1: any, value2: any): any;
|
||||
}
|
||||
/**
|
||||
* Represents an object validation/merging schema.
|
||||
*/
|
||||
export class ObjectSchema {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {ObjectDefinition} definitions The schema definitions.
|
||||
* @throws {Error} When the definitions are missing or invalid.
|
||||
*/
|
||||
constructor(definitions: ObjectDefinition);
|
||||
/**
|
||||
* Determines if a strategy has been registered for the given object key.
|
||||
* @param {string} key The object key to find a strategy for.
|
||||
* @returns {boolean} True if the key has a strategy registered, false if not.
|
||||
*/
|
||||
hasKey(key: string): boolean;
|
||||
/**
|
||||
* Merges objects together to create a new object comprised of the keys
|
||||
* of the all objects. Keys are merged based on the each key's merge
|
||||
* strategy.
|
||||
* @param {...Object} objects The objects to merge.
|
||||
* @returns {Object} A new object with a mix of all objects' keys.
|
||||
* @throws {TypeError} If any object is invalid.
|
||||
*/
|
||||
merge(...objects: any[]): any;
|
||||
/**
|
||||
* Validates an object's keys based on the validate strategy for each key.
|
||||
* @param {Object} object The object to validate.
|
||||
* @returns {void}
|
||||
* @throws {Error} When the object is invalid.
|
||||
*/
|
||||
validate(object: any): void;
|
||||
#private;
|
||||
}
|
||||
/**
|
||||
* @fileoverview Validation Strategy
|
||||
*/
|
||||
/**
|
||||
* Container class for several different validation strategies.
|
||||
*/
|
||||
export class ValidationStrategy {
|
||||
/**
|
||||
* Validates that a value is an array.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static array(value: any): void;
|
||||
/**
|
||||
* Validates that a value is a boolean.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static boolean(value: any): void;
|
||||
/**
|
||||
* Validates that a value is a number.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static number(value: any): void;
|
||||
/**
|
||||
* Validates that a value is a object.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static object(value: any): void;
|
||||
/**
|
||||
* Validates that a value is a object or null.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static "object?"(value: any): void;
|
||||
/**
|
||||
* Validates that a value is a string.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static string(value: any): void;
|
||||
/**
|
||||
* Validates that a value is a non-empty string.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static "string!"(value: any): void;
|
||||
}
|
||||
import type * as $typests from "./types.ts";
|
||||
454
frontend/node_modules/@eslint/object-schema/dist/esm/index.js
generated
vendored
454
frontend/node_modules/@eslint/object-schema/dist/esm/index.js
generated
vendored
@@ -1,454 +0,0 @@
|
||||
// @ts-self-types="./index.d.ts"
|
||||
/**
|
||||
* @fileoverview Merge Strategy
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Class
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Container class for several different merge strategies.
|
||||
*/
|
||||
class MergeStrategy {
|
||||
/**
|
||||
* Merges two keys by overwriting the first with the second.
|
||||
* @param {*} value1 The value from the first object key.
|
||||
* @param {*} value2 The value from the second object key.
|
||||
* @returns {*} The second value.
|
||||
*/
|
||||
static overwrite(value1, value2) {
|
||||
return value2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges two keys by replacing the first with the second only if the
|
||||
* second is defined.
|
||||
* @param {*} value1 The value from the first object key.
|
||||
* @param {*} value2 The value from the second object key.
|
||||
* @returns {*} The second value if it is defined.
|
||||
*/
|
||||
static replace(value1, value2) {
|
||||
if (typeof value2 !== "undefined") {
|
||||
return value2;
|
||||
}
|
||||
|
||||
return value1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges two properties by assigning properties from the second to the first.
|
||||
* @param {*} value1 The value from the first object key.
|
||||
* @param {*} value2 The value from the second object key.
|
||||
* @returns {*} A new object containing properties from both value1 and
|
||||
* value2.
|
||||
*/
|
||||
static assign(value1, value2) {
|
||||
return Object.assign({}, value1, value2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @fileoverview Validation Strategy
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Class
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Container class for several different validation strategies.
|
||||
*/
|
||||
class ValidationStrategy {
|
||||
/**
|
||||
* Validates that a value is an array.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static array(value) {
|
||||
if (!Array.isArray(value)) {
|
||||
throw new TypeError("Expected an array.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that a value is a boolean.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static boolean(value) {
|
||||
if (typeof value !== "boolean") {
|
||||
throw new TypeError("Expected a Boolean.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that a value is a number.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static number(value) {
|
||||
if (typeof value !== "number") {
|
||||
throw new TypeError("Expected a number.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that a value is a object.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static object(value) {
|
||||
if (!value || typeof value !== "object") {
|
||||
throw new TypeError("Expected an object.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that a value is a object or null.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static "object?"(value) {
|
||||
if (typeof value !== "object") {
|
||||
throw new TypeError("Expected an object or null.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that a value is a string.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static string(value) {
|
||||
if (typeof value !== "string") {
|
||||
throw new TypeError("Expected a string.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that a value is a non-empty string.
|
||||
* @param {*} value The value to validate.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the value is invalid.
|
||||
*/
|
||||
static "string!"(value) {
|
||||
if (typeof value !== "string" || value.length === 0) {
|
||||
throw new TypeError("Expected a non-empty string.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @fileoverview Object Schema
|
||||
*/
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Types
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/** @import * as $typests from "./types.ts"; */
|
||||
/** @typedef {$typests.ObjectDefinition} ObjectDefinition */
|
||||
/** @typedef {$typests.PropertyDefinition} PropertyDefinition */
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Private
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Validates a schema strategy.
|
||||
* @param {string} name The name of the key this strategy is for.
|
||||
* @param {PropertyDefinition} definition The strategy for the object key.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} When the strategy is missing a name.
|
||||
* @throws {TypeError} When the strategy is missing a merge() method.
|
||||
* @throws {TypeError} When the strategy is missing a validate() method.
|
||||
*/
|
||||
function validateDefinition(name, definition) {
|
||||
let hasSchema = false;
|
||||
if (definition.schema) {
|
||||
if (typeof definition.schema === "object") {
|
||||
hasSchema = true;
|
||||
} else {
|
||||
throw new TypeError("Schema must be an object.");
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof definition.merge === "string") {
|
||||
if (!(definition.merge in MergeStrategy)) {
|
||||
throw new TypeError(
|
||||
`Definition for key "${name}" missing valid merge strategy.`,
|
||||
);
|
||||
}
|
||||
} else if (!hasSchema && typeof definition.merge !== "function") {
|
||||
throw new TypeError(
|
||||
`Definition for key "${name}" must have a merge property.`,
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof definition.validate === "string") {
|
||||
if (!(definition.validate in ValidationStrategy)) {
|
||||
throw new TypeError(
|
||||
`Definition for key "${name}" missing valid validation strategy.`,
|
||||
);
|
||||
}
|
||||
} else if (!hasSchema && typeof definition.validate !== "function") {
|
||||
throw new TypeError(
|
||||
`Definition for key "${name}" must have a validate() method.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Errors
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Error when an unexpected key is found.
|
||||
*/
|
||||
class UnexpectedKeyError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} key The key that was unexpected.
|
||||
*/
|
||||
constructor(key) {
|
||||
super(`Unexpected key "${key}" found.`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Error when a required key is missing.
|
||||
*/
|
||||
class MissingKeyError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} key The key that was missing.
|
||||
*/
|
||||
constructor(key) {
|
||||
super(`Missing required key "${key}".`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Error when a key requires other keys that are missing.
|
||||
*/
|
||||
class MissingDependentKeysError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} key The key that was unexpected.
|
||||
* @param {Array<string>} requiredKeys The keys that are required.
|
||||
*/
|
||||
constructor(key, requiredKeys) {
|
||||
super(`Key "${key}" requires keys "${requiredKeys.join('", "')}".`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper error for errors occuring during a merge or validate operation.
|
||||
*/
|
||||
class WrapperError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} key The object key causing the error.
|
||||
* @param {Error} source The source error.
|
||||
*/
|
||||
constructor(key, source) {
|
||||
super(`Key "${key}": ${source.message}`, { cause: source });
|
||||
|
||||
// copy over custom properties that aren't represented
|
||||
for (const sourceKey of Object.keys(source)) {
|
||||
if (!(sourceKey in this)) {
|
||||
this[sourceKey] = source[sourceKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Main
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Represents an object validation/merging schema.
|
||||
*/
|
||||
class ObjectSchema {
|
||||
/**
|
||||
* Track all definitions in the schema by key.
|
||||
* @type {Map<string, PropertyDefinition>}
|
||||
*/
|
||||
#definitions = new Map();
|
||||
|
||||
/**
|
||||
* Separately track any keys that are required for faster validtion.
|
||||
* @type {Map<string, PropertyDefinition>}
|
||||
*/
|
||||
#requiredKeys = new Map();
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {ObjectDefinition} definitions The schema definitions.
|
||||
* @throws {Error} When the definitions are missing or invalid.
|
||||
*/
|
||||
constructor(definitions) {
|
||||
if (!definitions) {
|
||||
throw new Error("Schema definitions missing.");
|
||||
}
|
||||
|
||||
// add in all strategies
|
||||
for (const key of Object.keys(definitions)) {
|
||||
validateDefinition(key, definitions[key]);
|
||||
|
||||
// normalize merge and validate methods if subschema is present
|
||||
if (typeof definitions[key].schema === "object") {
|
||||
const schema = new ObjectSchema(definitions[key].schema);
|
||||
definitions[key] = {
|
||||
...definitions[key],
|
||||
merge(first = {}, second = {}) {
|
||||
return schema.merge(first, second);
|
||||
},
|
||||
validate(value) {
|
||||
ValidationStrategy.object(value);
|
||||
schema.validate(value);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// normalize the merge method in case there's a string
|
||||
if (typeof definitions[key].merge === "string") {
|
||||
definitions[key] = {
|
||||
...definitions[key],
|
||||
merge: MergeStrategy[
|
||||
/** @type {string} */ (definitions[key].merge)
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
// normalize the validate method in case there's a string
|
||||
if (typeof definitions[key].validate === "string") {
|
||||
definitions[key] = {
|
||||
...definitions[key],
|
||||
validate:
|
||||
ValidationStrategy[
|
||||
/** @type {string} */ (definitions[key].validate)
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
this.#definitions.set(key, definitions[key]);
|
||||
|
||||
if (definitions[key].required) {
|
||||
this.#requiredKeys.set(key, definitions[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a strategy has been registered for the given object key.
|
||||
* @param {string} key The object key to find a strategy for.
|
||||
* @returns {boolean} True if the key has a strategy registered, false if not.
|
||||
*/
|
||||
hasKey(key) {
|
||||
return this.#definitions.has(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges objects together to create a new object comprised of the keys
|
||||
* of the all objects. Keys are merged based on the each key's merge
|
||||
* strategy.
|
||||
* @param {...Object} objects The objects to merge.
|
||||
* @returns {Object} A new object with a mix of all objects' keys.
|
||||
* @throws {TypeError} If any object is invalid.
|
||||
*/
|
||||
merge(...objects) {
|
||||
// double check arguments
|
||||
if (objects.length < 2) {
|
||||
throw new TypeError("merge() requires at least two arguments.");
|
||||
}
|
||||
|
||||
if (
|
||||
objects.some(
|
||||
object => object === null || typeof object !== "object",
|
||||
)
|
||||
) {
|
||||
throw new TypeError("All arguments must be objects.");
|
||||
}
|
||||
|
||||
return objects.reduce((result, object) => {
|
||||
this.validate(object);
|
||||
|
||||
for (const [key, strategy] of this.#definitions) {
|
||||
try {
|
||||
if (key in result || key in object) {
|
||||
const merge = /** @type {Function} */ (strategy.merge);
|
||||
const value = merge.call(
|
||||
this,
|
||||
result[key],
|
||||
object[key],
|
||||
);
|
||||
if (value !== undefined) {
|
||||
result[key] = value;
|
||||
}
|
||||
}
|
||||
} catch (ex) {
|
||||
throw new WrapperError(key, ex);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}, {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates an object's keys based on the validate strategy for each key.
|
||||
* @param {Object} object The object to validate.
|
||||
* @returns {void}
|
||||
* @throws {Error} When the object is invalid.
|
||||
*/
|
||||
validate(object) {
|
||||
// check existing keys first
|
||||
for (const key of Object.keys(object)) {
|
||||
// check to see if the key is defined
|
||||
if (!this.hasKey(key)) {
|
||||
throw new UnexpectedKeyError(key);
|
||||
}
|
||||
|
||||
// validate existing keys
|
||||
const definition = this.#definitions.get(key);
|
||||
|
||||
// first check to see if any other keys are required
|
||||
if (Array.isArray(definition.requires)) {
|
||||
if (
|
||||
!definition.requires.every(otherKey => otherKey in object)
|
||||
) {
|
||||
throw new MissingDependentKeysError(
|
||||
key,
|
||||
definition.requires,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// now apply remaining validation strategy
|
||||
try {
|
||||
const validate = /** @type {Function} */ (definition.validate);
|
||||
validate.call(definition, object[key]);
|
||||
} catch (ex) {
|
||||
throw new WrapperError(key, ex);
|
||||
}
|
||||
}
|
||||
|
||||
// ensure required keys aren't missing
|
||||
for (const [key] of this.#requiredKeys) {
|
||||
if (!(key in object)) {
|
||||
throw new MissingKeyError(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { MergeStrategy, ObjectSchema, ValidationStrategy };
|
||||
40
frontend/node_modules/@eslint/object-schema/dist/esm/types.d.ts
generated
vendored
40
frontend/node_modules/@eslint/object-schema/dist/esm/types.d.ts
generated
vendored
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* @fileoverview Types for object-schema package.
|
||||
*/
|
||||
/**
|
||||
* Built-in validation strategies.
|
||||
*/
|
||||
export type BuiltInValidationStrategy = "array" | "boolean" | "number" | "object" | "object?" | "string" | "string!";
|
||||
/**
|
||||
* Built-in merge strategies.
|
||||
*/
|
||||
export type BuiltInMergeStrategy = "assign" | "overwrite" | "replace";
|
||||
/**
|
||||
* Property definition.
|
||||
*/
|
||||
export interface PropertyDefinition {
|
||||
/**
|
||||
* Indicates if the property is required.
|
||||
*/
|
||||
required: boolean;
|
||||
/**
|
||||
* The other properties that must be present when this property is used.
|
||||
*/
|
||||
requires?: string[];
|
||||
/**
|
||||
* The strategy to merge the property.
|
||||
*/
|
||||
merge: BuiltInMergeStrategy | ((target: any, source: any) => any);
|
||||
/**
|
||||
* The strategy to validate the property.
|
||||
*/
|
||||
validate: BuiltInValidationStrategy | ((value: any) => void);
|
||||
/**
|
||||
* The schema for the object value of this property.
|
||||
*/
|
||||
schema?: ObjectDefinition;
|
||||
}
|
||||
/**
|
||||
* Object definition.
|
||||
*/
|
||||
export type ObjectDefinition = Record<string, PropertyDefinition>;
|
||||
57
frontend/node_modules/@eslint/object-schema/dist/esm/types.ts
generated
vendored
57
frontend/node_modules/@eslint/object-schema/dist/esm/types.ts
generated
vendored
@@ -1,57 +0,0 @@
|
||||
/**
|
||||
* @fileoverview Types for object-schema package.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Built-in validation strategies.
|
||||
*/
|
||||
export type BuiltInValidationStrategy =
|
||||
| "array"
|
||||
| "boolean"
|
||||
| "number"
|
||||
| "object"
|
||||
| "object?"
|
||||
| "string"
|
||||
| "string!";
|
||||
|
||||
/**
|
||||
* Built-in merge strategies.
|
||||
*/
|
||||
export type BuiltInMergeStrategy = "assign" | "overwrite" | "replace";
|
||||
|
||||
/**
|
||||
* Property definition.
|
||||
*/
|
||||
export interface PropertyDefinition {
|
||||
/**
|
||||
* Indicates if the property is required.
|
||||
*/
|
||||
required: boolean;
|
||||
|
||||
/**
|
||||
* The other properties that must be present when this property is used.
|
||||
*/
|
||||
requires?: string[];
|
||||
|
||||
/**
|
||||
* The strategy to merge the property.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/eslint/rewrite/pull/90#discussion_r1687206213
|
||||
merge: BuiltInMergeStrategy | ((target: any, source: any) => any);
|
||||
|
||||
/**
|
||||
* The strategy to validate the property.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/eslint/rewrite/pull/90#discussion_r1687206213
|
||||
validate: BuiltInValidationStrategy | ((value: any) => void);
|
||||
|
||||
/**
|
||||
* The schema for the object value of this property.
|
||||
*/
|
||||
schema?: ObjectDefinition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Object definition.
|
||||
*/
|
||||
export type ObjectDefinition = Record<string, PropertyDefinition>;
|
||||
59
frontend/node_modules/@eslint/object-schema/package.json
generated
vendored
59
frontend/node_modules/@eslint/object-schema/package.json
generated
vendored
@@ -1,59 +0,0 @@
|
||||
{
|
||||
"name": "@eslint/object-schema",
|
||||
"version": "2.1.7",
|
||||
"description": "An object schema merger/validator",
|
||||
"type": "module",
|
||||
"main": "dist/esm/index.js",
|
||||
"types": "dist/esm/index.d.ts",
|
||||
"exports": {
|
||||
"require": {
|
||||
"types": "./dist/cjs/index.d.cts",
|
||||
"default": "./dist/cjs/index.cjs"
|
||||
},
|
||||
"import": {
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"directories": {
|
||||
"test": "tests"
|
||||
},
|
||||
"scripts": {
|
||||
"build:dedupe-types": "node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js",
|
||||
"build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts",
|
||||
"build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts",
|
||||
"test": "mocha \"tests/**/*.test.js\"",
|
||||
"test:coverage": "c8 npm test",
|
||||
"test:jsr": "npx jsr@latest publish --dry-run",
|
||||
"test:types": "tsc -p tests/types/tsconfig.json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/eslint/rewrite.git",
|
||||
"directory": "packages/object-schema"
|
||||
},
|
||||
"keywords": [
|
||||
"object",
|
||||
"validation",
|
||||
"schema",
|
||||
"merge"
|
||||
],
|
||||
"author": "Nicholas C. Zakas",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/eslint/rewrite/issues"
|
||||
},
|
||||
"homepage": "https://github.com/eslint/rewrite/tree/main/packages/object-schema#readme",
|
||||
"devDependencies": {
|
||||
"rollup-plugin-copy": "^3.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
}
|
||||
}
|
||||
273
frontend/node_modules/@eslint/plugin-kit/README.md
generated
vendored
273
frontend/node_modules/@eslint/plugin-kit/README.md
generated
vendored
@@ -1,273 +0,0 @@
|
||||
# ESLint Plugin Kit
|
||||
|
||||
## Description
|
||||
|
||||
A collection of utilities to help build ESLint plugins.
|
||||
|
||||
## Installation
|
||||
|
||||
For Node.js and compatible runtimes:
|
||||
|
||||
```shell
|
||||
npm install @eslint/plugin-kit
|
||||
# or
|
||||
yarn add @eslint/plugin-kit
|
||||
# or
|
||||
pnpm install @eslint/plugin-kit
|
||||
# or
|
||||
bun add @eslint/plugin-kit
|
||||
```
|
||||
|
||||
For Deno:
|
||||
|
||||
```shell
|
||||
deno add @eslint/plugin-kit
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
This package exports the following utilities:
|
||||
|
||||
- [`ConfigCommentParser`](#configcommentparser) - used to parse ESLint configuration comments (i.e., `/* eslint-disable rule */`)
|
||||
- [`VisitNodeStep` and `CallMethodStep`](#visitnodestep-and-callmethodstep) - used to help implement `SourceCode#traverse()`
|
||||
- [`Directive`](#directive) - used to help implement `SourceCode#getDisableDirectives()`
|
||||
- [`TextSourceCodeBase`](#textsourcecodebase) - base class to help implement the `SourceCode` interface
|
||||
|
||||
### `ConfigCommentParser`
|
||||
|
||||
To use the `ConfigCommentParser` class, import it from the package and create a new instance, such as:
|
||||
|
||||
```js
|
||||
import { ConfigCommentParser } from "@eslint/plugin-kit";
|
||||
|
||||
// create a new instance
|
||||
const commentParser = new ConfigCommentParser();
|
||||
|
||||
// pass in a comment string without the comment delimiters
|
||||
const directive = commentParser.parseDirective(
|
||||
"eslint-disable prefer-const, semi -- I don't want to use these.",
|
||||
);
|
||||
|
||||
// will be undefined when a directive can't be parsed
|
||||
if (directive) {
|
||||
console.log(directive.label); // "eslint-disable"
|
||||
console.log(directive.value); // "prefer-const, semi"
|
||||
console.log(directive.justification); // "I don't want to use these."
|
||||
}
|
||||
```
|
||||
|
||||
There are different styles of directive values that you'll need to parse separately to get the correct format:
|
||||
|
||||
```js
|
||||
import { ConfigCommentParser } from "@eslint/plugin-kit";
|
||||
|
||||
// create a new instance
|
||||
const commentParser = new ConfigCommentParser();
|
||||
|
||||
// list format
|
||||
const list = commentParser.parseListConfig("prefer-const, semi");
|
||||
console.log(Object.entries(list)); // [["prefer-const", true], ["semi", true]]
|
||||
|
||||
// string format
|
||||
const strings = commentParser.parseStringConfig("foo:off, bar");
|
||||
console.log(Object.entries(strings)); // [["foo", "off"], ["bar", null]]
|
||||
|
||||
// JSON-like config format
|
||||
const jsonLike = commentParser.parseJSONLikeConfig(
|
||||
"semi:[error, never], prefer-const: warn",
|
||||
);
|
||||
console.log(Object.entries(jsonLike.config)); // [["semi", ["error", "never"]], ["prefer-const", "warn"]]
|
||||
```
|
||||
|
||||
### `VisitNodeStep` and `CallMethodStep`
|
||||
|
||||
The `VisitNodeStep` and `CallMethodStep` classes represent steps in the traversal of source code. They implement the correct interfaces to return from the `SourceCode#traverse()` method.
|
||||
|
||||
The `VisitNodeStep` class is the more common of the two, where you are describing a visit to a particular node during the traversal. The constructor accepts three arguments:
|
||||
|
||||
- `target` - the node being visited. This is used to determine the method to call inside of a rule. For instance, if the node's type is `Literal` then ESLint will call a method named `Literal()` on the rule (if present).
|
||||
- `phase` - either 1 for enter or 2 for exit.
|
||||
- `args` - an array of arguments to pass into the visitor method of a rule.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
import { VisitNodeStep } from "@eslint/plugin-kit";
|
||||
|
||||
class MySourceCode {
|
||||
traverse() {
|
||||
const steps = [];
|
||||
|
||||
for (const { node, parent, phase } of iterator(this.ast)) {
|
||||
steps.push(
|
||||
new VisitNodeStep({
|
||||
target: node,
|
||||
phase: phase === "enter" ? 1 : 2,
|
||||
args: [node, parent],
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
return steps;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The `CallMethodStep` class is less common and is used to tell ESLint to call a specific method on the rule. The constructor accepts two arguments:
|
||||
|
||||
- `target` - the name of the method to call, frequently beginning with `"on"` such as `"onCodePathStart"`.
|
||||
- `args` - an array of arguments to pass to the method.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
import { VisitNodeStep, CallMethodStep } from "@eslint/plugin-kit";
|
||||
|
||||
class MySourceCode {
|
||||
traverse() {
|
||||
const steps = [];
|
||||
|
||||
for (const { node, parent, phase } of iterator(this.ast)) {
|
||||
steps.push(
|
||||
new VisitNodeStep({
|
||||
target: node,
|
||||
phase: phase === "enter" ? 1 : 2,
|
||||
args: [node, parent],
|
||||
}),
|
||||
);
|
||||
|
||||
// call a method indicating how many times we've been through the loop
|
||||
steps.push(
|
||||
new CallMethodStep({
|
||||
target: "onIteration",
|
||||
args: [steps.length]
|
||||
});
|
||||
)
|
||||
}
|
||||
|
||||
return steps;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### `Directive`
|
||||
|
||||
The `Directive` class represents a disable directive in the source code and implements the `Directive` interface from `@eslint/core`. You can tell ESLint about disable directives using the `SourceCode#getDisableDirectives()` method, where part of the return value is an array of `Directive` objects. Here's an example:
|
||||
|
||||
```js
|
||||
import { Directive, ConfigCommentParser } from "@eslint/plugin-kit";
|
||||
|
||||
class MySourceCode {
|
||||
getDisableDirectives() {
|
||||
const directives = [];
|
||||
const problems = [];
|
||||
const commentParser = new ConfigCommentParser();
|
||||
|
||||
// read in the inline config nodes to check each one
|
||||
this.getInlineConfigNodes().forEach(comment => {
|
||||
// Step 1: Parse the directive
|
||||
const { label, value, justification } =
|
||||
commentParser.parseDirective(comment.value);
|
||||
|
||||
// Step 2: Extract the directive value and create the `Directive` object
|
||||
switch (label) {
|
||||
case "eslint-disable":
|
||||
case "eslint-enable":
|
||||
case "eslint-disable-next-line":
|
||||
case "eslint-disable-line": {
|
||||
const directiveType = label.slice("eslint-".length);
|
||||
|
||||
directives.push(
|
||||
new Directive({
|
||||
type: directiveType,
|
||||
node: comment,
|
||||
value,
|
||||
justification,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
// ignore any comments that don't begin with known labels
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
directives,
|
||||
problems,
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### `TextSourceCodeBase`
|
||||
|
||||
The `TextSourceCodeBase` class is intended to be a base class that has several of the common members found in `SourceCode` objects already implemented. Those members are:
|
||||
|
||||
- `lines` - an array of text lines that is created automatically when the constructor is called.
|
||||
- `getLoc(nodeOrToken)` - gets the location of a node or token. Works for nodes that have the ESLint-style `loc` property and nodes that have the Unist-style [`position` property](https://github.com/syntax-tree/unist?tab=readme-ov-file#position). If you're using an AST with a different location format, you'll still need to implement this method yourself.
|
||||
- `getLocFromIndex(index)` - Converts a source text index into a `{ line: number, column: number }` pair. (For this method to work, the root node should always cover the entire source code text, and the `getLoc()` method needs to be implemented correctly.)
|
||||
- `getIndexFromLoc(loc)` - Converts a `{ line: number, column: number }` pair into a source text index. (For this method to work, the root node should always cover the entire source code text, and the `getLoc()` method needs to be implemented correctly.)
|
||||
- `getRange(nodeOrToken)` - gets the range of a node or token within the source text. Works for nodes that have the ESLint-style `range` property and nodes that have the Unist-style [`position` property](https://github.com/syntax-tree/unist?tab=readme-ov-file#position). If you're using an AST with a different range format, you'll still need to implement this method yourself.
|
||||
- `getText(node, beforeCount, afterCount)` - gets the source text for the given node that has range information attached. Optionally, can return additional characters before and after the given node. As long as `getRange()` is properly implemented, this method will just work.
|
||||
- `getAncestors(node)` - returns the ancestry of the node. In order for this to work, you must implement the `getParent()` method yourself.
|
||||
|
||||
Here's an example:
|
||||
|
||||
```js
|
||||
import { TextSourceCodeBase } from "@eslint/plugin-kit";
|
||||
|
||||
export class MySourceCode extends TextSourceCodeBase {
|
||||
#parents = new Map();
|
||||
|
||||
constructor({ ast, text }) {
|
||||
super({ ast, text });
|
||||
}
|
||||
|
||||
getParent(node) {
|
||||
return this.#parents.get(node);
|
||||
}
|
||||
|
||||
traverse() {
|
||||
const steps = [];
|
||||
|
||||
for (const { node, parent, phase } of iterator(this.ast)) {
|
||||
//save the parent information
|
||||
this.#parent.set(node, parent);
|
||||
|
||||
steps.push(
|
||||
new VisitNodeStep({
|
||||
target: node,
|
||||
phase: phase === "enter" ? 1 : 2,
|
||||
args: [node, parent],
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
return steps;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In general, it's safe to collect the parent information during the `traverse()` method as `getParent()` and `getAncestor()` will only be called from rules once the AST has been traversed at least once.
|
||||
|
||||
## License
|
||||
|
||||
Apache 2.0
|
||||
|
||||
<!-- NOTE: This section is autogenerated. Do not manually edit.-->
|
||||
<!--sponsorsstart-->
|
||||
|
||||
## Sponsors
|
||||
|
||||
The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)
|
||||
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
|
||||
|
||||
<h3>Platinum Sponsors</h3>
|
||||
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
|
||||
<p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a> <a href="https://shopify.engineering/"><img src="https://avatars.githubusercontent.com/u/8085" alt="Shopify" height="96"></a></p><h3>Silver Sponsors</h3>
|
||||
<p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/e6d15e1/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301" alt="American Express" height="64"></a> <a href="https://stackblitz.com"><img src="https://avatars.githubusercontent.com/u/28635252" alt="StackBlitz" height="64"></a></p><h3>Bronze Sponsors</h3>
|
||||
<p><a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://sentry.io"><img src="https://github.com/getsentry.png" alt="Sentry" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="LambdaTest" height="32"></a></p>
|
||||
<h3>Technology Sponsors</h3>
|
||||
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.
|
||||
<p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p>
|
||||
<!--sponsorsend-->
|
||||
884
frontend/node_modules/@eslint/plugin-kit/dist/cjs/index.cjs
generated
vendored
884
frontend/node_modules/@eslint/plugin-kit/dist/cjs/index.cjs
generated
vendored
@@ -1,884 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var levn = require('levn');
|
||||
|
||||
/**
|
||||
* @fileoverview Config Comment Parser
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Type Definitions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/** @import * as $eslintcore from "@eslint/core"; */
|
||||
/** @typedef {$eslintcore.RuleConfig} RuleConfig */
|
||||
/** @typedef {$eslintcore.RulesConfig} RulesConfig */
|
||||
/** @import * as $typests from "./types.ts"; */
|
||||
/** @typedef {$typests.StringConfig} StringConfig */
|
||||
/** @typedef {$typests.BooleanConfig} BooleanConfig */
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const directivesPattern = /^([a-z]+(?:-[a-z]+)*)(?:\s|$)/u;
|
||||
const validSeverities = new Set([0, 1, 2, "off", "warn", "error"]);
|
||||
|
||||
/**
|
||||
* Determines if the severity in the rule configuration is valid.
|
||||
* @param {RuleConfig} ruleConfig A rule's configuration.
|
||||
* @returns {boolean} `true` if the severity is valid, otherwise `false`.
|
||||
*/
|
||||
function isSeverityValid(ruleConfig) {
|
||||
const severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;
|
||||
return validSeverities.has(severity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if all severities in the rules configuration are valid.
|
||||
* @param {RulesConfig} rulesConfig The rules configuration to check.
|
||||
* @returns {boolean} `true` if all severities are valid, otherwise `false`.
|
||||
*/
|
||||
function isEverySeverityValid(rulesConfig) {
|
||||
return Object.values(rulesConfig).every(isSeverityValid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a directive comment.
|
||||
*/
|
||||
class DirectiveComment {
|
||||
/**
|
||||
* The label of the directive, such as "eslint", "eslint-disable", etc.
|
||||
* @type {string}
|
||||
*/
|
||||
label = "";
|
||||
|
||||
/**
|
||||
* The value of the directive (the string after the label).
|
||||
* @type {string}
|
||||
*/
|
||||
value = "";
|
||||
|
||||
/**
|
||||
* The justification of the directive (the string after the --).
|
||||
* @type {string}
|
||||
*/
|
||||
justification = "";
|
||||
|
||||
/**
|
||||
* Creates a new directive comment.
|
||||
* @param {string} label The label of the directive.
|
||||
* @param {string} value The value of the directive.
|
||||
* @param {string} justification The justification of the directive.
|
||||
*/
|
||||
constructor(label, value, justification) {
|
||||
this.label = label;
|
||||
this.value = value;
|
||||
this.justification = justification;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Object to parse ESLint configuration comments.
|
||||
*/
|
||||
class ConfigCommentParser {
|
||||
/**
|
||||
* Parses a list of "name:string_value" or/and "name" options divided by comma or
|
||||
* whitespace. Used for "global" comments.
|
||||
* @param {string} string The string to parse.
|
||||
* @returns {StringConfig} Result map object of names and string values, or null values if no value was provided.
|
||||
*/
|
||||
parseStringConfig(string) {
|
||||
const items = /** @type {StringConfig} */ ({});
|
||||
|
||||
// Collapse whitespace around `:` and `,` to make parsing easier
|
||||
const trimmedString = string
|
||||
.trim()
|
||||
.replace(/(?<!\s)\s*([:,])\s*/gu, "$1");
|
||||
|
||||
trimmedString.split(/\s|,+/u).forEach(name => {
|
||||
if (!name) {
|
||||
return;
|
||||
}
|
||||
|
||||
// value defaults to null (if not provided), e.g: "foo" => ["foo", null]
|
||||
const [key, value = null] = name.split(":");
|
||||
|
||||
items[key] = value;
|
||||
});
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a JSON-like config.
|
||||
* @param {string} string The string to parse.
|
||||
* @returns {({ok: true, config: RulesConfig}|{ok: false, error: {message: string}})} Result map object
|
||||
*/
|
||||
parseJSONLikeConfig(string) {
|
||||
// Parses a JSON-like comment by the same way as parsing CLI option.
|
||||
try {
|
||||
const items =
|
||||
/** @type {RulesConfig} */ (levn.parse("Object", string)) || {};
|
||||
|
||||
/*
|
||||
* When the configuration has any invalid severities, it should be completely
|
||||
* ignored. This is because the configuration is not valid and should not be
|
||||
* applied.
|
||||
*
|
||||
* For example, the following configuration is invalid:
|
||||
*
|
||||
* "no-alert: 2 no-console: 2"
|
||||
*
|
||||
* This results in a configuration of { "no-alert": "2 no-console: 2" }, which is
|
||||
* not valid. In this case, the configuration should be ignored.
|
||||
*/
|
||||
if (isEverySeverityValid(items)) {
|
||||
return {
|
||||
ok: true,
|
||||
config: items,
|
||||
};
|
||||
}
|
||||
} catch {
|
||||
// levn parsing error: ignore to parse the string by a fallback.
|
||||
}
|
||||
|
||||
/*
|
||||
* Optionator cannot parse commaless notations.
|
||||
* But we are supporting that. So this is a fallback for that.
|
||||
*/
|
||||
const normalizedString = string
|
||||
.replace(/(?<![-a-zA-Z0-9/])([-a-zA-Z0-9/]+):/gu, '"$1":')
|
||||
.replace(/([\]0-9])\s+(?=")/u, "$1,");
|
||||
|
||||
try {
|
||||
const items = JSON.parse(`{${normalizedString}}`);
|
||||
|
||||
return {
|
||||
ok: true,
|
||||
config: items,
|
||||
};
|
||||
} catch (ex) {
|
||||
const errorMessage = ex instanceof Error ? ex.message : String(ex);
|
||||
|
||||
return {
|
||||
ok: false,
|
||||
error: {
|
||||
message: `Failed to parse JSON from '${normalizedString}': ${errorMessage}`,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a config of values separated by comma.
|
||||
* @param {string} string The string to parse.
|
||||
* @returns {BooleanConfig} Result map of values and true values
|
||||
*/
|
||||
parseListConfig(string) {
|
||||
const items = /** @type {BooleanConfig} */ ({});
|
||||
|
||||
string.split(",").forEach(name => {
|
||||
const trimmedName = name
|
||||
.trim()
|
||||
.replace(
|
||||
/^(?<quote>['"]?)(?<ruleId>.*)\k<quote>$/su,
|
||||
"$<ruleId>",
|
||||
);
|
||||
|
||||
if (trimmedName) {
|
||||
items[trimmedName] = true;
|
||||
}
|
||||
});
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the directive and the justification from a given directive comment and trim them.
|
||||
* @param {string} value The comment text to extract.
|
||||
* @returns {{directivePart: string, justificationPart: string}} The extracted directive and justification.
|
||||
*/
|
||||
#extractDirectiveComment(value) {
|
||||
const match = /\s-{2,}\s/u.exec(value);
|
||||
|
||||
if (!match) {
|
||||
return { directivePart: value.trim(), justificationPart: "" };
|
||||
}
|
||||
|
||||
const directive = value.slice(0, match.index).trim();
|
||||
const justification = value.slice(match.index + match[0].length).trim();
|
||||
|
||||
return { directivePart: directive, justificationPart: justification };
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a directive comment into directive text and value.
|
||||
* @param {string} string The string with the directive to be parsed.
|
||||
* @returns {DirectiveComment|undefined} The parsed directive or `undefined` if the directive is invalid.
|
||||
*/
|
||||
parseDirective(string) {
|
||||
const { directivePart, justificationPart } =
|
||||
this.#extractDirectiveComment(string);
|
||||
const match = directivesPattern.exec(directivePart);
|
||||
|
||||
if (!match) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const directiveText = match[1];
|
||||
const directiveValue = directivePart.slice(
|
||||
match.index + directiveText.length,
|
||||
);
|
||||
|
||||
return new DirectiveComment(
|
||||
directiveText,
|
||||
directiveValue.trim(),
|
||||
justificationPart,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @fileoverview A collection of helper classes for implementing `SourceCode`.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
/* eslint class-methods-use-this: off -- Required to complete interface. */
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Type Definitions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/** @typedef {$eslintcore.VisitTraversalStep} VisitTraversalStep */
|
||||
/** @typedef {$eslintcore.CallTraversalStep} CallTraversalStep */
|
||||
/** @typedef {$eslintcore.TraversalStep} TraversalStep */
|
||||
/** @typedef {$eslintcore.SourceLocation} SourceLocation */
|
||||
/** @typedef {$eslintcore.SourceLocationWithOffset} SourceLocationWithOffset */
|
||||
/** @typedef {$eslintcore.SourceRange} SourceRange */
|
||||
/** @typedef {$eslintcore.Directive} IDirective */
|
||||
/** @typedef {$eslintcore.DirectiveType} DirectiveType */
|
||||
/** @typedef {$eslintcore.SourceCodeBaseTypeOptions} SourceCodeBaseTypeOptions */
|
||||
/**
|
||||
* @typedef {import("@eslint/core").TextSourceCode<Options>} TextSourceCode<Options>
|
||||
* @template {SourceCodeBaseTypeOptions} [Options=SourceCodeBaseTypeOptions]
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Determines if a node has ESTree-style loc information.
|
||||
* @param {object} node The node to check.
|
||||
* @returns {node is {loc:SourceLocation}} `true` if the node has ESTree-style loc information, `false` if not.
|
||||
*/
|
||||
function hasESTreeStyleLoc(node) {
|
||||
return "loc" in node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a node has position-style loc information.
|
||||
* @param {object} node The node to check.
|
||||
* @returns {node is {position:SourceLocation}} `true` if the node has position-style range information, `false` if not.
|
||||
*/
|
||||
function hasPosStyleLoc(node) {
|
||||
return "position" in node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a node has ESTree-style range information.
|
||||
* @param {object} node The node to check.
|
||||
* @returns {node is {range:SourceRange}} `true` if the node has ESTree-style range information, `false` if not.
|
||||
*/
|
||||
function hasESTreeStyleRange(node) {
|
||||
return "range" in node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a node has position-style range information.
|
||||
* @param {object} node The node to check.
|
||||
* @returns {node is {position:SourceLocationWithOffset}} `true` if the node has position-style range information, `false` if not.
|
||||
*/
|
||||
function hasPosStyleRange(node) {
|
||||
return "position" in node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs binary search to find the line number containing a given target index.
|
||||
* Returns the lower bound - the index of the first element greater than the target.
|
||||
* **Please note that the `lineStartIndices` should be sorted in ascending order**.
|
||||
* - Time Complexity: O(log n) - Significantly faster than linear search for large files.
|
||||
* @param {number[]} lineStartIndices Sorted array of line start indices.
|
||||
* @param {number} targetIndex The target index to find the line number for.
|
||||
* @returns {number} The line number for the target index.
|
||||
*/
|
||||
function findLineNumberBinarySearch(lineStartIndices, targetIndex) {
|
||||
let low = 0;
|
||||
let high = lineStartIndices.length - 1;
|
||||
|
||||
while (low < high) {
|
||||
const mid = ((low + high) / 2) | 0; // Use bitwise OR to floor the division.
|
||||
|
||||
if (targetIndex < lineStartIndices[mid]) {
|
||||
high = mid;
|
||||
} else {
|
||||
low = mid + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return low;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* A class to represent a step in the traversal process where a node is visited.
|
||||
* @implements {VisitTraversalStep}
|
||||
*/
|
||||
class VisitNodeStep {
|
||||
/**
|
||||
* The type of the step.
|
||||
* @type {"visit"}
|
||||
* @readonly
|
||||
*/
|
||||
type = "visit";
|
||||
|
||||
/**
|
||||
* The kind of the step. Represents the same data as the `type` property
|
||||
* but it's a number for performance.
|
||||
* @type {1}
|
||||
* @readonly
|
||||
*/
|
||||
kind = 1;
|
||||
|
||||
/**
|
||||
* The target of the step.
|
||||
* @type {object}
|
||||
*/
|
||||
target;
|
||||
|
||||
/**
|
||||
* The phase of the step.
|
||||
* @type {1|2}
|
||||
*/
|
||||
phase;
|
||||
|
||||
/**
|
||||
* The arguments of the step.
|
||||
* @type {Array<any>}
|
||||
*/
|
||||
args;
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Object} options The options for the step.
|
||||
* @param {object} options.target The target of the step.
|
||||
* @param {1|2} options.phase The phase of the step.
|
||||
* @param {Array<any>} options.args The arguments of the step.
|
||||
*/
|
||||
constructor({ target, phase, args }) {
|
||||
this.target = target;
|
||||
this.phase = phase;
|
||||
this.args = args;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class to represent a step in the traversal process where a
|
||||
* method is called.
|
||||
* @implements {CallTraversalStep}
|
||||
*/
|
||||
class CallMethodStep {
|
||||
/**
|
||||
* The type of the step.
|
||||
* @type {"call"}
|
||||
* @readonly
|
||||
*/
|
||||
type = "call";
|
||||
|
||||
/**
|
||||
* The kind of the step. Represents the same data as the `type` property
|
||||
* but it's a number for performance.
|
||||
* @type {2}
|
||||
* @readonly
|
||||
*/
|
||||
kind = 2;
|
||||
|
||||
/**
|
||||
* The name of the method to call.
|
||||
* @type {string}
|
||||
*/
|
||||
target;
|
||||
|
||||
/**
|
||||
* The arguments to pass to the method.
|
||||
* @type {Array<any>}
|
||||
*/
|
||||
args;
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Object} options The options for the step.
|
||||
* @param {string} options.target The target of the step.
|
||||
* @param {Array<any>} options.args The arguments of the step.
|
||||
*/
|
||||
constructor({ target, args }) {
|
||||
this.target = target;
|
||||
this.args = args;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class to represent a directive comment.
|
||||
* @implements {IDirective}
|
||||
*/
|
||||
class Directive {
|
||||
/**
|
||||
* The type of directive.
|
||||
* @type {DirectiveType}
|
||||
* @readonly
|
||||
*/
|
||||
type;
|
||||
|
||||
/**
|
||||
* The node representing the directive.
|
||||
* @type {unknown}
|
||||
* @readonly
|
||||
*/
|
||||
node;
|
||||
|
||||
/**
|
||||
* Everything after the "eslint-disable" portion of the directive,
|
||||
* but before the "--" that indicates the justification.
|
||||
* @type {string}
|
||||
* @readonly
|
||||
*/
|
||||
value;
|
||||
|
||||
/**
|
||||
* The justification for the directive.
|
||||
* @type {string}
|
||||
* @readonly
|
||||
*/
|
||||
justification;
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Object} options The options for the directive.
|
||||
* @param {"disable"|"enable"|"disable-next-line"|"disable-line"} options.type The type of directive.
|
||||
* @param {unknown} options.node The node representing the directive.
|
||||
* @param {string} options.value The value of the directive.
|
||||
* @param {string} options.justification The justification for the directive.
|
||||
*/
|
||||
constructor({ type, node, value, justification }) {
|
||||
this.type = type;
|
||||
this.node = node;
|
||||
this.value = value;
|
||||
this.justification = justification;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Source Code Base Object
|
||||
* @template {SourceCodeBaseTypeOptions & {RootNode: object, SyntaxElementWithLoc: object}} [Options=SourceCodeBaseTypeOptions & {RootNode: object, SyntaxElementWithLoc: object}]
|
||||
* @implements {TextSourceCode<Options>}
|
||||
*/
|
||||
class TextSourceCodeBase {
|
||||
/**
|
||||
* The lines of text in the source code.
|
||||
* @type {Array<string>}
|
||||
*/
|
||||
#lines = [];
|
||||
|
||||
/**
|
||||
* The indices of the start of each line in the source code.
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
#lineStartIndices = [0];
|
||||
|
||||
/**
|
||||
* The pattern to match lineEndings in the source code.
|
||||
* @type {RegExp}
|
||||
*/
|
||||
#lineEndingPattern;
|
||||
|
||||
/**
|
||||
* The AST of the source code.
|
||||
* @type {Options['RootNode']}
|
||||
*/
|
||||
ast;
|
||||
|
||||
/**
|
||||
* The text of the source code.
|
||||
* @type {string}
|
||||
*/
|
||||
text;
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Object} options The options for the instance.
|
||||
* @param {string} options.text The source code text.
|
||||
* @param {Options['RootNode']} options.ast The root AST node.
|
||||
* @param {RegExp} [options.lineEndingPattern] The pattern to match lineEndings in the source code. Defaults to `/\r?\n/u`.
|
||||
*/
|
||||
constructor({ text, ast, lineEndingPattern = /\r?\n/u }) {
|
||||
this.ast = ast;
|
||||
this.text = text;
|
||||
// Remove the global(`g`) and sticky(`y`) flags from the `lineEndingPattern` to avoid issues with lastIndex.
|
||||
this.#lineEndingPattern = new RegExp(
|
||||
lineEndingPattern.source,
|
||||
lineEndingPattern.flags.replace(/[gy]/gu, ""),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the next line in the source text and updates `#lines` and `#lineStartIndices`.
|
||||
* @param {string} text The text to search for the next line.
|
||||
* @returns {boolean} `true` if a next line was found, `false` otherwise.
|
||||
*/
|
||||
#findNextLine(text) {
|
||||
const match = this.#lineEndingPattern.exec(text);
|
||||
|
||||
if (!match) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.#lines.push(text.slice(0, match.index));
|
||||
this.#lineStartIndices.push(
|
||||
(this.#lineStartIndices.at(-1) ?? 0) +
|
||||
match.index +
|
||||
match[0].length,
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures `#lines` is lazily calculated from the source text.
|
||||
* @returns {void}
|
||||
*/
|
||||
#ensureLines() {
|
||||
// If `#lines` has already been calculated, do nothing.
|
||||
if (this.#lines.length === this.#lineStartIndices.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (
|
||||
this.#findNextLine(this.text.slice(this.#lineStartIndices.at(-1)))
|
||||
) {
|
||||
// Continue parsing until no more matches are found.
|
||||
}
|
||||
|
||||
this.#lines.push(this.text.slice(this.#lineStartIndices.at(-1)));
|
||||
|
||||
Object.freeze(this.#lines);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures `#lineStartIndices` is lazily calculated up to the specified index.
|
||||
* @param {number} index The index of a character in a file.
|
||||
* @returns {void}
|
||||
*/
|
||||
#ensureLineStartIndicesFromIndex(index) {
|
||||
// If we've already parsed up to or beyond this index, do nothing.
|
||||
if (index <= (this.#lineStartIndices.at(-1) ?? 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (
|
||||
index > (this.#lineStartIndices.at(-1) ?? 0) &&
|
||||
this.#findNextLine(this.text.slice(this.#lineStartIndices.at(-1)))
|
||||
) {
|
||||
// Continue parsing until no more matches are found.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures `#lineStartIndices` is lazily calculated up to the specified loc.
|
||||
* @param {Object} loc A line/column location.
|
||||
* @param {number} loc.line The line number of the location. (0 or 1-indexed based on language.)
|
||||
* @param {number} lineStart The line number at which the parser starts counting.
|
||||
* @returns {void}
|
||||
*/
|
||||
#ensureLineStartIndicesFromLoc(loc, lineStart) {
|
||||
// Calculate line indices up to the potentially next line, as it is needed for the follow‑up calculation.
|
||||
const nextLocLineIndex = loc.line - lineStart + 1;
|
||||
const lastCalculatedLineIndex = this.#lineStartIndices.length - 1;
|
||||
let additionalLinesNeeded = nextLocLineIndex - lastCalculatedLineIndex;
|
||||
|
||||
// If we've already parsed up to or beyond this line, do nothing.
|
||||
if (additionalLinesNeeded <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (
|
||||
additionalLinesNeeded > 0 &&
|
||||
this.#findNextLine(this.text.slice(this.#lineStartIndices.at(-1)))
|
||||
) {
|
||||
// Continue parsing until no more matches are found or we have enough lines.
|
||||
additionalLinesNeeded -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the loc information for the given node or token.
|
||||
* @param {Options['SyntaxElementWithLoc']} nodeOrToken The node or token to get the loc information for.
|
||||
* @returns {SourceLocation} The loc information for the node or token.
|
||||
* @throws {Error} If the node or token does not have loc information.
|
||||
*/
|
||||
getLoc(nodeOrToken) {
|
||||
if (hasESTreeStyleLoc(nodeOrToken)) {
|
||||
return nodeOrToken.loc;
|
||||
}
|
||||
|
||||
if (hasPosStyleLoc(nodeOrToken)) {
|
||||
return nodeOrToken.position;
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
"Custom getLoc() method must be implemented in the subclass.",
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a source text index into a `{ line: number, column: number }` pair.
|
||||
* @param {number} index The index of a character in a file.
|
||||
* @throws {TypeError|RangeError} If non-numeric index or index out of range.
|
||||
* @returns {{line: number, column: number}} A `{ line: number, column: number }` location object with 0 or 1-indexed line and 0 or 1-indexed column based on language.
|
||||
* @public
|
||||
*/
|
||||
getLocFromIndex(index) {
|
||||
if (typeof index !== "number") {
|
||||
throw new TypeError("Expected `index` to be a number.");
|
||||
}
|
||||
|
||||
if (index < 0 || index > this.text.length) {
|
||||
throw new RangeError(
|
||||
`Index out of range (requested index ${index}, but source text has length ${this.text.length}).`,
|
||||
);
|
||||
}
|
||||
|
||||
const {
|
||||
start: { line: lineStart, column: columnStart },
|
||||
end: { line: lineEnd, column: columnEnd },
|
||||
} = this.getLoc(this.ast);
|
||||
|
||||
// If the index is at the start, return the start location of the root node.
|
||||
if (index === 0) {
|
||||
return {
|
||||
line: lineStart,
|
||||
column: columnStart,
|
||||
};
|
||||
}
|
||||
|
||||
// If the index is `this.text.length`, return the location one "spot" past the last character of the file.
|
||||
if (index === this.text.length) {
|
||||
return {
|
||||
line: lineEnd,
|
||||
column: columnEnd,
|
||||
};
|
||||
}
|
||||
|
||||
// Ensure `#lineStartIndices` are lazily calculated.
|
||||
this.#ensureLineStartIndicesFromIndex(index);
|
||||
|
||||
/*
|
||||
* To figure out which line `index` is on, determine the last place at which index could
|
||||
* be inserted into `#lineStartIndices` to keep the list sorted.
|
||||
*/
|
||||
const lineNumber =
|
||||
(index >= (this.#lineStartIndices.at(-1) ?? 0)
|
||||
? this.#lineStartIndices.length
|
||||
: findLineNumberBinarySearch(this.#lineStartIndices, index)) -
|
||||
1 +
|
||||
lineStart;
|
||||
|
||||
return {
|
||||
line: lineNumber,
|
||||
column:
|
||||
index -
|
||||
this.#lineStartIndices[lineNumber - lineStart] +
|
||||
columnStart,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a `{ line: number, column: number }` pair into a source text index.
|
||||
* @param {Object} loc A line/column location.
|
||||
* @param {number} loc.line The line number of the location. (0 or 1-indexed based on language.)
|
||||
* @param {number} loc.column The column number of the location. (0 or 1-indexed based on language.)
|
||||
* @throws {TypeError|RangeError} If `loc` is not an object with a numeric
|
||||
* `line` and `column`, if the `line` is less than or equal to zero or
|
||||
* the `line` or `column` is out of the expected range.
|
||||
* @returns {number} The index of the line/column location in a file.
|
||||
* @public
|
||||
*/
|
||||
getIndexFromLoc(loc) {
|
||||
if (
|
||||
loc === null ||
|
||||
typeof loc !== "object" ||
|
||||
typeof loc.line !== "number" ||
|
||||
typeof loc.column !== "number"
|
||||
) {
|
||||
throw new TypeError(
|
||||
"Expected `loc` to be an object with numeric `line` and `column` properties.",
|
||||
);
|
||||
}
|
||||
|
||||
const {
|
||||
start: { line: lineStart, column: columnStart },
|
||||
end: { line: lineEnd, column: columnEnd },
|
||||
} = this.getLoc(this.ast);
|
||||
|
||||
if (loc.line < lineStart || lineEnd < loc.line) {
|
||||
throw new RangeError(
|
||||
`Line number out of range (line ${loc.line} requested). Valid range: ${lineStart}-${lineEnd}`,
|
||||
);
|
||||
}
|
||||
|
||||
// If the loc is at the start, return the start index of the root node.
|
||||
if (loc.line === lineStart && loc.column === columnStart) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// If the loc is at the end, return the index one "spot" past the last character of the file.
|
||||
if (loc.line === lineEnd && loc.column === columnEnd) {
|
||||
return this.text.length;
|
||||
}
|
||||
|
||||
// Ensure `#lineStartIndices` are lazily calculated.
|
||||
this.#ensureLineStartIndicesFromLoc(loc, lineStart);
|
||||
|
||||
const isLastLine = loc.line === lineEnd;
|
||||
const lineStartIndex = this.#lineStartIndices[loc.line - lineStart];
|
||||
const lineEndIndex = isLastLine
|
||||
? this.text.length
|
||||
: this.#lineStartIndices[loc.line - lineStart + 1];
|
||||
const positionIndex = lineStartIndex + loc.column - columnStart;
|
||||
|
||||
if (
|
||||
loc.column < columnStart ||
|
||||
(isLastLine && positionIndex > lineEndIndex) ||
|
||||
(!isLastLine && positionIndex >= lineEndIndex)
|
||||
) {
|
||||
throw new RangeError(
|
||||
`Column number out of range (column ${loc.column} requested). Valid range for line ${loc.line}: ${columnStart}-${lineEndIndex - lineStartIndex + columnStart + (isLastLine ? 0 : -1)}`,
|
||||
);
|
||||
}
|
||||
|
||||
return positionIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the range information for the given node or token.
|
||||
* @param {Options['SyntaxElementWithLoc']} nodeOrToken The node or token to get the range information for.
|
||||
* @returns {SourceRange} The range information for the node or token.
|
||||
* @throws {Error} If the node or token does not have range information.
|
||||
*/
|
||||
getRange(nodeOrToken) {
|
||||
if (hasESTreeStyleRange(nodeOrToken)) {
|
||||
return nodeOrToken.range;
|
||||
}
|
||||
|
||||
if (hasPosStyleRange(nodeOrToken)) {
|
||||
return [
|
||||
nodeOrToken.position.start.offset,
|
||||
nodeOrToken.position.end.offset,
|
||||
];
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
"Custom getRange() method must be implemented in the subclass.",
|
||||
);
|
||||
}
|
||||
|
||||
/* eslint-disable no-unused-vars -- Required to complete interface. */
|
||||
/**
|
||||
* Returns the parent of the given node.
|
||||
* @param {Options['SyntaxElementWithLoc']} node The node to get the parent of.
|
||||
* @returns {Options['SyntaxElementWithLoc']|undefined} The parent of the node.
|
||||
* @throws {Error} If the method is not implemented in the subclass.
|
||||
*/
|
||||
getParent(node) {
|
||||
throw new Error("Not implemented.");
|
||||
}
|
||||
/* eslint-enable no-unused-vars -- Required to complete interface. */
|
||||
|
||||
/**
|
||||
* Gets all the ancestors of a given node
|
||||
* @param {Options['SyntaxElementWithLoc']} node The node
|
||||
* @returns {Array<Options['SyntaxElementWithLoc']>} All the ancestor nodes in the AST, not including the provided node, starting
|
||||
* from the root node at index 0 and going inwards to the parent node.
|
||||
* @throws {TypeError} When `node` is missing.
|
||||
*/
|
||||
getAncestors(node) {
|
||||
if (!node) {
|
||||
throw new TypeError("Missing required argument: node.");
|
||||
}
|
||||
|
||||
const ancestorsStartingAtParent = [];
|
||||
|
||||
for (
|
||||
let ancestor = this.getParent(node);
|
||||
ancestor;
|
||||
ancestor = this.getParent(ancestor)
|
||||
) {
|
||||
ancestorsStartingAtParent.push(ancestor);
|
||||
}
|
||||
|
||||
return ancestorsStartingAtParent.reverse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the source code for the given node.
|
||||
* @param {Options['SyntaxElementWithLoc']} [node] The AST node to get the text for.
|
||||
* @param {number} [beforeCount] The number of characters before the node to retrieve.
|
||||
* @param {number} [afterCount] The number of characters after the node to retrieve.
|
||||
* @returns {string} The text representing the AST node.
|
||||
* @public
|
||||
*/
|
||||
getText(node, beforeCount, afterCount) {
|
||||
if (node) {
|
||||
const range = this.getRange(node);
|
||||
return this.text.slice(
|
||||
Math.max(range[0] - (beforeCount || 0), 0),
|
||||
range[1] + (afterCount || 0),
|
||||
);
|
||||
}
|
||||
return this.text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entire source text split into an array of lines.
|
||||
* @returns {Array<string>} The source text as an array of lines.
|
||||
* @public
|
||||
*/
|
||||
get lines() {
|
||||
this.#ensureLines(); // Ensure `#lines` is lazily calculated.
|
||||
|
||||
return this.#lines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Traverse the source code and return the steps that were taken.
|
||||
* @returns {Iterable<TraversalStep>} The steps that were taken while traversing the source code.
|
||||
*/
|
||||
traverse() {
|
||||
throw new Error("Not implemented.");
|
||||
}
|
||||
}
|
||||
|
||||
exports.CallMethodStep = CallMethodStep;
|
||||
exports.ConfigCommentParser = ConfigCommentParser;
|
||||
exports.Directive = Directive;
|
||||
exports.TextSourceCodeBase = TextSourceCodeBase;
|
||||
exports.VisitNodeStep = VisitNodeStep;
|
||||
328
frontend/node_modules/@eslint/plugin-kit/dist/cjs/index.d.cts
generated
vendored
328
frontend/node_modules/@eslint/plugin-kit/dist/cjs/index.d.cts
generated
vendored
@@ -1,328 +0,0 @@
|
||||
export type VisitTraversalStep = $eslintcore.VisitTraversalStep;
|
||||
export type CallTraversalStep = $eslintcore.CallTraversalStep;
|
||||
export type TraversalStep = $eslintcore.TraversalStep;
|
||||
export type SourceLocation = $eslintcore.SourceLocation;
|
||||
export type SourceLocationWithOffset = $eslintcore.SourceLocationWithOffset;
|
||||
export type SourceRange = $eslintcore.SourceRange;
|
||||
export type IDirective = $eslintcore.Directive;
|
||||
export type DirectiveType = $eslintcore.DirectiveType;
|
||||
export type SourceCodeBaseTypeOptions = $eslintcore.SourceCodeBaseTypeOptions;
|
||||
/**
|
||||
* <Options>
|
||||
*/
|
||||
export type TextSourceCode<Options extends SourceCodeBaseTypeOptions = $eslintcore.SourceCodeBaseTypeOptions> = import("@eslint/core").TextSourceCode<Options>;
|
||||
export type RuleConfig = $eslintcore.RuleConfig;
|
||||
export type RulesConfig = $eslintcore.RulesConfig;
|
||||
export type StringConfig = $typests.StringConfig;
|
||||
export type BooleanConfig = $typests.BooleanConfig;
|
||||
/**
|
||||
* A class to represent a step in the traversal process where a
|
||||
* method is called.
|
||||
* @implements {CallTraversalStep}
|
||||
*/
|
||||
export class CallMethodStep implements CallTraversalStep {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Object} options The options for the step.
|
||||
* @param {string} options.target The target of the step.
|
||||
* @param {Array<any>} options.args The arguments of the step.
|
||||
*/
|
||||
constructor({ target, args }: {
|
||||
target: string;
|
||||
args: Array<any>;
|
||||
});
|
||||
/**
|
||||
* The type of the step.
|
||||
* @type {"call"}
|
||||
* @readonly
|
||||
*/
|
||||
readonly type: "call";
|
||||
/**
|
||||
* The kind of the step. Represents the same data as the `type` property
|
||||
* but it's a number for performance.
|
||||
* @type {2}
|
||||
* @readonly
|
||||
*/
|
||||
readonly kind: 2;
|
||||
/**
|
||||
* The name of the method to call.
|
||||
* @type {string}
|
||||
*/
|
||||
target: string;
|
||||
/**
|
||||
* The arguments to pass to the method.
|
||||
* @type {Array<any>}
|
||||
*/
|
||||
args: Array<any>;
|
||||
}
|
||||
/**
|
||||
* Object to parse ESLint configuration comments.
|
||||
*/
|
||||
export class ConfigCommentParser {
|
||||
/**
|
||||
* Parses a list of "name:string_value" or/and "name" options divided by comma or
|
||||
* whitespace. Used for "global" comments.
|
||||
* @param {string} string The string to parse.
|
||||
* @returns {StringConfig} Result map object of names and string values, or null values if no value was provided.
|
||||
*/
|
||||
parseStringConfig(string: string): StringConfig;
|
||||
/**
|
||||
* Parses a JSON-like config.
|
||||
* @param {string} string The string to parse.
|
||||
* @returns {({ok: true, config: RulesConfig}|{ok: false, error: {message: string}})} Result map object
|
||||
*/
|
||||
parseJSONLikeConfig(string: string): ({
|
||||
ok: true;
|
||||
config: RulesConfig;
|
||||
} | {
|
||||
ok: false;
|
||||
error: {
|
||||
message: string;
|
||||
};
|
||||
});
|
||||
/**
|
||||
* Parses a config of values separated by comma.
|
||||
* @param {string} string The string to parse.
|
||||
* @returns {BooleanConfig} Result map of values and true values
|
||||
*/
|
||||
parseListConfig(string: string): BooleanConfig;
|
||||
/**
|
||||
* Parses a directive comment into directive text and value.
|
||||
* @param {string} string The string with the directive to be parsed.
|
||||
* @returns {DirectiveComment|undefined} The parsed directive or `undefined` if the directive is invalid.
|
||||
*/
|
||||
parseDirective(string: string): DirectiveComment | undefined;
|
||||
#private;
|
||||
}
|
||||
/**
|
||||
* A class to represent a directive comment.
|
||||
* @implements {IDirective}
|
||||
*/
|
||||
export class Directive implements IDirective {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Object} options The options for the directive.
|
||||
* @param {"disable"|"enable"|"disable-next-line"|"disable-line"} options.type The type of directive.
|
||||
* @param {unknown} options.node The node representing the directive.
|
||||
* @param {string} options.value The value of the directive.
|
||||
* @param {string} options.justification The justification for the directive.
|
||||
*/
|
||||
constructor({ type, node, value, justification }: {
|
||||
type: "disable" | "enable" | "disable-next-line" | "disable-line";
|
||||
node: unknown;
|
||||
value: string;
|
||||
justification: string;
|
||||
});
|
||||
/**
|
||||
* The type of directive.
|
||||
* @type {DirectiveType}
|
||||
* @readonly
|
||||
*/
|
||||
readonly type: DirectiveType;
|
||||
/**
|
||||
* The node representing the directive.
|
||||
* @type {unknown}
|
||||
* @readonly
|
||||
*/
|
||||
readonly node: unknown;
|
||||
/**
|
||||
* Everything after the "eslint-disable" portion of the directive,
|
||||
* but before the "--" that indicates the justification.
|
||||
* @type {string}
|
||||
* @readonly
|
||||
*/
|
||||
readonly value: string;
|
||||
/**
|
||||
* The justification for the directive.
|
||||
* @type {string}
|
||||
* @readonly
|
||||
*/
|
||||
readonly justification: string;
|
||||
}
|
||||
/**
|
||||
* Source Code Base Object
|
||||
* @template {SourceCodeBaseTypeOptions & {RootNode: object, SyntaxElementWithLoc: object}} [Options=SourceCodeBaseTypeOptions & {RootNode: object, SyntaxElementWithLoc: object}]
|
||||
* @implements {TextSourceCode<Options>}
|
||||
*/
|
||||
export class TextSourceCodeBase<Options extends SourceCodeBaseTypeOptions & {
|
||||
RootNode: object;
|
||||
SyntaxElementWithLoc: object;
|
||||
} = $eslintcore.SourceCodeBaseTypeOptions & {
|
||||
RootNode: object;
|
||||
SyntaxElementWithLoc: object;
|
||||
}> implements TextSourceCode<Options> {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Object} options The options for the instance.
|
||||
* @param {string} options.text The source code text.
|
||||
* @param {Options['RootNode']} options.ast The root AST node.
|
||||
* @param {RegExp} [options.lineEndingPattern] The pattern to match lineEndings in the source code. Defaults to `/\r?\n/u`.
|
||||
*/
|
||||
constructor({ text, ast, lineEndingPattern }: {
|
||||
text: string;
|
||||
ast: Options["RootNode"];
|
||||
lineEndingPattern?: RegExp;
|
||||
});
|
||||
/**
|
||||
* The AST of the source code.
|
||||
* @type {Options['RootNode']}
|
||||
*/
|
||||
ast: Options["RootNode"];
|
||||
/**
|
||||
* The text of the source code.
|
||||
* @type {string}
|
||||
*/
|
||||
text: string;
|
||||
/**
|
||||
* Returns the loc information for the given node or token.
|
||||
* @param {Options['SyntaxElementWithLoc']} nodeOrToken The node or token to get the loc information for.
|
||||
* @returns {SourceLocation} The loc information for the node or token.
|
||||
* @throws {Error} If the node or token does not have loc information.
|
||||
*/
|
||||
getLoc(nodeOrToken: Options["SyntaxElementWithLoc"]): SourceLocation;
|
||||
/**
|
||||
* Converts a source text index into a `{ line: number, column: number }` pair.
|
||||
* @param {number} index The index of a character in a file.
|
||||
* @throws {TypeError|RangeError} If non-numeric index or index out of range.
|
||||
* @returns {{line: number, column: number}} A `{ line: number, column: number }` location object with 0 or 1-indexed line and 0 or 1-indexed column based on language.
|
||||
* @public
|
||||
*/
|
||||
public getLocFromIndex(index: number): {
|
||||
line: number;
|
||||
column: number;
|
||||
};
|
||||
/**
|
||||
* Converts a `{ line: number, column: number }` pair into a source text index.
|
||||
* @param {Object} loc A line/column location.
|
||||
* @param {number} loc.line The line number of the location. (0 or 1-indexed based on language.)
|
||||
* @param {number} loc.column The column number of the location. (0 or 1-indexed based on language.)
|
||||
* @throws {TypeError|RangeError} If `loc` is not an object with a numeric
|
||||
* `line` and `column`, if the `line` is less than or equal to zero or
|
||||
* the `line` or `column` is out of the expected range.
|
||||
* @returns {number} The index of the line/column location in a file.
|
||||
* @public
|
||||
*/
|
||||
public getIndexFromLoc(loc: {
|
||||
line: number;
|
||||
column: number;
|
||||
}): number;
|
||||
/**
|
||||
* Returns the range information for the given node or token.
|
||||
* @param {Options['SyntaxElementWithLoc']} nodeOrToken The node or token to get the range information for.
|
||||
* @returns {SourceRange} The range information for the node or token.
|
||||
* @throws {Error} If the node or token does not have range information.
|
||||
*/
|
||||
getRange(nodeOrToken: Options["SyntaxElementWithLoc"]): SourceRange;
|
||||
/**
|
||||
* Returns the parent of the given node.
|
||||
* @param {Options['SyntaxElementWithLoc']} node The node to get the parent of.
|
||||
* @returns {Options['SyntaxElementWithLoc']|undefined} The parent of the node.
|
||||
* @throws {Error} If the method is not implemented in the subclass.
|
||||
*/
|
||||
getParent(node: Options["SyntaxElementWithLoc"]): Options["SyntaxElementWithLoc"] | undefined;
|
||||
/**
|
||||
* Gets all the ancestors of a given node
|
||||
* @param {Options['SyntaxElementWithLoc']} node The node
|
||||
* @returns {Array<Options['SyntaxElementWithLoc']>} All the ancestor nodes in the AST, not including the provided node, starting
|
||||
* from the root node at index 0 and going inwards to the parent node.
|
||||
* @throws {TypeError} When `node` is missing.
|
||||
*/
|
||||
getAncestors(node: Options["SyntaxElementWithLoc"]): Array<Options["SyntaxElementWithLoc"]>;
|
||||
/**
|
||||
* Gets the source code for the given node.
|
||||
* @param {Options['SyntaxElementWithLoc']} [node] The AST node to get the text for.
|
||||
* @param {number} [beforeCount] The number of characters before the node to retrieve.
|
||||
* @param {number} [afterCount] The number of characters after the node to retrieve.
|
||||
* @returns {string} The text representing the AST node.
|
||||
* @public
|
||||
*/
|
||||
public getText(node?: Options["SyntaxElementWithLoc"], beforeCount?: number, afterCount?: number): string;
|
||||
/**
|
||||
* Gets the entire source text split into an array of lines.
|
||||
* @returns {Array<string>} The source text as an array of lines.
|
||||
* @public
|
||||
*/
|
||||
public get lines(): Array<string>;
|
||||
/**
|
||||
* Traverse the source code and return the steps that were taken.
|
||||
* @returns {Iterable<TraversalStep>} The steps that were taken while traversing the source code.
|
||||
*/
|
||||
traverse(): Iterable<TraversalStep>;
|
||||
#private;
|
||||
}
|
||||
/**
|
||||
* A class to represent a step in the traversal process where a node is visited.
|
||||
* @implements {VisitTraversalStep}
|
||||
*/
|
||||
export class VisitNodeStep implements VisitTraversalStep {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Object} options The options for the step.
|
||||
* @param {object} options.target The target of the step.
|
||||
* @param {1|2} options.phase The phase of the step.
|
||||
* @param {Array<any>} options.args The arguments of the step.
|
||||
*/
|
||||
constructor({ target, phase, args }: {
|
||||
target: object;
|
||||
phase: 1 | 2;
|
||||
args: Array<any>;
|
||||
});
|
||||
/**
|
||||
* The type of the step.
|
||||
* @type {"visit"}
|
||||
* @readonly
|
||||
*/
|
||||
readonly type: "visit";
|
||||
/**
|
||||
* The kind of the step. Represents the same data as the `type` property
|
||||
* but it's a number for performance.
|
||||
* @type {1}
|
||||
* @readonly
|
||||
*/
|
||||
readonly kind: 1;
|
||||
/**
|
||||
* The target of the step.
|
||||
* @type {object}
|
||||
*/
|
||||
target: object;
|
||||
/**
|
||||
* The phase of the step.
|
||||
* @type {1|2}
|
||||
*/
|
||||
phase: 1 | 2;
|
||||
/**
|
||||
* The arguments of the step.
|
||||
* @type {Array<any>}
|
||||
*/
|
||||
args: Array<any>;
|
||||
}
|
||||
import type * as $eslintcore from "@eslint/core";
|
||||
import type * as $typests from "./types.cts";
|
||||
/**
|
||||
* Represents a directive comment.
|
||||
*/
|
||||
declare class DirectiveComment {
|
||||
/**
|
||||
* Creates a new directive comment.
|
||||
* @param {string} label The label of the directive.
|
||||
* @param {string} value The value of the directive.
|
||||
* @param {string} justification The justification of the directive.
|
||||
*/
|
||||
constructor(label: string, value: string, justification: string);
|
||||
/**
|
||||
* The label of the directive, such as "eslint", "eslint-disable", etc.
|
||||
* @type {string}
|
||||
*/
|
||||
label: string;
|
||||
/**
|
||||
* The value of the directive (the string after the label).
|
||||
* @type {string}
|
||||
*/
|
||||
value: string;
|
||||
/**
|
||||
* The justification of the directive (the string after the --).
|
||||
* @type {string}
|
||||
*/
|
||||
justification: string;
|
||||
}
|
||||
export {};
|
||||
7
frontend/node_modules/@eslint/plugin-kit/dist/cjs/types.cts
generated
vendored
7
frontend/node_modules/@eslint/plugin-kit/dist/cjs/types.cts
generated
vendored
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* @fileoverview Types for the plugin-kit package.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
export type StringConfig = Record<string, string | null>;
|
||||
export type BooleanConfig = Record<string, boolean>;
|
||||
328
frontend/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts
generated
vendored
328
frontend/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts
generated
vendored
@@ -1,328 +0,0 @@
|
||||
export type VisitTraversalStep = $eslintcore.VisitTraversalStep;
|
||||
export type CallTraversalStep = $eslintcore.CallTraversalStep;
|
||||
export type TraversalStep = $eslintcore.TraversalStep;
|
||||
export type SourceLocation = $eslintcore.SourceLocation;
|
||||
export type SourceLocationWithOffset = $eslintcore.SourceLocationWithOffset;
|
||||
export type SourceRange = $eslintcore.SourceRange;
|
||||
export type IDirective = $eslintcore.Directive;
|
||||
export type DirectiveType = $eslintcore.DirectiveType;
|
||||
export type SourceCodeBaseTypeOptions = $eslintcore.SourceCodeBaseTypeOptions;
|
||||
/**
|
||||
* <Options>
|
||||
*/
|
||||
export type TextSourceCode<Options extends SourceCodeBaseTypeOptions = $eslintcore.SourceCodeBaseTypeOptions> = import("@eslint/core").TextSourceCode<Options>;
|
||||
export type RuleConfig = $eslintcore.RuleConfig;
|
||||
export type RulesConfig = $eslintcore.RulesConfig;
|
||||
export type StringConfig = $typests.StringConfig;
|
||||
export type BooleanConfig = $typests.BooleanConfig;
|
||||
/**
|
||||
* A class to represent a step in the traversal process where a
|
||||
* method is called.
|
||||
* @implements {CallTraversalStep}
|
||||
*/
|
||||
export class CallMethodStep implements CallTraversalStep {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Object} options The options for the step.
|
||||
* @param {string} options.target The target of the step.
|
||||
* @param {Array<any>} options.args The arguments of the step.
|
||||
*/
|
||||
constructor({ target, args }: {
|
||||
target: string;
|
||||
args: Array<any>;
|
||||
});
|
||||
/**
|
||||
* The type of the step.
|
||||
* @type {"call"}
|
||||
* @readonly
|
||||
*/
|
||||
readonly type: "call";
|
||||
/**
|
||||
* The kind of the step. Represents the same data as the `type` property
|
||||
* but it's a number for performance.
|
||||
* @type {2}
|
||||
* @readonly
|
||||
*/
|
||||
readonly kind: 2;
|
||||
/**
|
||||
* The name of the method to call.
|
||||
* @type {string}
|
||||
*/
|
||||
target: string;
|
||||
/**
|
||||
* The arguments to pass to the method.
|
||||
* @type {Array<any>}
|
||||
*/
|
||||
args: Array<any>;
|
||||
}
|
||||
/**
|
||||
* Object to parse ESLint configuration comments.
|
||||
*/
|
||||
export class ConfigCommentParser {
|
||||
/**
|
||||
* Parses a list of "name:string_value" or/and "name" options divided by comma or
|
||||
* whitespace. Used for "global" comments.
|
||||
* @param {string} string The string to parse.
|
||||
* @returns {StringConfig} Result map object of names and string values, or null values if no value was provided.
|
||||
*/
|
||||
parseStringConfig(string: string): StringConfig;
|
||||
/**
|
||||
* Parses a JSON-like config.
|
||||
* @param {string} string The string to parse.
|
||||
* @returns {({ok: true, config: RulesConfig}|{ok: false, error: {message: string}})} Result map object
|
||||
*/
|
||||
parseJSONLikeConfig(string: string): ({
|
||||
ok: true;
|
||||
config: RulesConfig;
|
||||
} | {
|
||||
ok: false;
|
||||
error: {
|
||||
message: string;
|
||||
};
|
||||
});
|
||||
/**
|
||||
* Parses a config of values separated by comma.
|
||||
* @param {string} string The string to parse.
|
||||
* @returns {BooleanConfig} Result map of values and true values
|
||||
*/
|
||||
parseListConfig(string: string): BooleanConfig;
|
||||
/**
|
||||
* Parses a directive comment into directive text and value.
|
||||
* @param {string} string The string with the directive to be parsed.
|
||||
* @returns {DirectiveComment|undefined} The parsed directive or `undefined` if the directive is invalid.
|
||||
*/
|
||||
parseDirective(string: string): DirectiveComment | undefined;
|
||||
#private;
|
||||
}
|
||||
/**
|
||||
* A class to represent a directive comment.
|
||||
* @implements {IDirective}
|
||||
*/
|
||||
export class Directive implements IDirective {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Object} options The options for the directive.
|
||||
* @param {"disable"|"enable"|"disable-next-line"|"disable-line"} options.type The type of directive.
|
||||
* @param {unknown} options.node The node representing the directive.
|
||||
* @param {string} options.value The value of the directive.
|
||||
* @param {string} options.justification The justification for the directive.
|
||||
*/
|
||||
constructor({ type, node, value, justification }: {
|
||||
type: "disable" | "enable" | "disable-next-line" | "disable-line";
|
||||
node: unknown;
|
||||
value: string;
|
||||
justification: string;
|
||||
});
|
||||
/**
|
||||
* The type of directive.
|
||||
* @type {DirectiveType}
|
||||
* @readonly
|
||||
*/
|
||||
readonly type: DirectiveType;
|
||||
/**
|
||||
* The node representing the directive.
|
||||
* @type {unknown}
|
||||
* @readonly
|
||||
*/
|
||||
readonly node: unknown;
|
||||
/**
|
||||
* Everything after the "eslint-disable" portion of the directive,
|
||||
* but before the "--" that indicates the justification.
|
||||
* @type {string}
|
||||
* @readonly
|
||||
*/
|
||||
readonly value: string;
|
||||
/**
|
||||
* The justification for the directive.
|
||||
* @type {string}
|
||||
* @readonly
|
||||
*/
|
||||
readonly justification: string;
|
||||
}
|
||||
/**
|
||||
* Source Code Base Object
|
||||
* @template {SourceCodeBaseTypeOptions & {RootNode: object, SyntaxElementWithLoc: object}} [Options=SourceCodeBaseTypeOptions & {RootNode: object, SyntaxElementWithLoc: object}]
|
||||
* @implements {TextSourceCode<Options>}
|
||||
*/
|
||||
export class TextSourceCodeBase<Options extends SourceCodeBaseTypeOptions & {
|
||||
RootNode: object;
|
||||
SyntaxElementWithLoc: object;
|
||||
} = $eslintcore.SourceCodeBaseTypeOptions & {
|
||||
RootNode: object;
|
||||
SyntaxElementWithLoc: object;
|
||||
}> implements TextSourceCode<Options> {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Object} options The options for the instance.
|
||||
* @param {string} options.text The source code text.
|
||||
* @param {Options['RootNode']} options.ast The root AST node.
|
||||
* @param {RegExp} [options.lineEndingPattern] The pattern to match lineEndings in the source code. Defaults to `/\r?\n/u`.
|
||||
*/
|
||||
constructor({ text, ast, lineEndingPattern }: {
|
||||
text: string;
|
||||
ast: Options["RootNode"];
|
||||
lineEndingPattern?: RegExp;
|
||||
});
|
||||
/**
|
||||
* The AST of the source code.
|
||||
* @type {Options['RootNode']}
|
||||
*/
|
||||
ast: Options["RootNode"];
|
||||
/**
|
||||
* The text of the source code.
|
||||
* @type {string}
|
||||
*/
|
||||
text: string;
|
||||
/**
|
||||
* Returns the loc information for the given node or token.
|
||||
* @param {Options['SyntaxElementWithLoc']} nodeOrToken The node or token to get the loc information for.
|
||||
* @returns {SourceLocation} The loc information for the node or token.
|
||||
* @throws {Error} If the node or token does not have loc information.
|
||||
*/
|
||||
getLoc(nodeOrToken: Options["SyntaxElementWithLoc"]): SourceLocation;
|
||||
/**
|
||||
* Converts a source text index into a `{ line: number, column: number }` pair.
|
||||
* @param {number} index The index of a character in a file.
|
||||
* @throws {TypeError|RangeError} If non-numeric index or index out of range.
|
||||
* @returns {{line: number, column: number}} A `{ line: number, column: number }` location object with 0 or 1-indexed line and 0 or 1-indexed column based on language.
|
||||
* @public
|
||||
*/
|
||||
public getLocFromIndex(index: number): {
|
||||
line: number;
|
||||
column: number;
|
||||
};
|
||||
/**
|
||||
* Converts a `{ line: number, column: number }` pair into a source text index.
|
||||
* @param {Object} loc A line/column location.
|
||||
* @param {number} loc.line The line number of the location. (0 or 1-indexed based on language.)
|
||||
* @param {number} loc.column The column number of the location. (0 or 1-indexed based on language.)
|
||||
* @throws {TypeError|RangeError} If `loc` is not an object with a numeric
|
||||
* `line` and `column`, if the `line` is less than or equal to zero or
|
||||
* the `line` or `column` is out of the expected range.
|
||||
* @returns {number} The index of the line/column location in a file.
|
||||
* @public
|
||||
*/
|
||||
public getIndexFromLoc(loc: {
|
||||
line: number;
|
||||
column: number;
|
||||
}): number;
|
||||
/**
|
||||
* Returns the range information for the given node or token.
|
||||
* @param {Options['SyntaxElementWithLoc']} nodeOrToken The node or token to get the range information for.
|
||||
* @returns {SourceRange} The range information for the node or token.
|
||||
* @throws {Error} If the node or token does not have range information.
|
||||
*/
|
||||
getRange(nodeOrToken: Options["SyntaxElementWithLoc"]): SourceRange;
|
||||
/**
|
||||
* Returns the parent of the given node.
|
||||
* @param {Options['SyntaxElementWithLoc']} node The node to get the parent of.
|
||||
* @returns {Options['SyntaxElementWithLoc']|undefined} The parent of the node.
|
||||
* @throws {Error} If the method is not implemented in the subclass.
|
||||
*/
|
||||
getParent(node: Options["SyntaxElementWithLoc"]): Options["SyntaxElementWithLoc"] | undefined;
|
||||
/**
|
||||
* Gets all the ancestors of a given node
|
||||
* @param {Options['SyntaxElementWithLoc']} node The node
|
||||
* @returns {Array<Options['SyntaxElementWithLoc']>} All the ancestor nodes in the AST, not including the provided node, starting
|
||||
* from the root node at index 0 and going inwards to the parent node.
|
||||
* @throws {TypeError} When `node` is missing.
|
||||
*/
|
||||
getAncestors(node: Options["SyntaxElementWithLoc"]): Array<Options["SyntaxElementWithLoc"]>;
|
||||
/**
|
||||
* Gets the source code for the given node.
|
||||
* @param {Options['SyntaxElementWithLoc']} [node] The AST node to get the text for.
|
||||
* @param {number} [beforeCount] The number of characters before the node to retrieve.
|
||||
* @param {number} [afterCount] The number of characters after the node to retrieve.
|
||||
* @returns {string} The text representing the AST node.
|
||||
* @public
|
||||
*/
|
||||
public getText(node?: Options["SyntaxElementWithLoc"], beforeCount?: number, afterCount?: number): string;
|
||||
/**
|
||||
* Gets the entire source text split into an array of lines.
|
||||
* @returns {Array<string>} The source text as an array of lines.
|
||||
* @public
|
||||
*/
|
||||
public get lines(): Array<string>;
|
||||
/**
|
||||
* Traverse the source code and return the steps that were taken.
|
||||
* @returns {Iterable<TraversalStep>} The steps that were taken while traversing the source code.
|
||||
*/
|
||||
traverse(): Iterable<TraversalStep>;
|
||||
#private;
|
||||
}
|
||||
/**
|
||||
* A class to represent a step in the traversal process where a node is visited.
|
||||
* @implements {VisitTraversalStep}
|
||||
*/
|
||||
export class VisitNodeStep implements VisitTraversalStep {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Object} options The options for the step.
|
||||
* @param {object} options.target The target of the step.
|
||||
* @param {1|2} options.phase The phase of the step.
|
||||
* @param {Array<any>} options.args The arguments of the step.
|
||||
*/
|
||||
constructor({ target, phase, args }: {
|
||||
target: object;
|
||||
phase: 1 | 2;
|
||||
args: Array<any>;
|
||||
});
|
||||
/**
|
||||
* The type of the step.
|
||||
* @type {"visit"}
|
||||
* @readonly
|
||||
*/
|
||||
readonly type: "visit";
|
||||
/**
|
||||
* The kind of the step. Represents the same data as the `type` property
|
||||
* but it's a number for performance.
|
||||
* @type {1}
|
||||
* @readonly
|
||||
*/
|
||||
readonly kind: 1;
|
||||
/**
|
||||
* The target of the step.
|
||||
* @type {object}
|
||||
*/
|
||||
target: object;
|
||||
/**
|
||||
* The phase of the step.
|
||||
* @type {1|2}
|
||||
*/
|
||||
phase: 1 | 2;
|
||||
/**
|
||||
* The arguments of the step.
|
||||
* @type {Array<any>}
|
||||
*/
|
||||
args: Array<any>;
|
||||
}
|
||||
import type * as $eslintcore from "@eslint/core";
|
||||
import type * as $typests from "./types.ts";
|
||||
/**
|
||||
* Represents a directive comment.
|
||||
*/
|
||||
declare class DirectiveComment {
|
||||
/**
|
||||
* Creates a new directive comment.
|
||||
* @param {string} label The label of the directive.
|
||||
* @param {string} value The value of the directive.
|
||||
* @param {string} justification The justification of the directive.
|
||||
*/
|
||||
constructor(label: string, value: string, justification: string);
|
||||
/**
|
||||
* The label of the directive, such as "eslint", "eslint-disable", etc.
|
||||
* @type {string}
|
||||
*/
|
||||
label: string;
|
||||
/**
|
||||
* The value of the directive (the string after the label).
|
||||
* @type {string}
|
||||
*/
|
||||
value: string;
|
||||
/**
|
||||
* The justification of the directive (the string after the --).
|
||||
* @type {string}
|
||||
*/
|
||||
justification: string;
|
||||
}
|
||||
export {};
|
||||
879
frontend/node_modules/@eslint/plugin-kit/dist/esm/index.js
generated
vendored
879
frontend/node_modules/@eslint/plugin-kit/dist/esm/index.js
generated
vendored
@@ -1,879 +0,0 @@
|
||||
// @ts-self-types="./index.d.ts"
|
||||
import levn from 'levn';
|
||||
|
||||
/**
|
||||
* @fileoverview Config Comment Parser
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Type Definitions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/** @import * as $eslintcore from "@eslint/core"; */
|
||||
/** @typedef {$eslintcore.RuleConfig} RuleConfig */
|
||||
/** @typedef {$eslintcore.RulesConfig} RulesConfig */
|
||||
/** @import * as $typests from "./types.ts"; */
|
||||
/** @typedef {$typests.StringConfig} StringConfig */
|
||||
/** @typedef {$typests.BooleanConfig} BooleanConfig */
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const directivesPattern = /^([a-z]+(?:-[a-z]+)*)(?:\s|$)/u;
|
||||
const validSeverities = new Set([0, 1, 2, "off", "warn", "error"]);
|
||||
|
||||
/**
|
||||
* Determines if the severity in the rule configuration is valid.
|
||||
* @param {RuleConfig} ruleConfig A rule's configuration.
|
||||
* @returns {boolean} `true` if the severity is valid, otherwise `false`.
|
||||
*/
|
||||
function isSeverityValid(ruleConfig) {
|
||||
const severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;
|
||||
return validSeverities.has(severity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if all severities in the rules configuration are valid.
|
||||
* @param {RulesConfig} rulesConfig The rules configuration to check.
|
||||
* @returns {boolean} `true` if all severities are valid, otherwise `false`.
|
||||
*/
|
||||
function isEverySeverityValid(rulesConfig) {
|
||||
return Object.values(rulesConfig).every(isSeverityValid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a directive comment.
|
||||
*/
|
||||
class DirectiveComment {
|
||||
/**
|
||||
* The label of the directive, such as "eslint", "eslint-disable", etc.
|
||||
* @type {string}
|
||||
*/
|
||||
label = "";
|
||||
|
||||
/**
|
||||
* The value of the directive (the string after the label).
|
||||
* @type {string}
|
||||
*/
|
||||
value = "";
|
||||
|
||||
/**
|
||||
* The justification of the directive (the string after the --).
|
||||
* @type {string}
|
||||
*/
|
||||
justification = "";
|
||||
|
||||
/**
|
||||
* Creates a new directive comment.
|
||||
* @param {string} label The label of the directive.
|
||||
* @param {string} value The value of the directive.
|
||||
* @param {string} justification The justification of the directive.
|
||||
*/
|
||||
constructor(label, value, justification) {
|
||||
this.label = label;
|
||||
this.value = value;
|
||||
this.justification = justification;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Object to parse ESLint configuration comments.
|
||||
*/
|
||||
class ConfigCommentParser {
|
||||
/**
|
||||
* Parses a list of "name:string_value" or/and "name" options divided by comma or
|
||||
* whitespace. Used for "global" comments.
|
||||
* @param {string} string The string to parse.
|
||||
* @returns {StringConfig} Result map object of names and string values, or null values if no value was provided.
|
||||
*/
|
||||
parseStringConfig(string) {
|
||||
const items = /** @type {StringConfig} */ ({});
|
||||
|
||||
// Collapse whitespace around `:` and `,` to make parsing easier
|
||||
const trimmedString = string
|
||||
.trim()
|
||||
.replace(/(?<!\s)\s*([:,])\s*/gu, "$1");
|
||||
|
||||
trimmedString.split(/\s|,+/u).forEach(name => {
|
||||
if (!name) {
|
||||
return;
|
||||
}
|
||||
|
||||
// value defaults to null (if not provided), e.g: "foo" => ["foo", null]
|
||||
const [key, value = null] = name.split(":");
|
||||
|
||||
items[key] = value;
|
||||
});
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a JSON-like config.
|
||||
* @param {string} string The string to parse.
|
||||
* @returns {({ok: true, config: RulesConfig}|{ok: false, error: {message: string}})} Result map object
|
||||
*/
|
||||
parseJSONLikeConfig(string) {
|
||||
// Parses a JSON-like comment by the same way as parsing CLI option.
|
||||
try {
|
||||
const items =
|
||||
/** @type {RulesConfig} */ (levn.parse("Object", string)) || {};
|
||||
|
||||
/*
|
||||
* When the configuration has any invalid severities, it should be completely
|
||||
* ignored. This is because the configuration is not valid and should not be
|
||||
* applied.
|
||||
*
|
||||
* For example, the following configuration is invalid:
|
||||
*
|
||||
* "no-alert: 2 no-console: 2"
|
||||
*
|
||||
* This results in a configuration of { "no-alert": "2 no-console: 2" }, which is
|
||||
* not valid. In this case, the configuration should be ignored.
|
||||
*/
|
||||
if (isEverySeverityValid(items)) {
|
||||
return {
|
||||
ok: true,
|
||||
config: items,
|
||||
};
|
||||
}
|
||||
} catch {
|
||||
// levn parsing error: ignore to parse the string by a fallback.
|
||||
}
|
||||
|
||||
/*
|
||||
* Optionator cannot parse commaless notations.
|
||||
* But we are supporting that. So this is a fallback for that.
|
||||
*/
|
||||
const normalizedString = string
|
||||
.replace(/(?<![-a-zA-Z0-9/])([-a-zA-Z0-9/]+):/gu, '"$1":')
|
||||
.replace(/([\]0-9])\s+(?=")/u, "$1,");
|
||||
|
||||
try {
|
||||
const items = JSON.parse(`{${normalizedString}}`);
|
||||
|
||||
return {
|
||||
ok: true,
|
||||
config: items,
|
||||
};
|
||||
} catch (ex) {
|
||||
const errorMessage = ex instanceof Error ? ex.message : String(ex);
|
||||
|
||||
return {
|
||||
ok: false,
|
||||
error: {
|
||||
message: `Failed to parse JSON from '${normalizedString}': ${errorMessage}`,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a config of values separated by comma.
|
||||
* @param {string} string The string to parse.
|
||||
* @returns {BooleanConfig} Result map of values and true values
|
||||
*/
|
||||
parseListConfig(string) {
|
||||
const items = /** @type {BooleanConfig} */ ({});
|
||||
|
||||
string.split(",").forEach(name => {
|
||||
const trimmedName = name
|
||||
.trim()
|
||||
.replace(
|
||||
/^(?<quote>['"]?)(?<ruleId>.*)\k<quote>$/su,
|
||||
"$<ruleId>",
|
||||
);
|
||||
|
||||
if (trimmedName) {
|
||||
items[trimmedName] = true;
|
||||
}
|
||||
});
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the directive and the justification from a given directive comment and trim them.
|
||||
* @param {string} value The comment text to extract.
|
||||
* @returns {{directivePart: string, justificationPart: string}} The extracted directive and justification.
|
||||
*/
|
||||
#extractDirectiveComment(value) {
|
||||
const match = /\s-{2,}\s/u.exec(value);
|
||||
|
||||
if (!match) {
|
||||
return { directivePart: value.trim(), justificationPart: "" };
|
||||
}
|
||||
|
||||
const directive = value.slice(0, match.index).trim();
|
||||
const justification = value.slice(match.index + match[0].length).trim();
|
||||
|
||||
return { directivePart: directive, justificationPart: justification };
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a directive comment into directive text and value.
|
||||
* @param {string} string The string with the directive to be parsed.
|
||||
* @returns {DirectiveComment|undefined} The parsed directive or `undefined` if the directive is invalid.
|
||||
*/
|
||||
parseDirective(string) {
|
||||
const { directivePart, justificationPart } =
|
||||
this.#extractDirectiveComment(string);
|
||||
const match = directivesPattern.exec(directivePart);
|
||||
|
||||
if (!match) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const directiveText = match[1];
|
||||
const directiveValue = directivePart.slice(
|
||||
match.index + directiveText.length,
|
||||
);
|
||||
|
||||
return new DirectiveComment(
|
||||
directiveText,
|
||||
directiveValue.trim(),
|
||||
justificationPart,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @fileoverview A collection of helper classes for implementing `SourceCode`.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
/* eslint class-methods-use-this: off -- Required to complete interface. */
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Type Definitions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/** @typedef {$eslintcore.VisitTraversalStep} VisitTraversalStep */
|
||||
/** @typedef {$eslintcore.CallTraversalStep} CallTraversalStep */
|
||||
/** @typedef {$eslintcore.TraversalStep} TraversalStep */
|
||||
/** @typedef {$eslintcore.SourceLocation} SourceLocation */
|
||||
/** @typedef {$eslintcore.SourceLocationWithOffset} SourceLocationWithOffset */
|
||||
/** @typedef {$eslintcore.SourceRange} SourceRange */
|
||||
/** @typedef {$eslintcore.Directive} IDirective */
|
||||
/** @typedef {$eslintcore.DirectiveType} DirectiveType */
|
||||
/** @typedef {$eslintcore.SourceCodeBaseTypeOptions} SourceCodeBaseTypeOptions */
|
||||
/**
|
||||
* @typedef {import("@eslint/core").TextSourceCode<Options>} TextSourceCode<Options>
|
||||
* @template {SourceCodeBaseTypeOptions} [Options=SourceCodeBaseTypeOptions]
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Determines if a node has ESTree-style loc information.
|
||||
* @param {object} node The node to check.
|
||||
* @returns {node is {loc:SourceLocation}} `true` if the node has ESTree-style loc information, `false` if not.
|
||||
*/
|
||||
function hasESTreeStyleLoc(node) {
|
||||
return "loc" in node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a node has position-style loc information.
|
||||
* @param {object} node The node to check.
|
||||
* @returns {node is {position:SourceLocation}} `true` if the node has position-style range information, `false` if not.
|
||||
*/
|
||||
function hasPosStyleLoc(node) {
|
||||
return "position" in node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a node has ESTree-style range information.
|
||||
* @param {object} node The node to check.
|
||||
* @returns {node is {range:SourceRange}} `true` if the node has ESTree-style range information, `false` if not.
|
||||
*/
|
||||
function hasESTreeStyleRange(node) {
|
||||
return "range" in node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a node has position-style range information.
|
||||
* @param {object} node The node to check.
|
||||
* @returns {node is {position:SourceLocationWithOffset}} `true` if the node has position-style range information, `false` if not.
|
||||
*/
|
||||
function hasPosStyleRange(node) {
|
||||
return "position" in node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs binary search to find the line number containing a given target index.
|
||||
* Returns the lower bound - the index of the first element greater than the target.
|
||||
* **Please note that the `lineStartIndices` should be sorted in ascending order**.
|
||||
* - Time Complexity: O(log n) - Significantly faster than linear search for large files.
|
||||
* @param {number[]} lineStartIndices Sorted array of line start indices.
|
||||
* @param {number} targetIndex The target index to find the line number for.
|
||||
* @returns {number} The line number for the target index.
|
||||
*/
|
||||
function findLineNumberBinarySearch(lineStartIndices, targetIndex) {
|
||||
let low = 0;
|
||||
let high = lineStartIndices.length - 1;
|
||||
|
||||
while (low < high) {
|
||||
const mid = ((low + high) / 2) | 0; // Use bitwise OR to floor the division.
|
||||
|
||||
if (targetIndex < lineStartIndices[mid]) {
|
||||
high = mid;
|
||||
} else {
|
||||
low = mid + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return low;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* A class to represent a step in the traversal process where a node is visited.
|
||||
* @implements {VisitTraversalStep}
|
||||
*/
|
||||
class VisitNodeStep {
|
||||
/**
|
||||
* The type of the step.
|
||||
* @type {"visit"}
|
||||
* @readonly
|
||||
*/
|
||||
type = "visit";
|
||||
|
||||
/**
|
||||
* The kind of the step. Represents the same data as the `type` property
|
||||
* but it's a number for performance.
|
||||
* @type {1}
|
||||
* @readonly
|
||||
*/
|
||||
kind = 1;
|
||||
|
||||
/**
|
||||
* The target of the step.
|
||||
* @type {object}
|
||||
*/
|
||||
target;
|
||||
|
||||
/**
|
||||
* The phase of the step.
|
||||
* @type {1|2}
|
||||
*/
|
||||
phase;
|
||||
|
||||
/**
|
||||
* The arguments of the step.
|
||||
* @type {Array<any>}
|
||||
*/
|
||||
args;
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Object} options The options for the step.
|
||||
* @param {object} options.target The target of the step.
|
||||
* @param {1|2} options.phase The phase of the step.
|
||||
* @param {Array<any>} options.args The arguments of the step.
|
||||
*/
|
||||
constructor({ target, phase, args }) {
|
||||
this.target = target;
|
||||
this.phase = phase;
|
||||
this.args = args;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class to represent a step in the traversal process where a
|
||||
* method is called.
|
||||
* @implements {CallTraversalStep}
|
||||
*/
|
||||
class CallMethodStep {
|
||||
/**
|
||||
* The type of the step.
|
||||
* @type {"call"}
|
||||
* @readonly
|
||||
*/
|
||||
type = "call";
|
||||
|
||||
/**
|
||||
* The kind of the step. Represents the same data as the `type` property
|
||||
* but it's a number for performance.
|
||||
* @type {2}
|
||||
* @readonly
|
||||
*/
|
||||
kind = 2;
|
||||
|
||||
/**
|
||||
* The name of the method to call.
|
||||
* @type {string}
|
||||
*/
|
||||
target;
|
||||
|
||||
/**
|
||||
* The arguments to pass to the method.
|
||||
* @type {Array<any>}
|
||||
*/
|
||||
args;
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Object} options The options for the step.
|
||||
* @param {string} options.target The target of the step.
|
||||
* @param {Array<any>} options.args The arguments of the step.
|
||||
*/
|
||||
constructor({ target, args }) {
|
||||
this.target = target;
|
||||
this.args = args;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class to represent a directive comment.
|
||||
* @implements {IDirective}
|
||||
*/
|
||||
class Directive {
|
||||
/**
|
||||
* The type of directive.
|
||||
* @type {DirectiveType}
|
||||
* @readonly
|
||||
*/
|
||||
type;
|
||||
|
||||
/**
|
||||
* The node representing the directive.
|
||||
* @type {unknown}
|
||||
* @readonly
|
||||
*/
|
||||
node;
|
||||
|
||||
/**
|
||||
* Everything after the "eslint-disable" portion of the directive,
|
||||
* but before the "--" that indicates the justification.
|
||||
* @type {string}
|
||||
* @readonly
|
||||
*/
|
||||
value;
|
||||
|
||||
/**
|
||||
* The justification for the directive.
|
||||
* @type {string}
|
||||
* @readonly
|
||||
*/
|
||||
justification;
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Object} options The options for the directive.
|
||||
* @param {"disable"|"enable"|"disable-next-line"|"disable-line"} options.type The type of directive.
|
||||
* @param {unknown} options.node The node representing the directive.
|
||||
* @param {string} options.value The value of the directive.
|
||||
* @param {string} options.justification The justification for the directive.
|
||||
*/
|
||||
constructor({ type, node, value, justification }) {
|
||||
this.type = type;
|
||||
this.node = node;
|
||||
this.value = value;
|
||||
this.justification = justification;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Source Code Base Object
|
||||
* @template {SourceCodeBaseTypeOptions & {RootNode: object, SyntaxElementWithLoc: object}} [Options=SourceCodeBaseTypeOptions & {RootNode: object, SyntaxElementWithLoc: object}]
|
||||
* @implements {TextSourceCode<Options>}
|
||||
*/
|
||||
class TextSourceCodeBase {
|
||||
/**
|
||||
* The lines of text in the source code.
|
||||
* @type {Array<string>}
|
||||
*/
|
||||
#lines = [];
|
||||
|
||||
/**
|
||||
* The indices of the start of each line in the source code.
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
#lineStartIndices = [0];
|
||||
|
||||
/**
|
||||
* The pattern to match lineEndings in the source code.
|
||||
* @type {RegExp}
|
||||
*/
|
||||
#lineEndingPattern;
|
||||
|
||||
/**
|
||||
* The AST of the source code.
|
||||
* @type {Options['RootNode']}
|
||||
*/
|
||||
ast;
|
||||
|
||||
/**
|
||||
* The text of the source code.
|
||||
* @type {string}
|
||||
*/
|
||||
text;
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Object} options The options for the instance.
|
||||
* @param {string} options.text The source code text.
|
||||
* @param {Options['RootNode']} options.ast The root AST node.
|
||||
* @param {RegExp} [options.lineEndingPattern] The pattern to match lineEndings in the source code. Defaults to `/\r?\n/u`.
|
||||
*/
|
||||
constructor({ text, ast, lineEndingPattern = /\r?\n/u }) {
|
||||
this.ast = ast;
|
||||
this.text = text;
|
||||
// Remove the global(`g`) and sticky(`y`) flags from the `lineEndingPattern` to avoid issues with lastIndex.
|
||||
this.#lineEndingPattern = new RegExp(
|
||||
lineEndingPattern.source,
|
||||
lineEndingPattern.flags.replace(/[gy]/gu, ""),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the next line in the source text and updates `#lines` and `#lineStartIndices`.
|
||||
* @param {string} text The text to search for the next line.
|
||||
* @returns {boolean} `true` if a next line was found, `false` otherwise.
|
||||
*/
|
||||
#findNextLine(text) {
|
||||
const match = this.#lineEndingPattern.exec(text);
|
||||
|
||||
if (!match) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.#lines.push(text.slice(0, match.index));
|
||||
this.#lineStartIndices.push(
|
||||
(this.#lineStartIndices.at(-1) ?? 0) +
|
||||
match.index +
|
||||
match[0].length,
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures `#lines` is lazily calculated from the source text.
|
||||
* @returns {void}
|
||||
*/
|
||||
#ensureLines() {
|
||||
// If `#lines` has already been calculated, do nothing.
|
||||
if (this.#lines.length === this.#lineStartIndices.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (
|
||||
this.#findNextLine(this.text.slice(this.#lineStartIndices.at(-1)))
|
||||
) {
|
||||
// Continue parsing until no more matches are found.
|
||||
}
|
||||
|
||||
this.#lines.push(this.text.slice(this.#lineStartIndices.at(-1)));
|
||||
|
||||
Object.freeze(this.#lines);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures `#lineStartIndices` is lazily calculated up to the specified index.
|
||||
* @param {number} index The index of a character in a file.
|
||||
* @returns {void}
|
||||
*/
|
||||
#ensureLineStartIndicesFromIndex(index) {
|
||||
// If we've already parsed up to or beyond this index, do nothing.
|
||||
if (index <= (this.#lineStartIndices.at(-1) ?? 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (
|
||||
index > (this.#lineStartIndices.at(-1) ?? 0) &&
|
||||
this.#findNextLine(this.text.slice(this.#lineStartIndices.at(-1)))
|
||||
) {
|
||||
// Continue parsing until no more matches are found.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures `#lineStartIndices` is lazily calculated up to the specified loc.
|
||||
* @param {Object} loc A line/column location.
|
||||
* @param {number} loc.line The line number of the location. (0 or 1-indexed based on language.)
|
||||
* @param {number} lineStart The line number at which the parser starts counting.
|
||||
* @returns {void}
|
||||
*/
|
||||
#ensureLineStartIndicesFromLoc(loc, lineStart) {
|
||||
// Calculate line indices up to the potentially next line, as it is needed for the follow‑up calculation.
|
||||
const nextLocLineIndex = loc.line - lineStart + 1;
|
||||
const lastCalculatedLineIndex = this.#lineStartIndices.length - 1;
|
||||
let additionalLinesNeeded = nextLocLineIndex - lastCalculatedLineIndex;
|
||||
|
||||
// If we've already parsed up to or beyond this line, do nothing.
|
||||
if (additionalLinesNeeded <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (
|
||||
additionalLinesNeeded > 0 &&
|
||||
this.#findNextLine(this.text.slice(this.#lineStartIndices.at(-1)))
|
||||
) {
|
||||
// Continue parsing until no more matches are found or we have enough lines.
|
||||
additionalLinesNeeded -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the loc information for the given node or token.
|
||||
* @param {Options['SyntaxElementWithLoc']} nodeOrToken The node or token to get the loc information for.
|
||||
* @returns {SourceLocation} The loc information for the node or token.
|
||||
* @throws {Error} If the node or token does not have loc information.
|
||||
*/
|
||||
getLoc(nodeOrToken) {
|
||||
if (hasESTreeStyleLoc(nodeOrToken)) {
|
||||
return nodeOrToken.loc;
|
||||
}
|
||||
|
||||
if (hasPosStyleLoc(nodeOrToken)) {
|
||||
return nodeOrToken.position;
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
"Custom getLoc() method must be implemented in the subclass.",
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a source text index into a `{ line: number, column: number }` pair.
|
||||
* @param {number} index The index of a character in a file.
|
||||
* @throws {TypeError|RangeError} If non-numeric index or index out of range.
|
||||
* @returns {{line: number, column: number}} A `{ line: number, column: number }` location object with 0 or 1-indexed line and 0 or 1-indexed column based on language.
|
||||
* @public
|
||||
*/
|
||||
getLocFromIndex(index) {
|
||||
if (typeof index !== "number") {
|
||||
throw new TypeError("Expected `index` to be a number.");
|
||||
}
|
||||
|
||||
if (index < 0 || index > this.text.length) {
|
||||
throw new RangeError(
|
||||
`Index out of range (requested index ${index}, but source text has length ${this.text.length}).`,
|
||||
);
|
||||
}
|
||||
|
||||
const {
|
||||
start: { line: lineStart, column: columnStart },
|
||||
end: { line: lineEnd, column: columnEnd },
|
||||
} = this.getLoc(this.ast);
|
||||
|
||||
// If the index is at the start, return the start location of the root node.
|
||||
if (index === 0) {
|
||||
return {
|
||||
line: lineStart,
|
||||
column: columnStart,
|
||||
};
|
||||
}
|
||||
|
||||
// If the index is `this.text.length`, return the location one "spot" past the last character of the file.
|
||||
if (index === this.text.length) {
|
||||
return {
|
||||
line: lineEnd,
|
||||
column: columnEnd,
|
||||
};
|
||||
}
|
||||
|
||||
// Ensure `#lineStartIndices` are lazily calculated.
|
||||
this.#ensureLineStartIndicesFromIndex(index);
|
||||
|
||||
/*
|
||||
* To figure out which line `index` is on, determine the last place at which index could
|
||||
* be inserted into `#lineStartIndices` to keep the list sorted.
|
||||
*/
|
||||
const lineNumber =
|
||||
(index >= (this.#lineStartIndices.at(-1) ?? 0)
|
||||
? this.#lineStartIndices.length
|
||||
: findLineNumberBinarySearch(this.#lineStartIndices, index)) -
|
||||
1 +
|
||||
lineStart;
|
||||
|
||||
return {
|
||||
line: lineNumber,
|
||||
column:
|
||||
index -
|
||||
this.#lineStartIndices[lineNumber - lineStart] +
|
||||
columnStart,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a `{ line: number, column: number }` pair into a source text index.
|
||||
* @param {Object} loc A line/column location.
|
||||
* @param {number} loc.line The line number of the location. (0 or 1-indexed based on language.)
|
||||
* @param {number} loc.column The column number of the location. (0 or 1-indexed based on language.)
|
||||
* @throws {TypeError|RangeError} If `loc` is not an object with a numeric
|
||||
* `line` and `column`, if the `line` is less than or equal to zero or
|
||||
* the `line` or `column` is out of the expected range.
|
||||
* @returns {number} The index of the line/column location in a file.
|
||||
* @public
|
||||
*/
|
||||
getIndexFromLoc(loc) {
|
||||
if (
|
||||
loc === null ||
|
||||
typeof loc !== "object" ||
|
||||
typeof loc.line !== "number" ||
|
||||
typeof loc.column !== "number"
|
||||
) {
|
||||
throw new TypeError(
|
||||
"Expected `loc` to be an object with numeric `line` and `column` properties.",
|
||||
);
|
||||
}
|
||||
|
||||
const {
|
||||
start: { line: lineStart, column: columnStart },
|
||||
end: { line: lineEnd, column: columnEnd },
|
||||
} = this.getLoc(this.ast);
|
||||
|
||||
if (loc.line < lineStart || lineEnd < loc.line) {
|
||||
throw new RangeError(
|
||||
`Line number out of range (line ${loc.line} requested). Valid range: ${lineStart}-${lineEnd}`,
|
||||
);
|
||||
}
|
||||
|
||||
// If the loc is at the start, return the start index of the root node.
|
||||
if (loc.line === lineStart && loc.column === columnStart) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// If the loc is at the end, return the index one "spot" past the last character of the file.
|
||||
if (loc.line === lineEnd && loc.column === columnEnd) {
|
||||
return this.text.length;
|
||||
}
|
||||
|
||||
// Ensure `#lineStartIndices` are lazily calculated.
|
||||
this.#ensureLineStartIndicesFromLoc(loc, lineStart);
|
||||
|
||||
const isLastLine = loc.line === lineEnd;
|
||||
const lineStartIndex = this.#lineStartIndices[loc.line - lineStart];
|
||||
const lineEndIndex = isLastLine
|
||||
? this.text.length
|
||||
: this.#lineStartIndices[loc.line - lineStart + 1];
|
||||
const positionIndex = lineStartIndex + loc.column - columnStart;
|
||||
|
||||
if (
|
||||
loc.column < columnStart ||
|
||||
(isLastLine && positionIndex > lineEndIndex) ||
|
||||
(!isLastLine && positionIndex >= lineEndIndex)
|
||||
) {
|
||||
throw new RangeError(
|
||||
`Column number out of range (column ${loc.column} requested). Valid range for line ${loc.line}: ${columnStart}-${lineEndIndex - lineStartIndex + columnStart + (isLastLine ? 0 : -1)}`,
|
||||
);
|
||||
}
|
||||
|
||||
return positionIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the range information for the given node or token.
|
||||
* @param {Options['SyntaxElementWithLoc']} nodeOrToken The node or token to get the range information for.
|
||||
* @returns {SourceRange} The range information for the node or token.
|
||||
* @throws {Error} If the node or token does not have range information.
|
||||
*/
|
||||
getRange(nodeOrToken) {
|
||||
if (hasESTreeStyleRange(nodeOrToken)) {
|
||||
return nodeOrToken.range;
|
||||
}
|
||||
|
||||
if (hasPosStyleRange(nodeOrToken)) {
|
||||
return [
|
||||
nodeOrToken.position.start.offset,
|
||||
nodeOrToken.position.end.offset,
|
||||
];
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
"Custom getRange() method must be implemented in the subclass.",
|
||||
);
|
||||
}
|
||||
|
||||
/* eslint-disable no-unused-vars -- Required to complete interface. */
|
||||
/**
|
||||
* Returns the parent of the given node.
|
||||
* @param {Options['SyntaxElementWithLoc']} node The node to get the parent of.
|
||||
* @returns {Options['SyntaxElementWithLoc']|undefined} The parent of the node.
|
||||
* @throws {Error} If the method is not implemented in the subclass.
|
||||
*/
|
||||
getParent(node) {
|
||||
throw new Error("Not implemented.");
|
||||
}
|
||||
/* eslint-enable no-unused-vars -- Required to complete interface. */
|
||||
|
||||
/**
|
||||
* Gets all the ancestors of a given node
|
||||
* @param {Options['SyntaxElementWithLoc']} node The node
|
||||
* @returns {Array<Options['SyntaxElementWithLoc']>} All the ancestor nodes in the AST, not including the provided node, starting
|
||||
* from the root node at index 0 and going inwards to the parent node.
|
||||
* @throws {TypeError} When `node` is missing.
|
||||
*/
|
||||
getAncestors(node) {
|
||||
if (!node) {
|
||||
throw new TypeError("Missing required argument: node.");
|
||||
}
|
||||
|
||||
const ancestorsStartingAtParent = [];
|
||||
|
||||
for (
|
||||
let ancestor = this.getParent(node);
|
||||
ancestor;
|
||||
ancestor = this.getParent(ancestor)
|
||||
) {
|
||||
ancestorsStartingAtParent.push(ancestor);
|
||||
}
|
||||
|
||||
return ancestorsStartingAtParent.reverse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the source code for the given node.
|
||||
* @param {Options['SyntaxElementWithLoc']} [node] The AST node to get the text for.
|
||||
* @param {number} [beforeCount] The number of characters before the node to retrieve.
|
||||
* @param {number} [afterCount] The number of characters after the node to retrieve.
|
||||
* @returns {string} The text representing the AST node.
|
||||
* @public
|
||||
*/
|
||||
getText(node, beforeCount, afterCount) {
|
||||
if (node) {
|
||||
const range = this.getRange(node);
|
||||
return this.text.slice(
|
||||
Math.max(range[0] - (beforeCount || 0), 0),
|
||||
range[1] + (afterCount || 0),
|
||||
);
|
||||
}
|
||||
return this.text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entire source text split into an array of lines.
|
||||
* @returns {Array<string>} The source text as an array of lines.
|
||||
* @public
|
||||
*/
|
||||
get lines() {
|
||||
this.#ensureLines(); // Ensure `#lines` is lazily calculated.
|
||||
|
||||
return this.#lines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Traverse the source code and return the steps that were taken.
|
||||
* @returns {Iterable<TraversalStep>} The steps that were taken while traversing the source code.
|
||||
*/
|
||||
traverse() {
|
||||
throw new Error("Not implemented.");
|
||||
}
|
||||
}
|
||||
|
||||
export { CallMethodStep, ConfigCommentParser, Directive, TextSourceCodeBase, VisitNodeStep };
|
||||
6
frontend/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts
generated
vendored
6
frontend/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts
generated
vendored
@@ -1,6 +0,0 @@
|
||||
/**
|
||||
* @fileoverview Types for the plugin-kit package.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
export type StringConfig = Record<string, string | null>;
|
||||
export type BooleanConfig = Record<string, boolean>;
|
||||
7
frontend/node_modules/@eslint/plugin-kit/dist/esm/types.ts
generated
vendored
7
frontend/node_modules/@eslint/plugin-kit/dist/esm/types.ts
generated
vendored
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* @fileoverview Types for the plugin-kit package.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
export type StringConfig = Record<string, string | null>;
|
||||
export type BooleanConfig = Record<string, boolean>;
|
||||
61
frontend/node_modules/@eslint/plugin-kit/package.json
generated
vendored
61
frontend/node_modules/@eslint/plugin-kit/package.json
generated
vendored
@@ -1,61 +0,0 @@
|
||||
{
|
||||
"name": "@eslint/plugin-kit",
|
||||
"version": "0.4.1",
|
||||
"description": "Utilities for building ESLint plugins.",
|
||||
"author": "Nicholas C. Zakas",
|
||||
"type": "module",
|
||||
"main": "dist/esm/index.js",
|
||||
"types": "dist/esm/index.d.ts",
|
||||
"exports": {
|
||||
"require": {
|
||||
"types": "./dist/cjs/index.d.cts",
|
||||
"default": "./dist/cjs/index.cjs"
|
||||
},
|
||||
"import": {
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/eslint/rewrite.git",
|
||||
"directory": "packages/plugin-kit"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/eslint/rewrite/issues"
|
||||
},
|
||||
"homepage": "https://github.com/eslint/rewrite/tree/main/packages/plugin-kit#readme",
|
||||
"scripts": {
|
||||
"build:dedupe-types": "node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js",
|
||||
"build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts",
|
||||
"build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts",
|
||||
"pretest": "npm run build",
|
||||
"test": "mocha \"tests/**/*.test.js\"",
|
||||
"test:coverage": "c8 npm test",
|
||||
"test:jsr": "npx jsr@latest publish --dry-run",
|
||||
"test:types": "tsc -p tests/types/tsconfig.json"
|
||||
},
|
||||
"keywords": [
|
||||
"eslint",
|
||||
"eslintplugin",
|
||||
"eslint-plugin"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@eslint/core": "^0.17.0",
|
||||
"levn": "^0.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/levn": "^0.4.0",
|
||||
"rollup-plugin-copy": "^3.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
}
|
||||
}
|
||||
201
frontend/node_modules/@humanfs/core/LICENSE
generated
vendored
201
frontend/node_modules/@humanfs/core/LICENSE
generated
vendored
@@ -1,201 +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
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
||||
140
frontend/node_modules/@humanfs/core/README.md
generated
vendored
140
frontend/node_modules/@humanfs/core/README.md
generated
vendored
@@ -1,140 +0,0 @@
|
||||
# `@humanfs/core`
|
||||
|
||||
by [Nicholas C. Zakas](https://humanwhocodes.com)
|
||||
|
||||
If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate) or [nominate me](https://stars.github.com/nominate/) for a GitHub Star.
|
||||
|
||||
## Description
|
||||
|
||||
The core functionality for humanfs that is shared across all implementations for all runtimes. The contents of this package are intentionally runtime agnostic and are not intended to be used alone.
|
||||
|
||||
Currently, this package simply exports the `Hfs` class, which is an abstract base class intended to be inherited from in runtime-specific hfs packages (like `@humanfs/node`).
|
||||
|
||||
> [!WARNING]
|
||||
> This project is **experimental** and may change significantly before v1.0.0. Use at your own caution and definitely not in production!
|
||||
|
||||
## Installation
|
||||
|
||||
### Node.js
|
||||
|
||||
Install using your favorite package manager for Node.js:
|
||||
|
||||
```shell
|
||||
npm install @humanfs/core
|
||||
|
||||
# or
|
||||
|
||||
pnpm install @humanfs/core
|
||||
|
||||
# or
|
||||
|
||||
yarn add @humanfs/core
|
||||
|
||||
# or
|
||||
|
||||
bun install @humanfs/core
|
||||
```
|
||||
|
||||
Then you can import the `Hfs` and `Path` classes like this:
|
||||
|
||||
```js
|
||||
import { Hfs, Path } from "@humanfs/core";
|
||||
```
|
||||
|
||||
### Deno
|
||||
|
||||
Install using [JSR](https://jsr.io):
|
||||
|
||||
```shell
|
||||
deno add @humanfs/core
|
||||
|
||||
# or
|
||||
|
||||
jsr add @humanfs/core
|
||||
```
|
||||
|
||||
Then you can import the `Hfs` class like this:
|
||||
|
||||
```js
|
||||
import { Hfs, Path } from "@humanfs/core";
|
||||
```
|
||||
|
||||
### Browser
|
||||
|
||||
It's recommended to import the minified version to save bandwidth:
|
||||
|
||||
```js
|
||||
import { Hfs, Path } from "https://cdn.skypack.dev/@humanfs/core?min";
|
||||
```
|
||||
|
||||
However, you can also import the unminified version for debugging purposes:
|
||||
|
||||
```js
|
||||
import { Hfs, Path } from "https://cdn.skypack.dev/@humanfs/core";
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### `Hfs` Class
|
||||
|
||||
The `Hfs` class contains all of the basic functionality for an `Hfs` instance *without* a predefined impl. This class is mostly used for creating runtime-specific impls, such as `NodeHfs` and `DenoHfs`.
|
||||
|
||||
You can create your own instance by providing an `impl` directly:
|
||||
|
||||
```js
|
||||
const hfs = new Hfs({ impl: { async text() {} }});
|
||||
```
|
||||
|
||||
The specified `impl` becomes the base impl for the instance, meaning you can always reset back to it using `resetImpl()`.
|
||||
|
||||
You can also inherit from `Hfs` to create your own class with a preconfigured impl, such as:
|
||||
|
||||
```js
|
||||
class MyHfs extends Hfs {
|
||||
constructor() {
|
||||
super({
|
||||
impl: myImpl
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### `Path` Class
|
||||
|
||||
The `Path` class represents the path to a directory or file within a file system. It's an abstract representation that can be used even outside of traditional file systems where string paths might not make sense.
|
||||
|
||||
```js
|
||||
const myPath = new Path(["dir", "subdir"]);
|
||||
console.log(myPath.toString()); // "dir/subdir"
|
||||
|
||||
// add another step
|
||||
myPath.push("file.txt");
|
||||
console.log(myPath.toString()); // "dir/subdir/file.txt"
|
||||
|
||||
// get just the last step
|
||||
console.log(myPath.name); // "file.txt"
|
||||
|
||||
// change just the last step
|
||||
myPath.name = "file.json";
|
||||
console.log(myPath.name); // "file.json"
|
||||
console.log(myPath.toString()); // "dir/subdir/file.json"
|
||||
|
||||
// get the size of the path
|
||||
console.log(myPath.size); // 3
|
||||
|
||||
// remove the last step
|
||||
myPath.pop();
|
||||
console.log(myPath.toString()); // "dir/subdir"
|
||||
|
||||
// iterate over the steps
|
||||
for (const step of myPath) {
|
||||
// do something
|
||||
}
|
||||
|
||||
// create a new path from a string
|
||||
const newPath = Path.fromString("/foo/bar");
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Apache 2.0
|
||||
64
frontend/node_modules/@humanfs/core/dist/errors.d.ts
generated
vendored
64
frontend/node_modules/@humanfs/core/dist/errors.d.ts
generated
vendored
@@ -1,64 +0,0 @@
|
||||
/**
|
||||
* @fileoverview Common error classes
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
/**
|
||||
* Error thrown when a file or directory is not found.
|
||||
*/
|
||||
export class NotFoundError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} message The error message.
|
||||
*/
|
||||
constructor(message: string);
|
||||
/**
|
||||
* Error code.
|
||||
* @type {string}
|
||||
*/
|
||||
code: string;
|
||||
}
|
||||
/**
|
||||
* Error thrown when an operation is not permitted.
|
||||
*/
|
||||
export class PermissionError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} message The error message.
|
||||
*/
|
||||
constructor(message: string);
|
||||
/**
|
||||
* Error code.
|
||||
* @type {string}
|
||||
*/
|
||||
code: string;
|
||||
}
|
||||
/**
|
||||
* Error thrown when an operation is not allowed on a directory.
|
||||
*/
|
||||
export class DirectoryError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} message The error message.
|
||||
*/
|
||||
constructor(message: string);
|
||||
/**
|
||||
* Error code.
|
||||
* @type {string}
|
||||
*/
|
||||
code: string;
|
||||
}
|
||||
/**
|
||||
* Error thrown when a directory is not empty.
|
||||
*/
|
||||
export class NotEmptyError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} message The error message.
|
||||
*/
|
||||
constructor(message: string);
|
||||
/**
|
||||
* Error code.
|
||||
* @type {string}
|
||||
*/
|
||||
code: string;
|
||||
}
|
||||
193
frontend/node_modules/@humanfs/core/dist/fsx.d.ts
generated
vendored
193
frontend/node_modules/@humanfs/core/dist/fsx.d.ts
generated
vendored
@@ -1,193 +0,0 @@
|
||||
/**
|
||||
* @fileoverview The main file for the hfs package.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
/** @typedef{import("@humanfs/types").HfsImpl} HfsImpl */
|
||||
/** @typedef{import("@humanfs/types").HfsDirectoryEntry} HfsDirectoryEntry */
|
||||
/**
|
||||
* Error to represent when a method is missing on an impl.
|
||||
*/
|
||||
export class NoSuchMethodError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} methodName The name of the method that was missing.
|
||||
*/
|
||||
constructor(methodName: string);
|
||||
}
|
||||
/**
|
||||
* Error to represent when an impl is already set.
|
||||
*/
|
||||
export class ImplAlreadySetError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
*/
|
||||
constructor();
|
||||
}
|
||||
/**
|
||||
* A class representing a log entry.
|
||||
*/
|
||||
export class LogEntry {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} type The type of log entry.
|
||||
* @param {any} [data] The data associated with the log entry.
|
||||
*/
|
||||
constructor(type: string, data?: any);
|
||||
/**
|
||||
* The time at which the log entry was created.
|
||||
* @type {number}
|
||||
*/
|
||||
timestamp: number;
|
||||
methodName: string;
|
||||
data: any;
|
||||
#private;
|
||||
}
|
||||
/**
|
||||
* A class representing a file system utility library.
|
||||
* @implements {HfsImpl}
|
||||
*/
|
||||
export class Hfs implements HfsImpl {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {object} options The options for the instance.
|
||||
* @param {HfsImpl} options.impl The implementation to use.
|
||||
*/
|
||||
constructor({ impl }: {
|
||||
impl: HfsImpl;
|
||||
});
|
||||
/**
|
||||
* Starts a new log with the given name.
|
||||
* @param {string} name The name of the log to start;
|
||||
* @returns {void}
|
||||
* @throws {Error} When the log already exists.
|
||||
* @throws {TypeError} When the name is not a non-empty string.
|
||||
*/
|
||||
logStart(name: string): void;
|
||||
/**
|
||||
* Ends a log with the given name and returns the entries.
|
||||
* @param {string} name The name of the log to end.
|
||||
* @returns {Array<LogEntry>} The entries in the log.
|
||||
* @throws {Error} When the log does not exist.
|
||||
*/
|
||||
logEnd(name: string): Array<LogEntry>;
|
||||
/**
|
||||
* Determines if the current implementation is the base implementation.
|
||||
* @returns {boolean} True if the current implementation is the base implementation.
|
||||
*/
|
||||
isBaseImpl(): boolean;
|
||||
/**
|
||||
* Sets the implementation for this instance.
|
||||
* @param {object} impl The implementation to use.
|
||||
* @returns {void}
|
||||
*/
|
||||
setImpl(impl: object): void;
|
||||
/**
|
||||
* Resets the implementation for this instance back to its original.
|
||||
* @returns {void}
|
||||
*/
|
||||
resetImpl(): void;
|
||||
/**
|
||||
* Reads the given file and returns the contents as text. Assumes UTF-8 encoding.
|
||||
* @param {string} filePath The file to read.
|
||||
* @returns {Promise<string|undefined>} The contents of the file.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
*/
|
||||
text(filePath: string): Promise<string | undefined>;
|
||||
/**
|
||||
* Reads the given file and returns the contents as JSON. Assumes UTF-8 encoding.
|
||||
* @param {string} filePath The file to read.
|
||||
* @returns {Promise<any|undefined>} The contents of the file as JSON.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {SyntaxError} When the file contents are not valid JSON.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
*/
|
||||
json(filePath: string): Promise<any | undefined>;
|
||||
/**
|
||||
* Reads the given file and returns the contents as an ArrayBuffer.
|
||||
* @param {string} filePath The file to read.
|
||||
* @returns {Promise<ArrayBuffer|undefined>} The contents of the file as an ArrayBuffer.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
* @deprecated Use bytes() instead.
|
||||
*/
|
||||
arrayBuffer(filePath: string): Promise<ArrayBuffer | undefined>;
|
||||
/**
|
||||
* Reads the given file and returns the contents as an Uint8Array.
|
||||
* @param {string} filePath The file to read.
|
||||
* @returns {Promise<Uint8Array|undefined>} The contents of the file as an Uint8Array.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
*/
|
||||
bytes(filePath: string): Promise<Uint8Array | undefined>;
|
||||
/**
|
||||
* Writes the given data to the given file. Creates any necessary directories along the way.
|
||||
* If the data is a string, UTF-8 encoding is used.
|
||||
* @param {string} filePath The file to write.
|
||||
* @param {any} contents The data to write.
|
||||
* @returns {Promise<void>} A promise that resolves when the file is written.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
*/
|
||||
write(filePath: string, contents: any): Promise<void>;
|
||||
/**
|
||||
* Determines if the given file exists.
|
||||
* @param {string} filePath The file to check.
|
||||
* @returns {Promise<boolean>} True if the file exists.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
*/
|
||||
isFile(filePath: string): Promise<boolean>;
|
||||
/**
|
||||
* Determines if the given directory exists.
|
||||
* @param {string} dirPath The directory to check.
|
||||
* @returns {Promise<boolean>} True if the directory exists.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the directory path is not a non-empty string.
|
||||
*/
|
||||
isDirectory(dirPath: string): Promise<boolean>;
|
||||
/**
|
||||
* Creates the given directory.
|
||||
* @param {string} dirPath The directory to create.
|
||||
* @returns {Promise<void>} A promise that resolves when the directory is created.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the directory path is not a non-empty string.
|
||||
*/
|
||||
createDirectory(dirPath: string): Promise<void>;
|
||||
/**
|
||||
* Deletes the given file.
|
||||
* @param {string} filePath The file to delete.
|
||||
* @returns {Promise<void>} A promise that resolves when the file is deleted.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
*/
|
||||
delete(filePath: string): Promise<void>;
|
||||
/**
|
||||
* Deletes the given directory.
|
||||
* @param {string} dirPath The directory to delete.
|
||||
* @returns {Promise<void>} A promise that resolves when the directory is deleted.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the directory path is not a non-empty string.
|
||||
*/
|
||||
deleteAll(dirPath: string): Promise<void>;
|
||||
/**
|
||||
* Returns a list of directory entries for the given path.
|
||||
* @param {string} dirPath The path to the directory to read.
|
||||
* @returns {AsyncIterable<HfsDirectoryEntry>} A promise that resolves with the
|
||||
* directory entries.
|
||||
* @throws {TypeError} If the directory path is not a string.
|
||||
* @throws {Error} If the directory cannot be read.
|
||||
*/
|
||||
list(dirPath: string): AsyncIterable<HfsDirectoryEntry>;
|
||||
/**
|
||||
* Returns the size of the given file.
|
||||
* @param {string} filePath The path to the file to read.
|
||||
* @returns {Promise<number>} A promise that resolves with the size of the file.
|
||||
* @throws {TypeError} If the file path is not a string.
|
||||
* @throws {Error} If the file cannot be read.
|
||||
*/
|
||||
size(filePath: string): Promise<number>;
|
||||
#private;
|
||||
}
|
||||
export type HfsImpl = import("@humanfs/types").HfsImpl;
|
||||
export type HfsDirectoryEntry = import("@humanfs/types").HfsDirectoryEntry;
|
||||
288
frontend/node_modules/@humanfs/core/dist/hfs.d.ts
generated
vendored
288
frontend/node_modules/@humanfs/core/dist/hfs.d.ts
generated
vendored
@@ -1,288 +0,0 @@
|
||||
/**
|
||||
* Error to represent when a method is missing on an impl.
|
||||
*/
|
||||
export class NoSuchMethodError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} methodName The name of the method that was missing.
|
||||
*/
|
||||
constructor(methodName: string);
|
||||
}
|
||||
/**
|
||||
* Error to represent when a method is not supported on an impl. This happens
|
||||
* when a method on `Hfs` is called with one name and the corresponding method
|
||||
* on the impl has a different name. (Example: `text()` and `bytes()`.)
|
||||
*/
|
||||
export class MethodNotSupportedError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} methodName The name of the method that was missing.
|
||||
*/
|
||||
constructor(methodName: string);
|
||||
}
|
||||
/**
|
||||
* Error to represent when an impl is already set.
|
||||
*/
|
||||
export class ImplAlreadySetError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
*/
|
||||
constructor();
|
||||
}
|
||||
/**
|
||||
* A class representing a log entry.
|
||||
*/
|
||||
export class LogEntry {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} type The type of log entry.
|
||||
* @param {any} [data] The data associated with the log entry.
|
||||
*/
|
||||
constructor(type: string, data?: any);
|
||||
/**
|
||||
* The type of log entry.
|
||||
* @type {string}
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* The data associated with the log entry.
|
||||
* @type {any}
|
||||
*/
|
||||
data: any;
|
||||
/**
|
||||
* The time at which the log entry was created.
|
||||
* @type {number}
|
||||
*/
|
||||
timestamp: number;
|
||||
}
|
||||
/**
|
||||
* A class representing a file system utility library.
|
||||
* @implements {HfsImpl}
|
||||
*/
|
||||
export class Hfs implements HfsImpl {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {object} options The options for the instance.
|
||||
* @param {HfsImpl} options.impl The implementation to use.
|
||||
*/
|
||||
constructor({ impl }: {
|
||||
impl: HfsImpl;
|
||||
});
|
||||
/**
|
||||
* Starts a new log with the given name.
|
||||
* @param {string} name The name of the log to start;
|
||||
* @returns {void}
|
||||
* @throws {Error} When the log already exists.
|
||||
* @throws {TypeError} When the name is not a non-empty string.
|
||||
*/
|
||||
logStart(name: string): void;
|
||||
/**
|
||||
* Ends a log with the given name and returns the entries.
|
||||
* @param {string} name The name of the log to end.
|
||||
* @returns {Array<LogEntry>} The entries in the log.
|
||||
* @throws {Error} When the log does not exist.
|
||||
*/
|
||||
logEnd(name: string): Array<LogEntry>;
|
||||
/**
|
||||
* Determines if the current implementation is the base implementation.
|
||||
* @returns {boolean} True if the current implementation is the base implementation.
|
||||
*/
|
||||
isBaseImpl(): boolean;
|
||||
/**
|
||||
* Sets the implementation for this instance.
|
||||
* @param {object} impl The implementation to use.
|
||||
* @returns {void}
|
||||
*/
|
||||
setImpl(impl: object): void;
|
||||
/**
|
||||
* Resets the implementation for this instance back to its original.
|
||||
* @returns {void}
|
||||
*/
|
||||
resetImpl(): void;
|
||||
/**
|
||||
* Reads the given file and returns the contents as text. Assumes UTF-8 encoding.
|
||||
* @param {string|URL} filePath The file to read.
|
||||
* @returns {Promise<string|undefined>} The contents of the file.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
*/
|
||||
text(filePath: string | URL): Promise<string | undefined>;
|
||||
/**
|
||||
* Reads the given file and returns the contents as JSON. Assumes UTF-8 encoding.
|
||||
* @param {string|URL} filePath The file to read.
|
||||
* @returns {Promise<any|undefined>} The contents of the file as JSON.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {SyntaxError} When the file contents are not valid JSON.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
*/
|
||||
json(filePath: string | URL): Promise<any | undefined>;
|
||||
/**
|
||||
* Reads the given file and returns the contents as an ArrayBuffer.
|
||||
* @param {string|URL} filePath The file to read.
|
||||
* @returns {Promise<ArrayBuffer|undefined>} The contents of the file as an ArrayBuffer.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
* @deprecated Use bytes() instead.
|
||||
*/
|
||||
arrayBuffer(filePath: string | URL): Promise<ArrayBuffer | undefined>;
|
||||
/**
|
||||
* Reads the given file and returns the contents as an Uint8Array.
|
||||
* @param {string|URL} filePath The file to read.
|
||||
* @returns {Promise<Uint8Array|undefined>} The contents of the file as an Uint8Array.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
*/
|
||||
bytes(filePath: string | URL): Promise<Uint8Array | undefined>;
|
||||
/**
|
||||
* Writes the given data to the given file. Creates any necessary directories along the way.
|
||||
* If the data is a string, UTF-8 encoding is used.
|
||||
* @param {string|URL} filePath The file to write.
|
||||
* @param {string|ArrayBuffer|ArrayBufferView} contents The data to write.
|
||||
* @returns {Promise<void>} A promise that resolves when the file is written.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
*/
|
||||
write(filePath: string | URL, contents: string | ArrayBuffer | ArrayBufferView): Promise<void>;
|
||||
/**
|
||||
* Appends the given data to the given file. Creates any necessary directories along the way.
|
||||
* If the data is a string, UTF-8 encoding is used.
|
||||
* @param {string|URL} filePath The file to append to.
|
||||
* @param {string|ArrayBuffer|ArrayBufferView} contents The data to append.
|
||||
* @returns {Promise<void>} A promise that resolves when the file is appended to.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
* @throws {TypeError} When the file contents are not a string or ArrayBuffer.
|
||||
* @throws {Error} When the file cannot be appended to.
|
||||
*/
|
||||
append(filePath: string | URL, contents: string | ArrayBuffer | ArrayBufferView): Promise<void>;
|
||||
/**
|
||||
* Determines if the given file exists.
|
||||
* @param {string|URL} filePath The file to check.
|
||||
* @returns {Promise<boolean>} True if the file exists.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
*/
|
||||
isFile(filePath: string | URL): Promise<boolean>;
|
||||
/**
|
||||
* Determines if the given directory exists.
|
||||
* @param {string|URL} dirPath The directory to check.
|
||||
* @returns {Promise<boolean>} True if the directory exists.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the directory path is not a non-empty string.
|
||||
*/
|
||||
isDirectory(dirPath: string | URL): Promise<boolean>;
|
||||
/**
|
||||
* Creates the given directory.
|
||||
* @param {string|URL} dirPath The directory to create.
|
||||
* @returns {Promise<void>} A promise that resolves when the directory is created.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the directory path is not a non-empty string.
|
||||
*/
|
||||
createDirectory(dirPath: string | URL): Promise<void>;
|
||||
/**
|
||||
* Deletes the given file or empty directory.
|
||||
* @param {string|URL} filePath The file to delete.
|
||||
* @returns {Promise<boolean>} A promise that resolves when the file or
|
||||
* directory is deleted, true if the file or directory is deleted, false
|
||||
* if the file or directory does not exist.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
*/
|
||||
delete(filePath: string | URL): Promise<boolean>;
|
||||
/**
|
||||
* Deletes the given file or directory recursively.
|
||||
* @param {string|URL} dirPath The directory to delete.
|
||||
* @returns {Promise<boolean>} A promise that resolves when the file or
|
||||
* directory is deleted, true if the file or directory is deleted, false
|
||||
* if the file or directory does not exist.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the directory path is not a non-empty string.
|
||||
*/
|
||||
deleteAll(dirPath: string | URL): Promise<boolean>;
|
||||
/**
|
||||
* Returns a list of directory entries for the given path.
|
||||
* @param {string|URL} dirPath The path to the directory to read.
|
||||
* @returns {AsyncIterable<HfsDirectoryEntry>} A promise that resolves with the
|
||||
* directory entries.
|
||||
* @throws {TypeError} If the directory path is not a string or URL.
|
||||
* @throws {Error} If the directory cannot be read.
|
||||
*/
|
||||
list(dirPath: string | URL): AsyncIterable<HfsDirectoryEntry>;
|
||||
/**
|
||||
* Walks a directory using a depth-first traversal and returns the entries
|
||||
* from the traversal.
|
||||
* @param {string|URL} dirPath The path to the directory to walk.
|
||||
* @param {Object} [options] The options for the walk.
|
||||
* @param {(entry:HfsWalkEntry) => Promise<boolean>|boolean} [options.directoryFilter] A filter function to determine
|
||||
* if a directory's entries should be included in the walk.
|
||||
* @param {(entry:HfsWalkEntry) => Promise<boolean>|boolean} [options.entryFilter] A filter function to determine if
|
||||
* an entry should be included in the walk.
|
||||
* @returns {AsyncIterable<HfsWalkEntry>} A promise that resolves with the
|
||||
* directory entries.
|
||||
* @throws {TypeError} If the directory path is not a string or URL.
|
||||
* @throws {Error} If the directory cannot be read.
|
||||
*/
|
||||
walk(dirPath: string | URL, { directoryFilter, entryFilter }?: {
|
||||
directoryFilter?: (entry: HfsWalkEntry) => Promise<boolean> | boolean;
|
||||
entryFilter?: (entry: HfsWalkEntry) => Promise<boolean> | boolean;
|
||||
}): AsyncIterable<HfsWalkEntry>;
|
||||
/**
|
||||
* Returns the size of the given file.
|
||||
* @param {string|URL} filePath The path to the file to read.
|
||||
* @returns {Promise<number>} A promise that resolves with the size of the file.
|
||||
* @throws {TypeError} If the file path is not a string or URL.
|
||||
* @throws {Error} If the file cannot be read.
|
||||
*/
|
||||
size(filePath: string | URL): Promise<number>;
|
||||
/**
|
||||
* Returns the last modified timestamp of the given file or directory.
|
||||
* @param {string|URL} fileOrDirPath The path to the file or directory.
|
||||
* @returns {Promise<Date|undefined>} A promise that resolves with the last modified date
|
||||
* or undefined if the file or directory does not exist.
|
||||
* @throws {TypeError} If the path is not a string or URL.
|
||||
*/
|
||||
lastModified(fileOrDirPath: string | URL): Promise<Date | undefined>;
|
||||
/**
|
||||
* Copys a file from one location to another.
|
||||
* @param {string|URL} source The path to the file to copy.
|
||||
* @param {string|URL} destination The path to the new file.
|
||||
* @returns {Promise<void>} A promise that resolves when the file is copied.
|
||||
* @throws {TypeError} If the file path is not a string or URL.
|
||||
* @throws {Error} If the file cannot be copied.
|
||||
*/
|
||||
copy(source: string | URL, destination: string | URL): Promise<void>;
|
||||
/**
|
||||
* Copies a file or directory from one location to another.
|
||||
* @param {string|URL} source The path to the file or directory to copy.
|
||||
* @param {string|URL} destination The path to copy the file or directory to.
|
||||
* @returns {Promise<void>} A promise that resolves when the file or directory is
|
||||
* copied.
|
||||
* @throws {TypeError} If the directory path is not a string or URL.
|
||||
* @throws {Error} If the directory cannot be copied.
|
||||
*/
|
||||
copyAll(source: string | URL, destination: string | URL): Promise<void>;
|
||||
/**
|
||||
* Moves a file from the source path to the destination path.
|
||||
* @param {string|URL} source The location of the file to move.
|
||||
* @param {string|URL} destination The destination of the file to move.
|
||||
* @returns {Promise<void>} A promise that resolves when the move is complete.
|
||||
* @throws {TypeError} If the file or directory paths are not strings.
|
||||
* @throws {Error} If the file or directory cannot be moved.
|
||||
*/
|
||||
move(source: string | URL, destination: string | URL): Promise<void>;
|
||||
/**
|
||||
* Moves a file or directory from one location to another.
|
||||
* @param {string|URL} source The path to the file or directory to move.
|
||||
* @param {string|URL} destination The path to move the file or directory to.
|
||||
* @returns {Promise<void>} A promise that resolves when the file or directory is
|
||||
* moved.
|
||||
* @throws {TypeError} If the source is not a string or URL.
|
||||
* @throws {TypeError} If the destination is not a string or URL.
|
||||
* @throws {Error} If the file or directory cannot be moved.
|
||||
*/
|
||||
moveAll(source: string | URL, destination: string | URL): Promise<void>;
|
||||
#private;
|
||||
}
|
||||
export type HfsImpl = import("@humanfs/types").HfsImpl;
|
||||
export type HfsDirectoryEntry = import("@humanfs/types").HfsDirectoryEntry;
|
||||
export type HfsWalkEntry = import("@humanfs/types").HfsWalkEntry;
|
||||
3
frontend/node_modules/@humanfs/core/dist/index.d.ts
generated
vendored
3
frontend/node_modules/@humanfs/core/dist/index.d.ts
generated
vendored
@@ -1,3 +0,0 @@
|
||||
export { Hfs } from "./hfs.js";
|
||||
export { Path } from "./path.js";
|
||||
export * from "./errors.js";
|
||||
82
frontend/node_modules/@humanfs/core/dist/path.d.ts
generated
vendored
82
frontend/node_modules/@humanfs/core/dist/path.d.ts
generated
vendored
@@ -1,82 +0,0 @@
|
||||
export class Path {
|
||||
/**
|
||||
* Creates a new path based on the argument type. If the argument is a string,
|
||||
* it is assumed to be a file or directory path and is converted to a Path
|
||||
* instance. If the argument is a URL, it is assumed to be a file URL and is
|
||||
* converted to a Path instance. If the argument is a Path instance, it is
|
||||
* copied into a new Path instance. If the argument is an array, it is assumed
|
||||
* to be the steps of a path and is used to create a new Path instance.
|
||||
* @param {string|URL|Path|Array<string>} pathish The value to convert to a Path instance.
|
||||
* @returns {Path} A new Path instance.
|
||||
* @throws {TypeError} When pathish is not a string, URL, Path, or Array.
|
||||
* @throws {TypeError} When pathish is a string and is empty.
|
||||
*/
|
||||
static from(pathish: string | URL | Path | Array<string>): Path;
|
||||
/**
|
||||
* Creates a new Path instance from a string.
|
||||
* @param {string} fileOrDirPath The file or directory path to convert.
|
||||
* @returns {Path} A new Path instance.
|
||||
* @deprecated Use Path.from() instead.
|
||||
*/
|
||||
static fromString(fileOrDirPath: string): Path;
|
||||
/**
|
||||
* Creates a new Path instance from a URL.
|
||||
* @param {URL} url The URL to convert.
|
||||
* @returns {Path} A new Path instance.
|
||||
* @throws {TypeError} When url is not a URL instance.
|
||||
* @throws {TypeError} When url.pathname is empty.
|
||||
* @throws {TypeError} When url.protocol is not "file:".
|
||||
* @deprecated Use Path.from() instead.
|
||||
*/
|
||||
static fromURL(url: URL): Path;
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Iterable<string>} [steps] The steps to use for the path.
|
||||
* @throws {TypeError} When steps is not iterable.
|
||||
*/
|
||||
constructor(steps?: Iterable<string>);
|
||||
/**
|
||||
* Adds steps to the end of the path.
|
||||
* @param {...string} steps The steps to add to the path.
|
||||
* @returns {void}
|
||||
*/
|
||||
push(...steps: string[]): void;
|
||||
/**
|
||||
* Removes the last step from the path.
|
||||
* @returns {string} The last step in the path.
|
||||
*/
|
||||
pop(): string;
|
||||
/**
|
||||
* Returns an iterator for steps in the path.
|
||||
* @returns {IterableIterator<string>} An iterator for the steps in the path.
|
||||
*/
|
||||
steps(): IterableIterator<string>;
|
||||
/**
|
||||
* Sets the name (the last step) of the path.
|
||||
* @type {string}
|
||||
*/
|
||||
set name(value: string);
|
||||
/**
|
||||
* Retrieves the name (the last step) of the path.
|
||||
* @type {string}
|
||||
*/
|
||||
get name(): string;
|
||||
/**
|
||||
* Retrieves the size of the path.
|
||||
* @type {number}
|
||||
*/
|
||||
get size(): number;
|
||||
/**
|
||||
* Returns the path as a string.
|
||||
* @returns {string} The path as a string.
|
||||
*/
|
||||
toString(): string;
|
||||
/**
|
||||
* Returns an iterator for the steps in the path.
|
||||
* @returns {IterableIterator<string>} An iterator for the steps in the path.
|
||||
*/
|
||||
[Symbol.iterator](): IterableIterator<string>;
|
||||
#private;
|
||||
}
|
||||
export type HfsImpl = import("@humanfs/types").HfsImpl;
|
||||
export type HfsDirectoryEntry = import("@humanfs/types").HfsDirectoryEntry;
|
||||
52
frontend/node_modules/@humanfs/core/package.json
generated
vendored
52
frontend/node_modules/@humanfs/core/package.json
generated
vendored
@@ -1,52 +0,0 @@
|
||||
{
|
||||
"name": "@humanfs/core",
|
||||
"version": "0.19.1",
|
||||
"description": "The core of the humanfs library.",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./src/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"src"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"prepare": "npm run build",
|
||||
"pretest": "npm run build",
|
||||
"test": "c8 mocha tests"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/humanwhocodes/humanfs.git"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"keywords": [
|
||||
"filesystem",
|
||||
"fs",
|
||||
"hfs",
|
||||
"files"
|
||||
],
|
||||
"author": "Nicholas C. Zakas",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/humanwhocodes/humanfs/issues"
|
||||
},
|
||||
"homepage": "https://github.com/humanwhocodes/humanfs#readme",
|
||||
"engines": {
|
||||
"node": ">=18.18.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@humanfs/types": "^0.15.0",
|
||||
"c8": "^9.0.0",
|
||||
"mocha": "^10.2.0",
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
}
|
||||
105
frontend/node_modules/@humanfs/core/src/errors.js
generated
vendored
105
frontend/node_modules/@humanfs/core/src/errors.js
generated
vendored
@@ -1,105 +0,0 @@
|
||||
/**
|
||||
* @fileoverview Common error classes
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
/**
|
||||
* Error thrown when a file or directory is not found.
|
||||
*/
|
||||
export class NotFoundError extends Error {
|
||||
/**
|
||||
* Name of the error class.
|
||||
* @type {string}
|
||||
*/
|
||||
name = "NotFoundError";
|
||||
|
||||
/**
|
||||
* Error code.
|
||||
* @type {string}
|
||||
*/
|
||||
code = "ENOENT";
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} message The error message.
|
||||
*/
|
||||
constructor(message) {
|
||||
super(`ENOENT: No such file or directory, ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Error thrown when an operation is not permitted.
|
||||
*/
|
||||
export class PermissionError extends Error {
|
||||
/**
|
||||
* Name of the error class.
|
||||
* @type {string}
|
||||
*/
|
||||
name = "PermissionError";
|
||||
|
||||
/**
|
||||
* Error code.
|
||||
* @type {string}
|
||||
*/
|
||||
code = "EPERM";
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} message The error message.
|
||||
*/
|
||||
constructor(message) {
|
||||
super(`EPERM: Operation not permitted, ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Error thrown when an operation is not allowed on a directory.
|
||||
*/
|
||||
|
||||
export class DirectoryError extends Error {
|
||||
/**
|
||||
* Name of the error class.
|
||||
* @type {string}
|
||||
*/
|
||||
name = "DirectoryError";
|
||||
|
||||
/**
|
||||
* Error code.
|
||||
* @type {string}
|
||||
*/
|
||||
code = "EISDIR";
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} message The error message.
|
||||
*/
|
||||
constructor(message) {
|
||||
super(`EISDIR: Illegal operation on a directory, ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Error thrown when a directory is not empty.
|
||||
*/
|
||||
export class NotEmptyError extends Error {
|
||||
/**
|
||||
* Name of the error class.
|
||||
* @type {string}
|
||||
*/
|
||||
name = "NotEmptyError";
|
||||
|
||||
/**
|
||||
* Error code.
|
||||
* @type {string}
|
||||
*/
|
||||
code = "ENOTEMPTY";
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} message The error message.
|
||||
*/
|
||||
constructor(message) {
|
||||
super(`ENOTEMPTY: Directory not empty, ${message}`);
|
||||
}
|
||||
}
|
||||
699
frontend/node_modules/@humanfs/core/src/hfs.js
generated
vendored
699
frontend/node_modules/@humanfs/core/src/hfs.js
generated
vendored
@@ -1,699 +0,0 @@
|
||||
/**
|
||||
* @fileoverview The main file for the humanfs package.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
/* global URL, TextDecoder, TextEncoder */
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Types
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/** @typedef {import("@humanfs/types").HfsImpl} HfsImpl */
|
||||
/** @typedef {import("@humanfs/types").HfsDirectoryEntry} HfsDirectoryEntry */
|
||||
/** @typedef {import("@humanfs/types").HfsWalkEntry} HfsWalkEntry */
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const decoder = new TextDecoder();
|
||||
const encoder = new TextEncoder();
|
||||
|
||||
/**
|
||||
* Error to represent when a method is missing on an impl.
|
||||
*/
|
||||
export class NoSuchMethodError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} methodName The name of the method that was missing.
|
||||
*/
|
||||
constructor(methodName) {
|
||||
super(`Method "${methodName}" does not exist on impl.`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Error to represent when a method is not supported on an impl. This happens
|
||||
* when a method on `Hfs` is called with one name and the corresponding method
|
||||
* on the impl has a different name. (Example: `text()` and `bytes()`.)
|
||||
*/
|
||||
export class MethodNotSupportedError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} methodName The name of the method that was missing.
|
||||
*/
|
||||
constructor(methodName) {
|
||||
super(`Method "${methodName}" is not supported on this impl.`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Error to represent when an impl is already set.
|
||||
*/
|
||||
export class ImplAlreadySetError extends Error {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
*/
|
||||
constructor() {
|
||||
super(`Implementation already set.`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the given path is a valid file path.
|
||||
* @param {any} fileOrDirPath The path to check.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} When the path is not a non-empty string.
|
||||
*/
|
||||
function assertValidFileOrDirPath(fileOrDirPath) {
|
||||
if (
|
||||
!fileOrDirPath ||
|
||||
(!(fileOrDirPath instanceof URL) && typeof fileOrDirPath !== "string")
|
||||
) {
|
||||
throw new TypeError("Path must be a non-empty string or URL.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the given file contents are valid.
|
||||
* @param {any} contents The contents to check.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} When the contents are not a string or ArrayBuffer.
|
||||
*/
|
||||
function assertValidFileContents(contents) {
|
||||
if (
|
||||
typeof contents !== "string" &&
|
||||
!(contents instanceof ArrayBuffer) &&
|
||||
!ArrayBuffer.isView(contents)
|
||||
) {
|
||||
throw new TypeError(
|
||||
"File contents must be a string, ArrayBuffer, or ArrayBuffer view.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the given contents to Uint8Array.
|
||||
* @param {any} contents The data to convert.
|
||||
* @returns {Uint8Array} The converted Uint8Array.
|
||||
* @throws {TypeError} When the contents are not a string or ArrayBuffer.
|
||||
*/
|
||||
function toUint8Array(contents) {
|
||||
if (contents instanceof Uint8Array) {
|
||||
return contents;
|
||||
}
|
||||
|
||||
if (typeof contents === "string") {
|
||||
return encoder.encode(contents);
|
||||
}
|
||||
|
||||
if (contents instanceof ArrayBuffer) {
|
||||
return new Uint8Array(contents);
|
||||
}
|
||||
|
||||
if (ArrayBuffer.isView(contents)) {
|
||||
const bytes = contents.buffer.slice(
|
||||
contents.byteOffset,
|
||||
contents.byteOffset + contents.byteLength,
|
||||
);
|
||||
return new Uint8Array(bytes);
|
||||
}
|
||||
throw new TypeError(
|
||||
"Invalid contents type. Expected string or ArrayBuffer.",
|
||||
);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* A class representing a log entry.
|
||||
*/
|
||||
export class LogEntry {
|
||||
/**
|
||||
* The type of log entry.
|
||||
* @type {string}
|
||||
*/
|
||||
type;
|
||||
|
||||
/**
|
||||
* The data associated with the log entry.
|
||||
* @type {any}
|
||||
*/
|
||||
data;
|
||||
|
||||
/**
|
||||
* The time at which the log entry was created.
|
||||
* @type {number}
|
||||
*/
|
||||
timestamp = Date.now();
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} type The type of log entry.
|
||||
* @param {any} [data] The data associated with the log entry.
|
||||
*/
|
||||
constructor(type, data) {
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class representing a file system utility library.
|
||||
* @implements {HfsImpl}
|
||||
*/
|
||||
export class Hfs {
|
||||
/**
|
||||
* The base implementation for this instance.
|
||||
* @type {HfsImpl}
|
||||
*/
|
||||
#baseImpl;
|
||||
|
||||
/**
|
||||
* The current implementation for this instance.
|
||||
* @type {HfsImpl}
|
||||
*/
|
||||
#impl;
|
||||
|
||||
/**
|
||||
* A map of log names to their corresponding entries.
|
||||
* @type {Map<string,Array<LogEntry>>}
|
||||
*/
|
||||
#logs = new Map();
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {object} options The options for the instance.
|
||||
* @param {HfsImpl} options.impl The implementation to use.
|
||||
*/
|
||||
constructor({ impl }) {
|
||||
this.#baseImpl = impl;
|
||||
this.#impl = impl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs an entry onto all currently open logs.
|
||||
* @param {string} methodName The name of the method being called.
|
||||
* @param {...*} args The arguments to the method.
|
||||
* @returns {void}
|
||||
*/
|
||||
#log(methodName, ...args) {
|
||||
for (const logs of this.#logs.values()) {
|
||||
logs.push(new LogEntry("call", { methodName, args }));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a new log with the given name.
|
||||
* @param {string} name The name of the log to start;
|
||||
* @returns {void}
|
||||
* @throws {Error} When the log already exists.
|
||||
* @throws {TypeError} When the name is not a non-empty string.
|
||||
*/
|
||||
logStart(name) {
|
||||
if (!name || typeof name !== "string") {
|
||||
throw new TypeError("Log name must be a non-empty string.");
|
||||
}
|
||||
|
||||
if (this.#logs.has(name)) {
|
||||
throw new Error(`Log "${name}" already exists.`);
|
||||
}
|
||||
|
||||
this.#logs.set(name, []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ends a log with the given name and returns the entries.
|
||||
* @param {string} name The name of the log to end.
|
||||
* @returns {Array<LogEntry>} The entries in the log.
|
||||
* @throws {Error} When the log does not exist.
|
||||
*/
|
||||
logEnd(name) {
|
||||
if (this.#logs.has(name)) {
|
||||
const logs = this.#logs.get(name);
|
||||
this.#logs.delete(name);
|
||||
return logs;
|
||||
}
|
||||
|
||||
throw new Error(`Log "${name}" does not exist.`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the current implementation is the base implementation.
|
||||
* @returns {boolean} True if the current implementation is the base implementation.
|
||||
*/
|
||||
isBaseImpl() {
|
||||
return this.#impl === this.#baseImpl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the implementation for this instance.
|
||||
* @param {object} impl The implementation to use.
|
||||
* @returns {void}
|
||||
*/
|
||||
setImpl(impl) {
|
||||
this.#log("implSet", impl);
|
||||
|
||||
if (this.#impl !== this.#baseImpl) {
|
||||
throw new ImplAlreadySetError();
|
||||
}
|
||||
|
||||
this.#impl = impl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the implementation for this instance back to its original.
|
||||
* @returns {void}
|
||||
*/
|
||||
resetImpl() {
|
||||
this.#log("implReset");
|
||||
this.#impl = this.#baseImpl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the given method exists on the current implementation.
|
||||
* @param {string} methodName The name of the method to check.
|
||||
* @returns {void}
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
*/
|
||||
#assertImplMethod(methodName) {
|
||||
if (typeof this.#impl[methodName] !== "function") {
|
||||
throw new NoSuchMethodError(methodName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the given method exists on the current implementation, and if not,
|
||||
* throws an error with a different method name.
|
||||
* @param {string} methodName The name of the method to check.
|
||||
* @param {string} targetMethodName The name of the method that should be reported
|
||||
* as an error when methodName does not exist.
|
||||
* @returns {void}
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
*/
|
||||
#assertImplMethodAlt(methodName, targetMethodName) {
|
||||
if (typeof this.#impl[methodName] !== "function") {
|
||||
throw new MethodNotSupportedError(targetMethodName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the given method on the current implementation.
|
||||
* @param {string} methodName The name of the method to call.
|
||||
* @param {...any} args The arguments to the method.
|
||||
* @returns {any} The return value from the method.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
*/
|
||||
#callImplMethod(methodName, ...args) {
|
||||
this.#log(methodName, ...args);
|
||||
this.#assertImplMethod(methodName);
|
||||
return this.#impl[methodName](...args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the given method on the current implementation and doesn't log the call.
|
||||
* @param {string} methodName The name of the method to call.
|
||||
* @param {...any} args The arguments to the method.
|
||||
* @returns {any} The return value from the method.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
*/
|
||||
#callImplMethodWithoutLog(methodName, ...args) {
|
||||
this.#assertImplMethod(methodName);
|
||||
return this.#impl[methodName](...args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the given method on the current implementation but logs a different method name.
|
||||
* @param {string} methodName The name of the method to call.
|
||||
* @param {string} targetMethodName The name of the method to log.
|
||||
* @param {...any} args The arguments to the method.
|
||||
* @returns {any} The return value from the method.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
*/
|
||||
#callImplMethodAlt(methodName, targetMethodName, ...args) {
|
||||
this.#log(targetMethodName, ...args);
|
||||
this.#assertImplMethodAlt(methodName, targetMethodName);
|
||||
return this.#impl[methodName](...args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the given file and returns the contents as text. Assumes UTF-8 encoding.
|
||||
* @param {string|URL} filePath The file to read.
|
||||
* @returns {Promise<string|undefined>} The contents of the file.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
*/
|
||||
async text(filePath) {
|
||||
assertValidFileOrDirPath(filePath);
|
||||
|
||||
const result = await this.#callImplMethodAlt("bytes", "text", filePath);
|
||||
return result ? decoder.decode(result) : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the given file and returns the contents as JSON. Assumes UTF-8 encoding.
|
||||
* @param {string|URL} filePath The file to read.
|
||||
* @returns {Promise<any|undefined>} The contents of the file as JSON.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {SyntaxError} When the file contents are not valid JSON.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
*/
|
||||
async json(filePath) {
|
||||
assertValidFileOrDirPath(filePath);
|
||||
|
||||
const result = await this.#callImplMethodAlt("bytes", "json", filePath);
|
||||
return result ? JSON.parse(decoder.decode(result)) : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the given file and returns the contents as an ArrayBuffer.
|
||||
* @param {string|URL} filePath The file to read.
|
||||
* @returns {Promise<ArrayBuffer|undefined>} The contents of the file as an ArrayBuffer.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
* @deprecated Use bytes() instead.
|
||||
*/
|
||||
async arrayBuffer(filePath) {
|
||||
assertValidFileOrDirPath(filePath);
|
||||
|
||||
const result = await this.#callImplMethodAlt(
|
||||
"bytes",
|
||||
"arrayBuffer",
|
||||
filePath,
|
||||
);
|
||||
return result?.buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the given file and returns the contents as an Uint8Array.
|
||||
* @param {string|URL} filePath The file to read.
|
||||
* @returns {Promise<Uint8Array|undefined>} The contents of the file as an Uint8Array.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
*/
|
||||
async bytes(filePath) {
|
||||
assertValidFileOrDirPath(filePath);
|
||||
return this.#callImplMethod("bytes", filePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the given data to the given file. Creates any necessary directories along the way.
|
||||
* If the data is a string, UTF-8 encoding is used.
|
||||
* @param {string|URL} filePath The file to write.
|
||||
* @param {string|ArrayBuffer|ArrayBufferView} contents The data to write.
|
||||
* @returns {Promise<void>} A promise that resolves when the file is written.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
*/
|
||||
async write(filePath, contents) {
|
||||
assertValidFileOrDirPath(filePath);
|
||||
assertValidFileContents(contents);
|
||||
this.#log("write", filePath, contents);
|
||||
|
||||
let value = toUint8Array(contents);
|
||||
return this.#callImplMethodWithoutLog("write", filePath, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the given data to the given file. Creates any necessary directories along the way.
|
||||
* If the data is a string, UTF-8 encoding is used.
|
||||
* @param {string|URL} filePath The file to append to.
|
||||
* @param {string|ArrayBuffer|ArrayBufferView} contents The data to append.
|
||||
* @returns {Promise<void>} A promise that resolves when the file is appended to.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
* @throws {TypeError} When the file contents are not a string or ArrayBuffer.
|
||||
* @throws {Error} When the file cannot be appended to.
|
||||
*/
|
||||
async append(filePath, contents) {
|
||||
assertValidFileOrDirPath(filePath);
|
||||
assertValidFileContents(contents);
|
||||
this.#log("append", filePath, contents);
|
||||
|
||||
let value = toUint8Array(contents);
|
||||
return this.#callImplMethodWithoutLog("append", filePath, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the given file exists.
|
||||
* @param {string|URL} filePath The file to check.
|
||||
* @returns {Promise<boolean>} True if the file exists.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
*/
|
||||
async isFile(filePath) {
|
||||
assertValidFileOrDirPath(filePath);
|
||||
return this.#callImplMethod("isFile", filePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the given directory exists.
|
||||
* @param {string|URL} dirPath The directory to check.
|
||||
* @returns {Promise<boolean>} True if the directory exists.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the directory path is not a non-empty string.
|
||||
*/
|
||||
async isDirectory(dirPath) {
|
||||
assertValidFileOrDirPath(dirPath);
|
||||
return this.#callImplMethod("isDirectory", dirPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the given directory.
|
||||
* @param {string|URL} dirPath The directory to create.
|
||||
* @returns {Promise<void>} A promise that resolves when the directory is created.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the directory path is not a non-empty string.
|
||||
*/
|
||||
async createDirectory(dirPath) {
|
||||
assertValidFileOrDirPath(dirPath);
|
||||
return this.#callImplMethod("createDirectory", dirPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the given file or empty directory.
|
||||
* @param {string|URL} filePath The file to delete.
|
||||
* @returns {Promise<boolean>} A promise that resolves when the file or
|
||||
* directory is deleted, true if the file or directory is deleted, false
|
||||
* if the file or directory does not exist.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the file path is not a non-empty string.
|
||||
*/
|
||||
async delete(filePath) {
|
||||
assertValidFileOrDirPath(filePath);
|
||||
return this.#callImplMethod("delete", filePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the given file or directory recursively.
|
||||
* @param {string|URL} dirPath The directory to delete.
|
||||
* @returns {Promise<boolean>} A promise that resolves when the file or
|
||||
* directory is deleted, true if the file or directory is deleted, false
|
||||
* if the file or directory does not exist.
|
||||
* @throws {NoSuchMethodError} When the method does not exist on the current implementation.
|
||||
* @throws {TypeError} When the directory path is not a non-empty string.
|
||||
*/
|
||||
async deleteAll(dirPath) {
|
||||
assertValidFileOrDirPath(dirPath);
|
||||
return this.#callImplMethod("deleteAll", dirPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of directory entries for the given path.
|
||||
* @param {string|URL} dirPath The path to the directory to read.
|
||||
* @returns {AsyncIterable<HfsDirectoryEntry>} A promise that resolves with the
|
||||
* directory entries.
|
||||
* @throws {TypeError} If the directory path is not a string or URL.
|
||||
* @throws {Error} If the directory cannot be read.
|
||||
*/
|
||||
async *list(dirPath) {
|
||||
assertValidFileOrDirPath(dirPath);
|
||||
yield* await this.#callImplMethod("list", dirPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Walks a directory using a depth-first traversal and returns the entries
|
||||
* from the traversal.
|
||||
* @param {string|URL} dirPath The path to the directory to walk.
|
||||
* @param {Object} [options] The options for the walk.
|
||||
* @param {(entry:HfsWalkEntry) => Promise<boolean>|boolean} [options.directoryFilter] A filter function to determine
|
||||
* if a directory's entries should be included in the walk.
|
||||
* @param {(entry:HfsWalkEntry) => Promise<boolean>|boolean} [options.entryFilter] A filter function to determine if
|
||||
* an entry should be included in the walk.
|
||||
* @returns {AsyncIterable<HfsWalkEntry>} A promise that resolves with the
|
||||
* directory entries.
|
||||
* @throws {TypeError} If the directory path is not a string or URL.
|
||||
* @throws {Error} If the directory cannot be read.
|
||||
*/
|
||||
async *walk(
|
||||
dirPath,
|
||||
{ directoryFilter = () => true, entryFilter = () => true } = {},
|
||||
) {
|
||||
assertValidFileOrDirPath(dirPath);
|
||||
this.#log("walk", dirPath, { directoryFilter, entryFilter });
|
||||
|
||||
// inner function for recursion without additional logging
|
||||
const walk = async function* (
|
||||
dirPath,
|
||||
{ directoryFilter, entryFilter, parentPath = "", depth = 1 },
|
||||
) {
|
||||
let dirEntries;
|
||||
|
||||
try {
|
||||
dirEntries = await this.#callImplMethodWithoutLog(
|
||||
"list",
|
||||
dirPath,
|
||||
);
|
||||
} catch (error) {
|
||||
// if the directory does not exist then return an empty array
|
||||
if (error.code === "ENOENT") {
|
||||
return;
|
||||
}
|
||||
|
||||
// otherwise, rethrow the error
|
||||
throw error;
|
||||
}
|
||||
|
||||
for await (const listEntry of dirEntries) {
|
||||
const walkEntry = {
|
||||
path: listEntry.name,
|
||||
depth,
|
||||
...listEntry,
|
||||
};
|
||||
|
||||
if (parentPath) {
|
||||
walkEntry.path = `${parentPath}/${walkEntry.path}`;
|
||||
}
|
||||
|
||||
// first emit the entry but only if the entry filter returns true
|
||||
let shouldEmitEntry = entryFilter(walkEntry);
|
||||
if (shouldEmitEntry.then) {
|
||||
shouldEmitEntry = await shouldEmitEntry;
|
||||
}
|
||||
|
||||
if (shouldEmitEntry) {
|
||||
yield walkEntry;
|
||||
}
|
||||
|
||||
// if it's a directory then yield the entry and walk the directory
|
||||
if (listEntry.isDirectory) {
|
||||
// if the directory filter returns false, skip the directory
|
||||
let shouldWalkDirectory = directoryFilter(walkEntry);
|
||||
if (shouldWalkDirectory.then) {
|
||||
shouldWalkDirectory = await shouldWalkDirectory;
|
||||
}
|
||||
|
||||
if (!shouldWalkDirectory) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// make sure there's a trailing slash on the directory path before appending
|
||||
const directoryPath =
|
||||
dirPath instanceof URL
|
||||
? new URL(
|
||||
listEntry.name,
|
||||
dirPath.href.endsWith("/")
|
||||
? dirPath.href
|
||||
: `${dirPath.href}/`,
|
||||
)
|
||||
: `${dirPath.endsWith("/") ? dirPath : `${dirPath}/`}${listEntry.name}`;
|
||||
|
||||
yield* walk(directoryPath, {
|
||||
directoryFilter,
|
||||
entryFilter,
|
||||
parentPath: walkEntry.path,
|
||||
depth: depth + 1,
|
||||
});
|
||||
}
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
yield* walk(dirPath, { directoryFilter, entryFilter });
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the given file.
|
||||
* @param {string|URL} filePath The path to the file to read.
|
||||
* @returns {Promise<number>} A promise that resolves with the size of the file.
|
||||
* @throws {TypeError} If the file path is not a string or URL.
|
||||
* @throws {Error} If the file cannot be read.
|
||||
*/
|
||||
async size(filePath) {
|
||||
assertValidFileOrDirPath(filePath);
|
||||
return this.#callImplMethod("size", filePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last modified timestamp of the given file or directory.
|
||||
* @param {string|URL} fileOrDirPath The path to the file or directory.
|
||||
* @returns {Promise<Date|undefined>} A promise that resolves with the last modified date
|
||||
* or undefined if the file or directory does not exist.
|
||||
* @throws {TypeError} If the path is not a string or URL.
|
||||
*/
|
||||
async lastModified(fileOrDirPath) {
|
||||
assertValidFileOrDirPath(fileOrDirPath);
|
||||
return this.#callImplMethod("lastModified", fileOrDirPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copys a file from one location to another.
|
||||
* @param {string|URL} source The path to the file to copy.
|
||||
* @param {string|URL} destination The path to the new file.
|
||||
* @returns {Promise<void>} A promise that resolves when the file is copied.
|
||||
* @throws {TypeError} If the file path is not a string or URL.
|
||||
* @throws {Error} If the file cannot be copied.
|
||||
*/
|
||||
async copy(source, destination) {
|
||||
assertValidFileOrDirPath(source);
|
||||
assertValidFileOrDirPath(destination);
|
||||
return this.#callImplMethod("copy", source, destination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies a file or directory from one location to another.
|
||||
* @param {string|URL} source The path to the file or directory to copy.
|
||||
* @param {string|URL} destination The path to copy the file or directory to.
|
||||
* @returns {Promise<void>} A promise that resolves when the file or directory is
|
||||
* copied.
|
||||
* @throws {TypeError} If the directory path is not a string or URL.
|
||||
* @throws {Error} If the directory cannot be copied.
|
||||
*/
|
||||
async copyAll(source, destination) {
|
||||
assertValidFileOrDirPath(source);
|
||||
assertValidFileOrDirPath(destination);
|
||||
return this.#callImplMethod("copyAll", source, destination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves a file from the source path to the destination path.
|
||||
* @param {string|URL} source The location of the file to move.
|
||||
* @param {string|URL} destination The destination of the file to move.
|
||||
* @returns {Promise<void>} A promise that resolves when the move is complete.
|
||||
* @throws {TypeError} If the file or directory paths are not strings.
|
||||
* @throws {Error} If the file or directory cannot be moved.
|
||||
*/
|
||||
async move(source, destination) {
|
||||
assertValidFileOrDirPath(source);
|
||||
assertValidFileOrDirPath(destination);
|
||||
return this.#callImplMethod("move", source, destination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves a file or directory from one location to another.
|
||||
* @param {string|URL} source The path to the file or directory to move.
|
||||
* @param {string|URL} destination The path to move the file or directory to.
|
||||
* @returns {Promise<void>} A promise that resolves when the file or directory is
|
||||
* moved.
|
||||
* @throws {TypeError} If the source is not a string or URL.
|
||||
* @throws {TypeError} If the destination is not a string or URL.
|
||||
* @throws {Error} If the file or directory cannot be moved.
|
||||
*/
|
||||
async moveAll(source, destination) {
|
||||
assertValidFileOrDirPath(source);
|
||||
assertValidFileOrDirPath(destination);
|
||||
return this.#callImplMethod("moveAll", source, destination);
|
||||
}
|
||||
}
|
||||
8
frontend/node_modules/@humanfs/core/src/index.js
generated
vendored
8
frontend/node_modules/@humanfs/core/src/index.js
generated
vendored
@@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @fileoverview API entrypoint for hfs/core
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
export { Hfs } from "./hfs.js";
|
||||
export { Path } from "./path.js";
|
||||
export * from "./errors.js";
|
||||
237
frontend/node_modules/@humanfs/core/src/path.js
generated
vendored
237
frontend/node_modules/@humanfs/core/src/path.js
generated
vendored
@@ -1,237 +0,0 @@
|
||||
/**
|
||||
* @fileoverview The Path class.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
/* globals URL */
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Types
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/** @typedef{import("@humanfs/types").HfsImpl} HfsImpl */
|
||||
/** @typedef{import("@humanfs/types").HfsDirectoryEntry} HfsDirectoryEntry */
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Normalizes a path to use forward slashes.
|
||||
* @param {string} filePath The path to normalize.
|
||||
* @returns {string} The normalized path.
|
||||
*/
|
||||
function normalizePath(filePath) {
|
||||
let startIndex = 0;
|
||||
let endIndex = filePath.length;
|
||||
|
||||
if (/[a-z]:\//i.test(filePath)) {
|
||||
startIndex = 3;
|
||||
}
|
||||
|
||||
if (filePath.startsWith("./")) {
|
||||
startIndex = 2;
|
||||
}
|
||||
|
||||
if (filePath.startsWith("/")) {
|
||||
startIndex = 1;
|
||||
}
|
||||
|
||||
if (filePath.endsWith("/")) {
|
||||
endIndex = filePath.length - 1;
|
||||
}
|
||||
|
||||
return filePath.slice(startIndex, endIndex).replace(/\\/g, "/");
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the given name is a non-empty string, no equal to "." or "..",
|
||||
* and does not contain a forward slash or backslash.
|
||||
* @param {string} name The name to check.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} When name is not valid.
|
||||
*/
|
||||
function assertValidName(name) {
|
||||
if (typeof name !== "string") {
|
||||
throw new TypeError("name must be a string");
|
||||
}
|
||||
|
||||
if (!name) {
|
||||
throw new TypeError("name cannot be empty");
|
||||
}
|
||||
|
||||
if (name === ".") {
|
||||
throw new TypeError(`name cannot be "."`);
|
||||
}
|
||||
|
||||
if (name === "..") {
|
||||
throw new TypeError(`name cannot be ".."`);
|
||||
}
|
||||
|
||||
if (name.includes("/") || name.includes("\\")) {
|
||||
throw new TypeError(
|
||||
`name cannot contain a slash or backslash: "${name}"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
export class Path {
|
||||
/**
|
||||
* The steps in the path.
|
||||
* @type {Array<string>}
|
||||
*/
|
||||
#steps;
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Iterable<string>} [steps] The steps to use for the path.
|
||||
* @throws {TypeError} When steps is not iterable.
|
||||
*/
|
||||
constructor(steps = []) {
|
||||
if (typeof steps[Symbol.iterator] !== "function") {
|
||||
throw new TypeError("steps must be iterable");
|
||||
}
|
||||
|
||||
this.#steps = [...steps];
|
||||
this.#steps.forEach(assertValidName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds steps to the end of the path.
|
||||
* @param {...string} steps The steps to add to the path.
|
||||
* @returns {void}
|
||||
*/
|
||||
push(...steps) {
|
||||
steps.forEach(assertValidName);
|
||||
this.#steps.push(...steps);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the last step from the path.
|
||||
* @returns {string} The last step in the path.
|
||||
*/
|
||||
pop() {
|
||||
return this.#steps.pop();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator for steps in the path.
|
||||
* @returns {IterableIterator<string>} An iterator for the steps in the path.
|
||||
*/
|
||||
steps() {
|
||||
return this.#steps.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator for the steps in the path.
|
||||
* @returns {IterableIterator<string>} An iterator for the steps in the path.
|
||||
*/
|
||||
[Symbol.iterator]() {
|
||||
return this.steps();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the name (the last step) of the path.
|
||||
* @type {string}
|
||||
*/
|
||||
get name() {
|
||||
return this.#steps[this.#steps.length - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name (the last step) of the path.
|
||||
* @type {string}
|
||||
*/
|
||||
set name(value) {
|
||||
assertValidName(value);
|
||||
this.#steps[this.#steps.length - 1] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the size of the path.
|
||||
* @type {number}
|
||||
*/
|
||||
get size() {
|
||||
return this.#steps.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path as a string.
|
||||
* @returns {string} The path as a string.
|
||||
*/
|
||||
toString() {
|
||||
return this.#steps.join("/");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new path based on the argument type. If the argument is a string,
|
||||
* it is assumed to be a file or directory path and is converted to a Path
|
||||
* instance. If the argument is a URL, it is assumed to be a file URL and is
|
||||
* converted to a Path instance. If the argument is a Path instance, it is
|
||||
* copied into a new Path instance. If the argument is an array, it is assumed
|
||||
* to be the steps of a path and is used to create a new Path instance.
|
||||
* @param {string|URL|Path|Array<string>} pathish The value to convert to a Path instance.
|
||||
* @returns {Path} A new Path instance.
|
||||
* @throws {TypeError} When pathish is not a string, URL, Path, or Array.
|
||||
* @throws {TypeError} When pathish is a string and is empty.
|
||||
*/
|
||||
static from(pathish) {
|
||||
if (typeof pathish === "string") {
|
||||
if (!pathish) {
|
||||
throw new TypeError("argument cannot be empty");
|
||||
}
|
||||
|
||||
return Path.fromString(pathish);
|
||||
}
|
||||
|
||||
if (pathish instanceof URL) {
|
||||
return Path.fromURL(pathish);
|
||||
}
|
||||
|
||||
if (pathish instanceof Path || Array.isArray(pathish)) {
|
||||
return new Path(pathish);
|
||||
}
|
||||
|
||||
throw new TypeError("argument must be a string, URL, Path, or Array");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Path instance from a string.
|
||||
* @param {string} fileOrDirPath The file or directory path to convert.
|
||||
* @returns {Path} A new Path instance.
|
||||
* @deprecated Use Path.from() instead.
|
||||
*/
|
||||
static fromString(fileOrDirPath) {
|
||||
return new Path(normalizePath(fileOrDirPath).split("/"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Path instance from a URL.
|
||||
* @param {URL} url The URL to convert.
|
||||
* @returns {Path} A new Path instance.
|
||||
* @throws {TypeError} When url is not a URL instance.
|
||||
* @throws {TypeError} When url.pathname is empty.
|
||||
* @throws {TypeError} When url.protocol is not "file:".
|
||||
* @deprecated Use Path.from() instead.
|
||||
*/
|
||||
static fromURL(url) {
|
||||
if (!(url instanceof URL)) {
|
||||
throw new TypeError("url must be a URL instance");
|
||||
}
|
||||
|
||||
if (!url.pathname || url.pathname === "/") {
|
||||
throw new TypeError("url.pathname cannot be empty");
|
||||
}
|
||||
|
||||
if (url.protocol !== "file:") {
|
||||
throw new TypeError(`url.protocol must be "file:"`);
|
||||
}
|
||||
|
||||
// Remove leading slash in pathname
|
||||
return new Path(normalizePath(url.pathname.slice(1)).split("/"));
|
||||
}
|
||||
}
|
||||
201
frontend/node_modules/@humanfs/node/LICENSE
generated
vendored
201
frontend/node_modules/@humanfs/node/LICENSE
generated
vendored
@@ -1,201 +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
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
||||
141
frontend/node_modules/@humanfs/node/README.md
generated
vendored
141
frontend/node_modules/@humanfs/node/README.md
generated
vendored
@@ -1,141 +0,0 @@
|
||||
# `@humanfs/node`
|
||||
|
||||
by [Nicholas C. Zakas](https://humanwhocodes.com)
|
||||
|
||||
If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate) or [nominate me](https://stars.github.com/nominate/) for a GitHub Star.
|
||||
|
||||
## Description
|
||||
|
||||
The `hfs` bindings for use in Node.js and Node.js-compatible runtimes.
|
||||
|
||||
> [!WARNING]
|
||||
> This project is **experimental** and may change significantly before v1.0.0. Use at your own caution and definitely not in production!
|
||||
|
||||
## Installation
|
||||
|
||||
Install using your favorite package manager:
|
||||
|
||||
```shell
|
||||
npm install @humanfs/node
|
||||
|
||||
# or
|
||||
|
||||
pnpm install @humanfs/node
|
||||
|
||||
# or
|
||||
|
||||
yarn add @humanfs/node
|
||||
|
||||
# or
|
||||
|
||||
bun install @humanfs/node
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
The easiest way to use hfs in your project is to import the `hfs` object:
|
||||
|
||||
```js
|
||||
import { hfs } from "@humanfs/node";
|
||||
```
|
||||
|
||||
Then, you can use the API methods:
|
||||
|
||||
```js
|
||||
// 1. Files
|
||||
|
||||
// read from a text file
|
||||
const text = await hfs.text("file.txt");
|
||||
|
||||
// read from a JSON file
|
||||
const json = await hfs.json("file.json");
|
||||
|
||||
// read raw bytes from a text file
|
||||
const arrayBuffer = await hfs.arrayBuffer("file.txt");
|
||||
|
||||
// write text to a file
|
||||
await hfs.write("file.txt", "Hello world!");
|
||||
|
||||
// write bytes to a file
|
||||
await hfs.write("file.txt", new TextEncoder().encode("Hello world!"));
|
||||
|
||||
// append text to a file
|
||||
await hfs.append("file.txt", "Hello world!");
|
||||
|
||||
// append bytes to a file
|
||||
await hfs.append("file.txt", new TextEncoder().encode("Hello world!"));
|
||||
|
||||
// does the file exist?
|
||||
const found = await hfs.isFile("file.txt");
|
||||
|
||||
// how big is the file?
|
||||
const size = await hfs.size("file.txt");
|
||||
|
||||
// when was the file modified?
|
||||
const mtime = await hfs.lastModified("file.txt");
|
||||
|
||||
// copy a file from one location to another
|
||||
await hfs.copy("file.txt", "file-copy.txt");
|
||||
|
||||
// move a file from one location to another
|
||||
await hfs.move("file.txt", "renamed.txt");
|
||||
|
||||
// delete a file
|
||||
await hfs.delete("file.txt");
|
||||
|
||||
// 2. Directories
|
||||
|
||||
// create a directory
|
||||
await hfs.createDirectory("dir");
|
||||
|
||||
// create a directory recursively
|
||||
await hfs.createDirectory("dir/subdir");
|
||||
|
||||
// does the directory exist?
|
||||
const dirFound = await hfs.isDirectory("dir");
|
||||
|
||||
// copy the entire directory
|
||||
hfs.copyAll("from-dir", "to-dir");
|
||||
|
||||
// move the entire directory
|
||||
hfs.moveAll("from-dir", "to-dir");
|
||||
|
||||
// delete a directory
|
||||
await hfs.delete("dir");
|
||||
|
||||
// delete a non-empty directory
|
||||
await hfs.deleteAll("dir");
|
||||
```
|
||||
|
||||
If you'd like to create your own instance, import the `NodeHfs` constructor:
|
||||
|
||||
```js
|
||||
import { NodeHfs } from "@humanfs/node";
|
||||
import fsp from "fs/promises";
|
||||
|
||||
const hfs = new NodeHfs();
|
||||
|
||||
// optionally specify the fs/promises object to use
|
||||
const hfs = new NodeHfs({ fsp });
|
||||
```
|
||||
|
||||
If you'd like to use just the impl, import the `NodeHfsImpl` constructor:
|
||||
|
||||
```js
|
||||
import { NodeHfsImpl } from "@humanfs/node";
|
||||
import fsp from "fs/promises";
|
||||
|
||||
const hfs = new NodeHfsImpl();
|
||||
|
||||
// optionally specify the fs/promises object to use
|
||||
const hfs = new NodeHfsImpl({ fsp });
|
||||
```
|
||||
|
||||
## Errors Handled
|
||||
|
||||
* `ENOENT` - in most cases, these errors are handled silently.
|
||||
* `ENFILE` and `EMFILE` - calls that result in these errors are retried for up to 60 seconds before giving up for good.
|
||||
|
||||
## License
|
||||
|
||||
Apache 2.0
|
||||
2
frontend/node_modules/@humanfs/node/dist/index.d.ts
generated
vendored
2
frontend/node_modules/@humanfs/node/dist/index.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
export * from "./node-hfs.js";
|
||||
export { Hfs } from "@humanfs/core";
|
||||
150
frontend/node_modules/@humanfs/node/dist/node-fsx.d.ts
generated
vendored
150
frontend/node_modules/@humanfs/node/dist/node-fsx.d.ts
generated
vendored
@@ -1,150 +0,0 @@
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
/**
|
||||
* A class representing the Node.js implementation of Hfs.
|
||||
* @implements {HfsImpl}
|
||||
*/
|
||||
export class NodeHfsImpl implements HfsImpl {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {object} [options] The options for the instance.
|
||||
* @param {Fsp} [options.fsp] The file system module to use.
|
||||
*/
|
||||
constructor({ fsp }?: {
|
||||
fsp?: Fsp;
|
||||
});
|
||||
/**
|
||||
* Reads a file and returns the contents as a string. Assumes UTF-8 encoding.
|
||||
* @param {string} filePath The path to the file to read.
|
||||
* @returns {Promise<string|undefined>} A promise that resolves with the contents of
|
||||
* the file or undefined if the file doesn't exist.
|
||||
* @throws {TypeError} If the file path is not a string.
|
||||
* @throws {RangeError} If the file path is empty.
|
||||
* @throws {RangeError} If the file path is not absolute.
|
||||
* @throws {RangeError} If the file path is not a file.
|
||||
* @throws {RangeError} If the file path is not readable.
|
||||
*/
|
||||
text(filePath: string): Promise<string | undefined>;
|
||||
/**
|
||||
* Reads a file and returns the contents as a JSON object. Assumes UTF-8 encoding.
|
||||
* @param {string} filePath The path to the file to read.
|
||||
* @returns {Promise<object|undefined>} A promise that resolves with the contents of
|
||||
* the file or undefined if the file doesn't exist.
|
||||
* @throws {SyntaxError} If the file contents are not valid JSON.
|
||||
* @throws {Error} If the file cannot be read.
|
||||
* @throws {TypeError} If the file path is not a string.
|
||||
*/
|
||||
json(filePath: string): Promise<object | undefined>;
|
||||
/**
|
||||
* Reads a file and returns the contents as an ArrayBuffer.
|
||||
* @param {string} filePath The path to the file to read.
|
||||
* @returns {Promise<ArrayBuffer|undefined>} A promise that resolves with the contents
|
||||
* of the file or undefined if the file doesn't exist.
|
||||
* @throws {Error} If the file cannot be read.
|
||||
* @throws {TypeError} If the file path is not a string.
|
||||
* @deprecated Use bytes() instead.
|
||||
*/
|
||||
arrayBuffer(filePath: string): Promise<ArrayBuffer | undefined>;
|
||||
/**
|
||||
* Reads a file and returns the contents as an Uint8Array.
|
||||
* @param {string} filePath The path to the file to read.
|
||||
* @returns {Promise<Uint8Array|undefined>} A promise that resolves with the contents
|
||||
* of the file or undefined if the file doesn't exist.
|
||||
* @throws {Error} If the file cannot be read.
|
||||
* @throws {TypeError} If the file path is not a string.
|
||||
*/
|
||||
bytes(filePath: string): Promise<Uint8Array | undefined>;
|
||||
/**
|
||||
* Writes a value to a file. If the value is a string, UTF-8 encoding is used.
|
||||
* @param {string} filePath The path to the file to write.
|
||||
* @param {string|ArrayBuffer|ArrayBufferView} contents The contents to write to the
|
||||
* file.
|
||||
* @returns {Promise<void>} A promise that resolves when the file is
|
||||
* written.
|
||||
* @throws {TypeError} If the file path is not a string.
|
||||
* @throws {Error} If the file cannot be written.
|
||||
*/
|
||||
write(filePath: string, contents: string | ArrayBuffer | ArrayBufferView): Promise<void>;
|
||||
/**
|
||||
* Checks if a file exists.
|
||||
* @param {string} filePath The path to the file to check.
|
||||
* @returns {Promise<boolean>} A promise that resolves with true if the
|
||||
* file exists or false if it does not.
|
||||
* @throws {Error} If the operation fails with a code other than ENOENT.
|
||||
*/
|
||||
isFile(filePath: string): Promise<boolean>;
|
||||
/**
|
||||
* Checks if a directory exists.
|
||||
* @param {string} dirPath The path to the directory to check.
|
||||
* @returns {Promise<boolean>} A promise that resolves with true if the
|
||||
* directory exists or false if it does not.
|
||||
* @throws {Error} If the operation fails with a code other than ENOENT.
|
||||
*/
|
||||
isDirectory(dirPath: string): Promise<boolean>;
|
||||
/**
|
||||
* Creates a directory recursively.
|
||||
* @param {string} dirPath The path to the directory to create.
|
||||
* @returns {Promise<void>} A promise that resolves when the directory is
|
||||
* created.
|
||||
*/
|
||||
createDirectory(dirPath: string): Promise<void>;
|
||||
/**
|
||||
* Deletes a file or empty directory.
|
||||
* @param {string} fileOrDirPath The path to the file or directory to
|
||||
* delete.
|
||||
* @returns {Promise<void>} A promise that resolves when the file or
|
||||
* directory is deleted.
|
||||
* @throws {TypeError} If the file or directory path is not a string.
|
||||
* @throws {Error} If the file or directory cannot be deleted.
|
||||
* @throws {Error} If the file or directory is not found.
|
||||
*/
|
||||
delete(fileOrDirPath: string): Promise<void>;
|
||||
/**
|
||||
* Deletes a file or directory recursively.
|
||||
* @param {string} fileOrDirPath The path to the file or directory to
|
||||
* delete.
|
||||
* @returns {Promise<void>} A promise that resolves when the file or
|
||||
* directory is deleted.
|
||||
* @throws {TypeError} If the file or directory path is not a string.
|
||||
* @throws {Error} If the file or directory cannot be deleted.
|
||||
* @throws {Error} If the file or directory is not found.
|
||||
*/
|
||||
deleteAll(fileOrDirPath: string): Promise<void>;
|
||||
/**
|
||||
* Returns a list of directory entries for the given path.
|
||||
* @param {string} dirPath The path to the directory to read.
|
||||
* @returns {AsyncIterable<HfsDirectoryEntry>} A promise that resolves with the
|
||||
* directory entries.
|
||||
* @throws {TypeError} If the directory path is not a string.
|
||||
* @throws {Error} If the directory cannot be read.
|
||||
*/
|
||||
list(dirPath: string): AsyncIterable<HfsDirectoryEntry>;
|
||||
/**
|
||||
* Returns the size of a file.
|
||||
* @param {string} filePath The path to the file to read.
|
||||
* @returns {Promise<number|undefined>} A promise that resolves with the size of the
|
||||
* file in bytes or undefined if the file doesn't exist.
|
||||
*/
|
||||
size(filePath: string): Promise<number | undefined>;
|
||||
#private;
|
||||
}
|
||||
/**
|
||||
* A class representing a file system utility library.
|
||||
* @implements {HfsImpl}
|
||||
*/
|
||||
export class NodeHfs extends Hfs implements HfsImpl {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {object} [options] The options for the instance.
|
||||
* @param {Fsp} [options.fsp] The file system module to use.
|
||||
*/
|
||||
constructor({ fsp }?: {
|
||||
fsp?: Fsp;
|
||||
});
|
||||
}
|
||||
export const hfs: NodeHfs;
|
||||
export type HfsImpl = import("@humanfs/types").HfsImpl;
|
||||
export type HfsDirectoryEntry = import("@humanfs/types").HfsDirectoryEntry;
|
||||
export type Fsp = typeof nativeFsp;
|
||||
export type Dirent = import("fs").Dirent;
|
||||
import { Hfs } from "@humanfs/core";
|
||||
import nativeFsp from "node:fs/promises";
|
||||
176
frontend/node_modules/@humanfs/node/dist/node-hfs.d.ts
generated
vendored
176
frontend/node_modules/@humanfs/node/dist/node-hfs.d.ts
generated
vendored
@@ -1,176 +0,0 @@
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
/**
|
||||
* A class representing the Node.js implementation of Hfs.
|
||||
* @implements {HfsImpl}
|
||||
*/
|
||||
export class NodeHfsImpl implements HfsImpl {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {object} [options] The options for the instance.
|
||||
* @param {Fsp} [options.fsp] The file system module to use.
|
||||
*/
|
||||
constructor({ fsp }?: {
|
||||
fsp?: Fsp;
|
||||
});
|
||||
/**
|
||||
* Reads a file and returns the contents as an Uint8Array.
|
||||
* @param {string|URL} filePath The path to the file to read.
|
||||
* @returns {Promise<Uint8Array|undefined>} A promise that resolves with the contents
|
||||
* of the file or undefined if the file doesn't exist.
|
||||
* @throws {Error} If the file cannot be read.
|
||||
* @throws {TypeError} If the file path is not a string.
|
||||
*/
|
||||
bytes(filePath: string | URL): Promise<Uint8Array | undefined>;
|
||||
/**
|
||||
* Writes a value to a file. If the value is a string, UTF-8 encoding is used.
|
||||
* @param {string|URL} filePath The path to the file to write.
|
||||
* @param {Uint8Array} contents The contents to write to the
|
||||
* file.
|
||||
* @returns {Promise<void>} A promise that resolves when the file is
|
||||
* written.
|
||||
* @throws {TypeError} If the file path is not a string.
|
||||
* @throws {Error} If the file cannot be written.
|
||||
*/
|
||||
write(filePath: string | URL, contents: Uint8Array): Promise<void>;
|
||||
/**
|
||||
* Appends a value to a file. If the value is a string, UTF-8 encoding is used.
|
||||
* @param {string|URL} filePath The path to the file to append to.
|
||||
* @param {Uint8Array} contents The contents to append to the
|
||||
* file.
|
||||
* @returns {Promise<void>} A promise that resolves when the file is
|
||||
* written.
|
||||
* @throws {TypeError} If the file path is not a string.
|
||||
* @throws {Error} If the file cannot be appended to.
|
||||
*/
|
||||
append(filePath: string | URL, contents: Uint8Array): Promise<void>;
|
||||
/**
|
||||
* Checks if a file exists.
|
||||
* @param {string|URL} filePath The path to the file to check.
|
||||
* @returns {Promise<boolean>} A promise that resolves with true if the
|
||||
* file exists or false if it does not.
|
||||
* @throws {Error} If the operation fails with a code other than ENOENT.
|
||||
*/
|
||||
isFile(filePath: string | URL): Promise<boolean>;
|
||||
/**
|
||||
* Checks if a directory exists.
|
||||
* @param {string|URL} dirPath The path to the directory to check.
|
||||
* @returns {Promise<boolean>} A promise that resolves with true if the
|
||||
* directory exists or false if it does not.
|
||||
* @throws {Error} If the operation fails with a code other than ENOENT.
|
||||
*/
|
||||
isDirectory(dirPath: string | URL): Promise<boolean>;
|
||||
/**
|
||||
* Creates a directory recursively.
|
||||
* @param {string|URL} dirPath The path to the directory to create.
|
||||
* @returns {Promise<void>} A promise that resolves when the directory is
|
||||
* created.
|
||||
*/
|
||||
createDirectory(dirPath: string | URL): Promise<void>;
|
||||
/**
|
||||
* Deletes a file or empty directory.
|
||||
* @param {string|URL} fileOrDirPath The path to the file or directory to
|
||||
* delete.
|
||||
* @returns {Promise<boolean>} A promise that resolves when the file or
|
||||
* directory is deleted, true if the file or directory is deleted, false
|
||||
* if the file or directory does not exist.
|
||||
* @throws {TypeError} If the file or directory path is not a string.
|
||||
* @throws {Error} If the file or directory cannot be deleted.
|
||||
*/
|
||||
delete(fileOrDirPath: string | URL): Promise<boolean>;
|
||||
/**
|
||||
* Deletes a file or directory recursively.
|
||||
* @param {string|URL} fileOrDirPath The path to the file or directory to
|
||||
* delete.
|
||||
* @returns {Promise<boolean>} A promise that resolves when the file or
|
||||
* directory is deleted, true if the file or directory is deleted, false
|
||||
* if the file or directory does not exist.
|
||||
* @throws {TypeError} If the file or directory path is not a string.
|
||||
* @throws {Error} If the file or directory cannot be deleted.
|
||||
*/
|
||||
deleteAll(fileOrDirPath: string | URL): Promise<boolean>;
|
||||
/**
|
||||
* Returns a list of directory entries for the given path.
|
||||
* @param {string|URL} dirPath The path to the directory to read.
|
||||
* @returns {AsyncIterable<HfsDirectoryEntry>} A promise that resolves with the
|
||||
* directory entries.
|
||||
* @throws {TypeError} If the directory path is not a string.
|
||||
* @throws {Error} If the directory cannot be read.
|
||||
*/
|
||||
list(dirPath: string | URL): AsyncIterable<HfsDirectoryEntry>;
|
||||
/**
|
||||
* Returns the size of a file. This method handles ENOENT errors
|
||||
* and returns undefined in that case.
|
||||
* @param {string|URL} filePath The path to the file to read.
|
||||
* @returns {Promise<number|undefined>} A promise that resolves with the size of the
|
||||
* file in bytes or undefined if the file doesn't exist.
|
||||
*/
|
||||
size(filePath: string | URL): Promise<number | undefined>;
|
||||
/**
|
||||
* Returns the last modified date of a file or directory. This method handles ENOENT errors
|
||||
* and returns undefined in that case.
|
||||
* @param {string|URL} fileOrDirPath The path to the file to read.
|
||||
* @returns {Promise<Date|undefined>} A promise that resolves with the last modified
|
||||
* date of the file or directory, or undefined if the file doesn't exist.
|
||||
*/
|
||||
lastModified(fileOrDirPath: string | URL): Promise<Date | undefined>;
|
||||
/**
|
||||
* Copies a file from one location to another.
|
||||
* @param {string|URL} source The path to the file to copy.
|
||||
* @param {string|URL} destination The path to copy the file to.
|
||||
* @returns {Promise<void>} A promise that resolves when the file is copied.
|
||||
* @throws {Error} If the source file does not exist.
|
||||
* @throws {Error} If the source file is a directory.
|
||||
* @throws {Error} If the destination file is a directory.
|
||||
*/
|
||||
copy(source: string | URL, destination: string | URL): Promise<void>;
|
||||
/**
|
||||
* Copies a file or directory from one location to another.
|
||||
* @param {string|URL} source The path to the file or directory to copy.
|
||||
* @param {string|URL} destination The path to copy the file or directory to.
|
||||
* @returns {Promise<void>} A promise that resolves when the file or directory is
|
||||
* copied.
|
||||
* @throws {Error} If the source file or directory does not exist.
|
||||
* @throws {Error} If the destination file or directory is a directory.
|
||||
*/
|
||||
copyAll(source: string | URL, destination: string | URL): Promise<void>;
|
||||
/**
|
||||
* Moves a file from the source path to the destination path.
|
||||
* @param {string|URL} source The location of the file to move.
|
||||
* @param {string|URL} destination The destination of the file to move.
|
||||
* @returns {Promise<void>} A promise that resolves when the move is complete.
|
||||
* @throws {TypeError} If the file paths are not strings.
|
||||
* @throws {Error} If the file cannot be moved.
|
||||
*/
|
||||
move(source: string | URL, destination: string | URL): Promise<void>;
|
||||
/**
|
||||
* Moves a file or directory from the source path to the destination path.
|
||||
* @param {string|URL} source The location of the file or directory to move.
|
||||
* @param {string|URL} destination The destination of the file or directory to move.
|
||||
* @returns {Promise<void>} A promise that resolves when the move is complete.
|
||||
* @throws {TypeError} If the file paths are not strings.
|
||||
* @throws {Error} If the file or directory cannot be moved.
|
||||
*/
|
||||
moveAll(source: string | URL, destination: string | URL): Promise<void>;
|
||||
#private;
|
||||
}
|
||||
/**
|
||||
* A class representing a file system utility library.
|
||||
* @implements {HfsImpl}
|
||||
*/
|
||||
export class NodeHfs extends Hfs implements HfsImpl {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {object} [options] The options for the instance.
|
||||
* @param {Fsp} [options.fsp] The file system module to use.
|
||||
*/
|
||||
constructor({ fsp }?: {
|
||||
fsp?: Fsp;
|
||||
});
|
||||
}
|
||||
export const hfs: NodeHfs;
|
||||
export type HfsImpl = import("@humanfs/types").HfsImpl;
|
||||
export type HfsDirectoryEntry = import("@humanfs/types").HfsDirectoryEntry;
|
||||
export type Fsp = typeof nativeFsp;
|
||||
export type Dirent = import("fs").Dirent;
|
||||
import { Hfs } from "@humanfs/core";
|
||||
import nativeFsp from "node:fs/promises";
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user