File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed
modules/code-generator/src Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ import {
3232import { SUPPORT_SCHEMA_VERSION_LIST } from '../const' ;
3333
3434import { getErrorMessage } from '../utils/errors' ;
35- import { handleSubNodes , isValidContainerType } from '../utils/schema' ;
35+ import { handleSubNodes , isValidContainerType , ContainerType } from '../utils/schema' ;
3636import { uniqueArray } from '../utils/common' ;
3737import { componentAnalyzer } from '../analyzer/componentAnalyzer' ;
3838import { ensureValidClassName } from '../utils/validate' ;
@@ -161,7 +161,8 @@ export class SchemaParser implements ISchemaParser {
161161 ...subRoot ,
162162 componentName : getRootComponentName ( subRoot . componentName , compDeps ) ,
163163 containerType : subRoot . componentName ,
164- moduleName : ensureValidClassName ( changeCase . pascalCase ( subRoot . fileName ) ) ,
164+ moduleName : ensureValidClassName ( subRoot . componentName === ContainerType . Component ?
165+ subRoot . fileName : changeCase . pascalCase ( subRoot . fileName ) ) ,
165166 } ;
166167 return container ;
167168 } ) ;
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ const pluginFactory: BuilderComponentPluginFactory<unknown> = () => {
4848 type : ChunkType . STRING ,
4949 fileType : FileType . JSX ,
5050 name : CLASS_DEFINE_CHUNK_NAME . InsVar ,
51- content : `static displayName = '${ changeCase . pascalCase ( ir . moduleName ) } ';` ,
51+ content : `static displayName = '${ ir . moduleName } ';` ,
5252 linkAfter : [
5353 CLASS_DEFINE_CHUNK_NAME . Start ,
5454 ] ,
Original file line number Diff line number Diff line change @@ -147,4 +147,10 @@ export function isValidContainerType(schema: IPublicTypeNodeSchema) {
147147 'Component' ,
148148 'Block' ,
149149 ] . includes ( schema . componentName ) ;
150+ }
151+
152+ export const enum ContainerType {
153+ Page = 'Page' ,
154+ Component = 'Component' ,
155+ Block = 'Block' ,
150156}
You can’t perform that action at this time.
0 commit comments