Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a5407e3
allow to pass in the `!important` flag
RobinMalfait Dec 3, 2024
29cc49d
implement `postCssAstToCssAst` and `cssAstToPostCssAst`
RobinMalfait Dec 3, 2024
94aeeab
optimize AST before printing
RobinMalfait Dec 3, 2024
7eefb19
implement new `compileAst(…)` and update `compile(…)`
RobinMalfait Dec 3, 2024
531670b
expose `compileAst` from `@tailwindcss/node`
RobinMalfait Dec 3, 2024
6cabeea
WIP: PostCSS implementation
RobinMalfait Dec 3, 2024
42401b4
Tweak code
thecrypticace Dec 3, 2024
0e954b2
Convert our AST to PostCSS’s AST
thecrypticace Dec 3, 2024
79cadb8
Pass through source information
thecrypticace Dec 3, 2024
2adaf42
print CSS from our own AST
RobinMalfait Dec 4, 2024
ef17c45
only convert our AST into a PostCSS AST when not optimizing
RobinMalfait Dec 4, 2024
f006e36
remove unused variable
RobinMalfait Dec 4, 2024
709947c
rename variables to be more explicit
RobinMalfait Dec 4, 2024
a4df476
add timing info around `cssAstToPostCssAst(…)`
RobinMalfait Dec 4, 2024
71c1c0d
restructure `build(…)`
RobinMalfait Dec 4, 2024
a24e4c4
track the `tailwindCssAst` for subsequent cache hits
RobinMalfait Dec 4, 2024
260beed
ensure PostCSS AST nodes have semicolons
RobinMalfait Dec 4, 2024
87065a8
handle comments correctly
RobinMalfait Dec 4, 2024
3de1864
compute current_mtimes in parallel per file/directory
RobinMalfait Dec 4, 2024
98f66cb
remove instrumentation from `read_dir`
RobinMalfait Dec 4, 2024
84bde5e
trick PostCSS into using 2 spaces instead of 4
RobinMalfait Dec 4, 2024
7aeea03
use `??=` shorthand
RobinMalfait Dec 4, 2024
1a04957
ensure `compile` and `compileAst` re-use the same logic
RobinMalfait Dec 4, 2024
5f22986
run format
RobinMalfait Dec 4, 2024
c5c7c9f
clone the cached PostCSS tree before appending it to the root
RobinMalfait Dec 4, 2024
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
Prev Previous commit
Next Next commit
compute current_mtimes in parallel per file/directory
  • Loading branch information
RobinMalfait committed Dec 4, 2024
commit 3de1864b593a7130bb96df4316988e3e8875e91b
32 changes: 23 additions & 9 deletions crates/oxide/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,18 @@ impl Scanner {
fn compute_candidates(&mut self) {
let mut changed_content = vec![];

for path in &self.files {
let current_time = fs::metadata(path)
.and_then(|m| m.modified())
.unwrap_or(SystemTime::now());
let current_mtimes = self
.files
.par_iter()
.map(|path| {
fs::metadata(path)
.and_then(|m| m.modified())
.unwrap_or(SystemTime::now())
})
.collect::<Vec<_>>();

for (idx, path) in self.files.iter().enumerate() {
let current_time = current_mtimes[idx];
let previous_time = self.mtimes.insert(path.clone(), current_time);

let should_scan_file = match previous_time {
Expand Down Expand Up @@ -218,14 +225,21 @@ impl Scanner {

#[tracing::instrument(skip_all)]
fn check_for_new_files(&mut self) {
let current_mtimes = self
.dirs
.par_iter()
.map(|path| {
fs::metadata(path)
.and_then(|m| m.modified())
.unwrap_or(SystemTime::now())
})
.collect::<Vec<_>>();

let mut modified_dirs: Vec<PathBuf> = vec![];

// Check all directories to see if they were modified
for path in &self.dirs {
let current_time = fs::metadata(path)
.and_then(|m| m.modified())
.unwrap_or(SystemTime::now());

for (idx, path) in self.dirs.iter().enumerate() {
let current_time = current_mtimes[idx];
let previous_time = self.mtimes.insert(path.clone(), current_time);

let should_scan = match previous_time {
Expand Down