@superblocksteam/vite-plugin-file-sync 2.0.55 → 2.0.56-next.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 (369) hide show
  1. package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts.map +1 -1
  2. package/dist/ai-service/agent/prompts/build-base-system-prompt.js +394 -2303
  3. package/dist/ai-service/agent/prompts/build-base-system-prompt.js.map +1 -1
  4. package/dist/ai-service/agent/subagents/apis/examples.d.ts.map +1 -1
  5. package/dist/ai-service/agent/subagents/apis/examples.js +34 -35
  6. package/dist/ai-service/agent/subagents/apis/examples.js.map +1 -1
  7. package/dist/ai-service/agent/subagents/apis/generate-api-source.d.ts +2 -8
  8. package/dist/ai-service/agent/subagents/apis/generate-api-source.d.ts.map +1 -1
  9. package/dist/ai-service/agent/subagents/apis/generate-api-source.js +17 -46
  10. package/dist/ai-service/agent/subagents/apis/generate-api-source.js.map +1 -1
  11. package/dist/ai-service/agent/subagents/apis/prompt-builder.d.ts +0 -1
  12. package/dist/ai-service/agent/subagents/apis/prompt-builder.d.ts.map +1 -1
  13. package/dist/ai-service/agent/subagents/apis/prompt-builder.js +4 -25
  14. package/dist/ai-service/agent/subagents/apis/prompt-builder.js.map +1 -1
  15. package/dist/ai-service/agent/subagents/apis/state.js +1 -1
  16. package/dist/ai-service/agent/subagents/apis/state.js.map +1 -1
  17. package/dist/ai-service/agent/subagents/apis/system-prompt.d.ts +1 -1
  18. package/dist/ai-service/agent/subagents/apis/system-prompt.d.ts.map +1 -1
  19. package/dist/ai-service/agent/subagents/apis/system-prompt.js +134 -173
  20. package/dist/ai-service/agent/subagents/apis/system-prompt.js.map +1 -1
  21. package/dist/ai-service/agent/subagents/apis/types.d.ts +1 -4
  22. package/dist/ai-service/agent/subagents/apis/types.d.ts.map +1 -1
  23. package/dist/ai-service/agent/tool-message-utils.d.ts.map +1 -1
  24. package/dist/ai-service/agent/tool-message-utils.js +14 -31
  25. package/dist/ai-service/agent/tool-message-utils.js.map +1 -1
  26. package/dist/ai-service/agent/tools/apis/build-api.d.ts +1 -6
  27. package/dist/ai-service/agent/tools/apis/build-api.d.ts.map +1 -1
  28. package/dist/ai-service/agent/tools/apis/build-api.js +12 -21
  29. package/dist/ai-service/agent/tools/apis/build-api.js.map +1 -1
  30. package/dist/ai-service/agent/tools/apis/finalize-api.d.ts +2 -6
  31. package/dist/ai-service/agent/tools/apis/finalize-api.d.ts.map +1 -1
  32. package/dist/ai-service/agent/tools/apis/finalize-api.js +29 -20
  33. package/dist/ai-service/agent/tools/apis/finalize-api.js.map +1 -1
  34. package/dist/ai-service/agent/tools/build-edit-file.d.ts.map +1 -1
  35. package/dist/ai-service/agent/tools/build-edit-file.js +4 -9
  36. package/dist/ai-service/agent/tools/build-edit-file.js.map +1 -1
  37. package/dist/ai-service/agent/tools/build-install-packages.d.ts +7 -1
  38. package/dist/ai-service/agent/tools/build-install-packages.d.ts.map +1 -1
  39. package/dist/ai-service/agent/tools/build-install-packages.js +43 -8
  40. package/dist/ai-service/agent/tools/build-install-packages.js.map +1 -1
  41. package/dist/ai-service/agent/tools/build-manage-checklist.d.ts +1 -1
  42. package/dist/ai-service/agent/tools/build-multi-edit-file.d.ts.map +1 -1
  43. package/dist/ai-service/agent/tools/build-multi-edit-file.js +7 -9
  44. package/dist/ai-service/agent/tools/build-multi-edit-file.js.map +1 -1
  45. package/dist/ai-service/agent/tools/build-read-files.d.ts +2 -0
  46. package/dist/ai-service/agent/tools/build-read-files.d.ts.map +1 -1
  47. package/dist/ai-service/agent/tools/build-read-files.js +18 -18
  48. package/dist/ai-service/agent/tools/build-read-files.js.map +1 -1
  49. package/dist/ai-service/agent/tools/build-rename-file.d.ts +11 -0
  50. package/dist/ai-service/agent/tools/build-rename-file.d.ts.map +1 -0
  51. package/dist/ai-service/agent/tools/build-rename-file.js +103 -0
  52. package/dist/ai-service/agent/tools/build-rename-file.js.map +1 -0
  53. package/dist/ai-service/agent/tools/build-validate-icons.d.ts +0 -1
  54. package/dist/ai-service/agent/tools/build-validate-icons.d.ts.map +1 -1
  55. package/dist/ai-service/agent/tools/build-validate-icons.js +0 -6
  56. package/dist/ai-service/agent/tools/build-validate-icons.js.map +1 -1
  57. package/dist/ai-service/agent/tools/build-write-file.d.ts.map +1 -1
  58. package/dist/ai-service/agent/tools/build-write-file.js +5 -6
  59. package/dist/ai-service/agent/tools/build-write-file.js.map +1 -1
  60. package/dist/ai-service/agent/tools/index.d.ts +0 -10
  61. package/dist/ai-service/agent/tools/index.d.ts.map +1 -1
  62. package/dist/ai-service/agent/tools/index.js +0 -10
  63. package/dist/ai-service/agent/tools/index.js.map +1 -1
  64. package/dist/ai-service/agent/tools/shared-helpers.d.ts +1 -7
  65. package/dist/ai-service/agent/tools/shared-helpers.d.ts.map +1 -1
  66. package/dist/ai-service/agent/tools/shared-helpers.js +9 -29
  67. package/dist/ai-service/agent/tools/shared-helpers.js.map +1 -1
  68. package/dist/ai-service/agent/tools.d.ts.map +1 -1
  69. package/dist/ai-service/agent/tools.js +5 -11
  70. package/dist/ai-service/agent/tools.js.map +1 -1
  71. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts +1 -2
  72. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts.map +1 -1
  73. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js +89 -67
  74. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js.map +1 -1
  75. package/dist/ai-service/agent/tools2/tools/explain-code-finalize.d.ts +4 -0
  76. package/dist/ai-service/agent/tools2/tools/explain-code-finalize.d.ts.map +1 -0
  77. package/dist/ai-service/agent/tools2/tools/explain-code-finalize.js +19 -0
  78. package/dist/ai-service/agent/tools2/tools/explain-code-finalize.js.map +1 -0
  79. package/dist/ai-service/agent/tools2/tools/glob.d.ts.map +1 -1
  80. package/dist/ai-service/agent/tools2/tools/glob.js +15 -6
  81. package/dist/ai-service/agent/tools2/tools/glob.js.map +1 -1
  82. package/dist/ai-service/agent/tools2/tools/grep-metadata.d.ts +13 -0
  83. package/dist/ai-service/agent/tools2/tools/grep-metadata.d.ts.map +1 -1
  84. package/dist/ai-service/agent/tools2/tools/grep-metadata.js +21 -0
  85. package/dist/ai-service/agent/tools2/tools/grep-metadata.js.map +1 -1
  86. package/dist/ai-service/agent/tools2/tools/index.d.ts +1 -0
  87. package/dist/ai-service/agent/tools2/tools/index.d.ts.map +1 -1
  88. package/dist/ai-service/agent/tools2/tools/index.js +1 -0
  89. package/dist/ai-service/agent/tools2/tools/index.js.map +1 -1
  90. package/dist/ai-service/agent/tools2/tools/ls.d.ts +10 -0
  91. package/dist/ai-service/agent/tools2/tools/ls.d.ts.map +1 -0
  92. package/dist/ai-service/agent/tools2/tools/ls.js +71 -0
  93. package/dist/ai-service/agent/tools2/tools/ls.js.map +1 -0
  94. package/dist/ai-service/agent/utils.d.ts +0 -35
  95. package/dist/ai-service/agent/utils.d.ts.map +1 -1
  96. package/dist/ai-service/agent/utils.js +0 -132
  97. package/dist/ai-service/agent/utils.js.map +1 -1
  98. package/dist/ai-service/app-interface/file-system-interface.d.ts +1 -1
  99. package/dist/ai-service/app-interface/file-system-interface.d.ts.map +1 -1
  100. package/dist/ai-service/app-interface/file-system-interface.js +2 -2
  101. package/dist/ai-service/app-interface/file-system-interface.js.map +1 -1
  102. package/dist/ai-service/app-interface/shell.d.ts +5 -0
  103. package/dist/ai-service/app-interface/shell.d.ts.map +1 -1
  104. package/dist/ai-service/app-interface/shell.js +60 -0
  105. package/dist/ai-service/app-interface/shell.js.map +1 -1
  106. package/dist/ai-service/chat/chat-session-store.d.ts.map +1 -1
  107. package/dist/ai-service/chat/chat-session-store.js +8 -1
  108. package/dist/ai-service/chat/chat-session-store.js.map +1 -1
  109. package/dist/ai-service/clark-provider/clark-chat-settings.d.ts +2 -1
  110. package/dist/ai-service/clark-provider/clark-chat-settings.d.ts.map +1 -1
  111. package/dist/ai-service/clark-provider/clark-chat-settings.js +1 -0
  112. package/dist/ai-service/clark-provider/clark-chat-settings.js.map +1 -1
  113. package/dist/ai-service/const.d.ts +3 -7
  114. package/dist/ai-service/const.d.ts.map +1 -1
  115. package/dist/ai-service/const.js +2 -6
  116. package/dist/ai-service/const.js.map +1 -1
  117. package/dist/ai-service/context/app-context.d.ts +2 -1
  118. package/dist/ai-service/context/app-context.d.ts.map +1 -1
  119. package/dist/ai-service/context/app-context.js +9 -15
  120. package/dist/ai-service/context/app-context.js.map +1 -1
  121. package/dist/ai-service/index.d.ts +4 -4
  122. package/dist/ai-service/index.d.ts.map +1 -1
  123. package/dist/ai-service/index.js +168 -16
  124. package/dist/ai-service/index.js.map +1 -1
  125. package/dist/ai-service/llm/impl/anthropic.d.ts.map +1 -1
  126. package/dist/ai-service/llm/impl/anthropic.js +1 -0
  127. package/dist/ai-service/llm/impl/anthropic.js.map +1 -1
  128. package/dist/ai-service/llm/impl/clark.d.ts.map +1 -1
  129. package/dist/ai-service/llm/impl/clark.js +1 -0
  130. package/dist/ai-service/llm/impl/clark.js.map +1 -1
  131. package/dist/ai-service/llm/provider.d.ts.map +1 -1
  132. package/dist/ai-service/llm/provider.js +1 -0
  133. package/dist/ai-service/llm/provider.js.map +1 -1
  134. package/dist/ai-service/llm/types.d.ts +1 -1
  135. package/dist/ai-service/llm/types.d.ts.map +1 -1
  136. package/dist/ai-service/prompt-builder-service/types.d.ts +0 -2
  137. package/dist/ai-service/prompt-builder-service/types.d.ts.map +1 -1
  138. package/dist/ai-service/prompt-builder-service/types.js.map +1 -1
  139. package/dist/ai-service/prompts/explain-code.d.ts +7 -0
  140. package/dist/ai-service/prompts/explain-code.d.ts.map +1 -0
  141. package/dist/ai-service/prompts/explain-code.js +23 -0
  142. package/dist/ai-service/prompts/explain-code.js.map +1 -0
  143. package/dist/ai-service/state-machine/clark-fsm.d.ts +0 -2
  144. package/dist/ai-service/state-machine/clark-fsm.d.ts.map +1 -1
  145. package/dist/ai-service/state-machine/clark-fsm.js.map +1 -1
  146. package/dist/ai-service/state-machine/handlers/agent-planning.js +16 -16
  147. package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
  148. package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
  149. package/dist/ai-service/state-machine/handlers/llm-generating.js +39 -4
  150. package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
  151. package/dist/ai-service/state-machine/mocks.d.ts.map +1 -1
  152. package/dist/ai-service/state-machine/mocks.js +1 -0
  153. package/dist/ai-service/state-machine/mocks.js.map +1 -1
  154. package/dist/ai-service/test-utils/app-generation-mocks/orders-app.d.ts +1 -1
  155. package/dist/ai-service/test-utils/app-generation-mocks/orders-app.d.ts.map +1 -1
  156. package/dist/ai-service/test-utils/app-generation-mocks/orders-app.js +0 -7
  157. package/dist/ai-service/test-utils/app-generation-mocks/orders-app.js.map +1 -1
  158. package/dist/ai-service/test-utils/app-generation-mocks/smoketest.d.ts +1 -1
  159. package/dist/ai-service/test-utils/app-generation-mocks/smoketest.d.ts.map +1 -1
  160. package/dist/ai-service/test-utils/app-generation-mocks/smoketest.js +0 -8
  161. package/dist/ai-service/test-utils/app-generation-mocks/smoketest.js.map +1 -1
  162. package/dist/ai-service/transform/api-builder/to-sdk-transformer.d.ts.map +1 -1
  163. package/dist/ai-service/transform/api-builder/to-sdk-transformer.js +0 -15
  164. package/dist/ai-service/transform/api-builder/to-sdk-transformer.js.map +1 -1
  165. package/dist/ai-service/transform/api-builder/to-yaml-transformer.d.ts.map +1 -1
  166. package/dist/ai-service/transform/api-builder/to-yaml-transformer.js +0 -13
  167. package/dist/ai-service/transform/api-builder/to-yaml-transformer.js.map +1 -1
  168. package/dist/ai-service/types.d.ts +2 -2
  169. package/dist/ai-service/types.d.ts.map +1 -1
  170. package/dist/ai-service/util/json-stream-parser.d.ts +20 -0
  171. package/dist/ai-service/util/json-stream-parser.d.ts.map +1 -0
  172. package/dist/ai-service/util/json-stream-parser.js +139 -0
  173. package/dist/ai-service/util/json-stream-parser.js.map +1 -0
  174. package/dist/binding-extraction/extract-identifiers.d.ts +1 -5
  175. package/dist/binding-extraction/extract-identifiers.d.ts.map +1 -1
  176. package/dist/binding-extraction/extract-identifiers.js +78 -15
  177. package/dist/binding-extraction/extract-identifiers.js.map +1 -1
  178. package/dist/binding-extraction/index.d.ts +1 -1
  179. package/dist/binding-extraction/index.d.ts.map +1 -1
  180. package/dist/binding-extraction/index.js +1 -1
  181. package/dist/binding-extraction/index.js.map +1 -1
  182. package/dist/binding-extraction/{extract-js-identifiers.d.ts → js-identifiers.d.ts} +2 -1
  183. package/dist/binding-extraction/js-identifiers.d.ts.map +1 -0
  184. package/dist/binding-extraction/{extract-js-identifiers.js → js-identifiers.js} +81 -1
  185. package/dist/binding-extraction/js-identifiers.js.map +1 -0
  186. package/dist/binding-extraction/python-identifiers.d.ts +13 -0
  187. package/dist/binding-extraction/python-identifiers.d.ts.map +1 -0
  188. package/dist/binding-extraction/{extract-py-identifiers.js → python-identifiers.js} +155 -1
  189. package/dist/binding-extraction/python-identifiers.js.map +1 -0
  190. package/dist/codegen.d.ts.map +1 -1
  191. package/dist/codegen.js +9 -15
  192. package/dist/codegen.js.map +1 -1
  193. package/dist/components-manager.d.ts +12 -13
  194. package/dist/components-manager.d.ts.map +1 -1
  195. package/dist/components-manager.js +78 -139
  196. package/dist/components-manager.js.map +1 -1
  197. package/dist/file-sync-vite-plugin.d.ts +1 -1
  198. package/dist/file-sync-vite-plugin.d.ts.map +1 -1
  199. package/dist/file-sync-vite-plugin.js +164 -326
  200. package/dist/file-sync-vite-plugin.js.map +1 -1
  201. package/dist/file-system-helpers.d.ts +2 -2
  202. package/dist/file-system-helpers.d.ts.map +1 -1
  203. package/dist/file-system-helpers.js +6 -4
  204. package/dist/file-system-helpers.js.map +1 -1
  205. package/dist/file-system-manager.d.ts +7 -33
  206. package/dist/file-system-manager.d.ts.map +1 -1
  207. package/dist/file-system-manager.js +185 -594
  208. package/dist/file-system-manager.js.map +1 -1
  209. package/dist/index.d.ts +1 -1
  210. package/dist/index.d.ts.map +1 -1
  211. package/dist/index.js +0 -1
  212. package/dist/index.js.map +1 -1
  213. package/dist/inject-no-select.d.ts +15 -0
  214. package/dist/inject-no-select.d.ts.map +1 -0
  215. package/dist/inject-no-select.js +173 -0
  216. package/dist/inject-no-select.js.map +1 -0
  217. package/dist/injected-index.d.ts +0 -1
  218. package/dist/injected-index.d.ts.map +1 -1
  219. package/dist/injected-index.js +0 -1
  220. package/dist/injected-index.js.map +1 -1
  221. package/dist/lock-service/activity-tracker.d.ts.map +1 -1
  222. package/dist/lock-service/activity-tracker.js +4 -1
  223. package/dist/lock-service/activity-tracker.js.map +1 -1
  224. package/dist/parsing/entity/to-code-entity.d.ts.map +1 -1
  225. package/dist/parsing/entity/to-code-entity.js +3 -4
  226. package/dist/parsing/entity/to-code-entity.js.map +1 -1
  227. package/dist/parsing/entity/to-value-entity.d.ts.map +1 -1
  228. package/dist/parsing/entity/to-value-entity.js +19 -13
  229. package/dist/parsing/entity/to-value-entity.js.map +1 -1
  230. package/dist/parsing/ids.d.ts +0 -1
  231. package/dist/parsing/ids.d.ts.map +1 -1
  232. package/dist/parsing/ids.js +3 -4
  233. package/dist/parsing/ids.js.map +1 -1
  234. package/dist/parsing/imports.d.ts.map +1 -1
  235. package/dist/parsing/imports.js +0 -10
  236. package/dist/parsing/imports.js.map +1 -1
  237. package/dist/parsing/index.d.ts +0 -1
  238. package/dist/parsing/index.d.ts.map +1 -1
  239. package/dist/parsing/index.js +0 -1
  240. package/dist/parsing/index.js.map +1 -1
  241. package/dist/parsing/jsx.d.ts.map +1 -1
  242. package/dist/parsing/jsx.js +50 -22
  243. package/dist/parsing/jsx.js.map +1 -1
  244. package/dist/parsing/page.d.ts +0 -1
  245. package/dist/parsing/page.d.ts.map +1 -1
  246. package/dist/parsing/page.js +55 -32
  247. package/dist/parsing/page.js.map +1 -1
  248. package/dist/parsing/properties.d.ts.map +1 -1
  249. package/dist/parsing/properties.js +45 -15
  250. package/dist/parsing/properties.js.map +1 -1
  251. package/dist/parsing/template/index.js +1 -1
  252. package/dist/parsing/template/index.js.map +1 -1
  253. package/dist/parsing/template/to-code-template.d.ts +1 -2
  254. package/dist/parsing/template/to-code-template.d.ts.map +1 -1
  255. package/dist/parsing/template/to-code-template.js +2 -3
  256. package/dist/parsing/template/to-code-template.js.map +1 -1
  257. package/dist/parsing/type-parsing-registry.d.ts +0 -1
  258. package/dist/parsing/type-parsing-registry.d.ts.map +1 -1
  259. package/dist/parsing/type-parsing-registry.js +0 -2
  260. package/dist/parsing/type-parsing-registry.js.map +1 -1
  261. package/dist/parsing/util.d.ts.map +1 -1
  262. package/dist/parsing/util.js +22 -5
  263. package/dist/parsing/util.js.map +1 -1
  264. package/dist/plugin-options.d.ts +8 -1
  265. package/dist/plugin-options.d.ts.map +1 -1
  266. package/dist/plugin-options.js.map +1 -1
  267. package/dist/refactor/javascript.js +1 -1
  268. package/dist/refactor/javascript.js.map +1 -1
  269. package/dist/rename-manager.d.ts.map +1 -1
  270. package/dist/rename-manager.js +1 -2
  271. package/dist/rename-manager.js.map +1 -1
  272. package/dist/router-parser.d.ts +35 -0
  273. package/dist/router-parser.d.ts.map +1 -0
  274. package/dist/router-parser.js +490 -0
  275. package/dist/router-parser.js.map +1 -0
  276. package/dist/socket-manager.d.ts +3 -3
  277. package/dist/socket-manager.d.ts.map +1 -1
  278. package/dist/socket-manager.js +14 -15
  279. package/dist/socket-manager.js.map +1 -1
  280. package/dist/source-tracker.d.ts +9 -77
  281. package/dist/source-tracker.d.ts.map +1 -1
  282. package/dist/source-tracker.js +83 -374
  283. package/dist/source-tracker.js.map +1 -1
  284. package/dist/util/operation-queue.d.ts +3 -0
  285. package/dist/util/operation-queue.d.ts.map +1 -1
  286. package/dist/util/operation-queue.js +5 -0
  287. package/dist/util/operation-queue.js.map +1 -1
  288. package/dist/util.d.ts +13 -1
  289. package/dist/util.d.ts.map +1 -1
  290. package/dist/util.js +49 -28
  291. package/dist/util.js.map +1 -1
  292. package/dist/vite-plugin-yaml-types.d.ts +9 -0
  293. package/dist/vite-plugin-yaml-types.d.ts.map +1 -0
  294. package/dist/vite-plugin-yaml-types.js +114 -0
  295. package/dist/vite-plugin-yaml-types.js.map +1 -0
  296. package/package.json +8 -7
  297. package/dist/ai-service/agent/tools/build-add-event.d.ts +0 -14
  298. package/dist/ai-service/agent/tools/build-add-event.d.ts.map +0 -1
  299. package/dist/ai-service/agent/tools/build-add-event.js +0 -44
  300. package/dist/ai-service/agent/tools/build-add-event.js.map +0 -1
  301. package/dist/ai-service/agent/tools/build-add-state-var.d.ts +0 -16
  302. package/dist/ai-service/agent/tools/build-add-state-var.d.ts.map +0 -1
  303. package/dist/ai-service/agent/tools/build-add-state-var.js +0 -62
  304. package/dist/ai-service/agent/tools/build-add-state-var.js.map +0 -1
  305. package/dist/ai-service/agent/tools/build-add-timer.d.ts +0 -16
  306. package/dist/ai-service/agent/tools/build-add-timer.d.ts.map +0 -1
  307. package/dist/ai-service/agent/tools/build-add-timer.js +0 -46
  308. package/dist/ai-service/agent/tools/build-add-timer.js.map +0 -1
  309. package/dist/ai-service/agent/tools/build-create-page.d.ts +0 -10
  310. package/dist/ai-service/agent/tools/build-create-page.d.ts.map +0 -1
  311. package/dist/ai-service/agent/tools/build-create-page.js +0 -57
  312. package/dist/ai-service/agent/tools/build-create-page.js.map +0 -1
  313. package/dist/ai-service/agent/tools/build-list-available-components.d.ts +0 -9
  314. package/dist/ai-service/agent/tools/build-list-available-components.d.ts.map +0 -1
  315. package/dist/ai-service/agent/tools/build-list-available-components.js +0 -55
  316. package/dist/ai-service/agent/tools/build-list-available-components.js.map +0 -1
  317. package/dist/ai-service/agent/tools/build-register-component-name.d.ts +0 -9
  318. package/dist/ai-service/agent/tools/build-register-component-name.d.ts.map +0 -1
  319. package/dist/ai-service/agent/tools/build-register-component-name.js +0 -53
  320. package/dist/ai-service/agent/tools/build-register-component-name.js.map +0 -1
  321. package/dist/ai-service/agent/tools/build-rename-page.d.ts +0 -9
  322. package/dist/ai-service/agent/tools/build-rename-page.d.ts.map +0 -1
  323. package/dist/ai-service/agent/tools/build-rename-page.js +0 -50
  324. package/dist/ai-service/agent/tools/build-rename-page.js.map +0 -1
  325. package/dist/ai-service/agent/tools/build-set-api-triggers.d.ts +0 -25
  326. package/dist/ai-service/agent/tools/build-set-api-triggers.d.ts.map +0 -1
  327. package/dist/ai-service/agent/tools/build-set-api-triggers.js +0 -266
  328. package/dist/ai-service/agent/tools/build-set-api-triggers.js.map +0 -1
  329. package/dist/ai-service/agent/tools/build-update-state-var.d.ts +0 -16
  330. package/dist/ai-service/agent/tools/build-update-state-var.d.ts.map +0 -1
  331. package/dist/ai-service/agent/tools/build-update-state-var.js +0 -67
  332. package/dist/ai-service/agent/tools/build-update-state-var.js.map +0 -1
  333. package/dist/ai-service/agent/tools/study-current-app-state.d.ts +0 -20
  334. package/dist/ai-service/agent/tools/study-current-app-state.d.ts.map +0 -1
  335. package/dist/ai-service/agent/tools/study-current-app-state.js +0 -20
  336. package/dist/ai-service/agent/tools/study-current-app-state.js.map +0 -1
  337. package/dist/binding-extraction/extract-js-identifiers.d.ts.map +0 -1
  338. package/dist/binding-extraction/extract-js-identifiers.js.map +0 -1
  339. package/dist/binding-extraction/extract-py-identifiers.d.ts +0 -4
  340. package/dist/binding-extraction/extract-py-identifiers.d.ts.map +0 -1
  341. package/dist/binding-extraction/extract-py-identifiers.js.map +0 -1
  342. package/dist/component-docs-service/index.d.ts +0 -37
  343. package/dist/component-docs-service/index.d.ts.map +0 -1
  344. package/dist/component-docs-service/index.js +0 -118
  345. package/dist/component-docs-service/index.js.map +0 -1
  346. package/dist/parsing/events/index.d.ts +0 -5
  347. package/dist/parsing/events/index.d.ts.map +0 -1
  348. package/dist/parsing/events/index.js +0 -7
  349. package/dist/parsing/events/index.js.map +0 -1
  350. package/dist/parsing/events/to-code-events.d.ts +0 -3
  351. package/dist/parsing/events/to-code-events.d.ts.map +0 -1
  352. package/dist/parsing/events/to-code-events.js +0 -147
  353. package/dist/parsing/events/to-code-events.js.map +0 -1
  354. package/dist/parsing/events/to-value-events.d.ts +0 -10
  355. package/dist/parsing/events/to-value-events.d.ts.map +0 -1
  356. package/dist/parsing/events/to-value-events.js +0 -473
  357. package/dist/parsing/events/to-value-events.js.map +0 -1
  358. package/dist/parsing/scope.d.ts +0 -103
  359. package/dist/parsing/scope.d.ts.map +0 -1
  360. package/dist/parsing/scope.js +0 -902
  361. package/dist/parsing/scope.js.map +0 -1
  362. package/dist/routing.d.ts +0 -6
  363. package/dist/routing.d.ts.map +0 -1
  364. package/dist/routing.js +0 -169
  365. package/dist/routing.js.map +0 -1
  366. package/dist/sb-scope-manager.d.ts +0 -121
  367. package/dist/sb-scope-manager.d.ts.map +0 -1
  368. package/dist/sb-scope-manager.js +0 -678
  369. package/dist/sb-scope-manager.js.map +0 -1
