styleproof 4.4.5 → 4.4.7

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
@@ -9,10 +9,16 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
9
9
 
10
10
  ### Fixed
11
11
 
12
+ - **Generated CI authenticates map publication explicitly.** `styleproof-init`
13
+ passes the workflow's least-privilege `github.token` as
14
+ `STYLEPROOF_MAP_STORE_TOKEN`, so cold-cache uploads do not depend on private
15
+ `actions/checkout` credential-storage details. Local hooks continue to reuse
16
+ normal Git credentials without requiring this variable.
12
17
  - **Map-store uploads now reuse credentials from `actions/checkout@v7`.**
13
18
  Checkout v7 keeps its HTTP header in an included temporary config rather than
14
19
  directly in `.git/config`; StyleProof now explicitly enables Git config includes
15
- before carrying that header into its isolated clone and push.
20
+ and falls back to its locally registered checkout config before carrying that
21
+ header into the isolated clone and push.
16
22
  - **Map-store uploads now reuse the HTTP authentication persisted by
17
23
  `actions/checkout`.** The isolated `styleproof-maps` clone carries the
18
24
  checkout's URL-scoped extra header through clone and push, so cache-miss
@@ -388,6 +388,8 @@ jobs:
388
388
  # Report on open/update; the prune job below handles close.
389
389
  if: github.event.action != 'closed'
390
390
  runs-on: ubuntu-latest
391
+ env:
392
+ STYLEPROOF_MAP_STORE_TOKEN: \${{ github.token }}
391
393
  steps:
392
394
  - uses: actions/checkout@v4
393
395
  with:
package/dist/map-store.js CHANGED
@@ -52,24 +52,45 @@ function gitProcessEnvironment() {
52
52
  function runGit(cwd, args, maxBuffer = 1 << 28) {
53
53
  return spawnSync('git', args, { cwd, encoding: 'utf8', maxBuffer, env: gitProcessEnvironment() });
54
54
  }
55
- function effectiveGitHttpExtraHeaders(cwd) {
56
- const configuredHeaders = runGit(cwd, ['config', '--includes', '--get-regexp', '^http\\..*\\.extraheader$'], 1 << 20);
57
- if (configuredHeaders.status !== 0)
58
- return [];
59
- return configuredHeaders.stdout
55
+ function parseGitHttpExtraHeaders(configuredHeaders) {
56
+ return configuredHeaders
60
57
  .split('\n')
61
58
  .filter(Boolean)
62
59
  .flatMap((configuredHeader) => {
63
60
  const separatorIndex = configuredHeader.indexOf(' ');
64
61
  if (separatorIndex === -1)
65
62
  return [];
66
- return [
67
- {
68
- key: configuredHeader.slice(0, separatorIndex),
69
- value: configuredHeader.slice(separatorIndex + 1),
70
- },
71
- ];
63
+ return [{ key: configuredHeader.slice(0, separatorIndex), value: configuredHeader.slice(separatorIndex + 1) }];
64
+ });
65
+ }
66
+ function effectiveGitHttpExtraHeaders(cwd) {
67
+ const configuredHeaders = runGit(cwd, ['config', '--includes', '--get-regexp', '^http\\..*\\.extraheader$'], 1 << 20);
68
+ const effectiveHeaders = parseGitHttpExtraHeaders(configuredHeaders.stdout);
69
+ if (effectiveHeaders.length > 0)
70
+ return effectiveHeaders;
71
+ const registeredIncludes = runGit(cwd, ['config', '--local', '--get-regexp', '^includeIf\\..*\\.path$'], 1 << 20);
72
+ const includedHeaders = registeredIncludes.stdout
73
+ .split('\n')
74
+ .filter(Boolean)
75
+ .flatMap((registeredInclude) => {
76
+ const separatorIndex = registeredInclude.indexOf(' ');
77
+ if (separatorIndex === -1)
78
+ return [];
79
+ const includedConfigPath = registeredInclude.slice(separatorIndex + 1);
80
+ const includedHeaders = runGit(cwd, ['config', '--file', includedConfigPath, '--get-regexp', '^http\\..*\\.extraheader$'], 1 << 20);
81
+ return parseGitHttpExtraHeaders(includedHeaders.stdout);
72
82
  });
83
+ if (includedHeaders.length > 0)
84
+ return includedHeaders;
85
+ const mapStoreToken = process.env.STYLEPROOF_MAP_STORE_TOKEN;
86
+ if (!mapStoreToken)
87
+ return [];
88
+ return [
89
+ {
90
+ key: ['http.https:', '', 'github.com', '.extraheader'].join('/'),
91
+ value: `AUTHORIZATION: basic ${Buffer.from(`x-access-token:${mapStoreToken}`).toString('base64')}`,
92
+ },
93
+ ];
73
94
  }
74
95
  function gitOutput(cwd, args) {
75
96
  const r = runGit(cwd, args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "styleproof",
3
- "version": "4.4.5",
3
+ "version": "4.4.7",
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",