@base44-preview/cli 0.1.6-pr.580.1bd5eee → 0.1.6-pr.580.64295ac
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 +217 -219
- package/dist/cli/index.js.map +8 -9
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -163190,7 +163190,7 @@ var require_stringify5 = __commonJS((exports, module) => {
|
|
|
163190
163190
|
return typeof v10 === "string" || typeof v10 === "number" || typeof v10 === "boolean" || typeof v10 === "symbol" || typeof v10 === "bigint";
|
|
163191
163191
|
};
|
|
163192
163192
|
var sentinel = {};
|
|
163193
|
-
var
|
|
163193
|
+
var stringify2 = function stringify3(object2, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter2, sort, allowDots, serializeDate, format3, formatter, encodeValuesOnly, charset, sideChannel) {
|
|
163194
163194
|
var obj = object2;
|
|
163195
163195
|
var tmpSc = sideChannel;
|
|
163196
163196
|
var step = 0;
|
|
@@ -163266,7 +163266,7 @@ var require_stringify5 = __commonJS((exports, module) => {
|
|
|
163266
163266
|
sideChannel.set(object2, step);
|
|
163267
163267
|
var valueSideChannel = getSideChannel();
|
|
163268
163268
|
valueSideChannel.set(sentinel, sideChannel);
|
|
163269
|
-
pushToArray(values,
|
|
163269
|
+
pushToArray(values, stringify3(value, keyPrefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder, filter2, sort, allowDots, serializeDate, format3, formatter, encodeValuesOnly, charset, valueSideChannel));
|
|
163270
163270
|
}
|
|
163271
163271
|
return values;
|
|
163272
163272
|
};
|
|
@@ -163364,7 +163364,7 @@ var require_stringify5 = __commonJS((exports, module) => {
|
|
|
163364
163364
|
if (options8.skipNulls && value === null) {
|
|
163365
163365
|
continue;
|
|
163366
163366
|
}
|
|
163367
|
-
pushToArray(keys,
|
|
163367
|
+
pushToArray(keys, stringify2(value, key2, generateArrayPrefix, commaRoundTrip, options8.allowEmptyArrays, options8.strictNullHandling, options8.skipNulls, options8.encodeDotInKeys, options8.encode ? options8.encoder : null, options8.filter, options8.sort, options8.allowDots, options8.serializeDate, options8.format, options8.formatter, options8.encodeValuesOnly, options8.charset, sideChannel));
|
|
163368
163368
|
}
|
|
163369
163369
|
var joined = keys.join(options8.delimiter);
|
|
163370
163370
|
var prefix = options8.addQueryPrefix === true ? "?" : "";
|
|
@@ -163654,13 +163654,13 @@ var require_parse8 = __commonJS((exports, module) => {
|
|
|
163654
163654
|
|
|
163655
163655
|
// ../../node_modules/qs/lib/index.js
|
|
163656
163656
|
var require_lib6 = __commonJS((exports, module) => {
|
|
163657
|
-
var
|
|
163657
|
+
var stringify2 = require_stringify5();
|
|
163658
163658
|
var parse11 = require_parse8();
|
|
163659
163659
|
var formats = require_formats();
|
|
163660
163660
|
module.exports = {
|
|
163661
163661
|
formats,
|
|
163662
163662
|
parse: parse11,
|
|
163663
|
-
stringify
|
|
163663
|
+
stringify: stringify2
|
|
163664
163664
|
};
|
|
163665
163665
|
});
|
|
163666
163666
|
|
|
@@ -165293,7 +165293,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
165293
165293
|
exports.compile = compile2;
|
|
165294
165294
|
exports.match = match;
|
|
165295
165295
|
exports.pathToRegexp = pathToRegexp;
|
|
165296
|
-
exports.stringify =
|
|
165296
|
+
exports.stringify = stringify2;
|
|
165297
165297
|
var DEFAULT_DELIMITER = "/";
|
|
165298
165298
|
var NOOP_VALUE = (value) => value;
|
|
165299
165299
|
var ID_START = /^[$_\p{ID_Start}]$/u;
|
|
@@ -165623,7 +165623,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
165623
165623
|
}
|
|
165624
165624
|
return value;
|
|
165625
165625
|
}
|
|
165626
|
-
function
|
|
165626
|
+
function stringify2(data) {
|
|
165627
165627
|
return stringifyTokens(data.tokens);
|
|
165628
165628
|
}
|
|
165629
165629
|
function isNameSafe(name2) {
|
|
@@ -168490,7 +168490,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168490
168490
|
var escape3 = app.get("json escape");
|
|
168491
168491
|
var replacer = app.get("json replacer");
|
|
168492
168492
|
var spaces = app.get("json spaces");
|
|
168493
|
-
var body =
|
|
168493
|
+
var body = stringify2(obj, replacer, spaces, escape3);
|
|
168494
168494
|
if (!this.get("Content-Type")) {
|
|
168495
168495
|
this.set("Content-Type", "application/json");
|
|
168496
168496
|
}
|
|
@@ -168501,7 +168501,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168501
168501
|
var escape3 = app.get("json escape");
|
|
168502
168502
|
var replacer = app.get("json replacer");
|
|
168503
168503
|
var spaces = app.get("json spaces");
|
|
168504
|
-
var body =
|
|
168504
|
+
var body = stringify2(obj, replacer, spaces, escape3);
|
|
168505
168505
|
var callback = this.req.query[app.get("jsonp callback name")];
|
|
168506
168506
|
if (!this.get("Content-Type")) {
|
|
168507
168507
|
this.set("X-Content-Type-Options", "nosniff");
|
|
@@ -168820,7 +168820,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168820
168820
|
}
|
|
168821
168821
|
file2.pipe(res2);
|
|
168822
168822
|
}
|
|
168823
|
-
function
|
|
168823
|
+
function stringify2(value, replacer, spaces, escape3) {
|
|
168824
168824
|
var json3 = replacer || spaces ? JSON.stringify(value, replacer, spaces) : JSON.stringify(value);
|
|
168825
168825
|
if (escape3 && typeof json3 === "string") {
|
|
168826
168826
|
json3 = json3.replace(/[<>&]/g, function(c8) {
|
|
@@ -258285,6 +258285,43 @@ function getWorkspaceCommand() {
|
|
|
258285
258285
|
return new Command("workspace").description("List workspaces, inspect one, and move apps between them").addCommand(getWorkspaceListCommand()).addCommand(getWorkspaceGetCommand()).addCommand(getWorkspaceMoveCommand());
|
|
258286
258286
|
}
|
|
258287
258287
|
|
|
258288
|
+
// src/cli/dev/createDevLogger.ts
|
|
258289
|
+
var colorByType = {
|
|
258290
|
+
error: theme.styles.error,
|
|
258291
|
+
warn: theme.styles.warn,
|
|
258292
|
+
log: (input) => input
|
|
258293
|
+
};
|
|
258294
|
+
var stringify = (item) => {
|
|
258295
|
+
if (typeof item === "string") {
|
|
258296
|
+
return item;
|
|
258297
|
+
}
|
|
258298
|
+
if (item instanceof Error) {
|
|
258299
|
+
return item.toString();
|
|
258300
|
+
}
|
|
258301
|
+
try {
|
|
258302
|
+
return JSON.stringify(item, null, 2) ?? String(item);
|
|
258303
|
+
} catch {
|
|
258304
|
+
return String(item);
|
|
258305
|
+
}
|
|
258306
|
+
};
|
|
258307
|
+
function createDevLogger(label2, labelColor = theme.styles.dim) {
|
|
258308
|
+
const prefix = label2 ? `${labelColor(`[${label2}]`)} ` : "";
|
|
258309
|
+
const print = (type, ...args) => {
|
|
258310
|
+
const colorize = colorByType[type];
|
|
258311
|
+
console[type](prefix + args.map((item) => colorize(stringify(item))).join(" "));
|
|
258312
|
+
};
|
|
258313
|
+
return {
|
|
258314
|
+
log: (...args) => print("log", ...args),
|
|
258315
|
+
error: (msg, err) => {
|
|
258316
|
+
print("error", msg);
|
|
258317
|
+
if (err) {
|
|
258318
|
+
print("error", err);
|
|
258319
|
+
}
|
|
258320
|
+
},
|
|
258321
|
+
warn: (...args) => print("warn", ...args)
|
|
258322
|
+
};
|
|
258323
|
+
}
|
|
258324
|
+
|
|
258288
258325
|
// src/cli/dev/dev-server/main.ts
|
|
258289
258326
|
var import_cors = __toESM(require_lib4(), 1);
|
|
258290
258327
|
var import_express6 = __toESM(require_express(), 1);
|
|
@@ -258421,43 +258458,6 @@ var $tmpName = promisify11(tmp.tmpName);
|
|
|
258421
258458
|
var $tmpdir = tmp.tmpdir;
|
|
258422
258459
|
var $setGracefulCleanup = tmp.setGracefulCleanup;
|
|
258423
258460
|
|
|
258424
|
-
// src/cli/dev/createDevLogger.ts
|
|
258425
|
-
var colorByType = {
|
|
258426
|
-
error: theme.styles.error,
|
|
258427
|
-
warn: theme.styles.warn,
|
|
258428
|
-
log: (input) => input
|
|
258429
|
-
};
|
|
258430
|
-
var stringify = (item) => {
|
|
258431
|
-
if (typeof item === "string") {
|
|
258432
|
-
return item;
|
|
258433
|
-
}
|
|
258434
|
-
if (item instanceof Error) {
|
|
258435
|
-
return item.toString();
|
|
258436
|
-
}
|
|
258437
|
-
try {
|
|
258438
|
-
return JSON.stringify(item, null, 2) ?? String(item);
|
|
258439
|
-
} catch {
|
|
258440
|
-
return String(item);
|
|
258441
|
-
}
|
|
258442
|
-
};
|
|
258443
|
-
function createDevLogger(label2, labelColor = theme.styles.dim) {
|
|
258444
|
-
const prefix = label2 ? `${labelColor(`[${label2}]`)} ` : "";
|
|
258445
|
-
const print = (type, ...args) => {
|
|
258446
|
-
const colorize = colorByType[type];
|
|
258447
|
-
console[type](prefix + args.map((item) => colorize(stringify(item))).join(" "));
|
|
258448
|
-
};
|
|
258449
|
-
return {
|
|
258450
|
-
log: (...args) => print("log", ...args),
|
|
258451
|
-
error: (msg, err) => {
|
|
258452
|
-
print("error", msg);
|
|
258453
|
-
if (err) {
|
|
258454
|
-
print("error", err);
|
|
258455
|
-
}
|
|
258456
|
-
},
|
|
258457
|
-
warn: (...args) => print("warn", ...args)
|
|
258458
|
-
};
|
|
258459
|
-
}
|
|
258460
|
-
|
|
258461
258461
|
// src/cli/dev/dev-server/function-manager.ts
|
|
258462
258462
|
import { spawn as spawn2 } from "node:child_process";
|
|
258463
258463
|
import { dirname as dirname20, join as join27 } from "node:path";
|
|
@@ -259073,127 +259073,6 @@ function createFunctionRouter(manager, logger2) {
|
|
|
259073
259073
|
return router;
|
|
259074
259074
|
}
|
|
259075
259075
|
|
|
259076
|
-
// src/cli/dev/dev-server/serve-runner.ts
|
|
259077
|
-
import { spawn as spawn3 } from "node:child_process";
|
|
259078
|
-
import process23 from "node:process";
|
|
259079
|
-
|
|
259080
|
-
class ServeRunner {
|
|
259081
|
-
command;
|
|
259082
|
-
cwd;
|
|
259083
|
-
env;
|
|
259084
|
-
logger;
|
|
259085
|
-
child;
|
|
259086
|
-
stopping = false;
|
|
259087
|
-
stopPromise;
|
|
259088
|
-
exitListeners = [];
|
|
259089
|
-
constructor(options8) {
|
|
259090
|
-
this.command = options8.command;
|
|
259091
|
-
this.cwd = options8.cwd;
|
|
259092
|
-
this.env = options8.env;
|
|
259093
|
-
this.logger = options8.logger;
|
|
259094
|
-
}
|
|
259095
|
-
start() {
|
|
259096
|
-
if (this.child) {
|
|
259097
|
-
return;
|
|
259098
|
-
}
|
|
259099
|
-
const stdin2 = process23.platform === "win32" ? "ignore" : "inherit";
|
|
259100
|
-
const child = spawn3(this.command, {
|
|
259101
|
-
cwd: this.cwd,
|
|
259102
|
-
shell: true,
|
|
259103
|
-
detached: process23.platform !== "win32",
|
|
259104
|
-
env: { ...process23.env, ...this.env },
|
|
259105
|
-
stdio: [stdin2, "pipe", "pipe"],
|
|
259106
|
-
windowsHide: true
|
|
259107
|
-
});
|
|
259108
|
-
this.child = child;
|
|
259109
|
-
this.setupHandlers(child);
|
|
259110
|
-
}
|
|
259111
|
-
onExit(listener) {
|
|
259112
|
-
this.exitListeners.push(listener);
|
|
259113
|
-
}
|
|
259114
|
-
async stop() {
|
|
259115
|
-
if (this.stopPromise) {
|
|
259116
|
-
return this.stopPromise;
|
|
259117
|
-
}
|
|
259118
|
-
this.stopPromise = this.stopChild();
|
|
259119
|
-
return this.stopPromise;
|
|
259120
|
-
}
|
|
259121
|
-
async stopChild() {
|
|
259122
|
-
const child = this.child;
|
|
259123
|
-
if (!child || child.exitCode !== null) {
|
|
259124
|
-
return;
|
|
259125
|
-
}
|
|
259126
|
-
this.stopping = true;
|
|
259127
|
-
const exited = new Promise((resolve13) => child.once("exit", () => resolve13()));
|
|
259128
|
-
if (process23.platform === "win32" && child.pid) {
|
|
259129
|
-
const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
259130
|
-
stdio: "ignore",
|
|
259131
|
-
windowsHide: true
|
|
259132
|
-
});
|
|
259133
|
-
await new Promise((resolve13) => {
|
|
259134
|
-
taskkill.once("exit", () => resolve13());
|
|
259135
|
-
taskkill.once("error", () => resolve13());
|
|
259136
|
-
});
|
|
259137
|
-
} else if (child.pid) {
|
|
259138
|
-
try {
|
|
259139
|
-
process23.kill(-child.pid, "SIGTERM");
|
|
259140
|
-
} catch {
|
|
259141
|
-
child.kill();
|
|
259142
|
-
}
|
|
259143
|
-
}
|
|
259144
|
-
await exited;
|
|
259145
|
-
}
|
|
259146
|
-
setupHandlers(child) {
|
|
259147
|
-
child.stdout?.on("data", (data) => this.emitLines(data, "log"));
|
|
259148
|
-
child.stderr?.on("data", (data) => this.emitLines(data, "error"));
|
|
259149
|
-
child.on("error", (error48) => {
|
|
259150
|
-
this.logger.error("Frontend dev server failed to start:", error48);
|
|
259151
|
-
this.notifyExit(null);
|
|
259152
|
-
});
|
|
259153
|
-
child.on("exit", (code2) => {
|
|
259154
|
-
if (this.stopping) {
|
|
259155
|
-
return;
|
|
259156
|
-
}
|
|
259157
|
-
this.logger.error(`Frontend dev server exited with code ${code2}`);
|
|
259158
|
-
this.notifyExit(code2);
|
|
259159
|
-
});
|
|
259160
|
-
}
|
|
259161
|
-
notifyExit(code2) {
|
|
259162
|
-
for (const listener of this.exitListeners) {
|
|
259163
|
-
listener(code2);
|
|
259164
|
-
}
|
|
259165
|
-
}
|
|
259166
|
-
emitLines(data, type) {
|
|
259167
|
-
const lines = data.toString().trimEnd().split(`
|
|
259168
|
-
`);
|
|
259169
|
-
for (const line3 of lines) {
|
|
259170
|
-
if (type === "error") {
|
|
259171
|
-
this.logger.error(line3);
|
|
259172
|
-
} else {
|
|
259173
|
-
this.logger.log(line3);
|
|
259174
|
-
}
|
|
259175
|
-
}
|
|
259176
|
-
}
|
|
259177
|
-
}
|
|
259178
|
-
|
|
259179
|
-
// src/cli/dev/frontend-runner.ts
|
|
259180
|
-
function createFrontendRunner({
|
|
259181
|
-
serveCommand,
|
|
259182
|
-
projectRoot,
|
|
259183
|
-
appId,
|
|
259184
|
-
appBaseUrl
|
|
259185
|
-
}) {
|
|
259186
|
-
return new ServeRunner({
|
|
259187
|
-
command: serveCommand,
|
|
259188
|
-
cwd: projectRoot,
|
|
259189
|
-
env: {
|
|
259190
|
-
VITE_BASE44_APP_ID: appId,
|
|
259191
|
-
VITE_BASE44_APP_BASE_URL: appBaseUrl
|
|
259192
|
-
},
|
|
259193
|
-
logger: createDevLogger("frontend", theme.colors.base44Orange)
|
|
259194
|
-
});
|
|
259195
|
-
}
|
|
259196
|
-
|
|
259197
259076
|
// src/cli/dev/dev-server/db/database.ts
|
|
259198
259077
|
var import_nedb = __toESM(require_nedb(), 1);
|
|
259199
259078
|
|
|
@@ -262159,16 +262038,6 @@ async function createDevServer(options8) {
|
|
|
262159
262038
|
}
|
|
262160
262039
|
});
|
|
262161
262040
|
await base44ConfigWatcher.start();
|
|
262162
|
-
const serveCommand = project2.site?.serveCommand;
|
|
262163
|
-
let serveRunner;
|
|
262164
|
-
if (options8.appId && serveCommand) {
|
|
262165
|
-
serveRunner = createFrontendRunner({
|
|
262166
|
-
serveCommand,
|
|
262167
|
-
projectRoot: project2.root,
|
|
262168
|
-
appId: options8.appId,
|
|
262169
|
-
appBaseUrl: baseUrl
|
|
262170
|
-
});
|
|
262171
|
-
}
|
|
262172
262041
|
const handleShutdownError = (error48) => {
|
|
262173
262042
|
const errorMessage = error48 instanceof Error ? error48.message : String(error48);
|
|
262174
262043
|
devLogger.error(`Failed to shut down dev server: ${errorMessage}`);
|
|
@@ -262191,7 +262060,6 @@ async function createDevServer(options8) {
|
|
|
262191
262060
|
base44ConfigWatcher.close();
|
|
262192
262061
|
await io6.close();
|
|
262193
262062
|
await functionManager.stopAll();
|
|
262194
|
-
await serveRunner?.stop();
|
|
262195
262063
|
await closeServerIfRunning();
|
|
262196
262064
|
};
|
|
262197
262065
|
let shutdownPromise;
|
|
@@ -262201,27 +262069,128 @@ async function createDevServer(options8) {
|
|
|
262201
262069
|
};
|
|
262202
262070
|
process.on("SIGINT", shutdown);
|
|
262203
262071
|
process.on("SIGTERM", shutdown);
|
|
262204
|
-
|
|
262205
|
-
shutdown().finally(() => process.exit(1));
|
|
262206
|
-
});
|
|
262207
|
-
if (serveRunner) {
|
|
262208
|
-
devLogger.log(`Backend running on ${baseUrl}`);
|
|
262209
|
-
serveRunner.start();
|
|
262210
|
-
}
|
|
262211
|
-
return { port, server, isServingFrontend: serveRunner !== undefined };
|
|
262072
|
+
return { port, server, shutdown };
|
|
262212
262073
|
}
|
|
262213
262074
|
|
|
262214
|
-
// src/cli/dev/
|
|
262215
|
-
|
|
262216
|
-
|
|
262217
|
-
|
|
262218
|
-
|
|
262219
|
-
|
|
262075
|
+
// src/cli/dev/dev-server/serve-runner.ts
|
|
262076
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
262077
|
+
import process23 from "node:process";
|
|
262078
|
+
|
|
262079
|
+
class ServeRunner {
|
|
262080
|
+
command;
|
|
262081
|
+
cwd;
|
|
262082
|
+
env;
|
|
262083
|
+
logger;
|
|
262084
|
+
child;
|
|
262085
|
+
stopping = false;
|
|
262086
|
+
stopPromise;
|
|
262087
|
+
exitListeners = [];
|
|
262088
|
+
constructor(options8) {
|
|
262089
|
+
this.command = options8.command;
|
|
262090
|
+
this.cwd = options8.cwd;
|
|
262091
|
+
this.env = options8.env;
|
|
262092
|
+
this.logger = options8.logger;
|
|
262093
|
+
}
|
|
262094
|
+
start() {
|
|
262095
|
+
if (this.child) {
|
|
262096
|
+
return;
|
|
262097
|
+
}
|
|
262098
|
+
const stdin2 = process23.platform === "win32" ? "ignore" : "inherit";
|
|
262099
|
+
const child = spawn3(this.command, {
|
|
262100
|
+
cwd: this.cwd,
|
|
262101
|
+
shell: true,
|
|
262102
|
+
detached: process23.platform !== "win32",
|
|
262103
|
+
env: { ...process23.env, ...this.env },
|
|
262104
|
+
stdio: [stdin2, "pipe", "pipe"],
|
|
262105
|
+
windowsHide: true
|
|
262106
|
+
});
|
|
262107
|
+
this.child = child;
|
|
262108
|
+
this.setupHandlers(child);
|
|
262109
|
+
}
|
|
262110
|
+
onExit(listener) {
|
|
262111
|
+
this.exitListeners.push(listener);
|
|
262112
|
+
}
|
|
262113
|
+
async stop() {
|
|
262114
|
+
if (this.stopPromise) {
|
|
262115
|
+
return this.stopPromise;
|
|
262116
|
+
}
|
|
262117
|
+
this.stopPromise = this.stopChild();
|
|
262118
|
+
return this.stopPromise;
|
|
262119
|
+
}
|
|
262120
|
+
async stopChild() {
|
|
262121
|
+
const child = this.child;
|
|
262122
|
+
if (!child || child.exitCode !== null) {
|
|
262123
|
+
return;
|
|
262124
|
+
}
|
|
262125
|
+
this.stopping = true;
|
|
262126
|
+
const exited = new Promise((resolve15) => child.once("exit", () => resolve15()));
|
|
262127
|
+
if (process23.platform === "win32" && child.pid) {
|
|
262128
|
+
const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
262129
|
+
stdio: "ignore",
|
|
262130
|
+
windowsHide: true
|
|
262131
|
+
});
|
|
262132
|
+
await new Promise((resolve15) => {
|
|
262133
|
+
taskkill.once("exit", () => resolve15());
|
|
262134
|
+
taskkill.once("error", () => resolve15());
|
|
262135
|
+
});
|
|
262136
|
+
} else if (child.pid) {
|
|
262137
|
+
try {
|
|
262138
|
+
process23.kill(-child.pid, "SIGTERM");
|
|
262139
|
+
} catch {
|
|
262140
|
+
child.kill();
|
|
262141
|
+
}
|
|
262142
|
+
}
|
|
262143
|
+
await exited;
|
|
262144
|
+
}
|
|
262145
|
+
setupHandlers(child) {
|
|
262146
|
+
child.stdout?.on("data", (data) => this.emitLines(data, "log"));
|
|
262147
|
+
child.stderr?.on("data", (data) => this.emitLines(data, "error"));
|
|
262148
|
+
child.on("error", (error48) => {
|
|
262149
|
+
this.logger.error("Frontend dev server failed to start:", error48);
|
|
262150
|
+
this.notifyExit(null);
|
|
262151
|
+
});
|
|
262152
|
+
child.on("exit", (code2) => {
|
|
262153
|
+
if (this.stopping) {
|
|
262154
|
+
return;
|
|
262155
|
+
}
|
|
262156
|
+
this.logger.error(`Frontend dev server exited with code ${code2}`);
|
|
262157
|
+
this.notifyExit(code2);
|
|
262158
|
+
});
|
|
262159
|
+
}
|
|
262160
|
+
notifyExit(code2) {
|
|
262161
|
+
for (const listener of this.exitListeners) {
|
|
262162
|
+
listener(code2);
|
|
262163
|
+
}
|
|
262164
|
+
}
|
|
262165
|
+
emitLines(data, type) {
|
|
262166
|
+
const lines = data.toString().trimEnd().split(`
|
|
262167
|
+
`);
|
|
262168
|
+
for (const line3 of lines) {
|
|
262169
|
+
if (type === "error") {
|
|
262170
|
+
this.logger.error(line3);
|
|
262171
|
+
} else {
|
|
262172
|
+
this.logger.log(line3);
|
|
262173
|
+
}
|
|
262174
|
+
}
|
|
262175
|
+
}
|
|
262220
262176
|
}
|
|
262221
|
-
|
|
262222
|
-
|
|
262223
|
-
|
|
262224
|
-
|
|
262177
|
+
|
|
262178
|
+
// src/cli/dev/serve-command-runner.ts
|
|
262179
|
+
function createServeCommandRunner({
|
|
262180
|
+
serveCommand,
|
|
262181
|
+
projectRoot,
|
|
262182
|
+
appId,
|
|
262183
|
+
appBaseUrl
|
|
262184
|
+
}) {
|
|
262185
|
+
return new ServeRunner({
|
|
262186
|
+
command: serveCommand,
|
|
262187
|
+
cwd: projectRoot,
|
|
262188
|
+
env: {
|
|
262189
|
+
VITE_BASE44_APP_ID: appId,
|
|
262190
|
+
VITE_BASE44_APP_BASE_URL: appBaseUrl
|
|
262191
|
+
},
|
|
262192
|
+
logger: createDevLogger("frontend", theme.colors.base44Orange)
|
|
262193
|
+
});
|
|
262225
262194
|
}
|
|
262226
262195
|
|
|
262227
262196
|
// src/cli/commands/dev.ts
|
|
@@ -262238,40 +262207,56 @@ function validateDevOptions(command2) {
|
|
|
262238
262207
|
command2.error("--port applies to the local backend, which --remote does not start.");
|
|
262239
262208
|
}
|
|
262240
262209
|
}
|
|
262241
|
-
|
|
262210
|
+
function requireLinkedProject({ app }) {
|
|
262211
|
+
if (!app?.projectRoot) {
|
|
262212
|
+
throw new ConfigInvalidError("base44 dev requires a linked local project. Run it from a project with base44/.app.jsonc.");
|
|
262213
|
+
}
|
|
262214
|
+
return { id: app.id, projectRoot: app.projectRoot };
|
|
262215
|
+
}
|
|
262216
|
+
async function resolveConfiguredSite(app) {
|
|
262242
262217
|
const { project: project2 } = await readProjectConfig(app.projectRoot);
|
|
262243
262218
|
const serveCommand = project2.site?.serveCommand;
|
|
262244
|
-
|
|
262219
|
+
return serveCommand ? { serveCommand, projectRoot: project2.root } : undefined;
|
|
262220
|
+
}
|
|
262221
|
+
function stopRunnerOnProcessSignals(runner) {
|
|
262222
|
+
const stop2 = () => void runner.stop();
|
|
262223
|
+
process.on("SIGINT", stop2);
|
|
262224
|
+
process.on("SIGTERM", stop2);
|
|
262225
|
+
}
|
|
262226
|
+
function startServeCommand(runner, backend) {
|
|
262227
|
+
stopRunnerOnProcessSignals(runner);
|
|
262228
|
+
runner.onExit(() => {
|
|
262229
|
+
backend.shutdown().finally(() => process.exit(1));
|
|
262230
|
+
});
|
|
262231
|
+
createDevLogger("backend", theme.styles.info).log(`Backend running on ${backend.url}`);
|
|
262232
|
+
runner.start();
|
|
262233
|
+
}
|
|
262234
|
+
async function remoteDevAction(app) {
|
|
262235
|
+
const site2 = await resolveConfiguredSite(app);
|
|
262236
|
+
if (!site2) {
|
|
262245
262237
|
throw new ConfigInvalidError("base44 dev --remote serves the frontend against the production backend, but this project has no site.serveCommand in base44/config.jsonc.");
|
|
262246
262238
|
}
|
|
262247
262239
|
const appBaseUrl = await getSiteUrl();
|
|
262248
|
-
|
|
262240
|
+
const runner = createServeCommandRunner({
|
|
262241
|
+
...site2,
|
|
262249
262242
|
appId: app.id,
|
|
262250
|
-
appBaseUrl
|
|
262251
|
-
serveCommand,
|
|
262252
|
-
projectRoot: project2.root
|
|
262243
|
+
appBaseUrl
|
|
262253
262244
|
});
|
|
262245
|
+
stopRunnerOnProcessSignals(runner);
|
|
262246
|
+
runner.onExit((code2) => process.exit(code2 ?? 1));
|
|
262247
|
+
runner.start();
|
|
262254
262248
|
return {
|
|
262255
262249
|
outroMessage: `Frontend dev server targets ${theme.styles.bold(appBaseUrl)} — every write hits your live app`
|
|
262256
262250
|
};
|
|
262257
262251
|
}
|
|
262258
|
-
async function
|
|
262259
|
-
const
|
|
262260
|
-
if (!app?.projectRoot) {
|
|
262261
|
-
throw new ConfigInvalidError("base44 dev requires a linked local project. Run it from a project with base44/.app.jsonc.");
|
|
262262
|
-
}
|
|
262263
|
-
return options8.remote ? remoteDevAction({ id: app.id, projectRoot: app.projectRoot }) : localDevAction(ctx, options8);
|
|
262264
|
-
}
|
|
262265
|
-
async function localDevAction({ log, app }, options8) {
|
|
262266
|
-
const port = options8.port ? Number(options8.port) : undefined;
|
|
262267
|
-
const appId = app?.id;
|
|
262252
|
+
async function localDevAction(ctx, app, options8) {
|
|
262253
|
+
const site2 = await resolveConfiguredSite(app);
|
|
262268
262254
|
const siteUrlPromise = getSiteUrl().catch(() => {
|
|
262269
262255
|
return;
|
|
262270
262256
|
});
|
|
262271
|
-
const
|
|
262272
|
-
log,
|
|
262273
|
-
port,
|
|
262274
|
-
appId,
|
|
262257
|
+
const backend = await createDevServer({
|
|
262258
|
+
log: ctx.log,
|
|
262259
|
+
port: options8.port ? Number(options8.port) : undefined,
|
|
262275
262260
|
denoWrapperPath: getDenoWrapperPath(),
|
|
262276
262261
|
loadResources: async () => {
|
|
262277
262262
|
const { functions, entities, project: project2 } = await readProjectConfig();
|
|
@@ -262279,9 +262264,22 @@ async function localDevAction({ log, app }, options8) {
|
|
|
262279
262264
|
return { functions, entities, project: project2, siteUrl };
|
|
262280
262265
|
}
|
|
262281
262266
|
});
|
|
262282
|
-
const
|
|
262267
|
+
const backendUrl = localServerUrl(backend.port);
|
|
262268
|
+
if (site2) {
|
|
262269
|
+
const runner = createServeCommandRunner({
|
|
262270
|
+
...site2,
|
|
262271
|
+
appId: app.id,
|
|
262272
|
+
appBaseUrl: backendUrl
|
|
262273
|
+
});
|
|
262274
|
+
startServeCommand(runner, { url: backendUrl, shutdown: backend.shutdown });
|
|
262275
|
+
}
|
|
262276
|
+
const outroMessage = site2 ? "Open your app using the frontend dev server URL" : `Dev server is available at ${theme.colors.links(backendUrl)}`;
|
|
262283
262277
|
return { outroMessage };
|
|
262284
262278
|
}
|
|
262279
|
+
async function devAction(ctx, options8) {
|
|
262280
|
+
const app = requireLinkedProject(ctx);
|
|
262281
|
+
return options8.remote ? remoteDevAction(app) : localDevAction(ctx, app, options8);
|
|
262282
|
+
}
|
|
262285
262283
|
function getDevCommand() {
|
|
262286
262284
|
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").option("--remote", "Serve the frontend against the production backend instead of a local one").hook("preAction", validateDevOptions).action(devAction);
|
|
262287
262285
|
}
|
|
@@ -266801,4 +266799,4 @@ export {
|
|
|
266801
266799
|
CLIExitError
|
|
266802
266800
|
};
|
|
266803
266801
|
|
|
266804
|
-
//# debugId=
|
|
266802
|
+
//# debugId=4E24EC53FAF832E164756E2164756E21
|