@qontinui/ui-bridge 0.3.0 → 0.3.1

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 (127) hide show
  1. package/dist/ai/index.d.mts +312 -155
  2. package/dist/ai/index.d.ts +312 -155
  3. package/dist/ai/index.js +2363 -67
  4. package/dist/ai/index.js.map +1 -1
  5. package/dist/ai/index.mjs +2328 -68
  6. package/dist/ai/index.mjs.map +1 -1
  7. package/dist/annotations/index.d.mts +218 -0
  8. package/dist/annotations/index.d.ts +218 -0
  9. package/dist/annotations/index.js +246 -0
  10. package/dist/annotations/index.js.map +1 -0
  11. package/dist/annotations/index.mjs +241 -0
  12. package/dist/annotations/index.mjs.map +1 -0
  13. package/dist/assertions-BSR3afVr.d.ts +161 -0
  14. package/dist/assertions-CTw1hfOx.d.mts +161 -0
  15. package/dist/babel-plugin/index.js +23 -34
  16. package/dist/babel-plugin/index.js.map +1 -1
  17. package/dist/babel-plugin/index.mjs +23 -34
  18. package/dist/babel-plugin/index.mjs.map +1 -1
  19. package/dist/browser-capture-Bms60T6f.d.mts +47 -0
  20. package/dist/browser-capture-CsTU29mb.d.ts +47 -0
  21. package/dist/control/index.d.mts +26 -7
  22. package/dist/control/index.d.ts +26 -7
  23. package/dist/control/index.js +276 -48
  24. package/dist/control/index.js.map +1 -1
  25. package/dist/control/index.mjs +276 -48
  26. package/dist/control/index.mjs.map +1 -1
  27. package/dist/core/index.d.mts +2 -2
  28. package/dist/core/index.d.ts +2 -2
  29. package/dist/core/index.js.map +1 -1
  30. package/dist/core/index.mjs.map +1 -1
  31. package/dist/debug/index.d.mts +5 -3
  32. package/dist/debug/index.d.ts +5 -3
  33. package/dist/debug/index.js +925 -1
  34. package/dist/debug/index.js.map +1 -1
  35. package/dist/debug/index.mjs +924 -2
  36. package/dist/debug/index.mjs.map +1 -1
  37. package/dist/index.d.mts +12 -7
  38. package/dist/index.d.ts +12 -7
  39. package/dist/index.js +4720 -173
  40. package/dist/index.js.map +1 -1
  41. package/dist/index.mjs +4656 -174
  42. package/dist/index.mjs.map +1 -1
  43. package/dist/{metrics-DTA2bwG7.d.mts → metrics-DuA2qIIz.d.mts} +2 -2
  44. package/dist/{metrics-BfiT_rhZ.d.ts → metrics-KFAAKNEB.d.ts} +2 -2
  45. package/dist/native/control/index.js +2 -7
  46. package/dist/native/control/index.js.map +1 -1
  47. package/dist/native/control/index.mjs +2 -7
  48. package/dist/native/control/index.mjs.map +1 -1
  49. package/dist/native/core/index.js.map +1 -1
  50. package/dist/native/core/index.mjs.map +1 -1
  51. package/dist/native/debug/index.js +23 -66
  52. package/dist/native/debug/index.js.map +1 -1
  53. package/dist/native/debug/index.mjs +23 -66
  54. package/dist/native/debug/index.mjs.map +1 -1
  55. package/dist/native/index.js +89 -131
  56. package/dist/native/index.js.map +1 -1
  57. package/dist/native/index.mjs +89 -131
  58. package/dist/native/index.mjs.map +1 -1
  59. package/dist/native/react/index.js +28 -52
  60. package/dist/native/react/index.js.map +1 -1
  61. package/dist/native/react/index.mjs +28 -52
  62. package/dist/native/react/index.mjs.map +1 -1
  63. package/dist/native/server/index.js +38 -13
  64. package/dist/native/server/index.js.map +1 -1
  65. package/dist/native/server/index.mjs +38 -13
  66. package/dist/native/server/index.mjs.map +1 -1
  67. package/dist/react/index.d.mts +107 -8
  68. package/dist/react/index.d.ts +107 -8
  69. package/dist/react/index.js +2194 -84
  70. package/dist/react/index.js.map +1 -1
  71. package/dist/react/index.mjs +2194 -85
  72. package/dist/react/index.mjs.map +1 -1
  73. package/dist/{registry-BKLEm-yk.d.ts → registry-C6dDtn1v.d.ts} +27 -2
  74. package/dist/{registry-BmZgyCz8.d.mts → registry-POtcxnal.d.mts} +27 -2
  75. package/dist/render-log/index.d.mts +1 -1
  76. package/dist/render-log/index.d.ts +1 -1
  77. package/dist/server/express.d.mts +5 -4
  78. package/dist/server/express.d.ts +5 -4
  79. package/dist/server/express.js +104 -2
  80. package/dist/server/express.js.map +1 -1
  81. package/dist/server/express.mjs +104 -2
  82. package/dist/server/express.mjs.map +1 -1
  83. package/dist/server/handlers.d.mts +36 -5
  84. package/dist/server/handlers.d.ts +36 -5
  85. package/dist/server/handlers.js +3129 -224
  86. package/dist/server/handlers.js.map +1 -1
  87. package/dist/server/handlers.mjs +3129 -224
  88. package/dist/server/handlers.mjs.map +1 -1
  89. package/dist/server/index.d.mts +7 -5
  90. package/dist/server/index.d.ts +7 -5
  91. package/dist/server/index.js +3215 -183
  92. package/dist/server/index.js.map +1 -1
  93. package/dist/server/index.mjs +3215 -183
  94. package/dist/server/index.mjs.map +1 -1
  95. package/dist/server/nextjs.d.mts +6 -4
  96. package/dist/server/nextjs.d.ts +6 -4
  97. package/dist/server/nextjs.js +106 -3
  98. package/dist/server/nextjs.js.map +1 -1
  99. package/dist/server/nextjs.mjs +106 -3
  100. package/dist/server/nextjs.mjs.map +1 -1
  101. package/dist/server/standalone.d.mts +6 -5
  102. package/dist/server/standalone.d.ts +6 -5
  103. package/dist/server/standalone.js +131 -5
  104. package/dist/server/standalone.js.map +1 -1
  105. package/dist/server/standalone.mjs +131 -5
  106. package/dist/server/standalone.mjs.map +1 -1
  107. package/dist/specs/index.d.mts +365 -0
  108. package/dist/specs/index.d.ts +365 -0
  109. package/dist/specs/index.js +2809 -0
  110. package/dist/specs/index.js.map +1 -0
  111. package/dist/specs/index.mjs +2786 -0
  112. package/dist/specs/index.mjs.map +1 -0
  113. package/dist/{standalone-BURj8J3G.d.ts → standalone-B6GLIEmR.d.ts} +6 -2
  114. package/dist/{standalone-Dwmel29d.d.mts → standalone-CjdYqj3P.d.mts} +6 -2
  115. package/dist/{types-CHnlwiTK.d.ts → types-B2EfvEaq.d.ts} +83 -3
  116. package/dist/{types-B7J7noLK.d.mts → types-C7gVYRnF.d.ts} +72 -2
  117. package/dist/{types-BkNRILUa.d.ts → types-CJGrBEhC.d.mts} +72 -2
  118. package/dist/types-CebMQj76.d.ts +1275 -0
  119. package/dist/types-D_ypYl3T.d.mts +1275 -0
  120. package/dist/types-UBtp7R0u.d.mts +132 -0
  121. package/dist/types-UBtp7R0u.d.ts +132 -0
  122. package/dist/{types-CEQLnFMv.d.mts → types-gO696T_t.d.mts} +83 -3
  123. package/dist/{types-jKVgTI6_.d.mts → types-suaYwWWg.d.mts} +173 -2
  124. package/dist/{types-jKVgTI6_.d.ts → types-suaYwWWg.d.ts} +173 -2
  125. package/package.json +18 -2
  126. package/dist/types-B5Q0GVo0.d.mts +0 -646
  127. package/dist/types-DfPqwU-i.d.ts +0 -646
@@ -330,10 +330,7 @@ function hasAttribute(element, attrName, types) {
330
330
  }
331
331
  function addAttribute(element, name, value, types) {
332
332
  element.attributes.push(
333
- types.jsxAttribute(
334
- types.jsxIdentifier(name),
335
- types.stringLiteral(value)
336
- )
333
+ types.jsxAttribute(types.jsxIdentifier(name), types.stringLiteral(value))
337
334
  );
338
335
  }
