@base44-preview/cli 0.1.16-pr.637.845faaa → 0.1.17-pr.635.345b6e2
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 +298 -179
- package/dist/cli/index.js.map +15 -11
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -119090,7 +119090,7 @@ import path52 from "path";
|
|
|
119090
119090
|
import * as path42 from "path";
|
|
119091
119091
|
import * as fs26 from "fs/promises";
|
|
119092
119092
|
import * as path22 from "path";
|
|
119093
|
-
import
|
|
119093
|
+
import process23 from "process";
|
|
119094
119094
|
import * as path32 from "path";
|
|
119095
119095
|
import process32 from "process";
|
|
119096
119096
|
import path92 from "path";
|
|
@@ -119622,7 +119622,7 @@ function partition2(array2, predicate) {
|
|
|
119622
119622
|
return result;
|
|
119623
119623
|
}
|
|
119624
119624
|
async function findInDirectory(nameOrNames, { typeCheck, cwd, allowSymlinks = true, filter: filter2 }) {
|
|
119625
|
-
const directory = toAbsolutePath(cwd) ??
|
|
119625
|
+
const directory = toAbsolutePath(cwd) ?? process23.cwd();
|
|
119626
119626
|
const names = Array.isArray(nameOrNames) ? nameOrNames : [nameOrNames];
|
|
119627
119627
|
for (const name of names) {
|
|
119628
119628
|
const fileOrDirectory = path22.join(directory, name);
|
|
@@ -146002,10 +146002,10 @@ __export(exports_supports_color, {
|
|
|
146002
146002
|
createSupportsColor: () => createSupportsColor2,
|
|
146003
146003
|
default: () => supports_color_default2
|
|
146004
146004
|
});
|
|
146005
|
-
import
|
|
146005
|
+
import process24 from "node:process";
|
|
146006
146006
|
import os9 from "node:os";
|
|
146007
146007
|
import tty4 from "node:tty";
|
|
146008
|
-
function hasFlag2(flag, argv = globalThis.Deno ? globalThis.Deno.args :
|
|
146008
|
+
function hasFlag2(flag, argv = globalThis.Deno ? globalThis.Deno.args : process24.argv) {
|
|
146009
146009
|
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
146010
146010
|
const position = argv.indexOf(prefix + flag);
|
|
146011
146011
|
const terminatorPosition = argv.indexOf("--");
|
|
@@ -146068,7 +146068,7 @@ function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
146068
146068
|
if (env3.TERM === "dumb") {
|
|
146069
146069
|
return min;
|
|
146070
146070
|
}
|
|
146071
|
-
if (
|
|
146071
|
+
if (process24.platform === "win32") {
|
|
146072
146072
|
const osRelease = os9.release().split(".");
|
|
146073
146073
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
146074
146074
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
@@ -146130,7 +146130,7 @@ function createSupportsColor2(stream, options = {}) {
|
|
|
146130
146130
|
}
|
|
146131
146131
|
var env3, flagForceColor2, supportsColor2, supports_color_default2;
|
|
146132
146132
|
var init_supports_color = __esm(() => {
|
|
146133
|
-
({ env: env3 } =
|
|
146133
|
+
({ env: env3 } = process24);
|
|
146134
146134
|
if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
|
|
146135
146135
|
flagForceColor2 = 0;
|
|
146136
146136
|
} else if (hasFlag2("color") || hasFlag2("colors") || hasFlag2("color=true") || hasFlag2("color=always")) {
|
|
@@ -230721,7 +230721,10 @@ var SiteConfigSchema = object({
|
|
|
230721
230721
|
buildCommand: string2().default("npm run build"),
|
|
230722
230722
|
serveCommand: string2().optional(),
|
|
230723
230723
|
outputDirectory: string2().optional(),
|
|
230724
|
-
installCommand: string2().default("npm install")
|
|
230724
|
+
installCommand: string2().default("npm install"),
|
|
230725
|
+
devHostFlag: string2().default("--host"),
|
|
230726
|
+
devHost: string2().default("0.0.0.0"),
|
|
230727
|
+
devPort: number2().int().min(1).max(65535).default(5173)
|
|
230725
230728
|
});
|
|
230726
230729
|
var PluginMetadataSchema = object({
|
|
230727
230730
|
namespace: string2().min(1, "Plugin namespace cannot be empty").regex(/^[a-zA-Z0-9_-]+$/, "Plugin namespace can only contain letters, numbers, underscores, and dashes")
|
|
@@ -239251,7 +239254,7 @@ import { join as join13 } from "node:path";
|
|
|
239251
239254
|
// package.json
|
|
239252
239255
|
var package_default = {
|
|
239253
239256
|
name: "base44",
|
|
239254
|
-
version: "0.1.
|
|
239257
|
+
version: "0.1.17",
|
|
239255
239258
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
239256
239259
|
type: "module",
|
|
239257
239260
|
bin: {
|
|
@@ -246706,6 +246709,41 @@ async function gitHead(projectRoot) {
|
|
|
246706
246709
|
return null;
|
|
246707
246710
|
}
|
|
246708
246711
|
}
|
|
246712
|
+
// src/core/site/serve-command.ts
|
|
246713
|
+
var DEFAULT_SERVE_COMMAND = "npm run dev";
|
|
246714
|
+
var SCRIPT = "[A-Za-z0-9:_.-]+";
|
|
246715
|
+
var PREFIX2 = "[A-Za-z0-9._/-]+";
|
|
246716
|
+
var SCRIPT_RUNNERS = [
|
|
246717
|
+
{
|
|
246718
|
+
pattern: new RegExp(String.raw`^npm(\s+--prefix\s+${PREFIX2})?\s+run\s+${SCRIPT}$`),
|
|
246719
|
+
separator: " -- "
|
|
246720
|
+
},
|
|
246721
|
+
{
|
|
246722
|
+
pattern: new RegExp(String.raw`^(?:pnpm|yarn|bun)(\s+run)?\s+${SCRIPT}$`),
|
|
246723
|
+
separator: " "
|
|
246724
|
+
}
|
|
246725
|
+
];
|
|
246726
|
+
function runnerFor(serveCommand) {
|
|
246727
|
+
return SCRIPT_RUNNERS.find((runner) => runner.pattern.test(serveCommand));
|
|
246728
|
+
}
|
|
246729
|
+
function withServeAddress(serveCommand, { host, port, hostFlag }) {
|
|
246730
|
+
const command = serveCommand.trim();
|
|
246731
|
+
const args = [
|
|
246732
|
+
...host ? [hostFlag, host] : [],
|
|
246733
|
+
...port === undefined ? [] : ["--port", String(port)]
|
|
246734
|
+
];
|
|
246735
|
+
if (args.length === 0) {
|
|
246736
|
+
return { command, droppedAddress: false };
|
|
246737
|
+
}
|
|
246738
|
+
const runner = runnerFor(command);
|
|
246739
|
+
if (!runner) {
|
|
246740
|
+
return { command, droppedAddress: true };
|
|
246741
|
+
}
|
|
246742
|
+
return {
|
|
246743
|
+
command: `${command}${runner.separator}${args.join(" ")}`,
|
|
246744
|
+
droppedAddress: false
|
|
246745
|
+
};
|
|
246746
|
+
}
|
|
246709
246747
|
// src/core/project/deploy.ts
|
|
246710
246748
|
function hasResourcesToDeploy(projectData) {
|
|
246711
246749
|
const {
|
|
@@ -249608,7 +249646,7 @@ async function buildAction(ctx) {
|
|
|
249608
249646
|
};
|
|
249609
249647
|
}
|
|
249610
249648
|
function getBuildCommand() {
|
|
249611
|
-
return new Base44Command("build").description("Build the site with the Base44 app id injected").action(buildAction);
|
|
249649
|
+
return new Base44Command("build", { requireAuth: false }).description("Build the site with the Base44 app id injected").action(buildAction);
|
|
249612
249650
|
}
|
|
249613
249651
|
|
|
249614
249652
|
// src/cli/commands/project/create.ts
|
|
@@ -250005,6 +250043,36 @@ function printStripeResult(r, log) {
|
|
|
250005
250043
|
log.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
|
|
250006
250044
|
}
|
|
250007
250045
|
|
|
250046
|
+
// src/cli/commands/project/install.ts
|
|
250047
|
+
async function installAction({
|
|
250048
|
+
runTask
|
|
250049
|
+
}) {
|
|
250050
|
+
const { project } = await readProjectConfig();
|
|
250051
|
+
const installCommand = project.site?.installCommand;
|
|
250052
|
+
if (!installCommand) {
|
|
250053
|
+
throw new ConfigNotFoundError("No site install command found.", {
|
|
250054
|
+
hints: [
|
|
250055
|
+
{
|
|
250056
|
+
message: `Add a 'site' block to your config.jsonc (e.g., "site": { "installCommand": "npm ci" }). Inside one, installCommand defaults to "npm install".`
|
|
250057
|
+
}
|
|
250058
|
+
]
|
|
250059
|
+
});
|
|
250060
|
+
}
|
|
250061
|
+
await runTask("Installing site dependencies...", () => execa({ cwd: project.root, shell: true })`${installCommand}`, {
|
|
250062
|
+
successMessage: "Dependencies installed",
|
|
250063
|
+
errorMessage: "Install failed"
|
|
250064
|
+
});
|
|
250065
|
+
return {
|
|
250066
|
+
outroMessage: `Installed with ${theme.styles.bold(installCommand)}`
|
|
250067
|
+
};
|
|
250068
|
+
}
|
|
250069
|
+
function getInstallCommand() {
|
|
250070
|
+
return new Base44Command("install", {
|
|
250071
|
+
requireAuth: false,
|
|
250072
|
+
requireAppContext: false
|
|
250073
|
+
}).description("Install the site's dependencies with its configured command").action(installAction);
|
|
250074
|
+
}
|
|
250075
|
+
|
|
250008
250076
|
// src/cli/commands/project/app-id-options.ts
|
|
250009
250077
|
function readExplicitAppId(command) {
|
|
250010
250078
|
const { appId } = command.optsWithGlobals();
|
|
@@ -251084,6 +251152,219 @@ function parseConcurrency(value) {
|
|
|
251084
251152
|
return parsed;
|
|
251085
251153
|
}
|
|
251086
251154
|
|
|
251155
|
+
// src/cli/dev/createDevLogger.ts
|
|
251156
|
+
var colorByType = {
|
|
251157
|
+
error: theme.styles.error,
|
|
251158
|
+
warn: theme.styles.warn,
|
|
251159
|
+
log: (input) => input
|
|
251160
|
+
};
|
|
251161
|
+
var stringify = (item) => {
|
|
251162
|
+
if (typeof item === "string") {
|
|
251163
|
+
return item;
|
|
251164
|
+
}
|
|
251165
|
+
if (item instanceof Error) {
|
|
251166
|
+
return item.toString();
|
|
251167
|
+
}
|
|
251168
|
+
try {
|
|
251169
|
+
return JSON.stringify(item, null, 2) ?? String(item);
|
|
251170
|
+
} catch {
|
|
251171
|
+
return String(item);
|
|
251172
|
+
}
|
|
251173
|
+
};
|
|
251174
|
+
function createDevLogger(label, labelColor = theme.styles.dim) {
|
|
251175
|
+
const prefix = label ? `${labelColor(`[${label}]`)} ` : "";
|
|
251176
|
+
const print = (type, ...args) => {
|
|
251177
|
+
const colorize = colorByType[type];
|
|
251178
|
+
console[type](prefix + args.map((item) => colorize(stringify(item))).join(" "));
|
|
251179
|
+
};
|
|
251180
|
+
return {
|
|
251181
|
+
log: (...args) => print("log", ...args),
|
|
251182
|
+
error: (msg, err) => {
|
|
251183
|
+
print("error", msg);
|
|
251184
|
+
if (err) {
|
|
251185
|
+
print("error", err);
|
|
251186
|
+
}
|
|
251187
|
+
},
|
|
251188
|
+
warn: (...args) => print("warn", ...args)
|
|
251189
|
+
};
|
|
251190
|
+
}
|
|
251191
|
+
|
|
251192
|
+
// src/cli/dev/dev-server/serve-runner.ts
|
|
251193
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
251194
|
+
import process21 from "node:process";
|
|
251195
|
+
|
|
251196
|
+
class ServeRunner {
|
|
251197
|
+
command;
|
|
251198
|
+
cwd;
|
|
251199
|
+
env;
|
|
251200
|
+
logger;
|
|
251201
|
+
child;
|
|
251202
|
+
stopping = false;
|
|
251203
|
+
stopPromise;
|
|
251204
|
+
exitListeners = [];
|
|
251205
|
+
constructor(options) {
|
|
251206
|
+
this.command = options.command;
|
|
251207
|
+
this.cwd = options.cwd;
|
|
251208
|
+
this.env = options.env;
|
|
251209
|
+
this.logger = options.logger;
|
|
251210
|
+
}
|
|
251211
|
+
start() {
|
|
251212
|
+
if (this.child) {
|
|
251213
|
+
return;
|
|
251214
|
+
}
|
|
251215
|
+
const stdin = process21.platform === "win32" ? "ignore" : "inherit";
|
|
251216
|
+
const child = spawn2(this.command, {
|
|
251217
|
+
cwd: this.cwd,
|
|
251218
|
+
shell: true,
|
|
251219
|
+
detached: process21.platform !== "win32",
|
|
251220
|
+
env: { ...process21.env, ...this.env },
|
|
251221
|
+
stdio: [stdin, "pipe", "pipe"],
|
|
251222
|
+
windowsHide: true
|
|
251223
|
+
});
|
|
251224
|
+
this.child = child;
|
|
251225
|
+
this.setupHandlers(child);
|
|
251226
|
+
}
|
|
251227
|
+
onExit(listener) {
|
|
251228
|
+
this.exitListeners.push(listener);
|
|
251229
|
+
}
|
|
251230
|
+
async stop() {
|
|
251231
|
+
if (this.stopPromise) {
|
|
251232
|
+
return this.stopPromise;
|
|
251233
|
+
}
|
|
251234
|
+
this.stopPromise = this.stopChild();
|
|
251235
|
+
return this.stopPromise;
|
|
251236
|
+
}
|
|
251237
|
+
async stopChild() {
|
|
251238
|
+
const child = this.child;
|
|
251239
|
+
if (!child || child.exitCode !== null) {
|
|
251240
|
+
return;
|
|
251241
|
+
}
|
|
251242
|
+
this.stopping = true;
|
|
251243
|
+
const exited = new Promise((resolve) => child.once("exit", () => resolve()));
|
|
251244
|
+
if (process21.platform === "win32" && child.pid) {
|
|
251245
|
+
const taskkill = spawn2("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
251246
|
+
stdio: "ignore",
|
|
251247
|
+
windowsHide: true
|
|
251248
|
+
});
|
|
251249
|
+
await new Promise((resolve) => {
|
|
251250
|
+
taskkill.once("exit", () => resolve());
|
|
251251
|
+
taskkill.once("error", () => resolve());
|
|
251252
|
+
});
|
|
251253
|
+
} else if (child.pid) {
|
|
251254
|
+
try {
|
|
251255
|
+
process21.kill(-child.pid, "SIGTERM");
|
|
251256
|
+
} catch {
|
|
251257
|
+
child.kill();
|
|
251258
|
+
}
|
|
251259
|
+
}
|
|
251260
|
+
await exited;
|
|
251261
|
+
}
|
|
251262
|
+
setupHandlers(child) {
|
|
251263
|
+
child.stdout?.on("data", (data) => this.emitLines(data, "log"));
|
|
251264
|
+
child.stderr?.on("data", (data) => this.emitLines(data, "error"));
|
|
251265
|
+
child.on("error", (error) => {
|
|
251266
|
+
this.logger.error("Frontend dev server failed to start:", error);
|
|
251267
|
+
this.notifyExit(null);
|
|
251268
|
+
});
|
|
251269
|
+
child.on("exit", (code) => {
|
|
251270
|
+
if (this.stopping) {
|
|
251271
|
+
return;
|
|
251272
|
+
}
|
|
251273
|
+
this.logger.error(`Frontend dev server exited with code ${code}`);
|
|
251274
|
+
this.notifyExit(code);
|
|
251275
|
+
});
|
|
251276
|
+
}
|
|
251277
|
+
notifyExit(code) {
|
|
251278
|
+
for (const listener of this.exitListeners) {
|
|
251279
|
+
listener(code);
|
|
251280
|
+
}
|
|
251281
|
+
}
|
|
251282
|
+
emitLines(data, type) {
|
|
251283
|
+
const lines = data.toString().trimEnd().split(`
|
|
251284
|
+
`);
|
|
251285
|
+
for (const line of lines) {
|
|
251286
|
+
if (type === "error") {
|
|
251287
|
+
this.logger.error(line);
|
|
251288
|
+
} else {
|
|
251289
|
+
this.logger.log(line);
|
|
251290
|
+
}
|
|
251291
|
+
}
|
|
251292
|
+
}
|
|
251293
|
+
}
|
|
251294
|
+
|
|
251295
|
+
// src/cli/dev/serve-command-runner.ts
|
|
251296
|
+
function createServeCommandRunner({
|
|
251297
|
+
serveCommand,
|
|
251298
|
+
projectRoot,
|
|
251299
|
+
appId,
|
|
251300
|
+
appBaseUrl
|
|
251301
|
+
}) {
|
|
251302
|
+
return new ServeRunner({
|
|
251303
|
+
command: serveCommand,
|
|
251304
|
+
cwd: projectRoot,
|
|
251305
|
+
env: {
|
|
251306
|
+
VITE_BASE44_APP_ID: appId,
|
|
251307
|
+
...appBaseUrl ? { VITE_BASE44_APP_BASE_URL: appBaseUrl } : {}
|
|
251308
|
+
},
|
|
251309
|
+
logger: createDevLogger("frontend", theme.colors.base44Orange)
|
|
251310
|
+
});
|
|
251311
|
+
}
|
|
251312
|
+
|
|
251313
|
+
// src/cli/dev/stop-runner-on-signals.ts
|
|
251314
|
+
import process22 from "node:process";
|
|
251315
|
+
function stopRunnerOnProcessSignals(runner) {
|
|
251316
|
+
const stop = () => void runner.stop();
|
|
251317
|
+
process22.on("SIGINT", stop);
|
|
251318
|
+
process22.on("SIGTERM", stop);
|
|
251319
|
+
}
|
|
251320
|
+
|
|
251321
|
+
// src/cli/commands/site/dev.ts
|
|
251322
|
+
function parsePort(value) {
|
|
251323
|
+
if (!/^\d+$/.test(value)) {
|
|
251324
|
+
throw new InvalidArgumentError2("must be a whole number");
|
|
251325
|
+
}
|
|
251326
|
+
const port = Number(value);
|
|
251327
|
+
if (port < 1 || port > 65535) {
|
|
251328
|
+
throw new InvalidArgumentError2("must be between 1 and 65535");
|
|
251329
|
+
}
|
|
251330
|
+
return port;
|
|
251331
|
+
}
|
|
251332
|
+
async function siteDevAction(ctx, options) {
|
|
251333
|
+
const { app } = ctx;
|
|
251334
|
+
if (!app?.projectRoot) {
|
|
251335
|
+
throw new ConfigInvalidError("base44 site dev requires a linked local project. Run it from a project with base44/.app.jsonc.");
|
|
251336
|
+
}
|
|
251337
|
+
const { project } = await readProjectConfig(app.projectRoot);
|
|
251338
|
+
const site = project.site;
|
|
251339
|
+
if (!site) {
|
|
251340
|
+
throw new InvalidInputError(`This project has no 'site' block in base44/config.jsonc, so there is no frontend to serve. Add one naming its serveCommand; site dev falls back to "npm run dev".`);
|
|
251341
|
+
}
|
|
251342
|
+
const serveCommand = site.serveCommand ?? DEFAULT_SERVE_COMMAND;
|
|
251343
|
+
const { command, droppedAddress } = withServeAddress(serveCommand, {
|
|
251344
|
+
host: options.host ?? site.devHost,
|
|
251345
|
+
port: options.port ?? site.devPort,
|
|
251346
|
+
hostFlag: site.devHostFlag
|
|
251347
|
+
});
|
|
251348
|
+
if (droppedAddress) {
|
|
251349
|
+
throw new InvalidInputError(`serveCommand '${serveCommand}' takes no forwarded arguments, so the bind address cannot be passed to it. Bind it inside serveCommand itself, or use an 'npm run', 'pnpm', 'yarn' or 'bun run' script.`);
|
|
251350
|
+
}
|
|
251351
|
+
const runner = createServeCommandRunner({
|
|
251352
|
+
serveCommand: command,
|
|
251353
|
+
projectRoot: project.root,
|
|
251354
|
+
appId: app.id,
|
|
251355
|
+
appBaseUrl: options.backendUrl
|
|
251356
|
+
});
|
|
251357
|
+
stopRunnerOnProcessSignals(runner);
|
|
251358
|
+
runner.onExit((code) => process.exit(code ?? 1));
|
|
251359
|
+
runner.start();
|
|
251360
|
+
return {
|
|
251361
|
+
outroMessage: options.backendUrl ? `Frontend dev server running '${command}' against ${theme.styles.bold(options.backendUrl)}` : `Frontend dev server running '${command}'`
|
|
251362
|
+
};
|
|
251363
|
+
}
|
|
251364
|
+
function getSiteDevCommand() {
|
|
251365
|
+
return new Base44Command("dev", { requireAuth: false }).description("Run the site's dev server against a given backend (no local backend)").option("--backend-url <url>", "Backend the frontend should call, injected as VITE_BASE44_APP_BASE_URL. Omit for a frontend that reaches its backend same-origin.").option("--host <address>", "Address to bind, overriding site.devHost").option("--port <number>", "Port to bind, overriding site.devPort", parsePort).action(siteDevAction);
|
|
251366
|
+
}
|
|
251367
|
+
|
|
251087
251368
|
// src/cli/commands/site/open.ts
|
|
251088
251369
|
async function openAction({
|
|
251089
251370
|
isNonInteractive
|
|
@@ -251100,7 +251381,7 @@ function getSiteOpenCommand() {
|
|
|
251100
251381
|
|
|
251101
251382
|
// src/cli/commands/site/index.ts
|
|
251102
251383
|
function getSiteCommand() {
|
|
251103
|
-
return new Command2("site").description("Manage app site (frontend app)").addCommand(getSiteDeployCommand()).addCommand(getSiteOpenCommand());
|
|
251384
|
+
return new Command2("site").description("Manage app site (frontend app)").addCommand(getSiteDeployCommand()).addCommand(getSiteDevCommand()).addCommand(getSiteOpenCommand());
|
|
251104
251385
|
}
|
|
251105
251386
|
|
|
251106
251387
|
// src/core/types/generator.ts
|
|
@@ -251620,43 +251901,6 @@ function getWorkspaceCommand() {
|
|
|
251620
251901
|
return new Command2("workspace").description("List workspaces, inspect one, and move apps between them").addCommand(getWorkspaceListCommand()).addCommand(getWorkspaceGetCommand()).addCommand(getWorkspaceMoveCommand());
|
|
251621
251902
|
}
|
|
251622
251903
|
|
|
251623
|
-
// src/cli/dev/createDevLogger.ts
|
|
251624
|
-
var colorByType = {
|
|
251625
|
-
error: theme.styles.error,
|
|
251626
|
-
warn: theme.styles.warn,
|
|
251627
|
-
log: (input) => input
|
|
251628
|
-
};
|
|
251629
|
-
var stringify = (item) => {
|
|
251630
|
-
if (typeof item === "string") {
|
|
251631
|
-
return item;
|
|
251632
|
-
}
|
|
251633
|
-
if (item instanceof Error) {
|
|
251634
|
-
return item.toString();
|
|
251635
|
-
}
|
|
251636
|
-
try {
|
|
251637
|
-
return JSON.stringify(item, null, 2) ?? String(item);
|
|
251638
|
-
} catch {
|
|
251639
|
-
return String(item);
|
|
251640
|
-
}
|
|
251641
|
-
};
|
|
251642
|
-
function createDevLogger(label, labelColor = theme.styles.dim) {
|
|
251643
|
-
const prefix = label ? `${labelColor(`[${label}]`)} ` : "";
|
|
251644
|
-
const print = (type, ...args) => {
|
|
251645
|
-
const colorize = colorByType[type];
|
|
251646
|
-
console[type](prefix + args.map((item) => colorize(stringify(item))).join(" "));
|
|
251647
|
-
};
|
|
251648
|
-
return {
|
|
251649
|
-
log: (...args) => print("log", ...args),
|
|
251650
|
-
error: (msg, err) => {
|
|
251651
|
-
print("error", msg);
|
|
251652
|
-
if (err) {
|
|
251653
|
-
print("error", err);
|
|
251654
|
-
}
|
|
251655
|
-
},
|
|
251656
|
-
warn: (...args) => print("warn", ...args)
|
|
251657
|
-
};
|
|
251658
|
-
}
|
|
251659
|
-
|
|
251660
251904
|
// src/cli/dev/dev-server/main.ts
|
|
251661
251905
|
var import_cors = __toESM(require_lib4(), 1);
|
|
251662
251906
|
var import_express6 = __toESM(require_express(), 1);
|
|
@@ -251789,7 +252033,7 @@ var $dir = async (options) => dirWithOptions(options);
|
|
|
251789
252033
|
var $tmpName = promisify11(tmp.tmpName);
|
|
251790
252034
|
|
|
251791
252035
|
// src/cli/dev/dev-server/function-manager.ts
|
|
251792
|
-
import { spawn as
|
|
252036
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
251793
252037
|
import { dirname as dirname23, join as join31 } from "node:path";
|
|
251794
252038
|
import { pathToFileURL } from "node:url";
|
|
251795
252039
|
|
|
@@ -251887,7 +252131,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
251887
252131
|
async stopFunction(_name, { process: proc }) {
|
|
251888
252132
|
const exited = new Promise((r) => proc.once("exit", () => r()));
|
|
251889
252133
|
if (process.platform === "win32" && proc.pid) {
|
|
251890
|
-
|
|
252134
|
+
spawn3("taskkill", ["/pid", String(proc.pid), "/T", "/F"]);
|
|
251891
252135
|
} else {
|
|
251892
252136
|
proc.kill();
|
|
251893
252137
|
}
|
|
@@ -251896,7 +252140,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
251896
252140
|
spawnFunction(func, port) {
|
|
251897
252141
|
this.logger.log(`Spawning function "${func.name}" on port ${port}`);
|
|
251898
252142
|
const importMapPath = join31(dirname23(this.wrapperPath), "import-map.json");
|
|
251899
|
-
const process2 =
|
|
252143
|
+
const process2 = spawn3("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
|
|
251900
252144
|
env: {
|
|
251901
252145
|
...globalThis.process.env,
|
|
251902
252146
|
FUNCTION_PATH: pathToFileURL(func.entryPath).href,
|
|
@@ -255426,127 +255670,6 @@ async function createDevServer(options) {
|
|
|
255426
255670
|
return { port, server, shutdown };
|
|
255427
255671
|
}
|
|
255428
255672
|
|
|
255429
|
-
// src/cli/dev/dev-server/serve-runner.ts
|
|
255430
|
-
import { spawn as spawn3 } from "node:child_process";
|
|
255431
|
-
import process23 from "node:process";
|
|
255432
|
-
|
|
255433
|
-
class ServeRunner {
|
|
255434
|
-
command;
|
|
255435
|
-
cwd;
|
|
255436
|
-
env;
|
|
255437
|
-
logger;
|
|
255438
|
-
child;
|
|
255439
|
-
stopping = false;
|
|
255440
|
-
stopPromise;
|
|
255441
|
-
exitListeners = [];
|
|
255442
|
-
constructor(options) {
|
|
255443
|
-
this.command = options.command;
|
|
255444
|
-
this.cwd = options.cwd;
|
|
255445
|
-
this.env = options.env;
|
|
255446
|
-
this.logger = options.logger;
|
|
255447
|
-
}
|
|
255448
|
-
start() {
|
|
255449
|
-
if (this.child) {
|
|
255450
|
-
return;
|
|
255451
|
-
}
|
|
255452
|
-
const stdin = process23.platform === "win32" ? "ignore" : "inherit";
|
|
255453
|
-
const child = spawn3(this.command, {
|
|
255454
|
-
cwd: this.cwd,
|
|
255455
|
-
shell: true,
|
|
255456
|
-
detached: process23.platform !== "win32",
|
|
255457
|
-
env: { ...process23.env, ...this.env },
|
|
255458
|
-
stdio: [stdin, "pipe", "pipe"],
|
|
255459
|
-
windowsHide: true
|
|
255460
|
-
});
|
|
255461
|
-
this.child = child;
|
|
255462
|
-
this.setupHandlers(child);
|
|
255463
|
-
}
|
|
255464
|
-
onExit(listener) {
|
|
255465
|
-
this.exitListeners.push(listener);
|
|
255466
|
-
}
|
|
255467
|
-
async stop() {
|
|
255468
|
-
if (this.stopPromise) {
|
|
255469
|
-
return this.stopPromise;
|
|
255470
|
-
}
|
|
255471
|
-
this.stopPromise = this.stopChild();
|
|
255472
|
-
return this.stopPromise;
|
|
255473
|
-
}
|
|
255474
|
-
async stopChild() {
|
|
255475
|
-
const child = this.child;
|
|
255476
|
-
if (!child || child.exitCode !== null) {
|
|
255477
|
-
return;
|
|
255478
|
-
}
|
|
255479
|
-
this.stopping = true;
|
|
255480
|
-
const exited = new Promise((resolve) => child.once("exit", () => resolve()));
|
|
255481
|
-
if (process23.platform === "win32" && child.pid) {
|
|
255482
|
-
const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
255483
|
-
stdio: "ignore",
|
|
255484
|
-
windowsHide: true
|
|
255485
|
-
});
|
|
255486
|
-
await new Promise((resolve) => {
|
|
255487
|
-
taskkill.once("exit", () => resolve());
|
|
255488
|
-
taskkill.once("error", () => resolve());
|
|
255489
|
-
});
|
|
255490
|
-
} else if (child.pid) {
|
|
255491
|
-
try {
|
|
255492
|
-
process23.kill(-child.pid, "SIGTERM");
|
|
255493
|
-
} catch {
|
|
255494
|
-
child.kill();
|
|
255495
|
-
}
|
|
255496
|
-
}
|
|
255497
|
-
await exited;
|
|
255498
|
-
}
|
|
255499
|
-
setupHandlers(child) {
|
|
255500
|
-
child.stdout?.on("data", (data) => this.emitLines(data, "log"));
|
|
255501
|
-
child.stderr?.on("data", (data) => this.emitLines(data, "error"));
|
|
255502
|
-
child.on("error", (error) => {
|
|
255503
|
-
this.logger.error("Frontend dev server failed to start:", error);
|
|
255504
|
-
this.notifyExit(null);
|
|
255505
|
-
});
|
|
255506
|
-
child.on("exit", (code) => {
|
|
255507
|
-
if (this.stopping) {
|
|
255508
|
-
return;
|
|
255509
|
-
}
|
|
255510
|
-
this.logger.error(`Frontend dev server exited with code ${code}`);
|
|
255511
|
-
this.notifyExit(code);
|
|
255512
|
-
});
|
|
255513
|
-
}
|
|
255514
|
-
notifyExit(code) {
|
|
255515
|
-
for (const listener of this.exitListeners) {
|
|
255516
|
-
listener(code);
|
|
255517
|
-
}
|
|
255518
|
-
}
|
|
255519
|
-
emitLines(data, type) {
|
|
255520
|
-
const lines = data.toString().trimEnd().split(`
|
|
255521
|
-
`);
|
|
255522
|
-
for (const line of lines) {
|
|
255523
|
-
if (type === "error") {
|
|
255524
|
-
this.logger.error(line);
|
|
255525
|
-
} else {
|
|
255526
|
-
this.logger.log(line);
|
|
255527
|
-
}
|
|
255528
|
-
}
|
|
255529
|
-
}
|
|
255530
|
-
}
|
|
255531
|
-
|
|
255532
|
-
// src/cli/dev/serve-command-runner.ts
|
|
255533
|
-
function createServeCommandRunner({
|
|
255534
|
-
serveCommand,
|
|
255535
|
-
projectRoot,
|
|
255536
|
-
appId,
|
|
255537
|
-
appBaseUrl
|
|
255538
|
-
}) {
|
|
255539
|
-
return new ServeRunner({
|
|
255540
|
-
command: serveCommand,
|
|
255541
|
-
cwd: projectRoot,
|
|
255542
|
-
env: {
|
|
255543
|
-
VITE_BASE44_APP_ID: appId,
|
|
255544
|
-
VITE_BASE44_APP_BASE_URL: appBaseUrl
|
|
255545
|
-
},
|
|
255546
|
-
logger: createDevLogger("frontend", theme.colors.base44Orange)
|
|
255547
|
-
});
|
|
255548
|
-
}
|
|
255549
|
-
|
|
255550
255673
|
// src/cli/commands/dev.ts
|
|
255551
255674
|
function localServerUrl(port) {
|
|
255552
255675
|
return `http://localhost:${port}`;
|
|
@@ -255572,11 +255695,6 @@ async function resolveConfiguredSite(app) {
|
|
|
255572
255695
|
const serveCommand = project.site?.serveCommand;
|
|
255573
255696
|
return serveCommand ? { serveCommand, projectRoot: project.root } : undefined;
|
|
255574
255697
|
}
|
|
255575
|
-
function stopRunnerOnProcessSignals(runner) {
|
|
255576
|
-
const stop = () => void runner.stop();
|
|
255577
|
-
process.on("SIGINT", stop);
|
|
255578
|
-
process.on("SIGTERM", stop);
|
|
255579
|
-
}
|
|
255580
255698
|
function startServeCommand(runner, backend) {
|
|
255581
255699
|
stopRunnerOnProcessSignals(runner);
|
|
255582
255700
|
runner.onExit(() => {
|
|
@@ -255690,7 +255808,7 @@ function readStdin2() {
|
|
|
255690
255808
|
process.stdin.on("error", reject);
|
|
255691
255809
|
});
|
|
255692
255810
|
}
|
|
255693
|
-
function
|
|
255811
|
+
function parsePort2(value) {
|
|
255694
255812
|
const port = Number(value);
|
|
255695
255813
|
if (!Number.isInteger(port) || port <= 0 || port > 65535) {
|
|
255696
255814
|
throw new InvalidInputError(`Invalid --port value: "${value}".`, {
|
|
@@ -255727,7 +255845,7 @@ async function execAction({ app, isNonInteractive }, options) {
|
|
|
255727
255845
|
if (!code.trim()) {
|
|
255728
255846
|
throw noInputError;
|
|
255729
255847
|
}
|
|
255730
|
-
const local = options.local ? await resolveLocalTarget(options.port !== undefined ?
|
|
255848
|
+
const local = options.local ? await resolveLocalTarget(options.port !== undefined ? parsePort2(options.port) : DEFAULT_DEV_SERVER_PORT) : undefined;
|
|
255731
255849
|
const { exitCode } = await runScript({
|
|
255732
255850
|
appId: app.id,
|
|
255733
255851
|
code,
|
|
@@ -255892,6 +256010,7 @@ function createProgram(context) {
|
|
|
255892
256010
|
program.addCommand(getCreateCommand());
|
|
255893
256011
|
program.addCommand(getScaffoldCommand());
|
|
255894
256012
|
program.addCommand(getDashboardCommand());
|
|
256013
|
+
program.addCommand(getInstallCommand());
|
|
255895
256014
|
program.addCommand(getBuildCommand());
|
|
255896
256015
|
program.addCommand(getDeployCommand3());
|
|
255897
256016
|
program.addCommand(getVisibilityCommand());
|
|
@@ -259961,4 +260080,4 @@ export {
|
|
|
259961
260080
|
runCLI
|
|
259962
260081
|
};
|
|
259963
260082
|
|
|
259964
|
-
//# debugId=
|
|
260083
|
+
//# debugId=E803849EB8B019CA64756E2164756E21
|