Commit Graph

31 Commits

Author SHA1 Message Date
Natalie Weizenbaum
7e371666f4
Add quietDeps and verbose to the JS API (#1353)
To support this, we now run Node-Sass-style relative loads outside of
the Node importer. This allows the evaluator to check whether a
relative load succeeded and use that to determine whether the
stylesheet counts as a dependency.

See sass/sass#3065
2021-06-14 17:41:56 -07:00
Natalie Weizenbaum
d660bf12ef Add an option to the CLI and Dart Sass to silence warnings from deps
Closes #672
2021-05-21 22:45:58 -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
Natalie Weizenbaum
8fdb281e83 Make the first parameter to ImportCache() named, not mandatory
It was always valid to pass in `null`, this just makes it more clear.
2021-04-14 17:15:08 -07:00
Natalie Weizenbaum
3fa2b1d98a Fix hints and lints 2021-04-12 17:31:11 -07:00
Jennifer Thakar
247cb3d816 Update dependencies to null-safe versions
This also replaces package_resolver with package_config, since
package_resolver is archived and is incompatible with null-safe Dart
packages.
2021-04-12 17:31:09 -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
a13f7be81b
Apply the change in #1139 to the asynchronous source file (#1150) 2020-11-19 17:44:36 -08:00
Michael R Fairhurst
82b2779d5c
Remove unused dart:async imports (#1097)
* Remove unused dart:async imports

Since Dart 2.1, Future and Stream have been exported from dart:core

* Run grinder
2020-10-05 09:35:03 -07:00
Natalie Weizenbaum
93dcf994d5
Update outdated docs for ImportCache.importCanonical(). (#982) 2020-05-13 12:47:52 -07:00
Sam Rawlins
da6b2c5d01
Remove two unused constructors named '_none' (#979) 2020-04-23 12:24:59 -07:00
Natalie Weizenbaum
a333059e71 Keep recompiling downstream dependencies after an error in --watch
Prior to this, the watcher handled all the logic around recompiling
stylesheets if an upstream file was deleted or added in a way that
could affect their import resolution. This left a gap where the
stylesheet graph wouldn't be aware that a newly-added file had become
upstream dependency of an existing downstream file, leading to
recompilation failures.

This commit fixes that by moving all that logic into the stylesheet
graph. The graph now has full and sole responsibility for providing a
consistent view of which stylesheets depend on one another even as the
shape of the graph changes, and the watcher is just a client of that
logic.

Closes #550
2020-02-24 20:18:03 -08:00
Jennifer Thakar
79d9a73474
Cache separate canonical URLs for @use and @import (#908)
Fixes #899.

The cache for canonical URLs is now keyed on *both* the rule URL and
whether that URL was canonicalized for an `@import` rule.
2020-01-02 15:25:02 -08:00
XhmikosR
a95d61e886 Typo fixes (#842) 2019-10-10 15:33:36 -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
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
a09a62538e Remove extra importer parameters from internal compile functions
These can be passed as an ImportCache now, so they make the API more
confusing for relatively little benefit.

This also changes the const AsyncImportCache.none field to a non-const
AsyncImportCache.none() constructor. The const field didn't make sense
for a couple reasons: first, it wouldn't use a user's custom logger;
and second, it couldn't cache any relative imports, which were still
possible when the initial file was loaded from disk.
2018-12-12 15:54:32 -08:00
Natalie Weizenbaum
487e5025ff Reformat with Dart-2-only features 2018-11-15 15:16:24 -08:00
Natalie Weizenbaum
77563be056
Add support for SASS_PATH (#514)
Closes #512
2018-11-05 15:24:14 -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
0f7f9e69a7
Add support for plain CSS imports (#436)
Closes #424
2018-08-10 15:58:15 -07:00
Natalie Weizenbaum
87e568faa4
Fix a bug where we were setting the base URL of stylesheets wrong (#370)
Closes #369
2018-06-20 17:43:40 -07:00
Natalie Weizenbaum
6ad67a6f28 Remove the workaround for dart-lang/sdk#30098
This un-reverts pull request #320 from sass/remove-path-workaround,
which was reverted by commit 0fb5d25ee2.
2018-06-14 16:15:27 -07:00
Natalie Weizenbaum
6bbb961675 Add a --watch command
Partially addresses #264
2018-06-09 14:13:36 -04:00
Natalie Weizenbaum
e6c821e719 Add modification methods to StylesheetGraph 2018-06-08 21:48:39 -04:00
Natalie Weizenbaum
0fb5d25ee2 Revert "Merge pull request #320 from sass/remove-path-workaround"
This reverts commit 08bfb46f16, reversing
changes made to ad73a91f84.
2018-05-31 14:37:21 -04: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
31c77fb1cc Remove the workaround for dart-lang/sdk#30098 2018-05-28 15:23:47 -04:00
Natalie Weizenbaum
5b9765c833 Add an ImportCache
This will allow cached imports to be shared outside of the context of
a single stylesheet compilation.
2018-05-24 14:31:07 -04:00