vitrify 0.5.5 → 0.5.8
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/dev.js +3 -1
- package/dist/index.js +6 -4
- package/dist/plugins/quasar.js +111 -65
- package/dist/types/bin/dev.d.ts +1 -1
- package/package.json +17 -18
- package/src/node/bin/dev.ts +3 -1
- package/src/node/index.ts +6 -4
- package/src/node/plugins/quasar.ts +110 -90
- package/src/vite/vue/ssr/entry-server.ts +1 -1
package/dist/bin/dev.js
CHANGED
|
@@ -33,7 +33,7 @@ ssr, framework = 'vue', host, appDir, publicDir, base }) {
|
|
|
33
33
|
},
|
|
34
34
|
port,
|
|
35
35
|
// middlewareMode: mode === 'ssr' ? 'ssr' : undefined,
|
|
36
|
-
middlewareMode: ssr ?
|
|
36
|
+
middlewareMode: ssr ? true : false,
|
|
37
37
|
fs: {
|
|
38
38
|
strict: false,
|
|
39
39
|
allow: [
|
|
@@ -51,6 +51,8 @@ ssr, framework = 'vue', host, appDir, publicDir, base }) {
|
|
|
51
51
|
},
|
|
52
52
|
host
|
|
53
53
|
};
|
|
54
|
+
if (ssr)
|
|
55
|
+
config.appType = 'custom';
|
|
54
56
|
const vitrifyDevServer = await (await import('vite')).createServer({
|
|
55
57
|
configFile: false,
|
|
56
58
|
...config
|
package/dist/index.js
CHANGED
|
@@ -132,7 +132,8 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
132
132
|
console.log('No vitrify.config.(ts|js) file found, using defaults');
|
|
133
133
|
vitrifyConfig = {};
|
|
134
134
|
}
|
|
135
|
-
const localPackages = ['vue', 'vue-router']
|
|
135
|
+
// const localPackages = ['vue', 'vue-router', '@vue/server-renderer']
|
|
136
|
+
const localPackages = [];
|
|
136
137
|
const cliPackages = [];
|
|
137
138
|
const packageUrls = vitrifyConfig.vitrify?.urls?.packages || {};
|
|
138
139
|
await (async () => {
|
|
@@ -459,7 +460,8 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
459
460
|
};
|
|
460
461
|
}
|
|
461
462
|
const config = {
|
|
462
|
-
root: ssr === 'fastify' ? appDir.pathname : frameworkDir.pathname,
|
|
463
|
+
// root: ssr === 'fastify' ? appDir.pathname : frameworkDir.pathname,
|
|
464
|
+
root: appDir.pathname,
|
|
463
465
|
publicDir: publicDir.pathname,
|
|
464
466
|
base,
|
|
465
467
|
envDir: appDir.pathname,
|
|
@@ -475,10 +477,10 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
475
477
|
},
|
|
476
478
|
plugins,
|
|
477
479
|
optimizeDeps: {
|
|
478
|
-
exclude: ['vue', ...serverModules, ...builtinModules]
|
|
480
|
+
exclude: ['vue', 'vue-router', ...serverModules, ...builtinModules]
|
|
479
481
|
},
|
|
480
482
|
resolve: {
|
|
481
|
-
dedupe: ['vue', 'vue-router'],
|
|
483
|
+
dedupe: ['vue', '@vue/server-renderer', 'vue-router'],
|
|
482
484
|
alias
|
|
483
485
|
},
|
|
484
486
|
build: {
|
package/dist/plugins/quasar.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { readFileSync } from 'fs';
|
|
2
1
|
import Components from 'unplugin-vue-components/vite';
|
|
3
2
|
// import { quasarDir as defaultQuasarDir } from '../app-urls.js'
|
|
4
3
|
// import { QuasarResolver } from '../resolver.js';
|
|
@@ -36,26 +35,36 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
36
35
|
Components({
|
|
37
36
|
resolvers: [QuasarResolver()]
|
|
38
37
|
}),
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
// {
|
|
39
|
+
// name: 'vite-plugin-quasar-transform',
|
|
40
|
+
// enforce: 'pre',
|
|
41
|
+
// transform: (code, id, options) => {
|
|
42
|
+
// const { ssr: transformSsr } = options || {}
|
|
43
|
+
// code = code
|
|
44
|
+
// .replaceAll('__QUASAR_SSR__', ssr ? ssr.toString() : 'false')
|
|
45
|
+
// .replaceAll(
|
|
46
|
+
// '__QUASAR_SSR_SERVER__',
|
|
47
|
+
// transformSsr ? 'import.meta.env.SSR' : 'false'
|
|
48
|
+
// )
|
|
49
|
+
// .replaceAll(
|
|
50
|
+
// '__QUASAR_SSR_CLIENT__',
|
|
51
|
+
// ssr ? '!import.meta.env.SSR' : 'false'
|
|
52
|
+
// )
|
|
53
|
+
// .replaceAll(
|
|
54
|
+
// '__QUASAR_SSR_PWA__',
|
|
55
|
+
// ssr && pwa ? '!import.meta.env.SSR' : 'false'
|
|
56
|
+
// )
|
|
57
|
+
// return code
|
|
58
|
+
// }
|
|
59
|
+
// },
|
|
52
60
|
{
|
|
53
61
|
name: 'vite-plugin-quasar-setup',
|
|
54
62
|
enforce: 'pre',
|
|
55
63
|
config: async (config, env) => {
|
|
56
64
|
const { vitrify: { urls } = {}, quasar } = config;
|
|
57
65
|
const globalCss = quasar?.extras.map((extra) => `@quasar/extras/${extra}/${extra}.css`);
|
|
58
|
-
const localPackages = ['@quasar/extras', 'quasar']
|
|
66
|
+
// const localPackages = ['@quasar/extras', 'quasar']
|
|
67
|
+
const localPackages = [];
|
|
59
68
|
await (async () => {
|
|
60
69
|
for (const val of localPackages)
|
|
61
70
|
urls.packages[val] = getPkgJsonDir(new URL(await resolve(val, urls.app)));
|
|
@@ -72,7 +81,7 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
72
81
|
// @ts-ignore
|
|
73
82
|
const quasarPlugins = await import('virtual:quasar-plugins');
|
|
74
83
|
// @ts-ignore
|
|
75
|
-
const directives = await import('quasar
|
|
84
|
+
const directives = await import('virtual:quasar-directives');
|
|
76
85
|
app.use(staticImports?.Quasar, {
|
|
77
86
|
plugins: quasarPlugins,
|
|
78
87
|
directives
|
|
@@ -104,8 +113,20 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
104
113
|
enforce: 'post',
|
|
105
114
|
config: async (config, env) => {
|
|
106
115
|
const { quasar: quasarConf, vitrify: { urls } = {} } = config;
|
|
107
|
-
const quasarPkgJsonPath = new URL(
|
|
108
|
-
|
|
116
|
+
// const quasarPkgJsonPath = new URL(
|
|
117
|
+
// 'package.json',
|
|
118
|
+
// urls?.packages?.quasar
|
|
119
|
+
// ).pathname
|
|
120
|
+
// const { version } = JSON.parse(
|
|
121
|
+
// readFileSync(quasarPkgJsonPath, { encoding: 'utf-8' })
|
|
122
|
+
// )
|
|
123
|
+
// const { version } = await import('quasar/package.json', {
|
|
124
|
+
// assert: { type: 'json' }
|
|
125
|
+
// })
|
|
126
|
+
/**
|
|
127
|
+
* Importing package.json is problematic
|
|
128
|
+
*/
|
|
129
|
+
const version = '?';
|
|
109
130
|
/**
|
|
110
131
|
* All components should have been auto-imported
|
|
111
132
|
*/
|
|
@@ -119,59 +140,79 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
119
140
|
}
|
|
120
141
|
return {
|
|
121
142
|
resolve: {
|
|
143
|
+
dedupe: ['quasar', '@quasar/extras'],
|
|
122
144
|
alias: [
|
|
145
|
+
// {
|
|
146
|
+
// find: 'quasar/wrappers',
|
|
147
|
+
// replacement: new URL('quasar-wrappers.ts', urls?.cli).pathname
|
|
148
|
+
// },
|
|
149
|
+
// {
|
|
150
|
+
// find: 'quasar/vue-plugin',
|
|
151
|
+
// replacement: new URL(
|
|
152
|
+
// 'src/vue-plugin.js',
|
|
153
|
+
// urls?.packages?.quasar
|
|
154
|
+
// ).pathname
|
|
155
|
+
// },
|
|
156
|
+
// {
|
|
157
|
+
// find: 'quasar/plugins',
|
|
158
|
+
// replacement: new URL('src/plugins.js', urls?.packages?.quasar)
|
|
159
|
+
// .pathname
|
|
160
|
+
// },
|
|
161
|
+
// {
|
|
162
|
+
// find: 'quasar/components',
|
|
163
|
+
// replacement: new URL(
|
|
164
|
+
// 'src/components.js',
|
|
165
|
+
// urls?.packages?.quasar
|
|
166
|
+
// ).pathname
|
|
167
|
+
// },
|
|
168
|
+
// {
|
|
169
|
+
// find: 'quasar/composables',
|
|
170
|
+
// replacement: new URL(
|
|
171
|
+
// 'src/composables.js',
|
|
172
|
+
// urls?.packages?.quasar
|
|
173
|
+
// ).pathname
|
|
174
|
+
// },
|
|
175
|
+
// {
|
|
176
|
+
// find: 'quasar/directives',
|
|
177
|
+
// replacement: new URL(
|
|
178
|
+
// 'src/directives.js',
|
|
179
|
+
// urls?.packages?.quasar
|
|
180
|
+
// ).pathname
|
|
181
|
+
// },
|
|
182
|
+
// {
|
|
183
|
+
// find: 'quasar/src',
|
|
184
|
+
// replacement: new URL('src/', urls?.packages?.quasar).pathname
|
|
185
|
+
// }
|
|
123
186
|
{
|
|
124
|
-
find: 'quasar
|
|
125
|
-
replacement:
|
|
126
|
-
}
|
|
127
|
-
{
|
|
128
|
-
find: 'quasar/vue-plugin',
|
|
129
|
-
replacement: new URL('src/vue-plugin.js', urls?.packages?.quasar).pathname
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
find: 'quasar/plugins',
|
|
133
|
-
replacement: new URL('src/plugins.js', urls?.packages?.quasar)
|
|
134
|
-
.pathname
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
find: 'quasar/components',
|
|
138
|
-
replacement: new URL('src/components.js', urls?.packages?.quasar).pathname
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
find: 'quasar/composables',
|
|
142
|
-
replacement: new URL('src/composables.js', urls?.packages?.quasar).pathname
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
find: 'quasar/directives',
|
|
146
|
-
replacement: new URL('src/directives.js', urls?.packages?.quasar).pathname
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
find: 'quasar/src',
|
|
150
|
-
replacement: new URL('src/', urls?.packages?.quasar).pathname
|
|
151
|
-
},
|
|
187
|
+
find: new RegExp('^quasar$'),
|
|
188
|
+
replacement: 'quasar/src/index.all.js'
|
|
189
|
+
}
|
|
152
190
|
// {
|
|
153
191
|
// find: new RegExp('^quasar$'),
|
|
154
192
|
// replacement: new URL('src/index.all.js', urls?.packages?.quasar)
|
|
155
193
|
// .pathname
|
|
156
194
|
// },
|
|
157
|
-
{
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
195
|
+
// {
|
|
196
|
+
// find: `@quasar/extras`,
|
|
197
|
+
// replacement: new URL('.', urls?.packages?.['@quasar/extras'])
|
|
198
|
+
// .pathname
|
|
199
|
+
// }
|
|
162
200
|
// { find: new RegExp('^quasar$'), replacement: 'virtual:quasar' }
|
|
163
201
|
]
|
|
164
202
|
},
|
|
203
|
+
optimizeDeps: {
|
|
204
|
+
exclude: ['quasar']
|
|
205
|
+
},
|
|
165
206
|
define: {
|
|
166
207
|
__DEV__: process.env.NODE_ENV !== 'production' || true,
|
|
167
|
-
__QUASAR_VERSION__: `'${version}'
|
|
168
|
-
|
|
169
|
-
//
|
|
170
|
-
|
|
171
|
-
//
|
|
172
|
-
|
|
173
|
-
//
|
|
174
|
-
|
|
208
|
+
__QUASAR_VERSION__: `'${version}'`,
|
|
209
|
+
__QUASAR_SSR__: !!ssr,
|
|
210
|
+
// __QUASAR_SSR_SERVER__: ssr === 'server',
|
|
211
|
+
__QUASAR_SSR_SERVER__: `import.meta.env.SSR`,
|
|
212
|
+
// __QUASAR_SSR_CLIENT__: ssr === 'client',
|
|
213
|
+
__QUASAR_SSR_CLIENT__: `!import.meta.env.SSR`,
|
|
214
|
+
// __QUASAR_SSR_PWA__: ssr === 'client' && pwa
|
|
215
|
+
__QUASAR_SSR_PWA__: pwa ? `!import.meta.env.SSR` : false
|
|
175
216
|
},
|
|
176
217
|
ssr: {
|
|
177
218
|
noExternal: ['quasar']
|
|
@@ -193,6 +234,8 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
193
234
|
switch (id) {
|
|
194
235
|
case 'virtual:quasar-plugins':
|
|
195
236
|
return 'virtual:quasar-plugins';
|
|
237
|
+
case 'virtual:quasar-directives':
|
|
238
|
+
return 'virtual:quasar-directives';
|
|
196
239
|
case 'quasar':
|
|
197
240
|
return { id: 'quasar', moduleSideEffects: false };
|
|
198
241
|
default:
|
|
@@ -203,13 +246,16 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
203
246
|
if (id === 'virtual:quasar-plugins') {
|
|
204
247
|
return `export { ${plugins.join(',')} } from 'quasar'`;
|
|
205
248
|
}
|
|
249
|
+
else if (id === 'virtual:quasar-directives') {
|
|
250
|
+
return `export * from 'quasar/src/directives'`;
|
|
251
|
+
}
|
|
206
252
|
else if (id === 'quasar') {
|
|
207
|
-
return `export * from 'quasar/src/plugins
|
|
208
|
-
export * from 'quasar/src/components
|
|
209
|
-
export * from 'quasar/src/composables
|
|
210
|
-
export * from 'quasar/src/directives
|
|
211
|
-
export * from 'quasar/src/utils
|
|
212
|
-
export { default as Quasar } from 'quasar/src/install-quasar
|
|
253
|
+
return `export * from 'quasar/src/plugins';
|
|
254
|
+
export * from 'quasar/src/components';
|
|
255
|
+
export * from 'quasar/src/composables';
|
|
256
|
+
export * from 'quasar/src/directives';
|
|
257
|
+
export * from 'quasar/src/utils';
|
|
258
|
+
export { default as Quasar } from 'quasar/src/install-quasar'`;
|
|
213
259
|
}
|
|
214
260
|
return null;
|
|
215
261
|
}
|
package/dist/types/bin/dev.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare function createServer({ port, logLevel, ssr, framework, host, app
|
|
|
22
22
|
publicDir?: URL;
|
|
23
23
|
}): Promise<{
|
|
24
24
|
server: Server;
|
|
25
|
-
config: Readonly<Omit<import("vite").UserConfig, "
|
|
25
|
+
config: Readonly<Omit<import("vite").UserConfig, "optimizeDeps" | "plugins" | "assetsInclude" | "worker"> & {
|
|
26
26
|
configFile: string | undefined;
|
|
27
27
|
configFileDependencies: string[];
|
|
28
28
|
inlineConfig: InlineConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitrify",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Stefan van Herwijnen",
|
|
6
6
|
"description": "Pre-configured Vite CLI for your framework",
|
|
@@ -54,47 +54,46 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@fastify/middie": "^8.0.0",
|
|
56
56
|
"@fastify/static": "^6.4.0",
|
|
57
|
-
"@quasar/extras": "^1.14.
|
|
57
|
+
"@quasar/extras": "^1.14.1",
|
|
58
58
|
"@vitejs/plugin-vue": "^3.0.0-alpha.1",
|
|
59
|
-
"@vue/server-renderer": "^3.2.37",
|
|
60
59
|
"builtin-modules": "^3.3.0",
|
|
61
60
|
"cac": "^6.7.12",
|
|
62
61
|
"chalk": "^5.0.1",
|
|
62
|
+
"critters": "^0.0.16",
|
|
63
63
|
"cross-env": "^7.0.3",
|
|
64
|
-
"esbuild": "^0.14.
|
|
65
|
-
"fastify": "^4.
|
|
64
|
+
"esbuild": "^0.14.47",
|
|
65
|
+
"fastify": "^4.2.0",
|
|
66
66
|
"glob": "^8.0.3",
|
|
67
|
-
"happy-dom": "^5.
|
|
67
|
+
"happy-dom": "^5.3.4",
|
|
68
68
|
"magic-string": "^0.26.2",
|
|
69
69
|
"merge-deep": "^3.0.3",
|
|
70
70
|
"readline": "^1.3.0",
|
|
71
71
|
"rollup-plugin-visualizer": "^5.6.0",
|
|
72
|
-
"sass": "1.
|
|
72
|
+
"sass": "1.53.0",
|
|
73
73
|
"ts-node": "^10.8.1",
|
|
74
|
-
"unplugin-vue-components": "^0.
|
|
74
|
+
"unplugin-vue-components": "^0.20.1",
|
|
75
75
|
"vite": "^3.0.0-beta.0",
|
|
76
|
-
"vitest": "^0.
|
|
76
|
+
"vitest": "^0.16.0"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@types/connect": "^3.4.35",
|
|
80
80
|
"@types/glob": "^7.2.0",
|
|
81
81
|
"@types/merge-deep": "^3.0.0",
|
|
82
|
-
"@types/node": "^
|
|
82
|
+
"@types/node": "^18.0.0",
|
|
83
83
|
"@types/ws": "^8.5.3",
|
|
84
84
|
"@vue/runtime-core": "^3.2.37",
|
|
85
|
-
"quasar": "^2.7.
|
|
86
|
-
"rollup": "^2.75.
|
|
87
|
-
"typescript": "^4.7.
|
|
88
|
-
"vite": "^3.0.0-alpha.11",
|
|
85
|
+
"quasar": "^2.7.3",
|
|
86
|
+
"rollup": "^2.75.7",
|
|
87
|
+
"typescript": "^4.7.4",
|
|
89
88
|
"vue": "^3.2.37",
|
|
90
|
-
"vue-router": "^4.0.
|
|
89
|
+
"vue-router": "^4.0.16"
|
|
91
90
|
},
|
|
92
91
|
"peerDependencies": {
|
|
93
92
|
"@fastify/static": "^6.4.0",
|
|
94
|
-
"fastify": "^4.
|
|
95
|
-
"quasar": "^2.7.
|
|
93
|
+
"fastify": "^4.2.0",
|
|
94
|
+
"quasar": "^2.7.3",
|
|
96
95
|
"vue": "^3.2.37",
|
|
97
|
-
"vue-router": "^4.0.
|
|
96
|
+
"vue-router": "^4.0.16"
|
|
98
97
|
},
|
|
99
98
|
"publishConfig": {
|
|
100
99
|
"access": "public",
|
package/src/node/bin/dev.ts
CHANGED
|
@@ -60,7 +60,7 @@ export async function createVitrifyDevServer({
|
|
|
60
60
|
},
|
|
61
61
|
port,
|
|
62
62
|
// middlewareMode: mode === 'ssr' ? 'ssr' : undefined,
|
|
63
|
-
middlewareMode: ssr ?
|
|
63
|
+
middlewareMode: ssr ? true : false,
|
|
64
64
|
fs: {
|
|
65
65
|
strict: false, // https://github.com/vitejs/vite/issues/8175
|
|
66
66
|
allow: [
|
|
@@ -78,6 +78,8 @@ export async function createVitrifyDevServer({
|
|
|
78
78
|
},
|
|
79
79
|
host
|
|
80
80
|
}
|
|
81
|
+
if (ssr) config.appType = 'custom'
|
|
82
|
+
|
|
81
83
|
const vitrifyDevServer = await (
|
|
82
84
|
await import('vite')
|
|
83
85
|
).createServer({
|
package/src/node/index.ts
CHANGED
|
@@ -194,7 +194,8 @@ export const baseConfig = async ({
|
|
|
194
194
|
vitrifyConfig = {}
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
const localPackages = ['vue', 'vue-router']
|
|
197
|
+
// const localPackages = ['vue', 'vue-router', '@vue/server-renderer']
|
|
198
|
+
const localPackages: string[] = []
|
|
198
199
|
const cliPackages = []
|
|
199
200
|
const packageUrls: Record<string, URL> =
|
|
200
201
|
vitrifyConfig.vitrify?.urls?.packages || {}
|
|
@@ -541,7 +542,8 @@ export const baseConfig = async ({
|
|
|
541
542
|
}
|
|
542
543
|
|
|
543
544
|
const config = {
|
|
544
|
-
root: ssr === 'fastify' ? appDir.pathname : frameworkDir.pathname,
|
|
545
|
+
// root: ssr === 'fastify' ? appDir.pathname : frameworkDir.pathname,
|
|
546
|
+
root: appDir.pathname,
|
|
545
547
|
publicDir: publicDir.pathname,
|
|
546
548
|
base,
|
|
547
549
|
envDir: appDir.pathname,
|
|
@@ -557,10 +559,10 @@ export const baseConfig = async ({
|
|
|
557
559
|
},
|
|
558
560
|
plugins,
|
|
559
561
|
optimizeDeps: {
|
|
560
|
-
exclude: ['vue', ...serverModules, ...builtinModules]
|
|
562
|
+
exclude: ['vue', 'vue-router', ...serverModules, ...builtinModules]
|
|
561
563
|
},
|
|
562
564
|
resolve: {
|
|
563
|
-
dedupe: ['vue', 'vue-router'],
|
|
565
|
+
dedupe: ['vue', '@vue/server-renderer', 'vue-router'],
|
|
564
566
|
alias
|
|
565
567
|
},
|
|
566
568
|
build: {
|
|
@@ -86,29 +86,29 @@ export const QuasarPlugin: VitrifyPlugin = async ({
|
|
|
86
86
|
Components({
|
|
87
87
|
resolvers: [QuasarResolver()]
|
|
88
88
|
}),
|
|
89
|
-
{
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
89
|
+
// {
|
|
90
|
+
// name: 'vite-plugin-quasar-transform',
|
|
91
|
+
// enforce: 'pre',
|
|
92
|
+
// transform: (code, id, options) => {
|
|
93
|
+
// const { ssr: transformSsr } = options || {}
|
|
94
|
+
// code = code
|
|
95
|
+
// .replaceAll('__QUASAR_SSR__', ssr ? ssr.toString() : 'false')
|
|
96
|
+
// .replaceAll(
|
|
97
|
+
// '__QUASAR_SSR_SERVER__',
|
|
98
|
+
// transformSsr ? 'import.meta.env.SSR' : 'false'
|
|
99
|
+
// )
|
|
100
|
+
// .replaceAll(
|
|
101
|
+
// '__QUASAR_SSR_CLIENT__',
|
|
102
|
+
// ssr ? '!import.meta.env.SSR' : 'false'
|
|
103
|
+
// )
|
|
104
|
+
// .replaceAll(
|
|
105
|
+
// '__QUASAR_SSR_PWA__',
|
|
106
|
+
// ssr && pwa ? '!import.meta.env.SSR' : 'false'
|
|
107
|
+
// )
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
},
|
|
109
|
+
// return code
|
|
110
|
+
// }
|
|
111
|
+
// },
|
|
112
112
|
{
|
|
113
113
|
name: 'vite-plugin-quasar-setup',
|
|
114
114
|
enforce: 'pre',
|
|
@@ -119,7 +119,8 @@ export const QuasarPlugin: VitrifyPlugin = async ({
|
|
|
119
119
|
(extra) => `@quasar/extras/${extra}/${extra}.css`
|
|
120
120
|
)
|
|
121
121
|
|
|
122
|
-
const localPackages = ['@quasar/extras', 'quasar']
|
|
122
|
+
// const localPackages = ['@quasar/extras', 'quasar']
|
|
123
|
+
const localPackages: string[] = []
|
|
123
124
|
await (async () => {
|
|
124
125
|
for (const val of localPackages)
|
|
125
126
|
urls!.packages![val] = getPkgJsonDir(
|
|
@@ -142,7 +143,7 @@ export const QuasarPlugin: VitrifyPlugin = async ({
|
|
|
142
143
|
// @ts-ignore
|
|
143
144
|
const quasarPlugins = await import('virtual:quasar-plugins')
|
|
144
145
|
// @ts-ignore
|
|
145
|
-
const directives = await import('quasar
|
|
146
|
+
const directives = await import('virtual:quasar-directives')
|
|
146
147
|
|
|
147
148
|
app.use(
|
|
148
149
|
staticImports?.Quasar,
|
|
@@ -181,13 +182,20 @@ export const QuasarPlugin: VitrifyPlugin = async ({
|
|
|
181
182
|
config: async (config: VitrifyConfig, env) => {
|
|
182
183
|
const { quasar: quasarConf, vitrify: { urls } = {} } = config
|
|
183
184
|
|
|
184
|
-
const quasarPkgJsonPath = new URL(
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
).pathname
|
|
188
|
-
const { version } = JSON.parse(
|
|
189
|
-
|
|
190
|
-
)
|
|
185
|
+
// const quasarPkgJsonPath = new URL(
|
|
186
|
+
// 'package.json',
|
|
187
|
+
// urls?.packages?.quasar
|
|
188
|
+
// ).pathname
|
|
189
|
+
// const { version } = JSON.parse(
|
|
190
|
+
// readFileSync(quasarPkgJsonPath, { encoding: 'utf-8' })
|
|
191
|
+
// )
|
|
192
|
+
// const { version } = await import('quasar/package.json', {
|
|
193
|
+
// assert: { type: 'json' }
|
|
194
|
+
// })
|
|
195
|
+
/**
|
|
196
|
+
* Importing package.json is problematic
|
|
197
|
+
*/
|
|
198
|
+
const version = '?'
|
|
191
199
|
|
|
192
200
|
/**
|
|
193
201
|
* All components should have been auto-imported
|
|
@@ -202,71 +210,79 @@ export const QuasarPlugin: VitrifyPlugin = async ({
|
|
|
202
210
|
|
|
203
211
|
return {
|
|
204
212
|
resolve: {
|
|
213
|
+
dedupe: ['quasar', '@quasar/extras'],
|
|
205
214
|
alias: [
|
|
215
|
+
// {
|
|
216
|
+
// find: 'quasar/wrappers',
|
|
217
|
+
// replacement: new URL('quasar-wrappers.ts', urls?.cli).pathname
|
|
218
|
+
// },
|
|
219
|
+
// {
|
|
220
|
+
// find: 'quasar/vue-plugin',
|
|
221
|
+
// replacement: new URL(
|
|
222
|
+
// 'src/vue-plugin.js',
|
|
223
|
+
// urls?.packages?.quasar
|
|
224
|
+
// ).pathname
|
|
225
|
+
// },
|
|
226
|
+
// {
|
|
227
|
+
// find: 'quasar/plugins',
|
|
228
|
+
// replacement: new URL('src/plugins.js', urls?.packages?.quasar)
|
|
229
|
+
// .pathname
|
|
230
|
+
// },
|
|
231
|
+
// {
|
|
232
|
+
// find: 'quasar/components',
|
|
233
|
+
// replacement: new URL(
|
|
234
|
+
// 'src/components.js',
|
|
235
|
+
// urls?.packages?.quasar
|
|
236
|
+
// ).pathname
|
|
237
|
+
// },
|
|
238
|
+
// {
|
|
239
|
+
// find: 'quasar/composables',
|
|
240
|
+
// replacement: new URL(
|
|
241
|
+
// 'src/composables.js',
|
|
242
|
+
// urls?.packages?.quasar
|
|
243
|
+
// ).pathname
|
|
244
|
+
// },
|
|
245
|
+
// {
|
|
246
|
+
// find: 'quasar/directives',
|
|
247
|
+
// replacement: new URL(
|
|
248
|
+
// 'src/directives.js',
|
|
249
|
+
// urls?.packages?.quasar
|
|
250
|
+
// ).pathname
|
|
251
|
+
// },
|
|
252
|
+
// {
|
|
253
|
+
// find: 'quasar/src',
|
|
254
|
+
// replacement: new URL('src/', urls?.packages?.quasar).pathname
|
|
255
|
+
// }
|
|
206
256
|
{
|
|
207
|
-
find: 'quasar
|
|
208
|
-
replacement:
|
|
209
|
-
}
|
|
210
|
-
{
|
|
211
|
-
find: 'quasar/vue-plugin',
|
|
212
|
-
replacement: new URL(
|
|
213
|
-
'src/vue-plugin.js',
|
|
214
|
-
urls?.packages?.quasar
|
|
215
|
-
).pathname
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
find: 'quasar/plugins',
|
|
219
|
-
replacement: new URL('src/plugins.js', urls?.packages?.quasar)
|
|
220
|
-
.pathname
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
find: 'quasar/components',
|
|
224
|
-
replacement: new URL(
|
|
225
|
-
'src/components.js',
|
|
226
|
-
urls?.packages?.quasar
|
|
227
|
-
).pathname
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
find: 'quasar/composables',
|
|
231
|
-
replacement: new URL(
|
|
232
|
-
'src/composables.js',
|
|
233
|
-
urls?.packages?.quasar
|
|
234
|
-
).pathname
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
find: 'quasar/directives',
|
|
238
|
-
replacement: new URL(
|
|
239
|
-
'src/directives.js',
|
|
240
|
-
urls?.packages?.quasar
|
|
241
|
-
).pathname
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
find: 'quasar/src',
|
|
245
|
-
replacement: new URL('src/', urls?.packages?.quasar).pathname
|
|
246
|
-
},
|
|
257
|
+
find: new RegExp('^quasar$'),
|
|
258
|
+
replacement: 'quasar/src/index.all.js'
|
|
259
|
+
}
|
|
247
260
|
// {
|
|
248
261
|
// find: new RegExp('^quasar$'),
|
|
249
262
|
// replacement: new URL('src/index.all.js', urls?.packages?.quasar)
|
|
250
263
|
// .pathname
|
|
251
264
|
// },
|
|
252
|
-
{
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
265
|
+
// {
|
|
266
|
+
// find: `@quasar/extras`,
|
|
267
|
+
// replacement: new URL('.', urls?.packages?.['@quasar/extras'])
|
|
268
|
+
// .pathname
|
|
269
|
+
// }
|
|
257
270
|
// { find: new RegExp('^quasar$'), replacement: 'virtual:quasar' }
|
|
258
271
|
]
|
|
259
272
|
},
|
|
273
|
+
optimizeDeps: {
|
|
274
|
+
exclude: ['quasar']
|
|
275
|
+
},
|
|
260
276
|
define: {
|
|
261
277
|
__DEV__: process.env.NODE_ENV !== 'production' || true,
|
|
262
|
-
__QUASAR_VERSION__: `'${version}'
|
|
263
|
-
|
|
264
|
-
//
|
|
265
|
-
|
|
266
|
-
//
|
|
267
|
-
|
|
268
|
-
//
|
|
269
|
-
|
|
278
|
+
__QUASAR_VERSION__: `'${version}'`,
|
|
279
|
+
__QUASAR_SSR__: !!ssr,
|
|
280
|
+
// __QUASAR_SSR_SERVER__: ssr === 'server',
|
|
281
|
+
__QUASAR_SSR_SERVER__: `import.meta.env.SSR`,
|
|
282
|
+
// __QUASAR_SSR_CLIENT__: ssr === 'client',
|
|
283
|
+
__QUASAR_SSR_CLIENT__: `!import.meta.env.SSR`,
|
|
284
|
+
// __QUASAR_SSR_PWA__: ssr === 'client' && pwa
|
|
285
|
+
__QUASAR_SSR_PWA__: pwa ? `!import.meta.env.SSR` : false
|
|
270
286
|
},
|
|
271
287
|
ssr: {
|
|
272
288
|
noExternal: ['quasar']
|
|
@@ -288,6 +304,8 @@ export const QuasarPlugin: VitrifyPlugin = async ({
|
|
|
288
304
|
switch (id) {
|
|
289
305
|
case 'virtual:quasar-plugins':
|
|
290
306
|
return 'virtual:quasar-plugins'
|
|
307
|
+
case 'virtual:quasar-directives':
|
|
308
|
+
return 'virtual:quasar-directives'
|
|
291
309
|
case 'quasar':
|
|
292
310
|
return { id: 'quasar', moduleSideEffects: false }
|
|
293
311
|
default:
|
|
@@ -297,13 +315,15 @@ export const QuasarPlugin: VitrifyPlugin = async ({
|
|
|
297
315
|
load(id) {
|
|
298
316
|
if (id === 'virtual:quasar-plugins') {
|
|
299
317
|
return `export { ${plugins.join(',')} } from 'quasar'`
|
|
318
|
+
} else if (id === 'virtual:quasar-directives') {
|
|
319
|
+
return `export * from 'quasar/src/directives'`
|
|
300
320
|
} else if (id === 'quasar') {
|
|
301
|
-
return `export * from 'quasar/src/plugins
|
|
302
|
-
export * from 'quasar/src/components
|
|
303
|
-
export * from 'quasar/src/composables
|
|
304
|
-
export * from 'quasar/src/directives
|
|
305
|
-
export * from 'quasar/src/utils
|
|
306
|
-
export { default as Quasar } from 'quasar/src/install-quasar
|
|
321
|
+
return `export * from 'quasar/src/plugins';
|
|
322
|
+
export * from 'quasar/src/components';
|
|
323
|
+
export * from 'quasar/src/composables';
|
|
324
|
+
export * from 'quasar/src/directives';
|
|
325
|
+
export * from 'quasar/src/utils';
|
|
326
|
+
export { default as Quasar } from 'quasar/src/install-quasar'`
|
|
307
327
|
}
|
|
308
328
|
return null
|
|
309
329
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createApp } from '../main.js'
|
|
2
|
-
import { renderToString } from 'vue/server-renderer'
|
|
2
|
+
import { renderToString } from '@vue/server-renderer'
|
|
3
3
|
import type { FastifyInstance } from 'fastify'
|
|
4
4
|
// import * as ApolloSSR from '@vue/apollo-ssr'
|
|
5
5
|
// import { ApolloClients } from '@vue/apollo-composable'
|