From ce2c86de39d7e07bb3790e177ffd0d8b83d58f4e Mon Sep 17 00:00:00 2001 From: puyajun Date: Sat, 22 Jan 2022 15:49:49 +0800 Subject: [PATCH] puyajun@huawei.com builder transmission parameter rule Signed-off-by: puyajun Change-Id: Ib8e3abcc0b5d8f40644230d4f49b5ee9f66ac97c --- compiler/src/compile_info.ts | 12 +-- compiler/src/pre_define.ts | 1 - compiler/src/pre_process.ts | 6 +- compiler/src/process_component_build.ts | 95 ++++++++++--------- compiler/src/process_component_class.ts | 20 ++-- compiler/src/process_component_constructor.ts | 2 +- compiler/src/process_component_member.ts | 6 +- compiler/src/process_custom_component.ts | 63 +++++++++++- compiler/src/process_ui_syntax.ts | 8 +- compiler/src/result_process.ts | 1 - compiler/src/utils.ts | 6 +- compiler/src/validate_ui_syntax.ts | 34 +++---- 12 files changed, 156 insertions(+), 98 deletions(-) diff --git a/compiler/src/compile_info.ts b/compiler/src/compile_info.ts index 90c4685..c279652 100644 --- a/compiler/src/compile_info.ts +++ b/compiler/src/compile_info.ts @@ -92,7 +92,7 @@ export class ResultStates { } ); - compilation.hooks.buildModule.tap("findModule", (module) => { + compilation.hooks.buildModule.tap('findModule', (module) => { if (/node_modules/.test(module.context)) { const modulePath: string = path.resolve(module.resourceResolveData.descriptionFileRoot, MODULE_SHARE_PATH); @@ -113,7 +113,7 @@ export class ResultStates { compilation.hooks.processAssets.tap( { name: 'GLOBAL_COMMON_MODULE_CACHE', - stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS, + stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS }, (assets) => { if (assets['commons.js']) { @@ -133,7 +133,7 @@ export class ResultStates { `globalThis["__common_module_cache__"][moduleId]: null;\n` + `if (commonCachedModule) { return commonCachedModule.exports; }\n` + source.replace('// Execute the module function', - `if (globalThis["__common_module_cache__"] && moduleId.indexOf("?name=") < 0 && ` + + `if (globalThis["__common_module_cache__"] && moduleId.indexOf("?name=") < 0 && ` + `Object.keys(globalThis["__common_module_cache__"]).indexOf(moduleId) >= 0) {\n` + ` globalThis["__common_module_cache__"][moduleId] = module;\n}`); }); @@ -157,12 +157,12 @@ export class ResultStates { compiler.hooks.compilation.tap('Collect Components And Modules', compilation => { compilation.hooks.additionalAssets.tapAsync('Collect Components And Modules', callback => { compilation.assets['./component_collection.txt'] = - new RawSource(Array.from(appComponentCollection).join(",")); + new RawSource(Array.from(appComponentCollection).join(',')); compilation.assets['./module_collection.txt'] = - new RawSource(moduleCollection.size === 0 ? 'NULL' : Array.from(moduleCollection).join(",")); + new RawSource(moduleCollection.size === 0 ? 'NULL' : Array.from(moduleCollection).join(',')); callback(); }); - }) + }); } } diff --git a/compiler/src/pre_define.ts b/compiler/src/pre_define.ts index 33f4f21..8efee8a 100644 --- a/compiler/src/pre_define.ts +++ b/compiler/src/pre_define.ts @@ -182,7 +182,6 @@ export const GEOMETRY_VIEW: string = 'GeometryView'; export const MODULE_SHARE_PATH: string = 'src' + path.sep + 'ets' + path.sep + 'share'; export const BUILD_SHARE_PATH: string = '../share'; -export const CHILD: string = 'child'; export const THIS: string = 'this'; export const STYLES: string = 'Styles'; export const VISUAL_STATE: string = 'visualState'; diff --git a/compiler/src/pre_process.ts b/compiler/src/pre_process.ts index 318ef8e..bab5b8c 100644 --- a/compiler/src/pre_process.ts +++ b/compiler/src/pre_process.ts @@ -70,7 +70,7 @@ function parseStatement(statement: ts.Statement, content: string, log: LogInfo[] if (visualPath && fs.existsSync(visualPath) && statement.members) { statement.members.forEach(member => { if (member.kind && member.kind === ts.SyntaxKind.MethodDeclaration) { - content = parseMember(member, content, log, visualPath) + content = parseMember(member, content, log, visualPath); } }); } @@ -108,7 +108,7 @@ function findVisualFile(filePath: string): string { function getVisualContent(visualPath: string, log: LogInfo[], pos: number): string { const parseContent: any = genETS(fs.readFileSync(visualPath, 'utf-8')); - if (parseContent && parseContent.errorType && parseContent.errorType != '') { + if (parseContent && parseContent.errorType && parseContent.errorType !== '') { log.push({ type: LogType.ERROR, message: parseContent.message, @@ -118,4 +118,4 @@ function getVisualContent(visualPath: string, log: LogInfo[], pos: number): stri return parseContent ? parseContent.ets : null; } -module.exports = preProcess; \ No newline at end of file +module.exports = preProcess; diff --git a/compiler/src/process_component_build.ts b/compiler/src/process_component_build.ts index 78d9fce..ea2b141 100644 --- a/compiler/src/process_component_build.ts +++ b/compiler/src/process_component_build.ts @@ -45,7 +45,6 @@ import { COMPONENT_TRANSITION_NAME, COMPONENT_DEBUGLINE_FUNCTION, ATTRIBUTE_STATESTYLES, - CHILD, THIS, VISUAL_STATE, VIEW_STACK_PROCESSOR, @@ -169,10 +168,11 @@ export function processComponentChild(node: ts.Block | ts.SourceFile, newStateme break; case ComponentType.customComponent: if (index + 1 < array.length && ts.isBlock(array[index + 1])) { - item = processExpressionStatementChange(item, - array[index + 1] as ts.Block, log) + if (processExpressionStatementChange(item, array[index + 1] as ts.Block, log)) { + item = processExpressionStatementChange(item, array[index + 1] as ts.Block, log); + } } - processCustomComponent(item, newStatements, log); + processCustomComponent(item as ts.ExpressionStatement, newStatements, log); break; case ComponentType.forEachComponent: processForEachComponent(item, newStatements, log); @@ -198,43 +198,48 @@ export function processComponentChild(node: ts.Block | ts.SourceFile, newStateme function processExpressionStatementChange(node: ts.ExpressionStatement, nextNode: ts.Block, log: LogInfo[]): ts.ExpressionStatement { - // @ts-ignore - let name = node.expression.expression.escapedText.toString() - let childParam: string; - if (builderParamObjectCollection.get(name) && builderParamObjectCollection.get(name).size > 0) { - builderParamObjectCollection.get(name).forEach((item) => { - childParam = item - }) - // @ts-ignore - const newBlock: ts.Block = processComponentBlock(nextNode, false, log); - const arrowNode: ts.ArrowFunction = ts.factory.createArrowFunction(undefined, undefined, - [], undefined, ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), newBlock); - const newPropertyAssignment:ts.PropertyAssignment = ts.factory.createPropertyAssignment( - ts.factory.createIdentifier(childParam), arrowNode); - // @ts-ignore - let argumentsArray: ts.ObjectLiteralExpression[] = node.expression.arguments; - if (argumentsArray && argumentsArray.length < 1) { - argumentsArray = [ts.factory.createObjectLiteralExpression([newPropertyAssignment], true)] - } else { - // @ts-ignore - argumentsArray = [ts.factory.createObjectLiteralExpression( - // @ts-ignore - node.expression.arguments[0].properties.concat([newPropertyAssignment]), true)] - } - // @ts-ignore - node = ts.factory.updateExpressionStatement(node, ts.factory.updateCallExpression(node.expression, - // @ts-ignore - node.expression.expression, node.expression.expression.typeArguments, argumentsArray)) - return node; + let name: string; + // @ts-ignore + if (node.expression.expression && ts.isIdentifier(node.expression.expression)) { + name = node.expression.expression.escapedText.toString(); + } + if (builderParamObjectCollection.get(name) && + builderParamObjectCollection.get(name).size === 1) { + return processBlockToExpression(node, nextNode, log, name); } else { log.push({ type: LogType.ERROR, - message: `'${name}' should have a property decorated with @ builderparam .`, + message: `In the trailing lambda case, '${name}' must have one and only one property decorated with ` + + `@BuilderParam, and its @BuilderParam expects no parameter.`, pos: node.getStart() }); } } +function processBlockToExpression(node: ts.ExpressionStatement, nextNode: ts.Block, + log: LogInfo[], name: string): ts.ExpressionStatement { + const childParam: string = [...builderParamObjectCollection.get(name)].slice(-1)[0]; + const newBlock: ts.Block = processComponentBlock(nextNode, false, log); + const arrowNode: ts.ArrowFunction = ts.factory.createArrowFunction(undefined, undefined, + [], undefined, ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), newBlock); + const newPropertyAssignment:ts.PropertyAssignment = ts.factory.createPropertyAssignment( + ts.factory.createIdentifier(childParam), arrowNode); + // @ts-ignore + let argumentsArray: ts.ObjectLiteralExpression[] = node.expression.arguments; + if (argumentsArray && !argumentsArray.length) { + argumentsArray = [ts.factory.createObjectLiteralExpression([newPropertyAssignment], true)]; + } else { + argumentsArray = [ts.factory.createObjectLiteralExpression( + // @ts-ignore + node.expression.arguments[0].properties.concat([newPropertyAssignment]), true)]; + } + node = ts.factory.updateExpressionStatement(node, ts.factory.updateCallExpression( + // @ts-ignore + node.expression, node.expression.expression, node.expression.expression.typeArguments, + argumentsArray)); + return node; +} + function processInnerComponent(node: ts.ExpressionStatement, index: number, arr: ts.Statement[], newStatements: ts.Statement[], log: LogInfo[], name: string): void { const res: CreateResult = createComponent(node, COMPONENT_CREATE_FUNCTION); @@ -533,7 +538,7 @@ export function bindComponentAttr(node: ts.ExpressionStatement, identifierNode: } } -function createArrowFunctionFor$$ ($$varExp: ts.Expression): ts.ArrowFunction { +function createArrowFunctionFor$$($$varExp: ts.Expression): ts.ArrowFunction { return ts.factory.createArrowFunction( undefined, undefined, [ts.factory.createParameterDeclaration( @@ -557,7 +562,7 @@ function createArrowFunctionFor$$ ($$varExp: ts.Expression): ts.ArrowFunction { function updateArgumentFor$$(argument: any): ts.Expression { if (ts.isElementAccessExpression(argument)) { return ts.factory.updateElementAccessExpression - (argument, updateArgumentFor$$(argument.expression), argument.argumentExpression); + (argument, updateArgumentFor$$(argument.expression), argument.argumentExpression); } else if (ts.isIdentifier(argument)) { props.push(argument.getText()); if (argument.getText() === $$_THIS) { @@ -567,7 +572,7 @@ function updateArgumentFor$$(argument: any): ts.Expression { } } else if (ts.isPropertyAccessExpression(argument)) { return ts.factory.updatePropertyAccessExpression - (argument, updateArgumentFor$$(argument.expression), argument.name); + (argument, updateArgumentFor$$(argument.expression), argument.name); } } @@ -633,7 +638,7 @@ function addComponentAttr(temp: any, node: ts.Identifier, lastStatement: any, validateStateStyleSyntax(temp, log); } if (isGlobalStyles) { - for (let i=0; i) ts.factory.createStringLiteral(key), ts.isStringLiteral(value) ? ts.factory.createPropertyAccessExpression(ts.factory.createThis(), - ts.factory.createIdentifier(value.text)) : value as ts.PropertyAccessExpression + ts.factory.createIdentifier(value.text)) : value as ts.PropertyAccessExpression ] )); watchStatements.push(watchNode); diff --git a/compiler/src/process_component_member.ts b/compiler/src/process_component_member.ts index 0052cc9..1651e16 100644 --- a/compiler/src/process_component_member.ts +++ b/compiler/src/process_component_member.ts @@ -419,9 +419,9 @@ function createUpdateParams(name: ts.Identifier, decorator: string): ts.Statemen builderParamObjectCollection.set(componentCollection.currentClassName, new Set([])); } builderParamObjectCollection.get(componentCollection.currentClassName) - .add(name.escapedText.toString()) + .add(name.escapedText.toString()); } - updateParamsNode = createUpdateParamsWithoutIf(name, true); + updateParamsNode = createUpdateParamsWithoutIf(name); break; } return updateParamsNode; @@ -437,7 +437,7 @@ function createUpdateParamsWithIf(name: ts.Identifier): ts.IfStatement { createUpdateParamsWithoutIf(name)], true), undefined); } -function createUpdateParamsWithoutIf(name: ts.Identifier, isAdd: boolean = false): ts.ExpressionStatement { +function createUpdateParamsWithoutIf(name: ts.Identifier): ts.ExpressionStatement { return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( createPropertyAccessExpressionWithThis(name.getText()), ts.factory.createToken(ts.SyntaxKind.EqualsToken), diff --git a/compiler/src/process_custom_component.ts b/compiler/src/process_custom_component.ts index 5ac3f84..484f906 100644 --- a/compiler/src/process_custom_component.ts +++ b/compiler/src/process_custom_component.ts @@ -52,6 +52,7 @@ import { createViewCreate, createCustomComponentNewExpression } from './process_component_member'; +import { builderParamObjectCollection } from './process_component_member'; import { LogType, LogInfo, @@ -72,10 +73,44 @@ const decoractorMap: Map>> = new Map( export function processCustomComponent(node: ts.ExpressionStatement, newStatements: ts.Statement[], log: LogInfo[]): void { if (ts.isCallExpression(node.expression)) { - addCustomComponent(node, newStatements, createCustomComponentNewExpression(node.expression), log); + let ischangeNode: boolean = false; + let customComponentNewExpression: ts.NewExpression = createCustomComponentNewExpression( + node.expression); + let argumentsArray: ts.PropertyAssignment[]; + if (isHasChild(node.expression)) { + // @ts-ignore + argumentsArray = node.expression.arguments[0].properties.slice(); + argumentsArray.forEach((item: ts.PropertyAssignment, index: number) => { + if (ts.isCallExpression(item.initializer)) { + ischangeNode = true; + const PropertyAssignmentNode: ts.PropertyAssignment = ts.factory.updatePropertyAssignment( + item, item.name, changeNodeFromCallToArrow(item.initializer)); + argumentsArray.splice(index, 1, PropertyAssignmentNode); + } + }); + if (ischangeNode) { + const newNode: ts.ExpressionStatement = ts.factory.updateExpressionStatement(node, + ts.factory.createNewExpression(node.expression.expression, node.expression.typeArguments, + [ts.factory.createObjectLiteralExpression(argumentsArray, true)])); + customComponentNewExpression = createCustomComponentNewExpression( + newNode.expression as ts.CallExpression); + } + } + addCustomComponent(node, newStatements, customComponentNewExpression, log); } } +function isHasChild(node: ts.CallExpression): boolean { + return node.arguments && node.arguments[0] && ts.isObjectLiteralExpression(node.arguments[0]) && + node.arguments[0].properties && node.arguments[0].properties.length; +} + +function changeNodeFromCallToArrow(node: ts.CallExpression): ts.ArrowFunction { + return ts.factory.createArrowFunction(undefined, undefined, [], undefined, + ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), + ts.factory.createBlock([ts.factory.createExpressionStatement(node)], true)); +} + function addCustomComponent(node: ts.ExpressionStatement, newStatements: ts.Statement[], newNode: ts.NewExpression, log: LogInfo[]): void { if (ts.isNewExpression(newNode)) { @@ -105,13 +140,16 @@ function validateCustomComponentPrams(node: ts.ExpressionStatement, name: string ts.isObjectLiteralExpression(nodeArguments[0])) { const nodeArgument: ts.ObjectLiteralExpression = nodeArguments[0] as ts.ObjectLiteralExpression; nodeArgument.properties.forEach(item => { - if (item.name && item.name.escapedText) { - // @ts-ignore + if (item.name && ts.isIdentifier(item.name)) { curChildProps.add(item.name.escapedText.toString()); } if (isThisProperty(item, propertySet)) { validateStateManagement(item, name, log); if (isNonThisProperty(item, linkSet)) { + if (item.initializer && ts.isCallExpression(item.initializer)) { + item = ts.factory.updatePropertyAssignment(item as ts.PropertyAssignment, + item.name, changeNodeFromCallToArrow(item.initializer)); + } props.push(item); } } else { @@ -119,6 +157,7 @@ function validateCustomComponentPrams(node: ts.ExpressionStatement, name: string } }); } + validateMandatoryToAssignmentViaParam(node, name, curChildProps, log); validateMandatoryToInitViaParam(node, name, curChildProps, log); } @@ -346,11 +385,27 @@ function validateNonExistentProperty(node: ts.ObjectLiteralElementLike, customComponentName: string, log: LogInfo[]): void { log.push({ type: LogType.ERROR, - message: `Property '${node.name.getText()}' does not exist on type '${customComponentName}'.`, + message: `Property '${node.name.escapedText.toString()}' does not exist on type '${customComponentName}'.`, pos: node.name.getStart() }); } +function validateMandatoryToAssignmentViaParam(node: ts.ExpressionStatement, customComponentName: string, + curChildProps: Set, log: LogInfo[]): void { + if (builderParamObjectCollection.get(customComponentName) && + builderParamObjectCollection.get(customComponentName).size) { + builderParamObjectCollection.get(customComponentName).forEach((item) => { + if (!curChildProps.has(item)) { + log.push({ + type: LogType.ERROR, + message: `The property decorated with @BuilderParam '${item}' must be assigned a value .`, + pos: node.getStart() + }); + } + }); + } +} + function validateMandatoryToInitViaParam(node: ts.ExpressionStatement, customComponentName: string, curChildProps: Set, log: LogInfo[]): void { const mandatoryToInitViaParamSet: Set = new Set([ diff --git a/compiler/src/process_ui_syntax.ts b/compiler/src/process_ui_syntax.ts index 481074b..e0d66ce 100644 --- a/compiler/src/process_ui_syntax.ts +++ b/compiler/src/process_ui_syntax.ts @@ -81,7 +81,7 @@ export function processUISyntax(program: ts.Program, ut = false): Function { node = ts.visitEachChild(node, processAllNodes, context); GLOBAL_STYLE_FUNCTION.forEach((block, styleName) => { BUILDIN_STYLE_NAMES.delete(styleName); - }) + }); GLOBAL_STYLE_FUNCTION.clear(); return node; } else { @@ -98,7 +98,7 @@ export function processUISyntax(program: ts.Program, ut = false): Function { componentCollection.currentClassName = null; INNER_STYLE_FUNCTION.forEach((block, styleName) => { BUILDIN_STYLE_NAMES.delete(styleName); - }) + }); INNER_STYLE_FUNCTION.clear(); } else if (ts.isFunctionDeclaration(node)) { if (hasDecorator(node, COMPONENT_EXTEND_DECORATOR)) { @@ -154,7 +154,7 @@ function collectComponents(node: ts.SourceFile): void { // @ts-ignore if (node.identifiers && node.identifiers.size) { // @ts-ignore - for (let key of node.identifiers.keys()) { + for (const key of node.identifiers.keys()) { if (JS_BIND_COMPONENTS.has(key)) { appComponentCollection.add(key); } @@ -186,7 +186,7 @@ function processResourceData(node: ts.CallExpression): ts.Node { return node; } -function createResourceParam(resourceValue: number, resourceType: number,argsArr: ts.Expression[]): +function createResourceParam(resourceValue: number, resourceType: number, argsArr: ts.Expression[]): ts.ObjectLiteralExpression { const resourceParams: ts.ObjectLiteralExpression = ts.factory.createObjectLiteralExpression( [ diff --git a/compiler/src/result_process.ts b/compiler/src/result_process.ts index 46ea792..fb0269a 100644 --- a/compiler/src/result_process.ts +++ b/compiler/src/result_process.ts @@ -14,7 +14,6 @@ */ import ts from 'typescript'; -import path from 'path'; import { BUILD_OFF } from './pre_define'; import { diff --git a/compiler/src/utils.ts b/compiler/src/utils.ts index fdd8cf4..c7a7700 100644 --- a/compiler/src/utils.ts +++ b/compiler/src/utils.ts @@ -159,10 +159,10 @@ export function createFunction(node: ts.Identifier, attrNode: ts.Identifier, } export function circularFile(inputPath: string, outputPath: string): void { - if ((!inputPath) || (!outputPath)) { + if (!inputPath || !outputPath) { return; } - fs.readdir(inputPath, function (err, files) { + fs.readdir(inputPath, function(err, files) { if (!files) { return; } @@ -205,4 +205,4 @@ function mkDir(path_: string): void { mkDir(parent); } fs.mkdirSync(path_); -} \ No newline at end of file +} diff --git a/compiler/src/validate_ui_syntax.ts b/compiler/src/validate_ui_syntax.ts index c57d75f..65e2c65 100644 --- a/compiler/src/validate_ui_syntax.ts +++ b/compiler/src/validate_ui_syntax.ts @@ -183,7 +183,7 @@ function checkComponentDecorator(source: string, filePath: string, } if (ts.isFunctionDeclaration(item) && item.decorators && item.decorators.length === 1 && item.decorators[0].expression && item.decorators[0].expression.getText() === STYLES) { - STYLES_ATTRIBUTE.add(item.name.getText()) + STYLES_ATTRIBUTE.add(item.name.getText()); GLOBAL_STYLE_FUNCTION.set(item.name.getText(), item.body); BUILDIN_STYLE_NAMES.add(item.name.getText()); } @@ -744,7 +744,7 @@ export function sourceReplace(source: string, sourcePath: string): ReplaceResult return { content: content, log: log - } + }; } export function preprocessExtend(content: string, sourcePath: string, log: LogInfo[]): string { @@ -772,7 +772,7 @@ export function preprocessExtend(content: string, sourcePath: string, log: LogIn syntaxCheckContent = content; } if (result.error_otherParsers) { - for(let i = 0; i < result.error_otherParsers.length; i++) { + for (let i = 0; i < result.error_otherParsers.length; i++) { log.push({ type: LogType.ERROR, message: result.error_otherParsers[i].errMessage, @@ -810,24 +810,24 @@ export function processSystemApi(content: string, isProcessWhiteList: boolean = const libSoValue: string = item1 || item3; const libSoKey: string = item2 || item4; return `var ${libSoValue} = globalThis.requireNapi("${libSoKey}", true);`; - }).replace(REG_SYSTEM, (item, item1, item2, item3, item4, item5, item6, item7) => { - let moduleType: string = item2 || item5; - let systemKey: string = item3 || item6; - let systemValue: string = item1 || item4; - moduleCollection.add(`${moduleType}.${systemKey}`); - if (NATIVE_MODULE.has(`${moduleType}.${systemKey}`)) { - item = `var ${systemValue} = globalThis.requireNativeModule('${moduleType}.${systemKey}')`; - } else if (moduleType === SYSTEM_PLUGIN) { - item = `var ${systemValue} = isSystemplugin('${systemKey}', '${SYSTEM_PLUGIN}') ? ` + + }).replace(REG_SYSTEM, (item, item1, item2, item3, item4, item5, item6, item7) => { + const moduleType: string = item2 || item5; + const systemKey: string = item3 || item6; + const systemValue: string = item1 || item4; + moduleCollection.add(`${moduleType}.${systemKey}`); + if (NATIVE_MODULE.has(`${moduleType}.${systemKey}`)) { + item = `var ${systemValue} = globalThis.requireNativeModule('${moduleType}.${systemKey}')`; + } else if (moduleType === SYSTEM_PLUGIN) { + item = `var ${systemValue} = isSystemplugin('${systemKey}', '${SYSTEM_PLUGIN}') ? ` + `globalThis.systemplugin.${systemKey} : globalThis.requireNapi('${systemKey}')`; - } else if (moduleType === OHOS_PLUGIN) { - item = `var ${systemValue} = globalThis.requireNapi('${systemKey}') || ` + + } else if (moduleType === OHOS_PLUGIN) { + item = `var ${systemValue} = globalThis.requireNapi('${systemKey}') || ` + `(isSystemplugin('${systemKey}', '${OHOS_PLUGIN}') ? ` + `globalThis.ohosplugin.${systemKey} : isSystemplugin('${systemKey}', '${SYSTEM_PLUGIN}') ` + `? globalThis.systemplugin.${systemKey} : undefined)`; - } - return item; - }); + } + return item; + }); } function validateWhiteListModule(moduleType: string, systemKey: string): boolean {