@utoo/pack 1.3.10-alpha.0 → 1.3.11
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/cjs/utils/printServerInfo.js +17 -18
- package/esm/utils/printServerInfo.js +17 -18
- package/package.json +10 -10
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.printServerInfo = printServerInfo;
|
|
7
7
|
const os_1 = __importDefault(require("os"));
|
|
8
8
|
const picocolors_1 = __importDefault(require("picocolors"));
|
|
9
|
+
const BOX_INNER_WIDTH = 50;
|
|
9
10
|
function printServerInfo(protocol, hostname, port) {
|
|
10
11
|
const localUrl = `${protocol}://localhost:${port}`;
|
|
11
12
|
const networkAddress = getNetworkAddress();
|
|
@@ -14,29 +15,27 @@ function printServerInfo(protocol, hostname, port) {
|
|
|
14
15
|
: null;
|
|
15
16
|
console.log();
|
|
16
17
|
console.log(picocolors_1.default.green(" ┌──────────────────────────────────────────────────┐"));
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
console.log(picocolors_1.default.green(" │ │"));
|
|
22
|
-
const localLabel = " │ - Local: ";
|
|
23
|
-
const localPadding = 50 - 15 - localUrl.length; // 15 is " - Local: ".length
|
|
24
|
-
console.log(picocolors_1.default.green(localLabel) +
|
|
25
|
-
picocolors_1.default.cyan(localUrl) +
|
|
26
|
-
picocolors_1.default.green(" ".repeat(Math.max(0, localPadding)) + "│"));
|
|
18
|
+
printPlainBoxLine();
|
|
19
|
+
printStyledBoxLine(" Serving!", ` ${picocolors_1.default.bold("Serving!")}`);
|
|
20
|
+
printPlainBoxLine();
|
|
21
|
+
printStyledBoxLine(` - Local: ${localUrl}`, ` - Local: ${picocolors_1.default.cyan(localUrl)}`);
|
|
27
22
|
if (networkUrl) {
|
|
28
|
-
|
|
29
|
-
const netPadding = 50 - 17 - networkUrl.length; // 17 is " - Network: ".length
|
|
30
|
-
console.log(picocolors_1.default.green(netLabel) +
|
|
31
|
-
picocolors_1.default.cyan(networkUrl) +
|
|
32
|
-
picocolors_1.default.green(" ".repeat(Math.max(0, netPadding)) + "│"));
|
|
23
|
+
printStyledBoxLine(` - Network: ${networkUrl}`, ` - Network: ${picocolors_1.default.cyan(networkUrl)}`);
|
|
33
24
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
printPlainBoxLine();
|
|
26
|
+
printPlainBoxLine(" Copied local address to clipboard!");
|
|
27
|
+
printPlainBoxLine();
|
|
37
28
|
console.log(picocolors_1.default.green(" └──────────────────────────────────────────────────┘"));
|
|
38
29
|
console.log();
|
|
39
30
|
}
|
|
31
|
+
function printPlainBoxLine(content = "") {
|
|
32
|
+
console.log(picocolors_1.default.green(` │${content.padEnd(BOX_INNER_WIDTH, " ")}│`));
|
|
33
|
+
}
|
|
34
|
+
function printStyledBoxLine(plainContent, styledContent) {
|
|
35
|
+
console.log(picocolors_1.default.green(" │") +
|
|
36
|
+
styledContent +
|
|
37
|
+
picocolors_1.default.green(`${" ".repeat(Math.max(0, BOX_INNER_WIDTH - plainContent.length))}│`));
|
|
38
|
+
}
|
|
40
39
|
function getNetworkAddress() {
|
|
41
40
|
const interfaces = os_1.default.networkInterfaces();
|
|
42
41
|
for (const name of Object.keys(interfaces)) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import os from "os";
|
|
2
2
|
import pc from "picocolors";
|
|
3
|
+
const BOX_INNER_WIDTH = 50;
|
|
3
4
|
export function printServerInfo(protocol, hostname, port) {
|
|
4
5
|
const localUrl = `${protocol}://localhost:${port}`;
|
|
5
6
|
const networkAddress = getNetworkAddress();
|
|
@@ -8,29 +9,27 @@ export function printServerInfo(protocol, hostname, port) {
|
|
|
8
9
|
: null;
|
|
9
10
|
console.log();
|
|
10
11
|
console.log(pc.green(" ┌──────────────────────────────────────────────────┐"));
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
console.log(pc.green(" │ │"));
|
|
16
|
-
const localLabel = " │ - Local: ";
|
|
17
|
-
const localPadding = 50 - 15 - localUrl.length; // 15 is " - Local: ".length
|
|
18
|
-
console.log(pc.green(localLabel) +
|
|
19
|
-
pc.cyan(localUrl) +
|
|
20
|
-
pc.green(" ".repeat(Math.max(0, localPadding)) + "│"));
|
|
12
|
+
printPlainBoxLine();
|
|
13
|
+
printStyledBoxLine(" Serving!", ` ${pc.bold("Serving!")}`);
|
|
14
|
+
printPlainBoxLine();
|
|
15
|
+
printStyledBoxLine(` - Local: ${localUrl}`, ` - Local: ${pc.cyan(localUrl)}`);
|
|
21
16
|
if (networkUrl) {
|
|
22
|
-
|
|
23
|
-
const netPadding = 50 - 17 - networkUrl.length; // 17 is " - Network: ".length
|
|
24
|
-
console.log(pc.green(netLabel) +
|
|
25
|
-
pc.cyan(networkUrl) +
|
|
26
|
-
pc.green(" ".repeat(Math.max(0, netPadding)) + "│"));
|
|
17
|
+
printStyledBoxLine(` - Network: ${networkUrl}`, ` - Network: ${pc.cyan(networkUrl)}`);
|
|
27
18
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
printPlainBoxLine();
|
|
20
|
+
printPlainBoxLine(" Copied local address to clipboard!");
|
|
21
|
+
printPlainBoxLine();
|
|
31
22
|
console.log(pc.green(" └──────────────────────────────────────────────────┘"));
|
|
32
23
|
console.log();
|
|
33
24
|
}
|
|
25
|
+
function printPlainBoxLine(content = "") {
|
|
26
|
+
console.log(pc.green(` │${content.padEnd(BOX_INNER_WIDTH, " ")}│`));
|
|
27
|
+
}
|
|
28
|
+
function printStyledBoxLine(plainContent, styledContent) {
|
|
29
|
+
console.log(pc.green(" │") +
|
|
30
|
+
styledContent +
|
|
31
|
+
pc.green(`${" ".repeat(Math.max(0, BOX_INNER_WIDTH - plainContent.length))}│`));
|
|
32
|
+
}
|
|
34
33
|
function getNetworkAddress() {
|
|
35
34
|
const interfaces = os.networkInterfaces();
|
|
36
35
|
for (const name of Object.keys(interfaces)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utoo/pack",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.11",
|
|
4
4
|
"main": "cjs/index.js",
|
|
5
5
|
"module": "esm/index.js",
|
|
6
6
|
"types": "esm/index.d.ts",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"@hono/node-server": "^1.19.11",
|
|
42
42
|
"@hono/node-ws": "^1.3.0",
|
|
43
43
|
"@swc/helpers": "0.5.15",
|
|
44
|
-
"@utoo/pack-shared": "1.3.
|
|
44
|
+
"@utoo/pack-shared": "1.3.11",
|
|
45
45
|
"domparser-rs": "^0.0.7",
|
|
46
46
|
"find-up": "4.1.0",
|
|
47
|
-
"get-port": "
|
|
47
|
+
"get-port": "5.1.1",
|
|
48
48
|
"hono": "^4.12.5",
|
|
49
49
|
"nanoid": "^3.3.11",
|
|
50
50
|
"picocolors": "^1.1.1",
|
|
@@ -92,12 +92,12 @@
|
|
|
92
92
|
},
|
|
93
93
|
"repository": "git@github.com:utooland/utoo.git",
|
|
94
94
|
"optionalDependencies": {
|
|
95
|
-
"@utoo/pack-darwin-arm64": "1.3.
|
|
96
|
-
"@utoo/pack-darwin-x64": "1.3.
|
|
97
|
-
"@utoo/pack-linux-arm64-gnu": "1.3.
|
|
98
|
-
"@utoo/pack-linux-arm64-musl": "1.3.
|
|
99
|
-
"@utoo/pack-linux-x64-gnu": "1.3.
|
|
100
|
-
"@utoo/pack-linux-x64-musl": "1.3.
|
|
101
|
-
"@utoo/pack-win32-x64-msvc": "1.3.
|
|
95
|
+
"@utoo/pack-darwin-arm64": "1.3.11",
|
|
96
|
+
"@utoo/pack-darwin-x64": "1.3.11",
|
|
97
|
+
"@utoo/pack-linux-arm64-gnu": "1.3.11",
|
|
98
|
+
"@utoo/pack-linux-arm64-musl": "1.3.11",
|
|
99
|
+
"@utoo/pack-linux-x64-gnu": "1.3.11",
|
|
100
|
+
"@utoo/pack-linux-x64-musl": "1.3.11",
|
|
101
|
+
"@utoo/pack-win32-x64-msvc": "1.3.11"
|
|
102
102
|
}
|
|
103
103
|
}
|