@vuepress/core 2.0.0-beta.47 → 2.0.0-beta.48
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.
|
@@ -20,7 +20,8 @@ if (import.meta.hot) {
|
|
|
20
20
|
*/
|
|
21
21
|
const preparePageData = async (app, page) => {
|
|
22
22
|
// page data file content
|
|
23
|
-
let content = `export const data = ${JSON.stringify(page.data
|
|
23
|
+
let content = `export const data = JSON.parse(${JSON.stringify(JSON.stringify(page.data))})
|
|
24
|
+
`;
|
|
24
25
|
// inject HMR code
|
|
25
26
|
if (app.env.isDev) {
|
|
26
27
|
content += HMR_CODE;
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.preparePagesRoutes = void 0;
|
|
4
4
|
const shared_1 = require("@vuepress/shared");
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Resolve page route item
|
|
7
7
|
*/
|
|
8
|
-
const
|
|
8
|
+
const resolvePageRouteItem = ({ key, path, pathInferred, filePathRelative, routeMeta, }) => {
|
|
9
9
|
// paths that should redirect to this page, use set to dedupe
|
|
10
10
|
const redirectsSet = new Set();
|
|
11
11
|
// redirect from decoded path
|
|
@@ -37,38 +37,11 @@ const transformPageToRouteItem = ({ key, path, pathInferred, filePathRelative, r
|
|
|
37
37
|
* Generate routes temp file
|
|
38
38
|
*/
|
|
39
39
|
const preparePagesRoutes = async (app) => {
|
|
40
|
-
const routeItems = app.pages.map(
|
|
40
|
+
const routeItems = app.pages.map(resolvePageRouteItem);
|
|
41
41
|
const content = `\
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const routeItems = [\
|
|
42
|
+
export const pagesRoutes = [\
|
|
45
43
|
${routeItems.map((routeItem) => `\n ${JSON.stringify(routeItem)},`).join('')}
|
|
46
44
|
]
|
|
47
|
-
|
|
48
|
-
export const pagesRoutes = routeItems.reduce(
|
|
49
|
-
(result, [name, path, meta, redirects]) => {
|
|
50
|
-
result.push(
|
|
51
|
-
{
|
|
52
|
-
name,
|
|
53
|
-
path,
|
|
54
|
-
component: Vuepress,
|
|
55
|
-
meta,
|
|
56
|
-
},
|
|
57
|
-
...redirects.map((item) => ({
|
|
58
|
-
path: item,
|
|
59
|
-
redirect: path,
|
|
60
|
-
}))
|
|
61
|
-
)
|
|
62
|
-
return result
|
|
63
|
-
},
|
|
64
|
-
[
|
|
65
|
-
{
|
|
66
|
-
name: '404',
|
|
67
|
-
path: '/:catchAll(.*)',
|
|
68
|
-
component: Vuepress,
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
)
|
|
72
45
|
`;
|
|
73
46
|
await app.writeTemp('internal/pagesRoutes.js', content);
|
|
74
47
|
};
|
|
@@ -20,7 +20,7 @@ if (import.meta.hot) {
|
|
|
20
20
|
*/
|
|
21
21
|
const prepareSiteData = async (app) => {
|
|
22
22
|
let content = `\
|
|
23
|
-
export const siteData = ${JSON.stringify(app.siteData
|
|
23
|
+
export const siteData = JSON.parse(${JSON.stringify(JSON.stringify(app.siteData))})
|
|
24
24
|
`;
|
|
25
25
|
// inject HMR code
|
|
26
26
|
if (app.env.isDev) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/core",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.48",
|
|
4
4
|
"description": "Core package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"lib"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@vuepress/client": "2.0.0-beta.
|
|
26
|
-
"@vuepress/markdown": "2.0.0-beta.
|
|
27
|
-
"@vuepress/shared": "2.0.0-beta.
|
|
28
|
-
"@vuepress/utils": "2.0.0-beta.
|
|
25
|
+
"@vuepress/client": "2.0.0-beta.48",
|
|
26
|
+
"@vuepress/markdown": "2.0.0-beta.48",
|
|
27
|
+
"@vuepress/shared": "2.0.0-beta.48",
|
|
28
|
+
"@vuepress/utils": "2.0.0-beta.48",
|
|
29
29
|
"gray-matter": "^4.0.3",
|
|
30
30
|
"toml": "^3.0.0",
|
|
31
31
|
"vue": "^3.2.36"
|