@argos-ci/core 6.1.0 → 6.1.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.
Files changed (2) hide show
  1. package/dist/index.mjs +13 -3
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -1028,6 +1028,15 @@ const chunk = (collection, size) => {
1028
1028
  }
1029
1029
  return result;
1030
1030
  };
1031
+ /**
1032
+ * Map over a collection asynchronously, processing at most `size` items
1033
+ * concurrently to limit memory pressure.
1034
+ */
1035
+ async function mapInChunks(collection, size, mapper) {
1036
+ const results = [];
1037
+ for (const items of chunk(collection, size)) results.push(...await Promise.all(items.map(mapper)));
1038
+ return results;
1039
+ }
1031
1040
  //#endregion
1032
1041
  //#region src/github-actions-oidc.ts
1033
1042
  /**
@@ -1370,7 +1379,8 @@ async function skip(params) {
1370
1379
  //#endregion
1371
1380
  //#region src/upload.ts
1372
1381
  /**
1373
- * Size of the chunks used to upload screenshots to Argos.
1382
+ * Size of the chunks used to process and upload screenshots.
1383
+ * Limits concurrency to avoid memory pressure when handling many screenshots.
1374
1384
  */
1375
1385
  const CHUNK_SIZE = 10;
1376
1386
  const PLAYWRIGHT_TRACE_CONTENT_TYPE = "application/zip";
@@ -1400,7 +1410,7 @@ async function upload(params) {
1400
1410
  ignore: params.ignore
1401
1411
  });
1402
1412
  debug("Found snapshots", files);
1403
- const snapshots = await Promise.all(files.map(async (snapshot) => {
1413
+ const snapshots = await mapInChunks(files, CHUNK_SIZE, async (snapshot) => {
1404
1414
  const contentType = getSnapshotMimeType(snapshot.path);
1405
1415
  const [metadata, pwTracePath, optimizedPath] = await Promise.all([
1406
1416
  readMetadata(snapshot.path),
@@ -1429,7 +1439,7 @@ async function upload(params) {
1429
1439
  } : null,
1430
1440
  contentType
1431
1441
  };
1432
- }));
1442
+ });
1433
1443
  debug("Fetch project");
1434
1444
  const projectResponse = await apiClient.GET("/project");
1435
1445
  if (projectResponse.error) throwAPIError(projectResponse.error);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@argos-ci/core",
3
3
  "description": "Node.js SDK for visual testing with Argos.",
4
- "version": "6.1.0",
4
+ "version": "6.1.1",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -67,5 +67,5 @@
67
67
  "lint": "eslint .",
68
68
  "test": "vitest"
69
69
  },
70
- "gitHead": "4d890d5091bd313c327eb4e8c17dc1bee9d48578"
70
+ "gitHead": "ee8cfb3ab17cb541f8c3456a271d32c3411077c6"
71
71
  }