339
336
  function getTagName(element, types) {
@@ -404,8 +401,7 @@ var uiBridgeBabelPlugin = helperPluginUtils.declare(
404
401
  },
405
402
  visitor: {
406
403
  JSXElement(path) {
407
- const state = this;
408
- if (!shouldProcessFile(state.filename, state.config)) {
404
+ if (!shouldProcessFile(this.filename, this.config)) {
409
405
  return;
410
406
  }
411
407
  const openingElement = path.node.openingElement;
@@ -413,36 +409,33 @@ var uiBridgeBabelPlugin = helperPluginUtils.declare(
413
409
  if (!tagName || !isHtmlElement(tagName)) {
414
410
  return;
415
411
  }
416
- if (!state.config.elements.includes(tagName)) {
412
+ if (!this.config.elements.includes(tagName)) {
417
413
  return;
418
414
  }
419
- if (state.config.skipExisting && hasAttribute(openingElement, state.config.idAttribute, types)) {
415
+ if (this.config.skipExisting && hasAttribute(openingElement, this.config.idAttribute, types)) {
420
416
  return;
421
417
  }
422
418
  const componentName = findComponentName(path);
423
- if (state.config.onlyInComponents.length > 0) {
424
- if (!componentName || !state.config.onlyInComponents.includes(componentName)) {
419
+ if (this.config.onlyInComponents.length > 0) {
420
+ if (!componentName || !this.config.onlyInComponents.includes(componentName)) {
425
421
  return;
426
422
  }
427
423
  }
428
- if (state.config.skipInComponents.length > 0) {
429
- if (componentName && state.config.skipInComponents.includes(componentName)) {
424
+ if (this.config.skipInComponents.length > 0) {
425
+ if (componentName && this.config.skipInComponents.includes(componentName)) {
430
426
  return;
431
427
  }
432
428
  }
433
- const textContent = extractTextContent(
434
- path.node.children,
435
- types
436
- );
429
+ const textContent = extractTextContent(path.node.children, types);
437
430
  const ariaLabel = getAttributeValue(openingElement, "aria-label", types);
438
431
  const placeholder = getAttributeValue(openingElement, "placeholder", types);
439
432
  const title = getAttributeValue(openingElement, "title", types);
440
433
  const name = getAttributeValue(openingElement, "name", types);
441
434
  const existingId = getAttributeValue(openingElement, "id", types);
442
- const elementIndex = getNextElementIndex(state.filename, tagName);
435
+ const elementIndex = getNextElementIndex(this.filename, tagName);
443
436
  const idContext = {
444
437
  componentName,
445
- filePath: state.filename,
438
+ filePath: this.filename,
446
439
  tagName,
447
440
  textContent,
448
441
  ariaLabel,
@@ -451,16 +444,16 @@ var uiBridgeBabelPlugin = helperPluginUtils.declare(
451
444
  elementIndex,
452
445
  existingId
453
446
  };
454
- const generatedId = generateId(idContext, state.config);
455
- if (state.processed.has(generatedId)) {
447
+ const generatedId = generateId(idContext, this.config);
448
+ if (this.processed.has(generatedId)) {
456
449
  const uniqueId = `${generatedId}-${elementIndex}`;
457
- addAttribute(openingElement, state.config.idAttribute, uniqueId, types);
450
+ addAttribute(openingElement, this.config.idAttribute, uniqueId, types);
458
451
  } else {
459
- state.processed.add(generatedId);
460
- addAttribute(openingElement, state.config.idAttribute, generatedId, types);
452
+ this.processed.add(generatedId);
453
+ addAttribute(openingElement, this.config.idAttribute, generatedId, types);
461
454
  }
462
455
  const semanticType = getSemanticType(tagName, idContext);
463
- addAttribute(openingElement, state.config.typeAttribute, semanticType, types);
456
+ addAttribute(openingElement, this.config.typeAttribute, semanticType, types);
464
457
  const aliasContext = {
465
458
  tagName,
466
459
  textContent,
@@ -468,29 +461,25 @@ var uiBridgeBabelPlugin = helperPluginUtils.declare(
468
461
  placeholder,
469
462
  title,
470
463
  name};
471
- if (shouldGenerateAliases(aliasContext, state.config)) {
472
- const aliases = generateAliases(aliasContext, state.config);
464
+ if (shouldGenerateAliases(aliasContext, this.config)) {
465
+ const aliases = generateAliases(aliasContext, this.config);
473
466
  if (aliases.length > 0) {
474
467
  addAttribute(
475
468
  openingElement,
476
- state.config.aliasesAttribute,
469
+ this.config.aliasesAttribute,
477
470
  formatAliasesAttribute(aliases),
478
471
  types
479
472
  );
480
473
  }
481
474
  }
482
- if (state.config.verbose) {
483
- console.log(
484
- `[ui-bridge-babel-plugin] Instrumented <${tagName}> as "${generatedId}"`
485
- );
475
+ if (this.config.verbose) {
476
+ console.log(`[ui-bridge-babel-plugin] Instrumented <${tagName}> as "${generatedId}"`);
486
477
  }
487
478
  }
488
479
  },
489
480
  post() {
490
481
  if (this.config.verbose) {
491
- console.log(
492
- `[ui-bridge-babel-plugin] Finished processing: ${this.filename}`
493
- );
482
+ console.log(`[ui-bridge-babel-plugin] Finished processing: ${this.filename}`);
494
483
  }
495
484
  }
496
485
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/babel-plugin/config.ts","../../src/babel-plugin/id-generator.ts","../../src/babel-plugin/alias-generator.ts","../../src/babel-plugin/index.ts"],"names":["declare"],"mappings":";;;;;;;;;AAuIO,IAAM,cAAA,GAAyC;AAAA,EACpD,OAAA,EAAS,CAAC,UAAA,EAAY,UAAU,CAAA;AAAA,EAChC,OAAA,EAAS,CAAC,oBAAA,EAAsB,aAAA,EAAe,eAAe,gBAAgB,CAAA;AAAA,EAC9E,UAAU,CAAC,QAAA,EAAU,SAAS,QAAA,EAAU,UAAA,EAAY,KAAK,MAAM,CAAA;AAAA,EAC/D,QAAA,EAAU,IAAA;AAAA,EACV,WAAA,EAAa,YAAA;AAAA,EACb,gBAAA,EAAkB,iBAAA;AAAA,EAClB,aAAA,EAAe,cAAA;AAAA,EACf,eAAA,EA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AS;AACvB,UAAA,OAAA,CAAQ,GAAA;AAAA,YACN,CAAA,8CAAA,EAAiD,KAAK,QAAQ,CAAA;AAAA,WAChE;AAAA,QACF;AAAA,MACF;AAAA,KACF;AAAA,EACF;AACF;AAEA,IAAO,oBAAA,GAAQ","file":"index.js","sourcesContent":["/**\n * Plugin Configuration\n *\n * Configuration options for the UI Bridge Babel plugin.\n */\n\n/**\n * Elements to instrument\n */\nexport type InstrumentableElement =\n | 'button'\n | 'input'\n | 'select'\n | 'textarea'\n | 'a'\n | 'form'\n | 'label'\n | 'img'\n | 'video'\n | 'audio'\n | 'dialog'\n | 'details'\n | 'summary'\n | 'nav'\n | 'header'\n | 'footer'\n | 'main'\n | 'aside'\n | 'section'\n | 'article';\n\n/**\n * Plugin configuration options\n */\nexport interface PluginConfig {\n /**\n * Include specific file patterns (glob)\n * @default ['**\\/*.tsx', '**\\/*.jsx']\n */\n include?: string[];\n\n /**\n * Exclude specific file patterns (glob)\n * @default ['**\\/node_modules/**', '**\\/*.test.*', '**\\/*.spec.*']\n */\n exclude?: string[];\n\n /**\n * Elements to automatically instrument\n * @default ['button', 'input', 'select', 'textarea', 'a', 'form']\n */\n elements?: InstrumentableElement[];\n\n /**\n * Prefix for generated IDs\n * @default 'ui'\n */\n idPrefix?: string;\n\n /**\n * Attribute name for the generated ID\n * @default 'data-ui-id'\n */\n idAttribute?: string;\n\n /**\n * Attribute name for aliases\n * @default 'data-ui-aliases'\n */\n aliasesAttribute?: string;\n\n /**\n * Attribute name for element type\n * @default 'data-ui-type'\n */\n typeAttribute?: string;\n\n /**\n * Generate aliases from text content\n * @default true\n */\n generateAliases?: boolean;\n\n /**\n * Include component name in generated ID\n * @default true\n */\n includeComponentName?: boolean;\n\n /**\n * Include file path in generated ID\n * @default false\n */\n includeFilePath?: boolean;\n\n /**\n * Hash the generated ID for shorter strings\n * @default false\n */\n hashIds?: boolean;\n\n /**\n * Maximum alias count per element\n * @default 5\n */\n maxAliases?: number;\n\n /**\n * Skip elements that already have data-ui-id\n * @default true\n */\n skipExisting?: boolean;\n\n /**\n * Only instrument elements inside components with specific names\n * @default []\n */\n onlyInComponents?: string[];\n\n /**\n * Skip instrumentation for elements inside these components\n * @default []\n */\n skipInComponents?: string[];\n\n /**\n * Enable verbose logging during build\n * @default false\n */\n verbose?: boolean;\n}\n\n/**\n * Default configuration\n */\nexport const DEFAULT_CONFIG: Required<PluginConfig> = {\n include: ['**/*.tsx', '**/*.jsx'],\n exclude: ['**/node_modules/**', '**/*.test.*', '**/*.spec.*', '**/*.stories.*'],\n elements: ['button', 'input', 'select', 'textarea', 'a', 'form'],\n idPrefix: 'ui',\n idAttribute: 'data-ui-id',\n aliasesAttribute: 'data-ui-aliases',\n typeAttribute: 'data-ui-type',\n generateAliases: true,\n includeComponentName: true,\n includeFilePath: false,\n hashIds: false,\n maxAliases: 5,\n skipExisting: true,\n onlyInComponents: [],\n skipInComponents: [],\n verbose: false,\n};\n\n/**\n * Merge user config with defaults\n */\nexport function mergeConfig(userConfig: PluginConfig = {}): Required<PluginConfig> {\n return {\n ...DEFAULT_CONFIG,\n ...userConfig,\n // Ensure arrays are properly merged\n include: userConfig.include ?? DEFAULT_CONFIG.include,\n exclude: userConfig.exclude ?? DEFAULT_CONFIG.exclude,\n elements: userConfig.elements ?? DEFAULT_CONFIG.elements,\n onlyInComponents: userConfig.onlyInComponents ?? DEFAULT_CONFIG.onlyInComponents,\n skipInComponents: userConfig.skipInComponents ?? DEFAULT_CONFIG.skipInComponents,\n };\n}\n\n/**\n * Check if a file should be processed based on include/exclude patterns\n */\nexport function shouldProcessFile(\n filename: string,\n config: Required<PluginConfig>\n): boolean {\n // Simple pattern matching (for full glob support, use micromatch)\n const matchPattern = (pattern: string, path: string): boolean => {\n // Simple extension-based matching for common patterns\n // **/*.tsx -> match any .tsx file\n // **/*.test.* -> match any file with .test. in name\n\n // Handle **/*.ext pattern (match files with extension anywhere)\n if (pattern.startsWith('**/')) {\n const restOfPattern = pattern.slice(3); // Remove **/\n\n // Handle **/dir/** patterns\n if (restOfPattern.includes('/**')) {\n const dir = restOfPattern.replace('/**', '');\n return path.includes('/' + dir + '/') || path.startsWith(dir + '/');\n }\n\n // Handle **/*.test.* or **/*.spec.* (files with .test. or .spec. in name)\n // Must check this BEFORE the simple extension check\n if (restOfPattern.startsWith('*.') && restOfPattern.endsWith('.*') && restOfPattern.length > 3) {\n const middle = restOfPattern.slice(2, -2); // Get middle part like \"test\" or \"spec\"\n const fileName = path.includes('/') ? path.split('/').pop() || path : path;\n return fileName.includes('.' + middle + '.');\n }\n\n // Handle **/*.ext (any file with simple extension like .tsx, .jsx)\n if (restOfPattern.startsWith('*.') && !restOfPattern.slice(2).includes('*')) {\n const ext = restOfPattern.slice(1); // Get .ext part\n return path.endsWith(ext);\n }\n }\n\n // Fallback: exact match\n return path === pattern;\n };\n\n // Normalize path\n const normalizedPath = filename.replace(/\\\\/g, '/');\n\n // Check exclude patterns first\n for (const pattern of config.exclude) {\n if (matchPattern(pattern, normalizedPath)) {\n return false;\n }\n }\n\n // Check include patterns\n for (const pattern of config.include) {\n if (matchPattern(pattern, normalizedPath)) {\n return true;\n }\n }\n\n return false;\n}\n","/**\n * ID Generator\n *\n * Generates stable, unique IDs for UI elements based on component path,\n * element type, and content.\n */\n\nimport type { PluginConfig } from './config';\n\n/**\n * Context for generating element IDs\n */\nexport interface IdGeneratorContext {\n /** Component name */\n componentName: string | null;\n /** File path */\n filePath: string;\n /** Element tag name */\n tagName: string;\n /** Element text content */\n textContent: string | null;\n /** Aria label */\n ariaLabel: string | null;\n /** Placeholder text */\n placeholder: string | null;\n /** Title attribute */\n title: string | null;\n /** Element index in component (for uniqueness) */\n elementIndex: number;\n /** Existing id attribute */\n existingId: string | null;\n}\n\n/**\n * Simple hash function for ID generation\n */\nfunction simpleHash(str: string): string {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = ((hash << 5) - hash) + char;\n hash = hash & hash; // Convert to 32bit integer\n }\n // Convert to positive hex string\n return Math.abs(hash).toString(16).substring(0, 8);\n}\n\n/**\n * Normalize text for use in ID\n */\nfunction normalizeForId(text: string): string {\n return text\n .toLowerCase()\n .trim()\n // Replace non-alphanumeric with dash\n .replace(/[^a-z0-9]+/g, '-')\n // Remove leading/trailing dashes\n .replace(/^-+|-+$/g, '')\n // Collapse multiple dashes\n .replace(/-+/g, '-')\n // Limit length\n .substring(0, 30);\n}\n\n/**\n * Extract component name from file path\n */\nexport function extractComponentFromPath(filePath: string): string | null {\n // Normalize path separators\n const normalized = filePath.replace(/\\\\/g, '/');\n\n // Get filename without extension\n const match = normalized.match(/\\/([^/]+)\\.(tsx?|jsx?)$/);\n if (!match) return null;\n\n const filename = match[1];\n\n // Skip index files\n if (filename === 'index') {\n // Try to get parent folder name\n const parentMatch = normalized.match(/\\/([^/]+)\\/index\\.(tsx?|jsx?)$/);\n if (parentMatch) {\n return normalizeForId(parentMatch[1]);\n }\n }\n\n return normalizeForId(filename);\n}\n\n/**\n * Get semantic type for element\n */\nexport function getSemanticType(tagName: string, context: IdGeneratorContext): string {\n const tag = tagName.toLowerCase();\n\n // Check for specific input types\n if (tag === 'input') {\n // Would need to check type attribute, for now just return 'input'\n return 'input';\n }\n\n // Check for specific button purposes\n if (tag === 'button') {\n const text = context.textContent?.toLowerCase() || '';\n if (text.includes('submit') || text.includes('save')) return 'submit-button';\n if (text.includes('cancel') || text.includes('close')) return 'cancel-button';\n if (text.includes('delete') || text.includes('remove')) return 'delete-button';\n return 'button';\n }\n\n // Map tags to semantic types\n const typeMap: Record<string, string> = {\n a: 'link',\n select: 'dropdown',\n textarea: 'textarea',\n form: 'form',\n nav: 'navigation',\n header: 'header',\n footer: 'footer',\n main: 'main',\n aside: 'sidebar',\n dialog: 'dialog',\n img: 'image',\n };\n\n return typeMap[tag] || tag;\n}\n\n/**\n * Generate a unique ID for an element\n */\nexport function generateId(\n context: IdGeneratorContext,\n config: Required<PluginConfig>\n): string {\n const parts: string[] = [];\n\n // Add prefix\n if (config.idPrefix) {\n parts.push(config.idPrefix);\n }\n\n // Add file path component\n if (config.includeFilePath) {\n const fileComponent = extractComponentFromPath(context.filePath);\n if (fileComponent) {\n parts.push(fileComponent);\n }\n }\n\n // Add component name\n if (config.includeComponentName && context.componentName) {\n parts.push(normalizeForId(context.componentName));\n }\n\n // Add descriptive part from text/aria/placeholder\n const descriptiveText =\n context.textContent ||\n context.ariaLabel ||\n context.placeholder ||\n context.title ||\n context.existingId;\n\n if (descriptiveText) {\n parts.push(normalizeForId(descriptiveText));\n }\n\n // Add semantic type\n const semanticType = getSemanticType(context.tagName, context);\n parts.push(semanticType);\n\n // Generate base ID\n let id = parts.filter(Boolean).join('-');\n\n // If ID is empty or too short, use index\n if (id.length < 5) {\n id = `${config.idPrefix}-${context.tagName}-${context.elementIndex}`;\n }\n\n // Hash if configured\n if (config.hashIds) {\n const hash = simpleHash(id + context.filePath + context.elementIndex);\n id = `${config.idPrefix}-${hash}`;\n }\n\n return id;\n}\n\n/**\n * Counter for element indices per file\n */\nconst fileElementCounters = new Map<string, Map<string, number>>();\n\n/**\n * Get next element index for a file/tag combination\n */\nexport function getNextElementIndex(filePath: string, tagName: string): number {\n if (!fileElementCounters.has(filePath)) {\n fileElementCounters.set(filePath, new Map());\n }\n\n const fileCounters = fileElementCounters.get(filePath)!;\n const current = fileCounters.get(tagName) || 0;\n fileCounters.set(tagName, current + 1);\n\n return current;\n}\n\n/**\n * Reset counters for a file (call at start of file processing)\n */\nexport function resetFileCounters(filePath: string): void {\n fileElementCounters.delete(filePath);\n}\n","/**\n * Alias Generator\n *\n * Generates search aliases from element text, aria labels, and other attributes.\n */\n\nimport type { PluginConfig } from './config';\n\n/**\n * Context for generating aliases\n */\nexport interface AliasGeneratorContext {\n /** Element tag name */\n tagName: string;\n /** Text content */\n textContent: string | null;\n /** Aria label */\n ariaLabel: string | null;\n /** Placeholder text */\n placeholder: string | null;\n /** Title attribute */\n title: string | null;\n /** Name attribute */\n name: string | null;\n /** ID attribute */\n id: string | null;\n}\n\n/**\n * Common word synonyms for UI actions\n */\nconst SYNONYMS: Record<string, string[]> = {\n submit: ['send', 'go', 'confirm', 'done', 'ok', 'apply'],\n cancel: ['close', 'dismiss', 'abort', 'back', 'exit'],\n delete: ['remove', 'trash', 'erase', 'clear'],\n edit: ['modify', 'change', 'update'],\n add: ['create', 'new', 'plus', 'insert'],\n save: ['store', 'keep', 'preserve'],\n search: ['find', 'lookup', 'query'],\n login: ['signin', 'sign in', 'log in'],\n logout: ['signout', 'sign out', 'log out'],\n register: ['signup', 'sign up', 'join'],\n next: ['continue', 'forward', 'proceed'],\n previous: ['back', 'prev', 'prior'],\n start: ['begin', 'launch', 'run'],\n stop: ['end', 'halt', 'pause'],\n upload: ['attach', 'import'],\n download: ['export', 'get'],\n settings: ['preferences', 'options', 'config'],\n help: ['support', 'info', 'about'],\n home: ['main', 'dashboard'],\n profile: ['account', 'user'],\n};\n\n/**\n * Normalize text for alias matching\n */\nfunction normalizeText(text: string): string {\n return text\n .toLowerCase()\n .trim()\n .replace(/[^a-z0-9\\s]/g, '')\n .replace(/\\s+/g, ' ');\n}\n\n/**\n * Tokenize text into words\n */\nfunction tokenize(text: string): string[] {\n return normalizeText(text)\n .split(' ')\n .filter((word) => word.length > 1);\n}\n\n/**\n * Get synonyms for a word\n */\nfunction getSynonyms(word: string): string[] {\n const normalized = word.toLowerCase();\n\n // Check if word is in synonyms\n if (SYNONYMS[normalized]) {\n return SYNONYMS[normalized];\n }\n\n // Check if word is a synonym of something\n for (const [key, values] of Object.entries(SYNONYMS)) {\n if (values.includes(normalized)) {\n return [key, ...values.filter((v) => v !== normalized)];\n }\n }\n\n return [];\n}\n\n/**\n * Generate n-grams from tokens\n */\nfunction generateNgrams(tokens: string[], n: number): string[] {\n const ngrams: string[] = [];\n\n for (let i = 0; i <= tokens.length - n; i++) {\n ngrams.push(tokens.slice(i, i + n).join(' '));\n }\n\n return ngrams;\n}\n\n/**\n * Generate aliases for an element\n */\nexport function generateAliases(\n context: AliasGeneratorContext,\n config: Required<PluginConfig>\n): string[] {\n const aliases = new Set<string>();\n\n // Add text content\n if (context.textContent) {\n const normalized = normalizeText(context.textContent);\n if (normalized) {\n aliases.add(normalized);\n\n // Add individual tokens\n const tokens = tokenize(context.textContent);\n for (const token of tokens) {\n if (token.length >= 3) {\n aliases.add(token);\n }\n\n // Add synonyms\n for (const synonym of getSynonyms(token)) {\n aliases.add(synonym);\n }\n }\n\n // Add bi-grams\n if (tokens.length >= 2) {\n for (const ngram of generateNgrams(tokens, 2)) {\n aliases.add(ngram);\n }\n }\n }\n }\n\n // Add aria label\n if (context.ariaLabel) {\n const normalized = normalizeText(context.ariaLabel);\n if (normalized) {\n aliases.add(normalized);\n }\n }\n\n // Add placeholder\n if (context.placeholder) {\n const normalized = normalizeText(context.placeholder);\n if (normalized) {\n aliases.add(normalized);\n }\n }\n\n // Add title\n if (context.title) {\n const normalized = normalizeText(context.title);\n if (normalized) {\n aliases.add(normalized);\n }\n }\n\n // Add name attribute (often semantic)\n if (context.name) {\n const normalized = normalizeText(context.name).replace(/-/g, ' ');\n if (normalized) {\n aliases.add(normalized);\n }\n }\n\n // Add element type\n const typeAlias = getElementTypeAlias(context.tagName);\n if (typeAlias) {\n aliases.add(typeAlias);\n }\n\n // Convert to array and limit\n const result = Array.from(aliases)\n .filter((alias) => alias.length >= 2 && alias.length <= 50)\n .slice(0, config.maxAliases);\n\n return result;\n}\n\n/**\n * Get type alias for element\n */\nfunction getElementTypeAlias(tagName: string): string | null {\n const tag = tagName.toLowerCase();\n\n const typeAliases: Record<string, string> = {\n button: 'button',\n input: 'input',\n select: 'dropdown',\n textarea: 'text area',\n a: 'link',\n form: 'form',\n nav: 'navigation',\n img: 'image',\n };\n\n return typeAliases[tag] || null;\n}\n\n/**\n * Format aliases for attribute value\n */\nexport function formatAliasesAttribute(aliases: string[]): string {\n return aliases.join(',');\n}\n\n/**\n * Determine if aliases should be generated for this element\n */\nexport function shouldGenerateAliases(\n context: AliasGeneratorContext,\n config: Required<PluginConfig>\n): boolean {\n if (!config.generateAliases) {\n return false;\n }\n\n // Need at least some content to generate aliases\n return !!(\n context.textContent ||\n context.ariaLabel ||\n context.placeholder ||\n context.title ||\n context.name\n );\n}\n","/**\n * UI Bridge Babel Plugin\n *\n * Automatically instruments React components with UI Bridge IDs and aliases.\n *\n * @example\n * ```js\n * // babel.config.js\n * module.exports = {\n * plugins: [\n * ['@qontinui/ui-bridge/babel-plugin', {\n * elements: ['button', 'input', 'a'],\n * idPrefix: 'ui',\n * }]\n * ]\n * };\n * ```\n *\n * @example\n * ```jsx\n * // Input\n * <button onClick={handleSubmit}>Submit</button>\n *\n * // Output\n * <button\n * onClick={handleSubmit}\n * data-ui-id=\"ui-component-submit-button\"\n * data-ui-aliases=\"submit,send,go,confirm\"\n * data-ui-type=\"button\"\n * >\n * Submit\n * </button>\n * ```\n */\n\nimport { declare } from '@babel/helper-plugin-utils';\nimport type { PluginObj, NodePath, BabelFile } from '@babel/core';\nimport type * as t from '@babel/types';\nimport {\n type PluginConfig,\n mergeConfig,\n shouldProcessFile,\n} from './config';\nimport {\n generateId,\n getNextElementIndex,\n resetFileCounters,\n getSemanticType,\n type IdGeneratorContext,\n} from './id-generator';\nimport {\n generateAliases,\n formatAliasesAttribute,\n shouldGenerateAliases,\n type AliasGeneratorContext,\n} from './alias-generator';\n\nexport type { PluginConfig } from './config';\n\n/**\n * State tracked during file transformation\n */\ninterface PluginState {\n filename: string;\n config: Required<PluginConfig>;\n componentStack: string[];\n processed: Set<string>;\n}\n\n/**\n * Extract text content from JSX children\n */\nfunction extractTextContent(\n children: (t.JSXElement | t.JSXText | t.JSXExpressionContainer | t.JSXSpreadChild | t.JSXFragment)[],\n types: typeof t\n): string | null {\n const textParts: string[] = [];\n\n for (const child of children) {\n if (types.isJSXText(child)) {\n const text = child.value.trim();\n if (text) {\n textParts.push(text);\n }\n }\n }\n\n return textParts.length > 0 ? textParts.join(' ') : null;\n}\n\n/**\n * Get attribute value from JSX element\n */\nfunction getAttributeValue(\n element: t.JSXOpeningElement,\n attrName: string,\n types: typeof t\n): string | null {\n for (const attr of element.attributes) {\n if (types.isJSXAttribute(attr) && types.isJSXIdentifier(attr.name)) {\n if (attr.name.name === attrName) {\n if (types.isStringLiteral(attr.value)) {\n return attr.value.value;\n }\n if (types.isJSXExpressionContainer(attr.value)) {\n if (types.isStringLiteral(attr.value.expression)) {\n return attr.value.expression.value;\n }\n }\n }\n }\n }\n return null;\n}\n\n/**\n * Check if element has a specific attribute\n */\nfunction hasAttribute(\n element: t.JSXOpeningElement,\n attrName: string,\n types: typeof t\n): boolean {\n return element.attributes.some(\n (attr) =>\n types.isJSXAttribute(attr) &&\n types.isJSXIdentifier(attr.name) &&\n attr.name.name === attrName\n );\n}\n\n/**\n * Add attribute to JSX element\n */\nfunction addAttribute(\n element: t.JSXOpeningElement,\n name: string,\n value: string,\n types: typeof t\n): void {\n element.attributes.push(\n types.jsxAttribute(\n types.jsxIdentifier(name),\n types.stringLiteral(value)\n )\n );\n}\n\n/**\n * Get tag name from JSX element\n */\nfunction getTagName(element: t.JSXOpeningElement, types: typeof t): string | null {\n if (types.isJSXIdentifier(element.name)) {\n return element.name.name;\n }\n if (types.isJSXMemberExpression(element.name)) {\n // Handle Component.SubComponent\n return null; // Skip member expressions\n }\n return null;\n}\n\n/**\n * Check if tag is a lowercase HTML element (not a React component)\n */\nfunction isHtmlElement(tagName: string): boolean {\n return tagName[0] === tagName[0].toLowerCase();\n}\n\n/**\n * Find parent component name\n */\nfunction findComponentName(path: NodePath<t.JSXElement>): string | null {\n let current: NodePath<t.Node> | null = path as NodePath<t.Node>;\n\n while (current) {\n const parent: NodePath<t.Node> | null = current.parentPath;\n\n if (!parent) break;\n\n // Check for function declaration\n if (parent.isFunctionDeclaration()) {\n const name = (parent.node as t.FunctionDeclaration).id?.name;\n if (name && name[0] === name[0].toUpperCase()) {\n return name;\n }\n }\n\n // Check for variable declarator with arrow function\n if (parent.isArrowFunctionExpression() || parent.isFunctionExpression()) {\n const varDeclarator = parent.parentPath;\n if (varDeclarator?.isVariableDeclarator()) {\n const id = (varDeclarator.node as t.VariableDeclarator).id;\n if (id && id.type === 'Identifier') {\n const name = id.name;\n if (name[0] === name[0].toUpperCase()) {\n return name;\n }\n }\n }\n }\n\n // Check for class method (render)\n if (parent.isClassMethod()) {\n const classDecl = parent.parentPath?.parentPath;\n if (classDecl?.isClassDeclaration()) {\n const name = (classDecl.node as t.ClassDeclaration).id?.name;\n if (name) {\n return name;\n }\n }\n }\n\n current = parent;\n }\n\n return null;\n}\n\n/**\n * Babel API interface\n */\ninterface BabelAPI {\n assertVersion(version: number): void;\n types: typeof t;\n}\n\n/**\n * The Babel plugin\n */\nconst uiBridgeBabelPlugin = declare<PluginConfig, PluginObj<PluginState>>(\n (api: BabelAPI, options: PluginConfig) => {\n api.assertVersion(7);\n\n const types = api.types;\n const config = mergeConfig(options);\n\n return {\n name: 'ui-bridge-babel-plugin',\n\n pre(this: PluginState, file: BabelFile) {\n const filename = file.opts.filename || 'unknown';\n this.filename = filename;\n this.config = config;\n this.componentStack = [];\n this.processed = new Set();\n\n // Reset element counters for this file\n resetFileCounters(filename);\n\n if (config.verbose) {\n console.log(`[ui-bridge-babel-plugin] Processing: ${filename}`);\n }\n },\n\n visitor: {\n JSXElement(this: PluginState, path: NodePath<t.JSXElement>) {\n const state = this;\n\n // Check if file should be processed\n if (!shouldProcessFile(state.filename, state.config)) {\n return;\n }\n\n const openingElement = path.node.openingElement;\n const tagName = getTagName(openingElement, types);\n\n // Skip if no tag name or not an HTML element\n if (!tagName || !isHtmlElement(tagName)) {\n return;\n }\n\n // Check if this element type should be instrumented\n if (!state.config.elements.includes(tagName as any)) {\n return;\n }\n\n // Skip if already has ui-id (unless configured otherwise)\n if (\n state.config.skipExisting &&\n hasAttribute(openingElement, state.config.idAttribute, types)\n ) {\n return;\n }\n\n // Find component name\n const componentName = findComponentName(path);\n\n // Check component filters\n if (state.config.onlyInComponents.length > 0) {\n if (!componentName || !state.config.onlyInComponents.includes(componentName)) {\n return;\n }\n }\n\n if (state.config.skipInComponents.length > 0) {\n if (componentName && state.config.skipInComponents.includes(componentName)) {\n return;\n }\n }\n\n // Extract element info\n const textContent = extractTextContent(\n path.node.children as any[],\n types\n );\n const ariaLabel = getAttributeValue(openingElement, 'aria-label', types);\n const placeholder = getAttributeValue(openingElement, 'placeholder', types);\n const title = getAttributeValue(openingElement, 'title', types);\n const name = getAttributeValue(openingElement, 'name', types);\n const existingId = getAttributeValue(openingElement, 'id', types);\n\n // Get element index for uniqueness\n const elementIndex = getNextElementIndex(state.filename, tagName);\n\n // Build context for ID generation\n const idContext: IdGeneratorContext = {\n componentName,\n filePath: state.filename,\n tagName,\n textContent,\n ariaLabel,\n placeholder,\n title,\n elementIndex,\n existingId,\n };\n\n // Generate ID\n const generatedId = generateId(idContext, state.config);\n\n // Skip if this exact ID was already generated (collision)\n if (state.processed.has(generatedId)) {\n // Add index suffix for uniqueness\n const uniqueId = `${generatedId}-${elementIndex}`;\n addAttribute(openingElement, state.config.idAttribute, uniqueId, types);\n } else {\n state.processed.add(generatedId);\n addAttribute(openingElement, state.config.idAttribute, generatedId, types);\n }\n\n // Add element type\n const semanticType = getSemanticType(tagName, idContext);\n addAttribute(openingElement, state.config.typeAttribute, semanticType, types);\n\n // Generate and add aliases\n const aliasContext: AliasGeneratorContext = {\n tagName,\n textContent,\n ariaLabel,\n placeholder,\n title,\n name,\n id: existingId,\n };\n\n if (shouldGenerateAliases(aliasContext, state.config)) {\n const aliases = generateAliases(aliasContext, state.config);\n if (aliases.length > 0) {\n addAttribute(\n openingElement,\n state.config.aliasesAttribute,\n formatAliasesAttribute(aliases),\n types\n );\n }\n }\n\n if (state.config.verbose) {\n console.log(\n `[ui-bridge-babel-plugin] Instrumented <${tagName}> as \"${generatedId}\"`\n );\n }\n },\n },\n\n post(this: PluginState) {\n if (this.config.verbose) {\n console.log(\n `[ui-bridge-babel-plugin] Finished processing: ${this.filename}`\n );\n }\n },\n };\n }\n);\n\nexport default uiBridgeBabelPlugin;\n\n// Named export for ESM compatibility\nexport { uiBridgeBabelPlugin };\n\n// Re-export utilities for advanced usage\nexport { mergeConfig, shouldProcessFile, DEFAULT_CONFIG } from './config';\nexport {\n generateId,\n getSemanticType,\n extractComponentFromPath,\n resetFileCounters,\n getNextElementIndex,\n type IdGeneratorContext,\n} from './id-generator';\nexport {\n generateAliases,\n formatAliasesAttribute,\n shouldGenerateAliases,\n type AliasGeneratorContext,\n} from './alias-generator';\n"]}
1
+ {"version":3,"sources":["../../src/babel-plugin/config.ts","../../src/babel-plugin/id-generator.ts","../../src/babel-plugin/alias-generator.ts","../../src/babel-plugin/index.ts"],"names":["declare"],"mappings":";;;;;;;;;AAuIO,IAAM,cAAA,GAAyC;AAAA,EACpD,OAAA,EAAS,CAAC,UAAA,EAAY,UAAU,CAAA;AAAA,EAChC,OAAA,EAAS,CAAC,oBAAA,EAAsB,aAAA,EAAe,eAAe,gBAAgB,CAAA;AAAA,EAC9E,UAAU,CAAC,QAAA,EAAU,SAAS,QAAA,EAAU,UAAA,EAAY,KAAK,MAAM,CAAA;AAAA,EAC/D,QAAA,EAAU,IAAA;AAAA,EACV,WAAA,EAAa,YAAA;AAAA,EACb,gBAAA,EAAkB,iBAAA;AAAA,EAClB,aAAA,EAAe,cAAA;AAAA,EACf,eAAA,EAAiB,IAAA;AAAA,EACjB,oBAAA,EAAsB,IAAA;AAAA,EACtB,eAAA,EAAiB,KAAA;AAAA,EACjB,OAAA,EAAS,KAAA;AAAA,EACT,UAAA,EAAY,CAAA;AAAA,EACZ,YAAA,EAAc,IAAA;AAAA,EACd,kBAAkB,EAAC;AAAA,EACnB,kBAAkB,EAAC;AAAA,EACnB,OAAA,EAAS;AACX;AAKO,SAAS,WAAA,CAAY,UAAA,GAA2B,EAAC,EAA2B;AACjF,EAAA,OAAO;AAAA,IACL,GAAG,cAAA;AAAA,IACH,GAAG,UAAA;AAAA;AAAA,IAEH,OAAA,E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AgB,IAAA,CAAK,MAAA,CAAO,aAAA,EAAe,cAAc,KAAK,CAAA;AAG3E,UAAA,MAAM,YAAA,GAAsC;AAAA,YAC1C,OAAA;AAAA,YACA,WAAA;AAAA,YACA,SAAA;AAAA,YACA,WAAA;AAAA,YACA,KAAA;AAAA,YACA,IAEF,CAAA;AAEA,UAAA,IAAI,qBAAA,CAAsB,YAAA,EAAc,IAAA,CAAK,MAAM,CAAA,EAAG;AACpD,YAAA,MAAM,OAAA,GAAU,eAAA,CAAgB,YAAA,EAAc,IAAA,CAAK,MAAM,CAAA;AACzD,YAAA,IAAI,OAAA,CAAQ,SAAS,CAAA,EAAG;AACtB,cAAA,YAAA;AAAA,gBACE,cAAA;AAAA,gBACA,KAAK,MAAA,CAAO,gBAAA;AAAA,gBACZ,uBAAuB,OAAO,CAAA;AAAA,gBAC9B;AAAA,eACF;AAAA,YACF;AAAA,UACF;AAEA,UAAA,IAAI,IAAA,CAAK,OAAO,OAAA,EAAS;AACvB,YAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,uCAAA,EAA0C,OAAO,CAAA,MAAA,EAAS,WAAW,CAAA,CAAA,CAAG,CAAA;AAAA,UACtF;AAAA,QACF;AAAA,OACF;AAAA,MAEA,IAAA,GAAwB;AACtB,QAAA,IAAI,IAAA,CAAK,OAAO,OAAA,EAAS;AACvB,UAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,8CAAA,EAAiD,IAAA,CAAK,QAAQ,CAAA,CAAE,CAAA;AAAA,QAC9E;AAAA,MACF;AAAA,KACF;AAAA,EACF;AACF;AAEA,IAAO,oBAAA,GAAQ","file":"index.js","sourcesContent":["/**\n * Plugin Configuration\n *\n * Configuration options for the UI Bridge Babel plugin.\n */\n\n/**\n * Elements to instrument\n */\nexport type InstrumentableElement =\n | 'button'\n | 'input'\n | 'select'\n | 'textarea'\n | 'a'\n | 'form'\n | 'label'\n | 'img'\n | 'video'\n | 'audio'\n | 'dialog'\n | 'details'\n | 'summary'\n | 'nav'\n | 'header'\n | 'footer'\n | 'main'\n | 'aside'\n | 'section'\n | 'article';\n\n/**\n * Plugin configuration options\n */\nexport interface PluginConfig {\n /**\n * Include specific file patterns (glob)\n * @default ['**\\/*.tsx', '**\\/*.jsx']\n */\n include?: string[];\n\n /**\n * Exclude specific file patterns (glob)\n * @default ['**\\/node_modules/**', '**\\/*.test.*', '**\\/*.spec.*']\n */\n exclude?: string[];\n\n /**\n * Elements to automatically instrument\n * @default ['button', 'input', 'select', 'textarea', 'a', 'form']\n */\n elements?: InstrumentableElement[];\n\n /**\n * Prefix for generated IDs\n * @default 'ui'\n */\n idPrefix?: string;\n\n /**\n * Attribute name for the generated ID\n * @default 'data-ui-id'\n */\n idAttribute?: string;\n\n /**\n * Attribute name for aliases\n * @default 'data-ui-aliases'\n */\n aliasesAttribute?: string;\n\n /**\n * Attribute name for element type\n * @default 'data-ui-type'\n */\n typeAttribute?: string;\n\n /**\n * Generate aliases from text content\n * @default true\n */\n generateAliases?: boolean;\n\n /**\n * Include component name in generated ID\n * @default true\n */\n includeComponentName?: boolean;\n\n /**\n * Include file path in generated ID\n * @default false\n */\n includeFilePath?: boolean;\n\n /**\n * Hash the generated ID for shorter strings\n * @default false\n */\n hashIds?: boolean;\n\n /**\n * Maximum alias count per element\n * @default 5\n */\n maxAliases?: number;\n\n /**\n * Skip elements that already have data-ui-id\n * @default true\n */\n skipExisting?: boolean;\n\n /**\n * Only instrument elements inside components with specific names\n * @default []\n */\n onlyInComponents?: string[];\n\n /**\n * Skip instrumentation for elements inside these components\n * @default []\n */\n skipInComponents?: string[];\n\n /**\n * Enable verbose logging during build\n * @default false\n */\n verbose?: boolean;\n}\n\n/**\n * Default configuration\n */\nexport const DEFAULT_CONFIG: Required<PluginConfig> = {\n include: ['**/*.tsx', '**/*.jsx'],\n exclude: ['**/node_modules/**', '**/*.test.*', '**/*.spec.*', '**/*.stories.*'],\n elements: ['button', 'input', 'select', 'textarea', 'a', 'form'],\n idPrefix: 'ui',\n idAttribute: 'data-ui-id',\n aliasesAttribute: 'data-ui-aliases',\n typeAttribute: 'data-ui-type',\n generateAliases: true,\n includeComponentName: true,\n includeFilePath: false,\n hashIds: false,\n maxAliases: 5,\n skipExisting: true,\n onlyInComponents: [],\n skipInComponents: [],\n verbose: false,\n};\n\n/**\n * Merge user config with defaults\n */\nexport function mergeConfig(userConfig: PluginConfig = {}): Required<PluginConfig> {\n return {\n ...DEFAULT_CONFIG,\n ...userConfig,\n // Ensure arrays are properly merged\n include: userConfig.include ?? DEFAULT_CONFIG.include,\n exclude: userConfig.exclude ?? DEFAULT_CONFIG.exclude,\n elements: userConfig.elements ?? DEFAULT_CONFIG.elements,\n onlyInComponents: userConfig.onlyInComponents ?? DEFAULT_CONFIG.onlyInComponents,\n skipInComponents: userConfig.skipInComponents ?? DEFAULT_CONFIG.skipInComponents,\n };\n}\n\n/**\n * Check if a file should be processed based on include/exclude patterns\n */\nexport function shouldProcessFile(filename: string, config: Required<PluginConfig>): boolean {\n // Simple pattern matching (for full glob support, use micromatch)\n const matchPattern = (pattern: string, path: string): boolean => {\n // Simple extension-based matching for common patterns\n // **/*.tsx -> match any .tsx file\n // **/*.test.* -> match any file with .test. in name\n\n // Handle **/*.ext pattern (match files with extension anywhere)\n if (pattern.startsWith('**/')) {\n const restOfPattern = pattern.slice(3); // Remove **/\n\n // Handle **/dir/** patterns\n if (restOfPattern.includes('/**')) {\n const dir = restOfPattern.replace('/**', '');\n return path.includes('/' + dir + '/') || path.startsWith(dir + '/');\n }\n\n // Handle **/*.test.* or **/*.spec.* (files with .test. or .spec. in name)\n // Must check this BEFORE the simple extension check\n if (\n restOfPattern.startsWith('*.') &&\n restOfPattern.endsWith('.*') &&\n restOfPattern.length > 3\n ) {\n const middle = restOfPattern.slice(2, -2); // Get middle part like \"test\" or \"spec\"\n const fileName = path.includes('/') ? path.split('/').pop() || path : path;\n return fileName.includes('.' + middle + '.');\n }\n\n // Handle **/*.ext (any file with simple extension like .tsx, .jsx)\n if (restOfPattern.startsWith('*.') && !restOfPattern.slice(2).includes('*')) {\n const ext = restOfPattern.slice(1); // Get .ext part\n return path.endsWith(ext);\n }\n }\n\n // Fallback: exact match\n return path === pattern;\n };\n\n // Normalize path\n const normalizedPath = filename.replace(/\\\\/g, '/');\n\n // Check exclude patterns first\n for (const pattern of config.exclude) {\n if (matchPattern(pattern, normalizedPath)) {\n return false;\n }\n }\n\n // Check include patterns\n for (const pattern of config.include) {\n if (matchPattern(pattern, normalizedPath)) {\n return true;\n }\n }\n\n return false;\n}\n","/**\n * ID Generator\n *\n * Generates stable, unique IDs for UI elements based on component path,\n * element type, and content.\n */\n\nimport type { PluginConfig } from './config';\n\n/**\n * Context for generating element IDs\n */\nexport interface IdGeneratorContext {\n /** Component name */\n componentName: string | null;\n /** File path */\n filePath: string;\n /** Element tag name */\n tagName: string;\n /** Element text content */\n textContent: string | null;\n /** Aria label */\n ariaLabel: string | null;\n /** Placeholder text */\n placeholder: string | null;\n /** Title attribute */\n title: string | null;\n /** Element index in component (for uniqueness) */\n elementIndex: number;\n /** Existing id attribute */\n existingId: string | null;\n}\n\n/**\n * Simple hash function for ID generation\n */\nfunction simpleHash(str: string): string {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = (hash << 5) - hash + char;\n hash = hash & hash; // Convert to 32bit integer\n }\n // Convert to positive hex string\n return Math.abs(hash).toString(16).substring(0, 8);\n}\n\n/**\n * Normalize text for use in ID\n */\nfunction normalizeForId(text: string): string {\n return (\n text\n .toLowerCase()\n .trim()\n // Replace non-alphanumeric with dash\n .replace(/[^a-z0-9]+/g, '-')\n // Remove leading/trailing dashes\n .replace(/^-+|-+$/g, '')\n // Collapse multiple dashes\n .replace(/-+/g, '-')\n // Limit length\n .substring(0, 30)\n );\n}\n\n/**\n * Extract component name from file path\n */\nexport function extractComponentFromPath(filePath: string): string | null {\n // Normalize path separators\n const normalized = filePath.replace(/\\\\/g, '/');\n\n // Get filename without extension\n const match = normalized.match(/\\/([^/]+)\\.(tsx?|jsx?)$/);\n if (!match) return null;\n\n const filename = match[1];\n\n // Skip index files\n if (filename === 'index') {\n // Try to get parent folder name\n const parentMatch = normalized.match(/\\/([^/]+)\\/index\\.(tsx?|jsx?)$/);\n if (parentMatch) {\n return normalizeForId(parentMatch[1]);\n }\n }\n\n return normalizeForId(filename);\n}\n\n/**\n * Get semantic type for element\n */\nexport function getSemanticType(tagName: string, context: IdGeneratorContext): string {\n const tag = tagName.toLowerCase();\n\n // Check for specific input types\n if (tag === 'input') {\n // Would need to check type attribute, for now just return 'input'\n return 'input';\n }\n\n // Check for specific button purposes\n if (tag === 'button') {\n const text = context.textContent?.toLowerCase() || '';\n if (text.includes('submit') || text.includes('save')) return 'submit-button';\n if (text.includes('cancel') || text.includes('close')) return 'cancel-button';\n if (text.includes('delete') || text.includes('remove')) return 'delete-button';\n return 'button';\n }\n\n // Map tags to semantic types\n const typeMap: Record<string, string> = {\n a: 'link',\n select: 'dropdown',\n textarea: 'textarea',\n form: 'form',\n nav: 'navigation',\n header: 'header',\n footer: 'footer',\n main: 'main',\n aside: 'sidebar',\n dialog: 'dialog',\n img: 'image',\n };\n\n return typeMap[tag] || tag;\n}\n\n/**\n * Generate a unique ID for an element\n */\nexport function generateId(context: IdGeneratorContext, config: Required<PluginConfig>): string {\n const parts: string[] = [];\n\n // Add prefix\n if (config.idPrefix) {\n parts.push(config.idPrefix);\n }\n\n // Add file path component\n if (config.includeFilePath) {\n const fileComponent = extractComponentFromPath(context.filePath);\n if (fileComponent) {\n parts.push(fileComponent);\n }\n }\n\n // Add component name\n if (config.includeComponentName && context.componentName) {\n parts.push(normalizeForId(context.componentName));\n }\n\n // Add descriptive part from text/aria/placeholder\n const descriptiveText =\n context.textContent ||\n context.ariaLabel ||\n context.placeholder ||\n context.title ||\n context.existingId;\n\n if (descriptiveText) {\n parts.push(normalizeForId(descriptiveText));\n }\n\n // Add semantic type\n const semanticType = getSemanticType(context.tagName, context);\n parts.push(semanticType);\n\n // Generate base ID\n let id = parts.filter(Boolean).join('-');\n\n // If ID is empty or too short, use index\n if (id.length < 5) {\n id = `${config.idPrefix}-${context.tagName}-${context.elementIndex}`;\n }\n\n // Hash if configured\n if (config.hashIds) {\n const hash = simpleHash(id + context.filePath + context.elementIndex);\n id = `${config.idPrefix}-${hash}`;\n }\n\n return id;\n}\n\n/**\n * Counter for element indices per file\n */\nconst fileElementCounters = new Map<string, Map<string, number>>();\n\n/**\n * Get next element index for a file/tag combination\n */\nexport function getNextElementIndex(filePath: string, tagName: string): number {\n if (!fileElementCounters.has(filePath)) {\n fileElementCounters.set(filePath, new Map());\n }\n\n const fileCounters = fileElementCounters.get(filePath)!;\n const current = fileCounters.get(tagName) || 0;\n fileCounters.set(tagName, current + 1);\n\n return current;\n}\n\n/**\n * Reset counters for a file (call at start of file processing)\n */\nexport function resetFileCounters(filePath: string): void {\n fileElementCounters.delete(filePath);\n}\n","/**\n * Alias Generator\n *\n * Generates search aliases from element text, aria labels, and other attributes.\n */\n\nimport type { PluginConfig } from './config';\n\n/**\n * Context for generating aliases\n */\nexport interface AliasGeneratorContext {\n /** Element tag name */\n tagName: string;\n /** Text content */\n textContent: string | null;\n /** Aria label */\n ariaLabel: string | null;\n /** Placeholder text */\n placeholder: string | null;\n /** Title attribute */\n title: string | null;\n /** Name attribute */\n name: string | null;\n /** ID attribute */\n id: string | null;\n}\n\n/**\n * Common word synonyms for UI actions\n */\nconst SYNONYMS: Record<string, string[]> = {\n submit: ['send', 'go', 'confirm', 'done', 'ok', 'apply'],\n cancel: ['close', 'dismiss', 'abort', 'back', 'exit'],\n delete: ['remove', 'trash', 'erase', 'clear'],\n edit: ['modify', 'change', 'update'],\n add: ['create', 'new', 'plus', 'insert'],\n save: ['store', 'keep', 'preserve'],\n search: ['find', 'lookup', 'query'],\n login: ['signin', 'sign in', 'log in'],\n logout: ['signout', 'sign out', 'log out'],\n register: ['signup', 'sign up', 'join'],\n next: ['continue', 'forward', 'proceed'],\n previous: ['back', 'prev', 'prior'],\n start: ['begin', 'launch', 'run'],\n stop: ['end', 'halt', 'pause'],\n upload: ['attach', 'import'],\n download: ['export', 'get'],\n settings: ['preferences', 'options', 'config'],\n help: ['support', 'info', 'about'],\n home: ['main', 'dashboard'],\n profile: ['account', 'user'],\n};\n\n/**\n * Normalize text for alias matching\n */\nfunction normalizeText(text: string): string {\n return text\n .toLowerCase()\n .trim()\n .replace(/[^a-z0-9\\s]/g, '')\n .replace(/\\s+/g, ' ');\n}\n\n/**\n * Tokenize text into words\n */\nfunction tokenize(text: string): string[] {\n return normalizeText(text)\n .split(' ')\n .filter((word) => word.length > 1);\n}\n\n/**\n * Get synonyms for a word\n */\nfunction getSynonyms(word: string): string[] {\n const normalized = word.toLowerCase();\n\n // Check if word is in synonyms\n if (SYNONYMS[normalized]) {\n return SYNONYMS[normalized];\n }\n\n // Check if word is a synonym of something\n for (const [key, values] of Object.entries(SYNONYMS)) {\n if (values.includes(normalized)) {\n return [key, ...values.filter((v) => v !== normalized)];\n }\n }\n\n return [];\n}\n\n/**\n * Generate n-grams from tokens\n */\nfunction generateNgrams(tokens: string[], n: number): string[] {\n const ngrams: string[] = [];\n\n for (let i = 0; i <= tokens.length - n; i++) {\n ngrams.push(tokens.slice(i, i + n).join(' '));\n }\n\n return ngrams;\n}\n\n/**\n * Generate aliases for an element\n */\nexport function generateAliases(\n context: AliasGeneratorContext,\n config: Required<PluginConfig>\n): string[] {\n const aliases = new Set<string>();\n\n // Add text content\n if (context.textContent) {\n const normalized = normalizeText(context.textContent);\n if (normalized) {\n aliases.add(normalized);\n\n // Add individual tokens\n const tokens = tokenize(context.textContent);\n for (const token of tokens) {\n if (token.length >= 3) {\n aliases.add(token);\n }\n\n // Add synonyms\n for (const synonym of getSynonyms(token)) {\n aliases.add(synonym);\n }\n }\n\n // Add bi-grams\n if (tokens.length >= 2) {\n for (const ngram of generateNgrams(tokens, 2)) {\n aliases.add(ngram);\n }\n }\n }\n }\n\n // Add aria label\n if (context.ariaLabel) {\n const normalized = normalizeText(context.ariaLabel);\n if (normalized) {\n aliases.add(normalized);\n }\n }\n\n // Add placeholder\n if (context.placeholder) {\n const normalized = normalizeText(context.placeholder);\n if (normalized) {\n aliases.add(normalized);\n }\n }\n\n // Add title\n if (context.title) {\n const normalized = normalizeText(context.title);\n if (normalized) {\n aliases.add(normalized);\n }\n }\n\n // Add name attribute (often semantic)\n if (context.name) {\n const normalized = normalizeText(context.name).replace(/-/g, ' ');\n if (normalized) {\n aliases.add(normalized);\n }\n }\n\n // Add element type\n const typeAlias = getElementTypeAlias(context.tagName);\n if (typeAlias) {\n aliases.add(typeAlias);\n }\n\n // Convert to array and limit\n const result = Array.from(aliases)\n .filter((alias) => alias.length >= 2 && alias.length <= 50)\n .slice(0, config.maxAliases);\n\n return result;\n}\n\n/**\n * Get type alias for element\n */\nfunction getElementTypeAlias(tagName: string): string | null {\n const tag = tagName.toLowerCase();\n\n const typeAliases: Record<string, string> = {\n button: 'button',\n input: 'input',\n select: 'dropdown',\n textarea: 'text area',\n a: 'link',\n form: 'form',\n nav: 'navigation',\n img: 'image',\n };\n\n return typeAliases[tag] || null;\n}\n\n/**\n * Format aliases for attribute value\n */\nexport function formatAliasesAttribute(aliases: string[]): string {\n return aliases.join(',');\n}\n\n/**\n * Determine if aliases should be generated for this element\n */\nexport function shouldGenerateAliases(\n context: AliasGeneratorContext,\n config: Required<PluginConfig>\n): boolean {\n if (!config.generateAliases) {\n return false;\n }\n\n // Need at least some content to generate aliases\n return !!(\n context.textContent ||\n context.ariaLabel ||\n context.placeholder ||\n context.title ||\n context.name\n );\n}\n","/**\n * UI Bridge Babel Plugin\n *\n * Automatically instruments React components with UI Bridge IDs and aliases.\n *\n * @example\n * ```js\n * // babel.config.js\n * module.exports = {\n * plugins: [\n * ['@qontinui/ui-bridge/babel-plugin', {\n * elements: ['button', 'input', 'a'],\n * idPrefix: 'ui',\n * }]\n * ]\n * };\n * ```\n *\n * @example\n * ```jsx\n * // Input\n * <button onClick={handleSubmit}>Submit</button>\n *\n * // Output\n * <button\n * onClick={handleSubmit}\n * data-ui-id=\"ui-component-submit-button\"\n * data-ui-aliases=\"submit,send,go,confirm\"\n * data-ui-type=\"button\"\n * >\n * Submit\n * </button>\n * ```\n */\n\nimport { declare } from '@babel/helper-plugin-utils';\nimport type { PluginObj, NodePath, BabelFile } from '@babel/core';\nimport type * as t from '@babel/types';\nimport { type PluginConfig, mergeConfig, shouldProcessFile } from './config';\nimport {\n generateId,\n getNextElementIndex,\n resetFileCounters,\n getSemanticType,\n type IdGeneratorContext,\n} from './id-generator';\nimport {\n generateAliases,\n formatAliasesAttribute,\n shouldGenerateAliases,\n type AliasGeneratorContext,\n} from './alias-generator';\n\nexport type { PluginConfig } from './config';\n\n/**\n * State tracked during file transformation\n */\ninterface PluginState {\n filename: string;\n config: Required<PluginConfig>;\n componentStack: string[];\n processed: Set<string>;\n}\n\n/**\n * Extract text content from JSX children\n */\nfunction extractTextContent(\n children: (\n | t.JSXElement\n | t.JSXText\n | t.JSXExpressionContainer\n | t.JSXSpreadChild\n | t.JSXFragment\n )[],\n types: typeof t\n): string | null {\n const textParts: string[] = [];\n\n for (const child of children) {\n if (types.isJSXText(child)) {\n const text = child.value.trim();\n if (text) {\n textParts.push(text);\n }\n }\n }\n\n return textParts.length > 0 ? textParts.join(' ') : null;\n}\n\n/**\n * Get attribute value from JSX element\n */\nfunction getAttributeValue(\n element: t.JSXOpeningElement,\n attrName: string,\n types: typeof t\n): string | null {\n for (const attr of element.attributes) {\n if (types.isJSXAttribute(attr) && types.isJSXIdentifier(attr.name)) {\n if (attr.name.name === attrName) {\n if (types.isStringLiteral(attr.value)) {\n return attr.value.value;\n }\n if (types.isJSXExpressionContainer(attr.value)) {\n if (types.isStringLiteral(attr.value.expression)) {\n return attr.value.expression.value;\n }\n }\n }\n }\n }\n return null;\n}\n\n/**\n * Check if element has a specific attribute\n */\nfunction hasAttribute(element: t.JSXOpeningElement, attrName: string, types: typeof t): boolean {\n return element.attributes.some(\n (attr) =>\n types.isJSXAttribute(attr) && types.isJSXIdentifier(attr.name) && attr.name.name === attrName\n );\n}\n\n/**\n * Add attribute to JSX element\n */\nfunction addAttribute(\n element: t.JSXOpeningElement,\n name: string,\n value: string,\n types: typeof t\n): void {\n element.attributes.push(\n types.jsxAttribute(types.jsxIdentifier(name), types.stringLiteral(value))\n );\n}\n\n/**\n * Get tag name from JSX element\n */\nfunction getTagName(element: t.JSXOpeningElement, types: typeof t): string | null {\n if (types.isJSXIdentifier(element.name)) {\n return element.name.name;\n }\n if (types.isJSXMemberExpression(element.name)) {\n // Handle Component.SubComponent\n return null; // Skip member expressions\n }\n return null;\n}\n\n/**\n * Check if tag is a lowercase HTML element (not a React component)\n */\nfunction isHtmlElement(tagName: string): boolean {\n return tagName[0] === tagName[0].toLowerCase();\n}\n\n/**\n * Find parent component name\n */\nfunction findComponentName(path: NodePath<t.JSXElement>): string | null {\n let current: NodePath<t.Node> | null = path as NodePath<t.Node>;\n\n while (current) {\n const parent: NodePath<t.Node> | null = current.parentPath;\n\n if (!parent) break;\n\n // Check for function declaration\n if (parent.isFunctionDeclaration()) {\n const name = (parent.node as t.FunctionDeclaration).id?.name;\n if (name && name[0] === name[0].toUpperCase()) {\n return name;\n }\n }\n\n // Check for variable declarator with arrow function\n if (parent.isArrowFunctionExpression() || parent.isFunctionExpression()) {\n const varDeclarator = parent.parentPath;\n if (varDeclarator?.isVariableDeclarator()) {\n const id = (varDeclarator.node as t.VariableDeclarator).id;\n if (id && id.type === 'Identifier') {\n const name = id.name;\n if (name[0] === name[0].toUpperCase()) {\n return name;\n }\n }\n }\n }\n\n // Check for class method (render)\n if (parent.isClassMethod()) {\n const classDecl = parent.parentPath?.parentPath;\n if (classDecl?.isClassDeclaration()) {\n const name = (classDecl.node as t.ClassDeclaration).id?.name;\n if (name) {\n return name;\n }\n }\n }\n\n current = parent;\n }\n\n return null;\n}\n\n/**\n * Babel API interface\n */\ninterface BabelAPI {\n assertVersion(version: number): void;\n types: typeof t;\n}\n\n/**\n * The Babel plugin\n */\nconst uiBridgeBabelPlugin = declare<PluginConfig, PluginObj<PluginState>>(\n (api: BabelAPI, options: PluginConfig) => {\n api.assertVersion(7);\n\n const types = api.types;\n const config = mergeConfig(options);\n\n return {\n name: 'ui-bridge-babel-plugin',\n\n pre(this: PluginState, file: BabelFile) {\n const filename = file.opts.filename || 'unknown';\n this.filename = filename;\n this.config = config;\n this.componentStack = [];\n this.processed = new Set();\n\n // Reset element counters for this file\n resetFileCounters(filename);\n\n if (config.verbose) {\n console.log(`[ui-bridge-babel-plugin] Processing: ${filename}`);\n }\n },\n\n visitor: {\n JSXElement(this: PluginState, path: NodePath<t.JSXElement>) {\n // Check if file should be processed\n if (!shouldProcessFile(this.filename, this.config)) {\n return;\n }\n\n const openingElement = path.node.openingElement;\n const tagName = getTagName(openingElement, types);\n\n // Skip if no tag name or not an HTML element\n if (!tagName || !isHtmlElement(tagName)) {\n return;\n }\n\n // Check if this element type should be instrumented\n if (!this.config.elements.includes(tagName as any)) {\n return;\n }\n\n // Skip if already has ui-id (unless configured otherwise)\n if (\n this.config.skipExisting &&\n hasAttribute(openingElement, this.config.idAttribute, types)\n ) {\n return;\n }\n\n // Find component name\n const componentName = findComponentName(path);\n\n // Check component filters\n if (this.config.onlyInComponents.length > 0) {\n if (!componentName || !this.config.onlyInComponents.includes(componentName)) {\n return;\n }\n }\n\n if (this.config.skipInComponents.length > 0) {\n if (componentName && this.config.skipInComponents.includes(componentName)) {\n return;\n }\n }\n\n // Extract element info\n const textContent = extractTextContent(path.node.children as any[], types);\n const ariaLabel = getAttributeValue(openingElement, 'aria-label', types);\n const placeholder = getAttributeValue(openingElement, 'placeholder', types);\n const title = getAttributeValue(openingElement, 'title', types);\n const name = getAttributeValue(openingElement, 'name', types);\n const existingId = getAttributeValue(openingElement, 'id', types);\n\n // Get element index for uniqueness\n const elementIndex = getNextElementIndex(this.filename, tagName);\n\n // Build context for ID generation\n const idContext: IdGeneratorContext = {\n componentName,\n filePath: this.filename,\n tagName,\n textContent,\n ariaLabel,\n placeholder,\n title,\n elementIndex,\n existingId,\n };\n\n // Generate ID\n const generatedId = generateId(idContext, this.config);\n\n // Skip if this exact ID was already generated (collision)\n if (this.processed.has(generatedId)) {\n // Add index suffix for uniqueness\n const uniqueId = `${generatedId}-${elementIndex}`;\n addAttribute(openingElement, this.config.idAttribute, uniqueId, types);\n } else {\n this.processed.add(generatedId);\n addAttribute(openingElement, this.config.idAttribute, generatedId, types);\n }\n\n // Add element type\n const semanticType = getSemanticType(tagName, idContext);\n addAttribute(openingElement, this.config.typeAttribute, semanticType, types);\n\n // Generate and add aliases\n const aliasContext: AliasGeneratorContext = {\n tagName,\n textContent,\n ariaLabel,\n placeholder,\n title,\n name,\n id: existingId,\n };\n\n if (shouldGenerateAliases(aliasContext, this.config)) {\n const aliases = generateAliases(aliasContext, this.config);\n if (aliases.length > 0) {\n addAttribute(\n openingElement,\n this.config.aliasesAttribute,\n formatAliasesAttribute(aliases),\n types\n );\n }\n }\n\n if (this.config.verbose) {\n console.log(`[ui-bridge-babel-plugin] Instrumented <${tagName}> as \"${generatedId}\"`);\n }\n },\n },\n\n post(this: PluginState) {\n if (this.config.verbose) {\n console.log(`[ui-bridge-babel-plugin] Finished processing: ${this.filename}`);\n }\n },\n };\n }\n);\n\nexport default uiBridgeBabelPlugin;\n\n// Named export for ESM compatibility\nexport { uiBridgeBabelPlugin };\n\n// Re-export utilities for advanced usage\nexport { mergeConfig, shouldProcessFile, DEFAULT_CONFIG } from './config';\nexport {\n generateId,\n getSemanticType,\n extractComponentFromPath,\n resetFileCounters,\n getNextElementIndex,\n type IdGeneratorContext,\n} from './id-generator';\nexport {\n generateAliases,\n formatAliasesAttribute,\n shouldGenerateAliases,\n type AliasGeneratorContext,\n} from './alias-generator';\n"]}
@@ -326,10 +326,7 @@ function hasAttribute(element, attrName, types) {
326
326
  }
327
327
  function addAttribute(element, name, value, types) {
328
328
  element.attributes.push(
329
- types.jsxAttribute(
330
- types.jsxIdentifier(name),
331
- types.stringLiteral(value)
332
- )
329
+ types.jsxAttribute(types.jsxIdentifier(name), types.stringLiteral(value))
333
330
  );
334
331
  }
335
332
  function getTagName(element, types) {
@@ -400,8 +397,7 @@ var uiBridgeBabelPlugin = declare(
400
397
  },
401
398
  visitor: {
402
399
  JSXElement(path) {
403
- const state = this;
404
- if (!shouldProcessFile(state.filename, state.config)) {
400
+ if (!shouldProcessFile(this.filename, this.config)) {
405
401
  return;
406
402
  }
407
403
  const openingElement = path.node.openingElement;
@@ -409,36 +405,33 @@ var uiBridgeBabelPlugin = declare(
409
405
  if (!tagName || !isHtmlElement(tagName)) {
410
406
  return;
411
407
  }
412
- if (!state.config.elements.includes(tagName)) {
408
+ if (!this.config.elements.includes(tagName)) {
413
409
  return;
414
410
  }
415
- if (state.config.skipExisting && hasAttribute(openingElement, state.config.idAttribute, types)) {
411
+ if (this.config.skipExisting && hasAttribute(openingElement, this.config.idAttribute, types)) {
416
412
  return;
417
413
  }
418
414
  const componentName = findComponentName(path);
419
- if (state.config.onlyInComponents.length > 0) {
420
- if (!componentName || !state.config.onlyInComponents.includes(componentName)) {
415
+ if (this.config.onlyInComponents.length > 0) {
416
+ if (!componentName || !this.config.onlyInComponents.includes(componentName)) {
421
417
  return;
422
418
  }
423
419
  }
424
- if (state.config.skipInComponents.length > 0) {
425
- if (componentName && state.config.skipInComponents.includes(componentName)) {
420
+ if (this.config.skipInComponents.length > 0) {
421
+ if (componentName && this.config.skipInComponents.includes(componentName)) {
426
422
  return;
427
423
  }
428
424
  }
429
- const textContent = extractTextContent(
430
- path.node.children,
431
- types
432
- );
425
+ const textContent = extractTextContent(path.node.children, types);
433
426
  const ariaLabel = getAttributeValue(openingElement, "aria-label", types);
434
427
  const placeholder = getAttributeValue(openingElement, "placeholder", types);
435
428
  const title = getAttributeValue(openingElement, "title", types);
436
429
  const name = getAttributeValue(openingElement, "name", types);
437
430
  const existingId = getAttributeValue(openingElement, "id", types);
438
- const elementIndex = getNextElementIndex(state.filename, tagName);
431
+ const elementIndex = getNextElementIndex(this.filename, tagName);
439
432
  const idContext = {
440
433
  componentName,
441
- filePath: state.filename,
434
+ filePath: this.filename,
442
435
  tagName,
443
436
  textContent,
444
437
  ariaLabel,
@@ -447,16 +440,16 @@ var uiBridgeBabelPlugin = declare(
447
440
  elementIndex,
448
441
  existingId
449
442
  };
450
- const generatedId = generateId(idContext, state.config);
451
- if (state.processed.has(generatedId)) {
443
+ const generatedId = generateId(idContext, this.config);
444
+ if (this.processed.has(generatedId)) {
452
445
  const uniqueId = `${generatedId}-${elementIndex}`;
453
- addAttribute(openingElement, state.config.idAttribute, uniqueId, types);
446
+ addAttribute(openingElement, this.config.idAttribute, uniqueId, types);
454
447
  } else {
455
- state.processed.add(generatedId);
456
- addAttribute(openingElement, state.config.idAttribute, generatedId, types);
448
+ this.processed.add(generatedId);
449
+ addAttribute(openingElement, this.config.idAttribute, generatedId, types);
457
450
  }
458
451
  const semanticType = getSemanticType(tagName, idContext);
459
- addAttribute(openingElement, state.config.typeAttribute, semanticType, types);
452
+ addAttribute(openingElement, this.config.typeAttribute, semanticType, types);
460
453
  const aliasContext = {
461
454
  tagName,
462
455
  textContent,
@@ -464,29 +457,25 @@ var uiBridgeBabelPlugin = declare(
464
457
  placeholder,
465
458
  title,
466
459
  name};
467
- if (shouldGenerateAliases(aliasContext, state.config)) {
468
- const aliases = generateAliases(aliasContext, state.config);
460
+ if (shouldGenerateAliases(aliasContext, this.config)) {
461
+ const aliases = generateAliases(aliasContext, this.config);
469
462
  if (aliases.length > 0) {
470
463
  addAttribute(
471
464
  openingElement,
472
- state.config.aliasesAttribute,
465
+ this.config.aliasesAttribute,
473
466
  formatAliasesAttribute(aliases),
474
467
  types
475
468
  );
476
469
  }
477
470
  }
478
- if (state.config.verbose) {
479
- console.log(
480
- `[ui-bridge-babel-plugin] Instrumented <${tagName}> as "${generatedId}"`
481
- );
471
+ if (this.config.verbose) {
472
+ console.log(`[ui-bridge-babel-plugin] Instrumented <${tagName}> as "${generatedId}"`);
482
473
  }
483
474
  }
484
475
  },
485
476
  post() {
486
477
  if (this.config.verbose) {
487
- console.log(
488
- `[ui-bridge-babel-plugin] Finished processing: ${this.filename}`
489
- );
478
+ console.log(`[ui-bridge-babel-plugin] Finished processing: ${this.filename}`);
490
479
  }
491
480
  }
492
481
  };