mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-10 18:03:01 +00:00
feat(codegen): add new option exclude for plugin containerLifeCycle
This commit is contained in:
parent
aa1bb1c0d7
commit
7a1b9802a4
@ -16,13 +16,14 @@ import { isJSFunction, isJSExpression } from '@alilc/lowcode-types';
|
||||
import { isJSExpressionFn } from '../../../utils/common';
|
||||
|
||||
export interface PluginConfig {
|
||||
fileType: string;
|
||||
exportNameMapping: Record<string, string>;
|
||||
normalizeNameMapping: Record<string, string>;
|
||||
fileType?: string;
|
||||
exportNameMapping?: Record<string, string>;
|
||||
normalizeNameMapping?: Record<string, string>;
|
||||
exclude?: string[];
|
||||
}
|
||||
|
||||
const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) => {
|
||||
const cfg: PluginConfig = {
|
||||
const cfg = {
|
||||
fileType: FileType.JSX,
|
||||
exportNameMapping: {},
|
||||
normalizeNameMapping: {},
|
||||
@ -56,6 +57,10 @@ const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) =>
|
||||
normalizeName = cfg.normalizeNameMapping[lifeCycleName] || lifeCycleName;
|
||||
}
|
||||
|
||||
if (cfg?.exclude?.includes(normalizeName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const exportName = cfg.exportNameMapping[lifeCycleName] || lifeCycleName;
|
||||
if (normalizeName === 'constructor') {
|
||||
return {
|
||||
@ -97,7 +102,7 @@ const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) =>
|
||||
}),
|
||||
linkAfter: [...DEFAULT_LINK_AFTER[CLASS_DEFINE_CHUNK_NAME.InsMethod]],
|
||||
};
|
||||
});
|
||||
}).filter((i) => !!i);
|
||||
|
||||
next.chunks.push(...chunks.filter((x): x is ICodeChunk => x !== null));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user