This commit is contained in:
lalBi94
2023-03-05 13:23:23 +01:00
commit 7bc56c09b5
14034 changed files with 1834369 additions and 0 deletions

358
node_modules/node-sass/src/binding.cpp generated vendored Normal file
View File

@@ -0,0 +1,358 @@
#include <nan.h>
#include <vector>
#include "sass_context_wrapper.h"
#include "custom_function_bridge.h"
#include "create_string.h"
#include "sass_types/factory.h"
Sass_Import_List sass_importer(const char* cur_path, Sass_Importer_Entry cb, struct Sass_Compiler* comp)
{
void* cookie = sass_importer_get_cookie(cb);
struct Sass_Import* previous = sass_compiler_get_last_import(comp);
const char* prev_path = sass_import_get_abs_path(previous);
CustomImporterBridge& bridge = *(static_cast<CustomImporterBridge*>(cookie));
std::vector<void*> argv;
argv.push_back((void*)cur_path);
argv.push_back((void*)prev_path);
return bridge(argv);
}
union Sass_Value* sass_custom_function(const union Sass_Value* s_args, Sass_Function_Entry cb, struct Sass_Compiler* comp)
{
void* cookie = sass_function_get_cookie(cb);
CustomFunctionBridge& bridge = *(static_cast<CustomFunctionBridge*>(cookie));
std::vector<void*> argv;
for (unsigned l = sass_list_get_length(s_args), i = 0; i < l; i++) {
argv.push_back((void*)sass_list_get_value(s_args, i));
}
return bridge(argv);
}
int ExtractOptions(v8::Local<v8::Object> options, void* cptr, sass_context_wrapper* ctx_w, bool is_file, bool is_sync) {
Nan::HandleScope scope;
struct Sass_Context* ctx;
v8::Local<v8::Value> result_ = Nan::Get(
options,
Nan::New("result").ToLocalChecked()
).ToLocalChecked();
if (!result_->IsObject()) {
Nan::ThrowTypeError("\"result\" element is not an object");
return -1;
}
ctx_w->result.Reset(result_.As<v8::Object>());
if (is_file) {
ctx_w->fctx = (struct Sass_File_Context*) cptr;
ctx = sass_file_context_get_context(ctx_w->fctx);
}
else {
ctx_w->dctx = (struct Sass_Data_Context*) cptr;
ctx = sass_data_context_get_context(ctx_w->dctx);
}
struct Sass_Options* sass_options = sass_context_get_options(ctx);
ctx_w->is_sync = is_sync;
if (!is_sync) {
ctx_w->request.data = ctx_w;
// async (callback) style
v8::Local<v8::Function> success_callback = v8::Local<v8::Function>::Cast(Nan::Get(options, Nan::New("success").ToLocalChecked()).ToLocalChecked());
v8::Local<v8::Function> error_callback = v8::Local<v8::Function>::Cast(Nan::Get(options, Nan::New("error").ToLocalChecked()).ToLocalChecked());
ctx_w->success_callback = new Nan::Callback(success_callback);
ctx_w->error_callback = new Nan::Callback(error_callback);
}
if (!is_file) {
ctx_w->file = create_string(Nan::Get(options, Nan::New("file").ToLocalChecked()));
sass_option_set_input_path(sass_options, ctx_w->file);
}
int indent_len = Nan::To<int32_t>(
Nan::Get(
options,
Nan::New("indentWidth").ToLocalChecked()
).ToLocalChecked()).FromJust();
ctx_w->indent = (char*)malloc(indent_len + 1);
strcpy(ctx_w->indent, std::string(
indent_len,
Nan::To<int32_t>(
Nan::Get(
options,
Nan::New("indentType").ToLocalChecked()
).ToLocalChecked()).FromJust() == 1 ? '\t' : ' '
).c_str());
ctx_w->linefeed = create_string(Nan::Get(options, Nan::New("linefeed").ToLocalChecked()));
ctx_w->include_path = create_string(Nan::Get(options, Nan::New("includePaths").ToLocalChecked()));
ctx_w->out_file = create_string(Nan::Get(options, Nan::New("outFile").ToLocalChecked()));
ctx_w->source_map = create_string(Nan::Get(options, Nan::New("sourceMap").ToLocalChecked()));
ctx_w->source_map_root = create_string(Nan::Get(options, Nan::New("sourceMapRoot").ToLocalChecked()));
sass_option_set_output_path(sass_options, ctx_w->out_file);
sass_option_set_output_style(sass_options, (Sass_Output_Style)Nan::To<int32_t>(Nan::Get(options, Nan::New("style").ToLocalChecked()).ToLocalChecked()).FromJust());
sass_option_set_is_indented_syntax_src(sass_options, Nan::To<bool>(Nan::Get(options, Nan::New("indentedSyntax").ToLocalChecked()).ToLocalChecked()).FromJust());
sass_option_set_source_comments(sass_options, Nan::To<bool>(Nan::Get(options, Nan::New("sourceComments").ToLocalChecked()).ToLocalChecked()).FromJust());
sass_option_set_omit_source_map_url(sass_options, Nan::To<bool>(Nan::Get(options, Nan::New("omitSourceMapUrl").ToLocalChecked()).ToLocalChecked()).FromJust());
sass_option_set_source_map_embed(sass_options, Nan::To<bool>(Nan::Get(options, Nan::New("sourceMapEmbed").ToLocalChecked()).ToLocalChecked()).FromJust());
sass_option_set_source_map_contents(sass_options, Nan::To<bool>(Nan::Get(options, Nan::New("sourceMapContents").ToLocalChecked()).ToLocalChecked()).FromJust());
sass_option_set_source_map_file(sass_options, ctx_w->source_map);
sass_option_set_source_map_root(sass_options, ctx_w->source_map_root);
sass_option_set_include_path(sass_options, ctx_w->include_path);
sass_option_set_precision(sass_options, Nan::To<int32_t>(Nan::Get(options, Nan::New("precision").ToLocalChecked()).ToLocalChecked()).FromJust());
sass_option_set_indent(sass_options, ctx_w->indent);
sass_option_set_linefeed(sass_options, ctx_w->linefeed);
v8::Local<v8::Value> importer_callback = Nan::Get(options, Nan::New("importer").ToLocalChecked()).ToLocalChecked();
if (importer_callback->IsFunction()) {
v8::Local<v8::Function> importer = importer_callback.As<v8::Function>();
CustomImporterBridge *bridge = new CustomImporterBridge(importer, ctx_w->is_sync);
ctx_w->importer_bridges.push_back(bridge);
Sass_Importer_List c_importers = sass_make_importer_list(1);
c_importers[0] = sass_make_importer(sass_importer, 0, bridge);
sass_option_set_c_importers(sass_options, c_importers);
}
else if (importer_callback->IsArray()) {
v8::Local<v8::Array> importers = importer_callback.As<v8::Array>();
Sass_Importer_List c_importers = sass_make_importer_list(importers->Length());
for (size_t i = 0; i < importers->Length(); ++i) {
v8::Local<v8::Function> callback = v8::Local<v8::Function>::Cast(Nan::Get(importers, static_cast<uint32_t>(i)).ToLocalChecked());
CustomImporterBridge *bridge = new CustomImporterBridge(callback, ctx_w->is_sync);
ctx_w->importer_bridges.push_back(bridge);
c_importers[i] = sass_make_importer(sass_importer, importers->Length() - i - 1, bridge);
}
sass_option_set_c_importers(sass_options, c_importers);
}
v8::Local<v8::Value> custom_functions = Nan::Get(options, Nan::New("functions").ToLocalChecked()).ToLocalChecked();
if (custom_functions->IsObject()) {
v8::Local<v8::Object> functions = custom_functions.As<v8::Object>();
v8::Local<v8::Array> signatures = Nan::GetOwnPropertyNames(functions).ToLocalChecked();
unsigned num_signatures = signatures->Length();
Sass_Function_List fn_list = sass_make_function_list(num_signatures);
for (unsigned i = 0; i < num_signatures; i++) {
v8::Local<v8::String> signature = v8::Local<v8::String>::Cast(Nan::Get(signatures, Nan::New(i)).ToLocalChecked());
v8::Local<v8::Function> callback = v8::Local<v8::Function>::Cast(Nan::Get(functions, signature).ToLocalChecked());
CustomFunctionBridge *bridge = new CustomFunctionBridge(callback, ctx_w->is_sync);
ctx_w->function_bridges.push_back(bridge);
char* sig = create_string(signature);
Sass_Function_Entry fn = sass_make_function(sig, sass_custom_function, bridge);
free(sig);
sass_function_set_list_entry(fn_list, i, fn);
}
sass_option_set_c_functions(sass_options, fn_list);
}
return 0;
}
void GetStats(sass_context_wrapper* ctx_w, Sass_Context* ctx) {
Nan::HandleScope scope;
char** included_files = sass_context_get_included_files(ctx);
v8::Local<v8::Array> arr = Nan::New<v8::Array>();
if (included_files) {
for (int i = 0; included_files[i] != nullptr; ++i) {
Nan::Set(arr, i, Nan::New<v8::String>(included_files[i]).ToLocalChecked());
}
}
v8::Local<v8::Object> result = Nan::New(ctx_w->result);
assert(result->IsObject());
v8::Local<v8::Value> stats = Nan::Get(
result,
Nan::New("stats").ToLocalChecked()
).ToLocalChecked();
if (stats->IsObject()) {
Nan::Set(
stats.As<v8::Object>(),
Nan::New("includedFiles").ToLocalChecked(),
arr
);
} else {
Nan::ThrowTypeError("\"result.stats\" element is not an object");
}
}
int GetResult(sass_context_wrapper* ctx_w, Sass_Context* ctx, bool is_sync = false) {
Nan::HandleScope scope;
v8::Local<v8::Object> result;
int status = sass_context_get_error_status(ctx);
result = Nan::New(ctx_w->result);
assert(result->IsObject());
if (status == 0) {
const char* css = sass_context_get_output_string(ctx);
const char* map = sass_context_get_source_map_string(ctx);
Nan::Set(result, Nan::New("css").ToLocalChecked(), Nan::CopyBuffer(css, static_cast<uint32_t>(strlen(css))).ToLocalChecked());
GetStats(ctx_w, ctx);
if (map) {
Nan::Set(result, Nan::New("map").ToLocalChecked(), Nan::CopyBuffer(map, static_cast<uint32_t>(strlen(map))).ToLocalChecked());
}
}
else if (is_sync) {
Nan::Set(result, Nan::New("error").ToLocalChecked(), Nan::New<v8::String>(sass_context_get_error_json(ctx)).ToLocalChecked());
}
return status;
}
void PerformCall(sass_context_wrapper* ctx_w, Nan::Callback* callback, int argc, v8::Local<v8::Value> argv[]) {
if (ctx_w->is_sync) {
Nan::Call(*callback, argc, argv);
} else {
callback->Call(argc, argv, ctx_w->async_resource);
}
}
void MakeCallback(uv_work_t* req) {
Nan::HandleScope scope;
Nan::TryCatch try_catch;
sass_context_wrapper* ctx_w = static_cast<sass_context_wrapper*>(req->data);
struct Sass_Context* ctx;
if (ctx_w->dctx) {
ctx = sass_data_context_get_context(ctx_w->dctx);
}
else {
ctx = sass_file_context_get_context(ctx_w->fctx);
}
int status = GetResult(ctx_w, ctx);
if (status == 0 && ctx_w->success_callback) {
// if no error, do callback(null, result)
PerformCall(ctx_w, ctx_w->success_callback, 0, 0);
}
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()
};
PerformCall(ctx_w, ctx_w->error_callback, 1, argv);
}
if (try_catch.HasCaught()) {
Nan::FatalException(try_catch);
}
sass_free_context_wrapper(ctx_w);
}
NAN_METHOD(render) {
v8::Local<v8::Object> options = Nan::To<v8::Object>(info[0]).ToLocalChecked();
char* source_string = create_string(Nan::Get(options, Nan::New("data").ToLocalChecked()));
struct Sass_Data_Context* dctx = sass_make_data_context(source_string);
sass_context_wrapper* ctx_w = sass_make_context_wrapper();
ctx_w->async_resource = new Nan::AsyncResource("node-sass:sass_context_wrapper:render");
if (ExtractOptions(options, dctx, ctx_w, false, false) >= 0) {
int status = uv_queue_work(uv_default_loop(), &ctx_w->request, compile_it, (uv_after_work_cb)MakeCallback);
assert(status == 0);
}
}
NAN_METHOD(render_sync) {
v8::Local<v8::Object> options = Nan::To<v8::Object>(info[0]).ToLocalChecked();
char* source_string = create_string(Nan::Get(options, Nan::New("data").ToLocalChecked()));
struct Sass_Data_Context* dctx = sass_make_data_context(source_string);
struct Sass_Context* ctx = sass_data_context_get_context(dctx);
sass_context_wrapper* ctx_w = sass_make_context_wrapper();
int result = -1;
if ((result = ExtractOptions(options, dctx, ctx_w, false, true)) >= 0) {
compile_data(dctx);
result = GetResult(ctx_w, ctx, true);
}
sass_free_context_wrapper(ctx_w);
info.GetReturnValue().Set(result == 0);
}
NAN_METHOD(render_file) {
v8::Local<v8::Object> options = Nan::To<v8::Object>(info[0]).ToLocalChecked();
char* input_path = create_string(Nan::Get(options, Nan::New("file").ToLocalChecked()));
struct Sass_File_Context* fctx = sass_make_file_context(input_path);
sass_context_wrapper* ctx_w = sass_make_context_wrapper();
ctx_w->async_resource = new Nan::AsyncResource("node-sass:sass_context_wrapper:render_file");
if (ExtractOptions(options, fctx, ctx_w, true, false) >= 0) {
int status = uv_queue_work(uv_default_loop(), &ctx_w->request, compile_it, (uv_after_work_cb)MakeCallback);
assert(status == 0);
}
}
NAN_METHOD(render_file_sync) {
v8::Local<v8::Object> options = Nan::To<v8::Object>(info[0]).ToLocalChecked();
char* input_path = create_string(Nan::Get(options, Nan::New("file").ToLocalChecked()));
struct Sass_File_Context* fctx = sass_make_file_context(input_path);
struct Sass_Context* ctx = sass_file_context_get_context(fctx);
sass_context_wrapper* ctx_w = sass_make_context_wrapper();
int result = -1;
if ((result = ExtractOptions(options, fctx, ctx_w, true, true)) >= 0) {
compile_file(fctx);
result = GetResult(ctx_w, ctx, true);
};
free(input_path);
sass_free_context_wrapper(ctx_w);
info.GetReturnValue().Set(result == 0);
}
NAN_METHOD(libsass_version) {
info.GetReturnValue().Set(Nan::New<v8::String>(libsass_version()).ToLocalChecked());
}
NAN_MODULE_INIT(RegisterModule) {
Nan::SetMethod(target, "render", render);
Nan::SetMethod(target, "renderSync", render_sync);
Nan::SetMethod(target, "renderFile", render_file);
Nan::SetMethod(target, "renderFileSync", render_file_sync);
Nan::SetMethod(target, "libsassVersion", libsass_version);
SassTypes::Factory::initExports(target);
}
NODE_MODULE(binding, RegisterModule);

228
node_modules/node-sass/src/callback_bridge.h generated vendored Normal file
View File

