Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 1f5eaff

Browse files
authored
Merge pull request #1866 from xzyfer/bump-libsass
Bump LibSass to 3.5.0.beta.2
2 parents 71a7a84 + 1b9970a commit 1f5eaff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+2771
-2110
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "node-sass",
33
"version": "4.3.0",
4-
"libsass": "3.4.3",
4+
"libsass": "3.5.0.beta.2",
55
"description": "Wrapper around libsass",
66
"license": "MIT",
77
"bugs": "https://github.com/sass/node-sass/issues",

src/libsass.gyp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
],
1313
'sources': [
1414
'libsass/src/ast.cpp',
15+
'libsass/src/ast_fwd_decl.cpp',
1516
'libsass/src/base64vlq.cpp',
1617
'libsass/src/bind.cpp',
1718
'libsass/src/cencode.c',

src/libsass/.travis.yml

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
language: cpp
22
sudo: false
33

4-
os:
5-
- linux
6-
- osx
7-
8-
compiler:
9-
- gcc
10-
- clang
114

125
# don't create redundant code coverage reports
136
# - AUTOTOOLS=yes COVERAGE=yes BUILD=static
@@ -19,27 +12,53 @@ compiler:
1912
# this will still catch all coding errors!
2013
# - AUTOTOOLS=yes COVERAGE=no BUILD=static
2114

22-
env:
23-
- AUTOTOOLS=no COVERAGE=no BUILD=shared
24-
- AUTOTOOLS=no COVERAGE=yes BUILD=static
25-
- AUTOTOOLS=yes COVERAGE=no BUILD=shared
26-
2715
# currenty there are various issues when
2816
# built with coverage, clang and autotools
2917
# - AUTOTOOLS=yes COVERAGE=yes BUILD=shared
3018

3119
matrix:
32-
exclude:
33-
- compiler: clang
34-
env: AUTOTOOLS=yes COVERAGE=yes BUILD=static
20+
include :
21+
- os: linux
22+
compiler: gcc
23+
env: AUTOTOOLS=no COVERAGE=yes BUILD=static
3524
- os: linux
25+
compiler: g++-5
26+
env: AUTOTOOLS=yes COVERAGE=no BUILD=shared
27+
addons:
28+
apt:
29+
sources:
30+
- ubuntu-toolchain-r-test
31+
packages:
32+
- g++-5
33+
- os: linux
34+
compiler: clang++-3.7
35+
env: AUTOTOOLS=no COVERAGE=yes BUILD=static
36+
addons:
37+
apt:
38+
sources:
39+
- ubuntu-toolchain-r-test
40+
- llvm-toolchain-precise-3.7
41+
packages:
42+
- clang-3.7
43+
- os: linux
44+
compiler: clang
45+
env: AUTOTOOLS=yes COVERAGE=no BUILD=shared
46+
- os: osx
47+
compiler: clang
3648
env: AUTOTOOLS=no COVERAGE=no BUILD=shared
3749
- os: osx
38-
compiler: gcc
50+
compiler: clang
51+
env: AUTOTOOLS=no COVERAGE=yes BUILD=static
3952
- os: osx
40-
env: AUTOTOOLS=no BUILD=static
53+
compiler: clang
54+
env: AUTOTOOLS=yes COVERAGE=no BUILD=shared
4155

42-
script: ./script/ci-build-libsass
56+
script:
57+
- ./script/ci-build-libsass
58+
- ./script/ci-build-plugin math
59+
- ./script/ci-build-plugin glob
60+
- ./script/ci-build-plugin digest
61+
- ./script/ci-build-plugin tests
4362
before_install: ./script/ci-install-deps
4463
install: ./script/ci-install-compiler
4564
after_success: ./script/ci-report-coverage

src/libsass/GNUmakefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ AM_COPT = -Wall -O2
44
AM_COVLDFLAGS =
55

66
if ENABLE_COVERAGE
7-
AM_COPT = -O0 --coverage
7+
AM_COPT = -Wall -O1 -fno-omit-frame-pointer --coverage
88
AM_COVLDFLAGS += -lgcov
99
endif
1010

@@ -57,7 +57,7 @@ TESTS = \
5757
$(SASS_SPEC_PATH)/spec/scss-tests \
5858
$(SASS_SPEC_PATH)/spec/types
5959

60-
SASS_TEST_FLAGS = -V 3.4 --impl libsass
60+
SASS_TEST_FLAGS = -V 3.5 --impl libsass
6161
LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) ./script/tap-driver
6262
AM_LOG_FLAGS = -c ./tester $(LOG_FLAGS)
6363
if USE_TAP

