babel-plugin-transform-taroapi 3.3.14 → 3.5.0-canary.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/__tests__/index.spec.ts +1 -1
- package/package.json +2 -2
- package/src/index.ts +4 -6
- package/tsconfig.json +5 -20
package/__tests__/index.spec.ts
CHANGED
|
@@ -137,7 +137,7 @@ it('should preserve default imports', function () {
|
|
|
137
137
|
it('should preserve assignments in lefthands', function () {
|
|
138
138
|
const code = `
|
|
139
139
|
import Taro from '@tarojs/taro-h5'
|
|
140
|
-
let animation
|
|
140
|
+
let animation
|
|
141
141
|
animation = Taro.createAnimation({
|
|
142
142
|
transformOrigin: "50% 50%",
|
|
143
143
|
duration: 1000,
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-plugin-transform-taroapi",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0-canary.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc"
|
|
7
7
|
},
|
|
8
8
|
"license": "MIT",
|
|
9
|
-
"gitHead": "
|
|
9
|
+
"gitHead": "a0222bc41bc05b0e34413d6db3de963d777a5015"
|
|
10
10
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { types as Types, PluginObj } from 'babel-core'
|
|
2
|
-
|
|
3
1
|
const plugin = function (babel: {
|
|
4
|
-
types:
|
|
5
|
-
})
|
|
2
|
+
types: any
|
|
3
|
+
}) {
|
|
6
4
|
const t = babel.types
|
|
7
5
|
|
|
8
6
|
// 这些变量需要在每个programe里重置
|
|
@@ -10,7 +8,7 @@ const plugin = function (babel: {
|
|
|
10
8
|
let taroName: string
|
|
11
9
|
let needDefault: boolean
|
|
12
10
|
|
|
13
|
-
let referrencedTaros:
|
|
11
|
+
let referrencedTaros: any[]
|
|
14
12
|
|
|
15
13
|
return {
|
|
16
14
|
name: 'babel-plugin-transform-taro-api',
|
|
@@ -71,7 +69,7 @@ const plugin = function (babel: {
|
|
|
71
69
|
const isAssignment = t.isAssignmentExpression(parentNode) && parentNode.left === ast.node
|
|
72
70
|
|
|
73
71
|
if (!isAssignment) {
|
|
74
|
-
let identifier:
|
|
72
|
+
let identifier: any
|
|
75
73
|
if (invokedApis.has(propertyName)) {
|
|
76
74
|
identifier = t.identifier(invokedApis.get(propertyName)!)
|
|
77
75
|
} else {
|
package/tsconfig.json
CHANGED
|
@@ -1,28 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "../../tsconfig.root.json",
|
|
2
3
|
"compilerOptions": {
|
|
3
|
-
"allowSyntheticDefaultImports": true,
|
|
4
|
-
"allowJs": true,
|
|
5
4
|
"baseUrl": ".",
|
|
6
|
-
"
|
|
7
|
-
"lib": ["esnext", "dom"],
|
|
8
|
-
"module": "commonjs",
|
|
9
|
-
"moduleResolution": "node",
|
|
10
|
-
"noImplicitAny": false,
|
|
11
|
-
"noUnusedLocals": true,
|
|
12
|
-
"outDir": "dist/",
|
|
13
|
-
"preserveConstEnums": true,
|
|
14
|
-
"removeComments": false,
|
|
5
|
+
"outDir": "dist",
|
|
15
6
|
"rootDir": "./src",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"target": "es2015",
|
|
19
|
-
"traceResolution": false,
|
|
20
|
-
"types": ["jest"],
|
|
21
|
-
"paths": {
|
|
22
|
-
"@tarojs/taro-h5": ["../packages/taro-h5"]
|
|
23
|
-
}
|
|
7
|
+
"module": "commonjs",
|
|
8
|
+
"skipLibCheck": true
|
|
24
9
|
},
|
|
25
10
|
"include": [
|
|
26
|
-
"./src
|
|
11
|
+
"./src"
|
|
27
12
|
]
|
|
28
13
|
}
|