@percy/core 1.6.1 → 1.6.2

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.
Files changed (2) hide show
  1. package/dist/percy.js +16 -4
  2. package/package.json +6 -6
package/dist/percy.js CHANGED
@@ -25,7 +25,9 @@ export class Percy {
25
25
  constructor({
26
26
  // initial log level
27
27
  loglevel,
28
- // do not eagerly upload snapshots
28
+ // process uploads before the next snapshot
29
+ delayUploads,
30
+ // process uploads after all snapshots
29
31
  deferUploads,
30
32
  // run without uploading anything
31
33
  skipUploads,
@@ -51,7 +53,8 @@ export class Percy {
51
53
  this.testing = testing ? {} : null;
52
54
  this.dryRun = !!testing || !!dryRun;
53
55
  this.skipUploads = this.dryRun || !!skipUploads;
54
- this.deferUploads = this.skipUploads || !!deferUploads;
56
+ this.delayUploads = this.skipUploads || !!delayUploads;
57
+ this.deferUploads = this.delayUploads || !!deferUploads;
55
58
  if (this.deferUploads) this.#uploads.stop();
56
59
  this.config = PercyConfig.load({
57
60
  overrides: options,
@@ -66,6 +69,10 @@ export class Percy {
66
69
  this.#snapshots.concurrency = concurrency;
67
70
  }
68
71
 
72
+ if (this.delayUploads) {
73
+ this.#uploads.concurrency = 1;
74
+ }
75
+
69
76
  this.client = new PercyClient({
70
77
  token,
71
78
  clientInfo,
@@ -166,7 +173,7 @@ export class Percy {
166
173
  };
167
174
  this.build.number = attributes['build-number'];
168
175
  this.build.url = attributes['web-url'];
169
- this.#uploads.run();
176
+ if (!this.delayUploads) this.#uploads.run();
170
177
  });
171
178
  }, 0); // handle deferred build errors
172
179
 
@@ -451,9 +458,14 @@ export class Percy {
451
458
 
452
459
  if ((_this$build4 = this.build) !== null && _this$build4 !== void 0 && _this$build4.error) {
453
460
  throw new Error(this.build.error);
454
- }
461
+ } // when not dry-running, process any existing delayed uploads
455
462
 
463
+
464
+ if (!this.dryRun && this.delayUploads) this.#uploads.run();
456
465
  return this.#uploads.push(`upload/${name}`, async () => {
466
+ // when delayed, stop the queue before other uploads are processed
467
+ if (this.delayUploads) this.#uploads.stop();
468
+
457
469
  try {
458
470
  /* istanbul ignore if: useful for other internal packages */
459
471
  if (typeof options === 'function') options = await options();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/core",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
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.6.1",
43
- "@percy/config": "1.6.1",
44
- "@percy/dom": "1.6.1",
45
- "@percy/logger": "1.6.1",
42
+ "@percy/client": "1.6.2",
43
+ "@percy/config": "1.6.2",
44
+ "@percy/dom": "1.6.2",
45
+ "@percy/logger": "1.6.2",
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": "87e8afc35605110fa7c7bde2100be18e6e74826b"
56
+ "gitHead": "c033d52167cdd5873027d9de2676f3fc9f55ef2d"
57
57
  }