New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-hydroxide

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-hydroxide - npm Package Compare versions

Comparing version 1.1.1 to 1.2.1

70

dist/index.js

@@ -1,2 +0,2 @@

// babel-plugin-hydroxide v1.1.1
// babel-plugin-hydroxide v1.2.1
'use strict';

@@ -105,3 +105,3 @@

const attributes = jsxElement.openingElement.attributes;
return attributes.find((attribute) => {
return attributes.find(attribute => {
return (!t__namespace.isJSXSpreadAttribute(attribute) &&

@@ -270,3 +270,3 @@ !t__namespace.isJSXNamespacedName(attribute.name) &&

const attributes = jsxElement.openingElement.attributes;
const index = attributes.findIndex((at) => at === attr);
const index = attributes.findIndex(at => at === attr);
attributes.splice(index, 1);

@@ -286,5 +286,3 @@ }

return;
const stringExprs = [
...[...programInfo.usedEvents].map((name) => t__namespace.stringLiteral(name))
];
const stringExprs = [...[...programInfo.usedEvents].map(name => t__namespace.stringLiteral(name))];
programInfo.path.node.body.push(t__namespace.expressionStatement(t__namespace.callExpression(registerImportMethod('delegateEvents', 'dom'), [

@@ -380,2 +378,7 @@ t__namespace.arrayExpression(stringExprs)

},
// bind(node, name, value)
bind(node, data) {
const bindId = registerImportMethod('bind', 'dom');
return callStatement(bindId, [node, t__namespace.stringLiteral(data.name), data.value]);
},
// effect(() => setAttribute(node, name, value) )

@@ -410,3 +413,3 @@ singleAttr(node, data) {

// let old1, old2, old3;
const prevValueDeclaration = t__namespace.variableDeclaration('let', prevValueIds.map((prevValueId) => {
const prevValueDeclaration = t__namespace.variableDeclaration('let', prevValueIds.map(prevValueId => {
return t__namespace.variableDeclarator(prevValueId);

@@ -516,7 +519,7 @@ }));

};
nodePaths.forEach((nodePath) => {
nodePaths.forEach(nodePath => {
// start with
let target = tree;
// target
nodePath.forEach((key) => {
nodePath.forEach(key => {
for (let i = 0; i <= key; i++) {

@@ -585,7 +588,7 @@ if (i === 0) {

const fullWalkToOptWalk = {};
targetNodes.forEach((targetNode) => {
targetNodes.forEach(targetNode => {
fullWalkToOptWalk[targetNode.fullWalk] = optWalkOf(targetNode);
});
const intOptWalks = intNodes.map((node) => node.optWalk);
const targetOptWalks = targetNodePaths.map((targetNodePath) => {
const intOptWalks = intNodes.map(node => node.optWalk);
const targetOptWalks = targetNodePaths.map(targetNodePath => {
// calculate the full walk for given target Node

@@ -693,6 +696,6 @@ const fullWalk = nodePathToDomWalk(targetNodePath);

}
attributePaths.forEach((attributePath) => {
attributePaths.forEach(attributePath => {
// spread attribute {...X}
if (t__namespace.isJSXSpreadAttribute(attributePath.node)) {
throw attributePath.buildCodeFrameError('Attribute Spreading is not allowed');
throw attributePath.buildCodeFrameError('attribute Spreading is not allowed');
}

@@ -711,2 +714,6 @@ // normal

const fullName = getAttrName(name);
// bind
if (fullName.startsWith('bind-')) {
throw attributePath.buildCodeFrameError('input binding can not be static');
}
// prop

@@ -742,2 +749,5 @@ if (fullName.startsWith('prop-')) {

const fullName = getAttrName(name);
if (fullName.startsWith('bind-')) {
throw attributePath.buildCodeFrameError('input binding can not be static');
}
if (fullName.startsWith('prop-')) {

@@ -770,2 +780,11 @@ elementJSXInfo.hydrations.push({

}
// bind-
else if (fullName.startsWith('bind-')) {
// static prop hydration
elementJSXInfo.hydrations.push({
type: 'Bind',
data: { name: fullName.substring(5), value: expr },
address
});
}
// ref

@@ -947,3 +966,3 @@ else if (fullName === 'ref') {

}
childrenJSXInfo.forEach((childJSXInfo) => {
childrenJSXInfo.forEach(childJSXInfo => {
elementJSXInfo.hydrations.push(...childJSXInfo.hydrations);

@@ -987,3 +1006,3 @@ elementJSXInfo.html += childJSXInfo.html;

t__namespace.isJSXEmptyExpression(ifAttr.value.expression)) {
throw jsxNodePath.buildCodeFrameError('invalid value for $:if');
throw jsxNodePath.buildCodeFrameError('Invalid value for a conditional attribute');
}

@@ -1031,3 +1050,3 @@ // remove if attribute to avoid infinite loop

if (t__namespace.isJSXEmptyExpression(elseIfAttr.value.expression)) {
throw jsxNodePath.buildCodeFrameError('invalid elseIf condition value');
throw jsxNodePath.buildCodeFrameError('Invalid value for a conditional attribute');
}

@@ -1087,3 +1106,3 @@ branches.push(t__namespace.arrayExpression([

else {
props.push(wrapInGetterMethod('children', t__namespace.arrayExpression(childrenExprs.map((expr) => wrapInArrowIfNeeded(expr)))));
props.push(wrapInGetterMethod('children', t__namespace.arrayExpression(childrenExprs.map(expr => wrapInArrowIfNeeded(expr)))));
}

@@ -1131,3 +1150,3 @@ }

if (t__namespace.isJSXSpreadAttribute(attribute)) {
throw jsxElementPath.buildCodeFrameError('Spread props are not allowed');
throw jsxElementPath.buildCodeFrameError('Prop Spreading is not allowed');
}

@@ -1182,3 +1201,3 @@ // normal attribute

const childrenExprs = [];
childPaths.forEach((childPath) => {
childPaths.forEach(childPath => {
// JSXElement

@@ -1328,3 +1347,3 @@ if (isPathOf.JSXElement(childPath)) {

.slice(1)
.map((x) => (x === 'f' ? 'firstChild' : 'nextSibling'))
.map(x => (x === 'f' ? 'firstChild' : 'nextSibling'))
.join('.');

@@ -1339,3 +1358,3 @@ const nodeValue = template__default["default"](`OBJ.${subPath}`)({

}
const [intermediateDomWalks, targetDOMWalks] = getOptWalks(hydrations.map((h) => h.address));
const [intermediateDomWalks, targetDOMWalks] = getOptWalks(hydrations.map(h => h.address));
// create intermediate nodes

@@ -1349,3 +1368,3 @@ intermediateDomWalks.forEach((domWalk, i) => {

hydratorBlock.body.push(t__namespace.variableDeclaration('const', [
...nodesToDeclare.map((declaration) => {
...nodesToDeclare.map(declaration => {
return t__namespace.variableDeclarator(declaration[0], declaration[1]);

@@ -1378,2 +1397,7 @@ })

}
case 'Bind': {
programInfo.usedEvents.add('input');
hydratorBlock.body.push(hydrate.bind(node, hydration.data));
break;
}
case 'Branch': {

@@ -1380,0 +1404,0 @@ hydratorBlock.body.push(hydrate.branch(node, hydration.data));

{
"name": "babel-plugin-hydroxide",
"description": "Compiler for Hydroxide Framework",
"version": "1.1.1",
"version": "1.2.1",
"author": "Manan Tank",

@@ -6,0 +6,0 @@ "license": "MIT",

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