Skip to content

Commit d7fc281

Browse files
Use json preprocessor for new-line delimited JSON files (#19862)
## Summary This specializes the `.jsonl` and `.ndjson` file extensions so they're preprocessed like JSON instead of by the standard scanner. This prevents them from creating thousands of sub machines and reduces scanning time (see #17125 where this was done for `.json` files). It seems reasonable to handle new-line delimited JSON files as well otherwise scanning these files can take quite a long time. It's quite unlikely that these will contain classes so, alternatively, these *could* go in the binary extensions list so they get ignored entirely. ## Test plan I ran manual tests inside the `oxide` crate against some large-ish JSONL files (5MB–15MB). These changes bring down scanning time from 2s–3s on my M3 Max (via `cargo test --release …`) to less than 20ms. I also ran tests through a full CLI build pipeline on a low-spec linux box. This change brought scanning time down from ~90s to ~300ms for a single ~15MB file.
1 parent df6209a commit d7fc281

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3232
- Canonicalization: migrate `end-full``inset-e-full`, `end-auto``inset-e-auto`, `end-px``inset-e-px`, and `end-<number>``inset-e-<number>` as well as negative versions ([#19849](https://github.com/tailwindlabs/tailwindcss/pull/19849))
3333
- Canonicalization: move the `-` sign inside the arbitrary value `-left-[9rem]``left-[-9rem]` ([#19858](https://github.com/tailwindlabs/tailwindcss/pull/19858))
3434
- Canonicalization: move the `-` sign outside the arbitrary value `ml-[calc(-1*var(--width))]``-ml-(--width)` ([#19858](https://github.com/tailwindlabs/tailwindcss/pull/19858))
35+
- Improve performance when scanning JSONL / NDJSON files ([#19862](https://github.com/tailwindlabs/tailwindcss/pull/19862))
3536

3637
## [4.2.2] - 2026-03-18
3738

crates/oxide/src/scanner/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ pub fn pre_process_input(content: Vec<u8>, extension: &str) -> Vec<u8> {
474474
"heex" | "eex" | "ex" | "exs" => Elixir.process(&content),
475475
"cshtml" | "razor" => Razor.process(&content),
476476
"haml" => Haml.process(&content),
477-
"json" => Json.process(&content),
477+
"json" | "jsonl" | "ndjson" => Json.process(&content),
478478
"md" | "mdx" => Markdown.process(&content),
479479
"pug" => Pug.process(&content),
480480
"rb" | "erb" => Ruby.process(&content),

0 commit comments

Comments
 (0)