Skip to content

Commit 376e373

Browse files
committed
fix(ci): count every form that declares a default export
`export { default } from './page'` is a valid Next entry and the regex required `as default`, so such an entry would have dropped out of the walk and skipped both the registry gate and the graph-weight ratchet — silently, which is the dangerous direction for a discriminator to fail in. Latent rather than live: the form appears once under `app/workspace`, in a barrel, not in an entry filename. Four forms now count — `export default …`, `export { default } from`, `export { default, … } from`, and `export { X as default }`. `export { default as X }` still does not: it re-exports another module's default under a name and leaves this one without one. Verified all ten variants, including that last distinction. Raised by both Cursor and Greptile on #7028.
1 parent c01be22 commit 376e373

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

scripts/check-tool-registry-boundary.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,16 @@ const ENTRY_FILENAMES = new Set([
8686
* it as a boundary for having no default. Counting it as an entry both inflated
8787
* the coverage number and would have recorded a shared component in the
8888
* graph-weight baseline as though it were a route.
89+
*
90+
* All four declaring forms count — `export default …`, `export { default } from`,
91+
* `export { default, … } from`, and `export { X as default }`. `export { default
92+
* as X }` does not: it re-exports someone else's default under a name and leaves
93+
* the module without one. Missing a form is the dangerous direction, since the
94+
* entry would drop out of the walk and skip both the registry gate and the
95+
* graph-weight ratchet silently.
8996
*/
9097
const DEFAULT_EXPORT_RE =
91-
/(?:^|\n)\s*export\s+default\b|(?:^|\n)\s*export\s*\{[^}]*\bas\s+default\b/
98+
/(?:^|\n)\s*export\s+default\b|(?:^|\n)\s*export\s*\{[^}]*(?:\bas\s+default\b|\bdefault\s*[,}])/
9299

93100
function hasDefaultExport(file: string): boolean {
94101
try {

0 commit comments

Comments
 (0)