Skip to content

Commit aa50503

Browse files
committedMay 21, 2022
lua2js
0 parents  commit aa50503

14 files changed

+1244
-0
lines changed
 

‎.gitignore

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

‎.vscode/extensions.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["Vue.volar"]
3+
}

‎README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Vue 3 + Vite
2+
3+
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
4+
5+
## Recommended IDE Setup
6+
7+
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)

‎index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" href="/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite App</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/main.js"></script>
12+
</body>
13+
</html>

‎nginx.conf

+170
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
worker_processes auto;
2+
user root root;
3+
# pid logs/nginx.pid;
4+
5+
events {
6+
worker_connections 10240;
7+
}
8+
9+
http {
10+
root .;
11+
lua_socket_log_errors off;
12+
lua_shared_dict CODE 2M;
13+
lua_package_path "./lualib/?.lua;./apps/?.lua;;";
14+
# init_by_lua_file "init.lua";
15+
lua_code_cache on;
16+
17+
# init_worker_by_lua_file init_worker.lua;
18+
19+
client_max_body_size 10m;
20+
client_body_buffer_size 10m;
21+
22+
proxy_redirect off;
23+
proxy_set_header Host $host;
24+
proxy_set_header X-Real-IP $remote_addr;
25+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
26+
proxy_connect_timeout 90;
27+
proxy_send_timeout 90;
28+
proxy_read_timeout 90;
29+
proxy_buffers 32 4k;
30+
31+
server {
32+
listen 80;
33+
encrypted_session_key "accdefghijklmnopqrstuvwxyz123456";
34+
encrypted_session_iv "1234567812345678";
35+
encrypted_session_expires 10d;
36+
location = / {
37+
try_files /dist/index.html =404;
38+
}
39+
location / {
40+
try_files /dist$uri @lua;
41+
}
42+
location @lua {
43+
content_by_lua 'mvc.shiye()';
44+
}
45+
}
46+
server {
47+
listen 8080;
48+
49+
location / {
50+
# proxy to 3000
51+
proxy_pass http://127.0.0.1:3000;
52+
}
53+
54+
}
55+
56+
57+
keepalive_timeout 65;
58+
resolver 223.5.5.5;
59+
default_type "application/json; charset=utf-8";
60+
charset utf-8;
61+
log_format with_request_time '$remote_addr [$time_local] "$request" $status $bytes_sent "$http_referer" "$http_user_agent" $request_time';
62+
error_log logs/error.log;
63+
access_log logs/access.log with_request_time buffer=32k;
64+
65+
client_body_temp_path tmp/client_body_temp;
66+
fastcgi_temp_path tmp/fastcgi_temp;
67+
proxy_temp_path tmp/proxy_temp;
68+
scgi_temp_path tmp/scgi_temp;
69+
uwsgi_temp_path tmp/uwsgi_temp;
70+
71+
gzip on;
72+
gzip_disable "msie6";
73+
gzip_min_length 2k;
74+
gzip_vary on;
75+
gzip_proxied any;
76+
gzip_comp_level 6;
77+
gzip_buffers 16 8k;
78+
gzip_http_version 1.1;
79+
gzip_types text/plain text/css application/json application/x-javascript text/xml;
80+
81+
types {
82+
text/html html htm shtml;
83+
text/css css;
84+
text/xml xml;
85+
image/gif gif;
86+
image/jpeg jpeg jpg;
87+
application/javascript js;
88+
application/atom+xml atom;
89+
application/rss+xml rss;
90+
91+
text/mathml mml;
92+
text/plain txt;
93+
text/vnd.sun.j2me.app-descriptor jad;
94+
text/vnd.wap.wml wml;
95+
text/x-component htc;
96+
97+
image/png png;
98+
image/tiff tif tiff;
99+
image/vnd.wap.wbmp wbmp;
100+
image/x-icon ico;
101+
image/x-jng jng;
102+
image/x-ms-bmp bmp;
103+
image/svg+xml svg svgz;
104+
image/webp webp;
105+
106+
application/font-woff woff;
107+
application/java-archive jar war ear;
108+
application/json json;
109+
application/mac-binhex40 hqx;
110+
application/msword doc;
111+
application/pdf pdf;
112+
application/postscript ps eps ai;
113+
application/rtf rtf;
114+
application/vnd.apple.mpegurl m3u8;
115+
application/vnd.ms-excel xls;
116+
application/vnd.ms-fontobject eot;
117+
application/vnd.ms-powerpoint ppt;
118+
application/vnd.wap.wmlc wmlc;
119+
application/vnd.google-earth.kml+xml kml;
120+
application/vnd.google-earth.kmz kmz;
121+
application/x-7z-compressed 7z;
122+
application/x-cocoa cco;
123+
application/x-java-archive-diff jardiff;
124+
application/x-java-jnlp-file jnlp;
125+
application/x-makeself run;
126+
application/x-perl pl pm;
127+
application/x-pilot prc pdb;
128+
application/x-rar-compressed rar;
129+
application/x-redhat-package-manager rpm;
130+
application/x-sea sea;
131+
application/x-shockwave-flash swf;
132+
application/x-stuffit sit;
133+
application/x-tcl tcl tk;
134+
application/x-x509-ca-cert der pem crt;
135+
application/x-xpinstall xpi;
136+
application/xhtml+xml xhtml;
137+
application/xspf+xml xspf;
138+
application/zip zip;
139+
140+
application/octet-stream bin exe dll;
141+
application/octet-stream deb;
142+
application/octet-stream dmg;
143+
application/octet-stream iso img;
144+
application/octet-stream msi msp msm;
145+
146+
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
147+
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
148+
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;
149+
150+
audio/midi mid midi kar;
151+
audio/mpeg mp3;
152+
audio/ogg ogg;
153+
audio/x-m4a m4a;
154+
audio/x-realaudio ra;
155+
156+
video/3gpp 3gpp 3gp;
157+
video/mp2t ts;
158+
video/mp4 mp4;
159+
video/mpeg mpeg mpg;
160+
video/quicktime mov;
161+
video/webm webm;
162+
video/x-flv flv;
163+
video/x-m4v m4v;
164+
video/x-mng mng;
165+
video/x-ms-asf asx asf;
166+
video/x-ms-wmv wmv;
167+
video/x-msvideo avi;
168+
}
169+
170+
}

