Skip to content

Commit

Permalink
feat: support live demo (#1905)
Browse files Browse the repository at this point in the history
* feat: support live code

* feat: split live plugin

* feat: enabled by live config

* feat: add error catcher

* docs: add docs

* docs: add docs

* feat: update single file logic

* docs: rm docs

* feat: put Live Components into theme-default slots

* feat: update regexp & fix enable logic

* feat: make LiveEditor derivate Editor
  • Loading branch information
MadCcc committed Oct 18, 2023
1 parent 52d8774 commit 5a588c6
Show file tree
Hide file tree
Showing 27 changed files with 1,024 additions and 460 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
/target
/compiled/crates
.swc
/server
1 change: 1 addition & 0 deletions examples/normal/.dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export default {
themeConfig: { name: '示例' },
mfsu: false,
apiParser: {},
live: true,
resolve: { entryFile: './src/index.ts' },
};
2 changes: 1 addition & 1 deletion examples/normal/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ features:
代码块 demo

```jsx
import react from 'react';
import React from 'react';

export default () => <>Hello first code block demo!</>;
```
Expand Down
1 change: 1 addition & 0 deletions examples/normal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"start": "npm run dev"
},
"dependencies": {
"antd": "^5.0.0",
"react": "^18.2.0"
},
"devDependencies": {
Expand Down
9 changes: 8 additions & 1 deletion examples/normal/src/Foo/demo/work.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@
* title: 我是标题
* description: 我是简介,我可以用 `Markdown` 来编写
*/
import { Button, Space } from 'antd';
import React from 'react';

export default () => 'External Demo Block';
export default () => (
<Space direction="vertical">
<div>External Demo Block</div>
<Button>Great!</Button>
</Space>
);
4 changes: 3 additions & 1 deletion examples/normal/src/Foo/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
组件路由测试

```jsx
export default () => 'Hello Foo!';
import React from 'react';

export default () => <div>Hello Foo!</div>;
```

你好,Foo!
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
"react-copy-to-clipboard": "^5.1.0",
"react-error-boundary": "^4.0.10",
"react-intl": "^6.4.4",
"react-simple-code-editor": "^0.13.1",
"rehype-autolink-headings": "^6.1.1",
"rehype-remove-comments": "^5.0.0",
"rehype-stringify": "^9.0.3",
Expand All @@ -132,6 +133,7 @@
"remark-rehype": "^10.1.0",
"sass": "^1.64.1",
"sitemap": "^7.1.1",
"sucrase": "^3.34.0",
"umi": "^4.0.84",
"unified": "^10.1.2",
"unist-util-visit": "^4.1.2",
Expand All @@ -150,8 +152,10 @@
"@types/lodash.throttle": "^4.1.7",
"@types/node": "^18.17.1",
"@types/pluralize": "^0.0.30",
"@types/prismjs": "^1.26.0",
"@types/react": "^18.2.17",
"@types/react-copy-to-clipboard": "^5.0.4",
"@types/react-dom": "^18.2.7",
"@umijs/lint": "^4.0.84",
"@umijs/plugins": "4.0.32",
"dumi-theme-mobile": "workspace:*",
Expand All @@ -165,6 +169,7 @@
"prettier-plugin-organize-imports": "^3.2.3",
"prettier-plugin-packagejson": "^2.4.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"stylelint": "^15.10.2",
"ts-node": "^10.9.1",
"typescript": "~5.0.4",
Expand Down
Loading

0 comments on commit 5a588c6

Please sign in to comment.