-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Binding: Refurbishes binding to use new API #543
Conversation
@mgreter, can you please review the code and let me know if you find memory leaks or any other issue which needs to be addressed? Out of 622, 619 tests are passing and the following three are failing:
Please let me know if there is something we need to update in order to pass those tests. I couldn't find a pattern. There are other passing tests with similar configuration. My first hunch was that they are failing due to the reason |
void free_file_context(struct Sass_File_Context* fctx) { | ||
// delete[] fctx->input_path; | ||
// delete[] fctx->options.include_paths; | ||
// delete[] fctx->options.image_path; |
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.
@mgreter, should we remove these?
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.
They should be safe to remove, since sass_free_xxx_context should take care of that!
@@ -51,56 +32,63 @@ void ExtractOptions(Local<Value> optionsValue, void* cptr, sass_context_wrapper* | |||
} | |||
|
|||
if (isFile) { |
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.
You can probably merge most or all of the following statements, as they now share a common struct (Sass_Options
) to setup the options (before you had to split it up, since the options were living on two totally unrelated structs).
Please see commit mgreter@f375c37 for a fix for the failing unit test. |
Great! I will try it now. For running tests, you can use I follow this sequence: # (1)
cd into/node-sass/dir
# (2) first get latest libsass
cd src/libsass
git pull --rebase mgreter-libsass api/c-interface
cd ../..
# (3) now install npm, only if you haven't already
# just once (a while; in case we modify dependencies or newer version of dependencies
# have arrived)
npm install # optionally you can delete npm_modules before running this command,
# so you don't have unused / outdated dependencies laying around
# (4) now rebuild so it doesn't use the old binaries
node scripts/build -f
# (5) finally run the test
npm test
node scripts/build -f Repeat (4) and (5) if you are making changes in cpp code. :) |
This code is ported from @mgreter's fork.
Now all tests are passing. 😄 Thanks again @mgreter. 👍 |
OK, glanced over the code and refactored some bits and removed some obsolete parts. Test still pass, but I would strongly recommend to do at least some basic memory leak testing. In |
Thanks can you please rebase your branch so I can pull your changes. Also, for memory leaks, wouldn't it make sense to use preexisting tools like http://valgrind.org/downloads/current.html#current to detect the memory leaks? I haven't tried it yet. :) |
Sure, Valgrind would be much better if you know how to use them properly with node.js ;) |
LOL, first I would have to compile it on Windows, and if that works then there is a learning curve for its usage. :) |
Sorry, rebase has to many conflicts. Maybe you can scavenge some bits from the diffs in my branch. |
Yup I will give it a try now. BTW, with latest sass-spec master, we are passing all 626 tests with your |
Credit goes to @mgreter.
@andrew, with this API, we can get error messages in both formats; JSON and (the old) plain text. I changed it to get JSON. Do we need to make it optional as well? I don't think with code usage anyone would not prefer JS-object. TBH, on CLI it also looks nicer. For instance, in CLI: C:\users\Adeel\Source\Repos\node-sass [master]> node bin/node-sass --stdout c:/temp/foo3.scss
{
"status": 1,
"file": "c:/temp/foo3.scss",
"line": 3,
"column": 9,
"message": "invalid syntax"
} Secondly; do we need to parse the errors as object? So in Thoughts? |
I don't see why not, when we release this I expect we'll bump it to 2.0.0 so breaking changes are to be expected. |
Awesome! 👍 |
For CLI format as JSON with indent = 2.
Also fixes the issue with destination path being resolved w.r.t input, without accounting for it being already absolute.
latest libsass, fixing x64 problem
When will this PR be integrated? Any though? |
Will it depends on libsass' next tagged release. This is related: sass/libsass#697. |
Binding: Refurbishes binding to use new API
Yay! 🎉 |
👍 |
Forgive me posting here not being a Node.js'er, but looks like this didn't make it into the real release yet? I noticed that node-sass doesn't make use of milestones (neither do I), and that the last release was about ~2.5 months ago, can we rely on a note here when the new version including the commit goes live? I can barely wait to abandon Ruby sass for my front end build! |
Exports quote and unquote functions for C bindings
(Responding to: sass/libsass#635)
Libsass is getting a new API. It doesn't replaces the current one, but renders it somewhat obsolete.
Thanks to @mgreter; the new API is beauty! 👍
I have managed to implement it as drop-in replacement to the existing one, by revamping the bindings and context-wrapper.
Status:
The new API also fixed: sass/libsass#634 and the corresponding node-sass test is updated and is passing.