@percy/sdk-utils 1.10.4 → 1.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.
- package/dist/bundle.js +32 -1
- package/dist/flush-snapshots.js +28 -0
- package/dist/index.js +16 -0
- package/dist/post-comparison.js +31 -0
- package/dist/post-snapshot.js +2 -2
- package/package.json +2 -2
package/dist/bundle.js
CHANGED
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
return info.domScript;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
//
|
|
226
|
+
// indicate that Percy has been disabled.
|
|
227
227
|
|
|
228
228
|
async function postSnapshot(options, params) {
|
|
229
229
|
let query = params ? `?${new URLSearchParams(params)}` : '';
|
|
@@ -238,6 +238,33 @@
|
|
|
238
238
|
});
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
+
// indicate that Percy has been disabled.
|
|
242
|
+
|
|
243
|
+
async function postComparison(options, params) {
|
|
244
|
+
let query = params ? `?${new URLSearchParams(params)}` : '';
|
|
245
|
+
await request.post(`/percy/comparison${query}`, options).catch(err => {
|
|
246
|
+
var _err$response, _err$response$body, _err$response$body$bu;
|
|
247
|
+
|
|
248
|
+
if ((_err$response = err.response) !== null && _err$response !== void 0 && (_err$response$body = _err$response.body) !== null && _err$response$body !== void 0 && (_err$response$body$bu = _err$response$body.build) !== null && _err$response$body$bu !== void 0 && _err$response$body$bu.error) {
|
|
249
|
+
info.enabled = false;
|
|
250
|
+
} else {
|
|
251
|
+
throw err;
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// will be flushed. Does nothing when Percy is not enabled.
|
|
257
|
+
|
|
258
|
+
async function flushSnapshots(options) {
|
|
259
|
+
if (info.enabled) {
|
|
260
|
+
// accept one or more snapshot names
|
|
261
|
+
options && (options = [].concat(options).map(o => typeof o === 'string' ? {
|
|
262
|
+
name: o
|
|
263
|
+
} : o));
|
|
264
|
+
await request.post('/percy/flush', options);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
241
268
|
var index = /*#__PURE__*/Object.freeze({
|
|
242
269
|
__proto__: null,
|
|
243
270
|
logger: logger,
|
|
@@ -247,14 +274,18 @@
|
|
|
247
274
|
waitForPercyIdle: waitForPercyIdle,
|
|
248
275
|
fetchPercyDOM: fetchPercyDOM,
|
|
249
276
|
postSnapshot: postSnapshot,
|
|
277
|
+
postComparison: postComparison,
|
|
278
|
+
flushSnapshots: flushSnapshots,
|
|
250
279
|
'default': index
|
|
251
280
|
});
|
|
252
281
|
|
|
253
282
|
exports["default"] = index;
|
|
254
283
|
exports.fetchPercyDOM = fetchPercyDOM;
|
|
284
|
+
exports.flushSnapshots = flushSnapshots;
|
|
255
285
|
exports.isPercyEnabled = isPercyEnabled;
|
|
256
286
|
exports.logger = logger;
|
|
257
287
|
exports.percy = info;
|
|
288
|
+
exports.postComparison = postComparison;
|
|
258
289
|
exports.postSnapshot = postSnapshot;
|
|
259
290
|
exports.request = request;
|
|
260
291
|
exports.waitForPercyIdle = waitForPercyIdle;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
exports.flushSnapshots = flushSnapshots;
|
|
8
|
+
|
|
9
|
+
var _percyInfo = _interopRequireDefault(require("./percy-info.js"));
|
|
10
|
+
|
|
11
|
+
var _request = _interopRequireDefault(require("./request.js"));
|
|
12
|
+
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
|
|
15
|
+
// Posts to the local Percy server one or more snapshots to flush. Given no arguments, all snapshots
|
|
16
|
+
// will be flushed. Does nothing when Percy is not enabled.
|
|
17
|
+
async function flushSnapshots(options) {
|
|
18
|
+
if (_percyInfo.default.enabled) {
|
|
19
|
+
// accept one or more snapshot names
|
|
20
|
+
options && (options = [].concat(options).map(o => typeof o === 'string' ? {
|
|
21
|
+
name: o
|
|
22
|
+
} : o));
|
|
23
|
+
await _request.default.post('/percy/flush', options);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var _default = flushSnapshots;
|
|
28
|
+
exports.default = _default;
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,12 @@ Object.defineProperty(exports, "fetchPercyDOM", {
|
|
|
10
10
|
return _percyDom.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
+
Object.defineProperty(exports, "flushSnapshots", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _flushSnapshots.default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
13
19
|
Object.defineProperty(exports, "isPercyEnabled", {
|
|
14
20
|
enumerable: true,
|
|
15
21
|
get: function () {
|
|
@@ -28,6 +34,12 @@ Object.defineProperty(exports, "percy", {
|
|
|
28
34
|
return _percyInfo.default;
|
|
29
35
|
}
|
|
30
36
|
});
|
|
37
|
+
Object.defineProperty(exports, "postComparison", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return _postComparison.default;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
31
43
|
Object.defineProperty(exports, "postSnapshot", {
|
|
32
44
|
enumerable: true,
|
|
33
45
|
get: function () {
|
|
@@ -61,6 +73,10 @@ var _percyDom = _interopRequireDefault(require("./percy-dom.js"));
|
|
|
61
73
|
|
|
62
74
|
var _postSnapshot = _interopRequireDefault(require("./post-snapshot.js"));
|
|
63
75
|
|
|
76
|
+
var _postComparison = _interopRequireDefault(require("./post-comparison.js"));
|
|
77
|
+
|
|
78
|
+
var _flushSnapshots = _interopRequireDefault(require("./flush-snapshots.js"));
|
|
79
|
+
|
|
64
80
|
var _default = _interopRequireWildcard(require("./index.js"));
|
|
65
81
|
|
|
66
82
|
exports.default = _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
exports.postComparison = postComparison;
|
|
8
|
+
|
|
9
|
+
var _percyInfo = _interopRequireDefault(require("./percy-info.js"));
|
|
10
|
+
|
|
11
|
+
var _request = _interopRequireDefault(require("./request.js"));
|
|
12
|
+
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
|
|
15
|
+
// Post snapshot data to the CLI snapshot endpoint. If the endpoint responds with a build error,
|
|
16
|
+
// indicate that Percy has been disabled.
|
|
17
|
+
async function postComparison(options, params) {
|
|
18
|
+
let query = params ? `?${new URLSearchParams(params)}` : '';
|
|
19
|
+
await _request.default.post(`/percy/comparison${query}`, options).catch(err => {
|
|
20
|
+
var _err$response, _err$response$body, _err$response$body$bu;
|
|
21
|
+
|
|
22
|
+
if ((_err$response = err.response) !== null && _err$response !== void 0 && (_err$response$body = _err$response.body) !== null && _err$response$body !== void 0 && (_err$response$body$bu = _err$response$body.build) !== null && _err$response$body$bu !== void 0 && _err$response$body$bu.error) {
|
|
23
|
+
_percyInfo.default.enabled = false;
|
|
24
|
+
} else {
|
|
25
|
+
throw err;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var _default = postComparison;
|
|
31
|
+
exports.default = _default;
|
package/dist/post-snapshot.js
CHANGED
|
@@ -12,8 +12,8 @@ var _request = _interopRequireDefault(require("./request.js"));
|
|
|
12
12
|
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
|
|
15
|
-
// Post snapshot data to the snapshot endpoint. If the
|
|
16
|
-
//
|
|
15
|
+
// Post snapshot data to the CLI snapshot endpoint. If the endpoint responds with a build error,
|
|
16
|
+
// indicate that Percy has been disabled.
|
|
17
17
|
async function postSnapshot(options, params) {
|
|
18
18
|
let query = params ? `?${new URLSearchParams(params)}` : '';
|
|
19
19
|
await _request.default.post(`/percy/snapshot${query}`, options).catch(err => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/sdk-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
]
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "4303b74df91f60e36065141289d2ef2277d1d6fc"
|
|
54
54
|
}
|