@@ -33,6 +33,12 @@ const EXCLUDED_EXPORTS = new Set([
3333 "./use-render" , // Internal hook
3434] ) ;
3535
36+ const COMPATIBILITY_EXPORTS : Record < string , string [ ] > = {
37+ "otp-field" : [
38+ 'export { OTPField as OTPFieldPreview } from "@base-ui/react/otp-field";' ,
39+ ] ,
40+ } ;
41+
3642function main ( ) {
3743 // Read base-ui package.json
3844 if ( ! existsSync ( BASE_UI_PACKAGE ) ) {
@@ -97,6 +103,7 @@ function generateBarrelExport(subpaths: string[]) {
97103 for ( const subpath of subpaths ) {
98104 const modulePath = `@base-ui/react/${ subpath . replace ( "./" , "" ) } ` ;
99105 lines . push ( `export * from "${ modulePath } ";` ) ;
106+ lines . push ( ...( COMPATIBILITY_EXPORTS [ subpath . replace ( "./" , "" ) ] ?? [ ] ) ) ;
100107 }
101108 lines . push ( "" ) ;
102109
@@ -109,6 +116,7 @@ function generateIndividualPrimitives(subpaths: string[]) {
109116 const primitiveFile = join ( PRIMITIVES_DIR , `${ primitiveName } .ts` ) ;
110117 const modulePath = `@base-ui/react/${ primitiveName } ` ;
111118
119+ const compatibilityExports = COMPATIBILITY_EXPORTS [ primitiveName ] ?? [ ] ;
112120 const content = [
113121 "/**" ,
114122 ` * ${ primitiveName } primitive` ,
@@ -123,6 +131,7 @@ function generateIndividualPrimitives(subpaths: string[]) {
123131 " */" ,
124132 "" ,
125133 `export * from "${ modulePath } ";` ,
134+ ...compatibilityExports ,
126135 "" ,
127136 ] . join ( "\n" ) ;
128137
0 commit comments