Glavin001 / atom-preview

:construction: (NO LONGER MAINTAINED) :construction: - :eyeglasses: Ultimate previewer of source code in Atom.
https://atom.io/packages/preview
MIT License
51 stars 23 forks source link

EvalError generating Jade preview #90

Closed PyroSA closed 9 years ago

PyroSA commented 9 years ago

I'm getting an error while generating Jade previews. Coffeescript works fine.

Atom: 0.187.0 Preview: 0.13.5 Runnning in Windows 8.1 x64

The error is as follows:

Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".

Previewing Failed…

EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".
 at Function (native)
 at makePredicate (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\node_modules\constantinople\node_modules\acorn-globals\node_modules\acorn\acorn.js:508:12)
 at C:\Users\-snip-\.atom\packages\preview\node_modules\jade\node_modules\constantinople\node_modules\acorn-globals\node_modules\acorn\acorn.js:513:25
 at exports.version (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\node_modules\constantinople\node_modules\acorn-globals\node_modules\acorn\acorn.js:25:71)
 at Object.<anonymous> (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\node_modules\constantinople\node_modules\acorn-globals\node_modules\acorn\acorn.js:28:3)
 at Module._compile (module.js:475:26)
 at Object.loadFile [as .js] (D:\programs\atom\app-0.187.0\resources\app\src\babel.js:162:21)
 at Module.load (module.js:370:32)
 at Function.Module._load (module.js:325:12)
 at Module.require (module.js:380:17)
 at require (module.js:399:17)
 at Object.<anonymous> (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\node_modules\constantinople\node_modules\acorn-globals\index.js:3:13)
 at Module._compile (module.js:475:26)
 at Object.loadFile [as .js] (D:\programs\atom\app-0.187.0\resources\app\src\babel.js:162:21)
 at Module.load (module.js:370:32)
 at Function.Module._load (module.js:325:12)
 at Module.require (module.js:380:17)
 at require (module.js:399:17)
 at Object.<anonymous> (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\node_modules\constantinople\index.js:3:14)
 at Module._compile (module.js:475:26)
 at Object.loadFile [as .js] (D:\programs\atom\app-0.187.0\resources\app\src\babel.js:162:21)
 at Module.load (module.js:370:32)
 at Function.Module._load (module.js:325:12)
 at Module.require (module.js:380:17)
 at require (module.js:399:17)
 at Object.<anonymous> (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\lib\parser.js:8:22)
 at Module._compile (module.js:475:26)
 at Object.loadFile [as .js] (D:\programs\atom\app-0.187.0\resources\app\src\babel.js:162:21)
 at Module.load (module.js:370:32)
 at Function.Module._load (module.js:325:12)
 at Module.require (module.js:380:17)
 at require (module.js:399:17)
 at Object.<anonymous> (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\lib\index.js:13:14)
 at Module._compile (module.js:475:26)
 at Object.loadFile [as .js] (D:\programs\atom\app-0.187.0\resources\app\src\babel.js:162:21)
 at Module.load (module.js:370:32)
 at Function.Module._load (module.js:325:12)
 at Module.require (module.js:380:17)
 at require (module.js:399:17)
 at Object.module.exports.grammars.Jade.render (C:\Users\-snip-\.atom\packages\preview\lib\renderer.coffee:95:16)
 at atom-preview-editor.PreviewView.renderPreviewWithRenderer (C:\Users\-snip-\.atom\packages\preview\lib\preview-view.coffee:347:27)
 at atom-preview-editor.PreviewView.renderPreview (C:\Users\-snip-\.atom\packages\preview\lib\preview-view.coffee:229:6)
 at later (C:\Users\-snip-\.atom\packages\preview\node_modules\underscore-plus\node_modules\underscore\underscore.js:724:25)
Glavin001 commented 9 years ago

I was unable to reproduce this.

However I have implemented the code that would fix this.

Let me know if it works.

Glavin001 commented 9 years ago

Published to v0.13.7

PyroSA commented 9 years ago

Error still seems to be exactly the same in v0.13.7

jonasem commented 9 years ago

I've got the exact same error on v0.13.7 on OS X

bkuri commented 9 years ago

Same error with atom 0.188.0 & preview v0.13.7 on Linux

Glavin001 commented 9 years ago

Bummer. I'll try to find some time this weekend to debug. I am unable to reproduce and the changes I made with https://github.com/Glavin001/atom-preview/commit/530a425eb7c37736a06d4abeeb989e500a2ae13c should have resolved it even if I was not experiencing the issue. I'll keep looking into it. Thanks for letting me know that you are also experiencing this issue.

Glavin001 commented 9 years ago

I am now able to reproduce: I unlinked my development copy of Atom Preview and installed a fresh copy of Atom Preview with apm. Working on resolving this now.

Glavin001 commented 9 years ago

Published to v0.13.8

jonasem commented 9 years ago

Awesome, works like a charm :+1:

Glavin001 commented 9 years ago

Great! Thanks for confirming that it is working for you. Let me know if there's anything else.

PyroSA commented 9 years ago

Working for me as well!

Thanks :+1: