vitrify 0.5.2 → 0.5.3
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/build.js +1 -1
- package/dist/bin/dev.js +0 -1
- package/dist/frameworks/vue/fastify-csr-plugin.js +1 -1
- package/dist/frameworks/vue/fastify-ssr-plugin.js +1 -1
- package/dist/index.js +26 -11
- package/dist/plugins/quasar.js +13 -11
- package/dist/types/vitrify-config.d.ts +1 -0
- package/package.json +1 -2
- package/src/node/bin/build.ts +1 -1
- package/src/node/bin/dev.ts +0 -1
- package/src/node/frameworks/vue/fastify-csr-plugin.ts +1 -1
- package/src/node/frameworks/vue/fastify-ssr-plugin.ts +1 -1
- package/src/node/index.ts +26 -14
- package/src/node/plugins/quasar.ts +13 -12
- package/src/node/vitrify-config.ts +1 -0
- package/src/vite/vue/main.ts +2 -0
package/dist/bin/build.js
CHANGED
package/dist/bin/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import fastifyStatic from '@fastify/static';
|
|
2
2
|
import { readFileSync } from 'fs';
|
|
3
3
|
import { componentsModules, collectCss } from '../../helpers/collect-css-ssr.js';
|
|
4
4
|
const fastifySsrPlugin = async (fastify, options, done) => {
|
package/dist/index.js
CHANGED
|
@@ -43,7 +43,9 @@ const manualChunks = (id) => {
|
|
|
43
43
|
export const VIRTUAL_MODULES = [
|
|
44
44
|
'virtual:vitrify-hooks',
|
|
45
45
|
'virtual:global-css',
|
|
46
|
-
'virtual:static-imports'
|
|
46
|
+
'virtual:static-imports',
|
|
47
|
+
'vitrify.sass',
|
|
48
|
+
'vitrify.css'
|
|
47
49
|
];
|
|
48
50
|
async function bundleConfigFile(fileName, isESM = false) {
|
|
49
51
|
const result = await build({
|
|
@@ -175,6 +177,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
175
177
|
let staticImports;
|
|
176
178
|
let sassVariables;
|
|
177
179
|
let additionalData;
|
|
180
|
+
let globalSass;
|
|
178
181
|
let serverModules = internalServerModules;
|
|
179
182
|
if (vitrifyConfig.vitrify?.ssr?.serverModules)
|
|
180
183
|
serverModules = [
|
|
@@ -215,17 +218,20 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
215
218
|
globalCss = config.vitrify?.globalCss || [];
|
|
216
219
|
staticImports = config.vitrify?.staticImports || {};
|
|
217
220
|
sassVariables = config.vitrify?.sass?.variables || {};
|
|
221
|
+
globalSass = config.vitrify?.sass?.global || [];
|
|
218
222
|
additionalData = config.vitrify?.sass?.additionalData || [];
|
|
219
223
|
return {
|
|
220
224
|
css: {
|
|
221
225
|
preprocessorOptions: {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
226
|
+
// sass: {
|
|
227
|
+
// additionalData: [
|
|
228
|
+
// ...Object.entries(sassVariables).map(
|
|
229
|
+
// ([key, value]) => `${key}: ${value}`
|
|
230
|
+
// )
|
|
231
|
+
// // ...additionalData
|
|
232
|
+
// // config.css?.preprocessorOptions?.sass.additionalData
|
|
233
|
+
// ].join('\n')
|
|
234
|
+
// }
|
|
229
235
|
}
|
|
230
236
|
}
|
|
231
237
|
};
|
|
@@ -238,7 +244,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
238
244
|
},
|
|
239
245
|
resolveId(id) {
|
|
240
246
|
if (VIRTUAL_MODULES.includes(id))
|
|
241
|
-
return { id
|
|
247
|
+
return { id };
|
|
242
248
|
return;
|
|
243
249
|
},
|
|
244
250
|
transform: (code, id) => {
|
|
@@ -281,6 +287,15 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
281
287
|
.map(([key, value]) => `export { ${value.join(',')} } from '${key}';`)
|
|
282
288
|
.join('\n')}`;
|
|
283
289
|
}
|
|
290
|
+
else if (id === 'vitrify.sass') {
|
|
291
|
+
return [
|
|
292
|
+
...Object.entries(sassVariables).map(([key, value]) => `${key}: ${value}`),
|
|
293
|
+
...globalSass.map((sass) => `@import '${sass}'`)
|
|
294
|
+
].join('\n');
|
|
295
|
+
}
|
|
296
|
+
else if (id === 'vitrify.css') {
|
|
297
|
+
return `${globalCss.map((css) => `import '${css}'`).join('\n')}`;
|
|
298
|
+
}
|
|
284
299
|
return null;
|
|
285
300
|
}
|
|
286
301
|
}
|
|
@@ -377,7 +392,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
377
392
|
],
|
|
378
393
|
external,
|
|
379
394
|
output: {
|
|
380
|
-
minifyInternalExports:
|
|
395
|
+
minifyInternalExports: !debug,
|
|
381
396
|
entryFileNames: '[name].mjs',
|
|
382
397
|
chunkFileNames: '[name].mjs',
|
|
383
398
|
format: 'es',
|
|
@@ -433,7 +448,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
433
448
|
// ],
|
|
434
449
|
external,
|
|
435
450
|
output: {
|
|
436
|
-
minifyInternalExports:
|
|
451
|
+
minifyInternalExports: !debug,
|
|
437
452
|
entryFileNames: '[name].mjs',
|
|
438
453
|
chunkFileNames: '[name].mjs',
|
|
439
454
|
format: 'es',
|
package/dist/plugins/quasar.js
CHANGED
|
@@ -93,7 +93,8 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
93
93
|
onRendered: [injectSsrContext]
|
|
94
94
|
},
|
|
95
95
|
sass: {
|
|
96
|
-
|
|
96
|
+
global: ['quasar/src/css/index.sass']
|
|
97
|
+
// additionalData: [`@import 'quasar/src/css/index.sass'`]
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
};
|
|
@@ -149,16 +150,17 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
149
150
|
find: 'quasar/src',
|
|
150
151
|
replacement: new URL('src/', urls?.packages?.quasar).pathname
|
|
151
152
|
},
|
|
152
|
-
{
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
},
|
|
153
|
+
// {
|
|
154
|
+
// find: new RegExp('^quasar$'),
|
|
155
|
+
// replacement: new URL('src/index.all.js', urls?.packages?.quasar)
|
|
156
|
+
// .pathname
|
|
157
|
+
// },
|
|
157
158
|
{
|
|
158
159
|
find: `@quasar/extras`,
|
|
159
160
|
replacement: new URL('.', urls?.packages?.['@quasar/extras'])
|
|
160
161
|
.pathname
|
|
161
162
|
}
|
|
163
|
+
// { find: new RegExp('^quasar$'), replacement: 'virtual:quasar' }
|
|
162
164
|
]
|
|
163
165
|
},
|
|
164
166
|
define: {
|
|
@@ -180,11 +182,11 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
180
182
|
},
|
|
181
183
|
{
|
|
182
184
|
name: 'quasar-virtual-modules',
|
|
183
|
-
enforce: '
|
|
185
|
+
enforce: 'pre',
|
|
184
186
|
config: async (config, env) => ({
|
|
185
187
|
resolve: {
|
|
186
188
|
alias: [
|
|
187
|
-
|
|
189
|
+
// { find: new RegExp('^quasar$'), replacement: 'virtual:quasar' }
|
|
188
190
|
]
|
|
189
191
|
}
|
|
190
192
|
}),
|
|
@@ -192,8 +194,8 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
192
194
|
switch (id) {
|
|
193
195
|
case 'virtual:quasar-plugins':
|
|
194
196
|
return 'virtual:quasar-plugins';
|
|
195
|
-
case '
|
|
196
|
-
return { id: '
|
|
197
|
+
case 'quasar':
|
|
198
|
+
return { id: 'quasar', moduleSideEffects: false };
|
|
197
199
|
default:
|
|
198
200
|
return;
|
|
199
201
|
}
|
|
@@ -202,7 +204,7 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
202
204
|
if (id === 'virtual:quasar-plugins') {
|
|
203
205
|
return `export { ${plugins.join(',')} } from 'quasar'`;
|
|
204
206
|
}
|
|
205
|
-
else if (id === '
|
|
207
|
+
else if (id === 'quasar') {
|
|
206
208
|
return `export * from 'quasar/src/plugins.js';
|
|
207
209
|
export * from 'quasar/src/components.js';
|
|
208
210
|
export * from 'quasar/src/composables.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitrify",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Stefan van Herwijnen",
|
|
6
6
|
"description": "Pre-configured Vite CLI for your framework",
|
|
@@ -93,7 +93,6 @@
|
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"@fastify/static": "^6.4.0",
|
|
95
95
|
"fastify": "^4.0.0",
|
|
96
|
-
"fastify-plugin": "^3.0.1",
|
|
97
96
|
"import-meta-resolve": "^2.0.3",
|
|
98
97
|
"quasar": "^2.7.1",
|
|
99
98
|
"vue": "^3.2.37",
|
package/src/node/bin/build.ts
CHANGED
package/src/node/bin/dev.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
FastifyRequest,
|
|
4
4
|
FastifyReply
|
|
5
5
|
} from 'fastify'
|
|
6
|
-
import
|
|
6
|
+
import fastifyStatic from '@fastify/static'
|
|
7
7
|
import type { OnRenderedHook } from '../../vitrify-config.js'
|
|
8
8
|
import type { ViteDevServer } from 'vite'
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
FastifyRequest,
|
|
4
4
|
FastifyReply
|
|
5
5
|
} from 'fastify'
|
|
6
|
-
import
|
|
6
|
+
import fastifyStatic from '@fastify/static'
|
|
7
7
|
import { readFileSync } from 'fs'
|
|
8
8
|
import type { OnRenderedHook } from '../../vitrify-config.js'
|
|
9
9
|
import { componentsModules, collectCss } from '../../helpers/collect-css-ssr.js'
|
package/src/node/index.ts
CHANGED
|
@@ -61,7 +61,9 @@ const manualChunks: ManualChunksOption = (id: string) => {
|
|
|
61
61
|
export const VIRTUAL_MODULES = [
|
|
62
62
|
'virtual:vitrify-hooks',
|
|
63
63
|
'virtual:global-css',
|
|
64
|
-
'virtual:static-imports'
|
|
64
|
+
'virtual:static-imports',
|
|
65
|
+
'vitrify.sass',
|
|
66
|
+
'vitrify.css'
|
|
65
67
|
]
|
|
66
68
|
|
|
67
69
|
async function bundleConfigFile(
|
|
@@ -247,6 +249,7 @@ export const baseConfig = async ({
|
|
|
247
249
|
let staticImports: StaticImports
|
|
248
250
|
let sassVariables: Record<string, string>
|
|
249
251
|
let additionalData: string[]
|
|
252
|
+
let globalSass: string[]
|
|
250
253
|
let serverModules: string[] = internalServerModules
|
|
251
254
|
|
|
252
255
|
if (vitrifyConfig.vitrify?.ssr?.serverModules)
|
|
@@ -289,20 +292,21 @@ export const baseConfig = async ({
|
|
|
289
292
|
globalCss = config.vitrify?.globalCss || []
|
|
290
293
|
staticImports = config.vitrify?.staticImports || {}
|
|
291
294
|
sassVariables = config.vitrify?.sass?.variables || {}
|
|
295
|
+
globalSass = config.vitrify?.sass?.global || []
|
|
292
296
|
additionalData = config.vitrify?.sass?.additionalData || []
|
|
293
297
|
|
|
294
298
|
return {
|
|
295
299
|
css: {
|
|
296
300
|
preprocessorOptions: {
|
|
297
|
-
sass: {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}
|
|
301
|
+
// sass: {
|
|
302
|
+
// additionalData: [
|
|
303
|
+
// ...Object.entries(sassVariables).map(
|
|
304
|
+
// ([key, value]) => `${key}: ${value}`
|
|
305
|
+
// )
|
|
306
|
+
// // ...additionalData
|
|
307
|
+
// // config.css?.preprocessorOptions?.sass.additionalData
|
|
308
|
+
// ].join('\n')
|
|
309
|
+
// }
|
|
306
310
|
}
|
|
307
311
|
}
|
|
308
312
|
}
|
|
@@ -314,8 +318,7 @@ export const baseConfig = async ({
|
|
|
314
318
|
}
|
|
315
319
|
},
|
|
316
320
|
resolveId(id) {
|
|
317
|
-
if (VIRTUAL_MODULES.includes(id))
|
|
318
|
-
return { id, moduleSideEffects: false }
|
|
321
|
+
if (VIRTUAL_MODULES.includes(id)) return { id }
|
|
319
322
|
return
|
|
320
323
|
},
|
|
321
324
|
transform: (code, id) => {
|
|
@@ -363,6 +366,15 @@ export const baseConfig = async ({
|
|
|
363
366
|
([key, value]) => `export { ${value.join(',')} } from '${key}';`
|
|
364
367
|
)
|
|
365
368
|
.join('\n')}`
|
|
369
|
+
} else if (id === 'vitrify.sass') {
|
|
370
|
+
return [
|
|
371
|
+
...Object.entries(sassVariables).map(
|
|
372
|
+
([key, value]) => `${key}: ${value}`
|
|
373
|
+
),
|
|
374
|
+
...globalSass.map((sass) => `@import '${sass}'`)
|
|
375
|
+
].join('\n')
|
|
376
|
+
} else if (id === 'vitrify.css') {
|
|
377
|
+
return `${globalCss.map((css) => `import '${css}'`).join('\n')}`
|
|
366
378
|
}
|
|
367
379
|
return null
|
|
368
380
|
}
|
|
@@ -465,7 +477,7 @@ export const baseConfig = async ({
|
|
|
465
477
|
],
|
|
466
478
|
external,
|
|
467
479
|
output: {
|
|
468
|
-
minifyInternalExports:
|
|
480
|
+
minifyInternalExports: !debug,
|
|
469
481
|
entryFileNames: '[name].mjs',
|
|
470
482
|
chunkFileNames: '[name].mjs',
|
|
471
483
|
format: 'es',
|
|
@@ -519,7 +531,7 @@ export const baseConfig = async ({
|
|
|
519
531
|
// ],
|
|
520
532
|
external,
|
|
521
533
|
output: {
|
|
522
|
-
minifyInternalExports:
|
|
534
|
+
minifyInternalExports: !debug,
|
|
523
535
|
entryFileNames: '[name].mjs',
|
|
524
536
|
chunkFileNames: '[name].mjs',
|
|
525
537
|
format: 'es',
|
|
@@ -168,7 +168,8 @@ export const QuasarPlugin: VitrifyPlugin = async ({
|
|
|
168
168
|
onRendered: [injectSsrContext]
|
|
169
169
|
},
|
|
170
170
|
sass: {
|
|
171
|
-
|
|
171
|
+
global: ['quasar/src/css/index.sass']
|
|
172
|
+
// additionalData: [`@import 'quasar/src/css/index.sass'`]
|
|
172
173
|
}
|
|
173
174
|
}
|
|
174
175
|
}
|
|
@@ -232,7 +233,6 @@ export const QuasarPlugin: VitrifyPlugin = async ({
|
|
|
232
233
|
urls?.packages?.quasar
|
|
233
234
|
).pathname
|
|
234
235
|
},
|
|
235
|
-
|
|
236
236
|
{
|
|
237
237
|
find: 'quasar/directives',
|
|
238
238
|
replacement: new URL(
|
|
@@ -244,16 +244,17 @@ export const QuasarPlugin: VitrifyPlugin = async ({
|
|
|
244
244
|
find: 'quasar/src',
|
|
245
245
|
replacement: new URL('src/', urls?.packages?.quasar).pathname
|
|
246
246
|
},
|
|
247
|
-
{
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
},
|
|
247
|
+
// {
|
|
248
|
+
// find: new RegExp('^quasar$'),
|
|
249
|
+
// replacement: new URL('src/index.all.js', urls?.packages?.quasar)
|
|
250
|
+
// .pathname
|
|
251
|
+
// },
|
|
252
252
|
{
|
|
253
253
|
find: `@quasar/extras`,
|
|
254
254
|
replacement: new URL('.', urls?.packages?.['@quasar/extras'])
|
|
255
255
|
.pathname
|
|
256
256
|
}
|
|
257
|
+
// { find: new RegExp('^quasar$'), replacement: 'virtual:quasar' }
|
|
257
258
|
]
|
|
258
259
|
},
|
|
259
260
|
define: {
|
|
@@ -275,11 +276,11 @@ export const QuasarPlugin: VitrifyPlugin = async ({
|
|
|
275
276
|
},
|
|
276
277
|
{
|
|
277
278
|
name: 'quasar-virtual-modules',
|
|
278
|
-
enforce: '
|
|
279
|
+
enforce: 'pre',
|
|
279
280
|
config: async (config, env) => ({
|
|
280
281
|
resolve: {
|
|
281
282
|
alias: [
|
|
282
|
-
{ find: new RegExp('^quasar$'), replacement: 'virtual:quasar' }
|
|
283
|
+
// { find: new RegExp('^quasar$'), replacement: 'virtual:quasar' }
|
|
283
284
|
]
|
|
284
285
|
}
|
|
285
286
|
}),
|
|
@@ -287,8 +288,8 @@ export const QuasarPlugin: VitrifyPlugin = async ({
|
|
|
287
288
|
switch (id) {
|
|
288
289
|
case 'virtual:quasar-plugins':
|
|
289
290
|
return 'virtual:quasar-plugins'
|
|
290
|
-
case '
|
|
291
|
-
return { id: '
|
|
291
|
+
case 'quasar':
|
|
292
|
+
return { id: 'quasar', moduleSideEffects: false }
|
|
292
293
|
default:
|
|
293
294
|
return
|
|
294
295
|
}
|
|
@@ -296,7 +297,7 @@ export const QuasarPlugin: VitrifyPlugin = async ({
|
|
|
296
297
|
load(id) {
|
|
297
298
|
if (id === 'virtual:quasar-plugins') {
|
|
298
299
|
return `export { ${plugins.join(',')} } from 'quasar'`
|
|
299
|
-
} else if (id === '
|
|
300
|
+
} else if (id === 'quasar') {
|
|
300
301
|
return `export * from 'quasar/src/plugins.js';
|
|
301
302
|
export * from 'quasar/src/components.js';
|
|
302
303
|
export * from 'quasar/src/composables.js';
|