@adobe/helix-rum-enhancer 1.5.0 → 1.7.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 CHANGED
@@ -1,3 +1,18 @@
1
+ # [1.7.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.6.0...v1.7.0) (2023-10-31)
2
+
3
+
4
+ ### Features
5
+
6
+ * **checkpoint:** new loadresource checkpoint ([d818efc](https://github.com/adobe/helix-rum-enhancer/commit/d818efc854241119979300387b3dcd4d59c6c8f5))
7
+ * **checkpoint:** introduce new resource checkpoint ([2845a20](https://github.com/adobe/helix-rum-enhancer/commit/2845a202281c09f1c75b4e8a52de000663410b1c))
8
+
9
+ # [1.6.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.5.0...v1.6.0) (2023-10-18)
10
+
11
+
12
+ ### Features
13
+
14
+ * **cwv:** add support for TTFB ([f987042](https://github.com/adobe/helix-rum-enhancer/commit/f9870425d6bf9135b090d18947e7dc6ad0fa6ca9))
15
+
1
16
  # [1.5.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.4.0...v1.5.0) (2023-09-21)
2
17
 
3
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -28,22 +28,22 @@
28
28
  "reporter-options": "configFile=.mocha-multi.json"
29
29
  },
30
30
  "devDependencies": {
31
- "@adobe/eslint-config-helix": "2.0.3",
31
+ "@adobe/eslint-config-helix": "2.0.4",
32
32
  "@semantic-release/changelog": "6.0.3",
33
33
  "@semantic-release/git": "10.0.1",
34
34
  "@semantic-release/npm": "11.0.0",
35
35
  "c8": "8.0.1",
36
36
  "codecov": "3.8.3",
37
- "eslint": "8.49.0",
37
+ "eslint": "8.52.0",
38
38
  "eslint-plugin-header": "3.1.1",
39
- "eslint-plugin-import": "2.28.1",
39
+ "eslint-plugin-import": "2.29.0",
40
40
  "husky": "8.0.3",
41
41
  "jsdoc-to-markdown": "8.0.0",
42
- "junit-report-builder": "3.0.1",
43
- "lint-staged": "14.0.1",
42
+ "junit-report-builder": "3.1.0",
43
+ "lint-staged": "15.0.2",
44
44
  "mocha": "10.2.0",
45
45
  "mocha-multi-reporters": "1.5.1",
46
- "semantic-release": "22.0.0"
46
+ "semantic-release": "22.0.5"
47
47
  },
48
48
  "lint-staged": {
49
49
  "*.js": "eslint",
package/src/index.js CHANGED
@@ -80,7 +80,7 @@ sampleRUM.drain('cwv', (() => {
80
80
  };
81
81
  // When loading `web-vitals` using a classic script, all the public
82
82
  // methods can be found on the `webVitals` global namespace.
83
- ['CLS', 'FID', 'LCP', 'INP']
83
+ ['CLS', 'FID', 'LCP', 'INP', 'TTFB']
84
84
  .map((metric) => window.webVitals[`get${metric}`])
85
85
  .filter((metric) => typeof metric === 'function')
86
86
  .forEach((invokeMetric) => {
@@ -134,3 +134,15 @@ document.querySelectorAll('form').forEach((form) => {
134
134
 
135
135
  window.addEventListener('visibilitychange', ((event) => sampleRUM.leave(event)));
136
136
  window.addEventListener('pagehide', ((event) => sampleRUM.leave(event)));
137
+
138
+ if (window.location.hostname === 'blog.adobe.com') {
139
+ const observer = new PerformanceObserver((list) => {
140
+ list.getEntries()
141
+ .filter((entry) => !entry.responseStatus || entry.responseStatus < 400)
142
+ .filter((entry) => new URL(entry.name).pathname.match('.*(\\.plain\\.html|\\.json)$'))
143
+ .forEach((entry) => {
144
+ sampleRUM('loadresource', { source: entry.name, target: Math.round(entry.duration) });
145
+ });
146
+ });
147
+ observer.observe({ type: 'resource', buffered: true });
148
+ }