New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

vike-vue

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vike-vue - npm Package Compare versions

Comparing version 0.7.6 to 0.8.0

import { OnCreateAppSync, OnCreateAppAsync, OnAfterRenderHtmlSync, OnAfterRenderHtmlAsync, OnBeforeRenderClientSync, OnBeforeRenderClientAsync, BodyInjectHtml } from './hooks/types';
import { ConfigEffect, ImportString } from 'vike/types';
import { ConfigEffect, ImportString, PageContextServer, PageContext as PageContext_, PageContextClient } from 'vike/types';
import { Component } from './types/PageContext';
import { Plugin } from 'vue';
import { TagAttributes } from './utils/getTagAttributesString';
import { Viewport } from './renderer/onRenderHtml';

@@ -21,2 +22,3 @@ declare const _default: {

};
cumulative: true;
};

@@ -36,7 +38,22 @@ Layout: {

};
description: {
env: {
server: true;
};
};
image: {
env: {
server: true;
};
};
viewport: {
env: {
server: true;
};
};
favicon: {
env: {
server: true;
client: true;
};
global: true;
};

@@ -60,8 +77,2 @@ lang: {

};
vuePlugins: {
env: {
server: true;
client: true;
};
};
onCreateApp: {

@@ -87,50 +98,141 @@ env: {

};
name: {
onAfterRenderClient: {
env: {
config: true;
server: false;
client: true;
};
cumulative: true;
};
require: {
bodyHtmlBegin: {
env: {
config: true;
server: true;
};
cumulative: true;
global: true;
};
bodyHtmlBegin: {
bodyHtmlEnd: {
env: {
server: true;
client: true;
};
cumulative: true;
global: true;
};
bodyHtmlEnd: {
htmlAttributes: {
env: {
server: true;
client: true;
};
global: true;
cumulative: true;
};
bodyAttributes: {
env: {
server: true;
};
global: true;
cumulative: true;
};
};
};
export default _default;
type VuePluginWithOptions = {
plugin: Plugin;
options?: any;
};
declare global {
namespace Vike {
interface Config {
/** Vue component rendered and appended into <head></head> */
/**
* Add arbitrary `<head>` tags.
*
* https://vike.dev/Head
*/
Head?: Component;
/**
* A component that defines the visual layout common to several pages.
*
* Technically: the `<Layout>` component wraps the root component `<Page>`.
*
* https://vike.dev/Layout
*/
Layout?: Component;
/** &lt;title>${title}&lt;/title> */
title?: string | ((pageContext: PageContext) => string);
/** &lt;link rel="icon" href="${favicon}" /> */
/**
* Set the page's tilte.
*
* Generates:
* ```jsx
* <head>
* <title>{title}</title>
* <meta property="og:title" content={title} />
* </head>
* ```
*
* https://vike.dev/title
*/
title?: string | ((pageContext: PageContext_) => string);
/**
* Set the page's description.
*
* Generates:
* ```jsx
* <head>
* <meta name="description" content={description}>
* <meta property="og:description" content={description}>
* </head>
* ```
*
* https://vike.dev/description
*/
description?: string | ((pageContext: PageContextServer) => string);
/**
* Set the page's preview image upon URL sharing.
*
* Generates:
* ```jsx
* <head>
* <meta property="og:image" content={image}>
* <meta name="twitter:card" content="summary_large_image">
* </head>
* ```
*
* https://vike.dev/image
*/
image?: string | ((pageContext: PageContextServer) => string);
/**
* Set the page's width shown to the user on mobile/tablet devices.
*
* @default "responsive"
*
* https://vike.dev/viewport
*/
viewport?: Viewport;
/**
* Set the page's favicon.
*
* Generates:
* ```jsx
* <head>
* <link rel="icon" href={favicon} />
* </head>
* ```
*
* https://vike.dev/favicon
*/
favicon?: string;
/** &lt;html lang="${lang}">
/**
* Set the page's language (`<html lang>`).
*
* @default 'en'
* @default 'en'
*
* https://vike.dev/lang
*/
lang?: string;
lang?: string | ((pageContext: PageContext_) => string) | null;
/**
* Add tag attributes such as `<html class="dark">`.
*
* https://vike.dev/htmlAttributes
*/
htmlAttributes?: TagAttributes;
/**
* Add tag attributes such as `<body class="dark">`.
*
* https://vike.dev/bodyAttributes
*/
bodyAttributes?: TagAttributes;
/**
* If `true`, the page is rendered twice: on the server-side (to HTML) and on the client-side (hydration).

@@ -140,6 +242,5 @@ *

*
* https://vike.dev/ssr
*
* @default true
*
* https://vike.dev/ssr
*/

@@ -153,15 +254,23 @@ ssr?: boolean;

*
* https://vike.dev/stream
*/
stream?: boolean | 'web';
/** @deprecated Use `onCreateApp()` instead. */
vuePlugins?: VuePluginWithOptions[];
/** The page's root Vue component */
/**
* The page's root Vue component.
*
* https://vike.dev/Page
*/
Page?: Component;
/**
* The result of this is injected at the start of `<body>`
* The result of this is injected at the start of `<body>`.
*
* https://vike.dev/bodyHtmlBegin
*/
bodyHtmlBegin?: BodyInjectHtml;
/**
* The result of this is injected at the end of `<body>`
* The result of this is injected at the end of `<body>`.
*
* @default `<div id="teleported"></div>`
*
* https://vike.dev/bodyHtmlEnd
*/

@@ -174,3 +283,3 @@ bodyHtmlEnd?: BodyInjectHtml;

*
* See https://vike.dev/onCreateApp
* https://vike.dev/onCreateApp
*/

@@ -183,2 +292,4 @@ onCreateApp?: OnCreateAppSync | OnCreateAppAsync | ImportString;

* Typically used for dehydrating state management libraries.
*
* https://vike.dev/onAfterRenderHtml
*/

@@ -190,7 +301,37 @@ onAfterRenderHtml?: OnAfterRenderHtmlSync | OnAfterRenderHtmlAsync | ImportString;

* Typically used for hydrating state management libraries.
*
* https://vike.dev/onBeforeRenderClient
*/
onBeforeRenderClient?: OnBeforeRenderClientSync | OnBeforeRenderClientAsync | ImportString;
/**
* Client-side hook called after the page is rendered.
*
* https://vike.dev/onAfterRenderClient
*/
onAfterRenderClient?: (pageContext: PageContextClient) => void;
}
interface ConfigResolved {
onCreateApp?: Array<OnCreateAppSync | OnCreateAppAsync>;
onAfterRenderHtml?: Array<OnAfterRenderHtmlSync | OnAfterRenderHtmlAsync>;
onBeforeRenderClient?: Array<OnBeforeRenderClientSync | OnBeforeRenderClientAsync>;
onAfterRenderClient?: Function[];
bodyHtmlBegin?: BodyInjectHtml[];
bodyHtmlEnd?: BodyInjectHtml[];
Layout?: Component[];
Head?: Component[];
bodyAttributes?: TagAttributes[];
htmlAttributes?: TagAttributes[];
}
}
}
type PickWithoutGetter<T, K extends keyof T> = {
[P in K]: Exclude<T[P], Function>;
};
export type ConfigFromHook = PickWithoutGetter<Vike.Config, 'Head' | 'title' | 'description' | 'image'>;
export type ConfigFromHookResolved = {
Head?: Component[];
title?: string;
description?: string;
image?: string;
};
declare const globalName: (target: Object, value: string) => Object;

@@ -197,0 +338,0 @@ declare global {

@@ -19,3 +19,3 @@ const toggleSsrRelatedConfig = ({ configDefinedAt, configValue }) => {

require: {
vike: ">=0.4.172"
vike: ">=0.4.182"
},

@@ -29,3 +29,3 @@ // https://vike.dev/onRenderHtml

// this list.
passToClient: ["fromHtmlRenderer"],
passToClient: ["fromHtmlRenderer", "_configFromHook"],
// https://vike.dev/clientRouting

@@ -37,3 +37,4 @@ clientRouting: true,

Head: {
env: { server: true }
env: { server: true },
cumulative: true
},

@@ -47,4 +48,14 @@ Layout: {

},
description: {
env: { server: true }
},
image: {
env: { server: true }
},
viewport: {
env: { server: true }
},
favicon: {
env: { server: true, client: true }
env: { server: true },
global: true
},

@@ -61,10 +72,2 @@ lang: {

},
// Deprecated (in favor of `onCreateApp()`). TODO/next-major-release: remove it.
vuePlugins: {
// List of vue plugins to be installed with app.vue() in onRenderHtml and
// onRenderClient. We make this config available both on the server and
// the client always, but if SSR is disabled, onRenderHtml won't make use
// of it.
env: { server: true, client: true }
},
onCreateApp: {

@@ -82,17 +85,27 @@ env: { server: true, client: true },

},
// Vike already defines the setting 'name', but we redundantly define it here for older Vike versions (otherwise older Vike versions will complain that 'name` is an unknown config). TODO/eventually: remove this once <=0.4.172 versions become rare (also because we use the `require` setting starting from `0.4.173`).
name: {
env: { config: true }
onAfterRenderClient: {
env: { server: false, client: true },
cumulative: true
},
// Vike already defines the setting 'require', but we redundantly define it here for older Vike versions (otherwise older Vike versions will complain that 'require` is an unknown config). TODO/eventually: remove this once <=0.4.172 versions become rare (also because we use the `require` setting starting from `0.4.173`).
require: {
env: { config: true }
},
bodyHtmlBegin: {
env: { server: true, client: true },
cumulative: true
env: { server: true },
cumulative: true,
global: true
},
bodyHtmlEnd: {
env: { server: true, client: true },
env: { server: true },
cumulative: true,
global: true
},
htmlAttributes: {
env: { server: true },
global: true,
cumulative: true
// for Vike extensions
},
bodyAttributes: {
env: { server: true },
global: true,
cumulative: true
// for Vike extensions
}

@@ -99,0 +112,0 @@ }

@@ -10,36 +10,7 @@ import { Component, SlotsType } from 'vue';

default: ComponentLoaded;
}>): {
new (...args: any[]): import('vue').CreateComponentPublicInstance<Readonly<import('vue').ExtractPropTypes<{}>>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
[key: string]: any;
}> | import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
[key: string]: any;
}>[] | undefined, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<import('vue').ExtractPropTypes<{}>>, {}, true, {}, SlotsType<{
fallback: {
error: unknown;
attrs: Record<string, any>;
};
'client-only-fallback': {
error: unknown;
attrs: Record<string, any>;
};
}>, {
P: {};
B: {};
D: {};
C: {};
M: {};
Defaults: {};
}, Readonly<import('vue').ExtractPropTypes<{}>>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
[key: string]: any;
}> | import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
[key: string]: any;
}>[] | undefined, {}, {}, {}, {}>;
__isFragment?: undefined;
__isTeleport?: undefined;
__isSuspense?: undefined;
} & import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{}>>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
}>): import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
[key: string]: any;
}> | import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
[key: string]: any;
}>[] | undefined, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {}, {}, string, SlotsType<{
}>[] | undefined, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{}>>, {}, SlotsType<{
fallback: {

@@ -53,2 +24,2 @@ error: unknown;

};
}>> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & ComponentLoaded;
}>> & ComponentLoaded;

@@ -5,4 +5,3 @@ import { inject } from "vue";

const data = inject(key);
if (!data)
throw new Error("setData() not called");
if (!data) throw new Error("setData() not called");
return data;

@@ -9,0 +8,0 @@ }

@@ -5,4 +5,3 @@ import { inject } from "vue";

const pageContext = inject(key);
if (!pageContext)
throw new Error("setPageContext() not called");
if (!pageContext) throw new Error("setPageContext() not called");
return pageContext;

@@ -9,0 +8,0 @@ }

import { App } from 'vue';
import { PageContext } from 'vike/types';
import { PageContextInternal } from '../types/PageContext';
export { createVueApp };
export type { ChangePage };
type ChangePage = (pageContext: PageContext) => Promise<void>;
declare function createVueApp(pageContext: PageContext, ssr: boolean, mainComponentName: 'Head' | 'Page'): Promise<{
declare function createVueApp(pageContext: PageContext & PageContextInternal, ssr: boolean, entryComponentName: 'Head' | 'Page'): Promise<{
app: App<any>;

@@ -8,0 +9,0 @@ changePage: ChangePage;

import { PageContext } from 'vike/types';
import { PageContextInternal } from '../types/PageContext.js';
export { getHeadSetting };
declare function getHeadSetting(headSetting: 'title' | 'favicon' | 'lang', pageContext: PageContext): undefined | null | string;
type HeadSetting = 'favicon' | 'lang' | 'title' | 'description' | 'image';
declare function getHeadSetting(headSetting: HeadSetting, pageContext: PageContext & PageContextInternal): undefined | null | string;

@@ -1,2 +0,2 @@

import { c as createVueApp, o as objectAssign, a as callCumulativeHooks, g as getHeadSetting } from "../getHeadSetting-Bd9Y_bSc.js";
import { c as createVueApp, o as objectAssign, a as callCumulativeHooks, g as getHeadSetting } from "../getHeadSetting-BWUIbJS6.js";
let app;

@@ -17,42 +17,15 @@ let changePage;

await changePage(pageContext);
const title = getHeadSetting("title", pageContext) || "";
const lang = getHeadSetting("lang", pageContext) || "en";
const favicon = getHeadSetting("favicon", pageContext);
if (title !== void 0)
document.title = title;
if (lang !== void 0)
document.documentElement.lang = lang;
if (favicon !== void 0)
setFavicon(favicon);
replaceAdjacentBodyHtml(pageContext, "bodyHtmlBegin");
replaceAdjacentBodyHtml(pageContext, "bodyHtmlEnd");
}
if (!pageContext.isHydration) {
updateDocument(pageContext);
}
await callCumulativeHooks(pageContext.config.onAfterRenderClient, pageContext);
};
function setFavicon(faviconUrl) {
let link = document.querySelector("link[rel~='icon']");
if (!faviconUrl) {
if (link)
document.head.removeChild(link);
return;
}
if (!link) {
link = document.createElement("link");
link.rel = "icon";
document.head.appendChild(link);
}
link.href = faviconUrl;
function updateDocument(pageContext) {
pageContext._headAlreadySet = true;
const title = getHeadSetting("title", pageContext);
const lang = getHeadSetting("lang", pageContext);
if (title !== void 0) document.title = title || "";
if (lang !== void 0) document.documentElement.lang = lang || "en";
}
async function replaceAdjacentBodyHtml(pageContext, method) {
const hooks = pageContext.config[method];
if (!hooks)
return;
const hookHtml = (await callCumulativeHooks(hooks, pageContext)).join("");
const startComment = `<!-- vike-vue:${method} start -->`;
const endComment = `<!-- vike-vue:${method} finish -->`;
const startIndex = document.body.innerHTML.indexOf(startComment) + startComment.length;
const endIndex = document.body.innerHTML.indexOf(endComment);
if (startIndex !== -1 && endIndex !== -1) {
document.body.innerHTML = document.body.innerHTML.substring(0, startIndex) + hookHtml + document.body.innerHTML.substring(endIndex);
}
}
export {

@@ -59,0 +32,0 @@ onRenderClient

import { OnRenderHtmlAsync } from 'vike/types';
export { onRenderHtml };
declare const onRenderHtml: OnRenderHtmlAsync;
export type Viewport = 'responsive' | number | null;

@@ -1,50 +0,28 @@

import { version, escapeInject, dangerouslySkipEscape } from "vike/server";
import { escapeInject, dangerouslySkipEscape } from "vike/server";
import { renderToString, renderToNodeStream, renderToWebStream } from "vue/server-renderer";
import { g as getHeadSetting, c as createVueApp, o as objectAssign, a as callCumulativeHooks } from "../getHeadSetting-Bd9Y_bSc.js";
checkVikeVersion();
import { c as createVueApp, o as objectAssign, a as callCumulativeHooks, g as getHeadSetting } from "../getHeadSetting-BWUIbJS6.js";
function getTagAttributesString(tagAttributes) {
const tagAttributesString = Object.entries(tagAttributes).filter(([_key, value]) => value !== false && value !== null && value !== void 0).map(([key, value]) => `${ensureIsValidAttributeName(key)}=${JSON.stringify(String(value))}`).join(" ");
if (tagAttributesString.length === 0) return "";
return ` ${tagAttributesString}`;
}
function ensureIsValidAttributeName(str) {
if (/^[a-z][a-z0-9\-]*$/i.test(str) && !str.endsWith("-")) return str;
throw new Error(`Invalid HTML tag attribute name ${JSON.stringify(str)}`);
}
const onRenderHtml = async (pageContext) => {
var _a;
const title = getHeadSetting("title", pageContext);
const favicon = getHeadSetting("favicon", pageContext);
const lang = getHeadSetting("lang", pageContext) || "en";
const titleTag = !title ? "" : escapeInject`<title>${title}</title>`;
const faviconTag = !favicon ? "" : escapeInject`<link rel="icon" href="${favicon}" />`;
let pageView = "";
const ssrContext = {};
const fromHtmlRenderer = {};
if (!!pageContext.Page) {
const { app } = await createVueApp(pageContext, true, "Page");
objectAssign(pageContext, { app });
pageView = !pageContext.config.stream ? dangerouslySkipEscape(await renderToStringWithErrorHandling(app, ssrContext)) : pageContext.config.stream === "web" ? renderToWebStreamWithErrorHandling(app, ssrContext) : renderToNodeStreamWithErrorHandling(app, ssrContext);
const afterRenderResults = await callCumulativeHooks(pageContext.config.onAfterRenderHtml, pageContext);
Object.assign(pageContext, { ssrContext });
Object.assign(fromHtmlRenderer, ...afterRenderResults);
}
let headHtml = "";
if (pageContext.config.Head) {
const { app } = await createVueApp(pageContext, true, "Head");
headHtml = dangerouslySkipEscape(await renderToStringWithErrorHandling(app));
}
const bodyHtmlBegin = dangerouslySkipEscape(
(await callCumulativeHooks(pageContext.config.bodyHtmlBegin, pageContext)).join("")
);
const defaultTeleport = `<div id="teleported">${((_a = ssrContext.teleports) == null ? void 0 : _a["#teleported"]) ?? ""}</div>`;
const bodyHtmlEndHooks = [defaultTeleport, ...pageContext.config.bodyHtmlEnd ?? []];
const bodyHtmlEnd = dangerouslySkipEscape((await callCumulativeHooks(bodyHtmlEndHooks, pageContext)).join(""));
const { pageHtml, fromHtmlRenderer, ssrContext } = await getPageHtml(pageContext);
const headHtml = await getHeadHtml(pageContext);
const { bodyHtmlBegin, bodyHtmlEnd } = await getBodyHtmlBeginEnd(pageContext, ssrContext);
const { htmlAttributesString, bodyAttributesString } = getTagAttributes(pageContext);
const documentHtml = escapeInject`<!DOCTYPE html>
<html lang='${lang}'>
<html${dangerouslySkipEscape(htmlAttributesString)}>
<head>
<meta charset="UTF-8" />
${titleTag}
${headHtml}
${faviconTag}
</head>
<body>
<!-- vike-vue:bodyHtmlBegin start -->
<body${dangerouslySkipEscape(bodyAttributesString)}>
${bodyHtmlBegin}
<!-- vike-vue:bodyHtmlBegin finish -->
<div id="app">${pageView}</div>
<!-- vike-vue:bodyHtmlEnd start -->
<div id="app">${pageHtml}</div>
${bodyHtmlEnd}
<!-- vike-vue:bodyHtmlEnd finish -->
</body>

@@ -61,2 +39,64 @@ <!-- built with https://github.com/vikejs/vike-vue -->

};
async function getPageHtml(pageContext) {
let pageHtml = "";
const ssrContext = {};
const fromHtmlRenderer = {};
if (!!pageContext.Page) {
const { app } = await createVueApp(pageContext, true, "Page");
objectAssign(pageContext, { app });
pageHtml = !pageContext.config.stream ? dangerouslySkipEscape(await renderToStringWithErrorHandling(app, ssrContext)) : pageContext.config.stream === "web" ? renderToWebStreamWithErrorHandling(app, ssrContext) : renderToNodeStreamWithErrorHandling(app, ssrContext);
const afterRenderResults = await callCumulativeHooks(pageContext.config.onAfterRenderHtml, pageContext);
Object.assign(pageContext, { ssrContext });
Object.assign(fromHtmlRenderer, ...afterRenderResults);
}
return { pageHtml, fromHtmlRenderer, ssrContext };
}
async function getHeadHtml(pageContext) {
pageContext._headAlreadySet = true;
const title = getHeadSetting("title", pageContext);
const favicon = getHeadSetting("favicon", pageContext);
const description = getHeadSetting("description", pageContext);
const image = getHeadSetting("image", pageContext);
const titleTags = !title ? "" : escapeInject`<title>${title}</title><meta property="og:title" content="${title}">`;
const faviconTag = !favicon ? "" : escapeInject`<link rel="icon" href="${favicon}" />`;
const descriptionTags = !description ? "" : escapeInject`<meta name="description" content="${description}"><meta property="og:description" content="${description}">`;
const imageTags = !image ? "" : escapeInject`<meta property="og:image" content="${image}"><meta name="twitter:card" content="summary_large_image">`;
const viewportTag = dangerouslySkipEscape(getViewportTag(pageContext.config.viewport));
let headElementHtml = "";
const { app } = await createVueApp(pageContext, true, "Head");
headElementHtml = dangerouslySkipEscape(await renderToStringWithErrorHandling(app));
const headHtml = escapeInject`
${titleTags}
${viewportTag}
${headElementHtml}
${faviconTag}
${descriptionTags}
${imageTags}
`;
return headHtml;
}
async function getBodyHtmlBeginEnd(pageContext, ssrContext) {
var _a;
const bodyHtmlBegin = dangerouslySkipEscape(
(await callCumulativeHooks(pageContext.config.bodyHtmlBegin, pageContext)).join("")
);
const defaultTeleport = `<div id="teleported">${((_a = ssrContext.teleports) == null ? void 0 : _a["#teleported"]) ?? ""}</div>`;
const bodyHtmlEndHooks = [defaultTeleport, ...pageContext.config.bodyHtmlEnd ?? []];
const bodyHtmlEnd = dangerouslySkipEscape((await callCumulativeHooks(bodyHtmlEndHooks, pageContext)).join(""));
return { bodyHtmlBegin, bodyHtmlEnd };
}
function getTagAttributes(pageContext) {
let lang = getHeadSetting("lang", pageContext);
if (lang === void 0) lang = "en";
const bodyAttributes = mergeTagAttributesList(pageContext.config.bodyAttributes);
const htmlAttributes = mergeTagAttributesList(pageContext.config.htmlAttributes);
const bodyAttributesString = getTagAttributesString(bodyAttributes);
const htmlAttributesString = getTagAttributesString({ ...htmlAttributes, lang: lang ?? htmlAttributes.lang });
return { htmlAttributesString, bodyAttributesString };
}
function mergeTagAttributesList(tagAttributesList = []) {
const tagAttributes = {};
tagAttributesList.forEach((tagAttrs) => Object.assign(tagAttributes, tagAttrs));
return tagAttributes;
}
async function renderToStringWithErrorHandling(app, ctx) {

@@ -74,4 +114,3 @@ let returned = false;

returned = true;
if (err)
throw err;
if (err) throw err;
return appHtml;

@@ -91,4 +130,3 @@ }

returned = true;
if (err)
throw err;
if (err) throw err;
return appHtml;

@@ -108,17 +146,13 @@ }

returned = true;
if (err)
throw err;
if (err) throw err;
return appHtml;
}
function checkVikeVersion() {
if (version) {
const versionParts = version.split(".").map((s) => parseInt(s, 10));
if (versionParts[0] > 0)
return;
if (versionParts[1] > 4)
return;
if (versionParts[2] >= 172)
return;
function getViewportTag(viewport) {
if (viewport === "responsive" || viewport === void 0) {
return '<meta name="viewport" content="width=device-width,initial-scale=1">';
}
throw new Error("Update Vike to 0.4.172 or above");
if (typeof viewport === "number") {
return `<meta name="viewport" content="width=${viewport}">`;
}
return "";
}

@@ -125,0 +159,0 @@ export {

import { App } from 'vue';
import { BodyInjectHtml, OnAfterRenderHtmlAsync, OnAfterRenderHtmlSync, OnBeforeRenderClientAsync, OnBeforeRenderClientSync, OnCreateAppAsync, OnCreateAppSync } from '../hooks/types';
import { SSRContext } from 'vue/server-renderer';
import { ConfigFromHookResolved } from '../+config';
export type { Component };

@@ -14,11 +14,7 @@ type Component = any;

}
interface ConfigResolved {
onCreateApp?: Array<OnCreateAppSync | OnCreateAppAsync>;
onAfterRenderHtml?: Array<OnAfterRenderHtmlSync | OnAfterRenderHtmlAsync>;
onBeforeRenderClient?: Array<OnBeforeRenderClientSync | OnBeforeRenderClientAsync>;
bodyHtmlBegin?: BodyInjectHtml[];
bodyHtmlEnd?: BodyInjectHtml[];
Layout?: Component[];
}
}
}
export type PageContextInternal = {
_configFromHook?: ConfigFromHookResolved;
_headAlreadySet?: true;
};

@@ -1,6 +0,1 @@

import { PageContext } from 'vike/types';
type Hook = (pageContext: PageContext) => unknown;
type PlainHook = unknown;
export declare function callCumulativeHooks<T extends Hook | PlainHook, C extends PageContext>(hooks: T[] | undefined, pageContext: C): Promise<any[]>;
export {};
export declare function callCumulativeHooks(values: undefined | unknown[], pageContext: unknown): Promise<unknown[]>;
{
"name": "vike-vue",
"version": "0.7.6",
"version": "0.8.0",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": "./dist/index.js",
"./config": "./dist/+config.js",

@@ -14,7 +11,7 @@ "./renderer/onRenderHtml": "./dist/renderer/onRenderHtml.js",

"./useData": "./dist/hooks/useData.js",
"./useConfig": {
"browser": "./dist/hooks/useConfig/useConfig-client.js",
"default": "./dist/hooks/useConfig/useConfig-server.js"
},
"./clientOnly": "./dist/helpers/clientOnly.js",
"./ClientOnly": {
"default": "./dist/components/ClientOnly.js",
"types": "./dist/components/ClientOnly.vue.d.ts"
},
"./types": {

@@ -34,3 +31,3 @@ "default": "./dist/types/index.js",

"peerDependencies": {
"vike": ">=0.4.172",
"vike": ">=0.4.182",
"vue": ">=3.0.0"

@@ -42,4 +39,4 @@ },

"@vitejs/plugin-vue": "^5.0.4",
"typescript": "^5.4.5",
"vike": "^0.4.173",
"typescript": "^5.5.4",
"vike": "^0.4.182",
"vite": "^5.2.9",

@@ -52,5 +49,2 @@ "vite-plugin-dts": "^3.8.3",

"*": {
".": [
"./dist/index.d.ts"
],
"config": [

@@ -68,2 +62,5 @@ "./dist/+config.d.ts"

],
"useConfig": [
"./dist/hooks/useConfig/useConfig-server.d.ts"
],
"clientOnly": [

@@ -77,5 +74,2 @@ "./dist/helpers/clientOnly.d.ts"

"./dist/renderer/onRenderClient.d.ts"
],
"ClientOnly": [
"./dist/components/ClientOnly.vue.d.ts"
]

@@ -82,0 +76,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet