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 CHANGED
File without changes
@@ -10,12 +10,6 @@ export declare const defaultViteConfig: {
10
10
  build: {
11
11
  outDir: string;
12
12
  emptyOutDir: boolean;
13
- rollupOptions: {
14
- external: string[];
15
- };
16
- };
17
- optimizeDeps: {
18
- exclude: string[];
19
13
  };
20
14
  };
21
15
  //# sourceMappingURL=vite.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../../../src/runtime/bundler/defaults/vite.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;CAmB7B,CAAC"}
1
+ {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../../../src/runtime/bundler/defaults/vite.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;CAa7B,CAAC"}
@@ -13,11 +13,5 @@ export const defaultViteConfig = {
13
13
  build: {
14
14
  outDir: "build",
15
15
  emptyOutDir: true,
16
- rollupOptions: {
17
- external: ["revine"],
18
- },
19
- },
20
- optimizeDeps: {
21
- exclude: ["revine"],
22
16
  },
23
17
  };
@@ -1 +1 @@
1
- {"version":3,"file":"viteLoggerPlugin.d.ts","sourceRoot":"","sources":["../../../src/runtime/bundler/viteLoggerPlugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;AAElD,wBAAgB,kBAAkB,IAAI,MAAM,CA8B3C"}
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 localUrl = server.resolvedUrls?.local[0] || `http://localhost:3000`;
11
- const { network = [] } = server.resolvedUrls ?? {};
12
- // Use the 'indigo' instance in place of 'chalk.cyan'
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 (network.length) {
18
- network.forEach((url) => {
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,6 +1,6 @@
1
1
  {
2
2
  "name": "revine",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "A react framework, but better.",
5
5
  "license": "MIT",
6
6
  "author": "Rachit Bharadwaj",
@@ -14,11 +14,5 @@ export const defaultViteConfig = {
14
14
  build: {
15
15
  outDir: "build",
16
16
  emptyOutDir: true,
17
- rollupOptions: {
18
- external: ["revine"],
19
- },
20
- },
21
- optimizeDeps: {
22
- exclude: ["revine"],
23
17
  },
24
18
  };
@@ -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] || `http://localhost:3000`;
15
- const { network = [] } = server.resolvedUrls ?? {};
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 (network.length) {
24
- network.forEach((url: string) => {
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("─────────────────────────────────────────────"));