Code Monkey home page Code Monkey logo

Comments (8)

iChenLei avatar iChenLei commented on June 2, 2024

@vixalien any idea ?

from stylus.

OktarinTentakel avatar OktarinTentakel commented on June 2, 2024

Still happening in 0.61.0.

from stylus.

vixalien avatar vixalien commented on June 2, 2024

I can confirm this error, but it doesn't seem to be introduced by 0.60.0. I hence believe the statement "version 0.59.0 works as expected" is false.

Reproducing:

  1. Create a project, I named mine stylus-test and initialize node with yarn init -y
  2. Add stylus yarn add [email protected]
  3. Create the following index.js file
var stylus = require('stylus');


const value = `
$jig---config ?= null
if !($jig---config is a 'object')
	if jig---config is defined
		$jig---config = jig---config
	else if $JIG_CONFIG is defined
		$jig---config = $JIG_CONFIG
	else if JIG_CONFIG is defined
		$jig---config = JIG_CONFIG

if !($jig---config is a 'object')
	error('jig:globals | jig config is undefined or not a hash')
`;

stylus(value).render((err, css) => {
	if (err) {
		throw err;
	}
	console.log(css);
});
  1. Run it
$ node index.js 
.../stylus-test/index.js:20
                throw err;
                ^

[Error: stylus:12:2
    8|  else if JIG_CONFIG is defined
    9|          $jig---config = JIG_CONFIG
   10| 
   11| if !($jig---config is a 'object')
   12|  error('jig:globals | jig config is undefined or not a hash')
--------^
   13| 

jig:globals | jig config is undefined or not a hash
] {
  fromStylus: true,
  lineno: 12,
  column: 2,
  filename: 'stylus',
  stylusStack: ''
}

Node.js v20.5.1

from stylus.

OktarinTentakel avatar OktarinTentakel commented on June 2, 2024

@vixalien 0.59.0 definitely works and by the way, you proved my point above, since the error thrown is exactly what's expected, but the error above is a completely different problem

your example throws my custom error, as expected, but 60/61 throws "cannot perform is 'object' undefined", which is exactly the problem since 60/61 fails at parsing "if !($jig---config is a 'object')"

from stylus.

vixalien avatar vixalien commented on June 2, 2024

sorry. It seems I misunderstood your problem.

I updated stylus to 0.61.0 and the error is still:

$ node index.js 
.../stylus-test/index.js:20
                throw err;
                ^

[Error: stylus:12:2
    8|  else if JIG_CONFIG is defined
    9|          $jig---config = JIG_CONFIG
   10| 
   11| if !($jig---config is a 'object')
   12|  error('jig:globals | jig config is undefined or not a hash')
--------^
   13| 

jig:globals | jig config is undefined or not a hash
] {
  fromStylus: true,
  lineno: 12,
  column: 2,
  filename: 'stylus',
  stylusStack: ''
}

Node.js v20.5.1

Is there something I'm not understanding?

from stylus.

OktarinTentakel avatar OktarinTentakel commented on June 2, 2024

@vixalien no, that would be expected, which is weird, since I just tested the upgrade/downgrade half an hour ago

two differences here:

I do have $JIG_CONFIG = {} previously defined before hitting the check (in another file), which should result in no error anymore and instead $jig---config just being {}

and I still have to use node 16.20 in docker, since intel macs throw segfaults in docker, so my node lts is older then yours (and running in docker, which hopefully does not make a difference here)

from stylus.

vixalien avatar vixalien commented on June 2, 2024

Thanks for explaining. It indeed seems the $JIG_CONFIG = {} was the missing thing. Since I can now reproduce the issue, I'll try to get to what caused it.

Thank you.

from stylus.

OktarinTentakel avatar OktarinTentakel commented on June 2, 2024

Just checked out the new version, everything seems to work again. Thanks a lot!

from stylus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.