@hadss/hmrouter-plugin 1.1.1-alpha.0 → 1.2.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -56
- package/dist/HMRouterPluginManager.d.ts +3 -1
- package/dist/HMRouterPluginManager.js +26 -8
- package/dist/Index.d.ts +5 -0
- package/dist/Index.js +29 -1
- package/dist/framework/core/PluginExecutionController.d.ts +11 -0
- package/dist/framework/core/PluginExecutionController.js +129 -22
- package/dist/framework/core/TaskManager.js +6 -5
- package/dist/framework/utils/FileUtil.d.ts +4 -0
- package/dist/framework/utils/FileUtil.js +11 -0
- package/dist/hmrouter_extension/HMRouterExtension.d.ts +1 -0
- package/dist/hmrouter_extension/HMRouterExtension.js +55 -0
- package/dist/hmrouter_extension/analyzer/ComponentAnalyzer.js +0 -1
- package/dist/hmrouter_extension/analyzer/RouterAnalyzer.d.ts +1 -0
- package/dist/hmrouter_extension/analyzer/RouterAnalyzer.js +16 -8
- package/dist/hmrouter_extension/config/HMRouterPluginConfig.js +3 -4
- package/dist/hmrouter_extension/constants/PluginConstants.d.ts +1 -0
- package/dist/hmrouter_extension/constants/PluginConstants.js +1 -0
- package/dist/hmrouter_extension/processor/CodeGenerationProcessor.js +2 -1
- package/dist/hmrouter_extension/processor/InitializerProcessor.d.ts +1 -0
- package/dist/hmrouter_extension/processor/InitializerProcessor.js +30 -5
- package/dist/hmrouter_extension/processor/ObfuscationProcessor.d.ts +0 -1
- package/dist/hmrouter_extension/processor/ObfuscationProcessor.js +6 -9
- package/dist/hmrouter_extension/processor/ResourceProcessor.js +14 -0
- package/dist/hmrouter_extension/processor/RouterMapBuildingProcessor.js +2 -6
- package/package.json +2 -1
- package/template/viewBuilder.ejs +1 -1
- package/dist/HMRouterAnalyzer.d.ts +0 -31
- package/dist/HMRouterAnalyzer.js +0 -343
- package/dist/HMRouterHvigorPlugin.d.ts +0 -15
- package/dist/HMRouterHvigorPlugin.js +0 -153
- package/dist/HMRouterPluginConfig.d.ts +0 -39
- package/dist/HMRouterPluginConfig.js +0 -74
- package/dist/HMRouterPluginHandle.d.ts +0 -23
- package/dist/HMRouterPluginHandle.js +0 -222
- package/dist/common/Logger.d.ts +0 -13
- package/dist/common/Logger.js +0 -55
- package/dist/common/PluginModel.d.ts +0 -51
- package/dist/common/PluginModel.js +0 -23
- package/dist/constants/CommonConstants.d.ts +0 -39
- package/dist/constants/CommonConstants.js +0 -46
- package/dist/constants/ConfigConstants.d.ts +0 -12
- package/dist/constants/ConfigConstants.js +0 -16
- package/dist/constants/TaskConstants.d.ts +0 -9
- package/dist/constants/TaskConstants.js +0 -13
- package/dist/store/PluginStore.d.ts +0 -14
- package/dist/store/PluginStore.js +0 -20
- package/dist/utils/FileUtil.d.ts +0 -13
- package/dist/utils/FileUtil.js +0 -20
- package/dist/utils/ObfuscationUtil.d.ts +0 -4
- package/dist/utils/ObfuscationUtil.js +0 -34
- package/dist/utils/StringUtil.d.ts +0 -3
- package/dist/utils/StringUtil.js +0 -18
- package/dist/utils/TsAstUtil.d.ts +0 -9
- package/dist/utils/TsAstUtil.js +0 -97
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.HMRouterPluginHandle = void 0;
|
|
7
|
-
const hvigor_ohos_plugin_1 = require("@ohos/hvigor-ohos-plugin");
|
|
8
|
-
const HMRouterPluginConfig_1 = require("./HMRouterPluginConfig");
|
|
9
|
-
const HMRouterHvigorPlugin_1 = require("./HMRouterHvigorPlugin");
|
|
10
|
-
const Logger_1 = require("./common/Logger");
|
|
11
|
-
const CommonConstants_1 = __importDefault(require("./constants/CommonConstants"));
|
|
12
|
-
const TaskConstants_1 = __importDefault(require("./constants/TaskConstants"));
|
|
13
|
-
const FileUtil_1 = __importDefault(require("./utils/FileUtil"));
|
|
14
|
-
const ObfuscationUtil_1 = __importDefault(require("./utils/ObfuscationUtil"));
|
|
15
|
-
const PluginStore_1 = __importDefault(require("./store/PluginStore"));
|
|
16
|
-
class HMRouterPluginHandle {
|
|
17
|
-
constructor(node, moduleContext) {
|
|
18
|
-
this.node = node;
|
|
19
|
-
this.moduleContext = moduleContext;
|
|
20
|
-
this.config = this.readConfig();
|
|
21
|
-
this.appContext = this.node.getParentNode()?.getContext(hvigor_ohos_plugin_1.OhosPluginId.OHOS_APP_PLUGIN);
|
|
22
|
-
PluginStore_1.default.getInstance().projectFilePath = this.appContext.getProjectPath();
|
|
23
|
-
this.plugin = new HMRouterHvigorPlugin_1.HMRouterHvigorPlugin(this.config);
|
|
24
|
-
}
|
|
25
|
-
start() {
|
|
26
|
-
Logger_1.Logger.info(`Exec ${this.moduleContext.getModuleType()}Plugin..., node:${this.node.getNodeName()}, nodePath:${this.node.getNodePath()}`);
|
|
27
|
-
this.moduleContext.targets((target) => {
|
|
28
|
-
const targetName = target.getTargetName();
|
|
29
|
-
this.node.registerTask({
|
|
30
|
-
name: targetName + TaskConstants_1.default.PLUGIN_TASK,
|
|
31
|
-
run: () => {
|
|
32
|
-
this.taskExec();
|
|
33
|
-
this.plugin.scanFiles = [];
|
|
34
|
-
this.plugin.routerMap = [];
|
|
35
|
-
},
|
|
36
|
-
dependencies: [targetName + TaskConstants_1.default.PRE_BUILD],
|
|
37
|
-
postDependencies: [targetName + TaskConstants_1.default.MERGE_PROFILE]
|
|
38
|
-
});
|
|
39
|
-
this.node.registerTask({
|
|
40
|
-
name: targetName + TaskConstants_1.default.COPY_ROUTER_MAP_TASK,
|
|
41
|
-
run: () => {
|
|
42
|
-
this.copyRouterMapToRawFileTask(target.getBuildTargetOutputPath(), targetName);
|
|
43
|
-
this.writeHspModuleName();
|
|
44
|
-
},
|
|
45
|
-
dependencies: [targetName + TaskConstants_1.default.PROCESS_ROUTER_MAP],
|
|
46
|
-
postDependencies: [targetName + TaskConstants_1.default.PROCESS_RESOURCE]
|
|
47
|
-
});
|
|
48
|
-
this.node.registerTask({
|
|
49
|
-
name: targetName + TaskConstants_1.default.GENERATE_OBFUSCATION_TASK,
|
|
50
|
-
run: () => {
|
|
51
|
-
this.generateObfuscationFileTask(this.moduleContext.getBuildProfileOpt());
|
|
52
|
-
},
|
|
53
|
-
dependencies: [targetName + TaskConstants_1.default.PLUGIN_TASK],
|
|
54
|
-
postDependencies: [targetName + TaskConstants_1.default.MERGE_PROFILE]
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
generateObfuscationFileTask(buildProfileOpt) {
|
|
59
|
-
if (!this.isEnableObfuscation(buildProfileOpt)) {
|
|
60
|
-
Logger_1.Logger.info('This compilation does not turn on code obfuscation, skip hmrouter_obfuscation_rules.txt file generation');
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
let obfuscationFilePath = FileUtil_1.default.pathResolve(this.config.modulePath, CommonConstants_1.default.OBFUSCATION_FILE_NAME);
|
|
64
|
-
let routerMap = JSON.parse(FileUtil_1.default.readFileSync(this.config.getRouterMapDir()).toString()).routerMap;
|
|
65
|
-
let obfuscationString = ObfuscationUtil_1.default.buildObfuscatedStrings(routerMap);
|
|
66
|
-
FileUtil_1.default.ensureFileSync(obfuscationFilePath);
|
|
67
|
-
FileUtil_1.default.writeFileSync(obfuscationFilePath, obfuscationString);
|
|
68
|
-
if (this.moduleContext.getModuleType() === CommonConstants_1.default.HAR_MODULE_NAME) {
|
|
69
|
-
let consumerRulesPath = FileUtil_1.default.pathResolve(this.config.modulePath, CommonConstants_1.default.CONSUMER_FILE_NAME);
|
|
70
|
-
FileUtil_1.default.ensureFileSync(consumerRulesPath);
|
|
71
|
-
FileUtil_1.default.writeFileSync(consumerRulesPath, obfuscationString);
|
|
72
|
-
}
|
|
73
|
-
Logger_1.Logger.info('Generate obfuscation rule file successfully, filePath:', obfuscationFilePath);
|
|
74
|
-
}
|
|
75
|
-
isEnableObfuscation(buildProfileOpt) {
|
|
76
|
-
let currentBuildMode = this.appContext.getBuildMode();
|
|
77
|
-
let buildOption = buildProfileOpt.buildOptionSet?.find((item) => {
|
|
78
|
-
return item.name == currentBuildMode;
|
|
79
|
-
});
|
|
80
|
-
if (!buildOption)
|
|
81
|
-
return false;
|
|
82
|
-
let ruleOptions = this.ensureNestedObject(buildOption, ['arkOptions', 'obfuscation', 'ruleOptions']);
|
|
83
|
-
if (this.config.autoObfuscation && ruleOptions.enable) {
|
|
84
|
-
let files = this.ensureNestedObject(buildOption, ['arkOptions', 'obfuscation', 'ruleOptions', 'files']);
|
|
85
|
-
let obfuscationFilePath = CommonConstants_1.default.CURRENT_DELIMITER +
|
|
86
|
-
CommonConstants_1.default.OBFUSCATION_FILE_NAME;
|
|
87
|
-
if (typeof files === 'string') {
|
|
88
|
-
ruleOptions.files = [files, obfuscationFilePath];
|
|
89
|
-
}
|
|
90
|
-
else if (Array.isArray(files)) {
|
|
91
|
-
files.push(obfuscationFilePath);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
ruleOptions.files = obfuscationFilePath;
|
|
95
|
-
}
|
|
96
|
-
if (this.moduleContext.getModuleType() === CommonConstants_1.default.HAR_MODULE_NAME) {
|
|
97
|
-
let consumerFiles = this.ensureNestedObject(buildOption, ['arkOptions', 'obfuscation', 'consumerFiles']);
|
|
98
|
-
let consumerRulesPath = CommonConstants_1.default.CURRENT_DELIMITER +
|
|
99
|
-
CommonConstants_1.default.CONSUMER_FILE_NAME;
|
|
100
|
-
if (typeof consumerFiles === 'string') {
|
|
101
|
-
this.ensureNestedObject(buildOption, ['arkOptions', 'obfuscation']).consumerFiles =
|
|
102
|
-
[consumerFiles, consumerRulesPath];
|
|
103
|
-
}
|
|
104
|
-
else if (Array.isArray(consumerFiles)) {
|
|
105
|
-
consumerFiles.push(consumerRulesPath);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
this.ensureNestedObject(buildOption, ['arkOptions', 'obfuscation']).consumerFiles = consumerRulesPath;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
this.moduleContext.setBuildProfileOpt(buildProfileOpt);
|
|
112
|
-
}
|
|
113
|
-
return ruleOptions.enable;
|
|
114
|
-
}
|
|
115
|
-
copyRouterMapToRawFileTask(buildOutputPath, targetName) {
|
|
116
|
-
let routerMapFilePath = FileUtil_1.default.pathResolve(buildOutputPath, CommonConstants_1.default.TEMP_ROUTER_MAP_PATH, targetName, CommonConstants_1.default.ROUTER_MAP_NAME);
|
|
117
|
-
let rawFilePath = this.config.getRawFilePath();
|
|
118
|
-
FileUtil_1.default.ensureFileSync(rawFilePath);
|
|
119
|
-
FileUtil_1.default.copyFileSync(routerMapFilePath, rawFilePath);
|
|
120
|
-
}
|
|
121
|
-
writeHspModuleName() {
|
|
122
|
-
if (!this.node.getAllPluginIds().includes(hvigor_ohos_plugin_1.OhosPluginId.OHOS_HAP_PLUGIN))
|
|
123
|
-
return;
|
|
124
|
-
let rawFilePath = this.config.getRawFilePath();
|
|
125
|
-
let rawFileRouterMap = JSON.parse(FileUtil_1.default.readFileSync(rawFilePath).toString());
|
|
126
|
-
rawFileRouterMap.hspModuleNames = [...new Set(PluginStore_1.default.getInstance().hspModuleNames)];
|
|
127
|
-
rawFileRouterMap.hspModuleNames.push(...this.getRemoteHspModuleNames(this.node, this.node.getAllPluginIds()));
|
|
128
|
-
FileUtil_1.default.writeFileSync(rawFilePath, JSON.stringify(rawFileRouterMap));
|
|
129
|
-
}
|
|
130
|
-
getRemoteHspModuleNames(node, pluginIds) {
|
|
131
|
-
let remoteHspModuleNames = [];
|
|
132
|
-
try {
|
|
133
|
-
pluginIds.forEach((id) => {
|
|
134
|
-
let context = node.getContext(id);
|
|
135
|
-
let signedHspObj = context.getOhpmRemoteHspDependencyInfo(true);
|
|
136
|
-
let remoteHspObj = context.getOhpmRemoteHspDependencyInfo(false);
|
|
137
|
-
for (const key in signedHspObj) {
|
|
138
|
-
remoteHspModuleNames.push(signedHspObj[key].name);
|
|
139
|
-
}
|
|
140
|
-
for (const key in remoteHspObj) {
|
|
141
|
-
remoteHspModuleNames.push(remoteHspObj[key].name);
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
catch (error) {
|
|
146
|
-
Logger_1.Logger.warn('Your DevEco Studio version less than 5.0.3.800, may cause remote hsp dependencies get failed');
|
|
147
|
-
}
|
|
148
|
-
return remoteHspModuleNames;
|
|
149
|
-
}
|
|
150
|
-
taskExec() {
|
|
151
|
-
let startTime = Date.now();
|
|
152
|
-
Logger_1.Logger.info(this.node.getNodeName() + ': HMRouterPluginTask start');
|
|
153
|
-
this.plugin.analyzeAnnotation();
|
|
154
|
-
this.updateModuleJsonOpt();
|
|
155
|
-
this.updateBuildProfileOpt();
|
|
156
|
-
let endTime = Date.now();
|
|
157
|
-
Logger_1.Logger.info(this.config.moduleName + ': HMRouterPluginTask end');
|
|
158
|
-
Logger_1.Logger.info(this.config.moduleName + ': HMRouterPluginTask cost: ' + (endTime - startTime) + ' ms');
|
|
159
|
-
}
|
|
160
|
-
updateModuleJsonOpt() {
|
|
161
|
-
const moduleJsonOpt = this.moduleContext.getModuleJsonOpt();
|
|
162
|
-
if (moduleJsonOpt.module.routerMap) {
|
|
163
|
-
let routerMapFileName = moduleJsonOpt.module.routerMap.split(':')[1];
|
|
164
|
-
let routerMapFilePath = this.config.getModuleRouterMapFilePath(routerMapFileName);
|
|
165
|
-
let routerMapObj = FileUtil_1.default.readJson5(routerMapFilePath);
|
|
166
|
-
if (routerMapFileName !== 'hm_router_map') {
|
|
167
|
-
this.plugin.routerMap.unshift(...routerMapObj[CommonConstants_1.default.ROUTER_MAP_KEY]);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
this.plugin.generateRouterMap();
|
|
171
|
-
moduleJsonOpt.module.routerMap = CommonConstants_1.default.MODULE_ROUTER_MAP_NAME;
|
|
172
|
-
this.moduleContext.setModuleJsonOpt(moduleJsonOpt);
|
|
173
|
-
}
|
|
174
|
-
updateBuildProfileOpt() {
|
|
175
|
-
const buildProfileOpt = this.moduleContext.getBuildProfileOpt();
|
|
176
|
-
let sources = this.ensureNestedObject(buildProfileOpt, ['buildOption', 'arkOptions', 'runtimeOnly', 'sources']);
|
|
177
|
-
if (!Array.isArray(sources)) {
|
|
178
|
-
buildProfileOpt.buildOption.arkOptions.runtimeOnly.sources = [];
|
|
179
|
-
}
|
|
180
|
-
this.pushRouterInfo(buildProfileOpt, this.plugin.routerMap);
|
|
181
|
-
this.moduleContext.setBuildProfileOpt(buildProfileOpt);
|
|
182
|
-
}
|
|
183
|
-
pushRouterInfo(buildProfileOpt, routerMap) {
|
|
184
|
-
const sources = buildProfileOpt.buildOption.arkOptions.runtimeOnly.sources;
|
|
185
|
-
routerMap.forEach((item) => {
|
|
186
|
-
const name = item.name;
|
|
187
|
-
if (name.includes(CommonConstants_1.default.LIFECYCLE_PREFIX) ||
|
|
188
|
-
name.includes(CommonConstants_1.default.INTERCEPTOR_PREFIX) ||
|
|
189
|
-
name.includes(CommonConstants_1.default.ANIMATOR_PREFIX) ||
|
|
190
|
-
name.includes(CommonConstants_1.default.SERVICE_PREFIX)) {
|
|
191
|
-
sources.push(CommonConstants_1.default.CURRENT_DELIMITER + item.pageSourceFile);
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
readConfig() {
|
|
196
|
-
let configParam;
|
|
197
|
-
let configFilePath;
|
|
198
|
-
let configDir;
|
|
199
|
-
configFilePath = FileUtil_1.default.pathResolve(this.node.getNodePath(), CommonConstants_1.default.CONFIG_FILE_NAME);
|
|
200
|
-
if (!FileUtil_1.default.exist(configFilePath)) {
|
|
201
|
-
configFilePath =
|
|
202
|
-
FileUtil_1.default.pathResolve(PluginStore_1.default.getInstance().projectFilePath, CommonConstants_1.default.CONFIG_FILE_NAME);
|
|
203
|
-
}
|
|
204
|
-
if (FileUtil_1.default.exist(configFilePath)) {
|
|
205
|
-
configParam = FileUtil_1.default.readJson5(configFilePath);
|
|
206
|
-
}
|
|
207
|
-
else {
|
|
208
|
-
configParam = {};
|
|
209
|
-
}
|
|
210
|
-
configDir = FileUtil_1.default.pathResolve(configFilePath, CommonConstants_1.default.PARENT_DELIMITER);
|
|
211
|
-
return new HMRouterPluginConfig_1.HMRouterPluginConfig(this.node.getNodeName(), this.node.getNodePath(), configDir, configParam);
|
|
212
|
-
}
|
|
213
|
-
ensureNestedObject(obj, path) {
|
|
214
|
-
return path.reduce((acc, key) => {
|
|
215
|
-
if (!acc[key]) {
|
|
216
|
-
acc[key] = {};
|
|
217
|
-
}
|
|
218
|
-
return acc[key];
|
|
219
|
-
}, obj);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
exports.HMRouterPluginHandle = HMRouterPluginHandle;
|
package/dist/common/Logger.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare class Logger {
|
|
2
|
-
static error(format: string, ...args: string[]): void;
|
|
3
|
-
static info(msg: string, ...args: unknown[]): void;
|
|
4
|
-
static warn(msg: string, ...args: unknown[]): void;
|
|
5
|
-
}
|
|
6
|
-
export declare enum PluginError {
|
|
7
|
-
ERR_DUPLICATE_NAME = "ERR_DUPLICATE_NAME",
|
|
8
|
-
ERR_WRONG_DECORATION = "ERR_DUPLICATE_",
|
|
9
|
-
ERR_REPEAT_ANNOTATION = "ERR_INIT_FRAMEWORK",
|
|
10
|
-
ERR_ERROR_CONFIG = "ERR_INIT_COMPONENT",
|
|
11
|
-
ERR_NOT_EMPTY_STRING = "ERR_INIT_NOT_READY",
|
|
12
|
-
ERR_INVALID_STRING_VALUE = "ERR_INVALID_STRING_VALUE"
|
|
13
|
-
}
|
package/dist/common/Logger.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PluginError = exports.Logger = void 0;
|
|
4
|
-
const hvigor_1 = require("@ohos/hvigor");
|
|
5
|
-
class Logger {
|
|
6
|
-
static error(format, ...args) {
|
|
7
|
-
let formatStr = format;
|
|
8
|
-
if (DEFINED_ERROR.has(format)) {
|
|
9
|
-
formatStr = `errorCode ${DEFINED_ERROR.get(format)?.errorCode}, errorMsg: ${DEFINED_ERROR.get(format)?.errorMsg}`;
|
|
10
|
-
}
|
|
11
|
-
const publicFormat = `[HMRouterPlugin] ERROR: ${formatStr.replace('%s', args[0])}`;
|
|
12
|
-
hvigor_1.HvigorLogger.getLogger().error(publicFormat);
|
|
13
|
-
}
|
|
14
|
-
static info(msg, ...args) {
|
|
15
|
-
hvigor_1.HvigorLogger.getLogger().info('[HMRouterPlugin] ' + msg, ...args);
|
|
16
|
-
}
|
|
17
|
-
static warn(msg, ...args) {
|
|
18
|
-
hvigor_1.HvigorLogger.getLogger().warn('[HMRouterPlugin] ' + msg, ...args);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.Logger = Logger;
|
|
22
|
-
var PluginError;
|
|
23
|
-
(function (PluginError) {
|
|
24
|
-
PluginError["ERR_DUPLICATE_NAME"] = "ERR_DUPLICATE_NAME";
|
|
25
|
-
PluginError["ERR_WRONG_DECORATION"] = "ERR_DUPLICATE_";
|
|
26
|
-
PluginError["ERR_REPEAT_ANNOTATION"] = "ERR_INIT_FRAMEWORK";
|
|
27
|
-
PluginError["ERR_ERROR_CONFIG"] = "ERR_INIT_COMPONENT";
|
|
28
|
-
PluginError["ERR_NOT_EMPTY_STRING"] = "ERR_INIT_NOT_READY";
|
|
29
|
-
PluginError["ERR_INVALID_STRING_VALUE"] = "ERR_INVALID_STRING_VALUE";
|
|
30
|
-
})(PluginError = exports.PluginError || (exports.PluginError = {}));
|
|
31
|
-
const DEFINED_ERROR = new Map();
|
|
32
|
-
DEFINED_ERROR.set(PluginError.ERR_DUPLICATE_NAME, {
|
|
33
|
-
errorCode: 40000001,
|
|
34
|
-
errorMsg: 'Duplicate pageUrl/interceptor/service/animator/lifecycle - %s'
|
|
35
|
-
});
|
|
36
|
-
DEFINED_ERROR.set(PluginError.ERR_WRONG_DECORATION, {
|
|
37
|
-
errorCode: 40000002,
|
|
38
|
-
errorMsg: 'Struct with @HMRouter annotation could not contain NavDestination component - %s'
|
|
39
|
-
});
|
|
40
|
-
DEFINED_ERROR.set(PluginError.ERR_REPEAT_ANNOTATION, {
|
|
41
|
-
errorCode: 40000003,
|
|
42
|
-
errorMsg: 'File: %s contains multiple annotations'
|
|
43
|
-
});
|
|
44
|
-
DEFINED_ERROR.set(PluginError.ERR_ERROR_CONFIG, {
|
|
45
|
-
errorCode: 40000004,
|
|
46
|
-
errorMsg: 'moduleContext is null, Please check hvigorfile.ts file in module directory - %s'
|
|
47
|
-
});
|
|
48
|
-
DEFINED_ERROR.set(PluginError.ERR_NOT_EMPTY_STRING, {
|
|
49
|
-
errorCode: 40000005,
|
|
50
|
-
errorMsg: '%s constant value cannot be empty string - %s'
|
|
51
|
-
});
|
|
52
|
-
DEFINED_ERROR.set(PluginError.ERR_INVALID_STRING_VALUE, {
|
|
53
|
-
errorCode: 40000006,
|
|
54
|
-
errorMsg: 'invalid string value: %s'
|
|
55
|
-
});
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export type AnalyzerResultLike = HMRouterResult | HMAnimatorResult | HMInterceptorResult | HMLifecycleResult | HMServiceResult;
|
|
2
|
-
export interface BaseAnalyzeResult {
|
|
3
|
-
name?: string;
|
|
4
|
-
module?: string;
|
|
5
|
-
annotation?: string;
|
|
6
|
-
pageSourceFile?: string;
|
|
7
|
-
isDefaultExport?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface HMRouterResult extends BaseAnalyzeResult {
|
|
10
|
-
pageUrl?: any;
|
|
11
|
-
dialog?: boolean;
|
|
12
|
-
singleton?: boolean;
|
|
13
|
-
interceptors?: string[];
|
|
14
|
-
animator?: string;
|
|
15
|
-
lifecycle?: string;
|
|
16
|
-
useNavDst?: boolean;
|
|
17
|
-
}
|
|
18
|
-
export interface HMAnimatorResult extends BaseAnalyzeResult {
|
|
19
|
-
animatorName?: string;
|
|
20
|
-
}
|
|
21
|
-
export interface HMInterceptorResult extends BaseAnalyzeResult {
|
|
22
|
-
interceptorName?: string;
|
|
23
|
-
priority?: number;
|
|
24
|
-
global?: boolean;
|
|
25
|
-
}
|
|
26
|
-
export interface HMLifecycleResult extends BaseAnalyzeResult {
|
|
27
|
-
lifecycleName?: string;
|
|
28
|
-
priority?: number;
|
|
29
|
-
global?: boolean;
|
|
30
|
-
}
|
|
31
|
-
export interface HMServiceResult extends BaseAnalyzeResult {
|
|
32
|
-
serviceName?: string;
|
|
33
|
-
functionName?: string;
|
|
34
|
-
singleton?: boolean;
|
|
35
|
-
}
|
|
36
|
-
export declare class TemplateModel {
|
|
37
|
-
pageUrl: string;
|
|
38
|
-
importPath: string;
|
|
39
|
-
componentName: string;
|
|
40
|
-
dialog: boolean;
|
|
41
|
-
generatorViewName: string;
|
|
42
|
-
isDefaultExport?: boolean;
|
|
43
|
-
constructor(pageUrl: string, importPath: string, componentName: string, dialog: boolean, generatorViewName: string, isDefaultExport?: boolean);
|
|
44
|
-
}
|
|
45
|
-
export declare class RouterInfo {
|
|
46
|
-
name: string;
|
|
47
|
-
pageSourceFile: string;
|
|
48
|
-
buildFunction: string;
|
|
49
|
-
customData: AnalyzerResultLike;
|
|
50
|
-
constructor(name: string, pageSourceFile: string, buildFunction: string, data?: AnalyzerResultLike);
|
|
51
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RouterInfo = exports.TemplateModel = void 0;
|
|
4
|
-
class TemplateModel {
|
|
5
|
-
constructor(pageUrl, importPath, componentName, dialog, generatorViewName, isDefaultExport) {
|
|
6
|
-
this.isDefaultExport = isDefaultExport;
|
|
7
|
-
this.pageUrl = pageUrl;
|
|
8
|
-
this.importPath = importPath;
|
|
9
|
-
this.componentName = componentName;
|
|
10
|
-
this.dialog = dialog;
|
|
11
|
-
this.generatorViewName = generatorViewName;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.TemplateModel = TemplateModel;
|
|
15
|
-
class RouterInfo {
|
|
16
|
-
constructor(name, pageSourceFile, buildFunction, data = {}) {
|
|
17
|
-
this.name = name;
|
|
18
|
-
this.pageSourceFile = pageSourceFile;
|
|
19
|
-
this.buildFunction = buildFunction;
|
|
20
|
-
this.customData = data;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.RouterInfo = RouterInfo;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export default class HMRouterPluginConstant {
|
|
2
|
-
static readonly ANIMATOR_PREFIX = "__animator__";
|
|
3
|
-
static readonly INTERCEPTOR_PREFIX = "__interceptor__";
|
|
4
|
-
static readonly LIFECYCLE_PREFIX = "__lifecycle__";
|
|
5
|
-
static readonly SERVICE_PREFIX = "__service__";
|
|
6
|
-
static readonly SERVICE_PROVIDE_PREFIX = "__service_provider__";
|
|
7
|
-
static readonly OBFUSCATION_FILE_NAME = "hmrouter-obfuscation-rules.txt";
|
|
8
|
-
static readonly CONSUMER_FILE_NAME = "hmrouter-consumer-rules.txt";
|
|
9
|
-
static readonly ROUTER_MAP_KEY = "routerMap";
|
|
10
|
-
static readonly FILE_SEPARATOR: "\\" | "/";
|
|
11
|
-
static readonly DELIMITER = "/";
|
|
12
|
-
static readonly MODULE_ROUTER_MAP_NAME = "$profile:hm_router_map";
|
|
13
|
-
static readonly ROUTER_MAP_NAME = "hm_router_map.json";
|
|
14
|
-
static readonly TEMP_ROUTER_MAP_PATH = "../../intermediates/router_map";
|
|
15
|
-
static readonly RAWFILE_DIR = "src/main/resources/rawfile/hm_router_map.json";
|
|
16
|
-
static readonly VIEW_NAME_PREFIX = "HM";
|
|
17
|
-
static readonly ETS_SUFFIX = ".ets";
|
|
18
|
-
static readonly JSON_SUFFIX = ".json";
|
|
19
|
-
static readonly HAP_PLUGIN_ID = "HAP_HMROUTER_PLUGIN";
|
|
20
|
-
static readonly HSP_PLUGIN_ID = "HSP_HMROUTER_PLUGIN";
|
|
21
|
-
static readonly HAR_PLUGIN_ID = "HAR_HMROUTER_PLUGIN";
|
|
22
|
-
static readonly HAR_MODULE_NAME = "har";
|
|
23
|
-
static readonly ROUTER_ANNOTATION = "HMRouter";
|
|
24
|
-
static readonly ANIMATOR_ANNOTATION = "HMAnimator";
|
|
25
|
-
static readonly INTERCEPTOR_ANNOTATION = "HMInterceptor";
|
|
26
|
-
static readonly LIFECYCLE_ANNOTATION = "HMLifecycle";
|
|
27
|
-
static readonly SERVICE_ANNOTATION = "HMService";
|
|
28
|
-
static readonly SERVICE_PROVIDE_ANNOTATION = "HMServiceProvider";
|
|
29
|
-
static readonly CONFIG_FILE_NAME = "hmrouter_config.json";
|
|
30
|
-
static readonly PARENT_DELIMITER = "../";
|
|
31
|
-
static readonly CURRENT_DELIMITER = "./";
|
|
32
|
-
static readonly LINE_BREAK = "\n";
|
|
33
|
-
static readonly KEEP_FILE_NAME = "-keep-file-name";
|
|
34
|
-
static readonly KEEP_PROPERTY_NAME = "-keep-property-name";
|
|
35
|
-
static readonly KEEP_GLOBAL_NAME = "-keep-global-name";
|
|
36
|
-
static readonly OH_MODULE_PATH = "oh_modules";
|
|
37
|
-
static readonly WARP_BUILDER = "WrapBuilder";
|
|
38
|
-
static readonly CUSTOM_BUILDER_TEMPLATE = "template/customBuilder.ejs";
|
|
39
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
class HMRouterPluginConstant {
|
|
8
|
-
}
|
|
9
|
-
exports.default = HMRouterPluginConstant;
|
|
10
|
-
HMRouterPluginConstant.ANIMATOR_PREFIX = '__animator__';
|
|
11
|
-
HMRouterPluginConstant.INTERCEPTOR_PREFIX = '__interceptor__';
|
|
12
|
-
HMRouterPluginConstant.LIFECYCLE_PREFIX = '__lifecycle__';
|
|
13
|
-
HMRouterPluginConstant.SERVICE_PREFIX = '__service__';
|
|
14
|
-
HMRouterPluginConstant.SERVICE_PROVIDE_PREFIX = '__service_provider__';
|
|
15
|
-
HMRouterPluginConstant.OBFUSCATION_FILE_NAME = 'hmrouter-obfuscation-rules.txt';
|
|
16
|
-
HMRouterPluginConstant.CONSUMER_FILE_NAME = 'hmrouter-consumer-rules.txt';
|
|
17
|
-
HMRouterPluginConstant.ROUTER_MAP_KEY = 'routerMap';
|
|
18
|
-
HMRouterPluginConstant.FILE_SEPARATOR = path_1.default.sep;
|
|
19
|
-
HMRouterPluginConstant.DELIMITER = '/';
|
|
20
|
-
HMRouterPluginConstant.MODULE_ROUTER_MAP_NAME = '$profile:hm_router_map';
|
|
21
|
-
HMRouterPluginConstant.ROUTER_MAP_NAME = 'hm_router_map.json';
|
|
22
|
-
HMRouterPluginConstant.TEMP_ROUTER_MAP_PATH = '../../intermediates/router_map';
|
|
23
|
-
HMRouterPluginConstant.RAWFILE_DIR = 'src/main/resources/rawfile/hm_router_map.json';
|
|
24
|
-
HMRouterPluginConstant.VIEW_NAME_PREFIX = 'HM';
|
|
25
|
-
HMRouterPluginConstant.ETS_SUFFIX = '.ets';
|
|
26
|
-
HMRouterPluginConstant.JSON_SUFFIX = '.json';
|
|
27
|
-
HMRouterPluginConstant.HAP_PLUGIN_ID = 'HAP_HMROUTER_PLUGIN';
|
|
28
|
-
HMRouterPluginConstant.HSP_PLUGIN_ID = 'HSP_HMROUTER_PLUGIN';
|
|
29
|
-
HMRouterPluginConstant.HAR_PLUGIN_ID = 'HAR_HMROUTER_PLUGIN';
|
|
30
|
-
HMRouterPluginConstant.HAR_MODULE_NAME = 'har';
|
|
31
|
-
HMRouterPluginConstant.ROUTER_ANNOTATION = 'HMRouter';
|
|
32
|
-
HMRouterPluginConstant.ANIMATOR_ANNOTATION = 'HMAnimator';
|
|
33
|
-
HMRouterPluginConstant.INTERCEPTOR_ANNOTATION = 'HMInterceptor';
|
|
34
|
-
HMRouterPluginConstant.LIFECYCLE_ANNOTATION = 'HMLifecycle';
|
|
35
|
-
HMRouterPluginConstant.SERVICE_ANNOTATION = 'HMService';
|
|
36
|
-
HMRouterPluginConstant.SERVICE_PROVIDE_ANNOTATION = 'HMServiceProvider';
|
|
37
|
-
HMRouterPluginConstant.CONFIG_FILE_NAME = 'hmrouter_config.json';
|
|
38
|
-
HMRouterPluginConstant.PARENT_DELIMITER = '../';
|
|
39
|
-
HMRouterPluginConstant.CURRENT_DELIMITER = './';
|
|
40
|
-
HMRouterPluginConstant.LINE_BREAK = '\n';
|
|
41
|
-
HMRouterPluginConstant.KEEP_FILE_NAME = '-keep-file-name';
|
|
42
|
-
HMRouterPluginConstant.KEEP_PROPERTY_NAME = '-keep-property-name';
|
|
43
|
-
HMRouterPluginConstant.KEEP_GLOBAL_NAME = '-keep-global-name';
|
|
44
|
-
HMRouterPluginConstant.OH_MODULE_PATH = 'oh_modules';
|
|
45
|
-
HMRouterPluginConstant.WARP_BUILDER = 'WrapBuilder';
|
|
46
|
-
HMRouterPluginConstant.CUSTOM_BUILDER_TEMPLATE = 'template/customBuilder.ejs';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export default class ConfigConstants {
|
|
2
|
-
static readonly DEFAULT_SCAN_DIR = "src/main/ets";
|
|
3
|
-
static readonly DEFAULT_ROUTER_MAP_DIR = "src/main/resources/base/profile";
|
|
4
|
-
static readonly DEFAULT_BUILD_DIR = "src/main/ets/generated";
|
|
5
|
-
static readonly DEFAULT_BUILD_TPL = "template/viewBuilder.ejs";
|
|
6
|
-
static readonly ROUTER_ANNOTATION = "HMRouter";
|
|
7
|
-
static readonly ANIMATOR_ANNOTATION = "HMAnimator";
|
|
8
|
-
static readonly INTERCEPTOR_ANNOTATION = "HMInterceptor";
|
|
9
|
-
static readonly LIFECYCLE_ANNOTATION = "HMLifecycle";
|
|
10
|
-
static readonly SERVICE_ANNOTATION = "HMService";
|
|
11
|
-
static readonly SERVICE_PROVIDE_ANNOTATION = "HMServiceProvider";
|
|
12
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class ConfigConstants {
|
|
4
|
-
}
|
|
5
|
-
exports.default = ConfigConstants;
|
|
6
|
-
ConfigConstants.DEFAULT_SCAN_DIR = 'src/main/ets';
|
|
7
|
-
ConfigConstants.DEFAULT_ROUTER_MAP_DIR = 'src/main/resources/base/profile';
|
|
8
|
-
ConfigConstants.DEFAULT_BUILD_DIR = 'src/main/ets/generated';
|
|
9
|
-
ConfigConstants.DEFAULT_BUILD_TPL = 'template/viewBuilder.ejs';
|
|
10
|
-
ConfigConstants.ROUTER_ANNOTATION = 'HMRouter';
|
|
11
|
-
ConfigConstants.ANIMATOR_ANNOTATION = 'HMAnimator';
|
|
12
|
-
ConfigConstants.INTERCEPTOR_ANNOTATION = 'HMInterceptor';
|
|
13
|
-
ConfigConstants.LIFECYCLE_ANNOTATION = 'HMLifecycle';
|
|
14
|
-
ConfigConstants.SERVICE_ANNOTATION = 'HMService';
|
|
15
|
-
ConfigConstants.SERVICE_PROVIDE_ANNOTATION = 'HMServiceProvider';
|
|
16
|
-
;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export default class TaskConstants {
|
|
2
|
-
static readonly PRE_BUILD = "@PreBuild";
|
|
3
|
-
static readonly MERGE_PROFILE = "@MergeProfile";
|
|
4
|
-
static readonly PROCESS_ROUTER_MAP = "@ProcessRouterMap";
|
|
5
|
-
static readonly PROCESS_RESOURCE = "@ProcessResource";
|
|
6
|
-
static readonly PLUGIN_TASK = "@HMRouterPluginTask";
|
|
7
|
-
static readonly COPY_ROUTER_MAP_TASK = "@HMRouterCopyRouterMapToRawFileTask";
|
|
8
|
-
static readonly GENERATE_OBFUSCATION_TASK = "@HMRouterGenerateObfuscationFileTask";
|
|
9
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class TaskConstants {
|
|
4
|
-
}
|
|
5
|
-
exports.default = TaskConstants;
|
|
6
|
-
TaskConstants.PRE_BUILD = '@PreBuild';
|
|
7
|
-
TaskConstants.MERGE_PROFILE = '@MergeProfile';
|
|
8
|
-
TaskConstants.PROCESS_ROUTER_MAP = '@ProcessRouterMap';
|
|
9
|
-
TaskConstants.PROCESS_RESOURCE = '@ProcessResource';
|
|
10
|
-
TaskConstants.PLUGIN_TASK = '@HMRouterPluginTask';
|
|
11
|
-
TaskConstants.COPY_ROUTER_MAP_TASK = '@HMRouterCopyRouterMapToRawFileTask';
|
|
12
|
-
TaskConstants.GENERATE_OBFUSCATION_TASK = '@HMRouterGenerateObfuscationFileTask';
|
|
13
|
-
;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export default class PluginStore implements IPluginStore {
|
|
2
|
-
private static instance;
|
|
3
|
-
variableCache: Map<string, Map<string, string[]>>;
|
|
4
|
-
projectFilePath: string;
|
|
5
|
-
hspModuleNames: string[];
|
|
6
|
-
static clear(): void;
|
|
7
|
-
static getInstance(): IPluginStore;
|
|
8
|
-
}
|
|
9
|
-
interface IPluginStore {
|
|
10
|
-
variableCache: Map<string, Map<string, string[]>>;
|
|
11
|
-
projectFilePath: string;
|
|
12
|
-
hspModuleNames: string[];
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class PluginStore {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.variableCache = new Map();
|
|
6
|
-
this.projectFilePath = '';
|
|
7
|
-
this.hspModuleNames = [];
|
|
8
|
-
}
|
|
9
|
-
static clear() {
|
|
10
|
-
this.instance = null;
|
|
11
|
-
}
|
|
12
|
-
static getInstance() {
|
|
13
|
-
if (!this.instance) {
|
|
14
|
-
this.instance = new PluginStore();
|
|
15
|
-
}
|
|
16
|
-
return this.instance;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.default = PluginStore;
|
|
20
|
-
PluginStore.instance = null;
|
package/dist/utils/FileUtil.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { FileUtil } from '@ohos/hvigor';
|
|
4
|
-
import fs from 'fs';
|
|
5
|
-
export default class HMFileUtil extends FileUtil {
|
|
6
|
-
static rmSync(path: fs.PathLike, options?: fs.RmOptions): void;
|
|
7
|
-
static unlinkSync(path: fs.PathLike): void;
|
|
8
|
-
static readdirSync(path: fs.PathLike, options?: {
|
|
9
|
-
encoding: BufferEncoding | null;
|
|
10
|
-
withFileTypes?: false | undefined;
|
|
11
|
-
recursive?: boolean | undefined;
|
|
12
|
-
}): string[];
|
|
13
|
-
}
|
package/dist/utils/FileUtil.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const hvigor_1 = require("@ohos/hvigor");
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
class HMFileUtil extends hvigor_1.FileUtil {
|
|
9
|
-
static rmSync(path, options) {
|
|
10
|
-
return fs_1.default.rmSync(path, options);
|
|
11
|
-
}
|
|
12
|
-
static unlinkSync(path) {
|
|
13
|
-
return fs_1.default.unlinkSync(path);
|
|
14
|
-
}
|
|
15
|
-
static readdirSync(path, options) {
|
|
16
|
-
return fs_1.default.readdirSync(path, options);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.default = HMFileUtil;
|
|
20
|
-
;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const CommonConstants_1 = __importDefault(require("../constants/CommonConstants"));
|
|
7
|
-
class ObfuscationUtil {
|
|
8
|
-
static buildObfuscatedStrings(routerMap) {
|
|
9
|
-
let srcPathArr = [...new Set(routerMap.map((routerInfo) => {
|
|
10
|
-
return CommonConstants_1.default.CURRENT_DELIMITER + routerInfo.pageSourceFile;
|
|
11
|
-
}))];
|
|
12
|
-
let classNameArr = [...new Set(routerMap.filter((routerInfo) => {
|
|
13
|
-
return routerInfo.name.includes('__');
|
|
14
|
-
}).map((routerInfo) => {
|
|
15
|
-
return routerInfo.customData.name;
|
|
16
|
-
}))];
|
|
17
|
-
let functionName = [...new Set(routerMap.filter((routerInfo) => {
|
|
18
|
-
return routerInfo.name.includes(CommonConstants_1.default.SERVICE_PREFIX);
|
|
19
|
-
}).map((routerInfo) => {
|
|
20
|
-
return routerInfo.customData.functionName;
|
|
21
|
-
}))];
|
|
22
|
-
let watchFunctionName = [...new Set(routerMap.filter((routerInfo) => {
|
|
23
|
-
return routerInfo.buildFunction;
|
|
24
|
-
}).map((routerInfo) => {
|
|
25
|
-
return routerInfo.buildFunction + CommonConstants_1.default.WARP_BUILDER;
|
|
26
|
-
}))];
|
|
27
|
-
return CommonConstants_1.default.KEEP_FILE_NAME + CommonConstants_1.default.LINE_BREAK +
|
|
28
|
-
srcPathArr.concat(CommonConstants_1.default.KEEP_PROPERTY_NAME, functionName)
|
|
29
|
-
.concat(CommonConstants_1.default.KEEP_GLOBAL_NAME, classNameArr, watchFunctionName)
|
|
30
|
-
.join(CommonConstants_1.default.LINE_BREAK);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.default = ObfuscationUtil;
|
|
34
|
-
;
|
package/dist/utils/StringUtil.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StringUtil = void 0;
|
|
4
|
-
class StringUtil {
|
|
5
|
-
static stringToHashCode(str) {
|
|
6
|
-
let hash = 0;
|
|
7
|
-
if (str.length === 0) {
|
|
8
|
-
return hash;
|
|
9
|
-
}
|
|
10
|
-
for (let i = 0; i < str.length; i++) {
|
|
11
|
-
const char = str.charCodeAt(i);
|
|
12
|
-
hash = (hash << 5) - hash + char;
|
|
13
|
-
hash |= 0;
|
|
14
|
-
}
|
|
15
|
-
return hash;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.StringUtil = StringUtil;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Project, SourceFile } from 'ts-morph';
|
|
2
|
-
export declare let project: Project | null;
|
|
3
|
-
export declare class TsAstUtil {
|
|
4
|
-
static getSourceFile(filePath: string): SourceFile;
|
|
5
|
-
static clearProject(): void;
|
|
6
|
-
static parseConstantValue(sourceFile: SourceFile, variableName: string, propertyName?: string): string;
|
|
7
|
-
static parseCrossModuleVariable(scanDir: string): Map<string, string[]>;
|
|
8
|
-
private static getExportedVariables;
|
|
9
|
-
}
|