[Dev] Bump dependencies (#2152)

This commit is contained in:
Alexander Zinchuk 2022-12-06 13:29:41 +01:00
parent 20549cb6aa
commit d0055d6653
14 changed files with 3559 additions and 18958 deletions

View File

@ -15,3 +15,5 @@ webpack.config.js
jest.config.js jest.config.js
src/lib/secret-sauce/ src/lib/secret-sauce/
playwright.config.ts playwright.config.ts
dist/*

View File

@ -41,7 +41,10 @@
"no-prototype-builtins": "off", "no-prototype-builtins": "off",
"no-await-in-loop": "off", "no-await-in-loop": "off",
"no-nested-ternary": "off", "no-nested-ternary": "off",
"function-paren-newline": ["error", "consistent"], "function-paren-newline": [
"error",
"consistent"
],
"prefer-destructuring": "off", "prefer-destructuring": "off",
// Allow for...of. Edited from: // Allow for...of. Edited from:
// https://github.com/airbnb/javascript/blob/b4377fb03089dd7f08955242695860d47f9caab4/packages/eslint-config-airbnb-base/rules/style.js#L333 // https://github.com/airbnb/javascript/blob/b4377fb03089dd7f08955242695860d47f9caab4/packages/eslint-config-airbnb-base/rules/style.js#L333
@ -71,13 +74,17 @@
"react/function-component-definition": "off", "react/function-component-definition": "off",
// Teact feature // Teact feature
"react/style-prop-object": "off", "react/style-prop-object": "off",
"react/jsx-no-bind": ["error", { "react/no-unknown-property": "off",
"ignoreRefs": true, "react/jsx-no-bind": [
"allowArrowFunctions": false, "error",
"allowFunctions": false, {
"allowBind": false, "ignoreRefs": true,
"ignoreDOMComponents": true "allowArrowFunctions": false,
}], "allowFunctions": false,
"allowBind": false,
"ignoreDOMComponents": true
}
],
"jsx-a11y/click-events-have-key-events": "off", "jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/no-static-element-interactions": "off", "jsx-a11y/no-static-element-interactions": "off",
"jsx-a11y/label-has-associated-control": "off", "jsx-a11y/label-has-associated-control": "off",
@ -94,7 +101,10 @@
"@typescript-eslint/camelcase": "off", "@typescript-eslint/camelcase": "off",
"@typescript-eslint/member-delimiter-style": "error", "@typescript-eslint/member-delimiter-style": "error",
"@typescript-eslint/default-param-last": "off", "@typescript-eslint/default-param-last": "off",
"@typescript-eslint/return-await": ["error", "in-try-catch"], "@typescript-eslint/return-await": [
"error",
"in-try-catch"
],
"@typescript-eslint/consistent-type-imports": [ "@typescript-eslint/consistent-type-imports": [
"error", "error",
{ {
@ -106,7 +116,10 @@
}, },
"settings": { "settings": {
"import/resolver": "webpack", "import/resolver": "webpack",
"import/core-modules": ["fs", "path"] "import/core-modules": [
"fs",
"path"
]
}, },
"parserOptions": { "parserOptions": {
"project": "./tsconfig.json" "project": "./tsconfig.json"

View File

@ -13,7 +13,7 @@ module.exports = {
testEnvironment: 'jsdom', testEnvironment: 'jsdom',
transform: { transform: {
'\\.(jsx?|tsx?)$': 'babel-jest', '\\.(jsx?|tsx?)$': 'babel-jest',
'\\.txt$': 'jest-raw-loader', '\\.txt$': '@glen/jest-raw-loader',
}, },
globals: { globals: {
APP_REVISION: "jest-test", APP_REVISION: "jest-test",

22337
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -28,8 +28,8 @@
"statoscope:validate-diff": "statoscope validate --input input.json --reference reference.json" "statoscope:validate-diff": "statoscope validate --input input.json --reference reference.json"
}, },
"engines": { "engines": {
"node": "^16.13", "node": "^18",
"npm": "^8.5.2" "npm": "^9"
}, },
"husky": { "husky": {
"hooks": { "hooks": {
@ -43,93 +43,87 @@
"author": "Alexander Zinchuk (alexander@zinchuk.com)", "author": "Alexander Zinchuk (alexander@zinchuk.com)",
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"devDependencies": { "devDependencies": {
"@babel/core": "^7.17.9", "@babel/core": "^7.20.5",
"@babel/plugin-proposal-class-properties": "^7.16.7", "@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-logical-assignment-operators": "^7.18.9", "@babel/plugin-proposal-logical-assignment-operators": "^7.18.9",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
"@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3",
"@babel/preset-env": "^7.16.11", "@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.16.7", "@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.16.7", "@babel/preset-typescript": "^7.18.6",
"@peculiar/webcrypto": "^1.3.3", "@glen/jest-raw-loader": "^2.0.0",
"@playwright/test": "^1.23.4", "@playwright/test": "^1.28.1",
"@statoscope/cli": "^5.20.1", "@statoscope/cli": "^5.24.0",
"@statoscope/webpack-plugin": "^5.20.1", "@statoscope/webpack-plugin": "^5.20.1",
"@testing-library/jest-dom": "^5.16.4", "@testing-library/jest-dom": "^5.16.5",
"@types/croppie": "^2.6.1", "@types/croppie": "^2.6.1",
"@types/hast": "^2.3.4", "@types/hast": "^2.3.4",
"@types/jest": "^27.4.1", "@types/jest": "^29.2.3",
"@types/react": "^18.0.5", "@types/react": "^18.0.25",
"@types/react-dom": "^18.0.0", "@types/react-dom": "^18.0.9",
"@types/wicg-mediasession": "^1.1.3", "@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/eslint-plugin": "^5.19.0", "@typescript-eslint/parser": "^5.45.0",
"@typescript-eslint/parser": "^5.19.0", "@webpack-cli/serve": "^2.0.0",
"@webpack-cli/serve": "^1.6.1", "autoprefixer": "^10.4.13",
"autoprefixer": "^10.4.4", "babel-loader": "^9.1.0",
"babel-loader": "^8.2.4",
"browserlist": "^1.0.1", "browserlist": "^1.0.1",
"buffer": "^6.0.3", "buffer": "^6.0.3",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"css-loader": "^6.7.1", "css-loader": "^6.7.2",
"dotenv": "^16.0.0", "dotenv": "^16.0.3",
"eslint": "^8.13.0", "eslint": "^8.28.0",
"eslint-config-airbnb": "^19.0.4", "eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0", "eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-react-app": "^7.0.1", "eslint-config-react-app": "^7.0.1",
"eslint-import-resolver-webpack": "^0.13.2", "eslint-import-resolver-webpack": "^0.13.2",
"eslint-plugin-flowtype": "^8.0.3", "eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.26.0", "eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.5.1", "eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-no-async-without-await": "^1.2.0", "eslint-plugin-no-async-without-await": "^1.2.0",
"eslint-plugin-no-null": "^1.0.2", "eslint-plugin-no-null": "^1.0.2",
"eslint-plugin-react": "^7.29.4", "eslint-plugin-react": "^7.31.11",
"eslint-plugin-react-hooks": "^4.4.0", "eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-teactn": "git+https://github.com/korenskoy/eslint-plugin-teactn#c2c39dd005d58c07c24c4361de804dce1c6261b5", "eslint-plugin-teactn": "git+https://github.com/korenskoy/eslint-plugin-teactn#c2c39dd005d58c07c24c4361de804dce1c6261b5",
"git-revision-webpack-plugin": "^5.0.0", "git-revision-webpack-plugin": "^5.0.0",
"gitlog": "^4.0.4", "gitlog": "^4.0.4",
"html-webpack-plugin": "^5.5.0", "html-webpack-plugin": "^5.5.0",
"husky": "^7.0.4", "husky": "^8.0.2",
"jest": "^27.5.1", "jest": "^29.3.1",
"jest-raw-loader": "^1.0.1", "jest-environment-jsdom": "^29.3.1",
"jsdom": "^19.0.0", "lint-staged": "^13.0.4",
"lint-staged": "^12.3.7", "mini-css-extract-plugin": "^2.7.1",
"mini-css-extract-plugin": "^2.6.0", "postcss-loader": "^7.0.1",
"postcss-loader": "^6.2.1", "postcss-modules": "^6.0.0",
"postcss-modules": "^4.3.1", "react": "^18.2.0",
"react": "^18.0.0", "sass": "^1.56.1",
"replace-in-file": "^6.3.2", "sass-loader": "^13.2.0",
"sass": "^1.50.0",
"sass-loader": "^12.6.0",
"script-loader": "^0.7.2", "script-loader": "^0.7.2",
"serve": "^13.0.2", "serve": "^14.1.2",
"style-loader": "^3.3.1", "style-loader": "^3.3.1",
"stylelint": "^14.6.1", "stylelint": "^14.15.0",
"stylelint-config-recommended-scss": "^6.0.0", "stylelint-config-recommended-scss": "^8.0.0",
"stylelint-declaration-block-no-ignored-properties": "^2.5.0", "stylelint-declaration-block-no-ignored-properties": "^2.6.0",
"stylelint-group-selectors": "^1.0.6", "stylelint-group-selectors": "^1.0.9",
"stylelint-high-performance-animation": "^1.6.0", "stylelint-high-performance-animation": "^1.6.0",
"telegraph-node": "^1.0.4", "telegraph-node": "^1.0.4",
"typescript": "^4.6.3", "typescript": "^4.9.3",
"webpack": "^5.72.0", "webpack": "^5.75.0",
"webpack-cli": "^4.9.2", "webpack-dev-server": "^4.11.1",
"webpack-dev-server": "^4.8.1", "whatwg-fetch": "^3.6.2"
"webpack-merge": "^5.8.0"
}, },
"dependencies": { "dependencies": {
"@cryptography/aes": "^0.1.1", "@cryptography/aes": "^0.1.1",
"async-mutex": "^0.3.2", "async-mutex": "^0.4.0",
"big-integer": "github:painor/BigInteger.js", "big-integer": "github:painor/BigInteger.js",
"croppie": "^2.6.5", "croppie": "^2.6.5",
"emoji-data-ios": "git+https://github.com/korenskoy/emoji-data-ios#3c401da02c6792cea0b6c758795da406377bf667", "emoji-data-ios": "git+https://github.com/korenskoy/emoji-data-ios#3c401da02c6792cea0b6c758795da406377bf667",
"events": "^3.3.0", "idb-keyval": "^6.2.0",
"idb-keyval": "^6.1.0", "lowlight": "^2.8.0",
"lowlight": "^2.6.1",
"opus-recorder": "github:Ajaxy/opus-recorder", "opus-recorder": "github:Ajaxy/opus-recorder",
"os-browserify": "^0.3.0", "os-browserify": "^0.3.0",
"pako": "^2.0.4", "pako": "^2.1.0",
"path-browserify": "^1.0.1", "path-browserify": "^1.0.1",
"qr-code-styling": "github:zubiden/qr-code-styling#10f7cf3", "qr-code-styling": "github:zubiden/qr-code-styling#dbbfed0"
"websocket": "^1.0.34"
}, },
"optionalDependencies": { "optionalDependencies": {
"fsevents": "2.3.2" "fsevents": "2.3.2"

View File

@ -256,7 +256,7 @@ function replaceSimpleMarkdown(textParts: TextPart[], type: 'jsx' | 'html'): Tex
} }
const parts = part.split(SIMPLE_MARKDOWN_REGEX); const parts = part.split(SIMPLE_MARKDOWN_REGEX);
const entities = part.match(SIMPLE_MARKDOWN_REGEX) || []; const entities: string[] = part.match(SIMPLE_MARKDOWN_REGEX) || [];
result.push(parts[0]); result.push(parts[0]);
return entities.reduce((entityResult: TextPart[], entity, i) => { return entities.reduce((entityResult: TextPart[], entity, i) => {

View File

@ -275,7 +275,6 @@ const MessageList: FC<OwnProps & StateProps> = ({
isScrollingRef.current = true; isScrollingRef.current = true;
if (!memoFocusingIdRef.current) { if (!memoFocusingIdRef.current) {
updateStickyDates(container, hasTools); updateStickyDates(container, hasTools);
} }

View File

@ -235,13 +235,13 @@ const MiddleColumn: FC<StateProps> = ({
// Fix for mobile virtual keyboard // Fix for mobile virtual keyboard
useEffect(() => { useEffect(() => {
const { visualViewport } = window as any; const { visualViewport } = window;
if (!visualViewport) { if (!visualViewport) {
return undefined; return undefined;
} }
const handleResize = () => { const handleResize = () => {
if (window.visualViewport.height !== document.documentElement.clientHeight) { if (visualViewport.height !== document.documentElement.clientHeight) {
document.body.classList.add('keyboard-visible'); document.body.classList.add('keyboard-visible');
} else { } else {
document.body.classList.remove('keyboard-visible'); document.body.classList.remove('keyboard-visible');

View File

@ -2,8 +2,6 @@ const { Mutex } = require('async-mutex');
const mutex = new Mutex(); const mutex = new Mutex();
const WebSocketClient = require('websocket').w3cwebsocket;
const closeError = new Error('WebSocket was closed'); const closeError = new Error('WebSocket was closed');
class PromisedWebSockets { class PromisedWebSockets {
@ -80,7 +78,7 @@ class PromisedWebSockets {
}); });
this.closed = false; this.closed = false;
this.website = this.getWebSocketLink(ip, port, testServers, isPremium); this.website = this.getWebSocketLink(ip, port, testServers, isPremium);
this.client = new WebSocketClient(this.website, 'binary'); this.client = new WebSocket(this.website, 'binary');
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.client.onopen = () => { this.client.onopen = () => {
this.receive(); this.receive();

View File

@ -105,6 +105,7 @@ function renderWithVirtual<T extends VirtualElement | undefined>(
} }
if (DEBUG && $new) { if (DEBUG && $new) {
// @ts-ignore TS 4.9 bug https://github.com/microsoft/TypeScript/issues/51501
const newTarget = 'target' in $new && $new.target; const newTarget = 'target' in $new && $new.target;
if (newTarget && (!$current || ('target' in $current && newTarget !== $current.target))) { if (newTarget && (!$current || ('target' in $current && newTarget !== $current.target))) {
throw new Error('[Teact] Cached virtual element was moved within tree'); throw new Error('[Teact] Cached virtual element was moved within tree');

View File

@ -1,5 +1,5 @@
export default function getKeyFromEvent(e: KeyboardEvent) { export default function getKeyFromEvent(e: KeyboardEvent) {
const key = 'key' in e ? e.key : e.code; const key = e.key || e.code;
return key.startsWith('Key') ? key.slice(3).toLowerCase() : key; return key.startsWith('Key') ? key.slice(3).toLowerCase() : key;
} }

View File

@ -43,7 +43,7 @@ export function pickTruthy<T, K extends keyof T>(object: T, keys: K[]) {
}, {} as Pick<T, K>); }, {} as Pick<T, K>);
} }
export function omit<T, K extends keyof T>(object: T, keys: K[]) { export function omit<T extends object, K extends keyof T>(object: T, keys: K[]): Omit<T, K> {
const stringKeys = new Set(keys.map(String)); const stringKeys = new Set(keys.map(String));
const savedKeys = Object.keys(object) const savedKeys = Object.keys(object)
.filter((key) => !stringKeys.has(key)) as Array<Exclude<keyof T, K>>; .filter((key) => !stringKeys.has(key)) as Array<Exclude<keyof T, K>>;
@ -118,7 +118,7 @@ export function split<T extends any>(array: T[], chunkSize: number) {
} }
export function cloneDeep<T>(value: T): T { export function cloneDeep<T>(value: T): T {
if (typeof value !== 'object') { if (!isObject(value)) {
return value; return value;
} }
@ -132,6 +132,11 @@ export function cloneDeep<T>(value: T): T {
}, {} as T); }, {} as T);
} }
function isObject(value: any): value is object {
// eslint-disable-next-line no-null/no-null
return typeof value === 'object' && value !== null;
}
export function findLast<T>(array: Array<T>, predicate: (value: T, index: number, obj: T[]) => boolean): T | undefined { export function findLast<T>(array: Array<T>, predicate: (value: T, index: number, obj: T[]) => boolean): T | undefined {
let cursor = array.length; let cursor = array.length;

View File

@ -92,16 +92,6 @@ export function setPositionState(state?: MediaPositionState) {
mediaSession?.setPositionState?.(state); mediaSession?.setPositionState?.(state);
} }
export function setMicrophoneActive(active: boolean) {
const { mediaSession } = window.navigator;
mediaSession?.setMicrophoneActive?.(active);
}
export function setCameraActive(active: boolean) {
const { mediaSession } = window.navigator;
mediaSession?.setCameraActive?.(active);
}
export function buildMediaMetadata({ export function buildMediaMetadata({
title, artist, album, artwork, title, artist, album, artwork,
}: MediaMetadataParameters) { }: MediaMetadataParameters) {

View File

@ -38,7 +38,7 @@ const handleResize = throttle(() => {
window.addEventListener('orientationchange', handleResize); window.addEventListener('orientationchange', handleResize);
if (IS_IOS) { if (IS_IOS) {
window.visualViewport.addEventListener('resize', handleResize); window.visualViewport!.addEventListener('resize', handleResize);
} else { } else {
window.addEventListener('resize', handleResize); window.addEventListener('resize', handleResize);
} }
@ -46,7 +46,7 @@ if (IS_IOS) {
export function updateSizes(): IDimensions { export function updateSizes(): IDimensions {
let height: number; let height: number;
if (IS_IOS) { if (IS_IOS) {
height = window.visualViewport.height + window.visualViewport.pageTop; height = window.visualViewport!.height + window.visualViewport!.pageTop;
} else { } else {
height = window.innerHeight; height = window.innerHeight;
} }