ccqa 1.42.0 → 1.42.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.
package/dist/bin/ccqa.mjs CHANGED
@@ -6353,6 +6353,14 @@ function resolveCovered(prepared, ranges) {
6353
6353
  const VENDOR = /(^|\/)node_modules\//;
6354
6354
  /** `(rsc)`, `(pages-dir-browser)`, ... — which build layer, not part of the path. */
6355
6355
  const LAYER = /^\([^)]*\)\//;
6356
+ /**
6357
+ * What follows `[project]/` is relative to the build's project root, not to
6358
+ * where the build ran. Only this one root is stripped: Turbopack's others
6359
+ * (`[output]`, `[externals]`) name generated code, not files on disk.
6360
+ */
6361
+ const TURBOPACK_PROJECT = /^\[project\]\//;
6362
+ /** The ` [layer] (ecmascript)` suffix Turbopack appends when it names a module. */
6363
+ const MODULE_IDENTIFIER = / \[[^\]]*\]/;
6356
6364
  const DEPENDENCY = { kind: "dependency" };
6357
6365
  const UNRESOLVED = { kind: "unresolved" };
6358
6366
  /** `absolute` as a posix path under `root`, or undefined when it is not under it. */
@@ -6371,9 +6379,12 @@ function normalizeSourcePath(raw, roots) {
6371
6379
  path = slash < 0 ? afterScheme : afterScheme.slice(from);
6372
6380
  }
6373
6381
  path = posix.normalize(path.replace(LAYER, ""));
6382
+ const rooted = TURBOPACK_PROJECT.test(path);
6383
+ if (rooted) path = path.replace(TURBOPACK_PROJECT, "");
6374
6384
  if (path === "" || path === ".") return UNRESOLVED;
6375
6385
  if (path.startsWith("<") || path.startsWith("[")) return UNRESOLVED;
6376
- const absolute = path.startsWith("/") ? path : resolve(roots.base, path);
6386
+ if (rooted && MODULE_IDENTIFIER.test(path)) return UNRESOLVED;
6387
+ const absolute = path.startsWith("/") ? path : resolve(rooted ? roots.root : roots.base, path);
6377
6388
  const rel = toProjectRelative(roots.root, absolute);
6378
6389
  if (rel === void 0) return UNRESOLVED;
6379
6390
  return VENDOR.test(rel) ? DEPENDENCY : {
@@ -6575,18 +6586,14 @@ var FrontendResolution = class {
6575
6586
  * nearly all of them misses on a deployment that pushes nothing.
6576
6587
  */
6577
6588
  sourceMapLoaders(script, source) {
6578
- const loaders = [];
6579
6589
  const reference = readSourceMappingUrl(source);
6580
- if (reference !== void 0) {
6581
- const inline = decodeInlineSourceMap(reference);
6582
- if (inline !== void 0) loaders.push(() => Promise.resolve(inline));
6583
- else {
6584
- const target = absoluteOrUndefined(reference, script.url);
6585
- if (target !== void 0) loaders.push(() => this.fetchText(target));
6586
- }
6587
- }
6590
+ const inline = reference === void 0 ? void 0 : decodeInlineSourceMap(reference);
6591
+ const mapUrl = reference !== void 0 && inline === void 0 ? absoluteOrUndefined(reference, script.url) : void 0;
6592
+ const loaders = [];
6593
+ if (inline !== void 0) loaders.push(() => Promise.resolve(inline));
6594
+ if (mapUrl !== void 0) loaders.push(() => this.fetchText(mapUrl));
6588
6595
  const stored = this.fetchStoredMap;
6589
- if (stored !== void 0) loaders.push(() => stored(script.url));
6596
+ if (stored !== void 0) loaders.push(() => stored(mapUrl ?? script.url, script.url));
6590
6597
  return loaders;
6591
6598
  }
6592
6599
  };
@@ -7191,7 +7198,7 @@ var Engine = class {
7191
7198
  coverageDir: opts.coverageDir,
7192
7199
  roots: opts.roots,
7193
7200
  fetchText: (url) => this.fetchThroughBrowser(url),
7194
- fetchStoredMap: (scriptUrl) => this.storedMapFor(scriptUrl),
7201
+ fetchStoredMap: (mapUrl, scriptUrl) => this.storedMapFor(mapUrl, scriptUrl),
7195
7202
  warn: opts.warn
7196
7203
  });
7197
7204
  }
@@ -7458,19 +7465,24 @@ var Engine = class {
7458
7465
  }
7459
7466
  }
7460
7467
  /**
7461
- * The map a deploy stored for `scriptUrl`, if this run knows where to ask.
7468
+ * The map a deploy stored for a script, if this run knows where to ask.
7462
7469
  * Addressed by the path under the asset origin rather than the URL, so the
7463
7470
  * push and the read agree without either knowing the other's host.
7471
+ *
7472
+ * The script's pointer names the map, but it may name it somewhere this run
7473
+ * never declared — a map-only host. Guessing from the script is worse than
7474
+ * the pointer and better than not asking, so it stays as the fallback.
7464
7475
  */
7465
- async storedMapFor(scriptUrl) {
7476
+ async storedMapFor(mapUrl, scriptUrl) {
7466
7477
  const stored = this.opts.fetchStoredSourceMap;
7467
7478
  if (stored === void 0) return void 0;
7468
- const assetPath = assetPathOf(scriptUrl, [...this.opts.origins, ...this.opts.assetOrigins ?? []]);
7469
- if (assetPath === void 0) return void 0;
7479
+ const origins = [...this.opts.origins, ...this.opts.assetOrigins ?? []];
7480
+ const key = storeKeyOf(mapUrl, origins) ?? storeKeyOf(scriptUrl, origins);
7481
+ if (key === void 0) return void 0;
7470
7482
  try {
7471
- return await stored(`${assetPath}.map`);
7483
+ return await stored(key);
7472
7484
  } catch (err) {
7473
- this.opts.warn(`could not read the stored source map for ${assetPath}: ${message(err)}`);
7485
+ this.opts.warn(`could not read the stored source map for ${key}: ${message(err)}`);
7474
7486
  return;
7475
7487
  }
7476
7488
  }
@@ -7494,6 +7506,16 @@ function message(error) {
7494
7506
  * is part of what the browser asked for, so the push has to have used it too.
7495
7507
  * A URL from an origin the run never declared is not ours to look up.
7496
7508
  */
7509
+ /**
7510
+ * The key a stored map is read by: the asset path, with `.map` appended only
7511
+ * when it is missing. A push files each map under its own path, so a URL that
7512
+ * already names a map needs no suffix; only a script URL has to guess one.
7513
+ */
7514
+ function storeKeyOf(url, origins) {
7515
+ const assetPath = assetPathOf(url, origins);
7516
+ if (assetPath === void 0) return void 0;
7517
+ return assetPath.endsWith(".map") ? assetPath : `${assetPath}.map`;
7518
+ }
7497
7519
  function assetPathOf(url, origins) {
7498
7520
  let parsed;
7499
7521
  try {
@@ -15704,7 +15726,7 @@ const CONFIG_NAMES = [
15704
15726
  "playwright.config.cjs"
15705
15727
  ];
15706
15728
  async function acquirePlaywrightBrowser(ctx) {
15707
- await sweepStaleWrappers(ctx.cwd);
15729
+ await sweepStaleWrappersOnce(ctx.cwd);
15708
15730
  const chromium = await resolveChromium(ctx.cwd);
15709
15731
  const port = await freePort();
15710
15732
  const server = await chromium.launchServer({ args: [`--remote-debugging-port=${port}`] });
@@ -15735,9 +15757,26 @@ async function acquirePlaywrightBrowser(ctx) {
15735
15757
  };
15736
15758
  }
15737
15759
  /**
15738
- * Wrappers a killed earlier run left behind. Deleted on the next acquire, not
15739
- * only guarded against: a stray one is git-status dirt in somebody's repo.
15760
+ * Wrappers a killed earlier run left behind. Deleted before this process
15761
+ * writes its first one, not only guarded against: a stray one is git-status
15762
+ * dirt in somebody's repo.
15763
+ *
15764
+ * Once per cwd per process, never per acquire: every live wrapper matches
15765
+ * the stale pattern, so under `--concurrency` a per-acquire sweep deletes
15766
+ * the wrapper a parallel spec just wrote and is about to hand to
15767
+ * `playwright test`, killing that spec before it starts. The memo makes
15768
+ * concurrent first acquires share one sweep that finished before either of
15769
+ * them wrote anything.
15740
15770
  */
15771
+ const sweptCwds = /* @__PURE__ */ new Map();
15772
+ function sweepStaleWrappersOnce(cwd) {
15773
+ let sweep = sweptCwds.get(cwd);
15774
+ if (!sweep) {
15775
+ sweep = sweepStaleWrappers(cwd);
15776
+ sweptCwds.set(cwd, sweep);
15777
+ }
15778
+ return sweep;
15779
+ }
15741
15780
  async function sweepStaleWrappers(cwd) {
15742
15781
  const entries = await readdir(cwd).catch(() => []);
15743
15782
  for (const name of entries) if (name.startsWith("ccqa-coverage.") && name.endsWith(".playwright.config.ts")) await unlink(join(cwd, name)).catch(() => void 0);
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccqa",
3
- "version": "1.42.0",
3
+ "version": "1.42.2",
4
4
  "type": "module",
5
5
  "description": "Browser test recorder powered by Claude Code and agent-browser",
6
6
  "repository": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccqa",
3
- "version": "1.42.0",
3
+ "version": "1.42.2",
4
4
  "type": "module",
5
5
  "description": "Browser test recorder powered by Claude Code and agent-browser",
6
6
  "repository": {