vite-plugin-material-symbols 0.5.0 → 0.7.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 +10 -0
- package/README.md +5 -3
- package/dist/index.d.ts +23 -20
- package/dist/index.js +1 -1
- package/package.json +17 -18
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -18,8 +18,10 @@ the font downloaded by the user.
|
|
|
18
18
|
|
|
19
19
|
## Requirements
|
|
20
20
|
|
|
21
|
-
- Node.js `^
|
|
22
|
-
-
|
|
21
|
+
- Node.js `^22 || ^24`;
|
|
22
|
+
- use the plugin version 0.6 for Node 20;
|
|
23
|
+
- Vite `^8`
|
|
24
|
+
- use the plugin version 0.6 for Vite 6 and 7;
|
|
23
25
|
|
|
24
26
|
## Installation
|
|
25
27
|
|
|
@@ -34,7 +36,7 @@ Add it to the Vite configuration:
|
|
|
34
36
|
```ts
|
|
35
37
|
// vite.config.ts
|
|
36
38
|
import { defineConfig } from "vite";
|
|
37
|
-
import react from "@vitejs/plugin-react
|
|
39
|
+
import react from "@vitejs/plugin-react";
|
|
38
40
|
import materialSymbols from "vite-plugin-material-symbols";
|
|
39
41
|
|
|
40
42
|
export default defineConfig({
|
package/dist/index.d.ts
CHANGED
|
@@ -2,26 +2,29 @@ import { Plugin } from "vite";
|
|
|
2
2
|
|
|
3
3
|
//#region src/index.d.ts
|
|
4
4
|
type PluginOptions = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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;
|
|
23
23
|
};
|
|
24
|
-
declare const plugin: ({
|
|
25
|
-
|
|
24
|
+
declare const plugin: ({
|
|
25
|
+
component,
|
|
26
|
+
getUrl,
|
|
27
|
+
preload
|
|
28
|
+
}?: Partial<PluginOptions>) => Plugin;
|
|
26
29
|
//#endregion
|
|
27
30
|
export { plugin as default };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
|
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,code:i}){if(!i||!/.([jt])sx?$/i.test(n))return;let o=this.parse(i),s=r(a),l=e.query(o,s).filter(t);for(let{value:e}of l)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}}}};export{a as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-material-symbols",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Selective loading of Material Symbols for production",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
"lint": "bun run biome check",
|
|
15
15
|
"prebuild": "tsc --noEmit",
|
|
16
16
|
"build": "tsdown",
|
|
17
|
-
"postbuild": "attw --pack --profile esm-only",
|
|
18
17
|
"mdfix": "bunx --bun prettier *.md --write",
|
|
19
18
|
"version": "bun run tools/version.ts",
|
|
20
19
|
"prepublishOnly": "bun lint && bun test && bun run build"
|
|
@@ -30,29 +29,29 @@
|
|
|
30
29
|
"*.md"
|
|
31
30
|
],
|
|
32
31
|
"engines": {
|
|
33
|
-
"node": "^
|
|
32
|
+
"node": "^22 || ^24"
|
|
34
33
|
},
|
|
35
34
|
"peerDependencies": {
|
|
36
|
-
"vite": "^
|
|
35
|
+
"vite": "^8.0.0"
|
|
37
36
|
},
|
|
38
37
|
"dependencies": {
|
|
39
|
-
"esquery": "^1.
|
|
38
|
+
"esquery": "^1.7.0"
|
|
40
39
|
},
|
|
41
40
|
"devDependencies": {
|
|
42
|
-
"@arethetypeswrong/
|
|
43
|
-
"@biomejs/biome": "
|
|
44
|
-
"@tsconfig/bun": "^1.0.
|
|
45
|
-
"@types/bun": "^1.
|
|
41
|
+
"@arethetypeswrong/core": "^0.18.2",
|
|
42
|
+
"@biomejs/biome": "2.4.7",
|
|
43
|
+
"@tsconfig/bun": "^1.0.8",
|
|
44
|
+
"@types/bun": "^1.2.17",
|
|
46
45
|
"@types/esquery": "^1.5.4",
|
|
47
|
-
"@types/react": "^19.
|
|
48
|
-
"@types/react-dom": "^19.
|
|
49
|
-
"@types/semver": "^7.
|
|
50
|
-
"@vitejs/plugin-react
|
|
51
|
-
"react": "^19.
|
|
52
|
-
"react-dom": "^19.
|
|
53
|
-
"semver": "^7.
|
|
54
|
-
"tsdown": "^0.
|
|
55
|
-
"typescript": "^5.
|
|
46
|
+
"@types/react": "^19.1.8",
|
|
47
|
+
"@types/react-dom": "^19.1.6",
|
|
48
|
+
"@types/semver": "^7.7.0",
|
|
49
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
50
|
+
"react": "^19.1.0",
|
|
51
|
+
"react-dom": "^19.1.0",
|
|
52
|
+
"semver": "^7.7.2",
|
|
53
|
+
"tsdown": "^0.21.2",
|
|
54
|
+
"typescript": "^5.8.3"
|
|
56
55
|
},
|
|
57
56
|
"keywords": [
|
|
58
57
|
"css",
|