Skip to content

Commit 1583dd1

Browse files
committed
Merge branch 'master' of github.com:devongovett/rust-css-transformer
2 parents 406a6b7 + 78ab48f commit 1583dd1

File tree

10 files changed

+653
-386
lines changed

10 files changed

+653
-386
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ 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.1", path = "./selectors" }
50+
parcel_selectors = { version = "0.25.2", path = "./selectors" }
5151
itertools = "0.10.1"
5252
smallvec = { version = "1.7.0", features = ["union"] }
5353
bitflags = "1.3.2"

c/cbindgen.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language = "C"
22

33
[parse]
4-
parse_deps = true
4+
parse_deps = false
55
include = ["lightningcss"]
66

77
[export.rename]

c/lightningcss.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ typedef struct ToCssOptions {
124124
bool source_map;
125125
const char *input_source_map;
126126
uintptr_t input_source_map_len;
127+
const char *project_root;
127128
struct Targets targets;
128129
bool analyze_dependencies;
129130
struct PseudoClasses pseudo_classes;

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"main": "node/index.js",
77
"types": "node/index.d.ts",
88
"exports": {
9+
"types": "./node/index.d.ts",
910
"import": "./node/index.mjs",
1011
"require": "./node/index.js"
1112
},

selectors/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[package]
22
name = "parcel_selectors"
3-
version = "0.25.1"
3+
version = "0.25.2"
44
authors = ["The Servo Project Developers"]
5-
documentation = "https://docs.rs/selectors/"
5+
documentation = "https://docs.rs/parcel_selectors/"
66
description = "CSS Selectors matching for Rust - forked for lightningcss"
7-
repository = "https://github.com/servo/servo"
7+
repository = "https://github.com/parcel-bundler/lightningcss"
88
readme = "README.md"
99
keywords = ["css", "selectors"]
1010
license = "MPL-2.0"
@@ -23,11 +23,11 @@ bitflags = "1.0"
2323
cssparser = "0.29"
2424
fxhash = "0.2"
2525
log = "0.4"
26-
phf = "0.8"
26+
phf = "0.10"
2727
precomputed-hash = "0.1"
2828
smallvec = "1.0"
2929
serde = { version = "1.0.123", features = ["derive"], optional = true }
3030
schemars = { version = "0.8.11", features = ["smallvec"], optional = true }
3131

3232
[build-dependencies]
33-
phf_codegen = "0.8"
33+
phf_codegen = "0.10"

src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ pub fn main() -> Result<(), std::io::Error> {
217217
}
218218
}
219219

220+
let output_path = Path::new(output_file);
221+
if let Some(p) = output_path.parent() {
222+
fs::create_dir_all(p)?
223+
};
220224
fs::write(output_file, code.as_bytes())?;
221225

222226
if let Some(css_modules) = cli_args.css_modules {

tests/cli_integration_tests.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use indoc::indoc;
55
use lightningcss::css_modules::CssModuleExport;
66
use predicates::prelude::*;
77
use std::collections::HashMap;
8+
use std::fs;
89
use std::process::Command;
910

1011
fn test_file() -> Result<assert_fs::NamedTempFile, FixtureError> {
@@ -182,6 +183,28 @@ fn output_file_option() -> Result<(), Box<dyn std::error::Error>> {
182183
Ok(())
183184
}
184185

186+
#[test]
187+
fn output_file_option_create_missing_directories() -> Result<(), Box<dyn std::error::Error>> {
188+
let infile = test_file()?;
189+
let outdir = assert_fs::TempDir::new()?;
190+
let outfile = outdir.child("out.css");
191+
outdir.close()?;
192+
let mut cmd = Command::cargo_bin("lightningcss")?;
193+
cmd.arg(infile.path());
194+
cmd.arg("--output-file").arg(outfile.path());
195+
cmd.assert().success();
196+
outfile.assert(predicate::str::contains(indoc! {
197+
r#"
198+
.foo {
199+
border: none;
200+
}
201+
"#
202+
}));
203+
fs::remove_dir_all(outfile.parent().unwrap())?;
204+
205+
Ok(())
206+
}
207+
185208
#[test]
186209
fn minify_option() -> Result<(), Box<dyn std::error::Error>> {
187210
let infile = test_file()?;

website/docs.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ header .title {
6464
text-decoration: none;
6565
}
6666

67+
header .title::selection {
68+
-webkit-text-stroke-color: #fffddd;
69+
background-color: var(--gold-text);
70+
}
71+
6772
h1, h2, h3 {
6873
font-family: urbane-rounded, ui-rounded;
6974
font-weight: 600;

website/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,11 @@ <h3>Browser grade</h3>
263263
letter-spacing: -0.02em;
264264
}
265265

266+
header h1::selection {
267+
-webkit-text-stroke-color: #fffddd;
268+
background-color: var(--gold-text);
269+
}
270+
266271
header h2 {
267272
font-family: urbane-rounded;
268273
color: lch(65% 85 35);

0 commit comments

Comments
 (0)