Commit Graph

286 Commits

Author SHA1 Message Date
Natalie Weizenbaum
e4b18b5231
Produce better stack traces for syntax errors loaded via import/use (#722)
We now wrap _withStackFrame() around wider sections of code, including
_loadStylesheet() which handles parse errors, so that the @use/@import
stack frames are available.
2019-06-18 17:26:46 -07:00
Natalie Weizenbaum
4716349a0e
Add new module-system features for existing functions (#720) 2019-06-18 12:03:12 -07:00
Natalie Weizenbaum
a87631777b
Declare a "sass" executable in the pubspec (#712) 2019-06-06 21:19:09 +01:00
Natalie Weizenbaum
bea609d74b
Add a top-level warn() function for functions and importers (#711)
In addition to being useful for users of Sass, this will make it
possible for core Sass functions to produce warnings without needing
an explicit reference to the evaluator.
2019-06-06 19:42:44 +01:00
Natalie Weizenbaum
48c284b4ef
Properly mark secure variables so they're decrypted by Travis (#697) 2019-05-31 17:01:33 +01:00
Natalie Weizenbaum
2836780339
Merge pull request #689 from sass/exponent
Fix some number serialization bugs
2019-05-24 15:09:37 -07:00
Natalie Weizenbaum
0fe0208f6e Remove exponent notation for integers on Node.js
Closes #688
2019-05-21 13:36:36 -07:00
Natalie Weizenbaum
fb383de20e Fix a bug in SerializeVisitor._writeDecimal
This function didn't expect a number ending in ".0", because they're
normally filtered out by fuzzyAsInt(). However, they can make it
through for very large doubles.
2019-05-20 15:50:45 -07:00
Natalie Weizenbaum
768da7088c
Resolve imports using custom imports before load paths (#687)
Closes #681
2019-05-20 15:34:57 -07:00
Natalie Weizenbaum
4b7699291c
Compile release executables in native mode (#679) 2019-05-15 16:02:02 -07:00
Natalie Weizenbaum
60fc306ab4 Release 1.20.1
This doesn't have any code changes, but I want to verify that the new
deployment infrastructure works and the only way to do that is to
actually deploy.
2019-05-03 13:13:20 -07:00
Natalie Weizenbaum
34c068a189
Generate a CSS file describing an error when one occurs (#659)
Closes #657
2019-05-02 18:14:25 -07:00
Natalie Weizenbaum
407eefded1
Add support for attribute selector modifiers (#658)
Closes #656
2019-04-30 11:31:18 -07:00
Natalie Weizenbaum
37f0740307
Allow ! in url()s (#650)
Closes #646
2019-04-18 17:37:20 -07:00
Natalie Weizenbaum
413c949446
Make FilesystemImport._loadPath absolute (#651)
This avoids having the effective load path change when the process's
working directory changes.
2019-04-18 16:34:48 -07:00
Natalie Weizenbaum
3b3a43a8f9
Add a --charset flag and API option (#644)
The automatic @charset adding is useful in general, but there are
consistently cases where it trips up naïve downstream tools. This
option makes it easier for users to control when it occurs.
2019-04-08 14:49:08 -07:00
Natalie Weizenbaum
59800ad1f9
Don't recursively list directories in realCasePath() (#641)
We only need to list the path's immediate parent directory in order to
find its real case.

Closes #636
2019-04-04 12:18:02 -07:00
Natalie Weizenbaum
495c6f3163
Only claim "package:" URLs are unsupported on Node (#637)
Closes #630
2019-04-04 12:17:36 -07:00
Natalie Weizenbaum
8c9412b520
Fix importing files relative to "package:" imports (#638)
The PackageImporter wasn't accepting paths relative to its
canonicalized outputs as inputs.

Closes #631
2019-04-03 13:57:52 -07:00
Natalie Weizenbaum
9999835df0
Add a sass.types.Error constructor to the JS API (#627)
Closes #590
2019-04-03 01:07:12 -07:00
Natalie Weizenbaum
bc5e3c4f8f
Properly parse CR, CR LF, and FF as newlines everywhere (#626)
Closes #623
2019-03-18 16:50:23 -07:00
Natalie Weizenbaum
62bce0c5b9
Properly stringify slash-separated numbers in operations (#612)
Closes #607
2019-03-07 18:14:12 -08:00
Natalie Weizenbaum
e84c8b1995
Don't put style rules inside empty @keyframes rules (#613)
Closes #611
2019-03-07 17:04:30 -08:00
Natalie Weizenbaum
8ab9ce1141
Deprecate assignment to non-existent global variables (#601)
See #600
See sass/sass#2606
2019-02-21 15:16:52 -08:00
Natalie Weizenbaum
149bf85b4d
Explicitly mark classes as sealed (#602) 2019-02-20 16:39:46 -08:00
Natalie Weizenbaum
26401fb135
Fix an attribute selector quoting bug (#599)
Closes #598
2019-02-20 13:38:21 -08:00
Natalie Weizenbaum
7ca989a4f7
Produce a better error for invalid function contents (#587)
Closes #584
2019-02-04 13:14:25 -08:00
Natalie Weizenbaum
a81017275a
Produce a better error message for unclosed style rules (#586)
Closes #577
2019-02-01 17:21:15 -08:00
Natalie Weizenbaum
b102dc496a
Allow individual directories to be passed on the command-line (#581)
Closes #543
2019-02-01 14:59:58 -08:00
Natalie Weizenbaum
cd3b82e2be
Fix a check for adjusting parse errors (#582) 2019-02-01 14:55:34 -08:00
Natalie Weizenbaum
e8ac314f56
Support dart-lang/source_span#25 (#566)
This adds a --no-unicode option to disable Unicode span rendering,
decouples repl highlighting from SourceSpan.highlight, and updates
tests to work with the new error highlighting.

It also tightly scopes source spans for statements with children.
Previously, source spans for these nodes extended all the way through
any whitespace that followed the node. This led to messy-looking
multiline span highlights with dart-lang/source_span#25.

Now, StylesheetParser.children doesn't consume trailing whitespace.
Instead, we add a helper method StylesheetParser._withChildren that
parses children, creates the appropriate span, and then consumes the
trailing whitespace.
2019-01-28 20:42:32 -05:00
Natalie Weizenbaum
9fdf5612ea
Fix a performance bug in BinaryOperatorExpression.span (#569)
Previously, evaluator called BinaryOperationExpression.span for each
binary operation it evaluated, which in turn called spanForList() to
create a span covering both child expressions. spanForList() then
called .span for both the left and right child operations *twice*,
leading to exponential behavior.

This is now avoided in three complementary ways:

1. The evaluator avoids eagerly calling AstNode.span, instead keeping
   the original AstNode until the span itself needs to be accessed.
   This means that a span will only be accessed when an error actually
   occurs, and then only one operation's span will be accessed.

2. BinaryOperationExpression.span now iterates through any child
   operations before calling their .span methods, so it only performs
   O(1) allocations.

3. spanForList() now only calls each AstNode.span once.
2019-01-17 18:04:14 -05:00
Natalie Weizenbaum
55ebe56d3c
Add support for new special number strings (#556)
See sass/sass#2584
2019-01-09 15:50:04 -05:00
Natalie Weizenbaum
32be730b6e
Emit tab characters as \9 (#553)
Closes #552
2019-01-04 14:20:28 -05:00
Natalie Weizenbaum
18c0cbdaea
Match Node Sass's this.includePaths behavior for importers (#551)
On Windows, paths are separated with a semicolon rather than a colon.

Closes #549
2019-01-03 10:48:20 -08:00
Natalie Weizenbaum
759b587364
Don't omit units in numbers in compressed mode (#545)
See https://github.com/sass/sass/issues/649#issuecomment-447033060
2019-01-03 10:47:54 -08:00
Natalie Weizenbaum
06b9fbd812
Merge branch 'master' into windows-path-separator 2018-12-26 14:17:45 -08:00
Natalie Weizenbaum
23968148d0 Properly use ImportResult.sourceMapUrl for source map URLs
This also uses data: URLs to refer to stylesheets from stdin in source
maps.
2018-12-20 16:22:43 -08:00
Natalie Weizenbaum
519bfa3d6b Match Node Sass's this.includePaths behavior for importers
On Windows, paths are separated with a semicolon rather than a colon.

Closes #549
2018-12-17 15:30:17 -08:00
Natalie Weizenbaum
94fd7e6e50
Match Ruby Sass's number behavior (#544)
This introduces two changes:

1. It changes the epsilon within which two numbers are considered
   equal to be an order of magnitude smaller than the numeric
   precision. Ruby Sass has always done this, and Dart Sass should
   have but did not until now.

2. It parses the component of a number after the decimal point using
   double.parse() to avoid accumulating floating point errors.
2018-12-13 15:27:08 -08:00
Natalie Weizenbaum
f3db1d6a66
Properly merge "all and" media queries (#539)
Closes #537
2018-12-10 13:13:19 -08:00
Natalie Weizenbaum
dad8491035
Make types.String.prototype.setValue() de-quote a string (#535)
Closes #513
2018-12-06 15:06:32 -08:00
Natalie Weizenbaum
aa52cf1474
Always add quotes to attribute selector values that begin with -- (#529)
Closes #527
2018-11-16 13:51:36 -08:00
Natalie Weizenbaum
50efdabcce Add support for CSS Color Level 4 rgb() and hsl() syntax
Closes #497
2018-11-12 16:33:54 -08:00
Natalie Weizenbaum
13006e9902
Clamp saturation and lightness rather than throwing errors (#521)
This matches Ruby Sass's behavior.
2018-11-12 14:25:40 -08:00
Natalie Weizenbaum
4520b8b53b
Don't trim escaped whitespace (#523)
Related to sass/ruby-sass#96
2018-11-08 11:54:59 -08:00
Natalie Weizenbaum
1206761da4
Add support for passing arguments to @content blocks (#518)
Closes #498
2018-11-05 16:53:43 -08:00
Natalie Weizenbaum
77563be056
Add support for SASS_PATH (#514)
Closes #512
2018-11-05 15:24:14 -08:00
Natalie Weizenbaum
bf71ca359d
Add support for interpolation in at-rule names (#509)
Closes #496
2018-11-01 14:31:46 -07:00
Natalie Weizenbaum
9e18b7e95b
Always include the error location in JS error messages (#511)
Always include the error location in JS error messages

I was trying to match Node Sass's behavior by having Error.formatted
property have more detail than Error.message, but our errors rely on
source snippets for context so this just ended up making them
confusing.
2018-10-31 18:13:04 -07:00