@hadss/hmrouter-plugin 1.2.0-beta.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.
Files changed (42) hide show
  1. package/README.md +8 -0
  2. package/dist/HMRouterPluginManager.js +9 -2
  3. package/dist/framework/core/PluginExecutionController.d.ts +11 -0
  4. package/dist/framework/core/PluginExecutionController.js +129 -22
  5. package/dist/framework/utils/FileUtil.d.ts +4 -0
  6. package/dist/framework/utils/FileUtil.js +11 -0
  7. package/dist/hmrouter_extension/config/HMRouterPluginConfig.js +3 -4
  8. package/dist/hmrouter_extension/processor/CodeGenerationProcessor.js +2 -1
  9. package/dist/hmrouter_extension/processor/InitializerProcessor.d.ts +1 -0
  10. package/dist/hmrouter_extension/processor/InitializerProcessor.js +29 -5
  11. package/dist/hmrouter_extension/processor/ObfuscationProcessor.js +1 -1
  12. package/dist/hmrouter_extension/processor/ResourceProcessor.js +14 -0
  13. package/dist/hmrouter_extension/processor/RouterMapBuildingProcessor.js +2 -1
  14. package/package.json +1 -1
  15. package/dist/HMRouterAnalyzer.d.ts +0 -31
  16. package/dist/HMRouterAnalyzer.js +0 -343
  17. package/dist/HMRouterHvigorPlugin.d.ts +0 -15
  18. package/dist/HMRouterHvigorPlugin.js +0 -153
  19. package/dist/HMRouterPluginConfig.d.ts +0 -39
  20. package/dist/HMRouterPluginConfig.js +0 -74
  21. package/dist/HMRouterPluginHandle.d.ts +0 -23
  22. package/dist/HMRouterPluginHandle.js +0 -222
  23. package/dist/common/Logger.d.ts +0 -13
  24. package/dist/common/Logger.js +0 -55
  25. package/dist/common/PluginModel.d.ts +0 -51
  26. package/dist/common/PluginModel.js +0 -23
  27. package/dist/constants/CommonConstants.d.ts +0 -39
  28. package/dist/constants/CommonConstants.js +0 -46
  29. package/dist/constants/ConfigConstants.d.ts +0 -12
  30. package/dist/constants/ConfigConstants.js +0 -16
  31. package/dist/constants/TaskConstants.d.ts +0 -9
  32. package/dist/constants/TaskConstants.js +0 -13
  33. package/dist/store/PluginStore.d.ts +0 -14
  34. package/dist/store/PluginStore.js +0 -20
  35. package/dist/utils/FileUtil.d.ts +0 -13
  36. package/dist/utils/FileUtil.js +0 -20
  37. package/dist/utils/ObfuscationUtil.d.ts +0 -4
  38. package/dist/utils/ObfuscationUtil.js +0 -34
  39. package/dist/utils/StringUtil.d.ts +0 -3
  40. package/dist/utils/StringUtil.js +0 -18
  41. package/dist/utils/TsAstUtil.d.ts +0 -9
  42. package/dist/utils/TsAstUtil.js +0 -97
package/README.md CHANGED
@@ -438,6 +438,14 @@ hvigor 5.7.3及以上
438
438
 
439
439
  ## 更新日志
440
440
 
441
+ ### 1.2.0-beta.1 (2025.07.29)
442
+
443
+ - 修复相同组件名称冲突的问题
444
+ - 修复默认模版的问题
445
+ - 修复ohosTest编译错误
446
+ - 修复oh-package.json5含注解的编译错误
447
+ - 修复自动混淆问题
448
+
441
449
  ### 1.2.0-beta.0 (2025.06.17)
442
450
 
443
451
  - 新增插件扩展能力
