vitrify 0.1.0 → 0.1.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.
Files changed (44) hide show
  1. package/README.md +86 -0
  2. package/dist/app-urls.js +32 -0
  3. package/dist/bin/build.js +73 -0
  4. package/dist/bin/cli.js +137 -0
  5. package/dist/bin/dev.js +106 -0
  6. package/dist/bin/run.js +26 -0
  7. package/dist/helpers/logger.js +108 -0
  8. package/dist/helpers/routes.js +24 -0
  9. package/dist/helpers/utils.js +24 -0
  10. package/dist/index.js +288 -0
  11. package/dist/plugins/index.js +1 -0
  12. package/dist/plugins/quasar.js +294 -0
  13. package/dist/types/app-urls.d.ts +11 -0
  14. package/dist/types/bin/build.d.ts +8 -0
  15. package/dist/types/bin/cli.d.ts +2 -0
  16. package/dist/types/bin/dev.d.ts +15 -0
  17. package/dist/types/bin/run.d.ts +8 -0
  18. package/dist/types/bin/test.d.ts +3 -0
  19. package/dist/types/helpers/logger.d.ts +23 -0
  20. package/dist/types/helpers/routes.d.ts +2 -0
  21. package/dist/types/helpers/utils.d.ts +5 -0
  22. package/dist/types/index.d.ts +15 -0
  23. package/dist/types/plugins/index.d.ts +7 -0
  24. package/dist/types/plugins/quasar.d.ts +16 -0
  25. package/dist/types/vitrify-config.d.ts +64 -0
  26. package/dist/types/vue/fastify-ssr-plugin.d.ts +14 -0
  27. package/dist/types/vue/prerender.d.ts +8 -0
  28. package/dist/types/vue/server.d.ts +9 -0
  29. package/dist/vitrify-config.js +1 -0
  30. package/dist/vue/fastify-ssr-plugin.js +91 -0
  31. package/dist/vue/prerender.js +29 -0
  32. package/dist/vue/server.js +20 -0
  33. package/package.json +94 -18
  34. package/src/vite/vue/components.d.ts +25 -0
  35. package/src/vite/vue/csr/entry.ts +8 -0
  36. package/src/vite/vue/index.html +16 -0
  37. package/src/vite/vue/main.ts +89 -0
  38. package/src/vite/vue/ssr/entry-client.ts +9 -0
  39. package/src/vite/vue/ssr/entry-server.ts +97 -0
  40. package/src/vite/vue/ssr/fastify-ssr-plugin.ts +120 -0
  41. package/src/vite/vue/ssr/prerender.ts +4 -0
  42. package/src/vite/vue/ssr/server.ts +15 -0
  43. package/src/vite/vue/ssr/server.ts.bak +61 -0
  44. package/src/vite/vue/ssr/tsconfig.json +9 -0
