Skip to content

Commit

Permalink
SourceMapping hack kinda works... :D
Browse files Browse the repository at this point in the history
  • Loading branch information
xenomuta committed Aug 8, 2012
1 parent 8cbd279 commit fdd1887
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.npmignore
npm-debug.log
node_modules
img
41 changes: 33 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,43 @@ _makes debugging coffee-script easier by displaying corresponding lines of code
![Coffee-Trace](https://github.com/xenomuta/coffee-trace/raw/master/img/coffee-trace.png "Coffee-Trace")

### About Coffee-Trace
If you love Coffee-Script and Node.js as much as me, you will provably also be frustrated by the challenges of quickly finding and debugging the corresponding javascript line on the stack-trace. I wrote Coffee-Trace in an attempt to make this task easier.

I've been searching myself for a solution, and have found some very useful [links](http://www.adaltas.com/blog/2012/02/15/coffeescript-print-debug-line/ "Coffee script, how do I debug that damn js line?") and [discussions](https://github.com/jashkenas/coffee-script/issues/558 "links and discussions"), but am yet unsatisfied. So, while [SourceMaps](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/ "SourceMaps") implementation in Coffee-Script is a reality, this is the least I can do.
Coffee-Trace makes debugging coffeescript code easier by attempting to point corresponding coffeescript code and line numbers and styling the stacktrace a little bit.

### Install Usage
### Example
Running this..

Install with:
coffeescript:
require '../'

test = ->
people =
john:
first_name: 'john'
last_name: 'doe'
mary:
first_name: 'mary'
last_name: 'jane'

console.log("Welcome", people[p].first_name, people[p].last_name, "!!!") for p in ['john', 'mary', 'josh']

process.nextTick test

will result in this:
![Coffee-Trace](https://github.com/xenomuta/coffee-trace/raw/master/img/example.png "Coffee-Trace example")


### Why?
If you love Coffee-Script and Node.js, you will provably also be frustrated by the challenges of quickly finding and debugging the coffeescript line corresponding to the one pointed out by the stack-trace.

I've been searching a cleaner solution myself, and have found some very useful [links](http://www.adaltas.com/blog/2012/02/15/coffeescript-print-debug-line/ "Coffee script, how do I debug that damn js line?") and [discussions](https://github.com/jashkenas/coffee-script/issues/558 "links and discussions"), but am yet unsatisfied. So, while [SourceMaps](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/ "SourceMaps") implementation in Coffee-Script is a reality, this is the least I can do.

### Install and Usage
Become a masochist by enjoying `uncaughtExceptions` and crashes. Just by installing with:
`npm install coffee-trace`

Become a masochist by enjoying uncaught exceptions and crashes. Just `require()` it at the very beginning of your code...
and `require()`ing at the very beginning of your code...

### Utopic Future (High Hopes)

I have this crazy idea that someday I'll have some time to make this show the actual coffee-script line corresponding to the trace.
That's right boyz, full source mapping.
* Testing ( make something crash the way expected )
* Beautify and comment code
Binary file added img/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ "name": "coffee-trace"
, "version": "1.2.8"
, "version": "1.3.0"
, "engines": ["node >= 0.4.0"]
, "main": "./lib/coffee-trace.coffee"
, "dependencies": {
Expand Down

0 comments on commit fdd1887

Please sign in to comment.