@@ -40,6 +40,11 @@ export interface ProjectBuilderInitOptions {
4040 inStrictMode ?: boolean ;
4141 /** 一些额外的上下文数据 */
4242 extraContextData ?: Record < string , unknown > ;
43+ /**
44+ * Hook which is used to customize original options, we can reorder/add/remove plugins/processors
45+ * of the existing solution.
46+ */
47+ customizeBuilderOptions ?( originalOptions : ProjectBuilderInitOptions ) : ProjectBuilderInitOptions ;
4348}
4449
4550export class ProjectBuilder implements IProjectBuilder {
@@ -67,16 +72,21 @@ export class ProjectBuilder implements IProjectBuilder {
6772 /** 一些额外的上下文数据 */
6873 readonly extraContextData : IContextData ;
6974
70- constructor ( {
71- template,
72- plugins,
73- postProcessors,
74- schemaParser = new SchemaParser ( ) ,
75- projectPreProcessors = [ ] ,
76- projectPostProcessors = [ ] ,
77- inStrictMode = false ,
78- extraContextData = { } ,
79- } : ProjectBuilderInitOptions ) {
75+ constructor ( builderOptions : ProjectBuilderInitOptions ) {
76+ let customBuilderOptions = builderOptions ;
77+ if ( typeof builderOptions . customizeBuilderOptions === 'function' ) {
78+ customBuilderOptions = builderOptions . customizeBuilderOptions ( builderOptions ) ;
79+ }
80+ const {
81+ template,
82+ plugins,
83+ postProcessors,
84+ schemaParser = new SchemaParser ( ) ,
85+ projectPreProcessors = [ ] ,
86+ projectPostProcessors = [ ] ,
87+ inStrictMode = false ,
88+ extraContextData = { } ,
89+ } = customBuilderOptions ;
8090 this . template = template ;
8191 this . plugins = plugins ;
8292 this . postProcessors = postProcessors ;
0 commit comments