File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -160,11 +160,14 @@ export class IndexGeneratorSource {
160
160
#createBarrelFileKeyGenerator( config : IndexGeneratorSourceConfig ) {
161
161
return function ( key : string ) {
162
162
const paths = key . split ( '/' )
163
- const baseName = new StringBuilder ( paths . pop ( ) ! )
164
- . removeSuffix ( config . removeSuffix ?? '' )
165
- . pascalCase ( )
166
- . toString ( )
167
- return [ ...paths . map ( ( p ) => string . camelCase ( p ) ) , baseName ] . join ( '/' )
163
+ let baseName = new StringBuilder ( paths . pop ( ) ! )
164
+ if ( config . computeBaseName ) {
165
+ baseName = config . computeBaseName ( baseName )
166
+ } else {
167
+ baseName = baseName . removeSuffix ( config . removeSuffix ?? '' ) . pascalCase ( )
168
+ }
169
+
170
+ return [ ...paths . map ( ( p ) => string . camelCase ( p ) ) , baseName . toString ( ) ] . join ( '/' )
168
171
}
169
172
}
170
173
Original file line number Diff line number Diff line change 9
9
10
10
import type { Logger } from '@poppinss/cliui'
11
11
import { type Prettify } from '@poppinss/utils/types'
12
+ import type StringBuilder from '@poppinss/utils/string_builder'
12
13
13
14
import { type AllHooks } from './hooks.ts'
14
15
import { type FileBuffer } from '../file_buffer.ts'
@@ -47,6 +48,7 @@ export type IndexGeneratorSourceConfig = (
47
48
) => void
48
49
}
49
50
) & {
51
+ computeBaseName ?: ( baseName : StringBuilder ) => StringBuilder
50
52
source : string
51
53
output : string
52
54
glob ?: string [ ]
You can’t perform that action at this time.
0 commit comments