Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fail-fast: false
matrix:
include:
- package: rspack_lightningcss
- package: rspack-lightningcss
bench: transform

steps:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release-crates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ permissions:
contents: read

concurrency:
group: release-rspack-lightningcss-crate
group: release-rspack-lightningcss-${{ inputs.dry_run && github.run_id || 'publish' }}
cancel-in-progress: false

jobs:
release-crates:
runs-on: ubuntu-latest
name: Release Rust crate
name: Release Rust crates
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Install Rust
uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
- name: Validate crate
run: cargo publish -p rspack_lightningcss --dry-run
- name: Publish crate
- name: Validate workspace crates
run: cargo publish --workspace --dry-run
- name: Publish workspace crates
if: ${{ !inputs.dry_run }}
run: cargo publish -p rspack_lightningcss
run: cargo publish --workspace
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ jobs:
- run: cargo fmt
- run: cargo test --all-features

validate-crates:
uses: ./.github/workflows/release-crates.yml
with:
dry_run: true

test-js:
runs-on: ubuntu-latest
steps:
Expand Down
174 changes: 87 additions & 87 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 26 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"node",
"napi",
Expand All @@ -9,15 +10,27 @@ members = [
"static-self-derive",
]

[workspace.package]
version = "0.1.0"
repository = "https://github.com/rstackjs/lightningcss"

[workspace.dependencies]
rspack-lightningcss = { version = "=0.1.0", path = "." }
rspack-lightningcss-derive = { version = "=0.1.0", path = "derive" }
rspack-lightningcss-napi = { version = "=0.1.0", path = "napi" }
rspack-lightningcss-selectors = { version = "=0.1.0", path = "selectors" }
rspack-lightningcss-static-self = { version = "=0.1.0", path = "static-self" }
rspack-lightningcss-static-self-derive = { version = "=0.1.0", path = "static-self-derive" }

[package]
authors = ["Devon Govett <devongovett@gmail.com>"]
name = "rspack_lightningcss"
version = "0.1.0"
name = "rspack-lightningcss"
version.workspace = true
description = "A CSS parser, transformer, and minifier"
license = "MPL-2.0"
edition = "2021"
keywords = ["CSS", "minifier", "Parcel"]
repository = "https://github.com/rstackjs/lightningcss"
repository.workspace = true

[package.metadata.docs.rs]
all-features = true
Expand All @@ -38,25 +51,25 @@ default = ["bundler", "nodejs", "sourcemap"]
browserslist = ["browserslist-rs"]
bundler = ["dashmap", "custom_sourcemap", "rayon"]
cli = ["clap", "serde_json", "browserslist", "jemallocator", "sourcemap"]
jsonschema = ["schemars", "serde", "parcel_selectors/jsonschema"]
jsonschema = ["schemars", "serde", "rspack-lightningcss-selectors/jsonschema"]
nodejs = ["dep:serde", "dep:serde-content"]
serde = [
"dep:serde",
"dep:serde-content",
"bitflags/serde",
"smallvec/serde",
"cssparser/serde",
"parcel_selectors/serde",
"rspack-lightningcss-selectors/serde",
"into_owned",
]
sourcemap = ["custom_sourcemap", "dep:parcel_sourcemap"]
custom_sourcemap = ["dep:rustc-hash"]
visitor = []
into_owned = [
"static-self",
"static-self/smallvec",
"static-self/indexmap",
"parcel_selectors/into_owned",
"rspack-lightningcss-static-self",
"rspack-lightningcss-static-self/smallvec",
"rspack-lightningcss-static-self/indexmap",
"rspack-lightningcss-selectors/into_owned",
]
substitute_variables = ["visitor", "into_owned"]

Expand All @@ -65,7 +78,7 @@ serde = { version = "1.0.228", features = ["derive"], optional = true }
serde-content = { version = "0.1.2", features = ["serde"], optional = true }
cssparser = "0.37.0"
cssparser-color = "0.5.0"
parcel_selectors = { version = "0.28.3", path = "./selectors" }
rspack-lightningcss-selectors.workspace = true
itertools = "0.10.1"
smallvec = { version = "1.7.0", features = ["union"] }
bitflags = "2.2.1"
Expand All @@ -84,12 +97,12 @@ browserslist-rs = { version = "0.21.0", optional = true }
rayon = { version = "1.5.1", optional = true }
dashmap = { version = "5.0.0", optional = true }
serde_json = { version = "1.0.78", optional = true }
lightningcss-derive = { version = "=1.0.0-alpha.43", path = "./derive" }
rspack-lightningcss-derive.workspace = true
schemars = { version = "0.8.19", features = [
"smallvec",
"indexmap2",
], optional = true }
static-self = { version = "0.1.2", path = "static-self", optional = true }
rspack-lightningcss-static-self = { workspace = true, optional = true }

[target.'cfg(target_os = "macos")'.dependencies]
jemallocator = { version = "0.3.2", features = [
Expand All @@ -106,7 +119,7 @@ assert_fs = "1.0"
predicates = "2.1"
serde_json = "1"
pretty_assertions = "1.4.0"
criterion = { package = "codspeed-criterion-compat", version = "4.5.0" }
codspeed-criterion-compat = "4.5.0"

[[test]]
name = "cli_integration_tests"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
> [!NOTE]
> **Rspack fork:** This repository maintains Lightning CSS for Rspack integration and independent releases. The upstream project is [parcel-bundler/lightningcss](https://github.com/parcel-bundler/lightningcss).
>
> - **Rust:** Use `rspack_lightningcss`. Its version starts at `0.1.0` and is independent of upstream Lightning CSS versions.
> - **Rust:** Use `rspack-lightningcss` (imported as `rspack_lightningcss`). Its version starts at `0.1.0` and is independent of upstream Lightning CSS versions.
> - **npm:** The package names are `rspack_lightningcss`, `rspack_lightningcss-cli`, and `rspack_lightningcss-wasm`. The CLI command remains `lightningcss`.
> - **Rust workspace:** All crates use the `rspack-` prefix and share version `0.1.0`. Internal dependency names and versions are declared in `[workspace.dependencies]`; dependency keys and Rust imports use the same package names without dependency aliases. `release-crates` validates and publishes all publishable members together, so the fork's derive and selector crates are used when verifying the published package.
> - **Publishing:** Manually run `release-crates` for Rust, or `release` for npm/CLI/WASM and Rust. Both support `dry_run` to validate without publishing; pushes and tags do not automatically publish packages.
>
> The original upstream README is preserved below. Its package names and links refer to upstream Lightning CSS; use the fork's package names when integrating this repository.
Expand Down
2 changes: 1 addition & 1 deletion benches/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use criterion::black_box;
use codspeed_criterion_compat::black_box;
use parcel_sourcemap::SourceMap;
use rspack_lightningcss::stylesheet::{MinifyOptions, ParserOptions, PrinterOptions, StyleSheet};
use std::fmt::Write;
Expand Down
2 changes: 1 addition & 1 deletion benches/transform.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod common;

use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};

fn bench_stylesheet_parse(c: &mut Criterion) {
let fixtures = common::stylesheet_fixtures();
Expand Down
Loading
Loading