-
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
[WIP] Implements embedding source contents in source maps #591
Conversation
Let's see if we can improve that code coverage score :) |
55410b9
to
bb91e27
Compare
39ff993
to
14c193b
Compare
Its positive again! ✔️ Should we have tests for it on SASSC? |
Is it possible to test this kind of stuff with sassc easily? |
14c193b
to
1b00718
Compare
The license looks fine to me to remove the notice, since they are declaring On Wed, Oct 29, 2014 at 6:42 PM, Coveralls notifications@github.com wrote:
|
@@ -25,7 +25,7 @@ install: | |||
|
|||
after_success: | |||
# exclude some directories from profiling (.libs is from autotools) | |||
- export EXCLUDE_COVERAGE="--exclude sassc --exclude sass-spec --exclude .libs" | |||
- export EXCLUDE_COVERAGE="-e sassc -e sass-spec -e .libs -e json.hpp -e json.cpp -e debug.hpp -e cencode.c -e b64 -e utf8 -e utf8.h -e utf8_string.hpp -e utf8_string.cpp -e test" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: it's good manners use long flags where possible. Make it easy to grok without consulting documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will have a look at how I can write this as a multiline command and will change it back to long flags again!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC this might work
export FOO="foo --bar bar \
--baz baz \
--bam bam"
I'm not overly familiar with sourcemaps but there's nothing here that jumps out at me 👍 |
@mgreter, I have pulled your branch and json.cpp presented new challenges when compiling with VS2013' cl.exe. Incidentally, there were three warnings json.cpp#L1175-L1177 and they are fixed by this orthodox way: http://stackoverflow.com/a/15486664/863980 😄 instead use: *b++ = 0xEFu;
*b++ = 0xBFu;
*b++ = 0xBDu; |
I wonder if it's possible for travis to run our builds against Windows so we can catch these issue sooner. |
Travis-CI doesn't have Windows. Appveyor is the one we use on node-sass. It has perl, python, VS2013, MinGW etc. Take a look at this: sass/libsass-net@94abbd7#commitcomment-8333599. :D I tried but didn't get too far with that.. Only if we can get cl.exe compatible nmake file, then we can configure it. |
Is there a upstream repository for this json library on github? |
That does not seem to be available on GitHub. It's over here: https://git.ozlabs.org/?p=ccan;a=tree;f=ccan/json. We can probably checkout @pb82's repository: https://github.com/pb82/JSON.cpp. |
I guess we got the main technical problems covered (which still need to be fixed), but what about the naming of the options?
Any better ideas (since I'm not really convinced that these are the best)? |
1b00718
to
53a568a
Compare
@am11: IMO |
Incidentally, should we look for other repos for json.cpp on GitHub as well? For instance, this one looks promising: https://github.com/open-source-parsers/jsoncpp. |
Honestly the current json lib feels much leaner than jsoncpp. And it's a pitty that only the error reporting is a problem and not the actual implementation ... but yeah, it may be the only viable solution. But IMHO the author of the current json lib is on github, so we may can get this that way working!? As always, feel free to make a PR ;) // CC @joeyadams |
Will do that! :) |
👍 Lets see what travis ci has to say :) |
0732248
to
8561dcd
Compare
It should now behave as before (at least for the node-sass tests). Will now create some unit tests of my own for |
Got it to pass all unit tests on my machine (Win7): There were some other minor issues:
The watch process is still not terminating correctly! |
@mgreter, thanks for adding more tests for node-sass! Please move the css/scss files to I will try running your tests now. Meanwhile, FWIW -- I use PowerShell with the following approach: (given you have Python 2.7.8 and VS2013 Express for Desktop 2013 installed) cd ./into/node-sass/
# if you haven't already, run
npm install -g node-gyp
# 1- given you have the remote: git remote add node-sass https://github.com/sass/node-sass
git pull --rebase node-sass master
# clear out the old pacakges
rm -r node_modules
# 2- install npm will download the dependencies and rebuild libsass binary,
# it then clones into sass/node-sass-binaries repo and copies the
# prebuild binaries (of all OS'es architectures into ./bin/)
npm install
# 3- its a bug in our build script that npm install first build the binary, copies it to ./bin/
# then it overwrites that binary as part of copying binaries from node-sass-clone,
# therefore, remove the windows binaries:
rm -r build; rm -r ./bin/win32-ia32-v8-3.14 -Force; rm -r ./bin/win32-x64-v8-3.14 -Force
# 4- if you want to modify ./src/libsass, now is the time, then:
node ./lib/build.js
npm test
# or you can just do "node" and enter node.js interactive shell
# where you can use: var sass = require("./lib");
# to get a node-sass object. If you want to modify |
I pulled your branch and tested with latest libsass, it passes all the tests and exited gracefully. I had to change diff --git a/binding.gyp b/binding.gyp
index 6b8e506..743888f 100644
--- a/binding.gyp
+++ b/binding.gyp
@@ -8,6 +8,7 @@
'src/libsass/ast.cpp',
'src/libsass/base64vlq.cpp',
'src/libsass/bind.cpp',
+ 'src/libsass/cencode.c',
'src/libsass/constants.cpp',
'src/libsass/context.cpp',
'src/libsass/contextualize.cpp',
@@ -19,6 +20,7 @@
'src/libsass/file.cpp',
'src/libsass/functions.cpp',
'src/libsass/inspect.cpp',
+ 'src/libsass/json.cpp',
'src/libsass/node.cpp',
'src/libsass/output_compressed.cpp',
'src/libsass/output_nested.cpp', See my branch: https://github.com/am11/node-sass/tree/mgreter-changes. |
Yeah, you def need to rebase to mirror the latest master before PR. A lot of changes happened in the tests structure. |
There are two commits. I just used the Anyway, probably the wrong thread to discuss this any further! IMHO this PR is ready to get merged! // CC @am11, @xzyfer, @hcatlin |
@mgreter for this PR, should we consider |
Also fixes the warning for unsigned char*.
- embed sources content inside source map - embed source map inside sourceMappingURL
They provide far more code than we actually use. And we certainly don't want to test all that code! Reverts back to using longhand options in travi-ci! Fixes some minor clang warnings in sass.cpp.
8561dcd
to
bff1afc
Compare
[WIP] Implements embedding source contents in source maps
- Remove line-breaks in Base64 encoded string - Actually embed the source-map json in data-url - Include original source in sources array
[BUGFIX] Add fix for source-maps (Fix-Up PR #591)
Implementation fallows source map spec (v3).
[edit] Added todo tasks for QA:
This is based on PR #443 by @aexmachina
Also streamlined status information for included sources. Added helper function
add_source
to build the storage for the status information, collecting this data:queue
: Internal queue of items to processincluded_files
: Absolute path to the included fileinclude_links
: Relative path (tosource_map_file
)sources
: The content of the include (is freed onContext
destruction)source_map.source_index
: Index to access the status info on theContext
IMO we could also store the content on each
source_map
, since it will anyway be just a pointer to the data stored insources
(that's how the original code by @aexmachina worked). But it was also handy to have direct access to all options and status information. I passctx
tosource_map.generate_source_map
and it will use the index to access the information. I also made the status vectors private, so nobody beside the helper function can mess with it (therefore it should ensure that all of them have always the same size).I also store the initial include on to these vectors, as it may provide usefull information if needed, and one can simply skip the first entry if only the "real" includes are interesting.
This probably need some discussion, as it adds two new options:
The first option enables to inclusion of source contents inside the source map.
The second is used to embed the source map inside the sourceMappingUrl (via data-uri).
Maybe someone has a better idea how to name them. I've choosen
source_map_contents
because the sources will be added to a property namedsourcesContent
(wassource_map_sources
in org. PR).For
source_map_embed
I had to add a Base64 encoding library.@hcatlin: I couldn't find a good library with explicit MIT license, but IMO it should be ok to use:
// CC @xzyfer, @am11: do you think this is already good to go?