Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ff98e6d
copy `ignore` crate for easier modifications
RobinMalfait Mar 17, 2025
18442be
manually apply patches to inlined `ignore` crate
RobinMalfait Mar 17, 2025
22bd00f
run all CI tests when `[ci-all]` exists in PR description
RobinMalfait Mar 21, 2025
ba153be
big refactor, move `Scanner` to `scanner/mod.rs`
RobinMalfait Mar 21, 2025
72b18cd
simplify `scanner` test setup
RobinMalfait Mar 21, 2025
cd6ccb2
add new Scanner tests
RobinMalfait Mar 21, 2025
324569c
update public Rust API
RobinMalfait Mar 21, 2025
335e9e1
update use statements due to big refactor
RobinMalfait Mar 21, 2025
88a6048
rename `globs` to `sources`
RobinMalfait Mar 21, 2025
602a801
add `negated` flag to `sources`
RobinMalfait Mar 21, 2025
9798637
add missing `reference` property
RobinMalfait Mar 21, 2025
9958612
update integration tests
RobinMalfait Mar 21, 2025
878782e
use `normalizedSources` in the CLI
RobinMalfait Mar 21, 2025
a7bef4e
add `.gitignore` as a default ignored file
RobinMalfait Mar 21, 2025
8d154d1
add `node_modules` as a default ignored folder
RobinMalfait Mar 21, 2025
38ed37e
add `enableSourceNot` feature flag
RobinMalfait Mar 21, 2025
0f73797
run prettier
RobinMalfait Mar 21, 2025
97fc4bf
Simplify gitignore order change
philipp-spiess Mar 25, 2025
94473d3
Rename GitHub CI var
philipp-spiess Mar 25, 2025
7442baa
Explicitly mark test functions
philipp-spiess Mar 25, 2025
2425aef
Handle source paths into ignored content dirs as "external"
philipp-spiess Mar 25, 2025
bb0610d
Revert "Explicitly mark test functions"
philipp-spiess Mar 25, 2025
6952871
Explicitly mark test functions
philipp-spiess Mar 25, 2025
b6ab98f
Cleanup comment
philipp-spiess Mar 25, 2025
5e7d035
Cleanup public source entry creation
philipp-spiess Mar 25, 2025
9d4c2af
Cleanups and test utf8 special characters in paths
philipp-spiess Mar 25, 2025
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
Cleanups and test utf8 special characters in paths
  • Loading branch information
philipp-spiess committed Mar 25, 2025
commit 9d4c2af7f18119c707f446c032b01dc6391ec5ff
2 changes: 1 addition & 1 deletion crates/oxide/src/extractor/pre_processors/ruby.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::cursor;
use crate::extractor::bracket_stack;
use crate::extractor::pre_processors::pre_processor::PreProcessor;
use crate::pre_process_input;
use crate::scanner::pre_process_input;
use bstr::ByteSlice;
use fancy_regex::Regex;
use std::sync;
Expand Down
21 changes: 11 additions & 10 deletions crates/oxide/src/scanner/sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,18 @@ impl PublicSourceEntry {

let base: PathBuf = self.base.clone().into();
let base = match static_part {
Some(static_part) => base.join(static_part),
None => base,
};

// TODO: If the base does not exist on disk, try removing the last slash and try again.
let base = match dunce::canonicalize(&base) {
Ok(base) => base,
Err(err) => {
event!(tracing::Level::ERROR, "Failed to resolve glob: {:?}", err);
return;
Some(static_part) => {
// TODO: If the base does not exist on disk, try removing the last slash and try
// again.
match dunce::canonicalize(base.join(static_part)) {
Ok(base) => base,
Err(err) => {
event!(tracing::Level::ERROR, "Failed to resolve glob: {:?}", err);
return;
}
}
}
None => base,
};

let pattern = match dynamic_part {
Expand Down
26 changes: 26 additions & 0 deletions crates/oxide/tests/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1585,4 +1585,30 @@ mod scanner {

assert!(candidates.is_empty());
}

#[test]
fn test_works_with_utf8_special_character_paths() {
let ScanResult {
candidates,
files,
globs,
normalized_sources,
} = scan_with_globs(
&[
("src/💩.js", "content-['src/💩.js']"),
("src/🤦‍♂️.tsx", "content-['src/🤦‍♂️.tsx']"),
("src/🤦‍♂️/foo.tsx", "content-['src/🤦‍♂️/foo.tsx']"),
],
vec!["@source '**/*'", "@source not 'src/🤦‍♂️'"],
);

assert_eq!(
candidates,
vec!["content-['src/💩.js']", "content-['src/🤦‍♂️.tsx']"]
);

assert_eq!(files, vec!["src/💩.js", "src/🤦‍♂️.tsx"]);
assert_eq!(globs, vec!["*", "src/*/*.{aspx,astro,cjs,cts,eex,erb,gjs,gts,haml,handlebars,hbs,heex,html,jade,js,jsx,liquid,md,mdx,mjs,mts,mustache,njk,nunjucks,php,pug,py,razor,rb,rhtml,rs,slim,svelte,tpl,ts,tsx,twig,vue}"]);
assert_eq!(normalized_sources, vec!["**/*"]);
}
}