From 06c6b8c5af9cc2240403053222d3eaaf99509c2a Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Wed, 1 May 2024 22:14:28 +0700 Subject: [PATCH] Simplify import paths again --- src/index.ts | 58 ++++++++++++++--------------- src/macros/build.ts | 2 +- src/modules/dialog.ts | 4 +- src/modules/loading-screen.ts | 10 ++--- src/modules/mkb/mkb-handler.ts | 20 +++++----- src/modules/mkb/mkb-preset.ts | 4 +- src/modules/mkb/mkb-remapper.ts | 14 +++---- src/modules/patcher.ts | 10 ++--- src/modules/remote-play.ts | 16 ++++---- src/modules/screenshot.ts | 4 +- src/modules/stream/stream-badges.ts | 8 ++-- src/modules/stream/stream-stats.ts | 14 +++---- src/modules/stream/stream-ui.ts | 10 ++--- src/modules/touch-controller.ts | 18 ++++----- src/modules/ui/global-settings.ts | 12 +++--- src/modules/ui/header.ts | 12 +++--- src/modules/ui/ui.ts | 22 +++++------ src/modules/vibration-manager.ts | 6 +-- src/types/mkb.d.ts | 2 +- src/utils/bx-event.ts | 2 +- src/utils/bx-exposed.ts | 8 ++-- src/utils/css.ts | 6 +-- src/utils/gamepad.ts | 10 ++--- src/utils/history.ts | 8 ++-- src/utils/html.ts | 24 ++++++------ src/utils/local-db.ts | 6 +-- src/utils/monkey-patches.ts | 10 ++--- src/utils/network.ts | 18 ++++----- src/utils/preferences.ts | 12 +++--- src/utils/region.ts | 4 +- src/utils/settings.ts | 2 +- src/utils/titles-info.ts | 4 +- src/utils/toast.ts | 2 +- src/utils/user-agent.ts | 2 +- src/utils/utils.ts | 6 +-- tsconfig.json | 6 ++- 36 files changed, 190 insertions(+), 186 deletions(-) diff --git a/src/index.ts b/src/index.ts index 9fd5608..70e0ce1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,32 +1,32 @@ -import "@/utils/global"; -import { BxEvent } from "@/utils/bx-event"; -import { BX_FLAGS } from "@/utils/bx-flags"; -import { BxExposed } from "@/utils/bx-exposed"; -import { t } from "@/utils/translation"; -import { interceptHttpRequests } from "@/utils/network"; -import { CE } from "@/utils/html"; -import { showGamepadToast } from "@/utils/gamepad"; -import { MkbHandler } from "@/modules/mkb/mkb-handler"; -import { StreamBadges } from "@/modules/stream/stream-badges"; -import { StreamStats } from "@/modules/stream/stream-stats"; -import { addCss } from "@/utils/css"; -import { Toast } from "@/utils/toast"; -import { setupBxUi, updateVideoPlayerCss } from "@/modules/ui/ui"; -import { PrefKey, getPref } from "@/utils/preferences"; -import { LoadingScreen } from "@/modules/loading-screen"; -import { MouseCursorHider } from "@/modules/mkb/mouse-cursor-hider"; -import { TouchController } from "@/modules/touch-controller"; -import { watchHeader } from "@/modules/ui/header"; -import { checkForUpdate, disablePwa } from "@/utils/utils"; -import { Patcher } from "@/modules/patcher"; -import { RemotePlay } from "@/modules/remote-play"; -import { onHistoryChanged, patchHistoryMethod } from "@/utils/history"; -import { VibrationManager } from "@/modules/vibration-manager"; -import { PreloadedState } from "@/utils/titles-info"; -import { patchAudioContext, patchRtcCodecs, patchRtcPeerConnection, patchVideoApi } from "@/utils/monkey-patches"; -import { STATES } from "@/utils/global"; -import { injectStreamMenuButtons } from "@/modules/stream/stream-ui"; -import { BxLogger } from "@/utils/bx-logger"; +import "@utils/global"; +import { BxEvent } from "@utils/bx-event"; +import { BX_FLAGS } from "@utils/bx-flags"; +import { BxExposed } from "@utils/bx-exposed"; +import { t } from "@utils/translation"; +import { interceptHttpRequests } from "@utils/network"; +import { CE } from "@utils/html"; +import { showGamepadToast } from "@utils/gamepad"; +import { MkbHandler } from "@modules/mkb/mkb-handler"; +import { StreamBadges } from "@modules/stream/stream-badges"; +import { StreamStats } from "@modules/stream/stream-stats"; +import { addCss } from "@utils/css"; +import { Toast } from "@utils/toast"; +import { setupBxUi, updateVideoPlayerCss } from "@modules/ui/ui"; +import { PrefKey, getPref } from "@utils/preferences"; +import { LoadingScreen } from "@modules/loading-screen"; +import { MouseCursorHider } from "@modules/mkb/mouse-cursor-hider"; +import { TouchController } from "@modules/touch-controller"; +import { watchHeader } from "@modules/ui/header"; +import { checkForUpdate, disablePwa } from "@utils/utils"; +import { Patcher } from "@modules/patcher"; +import { RemotePlay } from "@modules/remote-play"; +import { onHistoryChanged, patchHistoryMethod } from "@utils/history"; +import { VibrationManager } from "@modules/vibration-manager"; +import { PreloadedState } from "@utils/titles-info"; +import { patchAudioContext, patchRtcCodecs, patchRtcPeerConnection, patchVideoApi } from "@utils/monkey-patches"; +import { STATES } from "@utils/global"; +import { injectStreamMenuButtons } from "@modules/stream/stream-ui"; +import { BxLogger } from "@utils/bx-logger"; // Handle login page if (window.location.pathname.includes('/auth/msa')) { diff --git a/src/macros/build.ts b/src/macros/build.ts index 4270d6e..ef31386 100644 --- a/src/macros/build.ts +++ b/src/macros/build.ts @@ -1,7 +1,7 @@ import stylus from 'stylus'; // @ts-ignore -import cssStr from "@/assets/css/styles.styl" with { type: "text" }; +import cssStr from "@assets/css/styles.styl" with { type: "text" }; const generatedCss = await (stylus(cssStr, {}) .set('filename', 'styles.css') diff --git a/src/modules/dialog.ts b/src/modules/dialog.ts index 125d6bb..5972eab 100644 --- a/src/modules/dialog.ts +++ b/src/modules/dialog.ts @@ -1,5 +1,5 @@ -import { t } from "@/utils/translation"; -import { CE, createButton, ButtonStyle, Icon } from "@/utils/html"; +import { t } from "@utils/translation"; +import { CE, createButton, ButtonStyle, Icon } from "@utils/html"; type DialogOptions = { title?: string; diff --git a/src/modules/loading-screen.ts b/src/modules/loading-screen.ts index 7f25447..08f9503 100644 --- a/src/modules/loading-screen.ts +++ b/src/modules/loading-screen.ts @@ -1,8 +1,8 @@ -import { CE } from "@/utils/html"; -import { getPreferredServerRegion } from "@/utils/region"; -import { PrefKey, getPref } from "@/utils/preferences"; -import { t } from "@/utils/translation"; -import { STATES } from "@/utils/global"; +import { CE } from "@utils/html"; +import { getPreferredServerRegion } from "@utils/region"; +import { PrefKey, getPref } from "@utils/preferences"; +import { t } from "@utils/translation"; +import { STATES } from "@utils/global"; export class LoadingScreen { static #$bgStyle: HTMLElement; diff --git a/src/modules/mkb/mkb-handler.ts b/src/modules/mkb/mkb-handler.ts index aceb6af..eb3bb80 100644 --- a/src/modules/mkb/mkb-handler.ts +++ b/src/modules/mkb/mkb-handler.ts @@ -1,17 +1,17 @@ import { MkbPreset } from "./mkb-preset"; import { GamepadKey, MkbPresetKey, GamepadStick, MouseMapTo } from "./definitions"; -import { createButton, Icon, ButtonStyle, CE } from "@/utils/html"; -import { BxEvent } from "@/utils/bx-event"; -import { PrefKey, getPref } from "@/utils/preferences"; -import { Toast } from "@/utils/toast"; -import { t } from "@/utils/translation"; -import { LocalDb } from "@/utils/local-db"; +import { createButton, Icon, ButtonStyle, CE } from "@utils/html"; +import { BxEvent } from "@utils/bx-event"; +import { PrefKey, getPref } from "@utils/preferences"; +import { Toast } from "@utils/toast"; +import { t } from "@utils/translation"; +import { LocalDb } from "@utils/local-db"; import { KeyHelper } from "./key-helper"; import type { MkbStoredPreset } from "@/types/mkb"; -import { showStreamSettings } from "@/modules/stream/stream-ui"; -import { STATES } from "@/utils/global"; -import { UserAgent } from "@/utils/user-agent"; -import { BxLogger } from "@/utils/bx-logger"; +import { showStreamSettings } from "@modules/stream/stream-ui"; +import { STATES } from "@utils/global"; +import { UserAgent } from "@utils/user-agent"; +import { BxLogger } from "@utils/bx-logger"; const LOG_TAG = 'MkbHandler'; diff --git a/src/modules/mkb/mkb-preset.ts b/src/modules/mkb/mkb-preset.ts index 2f9882d..67a6dcb 100644 --- a/src/modules/mkb/mkb-preset.ts +++ b/src/modules/mkb/mkb-preset.ts @@ -1,5 +1,5 @@ -import { t } from "@/utils/translation"; -import { SettingElementType } from "@/utils/settings"; +import { t } from "@utils/translation"; +import { SettingElementType } from "@utils/settings"; import { GamepadKey, MouseButtonCode, MouseMapTo, MkbPresetKey } from "./definitions"; import { MkbHandler } from "./mkb-handler"; import type { MkbPresetData, MkbConvertedPresetData } from "@/types/mkb"; diff --git a/src/modules/mkb/mkb-remapper.ts b/src/modules/mkb/mkb-remapper.ts index c3e947f..583325e 100644 --- a/src/modules/mkb/mkb-remapper.ts +++ b/src/modules/mkb/mkb-remapper.ts @@ -1,15 +1,15 @@ import { GamepadKey } from "./definitions"; -import { CE, createButton, ButtonStyle } from "@/utils/html"; -import { t } from "@/utils/translation"; -import { Dialog } from "@/modules/dialog"; -import { getPref, setPref, PrefKey } from "@/utils/preferences"; +import { CE, createButton, ButtonStyle } from "@utils/html"; +import { t } from "@utils/translation"; +import { Dialog } from "@modules/dialog"; +import { getPref, setPref, PrefKey } from "@utils/preferences"; import { MkbPresetKey, GamepadKeyName } from "./definitions"; import { KeyHelper } from "./key-helper"; import { MkbPreset } from "./mkb-preset"; import { MkbHandler } from "./mkb-handler"; -import { LocalDb } from "@/utils/local-db"; -import { Icon } from "@/utils/html"; -import { SettingElement } from "@/utils/settings"; +import { LocalDb } from "@utils/local-db"; +import { Icon } from "@utils/html"; +import { SettingElement } from "@utils/settings"; import type { MkbPresetData, MkbStoredPresets } from "@/types/mkb"; diff --git a/src/modules/patcher.ts b/src/modules/patcher.ts index 84e0806..1521024 100644 --- a/src/modules/patcher.ts +++ b/src/modules/patcher.ts @@ -1,8 +1,8 @@ -import { STATES } from "@/utils/global"; -import { BX_FLAGS } from "@/utils/bx-flags"; -import { getPref, PrefKey } from "@/utils/preferences"; -import { VibrationManager } from "@/modules/vibration-manager"; -import { BxLogger } from "@/utils/bx-logger"; +import { STATES } from "@utils/global"; +import { BX_FLAGS } from "@utils/bx-flags"; +import { getPref, PrefKey } from "@utils/preferences"; +import { VibrationManager } from "@modules/vibration-manager"; +import { BxLogger } from "@utils/bx-logger"; const LOG_TAG = 'Patcher'; diff --git a/src/modules/remote-play.ts b/src/modules/remote-play.ts index 8fee9cb..9bba6c9 100644 --- a/src/modules/remote-play.ts +++ b/src/modules/remote-play.ts @@ -1,11 +1,11 @@ -import { STATES, AppInterface } from "@/utils/global"; -import { CE, createButton, ButtonStyle, Icon } from "@/utils/html"; -import { Toast } from "@/utils/toast"; -import { BxEvent } from "@/utils/bx-event"; -import { getPref, PrefKey, setPref } from "@/utils/preferences"; -import { t } from "@/utils/translation"; -import { localRedirect } from "@/modules/ui/ui"; -import { BxLogger } from "@/utils/bx-logger"; +import { STATES, AppInterface } from "@utils/global"; +import { CE, createButton, ButtonStyle, Icon } from "@utils/html"; +import { Toast } from "@utils/toast"; +import { BxEvent } from "@utils/bx-event"; +import { getPref, PrefKey, setPref } from "@utils/preferences"; +import { t } from "@utils/translation"; +import { localRedirect } from "@modules/ui/ui"; +import { BxLogger } from "@utils/bx-logger"; const LOG_TAG = 'RemotePlay'; diff --git a/src/modules/screenshot.ts b/src/modules/screenshot.ts index c4a9845..26d1d9d 100644 --- a/src/modules/screenshot.ts +++ b/src/modules/screenshot.ts @@ -1,5 +1,5 @@ -import { STATES, AppInterface } from "@/utils/global"; -import { CE } from "@/utils/html"; +import { STATES, AppInterface } from "@utils/global"; +import { CE } from "@utils/html"; export function takeScreenshot(callback: any) { const currentStream = STATES.currentStream!; diff --git a/src/modules/stream/stream-badges.ts b/src/modules/stream/stream-badges.ts index a773e28..8c1f1f3 100644 --- a/src/modules/stream/stream-badges.ts +++ b/src/modules/stream/stream-badges.ts @@ -1,7 +1,7 @@ -import { t } from "@/utils/translation"; -import { BxEvent } from "@/utils/bx-event"; -import { CE } from "@/utils/html"; -import { STATES } from "@/utils/global"; +import { t } from "@utils/translation"; +import { BxEvent } from "@utils/bx-event"; +import { CE } from "@utils/html"; +import { STATES } from "@utils/global"; enum StreamBadge { PLAYTIME = 'playtime', diff --git a/src/modules/stream/stream-stats.ts b/src/modules/stream/stream-stats.ts index 76d2070..7a6dc4d 100644 --- a/src/modules/stream/stream-stats.ts +++ b/src/modules/stream/stream-stats.ts @@ -1,11 +1,11 @@ -import { PrefKey } from "@/utils/preferences" -import { BxEvent } from "@/utils/bx-event" -import { getPref } from "@/utils/preferences" +import { PrefKey } from "@utils/preferences" +import { BxEvent } from "@utils/bx-event" +import { getPref } from "@utils/preferences" import { StreamBadges } from "./stream-badges" -import { CE } from "@/utils/html" -import { t } from "@/utils/translation" -import { STATES } from "@/utils/global" -import { BxLogger } from "@/utils/bx-logger" +import { CE } from "@utils/html" +import { t } from "@utils/translation" +import { STATES } from "@utils/global" +import { BxLogger } from "@utils/bx-logger" export enum StreamStat { PING = 'ping', diff --git a/src/modules/stream/stream-ui.ts b/src/modules/stream/stream-ui.ts index a977057..be21dff 100644 --- a/src/modules/stream/stream-ui.ts +++ b/src/modules/stream/stream-ui.ts @@ -1,8 +1,8 @@ -import { STATES } from "@/utils/global.ts"; -import { Icon, createSvgIcon } from "@/utils/html.ts"; -import { BxEvent } from "@/utils/bx-event.ts"; -import { PrefKey, getPref } from "@/utils/preferences.ts"; -import { t } from "@/utils/translation.ts"; +import { STATES } from "@utils/global.ts"; +import { Icon, createSvgIcon } from "@utils/html.ts"; +import { BxEvent } from "@utils/bx-event.ts"; +import { PrefKey, getPref } from "@utils/preferences.ts"; +import { t } from "@utils/translation.ts"; import { StreamBadges } from "./stream-badges.ts"; import { StreamStats } from "./stream-stats.ts"; diff --git a/src/modules/touch-controller.ts b/src/modules/touch-controller.ts index 75f2344..84a2c5f 100644 --- a/src/modules/touch-controller.ts +++ b/src/modules/touch-controller.ts @@ -1,12 +1,12 @@ -import { STATES } from "@/utils/global"; -import { CE } from "@/utils/html"; -import { Toast } from "@/utils/toast"; -import { BxEvent } from "@/utils/bx-event"; -import { BX_FLAGS } from "@/utils/bx-flags"; -import { getPref, PrefKey } from "@/utils/preferences"; -import { t } from "@/utils/translation"; -import { NATIVE_FETCH } from "@/utils/network"; -import { BxLogger } from "@/utils/bx-logger"; +import { STATES } from "@utils/global"; +import { CE } from "@utils/html"; +import { Toast } from "@utils/toast"; +import { BxEvent } from "@utils/bx-event"; +import { BX_FLAGS } from "@utils/bx-flags"; +import { getPref, PrefKey } from "@utils/preferences"; +import { t } from "@utils/translation"; +import { NATIVE_FETCH } from "@utils/network"; +import { BxLogger } from "@utils/bx-logger"; const LOG_TAG = 'TouchController'; diff --git a/src/modules/ui/global-settings.ts b/src/modules/ui/global-settings.ts index 8a9e3a5..f82a536 100644 --- a/src/modules/ui/global-settings.ts +++ b/src/modules/ui/global-settings.ts @@ -1,9 +1,9 @@ -import { STATES, AppInterface, SCRIPT_HOME, SCRIPT_VERSION } from "@/utils/global"; -import { CE, createButton, Icon, ButtonStyle } from "@/utils/html"; -import { getPreferredServerRegion } from "@/utils/region"; -import { UserAgent, UserAgentProfile } from "@/utils/user-agent"; -import { getPref, Preferences, PrefKey, setPref, toPrefElement } from "@/utils/preferences"; -import { t, refreshCurrentLocale } from "@/utils/translation"; +import { STATES, AppInterface, SCRIPT_HOME, SCRIPT_VERSION } from "@utils/global"; +import { CE, createButton, Icon, ButtonStyle } from "@utils/html"; +import { getPreferredServerRegion } from "@utils/region"; +import { UserAgent, UserAgentProfile } from "@utils/user-agent"; +import { getPref, Preferences, PrefKey, setPref, toPrefElement } from "@utils/preferences"; +import { t, refreshCurrentLocale } from "@utils/translation"; const SETTINGS_UI = { 'Better xCloud': { diff --git a/src/modules/ui/header.ts b/src/modules/ui/header.ts index 848d203..3c30fef 100644 --- a/src/modules/ui/header.ts +++ b/src/modules/ui/header.ts @@ -1,9 +1,9 @@ -import { SCRIPT_VERSION } from "@/utils/global"; -import { createButton, Icon, ButtonStyle } from "@/utils/html"; -import { getPreferredServerRegion } from "@/utils/region"; -import { PrefKey, getPref } from "@/utils/preferences"; -import { RemotePlay } from "@/modules/remote-play"; -import { t } from "@/utils/translation"; +import { SCRIPT_VERSION } from "@utils/global"; +import { createButton, Icon, ButtonStyle } from "@utils/html"; +import { getPreferredServerRegion } from "@utils/region"; +import { PrefKey, getPref } from "@utils/preferences"; +import { RemotePlay } from "@modules/remote-play"; +import { t } from "@utils/translation"; import { setupSettingsUi } from "./global-settings"; diff --git a/src/modules/ui/ui.ts b/src/modules/ui/ui.ts index 3102b2f..c583650 100644 --- a/src/modules/ui/ui.ts +++ b/src/modules/ui/ui.ts @@ -1,14 +1,14 @@ -import { STATES } from "@/utils/global"; -import { Icon, CE, createButton, ButtonStyle, createSvgIcon } from "@/utils/html"; -import { UserAgent } from "@/utils/user-agent"; -import { BxEvent } from "@/utils/bx-event"; -import { MkbRemapper } from "@/modules/mkb/mkb-remapper"; -import { getPref, PrefKey, toPrefElement } from "@/utils/preferences"; -import { setupScreenshotButton } from "@/modules/screenshot"; -import { StreamStats } from "@/modules/stream/stream-stats"; -import { TouchController } from "@/modules/touch-controller"; -import { t } from "@/utils/translation"; -import { VibrationManager } from "@/modules/vibration-manager"; +import { STATES } from "@utils/global"; +import { Icon, CE, createButton, ButtonStyle, createSvgIcon } from "@utils/html"; +import { UserAgent } from "@utils/user-agent"; +import { BxEvent } from "@utils/bx-event"; +import { MkbRemapper } from "@modules/mkb/mkb-remapper"; +import { getPref, PrefKey, toPrefElement } from "@utils/preferences"; +import { setupScreenshotButton } from "@modules/screenshot"; +import { StreamStats } from "@modules/stream/stream-stats"; +import { TouchController } from "@modules/touch-controller"; +import { t } from "@utils/translation"; +import { VibrationManager } from "@modules/vibration-manager"; export function localRedirect(path: string) { diff --git a/src/modules/vibration-manager.ts b/src/modules/vibration-manager.ts index 4bb6aa5..baf91c6 100644 --- a/src/modules/vibration-manager.ts +++ b/src/modules/vibration-manager.ts @@ -1,6 +1,6 @@ -import { AppInterface } from "@/utils/global"; -import { BxEvent } from "@/utils/bx-event"; -import { PrefKey, getPref } from "@/utils/preferences"; +import { AppInterface } from "@utils/global"; +import { BxEvent } from "@utils/bx-event"; +import { PrefKey, getPref } from "@utils/preferences"; const VIBRATION_DATA_MAP = { 'gamepadIndex': 8, diff --git a/src/types/mkb.d.ts b/src/types/mkb.d.ts index 38a7322..228e969 100644 --- a/src/types/mkb.d.ts +++ b/src/types/mkb.d.ts @@ -1,4 +1,4 @@ -import { MkbPresetKey } from "@/modules/mkb/definitions"; +import { MkbPresetKey } from "@modules/mkb/definitions"; type GamepadKeyNameType = {[index: string | number]: string[]}; diff --git a/src/utils/bx-event.ts b/src/utils/bx-event.ts index 20d00fb..6264dbe 100644 --- a/src/utils/bx-event.ts +++ b/src/utils/bx-event.ts @@ -1,4 +1,4 @@ -import { AppInterface } from "./global"; +import { AppInterface } from "@utils/global"; export enum BxEvent { JUMP_BACK_IN_READY = 'bx-jump-back-in-ready', diff --git a/src/utils/bx-exposed.ts b/src/utils/bx-exposed.ts index 7b6e2d1..eb9874c 100644 --- a/src/utils/bx-exposed.ts +++ b/src/utils/bx-exposed.ts @@ -1,7 +1,7 @@ -import { BxEvent } from "./bx-event"; -import { STATES } from "./global"; -import { getPref, PrefKey } from "./preferences"; -import { UserAgent } from "./user-agent"; +import { BxEvent } from "@utils/bx-event"; +import { STATES } from "@utils/global"; +import { getPref, PrefKey } from "@utils/preferences"; +import { UserAgent } from "@utils/user-agent"; enum InputType { CONTROLLER = 'Controller', diff --git a/src/utils/css.ts b/src/utils/css.ts index 00b8161..ed39a0c 100644 --- a/src/utils/css.ts +++ b/src/utils/css.ts @@ -1,6 +1,6 @@ -import { CE } from "./html"; -import { PrefKey, getPref } from "./preferences"; -import { renderStylus } from "@/macros/build" with {type: "macro"}; +import { CE } from "@utils/html"; +import { PrefKey, getPref } from "@utils/preferences"; +import { renderStylus } from "@macros/build" with {type: "macro"}; export function addCss() { diff --git a/src/utils/gamepad.ts b/src/utils/gamepad.ts index cb804f2..c5823aa 100644 --- a/src/utils/gamepad.ts +++ b/src/utils/gamepad.ts @@ -1,8 +1,8 @@ -import { MkbHandler } from "@/modules/mkb/mkb-handler"; -import { PrefKey, getPref } from "./preferences"; -import { t } from "./translation"; -import { Toast } from "./toast"; -import { BxLogger } from "./bx-logger"; +import { MkbHandler } from "@modules/mkb/mkb-handler"; +import { PrefKey, getPref } from "@utils/preferences"; +import { t } from "@utils/translation"; +import { Toast } from "@utils/toast"; +import { BxLogger } from "@utils/bx-logger"; // Show a toast when connecting/disconecting controller export function showGamepadToast(gamepad: Gamepad) { diff --git a/src/utils/history.ts b/src/utils/history.ts index fa1b661..e1e7694 100644 --- a/src/utils/history.ts +++ b/src/utils/history.ts @@ -1,7 +1,7 @@ -import { BxEvent } from "./bx-event"; -import { LoadingScreen } from "@/modules/loading-screen"; -import { RemotePlay } from "@/modules/remote-play"; -import { checkHeader } from "@/modules/ui/header"; +import { BxEvent } from "@utils/bx-event"; +import { LoadingScreen } from "@modules/loading-screen"; +import { RemotePlay } from "@modules/remote-play"; +import { checkHeader } from "@modules/ui/header"; export function patchHistoryMethod(type: 'pushState' | 'replaceState') { const orig = window.history[type]; diff --git a/src/utils/html.ts b/src/utils/html.ts index da83c98..be8bd0c 100644 --- a/src/utils/html.ts +++ b/src/utils/html.ts @@ -1,27 +1,27 @@ // @ts-ignore -import iconController from "@/assets/svg/controller.svg" with { type: "text" }; +import iconController from "@assets/svg/controller.svg" with { type: "text" }; // @ts-ignore -import iconCopy from "@/assets/svg/copy.svg" with { type: "text" }; +import iconCopy from "@assets/svg/copy.svg" with { type: "text" }; // @ts-ignore -import iconCursorText from "@/assets/svg/cursor-text.svg" with { type: "text" }; +import iconCursorText from "@assets/svg/cursor-text.svg" with { type: "text" }; // @ts-ignore -import iconDisplay from "@/assets/svg/display.svg" with { type: "text" }; +import iconDisplay from "@assets/svg/display.svg" with { type: "text" }; // @ts-ignore -import iconMouseSettings from "@/assets/svg/mouse-settings.svg" with { type: "text" }; +import iconMouseSettings from "@assets/svg/mouse-settings.svg" with { type: "text" }; // @ts-ignore -import iconMouse from "@/assets/svg/mouse.svg" with { type: "text" }; +import iconMouse from "@assets/svg/mouse.svg" with { type: "text" }; // @ts-ignore -import iconNew from "@/assets/svg/new.svg" with { type: "text" }; +import iconNew from "@assets/svg/new.svg" with { type: "text" }; // @ts-ignore -import iconQuestion from "@/assets/svg/question.svg" with { type: "text" }; +import iconQuestion from "@assets/svg/question.svg" with { type: "text" }; // @ts-ignore -import iconRemotePlay from "@/assets/svg/remote-play.svg" with { type: "text" }; +import iconRemotePlay from "@assets/svg/remote-play.svg" with { type: "text" }; // @ts-ignore -import iconStreamSettings from "@/assets/svg/stream-settings.svg" with { type: "text" }; +import iconStreamSettings from "@assets/svg/stream-settings.svg" with { type: "text" }; // @ts-ignore -import iconStreamStats from "@/assets/svg/stream-stats.svg" with { type: "text" }; +import iconStreamStats from "@assets/svg/stream-stats.svg" with { type: "text" }; // @ts-ignore -import iconTrash from "@/assets/svg/trash.svg" with { type: "text" }; +import iconTrash from "@assets/svg/trash.svg" with { type: "text" }; type BxButton = { diff --git a/src/utils/local-db.ts b/src/utils/local-db.ts index f0e6f76..24944cf 100644 --- a/src/utils/local-db.ts +++ b/src/utils/local-db.ts @@ -1,6 +1,6 @@ -import { MkbPreset } from "@/modules/mkb/mkb-preset"; -import { PrefKey, setPref } from "./preferences"; -import { t } from "./translation"; +import { MkbPreset } from "@modules/mkb/mkb-preset"; +import { PrefKey, setPref } from "@utils/preferences"; +import { t } from "@utils/translation"; import type { MkbStoredPreset, MkbStoredPresets } from "@/types/mkb"; export class LocalDb { diff --git a/src/utils/monkey-patches.ts b/src/utils/monkey-patches.ts index ae8c4c0..b725886 100644 --- a/src/utils/monkey-patches.ts +++ b/src/utils/monkey-patches.ts @@ -1,8 +1,8 @@ -import { BxEvent } from "./bx-event"; -import { getPref, PrefKey } from "./preferences"; -import { STATES } from "./global"; -import { UserAgent } from "./user-agent"; -import { BxLogger } from "./bx-logger"; +import { BxEvent } from "@utils/bx-event"; +import { getPref, PrefKey } from "@utils/preferences"; +import { STATES } from "@utils/global"; +import { UserAgent } from "@utils/user-agent"; +import { BxLogger } from "@utils/bx-logger"; export function patchVideoApi() { const PREF_SKIP_SPLASH_VIDEO = getPref(PrefKey.SKIP_SPLASH_VIDEO); diff --git a/src/utils/network.ts b/src/utils/network.ts index e7432ff..12fadcd 100644 --- a/src/utils/network.ts +++ b/src/utils/network.ts @@ -1,12 +1,12 @@ -import { BxEvent } from "@/utils/bx-event"; -import { BX_FLAGS } from "@/utils/bx-flags"; -import { LoadingScreen } from "@/modules/loading-screen"; -import { PrefKey, getPref } from "@/utils/preferences"; -import { RemotePlay } from "@/modules/remote-play"; -import { StreamBadges } from "@/modules/stream/stream-badges"; -import { TouchController } from "@/modules/touch-controller"; -import { STATES } from "@/utils/global"; -import { getPreferredServerRegion } from "@/utils/region"; +import { BxEvent } from "@utils/bx-event"; +import { BX_FLAGS } from "@utils/bx-flags"; +import { LoadingScreen } from "@modules/loading-screen"; +import { PrefKey, getPref } from "@utils/preferences"; +import { RemotePlay } from "@modules/remote-play"; +import { StreamBadges } from "@modules/stream/stream-badges"; +import { TouchController } from "@modules/touch-controller"; +import { STATES } from "@utils/global"; +import { getPreferredServerRegion } from "@utils/region"; export const NATIVE_FETCH = window.fetch; diff --git a/src/utils/preferences.ts b/src/utils/preferences.ts index af2b8ba..5c37fbb 100644 --- a/src/utils/preferences.ts +++ b/src/utils/preferences.ts @@ -1,10 +1,10 @@ -import { CE } from "./html"; -import { SUPPORTED_LANGUAGES, t } from "./translation"; -import { SettingElement, SettingElementType } from "./settings"; -import { UserAgentProfile } from "./user-agent"; -import { StreamStat } from "@/modules/stream/stream-stats"; +import { CE } from "@utils/html"; +import { SUPPORTED_LANGUAGES, t } from "@utils/translation"; +import { SettingElement, SettingElementType } from "@utils/settings"; +import { UserAgentProfile } from "@utils/user-agent"; +import { StreamStat } from "@modules/stream/stream-stats"; import type { PreferenceSettings } from "@/types/preferences"; -import { STATES } from "./global"; +import { STATES } from "@utils/global"; export enum PrefKey { LAST_UPDATE_CHECK = 'version_last_check', diff --git a/src/utils/region.ts b/src/utils/region.ts index dd5a53f..d4897f3 100644 --- a/src/utils/region.ts +++ b/src/utils/region.ts @@ -1,5 +1,5 @@ -import { getPref, PrefKey } from "./preferences"; -import { STATES } from "./global"; +import { getPref, PrefKey } from "@utils/preferences"; +import { STATES } from "@utils/global"; export function getPreferredServerRegion(shortName = false) { diff --git a/src/utils/settings.ts b/src/utils/settings.ts index dfc0ba8..8137b46 100644 --- a/src/utils/settings.ts +++ b/src/utils/settings.ts @@ -1,5 +1,5 @@ import type { PreferenceSetting } from "@/types/preferences"; -import { CE } from "./html"; +import { CE } from "@utils/html"; type MultipleOptionsParams = { size?: number; diff --git a/src/utils/titles-info.ts b/src/utils/titles-info.ts index afd8248..b2c74c1 100644 --- a/src/utils/titles-info.ts +++ b/src/utils/titles-info.ts @@ -1,5 +1,5 @@ -import { STATES } from "./global"; -import { UserAgent } from "./user-agent"; +import { STATES } from "@utils/global"; +import { UserAgent } from "@utils/user-agent"; export class PreloadedState { diff --git a/src/utils/toast.ts b/src/utils/toast.ts index 55108bd..486519d 100644 --- a/src/utils/toast.ts +++ b/src/utils/toast.ts @@ -1,4 +1,4 @@ -import { CE } from "./html"; +import { CE } from "@utils/html"; type ToastOptions = { instant?: boolean; diff --git a/src/utils/user-agent.ts b/src/utils/user-agent.ts index e204ef1..0b5dfef 100644 --- a/src/utils/user-agent.ts +++ b/src/utils/user-agent.ts @@ -1,4 +1,4 @@ -import { PrefKey, getPref } from "./preferences"; +import { PrefKey, getPref } from "@utils/preferences"; export enum UserAgentProfile { EDGE_WINDOWS = 'edge-windows', diff --git a/src/utils/utils.ts b/src/utils/utils.ts index d559f47..70e70e4 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1,6 +1,6 @@ -import { PrefKey, getPref, setPref } from "./preferences"; -import { SCRIPT_VERSION } from "./global"; -import { UserAgent } from "./user-agent"; +import { PrefKey, getPref, setPref } from "@utils/preferences"; +import { SCRIPT_VERSION } from "@utils/global"; +import { UserAgent } from "@utils/user-agent"; export function checkForUpdate() { const CHECK_INTERVAL_SECONDS = 2 * 3600; // check every 2 hours diff --git a/tsconfig.json b/tsconfig.json index dec2798..880ae99 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,11 @@ "compilerOptions": { "baseUrl": "./src", "paths": { - "@/*": ["./*"] + "@/*": ["./*"], + "@assets/*": ["./assets/*"], + "@macros/*": ["./macros/*"], + "@modules/*": ["./modules/*"], + "@utils/*": ["./utils/*"], }, // Enable latest features "lib": ["ESNext", "DOM"],