favicon-stealer 1.4.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -31,7 +31,7 @@ import { Favicon } from 'favicon-stealer';
31
31
  | `padding` | `number` | The padding in pixels.(px) Default is 0. |
32
32
  | `background` | `string` | The background color of the favicon. Default is transparent.(in hex) |
33
33
  | `borderRadius` | `number` | The border radius in pixels.(px) Default is 0. |
34
- | `preferGoogle` | `boolean` | Whether to prefer Google's favicon service over the website's own favicon. Default is false. |
34
+ | `preferFallback` | `boolean` | Whether to prefer Google's favicon service over the website's own favicon. Default is false. |
35
35
 
36
36
 
37
37
  # npm package
@@ -48,4 +48,6 @@ MIT License
48
48
  - v1.0.2: Update license to MIT (2025.1.21)
49
49
  - v1.1.0: Fix show bug(2025.2.1)
50
50
  - v1.2.0: Add props(lazy, border, padding, background, borderRadius)(2025.2.1)
51
- - v1.4.0: Improved favicon detection and optimized package size; Added preferGoogle option and improved favicon loading reliability (2025.2.27)
51
+ - v1.4.0: Improved favicon detection and optimized package size; Added preferGoogle option and improved favicon loading reliability (2025.2.27)
52
+ - v1.5.0: Update default timeout to 3000(3 seconds) (2025.2.27)
53
+ - v1.6.0: change prop preferGoogle to preferFallback (2025.2.27)
package/dist/Favicon.js CHANGED
@@ -36,8 +36,8 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
37
  const utils_1 = require("./lib/utils");
38
38
  const react_1 = __importStar(require("react"));
39
- const Favicon = ({ url, size = 32, className = "", timeout = 5000, // 增加到5秒,给网站自己的favicon更多加载时间
40
- border = false, padding = 0, background = "transparent", borderRadius = 0, lazy = false, preferGoogle = false, }) => {
39
+ const Favicon = ({ url, size = 32, className = "", timeout = 3000, // 增加到3秒,给网站自己的favicon更多加载时间
40
+ border = false, padding = 0, background = "transparent", borderRadius = 0, lazy = false, preferFallback = false, }) => {
41
41
  const domain = (0, utils_1.getDomain)(url);
42
42
  const [imgSrc, setImgSrc] = (0, react_1.useState)("");
43
43
  const [fallbackIndex, setFallbackIndex] = (0, react_1.useState)(0);
@@ -62,7 +62,7 @@ border = false, padding = 0, background = "transparent", borderRadius = 0, lazy
62
62
  `https://www.google.com/s2/favicons?domain=http://${domain}&sz=64`,
63
63
  `https://icons.duckduckgo.com/ip3/${domain}.ico`,
64
64
  ];
65
- const fallbackSources = preferGoogle
65
+ const fallbackSources = preferFallback
66
66
  ? [...fallbackServices, ...standardSources]
67
67
  : [...standardSources, ...fallbackServices];
68
68
  (0, react_1.useEffect)(() => {
@@ -9,7 +9,7 @@ interface IProps {
9
9
  background?: string;
10
10
  borderRadius?: number;
11
11
  lazy?: boolean;
12
- preferGoogle?: boolean;
12
+ preferFallback?: boolean;
13
13
  }
14
- declare const Favicon: ({ url, size, className, timeout, border, padding, background, borderRadius, lazy, preferGoogle, }: IProps) => React.JSX.Element;
14
+ declare const Favicon: ({ url, size, className, timeout, border, padding, background, borderRadius, lazy, preferFallback, }: IProps) => React.JSX.Element;
15
15
  export default Favicon;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "favicon-stealer",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/types/index.d.ts",
6
6
  "files": [