feat(api): add analyzeExports with symbolic mode#16
Open
privatenumber wants to merge 1 commit into
Open
Conversation
17a19ff to
d6d469b
Compare
Add new analyzeExports() function that works without filesystem access. - Add analyzeExports(exports, packageFiles?) public API - Support symbolic mode (no packageFiles): wildcards returned as patterns - Support concrete mode (with packageFiles): wildcards matched against files - Refactor getPackageEntryPoints to use analyzeExports internally - Add 10 new tests for symbolic mode (90 tests total) - Update README with analyzeExports documentation - Add PLAYGROUND.md for future interactive playground When packageFiles is omitted or empty: - Wildcard patterns returned as-is with pattern itself - Static paths accepted without validation - Useful for analysis tools and playgrounds without filesystem When packageFiles is provided: - Wildcard patterns matched against provided files - Static paths validated against file list - Original behavior maintained No breaking changes - all existing functionality works as before.
ca62287 to
519c038
Compare
575c4c2 to
28d16f9
Compare
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.
Problem
The library currently requires filesystem access to analyze package exports. This makes it impossible to use in:
Changes
New Public API
Added
analyzeExports(exports, packageFiles?)function that operates in two modes:Symbolic Mode (when
packageFilesis omitted):Concrete Mode (when
packageFilesis provided):Implementation Details
getConditions()to check for emptypackageFilesarray[[exports, '*']]for wildcardsgetPackageEntryPoints()andgetPackageEntryPointsSync()to useanalyzeExports()internallyTest Coverage
tests/specs/symbolic-mode.tsDocumentation
analyzeExports()getPackageEntryPointsSync()Future Work
PLAYGROUND.mdoutlining plan for interactive playgroundExample
Files Changed
src/index.ts- AddedanalyzeExports(), modifiedgetConditions()tests/specs/symbolic-mode.ts- New test suitetests/index.ts- Import symbolic mode testsREADME.md- API documentationPLAYGROUND.md- Future playground plan