move constants to typings as well

This commit is contained in:
Labhansh Agrawal 2023-07-25 16:09:11 +05:30
parent c62ed62752
commit f48c0e0608
22 changed files with 34 additions and 34 deletions

View file

@ -1,4 +1,4 @@
import {CONFIG_LOAD, CONFIG_RELOAD} from '../constants/config'; import {CONFIG_LOAD, CONFIG_RELOAD} from '../../typings/constants/config';
import type {HyperActions} from '../../typings/hyper'; import type {HyperActions} from '../../typings/hyper';
import type {configOptions} from '../../typings/config'; import type {configOptions} from '../../typings/config';

View file

@ -1,11 +1,11 @@
import {CLOSE_TAB, CHANGE_TAB} from '../constants/tabs'; import {CLOSE_TAB, CHANGE_TAB} from '../../typings/constants/tabs';
import { import {
UI_WINDOW_MAXIMIZE, UI_WINDOW_MAXIMIZE,
UI_WINDOW_UNMAXIMIZE, UI_WINDOW_UNMAXIMIZE,
UI_OPEN_HAMBURGER_MENU, UI_OPEN_HAMBURGER_MENU,
UI_WINDOW_MINIMIZE, UI_WINDOW_MINIMIZE,
UI_WINDOW_CLOSE UI_WINDOW_CLOSE
} from '../constants/ui'; } from '../../typings/constants/ui';
import rpc from '../rpc'; import rpc from '../rpc';
import {userExitTermGroup, setActiveGroup} from './term-groups'; import {userExitTermGroup, setActiveGroup} from './term-groups';
import type {HyperDispatch} from '../../typings/hyper'; import type {HyperDispatch} from '../../typings/hyper';

View file

