@rspress/shared
Advanced tools
Comparing version
@@ -364,2 +364,9 @@ import type { loadConfig } from '@rsbuild/core'; | ||
/** | ||
* match the sidebar key in user config | ||
* @param pattern /zh/guide | ||
* @param currentPathname /base/zh/guide/getting-started | ||
*/ | ||
export declare const matchSidebar: (pattern: string, currentPathname: string, base: string) => boolean; | ||
export declare const MDX_OR_MD_REGEXP: RegExp; | ||
@@ -454,2 +461,3 @@ | ||
content: string; | ||
flattenContent?: string; | ||
_html: string; | ||
@@ -631,2 +639,6 @@ frontmatter: FrontMatterMeta; | ||
/** | ||
* Callback after routeService generated | ||
*/ | ||
routeServiceGenerated?: (routeService: any, isProd: boolean) => Promise<void> | void; | ||
/** | ||
* Add addition ssg routes, for dynamic routes. | ||
@@ -633,0 +645,0 @@ */ |
@@ -45,2 +45,3 @@ "use strict"; | ||
isSCM: ()=>isSCM, | ||
matchSidebar: ()=>matchSidebar, | ||
addTrailingSlash: ()=>addTrailingSlash, | ||
@@ -58,3 +59,3 @@ normalizeSlash: ()=>normalizeSlash, | ||
isDataUrl: ()=>isDataUrl, | ||
cleanUrl: ()=>runtime_utils_cleanUrl | ||
cleanUrl: ()=>utils_cleanUrl | ||
}); | ||
@@ -105,3 +106,3 @@ const QUERY_REGEXP = /\?.*$/s; | ||
const isDevDebugMode = ()=>'rspress-dev' === process.env.DEBUG; | ||
const runtime_utils_cleanUrl = (url)=>url.replace(HASH_REGEXP, '').replace(QUERY_REGEXP, ''); | ||
const utils_cleanUrl = (url)=>url.replace(HASH_REGEXP, '').replace(QUERY_REGEXP, ''); | ||
function slash(str) { | ||
@@ -220,2 +221,10 @@ return str.replace(/\\/g, '/'); | ||
} | ||
const matchSidebar = (pattern, currentPathname, base)=>{ | ||
const prefix = withBase(pattern, base); | ||
if (prefix === currentPathname) return true; | ||
const prefixWithTrailingSlash = addTrailingSlash(prefix); | ||
if (currentPathname.startsWith(prefixWithTrailingSlash)) return true; | ||
const prefixWithDot = `${prefix}.`; | ||
return currentPathname.startsWith(prefixWithDot); | ||
}; | ||
exports.APPEARANCE_KEY = __webpack_exports__.APPEARANCE_KEY; | ||
@@ -238,2 +247,3 @@ exports.DEFAULT_HIGHLIGHT_LANGUAGES = __webpack_exports__.DEFAULT_HIGHLIGHT_LANGUAGES; | ||
exports.isSCM = __webpack_exports__.isSCM; | ||
exports.matchSidebar = __webpack_exports__.matchSidebar; | ||
exports.normalizeHref = __webpack_exports__.normalizeHref; | ||
@@ -271,2 +281,3 @@ exports.normalizePosixPath = __webpack_exports__.normalizePosixPath; | ||
"isSCM", | ||
"matchSidebar", | ||
"normalizeHref", | ||
@@ -273,0 +284,0 @@ "normalizePosixPath", |
@@ -384,2 +384,3 @@ import type { MdxJsxAttribute } from 'mdast-util-mdx-jsx'; | ||
content: string; | ||
flattenContent?: string; | ||
_html: string; | ||
@@ -501,2 +502,6 @@ frontmatter: FrontMatterMeta; | ||
/** | ||
* Callback after routeService generated | ||
*/ | ||
routeServiceGenerated?: (routeService: any, isProd: boolean) => Promise<void> | void; | ||
/** | ||
* Add addition ssg routes, for dynamic routes. | ||
@@ -503,0 +508,0 @@ */ |
{ | ||
"name": "@rspress/shared", | ||
"version": "2.0.0-alpha.11", | ||
"version": "2.0.0-alpha-canary-202504162001", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
73561
2.07%2333
1.52%1
Infinity%