src/libsass/Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@ INSTALL ?= install
1515
CFLAGS ?= -Wall
1616
CXXFLAGS ?= -Wall
1717
LDFLAGS ?= -Wall
18-
ifneq "$(COVERAGE)" "yes"
18+
ifeq "x$(COVERAGE)" "x"
1919
CFLAGS += -O2
2020
CXXFLAGS += -O2
2121
LDFLAGS += -O2
22+
else
23+
CFLAGS += -O1 -fno-omit-frame-pointer
24+
CXXFLAGS += -O1 -fno-omit-frame-pointer
25+
LDFLAGS += -O1 -fno-omit-frame-pointer
2226
endif
2327
LDFLAGS += -Wl,-undefined,error
2428
CAT ?= $(if $(filter $(OS),Windows_NT),type,cat)
@@ -305,16 +309,16 @@ version: $(SASSC_BIN)
305309
$(SASSC_BIN) -v
306310

307311
test: $(SASSC_BIN)
308-
$(RUBY_BIN) $(SASS_SPEC_PATH)/sass-spec.rb -V 3.4 -c $(SASSC_BIN) --impl libsass $(LOG_FLAGS) $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)
312+
$(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)
309313

310314
test_build: $(SASSC_BIN)
311-
$(RUBY_BIN) $(SASS_SPEC_PATH)/sass-spec.rb -V 3.4 -c $(SASSC_BIN) --impl libsass $(LOG_FLAGS) $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)
315+
$(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)
312316

313317
test_full: $(SASSC_BIN)
314-
$(RUBY_BIN) $(SASS_SPEC_PATH)/sass-spec.rb -V 3.4 -c $(SASSC_BIN) --impl libsass --run-todo $(LOG_FLAGS) $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)
318+
$(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)
315319

316320
test_probe: $(SASSC_BIN)
317-
$(RUBY_BIN) $(SASS_SPEC_PATH)/sass-spec.rb -V 3.4 -c $(SASSC_BIN) --impl libsass --probe-todo $(LOG_FLAGS) $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)
321+
$(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)
318322

319323
clean-objects: lib
320324
-$(RM) lib/*.a lib/*.so lib/*.dll lib/*.la

src/libsass/Makefile.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ SOURCES = \
1313
functions.cpp \
1414
color_maps.cpp \
1515
environment.cpp \
16+
ast_fwd_decl.cpp \
1617
bind.cpp \
1718
file.cpp \
1819
util.cpp \

src/libsass/appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ test_script:
6565
}
6666
$env:TargetPath = Join-Path $pwd.Path $env:TargetPath
6767
If (Test-Path "$env:TargetPath") {
68-
ruby sass-spec/sass-spec.rb -V 3.4 --probe-todo --impl libsass -c $env:TargetPath -s sass-spec/spec
68+
ruby sass-spec/sass-spec.rb -V 3.5 --probe-todo --impl libsass -c $env:TargetPath -s sass-spec/spec
6969
if(-not($?)) {
7070
echo "sass-spec tests failed"
7171
exit 1

src/libsass/configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ if test "x$enable_cov" = "xyes"; then
121121

122122
# Remove all optimization flags from C[XX]FLAGS
123123
changequote({,})
124-
CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
125-
CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9]*//g'`
124+
CFLAGS=`echo "$CFLAGS -O1 -fno-omit-frame-pointer" | $SED -e 's/-O[0-9]*//g'`
125+
CXXFLAGS=`echo "$CXXFLAGS -O1 -fno-omit-frame-pointer" | $SED -e 's/-O[0-9]*//g'`
126126
changequote([,])
127127

