New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-inlinesvg

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-inlinesvg - npm Package Compare versions

Comparing version 4.1.5 to 4.1.6

33

dist/index.d.ts

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

import * as React from 'react';
import React__default from 'react';
import React, { SVGProps, ReactNode, RefObject } from 'react';

@@ -17,10 +16,10 @@ declare const STATUS: {

type PreProcessorCallback = (code: string) => string;
type Props = Simplify<Omit<React.SVGProps<SVGElement>, 'onLoad' | 'onError' | 'ref'> & {
type Props = Simplify<Omit<SVGProps<SVGElement>, 'onLoad' | 'onError' | 'ref'> & {
baseURL?: string;
cacheRequests?: boolean;
children?: React.ReactNode;
children?: ReactNode;
description?: string;
fetchOptions?: RequestInit;
innerRef?: React.Ref<SVGElement>;
loader?: React.ReactNode;
innerRef?: RefObject<SVGElement | null>;
loader?: ReactNode;
onError?: ErrorCallback;

@@ -34,8 +33,6 @@ onLoad?: LoadCallback;

}>;
interface State {
content: string;
element: React.ReactNode;
isCached: boolean;
status: Status;
}
type Simplify<T> = {
[KeyType in keyof T]: T[KeyType];
} & {};
type Status = (typeof STATUS)[keyof typeof STATUS];
interface FetchError extends Error {

@@ -47,6 +44,8 @@ code: string;

}
type Simplify<T> = {
[KeyType in keyof T]: T[KeyType];
} & {};
type Status = (typeof STATUS)[keyof typeof STATUS];
interface State {
content: string;
element: ReactNode;
isCached: boolean;
status: Status;
}
interface StorageItem {

@@ -77,5 +76,5 @@ content: string;

declare let cacheStore: CacheStore;
declare function InlineSVG(props: Props): string | number | boolean | Iterable<React__default.ReactNode> | React__default.JSX.Element | null | undefined;
declare function InlineSVG(props: Props): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
export { type ErrorCallback, type FetchError, type LoadCallback, type PlainObject, type PreProcessorCallback, type Props, type Simplify, type State, type Status, type StorageItem, cacheStore, InlineSVG as default };
export = InlineSVG

@@ -56,4 +56,7 @@ "use client";

// src/modules/helpers.ts
function randomCharacter(character) {
return character[Math.floor(Math.random() * character.length)];
}
function canUseDOM() {
return !!(typeof window !== "undefined" && window.document && window.document.createElement);
return !!window?.document?.createElement;
}

@@ -63,2 +66,23 @@ function isSupportedEnvironment() {

}
function omit(input, ...filter) {
const output = {};
for (const key in input) {
if ({}.hasOwnProperty.call(input, key)) {
if (!filter.includes(key)) {
output[key] = input[key];
}
}
}
return output;
}
function randomString(length) {
const letters = "abcdefghijklmnopqrstuvwxyz";
const numbers = "1234567890";
const charset = `${letters}${letters.toUpperCase()}${numbers}`;
let R = "";
for (let index = 0; index < length; index++) {
R += randomCharacter(charset);
}
return R;
}
async function request(url, options) {

@@ -90,26 +114,2 @@ const response = await fetch(url, options);

}
function randomCharacter(character) {
return character[Math.floor(Math.random() * character.length)];
}
function randomString(length) {
const letters = "abcdefghijklmnopqrstuvwxyz";
const numbers = "1234567890";
const charset = `${letters}${letters.toUpperCase()}${numbers}`;
let R = "";
for (let index = 0; index < length; index++) {
R += randomCharacter(charset);
}
return R;
}
function omit(input, ...filter) {
const output = {};
for (const key in input) {
if ({}.hasOwnProperty.call(input, key)) {
if (!filter.includes(key)) {
output[key] = input[key];
}
}
}
return output;
}

@@ -245,3 +245,3 @@ // src/modules/cache.ts

function usePrevious(state) {
const ref = (0, import_react.useRef)();
const ref = (0, import_react.useRef)(void 0);
(0, import_react.useEffect)(() => {

@@ -522,3 +522,6 @@ ref.current = state;

if (element) {
return (0, import_react2.cloneElement)(element, { ref: innerRef, ...elementProps });
return (0, import_react2.cloneElement)(element, {
ref: innerRef,
...elementProps
});
}

@@ -525,0 +528,0 @@ if ([STATUS.UNSUPPORTED, STATUS.FAILED].includes(status)) {

@@ -30,3 +30,3 @@ "use client";

function canUseDOM() {
return !!(typeof window !== "undefined" && window.document && window.document.createElement);
return !!window?.document?.createElement;
}

@@ -33,0 +33,0 @@

{
"name": "react-inlinesvg",
"version": "4.1.5",
"version": "4.1.6",
"description": "An SVG loader for React",

@@ -54,7 +54,7 @@ "author": "Gil Barbara <gilbarbara@gmail.com>",

"dependencies": {
"react-from-dom": "^0.7.3"
"react-from-dom": "^0.7.5"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.0",
"@gilbarbara/eslint-config": "^0.8.2",
"@arethetypeswrong/cli": "^0.17.3",
"@gilbarbara/eslint-config": "^0.8.4",
"@gilbarbara/prettier-config": "^1.0.0",

@@ -64,8 +64,8 @@ "@gilbarbara/tsconfig": "^0.2.3",

"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@types/node": "^22.9.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.3",
"@vitest/coverage-v8": "^2.1.5",
"@testing-library/react": "^16.1.0",
"@types/node": "^22.10.6",
"@types/react": "^19.0.7",
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^4.3.4",
"@vitest/coverage-v8": "^2.1.8",
"browser-cache-mock": "^0.1.7",

@@ -75,15 +75,15 @@ "del-cli": "^6.0.0",

"http-server": "^14.1.1",
"husky": "^9.1.6",
"husky": "^9.1.7",
"jest-extended": "^4.0.2",
"jsdom": "^25.0.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"jsdom": "^26.0.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"repo-tools": "^0.3.1",
"size-limit": "^11.1.6",
"start-server-and-test": "^2.0.8",
"start-server-and-test": "^2.0.10",
"ts-node": "^10.9.2",
"tsup": "^8.3.5",
"typescript": "^5.6.3",
"vitest": "^2.1.5",
"vitest-fetch-mock": "^0.4.2"
"typescript": "^5.7.3",
"vitest": "^2.1.8",
"vitest-fetch-mock": "^0.4.3"
},

@@ -90,0 +90,0 @@ "scripts": {

@@ -1,6 +0,6 @@

import { canUseDOM, request, sleep } from './helpers';
import { CACHE_MAX_RETRIES, CACHE_NAME, STATUS } from '../config';
import { StorageItem } from '../types';
import { canUseDOM, request, sleep } from './helpers';
export default class CacheStore {

@@ -7,0 +7,0 @@ private cacheApi: Cache | undefined;

import type { PlainObject } from '../types';
function randomCharacter(character: string) {
return character[Math.floor(Math.random() * character.length)];
}
export function canUseDOM(): boolean {
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
return !!window?.document?.createElement;
}

@@ -11,2 +15,36 @@

/**
* Remove properties from an object
*/
export function omit<T extends PlainObject, K extends keyof T>(
input: T,
...filter: K[]
): Omit<T, K> {
const output: any = {};
for (const key in input) {
if ({}.hasOwnProperty.call(input, key)) {
if (!filter.includes(key as unknown as K)) {
output[key] = input[key];
}
}
}
return output as Omit<T, K>;
}
export function randomString(length: number): string {
const letters = 'abcdefghijklmnopqrstuvwxyz';
const numbers = '1234567890';
const charset = `${letters}${letters.toUpperCase()}${numbers}`;
let R = '';
for (let index = 0; index < length; index++) {
R += randomCharacter(charset);
}
return R;
}
export async function request(url: string, options?: RequestInit) {

@@ -47,39 +85,1 @@ const response = await fetch(url, options);

}
function randomCharacter(character: string) {
return character[Math.floor(Math.random() * character.length)];
}
export function randomString(length: number): string {
const letters = 'abcdefghijklmnopqrstuvwxyz';
const numbers = '1234567890';
const charset = `${letters}${letters.toUpperCase()}${numbers}`;
let R = '';
for (let index = 0; index < length; index++) {
R += randomCharacter(charset);
}
return R;
}
/**
* Remove properties from an object
*/
export function omit<T extends PlainObject, K extends keyof T>(
input: T,
...filter: K[]
): Omit<T, K> {
const output: any = {};
for (const key in input) {
if ({}.hasOwnProperty.call(input, key)) {
if (!filter.includes(key as unknown as K)) {
output[key] = input[key];
}
}
}
return output as Omit<T, K>;
}

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

import * as React from 'react';
import { ReactNode, RefObject, SVGProps } from 'react';

@@ -11,10 +11,10 @@ import { STATUS } from './config';

export type Props = Simplify<
Omit<React.SVGProps<SVGElement>, 'onLoad' | 'onError' | 'ref'> & {
Omit<SVGProps<SVGElement>, 'onLoad' | 'onError' | 'ref'> & {
baseURL?: string;
cacheRequests?: boolean;
children?: React.ReactNode;
children?: ReactNode;
description?: string;
fetchOptions?: RequestInit;
innerRef?: React.Ref<SVGElement>;
loader?: React.ReactNode;
innerRef?: RefObject<SVGElement | null>;
loader?: ReactNode;
onError?: ErrorCallback;

@@ -30,9 +30,6 @@ onLoad?: LoadCallback;

export interface State {
content: string;
element: React.ReactNode;
isCached: boolean;
status: Status;
}
export type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
export type Status = (typeof STATUS)[keyof typeof STATUS];
export interface FetchError extends Error {

@@ -45,6 +42,9 @@ code: string;

export type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
export interface State {
content: string;
element: ReactNode;
isCached: boolean;
status: Status;
}
export type Status = (typeof STATUS)[keyof typeof STATUS];
export interface StorageItem {

@@ -51,0 +51,0 @@ content: string;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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