bobe-dom 0.0.68 → 0.0.69
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/iconify.cjs +442 -0
- package/dist/iconify.cjs.map +1 -0
- package/dist/iconify.d.ts +42 -0
- package/dist/iconify.esm.js +432 -0
- package/dist/iconify.esm.js.map +1 -0
- package/package.json +10 -2
package/dist/iconify.cjs
ADDED
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var parser = require('@babel/parser');
|
|
6
|
+
var node_fs = require('node:fs');
|
|
7
|
+
var path = require('node:path');
|
|
8
|
+
var node_module = require('node:module');
|
|
9
|
+
|
|
10
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
11
|
+
function _arrayLikeToArray(r, a) {
|
|
12
|
+
(null == a || a > r.length) && (a = r.length);
|
|
13
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
14
|
+
return n;
|
|
15
|
+
}
|
|
16
|
+
function _arrayWithHoles(r) {
|
|
17
|
+
if (Array.isArray(r)) return r;
|
|
18
|
+
}
|
|
19
|
+
function _iterableToArrayLimit(r, l) {
|
|
20
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
21
|
+
if (null != t) {
|
|
22
|
+
var e,
|
|
23
|
+
n,
|
|
24
|
+
i,
|
|
25
|
+
u,
|
|
26
|
+
a = [],
|
|
27
|
+
f = true,
|
|
28
|
+
o = false;
|
|
29
|
+
try {
|
|
30
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
31
|
+
if (Object(t) !== t) return;
|
|
32
|
+
f = !1;
|
|
33
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
34
|
+
} catch (r) {
|
|
35
|
+
o = true, n = r;
|
|
36
|
+
} finally {
|
|
37
|
+
try {
|
|
38
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
39
|
+
} finally {
|
|
40
|
+
if (o) throw n;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return a;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function _nonIterableRest() {
|
|
47
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
48
|
+
}
|
|
49
|
+
function _slicedToArray(r, e) {
|
|
50
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
51
|
+
}
|
|
52
|
+
function _unsupportedIterableToArray(r, a) {
|
|
53
|
+
if (r) {
|
|
54
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
55
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
56
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const VIRTUAL_ID = 'virtual:bobe-iconify-icons';
|
|
61
|
+
const RESOLVED_VIRTUAL_ID = `\0${VIRTUAL_ID}`;
|
|
62
|
+
const DEFAULT_API_BASE = 'https://api.iconify.design';
|
|
63
|
+
const DEFAULT_CACHE_DIR = 'bobe-iconify';
|
|
64
|
+
const DEFAULT_EXTENSIONS_RE = /\.(?:[cm]?[jt]sx?|mdx?)$/;
|
|
65
|
+
const ICON_NAME_RE = /^([a-z0-9]+(?:-[a-z0-9]+)*):([a-z0-9]+[-_:.a-z0-9]*)$/i;
|
|
66
|
+
const ICON_ATTR_RE = /\bicon\s*=\s*(['"])([^'"]+)\1/g;
|
|
67
|
+
const DYNAMIC_ICON_RE = /\bicon\s*=\s*(?:\{|(['"])[^'"]*$)/;
|
|
68
|
+
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('iconify.cjs', document.baseURI).href)));
|
|
69
|
+
function bobeIconifyPlugin(options = {}) {
|
|
70
|
+
const icons = new Set();
|
|
71
|
+
const warnedDynamicIds = new Set();
|
|
72
|
+
const warnedInvalid = new Set();
|
|
73
|
+
const filter = createFilter(options.include, options.exclude);
|
|
74
|
+
let config;
|
|
75
|
+
let server;
|
|
76
|
+
let projectScanned = false;
|
|
77
|
+
let runtimeImports;
|
|
78
|
+
const addIcons = items => {
|
|
79
|
+
let changed = false;
|
|
80
|
+
for (const icon of items) {
|
|
81
|
+
if (icons.has(icon)) continue;
|
|
82
|
+
icons.add(icon);
|
|
83
|
+
changed = true;
|
|
84
|
+
}
|
|
85
|
+
if (changed && server) {
|
|
86
|
+
const mod = server.moduleGraph.getModuleById(RESOLVED_VIRTUAL_ID);
|
|
87
|
+
if (mod) server.moduleGraph.invalidateModule(mod);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const scanCode = (code, id, warn) => {
|
|
91
|
+
const result = extractBobeIconifyIcons(code);
|
|
92
|
+
addIcons(result.icons);
|
|
93
|
+
if (options.warnDynamic !== false && result.dynamic > 0 && !warnedDynamicIds.has(id)) {
|
|
94
|
+
warnedDynamicIds.add(id);
|
|
95
|
+
warn(`[bobe-iconify] ${id} 中存在动态 iconify-icon icon 属性,插件会跳过静态注册并保留 Iconify runtime fallback。如需本地注册,请通过 icons 配置补充。`);
|
|
96
|
+
}
|
|
97
|
+
for (const icon of result.invalid) {
|
|
98
|
+
const key = `${id}:${icon}`;
|
|
99
|
+
if (warnedInvalid.has(key)) continue;
|
|
100
|
+
warnedInvalid.add(key);
|
|
101
|
+
warn(`[bobe-iconify] 忽略非法 icon 名称 "${icon}",仅支持 "prefix:name"。来源:${id}`);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
return {
|
|
105
|
+
name: 'bobe-iconify',
|
|
106
|
+
configResolved(resolved) {
|
|
107
|
+
config = resolved;
|
|
108
|
+
runtimeImports = resolveRuntimeImports();
|
|
109
|
+
addIcons(normalizeIconList(options.icons || []));
|
|
110
|
+
},
|
|
111
|
+
configureServer(devServer) {
|
|
112
|
+
server = devServer;
|
|
113
|
+
},
|
|
114
|
+
async buildStart() {
|
|
115
|
+
addIcons(normalizeIconList(options.icons || []));
|
|
116
|
+
},
|
|
117
|
+
async transform(code, id) {
|
|
118
|
+
if (!filter(id)) return;
|
|
119
|
+
scanCode(code, id, message => this.warn(message));
|
|
120
|
+
},
|
|
121
|
+
transformIndexHtml: {
|
|
122
|
+
order: 'pre',
|
|
123
|
+
handler() {
|
|
124
|
+
if (config?.build?.ssr) return;
|
|
125
|
+
return [{
|
|
126
|
+
tag: 'script',
|
|
127
|
+
attrs: {
|
|
128
|
+
type: 'module',
|
|
129
|
+
src: `/${VIRTUAL_ID}`
|
|
130
|
+
},
|
|
131
|
+
injectTo: 'head'
|
|
132
|
+
}];
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
resolveId(id) {
|
|
136
|
+
if (id === VIRTUAL_ID || id === `/${VIRTUAL_ID}`) return RESOLVED_VIRTUAL_ID;
|
|
137
|
+
},
|
|
138
|
+
async load(id) {
|
|
139
|
+
if (id !== RESOLVED_VIRTUAL_ID) return;
|
|
140
|
+
await scanProjectOnce();
|
|
141
|
+
const cacheDir = getCacheDir(config, options);
|
|
142
|
+
const collections = await loadIconifyCollections(icons, {
|
|
143
|
+
apiBase: options.apiBase || DEFAULT_API_BASE,
|
|
144
|
+
cacheDir,
|
|
145
|
+
strict: options.strict,
|
|
146
|
+
warn: message => this.warn(message)
|
|
147
|
+
});
|
|
148
|
+
return createIconifyVirtualModule(groupIconsByPrefix(icons), collections, runtimeImports);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
async function scanProjectOnce() {
|
|
152
|
+
if (projectScanned || !config) return;
|
|
153
|
+
projectScanned = true;
|
|
154
|
+
const files = await collectSourceFiles(config.root);
|
|
155
|
+
await Promise.all(files.map(async file => {
|
|
156
|
+
const id = path.normalize(file);
|
|
157
|
+
if (!filter(id) || id.endsWith('.md') || id.endsWith('.mdx')) return;
|
|
158
|
+
try {
|
|
159
|
+
const code = await node_fs.promises.readFile(file, 'utf8');
|
|
160
|
+
scanCode(code, id, message => config.logger.warn(message));
|
|
161
|
+
} catch {}
|
|
162
|
+
}));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function extractBobeIconifyIcons(code) {
|
|
166
|
+
const icons = new Set();
|
|
167
|
+
const invalid = new Set();
|
|
168
|
+
let dynamic = 0;
|
|
169
|
+
let ast;
|
|
170
|
+
try {
|
|
171
|
+
ast = parser.parse(code, {
|
|
172
|
+
sourceType: 'module',
|
|
173
|
+
errorRecovery: true,
|
|
174
|
+
plugins: ['typescript', 'jsx']
|
|
175
|
+
});
|
|
176
|
+
} catch {
|
|
177
|
+
return {
|
|
178
|
+
icons: [],
|
|
179
|
+
dynamic: 0,
|
|
180
|
+
invalid: []
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
walkAst(ast, node => {
|
|
184
|
+
if (node.type !== 'TaggedTemplateExpression' || !isBobeTag(node.tag)) return;
|
|
185
|
+
for (const quasi of node.quasi?.quasis || []) {
|
|
186
|
+
const raw = quasi.value?.raw ?? quasi.value?.cooked ?? '';
|
|
187
|
+
const result = extractIconifyIconsFromTemplate(raw);
|
|
188
|
+
for (const icon of result.icons) icons.add(icon);
|
|
189
|
+
for (const icon of result.invalid) invalid.add(icon);
|
|
190
|
+
dynamic += result.dynamic;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
return {
|
|
194
|
+
icons: Array.from(icons).sort(),
|
|
195
|
+
dynamic,
|
|
196
|
+
invalid: Array.from(invalid).sort()
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function extractIconifyIconsFromTemplate(template) {
|
|
200
|
+
const icons = new Set();
|
|
201
|
+
const invalid = new Set();
|
|
202
|
+
let dynamic = 0;
|
|
203
|
+
let inIconifyElement = false;
|
|
204
|
+
for (const line of template.split(/\r?\n/)) {
|
|
205
|
+
const trimmed = line.trim();
|
|
206
|
+
if (!trimmed || trimmed.startsWith('//')) continue;
|
|
207
|
+
const isContinuation = trimmed.startsWith('|');
|
|
208
|
+
const isIconifyElement = /^<?iconify-icon\b/.test(trimmed);
|
|
209
|
+
if (!isContinuation) inIconifyElement = isIconifyElement;
|
|
210
|
+
if (!isIconifyElement && !(inIconifyElement && isContinuation)) continue;
|
|
211
|
+
for (const icon of extractStaticIconAttributes(trimmed)) {
|
|
212
|
+
if (isValidIconName(icon)) {
|
|
213
|
+
icons.add(icon);
|
|
214
|
+
} else {
|
|
215
|
+
invalid.add(icon);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (DYNAMIC_ICON_RE.test(trimmed)) dynamic++;
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
icons: Array.from(icons).sort(),
|
|
222
|
+
dynamic,
|
|
223
|
+
invalid: Array.from(invalid).sort()
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
async function loadIconifyCollections(iconNames, options) {
|
|
227
|
+
const grouped = groupIconsByPrefix(iconNames);
|
|
228
|
+
const collections = {};
|
|
229
|
+
await node_fs.promises.mkdir(options.cacheDir, {
|
|
230
|
+
recursive: true
|
|
231
|
+
});
|
|
232
|
+
for (const _ref of grouped) {
|
|
233
|
+
var _ref2 = _slicedToArray(_ref, 2);
|
|
234
|
+
const prefix = _ref2[0];
|
|
235
|
+
const names = _ref2[1];
|
|
236
|
+
const cacheFile = path.join(options.cacheDir, `${prefix}.json`);
|
|
237
|
+
const cached = await readCachedCollection(cacheFile, prefix);
|
|
238
|
+
const missing = Array.from(names).filter(name => !hasIcon(cached, name));
|
|
239
|
+
let collection = cached;
|
|
240
|
+
if (missing.length) {
|
|
241
|
+
const remote = await fetchIconifyCollection(prefix, missing, options);
|
|
242
|
+
if (remote) {
|
|
243
|
+
collection = mergeCollections(prefix, cached, remote);
|
|
244
|
+
await node_fs.promises.writeFile(cacheFile, JSON.stringify(collection, null, 2), 'utf8');
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
collections[prefix] = collection;
|
|
248
|
+
}
|
|
249
|
+
return collections;
|
|
250
|
+
}
|
|
251
|
+
function createIconifyVirtualModule(iconsByPrefix, collections, runtimeImports = {
|
|
252
|
+
iconifyIcon: 'iconify-icon',
|
|
253
|
+
iconifyUtils: '@iconify/utils'
|
|
254
|
+
}) {
|
|
255
|
+
const icons = Object.fromEntries(Array.from(iconsByPrefix, ([prefix, names]) => [prefix, Array.from(names).sort()]));
|
|
256
|
+
return [`import ${JSON.stringify(toImportPath(runtimeImports.iconifyIcon))};`, `import { addIcon } from ${JSON.stringify(toImportPath(runtimeImports.iconifyIcon))};`, `import { getIconData } from ${JSON.stringify(toImportPath(runtimeImports.iconifyUtils))};`, `const collections = ${JSON.stringify(collections)};`, `const icons = ${JSON.stringify(icons)};`, `for (const prefix of Object.keys(icons)) {`, ` const collection = collections[prefix];`, ` if (!collection) continue;`, ` for (const name of icons[prefix]) {`, ` const data = getIconData(collection, name);`, ` if (data) addIcon(prefix + ':' + name, data);`, ` }`, `}`, ``].join('\n');
|
|
257
|
+
}
|
|
258
|
+
function groupIconsByPrefix(iconNames) {
|
|
259
|
+
const grouped = new Map();
|
|
260
|
+
for (const iconName of normalizeIconList(iconNames)) {
|
|
261
|
+
const match = ICON_NAME_RE.exec(iconName);
|
|
262
|
+
if (!match) continue;
|
|
263
|
+
const _match = _slicedToArray(match, 3),
|
|
264
|
+
prefix = _match[1],
|
|
265
|
+
name = _match[2];
|
|
266
|
+
if (!grouped.has(prefix)) grouped.set(prefix, new Set());
|
|
267
|
+
grouped.get(prefix).add(name);
|
|
268
|
+
}
|
|
269
|
+
return grouped;
|
|
270
|
+
}
|
|
271
|
+
function extractStaticIconAttributes(line) {
|
|
272
|
+
const icons = [];
|
|
273
|
+
ICON_ATTR_RE.lastIndex = 0;
|
|
274
|
+
let match = ICON_ATTR_RE.exec(line);
|
|
275
|
+
while (match) {
|
|
276
|
+
icons.push(match[2].trim());
|
|
277
|
+
match = ICON_ATTR_RE.exec(line);
|
|
278
|
+
}
|
|
279
|
+
return icons;
|
|
280
|
+
}
|
|
281
|
+
function isValidIconName(icon) {
|
|
282
|
+
return ICON_NAME_RE.test(icon);
|
|
283
|
+
}
|
|
284
|
+
function normalizeIconList(iconNames) {
|
|
285
|
+
return Array.from(iconNames).map(icon => String(icon).trim()).filter(Boolean).filter(isValidIconName).sort();
|
|
286
|
+
}
|
|
287
|
+
function isBobeTag(tag) {
|
|
288
|
+
if (!tag) return false;
|
|
289
|
+
if (tag.type === 'Identifier') return tag.name === 'bobe';
|
|
290
|
+
if (tag.type === 'MemberExpression') {
|
|
291
|
+
const property = tag.property;
|
|
292
|
+
return !tag.computed && property?.type === 'Identifier' && property.name === 'bobe';
|
|
293
|
+
}
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
function walkAst(node, visit) {
|
|
297
|
+
if (!node || typeof node !== 'object') return;
|
|
298
|
+
if (typeof node.type === 'string') visit(node);
|
|
299
|
+
for (const key of Object.keys(node)) {
|
|
300
|
+
if (key === 'loc' || key === 'start' || key === 'end' || key === 'extra') continue;
|
|
301
|
+
const value = node[key];
|
|
302
|
+
if (Array.isArray(value)) {
|
|
303
|
+
for (const item of value) walkAst(item, visit);
|
|
304
|
+
} else if (value && typeof value === 'object') {
|
|
305
|
+
walkAst(value, visit);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
function createFilter(include, exclude) {
|
|
310
|
+
const includeMatchers = normalizeMatchers(include);
|
|
311
|
+
const excludeMatchers = normalizeMatchers(exclude);
|
|
312
|
+
return id => {
|
|
313
|
+
const normalized = normalizeId(id);
|
|
314
|
+
if (excludeMatchers.some(match => match(normalized))) return false;
|
|
315
|
+
if (includeMatchers.length) return includeMatchers.some(match => match(normalized));
|
|
316
|
+
return DEFAULT_EXTENSIONS_RE.test(normalized) && !normalized.includes('/node_modules/') && !normalized.includes('/dist/');
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function normalizeMatchers(value) {
|
|
320
|
+
return (Array.isArray(value) ? value : value ? [value] : []).map(toMatcher);
|
|
321
|
+
}
|
|
322
|
+
function toMatcher(pattern) {
|
|
323
|
+
const normalized = normalizeId(pattern);
|
|
324
|
+
if (!normalized.includes('*')) return id => id.includes(normalized);
|
|
325
|
+
const source = normalized.split('*').map(escapeRegExp).join('.*');
|
|
326
|
+
const re = new RegExp(source);
|
|
327
|
+
return id => re.test(id);
|
|
328
|
+
}
|
|
329
|
+
function normalizeId(id) {
|
|
330
|
+
return id.split('?')[0].replace(/\\/g, '/');
|
|
331
|
+
}
|
|
332
|
+
function escapeRegExp(value) {
|
|
333
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
334
|
+
}
|
|
335
|
+
async function collectSourceFiles(root) {
|
|
336
|
+
const files = [];
|
|
337
|
+
await walkDir(root, files);
|
|
338
|
+
return files;
|
|
339
|
+
}
|
|
340
|
+
async function walkDir(dir, files) {
|
|
341
|
+
const base = path.basename(dir);
|
|
342
|
+
if (base === 'node_modules' || base === 'dist' || base === '.git') return;
|
|
343
|
+
let entries;
|
|
344
|
+
try {
|
|
345
|
+
entries = await node_fs.promises.readdir(dir, {
|
|
346
|
+
withFileTypes: true
|
|
347
|
+
});
|
|
348
|
+
} catch {
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
await Promise.all(entries.map(async entry => {
|
|
352
|
+
const fullPath = path.join(dir, entry.name);
|
|
353
|
+
if (entry.isDirectory()) {
|
|
354
|
+
await walkDir(fullPath, files);
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
if (entry.isFile() && DEFAULT_EXTENSIONS_RE.test(entry.name)) files.push(fullPath);
|
|
358
|
+
}));
|
|
359
|
+
}
|
|
360
|
+
async function readCachedCollection(file, prefix) {
|
|
361
|
+
try {
|
|
362
|
+
const raw = await node_fs.promises.readFile(file, 'utf8');
|
|
363
|
+
const parsed = JSON.parse(raw);
|
|
364
|
+
if (parsed?.prefix === prefix && parsed.icons && typeof parsed.icons === 'object') {
|
|
365
|
+
return parsed;
|
|
366
|
+
}
|
|
367
|
+
} catch {}
|
|
368
|
+
return {
|
|
369
|
+
prefix,
|
|
370
|
+
icons: {}
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
async function fetchIconifyCollection(prefix, names, options) {
|
|
374
|
+
const fetcher = options.fetcher || globalThis.fetch;
|
|
375
|
+
if (typeof fetcher !== 'function') {
|
|
376
|
+
return handleFetchFailure(prefix, names, options, new Error('global fetch is not available'));
|
|
377
|
+
}
|
|
378
|
+
const url = `${options.apiBase.replace(/\/$/, '')}/${prefix}.json?icons=${names.map(encodeURIComponent).join(',')}`;
|
|
379
|
+
try {
|
|
380
|
+
const response = await fetcher(url);
|
|
381
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
382
|
+
const json = await response.json();
|
|
383
|
+
if (!json?.icons || typeof json.icons !== 'object') throw new Error('invalid Iconify response');
|
|
384
|
+
return json;
|
|
385
|
+
} catch (error) {
|
|
386
|
+
return handleFetchFailure(prefix, names, options, error);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
function handleFetchFailure(prefix, names, options, error) {
|
|
390
|
+
const message = `[bobe-iconify] 下载 ${prefix}:${names.join(',')} 失败,已保留 Iconify runtime fallback。${error instanceof Error ? error.message : String(error)}`;
|
|
391
|
+
if (options.strict) throw new Error(message);
|
|
392
|
+
options.warn?.(message);
|
|
393
|
+
return null;
|
|
394
|
+
}
|
|
395
|
+
function mergeCollections(prefix, cached, remote) {
|
|
396
|
+
return {
|
|
397
|
+
...cached,
|
|
398
|
+
...remote,
|
|
399
|
+
prefix,
|
|
400
|
+
icons: {
|
|
401
|
+
...(cached.icons || {}),
|
|
402
|
+
...(remote.icons || {})
|
|
403
|
+
},
|
|
404
|
+
aliases: mergeOptionalRecords(cached.aliases, remote.aliases)
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
function mergeOptionalRecords(a, b) {
|
|
408
|
+
const merged = {
|
|
409
|
+
...(a || {}),
|
|
410
|
+
...(b || {})
|
|
411
|
+
};
|
|
412
|
+
return Object.keys(merged).length ? merged : undefined;
|
|
413
|
+
}
|
|
414
|
+
function hasIcon(collection, name) {
|
|
415
|
+
return Boolean(collection.icons?.[name] || collection.aliases?.[name]);
|
|
416
|
+
}
|
|
417
|
+
function getCacheDir(config, options) {
|
|
418
|
+
if (options.cacheDir) {
|
|
419
|
+
return path.isAbsolute(options.cacheDir) ? options.cacheDir : path.resolve(config.root, options.cacheDir);
|
|
420
|
+
}
|
|
421
|
+
return path.resolve(config.cacheDir, DEFAULT_CACHE_DIR);
|
|
422
|
+
}
|
|
423
|
+
function resolveRuntimeImports() {
|
|
424
|
+
return {
|
|
425
|
+
iconifyIcon: requireResolve('iconify-icon/dist/iconify-icon.mjs'),
|
|
426
|
+
iconifyUtils: requireResolve('@iconify/utils')
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
function requireResolve(id) {
|
|
430
|
+
return require$1.resolve(id);
|
|
431
|
+
}
|
|
432
|
+
function toImportPath(id) {
|
|
433
|
+
return id.replace(/\\/g, '/');
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
exports.createIconifyVirtualModule = createIconifyVirtualModule;
|
|
437
|
+
exports.default = bobeIconifyPlugin;
|
|
438
|
+
exports.extractBobeIconifyIcons = extractBobeIconifyIcons;
|
|
439
|
+
exports.extractIconifyIconsFromTemplate = extractIconifyIconsFromTemplate;
|
|
440
|
+
exports.groupIconsByPrefix = groupIconsByPrefix;
|
|
441
|
+
exports.loadIconifyCollections = loadIconifyCollections;
|
|
442
|
+
//# sourceMappingURL=iconify.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iconify.cjs","sources":["../src/plugins/iconify/index.ts"],"sourcesContent":["import type { Plugin, ResolvedConfig, ViteDevServer } from 'vite';\nimport { parse } from '@babel/parser';\nimport { promises as fs } from 'node:fs';\nimport path from 'node:path';\nimport { createRequire } from 'node:module';\n\nconst VIRTUAL_ID = 'virtual:bobe-iconify-icons';\nconst RESOLVED_VIRTUAL_ID = `\\0${VIRTUAL_ID}`;\nconst DEFAULT_API_BASE = 'https://api.iconify.design';\nconst DEFAULT_CACHE_DIR = 'bobe-iconify';\nconst DEFAULT_EXTENSIONS_RE = /\\.(?:[cm]?[jt]sx?|mdx?)$/;\nconst ICON_NAME_RE = /^([a-z0-9]+(?:-[a-z0-9]+)*):([a-z0-9]+[-_:.a-z0-9]*)$/i;\nconst ICON_ATTR_RE = /\\bicon\\s*=\\s*(['\"])([^'\"]+)\\1/g;\nconst DYNAMIC_ICON_RE = /\\bicon\\s*=\\s*(?:\\{|(['\"])[^'\"]*$)/;\nconst require = createRequire(import.meta.url);\n\nexport interface BobeIconifyPluginOptions {\n include?: string | string[];\n exclude?: string | string[];\n icons?: string[];\n apiBase?: string;\n cacheDir?: string;\n strict?: boolean;\n warnDynamic?: boolean;\n}\n\nexport interface ExtractBobeIconifyResult {\n icons: string[];\n dynamic: number;\n invalid: string[];\n}\n\ninterface IconifyJSON {\n prefix: string;\n icons: Record<string, unknown>;\n aliases?: Record<string, unknown>;\n [key: string]: unknown;\n}\n\ninterface CollectionLoadOptions {\n apiBase: string;\n cacheDir: string;\n strict?: boolean;\n fetcher?: typeof fetch;\n warn?: (message: string) => void;\n}\n\ninterface RuntimeImportPaths {\n iconifyIcon: string;\n iconifyUtils: string;\n}\n\nexport default function bobeIconifyPlugin(options: BobeIconifyPluginOptions = {}): Plugin {\n const icons = new Set<string>();\n const warnedDynamicIds = new Set<string>();\n const warnedInvalid = new Set<string>();\n const filter = createFilter(options.include, options.exclude);\n let config: ResolvedConfig;\n let server: ViteDevServer | undefined;\n let projectScanned = false;\n let runtimeImports: RuntimeImportPaths;\n\n const addIcons = (items: Iterable<string>) => {\n let changed = false;\n for (const icon of items) {\n if (icons.has(icon)) continue;\n icons.add(icon);\n changed = true;\n }\n if (changed && server) {\n const mod = server.moduleGraph.getModuleById(RESOLVED_VIRTUAL_ID);\n if (mod) server.moduleGraph.invalidateModule(mod);\n }\n };\n\n const scanCode = (code: string, id: string, warn: (message: string) => void) => {\n const result = extractBobeIconifyIcons(code);\n addIcons(result.icons);\n\n if (options.warnDynamic !== false && result.dynamic > 0 && !warnedDynamicIds.has(id)) {\n warnedDynamicIds.add(id);\n warn(`[bobe-iconify] ${id} 中存在动态 iconify-icon icon 属性,插件会跳过静态注册并保留 Iconify runtime fallback。如需本地注册,请通过 icons 配置补充。`);\n }\n\n for (const icon of result.invalid) {\n const key = `${id}:${icon}`;\n if (warnedInvalid.has(key)) continue;\n warnedInvalid.add(key);\n warn(`[bobe-iconify] 忽略非法 icon 名称 \"${icon}\",仅支持 \"prefix:name\"。来源:${id}`);\n }\n };\n\n return {\n name: 'bobe-iconify',\n\n configResolved(resolved) {\n config = resolved;\n runtimeImports = resolveRuntimeImports();\n addIcons(normalizeIconList(options.icons || []));\n },\n\n configureServer(devServer) {\n server = devServer;\n },\n\n async buildStart() {\n addIcons(normalizeIconList(options.icons || []));\n },\n\n async transform(code, id) {\n if (!filter(id)) return;\n scanCode(code, id, message => this.warn(message));\n },\n\n transformIndexHtml: {\n order: 'pre',\n handler() {\n if (config?.build?.ssr) return;\n return [\n {\n tag: 'script',\n attrs: { type: 'module', src: `/${VIRTUAL_ID}` },\n injectTo: 'head',\n },\n ];\n },\n },\n\n resolveId(id) {\n if (id === VIRTUAL_ID || id === `/${VIRTUAL_ID}`) return RESOLVED_VIRTUAL_ID;\n },\n\n async load(id) {\n if (id !== RESOLVED_VIRTUAL_ID) return;\n\n await scanProjectOnce();\n const cacheDir = getCacheDir(config, options);\n const collections = await loadIconifyCollections(icons, {\n apiBase: options.apiBase || DEFAULT_API_BASE,\n cacheDir,\n strict: options.strict,\n warn: message => this.warn(message),\n });\n\n return createIconifyVirtualModule(groupIconsByPrefix(icons), collections, runtimeImports);\n },\n };\n\n async function scanProjectOnce() {\n if (projectScanned || !config) return;\n projectScanned = true;\n\n const files = await collectSourceFiles(config.root);\n await Promise.all(files.map(async file => {\n const id = path.normalize(file);\n if (!filter(id) || id.endsWith('.md') || id.endsWith('.mdx')) return;\n try {\n const code = await fs.readFile(file, 'utf8');\n scanCode(code, id, message => config.logger.warn(message));\n } catch {\n // Ignore unreadable files during eager project scan. Vite transform still handles modules in graph.\n }\n }));\n }\n}\n\nexport function extractBobeIconifyIcons(code: string): ExtractBobeIconifyResult {\n const icons = new Set<string>();\n const invalid = new Set<string>();\n let dynamic = 0;\n\n let ast: any;\n try {\n ast = parse(code, {\n sourceType: 'module',\n errorRecovery: true,\n plugins: [\n 'typescript',\n 'jsx'\n ],\n });\n } catch {\n return { icons: [], dynamic: 0, invalid: [] };\n }\n\n walkAst(ast, node => {\n if (node.type !== 'TaggedTemplateExpression' || !isBobeTag(node.tag)) return;\n\n for (const quasi of node.quasi?.quasis || []) {\n const raw = quasi.value?.raw ?? quasi.value?.cooked ?? '';\n const result = extractIconifyIconsFromTemplate(raw);\n for (const icon of result.icons) icons.add(icon);\n for (const icon of result.invalid) invalid.add(icon);\n dynamic += result.dynamic;\n }\n });\n\n return {\n icons: Array.from(icons).sort(),\n dynamic,\n invalid: Array.from(invalid).sort(),\n };\n}\n\nexport function extractIconifyIconsFromTemplate(template: string): ExtractBobeIconifyResult {\n const icons = new Set<string>();\n const invalid = new Set<string>();\n let dynamic = 0;\n let inIconifyElement = false;\n\n for (const line of template.split(/\\r?\\n/)) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith('//')) continue;\n\n const isContinuation = trimmed.startsWith('|');\n const isIconifyElement = /^<?iconify-icon\\b/.test(trimmed);\n if (!isContinuation) inIconifyElement = isIconifyElement;\n\n if (!isIconifyElement && !(inIconifyElement && isContinuation)) continue;\n\n for (const icon of extractStaticIconAttributes(trimmed)) {\n if (isValidIconName(icon)) {\n icons.add(icon);\n } else {\n invalid.add(icon);\n }\n }\n\n if (DYNAMIC_ICON_RE.test(trimmed)) dynamic++;\n }\n\n return {\n icons: Array.from(icons).sort(),\n dynamic,\n invalid: Array.from(invalid).sort(),\n };\n}\n\nexport async function loadIconifyCollections(iconNames: Iterable<string>, options: CollectionLoadOptions) {\n const grouped = groupIconsByPrefix(iconNames);\n const collections: Record<string, IconifyJSON> = {};\n await fs.mkdir(options.cacheDir, { recursive: true });\n\n for (const [prefix, names] of grouped) {\n const cacheFile = path.join(options.cacheDir, `${prefix}.json`);\n const cached = await readCachedCollection(cacheFile, prefix);\n const missing = Array.from(names).filter(name => !hasIcon(cached, name));\n let collection = cached;\n\n if (missing.length) {\n const remote = await fetchIconifyCollection(prefix, missing, options);\n if (remote) {\n collection = mergeCollections(prefix, cached, remote);\n await fs.writeFile(cacheFile, JSON.stringify(collection, null, 2), 'utf8');\n }\n }\n\n collections[prefix] = collection;\n }\n\n return collections;\n}\n\nexport function createIconifyVirtualModule(\n iconsByPrefix: Map<string, Set<string>>,\n collections: Record<string, IconifyJSON>,\n runtimeImports: RuntimeImportPaths = {\n iconifyIcon: 'iconify-icon',\n iconifyUtils: '@iconify/utils',\n }\n) {\n const icons = Object.fromEntries(\n Array.from(iconsByPrefix, ([prefix, names]) => [prefix, Array.from(names).sort()])\n );\n\n return [\n `import ${JSON.stringify(toImportPath(runtimeImports.iconifyIcon))};`,\n `import { addIcon } from ${JSON.stringify(toImportPath(runtimeImports.iconifyIcon))};`,\n `import { getIconData } from ${JSON.stringify(toImportPath(runtimeImports.iconifyUtils))};`,\n `const collections = ${JSON.stringify(collections)};`,\n `const icons = ${JSON.stringify(icons)};`,\n `for (const prefix of Object.keys(icons)) {`,\n ` const collection = collections[prefix];`,\n ` if (!collection) continue;`,\n ` for (const name of icons[prefix]) {`,\n ` const data = getIconData(collection, name);`,\n ` if (data) addIcon(prefix + ':' + name, data);`,\n ` }`,\n `}`,\n ``,\n ].join('\\n');\n}\n\nexport function groupIconsByPrefix(iconNames: Iterable<string>) {\n const grouped = new Map<string, Set<string>>();\n for (const iconName of normalizeIconList(iconNames)) {\n const match = ICON_NAME_RE.exec(iconName);\n if (!match) continue;\n const [, prefix, name] = match;\n if (!grouped.has(prefix)) grouped.set(prefix, new Set());\n grouped.get(prefix)!.add(name);\n }\n return grouped;\n}\n\nfunction extractStaticIconAttributes(line: string) {\n const icons: string[] = [];\n ICON_ATTR_RE.lastIndex = 0;\n let match = ICON_ATTR_RE.exec(line);\n while (match) {\n icons.push(match[2].trim());\n match = ICON_ATTR_RE.exec(line);\n }\n return icons;\n}\n\nfunction isValidIconName(icon: string) {\n return ICON_NAME_RE.test(icon);\n}\n\nfunction normalizeIconList(iconNames: Iterable<string>) {\n return Array.from(iconNames)\n .map(icon => String(icon).trim())\n .filter(Boolean)\n .filter(isValidIconName)\n .sort();\n}\n\nfunction isBobeTag(tag: any) {\n if (!tag) return false;\n if (tag.type === 'Identifier') return tag.name === 'bobe';\n if (tag.type === 'MemberExpression') {\n const property = tag.property;\n return !tag.computed && property?.type === 'Identifier' && property.name === 'bobe';\n }\n return false;\n}\n\nfunction walkAst(node: any, visit: (node: any) => void) {\n if (!node || typeof node !== 'object') return;\n if (typeof node.type === 'string') visit(node);\n\n for (const key of Object.keys(node)) {\n if (key === 'loc' || key === 'start' || key === 'end' || key === 'extra') continue;\n const value = node[key];\n if (Array.isArray(value)) {\n for (const item of value) walkAst(item, visit);\n } else if (value && typeof value === 'object') {\n walkAst(value, visit);\n }\n }\n}\n\nfunction createFilter(include?: string | string[], exclude?: string | string[]) {\n const includeMatchers = normalizeMatchers(include);\n const excludeMatchers = normalizeMatchers(exclude);\n\n return (id: string) => {\n const normalized = normalizeId(id);\n if (excludeMatchers.some(match => match(normalized))) return false;\n if (includeMatchers.length) return includeMatchers.some(match => match(normalized));\n return DEFAULT_EXTENSIONS_RE.test(normalized) && !normalized.includes('/node_modules/') && !normalized.includes('/dist/');\n };\n}\n\nfunction normalizeMatchers(value?: string | string[]) {\n return (Array.isArray(value) ? value : value ? [value] : []).map(toMatcher);\n}\n\nfunction toMatcher(pattern: string) {\n const normalized = normalizeId(pattern);\n if (!normalized.includes('*')) return (id: string) => id.includes(normalized);\n const source = normalized\n .split('*')\n .map(escapeRegExp)\n .join('.*');\n const re = new RegExp(source);\n return (id: string) => re.test(id);\n}\n\nfunction normalizeId(id: string) {\n return id.split('?')[0].replace(/\\\\/g, '/');\n}\n\nfunction escapeRegExp(value: string) {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nasync function collectSourceFiles(root: string) {\n const files: string[] = [];\n await walkDir(root, files);\n return files;\n}\n\nasync function walkDir(dir: string, files: string[]) {\n const base = path.basename(dir);\n if (base === 'node_modules' || base === 'dist' || base === '.git') return;\n\n let entries: import('node:fs').Dirent[];\n try {\n entries = await fs.readdir(dir, { withFileTypes: true });\n } catch {\n return;\n }\n\n await Promise.all(entries.map(async entry => {\n const fullPath = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n await walkDir(fullPath, files);\n return;\n }\n if (entry.isFile() && DEFAULT_EXTENSIONS_RE.test(entry.name)) files.push(fullPath);\n }));\n}\n\nasync function readCachedCollection(file: string, prefix: string): Promise<IconifyJSON> {\n try {\n const raw = await fs.readFile(file, 'utf8');\n const parsed = JSON.parse(raw);\n if (parsed?.prefix === prefix && parsed.icons && typeof parsed.icons === 'object') {\n return parsed;\n }\n } catch {\n // Missing or invalid cache is treated as an empty collection.\n }\n\n return { prefix, icons: {} };\n}\n\nasync function fetchIconifyCollection(prefix: string, names: string[], options: CollectionLoadOptions) {\n const fetcher = options.fetcher || globalThis.fetch;\n if (typeof fetcher !== 'function') {\n return handleFetchFailure(prefix, names, options, new Error('global fetch is not available'));\n }\n\n const url = `${options.apiBase.replace(/\\/$/, '')}/${prefix}.json?icons=${names.map(encodeURIComponent).join(',')}`;\n try {\n const response = await fetcher(url);\n if (!response.ok) throw new Error(`HTTP ${response.status}`);\n const json = await response.json();\n if (!json?.icons || typeof json.icons !== 'object') throw new Error('invalid Iconify response');\n return json as IconifyJSON;\n } catch (error) {\n return handleFetchFailure(prefix, names, options, error);\n }\n}\n\nfunction handleFetchFailure(prefix: string, names: string[], options: CollectionLoadOptions, error: unknown) {\n const message = `[bobe-iconify] 下载 ${prefix}:${names.join(',')} 失败,已保留 Iconify runtime fallback。${error instanceof Error ? error.message : String(error)}`;\n if (options.strict) throw new Error(message);\n options.warn?.(message);\n return null;\n}\n\nfunction mergeCollections(prefix: string, cached: IconifyJSON, remote: IconifyJSON): IconifyJSON {\n return {\n ...cached,\n ...remote,\n prefix,\n icons: {\n ...(cached.icons || {}),\n ...(remote.icons || {}),\n },\n aliases: mergeOptionalRecords(cached.aliases, remote.aliases),\n };\n}\n\nfunction mergeOptionalRecords(a?: Record<string, unknown>, b?: Record<string, unknown>) {\n const merged = { ...(a || {}), ...(b || {}) };\n return Object.keys(merged).length ? merged : undefined;\n}\n\nfunction hasIcon(collection: IconifyJSON, name: string) {\n return Boolean(collection.icons?.[name] || collection.aliases?.[name]);\n}\n\nfunction getCacheDir(config: ResolvedConfig, options: BobeIconifyPluginOptions) {\n if (options.cacheDir) {\n return path.isAbsolute(options.cacheDir)\n ? options.cacheDir\n : path.resolve(config.root, options.cacheDir);\n }\n return path.resolve(config.cacheDir, DEFAULT_CACHE_DIR);\n}\n\nfunction resolveRuntimeImports(): RuntimeImportPaths {\n return {\n iconifyIcon: requireResolve('iconify-icon/dist/iconify-icon.mjs'),\n iconifyUtils: requireResolve('@iconify/utils'),\n };\n}\n\nfunction requireResolve(id: string) {\n return require.resolve(id);\n}\n\nfunction toImportPath(id: string) {\n return id.replace(/\\\\/g, '/');\n}\n"],"names":["VIRTUAL_ID","RESOLVED_VIRTUAL_ID","DEFAULT_API_BASE","DEFAULT_CACHE_DIR","DEFAULT_EXTENSIONS_RE","ICON_NAME_RE","ICON_ATTR_RE","DYNAMIC_ICON_RE","require","createRequire","import","bobeIconifyPlugin","options","icons","Set","warnedDynamicIds","warnedInvalid","filter","createFilter","include","exclude","config","server","projectScanned","runtimeImports","addIcons","items","changed","icon","has","add","mod","moduleGraph","getModuleById","invalidateModule","scanCode","code","id","warn","result","extractBobeIconifyIcons","warnDynamic","dynamic","invalid","key","name","configResolved","resolved","resolveRuntimeImports","normalizeIconList","configureServer","devServer","buildStart","transform","message","transformIndexHtml","order","handler","build","ssr","tag","attrs","type","src","injectTo","resolveId","load","scanProjectOnce","cacheDir","getCacheDir","collections","loadIconifyCollections","apiBase","strict","createIconifyVirtualModule","groupIconsByPrefix","files","collectSourceFiles","root","Promise","all","map","file","path","normalize","endsWith","fs","readFile","logger","ast","parse","sourceType","errorRecovery","plugins","walkAst","node","isBobeTag","quasi","quasis","raw","value","cooked","extractIconifyIconsFromTemplate","Array","from","sort","template","inIconifyElement","line","split","trimmed","trim","startsWith","isContinuation","isIconifyElement","test","extractStaticIconAttributes","isValidIconName","iconNames","grouped","mkdir","recursive","_ref","_ref2","_slicedToArray","prefix","names","cacheFile","join","cached","readCachedCollection","missing","hasIcon","collection","length","remote","fetchIconifyCollection","mergeCollections","writeFile","JSON","stringify","iconsByPrefix","iconifyIcon","iconifyUtils","Object","fromEntries","toImportPath","Map","iconName","match","exec","_match","set","get","lastIndex","push","String","Boolean","property","computed","visit","keys","isArray","item","includeMatchers","normalizeMatchers","excludeMatchers","normalized","normalizeId","some","includes","toMatcher","pattern","source","escapeRegExp","re","RegExp","replace","walkDir","dir","base","basename","entries","readdir","withFileTypes","entry","fullPath","isDirectory","isFile","parsed","fetcher","globalThis","fetch","handleFetchFailure","Error","url","encodeURIComponent","response","ok","status","json","error","aliases","mergeOptionalRecords","a","b","merged","undefined","isAbsolute","resolve","requireResolve"],"mappings":";;;;;;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,WAAWA,CAAChD,MAAsB,EAAET,OAAiC,EAAE;EAC9E,IAAIA,OAAO,CAACwD,QAAQ,EAAE;IACpB,OAAOe,IAAI,CAAC6H,UAAU,CAACpM,OAAO,CAACwD,QAAQ,CAAC,GACpCxD,OAAO,CAACwD,QAAQ,GAChBe,IAAI,CAAC8H,OAAO,CAAC5L,MAAM,CAACyD,IAAI,EAAElE,OAAO,CAACwD,QAAQ,CAAC;AACjD,EAAA;EACA,OAAOe,IAAI,CAAC8H,OAAO,CAAC5L,MAAM,CAAC+C,QAAQ,EAAEjE,iBAAiB,CAAC;AACzD;AAEA,SAAS6C,qBAAqBA,GAAuB;EACnD,OAAO;AACL8F,IAAAA,WAAW,EAAEoE,cAAc,CAAC,oCAAoC,CAAC;IACjEnE,YAAY,EAAEmE,cAAc,CAAC,gBAAgB;GAC9C;AACH;AAEA,SAASA,cAAcA,CAAC7K,EAAU,EAAE;AAClC,EAAA,OAAO7B,SAAO,CAACyM,OAAO,CAAC5K,EAAE,CAAC;AAC5B;AAEA,SAAS6G,YAAYA,CAAC7G,EAAU,EAAE;AAChC,EAAA,OAAOA,EAAE,CAAC4I,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;AAC/B;;;;;;;;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
|
|
3
|
+
interface BobeIconifyPluginOptions {
|
|
4
|
+
include?: string | string[];
|
|
5
|
+
exclude?: string | string[];
|
|
6
|
+
icons?: string[];
|
|
7
|
+
apiBase?: string;
|
|
8
|
+
cacheDir?: string;
|
|
9
|
+
strict?: boolean;
|
|
10
|
+
warnDynamic?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface ExtractBobeIconifyResult {
|
|
13
|
+
icons: string[];
|
|
14
|
+
dynamic: number;
|
|
15
|
+
invalid: string[];
|
|
16
|
+
}
|
|
17
|
+
interface IconifyJSON {
|
|
18
|
+
prefix: string;
|
|
19
|
+
icons: Record<string, unknown>;
|
|
20
|
+
aliases?: Record<string, unknown>;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
interface CollectionLoadOptions {
|
|
24
|
+
apiBase: string;
|
|
25
|
+
cacheDir: string;
|
|
26
|
+
strict?: boolean;
|
|
27
|
+
fetcher?: typeof fetch;
|
|
28
|
+
warn?: (message: string) => void;
|
|
29
|
+
}
|
|
30
|
+
interface RuntimeImportPaths {
|
|
31
|
+
iconifyIcon: string;
|
|
32
|
+
iconifyUtils: string;
|
|
33
|
+
}
|
|
34
|
+
declare function bobeIconifyPlugin(options?: BobeIconifyPluginOptions): Plugin;
|
|
35
|
+
declare function extractBobeIconifyIcons(code: string): ExtractBobeIconifyResult;
|
|
36
|
+
declare function extractIconifyIconsFromTemplate(template: string): ExtractBobeIconifyResult;
|
|
37
|
+
declare function loadIconifyCollections(iconNames: Iterable<string>, options: CollectionLoadOptions): Promise<Record<string, IconifyJSON>>;
|
|
38
|
+
declare function createIconifyVirtualModule(iconsByPrefix: Map<string, Set<string>>, collections: Record<string, IconifyJSON>, runtimeImports?: RuntimeImportPaths): string;
|
|
39
|
+
declare function groupIconsByPrefix(iconNames: Iterable<string>): Map<string, Set<string>>;
|
|
40
|
+
|
|
41
|
+
export { createIconifyVirtualModule, bobeIconifyPlugin as default, extractBobeIconifyIcons, extractIconifyIconsFromTemplate, groupIconsByPrefix, loadIconifyCollections };
|
|
42
|
+
export type { BobeIconifyPluginOptions, ExtractBobeIconifyResult };
|
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { parse } from '@babel/parser';
|
|
2
|
+
import { promises } from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
5
|
+
|
|
6
|
+
function _arrayLikeToArray(r, a) {
|
|
7
|
+
(null == a || a > r.length) && (a = r.length);
|
|
8
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
9
|
+
return n;
|
|
10
|
+
}
|
|
11
|
+
function _arrayWithHoles(r) {
|
|
12
|
+
if (Array.isArray(r)) return r;
|
|
13
|
+
}
|
|
14
|
+
function _iterableToArrayLimit(r, l) {
|
|
15
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
16
|
+
if (null != t) {
|
|
17
|
+
var e,
|
|
18
|
+
n,
|
|
19
|
+
i,
|
|
20
|
+
u,
|
|
21
|
+
a = [],
|
|
22
|
+
f = true,
|
|
23
|
+
o = false;
|
|
24
|
+
try {
|
|
25
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
26
|
+
if (Object(t) !== t) return;
|
|
27
|
+
f = !1;
|
|
28
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
29
|
+
} catch (r) {
|
|
30
|
+
o = true, n = r;
|
|
31
|
+
} finally {
|
|
32
|
+
try {
|
|
33
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
34
|
+
} finally {
|
|
35
|
+
if (o) throw n;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return a;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function _nonIterableRest() {
|
|
42
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
43
|
+
}
|
|
44
|
+
function _slicedToArray(r, e) {
|
|
45
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
46
|
+
}
|
|
47
|
+
function _unsupportedIterableToArray(r, a) {
|
|
48
|
+
if (r) {
|
|
49
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
50
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
51
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const VIRTUAL_ID = 'virtual:bobe-iconify-icons';
|
|
56
|
+
const RESOLVED_VIRTUAL_ID = `\0${VIRTUAL_ID}`;
|
|
57
|
+
const DEFAULT_API_BASE = 'https://api.iconify.design';
|
|
58
|
+
const DEFAULT_CACHE_DIR = 'bobe-iconify';
|
|
59
|
+
const DEFAULT_EXTENSIONS_RE = /\.(?:[cm]?[jt]sx?|mdx?)$/;
|
|
60
|
+
const ICON_NAME_RE = /^([a-z0-9]+(?:-[a-z0-9]+)*):([a-z0-9]+[-_:.a-z0-9]*)$/i;
|
|
61
|
+
const ICON_ATTR_RE = /\bicon\s*=\s*(['"])([^'"]+)\1/g;
|
|
62
|
+
const DYNAMIC_ICON_RE = /\bicon\s*=\s*(?:\{|(['"])[^'"]*$)/;
|
|
63
|
+
const require$1 = createRequire(import.meta.url);
|
|
64
|
+
function bobeIconifyPlugin(options = {}) {
|
|
65
|
+
const icons = new Set();
|
|
66
|
+
const warnedDynamicIds = new Set();
|
|
67
|
+
const warnedInvalid = new Set();
|
|
68
|
+
const filter = createFilter(options.include, options.exclude);
|
|
69
|
+
let config;
|
|
70
|
+
let server;
|
|
71
|
+
let projectScanned = false;
|
|
72
|
+
let runtimeImports;
|
|
73
|
+
const addIcons = items => {
|
|
74
|
+
let changed = false;
|
|
75
|
+
for (const icon of items) {
|
|
76
|
+
if (icons.has(icon)) continue;
|
|
77
|
+
icons.add(icon);
|
|
78
|
+
changed = true;
|
|
79
|
+
}
|
|
80
|
+
if (changed && server) {
|
|
81
|
+
const mod = server.moduleGraph.getModuleById(RESOLVED_VIRTUAL_ID);
|
|
82
|
+
if (mod) server.moduleGraph.invalidateModule(mod);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const scanCode = (code, id, warn) => {
|
|
86
|
+
const result = extractBobeIconifyIcons(code);
|
|
87
|
+
addIcons(result.icons);
|
|
88
|
+
if (options.warnDynamic !== false && result.dynamic > 0 && !warnedDynamicIds.has(id)) {
|
|
89
|
+
warnedDynamicIds.add(id);
|
|
90
|
+
warn(`[bobe-iconify] ${id} 中存在动态 iconify-icon icon 属性,插件会跳过静态注册并保留 Iconify runtime fallback。如需本地注册,请通过 icons 配置补充。`);
|
|
91
|
+
}
|
|
92
|
+
for (const icon of result.invalid) {
|
|
93
|
+
const key = `${id}:${icon}`;
|
|
94
|
+
if (warnedInvalid.has(key)) continue;
|
|
95
|
+
warnedInvalid.add(key);
|
|
96
|
+
warn(`[bobe-iconify] 忽略非法 icon 名称 "${icon}",仅支持 "prefix:name"。来源:${id}`);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
return {
|
|
100
|
+
name: 'bobe-iconify',
|
|
101
|
+
configResolved(resolved) {
|
|
102
|
+
config = resolved;
|
|
103
|
+
runtimeImports = resolveRuntimeImports();
|
|
104
|
+
addIcons(normalizeIconList(options.icons || []));
|
|
105
|
+
},
|
|
106
|
+
configureServer(devServer) {
|
|
107
|
+
server = devServer;
|
|
108
|
+
},
|
|
109
|
+
async buildStart() {
|
|
110
|
+
addIcons(normalizeIconList(options.icons || []));
|
|
111
|
+
},
|
|
112
|
+
async transform(code, id) {
|
|
113
|
+
if (!filter(id)) return;
|
|
114
|
+
scanCode(code, id, message => this.warn(message));
|
|
115
|
+
},
|
|
116
|
+
transformIndexHtml: {
|
|
117
|
+
order: 'pre',
|
|
118
|
+
handler() {
|
|
119
|
+
if (config?.build?.ssr) return;
|
|
120
|
+
return [{
|
|
121
|
+
tag: 'script',
|
|
122
|
+
attrs: {
|
|
123
|
+
type: 'module',
|
|
124
|
+
src: `/${VIRTUAL_ID}`
|
|
125
|
+
},
|
|
126
|
+
injectTo: 'head'
|
|
127
|
+
}];
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
resolveId(id) {
|
|
131
|
+
if (id === VIRTUAL_ID || id === `/${VIRTUAL_ID}`) return RESOLVED_VIRTUAL_ID;
|
|
132
|
+
},
|
|
133
|
+
async load(id) {
|
|
134
|
+
if (id !== RESOLVED_VIRTUAL_ID) return;
|
|
135
|
+
await scanProjectOnce();
|
|
136
|
+
const cacheDir = getCacheDir(config, options);
|
|
137
|
+
const collections = await loadIconifyCollections(icons, {
|
|
138
|
+
apiBase: options.apiBase || DEFAULT_API_BASE,
|
|
139
|
+
cacheDir,
|
|
140
|
+
strict: options.strict,
|
|
141
|
+
warn: message => this.warn(message)
|
|
142
|
+
});
|
|
143
|
+
return createIconifyVirtualModule(groupIconsByPrefix(icons), collections, runtimeImports);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
async function scanProjectOnce() {
|
|
147
|
+
if (projectScanned || !config) return;
|
|
148
|
+
projectScanned = true;
|
|
149
|
+
const files = await collectSourceFiles(config.root);
|
|
150
|
+
await Promise.all(files.map(async file => {
|
|
151
|
+
const id = path.normalize(file);
|
|
152
|
+
if (!filter(id) || id.endsWith('.md') || id.endsWith('.mdx')) return;
|
|
153
|
+
try {
|
|
154
|
+
const code = await promises.readFile(file, 'utf8');
|
|
155
|
+
scanCode(code, id, message => config.logger.warn(message));
|
|
156
|
+
} catch {}
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function extractBobeIconifyIcons(code) {
|
|
161
|
+
const icons = new Set();
|
|
162
|
+
const invalid = new Set();
|
|
163
|
+
let dynamic = 0;
|
|
164
|
+
let ast;
|
|
165
|
+
try {
|
|
166
|
+
ast = parse(code, {
|
|
167
|
+
sourceType: 'module',
|
|
168
|
+
errorRecovery: true,
|
|
169
|
+
plugins: ['typescript', 'jsx']
|
|
170
|
+
});
|
|
171
|
+
} catch {
|
|
172
|
+
return {
|
|
173
|
+
icons: [],
|
|
174
|
+
dynamic: 0,
|
|
175
|
+
invalid: []
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
walkAst(ast, node => {
|
|
179
|
+
if (node.type !== 'TaggedTemplateExpression' || !isBobeTag(node.tag)) return;
|
|
180
|
+
for (const quasi of node.quasi?.quasis || []) {
|
|
181
|
+
const raw = quasi.value?.raw ?? quasi.value?.cooked ?? '';
|
|
182
|
+
const result = extractIconifyIconsFromTemplate(raw);
|
|
183
|
+
for (const icon of result.icons) icons.add(icon);
|
|
184
|
+
for (const icon of result.invalid) invalid.add(icon);
|
|
185
|
+
dynamic += result.dynamic;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
return {
|
|
189
|
+
icons: Array.from(icons).sort(),
|
|
190
|
+
dynamic,
|
|
191
|
+
invalid: Array.from(invalid).sort()
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
function extractIconifyIconsFromTemplate(template) {
|
|
195
|
+
const icons = new Set();
|
|
196
|
+
const invalid = new Set();
|
|
197
|
+
let dynamic = 0;
|
|
198
|
+
let inIconifyElement = false;
|
|
199
|
+
for (const line of template.split(/\r?\n/)) {
|
|
200
|
+
const trimmed = line.trim();
|
|
201
|
+
if (!trimmed || trimmed.startsWith('//')) continue;
|
|
202
|
+
const isContinuation = trimmed.startsWith('|');
|
|
203
|
+
const isIconifyElement = /^<?iconify-icon\b/.test(trimmed);
|
|
204
|
+
if (!isContinuation) inIconifyElement = isIconifyElement;
|
|
205
|
+
if (!isIconifyElement && !(inIconifyElement && isContinuation)) continue;
|
|
206
|
+
for (const icon of extractStaticIconAttributes(trimmed)) {
|
|
207
|
+
if (isValidIconName(icon)) {
|
|
208
|
+
icons.add(icon);
|
|
209
|
+
} else {
|
|
210
|
+
invalid.add(icon);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (DYNAMIC_ICON_RE.test(trimmed)) dynamic++;
|
|
214
|
+
}
|
|
215
|
+
return {
|
|
216
|
+
icons: Array.from(icons).sort(),
|
|
217
|
+
dynamic,
|
|
218
|
+
invalid: Array.from(invalid).sort()
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
async function loadIconifyCollections(iconNames, options) {
|
|
222
|
+
const grouped = groupIconsByPrefix(iconNames);
|
|
223
|
+
const collections = {};
|
|
224
|
+
await promises.mkdir(options.cacheDir, {
|
|
225
|
+
recursive: true
|
|
226
|
+
});
|
|
227
|
+
for (const _ref of grouped) {
|
|
228
|
+
var _ref2 = _slicedToArray(_ref, 2);
|
|
229
|
+
const prefix = _ref2[0];
|
|
230
|
+
const names = _ref2[1];
|
|
231
|
+
const cacheFile = path.join(options.cacheDir, `${prefix}.json`);
|
|
232
|
+
const cached = await readCachedCollection(cacheFile, prefix);
|
|
233
|
+
const missing = Array.from(names).filter(name => !hasIcon(cached, name));
|
|
234
|
+
let collection = cached;
|
|
235
|
+
if (missing.length) {
|
|
236
|
+
const remote = await fetchIconifyCollection(prefix, missing, options);
|
|
237
|
+
if (remote) {
|
|
238
|
+
collection = mergeCollections(prefix, cached, remote);
|
|
239
|
+
await promises.writeFile(cacheFile, JSON.stringify(collection, null, 2), 'utf8');
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
collections[prefix] = collection;
|
|
243
|
+
}
|
|
244
|
+
return collections;
|
|
245
|
+
}
|
|
246
|
+
function createIconifyVirtualModule(iconsByPrefix, collections, runtimeImports = {
|
|
247
|
+
iconifyIcon: 'iconify-icon',
|
|
248
|
+
iconifyUtils: '@iconify/utils'
|
|
249
|
+
}) {
|
|
250
|
+
const icons = Object.fromEntries(Array.from(iconsByPrefix, ([prefix, names]) => [prefix, Array.from(names).sort()]));
|
|
251
|
+
return [`import ${JSON.stringify(toImportPath(runtimeImports.iconifyIcon))};`, `import { addIcon } from ${JSON.stringify(toImportPath(runtimeImports.iconifyIcon))};`, `import { getIconData } from ${JSON.stringify(toImportPath(runtimeImports.iconifyUtils))};`, `const collections = ${JSON.stringify(collections)};`, `const icons = ${JSON.stringify(icons)};`, `for (const prefix of Object.keys(icons)) {`, ` const collection = collections[prefix];`, ` if (!collection) continue;`, ` for (const name of icons[prefix]) {`, ` const data = getIconData(collection, name);`, ` if (data) addIcon(prefix + ':' + name, data);`, ` }`, `}`, ``].join('\n');
|
|
252
|
+
}
|
|
253
|
+
function groupIconsByPrefix(iconNames) {
|
|
254
|
+
const grouped = new Map();
|
|
255
|
+
for (const iconName of normalizeIconList(iconNames)) {
|
|
256
|
+
const match = ICON_NAME_RE.exec(iconName);
|
|
257
|
+
if (!match) continue;
|
|
258
|
+
const _match = _slicedToArray(match, 3),
|
|
259
|
+
prefix = _match[1],
|
|
260
|
+
name = _match[2];
|
|
261
|
+
if (!grouped.has(prefix)) grouped.set(prefix, new Set());
|
|
262
|
+
grouped.get(prefix).add(name);
|
|
263
|
+
}
|
|
264
|
+
return grouped;
|
|
265
|
+
}
|
|
266
|
+
function extractStaticIconAttributes(line) {
|
|
267
|
+
const icons = [];
|
|
268
|
+
ICON_ATTR_RE.lastIndex = 0;
|
|
269
|
+
let match = ICON_ATTR_RE.exec(line);
|
|
270
|
+
while (match) {
|
|
271
|
+
icons.push(match[2].trim());
|
|
272
|
+
match = ICON_ATTR_RE.exec(line);
|
|
273
|
+
}
|
|
274
|
+
return icons;
|
|
275
|
+
}
|
|
276
|
+
function isValidIconName(icon) {
|
|
277
|
+
return ICON_NAME_RE.test(icon);
|
|
278
|
+
}
|
|
279
|
+
function normalizeIconList(iconNames) {
|
|
280
|
+
return Array.from(iconNames).map(icon => String(icon).trim()).filter(Boolean).filter(isValidIconName).sort();
|
|
281
|
+
}
|
|
282
|
+
function isBobeTag(tag) {
|
|
283
|
+
if (!tag) return false;
|
|
284
|
+
if (tag.type === 'Identifier') return tag.name === 'bobe';
|
|
285
|
+
if (tag.type === 'MemberExpression') {
|
|
286
|
+
const property = tag.property;
|
|
287
|
+
return !tag.computed && property?.type === 'Identifier' && property.name === 'bobe';
|
|
288
|
+
}
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
function walkAst(node, visit) {
|
|
292
|
+
if (!node || typeof node !== 'object') return;
|
|
293
|
+
if (typeof node.type === 'string') visit(node);
|
|
294
|
+
for (const key of Object.keys(node)) {
|
|
295
|
+
if (key === 'loc' || key === 'start' || key === 'end' || key === 'extra') continue;
|
|
296
|
+
const value = node[key];
|
|
297
|
+
if (Array.isArray(value)) {
|
|
298
|
+
for (const item of value) walkAst(item, visit);
|
|
299
|
+
} else if (value && typeof value === 'object') {
|
|
300
|
+
walkAst(value, visit);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
function createFilter(include, exclude) {
|
|
305
|
+
const includeMatchers = normalizeMatchers(include);
|
|
306
|
+
const excludeMatchers = normalizeMatchers(exclude);
|
|
307
|
+
return id => {
|
|
308
|
+
const normalized = normalizeId(id);
|
|
309
|
+
if (excludeMatchers.some(match => match(normalized))) return false;
|
|
310
|
+
if (includeMatchers.length) return includeMatchers.some(match => match(normalized));
|
|
311
|
+
return DEFAULT_EXTENSIONS_RE.test(normalized) && !normalized.includes('/node_modules/') && !normalized.includes('/dist/');
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
function normalizeMatchers(value) {
|
|
315
|
+
return (Array.isArray(value) ? value : value ? [value] : []).map(toMatcher);
|
|
316
|
+
}
|
|
317
|
+
function toMatcher(pattern) {
|
|
318
|
+
const normalized = normalizeId(pattern);
|
|
319
|
+
if (!normalized.includes('*')) return id => id.includes(normalized);
|
|
320
|
+
const source = normalized.split('*').map(escapeRegExp).join('.*');
|
|
321
|
+
const re = new RegExp(source);
|
|
322
|
+
return id => re.test(id);
|
|
323
|
+
}
|
|
324
|
+
function normalizeId(id) {
|
|
325
|
+
return id.split('?')[0].replace(/\\/g, '/');
|
|
326
|
+
}
|
|
327
|
+
function escapeRegExp(value) {
|
|
328
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
329
|
+
}
|
|
330
|
+
async function collectSourceFiles(root) {
|
|
331
|
+
const files = [];
|
|
332
|
+
await walkDir(root, files);
|
|
333
|
+
return files;
|
|
334
|
+
}
|
|
335
|
+
async function walkDir(dir, files) {
|
|
336
|
+
const base = path.basename(dir);
|
|
337
|
+
if (base === 'node_modules' || base === 'dist' || base === '.git') return;
|
|
338
|
+
let entries;
|
|
339
|
+
try {
|
|
340
|
+
entries = await promises.readdir(dir, {
|
|
341
|
+
withFileTypes: true
|
|
342
|
+
});
|
|
343
|
+
} catch {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
await Promise.all(entries.map(async entry => {
|
|
347
|
+
const fullPath = path.join(dir, entry.name);
|
|
348
|
+
if (entry.isDirectory()) {
|
|
349
|
+
await walkDir(fullPath, files);
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
if (entry.isFile() && DEFAULT_EXTENSIONS_RE.test(entry.name)) files.push(fullPath);
|
|
353
|
+
}));
|
|
354
|
+
}
|
|
355
|
+
async function readCachedCollection(file, prefix) {
|
|
356
|
+
try {
|
|
357
|
+
const raw = await promises.readFile(file, 'utf8');
|
|
358
|
+
const parsed = JSON.parse(raw);
|
|
359
|
+
if (parsed?.prefix === prefix && parsed.icons && typeof parsed.icons === 'object') {
|
|
360
|
+
return parsed;
|
|
361
|
+
}
|
|
362
|
+
} catch {}
|
|
363
|
+
return {
|
|
364
|
+
prefix,
|
|
365
|
+
icons: {}
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
async function fetchIconifyCollection(prefix, names, options) {
|
|
369
|
+
const fetcher = options.fetcher || globalThis.fetch;
|
|
370
|
+
if (typeof fetcher !== 'function') {
|
|
371
|
+
return handleFetchFailure(prefix, names, options, new Error('global fetch is not available'));
|
|
372
|
+
}
|
|
373
|
+
const url = `${options.apiBase.replace(/\/$/, '')}/${prefix}.json?icons=${names.map(encodeURIComponent).join(',')}`;
|
|
374
|
+
try {
|
|
375
|
+
const response = await fetcher(url);
|
|
376
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
377
|
+
const json = await response.json();
|
|
378
|
+
if (!json?.icons || typeof json.icons !== 'object') throw new Error('invalid Iconify response');
|
|
379
|
+
return json;
|
|
380
|
+
} catch (error) {
|
|
381
|
+
return handleFetchFailure(prefix, names, options, error);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
function handleFetchFailure(prefix, names, options, error) {
|
|
385
|
+
const message = `[bobe-iconify] 下载 ${prefix}:${names.join(',')} 失败,已保留 Iconify runtime fallback。${error instanceof Error ? error.message : String(error)}`;
|
|
386
|
+
if (options.strict) throw new Error(message);
|
|
387
|
+
options.warn?.(message);
|
|
388
|
+
return null;
|
|
389
|
+
}
|
|
390
|
+
function mergeCollections(prefix, cached, remote) {
|
|
391
|
+
return {
|
|
392
|
+
...cached,
|
|
393
|
+
...remote,
|
|
394
|
+
prefix,
|
|
395
|
+
icons: {
|
|
396
|
+
...(cached.icons || {}),
|
|
397
|
+
...(remote.icons || {})
|
|
398
|
+
},
|
|
399
|
+
aliases: mergeOptionalRecords(cached.aliases, remote.aliases)
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
function mergeOptionalRecords(a, b) {
|
|
403
|
+
const merged = {
|
|
404
|
+
...(a || {}),
|
|
405
|
+
...(b || {})
|
|
406
|
+
};
|
|
407
|
+
return Object.keys(merged).length ? merged : undefined;
|
|
408
|
+
}
|
|
409
|
+
function hasIcon(collection, name) {
|
|
410
|
+
return Boolean(collection.icons?.[name] || collection.aliases?.[name]);
|
|
411
|
+
}
|
|
412
|
+
function getCacheDir(config, options) {
|
|
413
|
+
if (options.cacheDir) {
|
|
414
|
+
return path.isAbsolute(options.cacheDir) ? options.cacheDir : path.resolve(config.root, options.cacheDir);
|
|
415
|
+
}
|
|
416
|
+
return path.resolve(config.cacheDir, DEFAULT_CACHE_DIR);
|
|
417
|
+
}
|
|
418
|
+
function resolveRuntimeImports() {
|
|
419
|
+
return {
|
|
420
|
+
iconifyIcon: requireResolve('iconify-icon/dist/iconify-icon.mjs'),
|
|
421
|
+
iconifyUtils: requireResolve('@iconify/utils')
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
function requireResolve(id) {
|
|
425
|
+
return require$1.resolve(id);
|
|
426
|
+
}
|
|
427
|
+
function toImportPath(id) {
|
|
428
|
+
return id.replace(/\\/g, '/');
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
export { createIconifyVirtualModule, bobeIconifyPlugin as default, extractBobeIconifyIcons, extractIconifyIconsFromTemplate, groupIconsByPrefix, loadIconifyCollections };
|
|
432
|
+
//# sourceMappingURL=iconify.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iconify.esm.js","sources":["../src/plugins/iconify/index.ts"],"sourcesContent":["import type { Plugin, ResolvedConfig, ViteDevServer } from 'vite';\nimport { parse } from '@babel/parser';\nimport { promises as fs } from 'node:fs';\nimport path from 'node:path';\nimport { createRequire } from 'node:module';\n\nconst VIRTUAL_ID = 'virtual:bobe-iconify-icons';\nconst RESOLVED_VIRTUAL_ID = `\\0${VIRTUAL_ID}`;\nconst DEFAULT_API_BASE = 'https://api.iconify.design';\nconst DEFAULT_CACHE_DIR = 'bobe-iconify';\nconst DEFAULT_EXTENSIONS_RE = /\\.(?:[cm]?[jt]sx?|mdx?)$/;\nconst ICON_NAME_RE = /^([a-z0-9]+(?:-[a-z0-9]+)*):([a-z0-9]+[-_:.a-z0-9]*)$/i;\nconst ICON_ATTR_RE = /\\bicon\\s*=\\s*(['\"])([^'\"]+)\\1/g;\nconst DYNAMIC_ICON_RE = /\\bicon\\s*=\\s*(?:\\{|(['\"])[^'\"]*$)/;\nconst require = createRequire(import.meta.url);\n\nexport interface BobeIconifyPluginOptions {\n include?: string | string[];\n exclude?: string | string[];\n icons?: string[];\n apiBase?: string;\n cacheDir?: string;\n strict?: boolean;\n warnDynamic?: boolean;\n}\n\nexport interface ExtractBobeIconifyResult {\n icons: string[];\n dynamic: number;\n invalid: string[];\n}\n\ninterface IconifyJSON {\n prefix: string;\n icons: Record<string, unknown>;\n aliases?: Record<string, unknown>;\n [key: string]: unknown;\n}\n\ninterface CollectionLoadOptions {\n apiBase: string;\n cacheDir: string;\n strict?: boolean;\n fetcher?: typeof fetch;\n warn?: (message: string) => void;\n}\n\ninterface RuntimeImportPaths {\n iconifyIcon: string;\n iconifyUtils: string;\n}\n\nexport default function bobeIconifyPlugin(options: BobeIconifyPluginOptions = {}): Plugin {\n const icons = new Set<string>();\n const warnedDynamicIds = new Set<string>();\n const warnedInvalid = new Set<string>();\n const filter = createFilter(options.include, options.exclude);\n let config: ResolvedConfig;\n let server: ViteDevServer | undefined;\n let projectScanned = false;\n let runtimeImports: RuntimeImportPaths;\n\n const addIcons = (items: Iterable<string>) => {\n let changed = false;\n for (const icon of items) {\n if (icons.has(icon)) continue;\n icons.add(icon);\n changed = true;\n }\n if (changed && server) {\n const mod = server.moduleGraph.getModuleById(RESOLVED_VIRTUAL_ID);\n if (mod) server.moduleGraph.invalidateModule(mod);\n }\n };\n\n const scanCode = (code: string, id: string, warn: (message: string) => void) => {\n const result = extractBobeIconifyIcons(code);\n addIcons(result.icons);\n\n if (options.warnDynamic !== false && result.dynamic > 0 && !warnedDynamicIds.has(id)) {\n warnedDynamicIds.add(id);\n warn(`[bobe-iconify] ${id} 中存在动态 iconify-icon icon 属性,插件会跳过静态注册并保留 Iconify runtime fallback。如需本地注册,请通过 icons 配置补充。`);\n }\n\n for (const icon of result.invalid) {\n const key = `${id}:${icon}`;\n if (warnedInvalid.has(key)) continue;\n warnedInvalid.add(key);\n warn(`[bobe-iconify] 忽略非法 icon 名称 \"${icon}\",仅支持 \"prefix:name\"。来源:${id}`);\n }\n };\n\n return {\n name: 'bobe-iconify',\n\n configResolved(resolved) {\n config = resolved;\n runtimeImports = resolveRuntimeImports();\n addIcons(normalizeIconList(options.icons || []));\n },\n\n configureServer(devServer) {\n server = devServer;\n },\n\n async buildStart() {\n addIcons(normalizeIconList(options.icons || []));\n },\n\n async transform(code, id) {\n if (!filter(id)) return;\n scanCode(code, id, message => this.warn(message));\n },\n\n transformIndexHtml: {\n order: 'pre',\n handler() {\n if (config?.build?.ssr) return;\n return [\n {\n tag: 'script',\n attrs: { type: 'module', src: `/${VIRTUAL_ID}` },\n injectTo: 'head',\n },\n ];\n },\n },\n\n resolveId(id) {\n if (id === VIRTUAL_ID || id === `/${VIRTUAL_ID}`) return RESOLVED_VIRTUAL_ID;\n },\n\n async load(id) {\n if (id !== RESOLVED_VIRTUAL_ID) return;\n\n await scanProjectOnce();\n const cacheDir = getCacheDir(config, options);\n const collections = await loadIconifyCollections(icons, {\n apiBase: options.apiBase || DEFAULT_API_BASE,\n cacheDir,\n strict: options.strict,\n warn: message => this.warn(message),\n });\n\n return createIconifyVirtualModule(groupIconsByPrefix(icons), collections, runtimeImports);\n },\n };\n\n async function scanProjectOnce() {\n if (projectScanned || !config) return;\n projectScanned = true;\n\n const files = await collectSourceFiles(config.root);\n await Promise.all(files.map(async file => {\n const id = path.normalize(file);\n if (!filter(id) || id.endsWith('.md') || id.endsWith('.mdx')) return;\n try {\n const code = await fs.readFile(file, 'utf8');\n scanCode(code, id, message => config.logger.warn(message));\n } catch {\n // Ignore unreadable files during eager project scan. Vite transform still handles modules in graph.\n }\n }));\n }\n}\n\nexport function extractBobeIconifyIcons(code: string): ExtractBobeIconifyResult {\n const icons = new Set<string>();\n const invalid = new Set<string>();\n let dynamic = 0;\n\n let ast: any;\n try {\n ast = parse(code, {\n sourceType: 'module',\n errorRecovery: true,\n plugins: [\n 'typescript',\n 'jsx'\n ],\n });\n } catch {\n return { icons: [], dynamic: 0, invalid: [] };\n }\n\n walkAst(ast, node => {\n if (node.type !== 'TaggedTemplateExpression' || !isBobeTag(node.tag)) return;\n\n for (const quasi of node.quasi?.quasis || []) {\n const raw = quasi.value?.raw ?? quasi.value?.cooked ?? '';\n const result = extractIconifyIconsFromTemplate(raw);\n for (const icon of result.icons) icons.add(icon);\n for (const icon of result.invalid) invalid.add(icon);\n dynamic += result.dynamic;\n }\n });\n\n return {\n icons: Array.from(icons).sort(),\n dynamic,\n invalid: Array.from(invalid).sort(),\n };\n}\n\nexport function extractIconifyIconsFromTemplate(template: string): ExtractBobeIconifyResult {\n const icons = new Set<string>();\n const invalid = new Set<string>();\n let dynamic = 0;\n let inIconifyElement = false;\n\n for (const line of template.split(/\\r?\\n/)) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith('//')) continue;\n\n const isContinuation = trimmed.startsWith('|');\n const isIconifyElement = /^<?iconify-icon\\b/.test(trimmed);\n if (!isContinuation) inIconifyElement = isIconifyElement;\n\n if (!isIconifyElement && !(inIconifyElement && isContinuation)) continue;\n\n for (const icon of extractStaticIconAttributes(trimmed)) {\n if (isValidIconName(icon)) {\n icons.add(icon);\n } else {\n invalid.add(icon);\n }\n }\n\n if (DYNAMIC_ICON_RE.test(trimmed)) dynamic++;\n }\n\n return {\n icons: Array.from(icons).sort(),\n dynamic,\n invalid: Array.from(invalid).sort(),\n };\n}\n\nexport async function loadIconifyCollections(iconNames: Iterable<string>, options: CollectionLoadOptions) {\n const grouped = groupIconsByPrefix(iconNames);\n const collections: Record<string, IconifyJSON> = {};\n await fs.mkdir(options.cacheDir, { recursive: true });\n\n for (const [prefix, names] of grouped) {\n const cacheFile = path.join(options.cacheDir, `${prefix}.json`);\n const cached = await readCachedCollection(cacheFile, prefix);\n const missing = Array.from(names).filter(name => !hasIcon(cached, name));\n let collection = cached;\n\n if (missing.length) {\n const remote = await fetchIconifyCollection(prefix, missing, options);\n if (remote) {\n collection = mergeCollections(prefix, cached, remote);\n await fs.writeFile(cacheFile, JSON.stringify(collection, null, 2), 'utf8');\n }\n }\n\n collections[prefix] = collection;\n }\n\n return collections;\n}\n\nexport function createIconifyVirtualModule(\n iconsByPrefix: Map<string, Set<string>>,\n collections: Record<string, IconifyJSON>,\n runtimeImports: RuntimeImportPaths = {\n iconifyIcon: 'iconify-icon',\n iconifyUtils: '@iconify/utils',\n }\n) {\n const icons = Object.fromEntries(\n Array.from(iconsByPrefix, ([prefix, names]) => [prefix, Array.from(names).sort()])\n );\n\n return [\n `import ${JSON.stringify(toImportPath(runtimeImports.iconifyIcon))};`,\n `import { addIcon } from ${JSON.stringify(toImportPath(runtimeImports.iconifyIcon))};`,\n `import { getIconData } from ${JSON.stringify(toImportPath(runtimeImports.iconifyUtils))};`,\n `const collections = ${JSON.stringify(collections)};`,\n `const icons = ${JSON.stringify(icons)};`,\n `for (const prefix of Object.keys(icons)) {`,\n ` const collection = collections[prefix];`,\n ` if (!collection) continue;`,\n ` for (const name of icons[prefix]) {`,\n ` const data = getIconData(collection, name);`,\n ` if (data) addIcon(prefix + ':' + name, data);`,\n ` }`,\n `}`,\n ``,\n ].join('\\n');\n}\n\nexport function groupIconsByPrefix(iconNames: Iterable<string>) {\n const grouped = new Map<string, Set<string>>();\n for (const iconName of normalizeIconList(iconNames)) {\n const match = ICON_NAME_RE.exec(iconName);\n if (!match) continue;\n const [, prefix, name] = match;\n if (!grouped.has(prefix)) grouped.set(prefix, new Set());\n grouped.get(prefix)!.add(name);\n }\n return grouped;\n}\n\nfunction extractStaticIconAttributes(line: string) {\n const icons: string[] = [];\n ICON_ATTR_RE.lastIndex = 0;\n let match = ICON_ATTR_RE.exec(line);\n while (match) {\n icons.push(match[2].trim());\n match = ICON_ATTR_RE.exec(line);\n }\n return icons;\n}\n\nfunction isValidIconName(icon: string) {\n return ICON_NAME_RE.test(icon);\n}\n\nfunction normalizeIconList(iconNames: Iterable<string>) {\n return Array.from(iconNames)\n .map(icon => String(icon).trim())\n .filter(Boolean)\n .filter(isValidIconName)\n .sort();\n}\n\nfunction isBobeTag(tag: any) {\n if (!tag) return false;\n if (tag.type === 'Identifier') return tag.name === 'bobe';\n if (tag.type === 'MemberExpression') {\n const property = tag.property;\n return !tag.computed && property?.type === 'Identifier' && property.name === 'bobe';\n }\n return false;\n}\n\nfunction walkAst(node: any, visit: (node: any) => void) {\n if (!node || typeof node !== 'object') return;\n if (typeof node.type === 'string') visit(node);\n\n for (const key of Object.keys(node)) {\n if (key === 'loc' || key === 'start' || key === 'end' || key === 'extra') continue;\n const value = node[key];\n if (Array.isArray(value)) {\n for (const item of value) walkAst(item, visit);\n } else if (value && typeof value === 'object') {\n walkAst(value, visit);\n }\n }\n}\n\nfunction createFilter(include?: string | string[], exclude?: string | string[]) {\n const includeMatchers = normalizeMatchers(include);\n const excludeMatchers = normalizeMatchers(exclude);\n\n return (id: string) => {\n const normalized = normalizeId(id);\n if (excludeMatchers.some(match => match(normalized))) return false;\n if (includeMatchers.length) return includeMatchers.some(match => match(normalized));\n return DEFAULT_EXTENSIONS_RE.test(normalized) && !normalized.includes('/node_modules/') && !normalized.includes('/dist/');\n };\n}\n\nfunction normalizeMatchers(value?: string | string[]) {\n return (Array.isArray(value) ? value : value ? [value] : []).map(toMatcher);\n}\n\nfunction toMatcher(pattern: string) {\n const normalized = normalizeId(pattern);\n if (!normalized.includes('*')) return (id: string) => id.includes(normalized);\n const source = normalized\n .split('*')\n .map(escapeRegExp)\n .join('.*');\n const re = new RegExp(source);\n return (id: string) => re.test(id);\n}\n\nfunction normalizeId(id: string) {\n return id.split('?')[0].replace(/\\\\/g, '/');\n}\n\nfunction escapeRegExp(value: string) {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nasync function collectSourceFiles(root: string) {\n const files: string[] = [];\n await walkDir(root, files);\n return files;\n}\n\nasync function walkDir(dir: string, files: string[]) {\n const base = path.basename(dir);\n if (base === 'node_modules' || base === 'dist' || base === '.git') return;\n\n let entries: import('node:fs').Dirent[];\n try {\n entries = await fs.readdir(dir, { withFileTypes: true });\n } catch {\n return;\n }\n\n await Promise.all(entries.map(async entry => {\n const fullPath = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n await walkDir(fullPath, files);\n return;\n }\n if (entry.isFile() && DEFAULT_EXTENSIONS_RE.test(entry.name)) files.push(fullPath);\n }));\n}\n\nasync function readCachedCollection(file: string, prefix: string): Promise<IconifyJSON> {\n try {\n const raw = await fs.readFile(file, 'utf8');\n const parsed = JSON.parse(raw);\n if (parsed?.prefix === prefix && parsed.icons && typeof parsed.icons === 'object') {\n return parsed;\n }\n } catch {\n // Missing or invalid cache is treated as an empty collection.\n }\n\n return { prefix, icons: {} };\n}\n\nasync function fetchIconifyCollection(prefix: string, names: string[], options: CollectionLoadOptions) {\n const fetcher = options.fetcher || globalThis.fetch;\n if (typeof fetcher !== 'function') {\n return handleFetchFailure(prefix, names, options, new Error('global fetch is not available'));\n }\n\n const url = `${options.apiBase.replace(/\\/$/, '')}/${prefix}.json?icons=${names.map(encodeURIComponent).join(',')}`;\n try {\n const response = await fetcher(url);\n if (!response.ok) throw new Error(`HTTP ${response.status}`);\n const json = await response.json();\n if (!json?.icons || typeof json.icons !== 'object') throw new Error('invalid Iconify response');\n return json as IconifyJSON;\n } catch (error) {\n return handleFetchFailure(prefix, names, options, error);\n }\n}\n\nfunction handleFetchFailure(prefix: string, names: string[], options: CollectionLoadOptions, error: unknown) {\n const message = `[bobe-iconify] 下载 ${prefix}:${names.join(',')} 失败,已保留 Iconify runtime fallback。${error instanceof Error ? error.message : String(error)}`;\n if (options.strict) throw new Error(message);\n options.warn?.(message);\n return null;\n}\n\nfunction mergeCollections(prefix: string, cached: IconifyJSON, remote: IconifyJSON): IconifyJSON {\n return {\n ...cached,\n ...remote,\n prefix,\n icons: {\n ...(cached.icons || {}),\n ...(remote.icons || {}),\n },\n aliases: mergeOptionalRecords(cached.aliases, remote.aliases),\n };\n}\n\nfunction mergeOptionalRecords(a?: Record<string, unknown>, b?: Record<string, unknown>) {\n const merged = { ...(a || {}), ...(b || {}) };\n return Object.keys(merged).length ? merged : undefined;\n}\n\nfunction hasIcon(collection: IconifyJSON, name: string) {\n return Boolean(collection.icons?.[name] || collection.aliases?.[name]);\n}\n\nfunction getCacheDir(config: ResolvedConfig, options: BobeIconifyPluginOptions) {\n if (options.cacheDir) {\n return path.isAbsolute(options.cacheDir)\n ? options.cacheDir\n : path.resolve(config.root, options.cacheDir);\n }\n return path.resolve(config.cacheDir, DEFAULT_CACHE_DIR);\n}\n\nfunction resolveRuntimeImports(): RuntimeImportPaths {\n return {\n iconifyIcon: requireResolve('iconify-icon/dist/iconify-icon.mjs'),\n iconifyUtils: requireResolve('@iconify/utils'),\n };\n}\n\nfunction requireResolve(id: string) {\n return require.resolve(id);\n}\n\nfunction toImportPath(id: string) {\n return id.replace(/\\\\/g, '/');\n}\n"],"names":["VIRTUAL_ID","RESOLVED_VIRTUAL_ID","DEFAULT_API_BASE","DEFAULT_CACHE_DIR","DEFAULT_EXTENSIONS_RE","ICON_NAME_RE","ICON_ATTR_RE","DYNAMIC_ICON_RE","require","createRequire","import","meta","url","bobeIconifyPlugin","options","icons","Set","warnedDynamicIds","warnedInvalid","filter","createFilter","include","exclude","config","server","projectScanned","runtimeImports","addIcons","items","changed","icon","has","add","mod","moduleGraph","getModuleById","invalidateModule","scanCode","code","id","warn","result","extractBobeIconifyIcons","warnDynamic","dynamic","invalid","key","name","configResolved","resolved","resolveRuntimeImports","normalizeIconList","configureServer","devServer","buildStart","transform","message","transformIndexHtml","order","handler","build","ssr","tag","attrs","type","src","injectTo","resolveId","load","scanProjectOnce","cacheDir","getCacheDir","collections","loadIconifyCollections","apiBase","strict","createIconifyVirtualModule","groupIconsByPrefix","files","collectSourceFiles","root","Promise","all","map","file","path","normalize","endsWith","fs","readFile","logger","ast","parse","sourceType","errorRecovery","plugins","walkAst","node","isBobeTag","quasi","quasis","raw","value","cooked","extractIconifyIconsFromTemplate","Array","from","sort","template","inIconifyElement","line","split","trimmed","trim","startsWith","isContinuation","isIconifyElement","test","extractStaticIconAttributes","isValidIconName","iconNames","grouped","mkdir","recursive","_ref","_ref2","_slicedToArray","prefix","names","cacheFile","join","cached","readCachedCollection","missing","hasIcon","collection","length","remote","fetchIconifyCollection","mergeCollections","writeFile","JSON","stringify","iconsByPrefix","iconifyIcon","iconifyUtils","Object","fromEntries","toImportPath","Map","iconName","match","exec","_match","set","get","lastIndex","push","String","Boolean","property","computed","visit","keys","isArray","item","includeMatchers","normalizeMatchers","excludeMatchers","normalized","normalizeId","some","includes","toMatcher","pattern","source","escapeRegExp","re","RegExp","replace","walkDir","dir","base","basename","entries","readdir","withFileTypes","entry","fullPath","isDirectory","isFile","parsed","fetcher","globalThis","fetch","handleFetchFailure","Error","encodeURIComponent","response","ok","status","json","error","aliases","mergeOptionalRecords","a","b","merged","undefined","isAbsolute","resolve","requireResolve"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAMA,UAAU,GAAG,4BAA4B;AAC/C,MAAMC,mBAAmB,GAAG,CAAA,EAAA,EAAKD,UAAU,CAAA,CAAE;AAC7C,MAAME,gBAAgB,GAAG,4BAA4B;AACrD,MAAMC,iBAAiB,GAAG,cAAc;AACxC,MAAMC,qBAAqB,GAAG,0BAA0B;AACxD,MAAMC,YAAY,GAAG,wDAAwD;AAC7E,MAAMC,YAAY,GAAG,gCAAgC;AACrD,MAAMC,eAAe,GAAG,mCAAmC;AAC3D,MAAMC,SAAO,GAAGC,aAAa,CAACC,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;AAsC/B,SAASC,iBAAiBA,CAACC,OAAiC,GAAG,EAAE,EAAU;AACxF,EAAA,MAAMC,KAAK,GAAG,IAAIC,GAAG,EAAU;AAC/B,EAAA,MAAMC,gBAAgB,GAAG,IAAID,GAAG,EAAU;AAC1C,EAAA,MAAME,aAAa,GAAG,IAAIF,GAAG,EAAU;EACvC,MAAMG,MAAM,GAAGC,YAAY,CAACN,OAAO,CAACO,OAAO,EAAEP,OAAO,CAACQ,OAAO,CAAC;AAC7D,EAAA,IAAIC,MAAsB;AAC1B,EAAA,IAAIC,MAAiC;EACrC,IAAIC,cAAc,GAAG,KAAK;AAC1B,EAAA,IAAIC,cAAkC;EAEtC,MAAMC,QAAQ,GAAIC,KAAuB,IAAK;IAC5C,IAAIC,OAAO,GAAG,KAAK;AACnB,IAAA,KAAK,MAAMC,IAAI,IAAIF,KAAK,EAAE;AACxB,MAAA,IAAIb,KAAK,CAACgB,GAAG,CAACD,IAAI,CAAC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;AACxD;AAEA,SAAS1E,OAAOA,CAACC,UAAuB,EAAExF,IAAY,EAAE;AACtD,EAAA,OAAOgH,OAAO,CAACxB,UAAU,CAACxH,KAAK,GAAGgC,IAAI,CAAC,IAAIwF,UAAU,CAACoE,OAAO,GAAG5J,IAAI,CAAC,CAAC;AACxE;AAEA,SAASwB,WAAWA,CAAChD,MAAsB,EAAET,OAAiC,EAAE;EAC9E,IAAIA,OAAO,CAACwD,QAAQ,EAAE;IACpB,OAAOe,IAAI,CAAC4H,UAAU,CAACnM,OAAO,CAACwD,QAAQ,CAAC,GACpCxD,OAAO,CAACwD,QAAQ,GAChBe,IAAI,CAAC6H,OAAO,CAAC3L,MAAM,CAACyD,IAAI,EAAElE,OAAO,CAACwD,QAAQ,CAAC;AACjD,EAAA;EACA,OAAOe,IAAI,CAAC6H,OAAO,CAAC3L,MAAM,CAAC+C,QAAQ,EAAEnE,iBAAiB,CAAC;AACzD;AAEA,SAAS+C,qBAAqBA,GAAuB;EACnD,OAAO;AACL8F,IAAAA,WAAW,EAAEmE,cAAc,CAAC,oCAAoC,CAAC;IACjElE,YAAY,EAAEkE,cAAc,CAAC,gBAAgB;GAC9C;AACH;AAEA,SAASA,cAAcA,CAAC5K,EAAU,EAAE;AAClC,EAAA,OAAO/B,SAAO,CAAC0M,OAAO,CAAC3K,EAAE,CAAC;AAC5B;AAEA,SAAS6G,YAAYA,CAAC7G,EAAU,EAAE;AAChC,EAAA,OAAOA,EAAE,CAAC4I,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;AAC/B;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bobe-dom",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.69",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/bobe-dom.cjs",
|
|
6
6
|
"module": "dist/bobe-dom.esm.js",
|
|
@@ -8,11 +8,14 @@
|
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"private": false,
|
|
10
10
|
"dependencies": {
|
|
11
|
+
"@babel/parser": "^8.0.0",
|
|
12
|
+
"@iconify/utils": "^3.1.3",
|
|
11
13
|
"gray-matter": "^4.0.3",
|
|
12
14
|
"highlight.js": "^11.11.1",
|
|
13
15
|
"htmlparser2": "^12.0.0",
|
|
16
|
+
"iconify-icon": "^3.0.2",
|
|
14
17
|
"marked": "^18.0.4",
|
|
15
|
-
"bobe": "0.0.
|
|
18
|
+
"bobe": "0.0.69"
|
|
16
19
|
},
|
|
17
20
|
"devDependencies": {
|
|
18
21
|
"vitest": "^4.1.7"
|
|
@@ -28,6 +31,11 @@
|
|
|
28
31
|
"import": "./dist/markdown.esm.js",
|
|
29
32
|
"require": "./dist/markdown.cjs"
|
|
30
33
|
},
|
|
34
|
+
"./plugin-iconify": {
|
|
35
|
+
"types": "./dist/iconify.d.ts",
|
|
36
|
+
"import": "./dist/iconify.esm.js",
|
|
37
|
+
"require": "./dist/iconify.cjs"
|
|
38
|
+
},
|
|
31
39
|
"./plugin-markdown/code": {
|
|
32
40
|
"types": "./dist/code.d.ts",
|
|
33
41
|
"import": "./dist/code.esm.js",
|