babel-plugin-transform-taroapi 3.7.0-canary.6 → 3.8.0-canary.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.
package/LICENSE CHANGED
@@ -158,3 +158,17 @@ MIT (stencil-vue2-output-target):
158
158
  The following files embed [stencil-vue2-output-target](https://github.com/diondree/stencil-vue2-output-target) MIT:
159
159
  `/packages/taro-components-library-vue2/src/vue-component-lib/utils.ts`
160
160
  See `/LICENSE` for details of the license.
161
+
162
+ ==================
163
+
164
+ MIT (weui):
165
+ The following files embed [stencil-vue2-output-target](https://github.com/Tencent/weui) MIT:
166
+ `/packages/taro-components/src/components/*.scss`
167
+ See `/LICENSE.txt` for details of the license.
168
+
169
+ ==================
170
+
171
+ Apache-2.0 (intersection-observer):
172
+ The following files embed [intersection-observer](https://github.com/GoogleChromeLabs/intersection-observer) Apache-2.0:
173
+ `/packages/taro-api/src/polyfill/intersection-observer.ts`
174
+ See `/LICENSE.txt` for details of the license.
@@ -2952,4 +2952,4 @@
2952
2952
  "src": ""
2953
2953
  }
2954
2954
  }
2955
- }
2955
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babel-plugin-transform-taroapi",
3
- "version": "3.7.0-canary.6",
3
+ "version": "3.8.0-canary.1",
4
4
  "main": "dist/index.js",
5
5
  "dependencies": {
6
6
  "lodash": "^4.17.21"
@@ -8,7 +8,7 @@
8
8
  "devDependencies": {
9
9
  "@babel/core": "^7.14.5",
10
10
  "@babel/types": "^7.14.5",
11
- "babel-jest": "^29.7.0",
11
+ "babel-jest": "^29.5.0",
12
12
  "jest": "^29.3.1",
13
13
  "jest-cli": "^29.3.1",
14
14
  "ts-jest": "^29.0.5",
@@ -18,7 +18,7 @@
18
18
  "scripts": {
19
19
  "build": "tsc",
20
20
  "test": "cross-env NODE_ENV=jest jest",
21
- "test:ci": "cross-env NODE_ENV=jest jest --ci -i",
21
+ "test:ci": "cross-env NODE_ENV=jest jest --ci -i --coverage --silent",
22
22
  "test:dev": "cross-env NODE_ENV=jest jest --watch",
23
23
  "test:coverage": "cross-env NODE_ENV=jest jest --coverage",
24
24
  "updateSnapshot": "cross-env NODE_ENV=jest jest --updateSnapshot"
package/src/index.ts CHANGED
@@ -60,7 +60,7 @@ const plugin = function (babel: typeof BabelCore): BabelCore.PluginObj<IState> {
60
60
  this.apis = apis
61
61
  },
62
62
  visitor: {
63
- ImportDeclaration (ast: BabelCore.NodePath<any>) {
63
+ ImportDeclaration (ast) {
64
64
  if (ast.node.source.value !== this.packageName) return
65
65
 
66
66
  ast.node.specifiers.forEach(node => {
@@ -91,7 +91,7 @@ const plugin = function (babel: typeof BabelCore): BabelCore.PluginObj<IState> {
91
91
  }
92
92
  })
93
93
  },
94
- MemberExpression (ast: BabelCore.NodePath<any>) {
94
+ MemberExpression (ast) {
95
95
  /* 处理Taro.xxx */
96
96
  const isTaro = t.isIdentifier(ast.node.object, { name: taroName })
97
97
  const property = ast.node.property
@@ -110,7 +110,7 @@ const plugin = function (babel: typeof BabelCore): BabelCore.PluginObj<IState> {
110
110
 
111
111
  // 同一api使用多次, 读取变量名
112
112
  if (this.apis.has(propertyName)) {
113
- const parentNode = ast.parent as BabelCore.types.AssignmentExpression
113
+ const parentNode = ast.parent
114
114
  const isAssignment = t.isAssignmentExpression(parentNode) && parentNode.left === ast.node
115
115
 
116
116
  if (!isAssignment) {
@@ -129,7 +129,7 @@ const plugin = function (babel: typeof BabelCore): BabelCore.PluginObj<IState> {
129
129
  needDefault = true
130
130
  }
131
131
  },
132
- CallExpression (ast: BabelCore.NodePath<any>) {
132
+ CallExpression (ast) {
133
133
  if (!ast.scope.hasReference(this.canIUse)) return
134
134
  const callee = ast.node.callee
135
135
  if (t.isMemberExpression(callee) && t.isIdentifier(callee.object, { name: taroName })) {
@@ -188,7 +188,7 @@ const plugin = function (babel: typeof BabelCore): BabelCore.PluginObj<IState> {
188
188
  ast.node.specifiers = namedImports
189
189
  }
190
190
  },
191
- CallExpression (ast: BabelCore.NodePath<any>) {
191
+ CallExpression (ast) {
192
192
  if (!invokedApis.has(that.canIUse)) return
193
193
  const callee = ast.node.callee
194
194
  const { name } = t.identifier(invokedApis.get(that.canIUse)!)