docusaurus/assets/js/16f8f4fb.64a32edf.js
2024-10-23 11:59:30 +00:00

1 line
No EOL
15 KiB
JavaScript

"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([["12837"],{98171:function(e,t,n){n.d(t,{Z:function(){return r}});let r=n.p+"assets/images/social-card-8ca15c1adaeb77ca302178575136a0b6.png"},93837:function(e,t,n){n.d(t,{Z:function(){return r}});let r=n.p+"assets/images/social-card-8ca15c1adaeb77ca302178575136a0b6.png"},55665:function(e,t,n){n.r(t),n.d(t,{assets:function(){return l},contentTitle:function(){return i},default:function(){return u},frontMatter:function(){return a},metadata:function(){return r},toc:function(){return c}});var r=n(3813),s=n(24246),o=n(80980);n(14522),n(51118),n(39468);let a={title:"Docusaurus 3.2",authors:["slorber"],tags:["release"],image:"./img/social-card.png",date:new Date("2024-03-29T00:00:00.000Z")},i=void 0,l={image:n(98171).Z,authorsImageUrls:[void 0]},c=[{value:"Highlights",id:"highlights",level:2},{value:"Faster builds",id:"faster-builds",level:3},{value:"Faster Dev Server",id:"faster-dev-server",level:3},{value:"MDX partials table-of-contents",id:"mdx-partials-table-of-contents",level:3},{value:"Blog improvements",id:"blog-improvements",level:3},{value:"Sitemap lastmod",id:"sitemap-lastmod",level:3},{value:"Other changes",id:"other-changes",level:2}];function d(e){let t={a:"a",code:"code",h2:"h2",h3:"h3",img:"img",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.a)(),...e.components},{Details:r}=t;return!r&&function(e,t){throw Error("Expected "+(t?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Details",!0),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:["We are happy to announce ",(0,s.jsx)(t.strong,{children:"Docusaurus 3.2"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["The upgrade should be easy: as explained in our ",(0,s.jsx)(t.a,{href:"/community/release-process",children:"release process documentation"}),", minor versions respect ",(0,s.jsx)(t.a,{href:"https://semver.org/",children:"Semantic Versioning"}),"."]}),"\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.img,{alt:"Docusaurus blog post social card",src:n(93837).Z+"",width:"1200",height:"600"})}),"\n","\n",(0,s.jsx)(t.h2,{id:"highlights",children:"Highlights"}),"\n",(0,s.jsx)(t.h3,{id:"faster-builds",children:"Faster builds"}),"\n",(0,s.jsx)(t.p,{children:"We worked hard to reduce the time it takes to build a Docusaurus site in production mode."}),"\n",(0,s.jsx)(t.p,{children:"Between v3.1.0 and v3.2.0, several changes have been made, leading to significantly faster production builds for many sites."}),"\n",(0,s.jsxs)(t.p,{children:["Let's take an example. Our benchmark on the ",(0,s.jsx)(t.a,{href:"https://github.com/facebook/react-native-website/pull/4072",children:"React Native website upgrading to v3.2"})," reports the following results:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"\uD83D\uDD25 Cold builds: 95s \u27A1\uFE0F 66s (~30% faster)"}),"\n",(0,s.jsx)(t.li,{children:"\uD83D\uDD25 Incremental builds: 55s \u27A1\uFE0F 22s (~60% faster)"}),"\n"]}),"\n",(0,s.jsx)(t.p,{children:"The results will vary depending on your site's topology and the options you turned on, but we expect the largest sites will see the most significant improvements."}),"\n",(0,s.jsxs)(t.p,{children:["Note that this is only the beginning, and Docusaurus performance can still be significantly improved, notably the bundling time and the memory consumption. Track our ",(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/issues/4765",children:"performance issue"})," for upcoming improvements."]}),"\n",(0,s.jsxs)(r,{children:[(0,s.jsx)("summary",{children:"What is the difference between a cold build and an incremental build?"}),(0,s.jsxs)(t.p,{children:["A cold build is when the Docusaurus caches are empty, generally after running ",(0,s.jsx)(t.code,{children:"docusaurus clear"}),"."]}),(0,s.jsxs)(t.p,{children:["An incremental build happens when you run another time the ",(0,s.jsx)(t.code,{children:"docusaurus build"}),' command. Docusaurus automatically tries to "re-use" computations from former builds to make subsequent builds faster. In practice it\'s based on ',(0,s.jsx)(t.a,{href:"https://webpack.js.org/guides/build-performance/#persistent-cache",children:"Webpack persistent caching"}),". To enable incremental builds on your CI server, you can persist the ",(0,s.jsx)(t.code,{children:"node_modules/.cache"})," folder across builds."]})]}),"\n",(0,s.jsx)(t.h3,{id:"faster-dev-server",children:"Faster Dev Server"}),"\n",(0,s.jsx)(t.p,{children:"We also worked on improving the performance of the dev server, so that you can get a faster feedback when editing Markdown/MDX files."}),"\n",(0,s.jsx)(t.p,{children:"The way we initially implemented content reloading wasn't great. For example, editing a blog post file would also trigger a useless reload of the unrelated docs plugin. From now on, when editing a plugin's content, only that plugin will reload. It's hard to measure precisely the impact of this change, but I estimate edits should appear in your browser at least 50% faster \uD83D\uDD25."}),"\n",(0,s.jsx)(t.p,{children:"We plan to keep improving the speed of our dev server, with even more granular hot reloads, ensuring we don't run useless computations that would always keep giving the same result."}),"\n",(0,s.jsx)(t.h3,{id:"mdx-partials-table-of-contents",children:"MDX partials table-of-contents"}),"\n",(0,s.jsxs)(t.p,{children:["With ",(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9684",children:"#9684"}),", Docusaurus is now able to render headings coming from an imported partial into the table-of-contents."]}),"\n",(0,s.jsxs)(t.p,{children:["Docusaurus and MDX allows you to ",(0,s.jsx)(t.a,{href:"/docs/markdown-features/react#importing-markdown",children:"import one Markdown file into another"}),'. We usually call the imported Markdown file a "partial", and use the ',(0,s.jsx)(t.code,{children:"_"})," prefix so that this file does not lead to the creation of a new page."]}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-md",metastring:'title="myDoc.mdx"',children:"# My Doc\n\n## Doc heading\n\nContent is imported from another MDX file:\n\nimport ImportedDoc from './\\_importedDoc.mdx';\n\n<ImportedDoc />\n"})}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-md",metastring:'title="_myPartial.mdx"',children:"## Partial heading\n\nSome paragraph\n"})}),"\n",(0,s.jsxs)(t.p,{children:["Previously, the heading ",(0,s.jsx)(t.code,{children:"Partial heading"})," did not appear in the table-of-contents, but now it will!"]}),"\n",(0,s.jsx)(t.h3,{id:"blog-improvements",children:"Blog improvements"}),"\n",(0,s.jsx)(t.p,{children:"We improved the blog plugin with several new options to make it even more powerful and flexible:"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9912",children:"#9912"}),": you can now display the last update time and author of a blog post, a feature the docs plugin already had."]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9886",children:"#9886"}),": a new ",(0,s.jsx)(t.code,{children:"processBlogPosts"})," option allow you to filter/transform/sort blog posts."]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9838",children:"#9838"}),": a new ",(0,s.jsx)(t.code,{children:"pageBasePath"})," option allows you to customize the blog pagination URL segment (",(0,s.jsx)(t.code,{children:"/blog/page/2"}),")"]}),"\n"]}),"\n",(0,s.jsx)(t.h3,{id:"sitemap-lastmod",children:"Sitemap lastmod"}),"\n",(0,s.jsxs)(t.p,{children:["With ",(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9954",children:"#9954"}),", the sitemap plugin has a new ",(0,s.jsx)(t.code,{children:"lastmod"})," option that can now emit a ",(0,s.jsx)(t.code,{children:"<lastmod>"})," tag on the XML. The value is read from the Git history by default, but can be overridden with docs and blog ",(0,s.jsx)(t.code,{children:"last_update"})," front matter."]}),"\n",(0,s.jsxs)(t.p,{children:["We also made it possible to opt-out of emitting ",(0,s.jsx)(t.code,{children:"<priority>"})," and ",(0,s.jsx)(t.code,{children:"<frequency>"})," tags, which are generally ignored by crawlers (notably ",(0,s.jsx)(t.a,{href:"https://developers.google.com/search/blog/2023/06/sitemaps-lastmod-ping",children:"Google"}),")."]}),"\n",(0,s.jsx)(t.p,{children:"We recommend using the following sitemap plugin config, that will become the default in Docusaurus V4:"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",children:"{\n lastmod: 'date',\n priority: null,\n changefreq: null,\n}\n"})}),"\n",(0,s.jsx)(t.h2,{id:"other-changes",children:"Other changes"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9687",children:"#9687"}),": new Vercel Analytics plugin"]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9681",children:"#9681"})," and ",(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9442",children:"#9442"}),": ",(0,s.jsx)(t.code,{children:"docusaurus swizzle"})," and ",(0,s.jsx)(t.code,{children:"create-docusaurus"})," CLIs now ask users if they prefer to use TypeScript"]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9928",children:"#9928"}),": new Icelandic translation"]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9931",children:"#9928"}),": new ",(0,s.jsx)(t.code,{children:"allContentLoaded"})," plugin lifecycle (experimental)"]}),"\n"]}),"\n",(0,s.jsxs)(t.p,{children:["Check the ",(0,s.jsx)(t.strong,{children:(0,s.jsx)(t.a,{href:"/changelog/3.2.0",children:"3.2.0 changelog entry"})})," for an exhaustive list of changes."]})]})}function u(e={}){let{wrapper:t}={...(0,o.a)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},51118:function(e,t,n){n.d(t,{Z:function(){return o}});var r=n(24246);n(27378);var s=n(14522);function o(e){var t=e.url;return(0,r.jsx)("div",{style:{padding:10},children:(0,r.jsx)(s.Z,{url:t,style:{minWidth:"min(100%,45vw)",width:800,maxWidth:"100%",overflow:"hidden"},bodyStyle:{padding:0},children:(0,r.jsx)("iframe",{src:t,title:t,style:{display:"block",width:"100%",height:300}})})})}},14522:function(e,t,n){n.d(t,{Z:()=>p});var r=n("24246");n("27378");var s=n("90496");let o="browserWindow_my1Q",a="browserWindowHeader_jXSR",i="buttons_uHc7",l="browserWindowAddressBar_Pd8y",c="dot_giz1",d="browserWindowMenuIcon_Vhuh",u="bar_rrRL",h="browserWindowBody_Idgs";function p(e){var t,n,p=e.children,m=e.minHeight,g=e.url,f=e.style,b=e.bodyStyle;return(0,r.jsxs)("div",{className:o,style:(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,s,o;r=e,s=t,o=n[t],s in r?Object.defineProperty(r,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[s]=o})}return e}({},f),n=(n={minHeight:m},n),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t),children:[(0,r.jsxs)("div",{className:a,children:[(0,r.jsxs)("div",{className:i,children:[(0,r.jsx)("span",{className:c,style:{background:"#f25f58"}}),(0,r.jsx)("span",{className:c,style:{background:"#fbbe3c"}}),(0,r.jsx)("span",{className:c,style:{background:"#58cb42"}})]}),(0,r.jsx)("div",{className:(0,s.Z)(l,"text--truncate"),children:void 0===g?"http://localhost:3000":g}),(0,r.jsx)("div",{className:d,children:(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:u}),(0,r.jsx)("span",{className:u}),(0,r.jsx)("span",{className:u})]})})]}),(0,r.jsx)("div",{className:h,style:b,children:p})]})}},39468:function(e,t,n){n.d(t,{Z:function(){return a}});var r=n(24246),s=n(27378);function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function a(e){var t,n,a=e.children,i=e.message,l=e.cause;var c=(t=(0,s.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,s=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=s){var o=[],a=!0,i=!1;try{for(s=s.call(e);!(a=(n=s.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){i=!0,r=e}finally{try{!a&&null!=s.return&&s.return()}finally{if(i)throw r}}return o}}(t,2)||function(e,t){if(e){if("string"==typeof e)return o(e,t);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 o(e,t)}}(t,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=c[0],u=c[1];if(d)throw Error(void 0===i?"Boom!\nSomething bad happened, but you can try again!":i,{cause:l?Error(l):void 0});return(0,r.jsx)("button",{className:"button button--danger",type:"button",onClick:function(){return u(!0)},children:void 0===a?"Boom!":a})}},80980:function(e,t,n){n.d(t,{Z:function(){return i},a:function(){return a}});var r=n(27378);let s={},o=r.createContext(s);function a(e){let t=r.useContext(o);return r.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}},3813:function(e){e.exports=JSON.parse('{"permalink":"/blog/releases/3.2","editUrl":"https://github.com/facebook/docusaurus/edit/main/website/blog/releases/3.2/index.mdx","source":"@site/blog/releases/3.2/index.mdx","title":"Docusaurus 3.2","description":"We are happy to announce Docusaurus 3.2.","date":"2024-03-29T00:00:00.000Z","tags":[{"inline":false,"label":"Release","permalink":"/blog/tags/release","description":"Blog posts about Docusaurus\' new releases"}],"readingTime":3.475,"hasTruncateMarker":true,"authors":[{"name":"S\xe9bastien Lorber","title":"Docusaurus maintainer, This Week In React editor","url":"https://thisweekinreact.com","page":{"permalink":"/blog/authors/slorber"},"description":"A freelance React and React-Native developer near Paris and Docusaurus maintainer. Also runs ThisWeekInReact.com, a newsletter to stay updated with the React ecosystem.\\n","socials":{"x":"https://x.com/sebastienlorber","linkedin":"https://www.linkedin.com/in/sebastienlorber/","github":"https://github.com/slorber","newsletter":"https://thisweekinreact.com"},"imageURL":"https://github.com/slorber.png","key":"slorber"}],"frontMatter":{"title":"Docusaurus 3.2","authors":["slorber"],"tags":["release"],"image":"./img/social-card.png","date":"2024-03-29T00:00:00.000Z"},"unlisted":false,"lastUpdatedAt":1729684612000,"lastUpdatedBy":"S\xe9bastien Lorber","prevItem":{"title":"Docusaurus 3.3","permalink":"/blog/releases/3.3"},"nextItem":{"title":"Docusaurus 3.1","permalink":"/blog/releases/3.1"}}')}}]);