@yahoo/uds 3.114.0-beta.2 → 3.114.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/dist/automated-config/dist/generated/autoVariants.cjs +3 -0
  2. package/dist/automated-config/dist/generated/autoVariants.d.cts +3 -0
  3. package/dist/automated-config/dist/generated/autoVariants.d.ts +3 -0
  4. package/dist/automated-config/dist/generated/autoVariants.js +3 -0
  5. package/dist/automated-config/dist/generated/generatedConfigs.cjs +1883 -0
  6. package/dist/automated-config/dist/generated/generatedConfigs.d.cts +175 -1
  7. package/dist/automated-config/dist/generated/generatedConfigs.d.ts +175 -1
  8. package/dist/automated-config/dist/generated/generatedConfigs.js +1882 -1
  9. package/dist/automated-config/dist/generated/universalTokensConfigAuto.cjs +84 -0
  10. package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.cts +3 -1
  11. package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.ts +3 -1
  12. package/dist/automated-config/dist/generated/universalTokensConfigAuto.js +84 -0
  13. package/dist/automated-config/dist/mapTextVariantFixtureToValue.cjs +1 -12
  14. package/dist/automated-config/dist/mapTextVariantFixtureToValue.js +1 -12
  15. package/dist/automated-config/dist/properties.cjs +58 -12
  16. package/dist/automated-config/dist/properties.d.cts +8 -0
  17. package/dist/automated-config/dist/properties.d.ts +8 -0
  18. package/dist/automated-config/dist/properties.js +58 -12
  19. package/dist/automated-config/dist/utils/getConfigVariantProperties.d.cts +2 -2
  20. package/dist/automated-config/dist/utils/getConfigVariantProperties.d.ts +2 -2
  21. package/dist/cli/commands/sync.cjs +7 -1
  22. package/dist/cli/commands/sync.d.cts +1 -1
  23. package/dist/cli/commands/sync.d.ts +1 -1
  24. package/dist/cli/commands/sync.js +7 -1
  25. package/dist/cli/commands/version.cjs +2 -0
  26. package/dist/cli/commands/version.d.cts +1 -1
  27. package/dist/cli/commands/version.d.ts +1 -1
  28. package/dist/cli/commands/version.js +2 -0
  29. package/dist/cli/dist/cli.cjs +1 -1
  30. package/dist/cli/dist/cli.js +1 -1
  31. package/dist/cli/dist/commands/editor-rules.cjs +2 -2
  32. package/dist/cli/dist/commands/editor-rules.js +2 -2
  33. package/dist/cli/dist/utils/rules/config.cjs +1 -1
  34. package/dist/cli/dist/utils/rules/config.js +1 -1
  35. package/dist/cli/runner.cjs +2 -11
  36. package/dist/cli/runner.js +2 -11
  37. package/dist/components/Scrim.cjs +28 -0
  38. package/dist/components/Scrim.d.cts +14 -0
  39. package/dist/components/Scrim.d.ts +14 -0
  40. package/dist/components/Scrim.js +26 -0
  41. package/dist/components/client/BottomSheet/BottomSheet.cjs +209 -0
  42. package/dist/components/client/BottomSheet/BottomSheet.d.cts +77 -0
  43. package/dist/components/client/BottomSheet/BottomSheet.d.ts +77 -0
  44. package/dist/components/client/BottomSheet/BottomSheet.js +207 -0
  45. package/dist/components/client/BottomSheet/BottomSheetContent.cjs +26 -0
  46. package/dist/components/client/BottomSheet/BottomSheetContent.d.cts +15 -0
  47. package/dist/components/client/BottomSheet/BottomSheetContent.d.ts +15 -0
  48. package/dist/components/client/BottomSheet/BottomSheetContent.js +24 -0
  49. package/dist/components/client/BottomSheet/BottomSheetDismiss.cjs +15 -0
  50. package/dist/components/client/BottomSheet/BottomSheetDismiss.d.cts +12 -0
  51. package/dist/components/client/BottomSheet/BottomSheetDismiss.d.ts +12 -0
  52. package/dist/components/client/BottomSheet/BottomSheetDismiss.js +13 -0
  53. package/dist/components/client/BottomSheet/BottomSheetHandle.cjs +30 -0
  54. package/dist/components/client/BottomSheet/BottomSheetHandle.d.cts +19 -0
  55. package/dist/components/client/BottomSheet/BottomSheetHandle.d.ts +19 -0
  56. package/dist/components/client/BottomSheet/BottomSheetHandle.js +28 -0
  57. package/dist/components/client/BottomSheet/BottomSheetHeader.cjs +42 -0
  58. package/dist/components/client/BottomSheet/BottomSheetHeader.d.cts +18 -0
  59. package/dist/components/client/BottomSheet/BottomSheetHeader.d.ts +18 -0
  60. package/dist/components/client/BottomSheet/BottomSheetHeader.js +40 -0
  61. package/dist/components/client/BottomSheet/BottomSheetProvider.cjs +21 -0
  62. package/dist/components/client/BottomSheet/BottomSheetProvider.d.cts +19 -0
  63. package/dist/components/client/BottomSheet/BottomSheetProvider.d.ts +19 -0
  64. package/dist/components/client/BottomSheet/BottomSheetProvider.js +19 -0
  65. package/dist/components/client/BottomSheet/BottomSheetTrigger.cjs +15 -0
  66. package/dist/components/client/BottomSheet/BottomSheetTrigger.d.cts +12 -0
  67. package/dist/components/client/BottomSheet/BottomSheetTrigger.d.ts +12 -0
  68. package/dist/components/client/BottomSheet/BottomSheetTrigger.js +13 -0
  69. package/dist/components/client/BottomSheet/UDSBottomSheetConfigProvider.cjs +32 -0
  70. package/dist/components/client/BottomSheet/UDSBottomSheetConfigProvider.d.cts +22 -0
  71. package/dist/components/client/BottomSheet/UDSBottomSheetConfigProvider.d.ts +22 -0
  72. package/dist/components/client/BottomSheet/UDSBottomSheetConfigProvider.js +29 -0
  73. package/dist/components/client/BottomSheet/index.cjs +22 -0
  74. package/dist/components/client/BottomSheet/index.d.cts +10 -0
  75. package/dist/components/client/BottomSheet/index.d.ts +10 -0
  76. package/dist/components/client/BottomSheet/index.js +12 -0
  77. package/dist/components/client/BottomSheet/useBottomSheetDrag.cjs +188 -0
  78. package/dist/components/client/BottomSheet/useBottomSheetDrag.d.cts +44 -0
  79. package/dist/components/client/BottomSheet/useBottomSheetDrag.d.ts +44 -0
  80. package/dist/components/client/BottomSheet/useBottomSheetDrag.js +185 -0
  81. package/dist/components/client/BottomSheet/useBottomSheetSnapModel.cjs +138 -0
  82. package/dist/components/client/BottomSheet/useBottomSheetSnapModel.d.cts +46 -0
  83. package/dist/components/client/BottomSheet/useBottomSheetSnapModel.d.ts +46 -0
  84. package/dist/components/client/BottomSheet/useBottomSheetSnapModel.js +135 -0
  85. package/dist/components/client/BottomSheet/useBottomSheetStore.cjs +34 -0
  86. package/dist/components/client/BottomSheet/useBottomSheetStore.d.cts +38 -0
  87. package/dist/components/client/BottomSheet/useBottomSheetStore.d.ts +38 -0
  88. package/dist/components/client/BottomSheet/useBottomSheetStore.js +31 -0
  89. package/dist/components/client/BottomSheet/useBottomSheetStoreInternal.cjs +17 -0
  90. package/dist/components/client/BottomSheet/useBottomSheetStoreInternal.d.cts +13 -0
  91. package/dist/components/client/BottomSheet/useBottomSheetStoreInternal.d.ts +13 -0
  92. package/dist/components/client/BottomSheet/useBottomSheetStoreInternal.js +15 -0
  93. package/dist/components/client/BottomSheet/useExpansionMargins.cjs +89 -0
  94. package/dist/components/client/BottomSheet/useExpansionMargins.d.cts +34 -0
  95. package/dist/components/client/BottomSheet/useExpansionMargins.d.ts +34 -0
  96. package/dist/components/client/BottomSheet/useExpansionMargins.js +87 -0
  97. package/dist/components/client/BottomSheet/useViewportHeight.cjs +32 -0
  98. package/dist/components/client/BottomSheet/useViewportHeight.d.cts +9 -0
  99. package/dist/components/client/BottomSheet/useViewportHeight.d.ts +9 -0
  100. package/dist/components/client/BottomSheet/useViewportHeight.js +30 -0
  101. package/dist/components/client/BottomSheet/useVirtualKeyboard.cjs +48 -0
  102. package/dist/components/client/BottomSheet/useVirtualKeyboard.d.cts +10 -0
  103. package/dist/components/client/BottomSheet/useVirtualKeyboard.d.ts +10 -0
  104. package/dist/components/client/BottomSheet/useVirtualKeyboard.js +46 -0
  105. package/dist/components/client/BottomSheet/utils.cjs +128 -0
  106. package/dist/components/client/BottomSheet/utils.d.cts +61 -0
  107. package/dist/components/client/BottomSheet/utils.d.ts +61 -0
  108. package/dist/components/client/BottomSheet/utils.js +118 -0
  109. package/dist/components/client/Menu/Menu.Content.cjs +1 -1
  110. package/dist/components/client/Menu/Menu.Content.js +1 -1
  111. package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +1 -1
  112. package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +1 -1
  113. package/dist/components/client/Menu/Menu.index.d.cts +1 -1
  114. package/dist/components/client/index.cjs +16 -0
  115. package/dist/components/client/index.d.cts +10 -1
  116. package/dist/components/client/index.d.ts +10 -1
  117. package/dist/components/client/index.js +9 -1
  118. package/dist/components/client/providers/UDSConfigProvider.cjs +10 -6
  119. package/dist/components/client/providers/UDSConfigProvider.d.cts +1 -0
  120. package/dist/components/client/providers/UDSConfigProvider.d.ts +1 -0
  121. package/dist/components/client/providers/UDSConfigProvider.js +10 -6
  122. package/dist/components/index.cjs +24 -0
  123. package/dist/components/index.d.cts +9 -1
  124. package/dist/components/index.d.ts +9 -1
  125. package/dist/components/index.js +17 -1
  126. package/dist/config/dist/index.cjs +110 -2
  127. package/dist/config/dist/index.js +110 -2
  128. package/dist/fixtures/dist/index.cjs +103 -0
  129. package/dist/fixtures/dist/index.d.cts +3 -2
  130. package/dist/fixtures/dist/index.d.ts +3 -2
  131. package/dist/fixtures/dist/index.js +103 -1
  132. package/dist/fixtures/index.cjs +1 -0
  133. package/dist/fixtures/index.d.cts +2 -2
  134. package/dist/fixtures/index.d.ts +2 -2
  135. package/dist/fixtures/index.js +2 -2
  136. package/dist/index.cjs +20 -2
  137. package/dist/index.d.cts +12 -5
  138. package/dist/index.d.ts +12 -5
  139. package/dist/index.js +11 -3
  140. package/dist/runtime/bottomSheetConfig.cjs +11 -0
  141. package/dist/runtime/bottomSheetConfig.d.cts +15 -0
  142. package/dist/runtime/bottomSheetConfig.d.ts +15 -0
  143. package/dist/runtime/bottomSheetConfig.js +9 -0
  144. package/dist/runtime/index.cjs +2 -0
  145. package/dist/runtime/index.d.cts +2 -1
  146. package/dist/runtime/index.d.ts +2 -1
  147. package/dist/runtime/index.js +2 -1
  148. package/dist/runtime/udsConfig.cjs +2 -0
  149. package/dist/runtime/udsConfig.d.cts +2 -0
  150. package/dist/runtime/udsConfig.d.ts +2 -0
  151. package/dist/runtime/udsConfig.js +2 -0
  152. package/dist/styles/styler.d.cts +33 -30
  153. package/dist/styles/styler.d.ts +33 -30
  154. package/dist/styles/variants.cjs +278 -278
  155. package/dist/styles/variants.d.cts +9 -0
  156. package/dist/styles/variants.d.ts +9 -0
  157. package/dist/styles/variants.js +278 -278
  158. package/dist/tailwind/dist/commands/generateComponentData.cjs +31 -33
  159. package/dist/tailwind/dist/commands/generateComponentData.d.ts +1 -1
  160. package/dist/tailwind/dist/commands/generateComponentData.js +31 -33
  161. package/dist/tailwind/dist/commands/generatePurgeCSSData.d.ts +1 -1
  162. package/dist/tailwind/dist/commands/purge.cjs +4 -3
  163. package/dist/tailwind/dist/commands/purge.d.ts +1 -1
  164. package/dist/tailwind/dist/commands/purge.js +4 -3
  165. package/dist/tailwind/dist/index.d.cts +0 -1
  166. package/dist/tailwind/dist/index.d.ts +3 -5
  167. package/dist/tailwind/dist/purger/legacy/purgeCSS.cjs +3 -4
  168. package/dist/tailwind/dist/purger/legacy/purgeCSS.js +3 -4
  169. package/dist/tailwind/dist/purger/optimized/ast/expressions.cjs +125 -122
  170. package/dist/tailwind/dist/purger/optimized/ast/expressions.js +125 -122
  171. package/dist/tailwind/dist/purger/optimized/ast/jsx.cjs +8 -1
  172. package/dist/tailwind/dist/purger/optimized/ast/jsx.js +8 -1
  173. package/dist/tailwind/dist/purger/optimized/purge.cjs +10 -11
  174. package/dist/tailwind/dist/purger/optimized/purge.js +9 -10
  175. package/dist/tailwind/dist/purger/optimized/purgeFromCode.cjs +127 -232
  176. package/dist/tailwind/dist/purger/optimized/purgeFromCode.js +127 -232
  177. package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.cjs +262 -330
  178. package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.js +262 -329
  179. package/dist/tailwind/dist/purger/optimized/utils/files.cjs +3 -4
  180. package/dist/tailwind/dist/purger/optimized/utils/files.js +3 -4
  181. package/dist/tailwind/dist/purger/optimized/utils/safelist.cjs +21 -13
  182. package/dist/tailwind/dist/purger/optimized/utils/safelist.js +21 -13
  183. package/dist/tailwind/dist/tailwind/plugins/components.cjs +2 -0
  184. package/dist/tailwind/dist/tailwind/plugins/components.js +3 -1
  185. package/dist/tailwind/dist/tailwind/plugins/typography.cjs +13 -41
  186. package/dist/tailwind/dist/tailwind/plugins/typography.js +13 -41
  187. package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.cjs +2 -4
  188. package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.d.cts +1 -10
  189. package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.d.ts +1 -10
  190. package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.js +2 -4
  191. package/dist/tailwind/dist/utils/tsMorph.cjs +1 -1
  192. package/dist/tokens/automation/configs/index.cjs +2 -0
  193. package/dist/tokens/automation/configs/index.d.cts +2 -2
  194. package/dist/tokens/automation/configs/index.d.ts +2 -2
  195. package/dist/tokens/automation/configs/index.js +2 -2
  196. package/dist/tokens/automation/index.cjs +2 -0
  197. package/dist/tokens/automation/index.d.cts +2 -2
  198. package/dist/tokens/automation/index.d.ts +2 -2
  199. package/dist/tokens/automation/index.js +2 -2
  200. package/dist/tokens/index.cjs +2 -0
  201. package/dist/tokens/index.d.cts +3 -3
  202. package/dist/tokens/index.d.ts +3 -3
  203. package/dist/tokens/index.js +2 -2
  204. package/dist/tokens/types.d.cts +2 -2
  205. package/dist/tokens/types.d.ts +2 -2
  206. package/dist/types/dist/index.d.cts +76 -1
  207. package/dist/types/dist/index.d.ts +76 -1
  208. package/dist/uds/generated/componentData.cjs +1187 -961
  209. package/dist/uds/generated/componentData.js +1111 -939
  210. package/dist/uds/generated/tailwindPurge.cjs +57 -29
  211. package/dist/uds/generated/tailwindPurge.js +57 -29
  212. package/dist/uds/package.cjs +4 -10
  213. package/dist/uds/package.js +4 -10
  214. package/package.json +4 -7
  215. package/dist/cli/dist/lib/logger.cjs +0 -66
  216. package/dist/cli/dist/lib/logger.js +0 -66
  217. package/dist/tailwind/dist/commands/css.cjs +0 -79
  218. package/dist/tailwind/dist/commands/css.d.ts +0 -3
  219. package/dist/tailwind/dist/commands/css.helpers.cjs +0 -32
  220. package/dist/tailwind/dist/commands/css.helpers.js +0 -28
  221. package/dist/tailwind/dist/commands/css.js +0 -79
  222. package/dist/tailwind/dist/css/generate.cjs +0 -120
  223. package/dist/tailwind/dist/css/generate.d.cts +0 -30
  224. package/dist/tailwind/dist/css/generate.d.ts +0 -31
  225. package/dist/tailwind/dist/css/generate.helpers.cjs +0 -112
  226. package/dist/tailwind/dist/css/generate.helpers.js +0 -100
  227. package/dist/tailwind/dist/css/generate.js +0 -115
  228. package/dist/tailwind/dist/css/postcss.cjs +0 -35
  229. package/dist/tailwind/dist/css/postcss.helpers.cjs +0 -27
  230. package/dist/tailwind/dist/css/postcss.helpers.js +0 -26
  231. package/dist/tailwind/dist/css/postcss.js +0 -35
  232. package/dist/tailwind/dist/css/runner.cjs +0 -278
  233. package/dist/tailwind/dist/css/runner.helpers.cjs +0 -26
  234. package/dist/tailwind/dist/css/runner.helpers.js +0 -23
  235. package/dist/tailwind/dist/css/runner.js +0 -275
  236. package/dist/tailwind/dist/css/theme.cjs +0 -12
  237. package/dist/tailwind/dist/css/theme.d.cts +0 -66
  238. package/dist/tailwind/dist/css/theme.d.ts +0 -66
  239. package/dist/tailwind/dist/css/theme.js +0 -11
  240. package/dist/tailwind/dist/css/utils.cjs +0 -234
  241. package/dist/tailwind/dist/css/utils.js +0 -223
  242. package/dist/tailwind/dist/utils/optimizeCSS.cjs +0 -405
  243. package/dist/tailwind/dist/utils/optimizeCSS.js +0 -403
  244. package/dist/tailwind/dist/utils/postcssPreserveVars.cjs +0 -67
  245. package/dist/tailwind/dist/utils/postcssPreserveVars.js +0 -65
  246. package/generated/componentData.json +0 -2397
  247. package/generated/tailwindPurge.ts +0 -4560
@@ -23,45 +23,43 @@ const makeGenerateComponentDataCommand = (getContext) => ({
23
23
  require_print.print("Scanning components in:", componentsDir);
24
24
  const componentPaths = await require_componentAnalyzer.scanComponentFiles(componentsDir);
25
25
  require_print.print(`Found ${componentPaths.size} components`);
26
- const componentDataEntries = await Promise.all([...componentPaths].map(async ([name, filePath]) => {
27
- try {
28
- project.addSourceFileAtPath(filePath);
29
- const info = require_componentAnalyzer.analyzeComponent(project, filePath);
30
- return info ? [name, serializeComponentInfo(info)] : null;
31
- } catch (error) {
32
- console.warn(`Warning: Could not analyze ${name}:`, error);
33
- return null;
34
- }
35
- }));
36
- const componentData = Object.fromEntries(componentDataEntries.filter((entry) => Boolean(entry)));
26
+ const componentData = {};
27
+ for (const [name, filePath] of componentPaths) try {
28
+ project.addSourceFileAtPath(filePath);
29
+ const info = require_componentAnalyzer.analyzeComponent(project, filePath);
30
+ if (info) componentData[name] = serializeComponentInfo(info);
31
+ } catch (error) {
32
+ console.warn(`Warning: Could not analyze ${name}:`, error);
33
+ }
37
34
  (0, node_fs.writeFileSync)(outputFile, JSON.stringify(componentData, null, 2));
38
35
  require_print.print(`Generated component data for ${Object.keys(componentData).length} components`);
39
36
  require_print.print(`Output written to: ${outputFile}`);
40
- const totals = Object.values(componentData).reduce((acc, comp) => ({
41
- totalDefaults: acc.totalDefaults + Object.keys(comp.defaultProps).length,
42
- totalLiterals: acc.totalLiterals + Object.keys(comp.getStylesLiterals).length,
43
- totalInternalComponents: acc.totalInternalComponents + comp.internalComponents.length
44
- }), {
45
- totalDefaults: 0,
46
- totalLiterals: 0,
47
- totalInternalComponents: 0
48
- });
37
+ let totalDefaults = 0;
38
+ let totalLiterals = 0;
39
+ let totalInternalComponents = 0;
40
+ for (const comp of Object.values(componentData)) {
41
+ totalDefaults += Object.keys(comp.defaultProps).length;
42
+ totalLiterals += Object.keys(comp.getStylesLiterals).length;
43
+ totalInternalComponents += comp.internalComponents.length;
44
+ }
49
45
  require_print.print("\nStats:");
50
- require_print.print(` Default props: ${totals.totalDefaults}`);
51
- require_print.print(` getStyles literals: ${totals.totalLiterals}`);
52
- require_print.print(` Internal component refs: ${totals.totalInternalComponents}`);
46
+ require_print.print(` Default props: ${totalDefaults}`);
47
+ require_print.print(` getStyles literals: ${totalLiterals}`);
48
+ require_print.print(` Internal component refs: ${totalInternalComponents}`);
53
49
  }
54
50
  });
