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.7.3 to 0.8.0

29

lib/context.ts

@@ -1,24 +0,27 @@

const AstroIcon = Symbol("AstroIcon");
interface AstroRequest extends Request {}
export function trackSprite(result: any, name: string) {
if (typeof result[AstroIcon] !== "undefined") {
result[AstroIcon]["sprites"].add(name);
const sprites = new WeakMap<AstroRequest, Set<string>>();
export function trackSprite(request: AstroRequest, name: string): void {
let currentSet = sprites.get(request);
if (!currentSet) {
currentSet = new Set([name]);
} else {
result[AstroIcon] = {
sprites: new Set([name]),
};
currentSet.add(name);
}
sprites.set(request, currentSet);
}
const warned = new Set();
export async function getUsedSprites(result: any) {
if (typeof result[AstroIcon] !== "undefined") {
return Array.from(result[AstroIcon]["sprites"]);
export async function getUsedSprites(request: AstroRequest): Promise<string[]> {
const currentSet = sprites.get(request);
if (currentSet) {
return Array.from(currentSet);
}
const pathname = result._metadata.pathname;
if (!warned.has(pathname)) {
if (!warned.has(request)) {
const { pathname } = new URL(request.url);
console.log(`[astro-icon] No sprites found while rendering "${pathname}"`);
warned.add(pathname);
warned.add(request);
}
return [];
}

@@ -1,3 +0,3 @@

import { statSync, promises as fs } from "fs";
import { fileURLToPath, pathToFileURL } from "url";
import { statSync, promises as fs } from "node:fs";
import { fileURLToPath, pathToFileURL } from "node:url";
import resolvePackage from "resolve-pkg";

@@ -4,0 +4,0 @@

@@ -173,3 +173,3 @@ /// <reference types="vite/client" />

}
const contents = await get(name);
const contents = await get(name, inputProps);
if (!contents) {

@@ -176,0 +176,0 @@ throw new Error(

{
"name": "astro-icon",
"version": "0.7.3",
"version": "0.8.0",
"type": "module",

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

@@ -5,6 +5,4 @@ # Astro Icon

## Setup
## Install `astro-icon`.
1. Install `astro-icon`.
```bash

@@ -16,14 +14,2 @@ npm i astro-icon

2. Add the following to your `astro.config.mjs` file. See [Issue #2](https://github.com/natemoo-re/astro-icon/issues/2).
```js
export default {
vite: {
ssr: {
external: ["svgo"],
},
},
};
```
## Icon Packs

@@ -30,0 +16,0 @@

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