vite-plugin-material-symbols 0.4.0 → 0.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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Version 0
4
4
 
5
+ ### v0.6.0
6
+
7
+ - Supporting Vite 7.
8
+
9
+ ### v0.5.0
10
+
11
+ - Supporting Node 24.
12
+
5
13
  ### v0.4.0
6
14
 
7
15
  - New option: `preload`, boolean:
package/README.md CHANGED
@@ -18,8 +18,8 @@ the font downloaded by the user.
18
18
 
19
19
  ## Requirements
20
20
 
21
- - Node.js `^20 || ^22`;
22
- - Vite `^6.0.0` (though, it might work with v5 as well).
21
+ - Node.js `^20 || ^22 || ^24`;
22
+ - Vite `^6 || ^7`.
23
23
 
24
24
  ## Installation
25
25
 
package/dist/index.d.ts CHANGED
@@ -1,25 +1,30 @@
1
- import { Plugin } from 'vite';
1
+ import { Plugin } from "vite";
2
2
 
3
+ //#region src/index.d.ts
3
4
  type PluginOptions = {
4
- /**
5
- * Material Symbols CSS Provider. Default: outlined, no infill, 24px, weight 400
6
- * @see https://fonts.google.com/icons?icon.set=Material+Symbols
7
- * @default () => `https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined...&${iconNamesParam}`
8
- * */
9
- getUrl: (iconNamesParam: string) => string;
10
- /**
11
- * The name of JSX component to obtain the icon names from
12
- * @default Icon
13
- * */
14
- component: string;
15
- /**
16
- * Enables higher priority for loading symbols
17
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload
18
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preconnect
19
- * @default false
20
- */
21
- preload: boolean;
5
+ /**
6
+ * Material Symbols CSS Provider. Default: outlined, no infill, 24px, weight 400
7
+ * @see https://fonts.google.com/icons?icon.set=Material+Symbols
8
+ * @default () => `https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined...&${iconNamesParam}`
9
+ * */
10
+ getUrl: (iconNamesParam: string) => string;
11
+ /**
12
+ * The name of JSX component to obtain the icon names from
13
+ * @default Icon
14
+ * */
15
+ component: string;
16
+ /**
17
+ * Enables higher priority for loading symbols
18
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload
19
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preconnect
20
+ * @default false
21
+ */
22
+ preload: boolean;
22
23
  };
23
- declare const plugin: ({ component, getUrl, preload, }?: Partial<PluginOptions>) => Plugin;
24
-
25
- export { plugin as default };
24
+ declare const plugin: ({
25
+ component,
26
+ getUrl,
27
+ preload
28
+ }?: Partial<PluginOptions>) => Plugin;
29
+ //#endregion
30
+ export { plugin as default };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import esquery from "esquery";const isStringLiteral=(h)=>h.type==="Literal"&&"value"in h&&typeof h.value==="string",defaultUrlProvider=(h)=>`https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&${h}`,makeSelector=(h)=>[`CallExpression[callee.name='jsx'][arguments.0.name='${h}']`,".arguments","Property[key.name='children'] Literal"].join(" > "),makeIconNamesParam=(h)=>{if(!h.size)return "";const i=[];for(const j of h.values())i.push(j);return `icon_names=${i.toSorted().join(",")}`},plugin=({component:h="Icon",getUrl:i=defaultUrlProvider,preload:j=!1}={})=>{const k=new Set();return {name:"material-symbols",enforce:"pre",moduleParsed:function({id:l,ast:m}){if(!m)return;const n=esquery.query(m,makeSelector(h)).filter(isStringLiteral);for(const {value:o}of n)this.debug({id:l,message:o}),k.add(o)},transformIndexHtml:(l)=>{const m=i(makeIconNamesParam(k)),n=[{injectTo:"head",tag:"link",attrs:{rel:"stylesheet",href:m}}];if(j)n.push({injectTo:"head-prepend",tag:"link",attrs:{rel:"preload",as:"style",href:m}},{injectTo:"head-prepend",tag:"link",attrs:{rel:"preconnect",href:"https://fonts.gstatic.com"}});return {html:l,tags:n}}}};var src_default=plugin;export {src_default as default};
1
+ import e from"esquery";const t=e=>e.type===`Literal`&&`value`in e&&typeof e.value==`string`,n=e=>`https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&${e}`,r=e=>[`CallExpression[callee.name='jsx'][arguments.0.name='${e}']`,`.arguments`,`Property[key.name='children'] Literal`].join(` > `),i=e=>{if(!e.size)return``;let t=[];for(let n of e.values())t.push(n);return`icon_names=${t.toSorted().join(`,`)}`},a=({component:a=`Icon`,getUrl:o=n,preload:s=!1}={})=>{let c=new Set;return{name:`material-symbols`,enforce:`pre`,moduleParsed:function({id:n,ast:i}){if(!i)return;let o=e.query(i,r(a)).filter(t);for(let{value:e}of o)this.debug({id:n,message:e}),c.add(e)},transformIndexHtml:e=>{let t=o(i(c)),n=[{injectTo:`head`,tag:`link`,attrs:{rel:`stylesheet`,href:t}}];return s&&n.push({injectTo:`head-prepend`,tag:`link`,attrs:{rel:`preload`,as:`style`,href:t}},{injectTo:`head-prepend`,tag:`link`,attrs:{rel:`preconnect`,href:`https://fonts.gstatic.com`}}),{html:e,tags:n}}}};var o=a;export{o as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-material-symbols",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Selective loading of Material Symbols for production",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -30,29 +30,29 @@
30
30
  "*.md"
31
31
  ],
32
32
  "engines": {
33
- "node": "^20 || ^22"
33
+ "node": "^20 || ^22 || ^24"
34
34
  },
35
35
  "peerDependencies": {
36
- "vite": "^6.0.0"
36
+ "vite": "^6.0.0 || ^7.0.0"
37
37
  },
38
38
  "dependencies": {
39
39
  "esquery": "^1.6.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@arethetypeswrong/cli": "^0.17.0",
43
- "@biomejs/biome": "1.9.4",
44
- "@tsconfig/bun": "^1.0.7",
45
- "@types/bun": "^1.1.14",
42
+ "@arethetypeswrong/cli": "^0.18.2",
43
+ "@biomejs/biome": "2.0.5",
44
+ "@tsconfig/bun": "^1.0.8",
45
+ "@types/bun": "^1.2.17",
46
46
  "@types/esquery": "^1.5.4",
47
- "@types/react": "^19.0.0",
48
- "@types/react-dom": "^19.0.0",
49
- "@types/semver": "^7.5.8",
50
- "@vitejs/plugin-react-swc": "^3.7.2",
51
- "react": "^19.0.0",
52
- "react-dom": "^19.0.0",
53
- "semver": "^7.6.3",
54
- "tsdown": "^0.5.0",
55
- "typescript": "^5.7.2"
47
+ "@types/react": "^19.1.8",
48
+ "@types/react-dom": "^19.1.6",
49
+ "@types/semver": "^7.7.0",
50
+ "@vitejs/plugin-react-swc": "^3.10.2",
51
+ "react": "^19.1.0",
52
+ "react-dom": "^19.1.0",
53
+ "semver": "^7.7.2",
54
+ "tsdown": "^0.12.8",
55
+ "typescript": "^5.8.3"
56
56
  },
57
57
  "keywords": [
58
58
  "css",