babel-plugin-transform-vnmfapi
Advanced tools
Comparing version 3.5.65 to 3.5.66
@@ -5,3 +5,3 @@ "use strict"; | ||
const t = babel.types; | ||
// 这些变量需要在每个 program 里重置 | ||
// These variables need to be in each program Re -sett | ||
const invokedApis = new Map(); | ||
@@ -26,7 +26,7 @@ let vnmfName; | ||
const propertyName = node.imported.name; | ||
if (apis.has(propertyName)) { // 记录api名字 | ||
if (apis.has(propertyName)) { // Record apiname | ||
ast.scope.rename(node.local.name); | ||
invokedApis.set(propertyName, node.local.name); | ||
} | ||
else { // 如果是未实现的api 改成Vnmf.xxx | ||
else { // If it is unrealized api Change to Vnmf.xxx | ||
needDefault = true; | ||
@@ -45,3 +45,3 @@ const localName = node.local.name; | ||
MemberExpression(ast, state) { | ||
/* 处理Vnmf.xxx */ | ||
/* deal with Vnmf.xxx */ | ||
const apis = state.opts.apis; | ||
@@ -54,3 +54,3 @@ const isVnmf = t.isIdentifier(ast.node.object, { name: vnmfName }); | ||
return; | ||
// 兼容一下 Vnmf['xxx'] | ||
// Compatible Vnmf['xxx'] | ||
if (t.isStringLiteral(property)) { | ||
@@ -62,3 +62,3 @@ propName = 'value'; | ||
return; | ||
// 同一api使用多次, 读取变量名 | ||
// Same apiUse many times , Read variable name | ||
if (apis.has(propertyName)) { | ||
@@ -75,3 +75,3 @@ const parentNode = ast.parent; | ||
invokedApis.set(propertyName, newPropertyName); | ||
/* 未绑定作用域 */ | ||
/* Unbounded field */ | ||
identifier = t.identifier(newPropertyName); | ||
@@ -96,3 +96,3 @@ } | ||
exit(ast, state) { | ||
// 防止重复引入 | ||
// Prevent repeated introduction | ||
let isVnmfApiImported = false; | ||
@@ -99,0 +99,0 @@ referVnmf.forEach(node => { |
{ | ||
"name": "babel-plugin-transform-vnmfapi", | ||
"version": "3.5.65", | ||
"version": "3.5.66", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -6,3 +6,3 @@ const plugin = function (babel: { | ||
// 这些变量需要在每个 program 里重置 | ||
// These variables need to be in each program Re -sett | ||
const invokedApis: Map<string, string> = new Map() | ||
@@ -28,6 +28,6 @@ let vnmfName: string | ||
const propertyName = node.imported.name | ||
if (apis.has(propertyName)) { // 记录api名字 | ||
if (apis.has(propertyName)) { // Record apiname | ||
ast.scope.rename(node.local.name) | ||
invokedApis.set(propertyName, node.local.name) | ||
} else { // 如果是未实现的api 改成Vnmf.xxx | ||
} else { // If it is unrealized api Change to Vnmf.xxx | ||
needDefault = true | ||
@@ -51,3 +51,3 @@ const localName = node.local.name | ||
MemberExpression (ast, state) { | ||
/* 处理Vnmf.xxx */ | ||
/* deal with Vnmf.xxx */ | ||
const apis = state.opts.apis | ||
@@ -61,3 +61,3 @@ const isVnmf = t.isIdentifier(ast.node.object, { name: vnmfName }) | ||
// 兼容一下 Vnmf['xxx'] | ||
// Compatible Vnmf['xxx'] | ||
if (t.isStringLiteral(property)) { | ||
@@ -70,3 +70,3 @@ propName = 'value' | ||
// 同一api使用多次, 读取变量名 | ||
// Same apiUse many times , Read variable name | ||
if (apis.has(propertyName)) { | ||
@@ -83,3 +83,3 @@ const parentNode = ast.parent | ||
invokedApis.set(propertyName, newPropertyName) | ||
/* 未绑定作用域 */ | ||
/* Unbounded field */ | ||
identifier = t.identifier(newPropertyName) | ||
@@ -104,3 +104,3 @@ } | ||
exit (ast, state) { | ||
// 防止重复引入 | ||
// Prevent repeated introduction | ||
let isVnmfApiImported = false | ||
@@ -107,0 +107,0 @@ referVnmf.forEach(node => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17959