diff --git a/app/config.ts b/app/config.ts index 6c3d66ccf668..ae86f53eb929 100644 --- a/app/config.ts +++ b/app/config.ts @@ -4,7 +4,7 @@ import {_import, getDefaultConfig} from './config/import'; import _openConfig from './config/open'; import {cfgPath, cfgDir} from './config/paths'; import {getColorMap} from './utils/colors'; -import type {parsedConfig, configOptions} from '../lib/config'; +import type {parsedConfig, configOptions} from '../typings/config'; import {app} from 'electron'; const watchers: Function[] = []; diff --git a/app/config/import.ts b/app/config/import.ts index 13821c3b924f..c6762a7385b9 100644 --- a/app/config/import.ts +++ b/app/config/import.ts @@ -2,7 +2,7 @@ import {readFileSync, mkdirpSync} from 'fs-extra'; import {defaultCfg, cfgPath, plugs, defaultPlatformKeyPath} from './paths'; import {_init} from './init'; import notify from '../notify'; -import type {rawConfig} from '../../lib/config'; +import type {rawConfig} from '../../typings/config'; import {migrateHyper3Config} from './migrate'; let defaultConfig: rawConfig; diff --git a/app/config/init.ts b/app/config/init.ts index 33d4e3e6d17f..2889b42f6463 100644 --- a/app/config/init.ts +++ b/app/config/init.ts @@ -1,7 +1,7 @@ import vm from 'vm'; import notify from '../notify'; import mapKeys from '../utils/map-keys'; -import type {parsedConfig, rawConfig, configOptions} from '../../lib/config'; +import type {parsedConfig, rawConfig, configOptions} from '../../typings/config'; import merge from 'lodash/merge'; const _extract = (script?: vm.Script): Record => { diff --git a/app/index.d.ts b/app/index.d.ts deleted file mode 100644 index 1349d7d99bd8..000000000000 --- a/app/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -// Dummy file, required by tsc diff --git a/app/plugins.ts b/app/plugins.ts index 3f53cb8edf5a..e7f03f41b010 100644 --- a/app/plugins.ts +++ b/app/plugins.ts @@ -15,10 +15,10 @@ import {availableExtensions} from './plugins/extensions'; import {install} from './plugins/install'; import {plugs} from './config/paths'; import mapKeys from './utils/map-keys'; -import type {configOptions} from '../lib/config'; +import type {configOptions} from '../typings/config'; import {promisify} from 'util'; import {exec, execFile} from 'child_process'; -import type {IpcMainWithCommands} from '../common'; +import type {IpcMainWithCommands} from '../typings/common'; // local storage const cache = new Config(); diff --git a/app/rpc.ts b/app/rpc.ts index 129a406f6958..3286b01ccdbb 100644 --- a/app/rpc.ts +++ b/app/rpc.ts @@ -2,7 +2,7 @@ import {EventEmitter} from 'events'; import type {BrowserWindow, IpcMainEvent} from 'electron'; import {ipcMain} from 'electron'; import {v4 as uuidv4} from 'uuid'; -import type {TypedEmitter, MainEvents, RendererEvents, FilterNever} from '../common'; +import type {TypedEmitter, MainEvents, RendererEvents, FilterNever} from '../typings/common'; export class Server { emitter: TypedEmitter; diff --git a/app/tsconfig.json b/app/tsconfig.json index d18cc80a4f89..5c7450fdeba8 100644 --- a/app/tsconfig.json +++ b/app/tsconfig.json @@ -7,6 +7,8 @@ }, "include": [ "./**/*", - "./package.json" + "./package.json", + "../typings/extend-electron.d.ts", + "../typings/ext-modules.d.ts" ] } diff --git a/app/ui/window.ts b/app/ui/window.ts index 519adb1cf6f1..0b0ebeabf742 100644 --- a/app/ui/window.ts +++ b/app/ui/window.ts @@ -16,10 +16,10 @@ import {execCommand} from '../commands'; import {setRendererType, unsetRendererType} from '../utils/renderer-utils'; import {decorateSessionOptions, decorateSessionClass} from '../plugins'; import {enable as remoteEnable} from '@electron/remote/main'; -import type {configOptions} from '../../lib/config'; +import type {configOptions} from '../../typings/config'; import {getWorkingDirectoryFromPID} from 'native-process-working-directory'; import {existsSync} from 'fs'; -import type {sessionExtraOptions} from '../../common'; +import type {sessionExtraOptions} from '../../typings/common'; import {getDefaultProfile} from '../config'; export function newWindow( diff --git a/lib/actions/config.ts b/lib/actions/config.ts index 8acd6511a22a..d792d84675d3 100644 --- a/lib/actions/config.ts +++ b/lib/actions/config.ts @@ -1,6 +1,6 @@ import {CONFIG_LOAD, CONFIG_RELOAD} from '../constants/config'; -import type {HyperActions} from '../hyper'; -import type {configOptions} from '../config'; +import type {HyperActions} from '../../typings/hyper'; +import type {configOptions} from '../../typings/config'; export function loadConfig(config: configOptions): HyperActions { return { diff --git a/lib/actions/header.ts b/lib/actions/header.ts index e4827977d45e..1057f00f7e61 100644 --- a/lib/actions/header.ts +++ b/lib/actions/header.ts @@ -8,7 +8,7 @@ import { } from '../constants/ui'; import rpc from '../rpc'; import {userExitTermGroup, setActiveGroup} from './term-groups'; -import type {HyperDispatch} from '../hyper'; +import type {HyperDispatch} from '../../typings/hyper'; export function closeTab(uid: string) { return (dispatch: HyperDispatch) => { diff --git a/lib/actions/index.ts b/lib/actions/index.ts index 7cef199a4d90..e001bc662986 100644 --- a/lib/actions/index.ts +++ b/lib/actions/index.ts @@ -1,6 +1,6 @@ import rpc from '../rpc'; import {INIT} from '../constants'; -import type {HyperDispatch} from '../hyper'; +import type {HyperDispatch} from '../../typings/hyper'; export default function init() { return (dispatch: HyperDispatch) => { diff --git a/lib/actions/notifications.ts b/lib/actions/notifications.ts index 6604bb369d01..7ad64611cff8 100644 --- a/lib/actions/notifications.ts +++ b/lib/actions/notifications.ts @@ -1,5 +1,5 @@ import {NOTIFICATION_MESSAGE, NOTIFICATION_DISMISS} from '../constants/notifications'; -import type {HyperActions} from '../hyper'; +import type {HyperActions} from '../../typings/hyper'; export function dismissNotification(id: string): HyperActions { return { diff --git a/lib/actions/sessions.ts b/lib/actions/sessions.ts index f62e1317850a..f90130164c35 100644 --- a/lib/actions/sessions.ts +++ b/lib/actions/sessions.ts @@ -15,8 +15,8 @@ import { SESSION_SET_XTERM_TITLE, SESSION_SEARCH } from '../constants/sessions'; -import type {HyperState, HyperDispatch, HyperActions} from '../hyper'; -import type {Session} from '../../common'; +import type {HyperState, HyperDispatch, HyperActions} from '../../typings/hyper'; +import type {Session} from '../../typings/common'; export function addSession({uid, shell, pid, cols = null, rows = null, splitDirection, activeUid, profile}: Session) { return (dispatch: HyperDispatch, getState: () => HyperState) => { diff --git a/lib/actions/term-groups.ts b/lib/actions/term-groups.ts index 45dd13273d42..75c8a6252401 100644 --- a/lib/actions/term-groups.ts +++ b/lib/actions/term-groups.ts @@ -10,7 +10,7 @@ import {SESSION_REQUEST} from '../constants/sessions'; import findBySession from '../utils/term-groups'; import {getRootGroups} from '../selectors'; import {setActiveSession, ptyExitSession, userExitSession} from './sessions'; -import type {ITermState, ITermGroup, HyperState, HyperDispatch, HyperActions} from '../hyper'; +import type {ITermState, ITermGroup, HyperState, HyperDispatch, HyperActions} from '../../typings/hyper'; function requestSplit(direction: 'VERTICAL' | 'HORIZONTAL') { return (_activeUid: string | undefined, _profile: string | undefined) => diff --git a/lib/actions/ui.ts b/lib/actions/ui.ts index bccc52799298..fd737ed31ec7 100644 --- a/lib/actions/ui.ts +++ b/lib/actions/ui.ts @@ -28,7 +28,7 @@ import { import {setActiveGroup} from './term-groups'; import type parseUrl from 'parse-url'; -import type {HyperState, HyperDispatch, HyperActions, ITermGroups} from '../hyper'; +import type {HyperState, HyperDispatch, HyperActions, ITermGroups} from '../../typings/hyper'; import type {Stats} from 'fs'; import {stat} from 'fs'; diff --git a/lib/actions/updater.ts b/lib/actions/updater.ts index 8f1167230149..e4cf53e4ece4 100644 --- a/lib/actions/updater.ts +++ b/lib/actions/updater.ts @@ -1,6 +1,6 @@ import {UPDATE_INSTALL, UPDATE_AVAILABLE} from '../constants/updater'; import rpc from '../rpc'; -import type {HyperActions} from '../hyper'; +import type {HyperActions} from '../../typings/hyper'; export function installUpdate(): HyperActions { return { diff --git a/lib/command-registry.ts b/lib/command-registry.ts index 0379c50bd956..de0552f14700 100644 --- a/lib/command-registry.ts +++ b/lib/command-registry.ts @@ -1,5 +1,5 @@ import {ipcRenderer} from './utils/ipc'; -import type {HyperDispatch} from './hyper'; +import type {HyperDispatch} from '../typings/hyper'; import {closeSearch} from './actions/sessions'; let commands: Record void> = { diff --git a/lib/components/header.tsx b/lib/components/header.tsx index 7eb052315737..bb2a57b72886 100644 --- a/lib/components/header.tsx +++ b/lib/components/header.tsx @@ -3,7 +3,7 @@ import React from 'react'; import {decorate, getTabsProps} from '../utils/plugins'; import Tabs_ from './tabs'; -import type {HeaderProps} from '../hyper'; +import type {HeaderProps} from '../../typings/hyper'; const Tabs = decorate(Tabs_, 'Tabs'); diff --git a/lib/components/new-tab.tsx b/lib/components/new-tab.tsx index 76ce6fa78f08..992420ea8a80 100644 --- a/lib/components/new-tab.tsx +++ b/lib/components/new-tab.tsx @@ -1,6 +1,6 @@ import React, {useRef, useState} from 'react'; import {VscChevronDown} from '@react-icons/all-files/vsc/VscChevronDown'; -import type {configOptions} from '../config'; +import type {configOptions} from '../../typings/config'; import useClickAway from 'react-use/lib/useClickAway'; interface Props { diff --git a/lib/components/notification.tsx b/lib/components/notification.tsx index 256ea8c42570..3cc78f8f4569 100644 --- a/lib/components/notification.tsx +++ b/lib/components/notification.tsx @@ -1,5 +1,5 @@ import React, {forwardRef, useEffect, useRef, useState} from 'react'; -import type {NotificationProps} from '../hyper'; +import type {NotificationProps} from '../../typings/hyper'; const Notification = forwardRef>((props, ref) => { const dismissTimer = useRef(undefined); diff --git a/lib/components/notifications.tsx b/lib/components/notifications.tsx index 07793949780e..e70769bc0b25 100644 --- a/lib/components/notifications.tsx +++ b/lib/components/notifications.tsx @@ -3,7 +3,7 @@ import React, {forwardRef} from 'react'; import {decorate} from '../utils/plugins'; import Notification_ from './notification'; -import type {NotificationsProps} from '../hyper'; +import type {NotificationsProps} from '../../typings/hyper'; const Notification = decorate(Notification_, 'Notification'); diff --git a/lib/components/searchBox.tsx b/lib/components/searchBox.tsx index c172584dedc6..fb13878e805f 100644 --- a/lib/components/searchBox.tsx +++ b/lib/components/searchBox.tsx @@ -1,5 +1,5 @@ import React, {useCallback, useRef, useEffect, forwardRef} from 'react'; -import type {SearchBoxProps} from '../hyper'; +import type {SearchBoxProps} from '../../typings/hyper'; import {VscArrowUp} from '@react-icons/all-files/vsc/VscArrowUp'; import {VscArrowDown} from '@react-icons/all-files/vsc/VscArrowDown'; import {VscClose} from '@react-icons/all-files/vsc/VscClose'; diff --git a/lib/components/split-pane.tsx b/lib/components/split-pane.tsx index 9c67d413ee68..e8d082417cc6 100644 --- a/lib/components/split-pane.tsx +++ b/lib/components/split-pane.tsx @@ -1,6 +1,6 @@ import React from 'react'; import sum from 'lodash/sum'; -import type {SplitPaneProps} from '../hyper'; +import type {SplitPaneProps} from '../../typings/hyper'; export default class SplitPane extends React.PureComponent< React.PropsWithChildren, diff --git a/lib/components/style-sheet.tsx b/lib/components/style-sheet.tsx index 2006c58062d1..26dbba956ee0 100644 --- a/lib/components/style-sheet.tsx +++ b/lib/components/style-sheet.tsx @@ -1,5 +1,5 @@ import React, {forwardRef} from 'react'; -import type {StyleSheetProps} from '../hyper'; +import type {StyleSheetProps} from '../../typings/hyper'; const StyleSheet = forwardRef((props, ref) => { const {borderColor} = props; diff --git a/lib/components/tab.tsx b/lib/components/tab.tsx index 5c4c1329b610..8a0c6912b4b6 100644 --- a/lib/components/tab.tsx +++ b/lib/components/tab.tsx @@ -1,5 +1,5 @@ import React, {forwardRef} from 'react'; -import type {TabProps} from '../hyper'; +import type {TabProps} from '../../typings/hyper'; const Tab = forwardRef((props, ref) => { const handleClick = (event: React.MouseEvent) => { diff --git a/lib/components/tabs.tsx b/lib/components/tabs.tsx index e966b3175026..afa94afb2038 100644 --- a/lib/components/tabs.tsx +++ b/lib/components/tabs.tsx @@ -3,7 +3,7 @@ import React, {forwardRef} from 'react'; import {decorate, getTabProps} from '../utils/plugins'; import Tab_ from './tab'; -import type {TabsProps} from '../hyper'; +import type {TabsProps} from '../../typings/hyper'; import DropdownButton from './new-tab'; const Tab = decorate(Tab_, 'Tab'); diff --git a/lib/components/term-group.tsx b/lib/components/term-group.tsx index a0902ea1272e..3edd4a7112dc 100644 --- a/lib/components/term-group.tsx +++ b/lib/components/term-group.tsx @@ -4,7 +4,7 @@ import {decorate, getTermProps, getTermGroupProps} from '../utils/plugins'; import {resizeTermGroup} from '../actions/term-groups'; import Term_ from './term'; import SplitPane_ from './split-pane'; -import type {HyperState, HyperDispatch, TermGroupProps, TermGroupOwnProps} from '../hyper'; +import type {HyperState, HyperDispatch, TermGroupProps, TermGroupOwnProps} from '../../typings/hyper'; const Term = decorate(Term_, 'Term'); const SplitPane = decorate(SplitPane_, 'SplitPane'); diff --git a/lib/components/term.tsx b/lib/components/term.tsx index 5ae7b9202c3f..997c9cf1e607 100644 --- a/lib/components/term.tsx +++ b/lib/components/term.tsx @@ -14,7 +14,7 @@ import Color from 'color'; import terms from '../terms'; import processClipboard from '../utils/paste'; import _SearchBox from './searchBox'; -import type {TermProps} from '../hyper'; +import type {TermProps} from '../../typings/hyper'; import pickBy from 'lodash/pickBy'; import isEqual from 'lodash/isEqual'; import {decorate} from '../utils/plugins'; diff --git a/lib/components/terms.tsx b/lib/components/terms.tsx index 9f4eb36b6e70..7bcd76f27569 100644 --- a/lib/components/terms.tsx +++ b/lib/components/terms.tsx @@ -3,7 +3,7 @@ import {decorate, getTermGroupProps} from '../utils/plugins'; import {registerCommandHandlers} from '../command-registry'; import TermGroup_ from './term-group'; import StyleSheet_ from './style-sheet'; -import type {TermsProps, HyperDispatch} from '../hyper'; +import type {TermsProps, HyperDispatch} from '../../typings/hyper'; import type Term from './term'; import {ObjectTypedKeys} from '../utils/object'; diff --git a/lib/constants/config.ts b/lib/constants/config.ts index 31aff6daac68..3345fe550fa8 100644 --- a/lib/constants/config.ts +++ b/lib/constants/config.ts @@ -1,4 +1,4 @@ -import type {configOptions} from '../config'; +import type {configOptions} from '../../typings/config'; export const CONFIG_LOAD = 'CONFIG_LOAD'; export const CONFIG_RELOAD = 'CONFIG_RELOAD'; diff --git a/lib/containers/header.ts b/lib/containers/header.ts index 992690ca7a77..a072ded745c8 100644 --- a/lib/containers/header.ts +++ b/lib/containers/header.ts @@ -4,7 +4,7 @@ import Header from '../components/header'; import {closeTab, changeTab, maximize, openHamburgerMenu, unmaximize, minimize, close} from '../actions/header'; import {connect} from '../utils/plugins'; import {getRootGroups} from '../selectors'; -import type {HyperState, HyperDispatch, ITab} from '../hyper'; +import type {HyperState, HyperDispatch, ITab} from '../../typings/hyper'; import {requestTermGroup} from '../actions/term-groups'; const isMac = /Mac/.test(navigator.userAgent); diff --git a/lib/containers/hyper.tsx b/lib/containers/hyper.tsx index 4ee96c4d9ad7..0dd981667bf2 100644 --- a/lib/containers/hyper.tsx +++ b/lib/containers/hyper.tsx @@ -10,7 +10,7 @@ import stylis from 'stylis'; import {HeaderContainer} from './header'; import TermsContainer from './terms'; import NotificationsContainer from './notifications'; -import type {HyperState, HyperProps, HyperDispatch} from '../hyper'; +import type {HyperState, HyperProps, HyperDispatch} from '../../typings/hyper'; import type Terms from '../components/terms'; const isMac = /Mac/.test(navigator.userAgent); diff --git a/lib/containers/notifications.ts b/lib/containers/notifications.ts index 8d56d0f820e8..bf584685f180 100644 --- a/lib/containers/notifications.ts +++ b/lib/containers/notifications.ts @@ -2,7 +2,7 @@ import Notifications from '../components/notifications'; import {installUpdate} from '../actions/updater'; import {connect} from '../utils/plugins'; import {dismissNotification} from '../actions/notifications'; -import type {HyperState, HyperDispatch} from '../hyper'; +import type {HyperState, HyperDispatch} from '../../typings/hyper'; const mapStateToProps = (state: HyperState) => { const {ui} = state; diff --git a/lib/containers/terms.ts b/lib/containers/terms.ts index 94a9487eba6d..d6e3d67f7423 100644 --- a/lib/containers/terms.ts +++ b/lib/containers/terms.ts @@ -11,7 +11,7 @@ import { import {openContextMenu} from '../actions/ui'; import {getRootGroups} from '../selectors'; -import type {HyperState, HyperDispatch} from '../hyper'; +import type {HyperState, HyperDispatch} from '../../typings/hyper'; const mapStateToProps = (state: HyperState) => { const {sessions} = state.sessions; diff --git a/lib/ext-modules.d.ts b/lib/ext-modules.d.ts deleted file mode 100644 index b29eea993469..000000000000 --- a/lib/ext-modules.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module 'php-escape-shell' { - export function php_escapeshellcmd(path: string): string; -} diff --git a/lib/index.tsx b/lib/index.tsx index 85175ddb22c0..f3df72823c2d 100644 --- a/lib/index.tsx +++ b/lib/index.tsx @@ -17,7 +17,7 @@ import {addNotificationMessage} from './actions/notifications'; import {loadConfig, reloadConfig} from './actions/config'; import HyperContainer from './containers/hyper'; import configureStore from './store/configure-store'; -import type {configOptions} from './config'; +import type {configOptions} from '../typings/config'; // On Linux, the default zoom was somehow changed with Electron 3 (or maybe 2). // Setting zoom factor to 1.2 brings back the normal default size diff --git a/lib/reducers/index.ts b/lib/reducers/index.ts index 809e5a389c6a..5d8177938b25 100644 --- a/lib/reducers/index.ts +++ b/lib/reducers/index.ts @@ -3,7 +3,7 @@ import {combineReducers} from 'redux'; import ui from './ui'; import sessions from './sessions'; import termGroups from './term-groups'; -import type {HyperActions, HyperState} from '../hyper'; +import type {HyperActions, HyperState} from '../../typings/hyper'; export default combineReducers({ ui, diff --git a/lib/reducers/sessions.ts b/lib/reducers/sessions.ts index 11f2a67e9088..85fab286f77e 100644 --- a/lib/reducers/sessions.ts +++ b/lib/reducers/sessions.ts @@ -12,7 +12,7 @@ import { SESSION_SET_CWD, SESSION_SEARCH } from '../constants/sessions'; -import type {sessionState, session, Mutable, ISessionReducer} from '../hyper'; +import type {sessionState, session, Mutable, ISessionReducer} from '../../typings/hyper'; const initialState: sessionState = Immutable>({ sessions: {}, diff --git a/lib/reducers/term-groups.ts b/lib/reducers/term-groups.ts index 7ce0027484d1..8ca33ef90820 100644 --- a/lib/reducers/term-groups.ts +++ b/lib/reducers/term-groups.ts @@ -6,7 +6,7 @@ import type {SessionAddAction} from '../constants/sessions'; import {SESSION_ADD, SESSION_SET_ACTIVE} from '../constants/sessions'; import findBySession from '../utils/term-groups'; import {decorateTermGroupsReducer} from '../utils/plugins'; -import type {ITermGroup, ITermState, ITermGroups, ITermGroupReducer, Mutable} from '../hyper'; +import type {ITermGroup, ITermState, ITermGroups, ITermGroupReducer, Mutable} from '../../typings/hyper'; const MIN_SIZE = 0.05; const initialState: ITermState = Immutable>({ diff --git a/lib/reducers/ui.ts b/lib/reducers/ui.ts index b5195ac92b58..dd1dbf01ba85 100644 --- a/lib/reducers/ui.ts +++ b/lib/reducers/ui.ts @@ -22,7 +22,7 @@ import { SESSION_SET_CWD } from '../constants/sessions'; import {UPDATE_AVAILABLE} from '../constants/updater'; -import type {uiState, Mutable, IUiReducer} from '../hyper'; +import type {uiState, Mutable, IUiReducer} from '../../typings/hyper'; import {release} from 'os'; const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].includes(navigator.platform) || process.platform === 'win32'; diff --git a/lib/selectors.ts b/lib/selectors.ts index 776070457678..bcf0e8a37653 100644 --- a/lib/selectors.ts +++ b/lib/selectors.ts @@ -1,5 +1,5 @@ import {createSelector} from 'reselect'; -import type {HyperState} from './hyper'; +import type {HyperState} from '../typings/hyper'; const getTermGroups = ({termGroups}: Pick) => termGroups.termGroups; export const getRootGroups = createSelector(getTermGroups, (termGroups) => diff --git a/lib/store/configure-store.dev.ts b/lib/store/configure-store.dev.ts index 977eef562651..b0560e6c6ba4 100644 --- a/lib/store/configure-store.dev.ts +++ b/lib/store/configure-store.dev.ts @@ -6,7 +6,7 @@ import effects from '../utils/effects'; import * as plugins from '../utils/plugins'; import writeMiddleware from './write-middleware'; import {composeWithDevTools} from '@redux-devtools/extension'; -import type {HyperState, HyperActions} from '../hyper'; +import type {HyperState, HyperActions} from '../../typings/hyper'; const thunk: ThunkMiddleware = _thunk; export default () => { diff --git a/lib/store/configure-store.prod.ts b/lib/store/configure-store.prod.ts index 057be3260943..1baa0a367d2f 100644 --- a/lib/store/configure-store.prod.ts +++ b/lib/store/configure-store.prod.ts @@ -5,7 +5,7 @@ import rootReducer from '../reducers/index'; import effects from '../utils/effects'; import * as plugins from '../utils/plugins'; import writeMiddleware from './write-middleware'; -import type {HyperState, HyperActions} from '../hyper'; +import type {HyperState, HyperActions} from '../../typings/hyper'; const thunk: ThunkMiddleware = _thunk; export default () => diff --git a/lib/store/write-middleware.ts b/lib/store/write-middleware.ts index 58f7d250e0aa..c7ecb5b627d7 100644 --- a/lib/store/write-middleware.ts +++ b/lib/store/write-middleware.ts @@ -1,4 +1,4 @@ -import type {HyperActions, HyperState} from '../hyper'; +import type {HyperActions, HyperState} from '../../typings/hyper'; import terms from '../terms'; import type {Dispatch, Middleware} from 'redux'; diff --git a/lib/utils/effects.ts b/lib/utils/effects.ts index 7d547306364a..0e1abb302041 100644 --- a/lib/utils/effects.ts +++ b/lib/utils/effects.ts @@ -1,5 +1,5 @@ import type {Dispatch, Middleware} from 'redux'; -import type {HyperActions, HyperState} from '../hyper'; +import type {HyperActions, HyperState} from '../../typings/hyper'; /** * Simple redux middleware that executes * the `effect` field if provided in an action diff --git a/lib/utils/ipc.ts b/lib/utils/ipc.ts index 55a7eeb117fc..78a337c7ba27 100644 --- a/lib/utils/ipc.ts +++ b/lib/utils/ipc.ts @@ -1,4 +1,4 @@ import {ipcRenderer as _ipc} from 'electron'; -import type {IpcRendererWithCommands} from '../../common'; +import type {IpcRendererWithCommands} from '../../typings/common'; export const ipcRenderer = _ipc as IpcRendererWithCommands; diff --git a/lib/utils/plugins.ts b/lib/utils/plugins.ts index 460cee2f2b0b..8c6e04409e9c 100644 --- a/lib/utils/plugins.ts +++ b/lib/utils/plugins.ts @@ -28,7 +28,7 @@ import type { TermProps, Assignable, HyperActions -} from '../hyper'; +} from '../../typings/hyper'; import type {Dispatch, Middleware} from 'redux'; import {ObjectTypedKeys} from './object'; import IPCChildProcess from './ipc-child-process'; diff --git a/lib/utils/rpc.ts b/lib/utils/rpc.ts index 6b67a5821c11..b547e172b645 100644 --- a/lib/utils/rpc.ts +++ b/lib/utils/rpc.ts @@ -1,6 +1,12 @@ import {EventEmitter} from 'events'; import type {IpcRendererEvent} from 'electron'; -import type {FilterNever, IpcRendererWithCommands, MainEvents, RendererEvents, TypedEmitter} from '../../common'; +import type { + FilterNever, + IpcRendererWithCommands, + MainEvents, + RendererEvents, + TypedEmitter +} from '../../typings/common'; import {ipcRenderer} from './ipc'; export default class Client { diff --git a/lib/utils/term-groups.ts b/lib/utils/term-groups.ts index d95dc3ae56f6..50ee42b55569 100644 --- a/lib/utils/term-groups.ts +++ b/lib/utils/term-groups.ts @@ -1,4 +1,4 @@ -import type {ITermState} from '../hyper'; +import type {ITermState} from '../../typings/hyper'; export default function findBySession(termGroupState: ITermState, sessionUid: string) { const {termGroups} = termGroupState; diff --git a/package.json b/package.json index 19b075715018..2e74cc547c1e 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "v8-snapshot:arch": "yarn run mk-snapshot && yarn run cp-snapshot", "mk-snapshot": "cross-env ELECTRON_CUSTOM_VERSION=$npm_package_devDependencies_electron node node_modules/electron-mksnapshot/download-mksnapshot.js && node bin/mk-snapshot.js", "cp-snapshot": "node bin/cp-snapshot.js", - "generate-schema": "typescript-json-schema ./lib/config.d.ts rawConfig -o ./app/config/schema.json --required" + "generate-schema": "typescript-json-schema ./typings/config.d.ts rawConfig -o ./app/config/schema.json --required" }, "license": "MIT", "author": { diff --git a/tsconfig.json b/tsconfig.json index 1ca87952dd16..e8a421e6667b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,8 @@ "./app/", "./lib/", "./test/", - "./cli/" + "./cli/", + "./typings" ], "references": [ { diff --git a/common.d.ts b/typings/common.d.ts similarity index 98% rename from common.d.ts rename to typings/common.d.ts index 5797b4e9fae7..26ee00a8fc7e 100644 --- a/common.d.ts +++ b/typings/common.d.ts @@ -1,7 +1,7 @@ import type parseUrl from 'parse-url'; import type {IpcMain, IpcRenderer} from 'electron'; import type {ExecFileOptions, ExecOptions} from 'child_process'; -import type {configOptions} from './lib/config'; +import type {configOptions} from './config'; export type Session = { uid: string; diff --git a/lib/config.d.ts b/typings/config.d.ts similarity index 100% rename from lib/config.d.ts rename to typings/config.d.ts diff --git a/app/ext-modules.d.ts b/typings/ext-modules.d.ts similarity index 80% rename from app/ext-modules.d.ts rename to typings/ext-modules.d.ts index a0e18df821e0..da1fd965415e 100644 --- a/app/ext-modules.d.ts +++ b/typings/ext-modules.d.ts @@ -1,3 +1,7 @@ +declare module 'php-escape-shell' { + export function php_escapeshellcmd(path: string): string; +} + declare module 'git-describe' { export function gitDescribe(...args: any[]): void; } diff --git a/app/extend-electron.d.ts b/typings/extend-electron.d.ts similarity index 83% rename from app/extend-electron.d.ts rename to typings/extend-electron.d.ts index e01f4e306246..ae7673017180 100644 --- a/app/extend-electron.d.ts +++ b/typings/extend-electron.d.ts @@ -1,10 +1,10 @@ -import type {Server} from './rpc'; +import type {Server} from '../app/rpc'; declare global { namespace Electron { interface App { - config: typeof import('./config'); - plugins: typeof import('./plugins'); + config: typeof import('../app/config'); + plugins: typeof import('../app/plugins'); getWindows: () => Set; getLastFocusedWindow: () => BrowserWindow | null; windowCallback?: (win: BrowserWindow) => void; diff --git a/lib/hyper.d.ts b/typings/hyper.d.ts similarity index 90% rename from lib/hyper.d.ts rename to typings/hyper.d.ts index 8ec0820bb325..85c407559d3e 100644 --- a/lib/hyper.d.ts +++ b/typings/hyper.d.ts @@ -1,5 +1,5 @@ import type {Immutable} from 'seamless-immutable'; -import type Client from './utils/rpc'; +import type Client from '../lib/utils/rpc'; declare global { interface Window { @@ -167,14 +167,14 @@ export type HyperState = { termGroups: ITermState; }; -import type {UIActions} from './constants/ui'; -import type {ConfigActions} from './constants/config'; -import type {SessionActions} from './constants/sessions'; -import type {NotificationActions} from './constants/notifications'; -import type {UpdateActions} from './constants/updater'; -import type {TermGroupActions} from './constants/term-groups'; -import type {InitActions} from './constants'; -import type {TabActions} from './constants/tabs'; +import type {UIActions} from '../lib/constants/ui'; +import type {ConfigActions} from '../lib/constants/config'; +import type {SessionActions} from '../lib/constants/sessions'; +import type {NotificationActions} from '../lib/constants/notifications'; +import type {UpdateActions} from '../lib/constants/updater'; +import type {TermGroupActions} from '../lib/constants/term-groups'; +import type {InitActions} from '../lib/constants'; +import type {TabActions} from '../lib/constants/tabs'; export type HyperActions = ( | UIActions @@ -187,7 +187,7 @@ export type HyperActions = ( | TabActions ) & {effect?: () => void}; -import type configureStore from './store/configure-store'; +import type configureStore from '../lib/store/configure-store'; export type HyperDispatch = ReturnType['dispatch']; import type {ReactChild} from 'react'; @@ -198,17 +198,17 @@ type extensionProps = Partial<{ customInnerChildren: ReactChild | ReactChild[]; }>; -import type {HeaderConnectedProps} from './containers/header'; +import type {HeaderConnectedProps} from '../lib/containers/header'; export type HeaderProps = HeaderConnectedProps & extensionProps; -import type {HyperConnectedProps} from './containers/hyper'; +import type {HyperConnectedProps} from '../lib/containers/hyper'; export type HyperProps = HyperConnectedProps & extensionProps; -import type {NotificationsConnectedProps} from './containers/notifications'; +import type {NotificationsConnectedProps} from '../lib/containers/notifications'; export type NotificationsProps = NotificationsConnectedProps & extensionProps; -import type Terms from './components/terms'; -import type {TermsConnectedProps} from './containers/terms'; +import type Terms from '../lib/components/terms'; +import type {TermsConnectedProps} from '../lib/containers/terms'; export type TermsProps = TermsConnectedProps & extensionProps & {ref_: (terms: Terms | null) => void}; export type StyleSheetProps = { @@ -266,7 +266,7 @@ export type SplitPaneProps = { sizes?: Immutable | null; }; -import type Term from './components/term'; +import type Term from '../lib/components/term'; export type TermGroupOwnProps = { cursorAccentColor?: string; @@ -318,7 +318,7 @@ export type TermGroupOwnProps = { | 'imageSupport' >; -import type {TermGroupConnectedProps} from './components/term-group'; +import type {TermGroupConnectedProps} from '../lib/components/term-group'; export type TermGroupProps = TermGroupConnectedProps & TermGroupOwnProps; export type SearchBoxProps = {