mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-06 04:42:40 +02:00
2 lines
No EOL
11 KiB
JavaScript
2 lines
No EOL
11 KiB
JavaScript
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([["27749"],{55701:function(e,n,r){r.d(n,{Z:()=>t});let t={tabItem:"tabItem_pnkT"}},93195:function(e,n,r){r.d(n,{Z:()=>t});let t={tabList:"tabList_Qoir",tabItem:"tabItem_AQgk"}},5759:function(e,n,r){r.d(n,{Z:()=>t});let t={apiTable:"apiTable_e8hp"}},76029:function(e,n,r){r.r(n),r.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>f,frontMatter:()=>u,metadata:()=>t,toc:()=>p});var t=r(85759),o=r(85893),a=r(80980),l=r(4575),s=r(54636),i=r(7450);let u={sidebar_position:7,slug:"/api/plugins/@docusaurus/plugin-rsdoctor"},c="\uD83D\uDCE6 plugin-rsdoctor",d={},p=[{value:"Installation",id:"installation",level:2},{value:"Configuration",id:"configuration",level:2},{value:"Example configuration",id:"ex-config",level:3}];function h(e){let n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,a.a)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"-plugin-rsdoctor",children:"\uD83D\uDCE6 plugin-rsdoctor"})}),"\n","\n",(0,o.jsxs)(n.p,{children:["A ",(0,o.jsx)(n.a,{href:"https://rsdoctor.dev/",children:"Rsdoctor"})," plugin can help you troubleshoot the bundling phase of your Docusaurus site, supporting both Webpack and Rspack."]}),"\n",(0,o.jsx)(n.admonition,{type:"tip",children:(0,o.jsx)(n.p,{children:"Use it to figure out which plugin or loader is slowing down the bundler, and focus your efforts on optimizing the bottleneck."})}),"\n",(0,o.jsx)(n.h2,{id:"installation",children:"Installation"}),"\n",(0,o.jsxs)(l.Z,{groupId:"npm2yarn",children:[(0,o.jsx)(s.Z,{value:"npm",children:(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-bash",children:"npm install --save @docusaurus/plugin-rsdoctor\n"})})}),(0,o.jsx)(s.Z,{value:"yarn",label:"Yarn",children:(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-bash",children:"yarn add @docusaurus/plugin-rsdoctor\n"})})}),(0,o.jsx)(s.Z,{value:"pnpm",label:"pnpm",children:(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-bash",children:"pnpm add @docusaurus/plugin-rsdoctor\n"})})}),(0,o.jsx)(s.Z,{value:"bun",label:"Bun",children:(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-bash",children:"bun add @docusaurus/plugin-rsdoctor\n"})})})]}),"\n",(0,o.jsx)(n.h2,{id:"configuration",children:"Configuration"}),"\n",(0,o.jsx)(n.p,{children:"Accepted fields:"}),"\n",(0,o.jsx)(i.Z,{children:(0,o.jsxs)(n.table,{children:[(0,o.jsx)(n.thead,{children:(0,o.jsxs)(n.tr,{children:[(0,o.jsx)(n.th,{children:"Name"}),(0,o.jsx)(n.th,{children:"Type"}),(0,o.jsx)(n.th,{children:"Default"}),(0,o.jsx)(n.th,{children:"Description"})]})}),(0,o.jsx)(n.tbody,{children:(0,o.jsxs)(n.tr,{children:[(0,o.jsx)(n.td,{children:(0,o.jsx)(n.code,{children:"rsdoctorOptions"})}),(0,o.jsx)(n.td,{children:(0,o.jsx)(n.code,{children:"object"})}),(0,o.jsx)(n.td,{children:(0,o.jsx)(n.code,{children:"{}"})}),(0,o.jsxs)(n.td,{children:["The ",(0,o.jsx)(n.a,{href:"https://rsdoctor.dev/config/options/options",children:"Rsdoctor bundler plugin options"}),", forwarded as is"]})]})})]})}),"\n",(0,o.jsx)(n.h3,{id:"ex-config",children:"Example configuration"}),"\n",(0,o.jsx)(n.p,{children:"You can configure this plugin through plugin options."}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-js",metastring:'title="docusaurus.config.js"',children:"export default {\n plugins: [\n [\n 'rsdoctor',\n {\n rsdoctorOptions: {\n mode: 'lite',\n },\n },\n ],\n ],\n};\n"})})]})}function f(e={}){let{wrapper:n}={...(0,a.a)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},54636:function(e,n,r){r.d(n,{Z:()=>l});var t=r(85893);r(67294);var o=r(90496),a=r(55701);function l(e){let{children:n,hidden:r,className:l}=e;return(0,t.jsx)("div",{role:"tabpanel",className:(0,o.Z)(a.Z.tabItem,l),hidden:r,children:n})}},4575:function(e,n,r){r.d(n,{Z:()=>h});var t=r(85893),o=r(67294),a=r(90496),l=r(54947),s=r(30623),i=r(71607),u=r(93195);function c(e){let{className:n,block:r,selectedValue:o,selectValue:s,tabValues:i}=e,c=[],{blockElementScrollPositionUntilNextRender:d}=(0,l.o5)(),p=e=>{let n=e.currentTarget,r=i[c.indexOf(n)].value;r!==o&&(d(n),s(r))},h=e=>{let n=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{let r=c.indexOf(e.currentTarget)+1;n=c[r]??c[0];break}case"ArrowLeft":{let r=c.indexOf(e.currentTarget)-1;n=c[r]??c[c.length-1]}}n?.focus()};return(0,t.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,a.Z)("tabs",{"tabs--block":r},n),children:i.map(e=>{let{value:n,label:r,attributes:l}=e;return(0,t.jsx)("li",{role:"tab",tabIndex:o===n?0:-1,"aria-selected":o===n,ref:e=>{c.push(e)},onKeyDown:h,onClick:p,...l,className:(0,a.Z)("tabs__item",u.Z.tabItem,l?.className,{"tabs__item--active":o===n}),children:r??n},n)})})}function d(e){let{lazy:n,children:r,selectedValue:l}=e,s=(Array.isArray(r)?r:[r]).filter(Boolean);if(n){let e=s.find(e=>e.props.value===l);return e?(0,o.cloneElement)(e,{className:(0,a.Z)("margin-top--md",e.props.className)}):null}return(0,t.jsx)("div",{className:"margin-top--md",children:s.map((e,n)=>(0,o.cloneElement)(e,{key:n,hidden:e.props.value!==l}))})}function p(e){let n=(0,s.Y)(e);return(0,t.jsxs)("div",{className:(0,a.Z)("tabs-container",u.Z.tabList),children:[(0,t.jsx)(c,{...n,...e}),(0,t.jsx)(d,{...n,...e})]})}function h(e){let n=(0,i.Z)();return(0,t.jsx)(p,{...e,children:(0,s.h)(e.children)},String(n))}},30623:function(e,n,r){r.d(n,{Y:()=>d,h:()=>u});var t=r(67294),o=r(3620),a=r(844),l=r(97486),s=r(32263),i=r(16971);function u(e){return t.Children.toArray(e).filter(e=>"\n"!==e).map(e=>{if(!e||(0,t.isValidElement)(e)&&function(e){let{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)})?.filter(Boolean)??[]}function c(e){let{value:n,tabValues:r}=e;return r.some(e=>e.value===n)}function d(e){let{defaultValue:n,queryString:r=!1,groupId:d}=e,p=function(e){let{values:n,children:r}=e;return(0,t.useMemo)(()=>{let e=n??u(r).map(e=>{let{props:{value:n,label:r,attributes:t,default:o}}=e;return{value:n,label:r,attributes:t,default:o}}),t=(0,s.lx)(e,(e,n)=>e.value===n.value);if(t.length>0)throw Error(`Docusaurus error: Duplicate values "${t.map(e=>e.value).join(", ")}" found in <Tabs>. Every value needs to be unique.`);return e},[n,r])}(e),[h,f]=(0,t.useState)(()=>(function(e){let{defaultValue:n,tabValues:r}=e;if(0===r.length)throw Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!c({value:n,tabValues:r}))throw Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${r.map(e=>e.value).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}let t=r.find(e=>e.default)??r[0];if(!t)throw Error("Unexpected error: 0 tabValues");return t.value})({defaultValue:n,tabValues:p})),[g,b]=function(e){let{queryString:n=!1,groupId:r}=e,a=(0,o.k6)(),s=function(e){let{queryString:n=!1,groupId:r}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!r)throw Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return r??null}({queryString:n,groupId:r});return[(0,l._X)(s),(0,t.useCallback)(e=>{if(!s)return;let n=new URLSearchParams(a.location.search);n.set(s,e),a.replace({...a.location,search:n.toString()})},[s,a])]}({queryString:r,groupId:d}),[m,x]=function(e){let{groupId:n}=e,r=n?`docusaurus.tab.${n}`:null,[o,a]=(0,i.Nk)(r);return[o,(0,t.useCallback)(e=>{r&&a.set(e)},[r,a])]}({groupId:d}),j=(()=>{let e=g??m;return c({value:e,tabValues:p})?e:null})();return(0,a.Z)(()=>{j&&f(j)},[j]),{selectedValue:h,selectValue:(0,t.useCallback)(e=>{if(!c({value:e,tabValues:p}))throw Error(`Can't select invalid tab value=${e}`);f(e),b(e),x(e)},[b,x,p]),tabValues:p}}},7450:function(e,n,r){r.d(n,{Z:()=>u});var t=r(85893),o=r(67294),a=r(30576),l=r(3620),s=r(5759);let i=o.forwardRef(function(e,n){let{name:r,children:s}=e,i=function(e){let n=e;for(;(0,o.isValidElement)(n);)[n]=o.Children.toArray(n.props.children);if("string"!=typeof n)throw Error(`Could not extract APITable row name from JSX tree:
|
|
${JSON.stringify(e,null,2)}`);return n}(s),u=r?`${r}-${i}`:i,c=`#${u}`,d=(0,l.k6)();return(0,a.Z)().collectAnchor(u),(0,t.jsx)("tr",{id:u,tabIndex:0,ref:d.location.hash===c?n:void 0,onClick:e=>{let n="TD"===e.target.tagName.toUpperCase(),r=!!window.getSelection()?.toString();n&&!r&&d.push(c)},onKeyDown:e=>{"Enter"===e.key&&d.push(c)},children:s.props.children})});function u(e){let{children:n,name:r}=e;if("table"!==n.type)throw Error("Bad usage of APITable component.\nIt is probably that your Markdown table is malformed.\nMake sure to double-check you have the appropriate number of columns for each table row.");let[a,l]=o.Children.toArray(n.props.children),u=(0,o.useRef)(null);(0,o.useEffect)(()=>{u.current?.focus()},[u]);let c=o.Children.map(l.props.children,e=>(0,t.jsx)(i,{name:r,ref:u,children:e}));return(0,t.jsxs)("table",{className:s.Z.apiTable,children:[a,(0,t.jsx)("tbody",{children:c})]})}},80980:function(e,n,r){r.d(n,{Z:()=>s,a:()=>l});var t=r(67294);let o={},a=t.createContext(o);function l(e){let n=t.useContext(a);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:l(e.components),t.createElement(a.Provider,{value:n},e.children)}},85759:function(e){e.exports=JSON.parse('{"id":"api/plugins/plugin-rsdoctor","title":"\uD83D\uDCE6 plugin-rsdoctor","description":"A Rsdoctor plugin can help you troubleshoot the bundling phase of your Docusaurus site, supporting both Webpack and Rspack.","source":"@site/docs/api/plugins/plugin-rsdoctor.mdx","sourceDirName":"api/plugins","slug":"/api/plugins/@docusaurus/plugin-rsdoctor","permalink":"/docs/api/plugins/@docusaurus/plugin-rsdoctor","draft":false,"unlisted":false,"editUrl":"https://github.com/facebook/docusaurus/edit/main/website/docs/api/plugins/plugin-rsdoctor.mdx","tags":[],"version":"current","lastUpdatedBy":"S\xe9bastien Lorber","lastUpdatedAt":1748625776000,"sidebarPosition":7,"frontMatter":{"sidebar_position":7,"slug":"/api/plugins/@docusaurus/plugin-rsdoctor"},"sidebar":"api","previous":{"title":"\uD83D\uDCE6 plugin-google-gtag","permalink":"/docs/api/plugins/@docusaurus/plugin-google-gtag"},"next":{"title":"\uD83D\uDCE6 plugin-svgr","permalink":"/docs/api/plugins/@docusaurus/plugin-svgr"}}')}}]); |