Giter VIP home page Giter VIP logo

Comments (4)

BYVoid avatar BYVoid commented on July 17, 2024

Thank you for your solution. It is scheduled to support source maps.

from continuation.

BYVoid avatar BYVoid commented on July 17, 2024

@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.

TomiBelan avatar TomiBelan commented on July 17, 2024

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.

TomiBelan avatar TomiBelan commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.