devtunnel-cli 3.0.23 → 3.0.24
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/package.json +1 -1
- package/src/core/start.js +6 -6
- package/src/core/static-server.js +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devtunnel-cli",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.24",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "DevTunnel - Share local dev servers worldwide. Zero configuration tunnel for any framework. Install via npm: npm install -g devtunnel-cli. Works with Vite, React, Next.js, Express, NestJS, Laravel (PHP), HTML, and more.",
|
|
6
6
|
"main": "src/core/start.js",
|
package/src/core/start.js
CHANGED
|
@@ -17,10 +17,10 @@ function getPackageVersion() {
|
|
|
17
17
|
const pkgPath = join(PROJECT_ROOT, "package.json");
|
|
18
18
|
if (existsSync(pkgPath)) {
|
|
19
19
|
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
20
|
-
return pkg.version || "3.0.
|
|
20
|
+
return pkg.version || "3.0.24";
|
|
21
21
|
}
|
|
22
22
|
} catch (err) {}
|
|
23
|
-
return "3.0.
|
|
23
|
+
return "3.0.24";
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// Helper to run command
|
|
@@ -133,12 +133,12 @@ function detectLaravelProject(currentDir) {
|
|
|
133
133
|
function detectHtmlProject(currentDir) {
|
|
134
134
|
const indexPath = join(currentDir, "index.html");
|
|
135
135
|
if (!existsSync(indexPath)) return null;
|
|
136
|
-
return { name: basename(currentDir), defaultPort:
|
|
136
|
+
return { name: basename(currentDir), defaultPort: 5500 }; // Live Server default; matches VS Code
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
// Check common ports for running dev servers (includes Laravel 8000, XAMPP/Live Server 8080/5500)
|
|
140
140
|
async function detectRunningDevServer() {
|
|
141
|
-
const commonPorts = [3000, 5173, 8080, 8000, 5000, 4000,
|
|
141
|
+
const commonPorts = [3000, 5173, 5500, 8080, 8000, 5000, 4000, 3001, 5174]; // 5500 before 8080 for Live Server
|
|
142
142
|
const detected = [];
|
|
143
143
|
|
|
144
144
|
for (const port of commonPorts) {
|
|
@@ -206,7 +206,7 @@ async function autoDetectProject() {
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
// 3) Plain HTML (index.html) — default port
|
|
209
|
+
// 3) Plain HTML (index.html) — default port 5500 (Live Server), else built-in static server
|
|
210
210
|
const html = detectHtmlProject(currentDir);
|
|
211
211
|
if (html) {
|
|
212
212
|
const detectedPort = runningPorts.length > 0 ? runningPorts[0] : html.defaultPort;
|
|
@@ -514,7 +514,7 @@ async function main() {
|
|
|
514
514
|
let detectedPort = laravelSelected
|
|
515
515
|
? laravelSelected.defaultPort
|
|
516
516
|
: htmlSelected
|
|
517
|
-
? htmlSelected.defaultPort
|
|
517
|
+
? htmlSelected.defaultPort // 5500
|
|
518
518
|
: detectPortFromPackage(selectedPackagePath);
|
|
519
519
|
|
|
520
520
|
// Check for running servers
|
|
@@ -7,7 +7,7 @@ import http from "http";
|
|
|
7
7
|
import fs from "fs";
|
|
8
8
|
import path from "path";
|
|
9
9
|
const ROOT = path.resolve(process.argv[2] || ".");
|
|
10
|
-
const PORT = parseInt(process.argv[3] || "
|
|
10
|
+
const PORT = parseInt(process.argv[3] || "5500", 10);
|
|
11
11
|
|
|
12
12
|
const MIME = {
|
|
13
13
|
".html": "text/html",
|
|
@@ -36,7 +36,8 @@ const server = http.createServer((req, res) => {
|
|
|
36
36
|
}
|
|
37
37
|
// Use only pathname (strip query string and hash) so /style.css?v=1 resolves to style.css
|
|
38
38
|
const pathname = (req.url || "/").split("?")[0].split("#")[0];
|
|
39
|
-
|
|
39
|
+
// Forward slashes only so /css/style.css works on Windows (path.normalize can break with \)
|
|
40
|
+
const relative = (pathname || "/").replace(/^\/+/, "").replace(/\\/g, "/") || ".";
|
|
40
41
|
let p = path.join(ROOT, relative);
|
|
41
42
|
if (!path.isAbsolute(p)) p = path.join(ROOT, p);
|
|
42
43
|
if (!p.startsWith(ROOT)) {
|