• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 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 */
15
16import * as ts from 'typescript';
17
18export interface ArkTSEvolutionModule {
19  language: string;
20  packageName: string;
21  moduleName: string;
22  modulePath: string;
23  declgenV1OutPath?: string;
24  declgenV2OutPath?: string;
25  declgenBridgeCodePath?: string;
26  declFilesPath?: string;
27  dynamicFiles: string[];
28  staticFiles: string[];
29  cachePath: string;
30  byteCodeHarInfo?: Object;
31  packageVersion: string;
32}
33
34export interface Params {
35  dependentModuleMap: Map<string, ArkTSEvolutionModule>;
36  projectConfig: ProjectConfig;
37  tasks: taskInfo[];
38}
39
40export interface ProjectConfig {
41  cachePath: string;
42  bundleName: string;
43  mainModuleName: string;
44  projectRootPath: string;
45};
46
47export enum BuildType {
48  DECLGEN = 'declgen',
49  BYTE_CODE_HAR = 'byteCodeHar',
50  INTEROP_CONTEXT = 'interopContext'
51}
52
53interface taskInfo {
54  packageName: string;
55  buildTask: BuildType;
56  mainModuleName?: string;
57}
58
59export interface AliasConfig {
60  originalAPIName: string;
61  isStatic: boolean;
62}
63
64export interface FileInfo {
65  recordName: string;
66  baseUrl: string;
67  absolutePath: string;
68  abstractPath: string;
69}
70
71export interface RunnerParms {
72  inputDirs: string[];
73  inputFiles: string[];
74  outDir: string;
75  rootDir: string;
76  customResolveModuleNames?: (moduleName: string[], containingFile: string) => ts.ResolvedModuleFull[];
77  customCompilerOptions?: ts.CompilerOptions;
78  includePaths?: string[];
79}
80
81export interface DeclFilesConfig {
82  packageName: string;
83  files: {
84    [filePath: string]: DeclFileConfig;
85  }
86}
87
88interface DeclFileConfig {
89  declPath: string;
90  ohmUrl: string;
91  isNative?: boolean
92}
93
94export interface Params {
95  dependentModuleMap: Map<string, ArkTSEvolutionModule>;
96  projectConfig: ProjectConfig;
97  tasks: taskInfo[];
98}
99
100interface taskInfo {
101  packageName: string;
102  buildTask: BuildType
103}
104
105export interface AliasConfig {
106  originalAPIName: string;
107  isStatic: boolean;
108}
109
110export interface FileInfo {
111  recordName: string;
112  baseUrl: string;
113  abstractPath: string;
114}
115export const DECLGEN_CACHE_FILE = 'declgen_cache.json';
116