@@ -0,0 +1,228 @@
#ifndef CALLBACK_BRIDGE_H
#define CALLBACK_BRIDGE_H
#include <vector>
#include <nan.h>
#include <algorithm>
#include <uv.h>
#define COMMA ,
template <typename T, typename L = void*>
class CallbackBridge {
public:
CallbackBridge(v8::Local<v8::Function>, bool);
virtual ~CallbackBridge();
// Executes the callback
T operator()(std::vector<void*>);
protected:
// We will expose a bridge object to the JS callback that wraps this instance so we don't loose context.
// This is the V8 constructor for such objects.
static Nan::MaybeLocal<v8::Function> get_wrapper_constructor();
static void async_gone(uv_handle_t *handle);
static NAN_METHOD(New);
static NAN_METHOD(ReturnCallback);
static Nan::Persistent<v8::Function> wrapper_constructor;
Nan::Persistent<v8::Object> wrapper;
// The callback that will get called in the main thread after the worker thread used for the sass
// compilation step makes a call to uv_async_send()
static void dispatched_async_uv_callback(uv_async_t*);
// The V8 values sent to our ReturnCallback must be read on the main thread not the sass worker thread.
// This gives a chance to specialized subclasses to transform those values into whatever makes sense to
// sass before we resume the worker thread.
virtual T post_process_return_value(v8::Local<v8::Value>) const =0;
virtual std::vector<v8::Local<v8::Value>> pre_process_args(std::vector<L>) const =0;
Nan::Callback* callback;
Nan::AsyncResource* async_resource;
bool is_sync;
uv_mutex_t cv_mutex;
uv_cond_t condition_variable;
uv_async_t *async;
std::vector<L> argv;
bool has_returned;
T return_value;
};
template <typename T, typename L>
Nan::Persistent<v8::Function> CallbackBridge<T, L>::wrapper_constructor;
template <typename T, typename L>
CallbackBridge<T, L>::CallbackBridge(v8::Local<v8::Function> callback, bool is_sync) : callback(new Nan::Callback(callback)), is_sync(is_sync) {
/*
* This is invoked from the main JavaScript thread.
* V8 context is available.
*/
Nan::HandleScope scope;
uv_mutex_init(&this->cv_mutex);
uv_cond_init(&this->condition_variable);
if (!is_sync) {
this->async = new uv_async_t;
this->async->data = (void*) this;
uv_async_init(uv_default_loop(), this->async, (uv_async_cb) dispatched_async_uv_callback);
this->async_resource = new Nan::AsyncResource("node-sass:CallbackBridge");
}
v8::Local<v8::Function> func = CallbackBridge<T, L>::get_wrapper_constructor().ToLocalChecked();
wrapper.Reset(Nan::NewInstance(func).ToLocalChecked());
Nan::SetInternalFieldPointer(Nan::New(wrapper), 0, this);
}
template <typename T, typename L>
CallbackBridge<T, L>::~CallbackBridge() {
delete this->callback;
this->wrapper.Reset();
uv_cond_destroy(&this->condition_variable);
uv_mutex_destroy(&this->cv_mutex);
if (!is_sync) {
uv_close((uv_handle_t*)this->async, &async_gone);
delete this->async_resource;
}
}
template <typename T, typename L>
T CallbackBridge<T, L>::operator()(std::vector<void*> argv) {
// argv.push_back(wrapper);
if (this->is_sync) {
/*
* This is invoked from the main JavaScript thread.
* V8 context is available.
*
* Establish Local<> scope for all functions
* from types invoked by pre_process_args() and
* post_process_args().
*/
Nan::HandleScope scope;
Nan::TryCatch try_catch;
std::vector<v8::Local<v8::Value>> argv_v8 = pre_process_args(argv);
if (try_catch.HasCaught()) {
Nan::FatalException(try_catch);
}
argv_v8.push_back(Nan::New(wrapper));
return this->post_process_return_value(
Nan::Call(*this->callback, argv_v8.size(), &argv_v8[0]).ToLocalChecked()
);
} else {
/*
* This is invoked from the worker thread.
* No V8 context and functions available.
* Just wait for response from asynchronously
* scheduled JavaScript code
*
* XXX Issue #1048: We block here even if the
* event loop stops and the callback
* would never be executed.
* XXX Issue #857: By waiting here we occupy
* one of the threads taken from the
* uv threadpool. Might deadlock if
* async I/O executed from JavaScript callbacks.
*/
this->argv = argv;
uv_mutex_lock(&this->cv_mutex);
this->has_returned = false;
uv_async_send(this->async);
while (!this->has_returned) {
uv_cond_wait(&this->condition_variable, &this->cv_mutex);
}
uv_mutex_unlock(&this->cv_mutex);
return this->return_value;
}
}
template <typename T, typename L>
void CallbackBridge<T, L>::dispatched_async_uv_callback(uv_async_t *req) {
CallbackBridge* bridge = static_cast<CallbackBridge*>(req->data);
/*
* Function scheduled via uv_async mechanism, therefore
* it is invoked from the main JavaScript thread.
* V8 context is available.
*
* Establish Local<> scope for all functions
* from types invoked by pre_process_args() and
* post_process_args().
*/
Nan::HandleScope scope;
Nan::TryCatch try_catch;
std::vector<v8::Local<v8::Value>> argv_v8 = bridge->pre_process_args(bridge->argv);
if (try_catch.HasCaught()) {
Nan::FatalException(try_catch);
}
argv_v8.push_back(Nan::New(bridge->wrapper));
bridge->callback->Call(argv_v8.size(), &argv_v8[0], bridge->async_resource);
if (try_catch.HasCaught()) {
Nan::FatalException(try_catch);
}
}
template <typename T, typename L>
NAN_METHOD(CallbackBridge<T COMMA L>::ReturnCallback) {
/*
* Callback function invoked by the user code.
* It is invoked from the main JavaScript thread.
* V8 context is available.
*
* Implicit Local<> handle scope created by NAN_METHOD(.)
*/
CallbackBridge<T, L>* bridge = static_cast<CallbackBridge<T, L>*>(Nan::GetInternalFieldPointer(info.This(), 0));
Nan::TryCatch try_catch;
bridge->return_value = bridge->post_process_return_value(info[0]);
{
uv_mutex_lock(&bridge->cv_mutex);
bridge->has_returned = true;
uv_mutex_unlock(&bridge->cv_mutex);
}
uv_cond_broadcast(&bridge->condition_variable);
if (try_catch.HasCaught()) {
Nan::FatalException(try_catch);
}
}
template <typename T, typename L>
Nan::MaybeLocal<v8::Function> CallbackBridge<T, L>::get_wrapper_constructor() {
/* Uses handle scope created in the CallbackBridge<T, L> constructor */
if (wrapper_constructor.IsEmpty()) {
v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
tpl->SetClassName(Nan::New("CallbackBridge").ToLocalChecked());
tpl->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetPrototypeTemplate(tpl, "success",
Nan::New<v8::FunctionTemplate>(ReturnCallback)
);
wrapper_constructor.Reset(Nan::GetFunction(tpl).ToLocalChecked());
}
return Nan::New(wrapper_constructor);
}
template <typename T, typename L>
NAN_METHOD(CallbackBridge<T COMMA L>::New) {
info.GetReturnValue().Set(info.This());
}
template <typename T, typename L>
void CallbackBridge<T, L>::async_gone(uv_handle_t *handle) {
delete (uv_async_t *)handle;
}
#endif

21
node_modules/node-sass/src/create_string.cpp generated vendored Normal file
View File

@@ -0,0 +1,21 @@
#include <nan.h>
#include <stdlib.h>
#include <string.h>
#include "create_string.h"
char* create_string(Nan::MaybeLocal<v8::Value> maybevalue) {
v8::Local<v8::Value> value;
if (maybevalue.ToLocal(&value)) {
if (value->IsNull() || !value->IsString()) {
return 0;
}
} else {
return 0;
}
Nan::Utf8String string(value);
char *str = (char *)malloc(string.length() + 1);
strcpy(str, *string);
return str;
}

8
node_modules/node-sass/src/create_string.h generated vendored Normal file
View File

@@ -0,0 +1,8 @@
#ifndef CREATE_STRING_H
#define CREATE_STRING_H
#include <nan.h>
char* create_string(Nan::MaybeLocal<v8::Value>);
#endif

27
node_modules/node-sass/src/custom_function_bridge.cpp generated vendored Normal file
View File

@@ -0,0 +1,27 @@
#include <nan.h>
#include <stdexcept>
#include "custom_function_bridge.h"
#include "sass_types/factory.h"
#include "sass_types/value.h"
Sass_Value* CustomFunctionBridge::post_process_return_value(v8::Local<v8::Value> _val) const {
SassTypes::Value *value = SassTypes::Factory::unwrap(_val);
if (value) {
return value->get_sass_value();
} else {
return sass_make_error("A SassValue object was expected.");
}
}
std::vector<v8::Local<v8::Value>> CustomFunctionBridge::pre_process_args(std::vector<void*> in) const {
std::vector<v8::Local<v8::Value>> argv = std::vector<v8::Local<v8::Value>>();
for (void* value : in) {
Sass_Value* x = static_cast<Sass_Value*>(value);
SassTypes::Value* y = SassTypes::Factory::create(x);
argv.push_back(y->get_js_object());
}
return argv;
}

18
node_modules/node-sass/src/custom_function_bridge.h generated vendored Normal file
View File

@@ -0,0 +1,18 @@
#ifndef CUSTOM_FUNCTION_BRIDGE_H
#define CUSTOM_FUNCTION_BRIDGE_H
#include <nan.h>
#include <sass/values.h>
#include <sass/functions.h>
#include "callback_bridge.h"
class CustomFunctionBridge : public CallbackBridge<Sass_Value*> {
public:
CustomFunctionBridge(v8::Local<v8::Function> cb, bool is_sync) : CallbackBridge<Sass_Value*>(cb, is_sync) {}
private:
Sass_Value* post_process_return_value(v8::Local<v8::Value>) const;
std::vector<v8::Local<v8::Value>> pre_process_args(std::vector<void*>) const;
};
#endif

104
node_modules/node-sass/src/custom_importer_bridge.cpp generated vendored Normal file
View File

@@ -0,0 +1,104 @@
#include <nan.h>
#include <stdexcept>
#include "custom_importer_bridge.h"
#include "create_string.h"
SassImportList CustomImporterBridge::post_process_return_value(v8::Local<v8::Value> returned_value) const {
SassImportList imports = 0;
Nan::HandleScope scope;
if (returned_value->IsArray()) {
v8::Local<v8::Array> array = returned_value.As<v8::Array>();
imports = sass_make_import_list(array->Length());
for (size_t i = 0; i < array->Length(); ++i) {
v8::Local<v8::Value> value;
Nan::MaybeLocal<v8::Value> unchecked = Nan::Get(array, static_cast<uint32_t>(i));
if (!unchecked.ToLocal(&value) || !value->IsObject()) {
imports[i] = sass_make_import_entry(0, 0, 0);
sass_import_set_error(imports[i], "returned array must only contain object literals", -1, -1);
continue;
}
v8::Local<v8::Object> object = value.As<v8::Object>();
if (value->IsNativeError()) {
char* message = create_string(Nan::Get(object, Nan::New<v8::String>("message").ToLocalChecked()));
imports[i] = sass_make_import_entry(0, 0, 0);
sass_import_set_error(imports[i], message, -1, -1);
free(message);
}
else {
imports[i] = get_importer_entry(object);
}
}
}
else if (returned_value->IsNativeError()) {
imports = sass_make_import_list(1);
v8::Local<v8::Object> object = returned_value.As<v8::Object>();
char* message = create_string(Nan::Get(object, Nan::New<v8::String>("message").ToLocalChecked()));
imports[0] = sass_make_import_entry(0, 0, 0);
sass_import_set_error(imports[0], message, -1, -1);
free(message);
}
else if (returned_value->IsObject()) {
imports = sass_make_import_list(1);
imports[0] = get_importer_entry(returned_value.As<v8::Object>());
}
return imports;
}
Sass_Import* CustomImporterBridge::check_returned_string(Nan::MaybeLocal<v8::Value> value, const char *msg) const
{
v8::Local<v8::Value> checked;
if (value.ToLocal(&checked)) {
if (!checked->IsUndefined() && !checked->IsString()) {
goto err;
} else {
return nullptr;
}
}
err:
auto entry = sass_make_import_entry(0, 0, 0);
sass_import_set_error(entry, msg, -1, -1);
return entry;
}
Sass_Import* CustomImporterBridge::get_importer_entry(const v8::Local<v8::Object>& object) const {
Nan::MaybeLocal<v8::Value> returned_file = Nan::Get(object, Nan::New<v8::String>("file").ToLocalChecked());
Nan::MaybeLocal<v8::Value> returned_contents = Nan::Get(object, Nan::New<v8::String>("contents").ToLocalChecked());
Nan::MaybeLocal<v8::Value> returned_map = Nan::Get(object, Nan::New<v8::String>("map").ToLocalChecked());
Sass_Import *err;
if ((err = check_returned_string(returned_file, "returned value of `file` must be a string")))
return err;
if ((err = check_returned_string(returned_contents, "returned value of `contents` must be a string")))
return err;
if ((err = check_returned_string(returned_map, "returned value of `returned_map` must be a string")))
return err;
char* path = create_string(returned_file);
char* contents = create_string(returned_contents);
char* srcmap = create_string(returned_map);
return sass_make_import_entry(path, contents, srcmap);
}
std::vector<v8::Local<v8::Value>> CustomImporterBridge::pre_process_args(std::vector<void*> in) const {
std::vector<v8::Local<v8::Value>> out;
for (void* ptr : in) {
out.push_back(Nan::New<v8::String>((char const*)ptr).ToLocalChecked());
}
return out;
}

22
node_modules/node-sass/src/custom_importer_bridge.h generated vendored Normal file
View File

@@ -0,0 +1,22 @@
#ifndef CUSTOM_IMPORTER_BRIDGE_H
#define CUSTOM_IMPORTER_BRIDGE_H
#include <nan.h>
#include <sass/functions.h>
#include <sass/values.h>
#include "callback_bridge.h"
typedef Sass_Import_List SassImportList;
class CustomImporterBridge : public CallbackBridge<SassImportList> {
public:
CustomImporterBridge(v8::Local<v8::Function> cb, bool is_sync) : CallbackBridge<SassImportList>(cb, is_sync) {}
private:
SassImportList post_process_return_value(v8::Local<v8::Value>) const;
Sass_Import* check_returned_string(Nan::MaybeLocal<v8::Value> value, const char *msg) const;
Sass_Import* get_importer_entry(const v8::Local<v8::Object>&) const;
std::vector<v8::Local<v8::Value>> pre_process_args(std::vector<void*>) const;
};
#endif

114
node_modules/node-sass/src/libsass.gyp generated vendored Normal file
View File

@@ -0,0 +1,114 @@
{
'targets': [
{
'target_name': 'libsass',
'win_delay_load_hook': 'false',
'type': 'static_library',
'defines': [
'LIBSASS_VERSION="<!(node -e "process.stdout.write(require(\'../package.json\').libsass)")"'
],
'defines!': [
'DEBUG'
],
'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',
'libsass/src/check_nesting.cpp',
'libsass/src/color_maps.cpp',
'libsass/src/constants.cpp',
'libsass/src/context.cpp',
'libsass/src/cssize.cpp',
'libsass/src/emitter.cpp',
'libsass/src/environment.cpp',
'libsass/src/error_handling.cpp',
'libsass/src/eval.cpp',
'libsass/src/expand.cpp',
'libsass/src/extend.cpp',
'libsass/src/file.cpp',
'libsass/src/functions.cpp',
'libsass/src/inspect.cpp',
'libsass/src/json.cpp',
'libsass/src/lexer.cpp',
'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',
'libsass/src/position.cpp',
'libsass/src/prelexer.cpp',
'libsass/src/remove_placeholders.cpp',
'libsass/src/sass.cpp',
'libsass/src/sass2scss.cpp',
'libsass/src/sass_context.cpp',
'libsass/src/sass_functions.cpp',
'libsass/src/sass_util.cpp',
'libsass/src/sass_values.cpp',
'libsass/src/source_map.cpp',
'libsass/src/subset_map.cpp',
'libsass/src/to_c.cpp',
'libsass/src/to_value.cpp',
'libsass/src/units.cpp',
'libsass/src/utf8_string.cpp',
'libsass/src/util.cpp',
'libsass/src/values.cpp'
],
'cflags!': [
'-fno-rtti',
'-fno-exceptions'
],
'cflags_cc!': [
'-fno-rtti',
'-fno-exceptions'
],
'cflags_cc': [
'-fexceptions',
'-frtti',
],
'include_dirs': [ 'libsass/include' ],
'direct_dependent_settings': {
'include_dirs': [ 'libsass/include' ],
},
'conditions': [
['OS=="mac"', {
'xcode_settings': {
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
'CLANG_CXX_LIBRARY': 'libc++',
'OTHER_LDFLAGS': [],
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'GCC_ENABLE_CPP_RTTI': 'YES',
'MACOSX_DEPLOYMENT_TARGET': '10.7'
}
}],
['OS=="win"', {
'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': [
'/GR',
'/EHsc'
]
}
},
'conditions': [
['MSVS_VERSION < "2015"', {
'sources': [
'libsass/src/c99func.c'
]
}]
]
}],
['OS!="win"', {
'cflags_cc+': [
'-std=c++0x'
]
}]
]
}
]
}

15
node_modules/node-sass/src/libsass/.editorconfig generated vendored Normal file
View File

@@ -0,0 +1,15 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
root = true
[*]
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
[{Makefile, GNUmakefile.am}]
indent_style = tab
indent_size = 4

2
node_modules/node-sass/src/libsass/.gitattributes generated vendored Normal file
View File

@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

View File

