From e8b4b38ac52731788bfc4701fa768c3beab40dbe Mon Sep 17 00:00:00 2001
From: supersheep <supersheepxjy@gmail.com>
Date: Fri, 11 Jul 2014 09:46:35 +0800
Subject: [PATCH] add commonjs support

---
 .gitignore          |  4 +++-
 dev/index.js        |  8 ++++++++
 dev/raphael.core.js |  5 ++++-
 package.json        | 25 +++++++++++++++++++++++++
 4 files changed, 40 insertions(+), 2 deletions(-)
 create mode 100644 dev/index.js
 create mode 100644 package.json

diff --git a/.gitignore b/.gitignore
index 9e20ae0..9c204c4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,6 @@
 node_modules
+neurons
+build
 raphael.pro-min.js
 raphael.pro.js
-/.idea
\ No newline at end of file
+/.idea
diff --git a/dev/index.js b/dev/index.js
new file mode 100644
index 0000000..5a50c49
--- /dev/null
+++ b/dev/index.js
@@ -0,0 +1,8 @@
+var core = require('./raphael.core');
+if(core.svg){
+  require('./raphael.svg');
+}
+if(core.vml){
+  require('./raphael.vml');
+}
+module.exports = core;
\ No newline at end of file
diff --git a/dev/raphael.core.js b/dev/raphael.core.js
index 5e1dff5..46e3f67 100644
--- a/dev/raphael.core.js
+++ b/dev/raphael.core.js
@@ -16,7 +16,7 @@
     } else {
         // Browser globals (glob is window)
         // Raphael adds itself to window
-        factory(glob, glob.eve);
+        factory(glob, glob.eve || (typeof require == "function" && require('eve')) );
     }
 }(this, function (window, eve) {
     /*\
@@ -5376,5 +5376,8 @@
     // Even with AMD, Raphael should be defined globally
     oldRaphael.was ? (g.win.Raphael = R) : (Raphael = R);
 
+    if(typeof exports == "object"){
+        module.exports = R;
+    }
     return R;
 }));
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..244c2b4
--- /dev/null
+++ b/package.json
@@ -0,0 +1,25 @@
+{
+  "name": "raphael",
+  "version": "2.1.2",
+  "description": "JavaScript Vector Library",
+  "main": "./dev/index.js",
+  "repository": "git://github.com/DmitryBaranovskiy/raphael.git",
+  "keywords": [
+    "vector",
+    "canvas",
+    "visualization"
+  ],
+  "license": "MIT",
+  "author": {
+    "name": "Dmitry Baranovskiy"
+  },
+  "bugs": {
+    "url": "http://github.com/DmitryBaranovskiy/raphael/issues"
+  },
+  "homepage": "http://github.com/DmitryBaranovskiy/raphael",
+  "cortex":{
+    "dependencies":{
+      "eve":"^0.5.0"
+    }
+  }
+}
\ No newline at end of file
--
libgit2 0.26.0