babel-preset-taro 3.6.2 → 3.6.4

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/LICENSE CHANGED
@@ -137,3 +137,24 @@ MIT (miniprogram-render):
137
137
  The following files embed [miniprogram-render](https://github.com/Tencent/kbone) MIT:
138
138
  `/packages/taro-plugin-http/src/runtime/Cookie.ts`
139
139
  See `/LICENSE` for details of the license.
140
+
141
+ ==================
142
+
143
+ MIT (stencil-ds-output-targets):
144
+ The following files embed [stencil-ds-output-targets](https://github.com/ionic-team/stencil-ds-output-targets/) MIT:
145
+ `/packages/taro-components-library-react/src/react-component-lib/utils/attachProps.ts`
146
+ `/packages/taro-components-library-react/src/react-component-lib/utils/case.ts`
147
+ `/packages/taro-components-library-react/src/react-component-lib/utils/dev.ts`
148
+ `/packages/taro-components-library-react/src/react-component-lib/utils/index.tsx`
149
+ `/packages/taro-components-library-react/src/react-component-lib/createComponent.tsx`
150
+ `/packages/taro-components-library-react/src/react-component-lib/createOverlayComponent.tsx`
151
+ `/packages/taro-components-library-react/src/react-component-lib/interfaces.ts`
152
+ `/packages/taro-components-library-vue3/src/vue-component-lib/utils.ts`
153
+ See `/LICENSE` for details of the license.
154
+
155
+ ==================
156
+
157
+ MIT (stencil-vue2-output-target):
158
+ The following files embed [stencil-vue2-output-target](https://github.com/diondree/stencil-vue2-output-target) MIT:
159
+ `/packages/taro-components-library-vue2/src/vue-component-lib/utils.ts`
160
+ See `/LICENSE` for details of the license.
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const path = require('path')
2
- const fs = require('fs')
3
2
 
4
3
  function hasBrowserslist () {
4
+ const fs = require('fs')
5
5
  const root = process.cwd()
6
6
  try {
7
7
  const pkg = require(path.resolve(root, 'package.json'))
@@ -21,6 +21,7 @@ function hasBrowserslist () {
21
21
  }
22
22
 
23
23
  module.exports = (_, options = {}) => {
24
+ const isWeb = require('@tarojs/shared').isWebPlatform()
24
25
  if (process.env.TARO_ENV === 'rn') {
25
26
  const presetForReactNative = require('./rn')
26
27
  return presetForReactNative(_, options)
@@ -45,7 +46,7 @@ module.exports = (_, options = {}) => {
45
46
  presets.push([require('@babel/preset-react'), {
46
47
  runtime: options.reactJsxRuntime || 'automatic'
47
48
  }])
48
- if (process.env.TARO_ENV === 'h5' && process.env.NODE_ENV !== 'production' && options.hot !== false) {
49
+ if (isWeb && process.env.NODE_ENV !== 'production' && options.hot !== false) {
49
50
  if (options.framework === 'react') {
50
51
  plugins.push([require('react-refresh/babel'), { skipEnvCheck: true }])
51
52
  } else if (options.framework === 'preact') {
@@ -175,7 +176,7 @@ module.exports = (_, options = {}) => {
175
176
  version
176
177
  }])
177
178
 
178
- if (typeof options['dynamic-import-node'] === 'boolean' ? options['dynamic-import-node'] : process.env.TARO_ENV !== 'h5') {
179
+ if (typeof options['dynamic-import-node'] === 'boolean' ? options['dynamic-import-node'] : !isWeb) {
179
180
  plugins.push([require('babel-plugin-dynamic-import-node')])
180
181
  }
181
182
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babel-preset-taro",
3
- "version": "3.6.2",
3
+ "version": "3.6.4",
4
4
  "description": "Taro babel preset",
5
5
  "author": "yuche <i@yuche.me>",
6
6
  "homepage": "https://github.com/nervjs/taro/tree/master/packages/babel-preset-taro#readme",
@@ -36,15 +36,20 @@
36
36
  "core-js": "^3.6.5",
37
37
  "metro-react-native-babel-preset": "^0.72.1",
38
38
  "react-refresh": "^0.11.0",
39
- "@tarojs/helper": "3.6.2",
40
- "@tarojs/taro-h5": "3.6.2",
41
- "babel-plugin-transform-react-jsx-to-rn-stylesheet": "3.6.2",
42
- "babel-plugin-transform-taroapi": "3.6.2"
39
+ "@tarojs/helper": "3.6.4",
40
+ "@tarojs/shared": "3.6.4",
41
+ "babel-plugin-transform-react-jsx-to-rn-stylesheet": "3.6.4",
42
+ "babel-plugin-transform-taroapi": "3.6.4"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@babel/core": "^7.14.5",
46
46
  "@vue/babel-plugin-jsx": "^1.0.6",
47
- "@vue/babel-preset-jsx": "^1.2.4"
47
+ "@vue/babel-preset-jsx": "^1.2.4",
48
+ "jest": "^29.3.1",
49
+ "jest-cli": "^29.3.1",
50
+ "jest-environment-node": "^29.5.0",
51
+ "ts-jest": "^29.0.5",
52
+ "typescript": "^4.7.4"
48
53
  },
49
54
  "peerDependencies": {
50
55
  "@babel/core": "*"
package/rn/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ const PLATFORM_TYPE = require('@tarojs/shared').PLATFORM_TYPE
1
2
  const reactNativeBabelPreset = require('metro-react-native-babel-preset')
2
3
  const { merge } = require('lodash')
3
4
  const fs = require('fs')
@@ -38,7 +39,8 @@ function getRNConfig () {
38
39
  function getEnv () {
39
40
  const config = getProjectConfig()
40
41
  const envConst = {
41
- 'process.env.TARO_ENV': 'rn'
42
+ 'process.env.TARO_ENV': 'rn',
43
+ 'process.env.TARO_PLATFORM': PLATFORM_TYPE.RN,
42
44
  }
43
45
  if (config.env) {
44
46
  Object.keys(config.env).forEach((key) => {