Comments (4)
Thank you for your solution. It is scheduled to support source maps.
from continuation.
@TomiBelan Source map is supported experimentally. You could have a try using command below:
continuation script.js -o compiled.js
A file named compiled.js.map
will be generated and //@ sourceMappingURL=compiled.js.map
will be appended to compiled.js
from continuation.
That was fast! Looks like it's working. I had to deal with some Chrome/Webkit issues though... (For instance, console logs that happen during page load still show the compiled location. I thought it's a continuation.js issue, but when I put it in an onclick handler it started working...)
It'd be nice if the implementation didn't use a global variable. I think it'd be better API design to return both the code and the source map from compile() (perhaps only when options.sourceMap is true, if you care about API compatibility at this stage).
It's a pity that the "Generated by..." mark had to be moved to the bottom. I'm looking into whether escodegen can be convinced to put it on top.
from continuation.
As for avoiding the global variable and returning both code and source map: for instance, escodegen has an undocumented option "sourceMapWithCode" which makes the return value be { code: "the generated code", map: "the map" }
. It might make sense to adopt the same output format, and perhaps even use that option directly (though that depends on what extra stuff continuation.js is doing with the source map).
Escodegen (and source-map) doesn't seem to support line offsets or comments on top, unfortunately. The toStringWithSourceMap() function always counts from line 1.
from continuation.
Related Issues (20)
- continuous return value instead of continuous passsing style? HOT 3
- The compiler allow non-lvars as argument to cont() etc.
- Heuristics for exceptions don't work HOT 2
- Arguments scope bug HOT 2
- cont() and obtain() do not work when instantiating a class HOT 1
- using 'continue' in for (... in ...) HOT 2
- single file to use in browser or|and embed with rhino HOT 2
- Running compiler from the browser HOT 1
- Wrong binding of `this` inside `if`/`while/`for` HOT 1
- function declaration should goes to the top level HOT 3
- module searching terminates unexpectedly at certain directory HOT 1
- Wrong context when using `cont()` in switch..case HOT 1
- When using `cont()` in `if` block, the context in `if` is correct while the context after `if` is incorrect. HOT 1
- `this` get lost in try block
- new statement is mistakenly parsed in cont()'d block HOT 1
- Portable continuations? HOT 3
- ECMAScript 6 is not supported
- Incorrect textual representation of time
- Textual representation of time incorrect
- Want to meet
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from continuation.