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
11 changes: 0 additions & 11 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion turbopack/crates/turbo-tasks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ regex = { workspace = true }
rustc-hash = { workspace = true }
serde = { workspace = true, features = ["rc", "derive"] }
serde_json = { workspace = true }
serde_regex = "1.1.0"
shrink-to-fit = { workspace=true,features = ["indexmap", "serde_json", "smallvec", "nightly"] }
smallvec = { workspace = true }
thiserror = { workspace = true }
Expand Down
26 changes: 1 addition & 25 deletions turbopack/crates/turbo-tasks/src/primitives.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{ops::Deref, time::Duration};
use std::time::Duration;

use turbo_rcstr::RcStr;
use turbo_tasks_macros::primitive as __turbo_tasks_internal_primitive;
Expand Down Expand Up @@ -33,27 +33,3 @@ __turbo_tasks_internal_primitive!(serde_json::Value);
__turbo_tasks_internal_primitive!(Duration);
__turbo_tasks_internal_primitive!(Vec<u8>, manual_shrink_to_fit);
__turbo_tasks_internal_primitive!(Vec<bool>, manual_shrink_to_fit);

#[turbo_tasks::value(transparent, eq = "manual")]
#[derive(Debug, Clone)]
pub struct Regex(
#[turbo_tasks(trace_ignore)]
#[serde(with = "serde_regex")]
pub regex::Regex,
);

impl Deref for Regex {
type Target = regex::Regex;

fn deref(&self) -> &Self::Target {
&self.0
}
}

impl PartialEq for Regex {
fn eq(&self, other: &Regex) -> bool {
// Context: https://github.com/rust-lang/regex/issues/313#issuecomment-269898900
self.0.as_str() == other.0.as_str()
}
}
impl Eq for Regex {}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ use std::{
mem::{replace, take},
};

use anyhow::{Result, bail};
use anyhow::Result;
use either::Either;
use serde::{Deserialize, Serialize};
use smallvec::SmallVec;
use turbo_esregex::EsRegex;
use turbo_tasks::{NonLocalValue, ReadRef, ResolvedVc, primitives::Regex, trace::TraceRawVcs};
use turbo_tasks::{NonLocalValue, ReadRef, ResolvedVc, trace::TraceRawVcs};
use turbo_tasks_fs::{FileContent, FileSystemPath, glob::Glob};
use turbopack_core::{
asset::Asset, reference_type::ReferenceType, source::Source, virtual_source::VirtualSource,
Expand All @@ -30,7 +30,6 @@ pub enum RuleCondition {
ResourcePathInExactDirectory(FileSystemPath),
ContentTypeStartsWith(String),
ContentTypeEmpty,
ResourcePathRegex(#[turbo_tasks(trace_ignore)] Regex),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ResourcePathEsRegex can contain a rust Regex, so it doesn't seem worth keeping this around, especially because we never implemented it.

ResourcePathEsRegex(#[turbo_tasks(trace_ignore)] ReadRef<EsRegex>),
ResourceContentEsRegex(#[turbo_tasks(trace_ignore)] ReadRef<EsRegex>),
/// For paths that are within the same filesystem as the `base`, it need to
Expand Down Expand Up @@ -268,9 +267,6 @@ impl RuleCondition {
.map_or(path.path.as_str(), |(_, b)| b);
return Ok(glob.matches(basename));
}
RuleCondition::ResourcePathRegex(_) => {
bail!("ResourcePathRegex not implemented yet");
}
RuleCondition::ResourcePathEsRegex(regex) => {
return Ok(regex.is_match(&path.path));
}
Expand Down
Loading