mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-28 17:57:48 +02:00
Compare commits
331 commits
Author | SHA1 | Date | |
---|---|---|---|
|
67924ca979 | ||
|
bf6f574383 | ||
|
730ce485ba | ||
|
5b944d6b64 | ||
|
ac0a6f7d5b | ||
|
72b8621515 | ||
|
535c1c9835 | ||
|
29d19a6884 | ||
|
387157205a | ||
|
e9dfecbce7 | ||
|
df5f465605 | ||
|
67248f8e66 | ||
|
e8e67e9b9e | ||
|
08467e5f51 | ||
|
abdd0c7995 | ||
|
979ae084a7 | ||
|
6215983cdd | ||
|
b7ba0b54fb | ||
|
31b279fea6 | ||
|
d28210d35b | ||
|
f6bdc3123b | ||
|
16e3002911 | ||
|
a05629eeb5 | ||
|
3176a2ccba | ||
|
c0f3755d51 | ||
|
dae29a2782 | ||
|
37d8844506 | ||
|
8881fd1a59 | ||
|
e64e0e7c96 | ||
|
43fdb825e8 | ||
|
fcee060f40 | ||
|
502b9007be | ||
|
3782244ce7 | ||
|
e88f1aaf96 | ||
|
1d4d17da18 | ||
|
b0b95ccff9 | ||
|
579bb5ad37 | ||
|
7d36e2a8ff | ||
|
39eded7b69 | ||
|
cb69b40c86 | ||
|
7cf94c03a4 | ||
|
fd51384cab | ||
|
549ab795c3 | ||
|
e2e85e6b50 | ||
|
15b0ef6d13 | ||
|
d33004da1e | ||
|
dec3bcbbd7 | ||
|
2976dfea72 | ||
|
4d3930f944 | ||
|
7f4a37949e | ||
|
a6ef3897e0 | ||
|
396deedba4 | ||
|
9d7ceec189 | ||
|
154c95c11c | ||
|
f31bfec3c9 | ||
|
ca035d8562 | ||
|
c10a18d51d | ||
|
e641568e7f | ||
|
5b848cb2f0 | ||
|
cdc3ba31d9 | ||
|
1a71b3863a | ||
|
871af414a5 | ||
|
75e5a00a66 | ||
|
af272bdefa | ||
|
a72a06ecb1 | ||
|
04f7972f32 | ||
|
45065e8d2b | ||
|
cd7875bf84 | ||
|
5331de2962 | ||
|
c5a793de9d | ||
|
cd2792775e | ||
|
3fde4a0d6a | ||
|
b76f0feadc | ||
|
0162f6abc6 | ||
|
801bc7f74a | ||
|
987eb1c6d2 | ||
|
f73d401d3a | ||
|
a0248ed404 | ||
|
3198de8c45 | ||
|
dee39835a1 | ||
|
7ca3aa5144 | ||
|
884f93eea8 | ||
|
3b72bb43db | ||
|
bc3445c344 | ||
|
78f44d0ae7 | ||
|
4d7a28963a | ||
|
8bc3e8a092 | ||
|
d025403f73 | ||
|
5dc472759f | ||
|
b6d9fe2843 | ||
|
98aab81388 | ||
|
042070cf9d | ||
|
9700d47d69 | ||
|
9df5aae6de | ||
|
67207bc5e5 | ||
|
e59355be76 | ||
|
fcc9e5c56a | ||
|
5a50522905 | ||
|
97690abc94 | ||
|
35259521e0 | ||
|
431526ecbc | ||
|
0df69844b6 | ||
|
c17b55b58f | ||
|
71d682c53b | ||
|
cacb973326 | ||
|
94a56fef08 | ||
|
1b44d7ae3c | ||
|
bdbdd5aff5 | ||
|
9800180f57 | ||
|
56ccf19063 | ||
|
43795fcabb | ||
|
cc97d66dbb | ||
|
e8ad3923ea | ||
|
e7a8c9db82 | ||
|
092238d0fa | ||
|
4a1ec52922 | ||
|
37184e581d | ||
|
e5ed9a3894 | ||
|
0f29a37b3a | ||
|
f196a1eb29 | ||
|
2565601af3 | ||
|
87a5ab9177 | ||
|
b5359db47e | ||
|
c5a6c26d94 | ||
|
9cefca42df | ||
|
91c0b5bf35 | ||
|
4966dce36e | ||
|
f9825af43e | ||
|
e9f0641620 | ||
|
01cad20b5a | ||
|
a995865314 | ||
|
df6f53a2f5 | ||
|
750edc78ff | ||
|
8098741245 | ||
|
1777b14566 | ||
|
fb7ad2c1bb | ||
|
ffdd415129 | ||
|
60499e2cdc | ||
|
fd43036ab8 | ||
|
8561826026 | ||
|
90e85e83a5 | ||
|
5344bc105e | ||
|
be7bace8bd | ||
|
644bc49862 | ||
|
e5bdb0b97d | ||
|
a53ddf6ae9 | ||
|
e6b7397253 | ||
|
e3c13291ac | ||
|
36fc11dccd | ||
|
33a35a4c65 | ||
|
2b8ddb9260 | ||
|
dfea969574 | ||
|
0c8635529e | ||
|
f1272788a4 | ||
|
d268a20a6f | ||
|
0c791fb4e9 | ||
|
ae46d110d1 | ||
|
bcfa3b1128 | ||
|
bdf55eda22 | ||
|
e32aa605ca | ||
|
1955002d3b | ||
|
5a883b4008 | ||
|
ed2cdf391f | ||
|
fce0884768 | ||
|
5cf2c39836 | ||
|
5c1ce0137c | ||
|
e7001060da | ||
|
a4fa4c27f1 | ||
|
a0aa7d8174 | ||
|
34f9a36a9d | ||
|
52e50d29bc | ||
|
d723a1ee46 | ||
|
87c19650ba | ||
|
3c8dc5bc15 | ||
|
85fd8f2871 | ||
|
c1349fe78c | ||
|
28f6a4907a | ||
|
4892f3ac4a | ||
|
35aa39bddb | ||
|
1a2b8b7d05 | ||
|
6eeab427bb | ||
|
d3f110cc03 | ||
|
dbdd254c51 | ||
|
776b3ee8c2 | ||
|
9457833df0 | ||
|
c9f231afb3 | ||
|
14579cbda8 | ||
|
c201fd56bb | ||
|
762f7b1927 | ||
|
24716787d3 | ||
|
f6a6ca899f | ||
|
904b53b963 | ||
|
97e6c42099 | ||
|
74c09aee35 | ||
|
c7fd8d1702 | ||
|
5400690108 | ||
|
912c4954d9 | ||
|
126d395f2d | ||
|
9e473bd080 | ||
|
05f3c203a2 | ||
|
5de4832fb2 | ||
|
7f6472a74d | ||
|
e8545b5280 | ||
|
0657e5806c | ||
|
0794ebdd18 | ||
|
c093dfdcc9 | ||
|
cba1e02772 | ||
|
3b7c8281d5 | ||
|
539412ef49 | ||
|
0692fe96b5 | ||
|
7d0345865b | ||
|
a5fd530ffc | ||
|
9ecff801ff | ||
|
fd14d6af55 | ||
|
ce159b1cfa | ||
|
95e2d469e3 | ||
|
a435fbd36e | ||
|
f1d4d55478 | ||
|
d6dcf16452 | ||
|
dd4fe63a3d | ||
|
2495d059de | ||
|
611842af91 | ||
|
3725dc37a0 | ||
|
1a70734c11 | ||
|
e8c6787ec2 | ||
|
5bab0b5432 | ||
|
897ebbe3ca | ||
|
a47e8dda2d | ||
|
3d69ff3d47 | ||
|
a4329d3388 | ||
|
2aef92cb9e | ||
|
200b38b763 | ||
|
02ed7d9132 | ||
|
95880282b1 | ||
|
d5885c0c5d | ||
|
db6c2af160 | ||
|
08da5c23fc | ||
|
c0b86f4e56 | ||
|
1b906a5726 | ||
|
bb90e35153 | ||
|
aa65f39d8c | ||
|
afd2374ca6 | ||
|
84c24127db | ||
|
418247ec87 | ||
|
349a58453a | ||
|
2b28b06f67 | ||
|
97bd815d9a | ||
|
1c56fa5830 | ||
|
473d1442b8 | ||
|
aba22afa18 | ||
|
bb499926a0 | ||
|
6652ed1443 | ||
|
2d55ca474e | ||
|
0b640ca3e2 | ||
|
3a0b4bf7a2 | ||
|
ae5328daac | ||
|
16a789904f | ||
|
655ce94c0f | ||
|
a1edf51003 | ||
|
221ced7242 | ||
|
685730ed32 | ||
|
140570bdc4 | ||
|
419d559fa7 | ||
|
547979a59f | ||
|
471f0d4333 | ||
|
e60de098a7 | ||
|
bde4414614 | ||
|
9c5eb35e51 | ||
|
584eec9ecf | ||
|
a56bd2edf4 | ||
|
daa6b87f24 | ||
|
a096bbc0b9 | ||
|
f43be857d7 | ||
|
a2e30bebc4 | ||
|
44ddada37a | ||
|
95ab9f8ee4 | ||
|
c58fcbdecd | ||
|
087a32971f | ||
|
7be1feaa0a | ||
|
08a893a2eb | ||
|
f356e29938 | ||
|
50f9fce29b | ||
|
347070bb07 | ||
|
95990c6105 | ||
|
40676cdebc | ||
|
9404d573cd | ||
|
029e8a166d | ||
|
23dbf9c0ae | ||
|
fb4e32fb81 | ||
|
5e9e1d051b | ||
|
afa9fcc965 | ||
|
026a317fc4 | ||
|
d426469608 | ||
|
868d72fe4f | ||
|
61d6858864 | ||
|
7544a2373d | ||
|
2494661687 | ||
|
49cf559157 | ||
|
0acd6371eb | ||
|
a6de0f2725 | ||
|
8b877d27d4 | ||
|
80203b385d | ||
|
8c2943421b | ||
|
fa743c81de | ||
|
d2bb74a8fd | ||
|
03e11dc0c6 | ||
|
6dd9a5076e | ||
|
aab1f4868b | ||
|
10830ce25c | ||
|
de59621fbb | ||
|
1405b25fc7 | ||
|
cc506c8950 | ||
|
4ad425a88f | ||
|
91cef6226a | ||
|
3a0a2a74b8 | ||
|
97630b438e | ||
|
2eecd70700 | ||
|
a05f265bb8 | ||
|
591914ca5c | ||
|
88788cec90 | ||
|
a7c515abb4 | ||
|
1f845e681e | ||
|
bc60f620c5 | ||
|
15b7f3f7a4 | ||
|
904b96c629 | ||
|
71ba685903 | ||
|
32d5ab08ca | ||
|
2b67ba94b1 | ||
|
189bb3d4a0 | ||
|
99825f6a5d | ||
|
dbdd4dfb2e |
1557 changed files with 127939 additions and 19914 deletions
|
@ -21,17 +21,22 @@
|
|||
],
|
||||
"ignorePaths": [
|
||||
"CHANGELOG.md",
|
||||
"patches",
|
||||
"packages/docusaurus-theme-translations/locales",
|
||||
"packages/docusaurus-plugin-ideal-image/src/theme/IdealImageLegacy",
|
||||
"package.json",
|
||||
"yarn.lock",
|
||||
"project-words.txt",
|
||||
"__snapshots__",
|
||||
"admin/scripts",
|
||||
"website/src/data/users.tsx",
|
||||
"website/src/data/tweets.tsx",
|
||||
"website/docusaurus.config.localized.json",
|
||||
"website/_dogfooding/_pages tests/diagrams.mdx",
|
||||
"*.xyz",
|
||||
"*.docx",
|
||||
"*.xsl",
|
||||
"*.xslt",
|
||||
"*.gitignore",
|
||||
"versioned_docs",
|
||||
"*.min.*",
|
||||
|
|
|
@ -1,32 +1,36 @@
|
|||
{
|
||||
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-22.04",
|
||||
"settings": {
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"[json]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"[jsonc]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true
|
||||
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"settings": {
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"[json]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"[jsonc]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true
|
||||
}
|
||||
},
|
||||
"extensions": [
|
||||
"dbaeumer.vscode-eslint",
|
||||
"orta.vscode-jest",
|
||||
"esbenp.prettier-vscode",
|
||||
"streetsidesoftware.code-spell-checker"
|
||||
]
|
||||
}
|
||||
},
|
||||
"extensions": [
|
||||
"dbaeumer.vscode-eslint",
|
||||
"orta.vscode-jest",
|
||||
"esbenp.prettier-vscode",
|
||||
"streetsidesoftware.code-spell-checker"
|
||||
],
|
||||
"forwardPorts": [3000],
|
||||
"containerUser": "vscode",
|
||||
"postCreateCommand": "yarn install",
|
||||
"waitFor": "postCreateCommand", // otherwise automated jest tests fail
|
||||
"features": {
|
||||
"node": {
|
||||
"version": "18"
|
||||
"version": "22"
|
||||
},
|
||||
"github-cli": "latest"
|
||||
}
|
||||
|
|
|
@ -21,3 +21,7 @@ packages/create-docusaurus/lib/*
|
|||
packages/create-docusaurus/templates/facebook
|
||||
|
||||
website/_dogfooding/_swizzle_theme_tests
|
||||
website/_dogfooding/_asset-tests/badSyntax.js
|
||||
|
||||
|
||||
packages/docusaurus-plugin-ideal-image/src/theme/IdealImageLegacy
|
||||
|
|
66
.eslintrc.js
vendored
66
.eslintrc.js
vendored
|
@ -9,16 +9,18 @@ const OFF = 0;
|
|||
const WARNING = 1;
|
||||
const ERROR = 2;
|
||||
|
||||
const ClientRestrictedImportPatterns = [
|
||||
// Prevent importing lodash in client bundle for bundle size
|
||||
'lodash',
|
||||
'lodash.**',
|
||||
'lodash/**',
|
||||
// Prevent importing server code in client bundle
|
||||
'**/../babel/**',
|
||||
'**/../server/**',
|
||||
'**/../commands/**',
|
||||
'**/../webpack/**',
|
||||
// Prevent importing lodash, usually for browser bundle size reasons
|
||||
const LodashImportPatterns = ['lodash', 'lodash.**', 'lodash/**'];
|
||||
|
||||
// Prevent importing content plugins, usually for coupling reasons
|
||||
const ContentPluginsImportPatterns = [
|
||||
'@docusaurus/plugin-content-blog',
|
||||
'@docusaurus/plugin-content-blog/**',
|
||||
// TODO fix theme-common => docs dependency issue
|
||||
// '@docusaurus/plugin-content-docs',
|
||||
// '@docusaurus/plugin-content-docs/**',
|
||||
'@docusaurus/plugin-content-pages',
|
||||
'@docusaurus/plugin-content-pages/**',
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
|
@ -58,6 +60,7 @@ module.exports = {
|
|||
},
|
||||
reportUnusedDisableDirectives: true,
|
||||
plugins: [
|
||||
'react-compiler',
|
||||
'react-hooks',
|
||||
'header',
|
||||
'jest',
|
||||
|
@ -66,6 +69,7 @@ module.exports = {
|
|||
'@docusaurus',
|
||||
],
|
||||
rules: {
|
||||
'react-compiler/react-compiler': ERROR,
|
||||
'react/jsx-uses-react': OFF, // JSX runtime: automatic
|
||||
'react/react-in-jsx-scope': OFF, // JSX runtime: automatic
|
||||
'array-callback-return': WARNING,
|
||||
|
@ -294,7 +298,7 @@ module.exports = {
|
|||
'jest/expect-expect': OFF,
|
||||
'jest/no-large-snapshots': [
|
||||
WARNING,
|
||||
{maxSize: Infinity, inlineMaxSize: 10},
|
||||
{maxSize: Infinity, inlineMaxSize: 50},
|
||||
],
|
||||
'jest/no-test-return-statement': ERROR,
|
||||
'jest/prefer-expect-resolves': WARNING,
|
||||
|
@ -378,7 +382,14 @@ module.exports = {
|
|||
// We don't provide any escape hatches for this rule. Rest siblings and
|
||||
// function placeholder params are always ignored, and any other unused
|
||||
// locals must be justified with a disable comment.
|
||||
'@typescript-eslint/no-unused-vars': [ERROR, {ignoreRestSiblings: true}],
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
ERROR,
|
||||
{
|
||||
ignoreRestSiblings: true,
|
||||
argsIgnorePattern: '^_',
|
||||
varsIgnorePattern: '^_',
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/prefer-optional-chain': ERROR,
|
||||
'@docusaurus/no-html-links': ERROR,
|
||||
'@docusaurus/prefer-docusaurus-heading': ERROR,
|
||||
|
@ -394,6 +405,7 @@ module.exports = {
|
|||
'@',
|
||||
'WebContainers',
|
||||
'Twitter',
|
||||
'X',
|
||||
'GitHub',
|
||||
'Dev.to',
|
||||
'1.x',
|
||||
|
@ -408,7 +420,33 @@ module.exports = {
|
|||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
patterns: ClientRestrictedImportPatterns,
|
||||
patterns: [
|
||||
...LodashImportPatterns,
|
||||
...ContentPluginsImportPatterns,
|
||||
// Prevent importing server code in client bundle
|
||||
'**/../babel/**',
|
||||
'**/../server/**',
|
||||
'**/../commands/**',
|
||||
'**/../webpack/**',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'packages/docusaurus-theme-common/src/**/*.{js,ts,tsx}',
|
||||
'packages/docusaurus-utils-common/src/**/*.{js,ts,tsx}',
|
||||
],
|
||||
excludedFiles: '*.test.{js,ts,tsx}',
|
||||
rules: {
|
||||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
patterns: [
|
||||
...LodashImportPatterns,
|
||||
...ContentPluginsImportPatterns,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -420,7 +458,7 @@ module.exports = {
|
|||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
patterns: ClientRestrictedImportPatterns.concat(
|
||||
patterns: LodashImportPatterns.concat(
|
||||
// Prevents relative imports between React theme components
|
||||
[
|
||||
'../**',
|
||||
|
|
8
.github/workflows/argos.yml
vendored
8
.github/workflows/argos.yml
vendored
|
@ -30,18 +30,18 @@ jobs:
|
|||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: 18
|
||||
node-version: lts/*
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
run: yarn || yarn || yarn
|
||||
|
||||
- name: Install Playwright browsers
|
||||
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
|
||||
|
|
6
.github/workflows/build-blog-only.yml
vendored
6
.github/workflows/build-blog-only.yml
vendored
|
@ -24,11 +24,11 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: '18'
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn
|
||||
run: yarn || yarn || yarn
|
||||
- name: Build blog-only
|
||||
run: yarn workspace website build:blogOnly
|
||||
|
|
6
.github/workflows/build-hash-router.yml
vendored
6
.github/workflows/build-hash-router.yml
vendored
|
@ -27,12 +27,12 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: '18'
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn
|
||||
run: yarn || yarn || yarn
|
||||
|
||||
- name: Build Hash Router
|
||||
run: yarn build:website:fast
|
||||
|
|
44
.github/workflows/build-perf.yml
vendored
44
.github/workflows/build-perf.yml
vendored
|
@ -11,6 +11,7 @@ on:
|
|||
- main
|
||||
- docusaurus-v**
|
||||
paths:
|
||||
- .github/workflows/build-perf.yml
|
||||
- package.json
|
||||
- yarn.lock
|
||||
- packages/**
|
||||
|
@ -25,6 +26,7 @@ permissions:
|
|||
contents: read
|
||||
|
||||
jobs:
|
||||
# Posts a PR comment with build size differences from PR vs main branches
|
||||
build-size:
|
||||
permissions:
|
||||
checks: write # for preactjs/compressed-size-action to create and update the checks
|
||||
|
@ -34,45 +36,65 @@ jobs:
|
|||
name: Build Size Report
|
||||
timeout-minutes: 30
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
DOCUSAURUS_INFRA: ['SLOWER', 'FASTER']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: '18'
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
- name: Track build size changes
|
||||
uses: preactjs/compressed-size-action@f780fd104362cfce9e118f9198df2ee37d12946c # v2
|
||||
uses: preactjs/compressed-size-action@946a292cd35bd1088e0d7eb92b69d1a8d5b5d76a # v2
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
build-script: build:website:en
|
||||
build-script: build:website:fast
|
||||
clean-script: clear:website # see https://github.com/facebook/docusaurus/pull/6838
|
||||
pattern: '{website/build/assets/js/main*js,website/build/assets/css/styles*css,website/.docusaurus/globalData.json,website/.docusaurus/registry.js,website/.docusaurus/routes.js,website/.docusaurus/routesChunkNames.json,website/.docusaurus/site-metadata.json,website/.docusaurus/codeTranslations.json,website/.docusaurus/i18n.json,website/.docusaurus/docusaurus.config.mjs,website/build/index.html,website/build/blog/index.html,website/build/blog/**/introducing-docusaurus/*,website/build/docs/index.html,website/build/docs/installation/index.html,website/build/tests/docs/index.html,website/build/tests/docs/standalone/index.html}'
|
||||
pattern: '{website/build/assets/js/main*js,website/build/assets/js/runtime~main*js,website/build/assets/css/styles*css,website/.docusaurus/globalData.json,website/.docusaurus/registry.js,website/.docusaurus/routes.js,website/.docusaurus/routesChunkNames.json,website/.docusaurus/site-metadata.json,website/.docusaurus/codeTranslations.json,website/.docusaurus/i18n.json,website/.docusaurus/docusaurus.config.mjs,website/build/index.html,website/build/docs.html,website/build/docs/**/*.html,website/build/blog.html,website/build/blog/**/*.html}'
|
||||
# HTML files: exclude versioned docs pages, tags pages, html redirect files
|
||||
exclude: '{website/build/docs/?.?.?/**/*.html,website/build/docs/next/**/*.html,website/build/blog/tags/**/*.html,**/*.html.html}'
|
||||
strip-hash: '\.([^;]\w{7})\.'
|
||||
minimum-change-threshold: 30
|
||||
compression: none
|
||||
comment-key: DOCUSAURUS_INFRA_${{ matrix.DOCUSAURUS_INFRA }}
|
||||
env:
|
||||
DOCUSAURUS_SLOWER: ${{ matrix.DOCUSAURUS_INFRA == 'SLOWER' && 'true' || 'false' }}
|
||||
|
||||
# Ensures build times stay under reasonable thresholds
|
||||
build-time:
|
||||
name: Build Time Perf
|
||||
timeout-minutes: 30
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
DOCUSAURUS_INFRA: ['SLOWER', 'FASTER']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn
|
||||
run: yarn || yarn || yarn
|
||||
|
||||
# Ensure build with a cold cache does not increase too much
|
||||
- name: Build (cold cache)
|
||||
run: yarn workspace website build --locale en
|
||||
timeout-minutes: 8
|
||||
run: yarn build:website:fast
|
||||
timeout-minutes: ${{ matrix.DOCUSAURUS_INFRA == 'SLOWER' && 3 || 2 }}
|
||||
env:
|
||||
DOCUSAURUS_SLOWER: ${{ matrix.DOCUSAURUS_INFRA == 'SLOWER' && 'true' || 'false' }}
|
||||
|
||||
# Ensure build with a warm cache does not increase too much
|
||||
- name: Build (warm cache)
|
||||
run: yarn workspace website build --locale en
|
||||
timeout-minutes: 2
|
||||
run: yarn build:website:fast
|
||||
# Temporary: upper value for Rspack until incremental cache works better
|
||||
timeout-minutes: ${{ matrix.DOCUSAURUS_INFRA == 'SLOWER' && 1 || 2 }}
|
||||
env:
|
||||
DOCUSAURUS_SLOWER: ${{ matrix.DOCUSAURUS_INFRA == 'SLOWER' && 'true' || 'false' }}
|
||||
|
||||
# TODO post a GitHub comment with build with perf warnings?
|
||||
|
|
9
.github/workflows/canary-release.yml
vendored
9
.github/workflows/canary-release.yml
vendored
|
@ -1,11 +1,14 @@
|
|||
name: Canary Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- docusaurus-v**
|
||||
paths:
|
||||
- .github/workflows/canary-release.yml
|
||||
- package.json
|
||||
- packages/**
|
||||
|
||||
permissions:
|
||||
|
@ -21,9 +24,9 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0 # Needed to get the commit number with "git rev-list --count HEAD"
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: '18'
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
- name: Prepare git
|
||||
run: |
|
||||
|
@ -38,7 +41,7 @@ jobs:
|
|||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
|
||||
- name: Installation
|
||||
run: yarn
|
||||
run: yarn || yarn || yarn
|
||||
- name: Publish Canary release
|
||||
run: |
|
||||
yarn canary
|
||||
|
|
4
.github/workflows/codeql-analysis.yml
vendored
4
.github/workflows/codeql-analysis.yml
vendored
|
@ -36,9 +36,9 @@ jobs:
|
|||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@9fdb3e49720b44c48891d036bb502feb25684276 # 3.25.6
|
||||
uses: github/codeql-action/init@2c779ab0d087cd7fe7b826087247c2c81f27bfa6 # 3.26.5
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@9fdb3e49720b44c48891d036bb502feb25684276 # 3.25.6
|
||||
uses: github/codeql-action/analyze@2c779ab0d087cd7fe7b826087247c2c81f27bfa6 # 3.26.5
|
||||
|
|
41
.github/workflows/continuous-releases.yml
vendored
Normal file
41
.github/workflows/continuous-releases.yml
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
name: Continuous Releases
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- docusaurus-v**
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Continuous Releases
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn
|
||||
|
||||
- name: Build packages
|
||||
run: yarn build:packages
|
||||
|
||||
- name: Initialize fresh templates
|
||||
run: |
|
||||
yarn create-docusaurus template/docusaurus-classic-js classic --javascript -p npm
|
||||
yarn create-docusaurus template/docusaurus-classic-ts classic --typescript -p npm
|
||||
|
||||
- name: Release
|
||||
run: npx pkg-pr-new@0.0.20 publish './packages/*' --template './template/*' --compact --comment=off
|
2
.github/workflows/dependency-review.yml
vendored
2
.github/workflows/dependency-review.yml
vendored
|
@ -15,4 +15,4 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Dependency Review
|
||||
uses: actions/dependency-review-action@0c155c5e8556a497adf53f2c18edabf945ed8e70 # 4.3.2
|
||||
uses: actions/dependency-review-action@ce3cf9537a52e8119d91fd484ab5b8a807627bf8 # 4.6.0
|
||||
|
|
10
.github/workflows/lighthouse-report.yml
vendored
10
.github/workflows/lighthouse-report.yml
vendored
|
@ -24,19 +24,19 @@ jobs:
|
|||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: 18
|
||||
node-version: lts/*
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
run: yarn || yarn || yarn
|
||||
|
||||
- name: Build website fast
|
||||
run: yarn build:website:fast
|
||||
|
||||
- name: Audit URLs using Lighthouse
|
||||
id: lighthouse_audit
|
||||
uses: treosh/lighthouse-ci-action@1b0e7c33270fbba31a18a0fbb1de7cc5256b6d39 # 11.4.0
|
||||
uses: treosh/lighthouse-ci-action@2f8dda6cf4de7d73b29853c3f29e73a01e297bd8 # 12.1.0
|
||||
with:
|
||||
urls: |
|
||||
http://localhost:3000
|
||||
|
@ -64,7 +64,7 @@ jobs:
|
|||
|
||||
- name: Add Lighthouse stats as comment
|
||||
id: comment_to_pr
|
||||
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # 2.9.0
|
||||
uses: marocchino/sticky-pull-request-comment@67d0dec7b07ed060a405f9b2a64b8ab319fdd7db # 2.9.2
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
number: ${{ github.event.pull_request.number }}
|
||||
|
|
2
.github/workflows/lint-autofix.yml
vendored
2
.github/workflows/lint-autofix.yml
vendored
|
@ -25,7 +25,7 @@ jobs:
|
|||
ref: ${{ github.head_ref }}
|
||||
|
||||
- name: Installation
|
||||
run: yarn
|
||||
run: yarn || yarn || yarn
|
||||
|
||||
- name: AutoFix Format
|
||||
run: yarn format
|
||||
|
|
13
.github/workflows/lint.yml
vendored
13
.github/workflows/lint.yml
vendored
|
@ -22,18 +22,23 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: '18'
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn
|
||||
# run: yarn install --immutable # Fails if yarn.lock is modified (unfortunately only works for Yarn 2, and --frozen-lockfile is not the same!)
|
||||
run: yarn install --frozen-lockfile || yarn install --frozen-lockfile || yarn install --frozen-lockfile
|
||||
- name: Check immutable yarn.lock
|
||||
run: git diff --exit-code
|
||||
|
||||
- name: Check for suspicious yarn.lock
|
||||
# for allowed aliases, see https://github.com/yargs/cliui/pull/139/files#r1670711112
|
||||
run: yarn lockfile-lint --path yarn.lock --type yarn --allowed-hosts yarn --validate-https --validate-package-names --validate-integrity --empty-hostname=false --allowed-package-name-aliases react-loadable react-helmet-async string-width-cjs strip-ansi-cjs wrap-ansi-cjs
|
||||
|
||||
- name: Lint
|
||||
run: |
|
||||
echo "::add-matcher::.github/workflows/cspell-problem-matcher.json"
|
||||
yarn lint:ci
|
||||
|
||||
- name: Prettier Code
|
||||
run: yarn format:diff
|
||||
|
|
6
.github/workflows/showcase-test.yml
vendored
6
.github/workflows/showcase-test.yml
vendored
|
@ -24,11 +24,11 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: '20'
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn
|
||||
run: yarn || yarn || yarn
|
||||
- name: Test
|
||||
run: yarn test website/src/data/__tests__/user.test.ts
|
||||
|
|
91
.github/workflows/tests-e2e.yml
vendored
91
.github/workflows/tests-e2e.yml
vendored
|
@ -38,21 +38,21 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: ['18.0', '18', '20']
|
||||
node: ['18.0', '20', '22']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn
|
||||
run: yarn || yarn || yarn
|
||||
- name: Generate test-website project against main branch
|
||||
run: yarn test:build:website -s
|
||||
- name: Install test-website project with Yarn v1
|
||||
run: yarn install
|
||||
run: yarn || yarn || yarn
|
||||
working-directory: ../test-website
|
||||
env:
|
||||
npm_config_registry: http://localhost:4873
|
||||
|
@ -62,7 +62,14 @@ jobs:
|
|||
env:
|
||||
E2E_TEST: true
|
||||
- name: Build test-website project
|
||||
run: yarn build
|
||||
# We build 2 locales to ensure a localized site doesn't leak memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10599
|
||||
run: yarn build --locale en --locale fr
|
||||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
NODE_OPTIONS: '--max-old-space-size=300'
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
working-directory: ../test-website
|
||||
|
||||
yarn-berry:
|
||||
|
@ -76,13 +83,13 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Use Node.js 18
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
- name: Use Node.js LTS
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: '18'
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn
|
||||
run: yarn || yarn || yarn
|
||||
- name: Generate test-website project with ${{ matrix.variant }} against main branch
|
||||
run: yarn test:build:website ${{ matrix.variant }}
|
||||
- name: Install test-website project with Yarn Berry and nodeLinker = ${{ matrix.nodeLinker }}
|
||||
|
@ -98,23 +105,15 @@ jobs:
|
|||
# https://yarnpkg.com/features/pnp#fallback-mode
|
||||
yarn config set pnpFallbackMode none
|
||||
|
||||
yarn install
|
||||
yarn || yarn || yarn
|
||||
working-directory: ../test-website
|
||||
env:
|
||||
YARN_ENABLE_IMMUTABLE_INSTALLS: false # Yarn berry should create the lockfile, despite CI env
|
||||
- name: Install missing dependencies
|
||||
if: matrix.variant == '-st' && matrix.nodeLinker == 'pnp'
|
||||
run: |
|
||||
# These dependencies are referenced in the init project, not by our packages
|
||||
yarn add @docusaurus/theme-classic @docusaurus/types @types/node
|
||||
yarn config set packageExtensions --json '{ "unified@^9.2.2": { "dependencies": { "@types/unist": "^2.0.6" } } }'
|
||||
working-directory: ../test-website
|
||||
- name: Start test-website project
|
||||
run: yarn start --no-open
|
||||
working-directory: ../test-website
|
||||
env:
|
||||
E2E_TEST: true
|
||||
|
||||
- name: TypeCheck website
|
||||
# TODO: there're some lingering issues with PnP + tsc. Enable tsc in PnP later.
|
||||
if: matrix.variant == '-st' && matrix.nodeLinker != 'pnp'
|
||||
|
@ -136,7 +135,14 @@ jobs:
|
|||
yarn typecheck
|
||||
|
||||
- name: Build test-website project
|
||||
run: yarn build
|
||||
# We build 2 locales to ensure a localized site doesn't leak memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10599
|
||||
run: yarn build --locale en --locale fr
|
||||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
NODE_OPTIONS: '--max-old-space-size=300'
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
working-directory: ../test-website
|
||||
|
||||
npm:
|
||||
|
@ -146,27 +152,37 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Use Node.js 18
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
- name: Use Node.js LTS
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: '18'
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn
|
||||
run: yarn || yarn || yarn
|
||||
- name: Generate test-website project against main branch
|
||||
run: yarn test:build:website -s
|
||||
run: yarn test:build:website -st
|
||||
- name: Install test-website project with npm
|
||||
run: npm install
|
||||
working-directory: ../test-website
|
||||
env:
|
||||
npm_config_registry: http://localhost:4873
|
||||
- name: TypeCheck website
|
||||
working-directory: ../test-website
|
||||
run: yarn typecheck
|
||||
- name: Start test-website project
|
||||
run: npm run start -- --no-open
|
||||
working-directory: ../test-website
|
||||
env:
|
||||
E2E_TEST: true
|
||||
- name: Build test-website project
|
||||
run: npm run build
|
||||
# We build 2 locales to ensure a localized site doesn't leak memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10599
|
||||
run: npm run build -- --locale en --locale fr
|
||||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
NODE_OPTIONS: '--max-old-space-size=300'
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
working-directory: ../test-website
|
||||
|
||||
pnpm:
|
||||
|
@ -176,28 +192,37 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Use Node.js 18
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
- name: Use Node.js LTS
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: '18'
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn
|
||||
run: yarn || yarn || yarn
|
||||
- name: Generate test-website project against main branch
|
||||
run: yarn test:build:website -s
|
||||
run: yarn test:build:website -st
|
||||
- name: Install test-website project with pnpm
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
# Fix some peer dependencies errors
|
||||
pnpm add @algolia/client-search @types/react@17 typescript
|
||||
pnpm install
|
||||
working-directory: ../test-website
|
||||
env:
|
||||
npm_config_registry: http://localhost:4873
|
||||
- name: TypeCheck website
|
||||
working-directory: ../test-website
|
||||
run: yarn typecheck
|
||||
- name: Start test-website project
|
||||
run: pnpm start --no-open
|
||||
working-directory: ../test-website
|
||||
env:
|
||||
E2E_TEST: true
|
||||
- name: Build test-website project
|
||||
run: pnpm run build
|
||||
# We build 2 locales to ensure a localized site doesn't leak memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10599
|
||||
run: pnpm run build --locale en --locale fr
|
||||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
NODE_OPTIONS: '--max-old-space-size=300'
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
working-directory: ../test-website
|
||||
|
|
10
.github/workflows/tests-swizzle.yml
vendored
10
.github/workflows/tests-swizzle.yml
vendored
|
@ -27,13 +27,13 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
- name: Set up Node LTS
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: '18'
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn
|
||||
run: yarn || yarn || yarn
|
||||
|
||||
# Swizzle all the theme components
|
||||
- name: Swizzle (${{matrix.action}} - ${{matrix.variant}})
|
||||
|
@ -43,4 +43,4 @@ jobs:
|
|||
run: yarn build:website:fast
|
||||
# Ensure swizzled site still typechecks
|
||||
- name: TypeCheck website
|
||||
run: yarn workspace website typecheck
|
||||
run: yarn workspace website typecheck --project tsconfig.skipLibCheck.json
|
||||
|
|
19
.github/workflows/tests-windows.yml
vendored
19
.github/workflows/tests-windows.yml
vendored
|
@ -11,6 +11,7 @@ on:
|
|||
- jest.config.mjs
|
||||
- packages/**
|
||||
- tsconfig.*.json
|
||||
- .github/workflows/tests-windows.yml
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
|
@ -26,18 +27,18 @@ jobs:
|
|||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: ['18.0', '18', '20']
|
||||
node: ['18.0', '20', '22']
|
||||
steps:
|
||||
- name: Support longpaths
|
||||
run: git config --system core.longpaths true
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn # 3 attempts to avoid timeout errors...
|
||||
run: yarn || yarn || yarn
|
||||
- name: Docusaurus Jest Tests
|
||||
run: yarn test
|
||||
- name: Create a deep path
|
||||
|
@ -54,12 +55,16 @@ jobs:
|
|||
run: yarn build:website:fast
|
||||
|
||||
- name: TypeCheck website
|
||||
run: yarn workspace website typecheck
|
||||
# TODO temporary, remove TS skipLibCheck
|
||||
# see https://github.com/facebook/docusaurus/pull/10486
|
||||
run: yarn workspace website typecheck --project tsconfig.skipLibCheck.json
|
||||
- name: TypeCheck website - min version - v5.1
|
||||
run: |
|
||||
yarn workspace website add typescript@5.1.6 --exact
|
||||
yarn add typescript@5.1.6 --exact -D -W --ignore-scripts
|
||||
yarn workspace website typecheck
|
||||
- name: TypeCheck website - max version - Latest
|
||||
# For latest TS there are often lib check errors, so we disable it
|
||||
# Details: https://github.com/facebook/docusaurus/pull/10486
|
||||
run: |
|
||||
yarn workspace website add typescript@latest --exact
|
||||
yarn workspace website typecheck
|
||||
yarn add typescript@latest --exact -D -W --ignore-scripts
|
||||
yarn workspace website typecheck --project tsconfig.skipLibCheck.json
|
||||
|
|
30
.github/workflows/tests.yml
vendored
30
.github/workflows/tests.yml
vendored
|
@ -11,6 +11,7 @@ on:
|
|||
- jest.config.mjs
|
||||
- packages/**
|
||||
- tsconfig.*.json
|
||||
- .github/workflows/tests.yml
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
|
@ -26,31 +27,44 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: ['18.0', '18', '20']
|
||||
node: ['18.0', '20', '22']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn
|
||||
run: yarn || yarn || yarn
|
||||
- name: Test
|
||||
run: yarn test
|
||||
- name: Remove Theme Internal Re-export
|
||||
run: yarn workspace @docusaurus/theme-common removeThemeInternalReexport
|
||||
- name: Docusaurus Build
|
||||
run: yarn build:website:fast
|
||||
# We build 2 locales to ensure a localized site doesn't leak memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10599
|
||||
run: yarn build:website:fast --locale en --locale fr
|
||||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
NODE_OPTIONS: '--max-old-space-size=450'
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
- name: Docusaurus site CSS order
|
||||
run: yarn workspace website test:css-order
|
||||
|
||||
- name: TypeCheck website
|
||||
run: yarn workspace website typecheck
|
||||
# TODO temporary, remove TS skipLibCheck
|
||||
# see https://github.com/facebook/docusaurus/pull/10486
|
||||
run: yarn workspace website typecheck --project tsconfig.skipLibCheck.json
|
||||
- name: TypeCheck website - min version - v5.1
|
||||
run: |
|
||||
yarn workspace website add typescript@5.1.6 --exact
|
||||
yarn add typescript@5.1.6 --exact -D -W --ignore-scripts
|
||||
yarn workspace website typecheck
|
||||
- name: TypeCheck website - max version - Latest
|
||||
# For latest TS there are often lib check errors, so we disable it
|
||||
# Details: https://github.com/facebook/docusaurus/pull/10486
|
||||
run: |
|
||||
yarn workspace website add typescript@latest --exact
|
||||
yarn workspace website typecheck
|
||||
yarn add typescript@latest --exact -D -W --ignore-scripts
|
||||
yarn workspace website typecheck --project tsconfig.skipLibCheck.json
|
||||
|
|
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -14,7 +14,7 @@ package-lock.json
|
|||
.eslintcache
|
||||
|
||||
yarn-error.log
|
||||
build
|
||||
website/build
|
||||
coverage
|
||||
.docusaurus
|
||||
.cache-loader
|
||||
|
@ -38,8 +38,13 @@ website/_dogfooding/_swizzle_theme_tests
|
|||
|
||||
CrowdinTranslations_*.zip
|
||||
|
||||
website/.cpu-prof
|
||||
|
||||
website/i18n/**/*
|
||||
#!website/i18n/fr
|
||||
#!website/i18n/fr/**/*
|
||||
|
||||
.netlify
|
||||
|
||||
website/rspack-tracing.json
|
||||
website/bundler-cpu-profile.json
|
||||
|
|
|
@ -4,6 +4,10 @@ node_modules
|
|||
build
|
||||
coverage
|
||||
.docusaurus
|
||||
.idea
|
||||
|
||||
.svg
|
||||
*.svg
|
||||
|
||||
jest/vendor
|
||||
|
||||
|
@ -26,3 +30,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
|
||||
|
|
|
@ -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
|
||||
|
|
551
CHANGELOG.md
551
CHANGELOG.md
|
@ -1,5 +1,556 @@
|
|||
# Docusaurus Changelog
|
||||
|
||||
## 3.7.0 (2025-01-03)
|
||||
|
||||
#### :rocket: New Feature
|
||||
|
||||
- `docusaurus-faster`, `docusaurus`
|
||||
- [#10800](https://github.com/facebook/docusaurus/pull/10800) feat(core): Turn Rspack incremental on by default (again) ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-plugin-content-blog`, `docusaurus-theme-classic`
|
||||
- [#10768](https://github.com/facebook/docusaurus/pull/10768) feat(blog): Add author social icons for bluesky, mastodon, threads, twitch, youtube, instagram ([@GingerGeek](https://github.com/GingerGeek))
|
||||
- `create-docusaurus`, `docusaurus-mdx-loader`, `docusaurus-module-type-aliases`, `docusaurus-plugin-client-redirects`, `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-plugin-content-pages`, `docusaurus-plugin-debug`, `docusaurus-plugin-google-analytics`, `docusaurus-plugin-google-gtag`, `docusaurus-plugin-google-tag-manager`, `docusaurus-plugin-ideal-image`, `docusaurus-plugin-pwa`, `docusaurus-plugin-rsdoctor`, `docusaurus-plugin-sitemap`, `docusaurus-plugin-svgr`, `docusaurus-plugin-vercel-analytics`, `docusaurus-preset-classic`, `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus-theme-live-codeblock`, `docusaurus-theme-mermaid`, `docusaurus-theme-search-algolia`, `docusaurus-types`, `docusaurus`
|
||||
- [#10763](https://github.com/facebook/docusaurus/pull/10763) feat: Add React 19 support to Docusaurus v3 ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-plugin-content-blog`
|
||||
- [#10729](https://github.com/facebook/docusaurus/pull/10729) feat(blog): Add `frontMatter.sidebar_label` ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-module-type-aliases`, `docusaurus-plugin-svgr`, `docusaurus-preset-classic`, `docusaurus-types`, `docusaurus-utils`, `docusaurus`
|
||||
- [#10677](https://github.com/facebook/docusaurus/pull/10677) feat(svgr): create new Docusaurus SVGR plugin ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
|
||||
- `docusaurus-remark-plugin-npm2yarn`
|
||||
- [#10803](https://github.com/facebook/docusaurus/pull/10803) fix(npm-to-yarn): add missing npm-to-yarn converter for Bun ([@Lehoczky](https://github.com/Lehoczky))
|
||||
- `docusaurus-theme-classic`, `docusaurus-theme-common`
|
||||
- [#10796](https://github.com/facebook/docusaurus/pull/10796) fix(theme): Footer Column/Link should merge provided className ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-bundler`, `docusaurus-theme-common`
|
||||
- [#10786](https://github.com/facebook/docusaurus/pull/10786) fix(core): fix React hydration errors, change html minifier settings ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-theme-common`
|
||||
- [#10782](https://github.com/facebook/docusaurus/pull/10782) fix(theme-common): code block magic comments should support SQL block comments ([@WillBlack403](https://github.com/WillBlack403))
|
||||
- `docusaurus-theme-translations`
|
||||
- [#10783](https://github.com/facebook/docusaurus/pull/10783) fix(theme-translations): Add missing Dutch (nl) theme translations ([@janaukema](https://github.com/janaukema))
|
||||
- [#10760](https://github.com/facebook/docusaurus/pull/10760) fix(theme-translation): add missing Korean (ko) theme translations ([@effozen](https://github.com/effozen))
|
||||
- `docusaurus-plugin-content-docs`
|
||||
- [#10754](https://github.com/facebook/docusaurus/pull/10754) fix(docs): fix sidebar item visibility bug for category index ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus`
|
||||
- [#10727](https://github.com/facebook/docusaurus/pull/10727) fix(core): fix codegen routesChunkName possible hash collision ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-mdx-loader`
|
||||
- [#10723](https://github.com/facebook/docusaurus/pull/10723) fix(mdx-loader): fix md image paths with spaces bug related to transformImage encoding problem ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### :memo: Documentation
|
||||
|
||||
- [#10740](https://github.com/facebook/docusaurus/pull/10740) docs: Link initialization docs together ([@waldyrious](https://github.com/waldyrious))
|
||||
|
||||
#### :robot: Dependencies
|
||||
|
||||
- [#10771](https://github.com/facebook/docusaurus/pull/10771) chore(deps): bump nanoid from 3.3.7 to 3.3.8 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10721](https://github.com/facebook/docusaurus/pull/10721) chore(deps): bump actions/dependency-review-action from 4.4.0 to 4.5.0 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
|
||||
#### :wrench: Maintenance
|
||||
|
||||
- Other
|
||||
- [#10770](https://github.com/facebook/docusaurus/pull/10770) chore: Devcontainer upgrade to Ubuntu Noble & Node 22 ([@GingerGeek](https://github.com/GingerGeek))
|
||||
- `docusaurus-theme-search-algolia`
|
||||
- [#10801](https://github.com/facebook/docusaurus/pull/10801) refactor(algolia): simplify SearchBar component ([@slorber](https://github.com/slorber))
|
||||
- [#10672](https://github.com/facebook/docusaurus/pull/10672) chore(algolia): upgrade algoliasearch to v5 ([@millotp](https://github.com/millotp))
|
||||
- `docusaurus`
|
||||
- [#10798](https://github.com/facebook/docusaurus/pull/10798) refactor(core): Use Intl native API to get locale direction, remove rtl-detect depend… ([@slorber](https://github.com/slorber))
|
||||
- [#10747](https://github.com/facebook/docusaurus/pull/10747) refactor(core): swizzle wrap should use ReactNode instead of JSX.Element ([@slorber](https://github.com/slorber))
|
||||
- `create-docusaurus`, `docusaurus-mdx-loader`, `docusaurus-module-type-aliases`, `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-plugin-content-pages`, `docusaurus-plugin-debug`, `docusaurus-plugin-ideal-image`, `docusaurus-plugin-pwa`, `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus-theme-live-codeblock`, `docusaurus-theme-mermaid`, `docusaurus-theme-search-algolia`, `docusaurus-types`, `docusaurus`
|
||||
- [#10746](https://github.com/facebook/docusaurus/pull/10746) refactor: prepare types for React 19 ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-theme-common`
|
||||
- [#10728](https://github.com/facebook/docusaurus/pull/10728) refactor(theme-common): change storageUtils useSyncExternalCode getSnapshot workaround ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### Committers: 14
|
||||
|
||||
- Alvin Bryan ([@alvinometric](https://github.com/alvinometric))
|
||||
- Hichem Fantar ([@hichemfantar](https://github.com/hichemfantar))
|
||||
- Ivan Cheban ([@ivancheban](https://github.com/ivancheban))
|
||||
- Jake Boone ([@jakeboone02](https://github.com/jakeboone02))
|
||||
- Jan Aukema ([@janaukema](https://github.com/janaukema))
|
||||
- Lehoczky Zoltán ([@Lehoczky](https://github.com/Lehoczky))
|
||||
- Lin Huang ([@codimiracle](https://github.com/codimiracle))
|
||||
- Pierre Millot ([@millotp](https://github.com/millotp))
|
||||
- Sébastien Lorber ([@slorber](https://github.com/slorber))
|
||||
- Taylor Reece ([@taylorreece](https://github.com/taylorreece))
|
||||
- Waldir Pimenta ([@waldyrious](https://github.com/waldyrious))
|
||||
- William Black ([@WillBlack403](https://github.com/WillBlack403))
|
||||
- Zed Spencer-Milnes ([@GingerGeek](https://github.com/GingerGeek))
|
||||
- Zen ([@effozen](https://github.com/effozen))
|
||||
|
||||
## 3.6.3 (2024-11-22)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
|
||||
- `docusaurus`
|
||||
- [#10712](https://github.com/facebook/docusaurus/pull/10712) fix(core): disable Rspack incremental in dev ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### Committers: 1
|
||||
|
||||
- Sébastien Lorber ([@slorber](https://github.com/slorber))
|
||||
|
||||
## 3.6.2 (2024-11-19)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
|
||||
- `docusaurus-module-type-aliases`
|
||||
- [#10693](https://github.com/facebook/docusaurus/pull/10693) fix(types): add missing ambiant TS declarations for .md / .mdx partials ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-theme-translations`
|
||||
- [#10688](https://github.com/facebook/docusaurus/pull/10688) fix(theme-translation): add and update Japanese translations ([@Ryoga-exe](https://github.com/Ryoga-exe))
|
||||
- `docusaurus`
|
||||
- [#10685](https://github.com/facebook/docusaurus/pull/10685) fix(cli): `docusaurus --help` should print plugin commands using `extendCli()` ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-bundler`
|
||||
- [#10680](https://github.com/facebook/docusaurus/pull/10680) fix(bundler): allow CSS nesting by default, restore postcss-preset-env ([@slorber](https://github.com/slorber))
|
||||
- `create-docusaurus`
|
||||
- [#10676](https://github.com/facebook/docusaurus/pull/10676) fix(create-docusaurus): add ts exclude to TS init template ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-bundler`, `docusaurus-faster`, `docusaurus`
|
||||
- [#10648](https://github.com/facebook/docusaurus/pull/10648) fix(faster): Upgrade to Rspack 1.1.1, fix build progress bar display ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### :wrench: Maintenance
|
||||
|
||||
- [#10691](https://github.com/facebook/docusaurus/pull/10691) chore(ci): retry `yarn install` to ignore temporary network errors ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### Committers: 5
|
||||
|
||||
- Junior_Gx ([@goffxnca](https://github.com/goffxnca))
|
||||
- Kyle Tsang ([@kyletsang](https://github.com/kyletsang))
|
||||
- Ryoga ([@Ryoga-exe](https://github.com/Ryoga-exe))
|
||||
- Sébastien Lorber ([@slorber](https://github.com/slorber))
|
||||
- Zwyx ([@Zwyx](https://github.com/Zwyx))
|
||||
|
||||
## 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
|
||||
|
||||
- `docusaurus-plugin-content-blog`, `docusaurus-theme-classic`
|
||||
- [#10586](https://github.com/facebook/docusaurus/pull/10586) feat(blog): Add `frontMatter.title_meta` to override title for SEO ([@ilg-ul](https://github.com/ilg-ul))
|
||||
- `docusaurus`
|
||||
- [#10600](https://github.com/facebook/docusaurus/pull/10600) feat(cli): build/deploy should allow multiple `--locale` options ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-logger`
|
||||
- [#10590](https://github.com/facebook/docusaurus/pull/10590) feat(core): add Node.js memory perf logging ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-plugin-rsdoctor`
|
||||
- [#10588](https://github.com/facebook/docusaurus/pull/10588) feat: new Rsdoctor official plugin ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-bundler`, `docusaurus-faster`, `docusaurus-theme-classic`, `docusaurus`
|
||||
- [#10402](https://github.com/facebook/docusaurus/pull/10402) feat(core): Replace Webpack with Rspack - `siteConfig.future.experimental_faster.rspackBundler` ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-bundler`, `docusaurus-faster`, `docusaurus-types`, `docusaurus`
|
||||
- [#10554](https://github.com/facebook/docusaurus/pull/10554) feat(core): faster HTML minimizer - `siteConfig.future.experimental_faster.swcHtmlMinimizer` ([@slorber](https://github.com/slorber))
|
||||
- [#10522](https://github.com/facebook/docusaurus/pull/10522) feat(core): faster CSS minimizer - `siteConfig.future.experimental_faster.lightningCssMinimizer` ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-theme-mermaid`
|
||||
- [#10510](https://github.com/facebook/docusaurus/pull/10510) feat(theme-mermaid): support Mermaid 11+ including new types of diagrams ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-mdx-loader`, `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-plugin-content-pages`, `docusaurus-types`, `docusaurus`
|
||||
- [#10479](https://github.com/facebook/docusaurus/pull/10479) feat(core, mdx-loader): deduplicate MDX compilation - `siteConfig.future.experimental_faster.mdxCrossCompilerCache` ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-faster`, `docusaurus-types`, `docusaurus`
|
||||
- [#10441](https://github.com/facebook/docusaurus/pull/10441) feat(core): faster JS minimizer - `siteConfig.future.experimental_faster.swcJsMinimizer` ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-faster`, `docusaurus-plugin-content-docs`, `docusaurus-types`, `docusaurus`
|
||||
- [#10435](https://github.com/facebook/docusaurus/pull/10435) feat(core): faster transpiler option - `siteConfig.future.experimental_faster.swcJsLoader` ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
|
||||
- `docusaurus-bundler`, `docusaurus`
|
||||
- [#10632](https://github.com/facebook/docusaurus/pull/10632) fix(core): restore Rspack ProgressBar colors ([@slorber](https://github.com/slorber))
|
||||
- [#10581](https://github.com/facebook/docusaurus/pull/10581) fix(core): fix handling of Swc html minifier warnings ([@slorber](https://github.com/slorber))
|
||||
- [#10573](https://github.com/facebook/docusaurus/pull/10573) fix(core): move @docusaurus/faster to bundler peerDeps ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-bundler`
|
||||
- [#10617](https://github.com/facebook/docusaurus/pull/10617) fix(faster): allow Rspack + babel-loader ([@slorber](https://github.com/slorber))
|
||||
- [#10614](https://github.com/facebook/docusaurus/pull/10614) fix(faster): fix error message typo + add color ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-theme-classic`
|
||||
- [#10618](https://github.com/facebook/docusaurus/pull/10618) fix(theme): Restore former globalThis.Prism ([@slorber](https://github.com/slorber))
|
||||
- [#10585](https://github.com/facebook/docusaurus/pull/10585) fix(theme): light & dark mode checkbox doesn't announce state switches ([@andrewasche](https://github.com/andrewasche))
|
||||
- [#10439](https://github.com/facebook/docusaurus/pull/10439) fix(theme): upgrade infima, fix footer link width bug ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-faster`
|
||||
- [#10616](https://github.com/facebook/docusaurus/pull/10616) fix(faster): add missing tslib dependency ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus`
|
||||
- [#10611](https://github.com/facebook/docusaurus/pull/10611) fix(core): fix DOCUSAURUS_CURRENT_LOCALE = 'undefined' ([@slorber](https://github.com/slorber))
|
||||
- [#10423](https://github.com/facebook/docusaurus/pull/10423) fix(core): always use hash for CSS module class names ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-bundler`, `docusaurus-faster`
|
||||
- [#10605](https://github.com/facebook/docusaurus/pull/10605) fix(core): Use proper swc loader options ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-theme-translations`
|
||||
- [#10551](https://github.com/facebook/docusaurus/pull/10551) fix(translations): complete missing slovenian theme translations ([@patik123](https://github.com/patik123))
|
||||
- [#10507](https://github.com/facebook/docusaurus/pull/10507) fix(theme-translations): add missing Vietnamese translations ([@namnguyenthanhwork](https://github.com/namnguyenthanhwork))
|
||||
- [#10413](https://github.com/facebook/docusaurus/pull/10413) fix(translations): fix Spanish translation for "breadcrumbs" ([@TheMineWay](https://github.com/TheMineWay))
|
||||
- `docusaurus-mdx-loader`
|
||||
- [#10553](https://github.com/facebook/docusaurus/pull/10553) fix(mdx-loader): fix cross-compiler cache randomly loading mdx with client/server envs ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-tsconfig`
|
||||
- [#10547](https://github.com/facebook/docusaurus/pull/10547) fix(tsconfig): add `@docusaurus/tsconfig` target es2022 ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-plugin-content-blog`
|
||||
- [#10424](https://github.com/facebook/docusaurus/pull/10424) fix(blog): normalize inline authors socials ([@OzakIOne](https://github.com/OzakIOne))
|
||||
- [#10440](https://github.com/facebook/docusaurus/pull/10440) fix(blog): apply baseUrl to relative image in blog authors ([@OzakIOne](https://github.com/OzakIOne))
|
||||
- `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus-theme-translations`
|
||||
- [#10431](https://github.com/facebook/docusaurus/pull/10431) fix(blog): authors count incorrectly rendered ([@OzakIOne](https://github.com/OzakIOne))
|
||||
- `docusaurus-types`, `docusaurus`
|
||||
- [#10420](https://github.com/facebook/docusaurus/pull/10420) fix(types): fix type of PluginModule ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### :running_woman: Performance
|
||||
|
||||
- `docusaurus-bundler`, `docusaurus-faster`
|
||||
- [#10605](https://github.com/facebook/docusaurus/pull/10605) fix(core): Use proper swc loader options ([@slorber](https://github.com/slorber))
|
||||
- Other
|
||||
- [#10601](https://github.com/facebook/docusaurus/pull/10601) perf(ci): Add CI checks to prevent memory, build-time and build-size regressions ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus`
|
||||
- [#10599](https://github.com/facebook/docusaurus/pull/10599) fix(core): fix i18n sites SSG memory leak - require.cache ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-mdx-loader`, `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-plugin-content-pages`
|
||||
- [#10470](https://github.com/facebook/docusaurus/pull/10470) refactor(mdx-loader): re-export metadata module instead of serializing it ([@slorber](https://github.com/slorber))
|
||||
- [#10457](https://github.com/facebook/docusaurus/pull/10457) refactor(mdx-loader): read metadata from memory (loaded content) instead of fs ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### :memo: Documentation
|
||||
|
||||
- Other
|
||||
- [#10631](https://github.com/facebook/docusaurus/pull/10631) docs: fix frontMatter.mdx.format docs ([@slorber](https://github.com/slorber))
|
||||
- [#10630](https://github.com/facebook/docusaurus/pull/10630) docs: Add missing API ref docs for Docusaurus Faster options ([@slorber](https://github.com/slorber))
|
||||
- [#10592](https://github.com/facebook/docusaurus/pull/10592) docs: resource add docusaurus-i18n ([@moonrailgun](https://github.com/moonrailgun))
|
||||
- [#10535](https://github.com/facebook/docusaurus/pull/10535) docs: add tip about harmless vulnerabilities ([@ilg-ul](https://github.com/ilg-ul))
|
||||
- [#10545](https://github.com/facebook/docusaurus/pull/10545) docs: clarify component naming for markdown import ([@jackrabbit128](https://github.com/jackrabbit128))
|
||||
- [#10416](https://github.com/facebook/docusaurus/pull/10416) docs: corrected typo in search.mdx ([@B0r1sD](https://github.com/B0r1sD))
|
||||
- [#10405](https://github.com/facebook/docusaurus/pull/10405) docs(website): small spellfix on 3.5 update notes ([@Zenahr](https://github.com/Zenahr))
|
||||
- `create-docusaurus`
|
||||
- [#10608](https://github.com/facebook/docusaurus/pull/10608) docs: mention config/sidebars run in Node.js runtime ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### :robot: Dependencies
|
||||
|
||||
- Other
|
||||
- [#10623](https://github.com/facebook/docusaurus/pull/10623) chore(deps): bump actions/setup-node from 4.0.4 to 4.1.0 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10624](https://github.com/facebook/docusaurus/pull/10624) chore(deps): bump actions/dependency-review-action from 4.3.4 to 4.4.0 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10539](https://github.com/facebook/docusaurus/pull/10539) chore(deps): bump preactjs/compressed-size-action from 2.6.0 to 2.7.0 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10530](https://github.com/facebook/docusaurus/pull/10530) chore(deps): bump rollup from 2.79.1 to 2.79.2 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10518](https://github.com/facebook/docusaurus/pull/10518) chore(deps): bump actions/setup-node from 4.0.2 to 4.0.4 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10505](https://github.com/facebook/docusaurus/pull/10505) chore(deps): bump dompurify from 3.0.5 to 3.1.6 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10488](https://github.com/facebook/docusaurus/pull/10488) chore(deps): bump express from 4.19.2 to 4.20.0 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10449](https://github.com/facebook/docusaurus/pull/10449) chore(deps): bump github/codeql-action from 3.26.3 to 3.26.5 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10444](https://github.com/facebook/docusaurus/pull/10444) chore(deps): bump micromatch from 4.0.5 to 4.0.8 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10425](https://github.com/facebook/docusaurus/pull/10425) chore(deps): bump github/codeql-action from 3.26.0 to 3.26.3 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- `docusaurus-plugin-pwa`
|
||||
- [#10455](https://github.com/facebook/docusaurus/pull/10455) chore(deps): bump webpack from 5.88.1 to 5.94.0 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
|
||||
#### :wrench: Maintenance
|
||||
|
||||
- Other
|
||||
- [#10612](https://github.com/facebook/docusaurus/pull/10612) chore: fix canary version prefix ([@slorber](https://github.com/slorber))
|
||||
- [#10438](https://github.com/facebook/docusaurus/pull/10438) chore(ci): fix setup-node, use LTS by default ([@slorber](https://github.com/slorber))
|
||||
- [#10418](https://github.com/facebook/docusaurus/pull/10418) chore(website): add Rsdoctor plugin ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-babel`, `docusaurus-bundler`, `docusaurus-mdx-loader`, `docusaurus-plugin-debug`, `docusaurus-plugin-pwa`, `docusaurus-plugin-rsdoctor`, `docusaurus-theme-live-codeblock`, `docusaurus`
|
||||
- [#10610](https://github.com/facebook/docusaurus/pull/10610) chore: upgrade minor dependencies ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-bundler`, `docusaurus-faster`
|
||||
- [#10609](https://github.com/facebook/docusaurus/pull/10609) chore: upgrade faster packages ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-bundler`, `docusaurus-logger`, `docusaurus-types`, `docusaurus`
|
||||
- [#10593](https://github.com/facebook/docusaurus/pull/10593) refactor(core): refactor SSG infrastructure ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus`
|
||||
- [#10587](https://github.com/facebook/docusaurus/pull/10587) refactor(core): replace serve-handler fork by official deps ([@slorber](https://github.com/slorber))
|
||||
- [#10579](https://github.com/facebook/docusaurus/pull/10579) refactor(core): remove useless Webpack wait plugin ([@slorber](https://github.com/slorber))
|
||||
- [#10485](https://github.com/facebook/docusaurus/pull/10485) refactor(core): rewrite Webpack ChunkAssetPlugin with RuntimeModule ([@slorber](https://github.com/slorber))
|
||||
- [#10448](https://github.com/facebook/docusaurus/pull/10448) refactor(core): Restore null-loader ([@slorber](https://github.com/slorber))
|
||||
- [#10442](https://github.com/facebook/docusaurus/pull/10442) fix(core): use serve-handler fork to remove annoying punycode warning ([@slorber](https://github.com/slorber))
|
||||
- [#10410](https://github.com/facebook/docusaurus/pull/10410) refactor(core): remove useless build forceTerminate exit ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-bundler`, `docusaurus-plugin-pwa`, `docusaurus-types`, `docusaurus`
|
||||
- [#10548](https://github.com/facebook/docusaurus/pull/10548) chore: upgrade Webpack to 5.95 and related deps ([@slorber](https://github.com/slorber))
|
||||
- `create-docusaurus`
|
||||
- [#10514](https://github.com/facebook/docusaurus/pull/10514) refactor: remove babel.config.js from init templates + website ([@slorber](https://github.com/slorber))
|
||||
- `create-docusaurus`, `docusaurus-babel`, `docusaurus-bundler`, `docusaurus-mdx-loader`, `docusaurus-plugin-pwa`, `docusaurus-theme-classic`, `docusaurus-theme-translations`, `docusaurus-types`, `docusaurus-utils`, `docusaurus`
|
||||
- [#10511](https://github.com/facebook/docusaurus/pull/10511) refactor: create `@docusaurus/bundler` and `@docusaurus/babel` packages ([@slorber](https://github.com/slorber))
|
||||
- `create-docusaurus`, `docusaurus-plugin-pwa`, `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus-theme-mermaid`, `docusaurus-utils`, `docusaurus`, `eslint-plugin`
|
||||
- [#10509](https://github.com/facebook/docusaurus/pull/10509) chore: Rename Twitter links/labels to X ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-plugin-content-docs`, `docusaurus-types`, `docusaurus`
|
||||
- [#10497](https://github.com/facebook/docusaurus/pull/10497) refactor(core): prepare codebase for swappable bundler ([@slorber](https://github.com/slorber))
|
||||
- `create-docusaurus`, `docusaurus-utils`
|
||||
- [#10486](https://github.com/facebook/docusaurus/pull/10486) chore: upgrade to TS 5.6 + temporarily use skipLibCheck for TS 5.6 ([@slorber](https://github.com/slorber))
|
||||
- `create-docusaurus`, `docusaurus-logger`, `docusaurus-theme-translations`, `docusaurus`
|
||||
- [#10480](https://github.com/facebook/docusaurus/pull/10480) refactor: move PerfLogger from core to @docusaurus/logger ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-remark-plugin-npm2yarn`
|
||||
- [#10454](https://github.com/facebook/docusaurus/pull/10454) chore: upgrade npm-to-yarn to v3 ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-mdx-loader`, `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-plugin-content-pages`, `docusaurus`
|
||||
- [#10450](https://github.com/facebook/docusaurus/pull/10450) refactor(mdx-loader): refactor mdx-loader, expose loader creation utils ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-mdx-loader`, `docusaurus-utils`, `docusaurus`
|
||||
- [#10429](https://github.com/facebook/docusaurus/pull/10429) refactor(core): improve handling of server bundle ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-mdx-loader`
|
||||
- [#10422](https://github.com/facebook/docusaurus/pull/10422) refactor(mdx-loader): remove useless usage of mdx loader this.query ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### Committers: 19
|
||||
|
||||
- Andrew Asche ([@andrewasche](https://github.com/andrewasche))
|
||||
- Boris Depoortere ([@B0r1sD](https://github.com/B0r1sD))
|
||||
- Chris Cho ([@ccho-mongodb](https://github.com/ccho-mongodb))
|
||||
- Flix ([@flixyudh](https://github.com/flixyudh))
|
||||
- Joel Campos ([@TheMineWay](https://github.com/TheMineWay))
|
||||
- Kamil Moskała ([@moskalakamil](https://github.com/moskalakamil))
|
||||
- Kenrick ([@kenrick95](https://github.com/kenrick95))
|
||||
- Liviu Ionescu ([@ilg-ul](https://github.com/ilg-ul))
|
||||
- Nguyễn Thành Nam ([@namnguyenthanhwork](https://github.com/namnguyenthanhwork))
|
||||
- Patrick ([@patik123](https://github.com/patik123))
|
||||
- Raghav ([@raghav2005](https://github.com/raghav2005))
|
||||
- Sébastien Lorber ([@slorber](https://github.com/slorber))
|
||||
- Zenahr Barzani ([@Zenahr](https://github.com/Zenahr))
|
||||
- [@Olexandr88](https://github.com/Olexandr88)
|
||||
- [@Radovenchyk](https://github.com/Radovenchyk)
|
||||
- [@jackrabbit128](https://github.com/jackrabbit128)
|
||||
- [@k-seltzer](https://github.com/k-seltzer)
|
||||
- moonrailgun ([@moonrailgun](https://github.com/moonrailgun))
|
||||
- ozaki ([@OzakIOne](https://github.com/OzakIOne))
|
||||
|
||||
## 3.5.2 (2024-08-13)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
|
||||
- `docusaurus-theme-common`
|
||||
- [#10397](https://github.com/facebook/docusaurus/pull/10397) fix(theme-common): restore useContextualSearchFilters public API for retrocompatibility ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus`
|
||||
- [#10391](https://github.com/facebook/docusaurus/pull/10391) fix(core): always alias React/ReactDOM to site dependency so that importing MDX from anywhere works ([@slorber](https://github.com/slorber))
|
||||
- `create-docusaurus`, `docusaurus-plugin-content-blog`
|
||||
- [#10392](https://github.com/facebook/docusaurus/pull/10392) fix(create-docusaurus): Improve init templates blog setup + fix warnings ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-theme-classic`
|
||||
- [#10390](https://github.com/facebook/docusaurus/pull/10390) fix(theme): Adjust blog authors line height to show descenders in lowercase letters (`g`, `j`, `p`, `q`, and `y`) ([@josh-wong](https://github.com/josh-wong))
|
||||
|
||||
#### :nail_care: Polish
|
||||
|
||||
- `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus-theme-translations`
|
||||
- [#10394](https://github.com/facebook/docusaurus/pull/10394) fix(translations): change casing of some en labels ([@cstangerup](https://github.com/cstangerup))
|
||||
|
||||
#### :memo: Documentation
|
||||
|
||||
- [#10393](https://github.com/facebook/docusaurus/pull/10393) docs(showcase): remove sites not using Docusaurus anymore ([@GatienBoquet](https://github.com/GatienBoquet))
|
||||
|
||||
#### :robot: Dependencies
|
||||
|
||||
- [#10396](https://github.com/facebook/docusaurus/pull/10396) chore(deps): bump github/codeql-action from 3.25.13 to 3.26.0 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
|
||||
#### Committers: 4
|
||||
|
||||
- Christian Stangerup ([@cstangerup](https://github.com/cstangerup))
|
||||
- Gatien Boquet ([@GatienBoquet](https://github.com/GatienBoquet))
|
||||
- Josh Wong ([@josh-wong](https://github.com/josh-wong))
|
||||
- Sébastien Lorber ([@slorber](https://github.com/slorber))
|
||||
|
||||
## 3.5.1 (2024-08-09)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
|
||||
- `docusaurus-plugin-content-blog`, `docusaurus-theme-search-algolia`
|
||||
- [#10384](https://github.com/facebook/docusaurus/pull/10384) fix(core): algolia context import ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-theme-search-algolia`
|
||||
- [#10382](https://github.com/facebook/docusaurus/pull/10382) fix(theme-algolia): useDocusaurusContext import error ([@anaclumos](https://github.com/anaclumos))
|
||||
|
||||
#### Committers: 2
|
||||
|
||||
- Sunghyun Cho ([@anaclumos](https://github.com/anaclumos))
|
||||
- Sébastien Lorber ([@slorber](https://github.com/slorber))
|
||||
|
||||
## 3.5.0 (2024-08-09)
|
||||
|
||||
#### :rocket: New Feature
|
||||
|
||||
- `docusaurus-plugin-content-blog`
|
||||
- [#10375](https://github.com/facebook/docusaurus/pull/10375) feat(blog): add `onUntruncatedBlogPosts` blog options ([@OzakIOne](https://github.com/OzakIOne))
|
||||
- `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus-theme-translations`
|
||||
- [#10376](https://github.com/facebook/docusaurus/pull/10376) feat(theme): show unlisted/draft banners in dev mode ([@OzakIOne](https://github.com/OzakIOne))
|
||||
- `create-docusaurus`, `docusaurus-plugin-content-blog`
|
||||
- [#9252](https://github.com/facebook/docusaurus/pull/9252) feat(blog): add feed xlst options to render beautiful RSS and Atom feeds ([@Xebec19](https://github.com/Xebec19))
|
||||
- `docusaurus-plugin-content-blog`, `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus-theme-translations`, `docusaurus-utils`
|
||||
- [#10216](https://github.com/facebook/docusaurus/pull/10216) feat(blog): authors page ([@OzakIOne](https://github.com/OzakIOne))
|
||||
- `docusaurus-theme-translations`
|
||||
- [#10339](https://github.com/facebook/docusaurus/pull/10339) feat(translation): add Estonian default translation ([@chirbard](https://github.com/chirbard))
|
||||
- [#10325](https://github.com/facebook/docusaurus/pull/10325) feat(translations): Indonesian translation ([@priyadi](https://github.com/priyadi))
|
||||
- `docusaurus-mdx-loader`
|
||||
- [#10335](https://github.com/facebook/docusaurus/pull/10335) feat(mdx-loader): wrap mdx content title (`# Title`) in `<header>` for concistency ([@OzakIOne](https://github.com/OzakIOne))
|
||||
- `create-docusaurus`, `docusaurus-plugin-content-blog`, `docusaurus-theme-classic`, `docusaurus-utils`
|
||||
- [#10222](https://github.com/facebook/docusaurus/pull/10222) feat(blog): author header social icons ([@OzakIOne](https://github.com/OzakIOne))
|
||||
- `docusaurus-plugin-client-redirects`, `docusaurus-plugin-google-analytics`, `docusaurus-plugin-google-gtag`, `docusaurus-plugin-google-tag-manager`, `docusaurus-plugin-pwa`, `docusaurus-plugin-sitemap`, `docusaurus-plugin-vercel-analytics`, `docusaurus-types`, `docusaurus`
|
||||
- [#10286](https://github.com/facebook/docusaurus/pull/10286) feat(core): allow plugins to self-disable by returning null ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-plugin-content-blog`, `docusaurus-theme-classic`, `docusaurus-theme-common`
|
||||
- [#10252](https://github.com/facebook/docusaurus/pull/10252) feat(blog): group sidebar items by year (`themeConfig.blog.sidebar.groupByYear`) ([@alicelovescake](https://github.com/alicelovescake))
|
||||
- `docusaurus-plugin-content-blog`, `docusaurus-utils`
|
||||
- [#10224](https://github.com/facebook/docusaurus/pull/10224) feat(blog): warn duplicate and inline authors ([@OzakIOne](https://github.com/OzakIOne))
|
||||
- `docusaurus-mdx-loader`, `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-plugin-content-pages`, `docusaurus-utils-validation`
|
||||
- [#10241](https://github.com/facebook/docusaurus/pull/10241) feat(mdx): support recma plugins ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
|
||||
- `docusaurus-theme-translations`
|
||||
- [#10344](https://github.com/facebook/docusaurus/pull/10344) fix(translations): fix wrong Estonian (et) translations and typos ([@Gekd](https://github.com/Gekd))
|
||||
- [#10360](https://github.com/facebook/docusaurus/pull/10360) fix(translations): Fix and Improve Spanish translations ([@sergioalmela](https://github.com/sergioalmela))
|
||||
- [#10235](https://github.com/facebook/docusaurus/pull/10235) fix(theme-translation): add missing German (de) theme.admonition translations ([@franzd1](https://github.com/franzd1))
|
||||
- `docusaurus-theme-search-algolia`
|
||||
- [#10342](https://github.com/facebook/docusaurus/pull/10342) fix(search): fix algolia search ignore ctrl + F in search input ([@mxschmitt](https://github.com/mxschmitt))
|
||||
- `docusaurus-plugin-content-docs`
|
||||
- [#10324](https://github.com/facebook/docusaurus/pull/10324) fix(docs): the _category_.json description attribute should display on generated index pages ([@bharateshwq](https://github.com/bharateshwq))
|
||||
- [#10309](https://github.com/facebook/docusaurus/pull/10309) fix(theme): docsVersionDropdown navbar item not showing the appropriate version ([@OzakIOne](https://github.com/OzakIOne))
|
||||
- `docusaurus`
|
||||
- [#10368](https://github.com/facebook/docusaurus/pull/10368) fix(cli): Fix bad docusaurus CLI behavior on for --version, -V, --help, -h ([@ashiq-firoz](https://github.com/ashiq-firoz))
|
||||
- [#10311](https://github.com/facebook/docusaurus/pull/10311) fix(core): revert wrong anchor link implementation change ([@slorber](https://github.com/slorber))
|
||||
- [#10239](https://github.com/facebook/docusaurus/pull/10239) fix(core): fail fast if plugin has no name ([@slorber](https://github.com/slorber))
|
||||
- [#10225](https://github.com/facebook/docusaurus/pull/10225) fix(core): fix sites unable to start/build without a static dir ([@slorber](https://github.com/slorber))
|
||||
- [#10223](https://github.com/facebook/docusaurus/pull/10223) fix: escape period ([@d4nyll](https://github.com/d4nyll))
|
||||
- `docusaurus-theme-classic`
|
||||
- [#10288](https://github.com/facebook/docusaurus/pull/10288) fix(theme): fix DocsVersionDropdownNavbarItem version link target ([@slorber](https://github.com/slorber))
|
||||
- [#10219](https://github.com/facebook/docusaurus/pull/10219) fix(theme): ignored className attribute on lazy loaded TabItem ([@lebalz](https://github.com/lebalz))
|
||||
- `docusaurus-utils`
|
||||
- [#10240](https://github.com/facebook/docusaurus/pull/10240) fix(markdown): mdx-code-block should support intentation ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### :nail_care: Polish
|
||||
|
||||
- `docusaurus-theme-translations`
|
||||
- [#10257](https://github.com/facebook/docusaurus/pull/10257) chore(theme-translations): add more Traditional Chinese(zh-Hant) translations ([@pjchender](https://github.com/pjchender))
|
||||
|
||||
#### :memo: Documentation
|
||||
|
||||
- Other
|
||||
- [#10361](https://github.com/facebook/docusaurus/pull/10361) docs: rename @getcanary/docusaurus-pagefind in docs ([@yujonglee](https://github.com/yujonglee))
|
||||
- [#10345](https://github.com/facebook/docusaurus/pull/10345) docs: Add @getcanary/docusaurus-pagefind in docs ([@yujonglee](https://github.com/yujonglee))
|
||||
- [#10337](https://github.com/facebook/docusaurus/pull/10337) docs: fix default value for `docRootComponent` ([@ultimate](https://github.com/ultimate))
|
||||
- [#10310](https://github.com/facebook/docusaurus/pull/10310) docs: remove deprecated partial toc warning ([@slorber](https://github.com/slorber))
|
||||
- [#10245](https://github.com/facebook/docusaurus/pull/10245) docs: add emoji for consistency ([@Paneedah](https://github.com/Paneedah))
|
||||
- [#10180](https://github.com/facebook/docusaurus/pull/10180) docs: backport #10173 to v3.3 + v3.4 & revise the content ([@tats-u](https://github.com/tats-u))
|
||||
- [#10233](https://github.com/facebook/docusaurus/pull/10233) docs(search): update docsearch api url ([@dhayab](https://github.com/dhayab))
|
||||
- `docusaurus-plugin-google-gtag`
|
||||
- [#10338](https://github.com/facebook/docusaurus/pull/10338) docs(plugin-google-gtag): replace the broken Google Developers links with valid ones ([@bohyunjung](https://github.com/bohyunjung))
|
||||
|
||||
#### :robot: Dependencies
|
||||
|
||||
- [#10330](https://github.com/facebook/docusaurus/pull/10330) chore(deps): bump github/codeql-action from 3.25.12 to 3.25.13 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10299](https://github.com/facebook/docusaurus/pull/10299) chore(deps): bump actions/dependency-review-action from 4.3.3 to 4.3.4 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10300](https://github.com/facebook/docusaurus/pull/10300) chore(deps): bump github/codeql-action from 3.25.11 to 3.25.12 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10259](https://github.com/facebook/docusaurus/pull/10259) chore(deps): bump github/codeql-action from 3.25.10 to 3.25.11 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10247](https://github.com/facebook/docusaurus/pull/10247) chore(deps): bump treosh/lighthouse-ci-action from 11.4.0 to 12.1.0 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10226](https://github.com/facebook/docusaurus/pull/10226) chore(deps): bump github/codeql-action from 3.25.8 to 3.25.10 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10227](https://github.com/facebook/docusaurus/pull/10227) chore(deps): bump ws from 7.5.9 to 7.5.10 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10210](https://github.com/facebook/docusaurus/pull/10210) chore(deps): bump braces from 3.0.2 to 3.0.3 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10209](https://github.com/facebook/docusaurus/pull/10209) chore(deps): bump actions/dependency-review-action from 4.3.2 to 4.3.3 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10208](https://github.com/facebook/docusaurus/pull/10208) chore(deps): bump github/codeql-action from 3.25.7 to 3.25.8 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10195](https://github.com/facebook/docusaurus/pull/10195) chore(deps): bump github/codeql-action from 3.25.6 to 3.25.7 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
|
||||
#### :wrench: Maintenance
|
||||
|
||||
- Other
|
||||
- [#10369](https://github.com/facebook/docusaurus/pull/10369) feat(ci): continuous releases for main and PRs with pkg.pr.new ([@Aslemammad](https://github.com/Aslemammad))
|
||||
- `docusaurus-theme-classic`
|
||||
- [#10343](https://github.com/facebook/docusaurus/pull/10343) chore(deps): update infima npm dependency to version 0.2.0-alpha.44 ([@hichemfantar](https://github.com/hichemfantar))
|
||||
- `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus-theme-search-algolia`
|
||||
- [#10316](https://github.com/facebook/docusaurus/pull/10316) refactor(docs): theme-common shouldn't depend on docs content ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-plugin-content-blog`, `docusaurus-theme-classic`, `docusaurus-theme-common`
|
||||
- [#10313](https://github.com/facebook/docusaurus/pull/10313) refactor(blog): theme-common shouldn't depend on blog content plugins ([@slorber](https://github.com/slorber))
|
||||
- `create-docusaurus`, `docusaurus-cssnano-preset`, `docusaurus-logger`, `docusaurus-mdx-loader`, `docusaurus-plugin-client-redirects`, `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-plugin-content-pages`, `docusaurus-plugin-debug`, `docusaurus-plugin-google-analytics`, `docusaurus-plugin-google-gtag`, `docusaurus-plugin-google-tag-manager`, `docusaurus-plugin-ideal-image`, `docusaurus-plugin-pwa`, `docusaurus-plugin-sitemap`, `docusaurus-plugin-vercel-analytics`, `docusaurus-preset-classic`, `docusaurus-remark-plugin-npm2yarn`, `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus-theme-live-codeblock`, `docusaurus-theme-mermaid`, `docusaurus-theme-search-algolia`, `docusaurus-theme-translations`, `docusaurus-utils-common`, `docusaurus-utils-validation`, `docusaurus-utils`, `docusaurus`, `eslint-plugin`, `lqip-loader`, `stylelint-copyright`
|
||||
- [#10256](https://github.com/facebook/docusaurus/pull/10256) chore: simplify TypeScript configs, use TS 5.5 configDir placeholder ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### Committers: 25
|
||||
|
||||
- Aaron Chen ([@pjchender](https://github.com/pjchender))
|
||||
- Alice Zhao ([@alicelovescake](https://github.com/alicelovescake))
|
||||
- Ashiq Firoz ([@ashiq-firoz](https://github.com/ashiq-firoz))
|
||||
- Balthasar Hofer ([@lebalz](https://github.com/lebalz))
|
||||
- Bharatesh ([@bharateshwq](https://github.com/bharateshwq))
|
||||
- Daniel Li ([@d4nyll](https://github.com/d4nyll))
|
||||
- Dhaya ([@dhayab](https://github.com/dhayab))
|
||||
- Hichem Fantar ([@hichemfantar](https://github.com/hichemfantar))
|
||||
- John Reilly ([@johnnyreilly](https://github.com/johnnyreilly))
|
||||
- Joshua Chen ([@Josh-Cena](https://github.com/Josh-Cena))
|
||||
- Julian V ([@ultimate](https://github.com/ultimate))
|
||||
- Markus Tamm ([@chirbard](https://github.com/chirbard))
|
||||
- Max Schmitt ([@mxschmitt](https://github.com/mxschmitt))
|
||||
- Mohammad Bagher Abiyat ([@Aslemammad](https://github.com/Aslemammad))
|
||||
- Paneedah ([@Paneedah](https://github.com/Paneedah))
|
||||
- Priyadi Iman Nurcahyo ([@priyadi](https://github.com/priyadi))
|
||||
- Robin Otter ([@Gekd](https://github.com/Gekd))
|
||||
- Rohan Thakur ([@Xebec19](https://github.com/Xebec19))
|
||||
- Sergio ([@sergioalmela](https://github.com/sergioalmela))
|
||||
- Sébastien Lorber ([@slorber](https://github.com/slorber))
|
||||
- Tatsunori Uchino ([@tats-u](https://github.com/tats-u))
|
||||
- [@franzd1](https://github.com/franzd1)
|
||||
- ozaki ([@OzakIOne](https://github.com/OzakIOne))
|
||||
- yujonglee ([@yujonglee](https://github.com/yujonglee))
|
||||
- 정보현 Bohyun Jung ([@bohyunjung](https://github.com/bohyunjung))
|
||||
|
||||
## 3.4.0 (2024-05-31)
|
||||
|
||||
#### :rocket: New Feature
|
||||
|
||||
- `create-docusaurus`, `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-theme-classic`, `docusaurus-utils-validation`, `docusaurus-utils`
|
||||
- [#10137](https://github.com/facebook/docusaurus/pull/10137) feat(docs, blog): add support for `tags.yml`, predefined list of tags ([@OzakIOne](https://github.com/OzakIOne))
|
||||
- `docusaurus-theme-translations`
|
||||
- [#10151](https://github.com/facebook/docusaurus/pull/10151) feat(theme-translations): Added Turkmen (tk) default theme translations ([@ilmedova](https://github.com/ilmedova))
|
||||
- [#10111](https://github.com/facebook/docusaurus/pull/10111) feat(theme-translations): Add Bulgarian default theme translations (bg) ([@PetarMc1](https://github.com/PetarMc1))
|
||||
- `docusaurus-plugin-client-redirects`, `docusaurus-plugin-content-blog`, `docusaurus-plugin-pwa`, `docusaurus-plugin-sitemap`, `docusaurus-theme-search-algolia`, `docusaurus-types`, `docusaurus-utils`, `docusaurus`
|
||||
- [#9859](https://github.com/facebook/docusaurus/pull/9859) feat(core): hash router option - browse site offline (experimental) ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-module-type-aliases`, `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus-types`, `docusaurus`
|
||||
- [#10121](https://github.com/facebook/docusaurus/pull/10121) feat(core): site storage config options (experimental) ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
|
||||
- `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-utils`
|
||||
- [#10185](https://github.com/facebook/docusaurus/pull/10185) fix(docs, blog): Markdown link resolution does not support hot reload ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-theme-search-algolia`
|
||||
- [#10178](https://github.com/facebook/docusaurus/pull/10178) fix(theme): SearchPage should respect `contextualSearch: false` setting ([@ncoughlin](https://github.com/ncoughlin))
|
||||
- [#10164](https://github.com/facebook/docusaurus/pull/10164) fix(search): fix algolia search container bug ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-mdx-loader`, `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-plugin-content-pages`, `docusaurus-utils`
|
||||
- [#10168](https://github.com/facebook/docusaurus/pull/10168) fix(mdx-loader): resolve Markdown/MDX links with Remark instead of RegExp ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-theme-translations`
|
||||
- [#10165](https://github.com/facebook/docusaurus/pull/10165) fix(theme-translation): add missing Korean (ko) theme translations ([@revi](https://github.com/revi))
|
||||
- [#10157](https://github.com/facebook/docusaurus/pull/10157) fix(theme-translations): complete Vietnamese theme translations ([@namnguyenthanhwork](https://github.com/namnguyenthanhwork))
|
||||
- `docusaurus`
|
||||
- [#10145](https://github.com/facebook/docusaurus/pull/10145) fix(core): fix serve workaround regexp ([@slorber](https://github.com/slorber))
|
||||
- [#10142](https://github.com/facebook/docusaurus/pull/10142) fix(core): fix `docusaurus serve` broken for assets when using trailingSlash ([@slorber](https://github.com/slorber))
|
||||
- [#10130](https://github.com/facebook/docusaurus/pull/10130) fix(core): the broken anchor checker should not be sensitive pathname trailing slashes ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-theme-classic`, `docusaurus-theme-common`
|
||||
- [#10144](https://github.com/facebook/docusaurus/pull/10144) fix(theme): fix announcement bar layout shift due to missing storage key namespace ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-plugin-content-docs`, `docusaurus`
|
||||
- [#10132](https://github.com/facebook/docusaurus/pull/10132) fix(core): `configurePostCss()` should run after `configureWebpack()` ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-utils`, `docusaurus`
|
||||
- [#10131](https://github.com/facebook/docusaurus/pull/10131) fix(core): codegen should generate unique route prop filenames ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-theme-classic`, `docusaurus-theme-translations`
|
||||
- [#10118](https://github.com/facebook/docusaurus/pull/10118) fix(theme-translations): fix missing pluralization for label DocCard.categoryDescription.plurals ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### :memo: Documentation
|
||||
|
||||
- [#10176](https://github.com/facebook/docusaurus/pull/10176) docs: add community plugin docusaurus-graph ([@Arsero](https://github.com/Arsero))
|
||||
- [#10173](https://github.com/facebook/docusaurus/pull/10173) docs: improve how to use `<details>` ([@tats-u](https://github.com/tats-u))
|
||||
- [#10167](https://github.com/facebook/docusaurus/pull/10167) docs: suggest using `{<...>...</...>}` if don't use Markdown in migra… ([@tats-u](https://github.com/tats-u))
|
||||
- [#10143](https://github.com/facebook/docusaurus/pull/10143) docs: recommend users to remove hast-util-is-element in migration to v3 ([@tats-u](https://github.com/tats-u))
|
||||
- [#10124](https://github.com/facebook/docusaurus/pull/10124) docs: v3 prepare your site blog post should point users to the upgrade guide ([@homotechsual](https://github.com/homotechsual))
|
||||
|
||||
#### :robot: Dependencies
|
||||
|
||||
- [#10155](https://github.com/facebook/docusaurus/pull/10155) chore(deps): bump peaceiris/actions-gh-pages from 3 to 4 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10154](https://github.com/facebook/docusaurus/pull/10154) chore(deps): bump github/codeql-action from 2.13.4 to 3.25.6 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10112](https://github.com/facebook/docusaurus/pull/10112) chore(deps): bump actions/dependency-review-action from 4.3.1 to 4.3.2 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
|
||||
#### Committers: 11
|
||||
|
||||
- Azzedine E. ([@Arsero](https://github.com/Arsero))
|
||||
- CodeDoctor ([@CodeDoctorDE](https://github.com/CodeDoctorDE))
|
||||
- Mahri Ilmedova ([@ilmedova](https://github.com/ilmedova))
|
||||
- Mikey O'Toole ([@homotechsual](https://github.com/homotechsual))
|
||||
- Nguyễn Thành Nam ([@namnguyenthanhwork](https://github.com/namnguyenthanhwork))
|
||||
- Nick Coughlin ([@ncoughlin](https://github.com/ncoughlin))
|
||||
- Petar_mc ([@PetarMc1](https://github.com/PetarMc1))
|
||||
- Sébastien Lorber ([@slorber](https://github.com/slorber))
|
||||
- Tatsunori Uchino ([@tats-u](https://github.com/tats-u))
|
||||
- Yongmin ([@revi](https://github.com/revi))
|
||||
- ozaki ([@OzakIOne](https://github.com/OzakIOne))
|
||||
|
||||
## 3.3.2 (2024-05-03)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# Code of Conduct
|
||||
|
||||
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.fb.com/codeofconduct/) so that you can understand what actions will and will not be tolerated.
|
||||
Meta has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.fb.com/codeofconduct/) so that you can understand what actions will and will not be tolerated.
|
||||
|
|
|
@ -9,7 +9,7 @@ The [Open Source Guides](https://opensource.guide/) website has a collection of
|
|||
|
||||
## Code of Conduct
|
||||
|
||||
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.fb.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
|
||||
Meta has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.fb.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
|
||||
|
||||
## Get Involved
|
||||
|
||||
|
@ -21,7 +21,7 @@ There are many ways to contribute to Docusaurus, and many of them do not involve
|
|||
- Read through the [Docusaurus docs](https://docusaurus.io/docs/installation). If you find anything that is confusing or can be improved, you can click "Edit this page" at the bottom of most docs, which takes you to the GitHub interface to make and propose changes.
|
||||
- Take a look at the [features requested](https://github.com/facebook/docusaurus/labels/feature) by others in the community and consider opening a pull request if you see something you want to work on.
|
||||
|
||||
Contributions are very welcome. If you think you need help planning your contribution, please ping us on Twitter at [@docusaurus](https://twitter.com/docusaurus) and let us know you are looking for a bit of help.
|
||||
Contributions are very welcome. If you think you need help planning your contribution, please ping us on X at [@docusaurus](https://x.com/docusaurus) and let us know you are looking for a bit of help.
|
||||
|
||||
### Join our Discord Channel
|
||||
|
||||
|
@ -63,7 +63,7 @@ If you're only fixing a bug, it's fine to submit a pull request right away but w
|
|||
|
||||
### Security Bugs
|
||||
|
||||
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. With that in mind, please do not file public issues; go through the process outlined on that page.
|
||||
Meta has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. With that in mind, please do not file public issues; go through the process outlined on that page.
|
||||
|
||||
### Feature requests
|
||||
|
||||
|
@ -206,7 +206,7 @@ This is also auto-fixable with the `header/header` ESLint rule.
|
|||
|
||||
### Contributor License Agreement (CLA)
|
||||
|
||||
In order to accept your pull request, we need you to submit a CLA. You only need to do this once, so if you've done this for another Facebook open source project, you're good to go. If you are submitting a pull request for the first time, the Facebook GitHub Bot will reply with a link to the CLA form. You may also [complete your CLA here](https://code.facebook.com/cla).
|
||||
In order to accept your pull request, we need you to submit a CLA. You only need to do this once, so if you've done this for another Meta open source project, you're good to go. If you are submitting a pull request for the first time, the Meta GitHub Bot will reply with a link to the CLA form. You may also [complete your CLA here](https://code.facebook.com/cla).
|
||||
|
||||
After you have signed the CLA, the CLA bot would automatically update the PR status. There's no need to open a new PR.
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</div>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://twitter.com/docusaurus"><img src="https://img.shields.io/twitter/follow/docusaurus.svg?style=social" align="right" alt="Twitter Follow" /></a>
|
||||
<a href="https://x.com/docusaurus"><img src="https://img.shields.io/twitter/follow/docusaurus.svg?style=social" align="right" alt="Twitter Follow" /></a>
|
||||
<a href="#backers" alt="sponsors on Open Collective"><img src="https://opencollective.com/Docusaurus/backers/badge.svg" /></a>
|
||||
<a href="#sponsors" alt="Sponsors on Open Collective"><img src="https://opencollective.com/Docusaurus/sponsors/badge.svg" /></a>
|
||||
<a href="https://www.npmjs.com/package/@docusaurus/core"><img src="https://img.shields.io/npm/v/@docusaurus/core.svg?style=flat" alt="npm version"></a>
|
||||
|
@ -59,11 +59,11 @@ npm init docusaurus@latest
|
|||
|
||||
## Contributing
|
||||
|
||||
We've released Docusaurus because it helps us better scale and supports the many OSS projects at Facebook. We hope that other organizations can benefit from the project. We are thankful for any contributions from the community.
|
||||
We've released Docusaurus because it helps us better scale and supports the many OSS projects at Meta. We hope that other organizations can benefit from the project. We are thankful for any contributions from the community.
|
||||
|
||||
### [Code of Conduct](https://code.fb.com/codeofconduct)
|
||||
|
||||
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.fb.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
|
||||
Meta has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.fb.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
|
||||
|
||||
### Contributing guide
|
||||
|
||||
|
@ -80,7 +80,7 @@ We have a few channels for contact:
|
|||
- [Discord](https://discord.gg/docusaurus):
|
||||
- `#general` for those using Docusaurus.
|
||||
- `#contributors` for those wanting to contribute to the Docusaurus core.
|
||||
- [@docusaurus](https://twitter.com/docusaurus) on Twitter
|
||||
- [@docusaurus](https://x.com/docusaurus) X
|
||||
- [GitHub Issues](https://github.com/facebook/docusaurus/issues)
|
||||
|
||||
## Contributors
|
||||
|
|
|
@ -35,15 +35,6 @@ const tsconfigSchema = Joi.object({
|
|||
'../../tsconfig.base.json',
|
||||
'../../tsconfig.base.client.json',
|
||||
),
|
||||
compilerOptions: Joi.object({
|
||||
rootDir: Joi.valid('src').required(),
|
||||
outDir: Joi.valid('lib').required(),
|
||||
tsBuildInfoFile: Joi.valid(
|
||||
'lib/.tsbuildinfo',
|
||||
'lib/.tsbuildinfo-client',
|
||||
'lib/.tsbuildinfo-worker',
|
||||
),
|
||||
}).unknown(),
|
||||
}).unknown();
|
||||
|
||||
describe('tsconfig files', () => {
|
||||
|
@ -52,7 +43,6 @@ describe('tsconfig files', () => {
|
|||
|
||||
tsconfigFiles
|
||||
// Ignore noEmit configs
|
||||
.filter((file) => !(file.content.compilerOptions!.noEmit === true))
|
||||
.forEach((file) => {
|
||||
try {
|
||||
Joi.attempt(file.content, tsconfigSchema);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "new.docusaurus.io",
|
||||
"version": "3.3.2",
|
||||
"version": "3.7.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "npx --package netlify-cli netlify dev"
|
||||
|
|
|
@ -218,7 +218,7 @@ Create a separate branch/PR and run `yarn examples:generate`
|
|||
|
||||
### 9. Notify people about new release (optional but desirable)
|
||||
|
||||
After new release, it is cool to notify our users about this in the Discord chat (`#announcements` channel) and write summaries on Twitter using the following templates.
|
||||
After new release, it is cool to notify our users about this in the Discord chat (`#announcements` channel) and write summaries on X using the following templates.
|
||||
|
||||
For Discord:
|
||||
|
||||
|
@ -227,7 +227,7 @@ A new version %VER% is available now! 🎉
|
|||
See release notes at the following link https://github.com/facebook/docusaurus/releases/tag/%VER%
|
||||
```
|
||||
|
||||
For Twitter:
|
||||
For X:
|
||||
|
||||
```
|
||||
💥 A new version %VER% is available now! 💥
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
// @ts-check
|
||||
|
||||
/** @typedef {Record<'performance' | 'accessibility' | 'best-practices' | 'seo' | 'pwa', number>} LighthouseSummary */
|
||||
/** @typedef {Record<'performance' | 'accessibility' | 'best-practices' | 'seo', number>} LighthouseSummary */
|
||||
|
||||
/** @type {Record<keyof LighthouseSummary, string>} */
|
||||
const summaryKeys = {
|
||||
|
@ -15,7 +15,6 @@ const summaryKeys = {
|
|||
accessibility: 'Accessibility',
|
||||
'best-practices': 'Best Practices',
|
||||
seo: 'SEO',
|
||||
pwa: 'PWA',
|
||||
};
|
||||
|
||||
/** @param {number} rawScore */
|
||||
|
@ -42,16 +41,23 @@ function createURL(url) {
|
|||
* @param {Object} param0
|
||||
* @param {string} param0.url
|
||||
* @param {LighthouseSummary} param0.summary
|
||||
* @param {string} param0.reportUrl
|
||||
* @param {string | undefined} param0.reportUrl
|
||||
* @return {string}
|
||||
*/
|
||||
const createMarkdownTableRow = ({url, summary, reportUrl}) =>
|
||||
[
|
||||
`| [${createURL(url).pathname}](${url})`,
|
||||
const createMarkdownTableRow = ({url, summary, reportUrl}) => {
|
||||
const columns = [
|
||||
`[${createURL(url).pathname}](${url})`,
|
||||
|
||||
.../** @type {(keyof LighthouseSummary)[]} */ (
|
||||
Object.keys(summaryKeys)
|
||||
).map((k) => scoreEntry(summary[k])),
|
||||
`[Report](${reportUrl}) |`,
|
||||
].join(' | ');
|
||||
|
||||
// See https://github.com/facebook/docusaurus/pull/10527
|
||||
reportUrl ? `[Report](${reportUrl})` : `Report N/A`,
|
||||
];
|
||||
|
||||
return `| ${columns.join(' | ')} |`;
|
||||
};
|
||||
|
||||
const createMarkdownTableHeader = () => [
|
||||
['| URL', ...Object.values(summaryKeys), 'Report |'].join(' | '),
|
||||
|
@ -65,18 +71,15 @@ const createMarkdownTableHeader = () => [
|
|||
* @param {Record<string, string>} param0.links
|
||||
* @param {{url: string, summary: LighthouseSummary}[]} param0.results
|
||||
*/
|
||||
const createLighthouseReport = ({results, links}) => {
|
||||
export default function formatLighthouseReport({results, links}) {
|
||||
const tableHeader = createMarkdownTableHeader();
|
||||
const tableBody = results.map((result) => {
|
||||
const testUrl = /** @type {string} */ (
|
||||
Object.keys(links).find((key) => key === result.url)
|
||||
);
|
||||
const reportPublicUrl = /** @type {string} */ (links[testUrl]);
|
||||
|
||||
const {url, summary} = result;
|
||||
const reportUrl = /** @type {string | undefined} */ (links[result.url]);
|
||||
return createMarkdownTableRow({
|
||||
url: testUrl,
|
||||
summary: result.summary,
|
||||
reportUrl: reportPublicUrl,
|
||||
url,
|
||||
summary,
|
||||
reportUrl,
|
||||
});
|
||||
});
|
||||
const comment = [
|
||||
|
@ -87,6 +90,4 @@ const createLighthouseReport = ({results, links}) => {
|
|||
'',
|
||||
];
|
||||
return comment.join('\n');
|
||||
};
|
||||
|
||||
export default createLighthouseReport;
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@ import fs from 'fs-extra';
|
|||
import path from 'path';
|
||||
import {fileURLToPath} from 'url';
|
||||
import {program} from 'commander';
|
||||
import logger from '@docusaurus/logger';
|
||||
import {logger} from '@docusaurus/logger';
|
||||
import sharp from 'sharp';
|
||||
import imageSize from 'image-size';
|
||||
import {imageSizeFromFile} from 'image-size/fromFile';
|
||||
|
||||
// You can use it as:
|
||||
//
|
||||
|
@ -64,7 +64,7 @@ program
|
|||
|
||||
await Promise.all(
|
||||
images.map(async (imgPath) => {
|
||||
const {width, height} = imageSize(imgPath);
|
||||
const {width, height} = await imageSizeFromFile(imgPath);
|
||||
const targetWidth =
|
||||
options.width ?? (imgPath.includes(showcasePath) ? 640 : 1000);
|
||||
const targetHeight =
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
set -euo pipefail
|
||||
set -xeuo pipefail
|
||||
|
||||
rm -rf ../test-website
|
||||
|
||||
CUSTOM_REGISTRY_URL="http://localhost:4873"
|
||||
NEW_VERSION="$(node -p "require('./packages/docusaurus/package.json').version")-NEW"
|
||||
|
@ -52,7 +54,8 @@ git diff --name-only -- '*.json' | sed 's, ,\\&,g' | xargs git checkout --
|
|||
cd ..
|
||||
|
||||
# Build skeleton website with new version
|
||||
npm_config_registry="$CUSTOM_REGISTRY_URL" npx create-docusaurus@"$NEW_VERSION" test-website classic --javascript $EXTRA_OPTS
|
||||
npm_config_registry="$CUSTOM_REGISTRY_URL" npx --yes --loglevel silly create-docusaurus@"$NEW_VERSION" test-website classic --javascript $EXTRA_OPTS
|
||||
|
||||
|
||||
# Stop Docker container
|
||||
if [[ -z "${KEEP_CONTAINER:-true}" ]] && ( $(docker container inspect "$CONTAINER_NAME" > /dev/null 2>&1) ); then
|
||||
|
|
49
admin/test-bad-package/README.mdx
Normal file
49
admin/test-bad-package/README.mdx
Normal file
|
@ -0,0 +1,49 @@
|
|||
# test-bad-package
|
||||
|
||||
This package declares a wrong React version on purpose (16.14.0)
|
||||
|
||||
The goal is to test that the MD/MDX content of this package can still be imported/rendered by our website.
|
||||
|
||||
See related issue https://github.com/facebook/docusaurus/issues/9027
|
||||
|
||||
---
|
||||
|
||||
import {version as ReactVersion} from 'react';
|
||||
import {version as ReactDOMVersion} from 'react-dom';
|
||||
|
||||
export function TestComponent() {
|
||||
const expectedVersion = 19;
|
||||
if (!ReactVersion.startsWith(`${expectedVersion}`)) {
|
||||
throw new Error(
|
||||
`'test-bad-package/README.mdx' is rendered with bad React version: ${ReactVersion}`,
|
||||
);
|
||||
}
|
||||
if (!ReactVersion.startsWith(`${expectedVersion}`)) {
|
||||
throw new Error(
|
||||
`'test-bad-package/README.mdx' is rendered with bad React-DOM version: ${ReactDOMVersion}`,
|
||||
);
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<div>React version: {ReactVersion}</div>
|
||||
<div>React DOM version: {ReactDOMVersion}</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
<TestComponent />
|
||||
|
||||
---
|
||||
|
||||
## MDX Components work:
|
||||
|
||||
<details>
|
||||
<summary>Summary</summary>
|
||||
|
||||
Details
|
||||
|
||||
</details>
|
||||
|
||||
```js
|
||||
const age = 42;
|
||||
```
|
10
admin/test-bad-package/package.json
Normal file
10
admin/test-bad-package/package.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"name": "test-bad-package",
|
||||
"version": "3.7.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@mdx-js/react": "1.0.1",
|
||||
"react": "16.14.0",
|
||||
"react-dom": "16.14.0"
|
||||
}
|
||||
}
|
|
@ -1,17 +1,17 @@
|
|||
{
|
||||
"name": "argos",
|
||||
"version": "3.3.2",
|
||||
"version": "3.7.0",
|
||||
"description": "Argos visual diff tests",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"screenshot": "playwright test",
|
||||
"upload": "npx @argos-ci/cli upload ./screenshots",
|
||||
"upload": "npx @argos-ci/cli upload ./screenshots/chromium",
|
||||
"report": "playwright show-report"
|
||||
},
|
||||
"dependencies": {
|
||||
"@argos-ci/playwright": "^1.9.3",
|
||||
"@playwright/test": "^1.41.2",
|
||||
"cheerio": "^1.0.0-rc.12"
|
||||
"@argos-ci/playwright": "^2.0.0",
|
||||
"@playwright/test": "^1.48.1",
|
||||
"cheerio": "1.0.0-rc.12"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,8 +41,28 @@ function isBlacklisted(pathname: string) {
|
|||
'/feature-requests',
|
||||
// Flaky because of dynamic canary version fetched from npm
|
||||
'/community/canary',
|
||||
// Flaky because of screenshots being taken dynamically
|
||||
'/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/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 (
|
||||
|
@ -50,6 +70,13 @@ function isBlacklisted(pathname: string) {
|
|||
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)
|
||||
);
|
||||
|
@ -103,28 +130,26 @@ function throwOnConsole(page: Page) {
|
|||
const typesToCheck = ['error', 'warning'];
|
||||
|
||||
const ignoreMessages = [
|
||||
// This mismatch warning looks like a React 18 bug to me
|
||||
'Warning: Prop `%s` did not match. Server: %s Client: %s%s className "null" ""',
|
||||
|
||||
// TODO this fetch error message is unexpected and should be fixed
|
||||
// it's already happening in main branch
|
||||
'Failed to load resource: the server responded with a status of 404 (Not Found)',
|
||||
|
||||
// TODO looks like a legit hydration bug to fix
|
||||
// on /blog/releases/2.4
|
||||
'Warning: Prop `%s` did not match. Server: %s Client: %s%s href "/docs" "/docs?docusaurus-theme=light"',
|
||||
'Warning: Prop `%s` did not match. Server: %s Client: %s%s href "/docs" "/docs?docusaurus-theme=dark"',
|
||||
// on /blog/releases/3.0
|
||||
'Warning: Prop `%s` did not match. Server: %s Client: %s%s href "/docs" "/docs?docusaurus-data-navbar=false&docusaurus-data-red-border"',
|
||||
// on /docs/styling-layout
|
||||
'Warning: Prop `%s` did not match. Server: %s Client: %s%s href "/docs" "/docs?docusaurus-data-navbar=false&docusaurus-data-red-border"',
|
||||
'Warning: Prop `%s` did not match. Server: %s Client: %s%s href "/docs/configuration" "/docs/configuration?docusaurus-theme=light"',
|
||||
'Warning: Prop `%s` did not match. Server: %s Client: %s%s href "/docs/configuration" "/docs/configuration?docusaurus-theme=dark"',
|
||||
// TODO legit hydration bugs to fix on embeds of /docs/styling-layout
|
||||
// useLocation() returns window.search/hash immediately :s
|
||||
'/docs/configuration?docusaurus-theme=light',
|
||||
'/docs/configuration?docusaurus-theme=dark',
|
||||
|
||||
// Warning because react-live not supporting React automatic JSX runtime
|
||||
// See https://github.com/FormidableLabs/react-live/issues/405
|
||||
'Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance',
|
||||
|
||||
// TODO weird problem related to KaTeX fonts refusing to decode?
|
||||
// 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) => {
|
||||
|
|
2
examples/README.md
generated
2
examples/README.md
generated
|
@ -2,7 +2,7 @@
|
|||
|
||||
These example projects are generated with the init CLI:
|
||||
|
||||
```
|
||||
```bash
|
||||
npx @docusaurus/init@latest init examples/<templateName> <templateName>`
|
||||
```
|
||||
|
||||
|
|
10
examples/classic-typescript/README.md
generated
10
examples/classic-typescript/README.md
generated
|
@ -4,13 +4,13 @@ This website is built using [Docusaurus](https://docusaurus.io/), a modern stati
|
|||
|
||||
### Installation
|
||||
|
||||
```
|
||||
```bash
|
||||
$ yarn
|
||||
```
|
||||
|
||||
### Local Development
|
||||
|
||||
```
|
||||
```bash
|
||||
$ yarn start
|
||||
```
|
||||
|
||||
|
@ -18,7 +18,7 @@ This command starts a local development server and opens up a browser window. Mo
|
|||
|
||||
### Build
|
||||
|
||||
```
|
||||
```bash
|
||||
$ yarn build
|
||||
```
|
||||
|
||||
|
@ -28,13 +28,13 @@ This command generates static content into the `build` directory and can be serv
|
|||
|
||||
Using SSH:
|
||||
|
||||
```
|
||||
```bash
|
||||
$ USE_SSH=true yarn deploy
|
||||
```
|
||||
|
||||
Not using SSH:
|
||||
|
||||
```
|
||||
```bash
|
||||
$ GIT_USER=<Your GitHub username> yarn deploy
|
||||
```
|
||||
|
||||
|
|
3
examples/classic-typescript/babel.config.js
generated
3
examples/classic-typescript/babel.config.js
generated
|
@ -1,3 +0,0 @@
|
|||
module.exports = {
|
||||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
|
||||
};
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
slug: first-blog-post
|
||||
title: First Blog Post
|
||||
authors:
|
||||
name: Gao Wei
|
||||
title: Docusaurus Core Team
|
||||
url: https://github.com/wgao19
|
||||
image_url: https://github.com/wgao19.png
|
||||
authors: [slorber, yangshun]
|
||||
tags: [hola, docusaurus]
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
||||
Lorem ipsum dolor sit amet...
|
||||
|
||||
<!-- truncate -->
|
||||
|
||||
...consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
slug: long-blog-post
|
||||
title: Long Blog Post
|
||||
authors: endi
|
||||
authors: yangshun
|
||||
tags: [hello, docusaurus]
|
||||
---
|
||||
|
||||
|
@ -9,7 +9,7 @@ This is the summary of a very long blog post,
|
|||
|
||||
Use a `<!--` `truncate` `-->` comment to limit blog post size in the list view.
|
||||
|
||||
<!--truncate-->
|
||||
<!-- truncate -->
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
||||
|
||||
|
|
|
@ -11,10 +11,14 @@ Blog posts support [Docusaurus Markdown features](https://docusaurus.io/docs/mar
|
|||
|
||||
Use the power of React to create interactive blog posts.
|
||||
|
||||
:::
|
||||
|
||||
{/* truncate */}
|
||||
|
||||
For example, use JSX to create an interactive button:
|
||||
|
||||
```js
|
||||
<button onClick={() => alert('button clicked!')}>Click me!</button>
|
||||
```
|
||||
|
||||
<button onClick={() => alert('button clicked!')}>Click me!</button>
|
||||
|
||||
:::
|
||||
|
|
|
@ -7,6 +7,10 @@ tags: [facebook, hello, docusaurus]
|
|||
|
||||
[Docusaurus blogging features](https://docusaurus.io/docs/blog) are powered by the [blog plugin](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog).
|
||||
|
||||
Here are a few tips you might find useful.
|
||||
|
||||
<!-- truncate -->
|
||||
|
||||
Simply add Markdown files (or folders) to the `blog` directory.
|
||||
|
||||
Regular blog authors can be added to `authors.yml`.
|
||||
|
|
18
examples/classic-typescript/blog/authors.yml
generated
18
examples/classic-typescript/blog/authors.yml
generated
|
@ -1,17 +1,23 @@
|
|||
endi:
|
||||
name: Endilie Yacop Sucipto
|
||||
title: Maintainer of Docusaurus
|
||||
url: https://github.com/endiliey
|
||||
image_url: https://github.com/endiliey.png
|
||||
|
||||
yangshun:
|
||||
name: Yangshun Tay
|
||||
title: Front End Engineer @ Facebook
|
||||
url: https://github.com/yangshun
|
||||
image_url: https://github.com/yangshun.png
|
||||
page: true
|
||||
socials:
|
||||
x: yangshunz
|
||||
github: yangshun
|
||||
|
||||
slorber:
|
||||
name: Sébastien Lorber
|
||||
title: Docusaurus maintainer
|
||||
url: https://sebastienlorber.com
|
||||
image_url: https://github.com/slorber.png
|
||||
page:
|
||||
# customize the url of the author page at /blog/authors/<permalink>
|
||||
permalink: '/all-sebastien-lorber-articles'
|
||||
socials:
|
||||
x: sebastienlorber
|
||||
linkedin: sebastienlorber
|
||||
github: slorber
|
||||
newsletter: https://thisweekinreact.com
|
||||
|
|
19
examples/classic-typescript/blog/tags.yml
generated
Normal file
19
examples/classic-typescript/blog/tags.yml
generated
Normal file
|
@ -0,0 +1,19 @@
|
|||
facebook:
|
||||
label: Facebook
|
||||
permalink: /facebook
|
||||
description: Facebook tag description
|
||||
|
||||
hello:
|
||||
label: Hello
|
||||
permalink: /hello
|
||||
description: Hello tag description
|
||||
|
||||
docusaurus:
|
||||
label: Docusaurus
|
||||
permalink: /docusaurus
|
||||
description: Docusaurus tag description
|
||||
|
||||
hola:
|
||||
label: Hola
|
||||
permalink: /hola
|
||||
description: Hola tag description
|
14
examples/classic-typescript/docusaurus.config.ts
generated
14
examples/classic-typescript/docusaurus.config.ts
generated
|
@ -2,6 +2,8 @@ import {themes as prismThemes} from 'prism-react-renderer';
|
|||
import type {Config} from '@docusaurus/types';
|
||||
import type * as Preset from '@docusaurus/preset-classic';
|
||||
|
||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||
|
||||
const config: Config = {
|
||||
title: 'My Site',
|
||||
tagline: 'Dinosaurs are cool',
|
||||
|
@ -42,10 +44,18 @@ const config: Config = {
|
|||
},
|
||||
blog: {
|
||||
showReadingTime: true,
|
||||
feedOptions: {
|
||||
type: ['rss', 'atom'],
|
||||
xslt: true,
|
||||
},
|
||||
// Please change this to your repo.
|
||||
// Remove this to remove the "edit this page" links.
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
|
||||
// Useful options to enforce blogging best practices
|
||||
onInlineTags: 'warn',
|
||||
onInlineAuthors: 'warn',
|
||||
onUntruncatedBlogPosts: 'warn',
|
||||
},
|
||||
theme: {
|
||||
customCss: './src/css/custom.css',
|
||||
|
@ -102,8 +112,8 @@ const config: Config = {
|
|||
href: 'https://discordapp.com/invite/docusaurus',
|
||||
},
|
||||
{
|
||||
label: 'Twitter',
|
||||
href: 'https://twitter.com/docusaurus',
|
||||
label: 'X',
|
||||
href: 'https://x.com/docusaurus',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
16
examples/classic-typescript/package.json
generated
16
examples/classic-typescript/package.json
generated
|
@ -16,19 +16,19 @@
|
|||
"dev": "docusaurus start"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/preset-classic": "3.3.2",
|
||||
"@docusaurus/core": "3.7.0",
|
||||
"@docusaurus/preset-classic": "3.7.0",
|
||||
"@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"
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.3.2",
|
||||
"@docusaurus/tsconfig": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"typescript": "~5.2.2"
|
||||
"@docusaurus/module-type-aliases": "3.7.0",
|
||||
"@docusaurus/tsconfig": "3.7.0",
|
||||
"@docusaurus/types": "3.7.0",
|
||||
"typescript": "~5.6.2"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
|
2
examples/classic-typescript/sidebars.ts
generated
2
examples/classic-typescript/sidebars.ts
generated
|
@ -1,5 +1,7 @@
|
|||
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
|
||||
|
||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||
|
||||
/**
|
||||
* Creating a sidebar enables you to:
|
||||
- create an ordered group of docs
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import type {ReactNode} from 'react';
|
||||
import clsx from 'clsx';
|
||||
import Heading from '@theme/Heading';
|
||||
import styles from './styles.module.css';
|
||||
|
@ -5,7 +6,7 @@ import styles from './styles.module.css';
|
|||
type FeatureItem = {
|
||||
title: string;
|
||||
Svg: React.ComponentType<React.ComponentProps<'svg'>>;
|
||||
description: JSX.Element;
|
||||
description: ReactNode;
|
||||
};
|
||||
|
||||
const FeatureList: FeatureItem[] = [
|
||||
|
@ -55,7 +56,7 @@ function Feature({title, Svg, description}: FeatureItem) {
|
|||
);
|
||||
}
|
||||
|
||||
export default function HomepageFeatures(): JSX.Element {
|
||||
export default function HomepageFeatures(): ReactNode {
|
||||
return (
|
||||
<section className={styles.features}>
|
||||
<div className="container">
|
||||
|
|
3
examples/classic-typescript/src/pages/index.tsx
generated
3
examples/classic-typescript/src/pages/index.tsx
generated
|
@ -1,3 +1,4 @@
|
|||
import type {ReactNode} from 'react';
|
||||
import clsx from 'clsx';
|
||||
import Link from '@docusaurus/Link';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
|
@ -28,7 +29,7 @@ function HomepageHeader() {
|
|||
);
|
||||
}
|
||||
|
||||
export default function Home(): JSX.Element {
|
||||
export default function Home(): ReactNode {
|
||||
const {siteConfig} = useDocusaurusContext();
|
||||
return (
|
||||
<Layout
|
||||
|
|
3
examples/classic-typescript/tsconfig.json
generated
3
examples/classic-typescript/tsconfig.json
generated
|
@ -3,5 +3,6 @@
|
|||
"extends": "@docusaurus/tsconfig",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "."
|
||||
}
|
||||
},
|
||||
"exclude": [".docusaurus", "build"]
|
||||
}
|
||||
|
|
4912
examples/classic-typescript/yarn.lock
generated
4912
examples/classic-typescript/yarn.lock
generated
File diff suppressed because it is too large
Load diff
10
examples/classic/README.md
generated
10
examples/classic/README.md
generated
|
@ -4,13 +4,13 @@ This website is built using [Docusaurus](https://docusaurus.io/), a modern stati
|
|||
|
||||
### Installation
|
||||
|
||||
```
|
||||
```bash
|
||||
$ yarn
|
||||
```
|
||||
|
||||
### Local Development
|
||||
|
||||
```
|
||||
```bash
|
||||
$ yarn start
|
||||
```
|
||||
|
||||
|
@ -18,7 +18,7 @@ This command starts a local development server and opens up a browser window. Mo
|
|||
|
||||
### Build
|
||||
|
||||
```
|
||||
```bash
|
||||
$ yarn build
|
||||
```
|
||||
|
||||
|
@ -28,13 +28,13 @@ This command generates static content into the `build` directory and can be serv
|
|||
|
||||
Using SSH:
|
||||
|
||||
```
|
||||
```bash
|
||||
$ USE_SSH=true yarn deploy
|
||||
```
|
||||
|
||||
Not using SSH:
|
||||
|
||||
```
|
||||
```bash
|
||||
$ GIT_USER=<Your GitHub username> yarn deploy
|
||||
```
|
||||
|
||||
|
|
3
examples/classic/babel.config.js
generated
3
examples/classic/babel.config.js
generated
|
@ -1,3 +0,0 @@
|
|||
module.exports = {
|
||||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
|
||||
};
|
12
examples/classic/blog/2019-05-28-first-blog-post.md
generated
12
examples/classic/blog/2019-05-28-first-blog-post.md
generated
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
slug: first-blog-post
|
||||
title: First Blog Post
|
||||
authors:
|
||||
name: Gao Wei
|
||||
title: Docusaurus Core Team
|
||||
url: https://github.com/wgao19
|
||||
image_url: https://github.com/wgao19.png
|
||||
authors: [slorber, yangshun]
|
||||
tags: [hola, docusaurus]
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
||||
Lorem ipsum dolor sit amet...
|
||||
|
||||
<!-- truncate -->
|
||||
|
||||
...consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
slug: long-blog-post
|
||||
title: Long Blog Post
|
||||
authors: endi
|
||||
authors: yangshun
|
||||
tags: [hello, docusaurus]
|
||||
---
|
||||
|
||||
|
@ -9,7 +9,7 @@ This is the summary of a very long blog post,
|
|||
|
||||
Use a `<!--` `truncate` `-->` comment to limit blog post size in the list view.
|
||||
|
||||
<!--truncate-->
|
||||
<!-- truncate -->
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
||||
|
||||
|
|
|
@ -11,10 +11,14 @@ Blog posts support [Docusaurus Markdown features](https://docusaurus.io/docs/mar
|
|||
|
||||
Use the power of React to create interactive blog posts.
|
||||
|
||||
:::
|
||||
|
||||
{/* truncate */}
|
||||
|
||||
For example, use JSX to create an interactive button:
|
||||
|
||||
```js
|
||||
<button onClick={() => alert('button clicked!')}>Click me!</button>
|
||||
```
|
||||
|
||||
<button onClick={() => alert('button clicked!')}>Click me!</button>
|
||||
|
||||
:::
|
||||
|
|
|
@ -7,6 +7,10 @@ tags: [facebook, hello, docusaurus]
|
|||
|
||||
[Docusaurus blogging features](https://docusaurus.io/docs/blog) are powered by the [blog plugin](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog).
|
||||
|
||||
Here are a few tips you might find useful.
|
||||
|
||||
<!-- truncate -->
|
||||
|
||||
Simply add Markdown files (or folders) to the `blog` directory.
|
||||
|
||||
Regular blog authors can be added to `authors.yml`.
|
||||
|
|
18
examples/classic/blog/authors.yml
generated
18
examples/classic/blog/authors.yml
generated
|
@ -1,17 +1,23 @@
|
|||
endi:
|
||||
name: Endilie Yacop Sucipto
|
||||
title: Maintainer of Docusaurus
|
||||
url: https://github.com/endiliey
|
||||
image_url: https://github.com/endiliey.png
|
||||
|
||||
yangshun:
|
||||
name: Yangshun Tay
|
||||
title: Front End Engineer @ Facebook
|
||||
url: https://github.com/yangshun
|
||||
image_url: https://github.com/yangshun.png
|
||||
page: true
|
||||
socials:
|
||||
x: yangshunz
|
||||
github: yangshun
|
||||
|
||||
slorber:
|
||||
name: Sébastien Lorber
|
||||
title: Docusaurus maintainer
|
||||
url: https://sebastienlorber.com
|
||||
image_url: https://github.com/slorber.png
|
||||
page:
|
||||
# customize the url of the author page at /blog/authors/<permalink>
|
||||
permalink: '/all-sebastien-lorber-articles'
|
||||
socials:
|
||||
x: sebastienlorber
|
||||
linkedin: sebastienlorber
|
||||
github: slorber
|
||||
newsletter: https://thisweekinreact.com
|
||||
|
|
19
examples/classic/blog/tags.yml
generated
Normal file
19
examples/classic/blog/tags.yml
generated
Normal file
|
@ -0,0 +1,19 @@
|
|||
facebook:
|
||||
label: Facebook
|
||||
permalink: /facebook
|
||||
description: Facebook tag description
|
||||
|
||||
hello:
|
||||
label: Hello
|
||||
permalink: /hello
|
||||
description: Hello tag description
|
||||
|
||||
docusaurus:
|
||||
label: Docusaurus
|
||||
permalink: /docusaurus
|
||||
description: Docusaurus tag description
|
||||
|
||||
hola:
|
||||
label: Hola
|
||||
permalink: /hola
|
||||
description: Hola tag description
|
14
examples/classic/docusaurus.config.js
generated
14
examples/classic/docusaurus.config.js
generated
|
@ -6,6 +6,8 @@
|
|||
|
||||
import {themes as prismThemes} from 'prism-react-renderer';
|
||||
|
||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||
|
||||
/** @type {import('@docusaurus/types').Config} */
|
||||
const config = {
|
||||
title: 'My Site',
|
||||
|
@ -48,10 +50,18 @@ const config = {
|
|||
},
|
||||
blog: {
|
||||
showReadingTime: true,
|
||||
feedOptions: {
|
||||
type: ['rss', 'atom'],
|
||||
xslt: true,
|
||||
},
|
||||
// Please change this to your repo.
|
||||
// Remove this to remove the "edit this page" links.
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
|
||||
// Useful options to enforce blogging best practices
|
||||
onInlineTags: 'warn',
|
||||
onInlineAuthors: 'warn',
|
||||
onUntruncatedBlogPosts: 'warn',
|
||||
},
|
||||
theme: {
|
||||
customCss: './src/css/custom.css',
|
||||
|
@ -110,8 +120,8 @@ const config = {
|
|||
href: 'https://discordapp.com/invite/docusaurus',
|
||||
},
|
||||
{
|
||||
label: 'Twitter',
|
||||
href: 'https://twitter.com/docusaurus',
|
||||
label: 'X',
|
||||
href: 'https://x.com/docusaurus',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
12
examples/classic/package.json
generated
12
examples/classic/package.json
generated
|
@ -15,17 +15,17 @@
|
|||
"dev": "docusaurus start"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/preset-classic": "3.3.2",
|
||||
"@docusaurus/core": "3.7.0",
|
||||
"@docusaurus/preset-classic": "3.7.0",
|
||||
"@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"
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2"
|
||||
"@docusaurus/module-type-aliases": "3.7.0",
|
||||
"@docusaurus/types": "3.7.0"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
|
10
examples/classic/sidebars.js
generated
10
examples/classic/sidebars.js
generated
|
@ -1,3 +1,7 @@
|
|||
// @ts-check
|
||||
|
||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||
|
||||
/**
|
||||
* Creating a sidebar enables you to:
|
||||
- create an ordered group of docs
|
||||
|
@ -7,11 +11,9 @@
|
|||
The sidebars can be generated from the filesystem, or explicitly defined here.
|
||||
|
||||
Create as many sidebars as you want.
|
||||
|
||||
@type {import('@docusaurus/plugin-content-docs').SidebarsConfig}
|
||||
*/
|
||||
|
||||
// @ts-check
|
||||
|
||||
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
||||
const sidebars = {
|
||||
// By default, Docusaurus generates a sidebar from the docs folder structure
|
||||
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
|
||||
|
|
4896
examples/classic/yarn.lock
generated
4896
examples/classic/yarn.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "3.3.2",
|
||||
"version": "3.7.0",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"useNx": false,
|
||||
|
@ -13,7 +13,8 @@
|
|||
"pr: polish": ":nail_care: Polish",
|
||||
"pr: documentation": ":memo: Documentation",
|
||||
"pr: dependencies": ":robot: Dependencies",
|
||||
"pr: maintenance": ":wrench: Maintenance"
|
||||
"pr: maintenance": ":wrench: Maintenance",
|
||||
"pr: translations": ":globe_with_meridians: Translations"
|
||||
},
|
||||
"cacheDir": ".changelog"
|
||||
}
|
||||
|
|
46
package.json
46
package.json
|
@ -9,11 +9,13 @@
|
|||
"website",
|
||||
"test-website-in-workspace",
|
||||
"packages/create-docusaurus/templates/*",
|
||||
"admin/test-bad-package",
|
||||
"admin/new.docusaurus.io"
|
||||
],
|
||||
"scripts": {
|
||||
"start": "yarn build:packages && yarn start:website",
|
||||
"start:website": "yarn workspace website start",
|
||||
"start:website:profile": "DOCUSAURUS_BUNDLER_CPU_PROFILE=true DOCUSAURUS_RSPACK_TRACE=true yarn workspace website start",
|
||||
"start:website:baseUrl": "yarn workspace website start:baseUrl",
|
||||
"start:website:blogOnly": "yarn workspace website start:blogOnly",
|
||||
"start:website:deployPreview": "cross-env NETLIFY=true CONTEXT='deploy-preview' yarn workspace website start",
|
||||
|
@ -21,12 +23,15 @@
|
|||
"build": "yarn build:packages && yarn build:website",
|
||||
"build:packages": "lerna run build --no-private",
|
||||
"build:website": "yarn workspace website build",
|
||||
"build:website:profile": "DOCUSAURUS_BUNDLER_CPU_PROFILE=true DOCUSAURUS_RSPACK_TRACE=true yarn workspace website build",
|
||||
"build:website:baseUrl": "yarn workspace website build:baseUrl",
|
||||
"build:website:blogOnly": "yarn workspace website build:blogOnly",
|
||||
"build:website:deployPreview:testWrap": "yarn workspace website test:swizzle:wrap:ts",
|
||||
"build:website:deployPreview:build": "cross-env NETLIFY=true CONTEXT='deploy-preview' yarn workspace website build",
|
||||
"build:website:deployPreview": "yarn build:website:deployPreview:testWrap && yarn build:website:deployPreview:build",
|
||||
"build:website:fast": "yarn workspace website build:fast",
|
||||
"build:website:fast:rsdoctor": "yarn workspace website build:fast:rsdoctor",
|
||||
"build:website:fast:profile": "yarn workspace website build:fast:profile",
|
||||
"build:website:en": "yarn workspace website build --locale en",
|
||||
"clear:website": "yarn workspace website clear",
|
||||
"serve:website": "yarn workspace website serve",
|
||||
|
@ -38,13 +43,16 @@
|
|||
"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:version": "echo 0.0.0-`git rev-list --count HEAD`+`git rev-parse --short HEAD`",
|
||||
"canary:getCoreVersion": "node -p \"require('./packages/docusaurus/package.json').version\"",
|
||||
"canary:version": "echo `yarn --silent canary:getCoreVersion`-canary-`git rev-list --count HEAD`+`git rev-parse --short HEAD`",
|
||||
"canary:bumpVersion": "yarn lerna version `yarn --silent canary:version` --exact --no-push --yes",
|
||||
"canary:publish": "yarn lerna publish from-package --dist-tag canary --yes --no-verify-access",
|
||||
"changelog": "lerna-changelog",
|
||||
"postinstall": "yarn lock:update && yarn build:packages",
|
||||
"postinstall": "patch-package && yarn lock:update && yarn build:packages",
|
||||
"prepare": "husky install",
|
||||
"format": "prettier --write .",
|
||||
"format:diff": "prettier --list-different .",
|
||||
|
@ -53,7 +61,7 @@
|
|||
"lint:js": "eslint --cache --report-unused-disable-directives \"**/*.{js,jsx,ts,tsx,mjs}\"",
|
||||
"lint:js:fix": "yarn lint:js --fix",
|
||||
"lint:spelling": "cspell \"**\" --no-progress --show-context --show-suggestions",
|
||||
"lint:spelling:fix": "yarn rimraf project-words.txt && echo \"# Project Words - DO NOT TOUCH - This is updated through CI\" >> project-words.txt && yarn -s lint:spelling --words-only --unique --no-exit-code --no-summary \"**\" | cross-env LC_ALL=en_US.UTF-8 sort --ignore-case >> project-words.txt",
|
||||
"lint:spelling:fix": "yarn rimraf project-words.txt && echo \"# Project Words - DO NOT TOUCH - This is updated through CI\" >> project-words.txt && yarn -s lint:spelling --words-only --unique --no-exit-code --no-summary \"**\" | cross-env LC_ALL=C sort --ignore-case >> project-words.txt",
|
||||
"lint:style": "stylelint \"**/*.css\"",
|
||||
"lint:style:fix": "yarn lint:style --fix",
|
||||
"lerna": "lerna",
|
||||
|
@ -67,23 +75,23 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@crowdin/cli": "^3.13.0",
|
||||
"@swc/core": "1.2.197",
|
||||
"@swc/jest": "^0.2.26",
|
||||
"@prettier/plugin-xml": "^2.2.0",
|
||||
"@swc/core": "^1.7.14",
|
||||
"@swc/jest": "^0.2.36",
|
||||
"@testing-library/react-hooks": "^8.0.1",
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
"@types/jest": "^29.5.3",
|
||||
"@types/jest": "^29.5.12",
|
||||
"@types/lodash": "^4.14.197",
|
||||
"@types/node": "^18.16.19",
|
||||
"@types/prompts": "^2.4.4",
|
||||
"@types/react": "^18.2.15",
|
||||
"@types/react-dev-utils": "^9.0.11",
|
||||
"@types/react-test-renderer": "^18.0.0",
|
||||
"@types/semver": "^7.5.0",
|
||||
"@types/shelljs": "^0.8.12",
|
||||
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
||||
"@typescript-eslint/parser": "^5.62.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"cspell": "^8.1.0",
|
||||
"cspell": "^8.18.1",
|
||||
"eslint": "^8.45.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
|
@ -92,22 +100,25 @@
|
|||
"eslint-plugin-jest": "^27.2.3",
|
||||
"eslint-plugin-jsx-a11y": "^6.7.1",
|
||||
"eslint-plugin-react": "^7.32.2",
|
||||
"eslint-plugin-react-compiler": "^19.0.0-beta-40c6c23-20250301",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-regexp": "^1.15.0",
|
||||
"husky": "^8.0.3",
|
||||
"image-size": "^1.0.2",
|
||||
"jest": "^29.6.1",
|
||||
"jest-environment-jsdom": "^29.6.1",
|
||||
"jest-serializer-ansi-escapes": "^2.0.1",
|
||||
"image-size": "^2.0.2",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"jest-serializer-ansi-escapes": "^3.0.0",
|
||||
"jest-serializer-react-helmet-async": "^1.0.21",
|
||||
"lerna": "^6.6.2",
|
||||
"lerna-changelog": "^2.2.0",
|
||||
"lint-staged": "^13.2.3",
|
||||
"lint-staged": "~13.2.3",
|
||||
"lockfile-lint": "^4.14.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.8.4",
|
||||
"patch-package": "^8.0.0",
|
||||
"postinstall-postinstall": "^2.1.0",
|
||||
"prettier": "^2.8.8",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0",
|
||||
"react-helmet-async": "^1.3.0",
|
||||
"react-test-renderer": "^18.0.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"sharp": "^0.32.3",
|
||||
|
@ -115,6 +126,7 @@
|
|||
"stylelint": "^14.16.1",
|
||||
"stylelint-config-prettier": "^9.0.5",
|
||||
"stylelint-config-standard": "^29.0.0",
|
||||
"typescript": "~5.4.5"
|
||||
}
|
||||
"typescript": "~5.8.2"
|
||||
},
|
||||
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
import path from 'path';
|
||||
import {createRequire} from 'module';
|
||||
import logger from '@docusaurus/logger';
|
||||
import {logger} from '@docusaurus/logger';
|
||||
import semver from 'semver';
|
||||
import {program} from 'commander';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "create-docusaurus",
|
||||
"version": "3.3.2",
|
||||
"version": "3.7.0",
|
||||
"description": "Create Docusaurus apps easily.",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
|
@ -22,14 +22,14 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/logger": "3.3.2",
|
||||
"@docusaurus/utils": "3.3.2",
|
||||
"@docusaurus/logger": "3.7.0",
|
||||
"@docusaurus/utils": "3.7.0",
|
||||
"commander": "^5.1.0",
|
||||
"execa": "5.1.1",
|
||||
"fs-extra": "^11.1.1",
|
||||
"lodash": "^4.17.21",
|
||||
"prompts": "^2.4.2",
|
||||
"semver": "^7.5.4",
|
||||
"shelljs": "^0.8.5",
|
||||
"supports-color": "^9.4.0",
|
||||
"tslib": "^2.6.0"
|
||||
},
|
||||
|
|
|
@ -9,11 +9,14 @@ import fs from 'fs-extra';
|
|||
import {fileURLToPath} from 'url';
|
||||
import path from 'path';
|
||||
import _ from 'lodash';
|
||||
import logger from '@docusaurus/logger';
|
||||
import shell from 'shelljs';
|
||||
import {logger} from '@docusaurus/logger';
|
||||
import execa from 'execa';
|
||||
import prompts, {type Choice} from 'prompts';
|
||||
import supportsColor from 'supports-color';
|
||||
import {escapeShellArg, askPreferredLanguage} from '@docusaurus/utils';
|
||||
|
||||
// TODO remove dependency on large @docusaurus/utils
|
||||
// would be better to have a new smaller @docusaurus/utils-cli package
|
||||
import {askPreferredLanguage} from '@docusaurus/utils';
|
||||
|
||||
type LanguagesOptions = {
|
||||
javascript?: boolean;
|
||||
|
@ -70,9 +73,9 @@ function findPackageManagerFromUserAgent(): PackageManager | undefined {
|
|||
}
|
||||
|
||||
async function askForPackageManagerChoice(): Promise<PackageManager> {
|
||||
const hasYarn = shell.exec('yarn --version', {silent: true}).code === 0;
|
||||
const hasPnpm = shell.exec('pnpm --version', {silent: true}).code === 0;
|
||||
const hasBun = shell.exec('bun --version', {silent: true}).code === 0;
|
||||
const hasYarn = (await execa.command('yarn --version')).exitCode === 0;
|
||||
const hasPnpm = (await execa.command('pnpm --version')).exitCode === 0;
|
||||
const hasBun = (await execa.command('bun --version')).exitCode === 0;
|
||||
|
||||
if (!hasYarn && !hasPnpm && !hasBun) {
|
||||
return 'npm';
|
||||
|
@ -530,10 +533,7 @@ export default async function init(
|
|||
|
||||
if (source.type === 'git') {
|
||||
const gitCommand = await getGitCommand(source.strategy);
|
||||
const gitCloneCommand = `${gitCommand} ${escapeShellArg(
|
||||
source.url,
|
||||
)} ${escapeShellArg(dest)}`;
|
||||
if (shell.exec(gitCloneCommand).code !== 0) {
|
||||
if ((await execa(gitCommand, [source.url, dest])).exitCode !== 0) {
|
||||
logger.error`Cloning Git template failed!`;
|
||||
process.exit(1);
|
||||
}
|
||||
|
@ -583,24 +583,27 @@ export default async function init(
|
|||
const cdpath = path.relative('.', dest);
|
||||
const pkgManager = await getPackageManager(dest, cliOptions);
|
||||
if (!cliOptions.skipInstall) {
|
||||
shell.cd(dest);
|
||||
process.chdir(dest);
|
||||
logger.info`Installing dependencies with name=${pkgManager}...`;
|
||||
// ...
|
||||
|
||||
if (
|
||||
shell.exec(
|
||||
pkgManager === 'yarn'
|
||||
? 'yarn'
|
||||
: pkgManager === 'bun'
|
||||
? 'bun install'
|
||||
: `${pkgManager} install --color always`,
|
||||
{
|
||||
env: {
|
||||
...process.env,
|
||||
// Force coloring the output, since the command is invoked by
|
||||
// shelljs, which is not an interactive shell
|
||||
...(supportsColor.stdout ? {FORCE_COLOR: '1'} : {}),
|
||||
(
|
||||
await execa.command(
|
||||
pkgManager === 'yarn'
|
||||
? 'yarn'
|
||||
: pkgManager === 'bun'
|
||||
? 'bun install'
|
||||
: `${pkgManager} install --color always`,
|
||||
{
|
||||
env: {
|
||||
...process.env,
|
||||
// Force coloring the output
|
||||
...(supportsColor.stdout ? {FORCE_COLOR: '1'} : {}),
|
||||
},
|
||||
},
|
||||
},
|
||||
).code !== 0
|
||||
)
|
||||
).exitCode !== 0
|
||||
) {
|
||||
logger.error('Dependency installation failed.');
|
||||
logger.info`The site directory has already been created, and you can retry by typing:
|
||||
|
|
|
@ -2,11 +2,18 @@ import {themes as prismThemes} from 'prism-react-renderer';
|
|||
import type {Config} from '@docusaurus/types';
|
||||
import type * as Preset from '@docusaurus/preset-classic';
|
||||
|
||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||
|
||||
const config: Config = {
|
||||
title: 'My Site',
|
||||
tagline: 'Dinosaurs are cool',
|
||||
favicon: 'img/favicon.ico',
|
||||
|
||||
// Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future
|
||||
future: {
|
||||
v4: true, // Improve compatibility with the upcoming Docusaurus v4
|
||||
},
|
||||
|
||||
// Set the production url of your site here
|
||||
url: 'https://your-docusaurus-site.example.com',
|
||||
// Set the /<baseUrl>/ pathname under which your site is served
|
||||
|
@ -42,10 +49,18 @@ const config: Config = {
|
|||
},
|
||||
blog: {
|
||||
showReadingTime: true,
|
||||
feedOptions: {
|
||||
type: ['rss', 'atom'],
|
||||
xslt: true,
|
||||
},
|
||||
// Please change this to your repo.
|
||||
// Remove this to remove the "edit this page" links.
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
|
||||
// Useful options to enforce blogging best practices
|
||||
onInlineTags: 'warn',
|
||||
onInlineAuthors: 'warn',
|
||||
onUntruncatedBlogPosts: 'warn',
|
||||
},
|
||||
theme: {
|
||||
customCss: './src/css/custom.css',
|
||||
|
@ -102,8 +117,8 @@ const config: Config = {
|
|||
href: 'https://discordapp.com/invite/docusaurus',
|
||||
},
|
||||
{
|
||||
label: 'Twitter',
|
||||
href: 'https://twitter.com/docusaurus',
|
||||
label: 'X',
|
||||
href: 'https://x.com/docusaurus',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "docusaurus-2-classic-typescript-template",
|
||||
"version": "3.3.2",
|
||||
"version": "3.7.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
|
@ -15,19 +15,19 @@
|
|||
"typecheck": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/preset-classic": "3.3.2",
|
||||
"@docusaurus/core": "3.7.0",
|
||||
"@docusaurus/preset-classic": "3.7.0",
|
||||
"@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"
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.3.2",
|
||||
"@docusaurus/tsconfig": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"typescript": "~5.2.2"
|
||||
"@docusaurus/module-type-aliases": "3.7.0",
|
||||
"@docusaurus/tsconfig": "3.7.0",
|
||||
"@docusaurus/types": "3.7.0",
|
||||
"typescript": "~5.6.2"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
|
||||
|
||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||
|
||||
/**
|
||||
* Creating a sidebar enables you to:
|
||||
- create an ordered group of docs
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import type {ReactNode} from 'react';
|
||||
import clsx from 'clsx';
|
||||
import Heading from '@theme/Heading';
|
||||
import styles from './styles.module.css';
|
||||
|
@ -5,7 +6,7 @@ import styles from './styles.module.css';
|
|||
type FeatureItem = {
|
||||
title: string;
|
||||
Svg: React.ComponentType<React.ComponentProps<'svg'>>;
|
||||
description: JSX.Element;
|
||||
description: ReactNode;
|
||||
};
|
||||
|
||||
const FeatureList: FeatureItem[] = [
|
||||
|
@ -55,7 +56,7 @@ function Feature({title, Svg, description}: FeatureItem) {
|
|||
);
|
||||
}
|
||||
|
||||
export default function HomepageFeatures(): JSX.Element {
|
||||
export default function HomepageFeatures(): ReactNode {
|
||||
return (
|
||||
<section className={styles.features}>
|
||||
<div className="container">
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import type {ReactNode} from 'react';
|
||||
import clsx from 'clsx';
|
||||
import Link from '@docusaurus/Link';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
|
@ -28,7 +29,7 @@ function HomepageHeader() {
|
|||
);
|
||||
}
|
||||
|
||||
export default function Home(): JSX.Element {
|
||||
export default function Home(): ReactNode {
|
||||
const {siteConfig} = useDocusaurusContext();
|
||||
return (
|
||||
<Layout
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
"extends": "@docusaurus/tsconfig",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "."
|
||||
}
|
||||
},
|
||||
"exclude": [".docusaurus", "build"]
|
||||
}
|
||||
|
|
|
@ -6,12 +6,19 @@
|
|||
|
||||
import {themes as prismThemes} from 'prism-react-renderer';
|
||||
|
||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||
|
||||
/** @type {import('@docusaurus/types').Config} */
|
||||
const config = {
|
||||
title: 'My Site',
|
||||
tagline: 'Dinosaurs are cool',
|
||||
favicon: 'img/favicon.ico',
|
||||
|
||||
// Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future
|
||||
future: {
|
||||
v4: true, // Improve compatibility with the upcoming Docusaurus v4
|
||||
},
|
||||
|
||||
// Set the production url of your site here
|
||||
url: 'https://your-docusaurus-site.example.com',
|
||||
// Set the /<baseUrl>/ pathname under which your site is served
|
||||
|
@ -48,10 +55,18 @@ const config = {
|
|||
},
|
||||
blog: {
|
||||
showReadingTime: true,
|
||||
feedOptions: {
|
||||
type: ['rss', 'atom'],
|
||||
xslt: true,
|
||||
},
|
||||
// Please change this to your repo.
|
||||
// Remove this to remove the "edit this page" links.
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
|
||||
// Useful options to enforce blogging best practices
|
||||
onInlineTags: 'warn',
|
||||
onInlineAuthors: 'warn',
|
||||
onUntruncatedBlogPosts: 'warn',
|
||||
},
|
||||
theme: {
|
||||
customCss: './src/css/custom.css',
|
||||
|
@ -110,8 +125,8 @@ const config = {
|
|||
href: 'https://discordapp.com/invite/docusaurus',
|
||||
},
|
||||
{
|
||||
label: 'Twitter',
|
||||
href: 'https://twitter.com/docusaurus',
|
||||
label: 'X',
|
||||
href: 'https://x.com/docusaurus',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "docusaurus-2-classic-template",
|
||||
"version": "3.3.2",
|
||||
"version": "3.7.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
|
@ -14,17 +14,17 @@
|
|||
"write-heading-ids": "docusaurus write-heading-ids"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/preset-classic": "3.3.2",
|
||||
"@docusaurus/core": "3.7.0",
|
||||
"@docusaurus/preset-classic": "3.7.0",
|
||||
"@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"
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2"
|
||||
"@docusaurus/module-type-aliases": "3.7.0",
|
||||
"@docusaurus/types": "3.7.0"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
// @ts-check
|
||||
|
||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||
|
||||
/**
|
||||
* Creating a sidebar enables you to:
|
||||
- create an ordered group of docs
|
||||
|
@ -7,11 +11,9 @@
|
|||
The sidebars can be generated from the filesystem, or explicitly defined here.
|
||||
|
||||
Create as many sidebars as you want.
|
||||
|
||||
@type {import('@docusaurus/plugin-content-docs').SidebarsConfig}
|
||||
*/
|
||||
|
||||
// @ts-check
|
||||
|
||||
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
||||
const sidebars = {
|
||||
// By default, Docusaurus generates a sidebar from the docs folder structure
|
||||
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
|
||||
|
|
|
@ -4,13 +4,13 @@ This website is built using [Docusaurus](https://docusaurus.io/), a modern stati
|
|||
|
||||
### Installation
|
||||
|
||||
```
|
||||
```bash
|
||||
$ yarn
|
||||
```
|
||||
|
||||
### Local Development
|
||||
|
||||
```
|
||||
```bash
|
||||
$ yarn start
|
||||
```
|
||||
|
||||
|
@ -18,7 +18,7 @@ This command starts a local development server and opens up a browser window. Mo
|
|||
|
||||
### Build
|
||||
|
||||
```
|
||||
```bash
|
||||
$ yarn build
|
||||
```
|
||||
|
||||
|
@ -28,13 +28,13 @@ This command generates static content into the `build` directory and can be serv
|
|||
|
||||
Using SSH:
|
||||
|
||||
```
|
||||
```bash
|
||||
$ USE_SSH=true yarn deploy
|
||||
```
|
||||
|
||||
Not using SSH:
|
||||
|
||||
```
|
||||
```bash
|
||||
$ GIT_USER=<Your GitHub username> yarn deploy
|
||||
```
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
module.exports = {
|
||||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
|
||||
};
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
slug: first-blog-post
|
||||
title: First Blog Post
|
||||
authors:
|
||||
name: Gao Wei
|
||||
title: Docusaurus Core Team
|
||||
url: https://github.com/wgao19
|
||||
image_url: https://github.com/wgao19.png
|
||||
authors: [slorber, yangshun]
|
||||
tags: [hola, docusaurus]
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
||||
Lorem ipsum dolor sit amet...
|
||||
|
||||
<!-- truncate -->
|
||||
|
||||
...consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
slug: long-blog-post
|
||||
title: Long Blog Post
|
||||
authors: endi
|
||||
authors: yangshun
|
||||
tags: [hello, docusaurus]
|
||||
---
|
||||
|
||||
|
@ -9,7 +9,7 @@ This is the summary of a very long blog post,
|
|||
|
||||
Use a `<!--` `truncate` `-->` comment to limit blog post size in the list view.
|
||||
|
||||
<!--truncate-->
|
||||
<!-- truncate -->
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
||||
|
||||
|
|
|
@ -11,10 +11,14 @@ Blog posts support [Docusaurus Markdown features](https://docusaurus.io/docs/mar
|
|||
|
||||
Use the power of React to create interactive blog posts.
|
||||
|
||||
:::
|
||||
|
||||
{/* truncate */}
|
||||
|
||||
For example, use JSX to create an interactive button:
|
||||
|
||||
```js
|
||||
<button onClick={() => alert('button clicked!')}>Click me!</button>
|
||||
```
|
||||
|
||||
<button onClick={() => alert('button clicked!')}>Click me!</button>
|
||||
|
||||
:::
|
||||
|
|
|
@ -7,6 +7,10 @@ tags: [facebook, hello, docusaurus]
|
|||
|
||||
[Docusaurus blogging features](https://docusaurus.io/docs/blog) are powered by the [blog plugin](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog).
|
||||
|
||||
Here are a few tips you might find useful.
|
||||
|
||||
<!-- truncate -->
|
||||
|
||||
Simply add Markdown files (or folders) to the `blog` directory.
|
||||
|
||||
Regular blog authors can be added to `authors.yml`.
|
||||
|
|
|
@ -1,17 +1,25 @@
|
|||
endi:
|
||||
name: Endilie Yacop Sucipto
|
||||
title: Maintainer of Docusaurus
|
||||
url: https://github.com/endiliey
|
||||
image_url: https://github.com/endiliey.png
|
||||
|
||||
yangshun:
|
||||
name: Yangshun Tay
|
||||
title: Front End Engineer @ Facebook
|
||||
url: https://github.com/yangshun
|
||||
title: Ex-Meta Staff Engineer, Co-founder GreatFrontEnd
|
||||
url: https://linkedin.com/in/yangshun
|
||||
image_url: https://github.com/yangshun.png
|
||||
page: true
|
||||
socials:
|
||||
x: yangshunz
|
||||
linkedin: yangshun
|
||||
github: yangshun
|
||||
newsletter: https://www.greatfrontend.com
|
||||
|
||||
slorber:
|
||||
name: Sébastien Lorber
|
||||
title: Docusaurus maintainer
|
||||
url: https://sebastienlorber.com
|
||||
image_url: https://github.com/slorber.png
|
||||
page:
|
||||
# customize the url of the author page at /blog/authors/<permalink>
|
||||
permalink: '/all-sebastien-lorber-articles'
|
||||
socials:
|
||||
x: sebastienlorber
|
||||
linkedin: sebastienlorber
|
||||
github: slorber
|
||||
newsletter: https://thisweekinreact.com
|
||||
|
|
|
@ -2,14 +2,17 @@ facebook:
|
|||
label: Facebook
|
||||
permalink: /facebook
|
||||
description: Facebook tag description
|
||||
|
||||
hello:
|
||||
label: Hello
|
||||
permalink: /hello
|
||||
description: Hello tag description
|
||||
|
||||
docusaurus:
|
||||
label: Docusaurus
|
||||
permalink: /docusaurus
|
||||
description: Docusaurus tag description
|
||||
|
||||
hola:
|
||||
label: Hola
|
||||
permalink: /hola
|
||||
|
|
|
@ -2,11 +2,7 @@
|
|||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"composite": true,
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": "lib/.tsbuildinfo",
|
||||
"rootDir": "src",
|
||||
"outDir": "lib"
|
||||
"tsBuildInfoFile": "lib/.tsbuildinfo-build"
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["templates/", "**/__tests__/**"]
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
"noEmit": true,
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": ["bin"],
|
||||
"include": ["package.json", "bin"],
|
||||
"exclude": ["**/__tests__/**"]
|
||||
}
|
||||
|
|
3
packages/docusaurus-babel/.npmignore
Normal file
3
packages/docusaurus-babel/.npmignore
Normal file
|
@ -0,0 +1,3 @@
|
|||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
3
packages/docusaurus-babel/README.md
Normal file
3
packages/docusaurus-babel/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# `@docusaurus/babel`
|
||||
|
||||
Docusaurus package for Babel-related utils.
|
50
packages/docusaurus-babel/package.json
Normal file
50
packages/docusaurus-babel/package.json
Normal file
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
"name": "@docusaurus/babel",
|
||||
"version": "3.7.0",
|
||||
"description": "Docusaurus package for Babel-related utils.",
|
||||
"main": "./lib/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"exports": {
|
||||
"./preset": {
|
||||
"types": "./lib/preset.d.ts",
|
||||
"default": "./lib/preset.js"
|
||||
},
|
||||
".": {
|
||||
"types": "./lib/index.d.ts",
|
||||
"default": "./lib/index.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"watch": "tsc --watch"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/docusaurus.git",
|
||||
"directory": "packages/docusaurus-babel"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.25.9",
|
||||
"@babel/generator": "^7.25.9",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||
"@babel/plugin-transform-runtime": "^7.25.9",
|
||||
"@babel/preset-env": "^7.25.9",
|
||||
"@babel/preset-react": "^7.25.9",
|
||||
"@babel/preset-typescript": "^7.25.9",
|
||||
"@babel/runtime": "^7.25.9",
|
||||
"@babel/runtime-corejs3": "^7.25.9",
|
||||
"@babel/traverse": "^7.25.9",
|
||||
"@docusaurus/logger": "3.7.0",
|
||||
"@docusaurus/utils": "3.7.0",
|
||||
"babel-plugin-dynamic-import-node": "^2.3.3",
|
||||
"fs-extra": "^11.1.1",
|
||||
"tslib": "^2.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,537 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {jest} from '@jest/globals';
|
||||
import fs from 'fs-extra';
|
||||
import tmp from 'tmp-promise';
|
||||
import {getBabelOptions} from '../utils';
|
||||
import {extractSourceCodeFileTranslations} from '../babelTranslationsExtractor';
|
||||
|
||||
const TestBabelOptions = getBabelOptions({
|
||||
isServer: true,
|
||||
});
|
||||
|
||||
async function createTmpSourceCodeFile({
|
||||
extension,
|
||||
content,
|
||||
}: {
|
||||
extension: string;
|
||||
content: string;
|
||||
}) {
|
||||
const file = await tmp.file({
|
||||
prefix: 'jest-createTmpSourceCodeFile',
|
||||
postfix: `.${extension}`,
|
||||
});
|
||||
|
||||
await fs.writeFile(file.path, content);
|
||||
|
||||
return {
|
||||
sourceCodeFilePath: file.path,
|
||||
};
|
||||
}
|
||||
|
||||
describe('extractSourceCodeFileTranslations', () => {
|
||||
it('throws for bad source code', async () => {
|
||||
const {sourceCodeFilePath} = await createTmpSourceCodeFile({
|
||||
extension: 'js',
|
||||
content: `
|
||||
const default => {
|
||||
|
||||
}
|
||||
`,
|
||||
});
|
||||
|
||||
const errorMock = jest.spyOn(console, 'error').mockImplementation(() => {});
|
||||
|
||||
await expect(
|
||||
extractSourceCodeFileTranslations(sourceCodeFilePath, TestBabelOptions),
|
||||
).rejects.toThrow();
|
||||
|
||||
expect(errorMock).toHaveBeenCalledWith(
|
||||
expect.stringMatching(
|
||||
/Error while attempting to extract Docusaurus translations from source code file at/,
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
it('extracts nothing from untranslated source code', async () => {
|
||||
const {sourceCodeFilePath} = await createTmpSourceCodeFile({
|
||||
extension: 'js',
|
||||
content: `
|
||||
const unrelated = 42;
|
||||
`,
|
||||
});
|
||||
|
||||
const sourceCodeFileTranslations = await extractSourceCodeFileTranslations(
|
||||
sourceCodeFilePath,
|
||||
TestBabelOptions,
|
||||
);
|
||||
|
||||
expect(sourceCodeFileTranslations).toEqual({
|
||||
sourceCodeFilePath,
|
||||
translations: {},
|
||||
warnings: [],
|
||||
});
|
||||
});
|
||||
|
||||
it('extracts from a translate() functions calls', async () => {
|
||||
const {sourceCodeFilePath} = await createTmpSourceCodeFile({
|
||||
extension: 'js',
|
||||
content: `
|
||||
import {translate} from '@docusaurus/Translate';
|
||||
|
||||
export default function MyComponent() {
|
||||
return (
|
||||
<div>
|
||||
<input text={translate({id: 'codeId',message: 'code message',description: 'code description'})}/>
|
||||
|
||||
<input text={translate({id: 'codeId1'})}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
`,
|
||||
});
|
||||
|
||||
const sourceCodeFileTranslations = await extractSourceCodeFileTranslations(
|
||||
sourceCodeFilePath,
|
||||
TestBabelOptions,
|
||||
);
|
||||
|
||||
expect(sourceCodeFileTranslations).toEqual({
|
||||
sourceCodeFilePath,
|
||||
translations: {
|
||||
codeId: {message: 'code message', description: 'code description'},
|
||||
codeId1: {message: 'codeId1'},
|
||||
},
|
||||
warnings: [],
|
||||
});
|
||||
});
|
||||
|
||||
it('extracts from a <Translate> components', async () => {
|
||||
const {sourceCodeFilePath} = await createTmpSourceCodeFile({
|
||||
extension: 'js',
|
||||
content: `
|
||||
import Translate from '@docusaurus/Translate';
|
||||
|
||||
export default function MyComponent() {
|
||||
return (
|
||||
<div>
|
||||
<Translate id="codeId" description={"code description"}>
|
||||
code message
|
||||
</Translate>
|
||||
|
||||
<Translate id="codeId1" description="description 2" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
`,
|
||||
});
|
||||
|
||||
const sourceCodeFileTranslations = await extractSourceCodeFileTranslations(
|
||||
sourceCodeFilePath,
|
||||
TestBabelOptions,
|
||||
);
|
||||
|
||||
expect(sourceCodeFileTranslations).toEqual({
|
||||
sourceCodeFilePath,
|
||||
translations: {
|
||||
codeId: {message: 'code message', description: 'code description'},
|
||||
codeId1: {message: 'codeId1', description: 'description 2'},
|
||||
},
|
||||
warnings: [],
|
||||
});
|
||||
});
|
||||
|
||||
it('extracts statically evaluable content', async () => {
|
||||
const {sourceCodeFilePath} = await createTmpSourceCodeFile({
|
||||
extension: 'js',
|
||||
content: `
|
||||
import Translate, {translate} from '@docusaurus/Translate';
|
||||
|
||||
const prefix = "prefix ";
|
||||
|
||||
export default function MyComponent() {
|
||||
return (
|
||||
<div>
|
||||
<input
|
||||
text={translate({
|
||||
id: prefix + 'codeId fn',
|
||||
message: prefix + 'code message',
|
||||
description: prefix + 'code description'}
|
||||
)}
|
||||
/>
|
||||
<Translate
|
||||
id={prefix + "codeId comp"}
|
||||
description={prefix + "code description"}
|
||||
>
|
||||
{prefix + "code message"}
|
||||
</Translate>
|
||||
<Translate>
|
||||
|
||||
{
|
||||
|
||||
prefix + \`Static template literal with unusual formatting!\`
|
||||
}
|
||||
</Translate>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
`,
|
||||
});
|
||||
|
||||
const sourceCodeFileTranslations = await extractSourceCodeFileTranslations(
|
||||
sourceCodeFilePath,
|
||||
TestBabelOptions,
|
||||
);
|
||||
|
||||
expect(sourceCodeFileTranslations).toEqual({
|
||||
sourceCodeFilePath,
|
||||
translations: {
|
||||
'prefix codeId comp': {
|
||||
message: 'prefix code message',
|
||||
description: 'prefix code description',
|
||||
},
|
||||
'prefix codeId fn': {
|
||||
message: 'prefix code message',
|
||||
description: 'prefix code description',
|
||||
},
|
||||
'prefix Static template literal with unusual formatting!': {
|
||||
message: 'prefix Static template literal with unusual formatting!',
|
||||
},
|
||||
},
|
||||
warnings: [],
|
||||
});
|
||||
});
|
||||
|
||||
it('extracts from TypeScript file', async () => {
|
||||
const {sourceCodeFilePath} = await createTmpSourceCodeFile({
|
||||
extension: 'tsx',
|
||||
content: `
|
||||
import {translate} from '@docusaurus/Translate';
|
||||
|
||||
type ComponentProps<T> = {toto: string}
|
||||
|
||||
export default function MyComponent<T>(props: ComponentProps<T>) {
|
||||
return (
|
||||
<div>
|
||||
<input text={translate({id: 'codeId',message: 'code message',description: 'code description'}) as string}/>
|
||||
<input text={translate({message: 'code message 2',description: 'code description 2'}) as string}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
`,
|
||||
});
|
||||
|
||||
const sourceCodeFileTranslations = await extractSourceCodeFileTranslations(
|
||||
sourceCodeFilePath,
|
||||
TestBabelOptions,
|
||||
);
|
||||
|
||||
expect(sourceCodeFileTranslations).toEqual({
|
||||
sourceCodeFilePath,
|
||||
translations: {
|
||||
codeId: {message: 'code message', description: 'code description'},
|
||||
'code message 2': {
|
||||
message: 'code message 2',
|
||||
description: 'code description 2',
|
||||
},
|
||||
},
|
||||
warnings: [],
|
||||
});
|
||||
});
|
||||
|
||||
it('does not extract from functions that is not docusaurus provided', async () => {
|
||||
const {sourceCodeFilePath} = await createTmpSourceCodeFile({
|
||||
extension: 'js',
|
||||
content: `
|
||||
import translate from 'a-lib';
|
||||
|
||||
export default function somethingElse() {
|
||||
const a = translate('foo');
|
||||
return <Translate>bar</Translate>
|
||||
}
|
||||
`,
|
||||
});
|
||||
|
||||
const sourceCodeFileTranslations = await extractSourceCodeFileTranslations(
|
||||
sourceCodeFilePath,
|
||||
TestBabelOptions,
|
||||
);
|
||||
|
||||
expect(sourceCodeFileTranslations).toEqual({
|
||||
sourceCodeFilePath,
|
||||
translations: {},
|
||||
warnings: [],
|
||||
});
|
||||
});
|
||||
|
||||
it('does not extract from functions that is internal', async () => {
|
||||
const {sourceCodeFilePath} = await createTmpSourceCodeFile({
|
||||
extension: 'js',
|
||||
content: `
|
||||
function translate() {
|
||||
return 'foo'
|
||||
}
|
||||
|
||||
export default function somethingElse() {
|
||||
const a = translate('foo');
|
||||
return a;
|
||||
}
|
||||
`,
|
||||
});
|
||||
|
||||
const sourceCodeFileTranslations = await extractSourceCodeFileTranslations(
|
||||
sourceCodeFilePath,
|
||||
TestBabelOptions,
|
||||
);
|
||||
|
||||
expect(sourceCodeFileTranslations).toEqual({
|
||||
sourceCodeFilePath,
|
||||
translations: {},
|
||||
warnings: [],
|
||||
});
|
||||
});
|
||||
|
||||
it('recognizes aliased imports', async () => {
|
||||
const {sourceCodeFilePath} = await createTmpSourceCodeFile({
|
||||
extension: 'js',
|
||||
content: `
|
||||
import Foo, {translate as bar} from '@docusaurus/Translate';
|
||||
|
||||
export function MyComponent() {
|
||||
return (
|
||||
<div>
|
||||
<Foo id="codeId" description={"code description"}>
|
||||
code message
|
||||
</Foo>
|
||||
|
||||
<Translate id="codeId1" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function () {
|
||||
return (
|
||||
<div>
|
||||
<input text={translate({id: 'codeId',message: 'code message',description: 'code description'})}/>
|
||||
|
||||
<input text={bar({id: 'codeId1'})}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
`,
|
||||
});
|
||||
|
||||
const sourceCodeFileTranslations = await extractSourceCodeFileTranslations(
|
||||
sourceCodeFilePath,
|
||||
TestBabelOptions,
|
||||
);
|
||||
|
||||
expect(sourceCodeFileTranslations).toEqual({
|
||||
sourceCodeFilePath,
|
||||
translations: {
|
||||
codeId: {
|
||||
description: 'code description',
|
||||
message: 'code message',
|
||||
},
|
||||
codeId1: {
|
||||
message: 'codeId1',
|
||||
},
|
||||
},
|
||||
warnings: [],
|
||||
});
|
||||
});
|
||||
|
||||
it('recognizes aliased imports as string literal', async () => {
|
||||
const {sourceCodeFilePath} = await createTmpSourceCodeFile({
|
||||
extension: 'js',
|
||||
content: `
|
||||
import {'translate' as bar} from '@docusaurus/Translate';
|
||||
|
||||
export default function () {
|
||||
return (
|
||||
<div>
|
||||
<input text={translate({id: 'codeId',message: 'code message',description: 'code description'})}/>
|
||||
|
||||
<input text={bar({id: 'codeId1'})}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
`,
|
||||
});
|
||||
|
||||
const sourceCodeFileTranslations = await extractSourceCodeFileTranslations(
|
||||
sourceCodeFilePath,
|
||||
TestBabelOptions,
|
||||
);
|
||||
|
||||
expect(sourceCodeFileTranslations).toEqual({
|
||||
sourceCodeFilePath,
|
||||
translations: {
|
||||
codeId1: {
|
||||
message: 'codeId1',
|
||||
},
|
||||
},
|
||||
warnings: [],
|
||||
});
|
||||
});
|
||||
|
||||
it('warns about id if no children', async () => {
|
||||
const {sourceCodeFilePath} = await createTmpSourceCodeFile({
|
||||
extension: 'js',
|
||||
content: `
|
||||
import Translate from '@docusaurus/Translate';
|
||||
|
||||
export default function () {
|
||||
return (
|
||||
<Translate description="foo" />
|
||||
);
|
||||
}
|
||||
`,
|
||||
});
|
||||
|
||||
const sourceCodeFileTranslations = await extractSourceCodeFileTranslations(
|
||||
sourceCodeFilePath,
|
||||
TestBabelOptions,
|
||||
);
|
||||
|
||||
expect(sourceCodeFileTranslations).toEqual({
|
||||
sourceCodeFilePath,
|
||||
translations: {},
|
||||
warnings: [
|
||||
`<Translate> without children must have id prop.
|
||||
Example: <Translate id="my-id" />
|
||||
File: ${sourceCodeFilePath} at line 6
|
||||
Full code: <Translate description="foo" />`,
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it('warns about dynamic id', async () => {
|
||||
const {sourceCodeFilePath} = await createTmpSourceCodeFile({
|
||||
extension: 'js',
|
||||
content: `
|
||||
import Translate from '@docusaurus/Translate';
|
||||
|
||||
export default function () {
|
||||
return (
|
||||
<Translate id={index}>foo</Translate>
|
||||
);
|
||||
}
|
||||
`,
|
||||
});
|
||||
|
||||
const sourceCodeFileTranslations = await extractSourceCodeFileTranslations(
|
||||
sourceCodeFilePath,
|
||||
TestBabelOptions,
|
||||
);
|
||||
|
||||
expect(sourceCodeFileTranslations).toEqual({
|
||||
sourceCodeFilePath,
|
||||
translations: {
|
||||
foo: {
|
||||
message: 'foo',
|
||||
},
|
||||
},
|
||||
warnings: [
|
||||
`<Translate> prop=id should be a statically evaluable object.
|
||||
Example: <Translate id="optional id" description="optional description">Message</Translate>
|
||||
Dynamically constructed values are not allowed, because they prevent translations to be extracted.
|
||||
File: ${sourceCodeFilePath} at line 6
|
||||
Full code: <Translate id={index}>foo</Translate>`,
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it('warns about dynamic children', async () => {
|
||||
const {sourceCodeFilePath} = await createTmpSourceCodeFile({
|
||||
extension: 'js',
|
||||
content: `
|
||||
import Translate from '@docusaurus/Translate';
|
||||
|
||||
export default function () {
|
||||
return (
|
||||
<Translate id='foo'><a>hhh</a></Translate>
|
||||
);
|
||||
}
|
||||
`,
|
||||
});
|
||||
|
||||
const sourceCodeFileTranslations = await extractSourceCodeFileTranslations(
|
||||
sourceCodeFilePath,
|
||||
TestBabelOptions,
|
||||
);
|
||||
|
||||
expect(sourceCodeFileTranslations).toEqual({
|
||||
sourceCodeFilePath,
|
||||
translations: {},
|
||||
warnings: [
|
||||
`Translate content could not be extracted. It has to be a static string and use optional but static props, like <Translate id="my-id" description="my-description">text</Translate>.
|
||||
File: ${sourceCodeFilePath} at line 6
|
||||
Full code: <Translate id='foo'><a>hhh</a></Translate>`,
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it('warns about dynamic translate argument', async () => {
|
||||
const {sourceCodeFilePath} = await createTmpSourceCodeFile({
|
||||
extension: 'js',
|
||||
content: `
|
||||
import {translate} from '@docusaurus/Translate';
|
||||
|
||||
translate(foo);
|
||||
`,
|
||||
});
|
||||
|
||||
const sourceCodeFileTranslations = await extractSourceCodeFileTranslations(
|
||||
sourceCodeFilePath,
|
||||
TestBabelOptions,
|
||||
);
|
||||
|
||||
expect(sourceCodeFileTranslations).toEqual({
|
||||
sourceCodeFilePath,
|
||||
translations: {},
|
||||
warnings: [
|
||||
`translate() first arg should be a statically evaluable object.
|
||||
Example: translate({message: "text",id: "optional.id",description: "optional description"}
|
||||
Dynamically constructed values are not allowed, because they prevent translations to be extracted.
|
||||
File: ${sourceCodeFilePath} at line 4
|
||||
Full code: translate(foo)`,
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it('warns about too many arguments', async () => {
|
||||
const {sourceCodeFilePath} = await createTmpSourceCodeFile({
|
||||
extension: 'js',
|
||||
content: `
|
||||
import {translate} from '@docusaurus/Translate';
|
||||
|
||||
translate({message: 'a'}, {a: 1}, 2);
|
||||
`,
|
||||
});
|
||||
|
||||
const sourceCodeFileTranslations = await extractSourceCodeFileTranslations(
|
||||
sourceCodeFilePath,
|
||||
TestBabelOptions,
|
||||
);
|
||||
|
||||
expect(sourceCodeFileTranslations).toEqual({
|
||||
sourceCodeFilePath,
|
||||
translations: {},
|
||||
warnings: [
|
||||
`translate() function only takes 1 or 2 args
|
||||
File: ${sourceCodeFilePath} at line 4
|
||||
Full code: translate({
|
||||
message: 'a'
|
||||
}, {
|
||||
a: 1
|
||||
}, 2)`,
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
266
packages/docusaurus-babel/src/babelTranslationsExtractor.ts
Normal file
266
packages/docusaurus-babel/src/babelTranslationsExtractor.ts
Normal file
|
@ -0,0 +1,266 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import logger from '@docusaurus/logger';
|
||||
import traverse, {type Node} from '@babel/traverse';
|
||||
import generate from '@babel/generator';
|
||||
import {
|
||||
parse,
|
||||
type types as t,
|
||||
type NodePath,
|
||||
type TransformOptions,
|
||||
} from '@babel/core';
|
||||
import type {TranslationFileContent} from '@docusaurus/types';
|
||||
|
||||
export type SourceCodeFileTranslations = {
|
||||
sourceCodeFilePath: string;
|
||||
translations: TranslationFileContent;
|
||||
warnings: string[];
|
||||
};
|
||||
|
||||
export async function extractAllSourceCodeFileTranslations(
|
||||
sourceCodeFilePaths: string[],
|
||||
babelOptions: TransformOptions,
|
||||
): Promise<SourceCodeFileTranslations[]> {
|
||||
return Promise.all(
|
||||
sourceCodeFilePaths.flatMap((sourceFilePath) =>
|
||||
extractSourceCodeFileTranslations(sourceFilePath, babelOptions),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export async function extractSourceCodeFileTranslations(
|
||||
sourceCodeFilePath: string,
|
||||
babelOptions: TransformOptions,
|
||||
): Promise<SourceCodeFileTranslations> {
|
||||
try {
|
||||
const code = await fs.readFile(sourceCodeFilePath, 'utf8');
|
||||
|
||||
const ast = parse(code, {
|
||||
...babelOptions,
|
||||
ast: true,
|
||||
// filename is important, because babel does not process the same files
|
||||
// according to their js/ts extensions.
|
||||
// See https://x.com/NicoloRibaudo/status/1321130735605002243
|
||||
filename: sourceCodeFilePath,
|
||||
}) as Node;
|
||||
|
||||
const translations = extractSourceCodeAstTranslations(
|
||||
ast,
|
||||
sourceCodeFilePath,
|
||||
);
|
||||
return translations;
|
||||
} catch (err) {
|
||||
logger.error`Error while attempting to extract Docusaurus translations from source code file at path=${sourceCodeFilePath}.`;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Need help understanding this?
|
||||
|
||||
Useful resources:
|
||||
https://github.com/jamiebuilds/babel-handbook/blob/master/translations/en/plugin-handbook.md
|
||||
https://github.com/formatjs/formatjs/blob/main/packages/babel-plugin-formatjs/index.ts
|
||||
https://github.com/pugjs/babel-walk
|
||||
*/
|
||||
function extractSourceCodeAstTranslations(
|
||||
ast: Node,
|
||||
sourceCodeFilePath: string,
|
||||
): SourceCodeFileTranslations {
|
||||
function sourceWarningPart(node: Node) {
|
||||
return `File: ${sourceCodeFilePath} at line ${node.loc?.start.line ?? '?'}
|
||||
Full code: ${generate(node).code}`;
|
||||
}
|
||||
|
||||
const translations: TranslationFileContent = {};
|
||||
const warnings: string[] = [];
|
||||
let translateComponentName: string | undefined;
|
||||
let translateFunctionName: string | undefined;
|
||||
|
||||
// First pass: find import declarations of Translate / translate.
|
||||
// If not found, don't process the rest to avoid false positives
|
||||
traverse(ast, {
|
||||
ImportDeclaration(path) {
|
||||
if (
|
||||
path.node.importKind === 'type' ||
|
||||
path.get('source').node.value !== '@docusaurus/Translate'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const importSpecifiers = path.get('specifiers');
|
||||
const defaultImport = importSpecifiers.find(
|
||||
(specifier): specifier is NodePath<t.ImportDefaultSpecifier> =>
|
||||
specifier.node.type === 'ImportDefaultSpecifier',
|
||||
);
|
||||
const callbackImport = importSpecifiers.find(
|
||||
(specifier): specifier is NodePath<t.ImportSpecifier> =>
|
||||
specifier.node.type === 'ImportSpecifier' &&
|
||||
((
|
||||
(specifier as NodePath<t.ImportSpecifier>).get('imported')
|
||||
.node as t.Identifier
|
||||
).name === 'translate' ||
|
||||
(
|
||||
(specifier as NodePath<t.ImportSpecifier>).get('imported')
|
||||
.node as t.StringLiteral
|
||||
).value === 'translate'),
|
||||
);
|
||||
|
||||
translateComponentName = defaultImport?.get('local').node.name;
|
||||
translateFunctionName = callbackImport?.get('local').node.name;
|
||||
},
|
||||
});
|
||||
|
||||
traverse(ast, {
|
||||
...(translateComponentName && {
|
||||
JSXElement(path) {
|
||||
if (
|
||||
!path
|
||||
.get('openingElement')
|
||||
.get('name')
|
||||
.isJSXIdentifier({name: translateComponentName})
|
||||
) {
|
||||
return;
|
||||
}
|
||||
function evaluateJSXProp(propName: string): string | undefined {
|
||||
const attributePath = path
|
||||
.get('openingElement.attributes')
|
||||
.find(
|
||||
(attr) =>
|
||||
attr.isJSXAttribute() &&
|
||||
attr.get('name').isJSXIdentifier({name: propName}),
|
||||
);
|
||||
|
||||
if (attributePath) {
|
||||
const attributeValue = attributePath.get('value') as NodePath;
|
||||
|
||||
const attributeValueEvaluated =
|
||||
attributeValue.isJSXExpressionContainer()
|
||||
? (attributeValue.get('expression') as NodePath).evaluate()
|
||||
: attributeValue.evaluate();
|
||||
|
||||
if (
|
||||
attributeValueEvaluated.confident &&
|
||||
typeof attributeValueEvaluated.value === 'string'
|
||||
) {
|
||||
return attributeValueEvaluated.value;
|
||||
}
|
||||
warnings.push(
|
||||
`<Translate> prop=${propName} should be a statically evaluable object.
|
||||
Example: <Translate id="optional id" description="optional description">Message</Translate>
|
||||
Dynamically constructed values are not allowed, because they prevent translations to be extracted.
|
||||
${sourceWarningPart(path.node)}`,
|
||||
);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const id = evaluateJSXProp('id');
|
||||
const description = evaluateJSXProp('description');
|
||||
let message: string;
|
||||
const childrenPath = path.get('children');
|
||||
|
||||
// Handle empty content
|
||||
if (!childrenPath.length) {
|
||||
if (!id) {
|
||||
warnings.push(`<Translate> without children must have id prop.
|
||||
Example: <Translate id="my-id" />
|
||||
${sourceWarningPart(path.node)}`);
|
||||
} else {
|
||||
translations[id] = {
|
||||
message: id,
|
||||
...(description && {description}),
|
||||
};
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle single non-empty content
|
||||
const singleChildren = childrenPath
|
||||
// Remove empty/useless text nodes that might be around our
|
||||
// translation! Makes the translation system more reliable to JSX
|
||||
// formatting issues
|
||||
.filter(
|
||||
(children) =>
|
||||
!(
|
||||
children.isJSXText() &&
|
||||
children.node.value.replace('\n', '').trim() === ''
|
||||
),
|
||||
)
|
||||
.pop();
|
||||
const isJSXText = singleChildren?.isJSXText();
|
||||
const isJSXExpressionContainer =
|
||||
singleChildren?.isJSXExpressionContainer() &&
|
||||
(singleChildren.get('expression') as NodePath).evaluate().confident;
|
||||
|
||||
if (isJSXText || isJSXExpressionContainer) {
|
||||
message = isJSXText
|
||||
? singleChildren.node.value.trim().replace(/\s+/g, ' ')
|
||||
: String(
|
||||
(singleChildren.get('expression') as NodePath).evaluate().value,
|
||||
);
|
||||
|
||||
translations[id ?? message] = {
|
||||
message,
|
||||
...(description && {description}),
|
||||
};
|
||||
} else {
|
||||
warnings.push(
|
||||
`Translate content could not be extracted. It has to be a static string and use optional but static props, like <Translate id="my-id" description="my-description">text</Translate>.
|
||||
${sourceWarningPart(path.node)}`,
|
||||
);
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
...(translateFunctionName && {
|
||||
CallExpression(path) {
|
||||
if (!path.get('callee').isIdentifier({name: translateFunctionName})) {
|
||||
return;
|
||||
}
|
||||
|
||||
const args = path.get('arguments');
|
||||
if (args.length === 1 || args.length === 2) {
|
||||
const firstArgPath = args[0]!;
|
||||
|
||||
// translate("x" + "y"); => translate("xy");
|
||||
const firstArgEvaluated = firstArgPath.evaluate();
|
||||
|
||||
if (
|
||||
firstArgEvaluated.confident &&
|
||||
typeof firstArgEvaluated.value === 'object'
|
||||
) {
|
||||
const {message, id, description} = firstArgEvaluated.value as {
|
||||
[propName: string]: unknown;
|
||||
};
|
||||
translations[String(id ?? message)] = {
|
||||
message: String(message ?? id),
|
||||
...(Boolean(description) && {description: String(description)}),
|
||||
};
|
||||
} else {
|
||||
warnings.push(
|
||||
`translate() first arg should be a statically evaluable object.
|
||||
Example: translate({message: "text",id: "optional.id",description: "optional description"}
|
||||
Dynamically constructed values are not allowed, because they prevent translations to be extracted.
|
||||
${sourceWarningPart(path.node)}`,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
warnings.push(
|
||||
`translate() function only takes 1 or 2 args
|
||||
${sourceWarningPart(path.node)}`,
|
||||
);
|
||||
}
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
return {sourceCodeFilePath, translations, warnings};
|
||||
}
|
10
packages/docusaurus-babel/src/index.ts
Normal file
10
packages/docusaurus-babel/src/index.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
export {getCustomBabelConfigFilePath, getBabelOptions} from './utils';
|
||||
|
||||
export {extractAllSourceCodeFileTranslations} from './babelTranslationsExtractor';
|
82
packages/docusaurus-babel/src/preset.ts
Normal file
82
packages/docusaurus-babel/src/preset.ts
Normal file
|
@ -0,0 +1,82 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import path from 'path';
|
||||
import type {ConfigAPI, TransformOptions} from '@babel/core';
|
||||
|
||||
function getTransformOptions(isServer: boolean): TransformOptions {
|
||||
const absoluteRuntimePath = path.dirname(
|
||||
require.resolve(`@babel/runtime/package.json`),
|
||||
);
|
||||
return {
|
||||
// All optional newlines and whitespace will be omitted when generating code
|
||||
// in compact mode
|
||||
compact: true,
|
||||
presets: [
|
||||
isServer
|
||||
? [
|
||||
require.resolve('@babel/preset-env'),
|
||||
{
|
||||
targets: {
|
||||
node: 'current',
|
||||
},
|
||||
},
|
||||
]
|
||||
: [
|
||||
require.resolve('@babel/preset-env'),
|
||||
{
|
||||
useBuiltIns: 'entry',
|
||||
loose: true,
|
||||
corejs: '3',
|
||||
// Do not transform modules to CJS
|
||||
modules: false,
|
||||
// Exclude transforms that make all code slower
|
||||
exclude: ['transform-typeof-symbol'],
|
||||
},
|
||||
],
|
||||
[
|
||||
require.resolve('@babel/preset-react'),
|
||||
{
|
||||
runtime: 'automatic',
|
||||
},
|
||||
],
|
||||
require.resolve('@babel/preset-typescript'),
|
||||
],
|
||||
plugins: [
|
||||
// Polyfills the runtime needed for async/await, generators, and friends
|
||||
// https://babeljs.io/docs/en/babel-plugin-transform-runtime
|
||||
[
|
||||
require.resolve('@babel/plugin-transform-runtime'),
|
||||
{
|
||||
corejs: false,
|
||||
helpers: true,
|
||||
// By default, it assumes @babel/runtime@7.0.0. Since we use >7.0.0,
|
||||
// better to explicitly specify the version so that it can reuse the
|
||||
// helper better. See https://github.com/babel/babel/issues/10261
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires, global-require
|
||||
version: (require('@babel/runtime/package.json') as {version: string})
|
||||
.version,
|
||||
regenerator: true,
|
||||
useESModules: true,
|
||||
// Undocumented option that lets us encapsulate our runtime, ensuring
|
||||
// the correct version is used
|
||||
// https://github.com/babel/babel/blob/090c364a90fe73d36a30707fc612ce037bdbbb24/packages/babel-plugin-transform-runtime/src/index.js#L35-L42
|
||||
absoluteRuntime: absoluteRuntimePath,
|
||||
},
|
||||
],
|
||||
// Adds syntax support for import()
|
||||
isServer
|
||||
? require.resolve('babel-plugin-dynamic-import-node')
|
||||
: require.resolve('@babel/plugin-syntax-dynamic-import'),
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export default function babelPresets(api: ConfigAPI): TransformOptions {
|
||||
const callerName = api.caller((caller) => caller?.name);
|
||||
return getTransformOptions(callerName === 'server');
|
||||
}
|
50
packages/docusaurus-babel/src/utils.ts
Normal file
50
packages/docusaurus-babel/src/utils.ts
Normal file
|
@ -0,0 +1,50 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import {BABEL_CONFIG_FILE_NAME} from '@docusaurus/utils';
|
||||
import type {TransformOptions} from '@babel/core';
|
||||
|
||||
export async function getCustomBabelConfigFilePath(
|
||||
siteDir: string,
|
||||
): Promise<string | undefined> {
|
||||
const customBabelConfigurationPath = path.join(
|
||||
siteDir,
|
||||
BABEL_CONFIG_FILE_NAME,
|
||||
);
|
||||
return (await fs.pathExists(customBabelConfigurationPath))
|
||||
? customBabelConfigurationPath
|
||||
: undefined;
|
||||
}
|
||||
|
||||
export function getBabelOptions({
|
||||
isServer,
|
||||
babelOptions,
|
||||
}: {
|
||||
isServer?: boolean;
|
||||
// TODO Docusaurus v4 fix this
|
||||
// weird to have getBabelOptions take a babelOptions param
|
||||
babelOptions?: TransformOptions | string;
|
||||
} = {}): TransformOptions {
|
||||
const caller = {name: isServer ? 'server' : 'client'};
|
||||
if (typeof babelOptions === 'string') {
|
||||
return {
|
||||
babelrc: false,
|
||||
configFile: babelOptions,
|
||||
caller,
|
||||
};
|
||||
}
|
||||
return {
|
||||
...(babelOptions ?? {
|
||||
presets: [require.resolve('@docusaurus/babel/preset')],
|
||||
}),
|
||||
babelrc: false,
|
||||
configFile: false,
|
||||
caller,
|
||||
};
|
||||
}
|
10
packages/docusaurus-babel/tsconfig.json
Normal file
10
packages/docusaurus-babel/tsconfig.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"sourceMap": true,
|
||||
"declarationMap": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["**/__tests__/**"]
|
||||
}
|
3
packages/docusaurus-bundler/.npmignore
Normal file
3
packages/docusaurus-bundler/.npmignore
Normal file
|
@ -0,0 +1,3 @@
|
|||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
3
packages/docusaurus-bundler/README.md
Normal file
3
packages/docusaurus-bundler/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# `@docusaurus/bundler`
|
||||
|
||||
Docusaurus util package to abstract the current bundler.
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue