@percy/core 1.27.5-beta.0 → 1.27.6-alpha.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/discovery.js CHANGED
@@ -279,7 +279,7 @@ export function createDiscoveryQueue(percy) {
279
279
  let {
280
280
  concurrency
281
281
  } = percy.config.discovery;
282
- let queue = new Queue();
282
+ let queue = new Queue('discovery');
283
283
  let cache;
284
284
  return queue.set({
285
285
  concurrency
package/dist/queue.js CHANGED
@@ -9,6 +9,7 @@ function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classEx
9
9
  function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
10
10
  function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
11
11
  import { yieldFor, generatePromise, AbortController } from './utils.js';
12
+ import logger from '@percy/logger';
12
13
 
13
14
  // Assigns a deffered promise and resolve & reject functions to an object
14
15
  function deferred(obj) {
@@ -46,12 +47,15 @@ var _end = /*#__PURE__*/new WeakMap();
46
47
  var _process = /*#__PURE__*/new WeakSet();
47
48
  var _until = /*#__PURE__*/new WeakSet();
48
49
  export class Queue {
49
- constructor() {
50
+ // item concurrency
51
+
52
+ constructor(name) {
50
53
  _classPrivateMethodInitSpec(this, _until);
51
54
  _classPrivateMethodInitSpec(this, _process);
52
55
  _classPrivateMethodInitSpec(this, _find);
53
56
  _classPrivateMethodInitSpec(this, _dequeue);
54
57
  _defineProperty(this, "concurrency", 10);
58
+ _defineProperty(this, "log", logger('core:queue'));
55
59
  _classPrivateFieldInitSpec(this, _handlers, {
56
60
  writable: true,
57
61
  value: {}
@@ -73,7 +77,9 @@ export class Queue {
73
77
  value: null
74
78
  });
75
79
  _defineProperty(this, "readyState", 0);
80
+ this.name = name;
76
81
  }
82
+
77
83
  // Configure queue properties
78
84
  set({
79
85
  concurrency
@@ -201,6 +207,7 @@ export class Queue {
201
207
  // clear and abort any queued tasks
202
208
  clear() {
203
209
  let tasks = [..._classPrivateFieldGet(this, _queued)];
210
+ this.log.debug(`Clearing ${this.name} queue, queued state: ${_classPrivateFieldGet(this, _queued).size}, pending state: ${_classPrivateFieldGet(this, _pending).size}`);
204
211
  _classPrivateFieldGet(this, _queued).clear();
205
212
  for (let task of tasks) {
206
213
  task.ctrl.abort();
@@ -235,6 +242,7 @@ export class Queue {
235
242
  // process items up to the latest queued item, starting the queue if necessary;
236
243
  // returns a generator that yields until the flushed item has finished processing
237
244
  flush(callback) {
245
+ this.log.debug(`Flushing ${this.name} queue, queued state: ${_classPrivateFieldGet(this, _queued).size}, pending state: ${_classPrivateFieldGet(this, _pending).size}`);
238
246
  let interrupt =
239
247
  // check for existing interrupts
240
248
  [..._classPrivateFieldGet(this, _pending)].find(t => t.stop) ?? [..._classPrivateFieldGet(this, _queued)].find(t => t.stop);
@@ -317,9 +325,11 @@ async function* _until2(task, callback) {
317
325
  // calculate the position within queued when not pending
318
326
  if (task && task.pending == null) queued = positionOf(_classPrivateFieldGet(this, _queued), task);
319
327
  // calculate the position within pending when not stopping
320
- if (!(task !== null && task !== void 0 && task.stop) && (task === null || task === void 0 ? void 0 : task.pending) != null) pending = positionOf(_classPrivateFieldGet(this, _pending), task);
328
+ // Commenting below line reason being currently if the task passed is found we will stop flushing
329
+ // rest of the tasks but ideally it should wait for flushing of all the tasks till the last dequeued task.
330
+ // if (!task?.stop && task?.pending != null) pending = positionOf(this.#pending, task);
321
331
  // call the callback and return true when not queued or pending
322
- let position = (queued ?? 0) + (pending ?? 0);
332
+ let position = (queued ?? 0) + pending;
323
333
  callback === null || callback === void 0 ? void 0 : callback(position);
324
334
  return !position;
325
335
  }, {
package/dist/snapshot.js CHANGED
@@ -318,7 +318,7 @@ export function createSnapshotsQueue(percy) {
318
318
  let {
319
319
  concurrency
320
320
  } = percy.config.discovery;
321
- let queue = new Queue();
321
+ let queue = new Queue('snapshot');
322
322
  let build;
323
323
  return queue.set({
324
324
  concurrency
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/core",
3
- "version": "1.27.5-beta.0",
3
+ "version": "1.27.6-alpha.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public",
12
- "tag": "latest"
12
+ "tag": "alpha"
13
13
  },
14
14
  "engines": {
15
15
  "node": ">=14"
@@ -43,11 +43,11 @@
43
43
  "test:types": "tsd"
44
44
  },
45
45
  "dependencies": {
46
- "@percy/client": "1.27.5-beta.0",
47
- "@percy/config": "1.27.5-beta.0",
48
- "@percy/dom": "1.27.5-beta.0",
49
- "@percy/logger": "1.27.5-beta.0",
50
- "@percy/webdriver-utils": "1.27.5-beta.0",
46
+ "@percy/client": "1.27.6-alpha.0",
47
+ "@percy/config": "1.27.6-alpha.0",
48
+ "@percy/dom": "1.27.6-alpha.0",
49
+ "@percy/logger": "1.27.6-alpha.0",
50
+ "@percy/webdriver-utils": "1.27.6-alpha.0",
51
51
  "content-disposition": "^0.5.4",
52
52
  "cross-spawn": "^7.0.3",
53
53
  "extract-zip": "^2.0.1",
@@ -58,5 +58,5 @@
58
58
  "rimraf": "^3.0.2",
59
59
  "ws": "^8.0.0"
60
60
  },
61
- "gitHead": "5fed59aa21112e7854a414306504ce7243df7365"
61
+ "gitHead": "415a083dc13e9453990b042a41d6676f6618df0c"
62
62
  }