Commit Graph

54 Commits

Author SHA1 Message Date
Ed Rivas
ca2be2ace9
Expose calculations in JS API (#1988)
Co-authored-by: Jonny Gerig Meyer <jonny@oddbird.net>
Co-authored-by: Natalie Weizenbaum <nweiz@google.com>
2023-07-19 14:36:22 -07:00
Ed Rivas
cca9464b09
Add support for running in the browser (#1895)
Closes #25

Co-authored-by: Jonny Gerig Meyer <jonny@oddbird.net>
Co-authored-by: Natalie Weizenbaum <nweiz@google.com>
2023-05-19 13:22:44 -07:00
Natalie Weizenbaum
103cb19b41
Consistently use floating-point numbers everywhere (#1802)
Closes #1794
2022-09-21 14:15:42 -07:00
Natalie Weizenbaum
98f326b507
Convert visitor classes to mixins (#1784)
Co-authored-by: Jennifer Thakar <jathak@google.com>
2022-08-19 15:17:58 -07:00
Natalie Weizenbaum
69077ddcea
Delete legacy Node.js API tests (#1610)
These are now tested using the runner in sass-spec.
2022-01-25 17:16:24 -08:00
Natalie Weizenbaum
e86897be97 Fix new analysis issues from Dart 2.15 2021-12-10 14:02:17 -08:00
Natalie Weizenbaum
2430ac6d20 Avoid creating zone variables inside _EvaluateVisitor
Instead, we create a single zone-scoped object that's visible for the
entire lifespan of the visitor, and which exposes evaluation internals
which can be updated as direct field modifications.
2021-10-20 16:36:52 -07:00
Jennifer Thakar
4f67c4dd30
Fix RecursiveAstVisitor (#1525)
`visitCalculationExpression` is now properly implemented.

This also adds concrete test classes that extend `RecursiveAstVisitor`
and `RecursiveStatementVisitor` to ensure similar issues are avoided in
the future whenever new AST nodes are added.
2021-10-05 18:36:45 -07:00
Christophe Coevoet
8012e0e9c9
Avoid the /-as-division warning when running the dart_api tests (#1467) 2021-09-07 12:25:08 -07:00
Christophe Coevoet
49c75b1509
Fix the test covering space-separated list to actually do it (#1466) 2021-09-07 12:23:33 -07:00
Christophe Coevoet
f098c7f5ac
Fix the test description for the list separator of non-empty maps (#1464) 2021-09-07 12:22:39 -07:00
Christophe Coevoet
1288b92b4e
Fix the description of some tests for SassNumber (#1463)
123/5 does not produce an integer.
2021-09-07 12:22:21 -07:00
Natalie Weizenbaum
558ca0aa72 Expose CompileResult publicly, along with methods that return it
This also exposes CompileResult.includedUrls.

Closes #1355
Partially addresses sass/embedded-protocol#62
2021-07-13 18:08:23 -07:00
Natalie Weizenbaum
43b69e60a0 Change CompileResult.includedFiles to CompileResult.includedUrls
Rather than constructing this explicitly to match Node Sass's API, we
construct it with canonical URLs and convert it into the format
expected by the Node Sass API (a mix of paths and URLs) in the
compatibility layer.
2021-07-13 18:08:18 -07:00
Natalie Weizenbaum
629881212c
Fix root-relative @import URLs as passed to importers (#1371)
Closes #1137
2021-06-22 17:22:29 -07:00
Natalie Weizenbaum
47920ad032
Merge branch 'master' into slash-separator 2021-05-17 14:13:03 -07:00
Natalie Weizenbaum
136bd285b3 Add AsyncImporter.fromImport for Dart importers 2021-05-13 18:06:43 -07:00
Natalie Weizenbaum
5a0242a090 Code review 2021-05-13 16:43:15 -07:00
Natalie Weizenbaum
be1a414f07 Deprecate /-as-division and add replacements
Partially addresses #663
2021-05-12 13:21:28 -07:00
Christophe Coevoet
fbd9cfd8a2
Fix a bunch of typos in comments (#1257)
Co-authored-by: Natalie Weizenbaum <nweiz@google.com>
2021-04-15 14:01:07 -07:00
Natalie Weizenbaum
e85d9a7afc Fix automated migrator errors
This gets the project analyzer-clean, but the tests are still failing.
2021-04-14 17:15:08 -07:00
Natalie Weizenbaum
81d952dc7d Automated null-safety migration 2021-04-14 17:15:08 -07:00
Jennifer Thakar
dfbdae0d71 Prepare for null-safety migration 2021-04-14 17:15:08 -07:00
Sam Rawlins
006e6aa62f
Remove unnecessary imports (#1177)
Co-authored-by: Natalie Weizenbaum <nweiz@google.com>
2020-12-30 14:57:50 -08:00
Natalie Weizenbaum
bae2968757 Deprecate incorrect HSL units
Partially addresses #1174
2020-12-29 13:26:54 -08:00
Natalie Weizenbaum
d532f015f6 Improve error reporting for incompatible units
The new messages more consistently include argument names and actual
values. Errors about mixed unitless and unitful numbers are now more
consistent.
2020-12-28 17:58:55 -08:00
Jennifer Thakar
4f1f5c9de8
Fix for importers that return null in load (#1139) 2020-11-10 09:44:37 -08:00
Natalie Weizenbaum
f798aae0af
Reformat (#1133) 2020-11-03 16:03:08 -08:00
Natalie Weizenbaum
b0f213c22f Merge remote-tracking branch 'origin/master' into feature.hwb 2020-10-09 17:29:47 -07:00
Natalie Weizenbaum
1918674295
Support HWB colors in SassColor (#1085)
See sass/sass#2835
2020-09-17 16:18:12 -07:00
Natalie Weizenbaum
028b2f6a01 Add a map.deep-merge() function (#1077) (#1080)
This also adds a Value.tryMap() function, which was useful for
implementing this and may be more generally useful to users as well.

See sass/sass#2836
See sass/sass-spec#1560
2020-09-15 16:25:49 -07:00
Natalie Weizenbaum
015a76cf0b Revert "Add a map.deep-merge() function (#1077) (#1080)"
This reverts commit 315e86b442.

Once again, this was supposed to go on feature.nested-maps.
2020-09-15 16:24:53 -07:00
Natalie Weizenbaum
315e86b442
Add a map.deep-merge() function (#1077) (#1080)
This also adds a Value.tryMap() function, which was useful for
implementing this and may be more generally useful to users as well.

See sass/sass#2836
See sass/sass-spec#1560
2020-09-15 16:23:01 -07:00
Natalie Weizenbaum
9503b57ac5 Revert "Add a map.deep-merge() function (#1077)"
This reverts commit bc7216a441.

This was intended to land on a feature branch, not on master.
2020-09-15 15:17:55 -07:00
Natalie Weizenbaum
bc7216a441
Add a map.deep-merge() function (#1077)
This also adds a Value.tryMap() function, which was useful for
implementing this and may be more generally useful to users as well.

See sass/sass#2836
See sass/sass-spec#1560
2020-09-15 13:03:38 -07:00
Natalie Weizenbaum
20978e0320 Fix new strict inference hints from Dart 2.6 2019-11-06 14:47:24 -08:00
XhmikosR
a95d61e886 Typo fixes (#842) 2019-10-10 15:33:36 -07:00
Natalie Weizenbaum
4ccddf8b13
Dash-normalize user-defined functions (#813)
Closes #811
2019-09-03 16:00:07 -07:00
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
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
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
487e5025ff Reformat with Dart-2-only features 2018-11-15 15:16:24 -08: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
c5071ef843 Stop using a deprecated API 2018-06-15 13:59:28 -07:00
Natalie Weizenbaum
d4655f22bd
Fix an Importer-calling bug (#338)
We were resolving URLs relative to the canonical URL rather than the
original URL, which broke importers for which those were different,
like the package importer.

Closes #334
2018-05-30 17:47:37 -04:00
Natalie Weizenbaum
4c6494c288 Add a Logger class to control how output is emitted 2018-03-11 21:05:34 -07:00
Natalie Weizenbaum
163e99bff2 Be explicit about string quotes in new SassString() 2018-02-02 16:47:54 -08:00
Natalie Weizenbaum
123fe55017 Add SassString index helpers
We aren't using these in our own functions because, for
backwards-compatibility, these functions don't throw errors for
invalid indices.
2018-01-14 16:04:46 -08:00