55
- const serializeComponentInfo = (info) => ({
56
- name: info.name,
57
- defaultProps: Object.fromEntries(info.defaultProps),
58
- getStylesLiterals: Object.fromEntries(info.getStylesLiterals),
59
- cxLiterals: info.cxLiterals,
60
- internalComponents: info.internalComponents,
61
- internalComponentProps: Object.fromEntries(Array.from(info.internalComponentProps.entries()).map(([key, propsMap]) => [key, Object.fromEntries(propsMap)])),
62
- propToVariantKeys: Object.fromEntries(info.propToVariantKeys),
63
- motionVarPrefixes: info.motionVarPrefixes
64
- });
51
+ function serializeComponentInfo(info) {
52
+ return {
53
+ name: info.name,
54
+ defaultProps: Object.fromEntries(info.defaultProps),
55
+ getStylesLiterals: Object.fromEntries(info.getStylesLiterals),
56
+ cxLiterals: info.cxLiterals,
57
+ internalComponents: info.internalComponents,
58
+ internalComponentProps: Object.fromEntries(Array.from(info.internalComponentProps.entries()).map(([key, propsMap]) => [key, Object.fromEntries(propsMap)])),
59
+ propToVariantKeys: Object.fromEntries(info.propToVariantKeys),
60
+ motionVarPrefixes: info.motionVarPrefixes
61
+ };
62
+ }
65
63
 
