@svgr/babel-plugin-transform-svg-component
Advanced tools
Comparing version 7.0.0 to 8.0.0
@@ -43,5 +43,5 @@ 'use strict'; | ||
}; | ||
const getOrCreateImport = ({ imports }, sourceValue) => { | ||
const getOrCreateImport = ({ imports }, sourceValue, importKind = void 0) => { | ||
const existing = imports.find( | ||
(imp2) => imp2.source.value === sourceValue && !imp2.specifiers.some( | ||
(imp2) => imp2.source.value === sourceValue && imp2.importKind === importKind && !imp2.specifiers.some( | ||
(specifier) => specifier.type === "ImportNamespaceSpecifier" | ||
@@ -53,2 +53,5 @@ ) | ||
const imp = core.types.importDeclaration([], core.types.stringLiteral(sourceValue)); | ||
if (importKind !== void 0) { | ||
imp.importKind = importKind; | ||
} | ||
imports.push(imp); | ||
@@ -60,3 +63,3 @@ return imp; | ||
const identifier2 = core.types.identifier("SvgProps"); | ||
getOrCreateImport(ctx, "react-native-svg").specifiers.push( | ||
getOrCreateImport(ctx, "react-native-svg", "type").specifiers.push( | ||
core.types.importSpecifier(identifier2, identifier2) | ||
@@ -67,3 +70,3 @@ ); | ||
const identifier = core.types.identifier("SVGProps"); | ||
getOrCreateImport(ctx, ctx.importSource).specifiers.push( | ||
getOrCreateImport(ctx, ctx.importSource, "type").specifiers.push( | ||
core.types.importSpecifier(identifier, identifier) | ||
@@ -70,0 +73,0 @@ ); |
{ | ||
"name": "@svgr/babel-plugin-transform-svg-component", | ||
"description": "Transform SVG into component", | ||
"version": "7.0.0", | ||
"version": "8.0.0", | ||
"main": "./dist/index.js", | ||
@@ -37,5 +37,8 @@ "types": "./dist/index.d.ts", | ||
"build": "rollup -c ../../build/rollup.config.mjs", | ||
"prepublishOnly": "npm run reset && npm run build" | ||
"prepublishOnly": "pnpm run reset && pnpm run build" | ||
}, | ||
"gitHead": "3b04a923ae6e0945a9401ad7da7efe26204c8390" | ||
"devDependencies": { | ||
"@types/babel__template": "^7.4.1" | ||
}, | ||
"gitHead": "52a1079681477587ef0d842c0e78531adf2d2520" | ||
} |
Sorry, the diff of this file is not supported yet
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
32766
345
1