babel-plugin-openui5-support
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -105,15 +105,11 @@ 'use strict'; | ||
function handleTechInfo(path, mode) { | ||
var callee = path.node.callee; | ||
function handleOldTechInfo(path, mode, callee, args) { | ||
var object = callee.object, | ||
property = callee.property; | ||
var args = path.node.arguments; | ||
if (callee.type !== 'MemberExpression' || args.length !== 1) { | ||
if (!object) { | ||
return; | ||
} | ||
var object = callee.object, | ||
property = callee.property; | ||
if (object.type !== 'Identifier' || property.type !== 'Identifier') { | ||
@@ -129,3 +125,3 @@ return; | ||
if (arg.type !== 'ObjectExpression') { | ||
if (!arg || arg.type !== 'ObjectExpression') { | ||
return; | ||
@@ -153,2 +149,37 @@ } | ||
function handleNewTechInfo(path, mode, callee) { | ||
var obj = callee.object; | ||
if (!obj || obj.type !== 'CallExpression') { | ||
return; | ||
} | ||
var args = obj.arguments; | ||
if (!args || args.length !== 2) { | ||
return; | ||
} | ||
if (args[0].type !== 'StringLiteral' || args[0].value !== 'sap.ui.support') { | ||
return; | ||
} | ||
var prop = obj.callee.property; | ||
if (prop && prop.type === 'Identifier' && prop.name === 'loadLibrary') { | ||
path.remove(); | ||
} | ||
} | ||
function handleTechInfo(path, mode) { | ||
var callee = path.node.callee; | ||
var args = path.node.arguments; | ||
if (callee.type !== 'MemberExpression' && args.length !== 1) { | ||
return; | ||
} | ||
handleOldTechInfo(path, mode, callee, args); | ||
handleNewTechInfo(path, mode, callee); | ||
} | ||
return { | ||
@@ -155,0 +186,0 @@ visitor: { |
{ | ||
"name": "babel-plugin-openui5-support", | ||
"description": "Handle support tool loading behavior for UI5", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "author": "Christoph Kraemer <chr.kraemer@sap.com>", |
@@ -102,12 +102,9 @@ export default function ({ types: t }) { | ||
function handleTechInfo(path, mode) { | ||
const { callee } = path.node; | ||
const args = path.node.arguments; | ||
function handleOldTechInfo(path, mode, callee, args) { | ||
const { object, property } = callee; | ||
if (callee.type !== 'MemberExpression' || args.length !== 1) { | ||
if (!object) { | ||
return; | ||
} | ||
const { object, property } = callee; | ||
if (object.type !== 'Identifier' || property.type !== 'Identifier') { | ||
@@ -123,3 +120,3 @@ return; | ||
if (arg.type !== 'ObjectExpression') { | ||
if (!arg || arg.type !== 'ObjectExpression') { | ||
return; | ||
@@ -194,2 +191,37 @@ } | ||
function handleNewTechInfo(path, mode, callee) { | ||
const obj = callee.object; | ||
if (!obj || obj.type !== 'CallExpression') { | ||
return; | ||
} | ||
const args = obj.arguments; | ||
if (!args || args.length !== 2) { | ||
return; | ||
} | ||
if (args[0].type !== 'StringLiteral' || args[0].value !== 'sap.ui.support') { | ||
return; | ||
} | ||
const prop = obj.callee.property; | ||
if (prop && prop.type === 'Identifier' && prop.name === 'loadLibrary') { | ||
path.remove(); | ||
} | ||
} | ||
function handleTechInfo(path, mode) { | ||
const { callee } = path.node; | ||
const args = path.node.arguments; | ||
if (callee.type !== 'MemberExpression' && args.length !== 1) { | ||
return; | ||
} | ||
handleOldTechInfo(path, mode, callee, args); | ||
handleNewTechInfo(path, mode, callee); | ||
} | ||
return { | ||
@@ -196,0 +228,0 @@ visitor: { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
20
20810
560