From 172ef02b52413acdfacd76ae636e8a311aefd29c Mon Sep 17 00:00:00 2001 From: yfwang6 Date: Fri, 22 Jul 2022 17:39:51 +0800 Subject: [PATCH] fixed eaff4a5 from https://gitee.com/yfwang6/developtools_ace-ets2bundle/pulls/865 wangyongfei6@huawei.com remove module_collection.txt and component_collection.txt Signed-off-by: yfwang6 Change-Id: I6c691e4ca2516aeef03247b5b29f720c97da7198 --- compiler/src/compile_info.ts | 33 ------------------------------ compiler/src/ets_checker.ts | 17 --------------- compiler/src/validate_ui_syntax.ts | 2 -- 3 files changed, 52 deletions(-) diff --git a/compiler/src/compile_info.ts b/compiler/src/compile_info.ts index fc577b7..ffc1755 100644 --- a/compiler/src/compile_info.ts +++ b/compiler/src/compile_info.ts @@ -29,7 +29,6 @@ import ConcatSource from 'webpack-sources/lib/ConcatSource'; import { transformLog } from './process_ui_syntax'; import { - moduleCollection, useOSFiles } from './validate_ui_syntax'; import { projectConfig } from '../main'; @@ -46,7 +45,6 @@ import { } from './pre_define'; import { createLanguageService, - appComponentCollection, createWatchCompilerHost } from './ets_checker'; import { globalProgram } from '../main'; @@ -204,37 +202,6 @@ export class ResultStates { } this.printResult(); }); - - if (!projectConfig.isPreview) { - compiler.hooks.compilation.tap('Collect Components And Modules', compilation => { - compilation.hooks.additionalAssets.tapAsync('Collect Components And Modules', callback => { - this.generateCollectionFile(); - callback(); - }); - }); - } - } - - private generateCollectionFile() { - if (projectConfig.aceSuperVisualPath && fs.existsSync(projectConfig.aceSuperVisualPath)) { - appComponentCollection.clear(); - } - if (fs.existsSync(path.resolve(projectConfig.buildPath, './module_collection.txt'))) { - const lastModuleCollection: string = - fs.readFileSync(path.resolve(projectConfig.buildPath, './module_collection.txt')).toString(); - if (lastModuleCollection && lastModuleCollection !== 'NULL') { - lastModuleCollection.split(',').forEach(item => { - moduleCollection.add(item); - }); - } - } - const moduleContent: string = - moduleCollection.size === 0 ? 'NULL' : Array.from(moduleCollection).join(','); - writeFileSync(path.resolve(projectConfig.buildPath, './module_collection.txt'), - moduleContent); - const componentContent: string = Array.from(appComponentCollection).join(','); - writeFileSync(path.resolve(projectConfig.buildPath, './component_collection.txt'), - componentContent); } private printDiagnostic(diagnostic: ts.Diagnostic): void { diff --git a/compiler/src/ets_checker.ts b/compiler/src/ets_checker.ts index 66fb980..7d321f2 100644 --- a/compiler/src/ets_checker.ts +++ b/compiler/src/ets_checker.ts @@ -219,7 +219,6 @@ function getResolveModule(modulePath: string, type): ts.ResolvedModuleFull { } export const dollarCollection: Set = new Set(); -export const appComponentCollection: Set = new Set(); export const decoratorParamsCollection: Set = new Set(); export const extendCollection: Set = new Set(); export const importModuleCollection: Set = new Set(); @@ -229,25 +228,12 @@ function checkUISyntax(source: string, fileName: string): void { if (path.basename(fileName) !== 'app.ets') { const sourceFile: ts.SourceFile = ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.ETS); - collectComponents(sourceFile); parseAllNode(sourceFile, sourceFile); props.push(...dollarCollection, ...decoratorParamsCollection, ...extendCollection); } } } -function collectComponents(node: ts.SourceFile): void { - // @ts-ignore - if (process.env.watchMode !== 'true' && node.identifiers && node.identifiers.size) { - // @ts-ignore - for (const key of node.identifiers.keys()) { - if (JS_BIND_COMPONENTS.has(key)) { - appComponentCollection.add(key); - } - } - } -} - function parseAllNode(node: ts.Node, sourceFileNode: ts.SourceFile): void { if (ts.isStructDeclaration(node)) { if (node.members) { @@ -269,9 +255,6 @@ function parseAllNode(node: ts.Node, sourceFileNode: ts.SourceFile): void { }); } } - if (ts.isIfStatement(node)) { - appComponentCollection.add(COMPONENT_IF); - } if (ts.isMethodDeclaration(node) && node.name.getText() === COMPONENT_BUILD_FUNCTION) { if (node.body && node.body.statements && node.body.statements.length) { const checkProp: ts.NodeArray = node.body.statements; diff --git a/compiler/src/validate_ui_syntax.ts b/compiler/src/validate_ui_syntax.ts index 41ec9fa..3268195 100644 --- a/compiler/src/validate_ui_syntax.ts +++ b/compiler/src/validate_ui_syntax.ts @@ -135,7 +135,6 @@ export const localStoragePropCollection: Map>> = export const isStaticViewCollection: Map = new Map(); export const packageCollection: Map> = new Map(); -export const moduleCollection: Set = new Set(); export const useOSFiles: Set = new Set(); export function validateUISyntax(source: string, content: string, filePath: string, @@ -850,7 +849,6 @@ function getPackageInfo(configFile: string): Array { } function replaceSystemApi(item: string, systemValue: string, moduleType: string, systemKey: string): string { - moduleCollection.add(`${moduleType}.${systemKey}`); if (NATIVE_MODULE.has(`${moduleType}.${systemKey}`)) { item = `var ${systemValue} = globalThis.requireNativeModule('${moduleType}.${systemKey}')`; } else if (moduleType === SYSTEM_PLUGIN) {