vitrify 0.6.2 → 0.6.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/types/bin/dev.d.ts
CHANGED
|
@@ -49,6 +49,6 @@ export declare function createServer({ port, logLevel, ssr, framework, host, app
|
|
|
49
49
|
optimizeDeps: import("vite").DepOptimizationOptions;
|
|
50
50
|
worker: import("vite").ResolveWorkerOptions;
|
|
51
51
|
appType: import("vite").AppType;
|
|
52
|
-
experimental: import("vite").
|
|
52
|
+
experimental: import("vite").ExperimentalOptions;
|
|
53
53
|
}>;
|
|
54
54
|
}>;
|
package/package.json
CHANGED
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
import { createApp } from '../main.js'
|
|
2
2
|
import { renderToString } from '@vue/server-renderer'
|
|
3
|
-
import type { FastifyInstance } from 'fastify'
|
|
4
|
-
// import * as ApolloSSR from '@vue/apollo-ssr'
|
|
5
|
-
// import { ApolloClients } from '@vue/apollo-composable'
|
|
6
|
-
// import serialize from 'serialize-javascript'
|
|
7
3
|
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
export const setup = async ({ fastify }: { fastify: FastifyInstance }) => {
|
|
11
|
-
if (onSetup?.length) {
|
|
12
|
-
for (const setup of onSetup) {
|
|
13
|
-
await setup(fastify)
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return fastify
|
|
17
|
-
}
|
|
4
|
+
import { onRendered } from 'virtual:vitrify-hooks'
|
|
18
5
|
|
|
19
6
|
const initializeApp = async (url, ssrContext) => {
|
|
20
7
|
const onRenderedList = []
|
|
@@ -53,18 +40,11 @@ export const getRoutes = async () =>
|
|
|
53
40
|
export async function render(url, manifest, ssrContext) {
|
|
54
41
|
const { app, router } = await initializeApp(url, ssrContext)
|
|
55
42
|
|
|
56
|
-
// passing SSR context object which will be available via useSSRContext()
|
|
57
|
-
// @vitejs/plugin-vue injects code into a component's setup() that registers
|
|
58
|
-
// itself on ctx.modules. After the render, ctx.modules would contain all the
|
|
59
|
-
// components that have been instantiated during this render call.
|
|
60
43
|
const ctx = {
|
|
61
44
|
__qMetaList: []
|
|
62
45
|
}
|
|
63
46
|
let html = await renderToString(app, ctx)
|
|
64
|
-
|
|
65
|
-
// the SSR manifest generated by Vite contains module -> chunk/asset mapping
|
|
66
|
-
// which we can then use to determine what files need to be preloaded for this
|
|
67
|
-
// request.
|
|
47
|
+
|
|
68
48
|
const preloadLinks = renderPreloadLinks(ctx.modules, manifest)
|
|
69
49
|
|
|
70
50
|
if (onRendered?.length) {
|