migrate redux store
Summary: Migrating redux stores to TypeScript Reviewed By: passy Differential Revision: D16579796 fbshipit-source-id: e3e507f17f1bdd57eb45e30cb0b28aaee6c4521c
This commit is contained in:
committed by
Facebook Github Bot
parent
2c95ef6b25
commit
64cefd0f84
@@ -6,11 +6,11 @@
|
||||
*/
|
||||
|
||||
import {getPersistentPlugins, getActivePersistentPlugins} from '../pluginUtils';
|
||||
import type {State as PluginsState} from '../../reducers/plugins.js';
|
||||
import type {State as PluginStatesState} from '../../reducers/pluginStates.js';
|
||||
import type {State as PluginsState} from '../../reducers/plugins.tsx';
|
||||
import type {State as PluginStatesState} from '../../reducers/pluginStates.tsx';
|
||||
import type {PluginDefinition} from '../../dispatcher/plugins';
|
||||
import {FlipperBasePlugin} from '../../..';
|
||||
import type {MiddlewareAPI} from '../../reducers/index.js';
|
||||
import type {MiddlewareAPI} from '../../reducers/index.tsx';
|
||||
class MockFlipperPluginWithDefaultPersistedState extends FlipperBasePlugin<
|
||||
*,
|
||||
*,
|
||||
@@ -46,15 +46,11 @@ function mockPluginState(
|
||||
): PluginsState {
|
||||
return {
|
||||
devicePlugins: new Map([
|
||||
//$FlowFixMe: Just for testing
|
||||
['DevicePlugin1', MockFlipperPluginWithDefaultPersistedState],
|
||||
//$FlowFixMe: Just for testing
|
||||
['DevicePlugin2', MockFlipperPluginWithDefaultPersistedState],
|
||||
]),
|
||||
clientPlugins: new Map([
|
||||
//$FlowFixMe: Just for testing
|
||||
['ClientPlugin1', MockFlipperPluginWithDefaultPersistedState],
|
||||
//$FlowFixMe: Just for testing
|
||||
['ClientPlugin2', MockFlipperPluginWithDefaultPersistedState],
|
||||
]),
|
||||
gatekeepedPlugins,
|
||||
@@ -95,15 +91,11 @@ test('getPersistentPlugins with no plugins getting excluded', () => {
|
||||
test('getPersistentPlugins, where the plugins with exportPersistedState not getting excluded', () => {
|
||||
const state: PluginsState = {
|
||||
devicePlugins: new Map([
|
||||
//$FlowFixMe: Just for testing
|
||||
['DevicePlugin1', MockFlipperPluginWithExportPersistedState],
|
||||
//$FlowFixMe: Just for testing
|
||||
['DevicePlugin2', MockFlipperPluginWithExportPersistedState],
|
||||
]),
|
||||
clientPlugins: new Map([
|
||||
//$FlowFixMe: Just for testing
|
||||
['ClientPlugin1', MockFlipperPluginWithExportPersistedState],
|
||||
//$FlowFixMe: Just for testing
|
||||
['ClientPlugin2', MockFlipperPluginWithExportPersistedState],
|
||||
]),
|
||||
gatekeepedPlugins: [],
|
||||
@@ -123,15 +115,11 @@ test('getPersistentPlugins, where the plugins with exportPersistedState not gett
|
||||
test('getPersistentPlugins, where the non persistent plugins getting excluded', () => {
|
||||
const state: PluginsState = {
|
||||
devicePlugins: new Map([
|
||||
//$FlowFixMe: Just for testing
|
||||
['DevicePlugin1', MockFlipperPluginWithNoPersistedState],
|
||||
//$FlowFixMe: Just for testing
|
||||
['DevicePlugin2', MockFlipperPluginWithDefaultPersistedState],
|
||||
]),
|
||||
clientPlugins: new Map([
|
||||
//$FlowFixMe: Just for testing
|
||||
['ClientPlugin1', MockFlipperPluginWithDefaultPersistedState],
|
||||
//$FlowFixMe: Just for testing
|
||||
['ClientPlugin2', MockFlipperPluginWithNoPersistedState],
|
||||
]),
|
||||
gatekeepedPlugins: [],
|
||||
@@ -146,15 +134,11 @@ test('getPersistentPlugins, where the non persistent plugins getting excluded',
|
||||
test('getActivePersistentPlugins, where the non persistent plugins getting excluded', () => {
|
||||
const state: PluginsState = {
|
||||
devicePlugins: new Map([
|
||||
//$FlowFixMe: Just for testing
|
||||
['DevicePlugin1', MockFlipperPluginWithNoPersistedState],
|
||||
//$FlowFixMe: Just for testing
|
||||
['DevicePlugin2', MockFlipperPluginWithDefaultPersistedState],
|
||||
]),
|
||||
clientPlugins: new Map([
|
||||
//$FlowFixMe: Just for testing
|
||||
['ClientPlugin1', MockFlipperPluginWithDefaultPersistedState],
|
||||
//$FlowFixMe: Just for testing
|
||||
['ClientPlugin2', MockFlipperPluginWithNoPersistedState],
|
||||
]),
|
||||
gatekeepedPlugins: [],
|
||||
@@ -175,15 +159,11 @@ test('getActivePersistentPlugins, where the non persistent plugins getting exclu
|
||||
test('getActivePersistentPlugins, where the plugins not in pluginState gets excluded', () => {
|
||||
const state: PluginsState = {
|
||||
devicePlugins: new Map([
|
||||
//$FlowFixMe: Just for testing
|
||||
['DevicePlugin1', MockFlipperPluginWithDefaultPersistedState],
|
||||
//$FlowFixMe: Just for testing
|
||||
['DevicePlugin2', MockFlipperPluginWithDefaultPersistedState],
|
||||
]),
|
||||
clientPlugins: new Map([
|
||||
//$FlowFixMe: Just for testing
|
||||
['ClientPlugin1', MockFlipperPluginWithDefaultPersistedState],
|
||||
//$FlowFixMe: Just for testing
|
||||
['ClientPlugin2', MockFlipperPluginWithDefaultPersistedState],
|
||||
]),
|
||||
gatekeepedPlugins: [],
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
* @format
|
||||
*/
|
||||
import {getInstance as getLogger} from '../fb-stubs/Logger';
|
||||
import type {Store, MiddlewareAPI} from '../reducers';
|
||||
import type {Store, MiddlewareAPI} from '../reducers.tsx';
|
||||
import type {DeviceExport} from '../devices/BaseDevice';
|
||||
import type {State as PluginStates} from '../reducers/pluginStates';
|
||||
import type {PluginNotification} from '../reducers/notifications.js';
|
||||
import type {State as PluginStates} from '../reducers/pluginStates.tsx';
|
||||
import type {PluginNotification} from '../reducers/notifications.tsx';
|
||||
import type {ClientExport} from '../Client.js';
|
||||
import type {State as PluginStatesState} from '../reducers/pluginStates';
|
||||
import {pluginKey} from '../reducers/pluginStates';
|
||||
import type {State as PluginStatesState} from '../reducers/pluginStates.tsx';
|
||||
import {pluginKey} from '../reducers/pluginStates.tsx';
|
||||
import {FlipperDevicePlugin, FlipperPlugin, callClient} from '../plugin.js';
|
||||
import {default as BaseDevice} from '../devices/BaseDevice';
|
||||
import {default as ArchivedDevice} from '../devices/ArchivedDevice';
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
*/
|
||||
import type {FlipperPlugin, FlipperDevicePlugin} from 'flipper';
|
||||
import {serialize} from './serialization';
|
||||
import type {State as PluginStatesState} from '../reducers/pluginStates';
|
||||
import type {Store} from '../reducers';
|
||||
import type {State as PluginStatesState} from '../reducers/pluginStates.tsx';
|
||||
import type {Store} from '../reducers/index.tsx';
|
||||
import fs from 'fs';
|
||||
import type {ExportType} from './exportData';
|
||||
import {fetchMetadata, pluginsClassMap} from './exportData';
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
import type {ProcessConfig} from './processConfig.js';
|
||||
import type {Store} from '../reducers/index.js';
|
||||
import type {Store} from '../reducers/index.tsx';
|
||||
|
||||
export function initLauncherHooks(config: ProcessConfig, store: Store) {
|
||||
if (config.launcherMsg) {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* @format
|
||||
*/
|
||||
import type {Store} from '../reducers/index.js';
|
||||
import type {Store} from '../reducers/index.tsx';
|
||||
import {FlipperPlugin, FlipperDevicePlugin} from '../plugin.js';
|
||||
import type BaseDevice from '../devices/BaseDevice.js';
|
||||
import {setPluginState} from '../reducers/pluginStates.js';
|
||||
import {setPluginState} from '../reducers/pluginStates.tsx';
|
||||
import {getPersistedState} from '../utils/pluginUtils.js';
|
||||
|
||||
export function registerDeviceCallbackOnPlugins(
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
*/
|
||||
import type BaseDevice from '../devices/BaseDevice.js';
|
||||
import {FlipperDevicePlugin, FlipperPlugin} from '../plugin.js';
|
||||
import type {State as PluginStatesState} from '../reducers/pluginStates.js';
|
||||
import type {State as PluginStatesState} from '../reducers/pluginStates.tsx';
|
||||
import {pluginsClassMap} from './exportData.js';
|
||||
import type {State as PluginsState} from '../reducers/plugins.js';
|
||||
import type {State as PluginsState} from '../reducers/plugins.tsx';
|
||||
import type {PluginDefinition} from '../dispatcher/plugins';
|
||||
|
||||
export function getPluginKey(
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* @format
|
||||
*/
|
||||
import type {State} from '../reducers/index';
|
||||
import {State} from '../reducers/index.tsx';
|
||||
import type {DeviceExport} from '../devices/BaseDevice';
|
||||
|
||||
export const stateSanitizer = (state: State) => {
|
||||
|
||||
Reference in New Issue
Block a user