vitrify 0.13.1 → 0.14.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/bin/cli.js +1 -1
- package/dist/bin/dev.js +2 -2
- package/dist/frameworks/vue/fastify-ssr-plugin.js +1 -1
- package/dist/index.js +11 -15
- package/dist/plugins/quasar.js +4 -4
- package/dist/types/bin/dev.d.ts +3 -3
- package/package.json +29 -28
- package/src/node/bin/cli.ts +1 -1
- package/src/node/bin/dev.ts +1 -1
- package/src/node/frameworks/vue/fastify-ssr-plugin.ts +1 -1
- package/src/node/index.ts +13 -14
- package/src/node/plugins/quasar.ts +3 -4
- package/src/vite/vue/main.ts +7 -3
package/dist/bin/cli.js
CHANGED
|
@@ -80,7 +80,7 @@ cli
|
|
|
80
80
|
prerender({
|
|
81
81
|
outDir: fileURLToPath(new URL('static/', baseOutDir)),
|
|
82
82
|
templatePath: fileURLToPath(new URL('static/index.html', baseOutDir)),
|
|
83
|
-
manifestPath: fileURLToPath(new URL('static/ssr-manifest.json', baseOutDir)),
|
|
83
|
+
manifestPath: fileURLToPath(new URL('static/.vite/ssr-manifest.json', baseOutDir)),
|
|
84
84
|
entryServerPath: new URL('ssr/server/entry-server.mjs', baseOutDir),
|
|
85
85
|
onRendered
|
|
86
86
|
});
|
package/dist/bin/dev.js
CHANGED
|
@@ -52,7 +52,7 @@ ssr, framework = 'vue', host, appDir, publicDir, base }) {
|
|
|
52
52
|
// middlewareMode: mode === 'ssr' ? 'ssr' : undefined,
|
|
53
53
|
middlewareMode: ssr ? true : false,
|
|
54
54
|
fs: {
|
|
55
|
-
strict: false,
|
|
55
|
+
strict: false, // https://github.com/vitejs/vite/issues/8175
|
|
56
56
|
allow: [
|
|
57
57
|
searchForWorkspaceRoot(process.cwd()),
|
|
58
58
|
searchForWorkspaceRoot(fileURLToPath(appDir)),
|
|
@@ -138,7 +138,7 @@ ssr, framework = 'vue', host, appDir, publicDir, vite }) {
|
|
|
138
138
|
if (vite && app) {
|
|
139
139
|
await app.ready();
|
|
140
140
|
await app.close();
|
|
141
|
-
({ app, server } = await createServer({
|
|
141
|
+
({ app, server, vite } = await createServer({
|
|
142
142
|
ssr: 'fastify',
|
|
143
143
|
host: host,
|
|
144
144
|
appDir,
|
|
@@ -113,7 +113,7 @@ const fastifySsrPlugin = async (fastify, options, done) => {
|
|
|
113
113
|
provide
|
|
114
114
|
};
|
|
115
115
|
const template = readFileSync(fileURLToPath(new URL('./dist/ssr/client/index.html', options.appDir))).toString();
|
|
116
|
-
const manifest = JSON.parse(readFileSync(new URL('./dist/ssr/client/ssr-manifest.json', options.appDir)).toString());
|
|
116
|
+
const manifest = JSON.parse(readFileSync(new URL('./dist/ssr/client/.vite/ssr-manifest.json', options.appDir)).toString());
|
|
117
117
|
const render = (await import(fileURLToPath(new URL('./dist/ssr/server/entry-server.mjs', options.appDir)))).render;
|
|
118
118
|
const [appHtml, preloadLinks] = await render(url, manifest, ssrContext);
|
|
119
119
|
if (!ssrContext.initialState)
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import vuePlugin from '@vitejs/plugin-vue';
|
|
2
|
-
import {
|
|
2
|
+
import { findDepPkgJsonPath } from 'vitefu';
|
|
3
3
|
import { mergeConfig } from 'vite';
|
|
4
4
|
import { build } from 'esbuild';
|
|
5
5
|
import fs from 'fs';
|
|
@@ -190,9 +190,9 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
190
190
|
const packageUrls = vitrifyConfig.vitrify?.urls?.packages || {};
|
|
191
191
|
await (async () => {
|
|
192
192
|
for (const val of localPackages) {
|
|
193
|
-
const
|
|
194
|
-
if (
|
|
195
|
-
packageUrls[val] = new URL(`file://${
|
|
193
|
+
const pkgDir = await findDepPkgJsonPath(val, fileURLToPath(appDir));
|
|
194
|
+
if (pkgDir)
|
|
195
|
+
packageUrls[val] = new URL(`file://${pkgDir}`);
|
|
196
196
|
}
|
|
197
197
|
})();
|
|
198
198
|
// await (async () => {
|
|
@@ -250,10 +250,10 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
250
250
|
name: 'vitrify-transforms',
|
|
251
251
|
enforce: 'pre',
|
|
252
252
|
transform: (code, id) => {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
253
|
+
if (['main.ts', 'vitrify'].every((val) => id.includes(val))) {
|
|
254
|
+
if (!isPwa)
|
|
255
|
+
code = code.replace(/\/\/ @vitrify-pwa-only((.|\n)*)\/\/ @vitrify-pwa-only-end/, '');
|
|
256
|
+
}
|
|
257
257
|
if (['RootComponent.vue', 'vitrify'].every((val) => id.includes(val))) {
|
|
258
258
|
const css = `${globalCss
|
|
259
259
|
.map((css) => `@import '${css}';`)
|
|
@@ -384,8 +384,8 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
384
384
|
name: 'html-transform',
|
|
385
385
|
enforce: 'pre',
|
|
386
386
|
transformIndexHtml: {
|
|
387
|
-
|
|
388
|
-
|
|
387
|
+
order: 'pre',
|
|
388
|
+
handler: (html) => {
|
|
389
389
|
let entry;
|
|
390
390
|
switch (ssr) {
|
|
391
391
|
case 'ssg':
|
|
@@ -466,11 +466,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
466
466
|
let noExternal = [
|
|
467
467
|
new RegExp(`^(?!(${[...builtinModules, ...serverModules].join('|')}))`)
|
|
468
468
|
];
|
|
469
|
-
const external = [
|
|
470
|
-
...builtinModules,
|
|
471
|
-
...serverModules,
|
|
472
|
-
'virtual:pwa-register/vue'
|
|
473
|
-
];
|
|
469
|
+
const external = [...builtinModules, ...serverModules];
|
|
474
470
|
if (ssr === 'server') {
|
|
475
471
|
rollupOptions = {
|
|
476
472
|
...rollupOptions,
|
package/dist/plugins/quasar.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { resolvePackageData } from 'vite';
|
|
2
1
|
import { fileURLToPath } from 'url';
|
|
2
|
+
import { findDepPkgJsonPath } from 'vitefu';
|
|
3
3
|
export const injectSsrContext = (html, ssrContext) => html
|
|
4
4
|
.replace(/(<html[^>]*)(>)/i, (found, start, end) => {
|
|
5
5
|
let matches;
|
|
@@ -52,9 +52,9 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
|
|
|
52
52
|
// const localPackages: string[] = []
|
|
53
53
|
await (async () => {
|
|
54
54
|
for (const val of localPackages) {
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
57
|
-
urls.packages[val] = new URL(`file://${
|
|
55
|
+
const pkgDir = await findDepPkgJsonPath(val, fileURLToPath(config.vitrify.urls.app));
|
|
56
|
+
if (pkgDir)
|
|
57
|
+
urls.packages[val] = new URL(`file://${pkgDir}`);
|
|
58
58
|
}
|
|
59
59
|
})();
|
|
60
60
|
const onMountedHooks = [
|
package/dist/types/bin/dev.d.ts
CHANGED
|
@@ -47,8 +47,8 @@ export declare function createServer({ port, logLevel, ssr, framework, host, app
|
|
|
47
47
|
resolve: Required<import("vite").ResolveOptions> & {
|
|
48
48
|
alias: import("vite").Alias[];
|
|
49
49
|
};
|
|
50
|
-
plugins: readonly import("vite").Plugin[];
|
|
51
|
-
css: import("vite").ResolvedCSSOptions
|
|
50
|
+
plugins: readonly import("vite").Plugin<any>[];
|
|
51
|
+
css: import("vite").ResolvedCSSOptions;
|
|
52
52
|
esbuild: false | import("vite").ESBuildOptions;
|
|
53
53
|
server: import("vite").ResolvedServerOptions;
|
|
54
54
|
build: import("vite").ResolvedBuildOptions;
|
|
@@ -58,7 +58,7 @@ export declare function createServer({ port, logLevel, ssr, framework, host, app
|
|
|
58
58
|
logger: import("vite").Logger;
|
|
59
59
|
createResolver: (options?: Partial<import("vite").InternalResolveOptions> | undefined) => import("vite").ResolveFn;
|
|
60
60
|
optimizeDeps: import("vite").DepOptimizationOptions;
|
|
61
|
-
worker: import("vite").
|
|
61
|
+
worker: import("vite").ResolvedWorkerOptions;
|
|
62
62
|
appType: import("vite").AppType;
|
|
63
63
|
experimental: import("vite").ExperimentalOptions;
|
|
64
64
|
} & import("vite").PluginHookUtils>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitrify",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Stefan van Herwijnen",
|
|
6
6
|
"description": "Vite as your Full Stack development tool",
|
|
@@ -48,45 +48,46 @@
|
|
|
48
48
|
"test": "vitest test/"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@fastify/middie": "^8.
|
|
52
|
-
"@fastify/static": "^6.
|
|
53
|
-
"@quasar/extras": "^1.16.
|
|
54
|
-
"@vitejs/plugin-vue": "^4.
|
|
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",
|
|
55
55
|
"ajv": "^8.12.0",
|
|
56
56
|
"builtin-modules": "^3.3.0",
|
|
57
57
|
"cac": "^6.7.14",
|
|
58
|
-
"chalk": "^5.
|
|
59
|
-
"critters": "^0.0.
|
|
58
|
+
"chalk": "^5.3.0",
|
|
59
|
+
"critters": "^0.0.20",
|
|
60
60
|
"cross-env": "^7.0.3",
|
|
61
|
-
"esbuild": "^0.
|
|
62
|
-
"fastify": "^4.
|
|
63
|
-
"glob": "^10.
|
|
64
|
-
"happy-dom": "^
|
|
61
|
+
"esbuild": "^0.19.8",
|
|
62
|
+
"fastify": "^4.24.3",
|
|
63
|
+
"glob": "^10.3.10",
|
|
64
|
+
"happy-dom": "^12.10.3",
|
|
65
65
|
"is-port-reachable": "^4.0.0",
|
|
66
|
-
"magic-string": "^0.30.
|
|
66
|
+
"magic-string": "^0.30.5",
|
|
67
67
|
"merge-deep": "^3.0.3",
|
|
68
68
|
"readline": "^1.3.0",
|
|
69
|
-
"rollup-plugin-visualizer": "^5.9.
|
|
70
|
-
"sass": "1.
|
|
69
|
+
"rollup-plugin-visualizer": "^5.9.3",
|
|
70
|
+
"sass": "1.69.5",
|
|
71
71
|
"ts-node": "^10.9.1",
|
|
72
|
-
"unplugin-vue-components": "^0.
|
|
73
|
-
"vite": "^
|
|
74
|
-
"vite-plugin-pwa": "^0.
|
|
75
|
-
"
|
|
72
|
+
"unplugin-vue-components": "^0.25.2",
|
|
73
|
+
"vite": "^5.0.2",
|
|
74
|
+
"vite-plugin-pwa": "^0.17.2",
|
|
75
|
+
"vitefu": "^0.2.5",
|
|
76
|
+
"vitest": "^0.34.6",
|
|
76
77
|
"workbox-window": "^7.0.0"
|
|
77
78
|
},
|
|
78
79
|
"devDependencies": {
|
|
79
|
-
"@types/connect": "^3.4.
|
|
80
|
+
"@types/connect": "^3.4.38",
|
|
80
81
|
"@types/glob": "^8.1.0",
|
|
81
|
-
"@types/merge-deep": "^3.0.
|
|
82
|
-
"@types/node": "^
|
|
83
|
-
"@types/ws": "^8.5.
|
|
84
|
-
"@vue/runtime-core": "^3.
|
|
85
|
-
"quasar": "^2.
|
|
86
|
-
"rollup": "^
|
|
87
|
-
"typescript": "^5.
|
|
88
|
-
"vue": "^3.
|
|
89
|
-
"vue-router": "^4.
|
|
82
|
+
"@types/merge-deep": "^3.0.3",
|
|
83
|
+
"@types/node": "^20.10.0",
|
|
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",
|
|
90
|
+
"vue-router": "^4.2.5"
|
|
90
91
|
},
|
|
91
92
|
"peerDependencies": {
|
|
92
93
|
"@fastify/static": "^6.5.0",
|
package/src/node/bin/cli.ts
CHANGED
|
@@ -96,7 +96,7 @@ cli
|
|
|
96
96
|
outDir: fileURLToPath(new URL('static/', baseOutDir)),
|
|
97
97
|
templatePath: fileURLToPath(new URL('static/index.html', baseOutDir)),
|
|
98
98
|
manifestPath: fileURLToPath(
|
|
99
|
-
new URL('static/ssr-manifest.json', baseOutDir)
|
|
99
|
+
new URL('static/.vite/ssr-manifest.json', baseOutDir)
|
|
100
100
|
),
|
|
101
101
|
entryServerPath: new URL('ssr/server/entry-server.mjs', baseOutDir),
|
|
102
102
|
onRendered
|
package/src/node/bin/dev.ts
CHANGED
|
@@ -174,7 +174,7 @@ const fastifySsrPlugin: FastifyPluginCallback<FastifySsrOptions> = async (
|
|
|
174
174
|
).toString()
|
|
175
175
|
const manifest = JSON.parse(
|
|
176
176
|
readFileSync(
|
|
177
|
-
new URL('./dist/ssr/client/ssr-manifest.json', options.appDir)
|
|
177
|
+
new URL('./dist/ssr/client/.vite/ssr-manifest.json', options.appDir)
|
|
178
178
|
).toString()
|
|
179
179
|
)
|
|
180
180
|
const render = (
|
package/src/node/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import vuePlugin from '@vitejs/plugin-vue'
|
|
2
2
|
import type { Alias, InlineConfig, UserConfig } from 'vite'
|
|
3
|
-
import {
|
|
3
|
+
import { findDepPkgJsonPath } from 'vitefu'
|
|
4
4
|
import { mergeConfig } from 'vite'
|
|
5
5
|
import { build } from 'esbuild'
|
|
6
6
|
import fs from 'fs'
|
|
@@ -261,8 +261,8 @@ export const baseConfig = async ({
|
|
|
261
261
|
vitrifyConfig.vitrify?.urls?.packages || {}
|
|
262
262
|
await (async () => {
|
|
263
263
|
for (const val of localPackages) {
|
|
264
|
-
const
|
|
265
|
-
if (
|
|
264
|
+
const pkgDir = await findDepPkgJsonPath(val, fileURLToPath(appDir))
|
|
265
|
+
if (pkgDir) packageUrls![val] = new URL(`file://${pkgDir}`)
|
|
266
266
|
}
|
|
267
267
|
})()
|
|
268
268
|
|
|
@@ -327,10 +327,13 @@ export const baseConfig = async ({
|
|
|
327
327
|
name: 'vitrify-transforms',
|
|
328
328
|
enforce: 'pre',
|
|
329
329
|
transform: (code, id) => {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
330
|
+
if (['main.ts', 'vitrify'].every((val) => id.includes(val))) {
|
|
331
|
+
if (!isPwa)
|
|
332
|
+
code = code.replace(
|
|
333
|
+
/\/\/ @vitrify-pwa-only((.|\n)*)\/\/ @vitrify-pwa-only-end/,
|
|
334
|
+
''
|
|
335
|
+
)
|
|
336
|
+
}
|
|
334
337
|
if (['RootComponent.vue', 'vitrify'].every((val) => id.includes(val))) {
|
|
335
338
|
const css = `${globalCss
|
|
336
339
|
.map((css) => `@import '${css}';`)
|
|
@@ -472,8 +475,8 @@ export const baseConfig = async ({
|
|
|
472
475
|
name: 'html-transform',
|
|
473
476
|
enforce: 'pre',
|
|
474
477
|
transformIndexHtml: {
|
|
475
|
-
|
|
476
|
-
|
|
478
|
+
order: 'pre',
|
|
479
|
+
handler: (html) => {
|
|
477
480
|
let entry: string
|
|
478
481
|
switch (ssr) {
|
|
479
482
|
case 'ssg':
|
|
@@ -564,11 +567,7 @@ export const baseConfig = async ({
|
|
|
564
567
|
let noExternal: RegExp[] | string[] = [
|
|
565
568
|
new RegExp(`^(?!(${[...builtinModules, ...serverModules].join('|')}))`)
|
|
566
569
|
]
|
|
567
|
-
const external = [
|
|
568
|
-
...builtinModules,
|
|
569
|
-
...serverModules,
|
|
570
|
-
'virtual:pwa-register/vue'
|
|
571
|
-
]
|
|
570
|
+
const external = [...builtinModules, ...serverModules]
|
|
572
571
|
|
|
573
572
|
if (ssr === 'server') {
|
|
574
573
|
rollupOptions = {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { Plugin } from 'vite'
|
|
2
|
-
import { resolvePackageData } from 'vite'
|
|
3
2
|
import { fileURLToPath } from 'url'
|
|
4
|
-
import Components from 'unplugin-vue-components/vite'
|
|
5
3
|
import type {
|
|
6
4
|
OnBootHook,
|
|
7
5
|
OnMountedHook,
|
|
8
6
|
VitrifyConfig
|
|
9
7
|
} from '../vitrify-config.js'
|
|
10
8
|
import type { VitrifyPlugin } from './index.js'
|
|
9
|
+
import { findDepPkgJsonPath } from 'vitefu'
|
|
11
10
|
export interface QuasarConf {
|
|
12
11
|
ctx?: Record<string, any>
|
|
13
12
|
css?: string[]
|
|
@@ -114,11 +113,11 @@ export const QuasarPlugin: VitrifyPlugin = async ({
|
|
|
114
113
|
// const localPackages: string[] = []
|
|
115
114
|
await (async () => {
|
|
116
115
|
for (const val of localPackages) {
|
|
117
|
-
const
|
|
116
|
+
const pkgDir = await findDepPkgJsonPath(
|
|
118
117
|
val,
|
|
119
118
|
fileURLToPath(config.vitrify!.urls!.app!)
|
|
120
119
|
)
|
|
121
|
-
if (
|
|
120
|
+
if (pkgDir) urls!.packages![val] = new URL(`file://${pkgDir}`)
|
|
122
121
|
}
|
|
123
122
|
})()
|
|
124
123
|
|
package/src/vite/vue/main.ts
CHANGED
|
@@ -78,10 +78,14 @@ export async function createApp(
|
|
|
78
78
|
await fn({ app, ssrContext, staticImports })
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
// @vitrify-pwa-only
|
|
82
|
+
if (__IS_PWA__) {
|
|
83
|
+
if (typeof window !== 'undefined') {
|
|
84
|
+
const { registerPWA } = await import('./pwa.js')
|
|
85
|
+
registerPWA(router)
|
|
86
|
+
}
|
|
84
87
|
}
|
|
88
|
+
// @vitrify-pwa-only-end
|
|
85
89
|
|
|
86
90
|
return { app, router, routes }
|
|
87
91
|
}
|