Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected type inside the list #41

Open
LittleYe233 opened this issue Feb 4, 2022 · 0 comments
Open

Unexpected type inside the list #41

LittleYe233 opened this issue Feb 4, 2022 · 0 comments

Comments

@LittleYe233
Copy link

LittleYe233 commented Feb 4, 2022

I am running a Hexo blog with this package and the server throws an OperationalError below.

03:36:22.234 ERROR {
  err: [OperationalError: F:/code/nodejs/hexo-theme-unit-test/node_modules/bulma-stylus/stylus/utilities/functions.styl:8:5
      4|     if match('\b(' + $type + ')\b', typeof(v)) != null
      5|       _void = _void + 1;
      6|
      7|   if length($list) != _void
      8|     error("Unexpected type inside the list.")
  ----------^
      9|     return false;
     10|
     11|   return true;

  Unexpected type inside the list.
  ] {
    cause: [Error: F:/code/nodejs/hexo-theme-unit-test/node_modules/bulma-stylus/stylus/utilities/functions.styl:8:5
        4|     if match('\b(' + $type + ')\b', typeof(v)) != null
        5|       _void = _void + 1;
        6|
        7|   if length($list) != _void
        8|     error("Unexpected type inside the list.")
    ----------^
        9|     return false;
       10|
       11|   return true;

    Unexpected type inside the list.
    ] {
      fromStylus: true,
      lineno: 8,
      column: 5,
      filename: 'F:/code/nodejs/hexo-theme-unit-test/node_modules/bulma-stylus/stylus/utilities/functions.styl',
      stylusStack: '',
      input: "listTypeofValuesValidator($list, $type= 'rgba|hsla')\n" +
        '  _void= 0;\n' +
        '  for v, i in $list\n' +
        "    if match('\\b(' + $type + ')\\b', typeof(v)) != null\n" +
        '      _void = _void + 1;\n' +
        '\n' +
        '  if length($list) != _void\n' +
        '    error("Unexpected type inside the list.")\n' +
        '    return false;\n' +
        '\n' +
        '  return true;\n' +
        '\n' +
        'mergeColorMaps($bulma-colors, $custom-colors)\n' +
        "  // We return at least Bulma's hard-coded colors\n" +
        '  $merged-colors = $bulma-colors\n' +
        '\n' +
        '  // We want a map as input\n' +
        "  if typeof($custom-colors) == 'object'\n" +
        '    for $name, $components in $custom-colors\n' +
        '      // The color name should be a string\n' +
        '      // and the components either a single color\n' +
        '      // or a colors list with at least one element\n' +
        "      if typeof($name) == 'string' and (typeof($components) == 'ident' or listTypeofValuesValidator($components, 'rgba|hsla')) and length($components) >= 1\n" +
        '        $color-base = null\n' +
        '        $color-invert = null\n' +
        '        $color-light = null\n' +
        '        $color-dark = null\n' +
        '        $value = null\n' +
        '\n' +
        '        // The param can either be a single color\n' +
        '        // or a list of 2 colors\n' +
        "        if listTypeofValuesValidator($components, 'rgba|hsla') and length($components) == 1\n" +
        '          $color-base = $components\n' +
        '          $color-invert = findColorInvert($color-base)\n' +
        '          $color-light = findLightColor($color-base)\n' +
        '          $color-dark = findDarkColor($color-base)\n' +
        "        else if listTypeofValuesValidator($components, 'rgba|hsla') and length($components) > 1\n" +
        '          $color-base = $components[0]\n' +
        '          // If Invert, Light and Dark are provided\n' +
        '          if length($components) > 3\n' +
        '            $color-invert = $components[1]\n' +
        '            $color-light = $components[2]\n' +
        '            $color-dark = $components[3]\n' +
        '            // If only Invert and Light are provided\n' +
        '          else if length($components) > 2\n' +
        '            $color-invert = $components[1]\n' +
        '            $color-light = $components[2]\n' +
        '            $color-dark = findDarkColor($color-base)\n' +
        '            // If only Invert is provided\n' +
        '          else\n' +
        '            $color-invert = $components[1]\n' +
        '            $color-light = findLightColor($color-base)\n' +
        '            $color-dark = findDarkColor($color-base)\n' +
        '\n' +
        '        $value = {\n' +
        "          '1': $color-base,\n" +
        "          '2': $color-invert,\n" +
        "          '3': $color-light,\n" +
        "          '4': $color-dark\n" +
        '        }\n' +
        '\n' +
        '        // We only want to merge the map if the color base is an actual color\n' +
        "        if match('\\b(rgba|hsla)\\b', typeof($color-base))\n" +
        "          // We merge this colors elements as map with Bulma's colors map\n" +
        '          // (we can override them this way, no multiple definition for the same name)\n' +
        '          // $merged-colors: map_merge($merged-colors, ($name: ($color-base, $color-invert, $color-light, $color-dark)))\n' +
        '          $merged-colors[$name] = $value\n' +
        '\n' +
        '  return $merged-colors\n' +
        '\n' +
        'powerNumber($number, $exp)\n' +
        '  return $number ** $exp\n' +
        '\n' +
        'colorLuminance($color)\n' +
        "  $color-rgb = {'red': red($color),'green': green($color),'blue': blue($color)}\n" +
        '  for $name, $value in $color-rgb\n' +
        '    $adjusted = 0\n' +
        '    $value = $value / 255\n' +
        '    if $value < 0.03928\n' +
        '      $value = $value / 12.92\n' +
        '    else\n' +
        '      $value = ($value + .055) / 1.055\n' +
        '      $value = powerNumber($value, 2)\n' +
        '    $color-rgb[$name] = $value\n' +
        "  return (($color-rgb['red'] * .2126) + ($color-rgb['green'] * .7152) + ($color-rgb['blue'] * .0722))\n" +
        '\n' +
        'findColorInvert($color)\n' +
        '  if colorLuminance($color) > 0.55\n' +
        '    return rgba(#000, 0.7)\n' +
        '  else\n' +
        '    return #fff\n' +
        '\n' +
        'findLightColor($color)\n' +
        "  if typeof($color) == 'rgba' or typeof($color) == 'hsla'\n" +
        '    $l = 96%\n' +
        '    if lightness($color) > 96%\n' +
        '      $l = lightness($color)\n' +
        '    return lightness($color, $l)\n' +
        '  return $background\n' +
        '\n' +
        'findDarkColor($color)\n' +
        "  if typeof($color) == 'rgba' or typeof($color) == 'hsla'\n" +
        '    $base-l = 29%\n' +
        '    $luminance = colorLuminance($color)\n' +
        '    $luminance-delta = (0.53 - $luminance)\n' +
        '    $target-l = round($base-l + ($luminance-delta * 53))\n' +
        '    return lightness($color, max($base-l, $target-l))\n' +
        '  return $text-strong\n' +
        '\n' +
        '/* Bif replacements to match the behaviour of Sass */\n' +
        '\n' +
        'bulma-stylus-darken($color, $amount)\n' +
        '  return lightness($color, lightness($color) - $amount)\n' +
        '\n' +
        'bulma-stylus-lighten($color, $amount)\n' +
        '  return lightness($color, lightness($color) + $amount)\n' +
        '\n' +
        'bulma-stylus-saturate($color, $amount)\n' +
        '  return saturation($color, saturation($color) + $amount)\n'
    },
    isOperational: true,
    fromStylus: true,
    lineno: 8,
    column: 5,
    filename: 'F:/code/nodejs/hexo-theme-unit-test/node_modules/bulma-stylus/stylus/utilities/functions.styl',
    stylusStack: '',
    input: "listTypeofValuesValidator($list, $type= 'rgba|hsla')\n" +
      '  _void= 0;\n' +
      '  for v, i in $list\n' +
      "    if match('\\b(' + $type + ')\\b', typeof(v)) != null\n" +
      '      _void = _void + 1;\n' +
      '\n' +
      '  if length($list) != _void\n' +
      '    error("Unexpected type inside the list.")\n' +
      '    return false;\n' +
      '\n' +
      '  return true;\n' +
      '\n' +
      'mergeColorMaps($bulma-colors, $custom-colors)\n' +
      "  // We return at least Bulma's hard-coded colors\n" +
      '  $merged-colors = $bulma-colors\n' +
      '\n' +
      '  // We want a map as input\n' +
      "  if typeof($custom-colors) == 'object'\n" +
      '    for $name, $components in $custom-colors\n' +
      '      // The color name should be a string\n' +
      '      // and the components either a single color\n' +
      '      // or a colors list with at least one element\n' +
      "      if typeof($name) == 'string' and (typeof($components) == 'ident' or listTypeofValuesValidator($components, 'rgba|hsla')) and length($components) >= 1\n" +
      '        $color-base = null\n' +
      '        $color-invert = null\n' +
      '        $color-light = null\n' +
      '        $color-dark = null\n' +
      '        $value = null\n' +
      '\n' +
      '        // The param can either be a single color\n' +
      '        // or a list of 2 colors\n' +
      "        if listTypeofValuesValidator($components, 'rgba|hsla') and length($components) == 1\n" +
      '          $color-base = $components\n' +
      '          $color-invert = findColorInvert($color-base)\n' +
      '          $color-light = findLightColor($color-base)\n' +
      '          $color-dark = findDarkColor($color-base)\n' +
      "        else if listTypeofValuesValidator($components, 'rgba|hsla') and length($components) > 1\n" +
      '          $color-base = $components[0]\n' +
      '          // If Invert, Light and Dark are provided\n' +
      '          if length($components) > 3\n' +
      '            $color-invert = $components[1]\n' +
      '            $color-light = $components[2]\n' +
      '            $color-dark = $components[3]\n' +
      '            // If only Invert and Light are provided\n' +
      '          else if length($components) > 2\n' +
      '            $color-invert = $components[1]\n' +
      '            $color-light = $components[2]\n' +
      '            $color-dark = findDarkColor($color-base)\n' +
      '            // If only Invert is provided\n' +
      '          else\n' +
      '            $color-invert = $components[1]\n' +
      '            $color-light = findLightColor($color-base)\n' +
      '            $color-dark = findDarkColor($color-base)\n' +
      '\n' +
      '        $value = {\n' +
      "          '1': $color-base,\n" +
      "          '2': $color-invert,\n" +
      "          '3': $color-light,\n" +
      "          '4': $color-dark\n" +
      '        }\n' +
      '\n' +
      '        // We only want to merge the map if the color base is an actual color\n' +
      "        if match('\\b(rgba|hsla)\\b', typeof($color-base))\n" +
      "          // We merge this colors elements as map with Bulma's colors map\n" +
      '          // (we can override them this way, no multiple definition for the same name)\n' +
      '          // $merged-colors: map_merge($merged-colors, ($name: ($color-base, $color-invert, $color-light, $color-dark)))\n' +
      '          $merged-colors[$name] = $value\n' +
      '\n' +
      '  return $merged-colors\n' +
      '\n' +
      'powerNumber($number, $exp)\n' +
      '  return $number ** $exp\n' +
      '\n' +
      'colorLuminance($color)\n' +
      "  $color-rgb = {'red': red($color),'green': green($color),'blue': blue($color)}\n" +
      '  for $name, $value in $color-rgb\n' +
      '    $adjusted = 0\n' +
      '    $value = $value / 255\n' +
      '    if $value < 0.03928\n' +
      '      $value = $value / 12.92\n' +
      '    else\n' +
      '      $value = ($value + .055) / 1.055\n' +
      '      $value = powerNumber($value, 2)\n' +
      '    $color-rgb[$name] = $value\n' +
      "  return (($color-rgb['red'] * .2126) + ($color-rgb['green'] * .7152) + ($color-rgb['blue'] * .0722))\n" +
      '\n' +
      'findColorInvert($color)\n' +
      '  if colorLuminance($color) > 0.55\n' +
      '    return rgba(#000, 0.7)\n' +
      '  else\n' +
      '    return #fff\n' +
      '\n' +
      'findLightColor($color)\n' +
      "  if typeof($color) == 'rgba' or typeof($color) == 'hsla'\n" +
      '    $l = 96%\n' +
      '    if lightness($color) > 96%\n' +
      '      $l = lightness($color)\n' +
      '    return lightness($color, $l)\n' +
      '  return $background\n' +
      '\n' +
      'findDarkColor($color)\n' +
      "  if typeof($color) == 'rgba' or typeof($color) == 'hsla'\n" +
      '    $base-l = 29%\n' +
      '    $luminance = colorLuminance($color)\n' +
      '    $luminance-delta = (0.53 - $luminance)\n' +
      '    $target-l = round($base-l + ($luminance-delta * 53))\n' +
      '    return lightness($color, max($base-l, $target-l))\n' +
      '  return $text-strong\n' +
      '\n' +
      '/* Bif replacements to match the behaviour of Sass */\n' +
      '\n' +
      'bulma-stylus-darken($color, $amount)\n' +
      '  return lightness($color, lightness($color) - $amount)\n' +
      '\n' +
      'bulma-stylus-lighten($color, $amount)\n' +
      '  return lightness($color, lightness($color) + $amount)\n' +
      '\n' +
      'bulma-stylus-saturate($color, $amount)\n' +
      '  return saturation($color, saturation($color) + $amount)\n'
  }
} Asset render failed: %s css/default.css

In the previous runs I used [email protected] and there were no errors. The current bulma-stylus version I use is 0.9.2-rc.1. So what happens?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant