aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/src/infrastructure
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-05-25 18:40:23 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2022-05-26 15:49:18 +0200
commit8484d3262dfb4fedd8b83f65d053bc21e455008d (patch)
tree9020f95a13ddf11863b0541619dd57ca3f511104 /packages/main/src/infrastructure
parentchore(deps): bump dependencies (diff)
downloadsophie-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')
-rw-r--r--packages/main/src/infrastructure/config/ConfigRepository.ts2
-rw-r--r--packages/main/src/infrastructure/config/impl/ConfigFile.ts10
-rw-r--r--packages/main/src/infrastructure/electron/RendererBridge.ts4
-rw-r--r--packages/main/src/infrastructure/electron/__tests__/RendererBridge.test.ts4
-rw-r--r--packages/main/src/infrastructure/electron/__tests__/UserAgents.test.ts2
-rw-r--r--packages/main/src/infrastructure/electron/impl/ElectronMainWindow.ts18
-rw-r--r--packages/main/src/infrastructure/electron/impl/ElectronPartition.ts6
-rw-r--r--packages/main/src/infrastructure/electron/impl/ElectronServiceView.ts12
-rw-r--r--packages/main/src/infrastructure/electron/impl/ElectronViewFactory.ts23
-rw-r--r--packages/main/src/infrastructure/electron/impl/__tests__/electron.integ.test.ts2
-rw-r--r--packages/main/src/infrastructure/electron/impl/__tests__/hardenSession.test.ts4
-rw-r--r--packages/main/src/infrastructure/electron/impl/__tests__/lockWebContentsToFile.test.ts4
-rw-r--r--packages/main/src/infrastructure/electron/impl/electronShell.ts2
-rw-r--r--packages/main/src/infrastructure/electron/impl/hardenSession.ts4
-rw-r--r--packages/main/src/infrastructure/electron/impl/lockWebContentsToFile.ts6
-rw-r--r--packages/main/src/infrastructure/electron/impl/setApplicationMenu.ts2
-rw-r--r--packages/main/src/infrastructure/electron/types.ts6
-rw-r--r--packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.test.ts4
-rw-r--r--packages/main/src/infrastructure/resources/impl/getDistResources.ts2
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
21import type Disposer from '../../utils/Disposer'; 21import type Disposer from '../../utils/Disposer.js';
22 22
23export type ReadConfigResult = 23export 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
25import { throttle } from 'lodash-es'; 25import { throttle } from 'lodash-es';
26 26
27import type Disposer from '../../../utils/Disposer'; 27import type Disposer from '../../../utils/Disposer.js';
28import getLogger from '../../../utils/getLogger'; 28import getLogger from '../../../utils/getLogger.js';
29import isErrno from '../../../utils/isErrno'; 29import isErrno from '../../../utils/isErrno.js';
30import type ConfigRepository from '../ConfigRepository'; 30import type ConfigRepository from '../ConfigRepository.js';
31import type { ReadConfigResult } from '../ConfigRepository'; 31import type { ReadConfigResult } from '../ConfigRepository.js';
32 32
33const log = getLogger('ConfigFile'); 33const 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
29import type MainStore from '../../stores/MainStore'; 29import type MainStore from '../../stores/MainStore.js';
30import Disposer from '../../utils/Disposer'; 30import Disposer from '../../utils/Disposer.js';
31 31
32export type PatchListener = (patch: IJsonPatch[]) => void; 32export 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
33import MainStore from '../../../stores/MainStore'; 33import MainStore from '../../../stores/MainStore.js';
34import RendererBridge, { type PatchListener } from '../RendererBridge'; 34import RendererBridge, { type PatchListener } from '../RendererBridge.js';
35 35
36const TestStore = MainStore.actions((theSelf) => ({ 36const 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
21import UserAgents from '../UserAgents'; 21import UserAgents from '../UserAgents.js';
22 22
23let userAgents: UserAgents; 23let 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 {
27import { BrowserWindow, ipcMain, IpcMainEvent } from 'electron'; 27import { BrowserWindow, ipcMain, IpcMainEvent } from 'electron';
28import type { IJsonPatch } from 'mobx-state-tree'; 28import type { IJsonPatch } from 'mobx-state-tree';
29 29
30import type MainStore from '../../../stores/MainStore'; 30import type MainStore from '../../../stores/MainStore.js';
31import getLogger from '../../../utils/getLogger'; 31import getLogger from '../../../utils/getLogger.js';
32import RendererBridge from '../RendererBridge'; 32import RendererBridge from '../RendererBridge.js';
33import type { MainWindow, ServiceView } from '../types'; 33import type { MainWindow, ServiceView } from '../types.js';
34 34
35import ElectronServiceView from './ElectronServiceView'; 35import ElectronServiceView from './ElectronServiceView.js';
36import type ElectronViewFactory from './ElectronViewFactory'; 36import type ElectronViewFactory from './ElectronViewFactory.js';
37import { openDevToolsWhenReady } from './devTools'; 37import { openDevToolsWhenReady } from './devTools.js';
38import lockWebContentsToFile from './lockWebContentsToFile'; 38import lockWebContentsToFile from './lockWebContentsToFile.js';
39 39
40const log = getLogger('ElectronMainWindow'); 40const 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
21import { Session, session } from 'electron'; 21import { Session, session } from 'electron';
22 22
23import type Profile from '../../../stores/Profile'; 23import type Profile from '../../../stores/Profile.js';
24import type { Partition } from '../types'; 24import type { Partition } from '../types.js';
25 25
26import type ElectronViewFactory from './ElectronViewFactory'; 26import type ElectronViewFactory from './ElectronViewFactory.js';
27 27
28export default class ElectronPartition implements Partition { 28export 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
21import { BrowserView } from 'electron'; 21import { BrowserView } from 'electron';
22 22
23import type Service from '../../../stores/Service'; 23import type Service from '../../../stores/Service.js';
24import getLogger from '../../../utils/getLogger'; 24import getLogger from '../../../utils/getLogger.js';
25import type Resources from '../../resources/Resources'; 25import type Resources from '../../resources/Resources.js';
26import type { ServiceView } from '../types'; 26import type { ServiceView } from '../types.js';
27 27
28import ElectronPartition from './ElectronPartition'; 28import ElectronPartition from './ElectronPartition.js';
29import type ElectronViewFactory from './ElectronViewFactory'; 29import type ElectronViewFactory from './ElectronViewFactory.js';
30 30
31const log = getLogger('ElectronServiceView'); 31const 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
21import type MainStore from '../../../stores/MainStore'; 21import type MainStore from '../../../stores/MainStore.js';
22import type Profile from '../../../stores/Profile'; 22import type Profile from '../../../stores/Profile.js';
23import type Service from '../../../stores/Service'; 23import type Service from '../../../stores/Service.js';
24import type Resources from '../../resources/Resources'; 24import type Resources from '../../resources/Resources.js';
25import type UserAgents from '../UserAgents'; 25import type UserAgents from '../UserAgents.js';
26import type { MainWindow, Partition, ServiceView, ViewFactory } from '../types'; 26import type {
27 MainWindow,
28 Partition,
29 ServiceView,
30 ViewFactory,
31} from '../types.js';
27 32
28import ElectronMainWindow from './ElectronMainWindow'; 33import ElectronMainWindow from './ElectronMainWindow.js';
29import ElectronPartition from './ElectronPartition'; 34import ElectronPartition from './ElectronPartition.js';
30import ElectronServiceView from './ElectronServiceView'; 35import ElectronServiceView from './ElectronServiceView.js';
31 36
32export default class ElectronViewFactory implements ViewFactory { 37export 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 @@
1import { BrowserWindow } from 'electron'; 1import { BrowserWindow } from 'electron';
2 2
3import '../ElectronMainWindow'; 3import '../ElectronMainWindow.js';
4 4
5test('create a BrowserWindow', async () => { 5test('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
33import type Resources from '../../../resources/Resources'; 33import type Resources from '../../../resources/Resources.js';
34import hardenSession from '../hardenSession'; 34import hardenSession from '../hardenSession.js';
35 35
36const permissions = [ 36const 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';
25import type { Event, HandlerDetails, WebContents } from 'electron'; 25import type { Event, HandlerDetails, WebContents } from 'electron';
26import { mocked } from 'jest-mock'; 26import { mocked } from 'jest-mock';
27 27
28import type Resources from '../../../resources/Resources'; 28import type Resources from '../../../resources/Resources.js';
29import lockWebContentsToFile from '../lockWebContentsToFile'; 29import lockWebContentsToFile from '../lockWebContentsToFile.js';
30 30
31type WillNavigateHandler = (event: Event, url: string) => void; 31type 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';
23import { app, dialog, shell } from 'electron'; 23import { app, dialog, shell } from 'electron';
24import { getLogger } from 'loglevel'; 24import { getLogger } from 'loglevel';
25 25
26import type MainEnv from '../../../stores/MainEnv'; 26import type MainEnv from '../../../stores/MainEnv.js';
27 27
28const log = getLogger('ElectronShell'); 28const 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
23import type { Session } from 'electron'; 23import type { Session } from 'electron';
24 24
25import getLogger from '../../../utils/getLogger'; 25import getLogger from '../../../utils/getLogger.js';
26import type Resources from '../../resources/Resources'; 26import 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
21import type { WebContents } from 'electron'; 21import type { WebContents } from 'electron';
22 22
23import getLogger from '../../../utils/getLogger'; 23import getLogger from '../../../utils/getLogger.js';
24import isErrno from '../../../utils/isErrno'; 24import isErrno from '../../../utils/isErrno.js';
25import type Resources from '../../resources/Resources'; 25import type Resources from '../../resources/Resources.js';
26 26
27const log = getLogger('lockWebContentsToFile'); 27const 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';
22import { autorun } from 'mobx'; 22import { autorun } from 'mobx';
23import { addDisposer } from 'mobx-state-tree'; 23import { addDisposer } from 'mobx-state-tree';
24 24
25import type MainStore from '../../../stores/MainStore'; 25import type MainStore from '../../../stores/MainStore.js';
26 26
27export default function setApplicationMenu( 27export 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
21import type MainStore from '../../stores/MainStore'; 21import type MainStore from '../../stores/MainStore.js';
22import type Profile from '../../stores/Profile'; 22import type Profile from '../../stores/Profile.js';
23import type Service from '../../stores/Service'; 23import type Service from '../../stores/Service.js';
24 24
25export interface ViewFactory { 25export 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
21import os from 'node:os'; 21import os from 'node:os';
22 22
23import Resources from '../../Resources'; 23import Resources from '../../Resources.js';
24import getDistResources from '../getDistResources'; 24import getDistResources from '../getDistResources.js';
25 25
26const defaultDevServerURL = 'http://localhost:3000/'; 26const 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 @@
21import path from 'node:path'; 21import path from 'node:path';
22import { pathToFileURL, URL } from 'node:url'; 22import { pathToFileURL, URL } from 'node:url';
23 23
24import Resources from '../Resources'; 24import Resources from '../Resources.js';
25 25
26export default function getDistResources( 26export default function getDistResources(
27 devMode: boolean, 27 devMode: boolean,