styleproof 4.4.7 → 4.4.8

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/CHANGELOG.md CHANGED
@@ -7,6 +7,21 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [4.4.8] - 2026-07-13
11
+
12
+ ### Fixed
13
+
14
+ - **Map-store restore now retrieves only the requested commit bundle.** Restore
15
+ clones branch metadata without a checkout, sparsely selects the requested SHA,
16
+ and, on partial-clone-capable remotes such as GitHub, downloads only that
17
+ bundle's blobs. Large long-lived map stores therefore no longer make every
18
+ cache lookup clone all historical bundles on supported remotes. Publishing
19
+ uses the same sparse checkout and stages only the requested bundle plus the
20
+ store README; Git's sparse index preserves unseen bundles without downloading
21
+ their blobs, so cache misses no longer materialise the complete store either.
22
+
23
+ ## [4.4.7] - 2026-07-13
24
+
10
25
  ### Fixed
11
26
 
12
27
  - **Generated CI authenticates map publication explicitly.** `styleproof-init`
@@ -19,6 +34,11 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
19
34
  directly in `.git/config`; StyleProof now explicitly enables Git config includes
20
35
  and falls back to its locally registered checkout config before carrying that
21
36
  header into the isolated clone and push.
37
+ - **Map-store uploads now reuse credentials from `actions/checkout@v7`.**
38
+ Checkout v7 keeps its HTTP header in an included temporary config rather than
39
+ directly in `.git/config`; StyleProof now explicitly enables Git config includes
40
+ and falls back to its locally registered checkout config before carrying that
41
+ header into the isolated clone and push.
22
42
  - **Map-store uploads now reuse the HTTP authentication persisted by
23
43
  `actions/checkout`.** The isolated `styleproof-maps` clone carries the
24
44
  checkout's URL-scoped extra header through clone and push, so cache-miss
package/dist/map-store.js CHANGED
@@ -435,15 +435,27 @@ function copyDir(src, dest, includeHar) {
435
435
  filter: (source) => includeHar || !source.endsWith('.har'),
436
436
  });
437
437
  }
438
- function checkoutMapStore(cwd, remote, branch) {
438
+ function checkoutSparseSegment(tmp, branch, segment) {
439
+ const sparseCheckout = runGit(tmp, ['sparse-checkout', 'set', segment], 1 << 20);
440
+ const checkout = sparseCheckout.status === 0 ? runGit(tmp, ['checkout', '-q', branch], 1 << 20) : sparseCheckout;
441
+ if (checkout.status !== 0) {
442
+ fs.rmSync(tmp, { recursive: true, force: true });
443
+ throw new MapStoreError(checkout.stderr.trim() || `could not check out ${segment} from map store`);
444
+ }
445
+ }
446
+ function checkoutMapStore(cwd, remote, branch, sparseSegment) {
439
447
  if (!remoteExists(remote, cwd))
440
448
  throw new MapStoreError(`git remote ${remote} was not found`);
441
449
  const remoteUrl = gitOutput(cwd, ['remote', 'get-url', remote]);
442
450
  const httpExtraHeaders = effectiveGitHttpExtraHeaders(cwd);
443
451
  const authenticationArguments = httpExtraHeaders.flatMap(({ key, value }) => ['-c', `${key}=${value}`]);
444
452
  const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'styleproof-map-store-'));
445
- if (runGit(cwd, ['ls-remote', '--exit-code', '--heads', remote, branch], 1 << 20).status === 0) {
446
- const clone = spawnSync('git', [...authenticationArguments, 'clone', '-q', '--depth', '1', '--branch', branch, remoteUrl, tmp], {
453
+ const branchExists = runGit(cwd, ['ls-remote', '--exit-code', '--heads', remote, branch], 1 << 20).status === 0;
454
+ if (branchExists) {
455
+ const cloneArguments = sparseSegment
456
+ ? ['clone', '-q', '--filter=blob:none', '--no-checkout', '--depth', '1', '--single-branch', '--branch', branch]
457
+ : ['clone', '-q', '--depth', '1', '--branch', branch];
458
+ const clone = spawnSync('git', [...authenticationArguments, ...cloneArguments, remoteUrl, tmp], {
447
459
  encoding: 'utf8',
448
460
  maxBuffer: 1 << 20,
449
461
  env: gitProcessEnvironment(),
@@ -459,6 +471,8 @@ function checkoutMapStore(cwd, remote, branch) {
459
471
  }
460
472
  for (const { key, value } of httpExtraHeaders)
461
473
  runGit(tmp, ['config', '--local', key, value]);
474
+ if (sparseSegment && branchExists)
475
+ checkoutSparseSegment(tmp, branch, sparseSegment);
462
476
  return tmp;
463
477
  }
464
478
  export function publishMapBundle(options) {
@@ -479,7 +493,7 @@ export function publishMapBundle(options) {
479
493
  let ok = false;
480
494
  let lastError = '';
481
495
  for (let attempt = 1; attempt <= 5; attempt++) {
482
- const tmp = checkoutMapStore(cwd, remote, branch);
496
+ const tmp = checkoutMapStore(cwd, remote, branch, sha);
483
497
  try {
484
498
  runGit(tmp, ['config', 'user.name', 'github-actions[bot]']);
485
499
  runGit(tmp, ['config', 'user.email', '41898282+github-actions[bot]@users.noreply.github.com']);
@@ -489,7 +503,7 @@ export function publishMapBundle(options) {
489
503
  if (!options.includeHar) {
490
504
  fs.writeFileSync(path.join(tmp, target, MAP_MANIFEST), JSON.stringify({ ...manifest, har: false }, null, 2));
491
505
  }
492
- runGit(tmp, ['add', '-A']);
506
+ runGit(tmp, ['add', '-A', '--sparse', '--', 'README.md', target]);
493
507
  runGit(tmp, ['commit', '-q', '-m', `StyleProof map ${sha.slice(0, 12)} ${compatibilityKey}`], 1 << 20);
494
508
  const push = runGit(tmp, ['push', '-q', 'origin', `HEAD:${branch}`], 1 << 20);
495
509
  if (push.status === 0) {
@@ -520,7 +534,7 @@ export function restoreMapBundle(options) {
520
534
  if (runGit(cwd, ['ls-remote', '--exit-code', '--heads', remote, branch], 1 << 20).status !== 0) {
521
535
  throw new MapStoreError(`map store branch ${branch} does not exist`);
522
536
  }
523
- const tmp = checkoutMapStore(cwd, remote, branch);
537
+ const tmp = checkoutMapStore(cwd, remote, branch, sha);
524
538
  try {
525
539
  const shaDir = path.join(tmp, sha);
526
540
  if (!fs.existsSync(shaDir))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "styleproof",
3
- "version": "4.4.7",
3
+ "version": "4.4.8",
4
4
  "description": "Catch every CSS change before it ships — review PRs and certify refactors by the browser's computed styles, not pixels. Works with any styling system.",
5
5
  "keywords": [
6
6
  "playwright",