Repository navigation
Conversation
Walk the component tree recursively so nested subdirectories are ejected instead of silently dropped, and make import-rewriting location-aware so intra-component imports from nested files stay relative while only escaping imports map to the owner package's subpaths. Every destination is asserted within the output dir before writing. Fixes #3506
cixzhang
requested review from
ejhammond,
imdreamrunner and
josephfarina
as code owners
July 26, 2026 03:01
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Author
|
Closing this — on reflection we can't build on an unsigned contribution here. The underlying issue #3506 remains open and we'll address it independently. |
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
This was referenced Aug 16, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3506.
astryx swizzle <Name>copied only a component's top-level files and silently skipped nested subdirectories. For components whose source spans folders (e.g.Table/plugins/*), that produced a broken partial eject: the copied entry file stillexport … from './plugins/…', but the subtree it pointed at was never copied — so the swizzled component fails module resolution while the CLI reports success.Re-implements the fix originally proposed by @oneshot2001 in #3507, rebased onto the reorganized CLI pillar layout (the logic now lives in
packages/cli/api/swizzle/swizzle.mjs, the API pillar, rather than the oldsrc/commands/swizzle.mjs).Changes
collectSourceFiles()walks the component tree, preserving nested structure and excluding tests/docs/README at every level. It's the single source of truth for the pre-flight collision check, the copy loop, and the reported file list. Symlinks are not followed.rewriteImportsgains an optional{fromDir, componentDir}. Each../import is resolved from the source file's own directory; only imports that actually escape the component are rewritten to the owner package's subpath. Intra-component imports from nested files (e.g.../../typesinTable/plugins/pagination/*) stay relative instead of becoming a broken@astryxdesign/core/... Without the location arg the legacy behavior is unchanged, so the existingrewriteImports(content)contract and its tests are preserved.assertWithin) before anymkdir/write.Testing
../../typesstays relative; nested-sibling stays relative; top-level legacy parity) and an end-to-end regression test that swizzles a component with a nestedplugins/subtree and asserts the full tree is copied with correct rewrites.packages/cliswizzle suites (swizzle.test.mjs,swizzle.routing.test.mjs,swizzle.path-safety.test.mjs) — 27/27 pass.typecheck:strict, checkJs) — clean.@astryxdesign/clipatch).Notes
Behavior change is additive: top-level-only components swizzle identically to before; multi-directory components now eject completely.