diff --git a/extension/src/browser/extension/manifest.json b/extension/chrome/manifest.json similarity index 100% rename from extension/src/browser/extension/manifest.json rename to extension/chrome/manifest.json diff --git a/extension/src/browser/firefox/manifest.json b/extension/firefox/manifest.json similarity index 100% rename from extension/src/browser/firefox/manifest.json rename to extension/firefox/manifest.json diff --git a/extension/src/app/containers/Actions.tsx b/extension/src/app/Actions.tsx similarity index 96% rename from extension/src/app/containers/Actions.tsx rename to extension/src/app/Actions.tsx index c821afe4..bf1c6f39 100644 --- a/extension/src/app/containers/Actions.tsx +++ b/extension/src/app/Actions.tsx @@ -19,8 +19,8 @@ import { } from '@redux-devtools/app'; 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 { Position } from '../pageScript/api/openWindow'; +import type { SingleMessage } from '../background/store/apiMiddleware'; type StateProps = ReturnType; type DispatchProps = ResolveThunks; diff --git a/extension/src/app/containers/App.tsx b/extension/src/app/App.tsx similarity index 100% rename from extension/src/app/containers/App.tsx rename to extension/src/app/App.tsx diff --git a/extension/src/app/stores/createStore.ts b/extension/src/app/stores/createStore.ts deleted file mode 100644 index f91dd548..00000000 --- a/extension/src/app/stores/createStore.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { - Action, - createStore, - PreloadedState, - Reducer, - StoreEnhancer, -} from 'redux'; - -export default function configureStore>( - reducer: Reducer, - initialState: PreloadedState | undefined, - enhance: () => StoreEnhancer -) { - return createStore(reducer, initialState, enhance()); -} diff --git a/extension/src/browser/extension/background/contextMenus.ts b/extension/src/background/contextMenus.ts similarity index 100% rename from extension/src/browser/extension/background/contextMenus.ts rename to extension/src/background/contextMenus.ts diff --git a/extension/src/browser/extension/background/index.ts b/extension/src/background/index.ts similarity index 86% rename from extension/src/browser/extension/background/index.ts rename to extension/src/background/index.ts index 165b1af0..c7236e2e 100644 --- a/extension/src/browser/extension/background/index.ts +++ b/extension/src/background/index.ts @@ -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 { BackgroundState } from './store/backgroundReducer'; declare global { interface Window { diff --git a/extension/src/browser/extension/background/logging.ts b/extension/src/background/logging.ts similarity index 100% rename from extension/src/browser/extension/background/logging.ts rename to extension/src/background/logging.ts diff --git a/extension/src/browser/extension/background/openWindow.ts b/extension/src/background/openWindow.ts similarity index 100% rename from extension/src/browser/extension/background/openWindow.ts rename to extension/src/background/openWindow.ts diff --git a/extension/src/app/middlewares/api.ts b/extension/src/background/store/apiMiddleware.ts similarity index 96% rename from extension/src/app/middlewares/api.ts rename to extension/src/background/store/apiMiddleware.ts index c8cb8937..fb132e1d 100644 --- a/extension/src/app/middlewares/api.ts +++ b/extension/src/background/store/apiMiddleware.ts @@ -15,28 +15,23 @@ import syncOptions, { Options, OptionsMessage, SyncOptions, -} from '../../browser/extension/options/syncOptions'; -import openDevToolsWindow, { - DevToolsPosition, -} from '../../browser/extension/background/openWindow'; -import { getReport } from '../../browser/extension/background/logging'; +} from '../../options/syncOptions'; +import openDevToolsWindow, { DevToolsPosition } from '../openWindow'; +import { getReport } from '../logging'; import { Action, Dispatch, MiddlewareAPI } from 'redux'; -import { +import type { ContentScriptToBackgroundMessage, SplitMessage, -} from '../../browser/extension/inject/contentScript'; -import { +} from '../../contentScript'; +import type { ErrorMessage, PageScriptToContentScriptMessageForwardedToMonitors, PageScriptToContentScriptMessageWithoutDisconnectOrInitInstance, -} from '../api'; +} from '../../pageScript/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 '../../pageScript/api/openWindow'; +import type { BackgroundState } from './backgroundReducer'; interface TabMessageBase { readonly type: string; diff --git a/extension/src/app/reducers/background/index.ts b/extension/src/background/store/backgroundReducer.ts similarity index 84% rename from extension/src/app/reducers/background/index.ts rename to extension/src/background/store/backgroundReducer.ts index bea610c0..01ca5a02 100644 --- a/extension/src/app/reducers/background/index.ts +++ b/extension/src/background/store/backgroundReducer.ts @@ -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; diff --git a/extension/src/app/stores/backgroundStore.ts b/extension/src/background/store/backgroundStore.ts similarity index 93% rename from extension/src/app/stores/backgroundStore.ts rename to extension/src/background/store/backgroundStore.ts index 55eed9e4..da72bdd4 100644 --- a/extension/src/app/stores/backgroundStore.ts +++ b/extension/src/background/store/backgroundStore.ts @@ -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; diff --git a/extension/src/browser/extension/chromeAPIMock.ts b/extension/src/chromeApiMock.ts similarity index 100% rename from extension/src/browser/extension/chromeAPIMock.ts rename to extension/src/chromeApiMock.ts diff --git a/extension/src/browser/extension/inject/contentScript.ts b/extension/src/contentScript/index.ts similarity index 98% rename from extension/src/browser/extension/inject/contentScript.ts rename to extension/src/contentScript/index.ts index 61c49e85..2c65ee14 100644 --- a/extension/src/browser/extension/inject/contentScript.ts +++ b/extension/src/contentScript/index.ts @@ -3,12 +3,12 @@ import { getOptionsFromBg, isAllowed, } from '../options/syncOptions'; -import { TabMessage } from '../../../app/middlewares/api'; -import { +import type { TabMessage } from '../background/store/apiMiddleware'; +import type { PageScriptToContentScriptMessage, PageScriptToContentScriptMessageWithoutDisconnect, PageScriptToContentScriptMessageWithoutDisconnectOrInitInstance, -} from '../../../app/api'; +} from '../pageScript/api'; import { Action } from 'redux'; import { CustomAction, diff --git a/extension/src/browser/views/devpanel.pug b/extension/src/devpanel/devpanel.pug similarity index 82% rename from extension/src/browser/views/devpanel.pug rename to extension/src/devpanel/devpanel.pug index ee41747c..4aa1268d 100644 --- a/extension/src/browser/views/devpanel.pug +++ b/extension/src/devpanel/devpanel.pug @@ -1,15 +1,15 @@ -doctype html - -html - head - meta(charset='UTF-8') - title Redux DevTools - include ./includes/style.pug - style. - body { - min-height: 100px; - } - - body - #root - script(src='/devpanel.bundle.js') +doctype html + +html + head + meta(charset='UTF-8') + title Redux DevTools + include ../style.pug + style. + body { + min-height: 100px; + } + + body + #root + script(src='/devpanel.bundle.js') diff --git a/extension/src/browser/extension/devpanel/index.tsx b/extension/src/devpanel/index.tsx similarity index 91% rename from extension/src/browser/extension/devpanel/index.tsx rename to extension/src/devpanel/index.tsx index af4fbfc3..aef0e752 100644 --- a/extension/src/browser/extension/devpanel/index.tsx +++ b/extension/src/devpanel/index.tsx @@ -3,13 +3,13 @@ import { createRoot, Root } from 'react-dom/client'; import { Provider } from 'react-redux'; import { Persistor } from 'redux-persist'; import { REMOVE_INSTANCE, StoreAction } from '@redux-devtools/app'; -import App from '../../../app/containers/App'; -import configureStore from '../../../app/stores/panelStore'; +import App from '../app/App'; +import configureStore from './store/panelStore'; -import '../../views/devpanel.pug'; +import './devpanel.pug'; import { Action, Store } from 'redux'; -import { PanelMessage } from '../../../app/middlewares/api'; -import { StoreStateWithoutSocket } from '../../../app/reducers/panel'; +import type { PanelMessage } from '../background/store/apiMiddleware'; +import type { StoreStateWithoutSocket } from './store/panelReducer'; import { PersistGate } from 'redux-persist/integration/react'; const position = location.hash; diff --git a/extension/src/app/reducers/panel/index.ts b/extension/src/devpanel/store/panelReducer.ts similarity index 100% rename from extension/src/app/reducers/panel/index.ts rename to extension/src/devpanel/store/panelReducer.ts diff --git a/extension/src/app/stores/panelStore.ts b/extension/src/devpanel/store/panelStore.ts similarity index 86% rename from extension/src/app/stores/panelStore.ts rename to extension/src/devpanel/store/panelStore.ts index 873e7284..f8b8e622 100644 --- a/extension/src/app/stores/panelStore.ts +++ b/extension/src/devpanel/store/panelStore.ts @@ -2,8 +2,8 @@ import { createStore, applyMiddleware, Reducer } from 'redux'; import localForage from 'localforage'; import { persistReducer, persistStore } from 'redux-persist'; import { exportStateMiddleware, StoreAction } from '@redux-devtools/app'; -import panelDispatcher from '../middlewares/panelSync'; -import rootReducer, { StoreStateWithoutSocket } from '../reducers/panel'; +import panelDispatcher from './panelSyncMiddleware'; +import rootReducer, { StoreStateWithoutSocket } from './panelReducer'; const persistConfig = { key: 'redux-devtools', diff --git a/extension/src/app/middlewares/panelSync.ts b/extension/src/devpanel/store/panelSyncMiddleware.ts similarity index 100% rename from extension/src/app/middlewares/panelSync.ts rename to extension/src/devpanel/store/panelSyncMiddleware.ts diff --git a/extension/src/browser/views/devtools.pug b/extension/src/devtools/devtools.pug similarity index 93% rename from extension/src/browser/views/devtools.pug rename to extension/src/devtools/devtools.pug index 7a361b53..c9f56539 100644 --- a/extension/src/browser/views/devtools.pug +++ b/extension/src/devtools/devtools.pug @@ -1,10 +1,10 @@ -doctype html - -html - head - meta(charset='UTF-8') - title Redux DevTools - - body - #root - script(src='/devtools.bundle.js') +doctype html + +html + head + meta(charset='UTF-8') + title Redux DevTools + + body + #root + script(src='/devtools.bundle.js') diff --git a/extension/src/browser/extension/devtools/index.ts b/extension/src/devtools/index.ts similarity index 92% rename from extension/src/browser/extension/devtools/index.ts rename to extension/src/devtools/index.ts index de6abaaa..cdd376b6 100644 --- a/extension/src/browser/extension/devtools/index.ts +++ b/extension/src/devtools/index.ts @@ -1,4 +1,4 @@ -import '../../views/devtools.pug'; +import './devtools.pug'; function createPanel(url: string) { chrome.devtools.panels.create( diff --git a/extension/src/browser/extension/options/AllowToRunGroup.tsx b/extension/src/options/AllowToRunGroup.tsx similarity index 100% rename from extension/src/browser/extension/options/AllowToRunGroup.tsx rename to extension/src/options/AllowToRunGroup.tsx diff --git a/extension/src/browser/extension/options/ContextMenuGroup.tsx b/extension/src/options/ContextMenuGroup.tsx similarity index 100% rename from extension/src/browser/extension/options/ContextMenuGroup.tsx rename to extension/src/options/ContextMenuGroup.tsx diff --git a/extension/src/browser/extension/options/EditorGroup.tsx b/extension/src/options/EditorGroup.tsx similarity index 100% rename from extension/src/browser/extension/options/EditorGroup.tsx rename to extension/src/options/EditorGroup.tsx diff --git a/extension/src/browser/extension/options/FilterGroup.tsx b/extension/src/options/FilterGroup.tsx similarity index 97% rename from extension/src/browser/extension/options/FilterGroup.tsx rename to extension/src/options/FilterGroup.tsx index 56c050f1..792ca9f4 100644 --- a/extension/src/browser/extension/options/FilterGroup.tsx +++ b/extension/src/options/FilterGroup.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { FilterState } from '../../../app/api/filters'; +import { FilterState } from '../pageScript/api/filters'; import { OptionsProps } from './Options'; export default ({ options, saveOption }: OptionsProps) => { diff --git a/extension/src/browser/extension/options/MiscellaneousGroup.tsx b/extension/src/options/MiscellaneousGroup.tsx similarity index 100% rename from extension/src/browser/extension/options/MiscellaneousGroup.tsx rename to extension/src/options/MiscellaneousGroup.tsx diff --git a/extension/src/browser/extension/options/Options.tsx b/extension/src/options/Options.tsx similarity index 100% rename from extension/src/browser/extension/options/Options.tsx rename to extension/src/options/Options.tsx diff --git a/extension/src/browser/extension/options/index.tsx b/extension/src/options/index.tsx similarity index 95% rename from extension/src/browser/extension/options/index.tsx rename to extension/src/options/index.tsx index b344b86b..181fa1b1 100644 --- a/extension/src/browser/extension/options/index.tsx +++ b/extension/src/options/index.tsx @@ -3,7 +3,7 @@ import { createRoot } from 'react-dom/client'; import OptionsComponent from './Options'; import { Options } from './syncOptions'; -import '../../views/options.pug'; +import './options.pug'; chrome.runtime.getBackgroundPage((background) => { const syncOptions = background!.syncOptions; diff --git a/extension/src/browser/views/options.pug b/extension/src/options/options.pug similarity index 95% rename from extension/src/browser/views/options.pug rename to extension/src/options/options.pug index 6e2dda01..48192b6a 100644 --- a/extension/src/browser/views/options.pug +++ b/extension/src/options/options.pug @@ -1,93 +1,93 @@ -doctype html - -html - head - meta(charset='UTF-8') - title Redux DevTools Options - style. - body { - padding: 2px; - min-width: 380px; - } - - .option-group { - /* Reset the default fieldset styles */ - margin: initial; - border: initial; - padding: initial; - } - - .option-group + .option-group { - margin-top: 30px; - } - - .option-group__title { - /* Reset the default legend styles */ - margin: initial; - padding: initial; - - margin-bottom: 8px; - font-weight: bold; - font-size: 30px; - } - - .option + .option { - margin-top: 5px; - } - - .option__textarea { - margin-top: 2px; - width: 300px; - min-height: 50px; - } - - .option__hint { - margin-top: 2px; - font-size: 10px; - } - - .option__textarea + .option__hint { - margin-top: -2px; - } - - /* Checkbox and radio styling */ - .option_type_checkbox .option__element, - .option_type_radio .option__element { - vertical-align: bottom; - } - - .option_type_checkbox .option__label, - .option_type_radio .option__label { - margin-left: 4px; - } - - .option_type_checkbox .option__textarea, - .option_type_checkbox .option__hint, - .option_type_radio .option__textarea, - .option_type_radio .option__hint { - margin-left: 20px; - } - - - /* Checkbox styling */ - .option_type_checkbox .option__element { - /* Checkboxes in Chrome are 2px narrower than radio buttons. - These margins align them. */ - margin-left: 1px; - /* ...margin-right is 2px instead of 1px - because both radios and checkboxes have initial margin-right of 1px */ - margin-right: 2px; - } - - /* Value-based styling */ - .option_value_max-age { - margin-left: 20px; - } - - .option_value_max-age .option__element { - width: 50px; - } - - body - #root - script(src='/options.bundle.js') +doctype html + +html + head + meta(charset='UTF-8') + title Redux DevTools Options + style. + body { + padding: 2px; + min-width: 380px; + } + + .option-group { + /* Reset the default fieldset styles */ + margin: initial; + border: initial; + padding: initial; + } + + .option-group + .option-group { + margin-top: 30px; + } + + .option-group__title { + /* Reset the default legend styles */ + margin: initial; + padding: initial; + + margin-bottom: 8px; + font-weight: bold; + font-size: 30px; + } + + .option + .option { + margin-top: 5px; + } + + .option__textarea { + margin-top: 2px; + width: 300px; + min-height: 50px; + } + + .option__hint { + margin-top: 2px; + font-size: 10px; + } + + .option__textarea + .option__hint { + margin-top: -2px; + } + + /* Checkbox and radio styling */ + .option_type_checkbox .option__element, + .option_type_radio .option__element { + vertical-align: bottom; + } + + .option_type_checkbox .option__label, + .option_type_radio .option__label { + margin-left: 4px; + } + + .option_type_checkbox .option__textarea, + .option_type_checkbox .option__hint, + .option_type_radio .option__textarea, + .option_type_radio .option__hint { + margin-left: 20px; + } + + + /* Checkbox styling */ + .option_type_checkbox .option__element { + /* Checkboxes in Chrome are 2px narrower than radio buttons. + These margins align them. */ + margin-left: 1px; + /* ...margin-right is 2px instead of 1px + because both radios and checkboxes have initial margin-right of 1px */ + margin-right: 2px; + } + + /* Value-based styling */ + .option_value_max-age { + margin-left: 20px; + } + + .option_value_max-age .option__element { + width: 50px; + } + + body + #root + script(src='/options.bundle.js') diff --git a/extension/src/browser/extension/options/syncOptions.ts b/extension/src/options/syncOptions.ts similarity index 98% rename from extension/src/browser/extension/options/syncOptions.ts rename to extension/src/options/syncOptions.ts index ede4b150..e523c598 100644 --- a/extension/src/browser/extension/options/syncOptions.ts +++ b/extension/src/options/syncOptions.ts @@ -1,4 +1,4 @@ -import { FilterState, FilterStateValue } from '../../../app/api/filters'; +import { FilterState, FilterStateValue } from '../pageScript/api/filters'; export interface Options { readonly useEditor: number; diff --git a/extension/src/app/service/Monitor.ts b/extension/src/pageScript/Monitor.ts similarity index 100% rename from extension/src/app/service/Monitor.ts rename to extension/src/pageScript/Monitor.ts diff --git a/extension/src/app/api/filters.ts b/extension/src/pageScript/api/filters.ts similarity index 100% rename from extension/src/app/api/filters.ts rename to extension/src/pageScript/api/filters.ts diff --git a/extension/src/app/api/generateInstanceId.ts b/extension/src/pageScript/api/generateInstanceId.ts similarity index 100% rename from extension/src/app/api/generateInstanceId.ts rename to extension/src/pageScript/api/generateInstanceId.ts diff --git a/extension/src/app/api/importState.ts b/extension/src/pageScript/api/importState.ts similarity index 95% rename from extension/src/app/api/importState.ts rename to extension/src/pageScript/api/importState.ts index 70bda05e..ae818149 100644 --- a/extension/src/app/api/importState.ts +++ b/extension/src/pageScript/api/importState.ts @@ -1,9 +1,6 @@ import jsan from 'jsan'; import { immutableSerialize } from '@redux-devtools/serialize'; -import { - Config, - SerializeWithImmutable, -} from '../../browser/extension/inject/pageScript'; +import type { Config, SerializeWithImmutable } from '../index'; import Immutable from 'immutable'; import { LiftedState } from '@redux-devtools/instrument'; import { Action } from 'redux'; diff --git a/extension/src/app/api/index.ts b/extension/src/pageScript/api/index.ts similarity index 99% rename from extension/src/app/api/index.ts rename to extension/src/pageScript/api/index.ts index e0e6c3a9..ed062fe9 100644 --- a/extension/src/app/api/index.ts +++ b/extension/src/pageScript/api/index.ts @@ -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 '../index'; 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'; +} from '../../contentScript'; +import type { Position } from './openWindow'; const listeners: { [instanceId: string]: diff --git a/extension/src/app/api/notifyErrors.ts b/extension/src/pageScript/api/notifyErrors.ts similarity index 100% rename from extension/src/app/api/notifyErrors.ts rename to extension/src/pageScript/api/notifyErrors.ts diff --git a/extension/src/app/api/openWindow.ts b/extension/src/pageScript/api/openWindow.ts similarity index 86% rename from extension/src/app/api/openWindow.ts rename to extension/src/pageScript/api/openWindow.ts index 51f9d145..53704b58 100644 --- a/extension/src/app/api/openWindow.ts +++ b/extension/src/pageScript/api/openWindow.ts @@ -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'; diff --git a/extension/src/app/stores/enhancerStore.ts b/extension/src/pageScript/enhancerStore.ts similarity index 93% rename from extension/src/app/stores/enhancerStore.ts rename to extension/src/pageScript/enhancerStore.ts index 532cfccb..5961292f 100644 --- a/extension/src/app/stores/enhancerStore.ts +++ b/extension/src/pageScript/enhancerStore.ts @@ -1,7 +1,7 @@ import { Action, compose, Reducer, StoreEnhancerStoreCreator } from 'redux'; import { instrument } from '@redux-devtools/instrument'; import { persistState } from '@redux-devtools/core'; -import { ConfigWithExpandedMaxAge } from '../../browser/extension/inject/pageScript'; +import type { ConfigWithExpandedMaxAge } from './index'; export function getUrlParam(key: string) { const matches = window.location.href.match( diff --git a/extension/src/browser/extension/inject/pageScript.ts b/extension/src/pageScript/index.ts similarity index 97% rename from extension/src/browser/extension/inject/pageScript.ts rename to extension/src/pageScript/index.ts index a0d48399..2b875ff1 100644 --- a/extension/src/browser/extension/inject/pageScript.ts +++ b/extension/src/pageScript/index.ts @@ -27,19 +27,19 @@ import { LibConfig, Features, } from '@redux-devtools/app'; -import configureStore, { getUrlParam } from '../../../app/stores/enhancerStore'; +import configureStore, { getUrlParam } from './enhancerStore'; import { isAllowed, Options } from '../options/syncOptions'; -import Monitor from '../../../app/service/Monitor'; +import Monitor from './Monitor'; import { noFiltersApplied, isFiltered, filterState, startingFrom, -} from '../../../app/api/filters'; -import notifyErrors from '../../../app/api/notifyErrors'; -import importState from '../../../app/api/importState'; -import openWindow, { Position } from '../../../app/api/openWindow'; -import generateId from '../../../app/api/generateInstanceId'; +} from './api/filters'; +import notifyErrors from './api/notifyErrors'; +import importState from './api/importState'; +import openWindow, { Position } from './api/openWindow'; +import generateId from './api/generateInstanceId'; import { toContentScript, sendMessage, @@ -51,8 +51,8 @@ import { Serialize, StructuralPerformAction, ConnectResponse, -} from '../../../app/api'; -import { ContentScriptToPageScriptMessage } from './contentScript'; +} from './api'; +import type { ContentScriptToPageScriptMessage } from '../contentScript'; type EnhancedStoreWithInitialDispatch< S, diff --git a/extension/src/browser/extension/inject/pageScriptWrap.ts b/extension/src/pageScriptWrap.ts similarity index 100% rename from extension/src/browser/extension/inject/pageScriptWrap.ts rename to extension/src/pageScriptWrap.ts diff --git a/extension/src/browser/extension/window/remote.tsx b/extension/src/remote/index.tsx similarity index 96% rename from extension/src/browser/extension/window/remote.tsx rename to extension/src/remote/index.tsx index f91c372a..af100aca 100644 --- a/extension/src/browser/extension/window/remote.tsx +++ b/extension/src/remote/index.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { createRoot } from 'react-dom/client'; import { Root } from '@redux-devtools/app'; -import '../../views/remote.pug'; +import './remote.pug'; chrome.storage.local.get( { diff --git a/extension/src/browser/views/remote.pug b/extension/src/remote/remote.pug similarity index 78% rename from extension/src/browser/views/remote.pug rename to extension/src/remote/remote.pug index c70bc7f5..259bd8f4 100644 --- a/extension/src/browser/views/remote.pug +++ b/extension/src/remote/remote.pug @@ -1,11 +1,11 @@ -doctype html - -html - head - meta(charset='UTF-8') - title RemoteDev - include ./includes/style.pug - - body - #root - script(src='/remote.bundle.js') +doctype html + +html + head + meta(charset='UTF-8') + title RemoteDev + include ../style.pug + + body + #root + script(src='/remote.bundle.js') diff --git a/extension/src/browser/views/includes/style.pug b/extension/src/style.pug similarity index 100% rename from extension/src/browser/views/includes/style.pug rename to extension/src/style.pug diff --git a/extension/src/browser/extension/window/index.tsx b/extension/src/window/index.tsx similarity index 84% rename from extension/src/browser/extension/window/index.tsx rename to extension/src/window/index.tsx index 41b72b08..c74e33a1 100644 --- a/extension/src/browser/extension/window/index.tsx +++ b/extension/src/window/index.tsx @@ -3,11 +3,11 @@ import { createRoot } from 'react-dom/client'; import { Provider } from 'react-redux'; 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 App from '../app/App'; +import configureStore from './store/windowStore'; +import type { MonitorMessage } from '../background/store/apiMiddleware'; -import '../../views/window.pug'; +import './window.pug'; const position = location.hash; diff --git a/extension/src/app/middlewares/instanceSelector.ts b/extension/src/window/store/instanceSelectorMiddleware.ts similarity index 100% rename from extension/src/app/middlewares/instanceSelector.ts rename to extension/src/window/store/instanceSelectorMiddleware.ts diff --git a/extension/src/app/reducers/window/instances.ts b/extension/src/window/store/instancesReducer.ts similarity index 94% rename from extension/src/app/reducers/window/instances.ts rename to extension/src/window/store/instancesReducer.ts index 6ef0cad3..cc39478b 100644 --- a/extension/src/app/reducers/window/instances.ts +++ b/extension/src/window/store/instancesReducer.ts @@ -6,10 +6,10 @@ import { LIFTED_ACTION, SET_PERSIST, } from '@redux-devtools/app'; -import { +import type { ExpandedUpdateStateAction, WindowStoreAction, -} from '../../stores/windowStore'; +} from './windowStore'; export default function instances( state = instancesInitialState, diff --git a/extension/src/app/reducers/window/index.ts b/extension/src/window/store/windowReducer.ts similarity index 80% rename from extension/src/app/reducers/window/index.ts rename to extension/src/window/store/windowReducer.ts index 3ec4ddf3..9a14cd3b 100644 --- a/extension/src/app/reducers/window/index.ts +++ b/extension/src/window/store/windowReducer.ts @@ -9,8 +9,8 @@ import { theme, StoreState, } from '@redux-devtools/app'; -import instances from './instances'; -import { WindowStoreAction } from '../../stores/windowStore'; +import instances from './instancesReducer'; +import type { WindowStoreAction } from './windowStore'; const rootReducer: Reducer = combineReducers({ diff --git a/extension/src/app/stores/windowStore.ts b/extension/src/window/store/windowStore.ts similarity index 81% rename from extension/src/app/stores/windowStore.ts rename to extension/src/window/store/windowStore.ts index 186203ab..f63002ae 100644 --- a/extension/src/app/stores/windowStore.ts +++ b/extension/src/window/store/windowStore.ts @@ -17,12 +17,15 @@ import { StoreState, UpdateStateAction, } from '@redux-devtools/app'; -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 syncStores from './windowSyncMiddleware'; +import instanceSelector from './instanceSelectorMiddleware'; +import rootReducer from './windowReducer'; +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; diff --git a/extension/src/app/middlewares/windowSync.ts b/extension/src/window/store/windowSyncMiddleware.ts similarity index 80% rename from extension/src/app/middlewares/windowSync.ts rename to extension/src/window/store/windowSyncMiddleware.ts index e6c2c599..6f9f9cf7 100644 --- a/extension/src/app/middlewares/windowSync.ts +++ b/extension/src/window/store/windowSyncMiddleware.ts @@ -7,9 +7,9 @@ import { UPDATE_STATE, } from '@redux-devtools/app'; import { Dispatch, MiddlewareAPI, Store } from 'redux'; -import { BackgroundState } from '../reducers/background'; -import { WindowStoreAction } from '../stores/windowStore'; -import { BackgroundAction } from '../stores/backgroundStore'; +import type { BackgroundState } from '../../background/store/backgroundReducer'; +import type { WindowStoreAction } from './windowStore'; +import type { BackgroundAction } from '../../background/store/backgroundStore'; const syncStores = (baseStore: Store) => diff --git a/extension/src/browser/views/window.pug b/extension/src/window/window.pug similarity index 89% rename from extension/src/browser/views/window.pug rename to extension/src/window/window.pug index 4ea83033..630a3edf 100644 --- a/extension/src/browser/views/window.pug +++ b/extension/src/window/window.pug @@ -1,17 +1,17 @@ -doctype html - -html - head - meta(charset='UTF-8') - title Redux DevTools - include ./includes/style.pug - - body - #root - div(style='position: relative') - img( - src='/img/loading.svg', - height=300, width=350, - style='position: absolute; top: 50%; left: 50%; margin-top: -175px; margin-left: -175px;' - ) - script(src='/window.bundle.js') +doctype html + +html + head + meta(charset='UTF-8') + title Redux DevTools + include ../style.pug + + body + #root + div(style='position: relative') + img( + src='/img/loading.svg', + height=300, width=350, + style='position: absolute; top: 50%; left: 50%; margin-top: -175px; margin-left: -175px;' + ) + script(src='/window.bundle.js') diff --git a/extension/test/app/containers/App.spec.js b/extension/test/app/containers/App.spec.js index 6da2054e..26725311 100644 --- a/extension/test/app/containers/App.spec.js +++ b/extension/test/app/containers/App.spec.js @@ -1,8 +1,8 @@ import React from 'react'; import { render, screen, within } from '@testing-library/react'; import { Provider } from 'react-redux'; -import configureStore from '../../../src/app/stores/windowStore'; -import App from '../../../src/app/containers/App'; +import configureStore from '../../../src/window/store/windowStore'; +import App from '../../../src/app/App'; Object.defineProperty(window, 'matchMedia', { writable: true, diff --git a/extension/test/app/inject/api.spec.js b/extension/test/app/inject/api.spec.js index 0b30f33e..0a06d321 100644 --- a/extension/test/app/inject/api.spec.js +++ b/extension/test/app/inject/api.spec.js @@ -1,5 +1,5 @@ import { insertScript, listenMessage } from '../../utils/inject'; -import '../../../src/browser/extension/inject/pageScript'; +import '../../../src/pageScript'; describe('API', () => { it('should get window.__REDUX_DEVTOOLS_EXTENSION__ function', () => { diff --git a/extension/test/app/inject/enhancer.spec.js b/extension/test/app/inject/enhancer.spec.js index 49229474..c4ce2b88 100644 --- a/extension/test/app/inject/enhancer.spec.js +++ b/extension/test/app/inject/enhancer.spec.js @@ -1,7 +1,7 @@ import '@babel/polyfill'; import { createStore, compose } from 'redux'; import { insertScript, listenMessage } from '../../utils/inject'; -import '../../../src/browser/extension/inject/pageScript'; +import '../../../src/pageScript'; function counter(state = 0, action) { switch (action.type) { diff --git a/extension/webpack/base.config.js b/extension/webpack/base.config.js index b320b890..1f3290ce 100644 --- a/extension/webpack/base.config.js +++ b/extension/webpack/base.config.js @@ -3,21 +3,30 @@ import webpack from 'webpack'; import CopyPlugin from 'copy-webpack-plugin'; import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'; -const extpath = path.join(__dirname, '../src/browser/extension/'); -const mock = `${extpath}chromeAPIMock`; - const baseConfig = (params) => ({ // devtool: 'source-map', mode: params.mode, entry: params.input || { - background: [mock, `${extpath}background/index`], - options: [mock, `${extpath}options/index`], - window: [`${extpath}window/index`], - remote: [`${extpath}window/remote`], - devpanel: [mock, `${extpath}devpanel/index`], - devtools: [`${extpath}devtools/index`], - content: [mock, `${extpath}inject/contentScript`], - pagewrap: [`${extpath}inject/pageScriptWrap`], + background: [ + path.resolve(__dirname, '../src/chromeApiMock'), + path.resolve(__dirname, '../src/background/index'), + ], + options: [ + path.resolve(__dirname, '../src/chromeApiMock'), + path.resolve(__dirname, '../src/options/index'), + ], + window: [path.resolve(__dirname, '../src/window/index')], + remote: [path.resolve(__dirname, '../src/remote/index')], + devpanel: [ + path.resolve(__dirname, '../src/chromeApiMock'), + path.resolve(__dirname, '../src/devpanel/index'), + ], + devtools: [path.resolve(__dirname, '../src/devtools/index')], + content: [ + path.resolve(__dirname, '../src/chromeApiMock'), + path.resolve(__dirname, '../src/contentScript/index'), + ], + pagewrap: [path.resolve(__dirname, '../src/pageScriptWrap')], ...params.inputExtra, }, output: { diff --git a/extension/webpack/dev.config.babel.js b/extension/webpack/dev.config.babel.js index cca1fa78..6abb9178 100644 --- a/extension/webpack/dev.config.babel.js +++ b/extension/webpack/dev.config.babel.js @@ -5,7 +5,7 @@ import baseConfig from './base.config'; let config = baseConfig({ mode: 'development', inputExtra: { - page: [path.join(__dirname, '../src/browser/extension/inject/pageScript')], + page: [path.join(__dirname, '../src/pageScript')], }, output: { path: path.join(__dirname, '../dev') }, globals: { @@ -15,10 +15,7 @@ let config = baseConfig({ }, plugins: [new webpack.NoEmitOnErrorsPlugin()], copy: true, - manifestJsonPath: path.join( - __dirname, - '../src/browser/extension/manifest.json' - ), + manifestJsonPath: path.join(__dirname, '../chrome/manifest.json'), }); config.watch = true; diff --git a/extension/webpack/prod.config.babel.js b/extension/webpack/prod.config.babel.js index ff04e735..c29e9924 100644 --- a/extension/webpack/prod.config.babel.js +++ b/extension/webpack/prod.config.babel.js @@ -4,7 +4,7 @@ import baseConfig from './base.config'; export default baseConfig({ mode: 'production', inputExtra: { - page: [path.join(__dirname, '../src/browser/extension/inject/pageScript')], + page: [path.join(__dirname, '../src/pageScript')], }, output: { path: path.join(__dirname, '../build/extension') }, globals: { @@ -13,8 +13,5 @@ export default baseConfig({ }, }, copy: true, - manifestJsonPath: path.join( - __dirname, - '../src/browser/extension/manifest.json' - ), + manifestJsonPath: path.join(__dirname, '../chrome/manifest.json'), }); diff --git a/extension/webpack/prod.firefox.config.babel.js b/extension/webpack/prod.firefox.config.babel.js index 54fdf8b9..f14b8d35 100644 --- a/extension/webpack/prod.firefox.config.babel.js +++ b/extension/webpack/prod.firefox.config.babel.js @@ -10,8 +10,5 @@ export default baseConfig({ }, }, copy: true, - manifestJsonPath: path.join( - __dirname, - '../src/browser/firefox/manifest.json' - ), + manifestJsonPath: path.join(__dirname, '../firefox/manifest.json'), }); diff --git a/extension/webpack/wrap.config.babel.js b/extension/webpack/wrap.config.babel.js index 25b57d11..ced8a881 100644 --- a/extension/webpack/wrap.config.babel.js +++ b/extension/webpack/wrap.config.babel.js @@ -4,7 +4,7 @@ import baseConfig from './base.config'; export default baseConfig({ mode: 'production', input: { - page: [path.join(__dirname, '../src/browser/extension/inject/pageScript')], + page: [path.join(__dirname, '../src/pageScript')], }, output: { path: path.join(__dirname, '../build/tmp') }, globals: {