babel-plugin-transform-taroapi 3.5.0-beta.4 → 3.5.0-theta.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/dist/index.js CHANGED
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const plugin = function (babel) {
4
4
  const t = babel.types;
5
- // 这些变量需要在每个programe里重置
5
+ // 这些变量需要在每个 program 里重置
6
6
  const invokedApis = new Map();
7
7
  let taroName;
8
8
  let needDefault;
9
- let referrencedTaros;
9
+ let referTaro;
10
10
  return {
11
11
  name: 'babel-plugin-transform-taro-api',
12
12
  visitor: {
@@ -30,10 +30,10 @@ const plugin = function (babel) {
30
30
  needDefault = true;
31
31
  const localName = node.local.name;
32
32
  const binding = ast.scope.getBinding(localName);
33
- const iden = t.identifier(taroName);
34
- referrencedTaros.push(iden);
33
+ const idn = t.identifier(taroName);
34
+ referTaro.push(idn);
35
35
  binding && binding.referencePaths.forEach(reference => {
36
- reference.replaceWith(t.memberExpression(iden, t.identifier(propertyName)));
36
+ reference.replaceWith(t.memberExpression(idn, t.identifier(propertyName)));
37
37
  });
38
38
  }
39
39
  }
@@ -80,7 +80,7 @@ const plugin = function (babel) {
80
80
  Program: {
81
81
  enter(ast) {
82
82
  needDefault = false;
83
- referrencedTaros = [];
83
+ referTaro = [];
84
84
  invokedApis.clear();
85
85
  taroName = ast.scope.getBinding('Taro')
86
86
  ? ast.scope.generateUid('Taro')
@@ -89,7 +89,7 @@ const plugin = function (babel) {
89
89
  exit(ast, state) {
90
90
  // 防止重复引入
91
91
  let isTaroApiImported = false;
92
- referrencedTaros.forEach(node => {
92
+ referTaro.forEach(node => {
93
93
  node.name = taroName;
94
94
  });
95
95
  ast.traverse({
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "babel-plugin-transform-taroapi",
3
- "version": "3.5.0-beta.4",
3
+ "version": "3.5.0-theta.0",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc"
7
7
  },
8
- "license": "MIT",
9
- "gitHead": "7aca7841ed7e2af1b182ff5d24e91f44730ce783"
8
+ "license": "MIT"
10
9
  }
package/src/index.ts CHANGED
@@ -3,12 +3,12 @@ const plugin = function (babel: {
3
3
  }) {
4
4
  const t = babel.types
5
5
 
6
- // 这些变量需要在每个programe里重置
6
+ // 这些变量需要在每个 program 里重置
7
7
  const invokedApis: Map<string, string> = new Map()
8
8
  let taroName: string
9
9
  let needDefault: boolean
10
10
 
11
- let referrencedTaros: any[]
11
+ let referTaro: any[]
12
12
 
13
13
  return {
14
14
  name: 'babel-plugin-transform-taro-api',
@@ -31,12 +31,12 @@ const plugin = function (babel: {
31
31
  needDefault = true
32
32
  const localName = node.local.name
33
33
  const binding = ast.scope.getBinding(localName)
34
- const iden = t.identifier(taroName)
35
- referrencedTaros.push(iden)
34
+ const idn = t.identifier(taroName)
35
+ referTaro.push(idn)
36
36
  binding && binding.referencePaths.forEach(reference => {
37
37
  reference.replaceWith(
38
38
  t.memberExpression(
39
- iden,
39
+ idn,
40
40
  t.identifier(propertyName)
41
41
  )
42
42
  )
@@ -87,7 +87,7 @@ const plugin = function (babel: {
87
87
  Program: {
88
88
  enter (ast) {
89
89
  needDefault = false
90
- referrencedTaros = []
90
+ referTaro = []
91
91
  invokedApis.clear()
92
92
 
93
93
  taroName = ast.scope.getBinding('Taro')
@@ -97,7 +97,7 @@ const plugin = function (babel: {
97
97
  exit (ast, state) {
98
98
  // 防止重复引入
99
99
  let isTaroApiImported = false
100
- referrencedTaros.forEach(node => {
100
+ referTaro.forEach(node => {
101
101
  node.name = taroName
102
102
  })
103
103
 
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2018
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.