metamask-extension
metamask-extension copied to clipboard
refactor: Typescript conversion of watch-asset.js
Part of #23014 Fixes #23474
Converting the level 6 dependency file app/scripts/lib/rpc-method-middleware/handlers/watch-asset.js to typescript for contributing to metamask-controller.js.
Description
Related issues
Fixes:
Manual testing steps
- Go to this page...
Screenshots/Recordings
Before
After
Pre-merge author checklist
- [ ] I’ve followed MetaMask Coding Standards.
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using JSDoc format if applicable
- [ ] I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
Pre-merge reviewer checklist
- [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.
BTW we can directly merge to develop :)
merge 2 commits into extract-wrapper-type from ts-watch-asset
This PR has been automatically marked as stale because it has not had recent activity in the last 60 days. It will be closed in 14 days. Thank you for your contributions.
This PR was closed because there has been no follow up activity in the last 14 days. Thank you for your contributions.
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
Builds ready [2ec2750]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (73 ± 22 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 72 | 297 | 113 | 61 | 30 |
| domContentLoaded | 9 | 93 | 31 | 24 | 12 | ||
| load | 38 | 206 | 73 | 45 | 22 | ||
| domInteractive | 9 | 93 | 31 | 24 | 12 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 0 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Codecov Report
Attention: Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.
Project coverage is 69.98%. Comparing base (
cdd543d) to head (2ec2750). Report is 1133 commits behind head on develop.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| .../lib/rpc-method-middleware/handlers/watch-asset.ts | 92.86% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## develop #23776 +/- ##
========================================
Coverage 69.98% 69.98%
========================================
Files 1422 1422
Lines 49926 49926
Branches 13861 13861
========================================
Hits 34940 34940
Misses 14986 14986
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This PR has been automatically marked as stale because it has not had recent activity in the last 60 days. It will be closed in 14 days. Thank you for your contributions.
@metamaskbot update-policies
No policy changes
Builds ready [131dcb2]
- builds: chrome, firefox
- builds (flask): chrome, firefox
- builds (MMI): chrome
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1487 ± 29 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 1345 | 1604 | 1486 | 60 | 29 |
| domContentLoaded | 1339 | 1593 | 1470 | 58 | 28 | ||
| load | 1346 | 1604 | 1487 | 60 | 29 | ||
| domInteractive | 23 | 89 | 32 | 17 | 8 | ||
| backgroundConnect | 9 | 86 | 22 | 20 | 10 | ||
| firstReactRender | 15 | 75 | 44 | 26 | 12 | ||
| getState | 4 | 58 | 8 | 12 | 6 | ||
| initialActions | 0 | 41 | 2 | 9 | 4 | ||
| loadScripts | 938 | 1175 | 1042 | 53 | 25 | ||
| setupStore | 6 | 11 | 8 | 1 | 0 | ||
| uiStartup | 1516 | 1833 | 1686 | 74 | 36 |
Bundle size diffs [🚨 Warning! Bundle size has increased!]
- background: 8 Bytes (0.00%)
- ui: 0 Bytes (0.00%)
- common: 0 Bytes (0.00%)
LGTM !
This PR has been automatically marked as stale because it has not had recent activity in the last 90 days. It will be closed in 7 days. Thank you for your contributions.
This PR was closed because there has been no follow up activity in 7 days. Thank you for your contributions.
Builds ready [131dcb2]
- builds: chrome, firefox
- builds (beta): chrome, firefox
- builds (flask): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- bundle size: Bundle Size Stats
- user-actions-benchmark: User Actions Stats
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
UI Startup Metrics (1220 ± 62 ms)
| Platform | BuildType | Page | Metric | Mean (ms) | Min (ms) | Max (ms) | Std Dev (ms) | P 75 (ms) | P 95 (ms) |
|---|---|---|---|---|---|---|---|---|---|
| Chrome | Browserify | Home | uiStartup | 1220 | 1123 | 1410 | 62 | 1260 | 1320 |
| load | 1057 | 948 | 1193 | 61 | 1104 | 1158 | |||
| domContentLoaded | 1051 | 944 | 1188 | 61 | 1099 | 1153 | |||
| domInteractive | 18 | 14 | 47 | 6 | 16 | 36 | |||
| firstPaint | 793 | 72 | 1195 | 404 | 1095 | 1159 | |||
| backgroundConnect | 7 | 4 | 33 | 4 | 7 | 11 | |||
| firstReactRender | 22 | 17 | 50 | 6 | 22 | 33 | |||
| getState | 12 | 6 | 31 | 6 | 17 | 26 | |||
| initialActions | 0 | 0 | 1 | 0 | 0 | 1 | |||
| loadScripts | 804 | 699 | 930 | 60 | 852 | 901 | |||
| setupStore | 8 | 5 | 19 | 3 | 8 | 16 | |||
| Webpack | Home | uiStartup | 2107 | 1704 | 2669 | 235 | 2257 | 2551 | |
| load | 1611 | 1291 | 2054 | 211 | 1756 | 2005 | |||
| domContentLoaded | 1605 | 1286 | 2050 | 210 | 1752 | 1991 | |||
| domInteractive | 17 | 11 | 74 | 13 | 13 | 55 | |||
| firstPaint | 168 | 62 | 570 | 78 | 224 | 293 | |||
| backgroundConnect | 24 | 10 | 280 | 36 | 22 | 39 | |||
| firstReactRender | 199 | 90 | 400 | 105 | 329 | 393 | |||
| getState | 10 | 4 | 37 | 5 | 12 | 18 | |||
| initialActions | 2 | 1 | 5 | 1 | 3 | 4 | |||
| loadScripts | 1600 | 1279 | 2039 | 208 | 1739 | 1980 | |||
| setupStore | 27 | 7 | 312 | 62 | 16 | 276 | |||
| Firefox | Browserify | Home | uiStartup | 1326 | 1177 | 1658 | 98 | 1368 | 1559 |
| load | 1166 | 1039 | 1334 | 68 | 1211 | 1293 | |||
| domContentLoaded | 1166 | 1038 | 1334 | 68 | 1211 | 1293 | |||
| domInteractive | 112 | 35 | 319 | 55 | 122 | 288 | |||
| firstPaint | NaN | NaN | NaN | NaN | NaN | NaN | |||
| backgroundConnect | 21 | 13 | 141 | 15 | 21 | 44 | |||
| firstReactRender | 23 | 21 | 38 | 2 | 24 | 27 | |||
| getState | 10 | 5 | 91 | 12 | 9 | 31 | |||
| initialActions | 0 | 0 | 1 | 0 | 0 | 1 | |||
| loadScripts | 1148 | 1026 | 1318 | 67 | 1194 | 1262 | |||
| setupStore | 8 | 4 | 75 | 8 | 6 | 19 | |||
| Webpack | Home | uiStartup | 1637 | 1400 | 2130 | 176 | 1739 | 2015 | |
| load | 1417 | 1194 | 1798 | 150 | 1533 | 1683 | |||
| domContentLoaded | 1416 | 1194 | 1798 | 149 | 1533 | 1682 | |||
| domInteractive | 101 | 33 | 525 | 70 | 95 | 298 | |||
| firstPaint | NaN | NaN | NaN | NaN | NaN | NaN | |||
| backgroundConnect | 22 | 15 | 43 | 5 | 24 | 35 | |||
| firstReactRender | 43 | 34 | 53 | 4 | 45 | 50 | |||
| getState | 11 | 6 | 39 | 6 | 11 | 26 | |||
| initialActions | 1 | 0 | 2 | 1 | 1 | 1 | |||
| loadScripts | 1397 | 1176 | 1771 | 149 | 1515 | 1663 | |||
| setupStore | 10 | 5 | 41 | 6 | 9 | 28 |
Benchmark value 393 exceeds gate value 370 for chrome webpack home p95 firstReactRender
Benchmark value 1981 exceeds gate value 1970 for chrome webpack home p95 loadScripts
Benchmark value 276 exceeds gate value 65 for chrome webpack home p95 setupStore
Benchmark value 112 exceeds gate value 110 for firefox browserify home mean domInteractive
Benchmark value 288 exceeds gate value 195 for firefox browserify home p95 domInteractive
Benchmark value 31 exceeds gate value 24 for firefox browserify home p95 getState
Benchmark value 1638 exceeds gate value 1615 for firefox webpack home mean uiStartup
Benchmark value 1417 exceeds gate value 1380 for firefox webpack home mean load
Benchmark value 1417 exceeds gate value 1380 for firefox webpack home mean domContentLoaded
Benchmark value 102 exceeds gate value 100 for firefox webpack home mean domInteractive
Benchmark value 43 exceeds gate value 38 for firefox webpack home mean firstReactRender
Benchmark value 1398 exceeds gate value 1360 for firefox webpack home mean loadScripts
Benchmark value 2015 exceeds gate value 1935 for firefox webpack home p95 uiStartup
Benchmark value 1683 exceeds gate value 1660 for firefox webpack home p95 load
Benchmark value 1682 exceeds gate value 1660 for firefox webpack home p95 domContentLoaded
Benchmark value 298 exceeds gate value 156 for firefox webpack home p95 domInteractive
Benchmark value 1663 exceeds gate value 1630 for firefox webpack home p95 loadScripts
Sum of mean exceeds: 144ms | Sum of p95 exceeds: 742ms
Sum of all benchmark exceeds: 886ms
Bundle size diffs [🚀 Bundle size reduced!]
- background: -547.65 KiB (-9.28%)
- ui: -641.17 KiB (-8.14%)
- common: -749.2 KiB (-8.18%)
Builds ready [21448a6]
- builds: chrome, firefox
- builds (beta): chrome, firefox
- builds (flask): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- bundle size: Bundle Size Stats
- user-actions-benchmark: User Actions Stats
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
UI Startup Metrics (1244 ± 57 ms)
| Platform | BuildType | Page | Metric | Mean (ms) | Min (ms) | Max (ms) | Std Dev (ms) | P 75 (ms) | P 95 (ms) |
|---|---|---|---|---|---|---|---|---|---|
| Chrome | Browserify | Home | uiStartup | 1244 | 1136 | 1401 | 57 | 1282 | 1346 |
| load | 1074 | 967 | 1198 | 57 | 1100 | 1188 | |||
| domContentLoaded | 1067 | 961 | 1192 | 58 | 1095 | 1182 | |||
| domInteractive | 17 | 14 | 39 | 5 | 17 | 31 | |||
| firstPaint | 705 | 79 | 1200 | 433 | 1090 | 1172 | |||
| backgroundConnect | 7 | 4 | 27 | 3 | 8 | 11 | |||
| firstReactRender | 23 | 16 | 49 | 7 | 24 | 41 | |||
| getState | 15 | 6 | 54 | 9 | 21 | 31 | |||
| initialActions | 0 | 0 | 1 | 0 | 0 | 1 | |||
| loadScripts | 817 | 706 | 937 | 55 | 845 | 921 | |||
| setupStore | 9 | 6 | 43 | 6 | 8 | 18 | |||
| Webpack | Home | uiStartup | 2171 | 1667 | 2803 | 217 | 2263 | 2595 | |
| load | 1665 | 1248 | 2116 | 186 | 1756 | 1999 | |||
| domContentLoaded | 1660 | 1244 | 2099 | 185 | 1749 | 1988 | |||
| domInteractive | 17 | 11 | 85 | 15 | 13 | 58 | |||
| firstPaint | 170 | 62 | 598 | 74 | 192 | 295 | |||
| backgroundConnect | 19 | 10 | 42 | 6 | 21 | 32 | |||
| firstReactRender | 220 | 89 | 414 | 112 | 358 | 403 | |||
| getState | 13 | 4 | 323 | 32 | 11 | 24 | |||
| initialActions | 2 | 1 | 5 | 1 | 3 | 4 | |||
| loadScripts | 1657 | 1242 | 2089 | 183 | 1748 | 1977 | |||
| setupStore | 16 | 7 | 269 | 26 | 16 | 24 | |||
| Firefox | Browserify | Home | uiStartup | 1358 | 1227 | 1693 | 104 | 1386 | 1617 |
| load | 1195 | 1075 | 1423 | 74 | 1242 | 1339 | |||
| domContentLoaded | 1194 | 1075 | 1423 | 74 | 1242 | 1338 | |||
| domInteractive | 110 | 35 | 341 | 61 | 108 | 318 | |||
| firstPaint | NaN | NaN | NaN | NaN | NaN | NaN | |||
| backgroundConnect | 22 | 14 | 123 | 12 | 22 | 42 | |||
| firstReactRender | 24 | 20 | 53 | 4 | 24 | 28 | |||
| getState | 10 | 5 | 75 | 9 | 9 | 25 | |||
| initialActions | 0 | 0 | 1 | 0 | 0 | 1 | |||
| loadScripts | 1176 | 1054 | 1399 | 74 | 1220 | 1316 | |||
| setupStore | 9 | 4 | 89 | 12 | 8 | 24 | |||
| Webpack | Home | uiStartup | 1603 | 1360 | 2246 | 187 | 1685 | 2077 | |
| load | 1393 | 1158 | 2003 | 163 | 1472 | 1794 | |||
| domContentLoaded | 1393 | 1158 | 2003 | 163 | 1472 | 1793 | |||
| domInteractive | 97 | 31 | 475 | 69 | 88 | 276 | |||
| firstPaint | NaN | NaN | NaN | NaN | NaN | NaN | |||
| backgroundConnect | 21 | 14 | 100 | 9 | 21 | 33 | |||
| firstReactRender | 41 | 31 | 47 | 3 | 43 | 46 | |||
| getState | 12 | 5 | 103 | 12 | 11 | 33 | |||
| initialActions | 1 | 0 | 2 | 1 | 1 | 1 | |||
| loadScripts | 1375 | 1142 | 1983 | 162 | 1452 | 1771 | |||
| setupStore | 8 | 5 | 32 | 4 | 8 | 18 |
Benchmark value 1074 exceeds gate value 1070 for chrome browserify home mean load
Benchmark value 1068 exceeds gate value 1061 for chrome browserify home mean domContentLoaded
Benchmark value 24 exceeds gate value 23 for chrome browserify home mean firstReactRender
Benchmark value 1183 exceeds gate value 1180 for chrome browserify home p95 domContentLoaded
Benchmark value 18 exceeds gate value 17 for chrome browserify home p95 setupStore
Benchmark value 2595 exceeds gate value 2454 for chrome webpack home p95 uiStartup
Benchmark value 58 exceeds gate value 57 for chrome webpack home p95 domInteractive
Benchmark value 403 exceeds gate value 370 for chrome webpack home p95 firstReactRender
Benchmark value 1977 exceeds gate value 1970 for chrome webpack home p95 loadScripts
Benchmark value 111 exceeds gate value 110 for firefox browserify home mean domInteractive
Benchmark value 10 exceeds gate value 9 for firefox browserify home mean setupStore
Benchmark value 318 exceeds gate value 195 for firefox browserify home p95 domInteractive
Benchmark value 25 exceeds gate value 24 for firefox browserify home p95 getState
Benchmark value 1394 exceeds gate value 1380 for firefox webpack home mean load
Benchmark value 1394 exceeds gate value 1380 for firefox webpack home mean domContentLoaded
Benchmark value 41 exceeds gate value 38 for firefox webpack home mean firstReactRender
Benchmark value 1375 exceeds gate value 1360 for firefox webpack home mean loadScripts
Benchmark value 2077 exceeds gate value 1935 for firefox webpack home p95 uiStartup
Benchmark value 1794 exceeds gate value 1660 for firefox webpack home p95 load
Benchmark value 1793 exceeds gate value 1660 for firefox webpack home p95 domContentLoaded
Benchmark value 276 exceeds gate value 156 for firefox webpack home p95 domInteractive
Benchmark value 33 exceeds gate value 32 for firefox webpack home p95 getState
Benchmark value 1771 exceeds gate value 1630 for firefox webpack home p95 loadScripts
Sum of mean exceeds: 70ms | Sum of p95 exceeds: 981ms
Sum of all benchmark exceeds: 1051ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
- background: 8 Bytes (0%)
- ui: 0 Bytes (0%)
- common: 0 Bytes (0%)