@percy/sdk-utils 1.31.14-beta.1 → 1.31.14-beta.3

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/dist/bundle.js CHANGED
@@ -326,6 +326,22 @@
326
326
  }
327
327
  }
328
328
 
329
+ // Iframe depth constants shared with @percy/dom's serialize-frames. Kept
330
+ // here so external Percy SDKs (Capybara, Cypress, Playwright, etc.) can
331
+ // clamp their own pre-CLI configuration to the same bounds the CLI enforces.
332
+ //
333
+ // MIRROR: must match @percy/dom/src/serialize-frames.js. The pair is kept
334
+ // duplicated (rather than imported across the package boundary) because the
335
+ // previous cross-package import broke Node 14 CI; the parity test below
336
+ // enforces alignment instead. Don't change one without changing the other.
337
+ const DEFAULT_MAX_IFRAME_DEPTH = 3;
338
+ const HARD_MAX_IFRAME_DEPTH = 10;
339
+ function clampIframeDepth(raw) {
340
+ const n = Number(raw);
341
+ if (!Number.isFinite(n) || n < 1) return DEFAULT_MAX_IFRAME_DEPTH;
342
+ return Math.min(Math.floor(n), HARD_MAX_IFRAME_DEPTH);
343
+ }
344
+
329
345
  var index = /*#__PURE__*/Object.freeze({
330
346
  __proto__: null,
331
347
  logger: logger,
@@ -340,10 +356,16 @@
340
356
  captureAutomateScreenshot: captureAutomateScreenshot,
341
357
  postBuildEvents: postBuildEvents,
342
358
  getResponsiveWidths: getResponsiveWidths,
359
+ DEFAULT_MAX_IFRAME_DEPTH: DEFAULT_MAX_IFRAME_DEPTH,
360
+ HARD_MAX_IFRAME_DEPTH: HARD_MAX_IFRAME_DEPTH,
361
+ clampIframeDepth: clampIframeDepth,
343
362
  'default': index
344
363
  });
345
364
 
365
+ exports.DEFAULT_MAX_IFRAME_DEPTH = DEFAULT_MAX_IFRAME_DEPTH;
366
+ exports.HARD_MAX_IFRAME_DEPTH = HARD_MAX_IFRAME_DEPTH;
346
367
  exports.captureAutomateScreenshot = captureAutomateScreenshot;
368
+ exports.clampIframeDepth = clampIframeDepth;
347
369
  exports["default"] = index;
348
370
  exports.fetchPercyDOM = fetchPercyDOM;
349
371
  exports.flushSnapshots = flushSnapshots;
package/dist/index.js CHANGED
@@ -3,12 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.HARD_MAX_IFRAME_DEPTH = exports.DEFAULT_MAX_IFRAME_DEPTH = void 0;
6
7
  Object.defineProperty(exports, "captureAutomateScreenshot", {
7
8
  enumerable: true,
8
9
  get: function () {
9
10
  return _postScreenshot.default;
10
11
  }
11
12
  });
13
+ exports.clampIframeDepth = clampIframeDepth;
12
14
  exports.default = void 0;
13
15
  Object.defineProperty(exports, "fetchPercyDOM", {
14
16
  enumerable: true,
@@ -92,4 +94,21 @@ var _default = _interopRequireWildcard(require("./index.js"));
92
94
  exports.default = _default;
93
95
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
94
96
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
95
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
97
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
98
+ // Iframe depth constants shared with @percy/dom's serialize-frames. Kept
99
+ // here so external Percy SDKs (Capybara, Cypress, Playwright, etc.) can
100
+ // clamp their own pre-CLI configuration to the same bounds the CLI enforces.
101
+ //
102
+ // MIRROR: must match @percy/dom/src/serialize-frames.js. The pair is kept
103
+ // duplicated (rather than imported across the package boundary) because the
104
+ // previous cross-package import broke Node 14 CI; the parity test below
105
+ // enforces alignment instead. Don't change one without changing the other.
106
+ const DEFAULT_MAX_IFRAME_DEPTH = exports.DEFAULT_MAX_IFRAME_DEPTH = 3;
107
+ const HARD_MAX_IFRAME_DEPTH = exports.HARD_MAX_IFRAME_DEPTH = 10;
108
+ function clampIframeDepth(raw) {
109
+ const n = Number(raw);
110
+ if (!Number.isFinite(n) || n < 1) return DEFAULT_MAX_IFRAME_DEPTH;
111
+ return Math.min(Math.floor(n), HARD_MAX_IFRAME_DEPTH);
112
+ }
113
+
114
+ // export the namespace by default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/sdk-utils",
3
- "version": "1.31.14-beta.1",
3
+ "version": "1.31.14-beta.3",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -54,5 +54,5 @@
54
54
  "dependencies": {
55
55
  "pac-proxy-agent": "^7.0.2"
56
56
  },
57
- "gitHead": "dd6957822cc94d460fd9c043a44cc4c9c5fcba23"
57
+ "gitHead": "a17d4a1453c6bef282fd3da38082b670e125a5be"
58
58
  }