@@ -0,0 +1,65 @@
# Contributing to LibSass
:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:
The following is a set of guidelines for contributing to LibSass, which is hosted in the [Sass Organization](https://github.com/sass) on GitHub.
These are just guidelines, not rules, use your best judgment and feel free to propose changes to this document in a pull request.
LibSass is a library that implements a [sass language][8] compiler. As such it does not directly interface with end users (frontend developers).
For direct contributions to the LibSass code base you will need to have at least a rough idea of C++, we will not lie about that.
But there are other ways to contribute to the progress of LibSass. All contributions are done via github pull requests.
You can also contribute to the LibSass [documentation][9] or provide additional [spec tests][10] (and we will gladly point you in the
direction for corners that lack test coverage). Foremost we rely on good and concise bug reports for issues the spec tests do not yet catch.
## Precheck: My Sass isn't compiling
- [ ] Check if you can reproduce the issue via [SourceMap Inspector][5] (updated regularly).
- [ ] Validate official ruby sass compiler via [SassMeister][6] produces your expected result.
- [ ] Search for similar issue in [LibSass][1] and [node-sass][2] (include closed tickets)
- [ ] Optionally test your code directly with [sass][7] or [sassc][3] ([installer][4])
## Precheck: My build/install fails
- [ ] Problems with building or installing libsass should be directed to implementors first!
- [ ] Except for issues directly verified via sassc or LibSass own build (make/autotools9
## Craft a meaningfull error report
- [ ] Include the version of libsass and the implementor (i.e. node-sass or sassc)
- [ ] Include information about your operating system and environment (i.e. io.js)
- [ ] Either create a self contained sample that shows your issue ...
- [ ] ... or provide it as a fetchable (github preferred) archive/repo
- [ ] ... and include a step by step list of command to get all dependencies
- [ ] Make it clear if you use indented or/and scss syntax
## My error is hiding in a big code base
1. we do not have time to support your code base!
2. to fix occuring issues we need precise bug reports
3. the more precise you are, the faster we can help you
4. lazy reports get overlooked even when exposing serious bugs
5. it's not hard to do, it only takes time
- [ ] Make sure you saved the current state (i.e. commit to git)
- [ ] Start by uncommenting blocks in the initial source file
- [ ] Check if the problem is still there after each edit
- [ ] Repeat until the problem goes away
- [ ] Inline imported files as you go along
- [ ] Finished once you cannot remove more
- [ ] The emphasis is on the word "repeat" ...
## What makes a code test case
Important is that someone else can get the test case up and running to reproduce it locally. For this
we urge you to verify that your sample yields the expected result by testing it via [SassMeister][6]
or directly via ruby sass or node-sass (or any other libsass implementor) before submitting your bug
report. Once you verified all of the above, you may use the template below to file your bug report.
[1]: https://github.com/sass/libsass/issues?utf8=%E2%9C%93&q=is%3Aissue
[2]: https://github.com/sass/node-sass/issues?utf8=%E2%9C%93&q=is%3Aissue
[3]: https://github.com/sass/sassc
[4]: http://libsass.ocbnet.ch/installer/
[5]: http://libsass.ocbnet.ch/srcmap/
[6]: http://www.sassmeister.com/
[7]: https://rubygems.org/gems/sass
[8]: http://sass-lang.com/
[9]: https://github.com/sass/libsass/tree/master/docs
[10]: https://github.com/sass/sass-spec

View File

@@ -0,0 +1,54 @@
[todo]: # (Title: Be as meaningful as possible)
[todo]: # (Title: Try to use 60 or less chars)
[todo]: # (This is only a template!)
[todo]: # (remove unneeded bits)
[todo]: # (use github preview!)
## input.scss
[todo]: # (always test and report with scss syntax)
[todo]: # (use sass only when results differ from scss)
```scss
test {
content: bar
}
```
## Actual results
[todo]: # (update version info!)
[libsass 3.X.y][1]
```css
test {
content: bar; }
```
## Expected result
[todo]: # (update version info!)
ruby sass 3.X.y
```css
test {
content: bar; }
```
[todo]: # (update version info!)
[todo]: # (example for node-sass!)
version info:
```cmd
$ node-sass --version
node-sass 3.X.y (Wrapper) [JavaScript]
libsass 3.X.y (Sass Compiler) [C/C++]
```
[todo]: # (Go to http://libsass.ocbnet.ch/srcmap)
[todo]: # (Enter your SCSS code and hit compile)
[todo]: # (Click `bookmark` and replace the url)
[todo]: # (link is used in actual results above)
[1]: http://libsass.ocbnet.ch/srcmap/#dGVzdCB7CiAgY29udGVudDogYmFyOyB9Cg==

64
node_modules/node-sass/src/libsass/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,64 @@
language: cpp
sudo: false
# don't create redundant code coverage reports
# - AUTOTOOLS=yes COVERAGE=yes BUILD=static
# - AUTOTOOLS=no COVERAGE=yes BUILD=shared
# - AUTOTOOLS=no COVERAGE=no BUILD=static
# further speed up day by day travis-ci builds
# re-enable this if you change the makefiles
# this will still catch all coding errors!
# - AUTOTOOLS=yes COVERAGE=no BUILD=static
# currenty there are various issues when
# built with coverage, clang and autotools
# - AUTOTOOLS=yes COVERAGE=yes BUILD=shared
matrix:
include :
- os: linux
compiler: gcc
env: AUTOTOOLS=no COVERAGE=yes BUILD=static
- os: linux
compiler: g++-5
env: AUTOTOOLS=yes COVERAGE=no BUILD=shared
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-5
- os: linux
compiler: clang++-3.7
env: AUTOTOOLS=no COVERAGE=yes BUILD=static
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
packages:
- clang-3.7
- os: linux
compiler: clang
env: AUTOTOOLS=yes COVERAGE=no BUILD=shared
- os: osx
compiler: clang
env: AUTOTOOLS=no COVERAGE=no BUILD=shared
- os: osx
compiler: clang
env: AUTOTOOLS=no COVERAGE=yes BUILD=static
- os: osx
compiler: clang
env: AUTOTOOLS=yes COVERAGE=no BUILD=shared
script:
- ./script/ci-build-libsass
- ./script/ci-build-plugin math
- ./script/ci-build-plugin glob
- ./script/ci-build-plugin digest
- ./script/ci-build-plugin tests
before_install: ./script/ci-install-deps
install: ./script/ci-install-compiler
after_success: ./script/ci-report-coverage

25
node_modules/node-sass/src/libsass/COPYING generated vendored Normal file
View File

@@ -0,0 +1,25 @@
Copyright (C) 2012 by Hampton Catlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The following files in the spec were taken from the original Ruby Sass project which
is copyright Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein and under
the same license.

74
node_modules/node-sass/src/libsass/GNUmakefile.am generated vendored Normal file
View File

@@ -0,0 +1,74 @@
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4 -I script
AM_COPT = -Wall -O2
AM_COVLDFLAGS =
if ENABLE_COVERAGE
AM_COPT = -Wall -O1 -fno-omit-frame-pointer --coverage
AM_COVLDFLAGS += -lgcov
endif
AM_CPPFLAGS = -I$(top_srcdir)/include
AM_CFLAGS = $(AM_COPT)
AM_CXXFLAGS = $(AM_COPT)
AM_LDFLAGS = $(AM_COPT) $(AM_COVLDFLAGS)
# only needed to support old source tree
# we have moved the files to src folder
AM_CPPFLAGS += -I$(top_srcdir)
RESOURCES =
if COMPILER_IS_MINGW32
RESOURCES += res/libsass.rc
AM_CXXFLAGS += -std=gnu++0x
else
AM_CXXFLAGS += -std=c++0x
endif
TEST_EXTENSIONS = .rb
if ENABLE_TESTS
SASS_SASSC_PATH ?= $(top_srcdir)/sassc
SASS_SPEC_PATH ?= $(top_srcdir)/sass-spec
noinst_PROGRAMS = tester
tester_LDADD = src/libsass.la
tester_LDFLAGS = $(AM_LDFLAGS)
nodist_tester_SOURCES = $(SASS_SASSC_PATH)/sassc.c
SASS_SASSC_VERSION ?= `cd "$(SASS_SASSC_PATH)" && ./version.sh`
tester_CFLAGS = $(AM_CFLAGS) -DSASSC_VERSION="\"$(SASS_SASSC_VERSION)\""
tester_CXXFLAGS = $(AM_CXXFLAGS) -DSASSC_VERSION="\"$(SASS_SASSC_VERSION)\""
if ENABLE_COVERAGE
nodist_EXTRA_tester_SOURCES = non-existent-file-to-force-CXX-linking.cxx
endif
TESTS = $(SASS_SPEC_PATH)/sass-spec.rb
RB_LOG_COMPILER = ./script/tap-runner
AM_RB_LOG_FLAGS = $(RUBY)
SASS_TEST_FLAGS = -V 3.5 --impl libsass
SASS_TEST_FLAGS += -r $(SASS_SPEC_PATH)
SASS_TEST_FLAGS += -c $(top_srcdir)/tester$(EXEEXT)
AM_TESTS_ENVIRONMENT = TEST_FLAGS='$(SASS_TEST_FLAGS)'
SASS_TESTER = $(RUBY) $(SASS_SPEC_PATH)/sass-spec.rb
test:
$(SASS_TESTER) $(SASS_TEST_FLAGS)
test_build:
$(SASS_TESTER) $(SASS_TEST_FLAGS)
test_full:
$(SASS_TESTER) --run-todo $(SASS_TEST_FLAGS)
test_probe:
$(SASS_TESTER) --probe-todo $(SASS_TEST_FLAGS)
.PHONY: test test_build test_full test_probe
endif
SUBDIRS = src

1
node_modules/node-sass/src/libsass/INSTALL generated vendored Normal file
View File

@@ -0,0 +1 @@
// Autotools requires us to have this file. Boo.

25
node_modules/node-sass/src/libsass/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,25 @@
Copyright (C) 2012-2016 by the Sass Open Source Foundation
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The following files in the spec were taken from the original Ruby Sass project which
is copyright Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein and under
the same license.

351
node_modules/node-sass/src/libsass/Makefile generated vendored Normal file
View File

@@ -0,0 +1,351 @@
OS ?= $(shell uname -s)
CC ?= gcc
CXX ?= g++
RM ?= rm -f
CP ?= cp -a
MKDIR ?= mkdir
RMDIR ?= rmdir
WINDRES ?= windres
# Solaris/Illumos flavors
# ginstall from coreutils
ifeq ($(OS),SunOS)
INSTALL ?= ginstall
endif
INSTALL ?= install
CFLAGS ?= -Wall
CXXFLAGS ?= -Wall
LDFLAGS ?= -Wall
ifeq "x$(COVERAGE)" "x"
CFLAGS += -O2
CXXFLAGS += -O2
LDFLAGS += -O2
else
CFLAGS += -O1 -fno-omit-frame-pointer
CXXFLAGS += -O1 -fno-omit-frame-pointer
LDFLAGS += -O1 -fno-omit-frame-pointer
endif
LDFLAGS += -Wl,-undefined,error
CAT ?= $(if $(filter $(OS),Windows_NT),type,cat)
ifneq (,$(findstring /cygdrive/,$(PATH)))
UNAME := Cygwin
else
ifneq (,$(findstring Windows_NT,$(OS)))
UNAME := Windows
else
ifneq (,$(findstring mingw32,$(MAKE)))
UNAME := Windows
else
ifneq (,$(findstring MINGW32,$(shell uname -s)))
UNAME = Windows
else
UNAME := $(shell uname -s)
endif
endif
endif
endif
ifeq ($(SASS_LIBSASS_PATH),)
SASS_LIBSASS_PATH = $(abspath $(CURDIR))
endif
ifeq ($(LIBSASS_VERSION),)
ifneq ($(wildcard ./.git/ ),)
LIBSASS_VERSION ?= $(shell git describe --abbrev=4 --dirty --always --tags)
endif
endif
ifeq ($(LIBSASS_VERSION),)
ifneq ($(wildcard VERSION),)
LIBSASS_VERSION ?= $(shell $(CAT) VERSION)
endif
endif
ifneq ($(LIBSASS_VERSION),)
CFLAGS += -DLIBSASS_VERSION="\"$(LIBSASS_VERSION)\""
CXXFLAGS += -DLIBSASS_VERSION="\"$(LIBSASS_VERSION)\""
endif
# enable mandatory flag
ifeq (Windows,$(UNAME))
ifneq ($(BUILD),shared)
STATIC_ALL ?= 1
endif
STATIC_LIBGCC ?= 1
STATIC_LIBSTDCPP ?= 1
CXXFLAGS += -std=gnu++0x
LDFLAGS += -std=gnu++0x
else
STATIC_ALL ?= 0
STATIC_LIBGCC ?= 0
STATIC_LIBSTDCPP ?= 0
CXXFLAGS += -std=c++0x
LDFLAGS += -std=c++0x
endif
ifneq ($(SASS_LIBSASS_PATH),)
CFLAGS += -I $(SASS_LIBSASS_PATH)/include
CXXFLAGS += -I $(SASS_LIBSASS_PATH)/include
else
# this is needed for mingw
CFLAGS += -I include
CXXFLAGS += -I include
endif
ifneq ($(EXTRA_CFLAGS),)
CFLAGS += $(EXTRA_CFLAGS)
endif
ifneq ($(EXTRA_CXXFLAGS),)
CXXFLAGS += $(EXTRA_CXXFLAGS)
endif
ifneq ($(EXTRA_LDFLAGS),)
LDFLAGS += $(EXTRA_LDFLAGS)
endif
LDLIBS = -lm
ifneq ($(BUILD),shared)
LDLIBS += -lstdc++
endif
# link statically into lib
# makes it a lot more portable
# increases size by about 50KB
ifeq ($(STATIC_ALL),1)
LDFLAGS += -static
endif
ifeq ($(STATIC_LIBGCC),1)
LDFLAGS += -static-libgcc
endif
ifeq ($(STATIC_LIBSTDCPP),1)
LDFLAGS += -static-libstdc++
endif
ifeq ($(UNAME),Darwin)
CFLAGS += -stdlib=libc++
CXXFLAGS += -stdlib=libc++
LDFLAGS += -stdlib=libc++
endif
ifneq (Windows,$(UNAME))
ifneq (FreeBSD,$(UNAME))
ifneq (OpenBSD,$(UNAME))
LDFLAGS += -ldl
LDLIBS += -ldl
endif
endif
endif
ifneq ($(BUILD),shared)
BUILD := static
endif
ifeq ($(DEBUG),1)
BUILD := debug-$(BUILD)
endif
ifeq (,$(TRAVIS_BUILD_DIR))
ifeq ($(OS),SunOS)
PREFIX ?= /opt/local
else
PREFIX ?= /usr/local
endif
else
PREFIX ?= $(TRAVIS_BUILD_DIR)
endif
SASS_SASSC_PATH ?= sassc
SASS_SPEC_PATH ?= sass-spec
SASS_SPEC_SPEC_DIR ?= spec
SASSC_BIN = $(SASS_SASSC_PATH)/bin/sassc
RUBY_BIN = ruby
LIB_STATIC = $(SASS_LIBSASS_PATH)/lib/libsass.a
LIB_SHARED = $(SASS_LIBSASS_PATH)/lib/libsass.so
ifeq (Windows,$(UNAME))
ifeq (shared,$(BUILD))
CFLAGS += -D ADD_EXPORTS
CXXFLAGS += -D ADD_EXPORTS
LIB_SHARED = $(SASS_LIBSASS_PATH)/lib/libsass.dll
endif
else
ifneq (Cygwin,$(UNAME))
CFLAGS += -fPIC
CXXFLAGS += -fPIC
LDFLAGS += -fPIC
endif
endif
ifeq (Windows,$(UNAME))
SASSC_BIN = $(SASS_SASSC_PATH)/bin/sassc.exe
endif
include Makefile.conf
RESOURCES =
STATICLIB = lib/libsass.a
SHAREDLIB = lib/libsass.so
ifeq (Windows,$(UNAME))
RESOURCES += res/resource.rc
SHAREDLIB = lib/libsass.dll
ifeq (shared,$(BUILD))
CFLAGS += -D ADD_EXPORTS
CXXFLAGS += -D ADD_EXPORTS
endif
else
ifneq (Cygwin,$(UNAME))
CFLAGS += -fPIC
CXXFLAGS += -fPIC
LDFLAGS += -fPIC
endif
endif
OBJECTS = $(addprefix src/,$(SOURCES:.cpp=.o))
COBJECTS = $(addprefix src/,$(CSOURCES:.c=.o))
RCOBJECTS = $(RESOURCES:.rc=.o)
DEBUG_LVL ?= NONE
CLEANUPS ?=
CLEANUPS += $(RCOBJECTS)
CLEANUPS += $(COBJECTS)
CLEANUPS += $(OBJECTS)
CLEANUPS += $(LIBSASS_LIB)
all: $(BUILD)
debug: $(BUILD)
debug-static: LDFLAGS := -g $(filter-out -O2,$(LDFLAGS))
debug-static: CFLAGS := -g -DDEBUG -DDEBUG_LVL="$(DEBUG_LVL)" $(filter-out -O2,$(CFLAGS))
debug-static: CXXFLAGS := -g -DDEBUG -DDEBUG_LVL="$(DEBUG_LVL)" $(filter-out -O2,$(CXXFLAGS))
debug-static: static
debug-shared: LDFLAGS := -g $(filter-out -O2,$(LDFLAGS))
debug-shared: CFLAGS := -g -DDEBUG -DDEBUG_LVL="$(DEBUG_LVL)" $(filter-out -O2,$(CFLAGS))
debug-shared: CXXFLAGS := -g -DDEBUG -DDEBUG_LVL="$(DEBUG_LVL)" $(filter-out -O2,$(CXXFLAGS))
debug-shared: shared
lib:
$(MKDIR) lib
lib/libsass.a: lib $(COBJECTS) $(OBJECTS)
$(AR) rcvs $@ $(COBJECTS) $(OBJECTS)
lib/libsass.so: lib $(COBJECTS) $(OBJECTS)
$(CXX) -shared $(LDFLAGS) -o $@ $(COBJECTS) $(OBJECTS) $(LDLIBS)
lib/libsass.dll: lib $(COBJECTS) $(OBJECTS) $(RCOBJECTS)
$(CXX) -shared $(LDFLAGS) -o $@ $(COBJECTS) $(OBJECTS) $(RCOBJECTS) $(LDLIBS) -s -Wl,--subsystem,windows,--out-implib,lib/libsass.a
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
%.o: %.rc
$(WINDRES) -i $< -o $@
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
%: %.o static
$(CXX) $(CXXFLAGS) -o $@ $+ $(LDFLAGS) $(LDLIBS)
install: install-$(BUILD)
static: $(STATICLIB)
shared: $(SHAREDLIB)
$(DESTDIR)$(PREFIX):
$(MKDIR) $(DESTDIR)$(PREFIX)
$(DESTDIR)$(PREFIX)/lib: $(DESTDIR)$(PREFIX)
$(MKDIR) $(DESTDIR)$(PREFIX)/lib
$(DESTDIR)$(PREFIX)/include: $(DESTDIR)$(PREFIX)
$(MKDIR) $(DESTDIR)$(PREFIX)/include
$(DESTDIR)$(PREFIX)/include/sass: $(DESTDIR)$(PREFIX)/include
$(MKDIR) $(DESTDIR)$(PREFIX)/include/sass
$(DESTDIR)$(PREFIX)/include/%.h: include/%.h \
$(DESTDIR)$(PREFIX)/include \
$(DESTDIR)$(PREFIX)/include/sass
$(INSTALL) -v -m0644 "$<" "$@"
install-headers: $(DESTDIR)$(PREFIX)/include/sass.h \
$(DESTDIR)$(PREFIX)/include/sass2scss.h \
$(DESTDIR)$(PREFIX)/include/sass/base.h \
$(DESTDIR)$(PREFIX)/include/sass/version.h \
$(DESTDIR)$(PREFIX)/include/sass/values.h \
$(DESTDIR)$(PREFIX)/include/sass/context.h \
$(DESTDIR)$(PREFIX)/include/sass/functions.h
$(DESTDIR)$(PREFIX)/lib/%.a: lib/%.a \
$(DESTDIR)$(PREFIX)/lib
@$(INSTALL) -v -m0755 "$<" "$@"
$(DESTDIR)$(PREFIX)/lib/%.so: lib/%.so \
$(DESTDIR)$(PREFIX)/lib
@$(INSTALL) -v -m0755 "$<" "$@"
$(DESTDIR)$(PREFIX)/lib/%.dll: lib/%.dll \
$(DESTDIR)$(PREFIX)/lib
@$(INSTALL) -v -m0755 "$<" "$@"
install-static: $(DESTDIR)$(PREFIX)/lib/libsass.a
install-shared: $(DESTDIR)$(PREFIX)/lib/libsass.so \
install-headers
$(SASSC_BIN): $(BUILD)
$(MAKE) -C $(SASS_SASSC_PATH) build-$(BUILD)-dev
sassc: $(SASSC_BIN)
$(SASSC_BIN) -v
version: $(SASSC_BIN)
$(SASSC_BIN) -h
$(SASSC_BIN) -v
test: $(SASSC_BIN)
$(RUBY_BIN) $(SASS_SPEC_PATH)/sass-spec.rb -V 3.5 -c $(SASSC_BIN) --impl libsass $(LOG_FLAGS) $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)
test_build: $(SASSC_BIN)
$(RUBY_BIN) $(SASS_SPEC_PATH)/sass-spec.rb -V 3.5 -c $(SASSC_BIN) --impl libsass $(LOG_FLAGS) $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)
test_full: $(SASSC_BIN)
$(RUBY_BIN) $(SASS_SPEC_PATH)/sass-spec.rb -V 3.5 -c $(SASSC_BIN) --impl libsass --run-todo $(LOG_FLAGS) $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)
test_probe: $(SASSC_BIN)
$(RUBY_BIN) $(SASS_SPEC_PATH)/sass-spec.rb -V 3.5 -c $(SASSC_BIN) --impl libsass --probe-todo $(LOG_FLAGS) $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)
clean-objects: lib
-$(RM) lib/*.a lib/*.so lib/*.dll lib/*.la
-$(RMDIR) lib
clean: clean-objects
$(RM) $(CLEANUPS)
clean-all:
$(MAKE) -C $(SASS_SASSC_PATH) clean
lib-file: lib-file-$(BUILD)
lib-opts: lib-opts-$(BUILD)
lib-file-static:
@echo $(LIB_STATIC)
lib-file-shared:
@echo $(LIB_SHARED)
lib-opts-static:
@echo -L"$(SASS_LIBSASS_PATH)/lib"
lib-opts-shared:
@echo -L"$(SASS_LIBSASS_PATH)/lib -lsass"
.PHONY: all static shared sassc \
version install-headers \
clean clean-all clean-objects \
debug debug-static debug-shared \
install install-static install-shared \
lib-opts lib-opts-shared lib-opts-static \
lib-file lib-file-shared lib-file-static
.DELETE_ON_ERROR:

55
node_modules/node-sass/src/libsass/Makefile.conf generated vendored Normal file
View File

@@ -0,0 +1,55 @@
# this is merely a common Makefile multiple implementers can use
# bigger files (in terms of compile time) tend to go to the top,
# so they don't end up as the last compile unit when compiling
# in parallel. But we also want to mix them a little too avoid
# heavy RAM usage peaks. Other than that the order is arbitrary.
SOURCES = \
ast.cpp \
node.cpp \
context.cpp \
constants.cpp \
functions.cpp \
color_maps.cpp \
environment.cpp \
ast_fwd_decl.cpp \
bind.cpp \
file.cpp \
util.cpp \
json.cpp \
units.cpp \
values.cpp \
plugins.cpp \
position.cpp \
lexer.cpp \
parser.cpp \
prelexer.cpp \
eval.cpp \
expand.cpp \
listize.cpp \
cssize.cpp \
extend.cpp \
output.cpp \
inspect.cpp \
emitter.cpp \
check_nesting.cpp \
remove_placeholders.cpp \
sass.cpp \
sass_util.cpp \
sass_values.cpp \
sass_context.cpp \
sass_functions.cpp \
sass2scss.cpp \
backtrace.cpp \
operators.cpp \
to_c.cpp \
to_value.cpp \
source_map.cpp \
subset_map.cpp \
error_handling.cpp \
memory/SharedPtr.cpp \
utf8_string.cpp \
base64vlq.cpp
CSOURCES = cencode.c

104
node_modules/node-sass/src/libsass/Readme.md generated vendored Normal file
View File

@@ -0,0 +1,104 @@
LibSass - Sass compiler written in C++
======================================
Currently maintained by Marcel Greter ([@mgreter]) and Michael Mifsud ([@xzyfer])
Originally created by Aaron Leung ([@akhleung]) and Hampton Catlin ([@hcatlin])
[![Unix CI](https://travis-ci.org/sass/libsass.svg?branch=master)](https://travis-ci.org/sass/libsass "Travis CI")
[![Windows CI](https://ci.appveyor.com/api/projects/status/github/sass/libsass?svg=true)](https://ci.appveyor.com/project/sass/libsass/branch/master "Appveyor CI")
[![Coverage Status](https://img.shields.io/coveralls/sass/libsass.svg)](https://coveralls.io/r/sass/libsass?branch=feature%2Ftest-travis-ci-3 "Code coverage of spec tests")
[![Percentage of issues still open](http://isitmaintained.com/badge/open/sass/libsass.svg)](http://isitmaintained.com/project/sass/libsass "Percentage of issues still open")
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/sass/libsass.svg)](http://isitmaintained.com/project/sass/libsass "Average time to resolve an issue")
[![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=283068)](https://www.bountysource.com/trackers/283068-libsass?utm_source=283068&utm_medium=shield&utm_campaign=TRACKER_BADGE "Bountysource")
[![Join us](https://libsass-slack.herokuapp.com/badge.svg)](https://libsass-slack.herokuapp.com/ "Slack communication channels")
[LibSass](https://github.com/sass/libsass "LibSass GitHub Project") is just a library!
If you want to use LibSass to compile Sass, you need an implementer. Some
implementations are only bindings into other programming languages. But most also
ship with a command line interface (CLI) you can use directly. There is also
[SassC](https://github.com/sass/sassc), which is the official lightweight
CLI tool built by the same people as LibSass.
### Excerpt of "sanctioned" implementations:
- https://github.com/sass/node-sass (Node.js)
- https://github.com/sass/perl-libsass (Perl)
- https://github.com/sass/libsass-python (Python)
- https://github.com/wellington/go-libsass (Go)
- https://github.com/sass/sassc-ruby (Ruby)
- https://github.com/sass/libsass-net (C#)
- https://github.com/medialize/sass.js (JS)
- https://github.com/bit3/jsass (Java)
This list does not say anything about the quality of either the listed or not listed [implementations](docs/implementations.md)!
The authors of the listed projects above are just known to work regularly together with LibSass developers.
About
-----
LibSass is a C++ port of the original Ruby Sass CSS compiler with a [C API](docs/api-doc.md).
We coded LibSass with portability and efficiency in mind. You can expect LibSass to be a lot
faster than Ruby Sass and on par or faster than the best alternative CSS compilers around.
Developing
----------
As noted above, the LibSass repository does not contain any binaries or other way to execute
LibSass. Therefore, you need an implementer to develop LibSass. Easiest is to start with
the official [SassC](http://github.com/sass/sassc) CLI wrapper. It is *guaranteed* to compile
with the latest code in LibSass master, since it is also used in the CI process. There is no
limitation here, as you may use any other LibSass implementer to test your LibSass branch!
Testing
-------
Since LibSass is a pure library, tests are run through the [Sass-Spec](https://github.com/sass/sass-spec)
project using the [SassC](http://github.com/sass/sassc) CLI wrapper. To run the tests against LibSass while
developing, you can run `./script/spec`. This will clone SassC and Sass-Spec under the project folder and
then run the Sass-Spec test suite. You may want to update the clones to ensure you have the latest version.
Note that the scripts in the `./script` folder are mainly intended for our CI needs.
Building
--------
To build LibSass you need GCC 4.6+ or Clang/LLVM. If your OS is older, you may need to upgrade
them first (or install clang as an alternative). On Windows, you need MinGW with GCC 4.6+ or VS 2013
Update 4+. It is also possible to build LibSass with Clang/LLVM on Windows with various build chains
and/or command line interpreters.
See the [build docs for further instructions](docs/build.md)!
Compatibility
-------------
Current LibSass 3.4 should be compatible with Sass 3.4. Please refer to the [sass compatibility
page](http://sass-compatibility.github.io/) for a more detailed comparison. But note that there
are still a few incomplete edges which we are aware of. Otherwise LibSass has reached a good level
of stability, thanks to our ever growing [Sass-Spec test suite](https://github.com/sass/sass-spec).
About Sass
----------
Sass is a CSS pre-processor language to add on exciting, new, awesome features to CSS. Sass was
the first language of its kind and by far the most mature and up to date codebase.
Sass was originally conceived of by the co-creator of this library, Hampton Catlin ([@hcatlin]).
Most of the language has been the result of years of work by Natalie Weizenbaum ([@nex3]) and
Chris Eppstein ([@chriseppstein]).
For more information about Sass itself, please visit http://sass-lang.com
Initial development of LibSass by Aaron Leung and Hampton Catlin was supported by [Moovweb](http://www.moovweb.com).
Licensing
---------
Our [MIT license](LICENSE) is designed to be as simple and liberal as possible.
[@hcatlin]: https://github.com/hcatlin
[@akhleung]: https://github.com/akhleung
[@chriseppstein]: https://github.com/chriseppstein
[@nex3]: https://github.com/nex3
[@mgreter]: https://github.com/mgreter
[@xzyfer]: https://github.com/xzyfer

10
node_modules/node-sass/src/libsass/SECURITY.md generated vendored Normal file
View File

@@ -0,0 +1,10 @@
Serious about security
======================
The LibSass team recognizes the important contributions the security research
community can make. We therefore encourage reporting security issues with the
code contained in this repository.
If you believe you have discovered a security vulnerability, please report it at
https://hackerone.com/libsass instead of GitHub.

91
node_modules/node-sass/src/libsass/appveyor.yml generated vendored Normal file
View File

@@ -0,0 +1,91 @@
os: Visual Studio 2013
environment:
CTEST_OUTPUT_ON_FAILURE: 1
ruby_version: 22-x64
TargetPath: sassc/bin/sassc.exe
matrix:
- Compiler: msvc
Config: Release
Platform: Win32
- Compiler: msvc
Config: Debug
Platform: Win32
- Compiler: msvc
Config: Release
Platform: Win64
- Compiler: mingw
Build: static
- Compiler: mingw
Build: shared
cache:
- C:\Ruby%ruby_version%\lib\ruby\gems
- C:\mingw64
install:
- git clone https://github.com/sass/sassc.git
- git clone https://github.com/sass/sass-spec.git
- set PATH=C:\Ruby%ruby_version%\bin;%PATH%
- ps: |
if(!(gem which minitest 2>$nul)) { gem install minitest --no-ri --no-rdoc }
if ($env:Compiler -eq "mingw" -AND -Not (Test-Path "C:\mingw64")) {
# Install MinGW.
$file = "x86_64-4.9.2-release-win32-seh-rt_v4-rev3.7z"
wget https://bintray.com/artifact/download/drewwells/generic/$file -OutFile $file
&7z x -oC:\ $file > $null
}
- set PATH=C:\mingw64\bin;%PATH%
- set CC=gcc
build_script:
- ps: |
if ($env:Compiler -eq "mingw") {
mingw32-make -j4 sassc
} else {
msbuild /m:4 /p:"Configuration=$env:Config;Platform=$env:Platform" sassc\win\sassc.sln
}
# print the branding art
mv script/branding script/branding.ps1
script/branding.ps1
# print the version info
&$env:TargetPath -v
ruby -v
test_script:
- ps: |
$PRNR = $env:APPVEYOR_PULL_REQUEST_NUMBER
if ($PRNR) {
echo "Fetching info for PR $PRNR"
wget https://api.github.com/repos/sass/libsass/pulls/$PRNR -OutFile pr.json
$json = cat pr.json -Raw
$SPEC_PR = [regex]::match($json,'sass\/sass-spec(#|\/pull\/)([0-9]+)').Groups[2].Value
if ($SPEC_PR) {
echo "Checkout sass spec PR $SPEC_PR"
git -C sass-spec fetch -q -u origin pull/$SPEC_PR/head:ci-spec-pr-$SPEC_PR
git -C sass-spec checkout -q --force ci-spec-pr-$SPEC_PR
}
}
$env:TargetPath = Join-Path $pwd.Path $env:TargetPath
If (Test-Path "$env:TargetPath") {
ruby sass-spec/sass-spec.rb -V 3.5 --probe-todo --impl libsass -c $env:TargetPath -s sass-spec/spec
if(-not($?)) {
echo "sass-spec tests failed"
exit 1
}
} else {
echo "spec runner not found (compile error?)"
exit 1
}
Write-Host "Explicitly testing the case when cwd has Cyrillic characters: " -nonewline
# See comments in gh-1774 for details.
cd sass-spec/spec/libsass/Sáss-UŢF8/
&$env:TargetPath ./input.scss 2>&1>$null
if(-not($?)) {
echo "Failed!"
exit 1
} else {
echo "Success!"
}

134
node_modules/node-sass/src/libsass/configure.ac generated vendored Normal file
View File

@@ -0,0 +1,134 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.61])
AC_INIT([libsass], m4_esyscmd_s([./version.sh]), [support@moovweb.com])
AC_CONFIG_SRCDIR([src/ast.hpp])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_FILES([include/sass/version.h])
AC_CONFIG_AUX_DIR([script])
# These are flags passed to automake
# Though they look like gcc flags!
AM_INIT_AUTOMAKE([foreign parallel-tests -Wall])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])])
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_LANG_PUSH([C])
AC_LANG_PUSH([C++])
AC_GNU_SOURCE
# Check fails on Travis, but it works fine
# AX_CXX_COMPILE_STDCXX_11([ext],[optional])
AC_CHECK_TOOL([AR], [ar], [false])
AC_CHECK_TOOL([DLLTOOL], [dlltool], [false])
AC_CHECK_TOOL([DLLWRAP], [dllwrap], [false])
AC_CHECK_TOOL([WINDRES], [windres], [false])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
LT_INIT([dlopen])
# Checks for header files.
AC_CHECK_HEADERS([unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([floor getcwd strtol])
# Checks for testing.
AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests], [enable testing the build]),
[enable_tests="$enableval"], [enable_tests=no])
AS_CASE([$host], [*-*-mingw*], [is_mingw32=yes], [is_mingw32=no])
AM_CONDITIONAL(COMPILER_IS_MINGW32, test "x$is_mingw32" = "xyes")
dnl The dlopen() function is in the C library for *BSD and in
dnl libdl on GLIBC-based systems
if test "x$is_mingw32" != "xyes"; then
AC_SEARCH_LIBS([dlopen], [dl dld], [], [
AC_MSG_ERROR([unable to find the dlopen() function])
])
fi
if test "x$enable_tests" = "xyes"; then
AC_PROG_CC
AC_PROG_AWK
# test need minitest gem
AC_PATH_PROG(RUBY, [ruby])
AC_PATH_PROG(TAPOUT, [tapout])
AC_REQUIRE_AUX_FILE([tap-driver])
AC_REQUIRE_AUX_FILE([tap-runner])
AC_ARG_WITH(sassc-dir,
AS_HELP_STRING([--with-sassc-dir=<dir>], [specify directory of sassc sources for testing (default: sassc)]),
[sassc_dir="$withval"], [sassc_dir="sassc"])
AC_CHECK_FILE([$sassc_dir/sassc.c], [], [
AC_MSG_ERROR([Unable to find sassc directory.
You must clone the sassc repository in this directory or specify
the --with-sassc-dir=<dir> argument.
])
])
SASS_SASSC_PATH=$sassc_dir
AC_SUBST(SASS_SASSC_PATH)
AC_ARG_WITH(sass-spec-dir,
AS_HELP_STRING([--with-sass-spec-dir=<dir>], [specify directory of sass-spec for testing (default: sass-spec)]),
[sass_spec_dir="$withval"], [sass_spec_dir="sass-spec"])
AC_CHECK_FILE([$sass_spec_dir/sass-spec.rb], [], [
AC_MSG_ERROR([Unable to find sass-spec directory.
You must clone the sass-spec repository in this directory or specify
the --with-sass-spec-dir=<dir> argument.
])
])
# Automake doesn't like its tests in an absolute path, so we make it relative.
case $sass_spec_dir in
/*)
SASS_SPEC_PATH=`$RUBY -e "require 'pathname'; puts Pathname.new('$sass_spec_dir').relative_path_from(Pathname.new('$PWD')).to_s"`
;;
*)
SASS_SPEC_PATH="$sass_spec_dir"
;;
esac
AC_SUBST(SASS_SPEC_PATH)
else
# we do not really need these paths for non test build
# but automake may error if we do not define them here
SASS_SPEC_PATH=sass-spec
SASS_SASSC_PATH=sassc
AC_SUBST(SASS_SPEC_PATH)
AC_SUBST(SASS_SASSC_PATH)
fi
AM_CONDITIONAL(ENABLE_TESTS, test "x$enable_tests" = "xyes")
AC_ARG_ENABLE([coverage],
[AS_HELP_STRING([--enable-coverage],
[enable coverage report for test suite])],
[enable_cov=$enableval],
[enable_cov=no])
if test "x$enable_cov" = "xyes"; then
AC_CHECK_PROG(GCOV, gcov, gcov)
# Remove all optimization flags from C[XX]FLAGS
changequote({,})
CFLAGS=`echo "$CFLAGS -O1 -fno-omit-frame-pointer" | $SED -e 's/-O[0-9]*//g'`
CXXFLAGS=`echo "$CXXFLAGS -O1 -fno-omit-frame-pointer" | $SED -e 's/-O[0-9]*//g'`
changequote([,])
AC_SUBST(GCOV)
fi
AM_CONDITIONAL(ENABLE_COVERAGE, test "x$enable_cov" = "xyes")
AC_SUBST(PACKAGE_VERSION)
AC_MSG_NOTICE([Building libsass ($VERSION)])
AC_CONFIG_FILES([GNUmakefile src/GNUmakefile src/support/libsass.pc])
AC_OUTPUT

