Skip to content

fix: AUI compiler assumes tokens always exists #214

Description

@nicholasrice
file:///project/node_modules/.pnpm/@adaptive-web+adaptive-ui@0.4.1/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/@adaptive-web+adaptive-ui@0.4.1/node_modules/@adaptive-web/adaptive-ui/dist/esm/bin/aui.js:155:45
    at Array.map (<anonymous>)
    at jsonToAUIStyleSheet (file:///project/node_modules/.pnpm/@adaptive-web+adaptive-ui@0.4.1/node_modules/@adaptive-web/adaptive-ui/dist/esm/bin/aui.js:151:31)
    at Command.<anonymous> (file:///project/node_modules/.pnpm/@adaptive-web+adaptive-ui@0.4.1/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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions