-
Notifications
You must be signed in to change notification settings - Fork 464
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
Add support for embedding source files into the source map #443
Conversation
Hadn't had a close look at the sources, but the travis build only seems to break because you didn't add the source files for the json lib to the automake build system (makefile.am). Maybe you could give us more info when it segfaults (how to reproduce). |
I've added the source files and Travis is happy. There's people asking for this, any chance we can move this forward? |
This looks like a significant addition, so I'll need a bit more time to review. Thanks! |
Sure @akhleung, no problem. Look forward to hearing from you. |
On a similar note; please take a look at #324. The gist is:
I know this is not usually what happens around here, but please (only this time -- for once) consider taking LESS' lead, because they really did a great job making source-maps versatile, most comprehensive and hence quite reliable. I believe sass gem (ruby version) will also be fixed at some point to capture more / all tokens language info (which is the main point of having source-map feature in first place, in source-to-source trans-compilations). With LESS set as criteria, you can make corresponding sample code in LESS for comparing source-maps and fix libsass' mappings until the results are ditto. :) That will complete source-map feature in libsass, once forever! Thoughts? |
We, really really need a test here. I'd LOVE to merge this in, but I don't think I should till I can be sure it breaks less than the last version. I'm not really familiar with this code at all. |
I wish I could help, this would really help improve our setup at work. |
I'd love to help here but I've got a few things that prevent me from doing so:
These are pretty simple changes, is there anybody else who can put together some tests so this can be merged in? |
Hmmm... just noticed the Copyright notice and license on the Json files. I might contact the person whose email is indicated and ask if we can remove the notice, put it under our license (MIT), and give him credit in the Readme? |
Oh, apparently he's on github! Hey @joeyadams, mind if we remove the copyright notice from the file and add a shout out to you in the Readme. This is an MIT-licensed project. |
Alright, I'm going to email @joeyadams and hope that we can get this sorted out! |
Hooray, I'm useful! Yes, you can remove the copyright notices from the files and put them in the readme. I took a quick look at the code, and noticed a few issues in SourceMap::generate_source_map:
|
Thanks @joeyadams, I've removed the extra square brackets. How can I resolve the memory leak? Forgive my ignorance but I know basically zero about C :) |
@joeyadams WOO! Thanks! |
@aexmachina: to fix the memory leak, change this:
to this:
Also, I'd change the name |
fa03d0b
to
aca759d
Compare
…cesContent property as per the source maps spec
6ee4b3b
to
b002e93
Compare
Thanks @joeyadams, I've made those changes. @hcatlin I've rebased now as well. Pretty sure the merge is correct, but I suggest this needs tests and I'm not the person to write them. |
@aexmachina, this is awesome! I think one of the reasons why the build is failing is because @mgreter, would it make sense to change file.hpp#L13 and file.cpp#L120 to: char* resolve_relative_path(const string& uri, const string& base, const string& cwd) file.cpp#L171 to: return result.c_str(); If not then @aexmachina, you would need to change the calls to |
⌚ Guys should we merge it in and fix it? OP did his best. This is big step forward to have JSON support. IMO, we should serialize errors/exception messages in JSON rather than noisy/verbose XML (or at least make it optional, so the compatibility with ruby-sass doesn't get effected -- I don't know if that is needed for error messages too). See sass/node-sass#464. |
I don't think we should merge something that's failing master. Having master fail impedes progress on other features. Also from other sourcemap related discussion it seems that few of us (myself included) really understand sourcemaps to make the call here. I would defer to @akhleung and @hcatlin on this one. |
This has to be fixed as it IMO introduces some memory leaks. I also don't like that it stores the complete source twice (there is also a |
Thanks @mgreter, really glad that someone who knows C++ is looking at this :) |
Closing this in favor of #591. |
Using sourcesContent property as per the source maps spec. This PR resolves #212.
Be aware that I'm not a C developer, so I'm really making guesses here although I have enlisted the help of someone who does know C. I think it's correct, but I don't have the knowledge to write tests or really validate that what I've done is correct.
I've added integration for this into node-sass but all I get is a segfault :( Happy to pursue it further if you have some suggestions but I feel that it might be better for someone with some clues about C to take it from here :)
FYI, the JSON code is taken from CCAN.