Reorganized folders into packages/*
Brian Vaughn committed
Aug 13, 2019 at 15:59 UTC
08743b1a8e012c1a36ba99391c6332e462b808b2
145 files changed
+375
-412
packages/react-devtools-core/src/backend.js
+11
-11
@@ -1,17 +1,17 @@
1
// @flow
2
3
-import Agent from 'src/backend/agent';
4
-import Bridge from 'src/bridge';
5
-import { installHook } from 'src/hook';
6
-import { initBackend } from 'src/backend';
7
-import { __DEBUG__ } from 'src/constants';
8
-import setupNativeStyleEditor from 'src/backend/NativeStyleEditor/setupNativeStyleEditor';
9
-import { getDefaultComponentFilters } from 'src/utils';
3
+import Agent from 'react-devtools-shared/src/backend/agent';
4
+import Bridge from 'react-devtools-shared/src/bridge';
5
+import { installHook } from 'react-devtools-shared/src/hook';
6
+import { initBackend } from 'react-devtools-shared/src/backend';
7
+import { __DEBUG__ } from 'react-devtools-shared/src/constants';
8
+import setupNativeStyleEditor from 'react-devtools-shared/src/backend/NativeStyleEditor/setupNativeStyleEditor';
9
+import { getDefaultComponentFilters } from 'react-devtools-shared/src/utils';
10
11
-import type { BackendBridge } from 'src/bridge';
12
-import type { ComponentFilter } from 'src/types';
13
-import type { DevToolsHook } from 'src/backend/types';
14
-import type { ResolveNativeStyle } from 'src/backend/NativeStyleEditor/setupNativeStyleEditor';
11
+import type { BackendBridge } from 'react-devtools-shared/src/bridge';
12
+import type { ComponentFilter } from 'react-devtools-shared/src/types';
13
+import type { DevToolsHook } from 'react-devtools-shared/src/backend/types';
14
+import type { ResolveNativeStyle } from 'react-devtools-shared/src/backend/NativeStyleEditor/setupNativeStyleEditor';
15
16
type ConnectOptions = {
17
host?: string,
packages/react-devtools-core/src/standalone.js
+8
-8
@@ -7,18 +7,18 @@ import {
7
// $FlowFixMe Flow does not yet know about createRoot()
8
unstable_createRoot as createRoot,
9
} from 'react-dom';
10
-import Bridge from 'src/bridge';
11
-import Store from 'src/devtools/store';
12
-import { getSavedComponentFilters, getAppendComponentStack } from 'src/utils';
10
+import Bridge from 'react-devtools-shared/src/bridge';
11
+import Store from 'react-devtools-shared/src/devtools/store';
12
+import { getSavedComponentFilters, getAppendComponentStack } from 'react-devtools-shared/src/utils';
13
import { Server } from 'ws';
14
import { existsSync, readFileSync } from 'fs';
15
-import { installHook } from 'src/hook';
16
-import DevTools from 'src/devtools/views/DevTools';
15
+import { installHook } from 'react-devtools-shared/src/hook';
16
+import DevTools from 'react-devtools-shared/src/devtools/views/DevTools';
17
import { doesFilePathExist, launchEditor } from './editor';
18
-import { __DEBUG__ } from 'src/constants';
18
+import { __DEBUG__ } from 'react-devtools-shared/src/constants';
19
20
-import type { FrontendBridge } from 'src/bridge';
21
-import type { InspectedElement } from 'src/devtools/views/Components/types';
20
+import type { FrontendBridge } from 'react-devtools-shared/src/bridge';
21
+import type { InspectedElement } from 'react-devtools-shared/src/devtools/views/Components/types';
22
23
installHook(window);
24
packages/react-devtools-extensions/chrome/README.md
renamed
packages/react-devtools-extensions/chrome/build.js
renamed
packages/react-devtools-extensions/chrome/deploy.js
renamed
packages/react-devtools-extensions/chrome/manifest.json
renamed
packages/react-devtools-extensions/chrome/now.json
renamed
packages/react-devtools-extensions/chrome/test.js
renamed
packages/react-devtools-extensions/firefox/README.md
renamed
packages/react-devtools-extensions/firefox/build.js
renamed
packages/react-devtools-extensions/firefox/deploy.js
renamed
packages/react-devtools-extensions/firefox/manifest.json
renamed
packages/react-devtools-extensions/firefox/now.json
renamed
packages/react-devtools-extensions/firefox/test.js
renamed
packages/react-devtools-extensions/package.json
+4
-162
@@ -1,164 +1,6 @@
1
{
2
- "version": "4.0.0",
3
- "repository": "bvaughn/react-devtools-experimental",
4
- "license": "MIT",
5
- "private": true,
6
- "workspaces": [
7
- "packages/*"
8
- ],
9
- "jest": {
10
- "modulePathIgnorePatterns": [
11
- "<rootDir>/shells"
12
- ],
13
- "modulePaths": [
14
- "<rootDir>"
15
- ],
16
- "moduleNameMapper": {
17
- "^src/(.*)$": "<rootDir>/src/$1",
18
- "\\.css$": "<rootDir>/src/__tests__/__mocks__/cssMock.js"
19
- },
20
- "setupFiles": [
21
- "<rootDir>/src/__tests__/setupEnv"
22
- ],
23
- "setupFilesAfterEnv": [
24
- "<rootDir>/src/__tests__/setupTests"
25
- ],
26
- "snapshotSerializers": [
27
- "<rootDir>/src/__tests__/inspectedElementSerializer",
28
- "<rootDir>/src/__tests__/storeSerializer"
29
- ],
30
- "testMatch": [
31
- "**/__tests__/**/*-test.js"
32
- ]
33
- },
34
- "scripts": {
35
- "build:core:backend": "cd ./packages/react-devtools-core && yarn build:backend",
36
- "build:core:standalone": "cd ./packages/react-devtools-core && yarn build:standalone",
37
- "build:core": "cd ./packages/react-devtools-core && yarn build",
38
- "build:inline": "cd ./packages/react-devtools-inline && yarn build",
39
- "build:demo": "cd ./shells/dev && cross-env NODE_ENV=development cross-env TARGET=remote webpack --config webpack.config.js",
40
- "build:extension": "cross-env NODE_ENV=production yarn run build:extension:chrome && yarn run build:extension:firefox",
41
- "build:extension:dev": "cross-env NODE_ENV=development yarn run build:extension:chrome && yarn run build:extension:firefox",
42
- "build:extension:chrome": "cross-env NODE_ENV=production node ./shells/browser/chrome/build",
43
- "build:extension:chrome:crx": "cross-env NODE_ENV=production node ./shells/browser/chrome/build --crx",
44
- "build:extension:chrome:dev": "cross-env NODE_ENV=development node ./shells/browser/chrome/build",
45
- "build:extension:firefox": "cross-env NODE_ENV=production node ./shells/browser/firefox/build",
46
- "build:extension:firefox:dev": "cross-env NODE_ENV=development node ./shells/browser/firefox/build",
47
- "build:standalone": "cd packages/react-devtools-core && yarn run build",
48
- "deploy": "yarn run deploy:demo && yarn run deploy:chrome && yarn run deploy:firefox",
49
- "deploy:demo": "yarn run build:demo && cd shells/dev/ && now deploy && now alias react-devtools-experimental",
50
- "deploy:chrome": "node ./shells/browser/chrome/deploy",
51
- "deploy:firefox": "node ./shells/browser/firefox/deploy",
52
- "linc": "lint-staged",
53
- "lint": "eslint '**/*.js'",
54
- "lint:ci": "eslint '**/*.js' --max-warnings 0",
55
- "precommit": "lint-staged",
56
- "prettier": "prettier --write '**/*.{js,json,css}'",
57
- "prettier:ci": "prettier --check '**/*.{js,json,css}'",
58
- "start": "cd ./shells/dev && cross-env NODE_ENV=development cross-env TARGET=local webpack-dev-server --open",
59
- "start:core:backend": "cd ./packages/react-devtools-core && yarn start:backend",
60
- "start:core:standalone": "cd ./packages/react-devtools-core && yarn start:standalone",
61
- "start:electron": "cd ./packages/react-devtools && node bin.js",
62
- "start:prod": "cd ./shells/dev && cross-env NODE_ENV=production cross-env TARGET=local webpack-dev-server --open",
63
- "test": "jest",
64
- "test-debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
65
- "test:chrome": "node ./shells/browser/chrome/test",
66
- "test:firefox": "node ./shells/browser/firefox/test",
67
- "test:standalone": "cd packages/react-devtools && yarn start",
68
- "typecheck": "flow check --show-all-errors"
69
- },
70
- "devEngines": {
71
- "node": "10.x || 11.x"
72
- },
73
- "lint-staged": {
74
- "{shells,src}/**/*.{js,json,css}": [
75
- "prettier --write",
76
- "git add"
77
- ],
78
- "**/*.js": "eslint --max-warnings 0"
79
- },
80
- "devDependencies": {
81
- "@babel/core": "^7.1.6",
82
- "@babel/plugin-proposal-class-properties": "^7.1.0",
83
- "@babel/plugin-transform-flow-strip-types": "^7.1.6",
84
- "@babel/plugin-transform-react-jsx-source": "^7.2.0",
85
- "@babel/preset-env": "^7.1.6",
86
- "@babel/preset-flow": "^7.0.0",
87
- "@babel/preset-react": "^7.0.0",
88
- "@reach/menu-button": "^0.1.17",
89
- "@reach/tooltip": "^0.2.2",
90
- "archiver": "^3.0.0",
91
- "babel-core": "^7.0.0-bridge",
92
- "babel-eslint": "^9.0.0",
93
- "babel-jest": "^24.7.1",
94
- "babel-loader": "^8.0.4",
95
- "child-process-promise": "^2.2.1",
96
- "chrome-launch": "^1.1.4",
97
- "classnames": "2.2.1",
98
- "cli-spinners": "^1.0.0",
99
- "clipboard-js": "^0.3.6",
100
- "cross-env": "^5.2.0",
101
- "crx": "^5.0.0",
102
- "css-loader": "^1.0.1",
103
- "error-stack-parser": "^2.0.2",
104
- "es6-symbol": "3.0.2",
105
- "escape-string-regexp": "^1.0.5",
106
- "eslint": "^4.19.1",
107
- "eslint-config-prettier": "^2.9.0",
108
- "eslint-config-react-app": "^2.1.0",
109
- "eslint-config-standard": "^11.0.0",
110
- "eslint-config-standard-react": "^6.0.0",
111
- "eslint-plugin-flowtype": "^2.47.1",
112
- "eslint-plugin-import": "^2.11.0",
113
- "eslint-plugin-jsx-a11y": "^5",
114
- "eslint-plugin-node": "^6.0.1",
115
- "eslint-plugin-prettier": "^2.6.0",
116
- "eslint-plugin-promise": "^3.7.0",
117
- "eslint-plugin-react": "^7.7.0",
118
- "eslint-plugin-react-hooks": "^1.6.0",
119
- "eslint-plugin-standard": "^3.0.1",
120
- "events": "^3.0.0",
121
- "fbjs": "0.5.1",
122
- "fbjs-scripts": "0.7.0",
123
- "firefox-profile": "^1.0.2",
124
- "flow-bin": "^0.103.0",
125
- "fs-extra": "^3.0.1",
126
- "gh-pages": "^1.0.0",
127
- "immutable": "3.7.6",
128
- "jest": "^24.7.1",
129
- "lerna": "^2.8.0",
130
- "lint-staged": "^7.0.5",
131
- "local-storage-fallback": "^4.1.1",
132
- "lodash.throttle": "^4.1.1",
133
- "log-update": "^2.0.0",
134
- "lru-cache": "^4.1.3",
135
- "memoize-one": "^3.1.1",
136
- "node-libs-browser": "0.5.3",
137
- "nullthrows": "^1.0.0",
138
- "object-assign": "4.0.1",
139
- "opener": "^1.5.1",
140
- "prettier": "^1.16.4",
141
- "prop-types": "^15.6.2",
142
- "raw-loader": "^3.1.0",
143
- "react": "^0.0.0-424099da6",
144
- "react-15": "npm:react@^15",
145
- "react-color": "^2.11.7",
146
- "react-dom": "^0.0.0-424099da6",
147
- "react-dom-15": "npm:react-dom@^15",
148
- "react-is": "0.0.0-424099da6",
149
- "react-native-web": "^0.11.5",
150
- "react-test-renderer": "^0.0.0-424099da6",
151
- "react-virtualized-auto-sizer": "^1.0.2",
152
- "request-promise": "^4.2.4",
153
- "rimraf": "^2.6.3",
154
- "scheduler": "^0.0.0-424099da6",
155
- "semver": "^5.5.1",
156
- "serve-static": "^1.14.1",
157
- "style-loader": "^0.23.1",
158
- "web-ext": "^3.0.0",
159
- "webpack": "^4.26.0",
160
- "webpack-cli": "^3.1.2",
161
- "webpack-dev-server": "^3.3.1",
162
- "yargs": "^13.2.4"
163
- }
2
+
3
+ "name": "react-devtools-extensions",
4
+ "version": "0.0.0",
5
+ "private": true
6
}
packages/react-devtools-extensions/shared/build.js
renamed
packages/react-devtools-extensions/shared/deploy.chrome.html
renamed
packages/react-devtools-extensions/shared/deploy.firefox.html
renamed
packages/react-devtools-extensions/shared/deploy.html
renamed
packages/react-devtools-extensions/shared/deploy.js
renamed
packages/react-devtools-extensions/shared/icons/128-deadcode.png
renamed
packages/react-devtools-extensions/shared/icons/128-development.png
renamed
packages/react-devtools-extensions/shared/icons/128-disabled.png
renamed
packages/react-devtools-extensions/shared/icons/128-outdated.png
renamed
packages/react-devtools-extensions/shared/icons/128-production.png
renamed
packages/react-devtools-extensions/shared/icons/128-unminified.png
renamed
packages/react-devtools-extensions/shared/icons/16-deadcode.png
renamed
packages/react-devtools-extensions/shared/icons/16-development.png
renamed
packages/react-devtools-extensions/shared/icons/16-disabled.png
renamed
packages/react-devtools-extensions/shared/icons/16-outdated.png
renamed
packages/react-devtools-extensions/shared/icons/16-production.png
renamed
packages/react-devtools-extensions/shared/icons/16-unminified.png
renamed
packages/react-devtools-extensions/shared/icons/32-deadcode.png
renamed
packages/react-devtools-extensions/shared/icons/32-development.png
renamed
packages/react-devtools-extensions/shared/icons/32-disabled.png
renamed
packages/react-devtools-extensions/shared/icons/32-outdated.png
renamed
packages/react-devtools-extensions/shared/icons/32-production.png
renamed
packages/react-devtools-extensions/shared/icons/32-unminified.png
renamed
packages/react-devtools-extensions/shared/icons/48-deadcode.png
renamed
packages/react-devtools-extensions/shared/icons/48-development.png
renamed
packages/react-devtools-extensions/shared/icons/48-disabled.png
renamed
packages/react-devtools-extensions/shared/icons/48-outdated.png
renamed
packages/react-devtools-extensions/shared/icons/48-production.png
renamed
packages/react-devtools-extensions/shared/icons/48-unminified.png
renamed
packages/react-devtools-extensions/shared/icons/deadcode.svg
renamed
packages/react-devtools-extensions/shared/icons/development.svg
renamed
packages/react-devtools-extensions/shared/icons/disabled.svg
renamed
packages/react-devtools-extensions/shared/icons/outdated.svg
renamed
packages/react-devtools-extensions/shared/icons/production.svg
renamed
packages/react-devtools-extensions/shared/main.html
renamed
packages/react-devtools-extensions/shared/panel.html
renamed
packages/react-devtools-extensions/shared/popups/deadcode.html
renamed
packages/react-devtools-extensions/shared/popups/development.html
renamed
packages/react-devtools-extensions/shared/popups/disabled.html
renamed
packages/react-devtools-extensions/shared/popups/outdated.html
renamed
packages/react-devtools-extensions/shared/popups/production.html
renamed
packages/react-devtools-extensions/shared/popups/shared.js
renamed
packages/react-devtools-extensions/shared/popups/unminified.html
renamed
packages/react-devtools-extensions/shared/src/backend.js
renamed
+4
-4
@@ -20,10 +20,10 @@ function welcome(event) {
20
window.addEventListener('message', welcome);
21
22
function setup(hook) {
23
- const Agent = require('src/backend/agent').default;
24
- const Bridge = require('src/bridge').default;
25
- const { initBackend } = require('src/backend');
26
- const setupNativeStyleEditor = require('src/backend/NativeStyleEditor/setupNativeStyleEditor')
23
+ const Agent = require('react-devtools-shared/src/backend/agent').default;
24
+ const Bridge = require('react-devtools-shared/src/bridge').default;
25
+ const { initBackend } = require('react-devtools-shared/src/backend');
26
+ const setupNativeStyleEditor = require('react-devtools-shared/src/backend/NativeStyleEditor/setupNativeStyleEditor')
27
.default;
28
29
const bridge = new Bridge({
packages/react-devtools-extensions/shared/src/background.js
renamed
packages/react-devtools-extensions/shared/src/contentScript.js
renamed
packages/react-devtools-extensions/shared/src/inject.js
renamed
packages/react-devtools-extensions/shared/src/injectGlobalHook.js
renamed
+3
-3
@@ -1,9 +1,9 @@
1
/* global chrome */
2
3
import nullthrows from 'nullthrows';
4
-import { installHook } from 'src/hook';
5
-import { SESSION_STORAGE_RELOAD_AND_PROFILE_KEY } from 'src/constants';
6
-import { sessionStorageGetItem } from 'src/storage';
4
+import { installHook } from 'react-devtools-shared/src/hook';
5
+import { SESSION_STORAGE_RELOAD_AND_PROFILE_KEY } from 'react-devtools-shared/src/constants';
6
+import { sessionStorageGetItem } from 'react-devtools-shared/src/storage';
7
8
function injectCode(code) {
9
const script = document.createElement('script');
packages/react-devtools-extensions/shared/src/main.js
renamed
+5
-5
@@ -2,21 +2,21 @@
2
3
import { createElement } from 'react';
4
import { unstable_createRoot as createRoot, flushSync } from 'react-dom';
5
-import Bridge from 'src/bridge';
6
-import Store from 'src/devtools/store';
5
+import Bridge from 'react-devtools-shared/src/bridge';
6
+import Store from 'react-devtools-shared/src/devtools/store';
7
import inject from './inject';
8
import {
9
createViewElementSource,
10
getBrowserName,
11
getBrowserTheme,
12
} from './utils';
13
-import { getSavedComponentFilters, getAppendComponentStack } from 'src/utils';
13
+import { getSavedComponentFilters, getAppendComponentStack } from 'react-devtools-shared/src/utils';
14
import {
15
localStorageGetItem,
16
localStorageRemoveItem,
17
localStorageSetItem,
18
-} from 'src/storage';
19
-import DevTools from 'src/devtools/views/DevTools';
18
+} from 'react-devtools-shared/src/storage';
19
+import DevTools from 'react-devtools-shared/src/devtools/views/DevTools';
20
21
const LOCAL_STORAGE_SUPPORTS_PROFILING_KEY =
22
'React::DevTools::supportsProfiling';
packages/react-devtools-extensions/shared/src/panel.js
renamed
packages/react-devtools-extensions/shared/src/renderer.js
renamed
+1
-1
@@ -8,7 +8,7 @@
8
* @flow
9
*/
10
11
-import { attach } from 'src/backend/renderer';
11
+import { attach } from 'react-devtools-shared/src/backend/renderer';
12
13
Object.defineProperty(
14
window,
packages/react-devtools-extensions/shared/src/utils.js
renamed
packages/react-devtools-extensions/shared/webpack.backend.js
renamed
+1
-1
@@ -1,6 +1,6 @@
1
const { resolve } = require('path');
2
const { DefinePlugin } = require('webpack');
3
-const { getGitHubURL, getVersionString } = require('../../utils');
3
+const { getGitHubURL, getVersionString } = require('../utils');
4
5
const NODE_ENV = process.env.NODE_ENV;
6
if (!NODE_ENV) {
packages/react-devtools-extensions/shared/webpack.config.js
renamed
+2
-7
@@ -1,6 +1,6 @@
1
const { resolve } = require('path');
2
const { DefinePlugin } = require('webpack');
3
-const { getGitHubURL, getVersionString } = require('../../utils');
3
+const { getGitHubURL, getVersionString } = require('../utils');
4
5
const NODE_ENV = process.env.NODE_ENV;
6
if (!NODE_ENV) {
@@ -28,11 +28,6 @@ module.exports = {
28
path: __dirname + '/build',
29
filename: '[name].js',
30
},
31
- resolve: {
32
- alias: {
33
- src: resolve(__dirname, '../../../src'),
34
- },
35
- },
31
plugins: [
32
new DefinePlugin({
33
__DEV__: false,
@@ -48,7 +43,7 @@ module.exports = {
43
test: /\.js$/,
44
loader: 'babel-loader',
45
options: {
51
- configFile: resolve(__dirname, '../../../babel.config.js'),
46
+ configFile: resolve(__dirname, '../babel.config.js'),
47
},
48
},
49
{
packages/react-devtools-extensions/utils.js
renamed
packages/react-devtools-inline/src/backend.js
+5
-5
@@ -1,10 +1,10 @@
1
/** @flow */
2
3
-import Agent from 'src/backend/agent';
4
-import Bridge from 'src/bridge';
5
-import { initBackend } from 'src/backend';
6
-import { installHook } from 'src/hook';
7
-import setupNativeStyleEditor from 'src/backend/NativeStyleEditor/setupNativeStyleEditor';
3
+import Agent from 'react-devtools-shared/src/backend/agent';
4
+import Bridge from 'react-devtools-shared/src/bridge';
5
+import { initBackend } from 'react-devtools-shared/src/backend';
6
+import { installHook } from 'react-devtools-shared/src/hook';
7
+import setupNativeStyleEditor from 'react-devtools-shared/src/backend/NativeStyleEditor/setupNativeStyleEditor';
8
import {
9
MESSAGE_TYPE_GET_SAVED_PREFERENCES,
10
MESSAGE_TYPE_SAVED_PREFERENCES,
packages/react-devtools-inline/src/frontend.js
+7
-7
@@ -1,21 +1,21 @@
1
/** @flow */
2
3
import React, { forwardRef } from 'react';
4
-import Bridge from 'src/bridge';
5
-import Store from 'src/devtools/store';
6
-import DevTools from 'src/devtools/views/DevTools';
7
-import { getSavedComponentFilters, getAppendComponentStack } from 'src/utils';
4
+import Bridge from 'react-devtools-shared/src/bridge';
5
+import Store from 'react-devtools-shared/src/devtools/store';
6
+import DevTools from 'react-devtools-shared/src/devtools/views/DevTools';
7
+import { getSavedComponentFilters, getAppendComponentStack } from 'react-devtools-shared/src/utils';
8
import {
9
MESSAGE_TYPE_GET_SAVED_PREFERENCES,
10
MESSAGE_TYPE_SAVED_PREFERENCES,
11
} from './constants';
12
13
-import type { FrontendBridge } from 'src/bridge';
14
-import type { Props } from 'src/devtools/views/DevTools';
13
+import type { FrontendBridge } from 'react-devtools-shared/src/bridge';
14
+import type { Props } from 'react-devtools-shared/src/devtools/views/DevTools';
15
16
export function initialize(
17
contentWindow: window
18
-): React$AbstractComponent<Props, mixed> {
18
+): React.AbstractComponent<Props, mixed> {
19
const onMessage = ({ data, source }) => {
20
if (source === 'react-devtools-content-script') {
21
// Ignore messages from the DevTools browser extension.
packages/react-devtools-shared/package.json
new
+13
@@ -0,0 +1,13 @@
1
+{
2
+ "private": true,
3
+ "name": "react-devtools-shared",
4
+ "version": "0.0.0",
5
+ "dependencies": {
6
+ "@reach/menu-button": "^0.1.17",
7
+ "@reach/tooltip": "^0.2.2",
8
+ "clipboard-js": "^0.3.6",
9
+ "lodash.throttle": "^4.1.1",
10
+ "memoize-one": "^3.1.1",
11
+ "react-virtualized-auto-sizer": "^1.0.2"
12
+ }
13
+}
packages/react-devtools-shared/src/__tests__/bridge-test.js
+1
-1
@@ -4,7 +4,7 @@ describe('Bridge', () => {
4
let Bridge;
5
6
beforeEach(() => {
7
- Bridge = require('src/bridge').default;
7
+ Bridge = require('react-devtools-shared/src/bridge').default;
8
});
9
10
it('should shutdown properly', () => {
packages/react-devtools-shared/src/__tests__/inspectedElementContext-test.js
+9
-9
@@ -1,9 +1,9 @@
1
// @flow
2
3
import typeof ReactTestRenderer from 'react-test-renderer';
4
-import type { GetInspectedElementPath } from 'src/devtools/views/Components/InspectedElementContext';
5
-import type { FrontendBridge } from 'src/bridge';
6
-import type Store from 'src/devtools/store';
4
+import type { GetInspectedElementPath } from 'react-devtools-shared/src/devtools/views/Components/InspectedElementContext';
5
+import type { FrontendBridge } from 'react-devtools-shared/src/bridge';
6
+import type Store from 'react-devtools-shared/src/devtools/store';
7
8
describe('InspectedElementContext', () => {
9
let React;
@@ -25,7 +25,7 @@ describe('InspectedElementContext', () => {
25
utils = require('./utils');
26
utils.beforeEachProfiling();
27
28
- meta = require('src/hydration').meta;
28
+ meta = require('react-devtools-shared/src/hydration').meta;
29
30
bridge = global.bridge;
31
store = global.store;
@@ -36,13 +36,13 @@ describe('InspectedElementContext', () => {
36
TestUtils = require('react-dom/test-utils');
37
TestRenderer = utils.requireTestRenderer();
38
39
- BridgeContext = require('src/devtools/views/context').BridgeContext;
40
- InspectedElementContext = require('src/devtools/views/Components/InspectedElementContext')
39
+ BridgeContext = require('react-devtools-shared/src/devtools/views/context').BridgeContext;
40
+ InspectedElementContext = require('react-devtools-shared/src/devtools/views/Components/InspectedElementContext')
41
.InspectedElementContext;
42
- InspectedElementContextController = require('src/devtools/views/Components/InspectedElementContext')
42
+ InspectedElementContextController = require('react-devtools-shared/src/devtools/views/Components/InspectedElementContext')
43
.InspectedElementContextController;
44
- StoreContext = require('src/devtools/views/context').StoreContext;
45
- TreeContextController = require('src/devtools/views/Components/TreeContext')
44
+ StoreContext = require('react-devtools-shared/src/devtools/views/context').StoreContext;
45
+ TreeContextController = require('react-devtools-shared/src/devtools/views/Components/TreeContext')
46
.TreeContextController;
47
});
48
packages/react-devtools-shared/src/__tests__/legacy/inspectElement-test.js
+6
-6
@@ -1,9 +1,9 @@
1
// @flow
2
3
-import type { InspectedElementPayload } from 'src/backend/types';
4
-import type { DehydratedData } from 'src/devtools/views/Components/types';
5
-import type { FrontendBridge } from 'src/bridge';
6
-import type Store from 'src/devtools/store';
3
+import type { InspectedElementPayload } from 'react-devtools-shared/src/backend/types';
4
+import type { DehydratedData } from 'react-devtools-shared/src/devtools/views/Components/types';
5
+import type { FrontendBridge } from 'react-devtools-shared/src/bridge';
6
+import type Store from 'react-devtools-shared/src/devtools/store';
7
8
describe('InspectedElementContext', () => {
9
let React;
@@ -59,8 +59,8 @@ describe('InspectedElementContext', () => {
59
bridge = global.bridge;
60
store = global.store;
61
62
- hydrate = require('src/hydration').hydrate;
63
- meta = require('src/hydration').meta;
62
+ hydrate = require('react-devtools-shared/src/hydration').hydrate;
63
+ meta = require('react-devtools-shared/src/hydration').meta;
64
65
// Redirect all React/ReactDOM requires to the v15 UMD.
66
// We use the UMD because Jest doesn't enable us to mock deep imports (e.g. "react/lib/Something").
packages/react-devtools-shared/src/__tests__/ownersListContext-test.js
+8
-8
@@ -1,9 +1,9 @@
1
// @flow
2
3
import typeof ReactTestRenderer from 'react-test-renderer';
4
-import type { Element } from 'src/devtools/views/Components/types';
5
-import type { FrontendBridge } from 'src/bridge';
6
-import type Store from 'src/devtools/store';
4
+import type { Element } from 'react-devtools-shared/src/devtools/views/Components/types';
5
+import type { FrontendBridge } from 'react-devtools-shared/src/bridge';
6
+import type Store from 'react-devtools-shared/src/devtools/store';
7
8
describe('OwnersListContext', () => {
9
let React;
@@ -31,13 +31,13 @@ describe('OwnersListContext', () => {
31
ReactDOM = require('react-dom');
32
TestRenderer = utils.requireTestRenderer();
33
34
- BridgeContext = require('src/devtools/views/context').BridgeContext;
35
- OwnersListContext = require('src/devtools/views/Components/OwnersListContext')
34
+ BridgeContext = require('react-devtools-shared/src/devtools/views/context').BridgeContext;
35
+ OwnersListContext = require('react-devtools-shared/src/devtools/views/Components/OwnersListContext')
36
.OwnersListContext;
37
- OwnersListContextController = require('src/devtools/views/Components/OwnersListContext')
37
+ OwnersListContextController = require('react-devtools-shared/src/devtools/views/Components/OwnersListContext')
38
.OwnersListContextController;
39
- StoreContext = require('src/devtools/views/context').StoreContext;
40
- TreeContextController = require('src/devtools/views/Components/TreeContext')
39
+ StoreContext = require('react-devtools-shared/src/devtools/views/context').StoreContext;
40
+ TreeContextController = require('react-devtools-shared/src/devtools/views/Components/TreeContext')
41
.TreeContextController;
42
});
43
packages/react-devtools-shared/src/__tests__/profilerContext-test.js
+11
-11
@@ -1,10 +1,10 @@
1
// @flow
2
3
import typeof ReactTestRenderer from 'react-test-renderer';
4
-import type { FrontendBridge } from 'src/bridge';
5
-import type { Context } from 'src/devtools/views/Profiler/ProfilerContext';
6
-import type { DispatcherContext } from 'src/devtools/views/Components/TreeContext';
7
-import type Store from 'src/devtools/store';
4
+import type { FrontendBridge } from 'react-devtools-shared/src/bridge';
5
+import type { Context } from 'react-devtools-shared/src/devtools/views/Profiler/ProfilerContext';
6
+import type { DispatcherContext } from 'react-devtools-shared/src/devtools/views/Components/TreeContext';
7
+import type Store from 'react-devtools-shared/src/devtools/store';
8
9
describe('ProfilerContext', () => {
10
let React;
@@ -35,17 +35,17 @@ describe('ProfilerContext', () => {
35
ReactDOM = require('react-dom');
36
TestRenderer = utils.requireTestRenderer();
37
38
- BridgeContext = require('src/devtools/views/context').BridgeContext;
39
- ProfilerContext = require('src/devtools/views/Profiler/ProfilerContext')
38
+ BridgeContext = require('react-devtools-shared/src/devtools/views/context').BridgeContext;
39
+ ProfilerContext = require('react-devtools-shared/src/devtools/views/Profiler/ProfilerContext')
40
.ProfilerContext;
41
- ProfilerContextController = require('src/devtools/views/Profiler/ProfilerContext')
41
+ ProfilerContextController = require('react-devtools-shared/src/devtools/views/Profiler/ProfilerContext')
42
.ProfilerContextController;
43
- StoreContext = require('src/devtools/views/context').StoreContext;
44
- TreeContextController = require('src/devtools/views/Components/TreeContext')
43
+ StoreContext = require('react-devtools-shared/src/devtools/views/context').StoreContext;
44
+ TreeContextController = require('react-devtools-shared/src/devtools/views/Components/TreeContext')
45
.TreeContextController;
46
- TreeDispatcherContext = require('src/devtools/views/Components/TreeContext')
46
+ TreeDispatcherContext = require('react-devtools-shared/src/devtools/views/Components/TreeContext')
47
.TreeDispatcherContext;
48
- TreeStateContext = require('src/devtools/views/Components/TreeContext')
48
+ TreeStateContext = require('react-devtools-shared/src/devtools/views/Components/TreeContext')
49
.TreeStateContext;
50
});
51
packages/react-devtools-shared/src/__tests__/profilerStore-test.js
+1
-1
@@ -1,6 +1,6 @@
1
// @flow
2
3
-import type Store from 'src/devtools/store';
3
+import type Store from 'react-devtools-shared/src/devtools/store';
4
5
describe('ProfilerStore', () => {
6
let React;
packages/react-devtools-shared/src/__tests__/profilingCache-test.js
+2
-2
@@ -1,8 +1,8 @@
1
// @flow
2
3
import typeof ReactTestRenderer from 'react-test-renderer';
4
-import type { FrontendBridge } from 'src/bridge';
5
-import type Store from 'src/devtools/store';
4
+import type { FrontendBridge } from 'react-devtools-shared/src/bridge';
5
+import type Store from 'react-devtools-shared/src/devtools/store';
6
7
describe('ProfilingCache', () => {
8
let PropTypes;
packages/react-devtools-shared/src/__tests__/profilingCharts-test.js
+1
-1
@@ -1,7 +1,7 @@
1
// @flow
2
3
import typeof TestRendererType from 'react-test-renderer';
4
-import type Store from 'src/devtools/store';
4
+import type Store from 'react-devtools-shared/src/devtools/store';
5
6
describe('profiling charts', () => {
7
let React;
packages/react-devtools-shared/src/__tests__/profilingCommitTreeBuilder-test.js
+1
-1
@@ -1,7 +1,7 @@
1
// @flow
2
3
import typeof TestRendererType from 'react-test-renderer';
4
-import type Store from 'src/devtools/store';
4
+import type Store from 'react-devtools-shared/src/devtools/store';
5
6
describe('commit tree', () => {
7
let React;
packages/react-devtools-shared/src/__tests__/profilingUtils-test.js
+1
-1
@@ -4,7 +4,7 @@ describe('profiling utils', () => {
4
let utils;
5
6
beforeEach(() => {
7
- utils = require('src/devtools/views/Profiler/utils');
7
+ utils = require('react-devtools-shared/src/devtools/views/Profiler/utils');
8
});
9
10
it('should throw if importing older/unsupported data', () => {
packages/react-devtools-shared/src/__tests__/setupTests.js
+7
-7
@@ -1,6 +1,6 @@
1
// @flow
2
3
-import type { BackendBridge, FrontendBridge } from 'src/bridge';
3
+import type { BackendBridge, FrontendBridge } from 'react-devtools-shared/src/bridge';
4
5
const env = jasmine.getEnv();
6
env.beforeEach(() => {
@@ -8,15 +8,15 @@ env.beforeEach(() => {
8
// rather than imported at the head of the module.
9
// That's because we reset modules between tests,
10
// which disconnects the DevTool's cache from the current dispatcher ref.
11
- const Agent = require('src/backend/agent').default;
12
- const { initBackend } = require('src/backend');
13
- const Bridge = require('src/bridge').default;
14
- const Store = require('src/devtools/store').default;
15
- const { installHook } = require('src/hook');
11
+ const Agent = require('react-devtools-shared/src/backend/agent').default;
12
+ const { initBackend } = require('react-devtools-shared/src/backend');
13
+ const Bridge = require('react-devtools-shared/src/bridge').default;
14
+ const Store = require('react-devtools-shared/src/devtools/store').default;
15
+ const { installHook } = require('react-devtools-shared/src/hook');
16
const {
17
getDefaultComponentFilters,
18
saveComponentFilters,
19
- } = require('src/utils');
19
+ } = require('react-devtools-shared/src/utils');
20
21
// Fake timers let us flush Bridge operations between setup and assertions.
22
jest.useFakeTimers();
packages/react-devtools-shared/src/__tests__/storeComponentFilters-test.js
+3
-3
@@ -1,7 +1,7 @@
1
// @flow
2
3
-import type { FrontendBridge } from 'src/bridge';
4
-import type Store from 'src/devtools/store';
3
+import type { FrontendBridge } from 'react-devtools-shared/src/bridge';
4
+import type Store from 'react-devtools-shared/src/devtools/store';
5
6
describe('Store component filters', () => {
7
let React;
@@ -29,7 +29,7 @@ describe('Store component filters', () => {
29
React = require('react');
30
ReactDOM = require('react-dom');
31
TestUtils = require('react-dom/test-utils');
32
- Types = require('src/types');
32
+ Types = require('react-devtools-shared/src/types');
33
utils = require('./utils');
34
});
35
packages/react-devtools-shared/src/__tests__/storeSerializer.js
+1
-1
@@ -3,7 +3,7 @@ export function test(maybeStore) {
3
// It's important to lazy-require the Store rather than imported at the head of the module.
4
// Because we reset modules between tests, different Store implementations will be used for each test.
5
// Unfortunately Jest does not reset its own serializer modules.
6
- return maybeStore instanceof require('src/devtools/store').default;
6
+ return maybeStore instanceof require('react-devtools-shared/src/devtools/store').default;
7
}
8
9
// print() is part of Jest's serializer API
packages/react-devtools-shared/src/__tests__/treeContext-test.js
+6
-6
@@ -1,12 +1,12 @@
1
// @flow
2
3
import typeof ReactTestRenderer from 'react-test-renderer';
4
-import type { FrontendBridge } from 'src/bridge';
5
-import type Store from 'src/devtools/store';
4
+import type { FrontendBridge } from 'react-devtools-shared/src/bridge';
5
+import type Store from 'react-devtools-shared/src/devtools/store';
6
import type {
7
DispatcherContext,
8
StateContext,
9
-} from 'src/devtools/views/Components/TreeContext';
9
+} from 'react-devtools-shared/src/devtools/views/Components/TreeContext';
10
11
describe('TreeListContext', () => {
12
let React;
@@ -35,9 +35,9 @@ describe('TreeListContext', () => {
35
ReactDOM = require('react-dom');
36
TestRenderer = utils.requireTestRenderer();
37
38
- BridgeContext = require('src/devtools/views/context').BridgeContext;
39
- StoreContext = require('src/devtools/views/context').StoreContext;
40
- TreeContext = require('src/devtools/views/Components/TreeContext');
38
+ BridgeContext = require('react-devtools-shared/src/devtools/views/context').BridgeContext;
39
+ StoreContext = require('react-devtools-shared/src/devtools/views/context').StoreContext;
40
+ TreeContext = require('react-devtools-shared/src/devtools/views/Components/TreeContext');
41
});
42
43
afterEach(() => {
packages/react-devtools-shared/src/__tests__/utils.js
+9
-9
@@ -2,10 +2,10 @@
2
3
import typeof ReactTestRenderer from 'react-test-renderer';
4
5
-import type { FrontendBridge } from 'src/bridge';
6
-import type Store from 'src/devtools/store';
7
-import type { ProfilingDataFrontend } from 'src/devtools/views/Profiler/types';
8
-import type { ElementType } from 'src/types';
5
+import type { FrontendBridge } from 'react-devtools-shared/src/bridge';
6
+import type Store from 'react-devtools-shared/src/devtools/store';
7
+import type { ProfilingDataFrontend } from 'react-devtools-shared/src/devtools/views/Profiler/types';
8
+import type { ElementType } from 'react-devtools-shared/src/types';
9
10
export function act(callback: Function): void {
11
const { act: actTestRenderer } = require('react-test-renderer');
@@ -75,7 +75,7 @@ export function createDisplayNameFilter(
75
source: string,
76
isEnabled: boolean = true
77
) {
78
- const Types = require('src/types');
78
+ const Types = require('react-devtools-shared/src/types');
79
let isValid = true;
80
try {
81
new RegExp(source);
@@ -91,7 +91,7 @@ export function createDisplayNameFilter(
91
}
92
93
export function createHOCFilter(isEnabled: boolean = true) {
94
- const Types = require('src/types');
94
+ const Types = require('react-devtools-shared/src/types');
95
return {
96
type: Types.ComponentFilterHOC,
97
isEnabled,
@@ -103,7 +103,7 @@ export function createElementTypeFilter(
103
elementType: ElementType,
104
isEnabled: boolean = true
105
) {
106
- const Types = require('src/types');
106
+ const Types = require('react-devtools-shared/src/types');
107
return {
108
type: Types.ComponentFilterElementType,
109
isEnabled,
@@ -115,7 +115,7 @@ export function createLocationFilter(
115
source: string,
116
isEnabled: boolean = true
117
) {
118
- const Types = require('src/types');
118
+ const Types = require('react-devtools-shared/src/types');
119
let isValid = true;
120
try {
121
new RegExp(source);
@@ -166,7 +166,7 @@ export function exportImportHelper(bridge: FrontendBridge, store: Store): void {
166
const {
167
prepareProfilingDataExport,
168
prepareProfilingDataFrontendFromExport,
169
- } = require('src/devtools/views/Profiler/utils');
169
+ } = require('react-devtools-shared/src/devtools/views/Profiler/utils');
170
171
const { profilerStore } = store;
172
packages/react-devtools-shared/src/backend/NativeStyleEditor/setupNativeStyleEditor.js
+2
-2
@@ -1,9 +1,9 @@
1
// @flow
2
3
-import Agent from 'src/backend/agent';
3
+import Agent from 'react-devtools-shared/src/backend/agent';
4
import resolveBoxStyle from './resolveBoxStyle';
5
6
-import type { BackendBridge } from 'src/bridge';
6
+import type { BackendBridge } from 'react-devtools-shared/src/bridge';
7
import type { RendererID } from '../types';
8
import type { StyleAndLayout } from './types';
9
packages/react-devtools-shared/src/backend/agent.js
+2
-2
@@ -12,11 +12,11 @@ import {
12
sessionStorageGetItem,
13
sessionStorageRemoveItem,
14
sessionStorageSetItem,
15
-} from 'src/storage';
15
+} from 'react-devtools-shared/src/storage';
16
import setupHighlighter from './views/Highlighter';
17
import { patch as patchConsole, unpatch as unpatchConsole } from './console';
18
19
-import type { BackendBridge } from 'src/bridge';
19
+import type { BackendBridge } from 'react-devtools-shared/src/bridge';
20
import type {
21
InstanceAndStyle,
22
NativeType,
packages/react-devtools-shared/src/backend/legacy/renderer.js
+3
-3
@@ -6,10 +6,10 @@ import {
6
ElementTypeRoot,
7
ElementTypeHostComponent,
8
ElementTypeOtherOrUnknown,
9
-} from 'src/types';
9
+} from 'react-devtools-shared/src/types';
10
import { getUID, utfEncodeString, printOperationsArray } from '../../utils';
11
import { cleanForBridge, copyWithSet } from '../utils';
12
-import { getDisplayName } from 'src/utils';
12
+import { getDisplayName } from 'react-devtools-shared/src/utils';
13
import {
14
__DEBUG__,
15
TREE_OPERATION_ADD,
@@ -28,7 +28,7 @@ import type {
28
PathMatch,
29
RendererInterface,
30
} from '../types';
31
-import type { ComponentFilter, ElementType } from 'src/types';
31
+import type { ComponentFilter, ElementType } from 'react-devtools-shared/src/types';
32
import type { Owner, InspectedElement } from '../types';
33
34
export type InternalInstance = Object;
packages/react-devtools-shared/src/backend/renderer.js
+5
-5
@@ -16,7 +16,7 @@ import {
16
ElementTypeProfiler,
17
ElementTypeRoot,
18
ElementTypeSuspense,
19
-} from 'src/types';
19
+} from 'react-devtools-shared/src/types';
20
import {
21
getDisplayName,
22
getDefaultComponentFilters,
@@ -24,8 +24,8 @@ import {
24
getUID,
25
setInObject,
26
utfEncodeString,
27
-} from 'src/utils';
28
-import { sessionStorageGetItem } from 'src/storage';
27
+} from 'react-devtools-shared/src/utils';
28
+import { sessionStorageGetItem } from 'react-devtools-shared/src/storage';
29
import { cleanForBridge, copyWithSet } from './utils';
30
import {
31
__DEBUG__,
@@ -58,8 +58,8 @@ import type {
58
ReactRenderer,
59
RendererInterface,
60
} from './types';
61
-import type { Interaction } from 'src/devtools/views/Profiler/types';
62
-import type { ComponentFilter, ElementType } from 'src/types';
61
+import type { Interaction } from 'react-devtools-shared/src/devtools/views/Profiler/types';
62
+import type { ComponentFilter, ElementType } from 'react-devtools-shared/src/types';
63
64
type getDisplayNameForFiberType = (fiber: Fiber) => string | null;
65
type getTypeSymbolType = (type: any) => Symbol | number;
packages/react-devtools-shared/src/backend/types.js
+3
-3
@@ -1,8 +1,8 @@
1
// @flow
2
3
-import type { ComponentFilter, ElementType } from 'src/types';
4
-import type { Interaction } from 'src/devtools/views/Profiler/types';
5
-import type { ResolveNativeStyle } from 'src/backend/NativeStyleEditor/setupNativeStyleEditor';
3
+import type { ComponentFilter, ElementType } from 'react-devtools-shared/src/types';
4
+import type { Interaction } from 'react-devtools-shared/src/devtools/views/Profiler/types';
5
+import type { ResolveNativeStyle } from 'react-devtools-shared/src/backend/NativeStyleEditor/setupNativeStyleEditor';
6
7
type BundleType =
8
| 0 // PROD
packages/react-devtools-shared/src/backend/utils.js
+1
-1
@@ -2,7 +2,7 @@
2
3
import { dehydrate } from '../hydration';
4
5
-import type { DehydratedData } from 'src/devtools/views/Components/types';
5
+import type { DehydratedData } from 'react-devtools-shared/src/devtools/views/Components/types';
6
7
export function cleanForBridge(
8
data: Object | null,
packages/react-devtools-shared/src/backend/views/Highlighter/index.js
+2
-2
@@ -2,10 +2,10 @@
2
3
import memoize from 'memoize-one';
4
import throttle from 'lodash.throttle';
5
-import Agent from 'src/backend/agent';
5
+import Agent from 'react-devtools-shared/src/backend/agent';
6
import { hideOverlay, showOverlay } from './Highlighter';
7
8
-import type { BackendBridge } from 'src/bridge';
8
+import type { BackendBridge } from 'react-devtools-shared/src/bridge';
9
10
// This plug-in provides in-page highlighting of the selected element.
11
// It is used by the browser extension nad the standalone DevTools shell (when connected to a browser).
packages/react-devtools-shared/src/bridge.js
+10
-6
@@ -8,8 +8,8 @@ import type {
8
OwnersList,
9
ProfilingDataBackend,
10
RendererID,
11
-} from 'src/backend/types';
12
-import type { StyleAndLayout as StyleAndLayoutPayload } from 'src/backend/NativeStyleEditor/types';
11
+} from 'react-devtools-shared/src/backend/types';
12
+import type { StyleAndLayout as StyleAndLayoutPayload } from 'react-devtools-shared/src/backend/NativeStyleEditor/types';
13
14
const BATCH_DURATION = 100;
15
@@ -205,8 +205,10 @@ class Bridge<
205
} while (this._messageQueue.length);
206
207
// Make sure once again that there is no dangling timer.
208
- clearTimeout(this._timeoutID);
209
- this._timeoutID = null;
208
+ if (this._timeoutID !== null) {
209
+ clearTimeout(this._timeoutID);
210
+ this._timeoutID = null;
211
+ }
212
}
213
214
_flush = () => {
@@ -214,8 +216,10 @@ class Bridge<
216
// so we do not bail out if the bridge marked as destroyed.
217
// It is a private method that the bridge ensures is only called at the right times.
218
217
- clearTimeout(this._timeoutID);
218
- this._timeoutID = null;
219
+ if (this._timeoutID !== null) {
220
+ clearTimeout(this._timeoutID);
221
+ this._timeoutID = null;
222
+ }
223
224
if (this._messageQueue.length) {
225
for (let i = 0; i < this._messageQueue.length; i += 2) {
packages/react-devtools-shared/src/constants.js
+8
-5
@@ -34,12 +34,10 @@ export const CHANGE_LOG_URL =
34
// Sometimes the inline target is rendered before root styles are applied,
35
// which would result in e.g. NaN itemSize being passed to react-window list.
36
//
37
-// We can't use the Webpack loader syntax in the context of Jest though,
38
-// so tests need some reasonably meaningful fallback value.
39
-let COMFORTABLE_LINE_HEIGHT = 15;
40
-let COMPACT_LINE_HEIGHT = 10;
37
+let COMFORTABLE_LINE_HEIGHT;
38
+let COMPACT_LINE_HEIGHT;
39
42
-if (!__TEST__) {
40
+try {
41
// $FlowFixMe
42
const rawStyleString = require('!!raw-loader!src/devtools/views/root.css') // eslint-disable-line import/no-webpack-loader-syntax
43
.default;
@@ -52,6 +50,11 @@ if (!__TEST__) {
50
51
COMFORTABLE_LINE_HEIGHT = extractVar('comfortable-line-height-data');
52
COMPACT_LINE_HEIGHT = extractVar('compact-line-height-data');
53
+} catch (error) {
54
+ // We can't use the Webpack loader syntax in the context of Jest,
55
+ // so tests need some reasonably meaningful fallback value.
56
+ COMFORTABLE_LINE_HEIGHT = 15;
57
+ COMPACT_LINE_HEIGHT = 10;
58
}
59
60
export { COMFORTABLE_LINE_HEIGHT, COMPACT_LINE_HEIGHT };
packages/react-devtools-shared/src/devtools/ProfilerStore.js
+2
-2
@@ -5,8 +5,8 @@ import { prepareProfilingDataFrontendFromBackendAndStore } from './views/Profile
5
import ProfilingCache from './ProfilingCache';
6
import Store from './store';
7
8
-import type { FrontendBridge } from 'src/bridge';
9
-import type { ProfilingDataBackend } from 'src/backend/types';
8
+import type { FrontendBridge } from 'react-devtools-shared/src/bridge';
9
+import type { ProfilingDataBackend } from 'react-devtools-shared/src/backend/types';
10
import type {
11
CommitDataFrontend,
12
ProfilingDataForRootFrontend,
packages/react-devtools-shared/src/devtools/ProfilingCache.js
+8
-8
@@ -4,24 +4,24 @@ import ProfilerStore from './ProfilerStore';
4
import {
5
getCommitTree,
6
invalidateCommitTrees,
7
-} from 'src/devtools/views/Profiler/CommitTreeBuilder';
7
+} from 'react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder';
8
import {
9
getChartData as getFlamegraphChartData,
10
invalidateChartData as invalidateFlamegraphChartData,
11
-} from 'src/devtools/views/Profiler/FlamegraphChartBuilder';
11
+} from 'react-devtools-shared/src/devtools/views/Profiler/FlamegraphChartBuilder';
12
import {
13
getChartData as getInteractionsChartData,
14
invalidateChartData as invalidateInteractionsChartData,
15
-} from 'src/devtools/views/Profiler/InteractionsChartBuilder';
15
+} from 'react-devtools-shared/src/devtools/views/Profiler/InteractionsChartBuilder';
16
import {
17
getChartData as getRankedChartData,
18
invalidateChartData as invalidateRankedChartData,
19
-} from 'src/devtools/views/Profiler/RankedChartBuilder';
19
+} from 'react-devtools-shared/src/devtools/views/Profiler/RankedChartBuilder';
20
21
-import type { CommitTree } from 'src/devtools/views/Profiler/types';
22
-import type { ChartData as FlamegraphChartData } from 'src/devtools/views/Profiler/FlamegraphChartBuilder';
23
-import type { ChartData as InteractionsChartData } from 'src/devtools/views/Profiler/InteractionsChartBuilder';
24
-import type { ChartData as RankedChartData } from 'src/devtools/views/Profiler/RankedChartBuilder';
21
+import type { CommitTree } from 'react-devtools-shared/src/devtools/views/Profiler/types';
22
+import type { ChartData as FlamegraphChartData } from 'react-devtools-shared/src/devtools/views/Profiler/FlamegraphChartBuilder';
23
+import type { ChartData as InteractionsChartData } from 'react-devtools-shared/src/devtools/views/Profiler/InteractionsChartBuilder';
24
+import type { ChartData as RankedChartData } from 'react-devtools-shared/src/devtools/views/Profiler/RankedChartBuilder';
25
26
export default class ProfilingCache {
27
_fiberCommits: Map<number, Array<number>> = new Map();
packages/react-devtools-shared/src/devtools/index.js
+1
-1
@@ -1,6 +1,6 @@
1
// @flow
2
3
-import type { FrontendBridge } from 'src/bridge';
3
+import type { FrontendBridge } from 'react-devtools-shared/src/bridge';
4
5
type Shell = {|
6
connect: (callback: Function) => void,
packages/react-devtools-shared/src/devtools/store.js
+2
-2
@@ -18,12 +18,12 @@ import {
18
} from '../utils';
19
import { localStorageGetItem, localStorageSetItem } from '../storage';
20
import { __DEBUG__ } from '../constants';
21
-import { printStore } from 'src/__tests__/storeSerializer';
21
+import { printStore } from '../__tests__/storeSerializer';
22
import ProfilerStore from './ProfilerStore';
23
24
import type { Element } from './views/Components/types';
25
import type { ComponentFilter, ElementType } from '../types';
26
-import type { FrontendBridge } from 'src/bridge';
26
+import type { FrontendBridge } from 'react-devtools-shared/src/bridge';
27
28
const debug = (methodName, ...args) => {
29
if (__DEBUG__) {
packages/react-devtools-shared/src/devtools/views/Components/Badge.js
+2
-2
@@ -1,10 +1,10 @@
1
// @flow
2
3
import React, { Fragment } from 'react';
4
-import { ElementTypeMemo, ElementTypeForwardRef } from 'src/types';
4
+import { ElementTypeMemo, ElementTypeForwardRef } from 'react-devtools-shared/src/types';
5
import styles from './Badge.css';
6
7
-import type { ElementType } from 'src/types';
7
+import type { ElementType } from 'react-devtools-shared/src/types';
8
9
type Props = {|
10
className?: string,
packages/react-devtools-shared/src/devtools/views/Components/Components.js
+2
-2
@@ -8,8 +8,8 @@ import { NativeStyleContextController } from './NativeStyleEditor/context';
8
import { OwnersListContextController } from './OwnersListContext';
9
import portaledContent from '../portaledContent';
10
import { ModalDialog } from '../ModalDialog';
11
-import SettingsModal from 'src/devtools/views/Settings/SettingsModal';
12
-import { SettingsModalContextController } from 'src/devtools/views/Settings/SettingsModalContext';
11
+import SettingsModal from 'react-devtools-shared/src/devtools/views/Settings/SettingsModal';
12
+import { SettingsModalContextController } from 'react-devtools-shared/src/devtools/views/Settings/SettingsModalContext';
13
14
import styles from './Components.css';
15
packages/react-devtools-shared/src/devtools/views/Components/Element.js
+1
-1
@@ -1,7 +1,7 @@
1
// @flow
2
3
import React, { Fragment, useContext, useMemo, useState } from 'react';
4
-import Store from 'src/devtools/store';
4
+import Store from 'react-devtools-shared/src/devtools/store';
5
import Badge from './Badge';
6
import ButtonIcon from '../ButtonIcon';
7
import { createRegExp } from '../utils';
packages/react-devtools-shared/src/devtools/views/Components/HocBadges.js
+1
-1
@@ -1,7 +1,7 @@
1
// @flow
2
3
import React from 'react';
4
-import { ElementTypeForwardRef, ElementTypeMemo } from 'src/types';
4
+import { ElementTypeForwardRef, ElementTypeMemo } from 'react-devtools-shared/src/types';
5
import styles from './HocBadges.css';
6
7
import type { Element } from './types';
packages/react-devtools-shared/src/devtools/views/Components/HooksTree.js
+1
-1
@@ -14,7 +14,7 @@ import styles from './HooksTree.css';
14
import { meta } from '../../../hydration';
15
16
import type { InspectPath } from './SelectedElement';
17
-import type { HooksNode, HooksTree } from 'src/backend/types';
17
+import type { HooksNode, HooksTree } from 'react-devtools-shared/src/backend/types';
18
19
type HooksTreeViewProps = {|
20
canEditHooks: boolean,
packages/react-devtools-shared/src/devtools/views/Components/InspectedElementContext.js
+4
-4
@@ -11,19 +11,19 @@ import React, {
11
import { unstable_batchedUpdates as batchedUpdates } from 'react-dom';
12
import { createResource } from '../../cache';
13
import { BridgeContext, StoreContext } from '../context';
14
-import { hydrate, fillInPath } from 'src/hydration';
14
+import { hydrate, fillInPath } from 'react-devtools-shared/src/hydration';
15
import { TreeStateContext } from './TreeContext';
16
-import { separateDisplayNameAndHOCs } from 'src/utils';
16
+import { separateDisplayNameAndHOCs } from 'react-devtools-shared/src/utils';
17
18
import type {
19
InspectedElement as InspectedElementBackend,
20
InspectedElementPayload,
21
-} from 'src/backend/types';
21
+} from 'react-devtools-shared/src/backend/types';
22
import type {
23
DehydratedData,
24
Element,
25
InspectedElement as InspectedElementFrontend,
26
-} from 'src/devtools/views/Components/types';
26
+} from 'react-devtools-shared/src/devtools/views/Components/types';
27
import type { Resource, Thenable } from '../../cache';
28
29
export type GetInspectedElementPath = (
packages/react-devtools-shared/src/devtools/views/Components/InspectedElementTree.js
+1
-1
@@ -29,7 +29,7 @@ export default function InspectedElementTree({
29
}: Props) {
30
const isEmpty = data === null || Object.keys(data).length === 0;
31
32
- const handleCopy = useCallback(() => copy(serializeDataForCopy(data)), [
32
+ const handleCopy = useCallback(() => copy(serializeDataForCopy(((data: any): Object))), [
33
data,
34
]);
35
packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js
+1
-1
@@ -3,7 +3,7 @@
3
import React, { useContext, useMemo, useRef, useState } from 'react';
4
import { unstable_batchedUpdates as batchedUpdates } from 'react-dom';
5
import { copy } from 'clipboard-js';
6
-import { BridgeContext, StoreContext } from 'src/devtools/views/context';
6
+import { BridgeContext, StoreContext } from 'react-devtools-shared/src/devtools/views/context';
7
import Button from '../../Button';
8
import ButtonIcon from '../../ButtonIcon';
9
import { serializeDataForCopy } from '../../utils';
packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/context.js
+5
-5
@@ -9,14 +9,14 @@ import React, {
9
useState,
10
} from 'react';
11
import { unstable_batchedUpdates as batchedUpdates } from 'react-dom';
12
-import { createResource } from 'src/devtools/cache';
13
-import { BridgeContext, StoreContext } from 'src/devtools/views/context';
12
+import { createResource } from 'react-devtools-shared/src/devtools/cache';
13
+import { BridgeContext, StoreContext } from 'react-devtools-shared/src/devtools/views/context';
14
import { TreeStateContext } from '../TreeContext';
15
16
-import type { StyleAndLayout as StyleAndLayoutBackend } from 'src/backend/NativeStyleEditor/types';
16
+import type { StyleAndLayout as StyleAndLayoutBackend } from 'react-devtools-shared/src/backend/NativeStyleEditor/types';
17
import type { StyleAndLayout as StyleAndLayoutFrontend } from './types';
18
-import type { Element } from 'src/devtools/views/Components/types';
19
-import type { Resource, Thenable } from 'src/devtools/cache';
18
+import type { Element } from 'react-devtools-shared/src/devtools/views/Components/types';
19
+import type { Resource, Thenable } from 'react-devtools-shared/src/devtools/cache';
20
21
export type GetStyleAndLayout = (id: number) => StyleAndLayoutFrontend | null;
22
packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/index.js
+4
-4
@@ -1,9 +1,9 @@
1
// @flow
2
3
import React, { Fragment, useContext, useMemo } from 'react';
4
-import Store from 'src/devtools/store';
5
-import { StoreContext } from 'src/devtools/views/context';
6
-import { useSubscription } from 'src/devtools/views/hooks';
4
+import Store from 'react-devtools-shared/src/devtools/store';
5
+import { StoreContext } from 'react-devtools-shared/src/devtools/views/context';
6
+import { useSubscription } from 'react-devtools-shared/src/devtools/views/hooks';
7
import { NativeStyleContext } from './context';
8
import LayoutViewer from './LayoutViewer';
9
import StyleEditor from './StyleEditor';
@@ -26,7 +26,7 @@ export default function NativeStyleEditorWrapper(_: Props) {
26
}),
27
[store]
28
);
29
- const supportsNativeStyleEditor = useSubscription<boolean, Store>(
29
+ const supportsNativeStyleEditor = useSubscription<boolean>(
30
subscription
31
);
32
packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/types.js
+1
-1
@@ -3,7 +3,7 @@
3
import type {
4
Layout as LayoutBackend,
5
Style as StyleBackend,
6
-} from 'src/backend/NativeStyleEditor/types';
6
+} from 'react-devtools-shared/src/backend/NativeStyleEditor/types';
7
8
export type Layout = LayoutBackend;
9
export type Style = StyleBackend;
packages/react-devtools-shared/src/devtools/views/Components/OwnersListContext.js
+3
-3
@@ -9,10 +9,10 @@ import React, {
9
import { createResource } from '../../cache';
10
import { BridgeContext, StoreContext } from '../context';
11
import { TreeStateContext } from './TreeContext';
12
-import { separateDisplayNameAndHOCs } from 'src/utils';
12
+import { separateDisplayNameAndHOCs } from 'react-devtools-shared/src/utils';
13
14
-import type { OwnersList } from 'src/backend/types';
15
-import type { Element, Owner } from 'src/devtools/views/Components/types';
14
+import type { OwnersList } from 'react-devtools-shared/src/backend/types';
15
+import type { Element, Owner } from 'react-devtools-shared/src/devtools/views/Components/types';
16
import type { Resource, Thenable } from '../../cache';
17
18
type Context = (id: number) => Array<Owner> | null;
packages/react-devtools-shared/src/devtools/views/Components/SelectedElement.js
+2
-2
@@ -21,13 +21,13 @@ import {
21
ElementTypeFunction,
22
ElementTypeMemo,
23
ElementTypeSuspense,
24
-} from 'src/types';
24
+} from 'react-devtools-shared/src/types';
25
26
import styles from './SelectedElement.css';
27
28
import type { GetInspectedElementPath } from './InspectedElementContext';
29
import type { Element, InspectedElement } from './types';
30
-import type { ElementType } from 'src/types';
30
+import type { ElementType } from 'react-devtools-shared/src/types';
31
32
export type Props = {||};
33
packages/react-devtools-shared/src/devtools/views/Components/SelectedTreeHighlight.js
+1
-1
@@ -76,7 +76,7 @@ export default function SelectedTreeHighlight(_: {||}) {
76
}),
77
[selectedElementID, store]
78
);
79
- const data = useSubscription<Data | null, Store>(subscription);
79
+ const data = useSubscription<Data | null>(subscription);
80
81
if (ownerID !== null) {
82
return null;
packages/react-devtools-shared/src/devtools/views/Components/Tree.js
+1
-1
@@ -19,7 +19,7 @@ import ElementView from './Element';
19
import InspectHostNodesToggle from './InspectHostNodesToggle';
20
import OwnersStack from './OwnersStack';
21
import SearchInput from './SearchInput';
22
-import SettingsModalContextToggle from 'src/devtools/views/Settings/SettingsModalContextToggle';
22
+import SettingsModalContextToggle from 'react-devtools-shared/src/devtools/views/Settings/SettingsModalContextToggle';
23
import SelectedTreeHighlight from './SelectedTreeHighlight';
24
import TreeFocusedContext from './TreeFocusedContext';
25
packages/react-devtools-shared/src/devtools/views/Components/ViewElementSourceContext.js
+1
-1
@@ -5,7 +5,7 @@ import { createContext } from 'react';
5
import type {
6
CanViewElementSource,
7
ViewElementSource,
8
-} from 'src/devtools/views/DevTools';
8
+} from 'react-devtools-shared/src/devtools/views/DevTools';
9
10
export type Context = {|
11
canViewElementSourceFunction: CanViewElementSource | null,
packages/react-devtools-shared/src/devtools/views/Components/types.js
+1
-1
@@ -1,6 +1,6 @@
1
// @flow
2
3
-import type { ElementType } from 'src/types';
3
+import type { ElementType } from 'react-devtools-shared/src/types';
4
5
// Each element on the frontend corresponds to a Fiber on the backend.
6
// Some of its information (e.g. id, type, displayName) come from the backend.
packages/react-devtools-shared/src/devtools/views/DevTools.js
+4
-4
@@ -24,8 +24,8 @@ import styles from './DevTools.css';
24
25
import './root.css';
26
27
-import type { InspectedElement } from 'src/devtools/views/Components/types';
28
-import type { FrontendBridge } from 'src/bridge';
27
+import type { InspectedElement } from 'react-devtools-shared/src/devtools/views/Components/types';
28
+import type { FrontendBridge } from 'react-devtools-shared/src/bridge';
29
30
export type BrowserTheme = 'dark' | 'light';
31
export type TabID = 'components' | 'profiler';
@@ -79,7 +79,7 @@ const tabs = [componentsTab, profilerTab];
79
export default function DevTools({
80
bridge,
81
browserTheme = 'light',
82
- canViewElementSourceFunction = null,
82
+ canViewElementSourceFunction,
83
defaultTab = 'components',
84
componentsPortalContainer,
85
overrideTab,
@@ -88,7 +88,7 @@ export default function DevTools({
88
showWelcomeToTheNewDevToolsDialog = false,
89
store,
90
warnIfLegacyBackendDetected = false,
91
- viewElementSourceFunction = null,
91
+ viewElementSourceFunction,
92
}: Props) {
93
const [tab, setTab] = useState(defaultTab);
94
if (overrideTab != null && overrideTab !== tab) {
packages/react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder.js
+6
-6
@@ -6,17 +6,17 @@ import {
6
TREE_OPERATION_REMOVE,
7
TREE_OPERATION_REORDER_CHILDREN,
8
TREE_OPERATION_UPDATE_TREE_BASE_DURATION,
9
-} from 'src/constants';
10
-import { utfDecodeString } from 'src/utils';
11
-import { ElementTypeRoot } from 'src/types';
12
-import ProfilerStore from 'src/devtools/ProfilerStore';
9
+} from 'react-devtools-shared/src/constants';
10
+import { utfDecodeString } from 'react-devtools-shared/src/utils';
11
+import { ElementTypeRoot } from 'react-devtools-shared/src/types';
12
+import ProfilerStore from 'react-devtools-shared/src/devtools/ProfilerStore';
13
14
-import type { ElementType } from 'src/types';
14
+import type { ElementType } from 'react-devtools-shared/src/types';
15
import type {
16
CommitTree,
17
CommitTreeNode,
18
ProfilingDataForRootFrontend,
19
-} from 'src/devtools/views/Profiler/types';
19
+} from 'react-devtools-shared/src/devtools/views/Profiler/types';
20
21
const debug = (methodName, ...args) => {
22
if (__DEBUG__) {
packages/react-devtools-shared/src/devtools/views/Profiler/FlamegraphChartBuilder.js
+2
-2
@@ -1,8 +1,8 @@
1
// @flow
2
3
-import { ElementTypeForwardRef, ElementTypeMemo } from 'src/types';
3
+import { ElementTypeForwardRef, ElementTypeMemo } from 'react-devtools-shared/src/types';
4
import { formatDuration } from './utils';
5
-import ProfilerStore from 'src/devtools/ProfilerStore';
5
+import ProfilerStore from 'react-devtools-shared/src/devtools/ProfilerStore';
6
7
import type { CommitTree } from './types';
8
packages/react-devtools-shared/src/devtools/views/Profiler/InteractionsChartBuilder.js
+1
-1
@@ -1,6 +1,6 @@
1
// @flow
2
3
-import ProfilerStore from 'src/devtools/ProfilerStore';
3
+import ProfilerStore from 'react-devtools-shared/src/devtools/ProfilerStore';
4
5
import type { Interaction } from './types';
6
packages/react-devtools-shared/src/devtools/views/Profiler/Profiler.js
+3
-3
@@ -16,9 +16,9 @@ import SnapshotSelector from './SnapshotSelector';
16
import SidebarCommitInfo from './SidebarCommitInfo';
17
import SidebarInteractions from './SidebarInteractions';
18
import SidebarSelectedFiberInfo from './SidebarSelectedFiberInfo';
19
-import SettingsModal from 'src/devtools/views/Settings/SettingsModal';
20
-import SettingsModalContextToggle from 'src/devtools/views/Settings/SettingsModalContextToggle';
21
-import { SettingsModalContextController } from 'src/devtools/views/Settings/SettingsModalContext';
19
+import SettingsModal from 'react-devtools-shared/src/devtools/views/Settings/SettingsModal';
20
+import SettingsModalContextToggle from 'react-devtools-shared/src/devtools/views/Settings/SettingsModalContextToggle';
21
+import { SettingsModalContextController } from 'react-devtools-shared/src/devtools/views/Settings/SettingsModalContext';
22
import portaledContent from '../portaledContent';
23
24
import styles from './Profiler.css';
packages/react-devtools-shared/src/devtools/views/Profiler/ProfilerContext.js
+1
-1
@@ -121,7 +121,7 @@ function ProfilerContextController({ children }: Props) {
121
isProfiling,
122
profilingData,
123
supportsProfiling,
124
- } = useSubscription<StoreProfilingState, Store>(subscription);
124
+ } = useSubscription<StoreProfilingState>(subscription);
125
126
const [prevProfilingData, setPrevProfilingData] = useState();
127
const [rootID, setRootID] = useState<number | null>(null);
packages/react-devtools-shared/src/devtools/views/Profiler/RankedChartBuilder.js
+2
-2
@@ -1,8 +1,8 @@
1
// @flow
2
3
-import { ElementTypeForwardRef, ElementTypeMemo } from 'src/types';
3
+import { ElementTypeForwardRef, ElementTypeMemo } from 'react-devtools-shared/src/types';
4
import { formatDuration } from './utils';
5
-import ProfilerStore from 'src/devtools/ProfilerStore';
5
+import ProfilerStore from 'react-devtools-shared/src/devtools/ProfilerStore';
6
7
import type { CommitTree } from './types';
8
packages/react-devtools-shared/src/devtools/views/Profiler/ReloadAndProfileButton.js
+2
-2
@@ -5,7 +5,7 @@ import Button from '../Button';
5
import ButtonIcon from '../ButtonIcon';
6
import { BridgeContext, StoreContext } from '../context';
7
import { useSubscription } from '../hooks';
8
-import Store from 'src/devtools/store';
8
+import Store from 'react-devtools-shared/src/devtools/store';
9
10
type SubscriptionData = {|
11
recordChangeDescriptions: boolean,
@@ -36,7 +36,7 @@ export default function ReloadAndProfileButton() {
36
const {
37
recordChangeDescriptions,
38
supportsReloadAndProfile,
39
- } = useSubscription<SubscriptionData, Store>(subscription);
39
+ } = useSubscription<SubscriptionData>(subscription);
40
41
const reloadAndProfile = useCallback(() => {
42
// TODO If we want to support reload-and-profile for e.g. React Native,
packages/react-devtools-shared/src/devtools/views/Profiler/SidebarSelectedFiberInfo.js
+1
-1
@@ -1,7 +1,7 @@
1
// @flow
2
3
import React, { Fragment, useContext } from 'react';
4
-import ProfilerStore from 'src/devtools/ProfilerStore';
4
+import ProfilerStore from 'react-devtools-shared/src/devtools/ProfilerStore';
5
import { ProfilerContext } from './ProfilerContext';
6
import { formatDuration, formatTime } from './utils';
7
import { StoreContext } from '../context';
packages/react-devtools-shared/src/devtools/views/Profiler/types.js
+1
-1
@@ -1,6 +1,6 @@
1
// @flow
2
3
-import type { ElementType } from 'src/types';
3
+import type { ElementType } from 'react-devtools-shared/src/types';
4
5
export type CommitTreeNode = {|
6
id: number,
packages/react-devtools-shared/src/devtools/views/Profiler/utils.js
+2
-2
@@ -1,8 +1,8 @@
1
// @flow
2
3
-import { PROFILER_EXPORT_VERSION } from 'src/constants';
3
+import { PROFILER_EXPORT_VERSION } from 'react-devtools-shared/src/constants';
4
5
-import type { ProfilingDataBackend } from 'src/backend/types';
5
+import type { ProfilingDataBackend } from 'react-devtools-shared/src/backend/types';
6
import type {
7
ProfilingDataExport,
8
ProfilingDataForRootExport,
packages/react-devtools-shared/src/devtools/views/Settings/ComponentsSettings.js
+4
-4
@@ -10,7 +10,7 @@ import React, {
10
} from 'react';
11
import { useSubscription } from '../hooks';
12
import { StoreContext } from '../context';
13
-import Store from 'src/devtools/store';
13
+import Store from 'react-devtools-shared/src/devtools/store';
14
import Button from '../Button';
15
import ButtonIcon from '../ButtonIcon';
16
import Toggle from '../Toggle';
@@ -28,7 +28,7 @@ import {
28
ElementTypeOtherOrUnknown,
29
ElementTypeProfiler,
30
ElementTypeSuspense,
31
-} from 'src/types';
31
+} from 'react-devtools-shared/src/types';
32
33
import styles from './SettingsShared.css';
34
@@ -39,7 +39,7 @@ import type {
39
ElementType,
40
ElementTypeComponentFilter,
41
RegExpComponentFilter,
42
-} from 'src/types';
42
+} from 'react-devtools-shared/src/types';
43
44
export default function ComponentsSettings(_: {||}) {
45
const store = useContext(StoreContext);
@@ -54,7 +54,7 @@ export default function ComponentsSettings(_: {||}) {
54
}),
55
[store]
56
);
57
- const collapseNodesByDefault = useSubscription<boolean, Store>(
57
+ const collapseNodesByDefault = useSubscription<boolean>(
58
collapseNodesByDefaultSubscription
59
);
60
packages/react-devtools-shared/src/devtools/views/Settings/GeneralSettings.js
+1
-1
@@ -2,7 +2,7 @@
2
3
import React, { useContext } from 'react';
4
import { SettingsContext } from './SettingsContext';
5
-import { CHANGE_LOG_URL } from 'src/constants';
5
+import { CHANGE_LOG_URL } from 'react-devtools-shared/src/constants';
6
7
import styles from './SettingsShared.css';
8
packages/react-devtools-shared/src/devtools/views/Settings/ProfilerSettings.js
+3
-3
@@ -3,8 +3,8 @@
3
import React, { useCallback, useContext, useMemo, useRef } from 'react';
4
import { useSubscription } from '../hooks';
5
import { StoreContext } from '../context';
6
-import { ProfilerContext } from 'src/devtools/views/Profiler/ProfilerContext';
7
-import Store from 'src/devtools/store';
6
+import { ProfilerContext } from 'react-devtools-shared/src/devtools/views/Profiler/ProfilerContext';
7
+import Store from 'react-devtools-shared/src/devtools/store';
8
9
import styles from './SettingsShared.css';
10
@@ -27,7 +27,7 @@ export default function ProfilerSettings(_: {||}) {
27
}),
28
[store]
29
);
30
- const recordChangeDescriptions = useSubscription<boolean, Store>(
30
+ const recordChangeDescriptions = useSubscription<boolean>(
31
recordChangeDescriptionsSubscription
32
);
33
packages/react-devtools-shared/src/devtools/views/Settings/SettingsContext.js
+1
-1
@@ -11,7 +11,7 @@ import {
11
COMFORTABLE_LINE_HEIGHT,
12
COMPACT_LINE_HEIGHT,
13
LOCAL_STORAGE_SHOULD_PATCH_CONSOLE_KEY,
14
-} from 'src/constants';
14
+} from 'react-devtools-shared/src/constants';
15
import { useLocalStorage } from '../hooks';
16
import { BridgeContext } from '../context';
17
packages/react-devtools-shared/src/devtools/views/Settings/SettingsModal.js
+2
-2
@@ -8,7 +8,7 @@ import React, {
8
useRef,
9
} from 'react';
10
import { SettingsModalContext } from './SettingsModalContext';
11
-import Store from 'src/devtools/store';
11
+import Store from 'react-devtools-shared/src/devtools/store';
12
import Button from '../Button';
13
import ButtonIcon from '../ButtonIcon';
14
import TabBar from '../TabBar';
@@ -45,7 +45,7 @@ export default function SettingsModal(_: {||}) {
45
}),
46
[profilerStore]
47
);
48
- const isProfiling = useSubscription<boolean, Store>(isProfilingSubscription);
48
+ const isProfiling = useSubscription<boolean>(isProfilingSubscription);
49
if (isProfiling && isModalShowing) {
50
setIsModalShowing(false);
51
}
packages/react-devtools-shared/src/devtools/views/Settings/SettingsModalContextToggle.js
+2
-2
@@ -6,7 +6,7 @@ import Button from '../Button';
6
import ButtonIcon from '../ButtonIcon';
7
import { StoreContext } from '../context';
8
import { useSubscription } from '../hooks';
9
-import Store from 'src/devtools/store';
9
+import Store from 'react-devtools-shared/src/devtools/store';
10
11
export default function SettingsModalContextToggle() {
12
const { setIsModalShowing } = useContext(SettingsModalContext);
@@ -29,7 +29,7 @@ export default function SettingsModalContextToggle() {
29
}),
30
[profilerStore]
31
);
32
- const isProfiling = useSubscription<boolean, Store>(isProfilingSubscription);
32
+ const isProfiling = useSubscription<boolean>(isProfilingSubscription);
33
34
return (
35
<Button
packages/react-devtools-shared/src/devtools/views/ShowWelcomeToTheNewDevToolsDialog.js
+1
-1
@@ -5,7 +5,7 @@ import { unstable_batchedUpdates as batchedUpdates } from 'react-dom';
5
import { useLocalStorage } from './hooks';
6
import { ModalDialogContext } from './ModalDialog';
7
import ReactLogo from './ReactLogo';
8
-import { CHANGE_LOG_URL } from 'src/constants';
8
+import { CHANGE_LOG_URL } from 'react-devtools-shared/src/constants';
9
10
import styles from './ShowWelcomeToTheNewDevToolsDialog.css';
11
packages/react-devtools-shared/src/devtools/views/TabBar.js
+3
-4
@@ -1,6 +1,5 @@
1
// @flow
2
3
-import classNames from 'classnames';
3
import React, { Fragment, useCallback } from 'react';
4
import Tooltip from '@reach/tooltip';
5
import Icon from './Icon';
@@ -84,11 +83,11 @@ export default function TabBar({
83
{tabs.map(({ icon, id, label, title }) => {
84
let button = (
85
<label
87
- className={classNames(
86
+ className={[
87
tabSizeClassName,
88
disabled ? styles.TabDisabled : styles.Tab,
90
- !disabled && currentTab === id ? styles.TabCurrent : null
91
- )}
89
+ !disabled && currentTab === id ? styles.TabCurrent : ''
90
+ ].join(' ')}
91
key={id}
92
onKeyDown={handleKeyDown}
93
onMouseDown={() => selectTab(id)}
packages/react-devtools-shared/src/devtools/views/context.js
+1
-1
@@ -3,7 +3,7 @@
3
import { createContext } from 'react';
4
import Store from '../store';
5
6
-import type { FrontendBridge } from 'src/bridge';
6
+import type { FrontendBridge } from 'react-devtools-shared/src/bridge';
7
8
export const BridgeContext = createContext<FrontendBridge>(
9
((null: any): FrontendBridge)
packages/react-devtools-shared/src/devtools/views/hooks.js
+1
-1
@@ -2,7 +2,7 @@
2
3
import throttle from 'lodash.throttle';
4
import { useCallback, useEffect, useLayoutEffect, useState } from 'react';
5
-import { localStorageGetItem, localStorageSetItem } from 'src/storage';
5
+import { localStorageGetItem, localStorageSetItem } from 'react-devtools-shared/src/storage';
6
7
export function useIsOverflowing(
8
containerRef: { current: HTMLDivElement | null },
packages/react-devtools-shared/src/devtools/views/utils.js
+1
-1
@@ -3,7 +3,7 @@
3
import escapeStringRegExp from 'escape-string-regexp';
4
import { meta } from '../../hydration';
5
6
-import type { HooksTree } from 'src/backend/types';
6
+import type { HooksTree } from 'react-devtools-shared/src/backend/types';
7
8
export function createRegExp(string: string): RegExp {
9
// Allow /regex/ syntax with optional last /
packages/react-devtools-shared/src/hook.js
+1
-1
@@ -12,7 +12,7 @@ import {
12
registerRenderer as registerRendererWithConsole,
13
} from './backend/console';
14
15
-import type { DevToolsHook } from 'src/backend/types';
15
+import type { DevToolsHook } from 'react-devtools-shared/src/backend/types';
16
17
declare var window: any;
18
packages/react-devtools-shared/src/node_modules/react-window/src/createGridComponent.js
+3
-3
@@ -1,7 +1,7 @@
1
// @flow
2
3
import memoizeOne from 'memoize-one';
4
-import { createElement, PureComponent } from 'react';
4
+import React, { createElement, PureComponent } from 'react';
5
import { cancelTimeout, requestTimeout } from './timer';
6
import { getScrollbarSize, getRTLOffsetType } from './domHelpers';
7
@@ -72,7 +72,7 @@ export type Props<T> = {|
72
initialScrollLeft?: number,
73
initialScrollTop?: number,
74
innerRef?: any,
75
- innerElementType?: string | React$AbstractComponent<InnerProps, any>,
75
+ innerElementType?: string | React.AbstractComponent<InnerProps, any>,
76
innerTagName?: string, // deprecated
77
itemData: T,
78
itemKey?: (params: {|
@@ -83,7 +83,7 @@ export type Props<T> = {|
83
onItemsRendered?: OnItemsRenderedCallback,
84
onScroll?: OnScrollCallback,
85
outerRef?: any,
86
- outerElementType?: string | React$AbstractComponent<OuterProps, any>,
86
+ outerElementType?: string | React.AbstractComponent<OuterProps, any>,
87
outerTagName?: string, // deprecated
88
overscanColumnCount?: number,
89
overscanColumnsCount?: number, // deprecated
packages/react-devtools-shared/src/node_modules/react-window/src/createListComponent.js
+3
-3
@@ -1,7 +1,7 @@
1
// @flow
2
3
import memoizeOne from 'memoize-one';
4
-import { createElement, PureComponent } from 'react';
4
+import React, { createElement, PureComponent } from 'react';
5
import { cancelTimeout, requestTimeout } from './timer';
6
import { getRTLOffsetType } from './domHelpers';
7
@@ -62,7 +62,7 @@ export type Props<T> = {|
62
height: number | string,
63
initialScrollOffset?: number,
64
innerRef?: any,
65
- innerElementType?: string | React$AbstractComponent<InnerProps, any>,
65
+ innerElementType?: string | React.AbstractComponent<InnerProps, any>,
66
innerTagName?: string, // deprecated
67
itemCount: number,
68
itemData: T,
@@ -72,7 +72,7 @@ export type Props<T> = {|
72
onItemsRendered?: onItemsRenderedCallback,
73
onScroll?: onScrollCallback,
74
outerRef?: any,
75
- outerElementType?: string | React$AbstractComponent<OuterProps, any>,
75
+ outerElementType?: string | React.AbstractComponent<OuterProps, any>,
76
outerTagName?: string, // deprecated
77
overscanCount: number,
78
style?: Object,
packages/react-devtools-shared/src/utils.js
+3
-3
@@ -7,7 +7,7 @@ import {
7
TREE_OPERATION_REORDER_CHILDREN,
8
TREE_OPERATION_UPDATE_TREE_BASE_DURATION,
9
} from './constants';
10
-import { ElementTypeRoot } from 'src/types';
10
+import { ElementTypeRoot } from 'react-devtools-shared/src/types';
11
import {
12
LOCAL_STORAGE_FILTER_PREFERENCES_KEY,
13
LOCAL_STORAGE_SHOULD_PATCH_CONSOLE_KEY,
@@ -18,7 +18,7 @@ import {
18
ElementTypeForwardRef,
19
ElementTypeFunction,
20
ElementTypeMemo,
21
-} from 'src/types';
21
+} from 'react-devtools-shared/src/types';
22
import { localStorageGetItem, localStorageSetItem } from './storage';
23
24
import type { ComponentFilter, ElementType } from './types';
@@ -235,7 +235,7 @@ export function separateDisplayNameAndHOCs(
235
case ElementTypeMemo:
236
if (displayName.indexOf('(') >= 0) {
237
const matches = displayName.match(/[^()]+/g);
238
- if (matches !== null) {
238
+ if (matches != null) {
239
displayName = matches.pop();
240
hocDisplayNames = matches;
241
}
yarn.lock
+108
-1
@@ -571,6 +571,77 @@
571
dependencies:
572
"@types/whatwg-streams" "^0.0.6"
573
574
+"@reach/auto-id@0.2.0":
575
+ version "0.2.0"
576
+ resolved "https://registry.yarnpkg.com/@reach/auto-id/-/auto-id-0.2.0.tgz#97f9e48fe736aa5c6f4f32cf73c1f19d005f8550"
577
+ integrity sha512-lVK/svL2HuQdp7jgvlrLkFsUx50Az9chAhxpiPwBqcS83I2pVWvXp98FOcSCCJCV++l115QmzHhFd+ycw1zLBg==
578
+
579
+"@reach/component-component@0.1.3", "@reach/component-component@^0.1.3":
580
+ version "0.1.3"
581
+ resolved "https://registry.yarnpkg.com/@reach/component-component/-/component-component-0.1.3.tgz#5d156319572dc38995b246f81878bc2577c517e5"
582
+ integrity sha512-a1USH7L3bEfDdPN4iNZGvMEFuBfkdG+QNybeyDv8RloVFgZYRoM+KGXyy2KOfEnTUM8QWDRSROwaL3+ts5Angg==
583
+
584
+"@reach/menu-button@^0.1.17":
585
+ version "0.1.18"
586
+ resolved "https://registry.yarnpkg.com/@reach/menu-button/-/menu-button-0.1.18.tgz#cb9e3bf1c2a2bdb5d618697b87ad353dfbca123e"
587
+ integrity sha512-MGdN8SWaQ0u0xj6KWUnK9fFc1VBg8NhNnFhEd2sp3D56XJcr08HU5GeVq/MFf5C97mxRnIPIKGnMPPeGAn9OFA==
588
+ dependencies:
589
+ "@reach/component-component" "0.1.3"
590
+ "@reach/portal" "^0.2.1"
591
+ "@reach/rect" "0.2.1"
592
+ "@reach/utils" "^0.2.3"
593
+ "@reach/window-size" "^0.1.4"
594
+ warning "^4.0.2"
595
+
596
+"@reach/observe-rect@^1.0.3":
597
+ version "1.0.3"
598
+ resolved "https://registry.yarnpkg.com/@reach/observe-rect/-/observe-rect-1.0.3.tgz#2ea3dcc369ab22bd9f050a92ea319321356a61e8"
599
+ integrity sha1-LqPcw2mrIr2fBQqS6jGTITVqYeg=
600
+
601
+"@reach/portal@^0.2.1":
602
+ version "0.2.1"
603
+ resolved "https://registry.yarnpkg.com/@reach/portal/-/portal-0.2.1.tgz#07720b999e0063a9e179c14dbdc60fd991cfc9fa"
604
+ integrity sha512-pUQ0EtCcYm4ormEjJmdk4uzZCxOpaRHB8FDKJXy6q6GqRqQwZ4lAT1f2Tvw0DAmULmyZTpe1/heXY27Tdnct+Q==
605
+ dependencies:
606
+ "@reach/component-component" "^0.1.3"
607
+
608
+"@reach/rect@0.2.1", "@reach/rect@^0.2.1":
609
+ version "0.2.1"
610
+ resolved "https://registry.yarnpkg.com/@reach/rect/-/rect-0.2.1.tgz#7343020174c90e2290b844d17c03fd9c78e6b601"
611
+ integrity sha512-aZ9RsNHDMQ3zETonikqu9/85iXxj+LPqZ9Gr9UAncj3AufYmGeWG3XG6b37B+7ORH+mkhVpLU2ZlIWxmOe9Cqg==
612
+ dependencies:
613
+ "@reach/component-component" "^0.1.3"
614
+ "@reach/observe-rect" "^1.0.3"
615
+
616
+"@reach/tooltip@^0.2.2":
617
+ version "0.2.2"
618
+ resolved "https://registry.yarnpkg.com/@reach/tooltip/-/tooltip-0.2.2.tgz#a861ce38269b586597ab40417323b33d3d6dc927"
619
+ integrity sha512-afcfqH6EzDHmwTB6g1k0dSbkyT0s9KPIi5bX56nNuldsCIasImFFYDjRZLhFcuxjskwIsHAi06yC3GV6mtcRxw==
620
+ dependencies:
621
+ "@reach/auto-id" "0.2.0"
622
+ "@reach/portal" "^0.2.1"
623
+ "@reach/rect" "^0.2.1"
624
+ "@reach/utils" "^0.2.3"
625
+ "@reach/visually-hidden" "^0.1.4"
626
+ prop-types "^15.7.2"
627
+
628
+"@reach/utils@^0.2.3":
629
+ version "0.2.3"
630
+ resolved "https://registry.yarnpkg.com/@reach/utils/-/utils-0.2.3.tgz#820f6a6af4301b4c5065cfc04bb89e6a3d1d723f"
631
+ integrity sha512-zM9rA8jDchr05giMhL95dPeYkK67cBQnIhCVrOKKqgWGsv+2GE/HZqeptvU4zqs0BvIqsThwov+YxVNVh5csTQ==
632
+
633
+"@reach/visually-hidden@^0.1.4":
634
+ version "0.1.4"
635
+ resolved "https://registry.yarnpkg.com/@reach/visually-hidden/-/visually-hidden-0.1.4.tgz#0dc4ecedf523004337214187db70a46183bd945b"
636
+ integrity sha512-QHbzXjflSlCvDd6vJwdwx16mSB+vUCCQMiU/wK/CgVNPibtpEiIbisyxkpZc55DyDFNUIqP91rSUsNae+ogGDQ==
637
+
638
+"@reach/window-size@^0.1.4":
639
+ version "0.1.4"
640
+ resolved "https://registry.yarnpkg.com/@reach/window-size/-/window-size-0.1.4.tgz#3257b646548f61c2708a661a683620fbe0a706cb"
641
+ integrity sha512-JZshEuGsLvi6fUIJ7Unx12yNeM5SmqWjber2MLr9tfwf1hpNv73EiPBOIJyV0DjW7GXzjcOEvwnqysm59s2s/A==
642
+ dependencies:
643
+ "@reach/component-component" "^0.1.3"
644
+
645
"@types/node@^10.12.18":
646
version "10.14.15"
647
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.15.tgz#e8f7729b631be1b02ae130ff0b61f3e018000640"
@@ -1644,6 +1715,11 @@ cli-width@^2.0.0:
1715
version "2.1.0"
1716
resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a"
1717
1718
+clipboard-js@^0.3.6:
1719
+ version "0.3.6"
1720
+ resolved "https://registry.yarnpkg.com/clipboard-js/-/clipboard-js-0.3.6.tgz#6260add69b5318fde40b80f9d3c8c863efdaf339"
1721
+ integrity sha512-hyrmvbrYCeRBHdiR3KrEz0tmrUTXXEU8HLeGW0Y0icUSwYmAsmc+d6wfE4EDb/TxZmAVJG0eTfMlulCIT+ecfw==
1722
+
1723
cliui@^2.1.0:
1724
version "2.1.0"
1725
resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1"
@@ -4257,6 +4333,11 @@ lodash.sortby@^4.7.0:
4333
version "4.7.0"
4334
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
4335
4336
+lodash.throttle@^4.1.1:
4337
+ version "4.1.1"
4338
+ resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
4339
+ integrity sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=
4340
+
4341
lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.2.0:
4342
version "4.17.10"
4343
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
@@ -4280,7 +4361,7 @@ loose-envify@^1.0.0, loose-envify@^1.1.0:
4361
dependencies:
4362
js-tokens "^3.0.0"
4363
4283
-loose-envify@^1.3.1:
4364
+loose-envify@^1.3.1, loose-envify@^1.4.0:
4365
version "1.4.0"
4366
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
4367
dependencies:
@@ -4352,6 +4433,11 @@ mem@^1.1.0:
4433
dependencies:
4434
mimic-fn "^1.0.0"
4435
4436
+memoize-one@^3.1.1:
4437
+ version "3.1.1"
4438
+ resolved "https://registry.yarnpkg.com/memoize-one/-/memoize-one-3.1.1.tgz#ef609811e3bc28970eac2884eece64d167830d17"
4439
+ integrity sha512-YqVh744GsMlZu6xkhGslPSqSurOv6P+kLN2J3ysBZfagLcL5FdRK/0UpgLoL8hwjjEvvAVkjJZyFP+1T6p1vgA==
4440
+
4441
meow@^3.1.0:
4442
version "3.7.0"
4443
resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb"
@@ -5101,6 +5187,15 @@ prop-types@^15.6.2:
5187
loose-envify "^1.3.1"
5188
object-assign "^4.1.1"
5189
5190
+prop-types@^15.7.2:
5191
+ version "15.7.2"
5192
+ resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
5193
+ integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
5194
+ dependencies:
5195
+ loose-envify "^1.4.0"
5196
+ object-assign "^4.1.1"
5197
+ react-is "^16.8.1"
5198
+
5199
proxy-from-env@^1.0.0:
5200
version "1.0.0"
5201
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee"
@@ -5180,6 +5275,11 @@ react-lifecycles-compat@^3.0.2:
5275
version "3.0.2"
5276
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.2.tgz#7279047275bd727a912e25f734c0559527e84eff"
5277
5278
+react-virtualized-auto-sizer@^1.0.2:
5279
+ version "1.0.2"
5280
+ resolved "https://registry.yarnpkg.com/react-virtualized-auto-sizer/-/react-virtualized-auto-sizer-1.0.2.tgz#a61dd4f756458bbf63bd895a92379f9b70f803bd"
5281
+ integrity sha512-MYXhTY1BZpdJFjUovvYHVBmkq79szK/k7V3MO+36gJkWGkrXKtyr4vCPtpphaTLRAdDNoYEYFZWE8LjN+PIHNg==
5282
+
5283
read-pkg-up@^1.0.1:
5284
version "1.0.1"
5285
resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02"
@@ -6430,6 +6530,13 @@ walker@~1.0.5:
6530
dependencies:
6531
makeerror "1.0.x"
6532
6533
+warning@^4.0.2:
6534
+ version "4.0.3"
6535
+ resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3"
6536
+ integrity sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==
6537
+ dependencies:
6538
+ loose-envify "^1.0.0"
6539
+
6540
watch@~0.18.0:
6541
version "0.18.0"
6542
resolved "https://registry.yarnpkg.com/watch/-/watch-0.18.0.tgz#28095476c6df7c90c963138990c0a5423eb4b986"