vitrify 0.9.2 → 0.10.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/index.js +3 -0
- package/dist/types/bin/dev.d.ts +1 -1
- package/dist/types/frameworks/vue/fastify-ssr-plugin.d.ts +3 -1
- package/dist/types/frameworks/vue/server.d.ts +1 -1
- package/package.json +22 -22
- package/src/node/bin/test.ts +1 -0
- package/src/node/frameworks/vue/fastify-ssr-plugin.ts +1 -1
- package/src/node/index.ts +2 -0
- package/src/vite/vue/csr/app.ts +1 -1
- package/src/vite/vue/csr/fastify-csr-plugin.ts +1 -1
- package/src/vite/vue/csr/server.ts +1 -1
- package/src/vite/vue/main.ts +17 -3
- package/src/vite/vue/ssr/entry-client.ts +1 -1
- package/src/vite/vue/ssr/entry-server.ts +1 -1
- package/src/vite/vue/ssr/server.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -141,6 +141,8 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
141
141
|
}
|
|
142
142
|
catch (e) {
|
|
143
143
|
console.log('No vitrify.config.(ts|js) file found, using defaults');
|
|
144
|
+
if (process.env.DEBUG)
|
|
145
|
+
console.error(e);
|
|
144
146
|
vitrifyConfig = {};
|
|
145
147
|
}
|
|
146
148
|
const localPackages = ['vue', 'vue-router', '@vue/server-renderer'];
|
|
@@ -338,6 +340,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
338
340
|
}
|
|
339
341
|
}
|
|
340
342
|
});
|
|
343
|
+
// @ts-ignore
|
|
341
344
|
if (debug)
|
|
342
345
|
plugins.push(visualizer());
|
|
343
346
|
}
|
package/dist/types/bin/dev.d.ts
CHANGED
|
@@ -49,5 +49,5 @@ export declare function createServer({ port, logLevel, ssr, framework, host, app
|
|
|
49
49
|
worker: import("vite").ResolveWorkerOptions;
|
|
50
50
|
appType: import("vite").AppType;
|
|
51
51
|
experimental: import("vite").ExperimentalOptions;
|
|
52
|
-
}>;
|
|
52
|
+
} & import("vite").PluginHookUtils>;
|
|
53
53
|
}>;
|
|
@@ -3,7 +3,9 @@ import type { ViteDevServer } from 'vite';
|
|
|
3
3
|
import type { OnRenderedHook } from 'src/node/vitrify-config.js';
|
|
4
4
|
export interface FastifySsrOptions {
|
|
5
5
|
baseUrl?: string;
|
|
6
|
-
provide?: (req: FastifyRequest, res: FastifyReply) => Promise<Record<string, unknown
|
|
6
|
+
provide?: (req: FastifyRequest, res: FastifyReply) => Promise<Record<string, unknown | {
|
|
7
|
+
value: unknown;
|
|
8
|
+
}>>;
|
|
7
9
|
vitrifyDir?: URL;
|
|
8
10
|
vite?: ViteDevServer;
|
|
9
11
|
onRendered?: OnRenderedHook[];
|
|
@@ -11,4 +11,4 @@ export declare const createApp: ({ onSetup, appDir, baseUrl, fastifyPlugin, onRe
|
|
|
11
11
|
onRendered: OnRenderedHook[];
|
|
12
12
|
vitrifyDir?: URL | undefined;
|
|
13
13
|
mode: string;
|
|
14
|
-
}) => FastifyInstance<import("http").Server
|
|
14
|
+
}) => FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, any, import("fastify").FastifyTypeProviderDefault> & PromiseLike<FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, any, import("fastify").FastifyTypeProviderDefault>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitrify",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Stefan van Herwijnen",
|
|
6
6
|
"description": "Vite as your Full Stack development tool",
|
|
@@ -58,48 +58,48 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@fastify/middie": "^8.0.0",
|
|
60
60
|
"@fastify/static": "^6.5.0",
|
|
61
|
-
"@quasar/extras": "^1.15.
|
|
62
|
-
"@vitejs/plugin-vue": "^3.0
|
|
61
|
+
"@quasar/extras": "^1.15.2",
|
|
62
|
+
"@vitejs/plugin-vue": "^3.1.0",
|
|
63
63
|
"@vitrify/plugin-env": "^0.1.0",
|
|
64
64
|
"builtin-modules": "^3.3.0",
|
|
65
|
-
"cac": "^6.7.
|
|
65
|
+
"cac": "^6.7.14",
|
|
66
66
|
"chalk": "^5.0.1",
|
|
67
67
|
"critters": "^0.0.16",
|
|
68
68
|
"cross-env": "^7.0.3",
|
|
69
|
-
"esbuild": "^0.
|
|
70
|
-
"fastify": "^4.3
|
|
69
|
+
"esbuild": "^0.15.7",
|
|
70
|
+
"fastify": "^4.5.3",
|
|
71
71
|
"glob": "^8.0.3",
|
|
72
72
|
"happy-dom": "^6.0.4",
|
|
73
73
|
"is-port-reachable": "^4.0.0",
|
|
74
|
-
"magic-string": "^0.26.
|
|
74
|
+
"magic-string": "^0.26.3",
|
|
75
75
|
"merge-deep": "^3.0.3",
|
|
76
76
|
"readline": "^1.3.0",
|
|
77
|
-
"rollup-plugin-visualizer": "^5.
|
|
78
|
-
"sass": "1.54.
|
|
77
|
+
"rollup-plugin-visualizer": "^5.8.1",
|
|
78
|
+
"sass": "1.54.8",
|
|
79
79
|
"ts-node": "^10.9.1",
|
|
80
|
-
"unplugin-vue-components": "^0.22.
|
|
81
|
-
"vite": "^3.0
|
|
82
|
-
"vitest": "^0.
|
|
80
|
+
"unplugin-vue-components": "^0.22.4",
|
|
81
|
+
"vite": "^3.1.0",
|
|
82
|
+
"vitest": "^0.23.1"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@types/connect": "^3.4.35",
|
|
86
|
-
"@types/glob": "^
|
|
86
|
+
"@types/glob": "^8.0.0",
|
|
87
87
|
"@types/merge-deep": "^3.0.0",
|
|
88
|
-
"@types/node": "^18.
|
|
88
|
+
"@types/node": "^18.7.15",
|
|
89
89
|
"@types/ws": "^8.5.3",
|
|
90
|
-
"@vue/runtime-core": "^3.2.
|
|
90
|
+
"@vue/runtime-core": "^3.2.38",
|
|
91
91
|
"quasar": "^2.7.7",
|
|
92
|
-
"rollup": "^2.
|
|
93
|
-
"typescript": "^4.
|
|
94
|
-
"vue": "^3.2.
|
|
95
|
-
"vue-router": "^4.1.
|
|
92
|
+
"rollup": "^2.79.0",
|
|
93
|
+
"typescript": "^4.8.2",
|
|
94
|
+
"vue": "^3.2.38",
|
|
95
|
+
"vue-router": "^4.1.5"
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|
|
98
98
|
"@fastify/static": "^6.5.0",
|
|
99
|
-
"fastify": "^4.3
|
|
99
|
+
"fastify": "^4.5.3",
|
|
100
100
|
"quasar": "^2.7.7",
|
|
101
|
-
"vue": "^3.2.
|
|
102
|
-
"vue-router": "^4.1.
|
|
101
|
+
"vue": "^3.2.38",
|
|
102
|
+
"vue-router": "^4.1.5"
|
|
103
103
|
},
|
|
104
104
|
"publishConfig": {
|
|
105
105
|
"access": "public",
|
package/src/node/bin/test.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface FastifySsrOptions {
|
|
|
13
13
|
provide?: (
|
|
14
14
|
req: FastifyRequest,
|
|
15
15
|
res: FastifyReply
|
|
16
|
-
) => Promise<Record<string, unknown>>
|
|
16
|
+
) => Promise<Record<string, unknown | { value: unknown }>>
|
|
17
17
|
vitrifyDir?: URL
|
|
18
18
|
vite?: ViteDevServer
|
|
19
19
|
// frameworkDir?: URL
|
package/src/node/index.ts
CHANGED
|
@@ -205,6 +205,7 @@ export const baseConfig = async ({
|
|
|
205
205
|
vitrifyConfig = await vitrifyConfig({ mode, command })
|
|
206
206
|
} catch (e) {
|
|
207
207
|
console.log('No vitrify.config.(ts|js) file found, using defaults')
|
|
208
|
+
if (process.env.DEBUG) console.error(e)
|
|
208
209
|
vitrifyConfig = {}
|
|
209
210
|
}
|
|
210
211
|
|
|
@@ -409,6 +410,7 @@ export const baseConfig = async ({
|
|
|
409
410
|
}
|
|
410
411
|
})
|
|
411
412
|
|
|
413
|
+
// @ts-ignore
|
|
412
414
|
if (debug) plugins.push(visualizer())
|
|
413
415
|
}
|
|
414
416
|
|
package/src/vite/vue/csr/app.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { createApp } from '../../../node/frameworks/vue/server.js'
|
|
|
2
2
|
import { getAppDir } from '../../../node/app-urls.js'
|
|
3
3
|
// import { setup } from 'virtual:fastify-setup'
|
|
4
4
|
import { onSetup } from 'virtual:vitrify-hooks'
|
|
5
|
-
import { fastifyCsrPlugin } from './fastify-csr-plugin
|
|
5
|
+
import { fastifyCsrPlugin } from './fastify-csr-plugin'
|
|
6
6
|
import type { ViteDevServer } from 'vite'
|
|
7
7
|
|
|
8
8
|
// const appDir = getPkgJsonDir(import.meta.url)
|
package/src/vite/vue/main.ts
CHANGED
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
createApp as createVueApp,
|
|
8
8
|
h,
|
|
9
9
|
onMounted as onMountedVue,
|
|
10
|
-
getCurrentInstance
|
|
10
|
+
getCurrentInstance,
|
|
11
|
+
ref
|
|
11
12
|
} from 'vue'
|
|
12
13
|
import { onBoot, onMounted } from 'virtual:vitrify-hooks'
|
|
13
14
|
import routes from 'src/router/routes'
|
|
@@ -19,6 +20,10 @@ interface ssrContext {
|
|
|
19
20
|
[key: string]: unknown
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
function capitalizeFirstLetter(string) {
|
|
24
|
+
return string.charAt(0).toUpperCase() + string.slice(1)
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
export async function createApp(
|
|
23
28
|
ssr?: 'client' | 'server',
|
|
24
29
|
ssrContext?: ssrContext
|
|
@@ -56,7 +61,7 @@ export async function createApp(
|
|
|
56
61
|
})
|
|
57
62
|
|
|
58
63
|
let initialState: Record<string, any>
|
|
59
|
-
let provide: Record<string,
|
|
64
|
+
let provide: Record<string, any> = {}
|
|
60
65
|
if (import.meta.env.SSR) {
|
|
61
66
|
if (ssrContext?.provide) {
|
|
62
67
|
provide = ssrContext?.provide
|
|
@@ -70,7 +75,16 @@ export async function createApp(
|
|
|
70
75
|
}
|
|
71
76
|
}
|
|
72
77
|
for (let key in provide) {
|
|
73
|
-
|
|
78
|
+
if (provide[key].value) {
|
|
79
|
+
const refValue = ref(provide[key].value)
|
|
80
|
+
app.provide(key, refValue)
|
|
81
|
+
app.provide(
|
|
82
|
+
`update${capitalizeFirstLetter(key)}`,
|
|
83
|
+
(val: any) => (refValue.value = val)
|
|
84
|
+
)
|
|
85
|
+
} else {
|
|
86
|
+
app.provide(key, provide[key])
|
|
87
|
+
}
|
|
74
88
|
}
|
|
75
89
|
|
|
76
90
|
for (let fn of onBoot) {
|