@base44-preview/cli 0.3.6-pr.706.15dfd19 → 0.3.6-pr.708.10e5c9d

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
@@ -225957,10 +225957,6 @@ var DEFAULT_API_URL = "https://app.base44.com";
225957
225957
  function getBase44ApiUrl() {
225958
225958
  return process.env.BASE44_API_URL || DEFAULT_API_URL;
225959
225959
  }
225960
- function getAppsBackendUrl() {
225961
- const apiUrl = getBase44ApiUrl();
225962
- return apiUrl === DEFAULT_API_URL ? "https://base44.app" : apiUrl;
225963
- }
225964
225960
  function getTestOverrides() {
225965
225961
  const raw = process.env.BASE44_CLI_TEST_OVERRIDES;
225966
225962
  if (!raw) {
@@ -255325,6 +255321,37 @@ import {
255325
255321
  workerEnvironment
255326
255322
  } from "base44:internal/runtime-context";
255327
255323
 
255324
+ // src/platform-fetch.ts
255325
+ var PLATFORM_FETCH_BINDING_NAME = "BASE44_PLATFORM_FETCH";
255326
+ var platformFetchInstalled = false;
255327
+ function needsPlatformFetch(input, init) {
255328
+ try {
255329
+ const request = typeof input === "string" || input instanceof URL ? void 0 : input;
255330
+ const method = String(init?.method ?? request?.method ?? "GET");
255331
+ const headers = init?.headers === void 0 ? request?.headers : new Headers(init.headers);
255332
+ return method.toUpperCase() === "HEAD" || headers?.has("range") === true || (init?.cache ?? request?.cache) === "no-store";
255333
+ } catch {
255334
+ return false;
255335
+ }
255336
+ }
255337
+ function createPlatformFetch(originalFetch, readEnvironment) {
255338
+ return (input, init) => {
255339
+ const binding = readEnvironment()[PLATFORM_FETCH_BINDING_NAME];
255340
+ if (typeof binding?.fetch !== "function" || !needsPlatformFetch(input, init)) {
255341
+ return originalFetch(input, init);
255342
+ }
255343
+ return binding.fetch(input, init);
255344
+ };
255345
+ }
255346
+ function installPlatformFetch() {
255347
+ if (platformFetchInstalled) return;
255348
+ globalThis.fetch = createPlatformFetch(
255349
+ globalThis.fetch.bind(globalThis),
255350
+ workerEnvironment
255351
+ );
255352
+ platformFetchInstalled = true;
255353
+ }
255354
+
255328
255355
  // src/static-egress-marker.ts
255329
255356
  var STATIC_EGRESS_ARTIFACT_MARKER = "base44.static-egress.request-env.v2";
255330
255357
 
@@ -255610,6 +255637,7 @@ function resolveHandler(functionName) {
255610
255637
  }
255611
255638
  export {
255612
255639
  getRegisteredHandler,
255640
+ installPlatformFetch,
255613
255641
  installStaticEgressFetch,
255614
255642
  registerLazy,
255615
255643
  resolveHandler
@@ -258872,12 +258900,14 @@ function buildEntrySource(userEntry, telemetry, runtimeSecrets = false) {
258872
258900
  return `// Auto-generated by the base44 bundler. Do not edit.
258873
258901
 
258874
258902
  import { currentWorkerRuntimeContext as _b44Context, runWithWorkerEnvironment as _b44Run } from ${JSON.stringify(RUNTIME_CONTEXT_SPECIFIER)};
258875
- import { getRegisteredHandler, installStaticEgressFetch } from "./${SHIM_FILENAME}";${activationImport(runtimeSecrets)}
258903
+ import { getRegisteredHandler, installPlatformFetch, installStaticEgressFetch } from "./${SHIM_FILENAME}";${activationImport(runtimeSecrets)}
258876
258904
 
258877
258905
  ${consolePatch(runtimeSecrets)}
258878
258906
  ${ERROR_RECORDS_PATCH}
258879
258907
  // Static egress reads workerEnv from the active request store. Install it
258880
- // before telemetry so telemetry remains the outermost fetch wrapper.
258908
+ // before telemetry so telemetry remains the outermost fetch wrapper, and after
258909
+ // the platform fetch, which serves the requests it doesn't take.
258910
+ installPlatformFetch();
258881
258911
  installStaticEgressFetch();
258882
258912
  ${telemetry ? TELEMETRY_PATCH : ""}
258883
258913
 
@@ -258926,14 +258956,16 @@ function buildAppEntrySource(functionModules, telemetry, runtimeSecrets = false)
258926
258956
  return `// Auto-generated by the base44 bundler. Do not edit.
258927
258957
 
258928
258958
  import { currentWorkerRuntimeContext as _b44Context, runWithWorkerEnvironment as _b44Run } from ${JSON.stringify(RUNTIME_CONTEXT_SPECIFIER)};
258929
- import { installStaticEgressFetch, resolveHandler } from "./${SHIM_FILENAME}";${activationImport(runtimeSecrets)}
258959
+ import { installPlatformFetch, installStaticEgressFetch, resolveHandler } from "./${SHIM_FILENAME}";${activationImport(runtimeSecrets)}
258930
258960
  ${moduleImports}
258931
258961
 
258932
258962
  ${consolePatch(runtimeSecrets)}
258933
258963
  ${INVOCATION_LOGS_PATCH}
258934
258964
  ${ERROR_RECORDS_PATCH}
258935
258965
  // Static egress reads workerEnv from the active request store. Install it
258936
- // before telemetry so telemetry remains the outermost fetch wrapper.
258966
+ // before telemetry so telemetry remains the outermost fetch wrapper, and after
258967
+ // the platform fetch, which serves the requests it doesn't take.
258968
+ installPlatformFetch();
258937
258969
  installStaticEgressFetch();
258938
258970
  ${telemetry ? TELEMETRY_PATCH : ""}
258939
258971
 
@@ -259462,9 +259494,10 @@ export function actorRequestToRoom(request, actorName, room, verified) {
259462
259494
  function buildPrelude() {
259463
259495
  return `// Auto-generated by the base44 bundler. Do not edit.
259464
259496
  import { currentWorkerRuntimeContext as _b44Context } from ${JSON.stringify(RUNTIME_CONTEXT_SPECIFIER)};
259465
- import { installStaticEgressFetch } from "./${SHIM_FILENAME}";
259497
+ import { installPlatformFetch, installStaticEgressFetch } from "./${SHIM_FILENAME}";
259466
259498
 
259467
259499
  ${CONSOLE_PATCH}
259500
+ installPlatformFetch();
259468
259501
  installStaticEgressFetch();
259469
259502
  `;
259470
259503
  }
@@ -270981,6 +271014,7 @@ class WatchBase44 extends EventEmitter4 {
270981
271014
 
270982
271015
  // src/cli/dev/dev-server/main.ts
270983
271016
  var DEFAULT_PORT = 4400;
271017
+ var BASE44_APP_URL = "https://base44.app";
270984
271018
  async function createDevServer(options) {
270985
271019
  const { port: userPort } = options;
270986
271020
  const port = userPort ?? await getPorts({
@@ -270990,7 +271024,7 @@ async function createDevServer(options) {
270990
271024
  const { functions, entities, project, siteUrl } = await options.loadResources();
270991
271025
  const app = import_express6.default();
270992
271026
  const remoteProxy = import_http_proxy_middleware2.createProxyMiddleware({
270993
- target: getAppsBackendUrl(),
271027
+ target: BASE44_APP_URL,
270994
271028
  changeOrigin: true
270995
271029
  });
270996
271030
  app.use(import_cors.default({
@@ -271000,7 +271034,7 @@ async function createDevServer(options) {
271000
271034
  const AUTH_ROUTE_PATTERN = /^\/api\/apps\/auth(\/|$)/;
271001
271035
  app.use((req, res, next) => {
271002
271036
  if (AUTH_ROUTE_PATTERN.test(req.path)) {
271003
- const targetUrl = new URL(req.originalUrl, getAppsBackendUrl());
271037
+ const targetUrl = new URL(req.originalUrl, BASE44_APP_URL);
271004
271038
  return res.redirect(targetUrl.toString());
271005
271039
  }
271006
271040
  next();
@@ -271307,7 +271341,7 @@ function inheritedEnv() {
271307
271341
  }
271308
271342
  return env;
271309
271343
  }
271310
- var appPreviewUrl = (appId) => getBase44ApiUrl() === DEFAULT_API_URL ? `https://preview--${appId}.base44.app` : getBase44ApiUrl();
271344
+ var appPreviewUrl = (appId) => `https://preview--${appId}.base44.app`;
271311
271345
  async function resolveAppBaseUrl(appId) {
271312
271346
  try {
271313
271347
  return await getSiteUrl();
@@ -275663,4 +275697,4 @@ export {
275663
275697
  runCLI
275664
275698
  };
275665
275699
 
275666
- //# debugId=D50299D36725282164756E2164756E21
275700
+ //# debugId=88AC635692AD00BA64756E2164756E21