├── src
├── template
│ ├── app.wxss
│ ├── app.js
│ ├── common
│ │ └── pages
│ │ │ └── default
│ │ │ ├── default.wxss
│ │ │ ├── default.json
│ │ │ ├── default.wxml
│ │ │ └── default.js
│ ├── components
│ │ ├── plain-text
│ │ │ ├── plain-text.wxss
│ │ │ ├── plain-text.wxml
│ │ │ ├── plain-text.json
│ │ │ └── plain-text.js
│ │ └── element
│ │ │ └── element.wxss
│ ├── adapter
│ │ ├── event
│ │ │ ├── custom-event.js
│ │ │ └── event.js
│ │ ├── bom
│ │ │ ├── screen.js
│ │ │ ├── navigator.js
│ │ │ ├── session-storage.js
│ │ │ ├── local-storage.js
│ │ │ └── history.js
│ │ ├── node
│ │ │ ├── comment.js
│ │ │ ├── element
│ │ │ │ ├── a.js
│ │ │ │ ├── input.js
│ │ │ │ ├── canvas.js
│ │ │ │ └── image.js
│ │ │ ├── text-node.js
│ │ │ ├── node.js
│ │ │ ├── style-list.js
│ │ │ ├── class-list.js
│ │ │ ├── attribute.js
│ │ │ └── style.js
│ │ ├── util
│ │ │ ├── tool.js
│ │ │ └── cache.js
│ │ ├── tree
│ │ │ ├── tag-map.js
│ │ │ └── tree.js
│ │ └── index.js
│ └── element.wxml.tmpl
├── config.js
├── js
│ ├── ignore-rewrite-var.js
│ ├── ignore-global-var.js
│ ├── adjust.js
│ ├── page.js.tmpl
│ └── index.js
├── json.js
├── html
│ ├── index.js
│ └── walker.js
├── css
│ ├── index.js
│ └── adjust.js
├── index.js
└── utils.js
├── index.js
├── test
├── demo
│ ├── demo05
│ │ ├── a.mp3
│ │ ├── imgs
│ │ │ ├── 4-1.png
│ │ │ ├── 4-2.png
│ │ │ ├── big1.png
│ │ │ ├── big2.png
│ │ │ ├── big3.png
│ │ │ ├── big4.png
│ │ │ ├── big5.png
│ │ │ ├── big6.png
│ │ │ ├── lv1.png
│ │ │ ├── lv2.png
│ │ │ ├── lv3.png
│ │ │ ├── note.png
│ │ │ ├── num1.png
│ │ │ ├── num2.png
│ │ │ ├── num3.png
│ │ │ ├── pass.png
│ │ │ ├── sure.png
│ │ │ ├── yes.png
│ │ │ ├── giftbox.png
│ │ │ ├── index.png
│ │ │ ├── invite.png
│ │ │ ├── openbox.png
│ │ │ ├── restart.png
│ │ │ ├── return.png
│ │ │ ├── share.png
│ │ │ ├── titlep.png
│ │ │ ├── winnbg.png
│ │ │ ├── download.png
│ │ │ ├── gamelose.png
│ │ │ ├── gamerule.png
│ │ │ ├── inputimg.png
│ │ │ ├── loading3.gif
│ │ │ ├── no-award.png
│ │ │ ├── startgame.png
│ │ │ ├── zhidaole.png
│ │ │ ├── background.png
│ │ │ ├── downloadBtn.png
│ │ │ ├── have-award.jpg
│ │ │ ├── have-award1.png
│ │ │ ├── jump_award.png
│ │ │ └── youxishuoming1.png
│ │ ├── js
│ │ │ └── rem.js
│ │ ├── index.html
│ │ └── css
│ │ │ └── index.css
│ ├── demo04
│ │ ├── images
│ │ │ ├── bg.png
│ │ │ ├── arrow.png
│ │ │ ├── bg1.png
│ │ │ ├── bg2.png
│ │ │ ├── logo.png
│ │ │ ├── title.png
│ │ │ ├── border.png
│ │ │ ├── border1.png
│ │ │ ├── border2.png
│ │ │ ├── home_bg.png
│ │ │ ├── liner1.png
│ │ │ ├── middle.png
│ │ │ ├── occupy-img.png
│ │ │ ├── final-title.png
│ │ │ ├── footer-left.png
│ │ │ ├── footer-right.png
│ │ │ ├── left-border.png
│ │ │ ├── right-border.png
│ │ │ ├── static_data1.png
│ │ │ ├── static_data2.png
│ │ │ ├── static_data3.png
│ │ │ ├── static_data4.png
│ │ │ ├── border-shading1.png
│ │ │ ├── border-shading2.png
│ │ │ ├── connect-linear.png
│ │ │ ├── current_period.png
│ │ │ ├── final-border1.png
│ │ │ ├── final-border2.png
│ │ │ ├── home-head-right.png
│ │ │ ├── previous_period.png
│ │ │ ├── static-border.png
│ │ │ ├── static_level1.png
│ │ │ ├── static_level2.png
│ │ │ ├── static_level3.png
│ │ │ ├── final-footer-left.png
│ │ │ ├── home-top-shading.png
│ │ │ ├── final-footer-right.png
│ │ │ ├── footer-left-shading.png
│ │ │ ├── footer-right-shading.png
│ │ │ ├── home-right-shading.png
│ │ │ └── footer-middle-shading.png
│ │ └── js
│ │ │ ├── rem.js
│ │ │ └── swiper.animate1.0.2.min.js
│ ├── demo03
│ │ ├── images
│ │ │ ├── logo.png
│ │ │ ├── zjnews_phone@2x.png
│ │ │ ├── zjnews_phone@3x.png
│ │ │ ├── zjnews_web@2x.png
│ │ │ ├── zjnews_web@3x.png
│ │ │ ├── zjnews_back_icon@2x.png
│ │ │ └── zjnews_back_icon@3x.png
│ │ ├── index.html
│ │ └── css
│ │ │ └── index.css
│ ├── demo06
│ │ ├── images
│ │ │ ├── 200.gif
│ │ │ ├── person.png
│ │ │ ├── header_bg.png
│ │ │ ├── person_1.png
│ │ │ └── header-border.png
│ │ ├── webpack.config.js
│ │ ├── package.json
│ │ ├── js
│ │ │ └── rem.js
│ │ ├── mock
│ │ │ └── vote.js
│ │ └── index.html
│ ├── demo07
│ │ ├── src
│ │ │ ├── main.js
│ │ │ ├── Btn.vue
│ │ │ ├── App.vue
│ │ │ └── Content.vue
│ │ ├── .babelrc
│ │ ├── dist
│ │ │ └── style.css
│ │ ├── README.md
│ │ ├── package.json
│ │ ├── index.html
│ │ └── webpack.config.js
│ ├── demo09
│ │ ├── .babelrc
│ │ ├── src
│ │ │ ├── AAA.vue
│ │ │ ├── BBB.vue
│ │ │ ├── main.js
│ │ │ └── App.vue
│ │ ├── README.md
│ │ ├── dist
│ │ │ └── style.css
│ │ ├── package.json
│ │ ├── index.html
│ │ └── webpack.config.js
│ ├── demo10
│ │ ├── .babelrc
│ │ ├── src
│ │ │ ├── AAA.vue
│ │ │ ├── BBB.vue
│ │ │ ├── main.js
│ │ │ └── App.vue
│ │ ├── README.md
│ │ ├── dist
│ │ │ └── style.css
│ │ ├── package.json
│ │ ├── index.html
│ │ └── webpack.config.js
│ ├── demo08
│ │ ├── .babelrc
│ │ ├── src
│ │ │ ├── index.jsx
│ │ │ ├── btn.jsx
│ │ │ ├── app.jsx
│ │ │ └── content.jsx
│ │ ├── package.json
│ │ ├── webpack.config.js
│ │ └── index.html
│ ├── demo11
│ │ ├── .babelrc
│ │ ├── src
│ │ │ ├── index.jsx
│ │ │ ├── aaa.jsx
│ │ │ ├── bbb.jsx
│ │ │ └── app.jsx
│ │ ├── webpack.config.js
│ │ ├── package.json
│ │ └── index.html
│ ├── demo12
│ │ ├── .babelrc
│ │ ├── src
│ │ │ ├── index.jsx
│ │ │ ├── aaa.jsx
│ │ │ ├── bbb.jsx
│ │ │ └── app.jsx
│ │ ├── webpack.config.js
│ │ ├── package.json
│ │ └── index.html
│ ├── extend1.js
│ ├── extend2.js
│ ├── demo02
│ │ ├── index.html
│ │ └── css
│ │ │ └── index.css
│ ├── server.js
│ ├── test.js
│ └── demo01
│ │ └── index.js
├── html
│ └── walker.test.js
├── js
│ └── adjust.test.js
├── adapter
│ ├── node
│ │ ├── style.test.js
│ │ ├── class-list.test.js
│ │ └── image.test.js
│ ├── bom
│ │ ├── xml-http-request.test.js
│ │ └── cookie.test.js
│ └── window.test.js
├── mock.js
└── css
│ └── adjust.test.js
├── .gitignore
├── .npmignore
├── UPDATE.md
├── LICENSE
├── docs
├── question.md
└── plan.md
├── package.json
└── .eslintrc.js
/src/template/app.wxss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/template/app.js:
--------------------------------------------------------------------------------
1 | App({})
2 |
--------------------------------------------------------------------------------
/src/template/common/pages/default/default.wxss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | module.exports = require('./src/index');
2 |
--------------------------------------------------------------------------------
/src/template/common/pages/default/default.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/src/template/components/plain-text/plain-text.wxss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | indent: ' ', // 缩进
3 | }
4 |
--------------------------------------------------------------------------------
/src/template/components/plain-text/plain-text.wxml:
--------------------------------------------------------------------------------
1 | {{content}}
2 |
--------------------------------------------------------------------------------
/src/template/common/pages/default/default.wxml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/template/components/plain-text/plain-text.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/test/demo/demo05/a.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/a.mp3
--------------------------------------------------------------------------------
/src/js/ignore-rewrite-var.js:
--------------------------------------------------------------------------------
1 | module.exports = [
2 | 'setTimeout', 'clearTimeout', 'setInterval', 'clearInterval'
3 | ]
4 |
--------------------------------------------------------------------------------
/test/demo/demo04/images/bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/bg.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/4-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/4-1.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/4-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/4-2.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/big1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/big1.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/big2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/big2.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/big3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/big3.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/big4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/big4.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/big5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/big5.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/big6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/big6.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/lv1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/lv1.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/lv2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/lv2.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/lv3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/lv3.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/note.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/note.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/num1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/num1.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/num2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/num2.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/num3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/num3.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/pass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/pass.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/sure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/sure.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/yes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/yes.png
--------------------------------------------------------------------------------
/test/demo/demo03/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo03/images/logo.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/arrow.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/bg1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/bg1.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/bg2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/bg2.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/logo.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/title.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/title.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/giftbox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/giftbox.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/index.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/index.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/invite.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/invite.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/openbox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/openbox.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/restart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/restart.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/return.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/return.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/share.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/titlep.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/titlep.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/winnbg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/winnbg.png
--------------------------------------------------------------------------------
/test/demo/demo06/images/200.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo06/images/200.gif
--------------------------------------------------------------------------------
/test/demo/demo04/images/border.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/border.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/border1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/border1.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/border2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/border2.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/home_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/home_bg.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/liner1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/liner1.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/middle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/middle.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/download.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/gamelose.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/gamelose.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/gamerule.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/gamerule.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/inputimg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/inputimg.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/loading3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/loading3.gif
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/no-award.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/no-award.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/startgame.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/startgame.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/zhidaole.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/zhidaole.png
--------------------------------------------------------------------------------
/test/demo/demo06/images/person.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo06/images/person.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/occupy-img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/occupy-img.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/background.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/downloadBtn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/downloadBtn.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/have-award.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/have-award.jpg
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/have-award1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/have-award1.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/jump_award.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/jump_award.png
--------------------------------------------------------------------------------
/test/demo/demo06/images/header_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo06/images/header_bg.png
--------------------------------------------------------------------------------
/test/demo/demo06/images/person_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo06/images/person_1.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/final-title.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/final-title.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/footer-left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/footer-left.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/footer-right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/footer-right.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/left-border.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/left-border.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/right-border.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/right-border.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/static_data1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/static_data1.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/static_data2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/static_data2.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/static_data3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/static_data3.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/static_data4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/static_data4.png
--------------------------------------------------------------------------------
/test/demo/demo05/imgs/youxishuoming1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo05/imgs/youxishuoming1.png
--------------------------------------------------------------------------------
/test/demo/demo03/images/zjnews_phone@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo03/images/zjnews_phone@2x.png
--------------------------------------------------------------------------------
/test/demo/demo03/images/zjnews_phone@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo03/images/zjnews_phone@3x.png
--------------------------------------------------------------------------------
/test/demo/demo03/images/zjnews_web@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo03/images/zjnews_web@2x.png
--------------------------------------------------------------------------------
/test/demo/demo03/images/zjnews_web@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo03/images/zjnews_web@3x.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/border-shading1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/border-shading1.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/border-shading2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/border-shading2.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/connect-linear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/connect-linear.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/current_period.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/current_period.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/final-border1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/final-border1.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/final-border2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/final-border2.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/home-head-right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/home-head-right.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/previous_period.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/previous_period.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/static-border.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/static-border.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/static_level1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/static_level1.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/static_level2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/static_level2.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/static_level3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/static_level3.png
--------------------------------------------------------------------------------
/test/demo/demo06/images/header-border.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo06/images/header-border.png
--------------------------------------------------------------------------------
/test/demo/demo07/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 |
4 | new Vue({
5 | el: '#app',
6 | render: h => h(App)
7 | })
8 |
--------------------------------------------------------------------------------
/test/demo/demo04/images/final-footer-left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/final-footer-left.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/home-top-shading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/home-top-shading.png
--------------------------------------------------------------------------------
/test/demo/demo03/images/zjnews_back_icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo03/images/zjnews_back_icon@2x.png
--------------------------------------------------------------------------------
/test/demo/demo03/images/zjnews_back_icon@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo03/images/zjnews_back_icon@3x.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/final-footer-right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/final-footer-right.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/footer-left-shading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/footer-left-shading.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/footer-right-shading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/footer-right-shading.png
--------------------------------------------------------------------------------
/test/demo/demo04/images/home-right-shading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/home-right-shading.png
--------------------------------------------------------------------------------
/test/demo/demo07/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", {
4 | "modules": false
5 | }]
6 | ],
7 | "plugins": [
8 | ]
9 | }
--------------------------------------------------------------------------------
/test/demo/demo09/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", {
4 | "modules": false
5 | }]
6 | ],
7 | "plugins": [
8 | ]
9 | }
--------------------------------------------------------------------------------
/test/demo/demo10/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", {
4 | "modules": false
5 | }]
6 | ],
7 | "plugins": [
8 | ]
9 | }
--------------------------------------------------------------------------------
/test/demo/demo04/images/footer-middle-shading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wechat-miniprogram/h5-to-miniprogram/HEAD/test/demo/demo04/images/footer-middle-shading.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | .DS_Store
3 | package-lock.json
4 |
5 | logs
6 | *.log
7 | npm-debug.log*
8 | yarn-debug.log*
9 | yarn-error.log*
10 |
11 | node_modules
12 | test/**/output
13 |
--------------------------------------------------------------------------------
/src/template/components/element/element.wxss:
--------------------------------------------------------------------------------
1 | .wx-comp-image {
2 | width: 100%;
3 | height: 100%;
4 | }
5 |
6 | .wx-comp-canvas {
7 | width: 100%;
8 | height: 100%;
9 | }
10 |
--------------------------------------------------------------------------------
/test/demo/demo08/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | "env",
4 | "stage-0",
5 | "react"
6 | ],
7 | "plugins": [
8 | "transform-runtime"
9 | ]
10 | }
--------------------------------------------------------------------------------
/test/demo/demo11/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | "env",
4 | "stage-0",
5 | "react"
6 | ],
7 | "plugins": [
8 | "transform-runtime"
9 | ]
10 | }
--------------------------------------------------------------------------------
/test/demo/demo12/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | "env",
4 | "stage-0",
5 | "react"
6 | ],
7 | "plugins": [
8 | "transform-runtime"
9 | ]
10 | }
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | .idea
2 | .DS_Store
3 | package-lock.json
4 |
5 | logs
6 | *.log
7 | npm-debug.log*
8 | yarn-debug.log*
9 | yarn-error.log*
10 |
11 | node_modules
12 | test/**/output
13 |
14 | test
15 | docs
--------------------------------------------------------------------------------
/UPDATE.md:
--------------------------------------------------------------------------------
1 | ## 0.0.5
2 |
3 | * 支持 cookie
4 | * 支持 hashchange 事件
5 | * 支持 document.createComment 接口
6 | * 支持 history
7 | * 支持压缩原 h5 页面代码
8 |
9 | ## 0.0.6
10 |
11 | * 支持当原 h5 页面引用了一些网络 js、css 文件也能进行正常构建转换
12 |
13 | ## next version
14 |
--------------------------------------------------------------------------------
/test/demo/demo08/src/index.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from 'react-dom';
3 |
4 | import App from './app.jsx';
5 |
6 | const rootEl = document.getElementById('app');
7 |
8 | render(
9 | ,
10 | rootEl
11 | );
--------------------------------------------------------------------------------
/test/demo/demo11/src/index.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from 'react-dom';
3 |
4 | import App from './app.jsx';
5 |
6 | const rootEl = document.getElementById('app');
7 |
8 | render(
9 | ,
10 | rootEl
11 | );
--------------------------------------------------------------------------------
/test/demo/demo12/src/index.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from 'react-dom';
3 |
4 | import App from './app.jsx';
5 |
6 | const rootEl = document.getElementById('app');
7 |
8 | render(
9 | ,
10 | rootEl
11 | );
--------------------------------------------------------------------------------
/src/template/common/pages/default/default.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | src: '',
4 | },
5 |
6 | onLoad({url}) {
7 | if (url) {
8 | this.setData({
9 | src: decodeURIComponent(url),
10 | })
11 | }
12 | },
13 | })
14 |
--------------------------------------------------------------------------------
/test/demo/demo08/src/btn.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 |
3 | export default class Btn extends Component {
4 | render() {
5 | return (
6 |
7 | );
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/test/demo/extend1.js:
--------------------------------------------------------------------------------
1 | module.exports = function(loadModule, moduleName) {
2 | if (moduleName === 'Window') {
3 | loadModule.prototype.I_am_extend_function = function () {
4 | return 'I am extend function'
5 | }
6 | } else {
7 | return loadModule
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/test/demo/extend2.js:
--------------------------------------------------------------------------------
1 | module.exports = function(loadModule, moduleName) {
2 | if (moduleName === 'Window') {
3 | loadModule.prototype.I_am_another_extend_function = function () {
4 | return 'I am another extend function'
5 | }
6 | } else {
7 | return loadModule
8 | }
9 | }
--------------------------------------------------------------------------------
/src/template/adapter/event/custom-event.js:
--------------------------------------------------------------------------------
1 | const load = require('../index')
2 |
3 | const Event = load('Event')
4 |
5 | class CustomEvent extends Event {
6 | constructor(name = '', options = {}) {
7 | super({
8 | name,
9 | ...options,
10 | })
11 | }
12 | }
13 |
14 | module.exports = CustomEvent
15 |
--------------------------------------------------------------------------------
/test/demo/demo11/src/aaa.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 |
3 | export default class AAA extends Component {
4 | render() {
5 | return (
6 |
7 |
I am aaa
8 |
route: {this.props.match.path}
9 |
10 | );
11 | }
12 | }
--------------------------------------------------------------------------------
/test/demo/demo11/src/bbb.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 |
3 | export default class BBB extends Component {
4 | render() {
5 | return (
6 |
7 |
I am bbb
8 |
route: {this.props.match.path}
9 |
10 | );
11 | }
12 | }
--------------------------------------------------------------------------------
/test/demo/demo12/src/aaa.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 |
3 | export default class AAA extends Component {
4 | render() {
5 | return (
6 |
7 |
I am aaa
8 |
route: {this.props.match.path}
9 |
10 | );
11 | }
12 | }
--------------------------------------------------------------------------------
/test/demo/demo12/src/bbb.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 |
3 | export default class BBB extends Component {
4 | render() {
5 | return (
6 |
7 |
I am bbb
8 |
route: {this.props.match.path}
9 |
10 | );
11 | }
12 | }
--------------------------------------------------------------------------------
/test/demo/demo09/src/AAA.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
I am aaa
4 |
route: {{route}}
5 |
6 |
7 |
8 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/test/demo/demo09/src/BBB.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
I am bbb
4 |
route: {{route}}
5 |
6 |
7 |
8 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/test/demo/demo10/src/AAA.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
I am aaa
4 |
route: {{route}}
5 |
6 |
7 |
8 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/test/demo/demo10/src/BBB.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
I am bbb
4 |
route: {{route}}
5 |
6 |
7 |
8 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/test/demo/demo07/src/Btn.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/test/demo/demo07/dist/style.css:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | .even {
52 | color: green;
53 | }
54 | .odd {
55 | color: red;
56 | }
57 |
--------------------------------------------------------------------------------
/test/demo/demo07/README.md:
--------------------------------------------------------------------------------
1 | # demo7
2 |
3 | > A Vue.js project
4 |
5 | ## Build Setup
6 |
7 | ``` bash
8 | # install dependencies
9 | npm install
10 |
11 | # serve with hot reload at localhost:8080
12 | npm run dev
13 |
14 | # build for production with minification
15 | npm run build
16 | ```
17 |
18 | For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader).
19 |
--------------------------------------------------------------------------------
/test/demo/demo09/README.md:
--------------------------------------------------------------------------------
1 | # demo7
2 |
3 | > A Vue.js project
4 |
5 | ## Build Setup
6 |
7 | ``` bash
8 | # install dependencies
9 | npm install
10 |
11 | # serve with hot reload at localhost:8080
12 | npm run dev
13 |
14 | # build for production with minification
15 | npm run build
16 | ```
17 |
18 | For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader).
19 |
--------------------------------------------------------------------------------
/test/demo/demo10/README.md:
--------------------------------------------------------------------------------
1 | # demo7
2 |
3 | > A Vue.js project
4 |
5 | ## Build Setup
6 |
7 | ``` bash
8 | # install dependencies
9 | npm install
10 |
11 | # serve with hot reload at localhost:8080
12 | npm run dev
13 |
14 | # build for production with minification
15 | npm run build
16 | ```
17 |
18 | For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader).
19 |
--------------------------------------------------------------------------------
/src/json.js:
--------------------------------------------------------------------------------
1 | const _ = require('./utils')
2 | const config = require('./config')
3 |
4 | module.exports = {
5 | /**
6 | * 生成配置
7 | */
8 | async generate(options) {
9 | const output = options.output
10 | const content = JSON.stringify({
11 | usingComponents: {
12 | body: '../../components/element/element',
13 | }
14 | }, null, config.indent.length)
15 |
16 | // 输出到 output 中
17 | await _.writeFile(output, content)
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/test/demo/demo10/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Router from 'vue-router'
3 | import App from './App.vue'
4 | import AAA from './AAA.vue'
5 | import BBB from './BBB.vue'
6 |
7 | Vue.use(Router)
8 |
9 | const router = new Router({
10 | mode: 'history', // 是否使用 history api
11 | routes: [
12 | { path: '/h5-to-miniprogram/aaa', component: AAA },
13 | { path: '/h5-to-miniprogram/bbb', component: BBB }
14 | ]
15 | })
16 |
17 | new Vue({
18 | el: '#app',
19 | router,
20 | render: h => h(App)
21 | })
22 |
--------------------------------------------------------------------------------
/test/demo/demo09/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Router from 'vue-router'
3 | import App from './App.vue'
4 | import AAA from './AAA.vue'
5 | import BBB from './BBB.vue'
6 |
7 | Vue.use(Router)
8 |
9 | const router = new Router({
10 | // mode: 'history', // 是否使用 history api
11 | routes: [
12 | { path: '/h5-to-miniprogram/aaa', component: AAA },
13 | { path: '/h5-to-miniprogram/bbb', component: BBB }
14 | ]
15 | })
16 |
17 | new Vue({
18 | el: '#app',
19 | router,
20 | render: h => h(App)
21 | })
22 |
--------------------------------------------------------------------------------
/test/demo/demo08/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "scripts": {
3 | "build": "webpack --progress --hide-modules"
4 | },
5 | "devDependencies": {
6 | "babel-core": "^6.26.3",
7 | "babel-loader": "^7.1.5",
8 | "babel-plugin-transform-runtime": "^6.23.0",
9 | "babel-preset-env": "^1.7.0",
10 | "babel-preset-react": "^6.24.1",
11 | "babel-preset-stage-0": "^6.24.1",
12 | "webpack": "^4.20.2",
13 | "webpack-cli": "^3.1.2"
14 | },
15 | "dependencies": {
16 | "react": "^16.5.2",
17 | "react-dom": "^16.5.2"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/test/demo/demo08/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 |
3 | module.exports = {
4 | mode: 'development',
5 | entry: path.join(__dirname, './src/index.jsx'),
6 | output: {
7 | path: path.join(__dirname, './dist'),
8 | filename: 'build.js',
9 | },
10 | module: {
11 | rules: [
12 | {
13 | test: /\.(js|jsx)$/,
14 | use: 'babel-loader',
15 | exclude: /node_modules/
16 | }
17 | ]
18 | },
19 | devtool: 'inline',
20 | }
21 |
--------------------------------------------------------------------------------
/test/demo/demo11/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 |
3 | module.exports = {
4 | mode: 'development',
5 | entry: path.join(__dirname, './src/index.jsx'),
6 | output: {
7 | path: path.join(__dirname, './dist'),
8 | filename: 'build.js',
9 | },
10 | module: {
11 | rules: [
12 | {
13 | test: /\.(js|jsx)$/,
14 | use: 'babel-loader',
15 | exclude: /node_modules/
16 | }
17 | ]
18 | },
19 | devtool: 'inline',
20 | }
21 |
--------------------------------------------------------------------------------
/test/demo/demo12/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 |
3 | module.exports = {
4 | mode: 'development',
5 | entry: path.join(__dirname, './src/index.jsx'),
6 | output: {
7 | path: path.join(__dirname, './dist'),
8 | filename: 'build.js',
9 | },
10 | module: {
11 | rules: [
12 | {
13 | test: /\.(js|jsx)$/,
14 | use: 'babel-loader',
15 | exclude: /node_modules/
16 | }
17 | ]
18 | },
19 | devtool: 'inline',
20 | }
21 |
--------------------------------------------------------------------------------
/test/demo/demo02/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | News
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/template/adapter/bom/screen.js:
--------------------------------------------------------------------------------
1 | const load = require('../index')
2 |
3 | const EventTarget = load('EventTarget')
4 |
5 | class Screen extends EventTarget {
6 | constructor() {
7 | super()
8 |
9 | this._width = 0
10 | this._height = 0
11 | }
12 |
13 | _$init(info) {
14 | this._width = info.screenWidth
15 | this._height = info.screenHeight
16 | }
17 |
18 | /**
19 | * 对外属性和方法
20 | */
21 | get width() {
22 | return this._width
23 | }
24 |
25 | get height() {
26 | return this._height
27 | }
28 | }
29 |
30 | module.exports = Screen
31 |
--------------------------------------------------------------------------------
/test/demo/demo11/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "scripts": {
3 | "build": "webpack --progress --hide-modules"
4 | },
5 | "devDependencies": {
6 | "babel-core": "^6.26.3",
7 | "babel-loader": "^7.1.5",
8 | "babel-plugin-transform-runtime": "^6.23.0",
9 | "babel-preset-env": "^1.7.0",
10 | "babel-preset-react": "^6.24.1",
11 | "babel-preset-stage-0": "^6.24.1",
12 | "webpack": "^4.20.2",
13 | "webpack-cli": "^3.1.2"
14 | },
15 | "dependencies": {
16 | "react": "^16.5.2",
17 | "react-dom": "^16.5.2",
18 | "react-router-dom": "^4.3.1"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/test/demo/demo12/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "scripts": {
3 | "build": "webpack --progress --hide-modules"
4 | },
5 | "devDependencies": {
6 | "babel-core": "^6.26.3",
7 | "babel-loader": "^7.1.5",
8 | "babel-plugin-transform-runtime": "^6.23.0",
9 | "babel-preset-env": "^1.7.0",
10 | "babel-preset-react": "^6.24.1",
11 | "babel-preset-stage-0": "^6.24.1",
12 | "webpack": "^4.20.2",
13 | "webpack-cli": "^3.1.2"
14 | },
15 | "dependencies": {
16 | "react": "^16.5.2",
17 | "react-dom": "^16.5.2",
18 | "react-router-dom": "^4.3.1"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/template/adapter/node/comment.js:
--------------------------------------------------------------------------------
1 | const load = require('../index')
2 |
3 | const Node = load('Node')
4 |
5 | class Comment extends Node {
6 | constructor(options, tree) {
7 | options.type = 'comment'
8 |
9 | super(options, tree)
10 | }
11 |
12 | /**
13 | * 对应的 dom 信息
14 | */
15 | get _$domInfo() {
16 | return {
17 | nodeId: this._nodeId,
18 | pageId: this._pageId,
19 | type: this._type,
20 | }
21 | }
22 |
23 | /**
24 | * 对外属性和方法
25 | */
26 | get nodeType() {
27 | return Node.COMMENT_NODE
28 | }
29 | }
30 |
31 | module.exports = Comment
32 |
--------------------------------------------------------------------------------
/test/demo/demo07/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/test/demo/demo07/src/Content.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | this is a vue demo
4 | even({{count}})
5 | odd({{count}})
6 |
7 |
8 |
9 |
22 |
23 |
32 |
--------------------------------------------------------------------------------
/test/demo/demo09/dist/style.css:
--------------------------------------------------------------------------------
1 |
2 | .tabbar {
3 | display: flex;
4 | list-style: none;
5 | }
6 | .tabbar li {
7 | position: relative;
8 | display: block;
9 | height: 50px;
10 | width: 80px;
11 | text-align: center;
12 | line-height: 50px;
13 | background: #dff1e7;
14 | margin: 5px;
15 | }
16 | .tabbar li .link {
17 | display: block;
18 | width: 100%;
19 | height: 100%;
20 | }
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/test/demo/demo10/dist/style.css:
--------------------------------------------------------------------------------
1 |
2 | .tabbar {
3 | display: flex;
4 | list-style: none;
5 | }
6 | .tabbar li {
7 | position: relative;
8 | display: block;
9 | height: 50px;
10 | width: 80px;
11 | text-align: center;
12 | line-height: 50px;
13 | background: #dff1e7;
14 | margin: 5px;
15 | }
16 | .tabbar li .link {
17 | display: block;
18 | width: 100%;
19 | height: 100%;
20 | }
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/test/demo/demo04/js/rem.js:
--------------------------------------------------------------------------------
1 | (function(doc, win){
2 | const docEl = doc.documentElement;
3 | const resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize';
4 | const recale = function(){
5 | const width = docEl.clientWidth;
6 | if (!width) return;
7 | if(width > 750){
8 | docEl.style.fontSize = '100px';
9 | }else{
10 | docEl.style.fontSize = width / 6.4 + 'px';
11 | }
12 | };
13 |
14 | if(document.addEventListener){
15 | win.addEventListener(resizeEvt, recale, false);
16 | doc.addEventListener('DOMContentLoaded', recale, false);
17 | }
18 | })(document, window);
--------------------------------------------------------------------------------
/src/template/components/plain-text/plain-text.js:
--------------------------------------------------------------------------------
1 | const load = require('../../adapter/index')
2 |
3 | const cache = load('cache')
4 |
5 | Component({
6 | properties: {
7 | // 文本内容
8 | content: {
9 | type: String,
10 | default: '',
11 | public: true,
12 | },
13 | },
14 | options: {
15 | addGlobalClass: true, // 开启全局样式
16 | },
17 | attached() {
18 | const nodeId = this.dataset.privateNodeId
19 | const pageId = this.dataset.privatePageId
20 |
21 | this.nodeId = nodeId
22 | this.pageId = pageId
23 |
24 | // 存储 nodeId 到 component 实例的映射
25 | cache.setNodeComp(pageId, nodeId, this)
26 |
27 | // 记录 dom
28 | this.domNode = cache.getNode(pageId, nodeId)
29 | },
30 | })
31 |
--------------------------------------------------------------------------------
/test/demo/demo06/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 |
3 | module.exports = {
4 | entry: './js/index.js',
5 |
6 | output: {
7 | path: path.resolve(__dirname, 'dist'),
8 | filename: 'bundle.js',
9 | publicPath: '/dist'
10 | },
11 |
12 | module: {
13 | rules: [
14 | {
15 | test: /\.js$/,
16 | exclude: /node_modules/,
17 | use: [
18 | {
19 | loader: 'babel-loader',
20 | options: {
21 | presets: ['es2015']
22 | }
23 | }
24 | ]
25 | }
26 | ]
27 | }
28 | }
--------------------------------------------------------------------------------
/src/template/element.wxml.tmpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{DATA}}
7 |
8 |
--------------------------------------------------------------------------------
/test/demo/demo06/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vote",
3 | "version": "1.0.0",
4 | "main": "index.js",
5 | "scripts": {
6 | "test": "echo \"Error: no test specified\" && exit 1",
7 | "start": "webpack-dev-server -p",
8 | "build": "webpack -p"
9 | },
10 | "keywords": [],
11 | "author": "",
12 | "license": "ISC",
13 | "dependencies": {
14 | "babel": "^6.23.0",
15 | "babel-core": "^6.26.0",
16 | "babel-loader": "^7.1.2",
17 | "babel-preset-es2015": "^6.24.1",
18 | "better-scroll": "^1.2.3",
19 | "es6-promise": "^4.1.1",
20 | "express": "^4.15.4",
21 | "jquery": "^3.2.1",
22 | "webpack": "^3.5.5",
23 | "webpack-dev-server": "^2.7.1"
24 | },
25 | "devDependencies": {},
26 | "description": ""
27 | }
28 |
--------------------------------------------------------------------------------
/test/demo/demo08/src/app.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 |
3 | import Btn from './btn.jsx'
4 | import Content from './content.jsx'
5 |
6 | export default class App extends Component {
7 | constructor() {
8 | super();
9 |
10 | this.state = {
11 | count: 1,
12 | text: 'add',
13 | };
14 | this.add = this.add.bind(this);
15 | }
16 |
17 | add() {
18 | this.setState({
19 | count: this.state.count + 1,
20 | });
21 | }
22 |
23 | render() {
24 | return (
25 |
26 |
27 |
28 |
29 | );
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/test/html/walker.test.js:
--------------------------------------------------------------------------------
1 | const mock = require('../mock')
2 | const walker = require('../../src/html/walker')
3 | const load = require('../../src/template/adapter')
4 |
5 | const parser = load('parser')
6 |
7 | test('walk html ast', () => {
8 | const parsed = parser.parse(mock.html)
9 | const res = walker.walk(parsed[0])
10 |
11 | expect(res.title).toBe('test')
12 | expect(res.style).toEqual([
13 | {src: './css/a.css', type: 'outer'},
14 | {src: './css/b.css', type: 'outer'},
15 | {content: '.a {\n color: green;\n }', type: 'inner'}
16 | ])
17 | expect(res.script).toEqual([
18 | {src: './js/a.js', type: 'outer'},
19 | {src: './js/b.js', type: 'outer'},
20 | {content: 'console.log(\'hello\');', type: 'inner'}
21 | ])
22 | expect(res.body.tagName).toBe('body')
23 | })
24 |
--------------------------------------------------------------------------------
/test/demo/demo09/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
17 |
18 |
39 |
--------------------------------------------------------------------------------
/test/demo/demo10/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
17 |
18 |
39 |
--------------------------------------------------------------------------------
/test/demo/demo07/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "scripts": {
3 | "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
4 | "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
5 | },
6 | "dependencies": {
7 | "vue": "^2.5.11"
8 | },
9 | "browserslist": [
10 | "> 1%",
11 | "last 2 versions",
12 | "not ie <= 8"
13 | ],
14 | "devDependencies": {
15 | "babel-core": "^6.26.0",
16 | "babel-loader": "^7.1.2",
17 | "babel-preset-env": "^1.6.0",
18 | "babel-preset-stage-3": "^6.24.1",
19 | "cross-env": "^5.0.5",
20 | "css-loader": "^0.28.7",
21 | "extract-text-webpack-plugin": "^3.0.2",
22 | "file-loader": "^1.1.4",
23 | "vue-loader": "^13.0.5",
24 | "vue-template-compiler": "^2.4.4",
25 | "webpack": "^3.6.0",
26 | "webpack-dev-server": "^2.9.1"
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/test/demo/demo05/js/rem.js:
--------------------------------------------------------------------------------
1 | (function (doc, win) {
2 | var docEl = doc.documentElement,
3 | resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
4 |
5 | recalc = function () {
6 | var clientWidth = docEl.clientWidth;
7 | if (!clientWidth) return;
8 | if(clientWidth > 750){ //针对移动版的页面控制在750px内
9 | docEl.style.fontSize = '100px';
10 | }
11 | if(clientWidth <750){
12 | // docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
13 | docEl.style.fontSize = clientWidth/ 6.4+ 'px';
14 |
15 | }
16 |
17 |
18 | };
19 | if (!doc.addEventListener) return;
20 | win.addEventListener(resizeEvt, recalc, false);
21 | doc.addEventListener('DOMContentLoaded', recalc, false);
22 | })(document, window);
--------------------------------------------------------------------------------
/src/html/index.js:
--------------------------------------------------------------------------------
1 | const load = require('../template/adapter')
2 | const walker = require('./walker')
3 | const _ = require('../utils')
4 |
5 | const parser = load('parser')
6 |
7 | module.exports = {
8 | /**
9 | * 解析 html
10 | */
11 | parse(content) {
12 | const ast = parser.parse(content)
13 |
14 | if (ast.length !== 1) throw new Error('invalid entry html')
15 |
16 | return walker.walk(ast[0])
17 | },
18 |
19 | /**
20 | * 生成页面
21 | */
22 | async generate(options) {
23 | const output = options.output
24 | const body = options.body
25 | const bodyClass = (body.attrs.class || '') + ' h5-body' // 增加默认 class
26 |
27 | await _.writeFile(output, `
23 |
24 |
25 |
26 | `)
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/test/demo/demo11/src/app.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { HashRouter as Router, Route, Link } from 'react-router-dom';
3 |
4 | import AAA from './aaa.jsx'
5 | import BBB from './bbb.jsx'
6 |
7 | export default class App extends Component {
8 | render() {
9 | return (
10 |
11 |
19 |
20 | );
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/test/demo/demo12/src/app.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { BrowserRouter as Router, Route, Link } from 'react-router-dom';
3 |
4 | import AAA from './aaa.jsx'
5 | import BBB from './bbb.jsx'
6 |
7 | export default class App extends Component {
8 | render() {
9 | return (
10 |
11 |
19 |
20 | );
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/test/demo/demo09/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "scripts": {
3 | "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
4 | "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
5 | },
6 | "dependencies": {
7 | "vue": "^2.5.11",
8 | "vue-router": "^3.0.1"
9 | },
10 | "browserslist": [
11 | "> 1%",
12 | "last 2 versions",
13 | "not ie <= 8"
14 | ],
15 | "devDependencies": {
16 | "babel-core": "^6.26.0",
17 | "babel-loader": "^7.1.2",
18 | "babel-preset-env": "^1.6.0",
19 | "babel-preset-stage-3": "^6.24.1",
20 | "cross-env": "^5.0.5",
21 | "css-loader": "^0.28.7",
22 | "extract-text-webpack-plugin": "^3.0.2",
23 | "file-loader": "^1.1.4",
24 | "vue-loader": "^13.0.5",
25 | "vue-template-compiler": "^2.4.4",
26 | "webpack": "^3.6.0",
27 | "webpack-dev-server": "^2.9.1"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/test/demo/demo10/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "scripts": {
3 | "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
4 | "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
5 | },
6 | "dependencies": {
7 | "vue": "^2.5.11",
8 | "vue-router": "^3.0.1"
9 | },
10 | "browserslist": [
11 | "> 1%",
12 | "last 2 versions",
13 | "not ie <= 8"
14 | ],
15 | "devDependencies": {
16 | "babel-core": "^6.26.0",
17 | "babel-loader": "^7.1.2",
18 | "babel-preset-env": "^1.6.0",
19 | "babel-preset-stage-3": "^6.24.1",
20 | "cross-env": "^5.0.5",
21 | "css-loader": "^0.28.7",
22 | "extract-text-webpack-plugin": "^3.0.2",
23 | "file-loader": "^1.1.4",
24 | "vue-loader": "^13.0.5",
25 | "vue-template-compiler": "^2.4.4",
26 | "webpack": "^3.6.0",
27 | "webpack-dev-server": "^2.9.1"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/test/demo/demo08/src/content.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 |
3 | export default class Content extends Component {
4 | constructor(props) {
5 | super();
6 |
7 | const count = props.count || 0
8 |
9 | this.state = {
10 | isEven: count % 2 === 0,
11 | };
12 | }
13 |
14 | componentWillReceiveProps(nextProps) {
15 | const count = nextProps.count || 0
16 |
17 | this.setState({
18 | isEven: count % 2 === 0,
19 | });
20 | }
21 |
22 | render() {
23 | return (
24 |
25 | this is a vue demo
26 | {
27 | this.state.isEven ? (even({this.props.count})) : (odd({this.props.count}))
28 | }
29 |
30 | );
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/test/demo/demo02/css/index.css:
--------------------------------------------------------------------------------
1 | * {
2 | padding: 0;
3 | margin: 0;
4 | }
5 | .container{
6 | width: 100%;
7 | overflow: hidden;
8 | position: relative;
9 | }
10 |
11 | table{
12 | width: 100%;
13 | border-collapse: collapse;
14 | }
15 |
16 | table tr:first-child{
17 | width: 100%;
18 | height: 150px;
19 | border-bottom: 1px solid #f3f5f7;
20 | }
21 |
22 | table tr:first-child td:last-child{
23 | vertical-align: top;
24 | padding-top: 10px;
25 | }
26 |
27 | table tr:first-child td:last-child p{
28 | height: 20px;
29 | line-height: 20px;
30 | }
31 |
32 | tr{
33 | width: 100%;
34 | border-bottom: 1px solid #f3f5f7;
35 | height: 40px;
36 | font-size: 12px;
37 | /* border-collapse: separate; */
38 | }
39 |
40 | td{
41 | padding-left: 10px;
42 | }
43 |
44 | tr td:last-child{
45 | width: 60%;
46 | font-weight: 700;
47 | }
48 |
49 | .head-img {
50 | display:block;
51 | margin: 0 auto;
52 | width: 112px;
53 | height: 123px;
54 | }
55 |
--------------------------------------------------------------------------------
/test/demo/demo09/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
vue
10 |
20 |
21 |
22 |