sass / node-sass

:rainbow: Node.js bindings to libsass
https://npmjs.org/package/node-sass
MIT License
8.5k stars 1.33k forks source link

Nested map regression #3383

Open jgranstrom opened 8 months ago

jgranstrom commented 8 months ago

Nested maps have regressed at some point since version ~4, the following test case used to pass, but does not compile properly anymore: https://github.com/jgranstrom/sass-extract/blob/21072b642eca5ef1fff9f1e365c5f65189e63931/test/map-keys.js#L75-L79.

The sass being compiled is

$map: (
  string: 1em,
  1px: 'number',
  white: 'color-string',
  #123456: 'color-hex',
  rgba(0, 1, 2, 0.5): 'color-rgba',
  rgb(0, 0, 0): 'color-black-rgba',
  true: 'boolean',
  null: 'null',
  (1, 2, 3): 'list',
  (1 2 3 4): 'list-spaces',
  (a: 'map'): 'map',
  ((b: 'nested'), (c: 'maps')): 'list-maps',
  (d: 'map'): (
    nested: (
      (1, 2, 3): 'list', // `node-sass` throws Error for the nested `(1, 2, 3)` key. The problem should be with node-sass itself, as it works OK with `sass`.
      (1 2 3 4): 'list-spaces'
    )
  ),
  darken(white, 1%): 'darkened-white',
  $keyvar: 'key-variable',
);

The nested key (d: 'map') does not compile with the expected output anymore.