From 1f8be98e86444eefb9d04ec30d203d59e920021c Mon Sep 17 00:00:00 2001 From: Jack Works Date: Sun, 22 Sep 2019 13:20:43 +0800 Subject: [PATCH] fix: upgrade react-devtools to 4+ --- config-overrides/index.js | 10 ++- package.json | 2 +- src/content-script.ts | 5 -- src/extension/popup-page/index.tsx | 2 +- yarn.lock | 132 ++++++++++++++--------------- 5 files changed, 75 insertions(+), 76 deletions(-) diff --git a/config-overrides/index.js b/config-overrides/index.js index b8ec1885fe97..8f2f37af26d9 100644 --- a/config-overrides/index.js +++ b/config-overrides/index.js @@ -59,12 +59,16 @@ function override(config, env) { if (env === 'development') config.devtool = 'inline-source-map' else delete config.devtool config.optimization.minimize = false + function appendReactDevtools(src) { + if (env === 'development') return ['react-devtools', src] + return src + } config.entry = { - 'options-page': src('./src/index.tsx'), - 'content-script': src('./src/content-script.ts'), + 'options-page': appendReactDevtools(src('./src/index.tsx')), + 'content-script': appendReactDevtools(src('./src/content-script.ts')), 'background-service': src('./src/background-service.ts'), 'injected-script': src('./src/extension/injected-script/index.ts'), - popup: src('./src/extension/popup-page/index.tsx'), + popup: appendReactDevtools(src('./src/extension/popup-page/index.tsx')), qrcode: src('./src/web-workers/QRCode.ts'), } if (env !== 'development') delete config.entry.devtools diff --git a/package.json b/package.json index 6324988e5207..17b1ea8d8161 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,7 @@ "eslint-plugin-prettier": "^3.1.0", "esm": "^3.2.25", "prettier": "^1.18.2", - "react-devtools": "^3.6.1", + "react-devtools": "^4.1.0", "storybook-addon-material-ui": "^0.9.0-alpha.19", "ts-node": "^8.3.0", "web-ext": "^3.1.1", diff --git a/src/content-script.ts b/src/content-script.ts index 00ba9f83bb28..4b8a9236e1ab 100644 --- a/src/content-script.ts +++ b/src/content-script.ts @@ -1,10 +1,5 @@ import './setup.ui' import { GetContext } from '@holoflows/kit/es' -if (process.env.NODE_ENV === 'development') { - try { - require('react-devtools') - } catch {} -} if (GetContext() === 'content') { console.log('Maskbook content script loaded') require('./extension/content-script/index') diff --git a/src/extension/popup-page/index.tsx b/src/extension/popup-page/index.tsx index 2c490f9ac9e5..35a9513af55a 100644 --- a/src/extension/popup-page/index.tsx +++ b/src/extension/popup-page/index.tsx @@ -1,10 +1,10 @@ +import '../../setup.ui' import React from 'react' import { ThemeProvider } from '@material-ui/styles' import { MaskbookLightTheme } from '../../utils/theme' import { makeStyles } from '@material-ui/core/styles' import { Button, ListItem, ListItemText, ListItemSecondaryAction, Switch, List } from '@material-ui/core' -import '../../setup.ui' import { SSRRenderer } from '../../utils/SSRRenderer' import { useValueRef } from '../../utils/hooks/useValueRef' import { debugModeSetting } from '../../components/shared-settings/settings' diff --git a/yarn.lock b/yarn.lock index dcc2090e1121..824a8da27b4a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2252,6 +2252,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.4.tgz#64db61e0359eb5a8d99b55e05c729f130a678b04" integrity sha512-W0+n1Y+gK/8G2P/piTkBBN38Qc5Q1ZSO6B5H3QmPCUewaiXOo2GCAWZ4ElZCcNhjJuBSUSLGFUJnmlCn5+nxOQ== +"@types/node@^10.12.18": + version "10.14.18" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.18.tgz#b7d45fc950e6ffd7edc685e890d13aa7b8535dce" + integrity sha512-ryO3Q3++yZC/+b8j8BdKd/dn9JlzlHBPdm80656xwYUdmPkpTGTjkAdt6BByiNupGPE8w0FhBgvYy/fX9hRNGQ== + "@types/node@^10.14.17": version "10.14.17" resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.17.tgz#b96d4dd3e427382482848948041d3754d40fd5ce" @@ -2262,7 +2267,7 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-6.14.7.tgz#2173f79d7a61d97d3aad2feeaac7ac69a3df39af" integrity sha512-YbPXbaynBTe0pVExPhL76TsWnxSPeFAvImIsmylpBWn/yfw+lHy+Q68aawvZHsgskT44ZAoeE67GM5f+Brekew== -"@types/node@^8.0.24", "@types/node@^8.0.7": +"@types/node@^8.0.7": version "8.10.53" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.53.tgz#5fa08eef810b08b2c03073e360b54f7bad899db1" integrity sha512-aOmXdv1a1/vYUn1OT1CED8ftbkmmYbKhKGSyMDeJiidLvKRKvZUQOdXwG/wcNY7T1Qb0XTlVdiYjIq00U7pLrQ== @@ -3327,7 +3332,7 @@ async-each@^1.0.1: resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.3.tgz#b727dbf87d7651602f06f4d4ac387f47d91b0cbf" integrity sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ== -async-limiter@~1.0.0: +async-limiter@^1.0.0, async-limiter@~1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== @@ -6116,33 +6121,33 @@ ejs@^2.6.1: resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.7.1.tgz#5b5ab57f718b79d4aca9254457afecd36fa80228" integrity sha512-kS/gEPzZs3Y1rRsbGX4UOSjtP/CeJP0CxSNZHYxGfVM/VgLcv0ZqM7C45YyTj2DI2g7+P9Dd24C+IMIg6D0nYQ== -electron-download@^3.0.1: - version "3.3.0" - resolved "https://registry.yarnpkg.com/electron-download/-/electron-download-3.3.0.tgz#2cfd54d6966c019c4d49ad65fbe65cc9cdef68c8" - integrity sha1-LP1U1pZsAZxNSa1l++Zcyc3vaMg= +electron-download@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/electron-download/-/electron-download-4.1.1.tgz#02e69556705cc456e520f9e035556ed5a015ebe8" + integrity sha512-FjEWG9Jb/ppK/2zToP+U5dds114fM1ZOJqMAR4aXXL5CvyPE9fiqBK/9YcwC9poIFQTEJk/EM/zyRwziziRZrg== dependencies: - debug "^2.2.0" - fs-extra "^0.30.0" - home-path "^1.0.1" + debug "^3.0.0" + env-paths "^1.0.0" + fs-extra "^4.0.1" minimist "^1.2.0" - nugget "^2.0.0" - path-exists "^2.1.0" - rc "^1.1.2" - semver "^5.3.0" - sumchecker "^1.2.0" + nugget "^2.0.1" + path-exists "^3.0.0" + rc "^1.2.1" + semver "^5.4.1" + sumchecker "^2.0.2" electron-to-chromium@^1.3.191, electron-to-chromium@^1.3.247: version "1.3.252" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.252.tgz#5b6261965b564a0f4df0f1c86246487897017f52" integrity sha512-NWJ5TztDnjExFISZHFwpoJjMbLUifsNBnx7u2JI0gCw6SbKyQYYWWtBHasO/jPtHym69F4EZuTpRNGN11MT/jg== -electron@^1.8.7: - version "1.8.8" - resolved "https://registry.yarnpkg.com/electron/-/electron-1.8.8.tgz#a90cddb075291f49576993e6f5c8bb4439301cae" - integrity sha512-1f9zJehcTTGjrkb06o6ds+gsRq6SYhZJyxOk6zIWjRH8hVy03y/RzUDELzNas71f5vcvXmfGVvyjeEsadDI8tg== +electron@^5.0.0: + version "5.0.10" + resolved "https://registry.yarnpkg.com/electron/-/electron-5.0.10.tgz#a3819c3ff8d05ee57315bfabe2d61d3529f5659c" + integrity sha512-OSyxTlJ+7Yf0B+6pTdHdxY9RvI4U+mVKAbn+CkAOWxlCPMg3K+jt5UHKSPRRLnXQhQ0Tulg4vupbC0k27aukVw== dependencies: - "@types/node" "^8.0.24" - electron-download "^3.0.1" + "@types/node" "^10.12.18" + electron-download "^4.1.0" extract-zip "^1.0.3" elegant-spinner@^1.0.1: @@ -6245,6 +6250,11 @@ entities@^2.0.0: resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.0.tgz#68d6084cab1b079767540d80e56a39b423e4abf4" integrity sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw== +env-paths@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-1.0.0.tgz#4168133b42bb05c38a35b1ae4397c8298ab369e0" + integrity sha1-QWgTO0K7BcOKNbGuQ5fIKYqzaeA= + errno@^0.1.3, errno@~0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" @@ -6334,7 +6344,7 @@ es6-promise@^2.0.1: resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-2.3.0.tgz#96edb9f2fdb01995822b263dd8aadab6748181bc" integrity sha1-lu258v2wGZWCKyY92KratnSBgbw= -es6-promise@^4.0.3, es6-promise@^4.0.5: +es6-promise@^4.0.3: version "4.2.8" resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== @@ -6375,7 +6385,7 @@ es6-symbol@3.1.1: d "1" es5-ext "~0.10.14" -es6-symbol@^3.1.1, es6-symbol@~3.1.1: +es6-symbol@^3, es6-symbol@^3.1.1, es6-symbol@~3.1.1: version "3.1.2" resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.2.tgz#859fdd34f32e905ff06d752e7171ddd4444a7ed1" integrity sha512-/ZypxQsArlv+KHpGvng52/Iz8by3EQPxhmbuz8yFG89N/caTFBSbcXONDw0aMjy827gQg26XAjP4uXFvnfINmQ== @@ -7476,7 +7486,7 @@ fs-extra@^0.30.0: path-is-absolute "^1.0.0" rimraf "^2.2.8" -fs-extra@^4.0.2, fs-extra@~4.0.2: +fs-extra@^4.0.1, fs-extra@^4.0.2, fs-extra@~4.0.2: version "4.0.3" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94" integrity sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg== @@ -8147,11 +8157,6 @@ hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.2.1, hoist-non-react- dependencies: react-is "^16.7.0" -home-path@^1.0.1: - version "1.0.6" - resolved "https://registry.yarnpkg.com/home-path/-/home-path-1.0.6.tgz#d549dc2465388a7f8667242c5b31588d29af29fc" - integrity sha512-wo+yjrdAtoXt43Vy92a+0IPCYViiyLAHyp0QVS4xL/tfvVz5sXIW1ubLZk3nhVkD92fQpUMKX+fzMjr5F489vw== - hosted-git-info@^2.1.4, hosted-git-info@^2.7.1: version "2.8.4" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.4.tgz#44119abaf4bc64692a16ace34700fed9c03e2546" @@ -9951,6 +9956,13 @@ jsx-ast-utils@^2.1.0, jsx-ast-utils@^2.2.1: array-includes "^3.0.3" object.assign "^4.1.0" +jsx-jsonml-devtools-renderer@^1.1.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/jsx-jsonml-devtools-renderer/-/jsx-jsonml-devtools-renderer-1.3.0.tgz#1af53802a49898db3bd2f9070a5f6e56d8c2ef13" + integrity sha512-DjsZ+XvwkInWB5Cr3xfibfE5+PmIibGk/MCLR5QBRttgUWX0Uzr0g+IpPi4Rb0U0U9D+BkhbvrE9gSSm08M8Nw== + dependencies: + csstype "^2.6.6" + jszip@^2.4.0: version "2.6.1" resolved "https://registry.yarnpkg.com/jszip/-/jszip-2.6.1.tgz#b88f3a7b2e67a2a048152982c7a3756d9c4828f0" @@ -11434,7 +11446,7 @@ nth-check@^1.0.2, nth-check@~1.0.1: dependencies: boolbase "~1.0.0" -nugget@^2.0.0: +nugget@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/nugget/-/nugget-2.0.1.tgz#201095a487e1ad36081b3432fa3cada4f8d071b0" integrity sha1-IBCVpIfhrTYIGzQy+jytpPjQcbA= @@ -12010,7 +12022,7 @@ path-dirname@^1.0.0: resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" integrity sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA= -path-exists@^2.0.0, path-exists@^2.1.0: +path-exists@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" integrity sha1-D+tsZPD8UY2adU3V77YscCJ2H0s= @@ -13364,7 +13376,7 @@ raw-loader@^2.0.0: loader-utils "^1.1.0" schema-utils "^1.0.0" -rc@^1.0.1, rc@^1.1.2, rc@^1.1.6, rc@^1.2.7, rc@^1.2.8: +rc@^1.0.1, rc@^1.1.6, rc@^1.2.1, rc@^1.2.7, rc@^1.2.8: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== @@ -13454,24 +13466,25 @@ react-dev-utils@^9.0.0, react-dev-utils@^9.0.3: strip-ansi "5.2.0" text-table "0.2.0" -react-devtools-core@^3.6.0: - version "3.6.3" - resolved "https://registry.yarnpkg.com/react-devtools-core/-/react-devtools-core-3.6.3.tgz#977d95b684c6ad28205f0c62e1e12c5f16675814" - integrity sha512-+P+eFy/yo8Z/UH9J0DqHZuUM5+RI2wl249TNvMx3J2jpUomLQa4Zxl56GEotGfw3PIP1eI+hVf1s53FlUONStQ== +react-devtools-core@4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/react-devtools-core/-/react-devtools-core-4.1.0.tgz#cc6528973999de75fba38c18661451aebad848c9" + integrity sha512-IhY5kH55uBBJhBvB9GXYqnJ4VO4cnngseo7hRiZ+iYi4NPwa4o8W8tUixjVeupvYd/p9Pr6YX/IJ0pYk5xu9qw== dependencies: + es6-symbol "^3" shell-quote "^1.6.1" - ws "^3.3.1" + ws "^7" -react-devtools@^3.6.1: - version "3.6.3" - resolved "https://registry.yarnpkg.com/react-devtools/-/react-devtools-3.6.3.tgz#47fcedbd2306724909b6ec76cd51392e93493c3f" - integrity sha512-7JrGlKHvyamqDfDi7EEoIC8BHygKC1Mc8PmAAYm0aokwYuam/42bO1gnF5y2K7K1MbO+6f7J93s1N4VK0YdmEw== +react-devtools@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/react-devtools/-/react-devtools-4.1.0.tgz#27856e2aaad208ff5199c90860ed63201adc5cae" + integrity sha512-QJktLhK4+rdvmlRJDPCxdGPoeeENJ9hO8svqDxfZhYqSXxxKZsr0CM/3Mv5l3AxZQ96TTaJO7OjVi7976Q8KgA== dependencies: cross-spawn "^5.0.1" - electron "^1.8.7" + electron "^5.0.0" ip "^1.1.4" minimist "^1.2.0" - react-devtools-core "^3.6.0" + react-devtools-core "4.1.0" update-notifier "^2.1.0" react-docgen@^4.1.0: @@ -13963,11 +13976,6 @@ redent@^2.0.0: indent-string "^3.0.0" strip-indent "^2.0.0" -reflect-metadata@^0.1.13: - version "0.1.13" - resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08" - integrity sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg== - refractor@^2.4.1: version "2.10.0" resolved "https://registry.yarnpkg.com/refractor/-/refractor-2.10.0.tgz#4cc7efc0028a87924a9b31d82d129dec831a287b" @@ -15772,13 +15780,12 @@ stylis@^3.5.0: resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.5.4.tgz#f665f25f5e299cf3d64654ab949a57c768b73fbe" integrity sha512-8/3pSmthWM7lsPBKv7NXkzn2Uc9W7NotcwGNpJaa3k7WMM1XDCA4MgT5k/8BIexd5ydZdboXtU90XH9Ec4Bv/Q== -sumchecker@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/sumchecker/-/sumchecker-1.3.1.tgz#79bb3b4456dd04f18ebdbc0d703a1d1daec5105d" - integrity sha1-ebs7RFbdBPGOvbwNcDodHa7FEF0= +sumchecker@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/sumchecker/-/sumchecker-2.0.2.tgz#0f42c10e5d05da5d42eea3e56c3399a37d6c5b3e" + integrity sha1-D0LBDl0F2l1C7qPlbDOZo31sWz4= dependencies: debug "^2.2.0" - es6-promise "^4.0.5" supports-color@^2.0.0: version "2.0.0" @@ -16380,11 +16387,6 @@ uglify-js@^3.1.4, uglify-js@^3.5.1: commander "~2.20.0" source-map "~0.6.1" -ultron@~1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.1.tgz#9fe1536a10a664a65266a1e3ccf85fd36302bc9c" - integrity sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og== - underscore@~1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.6.0.tgz#8b38b10cacdef63337b8b24e4ff86d45aea529a8" @@ -17317,15 +17319,6 @@ write@^0.2.1: dependencies: mkdirp "^0.5.1" -ws@^3.3.1: - version "3.3.3" - resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2" - integrity sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA== - dependencies: - async-limiter "~1.0.0" - safe-buffer "~5.1.0" - ultron "~1.1.0" - ws@^5.2.0: version "5.2.2" resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f" @@ -17340,6 +17333,13 @@ ws@^6.1.2, ws@~>6.2.1: dependencies: async-limiter "~1.0.0" +ws@^7: + version "7.1.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.1.2.tgz#c672d1629de8bb27a9699eb599be47aeeedd8f73" + integrity sha512-gftXq3XI81cJCgkUiAVixA0raD9IVmXqsylCrjRygw4+UOOGzPoxnQ6r/CnVL9i+mDncJo94tSkyrtuuQVBmrg== + dependencies: + async-limiter "^1.0.0" + xdg-basedir@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4"