Bug 1584973 - Expose object inspector's reducer file. r=jlast.
☠☠ backed out by bafc4821f21d ☠ ☠
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Tue, 01 Oct 2019 15:19:44 +0000
changeset 495859 e63ea229519de06a788d7ecd23946f36e4f55f82
parent 495858 a2656cc6a57e117876683954560a7b3573501bc7
child 495860 c06273b257694bd36d2ecff45d351c9bdd638b4a
push id114140
push userdvarga@mozilla.com
push dateWed, 02 Oct 2019 18:04:51 +0000
treeherdermozilla-inbound@32eb0ea893f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlast
bugs1584973
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1584973 - Expose object inspector's reducer file. r=jlast. This patch exposes the objectInspector reducer as a regular file that can be required in the devtools codebase. This should make things faster to start as we won't need to load the entire bundle (especially for the inspector where the reps is only used when navigating to specific subpanels). This means we need to remove the flow typing for now since we don't have a cross-toolbox build process like we have in the debugger. Differential Revision: https://phabricator.services.mozilla.com/D47728
devtools/client/debugger/moz.build
devtools/client/debugger/packages/devtools-reps/moz.build
devtools/client/debugger/packages/devtools-reps/src/moz.build
devtools/client/debugger/packages/devtools-reps/src/object-inspector/moz.build
devtools/client/debugger/packages/devtools-reps/src/object-inspector/reducer.js
devtools/client/debugger/packages/moz.build
devtools/client/inspector/reducers.js
devtools/client/webconsole/reducers/index.js
--- a/devtools/client/debugger/moz.build
+++ b/devtools/client/debugger/moz.build
@@ -1,16 +1,17 @@
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DIRS += [
   'dist',
   'images',
+  'packages',
   'src',
 ]
 
 include('../shared/build/node-templates.mozbuild')
 
 BROWSER_CHROME_MANIFESTS += [
   'test/mochitest/browser.ini',
 ]
new file mode 100644
--- /dev/null
+++ b/devtools/client/debugger/packages/devtools-reps/moz.build
@@ -0,0 +1,9 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DIRS += [
+	'src',
+]
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/devtools/client/debugger/packages/devtools-reps/src/moz.build
@@ -0,0 +1,9 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DIRS += [
+	'object-inspector',
+]
new file mode 100644
--- /dev/null
+++ b/devtools/client/debugger/packages/devtools-reps/src/object-inspector/moz.build
@@ -0,0 +1,9 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DevToolsModules(
+    'reducer.js',
+)
--- a/devtools/client/debugger/packages/devtools-reps/src/object-inspector/reducer.js
+++ b/devtools/client/debugger/packages/devtools-reps/src/object-inspector/reducer.js
@@ -1,29 +1,24 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
 
-import type { ReduxAction, State } from "./types";
-
 function initialState(overrides) {
   return {
     expandedPaths: new Set(),
     loadedProperties: new Map(),
     evaluations: new Map(),
     actors: new Set(),
     watchpoints: new Map(),
     ...overrides,
   };
 }
 
-function reducer(
-  state: State = initialState(),
-  action: ReduxAction = {}
-): State {
+function reducer(state = initialState(), action = {}) {
   const { type, data } = action;
 
   const cloneState = overrides => ({ ...state, ...overrides });
 
   if (type === "NODE_EXPAND") {
     return cloneState({
       expandedPaths: new Set(state.expandedPaths).add(data.node.path),
     });
new file mode 100644
--- /dev/null
+++ b/devtools/client/debugger/packages/moz.build
@@ -0,0 +1,9 @@
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DIRS += [
+  'devtools-reps',
+]
+
--- a/devtools/client/inspector/reducers.js
+++ b/devtools/client/inspector/reducers.js
@@ -18,11 +18,11 @@ exports.fontData = require("devtools/cli
 exports.fontEditor = require("devtools/client/inspector/fonts/reducers/font-editor");
 exports.grids = require("devtools/client/inspector/grids/reducers/grids");
 exports.highlighterSettings = require("devtools/client/inspector/grids/reducers/highlighter-settings");
 exports.pseudoClasses = require("devtools/client/inspector/rules/reducers/pseudo-classes");
 exports.rules = require("devtools/client/inspector/rules/reducers/rules");
 
 // This ObjectInspector reducer is needed for the Extension Sidebar.
 const {
-  objectInspector,
-} = require("devtools/client/shared/components/reps/reps");
-exports.objectInspector = objectInspector.reducer.default;
+  default: objectInspector,
+} = require("devtools/client/debugger/packages/devtools-reps/src/object-inspector/reducer");
+exports.objectInspector = objectInspector;
--- a/devtools/client/webconsole/reducers/index.js
+++ b/devtools/client/webconsole/reducers/index.js
@@ -5,23 +5,22 @@
 
 const { autocomplete } = require("./autocomplete");
 const { filters } = require("./filters");
 const { messages } = require("./messages");
 const { prefs } = require("./prefs");
 const { ui } = require("./ui");
 const { notifications } = require("./notifications");
 const { history } = require("./history");
-
 const {
-  objectInspector,
-} = require("devtools/client/shared/components/reps/reps.js");
+  default: objectInspector,
+} = require("devtools/client/debugger/packages/devtools-reps/src/object-inspector/reducer");
 
 exports.reducers = {
   autocomplete,
   filters,
   messages,
   prefs,
   ui,
   notifications,
   history,
-  objectInspector: objectInspector.reducer.default,
+  objectInspector,
 };