Socket
Socket
Sign inDemoInstall

@vuepress/client

Package Overview
Dependencies
Maintainers
2
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vuepress/client - npm Package Compare versions

Comparing version 2.0.0-rc.2 to 2.0.0-rc.3

dist/chunk-2SMBJWK6.js

87

dist/app.js
import {
ClientOnly,
Content,
VPLink,
layoutsSymbol,

@@ -11,5 +12,6 @@ pageDataSymbol,

pageLayoutSymbol,
pagesData,
resolveRoute,
resolvers,
routeLocaleSymbol,
routes,
siteData,

@@ -22,3 +24,3 @@ siteLocaleDataSymbol,

withBase
} from "./chunk-PEQEPZ75.js";
} from "./chunk-2SMBJWK6.js";

@@ -30,4 +32,3 @@ // src/app.ts

// src/router.ts
import { pagesComponents } from "@internal/pagesComponents";
// src/createVueRouter.ts
import { removeEndingSlash } from "@vuepress/shared";

@@ -41,5 +42,2 @@ import {

// src/routes.ts
import { pagesRoutes } from "@internal/pagesRoutes";
// src/components/Vuepress.ts

@@ -55,42 +53,3 @@ import { defineComponent, h } from "vue";

// src/routes.ts
var createRoutes = () => pagesRoutes.reduce(
(result, [name, path, meta, redirects]) => {
result.push(
{
name,
path,
component: Vuepress,
meta
},
{
path: path.endsWith("/") ? (
// redirect from `/index.html` to `/`
path + "index.html"
) : (
// redirect from `/foo` to `/foo.html`
path.substring(0, path.length - 5)
),
redirect: path
},
...redirects.map((item) => ({
path: item === ":md" ? (
// redirect from `/foo.md` to `/foo.html`
path.substring(0, path.length - 5) + ".md"
) : item,
redirect: path
}))
);
return result;
},
[
{
name: "404",
path: "/:catchAll(.*)",
component: Vuepress
}
]
);
// src/router.ts
// src/createVueRouter.ts
var historyCreator = __VUEPRESS_SSR__ ? createMemoryHistory : createWebHistory;

@@ -101,4 +60,10 @@ var createVueRouter = () => {

history: historyCreator(removeEndingSlash(__VUEPRESS_BASE__)),
routes: createRoutes(),
scrollBehavior: (to, from, savedPosition) => {
routes: [
{
name: "vuepress-route",
path: "/:catchAll(.*)",
component: Vuepress
}
],
scrollBehavior: (to, _from, savedPosition) => {
if (savedPosition)

@@ -113,7 +78,13 @@ return savedPosition;

if (to.path !== from.path || from === START_LOCATION) {
;
[to.meta._data] = await Promise.all([
resolvers.resolvePageData(to.name),
pagesComponents[to.name]?.__asyncLoader()
]);
const route = resolveRoute(to.path);
if (route.path !== to.path) {
return route.path;
}
const pageChunk = await route.loader();
to.meta = {
// attach route meta
...route.meta,
// attach page data to route meta to trigger page data computed when route changes
_data: pageChunk.data
};
}

@@ -128,2 +99,3 @@ });

app.component("Content", Content);
app.component("VPLink", VPLink);
};

@@ -141,5 +113,6 @@

if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) {
__VUE_HMR_RUNTIME__.updatePageData = (data) => {
pagesData.value[data.key] = () => Promise.resolve(data);
if (data.key === router.currentRoute.value.meta._data?.key) {
__VUE_HMR_RUNTIME__.updatePageData = async (data) => {
const pageChunk = await routes.value[data.path].loader();
routes.value[data.path].loader = () => Promise.resolve({ comp: pageChunk.comp, data });
if (data.path === router.currentRoute.value.meta._data?.path) {
router.currentRoute.value.meta._data = data;

@@ -146,0 +119,0 @@ pageData.trigger();

import { PageData, PageFrontmatter, HeadConfig, SiteData } from '@vuepress/shared';
export { PageData, PageFrontmatter, PageHeader, SiteData } from '@vuepress/shared';
import * as vue from 'vue';
import { ComputedRef, InjectionKey, Ref, Component, App } from 'vue';
import { Router, RouteMeta } from 'vue-router';
import { ComputedRef, InjectionKey, Ref, Component, App, FunctionalComponent, VNode } from 'vue';
import { Redirects, Routes, PageMetaDefault, Route } from '@internal/routes';
export { PageChunk, PageMetaDefault, Redirects, Route, Routes } from '@internal/routes';
import { Router } from 'vue-router';
export { C as CreateVueAppFunction } from './createVueAppFunction-YNGNKfE3.js';

@@ -30,6 +32,2 @@

/**
* Empty page data to be used as the fallback value
*/
declare const pageDataEmpty: PageData;
/**
* Returns the ref of the data of current page

@@ -117,39 +115,51 @@ */

/**
* Data resolvers of all pages
*
* The key is page key, and the value is an async function that
* returns the page data
* Route locale path
*/
type PagesData = Record<string, (() => Promise<PageData>) | undefined>;
type RouteLocale = string;
/**
* Ref wrapper of `PagesData`
* Ref wrapper of `RouteLocale`
*/
type PagesDataRef = Ref<PagesData>;
type RouteLocaleRef = Readonly<Ref<RouteLocale>>;
/**
* Global pages data ref
* Injection key for page route locale path
*/
declare const pagesData: PagesDataRef;
declare const routeLocaleSymbol: InjectionKey<RouteLocaleRef>;
/**
* Returns the ref of data resolvers of all pages
* Returns the ref of the route locale path of current page
*/
declare const usePagesData: () => PagesDataRef;
declare const useRouteLocale: () => RouteLocaleRef;
/**
* Route locale path
* Global redirects ref
*/
type RouteLocale = string;
declare const redirects: Ref<Redirects>;
/**
* Ref wrapper of `RouteLocale`
* Global routes ref
*/
type RouteLocaleRef = Readonly<Ref<RouteLocale>>;
declare const routes: Ref<Routes>;
interface ResolvedRoute<PageMeta extends PageMetaDefault = PageMetaDefault> extends Route<PageMeta> {
path: string;
notFound: boolean;
}
/**
* Injection key for page route locale path
* Resolve route with given path
*/
declare const routeLocaleSymbol: InjectionKey<RouteLocaleRef>;
declare const resolveRoute: <PageMeta extends PageMetaDefault = PageMetaDefault>(path: string) => ResolvedRoute<PageMeta>;
/**
* Returns the ref of the route locale path of current page
* Resolve route path with given raw path
*/
declare const useRouteLocale: () => RouteLocaleRef;
declare const resolveRoutePath: (path: string) => string;
/**
* Returns the ref of pages map
*/
declare const useRedirects: () => typeof redirects;
/**
* Returns the ref of routes map
*/
declare const useRoutes: () => typeof routes;
/**
* Ref wrapper of `SiteData`

@@ -226,9 +236,2 @@ */

type PageRouteItem = [
name: string,
path: string,
meta: RouteMeta,
redirects: string[]
];
declare const ClientOnly: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {

@@ -242,3 +245,3 @@ [key: string]: any;

declare const Content: vue.DefineComponent<{
pageKey: {
path: {
type: StringConstructor;

@@ -251,3 +254,3 @@ required: false;

}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
pageKey: {
path: {
type: StringConstructor;

@@ -258,5 +261,12 @@ required: false;

}>>, {
pageKey: string;
path: string;
}, {}>;
interface VPLinkProps {
to: string;
}
declare const VPLink: FunctionalComponent<VPLinkProps, Record<never, never>, {
default: () => string | VNode | (string | VNode)[];
}>;
/**

@@ -276,6 +286,7 @@ * A helper function to help you define vuepress client config file

* Users can override corresponding method for advanced customization
*
* @experimental - This is an experimental API and may be changed in minor versions
*/
declare const resolvers: {
resolveLayouts: (clientConfigs: ClientConfig[]) => Layouts;
resolvePageData: (pageKey: string) => Promise<PageData>;
resolvePageFrontmatter: (pageData: PageData) => PageFrontmatter;

@@ -290,2 +301,2 @@ resolvePageHead: (headTitle: PageHeadTitle, frontmatter: PageFrontmatter, siteLocale: SiteLocaleData) => PageHead;

export { type ClientConfig, ClientOnly, Content, type Layouts, type LayoutsRef, type PageDataRef, type PageFrontmatterRef, type PageHead, type PageHeadRef, type PageHeadTitle, type PageHeadTitleRef, type PageLang, type PageLangRef, type PageLayoutRef, type PageRouteItem, type PagesData, type PagesDataRef, type RouteLocale, type RouteLocaleRef, type SiteDataRef, type SiteLocaleData, type SiteLocaleDataRef, type UpdateHead, defineClientConfig, layoutsSymbol, pageDataEmpty, pageDataSymbol, pageFrontmatterSymbol, pageHeadSymbol, pageHeadTitleSymbol, pageLangSymbol, pageLayoutSymbol, pagesData, resolvers, routeLocaleSymbol, siteData, siteLocaleDataSymbol, updateHeadSymbol, useLayouts, usePageData, usePageFrontmatter, usePageHead, usePageHeadTitle, usePageLang, usePageLayout, usePagesData, useRouteLocale, useSiteData, useSiteLocaleData, useUpdateHead, withBase };
export { type ClientConfig, ClientOnly, Content, type Layouts, type LayoutsRef, type PageDataRef, type PageFrontmatterRef, type PageHead, type PageHeadRef, type PageHeadTitle, type PageHeadTitleRef, type PageLang, type PageLangRef, type PageLayoutRef, type RouteLocale, type RouteLocaleRef, type SiteDataRef, type SiteLocaleData, type SiteLocaleDataRef, type UpdateHead, VPLink, type VPLinkProps, defineClientConfig, layoutsSymbol, pageDataSymbol, pageFrontmatterSymbol, pageHeadSymbol, pageHeadTitleSymbol, pageLangSymbol, pageLayoutSymbol, redirects, resolveRoute, resolveRoutePath, resolvers, routeLocaleSymbol, routes, siteData, siteLocaleDataSymbol, updateHeadSymbol, useLayouts, usePageData, usePageFrontmatter, usePageHead, usePageHeadTitle, usePageLang, usePageLayout, useRedirects, useRouteLocale, useRoutes, useSiteData, useSiteLocaleData, useUpdateHead, withBase };
import {
ClientOnly,
Content,
VPLink,
defineClientConfig,
layoutsSymbol,
pageDataEmpty,
pageDataSymbol,

@@ -13,5 +13,8 @@ pageFrontmatterSymbol,

pageLayoutSymbol,
pagesData,
redirects,
resolveRoute,
resolveRoutePath,
resolvers,
routeLocaleSymbol,
routes,
siteData,

@@ -27,4 +30,5 @@ siteLocaleDataSymbol,

usePageLayout,
usePagesData,
useRedirects,
useRouteLocale,
useRoutes,
useSiteData,

@@ -34,9 +38,9 @@ useSiteLocaleData,

withBase
} from "./chunk-PEQEPZ75.js";
} from "./chunk-2SMBJWK6.js";
export {
ClientOnly,
Content,
VPLink,
defineClientConfig,
layoutsSymbol,
pageDataEmpty,
pageDataSymbol,

@@ -48,5 +52,8 @@ pageFrontmatterSymbol,

pageLayoutSymbol,
pagesData,
redirects,
resolveRoute,
resolveRoutePath,
resolvers,
routeLocaleSymbol,
routes,
siteData,

@@ -62,4 +69,5 @@ siteLocaleDataSymbol,

usePageLayout,
usePagesData,
useRedirects,
useRouteLocale,
useRoutes,
useSiteData,

@@ -66,0 +74,0 @@ useSiteLocaleData,

{
"name": "@vuepress/client",
"version": "2.0.0-rc.2",
"version": "2.0.0-rc.3",
"description": "Client package of VuePress",

@@ -40,3 +40,3 @@ "keywords": [

"vue-router": "^4.2.5",
"@vuepress/shared": "2.0.0-rc.2"
"@vuepress/shared": "2.0.0-rc.3"
},

@@ -59,5 +59,3 @@ "publishConfig": {

"@internal/layoutComponents",
"@internal/pagesComponents",
"@internal/pagesData",
"@internal/pagesRoutes",
"@internal/routes",
"@internal/siteData"

@@ -64,0 +62,0 @@ ],

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc