Refactor extension directory structure (#1248)

* Move background to top-level

* Move devpanel to top-level

* Move devtools to top-level

* Move options to top-level

* Move window to top-level

* Move chromeApiMock to top-level

* Move manifests to top-level

* Move contentScript to top-level

* Move pageScript to top-level

* Update tests

* Update Webpack config

* Fix path
This commit is contained in:
Nathan Bierema 2022-10-10 13:05:28 -04:00 committed by GitHub
parent 35fb3343f5
commit 6cc517d97e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 244 additions and 266 deletions

View File

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

View File

@ -1,15 +0,0 @@
import {
Action,
createStore,
PreloadedState,
Reducer,
StoreEnhancer,
} from 'redux';
export default function configureStore<S, A extends Action<unknown>>(
reducer: Reducer<S, A>,
initialState: PreloadedState<S> | undefined,
enhance: () => StoreEnhancer
) {
return createStore(reducer, initialState, enhance());
}

View File

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

View File

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

View File

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

View File

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

View File

@ -3,12 +3,12 @@ import {
getOptionsFromBg, getOptionsFromBg,
isAllowed, isAllowed,
} from '../options/syncOptions'; } from '../options/syncOptions';
import { TabMessage } from '../../../app/middlewares/api'; import type { TabMessage } from '../background/store/apiMiddleware';
import { import type {
PageScriptToContentScriptMessage, PageScriptToContentScriptMessage,
PageScriptToContentScriptMessageWithoutDisconnect, PageScriptToContentScriptMessageWithoutDisconnect,
PageScriptToContentScriptMessageWithoutDisconnectOrInitInstance, PageScriptToContentScriptMessageWithoutDisconnectOrInitInstance,
} from '../../../app/api'; } from '../pageScript/api';
import { Action } from 'redux'; import { Action } from 'redux';
import { import {
CustomAction, CustomAction,

View File

@ -1,15 +1,15 @@
doctype html doctype html
html html
head head
meta(charset='UTF-8') meta(charset='UTF-8')
title Redux DevTools title Redux DevTools
include ./includes/style.pug include ../style.pug
style. style.
body { body {
min-height: 100px; min-height: 100px;
} }
body body
#root #root
script(src='/devpanel.bundle.js') script(src='/devpanel.bundle.js')

View File

@ -3,13 +3,13 @@ import { createRoot, Root } from 'react-dom/client';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { Persistor } from 'redux-persist'; import { Persistor } from 'redux-persist';
import { REMOVE_INSTANCE, StoreAction } from '@redux-devtools/app'; import { REMOVE_INSTANCE, StoreAction } from '@redux-devtools/app';
import App from '../../../app/containers/App'; import App from '../app/App';
import configureStore from '../../../app/stores/panelStore'; import configureStore from './store/panelStore';
import '../../views/devpanel.pug'; import './devpanel.pug';
import { Action, Store } from 'redux'; 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 type { StoreStateWithoutSocket } from './store/panelReducer';
import { PersistGate } from 'redux-persist/integration/react'; import { PersistGate } from 'redux-persist/integration/react';
const position = location.hash; const position = location.hash;

View File

@ -2,8 +2,8 @@ import { createStore, applyMiddleware, Reducer } from 'redux';
import localForage from 'localforage'; import localForage from 'localforage';
import { persistReducer, persistStore } from 'redux-persist'; import { persistReducer, persistStore } from 'redux-persist';
import { exportStateMiddleware, StoreAction } from '@redux-devtools/app'; import { exportStateMiddleware, StoreAction } from '@redux-devtools/app';
import panelDispatcher from '../middlewares/panelSync'; import panelDispatcher from './panelSyncMiddleware';
import rootReducer, { StoreStateWithoutSocket } from '../reducers/panel'; import rootReducer, { StoreStateWithoutSocket } from './panelReducer';
const persistConfig = { const persistConfig = {
key: 'redux-devtools', key: 'redux-devtools',

View File

@ -1,10 +1,10 @@
doctype html doctype html
html html
head head
meta(charset='UTF-8') meta(charset='UTF-8')
title Redux DevTools title Redux DevTools
body body
#root #root
script(src='/devtools.bundle.js') script(src='/devtools.bundle.js')

View File

@ -1,4 +1,4 @@
import '../../views/devtools.pug'; import './devtools.pug';
function createPanel(url: string) { function createPanel(url: string) {
chrome.devtools.panels.create( chrome.devtools.panels.create(

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { FilterState } from '../../../app/api/filters'; import { FilterState } from '../pageScript/api/filters';
import { OptionsProps } from './Options'; import { OptionsProps } from './Options';
export default ({ options, saveOption }: OptionsProps) => { export default ({ options, saveOption }: OptionsProps) => {

View File

@ -3,7 +3,7 @@ import { createRoot } from 'react-dom/client';
import OptionsComponent from './Options'; import OptionsComponent from './Options';
import { Options } from './syncOptions'; import { Options } from './syncOptions';
import '../../views/options.pug'; import './options.pug';
chrome.runtime.getBackgroundPage((background) => { chrome.runtime.getBackgroundPage((background) => {
const syncOptions = background!.syncOptions; const syncOptions = background!.syncOptions;

View File

@ -1,93 +1,93 @@
doctype html doctype html
html html
head head
meta(charset='UTF-8') meta(charset='UTF-8')
title Redux DevTools Options title Redux DevTools Options
style. style.
body { body {
padding: 2px; padding: 2px;
min-width: 380px; min-width: 380px;
} }
.option-group { .option-group {
/* Reset the default fieldset styles */ /* Reset the default fieldset styles */
margin: initial; margin: initial;
border: initial; border: initial;
padding: initial; padding: initial;
} }
.option-group + .option-group { .option-group + .option-group {
margin-top: 30px; margin-top: 30px;
} }
.option-group__title { .option-group__title {
/* Reset the default legend styles */ /* Reset the default legend styles */
margin: initial; margin: initial;
padding: initial; padding: initial;
margin-bottom: 8px; margin-bottom: 8px;
font-weight: bold; font-weight: bold;
font-size: 30px; font-size: 30px;
} }
.option + .option { .option + .option {
margin-top: 5px; margin-top: 5px;
} }
.option__textarea { .option__textarea {
margin-top: 2px; margin-top: 2px;
width: 300px; width: 300px;
min-height: 50px; min-height: 50px;
} }
.option__hint { .option__hint {
margin-top: 2px; margin-top: 2px;
font-size: 10px; font-size: 10px;
} }
.option__textarea + .option__hint { .option__textarea + .option__hint {
margin-top: -2px; margin-top: -2px;
} }
/* Checkbox and radio styling */ /* Checkbox and radio styling */
.option_type_checkbox .option__element, .option_type_checkbox .option__element,
.option_type_radio .option__element { .option_type_radio .option__element {
vertical-align: bottom; vertical-align: bottom;
} }
.option_type_checkbox .option__label, .option_type_checkbox .option__label,
.option_type_radio .option__label { .option_type_radio .option__label {
margin-left: 4px; margin-left: 4px;
} }
.option_type_checkbox .option__textarea, .option_type_checkbox .option__textarea,
.option_type_checkbox .option__hint, .option_type_checkbox .option__hint,
.option_type_radio .option__textarea, .option_type_radio .option__textarea,
.option_type_radio .option__hint { .option_type_radio .option__hint {
margin-left: 20px; margin-left: 20px;
} }
/* Checkbox styling */ /* Checkbox styling */
.option_type_checkbox .option__element { .option_type_checkbox .option__element {
/* Checkboxes in Chrome are 2px narrower than radio buttons. /* Checkboxes in Chrome are 2px narrower than radio buttons.
These margins align them. */ These margins align them. */
margin-left: 1px; margin-left: 1px;
/* ...margin-right is 2px instead of 1px /* ...margin-right is 2px instead of 1px
because both radios and checkboxes have initial margin-right of 1px */ because both radios and checkboxes have initial margin-right of 1px */
margin-right: 2px; margin-right: 2px;
} }
/* Value-based styling */ /* Value-based styling */
.option_value_max-age { .option_value_max-age {
margin-left: 20px; margin-left: 20px;
} }
.option_value_max-age .option__element { .option_value_max-age .option__element {
width: 50px; width: 50px;
} }
body body
#root #root
script(src='/options.bundle.js') script(src='/options.bundle.js')

View File

@ -1,4 +1,4 @@
import { FilterState, FilterStateValue } from '../../../app/api/filters'; import { FilterState, FilterStateValue } from '../pageScript/api/filters';
export interface Options { export interface Options {
readonly useEditor: number; readonly useEditor: number;

View File

@ -1,9 +1,6 @@
import jsan from 'jsan'; import jsan from 'jsan';
import { immutableSerialize } from '@redux-devtools/serialize'; import { immutableSerialize } from '@redux-devtools/serialize';
import { import type { Config, SerializeWithImmutable } from '../index';
Config,
SerializeWithImmutable,
} from '../../browser/extension/inject/pageScript';
import Immutable from 'immutable'; import Immutable from 'immutable';
import { LiftedState } from '@redux-devtools/instrument'; import { LiftedState } from '@redux-devtools/instrument';
import { Action } from 'redux'; import { Action } from 'redux';

View File

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

View File

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

View File

@ -1,7 +1,7 @@
import { Action, compose, Reducer, StoreEnhancerStoreCreator } from 'redux'; import { Action, compose, Reducer, StoreEnhancerStoreCreator } from 'redux';
import { instrument } from '@redux-devtools/instrument'; import { instrument } from '@redux-devtools/instrument';
import { persistState } from '@redux-devtools/core'; import { persistState } from '@redux-devtools/core';
import { ConfigWithExpandedMaxAge } from '../../browser/extension/inject/pageScript'; import type { ConfigWithExpandedMaxAge } from './index';
export function getUrlParam(key: string) { export function getUrlParam(key: string) {
const matches = window.location.href.match( const matches = window.location.href.match(

View File

@ -27,19 +27,19 @@ import {
LibConfig, LibConfig,
Features, Features,
} from '@redux-devtools/app'; } from '@redux-devtools/app';
import configureStore, { getUrlParam } from '../../../app/stores/enhancerStore'; import configureStore, { getUrlParam } from './enhancerStore';
import { isAllowed, Options } from '../options/syncOptions'; import { isAllowed, Options } from '../options/syncOptions';
import Monitor from '../../../app/service/Monitor'; import Monitor from './Monitor';
import { import {
noFiltersApplied, noFiltersApplied,
isFiltered, isFiltered,
filterState, filterState,
startingFrom, startingFrom,
} from '../../../app/api/filters'; } from './api/filters';
import notifyErrors from '../../../app/api/notifyErrors'; import notifyErrors from './api/notifyErrors';
import importState from '../../../app/api/importState'; import importState from './api/importState';
import openWindow, { Position } from '../../../app/api/openWindow'; import openWindow, { Position } from './api/openWindow';
import generateId from '../../../app/api/generateInstanceId'; import generateId from './api/generateInstanceId';
import { import {
toContentScript, toContentScript,
sendMessage, sendMessage,
@ -51,8 +51,8 @@ import {
Serialize, Serialize,
StructuralPerformAction, StructuralPerformAction,
ConnectResponse, ConnectResponse,
} from '../../../app/api'; } from './api';
import { ContentScriptToPageScriptMessage } from './contentScript'; import type { ContentScriptToPageScriptMessage } from '../contentScript';
type EnhancedStoreWithInitialDispatch< type EnhancedStoreWithInitialDispatch<
S, S,

View File

@ -2,7 +2,7 @@ import React from 'react';
import { createRoot } from 'react-dom/client'; import { createRoot } from 'react-dom/client';
import { Root } from '@redux-devtools/app'; import { Root } from '@redux-devtools/app';
import '../../views/remote.pug'; import './remote.pug';
chrome.storage.local.get( chrome.storage.local.get(
{ {

View File

@ -1,11 +1,11 @@
doctype html doctype html
html html
head head
meta(charset='UTF-8') meta(charset='UTF-8')
title RemoteDev title RemoteDev
include ./includes/style.pug include ../style.pug
body body
#root #root
script(src='/remote.bundle.js') script(src='/remote.bundle.js')

View File

@ -3,11 +3,11 @@ import { createRoot } from 'react-dom/client';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/integration/react'; import { PersistGate } from 'redux-persist/integration/react';
import { UPDATE_STATE } from '@redux-devtools/app'; import { UPDATE_STATE } from '@redux-devtools/app';
import App from '../../../app/containers/App'; import App from '../app/App';
import configureStore from '../../../app/stores/windowStore'; import configureStore from './store/windowStore';
import { MonitorMessage } from '../../../app/middlewares/api'; import type { MonitorMessage } from '../background/store/apiMiddleware';
import '../../views/window.pug'; import './window.pug';
const position = location.hash; const position = location.hash;

View File

@ -6,10 +6,10 @@ import {
LIFTED_ACTION, LIFTED_ACTION,
SET_PERSIST, SET_PERSIST,
} from '@redux-devtools/app'; } from '@redux-devtools/app';
import { import type {
ExpandedUpdateStateAction, ExpandedUpdateStateAction,
WindowStoreAction, WindowStoreAction,
} from '../../stores/windowStore'; } from './windowStore';
export default function instances( export default function instances(
state = instancesInitialState, state = instancesInitialState,

View File

@ -9,8 +9,8 @@ import {
theme, theme,
StoreState, StoreState,
} from '@redux-devtools/app'; } from '@redux-devtools/app';
import instances from './instances'; import instances from './instancesReducer';
import { WindowStoreAction } from '../../stores/windowStore'; import type { WindowStoreAction } from './windowStore';
const rootReducer: Reducer<StoreState, WindowStoreAction> = const rootReducer: Reducer<StoreState, WindowStoreAction> =
combineReducers<StoreState>({ combineReducers<StoreState>({

View File

@ -17,12 +17,15 @@ import {
StoreState, StoreState,
UpdateStateAction, UpdateStateAction,
} from '@redux-devtools/app'; } from '@redux-devtools/app';
import syncStores from '../middlewares/windowSync'; import syncStores from './windowSyncMiddleware';
import instanceSelector from '../middlewares/instanceSelector'; import instanceSelector from './instanceSelectorMiddleware';
import rootReducer from '../reducers/window'; import rootReducer from './windowReducer';
import { BackgroundState } from '../reducers/background'; import type { BackgroundState } from '../../background/store/backgroundReducer';
import { BackgroundAction } from './backgroundStore'; import type { BackgroundAction } from '../../background/store/backgroundStore';
import { EmptyUpdateStateAction, NAAction } from '../middlewares/api'; import type {
EmptyUpdateStateAction,
NAAction,
} from '../../background/store/apiMiddleware';
export interface ExpandedUpdateStateAction extends UpdateStateAction { export interface ExpandedUpdateStateAction extends UpdateStateAction {
readonly instances: InstancesState; readonly instances: InstancesState;

View File

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

View File

@ -1,17 +1,17 @@
doctype html doctype html
html html
head head
meta(charset='UTF-8') meta(charset='UTF-8')
title Redux DevTools title Redux DevTools
include ./includes/style.pug include ../style.pug
body body
#root #root
div(style='position: relative') div(style='position: relative')
img( img(
src='/img/loading.svg', src='/img/loading.svg',
height=300, width=350, height=300, width=350,
style='position: absolute; top: 50%; left: 50%; margin-top: -175px; margin-left: -175px;' style='position: absolute; top: 50%; left: 50%; margin-top: -175px; margin-left: -175px;'
) )
script(src='/window.bundle.js') script(src='/window.bundle.js')

View File

@ -1,8 +1,8 @@
import React from 'react'; import React from 'react';
import { render, screen, within } from '@testing-library/react'; import { render, screen, within } from '@testing-library/react';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import configureStore from '../../../src/app/stores/windowStore'; import configureStore from '../../../src/window/store/windowStore';
import App from '../../../src/app/containers/App'; import App from '../../../src/app/App';
Object.defineProperty(window, 'matchMedia', { Object.defineProperty(window, 'matchMedia', {
writable: true, writable: true,

View File

@ -1,5 +1,5 @@
import { insertScript, listenMessage } from '../../utils/inject'; import { insertScript, listenMessage } from '../../utils/inject';
import '../../../src/browser/extension/inject/pageScript'; import '../../../src/pageScript';
describe('API', () => { describe('API', () => {
it('should get window.__REDUX_DEVTOOLS_EXTENSION__ function', () => { it('should get window.__REDUX_DEVTOOLS_EXTENSION__ function', () => {

View File

@ -1,7 +1,7 @@
import '@babel/polyfill'; import '@babel/polyfill';
import { createStore, compose } from 'redux'; import { createStore, compose } from 'redux';
import { insertScript, listenMessage } from '../../utils/inject'; import { insertScript, listenMessage } from '../../utils/inject';
import '../../../src/browser/extension/inject/pageScript'; import '../../../src/pageScript';
function counter(state = 0, action) { function counter(state = 0, action) {
switch (action.type) { switch (action.type) {

View File

@ -3,21 +3,30 @@ import webpack from 'webpack';
import CopyPlugin from 'copy-webpack-plugin'; import CopyPlugin from 'copy-webpack-plugin';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-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) => ({ const baseConfig = (params) => ({
// devtool: 'source-map', // devtool: 'source-map',
mode: params.mode, mode: params.mode,
entry: params.input || { entry: params.input || {
background: [mock, `${extpath}background/index`], background: [
options: [mock, `${extpath}options/index`], path.resolve(__dirname, '../src/chromeApiMock'),
window: [`${extpath}window/index`], path.resolve(__dirname, '../src/background/index'),
remote: [`${extpath}window/remote`], ],
devpanel: [mock, `${extpath}devpanel/index`], options: [
devtools: [`${extpath}devtools/index`], path.resolve(__dirname, '../src/chromeApiMock'),
content: [mock, `${extpath}inject/contentScript`], path.resolve(__dirname, '../src/options/index'),
pagewrap: [`${extpath}inject/pageScriptWrap`], ],
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, ...params.inputExtra,
}, },
output: { output: {

View File

@ -5,7 +5,7 @@ import baseConfig from './base.config';
let config = baseConfig({ let config = baseConfig({
mode: 'development', mode: 'development',
inputExtra: { inputExtra: {
page: [path.join(__dirname, '../src/browser/extension/inject/pageScript')], page: [path.join(__dirname, '../src/pageScript')],
}, },
output: { path: path.join(__dirname, '../dev') }, output: { path: path.join(__dirname, '../dev') },
globals: { globals: {
@ -15,10 +15,7 @@ let config = baseConfig({
}, },
plugins: [new webpack.NoEmitOnErrorsPlugin()], plugins: [new webpack.NoEmitOnErrorsPlugin()],
copy: true, copy: true,
manifestJsonPath: path.join( manifestJsonPath: path.join(__dirname, '../chrome/manifest.json'),
__dirname,
'../src/browser/extension/manifest.json'
),
}); });
config.watch = true; config.watch = true;

View File

@ -4,7 +4,7 @@ import baseConfig from './base.config';
export default baseConfig({ export default baseConfig({
mode: 'production', mode: 'production',
inputExtra: { inputExtra: {
page: [path.join(__dirname, '../src/browser/extension/inject/pageScript')], page: [path.join(__dirname, '../src/pageScript')],
}, },
output: { path: path.join(__dirname, '../build/extension') }, output: { path: path.join(__dirname, '../build/extension') },
globals: { globals: {
@ -13,8 +13,5 @@ export default baseConfig({
}, },
}, },
copy: true, copy: true,
manifestJsonPath: path.join( manifestJsonPath: path.join(__dirname, '../chrome/manifest.json'),
__dirname,
'../src/browser/extension/manifest.json'
),
}); });

View File

@ -10,8 +10,5 @@ export default baseConfig({
}, },
}, },
copy: true, copy: true,
manifestJsonPath: path.join( manifestJsonPath: path.join(__dirname, '../firefox/manifest.json'),
__dirname,
'../src/browser/firefox/manifest.json'
),
}); });

View File

@ -4,7 +4,7 @@ import baseConfig from './base.config';
export default baseConfig({ export default baseConfig({
mode: 'production', mode: 'production',
input: { input: {
page: [path.join(__dirname, '../src/browser/extension/inject/pageScript')], page: [path.join(__dirname, '../src/pageScript')],
}, },
output: { path: path.join(__dirname, '../build/tmp') }, output: { path: path.join(__dirname, '../build/tmp') },
globals: { globals: {