@@ -1,22 +1,19 @@
1
1
  import path from "node:path";
2
2
  import { parse } from "@babel/parser";
3
3
  import * as t from "@babel/types";
4
- import { isPropertyInfo, Property, splitJSPath, splitJSPathAdvanced, } from "@superblocksteam/library-shared";
5
- import { SbEntityType, } from "@superblocksteam/library-shared/types";
4
+ import { isPropertyInfo, splitJSPath, splitJSPathAdvanced, } from "@superblocksteam/library-shared";
6
5
  import { format } from "prettier";
7
6
  import { generateJSXAttribute, generateJSXElement, writeNestedProperty, } from "./codegen.js";
8
7
  import { ComponentsManager } from "./components-manager.js";
9
- import { SCOPE_FILE } from "./file-system-helpers.js";
10
8
  import { generate } from "./generate.js";
11
9
  import { generatePredictableId } from "./ids.js";
12
10
  import { getSbElementId, setSbElementId, supplementElementIds, } from "./parsing/ids.js";
13
11
  import { getRequiredImportsForProperty, EXTERNAL_LIBRARY_OPTIONS, } from "./parsing/imports.js";
14
- import { getDescriptiveName, getJSXAttributeName, getVariableReferences, isNamedComponent, } from "./parsing/jsx.js";
15
- import { getTagName, addImport, extractImportsFromAst, getImportPath, } from "./parsing/util.js";
16
- import { deleteEntityInAst } from "./refactor/entities.js";
12
+ import { getDescriptiveName, getJSXAttributeName, getVariableReferences, } from "./parsing/jsx.js";
13
+ import { getTagName, addImport, extractImportsFromAst, } from "./parsing/util.js";
17
14
  import { RenameManager } from "./rename-manager.js";
