@@ -3,6 +3,7 @@ const path = require("path");
33
44const rootPath = process . cwd ( ) ;
55const distIndexPath = path . join ( rootPath , "packages/core/dist/src/index.js" ) ;
6+ const distNextPath = path . join ( rootPath , "packages/core/dist/src/components/next.js" ) ;
67const componentsPath = path . join ( rootPath , "packages/components" ) ;
78const sizeLimitConfigPath = path . join ( rootPath , ".size-limit.js" ) ;
89
@@ -27,6 +28,26 @@ function generateSizeLimitConfig() {
2728 console . log ( `Core dist index file not found at ${ distIndexPath } .` ) ;
2829 }
2930
31+ // Process @next components
32+ if ( fs . existsSync ( distNextPath ) ) {
33+ const nextContent = fs . readFileSync ( distNextPath , "utf8" ) ;
34+ const exportRegex = / e x p o r t \{ .* ?\} f r o m " ( \. \/ [ ^ " ] + \. j s ) " ; / g;
35+
36+ let match ;
37+ let nextComponentsCount = 0 ;
38+ while ( ( match = exportRegex . exec ( nextContent ) ) !== null ) {
39+ const relativePath = match [ 1 ] ;
40+ const fullPath = path . join ( "packages/core/dist/src/components/" , relativePath ) . replace ( / \\ / g, "/" ) ;
41+ allComponents . push ( {
42+ path : fullPath
43+ } ) ;
44+ nextComponentsCount ++ ;
45+ }
46+ console . log ( `Found ${ nextComponentsCount } @next components.` ) ;
47+ } else {
48+ console . log ( `@next dist file not found at ${ distNextPath } .` ) ;
49+ }
50+
3051 // Process component packages
3152 if ( fs . existsSync ( componentsPath ) ) {
3253 const componentPackages = fs
0 commit comments