128128
AC_SUBST(GCOV)

src/libsass/docs/api-context-internal.md

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,35 @@ enum Sass_Input_Style {
77
SASS_CONTEXT_FOLDER
88
};
99

10-
// simple linked list
11-
struct string_list {
12-
string_list* next;
13-
char* string;
14-
};
15-
1610
// sass config options structure
17-
struct Sass_Options {
18-
19-
// Precision for fractional numbers
20-
int precision;
11+
struct Sass_Inspect_Options {
2112

2213
// Output style for the generated css code
2314
// A value from above SASS_STYLE_* constants
2415
enum Sass_Output_Style output_style;
2516

17+
// Precision for fractional numbers
18+
int precision;
19+
20+
};
21+
22+
// sass config options structure
23+
struct Sass_Output_Options : Sass_Inspect_Options {
24+
25+
// String to be used for indentation
26+
const char* indent;
27+
// String to be used to for line feeds
28+
const char* linefeed;
29+
2630
// Emit comments in the generated CSS indicating
2731
// the corresponding source line.
2832
bool source_comments;
2933

34+
};
35+
36+
// sass config options structure
37+
struct Sass_Options : Sass_Output_Options {
38+
3039
// embed sourceMappingUrl as data uri
3140
bool source_map_embed;
3241

@@ -56,15 +65,9 @@ struct Sass_Options {
5665
// information in source-maps etc.
5766
char* output_path;
5867

59-
// String to be used for indentation
60-
const char* indent;
61-
// String to be used to for line feeds
62-
const char* linefeed;
63-
6468
// Colon-separated list of paths
6569
// Semicolon-separated on Windows
66-
// Note: It may be better to use
67-
// array interface instead
70+
// Maybe use array interface instead?
6871
char* include_path;
6972
char* plugin_path;
7073

@@ -82,10 +85,13 @@ struct Sass_Options {
8285
char* source_map_root;
8386

8487
// Custom functions that can be called from sccs code
85-
Sass_C_Function_List c_functions;
88+
Sass_Function_List c_functions;
8689

8790
// Callback to overload imports
88-
Sass_C_Import_Callback importer;
91+
Sass_Importer_List c_importers;
92+
93+
// List of custom headers
94+
Sass_Importer_List c_headers;
8995

9096
};
9197

@@ -111,6 +117,7 @@ struct Sass_Context : Sass_Options
111117
char* error_file;
112118
size_t error_line;
113119
size_t error_column;
120+
const char* error_src;
114121

115122
// report imported files
116123
char** included_files;
@@ -130,6 +137,7 @@ struct Sass_Data_Context : Sass_Context {
130137

131138
// provided source string
132139
char* source_string;
140+
char* srcmap_string;
133141

134142
};
135143

@@ -147,9 +155,9 @@ struct Sass_Compiler {
147155
// original c context
148156
Sass_Context* c_ctx;
149157
// Sass::Context
150-
void* cpp_ctx;
158+
Sass::Context* cpp_ctx;
151159
// Sass::Block
152-
void* root;
160+
Sass::Block_Obj root;
153161
};
154162
```
155163

src/libsass/docs/api-context.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,17 +207,22 @@ size_t sass_context_get_error_column (struct Sass_Context* ctx);
207207
const char* sass_context_get_source_map_string (struct Sass_Context* ctx);
208208
char** sass_context_get_included_files (struct Sass_Context* ctx);
209209

210+
// Getters for Sass_Compiler options (query import stack)
211+
size_t sass_compiler_get_import_stack_size(struct Sass_Compiler* compiler);
212+
Sass_Import_Entry sass_compiler_get_last_import(struct Sass_Compiler* compiler);
213+
Sass_Import_Entry sass_compiler_get_import_entry(struct Sass_Compiler* compiler, size_t idx);
214+
// Getters for Sass_Compiler options (query function stack)
215+
size_t sass_compiler_get_callee_stack_size(struct Sass_Compiler* compiler);
216+
Sass_Callee_Entry sass_compiler_get_last_callee(struct Sass_Compiler* compiler);
217+
Sass_Callee_Entry sass_compiler_get_callee_entry(struct Sass_Compiler* compiler, size_t idx);
218+
210219
// Take ownership of memory (value on context is set to 0)
211220
char* sass_context_take_error_json (struct Sass_Context* ctx);
212221
char* sass_context_take_error_text (struct Sass_Context* ctx);
213222
char* sass_context_take_error_message (struct Sass_Context* ctx);
214223
char* sass_context_take_error_file (struct Sass_Context* ctx);
215224
char* sass_context_take_output_string (struct Sass_Context* ctx);
216225
char* sass_context_take_source_map_string (struct Sass_Context* ctx);
217-
218-
// Push function for plugin/include paths (no manipulation support for now)
219-
void sass_option_push_plugin_path (struct Sass_Options* options, const char* path);
220-
void sass_option_push_include_path (struct Sass_Options* options, const char* path);
221226
```
222227
223228
### Sass Options API
@@ -236,13 +241,18 @@ const char* sass_option_get_indent (struct Sass_Options* options);
236241
const char* sass_option_get_linefeed (struct Sass_Options* options);
237242
const char* sass_option_get_input_path (struct Sass_Options* options);
238243
const char* sass_option_get_output_path (struct Sass_Options* options);
239-
const char* sass_option_get_plugin_path (struct Sass_Options* options);
240-
const char* sass_option_get_include_path (struct Sass_Options* options);
241244
const char* sass_option_get_source_map_file (struct Sass_Options* options);
242245
const char* sass_option_get_source_map_root (struct Sass_Options* options);
243246
Sass_C_Function_List sass_option_get_c_functions (struct Sass_Options* options);
244247
Sass_C_Import_Callback sass_option_get_importer (struct Sass_Options* options);
245248
249+
// Getters for Context_Option include path array
250+
size_t sass_option_get_include_path_size(struct Sass_Options* options);
251+
const char* sass_option_get_include_path(struct Sass_Options* options, size_t i);
252+
// Plugin paths to load dynamic libraries work the same
253+
size_t sass_option_get_plugin_path_size(struct Sass_Options* options);
254+
const char* sass_option_get_plugin_path(struct Sass_Options* options, size_t i);
255+
246256
// Setters for Context_Option values
247257
void sass_option_set_precision (struct Sass_Options* options, int precision);
248258
void sass_option_set_output_style (struct Sass_Options* options, enum Sass_Output_Style output_style);
@@ -266,6 +276,16 @@ void sass_option_set_importer (struct Sass_Options* options, Sass_C_Import_Callb
266276
// Push function for paths (no manipulation support for now)
267277
void sass_option_push_plugin_path (struct Sass_Options* options, const char* path);
268278
void sass_option_push_include_path (struct Sass_Options* options, const char* path);
279+
280+
// Resolve a file via the given include paths in the sass option struct
281+
// find_file looks for the exact file name while find_include does a regular sass include
282+
char* sass_find_file (const char* path, struct Sass_Options* opt);
283+
char* sass_find_include (const char* path, struct Sass_Options* opt);
284+
285+
// Resolve a file relative to last import or include paths in the sass option struct
286+
// find_file looks for the exact file name while find_include does a regular sass include
287+
char* sass_compiler_find_file (const char* path, struct Sass_Compiler* compiler);
288+
char* sass_compiler_find_include (const char* path, struct Sass_Compiler* compiler);
269289
```
270290

271291
### More links

0 commit comments

Comments
 (0)