diff --git a/package.json b/package.json index 4dd18253..3cffc069 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "format": "prettier . --check --cache --cache-location='node_modules/.cache/prettiercache'", "format:fix": "prettier . --write --cache --cache-location='node_modules/.cache/prettiercache' --log-level=warn", "typecheck": "tsc --noEmit", - "profiler": "tsx ./scripts/profiler.ts", "test": "jest --maxWorkers=2 --passWithNoTests", "test:ci": "pnpm test -- --reporters=default --reporters=github-actions" }, @@ -61,7 +60,6 @@ "@types/react-dom": "^18.3.0", "@types/react-router-dom": "^5.3.3", "@types/webextension-polyfill": "^0.10.7", - "@types/webpack-bundle-analyzer": "^4.7.0", "@types/zip-webpack-plugin": "^3.0.6", "@typescript-eslint/eslint-plugin": "^7.13.0", "@typescript-eslint/parser": "^7.13.0", @@ -97,7 +95,6 @@ "tsx": "^4.15.4", "typescript": "^5.4.5", "webpack": "^5.92.0", - "webpack-bundle-analyzer": "^4.10.2", "webpack-cli": "^5.1.4", "webpack-ext-reloader-mv3": "^2.1.1", "webpack-extension-manifest-plugin": "^0.8.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 574bd428..a1192062 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -123,9 +123,6 @@ importers: '@types/webextension-polyfill': specifier: ^0.10.7 version: 0.10.7 - '@types/webpack-bundle-analyzer': - specifier: ^4.7.0 - version: 4.7.0(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2)(webpack@5.92.0)) '@types/zip-webpack-plugin': specifier: ^3.0.6 version: 3.0.6 @@ -231,15 +228,12 @@ importers: webpack: specifier: ^5.92.0 version: 5.92.0(webpack-cli@5.1.4) - webpack-bundle-analyzer: - specifier: ^4.10.2 - version: 4.10.2 webpack-cli: specifier: ^5.1.4 - version: 5.1.4(webpack-bundle-analyzer@4.10.2)(webpack@5.92.0) + version: 5.1.4(webpack@5.92.0) webpack-ext-reloader-mv3: specifier: ^2.1.1 - version: 2.1.1(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2)(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4)) + version: 2.1.1(webpack-cli@5.1.4(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4)) webpack-extension-manifest-plugin: specifier: ^0.8.0 version: 0.8.0 @@ -757,9 +751,6 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} - '@polka/url@1.0.0-next.24': - resolution: {integrity: sha512-2LuNTFBIO0m7kKIQvvPHN6UE63VjpmL9rnEEaOOaiSPbZK+zUOYIzBAWcED+3XYzhYsd/0mD57VdxAEqqV52CQ==} - '@remix-run/router@1.16.1': resolution: {integrity: sha512-es2g3dq6Nb07iFxGk5GuHN20RwBZOsuDQN7izWIisUcv9r+d2C5jQxqmgkdebXgReWfiyUabcki6Fg77mSNrig==} engines: {node: '>=14.0.0'} @@ -955,9 +946,6 @@ packages: '@types/webextension-polyfill@0.8.3': resolution: {integrity: sha512-GN+Hjzy9mXjWoXKmaicTegv3FJ0WFZ3aYz77Wk8TMp1IY3vEzvzj1vnsa0ggV7vMI1i+PUxe4qqnIJKCzf9aTg==} - '@types/webpack-bundle-analyzer@4.7.0': - resolution: {integrity: sha512-c5i2ThslSNSG8W891BRvOd/RoCjI2zwph8maD22b1adtSns20j+0azDDMCK06DiVrzTgnwiDl5Ntmu1YRJw8Sg==} - '@types/webpack-sources@3.2.3': resolution: {integrity: sha512-4nZOdMwSPHZ4pTEZzSp0AsTM4K7Qmu40UKW4tJDiOVs20UzYF9l+qUe4s0ftfN0pin06n+5cWWDJXH+sbhAiDw==} @@ -1599,10 +1587,6 @@ packages: resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} engines: {node: '>= 6'} - commander@7.2.0: - resolution: {integrity: sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==} - engines: {node: '>= 10'} - commander@8.3.0: resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==} engines: {node: '>= 12'} @@ -1750,9 +1734,6 @@ packages: resolution: {integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==} engines: {node: '>=0.11'} - debounce@1.2.1: - resolution: {integrity: sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==} - debug@4.3.4: resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} @@ -1894,9 +1875,6 @@ packages: dot-case@3.0.4: resolution: {integrity: sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==} - duplexer@0.1.2: - resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==} - eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} @@ -2356,10 +2334,6 @@ packages: graphemer@1.4.0: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} - gzip-size@6.0.0: - resolution: {integrity: sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==} - engines: {node: '>=10'} - har-schema@2.0.0: resolution: {integrity: sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==} engines: {node: '>=4'} @@ -3118,10 +3092,6 @@ packages: resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==} engines: {node: '>=16 || 14 >=14.17'} - mrmime@2.0.0: - resolution: {integrity: sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==} - engines: {node: '>=10'} - ms@2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} @@ -3260,10 +3230,6 @@ packages: openapi-types@12.1.3: resolution: {integrity: sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==} - opener@1.5.2: - resolution: {integrity: sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==} - hasBin: true - optionator@0.9.3: resolution: {integrity: sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==} engines: {node: '>= 0.8.0'} @@ -3870,10 +3836,6 @@ packages: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} - sirv@2.0.4: - resolution: {integrity: sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==} - engines: {node: '>= 10'} - sisteransi@1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} @@ -4105,10 +4067,6 @@ packages: resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} engines: {node: '>=0.6'} - totalist@3.0.1: - resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} - engines: {node: '>=6'} - tough-cookie@2.5.0: resolution: {integrity: sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==} engines: {node: '>=0.8'} @@ -4331,11 +4289,6 @@ packages: resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} engines: {node: '>=12'} - webpack-bundle-analyzer@4.10.2: - resolution: {integrity: sha512-vJptkMm9pk5si4Bv922ZbKLV8UTT4zib4FPgXMhgzUny0bfDDkLXAVQs3ly3fS4/TN9ROFtb0NFrm04UXFE/Vw==} - engines: {node: '>= 10.13.0'} - hasBin: true - webpack-cli@5.1.4: resolution: {integrity: sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg==} engines: {node: '>=14.15.0'} @@ -4434,18 +4387,6 @@ packages: resolution: {integrity: sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} - ws@7.5.9: - resolution: {integrity: sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==} - 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 - ws@8.16.0: resolution: {integrity: sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==} engines: {node: '>=10.0.0'} @@ -5119,8 +5060,6 @@ snapshots: '@pkgjs/parseargs@0.11.0': optional: true - '@polka/url@1.0.0-next.24': {} - '@remix-run/router@1.16.1': {} '@sinclair/typebox@0.27.8': {} @@ -5325,17 +5264,6 @@ snapshots: '@types/webextension-polyfill@0.8.3': {} - '@types/webpack-bundle-analyzer@4.7.0(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2)(webpack@5.92.0))': - dependencies: - '@types/node': 20.12.4 - tapable: 2.2.1 - webpack: 5.92.0(webpack-cli@5.1.4) - transitivePeerDependencies: - - '@swc/core' - - esbuild - - uglify-js - - webpack-cli - '@types/webpack-sources@3.2.3': dependencies: '@types/node': 20.12.4 @@ -5351,7 +5279,7 @@ snapshots: anymatch: 3.1.3 source-map: 0.6.1 - '@types/webpack@5.28.5(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2)(webpack@5.92.0))': + '@types/webpack@5.28.5(webpack-cli@5.1.4(webpack@5.92.0))': dependencies: '@types/node': 20.12.4 tapable: 2.2.1 @@ -5569,20 +5497,20 @@ snapshots: '@webassemblyjs/ast': 1.12.1 '@xtuc/long': 4.2.2 - '@webpack-cli/configtest@2.1.1(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2)(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4))': + '@webpack-cli/configtest@2.1.1(webpack-cli@5.1.4(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4))': dependencies: webpack: 5.92.0(webpack-cli@5.1.4) - webpack-cli: 5.1.4(webpack-bundle-analyzer@4.10.2)(webpack@5.92.0) + webpack-cli: 5.1.4(webpack@5.92.0) - '@webpack-cli/info@2.0.2(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2)(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4))': + '@webpack-cli/info@2.0.2(webpack-cli@5.1.4(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4))': dependencies: webpack: 5.92.0(webpack-cli@5.1.4) - webpack-cli: 5.1.4(webpack-bundle-analyzer@4.10.2)(webpack@5.92.0) + webpack-cli: 5.1.4(webpack@5.92.0) - '@webpack-cli/serve@2.0.5(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2)(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4))': + '@webpack-cli/serve@2.0.5(webpack-cli@5.1.4(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4))': dependencies: webpack: 5.92.0(webpack-cli@5.1.4) - webpack-cli: 5.1.4(webpack-bundle-analyzer@4.10.2)(webpack@5.92.0) + webpack-cli: 5.1.4(webpack@5.92.0) '@xtuc/ieee754@1.2.0': {} @@ -6124,8 +6052,6 @@ snapshots: commander@4.1.1: {} - commander@7.2.0: {} - commander@8.3.0: {} concat-map@0.0.1: {} @@ -6314,8 +6240,6 @@ snapshots: dependencies: '@babel/runtime': 7.24.4 - debounce@1.2.1: {} - debug@4.3.4: dependencies: ms: 2.1.2 @@ -6448,8 +6372,6 @@ snapshots: no-case: 3.0.4 tslib: 2.6.2 - duplexer@0.1.2: {} - eastasianwidth@0.2.0: {} ecc-jsbn@0.1.2: @@ -7111,10 +7033,6 @@ snapshots: graphemer@1.4.0: {} - gzip-size@6.0.0: - dependencies: - duplexer: 0.1.2 - har-schema@2.0.0: {} har-validator@5.1.5: @@ -8081,8 +7999,6 @@ snapshots: minipass@7.0.4: {} - mrmime@2.0.0: {} - ms@2.1.2: {} mz@2.7.0: @@ -8232,8 +8148,6 @@ snapshots: openapi-types@12.1.3: {} - opener@1.5.2: {} - optionator@0.9.3: dependencies: '@aashutoshrathi/word-wrap': 1.2.6 @@ -8811,12 +8725,6 @@ snapshots: signal-exit@4.1.0: {} - sirv@2.0.4: - dependencies: - '@polka/url': 1.0.0-next.24 - mrmime: 2.0.0 - totalist: 3.0.1 - sisteransi@1.0.5: {} slash@3.0.0: {} @@ -9087,8 +8995,6 @@ snapshots: toidentifier@1.0.1: {} - totalist@3.0.1: {} - tough-cookie@2.5.0: dependencies: psl: 1.9.0 @@ -9328,30 +9234,12 @@ snapshots: webidl-conversions@7.0.0: {} - webpack-bundle-analyzer@4.10.2: + webpack-cli@5.1.4(webpack@5.92.0): dependencies: '@discoveryjs/json-ext': 0.5.7 - acorn: 8.11.3 - acorn-walk: 8.3.2 - 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.4 - ws: 7.5.9 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - - webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2)(webpack@5.92.0): - dependencies: - '@discoveryjs/json-ext': 0.5.7 - '@webpack-cli/configtest': 2.1.1(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2)(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4)) - '@webpack-cli/info': 2.0.2(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2)(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4)) - '@webpack-cli/serve': 2.0.5(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2)(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4)) + '@webpack-cli/configtest': 2.1.1(webpack-cli@5.1.4(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4)) + '@webpack-cli/info': 2.0.2(webpack-cli@5.1.4(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4)) + '@webpack-cli/serve': 2.0.5(webpack-cli@5.1.4(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4)) colorette: 2.0.20 commander: 10.0.1 cross-spawn: 7.0.3 @@ -9362,13 +9250,11 @@ snapshots: rechoir: 0.8.0 webpack: 5.92.0(webpack-cli@5.1.4) webpack-merge: 5.10.0 - optionalDependencies: - webpack-bundle-analyzer: 4.10.2 - webpack-ext-reloader-mv3@2.1.1(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2)(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4)): + webpack-ext-reloader-mv3@2.1.1(webpack-cli@5.1.4(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4)): dependencies: '@types/webextension-polyfill': 0.8.3 - '@types/webpack': 5.28.5(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2)(webpack@5.92.0)) + '@types/webpack': 5.28.5(webpack-cli@5.1.4(webpack@5.92.0)) '@types/webpack-sources': 3.2.3 clean-webpack-plugin: 4.0.0(webpack@5.92.0(webpack-cli@5.1.4)) colors: 1.4.0 @@ -9429,7 +9315,7 @@ snapshots: watchpack: 2.4.1 webpack-sources: 3.2.3 optionalDependencies: - webpack-cli: 5.1.4(webpack-bundle-analyzer@4.10.2)(webpack@5.92.0) + webpack-cli: 5.1.4(webpack@5.92.0) transitivePeerDependencies: - '@swc/core' - esbuild @@ -9517,8 +9403,6 @@ snapshots: imurmurhash: 0.1.4 signal-exit: 3.0.7 - ws@7.5.9: {} - ws@8.16.0: {} xml-name-validator@4.0.0: {} diff --git a/scripts/profiler.ts b/scripts/profiler.ts deleted file mode 100644 index eba6b942..00000000 --- a/scripts/profiler.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* eslint-disable no-console */ -import { webpack } from 'webpack' -import { Target, callbackFn } from '../webpack/config' -import { getProfileConfig } from '../webpack/profile' - -const TARGET = (process.argv[2] as Target) || 'chrome' - -if (TARGET !== 'firefox' && TARGET !== 'chrome') { - console.log('Invalid target. Please use "chrome" or "firefox" as target.') - console.log( - 'Usage: pnpm dev , where is either "firefox" or "chrome".' - ) - process.exit(1) -} - -process.env.NODE_ENV = 'development' -const config = getProfileConfig(TARGET) - -webpack(config, callbackFn) diff --git a/src/background/services/background.ts b/src/background/services/background.ts index c778d55c..d97bbf5a 100644 --- a/src/background/services/background.ts +++ b/src/background/services/background.ts @@ -15,7 +15,7 @@ import { failure, getWalletInformation, success } from '@/shared/helpers' import { OpenPaymentsClientError } from '@interledger/open-payments/dist/client/error' import { OPEN_PAYMENTS_ERRORS } from '@/background/utils' import { TabEvents } from './tabEvents' -import { PERMISSION_HOSTS } from '@/shared/constants' +import { PERMISSION_HOSTS } from '@/shared/defines' export class Background { constructor( diff --git a/src/popup/pages/MissingHostPermission.tsx b/src/popup/pages/MissingHostPermission.tsx index a22317e1..954c37f7 100644 --- a/src/popup/pages/MissingHostPermission.tsx +++ b/src/popup/pages/MissingHostPermission.tsx @@ -1,6 +1,6 @@ import React from 'react' import browser from 'webextension-polyfill' -import { PERMISSION_HOSTS } from '@/shared/constants' +import { PERMISSION_HOSTS } from '@/shared/defines' import { WarningSign } from '@/popup/components/Icons' export const Component = () => { diff --git a/src/shared/constants.ts b/src/shared/constants.ts deleted file mode 100644 index 3c0be89a..00000000 --- a/src/shared/constants.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const PERMISSION_HOSTS = - process.env.NODE_ENV === 'production' - ? { origins: ['https://*/*'] } - : { origins: ['http://*/*', 'https://*/*'] } diff --git a/src/shared/defines.ts b/src/shared/defines.ts index 1f158c31..eda66f6a 100644 --- a/src/shared/defines.ts +++ b/src/shared/defines.ts @@ -1,5 +1,9 @@ import type { LogLevelDesc } from 'loglevel' declare const CONFIG_LOG_LEVEL: LogLevelDesc +declare const CONFIG_PERMISSION_HOSTS: { origins: string[] } +declare const CONFIG_ALLOWED_PROTOCOLS: string[] export const LOG_LEVEL = CONFIG_LOG_LEVEL +export const PERMISSION_HOSTS = CONFIG_PERMISSION_HOSTS +export const ALLOWED_PROTOCOLS = CONFIG_ALLOWED_PROTOCOLS diff --git a/webpack/dev.ts b/webpack/dev.ts index 4dbb985b..3739555d 100644 --- a/webpack/dev.ts +++ b/webpack/dev.ts @@ -40,7 +40,11 @@ export const getDevConfig = (target: Target): Configuration => { }) ], new DefinePlugin({ - CONFIG_LOG_LEVEL: JSON.stringify('DEBUG') + CONFIG_LOG_LEVEL: JSON.stringify('DEBUG'), + CONFIG_PERMISSION_HOSTS: JSON.stringify({ + origins: ['http://*/*', 'https://*/*'] + }), + CONFIG_ALLOWED_PROTOCOLS: JSON.stringify(['http:', 'https:']) }) ) } diff --git a/webpack/prod.ts b/webpack/prod.ts index f513bcf3..ed1fe7f9 100644 --- a/webpack/prod.ts +++ b/webpack/prod.ts @@ -47,7 +47,9 @@ export const getProdConfig = (target: Target): Configuration => { } }), new DefinePlugin({ - CONFIG_LOG_LEVEL: JSON.stringify('WARN') + CONFIG_LOG_LEVEL: JSON.stringify('WARN'), + CONFIG_PERMISSION_HOSTS: JSON.stringify({ origins: ['https://*/*'] }), + CONFIG_ALLOWED_PROTOCOLS: JSON.stringify(['https:']) }) ]) } diff --git a/webpack/profile.ts b/webpack/profile.ts deleted file mode 100644 index 13b54421..00000000 --- a/webpack/profile.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Configuration, DefinePlugin } from 'webpack' -import { DIRECTORIES, ROOT_DIR, mainConfig, type Target } from './config' -import path from 'node:path' -import { getMainPlugins } from './plugins' -import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer' - -export const getProfileConfig = (target: Target): Configuration => { - return { - ...mainConfig, - output: { - path: path.resolve(ROOT_DIR, `${DIRECTORIES.TEMP}/${target}`), - filename: '[name]/[name].js', - clean: true - }, - mode: 'production', - devtool: 'source-map', - stats: { - all: false, - builtAt: true, - errors: true, - hash: true - }, - plugins: getMainPlugins(DIRECTORIES.DEV, target).concat([ - new BundleAnalyzerPlugin({ - analyzerMode: 'server' - }), - new DefinePlugin({ - CONFIG_LOG_LEVEL: JSON.stringify('DEBUG') - }) - ]) - } -}