@hadss/hmrouter-plugin 1.0.0-rc.9 → 1.1.1-alpha.0

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.
Files changed (147) hide show
  1. package/LICENSE +176 -77
  2. package/NOTICE +1365 -0
  3. package/README.md +254 -71
  4. package/dist/HMRouterAnalyzer.d.ts +24 -1
  5. package/dist/HMRouterAnalyzer.js +154 -55
  6. package/dist/HMRouterHvigorPlugin.js +23 -4
  7. package/dist/HMRouterPluginConfig.d.ts +1 -0
  8. package/dist/HMRouterPluginConfig.js +7 -3
  9. package/dist/HMRouterPluginHandle.d.ts +1 -0
  10. package/dist/HMRouterPluginHandle.js +81 -55
  11. package/dist/HMRouterPluginManager.d.ts +9 -0
  12. package/dist/HMRouterPluginManager.js +55 -0
  13. package/dist/Index.d.ts +9 -3
  14. package/dist/Index.js +33 -103
  15. package/dist/common/Logger.js +1 -1
  16. package/dist/common/PluginModel.d.ts +4 -1
  17. package/dist/common/PluginModel.js +2 -1
  18. package/dist/constants/CommonConstants.d.ts +10 -5
  19. package/dist/constants/CommonConstants.js +11 -6
  20. package/dist/constants/ConfigConstants.d.ts +2 -1
  21. package/dist/constants/ConfigConstants.js +3 -2
  22. package/dist/constants/TaskConstants.js +1 -1
  23. package/dist/framework/constants/TaskConstants.d.ts +8 -0
  24. package/dist/framework/constants/TaskConstants.js +12 -0
  25. package/dist/framework/constants/index.d.ts +1 -0
  26. package/dist/framework/constants/index.js +17 -0
  27. package/dist/framework/core/PluginExecutionController.d.ts +15 -0
  28. package/dist/framework/core/PluginExecutionController.js +62 -0
  29. package/dist/framework/core/TaskManager.d.ts +12 -0
  30. package/dist/framework/core/TaskManager.js +67 -0
  31. package/dist/framework/core/TaskStage.d.ts +10 -0
  32. package/dist/framework/core/TaskStage.js +14 -0
  33. package/dist/framework/core/index.d.ts +3 -0
  34. package/dist/framework/core/index.js +19 -0
  35. package/dist/framework/extension/ExtensionManager.d.ts +11 -0
  36. package/dist/framework/extension/ExtensionManager.js +33 -0
  37. package/dist/framework/extension/PluginExtension.d.ts +13 -0
  38. package/dist/framework/extension/PluginExtension.js +6 -0
  39. package/dist/framework/extension/context/ExtensionContextImpl.d.ts +23 -0
  40. package/dist/framework/extension/context/ExtensionContextImpl.js +64 -0
  41. package/dist/framework/extension/context/Interface.d.ts +21 -0
  42. package/dist/framework/extension/context/Interface.js +2 -0
  43. package/dist/framework/extension/context/TemplateMetadataImpl.d.ts +12 -0
  44. package/dist/framework/extension/context/TemplateMetadataImpl.js +22 -0
  45. package/dist/framework/extension/index.d.ts +4 -0
  46. package/dist/framework/extension/index.js +20 -0
  47. package/dist/framework/index.d.ts +4 -0
  48. package/dist/framework/index.js +20 -0
  49. package/dist/framework/utils/FileUtil.d.ts +13 -0
  50. package/dist/framework/utils/FileUtil.js +20 -0
  51. package/dist/framework/utils/Logger.d.ts +12 -0
  52. package/dist/framework/utils/Logger.js +31 -0
  53. package/dist/framework/utils/ModuleTypeUtil.d.ts +4 -0
  54. package/dist/framework/utils/ModuleTypeUtil.js +16 -0
  55. package/dist/framework/utils/ObjectUtils.d.ts +3 -0
  56. package/dist/framework/utils/ObjectUtils.js +14 -0
  57. package/dist/framework/utils/PluginStore.d.ts +10 -0
  58. package/dist/framework/utils/PluginStore.js +29 -0
  59. package/dist/framework/utils/StringUtil.d.ts +3 -0
  60. package/dist/framework/utils/StringUtil.js +18 -0
  61. package/dist/framework/utils/TsAstUtil.d.ts +6 -0
  62. package/dist/framework/utils/TsAstUtil.js +19 -0
  63. package/dist/framework/utils/index.d.ts +7 -0
  64. package/dist/framework/utils/index.js +23 -0
  65. package/dist/hmrouter_extension/HMRouterExtension.d.ts +14 -0
  66. package/dist/hmrouter_extension/HMRouterExtension.js +47 -0
  67. package/dist/hmrouter_extension/HMRouterExtensionContext.d.ts +8 -0
  68. package/dist/hmrouter_extension/HMRouterExtensionContext.js +2 -0
  69. package/dist/hmrouter_extension/analyzer/AnnotationAnalyzerRegistry.d.ts +14 -0
  70. package/dist/hmrouter_extension/analyzer/AnnotationAnalyzerRegistry.js +45 -0
  71. package/dist/hmrouter_extension/analyzer/ComponentAnalyzer.d.ts +12 -0
  72. package/dist/hmrouter_extension/analyzer/ComponentAnalyzer.js +52 -0
  73. package/dist/hmrouter_extension/analyzer/RouterAnalyzer.d.ts +11 -0
  74. package/dist/hmrouter_extension/analyzer/RouterAnalyzer.js +79 -0
  75. package/dist/hmrouter_extension/analyzer/interface/AbstractAnnotationAnalyzer.d.ts +9 -0
  76. package/dist/hmrouter_extension/analyzer/interface/AbstractAnnotationAnalyzer.js +9 -0
  77. package/dist/hmrouter_extension/analyzer/interface/IConstantResolver.d.ts +7 -0
  78. package/dist/hmrouter_extension/analyzer/interface/IConstantResolver.js +2 -0
  79. package/dist/hmrouter_extension/analyzer/utils/ConstantAnalyzer.d.ts +9 -0
  80. package/dist/hmrouter_extension/analyzer/utils/ConstantAnalyzer.js +32 -0
  81. package/dist/hmrouter_extension/analyzer/utils/ConstantResolver.d.ts +15 -0
  82. package/dist/hmrouter_extension/analyzer/utils/ConstantResolver.js +217 -0
  83. package/dist/hmrouter_extension/analyzer/utils/DecoratorParser.d.ts +7 -0
  84. package/dist/hmrouter_extension/analyzer/utils/DecoratorParser.js +41 -0
  85. package/dist/hmrouter_extension/analyzer/utils/ImportAnalyzer.d.ts +4 -0
  86. package/dist/hmrouter_extension/analyzer/utils/ImportAnalyzer.js +35 -0
  87. package/dist/hmrouter_extension/config/HMRouterPluginConfig.d.ts +38 -0
  88. package/dist/hmrouter_extension/config/HMRouterPluginConfig.js +64 -0
  89. package/dist/hmrouter_extension/constants/AnnotationConstants.d.ts +8 -0
  90. package/dist/hmrouter_extension/constants/AnnotationConstants.js +11 -0
  91. package/dist/hmrouter_extension/constants/FilePathConstants.d.ts +19 -0
  92. package/dist/hmrouter_extension/constants/FilePathConstants.js +26 -0
  93. package/dist/hmrouter_extension/constants/ObfuscationConstants.d.ts +5 -0
  94. package/dist/hmrouter_extension/constants/ObfuscationConstants.js +8 -0
  95. package/dist/hmrouter_extension/constants/PluginConstants.d.ts +6 -0
  96. package/dist/hmrouter_extension/constants/PluginConstants.js +9 -0
  97. package/dist/hmrouter_extension/constants/PrefixConstants.d.ts +8 -0
  98. package/dist/hmrouter_extension/constants/PrefixConstants.js +11 -0
  99. package/dist/hmrouter_extension/constants/RouterMapConstants.d.ts +5 -0
  100. package/dist/hmrouter_extension/constants/RouterMapConstants.js +8 -0
  101. package/dist/hmrouter_extension/constants/TemplateConstants.d.ts +6 -0
  102. package/dist/hmrouter_extension/constants/TemplateConstants.js +9 -0
  103. package/dist/hmrouter_extension/constants/VersionConstants.d.ts +6 -0
  104. package/dist/hmrouter_extension/constants/VersionConstants.js +9 -0
  105. package/dist/hmrouter_extension/constants/index.d.ts +8 -0
  106. package/dist/hmrouter_extension/constants/index.js +22 -0
  107. package/dist/hmrouter_extension/error/PluginError.d.ts +29 -0
  108. package/dist/hmrouter_extension/error/PluginError.js +75 -0
  109. package/dist/hmrouter_extension/model/HMAnnotationModel.d.ts +28 -0
  110. package/dist/hmrouter_extension/model/HMAnnotationModel.js +2 -0
  111. package/dist/hmrouter_extension/model/RouterInfo.d.ts +6 -0
  112. package/dist/hmrouter_extension/model/RouterInfo.js +2 -0
  113. package/dist/hmrouter_extension/model/TemplateModel.d.ts +8 -0
  114. package/dist/hmrouter_extension/model/TemplateModel.js +2 -0
  115. package/dist/hmrouter_extension/model/index.d.ts +3 -0
  116. package/dist/hmrouter_extension/model/index.js +19 -0
  117. package/dist/hmrouter_extension/processor/CodeGenerationProcessor.d.ts +13 -0
  118. package/dist/hmrouter_extension/processor/CodeGenerationProcessor.js +117 -0
  119. package/dist/hmrouter_extension/processor/CompletionProcessor.d.ts +11 -0
  120. package/dist/hmrouter_extension/processor/CompletionProcessor.js +59 -0
  121. package/dist/hmrouter_extension/processor/ConfigUpdateProcessor.d.ts +11 -0
  122. package/dist/hmrouter_extension/processor/ConfigUpdateProcessor.js +53 -0
  123. package/dist/hmrouter_extension/processor/InitializerProcessor.d.ts +15 -0
  124. package/dist/hmrouter_extension/processor/InitializerProcessor.js +95 -0
  125. package/dist/hmrouter_extension/processor/ObfuscationProcessor.d.ts +13 -0
  126. package/dist/hmrouter_extension/processor/ObfuscationProcessor.js +121 -0
  127. package/dist/hmrouter_extension/processor/ResourceProcessor.d.ts +9 -0
  128. package/dist/hmrouter_extension/processor/ResourceProcessor.js +53 -0
  129. package/dist/hmrouter_extension/processor/RouterMapBuildingProcessor.d.ts +9 -0
  130. package/dist/hmrouter_extension/processor/RouterMapBuildingProcessor.js +122 -0
  131. package/dist/hmrouter_extension/processor/index.d.ts +7 -0
  132. package/dist/hmrouter_extension/processor/index.js +23 -0
  133. package/dist/store/PluginStore.d.ts +14 -0
  134. package/dist/store/PluginStore.js +20 -0
  135. package/dist/utils/FileUtil.d.ts +2 -0
  136. package/dist/utils/ObfuscationUtil.js +7 -1
  137. package/dist/utils/TsAstUtil.d.ts +3 -2
  138. package/dist/utils/TsAstUtil.js +51 -11
  139. package/examples/CustomExtension.ts +256 -0
  140. package/package.json +8 -7
  141. package/template/customBuilder.ejs +25 -0
  142. package/template/viewBuilder.ejs +51 -0
  143. package/{viewBuilder.ejs → template/viewBuilder_v1.ejs} +11 -4
  144. package/dist/common/Constant.d.ts +0 -27
  145. package/dist/common/Constant.js +0 -35
  146. package/dist/utils/ConfusionUtil.d.ts +0 -4
  147. package/dist/utils/ConfusionUtil.js +0 -27
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.HMRouterPluginHandle = void 0;
7
- const hvigor_1 = require("@ohos/hvigor");
8
7
  const hvigor_ohos_plugin_1 = require("@ohos/hvigor-ohos-plugin");
