babel-plugin-estrela
Advanced tools
Comparing version 0.11.0 to 0.11.1
export declare const selfClosingTags: string[]; | ||
export declare const svgTags: string[]; |
import { NodePath, types as t } from '@babel/core'; | ||
declare type JSXElement = t.JSXElement | t.JSXFragment; | ||
type JSXElement = t.JSXElement | t.JSXFragment; | ||
export declare function transformJSX(path: NodePath<JSXElement>): void; | ||
export {}; |
@@ -5,3 +5,3 @@ { | ||
"author": "Eduardo Rosostolato", | ||
"version": "0.11.0", | ||
"version": "0.11.1", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "main": "dist/index.js", |
@@ -17,1 +17,23 @@ export const selfClosingTags = [ | ||
]; | ||
export const svgTags = [ | ||
'circle', | ||
'clipPath', | ||
'defs', | ||
'ellipse', | ||
'filter', | ||
'g', | ||
'line', | ||
'linearGradient', | ||
'mask', | ||
'path', | ||
'pattern', | ||
'polygon', | ||
'polyline', | ||
'radialGradient', | ||
'rect', | ||
'stop', | ||
'symbol', | ||
'text', | ||
'use', | ||
]; |
import { NodePath, types as t } from '@babel/core'; | ||
import { selfClosingTags } from '../shared/tags'; | ||
import { selfClosingTags, svgTags } from '../shared/tags'; | ||
import { State } from '../types'; | ||
@@ -147,2 +147,3 @@ | ||
const isSelfClosing = !tagIsComponent && selfClosingTags.includes(tagName); | ||
const isSvgTemplate = svgTags.includes(tagName) && result.index === 1; | ||
const props = getAttrProps(path); | ||
@@ -166,8 +167,7 @@ | ||
} else { | ||
if (isSvgTemplate) { | ||
result.template += `<svg _tmpl_>`; | ||
} | ||
result.template += `<${tagName}`; | ||
if (tagName === 'slot') { | ||
result.props[result.index] = props; | ||
} else { | ||
handleAttributes(props, result); | ||
} | ||
handleAttributes(props, result); | ||
result.template += isSelfClosing ? '/>' : '>'; | ||
@@ -210,6 +210,2 @@ if (!isSelfClosing) { | ||
if (prop === 'slot') { | ||
continue; | ||
} | ||
if (prop === 'class' && typeof value === 'string') { | ||
@@ -216,0 +212,0 @@ klass += ` ${value}`; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
171367
4765