diff --git a/index.js b/index.js deleted file mode 100644 index 50fd42bf..00000000 --- a/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./src/loadNode.js'); \ No newline at end of file diff --git a/node.js/index.js b/node.js/index.js index 82e7669b..243a9d1b 100644 --- a/node.js/index.js +++ b/node.js/index.js @@ -1,9 +1,7 @@ var fs = require('fs'), vm = require('vm'), path = require('path'), - // Have HTMLCanvasElement reference Canvas too, so we do not handle browser - // and server differently in some places of our code. - Canvas = HTMLCanvasElement =require('canvas'); + Canvas = require('canvas'); __dirname = path.resolve(__dirname, '../src/'); @@ -16,6 +14,7 @@ var context = vm.createContext({ fs: fs, // Node Canvas library: https://github.com/learnboost/node-canvas Canvas: Canvas, + HTMLCanvasElement: Canvas, Image: Canvas.Image, // Copy over global variables: console: console, diff --git a/package.json b/package.json index 1e2e4124..30481c26 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "keywords": ["canvas", "graphic", "graphics", "vector", "paper.js"], "repository": "git://github.com/paperjs/paper.js/", "dependencies": { - "canvas": "0.7.0" + "canvas": ">= 0.7.0" }, - "engines": { "node": ">= 0.4.0 && < 0.6.0" }, + "engines": { "node": ">= 0.4.0" }, "main": "./node.js/index.js" } \ No newline at end of file diff --git a/src/core/PaperScript.js b/src/core/PaperScript.js index b44febe5..de19dabf 100644 --- a/src/core/PaperScript.js +++ b/src/core/PaperScript.js @@ -155,7 +155,7 @@ var PaperScript = this.PaperScript = new function() { function evaluate(code, scope) { // Set currently active scope. paper = scope; - var view = scope.project.view, + var view = scope.project && scope.project.view, res; // Define variables for potential handlers, so eval() calls below to // fetch their values do not require try-catch around them.