Repository navigation
Conversation
Add a new native `@angular/build:library` builder providing a modern, high-performance compilation and packaging pipeline.
A key and its entry file path in `entryPoints` can each contain one `*`, as with subpath patterns in package.json `exports`. For example `"./*": "projects/lib/*/public-api.ts"` adds an entry point for every matching file, with the matched part of the path, which can include `/`, used in the key. Explicit entry points take precedence over a pattern match with the same name or the same entry file, and a pattern that matches no files is an error. Patterns are expanded when the build starts.
|
Appreciate your contribution! Let's circle back to this after we get the initial API out the door. |
|
@alan-agius4 circling back on this now that builder is out in 22.3.0-next Since entry points moved to library package.json I redid it on top of main, pattern keys with main...thekhegay:angular-cli:library-export-patterns Should I open it as new PR, or better wait until builder settles? |
|
Thanks for following up, @thekhegay. For now, we'd prefer to hold off on supporting subpath patterns/globs for library entry points. Our main concern is that wildcard expansion makes it easy to accidentally expose new public entry points simply by adding a matching file on disk, rather than intentionally declaring public API subpaths in Let's keep entry point definitions explicit for now while the new library builder stabilizes, and we can revisit this in the future if we see significant demand from the community. |
|
@alan-agius4 Makes sense, thanks for looking into it. Will keep explicit map on ngwr for now |
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
Please check to confirm your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
This is on top of #34106, which adds
@angular/build:library, so there is nothing to merge it into yet and only the last commit is new. Draft until #34106 lands. cc @alan-agius4Follow-up to #34106 (comment).
entryPointslists every entry point by hand, so a library with many of them keeps a copy of its folder layout inangular.json, and an entry point missing from it is not published without any error.Issue Number: N/A
What is the new behavior?
A key and its entry file path can each contain one
*, as with subpath patterns in package.jsonexports:*matches any non-empty part of the path, including/, so nested entry points are picked up too. Explicit entries take precedence over a pattern match with the same name or the same file, which also allows renaming one or giving it its owntsConfig. A pattern that matches no files is an error. Patterns are expanded once when the build starts.On ngwr (228 entry points, 99 of them nested) these two lines replace a 230-line map, the output is identical to the build with the explicit map, and the expansion takes ~10 ms.
Does this PR introduce a breaking change?