package/dist/index.js ADDED
@@ -0,0 +1,288 @@
1
+ import vuePlugin from '@vitejs/plugin-vue';
2
+ import { mergeConfig } from 'vite';
3
+ import { readFileSync } from 'fs';
4
+ import builtinModules from 'builtin-modules';
5
+ import { resolve } from 'import-meta-resolve';
6
+ import { getPkgJsonDir } from './app-urls.js';
7
+ const serverModules = ['fastify', 'middie'];
8
+ const configPluginMap = {
9
+ quasar: () => import('./plugins/quasar.js').then((module) => module.QuasarPlugin)
10
+ };
11
+ export const VIRTUAL_MODULES = [
12
+ 'virtual:fastify-setup',
13
+ 'virtual:boot-functions',
14
+ 'virtual:ssr-functions',
15
+ 'virtual:on-mounted-hooks',
16
+ 'virtual:global-css',
17
+ 'virtual:static-imports'
18
+ ];
19
+ export const baseConfig = async ({ ssr, appDir, publicDir, command = 'build', mode = 'production', framework = 'vue', pwa = false }) => {
20
+ const { appDir: tempAppDir, cliDir, cliViteDir, srcDir } = await import('./app-urls.js');
21
+ const cwd = appDir || tempAppDir;
22
+ const frameworkDir = new URL(`${framework}/`, cliViteDir);
23
+ if (!appDir)
24
+ appDir = tempAppDir;
25
+ // const localPackages = ['vue', 'vue-router', 'quasar']
26
+ const localPackages = ['vue', 'vue-router'];
27
+ const cliPackages = ['vitest'];
28
+ const packageUrls = {};
29
+ await (async () => {
30
+ for (const val of localPackages)
31
+ packageUrls[val] = getPkgJsonDir(new URL(await resolve(val, appDir.href)));
32
+ })();
33
+ await (async () => {
34
+ for (const val of cliPackages)
35
+ packageUrls[val] = getPkgJsonDir(new URL(await resolve(val, cliDir.href)));
36
+ })();
37
+ // if (appDir) {
38
+ // srcDir = new URL('src/', appDir);
39
+ // quasarDir = new URL(await resolve('quasar/', appDir.href));
40
+ // ({ appDir: cwd, cliDir } = await import('./app-urls.js'))
41
+ // } else {
42
+ // ({ appDir, cliDir, srcDir, quasarDir } = await import('./app-urls.js'))
43
+ // cwd = appDir
44
+ // }
45
+ // vueDir = new URL('./', await resolve('vue', appDir.href));
46
+ // vueRouterDir = new URL('../', await resolve('vue-router', appDir.href));
47
+ // vitestDir = new URL('../', await resolve('vitest', cliDir.href));
48
+ if (!publicDir)
49
+ publicDir = new URL('public/', appDir);
50
+ /**
51
+ * TODO:Perform some manual check if command is run inside a Quasar Project
52
+ */
53
+ let vitrifyConfig;
54
+ try {
55
+ vitrifyConfig = (await import(new URL('vitrify.config.js', appDir).pathname)).default;
56
+ if (typeof vitrifyConfig === 'function')
57
+ vitrifyConfig = vitrifyConfig({ mode, command });
58
+ }
59
+ catch (e) {
60
+ console.error(e);
61
+ console.log('No vitrify.config.js file found, using defaults');
62
+ vitrifyConfig = {};
63
+ }
64
+ const { productName = 'Product name' } = JSON.parse(readFileSync(new URL('package.json', appDir).pathname, {
65
+ encoding: 'utf-8'
66
+ }));
67
+ const fastifySetup = vitrifyConfig.vitrify?.fastify?.setup || ((fastify) => { });
68
+ const sass = [];
69
+ const sassVariables = vitrifyConfig.vitrify?.sassVariables;
70
+ if (sassVariables) {
71
+ for (const variable in sassVariables) {
72
+ sass.push(`${variable}: ${sassVariables[variable]}`);
73
+ }
74
+ }
75
+ const ssrTransformCustomDir = () => {
76
+ return {
77
+ props: [],
78
+ needRuntime: true
79
+ };
80
+ };
81
+ const frameworkPlugins = [];
82
+ for (const framework of Object.keys(configPluginMap)) {
83
+ if (Object.keys(vitrifyConfig).includes(framework)) {
84
+ const plugin = await configPluginMap[framework]();
85
+ frameworkPlugins.push(await plugin({
86
+ ssr,
87
+ pwa
88
+ }));
89
+ }
90
+ }
91
+ let bootFunctions;
92
+ let ssrFunctions;
93
+ let onMountedHooks;
94
+ let globalCss;
95
+ let staticImports;
96
+ const plugins = [
97
+ vuePlugin({
98
+ template: {
99
+ ssr: !!ssr,
100
+ compilerOptions: {
101
+ directiveTransforms: {
102
+ 'close-popup': ssrTransformCustomDir,
103
+ intersection: ssrTransformCustomDir,
104
+ ripple: ssrTransformCustomDir,
105
+ mutation: ssrTransformCustomDir,
106
+ morph: ssrTransformCustomDir,
107
+ scroll: ssrTransformCustomDir,
108
+ 'scroll-fire': ssrTransformCustomDir,
109
+ 'touch-hold': ssrTransformCustomDir,
110
+ 'touch-pan': ssrTransformCustomDir,
111
+ 'touch-repeat': ssrTransformCustomDir,
112
+ 'touch-swipe': ssrTransformCustomDir
113
+ }
114
+ }
115
+ }
116
+ }),
117
+ ...frameworkPlugins,
118
+ // await QuasarPlugin({
119
+ // ssr: ssr,
120
+ // pwa: pwa
121
+ // // quasarDir: packageUrls.quasar
122
+ // }),
123
+ {
124
+ name: 'vitrify-virtual-modules',
125
+ enforce: 'post',
126
+ config: async (config, env) => {
127
+ bootFunctions = config.vitrify?.bootFunctions || [];
128
+ ssrFunctions = config.vitrify?.ssrFunctions || [];
129
+ onMountedHooks = config.vitrify?.hooks?.onMounted || [];
130
+ globalCss = config.vitrify?.globalCss || [];
131
+ staticImports = config.vitrify?.staticImports || {};
132
+ },
133
+ resolveId(id) {
134
+ if (VIRTUAL_MODULES.includes(id))
135
+ return id;
136
+ return;
137
+ },
138
+ load(id) {
139
+ if (id === 'virtual:fastify-setup') {
140
+ return `export const setup = ${String(fastifySetup)}`;
141
+ }
142
+ else if (id === 'virtual:boot-functions') {
143
+ return `export default [${bootFunctions
144
+ .map((fn) => `${String(fn)}`)
145
+ .join(', ')}]`;
146
+ }
147
+ else if (id === 'virtual:ssr-functions') {
148
+ return `export default [${ssrFunctions
149
+ .map((fn) => `${String(fn)}`)
150
+ .join(', ')}]`;
151
+ }
152
+ else if (id === 'virtual:on-mounted-hooks') {
153
+ return `export default [${onMountedHooks
154
+ .map((fn) => `${String(fn)}`)
155
+ .join(', ')}]`;
156
+ }
157
+ else if (id === 'virtual:global-css') {
158
+ return `${globalCss.map((css) => `import '${css}'`).join('\n')}`;
159
+ }
160
+ else if (id === 'virtual:static-imports') {
161
+ return `${Object.entries(staticImports)
162
+ .map(([key, value]) => `export { ${value.join(',')} } from '${key}';`)
163
+ .join('\n')}`;
164
+ }
165
+ return null;
166
+ }
167
+ }
168
+ ];
169
+ if (command !== 'test') {
170
+ plugins.unshift({
171
+ name: 'html-transform',
172
+ enforce: 'pre',
173
+ transformIndexHtml: {
174
+ enforce: 'pre',
175
+ transform: (html) => {
176
+ let entry;
177
+ switch (ssr) {
178
+ case 'ssg':
179
+ case 'server':
180
+ case 'client':
181
+ entry = new URL('ssr/entry-client.ts', frameworkDir).pathname;
182
+ break;
183
+ default:
184
+ entry = new URL('csr/entry.ts', frameworkDir).pathname;
185
+ }
186
+ const entryScript = `<script type="module" src="${entry}"></script>`;
187
+ html = html
188
+ .replace('<!--entry-script-->', entryScript)
189
+ .replace('<!--product-name-->', productName);
190
+ return html;
191
+ }
192
+ }
193
+ });
194
+ }
195
+ const alias = [
196
+ { find: 'src', replacement: srcDir.pathname },
197
+ { find: 'app', replacement: appDir.pathname },
198
+ { find: 'cwd', replacement: cwd.pathname },
199
+ { find: 'boot', replacement: new URL('boot/', srcDir).pathname },
200
+ { find: 'assets', replacement: new URL('assets/', srcDir).pathname },
201
+ // ...Object.entries(packageUrls).map(([key, value]) => ({
202
+ // find: key, replacement: value.pathname
203
+ // })),
204
+ { find: 'vue', replacement: packageUrls['vue'].pathname },
205
+ { find: 'vue-router', replacement: packageUrls['vue-router'].pathname },
206
+ { find: 'vitrify', replacement: cliDir.pathname }
207
+ ];
208
+ if (command === 'test')
209
+ alias.push({
210
+ find: 'vitest',
211
+ replacement: packageUrls.vitest.pathname
212
+ });
213
+ const config = {
214
+ root: frameworkDir.pathname,
215
+ publicDir: publicDir.pathname,
216
+ vitrify: {
217
+ productName,
218
+ urls: {
219
+ // @ts-ignore
220
+ app: appDir,
221
+ cli: cliDir,
222
+ src: srcDir,
223
+ cwd,
224
+ packages: packageUrls
225
+ }
226
+ },
227
+ plugins,
228
+ optimizeDeps: {
229
+ exclude: ['vue']
230
+ },
231
+ resolve: {
232
+ // Dedupe uses require which breaks ESM SSR builds
233
+ // dedupe: [
234
+ // 'vue',
235
+ // 'vue-router'
236
+ // ],
237
+ alias
238
+ },
239
+ build: {
240
+ target: ssr === 'server' ? 'esnext' : 'modules',
241
+ ssr: ssr === 'server' ? true : false,
242
+ ssrManifest: ssr === 'client' || ssr === 'ssg',
243
+ rollupOptions: ssr === 'server'
244
+ ? {
245
+ input: [
246
+ new URL('ssr/entry-server.ts', frameworkDir).pathname,
247
+ new URL('ssr/server.ts', frameworkDir).pathname
248
+ ],
249
+ output: {
250
+ minifyInternalExports: false,
251
+ entryFileNames: '[name].mjs',
252
+ chunkFileNames: '[name].mjs',
253
+ format: 'es',
254
+ manualChunks: (id) => {
255
+ if (id.includes('fastify-ssr-plugin')) {
256
+ return 'fastify-ssr-plugin';
257
+ }
258
+ else if (id.includes('node_modules')) {
259
+ return 'vendor';
260
+ }
261
+ }
262
+ }
263
+ }
264
+ : {
265
+ output: {
266
+ format: 'es'
267
+ }
268
+ }
269
+ },
270
+ css: {
271
+ preprocessorOptions: {
272
+ sass: {
273
+ additionalData: [...sass].join('\n') + '\n'
274
+ }
275
+ }
276
+ },
277
+ ssr: {
278
+ // Create a SSR bundle
279
+ noExternal: [
280
+ new RegExp(`^(?!.*(${[...builtinModules, ...serverModules].join('|')}))`)
281
+ ]
282
+ },
283
+ define: {
284
+ __BASE_URL__: `'/'`
285
+ }
286
+ };
287
+ return mergeConfig(config, vitrifyConfig);
288
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,294 @@
1
+ import { readFileSync } from 'fs';
2
+ import Components from 'unplugin-vue-components/vite';
3
+ // import { quasarDir as defaultQuasarDir } from '../app-urls.js'
4
+ // import { QuasarResolver } from '../resolver.js';
5
+ import { QuasarResolver } from 'unplugin-vue-components/resolvers';
6
+ import { getPkgJsonDir } from '../app-urls.js';
7
+ import { resolve } from 'import-meta-resolve';
8
+ export const injectSsrContext = (html, ssrContext) => html
9
+ .replace(/(<html[^>]*)(>)/i, (found, start, end) => {
10
+ let matches;
11
+ matches = found.match(/\sdir\s*=\s*['"]([^'"]*)['"]/i);
12
+ if (matches) {
13
+ start = start.replace(matches[0], '');
14
+ }
15
+ matches = found.match(/\slang\s*=\s*['"]([^'"]*)['"]/i);
16
+ if (matches) {
17
+ start = start.replace(matches[0], '');
18
+ }
19
+ return `${start} ${ssrContext._meta.htmlAttrs || ''} ${end}`;
20
+ })
21
+ .replace(/(<head[^>]*)(>)/i, (_, start, end) => `${start}${end}${ssrContext._meta.headTags || ''}`)
22
+ .replace(/(<\/head>)/i, (_, tag) => `${ssrContext._meta.resourceStyles || ''}${ssrContext._meta.endingHeadTags || ''}${tag}`)
23
+ .replace(/(<body[^>]*)(>)/i, (found, start, end) => {
24
+ let classes = ssrContext._meta.bodyClasses || '';
25
+ const matches = found.match(/\sclass\s*=\s*['"]([^'"]*)['"]/i);
26
+ if (matches) {
27
+ if (matches[1].length > 0) {
28
+ classes += ` ${matches[1]}`;
29
+ }
30
+ start = start.replace(matches[0], '');
31
+ }
32
+ return `${start} class="${classes.trim()}" ${ssrContext._meta.bodyAttrs || ''}${end}${ssrContext._meta.bodyTags || ''}`;
33
+ });
34
+ // export interface Configuration {
35
+ // ssr?: 'server' | 'client' | 'ssg' | false
36
+ // }
37
+ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
38
+ // const extraPlugins: Plugin[] = []
39
+ // const ctx = {
40
+ // prod: process.env.MODE === 'production',
41
+ // dev: process.env.MODE === 'development',
42
+ // mode: {
43
+ // ssr: !!ssr,
44
+ // pwa: !!pwa
45
+ // }
46
+ // }
47
+ // let bootFilePaths: Record<string, any> = {}
48
+ // let components: string[] = []
49
+ let plugins = [];
50
+ // let css: string[] = []
51
+ let extras = [];
52
+ return [
53
+ // {
54
+ // name: 'legacy-support',
55
+ // enforce: 'pre',
56
+ // transform (code, id) {
57
+ // /**
58
+ // * ESM does not resolve an import to .default when there are multiple exports. The following is required to make the VuePlugin import of QCalendar work.
59
+ // */
60
+ // if (code.includes('app.use(VuePlugin)')) {
61
+ // code = code.replace(/app\.use\(VuePlugin\)/g, `app.use(VuePlugin.install ? VuePlugin : VuePlugin.default)`)
62
+ // }
63
+ // return code
64
+ // }
65
+ // },
66
+ Components({
67
+ resolvers: [QuasarResolver()]
68
+ }),
69
+ {
70
+ name: 'vite-plugin-quasar-setup',
71
+ enforce: 'pre',
72
+ config: async (config, env) => {
73
+ const { vitrify: { urls } = {}, quasar } = config;
74
+ const globalCss = quasar?.extras.map((extra) => `@quasar/extras/${extra}/${extra}.css`);
75
+ const localPackages = ['@quasar/extras', 'quasar'];
76
+ await (async () => {
77
+ for (const val of localPackages)
78
+ urls.packages[val] = getPkgJsonDir(new URL(await resolve(val, urls.app.href)));
79
+ })();
80
+ const onMountedHooks = [
81
+ async (instance) => {
82
+ // @ts-ignore
83
+ const { proxy: { $q } } = instance;
84
+ $q.onSSRHydrated !== void 0 && $q.onSSRHydrated();
85
+ }
86
+ ];
87
+ const bootFunctions = [
88
+ async ({ app, ssrContext, staticImports }) => {
89
+ // @ts-ignore
90
+ // const quasarVuePlugin = (await import('quasar/vue-plugin')).default
91
+ // @ts-ignore
92
+ const quasarPlugins = await import('virtual:quasar-plugins');
93
+ // @ts-ignore
94
+ const directives = await import('quasar/directives');
95
+ app.use(staticImports.Quasar, {
96
+ plugins: quasarPlugins,
97
+ directives
98
+ }, ssrContext);
99
+ }
100
+ ];
101
+ return {
102
+ vitrify: {
103
+ urls,
104
+ bootFunctions,
105
+ ssrFunctions: [injectSsrContext],
106
+ globalCss,
107
+ staticImports: {
108
+ quasar: ['Quasar']
109
+ },
110
+ hooks: {
111
+ onMounted: onMountedHooks
112
+ }
113
+ }
114
+ };
115
+ }
116
+ },
117
+ {
118
+ name: 'vite-plugin-quasar',
119
+ enforce: 'post',
120
+ // transformIndexHtml: {
121
+ // enforce: 'post',
122
+ // transform: (html) => {
123
+ // return html.replace(
124
+ // '<!--product-name-->',
125
+ // productName
126
+ // )
127
+ // }
128
+ // },
129
+ config: async (config, env) => {
130
+ // let appDir: URL
131
+ // let cliDir: URL
132
+ // let cwd: URL
133
+ // let quasarDir: URL
134
+ // let quasarConf: QuasarConf | undefined
135
+ const { quasar: quasarConf, vitrify: { urls } = {} } = config;
136
+ const quasarPkgJsonPath = new URL('package.json', urls?.packages?.quasar).pathname;
137
+ const { version } = JSON.parse(readFileSync(quasarPkgJsonPath, { encoding: 'utf-8' }));
138
+ // if (quasarConf?.boot) {
139
+ // bootFilePaths = (quasarConf.boot as (Record<string, any> | string)[])
140
+ // .filter(entry => {
141
+ // if (typeof entry === 'object') return (entry.server && (ssr === 'server'))
142
+ // else if (entry !== '') return true
143
+ // })
144
+ // .map(entry => {
145
+ // if (typeof entry === 'string') return entry
146
+ // else if (typeof entry === 'object') return entry.path
147
+ // })
148
+ // .reduce((acc, entry) => {
149
+ // if (entry[0] === '~') {
150
+ // const split = entry.substring(1).split('/')
151
+ // const name = split[0].replace(/[|&;$%@"<>()+,]/g, "");
152
+ // acc[name] = {
153
+ // path: new URL(`node_modules/${entry.substring(1)}`, urls?.app).pathname
154
+ // }
155
+ // } else {
156
+ // const name = entry.split('.')[0]
157
+ // acc[name] = {
158
+ // path: `src/boot/${entry}`
159
+ // }
160
+ // }
161
+ // return acc
162
+ // }, {})
163
+ // }
164
+ /**
165
+ * All components should have been auto-imported
166
+ */
167
+ if (quasarConf?.framework?.plugins) {
168
+ if (!quasarConf.framework)
169
+ quasarConf.framework = {};
170
+ quasarConf.framework.plugins = [
171
+ ...new Set(quasarConf.framework.plugins)
172
+ ];
173
+ plugins = quasarConf?.framework.plugins;
174
+ }
175
+ // css = (quasarConf?.css || []).map((v => {
176
+ // if (v[0] === '~') {
177
+ // return v.slice(1)
178
+ // }
179
+ // return v
180
+ // })).map((v) => `@import '${v}'`)
181
+ extras = quasarConf?.extras || [];
182
+ return {
183
+ resolve: {
184
+ alias: [
185
+ {
186
+ find: 'quasar/wrappers',
187
+ replacement: new URL('quasar-wrappers.ts', urls?.cli).pathname
188
+ },
189
+ {
190
+ find: 'quasar/vue-plugin',
191
+ replacement: new URL('src/vue-plugin.js', urls?.packages?.quasar).pathname
192
+ },
193
+ {
194
+ find: 'quasar/plugins',
195
+ replacement: new URL('src/plugins.js', urls?.packages?.quasar)
196
+ .pathname
197
+ },
198
+ {
199
+ find: 'quasar/components',
200
+ replacement: new URL('src/components.js', urls?.packages?.quasar).pathname
201
+ },
202
+ {
203
+ find: 'quasar/composables',
204
+ replacement: new URL('src/composables.js', urls?.packages?.quasar).pathname
205
+ },
206
+ {
207
+ find: 'quasar/directives',
208
+ replacement: new URL('src/directives.js', urls?.packages?.quasar).pathname
209
+ },
210
+ {
211
+ find: 'quasar/src',
212
+ replacement: new URL('src/', urls?.packages?.quasar).pathname
213
+ },
214
+ // ...extras.map(extra => ({
215
+ // find: `@quasar/extras/${extra}/${extra}.css`,
216
+ // replacement: new URL(`${extra}/${extra}.css`, urls?.packages?.['@quasar/extras']).pathname
217
+ // })
218
+ // ),
219
+ {
220
+ find: 'quasar',
221
+ replacement: new URL('src/', urls?.packages?.quasar).pathname
222
+ },
223
+ {
224
+ find: `@quasar/extras`,
225
+ replacement: new URL('.', urls?.packages?.['@quasar/extras'])
226
+ .pathname
227
+ }
228
+ // { find: new RegExp('^quasar$'), replacement: new URL('src/index.all.js', urls?.packages?.quasar).pathname },
229
+ // { find: new RegExp('^quasar$'), replacement: 'virtual:quasar' },
230
+ ]
231
+ },
232
+ define: {
233
+ __DEV__: process.env.NODE_ENV !== 'production' || true,
234
+ __QUASAR_VERSION__: `'${version}'`,
235
+ __QUASAR_SSR__: !!ssr,
236
+ __QUASAR_SSR_SERVER__: ssr === 'server',
237
+ __QUASAR_SSR_CLIENT__: ssr === 'client',
238
+ __QUASAR_SSR_PWA__: ssr === 'client' && pwa
239
+ },
240
+ css: {
241
+ preprocessorOptions: {
242
+ sass: {
243
+ additionalData: [
244
+ // ...extras.map(extra => `@import "@quasar/extras/${extra}/${extra}.css"`),
245
+ // ...extras.map(extra => `@import ${new URL(`${extra}/${extra}.css`, urls?.packages?.['@quasar/extras']).pathname}`) || [],
246
+ config.css?.preprocessorOptions?.sass?.additionalData,
247
+ `@import 'quasar/src/css/index.sass'`
248
+ ].join('\n') + '\n'
249
+ }
250
+ }
251
+ },
252
+ ssr: {
253
+ noExternal: ['quasar']
254
+ }
255
+ };
256
+ }
257
+ },
258
+ {
259
+ name: 'quasar-virtual-modules',
260
+ enforce: 'post',
261
+ config: async (config, env) => ({
262
+ resolve: {
263
+ alias: [
264
+ { find: new RegExp('^quasar$'), replacement: 'virtual:quasar' }
265
+ ]
266
+ }
267
+ }),
268
+ resolveId(id) {
269
+ switch (id) {
270
+ case 'virtual:quasar-plugins':
271
+ return 'virtual:quasar-plugins';
272
+ case 'virtual:quasar':
273
+ return { id: 'virtual:quasar', moduleSideEffects: false };
274
+ default:
275
+ return;
276
+ }
277
+ },
278
+ load(id) {
279
+ if (id === 'virtual:quasar-plugins') {
280
+ return `export { ${plugins.join(',')} } from 'quasar'`;
281
+ }
282
+ else if (id === 'virtual:quasar') {
283
+ return `export * from 'quasar/src/plugins.js';
284
+ export * from 'quasar/src/components.js';
285
+ export * from 'quasar/src/composables.js';
286
+ export * from 'quasar/src/directives.js';
287
+ export { default as Quasar } from 'quasar/src/vue-plugin.js'`;
288
+ }
289
+ return null;
290
+ }
291
+ }
292
+ ];
293
+ };
294
+ export default QuasarPlugin;
@@ -0,0 +1,11 @@
1
+ export declare const getPkgJsonDir: (dir: URL) => URL;
2
+ export declare const appDir: URL;
3
+ export declare const cliDir: URL;
4
+ export declare const cliViteDir: URL;
5
+ export declare const srcDir: URL;
6
+ export declare const parsePath: (path: string) => URL | undefined;
7
+ export declare const projectURLs: {
8
+ src: (path: string) => URL;
9
+ app: (path: string) => URL;
10
+ cli: (path: string) => URL;
11
+ };
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/node --experimental-specifier-resolution=node
2
+ export declare function build(opts: {
3
+ ssr?: 'client' | 'server' | 'ssg';
4
+ base?: string;
5
+ outDir?: string;
6
+ appDir?: URL;
7
+ publicDir?: URL;
8
+ }): Promise<import("rollup").RollupOutput | import("rollup").RollupOutput[] | import("rollup").RollupWatcher>;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,15 @@
1
+ /// <reference types="node" />
2
+ import type { ViteDevServer, LogLevel } from 'vite';
3
+ import type { Server } from 'net';
4
+ export declare function createServer({ port, logLevel, mode, framework, host, appDir, publicDir }: {
5
+ port?: number;
6
+ logLevel?: LogLevel;
7
+ mode?: 'csr' | 'ssr';
8
+ framework?: 'vue';
9
+ host?: string;
10
+ appDir?: URL;
11
+ publicDir?: URL;
12
+ }): Promise<{
13
+ server: Server;
14
+ vite: ViteDevServer;
15
+ }>;
@@ -0,0 +1,8 @@
1
+ import { projectURLs } from '../app-urls.js';
2
+ export interface VitrifyContext {
3
+ vitrify: {
4
+ version: string;
5
+ };
6
+ projectURLs: typeof projectURLs;
7
+ }
8
+ export declare function run(filePath: string): Promise<void>;
@@ -0,0 +1,3 @@
1
+ export declare function test(opts: {
2
+ appDir: URL;
3
+ }): Promise<void>;
@@ -0,0 +1,23 @@
1
+ /// <reference types="node" />
2
+ import type { Server } from 'net';
3
+ import type { ResolvedConfig } from 'vite';
4
+ export declare const clearConsole: () => void;
5
+ export declare const log: (msg?: string | undefined) => void;
6
+ export declare const warn: (msg?: string | undefined, pill?: string | undefined) => void;
7
+ export declare const fatal: (msg?: string | undefined, pill?: string | undefined) => never;
8
+ /**
9
+ * Extended approach - Compilation status & pills
10
+ */
11
+ export declare const successPill: (msg?: string | undefined) => string;
12
+ export declare const infoPill: (msg?: string | undefined) => string;
13
+ export declare const errorPill: (msg?: string | undefined) => string;
14
+ export declare const warningPill: (msg?: string | undefined) => string;
15
+ export declare const success: (msg?: string | undefined, title?: string) => void;
16
+ export declare const getSuccess: (msg?: string | undefined, title?: string | undefined) => string;
17
+ export declare const info: (msg?: string | undefined, title?: string) => void;
18
+ export declare const getInfo: (msg?: string | undefined, title?: string | undefined) => string;
19
+ export declare const error: (msg?: string | undefined, title?: string) => void;
20
+ export declare const getError: (msg?: string | undefined, title?: string) => string;
21
+ export declare const warning: (msg?: string | undefined, title?: string) => void;
22
+ export declare const getWarning: (msg?: string | undefined, title?: string) => string;
23
+ export declare function printHttpServerUrls(server: Server, config: ResolvedConfig): void;
@@ -0,0 +1,2 @@
1
+ import type { RouteRecordRaw } from 'vue-router';
2
+ export declare const routesToPaths: (routes?: RouteRecordRaw[] | undefined) => string[];
@@ -0,0 +1,5 @@
1
+ export interface Hostname {
2
+ host: string | undefined;
3
+ name: string;
4
+ }
5
+ export declare function resolveHostname(optionsHost: string | boolean | undefined): Hostname;