@rebasepro/cli 0.30.1 → 0.31.0-canary.g902a0ce
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.
- package/README.md +8 -7
- package/dist/{agent-setup-0uyfC7VX.js → agent-setup-DqAcoDcn.js} +10 -5
- package/dist/{agent-setup-0uyfC7VX.js.map → agent-setup-DqAcoDcn.js.map} +1 -1
- package/dist/{api-keys-Dfw5-9s1.js → api-keys-eIUjMqWn.js} +8 -7
- package/dist/api-keys-eIUjMqWn.js.map +1 -0
- package/dist/{apps-MKQbgDtN.js → apps-DExO4PEl.js} +8 -7
- package/dist/apps-DExO4PEl.js.map +1 -0
- package/dist/{project-CasK56vN.js → args-CaCcrYE1.js} +2 -351
- package/dist/args-CaCcrYE1.js.map +1 -0
- package/dist/{atlas-dev-database-BODqdCWt.js → atlas-dev-database-DOCKk6ht.js} +2 -2
- package/dist/{atlas-dev-database-BODqdCWt.js.map → atlas-dev-database-DOCKk6ht.js.map} +1 -1
- package/dist/{auth-Bv0rTbQX.js → auth-CyADghFQ.js} +7 -6
- package/dist/{auth-Bv0rTbQX.js.map → auth-CyADghFQ.js.map} +1 -1
- package/dist/backend-guard-C0mVkXBw.js +162 -0
- package/dist/backend-guard-C0mVkXBw.js.map +1 -0
- package/dist/{branch-pointer-BQUF6lYa.js → branch-pointer-DMPyvZoK.js} +1 -1
- package/dist/{build-BuKTnec8.js → build-CA5R07tw.js} +29 -9
- package/dist/build-CA5R07tw.js.map +1 -0
- package/dist/{bundle-BAH4FCju.js → bundle-DgILeA5b.js} +112 -138
- package/dist/bundle-DgILeA5b.js.map +1 -0
- package/dist/bundle.d.ts +35 -12
- package/dist/cli.d.ts +2 -2
- package/dist/{cloud-DtADfWwn.js → cloud-CYMk92iG.js} +72 -71
- package/dist/cloud-CYMk92iG.js.map +1 -0
- package/dist/cms-directories-BK3vcswg.js +33 -0
- package/dist/cms-directories-BK3vcswg.js.map +1 -0
- package/dist/codemod/collections-to-tables/ast.d.ts +135 -0
- package/dist/codemod/collections-to-tables/backend.d.ts +38 -0
- package/dist/codemod/collections-to-tables/command.d.ts +35 -0
- package/dist/codemod/collections-to-tables/comments.d.ts +45 -0
- package/dist/codemod/collections-to-tables/customization.d.ts +47 -0
- package/dist/codemod/collections-to-tables/dynamic-props.d.ts +34 -0
- package/dist/codemod/collections-to-tables/export-changes.d.ts +83 -0
- package/dist/codemod/collections-to-tables/firestore.d.ts +11 -0
- package/dist/codemod/collections-to-tables/helper-hooks.d.ts +41 -0
- package/dist/codemod/collections-to-tables/hooks.d.ts +44 -0
- package/dist/codemod/collections-to-tables/journal.d.ts +10 -0
- package/dist/codemod/collections-to-tables/legacy-shims.d.ts +52 -0
- package/dist/codemod/collections-to-tables/load-legacy.d.ts +81 -0
- package/dist/codemod/collections-to-tables/migrate.d.ts +20 -0
- package/dist/codemod/collections-to-tables/modules.d.ts +127 -0
- package/dist/codemod/collections-to-tables/moved-imports.d.ts +70 -0
- package/dist/codemod/collections-to-tables/moved-symbols.generated.d.ts +12 -0
- package/dist/codemod/collections-to-tables/own.d.ts +10 -0
- package/dist/codemod/collections-to-tables/path-aliases.d.ts +26 -0
- package/dist/codemod/collections-to-tables/plan-context.d.ts +49 -0
- package/dist/codemod/collections-to-tables/print-js.d.ts +44 -0
- package/dist/codemod/collections-to-tables/project-files.d.ts +144 -0
- package/dist/codemod/collections-to-tables/repoint.d.ts +50 -0
- package/dist/codemod/collections-to-tables/row-hands.d.ts +7 -0
- package/dist/codemod/collections-to-tables/sdk-calls.d.ts +88 -0
- package/dist/codemod/collections-to-tables/skills-step.d.ts +13 -0
- package/dist/codemod/collections-to-tables/split-constants.d.ts +42 -0
- package/dist/codemod/collections-to-tables/storage-paths.d.ts +28 -0
- package/dist/codemod/collections-to-tables/types.d.ts +164 -0
- package/dist/codemod/collections-to-tables/verify.d.ts +27 -0
- package/dist/codemod/collections-to-tables/vocabulary.d.ts +40 -0
- package/dist/command-D5lhW_-B.js +9984 -0
- package/dist/command-D5lhW_-B.js.map +1 -0
- package/dist/commands/agent-setup.d.ts +6 -2
- package/dist/commands/cloud/context.d.ts +1 -1
- package/dist/commands/cloud/init.d.ts +2 -2
- package/dist/commands/console.d.ts +1 -2
- package/dist/commands/db.d.ts +5 -6
- package/dist/commands/dev.d.ts +18 -17
- package/dist/commands/doctor.d.ts +4 -5
- package/dist/commands/eject.d.ts +17 -13
- package/dist/commands/generate-view.d.ts +20 -9
- package/dist/commands/generate_sdk.d.ts +27 -27
- package/dist/commands/init.d.ts +21 -8
- package/dist/commands/migrate.d.ts +24 -0
- package/dist/commands/schema-reconcile.d.ts +1 -1
- package/dist/commands/skills.d.ts +8 -0
- package/dist/commands/verify-cms.d.ts +28 -0
- package/dist/commands/verify.d.ts +14 -9
- package/dist/{consent-BD7F29T3.js → consent-BXLIrMl8.js} +2 -2
- package/dist/{consent-BD7F29T3.js.map → consent-BXLIrMl8.js.map} +1 -1
- package/dist/{console-CdwIYOMV.js → console-CMjhgMUE.js} +14 -14
- package/dist/console-CMjhgMUE.js.map +1 -0
- package/dist/{context-AXdAh-q8.js → context--JwaHaZp.js} +6 -5
- package/dist/context--JwaHaZp.js.map +1 -0
- package/dist/{daemon-Cp7oNXth.js → daemon-w30PsdwV.js} +2 -2
- package/dist/{daemon-Cp7oNXth.js.map → daemon-w30PsdwV.js.map} +1 -1
- package/dist/{db-DBbKpjYX.js → db-A7XDCIIO.js} +51 -51
- package/dist/db-A7XDCIIO.js.map +1 -0
- package/dist/{derive-ae9UOoOB.js → derive-C3ezmY-p.js} +105 -133
- package/dist/derive-C3ezmY-p.js.map +1 -0
- package/dist/dev-db/attver.d.ts +11 -0
- package/dist/{dev-preflight-Cxv3TiD1.js → dev-preflight-DjvcV6SK.js} +5 -5
- package/dist/dev-preflight-DjvcV6SK.js.map +1 -0
- package/dist/{dev-server-OJsUGZEB.js → dev-server-BLxCbQEP.js} +2 -2
- package/dist/{dev-server-OJsUGZEB.js.map → dev-server-BLxCbQEP.js.map} +1 -1
- package/dist/{dev-C93d4QIv.js → dev-tWwPyWkQ.js} +142 -84
- package/dist/dev-tWwPyWkQ.js.map +1 -0
- package/dist/{doctor-BBPQUO2g.js → doctor-BBM0dWvZ.js} +39 -62
- package/dist/doctor-BBM0dWvZ.js.map +1 -0
- package/dist/doctor-environment.d.ts +6 -6
- package/dist/{eject-DABcDnPN.js → eject-Bhzd6hgb.js} +25 -16
- package/dist/eject-Bhzd6hgb.js.map +1 -0
- package/dist/{fold-static-BWzxNn06.js → fold-static-CKewnAPX.js} +5 -3
- package/dist/fold-static-CKewnAPX.js.map +1 -0
- package/dist/{generate-view-IFwCADvb.js → generate-view-CTOluXvH.js} +160 -89
- package/dist/generate-view-CTOluXvH.js.map +1 -0
- package/dist/{generate_sdk-DNmNuFuW.js → generate_sdk-De-aLC1L.js} +120 -137
- package/dist/generate_sdk-De-aLC1L.js.map +1 -0
- package/dist/import-schema-module-Df67TIWj.js +51 -0
- package/dist/import-schema-module-Df67TIWj.js.map +1 -0
- package/dist/index.es.js +64 -51
- package/dist/index.es.js.map +1 -1
- package/dist/{init-vL1DWOeC.js → init-Dtl-IcXf.js} +83 -80
- package/dist/init-Dtl-IcXf.js.map +1 -0
- package/dist/last-dev-database-Dc8cP01o.js +2 -0
- package/dist/{manifest-BtzDy7KQ.js → manifest-C3uLDrrJ.js} +115 -40
- package/dist/manifest-C3uLDrrJ.js.map +1 -0
- package/dist/manifest.d.ts +79 -24
- package/dist/migrate-VrKoi3nB.js +138 -0
- package/dist/migrate-VrKoi3nB.js.map +1 -0
- package/dist/{normalize-imports-Bd5Y4yLp.js → normalize-imports-DwxqEMYq.js} +3 -3
- package/dist/{normalize-imports-Bd5Y4yLp.js.map → normalize-imports-DwxqEMYq.js.map} +1 -1
- package/dist/path-flags-7O5uPBcQ.js +139 -0
- package/dist/path-flags-7O5uPBcQ.js.map +1 -0
- package/dist/{prepare-CTw9NEkh.js → prepare-Ccxspoj-.js} +4 -4
- package/dist/{prepare-CTw9NEkh.js.map → prepare-Ccxspoj-.js.map} +1 -1
- package/dist/project-CLcF5i8c.js +360 -0
- package/dist/project-CLcF5i8c.js.map +1 -0
- package/dist/project-schema-CsSOG2gE.js +30 -0
- package/dist/project-schema-CsSOG2gE.js.map +1 -0
- package/dist/{pull-DDMpsZ5r.js → pull-D9WvpDYY.js} +189 -1
- package/dist/pull-D9WvpDYY.js.map +1 -0
- package/dist/resolve-BY7bSFRT.js +2 -0
- package/dist/resources/derive.d.ts +19 -13
- package/dist/{resources-CPSC5Kcu.js → resources-Dpfs2y8P.js} +5 -4
- package/dist/{resources-CPSC5Kcu.js.map → resources-Dpfs2y8P.js.map} +1 -1
- package/dist/{schema-DtLPsXbT.js → schema-DwFDI1iU.js} +41 -39
- package/dist/schema-DwFDI1iU.js.map +1 -0
- package/dist/schema-dir-Cd1kvYbf.js +98 -0
- package/dist/schema-dir-Cd1kvYbf.js.map +1 -0
- package/dist/schema-reconcile-Tto54Qbv.js +2 -0
- package/dist/schema-text-CpNrsuMe.js +73 -0
- package/dist/schema-text-CpNrsuMe.js.map +1 -0
- package/dist/{skills-CbwV6vw_.js → skills-CXjA9TWw.js} +54 -10
- package/dist/skills-CXjA9TWw.js.map +1 -0
- package/dist/{start-YOr3X5Zm.js → start-Bwbtt2W5.js} +7 -10
- package/dist/{start-YOr3X5Zm.js.map → start-Bwbtt2W5.js.map} +1 -1
- package/dist/{status-BREvtzJm.js → status-DQ_PPz4C.js} +12 -12
- package/dist/status-DQ_PPz4C.js.map +1 -0
- package/dist/{storage-CO9ouK76.js → storage-iTqj5-Av.js} +12 -11
- package/dist/storage-iTqj5-Av.js.map +1 -0
- package/dist/{telemetry-DwK5RQJl.js → telemetry-BP_1Cl9r.js} +4 -4
- package/dist/{telemetry-DwK5RQJl.js.map → telemetry-BP_1Cl9r.js.map} +1 -1
- package/dist/{telemetry-CgwJPVMO.js → telemetry-M3HjlyhZ.js} +2 -2
- package/dist/{telemetry-CgwJPVMO.js.map → telemetry-M3HjlyhZ.js.map} +1 -1
- package/dist/{upgrade-B7sVwL8S.js → upgrade-oZzJ13jM.js} +5 -4
- package/dist/{upgrade-B7sVwL8S.js.map → upgrade-oZzJ13jM.js.map} +1 -1
- package/dist/utils/backend-guard.d.ts +47 -0
- package/dist/utils/cms-directories.d.ts +6 -0
- package/dist/utils/dev-preflight.d.ts +2 -2
- package/dist/utils/import-schema-module.d.ts +16 -0
- package/dist/utils/path-flags.d.ts +35 -16
- package/dist/utils/project-schema.d.ts +40 -0
- package/dist/utils/project.d.ts +8 -2
- package/dist/utils/schema-dir.d.ts +32 -0
- package/dist/utils/schema-drift.d.ts +6 -0
- package/dist/utils/schema-text.d.ts +24 -0
- package/dist/verify-DkJqhYPI.js +1160 -0
- package/dist/verify-DkJqhYPI.js.map +1 -0
- package/package.json +11 -8
- package/runtime/dev-server.mjs +5 -1
- package/templates/eject/Dockerfile +1 -4
- package/templates/eject/backend/src/env.ts +1 -1
- package/templates/eject/backend/src/index.ts +53 -40
- package/templates/eject/docker-compose.custom.yml +1 -1
- package/templates/overlays/baas/README.md +39 -12
- package/templates/overlays/baas/ai-instructions.md +8 -8
- package/templates/overlays/baas/{config → backend}/storage.ts +3 -4
- package/templates/overlays/baas/backend/tsconfig.json +10 -12
- package/templates/overlays/baas/package.json +1 -2
- package/templates/overlays/baas/pnpm-workspace.yaml +0 -1
- package/templates/presets/blank/backend/schema/index.ts +19 -0
- package/templates/presets/blank/frontend/src/App.tsx +56 -0
- package/templates/presets/ecommerce/backend/schema/categories.ts +12 -0
- package/templates/presets/ecommerce/backend/schema/index.ts +23 -0
- package/templates/presets/ecommerce/backend/schema/orders.ts +13 -0
- package/templates/presets/ecommerce/backend/schema/products.ts +18 -0
- package/templates/presets/ecommerce/frontend/src/App.tsx +59 -0
- package/templates/presets/ecommerce/frontend/src/cms/categories.tsx +12 -0
- package/templates/presets/ecommerce/frontend/src/cms/orders.tsx +38 -0
- package/templates/presets/ecommerce/frontend/src/cms/products.tsx +27 -0
- package/templates/resource-graphs/blank.json +2 -2
- package/templates/resource-graphs/blog.json +5 -5
- package/templates/resource-graphs/ecommerce.json +5 -5
- package/templates/resource-graphs/headless.json +1 -1
- package/templates/template/.claude/hooks/post-edit-collection.sh +27 -23
- package/templates/template/.cursorrules +2 -2
- package/templates/template/.env.example +6 -17
- package/templates/template/.github/copilot-instructions.md +2 -2
- package/templates/template/.windsurfrules +2 -2
- package/templates/template/AGENTS.md +2 -2
- package/templates/template/CLAUDE.md +2 -2
- package/templates/template/README.md +47 -13
- package/templates/template/ai-instructions.md +15 -14
- package/templates/template/backend/functions/hello.ts +1 -1
- package/templates/template/backend/package.json +0 -2
- package/templates/template/{config → backend}/resources.ts +3 -3
- package/templates/template/backend/schema/authors.ts +11 -0
- package/templates/template/backend/schema/index.ts +29 -0
- package/templates/template/backend/schema/posts.ts +29 -0
- package/templates/template/backend/schema/tags.ts +9 -0
- package/templates/template/backend/schema/users.ts +32 -0
- package/templates/template/{config → backend}/storage.ts +4 -4
- package/templates/template/backend/tsconfig.json +15 -20
- package/templates/template/docker-compose.yml +3 -3
- package/templates/template/frontend/package.json +0 -2
- package/templates/template/frontend/src/App.tsx +10 -4
- package/templates/template/frontend/src/cms/authors.tsx +7 -0
- package/templates/template/frontend/src/cms/posts.tsx +27 -0
- package/templates/template/frontend/src/cms/tags.tsx +11 -0
- package/templates/template/frontend/src/cms/ui-config.json +3 -0
- package/templates/template/frontend/src/cms/users.tsx +54 -0
- package/templates/template/frontend/src/{virtual.d.ts → vite-env.d.ts} +0 -4
- package/templates/template/frontend/vite.config.ts +6 -2
- package/templates/template/gitignore +1 -1
- package/templates/template/package.json +1 -2
- package/templates/template/pnpm-workspace.yaml +0 -1
- package/templates/template/scripts/example.ts +3 -3
- package/templates/template/tsconfig.json +1 -1
- package/templates/views/AppView.tsx.tmpl +4 -4
- package/templates/views/EntityView.tsx.tmpl +3 -4
- package/dist/api-keys-Dfw5-9s1.js.map +0 -1
- package/dist/apps-MKQbgDtN.js.map +0 -1
- package/dist/build-BuKTnec8.js.map +0 -1
- package/dist/bundle-BAH4FCju.js.map +0 -1
- package/dist/cloud-DtADfWwn.js.map +0 -1
- package/dist/collection-drift-BKj_BoMq.js +0 -106
- package/dist/collection-drift-BKj_BoMq.js.map +0 -1
- package/dist/collections-dir-DlvDhime.js +0 -69
- package/dist/collections-dir-DlvDhime.js.map +0 -1
- package/dist/console-CdwIYOMV.js.map +0 -1
- package/dist/context-AXdAh-q8.js.map +0 -1
- package/dist/db-DBbKpjYX.js.map +0 -1
- package/dist/derive-ae9UOoOB.js.map +0 -1
- package/dist/dev-C93d4QIv.js.map +0 -1
- package/dist/dev-preflight-Cxv3TiD1.js.map +0 -1
- package/dist/doctor-BBPQUO2g.js.map +0 -1
- package/dist/eject-DABcDnPN.js.map +0 -1
- package/dist/fold-static-BWzxNn06.js.map +0 -1
- package/dist/generate-view-IFwCADvb.js.map +0 -1
- package/dist/generate_sdk-DNmNuFuW.js.map +0 -1
- package/dist/init-vL1DWOeC.js.map +0 -1
- package/dist/last-dev-database-DpW5dfoX.js +0 -2
- package/dist/manifest-BtzDy7KQ.js.map +0 -1
- package/dist/path-flags-DNvtEi2-.js +0 -92
- package/dist/path-flags-DNvtEi2-.js.map +0 -1
- package/dist/project-CasK56vN.js.map +0 -1
- package/dist/pull-DDMpsZ5r.js.map +0 -1
- package/dist/resolve-D647F1LA.js +0 -2
- package/dist/schema-DtLPsXbT.js.map +0 -1
- package/dist/schema-reconcile-DkArN9jF.js +0 -2
- package/dist/skills-CbwV6vw_.js.map +0 -1
- package/dist/status-BREvtzJm.js.map +0 -1
- package/dist/storage-CO9ouK76.js.map +0 -1
- package/dist/utils/collection-drift.d.ts +0 -27
- package/dist/utils/collections-dir.d.ts +0 -14
- package/dist/verify-Y3rWSgfA.js +0 -730
- package/dist/verify-Y3rWSgfA.js.map +0 -1
- package/templates/overlays/baas/config/index.ts +0 -24
- package/templates/overlays/baas/config/package.json +0 -30
- package/templates/template/config/cms.d.ts +0 -15
- package/templates/template/config/collections/authors.ts +0 -47
- package/templates/template/config/collections/index.ts +0 -44
- package/templates/template/config/collections/posts.ts +0 -94
- package/templates/template/config/collections/presets/blank/index.ts +0 -5
- package/templates/template/config/collections/presets/ecommerce/categories.ts +0 -42
- package/templates/template/config/collections/presets/ecommerce/index.ts +0 -31
- package/templates/template/config/collections/presets/ecommerce/orders.ts +0 -78
- package/templates/template/config/collections/presets/ecommerce/products.ts +0 -73
- package/templates/template/config/collections/tags.ts +0 -27
- package/templates/template/config/collections/users.ts +0 -149
- package/templates/template/config/frontend-assets.d.ts +0 -17
- package/templates/template/config/index.ts +0 -12
- package/templates/template/config/package.json +0 -30
- package/templates/template/config/tsconfig.json +0 -35
- /package/templates/eject/{config → backend}/resources.ts +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { b as loadManifest } from "./manifest-C3uLDrrJ.js";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
//#region src/utils/cms-directories.ts
|
|
5
|
+
/**
|
|
6
|
+
* Where a project keeps its table customizations.
|
|
7
|
+
*
|
|
8
|
+
* Its own module, outside `commands/`: the bundler reads it too, and nothing
|
|
9
|
+
* under `commands/` may sit on the CLI's startup import graph
|
|
10
|
+
* (`cli-startup-imports.test.ts`).
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The directories that hold the project's table customizations: `src/cms` of
|
|
14
|
+
* each static app `rebase.json` declares, and `frontend/src/cms`, the layout
|
|
15
|
+
* `rebase init` writes. Only those that exist; none for a headless project.
|
|
16
|
+
*/
|
|
17
|
+
function cmsDirectories(projectRoot) {
|
|
18
|
+
const roots = /* @__PURE__ */ new Set(["frontend"]);
|
|
19
|
+
try {
|
|
20
|
+
const { manifest } = loadManifest(projectRoot);
|
|
21
|
+
for (const app of Object.values(manifest.apps)) if (app.type === "static" && typeof app.root === "string") roots.add(app.root);
|
|
22
|
+
} catch {}
|
|
23
|
+
const out = [];
|
|
24
|
+
for (const root of roots) {
|
|
25
|
+
const dir = path.resolve(projectRoot, root, "src", "cms");
|
|
26
|
+
if (fs.existsSync(dir) && fs.statSync(dir).isDirectory() && !out.includes(dir)) out.push(dir);
|
|
27
|
+
}
|
|
28
|
+
return out;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { cmsDirectories as t };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=cms-directories-BK3vcswg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cms-directories-BK3vcswg.js","names":[],"sources":["../src/utils/cms-directories.ts"],"sourcesContent":["/**\n * Where a project keeps its table customizations.\n *\n * Its own module, outside `commands/`: the bundler reads it too, and nothing\n * under `commands/` may sit on the CLI's startup import graph\n * (`cli-startup-imports.test.ts`).\n */\nimport fs from \"fs\";\nimport path from \"path\";\nimport { loadManifest } from \"../manifest\";\n\n/**\n * The directories that hold the project's table customizations: `src/cms` of\n * each static app `rebase.json` declares, and `frontend/src/cms`, the layout\n * `rebase init` writes. Only those that exist; none for a headless project.\n */\nexport function cmsDirectories(projectRoot: string): string[] {\n const roots = new Set<string>([\"frontend\"]);\n try {\n const { manifest } = loadManifest(projectRoot);\n for (const app of Object.values(manifest.apps)) {\n if (app.type === \"static\" && typeof app.root === \"string\") roots.add(app.root);\n }\n } catch {\n // No rebase.json, or one another command reports: the conventional layout.\n }\n const out: string[] = [];\n for (const root of roots) {\n const dir = path.resolve(projectRoot, root, \"src\", \"cms\");\n if (fs.existsSync(dir) && fs.statSync(dir).isDirectory() && !out.includes(dir)) out.push(dir);\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAgB,eAAe,aAA+B;CAC1D,MAAM,wBAAQ,IAAI,IAAY,CAAC,UAAU,CAAC;CAC1C,IAAI;EACA,MAAM,EAAE,aAAa,aAAa,WAAW;EAC7C,KAAK,MAAM,OAAO,OAAO,OAAO,SAAS,IAAI,GACzC,IAAI,IAAI,SAAS,YAAY,OAAO,IAAI,SAAS,UAAU,MAAM,IAAI,IAAI,IAAI;CAErF,QAAQ,CAER;CACA,MAAM,MAAgB,CAAC;CACvB,KAAK,MAAM,QAAQ,OAAO;EACtB,MAAM,MAAM,KAAK,QAAQ,aAAa,MAAM,OAAO,KAAK;EACxD,IAAI,GAAG,WAAW,GAAG,KAAK,GAAG,SAAS,GAAG,CAAC,CAAC,YAAY,KAAK,CAAC,IAAI,SAAS,GAAG,GAAG,IAAI,KAAK,GAAG;CAChG;CACA,OAAO;AACX"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { ArrayLiteralExpression, Expression, Identifier, MethodDeclaration, Node, ObjectLiteralExpression, Project, SourceFile, Statement } from "ts-morph";
|
|
2
|
+
/** The ts-morph module, loaded lazily by the run. */
|
|
3
|
+
export type TsMorph = typeof import("ts-morph");
|
|
4
|
+
/** What every AST helper needs. */
|
|
5
|
+
export interface AstContext {
|
|
6
|
+
tsm: TsMorph;
|
|
7
|
+
/** An in-memory project holding the legacy files at their absolute paths, and scratch files. */
|
|
8
|
+
project: Project;
|
|
9
|
+
}
|
|
10
|
+
/** Create the in-memory project the legacy files are read into. */
|
|
11
|
+
export declare function createAstContext(tsm: TsMorph): AstContext;
|
|
12
|
+
/** Add a legacy file to the project, at its absolute path. */
|
|
13
|
+
export declare function addSourceFile(ctx: AstContext, absolutePath: string, text: string): SourceFile;
|
|
14
|
+
/** The node a lookup ended on, or why it could not get there. */
|
|
15
|
+
export type Located<T> = {
|
|
16
|
+
node: T;
|
|
17
|
+
reason?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
node?: undefined;
|
|
20
|
+
reason: string;
|
|
21
|
+
};
|
|
22
|
+
/** Strip `as`, `satisfies`, parentheses, `!` and `<T>` casts. */
|
|
23
|
+
export declare function unwrap(ctx: AstContext, node: Node): Node;
|
|
24
|
+
/** The top-level `const` an identifier names in its own file, or undefined. */
|
|
25
|
+
export declare function sameFileConst(ctx: AstContext, identifier: Identifier): Expression | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Follow a node to the object literal it denotes: through casts, a wrapper
|
|
28
|
+
* call (`defineCollection({...})`) and a same-file `const`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveObject(ctx: AstContext, node: Node | undefined, depth?: number): Located<ObjectLiteralExpression>;
|
|
31
|
+
/** Like {@link resolveObject}, for an array literal. */
|
|
32
|
+
export declare function resolveArray(ctx: AstContext, node: Node | undefined, depth?: number): Located<ArrayLiteralExpression>;
|
|
33
|
+
/** One member of an object literal, found by name. */
|
|
34
|
+
export interface Member {
|
|
35
|
+
/** The member node: a property assignment, a shorthand, or a method. */
|
|
36
|
+
node: Node;
|
|
37
|
+
/** The value expression (absent for a method, which is its own value). */
|
|
38
|
+
value?: Expression;
|
|
39
|
+
/** Present for a method. */
|
|
40
|
+
method?: MethodDeclaration;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The member of an object literal named `name`. Refuses (with the reason)
|
|
44
|
+
* when the literal has a spread or a computed key that could be providing
|
|
45
|
+
* it, because then the literal alone does not say where the value is from.
|
|
46
|
+
*/
|
|
47
|
+
export declare function memberOf(ctx: AstContext, literal: ObjectLiteralExpression, name: string): Located<Member>;
|
|
48
|
+
/**
|
|
49
|
+
* The value at `segments` below an object literal when an object literal on
|
|
50
|
+
* the way spreads the one object that must provide it — `{ ...fixedOnceCreated }`
|
|
51
|
+
* with no `dynamicProps` of its own — as an expression on that object:
|
|
52
|
+
* `fixedOnceCreated.dynamicProps`, the very value the evaluation saw. Returns
|
|
53
|
+
* the spread expression too, whose imports the caller carries.
|
|
54
|
+
*
|
|
55
|
+
* Only when nothing else could provide it: exactly one spread in that literal,
|
|
56
|
+
* no computed key, no member of that name (before or after the spread), a
|
|
57
|
+
* spread of an imported or top-level `const` name (not a call, not a
|
|
58
|
+
* parameter), and only names below it.
|
|
59
|
+
*/
|
|
60
|
+
export declare function spreadSource(ctx: AstContext, root: ObjectLiteralExpression, segments: readonly PathSegment[]): {
|
|
61
|
+
text: string;
|
|
62
|
+
spread: Expression;
|
|
63
|
+
} | undefined;
|
|
64
|
+
/** A path segment: a member name, or an array index. */
|
|
65
|
+
export type PathSegment = string | number;
|
|
66
|
+
/**
|
|
67
|
+
* The member at `segments` below an object literal: each name read with
|
|
68
|
+
* {@link memberOf}, each index from an array literal, every step resolved
|
|
69
|
+
* through same-file `const`s.
|
|
70
|
+
*/
|
|
71
|
+
export declare function nodeAtPath(ctx: AstContext, root: ObjectLiteralExpression, segments: readonly PathSegment[]): Located<Member>;
|
|
72
|
+
/** The whitespace a node's first line starts with in its file. */
|
|
73
|
+
export declare function lineIndent(node: Node): string;
|
|
74
|
+
/** A node's text with the indentation of its line removed from every later line. */
|
|
75
|
+
export declare function nodeText(node: Node): string;
|
|
76
|
+
/** `file:line` for messages, relative to `root`. */
|
|
77
|
+
export declare function where(node: Node, root: string): {
|
|
78
|
+
file: string;
|
|
79
|
+
line: number;
|
|
80
|
+
};
|
|
81
|
+
/** A path with `/` separators. */
|
|
82
|
+
export declare function toPosix(value: string): string;
|
|
83
|
+
/** Where a collection file's default export is. */
|
|
84
|
+
export interface CollectionSite {
|
|
85
|
+
/** The object literal the collection is written as. */
|
|
86
|
+
literal: ObjectLiteralExpression;
|
|
87
|
+
/** The local name the collection is bound to, when it is bound (`usersCollection`). */
|
|
88
|
+
binding?: string;
|
|
89
|
+
/** The statements that declare and default-export it, which are not carried anywhere. */
|
|
90
|
+
statements: Statement[];
|
|
91
|
+
}
|
|
92
|
+
/** Find the object literal a collection file default-exports. */
|
|
93
|
+
export declare function findCollectionSite(ctx: AstContext, sf: SourceFile): Located<CollectionSite>;
|
|
94
|
+
/**
|
|
95
|
+
* Assignments to the collection after its declaration, at the top level of
|
|
96
|
+
* its file: `usersCollection.securityRules = [...]`. Keyed by the assigned
|
|
97
|
+
* path (`securityRules`, `properties.title.callbacks`).
|
|
98
|
+
*/
|
|
99
|
+
export declare function postDeclarationAssignments(ctx: AstContext, sf: SourceFile, binding: string): Map<string, {
|
|
100
|
+
value: Expression;
|
|
101
|
+
statement: Statement;
|
|
102
|
+
}>;
|
|
103
|
+
/** One import binding a carried node uses. */
|
|
104
|
+
export interface ImportUse {
|
|
105
|
+
/** The module specifier as written. */
|
|
106
|
+
specifier: string;
|
|
107
|
+
/** The file it was written in (absolute), to resolve a relative specifier from. */
|
|
108
|
+
fromFile: string;
|
|
109
|
+
/** `default`, `*` (namespace) or the imported name. */
|
|
110
|
+
imported: string;
|
|
111
|
+
/** The local name. */
|
|
112
|
+
local: string;
|
|
113
|
+
/** Whether only types are imported. */
|
|
114
|
+
typeOnly: boolean;
|
|
115
|
+
}
|
|
116
|
+
/** The imports and top-level declarations some nodes reference, transitively. */
|
|
117
|
+
export interface References {
|
|
118
|
+
imports: ImportUse[];
|
|
119
|
+
/** Top-level statements, in file order, each once. */
|
|
120
|
+
statements: Statement[];
|
|
121
|
+
/** Names that resolve to a statement that may not be carried (the collection itself). */
|
|
122
|
+
forbidden: {
|
|
123
|
+
name: string;
|
|
124
|
+
line: number;
|
|
125
|
+
}[];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Collect what `nodes` reference at the top level of their file: import
|
|
129
|
+
* bindings, and the statements declaring other names (followed
|
|
130
|
+
* transitively). `exclude` are statements that must not be carried — a
|
|
131
|
+
* reference to one is reported in `forbidden`.
|
|
132
|
+
*/
|
|
133
|
+
export declare function collectReferences(ctx: AstContext, nodes: readonly Node[], exclude: readonly Statement[]): References;
|
|
134
|
+
/** The leading comments of a node worth carrying: block and line comments, not lint or compiler directives. */
|
|
135
|
+
export declare function leadingComments(node: Node): string[];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { LiftResult } from "@rebasepro/common/migrate";
|
|
2
|
+
import { type AnyTableDef, type AnyViewDef } from "@rebasepro/types";
|
|
3
|
+
import type { CollectionEntry, PlanContext } from "./plan-context.js";
|
|
4
|
+
/** How one table is named in the new layout. */
|
|
5
|
+
export interface TableName {
|
|
6
|
+
slug: string;
|
|
7
|
+
/** The exported identifier. */
|
|
8
|
+
identifier: string;
|
|
9
|
+
/** The module, absolute. */
|
|
10
|
+
file: string;
|
|
11
|
+
/** The SQL table name (the definition's name). */
|
|
12
|
+
table: string;
|
|
13
|
+
kind: "table" | "auth-table" | "view";
|
|
14
|
+
}
|
|
15
|
+
/** Placeholder tokens for code spliced into printed source. */
|
|
16
|
+
export declare class Splices {
|
|
17
|
+
private readonly texts;
|
|
18
|
+
private counter;
|
|
19
|
+
/** A token standing for `text` in printed output. */
|
|
20
|
+
token(text: string): string;
|
|
21
|
+
/** Replace every token by its text, re-indented to the line it sits on. */
|
|
22
|
+
apply(code: string): string;
|
|
23
|
+
}
|
|
24
|
+
export interface BackendPlanInput {
|
|
25
|
+
/** The Postgres collections, in the order they were lifted. */
|
|
26
|
+
entries: CollectionEntry[];
|
|
27
|
+
lift: LiftResult;
|
|
28
|
+
/** `backend/schema`, absolute. */
|
|
29
|
+
schemaDir: string;
|
|
30
|
+
/** The order the index lists the tables in: the legacy index's `collections`, then the rest by file. */
|
|
31
|
+
order: string[];
|
|
32
|
+
}
|
|
33
|
+
/** File names and identifiers for every table, unique. */
|
|
34
|
+
export declare function nameTables(entries: readonly CollectionEntry[], defs: readonly (AnyTableDef | AnyViewDef)[], schemaDir: string): Map<string, TableName>;
|
|
35
|
+
/** Plan the backend schema modules. */
|
|
36
|
+
export declare function planBackend(plan: PlanContext, input: BackendPlanInput, names: Map<string, TableName>): void;
|
|
37
|
+
/** The relative module path of a table, from a file in another directory. */
|
|
38
|
+
export declare function tableImportPath(fromFile: string, table: TableName): string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type SdkRewriteReport } from "./sdk-calls.js";
|
|
2
|
+
import type { ManualStep, MigrationReport, Note } from "./types.js";
|
|
3
|
+
/** The help page. */
|
|
4
|
+
export declare function printCollectionsToTablesHelp(): void;
|
|
5
|
+
export declare function groupSteps(steps: readonly ManualStep[]): ManualStep[];
|
|
6
|
+
/** Notes for a person: the same remark about several keys (`properties.id.isId is not carried: …`) printed once with the keys. */
|
|
7
|
+
export declare function groupNotes(notes: readonly Note[]): string[];
|
|
8
|
+
/**
|
|
9
|
+
* Run the command.
|
|
10
|
+
*
|
|
11
|
+
* @param flags the parsed flags
|
|
12
|
+
* @param dir the project directory, as typed
|
|
13
|
+
* @param moduleAliases specifiers mapped to files for evaluating the project (the in-repo entry points `@rebasepro/*` at source)
|
|
14
|
+
*/
|
|
15
|
+
export declare function runCollectionsToTables(flags: {
|
|
16
|
+
check?: boolean;
|
|
17
|
+
dryRun?: boolean;
|
|
18
|
+
json?: boolean;
|
|
19
|
+
force?: boolean;
|
|
20
|
+
skipSdkCalls?: boolean;
|
|
21
|
+
acceptRuleChanges?: boolean;
|
|
22
|
+
}, dir: string | undefined, moduleAliases?: Record<string, string>): Promise<MigrationReport>;
|
|
23
|
+
/** The help page of `rebase migrate sdk-calls`. */
|
|
24
|
+
export declare function printSdkCallsHelp(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Run \`rebase migrate sdk-calls\`.
|
|
27
|
+
*
|
|
28
|
+
* @param dir the project directory, as typed
|
|
29
|
+
* @param aliases specifiers mapped to files, for the type checker (in-repo runs)
|
|
30
|
+
*/
|
|
31
|
+
export declare function runSdkCalls(flags: {
|
|
32
|
+
dryRun?: boolean;
|
|
33
|
+
json?: boolean;
|
|
34
|
+
force?: boolean;
|
|
35
|
+
}, dir: string | undefined, aliases?: Record<string, string>): Promise<SdkRewriteReport | undefined>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { SourceFile } from "ts-morph";
|
|
2
|
+
import type { AnyTableDef, AnyViewDef } from "@rebasepro/types";
|
|
3
|
+
import type { AstContext } from "./ast.js";
|
|
4
|
+
import type { CollectionEntry } from "./plan-context.js";
|
|
5
|
+
/** Where a comment goes. */
|
|
6
|
+
export interface CommentTarget {
|
|
7
|
+
side: "backend" | "cms";
|
|
8
|
+
/** A top-level key of the definition / customization; absent for "unattached". */
|
|
9
|
+
key?: string;
|
|
10
|
+
/** An entry of that key's block: an object key, or an array index. */
|
|
11
|
+
entry?: string | number;
|
|
12
|
+
}
|
|
13
|
+
/** One comment and where it goes. */
|
|
14
|
+
export interface PlacedComment {
|
|
15
|
+
text: string;
|
|
16
|
+
target: CommentTarget;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Every comment of a collection file, and where it goes.
|
|
20
|
+
*
|
|
21
|
+
* @param def the definition the collection became (to know its columns and relations)
|
|
22
|
+
* @param skip comments already written by the module printer (the file header, the collection's own doc)
|
|
23
|
+
*/
|
|
24
|
+
export declare function collectComments(ctx: AstContext, entry: CollectionEntry, def: AnyTableDef | AnyViewDef, skip: ReadonlySet<string>): PlacedComment[];
|
|
25
|
+
/**
|
|
26
|
+
* Insert comments into printed text, each above its target line, indented
|
|
27
|
+
* like it. What has no target there is returned.
|
|
28
|
+
*/
|
|
29
|
+
export declare function placeComments(text: string, comments: readonly PlacedComment[]): {
|
|
30
|
+
text: string;
|
|
31
|
+
leftover: string[];
|
|
32
|
+
};
|
|
33
|
+
/** Comments nothing could be attached to, written after the module's imports under `// From <file>:`. */
|
|
34
|
+
export declare function addUnattached(text: string, comments: readonly string[], originalFile: string, root: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* The legacy collections index's comments: those about `defaultSecurityRules`
|
|
37
|
+
* go above `defaultRls`, those about the `collections` array (the panel's
|
|
38
|
+
* order) above `tableCustomizations`, the rest to the schema index's top.
|
|
39
|
+
*
|
|
40
|
+
* @returns the two index files' new text
|
|
41
|
+
*/
|
|
42
|
+
export declare function placeIndexComments(ctx: AstContext, legacyIndex: SourceFile, schemaIndex: string, cmsIndex: string | undefined, root: string): {
|
|
43
|
+
schemaIndex: string;
|
|
44
|
+
cmsIndex?: string;
|
|
45
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { LegacyEnumValues, LiftNote } from "@rebasepro/common/migrate";
|
|
2
|
+
import type { PathSegment } from "./ast.js";
|
|
3
|
+
import type { CollectionEntry, PlanContext } from "./plan-context.js";
|
|
4
|
+
import type { TableName } from "./backend.js";
|
|
5
|
+
/** The keys whose string value is a component path (the Vite plugin's `LAZY_COMPONENT_KEYS`). */
|
|
6
|
+
export declare const COMPONENT_KEYS: Set<string>;
|
|
7
|
+
/** Parse a lift note's key (`content[text].images[]`) into legacy literal segments. */
|
|
8
|
+
export declare function noteKeySegments(key: string): {
|
|
9
|
+
literal: PathSegment[];
|
|
10
|
+
field: string[];
|
|
11
|
+
};
|
|
12
|
+
/** The enum labels a field needs: only values whose label or colour is not the derived one. */
|
|
13
|
+
export declare function enumLabelsOf(values: LegacyEnumValues): Record<string, unknown> | undefined;
|
|
14
|
+
/** What {@link planCustomizations} wrote, for the index and `App.tsx`. */
|
|
15
|
+
export interface CustomizationOutput {
|
|
16
|
+
/** The exported identifier and module of each customization, in the order given. */
|
|
17
|
+
modules: {
|
|
18
|
+
identifier: string;
|
|
19
|
+
file: string;
|
|
20
|
+
slug: string;
|
|
21
|
+
}[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Plan one `customizeTable` module per collection with non-default
|
|
25
|
+
* presentation.
|
|
26
|
+
*
|
|
27
|
+
* @param notes the lift's `notCarried`
|
|
28
|
+
* @param cmsDir `frontend/src/cms`, absolute
|
|
29
|
+
*/
|
|
30
|
+
export declare function planCustomizations(plan: PlanContext, entries: readonly CollectionEntry[], names: ReadonlyMap<string, TableName>, notes: readonly LiftNote[], cmsDir: string): CustomizationOutput;
|
|
31
|
+
/**
|
|
32
|
+
* Brand the entries of `fieldOrder` / `listFields` that name one of the
|
|
33
|
+
* customization's `additionalFields`: `TableColumnId` accepts a field path, a
|
|
34
|
+
* relation tab, or an `AdditionalFieldKey`, and the key's documented spelling is
|
|
35
|
+
* `"key" as AdditionalFieldKey` (the brand is required, so a typo does not pass).
|
|
36
|
+
*
|
|
37
|
+
* @returns whether any entry was branded (the module then imports the type)
|
|
38
|
+
*/
|
|
39
|
+
export declare function brandAdditionalFieldKeys(options: Record<string, unknown>): boolean;
|
|
40
|
+
/** `frontend/src/cms/index.ts`: the customizations in navigation order, and the external collections. */
|
|
41
|
+
export declare function printCmsIndex(cmsDir: string, customizations: readonly {
|
|
42
|
+
identifier: string;
|
|
43
|
+
file: string;
|
|
44
|
+
}[], external: readonly {
|
|
45
|
+
identifier: string;
|
|
46
|
+
file: string;
|
|
47
|
+
}[]): string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A `dynamicProps` builder's return shape, 0.30 → 0.31.
|
|
3
|
+
*
|
|
4
|
+
* On 0.30 a builder returned a partial property: `{ admin: { readOnly: true } }`.
|
|
5
|
+
* On 0.31 it returns a field customization, flat: `{ readOnly: true }`, each
|
|
6
|
+
* key under the name `customizeTable` gives it (`hideFromCollection` →
|
|
7
|
+
* `hidden`, as the codemod routes a static `admin`). When every value the
|
|
8
|
+
* function can return is an object literal — directly, through a ternary, an
|
|
9
|
+
* early `return`, or a top-level `const` of the same file used only there —
|
|
10
|
+
* and each holds nothing but an `admin` block of routable keys, the literals
|
|
11
|
+
* are rewritten in place. Anything else (a spread, a computed value, a key
|
|
12
|
+
* that would collide or has no destination) is left for the manual step.
|
|
13
|
+
*/
|
|
14
|
+
import type { Node, SourceFile } from "ts-morph";
|
|
15
|
+
import type { AstContext } from "./ast.js";
|
|
16
|
+
import type { SourceEdit } from "./helper-hooks.js";
|
|
17
|
+
/** The rewrite of one builder: edits into its file, or why it is left. */
|
|
18
|
+
export type DynamicPropsRewrite = {
|
|
19
|
+
edits: SourceEdit[];
|
|
20
|
+
reason?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
edits?: undefined;
|
|
23
|
+
reason: string;
|
|
24
|
+
};
|
|
25
|
+
/** Every function of a file written as the value of a `dynamicProps` member. */
|
|
26
|
+
export declare function dynamicPropsBuilders(ctx: AstContext, sf: SourceFile): Node[];
|
|
27
|
+
/**
|
|
28
|
+
* Rewrite a builder's returned literals to the flat shape.
|
|
29
|
+
*
|
|
30
|
+
* @param fn the builder (arrow, function expression or method) in `sf`
|
|
31
|
+
* @param ownedBuilders every builder function of the file being rewritten: a
|
|
32
|
+
* `const` returned by one may only be read by such builders
|
|
33
|
+
*/
|
|
34
|
+
export declare function rewriteDynamicProps(ctx: AstContext, fn: Node, sf: SourceFile, ownedBuilders?: readonly Node[]): DynamicPropsRewrite;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What changed in 0.31 beyond the kernel moves, in the spellings a project's
|
|
3
|
+
* own code can hold: exports renamed or removed outside `@rebasepro/types` /
|
|
4
|
+
* `@rebasepro/common`, call options, environment variables, route paths, tool
|
|
5
|
+
* names. `rebase migrate sdk-calls` reads it (`moved-imports.ts`).
|
|
6
|
+
*
|
|
7
|
+
* The kernel moves are not here: they are generated from the headless guard's
|
|
8
|
+
* JSON into `moved-symbols.generated.ts`, and a row there wins over a row here
|
|
9
|
+
* for the same name and package.
|
|
10
|
+
*
|
|
11
|
+
* - A row of {@link EXPORT_CHANGES} with `to` set is rewritten: the meaning is
|
|
12
|
+
* the same and only the spelling (or the package) changed.
|
|
13
|
+
* - A row with `to: null` is not rewritten — the export is gone, or it still
|
|
14
|
+
* exists but takes or returns something different — so the codemod finds
|
|
15
|
+
* the import and prints a manual step with `instead` and the upgrade-guide
|
|
16
|
+
* section.
|
|
17
|
+
* - {@link CALL_OPTION_CHANGES} and {@link CODE_SPELLINGS} are detected the
|
|
18
|
+
* same way, never rewritten.
|
|
19
|
+
*
|
|
20
|
+
* The list is the diff of every package's root exports between 0.30.1 and
|
|
21
|
+
* this release, and the upgrade guide's sections; the coverage of each
|
|
22
|
+
* Breaking entry is recorded in the slice notes. The test
|
|
23
|
+
* (`moved-imports.test.ts`) holds every renamed name to an export of its
|
|
24
|
+
* package today and every `guide` to a heading of the upgrade guide.
|
|
25
|
+
*/
|
|
26
|
+
import type { MovedSymbol } from "./types.js";
|
|
27
|
+
/** The upgrade guide this release's manual steps point into. */
|
|
28
|
+
export declare const UPGRADE_GUIDE = "https://rebase.pro/docs/upgrading/0-30-to-0-31/";
|
|
29
|
+
/** Sections of the upgrade guide, by number: the anchor of each heading. */
|
|
30
|
+
export declare const GUIDE: {
|
|
31
|
+
readonly tables: "#108-tables-in-backendschema-replace-configcollections--run-the-codemod-first";
|
|
32
|
+
readonly configPackage: "#109-there-is-no-config-package";
|
|
33
|
+
readonly bootOptions: "#110-boot-options-and-hooks-name-tables";
|
|
34
|
+
readonly adminPanel: "#111-the-admin-panel-renders-the-tables-the-server-serves";
|
|
35
|
+
readonly sdk: "#115-the-sdk-addresses-a-table-datatableslug";
|
|
36
|
+
readonly cliFlags: "#116-cli-flags---schema-dir-not---collections";
|
|
37
|
+
readonly schemaEditor: "#117-the-schema-editor-edits-backendschema-with-tablepatch";
|
|
38
|
+
readonly componentSlot: "#118-a-component-slot-is-a-component";
|
|
39
|
+
readonly uiPreferences: "#119-panel-preferences-are-ui-preferences";
|
|
40
|
+
readonly mongo: "#120-mongodb-is-retired";
|
|
41
|
+
readonly mcp: "#122-mcp-tools-are-named-for-tables";
|
|
42
|
+
readonly rlsCheck: "#125-rls-check---format-agent-says-rls";
|
|
43
|
+
readonly review: "#126-rebaseproplugin-review-reviewrls";
|
|
44
|
+
readonly codegen: "#127-rebaseprocodegen-reads-descriptors";
|
|
45
|
+
readonly jsonCollections: "#129-usejsoncollectionsconfigcontroller-is-removed";
|
|
46
|
+
readonly history: "#132-history-is-served-as-reads";
|
|
47
|
+
readonly serverExports: "#133-rebaseproserver-exports-name-tables";
|
|
48
|
+
readonly postgresExports: "#134-rebaseproserver-postgres-exports-name-tables";
|
|
49
|
+
readonly kernel: "#135-rebaseprotypes-and-rebaseprocommon-drop-the-collection-model-from-their-roots";
|
|
50
|
+
};
|
|
51
|
+
/** Exports renamed (rewritten) or changed (a manual step) outside the kernel moves. */
|
|
52
|
+
export declare const EXPORT_CHANGES: readonly MovedSymbol[];
|
|
53
|
+
/** Packages that are gone: any import of them is a manual step. */
|
|
54
|
+
export declare const REMOVED_PACKAGES: Readonly<Record<string, {
|
|
55
|
+
instead: string;
|
|
56
|
+
guide: string;
|
|
57
|
+
}>>;
|
|
58
|
+
/** A call whose options named collections: detected (object-literal arguments), never rewritten. */
|
|
59
|
+
export interface CallOptionChange {
|
|
60
|
+
/** The function, as called (`openRebase`). */
|
|
61
|
+
callee: string;
|
|
62
|
+
/** Option keys of the collection model. */
|
|
63
|
+
keys: readonly string[];
|
|
64
|
+
instead: string;
|
|
65
|
+
guide: string;
|
|
66
|
+
}
|
|
67
|
+
/** Calls whose options named the collection model. */
|
|
68
|
+
export declare const CALL_OPTION_CHANGES: readonly CallOptionChange[];
|
|
69
|
+
/** A spelling found anywhere in a source file (not only in an import): detected, never rewritten. */
|
|
70
|
+
export interface CodeSpelling {
|
|
71
|
+
/** What the step calls it. */
|
|
72
|
+
spelling: string;
|
|
73
|
+
/** Where it is: each match is one line of the step. */
|
|
74
|
+
pattern: RegExp;
|
|
75
|
+
/** Only files whose text also matches this are read (a cheap guard against a common word). */
|
|
76
|
+
onlyIf?: RegExp;
|
|
77
|
+
instead: string;
|
|
78
|
+
guide: string;
|
|
79
|
+
}
|
|
80
|
+
/** Spellings a project's own code can hold whose meaning changed: each is a manual step. */
|
|
81
|
+
export declare const CODE_SPELLINGS: readonly CodeSpelling[];
|
|
82
|
+
/** A `package.json` script spelling of the old CLI: detected, never rewritten. */
|
|
83
|
+
export declare const SCRIPT_SPELLINGS: readonly CodeSpelling[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CollectionEntry, PlanContext } from "./plan-context.js";
|
|
2
|
+
/**
|
|
3
|
+
* Plan the move of one Firestore collection file.
|
|
4
|
+
*
|
|
5
|
+
* @param destination where the module goes; `<cmsDir>/<file name>` by default
|
|
6
|
+
* @returns the new module and the identifier its default export can be imported as
|
|
7
|
+
*/
|
|
8
|
+
export declare function planFirestoreCollection(plan: PlanContext, entry: CollectionEntry, cmsDir: string, destination?: string): {
|
|
9
|
+
file: string;
|
|
10
|
+
identifier: string;
|
|
11
|
+
} | undefined;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Node, ObjectLiteralExpression } from "ts-morph";
|
|
2
|
+
import type { PlanContext } from "./plan-context.js";
|
|
3
|
+
/** An edit to a file the run did not write as a collection: offsets into the file as it is on disk. */
|
|
4
|
+
export interface SourceEdit {
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
/** What following a helper found. */
|
|
10
|
+
export interface HelperHooks {
|
|
11
|
+
/** Edits to apply to each defining file (absolute path), so its functions take table-hook props. */
|
|
12
|
+
edits: Map<string, SourceEdit[]>;
|
|
13
|
+
/** Lines a carried hook left marked `TODO(rebase-migrate)`, with the file. */
|
|
14
|
+
todos: {
|
|
15
|
+
file: string;
|
|
16
|
+
hook: string;
|
|
17
|
+
todo: string;
|
|
18
|
+
}[];
|
|
19
|
+
/** The defining files outside `config/collections` (edited in place). */
|
|
20
|
+
files: Set<string>;
|
|
21
|
+
/** Why the helper could not be followed, or which hooks were not found in it. */
|
|
22
|
+
unresolved?: string;
|
|
23
|
+
}
|
|
24
|
+
export type Found = {
|
|
25
|
+
literal: ObjectLiteralExpression;
|
|
26
|
+
reason?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
literal?: undefined;
|
|
29
|
+
reason: string;
|
|
30
|
+
};
|
|
31
|
+
/** Follow an expression to the object literal it evaluates to. */
|
|
32
|
+
export declare function findLiteral(plan: PlanContext, node: Node, depth?: number): Found;
|
|
33
|
+
/**
|
|
34
|
+
* Follow a callbacks expression that is not an object literal to the
|
|
35
|
+
* helper's object literal, and plan its functions' props as table hooks.
|
|
36
|
+
*
|
|
37
|
+
* @param hookNames the hooks the evaluated collection had
|
|
38
|
+
*/
|
|
39
|
+
export declare function carryHelperHooks(plan: PlanContext, value: Node, hookNames: readonly string[]): HelperHooks;
|
|
40
|
+
/** A file's text with source edits applied (offsets into the original text). */
|
|
41
|
+
export declare function applySourceEdits(text: string, edits: readonly SourceEdit[] | undefined): string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { AstContext, Member } from "./ast.js";
|
|
2
|
+
/** The props a callback's parameter is renamed on. */
|
|
3
|
+
export interface PropRenames {
|
|
4
|
+
/** Always `table`: the descriptor replaces the collection. */
|
|
5
|
+
collection: "table";
|
|
6
|
+
/** `values`, for the hooks that received the row as `row`. */
|
|
7
|
+
row?: "values";
|
|
8
|
+
/**
|
|
9
|
+
* The renamed `collection` was a plain value (a slug) and `table` is the
|
|
10
|
+
* same value — `StorageAuthorizeData.collection` → `.table` — so no use of
|
|
11
|
+
* it needs checking.
|
|
12
|
+
*/
|
|
13
|
+
collectionIsValue?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** The renames for one table hook, or one column transform. */
|
|
16
|
+
export declare function renamesFor(hook: string): PropRenames;
|
|
17
|
+
/** A function carried into a table, and what to check in it. */
|
|
18
|
+
export interface CarriedFunction {
|
|
19
|
+
/** The source text, ready to print: its first line at column 0. */
|
|
20
|
+
text: string;
|
|
21
|
+
/** One sentence per use the codemod could not rewrite; each is also a `TODO(rebase-migrate)` line in the text. */
|
|
22
|
+
todos: string[];
|
|
23
|
+
}
|
|
24
|
+
/** The function text a member denotes: a method becomes the function expression it is. */
|
|
25
|
+
export declare function memberFunctionText(ctx: AstContext, member: Member): string;
|
|
26
|
+
/**
|
|
27
|
+
* The source of one hook (or one transform callback), its props renamed.
|
|
28
|
+
*
|
|
29
|
+
* @param member where it is in the legacy literal
|
|
30
|
+
* @param hook the hook's name: decides whether `row` is renamed
|
|
31
|
+
* @param options `collectionIsValue` when the renamed `collection` held a plain value
|
|
32
|
+
*/
|
|
33
|
+
export declare function carryHook(ctx: AstContext, member: Member, hook: string, options?: {
|
|
34
|
+
collectionIsValue?: boolean;
|
|
35
|
+
}): CarriedFunction;
|
|
36
|
+
/**
|
|
37
|
+
* The source of a `callbacks` object of a property — `{ beforeSave, afterRead }`
|
|
38
|
+
* — as the column's `.transform({...})` argument, each callback carried with
|
|
39
|
+
* {@link carryHook}.
|
|
40
|
+
*/
|
|
41
|
+
export declare function carryTransform(ctx: AstContext, members: {
|
|
42
|
+
name: string;
|
|
43
|
+
member: Member;
|
|
44
|
+
}[]): CarriedFunction;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** What was written, so it can be undone. */
|
|
2
|
+
export declare class Journal {
|
|
3
|
+
private readonly created;
|
|
4
|
+
private readonly createdDirs;
|
|
5
|
+
private readonly replaced;
|
|
6
|
+
/** Write one file, recording what was there before. */
|
|
7
|
+
write(file: string, content: string): void;
|
|
8
|
+
/** Put every file and directory back as it was. */
|
|
9
|
+
rollback(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The directory one run writes its shims into, and what it wrote there.
|
|
3
|
+
*
|
|
4
|
+
* Fresh per run — `mkdtemp` under the system's temporary directory, which
|
|
5
|
+
* creates it with a random name and mode 0700 — because the shims are code the
|
|
6
|
+
* run then evaluates: a directory any other user could have written to first
|
|
7
|
+
* (the fixed, content-named path this used to be, on a shared `/tmp`) would
|
|
8
|
+
* run whatever they planted there, `--dry-run` included. Every file is
|
|
9
|
+
* created exclusively (`wx`), so a file the run did not write is never used.
|
|
10
|
+
* {@link removeShimDir} deletes it when the run is over, failed or not.
|
|
11
|
+
*/
|
|
12
|
+
export interface ShimDir {
|
|
13
|
+
/** The directory, absolute. */
|
|
14
|
+
path: string;
|
|
15
|
+
/** The files this run created in it, by name. */
|
|
16
|
+
written: Map<string, string>;
|
|
17
|
+
}
|
|
18
|
+
/** A private directory for one run's shims. */
|
|
19
|
+
export declare function createShimDir(): ShimDir;
|
|
20
|
+
/** Delete a run's shim directory and everything in it. */
|
|
21
|
+
export declare function removeShimDir(dir: ShimDir): void;
|
|
22
|
+
/**
|
|
23
|
+
* The module aliases to evaluate a legacy `config/` with: the given ones,
|
|
24
|
+
* plus a shim for each package that lost `defineCollection`.
|
|
25
|
+
*
|
|
26
|
+
* @param configDir the project's `config/`, absolute
|
|
27
|
+
* @param shimDir the run's private shim directory ({@link createShimDir})
|
|
28
|
+
* @param aliases the run's module aliases (in-repo runs map `@rebasepro/*` to source)
|
|
29
|
+
*/
|
|
30
|
+
export declare function legacyLoadAliases(configDir: string, shimDir: ShimDir, aliases?: Readonly<Record<string, string>>): Record<string, string>;
|
|
31
|
+
/** A module importer (the run's jiti importer). */
|
|
32
|
+
type Importer = (file: string) => Promise<Record<string, unknown>>;
|
|
33
|
+
/**
|
|
34
|
+
* Shims for the names a 0.30 `config/` imports from a package that 0.31 moved
|
|
35
|
+
* elsewhere — `import { EntityRelation } from "@rebasepro/types"`, now in
|
|
36
|
+
* `@rebasepro/cms-types` — so the collection files load with 0.31's packages
|
|
37
|
+
* installed. A name is re-exported from its new package only when the package
|
|
38
|
+
* as installed no longer exports it and the new one does: a project still on
|
|
39
|
+
* 0.30 packages loads exactly as before.
|
|
40
|
+
*
|
|
41
|
+
* @param shimDir the run's private shim directory ({@link createShimDir})
|
|
42
|
+
* @param aliases the aliases the load uses so far ({@link legacyLoadAliases})
|
|
43
|
+
* @param importModule an importer built with those aliases
|
|
44
|
+
* @param moves the moved-symbol table
|
|
45
|
+
*/
|
|
46
|
+
export declare function movedNameAliases(configDir: string, shimDir: ShimDir, aliases: Readonly<Record<string, string>>, importModule: Importer, moves: readonly {
|
|
47
|
+
symbol: string;
|
|
48
|
+
from: string;
|
|
49
|
+
to: string | null;
|
|
50
|
+
as?: string;
|
|
51
|
+
}[]): Promise<Record<string, string>>;
|
|
52
|
+
export {};
|