spoko-design-system 2.0.0 → 2.0.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 CHANGED
@@ -1,3 +1,9 @@
1
+ ## [2.0.1](https://github.com/polo-blue/sds/compare/v2.0.0...v2.0.1) (2026-06-26)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **uno-config:** load icon collections from disk via loadCollectionFromFS ([#473](https://github.com/polo-blue/sds/issues/473)) ([cfbd892](https://github.com/polo-blue/sds/commit/cfbd8923dab1692c67b9272ce9e4e77cb6980755))
6
+
1
7
  ## [2.0.0](https://github.com/polo-blue/sds/compare/v1.40.0...v2.0.0) (2026-06-25)
2
8
 
3
9
  ### ⚠ BREAKING CHANGES
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spoko-design-system",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./index.ts",
@@ -102,6 +102,7 @@
102
102
  "@iconify-json/uil": "^1.2.3",
103
103
  "@iconify-json/vscode-icons": "^1.2.57",
104
104
  "@iconify/json": "^2.2.486",
105
+ "@iconify/utils": "^2.3.0",
105
106
  "@iconify/vue": "^5.0.1",
106
107
  "@unocss/astro": "66.7.2",
107
108
  "@unocss/preset-attributify": "66.7.2",
@@ -16,19 +16,32 @@ import presetUno from '@unocss/preset-uno'; // Primary UnoCSS preset
16
16
  import presetTypography from '@unocss/preset-typography'; // Typography preset
17
17
  import presetWebFonts from '@unocss/preset-web-fonts'; // Web fonts preset
18
18
 
19
+ import { fileURLToPath } from 'node:url';
20
+ import { dirname } from 'node:path';
21
+ import { loadCollectionFromFS } from '@iconify/utils/lib/loader/fs';
22
+
19
23
  import { shortcuts } from './theme/shortcuts/index.ts';
20
24
  import { theme } from './theme/index.ts';
21
25
  import { generatePalette, defaultPalette, type PaletteInput } from './palette-generator.ts';
22
26
  import { peerSelectorClasses, peerVariant } from './peer-variants.ts';
23
27
 
24
- // Icon collections are loaded lazily via dynamic import (see `iconCollections`
25
- // in the presetIcons config below). They are deliberately NOT statically
26
- // imported: static imports inline every collection's `icons.json` (hundreds of
27
- // MB across 26 collections) into this single module. On Vite 8's module runner
28
- // that produces an inline sourcemap larger than V8's max string length
29
- // (0x1fffffe8 536M chars), which crashes the build under Astro 7. Each loader
30
- // must use a literal specifier so the bundler can statically resolve the chunk.
31
-
28
+ // Icon collections are loaded from disk via loadCollectionFromFS anchored at
29
+ // this file's own directory. This lets Node's module resolution walk up the
30
+ // tree and find @iconify-json/* regardless of whether SDS is the root project
31
+ // or a nested dep under strict pnpm without going through the Vite module
32
+ // runner (which closes before icons are resolved during consumer builds).
33
+ // Static imports are deliberately avoided: inlining 26 collection JSONs into
34
+ // this module produces a sourcemap > V8's max string length on Vite 8 / Astro 7.
35
+ const _thisDir = dirname(fileURLToPath(import.meta.url));
36
+ const fromFS = (name: string) => () => loadCollectionFromFS(name, false, '@iconify-json', _thisDir);
37
+
38
+ const ICON_COLLECTIONS = [
39
+ 'ant-design', 'bi', 'bx', 'carbon', 'circle-flags', 'ei', 'el',
40
+ 'eos-icons', 'et', 'flowbite', 'fluent', 'fluent-emoji', 'ic',
41
+ 'icon-park-outline', 'la', 'lucide', 'material-symbols-light', 'mdi',
42
+ 'noto-v1', 'octicon', 'ph', 'simple-icons', 'system-uicons', 'uil',
43
+ 'vscode-icons', 'streamline-freehand-color',
44
+ ] as const;
32
45
 
33
46
  interface CustomConfig extends Partial<UserConfig> {
34
47
  shortcuts?: UserShortcuts;
@@ -188,38 +201,7 @@ export function createSdsConfig(customConfig: CustomConfig = {}) {
188
201
  'display': 'inline-block',
189
202
  'vertical-align': 'middle',
190
203
  },
191
- // Lazy async loaders: each collection resolves to its own dynamic-import
192
- // chunk instead of being inlined into this module (see the import note
193
- // at the top of the file). Specifiers must be string literals so the
194
- // bundler can statically resolve each chunk.
195
- collections: {
196
- 'ant-design': () => import('@iconify-json/ant-design/icons.json').then((m) => m.default),
197
- 'bi': () => import('@iconify-json/bi/icons.json').then((m) => m.default),
198
- 'bx': () => import('@iconify-json/bx/icons.json').then((m) => m.default),
199
- 'carbon': () => import('@iconify-json/carbon/icons.json').then((m) => m.default),
200
- 'circle-flags': () => import('@iconify-json/circle-flags/icons.json').then((m) => m.default),
201
- 'ei': () => import('@iconify-json/ei/icons.json').then((m) => m.default),
202
- 'el': () => import('@iconify-json/el/icons.json').then((m) => m.default),
203
- 'eos-icons': () => import('@iconify-json/eos-icons/icons.json').then((m) => m.default),
204
- 'et': () => import('@iconify-json/et/icons.json').then((m) => m.default),
205
- 'flowbite': () => import('@iconify-json/flowbite/icons.json').then((m) => m.default),
206
- 'fluent': () => import('@iconify-json/fluent/icons.json').then((m) => m.default),
207
- 'fluent-emoji': () => import('@iconify-json/fluent-emoji/icons.json').then((m) => m.default),
208
- 'ic': () => import('@iconify-json/ic/icons.json').then((m) => m.default),
209
- 'icon-park-outline': () => import('@iconify-json/icon-park-outline/icons.json').then((m) => m.default),
210
- 'la': () => import('@iconify-json/la/icons.json').then((m) => m.default),
211
- 'lucide': () => import('@iconify-json/lucide/icons.json').then((m) => m.default),
212
- 'material-symbols-light': () => import('@iconify-json/material-symbols-light/icons.json').then((m) => m.default),
213
- 'mdi': () => import('@iconify-json/mdi/icons.json').then((m) => m.default),
214
- 'noto-v1': () => import('@iconify-json/noto-v1/icons.json').then((m) => m.default),
215
- 'octicon': () => import('@iconify-json/octicon/icons.json').then((m) => m.default),
216
- 'ph': () => import('@iconify-json/ph/icons.json').then((m) => m.default),
217
- 'simple-icons': () => import('@iconify-json/simple-icons/icons.json').then((m) => m.default),
218
- 'system-uicons': () => import('@iconify-json/system-uicons/icons.json').then((m) => m.default),
219
- 'uil': () => import('@iconify-json/uil/icons.json').then((m) => m.default),
220
- 'vscode-icons': () => import('@iconify-json/vscode-icons/icons.json').then((m) => m.default),
221
- 'streamline-freehand-color': () => import('@iconify-json/streamline-freehand-color/icons.json').then((m) => m.default),
222
- }
204
+ collections: Object.fromEntries(ICON_COLLECTIONS.map((n) => [n, fromFS(n)]))
223
205
  }),
224
206
  presetTypography(),
225
207
  presetWebFonts({