From b8abf47fa2b907e7a061834754896aeee7b4b174 Mon Sep 17 00:00:00 2001 From: Jinbao1001 Date: Wed, 24 Jul 2024 14:15:04 +0800 Subject: [PATCH] chore: ignorePath to Options --- crates/binding/src/lib.rs | 1 + crates/mako/src/config/config.rs | 4 ++-- crates/mako/src/dev/watch.rs | 4 ++++ packages/mako/binding.d.ts | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/binding/src/lib.rs b/crates/binding/src/lib.rs index 90a76dfd7..38242612a 100644 --- a/crates/binding/src/lib.rs +++ b/crates/binding/src/lib.rs @@ -168,6 +168,7 @@ pub struct BuildParams { }; watch?: { ignoredPaths?: string[]; + nodeModulesRegexes?: string[]; }; }"#)] pub config: serde_json::Value, diff --git a/crates/mako/src/config/config.rs b/crates/mako/src/config/config.rs index 08f38c126..08c815f1b 100644 --- a/crates/mako/src/config/config.rs +++ b/crates/mako/src/config/config.rs @@ -445,8 +445,8 @@ pub struct ExperimentalConfig { #[derive(Deserialize, Serialize, Debug)] #[serde(rename_all = "camelCase")] pub struct WatchConfig { - pub ignore_paths: Vec, - pub node_modules_regexes: Vec, + pub ignore_paths: Option>, + pub node_modules_regexes: Option>, } #[derive(Deserialize, Serialize, Debug)] diff --git a/crates/mako/src/dev/watch.rs b/crates/mako/src/dev/watch.rs index e1aee98c7..a62fb52d8 100644 --- a/crates/mako/src/dev/watch.rs +++ b/crates/mako/src/dev/watch.rs @@ -39,6 +39,8 @@ impl<'a> Watcher<'a> { .config .watch .node_modules_regexes + .clone() + .unwrap_or_default() .iter() .map(|s| Regex::new(s).unwrap()) .collect::>(), @@ -125,6 +127,8 @@ impl<'a> Watcher<'a> { .config .watch .ignore_paths + .as_deref() + .unwrap_or(&[]) .iter() .map(|p| p.as_str()), ); diff --git a/packages/mako/binding.d.ts b/packages/mako/binding.d.ts index 2f8916ca1..55598dfd6 100644 --- a/packages/mako/binding.d.ts +++ b/packages/mako/binding.d.ts @@ -183,6 +183,7 @@ export interface BuildParams { }; watch?: { ignoredPaths?: string[]; + nodeModulesRegexes?: string[]; }; }; plugins: Array;