vitrify 0.11.3 → 0.11.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.
@@ -20,6 +20,7 @@ const fastifyCsrPlugin = async (fastify, options, done) => {
20
20
  console.log('Dev mode');
21
21
  if (!('use' in fastify)) {
22
22
  const middie = (await import('@fastify/middie')).default;
23
+ // @ts-ignore
23
24
  await fastify.register(middie);
24
25
  }
25
26
  fastify.use(vite.middlewares);
@@ -59,6 +59,7 @@ const fastifySsrPlugin = async (fastify, options, done) => {
59
59
  // })
60
60
  if (!('use' in fastify)) {
61
61
  const middie = (await import('@fastify/middie')).default;
62
+ // @ts-ignore
62
63
  await fastify.register(middie);
63
64
  }
64
65
  fastify.use(vite.middlewares);
package/dist/index.js CHANGED
@@ -9,7 +9,6 @@ import { readFileSync } from 'fs';
9
9
  import builtinModules from 'builtin-modules';
10
10
  import { visualizer } from 'rollup-plugin-visualizer';
11
11
  import { resolve } from './app-urls.js';
12
- import envPlugin from '@vitrify/plugin-env';
13
12
  import { addOrReplaceTitle, appendToBody } from './helpers/utils.js';
14
13
  import Components from 'unplugin-vue-components/vite';
15
14
  const internalServerModules = [
@@ -204,6 +203,8 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
204
203
  ({ productName } = JSON.parse(readFileSync(new URL('package.json', appDir).pathname, {
205
204
  encoding: 'utf-8'
206
205
  })));
206
+ if (!productName)
207
+ productName = vitrifyConfig.vitrify?.productName;
207
208
  }
208
209
  catch (e) {
209
210
  console.error('package.json not found');
@@ -266,7 +267,6 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
266
267
  }
267
268
  },
268
269
  vuePlugin(),
269
- envPlugin(),
270
270
  ...frameworkPlugins,
271
271
  {
272
272
  name: 'vitrify-setup',
@@ -335,7 +335,9 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
335
335
  const varName = url.pathname
336
336
  .replaceAll('/', '')
337
337
  .replaceAll('.', '')
338
- .replaceAll('-', '');
338
+ .replaceAll('-', '')
339
+ .replaceAll('_', '')
340
+ .replaceAll('+', '');
339
341
  return `import ${varName} from '${url.pathname}'; onSetup.push(${varName})`;
340
342
  })
