Adaptive-Web-Components icon indicating copy to clipboard operation
Adaptive-Web-Components copied to clipboard

fix: AUI compiler assumes tokens always exists

Open nicholasrice opened this issue 7 months ago • 0 comments

file:///project/node_modules/.pnpm/@[email protected]/node_modules/@adaptive-web/adaptive-ui/dist/esm/bin/aui.js:155
            const properties = style.tokens.reduce((prev, current) => {
                                            ^

TypeError: Cannot read properties of undefined (reading 'reduce')
    at file:///project/node_modules/.pnpm/@[email protected]/node_modules/@adaptive-web/adaptive-ui/dist/esm/bin/aui.js:155:45
    at Array.map (<anonymous>)
    at jsonToAUIStyleSheet (file:///project/node_modules/.pnpm/@[email protected]/node_modules/@adaptive-web/adaptive-ui/dist/esm/bin/aui.js:151:31)
    at Command.<anonymous> (file:///project/node_modules/.pnpm/@[email protected]/node_modules/@adaptive-web/adaptive-ui/dist/esm/bin/aui.js:59:19)

Node.js v20.10.0

When running AUI figma compiler against an anatomy where a style rule does not contain a 'tokens' property, this error is thrown. This is a valid case, so the fix is the just to check for style.tokens prior to reducing it.

nicholasrice avatar Jul 11 '24 18:07 nicholasrice