Skip to content

Commit 640e164

Browse files
committed
docs: migrate website editors from Monaco to CodeMirror
1 parent 34174e3 commit 640e164

16 files changed

Lines changed: 2772 additions & 2388 deletions

.prettierrc.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
plugins:
2+
- prettier-plugin-css-order
13
trailingComma: "none"
24
useTabs: false
35
tabWidth: 2

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"build": "tsdown && cp node_modules/tree-sitter-java-orchard/tree-sitter-java_orchard.wasm dist/",
2828
"ci": "yarn build && yarn lint && yarn format:validate && yarn test",
2929
"clone-samples": "node scripts/clone-samples.js",
30-
"format:fix": "prettier --write \"**/*.@(js|json|ts)\"",
31-
"format:validate": "prettier --list-different \"**/*.@(js|json|ts)\"",
30+
"format:fix": "prettier --write \"**/*.@(css|js|json|ts|tsx)\"",
31+
"format:validate": "prettier --list-different \"**/*.@(css|js|json|ts|tsx)\"",
3232
"generate-node-types": "node scripts/generate-node-types.ts && prettier --write src/node-types.ts",
3333
"lerna:publish": "lerna publish from-git --yes",
3434
"lerna:version": "lerna version --exact --no-private",
@@ -69,7 +69,9 @@
6969
"lint-staged": "^17.0.2",
7070
"mitata": "^1.0.34",
7171
"mocha": "^11.7.5",
72+
"postcss": "^8.5.15",
7273
"prettier": "^3.8.1",
74+
"prettier-plugin-css-order": "^2.2.0",
7375
"tree-sitter-java-orchard": "0.5.8",
7476
"tsdown": "^0.22.0",
7577
"typescript": "^6.0.3",

src/comments.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,7 @@ function printTrailingComments(path: NamedNodePath) {
490490
}
491491
const docs: Doc[] = [];
492492
let printedTrailingComment:
493-
| ReturnType<typeof printTrailingComment>
494-
| undefined;
493+
ReturnType<typeof printTrailingComment> | undefined;
495494

496495
path.each(path => {
497496
const { node: comment } = path;

src/node-types.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,9 +1064,7 @@ export interface LambdaExpressionNode extends NamedNodeBase {
10641064
type: SyntaxType.LambdaExpression;
10651065
bodyNode: BlockNode | ExpressionNode;
10661066
parametersNode:
1067-
| FormalParametersNode
1068-
| IdentifierNode
1069-
| InferredParametersNode;
1067+
FormalParametersNode | IdentifierNode | InferredParametersNode;
10701068
}
10711069

10721070
export interface LocalVariableDeclarationNode extends NamedNodeBase {
@@ -1338,10 +1336,7 @@ export interface UnaryExpressionNode extends NamedNodeBase {
13381336
type: SyntaxType.UnaryExpression;
13391337
operandNode: ExpressionNode;
13401338
operatorNode:
1341-
| UnnamedNode<"!">
1342-
| UnnamedNode<"+">
1343-
| UnnamedNode<"-">
1344-
| UnnamedNode<"~">;
1339+
UnnamedNode<"!"> | UnnamedNode<"+"> | UnnamedNode<"-"> | UnnamedNode<"~">;
13451340
}
13461341

13471342
export interface UpdateExpressionNode extends NamedNodeBase {

website/docusaurus.config.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,20 @@ export default {
9393
name: "webpack-config-plugin",
9494
configureWebpack(_, isServer) {
9595
return {
96-
resolve: isServer
97-
? {}
98-
: {
99-
fallback: {
100-
"fs/promises": false,
101-
module: false
102-
}
103-
},
104-
externals: isServer
105-
? {
106-
"prettier-plugin-java": "commonjs prettier-plugin-java",
107-
"web-tree-sitter": "commonjs web-tree-sitter"
96+
resolve: {
97+
...(!isServer && {
98+
fallback: {
99+
"fs/promises": false,
100+
module: false
108101
}
109-
: {}
102+
})
103+
},
104+
externals: {
105+
...(isServer && {
106+
"prettier-plugin-java": "commonjs prettier-plugin-java",
107+
"web-tree-sitter": "commonjs web-tree-sitter"
108+
})
109+
}
110110
};
111111
}
112112
})

website/package.json

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,31 @@
1515
"typecheck": "tsc"
1616
},
1717
"dependencies": {
18-
"@docusaurus/core": "^3",
19-
"@docusaurus/preset-classic": "^3",
20-
"@mdx-js/react": "^3",
21-
"@monaco-editor/react": "^4",
22-
"lz-string": "^1",
23-
"prettier": "^3",
18+
"@catppuccin/codemirror": "1.0.3",
19+
"@catppuccin/palette": "1.8.0",
20+
"@codemirror/autocomplete": "6.20.3",
21+
"@codemirror/commands": "6.10.4",
22+
"@codemirror/lang-java": "6.0.2",
23+
"@codemirror/language": "6.12.4",
24+
"@codemirror/search": "6.7.1",
25+
"@codemirror/state": "6.7.1",
26+
"@codemirror/view": "6.43.5",
27+
"@docusaurus/core": "3.10.1",
28+
"@docusaurus/preset-classic": "3.10.1",
29+
"@mdx-js/react": "3.1.1",
30+
"lz-string": "1.5.0",
31+
"prettier": "3.9.4",
2432
"prettier-plugin-java": "link:..",
25-
"prism-react-renderer": "^2",
26-
"react": "^19",
27-
"react-dom": "^19"
33+
"prism-react-renderer": "2.4.1",
34+
"react": "19.2.7",
35+
"react-dom": "19.2.7"
2836
},
2937
"devDependencies": {
30-
"@docusaurus/module-type-aliases": "^3",
31-
"@docusaurus/tsconfig": "^3",
32-
"@docusaurus/types": "^3",
33-
"@types/react": "^19",
34-
"typescript": "^5"
38+
"@docusaurus/module-type-aliases": "3.10.1",
39+
"@docusaurus/tsconfig": "3.10.1",
40+
"@docusaurus/types": "3.10.1",
41+
"@types/react": "19.2.17",
42+
"typescript": "6.0.3"
3543
},
3644
"browserslist": {
3745
"production": [
Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
.editor {
2-
width: calc(50vw - 100px);
3-
height: calc(100vh - 60px);
4-
border-left: 1px solid #ddd;
2+
position: relative;
3+
flex: 1;
4+
border-bottom: var(--playground-border);
5+
min-inline-size: 0;
6+
min-block-size: 0;
7+
font-size: 12px;
58
}
69

7-
@media (max-width: 996px) {
8-
.editor {
9-
width: calc(100vw - 200px);
10-
height: calc(50vh - 30px);
11-
border-bottom: 1px solid #ddd;
12-
}
13-
14-
.editor ~ .editor {
15-
border-bottom: none;
16-
}
10+
.editorName {
11+
position: absolute;
12+
opacity: 0.4;
13+
z-index: 10;
14+
inset-block-end: 1px;
15+
inset-inline-start: 1px;
16+
border-start-end-radius: 4px;
17+
background: #000;
18+
padding: 0.25em 0.5em;
19+
pointer-events: none;
20+
color: #fff;
21+
line-height: 1.25;
1722
}

0 commit comments

Comments
 (0)