@base44-preview/cli 0.3.4-pr.703.4ec4bf2 → 0.3.5-pr.703.cda6ca8

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/dist/cli/index.js CHANGED
@@ -239464,7 +239464,7 @@ import { join as join13 } from "node:path";
239464
239464
  // package.json
239465
239465
  var package_default = {
239466
239466
  name: "base44",
239467
- version: "0.3.4",
239467
+ version: "0.3.5",
239468
239468
  description: "Base44 CLI - Unified interface for managing Base44 applications",
239469
239469
  type: "module",
239470
239470
  bin: {
@@ -252869,6 +252869,33 @@ function declaredActor({
252869
252869
  static_egress: staticEgress
252870
252870
  };
252871
252871
  }
252872
+ function declaredRoutes({
252873
+ pages,
252874
+ home,
252875
+ entityPages,
252876
+ entityFreePaths
252877
+ }) {
252878
+ return {
252879
+ pages: pages.map(({ path, name, file, requiresAuth, binding, segmentValues }) => ({
252880
+ path,
252881
+ name,
252882
+ file,
252883
+ ...requiresAuth ? { requires_auth: true } : {},
252884
+ ...binding ? {
252885
+ binding: {
252886
+ entity: binding.entity,
252887
+ param: binding.param,
252888
+ field: binding.field,
252889
+ ...binding.extraParams ? { extra_params: binding.extraParams } : {}
252890
+ }
252891
+ } : {},
252892
+ ...segmentValues ? { segment_values: segmentValues } : {}
252893
+ })),
252894
+ home,
252895
+ ...entityPages ? { entity_pages: entityPages } : {},
252896
+ ...entityFreePaths ? { entity_free_paths: entityFreePaths } : {}
252897
+ };
252898
+ }
252872
252899
  function actorUploadPath(actor) {
252873
252900
  return `actors/${actor.name}.mjs`;
252874
252901
  }
@@ -252931,7 +252958,7 @@ async function createVersion(artifacts, options = {}) {
252931
252958
  agents: artifacts.agents,
252932
252959
  mcp_config: artifacts.mcpConfig,
252933
252960
  agent_skills: artifacts.agentSkills,
252934
- ...artifacts.pages ? { pages: artifacts.pages } : {},
252961
+ ...artifacts.routes ? { routes: declaredRoutes(artifacts.routes) } : {},
252935
252962
  source_commit: options.sourceCommit
252936
252963
  }, "declaring a version")).json(), "declare");
