Added component.json and fixed codegen to be component friendly

The function wrapper around the main code has been changed to use `exports` if it is available in the scope of the declaration and fallback to this otherwise.

Component add it's own wrapper in the form

```javascript
(function(exports, require, module) {
  // function code here
});
```

around the code, so the fix allows us to use the exports provided by component instead of the global object.

Fixes #96