@vuepress/core 2.0.0-rc.1 → 2.0.0-rc.3
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.d.ts +27 -55
- package/dist/index.js +113 -135
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -73,9 +73,7 @@ type Page<ExtraPageData extends Record<any, any> = Record<never, never>, ExtraPa
|
|
|
73
73
|
*/
|
|
74
74
|
permalink: string | null;
|
|
75
75
|
/**
|
|
76
|
-
* Custom data to be attached to
|
|
77
|
-
*
|
|
78
|
-
* @see https://router.vuejs.org/api/#meta
|
|
76
|
+
* Custom data to be attached to route record
|
|
79
77
|
*/
|
|
80
78
|
routeMeta: Record<string, unknown>;
|
|
81
79
|
/**
|
|
@@ -107,25 +105,19 @@ type Page<ExtraPageData extends Record<any, any> = Record<never, never>, ExtraPa
|
|
|
107
105
|
*/
|
|
108
106
|
componentFilePathRelative: string;
|
|
109
107
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* Only take effect in webpack
|
|
108
|
+
* Chunk file path
|
|
113
109
|
*/
|
|
114
|
-
|
|
110
|
+
chunkFilePath: string;
|
|
115
111
|
/**
|
|
116
|
-
*
|
|
112
|
+
* Chunk file path relative to temp directory
|
|
117
113
|
*/
|
|
118
|
-
|
|
114
|
+
chunkFilePathRelative: string;
|
|
119
115
|
/**
|
|
120
|
-
*
|
|
121
|
-
*/
|
|
122
|
-
dataFilePathRelative: string;
|
|
123
|
-
/**
|
|
124
|
-
* Page data file chunk name
|
|
116
|
+
* Chunk name
|
|
125
117
|
*
|
|
126
|
-
*
|
|
118
|
+
* This will only take effect in webpack
|
|
127
119
|
*/
|
|
128
|
-
|
|
120
|
+
chunkName: string;
|
|
129
121
|
/**
|
|
130
122
|
* Rendered html file path
|
|
131
123
|
*/
|
|
@@ -557,29 +549,19 @@ interface BuildApp extends App {
|
|
|
557
549
|
declare const prepareClientConfigs: (app: App) => Promise<void>;
|
|
558
550
|
|
|
559
551
|
/**
|
|
560
|
-
* Generate page
|
|
561
|
-
*/
|
|
562
|
-
declare const preparePageComponent: (app: App, page: Page) => Promise<void>;
|
|
563
|
-
|
|
564
|
-
/**
|
|
565
|
-
* Generate page data temp file of a single page
|
|
552
|
+
* Generate page chunk temp file of a single page
|
|
566
553
|
*/
|
|
567
|
-
declare const
|
|
554
|
+
declare const preparePageChunk: (app: App, page: Page) => Promise<void>;
|
|
568
555
|
|
|
569
556
|
/**
|
|
570
|
-
* Generate page
|
|
571
|
-
*/
|
|
572
|
-
declare const preparePagesComponents: (app: App) => Promise<void>;
|
|
573
|
-
|
|
574
|
-
/**
|
|
575
|
-
* Generate page path to page data map temp file
|
|
557
|
+
* Generate page component temp file of a single page
|
|
576
558
|
*/
|
|
577
|
-
declare const
|
|
559
|
+
declare const preparePageComponent: (app: App, page: Page) => Promise<void>;
|
|
578
560
|
|
|
579
561
|
/**
|
|
580
562
|
* Generate routes temp file
|
|
581
563
|
*/
|
|
582
|
-
declare const
|
|
564
|
+
declare const prepareRoutes: (app: App) => Promise<void>;
|
|
583
565
|
|
|
584
566
|
/**
|
|
585
567
|
* Generate site data temp file
|
|
@@ -705,30 +687,27 @@ declare const renderPageContent: ({ app, content, filePath, filePathRelative, op
|
|
|
705
687
|
};
|
|
706
688
|
|
|
707
689
|
/**
|
|
708
|
-
* Resolve page
|
|
690
|
+
* Resolve page data file path
|
|
709
691
|
*/
|
|
710
|
-
declare const
|
|
692
|
+
declare const resolvePageChunkInfo: ({ app, htmlFilePathRelative, }: {
|
|
711
693
|
app: App;
|
|
712
694
|
htmlFilePathRelative: string;
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
}>;
|
|
695
|
+
}) => {
|
|
696
|
+
chunkFilePath: string;
|
|
697
|
+
chunkFilePathRelative: string;
|
|
698
|
+
chunkName: string;
|
|
699
|
+
};
|
|
719
700
|
|
|
720
701
|
/**
|
|
721
|
-
* Resolve page
|
|
702
|
+
* Resolve page component and related info
|
|
722
703
|
*/
|
|
723
|
-
declare const
|
|
704
|
+
declare const resolvePageComponentInfo: ({ app, htmlFilePathRelative, }: {
|
|
724
705
|
app: App;
|
|
725
706
|
htmlFilePathRelative: string;
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
dataFileChunkName: string;
|
|
731
|
-
};
|
|
707
|
+
}) => Promise<{
|
|
708
|
+
componentFilePath: string;
|
|
709
|
+
componentFilePathRelative: string;
|
|
710
|
+
}>;
|
|
732
711
|
|
|
733
712
|
/**
|
|
734
713
|
* Resolve page date according to frontmatter or file path
|
|
@@ -770,13 +749,6 @@ declare const resolvePageHtmlInfo: ({ app, path: pagePath, }: {
|
|
|
770
749
|
htmlFilePathRelative: string;
|
|
771
750
|
};
|
|
772
751
|
|
|
773
|
-
/**
|
|
774
|
-
* Resolve page key to identify the page
|
|
775
|
-
*/
|
|
776
|
-
declare const resolvePageKey: ({ path }: {
|
|
777
|
-
path: string;
|
|
778
|
-
}) => string;
|
|
779
|
-
|
|
780
752
|
/**
|
|
781
753
|
* Resolve language of page
|
|
782
754
|
*/
|
|
@@ -842,4 +814,4 @@ declare const normalizeAliasDefineHook: (hook: AliasDefineHook['exposed']) => Al
|
|
|
842
814
|
*/
|
|
843
815
|
declare const normalizeClientConfigFileHook: (hook: ClientConfigFileHook['exposed']) => ClientConfigFileHook['normalized'];
|
|
844
816
|
|
|
845
|
-
export { type AliasDefineHook, type App, type AppConfig, type AppConfigBuild, type AppConfigCommon, type AppConfigDev, type AppDir, type AppDirFunction, type AppEnv, type AppOptions, type AppWriteTemp, type BuildApp, type Bundler, type ClientConfigFileHook, type DevApp, type ExtendsHook, type Hook, type HookItem, type HookQueue, type Hooks, type HooksExposed, type HooksName, type HooksNormalized, type HooksResult, type LifeCycleHook, type Page, type PageOptions, type Plugin, type PluginApi, type PluginConfig, type PluginFunction, type PluginObject, type Theme, type ThemeFunction, type ThemeInfo, type ThemeObject, appInit, appPrepare, appUse, createAppDirFunction, createBaseApp, createBuildApp, createDevApp, createHookQueue, createPage, createPluginApi, createPluginApiHooks, createPluginApiRegisterHooks, inferPagePath, normalizeAliasDefineHook, normalizeClientConfigFileHook, prepareClientConfigs,
|
|
817
|
+
export { type AliasDefineHook, type App, type AppConfig, type AppConfigBuild, type AppConfigCommon, type AppConfigDev, type AppDir, type AppDirFunction, type AppEnv, type AppOptions, type AppWriteTemp, type BuildApp, type Bundler, type ClientConfigFileHook, type DevApp, type ExtendsHook, type Hook, type HookItem, type HookQueue, type Hooks, type HooksExposed, type HooksName, type HooksNormalized, type HooksResult, type LifeCycleHook, type Page, type PageOptions, type Plugin, type PluginApi, type PluginConfig, type PluginFunction, type PluginObject, type Theme, type ThemeFunction, type ThemeInfo, type ThemeObject, appInit, appPrepare, appUse, createAppDirFunction, createBaseApp, createBuildApp, createDevApp, createHookQueue, createPage, createPluginApi, createPluginApiHooks, createPluginApiRegisterHooks, inferPagePath, normalizeAliasDefineHook, normalizeClientConfigFileHook, prepareClientConfigs, preparePageChunk, preparePageComponent, prepareRoutes, prepareSiteData, renderPageContent, resolveAppDir, resolveAppEnv, resolveAppOptions, resolveAppPages, resolveAppSiteData, resolveAppVersion, resolveAppWriteTemp, resolvePageChunkInfo, resolvePageComponentInfo, resolvePageDate, resolvePageFileContent, resolvePageFilePath, resolvePageHtmlInfo, resolvePageLang, resolvePagePath, resolvePagePermalink, resolvePageRouteMeta, resolvePageSlug, resolvePluginObject, resolveThemeInfo };
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,32 @@ ${clientConfigFiles.map((_, index) => ` clientConfig${index},`).join("\n")}
|
|
|
10
10
|
await app.writeTemp("internal/clientConfigs.js", content);
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
+
// src/app/prepare/preparePageChunk.ts
|
|
14
|
+
var HMR_CODE = `
|
|
15
|
+
if (import.meta.webpackHot) {
|
|
16
|
+
import.meta.webpackHot.accept()
|
|
17
|
+
if (__VUE_HMR_RUNTIME__.updatePageData) {
|
|
18
|
+
__VUE_HMR_RUNTIME__.updatePageData(data)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (import.meta.hot) {
|
|
23
|
+
import.meta.hot.accept(({ data }) => {
|
|
24
|
+
__VUE_HMR_RUNTIME__.updatePageData(data)
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
var preparePageChunk = async (app, page) => {
|
|
29
|
+
let content = `import comp from ${JSON.stringify(page.componentFilePath)}
|
|
30
|
+
const data = JSON.parse(${JSON.stringify(JSON.stringify(page.data))})
|
|
31
|
+
export { comp, data }
|
|
32
|
+
`;
|
|
33
|
+
if (app.env.isDev) {
|
|
34
|
+
content += HMR_CODE;
|
|
35
|
+
}
|
|
36
|
+
await app.writeTemp(page.chunkFilePathRelative, content);
|
|
37
|
+
};
|
|
38
|
+
|
|
13
39
|
// src/app/prepare/preparePageComponent.ts
|
|
14
40
|
var preparePageComponent = async (app, page) => {
|
|
15
41
|
await app.writeTemp(
|
|
@@ -27,99 +53,74 @@ var preparePageComponent = async (app, page) => {
|
|
|
27
53
|
);
|
|
28
54
|
};
|
|
29
55
|
|
|
30
|
-
// src/app/prepare/
|
|
31
|
-
|
|
56
|
+
// src/app/prepare/prepareRoutes.ts
|
|
57
|
+
import { ensureLeadingSlash, normalizeRoutePath } from "@vuepress/shared";
|
|
58
|
+
var HMR_CODE2 = `
|
|
32
59
|
if (import.meta.webpackHot) {
|
|
33
60
|
import.meta.webpackHot.accept()
|
|
34
|
-
if (__VUE_HMR_RUNTIME__.
|
|
35
|
-
__VUE_HMR_RUNTIME__.
|
|
61
|
+
if (__VUE_HMR_RUNTIME__.updateRoutes) {
|
|
62
|
+
__VUE_HMR_RUNTIME__.updateRoutes(routes)
|
|
63
|
+
}
|
|
64
|
+
if (__VUE_HMR_RUNTIME__.updateRedirects) {
|
|
65
|
+
__VUE_HMR_RUNTIME__.updateRedirects(redirects)
|
|
36
66
|
}
|
|
37
67
|
}
|
|
38
68
|
|
|
39
69
|
if (import.meta.hot) {
|
|
40
|
-
import.meta.hot.accept(({
|
|
41
|
-
__VUE_HMR_RUNTIME__.
|
|
70
|
+
import.meta.hot.accept(({ routes, redirects }) => {
|
|
71
|
+
__VUE_HMR_RUNTIME__.updateRoutes(routes)
|
|
72
|
+
__VUE_HMR_RUNTIME__.updateRedirects(redirects)
|
|
42
73
|
})
|
|
43
74
|
}
|
|
44
75
|
`;
|
|
45
|
-
var
|
|
46
|
-
let content = `export const data = JSON.parse(${JSON.stringify(
|
|
47
|
-
JSON.stringify(page.data)
|
|
48
|
-
)})
|
|
49
|
-
`;
|
|
50
|
-
if (app.env.isDev) {
|
|
51
|
-
content += HMR_CODE;
|
|
52
|
-
}
|
|
53
|
-
await app.writeTemp(page.dataFilePathRelative, content);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
// src/app/prepare/preparePagesComponents.ts
|
|
57
|
-
var preparePagesComponents = async (app) => {
|
|
58
|
-
const content = `import { defineAsyncComponent } from 'vue'
|
|
59
|
-
|
|
60
|
-
export const pagesComponents = {${app.pages.map(
|
|
61
|
-
({ key, path: path9, componentFilePath, componentFileChunkName }) => `
|
|
62
|
-
// path: ${path9}
|
|
63
|
-
${JSON.stringify(key)}: defineAsyncComponent(() => import(${componentFileChunkName ? `/* webpackChunkName: "${componentFileChunkName}" */` : ""}${JSON.stringify(componentFilePath)})),`
|
|
64
|
-
).join("")}
|
|
65
|
-
}
|
|
66
|
-
`;
|
|
67
|
-
await app.writeTemp("internal/pagesComponents.js", content);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
// src/app/prepare/preparePagesData.ts
|
|
71
|
-
var preparePagesData = async (app) => {
|
|
72
|
-
const content = `export const pagesData = {${app.pages.map(
|
|
73
|
-
({ key, path: path9, dataFilePath, dataFileChunkName }) => `
|
|
74
|
-
// path: ${path9}
|
|
75
|
-
${JSON.stringify(key)}: () => import(${dataFileChunkName ? `/* webpackChunkName: "${dataFileChunkName}" */` : ""}${JSON.stringify(dataFilePath)}).then(({ data }) => data),`
|
|
76
|
-
).join("")}
|
|
77
|
-
}
|
|
78
|
-
`;
|
|
79
|
-
await app.writeTemp("internal/pagesData.js", content);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
// src/app/prepare/preparePagesRoutes.ts
|
|
83
|
-
import { ensureLeadingSlash } from "@vuepress/shared";
|
|
84
|
-
var resolvePageRouteItem = ({
|
|
85
|
-
key,
|
|
76
|
+
var resolvePageRedirects = ({
|
|
86
77
|
path: path9,
|
|
87
78
|
pathInferred,
|
|
88
|
-
filePathRelative
|
|
89
|
-
routeMeta
|
|
79
|
+
filePathRelative
|
|
90
80
|
}) => {
|
|
91
81
|
const redirectsSet = /* @__PURE__ */ new Set();
|
|
92
|
-
|
|
82
|
+
const addRedirect = (redirect) => {
|
|
83
|
+
const normalizedPath = normalizeRoutePath(redirect);
|
|
84
|
+
if (normalizedPath === path9)
|
|
85
|
+
return;
|
|
86
|
+
const encodedPath = encodeURI(normalizedPath);
|
|
87
|
+
if (encodedPath === path9)
|
|
88
|
+
return;
|
|
89
|
+
redirectsSet.add(redirect);
|
|
90
|
+
};
|
|
93
91
|
if (pathInferred !== null) {
|
|
94
|
-
|
|
95
|
-
redirectsSet.add(encodeURI(pathInferred));
|
|
92
|
+
addRedirect(pathInferred);
|
|
96
93
|
}
|
|
97
94
|
if (filePathRelative !== null) {
|
|
98
|
-
|
|
99
|
-
redirectsSet.add(filenamePath);
|
|
100
|
-
redirectsSet.add(encodeURI(filenamePath));
|
|
95
|
+
addRedirect(ensureLeadingSlash(filePathRelative));
|
|
101
96
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
97
|
+
return Array.from(redirectsSet);
|
|
98
|
+
};
|
|
99
|
+
var prepareRoutes = async (app) => {
|
|
100
|
+
let content = `export const redirects = JSON.parse(${JSON.stringify(
|
|
101
|
+
JSON.stringify(
|
|
102
|
+
Object.fromEntries(
|
|
103
|
+
app.pages.flatMap(
|
|
104
|
+
(page) => resolvePageRedirects(page).map((redirect) => [redirect, page.path])
|
|
105
|
+
)
|
|
106
|
+
)
|
|
109
107
|
)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
]
|
|
108
|
+
)})
|
|
109
|
+
|
|
110
|
+
export const routes = Object.fromEntries([
|
|
111
|
+
${app.pages.map(
|
|
112
|
+
({ chunkFilePath, chunkName, path: path9, routeMeta }) => ` [${JSON.stringify(path9)}, { loader: () => import(${chunkName ? `/* webpackChunkName: "${chunkName}" */` : ""}${JSON.stringify(chunkFilePath)}), meta: ${JSON.stringify(routeMeta)} }],`
|
|
113
|
+
).join("\n")}
|
|
114
|
+
]);
|
|
117
115
|
`;
|
|
118
|
-
|
|
116
|
+
if (app.env.isDev) {
|
|
117
|
+
content += HMR_CODE2;
|
|
118
|
+
}
|
|
119
|
+
await app.writeTemp("internal/routes.js", content);
|
|
119
120
|
};
|
|
120
121
|
|
|
121
122
|
// src/app/prepare/prepareSiteData.ts
|
|
122
|
-
var
|
|
123
|
+
var HMR_CODE3 = `
|
|
123
124
|
if (import.meta.webpackHot) {
|
|
124
125
|
import.meta.webpackHot.accept()
|
|
125
126
|
if (__VUE_HMR_RUNTIME__.updateSiteData) {
|
|
@@ -139,7 +140,7 @@ var prepareSiteData = async (app) => {
|
|
|
139
140
|
)})
|
|
140
141
|
`;
|
|
141
142
|
if (app.env.isDev) {
|
|
142
|
-
content +=
|
|
143
|
+
content += HMR_CODE3;
|
|
143
144
|
}
|
|
144
145
|
await app.writeTemp("internal/siteData.js", content);
|
|
145
146
|
};
|
|
@@ -233,40 +234,36 @@ var renderPageContent = ({
|
|
|
233
234
|
};
|
|
234
235
|
};
|
|
235
236
|
|
|
236
|
-
// src/page/
|
|
237
|
-
import { path } from "@vuepress/utils";
|
|
238
|
-
var
|
|
237
|
+
// src/page/resolvePageChunkInfo.ts
|
|
238
|
+
import { hash, path } from "@vuepress/utils";
|
|
239
|
+
var resolvePageChunkInfo = ({
|
|
239
240
|
app,
|
|
240
|
-
htmlFilePathRelative
|
|
241
|
-
key
|
|
241
|
+
htmlFilePathRelative
|
|
242
242
|
}) => {
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
);
|
|
247
|
-
const componentFilePath = app.dir.temp(componentFilePathRelative);
|
|
248
|
-
const componentFileChunkName = key;
|
|
243
|
+
const chunkFilePathRelative = path.join("pages", `${htmlFilePathRelative}.js`);
|
|
244
|
+
const chunkFilePath = app.dir.temp(chunkFilePathRelative);
|
|
245
|
+
const chunkName = `v-${hash(htmlFilePathRelative)}`;
|
|
249
246
|
return {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
247
|
+
chunkFilePath,
|
|
248
|
+
chunkFilePathRelative,
|
|
249
|
+
chunkName
|
|
253
250
|
};
|
|
254
251
|
};
|
|
255
252
|
|
|
256
|
-
// src/page/
|
|
253
|
+
// src/page/resolvePageComponentInfo.ts
|
|
257
254
|
import { path as path2 } from "@vuepress/utils";
|
|
258
|
-
var
|
|
255
|
+
var resolvePageComponentInfo = async ({
|
|
259
256
|
app,
|
|
260
|
-
htmlFilePathRelative
|
|
261
|
-
key
|
|
257
|
+
htmlFilePathRelative
|
|
262
258
|
}) => {
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
|
|
259
|
+
const componentFilePathRelative = path2.join(
|
|
260
|
+
"pages",
|
|
261
|
+
`${htmlFilePathRelative}.vue`
|
|
262
|
+
);
|
|
263
|
+
const componentFilePath = app.dir.temp(componentFilePathRelative);
|
|
266
264
|
return {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
dataFileChunkName
|
|
265
|
+
componentFilePath,
|
|
266
|
+
componentFilePathRelative
|
|
270
267
|
};
|
|
271
268
|
};
|
|
272
269
|
|
|
@@ -366,8 +363,9 @@ var resolvePageHtmlInfo = ({
|
|
|
366
363
|
app,
|
|
367
364
|
path: pagePath
|
|
368
365
|
}) => {
|
|
366
|
+
const path9 = decodeURI(pagePath);
|
|
369
367
|
const htmlFilePathRelative = removeLeadingSlash(
|
|
370
|
-
|
|
368
|
+
path9.endsWith("/") ? path9 + "index.html" : path9.endsWith(".html") ? path9 : path9 + ".html"
|
|
371
369
|
);
|
|
372
370
|
const htmlFilePath = app.dir.dest(htmlFilePathRelative);
|
|
373
371
|
return {
|
|
@@ -376,10 +374,6 @@ var resolvePageHtmlInfo = ({
|
|
|
376
374
|
};
|
|
377
375
|
};
|
|
378
376
|
|
|
379
|
-
// src/page/resolvePageKey.ts
|
|
380
|
-
import { hash } from "@vuepress/utils";
|
|
381
|
-
var resolvePageKey = ({ path: path9 }) => `v-${hash(path9)}`;
|
|
382
|
-
|
|
383
377
|
// src/page/resolvePageLang.ts
|
|
384
378
|
import { isString as isString2 } from "@vuepress/shared";
|
|
385
379
|
var resolvePageLang = ({
|
|
@@ -394,22 +388,18 @@ var resolvePageLang = ({
|
|
|
394
388
|
};
|
|
395
389
|
|
|
396
390
|
// src/page/resolvePagePath.ts
|
|
397
|
-
import { ensureEndingSlash } from "@vuepress/shared";
|
|
398
391
|
import { logger as logger2, sanitizeFileName } from "@vuepress/utils";
|
|
399
392
|
var resolvePagePath = ({
|
|
400
393
|
permalink,
|
|
401
394
|
pathInferred,
|
|
402
395
|
options
|
|
403
396
|
}) => {
|
|
404
|
-
|
|
397
|
+
const pagePath = options.path || permalink || pathInferred;
|
|
405
398
|
if (!pagePath) {
|
|
406
399
|
throw logger2.createError(
|
|
407
400
|
`page path is empty, page options: ${JSON.stringify(options, null, 2)}`
|
|
408
401
|
);
|
|
409
402
|
}
|
|
410
|
-
if (!pagePath.endsWith(".html")) {
|
|
411
|
-
pagePath = ensureEndingSlash(pagePath);
|
|
412
|
-
}
|
|
413
403
|
return encodeURI(pagePath.split("/").map(sanitizeFileName).join("/"));
|
|
414
404
|
};
|
|
415
405
|
|
|
@@ -508,25 +498,18 @@ var createPage = async (app, options) => {
|
|
|
508
498
|
pathLocale
|
|
509
499
|
});
|
|
510
500
|
const path9 = resolvePagePath({ permalink, pathInferred, options });
|
|
511
|
-
const key = resolvePageKey({ path: path9 });
|
|
512
501
|
const { htmlFilePath, htmlFilePathRelative } = resolvePageHtmlInfo({
|
|
513
502
|
app,
|
|
514
503
|
path: path9
|
|
515
504
|
});
|
|
516
|
-
const {
|
|
517
|
-
componentFilePath,
|
|
518
|
-
componentFilePathRelative,
|
|
519
|
-
componentFileChunkName
|
|
520
|
-
} = await resolvePageComponentInfo({
|
|
505
|
+
const { componentFilePath, componentFilePathRelative } = await resolvePageComponentInfo({
|
|
521
506
|
app,
|
|
522
|
-
htmlFilePathRelative
|
|
523
|
-
key
|
|
507
|
+
htmlFilePathRelative
|
|
524
508
|
});
|
|
525
|
-
const {
|
|
509
|
+
const { chunkFilePath, chunkFilePathRelative, chunkName } = resolvePageChunkInfo({ app, htmlFilePathRelative });
|
|
526
510
|
const page = {
|
|
527
511
|
// page data
|
|
528
512
|
data: {
|
|
529
|
-
key,
|
|
530
513
|
path: path9,
|
|
531
514
|
title,
|
|
532
515
|
lang,
|
|
@@ -534,7 +517,6 @@ var createPage = async (app, options) => {
|
|
|
534
517
|
headers
|
|
535
518
|
},
|
|
536
519
|
// base fields
|
|
537
|
-
key,
|
|
538
520
|
path: path9,
|
|
539
521
|
title,
|
|
540
522
|
lang,
|
|
@@ -558,10 +540,9 @@ var createPage = async (app, options) => {
|
|
|
558
540
|
filePathRelative,
|
|
559
541
|
componentFilePath,
|
|
560
542
|
componentFilePathRelative,
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
dataFileChunkName,
|
|
543
|
+
chunkFilePath,
|
|
544
|
+
chunkFilePathRelative,
|
|
545
|
+
chunkName,
|
|
565
546
|
htmlFilePath,
|
|
566
547
|
htmlFilePathRelative
|
|
567
548
|
};
|
|
@@ -580,13 +561,15 @@ var resolveAppPages = async (app) => {
|
|
|
580
561
|
const pages = await Promise.all(
|
|
581
562
|
pageFilePaths.map((filePath) => createPage(app, { filePath }))
|
|
582
563
|
);
|
|
583
|
-
|
|
564
|
+
const notFoundPage = pages.find((page) => page.path === "/404.html");
|
|
565
|
+
if (notFoundPage) {
|
|
566
|
+
notFoundPage.frontmatter.layout ??= "NotFound";
|
|
567
|
+
} else {
|
|
584
568
|
pages.push(
|
|
585
569
|
await createPage(app, {
|
|
586
570
|
path: "/404.html",
|
|
587
|
-
frontmatter: {
|
|
588
|
-
|
|
589
|
-
}
|
|
571
|
+
frontmatter: { layout: "NotFound" },
|
|
572
|
+
content: "404 Not Found"
|
|
590
573
|
})
|
|
591
574
|
);
|
|
592
575
|
}
|
|
@@ -613,12 +596,10 @@ var appPrepare = async (app) => {
|
|
|
613
596
|
for (const page of app.pages) {
|
|
614
597
|
await preparePageComponent(app, page);
|
|
615
598
|
}
|
|
616
|
-
await preparePagesComponents(app);
|
|
617
599
|
for (const page of app.pages) {
|
|
618
|
-
await
|
|
600
|
+
await preparePageChunk(app, page);
|
|
619
601
|
}
|
|
620
|
-
await
|
|
621
|
-
await preparePagesRoutes(app);
|
|
602
|
+
await prepareRoutes(app);
|
|
622
603
|
await prepareSiteData(app);
|
|
623
604
|
await prepareClientConfigs(app);
|
|
624
605
|
await app.pluginApi.hooks.onPrepared.process(app);
|
|
@@ -1008,11 +989,9 @@ export {
|
|
|
1008
989
|
normalizeAliasDefineHook,
|
|
1009
990
|
normalizeClientConfigFileHook,
|
|
1010
991
|
prepareClientConfigs,
|
|
992
|
+
preparePageChunk,
|
|
1011
993
|
preparePageComponent,
|
|
1012
|
-
|
|
1013
|
-
preparePagesComponents,
|
|
1014
|
-
preparePagesData,
|
|
1015
|
-
preparePagesRoutes,
|
|
994
|
+
prepareRoutes,
|
|
1016
995
|
prepareSiteData,
|
|
1017
996
|
renderPageContent,
|
|
1018
997
|
resolveAppDir,
|
|
@@ -1022,13 +1001,12 @@ export {
|
|
|
1022
1001
|
resolveAppSiteData,
|
|
1023
1002
|
resolveAppVersion,
|
|
1024
1003
|
resolveAppWriteTemp,
|
|
1004
|
+
resolvePageChunkInfo,
|
|
1025
1005
|
resolvePageComponentInfo,
|
|
1026
|
-
resolvePageDataInfo,
|
|
1027
1006
|
resolvePageDate,
|
|
1028
1007
|
resolvePageFileContent,
|
|
1029
1008
|
resolvePageFilePath,
|
|
1030
1009
|
resolvePageHtmlInfo,
|
|
1031
|
-
resolvePageKey,
|
|
1032
1010
|
resolvePageLang,
|
|
1033
1011
|
resolvePagePath,
|
|
1034
1012
|
resolvePagePermalink,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/core",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.3",
|
|
4
4
|
"description": "Core package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"vue": "^3.4.15",
|
|
31
|
-
"@vuepress/client": "2.0.0-rc.
|
|
32
|
-
"@vuepress/markdown": "2.0.0-rc.
|
|
33
|
-
"@vuepress/shared": "2.0.0-rc.
|
|
34
|
-
"@vuepress/utils": "2.0.0-rc.
|
|
31
|
+
"@vuepress/client": "2.0.0-rc.3",
|
|
32
|
+
"@vuepress/markdown": "2.0.0-rc.3",
|
|
33
|
+
"@vuepress/shared": "2.0.0-rc.3",
|
|
34
|
+
"@vuepress/utils": "2.0.0-rc.3"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|