252937
252964
  const declaredFiles = [
@@ -264701,8 +264728,82 @@ function compiledModule(name, result) {
264701
264728
  return result.module;
264702
264729
  }
264703
264730
 
264704
- // src/core/version/pages.ts
264731
+ // src/core/version/publish.ts
264732
+ import { randomUUID as randomUUID4 } from "node:crypto";
264733
+ var DEFAULT_ENVIRONMENT = "production";
264734
+ async function tagStep2(step, run) {
264735
+ return await tagStep(step, run);
264736
+ }
264737
+ async function publishVersion(artifacts, options = {}) {
264738
+ const version = await tagStep2("create_version", () => createVersion(artifacts, {
264739
+ sourceCommit: options.sourceCommit,
264740
+ concurrency: options.concurrency,
264741
+ progress: options.progress
264742
+ }));
264743
+ const environment = await tagStep2("deploy", () => setEnvironmentVersion(options.target ?? DEFAULT_ENVIRONMENT, version.versionId, {
264744
+ idempotencyKey: randomUUID4()
264745
+ }));
264746
+ return {
264747
+ environment: environment.name,
264748
+ versionId: environment.versionId,
264749
+ manifestHash: environment.manifestHash,
264750
+ deploymentId: environment.deploymentId
264751
+ };
264752
+ }
264753
+
264754
+ // src/core/version/routes.ts
264705
264755
  import { join as join30 } from "node:path";
264756
+ var RoutesFileSchema = object({
264757
+ pages: array(object({
264758
+ path: string2().startsWith("/"),
264759
+ name: string2().min(1),
264760
+ file: string2().min(1),
264761
+ requires_auth: boolean2().optional(),
264762
+ binding: object({
264763
+ entity: string2().min(1),
264764
+ param: string2().min(1),
264765
+ field: string2().min(1),
264766
+ extra_params: record(string2(), string2()).optional()
264767
+ }).optional(),
264768
+ segment_values: record(string2(), array(string2())).optional()
264769
+ })),
264770
+ home: string2().nullable().optional(),
264771
+ entity_pages: record(string2(), array(string2())).optional(),
264772
+ entity_free_paths: array(string2()).optional()
264773
+ }).transform((data) => ({
264774
+ pages: data.pages.map((page) => ({
264775
+ path: page.path,
264776
+ name: page.name,
264777
+ file: page.file,
264778
+ ...page.requires_auth ? { requiresAuth: true } : {},
264779
+ ...page.binding ? {
264780
+ binding: {
264781
+ entity: page.binding.entity,
264782
+ param: page.binding.param,
264783
+ field: page.binding.field,
264784
+ ...page.binding.extra_params ? { extraParams: page.binding.extra_params } : {}
264785
+ }
264786
+ } : {},
264787
+ ...page.segment_values ? { segmentValues: page.segment_values } : {}
264788
+ })),
264789
+ home: data.home ?? null,
264790
+ ...data.entity_pages ? { entityPages: data.entity_pages } : {},
264791
+ ...data.entity_free_paths ? { entityFreePaths: data.entity_free_paths } : {}
264792
+ }));
264793
+ async function readRoutesFile(path) {
264794
+ const parsed = RoutesFileSchema.safeParse(await readJsonFile(path));
264795
+ if (!parsed.success) {
264796
+ throw new SchemaValidationError("Invalid routes file", parsed.error, path);
264797
+ }
264798
+ return parsed.data;
264799
+ }
264800
+ async function collectRoutes(projectRoot, routesFile) {
264801
+ if (routesFile) {
264802
+ return await readRoutesFile(routesFile);
264803
+ }
264804
+ const pages = await collectPages(projectRoot);
264805
+ return pages ? { pages, home: pages[0]?.name ?? null } : null;
264806
+ }
264706
264807
  var ROUTES_DIR = "src/routes";
264707
264808
  var ROUTE_TREE = "src/routeTree.gen.ts";
264708
264809
  var ROUTE_EXTENSIONS = [".tsx", ".ts", ".jsx", ".js"];
@@ -264849,29 +264950,6 @@ async function collectPages(projectRoot) {
264849
264950
  });
264850
264951
  }
264851
264952
 
264852
- // src/core/version/publish.ts
264853
- import { randomUUID as randomUUID4 } from "node:crypto";
264854
- var DEFAULT_ENVIRONMENT = "production";
264855
- async function tagStep2(step, run) {
264856
- return await tagStep(step, run);
264857
- }
264858
- async function publishVersion(artifacts, options = {}) {
264859
- const version = await tagStep2("create_version", () => createVersion(artifacts, {
264860
- sourceCommit: options.sourceCommit,
264861
- concurrency: options.concurrency,
264862
- progress: options.progress
264863
- }));
264864
- const environment = await tagStep2("deploy", () => setEnvironmentVersion(options.target ?? DEFAULT_ENVIRONMENT, version.versionId, {
264865
- idempotencyKey: randomUUID4()
264866
- }));
264867
- return {
264868
- environment: environment.name,
264869
- versionId: environment.versionId,
264870
- manifestHash: environment.manifestHash,
264871
- deploymentId: environment.deploymentId
264872
- };
264873
- }
264874
-
264875
264953
  // src/core/version/artifacts.ts
264876
264954
  var MAX_FILE_COUNT = 50000;
264877
264955
  var HASH_CONCURRENCY = 32;
@@ -264964,10 +265042,10 @@ async function collectResources(configDir, dirs) {
264964
265042
  ]);
264965
265043
  return { entities, agents, mcpConfig, agentSkills };
264966
265044
  }
