From 4efe564095229d1a3e248fbb27425b98fc1b15d1 Mon Sep 17 00:00:00 2001 From: Dmitry Verkhoturov Date: Sun, 20 Oct 2024 23:51:09 +0100 Subject: [PATCH 1/7] Lazy load sentry only on errors Credit: https://www.voorhoede.nl/en/blog/load-sentry-asynchronously-only-on-error/ --- hugo/src/js/app.js | 16 ++++++++++++++-- hugo/src/js/sentry.js | 12 +++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/hugo/src/js/app.js b/hugo/src/js/app.js index 9c75e258..639fce92 100644 --- a/hugo/src/js/app.js +++ b/hugo/src/js/app.js @@ -1,6 +1,16 @@ // TODO: fix babel-loader and use import require('./polyfills'); +let sentryInitialized = false; + +async function loadSentry() { + if (!sentryInitialized) { + sentryInitialized = true; + const {initSentry} = import('./sentry'); + await initSentry(); + } +} + if (process.env.NODE_ENV !== 'production') { // Include here for dev, but inline for prod require('./inline'); @@ -13,6 +23,8 @@ if (process.env.NODE_ENV === 'production' || process.env.MIX_TURBO) { require('./quicklink'); } +// Lazy load Sentry only on error if (process.env.NODE_ENV === 'production' || process.env.ENABLE_SENTRY) { - require('./sentry'); -} + window.addEventListener('error', loadSentry); + window.addEventListener('unhandledrejection', loadSentry); +} \ No newline at end of file diff --git a/hugo/src/js/sentry.js b/hugo/src/js/sentry.js index 5e1f1832..9a1620ce 100644 --- a/hugo/src/js/sentry.js +++ b/hugo/src/js/sentry.js @@ -1,5 +1,7 @@ -import * as Sentry from '@sentry/browser'; - -Sentry.init({ - dsn: 'https://6571368ba3af42308da7865628a950b6@sentry.io/1467904', -}); +export function initSentry() { + const Sentry = import('@sentry/browser'); + Sentry.init({ + dsn: 'https://6571368ba3af42308da7865628a950b6@sentry.io/1467904', + }); + return Sentry; +} \ No newline at end of file From 02da7d57626ef913822e0bfc99ad8ea199287814 Mon Sep 17 00:00:00 2001 From: Paul Mineev Date: Fri, 8 Nov 2024 22:46:14 -0500 Subject: [PATCH 2/7] sentry lazy loading --- README.md | 20 +++++++++++++++----- hugo/src/js/app.js | 16 ++-------------- hugo/src/js/sentry.js | 27 ++++++++++++++++++++------- hugo/webpack.mix.js | 14 ++++++++++++-- 4 files changed, 49 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index f7f85c2a..56c3bd7e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ docker-compose run --rm hugo ## публикация подкаста -Перед использованием, необходимо иметь собранный docker образ `publisher`. Команда сборки при помощи docker-compose (конфиг в руте репозитария): `docker-compose build publisher`. +Перед использованием, необходимо иметь собранный docker образ `publisher`. Команда сборки при помощи docker-compose (конфиг в руте репозитория): `docker-compose build publisher`. Скрипты публикации могут быть вызваны при помощи make в директории `./publisher`: @@ -25,6 +25,14 @@ docker-compose run --rm hugo ## фронтенд +### зависимости + +- [Node v22](https://nodejs.org/en/download/package-manager) +- [GoLang](https://go.dev/doc/install) +- [Hugo v0.81.0](https://gohugo.io/installation/macos/#build-from-source) + +### девелопмент + ```bash # node 10 cd hugo @@ -33,17 +41,19 @@ npm install # разработка на localhost:3000 # с hugo LiveReload, без turbolinks -npm run start +npm run dev # без hugo LiveReload, с turbolinks -npm run start-turbo +npm run dev:turbo -# сборка для прода +# сборка для prod # результаты сборки: # - hugo/static/build/ # - hugo/data/manifest.json npm run production ``` +### файловая структура + - лого в `src/images/` -- фавиконки в `static/` и описаны в `layouts/partials/favicons.html` +- favicons в `static/` и описаны в `layouts/partials/favicons.html` - обложки в `static/images/covers/` (для сохранения совместимости также оставлены обложки `static/images/cover.jpg` и `static/images/cover_rt_big_archive.png`) diff --git a/hugo/src/js/app.js b/hugo/src/js/app.js index 639fce92..64319252 100644 --- a/hugo/src/js/app.js +++ b/hugo/src/js/app.js @@ -1,15 +1,7 @@ // TODO: fix babel-loader and use import require('./polyfills'); +import './sentry' -let sentryInitialized = false; - -async function loadSentry() { - if (!sentryInitialized) { - sentryInitialized = true; - const {initSentry} = import('./sentry'); - await initSentry(); - } -} if (process.env.NODE_ENV !== 'production') { // Include here for dev, but inline for prod @@ -23,8 +15,4 @@ if (process.env.NODE_ENV === 'production' || process.env.MIX_TURBO) { require('./quicklink'); } -// Lazy load Sentry only on error -if (process.env.NODE_ENV === 'production' || process.env.ENABLE_SENTRY) { - window.addEventListener('error', loadSentry); - window.addEventListener('unhandledrejection', loadSentry); -} \ No newline at end of file + diff --git a/hugo/src/js/sentry.js b/hugo/src/js/sentry.js index 9a1620ce..e03c41d3 100644 --- a/hugo/src/js/sentry.js +++ b/hugo/src/js/sentry.js @@ -1,7 +1,20 @@ -export function initSentry() { - const Sentry = import('@sentry/browser'); - Sentry.init({ - dsn: 'https://6571368ba3af42308da7865628a950b6@sentry.io/1467904', - }); - return Sentry; -} \ No newline at end of file +let Sentry; + +/** Lazy load Sentry on error */ +async function handleException(errorEvent) { + try { + if (Sentry === undefined) { + Sentry = await import('@sentry/browser'); + Sentry.init({ + dsn: 'https://86c7b8de1ad3cf69978fdf409a776f28@o510231.ingest.us.sentry.io/4508265848897536', + enabled: process.env.NODE_ENV === 'production' || process.env.ENABLE_SENTRY, + }); + } + Sentry.captureException(errorEvent); + } catch (e) { + console.error('Logging to Sentry failed', e); + } +} + +window.addEventListener('error', handleException); +window.addEventListener('unhandledrejection', handleException); diff --git a/hugo/webpack.mix.js b/hugo/webpack.mix.js index 478b8f0b..ada33533 100644 --- a/hugo/webpack.mix.js +++ b/hugo/webpack.mix.js @@ -23,8 +23,10 @@ mix }, }) .ts('src/js/app.js', '.') + .extract(['@sentry/browser'], 'vendor~sentry.js') .version(); + // Process CSS with conditional minification ['app', 'vendor'].forEach((style) => { mix @@ -77,7 +79,7 @@ mix.webpackConfig({ }, ], }), - ], + ] }); if (process.env.ANALYZE) { @@ -138,4 +140,12 @@ if (mix.inProduction()) { }, }, }); -} \ No newline at end of file +} +mix.webpackConfig({ + output: { + publicPath: '/build', + }, + optimization: { + splitChunks: 'all', + }, +}) \ No newline at end of file From e5c2f28178790a9df25f8aedc0d07f1e1d72a610 Mon Sep 17 00:00:00 2001 From: Paul Mineev Date: Fri, 8 Nov 2024 22:51:32 -0500 Subject: [PATCH 3/7] add size-limit for new chunk --- hugo/.size-limit.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hugo/.size-limit.js b/hugo/.size-limit.js index 4998708a..fbee200e 100644 --- a/hugo/.size-limit.js +++ b/hugo/.size-limit.js @@ -11,6 +11,10 @@ module.exports = [ path: 'static/build/vendor.js', limit: '135 KB', }, + { + path: 'static/build/vendor~sentry.js', + limit: '15 KB', + }, { path: 'static/build/app.css', limit: '8 KB', From 0e3af473d1e62386e186c6099874062bc40ab760 Mon Sep 17 00:00:00 2001 From: Paul Mineev Date: Fri, 8 Nov 2024 23:07:02 -0500 Subject: [PATCH 4/7] fix webpack config --- hugo/webpack.mix.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hugo/webpack.mix.js b/hugo/webpack.mix.js index ada33533..07d4e7a5 100644 --- a/hugo/webpack.mix.js +++ b/hugo/webpack.mix.js @@ -16,14 +16,11 @@ mix alias: { 'react': 'preact/compat', 'react-dom': 'preact/compat', - }, - fallback: { - "buffer": require.resolve("buffer/") } }, }) .ts('src/js/app.js', '.') - .extract(['@sentry/browser'], 'vendor~sentry.js') + .extract(['@sentry', '@sentry-internal'], 'vendor~sentry.js') .version(); From 739b979823b4ed78e797f38ee78ff3fccc8398fc Mon Sep 17 00:00:00 2001 From: Paul Mineev Date: Fri, 8 Nov 2024 23:07:21 -0500 Subject: [PATCH 5/7] adjust size-limit --- hugo/.size-limit.js | 6 +- hugo/package-lock.json | 282 ++++++++++++++++++++++++++++++++++++++++- hugo/package.json | 1 + 3 files changed, 283 insertions(+), 6 deletions(-) diff --git a/hugo/.size-limit.js b/hugo/.size-limit.js index fbee200e..22646fdc 100644 --- a/hugo/.size-limit.js +++ b/hugo/.size-limit.js @@ -5,15 +5,15 @@ module.exports = [ }, { path: 'static/build/manifest.js', - limit: '1 KB', + limit: '1.50 KB', }, { path: 'static/build/vendor.js', - limit: '135 KB', + limit: '105 KB', }, { path: 'static/build/vendor~sentry.js', - limit: '15 KB', + limit: '105 KB', }, { path: 'static/build/app.css', diff --git a/hugo/package-lock.json b/hugo/package-lock.json index a528c503..a1fa9352 100644 --- a/hugo/package-lock.json +++ b/hugo/package-lock.json @@ -39,6 +39,7 @@ "visibilityjs": "^2.0.2", "vue-template-compiler": "^2.6.10", "webpack": "^5.96.1", + "webpack-bundle-analyzer": "^4.10.2", "webpack-cli": "^5.1.4" }, "devDependencies": { @@ -2067,6 +2068,12 @@ "url": "https://opencollective.com/parcel" } }, + "node_modules/@polka/url": { + "version": "1.0.0-next.28", + "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.28.tgz", + "integrity": "sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==", + "license": "MIT" + }, "node_modules/@sentry-internal/browser-utils": { "version": "8.36.0", "resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-8.36.0.tgz", @@ -2973,6 +2980,30 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/acorn-walk": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", + "license": "MIT", + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk/node_modules/acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/adjust-sourcemap-loader": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/adjust-sourcemap-loader/-/adjust-sourcemap-loader-3.0.0.tgz", @@ -4911,6 +4942,12 @@ "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz", "integrity": "sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==" }, + "node_modules/debounce": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", + "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==", + "license": "MIT" + }, "node_modules/debug": { "version": "4.3.7", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", @@ -5223,6 +5260,12 @@ "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz", "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==" }, + "node_modules/duplexer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", + "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==", + "license": "MIT" + }, "node_modules/easy-extender": { "version": "2.3.4", "resolved": "https://registry.npmjs.org/easy-extender/-/easy-extender-2.3.4.tgz", @@ -5620,7 +5663,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, "engines": { "node": ">=10" }, @@ -6842,6 +6884,21 @@ "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", "integrity": "sha512-+xGQY0YyAWCnqy7Cd++hc2JqMYzlm0dG30Jd0beaA64sROr8C4nt8Yc9V5Ro3avlSUDTN0ulqP/VBKi1/lLygw==" }, + "node_modules/gzip-size": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-6.0.0.tgz", + "integrity": "sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==", + "license": "MIT", + "dependencies": { + "duplexer": "^0.1.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/handle-thing": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", @@ -7030,6 +7087,12 @@ } ] }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "license": "MIT" + }, "node_modules/html-loader": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/html-loader/-/html-loader-1.3.2.tgz", @@ -8973,6 +9036,15 @@ "integrity": "sha512-r6lj77KlwqLhIUku9UWYes7KJtsczvolZkzp8hbaDPPaE24OmWl5s539Mytlj22siEQKosZ26qCBgda2PKwoJw==", "dev": true }, + "node_modules/mrmime": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.0.tgz", + "integrity": "sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -9561,6 +9633,15 @@ "node": ">=8" } }, + "node_modules/opener": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", + "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", + "license": "(WTFPL OR MIT)", + "bin": { + "opener": "bin/opener-bin.js" + } + }, "node_modules/openurl": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/openurl/-/openurl-1.1.1.tgz", @@ -11901,6 +11982,20 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, + "node_modules/sirv": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/sirv/-/sirv-2.0.4.tgz", + "integrity": "sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==", + "license": "MIT", + "dependencies": { + "@polka/url": "^1.0.0-next.24", + "mrmime": "^2.0.0", + "totalist": "^3.0.0" + }, + "engines": { + "node": ">= 10" + } + }, "node_modules/size-limit": { "version": "4.12.0", "resolved": "https://registry.npmjs.org/size-limit/-/size-limit-4.12.0.tgz", @@ -12717,6 +12812,15 @@ "node": ">=0.6" } }, + "node_modules/totalist": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", + "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/ts-loader": { "version": "6.2.2", "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-6.2.2.tgz", @@ -13324,6 +13428,74 @@ } } }, + "node_modules/webpack-bundle-analyzer": { + "version": "4.10.2", + "resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.10.2.tgz", + "integrity": "sha512-vJptkMm9pk5si4Bv922ZbKLV8UTT4zib4FPgXMhgzUny0bfDDkLXAVQs3ly3fS4/TN9ROFtb0NFrm04UXFE/Vw==", + "license": "MIT", + "dependencies": { + "@discoveryjs/json-ext": "0.5.7", + "acorn": "^8.0.4", + "acorn-walk": "^8.0.0", + "commander": "^7.2.0", + "debounce": "^1.2.1", + "escape-string-regexp": "^4.0.0", + "gzip-size": "^6.0.0", + "html-escaper": "^2.0.2", + "opener": "^1.5.2", + "picocolors": "^1.0.0", + "sirv": "^2.0.3", + "ws": "^7.3.1" + }, + "bin": { + "webpack-bundle-analyzer": "lib/bin/analyzer.js" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/webpack-bundle-analyzer/node_modules/acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/webpack-bundle-analyzer/node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/webpack-bundle-analyzer/node_modules/ws": { + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "license": "MIT", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/webpack-cli": { "version": "5.1.4", "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.1.4.tgz", @@ -15245,6 +15417,11 @@ "integrity": "sha512-+DvS92F9ezicfswqrvIRM2njcYJbd5mb9CUgtrHCHmvn7pPPa+nMDRu1o1bYYz/l5IB2NVGNJWiH7h1E58IF2A==", "optional": true }, + "@polka/url": { + "version": "1.0.0-next.28", + "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.28.tgz", + "integrity": "sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==" + }, "@sentry-internal/browser-utils": { "version": "8.36.0", "resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-8.36.0.tgz", @@ -15997,6 +16174,21 @@ "dev": true, "requires": {} }, + "acorn-walk": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", + "requires": { + "acorn": "^8.11.0" + }, + "dependencies": { + "acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==" + } + } + }, "adjust-sourcemap-loader": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/adjust-sourcemap-loader/-/adjust-sourcemap-loader-3.0.0.tgz", @@ -17439,6 +17631,11 @@ "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz", "integrity": "sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==" }, + "debounce": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", + "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==" + }, "debug": { "version": "4.3.7", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", @@ -17661,6 +17858,11 @@ "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz", "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==" }, + "duplexer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", + "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==" + }, "easy-extender": { "version": "2.3.4", "resolved": "https://registry.npmjs.org/easy-extender/-/easy-extender-2.3.4.tgz", @@ -17986,8 +18188,7 @@ "escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==" }, "eslint": { "version": "7.32.0", @@ -18886,6 +19087,14 @@ "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", "integrity": "sha512-+xGQY0YyAWCnqy7Cd++hc2JqMYzlm0dG30Jd0beaA64sROr8C4nt8Yc9V5Ro3avlSUDTN0ulqP/VBKi1/lLygw==" }, + "gzip-size": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-6.0.0.tgz", + "integrity": "sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==", + "requires": { + "duplexer": "^0.1.2" + } + }, "handle-thing": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", @@ -19030,6 +19239,11 @@ "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.5.2.tgz", "integrity": "sha512-K//PSRMQk4FZ78Kyau+mZurHn3FH0Vwr+H36eE0rPbeYkRRi9YxceYPhuN60UwWorxyKHhqoAJl2OFKa4BVtaA==" }, + "html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==" + }, "html-loader": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/html-loader/-/html-loader-1.3.2.tgz", @@ -20420,6 +20634,11 @@ "integrity": "sha512-r6lj77KlwqLhIUku9UWYes7KJtsczvolZkzp8hbaDPPaE24OmWl5s539Mytlj22siEQKosZ26qCBgda2PKwoJw==", "dev": true }, + "mrmime": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.0.tgz", + "integrity": "sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==" + }, "ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -20877,6 +21096,11 @@ } } }, + "opener": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", + "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==" + }, "openurl": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/openurl/-/openurl-1.1.1.tgz", @@ -22542,6 +22766,16 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, + "sirv": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/sirv/-/sirv-2.0.4.tgz", + "integrity": "sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==", + "requires": { + "@polka/url": "^1.0.0-next.24", + "mrmime": "^2.0.0", + "totalist": "^3.0.0" + } + }, "size-limit": { "version": "4.12.0", "resolved": "https://registry.npmjs.org/size-limit/-/size-limit-4.12.0.tgz", @@ -23179,6 +23413,11 @@ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" }, + "totalist": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", + "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==" + }, "ts-loader": { "version": "6.2.2", "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-6.2.2.tgz", @@ -23662,6 +23901,43 @@ } } }, + "webpack-bundle-analyzer": { + "version": "4.10.2", + "resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.10.2.tgz", + "integrity": "sha512-vJptkMm9pk5si4Bv922ZbKLV8UTT4zib4FPgXMhgzUny0bfDDkLXAVQs3ly3fS4/TN9ROFtb0NFrm04UXFE/Vw==", + "requires": { + "@discoveryjs/json-ext": "0.5.7", + "acorn": "^8.0.4", + "acorn-walk": "^8.0.0", + "commander": "^7.2.0", + "debounce": "^1.2.1", + "escape-string-regexp": "^4.0.0", + "gzip-size": "^6.0.0", + "html-escaper": "^2.0.2", + "opener": "^1.5.2", + "picocolors": "^1.0.0", + "sirv": "^2.0.3", + "ws": "^7.3.1" + }, + "dependencies": { + "acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==" + }, + "commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==" + }, + "ws": { + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "requires": {} + } + } + }, "webpack-cli": { "version": "5.1.4", "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.1.4.tgz", diff --git a/hugo/package.json b/hugo/package.json index 27c28d6c..bc8d2a08 100644 --- a/hugo/package.json +++ b/hugo/package.json @@ -48,6 +48,7 @@ "visibilityjs": "^2.0.2", "vue-template-compiler": "^2.6.10", "webpack": "^5.96.1", + "webpack-bundle-analyzer": "^4.10.2", "webpack-cli": "^5.1.4" }, "devDependencies": { From d6353e19da916f18590797fbcca0a041a9dc1011 Mon Sep 17 00:00:00 2001 From: Paul Mineev Date: Fri, 8 Nov 2024 23:57:31 -0500 Subject: [PATCH 6/7] fix quicklink --- hugo/src/js/quicklink.js | 18 ++++-------------- hugo/webpack.mix.js | 3 --- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/hugo/src/js/quicklink.js b/hugo/src/js/quicklink.js index a04a35b7..5c943dbb 100644 --- a/hugo/src/js/quicklink.js +++ b/hugo/src/js/quicklink.js @@ -1,20 +1,10 @@ -import { prefetch } from 'quicklink/dist/quicklink.mjs'; +import { listen } from 'quicklink'; -function start(options = {}) { - prefetch({ +window.addEventListener('load', () => { + listen({ ignores: [ (_, elem) => String(elem.getAttribute('href'))[0] === '#', (_, elem) => elem.matches('[noprefetch]') || elem.closest('[noprefetch]'), ], - ...options, }); -} - -document.addEventListener('turbolinks:load', start); -document.addEventListener('quicklink', (e) => start(e.detail || {})); - -if (document.readyState === 'loading') { - document.addEventListener('DOMContentLoaded', start); -} else { - start(); -} +}); diff --git a/hugo/webpack.mix.js b/hugo/webpack.mix.js index 07d4e7a5..4f06eb8f 100644 --- a/hugo/webpack.mix.js +++ b/hugo/webpack.mix.js @@ -142,7 +142,4 @@ mix.webpackConfig({ output: { publicPath: '/build', }, - optimization: { - splitChunks: 'all', - }, }) \ No newline at end of file From 63efc2a86b618cf844d837aa0447b2a3e3368e02 Mon Sep 17 00:00:00 2001 From: Dmitry Verkhoturov Date: Sat, 9 Nov 2024 20:36:41 +0000 Subject: [PATCH 7/7] bump libraries sizes --- hugo/.size-limit.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hugo/.size-limit.js b/hugo/.size-limit.js index 22646fdc..22b339a4 100644 --- a/hugo/.size-limit.js +++ b/hugo/.size-limit.js @@ -1,19 +1,19 @@ module.exports = [ { path: 'static/build/app.js', - limit: '20 KB', + limit: '22 KB', }, { path: 'static/build/manifest.js', - limit: '1.50 KB', + limit: '4 KB', }, { path: 'static/build/vendor.js', - limit: '105 KB', + limit: '110 KB', }, { path: 'static/build/vendor~sentry.js', - limit: '105 KB', + limit: '110 KB', }, { path: 'static/build/app.css',