vitrify 0.11.0 → 0.11.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/index.js
CHANGED
|
@@ -7,11 +7,11 @@ import path from 'path';
|
|
|
7
7
|
import { pathToFileURL } from 'url';
|
|
8
8
|
import { readFileSync } from 'fs';
|
|
9
9
|
import builtinModules from 'builtin-modules';
|
|
10
|
-
// import { resolve } from 'import-meta-resolve'
|
|
11
10
|
import { visualizer } from 'rollup-plugin-visualizer';
|
|
12
11
|
import { resolve } from './app-urls.js';
|
|
13
12
|
import envPlugin from '@vitrify/plugin-env';
|
|
14
13
|
import { addOrReplaceTitle, appendToBody } from './helpers/utils.js';
|
|
14
|
+
import Components from 'unplugin-vue-components/vite';
|
|
15
15
|
const internalServerModules = [
|
|
16
16
|
'util',
|
|
17
17
|
'vitrify',
|
|
@@ -30,6 +30,9 @@ const internalServerModules = [
|
|
|
30
30
|
const configPluginMap = {
|
|
31
31
|
quasar: () => import('./plugins/quasar.js').then((module) => module.QuasarPlugin)
|
|
32
32
|
};
|
|
33
|
+
const configResolverMap = {
|
|
34
|
+
quasar: () => import('unplugin-vue-components/resolvers').then((module) => module.QuasarResolver())
|
|
35
|
+
};
|
|
33
36
|
const manualChunkNames = [
|
|
34
37
|
'prerender',
|
|
35
38
|
'fastify-ssr-plugin',
|
|
@@ -181,13 +184,16 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
181
184
|
else {
|
|
182
185
|
}
|
|
183
186
|
const frameworkPlugins = [];
|
|
187
|
+
const resolvers = [];
|
|
184
188
|
for (const framework of Object.keys(configPluginMap)) {
|
|
185
189
|
if (Object.keys(vitrifyConfig).includes(framework)) {
|
|
186
190
|
const plugin = await configPluginMap[framework]();
|
|
191
|
+
const resolver = await configResolverMap[framework]();
|
|
187
192
|
frameworkPlugins.push(await plugin({
|
|
188
193
|
ssr,
|
|
189
194
|
pwa
|
|
190
195
|
}));
|
|
196
|
+
resolvers.push(resolver);
|
|
191
197
|
}
|
|
192
198
|
}
|
|
193
199
|
let onBootHooks;
|
|
@@ -327,7 +333,15 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
327
333
|
}
|
|
328
334
|
return null;
|
|
329
335
|
}
|
|
330
|
-
}
|
|
336
|
+
},
|
|
337
|
+
Components({
|
|
338
|
+
exclude: [
|
|
339
|
+
new RegExp(`[\\/]node_modules[\\/].*[\\/]!(${serverModules.join('|')})`),
|
|
340
|
+
/[\\/]\.git[\\/]/,
|
|
341
|
+
/[\\/]\.nuxt[\\/]/
|
|
342
|
+
],
|
|
343
|
+
resolvers
|
|
344
|
+
})
|
|
331
345
|
];
|
|
332
346
|
if (command !== 'test') {
|
|
333
347
|
plugins.unshift({
|
package/dist/plugins/quasar.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { resolvePackageData } from 'vite';
|
|
2
|
-
import Components from 'unplugin-vue-components/vite';
|
|
3
|
-
import { QuasarResolver } from 'unplugin-vue-components/resolvers';
|
|
4
2
|
export const injectSsrContext = (html, ssrContext) => html
|
|
5
3
|
.replace(/(<html[^>]*)(>)/i, (found, start, end) => {
|
|
6
4
|
let matches;
|
|
@@ -31,9 +29,6 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
31
29
|
let plugins = [];
|
|
32
30
|
let quasarConf;
|
|
33
31
|
return [
|
|
34
|
-
Components({
|
|
35
|
-
resolvers: [QuasarResolver()]
|
|
36
|
-
}),
|
|
37
32
|
{
|
|
38
33
|
name: 'vite-plugin-quasar-transform',
|
|
39
34
|
enforce: 'pre',
|
|
@@ -84,4 +84,5 @@ export interface VitrifyConfig extends UserConfig {
|
|
|
84
84
|
};
|
|
85
85
|
quasar?: QuasarConf;
|
|
86
86
|
}
|
|
87
|
+
export declare type VitrifyConfigAsync = VitrifyConfig | ((mode: string, command: string) => Promise<VitrifyConfig>);
|
|
87
88
|
export declare const defineConfig: (config: VitrifyConfig) => VitrifyConfig;
|
package/package.json
CHANGED
package/src/node/index.ts
CHANGED
|
@@ -8,7 +8,6 @@ import path from 'path'
|
|
|
8
8
|
import { pathToFileURL } from 'url'
|
|
9
9
|
import { readFileSync } from 'fs'
|
|
10
10
|
import builtinModules from 'builtin-modules'
|
|
11
|
-
// import { resolve } from 'import-meta-resolve'
|
|
12
11
|
import { visualizer } from 'rollup-plugin-visualizer'
|
|
13
12
|
import type {
|
|
14
13
|
StaticImports,
|
|
@@ -25,6 +24,8 @@ import { resolve } from './app-urls.js'
|
|
|
25
24
|
import type { ManualChunksOption, RollupOptions } from 'rollup'
|
|
26
25
|
import envPlugin from '@vitrify/plugin-env'
|
|
27
26
|
import { addOrReplaceTitle, appendToBody } from './helpers/utils.js'
|
|
27
|
+
import type { ComponentResolver } from 'unplugin-vue-components'
|
|
28
|
+
import Components from 'unplugin-vue-components/vite'
|
|
28
29
|
|
|
29
30
|
const internalServerModules = [
|
|
30
31
|
'util',
|
|
@@ -47,6 +48,16 @@ const configPluginMap: Record<string, () => Promise<VitrifyPlugin>> = {
|
|
|
47
48
|
import('./plugins/quasar.js').then((module) => module.QuasarPlugin)
|
|
48
49
|
}
|
|
49
50
|
|
|
51
|
+
const configResolverMap: Record<
|
|
52
|
+
string,
|
|
53
|
+
() => Promise<ComponentResolver | ComponentResolver[]>
|
|
54
|
+
> = {
|
|
55
|
+
quasar: () =>
|
|
56
|
+
import('unplugin-vue-components/resolvers').then((module) =>
|
|
57
|
+
module.QuasarResolver()
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
50
61
|
const manualChunkNames = [
|
|
51
62
|
'prerender',
|
|
52
63
|
'fastify-ssr-plugin',
|
|
@@ -249,15 +260,18 @@ export const baseConfig = async ({
|
|
|
249
260
|
}
|
|
250
261
|
|
|
251
262
|
const frameworkPlugins = []
|
|
263
|
+
const resolvers = []
|
|
252
264
|
for (const framework of Object.keys(configPluginMap)) {
|
|
253
265
|
if (Object.keys(vitrifyConfig).includes(framework)) {
|
|
254
266
|
const plugin = await configPluginMap[framework]()
|
|
267
|
+
const resolver = await configResolverMap[framework]()
|
|
255
268
|
frameworkPlugins.push(
|
|
256
269
|
await plugin({
|
|
257
270
|
ssr,
|
|
258
271
|
pwa
|
|
259
272
|
})
|
|
260
273
|
)
|
|
274
|
+
resolvers.push(resolver)
|
|
261
275
|
}
|
|
262
276
|
}
|
|
263
277
|
|
|
@@ -325,6 +339,7 @@ export const baseConfig = async ({
|
|
|
325
339
|
sassVariables = config.vitrify?.sass?.variables || {}
|
|
326
340
|
globalSass = config.vitrify?.sass?.global || []
|
|
327
341
|
additionalData = config.vitrify?.sass?.additionalData || []
|
|
342
|
+
|
|
328
343
|
return
|
|
329
344
|
},
|
|
330
345
|
configureServer(server) {
|
|
@@ -404,7 +419,17 @@ export const baseConfig = async ({
|
|
|
404
419
|
}
|
|
405
420
|
return null
|
|
406
421
|
}
|
|
407
|
-
}
|
|
422
|
+
},
|
|
423
|
+
Components({
|
|
424
|
+
exclude: [
|
|
425
|
+
new RegExp(
|
|
426
|
+
`[\\/]node_modules[\\/].*[\\/]!(${serverModules.join('|')})`
|
|
427
|
+
),
|
|
428
|
+
/[\\/]\.git[\\/]/,
|
|
429
|
+
/[\\/]\.nuxt[\\/]/
|
|
430
|
+
],
|
|
431
|
+
resolvers
|
|
432
|
+
})
|
|
408
433
|
]
|
|
409
434
|
if (command !== 'test') {
|
|
410
435
|
plugins.unshift({
|
|
@@ -6,7 +6,6 @@ import type {
|
|
|
6
6
|
OnMountedHook,
|
|
7
7
|
VitrifyConfig
|
|
8
8
|
} from '../vitrify-config.js'
|
|
9
|
-
import { QuasarResolver } from 'unplugin-vue-components/resolvers'
|
|
10
9
|
import type { VitrifyPlugin } from './index.js'
|
|
11
10
|
export interface QuasarConf {
|
|
12
11
|
ctx?: Record<string, any>
|
|
@@ -78,9 +77,6 @@ export const QuasarPlugin: VitrifyPlugin = async ({
|
|
|
78
77
|
let plugins: string[] = []
|
|
79
78
|
let quasarConf: QuasarConf
|
|
80
79
|
return [
|
|
81
|
-
Components({
|
|
82
|
-
resolvers: [QuasarResolver()]
|
|
83
|
-
}),
|
|
84
80
|
{
|
|
85
81
|
name: 'vite-plugin-quasar-transform',
|
|
86
82
|
enforce: 'pre',
|
|
@@ -2,6 +2,7 @@ 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
|
+
import { ComponentResolver } from 'unplugin-vue-components'
|
|
5
6
|
|
|
6
7
|
export type BootFunction = ({
|
|
7
8
|
app,
|
|
@@ -106,4 +107,8 @@ export interface VitrifyConfig extends UserConfig {
|
|
|
106
107
|
quasar?: QuasarConf
|
|
107
108
|
}
|
|
108
109
|
|
|
110
|
+
export type VitrifyConfigAsync =
|
|
111
|
+
| VitrifyConfig
|
|
112
|
+
| ((mode: string, command: string) => Promise<VitrifyConfig>)
|
|
113
|
+
|
|
109
114
|
export const defineConfig = (config: VitrifyConfig) => config
|