@base44-preview/cli 0.3.4-pr.703.4ec4bf2 → 0.3.5-pr.703.0e7d6f3

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
@@ -228045,6 +228045,14 @@ function object(shape, params) {
228045
228045
  };
228046
228046
  return new ZodObject(def);
228047
228047
  }
228048
+ function strictObject(shape, params) {
228049
+ return new ZodObject({
228050
+ type: "object",
228051
+ shape,
228052
+ catchall: never(),
228053
+ ...normalizeParams(params)
228054
+ });
228055
+ }
228048
228056
  function looseObject(shape, params) {
228049
228057
  return new ZodObject({
228050
228058
  type: "object",
@@ -239464,7 +239472,7 @@ import { join as join13 } from "node:path";
239464
239472
  // package.json
239465
239473
  var package_default = {
239466
239474
  name: "base44",
239467
- version: "0.3.4",
239475
+ version: "0.3.5",
239468
239476
  description: "Base44 CLI - Unified interface for managing Base44 applications",
239469
239477
  type: "module",
239470
239478
  bin: {
@@ -252869,6 +252877,33 @@ function declaredActor({
252869
252877
  static_egress: staticEgress
252870
252878
  };
252871
252879
  }
252880
+ function declaredRoutes({
252881
+ pages,
252882
+ home,
252883
+ entityPages,
252884
+ entityFreePaths
252885
+ }) {
252886
+ return {
252887
+ pages: pages.map(({ path, name, file, requiresAuth, binding, segmentValues }) => ({
252888
+ path,
252889
+ name,
252890
+ file,
252891
+ ...requiresAuth ? { requires_auth: true } : {},
252892
+ ...binding ? {
252893
+ binding: {
252894
+ entity: binding.entity,
252895
+ param: binding.param,
252896
+ field: binding.field,
252897
+ ...binding.extraParams ? { extra_params: binding.extraParams } : {}
252898
+ }
252899
+ } : {},
252900
+ ...segmentValues ? { segment_values: segmentValues } : {}
252901
+ })),
252902
+ home,
252903
+ ...entityPages ? { entity_pages: entityPages } : {},
252904
+ ...entityFreePaths ? { entity_free_paths: entityFreePaths } : {}
252905
+ };
252906
+ }
252872
252907
  function actorUploadPath(actor) {
252873
252908
  return `actors/${actor.name}.mjs`;
252874
252909
  }
@@ -252931,7 +252966,7 @@ async function createVersion(artifacts, options = {}) {
252931
252966
  agents: artifacts.agents,
252932
252967
  mcp_config: artifacts.mcpConfig,
252933
252968
  agent_skills: artifacts.agentSkills,
252934
- ...artifacts.pages ? { pages: artifacts.pages } : {},
252969
+ ...artifacts.routes ? { routes: declaredRoutes(artifacts.routes) } : {},
252935
252970
  source_commit: options.sourceCommit
252936
252971
  }, "declaring a version")).json(), "declare");
252937
252972
  const declaredFiles = [
@@ -264701,8 +264736,82 @@ function compiledModule(name, result) {
264701
264736
  return result.module;
264702
264737
  }
264703
264738
 
264704
- // src/core/version/pages.ts
264739
+ // src/core/version/publish.ts
264740
+ import { randomUUID as randomUUID4 } from "node:crypto";
264741
+ var DEFAULT_ENVIRONMENT = "production";
264742
+ async function tagStep2(step, run) {
264743
+ return await tagStep(step, run);
264744
+ }
264745
+ async function publishVersion(artifacts, options = {}) {
264746
+ const version = await tagStep2("create_version", () => createVersion(artifacts, {
264747
+ sourceCommit: options.sourceCommit,
264748
+ concurrency: options.concurrency,
264749
+ progress: options.progress
264750
+ }));
264751
+ const environment = await tagStep2("deploy", () => setEnvironmentVersion(options.target ?? DEFAULT_ENVIRONMENT, version.versionId, {
264752
+ idempotencyKey: randomUUID4()
264753
+ }));
264754
+ return {
264755
+ environment: environment.name,
264756
+ versionId: environment.versionId,
264757
+ manifestHash: environment.manifestHash,
264758
+ deploymentId: environment.deploymentId
264759
+ };
264760
+ }
264761
+
264762
+ // src/core/version/routes.ts
264705
264763
  import { join as join30 } from "node:path";
264764
+ var RoutesFileSchema = strictObject({
264765
+ pages: array(strictObject({
264766
+ path: string2().startsWith("/"),
264767
+ name: string2().min(1),
264768
+ file: string2().min(1),
264769
+ requires_auth: boolean2().optional(),
264770
+ binding: strictObject({
264771
+ entity: string2().min(1),
264772
+ param: string2().min(1),
264773
+ field: string2().min(1),
264774
+ extra_params: record(string2(), string2()).optional()
264775
+ }).optional(),
264776
+ segment_values: record(string2(), array(string2())).optional()
264777
+ })),
264778
+ home: string2().nullable().optional(),
264779
+ entity_pages: record(string2(), array(string2())).optional(),
264780
+ entity_free_paths: array(string2()).optional()
264781
+ }).transform((data) => ({
264782
+ pages: data.pages.map((page) => ({
264783
+ path: page.path,
264784
+ name: page.name,
264785
+ file: page.file,
264786
+ ...page.requires_auth ? { requiresAuth: true } : {},
264787
+ ...page.binding ? {
264788
+ binding: {
264789
+ entity: page.binding.entity,
264790
+ param: page.binding.param,
264791
+ field: page.binding.field,
264792
+ ...page.binding.extra_params ? { extraParams: page.binding.extra_params } : {}
264793
+ }
264794
+ } : {},
264795
+ ...page.segment_values ? { segmentValues: page.segment_values } : {}
264796
+ })),
264797
+ home: data.home ?? null,
264798
+ ...data.entity_pages ? { entityPages: data.entity_pages } : {},
264799
+ ...data.entity_free_paths ? { entityFreePaths: data.entity_free_paths } : {}
264800
+ }));
264801
+ async function readRoutesFile(path) {
264802
+ const parsed = RoutesFileSchema.safeParse(await readJsonFile(path));
264803
+ if (!parsed.success) {
264804
+ throw new SchemaValidationError("Invalid routes file", parsed.error, path);
264805
+ }
264806
+ return parsed.data;
264807
+ }
264808
+ async function collectRoutes(projectRoot, routesFile) {
264809
+ if (routesFile) {
264810
+ return await readRoutesFile(routesFile);
264811
+ }
264812
+ const pages = await collectPages(projectRoot);
264813
+ return pages ? { pages, home: pages[0]?.name ?? null } : null;
264814
+ }
264706
264815
  var ROUTES_DIR = "src/routes";
264707
264816
  var ROUTE_TREE = "src/routeTree.gen.ts";
264708
264817
  var ROUTE_EXTENSIONS = [".tsx", ".ts", ".jsx", ".js"];
@@ -264849,29 +264958,6 @@ async function collectPages(projectRoot) {
264849
264958
  });
264850
264959
  }
264851
264960
 
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
264961
  // src/core/version/artifacts.ts
264876
264962
  var MAX_FILE_COUNT = 50000;
264877
264963
  var HASH_CONCURRENCY = 32;
@@ -264964,10 +265050,10 @@ async function collectResources(configDir, dirs) {
264964
265050
  ]);
