@rspress/core 2.0.23 → 2.1.0-beta.2

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.
Files changed (181) hide show
  1. package/dist/cli/index.js +2 -2
  2. package/dist/{common-Qw-RoVFD.js → common-Bo3KCGim.js} +4 -1
  3. package/dist/config/loadConfigFile.js +1 -1
  4. package/dist/eject-theme/components/CdnTabs/index.test.tsx +71 -0
  5. package/dist/eject-theme/components/CdnTabs/index.tsx +175 -0
  6. package/dist/eject-theme/components/DocContent/index.tsx +0 -3
  7. package/dist/eject-theme/components/FallbackHeading/index.tsx +6 -1
  8. package/dist/eject-theme/components/Link/getHref.ts +1 -0
  9. package/dist/eject-theme/components/Link/index.tsx +9 -21
  10. package/dist/eject-theme/components/Link/useLinkNavigate.ts +43 -54
  11. package/dist/eject-theme/components/NavTitle/index.test.tsx +78 -0
  12. package/dist/eject-theme/components/NavTitle/index.tsx +9 -5
  13. package/dist/eject-theme/components/PackageManagerTabs/index.test.tsx +79 -1
  14. package/dist/eject-theme/components/PackageManagerTabs/index.tsx +25 -12
  15. package/dist/eject-theme/components/Search/NoSearchResult.scss +1 -2
  16. package/dist/eject-theme/components/Search/SearchPanel.scss +75 -63
  17. package/dist/eject-theme/components/Search/SuggestItem.scss +28 -41
  18. package/dist/eject-theme/components/Search/logic/providers/LocalProvider.ts +4 -1
  19. package/dist/eject-theme/components/Search/useSearchPanel.ts +103 -36
  20. package/dist/eject-theme/components/Sidebar/SidebarItem.scss +8 -0
  21. package/dist/eject-theme/components/Sidebar/SidebarSectionHeader.scss +3 -0
  22. package/dist/eject-theme/components/SocialLinks/GithubStars.test.tsx +4 -1
  23. package/dist/eject-theme/components/SocialLinks/GithubStars.tsx +1 -1
  24. package/dist/entry/worker.js +1 -1
  25. package/dist/index.d.ts +1 -1
  26. package/dist/node/PluginDriver.d.ts +5 -0
  27. package/dist/node/PluginDriver.js +17 -2
  28. package/dist/node/auto-nav-sidebar/index.js +1 -1
  29. package/dist/node/auto-nav-sidebar/locales.js +1 -1
  30. package/dist/node/auto-nav-sidebar/normalize.js +1 -1
  31. package/dist/node/auto-nav-sidebar/utils.js +1 -1
  32. package/dist/node/auto-nav-sidebar/walk.js +1 -1
  33. package/dist/node/constants.js +1 -1
  34. package/dist/node/eject.js +1 -1
  35. package/dist/node/initRsbuild.js +19 -7
  36. package/dist/node/llms.d.ts +1 -1
  37. package/dist/node/llms.js +2 -2
  38. package/dist/node/logger/hint.d.ts +1 -0
  39. package/dist/node/logger/hint.js +8 -2
  40. package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -0
  41. package/dist/node/mdx/remarkPlugins/link.js +1 -1
  42. package/dist/node/route/RoutePage.js +1 -1
  43. package/dist/node/route/RouteService.js +1 -1
  44. package/dist/node/route/extractPageData.js +1 -1
  45. package/dist/node/route/normalizeRoutePath.js +1 -1
  46. package/dist/node/runtimeModule/{DEFAULT_I18N_TEXT.d.ts → i18n/DEFAULT_I18N_TEXT.d.ts} +28 -0
  47. package/dist/node/runtimeModule/{DEFAULT_I18N_TEXT.js → i18n/DEFAULT_I18N_TEXT.js} +28 -0
  48. package/dist/node/runtimeModule/i18n/getI18nData.d.ts +11 -0
  49. package/dist/node/runtimeModule/{i18n.js → i18n/getI18nData.js} +35 -22
  50. package/dist/node/runtimeModule/i18n/rsbuildPlugin.d.ts +5 -0
  51. package/dist/node/runtimeModule/i18n/rsbuildPlugin.js +21 -0
  52. package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
  53. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
  54. package/dist/node/runtimeModule/searchHooks.js +2 -2
  55. package/dist/node/runtimeModule/siteData/createSiteData.d.ts +2 -1
  56. package/dist/node/runtimeModule/siteData/createSiteData.js +3 -3
  57. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.d.ts +2 -1
  58. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +3 -4
  59. package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +2 -2
  60. package/dist/node/serve.js +1 -1
  61. package/dist/node/sitemap.d.ts +7 -0
  62. package/dist/node/sitemap.js +86 -0
  63. package/dist/node/ssg/alternateLinks.js +1 -1
  64. package/dist/node/ssg/htmlFile.js +1 -1
  65. package/dist/node/ssg/renderHtmlTemplate.js +1 -1
  66. package/dist/node/ssg/renderPage.js +1 -1
  67. package/dist/node/ssg/renderPageWorker.js +1 -1
  68. package/dist/node/ssg/renderPages.js +2 -2
  69. package/dist/node/ssg/rsbuildPluginSSG.js +1 -1
  70. package/dist/node/ssg/ssgEnv.js +1 -1
  71. package/dist/node/ssg-md/llms/emitLlmsTxt.js +1 -1
  72. package/dist/node/ssg-md/llms/llmsTxt.js +1 -1
  73. package/dist/node/ssg-md/renderPage.js +5 -4
  74. package/dist/node/ssg-md/renderPages.js +2 -2
  75. package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
  76. package/dist/node/utils/checkLanguageParity.js +1 -1
  77. package/dist/node/utils/createHash.js +1 -1
  78. package/dist/node/utils/flattenMdxContent.js +1 -1
  79. package/dist/node/utils/getPageKey.js +1 -1
  80. package/dist/node/utils/reactAlias.js +6 -3
  81. package/dist/{a~0.js → p~0.js} +23 -18
  82. package/dist/runtime/App.js +20 -29
  83. package/dist/runtime/BrowserOnly.d.ts +1 -1
  84. package/dist/runtime/BrowserOnly.js +53 -20
  85. package/dist/runtime/ClientApp.d.ts +3 -2
  86. package/dist/runtime/ClientApp.js +31 -21
  87. package/dist/runtime/ErrorRoute.d.ts +1 -0
  88. package/dist/runtime/ErrorRoute.js +30 -0
  89. package/dist/runtime/NoSSR.d.ts +7 -3
  90. package/dist/runtime/NoSSR.js +30 -9
  91. package/dist/runtime/PageRoute.d.ts +2 -0
  92. package/dist/runtime/PageRoute.js +70 -0
  93. package/dist/runtime/createServerRouter.d.ts +4 -0
  94. package/dist/runtime/createServerRouter.js +17 -0
  95. package/dist/runtime/csrClientEntry.js +5 -2
  96. package/dist/runtime/hooks/useWebMcp.d.ts +36 -0
  97. package/dist/runtime/hooks/useWebMcp.js +80 -0
  98. package/dist/runtime/index.d.ts +6 -3
  99. package/dist/runtime/index.js +6 -5
  100. package/dist/runtime/initPageData.d.ts +0 -3
  101. package/dist/runtime/initPageData.js +9 -45
  102. package/dist/runtime/pageDataLoader.d.ts +11 -0
  103. package/dist/runtime/pageDataLoader.js +7 -0
  104. package/dist/runtime/react.d.ts +5 -0
  105. package/dist/runtime/react.js +4 -0
  106. package/dist/runtime/reactDom.d.ts +6 -0
  107. package/dist/runtime/reactDom.js +2 -1
  108. package/dist/runtime/socialLinks.d.ts +1 -0
  109. package/dist/runtime/socialLinks.js +3 -0
  110. package/dist/runtime/ssrClientEntry.js +14 -6
  111. package/dist/runtime/ssrMdServerEntry.js +10 -21
  112. package/dist/runtime/ssrServerEntry.js +10 -21
  113. package/dist/static/assets/package.json +58 -0
  114. package/dist/theme/assets/bun.js +101 -0
  115. package/dist/theme/assets/deno.js +15 -0
  116. package/dist/theme/assets/jsdelivr.js +53 -0
  117. package/dist/theme/{components/PackageManagerTabs/icons/Npm.js → assets/npm.js} +4 -4
  118. package/dist/theme/{components/PackageManagerTabs/icons/Pnpm.js → assets/pnpm.js} +4 -4
  119. package/dist/theme/assets/unpkg.js +15 -0
  120. package/dist/theme/assets/yarn.js +22 -0
  121. package/dist/theme/components/CdnTabs/index.d.ts +10 -0
  122. package/dist/theme/components/CdnTabs/index.js +146 -0
  123. package/dist/theme/components/DocContent/index.js +1 -2
  124. package/dist/theme/components/FallbackHeading/index.js +1 -0
  125. package/dist/theme/components/Link/index.js +4 -17
  126. package/dist/theme/components/Link/useLinkNavigate.d.ts +2 -2
  127. package/dist/theme/components/Link/useLinkNavigate.js +22 -36
  128. package/dist/theme/components/NavTitle/index.js +10 -5
  129. package/dist/theme/components/PackageManagerTabs/index.d.ts +2 -0
  130. package/dist/theme/components/PackageManagerTabs/index.js +22 -12
  131. package/dist/theme/components/Search/NoSearchResult.css +1 -2
  132. package/dist/theme/components/Search/SearchPanel.css +72 -51
  133. package/dist/theme/components/Search/SuggestItem.css +21 -34
  134. package/dist/theme/components/Search/logic/providers/LocalProvider.js +4 -1
  135. package/dist/theme/components/Search/useSearchPanel.js +74 -26
  136. package/dist/theme/components/Sidebar/SidebarItem.css +5 -0
  137. package/dist/theme/components/Sidebar/SidebarSectionHeader.css +1 -0
  138. package/dist/theme/components/SocialLinks/GithubStars.js +1 -1
  139. package/dist/theme/hooks/useDynamicToc.js +27 -34
  140. package/dist/theme/hooks/useWebMcpNavigation.d.ts +6 -0
  141. package/dist/theme/hooks/useWebMcpNavigation.js +123 -0
  142. package/dist/theme/hooks/useWebMcpPageList.d.ts +6 -0
  143. package/dist/theme/hooks/useWebMcpPageList.js +25 -0
  144. package/dist/theme/hooks/useWebMcpPageReading.d.ts +7 -0
  145. package/dist/theme/hooks/useWebMcpPageReading.js +23 -0
  146. package/dist/theme/hooks/useWebMcpSiteInfo.d.ts +6 -0
  147. package/dist/theme/hooks/useWebMcpSiteInfo.js +22 -0
  148. package/dist/theme/icons.d.ts +7 -0
  149. package/dist/theme/icons.js +15 -1
  150. package/dist/theme/index.d.ts +6 -2
  151. package/dist/theme/index.js +6 -2
  152. package/dist/theme/layout/ErrorLayout/index.css +52 -0
  153. package/dist/theme/layout/ErrorLayout/index.d.ts +8 -0
  154. package/dist/theme/layout/ErrorLayout/index.js +76 -0
  155. package/dist/theme/layout/Layout/index.js +1 -2
  156. package/dist/theme/webMcp/tools.d.ts +56 -0
  157. package/dist/theme/webMcp/tools.js +122 -0
  158. package/dist/theme/webMcp/types.d.ts +35 -0
  159. package/dist/theme/webMcp/types.js +0 -0
  160. package/dist/tinypool~0.js +19 -49
  161. package/dist/y~0.js +166 -0
  162. package/package.json +18 -18
  163. package/dist/b~0.js +0 -106
  164. package/dist/eject-theme/components/PackageManagerTabs/icons/Bun.tsx +0 -101
  165. package/dist/eject-theme/components/PackageManagerTabs/icons/Deno.tsx +0 -18
  166. package/dist/eject-theme/components/PackageManagerTabs/icons/Npm.tsx +0 -16
  167. package/dist/eject-theme/components/PackageManagerTabs/icons/Pnpm.tsx +0 -22
  168. package/dist/eject-theme/components/PackageManagerTabs/icons/Yarn.tsx +0 -18
  169. package/dist/node/runtimeModule/i18n.d.ts +0 -8
  170. package/dist/theme/components/PackageManagerTabs/icons/Bun.d.ts +0 -2
  171. package/dist/theme/components/PackageManagerTabs/icons/Bun.js +0 -137
  172. package/dist/theme/components/PackageManagerTabs/icons/Deno.d.ts +0 -2
  173. package/dist/theme/components/PackageManagerTabs/icons/Deno.js +0 -15
  174. package/dist/theme/components/PackageManagerTabs/icons/Npm.d.ts +0 -2
  175. package/dist/theme/components/PackageManagerTabs/icons/Pnpm.d.ts +0 -2
  176. package/dist/theme/components/PackageManagerTabs/icons/Yarn.d.ts +0 -2
  177. package/dist/theme/components/PackageManagerTabs/icons/Yarn.js +0 -22
  178. package/dist/theme/logic/useScrollAfterNav.d.ts +0 -5
  179. package/dist/theme/logic/useScrollAfterNav.js +0 -35
  180. package/dist/theme/logic/useScrollReset.d.ts +0 -5
  181. package/dist/theme/logic/useScrollReset.js +0 -12
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import type { BrowserUsable } from './reactDom.js';
3
+ type Use = <T>(usable: PromiseLike<T> | React.Context<T> | BrowserUsable) => T;
4
+ export declare const safeUse: Use | undefined;
5
+ export {};
@@ -0,0 +1,4 @@
1
+ import * as __rspack_external_react from "react";
2
+ const react = __rspack_external_react;
3
+ const safeUse = react.use ?? react.default?.use;
4
+ export { safeUse };
@@ -1,4 +1,9 @@
1
1
  type CrossOrigin = '' | 'anonymous' | 'use-credentials';
2
+ declare const browserUsable: unique symbol;
3
+ export interface BrowserUsable {
4
+ readonly [browserUsable]: never;
5
+ }
6
+ type Browser = (reason?: string | (() => unknown)) => BrowserUsable;
2
7
  type Preconnect = (href: string, options?: {
3
8
  crossOrigin?: CrossOrigin;
4
9
  }) => void;
@@ -14,6 +19,7 @@ type Preload = (href: string, options?: {
14
19
  referrerPolicy?: ReferrerPolicy;
15
20
  type?: string;
16
21
  }) => void;
22
+ export declare const safeBrowserOnly: Browser | undefined;
17
23
  export declare const safePreconnect: Preconnect | undefined;
18
24
  export declare const safePreload: Preload | undefined;
19
25
  export {};
@@ -1,5 +1,6 @@
1
1
  import * as __rspack_external_react_dom_20ef40a6 from "react-dom";
2
2
  const reactDOM = __rspack_external_react_dom_20ef40a6;
3
+ const safeBrowserOnly = reactDOM.browser ?? reactDOM.default?.browser;
3
4
  const safePreconnect = reactDOM.preconnect ?? reactDOM.default?.preconnect;
4
5
  const safePreload = reactDOM.preload ?? reactDOM.default?.preload;
5
- export { safePreconnect, safePreload };
6
+ export { safeBrowserOnly, safePreconnect, safePreload };
@@ -0,0 +1 @@
1
+ export declare const socialLinks: Record<string, string>;
@@ -0,0 +1,3 @@
1
+ import virtual_social_links from "virtual-social-links";
2
+ const socialLinks = virtual_social_links;
3
+ export { socialLinks };
@@ -1,19 +1,27 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { removeBase } from "@rspress/core/runtime";
3
3
  import { startTransition } from "react";
