1/* 2 * Copyright (c) 2023 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 16export const enum Extension { 17 TS = '.ts', 18 DTS = '.d.ts', 19 JS = '.js', 20 CJS = '.cjs', 21 MJS = '.mjs', 22 JSON = '.json', 23 ETS = '.ets', 24 DETS = '.d.ets' 25} 26 27export interface PathAndExtension { 28 path: string; 29 ext: string | undefined; 30} 31 32export interface ProjectInfo { 33 packageDir: string, 34 projectRootPath: string, 35 localPackageSet: Set<string>, 36 useNormalized: boolean, 37 useTsHar: boolean, 38}; 39 40/** 41 * MangledSymbolInfo: 42 * mangledName - the name of the node after obfuscation 43 * originalNameWithScope - the original name with scope info of the node 44 */ 45export interface MangledSymbolInfo { 46 mangledName: string, 47 originalNameWithScope: string 48} 49 50/** 51 * FilePathObj: 52 * buildFilePath - the absolute path of the source file in the cache directory 53 * relativeFilePath - the relative path of the source file in the module directory 54 */ 55export interface FilePathObj { 56 buildFilePath: string, 57 relativeFilePath: string 58} 59 60export const supportedRunningExtension: readonly string[] = [Extension.TS, Extension.JS]; 61export const supportedDeclarationExtension: readonly string[] = [Extension.DTS, Extension.DETS]; 62 63export const fileExtensions: string[] = [Extension.DETS, Extension.ETS, Extension.DTS, Extension.TS, Extension.JS, Extension.JSON]; 64 65// supported file suffixes from ets-loader. 66export const supportedParsingExtension: string[] = [Extension.ETS, Extension.TS, Extension.JS, Extension.CJS, Extension.MJS]; 67 68// Formatted Error Info for hvigor 69export interface HvigorErrorInfo { 70 code: string; 71 description: string; 72 cause: string; 73 position: string; 74 solutions: string[]; 75 moreInfo?: Object; 76} 77 78// Prefix of annotation declaration in intermediate files 79export const annotationPrefix: string = '__$$ETS_ANNOTATION$$__';