@adobe/helix-rum-enhancer 1.11.0 → 1.12.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/.releaserc.cjs +1 -1
- package/CHANGELOG.md +14 -0
- package/README.md +1 -2
- package/package.json +10 -9
- package/src/index.js +19 -6
package/.releaserc.cjs
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [1.12.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.11.1...v1.12.0) (2024-03-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **resources:** add missingresource checkpoint behind feature toggle ([204af90](https://github.com/adobe/helix-rum-enhancer/commit/204af900ddcd58fc68ecf57593a98dddec12f36d))
|
|
7
|
+
|
|
8
|
+
## [1.11.1](https://github.com/adobe/helix-rum-enhancer/compare/v1.11.0...v1.11.1) (2024-02-28)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **cwv:** report metrics eagerly ([b7a7e3e](https://github.com/adobe/helix-rum-enhancer/commit/b7a7e3e202f8dc4de97994cdf36ece95075082c4))
|
|
14
|
+
|
|
1
15
|
# [1.11.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.10.0...v1.11.0) (2024-01-17)
|
|
2
16
|
|
|
3
17
|
|
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.
|
|
3
|
+
"version": "1.12.0",
|
|
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,20 +29,20 @@
|
|
|
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
|
-
"@semantic-release/npm": "11.0.
|
|
35
|
-
"c8": "9.
|
|
35
|
+
"@semantic-release/npm": "11.0.3",
|
|
36
|
+
"c8": "9.1.0",
|
|
36
37
|
"codecov": "3.8.3",
|
|
37
|
-
"eslint": "8.
|
|
38
|
+
"eslint": "8.57.0",
|
|
38
39
|
"eslint-plugin-header": "3.1.1",
|
|
39
40
|
"eslint-plugin-import": "2.29.1",
|
|
40
41
|
"husky": "8.0.3",
|
|
41
|
-
"jsdoc-to-markdown": "8.0.
|
|
42
|
-
"junit-report-builder": "3.1
|
|
43
|
-
"lint-staged": "15.2.
|
|
44
|
-
"mocha": "10.
|
|
42
|
+
"jsdoc-to-markdown": "8.0.1",
|
|
43
|
+
"junit-report-builder": "3.2.1",
|
|
44
|
+
"lint-staged": "15.2.2",
|
|
45
|
+
"mocha": "10.3.0",
|
|
45
46
|
"mocha-multi-reporters": "1.5.1",
|
|
46
47
|
"semantic-release": "22.0.12"
|
|
47
48
|
},
|
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
|
}));
|
|
@@ -162,5 +167,13 @@ const observer = new PerformanceObserver((list) => {
|
|
|
162
167
|
.forEach((entry) => {
|
|
163
168
|
sampleRUM('loadresource', { source: entry.name, target: Math.round(entry.duration) });
|
|
164
169
|
});
|
|
170
|
+
if (window.origin === 'business.adobe.com') {
|
|
171
|
+
// feature flagged for now
|
|
172
|
+
list.getEntries()
|
|
173
|
+
.filter((entry) => entry.responseStatus === 404)
|
|
174
|
+
.forEach((entry) => {
|
|
175
|
+
sampleRUM('missingresource', { source: entry.name, target: entry.hostname });
|
|
176
|
+
});
|
|
177
|
+
}
|
|
165
178
|
});
|
|
166
179
|
observer.observe({ type: 'resource', buffered: true });
|