Commit 14a8ba15 by Andrew Nesbitt

Updated to NAN 1.2.0 and switched NanSymbol to NanNew

parent af304d20
......@@ -29,11 +29,11 @@ void ExtractOptions(Local<Value> optionsValue, void* cptr, sass_context_wrapper*
Local<Object> options = optionsValue->ToObject();
if (ctx_w) {
NanAssignPersistent(ctx_w->stats, options->Get(NanSymbol("stats"))->ToObject());
NanAssignPersistent(ctx_w->stats, options->Get(NanNew("stats"))->ToObject());
// async (callback) style
Local<Function> callback = Local<Function>::Cast(options->Get(NanSymbol("success")));
Local<Function> errorCallback = Local<Function>::Cast(options->Get(NanSymbol("error")));
Local<Function> callback = Local<Function>::Cast(options->Get(NanNew("success")));
Local<Function> errorCallback = Local<Function>::Cast(options->Get(NanNew("error")));
if (isFile) {
ctx_w->fctx = (sass_file_context*) cptr;
} else {
......@@ -46,23 +46,23 @@ void ExtractOptions(Local<Value> optionsValue, void* cptr, sass_context_wrapper*
if (isFile) {
sass_file_context* ctx = (sass_file_context*) cptr;
ctx->input_path = CreateString(options->Get(NanSymbol("file")));
ctx->options.image_path = CreateString(options->Get(NanSymbol("imagePath")));
ctx->options.output_style = options->Get(NanSymbol("style"))->Int32Value();
ctx->options.source_comments = source_comments = options->Get(NanSymbol("comments"))->Int32Value();
ctx->options.include_paths = CreateString(options->Get(NanSymbol("paths")));
ctx->input_path = CreateString(options->Get(NanNew("file")));
ctx->options.image_path = CreateString(options->Get(NanNew("imagePath")));
ctx->options.output_style = options->Get(NanNew("style"))->Int32Value();
ctx->options.source_comments = source_comments = options->Get(NanNew("comments"))->Int32Value();
ctx->options.include_paths = CreateString(options->Get(NanNew("paths")));
if (source_comments == SASS_SOURCE_COMMENTS_MAP) {
ctx->source_map_file = CreateString(options->Get(NanSymbol("sourceMap")));
ctx->source_map_file = CreateString(options->Get(NanNew("sourceMap")));
}
ctx->options.precision = options->Get(NanSymbol("precision"))->Int32Value();
ctx->options.precision = options->Get(NanNew("precision"))->Int32Value();
} else {
sass_context* ctx = (sass_context*) cptr;
ctx->source_string = CreateString(options->Get(NanSymbol("data")));
ctx->options.image_path = CreateString(options->Get(NanSymbol("imagePath")));
ctx->options.output_style = options->Get(NanSymbol("style"))->Int32Value();
ctx->options.source_comments = source_comments = options->Get(NanSymbol("comments"))->Int32Value();
ctx->options.include_paths = CreateString(options->Get(NanSymbol("paths")));
ctx->options.precision = options->Get(NanSymbol("precision"))->Int32Value();
ctx->source_string = CreateString(options->Get(NanNew("data")));
ctx->options.image_path = CreateString(options->Get(NanNew("imagePath")));
ctx->options.output_style = options->Get(NanNew("style"))->Int32Value();
ctx->options.source_comments = source_comments = options->Get(NanNew("comments"))->Int32Value();
ctx->options.include_paths = CreateString(options->Get(NanNew("paths")));
ctx->options.precision = options->Get(NanNew("precision"))->Int32Value();
}
}
......@@ -75,7 +75,7 @@ void FillStatsObj(Handle<Object> stats, Ctx ctx) {
for (i = 0; i < ctx->num_included_files; i++) {
arr->Set(i, NanNew<String>(ctx->included_files[i]));
}
(*stats)->Set(NanSymbol("includedFiles"), arr);
(*stats)->Set(NanNew("includedFiles"), arr);
}
void FillStatsObj(Handle<Object> stats, sass_file_context* ctx) {
......@@ -87,7 +87,7 @@ void FillStatsObj(Handle<Object> stats, sass_file_context* ctx) {
} else {
source_map = NanNull();
}
(*stats)->Set(NanSymbol("sourceMap"), source_map);
(*stats)->Set(NanNew("sourceMap"), source_map);
}
void MakeCallback(uv_work_t* req) {
......@@ -108,7 +108,7 @@ void MakeCallback(uv_work_t* req) {
char* val = ctx_w->ctx ? ctx_w->ctx->output_string : ctx_w->fctx->output_string;
Local<Value> argv[] = {
NanNew<String>(val),
NanNew(ctx_w->stats)->Get(NanSymbol("sourceMap"))
NanNew(ctx_w->stats)->Get(NanNew("sourceMap"))
};
ctx_w->callback->Call(2, argv);
} else {
......@@ -148,7 +148,7 @@ NAN_METHOD(RenderSync) {
sass_compile(ctx);
FillStatsObj(options->Get(NanSymbol("stats"))->ToObject(), ctx);
FillStatsObj(options->Get(NanNew("stats"))->ToObject(), ctx);
if (ctx->error_status == 0) {
Local<String> output = NanNew<String>(ctx->output_string);
......@@ -183,7 +183,7 @@ NAN_METHOD(RenderFileSync) {
sass_compile_file(ctx);
FillStatsObj(options->Get(NanSymbol("stats"))->ToObject(), ctx);
FillStatsObj(options->Get(NanNew("stats"))->ToObject(), ctx);
if (ctx->error_status == 0) {
Local<String> output = NanNew<String>(ctx->output_string);
......
......@@ -41,7 +41,7 @@
"chalk": "~0.4.0",
"mkdirp": "~0.3.5",
"mocha": "~1.18.2",
"nan": "~1.0.0",
"nan": "~1.2.0",
"node-watch": "~0.3.4",
"object-assign": "^0.3.1",
"optimist": "~0.6.1",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment