Socket
Book a DemoInstallSign in
Socket

babel-plugin-mithril-add-data-attribute

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-mithril-add-data-attribute - npm Package Compare versions

Comparing version

to
1.0.5

59

lib/index.dev.js

@@ -216,3 +216,3 @@ "use strict";

});
path.skip(); // only add attr to first m-call in an expession
path.stop(); // only add attr to first m-call in an expession
},

@@ -245,4 +245,3 @@

}) => {
console.log("Ö -- ObjectExpression"); // insert into object
console.log("Ö -- ObjectExpression");
const hasDataAttribute = path.node.properties.find(property => t.isObjectProperty(property) && t.isStringLiteral(property.key, {

@@ -253,2 +252,3 @@ value: DATA_ATTRIBUTE

if (hasDataAttribute) {
path.stop();
return;

@@ -258,3 +258,3 @@ }

path.node.properties.push(createObjectProperties(name));
path.stop();
path.skip();
},

@@ -388,11 +388,46 @@ Identifier: (path, state) => {

const test = testTransform(`
export default class extends m.Component {
view() {
return m("div");
}
}
`, {}, {
filename
});
const Button = {
oncreate(vnode) {
if (vnode.attrs.hoverLabel) {
this.tooltip = createHoverTooltip(vnode);
}
},
onupdate(vnode) {
if (vnode.attrs.hoverLabel && !this.tooltip) {
this.tooltip = createHoverTooltip(vnode);
}
if (this.tooltip) {
const tooltip = typeof vnode.attrs.hoverLabel === "string" ? vnode.attrs.hoverLabel : null;
if (vnode.attrs.disabled || !tooltip) {
this.tooltip.disable();
} else if (tooltip) {
this.tooltip.setContent(tooltip);
this.tooltip.enable();
}
}
},
onbeforeremove() {
if (this.tooltip) {
this.tooltip.destroy();
}
},
view: (vnode) => {
const { type = "button", onclick, disabled, label, ...attrs } = vnode.attrs;
return m(
"div",
{
...attrs,
type,
class: getClassName(vnode.attrs),
roffe: "leffe",
onclick: disabled ? undefined : onclick,
disabled: disabled ? "disabled" : undefined,
},
label
);
},
};
`);
test;
console.log(test);

@@ -227,2 +227,3 @@ "use strict";

if (hasDataAttribute) {
path.stop();
return;

@@ -229,0 +230,0 @@ }

{
"name": "babel-plugin-mithril-add-data-attribute",
"version": "1.0.3",
"version": "1.0.5",
"description": "Babel plugin adds attributes to m() components - intended for development. Helps debug - find your components in a large repo. Adds component name and file to component data attributes which will be visible in the generated HTML.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.