Skip to content

Commit

Permalink
Merge branch 'main' into slorber/upgrade-rspack
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Nov 14, 2024
2 parents baf1206 + 0c86355 commit b041714
Show file tree
Hide file tree
Showing 186 changed files with 648 additions and 373 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ packages/create-docusaurus/lib/*
packages/create-docusaurus/templates/facebook

website/_dogfooding/_swizzle_theme_tests
website/_dogfooding/_asset-tests/badSyntax.js
2 changes: 1 addition & 1 deletion .github/workflows/argos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: npx playwright install --with-deps chromium

- name: Build website fast
run: yarn build:website:fast --dev
run: yarn argos:build

- name: Take Argos screenshots
run: yarn argos:screenshot
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ website/static/katex/katex.min.css

website/changelog
website/_dogfooding/_swizzle_theme_tests
website/_dogfooding/_asset-tests/badSyntax.js
website/_dogfooding/_asset-tests/badSyntax.css
1 change: 1 addition & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ packages/docusaurus-*/lib/*
packages/create-docusaurus/lib/*
packages/create-docusaurus/templates/
website/static/katex/katex.min.css
website/_dogfooding/_asset-tests/badSyntax.css

jest/vendor
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# Docusaurus Changelog

## 3.6.1 (2024-11-08)

#### :bug: Bug Fix

- `docusaurus`
- [#10658](https://github.com/facebook/docusaurus/pull/10658) fix(core): bundler should not minimize static assets ([@slorber](https://github.com/slorber))
- `docusaurus-bundler`, `docusaurus-faster`, `docusaurus-utils-common`, `docusaurus-utils`
- [#10649](https://github.com/facebook/docusaurus/pull/10649) fix(faster,utils): fix faster/types peerDependencies ([@slorber](https://github.com/slorber))

#### :nail_care: Polish

- `docusaurus-bundler`, `docusaurus-types`, `docusaurus`
- [#10655](https://github.com/facebook/docusaurus/pull/10655) refactor(faster,bundler,core): improve js loader DX ([@slorber](https://github.com/slorber))

#### :memo: Documentation

- [#10657](https://github.com/facebook/docusaurus/pull/10657) docs: fix old base ts config ref ([@slorber](https://github.com/slorber))

#### :wrench: Maintenance

- `docusaurus-mdx-loader`
- [#10651](https://github.com/facebook/docusaurus/pull/10651) refactor(mdx-loader): streamline typescript usage for remark plugin types ([@lebalz](https://github.com/lebalz))
- Other
- [#10650](https://github.com/facebook/docusaurus/pull/10650) chore: Argos screenshot dogfooding test pages ([@slorber](https://github.com/slorber))

#### Committers: 2

- Balthasar Hofer ([@lebalz](https://github.com/lebalz))
- Sébastien Lorber ([@slorber](https://github.com/slorber))

## 3.6.0 (2024-11-04)

#### :rocket: New Feature
Expand Down
2 changes: 1 addition & 1 deletion admin/new.docusaurus.io/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.docusaurus.io",
"version": "3.6.0",
"version": "3.6.1",
"private": true,
"scripts": {
"start": "npx --package netlify-cli netlify dev"
Expand Down
2 changes: 1 addition & 1 deletion admin/test-bad-package/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "test-bad-package",
"version": "3.6.0",
"version": "3.6.1",
"private": true,
"dependencies": {
"@mdx-js/react": "1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion argos/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "argos",
"version": "3.6.0",
"version": "3.6.1",
"description": "Argos visual diff tests",
"license": "MIT",
"private": true,
Expand Down
29 changes: 29 additions & 0 deletions argos/tests/screenshot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,39 @@ function isBlacklisted(pathname: string) {
'/showcase',
// Long blog post with many image carousels, often timeouts
'/blog/2022/08/01/announcing-docusaurus-2.0',

// DOGFOOD TESTS
// React key errors:
'/tests/docs/tests/toc-partials',
// Console errors
'/tests/pages/diagrams',
'/tests/pages/markdown-tests-md',
'/tests/pages/react-18',
// Flaky because of hydration error
'/tests/blog/archive',
'/tests/docs/tests/custom-props',
'/tests/pages/code-block-tests',
'/tests/pages/embeds',
// Flaky because of hydration error with docusaurus serve + .html
'/tests/blog/x/y/z.html',
'/tests/docs/dummy.html',
// Cause weird docusaurus serve errors:
'/tests/docs/tests/ascii/%C3%A6%C3%B8%C3%A5',
'/tests/docs/tests/ascii/folder/%C3%A6%C3%B8%C3%A5',
];

return (
// changelog docs
pathname.startsWith('/changelog') ||
// versioned docs
pathname.match(/^\/docs\/((\d\.\d\.\d)|(next))\//) ||
// verbose useless dogfooding pages
pathname.startsWith('/tests/docs/toc/') ||
pathname.startsWith('/tests/docs/tags/') ||
pathname.startsWith('/tests/docs/tests/category-links') ||
pathname.startsWith('/tests/docs/tests/visibility') ||
pathname.startsWith('/tests/blog/page/') ||
pathname.startsWith('/tests/blog/tags/') ||
// manually excluded urls
BlacklistedPathnames.includes(pathname)
);
Expand Down Expand Up @@ -127,6 +153,9 @@ function throwOnConsole(page: Page) {
// on /docs/markdown-features/math-equations
'Failed to decode downloaded font: http://localhost:3000/katex/fonts/',
'OTS parsing error: Failed to convert WOFF 2.0 font to SFNT',

// Mermaid warning, see https://github.com/mermaid-js/mermaid/issues/6031
'Do not assign mappings to elements without corresponding data',
];

page.on('console', (message) => {
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.6.0",
"version": "3.6.1",
"npmClient": "yarn",
"useWorkspaces": true,
"useNx": false,
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
"crowdin:upload:website": "crowdin upload sources --config ./crowdin-v2.yaml",
"crowdin:download": "crowdin download --config ./crowdin-v2.yaml",
"crowdin:download:website": "yarn crowdin:download --language fr --language ko --language pt-BR --language zh-CN --language ja",
"argos": "yarn argos:build && yarn argos:screenshot",
"argos:build": "cross-env DOCUSAURUS_ARGOS_BUILD=true yarn build:website:fast --dev",
"argos:screenshot": "yarn workspace argos screenshot",
"canary": "yarn canary:bumpVersion && yarn canary:publish",
"canary:getCoreVersion": "node -p \"require('./packages/docusaurus/package.json').version\"",
Expand Down
6 changes: 3 additions & 3 deletions packages/create-docusaurus/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-docusaurus",
"version": "3.6.0",
"version": "3.6.1",
"description": "Create Docusaurus apps easily.",
"type": "module",
"repository": {
Expand All @@ -22,8 +22,8 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/logger": "3.6.0",
"@docusaurus/utils": "3.6.0",
"@docusaurus/logger": "3.6.1",
"@docusaurus/utils": "3.6.1",
"commander": "^5.1.0",
"fs-extra": "^11.1.1",
"lodash": "^4.17.21",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docusaurus-2-classic-typescript-template",
"version": "3.6.0",
"version": "3.6.1",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
Expand All @@ -15,18 +15,18 @@
"typecheck": "tsc"
},
"dependencies": {
"@docusaurus/core": "3.6.0",
"@docusaurus/preset-classic": "3.6.0",
"@docusaurus/core": "3.6.1",
"@docusaurus/preset-classic": "3.6.1",
"@mdx-js/react": "^3.0.0",
"clsx": "^2.0.0",
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.6.0",
"@docusaurus/tsconfig": "3.6.0",
"@docusaurus/types": "3.6.0",
"@docusaurus/module-type-aliases": "3.6.1",
"@docusaurus/tsconfig": "3.6.1",
"@docusaurus/types": "3.6.1",
"typescript": "~5.6.2"
},
"browserslist": {
Expand Down
10 changes: 5 additions & 5 deletions packages/create-docusaurus/templates/classic/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docusaurus-2-classic-template",
"version": "3.6.0",
"version": "3.6.1",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
Expand All @@ -14,17 +14,17 @@
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "3.6.0",
"@docusaurus/preset-classic": "3.6.0",
"@docusaurus/core": "3.6.1",
"@docusaurus/preset-classic": "3.6.1",
"@mdx-js/react": "^3.0.0",
"clsx": "^2.0.0",
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.6.0",
"@docusaurus/types": "3.6.0"
"@docusaurus/module-type-aliases": "3.6.1",
"@docusaurus/types": "3.6.1"
},
"browserslist": {
"production": [
Expand Down
6 changes: 3 additions & 3 deletions packages/docusaurus-babel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@docusaurus/babel",
"version": "3.6.0",
"version": "3.6.1",
"description": "Docusaurus package for Babel-related utils.",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand Down Expand Up @@ -38,8 +38,8 @@
"@babel/runtime": "^7.25.9",
"@babel/runtime-corejs3": "^7.25.9",
"@babel/traverse": "^7.25.9",
"@docusaurus/logger": "3.6.0",
"@docusaurus/utils": "3.6.0",
"@docusaurus/logger": "3.6.1",
"@docusaurus/utils": "3.6.1",
"babel-plugin-dynamic-import-node": "^2.3.3",
"fs-extra": "^11.1.1",
"tslib": "^2.6.0"
Expand Down
14 changes: 7 additions & 7 deletions packages/docusaurus-bundler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@docusaurus/bundler",
"version": "3.6.0",
"version": "3.6.1",
"description": "Docusaurus util package to abstract the current bundler.",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand All @@ -19,11 +19,11 @@
"license": "MIT",
"dependencies": {
"@babel/core": "^7.25.9",
"@docusaurus/babel": "3.6.0",
"@docusaurus/cssnano-preset": "3.6.0",
"@docusaurus/logger": "3.6.0",
"@docusaurus/types": "3.6.0",
"@docusaurus/utils": "3.6.0",
"@docusaurus/babel": "3.6.1",
"@docusaurus/cssnano-preset": "3.6.1",
"@docusaurus/logger": "3.6.1",
"@docusaurus/types": "3.6.1",
"@docusaurus/utils": "3.6.1",
"autoprefixer": "^10.4.14",
"babel-loader": "^9.2.1",
"clean-css": "^5.3.2",
Expand All @@ -45,7 +45,7 @@
"webpackbar": "^6.0.1"
},
"peerDependencies": {
"@docusaurus/faster": "3.5.2"
"@docusaurus/faster": "*"
},
"peerDependenciesMeta": {
"@docusaurus/faster": {
Expand Down
64 changes: 55 additions & 9 deletions packages/docusaurus-bundler/src/loaders/__tests__/jsLoader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import {createJsLoaderFactory} from '../jsLoader';

import type {RuleSetRule} from 'webpack';

type SiteConfigSlice = Parameters<
typeof createJsLoaderFactory
>[0]['siteConfig'];

describe('createJsLoaderFactory', () => {
function testJsLoaderFactory(
siteConfig?: PartialDeep<
Parameters<typeof createJsLoaderFactory>[0]['siteConfig']
>,
) {
function testJsLoaderFactory(siteConfig?: {
webpack?: SiteConfigSlice['webpack'];
future?: PartialDeep<SiteConfigSlice['future']>;
}) {
return createJsLoaderFactory({
siteConfig: {
...siteConfig,
webpack: {
jsLoader: 'babel',
...siteConfig?.webpack,
},
webpack: siteConfig?.webpack,
future: fromPartial({
...siteConfig?.future,
experimental_faster: fromPartial({
Expand All @@ -43,6 +43,52 @@ describe('createJsLoaderFactory', () => {
);
});

it('createJsLoaderFactory accepts babel loader preset', async () => {
const createJsLoader = await testJsLoaderFactory({
webpack: {jsLoader: 'babel'},
});
expect(createJsLoader({isServer: true}).loader).toBe(
require.resolve('babel-loader'),
);
expect(createJsLoader({isServer: false}).loader).toBe(
require.resolve('babel-loader'),
);
});

it('createJsLoaderFactory accepts custom loader', async () => {
const createJsLoader = await testJsLoaderFactory({
webpack: {
jsLoader: (isServer) => {
return {loader: `my-loader-${isServer ? 'server' : 'client'}`};
},
},
});
expect(createJsLoader({isServer: true}).loader).toBe('my-loader-server');
expect(createJsLoader({isServer: false}).loader).toBe('my-loader-client');
});

it('createJsLoaderFactory rejects custom loader when using faster swc loader', async () => {
await expect(() =>
testJsLoaderFactory({
future: {
experimental_faster: {
swcJsLoader: true,
},
},
webpack: {
jsLoader: (isServer) => {
return {loader: `my-loader-${isServer ? 'server' : 'client'}`};
},
},
}),
).rejects.toThrowErrorMatchingInlineSnapshot(`
"You can't use siteConfig.webpack.jsLoader and siteConfig.future.experimental_faster.swcJsLoader at the same time.
To avoid any configuration ambiguity, you must make an explicit choice:
- If you want to use Docusaurus Faster and SWC (recommended), remove siteConfig.webpack.jsLoader
- If you want to use a custom JS loader, use siteConfig.future.experimental_faster.swcJsLoader: false"
`);
});

it('createJsLoaderFactory accepts loaders with preset', async () => {
const createJsLoader = await testJsLoaderFactory({
webpack: {jsLoader: 'babel'},
Expand Down
Loading

0 comments on commit b041714

Please sign in to comment.