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 50export const supportedRunningExtension: readonly string[] = [Extension.TS, Extension.JS]; 51export const supportedDeclarationExtension: readonly string[] = [Extension.DTS, Extension.DETS]; 52 53export const fileExtensions: string[] = [Extension.DETS, Extension.ETS, Extension.DTS, Extension.TS, Extension.JS, Extension.JSON]; 54 55// supported file suffixes from ets-loader. 56export const supportedParsingExtension: string[] = [Extension.ETS, Extension.TS, Extension.JS, Extension.CJS, Extension.MJS];