@vuepress/core 2.0.0-rc.27 → 2.0.0-rc.29
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 +30 -4
- package/dist/index.js +24 -10
- package/package.json +20 -20
package/dist/index.d.ts
CHANGED
|
@@ -183,7 +183,7 @@ interface Hooks {
|
|
|
183
183
|
onInitialized: LifeCycleHook;
|
|
184
184
|
onPrepared: LifeCycleHook;
|
|
185
185
|
onWatched: LifeCycleHook<[watchers: Closable[], restart: () => Promise<void>]>;
|
|
186
|
-
onPageUpdated: LifeCycleHook<[type: 'create' | 'delete' | 'update',
|
|
186
|
+
onPageUpdated: LifeCycleHook<[type: 'create', newPage: Page, oldPage: null] | [type: 'delete', newPage: null, oldPage: Page] | [type: 'update', newPage: Page, oldPage: Page]>;
|
|
187
187
|
onGenerated: LifeCycleHook;
|
|
188
188
|
extendsMarkdownOptions: ExtendsHook<MarkdownOptions>;
|
|
189
189
|
extendsMarkdown: ExtendsHook<Markdown>;
|
|
@@ -322,6 +322,10 @@ interface ThemeObject extends Omit<PluginObject, 'multiple'> {
|
|
|
322
322
|
* Allow overriding default templateDev
|
|
323
323
|
*/
|
|
324
324
|
templateDev?: string;
|
|
325
|
+
/**
|
|
326
|
+
* Allow specifying user styles, which will be injected into client at the bottom
|
|
327
|
+
*/
|
|
328
|
+
userStyle?: string;
|
|
325
329
|
}
|
|
326
330
|
/**
|
|
327
331
|
* Resolved theme info
|
|
@@ -343,6 +347,10 @@ interface ThemeInfo {
|
|
|
343
347
|
* Default dev template
|
|
344
348
|
*/
|
|
345
349
|
templateDev?: string;
|
|
350
|
+
/**
|
|
351
|
+
* Allow specifying user styles, which will be injected into client at the bottom
|
|
352
|
+
*/
|
|
353
|
+
userStyle?: string;
|
|
346
354
|
}
|
|
347
355
|
//#endregion
|
|
348
356
|
//#region src/types/app/options.d.ts
|
|
@@ -405,7 +413,7 @@ interface AppConfigCommon extends Partial<SiteData$1> {
|
|
|
405
413
|
/**
|
|
406
414
|
* Patterns to match the markdown files as pages
|
|
407
415
|
*
|
|
408
|
-
* @default ['**\/*.md', '!.vuepress'
|
|
416
|
+
* @default ['**\/*.md', '!.vuepress']
|
|
409
417
|
*/
|
|
410
418
|
pagePatterns?: string[];
|
|
411
419
|
/**
|
|
@@ -414,6 +422,10 @@ interface AppConfigCommon extends Partial<SiteData$1> {
|
|
|
414
422
|
* @default null
|
|
415
423
|
*/
|
|
416
424
|
permalinkPattern?: string | null;
|
|
425
|
+
/**
|
|
426
|
+
* Allow specifying user styles, which will be injected into client at the bottom
|
|
427
|
+
*/
|
|
428
|
+
userStyle?: string | null;
|
|
417
429
|
/**
|
|
418
430
|
* Vuepress bundler
|
|
419
431
|
*
|
|
@@ -560,7 +572,18 @@ interface AppEnv {
|
|
|
560
572
|
/**
|
|
561
573
|
* Write temp file util
|
|
562
574
|
*/
|
|
563
|
-
|
|
575
|
+
interface AppWriteTemp {
|
|
576
|
+
(file: string, content: string): Promise<string>;
|
|
577
|
+
/**
|
|
578
|
+
* Clean up the internal write temp cache.
|
|
579
|
+
*
|
|
580
|
+
* This should be called when the dev server restarts
|
|
581
|
+
* to avoid stale cache and to release references to any
|
|
582
|
+
* in-memory write state so that pending write promises can
|
|
583
|
+
* complete and be garbage-collected naturally.
|
|
584
|
+
*/
|
|
585
|
+
cleanup: () => void;
|
|
586
|
+
}
|
|
564
587
|
//#endregion
|
|
565
588
|
//#region src/types/app/app.d.ts
|
|
566
589
|
/**
|
|
@@ -707,4 +730,7 @@ declare const createPage: (app: App, options: PageOptions) => Promise<Page>;
|
|
|
707
730
|
*/
|
|
708
731
|
declare const renderPageToVue: (app: App, page: Page) => string;
|
|
709
732
|
//#endregion
|
|
710
|
-
|
|
733
|
+
//#region src/constants.d.ts
|
|
734
|
+
declare const DEFAULT_IGNORE_PATTERNS: string[];
|
|
735
|
+
//#endregion
|
|
736
|
+
export { AliasHook, App, AppConfig, AppConfigBuild, AppConfigCommon, AppConfigDev, AppDir, AppDirFunction, AppEnv, AppOptions, AppPropertiesBase, AppPropertiesInitialized, AppWriteTemp, BuildApp, Bundler, BundlerOptions, ClientConfigFileHook, DEFAULT_IGNORE_PATTERNS, DefineHook, DevApp, ExtendsHook, type HeadAttrsConfig, type HeadConfig, type HeadTag, type HeadTagEmpty, type HeadTagNonEmpty, Hook, HookItem, HookQueue, Hooks, HooksExposed, HooksName, HooksNormalized, HooksResult, LifeCycleHook, type LocaleConfig, type LocaleData, Page, type PageData, type PageFrontmatter, type PageHeader, PageOptions, Plugin, PluginApi, PluginConfig, PluginFunction, PluginObject, type SiteData, type SiteLocaleConfig, Theme, ThemeFunction, ThemeInfo, ThemeObject, createBuildApp, createDevApp, createPage, preparePageChunk, prepareRoutes, renderPageToVue, resolveAppDir };
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ const prepareClientConfigs = async (app) => {
|
|
|
12
12
|
const clientConfigFiles = await app.pluginApi.hooks.clientConfigFile.process(app);
|
|
13
13
|
const content = `\
|
|
14
14
|
${clientConfigFiles.map((filePath, index) => `import * as clientConfig${index} from '${filePath}'`).join("\n")}
|
|
15
|
+
${app.options.userStyle ? `\nimport '${app.options.userStyle}'` : ""}
|
|
15
16
|
|
|
16
17
|
export const clientConfigs = [
|
|
17
18
|
${clientConfigFiles.map((_, index) => ` clientConfig${index},`).join("\n")}
|
|
@@ -513,6 +514,15 @@ const resolveAppMarkdown = async (app) => {
|
|
|
513
514
|
return markdown;
|
|
514
515
|
};
|
|
515
516
|
//#endregion
|
|
517
|
+
//#region src/constants.ts
|
|
518
|
+
const DEFAULT_IGNORE_PATTERNS = [
|
|
519
|
+
"**/node_modules",
|
|
520
|
+
"**/.yarn",
|
|
521
|
+
"**/.git",
|
|
522
|
+
"**/.svn",
|
|
523
|
+
"**/.hg"
|
|
524
|
+
];
|
|
525
|
+
//#endregion
|
|
516
526
|
//#region src/app/resolveAppPages.ts
|
|
517
527
|
const log$4 = debug("vuepress:core/app");
|
|
518
528
|
/**
|
|
@@ -524,7 +534,8 @@ const resolveAppPages = async (app) => {
|
|
|
524
534
|
log$4("resolveAppPages start");
|
|
525
535
|
const pageFilePaths = await tinyglobby.glob(app.options.pagePatterns, {
|
|
526
536
|
absolute: true,
|
|
527
|
-
cwd: app.dir.source()
|
|
537
|
+
cwd: app.dir.source(),
|
|
538
|
+
ignore: DEFAULT_IGNORE_PATTERNS
|
|
528
539
|
});
|
|
529
540
|
let hasNotFoundPage = false;
|
|
530
541
|
const pagesMap = {};
|
|
@@ -799,11 +810,7 @@ const require$1 = createRequire(import.meta.url);
|
|
|
799
810
|
*
|
|
800
811
|
* @internal
|
|
801
812
|
*/
|
|
802
|
-
const resolveAppOptions = ({ base = "/", lang = "en-US", title = "", description = "", head = [], locales = {}, source, dest = path.resolve(source, ".vuepress/dist"), temp = path.resolve(source, ".vuepress/.temp"), cache = path.resolve(source, ".vuepress/.cache"), public: publicDir = path.resolve(source, ".vuepress/public"), host = "0.0.0.0", port = 8080, open = false, templateDev = path.normalize(require$1.resolve("@vuepress/client/templates/dev.html")), shouldPreload = true, shouldPrefetch = true, templateBuild = path.normalize(require$1.resolve("@vuepress/client/templates/build.html")), templateBuildRenderer = templateRenderer, bundler, debug = false, markdown = {}, pagePatterns = [
|
|
803
|
-
"**/*.md",
|
|
804
|
-
"!.vuepress",
|
|
805
|
-
"!node_modules"
|
|
806
|
-
], permalinkPattern = null, plugins = [], theme }) => {
|
|
813
|
+
const resolveAppOptions = ({ base = "/", lang = "en-US", title = "", description = "", head = [], locales = {}, source, dest = path.resolve(source, ".vuepress/dist"), temp = path.resolve(source, ".vuepress/.temp"), cache = path.resolve(source, ".vuepress/.cache"), public: publicDir = path.resolve(source, ".vuepress/public"), host = "0.0.0.0", port = 8080, open = false, templateDev = path.normalize(require$1.resolve("@vuepress/client/templates/dev.html")), shouldPreload = true, shouldPrefetch = true, templateBuild = path.normalize(require$1.resolve("@vuepress/client/templates/build.html")), templateBuildRenderer = templateRenderer, bundler, debug = false, markdown = {}, pagePatterns = ["**/*.md", "!.vuepress"], permalinkPattern = null, userStyle = null, plugins = [], theme }) => {
|
|
807
814
|
locales["/"] ??= {
|
|
808
815
|
lang,
|
|
809
816
|
title,
|
|
@@ -834,6 +841,7 @@ const resolveAppOptions = ({ base = "/", lang = "en-US", title = "", description
|
|
|
834
841
|
markdown,
|
|
835
842
|
pagePatterns,
|
|
836
843
|
permalinkPattern,
|
|
844
|
+
userStyle,
|
|
837
845
|
plugins,
|
|
838
846
|
theme
|
|
839
847
|
};
|
|
@@ -875,7 +883,7 @@ const resolveAppVersion = () => {
|
|
|
875
883
|
*/
|
|
876
884
|
const resolveAppWriteTemp = (dir) => {
|
|
877
885
|
const cache = /* @__PURE__ */ new Map();
|
|
878
|
-
const writeTemp = async (file, content) => {
|
|
886
|
+
const writeTemp = (async (file, content) => {
|
|
879
887
|
const filePath = dir.temp(file);
|
|
880
888
|
const contentHash = hash(content);
|
|
881
889
|
let item = cache.get(filePath);
|
|
@@ -894,6 +902,9 @@ const resolveAppWriteTemp = (dir) => {
|
|
|
894
902
|
};
|
|
895
903
|
await item.current;
|
|
896
904
|
return filePath;
|
|
905
|
+
});
|
|
906
|
+
writeTemp.cleanup = () => {
|
|
907
|
+
cache.clear();
|
|
897
908
|
};
|
|
898
909
|
return writeTemp;
|
|
899
910
|
};
|
|
@@ -940,7 +951,8 @@ const resolveThemeInfo = (app, theme) => {
|
|
|
940
951
|
plugins: [...themeObject.plugins ?? [], themeObject],
|
|
941
952
|
templateBuild: themeObject.templateBuild,
|
|
942
953
|
templateBuildRenderer: themeObject.templateBuildRenderer,
|
|
943
|
-
templateDev: themeObject.templateDev
|
|
954
|
+
templateDev: themeObject.templateDev,
|
|
955
|
+
userStyle: themeObject.userStyle
|
|
944
956
|
};
|
|
945
957
|
if (!themeObject.extends) return themeInfo;
|
|
946
958
|
const parentThemeInfo = resolveThemeInfo(app, themeObject.extends);
|
|
@@ -948,7 +960,8 @@ const resolveThemeInfo = (app, theme) => {
|
|
|
948
960
|
plugins: [...parentThemeInfo.plugins, ...themeInfo.plugins],
|
|
949
961
|
templateBuild: themeObject.templateBuild ?? parentThemeInfo.templateBuild,
|
|
950
962
|
templateBuildRenderer: themeObject.templateBuildRenderer ?? parentThemeInfo.templateBuildRenderer,
|
|
951
|
-
templateDev: themeObject.templateDev ?? parentThemeInfo.templateDev
|
|
963
|
+
templateDev: themeObject.templateDev ?? parentThemeInfo.templateDev,
|
|
964
|
+
userStyle: themeObject.userStyle ?? parentThemeInfo.userStyle
|
|
952
965
|
};
|
|
953
966
|
};
|
|
954
967
|
//#endregion
|
|
@@ -963,6 +976,7 @@ const setupAppThemeAndPlugins = (app, config) => {
|
|
|
963
976
|
app.options.templateDev = config.templateDev ?? themeInfo.templateDev ?? app.options.templateDev;
|
|
964
977
|
app.options.templateBuild = config.templateBuild ?? themeInfo.templateBuild ?? app.options.templateBuild;
|
|
965
978
|
app.options.templateBuildRenderer = config.templateBuildRenderer ?? themeInfo.templateBuildRenderer ?? app.options.templateBuildRenderer;
|
|
979
|
+
app.options.userStyle = config.userStyle ?? themeInfo.userStyle ?? app.options.userStyle;
|
|
966
980
|
[...themeInfo.plugins, ...app.options.plugins].flat().forEach((plugin) => app.use(plugin));
|
|
967
981
|
};
|
|
968
982
|
//#endregion
|
|
@@ -990,4 +1004,4 @@ const createDevApp = (config) => {
|
|
|
990
1004
|
return app;
|
|
991
1005
|
};
|
|
992
1006
|
//#endregion
|
|
993
|
-
export { appInit, appPrepare, appUse, createAppDirFunction, createBaseApp, createBuildApp, createDevApp, createHookQueue, createPage, createPluginApi, createPluginApiHooks, createPluginApiRegisterHooks, inferPagePath, normalizeAliasDefineHook, normalizeClientConfigFileHook, parsePageContent, prepareClientConfigs, preparePageChunk, prepareRoutes, prepareSiteData, renderPageToVue, resolveAppDir, resolveAppEnv, resolveAppOptions, resolveAppPages, resolveAppSiteData, resolveAppVersion, resolveAppWriteTemp, resolvePageChunkInfo, resolvePageContent, resolvePageDate, resolvePageFilePath, resolvePageHtmlInfo, resolvePageLang, resolvePagePath, resolvePagePermalink, resolvePageRouteMeta, resolvePageSlug, resolvePluginObject, resolveThemeInfo };
|
|
1007
|
+
export { DEFAULT_IGNORE_PATTERNS, appInit, appPrepare, appUse, createAppDirFunction, createBaseApp, createBuildApp, createDevApp, createHookQueue, createPage, createPluginApi, createPluginApiHooks, createPluginApiRegisterHooks, inferPagePath, normalizeAliasDefineHook, normalizeClientConfigFileHook, parsePageContent, prepareClientConfigs, preparePageChunk, prepareRoutes, prepareSiteData, renderPageToVue, resolveAppDir, resolveAppEnv, resolveAppOptions, resolveAppPages, resolveAppSiteData, resolveAppVersion, resolveAppWriteTemp, resolvePageChunkInfo, resolvePageContent, resolvePageDate, resolvePageFilePath, resolvePageHtmlInfo, resolvePageLang, resolvePagePath, resolvePagePermalink, resolvePageRouteMeta, resolvePageSlug, resolvePluginObject, resolveThemeInfo };
|
package/package.json
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/core",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.29",
|
|
4
4
|
"description": "Core package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
6
|
+
"core",
|
|
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
|
-
"
|
|
18
|
-
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
19
22
|
"type": "module",
|
|
20
|
-
"exports": {
|
|
21
|
-
".": "./dist/index.js",
|
|
22
|
-
"./package.json": "./package.json"
|
|
23
|
-
},
|
|
24
23
|
"main": "./dist/index.js",
|
|
25
24
|
"module": "./dist/index.js",
|
|
26
25
|
"types": "./dist/index.d.ts",
|
|
27
|
-
"
|
|
28
|
-
"dist"
|
|
29
|
-
|
|
30
|
-
"dependencies": {
|
|
31
|
-
"vue": "^3.5.29",
|
|
32
|
-
"@vuepress/client": "2.0.0-rc.27",
|
|
33
|
-
"@vuepress/markdown": "2.0.0-rc.27",
|
|
34
|
-
"@vuepress/utils": "2.0.0-rc.27",
|
|
35
|
-
"@vuepress/shared": "2.0.0-rc.27"
|
|
26
|
+
"exports": {
|
|
27
|
+
".": "./dist/index.js",
|
|
28
|
+
"./package.json": "./package.json"
|
|
36
29
|
},
|
|
37
30
|
"publishConfig": {
|
|
38
31
|
"access": "public"
|
|
39
32
|
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"vue": "^3.5.34",
|
|
35
|
+
"@vuepress/client": "2.0.0-rc.29",
|
|
36
|
+
"@vuepress/markdown": "2.0.0-rc.29",
|
|
37
|
+
"@vuepress/shared": "2.0.0-rc.29",
|
|
38
|
+
"@vuepress/utils": "2.0.0-rc.29"
|
|
39
|
+
},
|
|
40
40
|
"tsdown": {
|
|
41
|
-
"entry": "./src/index.ts",
|
|
42
41
|
"dts": true,
|
|
42
|
+
"entry": "./src/index.ts",
|
|
43
|
+
"fixedExtension": false,
|
|
43
44
|
"format": "esm",
|
|
44
45
|
"target": "es2023",
|
|
45
|
-
"fixedExtension": false,
|
|
46
46
|
"tsconfig": "../../tsconfig.dts.json"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|