View File

@@ -0,0 +1,66 @@
Name: libsass
Version: %{version}
Release: 1%{?dist}
Summary: A C/C++ implementation of a Sass compiler
License: MIT
URL: http://libsass.org
Source0: %{name}-%{version}.tar.gz
BuildRequires: gcc-c++ >= 4.7
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
%description
LibSass is a C/C++ port of the Sass engine. The point is to be simple, fast, and easy to integrate.
%package devel
Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%prep
%setup -q
autoreconf --force --install
%build
%configure --disable-static \
--disable-tests \
--enable-shared
make %{?_smp_mflags}
%install
%make_install
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%doc Readme.md LICENSE
%{_libdir}/*.so.*
%files devel
%doc
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%changelog
* Tue Feb 10 2015 Gawain Lynch <gawain.lynch@gmail.com> - 3.1.0-1
- Initial SPEC file

60
node_modules/node-sass/src/libsass/contrib/plugin.cpp generated vendored Normal file
View File

@@ -0,0 +1,60 @@
#include <cstring>
#include <iostream>
#include <stdint.h>
#include <sass.h>
// gcc: g++ -shared plugin.cpp -o plugin.so -fPIC -Llib -lsass
// mingw: g++ -shared plugin.cpp -o plugin.dll -Llib -lsass
extern "C" const char* ADDCALL libsass_get_version() {
return libsass_version();
}
union Sass_Value* custom_function(const union Sass_Value* s_args, Sass_Function_Entry cb, struct Sass_Compiler* comp)
{
// get context/option struct associated with this compiler
struct Sass_Context* ctx = sass_compiler_get_context(comp);
struct Sass_Options* opts = sass_compiler_get_options(comp);
// get the cookie from function descriptor
void* cookie = sass_function_get_cookie(cb);
// we actually abuse the void* to store an "int"
return sass_make_number((intptr_t)cookie, "px");
}
extern "C" Sass_Function_List ADDCALL libsass_load_functions()
{
// allocate a custom function caller
Sass_Function_Entry c_func =
sass_make_function("foo()", custom_function, (void*)42);
// create list of all custom functions
Sass_Function_List fn_list = sass_make_function_list(1);
// put the only function in this plugin to the list
sass_function_set_list_entry(fn_list, 0, c_func);
// return the list
return fn_list;
}
Sass_Import_List custom_importer(const char* cur_path, Sass_Importer_Entry cb, struct Sass_Compiler* comp)
{
// get the cookie from importer descriptor
void* cookie = sass_importer_get_cookie(cb);
// create a list to hold our import entries
Sass_Import_List incs = sass_make_import_list(1);
// create our only import entry (route path back)
incs[0] = sass_make_import_entry(cur_path, 0, 0);
// return imports
return incs;
}
extern "C" Sass_Importer_List ADDCALL libsass_load_importers()
{
// allocate a custom function caller
Sass_Importer_Entry c_imp =
sass_make_importer(custom_importer, - 99, (void*)42);
// create list of all custom functions
Sass_Importer_List imp_list = sass_make_importer_list(1);
// put the only function in this plugin to the list
sass_importer_set_list_entry(imp_list, 0, c_imp);
// return the list
return imp_list;
}

20
node_modules/node-sass/src/libsass/docs/README.md generated vendored Normal file
View File

@@ -0,0 +1,20 @@
Welcome to the LibSass documentation!
## First Off
LibSass is just a library. To run the code locally (i.e. to compile your stylesheets), you need an implementer. SassC (get it?) is an implementer written in C. There are a number of other implementations of LibSass - for example Node. We encourage you to write your own port - the whole point of LibSass is that we want to bring Sass to many other languages, not just Ruby!
We're working hard on moving to full parity with Ruby Sass... learn more at the [The-LibSass-Compatibility-Plan](compatibility-plan.md)!
### Implementing LibSass
If you're interested in implementing LibSass in your own project see the [API Documentation](api-doc.md) which now includes implementing
your own [Sass functions](api-function.md). You may wish to [look at other implementations](implementations.md) for your language of choice.
Or make your own!
### Contributing to LibSass
| Issue Tracker | Issue Triage | Community Guidelines |
|-------------------|----------------------------------|-----------------------------|
| We're always needing help, so check out our issue tracker, help some people out, and read our article on [Contributing](contributing.md)! It's got all the details on what to do! | To help understand the process of triaging bugs, have a look at our [Issue-Triage](triage.md) document. | Oh, and don't forget we always follow [[Sass Community Guidelines|http://sass-lang.com/community-guidelines]]. Be nice and everyone else will be nice too! |
Please refer to the steps on [Building LibSass](build.md)

View File

@@ -0,0 +1,45 @@
## Example main.c
```C
#include <stdio.h>
#include "sass/context.h"
int main( int argc, const char* argv[] )
{
// get the input file from first argument or use default
const char* input = argc > 1 ? argv[1] : "styles.scss";
// create the file context and get all related structs
struct Sass_File_Context* file_ctx = sass_make_file_context(input);
struct Sass_Context* ctx = sass_file_context_get_context(file_ctx);
struct Sass_Options* ctx_opt = sass_context_get_options(ctx);
// configure some options ...
sass_option_set_precision(ctx_opt, 10);
// context is set up, call the compile step now
int status = sass_compile_file_context(file_ctx);
// print the result or the error to the stdout
if (status == 0) puts(sass_context_get_output_string(ctx));
else puts(sass_context_get_error_message(ctx));
// release allocated memory
sass_delete_file_context(file_ctx);
// exit status
return status;
}
```
### Compile main.c
```bash
gcc -c main.c -o main.o
gcc -o sample main.o -lsass
echo "foo { margin: 21px * 2; }" > foo.scss
./sample foo.scss => "foo { margin: 42px }"
```

View File

@@ -0,0 +1,163 @@
```C
// Input behaviours
enum Sass_Input_Style {
SASS_CONTEXT_NULL,
SASS_CONTEXT_FILE,
SASS_CONTEXT_DATA,
SASS_CONTEXT_FOLDER
};
// sass config options structure
struct Sass_Inspect_Options {
// Output style for the generated css code
// A value from above SASS_STYLE_* constants
enum Sass_Output_Style output_style;
// Precision for fractional numbers
int precision;
};
// sass config options structure
struct Sass_Output_Options : Sass_Inspect_Options {
// String to be used for indentation
const char* indent;
// String to be used to for line feeds
const char* linefeed;
// Emit comments in the generated CSS indicating
// the corresponding source line.
bool source_comments;
};
// sass config options structure
struct Sass_Options : Sass_Output_Options {
// embed sourceMappingUrl as data uri
bool source_map_embed;
// embed include contents in maps
bool source_map_contents;
// create file urls for sources
bool source_map_file_urls;
// Disable sourceMappingUrl in css output
bool omit_source_map_url;
// Treat source_string as sass (as opposed to scss)
bool is_indented_syntax_src;
// The input path is used for source map
// generation. It can be used to define
// something with string compilation or to
// overload the input file path. It is
// set to "stdin" for data contexts and
// to the input file on file contexts.
char* input_path;
// The output path is used for source map
// generation. LibSass will not write to
// this file, it is just used to create
// information in source-maps etc.
char* output_path;
// Colon-separated list of paths
// Semicolon-separated on Windows
// Maybe use array interface instead?
char* include_path;
char* plugin_path;
// Include paths (linked string list)
struct string_list* include_paths;
// Plugin paths (linked string list)
struct string_list* plugin_paths;
// Path to source map file
// Enables source map generation
// Used to create sourceMappingUrl
char* source_map_file;
// Directly inserted in source maps
char* source_map_root;
// Custom functions that can be called from sccs code
Sass_Function_List c_functions;
// Callback to overload imports
Sass_Importer_List c_importers;
// List of custom headers
Sass_Importer_List c_headers;
};
// base for all contexts
struct Sass_Context : Sass_Options
{
// store context type info
enum Sass_Input_Style type;
// generated output data
char* output_string;
// generated source map json
char* source_map_string;
// error status
int error_status;
char* error_json;
char* error_text;
char* error_message;
// error position
char* error_file;
size_t error_line;
size_t error_column;
const char* error_src;
// report imported files
char** included_files;
};
// struct for file compilation
struct Sass_File_Context : Sass_Context {
// no additional fields required
// input_path is already on options
};
// struct for data compilation
struct Sass_Data_Context : Sass_Context {
// provided source string
char* source_string;
char* srcmap_string;
};
// Compiler states
enum Sass_Compiler_State {
SASS_COMPILER_CREATED,
SASS_COMPILER_PARSED,
SASS_COMPILER_EXECUTED
};
// link c and cpp context
struct Sass_Compiler {
// progress status
Sass_Compiler_State state;
// original c context
Sass_Context* c_ctx;
// Sass::Context
Sass::Context* cpp_ctx;
// Sass::Block
Sass::Block_Obj root;
};
```

295
node_modules/node-sass/src/libsass/docs/api-context.md generated vendored Normal file
View File

@@ -0,0 +1,295 @@
Sass Contexts come in two flavors:
- `Sass_File_Context`
- `Sass_Data_Context`
### Basic Usage
```C
#include "sass/context.h"
```
***Sass_Options***
```C
// Precision for fractional numbers
int precision;
```
```C
// Output style for the generated css code
// A value from above SASS_STYLE_* constants
int output_style;
```
```C
// Emit comments in the generated CSS indicating
// the corresponding source line.
bool source_comments;
```
```C
// embed sourceMappingUrl as data uri
bool source_map_embed;
```
```C
// embed include contents in maps
bool source_map_contents;
```
```C
// create file urls for sources
bool source_map_file_urls;
```
```C
// Disable sourceMappingUrl in css output
bool omit_source_map_url;
```
```C
// Treat source_string as sass (as opposed to scss)
bool is_indented_syntax_src;
```
```C
// The input path is used for source map
// generating. It can be used to define
// something with string compilation or to
// overload the input file path. It is
// set to "stdin" for data contexts and
// to the input file on file contexts.
char* input_path;
```
```C
// The output path is used for source map
// generating. LibSass will not write to
// this file, it is just used to create
// information in source-maps etc.
char* output_path;
```
```C
// String to be used for indentation
const char* indent;
```
```C
// String to be used to for line feeds
const char* linefeed;
```
```C
// Colon-separated list of paths
// Semicolon-separated on Windows
char* include_path;
char* plugin_path;
```
```C
// Additional include paths
// Must be null delimited
char** include_paths;
char** plugin_paths;
```
```C
// Path to source map file
// Enables the source map generating
// Used to create sourceMappingUrl
char* source_map_file;
```
```C
// Directly inserted in source maps
char* source_map_root;
```
```C
// Custom functions that can be called from Sass code
Sass_C_Function_List c_functions;
```
```C
// Callback to overload imports
Sass_C_Import_Callback importer;
```
***Sass_Context***
```C
// store context type info
enum Sass_Input_Style type;
````
```C
// generated output data
char* output_string;
```
```C
// generated source map json
char* source_map_string;
```
```C
// error status
int error_status;
char* error_json;
char* error_text;
char* error_message;
// error position
char* error_file;
size_t error_line;
size_t error_column;
```
```C
// report imported files
char** included_files;
```
***Sass_File_Context***
```C
// no additional fields required
// input_path is already on options
```
***Sass_Data_Context***
```C
// provided source string
char* source_string;
```
### Sass Context API
```C
// Forward declaration
struct Sass_Compiler;
// Forward declaration
struct Sass_Options;
struct Sass_Context; // : Sass_Options
struct Sass_File_Context; // : Sass_Context
struct Sass_Data_Context; // : Sass_Context
// Create and initialize an option struct
struct Sass_Options* sass_make_options (void);
// Create and initialize a specific context
struct Sass_File_Context* sass_make_file_context (const char* input_path);
struct Sass_Data_Context* sass_make_data_context (char* source_string);
// Call the compilation step for the specific context
int sass_compile_file_context (struct Sass_File_Context* ctx);
int sass_compile_data_context (struct Sass_Data_Context* ctx);
// Create a sass compiler instance for more control
struct Sass_Compiler* sass_make_file_compiler (struct Sass_File_Context* file_ctx);
struct Sass_Compiler* sass_make_data_compiler (struct Sass_Data_Context* data_ctx);
// Execute the different compilation steps individually
// Usefull if you only want to query the included files
int sass_compiler_parse (struct Sass_Compiler* compiler);
int sass_compiler_execute (struct Sass_Compiler* compiler);
// Release all memory allocated with the compiler
// This does _not_ include any contexts or options
void sass_delete_compiler (struct Sass_Compiler* compiler);
void sass_delete_options(struct Sass_Options* options);
// Release all memory allocated and also ourself
void sass_delete_file_context (struct Sass_File_Context* ctx);
void sass_delete_data_context (struct Sass_Data_Context* ctx);
// Getters for Context from specific implementation
struct Sass_Context* sass_file_context_get_context (struct Sass_File_Context* file_ctx);
struct Sass_Context* sass_data_context_get_context (struct Sass_Data_Context* data_ctx);
// Getters for Context_Options from Sass_Context
struct Sass_Options* sass_context_get_options (struct Sass_Context* ctx);
struct Sass_Options* sass_file_context_get_options (struct Sass_File_Context* file_ctx);
struct Sass_Options* sass_data_context_get_options (struct Sass_Data_Context* data_ctx);
void sass_file_context_set_options (struct Sass_File_Context* file_ctx, struct Sass_Options* opt);
void sass_data_context_set_options (struct Sass_Data_Context* data_ctx, struct Sass_Options* opt);
// Getters for Sass_Context values
const char* sass_context_get_output_string (struct Sass_Context* ctx);
int sass_context_get_error_status (struct Sass_Context* ctx);
const char* sass_context_get_error_json (struct Sass_Context* ctx);
const char* sass_context_get_error_text (struct Sass_Context* ctx);
const char* sass_context_get_error_message (struct Sass_Context* ctx);
const char* sass_context_get_error_file (struct Sass_Context* ctx);
size_t sass_context_get_error_line (struct Sass_Context* ctx);
size_t sass_context_get_error_column (struct Sass_Context* ctx);
const char* sass_context_get_source_map_string (struct Sass_Context* ctx);
char** sass_context_get_included_files (struct Sass_Context* ctx);
// Getters for Sass_Compiler options (query import stack)
size_t sass_compiler_get_import_stack_size(struct Sass_Compiler* compiler);
Sass_Import_Entry sass_compiler_get_last_import(struct Sass_Compiler* compiler);
Sass_Import_Entry sass_compiler_get_import_entry(struct Sass_Compiler* compiler, size_t idx);
// Getters for Sass_Compiler options (query function stack)
size_t sass_compiler_get_callee_stack_size(struct Sass_Compiler* compiler);
Sass_Callee_Entry sass_compiler_get_last_callee(struct Sass_Compiler* compiler);
Sass_Callee_Entry sass_compiler_get_callee_entry(struct Sass_Compiler* compiler, size_t idx);
// Take ownership of memory (value on context is set to 0)
char* sass_context_take_error_json (struct Sass_Context* ctx);
char* sass_context_take_error_text (struct Sass_Context* ctx);
char* sass_context_take_error_message (struct Sass_Context* ctx);
char* sass_context_take_error_file (struct Sass_Context* ctx);
char* sass_context_take_output_string (struct Sass_Context* ctx);
char* sass_context_take_source_map_string (struct Sass_Context* ctx);
```
### Sass Options API
```C
// Getters for Context_Option values
int sass_option_get_precision (struct Sass_Options* options);
enum Sass_Output_Style sass_option_get_output_style (struct Sass_Options* options);
bool sass_option_get_source_comments (struct Sass_Options* options);
bool sass_option_get_source_map_embed (struct Sass_Options* options);
bool sass_option_get_source_map_contents (struct Sass_Options* options);
bool sass_option_get_source_map_file_urls (struct Sass_Options* options);
bool sass_option_get_omit_source_map_url (struct Sass_Options* options);
bool sass_option_get_is_indented_syntax_src (struct Sass_Options* options);
const char* sass_option_get_indent (struct Sass_Options* options);
const char* sass_option_get_linefeed (struct Sass_Options* options);
const char* sass_option_get_input_path (struct Sass_Options* options);
const char* sass_option_get_output_path (struct Sass_Options* options);
const char* sass_option_get_source_map_file (struct Sass_Options* options);
const char* sass_option_get_source_map_root (struct Sass_Options* options);
Sass_C_Function_List sass_option_get_c_functions (struct Sass_Options* options);
Sass_C_Import_Callback sass_option_get_importer (struct Sass_Options* options);
// Getters for Context_Option include path array
size_t sass_option_get_include_path_size(struct Sass_Options* options);
const char* sass_option_get_include_path(struct Sass_Options* options, size_t i);
// Plugin paths to load dynamic libraries work the same
size_t sass_option_get_plugin_path_size(struct Sass_Options* options);
const char* sass_option_get_plugin_path(struct Sass_Options* options, size_t i);
// Setters for Context_Option values
void sass_option_set_precision (struct Sass_Options* options, int precision);
void sass_option_set_output_style (struct Sass_Options* options, enum Sass_Output_Style output_style);
void sass_option_set_source_comments (struct Sass_Options* options, bool source_comments);
void sass_option_set_source_map_embed (struct Sass_Options* options, bool source_map_embed);
void sass_option_set_source_map_contents (struct Sass_Options* options, bool source_map_contents);
void sass_option_set_source_map_file_urls (struct Sass_Options* options, bool source_map_file_urls);
void sass_option_set_omit_source_map_url (struct Sass_Options* options, bool omit_source_map_url);
void sass_option_set_is_indented_syntax_src (struct Sass_Options* options, bool is_indented_syntax_src);
void sass_option_set_indent (struct Sass_Options* options, const char* indent);
void sass_option_set_linefeed (struct Sass_Options* options, const char* linefeed);
void sass_option_set_input_path (struct Sass_Options* options, const char* input_path);
void sass_option_set_output_path (struct Sass_Options* options, const char* output_path);
void sass_option_set_plugin_path (struct Sass_Options* options, const char* plugin_path);
void sass_option_set_include_path (struct Sass_Options* options, const char* include_path);
void sass_option_set_source_map_file (struct Sass_Options* options, const char* source_map_file);
void sass_option_set_source_map_root (struct Sass_Options* options, const char* source_map_root);
void sass_option_set_c_functions (struct Sass_Options* options, Sass_C_Function_List c_functions);
void sass_option_set_importer (struct Sass_Options* options, Sass_C_Import_Callback importer);
// Push function for paths (no manipulation support for now)
void sass_option_push_plugin_path (struct Sass_Options* options, const char* path);
void sass_option_push_include_path (struct Sass_Options* options, const char* path);
// Resolve a file via the given include paths in the sass option struct
// find_file looks for the exact file name while find_include does a regular sass include
char* sass_find_file (const char* path, struct Sass_Options* opt);
char* sass_find_include (const char* path, struct Sass_Options* opt);
// Resolve a file relative to last import or include paths in the sass option struct
// find_file looks for the exact file name while find_include does a regular sass include
char* sass_compiler_find_file (const char* path, struct Sass_Compiler* compiler);
char* sass_compiler_find_include (const char* path, struct Sass_Compiler* compiler);
```
### More links
- [Sass Context Example](api-context-example.md)
- [Sass Context Internal](api-context-internal.md)

215
node_modules/node-sass/src/libsass/docs/api-doc.md generated vendored Normal file
View File

@@ -0,0 +1,215 @@
## Introduction
LibSass wouldn't be much good without a way to interface with it. These
interface documentations describe the various functions and data structures
available to implementers. They are split up over three major components, which
have all their own source files (plus some common functionality).
- [Sass Context](api-context.md) - Trigger and handle the main Sass compilation
- [Sass Value](api-value.md) - Exchange values and its format with LibSass
- [Sass Function](api-function.md) - Get invoked by LibSass for function statments
- [Sass Importer](api-importer.md) - Get invoked by LibSass for @import statments
### Basic usage
First you will need to include the header file!
This will automatically load all other headers too!
```C
#include "sass/context.h"
```
## Basic C Example
```C
#include <stdio.h>
#include "sass/context.h"
int main() {
puts(libsass_version());
return 0;
}
```
```bash
gcc -Wall version.c -lsass -o version && ./version
```
## More C Examples
- [Sample code for Sass Context](api-context-example.md)
- [Sample code for Sass Value](api-value-example.md)
- [Sample code for Sass Function](api-function-example.md)
- [Sample code for Sass Importer](api-importer-example.md)
## Compiling your code
The most important is your sass file (or string of sass code). With this, you
will want to start a LibSass compiler. Here is some pseudocode describing the
process. The compiler has two different modes: direct input as a string with
`Sass_Data_Context` or LibSass will do file reading for you by using
`Sass_File_Context`. See the code for a list of options available
[Sass_Options](https://github.com/sass/libsass/blob/36feef0/include/sass/interface.h#L18)
**Building a file compiler**
context = sass_make_file_context("file.scss")
options = sass_file_context_get_options(context)
sass_option_set_precision(options, 1)
sass_option_set_source_comments(options, true)
sass_file_context_set_options(context, options)
compiler = sass_make_file_compiler(sass_context)
sass_compiler_parse(compiler)
sass_compiler_execute(compiler)
output = sass_context_get_output_string(context)
// Retrieve errors during compilation
error_status = sass_context_get_error_status(context)
json_error = sass_context_get_error_json(context)
// Release memory dedicated to the C compiler
sass_delete_compiler(compiler)
**Building a data compiler**
context = sass_make_data_context("div { a { color: blue; } }")
options = sass_data_context_get_options(context)
sass_option_set_precision(options, 1)
sass_option_set_source_comments(options, true)
sass_data_context_set_options(context, options)
compiler = sass_make_data_compiler(context)
sass_compiler_parse(compiler)
sass_compiler_execute(compiler)
output = sass_context_get_output_string(context)
// div a { color: blue; }
// Retrieve errors during compilation
error_status = sass_context_get_error_status(context)
json_error = sass_context_get_error_json(context)
// Release memory dedicated to the C compiler
sass_delete_compiler(compiler)
## Sass Context Internals
Everything is stored in structs:
```C
struct Sass_Options;
struct Sass_Context : Sass_Options;
struct Sass_File_context : Sass_Context;
struct Sass_Data_context : Sass_Context;
```
This mirrors very well how `libsass` uses these structures.
- `Sass_Options` holds everything you feed in before the compilation. It also hosts
`input_path` and `output_path` options, because they are used to generate/calculate
relative links in source-maps. The `input_path` is shared with `Sass_File_Context`.
- `Sass_Context` holds all the data returned by the compilation step.
- `Sass_File_Context` is a specific implementation that requires no additional fields
- `Sass_Data_Context` is a specific implementation that adds the `input_source` field
Structs can be down-casted to access `context` or `options`!
## Memory handling and life-cycles
We keep memory around for as long as the main [context](api-context.md) object
is not destroyed (`sass_delete_context`). LibSass will create copies of most
inputs/options beside the main sass code. You need to allocate and fill that
buffer before passing it to LibSass. You may also overtake memory management
from libsass for certain return values (i.e. `sass_context_take_output_string`).
```C
// to allocate buffer to be filled
void* sass_alloc_memory(size_t size);
// to allocate a buffer from existing string
char* sass_copy_c_string(const char* str);
// to free overtaken memory when done
void sass_free_memory(void* ptr);
```
## Miscellaneous API functions
```C
// Some convenient string helper function
char* sass_string_unquote (const char* str);
char* sass_string_quote (const char* str, const char quote_mark);
// Get compiled libsass version
const char* libsass_version(void);
// Implemented sass language version
// Hardcoded version 3.4 for time being
const char* libsass_language_version(void);
```
## Common Pitfalls
**input_path**
The `input_path` is part of `Sass_Options`, but it also is the main option for
`Sass_File_Context`. It is also used to generate relative file links in source-
maps. Therefore it is pretty usefull to pass this information if you have a
`Sass_Data_Context` and know the original path.
**output_path**
Be aware that `libsass` does not write the output file itself. This option
merely exists to give `libsass` the proper information to generate links in
source-maps. The file has to be written to the disk by the
binding/implementation. If the `output_path` is omitted, `libsass` tries to
extrapolate one from the `input_path` by replacing (or adding) the file ending
with `.css`.
## Error Codes
The `error_code` is integer value which indicates the type of error that
occurred inside the LibSass process. Following is the list of error codes along
with the short description:
* 1: normal errors like parsing or `eval` errors
* 2: bad allocation error (memory error)
* 3: "untranslated" C++ exception (`throw std::exception`)
* 4: legacy string exceptions ( `throw const char*` or `std::string` )
* 5: Some other unknown exception
Although for the API consumer, error codes do not offer much value except
indicating whether *any* error occurred during the compilation, it helps
debugging the LibSass internal code paths.
## Real-World Implementations
The proof is in the pudding, so we have highlighted a few implementations that
should be on par with the latest LibSass interface version. Some of them may not
have all features implemented!
1. [Perl Example](https://github.com/sass/perl-libsass/blob/master/lib/CSS/Sass.xs)
2. [Go Example](https://godoc.org/github.com/wellington/go-libsass#example-Compiler--Stdin)
3. [Node Example](https://github.com/sass/node-sass/blob/master/src/binding.cpp)
## ABI forward compatibility
We use a functional API to make dynamic linking more robust and future
compatible. The API is not yet 100% stable, so we do not yet guarantee
[ABI](https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html) forward
compatibility.
## Plugins (experimental)
LibSass can load plugins from directories. Just define `plugin_path` on context
options to load all plugins from the directories. To implement plugins, please
consult the following example implementations.
- https://github.com/mgreter/libsass-glob
- https://github.com/mgreter/libsass-math
- https://github.com/mgreter/libsass-digest
## Internal Structs
- [Sass Context Internals](api-context-internal.md)
- [Sass Value Internals](api-value-internal.md)
- [Sass Function Internals](api-function-internal.md)
- [Sass Importer Internals](api-importer-internal.md)

View File

@@ -0,0 +1,67 @@
## Example main.c
```C
#include <stdio.h>
#include <stdint.h>
#include "sass/context.h"
union Sass_Value* call_fn_foo(const union Sass_Value* s_args, Sass_Function_Entry cb, struct Sass_Compiler* comp)
{
// get context/option struct associated with this compiler
struct Sass_Context* ctx = sass_compiler_get_context(comp);
struct Sass_Options* opts = sass_compiler_get_options(comp);
// get information about previous importer entry from the stack
Sass_Import_Entry import = sass_compiler_get_last_import(comp);
const char* prev_abs_path = sass_import_get_abs_path(import);
const char* prev_imp_path = sass_import_get_imp_path(import);
// get the cookie from function descriptor
void* cookie = sass_function_get_cookie(cb);
// we actually abuse the void* to store an "int"
return sass_make_number((intptr_t)cookie, "px");
}
int main( int argc, const char* argv[] )
{
// get the input file from first argument or use default
const char* input = argc > 1 ? argv[1] : "styles.scss";
// create the file context and get all related structs
struct Sass_File_Context* file_ctx = sass_make_file_context(input);
struct Sass_Context* ctx = sass_file_context_get_context(file_ctx);
struct Sass_Options* ctx_opt = sass_context_get_options(ctx);
// allocate a custom function caller
Sass_Function_Entry fn_foo =
sass_make_function("foo()", call_fn_foo, (void*)42);
// create list of all custom functions
Sass_Function_List fn_list = sass_make_function_list(1);
sass_function_set_list_entry(fn_list, 0, fn_foo);
sass_option_set_c_functions(ctx_opt, fn_list);
// context is set up, call the compile step now
int status = sass_compile_file_context(file_ctx);
// print the result or the error to the stdout
if (status == 0) puts(sass_context_get_output_string(ctx));
else puts(sass_context_get_error_message(ctx));
// release allocated memory
sass_delete_file_context(file_ctx);
// exit status
return status;
}
```
### Compile main.c
```bash
gcc -c main.c -o main.o
gcc -o sample main.o -lsass
echo "foo { margin: foo(); }" > foo.scss
./sample foo.scss => "foo { margin: 42px }"
```

View File

@@ -0,0 +1,8 @@
```C
// Struct to hold custom function callback
struct Sass_Function {
const char* signature;
Sass_Function_Fn function;
void* cookie;
};
```

View File

@@ -0,0 +1,74 @@
Sass functions are used to define new custom functions callable by Sass code. They are also used to overload debug or error statements. You can also define a fallback function, which is called for every unknown function found in the Sass code. Functions get passed zero or more `Sass_Values` (a `Sass_List` value) and they must also return a `Sass_Value`. Return a `Sass_Error` if you want to signal an error.
## Special signatures
- `*` - Fallback implementation
- `@warn` - Overload warn statements
- `@error` - Overload error statements
- `@debug` - Overload debug statements
Note: The fallback implementation will be given the name of the called function as the first argument, before all the original function arguments. These features are pretty new and should be considered experimental.
### Basic Usage
```C
#include "sass/functions.h"
```
## Sass Function API
```C
// Forward declaration
struct Sass_Compiler;
struct Sass_Function;
// Typedef helpers for custom functions lists
typedef struct Sass_Function (*Sass_Function_Entry);
typedef struct Sass_Function* (*Sass_Function_List);
// Typedef defining function signature and return type
typedef union Sass_Value* (*Sass_Function_Fn)
(const union Sass_Value*, Sass_Function_Entry cb, struct Sass_Compiler* compiler);
// Creators for sass function list and function descriptors
Sass_Function_List sass_make_function_list (size_t length);
Sass_Function_Entry sass_make_function (const char* signature, Sass_Function_Fn cb, void* cookie);
// In case you need to free them yourself
void sass_delete_function (Sass_Function_Entry entry);
void sass_delete_function_list (Sass_Function_List list);
// Setters and getters for callbacks on function lists
Sass_Function_Entry sass_function_get_list_entry(Sass_Function_List list, size_t pos);
void sass_function_set_list_entry(Sass_Function_List list, size_t pos, Sass_Function_Entry cb);
// Setters to insert an entry into the import list (you may also use [] access directly)
// Since we are dealing with pointers they should have a guaranteed and fixed size
void sass_import_set_list_entry (Sass_Import_List list, size_t idx, Sass_Import_Entry entry);
Sass_Import_Entry sass_import_get_list_entry (Sass_Import_List list, size_t idx);
// Getters for custom function descriptors
const char* sass_function_get_signature (Sass_Function_Entry cb);
Sass_Function_Fn sass_function_get_function (Sass_Function_Entry cb);
void* sass_function_get_cookie (Sass_Function_Entry cb);
// Getters for callee entry
const char* sass_callee_get_name (Sass_Callee_Entry);
const char* sass_callee_get_path (Sass_Callee_Entry);
size_t sass_callee_get_line (Sass_Callee_Entry);
size_t sass_callee_get_column (Sass_Callee_Entry);
enum Sass_Callee_Type sass_callee_get_type (Sass_Callee_Entry);
Sass_Env_Frame sass_callee_get_env (Sass_Callee_Entry);
// Getters and Setters for environments (lexical, local and global)
union Sass_Value* sass_env_get_lexical (Sass_Env_Frame, const char*);
void sass_env_set_lexical (Sass_Env_Frame, const char*, union Sass_Value*);
union Sass_Value* sass_env_get_local (Sass_Env_Frame, const char*);
void sass_env_set_local (Sass_Env_Frame, const char*, union Sass_Value*);
union Sass_Value* sass_env_get_global (Sass_Env_Frame, const char*);
void sass_env_set_global (Sass_Env_Frame, const char*, union Sass_Value*);
```
### More links
- [Sass Function Example](api-function-example.md)
- [Sass Function Internal](api-function-internal.md)

View File

@@ -0,0 +1,112 @@
## Example importer.c
```C
#include <stdio.h>
#include <string.h>
#include "sass/context.h"
Sass_Import_List sass_importer(const char* path, Sass_Importer_Entry cb, struct Sass_Compiler* comp)
{
// get the cookie from importer descriptor
void* cookie = sass_importer_get_cookie(cb);
Sass_Import_List list = sass_make_import_list(2);
char* local = sass_copy_c_string("local { color: green; }");
char* remote = sass_copy_c_string("remote { color: red; }");
list[0] = sass_make_import_entry("/tmp/styles.scss", local, 0);
list[1] = sass_make_import_entry("http://www.example.com", remote, 0);
return list;
}
int main( int argc, const char* argv[] )
{
// get the input file from first argument or use default
const char* input = argc > 1 ? argv[1] : "styles.scss";
// create the file context and get all related structs
struct Sass_File_Context* file_ctx = sass_make_file_context(input);
struct Sass_Context* ctx = sass_file_context_get_context(file_ctx);
struct Sass_Options* ctx_opt = sass_context_get_options(ctx);
// allocate custom importer
Sass_Importer_Entry c_imp =
sass_make_importer(sass_importer, 0, 0);
// create list for all custom importers
Sass_Importer_List imp_list = sass_make_importer_list(1);
// put only the importer on to the list
sass_importer_set_list_entry(imp_list, 0, c_imp);
// register list on to the context options
sass_option_set_c_importers(ctx_opt, imp_list);
// context is set up, call the compile step now
int status = sass_compile_file_context(file_ctx);
// print the result or the error to the stdout
if (status == 0) puts(sass_context_get_output_string(ctx));
else puts(sass_context_get_error_message(ctx));
// release allocated memory
sass_delete_file_context(file_ctx);
// exit status
return status;
}
```
Compile importer.c
```bash
gcc -c importer.c -o importer.o
gcc -o importer importer.o -lsass
echo "@import 'foobar';" > importer.scss
./importer importer.scss
```
## Importer Behavior Examples
```C
Sass_Import_List importer(const char* path, Sass_Importer_Entry cb, struct Sass_Compiler* comp) {
// let LibSass handle the import request
return NULL;
}
Sass_Import_List importer(const char* path, Sass_Importer_Entry cb, struct Sass_Compiler* comp) {
// let LibSass handle the request
// swallows »@import "http://…"« pass-through
// (arguably a bug)
Sass_Import_List list = sass_make_import_list(1);
list[0] = sass_make_import_entry(path, 0, 0);
return list;
}
Sass_Import_List importer(const char* path, Sass_Importer_Entry cb, struct Sass_Compiler* comp) {
// return an error to halt execution
Sass_Import_List list = sass_make_import_list(1);
const char* message = "some error message";
list[0] = sass_make_import_entry(path, 0, 0);
sass_import_set_error(list[0], sass_copy_c_string(message), 0, 0);
return list;
}
Sass_Import_List importer(const char* path, Sass_Importer_Entry cb, struct Sass_Compiler* comp) {
// let LibSass load the file identifed by the importer
Sass_Import_List list = sass_make_import_list(1);
list[0] = sass_make_import_entry("/tmp/file.scss", 0, 0);
return list;
}
Sass_Import_List importer(const char* path, Sass_Importer_Entry cb, struct Sass_Compiler* comp) {
// completely hide the import
// (arguably a bug)
Sass_Import_List list = sass_make_import_list(0);
return list;
}
Sass_Import_List importer(const char* path, Sass_Importer_Entry cb, struct Sass_Compiler* comp) {
// completely hide the import
// (arguably a bug)
Sass_Import_List list = sass_make_import_list(1);
list[0] = sass_make_import_entry(0, 0, 0);
return list;
}
```

View File

@@ -0,0 +1,20 @@
```C
// External import entry
struct Sass_Import {
char* imp_path; // path as found in the import statement
char *abs_path; // path after importer has resolved it
char* source;
char* srcmap;
// error handling
char* error;
size_t line;
size_t column;
};
// Struct to hold importer callback
struct Sass_Importer {
Sass_Importer_Fn importer;
double priority;
void* cookie;
};
```

View File

@@ -0,0 +1,86 @@
By using custom importers, Sass stylesheets can be implemented in any possible way, such as by being loaded via a remote server. Please note: this feature is experimental and is implemented differently than importers in Ruby Sass. Imports must be relative to the parent import context and therefore we need to pass this information to the importer callback. This is currently done by passing the complete import string/path of the previous import context.
## Return Imports
You actually have to return a list of imports, since some importers may want to import multiple files from one import statement (ie. a glob/star importer). The memory you pass with source and srcmap is taken over by LibSass and freed automatically when the import is done. You are also allowed to return `0` instead of a list, which will tell LibSass to handle the import by itself (as if no custom importer was in use).
```C
Sass_Import_Entry* rv = sass_make_import_list(1);
rv[0] = sass_make_import(rel, abs, source, srcmap);
```
Every import will then be included in LibSass. You are allowed to only return a file path without any loaded source. This way you can ie. implement rewrite rules for import paths and leave the loading part for LibSass.
Please note that LibSass doesn't use the srcmap parameter yet. It has been added to not deprecate the C-API once support has been implemented. It will be used to re-map the actual sourcemap with the provided ones.
### Basic Usage
```C
#include "sass/functions.h"
```
## Sass Importer API
```C
// Forward declaration
struct Sass_Import;
// Forward declaration
struct Sass_C_Import_Descriptor;
// Typedef defining the custom importer callback
typedef struct Sass_C_Import_Descriptor (*Sass_C_Import_Callback);
// Typedef defining the importer c function prototype
typedef Sass_Import_Entry* (*Sass_C_Import_Fn) (const char* url, const char* prev, void* cookie);
// Creators for custom importer callback (with some additional pointer)
// The pointer is mostly used to store the callback into the actual function
Sass_C_Import_Callback sass_make_importer (Sass_C_Import_Fn, void* cookie);
// Getters for import function descriptors
Sass_C_Import_Fn sass_import_get_function (Sass_C_Import_Callback fn);
void* sass_import_get_cookie (Sass_C_Import_Callback fn);
// Deallocator for associated memory
void sass_delete_importer (Sass_C_Import_Callback fn);
// Creator for sass custom importer return argument list
Sass_Import_Entry* sass_make_import_list (size_t length);
// Creator for a single import entry returned by the custom importer inside the list
Sass_Import_Entry sass_make_import_entry (const char* path, char* source, char* srcmap);
Sass_Import_Entry sass_make_import (const char* rel, const char* abs, char* source, char* srcmap);
// set error message to abort import and to print out a message (path from existing object is used in output)
Sass_Import_Entry sass_import_set_error(Sass_Import_Entry import, const char* message, size_t line, size_t col);
// Setters to insert an entry into the import list (you may also use [] access directly)
// Since we are dealing with pointers they should have a guaranteed and fixed size
void sass_import_set_list_entry (Sass_Import_Entry* list, size_t idx, Sass_Import_Entry entry);
Sass_Import_Entry sass_import_get_list_entry (Sass_Import_Entry* list, size_t idx);
// Getters for import entry
const char* sass_import_get_imp_path (Sass_Import_Entry);
const char* sass_import_get_abs_path (Sass_Import_Entry);
const char* sass_import_get_source (Sass_Import_Entry);
const char* sass_import_get_srcmap (Sass_Import_Entry);
// Explicit functions to take ownership of these items
// The property on our struct will be reset to NULL
char* sass_import_take_source (Sass_Import_Entry);
char* sass_import_take_srcmap (Sass_Import_Entry);
// Getters for import error entries
size_t sass_import_get_error_line (Sass_Import_Entry);
size_t sass_import_get_error_column (Sass_Import_Entry);
const char* sass_import_get_error_message (Sass_Import_Entry);
// Deallocator for associated memory (incl. entries)
void sass_delete_import_list (Sass_Import_Entry*);
// Just in case we have some stray import structs
void sass_delete_import (Sass_Import_Entry);
```
### More links
- [Sass Importer Example](api-importer-example.md)
- [Sass Importer Internal](api-importer-internal.md)

View File

@@ -0,0 +1,55 @@
## Example operation.c
```C
#include <stdio.h>
#include <string.h>
#include "sass/values.h"
int main( int argc, const char* argv[] )
{
// create two new sass values to be added
union Sass_Value* string = sass_make_string("String");
union Sass_Value* number = sass_make_number(42, "nits");
// invoke the add operation which returns a new sass value
union Sass_Value* total = sass_value_op(ADD, string, number);
// no further use for the two operands
sass_delete_value(string);
sass_delete_value(number);
// this works since libsass will always return a
// string for add operations with a string as the
// left hand side. But you should never rely on it!
puts(sass_string_get_value(total));
// invoke stringification (uncompressed with precision of 5)
union Sass_Value* result = sass_value_stringify(total, false, 5);
// no further use for the sum
sass_delete_value(total);
// print the result - you may want to make
// sure result is indeed a string, altough
// stringify guarantees to return a string
// if (sass_value_is_string(result)) {}
// really depends on your level of paranoia
puts(sass_string_get_value(result));
// finally free result
sass_delete_value(result);
// exit status
return 0;
}
```
## Compile operation.c
```bash
gcc -c operation.c -o operation.o
gcc -o operation operation.o -lsass
./operation # => String42nits
```

View File

@@ -0,0 +1,76 @@
```C
struct Sass_Unknown {
enum Sass_Tag tag;
};
struct Sass_Boolean {
enum Sass_Tag tag;
bool value;
};
struct Sass_Number {
enum Sass_Tag tag;
double value;
char* unit;
};
struct Sass_Color {
enum Sass_Tag tag;
double r;
double g;
double b;
double a;
};
struct Sass_String {
enum Sass_Tag tag;
char* value;
};
struct Sass_List {
enum Sass_Tag tag;
enum Sass_Separator separator;
size_t length;
// null terminated "array"
union Sass_Value** values;
};
struct Sass_Map {
enum Sass_Tag tag;
size_t length;
struct Sass_MapPair* pairs;
};
struct Sass_Null {
enum Sass_Tag tag;
};
struct Sass_Error {
enum Sass_Tag tag;
char* message;
};
struct Sass_Warning {
enum Sass_Tag tag;
char* message;
};
union Sass_Value {
struct Sass_Unknown unknown;
struct Sass_Boolean boolean;
struct Sass_Number number;
struct Sass_Color color;
struct Sass_String string;
struct Sass_List list;
struct Sass_Map map;
struct Sass_Null null;
struct Sass_Error error;
struct Sass_Warning warning;
};
struct Sass_MapPair {
union Sass_Value* key;
union Sass_Value* value;
};
```

154
node_modules/node-sass/src/libsass/docs/api-value.md generated vendored Normal file
View File

@@ -0,0 +1,154 @@
`Sass_Values` are used to pass values and their types between the implementer
and LibSass. Sass knows various different value types (including nested arrays
and hash-maps). If you implement a binding to another programming language, you
have to find a way to [marshal][1] (convert) `Sass_Values` between the target
language and C. `Sass_Values` are currently only used by custom functions, but
it should also be possible to use them without a compiler context.
[1]: https://en.wikipedia.org/wiki/Marshalling_%28computer_science%29
### Basic Usage
```C
#include "sass/values.h"
```
```C
// Type for Sass values
enum Sass_Tag {
SASS_BOOLEAN,
SASS_NUMBER,
SASS_COLOR,
SASS_STRING,
SASS_LIST,
SASS_MAP,
SASS_NULL,
SASS_ERROR,
SASS_WARNING
};
// Tags for denoting Sass list separators
enum Sass_Separator {
SASS_COMMA,
SASS_SPACE,
// only used internally to represent a hash map before evaluation
// otherwise we would be too early to check for duplicate keys
SASS_HASH
};
// Value Operators
enum Sass_OP {
AND, OR, // logical connectives
EQ, NEQ, GT, GTE, LT, LTE, // arithmetic relations
ADD, SUB, MUL, DIV, MOD, // arithmetic functions
NUM_OPS // so we know how big to make the op table
};
```
### Sass Value API
```C
// Forward declaration
union Sass_Value;
// Creator functions for all value types
union Sass_Value* sass_make_null (void);
union Sass_Value* sass_make_boolean (bool val);
union Sass_Value* sass_make_string (const char* val);
union Sass_Value* sass_make_qstring (const char* val);
union Sass_Value* sass_make_number (double val, const char* unit);
union Sass_Value* sass_make_color (double r, double g, double b, double a);
union Sass_Value* sass_make_list (size_t len, enum Sass_Separator sep, bool is_bracketed);
union Sass_Value* sass_make_map (size_t len);
union Sass_Value* sass_make_error (const char* msg);
union Sass_Value* sass_make_warning (const char* msg);
// Generic destructor function for all types
// Will release memory of all associated Sass_Values
// Means we will delete recursively for lists and maps
void sass_delete_value (union Sass_Value* val);
// Make a deep cloned copy of the given sass value
union Sass_Value* sass_clone_value (const union Sass_Value* val);
// Stringify a Sass_Values and also return the result as a Sass_Value (of type STRING)
union Sass_Value* sass_value_stringify (const union Sass_Value* a, bool compressed, int precision);
// Execute an operation for two Sass_Values and return the result as a Sass_Value too
union Sass_Value* sass_value_op (enum Sass_OP op, const union Sass_Value* a, const union Sass_Value* b);
// Return the sass tag for a generic sass value
// Check is needed before accessing specific values!
enum Sass_Tag sass_value_get_tag (const union Sass_Value* v);
// Check value to be of a specific type
// Can also be used before accessing properties!
bool sass_value_is_null (const union Sass_Value* v);
bool sass_value_is_number (const union Sass_Value* v);
bool sass_value_is_string (const union Sass_Value* v);
bool sass_value_is_boolean (const union Sass_Value* v);
bool sass_value_is_color (const union Sass_Value* v);
bool sass_value_is_list (const union Sass_Value* v);
bool sass_value_is_map (const union Sass_Value* v);
bool sass_value_is_error (const union Sass_Value* v);
bool sass_value_is_warning (const union Sass_Value* v);
// Getters and setters for Sass_Number
double sass_number_get_value (const union Sass_Value* v);
void sass_number_set_value (union Sass_Value* v, double value);
const char* sass_number_get_unit (const union Sass_Value* v);
void sass_number_set_unit (union Sass_Value* v, char* unit);
// Getters and setters for Sass_String
const char* sass_string_get_value (const union Sass_Value* v);
void sass_string_set_value (union Sass_Value* v, char* value);
bool sass_string_is_quoted(const union Sass_Value* v);
void sass_string_set_quoted(union Sass_Value* v, bool quoted);
// Getters and setters for Sass_Boolean
bool sass_boolean_get_value (const union Sass_Value* v);
void sass_boolean_set_value (union Sass_Value* v, bool value);
// Getters and setters for Sass_Color
double sass_color_get_r (const union Sass_Value* v);
void sass_color_set_r (union Sass_Value* v, double r);
double sass_color_get_g (const union Sass_Value* v);
void sass_color_set_g (union Sass_Value* v, double g);
double sass_color_get_b (const union Sass_Value* v);
void sass_color_set_b (union Sass_Value* v, double b);
double sass_color_get_a (const union Sass_Value* v);
void sass_color_set_a (union Sass_Value* v, double a);
// Getter for the number of items in list
size_t sass_list_get_length (const union Sass_Value* v);
// Getters and setters for Sass_List
enum Sass_Separator sass_list_get_separator (const union Sass_Value* v);
void sass_list_set_separator (union Sass_Value* v, enum Sass_Separator value);
bool sass_list_get_is_bracketed (const union Sass_Value* v);
void sass_list_set_is_bracketed (union Sass_Value* v, bool value);
// Getters and setters for Sass_List values
union Sass_Value* sass_list_get_value (const union Sass_Value* v, size_t i);
void sass_list_set_value (union Sass_Value* v, size_t i, union Sass_Value* value);
// Getter for the number of items in map
size_t sass_map_get_length (const union Sass_Value* v);
// Getters and setters for Sass_Map keys and values
union Sass_Value* sass_map_get_key (const union Sass_Value* v, size_t i);
void sass_map_set_key (union Sass_Value* v, size_t i, union Sass_Value*);
union Sass_Value* sass_map_get_value (const union Sass_Value* v, size_t i);
void sass_map_set_value (union Sass_Value* v, size_t i, union Sass_Value*);
// Getters and setters for Sass_Error
char* sass_error_get_message (const union Sass_Value* v);
void sass_error_set_message (union Sass_Value* v, char* msg);
// Getters and setters for Sass_Warning
char* sass_warning_get_message (const union Sass_Value* v);
void sass_warning_set_message (union Sass_Value* v, char* msg);
```
### More links
- [Sass Value Example](api-value-example.md)
- [Sass Value Internal](api-value-internal.md)

View File

@@ -0,0 +1,27 @@
To install LibSass, make sure the OS X build tools are installed:
xcode-select --install
## Homebrew
To install homebrew, see [http://brew.sh](http://brew.sh)
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
You can install the latest version of LibSass quite easily with brew.
brew install --HEAD libsass
To update this, do:
brew reinstall --HEAD libsass
Brew will build static and shared libraries, and a `libsass.pc` file in `/usr/local/lib/pkgconfig`.
To use `libsass.pc`, make sure this path is in your `PKG_CONFIG_PATH`
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
## Manually
See the linux instructions [Building-with-autotools](build-with-autotools.md) or [Building-with-makefiles](build-with-makefiles.md)

View File

@@ -0,0 +1,55 @@
Here are two ebuilds to compile LibSass and sassc on gentoo linux. If you do not know how to use these ebuilds, you should probably read the gentoo wiki page about [portage overlays](http://wiki.gentoo.org/wiki/Overlay).
## www-misc/libsass/libsass-9999.ebuild
```ebuild
EAPI=4
inherit eutils git-2 autotools
DESCRIPTION="A C/C++ implementation of a Sass compiler."
HOMEPAGE="http://libsass.org/"
EGIT_PROJECT='libsass'
EGIT_REPO_URI="https://github.com/sass/libsass.git"
LICENSE="MIT"
SLOT="0"
KEYWORDS=""
IUSE=""
DEPEND=""
RDEPEND="${DEPEND}"
DEPEND="${DEPEND}"
pkg_pretend() {
# older gcc is not supported
local major=$(gcc-major-version)
local minor=$(gcc-minor-version)
[[ "${MERGE_TYPE}" != "binary" && ( $major > 4 || ( $major == 4 && $minor &lt; 5 ) ) ]] && \
die "Sorry, but gcc earlier than 4.5 will not work for LibSass."
}
src_prepare() {
eautoreconf
}
```
## www-misc/sassc/sassc-9999.ebuild
```ebuild
EAPI=4
inherit eutils git-2 autotools
DESCRIPTION="Command Line Tool for LibSass."
HOMEPAGE="http://libsass.org/"
EGIT_PROJECT='sassc'
EGIT_REPO_URI="https://github.com/sass/sassc.git"
LICENSE="MIT"
SLOT="0"
KEYWORDS=""
IUSE=""
DEPEND="www-misc/libsass"
RDEPEND="${DEPEND}"
DEPEND="${DEPEND}"
src_prepare() {
eautoreconf
}
```

View File

@@ -0,0 +1,139 @@
We support builds via MingGW and via Visual Studio Community 2013.
Both should be considered experimental (MinGW was better tested)!
## Building via MingGW (makefiles)
First grab the latest [MinGW for windows][1] installer. Once it is installed, you can click on continue or open the Installation Manager via `bin\mingw-get.exe`.
You need to have the following components installed:
![Visualization of components installed in the interface](https://cloud.githubusercontent.com/assets/282293/5525466/947bf396-89e6-11e4-841d-4aa916f14de1.png)
Next we need to install [git for windows][2]. You probably want to check the option to add it to the global path, but you do not need to install the unix tools.
If you want to run the spec test-suite you also need [ruby][3] and a few gems available. Grab the [latest installer][3] and make sure to add it the global path. Then install the missing gems:
```bash
gem install minitest
```
### Mount the mingw root directory
As mentioned in the [MinGW Getting Started](http://www.mingw.org/wiki/Getting_Started#toc5) guide, you should edit `C:\MinGW\msys\1.0\etc\fstab` to contain the following line:
```
C:\MinGW /mingw
```
### Starting a "MingGW" console
Create a batch file with this content:
```bat
@echo off
set PATH=C:\MinGW\bin;%PATH%
REM only needed if not already available
set PATH=%PROGRAMFILES%\git\bin;%PATH%
REM C:\MinGW\msys\1.0\msys.bat
cmd
```
Execute it and make sure these commands can be called: `git`, `mingw32-make`, `rm` and `gcc`! Once this is all set, you should be ready to compile `libsass`!
### Get the sources
```bash
# using git is preferred
git clone https://github.com/sass/libsass.git
# only needed for sassc and/or testsuite
git clone https://github.com/sass/sassc.git libsass/sassc
git clone https://github.com/sass/sass-spec.git libsass/sass-spec
```
### Decide for static or shared library
`libsass` can be built and linked as a `static` or as a `shared` library. The default is `static`. To change it you can set the `BUILD` environment variable:
```bat
set BUILD="shared"
```
### Compile the library
```bash
mingw32-make -C libsass
```
### Results can be found in
```bash
$ ls libsass/lib
libsass.a libsass.dll libsass.so
```
### Run the spec test-suite
```bash
mingw32-make -C libsass test_build
```
## Building via MingGW 64bit (makefiles)
Building libass to dll on window 64bit.
+ downloads [MinGW64 for windows7 64bit](http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.9.2/threads-win32/seh/x86_64-4.9.2-release-win32-seh-rt_v3-rev0.7z/download) , and unzip to "C:\mingw64".
+ Create a batch file with this content:
```bat
@echo off
set PATH=C:\mingw64\bin;%PATH%
set CC=gcc
REM only needed if not already available
set PATH=%PROGRAMFILES%\Git\bin;%PATH%
REM C:\MinGW\msys\1.0\msys.bat
cmd
```
+ By default , mingw64 dll will depends on "mingwm10.dll libgcc_s_dw2-1.dll" , we can modify Makefile to fix this:(add "-static")
``` bash
lib/libsass.dll: $(COBJECTS) $(OBJECTS) $(RCOBJECTS)
$(MKDIR) lib
$(CXX) -shared $(LDFLAGS) -o $@ $(COBJECTS) $(OBJECTS) $(RCOBJECTS) $(LDLIBS) -s -static -Wl,--subsystem,windows,--out-implib,lib/libsass.a
```
+ Compile the library
```bash
mingw32-make -C libsass
```
By the way , if you are using java jna , [JNAerator](http://jnaerator.googlecode.com/) is a good tool.
## Building via Visual Studio Community 2013
Open a Visual Studio 2013 command prompt:
- `VS2013 x86 Native Tools Command Prompt`
Note: When I installed the community edition, I only got the 2012 command prompts. I copied them from the Startmenu to the Desktop and adjusted the paths from `Visual Studio 11.0` to `Visual Studio 12.0`. Since `libsass` uses some `C++11` features, you need at least a MSVC 2013 compiler (v120).
### Get the source
```bash
# using git is preferred
git clone https://github.com/sass/libsass.git
git clone https://github.com/sass/sassc.git libsass/sassc
# only needed if you want to run the testsuite
git clone https://github.com/sass/sass-spec.git libsass/sass-spec
```
### Compile sassc
Sometimes `msbuild` seems not available from the command prompt. Just search for it and add it to the global path. It seems to be included in the .net folders too.
```bat
cd libsass
REM set PATH=%PATH%;%PROGRAMFILES%\MSBuild\12.0\Bin
msbuild /m:4 /p:Configuration=Release win\libsass.sln
REM running the spec test-suite manually (needs ruby and minitest gem)
ruby sass-spec\sass-spec.rb -V 3.5 -c win\bin\sassc.exe -s --impl libsass sass-spec/spec
cd ..
```
[1]: http://sourceforge.net/projects/mingw/files/latest/download?source=files
[2]: https://msysgit.github.io/
[3]: http://rubyinstaller.org/

View File

@@ -0,0 +1,35 @@
This page is mostly intended for people that want to build a system library that gets distributed via RPMs or other means. This is currently in a experimental phase, as we currently do not really guarantee any ABI forward compatibility. The C API was rewritten to make this possible in the future, but we want to wait some more time till we can call this final and stable.
Building via autotools
--
You want to build a system library only via autotools, since it will create the proper `libtool` files to make it loadable on multiple systems. We hope this works correctly, but nobody of the `libsass` core team has much knowledge in this area. Therefore we are open for comments or improvements by people that have more experience in that matter (like package maintainers from various linux distributions).
```bash
apt-get install autoconf libtool
git clone https://github.com/sass/libsass.git
cd libsass
autoreconf --force --install
./configure \
--disable-tests \
--disable-static \
--enable-shared \
--prefix=/usr
make -j5 install
cd ..
```
This should install these files
```bash
# $ ls -la /usr/lib/libsass.*
/usr/lib/libsass.la
/usr/lib/libsass.so -> libsass.so.0.0.9
/usr/lib/libsass.so.0 -> libsass.so.0.0.9
/usr/lib/libsass.so.0.0.9
# $ ls -la /usr/include/sass*
/usr/include/sass.h
/usr/include/sass2scss.h
/usr/include/sass/context.h
/usr/include/sass/functions.h
/usr/include/sass/values.h
```

View File

@@ -0,0 +1,78 @@
### Get the sources
```bash
# using git is preferred
git clone https://github.com/sass/libsass.git
# only needed for sassc and/or testsuite
git clone https://github.com/sass/sassc.git libsass/sassc
git clone https://github.com/sass/sass-spec.git libsass/sass-spec
```
### Prerequisites
In order to run autotools you need a few tools installed on your system.
```bash
yum install automake libtool # RedHat Linux
emerge -a automake libtool # Gentoo Linux
pkgin install automake libtool # SmartOS
```
### Create configure script
```bash
cd libsass
autoreconf --force --install
cd ..
```
### Create custom makefiles
```bash
cd libsass
./configure \
--disable-tests \
--disable-shared \
--prefix=/usr
cd ..
```
### Build the library
```bash
make -C libsass -j5
```
### Install the library
The library will be installed to the location given as `prefix` to `configure`. This is standard behavior for autotools and not `libsass` specific.
```bash
make -C libsass -j5 install
```
### Configure options
The `configure` script is created by autotools. To get an overview of available options you can call `./configure --help`. When you execute this script, it will create specific makefiles, which you then use via the regular make command.
There are some `libsass` specific options:
```
Optional Features:
--enable-tests enable testing the build
--enable-coverage enable coverage report for test suite
--enable-shared build shared libraries [default=yes]
--enable-static build static libraries [default=yes]
Optional Packages:
--with-sassc-dir=<dir> specify directory of sassc sources for
testing (default: sassc)
--with-sass-spec-dir=<dir> specify directory of sass-spec for testing
(default: sass-spec)
```
### Build sassc and run spec test-suite
```bash
cd libsass
autoreconf --force --install
./configure \
--enable-tests \
--enable-shared \
--prefix=/usr
make -j5 test_build
cd ..
```

View File

@@ -0,0 +1,68 @@
### Get the sources
```bash
# using git is preferred
git clone https://github.com/sass/libsass.git
# only needed for sassc and/or testsuite
git clone https://github.com/sass/sassc.git libsass/sassc
git clone https://github.com/sass/sass-spec.git libsass/sass-spec
```
### Decide for static or shared library
`libsass` can be built and linked as a `static` or as a `shared` library. The default is `static`. To change it you can set the `BUILD` environment variable:
```bash
export BUILD="shared"
```
Alternatively you can also define it directly when calling make:
```bash
BUILD="shared" make ...
```
### Compile the library
```bash
make -C libsass -j5
```
### Results can be found in
```bash
$ ls libsass/lib
libsass.a libsass.so
```
### Install onto the system
We recommend to use [autotools to install](build-with-autotools.md) libsass onto the
system, since that brings all the benefits of using libtools as the main install method.
If you still want to install libsass via the makefile, you need to make sure that gnu
`install` utility (or compatible) is installed on your system.
```bash
yum install coreutils # RedHat Linux
emerge -a coreutils # Gentoo Linux
pkgin install coreutils # SmartOS
```
You can set the install location by setting `PREFIX`
```bash
PREFIX="/opt/local" make install
```
### Compling sassc
```bash
# Let build know library location
export SASS_LIBSASS_PATH="`pwd`/libsass"
# Invokes the sassc makefile
make -C libsass -j5 sassc
```
### Run the spec test-suite
```bash
# needs ruby available
# also gem install minitest
make -C libsass -j5 test_build
```

View File

@@ -0,0 +1,107 @@
## Building LibSass with MingGW (makefiles)
First grab the latest [MinGW for windows][1] installer. Once it is installed, you can click on continue or open the Installation Manager via `bin\mingw-get.exe`.
You need to have the following components installed:
![](https://cloud.githubusercontent.com/assets/282293/5525466/947bf396-89e6-11e4-841d-4aa916f14de1.png)
Next we need to install [git for windows][2]. You probably want to check the option to add it to the global path, but you do not need to install the unix tools.
If you want to run the spec test-suite you also need [ruby][3] and a few gems available. Grab the [latest installer][3] and make sure to add it the global path. Then install the missing gems:
```bash
gem install minitest
```
### Mount the mingw root directory
As mentioned in the [MinGW Getting Started](http://www.mingw.org/wiki/Getting_Started#toc5) guide, you should edit `C:\MinGW\msys\1.0\etc\fstab` to contain the following line:
```
C:\MinGW /mingw
```
### Starting a "MingGW" console
Create a batch file with this content:
```bat
@echo off
set PATH=C:\MinGW\bin;%PATH%
REM only needed if not already available
set PATH=%PROGRAMFILES%\git\bin;%PATH%
REM C:\MinGW\msys\1.0\msys.bat
cmd
```
Execute it and make sure these commands can be called: `git`, `mingw32-make`, `rm` and `gcc`! Once this is all set, you should be ready to compile `libsass`!
### Get the sources
```bash
# using git is preferred
git clone https://github.com/sass/libsass.git
# only needed for sassc and/or testsuite
git clone https://github.com/sass/sassc.git libsass/sassc
git clone https://github.com/sass/sass-spec.git libsass/sass-spec
```
### Decide for static or shared library
`libsass` can be built and linked as a `static` or as a `shared` library. The default is `static`. To change it you can set the `BUILD` environment variable:
```bat
set BUILD="shared"
```
### Compile the library
```bash
mingw32-make -C libsass
```
### Results can be found in
```bash
$ ls libsass/lib
libsass.a libsass.dll libsass.so
```
### Run the spec test-suite
```bash
mingw32-make -C libsass test_build
```
## Building via MingGW 64bit (makefiles)
Building libass to dll on window 64bit.
Download [MinGW64 for windows7 64bit](http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.9.2/threads-win32/seh/x86_64-4.9.2-release-win32-seh-rt_v3-rev0.7z/download) and unzip to "C:\mingw64".
Create a batch file with this content:
```bat
@echo off
set PATH=C:\mingw64\bin;%PATH%
set CC=gcc
REM only needed if not already available
set PATH=%PROGRAMFILES%\Git\bin;%PATH%
REM C:\MinGW\msys\1.0\msys.bat
cmd
```
By default, mingw64 dll will depends on "mingwm10.dll libgcc_s_dw2-1.dll", we can modify Makefile to fix this:(add "-static")
``` bash
lib/libsass.dll: $(COBJECTS) $(OBJECTS) $(RCOBJECTS)
$(MKDIR) lib
$(CXX) -shared $(LDFLAGS) -o $@ $(COBJECTS) $(OBJECTS) $(RCOBJECTS) $(LDLIBS) -s -static -Wl,--subsystem,windows,--out-implib,lib/libsass.a
```
Compile the library
```bash
mingw32-make -C libsass
```
By the way, if you are using java jna, [JNAerator](http://jnaerator.googlecode.com/) is a good tool.
[1]: http://sourceforge.net/projects/mingw/files/latest/download?source=files
[2]: https://msysgit.github.io/
[3]: http://rubyinstaller.org/

View File

@@ -0,0 +1,90 @@
## Building LibSass with Visual Studio
### Requirements:
The minimum requirement to build LibSass with Visual Studio is "Visual Studio 2013 Express for Desktop".
Additionally, it is recommended to have `git` installed and available in `PATH`, so to deduce the `libsass` version information. For instance, if GitHub for Windows (https://windows.github.com/) is installed, the `PATH` will have an entry resembling: `X:\Users\<YOUR_NAME>\AppData\Local\GitHub\PortableGit_<SOME_GUID>\cmd\` (where `X` is the drive letter of system drive). If `git` is not available, inquiring the LibSass version will result in `[NA]`.
### Build Steps:
#### From Visual Studio:
On opening the `win\libsass.sln` solution and build (Ctrl+Shift+B) to build `libsass.dll`.
To Build LibSass as a static Library, it is recommended to set an environment variable `LIBSASS_STATIC_LIB` before launching the project:
```cmd
cd path\to\libsass
SET LIBSASS_STATIC_LIB=1
::
:: or in PowerShell:
:: $env:LIBSASS_STATIC_LIB=1
::
win\libsass.sln
```
Visual Studio will form the filtered source tree as shown below:
![image](https://cloud.githubusercontent.com/assets/3840695/9298985/aae9e072-44bf-11e5-89eb-e7995c098085.png)
`Header Files` contains the .h and .hpp files, while `Source Files` covers `.c` and `.cpp`. The other used headers/sources will appear under `External Dependencies`.
If there is a LibSass code file appearing under External Dependencies, it can be changed by altering the `win\libsass.vcxproj.filters` file or dragging in Solution Explorer.
#### From Command Prompt:
Notice that in the following commands:
* If the platform is 32-bit Windows, replace `ProgramFiles(x86)` with `ProgramFiles`.
* To build with Visual Studio 2015, replace `12.0` with `14.0` in the aforementioned command.
Open a command prompt:
To build dynamic/shared library (`libsass.dll`):
```cmd
:: debug build:
"%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild" win\libsass.sln
:: release build:
"%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild" win\libsass.sln ^
/p:Configuration=Release
```
To build static library (`libsass.lib`):
```cmd
:: debug build:
"%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild" win\libsass.sln ^
/p:LIBSASS_STATIC_LIB=1
:: release build:
"%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild" win\libsass.sln ^
/p:LIBSASS_STATIC_LIB=1 /p:Configuration=Release
```
#### From PowerShell:
To build dynamic/shared library (`libsass.dll`):
```powershell
# debug build:
&"${env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild" win\libsass.sln
# release build:
&"${env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild" win\libsass.sln `
/p:Configuration=Release
```
To build static library (`libsass.lib`):
```powershell
# build:
&"${env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild" win\libsass.sln `
/p:LIBSASS_STATIC_LIB=1
# release build:
&"${env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild" win\libsass.sln `
/p:LIBSASS_STATIC_LIB=1 /p:Configuration=Release
```

97
node_modules/node-sass/src/libsass/docs/build.md generated vendored Normal file
View File

@@ -0,0 +1,97 @@
`libsass` is only a library and does not do much on its own. You need an implementation that you can use from the [command line][6]. Or some [bindings|Implementations][9] to use it within your favorite programming language. You should be able to get [`sassc`][6] running by following the instructions in this guide.
Before starting, see [setup dev environment](setup-environment.md).
Building on different Operating Systems
--
We try to keep the code as OS independent and standard compliant as possible. Reading files from the file-system has some OS depending code, but will ultimately fall back to a posix compatible implementation. We do use some `C++11` features, but are so far only committed to use `unordered_map`. This means you will need a pretty recent compiler on most systems (gcc 4.5 seems to be the minimum).
### Building on Linux (and other *nix flavors)
Linux is the main target for `libsass` and we support two ways to build `libsass` here. The old plain makefiles should still work on most systems (including MinGW), while the autotools build is preferred if you want to create a [system library] (experimental).
- [Building with makefiles][1]
- [Building with autotools][2]
### Building on Windows (experimental)
Windows build support was added very recently and should be considered experimental. Credits go to @darrenkopp and @am11 for their work on getting `libsass` and `sassc` to compile with visual studio!
- [Building with MinGW][3]
- [Building with Visual Studio][11]
### Building on Max OS X (untested)
Works the same as on linux, but you can also install LibSass via `homebrew`.
- [Building on Mac OS X][10]
### Building a system library (experimental)
Since `libsass` is a library, it makes sense to install it as a shared library on your system. On linux this means creating a `.so` library via autotools. This should work pretty well already, but we are not yet committed to keep the ABI 100% stable. This should be the case once we increase the version number for the library to 1.0.0 or higher. On Windows you should be able get a `dll` by creating a shared build with MinGW. There is currently no target in the MSVC project files to do this.
- [Building shared system library][4]
Compiling with clang instead of gcc
--
To use clang you just need to set the appropriate environment variables:
```bash
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
```
Running the spec test-suite
--
We constantly and automatically test `libsass` against the official [spec test-suite][5]. To do this we need to have a test-runner (which is written in ruby) and a command-line tool ([`sassc`][6]) to run the tests. Therefore we need to additionally compile `sassc`. To do this, the build files of all three projects need to work together. This may not have the same quality for all build flavors. You definitely need to have ruby (2.1?) installed (version 1.9 seems to cause problems at least on windows). You also need some gems installed:
```bash
ruby -v
gem install minitest
# should be optional
gem install minitap
```
Including the LibSass version
--
There is a function in `libsass` to query the current version. This has to be defined at compile time. We use a C macro for this, which can be defined by calling `g++ -DLIBSASS_VERSION="\"x.y.z.\""`. The two quotes are necessary, since it needs to end up as a valid C string. Normally you do not need to do anything if you use the makefiles or autotools. They will try to fetch the version via git directly. If you only have the sources without the git repo, you can pass the version as an environment variable to `make` or `configure`:
```
export LIBSASS_VERSION="x.y.z."
```
Continuous Integration
--
We use two CI services to automatically test all commits against the latest [spec test-suite][5].
- [LibSass on Travis-CI (linux)][7]
[![Build Status](https://travis-ci.org/sass/libsass.png?branch=master)](https://travis-ci.org/sass/libsass)
- [LibSass on AppVeyor (windows)][8]
[![Build status](https://ci.appveyor.com/api/projects/status/github/sass/libsass?svg=true)](https://ci.appveyor.com/project/mgreter/libsass-513/branch/master)
Why not using CMake?
--
There were some efforts to get `libsass` to compile with CMake, which should make it easier to create build files for linux and windows. Unfortunately this was not completed. But we are certainly open for PRs!
Miscellaneous
--
- [Ebuilds for Gentoo Linux](build-on-gentoo.md)
[1]: build-with-makefiles.md
[2]: build-with-autotools.md
[3]: build-with-mingw.md
[4]: build-shared-library.md
[5]: https://github.com/sass/sass-spec
[6]: https://github.com/sass/sassc
[7]: https://github.com/sass/libsass/blob/master/.travis.yml
[8]: https://github.com/sass/libsass/blob/master/appveyor.yml
[9]: implementations.md
[10]: build-on-darwin.md
[11]: build-with-visual-studio.md

View File

@@ -0,0 +1,48 @@
This document is to serve as a living, changing plan for getting LibSass caught up with Ruby Sass.
_Note: an "s" preceeding a version number is specifying a Ruby Sass version. Without an s, it's a version of LibSass._
# Goal
**Our goal is to reach full s3.4 compatibility as soon as possible. LibSass version 3.4 will behave just like Ruby Sass 3.4**
I highlight the goal, because there are some things that are *not* currently priorities. To be clear, they WILL be priorities, but they are not at the moment:
* Performance Improvements
* Extensibility
The overriding goal is correctness.
## Verifying Correctness
LibSass uses the spec for its testing. The spec was originally based off s3.2 tests. Many things have changed in Ruby Sass since then and some of the tests need to be updated and changed in order to get them to match both LibSass and Ruby Sass.
Until this project is complete, the spec will be primarily a place to test LibSass. By the time LibSass reaches 3.4, it is our goal that sass-spec will be fully usable as an official testing source for ALL implementations of Sass.
## Version Naming
Until LibSass reaches parity with Ruby Sass, we will be aggressively bumping versions, and LibSass 3.4 will be the peer to Ruby Sass 3.4 in every way.
# Release Plan
## 3.0
The goal of 3.0 is to introduce some of the most demanded features for LibSass. That is, we are focusing on issues and features that have kept adoption down. This is a mongrel release wrt which version of Sass it's targeting. It's often a mixture of 3.2 / 3.3 / 3.4 behaviours. This is not ideal, but it's favourable to not existing. Targeting 3.4 strictly during this release would mean we never actually release.
# 3.1
The goal of 3.1 is to update all the passing specs to agree with 3.4. This will not be a complete representation of s3.4 (aka, there will me missing features), but the goal is to change existing features and implemented features to match 3.4 behaviour.
By the end of this, the sass-spec must pass against 3.4.
Major issues:
* Variable Scoping
* Color Handling
* Precision
# 3.2
This version will focus on edge case fixes. There are a LOT of edge cases in the _todo_ tests and this is the release where we hunt those down like dogs (not that we want to hurt dogs, it's just a figure of speech in English).
# 3.3
Dress rehearsal. When we are 99% sure that we've fixed the main issues keeping us from saying we are compliant in s3.4 behaviour.
# 3.4
Compass Compatibility. We need to be able to work with Compass and all the other libraries out there. At this point, we are calling LibSass "mature"
# Beyond 3.4
Obviously, there is matching Sass 3.5 behaviour. But, beyond that, we'll want to focus on performance, stability, and error handling. These can always be improved upon and are the life's work of an open source project. We'll have to work closely with Sass in the future.

Some files were not shown because too many files have changed in this diff Show More