Glavin001/atom-preview

coffee + yield not working

Closed this issue · 4 comments

I get "error: reserved word yield" when previewing

After poking around this for a couple minutes:

  • yield was not added to CoffeeScript until version 1.9.0 (reference)
  • this package depends on "coffee-script": "^1.7.1", (reference) which pulls latest (currently 1.10.0), however
  • atom itself pulls exactly "coffee-script": "1.8.0", (reference) in latest stable (currently 1.7.x series) and even in master branch, so
  • I believe atom's version of coffee-script overrides atom-preview's version, which would mean the problem is upstream... but I could be wrong

I will shortly post tmp workaround for this.

I believe atom's version of coffee-script overrides atom-preview's version, which would mean the problem is upstream... but I could be wrong

Whoa. This would be extremely strange behaviour. Has this been confirmed?

Great work on your poking around though @dancasey !

I did not try @Necromos solution, but there is an easier way: update this package's package.json to at least "coffee-script": "^1.9.0". Here's what I did to test this:

  • git clone https://github.com/Glavin001/atom-preview.git
  • edit package.json with "coffee-script": "^1.9.3"
  • apm i
  • apm link

This works (no error with yield keyword), which I guess means that the way apm resolves packages is that saying ^1.7.1 means atom's version 1.8.0 sufficies (because ^ is at least this minor version, but same major version). When you put ^1.9.3 however, it then overrides 1.8.0.

Here's where I got this idea: looking at similar package source-preview, I saw that yield keyword works, it does not seem to do funny business with require, and it depends on coffee-script ^1.9.3.

Hope this helps.