Skip to content

Commit c01838b

Browse files
Connor ClarkDevtools-frontend LUCI CQ
authored andcommitted
[WebVitals] Update building documentation
I verified the build docs were accurate and marked the manual edits within the imported package. I also extended roll_front_end_third_party.py to accept an optional version number, so rebuild.sh scripts can choose to pin to a specific version. Bug: 421413367 Change-Id: I12ac25414d2009cf70cc3e65b64c63a027c2165b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7030185 Commit-Queue: Connor Clark <[email protected]> Commit-Queue: Paul Irish <[email protected]> Reviewed-by: Paul Irish <[email protected]> Auto-Submit: Connor Clark <[email protected]>
1 parent 2731ecb commit c01838b

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

front_end/third_party/web-vitals/README.chromium

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ Essential metrics for a healthy site.
1414

1515
## Bumping.
1616

17+
First, go update rebuild.sh to specify the version you want. Then run the rebuild script:
18+
1719
```bash
1820
./front_end/third_party/web-vitals/rebuild.sh
19-
20-
# Also, consider commenting out roll script to just recompile without a bump, however this will reset some edits 2,3 listed below.
2121
```
2222

2323
## DevTools edits to web-vitals
2424

2525
1. There's a sed edit in the rebuild.sh to expose `attributeINP`. That'll continue in v5 but be harder to do.
26-
2. Some lines are manually commented out in `attribution/onINP.js`'s `saveInteractionTarget`. b/376777343 Unknown if needed in v5.
27-
3. Some lines are added in `onHidden.js` to resolve a memory leak. Not needed in v5. b/425309898#comment4
28-
4. (Not part of package, but..) There's a hack to clear `interactionTargetElement` in our own web-vitals-injected that won't be necessary in v5.
26+
2. Minor manual edits (ctrl+f "cdt-modification"):
27+
* some lines are manually commented out in `attribution/onINP.js`'s `saveInteractionTarget`. b/376777343 Unknown if needed in v5.
28+
3. (Not part of package, but..) There's a hack to clear `interactionTargetElement` in our own web-vitals-injected that won't be necessary in v5.

front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ const handleLoAFEntries = (entries) => {
6060
// Get a reference to the interaction target element in case it's removed
6161
// from the DOM later.
6262
const saveInteractionTarget = (entry) => {
63+
// cdt-modification
6364
// TODO(b/376777343): Remove this modification when web-vitals.js doesn't retain DOM nodes anymore
6465
// Although it is useful for DevTools to retain nodes for diagnostic purposes, it is not preferable
6566
// to retaining Nodes in memory when the user does not expect them to.

front_end/third_party/web-vitals/rebuild.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ set -euo pipefail
44

55
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
66

7-
# Roll the latest version of the package from NPM
8-
vpython3 scripts/deps/roll_front_end_third_party.py web-vitals web-vitals dist
7+
# Roll the specified version of the package from NPM
8+
vpython3 scripts/deps/roll_front_end_third_party.py web-vitals web-vitals dist 4.2.4
99

1010
# We need this one helper function to be exported, so modify the source .ts and then rebuild
1111
sed -i -e 's/^const attributeINP/export const attributeINP/g' $SCRIPT_DIR/package/src/attribution/onINP.ts

scripts/deps/roll_front_end_third_party.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ def main():
112112
parser.add_argument('package_name')
113113
parser.add_argument('output_dir')
114114
parser.add_argument('library_dir')
115+
parser.add_argument('version', default='latest')
115116

116117
args = parser.parse_args()
117118

@@ -125,7 +126,7 @@ def main():
125126
old_package_json = json.load(open(f'{package_path}/package.json'))
126127
package_json = json.load(
127128
urllib.request.urlopen(
128-
f'https://registry.npmjs.org/{package_name}/latest'))
129+
f'https://registry.npmjs.org/{package_name}/{args.version}'))
129130

130131
# Version check
131132
version = parse_version(package_json['version'])

0 commit comments

Comments
 (0)