UNPKG

marko-widgets

Version:

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

38 lines (36 loc) 1.12 kB
// packages/marko-widgets/src/migrate/w-config-directive.ts import { types as t } from "@marko/compiler"; import { diagnosticDeprecate } from "@marko/babel-utils"; import { isSourceBooleanAttribute } from "@marko/compat-utils"; var w_config_directive_default = { MarkoAttribute(attr) { const { node } = attr; if (node.name !== "w-config") return; diagnosticDeprecate(attr, { label: 'The "w-config" attribute is deprecated. See: https://github.com/marko-js/marko/wiki/Deprecation:-w\u2010config', fix() { const tag = attr.parentPath; attr.remove(); if (!isSourceBooleanAttribute(node)) { tag.insertBefore( t.markoScriptlet([ t.expressionStatement( t.assignmentExpression( "=", t.memberExpression( t.identifier("component"), t.identifier("widgetConfig") ), node.value ) ) ]) ); } } }); } }; export { w_config_directive_default };