Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-template-literals

Package Overview
Dependencies
Maintainers
6
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-template-literals - npm Package Compare versions

Comparing version 7.12.1 to 7.12.13

25

lib/index.js

@@ -67,20 +67,17 @@ "use strict";

const scope = path.scope.getProgramParent();
const templateObject = scope.generateUidIdentifier("templateObject");
const helperId = this.addHelper(helperName);
const callExpressionInput = [_core.types.arrayExpression(strings)];
const helperArgs = [_core.types.arrayExpression(strings)];
if (!isStringsRawEqual) {
callExpressionInput.push(_core.types.arrayExpression(raws));
helperArgs.push(_core.types.arrayExpression(raws));
}
const lazyLoad = _core.template.ast`
function ${templateObject}() {
const data = ${_core.types.callExpression(helperId, callExpressionInput)};
${_core.types.cloneNode(templateObject)} = function() { return data };
return data;
}
`;
scope.path.unshiftContainer("body", lazyLoad);
path.replaceWith(_core.types.callExpression(node.tag, [_core.types.callExpression(_core.types.cloneNode(templateObject), []), ...quasi.expressions]));
const tmp = path.scope.generateUidIdentifier("templateObject");
path.scope.getProgramParent().push({
id: _core.types.cloneNode(tmp)
});
path.replaceWith(_core.types.callExpression(node.tag, [_core.template.expression.ast`
${_core.types.cloneNode(tmp)} || (
${tmp} = ${this.addHelper(helperName)}(${helperArgs})
)
`, ...quasi.expressions]));
},

@@ -87,0 +84,0 @@

{
"name": "@babel/plugin-transform-template-literals",
"version": "7.12.1",
"version": "7.12.13",
"description": "Compile ES2015 template literals to ES5",

@@ -16,3 +16,3 @@ "repository": {

"dependencies": {
"@babel/helper-plugin-utils": "^7.10.4"
"@babel/helper-plugin-utils": "^7.12.13"
},

@@ -26,5 +26,6 @@ "keywords": [

"devDependencies": {
"@babel/core": "^7.12.1",
"@babel/helper-plugin-test-runner": "7.10.4"
}
"@babel/core": "7.12.13",
"@babel/helper-plugin-test-runner": "7.12.13"
},
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-template-literals"
}

@@ -5,3 +5,3 @@ # @babel/plugin-transform-template-literals

See our website [@babel/plugin-transform-template-literals](https://babeljs.io/docs/en/next/babel-plugin-transform-template-literals.html) for more information.
See our website [@babel/plugin-transform-template-literals](https://babeljs.io/docs/en/babel-plugin-transform-template-literals) for more information.

@@ -8,0 +8,0 @@ ## Install

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc