vitrify 0.6.17 → 0.7.1
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 +0 -1
- package/dist/bin/dev.js +4 -2
- package/dist/frameworks/vue/server.js +5 -5
- package/dist/index.js +41 -130
- package/dist/plugins/quasar.js +31 -108
- package/dist/types/bin/dev.d.ts +3 -4
- package/dist/types/frameworks/vue/server.d.ts +2 -2
- package/dist/types/plugins/quasar.d.ts +1 -0
- package/dist/types/vitrify-config.d.ts +3 -0
- package/package.json +21 -21
- package/src/node/bin/cli.ts +1 -1
- package/src/node/bin/dev.ts +7 -7
- package/src/node/frameworks/vue/server.ts +6 -6
- package/src/node/index.ts +40 -140
- package/src/node/plugins/quasar.ts +32 -115
- package/src/node/vitrify-config.ts +3 -0
- package/src/vite/fastify/entry.ts +1 -0
- package/src/vite/fastify/server.ts +3 -2
- package/src/vite/vue/main.ts +1 -1
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/bin/dev.js
CHANGED
|
@@ -77,15 +77,17 @@ ssr, framework = 'vue', host, appDir, publicDir }) {
|
|
|
77
77
|
let setup;
|
|
78
78
|
let server;
|
|
79
79
|
let onRendered;
|
|
80
|
+
let vitrifyConfig;
|
|
80
81
|
console.log(`Development mode: ${ssr ? ssr : 'csr'}`);
|
|
81
82
|
if (ssr) {
|
|
82
83
|
const entryUrl = ssr === 'fastify'
|
|
83
84
|
? new URL('src/vite/fastify/entry.ts', cliDir).pathname
|
|
84
85
|
: new URL(`src/vite/${framework}/ssr/app.ts`, cliDir).pathname;
|
|
85
|
-
({ setup, onRendered } = await vite.ssrLoadModule(entryUrl));
|
|
86
|
+
({ setup, onRendered, vitrifyConfig } = await vite.ssrLoadModule(entryUrl));
|
|
86
87
|
const app = fastify({
|
|
87
88
|
logger: false,
|
|
88
|
-
https: vite.config.server.https
|
|
89
|
+
https: vite.config.server.https,
|
|
90
|
+
...vitrifyConfig.vitrify?.ssr?.fastify
|
|
89
91
|
});
|
|
90
92
|
if (process.env)
|
|
91
93
|
process.env.MODE = 'development';
|
|
@@ -10,10 +10,10 @@ export const createApp = ({ onSetup, appDir, baseUrl, fastifyPlugin, onRendered,
|
|
|
10
10
|
onRendered,
|
|
11
11
|
mode
|
|
12
12
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
if (onSetup?.length) {
|
|
14
|
+
for (const setup of onSetup) {
|
|
15
|
+
setup(app);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
18
|
return app;
|
|
19
19
|
};
|
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
|
];
|
|
@@ -169,12 +169,6 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
169
169
|
catch (e) {
|
|
170
170
|
console.error('package.json not found');
|
|
171
171
|
}
|
|
172
|
-
const ssrTransformCustomDir = () => {
|
|
173
|
-
return {
|
|
174
|
-
props: [],
|
|
175
|
-
needRuntime: true
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
172
|
const frameworkPlugins = [];
|
|
179
173
|
for (const framework of Object.keys(configPluginMap)) {
|
|
180
174
|
if (Object.keys(vitrifyConfig).includes(framework)) {
|
|
@@ -189,7 +183,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
189
183
|
let onRenderedHooks;
|
|
190
184
|
let onMountedHooks;
|
|
191
185
|
let onSetupFiles;
|
|
192
|
-
let globalCss;
|
|
186
|
+
let globalCss = [];
|
|
193
187
|
let staticImports;
|
|
194
188
|
let sassVariables;
|
|
195
189
|
let additionalData;
|
|
@@ -201,32 +195,12 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
201
195
|
...vitrifyConfig.vitrify.ssr.serverModules
|
|
202
196
|
];
|
|
203
197
|
const plugins = [
|
|
204
|
-
vuePlugin(
|
|
205
|
-
// compiler: await import('vue/compiler-sfc'),
|
|
206
|
-
// template: {
|
|
207
|
-
// ssr: !!ssr,
|
|
208
|
-
// compilerOptions: {
|
|
209
|
-
// directiveTransforms: {
|
|
210
|
-
// 'close-popup': ssrTransformCustomDir,
|
|
211
|
-
// intersection: ssrTransformCustomDir,
|
|
212
|
-
// ripple: ssrTransformCustomDir,
|
|
213
|
-
// mutation: ssrTransformCustomDir,
|
|
214
|
-
// morph: ssrTransformCustomDir,
|
|
215
|
-
// scroll: ssrTransformCustomDir,
|
|
216
|
-
// 'scroll-fire': ssrTransformCustomDir,
|
|
217
|
-
// 'touch-hold': ssrTransformCustomDir,
|
|
218
|
-
// 'touch-pan': ssrTransformCustomDir,
|
|
219
|
-
// 'touch-repeat': ssrTransformCustomDir,
|
|
220
|
-
// 'touch-swipe': ssrTransformCustomDir
|
|
221
|
-
// }
|
|
222
|
-
// }
|
|
223
|
-
// }
|
|
224
|
-
}),
|
|
198
|
+
vuePlugin(),
|
|
225
199
|
...frameworkPlugins,
|
|
226
200
|
{
|
|
227
201
|
name: 'vitrify-setup',
|
|
228
202
|
enforce: 'post',
|
|
229
|
-
config:
|
|
203
|
+
config: (config, env) => {
|
|
230
204
|
onBootHooks = config.vitrify?.hooks?.onBoot || [];
|
|
231
205
|
onRenderedHooks = config.vitrify?.hooks?.onRendered || [];
|
|
232
206
|
onMountedHooks = config.vitrify?.hooks?.onMounted || [];
|
|
@@ -236,26 +210,18 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
236
210
|
sassVariables = config.vitrify?.sass?.variables || {};
|
|
237
211
|
globalSass = config.vitrify?.sass?.global || [];
|
|
238
212
|
additionalData = config.vitrify?.sass?.additionalData || [];
|
|
239
|
-
return
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
// // ...additionalData
|
|
248
|
-
// // config.css?.preprocessorOptions?.sass.additionalData
|
|
249
|
-
// ].join('\n')
|
|
250
|
-
// }
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
};
|
|
213
|
+
return;
|
|
214
|
+
},
|
|
215
|
+
configureServer(server) {
|
|
216
|
+
server.middlewares.use('/', (req, res, next) => {
|
|
217
|
+
if (req.url?.endsWith('.html'))
|
|
218
|
+
req.url = req.url.replace('.html', '');
|
|
219
|
+
next();
|
|
220
|
+
});
|
|
254
221
|
},
|
|
255
222
|
configResolved: (config) => {
|
|
256
223
|
if (process.env.DEBUG) {
|
|
257
|
-
console.log(config
|
|
258
|
-
console.log(config.optimizeDeps);
|
|
224
|
+
console.log(config);
|
|
259
225
|
}
|
|
260
226
|
},
|
|
261
227
|
resolveId(id) {
|
|
@@ -283,24 +249,21 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
283
249
|
.join(', ')}]
|
|
284
250
|
export const onSetup = []
|
|
285
251
|
${onSetupFiles
|
|
286
|
-
.map((url, index) =>
|
|
287
|
-
.
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
252
|
+
.map((url, index) => {
|
|
253
|
+
const varName = url.pathname
|
|
254
|
+
.replaceAll('/', '')
|
|
255
|
+
.replaceAll('.', '')
|
|
256
|
+
.replaceAll('-', '');
|
|
257
|
+
return `import ${varName} from '${url.pathname}'; onSetup.push(${varName})`;
|
|
258
|
+
})
|
|
291
259
|
.join('\n')}`;
|
|
292
|
-
// export const onSetup = [${onSetupHooks
|
|
293
|
-
// .map((fn) => `${String(fn)}`)
|
|
294
|
-
// .join(', ')}]`
|
|
295
|
-
/**
|
|
296
|
-
* CSS imports in virtual files do not seem to work. Using transform() instead
|
|
297
|
-
*/
|
|
298
|
-
// } else if (id === 'virtual:global-css') {
|
|
299
|
-
// return `${globalCss.map((css) => `import '${css}'`).join('\n')}`
|
|
300
260
|
}
|
|
301
261
|
else if (id === 'virtual:static-imports') {
|
|
302
262
|
return `${Object.entries(staticImports)
|
|
303
|
-
.map(([key, value]) =>
|
|
263
|
+
.map(([key, value]) => {
|
|
264
|
+
const deduped = [...new Set(value)];
|
|
265
|
+
return `export { ${deduped.join(',')} } from '${key}';`;
|
|
266
|
+
})
|
|
304
267
|
.join('\n')}`;
|
|
305
268
|
}
|
|
306
269
|
else if (id === 'vitrify.sass') {
|
|
@@ -310,7 +273,10 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
310
273
|
].join('\n');
|
|
311
274
|
}
|
|
312
275
|
else if (id === 'vitrify.css') {
|
|
313
|
-
return `${globalCss.map((css) =>
|
|
276
|
+
return `${globalCss.map((css) => `@import '${css}'`).join('\n')}`;
|
|
277
|
+
}
|
|
278
|
+
else if (id === 'virtual:vitrify-config') {
|
|
279
|
+
return `export default ${JSON.stringify(vitrifyConfig)}`;
|
|
314
280
|
}
|
|
315
281
|
return null;
|
|
316
282
|
}
|
|
@@ -320,16 +286,16 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
320
286
|
plugins.unshift({
|
|
321
287
|
name: 'html-transform',
|
|
322
288
|
enforce: 'pre',
|
|
323
|
-
transform: (code, id) => {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
// do not remove, required for additionalData import
|
|
329
|
-
</style
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
},
|
|
289
|
+
// transform: (code, id) => {
|
|
290
|
+
// if (id.endsWith('App.vue')) {
|
|
291
|
+
// code =
|
|
292
|
+
// code +
|
|
293
|
+
// `<style lang="sass">
|
|
294
|
+
// // do not remove, required for additionalData import
|
|
295
|
+
// </style>`
|
|
296
|
+
// }
|
|
297
|
+
// return code
|
|
298
|
+
// },
|
|
333
299
|
transformIndexHtml: {
|
|
334
300
|
enforce: 'pre',
|
|
335
301
|
transform: (html) => {
|
|
@@ -360,6 +326,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
360
326
|
config: (config, env) => {
|
|
361
327
|
if (config.vitrify?.productName)
|
|
362
328
|
productName = config.vitrify?.productName;
|
|
329
|
+
return;
|
|
363
330
|
},
|
|
364
331
|
transformIndexHtml: {
|
|
365
332
|
enforce: 'post',
|
|
@@ -386,17 +353,10 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
386
353
|
find: new RegExp('^vue$'),
|
|
387
354
|
replacement: new URL('./dist/vue.runtime.esm-bundler.js', packageUrls['vue']).pathname
|
|
388
355
|
},
|
|
389
|
-
// {
|
|
390
|
-
// find: new RegExp('^vue/server-renderer$'),
|
|
391
|
-
// replacement: 'vue/server-renderer/index.mjs'
|
|
392
|
-
// },
|
|
393
356
|
{
|
|
394
357
|
find: new RegExp('^vue-router$'),
|
|
395
358
|
replacement: new URL('./dist/vue-router.esm-bundler.js', packageUrls['vue-router']).pathname
|
|
396
359
|
}
|
|
397
|
-
// { find: 'vue', replacement: packageUrls['vue'].pathname },
|
|
398
|
-
// { find: 'vue-router', replacement: packageUrls['vue-router'].pathname },
|
|
399
|
-
// { find: 'vitrify', replacement: cliDir.pathname }
|
|
400
360
|
];
|
|
401
361
|
if (mode === 'development' && vitrifyConfig.vitrify?.dev?.alias)
|
|
402
362
|
alias.push(...vitrifyConfig.vitrify.dev.alias);
|
|
@@ -420,25 +380,16 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
420
380
|
],
|
|
421
381
|
external,
|
|
422
382
|
output: {
|
|
423
|
-
minifyInternalExports:
|
|
383
|
+
minifyInternalExports: false,
|
|
424
384
|
entryFileNames: '[name].mjs',
|
|
425
385
|
chunkFileNames: '[name].mjs',
|
|
426
386
|
format: 'es',
|
|
427
387
|
manualChunks
|
|
428
|
-
// manualChunks: (id) => {
|
|
429
|
-
// if (id.includes('vitrify/src/vite/')) {
|
|
430
|
-
// const name = id.split('/').at(-1)?.split('.').at(0)
|
|
431
|
-
// if (name && manualChunks.includes(name)) return name
|
|
432
|
-
// } else if (id.includes('node_modules')) {
|
|
433
|
-
// return 'vendor'
|
|
434
|
-
// }
|
|
435
|
-
// }
|
|
436
388
|
}
|
|
437
389
|
};
|
|
438
390
|
// Create a SSR bundle
|
|
439
391
|
noExternal = [
|
|
440
392
|
new RegExp(`^(?!(${[...builtinModules, ...serverModules].join('|')}))`)
|
|
441
|
-
// new RegExp(`^(?!.*(${[...builtinModules, ...serverModules].join('|')}))`)
|
|
442
393
|
];
|
|
443
394
|
}
|
|
444
395
|
else if (ssr === 'fastify') {
|
|
@@ -452,14 +403,6 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
452
403
|
chunkFileNames: '[name].mjs',
|
|
453
404
|
format: 'es',
|
|
454
405
|
manualChunks
|
|
455
|
-
// manualChunks: (id) => {
|
|
456
|
-
// if (id.includes('vitrify/src/vite/')) {
|
|
457
|
-
// const name = id.split('/').at(-1)?.split('.').at(0)
|
|
458
|
-
// if (name && manualChunks.includes(name)) return name
|
|
459
|
-
// } else if (id.includes('node_modules')) {
|
|
460
|
-
// return 'vendor'
|
|
461
|
-
// }
|
|
462
|
-
// }
|
|
463
406
|
}
|
|
464
407
|
};
|
|
465
408
|
// Create a SSR bundle
|
|
@@ -470,13 +413,9 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
470
413
|
else {
|
|
471
414
|
rollupOptions = {
|
|
472
415
|
...rollupOptions,
|
|
473
|
-
// input: [
|
|
474
|
-
// new URL('index.html', frameworkDir).pathname
|
|
475
|
-
// // new URL('csr/server.ts', frameworkDir).pathname
|
|
476
|
-
// ],
|
|
477
416
|
external,
|
|
478
417
|
output: {
|
|
479
|
-
minifyInternalExports:
|
|
418
|
+
minifyInternalExports: false,
|
|
480
419
|
entryFileNames: '[name].mjs',
|
|
481
420
|
chunkFileNames: '[name].mjs',
|
|
482
421
|
format: 'es',
|
|
@@ -485,7 +424,6 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
485
424
|
};
|
|
486
425
|
}
|
|
487
426
|
const config = {
|
|
488
|
-
// root: ssr === 'fastify' ? appDir.pathname : frameworkDir.pathname,
|
|
489
427
|
root: appDir.pathname,
|
|
490
428
|
publicDir: publicDir.pathname,
|
|
491
429
|
base,
|
|
@@ -513,33 +451,6 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
513
451
|
ssr: ssr === 'server' || ssr === 'fastify' ? true : false,
|
|
514
452
|
ssrManifest: ssr === 'client' || ssr === 'ssg',
|
|
515
453
|
rollupOptions
|
|
516
|
-
// ssr === 'server'
|
|
517
|
-
// ? {
|
|
518
|
-
// input: [
|
|
519
|
-
// new URL('ssr/entry-server.ts', frameworkDir).pathname,
|
|
520
|
-
// new URL('ssr/prerender.ts', frameworkDir).pathname,
|
|
521
|
-
// new URL('ssr/server.ts', frameworkDir).pathname
|
|
522
|
-
// ],
|
|
523
|
-
// output: {
|
|
524
|
-
// minifyInternalExports: false,
|
|
525
|
-
// entryFileNames: '[name].mjs',
|
|
526
|
-
// chunkFileNames: '[name].mjs',
|
|
527
|
-
// format: 'es',
|
|
528
|
-
// manualChunks: (id) => {
|
|
529
|
-
// if (id.includes('vitrify/src/vite/')) {
|
|
530
|
-
// const name = id.split('/').at(-1)?.split('.').at(0)
|
|
531
|
-
// if (name && manualChunks.includes(name)) return name
|
|
532
|
-
// } else if (id.includes('node_modules')) {
|
|
533
|
-
// return 'vendor'
|
|
534
|
-
// }
|
|
535
|
-
// }
|
|
536
|
-
// }
|
|
537
|
-
// }
|
|
538
|
-
// : {
|
|
539
|
-
// output: {
|
|
540
|
-
// format: 'es'
|
|
541
|
-
// }
|
|
542
|
-
// }
|
|
543
454
|
},
|
|
544
455
|
ssr: {
|
|
545
456
|
// Create a SSR bundle
|
package/dist/plugins/quasar.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { resolvePackageData } from 'vite';
|
|
2
2
|
import Components from 'unplugin-vue-components/vite';
|
|
3
|
-
// import { quasarDir as defaultQuasarDir } from '../app-urls.js'
|
|
4
|
-
// import { QuasarResolver } from '../resolver.js';
|
|
5
3
|
import { QuasarResolver } from 'unplugin-vue-components/resolvers';
|
|
6
4
|
export const injectSsrContext = (html, ssrContext) => html
|
|
7
5
|
.replace(/(<html[^>]*)(>)/i, (found, start, end) => {
|
|
@@ -31,6 +29,7 @@ export const injectSsrContext = (html, ssrContext) => html
|
|
|
31
29
|
});
|
|
32
30
|
export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
33
31
|
let plugins = [];
|
|
32
|
+
let quasarConf;
|
|
34
33
|
return [
|
|
35
34
|
Components({
|
|
36
35
|
resolvers: [QuasarResolver()]
|
|
@@ -76,47 +75,19 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
76
75
|
const quasarPlugins = await import('virtual:quasar-plugins');
|
|
77
76
|
// @ts-ignore
|
|
78
77
|
const directives = await import('virtual:quasar-directives');
|
|
78
|
+
// @ts-ignore
|
|
79
|
+
const { default: lang } = await import('virtual:quasar-lang');
|
|
79
80
|
app.use(staticImports?.Quasar, {
|
|
80
81
|
plugins: quasarPlugins,
|
|
81
|
-
directives
|
|
82
|
+
directives,
|
|
83
|
+
lang
|
|
82
84
|
}, ssrContext);
|
|
83
85
|
}
|
|
84
86
|
];
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
staticImports: {
|
|
90
|
-
quasar: ['Quasar']
|
|
91
|
-
},
|
|
92
|
-
hooks: {
|
|
93
|
-
onBoot: onBootHooks,
|
|
94
|
-
onMounted: onMountedHooks,
|
|
95
|
-
onRendered: [injectSsrContext]
|
|
96
|
-
},
|
|
97
|
-
sass: {
|
|
98
|
-
global: ['quasar/src/css/index.sass']
|
|
99
|
-
// additionalData: [`@import 'quasar/src/css/index.sass'`]
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
name: 'vite-plugin-quasar',
|
|
107
|
-
enforce: 'post',
|
|
108
|
-
config: async (config, env) => {
|
|
109
|
-
const { quasar: quasarConf, vitrify: { urls } = {} } = config;
|
|
110
|
-
// const quasarPkgJsonPath = new URL(
|
|
111
|
-
// 'package.json',
|
|
112
|
-
// urls?.packages?.quasar
|
|
113
|
-
// ).pathname
|
|
114
|
-
// const { version } = JSON.parse(
|
|
115
|
-
// readFileSync(quasarPkgJsonPath, { encoding: 'utf-8' })
|
|
116
|
-
// )
|
|
117
|
-
// const { version } = await import('quasar/package.json', {
|
|
118
|
-
// assert: { type: 'json' }
|
|
119
|
-
// })
|
|
87
|
+
if (quasar)
|
|
88
|
+
quasarConf = quasar;
|
|
89
|
+
if (!quasarConf.framework.lang && config.vitrify?.lang)
|
|
90
|
+
quasarConf.framework.lang = config.vitrify.lang;
|
|
120
91
|
/**
|
|
121
92
|
* Importing package.json is problematic
|
|
122
93
|
*/
|
|
@@ -133,75 +104,28 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
133
104
|
plugins = quasarConf?.framework.plugins;
|
|
134
105
|
}
|
|
135
106
|
return {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
107
|
+
vitrify: {
|
|
108
|
+
urls,
|
|
109
|
+
globalCss,
|
|
110
|
+
staticImports: {
|
|
111
|
+
quasar: ['Quasar']
|
|
112
|
+
},
|
|
113
|
+
hooks: {
|
|
114
|
+
onBoot: onBootHooks,
|
|
115
|
+
onMounted: onMountedHooks,
|
|
116
|
+
onRendered: [injectSsrContext]
|
|
117
|
+
},
|
|
118
|
+
sass: {
|
|
119
|
+
global: ['quasar/src/css/index.sass']
|
|
120
|
+
// additionalData: [`@import 'quasar/src/css/index.sass'`]
|
|
121
|
+
}
|
|
122
|
+
},
|
|
143
123
|
resolve: {
|
|
144
|
-
// dedupe: ['quasar', '@quasar/extras'],
|
|
145
124
|
alias: [
|
|
146
|
-
// {
|
|
147
|
-
// find: 'quasar/wrappers',
|
|
148
|
-
// replacement: new URL('quasar-wrappers.ts', urls?.cli).pathname
|
|
149
|
-
// },
|
|
150
|
-
// {
|
|
151
|
-
// find: 'quasar/vue-plugin',
|
|
152
|
-
// replacement: new URL(
|
|
153
|
-
// 'src/vue-plugin.js',
|
|
154
|
-
// urls?.packages?.quasar
|
|
155
|
-
// ).pathname
|
|
156
|
-
// },
|
|
157
|
-
// {
|
|
158
|
-
// find: 'quasar/plugins',
|
|
159
|
-
// replacement: new URL('src/plugins.js', urls?.packages?.quasar)
|
|
160
|
-
// .pathname
|
|
161
|
-
// },
|
|
162
|
-
// {
|
|
163
|
-
// find: 'quasar/components',
|
|
164
|
-
// replacement: new URL(
|
|
165
|
-
// 'src/components.js',
|
|
166
|
-
// urls?.packages?.quasar
|
|
167
|
-
// ).pathname
|
|
168
|
-
// },
|
|
169
|
-
// {
|
|
170
|
-
// find: 'quasar/composables',
|
|
171
|
-
// replacement: new URL(
|
|
172
|
-
// 'src/composables.js',
|
|
173
|
-
// urls?.packages?.quasar
|
|
174
|
-
// ).pathname
|
|
175
|
-
// },
|
|
176
|
-
// {
|
|
177
|
-
// find: 'quasar/directives',
|
|
178
|
-
// replacement: new URL(
|
|
179
|
-
// 'src/directives.js',
|
|
180
|
-
// urls?.packages?.quasar
|
|
181
|
-
// ).pathname
|
|
182
|
-
// },
|
|
183
125
|
{
|
|
184
126
|
find: 'quasar/src/',
|
|
185
127
|
replacement: new URL('./src/', config.vitrify.urls.packages.quasar).pathname
|
|
186
128
|
}
|
|
187
|
-
// {
|
|
188
|
-
// find: 'quasar',
|
|
189
|
-
// replacement: new URL(
|
|
190
|
-
// 'node_modules/quasar',
|
|
191
|
-
// config.vitrify?.urls?.app
|
|
192
|
-
// )
|
|
193
|
-
// }
|
|
194
|
-
// {
|
|
195
|
-
// find: new RegExp('^quasar$'),
|
|
196
|
-
// replacement: new URL('src/index.all.js', urls?.packages?.quasar)
|
|
197
|
-
// .pathname
|
|
198
|
-
// }
|
|
199
|
-
// {
|
|
200
|
-
// find: `@quasar/extras`,
|
|
201
|
-
// replacement: new URL('.', urls?.packages?.['@quasar/extras'])
|
|
202
|
-
// .pathname
|
|
203
|
-
// }
|
|
204
|
-
// { find: new RegExp('^quasar$'), replacement: 'virtual:quasar' }
|
|
205
129
|
]
|
|
206
130
|
},
|
|
207
131
|
optimizeDeps: {
|
|
@@ -210,13 +134,6 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
210
134
|
define: {
|
|
211
135
|
__DEV__: process.env.NODE_ENV !== 'production' || true,
|
|
212
136
|
__QUASAR_VERSION__: `'${version}'`
|
|
213
|
-
// __QUASAR_SSR__: !!ssr,
|
|
214
|
-
// // __QUASAR_SSR_SERVER__: ssr === 'server',
|
|
215
|
-
// __QUASAR_SSR_SERVER__: `import.meta.env.SSR`,
|
|
216
|
-
// // __QUASAR_SSR_CLIENT__: ssr === 'client',
|
|
217
|
-
// __QUASAR_SSR_CLIENT__: `!import.meta.env.SSR`,
|
|
218
|
-
// // __QUASAR_SSR_PWA__: ssr === 'client' && pwa
|
|
219
|
-
// __QUASAR_SSR_PWA__: pwa ? `!import.meta.env.SSR` : false
|
|
220
137
|
},
|
|
221
138
|
ssr: {
|
|
222
139
|
noExternal: ['quasar']
|
|
@@ -244,6 +161,8 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
244
161
|
return 'virtual:quasar-plugins';
|
|
245
162
|
case 'virtual:quasar-directives':
|
|
246
163
|
return 'virtual:quasar-directives';
|
|
164
|
+
case 'virtual:quasar-lang':
|
|
165
|
+
return 'virtual:quasar-lang';
|
|
247
166
|
case 'virtual:quasar':
|
|
248
167
|
return { id: 'virtual:quasar', moduleSideEffects: false };
|
|
249
168
|
default:
|
|
@@ -257,6 +176,10 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
257
176
|
else if (id === 'virtual:quasar-directives') {
|
|
258
177
|
return `export * from 'quasar/src/directives.js'`;
|
|
259
178
|
}
|
|
179
|
+
else if (id === 'virtual:quasar-lang') {
|
|
180
|
+
return `import lang from 'quasar/lang/${quasarConf?.framework?.lang || 'en-US'}';
|
|
181
|
+
export default lang`;
|
|
182
|
+
}
|
|
260
183
|
else if (id === 'virtual:quasar') {
|
|
261
184
|
return `export * from 'quasar/src/plugins.js';
|
|
262
185
|
export * from 'quasar/src/components.js';
|
package/dist/types/bin/dev.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { LogLevel, InlineConfig } from 'vite';
|
|
3
|
-
import { ViteDevServer } from 'vite';
|
|
4
3
|
import type { Server } from 'net';
|
|
5
4
|
export declare function createVitrifyDevServer({ port, logLevel, ssr, framework, host, appDir, publicDir, base }: {
|
|
6
5
|
port?: number;
|
|
@@ -11,7 +10,7 @@ export declare function createVitrifyDevServer({ port, logLevel, ssr, framework,
|
|
|
11
10
|
appDir?: URL;
|
|
12
11
|
publicDir?: URL;
|
|
13
12
|
base?: string;
|
|
14
|
-
}): Promise<ViteDevServer>;
|
|
13
|
+
}): Promise<import("vite").ViteDevServer>;
|
|
15
14
|
export declare function createServer({ port, logLevel, ssr, framework, host, appDir, publicDir }: {
|
|
16
15
|
port?: number;
|
|
17
16
|
logLevel?: LogLevel;
|
|
@@ -22,7 +21,7 @@ export declare function createServer({ port, logLevel, ssr, framework, host, app
|
|
|
22
21
|
publicDir?: URL;
|
|
23
22
|
}): Promise<{
|
|
24
23
|
server: Server;
|
|
25
|
-
config: Readonly<Omit<import("vite").UserConfig, "
|
|
24
|
+
config: Readonly<Omit<import("vite").UserConfig, "plugins" | "assetsInclude" | "optimizeDeps" | "worker"> & {
|
|
26
25
|
configFile: string | undefined;
|
|
27
26
|
configFileDependencies: string[];
|
|
28
27
|
inlineConfig: InlineConfig;
|
|
@@ -42,7 +41,7 @@ export declare function createServer({ port, logLevel, ssr, framework, host, app
|
|
|
42
41
|
server: import("vite").ResolvedServerOptions;
|
|
43
42
|
build: Required<import("vite").BuildOptions>;
|
|
44
43
|
preview: import("vite").ResolvedPreviewOptions;
|
|
45
|
-
ssr: import("vite").ResolvedSSROptions
|
|
44
|
+
ssr: import("vite").ResolvedSSROptions;
|
|
46
45
|
assetsInclude: (file: string) => boolean;
|
|
47
46
|
logger: import("vite").Logger;
|
|
48
47
|
createResolver: (options?: Partial<import("vite").InternalResolveOptions> | undefined) => import("vite").ResolveFn;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { FastifyInstance } from 'fastify';
|
|
3
|
-
import type { OnRenderedHook
|
|
3
|
+
import type { OnRenderedHook } from '../../vitrify-config.js';
|
|
4
4
|
import type { FastifyCsrPlugin } from './fastify-csr-plugin.js';
|
|
5
5
|
import type { FastifySsrPlugin } from './fastify-ssr-plugin.js';
|
|
6
6
|
export declare const createApp: ({ onSetup, appDir, baseUrl, fastifyPlugin, onRendered, vitrifyDir, mode }: {
|
|
7
|
-
onSetup:
|
|
7
|
+
onSetup: ((fastify: FastifyInstance) => void)[];
|
|
8
8
|
appDir: URL;
|
|
9
9
|
baseUrl?: string | undefined;
|
|
10
10
|
fastifyPlugin: FastifySsrPlugin | FastifyCsrPlugin;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
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
|
+
import type { FastifyServerOptions } from 'fastify';
|
|
4
5
|
export declare type BootFunction = ({ app, ssrContext, staticImports }: {
|
|
5
6
|
app: any;
|
|
6
7
|
ssrContext: Record<string, unknown>;
|
|
@@ -18,6 +19,7 @@ export declare type OnRenderedHook = (html: string, ssrContext: Record<string, a
|
|
|
18
19
|
export declare type OnSetupFile = URL;
|
|
19
20
|
export interface VitrifyConfig extends UserConfig {
|
|
20
21
|
vitrify?: {
|
|
22
|
+
lang?: string;
|
|
21
23
|
/**
|
|
22
24
|
* Global CSS imports
|
|
23
25
|
*/
|
|
@@ -71,6 +73,7 @@ export interface VitrifyConfig extends UserConfig {
|
|
|
71
73
|
*/
|
|
72
74
|
ssr?: {
|
|
73
75
|
serverModules?: string[];
|
|
76
|
+
fastify?: FastifyServerOptions;
|
|
74
77
|
};
|
|
75
78
|
/**
|
|
76
79
|
* Development only configuration
|