Skip to content

Commit

Permalink
Merge branch 'master' of github.com:NervJS/taro
Browse files Browse the repository at this point in the history
  • Loading branch information
Pines-Cheng committed Apr 18, 2019
2 parents 090b6ce + 99c59f6 commit e1850a3
Show file tree
Hide file tree
Showing 147 changed files with 19,011 additions and 560 deletions.
66 changes: 65 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,67 @@
<a name=""></a>
# [](https://github.com/NervJS/taro/compare/v1.2.26...v) (2019-04-15)
# [](https://github.com/NervJS/taro/compare/v1.2.27-beta.0...v) (2019-04-18)



<a name="1.2.27-beta.0"></a>
## [1.2.27-beta.0](https://github.com/NervJS/taro/compare/v1.2.26...v1.2.27-beta.0) (2019-04-18)


### Bug Fixes

* **cli:** h5端增加了reachBottom等函数的容错处理 ([1e7670c](https://github.com/NervJS/taro/commit/1e7670c))
* **cli:** mobx 模版依赖问题修复 ([4368557](https://github.com/NervJS/taro/commit/4368557))
* **component:** hoverable 异常逻辑 ([b21093f](https://github.com/NervJS/taro/commit/b21093f))
* **components:** picker 单列选择更新下标问题 (close [#2797](https://github.com/NervJS/taro/issues/2797)) ([36d3b0f](https://github.com/NervJS/taro/commit/36d3b0f))
* **components:** 修复某些时候swiper.destroy报错的问题 ([b479992](https://github.com/NervJS/taro/commit/b479992))
* **components-rn:** Picker time 格式 hh:mm ([a52ebc5](https://github.com/NervJS/taro/commit/a52ebc5))
* **h5:** 修复父类的componentDidShow等函数被覆盖的问题 ([ba88faa](https://github.com/NervJS/taro/commit/ba88faa))
* **h5:** 去除promise.finally ([1ed6d0d](https://github.com/NervJS/taro/commit/1ed6d0d))
* **index.d.ts:** 修正 Canvas 的类型定义 ([#2768](https://github.com/NervJS/taro/issues/2768)) ([5318903](https://github.com/NervJS/taro/commit/5318903))
* **mobx:** rn 端问题修复 ([fde899d](https://github.com/NervJS/taro/commit/fde899d))
* **mobx:** 支付宝小程序 onTaroCollectChilds 未定义问题修复 ([556c31f](https://github.com/NervJS/taro/commit/556c31f))
* **taro-rn:** RN 端 Toast 相关 API Promise 化 close [#2715](https://github.com/NervJS/taro/issues/2715) ([00bac39](https://github.com/NervJS/taro/commit/00bac39))
* **taro-transformer-wx:** props 改造,优化组件属性过滤判断 ([43c3dac](https://github.com/NervJS/taro/commit/43c3dac))
* **taro-transformer-wx:** 自动 import 的 taro 工具包补齐 ([bf1da1e](https://github.com/NervJS/taro/commit/bf1da1e))
* **taro-weapp:** 不再根据 Component.properties 来计算 next props ([2ede173](https://github.com/NervJS/taro/commit/2ede173))
* **taro-weapp:** 不去过滤所有第三方与原生组件的 propreties ([5fdc5fa](https://github.com/NervJS/taro/commit/5fdc5fa))
* **taro-weapp:** 优化微信小程序 props 改造方案 ([c2d5749](https://github.com/NervJS/taro/commit/c2d5749))
* **taro-weapp:** 修复没有 props 的自定义组件不初始化的问题。 ([29162b8](https://github.com/NervJS/taro/commit/29162b8))
* **taro-weapp:** 微信小程序 props 改造,compid 改为运行时动态打上 ([972255e](https://github.com/NervJS/taro/commit/972255e))
* **taro-weapp:** 微信小程序 redux props 不能被覆盖 ([684bcce](https://github.com/NervJS/taro/commit/684bcce))
* **taro-weapp:** 微信小程序收集自定义组件 props 过滤时过滤掉 render 开头的组件 ([55b7031](https://github.com/NervJS/taro/commit/55b7031))
* **taro-weapp/tt/swan/alipay:** 修复 ref ([d4e3ef5](https://github.com/NervJS/taro/commit/d4e3ef5))
* **transformer:** 最后加入到 render 函数的一刻才处理 propsManager.set 的先验条件 ([2a933c3](https://github.com/NervJS/taro/commit/2a933c3))
* **transformer:** 增加 isEmptyProps 对 JSXSpreadAttribute 的判断 ([9dbc512](https://github.com/NervJS/taro/commit/9dbc512))
* **transformer:** 多层循环中使用箭头函数给事件传参错误,close [#2551](https://github.com/NervJS/taro/issues/2551) ([f880c82](https://github.com/NervJS/taro/commit/f880c82)), closes [#2514](https://github.com/NervJS/taro/issues/2514) [#2112](https://github.com/NervJS/taro/issues/2112)
* css modules doesn't update ([#2712](https://github.com/NervJS/taro/issues/2712)) ([c599918](https://github.com/NervJS/taro/commit/c599918)), closes [#1388](https://github.com/NervJS/taro/issues/1388)
* **transformer:** 循环中传匿名函数 props 需要返回值 ([f65c6a5](https://github.com/NervJS/taro/commit/f65c6a5))
* **transformer:** 第三方组件事件处理错误 ([011dd77](https://github.com/NervJS/taro/commit/011dd77))
* **transformer:** 通过 props 传递生成的匿名函数需要直接 return ([60122df](https://github.com/NervJS/taro/commit/60122df))


### Features

* **component-rn:** 添加 Block 组件 ([714c770](https://github.com/NervJS/taro/commit/714c770))
* **components-rn:** add ClickableSimplified ([cccb502](https://github.com/NervJS/taro/commit/cccb502))
* **components-rn:** ts 改写 WebView 组件 ([73517c4](https://github.com/NervJS/taro/commit/73517c4))
* **components-rn:** 脱离expo, example 移至 react-native init 的项目下 ([7becd8e](https://github.com/NervJS/taro/commit/7becd8e))
* **components-rn:** 脱离expo, example 移至 react-native init 的项目下 ([1fdf035](https://github.com/NervJS/taro/commit/1fdf035))
* **h5:** canvas系列api不再使用Proxy ([ee708c5](https://github.com/NervJS/taro/commit/ee708c5))
* **h5:** canvas系列api现在不强制传this了 ([4cbaab3](https://github.com/NervJS/taro/commit/4cbaab3))
* **h5:** h5增加api createInnerAudioContext ([52703ac](https://github.com/NervJS/taro/commit/52703ac))
* **h5:** h5增加api get/setClipboardData ([e41bb2e](https://github.com/NervJS/taro/commit/e41bb2e))
* **h5:** h5端姑且支持setNavigationBarColor ([776aaea](https://github.com/NervJS/taro/commit/776aaea))
* **h5:** innerAudioContext的一些优化: ([8a4b6c7](https://github.com/NervJS/taro/commit/8a4b6c7))
* **h5:** open api 功能更新 [#2771](https://github.com/NervJS/taro/issues/2771) ([11e89f1](https://github.com/NervJS/taro/commit/11e89f1))
* **h5:** 增加createVideoContext api ([d8a3b0e](https://github.com/NervJS/taro/commit/d8a3b0e))
* **h5:** 增加了chooseVideo api, videoContext api补齐 ([7fb605d](https://github.com/NervJS/taro/commit/7fb605d))
* **ht:** h5增加api pageScrollTo ([b1c5252](https://github.com/NervJS/taro/commit/b1c5252))
* **taro-router-rn:** 添加 showTabBar 和 hideTabBar 的 API ([18298c6](https://github.com/NervJS/taro/commit/18298c6))
* **taro-swan:** 百度小程序重构 props 系统 ([1a6d244](https://github.com/NervJS/taro/commit/1a6d244))
* **taro-tt:** 字节跳动小程序 props 改造 ([0af1d46](https://github.com/NervJS/taro/commit/0af1d46))
* **taro-weapp:** 微信小程序 props 改造 ([e5fa03b](https://github.com/NervJS/taro/commit/e5fa03b))
* **transformer:** 如果用户没有写在循环中写 index,就生成一个匿名 index ([b60f5f1](https://github.com/NervJS/taro/commit/b60f5f1))



Expand Down Expand Up @@ -45,6 +107,7 @@

* **components:** video组件md更新 ([a5108c5](https://github.com/NervJS/taro/commit/a5108c5))
* **components:** 增加video组件 ([03b13a0](https://github.com/NervJS/taro/commit/03b13a0))
* **components-rn:** ts 改写 WebView 组件 ([2a0b21d](https://github.com/NervJS/taro/commit/2a0b21d))
* **scss:** support global scss inject ([#2725](https://github.com/NervJS/taro/issues/2725)) ([1187e24](https://github.com/NervJS/taro/commit/1187e24))


Expand Down Expand Up @@ -130,6 +193,7 @@
### Bug Fixes

* **components-rn:** Picker date 格式 yyyy-MM-dd ([62b632c](https://github.com/NervJS/taro/commit/62b632c))
* **components-rn:** Picker time 格式 hh:mm ([a7524ad](https://github.com/NervJS/taro/commit/a7524ad))
* **components-rn:** 大小写无法覆盖导致了引用问题 ([1dd42f3](https://github.com/NervJS/taro/commit/1dd42f3))
* **mobx:** 修复h5下,componentDidShow不触发的问题 ([#2583](https://github.com/NervJS/taro/issues/2583)) ([7076881](https://github.com/NervJS/taro/commit/7076881))
* **rn:** RN 下 navigationBarTextStyle 无效 close [#2119](https://github.com/NervJS/taro/issues/2119) ([0539c8e](https://github.com/NervJS/taro/commit/0539c8e))
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@
"message": "chore(release): publish %s"
}
},
"version": "1.2.26",
"version": "1.2.27-beta.0",
"npmClient": "npm"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-plugin-transform-jsx-to-stylesheet",
"version": "1.2.26",
"version": "1.2.27-beta.0",
"description": "Transform stylesheet selector to style in JSX Elements.",
"license": "MIT",
"main": "src/index.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-plugin-transform-taroapi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-plugin-transform-taroapi",
"version": "1.2.26",
"version": "1.2.27-beta.0",
"main": "dist/index.js",
"license": "MIT",
"scripts": {
Expand All @@ -10,7 +10,7 @@
"test": "jest"
},
"devDependencies": {
"@tarojs/taro-h5": "1.2.26",
"@tarojs/taro-h5": "1.2.27-beta.0",
"@types/babel-core": "^6.25.5",
"@types/babel-traverse": "^6.25.4",
"@types/babel-types": "^7.0.4",
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-taro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-taro",
"version": "1.2.26",
"version": "1.2.27-beta.0",
"description": "Taro specific linting rules for ESLint",
"main": "index.js",
"files": [
Expand All @@ -27,6 +27,6 @@
"author": "O2Team",
"license": "MIT",
"dependencies": {
"eslint-plugin-taro": "1.2.26"
"eslint-plugin-taro": "1.2.27-beta.0"
}
}
2 changes: 1 addition & 1 deletion packages/eslint-plugin-taro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-taro",
"version": "1.2.26",
"version": "1.2.27-beta.0",
"description": "Taro specific linting plugin for ESLint",
"main": "index.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-plugin-constparse/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postcss-plugin-constparse",
"version": "1.2.26",
"version": "1.2.27-beta.0",
"description": "parse constants defined in config",
"main": "index.js",
"author": "Simba",
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-pxtransform/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postcss-pxtransform",
"version": "1.2.26",
"version": "1.2.27-beta.0",
"description": "PostCSS plugin px 转小程序 rpx及h5 rem 单位",
"keywords": [
"postcss",
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-unit-transform/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postcss-taro-unit-transform",
"version": "1.2.26",
"version": "1.2.27-beta.0",
"description": "小程序单位转换",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/stylelint-config-taro-rn/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stylelint-config-taro-rn",
"version": "1.2.26",
"version": "1.2.27-beta.0",
"description": "Shareable stylelint config for React Native CSS modules",
"main": "index.js",
"files": [
Expand Down Expand Up @@ -28,7 +28,7 @@
"jest": "^23.6.0",
"npmpub": "^4.1.0",
"stylelint": "^9.9.0",
"stylelint-taro-rn": "1.2.26"
"stylelint-taro-rn": "1.2.27-beta.0"
},
"peerDependencies": {
"stylelint": "^8.0.0 || ^9.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/stylelint-taro-rn/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "stylelint-taro-rn",
"description": "A collection of React Native specific rules for stylelint",
"version": "1.2.26",
"version": "1.2.27-beta.0",
"main": "dist/index.js",
"babel": {
"presets": [
Expand Down
6 changes: 3 additions & 3 deletions packages/taro-alipay/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tarojs/taro-alipay",
"version": "1.2.26",
"version": "1.2.27-beta.0",
"description": "Taro alipay framework",
"main": "index.js",
"files": [
Expand All @@ -24,8 +24,8 @@
"author": "O2Team",
"license": "MIT",
"dependencies": {
"@tarojs/taro": "1.2.26",
"@tarojs/utils": "1.2.26",
"@tarojs/taro": "1.2.27-beta.0",
"@tarojs/utils": "1.2.27-beta.0",
"lodash": "^4.17.10",
"prop-types": "^15.6.1"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-async-await/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tarojs/async-await",
"version": "1.2.26",
"version": "1.2.27-beta.0",
"description": "taro async await",
"main": "index.js",
"scripts": {
Expand Down
14 changes: 7 additions & 7 deletions packages/taro-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tarojs/cli",
"version": "1.2.26",
"version": "1.2.27-beta.0",
"description": "cli tool for taro",
"main": "index.js",
"scripts": {
Expand All @@ -23,16 +23,16 @@
"author": "O2Team",
"license": "MIT",
"dependencies": {
"@tarojs/taroize": "1.2.26",
"@tarojs/transformer-wx": "1.2.26",
"@tarojs/taroize": "1.2.27-beta.0",
"@tarojs/transformer-wx": "1.2.27-beta.0",
"autoprefixer": "^8.4.1",
"babel-core": "^6.26.3",
"babel-generator": "^6.26.1",
"babel-plugin-danger-remove-unused-import": "^1.1.1",
"babel-plugin-remove-dead-code": "^1.3.2",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-define": "^1.3.0",
"babel-plugin-transform-jsx-to-stylesheet": "1.2.26",
"babel-plugin-transform-jsx-to-stylesheet": "1.2.27-beta.0",
"babel-plugin-transform-react-jsx": "^6.24.1",
"babel-template": "^6.26.0",
"babel-traverse": "^6.26.0",
Expand Down Expand Up @@ -64,7 +64,7 @@
"postcss-modules-resolve-imports": "^1.3.0",
"postcss-modules-scope": "^1.1.0",
"postcss-modules-values": "^1.3.0",
"postcss-pxtransform": "1.2.26",
"postcss-pxtransform": "1.2.27-beta.0",
"postcss-reporter": "^6.0.1",
"postcss-taro-unit-transform": "1.2.15",
"postcss-url": "^7.3.2",
Expand All @@ -74,8 +74,8 @@
"semver": "^5.5.0",
"shelljs": "^0.8.1",
"stylelint": "^9.10.1",
"stylelint-config-taro-rn": "1.2.26",
"stylelint-taro-rn": "1.2.26",
"stylelint-config-taro-rn": "1.2.27-beta.0",
"stylelint-taro-rn": "1.2.27-beta.0",
"through2": "^2.0.3",
"vinyl": "^2.1.0",
"vinyl-fs": "^3.0.2"
Expand Down
54 changes: 18 additions & 36 deletions packages/taro-cli/src/weapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,34 +447,8 @@ function parseAst (type, ast, depComponents, sourceFilePath, filePath, npmSkip =
filePath: styleFilePath
})
const tokens = result.root.exports || {}
const objectPropperties = []
for (const key in tokens) {
if (tokens.hasOwnProperty(key)) {
let keyPath = key
if (key.indexOf('-') >= 0) {
keyPath = `'${key}'`
}
objectPropperties.push(t.objectProperty(t.identifier(keyPath), t.stringLiteral(tokens[key])))
}
}
let defaultDeclator = null
let normalDeclator = null
let importItems = []
specifiers.forEach(s => {
if (t.isImportDefaultSpecifier(s)) {
defaultDeclator = [t.variableDeclarator(t.identifier(s.local.name), t.objectExpression(objectPropperties))]
} else {
importItems.push(t.objectProperty(t.identifier(s.local.name), t.identifier(s.local.name)))
}
})
normalDeclator = [t.variableDeclarator(t.objectPattern(importItems), t.objectExpression(objectPropperties))]
if (defaultDeclator) {
astPath.insertBefore(t.variableDeclaration('const', defaultDeclator))
}
if (normalDeclator) {
astPath.insertBefore(t.variableDeclaration('const', normalDeclator))
}
astPath.remove()
const cssModuleMapFile = createCssModuleMap(styleFilePath, tokens)
astPath.node.source = t.stringLiteral(astPath.node.source.value.replace(path.basename(styleFilePath), path.basename(cssModuleMapFile)))
if (styleFiles.indexOf(styleFilePath) < 0) { // add this css file to queue
styleFiles.push(styleFilePath)
}
Expand Down Expand Up @@ -553,13 +527,8 @@ function parseAst (type, ast, depComponents, sourceFilePath, filePath, npmSkip =
filePath: styleFilePath
})
const tokens = result.root.exports || {}
const objectPropperties = []
for (const key in tokens) {
if (tokens.hasOwnProperty(key)) {
objectPropperties.push(t.objectProperty(t.identifier(key), t.stringLiteral(tokens[key])))
}
}
astPath.replaceWith(t.objectExpression(objectPropperties))
const cssModuleMapFile = createCssModuleMap(styleFilePath, tokens)
astPath.node.arguments = [t.stringLiteral(astPath.node.arguments[0].value.replace(path.basename(styleFilePath), path.basename(cssModuleMapFile)))]
if (styleFiles.indexOf(styleFilePath) < 0) { // add this css file to queue
styleFiles.push(styleFilePath)
}
Expand Down Expand Up @@ -1507,6 +1476,15 @@ function processStyleUseCssModule (styleObj) {
return result
}

function createCssModuleMap (styleFilePath, tokens) {
const cssModuleMapFilename = path.basename(styleFilePath) + '.map.js'
const cssModuleMapFile = path.join(path.dirname(styleFilePath), cssModuleMapFilename).replace(sourceDir, outputDir)
Util.printLog(Util.pocessTypeEnum.GENERATE, 'CSS Modules map', cssModuleMapFile)
fs.ensureDirSync(path.dirname(cssModuleMapFile))
fs.writeFileSync(cssModuleMapFile, `module.exports = ${JSON.stringify(tokens, null, 2)};\n`)
return cssModuleMapFile
}

async function processStyleWithPostCSS (styleObj) {
const useModuleConf = weappConf.module || {}
const customPostcssConf = useModuleConf.postcss || {}
Expand Down Expand Up @@ -1572,7 +1550,11 @@ async function processStyleWithPostCSS (styleObj) {
})
let css = styleObj.css
if (customCssModulesConf.enable) {
css = processStyleUseCssModule(styleObj).css
const result = processStyleUseCssModule(styleObj)
css = result.css
if (result.root && result.root.exports) {
createCssModuleMap(styleObj.filePath, result.root.exports || {})
}
}
const postcssResult = await postcss(processors).process(css, {
from: styleObj.filePath
Expand Down
3 changes: 0 additions & 3 deletions packages/taro-components-rn/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ node_modules
.vs_code
.idea

# expo
.expo/

# build
dist
build
Expand Down
3 changes: 3 additions & 0 deletions packages/taro-components-rn/TCRNExample/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["react-native"]
}
6 changes: 6 additions & 0 deletions packages/taro-components-rn/TCRNExample/.buckconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

[android]
target = Google Inc.:Google APIs:23

[maven_repositories]
central = https://repo1.maven.org/maven2
Loading

0 comments on commit e1850a3

Please sign in to comment.