@babel/plugin-transform-template-literals
Advanced tools
Comparing version 7.4.4 to 7.7.4
@@ -8,23 +8,7 @@ "use strict"; | ||
function _helperPluginUtils() { | ||
const data = require("@babel/helper-plugin-utils"); | ||
var _helperPluginUtils = require("@babel/helper-plugin-utils"); | ||
_helperPluginUtils = function () { | ||
return data; | ||
}; | ||
var _core = require("@babel/core"); | ||
return data; | ||
} | ||
function _core() { | ||
const data = require("@babel/core"); | ||
_core = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
var _default = (0, _helperPluginUtils().declare)((api, options) => { | ||
var _default = (0, _helperPluginUtils.declare)((api, options) => { | ||
api.assertVersion(7); | ||
@@ -40,3 +24,3 @@ const { | ||
return items.reduce(function (left, right) { | ||
let canBeInserted = _core().types.isLiteral(right); | ||
let canBeInserted = _core.types.isLiteral(right); | ||
@@ -48,3 +32,3 @@ if (!canBeInserted && avail) { | ||
if (canBeInserted && _core().types.isCallExpression(left)) { | ||
if (canBeInserted && _core.types.isCallExpression(left)) { | ||
left.arguments.push(right); | ||
@@ -54,3 +38,3 @@ return left; | ||
return _core().types.callExpression(_core().types.memberExpression(left, _core().types.identifier("concat")), [right]); | ||
return _core.types.callExpression(_core.types.memberExpression(left, _core.types.identifier("concat")), [right]); | ||
}); | ||
@@ -78,5 +62,5 @@ } | ||
} = elem.value; | ||
const value = cooked == null ? path.scope.buildUndefinedNode() : _core().types.stringLiteral(cooked); | ||
const value = cooked == null ? path.scope.buildUndefinedNode() : _core.types.stringLiteral(cooked); | ||
strings.push(value); | ||
raws.push(_core().types.stringLiteral(raw)); | ||
raws.push(_core.types.stringLiteral(raw)); | ||
@@ -91,11 +75,11 @@ if (raw !== cooked) { | ||
const helperId = this.addHelper(helperName); | ||
const callExpressionInput = [_core().types.arrayExpression(strings)]; | ||
const callExpressionInput = [_core.types.arrayExpression(strings)]; | ||
if (!isStringsRawEqual) { | ||
callExpressionInput.push(_core().types.arrayExpression(raws)); | ||
callExpressionInput.push(_core.types.arrayExpression(raws)); | ||
} | ||
const lazyLoad = _core().template.ast` | ||
const lazyLoad = _core.template.ast` | ||
function ${templateObject}() { | ||
const data = ${_core().types.callExpression(helperId, callExpressionInput)}; | ||
const data = ${_core.types.callExpression(helperId, callExpressionInput)}; | ||
${templateObject} = function() { return data }; | ||
@@ -106,3 +90,3 @@ return data; | ||
scope.path.unshiftContainer("body", lazyLoad); | ||
path.replaceWith(_core().types.callExpression(node.tag, [_core().types.callExpression(_core().types.cloneNode(templateObject), []), ...quasi.expressions])); | ||
path.replaceWith(_core.types.callExpression(node.tag, [_core.types.callExpression(_core.types.cloneNode(templateObject), []), ...quasi.expressions])); | ||
}, | ||
@@ -117,3 +101,3 @@ | ||
if (elem.value.cooked) { | ||
nodes.push(_core().types.stringLiteral(elem.value.cooked)); | ||
nodes.push(_core.types.stringLiteral(elem.value.cooked)); | ||
} | ||
@@ -125,3 +109,3 @@ | ||
if (!_core().types.isStringLiteral(node, { | ||
if (!_core.types.isStringLiteral(node, { | ||
value: "" | ||
@@ -134,6 +118,6 @@ })) { | ||
const considerSecondNode = !loose || !_core().types.isStringLiteral(nodes[1]); | ||
const considerSecondNode = !loose || !_core.types.isStringLiteral(nodes[1]); | ||
if (!_core().types.isStringLiteral(nodes[0]) && considerSecondNode) { | ||
nodes.unshift(_core().types.stringLiteral("")); | ||
if (!_core.types.isStringLiteral(nodes[0]) && considerSecondNode) { | ||
nodes.unshift(_core.types.stringLiteral("")); | ||
} | ||
@@ -145,3 +129,3 @@ | ||
for (let i = 1; i < nodes.length; i++) { | ||
root = _core().types.binaryExpression("+", root, nodes[i]); | ||
root = _core.types.binaryExpression("+", root, nodes[i]); | ||
} | ||
@@ -148,0 +132,0 @@ } else if (nodes.length > 1) { |
{ | ||
"name": "@babel/plugin-transform-template-literals", | ||
"version": "7.4.4", | ||
"version": "7.7.4", | ||
"description": "Compile ES2015 template literals to ES5", | ||
@@ -12,3 +12,3 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-template-literals", | ||
"dependencies": { | ||
"@babel/helper-annotate-as-pure": "^7.0.0", | ||
"@babel/helper-annotate-as-pure": "^7.7.4", | ||
"@babel/helper-plugin-utils": "^7.0.0" | ||
@@ -23,6 +23,6 @@ }, | ||
"devDependencies": { | ||
"@babel/core": "^7.4.4", | ||
"@babel/helper-plugin-test-runner": "^7.0.0" | ||
"@babel/core": "^7.7.4", | ||
"@babel/helper-plugin-test-runner": "^7.7.4" | ||
}, | ||
"gitHead": "2c88694388831b1e5b88e4bbed6781eb2be1edba" | ||
"gitHead": "75767d87cb147709b9bd9b99bf44daa6688874a9" | ||
} |
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
5999
106