vitrify 0.14.0 → 0.14.2

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.
@@ -1,6 +1,6 @@
1
1
  import fastifyStatic from '@fastify/static';
2
2
  import { fileURLToPath } from 'url';
3
- const fastifyCsrPlugin = async (fastify, options, done) => {
3
+ const fastifyCsrPlugin = async (fastify, options) => {
4
4
  options.vitrifyDir =
5
5
  options.vitrifyDir || (await import('vitrify')).vitrifyDir;
6
6
  const frameworkDir = new URL('src/vite/vue/', options.vitrifyDir);
@@ -35,6 +35,5 @@ const fastifyCsrPlugin = async (fastify, options, done) => {
35
35
  prefix: options.baseUrl
36
36
  });
37
37
  }
38
- done();
39
38
  };
40
39
  export { fastifyCsrPlugin };
@@ -2,7 +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
- const fastifySsrPlugin = async (fastify, options, done) => {
5
+ const fastifySsrPlugin = async (fastify, options) => {
6
6
  options.baseUrl = options.baseUrl || '/';
7
7
  options.mode = options.mode || process.env.MODE || import.meta.env.MODE;
8
8
  options.appDir = options.appDir || new URL('../../..', import.meta.url);
@@ -144,6 +144,5 @@ const fastifySsrPlugin = async (fastify, options, done) => {
144
144
  res.send(html);
145
145
  });
146
146
  }
147
- done();
148
147
  };
149
148
  export { fastifySsrPlugin };
package/dist/index.js CHANGED
@@ -436,16 +436,31 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
436
436
  if (debug)
437
437
  plugins.push(visualizer());
438
438
  }
439
+ // Vue now only exports CJS for Node
440
+ // Add the deps as devDependency
441
+ const vueInternalPkgs = [
442
+ '@vue/runtime-dom',
443
+ '@vue/runtime-core',
444
+ '@vue/reactivity',
445
+ '@vue/shared',
446
+ '@vue/server-renderer'
447
+ ];
448
+ const vuePkgAliases = [];
449
+ for (const pkg of vueInternalPkgs) {
450
+ const specifier = pkg.split('/').at(-1);
451
+ const pkgJsonPath = await findDepPkgJsonPath(pkg, fileURLToPath(appDir));
452
+ if (pkgJsonPath)
453
+ vuePkgAliases.push({
454
+ find: pkg,
455
+ replacement: fileURLToPath(new URL(`./dist/${specifier}.esm-bundler.js`, `file://${pkgJsonPath}` || ''))
456
+ });
457
+ }
439
458
  const alias = [
440
459
  { find: 'src', replacement: fileURLToPath(srcDir) },
441
460
  { find: 'app', replacement: fileURLToPath(appDir) },
442
461
  { find: 'cwd', replacement: fileURLToPath(cwd) },
443
462
  { find: 'boot', replacement: fileURLToPath(new URL('boot/', srcDir)) },
444
463
  { find: 'assets', replacement: fileURLToPath(new URL('assets/', srcDir)) },
445
- // ...Object.entries(packageUrls).map(([key, value]) => ({
446
- // find: key,
447
- // replacement: value.pathname
448
- // }))
449
464
  {
450
465
  find: new RegExp('^vue$'),
451
466
  replacement: fileURLToPath(new URL('./dist/vue.runtime.esm-bundler.js', packageUrls['vue']))
@@ -453,7 +468,8 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
453
468
  {
454
469
  find: new RegExp('^vue-router$'),
455
470
  replacement: fileURLToPath(new URL('./dist/vue-router.esm-bundler.js', packageUrls['vue-router']))
456
- }
471
+ },
472
+ ...vuePkgAliases
457
473
  ];
458
474
  if (mode === 'development' && vitrifyConfig.vitrify?.dev?.alias)
459
475
  alias.push(...vitrifyConfig.vitrify.dev.alias);
@@ -1,4 +1,4 @@
1
- import type { FastifyPluginCallback, FastifyRequest, FastifyReply } from 'fastify';
1
+ import type { FastifyPluginAsync, FastifyRequest, FastifyReply } from 'fastify';
2
2
  import type { ViteDevServer } from 'vite';
