[dev] Bump dependencies (#2839)
This commit is contained in:
parent
2c8b22b964
commit
f53e38c4a7
19
.babelrc
19
.babelrc
@ -1,19 +0,0 @@
|
||||
{
|
||||
"presets": [
|
||||
[
|
||||
"@babel/typescript"
|
||||
],
|
||||
[
|
||||
"@babel/preset-env"
|
||||
],
|
||||
[
|
||||
"@babel/preset-react"
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator",
|
||||
"@babel/plugin-syntax-nullish-coalescing-operator",
|
||||
"@babel/plugin-proposal-logical-assignment-operators",
|
||||
]
|
||||
}
|
||||
@ -90,6 +90,12 @@
|
||||
"import/prefer-default-export": "off",
|
||||
"import/named": "off",
|
||||
"import/no-webpack-loader-syntax": "off",
|
||||
"import/no-cycle": [
|
||||
"error",
|
||||
{
|
||||
"allowUnsafeDynamicCyclicDependency": true // TODO: Fix this
|
||||
}
|
||||
],
|
||||
"react/prop-types": "off",
|
||||
"react/jsx-one-expression-per-line": "off",
|
||||
"react/button-has-type": "off",
|
||||
|
||||
22
babel.config.js
Normal file
22
babel.config.js
Normal file
@ -0,0 +1,22 @@
|
||||
const isTest = process.env.APP_ENV === 'test';
|
||||
|
||||
module.exports = {
|
||||
presets: [
|
||||
[
|
||||
'@babel/typescript',
|
||||
],
|
||||
[
|
||||
'@babel/preset-env',
|
||||
],
|
||||
[
|
||||
'@babel/preset-react',
|
||||
],
|
||||
],
|
||||
plugins: [
|
||||
'@babel/plugin-proposal-class-properties',
|
||||
'@babel/plugin-proposal-nullish-coalescing-operator',
|
||||
'@babel/plugin-syntax-nullish-coalescing-operator',
|
||||
'@babel/plugin-proposal-logical-assignment-operators',
|
||||
...(isTest ? ['babel-plugin-transform-import-meta'] : []),
|
||||
],
|
||||
};
|
||||
@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
setupFilesAfterEnv: ['./tests/init.js'],
|
||||
moduleNameMapper: {
|
||||
'\\.(css|scss|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|tgs)$':
|
||||
'\\.(css|scss|wasm|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|tgs)$':
|
||||
'<rootDir>/tests/staticFileMock.js',
|
||||
},
|
||||
testPathIgnorePatterns: [
|
||||
|
||||
3144
package-lock.json
generated
3144
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
76
package.json
76
package.json
@ -7,7 +7,7 @@
|
||||
"dev": "cross-env APP_ENV=development APP_VERSION=$(npm run version:print --silent) webpack serve --mode development",
|
||||
"dev:mocked": "cross-env APP_ENV=test APP_MOCKED_CLIENT=1 webpack serve --mode development --port 1235",
|
||||
"build:mocked": "cross-env APP_ENV=test APP_MOCKED_CLIENT=1 webpack --mode development",
|
||||
"build:staging": "APP_ENV=staging APP_VERSION=$(npm run version:inc --silent) webpack --mode development && ./deploy/copy_to_dist.sh",
|
||||
"build:staging": "cross-env APP_ENV=staging APP_VERSION=$(npm run version:inc --silent) webpack --mode development && ./deploy/copy_to_dist.sh",
|
||||
"build:production": "npm i && APP_VERSION=$(npm run version:inc --silent) webpack && ./deploy/copy_to_dist.sh",
|
||||
"deploy:production": "npm run build:production && git add -A && git commit -a -m '[Build]' --no-verify && git push",
|
||||
"postversion": "npm run version:update",
|
||||
@ -24,7 +24,6 @@
|
||||
"test:playwright": "playwright test",
|
||||
"test:record": "playwright codegen localhost:1235",
|
||||
"prepare": "husky install",
|
||||
"statoscope:validate": "statoscope validate --input public/build-stats.json",
|
||||
"statoscope:validate-diff": "statoscope validate --input input.json --reference reference.json",
|
||||
"postinstall": "(cd dev/eslint-multitab && npm i)"
|
||||
},
|
||||
@ -44,76 +43,77 @@
|
||||
"author": "Alexander Zinchuk (alexander@zinchuk.com)",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/core": "^7.21.3",
|
||||
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
||||
"@babel/plugin-proposal-logical-assignment-operators": "^7.18.9",
|
||||
"@babel/plugin-proposal-logical-assignment-operators": "^7.20.7",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
|
||||
"@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@babel/preset-typescript": "^7.21.0",
|
||||
"@glen/jest-raw-loader": "^2.0.0",
|
||||
"@playwright/test": "^1.28.1",
|
||||
"@statoscope/cli": "^5.24.0",
|
||||
"@statoscope/webpack-plugin": "^5.20.1",
|
||||
"@playwright/test": "^1.31.2",
|
||||
"@statoscope/cli": "^5.26.1",
|
||||
"@statoscope/webpack-plugin": "^5.25.1",
|
||||
"@testing-library/jest-dom": "^5.16.5",
|
||||
"@types/croppie": "^2.6.1",
|
||||
"@types/hast": "^2.3.4",
|
||||
"@types/jest": "^29.2.3",
|
||||
"@types/react": "^18.0.25",
|
||||
"@types/react-dom": "^18.0.9",
|
||||
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
||||
"@typescript-eslint/parser": "^5.45.0",
|
||||
"@webpack-cli/serve": "^2.0.0",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"babel-loader": "^9.1.0",
|
||||
"@types/jest": "^29.5.0",
|
||||
"@types/react": "^18.0.28",
|
||||
"@types/react-dom": "^18.0.11",
|
||||
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
||||
"@typescript-eslint/parser": "^5.55.0",
|
||||
"@webpack-cli/serve": "^2.0.1",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"babel-loader": "^9.1.2",
|
||||
"babel-plugin-transform-import-meta": "^2.2.0",
|
||||
"browserlist": "^1.0.1",
|
||||
"buffer": "^6.0.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"css-loader": "^6.7.2",
|
||||
"css-loader": "^6.7.3",
|
||||
"dotenv": "^16.0.3",
|
||||
"eslint": "^8.28.0",
|
||||
"eslint": "^8.36.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-airbnb-typescript": "^17.0.0",
|
||||
"eslint-config-react-app": "^7.0.1",
|
||||
"eslint-import-resolver-webpack": "^0.13.2",
|
||||
"eslint-plugin-eslint-multitab-tt": "file:dev/eslint-multitab",
|
||||
"eslint-plugin-flowtype": "^8.0.3",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.6.1",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"eslint-plugin-jsx-a11y": "^6.7.1",
|
||||
"eslint-plugin-jsx-expressions": "^1.3.1",
|
||||
"eslint-plugin-no-async-without-await": "^1.2.0",
|
||||
"eslint-plugin-no-null": "^1.0.2",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react": "^7.32.2",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-hooks-static-deps": "^1.0.7",
|
||||
"eslint-plugin-teactn": "git+https://github.com/korenskoy/eslint-plugin-teactn#c2c39dd005d58c07c24c4361de804dce1c6261b5",
|
||||
"git-revision-webpack-plugin": "^5.0.0",
|
||||
"gitlog": "^4.0.4",
|
||||
"html-webpack-plugin": "^5.5.0",
|
||||
"husky": "^8.0.2",
|
||||
"jest": "^29.3.1",
|
||||
"jest-environment-jsdom": "^29.3.1",
|
||||
"lint-staged": "^13.0.4",
|
||||
"mini-css-extract-plugin": "^2.7.1",
|
||||
"postcss-loader": "^7.0.1",
|
||||
"husky": "^8.0.3",
|
||||
"jest": "^29.5.0",
|
||||
"jest-environment-jsdom": "^29.5.0",
|
||||
"lint-staged": "^13.2.0",
|
||||
"mini-css-extract-plugin": "^2.7.5",
|
||||
"postcss-loader": "^7.1.0",
|
||||
"postcss-modules": "^6.0.0",
|
||||
"react": "^18.2.0",
|
||||
"sass": "^1.56.1",
|
||||
"sass-loader": "^13.2.0",
|
||||
"sass": "^1.59.3",
|
||||
"sass-loader": "^13.2.1",
|
||||
"script-loader": "^0.7.2",
|
||||
"serve": "^14.1.2",
|
||||
"style-loader": "^3.3.1",
|
||||
"stylelint": "^14.15.0",
|
||||
"serve": "^14.2.0",
|
||||
"style-loader": "^3.3.2",
|
||||
"stylelint": "^14.16.1",
|
||||
"stylelint-config-recommended-scss": "^8.0.0",
|
||||
"stylelint-declaration-block-no-ignored-properties": "^2.6.0",
|
||||
"stylelint-declaration-block-no-ignored-properties": "^2.7.0",
|
||||
"stylelint-group-selectors": "^1.0.9",
|
||||
"stylelint-high-performance-animation": "^1.6.0",
|
||||
"stylelint-high-performance-animation": "^1.8.0",
|
||||
"stylelint-selector-tag-no-without-class": "^2.0.5",
|
||||
"telegraph-node": "^1.0.4",
|
||||
"typescript": "^4.9.3",
|
||||
"webpack": "^5.75.0",
|
||||
"webpack-dev-server": "^4.11.1",
|
||||
"typescript": "^5.0.2",
|
||||
"webpack": "^5.76.2",
|
||||
"webpack-dev-server": "^4.13.1",
|
||||
"whatwg-fetch": "^3.6.2"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -123,7 +123,7 @@
|
||||
"croppie": "^2.6.5",
|
||||
"emoji-data-ios": "git+https://github.com/korenskoy/emoji-data-ios#3c401da02c6792cea0b6c758795da406377bf667",
|
||||
"idb-keyval": "^6.2.0",
|
||||
"lowlight": "^2.8.0",
|
||||
"lowlight": "^2.8.1",
|
||||
"opus-recorder": "github:Ajaxy/opus-recorder",
|
||||
"os-browserify": "^0.3.0",
|
||||
"pako": "^2.1.0",
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
export { default as MediaViewer } from '../components/mediaViewer/MediaViewer';
|
||||
|
||||
export { default as ForwardRecipientPicker } from '../components/main/ForwardRecipientPicker';
|
||||
@ -30,29 +29,23 @@ export { default as ReactorListModal } from '../components/middle/ReactorListMod
|
||||
export { default as EmojiInteractionAnimation } from '../components/middle/EmojiInteractionAnimation';
|
||||
export { default as MessageLanguageModal } from '../components/middle/MessageLanguageModal';
|
||||
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
export { default as LeftSearch } from '../components/left/search/LeftSearch';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
export { default as Settings } from '../components/left/settings/Settings';
|
||||
export { default as ContactList } from '../components/left/main/ContactList';
|
||||
export { default as NewChat } from '../components/left/newChat/NewChat';
|
||||
export { default as NewChatStep1 } from '../components/left/newChat/NewChatStep1';
|
||||
export { default as NewChatStep2 } from '../components/left/newChat/NewChatStep2';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
export { default as ArchivedChats } from '../components/left/ArchivedChats';
|
||||
export { default as ChatFolderModal } from '../components/left/ChatFolderModal';
|
||||
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
export { default as ContextMenuContainer } from '../components/middle/message/ContextMenuContainer';
|
||||
export { default as SponsoredMessageContextMenuContainer }
|
||||
from '../components/middle/message/SponsoredMessageContextMenuContainer';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
export { default as StickerSetModal } from '../components/common/StickerSetModal';
|
||||
export { default as CustomEmojiSetsModal } from '../components/common/CustomEmojiSetsModal';
|
||||
export { default as HeaderMenuContainer } from '../components/middle/HeaderMenuContainer';
|
||||
export { default as MobileSearch } from '../components/middle/MobileSearch';
|
||||
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
export { default as AttachmentModal } from '../components/middle/composer/AttachmentModal';
|
||||
export { default as PollModal } from '../components/middle/composer/PollModal';
|
||||
export { default as SymbolMenu } from '../components/middle/composer/SymbolMenu';
|
||||
@ -68,13 +61,9 @@ export { default as EmojiTooltip } from '../components/middle/composer/EmojiTool
|
||||
export { default as InlineBotTooltip } from '../components/middle/composer/InlineBotTooltip';
|
||||
export { default as SendAsMenu } from '../components/middle/composer/SendAsMenu';
|
||||
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
export { default as RightSearch } from '../components/right/RightSearch';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
export { default as StickerSearch } from '../components/right/StickerSearch';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
export { default as GifSearch } from '../components/right/GifSearch';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
export { default as Statistics } from '../components/right/statistics/Statistics';
|
||||
export { default as MessageStatistics } from '../components/right/statistics/MessageStatistics';
|
||||
export { default as PollResults } from '../components/right/PollResults';
|
||||
|
||||
@ -3,7 +3,6 @@ import { getActions, getGlobal } from '../global';
|
||||
import { IS_MULTITAB_SUPPORTED } from '../util/windowEnvironment';
|
||||
import { DEBUG } from '../config';
|
||||
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
export { default as Main } from '../components/main/Main';
|
||||
export { default as LockScreen } from '../components/main/LockScreen';
|
||||
|
||||
|
||||
@ -43,8 +43,7 @@ const StatusButton: FC<StateProps> = ({ emojiStatus }) => {
|
||||
showEffect();
|
||||
unmarkShouldShowEffect();
|
||||
}
|
||||
// eslint-disable-next-line react-hooks-static-deps/exhaustive-deps
|
||||
}, [emojiStatus, shouldShowEffect, showEffect, unmarkShouldShowEffect] as const);
|
||||
}, [emojiStatus, shouldShowEffect, showEffect, unmarkShouldShowEffect]);
|
||||
|
||||
const handleEmojiStatusSet = useCallback((sticker: ApiSticker) => {
|
||||
markShouldShowEffect();
|
||||
|
||||
@ -8,7 +8,7 @@ export enum ChatAnimationTypes {
|
||||
|
||||
export function useChatAnimationType<T extends number | string>(orderDiffById: Record<T, number>) {
|
||||
return useMemo(() => {
|
||||
const orderDiffs = Object.values(orderDiffById) as T[];
|
||||
const orderDiffs = Object.values(orderDiffById) as number[];
|
||||
const numberOfUp = orderDiffs.filter((diff) => diff < 0).length;
|
||||
const numberOfDown = orderDiffs.filter((diff) => diff > 0).length;
|
||||
|
||||
|
||||
@ -373,7 +373,7 @@ const Main: FC<OwnProps & StateProps> = ({
|
||||
willAnimateLeftColumnRef.current = false;
|
||||
forceUpdate();
|
||||
});
|
||||
}, [animationLevel, forceUpdate, isLeftColumnOpen]);
|
||||
}, [isLeftColumnOpen, animationLevel, forceUpdate]);
|
||||
|
||||
const rightColumnTransition = useShowTransition(
|
||||
isRightColumnOpen, undefined, true, undefined, shouldSkipHistoryAnimations, undefined, true,
|
||||
@ -402,7 +402,7 @@ const Main: FC<OwnProps & StateProps> = ({
|
||||
forceUpdate();
|
||||
setIsNarrowMessageList(isRightColumnOpen);
|
||||
});
|
||||
}, [animationLevel, forceUpdate, isRightColumnOpen]);
|
||||
}, [isRightColumnOpen, animationLevel, forceUpdate]);
|
||||
|
||||
const className = buildClassName(
|
||||
leftColumnTransition.hasShownClass && 'left-column-shown',
|
||||
|
||||
@ -506,8 +506,7 @@ const MessageList: FC<OwnProps & StateProps> = ({
|
||||
console.timeEnd('scrollTop');
|
||||
}
|
||||
// This should match deps for `useSyncEffect` above
|
||||
// eslint-disable-next-line react-hooks-static-deps/exhaustive-deps -- `as const` not yet supported by linter
|
||||
}, [messageIds, isViewportNewest, containerHeight, hasTools] as const);
|
||||
}, [messageIds, isViewportNewest, containerHeight, hasTools]);
|
||||
|
||||
useEffectWithPrevDeps(([prevIsSelectModeActive]) => {
|
||||
if (prevIsSelectModeActive !== undefined) {
|
||||
|
||||
@ -98,10 +98,7 @@ const useDraft = (
|
||||
}
|
||||
});
|
||||
}
|
||||
// eslint-disable-next-line react-hooks-static-deps/exhaustive-deps
|
||||
}, [
|
||||
chatId, threadId, draft, setHtml, editedMessage, loadCustomEmojis,
|
||||
] as const);
|
||||
}, [chatId, threadId, draft, setHtml, editedMessage, loadCustomEmojis]);
|
||||
|
||||
// Save draft on chat change
|
||||
useEffect(() => {
|
||||
|
||||
@ -64,8 +64,7 @@ const useEditing = (
|
||||
focusEditableElement(messageInput, true);
|
||||
}
|
||||
});
|
||||
// eslint-disable-next-line react-hooks-static-deps/exhaustive-deps -- `as const` not yet supported by linter
|
||||
}, [editedMessage, replyingToId, setHtml] as const);
|
||||
}, [editedMessage, replyingToId, editingDraft, setHtml]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!editedMessage) {
|
||||
|
||||
@ -45,8 +45,7 @@ export default function useInlineBotTooltip(
|
||||
if (prevUsername) {
|
||||
resetInlineBot({ username: prevUsername });
|
||||
}
|
||||
// eslint-disable-next-line react-hooks-static-deps/exhaustive-deps
|
||||
}, [username, resetInlineBot] as const);
|
||||
}, [username, resetInlineBot]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!usernameLowered) return;
|
||||
|
||||
@ -182,7 +182,7 @@ addActionHandler('reset', (global, actions): ActionReturnType => {
|
||||
void cacheApi.clear(CUSTOM_BG_CACHE_NAME);
|
||||
|
||||
const langCachePrefix = LANG_CACHE_NAME.replace(/\d+$/, '');
|
||||
const langCacheVersion = (LANG_CACHE_NAME.match(/\d+$/) || [0])[0];
|
||||
const langCacheVersion = Number((LANG_CACHE_NAME.match(/\d+$/) || ['0'])[0]);
|
||||
for (let i = 0; i < langCacheVersion; i++) {
|
||||
void cacheApi.clear(`${langCachePrefix}${i === 0 ? '' : i}`);
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@ addActionHandler('requestMasterAndRequestCall', (global, actions, payload): Acti
|
||||
});
|
||||
});
|
||||
|
||||
addActionHandler('requestCall', async (global, actions, payload): Promise<void> => {
|
||||
addActionHandler('requestCall', (global, actions, payload): ActionReturnType => {
|
||||
const { userId, isVideo, tabId = getCurrentTabId() } = payload;
|
||||
|
||||
if (global.phoneCall) {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { useEffect } from '../lib/teact/teact';
|
||||
import usePrevious from './usePrevious';
|
||||
|
||||
const useEffectWithPrevDeps = <T extends readonly any[]>(
|
||||
const useEffectWithPrevDeps = <const T extends readonly any[]>(
|
||||
cb: (args: T | readonly []) => void, dependencies: T, debugKey?: string,
|
||||
) => {
|
||||
const prevDeps = usePrevious<T>(dependencies);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { useLayoutEffect } from '../lib/teact/teact';
|
||||
import usePrevious from './usePrevious';
|
||||
|
||||
const useLayoutEffectWithPrevDeps = <T extends readonly any[]>(
|
||||
const useLayoutEffectWithPrevDeps = <const T extends readonly any[]>(
|
||||
cb: (args: T | readonly []) => void, dependencies: T, debugKey?: string,
|
||||
) => {
|
||||
const prevDeps = usePrevious<T>(dependencies);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import usePrevious from './usePrevious';
|
||||
|
||||
const useSyncEffect = <T extends readonly any[]>(cb: (args: T | readonly []) => void, dependencies: T) => {
|
||||
const useSyncEffect = <const T extends readonly any[]>(cb: (args: T | readonly []) => void, dependencies: T) => {
|
||||
const prevDeps = usePrevious<T>(dependencies);
|
||||
if (!prevDeps || dependencies.some((d, i) => d !== prevDeps[i])) {
|
||||
cb(prevDeps || []);
|
||||
|
||||
@ -28,7 +28,7 @@ const PLURAL_RULES = {
|
||||
en: (n: number) => (n !== 1 ? 6 : 2),
|
||||
ar: (n: number) => (n === 0 ? 1 : n === 1 ? 2 : n === 2 ? 3 : n % 100 >= 3 && n % 100 <= 10 ? 4 : n % 100 >= 11 ? 5 : 6),
|
||||
be: (n: number) => {
|
||||
const s = String(n).split('.'); const t0 = Number(s[0]) === n; const n10 = t0 && Number(s[0].slice(-1)); const n100 = t0 && Number(s[0].slice(-2));
|
||||
const s = String(n).split('.'); const t0 = Number(s[0]) === n; const n10 = t0 ? Number(s[0].slice(-1)) : 0; const n100 = t0 ? Number(s[0].slice(-2)) : 0;
|
||||
return n10 === 1 && n100 !== 11 ? 2
|
||||
: (n10 >= 2 && n10 <= 4) && (n100 < 12 || n100 > 14) ? 4
|
||||
: (t0 && n10 === 0) || (n10 >= 5 && n10 <= 9) || (n100 >= 11 && n100 <= 14) ? 5
|
||||
|
||||
@ -27,5 +27,6 @@
|
||||
"plugins",
|
||||
"dev",
|
||||
"webpack.config.js",
|
||||
"babel.config.js",
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const dotenv = require('dotenv');
|
||||
|
||||
const {
|
||||
@ -23,6 +24,7 @@ const {
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const STATOSCOPE_REFERENCE_URL = 'https://webz.dev/build-stats.json';
|
||||
const DEFAULT_APP_TITLE = `Telegram${APP_ENV !== 'production' ? ' Beta' : ''}`;
|
||||
|
||||
const {
|
||||
@ -139,6 +141,14 @@ module.exports = (_env, { mode = 'production' }) => {
|
||||
},
|
||||
|
||||
plugins: [
|
||||
{
|
||||
apply: (compiler) => {
|
||||
compiler.hooks.compile.tap('Before Compilation', async () => {
|
||||
const stats = await fetch(STATOSCOPE_REFERENCE_URL).then((res) => res.text());
|
||||
fs.writeFileSync(path.resolve('./public/reference.json'), stats);
|
||||
});
|
||||
},
|
||||
},
|
||||
// Clearing of the unused files for code highlight for smaller chunk count
|
||||
new ContextReplacementPlugin(
|
||||
/highlight\.js[\\/]lib[\\/]languages/,
|
||||
@ -190,6 +200,7 @@ module.exports = (_env, { mode = 'production' }) => {
|
||||
},
|
||||
saveReportTo: path.resolve('./public/statoscope-report.html'),
|
||||
saveStatsTo: path.resolve('./public/build-stats.json'),
|
||||
additionalStats: ['./public/reference.json'],
|
||||
normalizeStats: true,
|
||||
open: 'file',
|
||||
extensions: [new WebpackContextExtension()],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user