UNPKG

marko-widgets

Version:

<h1 align="center"> <!-- Logo --> <br/> marko-widgets@8 <br/>

30 lines (28 loc) 840 B
// packages/marko-widgets/src/migrate/w-on.ts import { types as t } from "@marko/compiler"; import { diagnosticDeprecate } from "@marko/babel-utils"; var w_on_default = { MarkoAttribute(attr) { var _a; const { node } = attr; if (!node.name.startsWith("w-on")) return; (_a = attr.hub.file.metadata.marko).widgetBind || (_a.widgetBind = true); diagnosticDeprecate(attr, { label: `The "w-on*" attributes are deprecated. Please use "on*()" instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-w\u2010*-Attributes`, fix() { attr.replaceWith( t.markoAttribute( node.name.slice(2), t.booleanLiteral(true), node.modifier, [node.value], node.default ) ); } }); } }; export { w_on_default };