vite-plugin-material-symbols 0.0.2 → 0.1.1

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 ADDED
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ ## Version 0
4
+
5
+ ### v0.1.1
6
+
7
+ - Fixed debugging message;
8
+
9
+ ### v0.1.0
10
+
11
+ - Two configuration options: `placeholder` and `component`.
12
+
13
+ ### v0.0.2
14
+
15
+ - Initial release, basic operation.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # vite-plugin-material-symbols
2
2
 
3
- [![coverage](https://coveralls.io/repos/github/RobinTail/vite-plugin-material-symbols/badge.svg)](https://coveralls.io/github/RobinTail/vite-plugin-material-symbols)
3
+ [![coverage](https://coveralls.io/repos/github/RobinTail/vite-plugin-material-symbols/badge.svg?branch=main)](https://coveralls.io/github/RobinTail/vite-plugin-material-symbols?branch=main)
4
4
 
5
5
  The plugin determines which Material Symbols are used in JSX `<Icon>` tags and substitutes this list in `index.html`
6
6
  for selective download from Google CDN, thus reducing the volume of the font downloaded by the user.
@@ -48,7 +48,14 @@ import react from "@vitejs/plugin-react-swc";
48
48
  import materialSymbols from "vite-plugin-material-symbols";
49
49
 
50
50
  export default defineConfig({
51
- plugins: [react(), materialSymbols()],
51
+ plugins: [
52
+ react(),
53
+ materialSymbols({
54
+ // these are defaults:
55
+ component: "Icon",
56
+ placeholder: "__MATERIAL_SYMBOLS__",
57
+ }),
58
+ ],
52
59
  });
53
60
  ```
54
61
 
package/dist/index.d.ts CHANGED
@@ -1,3 +1,9 @@
1
1
  import type { Plugin } from "vite";
2
- declare const plugin: () => Plugin;
2
+ type PluginOptions = {
3
+ /** @default __MATERIAL_SYMBOLS__ */
4
+ placeholder: string;
5
+ /** @default Icon */
6
+ component: string;
7
+ };
8
+ declare const plugin: ({ placeholder, component, }?: Partial<PluginOptions>) => Plugin;
3
9
  export default plugin;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import esquery from "esquery";const plugin=()=>{const d=new Set();return {name:"material-symbols",enforce:"pre",moduleParsed:function({id:e,ast:f}){if(!f)return;const g=esquery.query(f,"CallExpression[callee.name='jsx'][arguments.0.name='Icon'] > .arguments > Property[key.name='children'] Literal");this.debug({id:e,message:"value"});for(const {value:h}of g)if(typeof h==="string")d.add(h)},transformIndexHtml:(e)=>e.replace("__MATERIAL_SYMBOLS__",d.size?`icon_names=${Array.from(d.values()).toSorted().join(",")}`:"")}};var src_default=plugin;export {src_default as default};
1
+ import esquery from "esquery";const plugin=({placeholder:d="__MATERIAL_SYMBOLS__",component:e="Icon"}={})=>{const f=new Set();return {name:"material-symbols",enforce:"pre",moduleParsed:function({id:g,ast:h}){if(!h)return;const i=esquery.query(h,`CallExpression[callee.name='jsx'][arguments.0.name='${e}'] > .arguments > Property[key.name='children'] Literal`);for(const {value:j}of i)if(typeof j==="string")this.debug({id:g,message:j}),f.add(j)},transformIndexHtml:(g)=>g.replace(d,f.size?`icon_names=${Array.from(f.values()).toSorted().join(",")}`:"")}};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.0.2",
3
+ "version": "0.1.1",
4
4
  "description": "Selective loading of Material Symbols for production",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -15,7 +15,9 @@
15
15
  "prebuild": "tsc --noEmit",
16
16
  "build": "tsdown",
17
17
  "postbuild": "attw --pack --profile esm-only",
18
- "mdfix": "bunx --bun prettier *.md --write"
18
+ "mdfix": "bunx --bun prettier *.md --write",
19
+ "version": "bun run version.ts",
20
+ "prepublishOnly": "bun lint && bun test && bun run build"
19
21
  },
20
22
  "exports": {
21
23
  ".": {
@@ -23,7 +25,10 @@
23
25
  "default": "./dist/index.js"
24
26
  }
25
27
  },
26
- "files": ["dist", "*.md"],
28
+ "files": [
29
+ "dist",
30
+ "*.md"
31
+ ],
27
32
  "peerDependencies": {
28
33
  "vite": "^6.0.0"
29
34
  },
@@ -36,6 +41,13 @@
36
41
  "@tsconfig/bun": "^1.0.7",
37
42
  "@types/bun": "^1.1.14",
38
43
  "@types/esquery": "^1.5.4",
44
+ "@types/react": "^18.3.12",
45
+ "@types/react-dom": "^18.3.1",
46
+ "@types/semver": "^7.5.8",
47
+ "@vitejs/plugin-react-swc": "^3.7.2",
48
+ "react": "^18.3.1",
49
+ "react-dom": "^18.3.1",
50
+ "semver": "^7.6.3",
39
51
  "tsdown": "^0.3.1",
40
52
  "typescript": "^5.7.2"
41
53
  }