‎package.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "vlab",
3+
"private": true,
4+
"version": "0.0.0",
5+
"scripts": {
6+
"nginx": "nginx -p . -c nginx.conf",
7+
"nginx:reload": "yarn nginx -s reload",
8+
"nginx:stop": "yarn nginx -s stop",
9+
"dev": "vite",
10+
"build": "vite build",
11+
"preview": "vite preview"
12+
},
13+
"dependencies": {
14+
"bootstrap": "^5.1.3",
15+
"luaparse": "^0.3.1",
16+
"prettier": "^2.6.2",
17+
"vue": "^3.2.25"
18+
},
19+
"devDependencies": {
20+
"@vitejs/plugin-vue": "^2.3.3",
21+
"sass": "^1.52.1",
22+
"vite": "^2.9.9"
23+
}
24+
}

‎public/favicon.ico

4.19 KB
Binary file not shown.

‎src/App.vue

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<script setup>
2+
// This starter template is using Vue 3 <script setup> SFCs
3+
// Check out https://vuejs.org/api/sfc-script-setup.html#script-setup
4+
import HelloWorld from './components/HelloWorld.vue'
5+
</script>
6+
7+
<template>
8+
<div class="row">
9+
<HelloWorld msg="Hello Vue 3 + Vite" />
10+
</div>
11+
</template>
12+
13+
<style lang="scss">
14+
$enable-caret: true !default;
15+
$enable-rounded: false !default;
16+
$enable-shadows: false !default;
17+
$enable-gradients: false !default;
18+
$enable-transitions: true !default;
19+
$enable-grid-classes: true !default;
20+
$enable-print-styles: true !default;
21+
22+
$blue: #04405e !default;
23+
// $navbar-light-color: #d8d8d8;
24+
// $navbar-light-hover-color: #fff;
25+
// $navbar-light-active-color: #fff;
26+
// $dark: #417690;
27+
// $navbar-light-active-color: #fff;
28+
// $navbar-dark-color: #fff !default;
29+
// $navbar-dark-hover-color: #fff !default;
30+
// $light: #417690;
31+
$sidebar-background-color: #eeeeee;
32+
$sidebar-hover-color: #37424f;
33+
@import "node_modules/bootstrap/scss/bootstrap.scss";
34+
</style>

‎src/assets/logo.png

6.69 KB
Loading

‎src/components/HelloWorld.vue

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<script setup>
2+
import { ref } from 'vue'
3+
import { lua2ast, lua2js, ast2js } from './lua2js.js'
4+
5+
defineProps({
6+
msg: String
7+
})
8+
9+
const count = ref(0)
10+
const luacode = ref("")
11+
</script>
12+
13+
<template>
14+
<h1>lua 2 js</h1>
15+
<div class="row">
16+
<div class="col"><textarea class="form-control" :value="luacode" @input="luacode = $event.target.value"></textarea></div>
17+
</div>
18+
<div class="row">
19+
<pre class="col-4">{{ lua2ast(luacode) }}</pre>
20+
<div class="col-8">{{ lua2js(luacode) }}</div>
21+
</div>
22+
</template>
23+
24+
<style scoped>
25+
a {
26+
color: #42b983;
27+
}
28+
</style>

‎src/components/lua2js.js

+451
Large diffs are not rendered by default.

‎src/main.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { createApp } from 'vue'
2+
import App from './App.vue'
3+
4+
createApp(App).mount('#app')

‎vite.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineConfig } from 'vite'
2+
import vue from '@vitejs/plugin-vue'
3+
4+
// https://vitejs.dev/config/
5+
export default defineConfig({
6+
plugins: [vue()]
7+
})

‎yarn.lock

+479
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.