vitrify 0.5.2 → 0.5.5
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/app-urls.js +7 -0
- 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 +32 -15
- package/dist/plugins/quasar.js +15 -14
- package/dist/types/app-urls.d.ts +1 -0
- package/dist/types/vitrify-config.d.ts +1 -0
- package/package.json +2 -5
- package/src/node/app-urls.ts +8 -0
- 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 +32 -20
- package/src/node/plugins/quasar.ts +16 -15
- package/src/node/vitrify-config.ts +1 -0
- package/src/vite/vue/csr/app.ts +3 -4
- package/src/vite/vue/main.ts +2 -0
- package/src/vite/vue/ssr/app.ts +3 -4
package/dist/app-urls.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
// import { resolve } from 'import-meta-resolve'
|
|
2
2
|
import { existsSync } from 'fs';
|
|
3
|
+
export const resolve = (packageName, base) => {
|
|
4
|
+
const packageUrl = new URL(`./node_modules/${packageName}/`, base);
|
|
5
|
+
if (existsSync(packageUrl.pathname)) {
|
|
6
|
+
return new URL('./', packageUrl);
|
|
7
|
+
}
|
|
8
|
+
throw new Error(`Package ${packageName} not found in ${base.pathname}.`);
|
|
9
|
+
};
|
|
3
10
|
export const getPkgJsonDir = (dir) => {
|
|
4
11
|
const pkgJsonPath = new URL('package.json', dir);
|
|
5
12
|
if (existsSync(pkgJsonPath.pathname)) {
|
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
|
@@ -6,9 +6,9 @@ import path from 'path';
|
|
|
6
6
|
import { pathToFileURL } from 'url';
|
|
7
7
|
import { readFileSync } from 'fs';
|
|
8
8
|
import builtinModules from 'builtin-modules';
|
|
9
|
-
import { resolve } from 'import-meta-resolve'
|
|
9
|
+
// import { resolve } from 'import-meta-resolve'
|
|
10
10
|
import { visualizer } from 'rollup-plugin-visualizer';
|
|
11
|
-
import { getPkgJsonDir } from './app-urls.js';
|
|
11
|
+
import { getPkgJsonDir, resolve } from './app-urls.js';
|
|
12
12
|
const internalServerModules = [
|
|
13
13
|
'util',
|
|
14
14
|
'vitrify',
|
|
@@ -16,6 +16,8 @@ const internalServerModules = [
|
|
|
16
16
|
'vite',
|
|
17
17
|
'fastify',
|
|
18
18
|
'@fastify/static',
|
|
19
|
+
'@fastify/middie',
|
|
20
|
+
'@fastify',
|
|
19
21
|
'node'
|
|
20
22
|
];
|
|
21
23
|
const configPluginMap = {
|
|
@@ -43,7 +45,9 @@ const manualChunks = (id) => {
|
|
|
43
45
|
export const VIRTUAL_MODULES = [
|
|
44
46
|
'virtual:vitrify-hooks',
|
|
45
47
|
'virtual:global-css',
|
|
46
|
-
'virtual:static-imports'
|
|
48
|
+
'virtual:static-imports',
|
|
49
|
+
'vitrify.sass',
|
|
50
|
+
'vitrify.css'
|
|
47
51
|
];
|
|
48
52
|
async function bundleConfigFile(fileName, isESM = false) {
|
|
49
53
|
const result = await build({
|
|
@@ -133,7 +137,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
133
137
|
const packageUrls = vitrifyConfig.vitrify?.urls?.packages || {};
|
|
134
138
|
await (async () => {
|
|
135
139
|
for (const val of localPackages)
|
|
136
|
-
packageUrls[val] = getPkgJsonDir(new URL(await resolve(val, appDir
|
|
140
|
+
packageUrls[val] = getPkgJsonDir(new URL(await resolve(val, appDir)));
|
|
137
141
|
})();
|
|
138
142
|
// await (async () => {
|
|
139
143
|
// for (const val of cliPackages)
|
|
@@ -175,6 +179,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
175
179
|
let staticImports;
|
|
176
180
|
let sassVariables;
|
|
177
181
|
let additionalData;
|
|
182
|
+
let globalSass;
|
|
178
183
|
let serverModules = internalServerModules;
|
|
179
184
|
if (vitrifyConfig.vitrify?.ssr?.serverModules)
|
|
180
185
|
serverModules = [
|
|
@@ -215,17 +220,20 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
215
220
|
globalCss = config.vitrify?.globalCss || [];
|
|
216
221
|
staticImports = config.vitrify?.staticImports || {};
|
|
217
222
|
sassVariables = config.vitrify?.sass?.variables || {};
|
|
223
|
+
globalSass = config.vitrify?.sass?.global || [];
|
|
218
224
|
additionalData = config.vitrify?.sass?.additionalData || [];
|
|
219
225
|
return {
|
|
220
226
|
css: {
|
|
221
227
|
preprocessorOptions: {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
228
|
+
// sass: {
|
|
229
|
+
// additionalData: [
|
|
230
|
+
// ...Object.entries(sassVariables).map(
|
|
231
|
+
// ([key, value]) => `${key}: ${value}`
|
|
232
|
+
// )
|
|
233
|
+
// // ...additionalData
|
|
234
|
+
// // config.css?.preprocessorOptions?.sass.additionalData
|
|
235
|
+
// ].join('\n')
|
|
236
|
+
// }
|
|
229
237
|
}
|
|
230
238
|
}
|
|
231
239
|
};
|
|
@@ -238,7 +246,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
238
246
|
},
|
|
239
247
|
resolveId(id) {
|
|
240
248
|
if (VIRTUAL_MODULES.includes(id))
|
|
241
|
-
return { id
|
|
249
|
+
return { id };
|
|
242
250
|
return;
|
|
243
251
|
},
|
|
244
252
|
transform: (code, id) => {
|
|
@@ -281,6 +289,15 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
281
289
|
.map(([key, value]) => `export { ${value.join(',')} } from '${key}';`)
|
|
282
290
|
.join('\n')}`;
|
|
283
291
|
}
|
|
292
|
+
else if (id === 'vitrify.sass') {
|
|
293
|
+
return [
|
|
294
|
+
...Object.entries(sassVariables).map(([key, value]) => `${key}: ${value}`),
|
|
295
|
+
...globalSass.map((sass) => `@import '${sass}'`)
|
|
296
|
+
].join('\n');
|
|
297
|
+
}
|
|
298
|
+
else if (id === 'vitrify.css') {
|
|
299
|
+
return `${globalCss.map((css) => `import '${css}'`).join('\n')}`;
|
|
300
|
+
}
|
|
284
301
|
return null;
|
|
285
302
|
}
|
|
286
303
|
}
|
|
@@ -360,7 +377,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
360
377
|
if (command === 'test')
|
|
361
378
|
alias.push({
|
|
362
379
|
find: 'vitest',
|
|
363
|
-
replacement: new URL(await resolve('vitest', cliDir
|
|
380
|
+
replacement: new URL(await resolve('vitest', cliDir)).pathname
|
|
364
381
|
});
|
|
365
382
|
let rollupOptions = {};
|
|
366
383
|
let noExternal = [
|
|
@@ -377,7 +394,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
377
394
|
],
|
|
378
395
|
external,
|
|
379
396
|
output: {
|
|
380
|
-
minifyInternalExports:
|
|
397
|
+
minifyInternalExports: !debug,
|
|
381
398
|
entryFileNames: '[name].mjs',
|
|
382
399
|
chunkFileNames: '[name].mjs',
|
|
383
400
|
format: 'es',
|
|
@@ -433,7 +450,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
433
450
|
// ],
|
|
434
451
|
external,
|
|
435
452
|
output: {
|
|
436
|
-
minifyInternalExports:
|
|
453
|
+
minifyInternalExports: !debug,
|
|
437
454
|
entryFileNames: '[name].mjs',
|
|
438
455
|
chunkFileNames: '[name].mjs',
|
|
439
456
|
format: 'es',
|
package/dist/plugins/quasar.js
CHANGED
|
@@ -3,8 +3,7 @@ import Components from 'unplugin-vue-components/vite';
|
|
|
3
3
|
// import { quasarDir as defaultQuasarDir } from '../app-urls.js'
|
|
4
4
|
// import { QuasarResolver } from '../resolver.js';
|
|
5
5
|
import { QuasarResolver } from 'unplugin-vue-components/resolvers';
|
|
6
|
-
import { getPkgJsonDir } from '../app-urls.js';
|
|
7
|
-
import { resolve } from 'import-meta-resolve';
|
|
6
|
+
import { getPkgJsonDir, resolve } from '../app-urls.js';
|
|
8
7
|
export const injectSsrContext = (html, ssrContext) => html
|
|
9
8
|
.replace(/(<html[^>]*)(>)/i, (found, start, end) => {
|
|
10
9
|
let matches;
|
|
@@ -59,7 +58,7 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
59
58
|
const localPackages = ['@quasar/extras', 'quasar'];
|
|
60
59
|
await (async () => {
|
|
61
60
|
for (const val of localPackages)
|
|
62
|
-
urls.packages[val] = getPkgJsonDir(new URL(await resolve(val, urls.app
|
|
61
|
+
urls.packages[val] = getPkgJsonDir(new URL(await resolve(val, urls.app)));
|
|
63
62
|
})();
|
|
64
63
|
const onMountedHooks = [
|
|
65
64
|
async (instance) => {
|
|
@@ -93,7 +92,8 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
93
92
|
onRendered: [injectSsrContext]
|
|
94
93
|
},
|
|
95
94
|
sass: {
|
|
96
|
-
|
|
95
|
+
global: ['quasar/src/css/index.sass']
|
|
96
|
+
// additionalData: [`@import 'quasar/src/css/index.sass'`]
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
};
|
|
@@ -149,16 +149,17 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
149
149
|
find: 'quasar/src',
|
|
150
150
|
replacement: new URL('src/', urls?.packages?.quasar).pathname
|
|
151
151
|
},
|
|
152
|
-
{
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
},
|
|
152
|
+
// {
|
|
153
|
+
// find: new RegExp('^quasar$'),
|
|
154
|
+
// replacement: new URL('src/index.all.js', urls?.packages?.quasar)
|
|
155
|
+
// .pathname
|
|
156
|
+
// },
|
|
157
157
|
{
|
|
158
158
|
find: `@quasar/extras`,
|
|
159
159
|
replacement: new URL('.', urls?.packages?.['@quasar/extras'])
|
|
160
160
|
.pathname
|
|
161
161
|
}
|
|
162
|
+
// { find: new RegExp('^quasar$'), replacement: 'virtual:quasar' }
|
|
162
163
|
]
|
|
163
164
|
},
|
|
164
165
|
define: {
|
|
@@ -180,11 +181,11 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
180
181
|
},
|
|
181
182
|
{
|
|
182
183
|
name: 'quasar-virtual-modules',
|
|
183
|
-
enforce: '
|
|
184
|
+
enforce: 'pre',
|
|
184
185
|
config: async (config, env) => ({
|
|
185
186
|
resolve: {
|
|
186
187
|
alias: [
|
|
187
|
-
|
|
188
|
+
// { find: new RegExp('^quasar$'), replacement: 'virtual:quasar' }
|
|
188
189
|
]
|
|
189
190
|
}
|
|
190
191
|
}),
|
|
@@ -192,8 +193,8 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
192
193
|
switch (id) {
|
|
193
194
|
case 'virtual:quasar-plugins':
|
|
194
195
|
return 'virtual:quasar-plugins';
|
|
195
|
-
case '
|
|
196
|
-
return { id: '
|
|
196
|
+
case 'quasar':
|
|
197
|
+
return { id: 'quasar', moduleSideEffects: false };
|
|
197
198
|
default:
|
|
198
199
|
return;
|
|
199
200
|
}
|
|
@@ -202,7 +203,7 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
202
203
|
if (id === 'virtual:quasar-plugins') {
|
|
203
204
|
return `export { ${plugins.join(',')} } from 'quasar'`;
|
|
204
205
|
}
|
|
205
|
-
else if (id === '
|
|
206
|
+
else if (id === 'quasar') {
|
|
206
207
|
return `export * from 'quasar/src/plugins.js';
|
|
207
208
|
export * from 'quasar/src/components.js';
|
|
208
209
|
export * from 'quasar/src/composables.js';
|
package/dist/types/app-urls.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitrify",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Stefan van Herwijnen",
|
|
6
6
|
"description": "Pre-configured Vite CLI for your framework",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"@fastify/static": "^6.4.0",
|
|
57
57
|
"@quasar/extras": "^1.14.0",
|
|
58
58
|
"@vitejs/plugin-vue": "^3.0.0-alpha.1",
|
|
59
|
+
"@vue/server-renderer": "^3.2.37",
|
|
59
60
|
"builtin-modules": "^3.3.0",
|
|
60
61
|
"cac": "^6.7.12",
|
|
61
62
|
"chalk": "^5.0.1",
|
|
@@ -64,7 +65,6 @@
|
|
|
64
65
|
"fastify": "^4.0.0",
|
|
65
66
|
"glob": "^8.0.3",
|
|
66
67
|
"happy-dom": "^5.2.0",
|
|
67
|
-
"local-pkg": "^0.4.1",
|
|
68
68
|
"magic-string": "^0.26.2",
|
|
69
69
|
"merge-deep": "^3.0.3",
|
|
70
70
|
"readline": "^1.3.0",
|
|
@@ -82,7 +82,6 @@
|
|
|
82
82
|
"@types/node": "^17.0.41",
|
|
83
83
|
"@types/ws": "^8.5.3",
|
|
84
84
|
"@vue/runtime-core": "^3.2.37",
|
|
85
|
-
"import-meta-resolve": "^2.0.3",
|
|
86
85
|
"quasar": "^2.7.1",
|
|
87
86
|
"rollup": "^2.75.6",
|
|
88
87
|
"typescript": "^4.7.3",
|
|
@@ -93,8 +92,6 @@
|
|
|
93
92
|
"peerDependencies": {
|
|
94
93
|
"@fastify/static": "^6.4.0",
|
|
95
94
|
"fastify": "^4.0.0",
|
|
96
|
-
"fastify-plugin": "^3.0.1",
|
|
97
|
-
"import-meta-resolve": "^2.0.3",
|
|
98
95
|
"quasar": "^2.7.1",
|
|
99
96
|
"vue": "^3.2.37",
|
|
100
97
|
"vue-router": "^4.0.15"
|
package/src/node/app-urls.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
// import { resolve } from 'import-meta-resolve'
|
|
2
2
|
import { existsSync } from 'fs'
|
|
3
3
|
|
|
4
|
+
export const resolve = (packageName: string, base: URL) => {
|
|
5
|
+
const packageUrl = new URL(`./node_modules/${packageName}/`, base)
|
|
6
|
+
if (existsSync(packageUrl.pathname)) {
|
|
7
|
+
return new URL('./', packageUrl)
|
|
8
|
+
}
|
|
9
|
+
throw new Error(`Package ${packageName} not found in ${base.pathname}.`)
|
|
10
|
+
}
|
|
11
|
+
|
|
4
12
|
export const getPkgJsonDir = (dir: URL): URL => {
|
|
5
13
|
const pkgJsonPath = new URL('package.json', dir)
|
|
6
14
|
if (existsSync(pkgJsonPath.pathname)) {
|
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
|
@@ -8,7 +8,7 @@ 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'
|
|
11
|
+
// import { resolve } from 'import-meta-resolve'
|
|
12
12
|
import { visualizer } from 'rollup-plugin-visualizer'
|
|
13
13
|
import type {
|
|
14
14
|
StaticImports,
|
|
@@ -21,7 +21,7 @@ import type {
|
|
|
21
21
|
} from './vitrify-config.js'
|
|
22
22
|
import type { VitrifyContext } from './bin/run.js'
|
|
23
23
|
import type { VitrifyPlugin } from './plugins/index.js'
|
|
24
|
-
import { getPkgJsonDir } from './app-urls.js'
|
|
24
|
+
import { getPkgJsonDir, resolve } from './app-urls.js'
|
|
25
25
|
import type { ManualChunksOption, RollupOptions } from 'rollup'
|
|
26
26
|
|
|
27
27
|
const internalServerModules = [
|
|
@@ -31,6 +31,8 @@ const internalServerModules = [
|
|
|
31
31
|
'vite',
|
|
32
32
|
'fastify',
|
|
33
33
|
'@fastify/static',
|
|
34
|
+
'@fastify/middie',
|
|
35
|
+
'@fastify',
|
|
34
36
|
'node'
|
|
35
37
|
]
|
|
36
38
|
|
|
@@ -61,7 +63,9 @@ const manualChunks: ManualChunksOption = (id: string) => {
|
|
|
61
63
|
export const VIRTUAL_MODULES = [
|
|
62
64
|
'virtual:vitrify-hooks',
|
|
63
65
|
'virtual:global-css',
|
|
64
|
-
'virtual:static-imports'
|
|
66
|
+
'virtual:static-imports',
|
|
67
|
+
'vitrify.sass',
|
|
68
|
+
'vitrify.css'
|
|
65
69
|
]
|
|
66
70
|
|
|
67
71
|
async function bundleConfigFile(
|
|
@@ -196,9 +200,7 @@ export const baseConfig = async ({
|
|
|
196
200
|
vitrifyConfig.vitrify?.urls?.packages || {}
|
|
197
201
|
await (async () => {
|
|
198
202
|
for (const val of localPackages)
|
|
199
|
-
packageUrls[val] = getPkgJsonDir(
|
|
200
|
-
new URL(await resolve(val, appDir!.href))
|
|
201
|
-
)
|
|
203
|
+
packageUrls[val] = getPkgJsonDir(new URL(await resolve(val, appDir)))
|
|
202
204
|
})()
|
|
203
205
|
|
|
204
206
|
// await (async () => {
|
|
@@ -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
|
}
|
|
@@ -446,7 +458,7 @@ export const baseConfig = async ({
|
|
|
446
458
|
if (command === 'test')
|
|
447
459
|
alias.push({
|
|
448
460
|
find: 'vitest',
|
|
449
|
-
replacement: new URL(await resolve('vitest', cliDir
|
|
461
|
+
replacement: new URL(await resolve('vitest', cliDir)).pathname
|
|
450
462
|
})
|
|
451
463
|
|
|
452
464
|
let rollupOptions: RollupOptions = {}
|
|
@@ -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',
|
|
@@ -12,9 +12,9 @@ import type {
|
|
|
12
12
|
// import { QuasarResolver } from '../resolver.js';
|
|
13
13
|
import { QuasarResolver } from 'unplugin-vue-components/resolvers'
|
|
14
14
|
import type { VitrifyPlugin } from './index.js'
|
|
15
|
-
import { getPkgJsonDir } from '../app-urls.js'
|
|
15
|
+
import { getPkgJsonDir, resolve } from '../app-urls.js'
|
|
16
16
|
|
|
17
|
-
import { resolve } from 'import-meta-resolve'
|
|
17
|
+
// import { resolve } from 'import-meta-resolve'
|
|
18
18
|
|
|
19
19
|
export interface QuasarConf {
|
|
20
20
|
ctx: Record<string, any>
|
|
@@ -123,7 +123,7 @@ export const QuasarPlugin: VitrifyPlugin = async ({
|
|
|
123
123
|
await (async () => {
|
|
124
124
|
for (const val of localPackages)
|
|
125
125
|
urls!.packages![val] = getPkgJsonDir(
|
|
126
|
-
new URL(await resolve(val, urls!.app
|
|
126
|
+
new URL(await resolve(val, urls!.app!))
|
|
127
127
|
)
|
|
128
128
|
})()
|
|
129
129
|
|
|
@@ -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';
|
package/src/vite/vue/csr/app.ts
CHANGED
|
@@ -4,22 +4,21 @@ import { getAppDir } from '../../../node/app-urls.js'
|
|
|
4
4
|
import { onRendered, onSetup } from 'virtual:vitrify-hooks'
|
|
5
5
|
import { fastifyCsrPlugin } from './fastify-csr-plugin.js'
|
|
6
6
|
import type { ViteDevServer } from 'vite'
|
|
7
|
-
|
|
8
|
-
const { resolve } = imr
|
|
7
|
+
|
|
9
8
|
// const appDir = getPkgJsonDir(import.meta.url)
|
|
10
9
|
const getString = (str?: string) => str
|
|
11
10
|
let baseUrl = getString(__BASE_URL__)
|
|
12
11
|
const appDir = getAppDir()
|
|
13
12
|
|
|
14
13
|
export const setupApp = async () => {
|
|
15
|
-
const vitrifyDir = new URL('../', await resolve('vitrify', import.meta.url))
|
|
14
|
+
// const vitrifyDir = new URL('../', await resolve('vitrify', new URL(import.meta.url)))
|
|
16
15
|
return createApp({
|
|
17
16
|
onSetup,
|
|
18
17
|
appDir,
|
|
19
18
|
baseUrl,
|
|
20
19
|
onRendered,
|
|
21
20
|
fastifyPlugin: fastifyCsrPlugin,
|
|
22
|
-
vitrifyDir,
|
|
21
|
+
// vitrifyDir,
|
|
23
22
|
mode: import.meta.env.MODE
|
|
24
23
|
})
|
|
25
24
|
}
|
package/src/vite/vue/main.ts
CHANGED
package/src/vite/vue/ssr/app.ts
CHANGED
|
@@ -4,22 +4,21 @@ import { getAppDir } from '../../../node/app-urls.js'
|
|
|
4
4
|
import { onRendered, onSetup } from 'virtual:vitrify-hooks'
|
|
5
5
|
import { fastifySsrPlugin } from './fastify-ssr-plugin.js'
|
|
6
6
|
import type { ViteDevServer } from 'vite'
|
|
7
|
-
|
|
8
|
-
const { resolve } = imr
|
|
7
|
+
|
|
9
8
|
// const appDir = getPkgJsonDir(import.meta.url)
|
|
10
9
|
const getString = (str?: string) => str
|
|
11
10
|
let baseUrl = getString(__BASE_URL__)
|
|
12
11
|
const appDir = getAppDir()
|
|
13
12
|
|
|
14
13
|
export const setupApp = async () => {
|
|
15
|
-
const vitrifyDir = new URL('../', await resolve('vitrify', import.meta.url))
|
|
14
|
+
// const vitrifyDir = new URL('../', await resolve('vitrify', new URL(import.meta.url)))
|
|
16
15
|
return createApp({
|
|
17
16
|
onSetup,
|
|
18
17
|
appDir,
|
|
19
18
|
baseUrl,
|
|
20
19
|
onRendered,
|
|
21
20
|
fastifyPlugin: fastifySsrPlugin,
|
|
22
|
-
vitrifyDir,
|
|
21
|
+
// vitrifyDir,
|
|
23
22
|
mode: import.meta.env.MODE
|
|
24
23
|
})
|
|
25
24
|
}
|