• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15class Meta {
16  belongModulePath: string;
17  hostModulesInfo: Array<object>;
18  moduleName: string;
19  pkgName: string;
20  isLocalDependency: boolean;
21  isNodeEntryFile: boolean;
22  pkgPath: string;
23  dependencyPkgInfo: Object;
24  belongProjectPath: string;
25
26  constructor(entryModuleName: string, modulePath: string) {
27    this.belongModulePath = '';
28    this.hostModulesInfo = [];
29    this.moduleName = entryModuleName;
30    this.pkgName = '';
31    this.isLocalDependency = true;
32    this.isNodeEntryFile = false;
33    this.pkgPath = modulePath;
34    this.dependencyPkgInfo = undefined;
35    this.belongProjectPath = '';
36  }
37};
38
39class ModuleInfo {
40  meta: Meta;
41  id: string;
42  importedIdMaps: object = {};
43  importCache = [];
44  isEntry: boolean = false;
45
46  constructor(id: string, entryModuleName: string, modulePath: string) {
47    this.meta = new Meta(entryModuleName, modulePath);
48    this.id = id;
49
50    if (entryModuleName === 'entry') {
51      this.isEntry = true;
52    }
53  }
54
55  setIsLocalDependency(value: boolean) {
56    this.meta.isLocalDependency = value;
57  }
58  setIsNodeEntryFile(value: boolean) {
59    this.meta.isNodeEntryFile = value;
60  }
61
62  setImportedIdMaps(path?: string) { }
63
64  setNodeImportDeclaration() { }
65
66  setNodeImportExpression() { }
67
68  getNodeByType(IMPORT_NODE: string, EXPORTNAME_NODE: string, EXPORTALL_NODE: string, DYNAMICIMPORT_NODE: string) { }
69}
70
71export {
72	ModuleInfo
73};