Skip to content

Commit 9596203

Browse files
committed
[repo] Move to Docusaurus 3.0.0-alpha.0
1 parent 1945bc4 commit 9596203

File tree

12 files changed

+5530
-2129
lines changed

12 files changed

+5530
-2129
lines changed

config/prism.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
* You should have received a copy of the GNU General Public License
1515
* along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1616
*/
17-
const lightCodeTheme = require('prism-react-renderer/themes/github');
18-
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
17+
const { themes } = require('prism-react-renderer');
18+
19+
const lightCodeTheme = themes.github;
20+
const darkCodeTheme = themes.dracula;
1921

2022
module.exports = {
2123
theme: lightCodeTheme,

docs/guides/javascript/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,7 @@ Any time that this template is rendered and placed on the page the `mod_forum/di
288288

289289
:::note Since Moodle 4.0
290290
Moodle no longer supports Internet Explorer. It's now safe to use Arrow functions.
291-
<!--
292-
TODO:
291+
<!-- TODO:
293292
Moodle no longer supports Internet Explorer. It's now safe to use <Term reference="arrowFunctions">Arrow functions</Term>.
294293
-->
295294
:::

general/releases/2.3.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ Finally, thanks to all our testers both within Moodle HQ and from the whole comm
4343

4444
Credits to Moodle HQ: Marina Glancy, Barbara Ramiro, Martin Dougiamas, David Mudrak, Dongsheng Cai and others.
4545

46-
<!--
47-
Github Flavoured Markdown does not support tables without headers.
46+
<!-- Github Flavoured Markdown does not support tables without headers.
4847
We must use an HTML table here.
4948
Please note that Spacing in this table is important.
5049
Markdown must have empty newlines between it and HTML markup.
@@ -100,8 +99,7 @@ Credits to Moodle HQ: Dongsheng Cai, Marina Glancy, Martin Dougiamas, Petr Skoda
10099

101100
Credits to: Andrew Nicols and Ruslan Kabalin (LUNS) Davo Smith (Synergy Learning), Dan Poltawski and Martin Dougiamas (Moodle HQ)
102101

103-
<!--
104-
Github Flavoured Markdown does not support tables without headers.
102+
<!-- Github Flavoured Markdown does not support tables without headers.
105103
We must use an HTML table here.
106104
Please note that Spacing in this table is important.
107105
Markdown must have empty newlines between it and HTML markup.

general/releases/2.5.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ See [MDL-36504](https://tracker.moodle.org/browse/MDL-36504) for the full list o
121121
- [MDL-38391](https://tracker.moodle.org/browse/MDL-38391) - Improved YUI module loading performance
122122
- [MDL-37127](https://tracker.moodle.org/browse/MDL-37127) - Use of minified YUI modules to reduce content size
123123

124-
<!--
125-
Github Flavoured Markdown does not support tables without headers.
124+
<!-- Github Flavoured Markdown does not support tables without headers.
126125
We must use an HTML table here.
127126
Please note that Spacing in this table is important.
128127
Markdown must have empty newlines between it and HTML markup.

general/releases/2.6.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ Many important changes have been made to improve Moodle's performance: a new ses
9090
- [MDL-37028](https://tracker.moodle.org/browse/MDL-37028) - Integrity check of course data on-the-fly plus CLI script
9191
- [MDL-42387](https://tracker.moodle.org/browse/MDL-42387) - Standardised file lifetime handling
9292

93-
<!--
94-
Github Flavoured Markdown does not support tables without headers.
93+
<!-- Github Flavoured Markdown does not support tables without headers.
9594
We must use an HTML table here.
9695
Please note that Spacing in this table is important.
9796
Markdown must have empty newlines between it and HTML markup.

general/releases/3.0/3.0.1.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ PHP 7 was released on 3 December 2015 and is still very young. Not all libraries
2020

2121
**PHP 7 compatibility makes Moodle faster**
2222

23-
<!--
24-
Github Flavoured Markdown does not support tables without headers.
23+
<!-- Github Flavoured Markdown does not support tables without headers.
2524
We must use an HTML table here.
2625
Please note that Spacing in this table is important.
2726
Markdown must have empty newlines between it and HTML markup.
@@ -49,8 +48,7 @@ PHP 7 was released on 3 December 2015 and is still very young. Not all libraries
4948

5049
**PHP 7 compatibility significantly reduces memory used**
5150

52-
<!--
53-
Github Flavoured Markdown does not support tables without headers.
51+
<!-- Github Flavoured Markdown does not support tables without headers.
5452
We must use an HTML table here.
5553
Please note that Spacing in this table is important.
5654
Markdown must have empty newlines between it and HTML markup.

package.json

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,26 @@
3232
"spell": "cspell '*.md' '*.mdx' '**/*.md' '**/*.mdx' 'docs/*.md' 'docs/*.mdx' 'docs/**/*.md' 'docs/**/*.mdx' 'general/*.md' 'general/*.mdx' 'general/**/*.md' 'general/**/*.mdx'"
3333
},
3434
"dependencies": {
35-
"@docusaurus/core": "latest",
36-
"@docusaurus/plugin-pwa": "latest",
37-
"@docusaurus/preset-classic": "latest",
38-
"@docusaurus/theme-mermaid": "latest",
39-
"@emotion/react": "^11.10.5",
40-
"@emotion/styled": "^11.10.5",
41-
"@mdx-js/react": "^1.6.22",
42-
"@mui/icons-material": "^5.10.16",
43-
"@mui/material": "^5.10.16",
35+
"@docusaurus/core": "canary",
36+
"@docusaurus/plugin-pwa": "canary",
37+
"@docusaurus/preset-classic": "canary",
38+
"@docusaurus/theme-mermaid": "canary",
39+
"@emotion/react": "^11.11.1",
40+
"@emotion/styled": "^11.11.0",
41+
"@mdx-js/react": "^2.3.0",
42+
"@mui/icons-material": "^5.11.16",
43+
"@mui/material": "^5.13.5",
4444
"clsx": "^1.2.1",
4545
"commander": "5.1.0",
4646
"dotenv": "^16.0.3",
47-
"hast-util-from-parse5": "^7.1.0",
47+
"hast-util-from-parse5": "^7.1.2",
4848
"libxmljs2": "^0.31.0",
49-
"prism-react-renderer": "^1.3.5",
49+
"prism-react-renderer": "^2.0.5",
5050
"raw-loader": "^4.0.2",
51-
"react": "^17.0.2",
52-
"react-dom": "^17.0.2",
53-
"react-player": "^2.11.0"
51+
"react": "^18.2.0",
52+
"react-dom": "^18.2.0",
53+
"react-player": "^2.12.0",
54+
"unist-util-visit": "^4.1.2"
5455
},
5556
"browserslist": {
5657
"production": [
@@ -66,28 +67,28 @@
6667
},
6768
"devDependencies": {
6869
"@apidevtools/json-schema-ref-parser": "^9.1.0",
69-
"@babel/plugin-transform-runtime": "^7.19.6",
70-
"@babel/preset-env": "^7.20.2",
71-
"@docusaurus/module-type-aliases": "latest",
72-
"@tsconfig/docusaurus": "^1.0.6",
70+
"@babel/plugin-transform-runtime": "^7.22.5",
71+
"@babel/preset-env": "^7.22.5",
72+
"@docusaurus/module-type-aliases": "canary",
73+
"@tsconfig/docusaurus": "^1.0.7",
7374
"@types/core-js": "^2.5.5",
74-
"@types/node": "^18.11.10",
75-
"@typescript-eslint/eslint-plugin": "^5.45.0",
76-
"@typescript-eslint/parser": "^5.45.0",
75+
"@types/node": "^20.3.1",
76+
"@typescript-eslint/eslint-plugin": "^5.59.11",
77+
"@typescript-eslint/parser": "^5.59.11",
7778
"ajv-cli": "^5.0.0",
78-
"babel-jest": "^29.3.1",
79+
"babel-jest": "^29.5.0",
7980
"cspell": "^6.15.1",
80-
"eslint": "^8.28.0",
81+
"eslint": "^8.43.0",
8182
"eslint-config-airbnb": "^19.0.4",
8283
"eslint-plugin-header": "^3.1.1",
83-
"eslint-plugin-import": "^2.26.0",
84-
"eslint-plugin-jest": "^27.1.6",
85-
"eslint-plugin-jsx-a11y": "^6.6.1",
86-
"eslint-plugin-mdx": "^1.17.1",
87-
"eslint-plugin-react": "^7.31.11",
84+
"eslint-plugin-import": "^2.27.5",
85+
"eslint-plugin-jest": "^27.2.2",
86+
"eslint-plugin-jsx-a11y": "^6.7.1",
87+
"eslint-plugin-mdx": "^2.1.0",
88+
"eslint-plugin-react": "^7.32.2",
8889
"eslint-plugin-react-hooks": "^4.6.0",
89-
"eslint-plugin-regexp": "^1.11.0",
90-
"husky": "^8.0.2",
90+
"eslint-plugin-regexp": "^1.15.0",
91+
"husky": "^8.0.3",
9192
"inquirer": "^9.1.4",
9293
"jest": "^29.3.1",
9394
"js-yaml": "^4.1.0",
@@ -98,9 +99,9 @@
9899
"nodemw": "^0.18.0",
99100
"stylelint": "^14.15.0",
100101
"stylelint-config-standard": "^29.0.0",
101-
"ts-jest": "^29.0.3",
102-
"typescript": "^4.9.3",
103-
"unist-util-inspect": "7.0.1",
102+
"ts-jest": "^29.1.0",
103+
"typescript": "^5.1.3",
104+
"unist-util-inspect": "7.0.2",
104105
"winston": "^3.8.2"
105106
},
106107
"packageManager": "yarn@3.2.4"

src/remark/moodleBanner.js

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,50 @@
1616
*/
1717

1818
module.exports = () => (root) => {
19+
const attributes = [
20+
{
21+
type: 'mdxJsxAttribute',
22+
name: 'frontMatter',
23+
value: '{frontMatter}',
24+
},
25+
];
26+
27+
if (typeof metadata !== 'undefined') {
28+
attributes.push({
29+
type: 'mdxJsxAttribute',
30+
name: 'metadata',
31+
value: '{metadata}',
32+
});
33+
}
34+
1935
root.children.unshift({
20-
type: 'import',
36+
type: 'mdxjsEsm',
2137
value: 'import MoodlePageBanner from "@site/src/theme/MoodlePageBanner";',
38+
data: {
39+
estree: {
40+
type: 'Program',
41+
body: [
42+
{
43+
type: 'ImportDeclaration',
44+
specifiers: [
45+
{
46+
type: 'ImportDefaultSpecifier',
47+
local: { type: 'Identifier', name: 'MoodlePageBanner' },
48+
},
49+
],
50+
source: {
51+
type: 'Literal',
52+
value: '@site/src/theme/MoodlePageBanner',
53+
raw: "'@site/src/theme/MoodlePageBanner'",
54+
},
55+
},
56+
],
57+
sourceType: 'module',
58+
},
59+
},
2260
}, {
23-
type: 'jsx',
24-
value: '<MoodlePageBanner frontMatter={frontMatter} {...(typeof metadata !== "undefined" ? {metadata} : {} )}/>',
61+
type: 'mdxJsxFlowElement',
62+
name: 'MoodlePageBanner',
63+
attributes,
2564
});
2665
};

src/remark/trackerLinks.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
* along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
/* eslint-disable-next-line import/no-extraneous-dependencies */
19-
const visit = require('unist-util-visit');
20-
2118
const projects = [
2219
'MDL',
2320
'MDLQA',
@@ -61,7 +58,7 @@ const updateTextLink = (node, index, parent) => {
6158
return 'skip';
6259
}
6360

64-
const expression = new RegExp(`(?<issueNumber>(${projects.join('|')})-\\d+)`, 'g');
61+
const expression = new RegExp(`(?<issueNumber>(${projects.join('|')})-\\d+)`);
6562
const match = expression.exec(value);
6663
if (match === null) {
6764
// No matches found in this node, so skip this one, but keep processing.
@@ -86,7 +83,8 @@ const updateTextLink = (node, index, parent) => {
8683
return index + 2;
8784
};
8885

89-
const plugin = () => {
86+
const plugin = async () => {
87+
const { visit } = await import('unist-util-visit');
9088
const transformer = async (ast) => {
9189
// Visit all nodes on the AST which are of type 'text' and apply the updateTextLink function on them.
9290
// The visit function's third parameter is a Visitor function.

versioned_docs/version-4.1/guides/javascript/index.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,6 @@ Any time that this template is rendered and placed on the page the `mod_forum/di
288288

289289
:::note Since Moodle 4.0
290290
Moodle no longer supports Internet Explorer. It's now safe to use Arrow functions.
291-
<!--
292-
TODO:
293-
Moodle no longer supports Internet Explorer. It's now safe to use <Term reference="arrowFunctions">Arrow functions</Term>.
294-
-->
295291
:::
296292

297293
Often you may want to link the JavaScript to a specific `DOMElement` in the template.

0 commit comments

Comments
 (0)