Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taro 3.1 #8731

Merged
merged 141 commits into from
Feb 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
22c5b28
chore(cli): 各小程序平台插件拆为单独的包
Chen-jj Sep 15, 2020
875a7e3
chore(shared): 抽取出小程序平台插件的基类,放在 shared 包里
Chen-jj Sep 15, 2020
b336303
chore(shared): 拆解出所有小程序共有的组件及其属性列表,且可被外部修改
Chen-jj Sep 15, 2020
1516f88
chore(components): 此包的React组件入口精简出公共组件,可由外部插件拓展
Chen-jj Sep 15, 2020
4c3a660
chore(mini-runner): 修改 options 参数
Chen-jj Sep 15, 2020
4525715
chore(taro-weapp): 分离出 weapp 平台插件
Chen-jj Sep 15, 2020
13f55aa
chore(taro-weapp): 分离出 tt 平台插件
Chen-jj Sep 15, 2020
e9f47d9
chore(taro-weapp): 分离出 swan 平台插件
Chen-jj Sep 15, 2020
12d35bb
chore(taro-weapp): 分离出 qq 平台插件
Chen-jj Sep 15, 2020
787b6a1
chore(taro-weapp): 分离出 jd 平台插件
Chen-jj Sep 15, 2020
cc22115
chore(taro-weapp): 分离出 alipay 平台插件
Chen-jj Sep 15, 2020
6f4124b
chore(taro): 合并 @tarojs/taro 与 @tarojs/api
Chen-jj Sep 16, 2020
d0f11c6
chore(h5): 重构 @tarojs/h5 的打包方式
Chen-jj Sep 16, 2020
86f6657
chore(loader/platform/mini-runner): 解藕平台 API
Chen-jj Sep 21, 2020
5b2a0a1
chore(runtime): 分离 runtime 耦合逻辑到个小程序插件包中
Chen-jj Sep 22, 2020
1819da4
feat(alipay): 支付宝小程序支持引用自定义组件
Chen-jj Sep 22, 2020
b3254ce
chore(runtime/mini-runner/react): 优化打包方式
Chen-jj Sep 23, 2020
2799db0
chore(weapp/qq): 微信/ qq 平台插件使用 rollup 打包
Chen-jj Sep 23, 2020
a24216d
chore(alipay): 调整 alipay 的打包方式
Chen-jj Sep 23, 2020
616067a
chore(swan): 调整 swan 的打包方式
Chen-jj Sep 23, 2020
f70a5b9
chore(tt): 调整 tt 的打包方式
Chen-jj Sep 23, 2020
34a32fe
chore(jd): 调整 jd 的打包方式
Chen-jj Sep 23, 2020
35bfaa0
chore(taro): 调整 taro 包对 runtime 包的引用
Chen-jj Sep 23, 2020
c284c32
chore(release): publish 3.1.0-alpha.0
Chen-jj Sep 24, 2020
58c5afb
chore(release): publish 3.1.0-alpha.0
Chen-jj Sep 24, 2020
4ead1d8
fix(platform): 同步 3.0 修改
Chen-jj Sep 24, 2020
b7eda4e
chore(deps): 清除循环依赖
Chen-jj Sep 24, 2020
6f35bf5
chore(release): publish 3.1.0-alpha.0
Chen-jj Sep 24, 2020
659da39
chore(release): publish 3.1.0-alpha.0
Chen-jj Sep 24, 2020
943f19c
chore(release): publish 3.1.0-alpha.0
Chen-jj Sep 24, 2020
4a55ffd
chore(cli): 修复 CLI 测试用例
Chen-jj Sep 25, 2020
49f451c
fix(platforms): 修复循环依赖问题
Chen-jj Sep 25, 2020
61c6a06
chore(cli): 修复 CLI 测试用例
Chen-jj Oct 9, 2020
ea708a1
chore(release): publish 3.1.0-alpha.0
Chen-jj Oct 9, 2020
ea1acca
chore(release): publish 3.1.0-alpha.1
Chen-jj Oct 9, 2020
9d23bff
chore(mini-runner): 扩大@tarojs/components的查找范围
Chen-jj Oct 10, 2020
8dc15a7
chore(taro): 更改 taro、taro-api、taro-h5 打包方式
Chen-jj Oct 12, 2020
dfc2a2e
chore(release): publish 3.1.0-alpha.2
Chen-jj Oct 12, 2020
7f6f732
fix(alipay/weapp): 修复 Map 组件
Chen-jj Oct 15, 2020
a37d7bc
chore(shared): 修改组件合并方式
Chen-jj Oct 21, 2020
7d3399b
fix(platform): 同步 3.0 修改
Chen-jj Oct 23, 2020
a90a5bb
chore(weapp): 把 editor 需要创建 focus 模板的逻辑放入插件中
Chen-jj Oct 26, 2020
f2d5e8d
chore(release): publish 3.1.0-beta.0
Chen-jj Oct 26, 2020
3e1964a
chore(webpack-runner): 测试用例移入源码目录
Chen-jj Oct 27, 2020
b4a461d
fix(mini-runner): 修复测试用例
Chen-jj Oct 27, 2020
cbc3c01
fix: ci
Chen-jj Oct 28, 2020
d7f9e13
fix: ci
Chen-jj Oct 28, 2020
113cbcc
fix(cli): 修复 vue 不能渲染平台新增的组件模板的问题
Chen-jj Oct 28, 2020
85015cf
fix: ci
Chen-jj Oct 28, 2020
533bae3
fix(runtime): 修复 Vue2 入口组件生命周期多次触发的问题,#7179
Chen-jj Oct 28, 2020
e26ab55
fix(mini-runner): 修复多端文件没按extension解析的问题,fix #6786
Chen-jj Oct 29, 2020
4159d79
fix(loader): 修复分享 API 在使用 redux 时无法生效的问题,fix #7232
Chen-jj Nov 2, 2020
649a5e5
Merge remote-tracking branch 'origin/next' into chore/mini-program
Chen-jj Nov 6, 2020
42b6a09
fix(runtime): 同步3.0修改
Chen-jj Nov 7, 2020
98da09d
fix(router): 支持 H5 路由 404 时触发 App.onPageNotFound, fix #7474
Chen-jj Nov 7, 2020
f7259cf
fix: ci
Chen-jj Nov 7, 2020
354ceaa
feat(mini): 组件 View 增加 catch move 属性,解决滚动穿透问题。
Chen-jj Nov 8, 2020
7ce7766
chore(release): publish 3.1.0-beta.1
Chen-jj Nov 8, 2020
3a1531f
fix(cli): 可以运行 taro convert 命令
Chen-jj Nov 10, 2020
d79b063
fix(taro-with-weapp): 修复 convert 一些问题
Chen-jj Nov 13, 2020
4c76f94
fix(shared): 同步 3.0 修改
Chen-jj Nov 16, 2020
93f5ce5
fix: ci
Chen-jj Nov 17, 2020
eb7d069
fix(convert): 修复反向转换没有处理样式中字体文件的问题,fix #3444
Chen-jj Nov 17, 2020
a8a1f86
fix(taroize): 支持 catch 事件
Chen-jj Nov 17, 2020
cc6de1c
fix(taroize): 兼容自定义 tabbar
Chen-jj Nov 17, 2020
018263b
fix(taroize): 修复 include 缓存问题
Chen-jj Nov 18, 2020
e44c09c
fix(taroize): 完善 template 传递 data 的语法支持程度
Chen-jj Nov 18, 2020
96a5a3b
fix(taroize): 修复反向转换的一些问题
Chen-jj Nov 19, 2020
d6e8cc2
chore(release): publish 3.1.0-beta.2
Chen-jj Nov 20, 2020
80f4cf4
chore(release): publish 3.1.0-beta.2
Chen-jj Nov 20, 2020
d6d81f8
chore(release): publish 3.1.0-beta.2
Chen-jj Nov 20, 2020
4403e45
fix(with-weapp): 修复 buble 打包的类不能被 babel 类成功继承的问题
Chen-jj Nov 23, 2020
c09d799
fix(taroize): 补全微信内置组件
Chen-jj Nov 23, 2020
41391b4
fix(taroize): 修复问题
Chen-jj Nov 23, 2020
f7e2cd9
fix(taroize): 反向转换支持配置全局 usingComponents
Chen-jj Nov 24, 2020
9d7c282
feat(taroize): 反向转换支持 behavior, #5873
Chen-jj Nov 24, 2020
22f09a8
fix(with-weapp): 修复 App.onShow 获取不到路由参数的问题
Chen-jj Nov 25, 2020
b7c2e7c
fix(taroize): 自动处理循环的 key 值
Chen-jj Nov 25, 2020
f0e7dc3
fix(taroize): 修复 taroize 一些问题
Chen-jj Nov 27, 2020
2b548ed
chore(release): publish 3.1.0-beta.3
Chen-jj Nov 27, 2020
084edc9
fix(components): 同步小程序组件属性
Chen-jj Dec 14, 2020
26812a3
Merge remote-tracking branch 'origin/next' into chore/mini-program
Chen-jj Dec 14, 2020
4a86bc4
feat(weapp): 让微信小程序可以自定义project.config.json文件的源文件名
Chen-jj Dec 14, 2020
356215a
fix: ci
Chen-jj Dec 14, 2020
53e1c66
chore(release): publish 3.1.0-beta.4
Chen-jj Dec 14, 2020
9b3bce5
chore(release): publish 3.1.0-beta.4
Chen-jj Dec 14, 2020
8399d5b
refactor(with-weapp): 重构 app 挂载额外属性的方式
Chen-jj Jan 8, 2021
988e1f3
Merge branch 'next' into chore/mini-program
Chen-jj Jan 25, 2021
a03b488
fix: ci
Chen-jj Jan 25, 2021
7d65185
chore(weapp): 按钮组件增加 business-id 属性,fix #8342
Chen-jj Jan 25, 2021
79e1901
chore(components/qq): 补全 types,close #8346
Chen-jj Jan 25, 2021
7a2b9dc
feat(alipay): 增加 life-follow 组件,fix #8277
Chen-jj Jan 25, 2021
58de7bd
feat(weapp): 补全LivePusher,LivePlayer 的属性,fix #8363
Chen-jj Jan 26, 2021
38bba62
chore(cli): 更新默认模板 Vue2 的入口文件,fix #8546
Chen-jj Jan 26, 2021
7d5f5c4
fix(components): 修复表单组件 slot 兼容问题,fix #7363
Chen-jj Jan 27, 2021
5c70952
fix: ci
Chen-jj Jan 27, 2021
8b1bbe7
fix(components): 修复 view 和 text 组件多行截断样式失败问题
Chen-jj Jan 27, 2021
2b082da
feat(alipay): 支持 input 标签的 enableNative 属性,fix #7226
Chen-jj Jan 28, 2021
c3e1a5f
Merge branch 'next' into chore/mini-program
Chen-jj Jan 28, 2021
e61b204
Merge remote-tracking branch 'origin/next' into chore/mini-program
Chen-jj Jan 28, 2021
7e2f546
fix(components): h5组件的 style 支持设置 css 变量,fix #7452
Chen-jj Jan 28, 2021
3942f29
fix: ci
Chen-jj Jan 28, 2021
bbb70e7
fix: ci
Chen-jj Jan 29, 2021
417ebf2
Merge remote-tracking branch 'origin/next' into chore/mini-program
Chen-jj Jan 29, 2021
571ff27
chore(release): publish 3.1.0-beta.5
Chen-jj Jan 29, 2021
667c12a
chore(weapp/swan/alipay): 简化 components-react 的导出
Chen-jj Feb 1, 2021
bd5f061
fix(mini-runner): 修复支付宝编译问题
Chen-jj Feb 1, 2021
de998af
refactor(platform): 重构端平台插件编译时写法
Chen-jj Feb 1, 2021
65fbe2c
refactor(platform): 重构端平台插件运行时注入 API 的写法
Chen-jj Feb 2, 2021
3ee63f9
fix: ci
Chen-jj Feb 2, 2021
b633941
fix(loader): 修复百度小程序渲染问题,#7293
Chen-jj Feb 2, 2021
1ec0a1e
refactor(platform): 增加端编译平台中间层钩子
Chen-jj Feb 7, 2021
97be38e
refactor(shared): 改造模板生成规则,让第三方组件也能被控制是否循环渲染
Chen-jj Feb 7, 2021
48a8c8f
fix: ci
Chen-jj Feb 8, 2021
d47bb7e
fix: ci
Chen-jj Feb 8, 2021
3918cd9
chore(release): publish 3.1.0-beta.6
Chen-jj Feb 8, 2021
0f19564
Merge remote-tracking branch 'origin/next' into chore/mini-program
Chen-jj Feb 9, 2021
c6de0c4
chore(alipay): 增加工具函数的导出
Chen-jj Feb 10, 2021
a94c8e0
fix(swan): 修复百度没有正确生成项目配置的问题
Chen-jj Feb 10, 2021
bffca5c
chore(release): publish 3.1.0-beta.7
Chen-jj Feb 10, 2021
9cf583e
fix(weapp): 提供 Taro.sendBizRedPacket API 支持 ,fix #8686
Chen-jj Feb 19, 2021
899ad37
fix(components): 修复 style 设置失败的问题,fix #8678
Chen-jj Feb 19, 2021
d2a1bc9
feat(h5): 支持 React fast-refresh,fix #7291
Chen-jj Feb 21, 2021
da8a3e4
chore(release): publish 3.1.0-beta.8
Chen-jj Feb 21, 2021
cfcb583
fix(h5): fast-refresh 可以取消
Chen-jj Feb 21, 2021
d9f384c
fix: ci
Chen-jj Feb 21, 2021
3bd4acc
chore(release): publish 3.1.0-beta.9
Chen-jj Feb 21, 2021
0531429
feat: 支持 React 17
Chen-jj Feb 22, 2021
0582f0b
chore(release): publish 3.1.0-beta.10
Chen-jj Feb 22, 2021
d988608
fix: ci
Chen-jj Feb 22, 2021
0f2caef
fix: ci
Chen-jj Feb 22, 2021
533f1b1
chore(release): publish 3.1.0-beta.10
Chen-jj Feb 22, 2021
f28cf44
fix(mini-runner): 修复小程序编译失败的问题
Chen-jj Feb 22, 2021
4c5fb26
feat: 支持 TypeScript 4.1
Chen-jj Feb 22, 2021
04c729e
chore: 项目升级 ts 4.1,修复 lint 错误
Chen-jj Feb 23, 2021
38673a6
fix: ci
Chen-jj Feb 23, 2021
99fd286
Merge branch 'next' into chore/mini-program
Chen-jj Feb 23, 2021
674ea5e
chore(release): publish 3.1.0-beta.11
Chen-jj Feb 23, 2021
451a28d
fix(runtime): 修复H5使用类组件刷新时报错的问题。
Chen-jj Feb 23, 2021
c267197
chore(release): publish 3.1.0-beta.11
Chen-jj Feb 23, 2021
eb494e1
chore(release): publish 3.1.0
Chen-jj Feb 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 8 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@ packages/taro-transformer-wx/tt.js
packages/taro-transformer-wx/t.js
packages/taro-cli/src/jdreact/template/*.js
packages/taro-cli/templates
/packages/taro-components/loader
packages/taro-cli/src/rn
packages/taro-components/loader
packages/taro-webpack-runner/src/__tests__/__snapshots__
packages/taro-webpack-runner/src/__tests__/fixtures
packages/taro-mini-runner/src/__tests__/__snapshots__
packages/taro-mini-runner/src/__tests__/fixtures
packages/taro-cli/src/__tests__/fixtures
packages/taro/types
packages/taro-components-rn
packages/taro-rn
packages/taro-rn-runner
packages/taro-router-rn
packages/taro-mini-runner/src/quickapp
7 changes: 5 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,24 @@ module.exports = {
'plugin:react/recommended'
],
'rules': {
'no-use-before-define': 0,
'no-unused-vars': 'off',
'camelcase': 0,
'@typescript-eslint/explicit-function-return-type': 0,
"indent": "off",
'@typescript-eslint/indent': ['error', 2],
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_', 'args': 'after-used', }],
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/no-use-before-define': 0,
'@typescript-eslint/no-use-before-define': ['warn', { 'functions': false, 'classes': false }],
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/interface-name-prefix': 0,
'@typescript-eslint/member-delimiter-style': 0,
'@typescript-eslint/camelcase': 0,
'@typescript-eslint/no-namespace': 0,
'@typescript-eslint/ban-ts-comment': 0,
'standard/no-callback-literal': 0,
'no-console': ['error', { allow: ['warn', 'error'] }],
'prefer-spread': 0,
Expand All @@ -30,7 +33,7 @@ module.exports = {
'react/jsx-uses-vars': 'warn',
'react/prop-types': 0,
'react/no-find-dom-node': 0,
'no-unused-expressions': 0
'no-unused-expressions': 0,
// 'camelcase': ['error', {allow: ['^internal_', '^unstable_']}]
},
'env': {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest

strategy:
fail-fast: false
fail-fast: false
matrix:
node-version: [12.x, 13.x, 14.x]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
- name: Publish
if: steps.tag_check.outputs.exists_tag == 'false' && startsWith( env.commitmsg , 'chore(release):' )
run: |
yarn lerna publish from-package --yes
yarn lerna publish from-package --yes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export default {
</script>
```


### 多端转换支持

Taro 方案的初心就是为了打造一个多端开发的解决方案。
Expand Down
10 changes: 8 additions & 2 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@
"packages/taro-service",
"packages/taro-webpack-runner",
"packages/taro-with-weapp",
"packages/taroize"
"packages/taroize",
"packages/taro-weapp",
"packages/taro-alipay",
"packages/taro-swan",
"packages/taro-tt",
"packages/taro-qq",
"packages/taro-jd"
],
"command": {
"publish": {
Expand All @@ -35,6 +41,6 @@
"license": "MIT"
}
},
"version": "3.0.28",
"version": "3.1.0",
"npmClient": "yarn"
}
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"release:lerna": "lerna version --exact --no-git-tag-version",
"release:beta": "lerna publish --force-publish=* --exact --skip-temp-tag --preid=beta --npm-tag=beta",
"release": "npm-run-all build release:lerna && npm run changelog && node ./build/docs-version.js",
"test": "lerna run --parallel --scope babel-preset-taro --scope @tarojs/components --scope @tarojs/loader --scope @tarojs/react --scope @tarojs/webpack-runner --scope @tarojs/mini-runner --scope @tarojs/runtime test:ci"
"test": "lerna run --scope @tarojs/cli --scope babel-preset-taro --scope @tarojs/components --scope @tarojs/loader --scope @tarojs/react --scope @tarojs/webpack-runner --scope @tarojs/mini-runner --scope @tarojs/runtime test:ci"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -53,14 +53,15 @@
"@babel/plugin-proposal-do-expressions": "7.10.4",
"@babel/plugin-proposal-object-rest-spread": "7.11.0",
"@babel/plugin-syntax-dynamic-import": "7.8.3",
"@babel/plugin-transform-react-jsx": "7.10.4",
"@babel/plugin-transform-react-jsx": "7.12.17",
"@babel/plugin-transform-runtime": "7.11.0",
"@babel/preset-env": "7.11.0",
"@babel/preset-react": "7.10.4",
"@babel/preset-typescript": "7.10.4",
"@babel/preset-react": "7.12.13",
"@babel/preset-typescript": "7.12.17",
"@commitlint/cli": "^7.2.1",
"@commitlint/config-conventional": "^9.0.1",
"@rollup/plugin-replace": "^2.2.0",
"@rollup/plugin-babel": "5.2.1",
"@types/babel-generator": "^6.25.3",
"@types/babel-traverse": "^6.25.5",
"@types/babel-types": "^7.0.7",
Expand All @@ -74,8 +75,8 @@
"@types/sinon": "^7.5.0",
"@types/tapable": "1.0.5",
"@types/webpack": "^4.39.3",
"@typescript-eslint/eslint-plugin": "^2.23.0",
"@typescript-eslint/parser": "^2.23.0",
"@typescript-eslint/eslint-plugin": "^4.15.1",
"@typescript-eslint/parser": "^4.15.1",
"@vue/compiler-core": "^3.0.0-beta.14",
"@vue/runtime-core": "^3.0.0-beta.14",
"@vue/runtime-dom": "^3.0.0-beta.14",
Expand All @@ -102,7 +103,7 @@
"eslint-loader": "^2.0.0",
"eslint-plugin-flowtype": "^3.2.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^22.17.0",
"eslint-plugin-jest": "24.1.5",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-promise": "^4.2.1",
Expand Down Expand Up @@ -131,11 +132,11 @@
"ora": "^2.1.0",
"power-assert": "^1.6.1",
"prettier": "^1.18.2",
"react": "^16.10.2",
"react-dom": "^16.10.2",
"react": "^17.0.0",
"react-dom": "^17.0.0",
"react-native": "^0.61.2",
"react-native-mock-render": "^0.1.5",
"react-test-renderer": "^16.10.2",
"react-test-renderer": "^17.0.0",
"redux": "^4.0.4",
"rimraf": "^2.6.2",
"rollup": "^1.23.1",
Expand All @@ -153,7 +154,7 @@
"style-loader": "^0.20.3",
"stylelint": "^13.6.1",
"ts-jest": "26.4.0",
"typescript": "^3.8.3",
"typescript": "^4.1.0",
"vue": "^2.6.11",
"vue-loader": "^15.9.3",
"vue-template-compiler": "^2.6.11",
Expand Down
2 changes: 1 addition & 1 deletion 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": "3.0.28",
"version": "3.1.0",
"main": "dist/index.js",
"scripts": {
"build": "tsc"
Expand Down
6 changes: 0 additions & 6 deletions packages/babel-preset-taro/__tests__/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ describe('babel-preset-taro', () => {
})

expect(config.sourceType).toBe('unambiguous')

const [override] = config.overrides

const [, [_, reactConfig]] = override.presets
expect(reactConfig.pragma).toBe('React.createElement')
expect(reactConfig.pragmaFrag).toBe('React.Fragment')
})

it('vue', () => {
Expand Down
11 changes: 10 additions & 1 deletion packages/babel-preset-taro/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,22 @@ module.exports = (_, options = {}) => {
const isVue3 = options.framework === 'vue3'
const moduleName = options.framework.charAt(0).toUpperCase() + options.framework.slice(1)

if (isNerv || isReact) {
if (isNerv) {
presets.push([require('@babel/preset-react'), {
pragma: `${moduleName}.createElement`,
pragmaFrag: `${moduleName}.Fragment`
}])
}

if (isReact) {
presets.push([require('@babel/preset-react'), {
runtime: options.reactJsxRuntime || 'automatic'
}])
if (process.env.TARO_ENV === 'h5' && process.env.NODE_ENV !== 'production' && options.hot !== false) {
plugins.push([require('react-refresh/babel')])
}
}

if (options.ts) {
const config = {}
if (isNerv || isReact) {
Expand Down
13 changes: 7 additions & 6 deletions packages/babel-preset-taro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-preset-taro",
"version": "3.0.28",
"version": "3.1.0",
"description": "> TODO: description",
"author": "yuche <i@yuche.me>",
"homepage": "https://github.com/nervjs/taro/tree/master/packages/babel-preset-taro#readme",
Expand Down Expand Up @@ -30,12 +30,13 @@
"@babel/plugin-syntax-jsx": "^7.10.4",
"@babel/plugin-transform-runtime": "7.11.0",
"@babel/preset-env": "7.11.0",
"@babel/preset-react": "7.10.4",
"@babel/preset-typescript": "7.10.4",
"@babel/preset-react": "7.12.13",
"@babel/preset-typescript": "7.12.17",
"@babel/runtime": "^7.11.2",
"@tarojs/taro-h5": "3.0.28",
"@tarojs/taro-h5": "3.1.0",
"babel-plugin-dynamic-import-node": "^2.3.3",
"babel-plugin-transform-taroapi": "3.0.28",
"core-js": "^3.6.5"
"babel-plugin-transform-taroapi": "3.1.0",
"core-js": "^3.6.5",
"react-refresh": "0.9.0"
}
}
Loading