Socket
Socket
Sign inDemoInstall

melody-compiler

Package Overview
Dependencies
Maintainers
3
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

melody-compiler - npm Package Compare versions

Comparing version 1.2.0-42f95e8.8 to 1.2.0-70b7860.6

10

package.json
{
"name": "melody-compiler",
"version": "1.2.0-42f95e8.8+42f95e8",
"version": "1.2.0-70b7860.6+70b7860",
"description": "",

@@ -17,3 +17,3 @@ "main": "./lib/index.js",

"lodash": "^4.12.0",
"melody-code-frame": "1.2.0-42f95e8.8+42f95e8",
"melody-code-frame": "1.2.0-70b7860.6+70b7860",
"random-seed": "^0.3.0"

@@ -29,6 +29,6 @@ },

"devDependencies": {
"melody-extension-core": "1.2.0-42f95e8.8+42f95e8",
"melody-plugin-idom": "1.2.0-42f95e8.8+42f95e8"
"melody-extension-core": "1.2.0-70b7860.6+70b7860",
"melody-plugin-idom": "1.2.0-70b7860.6+70b7860"
},
"gitHead": "42f95e8a9d2eb19120722cede9c9b395e4e81c17"
"gitHead": "70b7860e11513e229ac382db686ac565b97a2bac"
}

@@ -44,52 +44,8 @@ /**

const node = path.node;
if (t.isStringLiteral(node.left)) {
if (t.isStringLiteral(node.right)) {
path.replaceWithJS(
t.stringLiteral(node.left.value + node.right.value)
);
} else {
path.replaceWithJS(
t.templateLiteral(
[t.templateElement({cooked: node.left.value, raw: node.left.value}), t.templateElement({cooked: '', raw: ''})],
[node.right]
)
);
}
} else if (t.isTemplateLiteral(node.left)) {
if (t.isStringLiteral(node.right)) {
// we need to append the new value to the last quasi
// to keep things predictable and pure we start by cloning the existing structure
const quasis = node.left.quasis.map(quasi => t.templateElement({ cooked: quasi.value.cooked, raw: quasi.value.raw }));
const last = quasis[quasis.length - 1];
last.value.cooked += node.right.value;
last.value.raw += node.right.value;
path.replaceWithJS(
t.templateLiteral(
quasis,
node.left.expressions
)
);
} else {
path.replaceWithJS(
t.templateLiteral(
[...node.left.quasis, t.templateElement({cooked: '', raw: ''})],
[...node.left.expressions, node.right]
)
);
}
} else if (t.isStringLiteral(node.right)) {
path.replaceWithJS(
t.templateLiteral(
[t.templateElement({cooked: '', raw: ''}), t.templateElement({cooked: node.right.value, raw: node.right.value})],
[node.left]
)
);
} else {
path.replaceWithJS(
t.templateLiteral(
[t.templateElement({cooked: '', raw: ''}), t.templateElement({cooked: '', raw: ''}), t.templateElement({cooked: '', raw: ''})],
[node.left, node.right]
)
);
}
path.replaceWithJS({
type: 'BinaryExpression',
operator: '+',
left: node.left,
right: node.right,
});
},

@@ -96,0 +52,0 @@ },

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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