vitrify 0.6.2 → 0.6.5

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
@@ -1,10 +1,12 @@
1
1
  // import { resolve } from 'import-meta-resolve'
2
2
  import { existsSync } from 'fs';
3
- export const resolve = (packageName, base) => {
3
+ export const resolve = (packageName, base, counter = 0) => {
4
4
  const packageUrl = new URL(`./node_modules/${packageName}/`, base);
5
5
  if (existsSync(packageUrl.pathname)) {
6
6
  return new URL('./', packageUrl);
7
7
  }
8
+ if (counter < 10)
9
+ return resolve(packageName, new URL('../', base), counter + 1);
8
10
  throw new Error(`Package ${packageName} not found in ${base.pathname}.`);
9
11
  };
10
12
  export const getPkgJsonDir = (dir) => {
@@ -178,7 +178,7 @@ export const QuasarPlugin = async ({ ssr = false, pwa = false }) => {
178
178
  // ).pathname
179
179
  // },
180
180
  {
181
- find: 'quasar/src',
181
+ find: 'quasar/src/',
182
182
  replacement: new URL('node_modules/quasar/src/', config.vitrify?.urls?.app).pathname
183
183
  }
184
184
  // {
@@ -1,4 +1,4 @@
1
- export declare const resolve: (packageName: string, base: URL) => URL;
1
+ export declare const resolve: (packageName: string, base: URL, counter?: number) => URL;
2
2
  export declare const getPkgJsonDir: (dir: URL) => URL;
3
3
  export declare const getAppDir: () => URL;
4
4
  export declare const getCliDir: () => URL;
@@ -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").ResolvedExperimentalOptions;
52
+ experimental: import("vite").ExperimentalOptions;
53
53
  }>;
54
54
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitrify",
3
- "version": "0.6.2",
3
+ "version": "0.6.5",
4
4
  "license": "MIT",
5
5
  "author": "Stefan van Herwijnen",
6
6
  "description": "Pre-configured Vite CLI for your framework",
@@ -1,11 +1,13 @@
1
1
  // import { resolve } from 'import-meta-resolve'
2
2
  import { existsSync } from 'fs'
3
3
 
4
- export const resolve = (packageName: string, base: URL) => {
4
+ export const resolve = (packageName: string, base: URL, counter = 0): URL => {
5
5
  const packageUrl = new URL(`./node_modules/${packageName}/`, base)
6
6
  if (existsSync(packageUrl.pathname)) {
7
7
  return new URL('./', packageUrl)
8
8
  }
9
+ if (counter < 10)
10
+ return resolve(packageName, new URL('../', base), counter + 1)
9
11
  throw new Error(`Package ${packageName} not found in ${base.pathname}.`)
10
12
  }
11
13
 
@@ -257,7 +257,7 @@ export const QuasarPlugin: VitrifyPlugin = async ({
257
257
  // ).pathname
258
258
  // },
259
259
  {
260
- find: 'quasar/src',
260
+ find: 'quasar/src/',
261
261
  replacement: new URL(
262
262
  'node_modules/quasar/src/',
263
263
  config.vitrify?.urls?.app
@@ -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 { onSetup, onRendered } from 'virtual:vitrify-hooks'
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
- // html = injectSsrContext(html, ssrContext)
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) {