@rebasepro/cli 0.30.0 → 0.31.0-canary.g59cd6fd

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 (286) hide show
  1. package/README.md +8 -7
  2. package/dist/{agent-setup-0uyfC7VX.js → agent-setup-DqAcoDcn.js} +10 -5
  3. package/dist/{agent-setup-0uyfC7VX.js.map → agent-setup-DqAcoDcn.js.map} +1 -1
  4. package/dist/{api-keys-Dfw5-9s1.js → api-keys-eIUjMqWn.js} +8 -7
  5. package/dist/api-keys-eIUjMqWn.js.map +1 -0
  6. package/dist/{apps-MKQbgDtN.js → apps-DExO4PEl.js} +8 -7
  7. package/dist/apps-DExO4PEl.js.map +1 -0
  8. package/dist/{project-CasK56vN.js → args-CaCcrYE1.js} +2 -351
  9. package/dist/args-CaCcrYE1.js.map +1 -0
  10. package/dist/{atlas-dev-database-BODqdCWt.js → atlas-dev-database-DOCKk6ht.js} +2 -2
  11. package/dist/{atlas-dev-database-BODqdCWt.js.map → atlas-dev-database-DOCKk6ht.js.map} +1 -1
  12. package/dist/{auth-Bv0rTbQX.js → auth-D96QYgFR.js} +7 -6
  13. package/dist/{auth-Bv0rTbQX.js.map → auth-D96QYgFR.js.map} +1 -1
  14. package/dist/backend-guard-C0mVkXBw.js +162 -0
  15. package/dist/backend-guard-C0mVkXBw.js.map +1 -0
  16. package/dist/{branch-pointer-BQUF6lYa.js → branch-pointer-DMPyvZoK.js} +1 -1
  17. package/dist/{build-BuKTnec8.js → build-CA5R07tw.js} +29 -9
  18. package/dist/build-CA5R07tw.js.map +1 -0
  19. package/dist/{bundle-BAH4FCju.js → bundle-DgILeA5b.js} +112 -138
  20. package/dist/bundle-DgILeA5b.js.map +1 -0
  21. package/dist/bundle.d.ts +35 -12
  22. package/dist/cli.d.ts +2 -2
  23. package/dist/{cloud-Cj5ey3l_.js → cloud-CYMk92iG.js} +217 -104
  24. package/dist/cloud-CYMk92iG.js.map +1 -0
  25. package/dist/cms-directories-BK3vcswg.js +33 -0
  26. package/dist/cms-directories-BK3vcswg.js.map +1 -0
  27. package/dist/codemod/collections-to-tables/ast.d.ts +135 -0
  28. package/dist/codemod/collections-to-tables/backend.d.ts +38 -0
  29. package/dist/codemod/collections-to-tables/command.d.ts +35 -0
  30. package/dist/codemod/collections-to-tables/comments.d.ts +45 -0
  31. package/dist/codemod/collections-to-tables/customization.d.ts +47 -0
  32. package/dist/codemod/collections-to-tables/dynamic-props.d.ts +34 -0
  33. package/dist/codemod/collections-to-tables/export-changes.d.ts +83 -0
  34. package/dist/codemod/collections-to-tables/firestore.d.ts +11 -0
  35. package/dist/codemod/collections-to-tables/helper-hooks.d.ts +41 -0
  36. package/dist/codemod/collections-to-tables/hooks.d.ts +44 -0
  37. package/dist/codemod/collections-to-tables/journal.d.ts +10 -0
  38. package/dist/codemod/collections-to-tables/legacy-shims.d.ts +52 -0
  39. package/dist/codemod/collections-to-tables/load-legacy.d.ts +81 -0
  40. package/dist/codemod/collections-to-tables/migrate.d.ts +20 -0
  41. package/dist/codemod/collections-to-tables/modules.d.ts +127 -0
  42. package/dist/codemod/collections-to-tables/moved-imports.d.ts +70 -0
  43. package/dist/codemod/collections-to-tables/moved-symbols.generated.d.ts +12 -0
  44. package/dist/codemod/collections-to-tables/own.d.ts +10 -0
  45. package/dist/codemod/collections-to-tables/path-aliases.d.ts +26 -0
  46. package/dist/codemod/collections-to-tables/plan-context.d.ts +49 -0
  47. package/dist/codemod/collections-to-tables/print-js.d.ts +44 -0
  48. package/dist/codemod/collections-to-tables/project-files.d.ts +144 -0
  49. package/dist/codemod/collections-to-tables/repoint.d.ts +50 -0
  50. package/dist/codemod/collections-to-tables/row-hands.d.ts +7 -0
  51. package/dist/codemod/collections-to-tables/sdk-calls.d.ts +88 -0
  52. package/dist/codemod/collections-to-tables/skills-step.d.ts +13 -0
  53. package/dist/codemod/collections-to-tables/split-constants.d.ts +42 -0
  54. package/dist/codemod/collections-to-tables/storage-paths.d.ts +28 -0
  55. package/dist/codemod/collections-to-tables/types.d.ts +164 -0
  56. package/dist/codemod/collections-to-tables/verify.d.ts +27 -0
  57. package/dist/codemod/collections-to-tables/vocabulary.d.ts +40 -0
  58. package/dist/command-D5lhW_-B.js +9984 -0
  59. package/dist/command-D5lhW_-B.js.map +1 -0
  60. package/dist/commands/agent-setup.d.ts +6 -2
  61. package/dist/commands/cloud/auth.d.ts +2 -0
  62. package/dist/commands/cloud/context.d.ts +1 -1
  63. package/dist/commands/cloud/init.d.ts +2 -2
  64. package/dist/commands/cloud/login-flow.d.ts +30 -1
  65. package/dist/commands/console.d.ts +1 -2
  66. package/dist/commands/db.d.ts +5 -6
  67. package/dist/commands/dev.d.ts +18 -17
  68. package/dist/commands/doctor.d.ts +4 -5
  69. package/dist/commands/eject.d.ts +17 -13
  70. package/dist/commands/generate-view.d.ts +20 -9
  71. package/dist/commands/generate_sdk.d.ts +27 -27
  72. package/dist/commands/init.d.ts +21 -8
  73. package/dist/commands/migrate.d.ts +24 -0
  74. package/dist/commands/schema-reconcile.d.ts +1 -1
  75. package/dist/commands/skills.d.ts +8 -0
  76. package/dist/commands/verify-cms.d.ts +28 -0
  77. package/dist/commands/verify.d.ts +14 -9
  78. package/dist/{consent-BD7F29T3.js → consent-BXLIrMl8.js} +2 -2
  79. package/dist/{consent-BD7F29T3.js.map → consent-BXLIrMl8.js.map} +1 -1
  80. package/dist/{console-CdwIYOMV.js → console-C1d3LwB7.js} +14 -14
  81. package/dist/console-C1d3LwB7.js.map +1 -0
  82. package/dist/{context-AXdAh-q8.js → context--JwaHaZp.js} +6 -5
  83. package/dist/context--JwaHaZp.js.map +1 -0
  84. package/dist/{daemon-Cp7oNXth.js → daemon-w30PsdwV.js} +2 -2
  85. package/dist/{daemon-Cp7oNXth.js.map → daemon-w30PsdwV.js.map} +1 -1
  86. package/dist/{db-DBbKpjYX.js → db-DQZK9n9c.js} +52 -51
  87. package/dist/db-DQZK9n9c.js.map +1 -0
  88. package/dist/{derive-ae9UOoOB.js → derive-C3ezmY-p.js} +105 -133
  89. package/dist/derive-C3ezmY-p.js.map +1 -0
  90. package/dist/{dev-C93d4QIv.js → dev-PY5h4O6u.js} +142 -84
  91. package/dist/dev-PY5h4O6u.js.map +1 -0
  92. package/dist/dev-db/attver.d.ts +32 -0
  93. package/dist/dev-db/pull.d.ts +15 -1
  94. package/dist/{dev-preflight-Cxv3TiD1.js → dev-preflight-DjvcV6SK.js} +5 -5
  95. package/dist/dev-preflight-DjvcV6SK.js.map +1 -0
  96. package/dist/{dev-server-OJsUGZEB.js → dev-server-BLxCbQEP.js} +2 -2
  97. package/dist/{dev-server-OJsUGZEB.js.map → dev-server-BLxCbQEP.js.map} +1 -1
  98. package/dist/{doctor-BBPQUO2g.js → doctor-CnUu8kpM.js} +39 -62
  99. package/dist/doctor-CnUu8kpM.js.map +1 -0
  100. package/dist/doctor-environment.d.ts +6 -6
  101. package/dist/{eject-DABcDnPN.js → eject-Bhzd6hgb.js} +25 -16
  102. package/dist/eject-Bhzd6hgb.js.map +1 -0
  103. package/dist/{fold-static-BWzxNn06.js → fold-static-CKewnAPX.js} +5 -3
  104. package/dist/fold-static-CKewnAPX.js.map +1 -0
  105. package/dist/{generate-view-IFwCADvb.js → generate-view-CTOluXvH.js} +160 -89
  106. package/dist/generate-view-CTOluXvH.js.map +1 -0
  107. package/dist/{generate_sdk-DNmNuFuW.js → generate_sdk-De-aLC1L.js} +120 -137
  108. package/dist/generate_sdk-De-aLC1L.js.map +1 -0
  109. package/dist/import-schema-module-Df67TIWj.js +51 -0
  110. package/dist/import-schema-module-Df67TIWj.js.map +1 -0
  111. package/dist/index.es.js +64 -51
  112. package/dist/index.es.js.map +1 -1
  113. package/dist/{init-vL1DWOeC.js → init-Dtl-IcXf.js} +83 -80
  114. package/dist/init-Dtl-IcXf.js.map +1 -0
  115. package/dist/last-dev-database-Dc8cP01o.js +2 -0
  116. package/dist/{manifest-BtzDy7KQ.js → manifest-C3uLDrrJ.js} +115 -40
  117. package/dist/manifest-C3uLDrrJ.js.map +1 -0
  118. package/dist/manifest.d.ts +79 -24
  119. package/dist/migrate-VrKoi3nB.js +138 -0
  120. package/dist/migrate-VrKoi3nB.js.map +1 -0
  121. package/dist/{normalize-imports-Bd5Y4yLp.js → normalize-imports-DwxqEMYq.js} +3 -3
  122. package/dist/{normalize-imports-Bd5Y4yLp.js.map → normalize-imports-DwxqEMYq.js.map} +1 -1
  123. package/dist/path-flags-7O5uPBcQ.js +139 -0
  124. package/dist/path-flags-7O5uPBcQ.js.map +1 -0
  125. package/dist/{prepare-CTw9NEkh.js → prepare-Ccxspoj-.js} +4 -4
  126. package/dist/{prepare-CTw9NEkh.js.map → prepare-Ccxspoj-.js.map} +1 -1
  127. package/dist/project-CLcF5i8c.js +360 -0
  128. package/dist/project-CLcF5i8c.js.map +1 -0
  129. package/dist/project-schema-CsSOG2gE.js +30 -0
  130. package/dist/project-schema-CsSOG2gE.js.map +1 -0
  131. package/dist/{pull-DDMpsZ5r.js → pull-DRWqBZp5.js} +327 -4
  132. package/dist/pull-DRWqBZp5.js.map +1 -0
  133. package/dist/resolve-BY7bSFRT.js +2 -0
  134. package/dist/resources/derive.d.ts +19 -13
  135. package/dist/{resources-CPSC5Kcu.js → resources-Dpfs2y8P.js} +5 -4
  136. package/dist/{resources-CPSC5Kcu.js.map → resources-Dpfs2y8P.js.map} +1 -1
  137. package/dist/{schema-DtLPsXbT.js → schema-CdDjv5zI.js} +41 -39
  138. package/dist/schema-CdDjv5zI.js.map +1 -0
  139. package/dist/schema-dir-Cd1kvYbf.js +98 -0
  140. package/dist/schema-dir-Cd1kvYbf.js.map +1 -0
  141. package/dist/schema-reconcile-BAupXfkd.js +2 -0
  142. package/dist/schema-text-CpNrsuMe.js +73 -0
  143. package/dist/schema-text-CpNrsuMe.js.map +1 -0
  144. package/dist/{skills-CbwV6vw_.js → skills-CXjA9TWw.js} +54 -10
  145. package/dist/skills-CXjA9TWw.js.map +1 -0
  146. package/dist/{start-YOr3X5Zm.js → start-Bwbtt2W5.js} +7 -10
  147. package/dist/{start-YOr3X5Zm.js.map → start-Bwbtt2W5.js.map} +1 -1
  148. package/dist/{status-BREvtzJm.js → status-D7XCGHu2.js} +12 -12
  149. package/dist/status-D7XCGHu2.js.map +1 -0
  150. package/dist/{storage-CO9ouK76.js → storage-iTqj5-Av.js} +12 -11
  151. package/dist/storage-iTqj5-Av.js.map +1 -0
  152. package/dist/{telemetry-DwK5RQJl.js → telemetry-BP_1Cl9r.js} +4 -4
  153. package/dist/{telemetry-DwK5RQJl.js.map → telemetry-BP_1Cl9r.js.map} +1 -1
  154. package/dist/{telemetry-CgwJPVMO.js → telemetry-M3HjlyhZ.js} +2 -2
  155. package/dist/{telemetry-CgwJPVMO.js.map → telemetry-M3HjlyhZ.js.map} +1 -1
  156. package/dist/{upgrade-B7sVwL8S.js → upgrade-oZzJ13jM.js} +5 -4
  157. package/dist/{upgrade-B7sVwL8S.js.map → upgrade-oZzJ13jM.js.map} +1 -1
  158. package/dist/utils/backend-guard.d.ts +47 -0
  159. package/dist/utils/cms-directories.d.ts +6 -0
  160. package/dist/utils/dev-preflight.d.ts +2 -2
  161. package/dist/utils/import-schema-module.d.ts +16 -0
  162. package/dist/utils/path-flags.d.ts +35 -16
  163. package/dist/utils/project-schema.d.ts +40 -0
  164. package/dist/utils/project.d.ts +8 -2
  165. package/dist/utils/schema-dir.d.ts +32 -0
  166. package/dist/utils/schema-drift.d.ts +6 -0
  167. package/dist/utils/schema-text.d.ts +24 -0
  168. package/dist/verify-5p_vaUG2.js +1160 -0
  169. package/dist/verify-5p_vaUG2.js.map +1 -0
  170. package/package.json +11 -8
  171. package/runtime/dev-server.mjs +5 -1
  172. package/templates/eject/Dockerfile +1 -4
  173. package/templates/eject/backend/src/env.ts +1 -1
  174. package/templates/eject/backend/src/index.ts +53 -40
  175. package/templates/eject/docker-compose.custom.yml +1 -1
  176. package/templates/overlays/baas/README.md +39 -12
  177. package/templates/overlays/baas/ai-instructions.md +8 -8
  178. package/templates/overlays/baas/{config → backend}/storage.ts +3 -4
  179. package/templates/overlays/baas/backend/tsconfig.json +10 -12
  180. package/templates/overlays/baas/package.json +1 -2
  181. package/templates/overlays/baas/pnpm-workspace.yaml +0 -1
  182. package/templates/presets/blank/backend/schema/index.ts +19 -0
  183. package/templates/presets/blank/frontend/src/App.tsx +56 -0
  184. package/templates/presets/ecommerce/backend/schema/categories.ts +12 -0
  185. package/templates/presets/ecommerce/backend/schema/index.ts +23 -0
  186. package/templates/presets/ecommerce/backend/schema/orders.ts +13 -0
  187. package/templates/presets/ecommerce/backend/schema/products.ts +18 -0
  188. package/templates/presets/ecommerce/frontend/src/App.tsx +59 -0
  189. package/templates/presets/ecommerce/frontend/src/cms/categories.tsx +12 -0
  190. package/templates/presets/ecommerce/frontend/src/cms/orders.tsx +38 -0
  191. package/templates/presets/ecommerce/frontend/src/cms/products.tsx +27 -0
  192. package/templates/resource-graphs/blank.json +2 -2
  193. package/templates/resource-graphs/blog.json +5 -5
  194. package/templates/resource-graphs/ecommerce.json +5 -5
  195. package/templates/resource-graphs/headless.json +1 -1
  196. package/templates/template/.claude/hooks/post-edit-collection.sh +27 -23
  197. package/templates/template/.cursorrules +2 -2
  198. package/templates/template/.env.example +6 -17
  199. package/templates/template/.github/copilot-instructions.md +2 -2
  200. package/templates/template/.windsurfrules +2 -2
  201. package/templates/template/AGENTS.md +2 -2
  202. package/templates/template/CLAUDE.md +2 -2
  203. package/templates/template/README.md +47 -13
  204. package/templates/template/ai-instructions.md +15 -14
  205. package/templates/template/backend/functions/hello.ts +1 -1
  206. package/templates/template/backend/package.json +0 -2
  207. package/templates/template/{config → backend}/resources.ts +3 -3
  208. package/templates/template/backend/schema/authors.ts +11 -0
  209. package/templates/template/backend/schema/index.ts +29 -0
  210. package/templates/template/backend/schema/posts.ts +29 -0
  211. package/templates/template/backend/schema/tags.ts +9 -0
  212. package/templates/template/backend/schema/users.ts +32 -0
  213. package/templates/template/{config → backend}/storage.ts +4 -4
  214. package/templates/template/backend/tsconfig.json +15 -20
  215. package/templates/template/docker-compose.yml +3 -3
  216. package/templates/template/frontend/package.json +0 -2
  217. package/templates/template/frontend/src/App.tsx +10 -4
  218. package/templates/template/frontend/src/cms/authors.tsx +7 -0
  219. package/templates/template/frontend/src/cms/posts.tsx +27 -0
  220. package/templates/template/frontend/src/cms/tags.tsx +11 -0
  221. package/templates/template/frontend/src/cms/ui-config.json +3 -0
  222. package/templates/template/frontend/src/cms/users.tsx +54 -0
  223. package/templates/template/frontend/src/{virtual.d.ts → vite-env.d.ts} +0 -4
  224. package/templates/template/frontend/vite.config.ts +6 -2
  225. package/templates/template/gitignore +1 -1
  226. package/templates/template/package.json +1 -2
  227. package/templates/template/pnpm-workspace.yaml +0 -1
  228. package/templates/template/scripts/example.ts +3 -3
  229. package/templates/template/tsconfig.json +1 -1
  230. package/templates/views/AppView.tsx.tmpl +4 -4
  231. package/templates/views/EntityView.tsx.tmpl +3 -4
  232. package/dist/api-keys-Dfw5-9s1.js.map +0 -1
  233. package/dist/apps-MKQbgDtN.js.map +0 -1
  234. package/dist/build-BuKTnec8.js.map +0 -1
  235. package/dist/bundle-BAH4FCju.js.map +0 -1
  236. package/dist/cloud-Cj5ey3l_.js.map +0 -1
  237. package/dist/collection-drift-BKj_BoMq.js +0 -106
  238. package/dist/collection-drift-BKj_BoMq.js.map +0 -1
  239. package/dist/collections-dir-DlvDhime.js +0 -69
  240. package/dist/collections-dir-DlvDhime.js.map +0 -1
  241. package/dist/console-CdwIYOMV.js.map +0 -1
  242. package/dist/context-AXdAh-q8.js.map +0 -1
  243. package/dist/db-DBbKpjYX.js.map +0 -1
  244. package/dist/derive-ae9UOoOB.js.map +0 -1
  245. package/dist/dev-C93d4QIv.js.map +0 -1
  246. package/dist/dev-preflight-Cxv3TiD1.js.map +0 -1
  247. package/dist/doctor-BBPQUO2g.js.map +0 -1
  248. package/dist/eject-DABcDnPN.js.map +0 -1
  249. package/dist/fold-static-BWzxNn06.js.map +0 -1
  250. package/dist/generate-view-IFwCADvb.js.map +0 -1
  251. package/dist/generate_sdk-DNmNuFuW.js.map +0 -1
  252. package/dist/init-vL1DWOeC.js.map +0 -1
  253. package/dist/last-dev-database-DpW5dfoX.js +0 -2
  254. package/dist/manifest-BtzDy7KQ.js.map +0 -1
  255. package/dist/path-flags-DNvtEi2-.js +0 -92
  256. package/dist/path-flags-DNvtEi2-.js.map +0 -1
  257. package/dist/project-CasK56vN.js.map +0 -1
  258. package/dist/pull-DDMpsZ5r.js.map +0 -1
  259. package/dist/resolve-D647F1LA.js +0 -2
  260. package/dist/schema-DtLPsXbT.js.map +0 -1
  261. package/dist/schema-reconcile-DkArN9jF.js +0 -2
  262. package/dist/skills-CbwV6vw_.js.map +0 -1
  263. package/dist/status-BREvtzJm.js.map +0 -1
  264. package/dist/storage-CO9ouK76.js.map +0 -1
  265. package/dist/utils/collection-drift.d.ts +0 -27
  266. package/dist/utils/collections-dir.d.ts +0 -14
  267. package/dist/verify-Y3rWSgfA.js +0 -730
  268. package/dist/verify-Y3rWSgfA.js.map +0 -1
  269. package/templates/overlays/baas/config/index.ts +0 -24
  270. package/templates/overlays/baas/config/package.json +0 -30
  271. package/templates/template/config/cms.d.ts +0 -15
  272. package/templates/template/config/collections/authors.ts +0 -47
  273. package/templates/template/config/collections/index.ts +0 -44
  274. package/templates/template/config/collections/posts.ts +0 -94
  275. package/templates/template/config/collections/presets/blank/index.ts +0 -5
  276. package/templates/template/config/collections/presets/ecommerce/categories.ts +0 -42
  277. package/templates/template/config/collections/presets/ecommerce/index.ts +0 -31
  278. package/templates/template/config/collections/presets/ecommerce/orders.ts +0 -78
  279. package/templates/template/config/collections/presets/ecommerce/products.ts +0 -73
  280. package/templates/template/config/collections/tags.ts +0 -27
  281. package/templates/template/config/collections/users.ts +0 -149
  282. package/templates/template/config/frontend-assets.d.ts +0 -17
  283. package/templates/template/config/index.ts +0 -12
  284. package/templates/template/config/package.json +0 -30
  285. package/templates/template/config/tsconfig.json +0 -35
  286. /package/templates/eject/{config → backend}/resources.ts +0 -0
