@rspress/shared 2.0.0-rc.3 → 2.0.0-rc.4
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/649.js +1 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +15 -15
- package/dist/logger.js +1 -2
- package/dist/node-utils.d.ts +2 -2
- package/package.json +2 -2
package/dist/649.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { logger };
|
|
1
|
+
export { logger } from "@rsbuild/core";
|
package/dist/index.d.ts
CHANGED
|
@@ -245,7 +245,7 @@ export declare type NavItem = NavItemWithLink | NavItemWithChildren | NavItemWit
|
|
|
245
245
|
export declare interface NavItemWithChildren {
|
|
246
246
|
text?: string;
|
|
247
247
|
tag?: string;
|
|
248
|
-
items:
|
|
248
|
+
items: NavItem[];
|
|
249
249
|
position?: 'left' | 'right';
|
|
250
250
|
}
|
|
251
251
|
|
|
@@ -260,7 +260,7 @@ export declare type NavItemWithLink = {
|
|
|
260
260
|
export declare interface NavItemWithLinkAndChildren {
|
|
261
261
|
text: string;
|
|
262
262
|
link: string;
|
|
263
|
-
items:
|
|
263
|
+
items: NavItem[];
|
|
264
264
|
tag?: string;
|
|
265
265
|
activeMatch?: string;
|
|
266
266
|
position?: 'left' | 'right';
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
const matchSidebar = (pattern, currentPathname)=>{
|
|
2
|
-
if (pattern === currentPathname) return true;
|
|
3
|
-
if (currentPathname.startsWith(pattern)) return true;
|
|
4
|
-
const prefixWithDot = `${pattern}.`;
|
|
5
|
-
return currentPathname.startsWith(prefixWithDot);
|
|
6
|
-
};
|
|
7
|
-
const getSidebarDataGroup = (sidebar, currentPathname)=>{
|
|
8
|
-
const navRoutes = Object.keys(sidebar).sort((a, b)=>b.length - a.length);
|
|
9
|
-
for (const name of navRoutes)if (matchSidebar(name, currentPathname)) {
|
|
10
|
-
const sidebarGroup = sidebar[name];
|
|
11
|
-
return sidebarGroup;
|
|
12
|
-
}
|
|
13
|
-
return [];
|
|
14
|
-
};
|
|
15
|
-
const matchNavbar = (item, currentPathname)=>new RegExp(item.activeMatch || item.link).test(currentPathname);
|
|
16
1
|
const QUERY_REGEXP = /\?.*$/s;
|
|
17
2
|
const HASH_REGEXP = /#.*$/s;
|
|
18
3
|
const MDX_OR_MD_REGEXP = /\.mdx?$/;
|
|
@@ -160,4 +145,19 @@ function removeBase(url, base) {
|
|
|
160
145
|
if ('' === removedBaseUrl) return '/';
|
|
161
146
|
return removedBaseUrl;
|
|
162
147
|
}
|
|
148
|
+
const matchSidebar = (pattern, currentPathname)=>{
|
|
149
|
+
if (pattern === currentPathname) return true;
|
|
150
|
+
if (currentPathname.startsWith(pattern)) return true;
|
|
151
|
+
const prefixWithDot = `${pattern}.`;
|
|
152
|
+
return currentPathname.startsWith(prefixWithDot);
|
|
153
|
+
};
|
|
154
|
+
const getSidebarDataGroup = (sidebar, currentPathname)=>{
|
|
155
|
+
const navRoutes = Object.keys(sidebar).sort((a, b)=>b.length - a.length);
|
|
156
|
+
for (const name of navRoutes)if (matchSidebar(name, currentPathname)) {
|
|
157
|
+
const sidebarGroup = sidebar[name];
|
|
158
|
+
return sidebarGroup;
|
|
159
|
+
}
|
|
160
|
+
return [];
|
|
161
|
+
};
|
|
162
|
+
const matchNavbar = (item, currentPathname)=>new RegExp(item.activeMatch || normalizeHref(item.link, true)).test(currentPathname);
|
|
163
163
|
export { HASH_REGEXP, MDX_OR_MD_REGEXP, QUERY_REGEXP, RSPRESS_TEMP_DIR, SEARCH_INDEX_NAME, addLeadingSlash, addTrailingSlash, getSidebarDataGroup, inBrowser, isDataUrl, isDebugMode, isDevDebugMode, isExternalUrl, isProduction, matchNavbar, matchSidebar, normalizeHref, normalizePosixPath, parseUrl, removeBase, removeHash, removeLeadingSlash, removeTrailingSlash, replaceLang, replaceVersion, slash, utils_cleanUrl as cleanUrl, withBase, withoutLang };
|
package/dist/logger.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { logger } from "@rsbuild/core";
|
|
1
|
+
export { logger } from "./649.js";
|
package/dist/node-utils.d.ts
CHANGED
|
@@ -235,7 +235,7 @@ declare type NavItem = NavItemWithLink | NavItemWithChildren | NavItemWithLinkAn
|
|
|
235
235
|
declare interface NavItemWithChildren {
|
|
236
236
|
text?: string;
|
|
237
237
|
tag?: string;
|
|
238
|
-
items:
|
|
238
|
+
items: NavItem[];
|
|
239
239
|
position?: 'left' | 'right';
|
|
240
240
|
}
|
|
241
241
|
|
|
@@ -250,7 +250,7 @@ declare type NavItemWithLink = {
|
|
|
250
250
|
declare interface NavItemWithLinkAndChildren {
|
|
251
251
|
text: string;
|
|
252
252
|
link: string;
|
|
253
|
-
items:
|
|
253
|
+
items: NavItem[];
|
|
254
254
|
tag?: string;
|
|
255
255
|
activeMatch?: string;
|
|
256
256
|
position?: 'left' | 'right';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/shared",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/web-infra-dev/rspress.git",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"unified": "^11.0.5"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@rslib/core": "0.18.
|
|
42
|
+
"@rslib/core": "0.18.6",
|
|
43
43
|
"@types/lodash-es": "^4.17.12",
|
|
44
44
|
"@types/node": "^22.8.1",
|
|
45
45
|
"@types/react": "^19.2.7",
|