66
64
  //#endregion
67
65
  exports.makeGenerateComponentDataCommand = makeGenerateComponentDataCommand;
@@ -1,3 +1,3 @@
1
1
 
2
2
  import { Project } from "ts-morph";
3
- import { Command } from "@yahoo/uds-cli/lib";
3
+ import { Command } from "@yahoo/uds-cli";
@@ -22,45 +22,43 @@ const makeGenerateComponentDataCommand = (getContext) => ({
22
22
  print("Scanning components in:", componentsDir);
23
23
  const componentPaths = await scanComponentFiles(componentsDir);
24
24
  print(`Found ${componentPaths.size} components`);
25
- const componentDataEntries = await Promise.all([...componentPaths].map(async ([name, filePath]) => {
26
- try {
27
- project.addSourceFileAtPath(filePath);
28
- const info = analyzeComponent(project, filePath);
29
- return info ? [name, serializeComponentInfo(info)] : null;
30
- } catch (error) {
31
- console.warn(`Warning: Could not analyze ${name}:`, error);
32
- return null;
33
- }
34
- }));
35
- const componentData = Object.fromEntries(componentDataEntries.filter((entry) => Boolean(entry)));
25
+ const componentData = {};
26
+ for (const [name, filePath] of componentPaths) try {
27
+ project.addSourceFileAtPath(filePath);
28
+ const info = analyzeComponent(project, filePath);
29
+ if (info) componentData[name] = serializeComponentInfo(info);
30
+ } catch (error) {
31
+ console.warn(`Warning: Could not analyze ${name}:`, error);
32
+ }
36
33
  writeFileSync(outputFile, JSON.stringify(componentData, null, 2));
37
34
  print(`Generated component data for ${Object.keys(componentData).length} components`);
38
35
  print(`Output written to: ${outputFile}`);
39
- const totals = Object.values(componentData).reduce((acc, comp) => ({
40
- totalDefaults: acc.totalDefaults + Object.keys(comp.defaultProps).length,
41
- totalLiterals: acc.totalLiterals + Object.keys(comp.getStylesLiterals).length,
42
- totalInternalComponents: acc.totalInternalComponents + comp.internalComponents.length
43
- }), {
44
- totalDefaults: 0,
45
- totalLiterals: 0,
46
- totalInternalComponents: 0
47
- });
36
+ let totalDefaults = 0;
37
+ let totalLiterals = 0;
38
+ let totalInternalComponents = 0;
39
+ for (const comp of Object.values(componentData)) {
40
+ totalDefaults += Object.keys(comp.defaultProps).length;
41
+ totalLiterals += Object.keys(comp.getStylesLiterals).length;
42
+ totalInternalComponents += comp.internalComponents.length;
43
+ }
48
44
  print("\nStats:");
49
- print(` Default props: ${totals.totalDefaults}`);
50
- print(` getStyles literals: ${totals.totalLiterals}`);
51
- print(` Internal component refs: ${totals.totalInternalComponents}`);
45
+ print(` Default props: ${totalDefaults}`);
46
+ print(` getStyles literals: ${totalLiterals}`);
47
+ print(` Internal component refs: ${totalInternalComponents}`);
52
48
  }
53
49
  });
54
- const serializeComponentInfo = (info) => ({
55
- name: info.name,
56
- defaultProps: Object.fromEntries(info.defaultProps),
57
- getStylesLiterals: Object.fromEntries(info.getStylesLiterals),
58
- cxLiterals: info.cxLiterals,
59
- internalComponents: info.internalComponents,
60
- internalComponentProps: Object.fromEntries(Array.from(info.internalComponentProps.entries()).map(([key, propsMap]) => [key, Object.fromEntries(propsMap)])),
61
- propToVariantKeys: Object.fromEntries(info.propToVariantKeys),
62
- motionVarPrefixes: info.motionVarPrefixes
63
- });
50
+ function serializeComponentInfo(info) {
51
+ return {
52
+ name: info.name,
53
+ defaultProps: Object.fromEntries(info.defaultProps),
54
+ getStylesLiterals: Object.fromEntries(info.getStylesLiterals),
55
+ cxLiterals: info.cxLiterals,
56
+ internalComponents: info.internalComponents,
57
+ internalComponentProps: Object.fromEntries(Array.from(info.internalComponentProps.entries()).map(([key, propsMap]) => [key, Object.fromEntries(propsMap)])),
58
+ propToVariantKeys: Object.fromEntries(info.propToVariantKeys),
59
+ motionVarPrefixes: info.motionVarPrefixes
60
+ };
61
+ }
64
62
 
65
63
  //#endregion
66
64
  export { makeGenerateComponentDataCommand };
@@ -1,3 +1,3 @@
1
1
 
2
2
  import { Project } from "ts-morph";
3
- import { Command } from "@yahoo/uds-cli/lib";
3
+ import { Command } from "@yahoo/uds-cli";
@@ -1,8 +1,9 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
+ const require_analytics = require('../../../cli/dist/utils/analytics.cjs');
2
3
  const require_print = require('../../../cli/dist/lib/print.cjs');
3
4
  const require_spinner = require('../../../cli/dist/lib/spinner.cjs');
4
- const require_purge = require('../purger/optimized/purge.cjs');
5
5
  const require_purgeCSS = require('../purger/legacy/purgeCSS.cjs');
6
+ const require_purge = require('../purger/optimized/purge.cjs');
6
7
 
7
8
  //#region ../tailwind/dist/commands/purge.js
8
9
  /*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
@@ -27,7 +28,7 @@ const makePurgeCommand = (getContext) => ({
27
28
  require_print.print(` Files scanned: ${result.stats.filesScanned}`);
28
29
  require_print.print(` Spreads traced: ${result.stats.spreadsTraced}`);
29
30
  require_print.print(` Expressions resolved: ${result.stats.expressionsResolved}`);
30
- return;
31
+ return await require_analytics.trackEvent("purge", { optimized: true });
31
32
  } catch (error) {
32
33
  if (error instanceof Error) require_spinner.spinStop("❌", error.message);
33
34
  else require_spinner.spinStop("❌", "Purging css failed! Please reach out to #uds-ask channel for support.");
@@ -42,7 +43,7 @@ const makePurgeCommand = (getContext) => ({
42
43
  output: typeof output === "string" ? output : void 0
43
44
  });
44
45
  require_spinner.spinStop("✅", "Purging css done!");
45
- return;
46
+ return await require_analytics.trackEvent("purge");
46
47
  } catch (error) {
47
48
  if (error instanceof Error) require_spinner.spinStop("❌", error.message);
48
49
  else require_spinner.spinStop("❌", "Purging css failed! Please reach out to #uds-ask channel for support.");
@@ -1,4 +1,4 @@
1
1
 
2
2
  import "./generateComponentData.js";
3
3
  import "../purger/legacy/purgeCSS.js";
4
- import { Command } from "@yahoo/uds-cli/lib";
4
+ import { Command } from "@yahoo/uds-cli";
@@ -1,8 +1,9 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
+ import { trackEvent } from "../../../cli/dist/utils/analytics.js";
2
3
  import { print } from "../../../cli/dist/lib/print.js";
3
4
  import { spinStart, spinStop } from "../../../cli/dist/lib/spinner.js";
4
- import { purgeOptimized } from "../purger/optimized/purge.js";
5
5
  import { purge } from "../purger/legacy/purgeCSS.js";
6
+ import { purgeOptimized } from "../purger/optimized/purge.js";
6
7
 
7
8
  //#region ../tailwind/dist/commands/purge.js
8
9
  /*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
@@ -27,7 +28,7 @@ const makePurgeCommand = (getContext) => ({
27
28
  print(` Files scanned: ${result.stats.filesScanned}`);
28
29
  print(` Spreads traced: ${result.stats.spreadsTraced}`);
29
30
  print(` Expressions resolved: ${result.stats.expressionsResolved}`);
30
- return;
31
+ return await trackEvent("purge", { optimized: true });
31
32
  } catch (error) {
32
33
  if (error instanceof Error) spinStop("❌", error.message);
33
34
  else spinStop("❌", "Purging css failed! Please reach out to #uds-ask channel for support.");
@@ -42,7 +43,7 @@ const makePurgeCommand = (getContext) => ({
42
43
  output: typeof output === "string" ? output : void 0
43
44
  });
44
45
  spinStop("✅", "Purging css done!");
45
- return;
46
+ return await trackEvent("purge");
46
47
  } catch (error) {
47
48
  if (error instanceof Error) spinStop("❌", error.message);
48
49
  else spinStop("❌", "Purging css failed! Please reach out to #uds-ask channel for support.");
@@ -1,4 +1,3 @@
1
1
 
2
- import { defineTheme } from "./css/theme.cjs";
3
2
  import "./tailwind/components/getResponsiveTextStyles.cjs";
4
3
  import { WebTokens, parseTokens } from "./utils/parseTokens.cjs";
@@ -1,8 +1,6 @@
1
1
 
2
+ import "./tailwind/components/getResponsiveTextStyles.js";
3
+ import { WebTokens, parseTokens } from "./utils/parseTokens.js";
2
4
  import "./commands/generateComponentData.js";
3
- import "./commands/css.js";
4
5
  import "./commands/generatePurgeCSSData.js";
5
- import "./commands/purge.js";
6
- import { defineTheme } from "./css/theme.js";
7
- import "./tailwind/components/getResponsiveTextStyles.js";
8
- import { WebTokens, parseTokens } from "./utils/parseTokens.js";
6
+ import "./commands/purge.js";
@@ -4,10 +4,10 @@ const require_index = require('../../../../css-tokens/dist/index.cjs');
4
4
  const require_print = require('../../../../cli/dist/lib/print.cjs');
5
5
  const require_spinner = require('../../../../cli/dist/lib/spinner.cjs');
6
6
  const require_tsMorph = require('../../utils/tsMorph.cjs');
7
- let ts_morph = require("ts-morph");
8
- let node_fs = require("node:fs");
9
7
  let node_path = require("node:path");
10
8
  node_path = require_runtime.__toESM(node_path);
9
+ let node_fs = require("node:fs");
10
+ let ts_morph = require("ts-morph");
11
11
  let fast_glob = require("fast-glob");
12
12
  fast_glob = require_runtime.__toESM(fast_glob);
13
13
 
@@ -32,8 +32,7 @@ const getFiles = async (entry) => {
32
32
  if (!workspaceDir) throw new Error("Workspace directory not found.");
33
33
  return await (0, fast_glob.default)(["**/*.jsx", "**/*.tsx"], {
34
34
  cwd: node_path.default.join(workspaceDir, entry),
35
- absolute: true,
36
- ignore: ["**/node_modules/**"]
35
+ absolute: true
37
36
  });
38
37
  } catch {
39
38
  throw new Error(`Couldn't find the entry directory: ${entry}. Please make sure it exists.`);
@@ -3,9 +3,9 @@ import { DARK_COLOR_MODE_CLASSNAME, LARGE_SCALE_MODE_CLASSNAME, LIGHT_COLOR_MODE
3
3
  import { print } from "../../../../cli/dist/lib/print.js";
4
4
  import { spinStart, spinStop } from "../../../../cli/dist/lib/spinner.js";
5
5
  import { findReferencesAsJsxElements, getUsedPropsInReference } from "../../utils/tsMorph.js";
6
- import { Node, Project, SyntaxKind, ts } from "ts-morph";
7
- import { mkdirSync, writeFileSync } from "node:fs";
8
6
  import path from "node:path";
7
+ import { mkdirSync, writeFileSync } from "node:fs";
8
+ import { Node, Project, SyntaxKind, ts } from "ts-morph";
9
9
  import fg from "fast-glob";
10
10
 
11
11
  //#region ../tailwind/dist/purger/legacy/purgeCSS.js
@@ -29,8 +29,7 @@ const getFiles = async (entry) => {
29
29
  if (!workspaceDir) throw new Error("Workspace directory not found.");
30
30
  return await fg(["**/*.jsx", "**/*.tsx"], {
31
31
  cwd: path.join(workspaceDir, entry),
32
- absolute: true,
33
- ignore: ["**/node_modules/**"]
32
+ absolute: true
34
33
  });
35
34
  } catch {
36
35
  throw new Error(`Couldn't find the entry directory: ${entry}. Please make sure it exists.`);
@@ -20,171 +20,174 @@ let ts_morph = require("ts-morph");
20
20
  * @param visited Set of visited nodes to prevent infinite recursion
21
21
  * @returns Array of extracted string literal values
22
22
  */
