vitrify 0.20.0 → 0.22.0

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 CHANGED
@@ -17,7 +17,7 @@ export const getPkgJsonDir = (dir) => {
17
17
  }
18
18
  return getPkgJsonDir(new URL('..', dir));
19
19
  };
20
- export const getAppDir = () => getPkgJsonDir(new URL(`file://${process.cwd()}/`));
20
+ export const getAppDir = (dir) => getPkgJsonDir(dir ?? new URL(`file://${process.cwd()}/`));
21
21
  export const getCliDir = () => getPkgJsonDir(new URL('./', import.meta.url));
22
22
  export const getCliViteDir = (cliDir) => new URL('src/vite/', cliDir);
23
23
  export const getSrcDir = (appDir) => new URL('src/', appDir);
package/dist/bin/cli.js CHANGED
@@ -5,6 +5,7 @@ import { getAppDir, parsePath } from '../app-urls.js';
5
5
  import { printHttpServerUrls, exitLogs } from '../helpers/logger.js';
6
6
  import { build as esbuild } from 'esbuild';
7
7
  import { readdir } from 'fs/promises';
8
+ import { loadSSRAssets } from '../frameworks/vue/fastify-ssr-plugin.js';
8
9
  const cli = cac('vitrify');
9
10
  cli
10
11
  .command('build')
@@ -73,12 +74,18 @@ cli
73
74
  ...args,
74
75
  outDir: fileURLToPath(new URL('ssr/server/', baseOutDir))
75
76
  });
76
- ({ prerender, onRendered } = await import(new URL('ssr/server/prerender.mjs', baseOutDir).pathname));
77
+ ({ prerender } = await import(new URL('ssr/server/prerender.mjs', baseOutDir).pathname));
78
+ const { template, manifest, render, getRoutes, onRendered } = await loadSSRAssets({
79
+ mode: 'ssg',
80
+ distDir: baseOutDir
81
+ });
82
+ const routes = await getRoutes();
77
83
  prerender({
78
84
  outDir: fileURLToPath(new URL('static/', baseOutDir)),
79
- templatePath: fileURLToPath(new URL('static/index.html', baseOutDir)),
80
- manifestPath: fileURLToPath(new URL('static/.vite/ssr-manifest.json', baseOutDir)),
81
- entryServerPath: new URL('ssr/server/entry-server.mjs', baseOutDir),
85
+ template,
86
+ manifest,
87
+ render,
88
+ routes,
82
89
  onRendered
83
90
  });
84
91
  break;
package/dist/bin/dev.js CHANGED
@@ -1,4 +1,3 @@
1
- import { searchForWorkspaceRoot } from 'vite';
2
1
  import { baseConfig } from '../index.js';
3
2
  import fastify from 'fastify';
4
3
  import { fastifySsrPlugin } from '../frameworks/vue/fastify-ssr-plugin.js';
@@ -15,7 +14,6 @@ export async function createVitrifyDevServer({ port = 3000, logLevel = 'info',
15
14
  // mode = 'csr',
16
15
  ssr, framework = 'vue', host, appDir, publicDir, base }) {
17
16
  const { getAppDir, getCliDir, getCliViteDir, getCwd } = await import('../app-urls.js');
18
- const cliDir = getCliDir();
19
17
  if (!appDir)
20
18
  appDir = getAppDir();
21
19
  let config = {};
@@ -33,46 +31,27 @@ ssr, framework = 'vue', host, appDir, publicDir, base }) {
33
31
  publicDir,
34
32
  base
35
33
  });
36
- config.logLevel = logLevel;
37
- config.define = {
38
- ...config.define,
39
- __HOST__: `'${host}'`
40
- };
41
34
  const wsPort = await getFirstOpenPort(24678);
42
35
  if (config.server?.https) {
43
36
  exitLogs.push(`[warning] HTTPS mode enabled. Visit https://{hostname}:${wsPort} to enable a security exception for HMR.`);
44
37
  }
