vite-plugin-material-symbols 0.4.0-beta.1 → 0.4.0-beta.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 CHANGED
@@ -5,9 +5,10 @@
5
5
  ### v0.4.0
6
6
 
7
7
  - New option: `preload`, boolean:
8
- - Enables higher priority to loading symbols;
9
- - Disabled by default;
10
- - More information: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload
8
+ - Enables higher priority for loading symbols;
9
+ - Disabled by default; More information:
10
+ - https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload
11
+ - https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preconnect
11
12
 
12
13
  ### v0.3.0
13
14
 
package/README.md CHANGED
@@ -109,6 +109,6 @@ getUrl:
109
109
  default: (iconNamesParam) => `https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&${iconNamesParam}`
110
110
  preload:
111
111
  type: boolean
112
- description: Enables higher priority to loading symbols
112
+ description: Enables higher priority for loading symbols
113
113
  default: false
114
114
  ```
package/dist/index.d.ts CHANGED
@@ -13,8 +13,9 @@ type PluginOptions = {
13
13
  * */
14
14
  component: string;
15
15
  /**
16
- * Enables higher priority to loading symbols
16
+ * Enables higher priority for loading symbols
17
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
18
19
  * @default false
19
20
  */
20
21
  preload: boolean;
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)=>({html:l,tags:[{injectTo:"head",tag:"link",attrs:{rel:j?"preload":"stylesheet",...j&&{as:"style"},href:i(makeIconNamesParam(k))}}]})}};var src_default=plugin;export {src_default as default};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-material-symbols",
3
- "version": "0.4.0-beta.1",
3
+ "version": "0.4.0-beta.3",
4
4
  "description": "Selective loading of Material Symbols for production",
5
5
  "main": "dist/index.js",
6
6
  "repository": {