vitrify 0.6.17 → 0.6.18

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
@@ -70,7 +70,6 @@ cli
70
70
  outDir: new URL('ssr/server/', baseOutDir).pathname
71
71
  });
72
72
  ({ prerender, onRendered } = await import(new URL('ssr/server/prerender.mjs', baseOutDir).pathname));
73
- console.log(onRendered);
74
73
  prerender({
75
74
  outDir: new URL('static/', baseOutDir).pathname,
76
75
  templatePath: new URL('static/index.html', baseOutDir).pathname,
package/dist/index.js CHANGED
@@ -54,8 +54,8 @@ const manualChunks = (id) => {
54
54
  };
55
55
  export const VIRTUAL_MODULES = [
56
56
  'virtual:vitrify-hooks',
57
- 'virtual:global-css',
58
57
  'virtual:static-imports',
58
+ 'virtual:vitrify-config',
59
59
  'vitrify.sass',
60
60
  'vitrify.css'
61
61
  ];
@@ -237,21 +237,28 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
237
237
  globalSass = config.vitrify?.sass?.global || [];
238
238
  additionalData = config.vitrify?.sass?.additionalData || [];
239
239
  return {
240
- css: {
241
- preprocessorOptions: {
242
- // sass: {
243
- // additionalData: [
244
- // ...Object.entries(sassVariables).map(
245
- // ([key, value]) => `${key}: ${value}`
246
- // )
247
- // // ...additionalData
248
- // // config.css?.preprocessorOptions?.sass.additionalData
249
- // ].join('\n')
250
- // }
251
- }
252
- }
240
+ // css: {
241
+ // preprocessorOptions: {
242
+ // sass: {
243
+ // additionalData: [
244
+ // ...Object.entries(sassVariables).map(
245
+ // ([key, value]) => `${key}: ${value}`
246
+ // )
247
+ // // ...additionalData
248
+ // // config.css?.preprocessorOptions?.sass.additionalData
249
+ // ].join('\n')
250
+ // }
251
+ // }
252
+ // }
253
253
  };
254
254
  },
255
+ configureServer(server) {
256
+ server.middlewares.use('/', (req, res, next) => {
257
+ if (req.url?.endsWith('.html'))
258
+ req.url = req.url.replace('.html', '');
259
+ next();
260
+ });
261
+ },
255
262
  configResolved: (config) => {
256
263
  if (process.env.DEBUG) {
257
264
  console.log(config.css?.preprocessorOptions?.sass.additionalData);
@@ -310,7 +317,10 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
310
317
  ].join('\n');
311
318
  }
312
319
  else if (id === 'vitrify.css') {
313
- return `${globalCss.map((css) => `import '${css}'`).join('\n')}`;
320
+ return `${globalCss.map((css) => `@import '${css}'`).join('\n')}`;
321
+ }
322
+ else if (id === 'virtual:vitrify-config') {
323
+ return `export default ${JSON.stringify(vitrifyConfig)}`;
314
324
  }
315
325
  return null;
316
326
  }
@@ -31,6 +31,7 @@ export const injectSsrContext = (html, ssrContext) => html
31
31
  });
32
32
  export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
33
33
  let plugins = [];
34
+ let quasarConf;
34
35
  return [
35
36
  Components({
36
37
  resolvers: [QuasarResolver()]
@@ -76,9 +77,13 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
76
77
  const quasarPlugins = await import('virtual:quasar-plugins');
77
78
  // @ts-ignore
78
79
  const directives = await import('virtual:quasar-directives');
80
+ // @ts-ignore
81
+ const { default: lang } = await import('virtual:quasar-lang');
82
+ console.log(lang);
79
83
  app.use(staticImports?.Quasar, {
80
84
  plugins: quasarPlugins,
81
- directives
85
+ directives,
86
+ lang
82
87
  }, ssrContext);
83
88
  }
84
89
  ];
@@ -106,7 +111,11 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
106
111
  name: 'vite-plugin-quasar',
107
112
  enforce: 'post',
108
113
  config: async (config, env) => {
109
- const { quasar: quasarConf, vitrify: { urls } = {} } = config;
114
+ const { quasar, vitrify: { urls } = {} } = config;
115
+ if (quasar)
116
+ quasarConf = quasar;
117
+ if (!quasarConf.framework.lang && config.vitrify?.lang)
118
+ quasarConf.framework.lang = config.vitrify.lang;
110
119
  // const quasarPkgJsonPath = new URL(
111
120
  // 'package.json',
112
121
  // urls?.packages?.quasar
@@ -244,6 +253,8 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
244
253
  return 'virtual:quasar-plugins';
245
254
  case 'virtual:quasar-directives':
246
255
  return 'virtual:quasar-directives';
256
+ case 'virtual:quasar-lang':
257
+ return 'virtual:quasar-lang';
247
258
  case 'virtual:quasar':
248
259
  return { id: 'virtual:quasar', moduleSideEffects: false };
249
260
  default:
@@ -257,6 +268,10 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
257
268
  else if (id === 'virtual:quasar-directives') {
258
269
  return `export * from 'quasar/src/directives.js'`;
259
270
  }
271
+ else if (id === 'virtual:quasar-lang') {
272
+ return `import lang from 'quasar/lang/${quasarConf?.framework?.lang || 'en-US'}';
273
+ export default lang`;
274
+ }
260
275
  else if (id === 'virtual:quasar') {
261
276
  return `export * from 'quasar/src/plugins.js';
262
277
  export * from 'quasar/src/components.js';
@@ -7,6 +7,7 @@ export interface QuasarConf {
7
7
  components?: string[];
8
8
  directives?: string[];
9
9
  plugins?: string[];
10
+ lang?: string;
10
11
  };
11
12
  animations: string[];
12
13
  extras: string[];
@@ -18,6 +18,7 @@ export declare type OnRenderedHook = (html: string, ssrContext: Record<string, a
18
18
  export declare type OnSetupFile = URL;
19
19
  export interface VitrifyConfig extends UserConfig {
20
20
  vitrify?: {
21
+ lang?: string;
21
22
  /**
22
23
  * Global CSS imports
23
24
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitrify",
3
- "version": "0.6.17",
3
+ "version": "0.6.18",
4
4
  "license": "MIT",
5
5
  "author": "Stefan van Herwijnen",
6
6
  "description": "Pre-configured Vite CLI for your framework",
@@ -88,7 +88,7 @@ cli
88
88
  ;({ prerender, onRendered } = await import(
89
89
  new URL('ssr/server/prerender.mjs', baseOutDir).pathname
90
90
  ))
91
- console.log(onRendered)
91
+
92
92
  prerender({
93
93
  outDir: new URL('static/', baseOutDir).pathname,
94
94
  templatePath: new URL('static/index.html', baseOutDir).pathname,
package/src/node/index.ts CHANGED
@@ -75,8 +75,8 @@ const manualChunks: ManualChunksOption = (id: string) => {
75
75
 
76
76
  export const VIRTUAL_MODULES = [
77
77
  'virtual:vitrify-hooks',
78
- 'virtual:global-css',
79
78
  'virtual:static-imports',
79
+ 'virtual:vitrify-config',
80
80
  'vitrify.sass',
81
81
  'vitrify.css'
82
82
  ]
@@ -312,21 +312,27 @@ export const baseConfig = async ({
312
312
  additionalData = config.vitrify?.sass?.additionalData || []
313
313
 
314
314
  return {
315
- css: {
316
- preprocessorOptions: {
317
- // sass: {
318
- // additionalData: [
319
- // ...Object.entries(sassVariables).map(
320
- // ([key, value]) => `${key}: ${value}`
321
- // )
322
- // // ...additionalData
323
- // // config.css?.preprocessorOptions?.sass.additionalData
324
- // ].join('\n')
325
- // }
326
- }
327
- }
315
+ // css: {
316
+ // preprocessorOptions: {
317
+ // sass: {
318
+ // additionalData: [
319
+ // ...Object.entries(sassVariables).map(
320
+ // ([key, value]) => `${key}: ${value}`
321
+ // )
322
+ // // ...additionalData
323
+ // // config.css?.preprocessorOptions?.sass.additionalData
324
+ // ].join('\n')
325
+ // }
326
+ // }
327
+ // }
328
328
  }
329
329
  },
330
+ configureServer(server) {
331
+ server.middlewares.use('/', (req, res, next) => {
332
+ if (req.url?.endsWith('.html')) req.url = req.url.replace('.html', '')
333
+ next()
334
+ })
335
+ },
330
336
  configResolved: (config) => {
331
337
  if (process.env.DEBUG) {
332
338
  console.log(config.css?.preprocessorOptions?.sass.additionalData)
@@ -390,7 +396,9 @@ export const baseConfig = async ({
390
396
  ...globalSass.map((sass) => `@import '${sass}'`)
391
397
  ].join('\n')
392
398
  } else if (id === 'vitrify.css') {
393
- return `${globalCss.map((css) => `import '${css}'`).join('\n')}`
399
+ return `${globalCss.map((css) => `@import '${css}'`).join('\n')}`
400
+ } else if (id === 'virtual:vitrify-config') {
401
+ return `export default ${JSON.stringify(vitrifyConfig)}`
394
402
  }
395
403
  return null
396
404
  }
@@ -25,6 +25,7 @@ export interface QuasarConf {
25
25
  components?: string[]
26
26
  directives?: string[]
27
27
  plugins?: string[]
28
+ lang?: string
28
29
  }
29
30
  animations: string[]
30
31
  extras: string[]
@@ -83,6 +84,7 @@ export const QuasarPlugin: VitrifyPlugin = async ({
83
84
  pwa = false
84
85
  }): Promise<Plugin[]> => {
85
86
  let plugins: string[] = []
87
+ let quasarConf: QuasarConf
86
88
  return [
87
89
  Components({
88
90
  resolvers: [QuasarResolver()]
@@ -148,12 +150,15 @@ export const QuasarPlugin: VitrifyPlugin = async ({
148
150
  const quasarPlugins = await import('virtual:quasar-plugins')
149
151
  // @ts-ignore
150
152
  const directives = await import('virtual:quasar-directives')
151
-
153
+ // @ts-ignore
154
+ const { default: lang } = await import('virtual:quasar-lang')
155
+ console.log(lang)
152
156
  app.use(
153
157
  staticImports?.Quasar,
154
158
  {
155
159
  plugins: quasarPlugins,
156
- directives
160
+ directives,
161
+ lang
157
162
  },
158
163
  ssrContext
159
164
  )
@@ -184,8 +189,10 @@ export const QuasarPlugin: VitrifyPlugin = async ({
184
189
  name: 'vite-plugin-quasar',
185
190
  enforce: 'post',
186
191
  config: async (config: VitrifyConfig, env) => {
187
- const { quasar: quasarConf, vitrify: { urls } = {} } = config
188
-
192
+ const { quasar, vitrify: { urls } = {} } = config
193
+ if (quasar) quasarConf = quasar
194
+ if (!quasarConf.framework.lang && config.vitrify?.lang)
195
+ quasarConf.framework.lang = config.vitrify.lang
189
196
  // const quasarPkgJsonPath = new URL(
190
197
  // 'package.json',
191
198
  // urls?.packages?.quasar
@@ -327,6 +334,8 @@ export const QuasarPlugin: VitrifyPlugin = async ({
327
334
  return 'virtual:quasar-plugins'
328
335
  case 'virtual:quasar-directives':
329
336
  return 'virtual:quasar-directives'
337
+ case 'virtual:quasar-lang':
338
+ return 'virtual:quasar-lang'
330
339
  case 'virtual:quasar':
331
340
  return { id: 'virtual:quasar', moduleSideEffects: false }
332
341
  default:
@@ -338,6 +347,11 @@ export const QuasarPlugin: VitrifyPlugin = async ({
338
347
  return `export { ${plugins.join(',')} } from 'quasar'`
339
348
  } else if (id === 'virtual:quasar-directives') {
340
349
  return `export * from 'quasar/src/directives.js'`
350
+ } else if (id === 'virtual:quasar-lang') {
351
+ return `import lang from 'quasar/lang/${
352
+ quasarConf?.framework?.lang || 'en-US'
353
+ }';
354
+ export default lang`
341
355
  } else if (id === 'virtual:quasar') {
342
356
  return `export * from 'quasar/src/plugins.js';
343
357
  export * from 'quasar/src/components.js';
@@ -39,6 +39,7 @@ export type OnRenderedHook = (
39
39
  export type OnSetupFile = URL
40
40
  export interface VitrifyConfig extends UserConfig {
41
41
  vitrify?: {
42
+ lang?: string
42
43
  /**
43
44
  * Global CSS imports
44
45
  */
@@ -49,7 +49,7 @@ export async function createApp(
49
49
  // Workaround to fix hydration errors when serving html files directly
50
50
  router.beforeEach((to, from, next) => {
51
51
  if (to.path.endsWith('.html')) {
52
- next({ path: to.path.replace('.html', '') })
52
+ return next({ path: to.path.replace('.html', '') })
53
53
  }
54
54
 
55
55
  next()