openmagic 0.26.1 → 0.26.3
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.js +23 -3
- package/dist/cli.js.map +1 -1
- package/dist/toolbar/index.global.js +1 -1
- package/dist/toolbar/index.global.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1447,7 +1447,7 @@ async function handleLlmChat(params, onChunk, onDone, onError) {
|
|
|
1447
1447
|
}
|
|
1448
1448
|
|
|
1449
1449
|
// src/server.ts
|
|
1450
|
-
var VERSION = "0.26.
|
|
1450
|
+
var VERSION = "0.26.3";
|
|
1451
1451
|
var __dirname = dirname2(fileURLToPath(import.meta.url));
|
|
1452
1452
|
function attachOpenMagic(httpServer, roots) {
|
|
1453
1453
|
function handleRequest(req, res) {
|
|
@@ -1981,7 +1981,7 @@ process.on("uncaughtException", (err) => {
|
|
|
1981
1981
|
});
|
|
1982
1982
|
var childProcesses = [];
|
|
1983
1983
|
var lastDetectedPort = null;
|
|
1984
|
-
var VERSION2 = "0.26.
|
|
1984
|
+
var VERSION2 = "0.26.3";
|
|
1985
1985
|
function ask(question) {
|
|
1986
1986
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
1987
1987
|
return new Promise((resolve3) => {
|
|
@@ -2312,12 +2312,22 @@ async function offerToStartDevServer(expectedPort) {
|
|
|
2312
2312
|
let childExited = false;
|
|
2313
2313
|
let detectedPort = null;
|
|
2314
2314
|
function parsePortFromOutput(line) {
|
|
2315
|
-
const clean = line.replace(/\x1b\[
|
|
2315
|
+
const clean = line.replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g, "").replace(/\x1b[^a-zA-Z]*[a-zA-Z]/g, "").replace(/[\x00-\x1f\x7f]/g, "");
|
|
2316
2316
|
const portMatch = clean.match(/https?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0):(\d+)/);
|
|
2317
2317
|
if (portMatch && !detectedPort) {
|
|
2318
2318
|
const p = parseInt(portMatch[1], 10);
|
|
2319
2319
|
if (p > 0 && p < 65536 && p !== port) {
|
|
2320
2320
|
detectedPort = p;
|
|
2321
|
+
return;
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
if (!detectedPort) {
|
|
2325
|
+
const fallback = clean.match(/(?:port|Port|PORT)\s+(\d{4,5})/);
|
|
2326
|
+
if (fallback) {
|
|
2327
|
+
const p = parseInt(fallback[1], 10);
|
|
2328
|
+
if (p > 0 && p < 65536 && p !== port) {
|
|
2329
|
+
detectedPort = p;
|
|
2330
|
+
}
|
|
2321
2331
|
}
|
|
2322
2332
|
}
|
|
2323
2333
|
}
|
|
@@ -2393,6 +2403,16 @@ async function offerToStartDevServer(expectedPort) {
|
|
|
2393
2403
|
return false;
|
|
2394
2404
|
}
|
|
2395
2405
|
if (!isUp) {
|
|
2406
|
+
for (const scanPort of [3e3, 3001, 5173, 5174, 4200, 8080, 8e3, 4e3, 1234, 4321, 3333, 8081]) {
|
|
2407
|
+
if (scanPort === port) continue;
|
|
2408
|
+
if (await isPortOpen(scanPort)) {
|
|
2409
|
+
console.log(
|
|
2410
|
+
chalk.green(` \u2713 Dev server found on port ${scanPort}.`)
|
|
2411
|
+
);
|
|
2412
|
+
lastDetectedPort = scanPort;
|
|
2413
|
+
return true;
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2396
2416
|
console.log(
|
|
2397
2417
|
chalk.yellow(` \u26A0 Port ${port} didn't open after 30s.`)
|
|
2398
2418
|
);
|