styleproof 4.4.1 → 4.4.3

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,19 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Fixed
11
+
12
+ - **Map-store uploads now reuse the HTTP authentication persisted by
13
+ `actions/checkout`.** The isolated `styleproof-maps` clone carries the
14
+ checkout's URL-scoped extra header through clone and push, so cache-miss
15
+ captures publish successfully without every consumer wiring a token into the
16
+ CLI step.
17
+ - **Map-store uploads from Git hooks no longer inherit the caller repository's
18
+ Git location variables.** A cold `styleproof-maps` upload could otherwise run
19
+ its temporary `git init` against the consumer repository, set
20
+ `core.bare=true`, and reject the push after a successful capture. StyleProof
21
+ now isolates every child Git process from hook-exported repository paths.
22
+
10
23
  ## [4.4.1] - 2026-07-13
11
24
 
12
25
  ### Changed
package/dist/map-store.js CHANGED
@@ -16,6 +16,19 @@ export const MAP_MANIFEST = 'styleproof-manifest.json';
16
16
  * has exited — no browser — so it reads the build back from here. Not a surface map. */
17
17
  export const BROWSER_BUILD_SIDECAR = 'styleproof-browser.json';
18
18
  const GENERATED_DIRTY_ALLOWLIST = new Set(['next-env.d.ts']);
19
+ const GIT_REPOSITORY_ENVIRONMENT_VARIABLES = [
20
+ 'GIT_ALTERNATE_OBJECT_DIRECTORIES',
21
+ 'GIT_COMMON_DIR',
22
+ 'GIT_DIR',
23
+ 'GIT_GRAFT_FILE',
24
+ 'GIT_INDEX_FILE',
25
+ 'GIT_INTERNAL_SUPER_PREFIX',
26
+ 'GIT_OBJECT_DIRECTORY',
27
+ 'GIT_PREFIX',
28
+ 'GIT_REPLACE_REF_BASE',
29
+ 'GIT_SHALLOW_FILE',
30
+ 'GIT_WORK_TREE',
31
+ ];
19
32
  /** Bundle files that sit alongside the maps but are NOT surfaces (manifest, coverage
20
33
  * ledger, and any future sidecar). Every place that enumerates surface maps must skip
21
34
  * these, or a sidecar reads as a phantom "new surface". */
@@ -30,8 +43,33 @@ export function isMapFile(name) {
30
43
  }
31
44
  export class MapStoreError extends Error {
32
45
  }
46
+ function gitProcessEnvironment() {
47
+ const environment = { ...process.env };
48
+ for (const variableName of GIT_REPOSITORY_ENVIRONMENT_VARIABLES)
49
+ delete environment[variableName];
50
+ return environment;
51
+ }
33
52
  function runGit(cwd, args, maxBuffer = 1 << 28) {
34
- return spawnSync('git', args, { cwd, encoding: 'utf8', maxBuffer });
53
+ return spawnSync('git', args, { cwd, encoding: 'utf8', maxBuffer, env: gitProcessEnvironment() });
54
+ }
55
+ function localGitHttpExtraHeaders(cwd) {
56
+ const configuredHeaders = runGit(cwd, ['config', '--local', '--get-regexp', '^http\\..*\\.extraheader$'], 1 << 20);
57
+ if (configuredHeaders.status !== 0)
58
+ return [];
59
+ return configuredHeaders.stdout
60
+ .split('\n')
61
+ .filter(Boolean)
62
+ .flatMap((configuredHeader) => {
63
+ const separatorIndex = configuredHeader.indexOf(' ');
64
+ if (separatorIndex === -1)
65
+ return [];
66
+ return [
67
+ {
68
+ key: configuredHeader.slice(0, separatorIndex),
69
+ value: configuredHeader.slice(separatorIndex + 1),
70
+ },
71
+ ];
72
+ });
35
73
  }
36
74
  function gitOutput(cwd, args) {
37
75
  const r = runGit(cwd, args);
@@ -380,11 +418,14 @@ function checkoutMapStore(cwd, remote, branch) {
380
418
  if (!remoteExists(remote, cwd))
381
419
  throw new MapStoreError(`git remote ${remote} was not found`);
382
420
  const remoteUrl = gitOutput(cwd, ['remote', 'get-url', remote]);
421
+ const httpExtraHeaders = localGitHttpExtraHeaders(cwd);
422
+ const authenticationArguments = httpExtraHeaders.flatMap(({ key, value }) => ['-c', `${key}=${value}`]);
383
423
  const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'styleproof-map-store-'));
384
424
  if (runGit(cwd, ['ls-remote', '--exit-code', '--heads', remote, branch], 1 << 20).status === 0) {
385
- const clone = spawnSync('git', ['clone', '-q', '--depth', '1', '--branch', branch, remoteUrl, tmp], {
425
+ const clone = spawnSync('git', [...authenticationArguments, 'clone', '-q', '--depth', '1', '--branch', branch, remoteUrl, tmp], {
386
426
  encoding: 'utf8',
387
427
  maxBuffer: 1 << 20,
428
+ env: gitProcessEnvironment(),
388
429
  });
389
430
  if (clone.status !== 0) {
390
431
  fs.rmSync(tmp, { recursive: true, force: true });
@@ -395,6 +436,8 @@ function checkoutMapStore(cwd, remote, branch) {
395
436
  runGit(tmp, ['init', '-q', '-b', branch]);
396
437
  runGit(tmp, ['remote', 'add', 'origin', remoteUrl]);
397
438
  }
439
+ for (const { key, value } of httpExtraHeaders)
440
+ runGit(tmp, ['config', '--local', key, value]);
398
441
  return tmp;
399
442
  }
400
443
  export function publishMapBundle(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "styleproof",
3
- "version": "4.4.1",
3
+ "version": "4.4.3",
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",