@@ -0,0 +1,81 @@
1
+ import type { SchemaModuleImporter } from "@rebasepro/server";
2
+ import { type LegacyCollectionConfig } from "@rebasepro/common/migrate";
3
+ import { type SecurityRule } from "@rebasepro/types";
4
+ /** A legacy collection, with the file it came from. */
5
+ export interface LoadedCollection {
6
+ collection: LegacyCollectionConfig;
7
+ /** The file, absolute. */
8
+ file: string;
9
+ }
10
+ /** A legacy project, evaluated. */
11
+ export interface LegacyProject {
12
+ /** The config directory (`config/`), absolute. */
13
+ configDir: string;
14
+ /** `<config>/collections`, absolute. */
15
+ collectionsDir: string;
16
+ /** Every collection, in the loader's order (file name order). */
17
+ collections: LoadedCollection[];
18
+ /** The index's `defaultSecurityRules`, when it exports any. */
19
+ defaultSecurityRules?: SecurityRule[];
20
+ /** The index's `collections` array, when it exports one: the panel's navigation order. */
21
+ navigationOrder?: LegacyCollectionConfig[];
22
+ /** Named exports of `<config>/index.ts`, when there is one (to find `callbacks`, `storageAuthorize`). */
23
+ configIndexExports: string[];
24
+ /**
25
+ * Files of `<config>/collections` that export no collection at all — no
26
+ * default export, and no named export shaped like one: helpers the
27
+ * collection files import (`_predicates.ts`), absolute. A project that passed
28
+ * its collections as an array never had its directory read, so these were
29
+ * never collections; they are moved like any other module of `config/`.
30
+ */
31
+ helperFiles: string[];
32
+ /**
33
+ * Firestore collections the project builds in a module the loader never
34
+ * read: a file under a subdirectory of `<config>/collections`, or a function
35
+ * the index exports (`getAllFirestoreCollections()`), which the app spread
36
+ * into the panel's collections. Empty when there are none.
37
+ */
38
+ builtFirestore: BuiltFirestoreCollection[];
39
+ /** The zero-argument functions that returned Firestore collections, with what each returned. */
40
+ firestoreBuilders: FirestoreBuilder[];
41
+ }
42
+ /** A Firestore collection reached outside the loader's top-level files. */
43
+ export interface BuiltFirestoreCollection {
44
+ collection: LegacyCollectionConfig;
45
+ /**
46
+ * The module whose default export is this collection's object (or one with
47
+ * its slug), absolute — absent when the collection only exists as what a
48
+ * call returns (built per locale, say), so no literal of its own exists.
49
+ */
50
+ file?: string;
51
+ }
52
+ /** An exported zero-argument function that returned Firestore collections. */
53
+ export interface FirestoreBuilder {
54
+ /** The module that exports it, absolute. */
55
+ file: string;
56
+ /** Its export name. */
57
+ exportName: string;
58
+ /** The slugs it returned, in order. */
59
+ slugs: string[];
60
+ /**
61
+ * The slugs it returned as a different object than their file exports — a
62
+ * copy the builder changed at run time (added a field, say), which a
63
+ * conversion of the file alone does not carry.
64
+ */
65
+ changed: string[];
66
+ }
67
+ /** A module importer: the CLI's jiti importer (`createSchemaModuleImporter`), or a stand-in in tests. */
68
+ export type ModuleImporter = SchemaModuleImporter;
69
+ /** The loader's file filter (`isCollectionFile` in `@rebasepro/server`). */
70
+ export declare function isLegacyCollectionFile(file: string): boolean;
71
+ /** Thrown when the legacy project cannot be evaluated: its own loader would refuse it too. */
72
+ export declare class LegacyLoadError extends Error {
73
+ readonly file?: string | undefined;
74
+ constructor(message: string, file?: string | undefined);
75
+ }
76
+ /**
77
+ * Evaluate `<config>/collections` of a project.
78
+ *
79
+ * @param configDir the config directory, absolute
80
+ */
81
+ export declare function loadLegacyProject(configDir: string, importModule: ModuleImporter): Promise<LegacyProject>;
@@ -0,0 +1,20 @@
1
+ import type { MigrateOptions, MigrationReport } from "./types.js";
2
+ /**
3
+ * Whether the project's git tree is clean, or why it is not usable as a safety net.
4
+ *
5
+ * @param root the project root
6
+ */
7
+ export declare function gitState(root: string): {
8
+ clean: true;
9
+ } | {
10
+ clean: false;
11
+ reason: string;
12
+ };
13
+ /**
14
+ * Run the codemod on one project.
15
+ *
16
+ * The shims the legacy `config/` is loaded with are written into a directory
17
+ * of this run's own, deleted when the run is over — whether it succeeded,
18
+ * refused or threw (see `ShimDir`).
19
+ */
20
+ export declare function migrateCollectionsToTables(options: MigrateOptions): Promise<MigrationReport>;
@@ -0,0 +1,127 @@
1
+ import type { AstContext, ImportUse } from "./ast.js";
2
+ /** Which side of the split a file lives on. */
3
+ export type Side = "backend" | "frontend";
4
+ /** A module specifier that cannot be moved, and why. */
5
+ export declare class RelocationError extends Error {
6
+ readonly file: string;
7
+ constructor(file: string, message: string);
8
+ }
9
+ /** How a relative specifier was written, so the moved one is written the same way. */
10
+ export type SpecifierStyle = "extensionless" | "directory" | {
11
+ extension: string;
12
+ };
13
+ export interface ResolvedSpecifier {
14
+ target: string;
15
+ style: SpecifierStyle;
16
+ }
17
+ /** The file a relative specifier written in `fromFile` names, and how it was written. */
18
+ export declare function resolveRelative(fromFile: string, specifier: string): ResolvedSpecifier;
19
+ /** A relative specifier from `fromFile` to `target`, written in `style`. */
20
+ export declare function writeSpecifier(fromFile: string, target: string, style: SpecifierStyle): string;
21
+ /** One helper module copied out of `config/`. */
22
+ export interface HelperCopy {
23
+ /** Where it was, absolute. */
24
+ from: string;
25
+ /** Where it goes, absolute. */
26
+ to: string;
27
+ side: Side;
28
+ }
29
+ /**
30
+ * Moves specifiers and collects the helper copies they need. One per run, so
31
+ * a helper used by several files is copied once per side.
32
+ */
33
+ export declare class Relocator {
34
+ private readonly ctx;
35
+ private readonly projectRoot;
36
+ private readonly configDir;
37
+ private readonly collectionFiles;
38
+ private readonly libDirs;
39
+ readonly helpers: Map<string, HelperCopy>;
40
+ /** Modules of the project's own in config/ that backend code the run writes imports in place. */
41
+ readonly keptBackendModules: Set<string>;
42
+ /** Modules outside config/collections the run edits in place for the panel (a shared `dynamicProps` builder). */
43
+ readonly keptFrontendModules: Set<string>;
44
+ /** Edits to a module's own text before it is copied or kept (a helper's callbacks as table hooks), by absolute path. */
45
+ readonly sourceEdits: Map<string, {
46
+ start: number;
47
+ end: number;
48
+ text: string;
49
+ }[]>;
50
+ /**
51
+ * Queue edits to a module's own text (deduplicated by position), dropping
52
+ * any copy of it already made so the next one carries them.
53
+ */
54
+ addSourceEdits(file: string, edits: readonly {
55
+ start: number;
56
+ end: number;
57
+ text: string;
58
+ }[]): void;
59
+ /** A module's text with its {@link sourceEdits} applied. */
60
+ editedSource(file: string): string;
61
+ /** Collection files that move rather than become tables (Firestore ones): legacy path → new path. */
62
+ readonly moved: Map<string, string>;
63
+ constructor(ctx: AstContext, projectRoot: string, configDir: string, collectionFiles: ReadonlySet<string>, libDirs: Readonly<Record<Side, string>>);
64
+ /** The config directory, absolute. */
65
+ get configDirectory(): string;
66
+ /** Whether `file` is inside `<config>/collections`, which the migration removes. */
67
+ isInCollections(file: string): boolean;
68
+ /** Whether `file` is inside the config directory. */
69
+ isInConfig(file: string): boolean;
70
+ /** The specifier `specifier` (written in `fromFile`) becomes when written in `destFile`. */
71
+ relocate(specifier: string, fromFile: string, destFile: string, side: Side): string;
72
+ private copyHelper;
73
+ private readonly contents;
74
+ /** A helper's content in its new home: its relative specifiers moved. */
75
+ helperContent(copy: HelperCopy): string;
76
+ /**
77
+ * A module of config/ that backend code imports in place, with the
78
+ * collection-model types it imports replaced by table-model aliases (as a
79
+ * copy to backend/lib gets them): the hooks it serves are table hooks now.
80
+ */
81
+ keptBackendContent(file: string): string;
82
+ /** Collection-model types left in moved backend code (used with type arguments), for the report. */
83
+ readonly legacyTypesLeft: {
84
+ file: string;
85
+ name: string;
86
+ }[];
87
+ /** Edits replacing the collection-model types a moved backend module imports (see {@link replaceLegacyTypes}). */
88
+ private legacyTypeEdits;
89
+ /**
90
+ * Every module specifier in `text` (static imports, re-exports, dynamic
91
+ * `import()`), moved from `fromFile` to `destFile`.
92
+ */
93
+ moveSpecifiersInText(text: string, fromFile: string, destFile: string, side: Side): string;
94
+ }
95
+ /**
96
+ * Collection-model types a backend helper used, and what each is in the table
97
+ * model (from `@rebasepro/server/schema`, which a backend depends on). A
98
+ * helper keeps its own name for the type — `type EntityCallbackContext =
99
+ * TableHookProps["context"];` — so its body is untouched.
100
+ */
101
+ export declare const LEGACY_TYPE_REPLACEMENTS: Readonly<Record<string, {
102
+ type: string;
103
+ expression: string;
104
+ }>>;
105
+ /** What {@link replaceLegacyTypes} decided. */
106
+ export interface LegacyTypeReplacement {
107
+ /** The uses still imported as they were. */
108
+ kept: ImportUse[];
109
+ /** `import type { … } from "@rebasepro/server/schema";`, when any type was replaced. */
110
+ imports: string[];
111
+ /** `type <local> = <replacement>;`, one per replaced binding. */
112
+ aliases: string[];
113
+ /** A binding used with type arguments, which an alias cannot stand for. */
114
+ unreplaceable: string[];
115
+ }
116
+ /**
117
+ * Replace collection-model types a backend module imports with their
118
+ * table-model equivalents, as local aliases.
119
+ *
120
+ * @param text the code that uses them, to tell a generic use (`AfterSaveProps<M>`) apart
121
+ */
122
+ export declare function replaceLegacyTypes(uses: readonly ImportUse[], text: string): LegacyTypeReplacement;
123
+ /**
124
+ * The import block of a generated module: the uses, grouped by (moved)
125
+ * specifier, in first-use order, each binding once.
126
+ */
127
+ export declare function importLines(uses: readonly ImportUse[], relocate: (use: ImportUse) => string): string[];
@@ -0,0 +1,70 @@
1
+ import type { SourceFile } from "ts-morph";
2
+ import type { AstContext } from "./ast.js";
3
+ import type { ManualStep, MovedSymbol, Note } from "./types.js";
4
+ /** A replacement of `[start, end)` in a file's text. */
5
+ export interface TextEdit {
6
+ start: number;
7
+ end: number;
8
+ text: string;
9
+ }
10
+ /** One name an import or re-export of the file now takes from another package or under another name. */
11
+ export interface MovedName {
12
+ symbol: string;
13
+ from: string;
14
+ to: string;
15
+ as?: string;
16
+ }
17
+ /** What the pass found in one file. */
18
+ export interface MovedImportsResult {
19
+ edits: TextEdit[];
20
+ moved: MovedName[];
21
+ manualSteps: ManualStep[];
22
+ }
23
+ /** The row for a name imported from a module, if it moved or changed. */
24
+ export declare function movedSymbol(from: string, symbol: string): MovedSymbol | undefined;
25
+ /** Every row of the table (generated rows win), for the report and the tests. */
26
+ export declare function movedSymbolTable(): readonly MovedSymbol[];
27
+ /** The package a module specifier belongs to (`@rebasepro/common/migrate` → `@rebasepro/common`). */
28
+ export declare function packageOf(specifier: string): string;
29
+ /**
30
+ * Plan the moves of one file.
31
+ *
32
+ * @param ctx the AST context
33
+ * @param sf the file, parsed (syntax only)
34
+ * @param relative its path from the project root, for the steps
35
+ */
36
+ export declare function rewriteMovedImports(ctx: AstContext, sf: SourceFile, relative: string): MovedImportsResult;
37
+ /** Whether a file can hold anything this pass reads (so the rest are never parsed). */
38
+ export declare function mayNeedImportPass(text: string): boolean;
39
+ /**
40
+ * The spellings of a source file whose meaning changed (never rewritten):
41
+ * {@link CODE_SPELLINGS}, and the call options of {@link CALL_OPTION_CHANGES}.
42
+ */
43
+ export declare function detectChangedSpellings(ctx: AstContext, sf: SourceFile, relative: string): ManualStep[];
44
+ /** A dependency the run added to a workspace package. */
45
+ export interface AddedDependency {
46
+ /** The `package.json`, relative to the project root. */
47
+ file: string;
48
+ name: string;
49
+ version: string;
50
+ }
51
+ /**
52
+ * Add each package a moved import now names to the workspace package that
53
+ * imports it, when that package does not depend on it yet: in `dependencies`,
54
+ * with the range it gives its other `@rebasepro/*` packages (or the root's).
55
+ * A package with no such range to copy is a manual step.
56
+ *
57
+ * @param root the project root
58
+ * @param needed source file → the packages its imports now name
59
+ * @param read a file's current text (the migration's planned content first)
60
+ */
61
+ export declare function planDependencies(root: string, needed: ReadonlyMap<string, ReadonlySet<string>>, read: (file: string) => string | undefined,
62
+ /** Versions to use for packages the config package declared (carried code moved out of config/). */
63
+ configVersions?: ReadonlyMap<string, string>): {
64
+ files: Map<string, string>;
65
+ added: AddedDependency[];
66
+ manualSteps: ManualStep[];
67
+ notes: Note[];
68
+ };
69
+ /** The old CLI spellings in a `package.json`'s scripts: a manual step, never rewritten. */
70
+ export declare function detectScriptSpellings(manifestText: string, relative: string): ManualStep[];
@@ -0,0 +1,12 @@
1
+ /**
2
+ * GENERATED by tooling/scripts/codemod/moved-symbols-table.mjs from
3
+ * tooling/scripts/headless-guard/moved-symbols.json and
4
+ * tooling/scripts/headless-guard/cms-only-symbols.json — do not edit by hand: change
5
+ * the JSON and run the script again. `moved-imports.test.ts` fails while they disagree.
6
+ *
7
+ * Every symbol that left a package's root in 0.31: `to` is the package to import it from now
8
+ * (`as`: under that name), or null when it is gone and `instead` says what to write.
9
+ */
10
+ import type { MovedSymbol } from "./types.js";
11
+ /** The symbols that moved or were removed, by the package they left. */
12
+ export declare const MOVED_SYMBOLS: readonly MovedSymbol[];
@@ -0,0 +1,10 @@
1
+ /**
2
+ * A record's own entry, never one inherited from `Object.prototype`.
3
+ *
4
+ * The codemod looks keys up by names it read from user code, and a name can be
5
+ * `toString` or `constructor`: `RECORD[name]` would hand back a function.
6
+ *
7
+ * @param record a plain record
8
+ * @param key the key, as read
9
+ */
10
+ export declare function own<T>(record: Readonly<Record<string, T>>, key: string): T | undefined;
@@ -0,0 +1,26 @@
1
+ /** One alias: `prefix` (with its trailing `/` for a wildcard) → an absolute path. */
2
+ export interface PathAlias {
3
+ /** What a specifier starts with: `@config/` for `@config/*`, `@config` for a Vite alias, the whole key for an exact entry. */
4
+ prefix: string;
5
+ /** Whether the rest of the specifier is appended to `target` (`@config/*`, or a Vite alias). */
6
+ wildcard: boolean;
7
+ /** Exact (non-wildcard) Vite aliases also match `prefix/…`. */
8
+ vite: boolean;
9
+ /** The directory (wildcard) or module (exact) it names, absolute. */
10
+ target: string;
11
+ /** The directory whose files the alias applies to (the tsconfig's or Vite config's), absolute. */
12
+ scope: string;
13
+ }
14
+ /**
15
+ * Every alias the project's tsconfig files (`compilerOptions.paths`) and Vite
16
+ * configs (`resolve.alias` written as `path.resolve(__dirname, …)`) declare,
17
+ * in the project root and the directories below it. A tsconfig that extends
18
+ * another is read as written: its own `paths` only.
19
+ */
20
+ export declare function readPathAliases(root: string): PathAlias[];
21
+ /**
22
+ * The relative specifier an aliased one stands for, from `fromFile` — or
23
+ * undefined when no alias in scope matches it. Longer prefixes win, as both
24
+ * TypeScript and Vite match the most specific entry.
25
+ */
26
+ export declare function aliasToRelative(aliases: readonly PathAlias[], fromFile: string, specifier: string): string | undefined;
@@ -0,0 +1,49 @@
1
+ import type { SourceFile } from "ts-morph";
2
+ import type { LegacyCollectionConfig } from "@rebasepro/common/migrate";
3
+ import type { AstContext, CollectionSite } from "./ast.js";
4
+ import type { Relocator } from "./modules.js";
5
+ import type { SplitConstant } from "./split-constants.js";
6
+ import type { ManualStep, Note, Refusal } from "./types.js";
7
+ /** One legacy collection with everything the planners read about it. */
8
+ export interface CollectionEntry {
9
+ collection: LegacyCollectionConfig;
10
+ /** The collection file, absolute. */
11
+ file: string;
12
+ /** Its AST. */
13
+ sourceFile: SourceFile;
14
+ /** Where its literal is, when the codemod could find it. */
15
+ site?: CollectionSite;
16
+ /** Why the literal could not be found, when it could not. */
17
+ siteProblem?: string;
18
+ }
19
+ /** The shared state of one planning run. */
20
+ export interface PlanContext {
21
+ /** The project root, absolute. */
22
+ root: string;
23
+ ast: AstContext;
24
+ relocator: Relocator;
25
+ /** The frontend app's root directory, absolute, when the project has one. */
26
+ frontendDir?: string;
27
+ /** Planned files: absolute path → content. */
28
+ files: Map<string, {
29
+ content: string;
30
+ role: string;
31
+ }>;
32
+ refusals: Refusal[];
33
+ notes: Note[];
34
+ manualSteps: ManualStep[];
35
+ /** Enum constants of `config/` split into backend values and CMS labels (see `split-constants.ts`). */
36
+ splitConstants?: SplitConstant[];
37
+ }
38
+ /** A path relative to the project root, `/`-separated. */
39
+ export declare function relativeToRoot(plan: PlanContext, file: string): string;
40
+ /** Record a refusal about one collection. */
41
+ export declare function refuse(plan: PlanContext, entry: CollectionEntry | undefined, reason: string, extra?: {
42
+ key?: string;
43
+ line?: number;
44
+ file?: string;
45
+ }): void;
46
+ /** Record a note about one collection. */
47
+ export declare function note(plan: PlanContext, entry: CollectionEntry | undefined, message: string, line?: number): void;
48
+ /** Plan a file, refusing a second, different content for the same path. */
49
+ export declare function planFile(plan: PlanContext, file: string, content: string, role: string): void;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Printing plain values as TypeScript source, with code spliced in.
3
+ *
4
+ * The codemod writes two kinds of value: data it read off an evaluated
5
+ * collection (strings, numbers, arrays, objects), printed here, and code it
6
+ * read off the legacy source (a hook, an entity action, a component), carried
7
+ * as {@link RawSource} and printed verbatim, re-indented to where it lands.
8
+ *
9
+ * Same conventions as the shared table printer: four-space indentation,
10
+ * double quotes, no trailing commas, one entry per line for a non-empty
11
+ * object.
12
+ */
13
+ /** Source text printed verbatim. Its first line starts at column 0; later lines carry their indentation relative to it. */
14
+ export declare class RawSource {
15
+ readonly text: string;
16
+ constructor(text: string);
17
+ }
18
+ /** An object key as written: bare when it is an identifier, quoted otherwise. */
19
+ export declare function printKey(key: string): string;
20
+ /** A string literal, double-quoted. */
21
+ export declare function printStringLiteral(value: string): string;
22
+ /**
23
+ * Re-indent raw source to land at `indent`: every line after the first gets
24
+ * the prefix, so the block keeps its own shape.
25
+ */
26
+ export declare function reindent(text: string, indent: string): string;
27
+ /**
28
+ * Strip the indentation a node had in its file: `text` is the node's text
29
+ * (its first line starts at the node), `baseIndent` the leading whitespace of
30
+ * the line it starts on. Later lines that start with that whitespace lose it.
31
+ */
32
+ export declare function dedent(text: string, baseIndent: string): string;
33
+ /** Thrown for a value that is code, and that no source text was found for. */
34
+ export declare class UnprintableValueError extends Error {
35
+ readonly path: string;
36
+ constructor(path: string, message: string);
37
+ }
38
+ /** Whether a value holds a function anywhere: it then needs source text to print. */
39
+ export declare function containsCode(value: unknown, seen?: Set<unknown>): boolean;
40
+ /**
41
+ * A value as source text, starting at `indent` (the indentation of the line
42
+ * it begins on).
43
+ */
44
+ export declare function printValue(value: unknown, indent?: string, path?: string): string;
@@ -0,0 +1,144 @@
1
+ import type { AstContext } from "./ast.js";
2
+ import { type PathAlias } from "./path-aliases.js";
3
+ import type { PlanContext } from "./plan-context.js";
4
+ import type { ManualStep } from "./types.js";
5
+ type JsonObject = Record<string, unknown>;
6
+ /** What `rebase.json` says about the layout, read raw (the CLI's parser refuses the legacy keys). */
7
+ export interface RawManifest {
8
+ file: string;
9
+ text: string;
10
+ value: JsonObject;
11
+ /** The backend app's key in `apps`. */
12
+ backendName?: string;
13
+ /** The config directory, relative to the root. */
14
+ configDir: string;
15
+ /** The frontend (static) app's root, relative to the root, when there is one. */
16
+ frontendRoot?: string;
17
+ }
18
+ /** Read `rebase.json`, if there is one. */
19
+ export declare function readRawManifest(root: string): RawManifest;
20
+ /** `rebase.json` without `config` and `usersCollection` (the tables directory is the default, so no `tables` key). */
21
+ export declare function planManifest(plan: PlanContext, manifest: RawManifest): void;
22
+ /** The workspace, the packages and the scripts that named the config package or directory. */
23
+ export declare function planWorkspace(plan: PlanContext, configDir: string, frontendRoot: string | undefined, keepConfigPackage?: boolean): void;
24
+ /**
25
+ * backend/tsconfig.json once `config/` is gone: `../config/**` out of
26
+ * `include` and the new modules in; `rootDir ".."` (which existed only so the
27
+ * program could reach ../config) back to `"."`, its comment and the include's
28
+ * comment rid of the config package; a `drizzle.config.ts` include that names
29
+ * no file dropped. With `rootDir "."` the emit moves from `dist/backend/src` to
30
+ * `dist/src`, so the scripts, `entrypoint.sh` and Dockerfile that name the old
31
+ * path follow. A tsconfig not in that shape is a manual step.
32
+ */
33
+ export declare function planBackendTsconfig(plan: PlanContext, wanted: readonly string[], keepConfig?: boolean): void;
34
+ /** A legacy config module that moves to `backend/`, with its imports moved. */
35
+ export declare function planMove(plan: PlanContext, from: string, to: string, role: string): boolean;
36
+ /**
37
+ * The file the collection editor writes presentation to in development, as
38
+ * `rebase init` ships it (`templates/template/frontend/src/cms/ui-config.json`),
39
+ * and the two lines that mount it — the import and the `<RebaseCMS>` prop.
40
+ */
41
+ export declare const UI_CONFIG_CONTENT = "{\n \"tables\": {}\n}\n";
42
+ /** The frontend's wiring: `App.tsx`, `vite.config.ts`, `virtual.d.ts`, `src/cms/ui-config.json`. */
43
+ export declare function planFrontendWiring(plan: PlanContext, frontendDir: string, hasExternal: boolean): void;
44
+ /**
45
+ * The other static apps `rebase.json` declares (a public site beside the
46
+ * panel): `rebase build` refuses every one whose Vite config lacks
47
+ * `rebaseBackendGuard()`, not only `frontend/`. Each without it is a manual
48
+ * step — the codemod does not add a dependency on `@rebasepro/app` to an app
49
+ * that may not have one.
50
+ */
51
+ export declare function planStaticAppGuards(plan: PlanContext, frontendDir: string | undefined): void;
52
+ /** Files of `config/` nothing the codemod moved needs, which the user should look at before deleting the directory. */
53
+ export declare function unmovedConfigFiles(plan: PlanContext, configDir: string, handled: ReadonlySet<string>): string[];
54
+ /** Where a module that imported something from `config/` should import it from now. */
55
+ export interface ConfigImporter {
56
+ file: string;
57
+ line: number;
58
+ /** As written: relative, or through a path alias (`@config/collections/posts`). */
59
+ specifier: string;
60
+ /** The same import written relative to the file (equal to `specifier` when it was). */
61
+ relativeSpecifier: string;
62
+ target: string;
63
+ }
64
+ /**
65
+ * Every module outside `config/` that imports something inside it — a custom
66
+ * backend entry importing `config/collections/users`, a test importing a
67
+ * collection — relative, or through a path alias the project's tsconfig
68
+ * `paths` or Vite `resolve.alias` declares. After the migration those imports
69
+ * point at nothing.
70
+ *
71
+ * @param skip files the run rewrites itself
72
+ */
73
+ export declare function findConfigImporters(root: string, configDir: string, skip: ReadonlySet<string>, aliases?: readonly PathAlias[]): ConfigImporter[];
74
+ /** A use of a server API the table model renamed. */
75
+ export interface LegacyApiUse {
76
+ file: string;
77
+ line: number;
78
+ /** The legacy name as written. */
79
+ api: string;
80
+ /** What it is now. */
81
+ replacement: string;
82
+ }
83
+ /** Every use of a renamed collection-model server API in the project's own code (outside `config/`). */
84
+ export declare function findLegacyApiUses(root: string, configDir: string, skip: ReadonlySet<string>, handled?: ReadonlySet<string>): LegacyApiUse[];
85
+ /**
86
+ * The modules of `config/` that are the project's own: everything but what
87
+ * Rebase read — `config/collections`, the wiring the run moves to `backend/`
88
+ * (`resources.ts`, `storage.ts`, `generated/register.ts`), the package's index,
89
+ * declarations and package files. 0.31 stops reading `config/collections`, not
90
+ * `config/`: these stay where they are, importable as before.
91
+ *
92
+ * @param moved the wiring files the run moves, absolute
93
+ */
94
+ export declare function keptConfigModules(plan: PlanContext, configDir: string, collectionsDir: string, moved: readonly string[]): string[];
95
+ /**
96
+ * The kept modules of `config/` nothing will import once the run is written:
97
+ * no file outside `config/` (read as the run leaves it), no kept module that is
98
+ * itself imported, and not the kept `config/index.ts`. A module whose only
99
+ * importers were the collections is dead weight once they are tables — it goes
100
+ * in the printed `git rm` line instead of staying as "the project's own".
101
+ *
102
+ * @param kept the kept modules, absolute
103
+ * @param removed files the run removes or moves (collections, moved wiring, a dropped index), absolute
104
+ * @param indexKept whether `config/index.ts` stays (its imports are live: the package entry)
105
+ */
106
+ export declare function unimportedConfigModules(plan: PlanContext, configDir: string, kept: readonly string[], removed: readonly string[], indexKept: boolean, aliases?: readonly PathAlias[]): string[];
107
+ /**
108
+ * Build and deploy files that name what the migration removes: the config
109
+ * workspace package by name (`pnpm --filter "<name>" run build`, a deploy
110
+ * workspace list, an `allowBuilds` entry) when the package goes, and the
111
+ * collections directory (`COPY config/collections`, a watcher on
112
+ * `../config/**`). The run rewrites `pnpm-workspace.yaml` and the manifests it
113
+ * owns; read as it leaves them, whatever still names these is a step per file
114
+ * with its lines — the codemod does not edit a Dockerfile or a CI pipeline.
115
+ *
116
+ * @param packageGoes whether the config package is removed (nothing of the project's own is left in it)
117
+ */
118
+ export declare function findDeployReferences(plan: PlanContext, configDir: string, collectionsDir: string, packageGoes: boolean): ManualStep[];
119
+ /** The names a module's text exports (`export { a, b as c }`, `export const x`); `export *` is not followed. */
120
+ export declare function exportedNamesOf(text: string): Set<string>;
121
+ /**
122
+ * The project's own code that still reads what the migration removes from
123
+ * `config/` in a way no import rewrite can fix — each a manual step with
124
+ * file:line, since the codemod cannot rewrite an assertion:
125
+ *
126
+ * - an import of a name `config/index.ts` no longer exports (`collections`,
127
+ * `storageAuthorize`, … — the re-exports of what Rebase read), relative, through
128
+ * a path alias, or by the config package's name;
129
+ * - a file that reads `config/collections` as TEXT (`readFileSync`, `readdirSync`,
130
+ * a path built with `path.join(…, "config", "collections")`): a test asserting
131
+ * over the collection files' source, a script listing them.
132
+ *
133
+ * @param removedIndexNames what the index exported before the run and does not after
134
+ * (every export when the index goes)
135
+ */
136
+ export declare function findLegacyConfigReads(plan: PlanContext, configDir: string, collectionsDir: string, removedIndexNames: ReadonlySet<string>, aliases?: readonly PathAlias[]): ManualStep[];
137
+ /**
138
+ * `config/index.ts` without its re-exports of what Rebase read
139
+ * (`export { collections } from "./collections"`, `export { storageAuthorize }
140
+ * from "./storage"`), so the package keeps exporting the project's own modules.
141
+ * Undefined when nothing but comments would be left: the index goes too.
142
+ */
143
+ export declare function withoutRebaseReexports(ctx: AstContext, indexFile: string, collectionsDir: string, moved: readonly string[]): string | undefined;
144
+ export {};
@@ -0,0 +1,50 @@
1
+ import type { PlanContext } from "./plan-context.js";
2
+ import type { ConfigImporter } from "./project-files.js";
3
+ /** A table a collection file became. */
4
+ export interface TableHome {
5
+ /** The exported identifier (`posts`). */
6
+ identifier: string;
7
+ /** The table module, absolute. */
8
+ file: string;
9
+ /** The customization module and its export, when one was written. */
10
+ cms?: {
11
+ identifier: string;
12
+ file: string;
13
+ };
14
+ }
15
+ /** What {@link repointConfigImports} needs to know about the run. */
16
+ export interface RepointContext {
17
+ configDir: string;
18
+ collectionsDir: string;
19
+ /** Collection files (absolute) → the table each became. */
20
+ tables: ReadonlyMap<string, TableHome>;
21
+ /** Rebase's own modules the run moved (absolute legacy path → new path). */
22
+ movedWiring: ReadonlyMap<string, string>;
23
+ /** Whether `config/index.ts` is removed (it re-exported nothing but what moved). */
24
+ indexRemoved: boolean;
25
+ }
26
+ /** An import repointed to a table module, whose uses are checked once the run's rewrites are done. */
27
+ export interface TableBinding {
28
+ /** The importing file, absolute. */
29
+ file: string;
30
+ /** The local name. */
31
+ local: string;
32
+ /** The table it now names. */
33
+ table: TableHome;
34
+ }
35
+ /**
36
+ * Rewrite the project's imports of what the migration removes from `config/`,
37
+ * planning each rewritten file; what cannot be rewritten is a manual step per
38
+ * file. Returns the bindings now naming a table, for {@link tableUseSteps}.
39
+ */
40
+ export declare function repointConfigImports(plan: PlanContext, ctx: RepointContext, importers: readonly ConfigImporter[]): TableBinding[];
41
+ /**
42
+ * The uses of a binding repointed to a table that read it as an object, one
43
+ * step per file, given the files as the run writes them (after the SDK
44
+ * rewrite, which may have removed a use, as `auth.collection`). A table
45
+ * definition is not a collection: `columns`, `hooks`, `rls` where a collection
46
+ * had `properties`, `callbacks`, `securityRules`.
47
+ *
48
+ * @param read a file's content as the run writes it
49
+ */
50
+ export declare function tableUseSteps(plan: PlanContext, bindings: readonly TableBinding[], read: (file: string) => string): void;
@@ -0,0 +1,7 @@
1
+ import type { PlanContext } from "./plan-context.js";
2
+ /**
3
+ * Rewrite or list the row-shaped hands in the frontend (planned contents first).
4
+ *
5
+ * @returns nothing; planned files are updated and one grouped step is pushed
6
+ */
7
+ export declare function planRowShapedHands(plan: PlanContext, frontendDir: string): void;