@adobe/helix-rum-enhancer 1.11.0 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.releaserc.cjs +1 -1
- package/CHANGELOG.md +7 -0
- package/README.md +1 -2
- package/package.json +3 -2
- package/src/index.js +11 -6
package/.releaserc.cjs
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.11.1](https://github.com/adobe/helix-rum-enhancer/compare/v1.11.0...v1.11.1) (2024-02-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **cwv:** report metrics eagerly ([b7a7e3e](https://github.com/adobe/helix-rum-enhancer/commit/b7a7e3e202f8dc4de97994cdf36ece95075082c4))
|
|
7
|
+
|
|
1
8
|
# [1.11.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.10.0...v1.11.0) (2024-01-17)
|
|
2
9
|
|
|
3
10
|
|
package/README.md
CHANGED
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
## Status
|
|
6
6
|
[](https://codecov.io/gh/adobe/helix-rum-enhancer)
|
|
7
|
-
[](https://github.com/adobe/helix-rum-enhancer/actions/workflows/main.yaml)
|
|
8
8
|
[](https://github.com/adobe/helix-rum-enhancer/blob/master/LICENSE.txt)
|
|
9
9
|
[](https://github.com/adobe/helix-rum-enhancer/issues)
|
|
10
|
-
[](https://lgtm.com/projects/g/adobe/helix-rum-enhancer)
|
|
11
10
|
[](https://github.com/semantic-release/semantic-release)
|
|
12
11
|
|
|
13
12
|
## Usage
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-rum-enhancer",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.1",
|
|
4
4
|
"description": "Helix RUM Enhancer",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"lint": "eslint .",
|
|
10
10
|
"docs": "npx jsdoc2md -c .jsdoc.json --files 'src/*.js' > docs/API.md",
|
|
11
11
|
"semantic-release": "semantic-release",
|
|
12
|
+
"semantic-release-dry": "semantic-release --dry-run --branches $CI_BRANCH 1.x main",
|
|
12
13
|
"prepare": "husky install"
|
|
13
14
|
},
|
|
14
15
|
"repository": {
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
"reporter-options": "configFile=.mocha-multi.json"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@adobe/eslint-config-helix": "2.0.
|
|
32
|
+
"@adobe/eslint-config-helix": "2.0.6",
|
|
32
33
|
"@semantic-release/changelog": "6.0.3",
|
|
33
34
|
"@semantic-release/git": "10.0.1",
|
|
34
35
|
"@semantic-release/npm": "11.0.2",
|
package/src/index.js
CHANGED
|
@@ -91,14 +91,19 @@ sampleRUM.drain('cwv', (() => {
|
|
|
91
91
|
data.cwv[measurement.name] = measurement.value;
|
|
92
92
|
sampleRUM('cwv', data);
|
|
93
93
|
};
|
|
94
|
+
|
|
95
|
+
const featureToggle = () => window.location.hostname === 'blog.adobe.com';
|
|
96
|
+
const isEager = (metric) => ['CLS', 'LCP'].includes(metric);
|
|
97
|
+
|
|
94
98
|
// When loading `web-vitals` using a classic script, all the public
|
|
95
99
|
// methods can be found on the `webVitals` global namespace.
|
|
96
|
-
['
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
100
|
+
['FID', 'INP', 'TTFB', 'CLS', 'LCP'].forEach((metric) => {
|
|
101
|
+
const metricFn = window.webVitals[`on${metric}`];
|
|
102
|
+
if (typeof metricFn === 'function') {
|
|
103
|
+
const opts = isEager(metric) ? { reportAllChanges: featureToggle() } : undefined;
|
|
104
|
+
metricFn(storeCWV, opts);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
102
107
|
};
|
|
103
108
|
document.head.appendChild(script);
|
|
104
109
|
}));
|