diff options
author | Kristóf Marussy <kristof@marussy.com> | 2022-05-25 18:40:23 +0200 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2022-05-26 15:49:18 +0200 |
commit | 8484d3262dfb4fedd8b83f65d053bc21e455008d (patch) | |
tree | 9020f95a13ddf11863b0541619dd57ca3f511104 /packages/main/src/infrastructure | |
parent | chore(deps): bump dependencies (diff) | |
download | sophie-8484d3262dfb4fedd8b83f65d053bc21e455008d.tar.gz sophie-8484d3262dfb4fedd8b83f65d053bc21e455008d.tar.zst sophie-8484d3262dfb4fedd8b83f65d053bc21e455008d.zip |
chore: use node16 moduleResolution where possible
We can't do this in the renderer package, because we need to import MUI
files that are not exported (MUI v6 is not ESM yet).
Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'packages/main/src/infrastructure')
19 files changed, 61 insertions, 56 deletions
diff --git a/packages/main/src/infrastructure/config/ConfigRepository.ts b/packages/main/src/infrastructure/config/ConfigRepository.ts index 67bffb0..7d5e12b 100644 --- a/packages/main/src/infrastructure/config/ConfigRepository.ts +++ b/packages/main/src/infrastructure/config/ConfigRepository.ts | |||
@@ -18,7 +18,7 @@ | |||
18 | * SPDX-License-Identifier: AGPL-3.0-only | 18 | * SPDX-License-Identifier: AGPL-3.0-only |
19 | */ | 19 | */ |
20 | 20 | ||
21 | import type Disposer from '../../utils/Disposer'; | 21 | import type Disposer from '../../utils/Disposer.js'; |
22 | 22 | ||
23 | export type ReadConfigResult = | 23 | export type ReadConfigResult = |
24 | | { found: true; contents: string } | 24 | | { found: true; contents: string } |
diff --git a/packages/main/src/infrastructure/config/impl/ConfigFile.ts b/packages/main/src/infrastructure/config/impl/ConfigFile.ts index 6203c89..684a827 100644 --- a/packages/main/src/infrastructure/config/impl/ConfigFile.ts +++ b/packages/main/src/infrastructure/config/impl/ConfigFile.ts | |||
@@ -24,11 +24,11 @@ import path from 'node:path'; | |||
24 | 24 | ||
25 | import { throttle } from 'lodash-es'; | 25 | import { throttle } from 'lodash-es'; |
26 | 26 | ||
27 | import type Disposer from '../../../utils/Disposer'; | 27 | import type Disposer from '../../../utils/Disposer.js'; |
28 | import getLogger from '../../../utils/getLogger'; | 28 | import getLogger from '../../../utils/getLogger.js'; |
29 | import isErrno from '../../../utils/isErrno'; | 29 | import isErrno from '../../../utils/isErrno.js'; |
30 | import type ConfigRepository from '../ConfigRepository'; | 30 | import type ConfigRepository from '../ConfigRepository.js'; |
31 | import type { ReadConfigResult } from '../ConfigRepository'; | 31 | import type { ReadConfigResult } from '../ConfigRepository.js'; |
32 | 32 | ||
33 | const log = getLogger('ConfigFile'); | 33 | const log = getLogger('ConfigFile'); |
34 | 34 | ||
diff --git a/packages/main/src/infrastructure/electron/RendererBridge.ts b/packages/main/src/infrastructure/electron/RendererBridge.ts index 097580a..921f09a 100644 --- a/packages/main/src/infrastructure/electron/RendererBridge.ts +++ b/packages/main/src/infrastructure/electron/RendererBridge.ts | |||
@@ -26,8 +26,8 @@ import { | |||
26 | onPatch, | 26 | onPatch, |
27 | } from 'mobx-state-tree'; | 27 | } from 'mobx-state-tree'; |
28 | 28 | ||
29 | import type MainStore from '../../stores/MainStore'; | 29 | import type MainStore from '../../stores/MainStore.js'; |
30 | import Disposer from '../../utils/Disposer'; | 30 | import Disposer from '../../utils/Disposer.js'; |
31 | 31 | ||
32 | export type PatchListener = (patch: IJsonPatch[]) => void; | 32 | export type PatchListener = (patch: IJsonPatch[]) => void; |
33 | 33 | ||
diff --git a/packages/main/src/infrastructure/electron/__tests__/RendererBridge.test.ts b/packages/main/src/infrastructure/electron/__tests__/RendererBridge.test.ts index b7c8a76..e29429d 100644 --- a/packages/main/src/infrastructure/electron/__tests__/RendererBridge.test.ts +++ b/packages/main/src/infrastructure/electron/__tests__/RendererBridge.test.ts | |||
@@ -30,8 +30,8 @@ import { | |||
30 | unprotect, | 30 | unprotect, |
31 | } from 'mobx-state-tree'; | 31 | } from 'mobx-state-tree'; |
32 | 32 | ||
33 | import MainStore from '../../../stores/MainStore'; | 33 | import MainStore from '../../../stores/MainStore.js'; |
34 | import RendererBridge, { type PatchListener } from '../RendererBridge'; | 34 | import RendererBridge, { type PatchListener } from '../RendererBridge.js'; |
35 | 35 | ||
36 | const TestStore = MainStore.actions((theSelf) => ({ | 36 | const TestStore = MainStore.actions((theSelf) => ({ |
37 | /** | 37 | /** |
diff --git a/packages/main/src/infrastructure/electron/__tests__/UserAgents.test.ts b/packages/main/src/infrastructure/electron/__tests__/UserAgents.test.ts index d963704..0c6dd1c 100644 --- a/packages/main/src/infrastructure/electron/__tests__/UserAgents.test.ts +++ b/packages/main/src/infrastructure/electron/__tests__/UserAgents.test.ts | |||
@@ -18,7 +18,7 @@ | |||
18 | * SPDX-License-Identifier: AGPL-3.0-only | 18 | * SPDX-License-Identifier: AGPL-3.0-only |
19 | */ | 19 | */ |
20 | 20 | ||
21 | import UserAgents from '../UserAgents'; | 21 | import UserAgents from '../UserAgents.js'; |
22 | 22 | ||
23 | let userAgents: UserAgents; | 23 | let userAgents: UserAgents; |
24 | 24 | ||
diff --git a/packages/main/src/infrastructure/electron/impl/ElectronMainWindow.ts b/packages/main/src/infrastructure/electron/impl/ElectronMainWindow.ts index 20a1f70..c4b3823 100644 --- a/packages/main/src/infrastructure/electron/impl/ElectronMainWindow.ts +++ b/packages/main/src/infrastructure/electron/impl/ElectronMainWindow.ts | |||
@@ -27,15 +27,15 @@ import { | |||
27 | import { BrowserWindow, ipcMain, IpcMainEvent } from 'electron'; | 27 | import { BrowserWindow, ipcMain, IpcMainEvent } from 'electron'; |
28 | import type { IJsonPatch } from 'mobx-state-tree'; | 28 | import type { IJsonPatch } from 'mobx-state-tree'; |
29 | 29 | ||
30 | import type MainStore from '../../../stores/MainStore'; | 30 | import type MainStore from '../../../stores/MainStore.js'; |
31 | import getLogger from '../../../utils/getLogger'; | 31 | import getLogger from '../../../utils/getLogger.js'; |
32 | import RendererBridge from '../RendererBridge'; | 32 | import RendererBridge from '../RendererBridge.js'; |
33 | import type { MainWindow, ServiceView } from '../types'; | 33 | import type { MainWindow, ServiceView } from '../types.js'; |
34 | 34 | ||
35 | import ElectronServiceView from './ElectronServiceView'; | 35 | import ElectronServiceView from './ElectronServiceView.js'; |
36 | import type ElectronViewFactory from './ElectronViewFactory'; | 36 | import type ElectronViewFactory from './ElectronViewFactory.js'; |
37 | import { openDevToolsWhenReady } from './devTools'; | 37 | import { openDevToolsWhenReady } from './devTools.js'; |
38 | import lockWebContentsToFile from './lockWebContentsToFile'; | 38 | import lockWebContentsToFile from './lockWebContentsToFile.js'; |
39 | 39 | ||
40 | const log = getLogger('ElectronMainWindow'); | 40 | const log = getLogger('ElectronMainWindow'); |
41 | 41 | ||
diff --git a/packages/main/src/infrastructure/electron/impl/ElectronPartition.ts b/packages/main/src/infrastructure/electron/impl/ElectronPartition.ts index e60ce21..d1220c5 100644 --- a/packages/main/src/infrastructure/electron/impl/ElectronPartition.ts +++ b/packages/main/src/infrastructure/electron/impl/ElectronPartition.ts | |||
@@ -20,10 +20,10 @@ | |||
20 | 20 | ||
21 | import { Session, session } from 'electron'; | 21 | import { Session, session } from 'electron'; |
22 | 22 | ||
23 | import type Profile from '../../../stores/Profile'; | 23 | import type Profile from '../../../stores/Profile.js'; |
24 | import type { Partition } from '../types'; | 24 | import type { Partition } from '../types.js'; |
25 | 25 | ||
26 | import type ElectronViewFactory from './ElectronViewFactory'; | 26 | import type ElectronViewFactory from './ElectronViewFactory.js'; |
27 | 27 | ||
28 | export default class ElectronPartition implements Partition { | 28 | export default class ElectronPartition implements Partition { |
29 | readonly id: string; | 29 | readonly id: string; |
diff --git a/packages/main/src/infrastructure/electron/impl/ElectronServiceView.ts b/packages/main/src/infrastructure/electron/impl/ElectronServiceView.ts index a9298bd..91247c8 100644 --- a/packages/main/src/infrastructure/electron/impl/ElectronServiceView.ts +++ b/packages/main/src/infrastructure/electron/impl/ElectronServiceView.ts | |||
@@ -20,13 +20,13 @@ | |||
20 | 20 | ||
21 | import { BrowserView } from 'electron'; | 21 | import { BrowserView } from 'electron'; |
22 | 22 | ||
23 | import type Service from '../../../stores/Service'; | 23 | import type Service from '../../../stores/Service.js'; |
24 | import getLogger from '../../../utils/getLogger'; | 24 | import getLogger from '../../../utils/getLogger.js'; |
25 | import type Resources from '../../resources/Resources'; | 25 | import type Resources from '../../resources/Resources.js'; |
26 | import type { ServiceView } from '../types'; | 26 | import type { ServiceView } from '../types.js'; |
27 | 27 | ||
28 | import ElectronPartition from './ElectronPartition'; | 28 | import ElectronPartition from './ElectronPartition.js'; |
29 | import type ElectronViewFactory from './ElectronViewFactory'; | 29 | import type ElectronViewFactory from './ElectronViewFactory.js'; |
30 | 30 | ||
31 | const log = getLogger('ElectronServiceView'); | 31 | const log = getLogger('ElectronServiceView'); |
32 | 32 | ||
diff --git a/packages/main/src/infrastructure/electron/impl/ElectronViewFactory.ts b/packages/main/src/infrastructure/electron/impl/ElectronViewFactory.ts index c72860d..df3de85 100644 --- a/packages/main/src/infrastructure/electron/impl/ElectronViewFactory.ts +++ b/packages/main/src/infrastructure/electron/impl/ElectronViewFactory.ts | |||
@@ -18,16 +18,21 @@ | |||
18 | * SPDX-License-Identifier: AGPL-3.0-only | 18 | * SPDX-License-Identifier: AGPL-3.0-only |
19 | */ | 19 | */ |
20 | 20 | ||
21 | import type MainStore from '../../../stores/MainStore'; | 21 | import type MainStore from '../../../stores/MainStore.js'; |
22 | import type Profile from '../../../stores/Profile'; | 22 | import type Profile from '../../../stores/Profile.js'; |
23 | import type Service from '../../../stores/Service'; | 23 | import type Service from '../../../stores/Service.js'; |
24 | import type Resources from '../../resources/Resources'; | 24 | import type Resources from '../../resources/Resources.js'; |
25 | import type UserAgents from '../UserAgents'; | 25 | import type UserAgents from '../UserAgents.js'; |
26 | import type { MainWindow, Partition, ServiceView, ViewFactory } from '../types'; | 26 | import type { |
27 | MainWindow, | ||
28 | Partition, | ||
29 | ServiceView, | ||
30 | ViewFactory, | ||
31 | } from '../types.js'; | ||
27 | 32 | ||
28 | import ElectronMainWindow from './ElectronMainWindow'; | 33 | import ElectronMainWindow from './ElectronMainWindow.js'; |
29 | import ElectronPartition from './ElectronPartition'; | 34 | import ElectronPartition from './ElectronPartition.js'; |
30 | import ElectronServiceView from './ElectronServiceView'; | 35 | import ElectronServiceView from './ElectronServiceView.js'; |
31 | 36 | ||
32 | export default class ElectronViewFactory implements ViewFactory { | 37 | export default class ElectronViewFactory implements ViewFactory { |
33 | private readonly webContentsIdToServiceView = new Map< | 38 | private readonly webContentsIdToServiceView = new Map< |
diff --git a/packages/main/src/infrastructure/electron/impl/__tests__/electron.integ.test.ts b/packages/main/src/infrastructure/electron/impl/__tests__/electron.integ.test.ts index 67cf689..75b12ac 100644 --- a/packages/main/src/infrastructure/electron/impl/__tests__/electron.integ.test.ts +++ b/packages/main/src/infrastructure/electron/impl/__tests__/electron.integ.test.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { BrowserWindow } from 'electron'; | 1 | import { BrowserWindow } from 'electron'; |
2 | 2 | ||
3 | import '../ElectronMainWindow'; | 3 | import '../ElectronMainWindow.js'; |
4 | 4 | ||
5 | test('create a BrowserWindow', async () => { | 5 | test('create a BrowserWindow', async () => { |
6 | const w = new BrowserWindow(); | 6 | const w = new BrowserWindow(); |
diff --git a/packages/main/src/infrastructure/electron/impl/__tests__/hardenSession.test.ts b/packages/main/src/infrastructure/electron/impl/__tests__/hardenSession.test.ts index 7b70d10..bbbd675 100644 --- a/packages/main/src/infrastructure/electron/impl/__tests__/hardenSession.test.ts +++ b/packages/main/src/infrastructure/electron/impl/__tests__/hardenSession.test.ts | |||
@@ -30,8 +30,8 @@ import type { | |||
30 | WebContents, | 30 | WebContents, |
31 | } from 'electron'; | 31 | } from 'electron'; |
32 | 32 | ||
33 | import type Resources from '../../../resources/Resources'; | 33 | import type Resources from '../../../resources/Resources.js'; |
34 | import hardenSession from '../hardenSession'; | 34 | import hardenSession from '../hardenSession.js'; |
35 | 35 | ||
36 | const permissions = [ | 36 | const permissions = [ |
37 | 'clipboard-read', | 37 | 'clipboard-read', |
diff --git a/packages/main/src/infrastructure/electron/impl/__tests__/lockWebContentsToFile.test.ts b/packages/main/src/infrastructure/electron/impl/__tests__/lockWebContentsToFile.test.ts index 47525d3..6332db7 100644 --- a/packages/main/src/infrastructure/electron/impl/__tests__/lockWebContentsToFile.test.ts +++ b/packages/main/src/infrastructure/electron/impl/__tests__/lockWebContentsToFile.test.ts | |||
@@ -25,8 +25,8 @@ import { fake } from '@sophie/test-utils'; | |||
25 | import type { Event, HandlerDetails, WebContents } from 'electron'; | 25 | import type { Event, HandlerDetails, WebContents } from 'electron'; |
26 | import { mocked } from 'jest-mock'; | 26 | import { mocked } from 'jest-mock'; |
27 | 27 | ||
28 | import type Resources from '../../../resources/Resources'; | 28 | import type Resources from '../../../resources/Resources.js'; |
29 | import lockWebContentsToFile from '../lockWebContentsToFile'; | 29 | import lockWebContentsToFile from '../lockWebContentsToFile.js'; |
30 | 30 | ||
31 | type WillNavigateHandler = (event: Event, url: string) => void; | 31 | type WillNavigateHandler = (event: Event, url: string) => void; |
32 | 32 | ||
diff --git a/packages/main/src/infrastructure/electron/impl/electronShell.ts b/packages/main/src/infrastructure/electron/impl/electronShell.ts index f7f7001..da246c0 100644 --- a/packages/main/src/infrastructure/electron/impl/electronShell.ts +++ b/packages/main/src/infrastructure/electron/impl/electronShell.ts | |||
@@ -23,7 +23,7 @@ import { writeFile } from 'node:fs/promises'; | |||
23 | import { app, dialog, shell } from 'electron'; | 23 | import { app, dialog, shell } from 'electron'; |
24 | import { getLogger } from 'loglevel'; | 24 | import { getLogger } from 'loglevel'; |
25 | 25 | ||
26 | import type MainEnv from '../../../stores/MainEnv'; | 26 | import type MainEnv from '../../../stores/MainEnv.js'; |
27 | 27 | ||
28 | const log = getLogger('ElectronShell'); | 28 | const log = getLogger('ElectronShell'); |
29 | 29 | ||
diff --git a/packages/main/src/infrastructure/electron/impl/hardenSession.ts b/packages/main/src/infrastructure/electron/impl/hardenSession.ts index fc358a1..0574146 100644 --- a/packages/main/src/infrastructure/electron/impl/hardenSession.ts +++ b/packages/main/src/infrastructure/electron/impl/hardenSession.ts | |||
@@ -22,8 +22,8 @@ import { URL } from 'node:url'; | |||
22 | 22 | ||
23 | import type { Session } from 'electron'; | 23 | import type { Session } from 'electron'; |
24 | 24 | ||
25 | import getLogger from '../../../utils/getLogger'; | 25 | import getLogger from '../../../utils/getLogger.js'; |
26 | import type Resources from '../../resources/Resources'; | 26 | import type Resources from '../../resources/Resources.js'; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * URL prefixes Sophie is allowed load in dev mode. | 29 | * URL prefixes Sophie is allowed load in dev mode. |
diff --git a/packages/main/src/infrastructure/electron/impl/lockWebContentsToFile.ts b/packages/main/src/infrastructure/electron/impl/lockWebContentsToFile.ts index da40a56..338c845 100644 --- a/packages/main/src/infrastructure/electron/impl/lockWebContentsToFile.ts +++ b/packages/main/src/infrastructure/electron/impl/lockWebContentsToFile.ts | |||
@@ -20,9 +20,9 @@ | |||
20 | 20 | ||
21 | import type { WebContents } from 'electron'; | 21 | import type { WebContents } from 'electron'; |
22 | 22 | ||
23 | import getLogger from '../../../utils/getLogger'; | 23 | import getLogger from '../../../utils/getLogger.js'; |
24 | import isErrno from '../../../utils/isErrno'; | 24 | import isErrno from '../../../utils/isErrno.js'; |
25 | import type Resources from '../../resources/Resources'; | 25 | import type Resources from '../../resources/Resources.js'; |
26 | 26 | ||
27 | const log = getLogger('lockWebContentsToFile'); | 27 | const log = getLogger('lockWebContentsToFile'); |
28 | 28 | ||
diff --git a/packages/main/src/infrastructure/electron/impl/setApplicationMenu.ts b/packages/main/src/infrastructure/electron/impl/setApplicationMenu.ts index 32b2d4d..7e45401 100644 --- a/packages/main/src/infrastructure/electron/impl/setApplicationMenu.ts +++ b/packages/main/src/infrastructure/electron/impl/setApplicationMenu.ts | |||
@@ -22,7 +22,7 @@ import { Menu, MenuItemConstructorOptions } from 'electron'; | |||
22 | import { autorun } from 'mobx'; | 22 | import { autorun } from 'mobx'; |
23 | import { addDisposer } from 'mobx-state-tree'; | 23 | import { addDisposer } from 'mobx-state-tree'; |
24 | 24 | ||
25 | import type MainStore from '../../../stores/MainStore'; | 25 | import type MainStore from '../../../stores/MainStore.js'; |
26 | 26 | ||
27 | export default function setApplicationMenu( | 27 | export default function setApplicationMenu( |
28 | store: MainStore, | 28 | store: MainStore, |
diff --git a/packages/main/src/infrastructure/electron/types.ts b/packages/main/src/infrastructure/electron/types.ts index 92ca9ad..608a342 100644 --- a/packages/main/src/infrastructure/electron/types.ts +++ b/packages/main/src/infrastructure/electron/types.ts | |||
@@ -18,9 +18,9 @@ | |||
18 | * SPDX-License-Identifier: AGPL-3.0-only | 18 | * SPDX-License-Identifier: AGPL-3.0-only |
19 | */ | 19 | */ |
20 | 20 | ||
21 | import type MainStore from '../../stores/MainStore'; | 21 | import type MainStore from '../../stores/MainStore.js'; |
22 | import type Profile from '../../stores/Profile'; | 22 | import type Profile from '../../stores/Profile.js'; |
23 | import type Service from '../../stores/Service'; | 23 | import type Service from '../../stores/Service.js'; |
24 | 24 | ||
25 | export interface ViewFactory { | 25 | export interface ViewFactory { |
26 | createMainWindow(store: MainStore): Promise<MainWindow>; | 26 | createMainWindow(store: MainStore): Promise<MainWindow>; |
diff --git a/packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.test.ts b/packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.test.ts index 649536b..c7c6e22 100644 --- a/packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.test.ts +++ b/packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.test.ts | |||
@@ -20,8 +20,8 @@ | |||
20 | 20 | ||
21 | import os from 'node:os'; | 21 | import os from 'node:os'; |
22 | 22 | ||
23 | import Resources from '../../Resources'; | 23 | import Resources from '../../Resources.js'; |
24 | import getDistResources from '../getDistResources'; | 24 | import getDistResources from '../getDistResources.js'; |
25 | 25 | ||
26 | const defaultDevServerURL = 'http://localhost:3000/'; | 26 | const defaultDevServerURL = 'http://localhost:3000/'; |
27 | 27 | ||
diff --git a/packages/main/src/infrastructure/resources/impl/getDistResources.ts b/packages/main/src/infrastructure/resources/impl/getDistResources.ts index 3c1ffb3..3b7827c 100644 --- a/packages/main/src/infrastructure/resources/impl/getDistResources.ts +++ b/packages/main/src/infrastructure/resources/impl/getDistResources.ts | |||
@@ -21,7 +21,7 @@ | |||
21 | import path from 'node:path'; | 21 | import path from 'node:path'; |
22 | import { pathToFileURL, URL } from 'node:url'; | 22 | import { pathToFileURL, URL } from 'node:url'; |
23 | 23 | ||
24 | import Resources from '../Resources'; | 24 | import Resources from '../Resources.js'; |
25 | 25 | ||
26 | export default function getDistResources( | 26 | export default function getDistResources( |
27 | devMode: boolean, | 27 | devMode: boolean, |