@@ -9,6 +9,15 @@ const aiPackageName = '@ui5/webcomponents-ai-react';
99const compatPackageName = '@ui5/webcomponents-react-compat' ;
1010const packageNames = [ mainPackageName , basePackageName , chartsPackageName , aiPackageName , compatPackageName ] ;
1111
12+ const mainPackageReExports = [
13+ 'CommonProps' ,
14+ 'Ui5CustomEvent' ,
15+ 'Ui5DomRef' ,
16+ 'UI5WCSlotsNode' ,
17+ 'withWebComponent' ,
18+ 'WithWebComponentPropTypes' ,
19+ ] ;
20+
1221function getFileNames ( dir : string ) {
1322 let fileNames : string [ ] = [ ] ;
1423 try {
@@ -161,25 +170,35 @@ export default function transform(file: FileInfo, api: API): string | undefined
161170 root . find ( j . ImportDeclaration , { source : { value : pkg } } ) . forEach ( ( importPath ) => {
162171 const specifiers = importPath . node . specifiers || [ ] ;
163172 specifiers . forEach ( ( spec ) => {
164- if ( spec . type !== 'ImportSpecifier' ) return ;
173+ if ( spec . type !== 'ImportSpecifier' ) {
174+ return ;
175+ }
165176 const importedName = spec . imported . name as string ;
166177 let componentName = importedName ;
167178 if ( importedName . endsWith ( 'PropTypes' ) ) {
168179 componentName = importedName . replace ( / P r o p T y p e s $ / , '' ) ;
169- } else if ( importedName . endsWith ( 'Props' ) ) {
180+ } else if ( importedName . endsWith ( 'Props' ) && ! mainPackageReExports . includes ( importedName ) ) {
170181 componentName = componentName . replace ( / P r o p s $ / , '' ) ;
171182 } else if ( importedName . endsWith ( 'DomRef' ) ) {
172183 componentName = componentName . replace ( / D o m R e f $ / , '' ) ;
173184 }
174185
175186 let newSource : string ;
176187 if ( pkg === mainPackageName ) {
177- newSource =
178- componentName !== importedName
179- ? `${ mainPackageName } /${ componentName } `
180- : enumNames . has ( importedName )
181- ? `${ mainPackageName } /enums/${ importedName } `
182- : `${ mainPackageName } /${ importedName } ` ;
188+ if ( mainPackageReExports . includes ( importedName ) ) {
189+ if ( importedName . toLowerCase ( ) . startsWith ( 'withwebcomponent' ) ) {
190+ newSource = `${ basePackageName } /withWebComponent` ;
191+ } else {
192+ newSource = `${ basePackageName } /internal/types` ;
193+ }
194+ } else {
195+ newSource =
196+ componentName !== importedName
197+ ? `${ mainPackageName } /${ componentName } `
198+ : enumNames . has ( importedName )
199+ ? `${ mainPackageName } /enums/${ importedName } `
200+ : `${ mainPackageName } /${ importedName } ` ;
201+ }
183202 } else if ( pkg === basePackageName && importedName !== 'Device' && importedName !== 'hooks' ) {
184203 newSource = resolveBaseExport ( importedName ) || basePackageName ;
185204 } else if ( pkg === chartsPackageName ) {
0 commit comments