45
- config.server = {
46
- https: config.server?.https,
47
- hmr: {
48
- protocol: config.server?.https ? 'wss' : 'ws',
49
- port: wsPort
50
- },
51
- port,
52
- // middlewareMode: mode === 'ssr' ? 'ssr' : undefined,
53
- middlewareMode: ssr ? true : false,
54
- fs: {
55
- strict: false, // https://github.com/vitejs/vite/issues/8175
56
- allow: [
57
- searchForWorkspaceRoot(process.cwd()),
58
- searchForWorkspaceRoot(fileURLToPath(appDir)),
59
- searchForWorkspaceRoot(fileURLToPath(cliDir)),
60
- fileURLToPath(appDir)
61
- ]
62
- },
63
- watch: {
64
- // During tests we edit the files too fast and sometimes chokidar
65
- // misses change events, so enforce polling for consistency
66
- usePolling: true,
67
- interval: 100
68
- },
69
- host
70
- };
71
- if (ssr)
72
- config.appType = 'custom';
73
38
  const vitrifyDevServer = await (await import('vite')).createServer({
74
39
  configFile: false,
75
- ...config
40
+ ...config,
41
+ logLevel,
42
+ define: {
43
+ ...config.define,
44
+ __HOST__: `'${host}'`
45
+ },
46
+ server: {
47
+ ...config.server,
48
+ host,
49
+ port,
50
+ hmr: {
51
+ protocol: config.server?.https ? 'wss' : 'ws',
52
+ port: wsPort
53
+ }
54
+ }
76
55
  });
77
56
  return vitrifyDevServer;
78
57
  }
@@ -103,9 +82,17 @@ ssr, framework = 'vue', host, appDir, publicDir, vite }) {
103
82
  const entryUrl = ssr === 'fastify'
104
83
  ? fileURLToPath(new URL('src/vite/fastify/entry.ts', cliDir))
105
84
  : fileURLToPath(new URL(`src/vite/${framework}/ssr/app.ts`, cliDir));
106
- ({ setup, onRendered, vitrifyConfig } = await vite.ssrLoadModule(entryUrl));
85
+ const environment = vite.environments.ssr;
86
+ ({ setup, onRendered, vitrifyConfig } =
87
+ // @ts-expect-error missing types
88
+ await environment.runner.import(entryUrl));
89
+ // console.log(module)
90
+ // ;({ setup, onRendered, vitrifyConfig } = await vite.ssrLoadModule(entryUrl))
107
91
  app = fastify({
108
92
  logger: {
93
+ transport: {
94
+ target: '@fastify/one-line-logger'
95
+ },
109
96
  level: process.env.DEBUG
110
97
  ? 'debug'
111
98
  : process.env.PINO_LOG_LEVEL || 'info'
@@ -2,6 +2,7 @@ import fastifyStatic from '@fastify/static';
2
2
  import { readFileSync } from 'fs';
3
3
  import { fileURLToPath } from 'url';
4
4
  import { addOrReplaceAppDiv, appendToBody, appendToHead } from '../../helpers/utils.js';
5
+ import { getAppDir } from '../../app-urls.js';
5
6
  const fastifySsrPlugin = async (fastify, options) => {
6
7
  options.baseUrl = options.baseUrl || '/';
7
8
  options.mode = options.mode || process.env.MODE || import.meta.env.MODE;
@@ -35,7 +36,10 @@ const fastifySsrPlugin = async (fastify, options) => {
35
36
  let template = readFileSync(new URL('index.html', frameworkDir)).toString();
36
37
  template = await vite.transformIndexHtml(url, template);
37
38
  const entryUrl = fileURLToPath(new URL('ssr/entry-server.ts', frameworkDir));
38
- const render = (await vite.ssrLoadModule(entryUrl)).render;
39
+ const environment = vite.environments.ssr;
40
+ // @ts-expect-error missing type
41
+ const { render } = await environment.runner.import(entryUrl);
42
+ // const render = (await vite!.ssrLoadModule(entryUrl)).render
39
43
  let manifest;
40
44
  // TODO: https://github.com/vitejs/vite/issues/2282
41
45
  try {
@@ -80,10 +84,9 @@ const fastifySsrPlugin = async (fastify, options) => {
80
84
  fastify.get(`${options.baseUrl}*`, async (req, res) => {
81
85
  const url = req.raw.url?.replace(options.baseUrl, '/');
82
86
  const provide = options.provide ? await options.provide(req, res) : {};
83
- const template = readFileSync(fileURLToPath(new URL('./dist/ssr/client/index.html', options.appDir))).toString();
84
- const manifest = JSON.parse(readFileSync(new URL('./dist/ssr/client/.vite/ssr-manifest.json', options.appDir)).toString());
85
- const render = (await import(fileURLToPath(new URL('./dist/ssr/server/entry-server.mjs', options.appDir)))).render;
86
- const onRendered = (await import(fileURLToPath(new URL('./dist/ssr/server/virtual_vitrify-hooks.mjs', options.appDir)))).onRendered;
87
+ const { template, manifest, render, onRendered } = await loadSSRAssets({
88
+ distDir: new URL('./dist/', options.appDir)
89
+ });
87
90
  const html = await renderHtml({
88
91
  request: req,
89
92
  reply: res,
@@ -131,4 +134,40 @@ const renderHtml = async (options) => {
131
134
  }
132
135
  return html;
133
136
  };
134
- export { fastifySsrPlugin, renderHtml };
137
+ const loadSSRAssets = async ({ mode, distDir } = {
138
+ mode: 'ssr'
139
+ }) => {
140
+ const appDir = getAppDir(new URL(import.meta.url));
141
+ const baseOutDir = distDir || new URL('dist/', appDir);
142
+ let templatePath, manifestPath, entryServerPath;
143
+ const onRenderedPath = fileURLToPath(new URL('ssr/server/virtual_vitrify-hooks.mjs', baseOutDir));
144
+ if (mode === 'ssg') {
145
+ templatePath = fileURLToPath(new URL('static/index.html', baseOutDir));
146
+ manifestPath = fileURLToPath(new URL('static/.vite/ssr-manifest.json', baseOutDir));
147
+ entryServerPath = fileURLToPath(new URL('ssr/server/entry-server.mjs', baseOutDir));
148
+ }
149
+ else {
150
+ templatePath = fileURLToPath(new URL('ssr/client/index.html', baseOutDir));
151
+ manifestPath = fileURLToPath(new URL('ssr/client/.vite/ssr-manifest.json', baseOutDir));
152
+ entryServerPath = fileURLToPath(new URL('ssr/server/entry-server.mjs', baseOutDir));
153
+ }
154
+ try {
155
+ const template = readFileSync(templatePath).toString();
156
+ const manifest = JSON.parse(readFileSync(manifestPath).toString());
157
+ const entryServer = await import(entryServerPath);
158
+ const { render, getRoutes } = entryServer;
159
+ const onRendered = (await import(onRenderedPath)).onRendered;
160
+ return {
161
+ template,
162
+ manifest,
163
+ render,
164
+ getRoutes,
165
+ onRendered
166
+ };
167
+ }
168
+ catch (e) {
169
+ console.error(e);
170
+ throw new Error('Unable to load SSR asset files');
171
+ }
172
+ };
173
+ export { fastifySsrPlugin, renderHtml, loadSSRAssets };
@@ -1,12 +1,8 @@
1
1
  import { existsSync, promises as fs, mkdirSync } from 'fs';
2
2
  import { routesToPaths } from '../../helpers/routes.js';
3
3
  import { renderHtml } from './fastify-ssr-plugin.js';
4
- export const prerender = async ({ outDir, templatePath, manifestPath, entryServerPath, onRendered }) => {
4
+ export const prerender = async ({ outDir, template, manifest, render, routes, onRendered }) => {
5
5
  const promises = [];
6
- const template = (await fs.readFile(templatePath)).toString();
7
- const manifest = JSON.parse((await fs.readFile(manifestPath)).toString());
8
- const { render, getRoutes } = await import(entryServerPath);
9
- const routes = await getRoutes();
10
6
  const paths = routesToPaths(routes).filter((i) => !i.includes(':') && !i.includes('*'));
11
7
  const beasties = new (await import('beasties')).default({
12
8
  path: outDir,
@@ -2,6 +2,9 @@ import fastify from 'fastify';
2
2
  export const createApp = ({ onSetup, appDir, baseUrl, fastifyPlugin, onRendered, vitrifyDir, mode }) => {
3
3
  const app = fastify({
4
4
  logger: {
5
+ transport: {
6
+ target: '@fastify/one-line-logger'
7
+ },
5
8
  level: process.env.DEBUG ? 'debug' : process.env.PINO_LOG_LEVEL || 'info'
6
9
  }
7
10
  });
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ import { addOrReplaceTitle, appendToBody } from './helpers/utils.js';
14
14
  import Components from 'unplugin-vue-components/vite';
15
15
  import { VitePWA } from 'vite-plugin-pwa';
16
16
  import UnoCSS from 'unocss/vite';
17
+ import { searchForWorkspaceRoot } from 'vite';
17
18
  const internalServerModules = [
18
19
  'util',
19
20
  'vitrify',
@@ -29,12 +30,6 @@ const internalServerModules = [
29
30
  'ws',
30
31
  'abort-controller'
31
32
  ];
32
- const configPluginMap = {
33
- quasar: () => import('./plugins/quasar.js').then((module) => module.QuasarPlugin)
34
- };
35
- const configResolverMap = {
36
- quasar: () => import('unplugin-vue-components/resolvers').then((module) => module.QuasarResolver())
37
- };
38
33
  const manualChunkNames = [
39
34
  'prerender',
40
35
  'fastify-ssr-plugin',
@@ -43,11 +38,12 @@ const manualChunkNames = [
43
38
  ];
44
39
  const moduleChunks = {
45
40
  vue: ['vue', '@vue', 'vue-router'],
46
- quasar: ['quasar', '@quasar']
41
+ quasar: ['quasar'],
42
+ atQuasar: ['@quasar']
47
43
  };
48
44
  const manualChunksFn = (manualChunkList) => {
49
45
  return (id) => {
50
- const matchedModule = Object.entries(moduleChunks).find(([chunkName, moduleNames]) => moduleNames.some((moduleName) => id.includes(moduleName + '/')));
46
+ const matchedModule = Object.entries(moduleChunks).find(([chunkName, moduleNames]) => moduleNames.some((moduleName) => new RegExp(`\/${moduleName}\/`).test(id)));
51
47
  if (id.includes('vitrify/src/')) {
52
48
  const name = id.split('/').at(-1)?.split('.').at(0);
53
49
  if (name && manualChunkNames.includes(name))
@@ -67,30 +63,6 @@ const manualChunksFn = (manualChunkList) => {
67
63
  }
68
64
  };
69
65
  };
70
- // const manualChunks: ManualChunksOption = (
71
- // id: string,
72
- // manualChunkList?: string[]
73
- // ) => {
74
- // const matchedModule = Object.entries(moduleChunks).find(
75
- // ([chunkName, moduleNames]) =>
76
- // moduleNames.some((moduleName) => id.includes(moduleName + '/'))
77
- // )
78
- // if (id.includes('vitrify/src/')) {
79
- // const name = id.split('/').at(-1)?.split('.').at(0)
80
- // if (name && manualChunkNames.includes(name)) return name
81
- // } else if (
82
- // VIRTUAL_MODULES.some((virtualModule) => id.includes(virtualModule))
83
- // ) {
84
- // return VIRTUAL_MODULES.find((name) => id.includes(name))
85
- // } else if (manualChunkList?.some((file) => id.includes(file))) {
86
- // return manualChunkList.find((file) => id.includes(file))
87
- // } else if (id.includes('node_modules')) {
88
- // if (matchedModule) {
89
- // return matchedModule[0]
90
- // }
91
- // return 'vendor'
92
- // }
93
- // }
94
66
  export const VIRTUAL_MODULES = [
95
67
  'virtual:vitrify-hooks',
96
68
  'virtual:static-imports',
@@ -167,7 +139,6 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
167
139
  const bundledConfig = await bundleConfigFile(fileURLToPath(new URL('vitrify.config.ts', appDir)));
168
140
  fs.writeFileSync(configPath + '.js', bundledConfig.code);
169
141
  rawVitrifyConfig = (await import('file://' + configPath + '.js')).default;
170
- // vitrifyConfig = (await import(configPath + '.js')).default
171
142
  fs.unlinkSync(configPath + '.js');
172
143
  }
173
144
  else {
@@ -184,8 +155,9 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
184
155
  console.log('No valid vitrify.config.(ts|js) file found.');
185
156
  throw e;
186
157
  }
187
- const localPackages = ['vue', 'vue-router', '@vue/server-renderer'];
188
- // const localPackages: string[] = []
158
+ const localPackages = [];
159
+ if (framework === 'vue')
160
+ localPackages.push('vue', 'vue-router', '@vue/server-renderer');
189
161
  const cliPackages = [];
190
162
  const packageUrls = vitrifyConfig.vitrify?.urls?.packages || {};
191
163
  await (async () => {
@@ -195,12 +167,6 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
195
167
  packageUrls[val] = new URL(`file://${pkgDir}`);
196
168
  }
197
169
  })();
198
- // await (async () => {
199
- // for (const val of cliPackages)
200
- // packageUrls[val] = getPkgJsonDir(
201
- // new URL(await resolve(val, cliDir!.href))
202
- // )
203
- // })()
204
170
  if (!productName) {
205
171
  try {
206
172
  ;
@@ -219,16 +185,26 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
219
185
  }
220
186
  const isPwa = !!vitrifyConfig.vitrify?.pwa || false;
221
187
  const frameworkPlugins = [];
222
- const resolvers = [];
223
- for (const framework of Object.keys(configPluginMap)) {
224
- if (Object.keys(vitrifyConfig).includes(framework)) {
225
- const plugin = await configPluginMap[framework]();
226
- const resolver = await configResolverMap[framework]();
227
- frameworkPlugins.push(await plugin({
188
+ if (framework === 'vue') {
189
+ frameworkPlugins.push(vuePlugin());
190
+ }
191
+ const vitrifyPlugins = [];
192
+ if (vitrifyConfig.vitrify?.plugins) {
193
+ for (const vitrifyPluginConfig of vitrifyConfig.vitrify.plugins) {
194
+ const vitrifyPlugin = await vitrifyPluginConfig.plugin({
228
195
  ssr,
229
- pwa: isPwa
230
- }));
231
- resolvers.push(resolver);
196
+ pwa: isPwa,
197
+ options: vitrifyPluginConfig.options
198
+ });
199
+ if ('plugin' in vitrifyPlugin) {
200
+ vitrifyPlugins.push(vitrifyPlugin.plugin);
201
+ }
202
+ else if ('plugins' in vitrifyPlugin) {
203
+ vitrifyPlugins.push(...vitrifyPlugin.plugins);
204
+ }
205
+ if (vitrifyPlugin.config) {
206
+ vitrifyConfig = mergeConfig(vitrifyConfig, vitrifyPlugin.config);
207
+ }
232
208
  }
233
209
  }
234
210
  let onBootHooks;
@@ -282,13 +258,12 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
282
258
  code = code
283
259
  .replace(/<style>(.*?)<\/style>/, '<style>' + css + '</style>')
284
260
  .replace(/<style lang="sass">(.*?)<\/style>/, '<style lang="sass">' + sass + '</style>');
285
- // code = code.replace(/<\/style>/, sass + '</style>')
286
261
  }
287
262
  return code;
288
263
  }
289
264
  },
290
- vuePlugin(),
291
265
  ...frameworkPlugins,
266
+ ...vitrifyPlugins,
292
267
  {
293
268
  name: 'vitrify-setup',
294
269
  enforce: 'post',
@@ -347,9 +322,6 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
347
322
  .replaceAll('_', '')
348
323
  .replaceAll('+', '');
349
324
  return `import ${varName} from '${new URL(url, appDir).pathname}'; onSetup.push(${varName})`;
350
- // return `import ${varName} from '${fileURLToPath(
351
- // url
352
- // )}'; onSetup.push(${varName})`
353
325
  })
354
326
  .join('\n')}`;
355
327
  }
@@ -367,9 +339,6 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
367
339
  ...globalSass.map((sass) => `@import '${sass}'`)
368
340
  ].join('\n');
369
341
  }
370
- // else if (id === 'vitrify.css') {
371
- // return `${globalCss.map((css) => `@import '${css}'`).join('\n')}`
372
- // }
373
342
  else if (id === 'virtual:vitrify-config') {
374
343
  return `export default ${JSON.stringify(vitrifyConfig)}`;
375
344
  }
@@ -394,12 +363,12 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
394
363
  }
395
364
  },
396
365
  Components({
366
+ ...vitrifyConfig.vitrify?.unpluginVueComponents,
397
367
  exclude: [
398
368
  new RegExp(`[\\/]node_modules[\\/].*[\\/]!(${serverModules.join('|')})`),
399
369
  /[\\/]\.git[\\/]/,
400
370
  /[\\/]\.nuxt[\\/]/
401
- ],
402
- resolvers
371
+ ]
403
372
  }),
404
373
  UnoCSS({
405
374
  ...vitrifyConfig.vitrify?.unocss,
@@ -447,31 +416,13 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
447
416
  else {
448
417
  entryScript = `<script type="module" src="${entry}"></script>`;
449
418
  }
450
- // html = html.replace('<!--entry-script-->', entryScript)
451
419
  html = appendToBody(entryScript, html);
452
420
  if (productName)
453
421
  html = addOrReplaceTitle(productName, html);
454
- // html = html.replace('<!--product-name-->', productName)
455
422
  return html;
456
423
  }
457
424
  }
458
425
  });
459
- // plugins.unshift({
460
- // name: 'product-name',
461
- // enforce: 'post',
462
- // config: (config: VitrifyConfig, env) => {
463
- // if (config.vitrify?.productName)
464
- // productName = config.vitrify?.productName
465
- // return
466
- // },
467
- // transformIndexHtml: {
468
- // enforce: 'post',
469
- // transform: (html) => {
470
- // html = html.replace('<!--product-name-->', productName)
471
- // return html
472
- // }
473
- // }
474
- // })
475
426
  if (debug)
476
427
  plugins.push(visualizer());
477
428
  }
@@ -485,31 +436,33 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
485
436
  '@vue/server-renderer'
486
437
  ];
487
438
  const vuePkgAliases = [];
488
- for (const pkg of vueInternalPkgs) {
489
- const specifier = pkg.split('/').at(-1);
490
- const pkgJsonPath = await findDepPkgJsonPath(pkg, fileURLToPath(appDir));
491
- if (pkgJsonPath)
439
+ if (packageUrls['vue']) {
440
+ for (const pkg of vueInternalPkgs) {
441
+ const specifier = pkg.split('/').at(-1);
442
+ const pkgJsonPath = await findDepPkgJsonPath(pkg, fileURLToPath(appDir));
443
+ if (pkgJsonPath)
444
+ vuePkgAliases.push({
445
+ find: pkg,
446
+ replacement: fileURLToPath(new URL(`./dist/${specifier}.esm-bundler.js`, `file://${pkgJsonPath}` || ''))
447
+ });
492
448
  vuePkgAliases.push({
493
- find: pkg,
494
- replacement: fileURLToPath(new URL(`./dist/${specifier}.esm-bundler.js`, `file://${pkgJsonPath}` || ''))
495
- });
449
+ find: new RegExp('^vue$'),
450
+ replacement: fileURLToPath(new URL('./dist/vue.runtime.esm-bundler.js', packageUrls['vue']))
451
+ }, {
452
+ find: new RegExp('^vue-router$'),
453
+ replacement: fileURLToPath(new URL('./dist/vue-router.esm-bundler.js', packageUrls['vue-router']))
454
+ }, ...vuePkgAliases);
455
+ }
496
456
  }
497
457
  const alias = [
498
458
  { find: 'src', replacement: fileURLToPath(srcDir) },
499
459
  { find: 'app', replacement: fileURLToPath(appDir) },
500
460
  { find: 'cwd', replacement: fileURLToPath(cwd) },
501
461
  { find: 'boot', replacement: fileURLToPath(new URL('boot/', srcDir)) },
502
- { find: 'assets', replacement: fileURLToPath(new URL('assets/', srcDir)) },
503
- {
504
- find: new RegExp('^vue$'),
505
- replacement: fileURLToPath(new URL('./dist/vue.runtime.esm-bundler.js', packageUrls['vue']))
506
- },
507
- {
508
- find: new RegExp('^vue-router$'),
509
- replacement: fileURLToPath(new URL('./dist/vue-router.esm-bundler.js', packageUrls['vue-router']))
510
- },
511
- ...vuePkgAliases
462
+ { find: 'assets', replacement: fileURLToPath(new URL('assets/', srcDir)) }
512
463
  ];
464
+ if (framework === 'vue')
465
+ alias.push(...vuePkgAliases);
513
466
  if (mode === 'development' && vitrifyConfig.vitrify?.dev?.alias)
514
467
  alias.push(...vitrifyConfig.vitrify.dev.alias);
515
468
  if (command === 'test')
@@ -578,6 +531,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
578
531
  }
579
532
  const config = {
580
533
  root: fileURLToPath(appDir),
534
+ appType: ssr ? 'custom' : 'spa',
581
535
  publicDir: fileURLToPath(publicDir),
582
536
  base,
583
537
  envDir: fileURLToPath(appDir),
@@ -614,6 +568,28 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
614
568
  __HOST__: `'localhost'`,
615
569
  __BASE_URL__: `'${base}'`,
616
570
  __IS_PWA__: `${isPwa}`
571
+ },
572
+ // environments: {
573
+ // },
574
+ server: {
575
+ https: vitrifyConfig.server?.https,
576
+ // middlewareMode: mode === 'ssr' ? 'ssr' : undefined,
577
+ middlewareMode: ssr ? true : false,
578
+ fs: {
579
+ strict: false, // https://github.com/vitejs/vite/issues/8175
580
+ allow: [
581
+ searchForWorkspaceRoot(process.cwd()),
582
+ searchForWorkspaceRoot(fileURLToPath(appDir)),
583
+ searchForWorkspaceRoot(fileURLToPath(cliDir)),
584
+ fileURLToPath(appDir)
585
+ ]
586
+ },
587
+ watch: {
588
+ // During tests we edit the files too fast and sometimes chokidar
589
+ // misses change events, so enforce polling for consistency
590
+ usePolling: true,
591
+ interval: 100
592
+ }
617
593
  }
618
594
  };
619
595
  return mergeConfig(config, vitrifyConfig);
@@ -1 +1 @@
1
- export {};
1
+ export * from './quasar/index.js';