Skip to content

Commit 65579f9

Browse files
authored
vue 2 version of "@vue/repl" (#31)
- only includes the source code of the components. - based on a Vue 2.7 , while utilizing the powerful @vue/compiler-sfc to achieve a functionality and user experience consistent with @vue/repl. - replaced webpack with vite Vite build tool has been adopted to improve the project's building efficiency and development experience.
1 parent f509cef commit 65579f9

File tree

235 files changed

+3470
-551073
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+3470
-551073
lines changed

.env

-2
This file was deleted.

.env.deploy

-3
This file was deleted.

.env.play

-3
This file was deleted.

.env.production

-3
This file was deleted.

.eslintignore

-14
This file was deleted.

.eslintrc.js

-23
This file was deleted.

.gitignore

+13-14
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
.DS_Store
2-
node_modules
3-
/dist
4-
/lib/*.html
5-
/lib/*.html.gz
6-
/deploy
7-
8-
# local env files
9-
.env.local
10-
.env.*.local
11-
12-
# Log files
1+
# Logs
2+
logs
3+
*.log
134
npm-debug.log*
145
yarn-debug.log*
156
yarn-error.log*
16-
*pnpm-debug.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
1714

1815
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
1918
.idea
20-
.vscode
19+
.DS_Store
2120
*.suo
2221
*.ntvs*
2322
*.njsproj

.npmignore

-24
This file was deleted.

.prettierignore

-5
This file was deleted.

.prettierrc.js

-3
This file was deleted.

.travis.yml

-20
This file was deleted.

README.md

+10-75
Original file line numberDiff line numberDiff line change
@@ -14,83 +14,21 @@
1414

1515
English | [简体中文](./README.zh-CN.md)
1616

17-
A lightweight code interaction component based on `vue 2.x`, which can edit, run and preview the code effect display in real time on the web page.
17+
Vue SFC REPL as a Vue 2.7 component.
1818

19-
When reading docs that contain a lot of code, many project docs implement a `render` representation of the sample code via the `markdown loader`, but it is static. When we want to debug code, we generally need to open the local IDE or open online editor websites such as `codepen`, `codesandbox`, and it is also subject to whether the computer has a development environment installed or whether the network connection is smooth.
19+
## 💻 Simple Usage
2020

21-
So can there be such a component that can support editing code in the page, edit, run and preview the code effect display in real time in the web page?
21+
```vue
22+
<script setup>
23+
import { Repl } from 'vue-code-view'
24+
import 'vue-code-view/style.css'
25+
</script>
2226
23-
Special thanks to the component [react-code-view](https://github.com/simonguo/react-code-view), based on which the vue version of the component was written! Using this component, you can edit the running code and preview the effect in real time by using the multi-sample code in the `vue` page or the `markdown` document.
24-
25-
## ⚡ Online Demo
26-
27-
![示例][preview-ol-v03]
28-
29-
demo address: <https://andurils.github.io/vue-code-view/#/demo>
30-
31-
`codesandbox` example: [vue-code-view-example](https://codesandbox.io/s/vue-code-view-example-forked-nivmw?fontsize=14&hidenavigation=1&theme=dark)
32-
33-
## ✨ Features
34-
35-
- 💻 Code can be edited online and preview the effect in real time.
36-
- 🎨 Support sample code highlighting, configure themes.
37-
- 🌈 Support `<style>` parsing and rendering.
38-
- 📑 Support `Markdown` file example rendering
39-
40-
## 📦 Install
41-
42-
```bash
43-
npm i vue-code-view
44-
# or
45-
yarn add vue-code-view
46-
```
47-
48-
## 🔨 Configure
49-
50-
Using `vue cli` requires configuration in the `vue.config.js` file, which supports the use of Vue builds that include the runtime compiler.
51-
52-
```javascript
53-
module.exports = {
54-
runtimeCompiler: true,
55-
// or
56-
chainWebpack: (config) => {
57-
config.resolve.alias
58-
.set("vue$", "vue/dist/vue.esm.js");
59-
},
60-
};
27+
<template>
28+
<Repl />
29+
</template>
6130
```
6231

63-
## 💻 Usage
64-
65-
Components are introduced in the entry file `main.js`, and there is no need to manually introduce styles.
66-
67-
```javascript
68-
import Vue from "vue";
69-
import App from "./App.vue";
70-
import CodeView from "vue-code-view";
71-
72-
Vue.use(CodeView);
73-
74-
new Vue({
75-
router,
76-
store,
77-
render: (h) => h(App),
78-
}).$mount("#app");
79-
```
80-
81-
## 📚 API
82-
83-
### Props
84-
85-
| Property | Description | Type | Default | Version |
86-
| --- | ----- | ---- | ----- | ---- |
87-
| themeMode | code editor theme mode,default `light` | `` \| `dark` | `` | |
88-
| showCode | show the code editor , only `layout` value is `top` takes effect | boolean | false | |
89-
| source | source code | string | - | |
90-
| layout | render view layout | `top` \| `right` \| `left` | `top` | `0.4.0+` |
91-
92-
<!-- ### Events -->
93-
9432
## 📋 Changelog
9533

9634
Detailed changes for each release are documented in the [release notes](./CHANGELOG.zh-CN.md).
@@ -105,7 +43,4 @@ VCV is licensed under the terms of the [MIT License](./LICENSE).
10543

10644
Copyright (c) 2021-present Anduril
10745

108-
[preview-ol]: https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/912bf867ef4c44d3a716e4bf723573ac~tplv-k3u1fbpfcp-watermark.image?
109-
[preview-ol-v01]:https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/e056aef106b04752bde86e5bc48434c9~tplv-k3u1fbpfcp-watermark.image?
110-
[preview-ol-v02]:https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/4550d42d98084cf99fe333fadb3f5983~tplv-k3u1fbpfcp-watermark.image?
11146
[preview-ol-v03]:https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/987ab9814e314f92a244fdf6510e6224~tplv-k3u1fbpfcp-watermark.image?

api-extractor.json

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
4+
"projectFolder": ".",
5+
6+
"mainEntryPointFilePath": "./dist/src/index.d.ts",
7+
8+
"dtsRollup": {
9+
"enabled": true
10+
},
11+
12+
"apiReport": {
13+
"enabled": false
14+
},
15+
16+
"docModel": {
17+
"enabled": false
18+
},
19+
20+
"tsdocMetadata": {
21+
"enabled": false
22+
},
23+
24+
"messages": {
25+
"compilerMessageReporting": {
26+
"default": {
27+
"logLevel": "warning"
28+
}
29+
},
30+
31+
"extractorMessageReporting": {
32+
"default": {
33+
"logLevel": "warning",
34+
"addToApiReportFile": true
35+
},
36+
37+
"ae-forgotten-export": {
38+
"logLevel": "none"
39+
},
40+
41+
"ae-missing-release-tag": {
42+
"logLevel": "none"
43+
}
44+
},
45+
46+
"tsdocMessageReporting": {
47+
"default": {
48+
"logLevel": "warning"
49+
},
50+
51+
"tsdoc-undefined-tag": {
52+
"logLevel": "none"
53+
}
54+
}
55+
}
56+
}

babel.config.js

-3
This file was deleted.

build/markdown-loader/index.js

-69
This file was deleted.

build/markdown-loader/util.js

-13
This file was deleted.

0 commit comments

Comments
 (0)