Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@babel/plugin-transform-template-literals

Package Overview
Dependencies
Maintainers
4
Versions
80
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.21.4-esm to 7.21.4-esm.1

43

lib/index.js

@@ -1,10 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _core = require("@babel/core");
var _default = (0, _helperPluginUtils.declare)((api, options) => {
import { declare } from "@babel/helper-plugin-utils";
import { template, types as t } from "@babel/core";
export default declare((api, options) => {
var _api$assumption, _api$assumption2;

@@ -19,3 +13,3 @@ api.assertVersion(7);

return items.reduce(function (left, right) {
let canBeInserted = _core.types.isLiteral(right);
let canBeInserted = t.isLiteral(right);
if (!canBeInserted && avail) {

@@ -25,7 +19,7 @@ canBeInserted = true;

}
if (canBeInserted && _core.types.isCallExpression(left)) {
if (canBeInserted && t.isCallExpression(left)) {
left.arguments.push(right);
return left;
}
return _core.types.callExpression(_core.types.memberExpression(left, _core.types.identifier("concat")), [right]);
return t.callExpression(t.memberExpression(left, t.identifier("concat")), [right]);
});

@@ -51,5 +45,5 @@ }

} = elem.value;
const value = cooked == null ? path.scope.buildUndefinedNode() : _core.types.stringLiteral(cooked);
const value = cooked == null ? path.scope.buildUndefinedNode() : t.stringLiteral(cooked);
strings.push(value);
raws.push(_core.types.stringLiteral(raw));
raws.push(t.stringLiteral(raw));
if (raw !== cooked) {

@@ -59,12 +53,12 @@ isStringsRawEqual = false;

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

@@ -83,3 +77,3 @@ )

if (elem.value.cooked) {
nodes.push(_core.types.stringLiteral(elem.value.cooked));
nodes.push(t.stringLiteral(elem.value.cooked));
}

@@ -89,3 +83,3 @@ if (index < expressions.length) {

const node = expr.node;
if (!_core.types.isStringLiteral(node, {
if (!t.isStringLiteral(node, {
value: ""

@@ -97,4 +91,4 @@ })) {

}
if (!_core.types.isStringLiteral(nodes[0]) && !(ignoreToPrimitiveHint && _core.types.isStringLiteral(nodes[1]))) {
nodes.unshift(_core.types.stringLiteral(""));
if (!t.isStringLiteral(nodes[0]) && !(ignoreToPrimitiveHint && t.isStringLiteral(nodes[1]))) {
nodes.unshift(t.stringLiteral(""));
}

@@ -104,3 +98,3 @@ let root = nodes[0];

for (let i = 1; i < nodes.length; i++) {
root = _core.types.binaryExpression("+", root, nodes[i]);
root = t.binaryExpression("+", root, nodes[i]);
}

@@ -115,4 +109,3 @@ } else if (nodes.length > 1) {

});
exports.default = _default;
//# sourceMappingURL=index.js.map
{
"name": "@babel/plugin-transform-template-literals",
"version": "7.21.4-esm",
"version": "7.21.4-esm.1",
"description": "Compile ES2015 template literals to ES5",

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

"dependencies": {
"@babel/helper-plugin-utils": "^7.21.4-esm"
"@babel/helper-plugin-utils": "^7.21.4-esm.1"
},

@@ -23,7 +23,7 @@ "keywords": [

"peerDependencies": {
"@babel/core": "^7.0.0-0 || 7.21.4-esm"
"@babel/core": "^7.0.0-0 || 7.21.4-esm.1"
},
"devDependencies": {
"@babel/core": "^7.21.4-esm",
"@babel/helper-plugin-test-runner": "^7.21.4-esm"
"@babel/core": "^7.21.4-esm.1",
"@babel/helper-plugin-test-runner": "^7.21.4-esm.1"
},

@@ -35,3 +35,3 @@ "homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-template-literals",

"author": "The Babel Team (https://babel.dev/team)",
"type": "commonjs"
"type": "module"
}

Sorry, the diff of this file is not supported yet

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