4
- import { hydrateRoot } from "react-dom/client";
5
- import { ClientApp } from "./ClientApp.js";
6
- import { initPageData, setCurrentPageData } from "./initPageData.js";
4
+ import { createRoot, hydrateRoot } from "react-dom/client";
5
+ import { ClientApp, createClientRouter } from "./ClientApp.js";
6
+ import { initPageData } from "./initPageData.js";
7
7
  import { redirectToCleanUrl } from "./route.js";
8
8
  async function renderInBrowser() {
9
9
  redirectToCleanUrl(window.location, window.history);
10
10
  const container = document.getElementById('__rspress_root');
11
11
  const pathname = removeBase(window.location.pathname);
12
- const initialPageData = await initPageData(pathname);
13
- setCurrentPageData(pathname, initialPageData);
12
+ let initialPageData;
13
+ try {
14
+ initialPageData = await initPageData(pathname);
15
+ } catch {
16
+ createRoot(container).render(/*#__PURE__*/ jsx(ClientApp, {
17
+ router: createClientRouter()
18
+ }));
19
+ return;
20
+ }
21
+ const router = createClientRouter(initialPageData);
14
22
  startTransition(()=>{
15
23
  hydrateRoot(container, /*#__PURE__*/ jsx(ClientApp, {
16
- initialPageData: initialPageData
24
+ router: router
17
25
  }), {
18
26
  onRecoverableError (error, errorInfo) {
19
27
  if (error instanceof Error) console.warn('hydrateRoot recoverable error:', error, errorInfo);
@@ -1,33 +1,22 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { PageContext, ThemeContext, pathnameToRouteService, removeTrailingSlash, withBase } from "@rspress/core/runtime";
2
+ import { ThemeContext } from "@rspress/core/runtime";
3
3
  import { UnheadProvider } from "@unhead/react/server";
4
4
  import { renderToMarkdownString } from "react-render-to-markdown";
5
- import { StaticRouter } from "react-router-dom";
6
- import { App } from "./App.js";
7
- import { initPageData } from "./initPageData.js";
5
+ import { StaticRouterProvider } from "virtual-react-router-server";
6
+ import { createServerRouter } from "./createServerRouter.js";
8
7
  const DEFAULT_THEME = 'light';
9
- async function preloadRoute(pathname) {
10
- const route = pathnameToRouteService(pathname);
11
- await route?.preload();
12
- }
13
8
  async function render(routePath, head) {
14
- const initialPageData = await initPageData(routePath);
15
- await preloadRoute(routePath);
9
+ const { router, context } = await createServerRouter(routePath);
16
10
  const appMd = await renderToMarkdownString(/*#__PURE__*/ jsx(ThemeContext.Provider, {
17
11
  value: {
18
12
  theme: DEFAULT_THEME
19
13
  },
20
- children: /*#__PURE__*/ jsx(PageContext.Provider, {
21
- value: {
22
- data: initialPageData
23
- },
24
- children: /*#__PURE__*/ jsx(StaticRouter, {
25
- location: withBase(routePath),
26
- basename: removeTrailingSlash(withBase('/')),
27
- children: /*#__PURE__*/ jsx(UnheadProvider, {
28
- value: head,
29
- children: /*#__PURE__*/ jsx(App, {})
30
- })
14
+ children: /*#__PURE__*/ jsx(UnheadProvider, {
15
+ value: head,
16
+ children: /*#__PURE__*/ jsx(StaticRouterProvider, {
17
+ router: router,
18
+ context: context,
19
+ hydrate: false
31
20
  })
32
21
  })
33
22
  }));
@@ -1,17 +1,12 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { PassThrough } from "node:stream";
3
3
  import { text as consumers_text } from "node:stream/consumers";
4
- import { PageContext, ThemeContext, pathnameToRouteService, removeTrailingSlash, withBase } from "@rspress/core/runtime";
4
+ import { ThemeContext } from "@rspress/core/runtime";
5
5
  import { UnheadProvider } from "@unhead/react/server";
6
6
  import { renderToPipeableStream } from "react-dom/server";
7
- import { StaticRouter } from "react-router-dom";
8
- import { App } from "./App.js";
9
- import { initPageData } from "./initPageData.js";
7
+ import { StaticRouterProvider } from "virtual-react-router-server";
8
+ import { createServerRouter } from "./createServerRouter.js";
10
9
  const DEFAULT_THEME = 'light';
11
- async function preloadRoute(pathname) {
12
- const route = pathnameToRouteService(pathname);
13
- await route?.preload();
14
- }
15
10
  function renderToHtml(app) {
16
11
  return new Promise((resolve, reject)=>{
17
12
  const passThrough = new PassThrough();
@@ -28,23 +23,17 @@ function renderToHtml(app) {
28
23
  });
29
24
  }
30
25
  async function render(routePath, head) {
31
- const initialPageData = await initPageData(routePath);
32
- await preloadRoute(routePath);
26
+ const { router, context } = await createServerRouter(routePath);
33
27
  const appHtml = await renderToHtml(/*#__PURE__*/ jsx(ThemeContext.Provider, {
34
28
  value: {
35
29
  theme: DEFAULT_THEME
36
30
  },
37
- children: /*#__PURE__*/ jsx(PageContext.Provider, {
38
- value: {
39
- data: initialPageData
40
- },
41
- children: /*#__PURE__*/ jsx(StaticRouter, {
42
- location: withBase(routePath),
43
- basename: removeTrailingSlash(withBase('/')),
44
- children: /*#__PURE__*/ jsx(UnheadProvider, {
45
- value: head,
46
- children: /*#__PURE__*/ jsx(App, {})
47
- })
31
+ children: /*#__PURE__*/ jsx(UnheadProvider, {
32
+ value: head,
33
+ children: /*#__PURE__*/ jsx(StaticRouterProvider, {
34
+ router: router,
35
+ context: context,
36
+ hydrate: false
48
37
  })
49
38
  })
50
39
  }));
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "tinypool",
3
+ "type": "module",
4
+ "version": "2.2.0",
5
+ "description": "A minimal and tiny Node.js Worker Thread Pool implementation, a fork of piscina, but with fewer features",
6
+ "license": "MIT",
7
+ "homepage": "https://github.com/tinylibs/tinypool#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/tinylibs/tinypool.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/tinylibs/tinypool/issues"
14
+ },
15
+ "keywords": [
16
+ "fast",
17
+ "worker threads",
18
+ "thread pool"
19
+ ],
20
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/index.d.ts",
23
+ "default": "./dist/index.js"
24
+ },
25
+ "./package.json": "./package.json"
26
+ },
27
+ "main": "./dist/index.js",
28
+ "module": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
30
+ "files": [
31
+ "dist"
32
+ ],
33
+ "engines": {
34
+ "node": "^20.0.0 || >=22.0.0"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "^20.12.8",
38
+ "clean-publish": "^3.4.4",
39
+ "eslint": "^9.4.0",
40
+ "eslint-config-prettier": "^9.1.0",
41
+ "eslint-plugin-prettier": "^5.1.3",
42
+ "eslint-plugin-unicorn": "^53.0.0",
43
+ "prettier": "^3.3.2",
44
+ "tsdown": "^0.11.3",
45
+ "typescript": "^5.4.5",
46
+ "typescript-eslint": "^7.13.0",
47
+ "vite": "^5.2.11",
48
+ "vitest": "^4.0.1"
49
+ },
50
+ "scripts": {
51
+ "test": "vitest",
52
+ "bench": "vitest bench",
53
+ "dev": "tsdown --watch ./src",
54
+ "build": "tsdown",
55
+ "lint": "eslint --max-warnings=0",
56
+ "typecheck": "tsc --noEmit"
57
+ }
58
+ }
@@ -0,0 +1,101 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgBun = (props)=>/*#__PURE__*/ jsxs("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: "1.2em",
6
+ height: "1.2em",
7
+ viewBox: "0 0 80 70",
8
+ ...props,
9
+ children: [
10
+ /*#__PURE__*/ jsx("path", {
11
+ d: "M71.09 20.74c-.16-.17-.33-.34-.5-.5s-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5A26.46 26.46 0 0 1 75.5 35.7c0 16.57-16.82 30.05-37.5 30.05-11.58 0-21.94-4.23-28.83-10.86l.5.5.5.5.5.5.5.5.5.5.5.5.5.5C19.55 65.3 30.14 69.75 42 69.75c20.68 0 37.5-13.48 37.5-30 0-7.06-3.04-13.75-8.41-19.01"
12
+ }),
13
+ /*#__PURE__*/ jsx("path", {
14
+ d: "M73 35.7c0 15.21-15.67 27.54-35 27.54S3 50.91 3 35.7C3 26.27 9 17.94 18.22 13S33.18 3 38 3s8.94 4.13 19.78 10C67 17.94 73 26.27 73 35.7",
15
+ style: {
16
+ fill: "#fbf0df"
17
+ }
18
+ }),
19
+ /*#__PURE__*/ jsx("path", {
20
+ d: "M73 35.7a21.7 21.7 0 0 0-.8-5.78c-2.73 33.3-43.35 34.9-59.32 24.94A40 40 0 0 0 38 63.24c19.3 0 35-12.35 35-27.54",
21
+ "data-name": "Bottom Shadow",
22
+ style: {
23
+ fill: "#f6dece"
24
+ }
25
+ }),
26
+ /*#__PURE__*/ jsx("path", {
27
+ d: "M24.53 11.17C29 8.49 34.94 3.46 40.78 3.45A9.3 9.3 0 0 0 38 3c-2.42 0-5 1.25-8.25 3.13-1.13.66-2.3 1.39-3.54 2.15-2.33 1.44-5 3.07-8 4.7C8.69 18.13 3 26.62 3 35.7v1.19c6.06-21.41 17.07-23.04 21.53-25.72",
28
+ "data-name": "Light Shine",
29
+ style: {
30
+ fill: "#fffefc"
31
+ }
32
+ }),
33
+ /*#__PURE__*/ jsx("path", {
34
+ d: "M35.12 5.53A16.41 16.41 0 0 1 29.49 18c-.28.25-.06.73.3.59 3.37-1.31 7.92-5.23 6-13.14-.08-.45-.67-.33-.67.08m2.27 0A16.24 16.24 0 0 1 39 19c-.12.35.31.65.55.36 2.19-2.8 4.1-8.36-1.62-14.36-.29-.26-.74.14-.54.49Zm2.76-.17A16.42 16.42 0 0 1 47 17.12a.33.33 0 0 0 .65.11c.92-3.49.4-9.44-7.17-12.53-.4-.16-.66.38-.33.62Zm-18.46 10.4a16.94 16.94 0 0 0 10.47-9c.18-.36.75-.22.66.18-1.73 8-7.52 9.67-11.12 9.45-.38.01-.37-.52-.01-.63",
35
+ style: {
36
+ fill: "#ccbea7",
37
+ fillRule: "evenodd"
38
+ }
39
+ }),
40
+ /*#__PURE__*/ jsx("path", {
41
+ d: "M38 65.75C17.32 65.75.5 52.27.5 35.7c0-10 6.18-19.33 16.53-24.92 3-1.6 5.57-3.21 7.86-4.62 1.26-.78 2.45-1.51 3.6-2.19C32 1.89 35 .5 38 .5s5.62 1.2 8.9 3.14c1 .57 2 1.19 3.07 1.87 2.49 1.54 5.3 3.28 9 5.27C69.32 16.37 75.5 25.69 75.5 35.7c0 16.57-16.82 30.05-37.5 30.05M38 3c-2.42 0-5 1.25-8.25 3.13-1.13.66-2.3 1.39-3.54 2.15-2.33 1.44-5 3.07-8 4.7C8.69 18.13 3 26.62 3 35.7c0 15.19 15.7 27.55 35 27.55S73 50.89 73 35.7c0-9.08-5.69-17.57-15.22-22.7-3.78-2-6.73-3.88-9.12-5.36-1.09-.67-2.09-1.29-3-1.84C42.63 4 40.42 3 38 3"
42
+ }),
43
+ /*#__PURE__*/ jsx("path", {
44
+ d: "M45.05 43a8.93 8.93 0 0 1-2.92 4.71 6.8 6.8 0 0 1-4 1.88A6.84 6.84 0 0 1 34 47.71 8.93 8.93 0 0 1 31.12 43a.72.72 0 0 1 .8-.81h12.34a.72.72 0 0 1 .79.81",
45
+ "data-name": "Background",
46
+ style: {
47
+ fill: "#b71422"
48
+ }
49
+ }),
50
+ /*#__PURE__*/ jsx("path", {
51
+ d: "M34 47.79a6.9 6.9 0 0 0 4.12 1.9 6.9 6.9 0 0 0 4.11-1.9 11 11 0 0 0 1-1.07 6.83 6.83 0 0 0-4.9-2.31 6.15 6.15 0 0 0-5 2.78c.23.21.43.41.67.6",
52
+ "data-name": "Background",
53
+ style: {
54
+ fill: "#ff6164"
55
+ }
56
+ }),
57
+ /*#__PURE__*/ jsx("path", {
58
+ d: "M34.16 47a5.36 5.36 0 0 1 4.19-2.08 6 6 0 0 1 4 1.69c.23-.25.45-.51.66-.77a7 7 0 0 0-4.71-1.93 6.36 6.36 0 0 0-4.89 2.36 10 10 0 0 0 .75.73",
59
+ "data-name": "Outline"
60
+ }),
61
+ /*#__PURE__*/ jsx("path", {
62
+ d: "M38.09 50.19a7.42 7.42 0 0 1-4.45-2 9.52 9.52 0 0 1-3.11-5.05 1.2 1.2 0 0 1 .26-1 1.41 1.41 0 0 1 1.13-.51h12.34a1.44 1.44 0 0 1 1.13.51 1.19 1.19 0 0 1 .25 1 9.52 9.52 0 0 1-3.11 5.05 7.42 7.42 0 0 1-4.44 2m-6.17-7.4c-.16 0-.2.07-.21.09a8.3 8.3 0 0 0 2.73 4.37A6.23 6.23 0 0 0 38.09 49a6.28 6.28 0 0 0 3.65-1.73 8.3 8.3 0 0 0 2.72-4.37.21.21 0 0 0-.2-.09Z",
63
+ "data-name": "Outline"
64
+ }),
65
+ /*#__PURE__*/ jsx("ellipse", {
66
+ cx: 53.22,
67
+ cy: 40.18,
68
+ "data-name": "Right Blush",
69
+ rx: 5.85,
70
+ ry: 3.44,
71
+ style: {
72
+ fill: "#febbd0"
73
+ }
74
+ }),
75
+ /*#__PURE__*/ jsx("ellipse", {
76
+ cx: 22.95,
77
+ cy: 40.18,
78
+ "data-name": "Left Bluch",
79
+ rx: 5.85,
80
+ ry: 3.44,
81
+ style: {
82
+ fill: "#febbd0"
83
+ }
84
+ }),
85
+ /*#__PURE__*/ jsx("path", {
86
+ d: "M25.7 38.8a5.51 5.51 0 1 0-5.5-5.51 5.51 5.51 0 0 0 5.5 5.51m24.77 0A5.51 5.51 0 1 0 45 33.29a5.5 5.5 0 0 0 5.47 5.51",
87
+ style: {
88
+ fillRule: "evenodd"
89
+ }
90
+ }),
91
+ /*#__PURE__*/ jsx("path", {
92
+ d: "M24 33.64a2.07 2.07 0 1 0-2.06-2.07A2.07 2.07 0 0 0 24 33.64m24.77 0a2.07 2.07 0 1 0-2.06-2.07 2.07 2.07 0 0 0 2.04 2.07Z",
93
+ style: {
94
+ fill: "#fff",
95
+ fillRule: "evenodd"
96
+ }
97
+ })
98
+ ]
99
+ });
100
+ var bun = SvgBun;
101
+ export default bun;
@@ -0,0 +1,15 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgDeno = (props)=>/*#__PURE__*/ jsx("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: "1em",
6
+ height: "1em",
7
+ viewBox: "0 0 24 24",
8
+ ...props,
9
+ children: /*#__PURE__*/ jsx("path", {
10
+ fill: "currentColor",
11
+ d: "M1.105 18.02A11.9 11.9 0 0 1 0 12.985q0-.698.078-1.376a12 12 0 0 1 .231-1.34A12 12 0 0 1 4.025 4.02a12 12 0 0 1 5.46-2.771 12 12 0 0 1 3.428-.23c1.452.112 2.825.477 4.077 1.05a12 12 0 0 1 2.78 1.774 12.02 12.02 0 0 1 4.053 7.078A12 12 0 0 1 24 12.985q0 .454-.036.914a12 12 0 0 1-.728 3.305 12 12 0 0 1-2.38 3.875c-1.33 1.357-3.02 1.962-4.43 1.936a4.4 4.4 0 0 1-2.724-1.024c-.99-.853-1.391-1.83-1.53-2.919a5 5 0 0 1 .128-1.518c.105-.38.37-1.116.76-1.437-.455-.197-1.04-.624-1.226-.829-.045-.05-.04-.13 0-.183a.155.155 0 0 1 .177-.053c.392.134.869.267 1.372.35.66.111 1.484.25 2.317.292 2.03.1 4.153-.813 4.812-2.627s.403-3.609-1.96-4.685-3.454-2.356-5.363-3.128c-1.247-.505-2.636-.205-4.06.582-3.838 2.121-7.277 8.822-5.69 15.032a.191.191 0 0 1-.315.19 12 12 0 0 1-1.25-1.634 12 12 0 0 1-.769-1.404M11.57 6.087c.649-.051 1.214.501 1.31 1.236.13.979-.228 1.99-1.41 2.013-1.01.02-1.315-.997-1.248-1.614.066-.616.574-1.575 1.35-1.635"
12
+ })
13
+ });
14
+ var deno = SvgDeno;
15
+ export default deno;
@@ -0,0 +1,53 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgJsdelivr = (props)=>/*#__PURE__*/ jsxs("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: "1em",
6
+ height: "1em",
7
+ viewBox: "0 0 32 34",
8
+ ...props,
9
+ children: [
10
+ /*#__PURE__*/ jsx("path", {
11
+ fill: "#BD483B",
12
+ d: "m15.817.338-3.106 11.038v11.143l3.106 11.143 3.195-11.143V11.376z"
13
+ }),
14
+ /*#__PURE__*/ jsx("path", {
15
+ fill: "#E64E3D",
16
+ d: "M15.817.338.432 5.88l2.186 20.492 13.199 7.29"
17
+ }),
18
+ /*#__PURE__*/ jsx("path", {
19
+ fill: "#BD483B",
20
+ d: "m15.817 33.662 13.269-7.365 2.482-20.49L15.817.338"
21
+ }),
22
+ /*#__PURE__*/ jsx("path", {
23
+ fill: "#FEC82F",
24
+ d: "M13.025 25.088a9.36 9.36 0 0 1-3.94-2.431l-.003-.002a9.342 9.342 0 0 1-2.238-3.814q.378.348.796.647.006.011.011.027-.005-.017-.011-.027a8.6 8.6 0 0 0 1.696.923q.267.105.542.195c.011.006.024.006.035.01q.049.018.097.033a1.7 1.7 0 0 0 1.39 1.504c.288 1.157.834 2.146 1.625 2.935M13.605 11.794c0 .324.088.627.243.883-1.25 1.753-2.108 3.656-2.479 5.539q-.062.314-.105.619c-.429.113-.79.393-1.016.762a.1.1 0 0 1-.035-.01c-.023-.006-.04-.014-.061-.021a7.157 7.157 0 0 1-2.796-1.715 7 7 0 0 1-.311-.332l-.041-.049-.115-.137-.047-.059q-.02-.026-.037-.045-.01-.014-.017-.023-.03-.035-.053-.068-.013-.018-.023-.029l-.004-.008c-.013-.014-.024-.033-.037-.049a4 4 0 0 1-.157-.225q-.015-.017-.025-.039l-.02-.027a9.338 9.338 0 0 1 2.227-6.703 9.36 9.36 0 0 1 4.299-2.847q.04.273.095.553c.192.967.513 1.942.949 2.898-.27.3-.434.698-.434 1.132M12.608 20.479a.89.89 0 0 1-.308.68.9.9 0 0 1-1.068.09.9.9 0 0 1-.342-.375.9.9 0 0 1-.089-.395.9.9 0 0 1 .377-.732.9.9 0 0 1 1.285.245.87.87 0 0 1 .145.487M16.209 11.794a.902.902 0 0 1-.902.905q-.066 0-.128-.006-.012-.004-.025-.006a.902.902 0 0 1 .153-1.794h.038a.907.907 0 0 1 .864.901"
25
+ }),
26
+ /*#__PURE__*/ jsx("path", {
27
+ fill: "#DF9C26",
28
+ d: "M25.183 16.143c0 .907-.129 1.782-.368 2.61a12.8 12.8 0 0 1-2.4-.914 1.7 1.7 0 0 0-.092-.975q.047-.044.095-.094a15 15 0 0 0 2.404-3.212 9.4 9.4 0 0 1 .361 2.585M24.313 12.196a11 11 0 0 1-.201.416 13.8 13.8 0 0 1-2.487 3.434 1.703 1.703 0 0 0-1.883.084 17 17 0 0 1-1.49-1.327 17 17 0 0 1-1.647-1.909 1.695 1.695 0 0 0 .168-1.964 16 16 0 0 1 3.917-2.788 9.4 9.4 0 0 1 3.623 4.054M21.649 17.503a.902.902 0 0 1-1.804.081q.017-.014.028-.022-.016-.01-.03-.023l-.001-.037a.907.907 0 0 1 1.165-.864.91.91 0 0 1 .642.865M21.884 18.767a1.7 1.7 0 0 1-2.088.151q-.059.039-.115.072a13.7 13.7 0 0 1-3.864 1.698v4.824a9.37 9.37 0 0 0 8.64-5.744 14 14 0 0 1-2.573-1.001"
29
+ }),
30
+ /*#__PURE__*/ jsx("path", {
31
+ fill: "#FEC82F",
32
+ d: "M15.817 20.688a11.7 11.7 0 0 1-2.385.367l-.128.008c-.151.41-.454.744-.839.94.245.909.688 1.698 1.319 2.327.524.524 1.162.92 1.891 1.18l.142.002z"
33
+ }),
34
+ /*#__PURE__*/ jsx("path", {
35
+ fill: "#DF9C26",
36
+ d: "M19.043 17.503q.001-.26.074-.498-.845-.66-1.625-1.442a18 18 0 0 1-1.675-1.934v5.946a12.9 12.9 0 0 0 3.321-1.511 1.7 1.7 0 0 1-.095-.561"
37
+ }),
38
+ /*#__PURE__*/ jsx("path", {
39
+ fill: "#FEC82F",
40
+ d: "M15.817 13.629c-.045-.059-.091-.113-.132-.174a1.716 1.716 0 0 1-1.015-.08c-1.134 1.606-1.912 3.341-2.25 5.049q-.048.243-.083.475c.477.195.848.596.996 1.092q.022-.005.046-.004c.809-.039 1.627-.18 2.438-.412z"
41
+ }),
42
+ /*#__PURE__*/ jsx("path", {
43
+ fill: "#DF9C26",
44
+ d: "M15.817 6.778v3.394q.073.023.145.055a17.2 17.2 0 0 1 3.573-2.681 9.3 9.3 0 0 0-3.718-.768"
45
+ }),
46
+ /*#__PURE__*/ jsx("path", {
47
+ fill: "#FEC82F",
48
+ d: "M15.817 6.778q-.914 0-1.773.168c.025.197.06.404.101.606.168.86.449 1.725.829 2.575q.16-.032.333-.033.266 0 .51.078z"
49
+ })
50
+ ]
51
+ });
52
+ var jsdelivr = SvgJsdelivr;
53
+ export default jsdelivr;
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- function Npm(props) {
3
- return /*#__PURE__*/ jsxs("svg", {
2
+ import "react";
3
+ const SvgNpm = (props)=>/*#__PURE__*/ jsxs("svg", {
4
4
  xmlns: "http://www.w3.org/2000/svg",
5
5
  width: "1em",
6
6
  height: "1em",
@@ -17,5 +17,5 @@ function Npm(props) {
17
17
  })
18
18
  ]
19
19
  });
20
- }
21
- export { Npm };
20
+ var npm = SvgNpm;
21
+ export default npm;
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- function Pnpm(props) {
3
- return /*#__PURE__*/ jsxs("svg", {
2
+ import "react";
3
+ const SvgPnpm = (props)=>/*#__PURE__*/ jsxs("svg", {
4
4
  xmlns: "http://www.w3.org/2000/svg",
5
5
  width: "1em",
6
6
  height: "1em",
@@ -17,5 +17,5 @@ function Pnpm(props) {
17
17
  })
18
18
  ]
19
19
  });
20
- }
21
- export { Pnpm };
20
+ var pnpm = SvgPnpm;
21
+ export default pnpm;
@@ -0,0 +1,15 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgUnpkg = (props)=>/*#__PURE__*/ jsx("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: "1em",
6
+ height: "1em",
7
+ fill: "currentColor",
8
+ viewBox: "0 0 24 24",
9
+ ...props,
10
+ children: /*#__PURE__*/ jsx("path", {
11
+ d: "M0 0v24h24V0zm4.322 2.977 4.37.002a.043.043 0 0 1 .044.04 9543 9543 0 0 1 0 9.165q0 1.126.09 1.957.057.505.287 1.03.503 1.153 1.715 1.405.94.195 1.893-.008c1.166-.248 1.813-1.268 1.96-2.404q.1-.77.1-2.018-.002-4.724.002-9.119 0-.05.049-.05h4.338a.033.033 0 0 1 .033.033v9.869c0 1.465-.17 2.918-.746 4.234-.777 1.775-2.323 2.836-4.195 3.211q-2.55.513-5.07-.013c-2.226-.465-3.808-1.828-4.46-4.03a10.2 10.2 0 0 1-.416-2.586 65 65 0 0 1-.029-1.88q-.003-4.555 0-8.801 0-.037.035-.037"
12
+ })
13
+ });
14
+ var unpkg = SvgUnpkg;
15
+ export default unpkg;
@@ -0,0 +1,22 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgYarn = (props)=>/*#__PURE__*/ jsx("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: "1em",
6
+ height: "1em",
7
+ viewBox: "0 0 128 128",
8
+ ...props,
9
+ children: /*#__PURE__*/ jsxs("g", {
10
+ fill: "#2c8ebb",
11
+ children: [
12
+ /*#__PURE__*/ jsx("path", {
13
+ d: "M99.24 80.71C94.9 80.76 91.1 83 87.89 85c-6 3.71-9 3.47-9 3.47l-.1-.17c-.41-.67 1.92-6.68-.69-13.84-2.82-7.83-7.3-9.72-6.94-10.32 1.53-2.59 5.36-6.7 6.89-14.36.91-4.64.67-12.28-1.39-16.28-.38-.74-3.78 1.24-3.78 1.24s-3.18-7.09-4.07-7.66c-2.87-1.84-6 7.61-6 7.61a14 14 0 0 0-11.71 4.5 9.64 9.64 0 0 1-3.85 2.27c-.41.14-.91.12-2.15 3.47-1.9 5.07 3.24 10.81 3.24 10.81s-6.13 4.33-8.4 9.72a24.8 24.8 0 0 0-1.75 11.68s-4.36 3.78-4.64 7.68a12.87 12.87 0 0 0 1.77 7.83 1.94 1.94 0 0 0 2.63.91s-2.9 3.38-.19 4.81c2.47 1.29 6.63 2 8.83-.19 1.6-1.6 1.92-5.17 2.51-6.63.14-.34.62.57 1.08 1a10 10 0 0 0 1.36 1s-3.9 1.68-2.3 5.51c.53 1.27 2.42 2.08 5.51 2.06 1.15 0 13.76-.72 17.12-1.53a4.33 4.33 0 0 0 2.61-1.46 63 63 0 0 0 15.49-7c4.74-3.09 6.68-3.93 10.51-4.84 3.16-.75 2.95-5.65-1.24-5.58"
14
+ }),
15
+ /*#__PURE__*/ jsx("path", {
16
+ d: "M64 2a62 62 0 1 0 62 62A62 62 0 0 0 64 2m37.3 87.83c-3.35.81-4.91 1.44-9.41 4.36a67 67 0 0 1-15.56 7.18 8.7 8.7 0 0 1-3.64 1.77c-3.81.93-16.88 1.63-17.91 1.63h-.24c-4 0-6.27-1.24-7.49-2.54-3.4 1.7-7.8 1-11-.69a5.55 5.55 0 0 1-3-3.9 6 6 0 0 1 0-2.06 6.7 6.7 0 0 1-.79-1A16.38 16.38 0 0 1 30 84.52c.29-3.73 2.87-7.06 4.55-8.83A28.6 28.6 0 0 1 36.61 64a26.8 26.8 0 0 1 6.82-9c-1.65-2.78-3.33-7.06-1.7-11.42 1.17-3.11 2.13-4.84 4.24-5.58a6.8 6.8 0 0 0 2.51-1.34A17.65 17.65 0 0 1 60.34 31c.19-.48.41-1 .65-1.46 1.6-3.4 3.3-5.31 5.29-6a4.88 4.88 0 0 1 4.4.5c.65.43 1.48 1 3.9 6a4.7 4.7 0 0 1 2.85-.1 3.8 3.8 0 0 1 2.39 1.94c2.47 4.74 2.8 13.19 1.72 18.62a33.8 33.8 0 0 1-5.84 13.31 25.7 25.7 0 0 1 5.77 9.43 25.4 25.4 0 0 1 1.41 10.41A29 29 0 0 0 86 81.91c3.06-1.89 7.68-4.74 13.19-4.81a6.62 6.62 0 0 1 7 5.7 6.35 6.35 0 0 1-4.89 7.03"
17
+ })
18
+ ]
19
+ })
20
+ });
21
+ var yarn = SvgYarn;
22
+ export default yarn;
@@ -0,0 +1,10 @@
1
+ export type CdnName = 'jsdelivr' | 'unpkg';
2
+ export type CdnTabsProps = {
3
+ /** Package name and version, e.g. `bootstrap@5`. */
4
+ package: string;
5
+ /** CSS and JavaScript asset paths within the package. */
6
+ files: ReadonlyArray<string>;
7
+ /** CDNs to display, in tab order. Defaults to jsDelivr and unpkg. */
8
+ cdns?: ReadonlyArray<CdnName>;
9
+ };
10
+ export declare function CdnTabs({ package: packageName, files, cdns, }: CdnTabsProps): string | import("react").JSX.Element;
@@ -0,0 +1,146 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { IconJsdelivr, IconUnpkg, SvgWrapper, Tab, Tabs, getCustomMDXComponent } from "@rspress/core/theme";
3
+ import { Fragment as external_react_Fragment, useMemo } from "react";
4
+ const DEFAULT_CDNS = [
5
+ 'jsdelivr',
6
+ 'unpkg'
7
+ ];
8
+ const CDN_INFO = {
9
+ jsdelivr: {
10
+ label: 'jsDelivr',
11
+ baseUrl: 'https://cdn.jsdelivr.net/npm/'
12
+ },
13
+ unpkg: {
14
+ label: 'unpkg',
15
+ baseUrl: 'https://unpkg.com/'
16
+ }
17
+ };
18
+ function encodePath(path) {
19
+ return path.split('/').map((segment)=>encodeURIComponent(segment).replace(/%40/gi, '@')).join('/');
20
+ }
21
+ function getAssetUrl(cdn, packageName, file) {
22
+ return `${CDN_INFO[cdn].baseUrl}${encodePath(packageName)}/${encodePath(file)}`;
23
+ }
24
+ function getAssetTags(cdn, packageName, files) {
25
+ return files.flatMap((file)=>{
26
+ const url = getAssetUrl(cdn, packageName, file);
27
+ if (file.toLowerCase().endsWith('.css')) return [
28
+ {
29
+ tag: 'link',
30
+ attributes: {
31
+ rel: 'stylesheet',
32
+ href: url
33
+ }
34
+ }
35
+ ];
36
+ if (file.toLowerCase().endsWith('.js')) return [
37
+ {
38
+ tag: "script",
39
+ attributes: {
40
+ src: url
41
+ }
42
+ }
43
+ ];
44
+ return [];
45
+ });
46
+ }
47
+ function getHtmlSnippet(tags) {
48
+ return tags.map(({ tag, attributes })=>{
49
+ const attrs = Object.entries(attributes).map(([name, value])=>`${name}="${value}"`).join(' ');
50
+ return 'link' === tag ? `<${tag} ${attrs} />` : `<${tag} ${attrs}></${tag}>`;
51
+ }).join('\n');
52
+ }
53
+ function CdnTabs({ package: packageName, files, cdns = DEFAULT_CDNS }) {
54
+ const Pre = useMemo(()=>getCustomMDXComponent().pre, [
55
+ getCustomMDXComponent
56
+ ]);
57
+ const tabs = cdns.map((cdn)=>({
58
+ cdn,
59
+ label: CDN_INFO[cdn].label,
60
+ tags: getAssetTags(cdn, packageName, files)
61
+ }));
62
+ if (import.meta.env.SSG_MD) return tabs.map(({ label, tags })=>`\n\`\`\`html [${label}]\n${getHtmlSnippet(tags)}\n\`\`\`\n`).join('');
63
+ return /*#__PURE__*/ jsx(Tabs, {
64
+ groupId: "cdn",
65
+ children: tabs.map(({ cdn, label, tags })=>/*#__PURE__*/ jsx(Tab, {
66
+ value: cdn,
67
+ label: /*#__PURE__*/ jsxs("span", {
68
+ style: {
69
+ display: 'flex',
70
+ alignItems: 'center',
71
+ gap: 6
72
+ },
73
+ children: [
74
+ /*#__PURE__*/ jsx(SvgWrapper, {
75
+ icon: 'jsdelivr' === cdn ? IconJsdelivr : IconUnpkg,
76
+ width: "1em",
77
+ height: "1em",
78
+ "aria-hidden": "true"
79
+ }),
80
+ label
81
+ ]
82
+ }),
83
+ children: /*#__PURE__*/ jsx(Pre, {
84
+ lang: "html",
85
+ className: "shiki css-variables",
86
+ style: {
87
+ backgroundColor: 'var(--shiki-background)',
88
+ color: 'var(--shiki-foreground)'
89
+ },
90
+ children: /*#__PURE__*/ jsx("code", {
91
+ style: {
92
+ whiteSpace: 'pre'
93
+ },
94
+ children: tags.map(({ tag, attributes }, index)=>/*#__PURE__*/ jsxs(external_react_Fragment, {
95
+ children: [
96
+ index > 0 ? '\n' : null,
97
+ /*#__PURE__*/ jsxs("span", {
98
+ className: "line",
99
+ children: [
100
+ '<',
101
+ /*#__PURE__*/ jsx("span", {
102
+ style: {
103
+ color: 'var(--shiki-token-keyword)'
104
+ },
105
+ children: tag
106
+ }),
107
+ Object.entries(attributes).map(([name, value])=>/*#__PURE__*/ jsxs(external_react_Fragment, {
108
+ children: [
109
+ ' ',
110
+ /*#__PURE__*/ jsx("span", {
111
+ style: {
112
+ color: 'var(--shiki-token-function)'
113
+ },
114
+ children: name
115
+ }),
116
+ '=',
117
+ /*#__PURE__*/ jsx("span", {
118
+ style: {
119
+ color: 'var(--shiki-token-string-expression)'
120
+ },
121
+ children: `"${value}"`
122
+ })
123
+ ]
124
+ }, name)),
125
+ 'link' === tag ? ' />' : /*#__PURE__*/ jsxs(Fragment, {
126
+ children: [
127
+ '></',
128
+ /*#__PURE__*/ jsx("span", {
129
+ style: {
130
+ color: 'var(--shiki-token-keyword)'
131
+ },
132
+ children: tag
133
+ }),
134
+ '>'
135
+ ]
136
+ })
137
+ ]
138
+ })
139
+ ]
140
+ }, index))
141
+ })
142
+ })
143
+ }, cdn))
144
+ });
145
+ }
146
+ export { CdnTabs };