9
8
  const HMRouterPluginConfig_1 = require("./HMRouterPluginConfig");
10
9
  const HMRouterHvigorPlugin_1 = require("./HMRouterHvigorPlugin");
@@ -13,12 +12,14 @@ const CommonConstants_1 = __importDefault(require("./constants/CommonConstants")
13
12
  const TaskConstants_1 = __importDefault(require("./constants/TaskConstants"));
14
13
  const FileUtil_1 = __importDefault(require("./utils/FileUtil"));
15
14
  const ObfuscationUtil_1 = __importDefault(require("./utils/ObfuscationUtil"));
15
+ const PluginStore_1 = __importDefault(require("./store/PluginStore"));
16
16
  class HMRouterPluginHandle {
17
17
  constructor(node, moduleContext) {
18
18
  this.node = node;
19
19
  this.moduleContext = moduleContext;
20
20
  this.config = this.readConfig();
21
21
  this.appContext = this.node.getParentNode()?.getContext(hvigor_ohos_plugin_1.OhosPluginId.OHOS_APP_PLUGIN);
22
+ PluginStore_1.default.getInstance().projectFilePath = this.appContext.getProjectPath();
22
23
  this.plugin = new HMRouterHvigorPlugin_1.HMRouterHvigorPlugin(this.config);
23
24
  }
24
25
  start() {
@@ -29,6 +30,8 @@ class HMRouterPluginHandle {
29
30
  name: targetName + TaskConstants_1.default.PLUGIN_TASK,
30
31
  run: () => {
31
32
  this.taskExec();
33
+ this.plugin.scanFiles = [];
34
+ this.plugin.routerMap = [];
32
35
  },
33
36
  dependencies: [targetName + TaskConstants_1.default.PRE_BUILD],
34
37
  postDependencies: [targetName + TaskConstants_1.default.MERGE_PROFILE]
@@ -58,8 +61,15 @@ class HMRouterPluginHandle {
58
61
  return;
59
62
  }
60
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);
61
66
  FileUtil_1.default.ensureFileSync(obfuscationFilePath);
62
- FileUtil_1.default.writeFileSync(obfuscationFilePath, ObfuscationUtil_1.default.buildObfuscatedStrings(this.plugin.routerMap));
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
+ }
63
73
  Logger_1.Logger.info('Generate obfuscation rule file successfully, filePath:', obfuscationFilePath);
64
74
  }
65
75
  isEnableObfuscation(buildProfileOpt) {
@@ -67,25 +77,40 @@ class HMRouterPluginHandle {
67
77
  let buildOption = buildProfileOpt.buildOptionSet?.find((item) => {
68
78
  return item.name == currentBuildMode;
69
79
  });
70
- if (buildOption) {
71
- let ruleOptions = this.ensureNestedObject(buildOption, ['arkOptions', 'obfuscation', 'ruleOptions']);
72
- if (this.config.autoObfuscation && ruleOptions.enable) {
73
- let files = this.ensureNestedObject(buildOption, ['arkOptions', 'obfuscation', 'ruleOptions', 'files']);
74
- let obfuscationFilePath = CommonConstants_1.default.CURRENT_DELIMITER +
75
- CommonConstants_1.default.OBFUSCATION_FILE_NAME;
76
- if (typeof files === 'string') {
77
- ruleOptions.files = [files, obfuscationFilePath];
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);
78
106
  }
79
107
  else {
80
- files.push(obfuscationFilePath);
108
+ this.ensureNestedObject(buildOption, ['arkOptions', 'obfuscation']).consumerFiles = consumerRulesPath;
81
109
  }
82
- this.moduleContext.setBuildProfileOpt(buildProfileOpt);
83
110
  }
84
- return ruleOptions.enable;
85
- }
86
- else {
87
- return false;
111
+ this.moduleContext.setBuildProfileOpt(buildProfileOpt);
88
112
  }
113
+ return ruleOptions.enable;
89
114
  }
90
115
  copyRouterMapToRawFileTask(buildOutputPath, targetName) {
91
116
  let routerMapFilePath = FileUtil_1.default.pathResolve(buildOutputPath, CommonConstants_1.default.TEMP_ROUTER_MAP_PATH, targetName, CommonConstants_1.default.ROUTER_MAP_NAME);
@@ -94,36 +119,33 @@ class HMRouterPluginHandle {
94
119
  FileUtil_1.default.copyFileSync(routerMapFilePath, rawFilePath);
95
120
  }
96
121
  writeHspModuleName() {
97
- if (this.node.getAllPluginIds().includes(hvigor_ohos_plugin_1.OhosPluginId.OHOS_HAP_PLUGIN)) {
98
- let rawFilePath = this.config.getRawFilePath();
99
- let rawFileRouterMap = JSON.parse(FileUtil_1.default.readFileSync(rawFilePath).toString());
100
- rawFileRouterMap.hspModuleNames = [];
101
- hvigor_1.hvigor.getAllNodes().forEach((node) => {
102
- let pluginIds = node.getAllPluginIds();
103
- if (pluginIds.includes(hvigor_ohos_plugin_1.OhosPluginId.OHOS_HSP_PLUGIN)) {
104
- let packageJson = FileUtil_1.default.readJson5(FileUtil_1.default.pathResolve(node.getNodePath(), 'oh-package.json5'));
105
- rawFileRouterMap.hspModuleNames.push(packageJson.name);
106
- }
107
- try {
108
- pluginIds.forEach((id) => {
109
- let context = node.getContext(id);
110
- let signedHspObj = context.getOhpmRemoteHspDependencyInfo(true);
111
- let remoteHspObj = context.getOhpmRemoteHspDependencyInfo(false);
112
- for (const key in signedHspObj) {
113
- rawFileRouterMap.hspModuleNames.push(signedHspObj[key].name);
114
- }
115
- for (const key in remoteHspObj) {
116
- rawFileRouterMap.hspModuleNames.push(remoteHspObj[key].name);
117
- }
118
- });
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);
119
139
  }
120
- catch (error) {
121
- Logger_1.Logger.warn('Your DevEco Studio version less than 5.0.3.800, may cause remote hsp dependencies get failed');
140
+ for (const key in remoteHspObj) {
141
+ remoteHspModuleNames.push(remoteHspObj[key].name);
122
142
  }
123
143
  });
124
- rawFileRouterMap.hspModuleNames = [...new Set(rawFileRouterMap.hspModuleNames)];
125
- FileUtil_1.default.writeFileSync(rawFilePath, JSON.stringify(rawFileRouterMap));
126
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;
127
149
  }
128
150
  taskExec() {
129
151
  let startTime = Date.now();
@@ -141,7 +163,9 @@ class HMRouterPluginHandle {
141
163
  let routerMapFileName = moduleJsonOpt.module.routerMap.split(':')[1];
142
164
  let routerMapFilePath = this.config.getModuleRouterMapFilePath(routerMapFileName);
143
165
  let routerMapObj = FileUtil_1.default.readJson5(routerMapFilePath);
144
- this.plugin.routerMap.unshift(...routerMapObj[CommonConstants_1.default.ROUTER_MAP_KEY]);
166
+ if (routerMapFileName !== 'hm_router_map') {
167
+ this.plugin.routerMap.unshift(...routerMapObj[CommonConstants_1.default.ROUTER_MAP_KEY]);
168
+ }
145
169
  }
146
170
  this.plugin.generateRouterMap();
147
171
  moduleJsonOpt.module.routerMap = CommonConstants_1.default.MODULE_ROUTER_MAP_NAME;
@@ -169,19 +193,21 @@ class HMRouterPluginHandle {
169
193
  });
170
194
  }
171
195
  readConfig() {
172
- let levels = 0;
173
- let configParam = {};
174
- let configFilePath = '';
175
- while (levels < 4) {
176
- configFilePath = FileUtil_1.default.pathResolve(this.node.getNodePath(), CommonConstants_1.default.PARENT_DELIMITER.repeat(levels) + CommonConstants_1.default.CONFIG_FILE_NAME);
177
- if (FileUtil_1.default.exist(configFilePath)) {
178
- configParam = FileUtil_1.default.readJson5(configFilePath);
179
- break;
180
- }
181
- levels++;
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 = {};
182
209
  }
183
- let configDir = configFilePath.split(CommonConstants_1.default.FILE_SEPARATOR).slice(0, -1)
184
- .join(CommonConstants_1.default.FILE_SEPARATOR);
210
+ configDir = FileUtil_1.default.pathResolve(configFilePath, CommonConstants_1.default.PARENT_DELIMITER);
185
211
  return new HMRouterPluginConfig_1.HMRouterPluginConfig(this.node.getNodeName(), this.node.getNodePath(), configDir, configParam);
186
212
  }
187
213
  ensureNestedObject(obj, path) {
@@ -0,0 +1,9 @@
1
+ import { HvigorNode } from '@ohos/hvigor';
2
+ import { PluginParam } from './Index';
3
+ export declare class HMRouterPluginManager {
4
+ private static instance;
5
+ private controllerSet;
6
+ private constructor();
7
+ static getInstance(): HMRouterPluginManager;
8
+ registerPlugin(node: HvigorNode, pluginId: string, options: PluginParam): void;
9
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HMRouterPluginManager = void 0;
4
+ const hvigor_1 = require("@ohos/hvigor");
5
+ const PluginError_1 = require("./hmrouter_extension/error/PluginError");
6
+ const HMRouterExtension_1 = require("./hmrouter_extension/HMRouterExtension");
7
+ const framework_1 = require("./framework");
8
+ class HMRouterPluginManager {
9
+ constructor() {
10
+ this.controllerSet = new Set();
11
+ framework_1.Logger.info('', 'HMRouterPlugin starting...');
12
+ (0, framework_1.registerPluginExtension)(new HMRouterExtension_1.HMRouterDefaultExtension());
13
+ hvigor_1.hvigor.nodesEvaluated(() => {
14
+ this.controllerSet.forEach((controller) => {
15
+ controller.start();
16
+ });
17
+ });
18
+ hvigor_1.hvigor.buildFinished(() => {
19
+ this.controllerSet.forEach((controller) => {
20
+ controller.complete();
21
+ });
22
+ HMRouterPluginManager.instance = null;
23
+ framework_1.PluginStore.destroy();
24
+ framework_1.ExtensionManager.destroy();
25
+ this.controllerSet.clear();
26
+ framework_1.TsAstUtil.clearProject();
27
+ });
28
+ }
29
+ static getInstance() {
30
+ if (!HMRouterPluginManager.instance) {
31
+ HMRouterPluginManager.instance = new HMRouterPluginManager();
32
+ }
33
+ return HMRouterPluginManager.instance;
34
+ }
35
+ registerPlugin(node, pluginId, options) {
36
+ const moduleContext = node.getContext(pluginId);
37
+ if (!moduleContext) {
38
+ throw PluginError_1.PluginError.create(PluginError_1.ErrorCode.ERROR_CONFIG, node.getNodeName(), node.getNodePath());
39
+ }
40
+ const controller = new framework_1.PluginExecutionController(node, moduleContext, options.extensions);
41
+ this.controllerSet.add(controller);
42
+ if ((0, framework_1.isHspModule)(node)) {
43
+ let packageJsonPath = framework_1.PluginFileUtil.pathResolve(node.getNodePath(), 'oh-package.json5');
44
+ let packageJsonContent = framework_1.PluginFileUtil.readFileSync(packageJsonPath);
45
+ let packageJson = JSON.parse(packageJsonContent.toString());
46
+ let hspNameArr = framework_1.PluginStore.getInstance().get('hspModuleNames');
47
+ if (!hspNameArr) {
48
+ framework_1.PluginStore.getInstance().set('hspModuleNames', []);
49
+ }
50
+ framework_1.PluginStore.getInstance().get('hspModuleNames')?.push(packageJson.name);
51
+ }
52
+ }
53
+ }
54
+ exports.HMRouterPluginManager = HMRouterPluginManager;
55
+ HMRouterPluginManager.instance = null;
package/dist/Index.d.ts CHANGED
@@ -1,4 +1,10 @@
1
1
  import { HvigorPlugin } from '@ohos/hvigor';
2
- export declare function hapPlugin(): HvigorPlugin;
3
- export declare function hspPlugin(): HvigorPlugin;
4
- export declare function harPlugin(): HvigorPlugin;
2
+ import { PluginExtension } from './framework';
3
+ export * from './framework/utils';
4
+ export * from './framework/extension';
5
+ export interface PluginParam {
6
+ extensions?: PluginExtension[];
7
+ }
8
+ export declare function hapPlugin(options?: PluginParam): HvigorPlugin;
9
+ export declare function hspPlugin(options?: PluginParam): HvigorPlugin;
10
+ export declare function harPlugin(options?: PluginParam): HvigorPlugin;
package/dist/Index.js CHANGED
@@ -1,119 +1,49 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
4
15
  };
5
16
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.hapPlugin = hapPlugin;
7
- exports.hspPlugin = hspPlugin;
8
- exports.harPlugin = harPlugin;
9
- const hvigor_1 = require("@ohos/hvigor");
17
+ exports.harPlugin = exports.hspPlugin = exports.hapPlugin = void 0;
10
18
  const hvigor_ohos_plugin_1 = require("@ohos/hvigor-ohos-plugin");
11
- const Logger_1 = require("./common/Logger");
12
- const CommonConstants_1 = __importDefault(require("./constants/CommonConstants"));
13
- const TsAstUtil_1 = require("./utils/TsAstUtil");
14
- const FileUtil_1 = __importDefault(require("./utils/FileUtil"));
15
- const HMRouterPluginHandle_1 = require("./HMRouterPluginHandle");
16
- class HMRouterPluginMgr {
17
- constructor() {
18
- this.hmRouterPluginSet = new Set();
19
- hvigor_1.hvigor.nodesEvaluated(() => {
20
- this.hmRouterPluginSet.forEach((pluginHandle) => {
21
- pluginHandle.start();
22
- });
23
- });
24
- hvigor_1.hvigor.buildFinished(() => {
25
- Logger_1.Logger.info('buildFinished deleteFile exec...');
26
- this.hmRouterPluginSet.forEach((pluginHandle) => {
27
- if (pluginHandle.config.saveGeneratedFile) {
28
- Logger_1.Logger.info(pluginHandle.config.moduleName + ' saveGeneratedFile is true, skip deleting');
29
- return;
30
- }
31
- this.deleteRouterMapFile(pluginHandle);
32
- this.deleteRawFile(pluginHandle);
33
- this.deleteGeneratorFile(pluginHandle);
34
- if (pluginHandle.config.autoObfuscation) {
35
- this.deleteObfuscationFile(pluginHandle);
36
- }
37
- });
38
- HMRouterPluginMgrInstance = null;
39
- TsAstUtil_1.TsAstUtil.clearProject();
40
- });
41
- }
42
- registerHMRouterPlugin(node, pluginId) {
43
- const moduleContext = node.getContext(pluginId);
44
- if (!moduleContext) {
45
- Logger_1.Logger.error(Logger_1.PluginError.ERR_ERROR_CONFIG, node.getNodePath());
46
- throw new Error('moduleContext is null');
47
- }
48
- let pluginHandle = new HMRouterPluginHandle_1.HMRouterPluginHandle(node, moduleContext);
49
- if (pluginId === hvigor_ohos_plugin_1.OhosPluginId.OHOS_HAP_PLUGIN) {
50
- let packageJson = FileUtil_1.default.readJson5(FileUtil_1.default.pathResolve(node.getNodePath(), 'oh-package.json5'));
51
- pluginHandle.config.moduleName = packageJson.name;
52
- }
53
- this.hmRouterPluginSet.add(pluginHandle);
54
- }
55
- deleteGeneratorFile(pluginHandle) {
56
- let builderDirPath = pluginHandle.config.getBuilderDir();
57
- if (FileUtil_1.default.exist(builderDirPath)) {
58
- FileUtil_1.default.rmSync(builderDirPath, {
59
- recursive: true
60
- });
61
- Logger_1.Logger.info(pluginHandle.config.modulePath + ' delete builder dir');
62
- }
63
- }
64
- deleteRouterMapFile(pluginHandle) {
65
- let routerMapDirPath = pluginHandle.config.getRouterMapDir();
66
- if (FileUtil_1.default.exist(routerMapDirPath)) {
67
- FileUtil_1.default.unlinkSync(routerMapDirPath);
68
- Logger_1.Logger.info(routerMapDirPath + ' delete hm_router_map.json');
69
- }
70
- }
71
- deleteRawFile(pluginHandle) {
72
- let rawFilePath = pluginHandle.config.getRawFilePath();
73
- if (FileUtil_1.default.exist(rawFilePath)) {
74
- FileUtil_1.default.unlinkSync(rawFilePath);
75
- Logger_1.Logger.info(pluginHandle.config.modulePath + ' delete rawfile hm_router_map.json');
76
- }
77
- }
78
- deleteObfuscationFile(pluginHandle) {
79
- let obfuscationFilePath = pluginHandle.config.getObfuscationFilePath();
80
- if (FileUtil_1.default.exist(obfuscationFilePath)) {
81
- FileUtil_1.default.unlinkSync(obfuscationFilePath);
82
- Logger_1.Logger.info(pluginHandle.config.modulePath + ' delete obfuscation hmrouter_obfuscation_rules.txt');
83
- }
84
- }
85
- }
86
- let HMRouterPluginMgrInstance = null;
87
- function hapPlugin() {
19
+ const constants_1 = require("./hmrouter_extension/constants");
20
+ const HMRouterPluginManager_1 = require("./HMRouterPluginManager");
21
+ __exportStar(require("./framework/utils"), exports);
22
+ __exportStar(require("./framework/extension"), exports);
23
+ function hapPlugin(options = {}) {
88
24
  return {
89
- pluginId: CommonConstants_1.default.HAP_PLUGIN_ID,
25
+ pluginId: constants_1.PluginConstants.HAP_PLUGIN_ID,
90
26
  apply(node) {
91
- if (!HMRouterPluginMgrInstance) {
92
- HMRouterPluginMgrInstance = new HMRouterPluginMgr();
93
- }
94
- HMRouterPluginMgrInstance.registerHMRouterPlugin(node, hvigor_ohos_plugin_1.OhosPluginId.OHOS_HAP_PLUGIN);
95
- }
27
+ HMRouterPluginManager_1.HMRouterPluginManager.getInstance().registerPlugin(node, hvigor_ohos_plugin_1.OhosPluginId.OHOS_HAP_PLUGIN, options);
28
+ },
96
29
  };
97
30
  }
98
- function hspPlugin() {
31
+ exports.hapPlugin = hapPlugin;
32
+ function hspPlugin(options = {}) {
99
33
  return {
100
- pluginId: CommonConstants_1.default.HSP_PLUGIN_ID,
34
+ pluginId: constants_1.PluginConstants.HSP_PLUGIN_ID,
101
35
  apply(node) {
102
- if (!HMRouterPluginMgrInstance) {
103
- HMRouterPluginMgrInstance = new HMRouterPluginMgr();
104
- }
105
- HMRouterPluginMgrInstance.registerHMRouterPlugin(node, hvigor_ohos_plugin_1.OhosPluginId.OHOS_HSP_PLUGIN);
106
- }
36
+ HMRouterPluginManager_1.HMRouterPluginManager.getInstance().registerPlugin(node, hvigor_ohos_plugin_1.OhosPluginId.OHOS_HSP_PLUGIN, options);
37
+ },
107
38
  };
108
39
  }
109
- function harPlugin() {
40
+ exports.hspPlugin = hspPlugin;
41
+ function harPlugin(options = {}) {
110
42
  return {
111
- pluginId: CommonConstants_1.default.HAR_PLUGIN_ID,
43
+ pluginId: constants_1.PluginConstants.HAR_PLUGIN_ID,
112
44
  apply(node) {
113
- if (!HMRouterPluginMgrInstance) {
114
- HMRouterPluginMgrInstance = new HMRouterPluginMgr();
115
- }
116
- HMRouterPluginMgrInstance.registerHMRouterPlugin(node, hvigor_ohos_plugin_1.OhosPluginId.OHOS_HAR_PLUGIN);
117
- }
45
+ HMRouterPluginManager_1.HMRouterPluginManager.getInstance().registerPlugin(node, hvigor_ohos_plugin_1.OhosPluginId.OHOS_HAR_PLUGIN, options);
46
+ },
118
47
  };
119
48
  }
49
+ exports.harPlugin = harPlugin;
@@ -27,7 +27,7 @@ var PluginError;
27
27
  PluginError["ERR_ERROR_CONFIG"] = "ERR_INIT_COMPONENT";
28
28
  PluginError["ERR_NOT_EMPTY_STRING"] = "ERR_INIT_NOT_READY";
29
29
  PluginError["ERR_INVALID_STRING_VALUE"] = "ERR_INVALID_STRING_VALUE";
30
- })(PluginError || (exports.PluginError = PluginError = {}));
30
+ })(PluginError = exports.PluginError || (exports.PluginError = {}));
31
31
  const DEFINED_ERROR = new Map();
