@vmz/plugin-iconify 0.3.5 → 0.3.7

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.
Files changed (3) hide show
  1. package/package.json +23 -8
  2. package/runtime.ts +0 -36
  3. package/vmz.plugin.ts +0 -46
package/package.json CHANGED
@@ -1,18 +1,30 @@
1
1
  {
2
2
  "dependencies": {
3
- "@vmz/plugin": "0.3.5"
3
+ "@vmz/plugin": "0.3.7"
4
4
  },
5
5
  "description": "VMZ Iconify adapter - <Iconify>",
6
+ "devDependencies": {
7
+ "@types/node": "^22.15.0",
8
+ "typescript": "^5.8.3"
9
+ },
10
+ "engines": {
11
+ "node": ">=24.12.0"
12
+ },
6
13
  "exports": {
7
14
  ".": {
8
- "default": "./vmz.plugin.ts",
9
- "types": "./vmz.plugin.ts"
15
+ "default": "./dist/vmz.plugin.js",
16
+ "types": "./dist/vmz.plugin.d.ts"
10
17
  },
11
18
  "./runtime": {
12
- "default": "./runtime.ts",
13
- "types": "./runtime.ts"
19
+ "default": "./dist/runtime.js",
20
+ "types": "./dist/runtime.d.ts"
14
21
  }
15
22
  },
23
+ "files": [
24
+ "dist",
25
+ "components",
26
+ "README.md"
27
+ ],
16
28
  "keywords": [
17
29
  "vmz",
18
30
  "plugin",
@@ -20,7 +32,7 @@
20
32
  "icon"
21
33
  ],
22
34
  "license": "MIT",
23
- "main": "./vmz.plugin.ts",
35
+ "main": "./dist/vmz.plugin.js",
24
36
  "name": "@vmz/plugin-iconify",
25
37
  "peerDependencies": {
26
38
  "@iconify/utils": ">=2"
@@ -38,7 +50,10 @@
38
50
  "type": "git",
39
51
  "url": "git+https://github.com/doki-land/vmz-framework.git"
40
52
  },
53
+ "scripts": {
54
+ "build": "tsc -p tsconfig.json"
55
+ },
41
56
  "type": "module",
42
- "types": "./vmz.plugin.ts",
43
- "version": "0.3.5"
57
+ "types": "./dist/vmz.plugin.d.ts",
58
+ "version": "0.3.7"
44
59
  }
package/runtime.ts DELETED
@@ -1,36 +0,0 @@
1
- /**
2
- * Iconify SVG fetch helper (runtime). Prefer build-time offline collections later.
3
- */
4
-
5
- const cache = new Map<string, string>();
6
-
7
- /** `name` is icon set:name e.g. `mdi:home`. */
8
- export async function loadIconSvg(name: string): Promise<string> {
9
- const key = String(name ?? '');
10
- if (cache.has(key)) return cache.get(key)!;
11
- const [prefix, icon] = key.split(':');
12
- if (!prefix || !icon) {
13
- const empty = '';
14
- cache.set(key, empty);
15
- return empty;
16
- }
17
- try {
18
- const res = await fetch(`https://api.iconify.design/${prefix}/${icon}.svg`);
19
- if (!res.ok) throw new Error(String(res.status));
20
- const svg = await res.text();
21
- cache.set(key, svg);
22
- return svg;
23
- } catch {
24
- const empty = '';
25
- cache.set(key, empty);
26
- return empty;
27
- }
28
- }
29
-
30
- export function iconFallback(name: string): string {
31
- const escaped = String(name ?? '')
32
- .replace(/&/g, '&amp;')
33
- .replace(/</g, '&lt;')
34
- .replace(/>/g, '&gt;');
35
- return `<span class="iconify-fallback" data-icon="${escaped}"></span>`;
36
- }
package/vmz.plugin.ts DELETED
@@ -1,46 +0,0 @@
1
- import { definePlugin, loadPluginSource } from '@vmz/plugin';
2
-
3
- const source = loadPluginSource(import.meta.url, 'components/Iconify.vmz');
4
-
5
- export default definePlugin({
6
- name: '@vmz/plugin-iconify',
7
- version: '0.1.0',
8
- protocol: '0.1.0',
9
- stages: ['workspace_resolve', 'analyzer'],
10
- deterministic: true,
11
- async contribute(ctx) {
12
- if (ctx.stage === 'workspace_resolve') {
13
- return {
14
- stage: 'workspace_resolve',
15
- cacheKey: `@vmz/plugin-iconify:Iconify.vmz:${source.contentHash.slice(0, 12)}`,
16
- items: [
17
- {
18
- id: 'component-iconify',
19
- kind: 'source',
20
- path: 'src/components/Iconify.vmz',
21
- content: source.content,
22
- contentHash: source.contentHash,
23
- materialize: true,
24
- },
25
- ],
26
- };
27
- }
28
- if (ctx.stage === 'analyzer') {
29
- return {
30
- stage: 'analyzer',
31
- cacheKey: '@vmz/plugin-iconify:analyzer',
32
- items: [
33
- {
34
- id: 'component-iconify-online',
35
- kind: 'analyzer',
36
- path: 'src/components/Iconify.vmz',
37
- severity: 'advice',
38
- message: 'Iconify component online',
39
- code: 'vmz.plugin.iconify',
40
- },
41
- ],
42
- };
43
- }
44
- return { stage: ctx.stage, items: [] };
45
- },
46
- });