@flow.os/client 0.0.1-dev.1771667897 → 0.0.1-dev.1771668924

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.
Files changed (2) hide show
  1. package/config.ts +23 -2
  2. package/package.json +1 -1
package/config.ts CHANGED
@@ -50,6 +50,24 @@ const DEFAULTS = {
50
50
  plugins: [] as Plugin[],
51
51
  };
52
52
 
53
+ /** Plugin che stampa l'URL effettivo quando il server è in ascolto (utile quando Vite usa una porta diversa, es. 3001). */
54
+ function flowServerUrlPlugin(): Plugin {
55
+ return {
56
+ name: 'flow:server-url',
57
+ configureServer(server) {
58
+ server.httpServer?.once('listening', () => {
59
+ const addr = server.httpServer?.address();
60
+ if (addr && typeof addr === 'object' && 'port' in addr) {
61
+ const port = (addr as { port: number }).port;
62
+ const host = (addr as { address: string }).address;
63
+ const hostDisplay = host === '::' || host === '0.0.0.0' ? 'localhost' : host;
64
+ console.log(`\n Flow OS: http://${hostDisplay}:${port}/\n`);
65
+ }
66
+ });
67
+ },
68
+ };
69
+ }
70
+
53
71
  /** Config per flow.config.ts. Client + Vite; server opzionale con server: flowServer(). */
54
72
  export default function config(
55
73
  options: FlowConfigOptions = {}
@@ -57,11 +75,14 @@ export default function config(
57
75
  const { port = DEFAULTS.port, host = DEFAULTS.host, server = DEFAULTS.server, plugins = DEFAULTS.plugins } = options;
58
76
  return async () => {
59
77
  const { flow } = await import('./vite.js');
60
- const allPlugins = server ? [server, flow(), ...plugins] : [flow(), ...plugins];
78
+ const allPlugins = [
79
+ flowServerUrlPlugin(),
80
+ ...(server ? [server, flow(), ...plugins] : [flow(), ...plugins]),
81
+ ];
61
82
  const alias = resolveAlias();
62
83
  return {
63
84
  resolve: Object.keys(alias).length ? { alias } : {},
64
- server: { port, host },
85
+ server: { port, host, strictPort: false },
65
86
  build: {
66
87
  rollupOptions: {
67
88
  external: ['@flow.os/server', /^@flow.os\/server\/.+/],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flow.os/client",
3
- "version": "0.0.1-dev.1771667897",
3
+ "version": "0.0.1-dev.1771668924",
4
4
  "type": "module",
5
5
  "main": "./index.ts",
6
6
  "types": "./index.ts",