babel-preset-taro 3.3.16 → 3.4.0-beta.1

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.
Files changed (2) hide show
  1. package/index.js +13 -3
  2. package/package.json +21 -20
package/index.js CHANGED
@@ -9,7 +9,7 @@ module.exports = (_, options = {}) => {
9
9
  const presets = []
10
10
  const plugins = []
11
11
  const overrides = []
12
- const isReact = options.framework === 'react'
12
+ const isReact = options.framework === 'react' || options.framework === 'preact'
13
13
  const isNerv = options.framework === 'nerv'
14
14
  const isVue = options.framework === 'vue'
15
15
  const isVue3 = options.framework === 'vue3'
@@ -27,7 +27,14 @@ module.exports = (_, options = {}) => {
27
27
  runtime: options.reactJsxRuntime || 'automatic'
28
28
  }])
29
29
  if (process.env.TARO_ENV === 'h5' && process.env.NODE_ENV !== 'production' && options.hot !== false) {
30
- plugins.push([require('react-refresh/babel')])
30
+ if (options.framework === 'react') {
31
+ plugins.push([require('react-refresh/babel')])
32
+ } else if (options.framework === 'preact') {
33
+ overrides.push({
34
+ include: /\.[jt]sx$/,
35
+ plugins: [require('@prefresh/babel-plugin')]
36
+ })
37
+ }
31
38
  }
32
39
  }
33
40
 
@@ -154,10 +161,13 @@ module.exports = (_, options = {}) => {
154
161
  packageName: '@tarojs/taro',
155
162
  apis
156
163
  }])
157
- } else {
164
+ }
165
+ if (options['dynamic-import-node'] || process.env.TARO_ENV !== 'h5') {
158
166
  plugins.push([require('babel-plugin-dynamic-import-node')])
159
167
  }
160
168
 
169
+ plugins.push(require('./remove-define-config'))
170
+
161
171
  return {
162
172
  sourceType: 'unambiguous',
163
173
  overrides: [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babel-preset-taro",
3
- "version": "3.3.16",
3
+ "version": "3.4.0-beta.1",
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",
@@ -25,31 +25,32 @@
25
25
  "@babel/core": "*"
26
26
  },
27
27
  "dependencies": {
28
- "@babel/plugin-proposal-class-properties": "7.10.4",
29
- "@babel/plugin-proposal-decorators": "7.10.5",
30
- "@babel/plugin-syntax-jsx": "^7.10.4",
31
- "@babel/plugin-transform-runtime": "7.11.0",
32
- "@babel/preset-env": "^7.11.0",
33
- "@babel/preset-react": "7.12.13",
34
- "@babel/preset-typescript": "7.12.17",
35
- "@babel/runtime": "^7.11.2",
36
- "@babel/runtime-corejs3": "^7.14.8",
37
- "@tarojs/helper": "3.3.16",
38
- "@tarojs/taro-h5": "3.3.16",
28
+ "@babel/plugin-proposal-class-properties": "^7.14.5",
29
+ "@babel/plugin-proposal-decorators": "^7.14.5",
30
+ "@babel/plugin-syntax-jsx": "^7.14.5",
31
+ "@babel/plugin-transform-runtime": "^7.14.5",
32
+ "@babel/preset-env": "^7.14.5",
33
+ "@babel/preset-react": "^7.14.5",
34
+ "@babel/preset-typescript": "^7.14.5",
35
+ "@babel/runtime": "^7.14.5",
36
+ "@babel/runtime-corejs3": "^7.14.5",
37
+ "@prefresh/babel-plugin": "^0.4.1",
38
+ "@tarojs/helper": "3.4.0-beta.1",
39
+ "@tarojs/taro-h5": "3.4.0-beta.1",
39
40
  "@vue/babel-plugin-jsx": "^1.0.6",
40
41
  "@vue/babel-preset-jsx": "^1.2.4",
41
- "babel-plugin-dynamic-import-node": "^2.3.3",
42
- "babel-plugin-global-define": "^1.0.3",
43
- "babel-plugin-jsx-attributes-array-to-object": "^0.3.0",
44
- "babel-plugin-transform-imports-api": "^1.0.0",
45
- "babel-plugin-transform-react-jsx-to-rn-stylesheet": "3.3.16",
46
- "babel-plugin-transform-taroapi": "3.3.16",
42
+ "babel-plugin-dynamic-import-node": "2.3.3",
43
+ "babel-plugin-global-define": "1.0.3",
44
+ "babel-plugin-jsx-attributes-array-to-object": "0.3.0",
45
+ "babel-plugin-transform-imports-api": "1.0.0",
46
+ "babel-plugin-transform-react-jsx-to-rn-stylesheet": "3.4.0-beta.1",
47
+ "babel-plugin-transform-taroapi": "3.4.0-beta.1",
47
48
  "core-js": "^3.6.5",
48
49
  "metro-react-native-babel-preset": "^0.66.2",
49
50
  "react-refresh": "0.9.0"
50
51
  },
51
52
  "devDependencies": {
52
- "@tarojs/taro-rn": "3.3.16"
53
+ "@tarojs/taro-rn": "3.4.0-beta.1"
53
54
  },
54
- "gitHead": "75d3de695c98fab79998612ef87567a68ea981a7"
55
+ "gitHead": "bd7b3674278d22f71e2658b530cc0be24bf9964e"
55
56
  }