@adobe/helix-rum-enhancer 1.4.0 → 1.6.0
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/CHANGELOG.md +15 -0
- package/package.json +6 -6
- package/src/index.js +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# [1.6.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.5.0...v1.6.0) (2023-10-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **cwv:** add support for TTFB ([f987042](https://github.com/adobe/helix-rum-enhancer/commit/f9870425d6bf9135b090d18947e7dc6ad0fa6ca9))
|
|
7
|
+
|
|
8
|
+
# [1.5.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.4.0...v1.5.0) (2023-09-21)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **index:** configurable base url. Adapt to changes in helix-rum-js ([1bb9792](https://github.com/adobe/helix-rum-enhancer/commit/1bb9792f46441d4b17809570f3a018552389515f))
|
|
14
|
+
* **index:** enable configurable base url ([3adc4a8](https://github.com/adobe/helix-rum-enhancer/commit/3adc4a8308b86571af5014f6463a4543f3fca857))
|
|
15
|
+
|
|
1
16
|
# [1.4.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.3.0...v1.4.0) (2023-09-02)
|
|
2
17
|
|
|
3
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-rum-enhancer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Helix RUM Enhancer",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -31,19 +31,19 @@
|
|
|
31
31
|
"@adobe/eslint-config-helix": "2.0.3",
|
|
32
32
|
"@semantic-release/changelog": "6.0.3",
|
|
33
33
|
"@semantic-release/git": "10.0.1",
|
|
34
|
-
"@semantic-release/npm": "
|
|
34
|
+
"@semantic-release/npm": "11.0.0",
|
|
35
35
|
"c8": "8.0.1",
|
|
36
36
|
"codecov": "3.8.3",
|
|
37
|
-
"eslint": "8.
|
|
37
|
+
"eslint": "8.51.0",
|
|
38
38
|
"eslint-plugin-header": "3.1.1",
|
|
39
39
|
"eslint-plugin-import": "2.28.1",
|
|
40
40
|
"husky": "8.0.3",
|
|
41
41
|
"jsdoc-to-markdown": "8.0.0",
|
|
42
|
-
"junit-report-builder": "3.0
|
|
43
|
-
"lint-staged": "
|
|
42
|
+
"junit-report-builder": "3.1.0",
|
|
43
|
+
"lint-staged": "15.0.1",
|
|
44
44
|
"mocha": "10.2.0",
|
|
45
45
|
"mocha-multi-reporters": "1.5.1",
|
|
46
|
-
"semantic-release": "
|
|
46
|
+
"semantic-release": "22.0.5"
|
|
47
47
|
},
|
|
48
48
|
"lint-staged": {
|
|
49
49
|
"*.js": "eslint",
|
package/src/index.js
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
const { sampleRUM } = window.hlx.rum;
|
|
13
13
|
|
|
14
|
+
sampleRUM.baseURL = sampleRUM.baseURL || new URL('https://rum.hlx.page');
|
|
15
|
+
|
|
14
16
|
sampleRUM.blockobserver = (window.IntersectionObserver) ? new IntersectionObserver((entries) => {
|
|
15
17
|
entries
|
|
16
18
|
.filter((entry) => entry.isIntersecting)
|
|
@@ -62,13 +64,14 @@ sampleRUM.targetselector = (element) => {
|
|
|
62
64
|
};
|
|
63
65
|
|
|
64
66
|
sampleRUM.drain('cwv', (() => {
|
|
65
|
-
|
|
67
|
+
const cwvScript = new URL('.rum/web-vitals/dist/web-vitals.iife.js', sampleRUM.baseURL).href;
|
|
68
|
+
if (document.querySelector(`script[src="${cwvScript}"]`)) {
|
|
66
69
|
// web vitals script has been loaded already
|
|
67
70
|
return;
|
|
68
71
|
}
|
|
69
72
|
// use classic script to avoid CORS issues
|
|
70
73
|
const script = document.createElement('script');
|
|
71
|
-
script.src =
|
|
74
|
+
script.src = cwvScript;
|
|
72
75
|
script.onload = () => {
|
|
73
76
|
const storeCWV = (measurement) => {
|
|
74
77
|
const data = { cwv: {} };
|
|
@@ -77,7 +80,7 @@ sampleRUM.drain('cwv', (() => {
|
|
|
77
80
|
};
|
|
78
81
|
// When loading `web-vitals` using a classic script, all the public
|
|
79
82
|
// methods can be found on the `webVitals` global namespace.
|
|
80
|
-
['CLS', 'FID', 'LCP', 'INP']
|
|
83
|
+
['CLS', 'FID', 'LCP', 'INP', 'TTFB']
|
|
81
84
|
.map((metric) => window.webVitals[`get${metric}`])
|
|
82
85
|
.filter((metric) => typeof metric === 'function')
|
|
83
86
|
.forEach((invokeMetric) => {
|