@percy/sdk-utils 1.27.0 → 1.27.1
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 +0 -52
- package/dist/index.js +0 -14
- package/package.json +2 -2
- package/dist/timing.js +0 -51
- package/dist/validations.js +0 -12
package/dist/bundle.js
CHANGED
|
@@ -279,54 +279,6 @@
|
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
function Undefined(obj) {
|
|
283
|
-
return obj === undefined;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
class TimeIt {
|
|
287
|
-
static data = {};
|
|
288
|
-
static enabled = process.env.PERCY_METRICS === 'true';
|
|
289
|
-
static async run(store, func) {
|
|
290
|
-
if (!this.enabled) return await func();
|
|
291
|
-
const t1 = Date.now();
|
|
292
|
-
try {
|
|
293
|
-
return await func();
|
|
294
|
-
} finally {
|
|
295
|
-
if (Undefined(this.data[store])) this.data[store] = [];
|
|
296
|
-
this.data[store].push(Date.now() - t1);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
static min(store) {
|
|
300
|
-
return Math.min(...this.data[store]);
|
|
301
|
-
}
|
|
302
|
-
static max(store) {
|
|
303
|
-
return Math.max(...this.data[store]);
|
|
304
|
-
}
|
|
305
|
-
static avg(store) {
|
|
306
|
-
const vals = this.data[store];
|
|
307
|
-
return vals.reduce((a, b) => a + b, 0) / vals.length;
|
|
308
|
-
}
|
|
309
|
-
static summary() {
|
|
310
|
-
let {
|
|
311
|
-
includeVals
|
|
312
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
313
|
-
const agg = {};
|
|
314
|
-
for (const key of Object.keys(this.data)) {
|
|
315
|
-
agg[key] = {
|
|
316
|
-
min: this.min(key),
|
|
317
|
-
max: this.max(key),
|
|
318
|
-
avg: this.avg(key),
|
|
319
|
-
count: this.data[key].length
|
|
320
|
-
};
|
|
321
|
-
if (includeVals) agg[key].vals = this.data[key];
|
|
322
|
-
}
|
|
323
|
-
return agg;
|
|
324
|
-
}
|
|
325
|
-
static reset() {
|
|
326
|
-
this.data = {};
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
282
|
var index = /*#__PURE__*/Object.freeze({
|
|
331
283
|
__proto__: null,
|
|
332
284
|
logger: logger,
|
|
@@ -339,13 +291,9 @@
|
|
|
339
291
|
postComparison: postComparison,
|
|
340
292
|
flushSnapshots: flushSnapshots,
|
|
341
293
|
captureAutomateScreenshot: captureAutomateScreenshot,
|
|
342
|
-
TimeIt: TimeIt,
|
|
343
|
-
Undefined: Undefined,
|
|
344
294
|
'default': index
|
|
345
295
|
});
|
|
346
296
|
|
|
347
|
-
exports.TimeIt = TimeIt;
|
|
348
|
-
exports.Undefined = Undefined;
|
|
349
297
|
exports.captureAutomateScreenshot = captureAutomateScreenshot;
|
|
350
298
|
exports["default"] = index;
|
|
351
299
|
exports.fetchPercyDOM = fetchPercyDOM;
|
package/dist/index.js
CHANGED
|
@@ -3,18 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "TimeIt", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _timing.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "Undefined", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _validations.default;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
6
|
Object.defineProperty(exports, "captureAutomateScreenshot", {
|
|
19
7
|
enumerable: true,
|
|
20
8
|
get: function () {
|
|
@@ -86,8 +74,6 @@ var _postSnapshot = _interopRequireDefault(require("./post-snapshot.js"));
|
|
|
86
74
|
var _postComparison = _interopRequireDefault(require("./post-comparison.js"));
|
|
87
75
|
var _flushSnapshots = _interopRequireDefault(require("./flush-snapshots.js"));
|
|
88
76
|
var _postScreenshot = _interopRequireDefault(require("./post-screenshot.js"));
|
|
89
|
-
var _timing = _interopRequireDefault(require("./timing.js"));
|
|
90
|
-
var _validations = _interopRequireDefault(require("./validations.js"));
|
|
91
77
|
var _default = _interopRequireWildcard(require("./index.js"));
|
|
92
78
|
exports.default = _default;
|
|
93
79
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/sdk-utils",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
]
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "a6f6441483b9c092ee1de1832f53c9a774968202"
|
|
55
55
|
}
|
package/dist/timing.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _validations = require("./validations.js");
|
|
8
|
-
class TimeIt {
|
|
9
|
-
static data = {};
|
|
10
|
-
static enabled = process.env.PERCY_METRICS === 'true';
|
|
11
|
-
static async run(store, func) {
|
|
12
|
-
if (!this.enabled) return await func();
|
|
13
|
-
const t1 = Date.now();
|
|
14
|
-
try {
|
|
15
|
-
return await func();
|
|
16
|
-
} finally {
|
|
17
|
-
if ((0, _validations.Undefined)(this.data[store])) this.data[store] = [];
|
|
18
|
-
this.data[store].push(Date.now() - t1);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
static min(store) {
|
|
22
|
-
return Math.min(...this.data[store]);
|
|
23
|
-
}
|
|
24
|
-
static max(store) {
|
|
25
|
-
return Math.max(...this.data[store]);
|
|
26
|
-
}
|
|
27
|
-
static avg(store) {
|
|
28
|
-
const vals = this.data[store];
|
|
29
|
-
return vals.reduce((a, b) => a + b, 0) / vals.length;
|
|
30
|
-
}
|
|
31
|
-
static summary({
|
|
32
|
-
includeVals
|
|
33
|
-
} = {}) {
|
|
34
|
-
const agg = {};
|
|
35
|
-
for (const key of Object.keys(this.data)) {
|
|
36
|
-
agg[key] = {
|
|
37
|
-
min: this.min(key),
|
|
38
|
-
max: this.max(key),
|
|
39
|
-
avg: this.avg(key),
|
|
40
|
-
count: this.data[key].length
|
|
41
|
-
};
|
|
42
|
-
if (includeVals) agg[key].vals = this.data[key];
|
|
43
|
-
}
|
|
44
|
-
return agg;
|
|
45
|
-
}
|
|
46
|
-
static reset() {
|
|
47
|
-
this.data = {};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.default = TimeIt;
|
|
51
|
-
;
|
package/dist/validations.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Undefined = Undefined;
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
function Undefined(obj) {
|
|
9
|
-
return obj === undefined;
|
|
10
|
-
}
|
|
11
|
-
var _default = Undefined;
|
|
12
|
-
exports.default = _default;
|