Skip to content

Commit

Permalink
Deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
saper committed Mar 17, 2018
2 parents 1f55131 + b2df434 commit 4b38acd
Show file tree
Hide file tree
Showing 42 changed files with 1,029 additions and 894 deletions.
6 changes: 3 additions & 3 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "node-sass",
"version": "4.8.2",
"libsass": "3.5.1",
"version": "4.8.3",
"libsass": "3.5.2",
"description": "Wrapper around libsass",
"license": "MIT",
"bugs": "https://github.com/sass/node-sass/issues",
Expand Down Expand Up @@ -65,7 +65,7 @@
"lodash.mergewith": "^4.6.0",
"meow": "^3.7.0",
"mkdirp": "^0.5.1",
"nan": "^2.9.2",
"nan": "^2.10.0",
"node-gyp": "^3.3.1",
"npmlog": "^4.0.0",
"request": "~2.79.0",
Expand Down
5 changes: 3 additions & 2 deletions src/binding.cpp
Expand Up @@ -229,6 +229,7 @@ int GetResult(sass_context_wrapper* ctx_w, Sass_Context* ctx, bool is_sync = fal

void MakeCallback(uv_work_t* req) {
Nan::HandleScope scope;
Nan::AsyncResource async("sass:MakeCallback");

Nan::TryCatch try_catch;
sass_context_wrapper* ctx_w = static_cast<sass_context_wrapper*>(req->data);
Expand All @@ -245,15 +246,15 @@ void MakeCallback(uv_work_t* req) {

if (status == 0 && ctx_w->success_callback) {
// if no error, do callback(null, result)
ctx_w->success_callback->Call(0, 0);
ctx_w->success_callback->Call(0, 0, &async);
}
else if (ctx_w->error_callback) {
// if error, do callback(error)
const char* err = sass_context_get_error_json(ctx);
v8::Local<v8::Value> argv[] = {
Nan::New<v8::String>(err).ToLocalChecked()
};
ctx_w->error_callback->Call(1, argv);
ctx_w->error_callback->Call(1, argv, &async);
}
if (try_catch.HasCaught()) {
Nan::FatalException(try_catch);
Expand Down
5 changes: 3 additions & 2 deletions src/callback_bridge.h
Expand Up @@ -107,7 +107,7 @@ T CallbackBridge<T, L>::operator()(std::vector<void*> argv) {
argv_v8.push_back(Nan::New(wrapper));

return this->post_process_return_value(
this->callback->Call(argv_v8.size(), &argv_v8[0])
Nan::Call(*callback, argv_v8.size(), &argv_v8[0]).ToLocalChecked()
);
} else {
/*
Expand Down Expand Up @@ -151,6 +151,7 @@ void CallbackBridge<T, L>::dispatched_async_uv_callback(uv_async_t *req) {
* post_process_args().
*/
Nan::HandleScope scope;
Nan::AsyncResource async("sass:CallbackBridge");
Nan::TryCatch try_catch;

std::vector<v8::Local<v8::Value>> argv_v8 = bridge->pre_process_args(bridge->argv);
Expand All @@ -159,7 +160,7 @@ void CallbackBridge<T, L>::dispatched_async_uv_callback(uv_async_t *req) {
}
argv_v8.push_back(Nan::New(bridge->wrapper));

bridge->callback->Call(argv_v8.size(), &argv_v8[0]);
bridge->callback->Call(argv_v8.size(), &argv_v8[0], &async);

if (try_catch.HasCaught()) {
Nan::FatalException(try_catch);
Expand Down
3 changes: 3 additions & 0 deletions src/libsass.gyp
Expand Up @@ -13,6 +13,7 @@
'sources': [
'libsass/src/ast.cpp',
'libsass/src/ast_fwd_decl.cpp',
'libsass/src/backtrace.cpp',
'libsass/src/base64vlq.cpp',
'libsass/src/bind.cpp',
'libsass/src/cencode.c',
Expand All @@ -35,6 +36,8 @@
'libsass/src/listize.cpp',
'libsass/src/memory/SharedPtr.cpp',
'libsass/src/node.cpp',
'libsass/src/operators.cpp',
'libsass/src/operators.hpp',
'libsass/src/output.cpp',
'libsass/src/parser.cpp',
'libsass/src/plugins.cpp',
Expand Down
2 changes: 2 additions & 0 deletions src/libsass/Makefile.conf
Expand Up @@ -41,6 +41,8 @@ SOURCES = \
sass_context.cpp \
sass_functions.cpp \
sass2scss.cpp \
backtrace.cpp \
operators.cpp \
to_c.cpp \
to_value.cpp \
source_map.cpp \
Expand Down
39 changes: 21 additions & 18 deletions src/libsass/src/ast.cpp
Expand Up @@ -837,7 +837,7 @@ namespace Sass {
return lhs_list->is_superselector_of(rhs_list);
}
}
error("is_superselector expected a Selector_List", sub->pstate());
coreError("is_superselector expected a Selector_List", sub->pstate());
return false;
}

Expand Down Expand Up @@ -1171,7 +1171,7 @@ namespace Sass {
// check if we need to append some headers
// then we need to check for the combinator
// only then we can safely set the new tail
void Complex_Selector::append(Complex_Selector_Obj ss)
void Complex_Selector::append(Complex_Selector_Obj ss, Backtraces& traces)
{

Complex_Selector_Obj t = ss->tail();
Expand All @@ -1185,7 +1185,8 @@ namespace Sass {
// append old headers
if (h && h->length()) {
if (last()->combinator() != ANCESTOR_OF && c != ANCESTOR_OF) {
error("Invalid parent selector", pstate_);
traces.push_back(Backtrace(pstate()));
throw Exception::InvalidParent(this, traces, ss);
} else if (last()->head_ && last()->head_->length()) {
Compound_Selector_Obj rh = last()->head();
size_t i;
Expand Down Expand Up @@ -1258,21 +1259,21 @@ namespace Sass {
return list;
}

Selector_List_Ptr Selector_List::resolve_parent_refs(std::vector<Selector_List_Obj>& pstack, bool implicit_parent)
Selector_List_Ptr Selector_List::resolve_parent_refs(std::vector<Selector_List_Obj>& pstack, Backtraces& traces, bool implicit_parent)
{
if (!this->has_parent_ref()) return this;
Selector_List_Ptr ss = SASS_MEMORY_NEW(Selector_List, pstate());
Selector_List_Ptr ps = pstack.back();
for (size_t pi = 0, pL = ps->length(); pi < pL; ++pi) {
for (size_t si = 0, sL = this->length(); si < sL; ++si) {
Selector_List_Obj rv = at(si)->resolve_parent_refs(pstack, implicit_parent);
Selector_List_Obj rv = at(si)->resolve_parent_refs(pstack, traces, implicit_parent);
ss->concat(rv);
}
}
return ss;
}

Selector_List_Ptr Complex_Selector::resolve_parent_refs(std::vector<Selector_List_Obj>& pstack, bool implicit_parent)
Selector_List_Ptr Complex_Selector::resolve_parent_refs(std::vector<Selector_List_Obj>& pstack, Backtraces& traces, bool implicit_parent)
{
Complex_Selector_Obj tail = this->tail();
Compound_Selector_Obj head = this->head();
Expand All @@ -1285,7 +1286,7 @@ namespace Sass {
}

// first resolve_parent_refs the tail (which may return an expanded list)
Selector_List_Obj tails = tail ? tail->resolve_parent_refs(pstack, implicit_parent) : 0;
Selector_List_Obj tails = tail ? tail->resolve_parent_refs(pstack, traces, implicit_parent) : 0;

if (head && head->length() > 0) {

Expand Down Expand Up @@ -1331,7 +1332,7 @@ namespace Sass {
// keep old parser state
s->pstate(pstate());
// append new tail
s->append(ss);
s->append(ss, traces);
retval->append(s);
}
}
Expand All @@ -1346,7 +1347,8 @@ namespace Sass {
// this is only if valid if the parent has no trailing op
// otherwise we cannot append more simple selectors to head
if (parent->last()->combinator() != ANCESTOR_OF) {
throw Exception::InvalidParent(parent, ss);
traces.push_back(Backtrace(pstate()));
throw Exception::InvalidParent(parent, traces, ss);
}
ss->tail(tail ? SASS_MEMORY_CLONE(tail) : NULL);
Compound_Selector_Obj h = SASS_MEMORY_COPY(head_);
Expand All @@ -1369,7 +1371,7 @@ namespace Sass {
// keep old parser state
s->pstate(pstate());
// append new tail
s->append(ss);
s->append(ss, traces);
retval->append(s);
}
}
Expand Down Expand Up @@ -1406,7 +1408,7 @@ namespace Sass {
for (Simple_Selector_Obj ss : head->elements()) {
if (Wrapped_Selector_Ptr ws = Cast<Wrapped_Selector>(ss)) {
if (Selector_List_Ptr sl = Cast<Selector_List>(ws->selector())) {
if (parents) ws->selector(sl->resolve_parent_refs(pstack, implicit_parent));
if (parents) ws->selector(sl->resolve_parent_refs(pstack, traces, implicit_parent));
}
}
}
Expand Down Expand Up @@ -1690,7 +1692,7 @@ namespace Sass {
}

if (!pIter->head() || pIter->tail()) {
error("nested selectors may not be extended", c->pstate());
coreError("nested selectors may not be extended", c->pstate());
}

compound_sel->is_optional(extendee->is_optional());
Expand Down Expand Up @@ -1766,31 +1768,31 @@ namespace Sass {
{
if (!a->name().empty()) {
if (has_keyword_argument()) {
error("named arguments must precede variable-length argument", a->pstate());
coreError("named arguments must precede variable-length argument", a->pstate());
}
has_named_arguments(true);
}
else if (a->is_rest_argument()) {
if (has_rest_argument()) {
error("functions and mixins may only be called with one variable-length argument", a->pstate());
coreError("functions and mixins may only be called with one variable-length argument", a->pstate());
}
if (has_keyword_argument_) {
error("only keyword arguments may follow variable arguments", a->pstate());
coreError("only keyword arguments may follow variable arguments", a->pstate());
}
has_rest_argument(true);
}
else if (a->is_keyword_argument()) {
if (has_keyword_argument()) {
error("functions and mixins may only be called with one keyword argument", a->pstate());
coreError("functions and mixins may only be called with one keyword argument", a->pstate());
}
has_keyword_argument(true);
}
else {
if (has_rest_argument()) {
error("ordinal arguments must precede variable-length arguments", a->pstate());
coreError("ordinal arguments must precede variable-length arguments", a->pstate());
}
if (has_named_arguments()) {
error("ordinal arguments must precede named arguments", a->pstate());
coreError("ordinal arguments must precede named arguments", a->pstate());
}
}
}
Expand Down Expand Up @@ -1907,6 +1909,7 @@ namespace Sass {
l.normalize(); r.normalize();
Units &lhs_unit = l, &rhs_unit = r;
if (!(lhs_unit == rhs_unit)) {
/* ToDo: do we always get usefull backtraces? */
throw Exception::IncompatibleUnits(rhs, *this);
}
return lhs_unit < rhs_unit ||
Expand Down

0 comments on commit 4b38acd

Please sign in to comment.