@ng-annotate/angular 0.3.11 → 0.3.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-annotate/angular",
3
- "version": "0.3.11",
3
+ "version": "0.3.13",
4
4
  "schematics": "./schematics/collection.json",
5
5
  "description": "Angular library for ng-annotate-mcp — browser overlay for annotating components and routing instructions to an AI agent",
6
6
  "keywords": [
@@ -95,7 +95,14 @@ function addVitePlugin() {
95
95
  return;
96
96
  }
97
97
  content = insertAfterLastImport(content, "import { ngAnnotateMcp } from '@ng-annotate/vite-plugin';");
98
- content = content.replace(/plugins\s*:\s*\[/, 'plugins: [...ngAnnotateMcp(), ');
98
+ if (/plugins\s*:\s*\[/.test(content)) {
99
+ // Existing plugins array — prepend into it
100
+ content = content.replace(/plugins\s*:\s*\[/, 'plugins: [...ngAnnotateMcp(), ');
101
+ }
102
+ else {
103
+ // No plugins array — inject one into defineConfig({...})
104
+ content = content.replace(/defineConfig\(\s*\{/, 'defineConfig({\n plugins: [...ngAnnotateMcp()],');
105
+ }
99
106
  tree.overwrite(viteConfigPath, content);
100
107
  context.logger.info(`✅ Added ngAnnotateMcp() to ${viteConfigPath}`);
101
108
  };
@@ -78,7 +78,14 @@ function addVitePlugin(): Rule {
78
78
  }
79
79
 
80
80
  content = insertAfterLastImport(content, "import { ngAnnotateMcp } from '@ng-annotate/vite-plugin';");
81
- content = content.replace(/plugins\s*:\s*\[/, 'plugins: [...ngAnnotateMcp(), ');
81
+
82
+ if (/plugins\s*:\s*\[/.test(content)) {
83
+ // Existing plugins array — prepend into it
84
+ content = content.replace(/plugins\s*:\s*\[/, 'plugins: [...ngAnnotateMcp(), ');
85
+ } else {
86
+ // No plugins array — inject one into defineConfig({...})
87
+ content = content.replace(/defineConfig\(\s*\{/, 'defineConfig({\n plugins: [...ngAnnotateMcp()],');
88
+ }
82
89
 
83
90
  tree.overwrite(viteConfigPath, content);
84
91
  context.logger.info(`✅ Added ngAnnotateMcp() to ${viteConfigPath}`);