@ -1,5 +1,5 @@
import rpc from '../rpc'; import rpc from '../rpc';
import {INIT} from '../constants'; import {INIT} from '../../typings/constants';
import type {HyperDispatch} from '../../typings/hyper'; import type {HyperDispatch} from '../../typings/hyper';
export default function init() { export default function init() {

View file

@ -1,4 +1,4 @@
import {NOTIFICATION_MESSAGE, NOTIFICATION_DISMISS} from '../constants/notifications'; import {NOTIFICATION_MESSAGE, NOTIFICATION_DISMISS} from '../../typings/constants/notifications';
import type {HyperActions} from '../../typings/hyper'; import type {HyperActions} from '../../typings/hyper';
export function dismissNotification(id: string): HyperActions { export function dismissNotification(id: string): HyperActions {

View file

@ -14,7 +14,7 @@ import {
SESSION_USER_DATA, SESSION_USER_DATA,
SESSION_SET_XTERM_TITLE, SESSION_SET_XTERM_TITLE,
SESSION_SEARCH SESSION_SEARCH
} from '../constants/sessions'; } from '../../typings/constants/sessions';
import type {HyperState, HyperDispatch, HyperActions} from '../../typings/hyper'; import type {HyperState, HyperDispatch, HyperActions} from '../../typings/hyper';
import type {Session} from '../../typings/common'; import type {Session} from '../../typings/common';

View file

@ -5,8 +5,8 @@ import {
TERM_GROUP_REQUEST, TERM_GROUP_REQUEST,
TERM_GROUP_EXIT, TERM_GROUP_EXIT,
TERM_GROUP_EXIT_ACTIVE TERM_GROUP_EXIT_ACTIVE
} from '../constants/term-groups'; } from '../../typings/constants/term-groups';
import {SESSION_REQUEST} from '../constants/sessions'; import {SESSION_REQUEST} from '../../typings/constants/sessions';
import findBySession from '../utils/term-groups'; import findBySession from '../utils/term-groups';
import {getRootGroups} from '../selectors'; import {getRootGroups} from '../selectors';
import {setActiveSession, ptyExitSession, userExitSession} from './sessions'; import {setActiveSession, ptyExitSession, userExitSession} from './sessions';

View file

@ -24,7 +24,7 @@ import {
UI_OPEN_SSH_URL, UI_OPEN_SSH_URL,
UI_CONTEXTMENU_OPEN, UI_CONTEXTMENU_OPEN,
UI_COMMAND_EXEC UI_COMMAND_EXEC
} from '../constants/ui'; } from '../../typings/constants/ui';
import {setActiveGroup} from './term-groups'; import {setActiveGroup} from './term-groups';
import type parseUrl from 'parse-url'; import type parseUrl from 'parse-url';

View file

@ -1,4 +1,4 @@
import {UPDATE_INSTALL, UPDATE_AVAILABLE} from '../constants/updater'; import {UPDATE_INSTALL, UPDATE_AVAILABLE} from '../../typings/constants/updater';
import rpc from '../rpc'; import rpc from '../rpc';
import type {HyperActions} from '../../typings/hyper'; import type {HyperActions} from '../../typings/hyper';

View file

@ -11,7 +11,7 @@ import {
SESSION_SET_XTERM_TITLE, SESSION_SET_XTERM_TITLE,
SESSION_SET_CWD, SESSION_SET_CWD,
SESSION_SEARCH SESSION_SEARCH
} from '../constants/sessions'; } from '../../typings/constants/sessions';
import type {sessionState, session, Mutable, ISessionReducer} from '../../typings/hyper'; import type {sessionState, session, Mutable, ISessionReducer} from '../../typings/hyper';
const initialState: sessionState = Immutable<Mutable<sessionState>>({ const initialState: sessionState = Immutable<Mutable<sessionState>>({

View file

@ -1,9 +1,9 @@
import {v4 as uuidv4} from 'uuid'; import {v4 as uuidv4} from 'uuid';
import type {Immutable as ImmutableType} from 'seamless-immutable'; import type {Immutable as ImmutableType} from 'seamless-immutable';
import Immutable from 'seamless-immutable'; import Immutable from 'seamless-immutable';
import {TERM_GROUP_EXIT, TERM_GROUP_RESIZE} from '../constants/term-groups'; import {TERM_GROUP_EXIT, TERM_GROUP_RESIZE} from '../../typings/constants/term-groups';
import type {SessionAddAction} from '../constants/sessions'; import type {SessionAddAction} from '../../typings/constants/sessions';
import {SESSION_ADD, SESSION_SET_ACTIVE} from '../constants/sessions'; import {SESSION_ADD, SESSION_SET_ACTIVE} from '../../typings/constants/sessions';
import findBySession from '../utils/term-groups'; import findBySession from '../utils/term-groups';
import {decorateTermGroupsReducer} from '../utils/plugins'; import {decorateTermGroupsReducer} from '../utils/plugins';
import type {ITermGroup, ITermState, ITermGroups, ITermGroupReducer, Mutable} from '../../typings/hyper'; import type {ITermGroup, ITermState, ITermGroups, ITermGroupReducer, Mutable} from '../../typings/hyper';

View file

@ -1,7 +1,7 @@
import type {Immutable as ImmutableType} from 'seamless-immutable'; import type {Immutable as ImmutableType} from 'seamless-immutable';
import Immutable from 'seamless-immutable'; import Immutable from 'seamless-immutable';
import {decorateUIReducer} from '../utils/plugins'; import {decorateUIReducer} from '../utils/plugins';
import {CONFIG_LOAD, CONFIG_RELOAD} from '../constants/config'; import {CONFIG_LOAD, CONFIG_RELOAD} from '../../typings/constants/config';
import { import {
UI_FONT_SIZE_SET, UI_FONT_SIZE_SET,
UI_FONT_SIZE_RESET, UI_FONT_SIZE_RESET,
@ -11,8 +11,8 @@ import {
UI_WINDOW_GEOMETRY_CHANGED, UI_WINDOW_GEOMETRY_CHANGED,
UI_ENTER_FULLSCREEN, UI_ENTER_FULLSCREEN,
UI_LEAVE_FULLSCREEN UI_LEAVE_FULLSCREEN
} from '../constants/ui'; } from '../../typings/constants/ui';
import {NOTIFICATION_MESSAGE, NOTIFICATION_DISMISS} from '../constants/notifications'; import {NOTIFICATION_MESSAGE, NOTIFICATION_DISMISS} from '../../typings/constants/notifications';
import { import {
SESSION_ADD, SESSION_ADD,
SESSION_RESIZE, SESSION_RESIZE,
@ -20,8 +20,8 @@ import {
SESSION_PTY_EXIT, SESSION_PTY_EXIT,
SESSION_SET_ACTIVE, SESSION_SET_ACTIVE,
SESSION_SET_CWD SESSION_SET_CWD
} from '../constants/sessions'; } from '../../typings/constants/sessions';
import {UPDATE_AVAILABLE} from '../constants/updater'; import {UPDATE_AVAILABLE} from '../../typings/constants/updater';
import type {uiState, Mutable, IUiReducer} from '../../typings/hyper'; import type {uiState, Mutable, IUiReducer} from '../../typings/hyper';
import {release} from 'os'; import {release} from 'os';

View file

@ -8,7 +8,7 @@
"./lib/", "./lib/",
"./test/", "./test/",
"./cli/", "./cli/",
"./typings" "./typings/"
], ],
"references": [ "references": [
{ {

View file

@ -1,4 +1,4 @@
import type {configOptions} from '../../typings/config'; import type {configOptions} from '../config';
export const CONFIG_LOAD = 'CONFIG_LOAD'; export const CONFIG_LOAD = 'CONFIG_LOAD';
export const CONFIG_RELOAD = 'CONFIG_RELOAD'; export const CONFIG_RELOAD = 'CONFIG_RELOAD';

View file

@ -2,10 +2,10 @@ export const TERM_GROUP_REQUEST = 'TERM_GROUP_REQUEST';
export const TERM_GROUP_EXIT = 'TERM_GROUP_EXIT'; export const TERM_GROUP_EXIT = 'TERM_GROUP_EXIT';
export const TERM_GROUP_RESIZE = 'TERM_GROUP_RESIZE'; export const TERM_GROUP_RESIZE = 'TERM_GROUP_RESIZE';
export const TERM_GROUP_EXIT_ACTIVE = 'TERM_GROUP_EXIT_ACTIVE'; export const TERM_GROUP_EXIT_ACTIVE = 'TERM_GROUP_EXIT_ACTIVE';
export const DIRECTION = { export enum DIRECTION {
HORIZONTAL: 'HORIZONTAL', HORIZONTAL = 'HORIZONTAL',
VERTICAL: 'VERTICAL' VERTICAL = 'VERTICAL'
} as const; }
export interface TermGroupRequestAction { export interface TermGroupRequestAction {
type: typeof TERM_GROUP_REQUEST; type: typeof TERM_GROUP_REQUEST;

16
typings/hyper.d.ts vendored
View file

@ -167,14 +167,14 @@ export type HyperState = {
termGroups: ITermState; termGroups: ITermState;
}; };
import type {UIActions} from '../lib/constants/ui'; import type {UIActions} from './constants/ui';
import type {ConfigActions} from '../lib/constants/config'; import type {ConfigActions} from './constants/config';
import type {SessionActions} from '../lib/constants/sessions'; import type {SessionActions} from './constants/sessions';
import type {NotificationActions} from '../lib/constants/notifications'; import type {NotificationActions} from './constants/notifications';
import type {UpdateActions} from '../lib/constants/updater'; import type {UpdateActions} from './constants/updater';
import type {TermGroupActions} from '../lib/constants/term-groups'; import type {TermGroupActions} from './constants/term-groups';
import type {InitActions} from '../lib/constants'; import type {InitActions} from './constants';
import type {TabActions} from '../lib/constants/tabs'; import type {TabActions} from './constants/tabs';
export type HyperActions = ( export type HyperActions = (
| UIActions | UIActions

View file

@ -72,7 +72,7 @@ const config: webpack.Configuration[] = [
mode: 'none', mode: 'none',
name: 'hyper', name: 'hyper',
resolve: { resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'] extensions: ['.js', '.jsx', '.ts', '.tsx', '.d.ts']
}, },
devtool: isProd ? 'hidden-source-map' : 'cheap-module-source-map', devtool: isProd ? 'hidden-source-map' : 'cheap-module-source-map',
entry: './lib/index.tsx', entry: './lib/index.tsx',