@vuepress/client 2.0.0-rc.3 → 2.0.0-rc.31

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/index.js CHANGED
@@ -1,72 +1,9 @@
1
- import {
2
- ClientOnly,
3
- Content,
4
- VPLink,
5
- defineClientConfig,
6
- layoutsSymbol,
7
- pageDataSymbol,
8
- pageFrontmatterSymbol,
9
- pageHeadSymbol,
10
- pageHeadTitleSymbol,
11
- pageLangSymbol,
12
- pageLayoutSymbol,
13
- redirects,
14
- resolveRoute,
15
- resolveRoutePath,
16
- resolvers,
17
- routeLocaleSymbol,
18
- routes,
19
- siteData,
20
- siteLocaleDataSymbol,
21
- updateHeadSymbol,
22
- useLayouts,
23
- usePageData,
24
- usePageFrontmatter,
25
- usePageHead,
26
- usePageHeadTitle,
27
- usePageLang,
28
- usePageLayout,
29
- useRedirects,
30
- useRouteLocale,
31
- useRoutes,
32
- useSiteData,
33
- useSiteLocaleData,
34
- useUpdateHead,
35
- withBase
36
- } from "./chunk-2SMBJWK6.js";
37
- export {
38
- ClientOnly,
39
- Content,
40
- VPLink,
41
- defineClientConfig,
42
- layoutsSymbol,
43
- pageDataSymbol,
44
- pageFrontmatterSymbol,
45
- pageHeadSymbol,
46
- pageHeadTitleSymbol,
47
- pageLangSymbol,
48
- pageLayoutSymbol,
49
- redirects,
50
- resolveRoute,
51
- resolveRoutePath,
52
- resolvers,
53
- routeLocaleSymbol,
54
- routes,
55
- siteData,
56
- siteLocaleDataSymbol,
57
- updateHeadSymbol,
58
- useLayouts,
59
- usePageData,
60
- usePageFrontmatter,
61
- usePageHead,
62
- usePageHeadTitle,
63
- usePageLang,
64
- usePageLayout,
65
- useRedirects,
66
- useRouteLocale,
67
- useRoutes,
68
- useSiteData,
69
- useSiteLocaleData,
70
- useUpdateHead,
71
- withBase
72
- };
1
+ import { A as useRouteLocale, C as usePageComponent, D as usePageLang, E as usePageHead, F as useSiteLocale, I as useSiteLocaleData, L as clientDataSymbol, M as useRoutes, N as useSite, O as usePageLayout, P as useSiteData, R as useClientData, S as usePage, T as usePageFrontmatter, _ as useData, a as AutoLink, b as useLang, c as useRouter, d as resolveRoutePath, g as onContentUpdated, h as useUpdateHead, i as ClientOnly, j as useRoutePath, k as useRedirects, l as resolveRouteFullPath, m as updateHeadSymbol, n as resolvers, o as RouteLink, r as Content, s as useRoute, t as withBase, u as resolveRoute, v as useFrontmatter, w as usePageData, x as useLayouts, y as useHead } from "./utils-jFeCv-dX.js";
2
+ import { c as constants_exports } from "./constants-CWVu3aBh.js";
3
+ //#region src/utils/defineClientConfig.ts
4
+ /**
5
+ * A helper function to help you define vuepress client config file
6
+ */
7
+ const defineClientConfig = (clientConfig = {}) => clientConfig;
8
+ //#endregion
9
+ export { AutoLink, ClientOnly, Content, constants_exports as DEVTOOLS, RouteLink, clientDataSymbol, defineClientConfig, onContentUpdated, resolveRoute, resolveRouteFullPath, resolveRoutePath, resolvers, updateHeadSymbol, useClientData, useData, useFrontmatter, useHead, useLang, useLayouts, usePage, usePageComponent, usePageData, usePageFrontmatter, usePageHead, usePageLang, usePageLayout, useRedirects, useRoute, useRouteLocale, useRoutePath, useRouter, useRoutes, useSite, useSiteData, useSiteLocale, useSiteLocaleData, useUpdateHead, withBase };
@@ -0,0 +1,13 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ //#endregion
13
+ export { __exportAll as t };
@@ -0,0 +1,64 @@
1
+ import { a as INSPECTOR_STATE_SECTION_NAME, i as INSPECTOR_NODES, n as INSPECTOR_ID, o as PLUGIN_ID, r as INSPECTOR_LABEL, s as PLUGIN_LABEL, t as COMPONENT_STATE_TYPE } from "./constants-CWVu3aBh.js";
2
+ import { watch } from "vue";
3
+ import { setupDevtoolsPlugin } from "@vue/devtools-api";
4
+ //#region src/devtools/setupDevtools.ts
5
+ const setupDevtools = (app, clientData) => {
6
+ setupDevtoolsPlugin({
7
+ app,
8
+ id: PLUGIN_ID,
9
+ label: PLUGIN_LABEL,
10
+ packageName: "@vuepress/client",
11
+ homepage: "https://vuepress.vuejs.org",
12
+ logo: "https://vuepress.vuejs.org/images/hero.png",
13
+ componentStateTypes: [COMPONENT_STATE_TYPE]
14
+ }, (api) => {
15
+ const clientDataEntries = Object.entries(clientData);
16
+ const clientDataKeys = Object.keys(clientData);
17
+ const clientDataValues = Object.values(clientData);
18
+ api.on.inspectComponent((payload) => {
19
+ payload.instanceData.state.push(...clientDataEntries.map(([name, item]) => ({
20
+ type: COMPONENT_STATE_TYPE,
21
+ editable: false,
22
+ key: name,
23
+ value: item.value
24
+ })));
25
+ });
26
+ api.addInspector({
27
+ id: INSPECTOR_ID,
28
+ label: INSPECTOR_LABEL,
29
+ icon: "article"
30
+ });
31
+ api.on.getInspectorTree((payload) => {
32
+ if (payload.inspectorId !== "org.vuejs.vuepress") return;
33
+ payload.rootNodes = Object.values(INSPECTOR_NODES).map((node) => ({
34
+ id: node.id,
35
+ label: node.label,
36
+ children: node.keys.map((key) => ({
37
+ id: key,
38
+ label: key
39
+ }))
40
+ }));
41
+ });
42
+ api.on.getInspectorState((payload) => {
43
+ if (payload.inspectorId !== "org.vuejs.vuepress") return;
44
+ const inspectorNode = INSPECTOR_NODES[payload.nodeId];
45
+ if (inspectorNode) {
46
+ payload.state = { [inspectorNode.label]: inspectorNode.keys.map((key) => ({
47
+ key,
48
+ value: clientData[key].value
49
+ })) };
50
+ return;
51
+ }
52
+ if (clientDataKeys.includes(payload.nodeId)) payload.state = { [INSPECTOR_STATE_SECTION_NAME]: [{
53
+ key: payload.nodeId,
54
+ value: clientData[payload.nodeId].value
55
+ }] };
56
+ });
57
+ watch(clientDataValues, () => {
58
+ api.notifyComponentUpdate();
59
+ api.sendInspectorState(INSPECTOR_ID);
60
+ });
61
+ });
62
+ };
63
+ //#endregion
64
+ export { setupDevtools };
@@ -0,0 +1,415 @@
1
+ import { computed, defineAsyncComponent, defineComponent, h, inject, onMounted, onUnmounted, reactive, ref, shallowRef, toRef } from "vue";
2
+ import { dedupeHead, isLinkHttp, isLinkWithProtocol, isString, normalizeRoutePath, removeLeadingSlash, resolveLocalePath, splitPath } from "@vuepress/shared";
3
+ import { useRoute, useRoute as useRoute$1, useRouter, useRouter as useRouter$1 } from "vue-router";
4
+ import { redirects, routes } from "@internal/routes";
5
+ //#region src/composables/clientData.ts
6
+ const CLIENT_DATA_SYMBOL_GLOBAL_KEY = "__VUEPRESS_CLIENT_DATA_SYMBOL__";
7
+ /**
8
+ * Injection key for client data
9
+ *
10
+ * Use a global Symbol to keep the same reference across module reloads.
11
+ * This is required for HMR in dev mode: when a markdown page with local
12
+ * components is edited, the main module (and its transitive deps that host
13
+ * this symbol) may be re-executed by Vite, which would otherwise create a
14
+ * new Symbol instance and break `inject` (see vuepress/core#1715).
15
+ */
16
+ const resolveClientDataSymbol = () => {
17
+ globalThis[CLIENT_DATA_SYMBOL_GLOBAL_KEY] ??= Symbol("clientData");
18
+ return globalThis[CLIENT_DATA_SYMBOL_GLOBAL_KEY];
19
+ };
20
+ /**
21
+ * The problem only occurs during hot updates in the development environment,
22
+ * It only needs to be processed in the development environment.
23
+ * (see vuepress/core#1715)
24
+ */
25
+ const clientDataSymbol = __VUEPRESS_DEV__ ? resolveClientDataSymbol() : Symbol("");
26
+ /**
27
+ * Returns client data
28
+ */
29
+ const useClientData = () => {
30
+ const clientData = inject(clientDataSymbol);
31
+ if (!clientData) throw new Error("useClientData() is called without provider.");
32
+ return clientData;
33
+ };
34
+ //#endregion
35
+ //#region src/composables/clientDataUtils.ts
36
+ const useLayouts = () => useClientData().layouts;
37
+ const usePageComponent = () => useClientData().pageComponent;
38
+ const usePageData = () => useClientData().pageData;
39
+ const usePageFrontmatter = () => useClientData().pageFrontmatter;
40
+ const usePageHead = () => useClientData().pageHead;
41
+ const usePageLang = () => useClientData().pageLang;
42
+ const usePageLayout = () => useClientData().pageLayout;
43
+ const useRedirects = () => useClientData().redirects;
44
+ const useRouteLocale = () => useClientData().routeLocale;
45
+ const useRoutePath = () => useClientData().routePath;
46
+ const useRoutes = () => useClientData().routes;
47
+ const useSiteData = () => useClientData().siteData;
48
+ const useSiteLocaleData = () => useClientData().siteLocaleData;
49
+ const useData = useClientData;
50
+ const useFrontmatter = usePageFrontmatter;
51
+ const useHead = usePageHead;
52
+ const useLang = usePageLang;
53
+ const usePage = usePageData;
54
+ const useSite = useSiteData;
55
+ const useSiteLocale = useSiteLocaleData;
56
+ //#endregion
57
+ //#region src/internal/contentUpdatedCallbacks.ts
58
+ /**
59
+ * Global content updated callbacks
60
+ */
61
+ const contentUpdatedCallbacks = /* @__PURE__ */ new Set();
62
+ //#endregion
63
+ //#region src/composables/onContentUpdated.ts
64
+ /**
65
+ * Register callback that is called every time the markdown content is updated
66
+ * in the DOM.
67
+ */
68
+ const onContentUpdated = (fn) => {
69
+ contentUpdatedCallbacks.add(fn);
70
+ onUnmounted(() => {
71
+ contentUpdatedCallbacks.delete(fn);
72
+ });
73
+ };
74
+ //#endregion
75
+ //#region src/composables/updateHead.ts
76
+ /**
77
+ * Injection key for `updateHead` util
78
+ */
79
+ const updateHeadSymbol = Symbol(__VUEPRESS_DEV__ ? "updateHead" : "");
80
+ /**
81
+ * Returns the `updateHead` util
82
+ */
83
+ const useUpdateHead = () => {
84
+ const updateHead = inject(updateHeadSymbol);
85
+ if (!updateHead) throw new Error("useUpdateHead() is called without provider.");
86
+ return updateHead;
87
+ };
88
+ //#endregion
89
+ //#region src/internal/routes.ts
90
+ /**
91
+ * Global redirects ref
92
+ */
93
+ const redirects$1 = shallowRef(redirects);
94
+ /**
95
+ * Global routes ref
96
+ */
97
+ const routes$1 = shallowRef(routes);
98
+ if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) {
99
+ __VUE_HMR_RUNTIME__.updateRedirects = (data) => {
100
+ redirects$1.value = data;
101
+ };
102
+ __VUE_HMR_RUNTIME__.updateRoutes = (data) => {
103
+ routes$1.value = data;
104
+ };
105
+ }
106
+ //#endregion
107
+ //#region src/router/resolveRoutePath.ts
108
+ /**
109
+ * Resolve route path with given raw path
110
+ */
111
+ const resolveRoutePath = (pathname, currentPath) => {
112
+ const normalizedRoutePath = normalizeRoutePath(pathname, currentPath);
113
+ if (routes$1.value[normalizedRoutePath]) return normalizedRoutePath;
114
+ const encodedRoutePath = encodeURI(normalizedRoutePath);
115
+ if (routes$1.value[encodedRoutePath]) return encodedRoutePath;
116
+ const redirectedRoutePath = redirects$1.value[normalizedRoutePath] || redirects$1.value[encodedRoutePath];
117
+ if (redirectedRoutePath) return redirectedRoutePath;
118
+ return normalizedRoutePath;
119
+ };
120
+ //#endregion
121
+ //#region src/router/resolveRoute.ts
122
+ /**
123
+ * Resolve route with given path
124
+ */
125
+ const resolveRoute = (path, currentPath) => {
126
+ const { pathname, hashAndQueries } = splitPath(path);
127
+ const routePath = resolveRoutePath(pathname, currentPath);
128
+ const routeFullPath = routePath + hashAndQueries;
129
+ if (!routes$1.value[routePath]) return {
130
+ ...routes$1.value["/404.html"],
131
+ path: routeFullPath,
132
+ notFound: true
133
+ };
134
+ return {
135
+ ...routes$1.value[routePath],
136
+ path: routeFullPath,
137
+ notFound: false
138
+ };
139
+ };
140
+ //#endregion
141
+ //#region src/router/resolveRouteFullPath.ts
142
+ /**
143
+ * Resolve route full path with given raw path
144
+ */
145
+ const resolveRouteFullPath = (path, currentPath) => {
146
+ const { pathname, hashAndQueries } = splitPath(path);
147
+ return resolveRoutePath(pathname, currentPath) + hashAndQueries;
148
+ };
149
+ //#endregion
150
+ //#region src/components/RouteLink.ts
151
+ /**
152
+ * Forked from https://github.com/vuejs/router/blob/941b2131e80550009e5221d4db9f366b1fea3fd5/packages/router/src/RouterLink.ts#L293
153
+ */
154
+ const guardEvent = (event) => {
155
+ if (event.metaKey || event.altKey || event.ctrlKey || event.shiftKey) return;
156
+ if (event.defaultPrevented) return;
157
+ if (event.button !== void 0 && event.button !== 0) return;
158
+ if (event.currentTarget) {
159
+ if (event.currentTarget.getAttribute("target")?.match(/\b_blank\b/i)) return;
160
+ }
161
+ event.preventDefault();
162
+ return true;
163
+ };
164
+ /**
165
+ * Component to render a link to another route.
166
+ *
167
+ * It's similar to `RouterLink` in `vue-router`, but more lightweight.
168
+ *
169
+ * It's recommended to use `RouteLink` in VuePress.
170
+ */
171
+ const RouteLink = defineComponent({
172
+ name: "RouteLink",
173
+ props: {
174
+ /**
175
+ * The route path to link to
176
+ */
177
+ to: {
178
+ type: String,
179
+ required: true
180
+ },
181
+ /**
182
+ * Whether the link is active to have an active class
183
+ *
184
+ * Notice that the active status is not automatically determined according to the current route.
185
+ */
186
+ active: Boolean,
187
+ /**
188
+ * The class to add when the link is active
189
+ */
190
+ activeClass: {
191
+ type: String,
192
+ default: "route-link-active"
193
+ }
194
+ },
195
+ slots: Object,
196
+ setup(props, { slots }) {
197
+ const router = useRouter();
198
+ const route = useRoute();
199
+ const path = computed(() => props.to.startsWith("#") || props.to.startsWith("?") ? props.to : `${__VUEPRESS_BASE__}${resolveRouteFullPath(props.to, route.path).substring(1)}`);
200
+ return () => h("a", {
201
+ class: ["route-link", { [props.activeClass]: props.active }],
202
+ href: path.value,
203
+ onClick: (event = {}) => {
204
+ if (guardEvent(event)) router.push(props.to).catch();
205
+ }
206
+ }, slots.default());
207
+ }
208
+ });
209
+ //#endregion
210
+ //#region src/components/AutoLink.ts
211
+ /**
212
+ * Component to render a link automatically according to the link type
213
+ *
214
+ * - If the link is internal, it will be rendered as a `<RouteLink>`
215
+ * - If the link is external, it will be rendered as a normal `<a>` tag
216
+ */
217
+ const AutoLink = defineComponent({
218
+ name: "AutoLink",
219
+ props: { config: {
220
+ type: Object,
221
+ required: true
222
+ } },
223
+ slots: Object,
224
+ setup(props, { slots }) {
225
+ const config = toRef(props, "config");
226
+ const route = useRoute();
227
+ const siteData = useSiteData();
228
+ const withProtocol = computed(() => isLinkWithProtocol(config.value.link));
229
+ const linkTarget = computed(() => config.value.target || (withProtocol.value ? "_blank" : void 0));
230
+ const isBlankTarget = computed(() => linkTarget.value === "_blank");
231
+ const isInternal = computed(() => !withProtocol.value && !isBlankTarget.value);
232
+ const linkRel = computed(() => config.value.rel || (isBlankTarget.value ? "noopener noreferrer" : null));
233
+ const linkAriaLabel = computed(() => config.value.ariaLabel ?? config.value.text);
234
+ const shouldBeActiveInSubpath = computed(() => {
235
+ if (config.value.exact) return false;
236
+ const localePaths = Object.keys(siteData.value.locales);
237
+ return localePaths.length ? localePaths.every((key) => key !== config.value.link) : config.value.link !== "/";
238
+ });
239
+ const isActive = computed(() => {
240
+ if (!isInternal.value) return false;
241
+ if (config.value.activeMatch) return (config.value.activeMatch instanceof RegExp ? config.value.activeMatch : new RegExp(config.value.activeMatch, "u")).test(route.path);
242
+ if (shouldBeActiveInSubpath.value) return route.path.startsWith(config.value.link);
243
+ return route.path === config.value.link;
244
+ });
245
+ return () => {
246
+ const { before, after, default: defaultSlot } = slots;
247
+ const content = defaultSlot?.(config.value) ?? [
248
+ before?.(config.value),
249
+ config.value.text,
250
+ after?.(config.value)
251
+ ];
252
+ return isInternal.value ? h(RouteLink, {
253
+ "class": "auto-link",
254
+ "to": config.value.link,
255
+ "active": isActive.value,
256
+ "aria-label": linkAriaLabel.value
257
+ }, () => content) : h("a", {
258
+ "class": "auto-link external-link",
259
+ "href": config.value.link,
260
+ "aria-label": linkAriaLabel.value,
261
+ "rel": linkRel.value,
262
+ "target": linkTarget.value
263
+ }, content);
264
+ };
265
+ }
266
+ });
267
+ //#endregion
268
+ //#region src/components/ClientOnly.ts
269
+ /**
270
+ * Wrapper component that only renders its content on the client side and skips server side rendering
271
+ *
272
+ * Since vue 3.5, you can try the new `data-allow-mismatch` attribute instead of `<ClientOnly>` component in some cases to avoid hydration mismatch.
273
+ *
274
+ * @see https://blog.vuejs.org/posts/vue-3-5#data-allow-mismatch
275
+ */
276
+ const ClientOnly = defineComponent({
277
+ name: "ClientOnly",
278
+ setup(_, ctx) {
279
+ const isMounted = ref(false);
280
+ onMounted(() => {
281
+ isMounted.value = true;
282
+ });
283
+ return () => isMounted.value ? ctx.slots.default?.() : null;
284
+ }
285
+ });
286
+ //#endregion
287
+ //#region src/components/Content.ts
288
+ /**
289
+ * Execute all callbacks registered via `onContentUpdated`.
290
+ *
291
+ * @internal
292
+ */
293
+ const runContentUpdatedCallbacks = (reason) => {
294
+ contentUpdatedCallbacks.forEach((fn) => fn(reason));
295
+ };
296
+ /**
297
+ * Markdown rendered content
298
+ */
299
+ const Content = defineComponent({
300
+ name: "Content",
301
+ props: { path: {
302
+ type: String,
303
+ required: false,
304
+ default: ""
305
+ } },
306
+ setup(props) {
307
+ const pageComponent = usePageComponent();
308
+ const ContentComponent = computed(() => {
309
+ if (!props.path) return pageComponent.value;
310
+ const route = resolveRoute(props.path);
311
+ return defineAsyncComponent(async () => route.loader().then((m) => m.default));
312
+ });
313
+ return () => h(ContentComponent.value, {
314
+ onVnodeMounted: () => {
315
+ runContentUpdatedCallbacks("mounted");
316
+ },
317
+ onVnodeUpdated: () => {
318
+ runContentUpdatedCallbacks("updated");
319
+ },
320
+ onVnodeBeforeUnmount: () => {
321
+ runContentUpdatedCallbacks("beforeUnmount");
322
+ }
323
+ });
324
+ }
325
+ });
326
+ //#endregion
327
+ //#region src/constants.ts
328
+ /**
329
+ * Name of the default layout
330
+ */
331
+ const LAYOUT_NAME_DEFAULT = "Layout";
332
+ //#endregion
333
+ //#region src/resolvers.ts
334
+ /**
335
+ * Resolver methods to get global computed
336
+ *
337
+ * Users can override corresponding method for advanced customization
338
+ *
339
+ * @experimental - This is an experimental API and may be changed in minor versions
340
+ */
341
+ const resolvers = reactive({
342
+ /**
343
+ * Resolve layouts component map
344
+ */
345
+ resolveLayouts: (clientConfigs) => clientConfigs.reduce((prev, item) => ({
346
+ ...prev,
347
+ ...item.layouts
348
+ }), {}),
349
+ /**
350
+ * Merge the head config in frontmatter and site locale
351
+ *
352
+ * Frontmatter should take priority over site locale
353
+ */
354
+ resolvePageHead: (pageHeadTitle, pageFrontmatter, siteLocaleDate) => {
355
+ const description = isString(pageFrontmatter.description) ? pageFrontmatter.description : siteLocaleDate.description;
356
+ return dedupeHead([
357
+ ...Array.isArray(pageFrontmatter.head) ? pageFrontmatter.head : [],
358
+ ...siteLocaleDate.head,
359
+ [
360
+ "title",
361
+ {},
362
+ pageHeadTitle
363
+ ],
364
+ ["meta", {
365
+ name: "description",
366
+ content: description
367
+ }]
368
+ ]);
369
+ },
370
+ /**
371
+ * Resolve the content of page head title
372
+ *
373
+ * It would be used as the content of the `<title>` tag
374
+ */
375
+ resolvePageHeadTitle: (pageData, siteLocaleDate) => [pageData.title, siteLocaleDate.title].filter((item) => !!item).join(" | "),
376
+ /**
377
+ * Resolve page language from page data
378
+ *
379
+ * It would be used as the `lang` attribute of `<html>` tag
380
+ */
381
+ resolvePageLang: (pageData, siteLocaleData) => pageData.lang || siteLocaleData.lang || "en-US",
382
+ /**
383
+ * Resolve layout component of current page
384
+ */
385
+ resolvePageLayout: (pageData, layouts) => {
386
+ const layoutName = isString(pageData.frontmatter.layout) ? pageData.frontmatter.layout : LAYOUT_NAME_DEFAULT;
387
+ if (!layouts[layoutName]) throw new Error(`[vuepress] Cannot resolve layout: ${layoutName}`);
388
+ return layouts[layoutName];
389
+ },
390
+ /**
391
+ * Resolve locale path according to route path and locales config
392
+ */
393
+ resolveRouteLocale: (locales, routePath) => resolveLocalePath(locales, decodeURI(routePath)),
394
+ /**
395
+ * Resolve site data for specific locale
396
+ *
397
+ * It would merge the locales fields to the root fields
398
+ */
399
+ resolveSiteLocaleData: ({ base, locales, ...siteData }, routeLocale) => ({
400
+ ...siteData,
401
+ ...locales[routeLocale],
402
+ head: [...locales[routeLocale]?.head ?? [], ...siteData.head]
403
+ })
404
+ });
405
+ //#endregion
406
+ //#region src/utils/withBase.ts
407
+ /**
408
+ * Prefix url with site base
409
+ */
410
+ const withBase = (url) => {
411
+ if (isLinkHttp(url)) return url;
412
+ return `${__VUEPRESS_BASE__}${removeLeadingSlash(url)}`;
413
+ };
414
+ //#endregion
415
+ export { useRouteLocale as A, usePageComponent as C, usePageLang as D, usePageHead as E, useSiteLocale as F, useSiteLocaleData as I, clientDataSymbol as L, useRoutes as M, useSite as N, usePageLayout as O, useSiteData as P, useClientData as R, usePage as S, usePageFrontmatter as T, useData as _, AutoLink as a, useLang as b, useRouter$1 as c, resolveRoutePath as d, redirects$1 as f, onContentUpdated as g, useUpdateHead as h, ClientOnly as i, useRoutePath as j, useRedirects as k, resolveRouteFullPath as l, updateHeadSymbol as m, resolvers as n, RouteLink as o, routes$1 as p, Content as r, useRoute$1 as s, withBase as t, resolveRoute as u, useFrontmatter as v, usePageData as w, useLayouts as x, useHead as y };
package/package.json CHANGED
@@ -1,22 +1,30 @@
1
1
  {
2
2
  "name": "@vuepress/client",
3
- "version": "2.0.0-rc.3",
3
+ "version": "2.0.0-rc.31",
4
4
  "description": "Client package of VuePress",
5
5
  "keywords": [
6
- "vuepress",
7
- "client"
6
+ "client",
7
+ "vuepress"
8
8
  ],
9
9
  "homepage": "https://github.com/vuepress",
10
10
  "bugs": {
11
11
  "url": "https://github.com/vuepress/core/issues"
12
12
  },
13
+ "license": "MIT",
14
+ "author": "meteorlxy",
13
15
  "repository": {
14
16
  "type": "git",
15
17
  "url": "git+https://github.com/vuepress/core.git"
16
18
  },
17
- "license": "MIT",
18
- "author": "meteorlxy",
19
+ "files": [
20
+ "dist",
21
+ "templates",
22
+ "types.d.ts"
23
+ ],
19
24
  "type": "module",
25
+ "main": "./dist/index.js",
26
+ "module": "./dist/index.js",
27
+ "types": "./dist/index.d.ts",
20
28
  "exports": {
21
29
  ".": "./dist/index.js",
22
30
  "./app": "./dist/app.js",
@@ -24,50 +32,38 @@
24
32
  "./templates/*": "./templates/*",
25
33
  "./types": "./types.d.ts"
26
34
  },
27
- "main": "./dist/index.js",
28
- "module": "./dist/index.js",
29
- "types": "./dist/index.d.ts",
30
- "files": [
31
- "dist",
32
- "templates",
33
- "types.d.ts"
34
- ],
35
- "dependencies": {
36
- "@vue/devtools-api": "^6.5.1",
37
- "@vueuse/core": "^10.7.2",
38
- "vue": "^3.4.15",
39
- "vue-router": "^4.2.5",
40
- "@vuepress/shared": "2.0.0-rc.3"
41
- },
42
35
  "publishConfig": {
43
36
  "access": "public"
44
37
  },
45
- "tsup": {
46
- "clean": true,
47
- "dts": [
48
- "./src/app.ts",
49
- "./src/index.ts"
50
- ],
38
+ "dependencies": {
39
+ "@vue/devtools-api": "^8.1.5",
40
+ "@vue/devtools-kit": "^8.1.5",
41
+ "vue": "^3.5.40",
42
+ "vue-router": "^5.2.0",
43
+ "@vuepress/shared": "2.0.0-rc.31"
44
+ },
45
+ "tsdown": {
46
+ "deps": {
47
+ "neverBundle": [
48
+ "@internal/clientConfigs",
49
+ "@internal/routes",
50
+ "@internal/siteData",
51
+ "@internal/userStyle"
52
+ ]
53
+ },
54
+ "dts": true,
51
55
  "entry": [
52
56
  "./src/app.ts",
53
57
  "./src/index.ts"
54
58
  ],
55
- "external": [
56
- "@internal/clientConfigs",
57
- "@internal/layoutComponents",
58
- "@internal/routes",
59
- "@internal/siteData"
60
- ],
61
- "format": [
62
- "esm"
63
- ],
59
+ "fixedExtension": false,
60
+ "format": "esm",
64
61
  "outDir": "./dist",
65
- "sourcemap": false,
66
- "target": "es2022",
62
+ "target": "es2023",
67
63
  "tsconfig": "./tsconfig.dts.json"
68
64
  },
69
65
  "scripts": {
70
- "build": "tsup",
66
+ "build": "tsdown",
71
67
  "clean": "rimraf dist"
72
68
  }
73
69
  }
package/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention, no-underscore-dangle */
1
2
  declare const __VUEPRESS_VERSION__: string
2
3
  declare const __VUEPRESS_BASE__: string
3
4
  declare const __VUEPRESS_DEV__: boolean
4
5
  declare const __VUEPRESS_SSR__: boolean
5
- declare const __VUE_HMR_RUNTIME__: Record<string, any>
6
- declare const __VUE_OPTIONS_API__: boolean
6
+ declare const __VUE_HMR_RUNTIME__: Record<string, unknown>
7
7
  declare const __VUE_PROD_DEVTOOLS__: boolean