@base44-preview/cli 0.0.55-pr.545.8ee8765 → 0.0.55-pr.545.9513e13
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 +52 -27
- package/dist/cli/index.js.map +5 -5
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -255490,6 +255490,7 @@ class ServeRunner {
|
|
|
255490
255490
|
logger;
|
|
255491
255491
|
child;
|
|
255492
255492
|
stopping = false;
|
|
255493
|
+
stopPromise;
|
|
255493
255494
|
exitListeners = [];
|
|
255494
255495
|
constructor(options8) {
|
|
255495
255496
|
this.command = options8.command;
|
|
@@ -255501,12 +255502,14 @@ class ServeRunner {
|
|
|
255501
255502
|
if (this.child) {
|
|
255502
255503
|
return;
|
|
255503
255504
|
}
|
|
255505
|
+
const stdin2 = process21.platform === "win32" ? "ignore" : "inherit";
|
|
255504
255506
|
const child = spawn3(this.command, {
|
|
255505
255507
|
cwd: this.cwd,
|
|
255506
255508
|
shell: true,
|
|
255507
|
-
detached:
|
|
255509
|
+
detached: true,
|
|
255508
255510
|
env: { ...process21.env, ...this.env },
|
|
255509
|
-
stdio: [
|
|
255511
|
+
stdio: [stdin2, "pipe", "pipe"],
|
|
255512
|
+
windowsHide: true
|
|
255510
255513
|
});
|
|
255511
255514
|
this.child = child;
|
|
255512
255515
|
this.setupHandlers(child);
|
|
@@ -255515,32 +255518,29 @@ class ServeRunner {
|
|
|
255515
255518
|
this.exitListeners.push(listener);
|
|
255516
255519
|
}
|
|
255517
255520
|
async stop() {
|
|
255521
|
+
if (this.stopPromise) {
|
|
255522
|
+
return this.stopPromise;
|
|
255523
|
+
}
|
|
255524
|
+
this.stopPromise = this.stopChild();
|
|
255525
|
+
return this.stopPromise;
|
|
255526
|
+
}
|
|
255527
|
+
async stopChild() {
|
|
255518
255528
|
const child = this.child;
|
|
255519
255529
|
if (!child || child.exitCode !== null) {
|
|
255520
255530
|
return;
|
|
255521
255531
|
}
|
|
255522
255532
|
this.stopping = true;
|
|
255523
|
-
const hasExited = () => child.exitCode !== null || child.signalCode !== null;
|
|
255524
255533
|
const exited = new Promise((resolve10) => child.once("exit", () => resolve10()));
|
|
255525
|
-
const waitForExit2 = async (timeoutMs) => {
|
|
255526
|
-
await Promise.race([
|
|
255527
|
-
exited,
|
|
255528
|
-
new Promise((resolve10) => setTimeout(resolve10, timeoutMs))
|
|
255529
|
-
]);
|
|
255530
|
-
};
|
|
255531
255534
|
if (process21.platform === "win32" && child.pid) {
|
|
255532
255535
|
const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
255533
|
-
stdio: "ignore"
|
|
255536
|
+
stdio: "ignore",
|
|
255537
|
+
windowsHide: true
|
|
255534
255538
|
});
|
|
255535
|
-
await new Promise((resolve10) =>
|
|
255536
|
-
|
|
255537
|
-
|
|
255538
|
-
|
|
255539
|
-
|
|
255540
|
-
}
|
|
255541
|
-
return;
|
|
255542
|
-
}
|
|
255543
|
-
if (child.pid) {
|
|
255539
|
+
await new Promise((resolve10) => {
|
|
255540
|
+
taskkill.once("exit", () => resolve10());
|
|
255541
|
+
taskkill.once("error", () => resolve10());
|
|
255542
|
+
});
|
|
255543
|
+
} else if (child.pid) {
|
|
255544
255544
|
try {
|
|
255545
255545
|
process21.kill(-child.pid, "SIGTERM");
|
|
255546
255546
|
} catch {
|
|
@@ -257287,7 +257287,7 @@ async function createDevServer(options8) {
|
|
|
257287
257287
|
port: process.env.IS_TEST === "true" ? undefined : DEFAULT_PORT
|
|
257288
257288
|
});
|
|
257289
257289
|
const baseUrl = `http://localhost:${port}`;
|
|
257290
|
-
const { functions, entities, project: project2 } = await options8.loadResources();
|
|
257290
|
+
const { functions, entities, project: project2, siteUrl } = await options8.loadResources();
|
|
257291
257291
|
const app = import_express6.default();
|
|
257292
257292
|
const remoteProxy = import_http_proxy_middleware2.createProxyMiddleware({
|
|
257293
257293
|
target: BASE44_APP_URL,
|
|
@@ -257347,6 +257347,12 @@ async function createDevServer(options8) {
|
|
|
257347
257347
|
const customIntegrationRoutes = createCustomIntegrationRoutes(remoteProxy, devLogger);
|
|
257348
257348
|
app.use("/api/apps/:appId/integrations/custom", customIntegrationRoutes);
|
|
257349
257349
|
app.use((req, res, next) => {
|
|
257350
|
+
if (siteUrl && (req.path === "/login" || req.path.startsWith("/login/"))) {
|
|
257351
|
+
const targetUrl = new URL(req.originalUrl, siteUrl);
|
|
257352
|
+
devLogger.warn(`"${req.originalUrl}" requires hosted login, redirecting to ${targetUrl.toString()}`);
|
|
257353
|
+
res.redirect(targetUrl.toString());
|
|
257354
|
+
return;
|
|
257355
|
+
}
|
|
257350
257356
|
if (!req.originalUrl.endsWith("analytics/track/batch")) {
|
|
257351
257357
|
devLogger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
257352
257358
|
}
|
|
@@ -257416,12 +257422,27 @@ async function createDevServer(options8) {
|
|
|
257416
257422
|
logger: createDevLogger("frontend", theme.colors.base44Orange)
|
|
257417
257423
|
});
|
|
257418
257424
|
}
|
|
257425
|
+
let shutdownPromise;
|
|
257419
257426
|
const shutdown = async () => {
|
|
257420
|
-
|
|
257421
|
-
|
|
257422
|
-
|
|
257423
|
-
|
|
257424
|
-
|
|
257427
|
+
shutdownPromise ??= (async () => {
|
|
257428
|
+
base44ConfigWatcher.close();
|
|
257429
|
+
io6.close();
|
|
257430
|
+
await functionManager.stopAll();
|
|
257431
|
+
await serveRunner?.stop();
|
|
257432
|
+
await new Promise((resolve12, reject) => {
|
|
257433
|
+
server.close((error48) => {
|
|
257434
|
+
if (error48) {
|
|
257435
|
+
reject(error48);
|
|
257436
|
+
return;
|
|
257437
|
+
}
|
|
257438
|
+
resolve12();
|
|
257439
|
+
});
|
|
257440
|
+
});
|
|
257441
|
+
})().catch((error48) => {
|
|
257442
|
+
const errorMessage = error48 instanceof Error ? error48.message : String(error48);
|
|
257443
|
+
devLogger.error(`Failed to shut down dev server: ${errorMessage}`);
|
|
257444
|
+
});
|
|
257445
|
+
return shutdownPromise;
|
|
257425
257446
|
};
|
|
257426
257447
|
process.on("SIGINT", shutdown);
|
|
257427
257448
|
process.on("SIGTERM", shutdown);
|
|
@@ -257452,6 +257473,9 @@ async function devAction(ctx, options8) {
|
|
|
257452
257473
|
}
|
|
257453
257474
|
const port = options8.port ? Number(options8.port) : undefined;
|
|
257454
257475
|
const appId = app.id;
|
|
257476
|
+
const siteUrlPromise = getSiteUrl().catch(() => {
|
|
257477
|
+
return;
|
|
257478
|
+
});
|
|
257455
257479
|
const { port: resolvedPort, isServingFrontend } = await createDevServer({
|
|
257456
257480
|
log,
|
|
257457
257481
|
port,
|
|
@@ -257459,7 +257483,8 @@ async function devAction(ctx, options8) {
|
|
|
257459
257483
|
denoWrapperPath: getDenoWrapperPath(),
|
|
257460
257484
|
loadResources: async () => {
|
|
257461
257485
|
const { functions, entities, project: project2 } = await readProjectConfig();
|
|
257462
|
-
|
|
257486
|
+
const siteUrl = await siteUrlPromise;
|
|
257487
|
+
return { functions, entities, project: project2, siteUrl };
|
|
257463
257488
|
}
|
|
257464
257489
|
});
|
|
257465
257490
|
const outroMessage = isServingFrontend ? "Open your app using the frontend dev server URL" : `Dev server is available at ${theme.colors.links(localServerUrl(resolvedPort))}`;
|
|
@@ -261945,4 +261970,4 @@ export {
|
|
|
261945
261970
|
CLIExitError
|
|
261946
261971
|
};
|
|
261947
261972
|
|
|
261948
|
-
//# debugId=
|
|
261973
|
+
//# debugId=F0F854B64EB6D34464756E2164756E21
|