@rebasepro/cli 0.30.0 → 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-Cj5ey3l_.js → cloud-CYMk92iG.js} +217 -104
- 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/auth.d.ts +2 -0
- package/dist/commands/cloud/context.d.ts +1 -1
- package/dist/commands/cloud/init.d.ts +2 -2
- package/dist/commands/cloud/login-flow.d.ts +30 -1
- 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-Cj5ey3l_.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
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { g as resolveTsx, h as resolvePluginCliScript, l as getActiveBackendPlugin, m as resolveLocalBin } from "./project-
|
|
1
|
+
import { g as resolveTsx, h as resolvePluginCliScript, l as getActiveBackendPlugin, m as resolveLocalBin } from "./project-CLcF5i8c.js";
|
|
2
|
+
import { C as resolveBackendPaths, g as compareMountOrder } from "./manifest-C3uLDrrJ.js";
|
|
3
|
+
import { r as schemaDirArgs } from "./schema-dir-Cd1kvYbf.js";
|
|
2
4
|
import { n as cliVersion } from "./version-Buyyo1ut.js";
|
|
3
|
-
import {
|
|
5
|
+
import { t as cmsDirectories } from "./cms-directories-BK3vcswg.js";
|
|
6
|
+
import { t as loadProjectSchema } from "./project-schema-CsSOG2gE.js";
|
|
4
7
|
import { n as summarisePortability, t as analyseFunctionsDirectory } from "./function-portability-BIvlvR9q.js";
|
|
5
8
|
import chalk from "chalk";
|
|
6
9
|
import fs from "fs";
|
|
@@ -196,14 +199,14 @@ function lockBundleBuild(projectRoot) {
|
|
|
196
199
|
/**
|
|
197
200
|
* Building a project bundle.
|
|
198
201
|
*
|
|
199
|
-
* A bundle is the deployable form of a project: compiled
|
|
200
|
-
* crons and schema, plus a generated manifest describing exactly what it needs
|
|
202
|
+
* A bundle is the deployable form of a project: its compiled tables, backend
|
|
203
|
+
* modules, functions, crons and schema, plus a generated manifest describing exactly what it needs
|
|
201
204
|
* to run. It contains no Dockerfile and no repository — the runtime is supplied
|
|
202
205
|
* separately, which is what allows a project to be moved onto a patched runtime
|
|
203
206
|
* without being rebuilt.
|
|
204
207
|
*
|
|
205
208
|
* Compilation runs through a generated tsconfig rooted at the project directory,
|
|
206
|
-
* so the output mirrors the source layout (`
|
|
209
|
+
* so the output mirrors the source layout (`backend/schema/…`, `backend/functions/…`)
|
|
207
210
|
* and every path in the manifest is predictable. Letting each workspace package
|
|
208
211
|
* emit into its own `dist/` would have meant guessing at three different
|
|
209
212
|
* layouts, since `rootDir` differs between the template flavours.
|
|
@@ -256,14 +259,13 @@ function say(options, line) {
|
|
|
256
259
|
* Type roots normally resolve by walking up from the tsconfig's own directory,
|
|
257
260
|
* which breaks here for two reasons: the generated config lives in `.rebase/`,
|
|
258
261
|
* and a pnpm workspace puts `@types/node` inside the *package* that depends on
|
|
259
|
-
* it (`
|
|
262
|
+
* it (`backend/node_modules/@types`) rather than at the project root. Listing them
|
|
260
263
|
* explicitly, as absolute paths, sidesteps both.
|
|
261
264
|
*/
|
|
262
265
|
function discoverTypeRoots(projectRoot) {
|
|
263
266
|
const candidates = [];
|
|
264
267
|
for (const relative of [
|
|
265
268
|
".",
|
|
266
|
-
"config",
|
|
267
269
|
"backend",
|
|
268
270
|
"frontend"
|
|
269
271
|
]) candidates.push(path.join(projectRoot, relative, "node_modules", "@types"));
|
|
@@ -337,7 +339,7 @@ function filterProjectPaths(baseDir, projectRoot, paths, baseUrl) {
|
|
|
337
339
|
/**
|
|
338
340
|
* Compose the tsconfig used to compile the bundle.
|
|
339
341
|
*
|
|
340
|
-
* Extends the
|
|
342
|
+
* Extends the backend's own tsconfig when there is one, so the project's
|
|
341
343
|
* choices about target, JSX and strictness are respected. It has to be `extends`
|
|
342
344
|
* rather than a copy of `compilerOptions`: TypeScript resolves relative paths
|
|
343
345
|
* against the file they were written in, so copying a value like
|
|
@@ -350,12 +352,12 @@ async function writeBundleTsconfig(projectRoot, outDir, includes, options) {
|
|
|
350
352
|
const fromTsconfig = (target) => {
|
|
351
353
|
return path.relative(tsconfigDir, path.resolve(projectRoot, target)).split(path.sep).join("/");
|
|
352
354
|
};
|
|
353
|
-
const
|
|
354
|
-
const extendsFrom = fs.existsSync(
|
|
355
|
+
const backendTsconfigPath = path.join(projectRoot, "backend", "tsconfig.json");
|
|
356
|
+
const extendsFrom = fs.existsSync(backendTsconfigPath) ? fromTsconfig(path.join("backend", "tsconfig.json")) : void 0;
|
|
355
357
|
let pathOverrides = {};
|
|
356
|
-
const baseOptions = await readCompilerOptions(projectRoot,
|
|
358
|
+
const baseOptions = await readCompilerOptions(projectRoot, backendTsconfigPath);
|
|
357
359
|
if (baseOptions?.paths && typeof baseOptions.paths === "object") {
|
|
358
|
-
const baseDir = path.dirname(
|
|
360
|
+
const baseDir = path.dirname(backendTsconfigPath);
|
|
359
361
|
const baseUrl = path.resolve(baseDir, typeof baseOptions.baseUrl === "string" ? baseOptions.baseUrl : ".");
|
|
360
362
|
const { kept, dropped } = filterProjectPaths(tsconfigDir, projectRoot, baseOptions.paths, baseUrl);
|
|
361
363
|
pathOverrides = {
|
|
@@ -404,13 +406,14 @@ async function writeBundleTsconfig(projectRoot, outDir, includes, options) {
|
|
|
404
406
|
return tsconfigPath;
|
|
405
407
|
}
|
|
406
408
|
/**
|
|
407
|
-
* Whether the compiled
|
|
409
|
+
* Whether the compiled `backend/storage` module exports a `storageAuthorize`
|
|
410
|
+
* hook.
|
|
408
411
|
*
|
|
409
412
|
* Recorded in the manifest so a host can refuse a deploy that would enable file
|
|
410
413
|
* storage with no access model, rather than let the runtime's boot guard turn it
|
|
411
414
|
* into a crash loop the developer cannot read.
|
|
412
415
|
*
|
|
413
|
-
* Read from the *compiled*
|
|
416
|
+
* Read from the *compiled* module, deliberately: that is the exact module the
|
|
414
417
|
* runtime imports and reads the export off, so this cannot disagree with what
|
|
415
418
|
* actually happens at boot. It is a textual check rather than an import because
|
|
416
419
|
* a freshly built bundle cannot resolve its own dependencies until it is
|
|
@@ -419,22 +422,25 @@ async function writeBundleTsconfig(projectRoot, outDir, includes, options) {
|
|
|
419
422
|
* Errs toward `false`: a missed detection costs a deploy rejection whose message
|
|
420
423
|
* says exactly how to proceed, while a false positive would hand back the crash
|
|
421
424
|
* loop this exists to prevent.
|
|
425
|
+
*
|
|
426
|
+
* @param compiledStorageModule the module without its extension
|
|
427
|
+
* (`<bundle>/backend/storage`), or a file; `.js`, `.mjs` and `.ts` are tried.
|
|
422
428
|
*/
|
|
423
|
-
function detectStorageAuthorize(
|
|
424
|
-
const
|
|
429
|
+
function detectStorageAuthorize(compiledStorageModule, depth = 0) {
|
|
430
|
+
const modulePath = [compiledStorageModule, ...[
|
|
425
431
|
".js",
|
|
426
432
|
".mjs",
|
|
427
433
|
".ts"
|
|
428
|
-
].map((ext) =>
|
|
429
|
-
if (!
|
|
430
|
-
return moduleExportsStorageAuthorize(
|
|
434
|
+
].map((ext) => `${compiledStorageModule}${ext}`)].find((candidate) => fs.existsSync(candidate) && fs.statSync(candidate).isFile());
|
|
435
|
+
if (!modulePath) return false;
|
|
436
|
+
return moduleExportsStorageAuthorize(modulePath, depth);
|
|
431
437
|
}
|
|
432
438
|
/**
|
|
433
439
|
* Whether one compiled module re-exports or defines `storageAuthorize`.
|
|
434
440
|
*
|
|
435
441
|
* Split out from {@link detectStorageAuthorize} so a wildcard re-export can be
|
|
436
|
-
* followed. `export * from "./
|
|
437
|
-
*
|
|
442
|
+
* followed. `export * from "./access.js"` is an ordinary way to write a module
|
|
443
|
+
* that re-exports, and treating it as "no hook" rejected deploys that were correct — with
|
|
438
444
|
* a message telling the developer to add a hook they had already written.
|
|
439
445
|
*/
|
|
440
446
|
function moduleExportsStorageAuthorize(modulePath, depth) {
|
|
@@ -507,11 +513,7 @@ function detectNativeDependencies(projectRoot, declared, limit = 2e3) {
|
|
|
507
513
|
const seen = /* @__PURE__ */ new Set();
|
|
508
514
|
const queue = Object.keys(declared);
|
|
509
515
|
let visited = 0;
|
|
510
|
-
const searchRoots = [
|
|
511
|
-
path.join(projectRoot, "node_modules"),
|
|
512
|
-
path.join(projectRoot, "backend", "node_modules"),
|
|
513
|
-
path.join(projectRoot, "config", "node_modules")
|
|
514
|
-
].filter((dir) => fs.existsSync(dir));
|
|
516
|
+
const searchRoots = [path.join(projectRoot, "node_modules"), path.join(projectRoot, "backend", "node_modules")].filter((dir) => fs.existsSync(dir));
|
|
515
517
|
while (queue.length > 0 && visited < limit) {
|
|
516
518
|
const name = queue.shift();
|
|
517
519
|
if (seen.has(name)) continue;
|
|
@@ -581,10 +583,9 @@ function hasNodeBinary(dir, depth = 0) {
|
|
|
581
583
|
*
|
|
582
584
|
* The bundle's declared deps are installed with `npm install` from the public
|
|
583
585
|
* registry beside the bundle at boot. A workspace package is not there, so
|
|
584
|
-
* declaring it guarantees a boot-time install failure
|
|
585
|
-
*
|
|
586
|
-
*
|
|
587
|
-
* dependency. Projects often express this as a `workspace:` range — caught
|
|
586
|
+
* declaring it guarantees a boot-time install failure — a shared package of the
|
|
587
|
+
* project's own, for one, which the backend depends on by name. Projects often
|
|
588
|
+
* express this as a `workspace:` range — caught
|
|
588
589
|
* separately — but a plain `"*"` against a workspace symlink is just as common
|
|
589
590
|
* and looks like a registry range, so the symlink is what actually settles it.
|
|
590
591
|
*
|
|
@@ -599,11 +600,7 @@ function resolvesToWorkspacePackage(projectRoot, name) {
|
|
|
599
600
|
} catch {
|
|
600
601
|
realRoot = projectRoot;
|
|
601
602
|
}
|
|
602
|
-
for (const base of [
|
|
603
|
-
projectRoot,
|
|
604
|
-
path.join(projectRoot, "backend"),
|
|
605
|
-
path.join(projectRoot, "config")
|
|
606
|
-
]) {
|
|
603
|
+
for (const base of [projectRoot, path.join(projectRoot, "backend")]) {
|
|
607
604
|
const link = path.join(base, "node_modules", name);
|
|
608
605
|
try {
|
|
609
606
|
if (!fs.lstatSync(link).isSymbolicLink()) continue;
|
|
@@ -626,11 +623,7 @@ function resolvesToWorkspacePackage(projectRoot, name) {
|
|
|
626
623
|
* be read last, so a scaffold declaring `dotenv ^16` at the root and `^17.4.2`
|
|
627
624
|
* in the backend shipped a manifest telling the managed runtime to install 16.
|
|
628
625
|
*/
|
|
629
|
-
var BUNDLE_DEP_MANIFESTS = [
|
|
630
|
-
"package.json",
|
|
631
|
-
"config/package.json",
|
|
632
|
-
"backend/package.json"
|
|
633
|
-
];
|
|
626
|
+
var BUNDLE_DEP_MANIFESTS = ["package.json", "backend/package.json"];
|
|
634
627
|
/**
|
|
635
628
|
* Where a project's npm configuration may live, in the order they are joined.
|
|
636
629
|
* npm reads the last value of a repeated key, so the backend's own file wins.
|
|
@@ -696,14 +689,10 @@ function nonRegistrySpecifier(version) {
|
|
|
696
689
|
if (/^\.{0,2}\//.test(trimmed)) return "a filesystem path";
|
|
697
690
|
return null;
|
|
698
691
|
}
|
|
699
|
-
/** The names this project's own `
|
|
692
|
+
/** The names this project's own `backend` and `frontend` packages go by. */
|
|
700
693
|
function localPackageNames(projectRoot) {
|
|
701
694
|
const names = /* @__PURE__ */ new Set();
|
|
702
|
-
for (const dir of [
|
|
703
|
-
"config",
|
|
704
|
-
"backend",
|
|
705
|
-
"frontend"
|
|
706
|
-
]) try {
|
|
695
|
+
for (const dir of ["backend", "frontend"]) try {
|
|
707
696
|
const { name } = JSON.parse(fs.readFileSync(path.join(projectRoot, dir, "package.json"), "utf8"));
|
|
708
697
|
if (name) names.add(name);
|
|
709
698
|
} catch {}
|
|
@@ -715,8 +704,7 @@ function localPackageNames(projectRoot) {
|
|
|
715
704
|
* Packages the runtime image already provides are excluded — reinstalling a
|
|
716
705
|
* second copy of the server next to the one running the process is at best
|
|
717
706
|
* wasted space and at worst a version conflict. Workspace packages are excluded
|
|
718
|
-
* too: they are not on the registry the runtime installs from
|
|
719
|
-
* own config package already travels inside the bundle.
|
|
707
|
+
* too: they are not on the registry the runtime installs from.
|
|
720
708
|
*
|
|
721
709
|
* Throws when a declared range is not something the registry can resolve, or
|
|
722
710
|
* when two manifests declare a name at ranges nothing satisfies. The
|
|
@@ -939,7 +927,6 @@ function detectFrameworkDepDrift(projectRoot, cliVersion) {
|
|
|
939
927
|
for (const relative of [
|
|
940
928
|
"package.json",
|
|
941
929
|
"backend/package.json",
|
|
942
|
-
"config/package.json",
|
|
943
930
|
"frontend/package.json"
|
|
944
931
|
]) {
|
|
945
932
|
const file = path.join(projectRoot, relative);
|
|
@@ -970,7 +957,7 @@ function detectFrameworkDepDrift(projectRoot, cliVersion) {
|
|
|
970
957
|
*
|
|
971
958
|
* `normalizeEsmSpecifiers` scans emitted output with a regular expression, and a
|
|
972
959
|
* regular expression cannot tell a specifier from a specifier somebody wrote
|
|
973
|
-
* about. The stock template ships one: `
|
|
960
|
+
* about. The stock template ships one: `backend/resources.ts` documents
|
|
974
961
|
* `import { media } from "../resources";` inside a docblock, tsc preserves the
|
|
975
962
|
* comment, and every `rebase build` of an untouched scaffold printed
|
|
976
963
|
* `⚠ 1 import(s) could not be resolved`. A warning that is wrong on the default
|
|
@@ -1024,7 +1011,7 @@ function commentSpans(source) {
|
|
|
1024
1011
|
* Rewrite relative import specifiers in emitted JavaScript so Node can resolve them.
|
|
1025
1012
|
*
|
|
1026
1013
|
* TypeScript deliberately does not touch specifiers: `moduleResolution: "bundler"`
|
|
1027
|
-
* lets a project write `from "./posts"` or `from "./
|
|
1014
|
+
* lets a project write `from "./posts"` or `from "./schema"`, and TypeScript
|
|
1028
1015
|
* emits them unchanged on the assumption that a bundler will finish the job.
|
|
1029
1016
|
* Nothing bundles a Rebase bundle — the runtime imports these files directly with
|
|
1030
1017
|
* Node's ESM loader, which requires a full path with an extension and refuses
|
|
@@ -1113,7 +1100,7 @@ function cleanOutDir(projectRoot, outDir) {
|
|
|
1113
1100
|
fs.mkdirSync(outDir, { recursive: true });
|
|
1114
1101
|
}
|
|
1115
1102
|
/**
|
|
1116
|
-
* Regenerate the Drizzle schema from the
|
|
1103
|
+
* Regenerate the Drizzle schema from the tables.
|
|
1117
1104
|
*
|
|
1118
1105
|
* Delegated to the database driver's own CLI — the same code `rebase schema
|
|
1119
1106
|
* generate` runs — so there is one implementation of what a schema is. When no
|
|
@@ -1121,7 +1108,7 @@ function cleanOutDir(projectRoot, outDir) {
|
|
|
1121
1108
|
* a `baas` project has no schema to generate, and a project mid-install should
|
|
1122
1109
|
* get a clear message rather than a hard stop.
|
|
1123
1110
|
*/
|
|
1124
|
-
async function regenerateSchema(projectRoot,
|
|
1111
|
+
async function regenerateSchema(projectRoot, options) {
|
|
1125
1112
|
const backendDir = path.join(projectRoot, "backend");
|
|
1126
1113
|
if (!fs.existsSync(backendDir)) return;
|
|
1127
1114
|
const plugin = getActiveBackendPlugin(backendDir);
|
|
@@ -1135,20 +1122,18 @@ async function regenerateSchema(projectRoot, configDir, options) {
|
|
|
1135
1122
|
log(options, chalk.dim(" (tsx not installed — skipping schema generation)"));
|
|
1136
1123
|
return;
|
|
1137
1124
|
}
|
|
1138
|
-
const
|
|
1125
|
+
const driverArgs = ["schema", "generate"];
|
|
1139
1126
|
const { execa } = await import("execa");
|
|
1140
1127
|
try {
|
|
1141
1128
|
await execa(runner, [
|
|
1142
1129
|
script,
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
"--collections",
|
|
1146
|
-
collectionsPath
|
|
1130
|
+
...driverArgs,
|
|
1131
|
+
...schemaDirArgs(projectRoot, driverArgs)
|
|
1147
1132
|
], {
|
|
1148
1133
|
cwd: backendDir,
|
|
1149
1134
|
stdio: "pipe"
|
|
1150
1135
|
});
|
|
1151
|
-
log(options, chalk.dim(" regenerated database schema from
|
|
1136
|
+
log(options, chalk.dim(" regenerated database schema from the tables"));
|
|
1152
1137
|
} catch (err) {
|
|
1153
1138
|
const detail = err instanceof Error ? err.message : String(err);
|
|
1154
1139
|
throw new Error(`Schema generation failed, so the bundle was not written.\n${detail}\nRun \`rebase schema generate\` to see the full output, or pass --skip-schema if the committed schema is deliberately hand-maintained.`);
|
|
@@ -1160,8 +1145,8 @@ async function regenerateSchema(projectRoot, configDir, options) {
|
|
|
1160
1145
|
* `rebase dev` runs `backend/src/index.ts` whenever a project has one, so for
|
|
1161
1146
|
* the whole of local development that file *is* the server and every route
|
|
1162
1147
|
* written in it works. A bundle has no entrypoint of its own: the runtime boots
|
|
1163
|
-
* the bundle and mounts what the manifest points at — the
|
|
1164
|
-
* functions, crons and the schema. The file is not compiled, not shipped, and
|
|
1148
|
+
* the bundle and mounts what the manifest points at — the tables, the backend
|
|
1149
|
+
* modules, functions, crons and the schema. The file is not compiled, not shipped, and
|
|
1165
1150
|
* never imported.
|
|
1166
1151
|
*
|
|
1167
1152
|
* Nothing said so. A project with custom routes in its entrypoint built clean,
|
|
@@ -1179,6 +1164,37 @@ function findUnusedServerEntry(projectRoot, functionsDir) {
|
|
|
1179
1164
|
return found ? found.split(path.sep).join("/") : void 0;
|
|
1180
1165
|
}
|
|
1181
1166
|
/**
|
|
1167
|
+
* Compile and assemble a bundle.
|
|
1168
|
+
*/
|
|
1169
|
+
/** Where a bundle carries the frontend's `ui-config.json` (`entry.uiConfig`). */
|
|
1170
|
+
var BUNDLED_UI_CONFIG = "ui-config.json";
|
|
1171
|
+
/**
|
|
1172
|
+
* Copy the frontend's `src/cms/ui-config.json` into the bundle, for
|
|
1173
|
+
* `entry.uiConfig`: the reviewed presentation the frontend ships as
|
|
1174
|
+
* `<RebaseCMS uiConfig>`, which a deployed server cannot read from the
|
|
1175
|
+
* project's tree. Looked for in each `cmsDirectories` (the static apps'
|
|
1176
|
+
* `src/cms`, and `frontend/src/cms`); the first found is carried. Nothing
|
|
1177
|
+
* when there is none. A file that is not a JSON object is refused: the
|
|
1178
|
+
* frontend's own build would fail on it too.
|
|
1179
|
+
*/
|
|
1180
|
+
function bundleUiConfig(projectRoot, outDir) {
|
|
1181
|
+
const source = cmsDirectories(projectRoot).map((dir) => path.join(dir, "ui-config.json")).find((file) => fs.existsSync(file) && fs.statSync(file).isFile());
|
|
1182
|
+
if (!source) return void 0;
|
|
1183
|
+
const text = fs.readFileSync(source, "utf8");
|
|
1184
|
+
let parsed;
|
|
1185
|
+
try {
|
|
1186
|
+
parsed = JSON.parse(text);
|
|
1187
|
+
} catch {
|
|
1188
|
+
throw new Error(`${path.relative(projectRoot, source)} is not valid JSON. Fix it, or delete it to start the presentation over.`);
|
|
1189
|
+
}
|
|
1190
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) throw new Error(`${path.relative(projectRoot, source)} must be a JSON object (\`{ "tables": { … } }\`).`);
|
|
1191
|
+
fs.writeFileSync(path.join(outDir, BUNDLED_UI_CONFIG), text, "utf8");
|
|
1192
|
+
return {
|
|
1193
|
+
source,
|
|
1194
|
+
entry: BUNDLED_UI_CONFIG
|
|
1195
|
+
};
|
|
1196
|
+
}
|
|
1197
|
+
/**
|
|
1182
1198
|
* The bundle manifest, as a pure function of its inputs.
|
|
1183
1199
|
*
|
|
1184
1200
|
* Separated from `buildBundle` so the SHAPE a host reads can be pinned by a
|
|
@@ -1201,7 +1217,7 @@ function composeBundleManifest(input) {
|
|
|
1201
1217
|
app: input.appName,
|
|
1202
1218
|
kind: "backend",
|
|
1203
1219
|
entry: input.entry,
|
|
1204
|
-
|
|
1220
|
+
tables: [...input.tableSlugs].sort(),
|
|
1205
1221
|
...input.functions.length > 0 ? { functions: input.functions } : {},
|
|
1206
1222
|
hooks: {
|
|
1207
1223
|
native: input.nativeModules.length > 0,
|
|
@@ -1230,25 +1246,36 @@ async function buildBundle(options) {
|
|
|
1230
1246
|
const release = lockBundleBuild(projectRoot);
|
|
1231
1247
|
const paths = resolveBackendPaths(app, projectRoot);
|
|
1232
1248
|
const outDir = path.resolve(projectRoot, options.outDir ?? "dist-bundle");
|
|
1249
|
+
const schema = await loadProjectSchema(projectRoot, path.join(projectRoot, paths.tables), options.moduleAliases);
|
|
1250
|
+
const tables = schema.compiled.descriptors;
|
|
1251
|
+
if (paths.hasTables && tables.length === 0) throw new Error(`${path.join(paths.tables, path.basename(schema.loaded.indexFile))} exports no tables. Export at least one defineTable / defineAuthTable / defineView from it, or delete the ${paths.tables} directory to have the runtime introspect the live database instead.`);
|
|
1252
|
+
const backendModules = [
|
|
1253
|
+
"resources",
|
|
1254
|
+
"storage",
|
|
1255
|
+
"hooks"
|
|
1256
|
+
].filter((part) => fs.existsSync(path.join(projectRoot, paths[part])));
|
|
1233
1257
|
const includes = [];
|
|
1234
1258
|
const addIfExists = (relative, pattern) => {
|
|
1235
1259
|
if (fs.existsSync(path.join(projectRoot, relative))) includes.push(pattern);
|
|
1236
1260
|
};
|
|
1237
|
-
if (paths.
|
|
1261
|
+
if (paths.hasTables) includes.push(`${paths.tables}/**/*`);
|
|
1262
|
+
for (const part of backendModules) includes.push(paths[part]);
|
|
1238
1263
|
addIfExists(paths.functions, `${paths.functions}/**/*.ts`);
|
|
1239
1264
|
addIfExists(paths.crons, `${paths.crons}/**/*.ts`);
|
|
1240
1265
|
if (fs.existsSync(path.join(projectRoot, paths.schema))) includes.push(paths.schema);
|
|
1241
|
-
if (includes.length === 0) throw new Error(`Nothing to build for app "${appName}". Expected
|
|
1242
|
-
if (paths.
|
|
1243
|
-
if (paths.
|
|
1244
|
-
const { writeRegistrationForBuild } = await import("./generate_sdk-
|
|
1245
|
-
const registered = await writeRegistrationForBuild(
|
|
1266
|
+
if (includes.length === 0) throw new Error(`Nothing to build for app "${appName}". Expected tables in "${paths.tables}" (an index.ts exporting them), backend modules (${paths.resources}, ${paths.storage}, ${paths.hooks}) or functions at "${paths.functions}".`);
|
|
1267
|
+
if (paths.hasTables && options.skipSchema !== true) await regenerateSchema(projectRoot, options);
|
|
1268
|
+
if (paths.hasTables) {
|
|
1269
|
+
const { writeRegistrationForBuild } = await import("./generate_sdk-De-aLC1L.js");
|
|
1270
|
+
const registered = await writeRegistrationForBuild(projectRoot, tables, app.registerDatabase === true);
|
|
1246
1271
|
if (registered) log(options, chalk.dim(` registered the Database for server-side code in ${path.relative(projectRoot, registered)}/`));
|
|
1247
1272
|
}
|
|
1273
|
+
addIfExists(paths.generated, `${paths.generated}/**/*.ts`);
|
|
1248
1274
|
const unusedEntry = findUnusedServerEntry(projectRoot, paths.functions);
|
|
1249
1275
|
if (unusedEntry) {
|
|
1250
1276
|
const parts = [
|
|
1251
|
-
...paths.
|
|
1277
|
+
...paths.hasTables ? [`${paths.tables}/`] : [],
|
|
1278
|
+
...backendModules.map((part) => paths[part]),
|
|
1252
1279
|
`${paths.functions}/`,
|
|
1253
1280
|
"the schema"
|
|
1254
1281
|
];
|
|
@@ -1281,17 +1308,12 @@ async function buildBundle(options) {
|
|
|
1281
1308
|
for (const item of normalized.unresolved.slice(0, 5)) say(options, chalk.dim(` ${item}`));
|
|
1282
1309
|
if (normalized.unresolved.length > 5) say(options, chalk.dim(` … and ${normalized.unresolved.length - 5} more`));
|
|
1283
1310
|
}
|
|
1284
|
-
const
|
|
1285
|
-
|
|
1286
|
-
let collections = [];
|
|
1287
|
-
if (paths.hasCollections) {
|
|
1288
|
-
collections = await loadSourceCollections(path.join(projectRoot, paths.config, "collections"));
|
|
1289
|
-
if (collections.length === 0) throw new Error(`No collections were found in ${path.join(paths.config, "collections")}. Define at least one collection there, or remove the directory to have the runtime introspect collections from the live database instead.`);
|
|
1290
|
-
if (!fs.existsSync(compiledCollectionsDir)) throw new Error(`Compilation produced no collections directory at ${path.relative(projectRoot, compiledCollectionsDir)}.`);
|
|
1291
|
-
}
|
|
1311
|
+
const compiledTablesDir = path.join(outDir, paths.tables);
|
|
1312
|
+
if (paths.hasTables && !fs.existsSync(compiledTablesDir)) throw new Error(`Compilation produced no schema directory at ${path.relative(projectRoot, compiledTablesDir)}.`);
|
|
1292
1313
|
const declared = collectDeclaredDependencies(projectRoot);
|
|
1293
1314
|
const nativeModules = detectNativeDependencies(projectRoot, declared);
|
|
1294
|
-
const
|
|
1315
|
+
const compiledModule = (source) => source.replace(/\.[mc]?ts$/, ".js");
|
|
1316
|
+
const declaresStorageAuthorize = detectStorageAuthorize(path.join(outDir, compiledModule(paths.storage)));
|
|
1295
1317
|
const resourceGraph = options.resources ?? {
|
|
1296
1318
|
version: 1,
|
|
1297
1319
|
resources: []
|
|
@@ -1305,6 +1327,8 @@ async function buildBundle(options) {
|
|
|
1305
1327
|
if (collision) throw new Error(`Buckets "${collision.a}" and "${collision.b}" both map to the environment variable suffix "${collision.suffix || "(none)"}", so they would read each other's configuration. Rename one of them.`);
|
|
1306
1328
|
const schemaOut = paths.schema.replace(/\.ts$/, ".js");
|
|
1307
1329
|
const relative = (target) => fs.existsSync(path.join(outDir, target)) ? target : void 0;
|
|
1330
|
+
const uiConfig = bundleUiConfig(projectRoot, outDir);
|
|
1331
|
+
if (uiConfig) log(options, chalk.dim(` carried ${path.relative(projectRoot, uiConfig.source)} for the server's views`));
|
|
1308
1332
|
const functionReports = analyseFunctionsDirectory(path.join(projectRoot, paths.functions), projectRoot);
|
|
1309
1333
|
const bundledFunctions = functionReports.map((report) => {
|
|
1310
1334
|
const requires = [...new Set(report.issues.filter((issue) => issue.kind === "node-builtin" || issue.kind === "node-only-package").map((issue) => issue.message))];
|
|
@@ -1319,17 +1343,19 @@ async function buildBundle(options) {
|
|
|
1319
1343
|
const manifest = composeBundleManifest({
|
|
1320
1344
|
runtimeRange: options.runtimeRange,
|
|
1321
1345
|
builtAgainst: resolveServerVersion(projectRoot),
|
|
1322
|
-
schemaVersion: paths.
|
|
1346
|
+
schemaVersion: paths.hasTables ? computeSchemaVersion(tables) : "",
|
|
1323
1347
|
appName,
|
|
1324
1348
|
entry: {
|
|
1325
|
-
|
|
1326
|
-
|
|
1349
|
+
tables: paths.hasTables ? relative(paths.tables) : void 0,
|
|
1350
|
+
resources: relative(compiledModule(paths.resources)),
|
|
1351
|
+
storage: relative(compiledModule(paths.storage)),
|
|
1352
|
+
hooks: relative(compiledModule(paths.hooks)),
|
|
1327
1353
|
functions: relative(paths.functions),
|
|
1328
1354
|
crons: relative(paths.crons),
|
|
1329
1355
|
schema: relative(schemaOut),
|
|
1330
|
-
|
|
1356
|
+
...uiConfig && { uiConfig: uiConfig.entry }
|
|
1331
1357
|
},
|
|
1332
|
-
|
|
1358
|
+
tableSlugs: tables.map((table) => table.slug),
|
|
1333
1359
|
functions: bundledFunctions,
|
|
1334
1360
|
nativeModules,
|
|
1335
1361
|
declaresStorageAuthorize,
|
|
@@ -1365,7 +1391,7 @@ async function buildBundle(options) {
|
|
|
1365
1391
|
return {
|
|
1366
1392
|
outDir,
|
|
1367
1393
|
manifest,
|
|
1368
|
-
|
|
1394
|
+
tableCount: tables.length,
|
|
1369
1395
|
vendor,
|
|
1370
1396
|
release
|
|
1371
1397
|
};
|
|
@@ -1687,58 +1713,6 @@ function buildStaticBundle(options) {
|
|
|
1687
1713
|
fileCount
|
|
1688
1714
|
};
|
|
1689
1715
|
}
|
|
1690
|
-
/**
|
|
1691
|
-
* Which files in a collections directory are collections.
|
|
1692
|
-
*
|
|
1693
|
-
* Mirrors the runtime loader's rules exactly, and must keep mirroring them: the
|
|
1694
|
-
* set of files counted here decides the schema version, and the runtime decides
|
|
1695
|
-
* what it serves the same way. A divergence would show up as a client that is
|
|
1696
|
-
* permanently "out of date" against a server that agrees with it.
|
|
1697
|
-
*
|
|
1698
|
-
* (`._*` guards macOS AppleDouble files, which look like sources and are not.)
|
|
1699
|
-
*/
|
|
1700
|
-
function isCollectionSourceFile(name) {
|
|
1701
|
-
if (name.startsWith(".")) return false;
|
|
1702
|
-
if (name.includes(".test.") || name.includes(".spec.")) return false;
|
|
1703
|
-
if (name.endsWith(".d.ts")) return false;
|
|
1704
|
-
if (name === "index.ts" || name === "index.js") return false;
|
|
1705
|
-
return name.endsWith(".ts") || name.endsWith(".js");
|
|
1706
|
-
}
|
|
1707
|
-
/**
|
|
1708
|
-
* Load collections from **source**, for hashing and for the manifest's slug list.
|
|
1709
|
-
*
|
|
1710
|
-
* Deliberately not the compiled output. A compiled bundle imports its
|
|
1711
|
-
* dependencies from beside itself — that is the whole point of shipping a
|
|
1712
|
-
* `package.json` with it — but at build time nothing has been installed there
|
|
1713
|
-
* yet, and under pnpm the project's own `node_modules` lives one directory per
|
|
1714
|
-
* package, so the emitted files genuinely cannot resolve their imports until
|
|
1715
|
-
* they are deployed.
|
|
1716
|
-
*
|
|
1717
|
-
* Reading source costs nothing in fidelity: compilation erases types, it does
|
|
1718
|
-
* not change the values a collection module exports, so the hash is the same
|
|
1719
|
-
* either way.
|
|
1720
|
-
*/
|
|
1721
|
-
async function loadSourceCollections(collectionsDir) {
|
|
1722
|
-
if (!fs.existsSync(collectionsDir)) return [];
|
|
1723
|
-
const { createJiti } = await import("jiti");
|
|
1724
|
-
const jiti = createJiti(path.join(collectionsDir, "index.ts"), {
|
|
1725
|
-
interopDefault: true,
|
|
1726
|
-
esmResolve: true
|
|
1727
|
-
});
|
|
1728
|
-
const files = fs.readdirSync(collectionsDir).filter(isCollectionSourceFile).sort();
|
|
1729
|
-
const collections = [];
|
|
1730
|
-
const failures = [];
|
|
1731
|
-
for (const file of files) try {
|
|
1732
|
-
const mod = await jiti.import(path.join(collectionsDir, file));
|
|
1733
|
-
const collection = mod.default ?? mod;
|
|
1734
|
-
if (collection && typeof collection === "object" && "slug" in collection) collections.push(collection);
|
|
1735
|
-
else failures.push(`${file}: no default-exported collection`);
|
|
1736
|
-
} catch (err) {
|
|
1737
|
-
failures.push(`${file}: ${err instanceof Error ? err.message : String(err)}`);
|
|
1738
|
-
}
|
|
1739
|
-
if (failures.length > 0) throw new Error(`Could not read ${failures.length} collection file(s):\n` + failures.map((f) => ` • ${f}`).join("\n"));
|
|
1740
|
-
return collections;
|
|
1741
|
-
}
|
|
1742
1716
|
/** The `@rebasepro/server` version the project resolves — what it was built against. */
|
|
1743
1717
|
function resolveServerVersion(projectRoot) {
|
|
1744
1718
|
const candidates = [path.join(projectRoot, "node_modules", "@rebasepro", "server", "package.json"), path.join(projectRoot, "backend", "node_modules", "@rebasepro", "server", "package.json")];
|
|
@@ -1751,6 +1725,6 @@ function resolveServerVersion(projectRoot) {
|
|
|
1751
1725
|
return "unknown";
|
|
1752
1726
|
}
|
|
1753
1727
|
//#endregion
|
|
1754
|
-
export {
|
|
1728
|
+
export { unvendoredReason as C, normalizeEsmSpecifiers as S, toolStdio as T, detectFrameworkDepDrift as _, VENDOR_SIZE_WARN_BYTES as a, findUnusedServerEntry as b, buildBundle as c, bundledNpmrc as d, collectDeclaredDependencies as f, detectDeclaredDepConflicts as g, describeDepConflicts as h, VENDOR_SIZE_MAX_BYTES as i, buildStaticBundle as l, composeBundleManifest as m, DEFAULT_BUNDLE_DIR as n, VENDOR_TARGET_CPU as o, commentSpans as p, UNVENDORED_COST as r, VENDOR_TARGET_OS as s, BUNDLED_UI_CONFIG as t, bundleUiConfig as u, detectNativeDependencies as v, vendorDependencies as w, foldStaticIntoBundle as x, detectStorageAuthorize as y };
|
|
1755
1729
|
|
|
1756
|
-
//# sourceMappingURL=bundle-
|
|
1730
|
+
//# sourceMappingURL=bundle-DgILeA5b.js.map
|