Skip to content

Commit 6f58f89

Browse files
authored
Merge pull request alibaba#1622 from alibaba/jsfm-feature-0.17
[jsfm] Merge js framework 0.17 into dev
2 parents 5a229b6 + e57e2ed commit 6f58f89

File tree

408 files changed

+10061
-2808
lines changed

Some content is hidden

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

408 files changed

+10061
-2808
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# do not lint test case source files
2+
html5/test/case/*/*.source.js
3+
html5/test/case/*/*.output.js

.gitignore

+1-3
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,14 @@ pids
2222
*.pid
2323
*.seed
2424

25-
# build framework options by script
26-
html5/runtime/config.js
27-
2825
# e2e test
2926
html5/test/e2e/reports
3027
html5/test/e2e/screenshots
3128
html5/test/e2e/logs
3229

3330
# Created by Weex Web Packer
3431
html5/browser/extend/packer.js
32+
html5/render/browser/extend/packer.js
3533

3634
android/playground/app/gradlew
3735
android/playground/app/gradlew.bat

.wwprc

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
2+
"componentsPath": "./html5/render/browser/extend/components",
3+
"apisPath": "./html5/render/browser/extend/api",
4+
"loadersPath": "./html5/render/browser/extend/loader",
5+
"packer": "./html5/render/browser/extend/packer.js",
26
"components": [
37
"image",
48
"text",
@@ -16,16 +20,17 @@
1620
"web"
1721
],
1822
"apis": [
23+
"animation",
24+
"clipboard",
1925
"dom",
2026
"event",
21-
"pageInfo",
22-
"stream",
27+
"geolocation",
28+
"globalEvent",
2329
"modal",
24-
"animation",
25-
"webview",
2630
"navigator",
31+
"pageInfo",
2732
"storage",
28-
"clipboard",
29-
"geolocation"
33+
"stream",
34+
"webview"
3035
]
3136
}

README.md

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Weex
22
Android[![Download](https://api.bintray.com/packages/alibabaweex/maven/weex_sdk/images/download.svg)](https://bintray.com/alibabaweex/maven/weex_sdk/_latestVersion)
3-
iOS[![Pod version](https://badge.fury.io/co/WeexSDK.svg)](https://cocoapods.org/pods/WeexSDK)
3+
iOS[![Pod version](https://badge.fury.io/co/WeexSDK.svg)](https://cocoapods.org/pods/WeexSDK)
44
HTML5[![npm version](https://badge.fury.io/js/weex-html5.svg)](https://www.npmjs.com/package/weex-html5)
55

66
> A framework for building Mobile cross-platform UI.
77
88
[![CircleCI](https://circleci.com/gh/alibaba/weex/tree/dev.svg?style=svg&circle-token=b83b047a3a01f6ec26458a455530a5ddc261925f)](https://circleci.com/gh/alibaba/weex/tree/dev) [![Gitter](https://img.shields.io/gitter/room/weexteam/cn.svg?maxAge=2592000)](https://gitter.im/weexteam) <sub>(English Gitter)</sub> [![Gitter](https://img.shields.io/gitter/room/weexteam/cn.svg?maxAge=2592000)](https://gitter.im/weexteam/cn) <sub>(Chinese 中文聊天室)</sub>
99

10-
Support Android 4.1 (API 16) and iOS 7.0+. See [Weex website](https://alibaba.github.io/weex/) for more information.
10+
Support Android 4.1 (API 16) and iOS 7.0+. See [Weex website](https://alibaba.github.io/weex/) for more information.
1111

1212
## For Windows
1313

@@ -26,12 +26,12 @@ Please ***INSTALL [Git for Windows](https://git-scm.com/download/win)*** and run
2626
* [Tutorial](https://alibaba.github.io/weex/doc/tutorial.html)
2727
* Doc: [English](https://alibaba.github.io/weex/doc/), [中文](https://github.com/weexteam/article/wiki/Weex%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3)
2828

29-
### Android
29+
### Android
3030

3131
0. Prerequisites
3232
0. Install [Node.js](http://nodejs.org/) 4.0+
33-
0. Under project root
34-
0. `npm install`, install project
33+
0. Under project root
34+
0. `npm install`, install project
3535
0. `./start`
3636
0. Install [Android Environment](http://developer.android.com/training/basics/firstapp/index.html)
3737
0. Run playground, In Android Studio
@@ -49,8 +49,8 @@ On Android Platform , Weex code is executed in [weex_v8core](https://github.com/
4949

5050
0. Prerequisites
5151
0. Install [Node.js](http://nodejs.org/) 4.0+
52-
0. Under project root
53-
0. `npm install`, install project
52+
0. Under project root
53+
0. `npm install`, install project
5454
0. `./start`
5555
0. Install [iOS Environment](https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppStoreDistributionTutorial/Setup/Setup.html)
5656
0. Install [CocoaPods](https://guides.cocoapods.org/using/getting-started.html)
@@ -78,7 +78,7 @@ Weex team have developed a [DevTool](https://github.com/weexteam/weex-devtool) t
7878
See [FAQ](https://alibaba.github.io/weex/doc/faq.html) for more information.
7979

8080

81-
### Community based Weex knowledge site
81+
### Community based Weex knowledge site
8282

8383
* [weex article](https://github.com/weexteam/article/wiki) : article collection about Weex(文章集合)
8484
* [weex.help](http://weex.help/) : 3rd forum about Weex(第三方Weex中文技术论坛)
@@ -87,4 +87,3 @@ See [FAQ](https://alibaba.github.io/weex/doc/faq.html) for more information.
8787
## Contributing
8888

8989
See [Weex Contributing Guide](./CONTRIBUTING.md) for more information.
90-

bin/dist-js-framework.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ rm -Rf src
1515
mkdir src
1616
cp ../../.babelrc .
1717
cp -Rf ../../html5/* src/
18-
rm -Rf src/browser
18+
rm -Rf src/render/browser
1919
rm -Rf src/test
2020

2121
if [ $# -gt 0 ]; then

build/build.js

+180
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
const fs = require('fs')
2+
const path = require('path')
3+
const gzip = require('zlib').createGzip()
4+
const pkg = require('../package.json')
5+
const { rollup } = require('rollup')
6+
const json = require('rollup-plugin-json')
7+
const eslint = require('rollup-plugin-eslint')
8+
const replace = require('rollup-plugin-replace')
9+
const postcss = require('rollup-plugin-postcss')
10+
const nodeResolve = require('rollup-plugin-node-resolve')
11+
const uglify = require('rollup-plugin-uglify')
12+
const commonjs = require('rollup-plugin-commonjs')
13+
const buble = require('rollup-plugin-buble')
14+
15+
const frameworkVersion = pkg.subversion.framework
16+
const browserVersion = pkg.subversion.browser
17+
const commonBanner = `(this.getJSFMVersion = function(){return "${frameworkVersion}"});`
18+
+ `var global = this, process = { env: {} };var setTimeout = global.setTimeout;\n`
19+
20+
// create dist folder
21+
if (!fs.existsSync('dist')) {
22+
fs.mkdirSync('dist')
23+
}
24+
25+
// build specific package
26+
if (process.argv[2]) {
27+
switch (process.argv[2]) {
28+
case 'native': buildNative(); break;
29+
case 'runtime': buildRuntime(); break;
30+
case 'browser': buildBrowser(); break;
31+
default: console.log('\n invalid package name.\n')
32+
}
33+
}
34+
35+
// build all packages by default
36+
else {
37+
buildNative()
38+
buildRuntime()
39+
}
40+
41+
function runRollup (config) {
42+
return rollup(config).then(bundle => {
43+
bundle.write(config)
44+
.then(() => {
45+
const size = getSize(config.dest)
46+
console.log(`write file at: ${config.dest} ${size}`)
47+
48+
// gzip minified file
49+
if (/\.min\.js$/.test(config.dest)) {
50+
const read = fs.createReadStream(config.dest)
51+
const write = fs.createWriteStream(config.dest + '.gz')
52+
read.pipe(gzip).pipe(write).on('close', () => {
53+
const gzipSize = getSize(config.dest + '.gz')
54+
console.log(`write file at: ${config.dest}.gz ${gzipSize}`)
55+
})
56+
}
57+
})
58+
})
59+
}
60+
61+
function build (name, options, plugins) {
62+
const env = options.env
63+
plugins = plugins || options.plugins
64+
delete options.env
65+
66+
// build development version
67+
if (!env || env === 'development') {
68+
// console.log(`start building ${name}.js (development version)`)
69+
runRollup(Object.assign({}, options, {
70+
dest: `./dist/${name}.js`,
71+
sourceMap: 'inline',
72+
plugins: [
73+
...plugins,
74+
replace({
75+
'process.env.NODE_ENV': JSON.stringify('development'),
76+
'process.env.VUE_ENV': JSON.stringify('weex'),
77+
'process.env.NODE_DEBUG': false
78+
})
79+
]
80+
}))
81+
}
82+
83+
// build production version
84+
if (!env || env === 'production') {
85+
// console.log(`start building ${name}.min.js (production version)`)
86+
runRollup(Object.assign({}, options, {
87+
dest: `./dist/${name}.min.js`,
88+
plugins: [
89+
...plugins,
90+
replace({
91+
'process.env.NODE_ENV': JSON.stringify('production'),
92+
'process.env.VUE_ENV': JSON.stringify('weex'),
93+
'process.env.NODE_DEBUG': false
94+
}),
95+
uglify()
96+
]
97+
}))
98+
}
99+
}
100+
101+
function buildNative () {
102+
const banner = `(this.nativeLog || function(s) {console.log(s)})`
103+
+ `('START JS FRAMEWORK: ${frameworkVersion} Build ${now()}');\n`
104+
+ commonBanner
105+
106+
build('native', {
107+
entry: './html5/render/native/index.js',
108+
banner,
109+
format: 'umd',
110+
plugins: [
111+
json(),
112+
eslint({
113+
exclude: './package.json'
114+
}),
115+
nodeResolve({
116+
jsnext: true,
117+
main: true
118+
}),
119+
commonjs(),
120+
buble()
121+
]
122+
})
123+
}
124+
125+
function buildRuntime () {
126+
const banner = `('WEEX JS RUNTIME: ${frameworkVersion}, Build ${now()}');`
127+
+ `var global = this, process = { env: {} };var setTimeout = global.setTimeout;\n`
128+
129+
build('runtime', {
130+
moduleName: 'weexRuntime',
131+
entry: './html5/runtime/index.js',
132+
format: 'umd',
133+
banner,
134+
plugins: [
135+
eslint(),
136+
nodeResolve({
137+
jsnext: true,
138+
main: true
139+
}),
140+
commonjs(),
141+
buble()
142+
]
143+
})
144+
}
145+
146+
function buildBrowser () {
147+
const banner = `(this.nativeLog || function(s) {console.log(s)})`
148+
+ `('START WEEX HTML5: ${browserVersion} Build ${now()}');\n`
149+
+ commonBanner
150+
151+
build('browser', {
152+
moduleName: 'weex',
153+
entry: './html5/render/browser/index.js',
154+
banner,
155+
format: 'umd',
156+
plugins: [
157+
postcss(),
158+
json(),
159+
eslint({
160+
exclude: ['./package.json', '**/*.css']
161+
}),
162+
nodeResolve({
163+
jsnext: true,
164+
main: true,
165+
browser: true
166+
}),
167+
commonjs(),
168+
buble()
169+
]
170+
})
171+
}
172+
173+
function getSize (file) {
174+
return (fs.statSync(file).size / 1024).toFixed(2) + 'KB'
175+
}
176+
177+
function now () {
178+
const time = Date.now() - (new Date()).getTimezoneOffset() * 60000
179+
return (new Date(time)).toISOString().replace('T', ' ').substring(0, 16)
180+
}

build/config.frameworks.js

-51
This file was deleted.

build/rollup.browser.common.config.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { rollup } from 'rollup'
2+
import postcss from 'rollup-plugin-postcss'
3+
import json from 'rollup-plugin-json'
4+
import eslint from 'rollup-plugin-eslint'
5+
import nodeResolve from 'rollup-plugin-node-resolve'
6+
import commonjs from 'rollup-plugin-commonjs'
7+
import buble from 'rollup-plugin-buble'
8+
9+
const pkg = require('../package.json')
10+
const version = pkg.subversion.browser
11+
const date = new Date().toISOString().split('T')[0].replace(/\-/g, '')
12+
const banner = `\
13+
console.log('START WEEX HTML5: ${version} Build ${date}');
14+
`
15+
16+
export default {
17+
entry: './html5/render/browser/index.js',
18+
dest: './dist/browser.common.js',
19+
banner,
20+
format: 'cjs',
21+
plugins: [
22+
postcss(),
23+
json(),
24+
eslint({
25+
exclude: ['./package.json', '**/*.css']
26+
}),
27+
nodeResolve({
28+
jsnext: true,
29+
main: true,
30+
browser: true
31+
}),
32+
commonjs(),
33+
buble()
34+
]
35+
}

0 commit comments

Comments
 (0)