Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error handling and forbidden at rules #145

Merged
merged 4 commits into from
Jun 15, 2022
Merged

Error handling and forbidden at rules #145

merged 4 commits into from
Jun 15, 2022

Conversation

kaj
Copy link
Owner

@kaj kaj commented Jun 6, 2022

Refactor error handling and add checks for forbidden at rules in some places.

@kaj kaj force-pushed the forbidden-at-rule branch 4 times, most recently from c301a73 to 28e4191 Compare June 12, 2022 01:06
@kaj kaj force-pushed the forbidden-at-rule branch 2 times, most recently from 321cd58 to 50726ab Compare June 15, 2022 17:13
@kaj kaj merged commit b819fc4 into master Jun 15, 2022
@kaj kaj deleted the forbidden-at-rule branch June 15, 2022 18:23
kaj added a commit that referenced this pull request Sep 18, 2022
Released 2022-09-18.
Progress: 4500 of 6843 tests passed (or 4673 if ignoring some
deprecation messages).

Breaking changes

* A `BuiltinFn` now takes a `&ResolvedArgs` rather than a `&ScopeRef` as
  argument (PR #157).
* `@extend` is still unsupported, but now some uses of it (e.g. in control
  structures) will result in an error instead of wrong output.
* Some `sass::Item` alternatives now contain a `Callable`, combining
  `FormalArgs` with a body (a `Vec<Item>`).  And `sass::Item::Content` now
  has a `CallArgs`.  Also, `MixinDeclImpl` is replaced with
  `sass::Closure`. (PR #146).
* `sass::CallArgs::new()` has an additional `trailing_comma` boolean
  argument (PR #147).
* Remove deprecated methods `css::Value::integer_value()` and
  `Number::is_integer()`.
* Changed the error type of `Scope::get_function()`.
* Setting a variable, `Scope::define` now takes the `Value` by value rather
  than by reference.  Also, `Scope::define_multi` is no longer exposed in
  the api.
* Renamed one variant of `ScopeError` and added two others.
* The sass `Value::Variable` and `Item::VariableDeclaration` variants
  now holds a `Name` rather than just a `String` for the variable name.
  Also, both now holds a `SourcePos`.
* Changes in `Error` representation.  Many errors are now constructed like
  `Invalid::SomeVariant.at(pos)` (PR #145).
* `Error::error` now takes an `Into<String>` argument (PR #151).
* The module `input` contains types types with `Context<L>`, `Loader`,
  `FsLoader`, and `FsContext`, replacing the old `FileContext` and
  `FsFileContext`.  Also, the types `SourceKind`, `SourceName` and `Parsed`
  are moved from top-level into the `input` module (PR #150).
* The `parse_scss_data` function is removed.  Please create a `SourceFile`
  and use the `parse` method on that instead (PR #150).
* The `Format::write_root` method are removed, `Context::transform`
  should be used instad (PR #152).

Improvements

* `input::Context` is the new main interface to rsass.
  Create a context suitable for how files should be loaded, configure it
  with an output format and optionally extend the global scope before
  calling `Context::transform` with an input file (PR #151, PR #152).
* Also provide `CargoContext` / `CargoLoader` for convenient use in
  build scripts (PR #154).
* The way to get argument values from the implementation of a builtin
  function is refactored to handle both any type that implements
  `TryFrom<Value>` and explicit validation/conversion methods nicer, and is
  now availiable for implementing builtin functions (extensions) outside of
  rsass itself (PR #157).
* The `@content` can have arguments when declaring and calling a mixin
  (PR #146).
* Variable declartions can be scoped (like `module.$var: value`).  Some
  error reporting improvements (PR #148).
* Allow interpolation in css min and max function arguments.
* The url for `@use` and `@forward` must be quoted.
* Improve detection of import loops (PR #150).
* When loading files, Don't apply suffix / index-adding rules if the file
  name already has a suffix (PR #150).
* Some `@` rules are now forbidden in some places as they should (PR #145).
* The css `var(...)` function is now parsed as a proper function, and not
  as a special string (PR #147).
* The null value can be quoted as an empty string (PR #147).
* Make `Debug` formatting of `rsass::Error` look like the `Display` output,
  but without the "Error: " prefix. This makes the error display correctly
  if returned from a main function.  This also removed the "Error: " prefix
  from a lot of message strings (PR #151).
* In error message, don't show ellipses for consecutive lines (PR #147).
* Somtimes a trailing comma in argument lists is preserved (PR #147).
* Simplified `main` of the command-line by returning a `Result` (PR #151).
* Update sass-spec test suite to 2022-09-15.
* Handle tests referencing `input.scss` in spectest (include it among the
  mock files, if mentioned in itself or any existing mock file) (PR #150).
* Use `lazy-regex` in spectest (PR #150).
* Rsass now uses rust edition 2021, so MSRV is 1.56.0 (PR #153).
* Some cleanups.
* The main branch is now named `main` rather than `master`.

Thanks to @fasterthanlime (again) for reporting the problem with
interpolation in min and max.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant