!865 remove module_collection.txt and component_collection.txt

Merge pull request !865 from yfwang6/removecollection
This commit is contained in:
openharmony_ci
2022-07-26 07:40:10 +00:00
committed by Gitee
3 changed files with 0 additions and 52 deletions
-33
View File
@@ -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 {
-17
View File
@@ -219,7 +219,6 @@ function getResolveModule(modulePath: string, type): ts.ResolvedModuleFull {
}
export const dollarCollection: Set<string> = new Set();
export const appComponentCollection: Set<string> = new Set();
export const decoratorParamsCollection: Set<string> = new Set();
export const extendCollection: Set<string> = new Set();
export const importModuleCollection: Set<string> = 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<ts.Statement> = node.body.statements;
-2
View File
@@ -136,7 +136,6 @@ export const localStoragePropCollection: Map<string, Map<string, Set<string>>> =
export const isStaticViewCollection: Map<string, boolean> = new Map();
export const packageCollection: Map<string, Array<string>> = new Map();
export const moduleCollection: Set<string> = new Set();
export const useOSFiles: Set<string> = new Set();
export function validateUISyntax(source: string, content: string, filePath: string,
@@ -851,7 +850,6 @@ function getPackageInfo(configFile: string): Array<string> {
}
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) {