18
- import { SbScopeManager } from "./sb-scope-manager.js";
19
15
  import { getErrorMeta, getLogger } from "./util/logger.js";
16
+ import { getScopeIdFromName } from "./util.js";
20
17
  const ATTRIBUTE_TYPES_WITH_STATE_ACCESS = ["COMPUTED", "TEMPLATE", "EVENT"];
21
18
  // File Explanation:
22
19
  // This file is responsible for tracking the source code of the application.
@@ -25,17 +22,12 @@ const ATTRIBUTE_TYPES_WITH_STATE_ACCESS = ["COMPUTED", "TEMPLATE", "EVENT"];
25
22
  // This information is used by the source code editor to provide features like drag and drop and property editing.
26
23
  export class SourceTracker {
27
24
  renameManager = new RenameManager();
28
- sbScopeManager;
29
25
  elementToLocation = {};
30
26
  elementToFilePath = {};
31
- scopeIdToFilePath = {};
32
- sbScopeNamesToFilePath = {};
33
27
  newlyAddedCount = 0;
34
28
  fileToMeta = {};
35
29
  changedFiles = new Set();
36
- constructor(tracer) {
37
- this.sbScopeManager = new SbScopeManager(this, tracer);
38
- }
30
+ constructor(_tracer) { }
39
31
  getCurrentFiles() {
40
32
  return this.fileToMeta;
41
33
  }
@@ -90,18 +82,8 @@ export class SourceTracker {
90
82
  deleteElementToFilePath(el) {
91
83
  delete this.elementToFilePath[el];
92
84
  }
93
- getScopeDefinitionForPage(pageName) {
94
- const { scopeDefinition } = this.sbScopeManager.getScopeDefinitionAndFilePathByNameOrId({
95
- identifier: pageName,
96
- type: "name",
97
- });
98
- return scopeDefinition;
99
- }
100
- getScopeDefinitionAndFilePathByNameOrId({ identifier, type, }) {
101
- return this.sbScopeManager.getScopeDefinitionAndFilePathByNameOrId({
102
- identifier,
103
- type,
104
- });
85
+ getScopeIdForPage(pageName) {
86
+ return getScopeIdFromName(pageName);
105
87
  }
106
88
  parseJsxFromEntrypoint({ files, }) {
107
89
  const parsedAsts = {};
@@ -129,7 +111,6 @@ export class SourceTracker {
129
111
  code,
130
112
  }));
131
113
  const parsedAsts = this.parseJsxFromEntrypoint({
132
- // entryPointFilePath: rootDir + "/pages/page1/_index.tsx",
133
114
  files: fileContents,
134
115
  });
135
116
  Object.entries(parsedAsts).forEach(([file, ast]) => {
@@ -144,29 +125,23 @@ export class SourceTracker {
144
125
  imports: extractImportsFromAst(ast),
145
126
  };
146
127
  });
147
- // We always re-parse scopes because we either have new scopes we need to parse, or
148
- // we've done a move/refactor of a named scope (pages)
149
- this.sbScopeManager.parseScopes(this.fileToMeta);
128
+ // Parse JSX elements and track their locations
150
129
  Object.entries(parsedAsts).forEach(([file, ast]) => {
151
- // scope files are handled by the sbScopeManager
152
- if (!file.endsWith(SCOPE_FILE)) {
153
- const { idMap } = supplementElementIds({
154
- fileName: file,
155
- ast,
156
- shouldModifyAst: false,
157
- });
158
- idMap.forEach((path, id) => {
159
- this.elementToLocation[id] = path;
160
- this.elementToFilePath[id] = file;
161
- });
162
- }
130
+ const { idMap } = supplementElementIds({
131
+ fileName: file,
132
+ ast,
133
+ shouldModifyAst: false,
134
+ });
135
+ idMap.forEach((path, id) => {
136
+ this.elementToLocation[id] = path;
137
+ this.elementToFilePath[id] = file;
138
+ });
163
139
  });
164
140
  };
165
141
  handleNonVisualChangeByDeletingIds = async (fileName, fileContents) => {
166
142
  const extension = path.extname(fileName);
167
143
  if (extension !== ".ts" && extension !== ".tsx")
168
144
  return;
169
- const existingFile = fileName in this.fileToMeta;
170
145
  try {
171
146
  const astMap = this.parseJsxFromEntrypoint({
172
147
  files: [{ fileName, code: fileContents }],
@@ -192,36 +167,15 @@ export class SourceTracker {
192
167
  delete this.elementToLocation[key];
193
168
  delete this.elementToFilePath[key];
194
169
  });
195
- let changedFiles = [];
196
- if (existingFile) {
197
- changedFiles = this.sbScopeManager.resetScope(fileName);
198
- }
199
- else {
200
- this.sbScopeManager.parseScopes({
201
- [fileName]: {
202
- code: fileContents,
203
- ast,
204
- imports: extractImportsFromAst(ast),
205
- },
206
- });
207
- changedFiles.push(fileName);
208
- }
209
- // scope file is handled by the sbScopeManager
210
- if (!fileName.endsWith(SCOPE_FILE)) {
211
- const { idMap } = supplementElementIds({
212
- fileName,
213
- ast,
214
- shouldModifyAst: false,
215
- });
216
- idMap.forEach((path, id) => {
217
- this.elementToLocation[id] = path;
218
- this.elementToFilePath[id] = fileName;
219
- });
220
- }
221
- changedFiles.forEach((file) => {
222
- if (file !== fileName) {
223
- this.changedFiles.add(file);
224
- }
170
+ // Parse JSX elements and track their locations
171
+ const { idMap } = supplementElementIds({
172
+ fileName,
173
+ ast,
174
+ shouldModifyAst: false,
175
+ });
176
+ idMap.forEach((path, id) => {
177
+ this.elementToLocation[id] = path;
178
+ this.elementToFilePath[id] = fileName;
225
179
  });
226
180
  // Mark the file as changed
227
181
  this.changedFiles.add(fileName);
@@ -240,18 +194,6 @@ export class SourceTracker {
240
194
  delete this.elementToFilePath[id];
241
195
  }
242
196
  });
243
- // Clean up sb scope mappings
244
- Object.entries(this.sbScopeNamesToFilePath).forEach(([scopeName, info]) => {
245
- if (info.filePath === fileName) {
246
- delete this.sbScopeNamesToFilePath[scopeName];
247
- }
248
- });
249
- // Clean up scope ID mappings
250
- Object.entries(this.scopeIdToFilePath).forEach(([scopeId, path]) => {
251
- if (path === fileName) {
252
- delete this.scopeIdToFilePath[scopeId];
253
- }
254
- });
255
197
  };
256
198
  updateFileContents(filePath, code) {
257
199
  const existingFile = this.fileToMeta[filePath];
@@ -343,132 +285,15 @@ export class SourceTracker {
343
285
  throw new Error("Error updating source tracker during move" + e.message);
344
286
  }
345
287
  };
346
- addApi = async ({ pageName, apiName, }) => {
347
- const { scopeDefinition, filePath: scopeFilePath } = this.sbScopeManager.getScopeDefinitionAndFilePathByNameOrId({
348
- identifier: pageName,
349
- type: "name",
350
- });
351
- if (!scopeDefinition || !scopeFilePath) {
352
- throw new Error("Scope not found for page " + pageName);
353
- }
354
- if (scopeDefinition.entityNames.includes(apiName)) {
355
- getLogger().warn(`API name ${apiName} already exists in scope for page ${pageName}. Ignoring scope update.`);
356
- return scopeDefinition.id;
357
- }
358
- const changedFiles = this.sbScopeManager.addScopeEntity(scopeDefinition.id, {
359
- type: SbEntityType.API,
360
- name: apiName,
361
- attributes: {},
362
- });
363
- changedFiles.forEach((file) => {
364
- this.changedFiles.add(file);
365
- });
366
- return scopeDefinition.id;
367
- };
368
- deleteApi = ({ pageName, apiName, }) => {
369
- const { scopeDefinition, filePath: scopeFilePath } = this.sbScopeManager.getScopeDefinitionAndFilePathByNameOrId({
370
- identifier: pageName,
371
- type: "name",
372
- });
373
- if (!scopeDefinition || !scopeFilePath) {
374
- throw new Error("Scope not found for page " + pageName);
375
- }
376
- const entityId = scopeDefinition.scopeNameToEntityId[apiName];
377
- if (!entityId) {
378
- getLogger().warn("Entity ID not found for API " + apiName);
379
- return;
380
- }
381
- const { changedFiles } = this.sbScopeManager.deleteScopeEntity(entityId);
382
- const scopeFolder = path.dirname(scopeFilePath);
383
- for (const filePath of Object.keys(this.fileToMeta)) {
384
- if (filePath.startsWith(scopeFolder) && filePath.endsWith(".tsx")) {
385
- const currentFile = this.fileToMeta[filePath];
386
- if (!currentFile || !currentFile.ast) {
387
- throw new Error(`File not found for element ${filePath}`);
388
- }
389
- deleteEntityInAst({ entityName: apiName, ast: currentFile.ast });
390
- }
391
- }
392
- changedFiles.forEach((file) => {
393
- this.changedFiles.add(file);
394
- });
395
- return scopeDefinition.id;
396
- };
397
- addEntity = ({ scopeId, entity, }) => {
398
- const changedFiles = this.sbScopeManager.addScopeEntity(scopeId, entity);
399
- changedFiles.forEach((file) => {
400
- this.changedFiles.add(file);
401
- });
402
- };
403
- updateEntity = (payload) => {
404
- const changedFile = this.sbScopeManager.updateScopeEntity(payload);
405
- this.changedFiles.add(changedFile);
406
- };
407
- deleteEntity = ({ entityId, }) => {
408
- const { changedFiles, deletedEntitiesNames } = this.sbScopeManager.deleteScopeEntity(entityId);
409
- changedFiles.forEach((file) => {
410
- this.changedFiles.add(file);
411
- });
412
- return deletedEntitiesNames[0];
413
- };
414
- checkImportInFilesForNewName = ({ entityId, newName, oldName, scopeName, }) => {
415
- const referencingFiles = this.sbScopeManager.getReferencingFilesByEntityIdAndScopeName(entityId, scopeName);
416
- for (const filePath of referencingFiles) {
417
- const file = this.fileToMeta[filePath];
418
- if (!file || !file.ast) {
419
- throw new Error(`File not found for element ${filePath}`);
420
- }
421
- const imports = extractImportsFromAst(file.ast);
422
- if (newName in imports) {
423
- throw new Error(`Cannot rename entity ${oldName} to ${newName} because it has a naming collision with an existing import in file ${filePath}`);
424
- }
425
- }
426
- };
427
- renameEntity = ({ entityId, oldName, newName, scopeName, }) => {
428
- this.checkImportInFilesForNewName({
429
- entityId,
430
- newName,
431
- oldName,
432
- scopeName,
433
- });
434
- const { changedFiles, scopeFile } = this.sbScopeManager.renameScopeEntity({
435
- entityId,
436
- newName,
437
- oldName,
438
- });
439
- if (changedFiles.length === 0) {
440
- console.warn("No changed files found for entity", entityId);
441
- return;
442
- }
443
- changedFiles.forEach((file) => {
444
- this.changedFiles.add(file);
445
- });
446
- if (!scopeFile) {
447
- console.error("Could not find scope file for entity", entityId);
448
- return;
449
- }
450
- this.changedFiles.add(scopeFile);
451
- // For now, just look in the same folder as the scope file for renames
452
- // in the future, we may need to look in other folders
453
- const scopeFolder = path.dirname(scopeFile);
454
- for (const filePath of Object.keys(this.fileToMeta)) {
455
- if (filePath.startsWith(scopeFolder) && filePath.endsWith(".tsx")) {
456
- this.renameIdentifier({
457
- oldName,
458
- newName,
459
- filePath,
460
- parentBinding: scopeName,
461
- });
462
- }
463
- }
288
+ addApi = async ({ apiName: _apiName }) => {
289
+ // Return the app-level scope ID
290
+ return getScopeIdFromName("App");
464
291
  };
465
- addScopeComponent = ({ scopeName, componentName, }) => {
466
- const changedFiles = this.sbScopeManager.addScopeComponent(scopeName, componentName);
467
- changedFiles.forEach((file) => {
468
- this.changedFiles.add(file);
469
- });
292
+ deleteApi = ({ apiName: _apiName, }) => {
293
+ // Return the app-level scope ID
294
+ return getScopeIdFromName("App");
470
295
  };
471
- addElement = ({ parentElement, tagName, properties, children, id, scopeName, }) => {
296
+ addElement = ({ parentElement, tagName, properties, children, id, scopeName: _scopeName, }) => {
472
297
  const logger = getLogger();
473
298
  const parentOpeningElementPath = this.getElementToLocation(parentElement.source.id);
474
299
  const parentFilepath = this.getElementToFilePath(parentElement.source.id);
@@ -486,54 +311,6 @@ export class SourceTracker {
486
311
  throw new Error("Parent element is not a JSX element");
487
312
  }
488
313
  try {
489
- const childName = properties.name;
490
- if (childName && scopeName) {
491
- const { scopeDefinition, filePath: scopeFilePath } = this.sbScopeManager.getScopeDefinitionAndFilePathByNameOrId({
492
- identifier: scopeName,
493
- type: "name",
494
- });
495
- if (!scopeDefinition || !scopeFilePath) {
496
- console.log("No scope creation found for " + scopeName + " will not add a bind");
497
- }
498
- else {
499
- const { name: scopeExportName } = scopeDefinition;
500
- if (scopeFilePath !== parentFilepath) {
501
- // check if exportName is already imported into parentFilePath
502
- const parentFileImports = this.fileToMeta[parentFilepath]?.imports;
503
- if (!parentFileImports || !parentFileImports[scopeExportName]) {
504
- const importPath = getImportPath(parentFilepath, scopeFilePath);
505
- // add the import
506
- addImport({
507
- importPath,
508
- importName: scopeExportName,
509
- path: parentOpeningElementPath,
510
- onAdd: () => {
511
- this.fileToMeta[parentFilepath].imports[scopeExportName] =
512
- importPath;
513
- },
514
- });
515
- }
516
- }
517
- const childNameValue = childName.value;
518
- const changedFiles = this.sbScopeManager.addScopeComponent(scopeName, childNameValue);
519
- changedFiles.forEach((file) => {
520
- this.changedFiles.add(file);
521
- });
522
- // if the scope file path is in the same page directory as this file, then we should destructure it
523
- if (path.dirname(scopeFilePath) === path.dirname(parentFilepath)) {
524
- this.sbScopeManager.addScopeDestructuringForComponent({
525
- elementLocation: parentJSXElementPath,
526
- scopeName,
527
- componentFilePath: parentFilepath,
528
- });
529
- properties.bind = Property.Expression(`${childNameValue}`);
530
- }
531
- else {
532
- properties.bind = Property.Expression(`${scopeExportName}.${childNameValue}`);
533
- }
534
- delete properties.name;
535
- }
536
- }
537
314
  const newElement = generateJSXElement({
538
315
  id,
539
316
  tagName,
@@ -629,7 +406,7 @@ export class SourceTracker {
629
406
  throw new Error("Error updating source tracker during add" + e.message);
630
407
  }
631
408
  };
632
- deleteElement = ({ source, scopeName, }) => {
409
+ deleteElement = ({ source, scopeName: _scopeName, }) => {
633
410
  const logger = getLogger();
634
411
  let openingTag = this.getElementToLocation(source.id);
635
412
  if (!openingTag) {
@@ -650,7 +427,7 @@ export class SourceTracker {
650
427
  logger.error(`Cannot delete a non-JSX element ${source.id}`);
651
428
  return;
652
429
  }
653
- const componentName = getDescriptiveName(openingTag.node);
430
+ const _componentName = getDescriptiveName(openingTag.node);
654
431
  const children = [];
655
432
  openingTag.traverse({
656
433
  JSXElement: (path) => {
@@ -669,20 +446,8 @@ export class SourceTracker {
669
446
  }
670
447
  delete this.elementToLocation[source.id];
671
448
  delete this.elementToFilePath[source.id];
672
- if (scopeName && componentName) {
673
- const changedFiles = this.sbScopeManager.deleteScopeComponent(scopeName, componentName);
674
- changedFiles.forEach((file) => {
675
- this.changedFiles.add(file);
676
- });
677
- }
678
- // Then remove all traces of the children
679
- children.forEach(({ id, name: childComponentName }) => {
680
- if (childComponentName && scopeName) {
681
- const changedFiles = this.sbScopeManager.deleteScopeComponent(scopeName, childComponentName);
682
- changedFiles.forEach((file) => {
683
- this.changedFiles.add(file);
684
- });
685
- }
449
+ // Clean up child element tracking
450
+ children.forEach(({ id }) => {
686
451
  delete this.elementToLocation[id];
687
452
  delete this.elementToFilePath[id];
688
453
  });
@@ -778,42 +543,6 @@ export class SourceTracker {
778
543
  }
779
544
  return found;
780
545
  };
781
- removeVariableReferencesFromRoot = (functionRoot, variableName) => {
782
- const referencesToRemove = new Set();
783
- functionRoot.traverse({
784
- JSXExpressionContainer(path) {
785
- const expression = path.get("expression");
786
- if (expression.isIdentifier() &&
787
- expression.node.name === variableName) {
788
- referencesToRemove.add(path);
789
- }
790
- else if (expression.isCallExpression()) {
791
- const callee = expression.get("callee");
792
- if (callee.isIdentifier() && callee.node.name === variableName) {
793
- referencesToRemove.add(path);
794
- }
795
- }
796
- },
797
- Identifier(path) {
798
- if (path.node.name === variableName && path.isReferencedIdentifier()) {
799
- const parent = path.parentPath;
800
- if (parent?.isJSXExpressionContainer()) {
801
- referencesToRemove.add(parent);
802
- }
803
- }
804
- },
805
- });
806
- for (const path of referencesToRemove) {
807
- try {
808
- if (!path.removed) {
809
- path.remove();
810
- }
811
- }
812
- catch (_e) {
813
- // Path might already be removed, ignore the error
814
- }
815
- }
816
- };
817
546
  // If we're deleting the only Column in an Section, remove the Section
818
547
  deleteSectionIfOnlyChild = (openingTag) => {
819
548
  const parentElement = openingTag.parentPath;
@@ -935,7 +664,29 @@ export class SourceTracker {
935
664
  const openingElement = element.get("openingElement");
936
665
  if (openingElement.node.selfClosing) {
937
666
  openingElement.node.selfClosing = false;
938
- element.node.closingElement = t.jsxClosingElement(t.jsxIdentifier(getTagName(openingElement.node.name) ?? ""));
667
+ element.node.closingElement = t.jsxClosingElement(openingElement.node.name);
668
+ }
669
+ };
670
+ setJSXChildren = (jsxElement, info) => {
671
+ const logger = getLogger();
672
+ try {
673
+ // Ensure the element is not self-closing
674
+ this.transformSelfClosingTagToRegularTag(jsxElement);
675
+ // Clear existing children
676
+ jsxElement.node.children = [];
677
+ // Handle different types of children content
678
+ if (info.type === "STATIC" && typeof info.value === "string") {
679
+ // For string children, create a text node
680
+ if (info.value.trim() !== "") {
681
+ jsxElement.node.children = [t.jsxText(info.value)];
682
+ }
683
+ }
684
+ else {
685
+ console.warn("setting non-static string children is not supported");
686
+ }
687
+ }
688
+ catch (e) {
689
+ logger.error("Error setting JSX children", getErrorMeta(e));
939
690
  }
940
691
  };
941
692
  setProperty = ({ source, property, info, }) => {
@@ -965,8 +716,28 @@ export class SourceTracker {
965
716
  if (!openingTag.isJSXOpeningElement()) {
966
717
  throw new Error(`Element ${source.id} is not a JSXOpeningElement`);
967
718
  }
719
+ // Get the JSX element to handle children
720
+ let jsxElement = this.getElementToLocation(source.id);
721
+ if (jsxElement?.isJSXOpeningElement()) {
722
+ jsxElement = jsxElement.parentPath;
723
+ }
968
724
  // Iterate over the changes and set each attribute using the helper
969
725
  for (const [key, info] of Object.entries(changes)) {
726
+ // Special handling for children property
727
+ if (key === "children") {
728
+ const childrenAttribute = openingTag
729
+ .get("attributes")
730
+ .find((attr) => attr.isJSXAttribute() && attr.node.name.name === "children");
731
+ const jsxChildrenExists = jsxElement.isJSXElement() && jsxElement.node.children.length > 0;
732
+ // We always set the jsx children UNLESS children exists as an attribute and there are no current jsx children
733
+ if (jsxChildrenExists || !childrenAttribute) {
734
+ this.setJSXChildren(jsxElement, info);
735
+ if (childrenAttribute) {
736
+ childrenAttribute.remove();
737
+ }
738
+ continue;
739
+ }
740
+ }
970
741
  const jsxAttribute = this.setAttribute(openingTag, key, info);
971
742
  const imports = getRequiredImportsForProperty(info);
972
743
  if (imports.length > 0) {
@@ -985,13 +756,7 @@ export class SourceTracker {
985
756
  }
986
757
  if (ATTRIBUTE_TYPES_WITH_STATE_ACCESS.includes(info.type) &&
987
758
  jsxAttribute) {
988
- const elementLocation = this.getElementToLocation(source.id);
989
- const scopeImports = this.sbScopeManager.getAndUpdateScopeImportsForCodeSnippet({
990
- jsxAttribute,
991
- codeFilePath: fileName,
992
- elementLocation,
993
- existingImports: this.fileToMeta[fileName].imports,
994
- });
759
+ // Add external library imports (but not scope imports)
995
760
  for (const externalLibrary of EXTERNAL_LIBRARY_OPTIONS) {
996
761
  const referencedGlobalFunctions = getVariableReferences(jsxAttribute, externalLibrary.imports).map((funcName) => {
997
762
  return {
@@ -999,7 +764,7 @@ export class SourceTracker {
999
764
  importName: funcName,
1000
765
  };
1001
766
  });
1002
- [...referencedGlobalFunctions, ...scopeImports].forEach(({ importPath, importName }) => {
767
+ referencedGlobalFunctions.forEach(({ importPath, importName }) => {
1003
768
  addImport({
1004
769
  importPath,
1005
770
  importName,
@@ -1046,18 +811,12 @@ export class SourceTracker {
1046
811
  logger.error("Error deleting properties", getErrorMeta(e));
1047
812
  }
1048
813
  };
1049
- renameComponent = async ({ widgetSourceId, newName, oldName, scopeName, renameInAst = true, }) => {
814
+ renameComponent = async ({ widgetSourceId, newName, oldName: _oldName, renameInAst = true, }) => {
1050
815
  const filePath = this.getElementToFilePath(widgetSourceId);
1051
816
  const currentFile = this.fileToMeta[filePath];
1052
817
  if (!currentFile || !currentFile.ast) {
1053
818
  throw new Error(`File not found for element ${filePath}`);
1054
819
  }
1055
- this.checkImportInFilesForNewName({
1056
- entityId: widgetSourceId,
1057
- newName,
1058
- oldName,
1059
- scopeName,
1060
- });
1061
820
  let widgetNode = this.getElementToLocation(widgetSourceId);
1062
821
  if (!widgetNode) {
1063
822
  throw new Error(`Widget ${widgetSourceId} not found`);
@@ -1065,26 +824,6 @@ export class SourceTracker {
1065
824
  if (widgetNode?.isJSXElement()) {
1066
825
  widgetNode = widgetNode.get("openingElement");
1067
826
  }
1068
- const hasNameAttribute = isNamedComponent(widgetNode.node);
1069
- if (scopeName) {
1070
- if (!hasNameAttribute) {
1071
- // if this is the first component getting named, we might need to add a scope destructuring for it
1072
- this.sbScopeManager.addScopeDestructuringForComponent({
1073
- elementLocation: widgetNode,
1074
- scopeName,
1075
- componentFilePath: filePath,
1076
- });
1077
- }
1078
- const changedFiles = this.sbScopeManager.renameScopeComponent({
1079
- oldName: hasNameAttribute ? oldName : undefined,
1080
- newName,
1081
- scopeName,
1082
- componentFilePath: filePath,
1083
- });
1084
- changedFiles.forEach((file) => {
1085
- this.changedFiles.add(file);
1086
- });
1087
- }
1088
827
  await this.renameManager.renameComponent({
1089
828
  widgetNode: widgetNode,
1090
829
  newName,
@@ -1110,41 +849,11 @@ export class SourceTracker {
1110
849
  });
1111
850
  this.changedFiles.add(filePath);
1112
851
  };
1113
- /**
1114
- * Change the name of a scope definition in a specific file path. Note: if this is part of a page rename,
1115
- * you have to perform all of the file system operations separately.
1116
-
1117
- */
1118
- renamePage = ({ oldName, newName, scopeFilePath, pageFilePath, }) => {
1119
- const scopeAst = this.fileToMeta[scopeFilePath]?.ast;
1120
- if (!scopeAst) {
1121
- throw new Error(`File not found for element ${scopeFilePath}`);
1122
- }
1123
- const pageAst = this.fileToMeta[pageFilePath]?.ast;
1124
- if (!pageAst) {
1125
- throw new Error(`File not found for element ${pageFilePath}`);
1126
- }
1127
- this.sbScopeManager.renamePageScope({
1128
- oldName,
1129
- newName,
1130
- newFilePath: scopeFilePath,
1131
- indexAst: pageAst,
1132
- scopeAst,
1133
- });
1134
- this.changedFiles.add(scopeFilePath);
1135
- this.changedFiles.add(pageFilePath);
1136
- };
1137
852
  getAddElementImports = ({ properties, children, }) => {
1138
853
  const componentsManager = ComponentsManager.getInstance();
1139
854
  const getPropertyImports = (properties) => {
1140
855
  return Object.values(properties)
1141
856
  .flatMap((property) => {
1142
- if (property.type === "EVENT") {
1143
- return {
1144
- importPath: "@superblocksteam/library",
1145
- importName: "EventFlow",
1146
- };
1147
- }
1148
857
  if (property.type === "DIMENSION") {
1149
858
  return {
1150
859
  importPath: "@superblocksteam/library",