diff --git a/developer-notes.md b/developer-notes.md index 1345e052..53c7c732 100644 --- a/developer-notes.md +++ b/developer-notes.md @@ -118,8 +118,8 @@ Links: ### Keep dependencies up to date - ffmpeg -- electron -- package.json +- `electron`, `@electron/remote` and upgrade [electron.vite.config.ts](./electron.vite.config.ts) `target`s. +- `package.json` ### i18n `yarn scan-i18n` diff --git a/electron.vite.config.ts b/electron.vite.config.ts index 29a703cd..8bb10f1d 100644 --- a/electron.vite.config.ts +++ b/electron.vite.config.ts @@ -9,7 +9,7 @@ export default defineConfig({ // However, until we use ESM for electron main, we need to include ESM-only deps in the bundle: (exclude from externalize) plugins: [externalizeDepsPlugin({ exclude: ['p-map', 'execa', 'nanoid'] })], build: { - target: 'node18.17', + target: 'node20.14', sourcemap: true, }, }, @@ -17,14 +17,14 @@ export default defineConfig({ // https://electron-vite.org/guide/dev#dependencies-vs-devdependencies plugins: [externalizeDepsPlugin({ exclude: [] })], build: { - target: 'node18.17', + target: 'node20.14', sourcemap: true, }, }, renderer: { plugins: [react()], build: { - target: 'chrome118', + target: 'chrome126', sourcemap: true, chunkSizeWarningLimit: 3e6, }, diff --git a/package.json b/package.json index b69dae22..6ef46f55 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "csv-parse": "^4.15.3", "csv-stringify": "^5.6.2", "data-uri-to-buffer": "^4.0.0", - "electron": "^27.0.0", + "electron": "^31.3.1", "electron-builder": "^24.6.4", "electron-devtools-installer": "^3.2.0", "electron-vite": "^2.3.0", @@ -124,11 +124,11 @@ "vitest": "^2.0.3" }, "dependencies": { - "@electron/remote": "^2.0.10", + "@electron/remote": "^2.1.2", "@octokit/core": "5", "cue-parser": "^0.3.0", "electron-store": "5.1.1", - "electron-unhandled": "^4.0.1", + "electron-unhandled": "^5.0.0", "execa": "^8.0.1", "express": "^4.19.2", "express-async-handler": "^1.2.0", diff --git a/src/main/index.ts b/src/main/index.ts index 21f8a058..fa3c57c2 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -4,7 +4,6 @@ process.traceProcessWarnings = true; /* eslint-disable import/first */ // eslint-disable-next-line import/no-extraneous-dependencies import electron, { AboutPanelOptionsOptions, BrowserWindow, BrowserWindowConstructorOptions, nativeTheme, shell, app, ipcMain } from 'electron'; -import unhandled from 'electron-unhandled'; import i18n from 'i18next'; import debounce from 'lodash/debounce'; import yargsParser from 'yargs-parser'; @@ -42,6 +41,17 @@ export { isLinux, isWindows, isMac, platform } from './util.js'; export { pathToFileURL } from 'node:url'; +const electronUnhandled = import('electron-unhandled'); + +// eslint-disable-next-line unicorn/prefer-top-level-await +(async () => { + try { + (await electronUnhandled).default({ showDialog: true, logger: (err) => logger.error('electron-unhandled', err) }); + } catch (err) { + logger.error(err); + } +})(); + // https://www.i18next.com/overview/typescript#argument-of-type-defaulttfuncreturn-is-not-assignable-to-parameter-of-type-xyz // todo This should not be necessary anymore since v23.0.0 declare module 'i18next' { @@ -60,10 +70,6 @@ app.commandLine.appendSwitch('enable-blink-features', 'AudioVideoTracks'); remote.initialize(); -unhandled({ - showDialog: true, -}); - const appVersion = app.getVersion(); diff --git a/yarn.lock b/yarn.lock index 61e594e1..b527b77d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -412,12 +412,12 @@ __metadata: languageName: node linkType: hard -"@electron/remote@npm:^2.0.10": - version: 2.0.10 - resolution: "@electron/remote@npm:2.0.10" +"@electron/remote@npm:^2.1.2": + version: 2.1.2 + resolution: "@electron/remote@npm:2.1.2" peerDependencies: electron: ">= 13.0.0" - checksum: 61b2ca95f850d431b95a51da460d50507137156b428795445546ef97439d7ed27e76c6f12ce659a1c1858d7564a9d306ac3e996cb7d416ed300b903abba77c57 + checksum: c0fa92fb30ca0dab600513b17f648a935b3e9718516d446d65590ac98a8765e0a8d20c5c6714069a164b52a32f0f07cee87a23ff8ee65197f69d0151679ac291 languageName: node linkType: hard @@ -2101,7 +2101,7 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*, @types/node@npm:18, @types/node@npm:^18.11.18": +"@types/node@npm:*, @types/node@npm:18": version: 18.19.21 resolution: "@types/node@npm:18.19.21" dependencies: @@ -2110,6 +2110,15 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:^20.9.0": + version: 20.14.14 + resolution: "@types/node@npm:20.14.14" + dependencies: + undici-types: "npm:~5.26.4" + checksum: 035bc347e3de04888d537801e23eb4b4f99522975ca002dbfef978edd853710031b7cd43bf022670d6aba4ed5d4ac75ea1b5ff77ff8f80998bffd943b7bcef48 + languageName: node + linkType: hard + "@types/normalize-package-data@npm:^2.4.0": version: 2.4.4 resolution: "@types/normalize-package-data@npm:2.4.4" @@ -3531,7 +3540,7 @@ __metadata: languageName: node linkType: hard -"clean-stack@npm:^2.0.0, clean-stack@npm:^2.1.0": +"clean-stack@npm:^2.0.0": version: 2.2.0 resolution: "clean-stack@npm:2.2.0" checksum: 2ac8cd2b2f5ec986a3c743935ec85b07bc174d5421a5efc8017e1f146a1cf5f781ae962618f416352103b32c9cd7e203276e8c28241bbe946160cab16149fb68 @@ -3547,6 +3556,15 @@ __metadata: languageName: node linkType: hard +"clean-stack@npm:^5.2.0": + version: 5.2.0 + resolution: "clean-stack@npm:5.2.0" + dependencies: + escape-string-regexp: "npm:5.0.0" + checksum: 9b16c9d56ef673b1666030d04afc5a382c7ec6b5fb8df2dd361090c3ac79273695d6db9867938bb3268903dcebf401e2c6034b2f56f27673f6032b5e89217b81 + languageName: node + linkType: hard + "cli-truncate@npm:^2.1.0": version: 2.1.0 resolution: "cli-truncate@npm:2.1.0" @@ -4431,10 +4449,10 @@ __metadata: languageName: node linkType: hard -"electron-is-dev@npm:^2.0.0": - version: 2.0.0 - resolution: "electron-is-dev@npm:2.0.0" - checksum: 7393f46f06153d70a427ea904c60a092e50fbf1015c26c342cebb8324ada8c9e0c0f1f02867af56d9cc76f47be17da8cb311ea6bdc83343e7ebd2323ec4014c8 +"electron-is-dev@npm:^3.0.1": + version: 3.0.1 + resolution: "electron-is-dev@npm:3.0.1" + checksum: 0f3bb1ebac00ab25d541a5e6b2ba9c6cdbcb0875782bffd1b0a7e8d303f837669580febfc696f1ce2b0f79cc4bc529dd71f0bf4da5d934492003c9a9b833ec22 languageName: node linkType: hard @@ -4470,16 +4488,16 @@ __metadata: languageName: node linkType: hard -"electron-unhandled@npm:^4.0.1": - version: 4.0.1 - resolution: "electron-unhandled@npm:4.0.1" +"electron-unhandled@npm:^5.0.0": + version: 5.0.0 + resolution: "electron-unhandled@npm:5.0.0" dependencies: - clean-stack: "npm:^2.1.0" - electron-is-dev: "npm:^2.0.0" - ensure-error: "npm:^2.0.0" + clean-stack: "npm:^5.2.0" + electron-is-dev: "npm:^3.0.1" + ensure-error: "npm:^4.0.0" lodash.debounce: "npm:^4.0.8" - serialize-error: "npm:^8.1.0" - checksum: 64874ef2f2a681a7a4c2f98be7bf0365c02d31ebf0adaef03f5a68a22bff6db3a22be66aef7a21b85c949f8c05647dd31b15d92fb73c0ff22e2e845c5a2a9db9 + serialize-error: "npm:^11.0.3" + checksum: df576bf54b715c57d1fd88195c984e5d3a8284983acf2e17dc132d36249d762709bd350c3d543be6bd3fdceff84ad8e813db1c39c01d0c70699290ace1a09cf2 languageName: node linkType: hard @@ -4505,16 +4523,16 @@ __metadata: languageName: node linkType: hard -"electron@npm:^27.0.0": - version: 27.0.0 - resolution: "electron@npm:27.0.0" +"electron@npm:^31.3.1": + version: 31.3.1 + resolution: "electron@npm:31.3.1" dependencies: "@electron/get": "npm:^2.0.0" - "@types/node": "npm:^18.11.18" + "@types/node": "npm:^20.9.0" extract-zip: "npm:^2.0.1" bin: electron: cli.js - checksum: 486057738b20ec65a7ac9b30d615f94311a6b8ea900f94d1c6668c4e48bb6c9371a9131ee4349a3247031c292f97b8aa85448ec8e95b6998200a28bafe4aa6c2 + checksum: bc6e582c2a6ad9a95eeff71a24b2f798b88ce33dae1cae9e02fcb81f058463c502210a8eb0b9a061c82223060159ac69c141386f689ce2f52818f96fefc827c9 languageName: node linkType: hard @@ -4564,10 +4582,10 @@ __metadata: languageName: node linkType: hard -"ensure-error@npm:^2.0.0": - version: 2.1.0 - resolution: "ensure-error@npm:2.1.0" - checksum: a24852103e9f39cb20ccd5b014d2657425fb786356da3ddc19a4842354430002847f1efeafd14c798e9ee62f644be1986b2b60c9eb1c73f335d1a6dea5bda71a +"ensure-error@npm:^4.0.0": + version: 4.0.0 + resolution: "ensure-error@npm:4.0.0" + checksum: 1670fadfa44162b198970f6336a77a5277e6eb3299c5d9760ea7ca20817b9c11c4714c49cfb9ec99e00d7a2a40cf8d819cb814974c7468668113f470e910d322 languageName: node linkType: hard @@ -7603,7 +7621,7 @@ __metadata: resolution: "lossless-cut@workspace:." dependencies: "@adamscybot/react-leaflet-component-marker": "npm:^2.0.0" - "@electron/remote": "npm:^2.0.10" + "@electron/remote": "npm:^2.1.2" "@fontsource/open-sans": "npm:^4.5.14" "@octokit/core": "npm:5" "@radix-ui/colors": "npm:^0.1.8" @@ -7635,11 +7653,11 @@ __metadata: csv-stringify: "npm:^5.6.2" cue-parser: "npm:^0.3.0" data-uri-to-buffer: "npm:^4.0.0" - electron: "npm:^27.0.0" + electron: "npm:^31.3.1" electron-builder: "npm:^24.6.4" electron-devtools-installer: "npm:^3.2.0" electron-store: "npm:5.1.1" - electron-unhandled: "npm:^4.0.1" + electron-unhandled: "npm:^5.0.0" electron-vite: "npm:^2.3.0" eslint: "npm:^8.2.0" eslint-config-mifi: "npm:^0.0.3" @@ -9945,6 +9963,15 @@ __metadata: languageName: node linkType: hard +"serialize-error@npm:^11.0.3": + version: 11.0.3 + resolution: "serialize-error@npm:11.0.3" + dependencies: + type-fest: "npm:^2.12.2" + checksum: 5fe19e120e9ad8488c0abe27517e60da75bd65f56ae1cb48d8524e013d0e07f18bb9d05eca72898c5244e1168576f3131f29145c9f785e735e10742ee9c86c08 + languageName: node + linkType: hard + "serialize-error@npm:^7.0.1": version: 7.0.1 resolution: "serialize-error@npm:7.0.1" @@ -9954,15 +9981,6 @@ __metadata: languageName: node linkType: hard -"serialize-error@npm:^8.1.0": - version: 8.1.0 - resolution: "serialize-error@npm:8.1.0" - dependencies: - type-fest: "npm:^0.20.2" - checksum: 2eef236d50edd2d7926e602c14fb500dc3a125ee52e9f08f67033181b8e0be5d1122498bdf7c23c80683cddcad083a27974e9e7111ce23165f4d3bcdd6d65102 - languageName: node - linkType: hard - "serve-static@npm:1.15.0": version: 1.15.0 resolution: "serve-static@npm:1.15.0" @@ -11035,6 +11053,13 @@ __metadata: languageName: node linkType: hard +"type-fest@npm:^2.12.2": + version: 2.19.0 + resolution: "type-fest@npm:2.19.0" + checksum: 7bf9e8fdf34f92c8bb364c0af14ca875fac7e0183f2985498b77be129dc1b3b1ad0a6b3281580f19e48c6105c037fb966ad9934520c69c6434d17fd0af4eed78 + languageName: node + linkType: hard + "type-fest@npm:^4.10.3, type-fest@npm:^4.23.0": version: 4.23.0 resolution: "type-fest@npm:4.23.0"