@@ -49,13 +49,20 @@ class HMRouterPluginManager {
49
49
  this.controllerMap.set(node.getNodeName(), controller);
50
50
  if ((0, framework_1.isHspModule)(node)) {
51
51
  let packageJsonPath = framework_1.PluginFileUtil.pathResolve(node.getNodePath(), 'oh-package.json5');
52
- let packageJsonContent = framework_1.PluginFileUtil.readFileSync(packageJsonPath);
53
- let packageJson = JSON.parse(packageJsonContent.toString());
52
+ let packageJson = framework_1.PluginFileUtil.readJson5(packageJsonPath);
54
53
  let hspNameArr = framework_1.PluginStore.getInstance().get('hspModuleNames');
55
54
  if (!hspNameArr) {
56
55
  framework_1.PluginStore.getInstance().set('hspModuleNames', []);
57
56
  }
57
+ let hspModulesInfo = framework_1.PluginStore.getInstance().get('hspModulesInfo');
58
+ if (!hspModulesInfo) {
59
+ framework_1.PluginStore.getInstance().set('hspModulesInfo', []);
60
+ }
58
61
  framework_1.PluginStore.getInstance().get('hspModuleNames')?.push(packageJson.name);
62
+ framework_1.PluginStore.getInstance().get('hspModulesInfo')?.push({
63
+ moduleName: node.getNodeName(),
64
+ packageName: packageJson.name
65
+ });
59
66
  }
60
67
  }
