@vuepress/core
Advanced tools
Comparing version 2.0.0-beta.46 to 2.0.0-beta.47
@@ -5,2 +5,2 @@ import type { AppConfig, AppOptions } from '../types'; | ||
*/ | ||
export declare const resolveAppOptions: ({ base, lang, title, description, head, locales, source, dest, temp, cache, public: publicDir, host, port, open, templateDev, shouldPreload, shouldPrefetch, templateBuild, bundler, debug, markdown, pagePatterns, plugins, theme, }: AppConfig) => AppOptions; | ||
export declare const resolveAppOptions: ({ base, lang, title, description, head, locales, source, dest, temp, cache, public: publicDir, host, port, open, templateDev, shouldPreload, shouldPrefetch, templateBuild, bundler, debug, markdown, pagePatterns, permalinkPattern, plugins, theme, }: AppConfig) => AppOptions; |
@@ -18,3 +18,3 @@ "use strict"; | ||
// common config | ||
bundler, debug = false, markdown = {}, pagePatterns = ['**/*.md', '!.vuepress', '!node_modules'], plugins = [], theme, }) => ({ | ||
bundler, debug = false, markdown = {}, pagePatterns = ['**/*.md', '!.vuepress', '!node_modules'], permalinkPattern = null, plugins = [], theme, }) => ({ | ||
base, | ||
@@ -42,2 +42,3 @@ lang, | ||
pagePatterns, | ||
permalinkPattern, | ||
plugins, | ||
@@ -44,0 +45,0 @@ theme, |
@@ -65,2 +65,3 @@ "use strict"; | ||
const permalink = (0, resolvePagePermalink_1.resolvePagePermalink)({ | ||
app, | ||
frontmatter, | ||
@@ -67,0 +68,0 @@ slug, |
@@ -1,6 +0,7 @@ | ||
import type { PageFrontmatter } from '../types'; | ||
import type { App, PageFrontmatter } from '../types'; | ||
/** | ||
* Resolve page permalink from frontmatter / options / pattern | ||
*/ | ||
export declare const resolvePagePermalink: ({ frontmatter, slug, date, pathInferred, pathLocale, }: { | ||
export declare const resolvePagePermalink: ({ app, frontmatter, slug, date, pathInferred, pathLocale, }: { | ||
app: App; | ||
frontmatter: PageFrontmatter; | ||
@@ -7,0 +8,0 @@ slug: string; |
@@ -9,3 +9,3 @@ "use strict"; | ||
*/ | ||
const resolvePagePermalink = ({ frontmatter, slug, date, pathInferred, pathLocale, }) => { | ||
const resolvePagePermalink = ({ app, frontmatter, slug, date, pathInferred, pathLocale, }) => { | ||
// use permalink in frontmatter directly | ||
@@ -15,7 +15,5 @@ if ((0, shared_1.isString)(frontmatter.permalink)) { | ||
} | ||
// get permalink pattern from frontmatter or options | ||
const pattern = (0, shared_1.isString)(frontmatter.permalinkPattern) | ||
? frontmatter.permalinkPattern | ||
: null; | ||
if (!pattern) { | ||
// get permalink pattern | ||
const permalinkPattern = getPermalinkPattern({ app, frontmatter }); | ||
if (permalinkPattern === null) { | ||
return null; | ||
@@ -25,3 +23,3 @@ } | ||
const [year, month, day] = date.split('-'); | ||
const link = utils_1.path.join(pathLocale, pattern | ||
const link = utils_1.path.join(pathLocale, permalinkPattern | ||
.replace(/:year/, year) | ||
@@ -35,1 +33,13 @@ .replace(/:month/, month) | ||
exports.resolvePagePermalink = resolvePagePermalink; | ||
/** | ||
* Get permalink pattern from frontmatter or app options | ||
*/ | ||
const getPermalinkPattern = ({ app, frontmatter, }) => { | ||
if (frontmatter.permalinkPattern === null) { | ||
return null; | ||
} | ||
if ((0, shared_1.isString)(frontmatter.permalinkPattern)) { | ||
return frontmatter.permalinkPattern; | ||
} | ||
return app.options.permalinkPattern; | ||
}; |
@@ -18,2 +18,3 @@ import type { MarkdownOptions } from '@vuepress/markdown'; | ||
pagePatterns?: string[]; | ||
permalinkPattern?: string | null; | ||
bundler: Bundler; | ||
@@ -20,0 +21,0 @@ theme: Theme; |
{ | ||
"name": "@vuepress/core", | ||
"version": "2.0.0-beta.46", | ||
"version": "2.0.0-beta.47", | ||
"description": "Core package of VuePress", | ||
@@ -25,9 +25,9 @@ "keywords": [ | ||
"dependencies": { | ||
"@vuepress/client": "2.0.0-beta.46", | ||
"@vuepress/markdown": "2.0.0-beta.46", | ||
"@vuepress/shared": "2.0.0-beta.46", | ||
"@vuepress/utils": "2.0.0-beta.46", | ||
"@vuepress/client": "2.0.0-beta.47", | ||
"@vuepress/markdown": "2.0.0-beta.47", | ||
"@vuepress/shared": "2.0.0-beta.47", | ||
"@vuepress/utils": "2.0.0-beta.47", | ||
"gray-matter": "^4.0.3", | ||
"toml": "^3.0.0", | ||
"vue": "^3.2.35" | ||
"vue": "^3.2.36" | ||
}, | ||
@@ -34,0 +34,0 @@ "publishConfig": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87410
2495
+ Added@vuepress/client@2.0.0-beta.47(transitive)
+ Added@vuepress/markdown@2.0.0-beta.47(transitive)
+ Added@vuepress/shared@2.0.0-beta.47(transitive)
+ Added@vuepress/utils@2.0.0-beta.47(transitive)
- Removed@vuepress/client@2.0.0-beta.46(transitive)
- Removed@vuepress/markdown@2.0.0-beta.46(transitive)
- Removed@vuepress/shared@2.0.0-beta.46(transitive)
- Removed@vuepress/utils@2.0.0-beta.46(transitive)
Updatedvue@^3.2.36