diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index da35229b1..e951002b3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,11 +44,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Node 14 - uses: actions/setup-node@v2 + - name: Install Node.js + uses: actions/setup-node@v3 with: - node-version: '14' + node-version: '18.x' - name: Install npm packages - run: npm install -g sass postcss-cli postcss autoprefixer + run: npm ci - name: Build style.css run: ./make_style.sh diff --git a/.gitignore b/.gitignore index 23bffc56c..b0e631657 100644 --- a/.gitignore +++ b/.gitignore @@ -35,7 +35,6 @@ backup*.json custom_script_* websocket/config.js node_modules/ -package-lock.json db.json tmp.sh *.sql diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..f2899c9e7 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,12 @@ +.DS_Store +node_modules +/build +/package +.env +.env.* +!.env.example + +# Ignore files for PNPM, NPM and YARN +pnpm-lock.yaml +package-lock.json +yarn.lock diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..a64cbe601 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,9 @@ +{ + "semi": true, + "useTabs": false, + "tabWidth": 2, + "printWidth": 100, + "singleQuote": false, + "trailingComma": "all", + "bracketSameLine": false +} diff --git a/make_style.sh b/make_style.sh index 80392ed84..b79ab2572 100755 --- a/make_style.sh +++ b/make_style.sh @@ -1,15 +1,15 @@ #!/bin/bash -if ! [ -x "$(command -v sass)" ]; then +if ! [ -x "$(command -v npx sass)" ]; then echo 'Error: sass is not installed.' >&2 exit 1 fi -if ! [ -x "$(command -v postcss)" ]; then +if ! [ -x "$(command -v npx postcss)" ]; then echo 'Error: postcss is not installed.' >&2 exit 1 fi -if ! [ -x "$(command -v autoprefixer)" ]; then +if ! [ -x "$(command -v npx autoprefixer)" ]; then echo 'Error: autoprefixer is not installed.' >&2 exit 1 fi @@ -19,8 +19,8 @@ cd "$(dirname "$0")" || exit build_style() { echo "Creating $1 style..." cp resources/vars-$1.scss resources/vars.scss - sass resources:sass_processed - postcss sass_processed/style.css sass_processed/martor-description.css sass_processed/select2-dmoj.css --verbose --use autoprefixer -d $2 + npx sass resources:sass_processed + npx postcss sass_processed/style.css sass_processed/martor-description.css sass_processed/select2-dmoj.css --verbose --use autoprefixer -d $2 } build_style 'default' 'resources' diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..1ac05f9f3 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1094 @@ +{ + "name": "@vnoi-admin/oj", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@vnoi-admin/oj", + "dependencies": { + "@commander-js/extra-typings": "11.0.0", + "commander": "11.0.0", + "ws": "8.14.0" + }, + "devDependencies": { + "@types/ws": "8.5.5", + "autoprefixer": "10.4.15", + "postcss": "8.4.29", + "postcss-cli": "10.1.0", + "prettier": "3.0.3", + "sass": "1.66.1" + } + }, + "node_modules/@commander-js/extra-typings": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/@commander-js/extra-typings/-/extra-typings-11.0.0.tgz", + "integrity": "sha512-06ol6Kn5gPjFY6v0vWOZ84nQwyqhZdaeZCHYH3vhwewjpOEjniF1KHZxh18887G3poWiJ8qyq5pb6ANuiddfPQ==", + "peerDependencies": { + "commander": "11.0.x" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@types/node": { + "version": "20.5.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.9.tgz", + "integrity": "sha512-PcGNd//40kHAS3sTlzKB9C9XL4K0sTup8nbG5lC14kzEteTNuAFh9u5nA0o5TWnSG2r/JNPRXFVcHJIIeRlmqQ==", + "dev": true + }, + "node_modules/@types/ws": { + "version": "8.5.5", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.5.tgz", + "integrity": "sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "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, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/autoprefixer": { + "version": "10.4.15", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.15.tgz", + "integrity": "sha512-KCuPB8ZCIqFdA4HwKXsvz7j6gvSDNhDP7WnUjBleRkKjPdvCmHFuQ77ocavI8FT6NdvlBnE2UFr2H4Mycn8Vew==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/autoprefixer" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "browserslist": "^4.21.10", + "caniuse-lite": "^1.0.30001520", + "fraction.js": "^4.2.0", + "normalize-range": "^0.1.2", + "picocolors": "^1.0.0", + "postcss-value-parser": "^4.2.0" + }, + "bin": { + "autoprefixer": "bin/autoprefixer" + }, + "engines": { + "node": "^10 || ^12 || >=14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.21.10", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.10.tgz", + "integrity": "sha512-bipEBdZfVH5/pwrvqc+Ub0kUPVfGUhlKxbvfD+z1BDnPEO/X98ruXGA1WP5ASpAFKan7Qr6j736IacbZQuAlKQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001517", + "electron-to-chromium": "^1.4.477", + "node-releases": "^2.0.13", + "update-browserslist-db": "^1.0.11" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001529", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001529.tgz", + "integrity": "sha512-n2pUQYGAkrLG4QYj2desAh+NqsJpHbNmVZz87imptDdxLAtjxary7Df/psdfyDGmskJK/9Dt9cPnx5RZ3CU4Og==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ] + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/commander": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.0.0.tgz", + "integrity": "sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==", + "engines": { + "node": ">=16" + } + }, + "node_modules/dependency-graph": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/dependency-graph/-/dependency-graph-0.11.0.tgz", + "integrity": "sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg==", + "dev": true, + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.4.512", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.512.tgz", + "integrity": "sha512-1W8wRbYlQE4ph7eoj3TJ+uqwO6+xvAE/L+KGU7WTQQvX3tnSIGZAb90MTsMoJqzntamiwJhBAj4WZmygXhsOUg==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/fast-glob": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fraction.js": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.6.tgz", + "integrity": "sha512-n2aZ9tNfYDwaHhvFTkhFErqOMIb8uyzSQ+vGJBjZyanAKZVbGUQ1sngfk9FdkBw7G26O7AgNjLcecLffD1c7eg==", + "dev": true, + "engines": { + "node": "*" + }, + "funding": { + "type": "patreon", + "url": "https://github.com/sponsors/rawify" + } + }, + "node_modules/fs-extra": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", + "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-stdin": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-9.0.0.tgz", + "integrity": "sha512-dVKBjfWisLAicarI2Sf+JuBE/DghV4UzNAVe9yhEJuzeREd3JhOTE9cUaJTeSa77fsbQUK3pcOpJfM59+VKZaA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globby": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", + "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", + "dev": true, + "dependencies": { + "dir-glob": "^3.0.1", + "fast-glob": "^3.3.0", + "ignore": "^5.2.4", + "merge2": "^1.4.1", + "slash": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globby/node_modules/slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/immutable": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.4.tgz", + "integrity": "sha512-fsXeu4J4i6WNWSikpI88v/PcVflZz+6kMhUfIwc5SY+poQRPnaf5V7qds6SUyUN3cVxEzuCab7QIoLOQ+DQ1wA==", + "dev": true + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/nanoid": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/node-releases": { + "version": "2.0.13", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", + "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", + "dev": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-range": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postcss": { + "version": "8.4.29", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.29.tgz", + "integrity": "sha512-cbI+jaqIeu/VGqXEarWkRCCffhjgXc0qjBtXpqJhTBohMUjUQnbBr0xqX3vEKudc4iviTewcJo5ajcec5+wdJw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-cli": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/postcss-cli/-/postcss-cli-10.1.0.tgz", + "integrity": "sha512-Zu7PLORkE9YwNdvOeOVKPmWghprOtjFQU3srMUGbdz3pHJiFh7yZ4geiZFMkjMfB0mtTFR3h8RemR62rPkbOPA==", + "dev": true, + "dependencies": { + "chokidar": "^3.3.0", + "dependency-graph": "^0.11.0", + "fs-extra": "^11.0.0", + "get-stdin": "^9.0.0", + "globby": "^13.0.0", + "picocolors": "^1.0.0", + "postcss-load-config": "^4.0.0", + "postcss-reporter": "^7.0.0", + "pretty-hrtime": "^1.0.3", + "read-cache": "^1.0.0", + "slash": "^5.0.0", + "yargs": "^17.0.0" + }, + "bin": { + "postcss": "index.js" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "postcss": "^8.0.0" + } + }, + "node_modules/postcss-load-config": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-4.0.1.tgz", + "integrity": "sha512-vEJIc8RdiBRu3oRAI0ymerOn+7rPuMvRXslTvZUKZonDHFIczxztIyJ1urxM1x9JXEikvpWWTUUqal5j/8QgvA==", + "dev": true, + "dependencies": { + "lilconfig": "^2.0.5", + "yaml": "^2.1.1" + }, + "engines": { + "node": ">= 14" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": ">=8.0.9", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "postcss": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/postcss-reporter": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/postcss-reporter/-/postcss-reporter-7.0.5.tgz", + "integrity": "sha512-glWg7VZBilooZGOFPhN9msJ3FQs19Hie7l5a/eE6WglzYqVeH3ong3ShFcp9kDWJT1g2Y/wd59cocf9XxBtkWA==", + "dev": true, + "dependencies": { + "picocolors": "^1.0.0", + "thenby": "^1.3.4" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true + }, + "node_modules/prettier": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", + "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/pretty-hrtime": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", + "integrity": "sha512-66hKPCr+72mlfiSjlEB1+45IjXSqvVAIy6mocupoww4tBFE9R9IhwwUGoI4G++Tc9Aq+2rxOt0RFU6gPcrte0A==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/read-cache": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", + "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", + "dev": true, + "dependencies": { + "pify": "^2.3.0" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/sass": { + "version": "1.66.1", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.66.1.tgz", + "integrity": "sha512-50c+zTsZOJVgFfTgwwEzkjA3/QACgdNsKueWPyAR0mRINIvLAStVQBbPg14iuqEQ74NPDbXzJARJ/O4SI1zftA==", + "dev": true, + "dependencies": { + "chokidar": ">=3.0.0 <4.0.0", + "immutable": "^4.0.0", + "source-map-js": ">=0.6.2 <2.0.0" + }, + "bin": { + "sass": "sass.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/slash": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "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, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/thenby": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/thenby/-/thenby-1.3.4.tgz", + "integrity": "sha512-89Gi5raiWA3QZ4b2ePcEwswC3me9JIg+ToSgtE0JWeCynLnLxNr/f9G+xfo9K+Oj4AFdom8YNJjibIARTJmapQ==", + "dev": true + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", + "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/ws": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.0.tgz", + "integrity": "sha512-WR0RJE9Ehsio6U4TuM+LmunEsjQ5ncHlw4sn9ihD6RoJKZrVyH9FWV3dmnwu8B2aNib1OvG2X6adUCyFpQyWcg==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yaml": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.2.tgz", + "integrity": "sha512-N/lyzTPaJasoDmfV7YTrYCI0G/3ivm/9wdG0aHuheKowWQwGTsK0Eoiw6utmzAnI6pkJa0DUVygvp3spqqEKXg==", + "dev": true, + "engines": { + "node": ">= 14" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 000000000..917adc13b --- /dev/null +++ b/package.json @@ -0,0 +1,21 @@ +{ + "name": "@vnoi-admin/oj", + "type": "module", + "scripts": { + "format": "prettier --write websocket", + "format:check": "prettier --check websocket" + }, + "dependencies": { + "@commander-js/extra-typings": "11.0.0", + "commander": "11.0.0", + "ws": "8.14.0" + }, + "devDependencies": { + "@types/ws": "8.5.5", + "autoprefixer": "10.4.15", + "postcss": "8.4.29", + "postcss-cli": "10.1.0", + "prettier": "3.0.3", + "sass": "1.66.1" + } +} diff --git a/websocket/daemon.js b/websocket/daemon.js index abb6b3b35..6cab21906 100644 --- a/websocket/daemon.js +++ b/websocket/daemon.js @@ -1,206 +1,272 @@ -var config = require('./config'); -var set = require('simplesets').Set; -var queue = require('qu'); -var WebSocketServer = require('ws').Server; -var wss_receiver = new WebSocketServer({host: config.get_host, port: config.get_port}); -var wss_sender = new WebSocketServer({host: config.post_host, port: config.post_port}); -var messages = new queue(); -var followers = new set(); -var pollers = new set(); -var max_queue = config.max_queue || 50; -var long_poll_timeout = config.long_poll_timeout || 60000; -var message_id = Date.now(); - -if (typeof String.prototype.startsWith != 'function') { - String.prototype.startsWith = function (str){ - return this.slice(0, str.length) == str; - }; -} +// @ts-check +/** + * @typedef {import("./types.js").Message} Message + * @typedef {import("./types.js").WebSocketExtended} WebSocketExtended + * @typedef {import("./types.js").IncomingMessageExtended} IncomingMessageExtended + * @typedef {import("./types.js").ServerResponseExtended} ServerResponseExtended + * @typedef {import("./types.js").WebSocketRawExtended} WebSocketRawExtended + */ +import { createServer } from "http"; +import { WebSocketServer } from "ws"; -messages.catch_up = function (client) { - this.each(function (message) { - if (message.id > client.last_msg) - client.got_message(message); - }); -}; +import config from "./config.js"; +import { Queue } from "./queue.js"; -messages.post = function (channel, message) { - message = { - id: ++message_id, - channel: channel, - message: message - }; - this.push(message); - if (this.length > max_queue) - this.shift(); - followers.each(function (client) { - client.got_message(message); - }); - pollers.each(function (request) { - request.got_message(message); - }); - return message.id; +const wssReceiver = new WebSocketServer({ + host: config.get_host, + port: config.get_port, +}); +const wssSender = new WebSocketServer({ + host: config.post_host, + port: config.post_port, +}); + +/** + * @type {Queue} + */ +const messages = new Queue(); +/** + * @type {Set} + */ +const followers = new Set(); +/** + * @type {Set} + */ +const pollers = new Set(); +const maxQueue = config.max_queue || 50; +const longPollTimeout = config.long_poll_timeout || 60000; +let messageId = Date.now(); + +/** + * @param {WebSocketExtended} client + */ +const messagesCatchUp = (client) => { + messages.forEach((message) => { + if (message.id > client.lastMessage) { + client.gotMessage(message); + } + }); }; -messages.last = function () { - return this.tail().id; +/** + * Post a message. + * @param {string} channel + * @param {string} message + * @returns + */ +const messagesPost = (channel, message) => { + /** + * @type {Message} + */ + const resolvedMessage = { + id: ++messageId, + channel: channel, + message: message, + }; + messages.push(resolvedMessage); + if (messages.length > maxQueue) { + messages.pop(); + } + followers.forEach((client) => { + client.gotMessage(resolvedMessage); + }); + pollers.forEach((request) => { + request.gotMessage(resolvedMessage); + }); + return resolvedMessage.id; }; -wss_receiver.on('connection', function (socket) { - socket.channel = null; - socket.last_msg = 0; - - var commands = { - start_msg: function (request) { - socket.last_msg = request.start; - }, - set_filter: function (request) { - var filter = {}; - if (Array.isArray(request.filter) && request.filter.length > 0 && - request.filter.every(function (channel, index, array) { - if (typeof channel != 'string') - return false; - filter[channel] = true; - return true; - })) { - socket.filter = filter; - followers.add(socket); - messages.catch_up(socket); - } else { - socket.send(JSON.stringify({ - status: 'error', - code: 'invalid-filter', - message: 'invalid filter: ' + request.filter - })); - } - }, - }; +wssReceiver.on("connection", (/** @type {WebSocketExtended} */ socket) => { + socket.lastMessage = 0; + const commands = { + /** + * @param {WebSocketRawExtended} request + */ + start_msg(request) { + socket.lastMessage = request.start; + }, + /** + * @param {WebSocketRawExtended} request + */ + set_filter(request) { + /** + * @type {Record} + */ + const filter = {}; + if ( + Array.isArray(request.filter) && + request.filter.length > 0 && + request.filter.every((channel) => { + if (typeof channel !== "string") { + return false; + } + filter[channel] = true; + return true; + }) + ) { + socket.filter = filter; + followers.add(socket); + messagesCatchUp(socket); + } else { + socket.send( + JSON.stringify({ + status: "error", + code: "invalid-filter", + message: "invalid filter: " + request.filter, + }), + ); + } + }, + }; - socket.got_message = function (message) { - if (message.channel in socket.filter) - socket.send(JSON.stringify(message)); - socket.last_msg = message.id; - }; + socket.gotMessage = (message) => { + if (message.channel in socket.filter) { + socket.send(JSON.stringify(message)); + } + socket.lastMessage = message.id; + }; - socket.on('message', function (request) { - try { - request = JSON.parse(request); - } catch (err) { - socket.send(JSON.stringify({ - status: 'error', - code: 'syntax-error', - message: err.message - })); - return; - } - request.command = request.command.replace(/-/g, '_'); - if (request.command in commands) - commands[request.command](request); - else - socket.send(JSON.stringify({ - status: 'error', - code: 'bad-command', - message: 'bad command: ' + request.command - })); - }); + socket.on("message", (/** @type {WebSocketRawExtended}*/ request) => { + try { + request = JSON.parse(request.toString()); + } catch (err) { + socket.send( + JSON.stringify({ + status: "error", + code: "syntax-error", + message: err.message, + }), + ); + return; + } + request.command = request.command.replace(/-/g, "_"); + if (request.command in commands) { + commands[request.command](request); + } else { + socket.send( + JSON.stringify({ + status: "error", + code: "bad-command", + message: `bad command: ${request.command}`, + }), + ); + return; + } + }); - socket.on('close', function(code, message) { - followers.remove(socket); - }); + socket.on("close", () => { + followers.delete(socket); + }); }); -wss_sender.on('connection', function (socket) { - var commands = { - post: function (request) { - if (typeof request.channel != 'string') - return { - status: 'error', - code: 'invalid-channel' - }; - return { - status: 'success', - id: messages.post(request.channel, request.message) - }; - }, - last_msg: function (request) { - return { - status: 'success', - id: message_id, - }; - } - }; - socket.on('message', function (request) { - try { - request = JSON.parse(request); - } catch (err) { - socket.send(JSON.stringify({ - status: 'error', - code: 'syntax-error', - message: err.message - })); - return; - } - request.command = request.command.replace(/-/g, '_'); - if (request.command in commands) - socket.send(JSON.stringify(commands[request.command](request))); - else - socket.send(JSON.stringify({ - status: 'error', - code: 'bad-command', - message: 'bad command: ' + request.command - })); - }); +wssSender.on("connection", (socket) => { + const commands = { + /** + * @param {WebSocketRawExtended} request + * @returns + */ + post(request) { + if (typeof request.channel !== "string") { + return { + status: "error", + code: "invalid-channel", + }; + } + return { + status: "success", + id: messagesPost(request.channel, request.message), + }; + }, + last_msg() { + return { + status: "success", + id: messageId, + }; + }, + }; + socket.on("message", (/** @type {WebSocketRawExtended}*/ request) => { + try { + request = JSON.parse(request.toString()); + } catch (err) { + return socket.send( + JSON.stringify({ + status: "error", + code: "syntax-error", + message: err.message, + }), + ); + } + request.command = request.command.replace(/-/g, "_"); + if (request.command in commands) { + socket.send(JSON.stringify(commands[request.command](request))); + } else { + socket.send( + JSON.stringify({ + status: "error", + code: "bad-command", + message: "bad command: " + request.command, + }), + ); + } + }); }); -var url = require('url'); -require('http').createServer(function (req, res) { - var parts = url.parse(req.url, true); +createServer( + // @ts-expect-error We can't pass generics to `createServer`. + (/** @type {IncomingMessageExtended} */ req, /** @type {ServerResponseExtended} */ res) => { + const parts = req.url ? new URL(req.url, "http://n") : undefined; - if (!parts.pathname.startsWith('/channels/')) { - res.writeHead(404, {'Content-Type': 'text/plain'}); - res.end('404 Not Found'); - return; + if (!parts?.pathname.startsWith("/channels/")) { + res.writeHead(404, { "Content-Type": "text/plain" }); + res.end("404 Not Found"); + return; } - var channels = decodeURI(parts.pathname).slice(10).split('|'); + const channels = decodeURI(parts.pathname).slice(10).split("|"); if (channels.length == 1 && !channels[0].length) { - res.writeHead(400, {'Content-Type': 'text/plain'}); - res.end('400 Bad Request'); - return; + res.writeHead(400, { "Content-Type": "text/plain" }); + res.end("400 Bad Request"); + return; } req.channels = {}; - req.last_msg = parseInt(parts.query.last); - if (isNaN(req.last_msg)) req.last_msg = 0; + req.lastMessage = parseInt(parts.searchParams.get("last") || "0"); + if (isNaN(req.lastMessage)) { + req.lastMessage = 0; + } - channels.forEach(function (channel) { - req.channels[channel] = true; + channels.forEach((channel) => { + req.channels[channel] = true; }); - req.on('close', function () { - pollers.remove(req); + req.on("close", () => { + pollers.delete(req); }); - req.got_message = function (message) { - if (message.channel in req.channels) { - res.writeHead(200, {'Content-Type': 'application/json'}); - res.end(JSON.stringify(message)); - pollers.remove(req); - return true; - } - return false; + req.gotMessage = (message) => { + if (message.channel in req.channels) { + res.writeHead(200, { "Content-Type": "application/json" }); + res.end(JSON.stringify(message)); + pollers.delete(req); + return true; + } + return false; }; - var got = false; - messages.each(function (message) { - if (!got && message.id > req.last_msg) - got = req.got_message(message); + let got = false; + messages.forEach((message) => { + if (!got && message.id > req.lastMessage) { + got = req.gotMessage(message); + } }); if (!got) { - pollers.add(req); - res.setTimeout(long_poll_timeout, function () { - pollers.remove(req); - res.writeHead(504, {'Content-Type': 'application/json'}); - res.end('{"error": "timeout"}'); - }); + pollers.add(req); + res.setTimeout(longPollTimeout, () => { + pollers.delete(req); + res.writeHead(504, { "Content-Type": "application/json" }); + res.end('{"error": "timeout"}'); + }); } -}).listen(config.http_port, config.http_host); + }, +).listen(config.http_port, config.http_host, () => { + console.log(`Websocket daemon listening on http://${config.http_host}:${config.http_port}`); +}); diff --git a/websocket/queue.js b/websocket/queue.js new file mode 100644 index 000000000..dadad2bb4 --- /dev/null +++ b/websocket/queue.js @@ -0,0 +1,131 @@ +// Source: https://github.com/skeggse/qu/blob/master/lib/qu.js (this code was not licensed at the time of writing). +// @ts-check +/** + * @template T + */ +class Item { + /** + * @param {T} data + * @param {Item | null} next + */ + constructor(data, next) { + /** + * The item's data. + * @type {T} + * @public + */ + this.data = data; + /** + * The item's next adjacent item. + * @type {Item | null} + * @public + */ + this.next = next; + } +} + +/** + * @template T + */ +export class Queue { + /** + * The queue's head. + * @type {Item | null} + */ + #head; + /** + * The queue's tail. + * @type {Item | null} + */ + #tail; + /** + * The queue's length. + * @type {number} + */ + #length; + constructor() { + this.#head = null; + this.#tail = null; + this.#length = 0; + } + /** + * @template T + * @param {T[]} array + * @returns {Queue} + */ + static fromArray(array) { + const queue = new Queue(); + for (let i = 0; i < array.length; i++) { + queue.push(array[i]); + } + return queue; + } + toArray() { + const array = new Array(this.length); + for (let item = this.#head, i = 0; item; item = item.next) { + array[i++] = item.data; + } + return array; + } + /** + * Adds an item to the queue. + * @param {T} data + * @returns + */ + push(data) { + const prev = this.#tail; + this.#tail = new Item(data, null); + if (prev) { + prev.next = this.#tail; + } else { + this.#head = this.#tail; + } + this.#length++; + return this; + } + /** + * Removes an item from the queue and returns it. + */ + pop() { + const data = this.#head?.data; + this.#head = this.#head?.next || null; + if (!this.#head) { + this.#tail = null; + } + this.#length--; + return data; + } + /** + * Adds an item to the queue. + * @param {T} data + * @returns + */ + unshift(data) { + this.#head = new Item(data, this.#head); + if (!this.#tail) { + this.#tail = this.#head; + } + this.#length++; + return this; + } + /** + * Loops through the queue. + * @param {((data: T, index: number) => void)} fn + */ + forEach(fn) { + for (let item = this.#head, i = 0; item; item = item.next) { + fn(item.data, i++); + } + } + get length() { + return this.#length; + } + get head() { + return this.#head?.data; + } + get tail() { + return this.#tail?.data; + } +} + +export default Queue; diff --git a/websocket/types.d.ts b/websocket/types.d.ts new file mode 100644 index 000000000..21e58de20 --- /dev/null +++ b/websocket/types.d.ts @@ -0,0 +1,32 @@ +import { IncomingMessage, ServerResponse } from "http"; +import type { RawData, WebSocket } from "ws"; + +export interface Message { + id: number; + channel: string; + message: string; +} + +export interface WebSocketExtended extends WebSocket { + lastMessage: number; + filter: Record; + gotMessage(message: Message): void; +} + +export interface IncomingMessageExtended extends IncomingMessage { + lastMessage: number; + channels: Record; + gotMessage(message: Message): boolean; +} + +export interface ServerResponseExtended extends ServerResponse { + req: IncomingMessageExtended; +} + +export type WebSocketRawExtended = RawData & { + command: string; + filter: unknown[]; + start: number; + channel: unknown; + message: string; +}; diff --git a/websocket/wscat.js b/websocket/wscat.js deleted file mode 100644 index a4e952d84..000000000 --- a/websocket/wscat.js +++ /dev/null @@ -1,223 +0,0 @@ -#!/usr/bin/env node - -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var WebSocket = require('ws') - , fs = require('fs') - , program = require('commander') - , util = require('util') - , events = require('events') - , readline = require('readline'); - -/** - * InputReader - processes console input - */ - -function Console() { - this.stdin = process.stdin; - this.stdout = process.stdout; - - this.readlineInterface = readline.createInterface(this.stdin, this.stdout); - - var self = this; - this.readlineInterface.on('line', function(data) { - self.emit('line', data); - }); - this.readlineInterface.on('close', function() { - self.emit('close'); - }); - - this._resetInput = function() { - self.clear(); - } -} -util.inherits(Console, events.EventEmitter); - -Console.Colors = { - Red: '\033[31m', - Green: '\033[32m', - Yellow: '\033[33m', - Cyan: '\033[36m', - Blue: '\033[34m', - Default: '\033[39m' -}; - -Console.prototype.prompt = function() { - this.readlineInterface.prompt(); -} - -Console.prototype.print = function(msg, color) { - this.clear(); - color = color || Console.Colors.Default; - this.stdout.write(color + msg + Console.Colors.Default + '\n'); - this.prompt(); -} - -Console.prototype.clear = function() { - this.stdout.write('\033[2K\033[E'); -} - -Console.prototype.pause = function() { - this.stdin.on('keypress', this._resetInput); -} - -Console.prototype.resume = function() { - this.stdin.removeListener('keypress', this._resetInput); -} - -function appender(xs) { - xs = xs || []; - return function (x) { - xs.push(x); - return xs; - } -} - -function into(obj, kvals) { - kvals.forEach(function (kv) { - obj[kv[0]] = kv[1]; - }); - return obj; -} - -function splitOnce(sep, str) { // sep can be either String or RegExp - var tokens = str.split(sep); - return [tokens[0], str.replace(sep, '').substr(tokens[0].length)]; -} - -/** - * The actual application - */ - -var version = '1.0';//JSON.parse(fs.readFileSync(__dirname + '/../package.json', 'utf8')).version; -program - .version(version) - .usage('[options] ') - .option('-l, --listen ', 'listen on port') - .option('-c, --connect ', 'connect to a websocket server') - .option('-p, --protocol ', 'optional protocol version') - .option('-o, --origin ', 'optional origin') - .option('--host ', 'optional host') - .option('-s, --subprotocol ', 'optional subprotocol') - .option('-n, --no-check', 'Do not check for unauthorized certificates') - .option('-H, --header ', 'Set an HTTP header. Repeat to set multiple. (--connect only)', appender(), []) - .option('--auth ', 'Add basic HTTP authentication header. (--connect only)') - .parse(process.argv); - -if (program.listen && program.connect) { - console.error('\033[33merror: use either --listen or --connect\033[39m'); - process.exit(-1); -} -else if (program.listen) { - var wsConsole = new Console(); - wsConsole.pause(); - var options = {}; - if (program.protocol) options.protocolVersion = program.protocol; - if (program.origin) options.origin = program.origin; - if (program.subprotocol) options.protocol = program.subprotocol; - if (!program.check) options.rejectUnauthorized = program.check; - var ws = null; - var wss = new WebSocket.Server({port: program.listen}, function() { - wsConsole.print('listening on port ' + program.listen + ' (press CTRL+C to quit)', Console.Colors.Green); - wsConsole.clear(); - }); - wsConsole.on('close', function() { - if (ws) { - try { - ws.close(); - } - catch (e) {} - } - process.exit(0); - }); - wsConsole.on('line', function(data) { - if (ws) { - ws.send(data, {mask: false}); - wsConsole.prompt(); - } - }); - wss.on('connection', function(newClient) { - if (ws) { - // limit to one client - newClient.terminate(); - return; - }; - ws = newClient; - wsConsole.resume(); - wsConsole.prompt(); - wsConsole.print('client connected', Console.Colors.Green); - ws.on('close', function() { - wsConsole.print('disconnected', Console.Colors.Green); - wsConsole.clear(); - wsConsole.pause(); - ws = null; - }); - ws.on('error', function(code, description) { - wsConsole.print('error: ' + code + (description ? ' ' + description : ''), Console.Colors.Yellow); - }); - ws.on('message', function(data, flags) { - wsConsole.print('< ' + data, Console.Colors.Blue); - }); - }); - wss.on('error', function(error) { - wsConsole.print('error: ' + error.toString(), Console.Colors.Yellow); - process.exit(-1); - }); -} -else if (program.connect) { - var wsConsole = new Console(); - var options = {}; - if (program.protocol) options.protocolVersion = program.protocol; - if (program.origin) options.origin = program.origin; - if (program.subprotocol) options.protocol = program.subprotocol; - if (program.host) options.host = program.host; - if (!program.check) options.rejectUnauthorized = program.check; - var headers = into({}, (program.header || []).map(function (s) { - return splitOnce(':', s) - })); - if (program.auth) { - headers['Authorization'] = 'Basic ' + new Buffer(program.auth).toString('base64'); - } - options.headers = headers; - var ws = new WebSocket(program.connect, options); - ws.on('open', function() { - wsConsole.print('connected (press CTRL+C to quit)', Console.Colors.Green); - wsConsole.on('line', function(data) { - ws.send(data, {mask: true}); - wsConsole.prompt(); - }); - }); - ws.on('close', function() { - wsConsole.print('disconnected', Console.Colors.Green); - wsConsole.clear(); - process.exit(); - }); - ws.on('error', function(code, description) { - wsConsole.print('error: ' + code + (description ? ' ' + description : ''), Console.Colors.Yellow); - process.exit(-1); - }); - ws.on('message', function(data, flags) { - wsConsole.print('< ' + data, Console.Colors.Cyan); - }); - wsConsole.on('close', function() { - if (ws) { - try { - ws.close(); - } - catch(e) {} - process.exit(); - } - }); -} -else { - console.error('\033[33merror: use either --listen or --connect\033[39m'); - process.exit(-1); -}