rename compiler crate

This commit is contained in:
Connor Skees 2023-01-08 10:52:53 -05:00
parent 2a9e20d037
commit a6f8b73324
6 changed files with 16 additions and 16 deletions

View File

@ -1,5 +1,5 @@
[package]
name = "compiler"
name = "grass_compiler"
version = "0.12.1"
edition = "2021"
description = "Internal implementation of the grass compiler"
@ -11,7 +11,7 @@ repository = "https://github.com/connorskees/grass"
authors = ["Connor Skees <39542938+ConnorSkees@users.noreply.github.com>"]
[lib]
name = "compiler"
name = "grass_compiler"
path = "src/lib.rs"
# crate-type = ["cdylib", "rlib"]
bench = false

View File

@ -14,7 +14,7 @@ implementation.
## Use as library
```
# use compiler as grass;
# use grass_compiler as grass;
fn main() -> Result<(), Box<grass::Error>> {
let css = grass::from_string(
"a { b { color: &; } }".to_owned(),
@ -187,7 +187,7 @@ fn from_string_with_file_name<P: AsRef<Path>>(
/// n.b. `grass` does not currently support files or paths that are not valid UTF-8
///
/// ```
/// # use compiler as grass;
/// # use grass_compiler as grass;
/// fn main() -> Result<(), Box<grass::Error>> {
/// let css = grass::from_path("input.scss", &grass::Options::default())?;
/// Ok(())
@ -201,7 +201,7 @@ pub fn from_path<P: AsRef<Path>>(p: P, options: &Options) -> Result<String> {
/// Compile CSS from a string
///
/// ```
/// # use compiler as grass;
/// # use grass_compiler as grass;
/// fn main() -> Result<(), Box<grass::Error>> {
/// let css = grass::from_string("a { b { color: &; } }".to_string(), &grass::Options::default())?;
/// assert_eq!(css, "a b {\n color: a b;\n}\n");

View File

@ -16,7 +16,7 @@ proc-macro = true
[dependencies]
syn = { version = "1.0.103", default-features = false }
compiler = { path = "../compiler" }
grass_compiler = { path = "../compiler" }
quote = { version = "1.0.23", default-features = false }
[features]

View File

@ -2,7 +2,7 @@
use std::{cell::RefCell, collections::HashSet, path::PathBuf};
use compiler::StdFs;
use grass_compiler::StdFs;
use proc_macro::TokenStream;
use quote::format_ident;
use syn::{parse_macro_input, LitStr};
@ -12,10 +12,10 @@ use quote::__private::TokenStream as TokenStream2;
#[derive(Debug)]
struct FileTracker<'a> {
files: RefCell<HashSet<PathBuf>>,
fs: &'a dyn compiler::Fs,
fs: &'a dyn grass_compiler::Fs,
}
impl<'a> compiler::Fs for FileTracker<'a> {
impl<'a> grass_compiler::Fs for FileTracker<'a> {
fn is_dir(&self, path: &std::path::Path) -> bool {
#[cfg(feature = "nightly")]
if let Ok(p) = std::fs::canonicalize(path) {
@ -88,7 +88,7 @@ fn finish(css: String, files: &HashSet<PathBuf>) -> TokenStream {
pub fn include_sass(item: TokenStream) -> TokenStream {
let input = parse_macro_input!(item as LitStr);
let options = compiler::Options::default();
let options = grass_compiler::Options::default();
let fs = FileTracker {
files: RefCell::new(HashSet::new()),
@ -97,9 +97,9 @@ pub fn include_sass(item: TokenStream) -> TokenStream {
let value = input.value();
let css = match compiler::from_path(
let css = match grass_compiler::from_path(
value,
&options.fs(&fs).style(compiler::OutputStyle::Compressed),
&options.fs(&fs).style(grass_compiler::OutputStyle::Compressed),
) {
Ok(css) => css,
Err(e) => {

View File

@ -24,7 +24,7 @@ path = "src/lib.rs"
bench = false
[dependencies]
compiler = { path = "../compiler", version = "0.12.1" }
grass_compiler = { path = "../compiler", version = "0.12.1" }
include_sass = { path = "../include_sass", version = "0.12.1", optional = true }
clap = { version = "2.34.0", optional = true }
@ -33,8 +33,8 @@ clap = { version = "2.34.0", optional = true }
default = ["commandline", "random"]
# Option (enabled by default): build a binary using clap
commandline = ["clap"]
random = ["compiler/random"]
wasm-exports = ["compiler/wasm-exports"]
random = ["grass_compiler/random"]
wasm-exports = ["grass_compiler/wasm-exports"]
# Option: include the proc macro `include_sass!`
macro = ["include_sass"]
nightly = ["include_sass/nightly"]

View File

@ -80,7 +80,7 @@ grass input.scss
unknown_lints,
)]
pub use compiler::*;
pub use grass_compiler::*;
/// Include CSS in your binary at compile time from a Sass source file
///