-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support SourceMaps #1
Comments
I hope to deconflict the copy extensions from the other compilers, letting the others win. In the short term you could detect js in the copy.extensions and either a) remove it or b) logger.warn it. You'd do this in the validate method. |
Sounds workable. I was also having a few other issues when trying to switch mimosa-traceur to being a compiler. I used this file from mimosa-coffee as the basis for structuring the module, but the compiler wasn't being picked up at all. Apart from adding I'll push up a branch with my attempt so far, I would love it if you wouldn't mind taking a look to see if i'm missing something obvious. |
I've just push up a branch with my failing attempt to convert to a compiler. Here's the branch. |
I've also pushed a semi-working prototype of sourcemaps (without converting to a compiler) here. I've resorted to copying a bunch of mimosa's built-in javascript compiler though, so I'd definitely prefer a compiler approach. Currently, this branch just generates sourcemaps with a data-uri. I haven't figured out a way to make this play nicely with the minify and optimize steps yet either, so I need to give that some attention too. |
What you have is working for me. I tossed a
I just wanted to make sure it was being called, I didn't fiddle with the copy extensions. One thing you may want to do in your README is mention that for this to work properly it is best that One thing I'd mention, the modules don't prefix the config block with comments anymore. So this can have the leading |
You know what, you're absolutely right, the compiler is working. I had an old version of mimosa installed on my machine - when I updated to the latest, the compiler is working just fine. I'll update master so it has the latest version from the compiler branch. The traceur parts seem to be working just fine too, albeit with traceur's default configuration. In time (and tracked under a separate issue), i'll probably want to surface other configuration options for experimental features and toggling language features. The piece to the puzzle that is missing is sourcemaps. At the moment I see two issues: Currently the plugin will generate sourcemaps, however:
Are sourcemaps supported when running coffescript with minified/combined flags? If so, did you have to specify anything special to enable multi-level sourcemaps? |
Finally got back to working on trying to have multiple compilers co-exist. I'm not sure I'm going to be able to get what we need working -- to allow a traceur compiler and the copy compiler both doing the right things at the right time -- without some small hacks. The traceur compiler would need a way to opt out of "claiming" certain files. Non-copy compilers trump the copy compiler. So if a JavaScript compiler thinks it should be processing a file, it'll process the file and the copy compiler will leave it alone. An The copy compiler also defers to any other compiler by not doing anything if the file already has So the copy compiler is essentially the bitch. All of this is as of So what would happen by default, given the changes I've made for But what if traceur jacks up plain Mimosa would have no way, given they have the same extension, to determine the difference between es6 JS and non-es6 JS. So your compiler would need to take some steps. It would need an You'd also need to just If you unclaim ( I hope that all makes sense. Mimosa is heavily extension based, so its been some work to allow the same extension to do multiple things at different times. |
@dbashford Thanks again for all your help!
Traceur doesn't have any smarts for detecting if a file is ES6 (as far as I can tell), so as I'll add a new issue for supporting an I'll also give |
I guess we must be getting closer... When running When looking at the sources tab in chrome I see:
The second file I can put a breakpoint in the ES6 source and the debugger hits at the appropriate point! Apart from the full file path in the map, this is pretty much as close as I'd expect to get. I'm fairly sure the full file path is just read from the The story isn't quite as smooth when throwing the --optimize and --minify flags into the mix. The first thing I notice when running
When looking at the sources tab in chrome I see:
if I open up define('viewmodels/shell',['require','knockout' ...etc
/*
//@ sourceMappingURL=shell.js.map
*/ but since the path is wrong (presumably it should be When running When looking at the sources tab in chrome I see:
In this case, Lastly, running When looking at the sources tab in chrome I see:
The other file in the nested |
Need to figure out how to get traceurs generated sourcemaps fed back into mimosa.
mimosa-traceur
may have to become a fully fledged compiler, rather than anafterCompile
step, in order to achieve this, although this may have other implications; The default extensionjs
will likely conflict with the copy step and i'd rather not have to use a different extension if I can avoid it.The text was updated successfully, but these errors were encountered: