babel-preset-taro 3.4.0-beta.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -161,10 +161,13 @@ module.exports = (_, options = {}) => {
161
161
  packageName: '@tarojs/taro',
162
162
  apis
163
163
  }])
164
- } else {
164
+ }
165
+ if (options['dynamic-import-node'] || process.env.TARO_ENV !== 'h5') {
165
166
  plugins.push([require('babel-plugin-dynamic-import-node')])
166
167
  }
167
168
 
169
+ plugins.push(require('./remove-define-config'))
170
+
168
171
  return {
169
172
  sourceType: 'unambiguous',
170
173
  overrides: [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babel-preset-taro",
3
- "version": "3.4.0-beta.0",
3
+ "version": "3.4.0",
4
4
  "description": "> TODO: description",
5
5
  "author": "yuche <i@yuche.me>",
6
6
  "homepage": "https://github.com/nervjs/taro/tree/master/packages/babel-preset-taro#readme",
@@ -8,6 +8,7 @@
8
8
  "main": "index.js",
9
9
  "files": [
10
10
  "rn/",
11
+ "remove-define-config.js",
11
12
  "index.js"
12
13
  ],
13
14
  "repository": {
@@ -35,22 +36,20 @@
35
36
  "@babel/runtime": "^7.14.5",
36
37
  "@babel/runtime-corejs3": "^7.14.5",
37
38
  "@prefresh/babel-plugin": "^0.4.1",
38
- "@tarojs/helper": "3.4.0-beta.0",
39
- "@tarojs/taro-h5": "3.4.0-beta.0",
39
+ "@tarojs/helper": "3.4.0",
40
+ "@tarojs/taro-h5": "3.4.0",
41
+ "@tarojs/taro-rn": "3.4.0",
40
42
  "@vue/babel-plugin-jsx": "^1.0.6",
41
43
  "@vue/babel-preset-jsx": "^1.2.4",
42
44
  "babel-plugin-dynamic-import-node": "2.3.3",
43
45
  "babel-plugin-global-define": "1.0.3",
44
46
  "babel-plugin-jsx-attributes-array-to-object": "0.3.0",
45
47
  "babel-plugin-transform-imports-api": "1.0.0",
46
- "babel-plugin-transform-react-jsx-to-rn-stylesheet": "3.4.0-beta.0",
47
- "babel-plugin-transform-taroapi": "3.4.0-beta.0",
48
+ "babel-plugin-transform-react-jsx-to-rn-stylesheet": "3.4.0",
49
+ "babel-plugin-transform-taroapi": "3.4.0",
48
50
  "core-js": "^3.6.5",
49
51
  "metro-react-native-babel-preset": "^0.66.2",
50
52
  "react-refresh": "0.9.0"
51
53
  },
52
- "devDependencies": {
53
- "@tarojs/taro-rn": "3.4.0-beta.0"
54
- },
55
- "gitHead": "107670bc2360ee9136a0e558e6d5fad1db640fba"
54
+ "gitHead": "a0e97bc937f878cc059f54748c9a3829fa3f4664"
56
55
  }
@@ -0,0 +1,18 @@
1
+ module.exports = function pluginRemovePageConfig (babel) {
2
+ const { types: t } = babel
3
+
4
+ return {
5
+ name: 'plugin:remove_pageconfig',
6
+ visitor: {
7
+ CallExpression (nodePath, state) {
8
+ if (!/src/.test(state.filename)) return
9
+ if (/\.config\.(t|j)sx?$/.test(state.filename)) return
10
+
11
+ const { callee } = nodePath.node
12
+ if (!t.isIdentifier(callee, { name: 'definePageConfig' })) return
13
+
14
+ nodePath.remove()
15
+ }
16
+ }
17
+ }
18
+ }