stylus/stylus

Stylus on Deno??

vixalien opened this issue · 0 comments

To reproduce:

Use stylus on deno, it doesn't matter whether you load it from esm.sh, unpkg or just use createRequire:

import { createRequire } from "https://deno.land/std@0.146.0/node/module.ts";

const require = createRequire(import.meta.url);

const stylus = require("stylus");

stylus.render(".foo { color: red; }", { filename: 'nesting.css' }, (err: Error, css: string) => {
  if (err) throw err;
  console.log(css);
});

Note: you can also load stylus from a CDN but it spits out the same error:

import stylus from "https://esm.sh/stylus"

Current behavior:

Every single time, an error pops out saying that there is a memory leak I believe.

error: Uncaught RangeError: Maximum call stack size exceeded
    return new Boolean(val);
           ^
    at new Boolean (file:///home/alien/sites/godson-joint/node_modules/stylus/lib/nodes/boolean.js:27:12)
    at new Boolean (file:///home/alien/sites/godson-joint/node_modules/stylus/lib/nodes/boolean.js:27:12)
    at new Boolean (file:///home/alien/sites/godson-joint/node_modules/stylus/lib/nodes/boolean.js:27:12)
    at new Boolean (file:///home/alien/sites/godson-joint/node_modules/stylus/lib/nodes/boolean.js:27:12)
    at new Boolean (file:///home/alien/sites/godson-joint/node_modules/stylus/lib/nodes/boolean.js:27:12)
    at new Boolean (file:///home/alien/sites/godson-joint/node_modules/stylus/lib/nodes/boolean.js:27:12)
    at new Boolean (file:///home/alien/sites/godson-joint/node_modules/stylus/lib/nodes/boolean.js:27:12)
    at new Boolean (file:///home/alien/sites/godson-joint/node_modules/stylus/lib/nodes/boolean.js:27:12)
    at new Boolean (file:///home/alien/sites/godson-joint/node_modules/stylus/lib/nodes/boolean.js:27:12)
    at new Boolean (file:///home/alien/sites/godson-joint/node_modules/stylus/lib/nodes/boolean.js:27:12)

Expected behavior:

I expected it to work out of the box. not sure what causes it. I rely on stylus but there aren't other libraries that compile stylus even written in other languages like rust or deno. This one is my go-to but it's broken on Deno.

Environment information:

  • stylus version: 0.58.1
  • nodejs version: v16.15.0
  • deno version: 1..23.2