openmagic 0.26.3 → 0.27.0
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 +13 -5
- 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.
|
|
1450
|
+
var VERSION = "0.27.0";
|
|
1451
1451
|
var __dirname = dirname2(fileURLToPath(import.meta.url));
|
|
1452
1452
|
function attachOpenMagic(httpServer, roots) {
|
|
1453
1453
|
function handleRequest(req, res) {
|
|
@@ -1830,7 +1830,7 @@ var COMMON_DEV_PORTS = [
|
|
|
1830
1830
|
5e3
|
|
1831
1831
|
// Flask (last — macOS AirPlay also uses 5000)
|
|
1832
1832
|
];
|
|
1833
|
-
function
|
|
1833
|
+
function checkPortSingle(port, host) {
|
|
1834
1834
|
return new Promise((resolve3) => {
|
|
1835
1835
|
const socket = createConnection({ port, host, timeout: 500 });
|
|
1836
1836
|
socket.on("connect", () => {
|
|
@@ -1847,13 +1847,21 @@ function checkPort(port, host = "127.0.0.1") {
|
|
|
1847
1847
|
});
|
|
1848
1848
|
});
|
|
1849
1849
|
}
|
|
1850
|
+
async function checkPort(port, host = "127.0.0.1") {
|
|
1851
|
+
const results = await Promise.all([
|
|
1852
|
+
checkPortSingle(port, host),
|
|
1853
|
+
checkPortSingle(port, "::1"),
|
|
1854
|
+
checkPortSingle(port, "localhost")
|
|
1855
|
+
]);
|
|
1856
|
+
return results.some(Boolean);
|
|
1857
|
+
}
|
|
1850
1858
|
async function detectDevServer() {
|
|
1851
1859
|
const scripts = detectDevScripts();
|
|
1852
1860
|
const scriptPorts = scripts.map((s) => s.defaultPort).filter((p, i, a) => a.indexOf(p) === i);
|
|
1853
1861
|
if (scriptPorts.length > 0) {
|
|
1854
1862
|
for (const port of scriptPorts) {
|
|
1855
1863
|
if (await checkPort(port)) {
|
|
1856
|
-
return { port, host: "
|
|
1864
|
+
return { port, host: "localhost" };
|
|
1857
1865
|
}
|
|
1858
1866
|
}
|
|
1859
1867
|
return null;
|
|
@@ -1981,7 +1989,7 @@ process.on("uncaughtException", (err) => {
|
|
|
1981
1989
|
});
|
|
1982
1990
|
var childProcesses = [];
|
|
1983
1991
|
var lastDetectedPort = null;
|
|
1984
|
-
var VERSION2 = "0.
|
|
1992
|
+
var VERSION2 = "0.27.0";
|
|
1985
1993
|
function ask(question) {
|
|
1986
1994
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
1987
1995
|
return new Promise((resolve3) => {
|
|
@@ -2160,7 +2168,7 @@ program.name("openmagic").description("AI-powered coding toolbar for any web app
|
|
|
2160
2168
|
}
|
|
2161
2169
|
}
|
|
2162
2170
|
const proxyServer = createProxyServer(targetHost, targetPort, roots);
|
|
2163
|
-
proxyServer.listen(proxyPort, "
|
|
2171
|
+
proxyServer.listen(proxyPort, "localhost", async () => {
|
|
2164
2172
|
const proxyUrl = `http://localhost:${proxyPort}`;
|
|
2165
2173
|
console.log("");
|
|
2166
2174
|
console.log(chalk.bold.green(" Ready!"));
|