Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix: remove internal-only exports from public API (#1603)

Cindy Zhangc732add9969a
diff --git a/packages/core/package.json b/packages/core/package.json
index 40bb9f1961..a3e70f8fcc 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -280,12 +280,6 @@
"import": "./dist/NavIcon/index.mjs",
"require": "./dist/NavIcon/index.js"
},
- "./NavItem": {
- "source": "./src/NavItem/index.ts",
- "types": "./dist/NavItem/index.d.ts",
- "import": "./dist/NavItem/index.mjs",
- "require": "./dist/NavItem/index.js"
- },
"./NavMenu": {
"source": "./src/NavMenu/index.ts",
"types": "./dist/NavMenu/index.d.ts",
diff --git a/packages/core/src/Calendar/index.ts b/packages/core/src/Calendar/index.ts
index aeca103cdf..043fc65d70 100644
--- a/packages/core/src/Calendar/index.ts
+++ b/packages/core/src/Calendar/index.ts
@@ -46,4 +46,4 @@ export {
} from './utils';
// Re-export theme styles for customization
-export {dayCellTheme} from './styles';
+
diff --git a/packages/core/src/Selector/index.ts b/packages/core/src/Selector/index.ts
index ed91c89130..071181781a 100644
--- a/packages/core/src/Selector/index.ts
+++ b/packages/core/src/Selector/index.ts
@@ -20,11 +20,4 @@ export type {
XDSSelectorDivider,
XDSSelectorSection,
} from './types';
-export {
- isOptionData,
- isDivider,
- isSection,
- normalizeOption,
- getSelectableOptions,
-} from './utils';
export {useCombobox, useSelectedItemOffset} from './hooks';
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index 6e7e8d4d31..ec7a46be39 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -38,7 +38,7 @@ export * from './Link';
export * from './List';
export * from './MetadataList';
export * from './NavIcon';
-export * from './NavItem';
+// NavItem (navItemStyles) is internal — shared styles consumed by SideNav/TopNav/MobileNav
export * from './NavMenu';
export * from './Slider';
export * from './Stack';
diff --git a/packages/core/src/theme/index.ts b/packages/core/src/theme/index.ts
index 01bff678f5..71ba40b5d8 100644
--- a/packages/core/src/theme/index.ts
+++ b/packages/core/src/theme/index.ts
@@ -51,7 +51,7 @@ export {
} from './domainTokens';
// Syntax theme API
-export {defineSyntaxTheme, syntaxThemeStyle, syntaxThemeToCSS} from './syntax';
+export {defineSyntaxTheme} from './syntax';
export type {
SyntaxTheme,
SyntaxThemeInput,
@@ -133,12 +133,7 @@ export type {
export {useXDSTheme} from './useXDSTheme';
export type {UseXDSThemeReturn} from './useXDSTheme';
-export {
- defaultOnDarkTokens,
- defaultOnLightTokens,
- resolveOnMedia,
-} from './onMediaTokens';
-export type {OnMediaOverrides, ResolvedOnMedia} from './onMediaTokens';
+
export type {
ThemeMode,
@@ -153,8 +148,4 @@ export type {
FontWeight,
} from './types';
-export {
- derivedVarRegistry,
- getDerivedVars,
- type DerivedVarEntry,
-} from './derivedVarRegistry';
+
diff --git a/scripts/sync-exports.js b/scripts/sync-exports.js
index 66a0d872d5..17bced062a 100644
--- a/scripts/sync-exports.js
+++ b/scripts/sync-exports.js
@@ -37,6 +37,13 @@ const CHECK_MODE = process.argv.includes('--check');
*/
const UTILITY_DIRS = new Set(['hooks', 'theme', 'utils']);
+/**
+ * Internal directories that have an index.ts but should NOT be
+ * publicly exported. These are shared implementation details
+ * consumed by other components via relative imports.
+ */
+const INTERNAL_DIRS = new Set(['NavItem']);
+
/**
* Additional exports that can't be auto-discovered from directory structure.
* These are maintained manually here as the single source of truth.
@@ -75,6 +82,7 @@ function discoverExportDirs() {
for (const entry of entries) {
if (!entry.isDirectory()) continue;
+ if (INTERNAL_DIRS.has(entry.name)) continue;
const indexPath = path.join(SRC_DIR, entry.name, 'index.ts');
if (fs.existsSync(indexPath)) {