Move background to top-level

This commit is contained in:
Nathan Bierema 2022-10-10 09:06:01 -04:00
parent 35fb3343f5
commit 1dcf198071
17 changed files with 31 additions and 35 deletions

View File

@ -1,6 +1,6 @@
import jsan from 'jsan';
import { immutableSerialize } from '@redux-devtools/serialize';
import {
import type {
Config,
SerializeWithImmutable,
} from '../../browser/extension/inject/pageScript';

View File

@ -5,15 +5,15 @@ import { getActionsArray, getLocalFilter } from '@redux-devtools/utils';
import { isFiltered, PartialLiftedState } from './filters';
import importState from './importState';
import generateId from './generateInstanceId';
import { Config } from '../../browser/extension/inject/pageScript';
import type { Config } from '../../browser/extension/inject/pageScript';
import { Action } from 'redux';
import { LiftedState, PerformAction } from '@redux-devtools/instrument';
import { LibConfig } from '@redux-devtools/app';
import {
import type {
ContentScriptToPageScriptMessage,
ListenerMessage,
} from '../../browser/extension/inject/contentScript';
import { Position } from './openWindow';
import type { Position } from './openWindow';
const listeners: {
[instanceId: string]:

View File

@ -1,5 +1,5 @@
import { Action } from 'redux';
import { PageScriptToContentScriptMessage } from './index';
import type { PageScriptToContentScriptMessage } from './index';
export type Position = 'left' | 'right' | 'bottom' | 'panel' | 'remote';

View File

@ -20,7 +20,7 @@ import {
import { GoRadioTower } from 'react-icons/go';
import { MdBorderBottom, MdBorderLeft, MdBorderRight } from 'react-icons/md';
import { Position } from '../api/openWindow';
import { SingleMessage } from '../middlewares/api';
import type { SingleMessage } from '../../background/store/apiMiddleware';
type StateProps = ReturnType<typeof mapStateToProps>;
type DispatchProps = ResolveThunks<typeof actionCreators>;

View File

@ -7,9 +7,9 @@ import {
UPDATE_STATE,
} from '@redux-devtools/app';
import { Dispatch, MiddlewareAPI, Store } from 'redux';
import { BackgroundState } from '../reducers/background';
import type { BackgroundState } from '../../background/store/backgroundReducer';
import { WindowStoreAction } from '../stores/windowStore';
import { BackgroundAction } from '../stores/backgroundStore';
import type { BackgroundAction } from '../../background/store/backgroundStore';
const syncStores =
(baseStore: Store<BackgroundState, BackgroundAction>) =>

View File

@ -20,9 +20,12 @@ import {
import syncStores from '../middlewares/windowSync';
import instanceSelector from '../middlewares/instanceSelector';
import rootReducer from '../reducers/window';
import { BackgroundState } from '../reducers/background';
import { BackgroundAction } from './backgroundStore';
import { EmptyUpdateStateAction, NAAction } from '../middlewares/api';
import type { BackgroundState } from '../../background/store/backgroundReducer';
import type { BackgroundAction } from '../../background/store/backgroundStore';
import type {
EmptyUpdateStateAction,
NAAction,
} from '../../background/store/apiMiddleware';
export interface ExpandedUpdateStateAction extends UpdateStateAction {
readonly instances: InstancesState;

View File

@ -1,11 +1,9 @@
import { Store } from 'redux';
import configureStore, {
BackgroundAction,
} from '../../../app/stores/backgroundStore';
import configureStore, { BackgroundAction } from './store/backgroundStore';
import openDevToolsWindow, { DevToolsPosition } from './openWindow';
import { createMenu, removeMenu } from './contextMenus';
import syncOptions from '../options/syncOptions';
import { BackgroundState } from '../../../app/reducers/background';
import syncOptions from '../browser/extension/options/syncOptions';
import { BackgroundState } from './store/backgroundReducer';
declare global {
interface Window {

View File

@ -16,27 +16,22 @@ import syncOptions, {
OptionsMessage,
SyncOptions,
} from '../../browser/extension/options/syncOptions';
import openDevToolsWindow, {
DevToolsPosition,
} from '../../browser/extension/background/openWindow';
import { getReport } from '../../browser/extension/background/logging';
import openDevToolsWindow, { DevToolsPosition } from '../openWindow';
import { getReport } from '../logging';
import { Action, Dispatch, MiddlewareAPI } from 'redux';
import {
ContentScriptToBackgroundMessage,
SplitMessage,
} from '../../browser/extension/inject/contentScript';
import {
import type {
ErrorMessage,
PageScriptToContentScriptMessageForwardedToMonitors,
PageScriptToContentScriptMessageWithoutDisconnectOrInitInstance,
} from '../api';
} from '../../app/api';
import { LiftedState } from '@redux-devtools/instrument';
import {
BackgroundAction,
LiftedActionAction,
} from '../stores/backgroundStore';
import { Position } from '../api/openWindow';
import { BackgroundState } from '../reducers/background';
import type { BackgroundAction, LiftedActionAction } from './backgroundStore';
import type { Position } from '../../app/api/openWindow';
import type { BackgroundState } from './backgroundReducer';
interface TabMessageBase {
readonly type: string;

View File

@ -1,6 +1,6 @@
import { combineReducers, Reducer } from 'redux';
import { instances, InstancesState } from '@redux-devtools/app';
import { BackgroundAction } from '../../stores/backgroundStore';
import type { BackgroundAction } from './backgroundStore';
export interface BackgroundState {
readonly instances: InstancesState;

View File

@ -5,8 +5,8 @@ import {
LIFTED_ACTION,
StoreActionWithoutLiftedAction,
} from '@redux-devtools/app';
import rootReducer, { BackgroundState } from '../reducers/background';
import api, { CONNECTED, DISCONNECTED } from '../middlewares/api';
import rootReducer, { BackgroundState } from './backgroundReducer';
import api, { CONNECTED, DISCONNECTED } from './apiMiddleware';
interface LiftedActionActionBase {
action?: DispatchAction | string | CustomAction;

View File

@ -8,7 +8,7 @@ import configureStore from '../../../app/stores/panelStore';
import '../../views/devpanel.pug';
import { Action, Store } from 'redux';
import { PanelMessage } from '../../../app/middlewares/api';
import type { PanelMessage } from '../../../background/store/apiMiddleware';
import { StoreStateWithoutSocket } from '../../../app/reducers/panel';
import { PersistGate } from 'redux-persist/integration/react';

View File

@ -3,7 +3,7 @@ import {
getOptionsFromBg,
isAllowed,
} from '../options/syncOptions';
import { TabMessage } from '../../../app/middlewares/api';
import type { TabMessage } from '../../../background/store/apiMiddleware';
import {
PageScriptToContentScriptMessage,
PageScriptToContentScriptMessageWithoutDisconnect,

View File

@ -5,7 +5,7 @@ import { PersistGate } from 'redux-persist/integration/react';
import { UPDATE_STATE } from '@redux-devtools/app';
import App from '../../../app/containers/App';
import configureStore from '../../../app/stores/windowStore';
import { MonitorMessage } from '../../../app/middlewares/api';
import type { MonitorMessage } from '../../../background/store/apiMiddleware';
import '../../views/window.pug';

View File

@ -10,7 +10,7 @@ const baseConfig = (params) => ({
// devtool: 'source-map',
mode: params.mode,
entry: params.input || {
background: [mock, `${extpath}background/index`],
background: [mock, '../src/background/index'],
options: [mock, `${extpath}options/index`],
window: [`${extpath}window/index`],
remote: [`${extpath}window/remote`],