revine 1.0.2 → 1.0.4
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/index.js +0 -0
- package/dist/runtime/bundler/defaults/vite.d.ts +0 -6
- package/dist/runtime/bundler/defaults/vite.d.ts.map +1 -1
- package/dist/runtime/bundler/defaults/vite.js +0 -6
- package/dist/runtime/bundler/viteLoggerPlugin.d.ts.map +1 -1
- package/dist/runtime/bundler/viteLoggerPlugin.js +32 -6
- package/package.json +1 -1
- package/src/runtime/bundler/defaults/vite.ts +0 -6
- package/src/runtime/bundler/viteLoggerPlugin.ts +35 -6
package/dist/index.js
CHANGED
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../../../src/runtime/bundler/defaults/vite.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../../../src/runtime/bundler/defaults/vite.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;CAa7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viteLoggerPlugin.d.ts","sourceRoot":"","sources":["../../../src/runtime/bundler/viteLoggerPlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"viteLoggerPlugin.d.ts","sourceRoot":"","sources":["../../../src/runtime/bundler/viteLoggerPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;AAwBlD,wBAAgB,kBAAkB,IAAI,MAAM,CAoC3C"}
|
|
@@ -1,24 +1,50 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
+
import os from "os";
|
|
3
|
+
/**
|
|
4
|
+
* Reads all non-internal IPv4 addresses from the host machine's
|
|
5
|
+
* network interfaces so we can display them regardless of Vite's
|
|
6
|
+
* resolvedUrls behaviour (which can be empty when logLevel is silent).
|
|
7
|
+
*/
|
|
8
|
+
function getNetworkAddresses() {
|
|
9
|
+
const interfaces = os.networkInterfaces();
|
|
10
|
+
const addresses = [];
|
|
11
|
+
for (const nets of Object.values(interfaces)) {
|
|
12
|
+
if (!nets)
|
|
13
|
+
continue;
|
|
14
|
+
for (const net of nets) {
|
|
15
|
+
// Only include external IPv4 addresses
|
|
16
|
+
if (net.family === "IPv4" && !net.internal) {
|
|
17
|
+
addresses.push(net.address);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return addresses;
|
|
22
|
+
}
|
|
2
23
|
export function revineLoggerPlugin() {
|
|
3
|
-
// custom chalk instance pointing to the indigo color
|
|
4
24
|
const indigo = chalk.hex("#6d28d9");
|
|
5
25
|
return {
|
|
6
26
|
name: "revine-logger",
|
|
7
27
|
configureServer(server) {
|
|
8
28
|
server.httpServer?.once("listening", () => {
|
|
9
29
|
const protocol = server.config.server.https ? "https" : "http";
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
//
|
|
30
|
+
const port = server.config.server.port ?? 3000;
|
|
31
|
+
const localUrl = server.resolvedUrls?.local[0] ?? `${protocol}://localhost:${port}/`;
|
|
32
|
+
// Always derive network URLs from OS interfaces — reliable even with logLevel: silent
|
|
33
|
+
const networkUrls = server.resolvedUrls?.network?.length
|
|
34
|
+
? server.resolvedUrls.network
|
|
35
|
+
: getNetworkAddresses().map((addr) => `${protocol}://${addr}:${port}/`);
|
|
13
36
|
console.log(indigo("─────────────────────────────────────────────"));
|
|
14
37
|
console.log(indigo.bold("🚀 Revine Dev Server is now running!"));
|
|
15
38
|
console.log(indigo("─────────────────────────────────────────────"));
|
|
16
39
|
console.log(indigo(`Local: ${chalk.green(localUrl)}`));
|
|
17
|
-
if (
|
|
18
|
-
|
|
40
|
+
if (networkUrls.length) {
|
|
41
|
+
networkUrls.forEach((url) => {
|
|
19
42
|
console.log(indigo(`Network: ${chalk.green(url)}`));
|
|
20
43
|
});
|
|
21
44
|
}
|
|
45
|
+
else {
|
|
46
|
+
console.log(indigo(`Network: ${chalk.dim("not available")}`));
|
|
47
|
+
}
|
|
22
48
|
console.log(indigo("─────────────────────────────────────────────"));
|
|
23
49
|
console.log("");
|
|
24
50
|
});
|
package/package.json
CHANGED
|
@@ -1,8 +1,30 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
+
import os from "os";
|
|
2
3
|
import type { Plugin, ViteDevServer } from "vite";
|
|
3
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Reads all non-internal IPv4 addresses from the host machine's
|
|
7
|
+
* network interfaces so we can display them regardless of Vite's
|
|
8
|
+
* resolvedUrls behaviour (which can be empty when logLevel is silent).
|
|
9
|
+
*/
|
|
10
|
+
function getNetworkAddresses(): string[] {
|
|
11
|
+
const interfaces = os.networkInterfaces();
|
|
12
|
+
const addresses: string[] = [];
|
|
13
|
+
|
|
14
|
+
for (const nets of Object.values(interfaces)) {
|
|
15
|
+
if (!nets) continue;
|
|
16
|
+
for (const net of nets) {
|
|
17
|
+
// Only include external IPv4 addresses
|
|
18
|
+
if (net.family === "IPv4" && !net.internal) {
|
|
19
|
+
addresses.push(net.address);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return addresses;
|
|
25
|
+
}
|
|
26
|
+
|
|
4
27
|
export function revineLoggerPlugin(): Plugin {
|
|
5
|
-
// custom chalk instance pointing to the indigo color
|
|
6
28
|
const indigo = chalk.hex("#6d28d9");
|
|
7
29
|
|
|
8
30
|
return {
|
|
@@ -10,20 +32,27 @@ export function revineLoggerPlugin(): Plugin {
|
|
|
10
32
|
configureServer(server: ViteDevServer) {
|
|
11
33
|
server.httpServer?.once("listening", () => {
|
|
12
34
|
const protocol = server.config.server.https ? "https" : "http";
|
|
35
|
+
const port = server.config.server.port ?? 3000;
|
|
13
36
|
const localUrl =
|
|
14
|
-
server.resolvedUrls?.local[0]
|
|
15
|
-
|
|
37
|
+
server.resolvedUrls?.local[0] ?? `${protocol}://localhost:${port}/`;
|
|
38
|
+
|
|
39
|
+
// Always derive network URLs from OS interfaces — reliable even with logLevel: silent
|
|
40
|
+
const networkUrls =
|
|
41
|
+
server.resolvedUrls?.network?.length
|
|
42
|
+
? server.resolvedUrls.network
|
|
43
|
+
: getNetworkAddresses().map((addr) => `${protocol}://${addr}:${port}/`);
|
|
16
44
|
|
|
17
|
-
// Use the 'indigo' instance in place of 'chalk.cyan'
|
|
18
45
|
console.log(indigo("─────────────────────────────────────────────"));
|
|
19
46
|
console.log(indigo.bold("🚀 Revine Dev Server is now running!"));
|
|
20
47
|
console.log(indigo("─────────────────────────────────────────────"));
|
|
21
48
|
console.log(indigo(`Local: ${chalk.green(localUrl)}`));
|
|
22
49
|
|
|
23
|
-
if (
|
|
24
|
-
|
|
50
|
+
if (networkUrls.length) {
|
|
51
|
+
networkUrls.forEach((url: string) => {
|
|
25
52
|
console.log(indigo(`Network: ${chalk.green(url)}`));
|
|
26
53
|
});
|
|
54
|
+
} else {
|
|
55
|
+
console.log(indigo(`Network: ${chalk.dim("not available")}`));
|
|
27
56
|
}
|
|
28
57
|
|
|
29
58
|
console.log(indigo("─────────────────────────────────────────────"));
|