mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-19 03:02:30 +02:00
1 line
No EOL
14 KiB
JavaScript
1 line
No EOL
14 KiB
JavaScript
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([["27749"],{71602:function(e,r,n){n.r(r),n.d(r,{metadata:()=>t,contentTitle:()=>s,default:()=>h,assets:()=>d,toc:()=>p,frontMatter:()=>c});var t=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":1729178406000,"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-google-tag-manager","permalink":"/docs/api/plugins/@docusaurus/plugin-google-tag-manager"}}'),o=n("24246"),a=n("80980"),i=n("15398"),l=n("58636"),u=n("32240");let c={sidebar_position:7,slug:"/api/plugins/@docusaurus/plugin-rsdoctor"},s="\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 f(e){let r={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)(r.header,{children:(0,o.jsx)(r.h1,{id:"-plugin-rsdoctor",children:"\uD83D\uDCE6 plugin-rsdoctor"})}),"\n","\n",(0,o.jsxs)(r.p,{children:["A ",(0,o.jsx)(r.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)(r.admonition,{type:"tip",children:(0,o.jsx)(r.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)(r.h2,{id:"installation",children:"Installation"}),"\n",(0,o.jsxs)(i.Z,{groupId:"npm2yarn",children:[(0,o.jsx)(l.Z,{value:"npm",children:(0,o.jsx)(r.pre,{children:(0,o.jsx)(r.code,{className:"language-bash",children:"npm install --save @docusaurus/plugin-rsdoctor\n"})})}),(0,o.jsx)(l.Z,{value:"yarn",label:"Yarn",children:(0,o.jsx)(r.pre,{children:(0,o.jsx)(r.code,{className:"language-bash",children:"yarn add @docusaurus/plugin-rsdoctor\n"})})}),(0,o.jsx)(l.Z,{value:"pnpm",label:"pnpm",children:(0,o.jsx)(r.pre,{children:(0,o.jsx)(r.code,{className:"language-bash",children:"pnpm add @docusaurus/plugin-rsdoctor\n"})})})]}),"\n",(0,o.jsx)(r.h2,{id:"configuration",children:"Configuration"}),"\n",(0,o.jsx)(r.p,{children:"Accepted fields:"}),"\n",(0,o.jsx)(u.Z,{children:(0,o.jsxs)(r.table,{children:[(0,o.jsx)(r.thead,{children:(0,o.jsxs)(r.tr,{children:[(0,o.jsx)(r.th,{children:"Name"}),(0,o.jsx)(r.th,{children:"Type"}),(0,o.jsx)(r.th,{children:"Default"}),(0,o.jsx)(r.th,{children:"Description"})]})}),(0,o.jsx)(r.tbody,{children:(0,o.jsxs)(r.tr,{children:[(0,o.jsx)(r.td,{children:(0,o.jsx)(r.code,{children:"rsdoctorOptions"})}),(0,o.jsx)(r.td,{children:(0,o.jsx)(r.code,{children:"object"})}),(0,o.jsx)(r.td,{children:(0,o.jsx)(r.code,{children:"{}"})}),(0,o.jsxs)(r.td,{children:["The ",(0,o.jsx)(r.a,{href:"https://rsdoctor.dev/config/options/options",children:"Rsdoctor bundler plugin options"}),", forwarded as is"]})]})})]})}),"\n",(0,o.jsx)(r.h3,{id:"ex-config",children:"Example configuration"}),"\n",(0,o.jsx)(r.p,{children:"You can configure this plugin through plugin options."}),"\n",(0,o.jsx)(r.pre,{children:(0,o.jsx)(r.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 h(e={}){let{wrapper:r}={...(0,a.a)(),...e.components};return r?(0,o.jsx)(r,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},58636:function(e,r,n){n.d(r,{Z:()=>i});var t=n("24246");n("27378");var o=n("90496");let a="tabItem_pnkT";function i(e){var r=e.children,n=e.hidden,i=e.className;return(0,t.jsx)("div",{role:"tabpanel",className:(0,o.Z)(a,i),hidden:n,children:r})}},15398:function(e,r,n){n.d(r,{Z:()=>k});var t=n("24246"),o=n("27378"),a=n("90496"),i=n("54947"),l=n("3620"),u=n("844"),c=n("97486"),s=n("32263"),d=n("16971");function p(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=Array(r);n<r;n++)t[n]=e[n];return t}function f(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var n,t,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!r||a.length!==r);i=!0);}catch(e){l=!0,t=e}finally{try{!i&&null!=o.return&&o.return()}finally{if(l)throw t}}return a}}(e,r)||function(e,r){if(e){if("string"==typeof e)return p(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,r)}}(e,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e){var r,n;return null!==(n=null===(r=o.Children.toArray(e).filter(function(e){return"\n"!==e}).map(function(e){var r,n;if(!e||(0,o.isValidElement)(e)&&(r=e.props)&&(void 0===r?"undefined":(n=r)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)=="object"&&"value"in r)return e;throw Error("Docusaurus error: Bad <Tabs> child <".concat("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.'))}))||void 0===r?void 0:r.filter(Boolean))&&void 0!==n?n:[]}function b(e){var r=e.value;return e.tabValues.some(function(e){return e.value===r})}var g=n("71607");let v="tabList_Qoir",m="tabItem_AQgk";function y(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},t=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),t.forEach(function(r){var t,o,a;t=e,o=r,a=n[r],o in t?Object.defineProperty(t,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[o]=a})}return e}function j(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):(function(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n.push.apply(n,t)}return n})(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))}),e}function x(e){var r=e.className,n=e.block,o=e.selectedValue,l=e.selectValue,u=e.tabValues,c=[],s=(0,i.o5)().blockElementScrollPositionUntilNextRender,d=function(e){var r=e.currentTarget,n=u[c.indexOf(r)].value;n!==o&&(s(r),l(n))},p=function(e){var r=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":var n,t=c.indexOf(e.currentTarget)+1;r=null!==(n=c[t])&&void 0!==n?n:c[0];break;case"ArrowLeft":var o,a=c.indexOf(e.currentTarget)-1;r=null!==(o=c[a])&&void 0!==o?o:c[c.length-1]}null==r||r.focus()};return(0,t.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,a.Z)("tabs",{"tabs--block":n},r),children:u.map(function(e){var r=e.value,n=e.label,i=e.attributes;return(0,t.jsx)("li",j(y({role:"tab",tabIndex:o===r?0:-1,"aria-selected":o===r,ref:function(e){return c.push(e)},onKeyDown:p,onClick:d},i),{className:(0,a.Z)("tabs__item",m,null==i?void 0:i.className,{"tabs__item--active":o===r}),children:null!=n?n:r}),r)})})}function O(e){var r=e.lazy,n=e.children,i=e.selectedValue,l=(Array.isArray(n)?n:[n]).filter(Boolean);if(r){var u=l.find(function(e){return e.props.value===i});return u?(0,o.cloneElement)(u,{className:(0,a.Z)("margin-top--md",u.props.className)}):null}return(0,t.jsx)("div",{className:"margin-top--md",children:l.map(function(e,r){return(0,o.cloneElement)(e,{key:r,hidden:e.props.value!==i})})})}function w(e){var r=function(e){var r,n,t,a,i,p,g,v,m,y,j,x,O,w,k=e.defaultValue,S=e.queryString,P=e.groupId;var A=(n=(r=e).values,t=r.children,(0,o.useMemo)(function(){var e=null!=n?n:h(t).map(function(e){var r=e.props;return{value:r.value,label:r.label,attributes:r.attributes,default:r.default}});return!function(e){var r=(0,s.lx)(e,function(e,r){return e.value===r.value});if(r.length>0)throw Error('Docusaurus error: Duplicate values "'.concat(r.map(function(e){return e.value}).join(", "),'" found in <Tabs>. Every value needs to be unique.'))}(e),e},[n,t])),I=f((0,o.useState)(function(){return function(e){var r,n=e.defaultValue,t=e.tabValues;if(0===t.length)throw Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!b({value:n,tabValues:t}))throw Error('Docusaurus error: The <Tabs> has a defaultValue "'.concat(n,'" but none of its children has the corresponding value. Available values are: ').concat(t.map(function(e){return e.value}).join(", "),". If you intend to show no default tab, use defaultValue={null} instead."));return n}var o=null!==(r=t.find(function(e){return e.default}))&&void 0!==r?r:t[0];if(!o)throw Error("Unexpected error: 0 tabValues");return o.value}({defaultValue:k,tabValues:A})}),2),E=I[0],T=I[1];var D=f((i=(a={queryString:void 0!==S&&S,groupId:P}).queryString,p=a.groupId,g=(0,l.k6)(),v=function(e){var r=e.queryString,n=void 0!==r&&r,t=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)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 null!=t?t:null}({queryString:void 0!==i&&i,groupId:p}),[(0,c._X)(v),(0,o.useCallback)(function(e){if(!!v){var r,n,t=new URLSearchParams(g.location.search);t.set(v,e),g.replace((r=function(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},t=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),t.forEach(function(r){var t,o,a;t=e,o=r,a=n[r],o in t?Object.defineProperty(t,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[o]=a})}return e}({},g.location),n=(n={search:t.toString()},n),Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):(function(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n.push.apply(n,t)}return n})(Object(n)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))}),r))}},[v,g])]),2),N=D[0],C=D[1];var V=f((y=(m=({groupId:P}).groupId)?"docusaurus.tab.".concat(m):null,x=(j=f((0,d.Nk)(y),2))[0],O=j[1],[x,(0,o.useCallback)(function(e){if(!!y)O.set(e)},[y,O])]),2),Z=V[0],q=V[1];var _=b({value:w=null!=N?N:Z,tabValues:A})?w:null;return(0,u.Z)(function(){_&&T(_)},[_]),{selectedValue:E,selectValue:(0,o.useCallback)(function(e){if(!b({value:e,tabValues:A}))throw Error("Can't select invalid tab value=".concat(e));T(e),C(e),q(e)},[C,q,A]),tabValues:A}}(e);return(0,t.jsxs)("div",{className:(0,a.Z)("tabs-container",v),children:[(0,t.jsx)(x,y({},r,e)),(0,t.jsx)(O,y({},r,e))]})}function k(e){var r=(0,g.Z)();return(0,t.jsx)(w,j(y({},e),{children:h(e.children)}),String(r))}},32240:function(e,r,n){n.d(r,{Z:()=>d});var t=n("24246"),o=n("27378"),a=n("96700"),i=n("3620");let l="apiTable_e8hp";function u(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=Array(r);n<r;n++)t[n]=e[n];return t}function c(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var n,t,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!r||a.length!==r);i=!0);}catch(e){l=!0,t=e}finally{try{!i&&null!=o.return&&o.return()}finally{if(l)throw t}}return a}}(e,r)||function(e,r){if(e){if("string"==typeof e)return u(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,r)}}(e,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var s=o.forwardRef(function(e,r){var n=e.name,l=e.children,u=function(e){for(var r=e;(0,o.isValidElement)(r);)r=c(o.Children.toArray(r.props.children),1)[0];if("string"!=typeof r)throw Error("Could not extract APITable row name from JSX tree:\n".concat(JSON.stringify(e,null,2)));return r}(l),s=n?"".concat(n,"-").concat(u):u,d="#".concat(s),p=(0,i.k6)();return(0,a.Z)().collectAnchor(s),(0,t.jsx)("tr",{id:s,tabIndex:0,ref:p.location.hash===d?r:void 0,onClick:function(e){var r,n="TD"===e.target.tagName.toUpperCase(),t=!!(null===(r=window.getSelection())||void 0===r?void 0:r.toString());n&&!t&&p.push(d)},onKeyDown:function(e){"Enter"===e.key&&p.push(d)},children:l.props.children})});function d(e){var r=e.children,n=e.name;if("table"!==r.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.");var a=c(o.Children.toArray(r.props.children),2),i=a[0],u=a[1],d=(0,o.useRef)(null);(0,o.useEffect)(function(){var e;null===(e=d.current)||void 0===e||e.focus()},[d]);var p=o.Children.map(u.props.children,function(e){return(0,t.jsx)(s,{name:n,ref:d,children:e})});return(0,t.jsxs)("table",{className:l,children:[i,(0,t.jsx)("tbody",{children:p})]})}},80980:function(e,r,n){n.d(r,{Z:function(){return l},a:function(){return i}});var t=n(27378);let o={},a=t.createContext(o);function i(e){let r=t.useContext(a);return t.useMemo(function(){return"function"==typeof e?e(r):{...r,...e}},[r,e])}function l(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),t.createElement(a.Provider,{value:r},e.children)}}}]); |