@base44-preview/cli 0.1.7-pr.584.b9b7274 → 0.1.7-pr.585.083d2ac

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
@@ -254777,8 +254777,8 @@ async function finalizeDeployment(deploymentId, completionJwt, modules) {
254777
254777
  const formData = new FormData;
254778
254778
  formData.append("payload", JSON.stringify({ completion_jwt: completionJwt }));
254779
254779
  for (const module of modules) {
254780
- const content = await readFile2(module.absolutePath);
254781
- formData.append(module.name, new File([new Uint8Array(content)], module.name, {
254780
+ const content = module.content !== undefined ? module.content : new Uint8Array(await readFile2(module.absolutePath));
254781
+ formData.append(module.name, new File([content], module.name, {
254782
254782
  type: MODULE_CONTENT_TYPES[module.type]
254783
254783
  }));
254784
254784
  }
@@ -255331,6 +255331,50 @@ function buildAssetsConfig(assetsConfig, progress) {
255331
255331
  run_worker_first: runWorkerFirst
255332
255332
  };
255333
255333
  }
255334
+ // src/core/deployments/static-site.ts
255335
+ var STATIC_WORKERS_ENV = "BASE44_STATIC_WORKERS";
255336
+ function staticWorkersEnabled(env2 = process.env) {
255337
+ const value = env2[STATIC_WORKERS_ENV];
255338
+ return value === "1" || value === "true";
255339
+ }
255340
+ var STUB_MODULE_NAME = "index.js";
255341
+ var STUB_SOURCE = `export default {
255342
+ async fetch(request, env) {
255343
+ return env.ASSETS.fetch(request);
255344
+ },
255345
+ };
255346
+ `;
255347
+ var STATIC_COMPATIBILITY_DATE = "2026-01-01";
255348
+ async function deployStaticSite(options) {
255349
+ const { outputDir, gitHash, progress } = options;
255350
+ const assets = await buildAssetManifest(outputDir, getAppContext().id);
255351
+ const created = await createDeployment({
255352
+ git_hash: gitHash,
255353
+ config: {
255354
+ main: STUB_MODULE_NAME,
255355
+ compatibility_date: STATIC_COMPATIBILITY_DATE,
255356
+ compatibility_flags: [],
255357
+ assets: { not_found_handling: "single-page-application" }
255358
+ },
255359
+ asset_manifest: assets.manifest
255360
+ });
255361
+ const totalAssets = Object.keys(assets.manifest).length;
255362
+ const newAssets = new Set(created.assetBuckets.flat()).size;
255363
+ progress?.onAssets?.({ totalAssets, newAssets });
255364
+ const completionJwt = await uploadAssetBuckets(created.deploymentId, created.assetBuckets, assets.filesByHash, progress?.onAssetUpload);
255365
+ const stubBytes = new TextEncoder().encode(STUB_SOURCE);
255366
+ const modules = [
255367
+ {
255368
+ name: STUB_MODULE_NAME,
255369
+ content: stubBytes,
255370
+ size: stubBytes.byteLength,
255371
+ type: "esm"
255372
+ }
255373
+ ];
255374
+ progress?.onWorker?.({ moduleCount: modules.length });
255375
+ const finalized = await finalizeDeployment(created.deploymentId, completionJwt, modules);
255376
+ return { deploymentId: finalized.deploymentId, gitHash };
255377
+ }
255334
255378
  // src/core/utils/dependencies.ts
255335
255379
  import { spawnSync as spawnSync2 } from "node:child_process";
255336
255380
  function verifyDenoInstalled(context) {
@@ -257606,7 +257650,11 @@ ${summaryLines.join(`
257606
257650
  fullStackResult = await runFullStackDeploy(ctx, project2.root, options);
257607
257651
  } else if (project2.site?.outputDirectory) {
257608
257652
  const outputDir = resolve11(project2.root, project2.site.outputDirectory);
257609
- ({ appUrl } = await deploySite(outputDir));
257653
+ if (staticWorkersEnabled()) {
257654
+ fullStackResult = await runFullStackDeploy(ctx, project2.root, options, outputDir);
257655
+ } else {
257656
+ ({ appUrl } = await deploySite(outputDir));
257657
+ }
257610
257658
  }
257611
257659
  const connectorResults = result.connectorResults ?? [];
257612
257660
  await handleOAuthConnectors(connectorResults, isNonInteractive, options, log);
@@ -257649,14 +257697,12 @@ async function buildSiteIfNeeded({ runTask: runTask2 }, { project: project2 }, o
257649
257697
  errorMessage: "Failed to build project"
257650
257698
  });
257651
257699
  }
257652
- async function runFullStackDeploy({ runTask: runTask2, log }, projectRoot, options) {
257700
+ async function runFullStackDeploy({ runTask: runTask2, log }, projectRoot, options, staticOutputDir) {
257653
257701
  const gitHash = await resolveGitHash(projectRoot, options.gitHash);
257654
257702
  const progressLines = [];
257655
257703
  const warnings = [];
257656
- const deployment = await runTask2("Deploying full-stack app...", async (updateMessage) => await deployFullStack({
257657
- projectRoot,
257658
- gitHash,
257659
- progress: {
257704
+ const deployment = await runTask2(staticOutputDir ? "Deploying site to Workers..." : "Deploying full-stack app...", async (updateMessage) => {
257705
+ const progress = {
257660
257706
  onWarning: (message) => {
257661
257707
  warnings.push(message);
257662
257708
  },
@@ -257671,10 +257717,15 @@ async function runFullStackDeploy({ runTask: runTask2, log }, projectRoot, optio
257671
257717
  onWorker: ({ moduleCount }) => {
257672
257718
  updateMessage(`Deploying worker (${moduleCount} modules)…`);
257673
257719
  }
257674
- }
257675
- }), {
257676
- successMessage: theme.colors.base44Orange("Full-stack app deployed"),
257677
- errorMessage: "Full-stack deploy failed"
257720
+ };
257721
+ return staticOutputDir ? await deployStaticSite({
257722
+ outputDir: staticOutputDir,
257723
+ gitHash,
257724
+ progress
257725
+ }) : await deployFullStack({ projectRoot, gitHash, progress });
257726
+ }, {
257727
+ successMessage: theme.colors.base44Orange(staticOutputDir ? "Site deployed to Workers" : "Full-stack app deployed"),
257728
+ errorMessage: staticOutputDir ? "Site deploy failed" : "Full-stack deploy failed"
257678
257729
  });
257679
257730
  for (const line of progressLines) {
257680
257731
  log.message(theme.styles.dim(line));
@@ -267375,4 +267426,4 @@ export {
267375
267426
  CLIExitError
267376
267427
  };
267377
267428
 
267378
- //# debugId=ACC632618E19D78664756E2164756E21
267429
+ //# debugId=FFEEAB2F2B84F55664756E2164756E21