Commit Graph

166 Commits

Author SHA1 Message Date
Natalie Weizenbaum
47e0cfc8c8 Empty maps have undecided separators
Closes #737
2019-07-03 15:31:56 -07:00
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
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
11e3749721
Merge pull request #709 from sass/analysis
Enable stricter analysis options, especially around typing
2019-05-31 17:01:13 +01:00
Natalie Weizenbaum
ac38653776 Enable strict raw types 2019-05-31 16:01:49 +01:00
Natalie Weizenbaum
79e9bbd816 Enable strict inference 2019-05-31 15:54:59 +01:00
Natalie Weizenbaum
1340ba7b8a Enable and fix (most) pedantic lints 2019-05-31 15:18:59 +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
768da7088c
Resolve imports using custom imports before load paths (#687)
Closes #681
2019-05-20 15:34:57 -07:00
Natalie Weizenbaum
db87ed2f0e
Use the new Dart 2.3.0 literal syntax (#684) 2019-05-17 18:02:12 -07:00
Natalie Weizenbaum
7c9d63a4dc Reformat with the latest formatter 2019-05-15 18:17:26 -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
80b70b9dc2 Skip synchronize_test on Windows 2019-04-25 11:51:29 -07:00
Natalie Weizenbaum
7bd0f422b9 Test Windows and OS X on Travis 2019-04-25 11:51:27 -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
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
b102dc496a
Allow individual directories to be passed on the command-line (#581)
Closes #543
2019-02-01 14:59:58 -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
7a75b7b786
Don't canonicalize file case in source maps (#541)
Closes #540
2019-01-04 14:17:18 -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
9f2f11682e
Merge pull request #546 from sass/source-map-urls
Properly use ImportResult.sourceMapUrl for source map URLs
2018-12-20 17:39:28 -08:00
Natalie Weizenbaum
7ae11f1c0e Make synchronize_test draw from the canonical list of synced files 2018-12-20 16:22:43 -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
Nicholas Shahan
3a493f23ab
Add documentation comment collection to AST (#548)
- Documentation comments are simply identified by starting with a triple-slash "///". 
- Adjacent comments in indented syntax are now coalesced into a single comment.
2018-12-20 16:08:26 -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
dad8491035
Make types.String.prototype.setValue() de-quote a string (#535)
Closes #513
2018-12-06 15:06:32 -08:00
Natalie Weizenbaum
487e5025ff Reformat with Dart-2-only features 2018-11-15 15:16:24 -08:00
Natalie Weizenbaum
80afdd88f8 Run in Dart 2 runtime mode everywhere 2018-11-14 13:53:53 -08:00
Natalie Weizenbaum
77563be056
Add support for SASS_PATH (#514)
Closes #512
2018-11-05 15:24:14 -08: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
Natalie Weizenbaum
a25bbb3fc7
Add a ParenthesizedExpression class (#503)
This allows us to accurately track the source spans for parenthesized
expressions, which in turn allows us to print accurate error
indications.

Adding a new class for this more accurately represents the structure
of the expression, but it also involves an extra allocation during
parsing and an extra level of nesting during evaluation which could
have a small but real performance impact.

We could alternatively add a package-internal setter for
Expression.span, and update the source span for parenthesized
expressions after they're initially parsed. However, this has its own
downsides: it adds complexity and mutability to the object model; and
many expression classes currently use lazily-generated spans, so
making them settable would require adding extra slots on those
classes.

I decided to go with the extra class because it only adds overhead
when parentheses are actually used in practice, as opposed to adding
overhead to every list/color/etc. The runtime overhead is also likely
to be mitigated if at any point we add a constant-folding step.
2018-10-17 16:52:32 -07:00
Jen Thakar
9a1f322d7f Remove space around combinators in compressed mode (#494)
Complex selectors like "a > b" will now be output as "a>b" in
compressed mode.
2018-10-11 18:03:09 -07:00
Natalie Weizenbaum
0595ac3e71
Fix an import-resolution bug (#488)
When a stylesheet is imported, the parsed stylesheet object is cached
based on its canonical URL. However, the stylesheet.span.sourceUrl was
based on the text of the import that was used to load that stylesheet.
The idea was to make the source URL in stack traces look nicer, but it
meant that relative URLs could be resolved based on the old importer's
URL before being sent to the new importer, which caused bugs.

Now stylesheet.span.sourceUrl is always the canonical URL of the
stylesheet, and thus safe to cache. We then use the import cache to
convert the canonical URL to a human-friendly URL at the point at
which we generate stack traces.

This also deprecates support for relative canonical URLs. The
semantics of these URLs were always unclear, and with the new change
in import internals the old behavior doesn't make much sense. It's
preserved for backwards-compatibility, but deprecated.
2018-10-11 15:06:26 -07:00
Natalie Weizenbaum
0620ccc19a
Fix @debug on stdin (#493) 2018-10-10 15:05:23 -07:00
Natalie Weizenbaum
04ada09a82
Get rid of the dart2 test tag (#477)
We're only ever running tests under Dart 2 now, so it's irrelevant
whether they're Dart 2-only.
2018-09-19 15:28:47 -04:00
Natalie Weizenbaum
1a5eb2a2e3
Fix embedding source maps with non-ASCII characters (#471)
Closes #457
2018-09-11 12:13:43 -07:00
Natalie Weizenbaum
ede9c81e0b
Properly adjust source maps when prepending encoding information (#470)
Closes #469
2018-09-10 15:38:30 -07:00
Natalie Weizenbaum
3346c7974a
Fix analysis hints (#450) 2018-08-15 12:43:55 -07:00
Natalie Weizenbaum
d1bb4a0d6d
Allow a BOM at the beginning of a document (#441)
This was only breaking in JS because apparently dart:io automatically
filters out BOMs.

Closes #437
2018-08-10 16:31:15 -07:00
Natalie Weizenbaum
0f7f9e69a7
Add support for plain CSS imports (#436)
Closes #424
2018-08-10 15:58:15 -07:00
Natalie Weizenbaum
8bffd52729
Don't hang after a syntax error in --watch (#435)
Closes #401
2018-08-03 15:38:16 -07:00
Natalie Weizenbaum
13b8ad6d4d Format 2018-07-23 16:57:21 -07:00