@percy/core 1.6.4 → 1.7.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.
Files changed (2) hide show
  1. package/dist/percy.js +11 -11
  2. package/package.json +6 -6
package/dist/percy.js CHANGED
@@ -69,10 +69,6 @@ export class Percy {
69
69
  this.#snapshots.concurrency = concurrency;
70
70
  }
71
71
 
72
- if (this.delayUploads) {
73
- this.#uploads.concurrency = 1;
74
- }
75
-
76
72
  this.client = new PercyClient({
77
73
  token,
78
74
  clientInfo,
@@ -162,17 +158,20 @@ export class Percy {
162
158
  let buildTask = this.#uploads.push('build/create', () => {
163
159
  // pause other queued tasks until after the build is created
164
160
  this.#uploads.stop();
161
+ this.build = {};
165
162
  return this.client.createBuild().then(({
166
163
  data: {
167
164
  id,
168
165
  attributes
169
166
  }
170
167
  }) => {
171
- this.build = {
172
- id
173
- };
174
- this.build.number = attributes['build-number'];
175
- this.build.url = attributes['web-url'];
168
+ let url = attributes['web-url'];
169
+ let number = attributes['build-number'];
170
+ Object.assign(this.build, {
171
+ id,
172
+ url,
173
+ number
174
+ });
176
175
  if (!this.delayUploads) this.#uploads.run();
177
176
  });
178
177
  }, 0); // handle deferred build errors
@@ -246,6 +245,7 @@ export class Percy {
246
245
  if (close) this.#uploads.close(); // prevent creating an empty build when deferred
247
246
 
248
247
  if (!this.deferUploads || !this.#uploads.has('build/create') || this.#uploads.size > 1) {
248
+ if (this.build && !this.build.id) yield* this.#uploads.idle();
249
249
  yield* this.#uploads.flush(s => {
250
250
  // do not log a count when not closing or while creating a build
251
251
  if (!close || this.#uploads.has('build/create')) return;
@@ -458,10 +458,10 @@ export class Percy {
458
458
 
459
459
  if ((_this$build4 = this.build) !== null && _this$build4 !== void 0 && _this$build4.error) throw new Error(this.build.error); // maybe process any existing delayed uploads
460
460
 
461
- if (!this.skipUploads && this.delayUploads) this.#uploads.run();
461
+ if (!this.skipUploads && this.delayUploads && (!this.build || this.build.id)) this.#uploads.run();
462
462
  return this.#uploads.push(`upload/${name}`, async () => {
463
463
  // when delayed, stop the queue before other uploads are processed
464
- if (this.delayUploads) this.#uploads.stop();
464
+ if (this.readyState < 2 && this.delayUploads) this.#uploads.stop();
465
465
 
466
466
  try {
467
467
  /* istanbul ignore if: useful for other internal packages */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/core",
3
- "version": "1.6.4",
3
+ "version": "1.7.0",
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.4",
43
- "@percy/config": "1.6.4",
44
- "@percy/dom": "1.6.4",
45
- "@percy/logger": "1.6.4",
42
+ "@percy/client": "1.7.0",
43
+ "@percy/config": "1.7.0",
44
+ "@percy/dom": "1.7.0",
45
+ "@percy/logger": "1.7.0",
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": "651c0fad62f128053723f9b8d565c69496dc51e4"
56
+ "gitHead": "f1418fb1effdaad2d32c65d1a358282ab1f9ec32"
57
57
  }