264967
- async function collectArtifacts(target) {
265045
+ async function collectArtifacts(target, options = {}) {
264968
265046
  const built = await resolveFullStackBuild(target.root);
264969
265047
  const siteWorker = built ? await describeSiteWorker(built) : null;
264970
- const pages = await collectPages(target.root);
265048
+ const routes = await collectRoutes(target.root, options.routesFile);
264971
265049
  return {
264972
265050
  assets: built ? built.assetsDir ? await collectBuildOutput(built.assetsDir) : [] : await collectBuildOutput(target.outputDir, {
264973
265051
  entryFile: ENTRY2
@@ -264976,7 +265054,7 @@ async function collectArtifacts(target) {
264976
265054
  backendBundles: await tagStep2("build", () => compileBackendBundles(target.root, join31(target.configDir, target.functionsDir))),
264977
265055
  actors: await tagStep2("build", () => compileActors(join31(target.configDir, target.actorsDir))),
264978
265056
  ...await collectResources(target.configDir, target),
264979
- ...pages ? { pages } : {}
265057
+ ...routes ? { routes } : {}
264980
265058
  };
264981
265059
  }
264982
265060
  // src/core/version/gate.ts
@@ -264995,6 +265073,9 @@ function targetOption() {
264995
265073
  function gitHashOption() {
264996
265074
  return new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser(parseGitHash);
264997
265075
  }
265076
+ function routesFileOption() {
265077
+ return new Option2("--routes-file <path>", "The app's routes as JSON, instead of reading them from its route files");
265078
+ }
264998
265079
  function concurrencyOption() {
264999
265080
  return new Option2("--concurrency <n>", "Parallel file uploads").default(DEFAULT_VERSION_UPLOAD_CONCURRENCY).argParser((value) => {
265000
265081
  const parsed = Number(value);
@@ -265019,7 +265100,7 @@ async function publishAction(ctx, options) {
265019
265100
  }
265020
265101
  const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
265021
265102
  const result = await runTask("Publishing...", async (updateMessage) => {
265022
- const artifacts = await tagStep2("create_version", () => collectArtifacts(target));
265103
+ const artifacts = await tagStep2("create_version", () => collectArtifacts(target, { routesFile: options.routesFile }));
265023
265104
  return await publishVersion(artifacts, {
265024
265105
  sourceCommit: gitHash,
265025
265106
  target: options.target,
@@ -265040,7 +265121,7 @@ async function publishAction(ctx, options) {
265040
265121
  };
265041
265122
  }
265042
265123
  function getPublishCommand() {
265043
- return new Base44Command("publish").description("Build the app, record it as a version, and serve that version").option("--no-build", "Publish the existing build output without rebuilding").addOption(outputDirOption()).addOption(targetOption()).addOption(gitHashOption()).addOption(concurrencyOption()).action(publishAction);
265124
+ return new Base44Command("publish").description("Build the app, record it as a version, and serve that version").option("--no-build", "Publish the existing build output without rebuilding").addOption(outputDirOption()).addOption(targetOption()).addOption(gitHashOption()).addOption(concurrencyOption()).addOption(routesFileOption()).action(publishAction);
265044
265125
  }
265045
265126
 
265046
265127
  // src/core/resources/sandbox/schema.ts
@@ -266766,7 +266847,7 @@ async function createAction2(ctx, options) {
266766
266847
  outputDir: options.outputDir
266767
266848
  });
266768
266849
  const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
266769
- const version = await runTask("Creating version...", async (updateMessage) => await createVersion(await collectArtifacts(target), {
266850
+ const version = await runTask("Creating version...", async (updateMessage) => await createVersion(await collectArtifacts(target, { routesFile: options.routesFile }), {
266770
266851
  sourceCommit: gitHash,
266771
266852
  concurrency: options.concurrency,
266772
266853
  progress: {
@@ -266784,7 +266865,7 @@ async function createAction2(ctx, options) {
266784
266865
  };
266785
266866
  }
266786
266867
  function getVersionCreateCommand() {
266787
- return new Base44Command("create").description("Record the built output as a version, without deploying it").addOption(outputDirOption()).addOption(gitHashOption()).addOption(concurrencyOption()).action(createAction2);
266868
+ return new Base44Command("create").description("Record the built output as a version, without deploying it").addOption(outputDirOption()).addOption(gitHashOption()).addOption(concurrencyOption()).addOption(routesFileOption()).action(createAction2);
266788
266869
  }
266789
266870
 
266790
266871
  // src/cli/commands/versions/deploy.ts
@@ -275525,4 +275606,4 @@ export {
275525
275606
  runCLI
275526
275607
  };
275527
275608
 
275528
- //# debugId=FB9FF0E01E1A0F2F64756E2164756E21
275609
+ //# debugId=427BD69CACE6446D64756E2164756E21