@adobe/helix-rum-enhancer 2.27.0 → 2.29.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,17 @@
1
+ # [2.29.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.28.0...v2.29.0) (2025-01-15)
2
+
3
+
4
+ ### Features
5
+
6
+ * **loadresource:** add `allresources` feature flag that enables tracking all resources, not just same host ([7c536d7](https://github.com/adobe/helix-rum-enhancer/commit/7c536d7b8ec77c40c4b9868dd3dff53c39529699))
7
+
8
+ # [2.28.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.27.0...v2.28.0) (2025-01-02)
9
+
10
+
11
+ ### Features
12
+
13
+ * remove (deprecated) FID ex-CWV ([58e39ae](https://github.com/adobe/helix-rum-enhancer/commit/58e39ae3eae6315562ab9c7aec479e9da2737e7d))
14
+
1
15
  # [2.27.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.26.4...v2.27.0) (2024-12-20)
2
16
 
3
17
 
package/modules/fflags.js CHANGED
@@ -9,16 +9,15 @@
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
+ const h = (s, a) => [...s].reduce((p, c) => p + c.charCodeAt(0), a) % 1371;
13
+
12
14
  export const fflags = {
13
- has: (flag) => fflags[flag].indexOf(Array.from(window.origin)
14
- .map((a) => a.charCodeAt(0))
15
- .reduce((a, b) => a + b, 1) % 1371) !== -1
16
- || !!window.origin.match(/localhost/),
17
- enabled: (flag, callback) => fflags.has(flag) && callback(),
18
- /* c8 ignore next */
19
- disabled: (flag, callback) => !fflags.has(flag) && callback(),
15
+ has: (f) => fflags[f].includes(h(window.origin, 1)) || /localhost/.test(window.origin),
16
+ enabled: (f, c) => fflags.has(f) && c(),
17
+ disabled: (f, c) => !fflags.has(f) && c(),
20
18
  eagercwv: [683],
21
19
  redirect: [620, 1139],
22
20
  example: [543, 770, 1136],
23
21
  language: [543, 959, 1139, 620],
22
+ allresources: [1139],
24
23
  };
package/modules/index.js CHANGED
@@ -90,7 +90,7 @@ function addCWVTracking() {
90
90
 
91
91
  // When loading `web-vitals` using a classic script, all the public
92
92
  // methods can be found on the `webVitals` global namespace.
93
- ['FID', 'INP', 'TTFB', 'CLS', 'LCP'].forEach((metric) => {
93
+ ['INP', 'TTFB', 'CLS', 'LCP'].forEach((metric) => {
94
94
  const metricFn = window.webVitals[`on${metric}`];
95
95
  if (typeof metricFn === 'function') {
96
96
  let opts = {};
@@ -162,7 +162,7 @@ function addLoadResourceTracking() {
162
162
  try {
163
163
  list.getEntries()
164
164
  .filter((e) => !e.responseStatus || e.responseStatus < 400)
165
- .filter((e) => window.location.hostname === new URL(e.name).hostname)
165
+ .filter((e) => window.location.hostname === new URL(e.name).hostname || fflags.has('allresources'))
166
166
  .filter((e) => new URL(e.name).pathname.match('.*(\\.plain\\.html$|\\.json|graphql|api)'))
167
167
  .forEach((e) => {
168
168
  sampleRUM('loadresource', { source: e.name, target: Math.round(e.duration) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "2.27.0",
3
+ "version": "2.29.0",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -41,6 +41,7 @@
41
41
  "@semantic-release/npm": "12.0.1",
42
42
  "@web/test-runner": "0.19.0",
43
43
  "@web/test-runner-commands": "0.9.0",
44
+ "@web/test-runner-junit-reporter": "0.7.2",
44
45
  "@web/test-runner-mocha": "0.9.0",
45
46
  "@web/test-runner-playwright": "0.11.0",
46
47
  "c8": "10.1.3",
@@ -51,14 +52,14 @@
51
52
  "husky": "9.1.7",
52
53
  "jsdoc-to-markdown": "9.1.1",
53
54
  "junit-report-builder": "5.1.1",
54
- "lint-staged": "15.2.11",
55
+ "lint-staged": "15.3.0",
55
56
  "mocha": "11.0.1",
56
57
  "mocha-multi-reporters": "1.5.1",
57
- "rollup": "4.28.1",
58
+ "rollup": "4.30.1",
58
59
  "rollup-plugin-checksum": "1.0.1",
59
60
  "rollup-plugin-cleanup": "3.2.1",
60
61
  "rollup-plugin-eslint-bundle": "9.0.0",
61
- "semantic-release": "24.2.0",
62
+ "semantic-release": "24.2.1",
62
63
  "semantic-release-slack-bot": "^4.0.2",
63
64
  "web-vitals": "4.2.4"
64
65
  },
package/src/index.js CHANGED
@@ -12,17 +12,16 @@
12
12
  (function () {
13
13
  'use strict';
14
14
 
15
+ const h = (s, a) => [...s].reduce((p, c) => p + c.charCodeAt(0), a) % 1371;
15
16
  const fflags = {
16
- has: (flag) => fflags[flag].indexOf(Array.from(window.origin)
17
- .map((a) => a.charCodeAt(0))
18
- .reduce((a, b) => a + b, 1) % 1371) !== -1
19
- || !!window.origin.match(/localhost/),
20
- enabled: (flag, callback) => fflags.has(flag) && callback(),
21
- disabled: (flag, callback) => !fflags.has(flag) && callback(),
17
+ has: (f) => fflags[f].includes(h(window.origin, 1)) || /localhost/.test(window.origin),
18
+ enabled: (f, c) => fflags.has(f) && c(),
19
+ disabled: (f, c) => !fflags.has(f) && c(),
22
20
  eagercwv: [683],
23
21
  redirect: [620, 1139],
24
22
  example: [543, 770, 1136],
25
23
  language: [543, 959, 1139, 620],
24
+ allresources: [1139],
26
25
  };
27
26
 
28
27
  const KNOWN_PROPERTIES = ['weight', 'id', 'referer', 'checkpoint', 't', 'source', 'target', 'cwv', 'CLS', 'FID', 'LCP', 'INP', 'TTFB'];
@@ -248,7 +247,7 @@
248
247
  sampleRUM('cwv', data);
249
248
  };
250
249
  const isEager = (metric) => ['CLS', 'LCP'].includes(metric);
251
- ['FID', 'INP', 'TTFB', 'CLS', 'LCP'].forEach((metric) => {
250
+ ['INP', 'TTFB', 'CLS', 'LCP'].forEach((metric) => {
252
251
  const metricFn = window.webVitals[`on${metric}`];
253
252
  if (typeof metricFn === 'function') {
254
253
  let opts = {};
@@ -309,7 +308,7 @@
309
308
  try {
310
309
  list.getEntries()
311
310
  .filter((e) => !e.responseStatus || e.responseStatus < 400)
312
- .filter((e) => window.location.hostname === new URL(e.name).hostname)
311
+ .filter((e) => window.location.hostname === new URL(e.name).hostname || fflags.has('allresources'))
313
312
  .filter((e) => new URL(e.name).pathname.match('.*(\\.plain\\.html$|\\.json|graphql|api)'))
314
313
  .forEach((e) => {
315
314
  sampleRUM('loadresource', { source: e.name, target: Math.round(e.duration) });
package/src/index.md5 CHANGED
@@ -1 +1 @@
1
- 04eb0119fbaa5f7d37e24a608bbb8195
1
+ 1abf13337d16246784fba2bcfa3f2fb1
@@ -9,7 +9,19 @@
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
+
13
+ // eslint-disable-next-line import/no-extraneous-dependencies
14
+ import { defaultReporter } from '@web/test-runner';
15
+ // eslint-disable-next-line import/no-extraneous-dependencies
16
+ import { junitReporter } from '@web/test-runner-junit-reporter';
17
+
12
18
  export default {
19
+ nodeResolve: true,
20
+ coverage: true,
21
+ reporters: [
22
+ defaultReporter(),
23
+ junitReporter(),
24
+ ],
13
25
  testFramework: {
14
26
  type: 'mocha',
15
27
  config: {
@@ -23,7 +35,7 @@ export default {
23
35
  'test/fixtures/**',
24
36
  'node_modules/**',
25
37
  '.rum/**',
26
- 'src/**',
38
+ 'src/index.js',
27
39
  ],
28
40
  },
29
41
  files: [