@base44-preview/cli 0.1.6-pr.580.9cdb7f2 → 0.1.6-pr.580.b42a66a
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 +211 -216
- package/dist/cli/index.js.map +9 -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) {
|
|
@@ -256655,13 +256655,11 @@ async function runSiteBuild({ runTask: runTask2 }, { root, buildCommand, appId }
|
|
|
256655
256655
|
]
|
|
256656
256656
|
});
|
|
256657
256657
|
}
|
|
256658
|
-
await runTask2("Building site...",
|
|
256659
|
-
|
|
256660
|
-
|
|
256661
|
-
|
|
256662
|
-
|
|
256663
|
-
})`${buildCommand}`;
|
|
256664
|
-
}, {
|
|
256658
|
+
await runTask2("Building site...", () => execa({
|
|
256659
|
+
cwd: root,
|
|
256660
|
+
shell: true,
|
|
256661
|
+
env: { VITE_BASE44_APP_ID: appId }
|
|
256662
|
+
})`${buildCommand}`, {
|
|
256665
256663
|
successMessage: "Site built successfully",
|
|
256666
256664
|
errorMessage: "Build failed"
|
|
256667
256665
|
});
|
|
@@ -258285,6 +258283,43 @@ function getWorkspaceCommand() {
|
|
|
258285
258283
|
return new Command("workspace").description("List workspaces, inspect one, and move apps between them").addCommand(getWorkspaceListCommand()).addCommand(getWorkspaceGetCommand()).addCommand(getWorkspaceMoveCommand());
|
|
258286
258284
|
}
|
|
258287
258285
|
|
|
258286
|
+
// src/cli/dev/createDevLogger.ts
|
|
258287
|
+
var colorByType = {
|
|
258288
|
+
error: theme.styles.error,
|
|
258289
|
+
warn: theme.styles.warn,
|
|
258290
|
+
log: (input) => input
|
|
258291
|
+
};
|
|
258292
|
+
var stringify = (item) => {
|
|
258293
|
+
if (typeof item === "string") {
|
|
258294
|
+
return item;
|
|
258295
|
+
}
|
|
258296
|
+
if (item instanceof Error) {
|
|
258297
|
+
return item.toString();
|
|
258298
|
+
}
|
|
258299
|
+
try {
|
|
258300
|
+
return JSON.stringify(item, null, 2) ?? String(item);
|
|
258301
|
+
} catch {
|
|
258302
|
+
return String(item);
|
|
258303
|
+
}
|
|
258304
|
+
};
|
|
258305
|
+
function createDevLogger(label2, labelColor = theme.styles.dim) {
|
|
258306
|
+
const prefix = label2 ? `${labelColor(`[${label2}]`)} ` : "";
|
|
258307
|
+
const print = (type, ...args) => {
|
|
258308
|
+
const colorize = colorByType[type];
|
|
258309
|
+
console[type](prefix + args.map((item) => colorize(stringify(item))).join(" "));
|
|
258310
|
+
};
|
|
258311
|
+
return {
|
|
258312
|
+
log: (...args) => print("log", ...args),
|
|
258313
|
+
error: (msg, err) => {
|
|
258314
|
+
print("error", msg);
|
|
258315
|
+
if (err) {
|
|
258316
|
+
print("error", err);
|
|
258317
|
+
}
|
|
258318
|
+
},
|
|
258319
|
+
warn: (...args) => print("warn", ...args)
|
|
258320
|
+
};
|
|
258321
|
+
}
|
|
258322
|
+
|
|
258288
258323
|
// src/cli/dev/dev-server/main.ts
|
|
258289
258324
|
var import_cors = __toESM(require_lib4(), 1);
|
|
258290
258325
|
var import_express6 = __toESM(require_express(), 1);
|
|
@@ -258421,43 +258456,6 @@ var $tmpName = promisify11(tmp.tmpName);
|
|
|
258421
258456
|
var $tmpdir = tmp.tmpdir;
|
|
258422
258457
|
var $setGracefulCleanup = tmp.setGracefulCleanup;
|
|
258423
258458
|
|
|
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
258459
|
// src/cli/dev/dev-server/function-manager.ts
|
|
258462
258460
|
import { spawn as spawn2 } from "node:child_process";
|
|
258463
258461
|
import { dirname as dirname20, join as join27 } from "node:path";
|
|
@@ -260211,109 +260209,6 @@ function createCustomIntegrationRoutes(remoteProxy, logger2) {
|
|
|
260211
260209
|
return router;
|
|
260212
260210
|
}
|
|
260213
260211
|
|
|
260214
|
-
// src/cli/dev/dev-server/serve-runner.ts
|
|
260215
|
-
import { spawn as spawn3 } from "node:child_process";
|
|
260216
|
-
import process23 from "node:process";
|
|
260217
|
-
|
|
260218
|
-
class ServeRunner {
|
|
260219
|
-
command;
|
|
260220
|
-
cwd;
|
|
260221
|
-
env;
|
|
260222
|
-
logger;
|
|
260223
|
-
child;
|
|
260224
|
-
stopping = false;
|
|
260225
|
-
stopPromise;
|
|
260226
|
-
exitListeners = [];
|
|
260227
|
-
constructor(options8) {
|
|
260228
|
-
this.command = options8.command;
|
|
260229
|
-
this.cwd = options8.cwd;
|
|
260230
|
-
this.env = options8.env;
|
|
260231
|
-
this.logger = options8.logger;
|
|
260232
|
-
}
|
|
260233
|
-
start() {
|
|
260234
|
-
if (this.child) {
|
|
260235
|
-
return;
|
|
260236
|
-
}
|
|
260237
|
-
const stdin2 = process23.platform === "win32" ? "ignore" : "inherit";
|
|
260238
|
-
const child = spawn3(this.command, {
|
|
260239
|
-
cwd: this.cwd,
|
|
260240
|
-
shell: true,
|
|
260241
|
-
detached: process23.platform !== "win32",
|
|
260242
|
-
env: { ...process23.env, ...this.env },
|
|
260243
|
-
stdio: [stdin2, "pipe", "pipe"],
|
|
260244
|
-
windowsHide: true
|
|
260245
|
-
});
|
|
260246
|
-
this.child = child;
|
|
260247
|
-
this.setupHandlers(child);
|
|
260248
|
-
}
|
|
260249
|
-
onExit(listener) {
|
|
260250
|
-
this.exitListeners.push(listener);
|
|
260251
|
-
}
|
|
260252
|
-
async stop() {
|
|
260253
|
-
if (this.stopPromise) {
|
|
260254
|
-
return this.stopPromise;
|
|
260255
|
-
}
|
|
260256
|
-
this.stopPromise = this.stopChild();
|
|
260257
|
-
return this.stopPromise;
|
|
260258
|
-
}
|
|
260259
|
-
async stopChild() {
|
|
260260
|
-
const child = this.child;
|
|
260261
|
-
if (!child || child.exitCode !== null) {
|
|
260262
|
-
return;
|
|
260263
|
-
}
|
|
260264
|
-
this.stopping = true;
|
|
260265
|
-
const exited = new Promise((resolve13) => child.once("exit", () => resolve13()));
|
|
260266
|
-
if (process23.platform === "win32" && child.pid) {
|
|
260267
|
-
const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
260268
|
-
stdio: "ignore",
|
|
260269
|
-
windowsHide: true
|
|
260270
|
-
});
|
|
260271
|
-
await new Promise((resolve13) => {
|
|
260272
|
-
taskkill.once("exit", () => resolve13());
|
|
260273
|
-
taskkill.once("error", () => resolve13());
|
|
260274
|
-
});
|
|
260275
|
-
} else if (child.pid) {
|
|
260276
|
-
try {
|
|
260277
|
-
process23.kill(-child.pid, "SIGTERM");
|
|
260278
|
-
} catch {
|
|
260279
|
-
child.kill();
|
|
260280
|
-
}
|
|
260281
|
-
}
|
|
260282
|
-
await exited;
|
|
260283
|
-
}
|
|
260284
|
-
setupHandlers(child) {
|
|
260285
|
-
child.stdout?.on("data", (data) => this.emitLines(data, "log"));
|
|
260286
|
-
child.stderr?.on("data", (data) => this.emitLines(data, "error"));
|
|
260287
|
-
child.on("error", (error48) => {
|
|
260288
|
-
this.logger.error("Frontend dev server failed to start:", error48);
|
|
260289
|
-
this.notifyExit(null);
|
|
260290
|
-
});
|
|
260291
|
-
child.on("exit", (code2) => {
|
|
260292
|
-
if (this.stopping) {
|
|
260293
|
-
return;
|
|
260294
|
-
}
|
|
260295
|
-
this.logger.error(`Frontend dev server exited with code ${code2}`);
|
|
260296
|
-
this.notifyExit(code2);
|
|
260297
|
-
});
|
|
260298
|
-
}
|
|
260299
|
-
notifyExit(code2) {
|
|
260300
|
-
for (const listener of this.exitListeners) {
|
|
260301
|
-
listener(code2);
|
|
260302
|
-
}
|
|
260303
|
-
}
|
|
260304
|
-
emitLines(data, type) {
|
|
260305
|
-
const lines = data.toString().trimEnd().split(`
|
|
260306
|
-
`);
|
|
260307
|
-
for (const line3 of lines) {
|
|
260308
|
-
if (type === "error") {
|
|
260309
|
-
this.logger.error(line3);
|
|
260310
|
-
} else {
|
|
260311
|
-
this.logger.log(line3);
|
|
260312
|
-
}
|
|
260313
|
-
}
|
|
260314
|
-
}
|
|
260315
|
-
}
|
|
260316
|
-
|
|
260317
260212
|
// src/cli/dev/dev-server/watcher.ts
|
|
260318
260213
|
import { EventEmitter as EventEmitter4 } from "node:events";
|
|
260319
260214
|
import { relative as relative6 } from "node:path";
|
|
@@ -262141,19 +262036,6 @@ async function createDevServer(options8) {
|
|
|
262141
262036
|
}
|
|
262142
262037
|
});
|
|
262143
262038
|
await base44ConfigWatcher.start();
|
|
262144
|
-
const serveCommand = project2.site?.serveCommand;
|
|
262145
|
-
let serveRunner;
|
|
262146
|
-
if (options8.appId && serveCommand) {
|
|
262147
|
-
serveRunner = new ServeRunner({
|
|
262148
|
-
command: serveCommand,
|
|
262149
|
-
cwd: project2.root,
|
|
262150
|
-
env: {
|
|
262151
|
-
VITE_BASE44_APP_ID: options8.appId,
|
|
262152
|
-
VITE_BASE44_APP_BASE_URL: baseUrl
|
|
262153
|
-
},
|
|
262154
|
-
logger: createDevLogger("frontend", theme.colors.base44Orange)
|
|
262155
|
-
});
|
|
262156
|
-
}
|
|
262157
262039
|
const handleShutdownError = (error48) => {
|
|
262158
262040
|
const errorMessage = error48 instanceof Error ? error48.message : String(error48);
|
|
262159
262041
|
devLogger.error(`Failed to shut down dev server: ${errorMessage}`);
|
|
@@ -262176,7 +262058,6 @@ async function createDevServer(options8) {
|
|
|
262176
262058
|
base44ConfigWatcher.close();
|
|
262177
262059
|
await io6.close();
|
|
262178
262060
|
await functionManager.stopAll();
|
|
262179
|
-
await serveRunner?.stop();
|
|
262180
262061
|
await closeServerIfRunning();
|
|
262181
262062
|
};
|
|
262182
262063
|
let shutdownPromise;
|
|
@@ -262186,28 +262067,118 @@ async function createDevServer(options8) {
|
|
|
262186
262067
|
};
|
|
262187
262068
|
process.on("SIGINT", shutdown);
|
|
262188
262069
|
process.on("SIGTERM", shutdown);
|
|
262189
|
-
|
|
262190
|
-
shutdown().finally(() => process.exit(1));
|
|
262191
|
-
});
|
|
262192
|
-
if (serveRunner) {
|
|
262193
|
-
devLogger.log(`Backend running on ${baseUrl}`);
|
|
262194
|
-
serveRunner.start();
|
|
262195
|
-
}
|
|
262196
|
-
return { port, server, isServingFrontend: serveRunner !== undefined };
|
|
262070
|
+
return { port, server, shutdown };
|
|
262197
262071
|
}
|
|
262198
262072
|
|
|
262199
|
-
// src/cli/dev/
|
|
262200
|
-
|
|
262201
|
-
|
|
262202
|
-
|
|
262203
|
-
|
|
262204
|
-
|
|
262073
|
+
// src/cli/dev/dev-server/serve-runner.ts
|
|
262074
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
262075
|
+
import process23 from "node:process";
|
|
262076
|
+
|
|
262077
|
+
class ServeRunner {
|
|
262078
|
+
command;
|
|
262079
|
+
cwd;
|
|
262080
|
+
env;
|
|
262081
|
+
logger;
|
|
262082
|
+
child;
|
|
262083
|
+
stopping = false;
|
|
262084
|
+
stopPromise;
|
|
262085
|
+
exitListeners = [];
|
|
262086
|
+
constructor(options8) {
|
|
262087
|
+
this.command = options8.command;
|
|
262088
|
+
this.cwd = options8.cwd;
|
|
262089
|
+
this.env = options8.env;
|
|
262090
|
+
this.logger = options8.logger;
|
|
262091
|
+
}
|
|
262092
|
+
start() {
|
|
262093
|
+
if (this.child) {
|
|
262094
|
+
return;
|
|
262095
|
+
}
|
|
262096
|
+
const stdin2 = process23.platform === "win32" ? "ignore" : "inherit";
|
|
262097
|
+
const child = spawn3(this.command, {
|
|
262098
|
+
cwd: this.cwd,
|
|
262099
|
+
shell: true,
|
|
262100
|
+
detached: process23.platform !== "win32",
|
|
262101
|
+
env: { ...process23.env, ...this.env },
|
|
262102
|
+
stdio: [stdin2, "pipe", "pipe"],
|
|
262103
|
+
windowsHide: true
|
|
262104
|
+
});
|
|
262105
|
+
this.child = child;
|
|
262106
|
+
this.setupHandlers(child);
|
|
262107
|
+
}
|
|
262108
|
+
onExit(listener) {
|
|
262109
|
+
this.exitListeners.push(listener);
|
|
262110
|
+
}
|
|
262111
|
+
async stop() {
|
|
262112
|
+
if (this.stopPromise) {
|
|
262113
|
+
return this.stopPromise;
|
|
262114
|
+
}
|
|
262115
|
+
this.stopPromise = this.stopChild();
|
|
262116
|
+
return this.stopPromise;
|
|
262117
|
+
}
|
|
262118
|
+
async stopChild() {
|
|
262119
|
+
const child = this.child;
|
|
262120
|
+
if (!child || child.exitCode !== null) {
|
|
262121
|
+
return;
|
|
262122
|
+
}
|
|
262123
|
+
this.stopping = true;
|
|
262124
|
+
const exited = new Promise((resolve15) => child.once("exit", () => resolve15()));
|
|
262125
|
+
if (process23.platform === "win32" && child.pid) {
|
|
262126
|
+
const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
262127
|
+
stdio: "ignore",
|
|
262128
|
+
windowsHide: true
|
|
262129
|
+
});
|
|
262130
|
+
await new Promise((resolve15) => {
|
|
262131
|
+
taskkill.once("exit", () => resolve15());
|
|
262132
|
+
taskkill.once("error", () => resolve15());
|
|
262133
|
+
});
|
|
262134
|
+
} else if (child.pid) {
|
|
262135
|
+
try {
|
|
262136
|
+
process23.kill(-child.pid, "SIGTERM");
|
|
262137
|
+
} catch {
|
|
262138
|
+
child.kill();
|
|
262139
|
+
}
|
|
262140
|
+
}
|
|
262141
|
+
await exited;
|
|
262142
|
+
}
|
|
262143
|
+
setupHandlers(child) {
|
|
262144
|
+
child.stdout?.on("data", (data) => this.emitLines(data, "log"));
|
|
262145
|
+
child.stderr?.on("data", (data) => this.emitLines(data, "error"));
|
|
262146
|
+
child.on("error", (error48) => {
|
|
262147
|
+
this.logger.error("Frontend dev server failed to start:", error48);
|
|
262148
|
+
this.notifyExit(null);
|
|
262149
|
+
});
|
|
262150
|
+
child.on("exit", (code2) => {
|
|
262151
|
+
if (this.stopping) {
|
|
262152
|
+
return;
|
|
262153
|
+
}
|
|
262154
|
+
this.logger.error(`Frontend dev server exited with code ${code2}`);
|
|
262155
|
+
this.notifyExit(code2);
|
|
262156
|
+
});
|
|
262157
|
+
}
|
|
262158
|
+
notifyExit(code2) {
|
|
262159
|
+
for (const listener of this.exitListeners) {
|
|
262160
|
+
listener(code2);
|
|
262161
|
+
}
|
|
262162
|
+
}
|
|
262163
|
+
emitLines(data, type) {
|
|
262164
|
+
const lines = data.toString().trimEnd().split(`
|
|
262165
|
+
`);
|
|
262166
|
+
for (const line3 of lines) {
|
|
262167
|
+
if (type === "error") {
|
|
262168
|
+
this.logger.error(line3);
|
|
262169
|
+
} else {
|
|
262170
|
+
this.logger.log(line3);
|
|
262171
|
+
}
|
|
262172
|
+
}
|
|
262173
|
+
}
|
|
262205
262174
|
}
|
|
262206
|
-
|
|
262207
|
-
|
|
262208
|
-
|
|
262175
|
+
|
|
262176
|
+
// src/cli/dev/serve-command-runner.ts
|
|
262177
|
+
function createServeCommandRunner({
|
|
262209
262178
|
serveCommand,
|
|
262210
|
-
projectRoot
|
|
262179
|
+
projectRoot,
|
|
262180
|
+
appId,
|
|
262181
|
+
appBaseUrl
|
|
262211
262182
|
}) {
|
|
262212
262183
|
return new ServeRunner({
|
|
262213
262184
|
command: serveCommand,
|
|
@@ -262219,11 +262190,6 @@ function createRemoteServeRunner({
|
|
|
262219
262190
|
logger: createDevLogger("frontend", theme.colors.base44Orange)
|
|
262220
262191
|
});
|
|
262221
262192
|
}
|
|
262222
|
-
function stopRunnerOnProcessSignals(runner) {
|
|
262223
|
-
const stop2 = () => void runner.stop();
|
|
262224
|
-
process.on("SIGINT", stop2);
|
|
262225
|
-
process.on("SIGTERM", stop2);
|
|
262226
|
-
}
|
|
262227
262193
|
|
|
262228
262194
|
// src/cli/commands/dev.ts
|
|
262229
262195
|
function localServerUrl(port) {
|
|
@@ -262239,40 +262205,56 @@ function validateDevOptions(command2) {
|
|
|
262239
262205
|
command2.error("--port applies to the local backend, which --remote does not start.");
|
|
262240
262206
|
}
|
|
262241
262207
|
}
|
|
262242
|
-
|
|
262208
|
+
function requireLinkedProject({ app }) {
|
|
262209
|
+
if (!app?.projectRoot) {
|
|
262210
|
+
throw new ConfigInvalidError("base44 dev requires a linked local project. Run it from a project with base44/.app.jsonc.");
|
|
262211
|
+
}
|
|
262212
|
+
return { id: app.id, projectRoot: app.projectRoot };
|
|
262213
|
+
}
|
|
262214
|
+
async function resolveConfiguredSite(app) {
|
|
262243
262215
|
const { project: project2 } = await readProjectConfig(app.projectRoot);
|
|
262244
262216
|
const serveCommand = project2.site?.serveCommand;
|
|
262245
|
-
|
|
262217
|
+
return serveCommand ? { serveCommand, projectRoot: project2.root } : undefined;
|
|
262218
|
+
}
|
|
262219
|
+
function stopRunnerOnProcessSignals(runner) {
|
|
262220
|
+
const stop2 = () => void runner.stop();
|
|
262221
|
+
process.on("SIGINT", stop2);
|
|
262222
|
+
process.on("SIGTERM", stop2);
|
|
262223
|
+
}
|
|
262224
|
+
function startServeCommand(runner, backend) {
|
|
262225
|
+
stopRunnerOnProcessSignals(runner);
|
|
262226
|
+
runner.onExit(() => {
|
|
262227
|
+
backend.shutdown().finally(() => process.exit(1));
|
|
262228
|
+
});
|
|
262229
|
+
createDevLogger("backend", theme.styles.info).log(`Backend running on ${backend.url}`);
|
|
262230
|
+
runner.start();
|
|
262231
|
+
}
|
|
262232
|
+
async function remoteDevAction(app) {
|
|
262233
|
+
const site2 = await resolveConfiguredSite(app);
|
|
262234
|
+
if (!site2) {
|
|
262246
262235
|
throw new ConfigInvalidError("base44 dev --remote serves the frontend against the production backend, but this project has no site.serveCommand in base44/config.jsonc.");
|
|
262247
262236
|
}
|
|
262248
262237
|
const appBaseUrl = await getSiteUrl();
|
|
262249
|
-
|
|
262238
|
+
const runner = createServeCommandRunner({
|
|
262239
|
+
...site2,
|
|
262250
262240
|
appId: app.id,
|
|
262251
|
-
appBaseUrl
|
|
262252
|
-
serveCommand,
|
|
262253
|
-
projectRoot: project2.root
|
|
262241
|
+
appBaseUrl
|
|
262254
262242
|
});
|
|
262243
|
+
stopRunnerOnProcessSignals(runner);
|
|
262244
|
+
runner.onExit((code2) => process.exit(code2 ?? 1));
|
|
262245
|
+
runner.start();
|
|
262255
262246
|
return {
|
|
262256
262247
|
outroMessage: `Frontend dev server targets ${theme.styles.bold(appBaseUrl)} — every write hits your live app`
|
|
262257
262248
|
};
|
|
262258
262249
|
}
|
|
262259
|
-
async function
|
|
262260
|
-
const
|
|
262261
|
-
if (!app?.projectRoot) {
|
|
262262
|
-
throw new ConfigInvalidError("base44 dev requires a linked local project. Run it from a project with base44/.app.jsonc.");
|
|
262263
|
-
}
|
|
262264
|
-
if (options8.remote) {
|
|
262265
|
-
return remoteDevAction({ id: app.id, projectRoot: app.projectRoot });
|
|
262266
|
-
}
|
|
262267
|
-
const port = options8.port ? Number(options8.port) : undefined;
|
|
262268
|
-
const appId = app.id;
|
|
262250
|
+
async function localDevAction(ctx, app, options8) {
|
|
262251
|
+
const site2 = await resolveConfiguredSite(app);
|
|
262269
262252
|
const siteUrlPromise = getSiteUrl().catch(() => {
|
|
262270
262253
|
return;
|
|
262271
262254
|
});
|
|
262272
|
-
const
|
|
262273
|
-
log,
|
|
262274
|
-
port,
|
|
262275
|
-
appId,
|
|
262255
|
+
const backend = await createDevServer({
|
|
262256
|
+
log: ctx.log,
|
|
262257
|
+
port: options8.port ? Number(options8.port) : undefined,
|
|
262276
262258
|
denoWrapperPath: getDenoWrapperPath(),
|
|
262277
262259
|
loadResources: async () => {
|
|
262278
262260
|
const { functions, entities, project: project2 } = await readProjectConfig();
|
|
@@ -262280,9 +262262,22 @@ async function devAction(ctx, options8) {
|
|
|
262280
262262
|
return { functions, entities, project: project2, siteUrl };
|
|
262281
262263
|
}
|
|
262282
262264
|
});
|
|
262283
|
-
const
|
|
262265
|
+
const backendUrl = localServerUrl(backend.port);
|
|
262266
|
+
if (site2) {
|
|
262267
|
+
const runner = createServeCommandRunner({
|
|
262268
|
+
...site2,
|
|
262269
|
+
appId: app.id,
|
|
262270
|
+
appBaseUrl: backendUrl
|
|
262271
|
+
});
|
|
262272
|
+
startServeCommand(runner, { url: backendUrl, shutdown: backend.shutdown });
|
|
262273
|
+
}
|
|
262274
|
+
const outroMessage = site2 ? "Open your app using the frontend dev server URL" : `Dev server is available at ${theme.colors.links(backendUrl)}`;
|
|
262284
262275
|
return { outroMessage };
|
|
262285
262276
|
}
|
|
262277
|
+
async function devAction(ctx, options8) {
|
|
262278
|
+
const app = requireLinkedProject(ctx);
|
|
262279
|
+
return options8.remote ? remoteDevAction(app) : localDevAction(ctx, app, options8);
|
|
262280
|
+
}
|
|
262286
262281
|
function getDevCommand() {
|
|
262287
262282
|
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);
|
|
262288
262283
|
}
|
|
@@ -266802,4 +266797,4 @@ export {
|
|
|
266802
266797
|
CLIExitError
|
|
266803
266798
|
};
|
|
266804
266799
|
|
|
266805
|
-
//# debugId=
|
|
266800
|
+
//# debugId=C55220F450B3C3E364756E2164756E21
|