32
32
  DEFINED_ERROR.set(PluginError.ERR_DUPLICATE_NAME, {
33
33
  errorCode: 40000001,
@@ -4,6 +4,7 @@ export interface BaseAnalyzeResult {
4
4
  module?: string;
5
5
  annotation?: string;
6
6
  pageSourceFile?: string;
7
+ isDefaultExport?: boolean;
7
8
  }
8
9
  export interface HMRouterResult extends BaseAnalyzeResult {
9
10
  pageUrl?: any;
@@ -12,6 +13,7 @@ export interface HMRouterResult extends BaseAnalyzeResult {
12
13
  interceptors?: string[];
13
14
  animator?: string;
14
15
  lifecycle?: string;
16
+ useNavDst?: boolean;
15
17
  }
16
18
  export interface HMAnimatorResult extends BaseAnalyzeResult {
17
19
  animatorName?: string;
@@ -37,7 +39,8 @@ export declare class TemplateModel {
37
39
  componentName: string;
38
40
  dialog: boolean;
39
41
  generatorViewName: string;
40
- constructor(pageUrl: string, importPath: string, componentName: string, dialog: boolean, generatorViewName: string);
42
+ isDefaultExport?: boolean;
43
+ constructor(pageUrl: string, importPath: string, componentName: string, dialog: boolean, generatorViewName: string, isDefaultExport?: boolean);
41
44
  }
42
45
  export declare class RouterInfo {
43
46
  name: string;
@@ -2,7 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RouterInfo = exports.TemplateModel = void 0;
4
4
  class TemplateModel {
5
- constructor(pageUrl, importPath, componentName, dialog, generatorViewName) {
5
+ constructor(pageUrl, importPath, componentName, dialog, generatorViewName, isDefaultExport) {
6
+ this.isDefaultExport = isDefaultExport;
6
7
  this.pageUrl = pageUrl;
7
8
  this.importPath = importPath;
8
9
  this.componentName = componentName;
@@ -3,10 +3,9 @@ export default class HMRouterPluginConstant {
3
3
  static readonly INTERCEPTOR_PREFIX = "__interceptor__";
4
4
  static readonly LIFECYCLE_PREFIX = "__lifecycle__";
5
5
  static readonly SERVICE_PREFIX = "__service__";
6
- static readonly PAGE_URL_PREFIX = "";
7
- static readonly OBFUSCATION_FILE_NAME = "hmrouter_obfuscation_rules.txt";
8
- static readonly VARIABLE_SEPARATOR = "__";
9
- static readonly PAGE_URL = "pageUrl";
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";
10
9
  static readonly ROUTER_MAP_KEY = "routerMap";
11
10
  static readonly FILE_SEPARATOR: "\\" | "/";
12
11
  static readonly DELIMITER = "/";
@@ -15,20 +14,26 @@ export default class HMRouterPluginConstant {
15
14
  static readonly TEMP_ROUTER_MAP_PATH = "../../intermediates/router_map";
16
15
  static readonly RAWFILE_DIR = "src/main/resources/rawfile/hm_router_map.json";
17
16
  static readonly VIEW_NAME_PREFIX = "HM";
18
- static readonly VIEW_NAME_SUFFIX = ".ets";
17
+ static readonly ETS_SUFFIX = ".ets";
19
18
  static readonly JSON_SUFFIX = ".json";
20
19
  static readonly HAP_PLUGIN_ID = "HAP_HMROUTER_PLUGIN";
21
20
  static readonly HSP_PLUGIN_ID = "HSP_HMROUTER_PLUGIN";
22
21
  static readonly HAR_PLUGIN_ID = "HAR_HMROUTER_PLUGIN";
22
+ static readonly HAR_MODULE_NAME = "har";
23
23
  static readonly ROUTER_ANNOTATION = "HMRouter";
24
24
  static readonly ANIMATOR_ANNOTATION = "HMAnimator";
25
25
  static readonly INTERCEPTOR_ANNOTATION = "HMInterceptor";
26
26
  static readonly LIFECYCLE_ANNOTATION = "HMLifecycle";
27
27
  static readonly SERVICE_ANNOTATION = "HMService";
28
+ static readonly SERVICE_PROVIDE_ANNOTATION = "HMServiceProvider";
28
29
  static readonly CONFIG_FILE_NAME = "hmrouter_config.json";
29
30
  static readonly PARENT_DELIMITER = "../";
30
31
  static readonly CURRENT_DELIMITER = "./";
31
32
  static readonly LINE_BREAK = "\n";
32
33
  static readonly KEEP_FILE_NAME = "-keep-file-name";
33
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";
34
39
  }
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const path_1 = __importDefault(require("path"));
7
7
  class HMRouterPluginConstant {
8
8
  }
9
+ exports.default = HMRouterPluginConstant;
9
10
  HMRouterPluginConstant.ANIMATOR_PREFIX = '__animator__';
10
11
  HMRouterPluginConstant.INTERCEPTOR_PREFIX = '__interceptor__';
11
12
  HMRouterPluginConstant.LIFECYCLE_PREFIX = '__lifecycle__';
12
13
  HMRouterPluginConstant.SERVICE_PREFIX = '__service__';
13
- HMRouterPluginConstant.PAGE_URL_PREFIX = '';
14
- HMRouterPluginConstant.OBFUSCATION_FILE_NAME = 'hmrouter_obfuscation_rules.txt';
15
- HMRouterPluginConstant.VARIABLE_SEPARATOR = '__';
16
- HMRouterPluginConstant.PAGE_URL = 'pageUrl';
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
17
  HMRouterPluginConstant.ROUTER_MAP_KEY = 'routerMap';
18
18
  HMRouterPluginConstant.FILE_SEPARATOR = path_1.default.sep;
19
19
  HMRouterPluginConstant.DELIMITER = '/';
@@ -22,20 +22,25 @@ HMRouterPluginConstant.ROUTER_MAP_NAME = 'hm_router_map.json';
22
22
  HMRouterPluginConstant.TEMP_ROUTER_MAP_PATH = '../../intermediates/router_map';
23
23
  HMRouterPluginConstant.RAWFILE_DIR = 'src/main/resources/rawfile/hm_router_map.json';
24
24
  HMRouterPluginConstant.VIEW_NAME_PREFIX = 'HM';
25
- HMRouterPluginConstant.VIEW_NAME_SUFFIX = '.ets';
25
+ HMRouterPluginConstant.ETS_SUFFIX = '.ets';
26
26
  HMRouterPluginConstant.JSON_SUFFIX = '.json';
27
27
  HMRouterPluginConstant.HAP_PLUGIN_ID = 'HAP_HMROUTER_PLUGIN';
28
28
  HMRouterPluginConstant.HSP_PLUGIN_ID = 'HSP_HMROUTER_PLUGIN';
29
29
  HMRouterPluginConstant.HAR_PLUGIN_ID = 'HAR_HMROUTER_PLUGIN';
30
+ HMRouterPluginConstant.HAR_MODULE_NAME = 'har';
30
31
  HMRouterPluginConstant.ROUTER_ANNOTATION = 'HMRouter';
31
32
  HMRouterPluginConstant.ANIMATOR_ANNOTATION = 'HMAnimator';
32
33
  HMRouterPluginConstant.INTERCEPTOR_ANNOTATION = 'HMInterceptor';
33
34
  HMRouterPluginConstant.LIFECYCLE_ANNOTATION = 'HMLifecycle';
34
35
  HMRouterPluginConstant.SERVICE_ANNOTATION = 'HMService';
36
+ HMRouterPluginConstant.SERVICE_PROVIDE_ANNOTATION = 'HMServiceProvider';
35
37
  HMRouterPluginConstant.CONFIG_FILE_NAME = 'hmrouter_config.json';
36
38
  HMRouterPluginConstant.PARENT_DELIMITER = '../';
37
39
  HMRouterPluginConstant.CURRENT_DELIMITER = './';
38
40
  HMRouterPluginConstant.LINE_BREAK = '\n';
39
41
  HMRouterPluginConstant.KEEP_FILE_NAME = '-keep-file-name';
40
42
  HMRouterPluginConstant.KEEP_PROPERTY_NAME = '-keep-property-name';
41
- exports.default = HMRouterPluginConstant;
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';
@@ -2,10 +2,11 @@ export default class ConfigConstants {
2
2
  static readonly DEFAULT_SCAN_DIR = "src/main/ets";
3
3
  static readonly DEFAULT_ROUTER_MAP_DIR = "src/main/resources/base/profile";
4
4
  static readonly DEFAULT_BUILD_DIR = "src/main/ets/generated";
5
- static readonly DEFAULT_BUILD_TPL = "viewBuilder.ejs";
5
+ static readonly DEFAULT_BUILD_TPL = "template/viewBuilder.ejs";
6
6
  static readonly ROUTER_ANNOTATION = "HMRouter";
7
7
  static readonly ANIMATOR_ANNOTATION = "HMAnimator";
8
8
  static readonly INTERCEPTOR_ANNOTATION = "HMInterceptor";
9
9
  static readonly LIFECYCLE_ANNOTATION = "HMLifecycle";
10
10
  static readonly SERVICE_ANNOTATION = "HMService";
11
+ static readonly SERVICE_PROVIDE_ANNOTATION = "HMServiceProvider";
11
12
  }
@@ -2,14 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class ConfigConstants {
4
4
  }
5
+ exports.default = ConfigConstants;
5
6
  ConfigConstants.DEFAULT_SCAN_DIR = 'src/main/ets';
6
7
  ConfigConstants.DEFAULT_ROUTER_MAP_DIR = 'src/main/resources/base/profile';
7
8
  ConfigConstants.DEFAULT_BUILD_DIR = 'src/main/ets/generated';
8
- ConfigConstants.DEFAULT_BUILD_TPL = 'viewBuilder.ejs';
9
+ ConfigConstants.DEFAULT_BUILD_TPL = 'template/viewBuilder.ejs';
9
10
  ConfigConstants.ROUTER_ANNOTATION = 'HMRouter';
10
11
  ConfigConstants.ANIMATOR_ANNOTATION = 'HMAnimator';
11
12
  ConfigConstants.INTERCEPTOR_ANNOTATION = 'HMInterceptor';
12
13
  ConfigConstants.LIFECYCLE_ANNOTATION = 'HMLifecycle';
13
14
  ConfigConstants.SERVICE_ANNOTATION = 'HMService';
14
- exports.default = ConfigConstants;
15
+ ConfigConstants.SERVICE_PROVIDE_ANNOTATION = 'HMServiceProvider';
15
16
  ;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class TaskConstants {
4
4
  }
5
+ exports.default = TaskConstants;
5
6
  TaskConstants.PRE_BUILD = '@PreBuild';
6
7
  TaskConstants.MERGE_PROFILE = '@MergeProfile';
7
8
  TaskConstants.PROCESS_ROUTER_MAP = '@ProcessRouterMap';
@@ -9,5 +10,4 @@ TaskConstants.PROCESS_RESOURCE = '@ProcessResource';
9
10
  TaskConstants.PLUGIN_TASK = '@HMRouterPluginTask';
10
11
  TaskConstants.COPY_ROUTER_MAP_TASK = '@HMRouterCopyRouterMapToRawFileTask';
11
12
  TaskConstants.GENERATE_OBFUSCATION_TASK = '@HMRouterGenerateObfuscationFileTask';
12
- exports.default = TaskConstants;
13
13
  ;
@@ -0,0 +1,8 @@
1
+ export declare class TaskConstants {
2
+ static readonly PRE_BUILD = "@PreBuild";
3
+ static readonly PROCESS_ROUTER_MAP = "@ProcessRouterMap";
4
+ static readonly PROCESS_RESOURCE = "@ProcessResource";
5
+ static readonly PLUGIN_TASK = "@HMRouterPluginTask";
6
+ static readonly COPY_ROUTER_MAP_TASK = "@HMRouterCopyRouterMapToRawFileTask";
7
+ static readonly GENERATE_OBFUSCATION_TASK = "@HMRouterGenerateObfuscationFileTask";
8
+ }