@epoch32/visage 1.1.4 → 1.1.5
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/dist/vite/index.js +22 -2
- package/package.json +1 -1
- package/src/vite/lucide.ts +22 -2
package/dist/vite/index.js
CHANGED
|
@@ -35,12 +35,32 @@ function visageLucide(options = {}) {
|
|
|
35
35
|
},
|
|
36
36
|
load(id) {
|
|
37
37
|
if (id.startsWith("\x00visage-lucide:")) {
|
|
38
|
-
return
|
|
38
|
+
return `
|
|
39
|
+
import * as lucideIcons from "lucide";
|
|
40
|
+
import { createIcon } from "visage/ui";
|
|
41
|
+
|
|
42
|
+
const cache = new Map();
|
|
43
|
+
export const __getIcon = (name) => {
|
|
44
|
+
if (cache.has(name)) return cache.get(name);
|
|
45
|
+
const node = lucideIcons[name];
|
|
46
|
+
const comp = node ? createIcon(name, node) : () => null;
|
|
47
|
+
cache.set(name, comp);
|
|
48
|
+
return comp;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default new Proxy({}, {
|
|
52
|
+
get: (_, prop) => typeof prop === "string" ? __getIcon(prop) : undefined
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Dynamic proxy export for all lucide icon names
|
|
56
|
+
${Object.keys({})};
|
|
57
|
+
export * from "lucide";
|
|
58
|
+
`;
|
|
39
59
|
}
|
|
40
60
|
return null;
|
|
41
61
|
},
|
|
42
62
|
transform(code, id) {
|
|
43
|
-
if (!id.match(/\.[jt]sx
|
|
63
|
+
if (!id.match(/\.([jt]sx?|mdx?)$/) || id.includes("node_modules")) {
|
|
44
64
|
return null;
|
|
45
65
|
}
|
|
46
66
|
let transformed = code;
|
package/package.json
CHANGED
package/src/vite/lucide.ts
CHANGED
|
@@ -72,13 +72,33 @@ export function visageLucide(options: VisageLucideOptions = {}): VisageVitePlugi
|
|
|
72
72
|
|
|
73
73
|
load(id: string) {
|
|
74
74
|
if (id.startsWith("\0visage-lucide:")) {
|
|
75
|
-
return
|
|
75
|
+
return `
|
|
76
|
+
import * as lucideIcons from "lucide";
|
|
77
|
+
import { createIcon } from "visage/ui";
|
|
78
|
+
|
|
79
|
+
const cache = new Map();
|
|
80
|
+
export const __getIcon = (name) => {
|
|
81
|
+
if (cache.has(name)) return cache.get(name);
|
|
82
|
+
const node = lucideIcons[name];
|
|
83
|
+
const comp = node ? createIcon(name, node) : () => null;
|
|
84
|
+
cache.set(name, comp);
|
|
85
|
+
return comp;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export default new Proxy({}, {
|
|
89
|
+
get: (_, prop) => typeof prop === "string" ? __getIcon(prop) : undefined
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Dynamic proxy export for all lucide icon names
|
|
93
|
+
${Object.keys({})};
|
|
94
|
+
export * from "lucide";
|
|
95
|
+
`;
|
|
76
96
|
}
|
|
77
97
|
return null;
|
|
78
98
|
},
|
|
79
99
|
|
|
80
100
|
transform(code: string, id: string) {
|
|
81
|
-
if (!id.match(/\.[jt]sx
|
|
101
|
+
if (!id.match(/\.([jt]sx?|mdx?)$/) || id.includes("node_modules")) {
|
|
82
102
|
return null;
|
|
83
103
|
}
|
|
84
104
|
|