@@ -3,6 +3,7 @@ import path from 'node:path'
33import url from 'node:url'
44import type { Config } from 'tailwindcss'
55import type { DesignSystem } from '../../../../tailwindcss/src/design-system'
6+ import { DefaultMap } from '../../../../tailwindcss/src/utils/default-map'
67import { printCandidate } from '../candidates'
78
89const __filename = url . fileURLToPath ( import . meta. url )
@@ -46,24 +47,16 @@ const THEME_KEYS = {
4647 'blur-xs' : '--blur-xs' ,
4748}
4849
49- const SEEDED = new WeakSet < DesignSystem > ( )
50+ const DESIGN_SYSTEMS = new DefaultMap ( ( base ) => {
51+ return __unstable__loadDesignSystem ( '@import "tailwindcss";' , { base } )
52+ } )
5053
5154export async function legacyClasses (
5255 designSystem : DesignSystem ,
5356 _userConfig : Config ,
5457 rawCandidate : string ,
5558) : Promise < string > {
56- // Prepare design system with the unknown legacy classes
57- if ( ! SEEDED . has ( designSystem ) ) {
58- for ( let old in LEGACY_CLASS_MAP ) {
59- designSystem . utilities . static ( old , ( ) => [ ] )
60- }
61- SEEDED . add ( designSystem )
62- }
63-
64- let defaultDesignSystem = await __unstable__loadDesignSystem ( '@import "tailwindcss";' , {
65- base : __dirname ,
66- } )
59+ let defaultDesignSystem = await DESIGN_SYSTEMS . get ( __dirname )
6760
6861 for ( let candidate of designSystem . parseCandidate ( rawCandidate ) ) {
6962 if ( candidate . kind === 'static' && Object . hasOwn ( LEGACY_CLASS_MAP , candidate . root ) ) {
0 commit comments