MCPcopy Index your code
hub / github.com/alibaba/lowcode-engine / generateNode

Function generateNode

modules/code-generator/src/utils/nodeToJSX.ts:371–394  ·  view source on GitHub ↗
(nodeItem: IPublicTypeNodeDataType, scope: IScope)

Source from the content-addressed store, hash-verified

369
370export function createNodeGenerator(cfg: NodeGeneratorConfig = {}): NodeGenerator<string> {
371 const generateNode = (nodeItem: IPublicTypeNodeDataType, scope: IScope): string => {
372 if (_.isArray(nodeItem)) {
373 const resList = nodeItem.map((n) => generateNode(n, scope));
374 return handleChildren(resList);
375 }
376
377 if (isNodeSchema(nodeItem)) {
378 return generateNodeSchema(nodeItem, scope, {
379 ...cfg,
380 self: generateNode,
381 });
382 }
383
384 const valueStr = generateCompositeType(nodeItem, scope, {
385 handlers: cfg.handlers,
386 nodeGenerator: generateNode,
387 });
388
389 if (isPureString(valueStr)) {
390 return encodeJsxStringNode(getStaticExprValue<string>(valueStr));
391 }
392
393 return `{${valueStr}}`;
394 };
395
396 return (nodeItem: IPublicTypeNodeDataType, scope: IScope) => unwrapJsExprQuoteInJsx(generateNode(nodeItem, scope));
397}

Callers 1

createNodeGeneratorFunction · 0.85

Calls 8

generateCompositeTypeFunction · 0.90
encodeJsxStringNodeFunction · 0.90
getStaticExprValueFunction · 0.90
handleChildrenFunction · 0.85
generateNodeSchemaFunction · 0.85
isPureStringFunction · 0.85
mapMethod · 0.65
isNodeSchemaFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…