├── vue ├── .gitignore ├── .babelrc ├── .DS_Store ├── main.js ├── public │ └── index.html ├── webpack.config.js ├── package.json └── npm-debug.log ├── extension ├── vscode-emoji │ ├── .gitignore │ ├── assets │ │ └── logo.png │ ├── .vscodeignore │ └── package.json ├── resource │ ├── index.js │ ├── uni.js │ └── lang.json └── hbuilder-emoji │ └── package.json ├── .DS_Store ├── omi ├── src │ ├── elements │ │ ├── app-intro │ │ │ ├── _index.css │ │ │ └── index.js │ │ ├── hello │ │ │ ├── omi.png │ │ │ ├── _index.css │ │ │ └── index.js │ │ ├── app │ │ │ └── index.js │ │ └── app-omil │ │ │ ├── _index.css │ │ │ ├── index.eno │ │ │ └── index.js │ ├── assets │ │ └── index.css │ ├── store │ │ └── admin-store.js │ ├── index.js │ ├── admin.js │ └── utils │ │ ├── mapping.js │ │ └── mapping-omio.js ├── build │ ├── favicon.ico │ ├── asset-manifest.json │ ├── manifest.json │ ├── admin.html │ ├── index.html │ ├── service-worker.js │ └── static │ │ └── js │ │ └── admin.2da51c11.js ├── public │ ├── favicon.ico │ ├── manifest.json │ └── index.html ├── config │ ├── jest │ │ ├── fileTransform.js │ │ └── cssTransform.js │ ├── entry.js │ ├── polyfills.js │ ├── paths.js │ ├── env.js │ ├── webpackDevServer.config.js │ ├── webpack.config.dev.js │ └── webpack.config.prod.js ├── .gitignore ├── scripts │ ├── test.js │ ├── start.js │ └── build.js ├── README.md ├── .eslintrc └── package.json └── README.md /vue/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /extension/vscode-emoji/.gitignore: -------------------------------------------------------------------------------- 1 | **.vsix -------------------------------------------------------------------------------- /vue/.babelrc: -------------------------------------------------------------------------------- 1 | { "presets": [ "es2015" ] } -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wscats/emoji/master/.DS_Store -------------------------------------------------------------------------------- /vue/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wscats/emoji/master/vue/.DS_Store -------------------------------------------------------------------------------- /omi/src/elements/app-intro/_index.css: -------------------------------------------------------------------------------- 1 | .app-intro { 2 | font-size: large; 3 | } 4 | -------------------------------------------------------------------------------- /omi/build/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wscats/emoji/master/omi/build/favicon.ico -------------------------------------------------------------------------------- /omi/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wscats/emoji/master/omi/public/favicon.ico -------------------------------------------------------------------------------- /omi/src/assets/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: sans-serif; 5 | } 6 | -------------------------------------------------------------------------------- /omi/src/elements/hello/omi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wscats/emoji/master/omi/src/elements/hello/omi.png -------------------------------------------------------------------------------- /extension/vscode-emoji/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wscats/emoji/master/extension/vscode-emoji/assets/logo.png -------------------------------------------------------------------------------- /omi/src/store/admin-store.js: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'I am admin page', 3 | rename(name) { 4 | this.name = name 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /omi/src/index.js: -------------------------------------------------------------------------------- 1 | import { render } from 'omi' 2 | import './assets/index.css' 3 | import './elements/app' 4 | 5 | render(, '#root') 6 | -------------------------------------------------------------------------------- /omi/src/admin.js: -------------------------------------------------------------------------------- 1 | import { render } from 'omi' 2 | import './assets/index.css' 3 | import './elements/hello' 4 | import store from './store/admin-store' 5 | 6 | render(, '#root', store) 7 | -------------------------------------------------------------------------------- /omi/src/elements/hello/_index.css: -------------------------------------------------------------------------------- 1 | .hello { 2 | text-align: center; 3 | } 4 | 5 | .omi { 6 | width: 143px; 7 | height: 59px; 8 | margin: 0 auto; 9 | background-image: url(./omi.png); 10 | } 11 | -------------------------------------------------------------------------------- /vue/main.js: -------------------------------------------------------------------------------- 1 | import Vue from "vue"; 2 | import "weui"; 3 | import index from "./components/index.vue" 4 | new Vue({ 5 | data: { 6 | name: 'abc' 7 | }, 8 | components: { 9 | index 10 | } 11 | }).$mount('#emoji') -------------------------------------------------------------------------------- /extension/vscode-emoji/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | out/test/** 4 | src/** 5 | .gitignore 6 | vsc-extension-quickstart.md 7 | **/tsconfig.json 8 | **/tslint.json 9 | **/*.map 10 | **/*.ts 11 | tests 12 | **.vsix -------------------------------------------------------------------------------- /omi/build/asset-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "admin.js": "./static/js/admin.2da51c11.js", 3 | "admin.js.map": "./static/js/admin.2da51c11.js.map", 4 | "index.js": "./static/js/index.192b3a3e.js", 5 | "index.js.map": "./static/js/index.192b3a3e.js.map", 6 | "admin.html": "./admin.html", 7 | "index.html": "./index.html" 8 | } -------------------------------------------------------------------------------- /vue/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Github-emoji 7 | 8 | 9 |
10 | 11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /omi/config/jest/fileTransform.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const path = require('path'); 4 | 5 | // This is a custom Jest transformer turning file imports into filenames. 6 | // http://facebook.github.io/jest/docs/en/webpack.html 7 | 8 | module.exports = { 9 | process(src, filename) { 10 | return `module.exports = ${JSON.stringify(path.basename(filename))};`; 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /omi/build/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Omi App", 3 | "name": "Omi Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": "./index.html", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /omi/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Omi App", 3 | "name": "Omi Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": "./index.html", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /omi/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | # /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /omi/config/jest/cssTransform.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // This is a custom Jest transformer turning style imports into empty objects. 4 | // http://facebook.github.io/jest/docs/en/webpack.html 5 | 6 | module.exports = { 7 | process() { 8 | return 'module.exports = {};'; 9 | }, 10 | getCacheKey() { 11 | // The output is always the same. 12 | return 'cssTransform'; 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /omi/src/elements/app/index.js: -------------------------------------------------------------------------------- 1 | import { define, WeElement } from 'omi' 2 | import '../app-omil' 3 | 4 | define('my-app', class extends WeElement { 5 | name = 'Omi' 6 | clickHandler = () => { 7 | this.name = 'Omio' 8 | this.update() 9 | } 10 | render() { 11 | return ( 12 |
15 | 16 |
17 | ) 18 | } 19 | }) 20 | -------------------------------------------------------------------------------- /omi/build/admin.html: -------------------------------------------------------------------------------- 1 | Omi
-------------------------------------------------------------------------------- /omi/build/index.html: -------------------------------------------------------------------------------- 1 | Omi
-------------------------------------------------------------------------------- /omi/src/elements/app-intro/index.js: -------------------------------------------------------------------------------- 1 | import { define, WeElement } from 'omi' 2 | import style from './_index.css' 3 | 4 | define('app-intro', class extends WeElement { 5 | css() { 6 | return ( 7 | style + 8 | ` 9 | code{ 10 | color: ${Math.random() > 0.5 ? 'red' : 'blue'} 11 | }` 12 | ) 13 | } 14 | 15 | render(props, data) { 16 | return ( 17 |

18 | To get started, edit src/elements/*/*.* and save to reload. 19 |

20 | ) 21 | } 22 | }) 23 | -------------------------------------------------------------------------------- /omi/src/elements/hello/index.js: -------------------------------------------------------------------------------- 1 | import { define, WeElement } from 'omi' 2 | 3 | define('hello-element', class extends WeElement { 4 | css = require('./_index.css') 5 | 6 | installed() { 7 | setTimeout(() => { 8 | this.store.name = 'Good Job!' 9 | this.update() 10 | }, 1000) 11 | } 12 | 13 | render(props, data) { 14 | return ( 15 |
16 |

{this.store.name}

17 |
I am hello element.
18 |
19 |
20 | ) 21 | } 22 | }) 23 | -------------------------------------------------------------------------------- /extension/resource/index.js: -------------------------------------------------------------------------------- 1 | const emojis = require('./emoji.json'); 2 | const fs = require('fs'); 3 | let hbuilder = {}; 4 | let md = '|Emoji|Prefix|\n|-|-|\n'; 5 | Object.keys(emojis).map((item) => { 6 | // 生成 hbuilder 的 prefix 7 | emojis[item].prefix.map((prefix, index) => { 8 | hbuilder[item + index] = { 9 | ...emojis[item], 10 | prefix 11 | } 12 | }) 13 | // 生成 md 14 | md += `|${emojis[item].body}|${emojis[item].prefix}|\n`; 15 | }) 16 | fs.writeFileSync('./hbuilder.json', JSON.stringify(hbuilder)); 17 | fs.writeFileSync('./emoji.md', md); -------------------------------------------------------------------------------- /omi/config/entry.js: -------------------------------------------------------------------------------- 1 | let fs = require('fs'), 2 | fileList = []; 3 | 4 | 5 | if (typeof String.prototype.endsWith != 'function') { 6 | String.prototype.endsWith = function (suffix) { 7 | return this.indexOf(suffix, this.length - suffix.length) !== -1; 8 | }; 9 | } 10 | 11 | function walk(path) { 12 | let dirList = fs.readdirSync(path); 13 | dirList.forEach(function (item) { 14 | if (!fs.statSync(path + '/' + item).isDirectory()) { 15 | if (item.endsWith('\.js')) { 16 | fileList.push(item.substr(0, item.length - 3)); 17 | } 18 | } else { 19 | //walk(path + '/' + item); 20 | } 21 | }); 22 | } 23 | 24 | walk('./src'); 25 | 26 | 27 | 28 | module.exports = fileList; -------------------------------------------------------------------------------- /vue/webpack.config.js: -------------------------------------------------------------------------------- 1 | //webpack.config.js 2 | module.exports = { 3 | devtool: 'eval-source-map', //用于调试代码 4 | entry: __dirname + "/main.js", //已多次提及的唯一入口文件 5 | output: { 6 | path: __dirname + "/public", //打包后的文件存放的地方 7 | filename: "bundle.js" //打包后输出文件的文件名 8 | }, 9 | module: { 10 | loaders: [{ 11 | test: /\.css$/, 12 | loader: 'style-loader!css-loader' 13 | }, { 14 | test: /\.(png|jpg)$/, 15 | loader: 'url-loader?limit=8192' 16 | }, { 17 | test: /\.js$/, 18 | exclude: /node_modules/, 19 | loader: "babel-loader" 20 | }, { 21 | test: /\.vue$/, 22 | loader: 'vue-loader' 23 | }] 24 | }, 25 | devServer: { 26 | contentBase: "./public", //本地服务器所加载的页面所在的目录 27 | historyApiFallback: true, //不跳转 28 | inline: true //实时刷新 29 | }, 30 | resolve: { 31 | alias: { 32 | vue: 'vue/dist/vue.js' 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /omi/scripts/test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Do this as the first thing so that any code reading it knows the right env. 4 | process.env.BABEL_ENV = 'test'; 5 | process.env.NODE_ENV = 'test'; 6 | process.env.PUBLIC_URL = ''; 7 | 8 | // Makes the script crash on unhandled rejections instead of silently 9 | // ignoring them. In the future, promise rejections that are not handled will 10 | // terminate the Node.js process with a non-zero exit code. 11 | process.on('unhandledRejection', err => { 12 | throw err; 13 | }); 14 | 15 | // Ensure environment variables are read. 16 | require('../config/env'); 17 | 18 | const jest = require('jest'); 19 | let argv = process.argv.slice(2); 20 | 21 | // Watch unless on CI or in coverage mode 22 | if (!process.env.CI && argv.indexOf('--coverage') < 0) { 23 | argv.push('--watch'); 24 | } 25 | 26 | 27 | jest.run(argv); 28 | -------------------------------------------------------------------------------- /omi/config/polyfills.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (typeof Promise === 'undefined') { 4 | // Rejection tracking prevents a common issue where React gets into an 5 | // inconsistent state due to an error, but it gets swallowed by a Promise, 6 | // and the user has no idea what causes React's erratic future behavior. 7 | require('promise/lib/rejection-tracking').enable(); 8 | window.Promise = require('promise/lib/es6-extensions.js'); 9 | } 10 | 11 | // fetch() polyfill for making API calls. 12 | require('whatwg-fetch'); 13 | 14 | // Object.assign() is commonly used with React. 15 | // It will use the native implementation if it's present and isn't buggy. 16 | Object.assign = require('object-assign'); 17 | 18 | // In tests, polyfill requestAnimationFrame since jsdom doesn't provide it yet. 19 | // We don't polyfill it in the browser--this is user's responsibility. 20 | if (process.env.NODE_ENV === 'test') { 21 | require('raf').polyfill(global); 22 | } 23 | -------------------------------------------------------------------------------- /extension/resource/uni.js: -------------------------------------------------------------------------------- 1 | const javascript = require('./javascript.json'); 2 | const css = require('./css.json'); 3 | const html = require('./vue-html.json'); 4 | const fs = require('fs'); 5 | let javascriptMD = '|API|Prefix|Description|\n|-|-|-|\n'; 6 | let cssMD = '|API|Prefix|Description|\n|-|-|-|\n'; 7 | let htmlMD = '|API|Prefix|Description|\n|-|-|-|\n'; 8 | Object.keys(javascript).map((item) => { 9 | // 生成 md 10 | javascriptMD += `|\`${javascript[item].body}\`|${javascript[item].prefix}|${javascript[item].description}|\n`; 11 | }) 12 | Object.keys(css).map((item) => { 13 | // 生成 md 14 | cssMD += `|\`${css[item].body}\`|${css[item].prefix}|${css[item].description}|\n`; 15 | }) 16 | Object.keys(html).map((item) => { 17 | // 生成 md 18 | htmlMD += `|\`${html[item].body}\`|\`${html[item].prefix}\`|${html[item].description}|\n`; 19 | }) 20 | fs.writeFileSync('./javascript.md', javascriptMD); 21 | fs.writeFileSync('./css.md', cssMD); 22 | fs.writeFileSync('./html.md', htmlMD); 23 | -------------------------------------------------------------------------------- /vue/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "github-emoji", 3 | "version": "1.2.3", 4 | "description": "Github表情大全", 5 | "main": "main.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "dev": "webpack-dev-server" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/Wscats/github-emoji.git" 13 | }, 14 | "author": "Wscats oaoafly&wscats", 15 | "license": "ISC", 16 | "bugs": { 17 | "url": "https://github.com/Wscats/github-emoji/issues" 18 | }, 19 | "homepage": "https://github.com/Wscats/github-emoji#readme", 20 | "dependencies": { 21 | "babel-cli": "^6.23.0", 22 | "babel-core": "^6.23.1", 23 | "babel-loader": "^6.3.2", 24 | "babel-preset-es2015": "^6.22.0", 25 | "css-loader": "^0.26.1", 26 | "vue": "^2.1.6", 27 | "vue-loader": "^10.0.2", 28 | "style-loader": "^0.16.1", 29 | "vue-template-compiler": "^2.1.6", 30 | "webpack": "^1.14.0", 31 | "webpack-dev-server": "^3.10.1", 32 | "weui": "^1.1.1" 33 | }, 34 | "devDependencies": { 35 | "babel-loader": "^6.4.1" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /omi/src/elements/app-omil/_index.css: -------------------------------------------------------------------------------- 1 | .page__hd { 2 | padding: 40px; 3 | } 4 | 5 | .page__title { 6 | text-align: left; 7 | font-size: 20px; 8 | font-weight: 400; 9 | } 10 | 11 | .page__desc { 12 | margin-top: 5px; 13 | color: #888; 14 | text-align: left; 15 | font-size: 14px; 16 | } 17 | 18 | .page, 19 | body { 20 | background-color: #f8f8f8; 21 | } 22 | 23 | .page__bd_spacing { 24 | padding: 0 15px; 25 | } 26 | 27 | .page__bd_spacing_top { 28 | overflow: hidden; 29 | padding-top: 15px; 30 | } 31 | 32 | input[type=range] { 33 | width: 100%; 34 | -webkit-appearance: none; 35 | background: #f8f8f8; 36 | } 37 | 38 | input[type=range]::-webkit-slider-thumb { 39 | -webkit-appearance: none; 40 | height: 25px; 41 | width: 25px; 42 | margin-top: -5px; 43 | /*使滑块超出轨道部分的偏移量相等*/ 44 | background: #ffffff; 45 | border-radius: 50%; 46 | /*外观设置为圆形*/ 47 | border: solid 0.125em rgba(205, 224, 230, 0.5); 48 | /*设置边框*/ 49 | box-shadow: 0 .125em .125em #3b4547; 50 | /*添加底部阴影*/ 51 | } -------------------------------------------------------------------------------- /omi/README.md: -------------------------------------------------------------------------------- 1 | ## Develop 2 | 3 | ```bash 4 | npm install 5 | npm start 6 | ``` 7 | 8 | ## Release 9 | 10 | ```bash 11 | npm run build 12 | ``` 13 | 14 | ## Eslint + Prettier 15 | 16 | ``` bash 17 | npm run fix 18 | ``` 19 | 20 | ## Directory description 21 | 22 | ``` 23 | ├─ config 24 | ├─ public 25 | ├─ scripts 26 | ├─ src 27 | │ ├─ assets 28 | │ ├─ elements //Store all custom elements 29 | │ ├─ store //Store all this store of pages 30 | │ ├─ admin.js //Entry js of compiler,will build to admin.html 31 | │ └─ index.js //Entry js of compiler,will build to index.html 32 | ``` 33 | 34 | ## Build Scripts 35 | 36 | ```json 37 | "scripts": { 38 | "start": "node scripts/start.js", 39 | "build": "PUBLIC_URL=. node scripts/build.js", 40 | "build-windows": "set PUBLIC_URL=.&& node scripts/build.js", 41 | "fix": "eslint src --fix" 42 | } 43 | ``` 44 | 45 | You can set up the PUBLIC_URL, such as: 46 | 47 | ```bash 48 | ... 49 | "build": "PUBLIC_URL=https://fe.wxpay.oa.com/dv node scripts/build.js", 50 | "build-windows": "set PUBLIC_URL=https://fe.wxpay.oa.com/dv&& node scripts/build.js", 51 | ... 52 | ``` 53 | 54 | ## Switch omi and omio 55 | 56 | Add or remove the alias config in package.json to switch omi and omio: 57 | 58 | ```js 59 | ... 60 | "alias": { 61 | "omi": "omio" 62 | } 63 | ... 64 | ``` 65 | 66 | ## License 67 | 68 | MIT 69 | 70 | -------------------------------------------------------------------------------- /omi/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "extends": ["prettier"], 4 | "plugins": ["prettier"], 5 | "env": { 6 | "browser": true, 7 | "mocha": true, 8 | "node": true, 9 | "es6": true 10 | }, 11 | "parserOptions": { 12 | "ecmaFeatures": { 13 | "modules": true, 14 | "jsx": true 15 | } 16 | }, 17 | "globals": { 18 | "sinon": true, 19 | "expect": true 20 | }, 21 | "rules": { 22 | "prettier/prettier": "error", 23 | "no-cond-assign": 1, 24 | "no-empty": 0, 25 | "no-console": 1, 26 | "semi": [1, "never"], 27 | "camelcase": 0, 28 | "comma-style": 2, 29 | "comma-dangle": [2, "never"], 30 | "indent": ["error", 2], 31 | "no-mixed-spaces-and-tabs": [2, "smart-tabs"], 32 | "no-trailing-spaces": [2, { "skipBlankLines": true }], 33 | "max-nested-callbacks": [2, 3], 34 | "no-eval": 2, 35 | "no-implied-eval": 2, 36 | "no-new-func": 2, 37 | "guard-for-in": 0, 38 | "eqeqeq": 0, 39 | "no-else-return": 2, 40 | "no-redeclare": 2, 41 | "no-dupe-keys": 2, 42 | "radix": 2, 43 | "strict": [2, "never"], 44 | "no-shadow": 0, 45 | "callback-return": [1, ["callback", "cb", "next", "done"]], 46 | "no-delete-var": 2, 47 | "no-undef-init": 2, 48 | "no-shadow-restricted-names": 2, 49 | "handle-callback-err": 0, 50 | "no-lonely-if": 2, 51 | "keyword-spacing": 2, 52 | "constructor-super": 2, 53 | "no-this-before-super": 2, 54 | "no-dupe-class-members": 2, 55 | "no-const-assign": 2, 56 | "prefer-spread": 2, 57 | "no-useless-concat": 2, 58 | "no-var": 2, 59 | "object-shorthand": 2, 60 | "prefer-arrow-callback": 2, 61 | "quotes": [1, "single"] 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /omi/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 22 | Omi 23 | 24 | 25 | 28 |
29 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /omi/config/paths.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const path = require('path'); 4 | const fs = require('fs'); 5 | const url = require('url'); 6 | 7 | // Make sure any symlinks in the project folder are resolved: 8 | // https://github.com/facebookincubator/create-react-app/issues/637 9 | const appDirectory = fs.realpathSync(process.cwd()); 10 | const resolveApp = relativePath => path.resolve(appDirectory, relativePath); 11 | 12 | const envPublicUrl = process.env.PUBLIC_URL; 13 | 14 | function ensureSlash(path, needsSlash) { 15 | const hasSlash = path.endsWith('/'); 16 | if (hasSlash && !needsSlash) { 17 | return path.substr(path, path.length - 1); 18 | } else if (!hasSlash && needsSlash) { 19 | return `${path}/`; 20 | } else { 21 | return path; 22 | } 23 | } 24 | 25 | const getPublicUrl = appPackageJson => 26 | envPublicUrl || require(appPackageJson).homepage; 27 | 28 | // We use `PUBLIC_URL` environment variable or "homepage" field to infer 29 | // "public path" at which the app is served. 30 | // Webpack needs to know it to put the right 117 | -------------------------------------------------------------------------------- /omi/src/utils/mapping-omio.js: -------------------------------------------------------------------------------- 1 | /** 2 | * mappingjs v2.0.0 by dntzhang 3 | * Objects mapping for javascript. Omi MVVM's best partner. 4 | * @method mapping 5 | * @param {from} options 6 | * @param {to} options 7 | * @param {rule} options 8 | * @return {Object} To Object 9 | */ 10 | 11 | var ARRAYTYPE = '[object Array]' 12 | var OBJECTTYPE = '[object Object]' 13 | 14 | function mapping(from, to, rule) { 15 | var tempRule = Object.assign({}, rule) 16 | var res = to || {} 17 | Object.keys(from).forEach(function(key) { 18 | var obj = from[key] 19 | if (isArray(obj)) { 20 | res[key] = res[key] || [] 21 | arrayMapping(obj, res[key], tempRule, key) 22 | } else if (isObject(obj)) { 23 | res[key] = res[key] || {} 24 | objMapping(obj, res[key], tempRule, key) 25 | } else { 26 | res[key] = obj 27 | } 28 | }) 29 | 30 | rule && 31 | Object.keys(tempRule).forEach(function(key) { 32 | var arr = key 33 | .replace(/]/g, '') 34 | .replace(/\[/g, '.') 35 | .split('.') 36 | 37 | if (arr.length === 1) { 38 | res[key] = tempRule[key].call ? tempRule[key].call(from) : tempRule[key] 39 | delete tempRule[key] 40 | } 41 | }) 42 | 43 | return res 44 | } 45 | 46 | function arrayMapping(from, to, rule, path) { 47 | if (from.length < to.length) { 48 | if (to.size) { 49 | //obaa extend method 50 | to.size(from.length) 51 | } else { 52 | to.length = from.length 53 | } 54 | } 55 | 56 | from.forEach(function(item, index) { 57 | //push method can trigger obaa callback 58 | if (index > to.length - 1) { 59 | if (isArray(item)) { 60 | to.push(arrayMapping(item, to[index], rule, path + '[' + index + ']')) 61 | } else if (isObject(item)) { 62 | to.push(objMapping(item, to[index], rule, path + '[' + index + ']')) 63 | } else { 64 | to.push(item) 65 | } 66 | } else { 67 | if (isArray(item)) { 68 | to[index] = to[index] || [] 69 | arrayMapping(item, to[index], rule, path + '[' + index + ']') 70 | } else if (isObject(item)) { 71 | to[index] = objMapping(item, to[index], rule, path + '[' + index + ']') 72 | } else { 73 | to[index] = item 74 | } 75 | } 76 | }) 77 | 78 | rule && 79 | Object.keys(rule).forEach(function(key) { 80 | var arr = key 81 | .replace(/]/g, '') 82 | .replace(/\[/g, '.') 83 | .split('.') 84 | var pathArr = path 85 | .replace(/]/g, '') 86 | .replace(/\[/g, '.') 87 | .split('.') 88 | 89 | var dl = arr.length - pathArr.length 90 | if (dl === 1 && equalArr(arr, pathArr)) { 91 | to[arr[arr.length - 1]] = rule[key].call 92 | ? rule[key].call(from) 93 | : rule[key] 94 | delete rule[key] 95 | } 96 | }) 97 | } 98 | 99 | function objMapping(from, to, rule, path) { 100 | var res = to || {} 101 | Object.keys(from).forEach(function(key) { 102 | var obj = from[key] 103 | if (isArray(obj)) { 104 | res[key] = res[key] || [] 105 | arrayMapping(obj, res[key], rule, path + '.' + key) 106 | } else if (isObject(obj)) { 107 | res[key] = res[key] || {} 108 | objMapping(obj, res[key], rule, path + '.' + key) 109 | } else { 110 | res[key] = obj 111 | } 112 | }) 113 | 114 | rule && 115 | Object.keys(rule).forEach(function(key) { 116 | var arr = key 117 | .replace(/]/g, '') 118 | .replace(/\[/g, '.') 119 | .split('.') 120 | var pathArr = path 121 | .replace(/]/g, '') 122 | .replace(/\[/g, '.') 123 | .split('.') 124 | 125 | if (arr.length - pathArr.length === 1 && equalArr(arr, pathArr)) { 126 | res[arr[arr.length - 1]] = rule[key].call 127 | ? rule[key].call(from) 128 | : rule[key] 129 | if (arr.indexOf('*') === -1) { 130 | delete rule[key] 131 | } 132 | } 133 | }) 134 | 135 | return res 136 | } 137 | 138 | function equalArr(arrA, arrB) { 139 | var i = 0, 140 | len = arrB.length 141 | for (; i < len; i++) { 142 | if (arrA[i] !== arrB[i] && !(arrA[i] === '*' && !isNaN(Number(arrB[i])))) { 143 | return false 144 | } 145 | } 146 | return true 147 | } 148 | 149 | function isArray(obj) { 150 | return Object.prototype.toString.call(obj) === ARRAYTYPE 151 | } 152 | 153 | function isObject(obj) { 154 | return Object.prototype.toString.call(obj) === OBJECTTYPE 155 | } 156 | 157 | //Compatible with older versions 158 | mapping.auto = mapping 159 | 160 | export default mapping 161 | -------------------------------------------------------------------------------- /omi/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "omi", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@babel/cli": "^7.0.0", 7 | "@babel/core": "^7.2.2", 8 | "@babel/plugin-proposal-class-properties": "^7.2.3", 9 | "@babel/plugin-proposal-decorators": "^7.2.3", 10 | "@babel/plugin-proposal-function-bind": "^7.2.0", 11 | "@babel/plugin-proposal-object-rest-spread": "^7.2.0", 12 | "@babel/plugin-syntax-dynamic-import": "^7.2.0", 13 | "@babel/plugin-transform-runtime": "^7.2.0", 14 | "@babel/preset-env": "^7.2.3", 15 | "@babel/preset-react": "^7.0.0", 16 | "@babel/runtime": "^7.3.1", 17 | "autoprefixer": "7.1.6", 18 | "babel-core": "^7.0.0-bridge.0", 19 | "babel-eslint": "7.2.3", 20 | "babel-jest": "20.0.3", 21 | "babel-loader": "^8.0.5", 22 | "case-sensitive-paths-webpack-plugin": "2.1.1", 23 | "chalk": "1.1.3", 24 | "css": "^2.2.4", 25 | "css-loader": "^1.0.1", 26 | "dotenv": "4.0.0", 27 | "dotenv-expand": "4.2.0", 28 | "eslint": "^4.18.2", 29 | "eslint-config-prettier": "^3.1.0", 30 | "eslint-loader": "1.9.0", 31 | "eslint-plugin-flowtype": "2.39.1", 32 | "eslint-plugin-import": "2.8.0", 33 | "eslint-plugin-jsx-a11y": "5.1.1", 34 | "eslint-plugin-prettier": "^3.0.0", 35 | "extract-text-webpack-plugin": "^4.0.0-beta.0", 36 | "file": "^0.2.2", 37 | "file-loader": "^2.0.0", 38 | "fs-extra": "3.0.1", 39 | "html-webpack-plugin": "^4.0.0-beta.5", 40 | "jest": "20.0.4", 41 | "less": "^3.10.0", 42 | "less-loader": "^5.0.0", 43 | "mini-css-extract-plugin": "^0.5.0", 44 | "object-assign": "4.1.1", 45 | "omi": "latest", 46 | "omil": "latest", 47 | "omi-router": "latest", 48 | "omio": "latest", 49 | "omiu": "latest", 50 | "optimize-css-assets-webpack-plugin": "^5.0.1", 51 | "postcss-flexbugs-fixes": "3.2.0", 52 | "postcss-loader": "2.0.8", 53 | "prettier": "^1.14.3", 54 | "promise": "8.0.1", 55 | "raf": "3.4.0", 56 | "react-dev-utils": "^7.0.1", 57 | "reomi": "latest", 58 | "resolve": "1.6.0", 59 | "style-loader": "0.19.0", 60 | "sw-precache-webpack-plugin": "^0.11.5", 61 | "to-string-loader": "^1.1.5", 62 | "url": "^0.11.0", 63 | "url-loader": "^1.1.2", 64 | "webpack": "^4.28.3", 65 | "webpack-cli": "^3.2.0", 66 | "webpack-dev-server": "^3.1.10", 67 | "webpack-manifest-plugin": "^2.0.4", 68 | "webpack-merge": "^4.2.1", 69 | "weui": "^2.0.1", 70 | "whatwg-fetch": "2.0.3" 71 | }, 72 | "scripts": { 73 | "start": "node scripts/start.js", 74 | "build": "PUBLIC_URL=. node scripts/build.js", 75 | "build-windows": "set PUBLIC_URL=.&& node scripts/build.js", 76 | "fix": "eslint src --fix" 77 | }, 78 | "jest": { 79 | "collectCoverageFrom": [ 80 | "src/**/*.{js,jsx,mjs}" 81 | ], 82 | "setupFiles": [ 83 | "/config/polyfills.js" 84 | ], 85 | "testMatch": [ 86 | "/src/**/__tests__/**/*.{js,jsx,mjs}", 87 | "/src/**/?(*.)(spec|test).{js,jsx,mjs}" 88 | ], 89 | "testEnvironment": "node", 90 | "testURL": "http://localhost", 91 | "transform": { 92 | "^.+\\.(js|jsx|mjs)$": "/node_modules/babel-jest", 93 | "^.+\\.css$": "/config/jest/cssTransform.js", 94 | "^(?!.*\\.(js|jsx|mjs|css|json)$)": "/config/jest/fileTransform.js" 95 | }, 96 | "transformIgnorePatterns": [ 97 | "[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$" 98 | ], 99 | "moduleNameMapper": { 100 | "^react-native$": "react-native-web" 101 | }, 102 | "moduleFileExtensions": [ 103 | "web.js", 104 | "js", 105 | "json", 106 | "web.jsx", 107 | "jsx", 108 | "node", 109 | "mjs" 110 | ] 111 | }, 112 | "babel": { 113 | "presets": [ 114 | "@babel/preset-env", 115 | [ 116 | "@babel/preset-react", 117 | { 118 | "pragma": "Omi.h" 119 | } 120 | ] 121 | ], 122 | "plugins": [ 123 | "@babel/plugin-proposal-class-properties", 124 | "@babel/transform-runtime", 125 | [ 126 | "@babel/plugin-proposal-decorators", 127 | { 128 | "legacy": true 129 | } 130 | ], 131 | "@babel/plugin-proposal-function-bind", 132 | "@babel/plugin-proposal-object-rest-spread", 133 | "@babel/plugin-syntax-dynamic-import" 134 | ] 135 | }, 136 | "prettier": { 137 | "singleQuote": true, 138 | "semi": false, 139 | "tabWidth": 2, 140 | "useTabs": false 141 | }, 142 | "alias": { 143 | "omi": "omio" 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /omi/scripts/build.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Do this as the first thing so that any code reading it knows the right env. 4 | process.env.BABEL_ENV = 'production'; 5 | process.env.NODE_ENV = 'production'; 6 | 7 | // Makes the script crash on unhandled rejections instead of silently 8 | // ignoring them. In the future, promise rejections that are not handled will 9 | // terminate the Node.js process with a non-zero exit code. 10 | process.on('unhandledRejection', err => { 11 | throw err; 12 | }); 13 | 14 | // Ensure environment variables are read. 15 | require('../config/env'); 16 | 17 | const path = require('path'); 18 | const chalk = require('chalk'); 19 | const fs = require('fs-extra'); 20 | const webpack = require('webpack'); 21 | const config = require('../config/webpack.config.prod'); 22 | const paths = require('../config/paths'); 23 | const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles'); 24 | const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages'); 25 | const printHostingInstructions = require('react-dev-utils/printHostingInstructions'); 26 | const FileSizeReporter = require('react-dev-utils/FileSizeReporter'); 27 | const printBuildError = require('react-dev-utils/printBuildError'); 28 | 29 | const measureFileSizesBeforeBuild = 30 | FileSizeReporter.measureFileSizesBeforeBuild; 31 | const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild; 32 | const useYarn = fs.existsSync(paths.yarnLockFile); 33 | 34 | // These sizes are pretty large. We'll warn for bundles exceeding them. 35 | const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024; 36 | const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024; 37 | 38 | // Warn and crash if required files are missing 39 | if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { 40 | process.exit(1); 41 | } 42 | 43 | // First, read the current file sizes in build directory. 44 | // This lets us display how much they changed later. 45 | measureFileSizesBeforeBuild(paths.appBuild) 46 | .then(previousFileSizes => { 47 | // Remove all content but keep the directory so that 48 | // if you're in it, you don't end up in Trash 49 | fs.emptyDirSync(paths.appBuild); 50 | // Merge with the public folder 51 | copyPublicFolder(); 52 | // Start the webpack build 53 | return build(previousFileSizes); 54 | }) 55 | .then( 56 | ({ stats, previousFileSizes, warnings }) => { 57 | if (warnings.length) { 58 | console.log(chalk.yellow('Compiled with warnings.\n')); 59 | console.log(warnings.join('\n\n')); 60 | console.log( 61 | '\nSearch for the ' + 62 | chalk.underline(chalk.yellow('keywords')) + 63 | ' to learn more about each warning.' 64 | ); 65 | console.log( 66 | 'To ignore, add ' + 67 | chalk.cyan('// eslint-disable-next-line') + 68 | ' to the line before.\n' 69 | ); 70 | } else { 71 | console.log(chalk.green('Compiled successfully.\n')); 72 | } 73 | 74 | console.log('File sizes after gzip:\n'); 75 | printFileSizesAfterBuild( 76 | stats, 77 | previousFileSizes, 78 | paths.appBuild, 79 | WARN_AFTER_BUNDLE_GZIP_SIZE, 80 | WARN_AFTER_CHUNK_GZIP_SIZE 81 | ); 82 | console.log(); 83 | 84 | const appPackage = require(paths.appPackageJson); 85 | const publicUrl = paths.publicUrl; 86 | const publicPath = config.output.publicPath; 87 | const buildFolder = path.relative(process.cwd(), paths.appBuild); 88 | printHostingInstructions( 89 | appPackage, 90 | publicUrl, 91 | publicPath, 92 | buildFolder, 93 | useYarn 94 | ); 95 | }, 96 | err => { 97 | console.log(chalk.red('Failed to compile.\n')); 98 | printBuildError(err); 99 | process.exit(1); 100 | } 101 | ); 102 | 103 | // Create the production build and print the deployment instructions. 104 | function build(previousFileSizes) { 105 | console.log('Creating an optimized production build...'); 106 | 107 | let compiler = webpack(config); 108 | return new Promise((resolve, reject) => { 109 | compiler.run((err, stats) => { 110 | if (err) { 111 | return reject(err); 112 | } 113 | const messages = formatWebpackMessages(stats.toJson({}, true)); 114 | if (messages.errors.length) { 115 | // Only keep the first error. Others are often indicative 116 | // of the same problem, but confuse the reader with noise. 117 | if (messages.errors.length > 1) { 118 | messages.errors.length = 1; 119 | } 120 | return reject(new Error(messages.errors.join('\n\n'))); 121 | } 122 | if ( 123 | process.env.CI && 124 | (typeof process.env.CI !== 'string' || 125 | process.env.CI.toLowerCase() !== 'false') && 126 | messages.warnings.length 127 | ) { 128 | console.log( 129 | chalk.yellow( 130 | '\nTreating warnings as errors because process.env.CI = true.\n' + 131 | 'Most CI servers set it automatically.\n' 132 | ) 133 | ); 134 | return reject(new Error(messages.warnings.join('\n\n'))); 135 | } 136 | return resolve({ 137 | stats, 138 | previousFileSizes, 139 | warnings: messages.warnings, 140 | }); 141 | }); 142 | }); 143 | } 144 | 145 | function copyPublicFolder() { 146 | fs.copySync(paths.appPublic, paths.appBuild, { 147 | dereference: true, 148 | filter: file => file !== paths.appHtml, 149 | }); 150 | } 151 | -------------------------------------------------------------------------------- /omi/config/webpackDevServer.config.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware'); 4 | const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware'); 5 | const ignoredFiles = require('react-dev-utils/ignoredFiles'); 6 | const config = require('./webpack.config.dev'); 7 | const paths = require('./paths'); 8 | 9 | const protocol = process.env.HTTPS === 'true' ? 'https' : 'http'; 10 | const host = process.env.HOST || '0.0.0.0'; 11 | 12 | // const fileList = require('./entry'); 13 | 14 | // let rewrites = []; 15 | 16 | // fileList.forEach(function (item) { 17 | 18 | // rewrites.push({ from: new RegExp('^\/' + item + '.html', 'g'), to: '/build/' + item + '.html' }) 19 | 20 | // }); 21 | 22 | 23 | 24 | module.exports = function(proxy, allowedHost) { 25 | return { 26 | // WebpackDevServer 2.4.3 introduced a security fix that prevents remote 27 | // websites from potentially accessing local content through DNS rebinding: 28 | // https://github.com/webpack/webpack-dev-server/issues/887 29 | // https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a 30 | // However, it made several existing use cases such as development in cloud 31 | // environment or subdomains in development significantly more complicated: 32 | // https://github.com/facebookincubator/create-react-app/issues/2271 33 | // https://github.com/facebookincubator/create-react-app/issues/2233 34 | // While we're investigating better solutions, for now we will take a 35 | // compromise. Since our WDS configuration only serves files in the `public` 36 | // folder we won't consider accessing them a vulnerability. However, if you 37 | // use the `proxy` feature, it gets more dangerous because it can expose 38 | // remote code execution vulnerabilities in backends like Django and Rails. 39 | // So we will disable the host check normally, but enable it if you have 40 | // specified the `proxy` setting. Finally, we let you override it if you 41 | // really know what you're doing with a special environment variable. 42 | disableHostCheck: 43 | !proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true', 44 | // Enable gzip compression of generated files. 45 | compress: true, 46 | // Silence WebpackDevServer's own logs since they're generally not useful. 47 | // It will still show compile warnings and errors with this setting. 48 | clientLogLevel: 'none', 49 | // By default WebpackDevServer serves physical files from current directory 50 | // in addition to all the virtual build products that it serves from memory. 51 | // This is confusing because those files won’t automatically be available in 52 | // production build folder unless we copy them. However, copying the whole 53 | // project directory is dangerous because we may expose sensitive files. 54 | // Instead, we establish a convention that only files in `public` directory 55 | // get served. Our build script will copy `public` into the `build` folder. 56 | // In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%: 57 | // 58 | // In JavaScript code, you can access it with `process.env.PUBLIC_URL`. 59 | // Note that we only recommend to use `public` folder as an escape hatch 60 | // for files like `favicon.ico`, `manifest.json`, and libraries that are 61 | // for some reason broken when imported through Webpack. If you just want to 62 | // use an image, put it in `src` and `import` it from JavaScript instead. 63 | contentBase: paths.appPublic, 64 | // By default files from `contentBase` will not trigger a page reload. 65 | watchContentBase: true, 66 | // Enable hot reloading server. It will provide /sockjs-node/ endpoint 67 | // for the WebpackDevServer client so it can learn when the files were 68 | // updated. The WebpackDevServer client is included as an entry point 69 | // in the Webpack development configuration. Note that only changes 70 | // to CSS are currently hot reloaded. JS changes will refresh the browser. 71 | hot: true, 72 | // It is important to tell WebpackDevServer to use the same "root" path 73 | // as we specified in the config. In development, we always serve from /. 74 | publicPath: config.output.publicPath, 75 | // WebpackDevServer is noisy by default so we emit custom message instead 76 | // by listening to the compiler events with `compiler.plugin` calls above. 77 | quiet: true, 78 | // Reportedly, this avoids CPU overload on some systems. 79 | // https://github.com/facebookincubator/create-react-app/issues/293 80 | // src/node_modules is not ignored to support absolute imports 81 | // https://github.com/facebookincubator/create-react-app/issues/1065 82 | watchOptions: { 83 | ignored: ignoredFiles(paths.appSrc), 84 | }, 85 | // Enable HTTPS if the HTTPS environment variable is set to 'true' 86 | https: protocol === 'https', 87 | host: host, 88 | overlay: false, 89 | historyApiFallback: { 90 | // Paths with dots should still use the history fallback. 91 | // See https://github.com/facebookincubator/create-react-app/issues/387. 92 | disableDotRule: true 93 | //rewrites: rewrites 94 | }, 95 | public: allowedHost, 96 | proxy, 97 | before(app) { 98 | // This lets us open files from the runtime error overlay. 99 | app.use(errorOverlayMiddleware()); 100 | // This service worker file is effectively a 'no-op' that will reset any 101 | // previous service worker registered for the same host:port combination. 102 | // We do this in development to avoid hitting the production cache if 103 | // it used the same host and port. 104 | // https://github.com/facebookincubator/create-react-app/issues/2272#issuecomment-302832432 105 | app.use(noopServiceWorkerMiddleware()); 106 | }, 107 | }; 108 | }; 109 | -------------------------------------------------------------------------------- /extension/hbuilder-emoji/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "emoji-snippet", 3 | "description": "收录最全表情代码块,更方便你对代码标记和文档编写等", 4 | "displayName": "表情代码块", 5 | "version": "0.0.2", 6 | "publisher": "wscats", 7 | "engines": { 8 | "HBuilderX": "^2.7.0" 9 | }, 10 | "categories": [ 11 | "Other" 12 | ], 13 | "contributes": { 14 | "snippets": [{ 15 | "language": "txt", 16 | "path": "./snippets/emoji.json" 17 | }, 18 | { 19 | "language": "actionscript", 20 | "path": "./snippets/emoji.json" 21 | }, 22 | { 23 | "language": "ada", 24 | "path": "./snippets/emoji.json" 25 | }, 26 | { 27 | "language": "asm", 28 | "path": "./snippets/emoji.json" 29 | }, 30 | { 31 | "language": "asp", 32 | "path": "./snippets/emoji.json" 33 | }, 34 | { 35 | "language": "autoit", 36 | "path": "./snippets/emoji.json" 37 | }, 38 | { 39 | "language": "baanc", 40 | "path": "./snippets/emoji.json" 41 | }, 42 | { 43 | "language": "bash", 44 | "path": "./snippets/emoji.json" 45 | }, 46 | { 47 | "language": "batch", 48 | "path": "./snippets/emoji.json" 49 | }, 50 | { 51 | "language": "c", 52 | "path": "./snippets/emoji.json" 53 | }, 54 | { 55 | "language": "cs", 56 | "path": "./snippets/emoji.json" 57 | }, 58 | { 59 | "language": "cmake", 60 | "path": "./snippets/emoji.json" 61 | }, 62 | { 63 | "language": "cpp", 64 | "path": "./snippets/emoji.json" 65 | }, 66 | { 67 | "language": "css", 68 | "path": "./snippets/emoji.json" 69 | }, 70 | { 71 | "language": "caml", 72 | "path": "./snippets/emoji.json" 73 | }, 74 | { 75 | "language": "cobol", 76 | "path": "./snippets/emoji.json" 77 | }, 78 | { 79 | "language": "coffeescript", 80 | "path": "./snippets/emoji.json" 81 | }, 82 | { 83 | "language": "d", 84 | "path": "./snippets/emoji.json" 85 | }, 86 | { 87 | "language": "dart", 88 | "path": "./snippets/emoji.json" 89 | }, 90 | { 91 | "language": "ejs", 92 | "path": "./snippets/emoji.json" 93 | }, 94 | { 95 | "language": "fortran", 96 | "path": "./snippets/emoji.json" 97 | }, 98 | { 99 | "language": "fortran77", 100 | "path": "./snippets/emoji.json" 101 | }, 102 | { 103 | "language": "html", 104 | "path": "./snippets/emoji.json" 105 | }, 106 | { 107 | "language": "html_es6", 108 | "path": "./snippets/emoji.json" 109 | }, 110 | { 111 | "language": "handlebars", 112 | "path": "./snippets/emoji.json" 113 | }, 114 | { 115 | "language": "haskell", 116 | "path": "./snippets/emoji.json" 117 | }, 118 | { 119 | "language": "inno", 120 | "path": "./snippets/emoji.json" 121 | }, 122 | { 123 | "language": "json", 124 | "path": "./snippets/emoji.json" 125 | }, 126 | { 127 | "language": "json_tm", 128 | "path": "./snippets/emoji.json" 129 | }, 130 | { 131 | "language": "java", 132 | "path": "./snippets/emoji.json" 133 | }, 134 | { 135 | "language": "javascript", 136 | "path": "./snippets/emoji.json" 137 | }, 138 | { 139 | "language": "javascriptreact", 140 | "path": "./snippets/emoji.json" 141 | }, 142 | { 143 | "language": "javascript_es6", 144 | "path": "./snippets/emoji.json" 145 | }, 146 | { 147 | "language": "kix", 148 | "path": "./snippets/emoji.json" 149 | }, 150 | { 151 | "language": "less", 152 | "path": "./snippets/emoji.json" 153 | }, 154 | { 155 | "language": "lisp", 156 | "path": "./snippets/emoji.json" 157 | }, 158 | { 159 | "language": "lua", 160 | "path": "./snippets/emoji.json" 161 | }, 162 | { 163 | "language": "markdown", 164 | "path": "./snippets/emoji.json" 165 | }, 166 | { 167 | "language": "matlab", 168 | "path": "./snippets/emoji.json" 169 | }, 170 | { 171 | "language": "njs", 172 | "path": "./snippets/emoji.json" 173 | }, 174 | { 175 | "language": "nml", 176 | "path": "./snippets/emoji.json" 177 | }, 178 | { 179 | "language": "nsis", 180 | "path": "./snippets/emoji.json" 181 | }, 182 | { 183 | "language": "nss", 184 | "path": "./snippets/emoji.json" 185 | }, 186 | { 187 | "language": "objc", 188 | "path": "./snippets/emoji.json" 189 | }, 190 | { 191 | "language": "php", 192 | "path": "./snippets/emoji.json" 193 | }, 194 | { 195 | "language": "pascal", 196 | "path": "./snippets/emoji.json" 197 | }, 198 | { 199 | "language": "perl", 200 | "path": "./snippets/emoji.json" 201 | }, 202 | { 203 | "language": "postscript", 204 | "path": "./snippets/emoji.json" 205 | }, 206 | { 207 | "language": "powershell", 208 | "path": "./snippets/emoji.json" 209 | }, 210 | { 211 | "language": "python", 212 | "path": "./snippets/emoji.json" 213 | }, 214 | { 215 | "language": "r", 216 | "path": "./snippets/emoji.json" 217 | }, 218 | { 219 | "language": "rc", 220 | "path": "./snippets/emoji.json" 221 | }, 222 | { 223 | "language": "ruby", 224 | "path": "./snippets/emoji.json" 225 | }, 226 | { 227 | "language": "sql", 228 | "path": "./snippets/emoji.json" 229 | }, 230 | { 231 | "language": "sass", 232 | "path": "./snippets/emoji.json" 233 | }, 234 | { 235 | "language": "scheme", 236 | "path": "./snippets/emoji.json" 237 | }, 238 | { 239 | "language": "scss", 240 | "path": "./snippets/emoji.json" 241 | }, 242 | { 243 | "language": "smalltalk", 244 | "path": "./snippets/emoji.json" 245 | }, 246 | { 247 | "language": "stylus", 248 | "path": "./snippets/emoji.json" 249 | }, 250 | { 251 | "language": "swift", 252 | "path": "./snippets/emoji.json" 253 | }, 254 | { 255 | "language": "tcl", 256 | "path": "./snippets/emoji.json" 257 | }, 258 | { 259 | "language": "typescript", 260 | "path": "./snippets/emoji.json" 261 | }, 262 | { 263 | "language": "typescriptreact", 264 | "path": "./snippets/emoji.json" 265 | }, 266 | { 267 | "language": "ux", 268 | "path": "./snippets/emoji.json" 269 | }, 270 | { 271 | "language": "vb", 272 | "path": "./snippets/emoji.json" 273 | }, 274 | { 275 | "language": "vhdl", 276 | "path": "./snippets/emoji.json" 277 | }, 278 | { 279 | "language": "verilog", 280 | "path": "./snippets/emoji.json" 281 | }, 282 | { 283 | "language": "vue", 284 | "path": "./snippets/emoji.json" 285 | }, 286 | { 287 | "language": "wxml", 288 | "path": "./snippets/emoji.json" 289 | }, 290 | { 291 | "language": "xml", 292 | "path": "./snippets/emoji.json" 293 | }, 294 | { 295 | "language": "yaml", 296 | "path": "./snippets/emoji.json" 297 | }, 298 | { 299 | "language": "pug", 300 | "path": "./snippets/emoji.json" 301 | } 302 | ] 303 | }, 304 | "extensionDependencies": [ 305 | "plugin-manager" 306 | ], 307 | "dependencies": {} 308 | } 309 | -------------------------------------------------------------------------------- /extension/resource/lang.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "language": "txt", 4 | "path": "./snippets/hbuilder.json" 5 | }, 6 | { 7 | "language": "actionscript", 8 | "path": "./snippets/hbuilder.json" 9 | }, 10 | { 11 | "language": "ada", 12 | "path": "./snippets/hbuilder.json" 13 | }, 14 | { 15 | "language": "asm", 16 | "path": "./snippets/hbuilder.json" 17 | }, 18 | { 19 | "language": "asp", 20 | "path": "./snippets/hbuilder.json" 21 | }, 22 | { 23 | "language": "autoit", 24 | "path": "./snippets/hbuilder.json" 25 | }, 26 | { 27 | "language": "baanc", 28 | "path": "./snippets/hbuilder.json" 29 | }, 30 | { 31 | "language": "bash", 32 | "path": "./snippets/hbuilder.json" 33 | }, 34 | { 35 | "language": "batch", 36 | "path": "./snippets/hbuilder.json" 37 | }, 38 | { 39 | "language": "c", 40 | "path": "./snippets/hbuilder.json" 41 | }, 42 | { 43 | "language": "cs", 44 | "path": "./snippets/hbuilder.json" 45 | }, 46 | { 47 | "language": "cmake", 48 | "path": "./snippets/hbuilder.json" 49 | }, 50 | { 51 | "language": "cpp", 52 | "path": "./snippets/hbuilder.json" 53 | }, 54 | { 55 | "language": "css", 56 | "path": "./snippets/hbuilder.json" 57 | }, 58 | { 59 | "language": "caml", 60 | "path": "./snippets/hbuilder.json" 61 | }, 62 | { 63 | "language": "cobol", 64 | "path": "./snippets/hbuilder.json" 65 | }, 66 | { 67 | "language": "coffeescript", 68 | "path": "./snippets/hbuilder.json" 69 | }, 70 | { 71 | "language": "d", 72 | "path": "./snippets/hbuilder.json" 73 | }, 74 | { 75 | "language": "dart", 76 | "path": "./snippets/hbuilder.json" 77 | }, 78 | { 79 | "language": "ejs", 80 | "path": "./snippets/hbuilder.json" 81 | }, 82 | { 83 | "language": "fortran", 84 | "path": "./snippets/hbuilder.json" 85 | }, 86 | { 87 | "language": "fortran77", 88 | "path": "./snippets/hbuilder.json" 89 | }, 90 | { 91 | "language": "html", 92 | "path": "./snippets/hbuilder.json" 93 | }, 94 | { 95 | "language": "html_es6", 96 | "path": "./snippets/hbuilder.json" 97 | }, 98 | { 99 | "language": "handlebars", 100 | "path": "./snippets/hbuilder.json" 101 | }, 102 | { 103 | "language": "haskell", 104 | "path": "./snippets/hbuilder.json" 105 | }, 106 | { 107 | "language": "inno", 108 | "path": "./snippets/hbuilder.json" 109 | }, 110 | { 111 | "language": "json", 112 | "path": "./snippets/hbuilder.json" 113 | }, 114 | { 115 | "language": "json_tm", 116 | "path": "./snippets/hbuilder.json" 117 | }, 118 | { 119 | "language": "java", 120 | "path": "./snippets/hbuilder.json" 121 | }, 122 | { 123 | "language": "javascript", 124 | "path": "./snippets/hbuilder.json" 125 | }, 126 | { 127 | "language": "javascriptreact", 128 | "path": "./snippets/hbuilder.json" 129 | }, 130 | { 131 | "language": "javascript_es6", 132 | "path": "./snippets/hbuilder.json" 133 | }, 134 | { 135 | "language": "kix", 136 | "path": "./snippets/hbuilder.json" 137 | }, 138 | { 139 | "language": "less", 140 | "path": "./snippets/hbuilder.json" 141 | }, 142 | { 143 | "language": "lisp", 144 | "path": "./snippets/hbuilder.json" 145 | }, 146 | { 147 | "language": "lua", 148 | "path": "./snippets/hbuilder.json" 149 | }, 150 | { 151 | "language": "markdown", 152 | "path": "./snippets/hbuilder.json" 153 | }, 154 | { 155 | "language": "matlab", 156 | "path": "./snippets/hbuilder.json" 157 | }, 158 | { 159 | "language": "njs", 160 | "path": "./snippets/hbuilder.json" 161 | }, 162 | { 163 | "language": "nml", 164 | "path": "./snippets/hbuilder.json" 165 | }, 166 | { 167 | "language": "nsis", 168 | "path": "./snippets/hbuilder.json" 169 | }, 170 | { 171 | "language": "nss", 172 | "path": "./snippets/hbuilder.json" 173 | }, 174 | { 175 | "language": "objc", 176 | "path": "./snippets/hbuilder.json" 177 | }, 178 | { 179 | "language": "php", 180 | "path": "./snippets/hbuilder.json" 181 | }, 182 | { 183 | "language": "pascal", 184 | "path": "./snippets/hbuilder.json" 185 | }, 186 | { 187 | "language": "perl", 188 | "path": "./snippets/hbuilder.json" 189 | }, 190 | { 191 | "language": "postscript", 192 | "path": "./snippets/hbuilder.json" 193 | }, 194 | { 195 | "language": "powershell", 196 | "path": "./snippets/hbuilder.json" 197 | }, 198 | { 199 | "language": "python", 200 | "path": "./snippets/hbuilder.json" 201 | }, 202 | { 203 | "language": "r", 204 | "path": "./snippets/hbuilder.json" 205 | }, 206 | { 207 | "language": "rc", 208 | "path": "./snippets/hbuilder.json" 209 | }, 210 | { 211 | "language": "ruby", 212 | "path": "./snippets/hbuilder.json" 213 | }, 214 | { 215 | "language": "sql", 216 | "path": "./snippets/hbuilder.json" 217 | }, 218 | { 219 | "language": "sass", 220 | "path": "./snippets/hbuilder.json" 221 | }, 222 | { 223 | "language": "scheme", 224 | "path": "./snippets/hbuilder.json" 225 | }, 226 | { 227 | "language": "scss", 228 | "path": "./snippets/hbuilder.json" 229 | }, 230 | { 231 | "language": "smalltalk", 232 | "path": "./snippets/hbuilder.json" 233 | }, 234 | { 235 | "language": "stylus", 236 | "path": "./snippets/hbuilder.json" 237 | }, 238 | { 239 | "language": "swift", 240 | "path": "./snippets/hbuilder.json" 241 | }, 242 | { 243 | "language": "tcl", 244 | "path": "./snippets/hbuilder.json" 245 | }, 246 | { 247 | "language": "typescript", 248 | "path": "./snippets/hbuilder.json" 249 | }, 250 | { 251 | "language": "typescriptreact", 252 | "path": "./snippets/hbuilder.json" 253 | }, 254 | { 255 | "language": "ux", 256 | "path": "./snippets/hbuilder.json" 257 | }, 258 | { 259 | "language": "vb", 260 | "path": "./snippets/hbuilder.json" 261 | }, 262 | { 263 | "language": "vhdl", 264 | "path": "./snippets/hbuilder.json" 265 | }, 266 | { 267 | "language": "verilog", 268 | "path": "./snippets/hbuilder.json" 269 | }, 270 | { 271 | "language": "vue", 272 | "path": "./snippets/hbuilder.json" 273 | }, 274 | { 275 | "language": "wxml", 276 | "path": "./snippets/hbuilder.json" 277 | }, 278 | { 279 | "language": "xml", 280 | "path": "./snippets/hbuilder.json" 281 | }, 282 | { 283 | "language": "yaml", 284 | "path": "./snippets/hbuilder.json" 285 | }, 286 | { 287 | "language": "pug", 288 | "path": "./snippets/hbuilder.json" 289 | } 290 | ] -------------------------------------------------------------------------------- /omi/src/elements/app-omil/index.js: -------------------------------------------------------------------------------- 1 | import { WeElement, define, h } from "omi"; 2 | import weui from "weui"; 3 | import style from "./_index.css"; 4 | import emojis from "./emojis.json"; 5 | 6 | class AppOmil extends WeElement { 7 | render(props) { 8 | return h( 9 | "div", 10 | null, 11 | h( 12 | "div", 13 | { 14 | class: "page__hd" 15 | }, 16 | h( 17 | "h1", 18 | { 19 | class: "page__title" 20 | }, 21 | "Emoji" 22 | ), 23 | h( 24 | "p", 25 | { 26 | class: "page__desc" 27 | }, 28 | h("span", null, this.data.category) 29 | ) 30 | ), 31 | h( 32 | "div", 33 | { 34 | class: "page__bd page__bd_spacing" 35 | }, 36 | h( 37 | "div", 38 | { 39 | class: "weui-cells__title" 40 | }, 41 | "Type" 42 | ), 43 | h( 44 | "div", 45 | { 46 | class: "weui-cells" 47 | }, 48 | h( 49 | "div", 50 | { 51 | class: "weui-cell weui-cell_select weui-cell_select-before" 52 | }, 53 | h( 54 | "div", 55 | { 56 | class: "weui-cell__hd" 57 | }, 58 | h( 59 | "select", 60 | { 61 | class: "weui-select", 62 | name: "select2", 63 | onChange: this.selectCategory.bind(this) 64 | }, 65 | this.data.categories.map(item => { 66 | return h( 67 | "option", 68 | { 69 | value: item 70 | }, 71 | item 72 | ); 73 | }) 74 | ) 75 | ), 76 | h( 77 | "div", 78 | { 79 | class: "weui-cell__bd" 80 | }, 81 | h("input", { 82 | id: "emojiCode", 83 | class: "weui-input", 84 | type: "text", 85 | placeholder: "The emoji code", 86 | value: this.data.emoji 87 | }) 88 | ), 89 | h( 90 | "div", 91 | { 92 | class: "weui-cell__ft" 93 | }, 94 | h( 95 | "button", 96 | { 97 | class: "weui-vcode-btn", 98 | onClick: this.copyCode.bind(this) 99 | }, 100 | "\u590D\u5236\u4EE3\u7801" 101 | ) 102 | ) 103 | ) 104 | ), 105 | h( 106 | "div", 107 | { 108 | class: "weui-cells__title" 109 | }, 110 | "Zoom(Moving dot right or left)" 111 | ), 112 | h( 113 | "div", 114 | { 115 | class: "weui-cells__title" 116 | }, 117 | "Choose(\u9F20\u6807\u9009\u62E9\u8868\u60C5\u7136\u540E\u590D\u5236\u4EE3\u7801)" 118 | ), 119 | h( 120 | "div", 121 | null, 122 | h( 123 | "p", 124 | { 125 | class: "page__bd page__bd_spacing_top" 126 | }, 127 | (() => { 128 | let arr = []; 129 | Object.keys(this.data.emojis).forEach(key => { 130 | if (this.data.category === "all") { 131 | arr.push( 132 | h( 133 | "span", 134 | { 135 | onClick: this.chooseEmoji.bind(this, key), 136 | alias: "smile", 137 | "ios-version": "6.0" 138 | }, 139 | this.data.emojis[key].char 140 | ) 141 | ); 142 | } else if ( 143 | this.data.emojis[key].category === this.data.category 144 | ) { 145 | arr.push( 146 | h( 147 | "span", 148 | { 149 | onClick: this.chooseEmoji.bind(this, key), 150 | alias: "smile", 151 | "ios-version": "6.0" 152 | }, 153 | this.data.emojis[key].char 154 | ) 155 | ); 156 | } 157 | }); 158 | return arr; 159 | })() 160 | ) 161 | ) 162 | ), 163 | h( 164 | "div", 165 | { 166 | id: "toast", 167 | style: { 168 | display: this.data.isShowToast ? "block" : "none" 169 | } 170 | }, 171 | h("div", { 172 | class: "weui-mask_transparent" 173 | }), 174 | h( 175 | "div", 176 | { 177 | class: "weui-toast" 178 | }, 179 | h("i", { 180 | class: "weui-icon-success-no-circle weui-icon_toast" 181 | }), 182 | h( 183 | "p", 184 | { 185 | class: "weui-toast__content" 186 | }, 187 | "\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F" 188 | ) 189 | ) 190 | ), 191 | h( 192 | "div", 193 | { 194 | class: "weui-footer", 195 | style: { 196 | paddingTop: "30px" 197 | } 198 | }, 199 | h( 200 | "p", 201 | { 202 | class: "weui-footer__links" 203 | }, 204 | h( 205 | "a", 206 | { 207 | href: "https://github.com/Wscats", 208 | class: "weui-footer__link" 209 | }, 210 | "Wscats" 211 | ), 212 | h( 213 | "a", 214 | { 215 | href: "https://github.com/Wscats", 216 | class: "weui-footer__link" 217 | }, 218 | "Eno Yao" 219 | ) 220 | ), 221 | h( 222 | "p", 223 | { 224 | class: "weui-footer__text" 225 | }, 226 | "Copyright \xA9" 227 | ) 228 | ) 229 | ); 230 | } 231 | 232 | install() { 233 | this.data = { 234 | isShowToast: false, 235 | emojis, 236 | emoji: "😊", 237 | categories: [ 238 | "all", 239 | "people", 240 | "animals_and_nature", 241 | "food_and_drink", 242 | "activity", 243 | "travel_and_places", 244 | "objects", 245 | "symbols", 246 | "flags" 247 | ], 248 | category: "all" 249 | }; 250 | } 251 | 252 | copyCode() { 253 | let input = document.getElementById("emojiCode"); 254 | input.select(); 255 | document.execCommand("Copy"); 256 | this.data.isShowToast = true; 257 | this.update(); 258 | setTimeout(() => { 259 | this.data.isShowToast = false; 260 | this.update(); 261 | }, 800); 262 | } 263 | 264 | chooseEmoji(key) { 265 | this.data.emoji = this.data.emojis[key].char; 266 | this.update(); 267 | console.log(this.data.emojis[key].char); 268 | } 269 | 270 | selectCategory(e) { 271 | console.log(e.target.value); 272 | this.data.category = e.target.value; 273 | this.update(); 274 | } 275 | } 276 | 277 | AppOmil.css = 278 | ` 279 | 280 | ` + 281 | style + 282 | weui; 283 | define("app-omil", AppOmil); 284 | -------------------------------------------------------------------------------- /extension/vscode-emoji/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "emoji", 3 | "displayName": "Emoji Snippets", 4 | "description": "😁Snippets to insert escaped Emoji code into a variety of languages", 5 | "version": "0.0.4", 6 | "author": { 7 | "name": "Eno Yao", 8 | "email": "kalone.cool@gmail.com", 9 | "url": "https://github.com/Wscats" 10 | }, 11 | "publisher": "Wscats", 12 | "preview": true, 13 | "icon": "assets/logo.png", 14 | "homepage": "https://github.com/Wscats/emoji", 15 | "engines": { 16 | "vscode": "^1.29.0" 17 | }, 18 | "categories": [ 19 | "Snippets" 20 | ], 21 | "keywords": [ 22 | "emoji" 23 | ], 24 | "galleryBanner": { 25 | "color": "#58bc58", 26 | "theme": "dark" 27 | }, 28 | "bugs": { 29 | "url": "https://github.com/Wscats/emoji/issues/new" 30 | }, 31 | "license": "MIT", 32 | "repository": { 33 | "type": "git", 34 | "url": "https://github.com/Wscats/emoji" 35 | }, 36 | "scripts": { 37 | "publish": "vsce package" 38 | }, 39 | "contributes": { 40 | "snippets": [ 41 | { 42 | "language": "txt", 43 | "path": "./snippets/emoji.json" 44 | }, 45 | { 46 | "language": "actionscript", 47 | "path": "./snippets/emoji.json" 48 | }, 49 | { 50 | "language": "ada", 51 | "path": "./snippets/emoji.json" 52 | }, 53 | { 54 | "language": "asm", 55 | "path": "./snippets/emoji.json" 56 | }, 57 | { 58 | "language": "asp", 59 | "path": "./snippets/emoji.json" 60 | }, 61 | { 62 | "language": "autoit", 63 | "path": "./snippets/emoji.json" 64 | }, 65 | { 66 | "language": "baanc", 67 | "path": "./snippets/emoji.json" 68 | }, 69 | { 70 | "language": "bash", 71 | "path": "./snippets/emoji.json" 72 | }, 73 | { 74 | "language": "batch", 75 | "path": "./snippets/emoji.json" 76 | }, 77 | { 78 | "language": "c", 79 | "path": "./snippets/emoji.json" 80 | }, 81 | { 82 | "language": "cs", 83 | "path": "./snippets/emoji.json" 84 | }, 85 | { 86 | "language": "cmake", 87 | "path": "./snippets/emoji.json" 88 | }, 89 | { 90 | "language": "cpp", 91 | "path": "./snippets/emoji.json" 92 | }, 93 | { 94 | "language": "css", 95 | "path": "./snippets/emoji.json" 96 | }, 97 | { 98 | "language": "caml", 99 | "path": "./snippets/emoji.json" 100 | }, 101 | { 102 | "language": "cobol", 103 | "path": "./snippets/emoji.json" 104 | }, 105 | { 106 | "language": "coffeescript", 107 | "path": "./snippets/emoji.json" 108 | }, 109 | { 110 | "language": "d", 111 | "path": "./snippets/emoji.json" 112 | }, 113 | { 114 | "language": "dart", 115 | "path": "./snippets/emoji.json" 116 | }, 117 | { 118 | "language": "ejs", 119 | "path": "./snippets/emoji.json" 120 | }, 121 | { 122 | "language": "fortran", 123 | "path": "./snippets/emoji.json" 124 | }, 125 | { 126 | "language": "fortran77", 127 | "path": "./snippets/emoji.json" 128 | }, 129 | { 130 | "language": "html", 131 | "path": "./snippets/emoji.json" 132 | }, 133 | { 134 | "language": "html_es6", 135 | "path": "./snippets/emoji.json" 136 | }, 137 | { 138 | "language": "handlebars", 139 | "path": "./snippets/emoji.json" 140 | }, 141 | { 142 | "language": "haskell", 143 | "path": "./snippets/emoji.json" 144 | }, 145 | { 146 | "language": "inno", 147 | "path": "./snippets/emoji.json" 148 | }, 149 | { 150 | "language": "json", 151 | "path": "./snippets/emoji.json" 152 | }, 153 | { 154 | "language": "json_tm", 155 | "path": "./snippets/emoji.json" 156 | }, 157 | { 158 | "language": "java", 159 | "path": "./snippets/emoji.json" 160 | }, 161 | { 162 | "language": "javascript", 163 | "path": "./snippets/emoji.json" 164 | }, 165 | { 166 | "language": "javascriptreact", 167 | "path": "./snippets/emoji.json" 168 | }, 169 | { 170 | "language": "javascript_es6", 171 | "path": "./snippets/emoji.json" 172 | }, 173 | { 174 | "language": "kix", 175 | "path": "./snippets/emoji.json" 176 | }, 177 | { 178 | "language": "less", 179 | "path": "./snippets/emoji.json" 180 | }, 181 | { 182 | "language": "lisp", 183 | "path": "./snippets/emoji.json" 184 | }, 185 | { 186 | "language": "lua", 187 | "path": "./snippets/emoji.json" 188 | }, 189 | { 190 | "language": "markdown", 191 | "path": "./snippets/emoji.json" 192 | }, 193 | { 194 | "language": "matlab", 195 | "path": "./snippets/emoji.json" 196 | }, 197 | { 198 | "language": "njs", 199 | "path": "./snippets/emoji.json" 200 | }, 201 | { 202 | "language": "nml", 203 | "path": "./snippets/emoji.json" 204 | }, 205 | { 206 | "language": "nsis", 207 | "path": "./snippets/emoji.json" 208 | }, 209 | { 210 | "language": "nss", 211 | "path": "./snippets/emoji.json" 212 | }, 213 | { 214 | "language": "objc", 215 | "path": "./snippets/emoji.json" 216 | }, 217 | { 218 | "language": "php", 219 | "path": "./snippets/emoji.json" 220 | }, 221 | { 222 | "language": "pascal", 223 | "path": "./snippets/emoji.json" 224 | }, 225 | { 226 | "language": "perl", 227 | "path": "./snippets/emoji.json" 228 | }, 229 | { 230 | "language": "postscript", 231 | "path": "./snippets/emoji.json" 232 | }, 233 | { 234 | "language": "powershell", 235 | "path": "./snippets/emoji.json" 236 | }, 237 | { 238 | "language": "python", 239 | "path": "./snippets/emoji.json" 240 | }, 241 | { 242 | "language": "r", 243 | "path": "./snippets/emoji.json" 244 | }, 245 | { 246 | "language": "rc", 247 | "path": "./snippets/emoji.json" 248 | }, 249 | { 250 | "language": "ruby", 251 | "path": "./snippets/emoji.json" 252 | }, 253 | { 254 | "language": "sql", 255 | "path": "./snippets/emoji.json" 256 | }, 257 | { 258 | "language": "sass", 259 | "path": "./snippets/emoji.json" 260 | }, 261 | { 262 | "language": "scheme", 263 | "path": "./snippets/emoji.json" 264 | }, 265 | { 266 | "language": "scss", 267 | "path": "./snippets/emoji.json" 268 | }, 269 | { 270 | "language": "smalltalk", 271 | "path": "./snippets/emoji.json" 272 | }, 273 | { 274 | "language": "stylus", 275 | "path": "./snippets/emoji.json" 276 | }, 277 | { 278 | "language": "swift", 279 | "path": "./snippets/emoji.json" 280 | }, 281 | { 282 | "language": "tcl", 283 | "path": "./snippets/emoji.json" 284 | }, 285 | { 286 | "language": "typescript", 287 | "path": "./snippets/emoji.json" 288 | }, 289 | { 290 | "language": "typescriptreact", 291 | "path": "./snippets/emoji.json" 292 | }, 293 | { 294 | "language": "ux", 295 | "path": "./snippets/emoji.json" 296 | }, 297 | { 298 | "language": "vb", 299 | "path": "./snippets/emoji.json" 300 | }, 301 | { 302 | "language": "vhdl", 303 | "path": "./snippets/emoji.json" 304 | }, 305 | { 306 | "language": "verilog", 307 | "path": "./snippets/emoji.json" 308 | }, 309 | { 310 | "language": "vue", 311 | "path": "./snippets/emoji.json" 312 | }, 313 | { 314 | "language": "wxml", 315 | "path": "./snippets/emoji.json" 316 | }, 317 | { 318 | "language": "xml", 319 | "path": "./snippets/emoji.json" 320 | }, 321 | { 322 | "language": "yaml", 323 | "path": "./snippets/emoji.json" 324 | }, 325 | { 326 | "language": "pug", 327 | "path": "./snippets/emoji.json" 328 | } 329 | ] 330 | } 331 | } -------------------------------------------------------------------------------- /omi/config/webpack.config.dev.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const autoprefixer = require('autoprefixer'); 4 | const path = require('path'); 5 | const webpack = require('webpack'); 6 | const HtmlWebpackPlugin = require('html-webpack-plugin'); 7 | const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); 8 | const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); 9 | const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); 10 | const eslintFormatter = require('react-dev-utils/eslintFormatter'); 11 | const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); 12 | const getClientEnvironment = require('./env'); 13 | const paths = require('./paths'); 14 | const fileList = require('./entry'); 15 | 16 | const pjson = require('../package.json'); 17 | 18 | let entry = {}; 19 | let htmlWebpackPlugins = []; 20 | 21 | fileList.forEach(function (item) { 22 | entry[item] = [ 23 | require.resolve('./polyfills'), 24 | require.resolve('react-dev-utils/webpackHotDevClient'), 25 | paths.appSrc + '/' + item + '.js', 26 | ]; 27 | 28 | htmlWebpackPlugins.push( 29 | new HtmlWebpackPlugin({ 30 | inject: true, 31 | chunks: [item], 32 | template: paths.appHtml, 33 | filename: item + '.html' 34 | })); 35 | }); 36 | 37 | // Webpack uses `publicPath` to determine where the app is being served from. 38 | // In development, we always serve from the root. This makes config easier. 39 | const publicPath = '/'; 40 | // `publicUrl` is just like `publicPath`, but we will provide it to our app 41 | // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript. 42 | // Omit trailing slash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz. 43 | const publicUrl = ''; 44 | // Get environment variables to inject into our app. 45 | const env = getClientEnvironment(publicUrl); 46 | 47 | // This is the development configuration. 48 | // It is focused on developer experience and fast rebuilds. 49 | // The production configuration is different and lives in a separate file. 50 | module.exports = { 51 | // You may want 'eval' instead if you prefer to see the compiled output in DevTools. 52 | // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343. 53 | devtool: 'cheap-module-source-map', 54 | // These are the "entry points" to our application. 55 | // This means they will be the "root" imports that are included in JS bundle. 56 | // The first two entry points enable "hot" CSS and auto-refreshes for JS. 57 | entry: entry, 58 | output: { 59 | // Add /* filename */ comments to generated require()s in the output. 60 | pathinfo: true, 61 | path: paths.appBuild, 62 | // This does not produce a real file. It's just the virtual path that is 63 | // served by WebpackDevServer in development. This is the JS bundle 64 | // containing code from all our entry points, and the Webpack runtime. 65 | filename: 'static/js/[name].bundle.js', 66 | // There are also additional JS chunk files if you use code splitting. 67 | chunkFilename: 'static/js/[name].chunk.js', 68 | // This is the URL that app is served from. We use "/" in development. 69 | publicPath: publicPath, 70 | // Point sourcemap entries to original disk location (format as URL on Windows) 71 | devtoolModuleFilenameTemplate: info => 72 | path.resolve(info.absoluteResourcePath).replace(/\\/g, '/'), 73 | }, 74 | resolve: { 75 | // This allows you to set a fallback for where Webpack should look for modules. 76 | // We placed these paths second because we want `node_modules` to "win" 77 | // if there are any conflicts. This matches Node resolution mechanism. 78 | // https://github.com/facebookincubator/create-react-app/issues/253 79 | modules: ['node_modules', paths.appNodeModules].concat( 80 | // It is guaranteed to exist because we tweak it in `env.js` 81 | process.env.NODE_PATH.split(path.delimiter).filter(Boolean) 82 | ), 83 | // These are the reasonable defaults supported by the Node ecosystem. 84 | // We also include JSX as a common component filename extension to support 85 | // some tools, although we do not recommend using it, see: 86 | // https://github.com/facebookincubator/create-react-app/issues/290 87 | // `web` extension prefixes have been added for better support 88 | // for React Native Web. 89 | extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx'], 90 | alias: pjson.alias, 91 | plugins: [ 92 | // Prevents users from importing files from outside of src/ (or node_modules/). 93 | // This often causes confusion because we only process files within src/ with babel. 94 | // To fix this, we prevent you from importing files out of src/ -- if you'd like to, 95 | // please link the files into your node_modules/ and let module-resolution kick in. 96 | // Make sure your source files are compiled, as they will not be processed in any way. 97 | new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]), 98 | ], 99 | }, 100 | module: { 101 | strictExportPresence: true, 102 | rules: [ 103 | // TODO: Disable require.ensure as it's not a standard language feature. 104 | // We are waiting for https://github.com/facebookincubator/create-react-app/issues/2176. 105 | // { parser: { requireEnsure: false } }, 106 | 107 | // First, run the linter. 108 | // It's important to do this before Babel processes the JS. 109 | // { 110 | // test: /\.(js|jsx|mjs)$/, 111 | // enforce: 'pre', 112 | // use: [ 113 | // { 114 | // options: { 115 | // formatter: eslintFormatter, 116 | // eslintPath: require.resolve('eslint'), 117 | 118 | // }, 119 | // loader: require.resolve('eslint-loader'), 120 | // }, 121 | // ], 122 | // include: paths.appSrc, 123 | // }, 124 | { 125 | // "oneOf" will traverse all following loaders until one will 126 | // match the requirements. When no loader matches it will fall 127 | // back to the "file" loader at the end of the loader list. 128 | oneOf: [ 129 | // "url" loader works like "file" loader except that it embeds assets 130 | // smaller than specified limit in bytes as data URLs to avoid requests. 131 | // A missing `test` is equivalent to a match. 132 | { 133 | test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/], 134 | loader: require.resolve('url-loader'), 135 | options: { 136 | limit: 10000, 137 | name: 'static/media/[name].[hash:8].[ext]', 138 | }, 139 | }, 140 | // Process JS with Babel. 141 | { 142 | test: /\.(js|jsx|mjs)$/, 143 | //include: paths.appSrc, 144 | loader: require.resolve('babel-loader'), 145 | options: { 146 | "presets": [ 147 | "@babel/preset-env", 148 | [ 149 | "@babel/preset-react", 150 | { 151 | "pragma": "Omi.h" 152 | } 153 | ] 154 | ], 155 | "plugins": [ 156 | "@babel/plugin-proposal-class-properties", 157 | [ 158 | "@babel/plugin-proposal-decorators", 159 | { 160 | "legacy": true 161 | } 162 | ], 163 | "@babel/plugin-proposal-function-bind", 164 | "@babel/plugin-proposal-object-rest-spread", 165 | "@babel/plugin-syntax-dynamic-import" 166 | ], 167 | // This is a feature of `babel-loader` for webpack (not Babel itself). 168 | // It enables caching results in ./node_modules/.cache/babel-loader/ 169 | // directory for faster rebuilds. 170 | cacheDirectory: true, 171 | }, 172 | }, 173 | { 174 | test: /[\\|\/]_[\S]*\.css$/, 175 | use: [ 176 | 'to-string-loader', 177 | 'css-loader' 178 | ] 179 | }, 180 | { 181 | test: /[\\|\/]_[\S]*\.less$/, 182 | use: [ 183 | 'to-string-loader', 184 | 'css-loader', 185 | 'less-loader' 186 | ] 187 | }, 188 | { 189 | test: /\.less$/, 190 | use: [ 191 | 'style-loader', 192 | 'css-loader', 193 | 'less-loader' 194 | ] 195 | }, 196 | // "postcss" loader applies autoprefixer to our CSS. 197 | // "css" loader resolves paths in CSS and adds assets as dependencies. 198 | // "style" loader turns CSS into JS modules that inject