Add icons subpath export for individual icon imports - #48
Open
AKnassa wants to merge 1 commit into
Open
Conversation
Expose a `./icons/*` subpath in the package exports so consumers can import a single icon (`import Calendar from "@openai/apps-sdk-ui/icons/Calendar"`) instead of the full Icon barrel. Each icon is a self-contained, side-effect-free module, so tools like Vite and Vitest resolve only the icons in use — measured ~124x faster than importing the barrel in a real consumer. The build already emits one ESM module and one declaration file per icon, so this is a package.json exports addition with no build changes. Adds tests covering the exports shape, the barrel/svg drift guard, per-icon module invariants, and rendering, plus a short usage note in the icons docs. Closes openai#46 Claude-Session: https://claude.ai/code/session_0161i4JkZ3RTQVY3XhtdN1hJ
|
@AKnassa how were you able to open this PR? I was blocked by permissions checks from pushing my branch up to |
AKnassa
marked this pull request as ready for review
July 8, 2026 22:00
Author
|
Hey @ellismarkf 👋 Yeah, direct pushes to
That cross-repo flow is the standard way to contribute here, so you never touch |
|
@moustafa-openai @tylersmith-openai Tagging some OpenAI contributors. Are there any plans to review and merge open PRs? |
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.
What this does
Adds a
./icons/*subpath to the packageexportsso consumers can import a single icon directly:instead of pulling in the full
components/Iconbarrel.Why
Importing from
@openai/apps-sdk-ui/components/Iconresolves the ~745-export barrel, which adds real overhead in tooling like Vite/Vitest even when only a few icons are used (see #46). Each icon is a self-contained, side-effect-free module, so a direct subpath import resolves only what's actually used. Measured in a real installed consumer, a single-icon import took ~8 ms vs ~960 ms for the barrel — roughly 124x faster.What changed
package.json— one newexportsentry,"./icons/*", mirroring the existing./hooks/*wildcard shape (typesbeforedefault). No build changes:tscalready emits one ESM module and one.d.tsper icon underdist/{es,types}/components/Icon/svg/, and the existingfilesglobs already ship them.src/components/Icon/Icon.test.tsx) — exports-map shape and condition order, a pre-existing-exports regression guard, svg-dir purity, a case-collision guard, a "no runtime imports" invariant (keeps each icon module barrel-free), a default-export invariant, a barrel↔disk drift guard, and render smoke tests.Icons.mdx,README.md, andInstallation.mdxshowing the individual-import form (plus the one naming exception: theObjecticon is imported asicons/ObjectIcon).@types/nodeadded todevDependencies— the new test reads the manifest and icon directory vianode:fs/node:path/node:url; it was previously only a transitive dependency.Notes for reviewers
svg/but aren't in theIconbarrel (Instagram, Youtube, etc.). They already ship indist; if you'd rather keep them out of the public surface, I'm happy to exclude them as a follow-up — just say the word.src/(contrary to theAGENTS.mdguideline):package.json, because subpath exports can only be declared there, andREADME.md, to keep it in sync with itssrc/Installation.mdxtwin.bundlerandnode16/nodenext.npm run format/lint/types/testall pass.Closes #46