react-inlinesvg
Advanced tools
Comparing version 4.0.5 to 4.0.6
@@ -127,3 +127,3 @@ "use strict"; | ||
cacheName = window.REACT_INLINESVG_CACHE_NAME ?? CACHE_NAME; | ||
usePersistentCache = !!window.REACT_INLINESVG_PERSISTENT_CACHE; | ||
usePersistentCache = !!window.REACT_INLINESVG_PERSISTENT_CACHE && "caches" in window; | ||
} | ||
@@ -135,2 +135,5 @@ if (usePersistentCache) { | ||
this.subscribers.forEach((callback) => callback()); | ||
}).catch((error) => { | ||
this.isReady = true; | ||
console.error(`Failed to open cache: ${error.message}`); | ||
}); | ||
@@ -137,0 +140,0 @@ } else { |
{ | ||
"name": "react-inlinesvg", | ||
"version": "4.0.5", | ||
"version": "4.0.6", | ||
"description": "An SVG loader for React", | ||
@@ -62,7 +62,6 @@ "author": "Gil Barbara <gilbarbara@gmail.com>", | ||
"@size-limit/preset-small-lib": "^9.0.0", | ||
"@testing-library/jest-dom": "^6.1.3", | ||
"@testing-library/jest-dom": "^6.1.4", | ||
"@testing-library/react": "^14.0.0", | ||
"@types/exenv": "^1.2.0", | ||
"@types/fetch-mock": "^7.3.6", | ||
"@types/jest": "^29.5.5", | ||
"@types/node": "^20.8.2", | ||
@@ -72,4 +71,4 @@ "@types/node-fetch": "^2.6.6", | ||
"@types/react-dom": "^18.2.8", | ||
"@vitest/coverage-v8": "^0.34.6", | ||
"browser-cache-mock": "^0.1.7", | ||
"cross-fetch": "^4.0.0", | ||
"del-cli": "^5.1.0", | ||
@@ -79,8 +78,4 @@ "fix-tsup-cjs": "^1.2.0", | ||
"husky": "^8.0.3", | ||
"jest": "^29.7.0", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"jest-extended": "^4.0.1", | ||
"jest-fetch-mock": "^3.0.3", | ||
"jest-serializer-html": "^7.1.0", | ||
"jest-watch-typeahead": "^2.2.2", | ||
"jest-extended": "^4.0.2", | ||
"jsdom": "^22.1.0", | ||
"react": "^18.2.0", | ||
@@ -91,6 +86,7 @@ "react-dom": "^18.2.0", | ||
"start-server-and-test": "^2.0.1", | ||
"ts-jest": "^29.1.1", | ||
"ts-node": "^10.9.1", | ||
"tsup": "^7.2.0", | ||
"typescript": "^5.2.2" | ||
"typescript": "^5.2.2", | ||
"vitest": "^0.34.6", | ||
"vitest-fetch-mock": "^0.2.2" | ||
}, | ||
@@ -101,8 +97,8 @@ "scripts": { | ||
"clean": "del dist/*", | ||
"lint": "eslint src test", | ||
"start": "http-server test/__fixtures__ -p 1337 --cors", | ||
"lint": "eslint src test", | ||
"test": "start-server-and-test start http://127.0.0.1:1337 test:coverage", | ||
"test:coverage": "jest --coverage --bail", | ||
"test:watch": "jest --watchAll --verbose", | ||
"typecheck": "tsc --noEmit", | ||
"test:coverage": "vitest run --coverage", | ||
"test:watch": "vitest watch", | ||
"typecheck": "tsc -p test/tsconfig.json", | ||
"size": "size-limit", | ||
@@ -150,3 +146,3 @@ "validate": "pnpm run lint && pnpm run typecheck && pnpm run test && pnpm run build && pnpm run size", | ||
"path": "./dist/index.js", | ||
"limit": "11 KB" | ||
"limit": "10 KB" | ||
}, | ||
@@ -156,5 +152,5 @@ { | ||
"path": "./dist/index.mjs", | ||
"limit": "9 KB" | ||
"limit": "10 KB" | ||
} | ||
] | ||
} |
@@ -19,12 +19,20 @@ import { CACHE_MAX_RETRIES, CACHE_NAME, STATUS } from './config'; | ||
cacheName = window.REACT_INLINESVG_CACHE_NAME ?? CACHE_NAME; | ||
usePersistentCache = !!window.REACT_INLINESVG_PERSISTENT_CACHE; | ||
usePersistentCache = !!window.REACT_INLINESVG_PERSISTENT_CACHE && 'caches' in window; | ||
} | ||
if (usePersistentCache) { | ||
caches.open(cacheName).then(cache => { | ||
this.cacheApi = cache; | ||
this.isReady = true; | ||
caches | ||
.open(cacheName) | ||
.then(cache => { | ||
this.cacheApi = cache; | ||
this.isReady = true; | ||
this.subscribers.forEach(callback => callback()); | ||
}); | ||
this.subscribers.forEach(callback => callback()); | ||
}) | ||
.catch(error => { | ||
this.isReady = true; | ||
// eslint-disable-next-line no-console | ||
console.error(`Failed to open cache: ${error.message}`); | ||
}); | ||
} else { | ||
@@ -31,0 +39,0 @@ this.isReady = true; |
@@ -34,3 +34,3 @@ import type { PlainObject } from './types'; | ||
export function supportsInlineSVG(): boolean { | ||
/* istanbul ignore next */ | ||
/* c8 ignore next 3 */ | ||
if (!document) { | ||
@@ -76,3 +76,2 @@ return false; | ||
for (const key in input) { | ||
/* istanbul ignore else */ | ||
if ({}.hasOwnProperty.call(input, key)) { | ||
@@ -79,0 +78,0 @@ if (!filter.includes(key as unknown as K)) { |
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
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
125322
31
1680