GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(codegen): add new option exclude for plugin containerLifeCycle · timeless1406/lowcode-engine@7a1b980

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • modules/code-generator/src/plugins/component/react
    • containerLifeCycle.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎modules/code-generator/src/plugins/component/react/containerLifeCycle.ts‎

Copy file name to clipboardExpand all lines: modules/code-generator/src/plugins/component/react/containerLifeCycle.ts
+10-5Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ import { isJSFunction, isJSExpression } from '@alilc/lowcode-types';
1616
import { isJSExpressionFn } from '../../../utils/common';
1717

1818
export interface PluginConfig {
19-
fileType: string;
20-
exportNameMapping: Record<string, string>;
21-
normalizeNameMapping: Record<string, string>;
19+
fileType?: string;
20+
exportNameMapping?: Record<string, string>;
21+
normalizeNameMapping?: Record<string, string>;
22+
exclude?: string[];
2223
}
2324

2425
const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) => {
25-
const cfg: PluginConfig = {
26+
const cfg = {
2627
fileType: FileType.JSX,
2728
exportNameMapping: {},
2829
normalizeNameMapping: {},
@@ -56,6 +57,10 @@ const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) =>
5657
normalizeName = cfg.normalizeNameMapping[lifeCycleName] || lifeCycleName;
5758
}
5859

60+
if (cfg?.exclude?.includes(normalizeName)) {
61+
return null;
62+
}
63+
5964
const exportName = cfg.exportNameMapping[lifeCycleName] || lifeCycleName;
6065
if (normalizeName === 'constructor') {
6166
return {
@@ -97,7 +102,7 @@ const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) =>
97102
}),
98103
linkAfter: [...DEFAULT_LINK_AFTER[CLASS_DEFINE_CHUNK_NAME.InsMethod]],
99104
};
100-
});
105+
}).filter((i) => !!i);
101106

102107
next.chunks.push(...chunks.filter((x): x is ICodeChunk => x !== null));
103108
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.