UNPKG

nuxt-multi-cache

Version:

SSR route, component and data cache for Nuxt.js

38 lines (37 loc) 1.56 kB
import type { Storage } from 'unstorage'; import type { VNode, RendererNode, RendererElement, Slots, ComponentInternalInstance } from 'vue'; import type { ComponentCacheItem } from './../../../types.js'; type RenderCacheableSlotVNode = VNode<RendererNode, RendererElement, { [key: string]: any; }>; type RenderCacheableProps = { tag?: string; noCache?: boolean; cacheKey?: string; cacheTags?: string[]; asyncDataKeys?: string[]; }; /** * Build the cache key. * * A custom key is used if provided. If not, a key is generated based on the * props of the given vnode. If no props are available or if the component has * no name, return. */ export declare function getCacheKey(props: RenderCacheableProps, vnode: RenderCacheableSlotVNode, debug?: boolean): string | undefined; export declare function getComponentName(vnode: RenderCacheableSlotVNode): string | undefined; /** * Render the contents of a slot and return the markup. * * This is approximately the same behavior as in vue/server-renderer. The * ssrRenderSlotInner pushes the rendered fragments of the entire tree in the * buffer array. Then the unrollBuffer method is called which merges the * nested array into a single string of markup. */ export declare function renderSlot(slots: Slots, parent: ComponentInternalInstance): Promise<string>; /** * Check the cache for an already rendered component. If available, return the * data. */ export declare function getCachedComponent(storage: Storage, cacheKey: string): Promise<ComponentCacheItem | void>; export {};