@pagepocket/capture-http-lighterceptor-unit 0.11.0 → 0.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.
@@ -1,4 +1,4 @@
1
- import { Unit, type CaptureArtifacts } from "@pagepocket/lib";
1
+ import { Unit, type CaptureArtifacts, type UnitContext, type UnitRuntime } from "@pagepocket/lib";
2
2
  import { type LighterceptorAdapterOptions } from "./internal/lighterceptor-adapter.js";
3
3
  export type CaptureHttpLighterceptorUnitOptions = LighterceptorAdapterOptions;
4
4
  export declare class CaptureHttpLighterceptorUnit extends Unit {
@@ -6,7 +6,7 @@ export declare class CaptureHttpLighterceptorUnit extends Unit {
6
6
  readonly kind = "capture.http.lighterceptor";
7
7
  private adapterOptions;
8
8
  constructor(options?: CaptureHttpLighterceptorUnitOptions);
9
- run(ctx: import("@pagepocket/lib").UnitContext, rt: import("@pagepocket/lib").UnitRuntime): Promise<{
9
+ run(ctx: UnitContext, rt: UnitRuntime): Promise<{
10
10
  capture: CaptureArtifacts;
11
11
  html: {};
12
12
  }>;
@@ -16,13 +16,13 @@ const simulateHoverAll = async () => {
16
16
  const elements = Array.from(document.querySelectorAll("*"));
17
17
  for (const element of elements) {
18
18
  const rect = element.getBoundingClientRect();
19
- const x = rect.left + rect.width / 2;
20
- const y = rect.top + rect.height / 2;
19
+ const pointerX = rect.left + rect.width / 2;
20
+ const pointerY = rect.top + rect.height / 2;
21
21
  const event = new MouseEvent("mouseover", {
22
22
  bubbles: true,
23
23
  cancelable: true,
24
- clientX: x,
25
- clientY: y
24
+ clientX: pointerX,
25
+ clientY: pointerY
26
26
  });
27
27
  element.dispatchEvent(event);
28
28
  }
@@ -2,8 +2,8 @@ export const decodeBase64 = (input) => {
2
2
  if (typeof atob === "function") {
3
3
  const binary = atob(input);
4
4
  const bytes = new Uint8Array(binary.length);
5
- for (let i = 0; i < binary.length; i++) {
6
- bytes[i] = binary.charCodeAt(i);
5
+ for (let byteIndex = 0; byteIndex < binary.length; byteIndex += 1) {
6
+ bytes[byteIndex] = binary.charCodeAt(byteIndex);
7
7
  }
8
8
  return bytes;
9
9
  }
@@ -1,4 +1,4 @@
1
1
  export const getHeaderValue = (headers, name) => {
2
- const key = Object.keys(headers).find((k) => k.toLowerCase() === name.toLowerCase());
3
- return key ? headers[key] : undefined;
2
+ const headerKey = Object.keys(headers).find((existingHeaderName) => existingHeaderName.toLowerCase() === name.toLowerCase());
3
+ return headerKey ? headers[headerKey] : undefined;
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagepocket/capture-http-lighterceptor-unit",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "PagePocket plugin: capture HTTP events (lighterceptor adapter)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -10,9 +10,9 @@
10
10
  ],
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "@pagepocket/lib": "0.11.0",
14
- "@pagepocket/contracts": "0.11.0",
15
- "@pagepocket/lighterceptor": "0.11.0"
13
+ "@pagepocket/lib": "0.12.0",
14
+ "@pagepocket/contracts": "0.12.0",
15
+ "@pagepocket/lighterceptor": "0.12.0"
16
16
  },
17
17
  "devDependencies": {
18
18
  "typescript": "^5.4.5"