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.8.1 to 0.8.2

LICENSE

25

lib/createIconPack.ts

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

import { statSync, promises as fs } from "node:fs";
import * as fs from "node:fs/promises";
import { fileURLToPath, pathToFileURL } from "node:url";

@@ -18,7 +18,17 @@ import resolvePackage from "resolve-pkg";

return async (name: string) => {
const baseUrl = new URL(pathToFileURL(resolvePackage(pkg)) + "/");
const pkgPath = resolvePackage(pkg);
if (!pkgPath) {
throw new Error(
`[astro-icon] Unable to resolve "${pkgPath}"! Is the package installed?"`
);
}
const baseUrl = new URL(pathToFileURL(pkgPath) + "/");
const path = fileURLToPath(
new URL(dir ? `${dir}/${name}.svg` : `${name}.svg`, baseUrl)
);
if (!exists(path)) {
try {
const svg = await fs.readFile(path, "utf8");
return svg;
} catch {
throw new Error(

@@ -28,4 +38,2 @@ `[astro-icon] Unable to load "${path}"! Does the file exist?"`

}
const svg = await fs.readFile(path).then((res) => res.toString());
return svg;
};

@@ -53,8 +61,1 @@ }

}
const exists = (path: string): boolean => {
try {
return statSync(path).isFile();
} catch (e) {}
return false;
};
import { SPRITESHEET_NAMESPACE } from "./constants";
import { Props, Optimize } from "./Props";
import type { Props, Optimize } from "./Props";
import getFromService from "./resolver";

@@ -148,4 +148,5 @@ import { optimize as optimizeSVGNative } from "svgo";

try {
const files = import.meta.globEager(
"/src/icons/**/*.{js,ts,cjs,mjc,cts,mts}"
const files = import.meta.glob(
"/src/icons/**/*.{js,ts,cjs,mjc,cts,mts}",
{ eager: true }
);

@@ -192,3 +193,6 @@ const keys = Object.fromEntries(

try {
const files = import.meta.globEager("/src/icons/**/*.svg", { as: "raw" });
const files = import.meta.glob("/src/icons/**/*.svg", {
eager: true,
as: "raw",
});

@@ -195,0 +199,0 @@ if (!(filepath in files)) {

{
"name": "astro-icon",
"version": "0.8.1",
"version": "0.8.2",
"type": "module",

@@ -39,6 +39,5 @@ "exports": {

"dependencies": {
"node-fetch": "^3.1.0",
"resolve-pkg": "^2.0.0",
"svgo": "^2.8.0"
}
}
}
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