vitrify 0.14.3 → 0.15.0

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/bin/cli.js CHANGED
@@ -93,7 +93,10 @@ cli
93
93
  cli
94
94
  .command('dev')
95
95
  .option('-m, --mode [mode]', 'Development server mode', { default: 'csr' })
96
- .option('--host [host]', 'Specify which IP addresses the server should listen on', { default: '127.0.0.1' })
96
+ .option('--host [host]', 'Specify which IP addresses the server should listen on', { default: 'localhost' })
97
+ .option('--port [port]', 'Specify which port the server should listen on', {
98
+ default: '3000'
99
+ })
97
100
  .option('--appDir [appDir]', 'Application directory')
98
101
  // .option('--app [app]', 'Fastify app instance path')
99
102
  .option('--publicDir [publicDir]', 'Public directory')
@@ -113,6 +116,7 @@ cli
113
116
  ({ server, config } = await createServer({
114
117
  ssr: 'ssr',
115
118
  host: options.host,
119
+ port: options.port,
116
120
  appDir: parsePath(options.appDir, cwd),
117
121
  publicDir: parsePath(options.publicDir, cwd)
118
122
  }));
@@ -122,6 +126,7 @@ cli
122
126
  ({ app, server, config, vite } = await createServer({
123
127
  ssr: 'fastify',
124
128
  host: options.host,
129
+ port: options.port,
125
130
  appDir: parsePath(options.appDir, cwd),
126
131
  publicDir: parsePath(options.publicDir, cwd)
127
132
  }));
@@ -130,6 +135,7 @@ cli
130
135
  ;
131
136
  ({ server, config } = await createServer({
132
137
  host: options.host,
138
+ port: options.port,
133
139
  appDir: parsePath(options.appDir, cwd),
134
140
  publicDir: parsePath(options.publicDir, cwd)
135
141
  }));
@@ -13,10 +13,10 @@ export function printHttpServerUrls(server, config) {
13
13
  }
14
14
  }
15
15
  function printServerUrls(hostname, protocol, port, base, info) {
16
- if (hostname.host === '127.0.0.1') {
16
+ if (hostname.host === 'localhost') {
17
17
  const url = `${protocol}://${hostname.name}:${chalk.bold(port)}${base}`;
18
18
  info(` > Local: ${chalk.cyan(url)}`);
19
- if (hostname.name !== '127.0.0.1') {
19
+ if (hostname.name !== 'localhost') {
20
20
  info(` > Network: ${chalk.dim('use `--host` to expose')}`);
21
21
  }
22
22
  }
@@ -25,10 +25,10 @@ function printServerUrls(hostname, protocol, port, base, info) {
25
25
  .flatMap((nInterface) => nInterface ?? [])
26
26
  .filter((detail) => detail && detail.address && detail.family === 'IPv4')
27
27
  .map((detail) => {
28
- const type = detail.address.includes('127.0.0.1')
28
+ const type = detail.address.includes('localhost')
29
29
  ? 'Local: '
30
30
  : 'Network: ';
31
- const host = detail.address.replace('127.0.0.1', hostname.name);
31
+ const host = detail.address.replace('localhost', hostname.name);
32
32
  const url = `${protocol}://${host}:${chalk.bold(port)}${base}`;
33
33
  return ` > ${type} ${chalk.cyan(url)}`;
34
34
  })
@@ -4,7 +4,7 @@ export function resolveHostname(optionsHost) {
4
4
  optionsHost === false ||
5
5
  optionsHost === 'localhost') {
6
6
  // Use a secure default
7
- host = '127.0.0.1';
7
+ host = 'localhost';
8
8
  }
9
9
  else if (optionsHost === true) {
10
10
  // If passed --host in the CLI without arguments
@@ -13,8 +13,8 @@ export function resolveHostname(optionsHost) {
13
13
  else {
14
14
  host = optionsHost;
15
15
  }
16
- // Set host name to localhost when possible, unless the user explicitly asked for '127.0.0.1'
17
- const name = (optionsHost !== '127.0.0.1' && host === '127.0.0.1') ||
16
+ // Set host name to localhost when possible, unless the user explicitly asked for 'localhost'
17
+ const name = (optionsHost !== 'localhost' && host === 'localhost') ||
18
18
  host === '0.0.0.0' ||
19
19
  host === '::' ||
20
20
  host === undefined
@@ -6,9 +6,9 @@ import type { FastifySsrPlugin } from './fastify-ssr-plugin.js';
6
6
  export declare const createApp: ({ onSetup, appDir, baseUrl, fastifyPlugin, onRendered, vitrifyDir, mode }: {
7
7
  onSetup: ((fastify: FastifyInstance) => void)[];
8
8
  appDir: URL;
9
- baseUrl?: string | undefined;
9
+ baseUrl?: string;
10
10
  fastifyPlugin: FastifySsrPlugin | FastifyCsrPlugin;
11
11
  onRendered: OnRenderedHook[];
12
- vitrifyDir?: URL | undefined;
12
+ vitrifyDir?: URL;
13
13
  mode: string;
14
14
  }) => FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault> & PromiseLike<FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>>;
@@ -5,8 +5,8 @@ import type { ViteDevServer, ModuleNode } from 'vite';
5
5
  export declare const componentsModules: (components: string[], vite: ViteDevServer) => Set<ModuleNode>;
6
6
  export declare const collectCss: ({ mods, styles, checkedComponents }: {
7
7
  mods: Set<ModuleNode>;
8
- styles?: Map<string, string> | undefined;
9
- checkedComponents?: Set<unknown> | undefined;
8
+ styles?: Map<string, string>;
9
+ checkedComponents?: Set<unknown>;
10
10
  }) => string;
11
11
  /**
12
12
  * Client listener to detect updated modules through HMR, and remove the initial styled attached to the head
@@ -4,15 +4,15 @@ import type { VitrifyContext } from './bin/run.js';
4
4
  import type { VitrifyPlugin } from './plugins/index.js';
5
5
  export declare const VIRTUAL_MODULES: string[];
6
6
  export declare const baseConfig: ({ ssr, appDir, publicDir, base, command, mode, framework, debug, productName }: {
7
- ssr?: VitrifySSRModes | undefined;
8
- appDir?: URL | undefined;
9
- publicDir?: URL | undefined;
10
- base?: string | undefined;
11
- command?: VitrifyCommands | undefined;
12
- mode?: VitrifyModes | undefined;
13
- framework?: "vue" | undefined;
14
- debug?: boolean | undefined;
15
- productName?: string | undefined;
7
+ ssr?: VitrifySSRModes;
8
+ appDir?: URL;
9
+ publicDir?: URL;
10
+ base?: string;
11
+ command?: VitrifyCommands;
12
+ mode?: VitrifyModes;
13
+ framework?: VitrifyUIFrameworks;
14
+ debug?: boolean;
15
+ productName?: string;
16
16
  }) => Promise<InlineConfig>;
17
17
  export declare const vitrifyDir: URL;
18
18
  export { prerender } from './frameworks/vue/prerender.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitrify",
3
- "version": "0.14.3",
3
+ "version": "0.15.0",
4
4
  "license": "MIT",
5
5
  "author": "Stefan van Herwijnen",
6
6
  "description": "Vite as your Full Stack development tool",
@@ -90,7 +90,7 @@
90
90
  "vue-router": "^4.2.5"
91
91
  },
92
92
  "peerDependencies": {
93
- "@fastify/static": "^7.01",
93
+ "@fastify/static": "^7.0.1",
94
94
  "fastify": "^4.26.0",
95
95
  "quasar": "^2.14.3",
96
96
  "vue": "^3.4.15",
@@ -114,8 +114,11 @@ cli
114
114
  .option(
115
115
  '--host [host]',
116
116
  'Specify which IP addresses the server should listen on',
117
- { default: '127.0.0.1' }
117
+ { default: 'localhost' }
118
118
  )
119
+ .option('--port [port]', 'Specify which port the server should listen on', {
120
+ default: '3000'
121
+ })
119
122
  .option('--appDir [appDir]', 'Application directory')
120
123
  // .option('--app [app]', 'Fastify app instance path')
121
124
  .option('--publicDir [publicDir]', 'Public directory')
@@ -135,6 +138,7 @@ cli
135
138
  ;({ server, config } = await createServer({
136
139
  ssr: 'ssr',
137
140
  host: options.host,
141
+ port: options.port,
138
142
  appDir: parsePath(options.appDir, cwd),
139
143
  publicDir: parsePath(options.publicDir, cwd)
140
144
  }))
@@ -143,6 +147,7 @@ cli
143
147
  ;({ app, server, config, vite } = await createServer({
144
148
  ssr: 'fastify',
145
149
  host: options.host,
150
+ port: options.port,
146
151
  appDir: parsePath(options.appDir, cwd),
147
152
  publicDir: parsePath(options.publicDir, cwd)
148
153
  }))
@@ -150,6 +155,7 @@ cli
150
155
  default:
151
156
  ;({ server, config } = await createServer({
152
157
  host: options.host,
158
+ port: options.port,
153
159
  appDir: parsePath(options.appDir, cwd),
154
160
  publicDir: parsePath(options.publicDir, cwd)
155
161
  }))
@@ -34,10 +34,10 @@ function printServerUrls(
34
34
  base: string,
35
35
  info: Logger['info']
36
36
  ): void {
37
- if (hostname.host === '127.0.0.1') {
37
+ if (hostname.host === 'localhost') {
38
38
  const url = `${protocol}://${hostname.name}:${chalk.bold(port)}${base}`
39
39
  info(` > Local: ${chalk.cyan(url)}`)
40
- if (hostname.name !== '127.0.0.1') {
40
+ if (hostname.name !== 'localhost') {
41
41
  info(` > Network: ${chalk.dim('use `--host` to expose')}`)
42
42
  }
43
43
  } else {
@@ -45,10 +45,10 @@ function printServerUrls(
45
45
  .flatMap((nInterface) => nInterface ?? [])
46
46
  .filter((detail) => detail && detail.address && detail.family === 'IPv4')
47
47
  .map((detail) => {
48
- const type = detail.address.includes('127.0.0.1')
48
+ const type = detail.address.includes('localhost')
49
49
  ? 'Local: '
50
50
  : 'Network: '
51
- const host = detail.address.replace('127.0.0.1', hostname.name)
51
+ const host = detail.address.replace('localhost', hostname.name)
52
52
  const url = `${protocol}://${host}:${chalk.bold(port)}${base}`
53
53
  return ` > ${type} ${chalk.cyan(url)}`
54
54
  })
@@ -16,7 +16,7 @@ export function resolveHostname(
16
16
  optionsHost === 'localhost'
17
17
  ) {
18
18
  // Use a secure default
19
- host = '127.0.0.1'
19
+ host = 'localhost'
20
20
  } else if (optionsHost === true) {
21
21
  // If passed --host in the CLI without arguments
22
22
  host = undefined // undefined typically means 0.0.0.0 or :: (listen on all IPs)
@@ -24,9 +24,9 @@ export function resolveHostname(
24
24
  host = optionsHost
25
25
  }
26
26
 
27
- // Set host name to localhost when possible, unless the user explicitly asked for '127.0.0.1'
27
+ // Set host name to localhost when possible, unless the user explicitly asked for 'localhost'
28
28
  const name =
29
- (optionsHost !== '127.0.0.1' && host === '127.0.0.1') ||
29
+ (optionsHost !== 'localhost' && host === 'localhost') ||
30
30
  host === '0.0.0.0' ||
31
31
  host === '::' ||
32
32
  host === undefined
@@ -9,5 +9,5 @@ await setup({ fastify })
9
9
 
10
10
  fastify.listen({
11
11
  port: Number(process.env.PORT || 3000),
12
- host: process.env.HOST || '127.0.0.1'
12
+ host: process.env.HOST || 'localhost'
13
13
  })
@@ -4,5 +4,5 @@ const app = await setupApp()
4
4
 
5
5
  app.listen({
6
6
  port: Number(process.env.PORT || 3000),
7
- host: process.env.HOST || '127.0.0.1'
7
+ host: process.env.HOST || 'localhost'
8
8
  })
@@ -4,5 +4,5 @@ const app = await setupApp()
4
4
 
5
5
  app.listen({
6
6
  port: Number(process.env.PORT || 3000),
7
- host: process.env.HOST || '127.0.0.1'
7
+ host: process.env.HOST || 'localhost'
8
8
  })