264965
265051
  return { entities, agents, mcpConfig, agentSkills };
264966
265052
  }
264967
- async function collectArtifacts(target) {
265053
+ async function collectArtifacts(target, options = {}) {
264968
265054
  const built = await resolveFullStackBuild(target.root);
264969
265055
  const siteWorker = built ? await describeSiteWorker(built) : null;
264970
- const pages = await collectPages(target.root);
265056
+ const routes = await collectRoutes(target.root, options.routesFile);
264971
265057
  return {
264972
265058
  assets: built ? built.assetsDir ? await collectBuildOutput(built.assetsDir) : [] : await collectBuildOutput(target.outputDir, {
264973
265059
  entryFile: ENTRY2
@@ -264976,7 +265062,7 @@ async function collectArtifacts(target) {
264976
265062
  backendBundles: await tagStep2("build", () => compileBackendBundles(target.root, join31(target.configDir, target.functionsDir))),
264977
265063
  actors: await tagStep2("build", () => compileActors(join31(target.configDir, target.actorsDir))),
264978
265064
  ...await collectResources(target.configDir, target),
264979
- ...pages ? { pages } : {}
265065
+ ...routes ? { routes } : {}
264980
265066
  };
264981
265067
  }
264982
265068
  // src/core/version/gate.ts
@@ -264995,6 +265081,9 @@ function targetOption() {
264995
265081
  function gitHashOption() {
264996
265082
  return new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser(parseGitHash);
264997
265083
  }
265084
+ function routesFileOption() {
265085
+ return new Option2("--routes-file <path>", "The app's routes as JSON, instead of reading them from its route files");
265086
+ }
264998
265087
  function concurrencyOption() {
264999
265088
  return new Option2("--concurrency <n>", "Parallel file uploads").default(DEFAULT_VERSION_UPLOAD_CONCURRENCY).argParser((value) => {
265000
265089
  const parsed = Number(value);
@@ -265019,7 +265108,7 @@ async function publishAction(ctx, options) {
265019
265108
  }
265020
265109
  const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
265021
265110
  const result = await runTask("Publishing...", async (updateMessage) => {
265022
- const artifacts = await tagStep2("create_version", () => collectArtifacts(target));
265111
+ const artifacts = await tagStep2("create_version", () => collectArtifacts(target, { routesFile: options.routesFile }));
265023
265112
  return await publishVersion(artifacts, {
265024
265113
  sourceCommit: gitHash,
265025
265114
  target: options.target,
@@ -265040,7 +265129,7 @@ async function publishAction(ctx, options) {
265040
265129
  };
265041
265130
  }
265042
265131
  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);
265132
+ 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
265133
  }
265045
265134
 
265046
265135
  // src/core/resources/sandbox/schema.ts
@@ -266766,7 +266855,7 @@ async function createAction2(ctx, options) {
266766
266855
  outputDir: options.outputDir
266767
266856
  });
266768
266857
  const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
266769
- const version = await runTask("Creating version...", async (updateMessage) => await createVersion(await collectArtifacts(target), {
266858
+ const version = await runTask("Creating version...", async (updateMessage) => await createVersion(await collectArtifacts(target, { routesFile: options.routesFile }), {
266770
266859
  sourceCommit: gitHash,
266771
266860
  concurrency: options.concurrency,
266772
266861
  progress: {
@@ -266784,7 +266873,7 @@ async function createAction2(ctx, options) {
266784
266873
  };
266785
266874
  }
266786
266875
  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);
266876
+ 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
266877
  }
266789
266878
 
266790
266879
  // src/cli/commands/versions/deploy.ts
@@ -275525,4 +275614,4 @@ export {
275525
275614
  runCLI
275526
275615
  };
275527
275616
 
275528
- //# debugId=FB9FF0E01E1A0F2F64756E2164756E21
275617
+ //# debugId=E189FA51139F7E2864756E2164756E21