Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

astro-icon

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

astro-icon - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

19

lib/utils.ts

@@ -0,1 +1,2 @@

import { SPRITESHEET_NAMESPACE } from "./constants";
import { Props, Optimize } from "./Props";

@@ -23,3 +24,7 @@ import getFromService from "./resolver";

function optimizeSvg(contents: string, options: Optimize): string {
function optimizeSvg(
contents: string,
name: string,
options: Optimize
): string {
return optimizeSVGNative(contents, {

@@ -36,3 +41,6 @@ plugins: [

"convertStyleToAttrs",
"cleanupIDs",
{
name: "cleanupIDs",
params: { prefix: `${SPRITESHEET_NAMESPACE}:${name}` },
},
"removeRasterImages",

@@ -71,3 +79,3 @@ "removeUselessDefs",

const preprocessCache = new Map();
export function preprocess(contents: string, { optimize }) {
export function preprocess(contents: string, name: string, { optimize }) {
if (preprocessCache.has(contents)) {

@@ -77,3 +85,3 @@ return preprocessCache.get(contents);

if (optimize) {
contents = optimizeSvg(contents, optimize);
contents = optimizeSvg(contents, name, optimize);
}

@@ -128,2 +136,3 @@ domParserTokenizer.lastIndex = 0;

) {
const key = name;
if (!name) {

@@ -191,3 +200,3 @@ throw new Error("<Icon> requires a name!");

const { innerHTML, defaultProps } = preprocess(svg, { optimize });
const { innerHTML, defaultProps } = preprocess(svg, key, { optimize });

@@ -194,0 +203,0 @@ if (!innerHTML.trim()) {

{
"name": "astro-icon",
"version": "0.5.0",
"version": "0.5.1",
"type": "module",

@@ -5,0 +5,0 @@ "exports": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc