@@ -122,6 +122,51 @@ StyleDictionary.registerPreprocessor({
122122 } ,
123123} ) ;
124124
125+ /*
126+ * WORKAROUND for a bug in @devexpress/design-tokens-internal, present since 262.13.0: that release
127+ * dropped `color.shadow-none` from semantic/colors/*, but semantic/box-shadow/{fluent,material}.json
128+ * still reference it from every layer of `box-shadow.none`, so Style Dictionary fails the whole build
129+ * on three unresolvable references. The value the token carried up to 262.12.0 is substituted here,
130+ * which keeps the output identical to that release: `box-shadow.none` is all-zero geometry in a fully
131+ * transparent colour.
132+ *
133+ * Remove this once the package defines the token again or stops referencing it. The other two
134+ * preprocessors above patch the same class of export defect.
135+ */
136+ const REMOVED_REFERENCES = new Map ( [
137+ [ 'color.shadow-none' , 'rgba(0,0,0,0)' ] ,
138+ ] ) ;
139+
140+ StyleDictionary . registerPreprocessor ( {
141+ name : 'dx/substitute-removed-references' ,
142+ preprocessor : ( tokens ) => {
143+ const visit = ( node ) => {
144+ if ( typeof node !== 'object' || node === null ) {
145+ return ;
146+ }
147+
148+ Object . entries ( node ) . forEach ( ( [ key , value ] ) => {
149+ if ( typeof value === 'string' ) {
150+ REMOVED_REFERENCES . forEach ( ( replacement , refPath ) => {
151+ if ( value . includes ( `{${ refPath } }` ) && ! hasTokenAtPath ( tokens , refPath ) ) {
152+ console . warn ( `[design-tokens] Substituting removed reference {${ refPath } } -> ${ replacement } ` ) ;
153+ node [ key ] = value . replaceAll ( `{${ refPath } }` , replacement ) ;
154+ }
155+ } ) ;
156+
157+ return ;
158+ }
159+
160+ visit ( value ) ;
161+ } ) ;
162+ } ;
163+
164+ visit ( tokens ) ;
165+
166+ return tokens ;
167+ } ,
168+ } ) ;
169+
125170const dirname = import . meta. dirname || path . dirname ( url . fileURLToPath ( import . meta. url ) ) ;
126171const require = createRequire ( import . meta. url ) ;
127172const tokensDir = path . dirname ( require . resolve ( '@devexpress/design-tokens-internal/package.json' ) ) ;
@@ -230,7 +275,12 @@ const createConfig = (name, files, platformFiles) => ({
230275 theme : THEME_NAME ,
231276 name,
232277 source : files . map ( ( src ) => path . resolve ( tokensDir , `tokens/${ src } .json` ) ) ,
233- preprocessors : [ 'dx/fix-dangling-size-references' , 'dx/fix-composite-shadow-references' , 'tokens-studio' ] ,
278+ preprocessors : [
279+ 'dx/fix-dangling-size-references' ,
280+ 'dx/fix-composite-shadow-references' ,
281+ 'dx/substitute-removed-references' ,
282+ 'tokens-studio' ,
283+ ] ,
234284 expand : customExpand ,
235285 platforms : getPlatformSettings ( platformFiles ) ,
236286} ) ;
0 commit comments