23
- const extractStringLiterals = (node, visited = /* @__PURE__ */ new Set()) => {
23
+ function extractStringLiterals(node, visited = /* @__PURE__ */ new Set()) {
24
24
  if (visited.has(node)) return [];
25
25
  visited.add(node);
26
- const directValues = extractDirectLiteralValues(node);
27
- if (directValues) return directValues;
28
- const templateValues = extractTemplateExpressionValues(node, visited);
29
- if (templateValues) return templateValues;
30
- if (ts_morph.Node.isConditionalExpression(node)) return [...extractStringLiterals(node.getWhenTrue(), visited), ...extractStringLiterals(node.getWhenFalse(), visited)];
31
- const binaryValues = extractBinaryExpressionValues(node, visited);
32
- if (binaryValues) return binaryValues;
33
- const wrappedExpressionValues = extractWrappedExpressionValues(node, visited);
34
- if (wrappedExpressionValues) return wrappedExpressionValues;
35
- const propertyAccessValues = extractPropertyAccessValues(node, visited);
36
- if (propertyAccessValues) return propertyAccessValues;
37
- const elementAccessValues = extractElementAccessValues(node);
38
- if (elementAccessValues) return elementAccessValues;
39
- const callExpressionValues = extractCallExpressionValues(node, visited);
40
- if (callExpressionValues) return callExpressionValues;
41
- const identifierValues = extractIdentifierValues(node, visited);
42
- if (identifierValues) return identifierValues;
43
- return [];
44
- };
45
- const extractDirectLiteralValues = (node) => {
46
- if (ts_morph.Node.isStringLiteral(node) || ts_morph.Node.isNoSubstitutionTemplateLiteral(node)) return [node.getLiteralValue()];
47
- return null;
48
- };
49
- const extractTemplateExpressionValues = (node, visited) => {
50
- if (!ts_morph.Node.isTemplateExpression(node)) return null;
51
- const parts = [[node.getHead().getLiteralText()]];
52
- node.getTemplateSpans().forEach((span) => {
53
- const exprValues = extractStringLiterals(span.getExpression(), visited);
54
- const literalText = span.getLiteral().getLiteralText();
55
- parts.push(exprValues.length > 0 ? exprValues.map((value) => `${value}${literalText}`) : ["", literalText]);
56
- });
57
- return parts.reduce((acc, segment) => acc.flatMap((base) => segment.map((frag) => `${base}${frag}`)), [""]).filter((value) => value.length > 0);
58
- };
59
- const extractBinaryExpressionValues = (node, visited) => {
60
- if (!ts_morph.Node.isBinaryExpression(node)) return null;
61
- const operator = node.getOperatorToken().getText();
62
- if (operator === "+") {
63
- const left = extractStringLiterals(node.getLeft(), visited);
64
- const right = extractStringLiterals(node.getRight(), visited);
65
- const combined = left.flatMap((l) => right.map((r) => `${l}${r}`));
66
- return combined.length > 0 ? combined : [];
26
+ const values = [];
27
+ if (ts_morph.Node.isStringLiteral(node)) {
28
+ values.push(node.getLiteralValue());
29
+ return values;
67
30
  }
68
- if (operator === "||" || operator === "??") return [...extractStringLiterals(node.getLeft(), visited), ...extractStringLiterals(node.getRight(), visited)];
69
- return [];
70
- };
71
- const extractWrappedExpressionValues = (node, visited) => {
72
- if (ts_morph.Node.isParenthesizedExpression(node) || ts_morph.Node.isAsExpression(node)) return extractStringLiterals(node.getExpression(), visited);
73
- return null;
74
- };
75
- const extractPropertyAccessValues = (node, visited) => {
76
- if (!ts_morph.Node.isPropertyAccessExpression(node)) return null;
77
- const typeValues = extractLiteralValuesFromType(node);
78
- if (typeValues.length > 0) return typeValues;
79
- const propertyName = node.getName();
80
- return extractObjectValues(node.getExpression(), visited).filter((value) => typeof value === "object" && value !== null && propertyName in value).map((value) => value[propertyName]).filter((value) => typeof value === "string");
81
- };
82
- const extractElementAccessValues = (node) => {
83
- if (!ts_morph.Node.isElementAccessExpression(node)) return null;
84
- return extractLiteralValuesFromType(node);
85
- };
86
- const extractCallExpressionValues = (node, visited) => {
87
- if (!ts_morph.Node.isCallExpression(node)) return null;
88
- const expression = node.getExpression();
89
- const fromDefinitions = ts_morph.Node.isIdentifier(expression) ? expression.getDefinitionNodes().flatMap((definition) => {
90
- if (ts_morph.Node.isFunctionDeclaration(definition)) return definition.getDescendantsOfKind(ts_morph.SyntaxKind.ReturnStatement).flatMap((returnStmt) => {
91
- const expression = returnStmt.getExpression();
92
- return expression ? extractStringLiterals(expression, visited) : [];
93
- });
94
- if (ts_morph.Node.isVariableDeclaration(definition)) {
95
- const initializer = definition.getInitializer();
96
- return initializer ? extractFromFunctionLike(initializer, visited) : [];
31
+ if (ts_morph.Node.isNoSubstitutionTemplateLiteral(node)) {
32
+ values.push(node.getLiteralValue());
33
+ return values;
34
+ }
35
+ if (ts_morph.Node.isConditionalExpression(node)) {
36
+ values.push(...extractStringLiterals(node.getWhenTrue(), visited));
37
+ values.push(...extractStringLiterals(node.getWhenFalse(), visited));
38
+ return values;
39
+ }
40
+ if (ts_morph.Node.isBinaryExpression(node)) {
41
+ const op = node.getOperatorToken().getText();
42
+ if (op === "||" || op === "??") {
43
+ values.push(...extractStringLiterals(node.getLeft(), visited));
44
+ values.push(...extractStringLiterals(node.getRight(), visited));
45
+ return values;
97
46
  }
98
- return [];
99
- }) : [];
100
- const fromArguments = node.getArguments().flatMap((arg) => extractStringLiterals(arg, visited));
101
- return [...fromDefinitions, ...fromArguments];
102
- };
103
- const extractIdentifierValues = (node, visited) => {
104
- if (!ts_morph.Node.isIdentifier(node)) return null;
105
- const values = node.getDefinitionNodes().flatMap((definition) => {
106
- if (ts_morph.Node.isVariableDeclaration(definition) || ts_morph.Node.isParameterDeclaration(definition) || ts_morph.Node.isBindingElement(definition)) {
107
- const initializer = definition.getInitializer();
108
- return initializer ? extractStringLiterals(initializer, visited) : [];
47
+ }
48
+ if (ts_morph.Node.isParenthesizedExpression(node)) {
49
+ values.push(...extractStringLiterals(node.getExpression(), visited));
50
+ return values;
51
+ }
52
+ if (ts_morph.Node.isAsExpression(node)) {
53
+ values.push(...extractStringLiterals(node.getExpression(), visited));
54
+ return values;
55
+ }
56
+ if (ts_morph.Node.isPropertyAccessExpression(node)) {
57
+ const typeValues = extractLiteralValuesFromType(node);
58
+ if (typeValues.length > 0) {
59
+ values.push(...typeValues);
60
+ return values;
109
61
  }
110
- return [];
111
- });
112
- return values.length > 0 ? values : extractLiteralValuesFromType(node);
113
- };
62
+ const expression = node.getExpression();
63
+ const propertyName = node.getName();
64
+ const baseValues = extractObjectValues(expression, visited);
65
+ for (const objValue of baseValues) if (typeof objValue === "object" && objValue !== null && propertyName in objValue) {
66
+ const propValue = objValue[propertyName];
67
+ if (typeof propValue === "string") values.push(propValue);
68
+ }
69
+ return values;
70
+ }
71
+ if (ts_morph.Node.isElementAccessExpression(node)) {
72
+ const typeValues = extractLiteralValuesFromType(node);
73
+ if (typeValues.length > 0) {
74
+ values.push(...typeValues);
75
+ return values;
76
+ }
77
+ return values;
78
+ }
79
+ if (ts_morph.Node.isCallExpression(node)) {
80
+ const expression = node.getExpression();
81
+ if (ts_morph.Node.isIdentifier(expression)) for (const definition of expression.getDefinitionNodes()) {
82
+ if (ts_morph.Node.isFunctionDeclaration(definition)) for (const returnStmt of definition.getDescendantsOfKind(ts_morph.SyntaxKind.ReturnStatement)) {
83
+ const returnExpr = returnStmt.getExpression();
84
+ if (returnExpr) values.push(...extractStringLiterals(returnExpr, visited));
85
+ }
86
+ if (ts_morph.Node.isVariableDeclaration(definition)) {
87
+ const initializer = definition.getInitializer();
88
+ if (initializer) values.push(...extractFromFunctionLike(initializer, visited));
89
+ }
90
+ }
91
+ return values;
92
+ }
93
+ if (ts_morph.Node.isIdentifier(node)) {
94
+ let foundInitializer = false;
95
+ for (const definition of node.getDefinitionNodes()) {
96
+ if (ts_morph.Node.isVariableDeclaration(definition)) {
97
+ const initializer = definition.getInitializer();
98
+ if (initializer) {
99
+ foundInitializer = true;
100
+ values.push(...extractStringLiterals(initializer, visited));
101
+ }
102
+ }
103
+ if (ts_morph.Node.isParameterDeclaration(definition)) {
104
+ const initializer = definition.getInitializer();
105
+ if (initializer) {
106
+ foundInitializer = true;
107
+ values.push(...extractStringLiterals(initializer, visited));
108
+ }
109
+ }
110
+ if (ts_morph.Node.isBindingElement(definition)) {
111
+ const initializer = definition.getInitializer();
112
+ if (initializer) {
113
+ foundInitializer = true;
114
+ values.push(...extractStringLiterals(initializer, visited));
115
+ }
116
+ }
117
+ }
118
+ if (!foundInitializer && values.length === 0) values.push(...extractLiteralValuesFromType(node));
119
+ return values;
120
+ }
121
+ return values;
122
+ }
114
123
  /**
115
124
  * Extract string literals from arrow functions or function expressions
116
125
  */
117
- const extractFromFunctionLike = (node, visited) => {
126
+ function extractFromFunctionLike(node, visited) {
118
127
  const values = [];
119
128
  if (ts_morph.Node.isArrowFunction(node)) {
120
129
  const body = node.getBody();
121
- if (ts_morph.Node.isBlock(body)) body.getDescendantsOfKind(ts_morph.SyntaxKind.ReturnStatement).forEach((returnStmt) => {
130
+ if (ts_morph.Node.isBlock(body)) for (const returnStmt of body.getDescendantsOfKind(ts_morph.SyntaxKind.ReturnStatement)) {
122
131
  const returnExpr = returnStmt.getExpression();
123
132
  if (returnExpr) values.push(...extractStringLiterals(returnExpr, visited));
124
- });
133
+ }
125
134
  else values.push(...extractStringLiterals(body, visited));
126
- } else if (ts_morph.Node.isFunctionExpression(node)) node.getDescendantsOfKind(ts_morph.SyntaxKind.ReturnStatement).forEach((returnStmt) => {
135
+ } else if (ts_morph.Node.isFunctionExpression(node)) for (const returnStmt of node.getDescendantsOfKind(ts_morph.SyntaxKind.ReturnStatement)) {
127
136
  const returnExpr = returnStmt.getExpression();
128
137
  if (returnExpr) values.push(...extractStringLiterals(returnExpr, visited));
129
- });
138
+ }
130
139
  return values;
131
- };
140
+ }
132
141
  /**
133
142
  * Extract object literal values from an expression.
134
143
  * Returns an array of all possible object values (for union types or indexed access).
135
144
  */
136
- const extractObjectValues = (node, visited) => {
145
+ function extractObjectValues(node, visited) {
137
146
  if (visited.has(node)) return [];
138
147
  visited.add(node);
139
148
  const values = [];
140
149
  if (ts_morph.Node.isObjectLiteralExpression(node)) {
141
150
  const obj = {};
142
- node.getProperties().forEach((prop) => {
143
- if (ts_morph.Node.isPropertyAssignment(prop)) {
144
- const name = prop.getName();
145
- const init = prop.getInitializer();
146
- if (init && ts_morph.Node.isStringLiteral(init)) obj[name] = init.getLiteralValue();
147
- else if (init && ts_morph.Node.isObjectLiteralExpression(init)) {
148
- const nestedValues = extractObjectValues(init, visited);
149
- if (nestedValues.length > 0) obj[name] = nestedValues[0];
150
- }
151
+ for (const prop of node.getProperties()) if (ts_morph.Node.isPropertyAssignment(prop)) {
152
+ const name = prop.getName();
153
+ const init = prop.getInitializer();
154
+ if (init && ts_morph.Node.isStringLiteral(init)) obj[name] = init.getLiteralValue();
155
+ else if (init && ts_morph.Node.isObjectLiteralExpression(init)) {
156
+ const nestedValues = extractObjectValues(init, visited);
157
+ if (nestedValues.length > 0) obj[name] = nestedValues[0];
151
158
  }
152
- });
159
+ }
153
160
  values.push(obj);
154
161
  return values;
155
162
  }
156
163
  if (ts_morph.Node.isIdentifier(node)) {
157
- node.getDefinitionNodes().forEach((definition) => {
158
- if (ts_morph.Node.isVariableDeclaration(definition)) {
159
- const initializer = definition.getInitializer();
160
- if (initializer) if (ts_morph.Node.isAsExpression(initializer)) {
161
- const inner = initializer.getExpression();
162
- values.push(...extractObjectValues(inner, visited));
163
- } else values.push(...extractObjectValues(initializer, visited));
164
- }
165
- });
164
+ for (const definition of node.getDefinitionNodes()) if (ts_morph.Node.isVariableDeclaration(definition)) {
165
+ const initializer = definition.getInitializer();
166
+ if (initializer) if (ts_morph.Node.isAsExpression(initializer)) {
167
+ const inner = initializer.getExpression();
168
+ values.push(...extractObjectValues(inner, visited));
169
+ } else values.push(...extractObjectValues(initializer, visited));
170
+ }
166
171
  return values;
167
172
  }
168
173
  if (ts_morph.Node.isElementAccessExpression(node)) {
169
- extractObjectValues(node.getExpression(), visited).forEach((obj) => {
170
- if (typeof obj === "object" && obj !== null) Object.values(obj).forEach((value) => values.push(value));
171
- });
174
+ const baseObjects = extractObjectValues(node.getExpression(), visited);
175
+ for (const obj of baseObjects) if (typeof obj === "object" && obj !== null) for (const value of Object.values(obj)) values.push(value);
172
176
  return values;
173
177
  }
174
178
  return values;
175
- };
179
+ }
176
180
  /**
177
181
  * Extract literal values from a TypeScript type (for union types like 'brand' | 'secondary')
178
182
  */
179
- const extractLiteralValuesFromType = (node) => {
183
+ function extractLiteralValuesFromType(node) {
180
184
  const values = [];
181
185
  const nodeType = node.getType();
182
- if (nodeType.isUnion()) nodeType.getUnionTypes().forEach((unionMember) => {
183
- if (unionMember.isStringLiteral()) values.push(unionMember.getLiteralValue());
184
- });
185
- else if (nodeType.isStringLiteral()) values.push(nodeType.getLiteralValue());
186
+ if (nodeType.isUnion()) {
187
+ for (const unionMember of nodeType.getUnionTypes()) if (unionMember.isStringLiteral()) values.push(unionMember.getLiteralValue());
188
+ } else if (nodeType.isStringLiteral()) values.push(nodeType.getLiteralValue());
186
189
  return values;
187
- };
190
+ }
188
191
 
189
192
  //#endregion
190
193
  exports.extractStringLiterals = extractStringLiterals;