From 2cd81ccb0f8bbeee637e65c113f46b0b12d8c1b6 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Tue, 16 Jun 2020 20:40:19 -0400 Subject: [PATCH] bump version to 0.9.0 --- CHANGELOG.md | 20 ++++++++++++++++ Cargo.toml | 2 +- src/lib.rs | 39 ++++++++++++++++++++++++++++++-- src/main.rs | 1 + src/parse/mod.rs | 3 --- src/selector/extend/extension.rs | 2 -- 6 files changed, 59 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 482061b..ef4749e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ +# 0.9.0 + +This release is focused on setting up the groundwork for implementing `@extend` as well +as being able to compile Bootstrap. + - Implement all builtin selector functions + - `selector-append` + - `selector-extend` + - `selector-nest` + - `selector-parse` + - `selector-replace` + - `selector-unify` + - `simple-selectors` + - `is-superselector` + - Implement builtin function `content-exists` + - Allow `@import`, `@warn`, and `@debug` in all contexts, such as inside `@mixin` + - Refactor control flow evaluation, resolving some issues blocking Bootstrap + +#### Breaking Changes + - remove the `StyleSheet` struct in favor of freestanding functions, `from_string` and `from_path` + # 0.8.3 This release is largely focused on performance and robustness diff --git a/Cargo.toml b/Cargo.toml index 5a5e8ed..ac2165a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grass" -version = "0.8.3" +version = "0.9.0" description = "SASS compiler" readme = "README.md" license = "MIT" diff --git a/src/lib.rs b/src/lib.rs index 912d401..1351e0e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,7 +7,7 @@ Spec progress as of 2020-05-01: | Passing | Failing | Total | |---------|---------|-------| -| 2193 | 2900 | 5093 | +| 2489 | 2604 | 5093 | ## Use as library ``` @@ -88,6 +88,9 @@ grass input.scss #![cfg_attr(feature = "profiling", inline(never))] use std::{fs, path::Path}; +#[cfg(feature = "wasm")] +use wasm_bindgen::prelude::*; + #[cfg(target_pointer_width = "64")] pub(crate) use beef::lean::Cow; #[cfg(not(target_pointer_width = "64"))] @@ -179,9 +182,9 @@ pub fn from_path(p: &str) -> Result { /// Ok(()) /// } /// ``` -#[cfg_attr(feature = "wasm", wasm_bindgen)] #[cfg_attr(feature = "profiling", inline(never))] #[cfg_attr(not(feature = "profiling"), inline)] +#[cfg(not(feature = "wasm"))] pub fn from_string(p: String) -> Result { let mut map = CodeMap::new(); let file = map.add_file("stdin".into(), p); @@ -211,3 +214,35 @@ pub fn from_string(p: String) -> Result { .pretty_print(&map) .map_err(|e| raw_to_parse_error(&map, e)) } + +#[cfg(feature = "wasm")] +#[wasm_bindgen] +pub fn from_string(p: String) -> std::result::Result { + let mut map = CodeMap::new(); + let file = map.add_file("stdin".into(), p); + Ok(Css::from_stmts( + Parser { + toks: &mut Lexer::new(&file) + .collect::>() + .into_iter() + .peekmore(), + map: &mut map, + path: Path::new(""), + scopes: &mut NeverEmptyVec::new(Scope::new()), + global_scope: &mut Scope::new(), + super_selectors: &mut NeverEmptyVec::new(Selector::new()), + span_before: file.span.subspan(0, 0), + content: None, + in_mixin: false, + in_function: false, + in_control_flow: false, + at_root: true, + at_root_has_selector: false, + } + .parse() + .map_err(|e| raw_to_parse_error(&map, e).to_string())?, + ) + .map_err(|e| raw_to_parse_error(&map, e).to_string())? + .pretty_print(&map) + .map_err(|e| raw_to_parse_error(&map, e).to_string())?) +} diff --git a/src/main.rs b/src/main.rs index 27b4b51..c9704e3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,6 +5,7 @@ use std::{ use clap::{arg_enum, App, Arg}; +#[cfg(not(feature = "wasm"))] use grass::from_path; arg_enum! { diff --git a/src/parse/mod.rs b/src/parse/mod.rs index c5fe083..f68a85e 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -31,9 +31,6 @@ use crate::{ use common::{Branch, NeverEmptyVec, SelectorOrStyle}; -#[cfg(feature = "wasm")] -use wasm_bindgen::prelude::*; - mod args; pub mod common; mod ident; diff --git a/src/selector/extend/extension.rs b/src/selector/extend/extension.rs index d75e836..d7a2317 100644 --- a/src/selector/extend/extension.rs +++ b/src/selector/extend/extension.rs @@ -1,7 +1,5 @@ use codemap::Span; -use crate::error::SassResult; - use super::{ComplexSelector, CssMediaQuery, SimpleSelector}; #[derive(Clone, Debug, Eq, PartialEq, Hash)]