vite-plugin-ai-annotator 1.0.3 → 1.1.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.
@@ -7030,6 +7030,28 @@
7030
7030
  }
7031
7031
  }
7032
7032
  function getVanillaComponentInfo(element) {
7033
+ const sourceLoc = element.getAttribute("data-source-loc");
7034
+ if (sourceLoc) {
7035
+ const match = sourceLoc.match(/^(.+):(\d+):(\d+)$/);
7036
+ if (match) {
7037
+ const [, file, line, column] = match;
7038
+ return {
7039
+ componentLocation: file,
7040
+ componentName: element.tagName.toLowerCase(),
7041
+ framework: "vanilla",
7042
+ elementLocation: {
7043
+ file,
7044
+ line: parseInt(line, 10),
7045
+ column: parseInt(column, 10)
7046
+ },
7047
+ sourceMap: {
7048
+ originalLine: parseInt(line, 10),
7049
+ originalColumn: parseInt(column, 10),
7050
+ originalSource: file
7051
+ }
7052
+ };
7053
+ }
7054
+ }
7033
7055
  const componentName = element.getAttribute("data-component-name");
7034
7056
  const componentFile = element.getAttribute("data-component-file");
7035
7057
  if (!componentName && !componentFile) {
@@ -20,6 +20,12 @@ export interface AiAnnotatorOptions {
20
20
  * @default false
21
21
  */
22
22
  verbose?: boolean;
23
+ /**
24
+ * Inject source location data attributes into HTML elements
25
+ * Enables precise line number detection for vanilla HTML/JS projects
26
+ * @default true
27
+ */
28
+ injectSourceLoc?: boolean;
23
29
  }
24
30
  export declare function aiAnnotator(options?: AiAnnotatorOptions): Plugin;
25
31
  export default aiAnnotator;