Repository navigation
fix(cli): integration verify reads exports with the reader discovery uses - #7660
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Visual Regression40 of 478 shot(s) changed. A change here is a question, not a failure: check whether the after is the
and 20 more. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
This review recommends approving the fix: integration verify now follows a folder re-export to its index file, the new regression test fails without the change and passes with it, and the existing integration tests still pass. No changes are required. One optional wording fix: the new test's comment says Node loads a folder's index file, but Node's ESM loader rejects directory imports, so "TypeScript and bundlers", as in the code comment and changeset, is the accurate reason.
[Automated review]
| }); | ||
|
|
||
| it('follows a re-export of a folder to its index file', async () => { | ||
| // `./primitives` names a folder: Node and TypeScript load its index file. |
There was a problem hiding this comment.
Optional wording: Node's ESM loader rejects directory imports (ERR_UNSUPPORTED_DIR_IMPORT); only CommonJS require, TypeScript and bundlers load the folder's index. Matching the code comment and changeset avoids implying the check models Node ESM:
// `./primitives` names a folder: TypeScript and bundlers load its index file.…uses The pack check kept a private copy of the static export reader. It read a folder named by a relative re-export as a module and counted a type-only re-export as the component, so integration verify disagreed with discovery. Verify now uses the shared reader in foundation/discovery/module-exports.mjs, and the private copy is deleted.
83b061e to
35cf936
Compare
|
Widened this fix: instead of patching the folder case in the pack check's private export reader, |
There was a problem hiding this comment.
This review recommends approving the change: integration verify now reads exports with the shared reader, so a component re-exported through a folder's index file passes and a type-only re-export no longer counts as the component, and both new tests fail without the change and pass with it. No changes are required. One optional follow-up outside this diff: for an extensionless re-export the shared reader tries a same-stem .cjs before .ts and .tsx, which TypeScript and common bundlers do not, so a source folder holding both files would now fail verify.
[Automated review]
User impact
astryx integration verifyand discovery read a package's exports with two different readers, so verify can contradict whatcomponent, search and the list already accept:export * from './primitives', withprimitives/index.tsre-exporting the components) fails verify withcomponent_export_missingfor every component reached through that folder. TypeScript and bundlers load the folder's index file, so the package works in apps built with them, but it cannot pass the check that comes before publishing without rewriting its re-exports to name files.export type {AcmeWidget} from './AcmeWidget') passes verify as if it exported the component, though an app importing it gets nothing at runtime.Problem and solution fit
foundation/discovery/module-exports.mjsresolves a folder to its index file and skips type-only anddeclareexports.integration verifyis the gate before publishing. A false failure blocks a correct package, and a false pass ships a component apps cannot import.Expected behavior and authority
architecture:cli-surfaceINV17:integration verifyfails when the packed artifact has no usable public export, not when it has one. Discovery's reader already implements that reading for every other surface.Smallest restoration
api/integration/pack-check.mjsimportsmoduleExportsNamefromfoundation/discovery/module-exports.mjsand deletes its private reader: the jscodeshift parser, its module resolver and its ownmoduleExportsName. The call sites are unchanged. No other behavior changes.Evidence
component_export_missing, "packed module does not export "AcmeWidget"", and the type-only test passes verify with no issue.component_export_missing.api/integrationpass (321 tests), including the existing re-export,exports-map and missing-export cases.pack-check.test.mjs› "follows a re-export of a folder to its index file" and "does not count a type-only re-export as the component". Each fails on the private reader.Overlaps
pack-check.mjs.Scope
Testing
vitest run --project node packages/cli/api/integration: 14 files, 321 tests pass.pnpm check:changesetspass; the strict typecheck reports only the two errors any checkout without a built@astryxdesign/theme-neutralreports.