3
3
  export interface FastifySsrOptions {
4
4
  baseUrl?: string;
@@ -10,6 +10,6 @@ export interface FastifySsrOptions {
10
10
  productName?: string;
11
11
  mode?: string;
12
12
  }
13
- declare const fastifyCsrPlugin: FastifyPluginCallback<FastifySsrOptions>;
13
+ declare const fastifyCsrPlugin: FastifyPluginAsync<FastifySsrOptions>;
14
14
  export { fastifyCsrPlugin };
15
15
  export type FastifyCsrPlugin = typeof fastifyCsrPlugin;
@@ -1,4 +1,4 @@
1
- import type { FastifyPluginCallback, FastifyRequest, FastifyReply } from 'fastify';
1
+ import type { FastifyPluginAsync, FastifyRequest, FastifyReply } from 'fastify';
2
2
  import type { ViteDevServer } from 'vite';
3
3
  import type { OnRenderedHook } from '../../vitrify-config.js';
4
4
  export interface FastifySsrOptions {
@@ -14,6 +14,6 @@ export interface FastifySsrOptions {
14
14
  mode?: string;
15
15
  host?: string;
16
16
  }
17
- declare const fastifySsrPlugin: FastifyPluginCallback<FastifySsrOptions>;
17
+ declare const fastifySsrPlugin: FastifyPluginAsync<FastifySsrOptions>;
18
18
  export { fastifySsrPlugin };
19
19
  export type FastifySsrPlugin = typeof fastifySsrPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitrify",
3
- "version": "0.14.0",
3
+ "version": "0.14.2",
4
4
  "license": "MIT",
5
5
  "author": "Stefan van Herwijnen",
6
6
  "description": "Vite as your Full Stack development tool",
@@ -49,52 +49,52 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@fastify/middie": "^8.3.0",
52
- "@fastify/static": "^6.12.0",
53
- "@quasar/extras": "^1.16.8",
54
- "@vitejs/plugin-vue": "^4.5.0",
52
+ "@fastify/static": "^7.0.1",
53
+ "@vitejs/plugin-vue": "^5.0.4",
55
54
  "ajv": "^8.12.0",
56
55
  "builtin-modules": "^3.3.0",
57
56
  "cac": "^6.7.14",
58
57
  "chalk": "^5.3.0",
59
58
  "critters": "^0.0.20",
60
59
  "cross-env": "^7.0.3",
61
- "esbuild": "^0.19.8",
62
- "fastify": "^4.24.3",
60
+ "esbuild": "^0.20.0",
61
+ "fastify": "^4.26.1",
63
62
  "glob": "^10.3.10",
64
- "happy-dom": "^12.10.3",
63
+ "happy-dom": "^13.3.8",
65
64
  "is-port-reachable": "^4.0.0",
66
- "magic-string": "^0.30.5",
65
+ "magic-string": "^0.30.7",
67
66
  "merge-deep": "^3.0.3",
68
67
  "readline": "^1.3.0",
69
- "rollup-plugin-visualizer": "^5.9.3",
70
- "sass": "1.69.5",
71
- "ts-node": "^10.9.1",
72
- "unplugin-vue-components": "^0.25.2",
73
- "vite": "^5.0.2",
74
- "vite-plugin-pwa": "^0.17.2",
68
+ "rollup-plugin-visualizer": "^5.12.0",
69
+ "sass": "1.71.0",
70
+ "ts-node": "^10.9.2",
71
+ "unplugin-vue-components": "^0.26.0",
72
+ "vite": "^5.1.3",
73
+ "vite-plugin-pwa": "^0.18.2",
75
74
  "vitefu": "^0.2.5",
76
- "vitest": "^0.34.6",
75
+ "vitest": "^1.2.2",
77
76
  "workbox-window": "^7.0.0"
78
77
  },
79
78
  "devDependencies": {
79
+ "@quasar/extras": "^1.16.9",
80
80
  "@types/connect": "^3.4.38",
81
81
  "@types/glob": "^8.1.0",
82
82
  "@types/merge-deep": "^3.0.3",
83
- "@types/node": "^20.10.0",
83
+ "@types/node": "^20.11.19",
84
84
  "@types/ws": "^8.5.10",
85
- "@vue/runtime-core": "^3.3.9",
86
- "quasar": "^2.14.0",
87
- "rollup": "^4.6.0",
88
- "typescript": "^5.3.2",
89
- "vue": "^3.3.9",
85
+ "@vue/runtime-core": "^3.4.19",
86
+ "quasar": "^2.14.4",
87
+ "rollup": "^4.11.0",
88
+ "typescript": "^5.3.3",
89
+ "vue": "^3.4.19",
90
90
  "vue-router": "^4.2.5"
91
91
  },
92
92
  "peerDependencies": {
93
- "@fastify/static": "^6.5.0",
94
- "fastify": "^4.5.3",
95
- "quasar": "^2.7.7",
96
- "vue": "^3.2.38",
97
- "vue-router": "^4.1.5"
93
+ "@fastify/static": "^6.12.0",
94
+ "fastify": "^4.26.0",
95
+ "quasar": "^2.14.3",
96
+ "vue": "^3.4.15",
97
+ "vue-router": "^4.2.5"
98
98
  },
99
99
  "publishConfig": {
100
100
  "access": "public",
@@ -1,8 +1,4 @@
1
- import type {
2
- FastifyPluginCallback,
3
- FastifyRequest,
4
- FastifyReply
5
- } from 'fastify'
1
+ import type { FastifyPluginAsync, FastifyRequest, FastifyReply } from 'fastify'
6
2
  import fastifyStatic from '@fastify/static'
7
3
  import type { ViteDevServer } from 'vite'
8
4
  import { fileURLToPath } from 'url'
@@ -21,10 +17,9 @@ export interface FastifySsrOptions {
21
17
  mode?: string
22
18
  }
23
19
 
24
- const fastifyCsrPlugin: FastifyPluginCallback<FastifySsrOptions> = async (
20
+ const fastifyCsrPlugin: FastifyPluginAsync<FastifySsrOptions> = async (
25
21
  fastify,
26
- options,
27
- done
22
+ options
28
23
  ) => {
29
24
  options.vitrifyDir =
30
25
  options.vitrifyDir || (await import('vitrify')).vitrifyDir
@@ -64,7 +59,6 @@ const fastifyCsrPlugin: FastifyPluginCallback<FastifySsrOptions> = async (
64
59
  prefix: options.baseUrl
65
60
  })
66
61
  }
67
- done()
68
62
  }
69
63
 
70
64
  export { fastifyCsrPlugin }
@@ -1,8 +1,4 @@
1
- import type {
2
- FastifyPluginCallback,
3
- FastifyRequest,
4
- FastifyReply
5
- } from 'fastify'
1
+ import type { FastifyPluginAsync, FastifyRequest, FastifyReply } from 'fastify'
6
2
  import fastifyStatic from '@fastify/static'
7
3
  import { readFileSync } from 'fs'
8
4
  import { fileURLToPath } from 'url'
@@ -31,10 +27,9 @@ export interface FastifySsrOptions {
31
27
  host?: string
32
28
  }
33
29
 
34
- const fastifySsrPlugin: FastifyPluginCallback<FastifySsrOptions> = async (
30
+ const fastifySsrPlugin: FastifyPluginAsync<FastifySsrOptions> = async (
35
31
  fastify,
36
- options,
37
- done
32
+ options
38
33
  ) => {
39
34
  options.baseUrl = options.baseUrl || '/'
40
35
  options.mode = options.mode || process.env.MODE || import.meta.env.MODE
@@ -223,8 +218,6 @@ const fastifySsrPlugin: FastifyPluginCallback<FastifySsrOptions> = async (
223
218
  res.send(html)
224
219
  })
225
220
  }
226
-
227
- done()
228
221
  }
229
222
 
230
223
  export { fastifySsrPlugin }
package/src/node/index.ts CHANGED
@@ -531,16 +531,38 @@ export const baseConfig = async ({
531
531
  if (debug) plugins.push(visualizer())
532
532
  }
533
533
 
534
+ // Vue now only exports CJS for Node
535
+ // Add the deps as devDependency
536
+ const vueInternalPkgs = [
537
+ '@vue/runtime-dom',
538
+ '@vue/runtime-core',
539
+ '@vue/reactivity',
540
+ '@vue/shared',
541
+ '@vue/server-renderer'
542
+ ]
543
+
544
+ const vuePkgAliases: Alias[] = []
545
+ for (const pkg of vueInternalPkgs) {
546
+ const specifier = pkg.split('/').at(-1)
547
+ const pkgJsonPath = await findDepPkgJsonPath(pkg, fileURLToPath(appDir!))
548
+ if (pkgJsonPath)
549
+ vuePkgAliases.push({
550
+ find: pkg,
551
+ replacement: fileURLToPath(
552
+ new URL(
553
+ `./dist/${specifier}.esm-bundler.js`,
554
+ `file://${pkgJsonPath}` || ''
555
+ )
556
+ )
557
+ })
558
+ }
559
+
534
560
  const alias: Alias[] = [
535
561
  { find: 'src', replacement: fileURLToPath(srcDir) },
536
562
  { find: 'app', replacement: fileURLToPath(appDir) },
537
563
  { find: 'cwd', replacement: fileURLToPath(cwd) },
538
564
  { find: 'boot', replacement: fileURLToPath(new URL('boot/', srcDir)) },
539
565
  { find: 'assets', replacement: fileURLToPath(new URL('assets/', srcDir)) },
540
- // ...Object.entries(packageUrls).map(([key, value]) => ({
541
- // find: key,
542
- // replacement: value.pathname
543
- // }))
544
566
  {
545
567
  find: new RegExp('^vue$'),
546
568
  replacement: fileURLToPath(
@@ -552,7 +574,8 @@ export const baseConfig = async ({
552
574
  replacement: fileURLToPath(
553
575
  new URL('./dist/vue-router.esm-bundler.js', packageUrls['vue-router'])
554
576
  )
555
- }
577
+ },
578
+ ...vuePkgAliases
556
579
  ]
557
580
  if (mode === 'development' && vitrifyConfig.vitrify?.dev?.alias)
558
581
  alias.push(...vitrifyConfig.vitrify.dev.alias)