@smoothdeploy/playwright-core 1.57.0 → 1.57.1-beta-1770368987000

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.

Potentially problematic release.


This version of @smoothdeploy/playwright-core might be problematic. Click here for more details.

Files changed (31) hide show
  1. package/lib/client/channelOwner.js +4 -3
  2. package/lib/client/clientInstrumentation.js +10 -0
  3. package/lib/generated/pollingRecorderSource.js +1 -1
  4. package/lib/protocol/validator.js +16 -0
  5. package/lib/server/recorder.js +55 -0
  6. package/lib/server/screenshotCompositor.js +127 -0
  7. package/lib/vite/traceViewer/assets/codeMirrorModule-8UJPCtp4.js +16884 -0
  8. package/lib/vite/traceViewer/assets/{codeMirrorModule-Bucv2d7q.js → codeMirrorModule-BNr6yhVP.js} +1 -1
  9. package/lib/vite/traceViewer/assets/codeMirrorModule-BtSt7Qcn.js +25 -0
  10. package/lib/vite/traceViewer/assets/codeMirrorModule-DySgctgr.js +16884 -0
  11. package/lib/vite/traceViewer/assets/{defaultSettingsView-BEpdCv1S.js → defaultSettingsView-D-QZZQWH.js} +39 -39
  12. package/lib/vite/traceViewer/assets/defaultSettingsView-D4fm31R-.js +34087 -0
  13. package/lib/vite/traceViewer/assets/defaultSettingsView-JtyB0yzL.js +34087 -0
  14. package/lib/vite/traceViewer/assets/defaultSettingsView-tEZf-LNj.js +266 -0
  15. package/lib/vite/traceViewer/assets/xtermModule-DDw6eROI.js +6168 -0
  16. package/lib/vite/traceViewer/codeMirrorModule.DuST8d_k.css +344 -0
  17. package/lib/vite/traceViewer/defaultSettingsView.5FCqBwKs.css +3986 -0
  18. package/lib/vite/traceViewer/index.BQs8gGhY.js +249 -0
  19. package/lib/vite/traceViewer/{index.BxQ34UMZ.js → index.BoLn624r.js} +1 -1
  20. package/lib/vite/traceViewer/index.Bq_EaK8x.js +249 -0
  21. package/lib/vite/traceViewer/index.DM2kY0Ok.js +2 -0
  22. package/lib/vite/traceViewer/index.G-7UhDxt.css +164 -0
  23. package/lib/vite/traceViewer/index.html +2 -2
  24. package/lib/vite/traceViewer/uiMode.-Kflt2XM.css +1440 -0
  25. package/lib/vite/traceViewer/{uiMode.BWTwXl41.js → uiMode.BTRKnokb.js} +1 -1
  26. package/lib/vite/traceViewer/uiMode.CIWF23si.js +1829 -0
  27. package/lib/vite/traceViewer/uiMode.DItQ2Rvo.js +5 -0
  28. package/lib/vite/traceViewer/uiMode.Wi-DvIEY.js +1829 -0
  29. package/lib/vite/traceViewer/uiMode.html +2 -2
  30. package/lib/vite/traceViewer/xtermModule.BKlWQB97.css +218 -0
  31. package/package.json +2 -1
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var screenshotCompositor_exports = {};
20
+ __export(screenshotCompositor_exports, {
21
+ compositeHighlight: () => compositeHighlight,
22
+ cropFullWidth: () => cropFullWidth,
23
+ cropRegion: () => cropRegion,
24
+ setPixel: () => setPixel
25
+ });
26
+ module.exports = __toCommonJS(screenshotCompositor_exports);
27
+ var import_utilsBundle = require("../utilsBundle");
28
+ function setPixel(data, width, height, x, y, color) {
29
+ if (x < 0 || x >= width || y < 0 || y >= height)
30
+ return;
31
+ const i = (y * width + x) * 4;
32
+ data[i] = color.r;
33
+ data[i + 1] = color.g;
34
+ data[i + 2] = color.b;
35
+ data[i + 3] = 255;
36
+ }
37
+ function cropFullWidth(data, imgWidth, imgHeight, by, bh) {
38
+ const cw = imgWidth;
39
+ let ch = Math.min(imgHeight, Math.round(cw / (16 / 9)));
40
+ const elementCenterY = by + Math.round(bh / 2);
41
+ let cy = Math.max(0, elementCenterY - Math.round(ch / 2));
42
+ if (cy + ch > imgHeight)
43
+ cy = Math.max(0, imgHeight - ch);
44
+ ch = Math.min(imgHeight - cy, ch);
45
+ const cropped = Buffer.alloc(cw * ch * 4);
46
+ for (let row = 0; row < ch; row++) {
47
+ const srcOffset = (cy + row) * cw * 4;
48
+ const dstOffset = row * cw * 4;
49
+ data.copy(cropped, dstOffset, srcOffset, srcOffset + cw * 4);
50
+ }
51
+ return { data: cropped, width: cw, height: ch };
52
+ }
53
+ function cropRegion(data, imgWidth, imgHeight, bx, by, bw, bh, dpr, padPx = 50) {
54
+ const pad = padPx * dpr;
55
+ let cx = Math.max(0, bx - pad);
56
+ let cy = Math.max(0, by - pad);
57
+ let cw = Math.min(imgWidth - cx, bw + 2 * pad);
58
+ let ch = Math.min(imgHeight - cy, bh + 2 * pad);
59
+ const targetRatio = 16 / 9;
60
+ if (cw / ch < targetRatio) {
61
+ const newCw = Math.round(ch * targetRatio);
62
+ const expand = newCw - cw;
63
+ cx = Math.max(0, cx - Math.round(expand / 2));
64
+ cw = Math.min(imgWidth - cx, newCw);
65
+ } else {
66
+ const newCh = Math.round(cw / targetRatio);
67
+ const expand = newCh - ch;
68
+ cy = Math.max(0, cy - Math.round(expand / 2));
69
+ ch = Math.min(imgHeight - cy, newCh);
70
+ }
71
+ const cropped = Buffer.alloc(cw * ch * 4);
72
+ for (let row = 0; row < ch; row++) {
73
+ const srcOffset = ((cy + row) * imgWidth + cx) * 4;
74
+ const dstOffset = row * cw * 4;
75
+ data.copy(cropped, dstOffset, srcOffset, srcOffset + cw * 4);
76
+ }
77
+ return { data: cropped, width: cw, height: ch };
78
+ }
79
+ function compositeHighlight(pngBuffer, box, viewport) {
80
+ const png = import_utilsBundle.PNG.sync.read(pngBuffer);
81
+ const { width, height, data } = png;
82
+ const scaleX = viewport ? width / viewport.width : 1;
83
+ const scaleY = viewport ? height / viewport.height : 1;
84
+ const bx = Math.max(0, Math.round(box.x * scaleX));
85
+ const by = Math.max(0, Math.round(box.y * scaleY));
86
+ const bw = Math.min(width - bx, Math.round(box.width * scaleX));
87
+ const bh = Math.min(height - by, Math.round(box.height * scaleY));
88
+ for (let y = 0; y < height; y++) {
89
+ for (let x = 0; x < width; x++) {
90
+ if (x >= bx && x < bx + bw && y >= by && y < by + bh)
91
+ continue;
92
+ const i = (y * width + x) * 4;
93
+ data[i] = data[i] * 0.5 | 0;
94
+ data[i + 1] = data[i + 1] * 0.5 | 0;
95
+ data[i + 2] = data[i + 2] * 0.5 | 0;
96
+ }
97
+ }
98
+ const borderColor = { r: 255, g: 0, b: 0 };
99
+ const dpr = Math.round(scaleX) || 1;
100
+ const offset = 2 * dpr;
101
+ const thickness = 3 * dpr;
102
+ const ox = bx - offset - thickness;
103
+ const oy = by - offset - thickness;
104
+ const ow = bw + (offset + thickness) * 2;
105
+ const oh = bh + (offset + thickness) * 2;
106
+ for (let t = 0; t < thickness; t++) {
107
+ for (let x = ox; x < ox + ow; x++)
108
+ setPixel(data, width, height, x, oy + t, borderColor);
109
+ for (let x = ox; x < ox + ow; x++)
110
+ setPixel(data, width, height, x, oy + oh - 1 - t, borderColor);
111
+ for (let y = oy; y < oy + oh; y++)
112
+ setPixel(data, width, height, ox + t, y, borderColor);
113
+ for (let y = oy; y < oy + oh; y++)
114
+ setPixel(data, width, height, ox + ow - 1 - t, y, borderColor);
115
+ }
116
+ const fullData = Buffer.from(data.buffer, data.byteOffset, data.byteLength);
117
+ const full = cropFullWidth(fullData, width, height, by, bh);
118
+ const cropped = cropRegion(fullData, width, height, bx, by, bw, bh, dpr, 50);
119
+ return { full, cropped };
120
+ }
121
+ // Annotate the CommonJS export names for ESM import in node:
122
+ 0 && (module.exports = {
123
+ compositeHighlight,
124
+ cropFullWidth,
125
+ cropRegion,
126
+ setPixel
127
+ });