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 enum StringConstant { 17 /** 18 * 参数类型有callback的function 19 */ 20 ASYNC_CALLBACK_METHOD_KEY = 'AsyncCallback', 21 /** 22 * 参数类型有AsyncCallback的function,设置sync的值 23 */ 24 ASYNC_CALLBACK_METHOD_KEY_CHANGE = 'AsyncCallback', 25 /** 26 * 驼峰校验version 27 */ 28 CHECK_API_VERSION = '11', 29 CONST_KEY_WORD = 'const', 30 /** 31 * class和interface构造函数默认apiName 32 */ 33 CONSTRUCTOR_API_NAME = 'constructor', 34 /** 35 * exportDefault节点apiName前缀 36 */ 37 EXPORT_DEFAULT = 'export_default_', 38 /** 39 * export节点apiName前缀 40 */ 41 EXPORT = 'export_', 42 /** 43 * d.ts文件后缀名 44 */ 45 DTS_EXTENSION = '.d.ts', 46 /** 47 * d.ets文件后缀名 48 */ 49 DETS_EXTENSION = '.d.ets', 50 /** 51 * .ets文件后缀名 52 */ 53 ETS_EXTENSION = '.ets', 54 FA_MODEL_ONLY = 'famodelonly', 55 /** 56 * 返回类型是Promise的function 57 */ 58 PROMISE_METHOD_KEY = 'Promise', 59 /** 60 * 返回类型是Promise的function,设置sync的值 61 */ 62 PROMISE_METHOD_KEY_CHANGE = 'Promise', 63 REFERENCE = '_reference', 64 /** 65 * .ts文件后缀名 66 */ 67 TS_EXTENSION = '.ts', 68 /** 69 * 在基础解析工具中用于存放当前节点的信息 70 */ 71 SELF = '_self', 72 STAGE_MODEL_ONLY = 'stagemodelonly', 73 /** 74 * 输出文件使用utf-8 75 */ 76 UTF8 = 'utf-8', 77 78 /** 79 * 不扫描build-tools目录下的文件 80 */ 81 NOT_SCAN_DIR = 'build-tools', 82} 83 84export enum NumberConstant { 85 /** 86 * 缩进2个空格 87 */ 88 INDENT_SPACE = 2, 89 /** 90 * API层级关系 91 */ 92 RELATION_LENGTH = 2, 93 /** 94 * 默认废弃版本为-1 95 */ 96 DEFAULT_DEPRECATED_VERSION = '-1', 97 /** 98 * 判断字段是否存在 99 */ 100 IS_FIELD_EXIST = 0, 101 /** 102 * 转成二进制 103 */ 104 BINARY_SYSTEM = 2, 105 /** 106 * 表格的行数,代表从第二行开始写信息 107 */ 108 LINE_IN_EXCEL = 2, 109 /** 110 * syscap分隔为数组后,index为2的字段是关键字段 111 */ 112 SYSCAP_KEY_FIELD_INDEX = 2, 113 114 /** 115 *当前版本对应的jsdoc 116 */ 117 DELETE_CURRENT_JS_DOC = -2, 118} 119 120/** 121 * 常用符号存储 122 */ 123export enum PunctuationMark { 124 QUERY = '?', 125 LEFT_BRACKET = '[', 126 RIGHT_BRACKET = ']', 127 LEFT_BRACE = '{', 128 RIGHT_BRACE = '}', 129 LEFT_PARENTHESES = '(', 130 RIGHT_PARENTHESES = ')', 131} 132 133export class EventConstant { 134 static eventNameList: string[] = ['on', 'off', 'emit', 'once']; 135 static eventMethodCheckVersion: number = 10; 136 static eventFirstParamName: string = 'type'; 137} 138