repo-contract 0.7.3 → 0.8.5
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 +138 -75
- package/README.md +4 -0
- package/bin/preset-catalog.d.mts +9 -0
- package/bin/preset-catalog.mjs +42 -1
- package/bin/repo-contract.mjs +6 -2
- package/dist/.dts/helpers/exception-policy.d.ts +6 -6
- package/dist/.dts/helpers/exception-policy.d.ts.map +1 -1
- package/dist/.dts/helpers/glob-match.d.ts +29 -0
- package/dist/.dts/helpers/glob-match.d.ts.map +1 -0
- package/dist/.dts/helpers/index.d.ts +1 -1
- package/dist/.dts/parsing/parse-output.d.ts +1 -1
- package/dist/.dts/presets/dist-no-urls.d.ts +26 -0
- package/dist/.dts/presets/dist-no-urls.d.ts.map +1 -0
- package/dist/.dts/presets/index.d.ts +2 -0
- package/dist/.dts/presets/index.d.ts.map +1 -1
- package/dist/.dts/standard-schema/types.d.ts +2 -2
- package/dist/.dts/types.d.ts +5 -5
- package/dist/.dts/types.d.ts.map +1 -1
- package/dist/chunk-HDKSRSNF.js +108 -0
- package/dist/chunk-HDKSRSNF.js.map +1 -0
- package/dist/helpers.cjs +109 -3
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.js +3 -4
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/presets.cjs +214 -0
- package/dist/presets.cjs.map +1 -1
- package/dist/presets.js +110 -1
- package/dist/presets.js.map +1 -1
- package/package.json +22 -16
- package/schemas/evidence.schema.json +2 -2
- package/schemas/verdict.schema.json +2 -2
- package/src/config/validate-config.ts +3 -3
- package/src/helpers/exception-policy.ts +9 -9
- package/src/helpers/glob-match.ts +203 -0
- package/src/helpers/index.ts +1 -1
- package/src/parsing/parse-output.ts +1 -1
- package/src/presets/dist-no-urls.ts +179 -0
- package/src/presets/index.ts +2 -0
- package/src/standard-schema/types.ts +2 -2
- package/src/types.ts +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,69 +1,142 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.8.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- chore(benchmarks): refresh results.json
|
|
8
|
+
- chore(benchmarks): refresh results.json
|
|
9
|
+
- b07c91a: Re-pin internal-package-contract (lockfile and reusable-workflow references) to its 0.5.0 release.
|
|
10
|
+
- 2000ec3: Move the repository's own benchmarks onto internal-package-contract's shared benchmark kit (documented suites, cost-first `BENCHMARKS.md`, `benchmarks/README.md`, WRITING/READING docs) and re-pin internal-package-contract to its 0.4 release.
|
|
11
|
+
|
|
12
|
+
## 0.8.4
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 9549cf9: Accept npm 12's `npm pack --json` output (an object keyed by package name) as well as the older array form, so the consumer-install E2E suites and the `arethetypeswrong` check no longer fail under the latest npm during the release job.
|
|
17
|
+
|
|
18
|
+
## 0.8.3
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- chore(benchmarks): refresh results.json
|
|
23
|
+
- 8bcc7d4: Send the publish-time contract run's report to stderr so a failing check is visible in the release job's log instead of being swallowed by the Changesets action.
|
|
24
|
+
|
|
25
|
+
## 0.8.2
|
|
4
26
|
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- chore(benchmarks): refresh results.json
|
|
30
|
+
- e0f4cd4: Generate the gitignored `docs/api/` and `docs/benchmarks/` pages before the publish-time contract run, so the `docs` check no longer 404s on them in the release job's fresh checkout.
|
|
31
|
+
|
|
32
|
+
## 0.8.1
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- chore(sbom): regenerate for 0.8.0
|
|
37
|
+
- chore(benchmarks): refresh results.json
|
|
38
|
+
- chore: sync generated API baseline for release
|
|
39
|
+
|
|
40
|
+
## 0.8.0
|
|
41
|
+
|
|
42
|
+
### Minor Changes
|
|
43
|
+
|
|
44
|
+
- feat(sbom): add a real CycloneDX SBOM generator check
|
|
45
|
+
- feat: consume internal-package-contract's ApiContract/ApiDocsReport engine
|
|
46
|
+
- feat(benchmarks): add repo-contract's own benchmark suite, wire into CI, add site nav
|
|
47
|
+
- 4cd248d: Add the `distNoUrls({ dir?, allow? })` preset (`repo-contract/presets`). It fails when any URL
|
|
48
|
+
(any scheme followed by a colon and two slashes) appears in any file of the build output --
|
|
49
|
+
code, declarations and sourcemaps included -- so supply-chain scanners such as Socket.dev have no
|
|
50
|
+
URL strings to flag. `allow` takes `{ url, reason }` entries (`url` may be a glob); a missing
|
|
51
|
+
`reason` fails the check. repo-contract's own build output is now URL-free and the check runs in
|
|
52
|
+
its own contract.
|
|
53
|
+
- 65b74f0: Remove the `minimatch` runtime dependency. Exception-policy category globs are now matched by a
|
|
54
|
+
dependency-free, environment-free matcher (`src/helpers/glob-match.ts`, ADR 0017), so the package
|
|
55
|
+
has zero runtime dependencies. **Breaking (0.x minor):** only `*`, `**`, `?`, `[...]` classes,
|
|
56
|
+
`{a,b}` alternation and `\` escapes are supported; extglobs, POSIX classes, dotfile exclusion and
|
|
57
|
+
case folding are no longer interpreted, and a malformed character class now throws.
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- fix(checks): read the crap4ts report from a file instead of a pipe
|
|
62
|
+
- fix(ci): prettier-ignore the generated release-bump file
|
|
63
|
+
- fix(sbom): derive generate.test.ts's expected paths via path.join
|
|
64
|
+
- fix: waive the OpenSSF-Scorecard docs-links false positive; re-pin IPC workflows to latest SHA
|
|
65
|
+
- chore(benchmarks): refresh results.json
|
|
66
|
+
- fix: prevent TypeDoc/marked GFM autolink from mangling bare VERSIONING.md mentions
|
|
67
|
+
- fix(checks): keep the crap report where a fresh checkout can write it
|
|
68
|
+
- docs: update remaining release-please mentions after the Changesets migration
|
|
69
|
+
- fix(sbom): exclude docs/sbom.cdx.json from Prettier reformatting
|
|
70
|
+
- chore(benchmarks): refresh results.json
|
|
71
|
+
- chore(benchmarks): refresh results.json
|
|
72
|
+
- fix(helpers): reject glob patterns over 1000 characters so brace expansion fails fast
|
|
73
|
+
- chore(main): release repo-contract 0.7.3 (#85)
|
|
74
|
+
- chore: regenerate schemas for the VERSIONING.md backtick fix
|
|
75
|
+
- docs: update prose referencing the old local api-contract/api-docs engine
|
|
76
|
+
- fix: generate docs/api/ before the docs check; fix a stale RELEASING.md anchor
|
|
77
|
+
- fix(benchmarks): strip trailing whitespace before nested blocks in RESULTS.md
|
|
78
|
+
- fix(openssf-scorecard): stop Dangerous-Workflow from misreading past its first run: block
|
|
79
|
+
- fix: skip TypeDoc's own unpushed-HEAD source links in the local pre-push docs crawl
|
|
80
|
+
- chore(benchmarks): refresh results.json
|
|
81
|
+
- chore(benchmarks): refresh results.json
|
|
82
|
+
- chore: remove iso-12207-alignment compliance-document generator
|
|
83
|
+
- a52a06d: The `openssf-scorecard` self-evaluation now computes a weighted aggregate (`Σ(score × weight) / Σ(weight)`), with per-check weights fetched live from `ossf/scorecard`'s own published `docs/checks/internal/checks.yaml` risk tiers and `pkg/scorecard/scorecard_result.go` risk-weight table, rather than a simple average -- mirroring upstream's own `Result.GetAggregateScore` for closer methodology fidelity. `docs/OpenSSF-Scorecard.md` also now records provenance metadata (run date, evaluated repo + commit, and this evaluator's own version -- explicitly distinguished from the upstream `scorecard` binary's version, since this evaluation never runs that binary). Internal tooling only (`checks/`, `scripts/`); no public API change.
|
|
84
|
+
|
|
85
|
+
## [0.7.3](https://github.com/MaverickCER/repo-contract/compare/repo-contract-v0.7.2...repo-contract-v0.7.3) (2026-09-27)
|
|
5
86
|
|
|
6
87
|
### Bug Fixes
|
|
7
88
|
|
|
8
|
-
|
|
89
|
+
- exclude typescript@7 and vitest@5 from this dependency-group bump ([12b9ad0](https://github.com/MaverickCER/repo-contract/commit/12b9ad03bb808006612fc79f598252633ed4fd53))
|
|
9
90
|
|
|
10
91
|
## [0.7.2](https://github.com/MaverickCER/repo-contract/compare/repo-contract-v0.7.1...repo-contract-v0.7.2) (2026-09-27)
|
|
11
92
|
|
|
12
|
-
|
|
13
93
|
### Bug Fixes
|
|
14
94
|
|
|
15
|
-
|
|
95
|
+
- badges/docs-evidence carry forward checks instead of failing every push ([#83](https://github.com/MaverickCER/repo-contract/issues/83)) ([215db16](https://github.com/MaverickCER/repo-contract/commit/215db1666ec334a2cc341a8eedba38cc343abd7c))
|
|
16
96
|
|
|
17
97
|
## [0.7.1](https://github.com/MaverickCER/repo-contract/compare/repo-contract-v0.7.0...repo-contract-v0.7.1) (2026-09-26)
|
|
18
98
|
|
|
19
|
-
|
|
20
99
|
### Bug Fixes
|
|
21
100
|
|
|
22
|
-
|
|
101
|
+
- branch-protection-compatible CI, TS-compat check, dev-audit cleanup ([#78](https://github.com/MaverickCER/repo-contract/issues/78)) ([076461b](https://github.com/MaverickCER/repo-contract/commit/076461bb45b59a5859a3f4bef0da9828c95d10e6))
|
|
23
102
|
|
|
24
103
|
## [0.7.0](https://github.com/MaverickCER/repo-contract/compare/repo-contract-v0.6.0...repo-contract-v0.7.0) (2026-09-23)
|
|
25
104
|
|
|
26
|
-
|
|
27
105
|
### ⚠ BREAKING CHANGES
|
|
28
106
|
|
|
29
|
-
|
|
107
|
+
- OutputFormat no longer includes "yaml", and ParserDependencyMissingError (thrown only for a missing "yaml" peer dependency) is removed from the public API. A config using output.format: "yaml" will now fail config validation.
|
|
30
108
|
|
|
31
109
|
### Features
|
|
32
110
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
111
|
+
- drop first-class YAML output-format support ([99f7b6d](https://github.com/MaverickCER/repo-contract/commit/99f7b6db13ef60e159b2eb589317fdf0e99f0726))
|
|
112
|
+
- **security-socket:** reject supplyChainRisk alerts on shipped dependencies outright ([bf7f2b3](https://github.com/MaverickCER/repo-contract/commit/bf7f2b32ed47c496aea4877b20adb474592b85ad))
|
|
113
|
+
- **security-socket:** reject supplyChainRisk alerts on shipped dependencies outright ([d0a0563](https://github.com/MaverickCER/repo-contract/commit/d0a0563eb7f783577333291e94383408bb9e8c53))
|
|
37
114
|
|
|
38
115
|
### Bug Fixes
|
|
39
116
|
|
|
40
|
-
|
|
117
|
+
- **security-socket:** peerDependencies also count as shipped for supplyChainRisk ([e5db3cd](https://github.com/MaverickCER/repo-contract/commit/e5db3cd443c46c131ab0afc076451484132edede))
|
|
41
118
|
|
|
42
119
|
## [0.6.0](https://github.com/MaverickCER/repo-contract/compare/repo-contract-v0.5.2...repo-contract-v0.6.0) (2026-09-20)
|
|
43
120
|
|
|
44
|
-
|
|
45
121
|
### Features
|
|
46
122
|
|
|
47
|
-
|
|
48
|
-
|
|
123
|
+
- **docs:** waive known-good-but-flaky external links; release as 0.6.0 ([2ffdd8f](https://github.com/MaverickCER/repo-contract/commit/2ffdd8fbf9d767f537939da40cd750af2fb5d0b7))
|
|
49
124
|
|
|
50
125
|
### Miscellaneous Chores
|
|
51
126
|
|
|
52
|
-
|
|
127
|
+
- release repo-contract as 0.6.0 ([8282f70](https://github.com/MaverickCER/repo-contract/commit/8282f70f7727ee7f2c517acf7e65e93fc51388c9))
|
|
53
128
|
|
|
54
129
|
## [0.5.2](https://github.com/MaverickCER/repo-contract/compare/repo-contract-v0.5.1...repo-contract-v0.5.2) (2026-09-18)
|
|
55
130
|
|
|
56
|
-
|
|
57
131
|
### Features
|
|
58
132
|
|
|
59
|
-
|
|
133
|
+
- OpenSSF Scorecard + ISO 12207 alignment, mutation zero-tolerance ([#68](https://github.com/MaverickCER/repo-contract/issues/68)) ([76de4af](https://github.com/MaverickCER/repo-contract/commit/76de4af16cc681e88e3fe85439537848aad096ad))
|
|
60
134
|
|
|
61
135
|
## [0.5.1](https://github.com/MaverickCER/repo-contract/compare/repo-contract-v0.5.0...repo-contract-v0.5.1) (2026-09-14)
|
|
62
136
|
|
|
63
|
-
|
|
64
137
|
### Bug Fixes
|
|
65
138
|
|
|
66
|
-
|
|
139
|
+
- correct repository/bugs URL casing to match GitHub (MaverickCER) ([55d563c](https://github.com/MaverickCER/repo-contract/commit/55d563c06ec7b9fe1b26c73239e693f189aa31c8))
|
|
67
140
|
|
|
68
141
|
## [0.5.0](https://github.com/MaverickCER/repo-contract/compare/repo-contract-v0.4.0...repo-contract-v0.5.0) (2026-09-12)
|
|
69
142
|
|
|
@@ -71,109 +144,99 @@ Administrative republish -- 0.4.0 is already published on npm at its current con
|
|
|
71
144
|
|
|
72
145
|
## [0.4.0](https://github.com/MaverickCER/repo-contract/compare/repo-contract-v0.3.2...repo-contract-v0.4.0) (2026-09-09)
|
|
73
146
|
|
|
74
|
-
|
|
75
147
|
### ⚠ BREAKING CHANGES
|
|
76
148
|
|
|
77
|
-
|
|
149
|
+
- adds the new Experimental repo-contract/helpers subpath (exception-policy primitive). No existing export's shape changes; classified as minor per VERSIONING.md's "a new preset -> minor" convention for the Experimental tier, not a literal incompatibility.
|
|
78
150
|
|
|
79
151
|
### Features
|
|
80
152
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
153
|
+
- add a narrow `repo-contract init` scaffolding command ([#63](https://github.com/MaverickCER/repo-contract/issues/63)) ([a1d4e4a](https://github.com/MaverickCER/repo-contract/commit/a1d4e4a242cb0253e0a62e486e86a475a5c8ddbd))
|
|
154
|
+
- add a verified-exception waiver path to security-network ([94dbf43](https://github.com/MaverickCER/repo-contract/commit/94dbf4321b9288b10c65e7efc3e2596a40f4c628))
|
|
155
|
+
- add security-socket and coderabbitai checks ([cb7d3ca](https://github.com/MaverickCER/repo-contract/commit/cb7d3cad8d8015e85c82731075abe48e12371b15))
|
|
156
|
+
- add security-socket and coderabbitai checks ([31374ee](https://github.com/MaverickCER/repo-contract/commit/31374eebe5c35ff54e3efd37d5ed756cc8b8cdc4))
|
|
157
|
+
- add the checks/shared exception-matching and identity layer ([0d711f5](https://github.com/MaverickCER/repo-contract/commit/0d711f5f17d382af507cfafab4a441d620a8b220))
|
|
158
|
+
- add the generic exception-policy core primitive ([8d8f670](https://github.com/MaverickCER/repo-contract/commit/8d8f6704c20bc2c5a4b07e68dcb8e328ee48b9c7))
|
|
159
|
+
- content-bound verification for suppression-governance ([fb6a838](https://github.com/MaverickCER/repo-contract/commit/fb6a838da76247cc42ab316ad9d420ff174a4124))
|
|
160
|
+
- content-bound verification for suppression-governance (disable-comments.json) ([8da651a](https://github.com/MaverickCER/repo-contract/commit/8da651a0f76ab0464ed3b22ac5113b837ea3ecc1))
|
|
161
|
+
- **helpers:** add the exception-registry lifecycle primitives ([de8e855](https://github.com/MaverickCER/repo-contract/commit/de8e8558a26ca238aafc69d736e576aafddd8fa0))
|
|
162
|
+
- publish the repo-contract/helpers subpath ([35f168c](https://github.com/MaverickCER/repo-contract/commit/35f168ca9fbde4f46d1a29624f112e0d4d3b296d))
|
|
163
|
+
- retrofit security-network onto the exception-policy primitive ([62b8d0a](https://github.com/MaverickCER/repo-contract/commit/62b8d0afae9f3958b60666531d58a25a6f5b796e))
|
|
93
164
|
|
|
94
165
|
### Bug Fixes
|
|
95
166
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
167
|
+
- address CodeRabbit findings on the security-network retrofit ([e53313e](https://github.com/MaverickCER/repo-contract/commit/e53313ecf2973649cc2dca045a220f27f0e205db))
|
|
168
|
+
- address CodeRabbit findings on the two new checks ([255e495](https://github.com/MaverickCER/repo-contract/commit/255e49584a2b6622cee174f560221e731932d840))
|
|
169
|
+
- address CodeRabbit findings on the verification retrofit ([3d91878](https://github.com/MaverickCER/repo-contract/commit/3d91878407dd006f82239d034cb319d3856a0c46))
|
|
170
|
+
- address round-2 CodeRabbit findings on the helpers primitive ([fabb9df](https://github.com/MaverickCER/repo-contract/commit/fabb9df2261051cc35fbe15faf3e6df9317afdf5))
|
|
171
|
+
- backfill verification baseline onto records merged in from main ([286e877](https://github.com/MaverickCER/repo-contract/commit/286e8775ad66d7d727f68c0ba269ad2cfa036d56))
|
|
172
|
+
- harden exception-policy config validation and smoke/license accuracy ([e23c069](https://github.com/MaverickCER/repo-contract/commit/e23c069f422ac8967cf8c3a65605bdfb85c07abc))
|
|
173
|
+
- reject impossible calendar dates in verifiedAt, sync ADR 0013 ([6df0911](https://github.com/MaverickCER/repo-contract/commit/6df0911c8bbbfe99bd97095e811b9d762aeb6438))
|
|
174
|
+
- reject trailing newline in verifiedAt; PATH-aware socket probe in the integration test ([ef01ba6](https://github.com/MaverickCER/repo-contract/commit/ef01ba65950041838a3e43f8d8f440add6c4a97c))
|
|
175
|
+
- remove duplicate StandardSchemaV1 re-export in src/helpers/index.ts ([a0d8ee7](https://github.com/MaverickCER/repo-contract/commit/a0d8ee7a490d05fc99d9cbb7150706f7c1494694))
|
|
176
|
+
- skip the real-source drift test inside a Stryker mutation sandbox ([e9e64f6](https://github.com/MaverickCER/repo-contract/commit/e9e64f6dbe57a9e0612209bb568b584961d130cc))
|
|
177
|
+
- validate exception registries on every run and tighten verification ([8d6993f](https://github.com/MaverickCER/repo-contract/commit/8d6993fb94299a50c7b2589d400e592e43767df5))
|
|
178
|
+
- validate the coderabbit terminal event findings count ([a7acd09](https://github.com/MaverickCER/repo-contract/commit/a7acd0950b54f3bd2dbde3956a697d97d80daf9c))
|
|
108
179
|
|
|
109
180
|
## [0.3.2](https://github.com/MaverickCER/repo-contract/compare/repo-contract-v0.3.1...repo-contract-v0.3.2) (2026-09-04)
|
|
110
181
|
|
|
111
|
-
|
|
112
182
|
### Features
|
|
113
183
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
184
|
+
- validate and transform check output with a Standard Schema ([d53cb17](https://github.com/MaverickCER/repo-contract/commit/d53cb17a9e3a3f939cd403226ab5256be0de79ac))
|
|
185
|
+
- validate and transform check output with a Standard Schema ([fbb7925](https://github.com/MaverickCER/repo-contract/commit/fbb79259f4a6cede1da64a0abd7e1f1541e1d505))
|
|
117
186
|
|
|
118
187
|
### Bug Fixes
|
|
119
188
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
189
|
+
- address CodeRabbit findings and close mutation-testing gaps in Standard Schema support ([53baf87](https://github.com/MaverickCER/repo-contract/commit/53baf877d367fd17dbe1ec2f312ab9ed790e6ae6))
|
|
190
|
+
- **api-contract:** don't classify a required property on a brand-new container as breaking ([27ad5d5](https://github.com/MaverickCER/repo-contract/commit/27ad5d5c57811d90393b00f48ae8a8bbd413407b))
|
|
191
|
+
- **test:** harden isRuntimeAvailable against spawnSync throwing under load ([60c76b6](https://github.com/MaverickCER/repo-contract/commit/60c76b642dfd6187888f02d31639e68468e77b17))
|
|
123
192
|
|
|
124
193
|
## [0.3.1](https://github.com/MaverickCER/repo-contract/compare/repo-contract-v0.3.0...repo-contract-v0.3.1) (2026-09-03)
|
|
125
194
|
|
|
126
|
-
|
|
127
195
|
### Bug Fixes
|
|
128
196
|
|
|
129
|
-
|
|
130
|
-
|
|
197
|
+
- correct the release runbook that shipped types-less tarballs ([f56ea34](https://github.com/MaverickCER/repo-contract/commit/f56ea342606cfc92a09943ea5eb787936e7b7ba9))
|
|
198
|
+
- published tarball missing types; simplify CI matrix ([7ec8fd9](https://github.com/MaverickCER/repo-contract/commit/7ec8fd946bd584098255c5d2ab3f07b98b55ba1f))
|
|
131
199
|
|
|
132
200
|
## [0.3.0](https://github.com/MaverickCER/repo-contract/compare/repo-contract-v0.2.1...repo-contract-v0.3.0) (2026-09-03)
|
|
133
201
|
|
|
134
|
-
|
|
135
202
|
### ⚠ BREAKING CHANGES
|
|
136
203
|
|
|
137
|
-
|
|
204
|
+
- defineRepoContract/runRepoContract now require spawn and env on the config (e.g. spawn: child_process.spawn, env: process.env). See ADR 0011 and README's "Supplying spawn/env" section for migration.
|
|
138
205
|
|
|
139
206
|
### Features
|
|
140
207
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
208
|
+
- contract engine, self-hosting checks and CI workflows ([97ae128](https://github.com/MaverickCER/repo-contract/commit/97ae128bd96f2c631057f1150068af58cc66b224))
|
|
209
|
+
- contract engine, self-hosting checks and CI workflows ([22b2a3b](https://github.com/MaverickCER/repo-contract/commit/22b2a3b03fe4e44ad7a01b82342d86583926416a))
|
|
210
|
+
- make process spawning and env access consumer-supplied capabilities ([640a961](https://github.com/MaverickCER/repo-contract/commit/640a961b65fd73511586c3b4f6274284bf5172a9))
|
|
145
211
|
|
|
146
212
|
### Bug Fixes
|
|
147
213
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
214
|
+
- clear Socket supply-chain alerts (unminified dist, no prepare script) ([71c9230](https://github.com/MaverickCER/repo-contract/commit/71c92306fcf00e3858f0596c2d56f3272199339d))
|
|
215
|
+
- publish the dist bundle unminified ([266ae47](https://github.com/MaverickCER/repo-contract/commit/266ae47919753c55f10364713fe0c7c5876815b7))
|
|
216
|
+
- remove the prepare install script from the published package ([9153540](https://github.com/MaverickCER/repo-contract/commit/9153540e4f0f1a069e07c12ddfee8ba62827ce5b))
|
|
151
217
|
|
|
152
218
|
## [0.2.1](https://github.com/MaverickCER/repo-contract/compare/repo-contract-v0.2.0...repo-contract-v0.2.1) (2026-09-03)
|
|
153
219
|
|
|
154
|
-
|
|
155
220
|
### Documentation
|
|
156
221
|
|
|
157
|
-
|
|
222
|
+
- add Socket security badge to README
|
|
158
223
|
|
|
159
224
|
## [0.2.0](https://github.com/MaverickCER/repo-contract/compare/repo-contract-v0.1.1...repo-contract-v0.2.0) (2026-09-03)
|
|
160
225
|
|
|
161
|
-
|
|
162
226
|
### ⚠ BREAKING CHANGES
|
|
163
227
|
|
|
164
|
-
|
|
228
|
+
- defineRepoContract/runRepoContract now require spawn and env on the config (e.g. spawn: child_process.spawn, env: process.env). See ADR 0011 and README's "Supplying spawn/env" section for migration.
|
|
165
229
|
|
|
166
230
|
### Features
|
|
167
231
|
|
|
168
|
-
|
|
232
|
+
- make process spawning and env access consumer-supplied capabilities ([640a961](https://github.com/MaverickCER/repo-contract/commit/640a961b65fd73511586c3b4f6274284bf5172a9))
|
|
169
233
|
|
|
170
234
|
## [0.1.1](https://github.com/MaverickCER/repo-contract/compare/repo-contract-v0.1.0...repo-contract-v0.1.1) (2026-09-01)
|
|
171
235
|
|
|
172
|
-
|
|
173
236
|
### Bug Fixes
|
|
174
237
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
238
|
+
- clear Socket supply-chain alerts (unminified dist, no prepare script) ([71c9230](https://github.com/MaverickCER/repo-contract/commit/71c92306fcf00e3858f0596c2d56f3272199339d))
|
|
239
|
+
- publish the dist bundle unminified ([266ae47](https://github.com/MaverickCER/repo-contract/commit/266ae47919753c55f10364713fe0c7c5876815b7))
|
|
240
|
+
- remove the prepare install script from the published package ([9153540](https://github.com/MaverickCER/repo-contract/commit/9153540e4f0f1a069e07c12ddfee8ba62827ce5b))
|
|
178
241
|
|
|
179
242
|
## Changelog
|
package/README.md
CHANGED
|
@@ -203,6 +203,10 @@ new requirements land as `warn`, become `fail` on a date
|
|
|
203
203
|
|
|
204
204
|
AI coding agents, CI bots, and release automation consume the same contract as human contributors. An actionable rationale gives automation a concrete thing to fix rather than a bare "a check failed" — making regenerate-until-green workflows much easier to converge.
|
|
205
205
|
|
|
206
|
+
## Supply-chain transparency
|
|
207
|
+
|
|
208
|
+
This repository publishes its own dependency inventory: [`docs/sbom.cdx.json`](docs/sbom.cdx.json), a real [CycloneDX](https://cyclonedx.org/) 1.6 Software Bill of Materials, regenerated on every `npm run contract` run via [`@cyclonedx/cyclonedx-npm`](https://github.com/CycloneDX/cyclonedx-node-npm) (`checks/sbom.ts`). It covers every direct and transitive **npm** dependency resolved in `package-lock.json` — no other ecosystem — and is deterministic given an unchanged lockfile, so it stays a normal, diff-gated committed file rather than a special-cased exclusion.
|
|
209
|
+
|
|
206
210
|
## Status
|
|
207
211
|
|
|
208
212
|
Pre-1.0. Per [VERSIONING.md](VERSIONING.md), a `0.x` minor may carry a breaking change to the Stable tier before 1.0 — pin accordingly and read the [CHANGELOG](CHANGELOG.md) on every minor upgrade.
|
package/bin/preset-catalog.d.mts
CHANGED
|
@@ -9,6 +9,7 @@ export type PresetName =
|
|
|
9
9
|
| "stylelint"
|
|
10
10
|
| "markdownlint"
|
|
11
11
|
| "brokenLinks"
|
|
12
|
+
| "distNoUrls"
|
|
12
13
|
| "securityDeps"
|
|
13
14
|
| "securitySecrets"
|
|
14
15
|
| "license"
|
|
@@ -16,6 +17,8 @@ export type PresetName =
|
|
|
16
17
|
| "publint"
|
|
17
18
|
| "arethetypeswrong"
|
|
18
19
|
|
|
20
|
+
export declare const DIST_OUTPUT: "dist/"
|
|
21
|
+
|
|
19
22
|
export declare const PRESET_DEPENDENCIES: Readonly<Record<PresetName, string | null>>
|
|
20
23
|
|
|
21
24
|
export declare const FACTORY_PRESETS: ReadonlySet<PresetName>
|
|
@@ -36,4 +39,10 @@ export declare function detectPresets(packageJson: {
|
|
|
36
39
|
// `devDependencies` (see preset-catalog.mjs's own doc comment for why).
|
|
37
40
|
readonly dependencies?: Readonly<Record<string, string>>
|
|
38
41
|
readonly devDependencies?: Readonly<Record<string, string>>
|
|
42
|
+
// Read only to detect a published `dist/` (the `distNoUrls` preset).
|
|
43
|
+
readonly main?: string
|
|
44
|
+
readonly module?: string
|
|
45
|
+
readonly types?: string
|
|
46
|
+
readonly files?: readonly string[]
|
|
47
|
+
readonly exports?: unknown
|
|
39
48
|
}): DetectPresetsResult
|
package/bin/preset-catalog.mjs
CHANGED
|
@@ -9,10 +9,17 @@
|
|
|
9
9
|
// -- it cannot prove each dependency mapping below is itself correct. That's a known, accepted
|
|
10
10
|
// limit of a hand-maintained table, stated here rather than assumed away.
|
|
11
11
|
//
|
|
12
|
+
// `distNoUrls` maps to `DIST_OUTPUT`, a pseudo-dependency: it needs no CLI at all, only a package that
|
|
13
|
+
// actually publishes a built `dist/`, so `detectPresets` detects it from package.json's own
|
|
14
|
+
// `main`/`module`/`types`/`files`/`exports` instead of from `devDependencies`.
|
|
15
|
+
//
|
|
12
16
|
// `securityDeps` maps to `null`, not a real npm package name: it shells out to `npm` itself (see
|
|
13
17
|
// GUIDE.md's preset table), which is always present because this script is already running via
|
|
14
18
|
// `npx`/`npm exec`. It goes through the exact same detection loop as every other preset below,
|
|
15
19
|
// with an always-true answer -- not a separate branch elsewhere.
|
|
20
|
+
/** The pseudo-dependency `distNoUrls` maps to -- see the comment above. */
|
|
21
|
+
export const DIST_OUTPUT = "dist/"
|
|
22
|
+
|
|
16
23
|
export const PRESET_DEPENDENCIES = {
|
|
17
24
|
test: "vitest",
|
|
18
25
|
e2e: "@playwright/test",
|
|
@@ -24,6 +31,7 @@ export const PRESET_DEPENDENCIES = {
|
|
|
24
31
|
stylelint: "stylelint",
|
|
25
32
|
markdownlint: "markdownlint-cli2",
|
|
26
33
|
brokenLinks: "linkinator",
|
|
34
|
+
distNoUrls: DIST_OUTPUT,
|
|
27
35
|
securityDeps: null,
|
|
28
36
|
securitySecrets: "secretlint",
|
|
29
37
|
license: "licensee",
|
|
@@ -42,8 +50,38 @@ export const FACTORY_PRESETS = new Set([
|
|
|
42
50
|
"markdownlint",
|
|
43
51
|
"brokenLinks",
|
|
44
52
|
"commitlint",
|
|
53
|
+
"distNoUrls",
|
|
45
54
|
])
|
|
46
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Every string anywhere inside `value` (an `exports` map nests arbitrarily).
|
|
58
|
+
* @param value - Any parsed JSON value.
|
|
59
|
+
* @returns the strings it contains.
|
|
60
|
+
*/
|
|
61
|
+
function allStrings(value) {
|
|
62
|
+
if (typeof value === "string") return [value]
|
|
63
|
+
if (Array.isArray(value)) return value.flatMap(allStrings)
|
|
64
|
+
if (value !== null && typeof value === "object") return Object.values(value).flatMap(allStrings)
|
|
65
|
+
return []
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Whether package.json publishes a built `dist/` directory (its entry points or `files` allowlist
|
|
70
|
+
* name it).
|
|
71
|
+
* @param packageJson - Parsed package.json content.
|
|
72
|
+
* @returns `true` when any entry point or `files` entry is `dist` or lives under it.
|
|
73
|
+
*/
|
|
74
|
+
function publishesDist(packageJson) {
|
|
75
|
+
const references = allStrings([
|
|
76
|
+
packageJson.main,
|
|
77
|
+
packageJson.module,
|
|
78
|
+
packageJson.types,
|
|
79
|
+
packageJson.files,
|
|
80
|
+
packageJson.exports,
|
|
81
|
+
])
|
|
82
|
+
return references.some((reference) => /^(\.\/)?dist(\/|$)/.test(reference))
|
|
83
|
+
}
|
|
84
|
+
|
|
47
85
|
/**
|
|
48
86
|
* Detects which presets' underlying CLIs are already declared in a consumer's package.json.
|
|
49
87
|
* Checks `devDependencies` only -- every published preset's own documentation (GUIDE.md's
|
|
@@ -60,7 +98,10 @@ export function detectPresets(packageJson) {
|
|
|
60
98
|
const skipped = []
|
|
61
99
|
|
|
62
100
|
for (const [preset, dependency] of Object.entries(PRESET_DEPENDENCIES)) {
|
|
63
|
-
|
|
101
|
+
const present =
|
|
102
|
+
dependency === null ||
|
|
103
|
+
(dependency === DIST_OUTPUT ? publishesDist(packageJson) : declared.has(dependency))
|
|
104
|
+
if (present) {
|
|
64
105
|
detected.push(preset)
|
|
65
106
|
} else {
|
|
66
107
|
skipped.push({ preset, dependency })
|
package/bin/repo-contract.mjs
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs"
|
|
14
14
|
import path from "node:path"
|
|
15
|
-
import { detectPresets } from "./preset-catalog.mjs"
|
|
15
|
+
import { DIST_OUTPUT, detectPresets } from "./preset-catalog.mjs"
|
|
16
16
|
import { buildConfigTemplate, CONTRACT_RUNNER_TEMPLATE } from "./templates.mjs"
|
|
17
17
|
import { patchContractScript } from "./package-json-patch.mjs"
|
|
18
18
|
|
|
@@ -172,7 +172,11 @@ function report({ configResult, runnerResult, scriptStatus, detected, skipped })
|
|
|
172
172
|
if (skipped.length > 0) {
|
|
173
173
|
lines.push("Not detected (install the tool to add its check):")
|
|
174
174
|
for (const { preset, dependency } of skipped)
|
|
175
|
-
lines.push(
|
|
175
|
+
lines.push(
|
|
176
|
+
dependency === DIST_OUTPUT
|
|
177
|
+
? ` - ${preset} (package.json names no dist/ build output)`
|
|
178
|
+
: ` - ${preset} (${dependency} not installed)`,
|
|
179
|
+
)
|
|
176
180
|
lines.push("")
|
|
177
181
|
}
|
|
178
182
|
|
|
@@ -25,7 +25,7 @@ export type ExceptionPolicy = {
|
|
|
25
25
|
* with no exact or glob match in `rules` (see `resolveExceptionPolicy` for the full exact > glob >
|
|
26
26
|
* group-default > global-default precedence). Omit `default` to fall through to the caller-supplied
|
|
27
27
|
* `globalDefault` instead. Each key of `rules` is either an exact `category` string or a
|
|
28
|
-
*
|
|
28
|
+
* glob pattern -- `resolveExceptionPolicy` tries an exact match first and only
|
|
29
29
|
* consults glob matching once no exact key exists, so a glob can never shadow a more specific
|
|
30
30
|
* exact entry.
|
|
31
31
|
* @beta
|
|
@@ -33,7 +33,7 @@ export type ExceptionPolicy = {
|
|
|
33
33
|
export interface ExceptionCategoryGroup {
|
|
34
34
|
/** This group's fallback policy when `category` matches neither an exact nor a glob key in `rules`. Falls through to the caller's `globalDefault` when omitted. */
|
|
35
35
|
readonly default?: ExceptionPolicy;
|
|
36
|
-
/** Keyed by exact `category` string or
|
|
36
|
+
/** Keyed by exact `category` string or glob pattern. A literal `"*"` key is rejected by `validateExceptionPolicyConfig` -- see that function's own doc comment for why. */
|
|
37
37
|
readonly rules?: Readonly<Record<string, ExceptionPolicy>>;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
@@ -110,7 +110,7 @@ export declare function stricterOf(a: ExceptionPolicy, b: ExceptionPolicy): Exce
|
|
|
110
110
|
* 1. **Blanket category** -- `category === "*"` means every category this group could ever apply
|
|
111
111
|
* to was matched at once, not one specific category literally named `"*"`. It resolves as the
|
|
112
112
|
* strictest (`stricterOf`) policy across every entry in `group.rules` plus the group's own
|
|
113
|
-
* default (or `globalDefault`) -- never via
|
|
113
|
+
* default (or `globalDefault`) -- never via the glob matcher: `globMatch("*", pattern)` tests the
|
|
114
114
|
* literal one-character string `"*"` as a path against `pattern`, which does not glob-match a
|
|
115
115
|
* pattern like `"security/*"` (that would require the *pattern*, not the *target*, to be `"*"`),
|
|
116
116
|
* so treating this case as an ordinary pattern match would silently let a blanket match fall
|
|
@@ -118,7 +118,7 @@ export declare function stricterOf(a: ExceptionPolicy, b: ExceptionPolicy): Exce
|
|
|
118
118
|
* 2. **Exact match** -- `group.rules[category]`, if present. A glob is never even consulted once an
|
|
119
119
|
* exact entry exists for `category`.
|
|
120
120
|
* 3. **Glob match** -- the strictest (`stricterOf`) policy among every key in `group.rules` that is
|
|
121
|
-
* not itself an exact match for `category` but does match it as a
|
|
121
|
+
* not itself an exact match for `category` but does match it as a glob (e.g.
|
|
122
122
|
* `"security/*"` matching `"security/detect-object-injection"`).
|
|
123
123
|
* 4. **Group default** -- `group.default`, if `group` itself has an entry in `config` (whether or
|
|
124
124
|
* not that entry defines its own `default`).
|
|
@@ -186,9 +186,9 @@ export declare function evaluateExceptionRecords<TRecord>(inputs: readonly Excep
|
|
|
186
186
|
* no group's `rules` may use the literal `"*"` as a key. A literal `"*"` key is always a mistake,
|
|
187
187
|
* never an intentional blanket policy: `resolveExceptionPolicy`'s own blanket-category handling is
|
|
188
188
|
* triggered by the *input* `category` being `"*"`, not by a `"*"` entry in `rules` -- a `"*"` rules
|
|
189
|
-
* key would instead be consulted only as an ordinary
|
|
189
|
+
* key would instead be consulted only as an ordinary glob, which matches the literal
|
|
190
190
|
* one-character string `"*"` as a *target*, not as a wildcard pattern matching every real category
|
|
191
|
-
* name (`
|
|
191
|
+
* name (`globMatch("*", pattern)` truthiness depends on `pattern`, not the other way around) --
|
|
192
192
|
* see `resolveExceptionPolicy`'s own doc comment, case 1, for the failure mode this prevents.
|
|
193
193
|
* @param config - The exception policy configuration to validate.
|
|
194
194
|
* @param validRequirements - The complete set of field names this consumer's policy may require, if the consumer wants that checked. Omit to skip that check entirely.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exception-policy.d.ts","sourceRoot":"","sources":["../../../src/helpers/exception-policy.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GAC9B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAA;AAE5E;;;;;;;;;GASG;AACH,MAAM,WAAW,sBAAsB;IACrC,mKAAmK;IACnK,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,CAAA;IAClC,
|
|
1
|
+
{"version":3,"file":"exception-policy.d.ts","sourceRoot":"","sources":["../../../src/helpers/exception-policy.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A small, dependency-free glob matcher -- the replacement for the `minimatch` runtime dependency
|
|
3
|
+
* (see specs/decisions/0017-own-glob-matcher-replaces-minimatch.md). Pure string logic: it reads no
|
|
4
|
+
* environment variable, touches no filesystem, imports nothing, and builds no `RegExp` from its
|
|
5
|
+
* input -- a pattern is tokenized and matched by a position-set simulation that is polynomial in
|
|
6
|
+
* the sizes of the pattern and the value, so no pattern can cause catastrophic backtracking.
|
|
7
|
+
*
|
|
8
|
+
* Supported syntax (exactly what exception-policy category keys use, e.g. `"security/*"`):
|
|
9
|
+
* - `*` any run of characters except `/`
|
|
10
|
+
* - `**` any run of characters including `/`; a whole `**` + `/` segment also matches zero segments
|
|
11
|
+
* - `?` exactly one character except `/`
|
|
12
|
+
* - `[abc]`, `[a-z]`, `[!abc]` / `[^abc]` a character class (a reversed range matches nothing)
|
|
13
|
+
* - `{a,b}` alternation (nestable)
|
|
14
|
+
* - `\x` the literal character `x`
|
|
15
|
+
*
|
|
16
|
+
* Not supported (treated as literal text, never as a special form): extglobs (`+(a|b)`), POSIX
|
|
17
|
+
* classes (`[[:alpha:]]`), dotfile exclusion, case folding.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Whether `value` matches the glob `pattern` (see this module's own doc comment for the exact
|
|
21
|
+
* syntax). Nothing is cached: compiling a category glob costs microseconds, and a cache would make a
|
|
22
|
+
* pattern's code paths run only for the first caller.
|
|
23
|
+
* @param value - the string to test (an exception category such as `"security/xss"`).
|
|
24
|
+
* @param pattern - the glob to test it against.
|
|
25
|
+
* @returns `true` when the whole of `value` matches `pattern`.
|
|
26
|
+
* @throws {Error} when `pattern` is over 1000 characters, or its brace groups expand to too many alternatives.
|
|
27
|
+
*/
|
|
28
|
+
export declare function globMatch(value: string, pattern: string): boolean;
|
|
29
|
+
//# sourceMappingURL=glob-match.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob-match.d.ts","sourceRoot":"","sources":["../../../src/helpers/glob-match.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAwKH;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAQjE"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* specs/decisions/0013-reusable-exception-policy-helper.md for the full
|
|
13
13
|
* rationale and the boundary this barrel deliberately does not cross.
|
|
14
14
|
*
|
|
15
|
-
* Published **Experimental** (see VERSIONING.md): its TypeScript signature
|
|
15
|
+
* Published **Experimental** (see `VERSIONING.md`): its TypeScript signature
|
|
16
16
|
* and runtime behavior may both change in a minor or patch release, the same
|
|
17
17
|
* classification `repo-contract/presets` already carries (see
|
|
18
18
|
* specs/decisions/0004-public-surface-stays-narrow-no-cli-experimental-presets.md)
|
|
@@ -3,7 +3,7 @@ import type { OutputFormat, ParsedOutput } from "../types.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Dispatches to the parser for `format`, then -- only on a successful parse, and only if `schema`
|
|
5
5
|
* is supplied -- runs `schema["~standard"].validate()` against the parsed value
|
|
6
|
-
* (
|
|
6
|
+
* (standardschema.dev). `parse-json.ts`/`parse-text.ts` stay entirely unaware of `schema`;
|
|
7
7
|
* this is the sole orchestration point. `validate()` may return its `Result` synchronously or as a
|
|
8
8
|
* `Promise` -- `await`ing either uniformly is a no-op for the synchronous case, but this function
|
|
9
9
|
* still needs to be `async` for that awaited call. A successful `Result` (`issues === undefined`)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CheckDefinitionConfig } from "../types.js";
|
|
2
|
+
/** One allowlisted URL (glob) and the reviewable reason it may ship. */
|
|
3
|
+
export interface DistNoUrlsAllowEntry {
|
|
4
|
+
/** A URL, or a glob (`*`, `**`, `?`, `[...]`, `{a,b}`; escape literals with `\`) matched against each whole URL found. */
|
|
5
|
+
readonly url: string;
|
|
6
|
+
/** Why this URL must ship in the build output. Required and non-empty -- an allowlist entry without one fails the check. */
|
|
7
|
+
readonly reason: string;
|
|
8
|
+
}
|
|
9
|
+
/** Options accepted by {@link distNoUrls}. */
|
|
10
|
+
export interface DistNoUrlsOptions {
|
|
11
|
+
/** Build-output directory to scan, relative to the working directory. Defaults to `"dist"`. */
|
|
12
|
+
readonly dir?: string;
|
|
13
|
+
/** URLs permitted in the output, each with a reason. Empty by default: the strictest policy is the default. */
|
|
14
|
+
readonly allow?: readonly DistNoUrlsAllowEntry[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Fails when any URL (any scheme followed by a colon and two slashes) appears in any file of the build output directory, so
|
|
18
|
+
* supply-chain scanners that flag shipped URLs (Socket.dev's "URL strings" alert, for one) have
|
|
19
|
+
* nothing to flag. Scans every file, sourcemaps and declaration files included. Individual URLs can
|
|
20
|
+
* be allowed with a mandatory, reviewable `reason`; there is no blanket opt-out.
|
|
21
|
+
* @param options - configuration for this check; see {@link DistNoUrlsOptions}.
|
|
22
|
+
* @returns the configured check.
|
|
23
|
+
* @beta
|
|
24
|
+
*/
|
|
25
|
+
export declare function distNoUrls(options?: DistNoUrlsOptions): CheckDefinitionConfig;
|
|
26
|
+
//# sourceMappingURL=dist-no-urls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dist-no-urls.d.ts","sourceRoot":"","sources":["../../../src/presets/dist-no-urls.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAGxD,wEAAwE;AACxE,MAAM,WAAW,oBAAoB;IACnC,0HAA0H;IAC1H,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,4HAA4H;IAC5H,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED,8CAA8C;AAC9C,MAAM,WAAW,iBAAiB;IAChC,+FAA+F;IAC/F,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;IACrB,+GAA+G;IAC/G,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAA;CACjD;AAsFD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,qBAAqB,CAiEjF"}
|