feat(typescript): add internal prop to exclude declarations from barrel exports#375
Open
joheredi wants to merge 3 commits intoalloy-framework:mainfrom
Open
feat(typescript): add internal prop to exclude declarations from barrel exports#375joheredi wants to merge 3 commits intoalloy-framework:mainfrom
joheredi wants to merge 3 commits intoalloy-framework:mainfrom
Conversation
…el exports Add an `internal` boolean prop to all declaration components (FunctionDeclaration, VarDeclaration, ClassDeclaration, InterfaceDeclaration, EnumDeclaration, TypeDeclaration). When a declaration has both `export` and `internal`, it is exported from its source module but excluded from: - Barrel file re-exports (uses filtered named exports instead of export *) - Cross-package public symbol resolution This enables keeping utility declarations importable within a package while hiding them from the generated public API surface. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
All changed packages have been documented.
Show changes
|
commit: |
When multiple source files in the same directory export symbols with the same name, the generated barrel file now detects the conflict and falls back to named re-exports with deterministic aliases instead of emitting conflicting export * statements that cause TypeScript build errors. - BarrelFile pre-scans public exports to detect duplicate names - ExportStatement renders aliased named re-exports for conflicts - Reference resolution uses barrel-exported symbol for correct imports - Added 4 regression tests for various conflict scenarios Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace manual name conflict detection in BarrelFile with the SymbolTable's built-in deconfliction. ExportStatement now creates re-export alias symbols in the barrel module's values SymbolTable, and the defaultConflictHandler automatically renames duplicates. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Add an
internalboolean prop to all declaration components (FunctionDeclaration,VarDeclaration,ClassDeclaration,InterfaceDeclaration,EnumDeclaration,TypeDeclaration). When a declaration has bothexportandinternal, it isexported from its source module but excluded from:
export *)This enables keeping utility declarations importable within a package while hiding them from the generated public API surface.
Additionally, barrel files now detect and resolve name conflicts when multiple source files export symbols with the same name. Instead of emitting conflicting
export *statements that cause TypeScript build errors, the barrel falls back to namedre-exports with deterministic aliases (e.g.
export { helper as helper_1 } from "./b.js"). Cross-package reference resolution uses the aliased name so consumer imports match the barrel's exports.