sass / node-sass

:rainbow: Node.js bindings to libsass

Home Page:https://npmjs.org/package/node-sass

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nested map regression

jgranstrom opened this issue · comments

  • NPM version (npm -v): 9.5.1
  • Node version (node -v): v19.8.1
  • Node Process (node -p process.versions):
{
  node: '19.8.1',
  acorn: '8.8.2',
  ada: '1.0.4',
  ares: '1.19.0',
  brotli: '1.0.9',
  cldr: '42.0',
  icu: '72.1',
  llhttp: '8.1.0',
  modules: '111',
  napi: '8',
  nghttp2: '1.52.0',
  nghttp3: '0.7.0',
  ngtcp2: '0.8.1',
  openssl: '3.0.8+quic',
  simdutf: '3.2.2',
  tz: '2022g',
  undici: '5.21.0',
  unicode: '15.0',
  uv: '1.44.2',
  uvwasi: '0.0.16',
  v8: '10.8.168.25-node.12',
  zlib: '1.2.13'
}
  • Node Platform (node -p process.platform): darwin
  • Node architecture (node -p process.arch): arm64
  • node-sass version (node -p "require('node-sass').info"):
node-sass	9.0.0	(Wrapper)	[JavaScript]
libsass  	3.5.5	(Sass Compiler)	[C/C++]
  • npm node-sass versions (npm ls node-sass): node-sass@9.0.0

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/master/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.