61
68
  addModuleNode(node) {
@@ -7,9 +7,20 @@ export declare class PluginExecutionController {
7
7
  private readonly taskManager;
8
8
  private readonly baseContext;
9
9
  private extensionContextCache;
10
+ private originalBuilderDir?;
10
11
  constructor(node: HvigorNode, moduleContext: OhosModuleContext, moduleExtensions?: PluginExtension[]);
11
12
  start(): void;
12
13
  complete(): void;
13
14
  private initializeContext;
14
15
  private registerHvigorTasks;
16
+ private filterScanFilesForTarget;
17
+ private backupScanFiles;
18
+ private restoreScanFiles;
19
+ private backupConfig;
20
+ private restoreConfig;
21
+ private adjustConfigForTarget;
22
+ private registerMainPluginTask;
23
+ private registerObfuscationTask;
24
+ private registerCopyRouterMapTask;
25
+ private getTaskName;
15
26
  }
@@ -5,6 +5,7 @@ const TaskManager_1 = require("./TaskManager");
5
5
  const TaskStage_1 = require("./TaskStage");
6
6
  const constants_1 = require("../constants");
7
7
  const extension_1 = require("../extension");
8
+ const utils_1 = require("../utils");
8
9
  class PluginExecutionController {
9
10
  constructor(node, moduleContext, moduleExtensions) {
10
11
  this.extensionContextCache = new Map();
@@ -28,35 +29,141 @@ class PluginExecutionController {
28
29
  registerHvigorTasks() {
29
30
  this.moduleContext.targets((target) => {
30
31
  const targetName = target.getTargetName();
31
- this.node.registerTask({
32
- name: targetName + constants_1.TaskConstants.PLUGIN_TASK,
33
- run: () => {
32
+ this.taskManager.context.currentTarget = target;
33
+ this.registerMainPluginTask(targetName);
34
+ this.registerObfuscationTask(targetName);
35
+ if ((0, utils_1.isHapModule)(this.node) || (0, utils_1.isHspModule)(this.node)) {
36
+ this.registerCopyRouterMapTask(targetName);
37
+ }
38
+ });
39
+ }
40
+ filterScanFilesForTarget() {
41
+ const currentTargetName = this.taskManager.context.currentTarget?.getTargetName();
42
+ if (!currentTargetName) {
43
+ return;
44
+ }
45
+ const buildProfileTargets = this.moduleContext.getBuildProfileOpt().targets || [];
46
+ const targetOpt = buildProfileTargets.find((target) => target.name === currentTargetName);
47
+ if (!targetOpt?.source?.sourceRoots || targetOpt.source.sourceRoots.length === 0) {
48
+ return;
49
+ }
50
+ const moduleRoot = this.moduleContext.getModulePath();
51
+ const absoluteSourceRoots = targetOpt.source.sourceRoots.map((sourceRoot) => {
52
+ const absolutePath = utils_1.PluginFileUtil.resolve(moduleRoot, sourceRoot);
53
+ const normalizedPath = utils_1.PluginFileUtil.normalize(absolutePath);
54
+ return normalizedPath.endsWith(utils_1.PluginFileUtil.sep) ? normalizedPath : normalizedPath + utils_1.PluginFileUtil.sep;
55
+ });
56
+ this.baseContext.scanFiles = this.baseContext.scanFiles.filter((filePath) => {
57
+ const normalizedFilePath = utils_1.PluginFileUtil.normalize(filePath);
58
+ return absoluteSourceRoots.some((sourceRootPath) => {
59
+ return normalizedFilePath.startsWith(sourceRootPath);
60
+ });
61
+ });
62
+ }
63
+ backupScanFiles() {
64
+ return [...this.baseContext.scanFiles];
65
+ }
66
+ restoreScanFiles(backup) {
67
+ this.baseContext.scanFiles = backup;
68
+ }
69
+ backupConfig() {
70
+ const hmrouterContext = this.taskManager.context;
71
+ if (hmrouterContext.config && hmrouterContext.config.builderDir) {
72
+ this.originalBuilderDir = hmrouterContext.config.builderDir;
73
+ }
74
+ }
75
+ restoreConfig() {
76
+ if (this.originalBuilderDir) {
77
+ const hmrouterContext = this.taskManager.context;
78
+ if (hmrouterContext.config) {
79
+ hmrouterContext.config.builderDir = this.originalBuilderDir;
80
+ }
81
+ this.originalBuilderDir = undefined;
82
+ }
83
+ }
84
+ adjustConfigForTarget() {
85
+ const currentTargetName = this.taskManager.context.currentTarget?.getTargetName();
86
+ if (!currentTargetName) {
87
+ return;
88
+ }
89
+ const buildProfileTargets = this.moduleContext.getBuildProfileOpt().targets || [];
90
+ const targetOpt = buildProfileTargets.find((target) => target.name === currentTargetName);
91
+ if (!targetOpt?.source?.sourceRoots || targetOpt.source.sourceRoots.length === 0) {
92
+ return;
93
+ }
94
+ const hmrouterContext = this.taskManager.context;
95
+ if (!hmrouterContext.config || !hmrouterContext.config.builderDir) {
96
+ return;
97
+ }
98
+ const firstSourceRoot = targetOpt.source.sourceRoots[0];
99
+ const cleanSourceRoot = firstSourceRoot.replace(/^\.\//, '');
100
+ hmrouterContext.config.builderDir = `${cleanSourceRoot}/ets/generated`;
101
+ }
102
+ registerMainPluginTask(targetName) {
103
+ this.node.registerTask({
104
+ name: this.getTaskName(targetName, constants_1.TaskConstants.PLUGIN_TASK),
105
+ run: () => {
106
+ const scanFilesBackup = this.backupScanFiles();
107
+ try {
108
+ this.backupConfig();
109
+ this.filterScanFilesForTarget();
110
+ this.adjustConfigForTarget();
34
111
  this.taskManager.executeStage(TaskStage_1.TaskStage.AFTER_ANNOTATION_ANALYSIS);
35
112
  this.taskManager.executeStage(TaskStage_1.TaskStage.AFTER_CODE_GENERATION);
36
113
  this.taskManager.executeStage(TaskStage_1.TaskStage.AFTER_ROUTER_MAP_BUILDING);
37
114
  this.taskManager.executeStage(TaskStage_1.TaskStage.AFTER_CONFIG_UPDATE);
38
- },
39
- dependencies: [],
40
- postDependencies: [targetName + constants_1.TaskConstants.PRE_BUILD],
41
- });
42
- this.node.registerTask({
43
- name: targetName + constants_1.TaskConstants.GENERATE_OBFUSCATION_TASK,
44
- run: () => {
115
+ }
116
+ finally {
117
+ this.restoreConfig();
118
+ this.restoreScanFiles(scanFilesBackup);
119
+ }
120
+ },
121
+ dependencies: [],
122
+ postDependencies: [this.getTaskName(targetName, constants_1.TaskConstants.PRE_BUILD)],
123
+ });
124
+ }
125
+ registerObfuscationTask(targetName) {
126
+ this.node.registerTask({
127
+ name: this.getTaskName(targetName, constants_1.TaskConstants.GENERATE_OBFUSCATION_TASK),
128
+ run: () => {
129
+ const scanFilesBackup = this.backupScanFiles();
130
+ try {
131
+ this.backupConfig();
132
+ this.filterScanFilesForTarget();
133
+ this.adjustConfigForTarget();
45
134
  this.taskManager.executeStage(TaskStage_1.TaskStage.AFTER_OBFUSCATION_PROCESS);
46
- },
47
- dependencies: [targetName + constants_1.TaskConstants.PLUGIN_TASK],
48
- postDependencies: [targetName + constants_1.TaskConstants.PRE_BUILD],
49
- });
50
- this.node.registerTask({
51
- name: targetName + constants_1.TaskConstants.COPY_ROUTER_MAP_TASK,
52
- run: () => {
53
- this.taskManager.context.currentTarget = target;
135
+ }
136
+ finally {
137
+ this.restoreConfig();
138
+ this.restoreScanFiles(scanFilesBackup);
139
+ }
140
+ },
141
+ dependencies: [this.getTaskName(targetName, constants_1.TaskConstants.PLUGIN_TASK)],
142
+ postDependencies: [this.getTaskName(targetName, constants_1.TaskConstants.PRE_BUILD)],
143
+ });
144
+ }
145
+ registerCopyRouterMapTask(targetName) {
146
+ this.node.registerTask({
147
+ name: this.getTaskName(targetName, constants_1.TaskConstants.COPY_ROUTER_MAP_TASK),
148
+ run: () => {
149
+ const scanFilesBackup = this.backupScanFiles();
150
+ try {
151
+ this.backupConfig();
152
+ this.filterScanFilesForTarget();
153
+ this.adjustConfigForTarget();
54
154
  this.taskManager.executeStage(TaskStage_1.TaskStage.AFTER_RESOURCE_PROCESS);
55
- },
56
- dependencies: [targetName + constants_1.TaskConstants.PROCESS_ROUTER_MAP],
57
- postDependencies: [targetName + constants_1.TaskConstants.PROCESS_RESOURCE],
58
- });
155
+ }
156
+ finally {
157
+ this.restoreConfig();
158
+ this.restoreScanFiles(scanFilesBackup);
159
+ }
160
+ },
161
+ dependencies: [this.getTaskName(targetName, constants_1.TaskConstants.PROCESS_ROUTER_MAP)],
162
+ postDependencies: [this.getTaskName(targetName, constants_1.TaskConstants.PROCESS_RESOURCE)],
59
163
  });
60
164
  }
165
+ getTaskName(targetName, taskConstant) {
166
+ return targetName + taskConstant;
167
+ }
61
168
  }
62
169
  exports.PluginExecutionController = PluginExecutionController;
@@ -3,6 +3,7 @@
3
3
  import { FileUtil } from '@ohos/hvigor';
4
4
  import fs from 'fs';
5
5
  export declare class PluginFileUtil extends FileUtil {
6
+ static readonly sep: "\\" | "/";
6
7
  static rmSync(path: fs.PathLike, options?: fs.RmOptions): void;
7
8
  static unlinkSync(path: fs.PathLike): void;
8
9
  static readdirSync(path: fs.PathLike, options?: {
@@ -10,4 +11,7 @@ export declare class PluginFileUtil extends FileUtil {
10
11
  withFileTypes?: false | undefined;
11
12
  recursive?: boolean | undefined;
12
13
  }): string[];
14
+ static normalize(filePath: string): string;
15
+ static resolve(...paths: string[]): string;
16
+ static join(...paths: string[]): string;
13
17
  }
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PluginFileUtil = void 0;
7
7
  const hvigor_1 = require("@ohos/hvigor");
8
8
  const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
9
10
  class PluginFileUtil extends hvigor_1.FileUtil {
10
11
  static rmSync(path, options) {
11
12
  return fs_1.default.rmSync(path, options);
@@ -16,5 +17,15 @@ class PluginFileUtil extends hvigor_1.FileUtil {
16
17
  static readdirSync(path, options) {
17
18
  return fs_1.default.readdirSync(path, options);
18
19
  }
20
+ static normalize(filePath) {
21
+ return path_1.default.normalize(filePath);
22
+ }
23
+ static resolve(...paths) {
24
+ return path_1.default.resolve(...paths);
25
+ }
26
+ static join(...paths) {
27
+ return path_1.default.join(...paths);
28
+ }
19
29
  }
20
30
  exports.PluginFileUtil = PluginFileUtil;
31
+ PluginFileUtil.sep = path_1.default.sep;
@@ -48,11 +48,10 @@ class HMRouterPluginConfig {
48
48
  return framework_1.PluginFileUtil.pathResolve(this.modulePath, constants_1.FilePathConstants.RAWFILE_DIR);
49
49
  }
50
50
  getDefaultTplFilePath() {
51
- let templateFilePath = framework_1.PluginFileUtil.pathResolve(this.configDir, this.defaultPageTemplate);
52
- if (framework_1.PluginFileUtil.exist(templateFilePath)) {
53
- return templateFilePath;
51
+ if (path_1.default.isAbsolute(this.defaultPageTemplate) && framework_1.PluginFileUtil.exist(this.defaultPageTemplate)) {
52
+ return this.defaultPageTemplate;
54
53
  }
55
- return framework_1.PluginFileUtil.pathResolve(__dirname, constants_1.FilePathConstants.PARENT_DELIMITER.repeat(3) + this.defaultPageTemplate);
54
+ return framework_1.PluginFileUtil.pathResolve(__dirname, constants_1.FilePathConstants.PARENT_DELIMITER.repeat(3) + constants_1.TemplateConstants.VIEW_BUILDER_TEMPLATE);
56
55
  }
57
56
  getObfuscationFilePath() {
58
57
  return framework_1.PluginFileUtil.pathResolve(this.modulePath, constants_1.FilePathConstants.OBFUSCATION_FILE_NAME);
@@ -33,7 +33,8 @@ class CodeGenerationProcessor {
33
33
  tempFilePath = this.determineTemplatePath(result, tempFilePath);
34
34
  const generatedFilePath = this.generateFile(templateModel, tempFilePath);
35
35
  framework_1.Logger.info(this.context.node.getNodeName(), `Builder ${templateModel.generatorViewName}.ets has been generated in ${generatedFilePath}`);
36
- this.context.generatedPaths.set(result.name, generatedFilePath);
36
+ const uniqueKey = `${result.name}#${result.pageUrl}`;
37
+ this.context.generatedPaths.set(uniqueKey, generatedFilePath);
37
38
  }
38
39
  matchedPath(filePath, customPageTemplate, defaultTplFilePath) {
39
40
  for (const template of customPageTemplate) {
@@ -9,6 +9,7 @@ export declare class InitializerProcessor {
9
9
  private readConfigFile;
10
10
  private readProjectConfig;
11
11
  private readModuleConfig;
12
+ private resolveConfigPaths;
12
13
  private mergeConfigs;
13
14
  private setupAppContext;
14
15
  private createConfigInstance;
@@ -52,12 +52,27 @@ class InitializerProcessor {
52
52
  return configParam;
53
53
  }
54
54
  readProjectConfig() {
55
- const projectConfigFilePath = framework_1.PluginFileUtil.pathResolve(framework_1.PluginStore.getInstance().get('projectFilePath'), constants_1.FilePathConstants.CONFIG_FILE_NAME);
56
- return this.readConfigFile(projectConfigFilePath);
55
+ const projectPath = framework_1.PluginStore.getInstance().get('projectFilePath');
56
+ const projectConfigFilePath = framework_1.PluginFileUtil.pathResolve(projectPath, constants_1.FilePathConstants.CONFIG_FILE_NAME);
57
+ const configParam = this.readConfigFile(projectConfigFilePath);
58
+ return this.resolveConfigPaths(configParam, projectPath);
57
59
  }
58
60
  readModuleConfig(node) {
59
- const moduleConfigFilePath = framework_1.PluginFileUtil.pathResolve(node.getNodePath(), constants_1.FilePathConstants.CONFIG_FILE_NAME);
60
- return this.readConfigFile(moduleConfigFilePath);
61
+ const modulePath = node.getNodePath();
62
+ const moduleConfigFilePath = framework_1.PluginFileUtil.pathResolve(modulePath, constants_1.FilePathConstants.CONFIG_FILE_NAME);
63
+ const configParam = this.readConfigFile(moduleConfigFilePath);
64
+ return this.resolveConfigPaths(configParam, modulePath);
65
+ }
66
+ resolveConfigPaths(configParam, basePath) {
67
+ if (configParam.defaultPageTemplate) {
68
+ configParam.defaultPageTemplate = framework_1.PluginFileUtil.pathResolve(basePath, configParam.defaultPageTemplate);
69
+ }
70
+ if (configParam.customPageTemplate) {
71
+ configParam.customPageTemplate.forEach((item) => {
72
+ item.templatePath = framework_1.PluginFileUtil.pathResolve(basePath, item.templatePath);
73
+ });
74
+ }
75
+ return configParam;
61
76
  }
62
77
  mergeConfigs(projectConfigParam, moduleConfigParam) {
63
78
  const defaultConfig = {
@@ -90,7 +105,16 @@ class InitializerProcessor {
90
105
  let packageJson = framework_1.PluginFileUtil.readJson5(framework_1.PluginFileUtil.pathResolve(node.getNodePath(), constants_1.FilePathConstants.OH_PACKAGE_FILE_NAME));
91
106
  nodeName = packageJson.name;
92
107
  }
93
- return new HMRouterPluginConfig_1.HMRouterPluginConfig(nodeName, modulePath, modulePath, configParam);
108
+ let configDir = modulePath;
109
+ const moduleConfigPath = framework_1.PluginFileUtil.pathResolve(modulePath, constants_1.FilePathConstants.CONFIG_FILE_NAME);
110
+ const projectConfigPath = framework_1.PluginFileUtil.pathResolve(framework_1.PluginStore.getInstance().get('projectFilePath'), constants_1.FilePathConstants.CONFIG_FILE_NAME);
111
+ if (framework_1.PluginFileUtil.exist(moduleConfigPath)) {
112
+ configDir = modulePath;
113
+ }
114
+ else if (framework_1.PluginFileUtil.exist(projectConfigPath)) {
115
+ configDir = framework_1.PluginStore.getInstance().get('projectFilePath');
116
+ }
117
+ return new HMRouterPluginConfig_1.HMRouterPluginConfig(nodeName, modulePath, configDir, configParam);
94
118
  }
95
119
  }
96
120
  exports.InitializerProcessor = InitializerProcessor;
@@ -86,7 +86,7 @@ class ObfuscationProcessor {
86
86
  return routerInfo.name.includes('__');
87
87
  })
88
88
  .map((routerInfo) => {
89
- return routerInfo.customData.className;
89
+ return routerInfo.customData.name;
90
90
  })),
91
91
  ];
92
92
  let functionName = [
@@ -27,6 +27,20 @@ class ResourceProcessProcessor {
27
27
  let rawFileRouterMap = JSON.parse(framework_1.PluginFileUtil.readFileSync(rawFilePath).toString());
28
28
  rawFileRouterMap.hspModuleNames = [...new Set(framework_1.PluginStore.getInstance().get('hspModuleNames'))];
29
29
  rawFileRouterMap.hspModuleNames.push(...this.getRemoteHspModuleNames(this.context.node.getAllPluginIds()));
30
+ let hspModulesInfo = framework_1.PluginStore.getInstance().get('hspModulesInfo');
31
+ if (hspModulesInfo && hspModulesInfo.length > 0) {
32
+ rawFileRouterMap.hspModulesInfo = hspModulesInfo;
33
+ }
34
+ else {
35
+ rawFileRouterMap.hspModulesInfo = [];
36
+ }
37
+ let remoteHspModuleNames = this.getRemoteHspModuleNames(this.context.node.getAllPluginIds());
38
+ for (const remoteName of remoteHspModuleNames) {
39
+ rawFileRouterMap.hspModulesInfo.push({
40
+ moduleName: remoteName,
41
+ packageName: remoteName
42
+ });
43
+ }
30
44
  framework_1.PluginFileUtil.writeFileSync(rawFilePath, JSON.stringify(rawFileRouterMap));
31
45
  }
32
46
  getRemoteHspModuleNames(pluginIds) {
@@ -25,7 +25,8 @@ class RouterMapBuildingProcessor {
25
25
  .replaceAll(constants_1.FilePathConstants.FILE_SEPARATOR, constants_1.FilePathConstants.DELIMITER);
26
26
  if (result.annotation === constants_1.AnnotationConstants.ROUTER_ANNOTATION) {
27
27
  let pageUrl = result.pageUrl;
28
- let builderPath = this.context.generatedPaths.get(result.name) || '';
28
+ let uniqueKey = `${result.name}#${pageUrl}`;
29
+ let builderPath = this.context.generatedPaths.get(uniqueKey) || '';
29
30
  this.context.routerMap.push({
30
31
  name: pageUrl,
31
32
  pageSourceFile: builderPath,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hadss/hmrouter-plugin",
3
- "version": "1.2.0-beta.0",
3
+ "version": "1.2.0-beta.2",
4
4
  "description": "HMRouter Compiler Plugin",
5
5
  "main": "dist/Index.js",
6
6
  "scripts": {
@@ -1,31 +0,0 @@
1
- import { AnalyzerResultLike } from './common/PluginModel';
2
- import { HMRouterPluginConfig } from './HMRouterPluginConfig';
3
- export declare class AnalyzerController {
4
- private analyzeResult;
5
- analyzeFile(sourceFilePath: string, config: HMRouterPluginConfig): void;
6
- parseConstants(): void;
7
- private parsePropertyValue;
8
- getAnalyzeResultSet(): Set<AnalyzerResultLike>;
9
- clearAnalyzeResultSet(): void;
10
- }
11
- export declare class AnalyzerService {
12
- private readonly sourceFilePath;
13
- private sourceFile;
14
- private config;
15
- private analyzerResultSet;
16
- private importMap;
17
- constructor(sourceFilePath: string, config: HMRouterPluginConfig);
18
- start(): void;
19
- getResult(): Set<AnalyzerResultLike>;
20
- private analyzeImport;
21
- private analyzeRouter;
22
- private parseFileByLineOrder;
23
- private analyzeComponent;
24
- private addToResultSet;
25
- private parseDecorator;
26
- private parseDecoratorArguments;
27
- private parseIdentifierPropertyValue;
28
- private parsePrimitiveValue;
29
- private getVariableFilePath;
30
- private getOtherModuleVariableFilePath;
31
- }