@vuepress/client 2.0.0-rc.26 → 2.0.0-rc.27
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.d.ts +4 -5
- package/dist/app.js +254 -322
- package/dist/chunk-pbuEa-1d.js +13 -0
- package/dist/constants-COBTj3zj.js +57 -0
- package/dist/index-CNztZIId.d.ts +117 -0
- package/dist/index.d.ts +184 -279
- package/dist/index.js +3 -83
- package/dist/setupDevtools-B3cgI7XH.js +64 -0
- package/dist/utils-_b2e7bpk.js +365 -0
- package/package.json +18 -22
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-XZCIWC7J.js +0 -66
- package/dist/chunk-YWDQ52BP.js +0 -459
- package/dist/createVueAppFunction-onJTVJru.d.ts +0 -9
- package/dist/setupDevtools-QXEOFQJV.js +0 -91
|
@@ -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-COBTj3zj.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,365 @@
|
|
|
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
|
+
/**
|
|
7
|
+
* Injection key for client data
|
|
8
|
+
*/
|
|
9
|
+
const clientDataSymbol = Symbol(__VUEPRESS_DEV__ ? "clientData" : "");
|
|
10
|
+
/**
|
|
11
|
+
* Returns client data
|
|
12
|
+
*/
|
|
13
|
+
const useClientData = () => {
|
|
14
|
+
const clientData = inject(clientDataSymbol);
|
|
15
|
+
if (!clientData) throw new Error("useClientData() is called without provider.");
|
|
16
|
+
return clientData;
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/composables/clientDataUtils.ts
|
|
20
|
+
const useLayouts = () => useClientData().layouts;
|
|
21
|
+
const usePageComponent = () => useClientData().pageComponent;
|
|
22
|
+
const usePageData = () => useClientData().pageData;
|
|
23
|
+
const usePageFrontmatter = () => useClientData().pageFrontmatter;
|
|
24
|
+
const usePageHead = () => useClientData().pageHead;
|
|
25
|
+
const usePageLang = () => useClientData().pageLang;
|
|
26
|
+
const usePageLayout = () => useClientData().pageLayout;
|
|
27
|
+
const useRedirects = () => useClientData().redirects;
|
|
28
|
+
const useRouteLocale = () => useClientData().routeLocale;
|
|
29
|
+
const useRoutePath = () => useClientData().routePath;
|
|
30
|
+
const useRoutes = () => useClientData().routes;
|
|
31
|
+
const useSiteData = () => useClientData().siteData;
|
|
32
|
+
const useSiteLocaleData = () => useClientData().siteLocaleData;
|
|
33
|
+
const useData = useClientData;
|
|
34
|
+
const useFrontmatter = usePageFrontmatter;
|
|
35
|
+
const useHead = usePageHead;
|
|
36
|
+
const useLang = usePageLang;
|
|
37
|
+
const usePage = usePageData;
|
|
38
|
+
const useSite = useSiteData;
|
|
39
|
+
const useSiteLocale = useSiteLocaleData;
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/internal/contentUpdatedCallbacks.ts
|
|
42
|
+
/**
|
|
43
|
+
* Global content updated callbacks
|
|
44
|
+
*/
|
|
45
|
+
const contentUpdatedCallbacks = /* @__PURE__ */ new Set();
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/composables/onContentUpdated.ts
|
|
48
|
+
/**
|
|
49
|
+
* Register callback that is called every time the markdown content is updated
|
|
50
|
+
* in the DOM.
|
|
51
|
+
*/
|
|
52
|
+
const onContentUpdated = (fn) => {
|
|
53
|
+
contentUpdatedCallbacks.add(fn);
|
|
54
|
+
onUnmounted(() => {
|
|
55
|
+
contentUpdatedCallbacks.delete(fn);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/composables/updateHead.ts
|
|
60
|
+
/**
|
|
61
|
+
* Injection key for `updateHead` util
|
|
62
|
+
*/
|
|
63
|
+
const updateHeadSymbol = Symbol(__VUEPRESS_DEV__ ? "updateHead" : "");
|
|
64
|
+
/**
|
|
65
|
+
* Returns the `updateHead` util
|
|
66
|
+
*/
|
|
67
|
+
const useUpdateHead = () => {
|
|
68
|
+
const updateHead = inject(updateHeadSymbol);
|
|
69
|
+
if (!updateHead) throw new Error("useUpdateHead() is called without provider.");
|
|
70
|
+
return updateHead;
|
|
71
|
+
};
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/internal/routes.ts
|
|
74
|
+
/**
|
|
75
|
+
* Global redirects ref
|
|
76
|
+
*/
|
|
77
|
+
const redirects$1 = shallowRef(redirects);
|
|
78
|
+
/**
|
|
79
|
+
* Global routes ref
|
|
80
|
+
*/
|
|
81
|
+
const routes$1 = shallowRef(routes);
|
|
82
|
+
if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) {
|
|
83
|
+
__VUE_HMR_RUNTIME__.updateRedirects = (data) => {
|
|
84
|
+
redirects$1.value = data;
|
|
85
|
+
};
|
|
86
|
+
__VUE_HMR_RUNTIME__.updateRoutes = (data) => {
|
|
87
|
+
routes$1.value = data;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/router/resolveRoutePath.ts
|
|
92
|
+
/**
|
|
93
|
+
* Resolve route path with given raw path
|
|
94
|
+
*/
|
|
95
|
+
const resolveRoutePath = (pathname, currentPath) => {
|
|
96
|
+
const normalizedRoutePath = normalizeRoutePath(pathname, currentPath);
|
|
97
|
+
if (routes$1.value[normalizedRoutePath]) return normalizedRoutePath;
|
|
98
|
+
const encodedRoutePath = encodeURI(normalizedRoutePath);
|
|
99
|
+
if (routes$1.value[encodedRoutePath]) return encodedRoutePath;
|
|
100
|
+
const redirectedRoutePath = redirects$1.value[normalizedRoutePath] || redirects$1.value[encodedRoutePath];
|
|
101
|
+
if (redirectedRoutePath) return redirectedRoutePath;
|
|
102
|
+
return normalizedRoutePath;
|
|
103
|
+
};
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/router/resolveRoute.ts
|
|
106
|
+
/**
|
|
107
|
+
* Resolve route with given path
|
|
108
|
+
*/
|
|
109
|
+
const resolveRoute = (path, currentPath) => {
|
|
110
|
+
const { pathname, hashAndQueries } = splitPath(path);
|
|
111
|
+
const routePath = resolveRoutePath(pathname, currentPath);
|
|
112
|
+
const routeFullPath = routePath + hashAndQueries;
|
|
113
|
+
if (!routes$1.value[routePath]) return {
|
|
114
|
+
...routes$1.value["/404.html"],
|
|
115
|
+
path: routeFullPath,
|
|
116
|
+
notFound: true
|
|
117
|
+
};
|
|
118
|
+
return {
|
|
119
|
+
...routes$1.value[routePath],
|
|
120
|
+
path: routeFullPath,
|
|
121
|
+
notFound: false
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/router/resolveRouteFullPath.ts
|
|
126
|
+
/**
|
|
127
|
+
* Resolve route full path with given raw path
|
|
128
|
+
*/
|
|
129
|
+
const resolveRouteFullPath = (path, currentPath) => {
|
|
130
|
+
const { pathname, hashAndQueries } = splitPath(path);
|
|
131
|
+
return resolveRoutePath(pathname, currentPath) + hashAndQueries;
|
|
132
|
+
};
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/components/RouteLink.ts
|
|
135
|
+
/**
|
|
136
|
+
* Forked from https://github.com/vuejs/router/blob/941b2131e80550009e5221d4db9f366b1fea3fd5/packages/router/src/RouterLink.ts#L293
|
|
137
|
+
*/
|
|
138
|
+
const guardEvent = (event) => {
|
|
139
|
+
if (event.metaKey || event.altKey || event.ctrlKey || event.shiftKey) return;
|
|
140
|
+
if (event.defaultPrevented) return;
|
|
141
|
+
if (event.button !== void 0 && event.button !== 0) return;
|
|
142
|
+
if (event.currentTarget) {
|
|
143
|
+
if (event.currentTarget.getAttribute("target")?.match(/\b_blank\b/i)) return;
|
|
144
|
+
}
|
|
145
|
+
event.preventDefault();
|
|
146
|
+
return true;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Component to render a link to another route.
|
|
150
|
+
*
|
|
151
|
+
* It's similar to `RouterLink` in `vue-router`, but more lightweight.
|
|
152
|
+
*
|
|
153
|
+
* It's recommended to use `RouteLink` in VuePress.
|
|
154
|
+
*/
|
|
155
|
+
const RouteLink = defineComponent({
|
|
156
|
+
name: "RouteLink",
|
|
157
|
+
props: {
|
|
158
|
+
to: {
|
|
159
|
+
type: String,
|
|
160
|
+
required: true
|
|
161
|
+
},
|
|
162
|
+
active: Boolean,
|
|
163
|
+
activeClass: {
|
|
164
|
+
type: String,
|
|
165
|
+
default: "route-link-active"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
slots: Object,
|
|
169
|
+
setup(props, { slots }) {
|
|
170
|
+
const router = useRouter();
|
|
171
|
+
const route = useRoute();
|
|
172
|
+
const path = computed(() => props.to.startsWith("#") || props.to.startsWith("?") ? props.to : `${__VUEPRESS_BASE__}${resolveRouteFullPath(props.to, route.path).substring(1)}`);
|
|
173
|
+
return () => h("a", {
|
|
174
|
+
class: ["route-link", { [props.activeClass]: props.active }],
|
|
175
|
+
href: path.value,
|
|
176
|
+
onClick: (event = {}) => {
|
|
177
|
+
if (guardEvent(event)) router.push(props.to).catch();
|
|
178
|
+
}
|
|
179
|
+
}, slots.default());
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/components/AutoLink.ts
|
|
184
|
+
/**
|
|
185
|
+
* Component to render a link automatically according to the link type
|
|
186
|
+
*
|
|
187
|
+
* - If the link is internal, it will be rendered as a `<RouteLink>`
|
|
188
|
+
* - If the link is external, it will be rendered as a normal `<a>` tag
|
|
189
|
+
*/
|
|
190
|
+
const AutoLink = defineComponent({
|
|
191
|
+
name: "AutoLink",
|
|
192
|
+
props: { config: {
|
|
193
|
+
type: Object,
|
|
194
|
+
required: true
|
|
195
|
+
} },
|
|
196
|
+
slots: Object,
|
|
197
|
+
setup(props, { slots }) {
|
|
198
|
+
const config = toRef(props, "config");
|
|
199
|
+
const route = useRoute();
|
|
200
|
+
const siteData = useSiteData();
|
|
201
|
+
const withProtocol = computed(() => isLinkWithProtocol(config.value.link));
|
|
202
|
+
const linkTarget = computed(() => config.value.target || (withProtocol.value ? "_blank" : void 0));
|
|
203
|
+
const isBlankTarget = computed(() => linkTarget.value === "_blank");
|
|
204
|
+
const isInternal = computed(() => !withProtocol.value && !isBlankTarget.value);
|
|
205
|
+
const linkRel = computed(() => config.value.rel || (isBlankTarget.value ? "noopener noreferrer" : null));
|
|
206
|
+
const linkAriaLabel = computed(() => config.value.ariaLabel ?? config.value.text);
|
|
207
|
+
const shouldBeActiveInSubpath = computed(() => {
|
|
208
|
+
if (config.value.exact) return false;
|
|
209
|
+
const localePaths = Object.keys(siteData.value.locales);
|
|
210
|
+
return localePaths.length ? localePaths.every((key) => key !== config.value.link) : config.value.link !== "/";
|
|
211
|
+
});
|
|
212
|
+
const isActive = computed(() => {
|
|
213
|
+
if (!isInternal.value) return false;
|
|
214
|
+
if (config.value.activeMatch) return (config.value.activeMatch instanceof RegExp ? config.value.activeMatch : new RegExp(config.value.activeMatch, "u")).test(route.path);
|
|
215
|
+
if (shouldBeActiveInSubpath.value) return route.path.startsWith(config.value.link);
|
|
216
|
+
return route.path === config.value.link;
|
|
217
|
+
});
|
|
218
|
+
return () => {
|
|
219
|
+
const { before, after, default: defaultSlot } = slots;
|
|
220
|
+
const content = defaultSlot?.(config.value) ?? [
|
|
221
|
+
before?.(config.value),
|
|
222
|
+
config.value.text,
|
|
223
|
+
after?.(config.value)
|
|
224
|
+
];
|
|
225
|
+
return isInternal.value ? h(RouteLink, {
|
|
226
|
+
"class": "auto-link",
|
|
227
|
+
"to": config.value.link,
|
|
228
|
+
"active": isActive.value,
|
|
229
|
+
"aria-label": linkAriaLabel.value
|
|
230
|
+
}, () => content) : h("a", {
|
|
231
|
+
"class": "auto-link external-link",
|
|
232
|
+
"href": config.value.link,
|
|
233
|
+
"aria-label": linkAriaLabel.value,
|
|
234
|
+
"rel": linkRel.value,
|
|
235
|
+
"target": linkTarget.value
|
|
236
|
+
}, content);
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region src/components/ClientOnly.ts
|
|
242
|
+
/**
|
|
243
|
+
* Wrapper component that only renders its content on the client side and skips server side rendering
|
|
244
|
+
*
|
|
245
|
+
* Since vue 3.5, you can try the new `data-allow-mismatch` attribute instead of `<ClientOnly>` component in some cases to avoid hydration mismatch.
|
|
246
|
+
*
|
|
247
|
+
* @see https://blog.vuejs.org/posts/vue-3-5#data-allow-mismatch
|
|
248
|
+
*/
|
|
249
|
+
const ClientOnly = defineComponent({
|
|
250
|
+
name: "ClientOnly",
|
|
251
|
+
setup(_, ctx) {
|
|
252
|
+
const isMounted = ref(false);
|
|
253
|
+
onMounted(() => {
|
|
254
|
+
isMounted.value = true;
|
|
255
|
+
});
|
|
256
|
+
return () => isMounted.value ? ctx.slots.default?.() : null;
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/components/Content.ts
|
|
261
|
+
/**
|
|
262
|
+
* Execute all callbacks registered via `onContentUpdated`.
|
|
263
|
+
*
|
|
264
|
+
* @internal
|
|
265
|
+
*/
|
|
266
|
+
const runContentUpdatedCallbacks = (reason) => {
|
|
267
|
+
contentUpdatedCallbacks.forEach((fn) => fn(reason));
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* Markdown rendered content
|
|
271
|
+
*/
|
|
272
|
+
const Content = defineComponent({
|
|
273
|
+
name: "Content",
|
|
274
|
+
props: { path: {
|
|
275
|
+
type: String,
|
|
276
|
+
required: false,
|
|
277
|
+
default: ""
|
|
278
|
+
} },
|
|
279
|
+
setup(props) {
|
|
280
|
+
const pageComponent = usePageComponent();
|
|
281
|
+
const ContentComponent = computed(() => {
|
|
282
|
+
if (!props.path) return pageComponent.value;
|
|
283
|
+
const route = resolveRoute(props.path);
|
|
284
|
+
return defineAsyncComponent(async () => route.loader().then((m) => m.default));
|
|
285
|
+
});
|
|
286
|
+
return () => h(ContentComponent.value, {
|
|
287
|
+
onVnodeMounted: () => {
|
|
288
|
+
runContentUpdatedCallbacks("mounted");
|
|
289
|
+
},
|
|
290
|
+
onVnodeUpdated: () => {
|
|
291
|
+
runContentUpdatedCallbacks("updated");
|
|
292
|
+
},
|
|
293
|
+
onVnodeBeforeUnmount: () => {
|
|
294
|
+
runContentUpdatedCallbacks("beforeUnmount");
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
//#endregion
|
|
300
|
+
//#region src/constants.ts
|
|
301
|
+
/**
|
|
302
|
+
* Name of the default layout
|
|
303
|
+
*/
|
|
304
|
+
const LAYOUT_NAME_DEFAULT = "Layout";
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/resolvers.ts
|
|
307
|
+
/**
|
|
308
|
+
* Resolver methods to get global computed
|
|
309
|
+
*
|
|
310
|
+
* Users can override corresponding method for advanced customization
|
|
311
|
+
*
|
|
312
|
+
* @experimental - This is an experimental API and may be changed in minor versions
|
|
313
|
+
*/
|
|
314
|
+
const resolvers = reactive({
|
|
315
|
+
resolveLayouts: (clientConfigs) => clientConfigs.reduce((prev, item) => ({
|
|
316
|
+
...prev,
|
|
317
|
+
...item.layouts
|
|
318
|
+
}), {}),
|
|
319
|
+
resolvePageHead: (pageHeadTitle, pageFrontmatter, siteLocaleDate) => {
|
|
320
|
+
const description = isString(pageFrontmatter.description) ? pageFrontmatter.description : siteLocaleDate.description;
|
|
321
|
+
return dedupeHead([
|
|
322
|
+
...Array.isArray(pageFrontmatter.head) ? pageFrontmatter.head : [],
|
|
323
|
+
...siteLocaleDate.head,
|
|
324
|
+
[
|
|
325
|
+
"title",
|
|
326
|
+
{},
|
|
327
|
+
pageHeadTitle
|
|
328
|
+
],
|
|
329
|
+
["meta", {
|
|
330
|
+
name: "description",
|
|
331
|
+
content: description
|
|
332
|
+
}]
|
|
333
|
+
]);
|
|
334
|
+
},
|
|
335
|
+
resolvePageHeadTitle: (pageData, siteLocaleDate) => [pageData.title, siteLocaleDate.title].filter((item) => !!item).join(" | "),
|
|
336
|
+
resolvePageLang: (pageData, siteLocaleData) => pageData.lang || siteLocaleData.lang || "en-US",
|
|
337
|
+
resolvePageLayout: (pageData, layouts) => {
|
|
338
|
+
const layoutName = isString(pageData.frontmatter.layout) ? pageData.frontmatter.layout : LAYOUT_NAME_DEFAULT;
|
|
339
|
+
if (!layouts[layoutName]) throw new Error(`[vuepress] Cannot resolve layout: ${layoutName}`);
|
|
340
|
+
return layouts[layoutName];
|
|
341
|
+
},
|
|
342
|
+
resolveRouteLocale: (locales, routePath) => resolveLocalePath(locales, decodeURI(routePath)),
|
|
343
|
+
resolveSiteLocaleData: ({ base, locales, ...siteData }, routeLocale) => ({
|
|
344
|
+
...siteData,
|
|
345
|
+
...locales[routeLocale],
|
|
346
|
+
head: [...locales[routeLocale]?.head ?? [], ...siteData.head]
|
|
347
|
+
})
|
|
348
|
+
});
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/utils/defineClientConfig.ts
|
|
351
|
+
/**
|
|
352
|
+
* A helper function to help you define vuepress client config file
|
|
353
|
+
*/
|
|
354
|
+
const defineClientConfig = (clientConfig = {}) => clientConfig;
|
|
355
|
+
//#endregion
|
|
356
|
+
//#region src/utils/withBase.ts
|
|
357
|
+
/**
|
|
358
|
+
* Prefix url with site base
|
|
359
|
+
*/
|
|
360
|
+
const withBase = (url) => {
|
|
361
|
+
if (isLinkHttp(url)) return url;
|
|
362
|
+
return `${__VUEPRESS_BASE__}${removeLeadingSlash(url)}`;
|
|
363
|
+
};
|
|
364
|
+
//#endregion
|
|
365
|
+
export { useRedirects as A, usePage as C, usePageHead as D, usePageFrontmatter as E, useSiteData as F, useSiteLocale as I, useSiteLocaleData as L, useRoutePath as M, useRoutes as N, usePageLang as O, useSite as P, clientDataSymbol as R, useLayouts as S, usePageData as T, onContentUpdated as _, ClientOnly as a, useHead as b, useRoute$1 as c, resolveRoute as d, resolveRoutePath as f, useUpdateHead as g, updateHeadSymbol as h, Content as i, useRouteLocale as j, usePageLayout as k, useRouter$1 as l, routes$1 as m, defineClientConfig as n, AutoLink as o, redirects$1 as p, resolvers as r, RouteLink as s, withBase as t, resolveRouteFullPath as u, useData as v, usePageComponent as w, useLang as x, useFrontmatter as y, useClientData as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/client",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.27",
|
|
4
4
|
"description": "Client package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress",
|
|
@@ -33,40 +33,36 @@
|
|
|
33
33
|
"types.d.ts"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@vue/devtools-api": "^8.0.
|
|
37
|
-
"@vue/devtools-kit": "^8.0.
|
|
38
|
-
"vue": "^3.5.
|
|
39
|
-
"vue-router": "^
|
|
40
|
-
"@vuepress/shared": "2.0.0-rc.
|
|
36
|
+
"@vue/devtools-api": "^8.0.7",
|
|
37
|
+
"@vue/devtools-kit": "^8.0.7",
|
|
38
|
+
"vue": "^3.5.29",
|
|
39
|
+
"vue-router": "^5.0.3",
|
|
40
|
+
"@vuepress/shared": "2.0.0-rc.27"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
"tsdown": {
|
|
46
|
+
"deps": {
|
|
47
|
+
"neverBundle": [
|
|
48
|
+
"@internal/clientConfigs",
|
|
49
|
+
"@internal/routes",
|
|
50
|
+
"@internal/siteData"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"dts": true,
|
|
51
54
|
"entry": [
|
|
52
55
|
"./src/app.ts",
|
|
53
56
|
"./src/index.ts"
|
|
54
57
|
],
|
|
55
|
-
"
|
|
56
|
-
"@internal/clientConfigs",
|
|
57
|
-
"@internal/routes",
|
|
58
|
-
"@internal/siteData"
|
|
59
|
-
],
|
|
60
|
-
"format": [
|
|
61
|
-
"esm"
|
|
62
|
-
],
|
|
58
|
+
"format": "esm",
|
|
63
59
|
"outDir": "./dist",
|
|
64
|
-
"sourcemap": false,
|
|
65
60
|
"target": "es2023",
|
|
61
|
+
"fixedExtension": false,
|
|
66
62
|
"tsconfig": "./tsconfig.dts.json"
|
|
67
63
|
},
|
|
68
64
|
"scripts": {
|
|
69
|
-
"build": "
|
|
65
|
+
"build": "tsdown",
|
|
70
66
|
"clean": "rimraf dist"
|
|
71
67
|
}
|
|
72
68
|
}
|
package/dist/chunk-MLKGABMK.js
DELETED
package/dist/chunk-XZCIWC7J.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__export
|
|
3
|
-
} from "./chunk-MLKGABMK.js";
|
|
4
|
-
|
|
5
|
-
// src/devtools/constants.ts
|
|
6
|
-
var constants_exports = {};
|
|
7
|
-
__export(constants_exports, {
|
|
8
|
-
COMPONENT_STATE_TYPE: () => COMPONENT_STATE_TYPE,
|
|
9
|
-
INSPECTOR_ID: () => INSPECTOR_ID,
|
|
10
|
-
INSPECTOR_LABEL: () => INSPECTOR_LABEL,
|
|
11
|
-
INSPECTOR_NODES: () => INSPECTOR_NODES,
|
|
12
|
-
INSPECTOR_STATE_SECTION_NAME: () => INSPECTOR_STATE_SECTION_NAME,
|
|
13
|
-
PLUGIN_ID: () => PLUGIN_ID,
|
|
14
|
-
PLUGIN_LABEL: () => PLUGIN_LABEL
|
|
15
|
-
});
|
|
16
|
-
var PLUGIN_ID = "org.vuejs.vuepress";
|
|
17
|
-
var PLUGIN_LABEL = "VuePress";
|
|
18
|
-
var COMPONENT_STATE_TYPE = PLUGIN_LABEL;
|
|
19
|
-
var INSPECTOR_ID = PLUGIN_ID;
|
|
20
|
-
var INSPECTOR_LABEL = PLUGIN_LABEL;
|
|
21
|
-
var INSPECTOR_NODE_INTERNAL = {
|
|
22
|
-
id: "INTERNAL",
|
|
23
|
-
label: "Internal",
|
|
24
|
-
keys: ["layouts", "routes", "redirects"]
|
|
25
|
-
};
|
|
26
|
-
var INSPECTOR_NODE_SITE = {
|
|
27
|
-
id: "SITE",
|
|
28
|
-
label: "Site",
|
|
29
|
-
keys: ["siteData", "siteLocaleData"]
|
|
30
|
-
};
|
|
31
|
-
var INSPECTOR_NODE_ROUTE = {
|
|
32
|
-
id: "ROUTE",
|
|
33
|
-
label: "Route",
|
|
34
|
-
keys: ["routePath", "routeLocale"]
|
|
35
|
-
};
|
|
36
|
-
var INSPECTOR_NODE_PAGE = {
|
|
37
|
-
id: "PAGE",
|
|
38
|
-
label: "Page",
|
|
39
|
-
keys: [
|
|
40
|
-
"pageData",
|
|
41
|
-
"pageFrontmatter",
|
|
42
|
-
"pageLang",
|
|
43
|
-
"pageHead",
|
|
44
|
-
"pageHeadTitle",
|
|
45
|
-
"pageLayout",
|
|
46
|
-
"pageComponent"
|
|
47
|
-
]
|
|
48
|
-
};
|
|
49
|
-
var INSPECTOR_NODES = {
|
|
50
|
-
[INSPECTOR_NODE_INTERNAL.id]: INSPECTOR_NODE_INTERNAL,
|
|
51
|
-
[INSPECTOR_NODE_SITE.id]: INSPECTOR_NODE_SITE,
|
|
52
|
-
[INSPECTOR_NODE_ROUTE.id]: INSPECTOR_NODE_ROUTE,
|
|
53
|
-
[INSPECTOR_NODE_PAGE.id]: INSPECTOR_NODE_PAGE
|
|
54
|
-
};
|
|
55
|
-
var INSPECTOR_STATE_SECTION_NAME = "State";
|
|
56
|
-
|
|
57
|
-
export {
|
|
58
|
-
PLUGIN_ID,
|
|
59
|
-
PLUGIN_LABEL,
|
|
60
|
-
COMPONENT_STATE_TYPE,
|
|
61
|
-
INSPECTOR_ID,
|
|
62
|
-
INSPECTOR_LABEL,
|
|
63
|
-
INSPECTOR_NODES,
|
|
64
|
-
INSPECTOR_STATE_SECTION_NAME,
|
|
65
|
-
constants_exports
|
|
66
|
-
};
|