@leancodepl/vite-plugin-favicon 10.1.2 → 10.1.3
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/CHANGELOG.md +12 -0
- package/dist/index.js +31 -23
- package/dist/index.umd.cjs +1 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See
|
|
4
4
|
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [10.1.3](https://github.com/leancodepl/js_corelibrary/compare/v10.1.2...v10.1.3) (2026-04-01)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- correct favicons paths for Vite deduplicated assets
|
|
11
|
+
([64cd032](https://github.com/leancodepl/js_corelibrary/commit/64cd0321c7e61402ec33e97b96e5560b6bc462c4))
|
|
12
|
+
|
|
13
|
+
# Change Log
|
|
14
|
+
|
|
15
|
+
All notable changes to this project will be documented in this file. See
|
|
16
|
+
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
17
|
+
|
|
6
18
|
## [10.1.2](https://github.com/leancodepl/js_corelibrary/compare/v10.1.1...v10.1.2) (2026-02-26)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @leancodepl/vite-plugin-favicon
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { parseFragment as
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
const
|
|
1
|
+
import g from "favicons";
|
|
2
|
+
import u from "node:path";
|
|
3
|
+
import { parseFragment as p } from "parse5";
|
|
4
|
+
function b(a = {}) {
|
|
5
|
+
a.inject ??= !0;
|
|
6
|
+
const c = u.resolve(a.logo ?? u.join("assets", "logo.png"));
|
|
7
7
|
let t;
|
|
8
|
-
const f = async (
|
|
9
|
-
|
|
10
|
-
for (const { name:
|
|
11
|
-
|
|
8
|
+
const f = async (r) => {
|
|
9
|
+
r.addWatchFile(c), t = await g(c, a.favicons);
|
|
10
|
+
for (const { name: i, contents: s } of [...t.files, ...t.images])
|
|
11
|
+
r.emitFile({ type: "asset", name: i, source: s });
|
|
12
12
|
};
|
|
13
13
|
return {
|
|
14
14
|
name: "vite-plugin-favicon",
|
|
@@ -16,26 +16,34 @@ function j(e = {}) {
|
|
|
16
16
|
async buildStart() {
|
|
17
17
|
await f(this);
|
|
18
18
|
},
|
|
19
|
-
transformIndexHtml(
|
|
20
|
-
if (!
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
transformIndexHtml(r, i) {
|
|
20
|
+
if (!a.inject || !t) return;
|
|
21
|
+
const s = [], d = Object.values(i.bundle ?? {}).reduce(
|
|
22
|
+
(n, e) => {
|
|
23
|
+
if (e.type !== "asset") return n;
|
|
24
|
+
for (const o of e.names)
|
|
25
|
+
n[o] = e.fileName;
|
|
26
|
+
return n;
|
|
27
|
+
},
|
|
28
|
+
{}
|
|
29
|
+
);
|
|
30
|
+
for (const n of t.html) {
|
|
31
|
+
const e = p(n).childNodes[0];
|
|
32
|
+
"attrs" in e && s.push({
|
|
33
|
+
tag: e.tagName,
|
|
34
|
+
attrs: e.attrs.reduce(
|
|
35
|
+
(o, l) => {
|
|
36
|
+
const m = d[l.value.slice(1)];
|
|
37
|
+
return o[l.name] = m ? `/${m}` : l.value, o;
|
|
30
38
|
},
|
|
31
39
|
{}
|
|
32
40
|
)
|
|
33
41
|
});
|
|
34
42
|
}
|
|
35
|
-
return
|
|
43
|
+
return s;
|
|
36
44
|
}
|
|
37
45
|
};
|
|
38
46
|
}
|
|
39
47
|
export {
|
|
40
|
-
|
|
48
|
+
b as ViteFaviconsPlugin
|
|
41
49
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("favicons"),require("node:path"),require("parse5")):typeof define=="function"&&define.amd?define(["exports","favicons","node:path","parse5"],n):(e=typeof globalThis<"u"?globalThis:e||self,n(e["@leancodepl/vite-plugin-favicon"]={},e.favicons,e.path,e.parse5))})(this,(function(e,n,
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("favicons"),require("node:path"),require("parse5")):typeof define=="function"&&define.amd?define(["exports","favicons","node:path","parse5"],n):(e=typeof globalThis<"u"?globalThis:e||self,n(e["@leancodepl/vite-plugin-favicon"]={},e.favicons,e.path,e.parse5))})(this,(function(e,n,d,m){"use strict";function v(a={}){a.inject??=!0;const l=d.resolve(a.logo??d.join("assets","logo.png"));let i;const g=async u=>{u.addWatchFile(l),i=await n(l,a.favicons);for(const{name:f,contents:o}of[...i.files,...i.images])u.emitFile({type:"asset",name:f,source:o})};return{name:"vite-plugin-favicon",apply:"build",async buildStart(){await g(this)},transformIndexHtml(u,f){if(!a.inject||!i)return;const o=[],h=Object.values(f.bundle??{}).reduce((s,t)=>{if(t.type!=="asset")return s;for(const r of t.names)s[r]=t.fileName;return s},{});for(const s of i.html){const t=m.parseFragment(s).childNodes[0];"attrs"in t&&o.push({tag:t.tagName,attrs:t.attrs.reduce((r,c)=>{const p=h[c.value.slice(1)];return r[c.name]=p?`/${p}`:c.value,r},{})})}return o}}}e.ViteFaviconsPlugin=v,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqB,MAAM,EAAE,MAAM,MAAM,CAAA;AACrD,OAAiB,EAAE,cAAc,EAAmB,MAAM,UAAU,CAAA;AAIpE;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAClC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,KAAK,kBAAkB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,kBAAuB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqB,MAAM,EAAE,MAAM,MAAM,CAAA;AACrD,OAAiB,EAAE,cAAc,EAAmB,MAAM,UAAU,CAAA;AAIpE;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAClC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,KAAK,kBAAkB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,kBAAuB,GAAG,MAAM,CA4D3E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leancodepl/vite-plugin-favicon",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"sideEffects": false,
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"vite": ">=
|
|
45
|
+
"vite": ">=6.0.0"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"favicons": "^7.2.0",
|