Skip to content

Commit 58d100a

Browse files
authored
Merge branch 'parcel-bundler:master' into master
2 parents e8da081 + 31ce350 commit 58d100a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+9427
-2359
lines changed

Cargo.lock

Lines changed: 28 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ members = [
99
[package]
1010
authors = ["Devon Govett <devongovett@gmail.com>"]
1111
name = "lightningcss"
12-
version = "1.0.0-alpha.40"
12+
version = "1.0.0-alpha.41"
1313
description = "A CSS parser, transformer, and minifier"
1414
license = "MPL-2.0"
1515
edition = "2021"
@@ -47,24 +47,25 @@ substitute_variables = ["visitor", "into_owned"]
4747
[dependencies]
4848
serde = { version = "1.0.123", features = ["derive"], optional = true }
4949
cssparser = "0.29.1"
50-
parcel_selectors = { version = "0.25.2", path = "./selectors" }
50+
parcel_selectors = { version = "0.25.3", path = "./selectors" }
5151
itertools = "0.10.1"
5252
smallvec = { version = "1.7.0", features = ["union"] }
53-
bitflags = "1.3.2"
53+
bitflags = "2.2.1"
5454
parcel_sourcemap = { version = "2.1.1", features = ["json"], optional = true }
5555
data-encoding = "2.3.2"
5656
lazy_static = "1.4.0"
5757
const-str = "0.3.1"
5858
pathdiff = "0.2.1"
5959
ahash = "0.7.6"
60+
paste = "1.0.12"
6061
# CLI deps
6162
atty = { version = "0.2", optional = true }
6263
clap = { version = "3.0.6", features = ["derive"], optional = true }
63-
browserslist-rs = { version = "0.7.0", optional = true }
64+
browserslist-rs = { version = "0.12.3", optional = true }
6465
rayon = { version = "1.5.1", optional = true }
6566
dashmap = { version = "5.0.0", optional = true }
6667
serde_json = { version = "1.0.78", optional = true }
67-
lightningcss-derive = { version = "1.0.0-alpha.37", path = "./derive", optional = true }
68+
lightningcss-derive = { version = "1.0.0-alpha.38", path = "./derive", optional = true }
6869
schemars = { version = "0.8.11", features = ["smallvec"], optional = true }
6970

7071
[target.'cfg(target_os = "macos")'.dependencies]

c/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ crate-type = ["cdylib"]
1111
[dependencies]
1212
lightningcss = { path = "../", features = ["browserslist"] }
1313
parcel_sourcemap = { version = "2.1.1", features = ["json"] }
14-
browserslist-rs = { version = "0.7.0" }
14+
browserslist-rs = { version = "0.12.3" }
1515

1616
[build-dependencies]
1717
cbindgen = "0.24.3"

c/src/lib.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::sync::{Arc, RwLock};
66

77
use lightningcss::css_modules::PatternParseError;
88
use lightningcss::error::{Error, MinifyErrorKind, ParserError, PrinterError};
9-
use lightningcss::stylesheet::{MinifyOptions, ParserOptions, PrinterOptions, StyleSheet};
9+
use lightningcss::stylesheet::{MinifyOptions, ParserFlags, ParserOptions, PrinterOptions, StyleSheet};
1010
use lightningcss::targets::Browsers;
1111
use parcel_sourcemap::SourceMap;
1212

@@ -180,9 +180,9 @@ impl Into<MinifyOptions> for TransformOptions {
180180

181181
MinifyOptions {
182182
targets: if self.targets != Targets::default() {
183-
Some(self.targets.into())
183+
Some(self.targets.into()).into()
184184
} else {
185-
None
185+
Default::default()
186186
},
187187
unused_symbols,
188188
}
@@ -255,14 +255,16 @@ pub extern "C" fn lightningcss_stylesheet_parse(
255255
let slice = unsafe { std::slice::from_raw_parts(source as *const u8, len) };
256256
let code = unsafe { std::str::from_utf8_unchecked(slice) };
257257
let warnings = Arc::new(RwLock::new(Vec::new()));
258+
let mut flags = ParserFlags::empty();
259+
flags.set(ParserFlags::NESTING, options.nesting);
260+
flags.set(ParserFlags::CUSTOM_MEDIA, options.custom_media);
258261
let opts = ParserOptions {
259262
filename: if options.filename.is_null() {
260263
String::new()
261264
} else {
262265
unsafe { std::str::from_utf8_unchecked(CStr::from_ptr(options.filename).to_bytes()).to_owned() }
263266
},
264-
nesting: options.nesting,
265-
custom_media: options.custom_media,
267+
flags,
266268
css_modules: if options.css_modules {
267269
let pattern = if !options.css_modules_pattern.is_null() {
268270
let pattern =
@@ -331,9 +333,9 @@ pub extern "C" fn lightningcss_stylesheet_to_css(
331333
},
332334
source_map: source_map.as_mut(),
333335
targets: if options.targets != Targets::default() {
334-
Some(options.targets.into())
336+
Some(options.targets.into()).into()
335337
} else {
336-
None
338+
Default::default()
337339
},
338340
analyze_dependencies: if options.analyze_dependencies {
339341
Some(Default::default())

derive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
authors = ["Devon Govett <devongovett@gmail.com>"]
33
name = "lightningcss-derive"
44
description = "Derive macros for lightningcss"
5-
version = "1.0.0-alpha.37"
5+
version = "1.0.0-alpha.38"
66
license = "MPL-2.0"
77
edition = "2021"
88
repository = "https://github.com/parcel-bundler/lightningcss"

derive/src/into_owned.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub(crate) fn derive_into_owned(input: TokenStream) -> TokenStream {
9696
quote! {
9797
match self {
9898
#variants
99-
_ => unsafe { std::mem::transmute(self) }
99+
_ => unsafe { std::mem::transmute_copy(&self) }
100100
}
101101
}
102102
}
@@ -110,10 +110,11 @@ pub(crate) fn derive_into_owned(input: TokenStream) -> TokenStream {
110110
let into_owned = if generics.lifetimes().next().is_none() {
111111
panic!("can't derive IntoOwned on a type without any lifetimes")
112112
} else {
113+
let params = generics.type_params();
113114
quote! {
114115
impl #impl_generics #self_name #ty_generics #where_clause {
115116
/// Consumes the value and returns an owned clone.
116-
pub fn into_owned<'x>(self) -> #self_name<'x> {
117+
pub fn into_owned<'x>(self) -> #self_name<'x, #(#params),*> {
117118
#res
118119
}
119120
}

0 commit comments

Comments
 (0)