@percy/core 1.7.1 → 1.8.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/utils.js CHANGED
@@ -108,15 +108,19 @@ export class AbortError extends Error {
108
108
  } // An async generator that yields after every event loop until the promise settles
109
109
 
110
110
  export async function* yieldTo(subject) {
111
- var _subject;
111
+ // yield to any provided generator or return non-promise values
112
+ if (isGenerator(subject)) return yield* subject;
113
+ if (typeof (subject === null || subject === void 0 ? void 0 : subject.then) !== 'function') return subject; // update local variables with the provided promise
112
114
 
113
- let pending = typeof ((_subject = subject) === null || _subject === void 0 ? void 0 : _subject.finally) === 'function';
114
- if (pending) subject = subject.finally(() => pending = false);
115
+ let result,
116
+ error,
117
+ pending = !!subject.then(r => result = r, e => error = e).finally(() => pending = false);
115
118
  /* eslint-disable-next-line no-unmodified-loop-condition */
116
119
 
117
120
  while (pending) yield new Promise(r => setImmediate(r));
118
121
 
119
- return isGenerator(subject) ? yield* subject : await subject;
122
+ if (error) throw error;
123
+ return result;
120
124
  } // An async generator that runs provided generators concurrently
121
125
 
122
126
  export async function* yieldAll(all) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/core",
3
- "version": "1.7.1",
3
+ "version": "1.8.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -39,10 +39,10 @@
39
39
  "test:types": "tsd"
40
40
  },
41
41
  "dependencies": {
42
- "@percy/client": "1.7.1",
43
- "@percy/config": "1.7.1",
44
- "@percy/dom": "1.7.1",
45
- "@percy/logger": "1.7.1",
42
+ "@percy/client": "1.8.1",
43
+ "@percy/config": "1.8.1",
44
+ "@percy/dom": "1.8.1",
45
+ "@percy/logger": "1.8.1",
46
46
  "content-disposition": "^0.5.4",
47
47
  "cross-spawn": "^7.0.3",
48
48
  "extract-zip": "^2.0.1",
@@ -53,5 +53,5 @@
53
53
  "rimraf": "^3.0.2",
54
54
  "ws": "^8.0.0"
55
55
  },
56
- "gitHead": "012892cdaf7a07aa1b5aa355017639cee0e8a19e"
56
+ "gitHead": "497772c62e2fa2d763b350c40a0cfec918f7125f"
57
57
  }
package/types/index.d.ts CHANGED
@@ -38,6 +38,8 @@ interface CommonSnapshotOptions {
38
38
  minHeight?: number;
39
39
  percyCSS?: string;
40
40
  enableJavaScript?: boolean;
41
+ devicePixelRatio?: number;
42
+ scope?: string;
41
43
  }
42
44
 
43
45
  export interface SnapshotOptions extends CommonSnapshotOptions {