341
343
  .join('\n')}`;
@@ -12,4 +12,4 @@ export interface FastifySsrOptions {
12
12
  }
13
13
  declare const fastifyCsrPlugin: FastifyPluginCallback<FastifySsrOptions>;
14
14
  export { fastifyCsrPlugin };
15
- export declare type FastifyCsrPlugin = typeof fastifyCsrPlugin;
15
+ export type FastifyCsrPlugin = typeof fastifyCsrPlugin;
@@ -16,4 +16,4 @@ export interface FastifySsrOptions {
16
16
  }
17
17
  declare const fastifySsrPlugin: FastifyPluginCallback<FastifySsrOptions>;
18
18
  export { fastifySsrPlugin };
19
- export declare type FastifySsrPlugin = typeof fastifySsrPlugin;
19
+ export type FastifySsrPlugin = typeof fastifySsrPlugin;
@@ -1,5 +1,5 @@
1
1
  import type { Plugin } from 'vite';
2
- export declare type VitrifyPlugin = ({ ssr, mode, command }: {
2
+ export type VitrifyPlugin = ({ ssr, mode, command }: {
3
3
  ssr?: 'server' | 'client' | 'ssg' | 'fastify' | false;
4
4
  pwa?: boolean;
5
5
  mode?: 'production' | 'development';
@@ -2,21 +2,21 @@ import type { Alias, UserConfig } from 'vite';
2
2
  import type { QuasarConf } from './plugins/quasar.js';
3
3
  import type { ComponentInternalInstance } from '@vue/runtime-core';
4
4
  import type { FastifyServerOptions } from 'fastify';
5
- export declare type BootFunction = ({ app, ssrContext, staticImports }: {
5
+ export type BootFunction = ({ app, ssrContext, staticImports }: {
6
6
  app: any;
7
7
  ssrContext: Record<string, unknown>;
8
8
  staticImports: Record<string, any>;
9
9
  }) => Promise<void> | void;
10
- export declare type OnBootHook = ({ app, ssrContext, staticImports }: {
10
+ export type OnBootHook = ({ app, ssrContext, staticImports }: {
11
11
  app: any;
12
12
  ssrContext: Record<string, unknown>;
13
13
  staticImports?: Record<string, any>;
14
14
  }) => Promise<void> | void;
15
- export declare type OnMountedHook = (instance: ComponentInternalInstance) => Promise<void> | void;
16
- export declare type StaticImports = Record<string, string[]>;
17
- export declare type SsrFunction = (html: string, ssrContext: Record<string, any>) => string;
18
- export declare type OnRenderedHook = (html: string, ssrContext: Record<string, any>) => string;
19
- export declare type OnSetupFile = URL;
15
+ export type OnMountedHook = (instance: ComponentInternalInstance) => Promise<void> | void;
16
+ export type StaticImports = Record<string, string[]>;
17
+ export type SsrFunction = (html: string, ssrContext: Record<string, any>) => string;
18
+ export type OnRenderedHook = (html: string, ssrContext: Record<string, any>) => string;
19
+ export type OnSetupFile = URL;
20
20
  export interface VitrifyConfig extends UserConfig {
21
21
  vitrify?: {
22
22
  lang?: string;
@@ -88,5 +88,5 @@ export interface VitrifyConfig extends UserConfig {
88
88
  };
89
89
  quasar?: QuasarConf;
90
90
  }
91
- export declare type VitrifyConfigAsync = VitrifyConfig | ((mode: string, command: string) => Promise<VitrifyConfig>);
91
+ export type VitrifyConfigAsync = VitrifyConfig | ((mode: string, command: string) => Promise<VitrifyConfig>);
92
92
  export declare const defineConfig: (config: VitrifyConfig) => VitrifyConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitrify",
3
- "version": "0.11.3",
3
+ "version": "0.11.4",
4
4
  "license": "MIT",
5
5
  "author": "Stefan van Herwijnen",
6
6
  "description": "Vite as your Full Stack development tool",
@@ -52,7 +52,6 @@
52
52
  "@fastify/static": "^6.5.0",
53
53
  "@quasar/extras": "^1.15.2",
54
54
  "@vitejs/plugin-vue": "^3.1.0",
55
- "@vitrify/plugin-env": "^0.1.1",
56
55
  "builtin-modules": "^3.3.0",
57
56
  "cac": "^6.7.14",
58
57
  "chalk": "^5.0.1",
@@ -51,6 +51,7 @@ const fastifyCsrPlugin: FastifyPluginCallback<FastifySsrOptions> = async (
51
51
  console.log('Dev mode')
52
52
  if (!('use' in fastify)) {
53
53
  const middie = (await import('@fastify/middie')).default
54
+ // @ts-ignore
54
55
  await fastify.register(middie)
55
56
  }
56
57
  fastify.use(vite.middlewares)
@@ -98,6 +98,7 @@ const fastifySsrPlugin: FastifyPluginCallback<FastifySsrOptions> = async (
98
98
 
99
99
  if (!('use' in fastify)) {
100
100
  const middie = (await import('@fastify/middie')).default
101
+ // @ts-ignore
101
102
  await fastify.register(middie)
102
103
  }
103
104
  fastify.use(vite.middlewares)
package/src/node/index.ts CHANGED
@@ -22,7 +22,6 @@ import type { VitrifyContext } from './bin/run.js'
22
22
  import type { VitrifyPlugin } from './plugins/index.js'
23
23
  import { resolve } from './app-urls.js'
24
24
  import type { ManualChunksOption, RollupOptions } from 'rollup'
25
- import envPlugin from '@vitrify/plugin-env'
26
25
  import { addOrReplaceTitle, appendToBody } from './helpers/utils.js'
27
26
  import type { ComponentResolver } from 'unplugin-vue-components'
28
27
  import Components from 'unplugin-vue-components/vite'
@@ -281,6 +280,7 @@ export const baseConfig = async ({
281
280
  encoding: 'utf-8'
282
281
  })
283
282
  ))
283
+ if (!productName) productName = vitrifyConfig.vitrify?.productName
284
284
  } catch (e) {
285
285
  console.error('package.json not found')
286
286
  productName = 'Product name'
@@ -353,7 +353,6 @@ export const baseConfig = async ({
353
353
  }
354
354
  },
355
355
  vuePlugin(),
356
- envPlugin(),
357
356
  ...frameworkPlugins,
358
357
  {
359
358
  name: 'vitrify-setup',
@@ -422,6 +421,8 @@ export const baseConfig = async ({
422
421
  .replaceAll('/', '')
423
422
  .replaceAll('.', '')
424
423
  .replaceAll('-', '')
424
+ .replaceAll('_', '')
425
+ .replaceAll('+', '')
425
426
  return `import ${varName} from '${url.pathname}'; onSetup.push(${varName})`
426
427
  })
427
428
  .join('\n')}`