dart-decimate 0.0.34 → 0.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Cargo.lock CHANGED
@@ -102,7 +102,7 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
102
102
 
103
103
  [[package]]
104
104
  name = "dart-decimate"
105
- version = "0.0.34"
105
+ version = "0.0.36"
106
106
  dependencies = [
107
107
  "clap",
108
108
  "glob",
package/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "dart-decimate"
3
- version = "0.0.34"
3
+ version = "0.0.36"
4
4
  edition = "2024"
5
5
  rust-version = "1.85"
6
6
  description = "Rust-native codebase intelligence for Dart and Flutter module graphs."
@@ -7,12 +7,16 @@ const { spawnSync } = require("node:child_process");
7
7
 
8
8
  const root = join(__dirname, "..", "..");
9
9
  const tempDir = mkdtempSync(join(tmpdir(), "dart-decimate-npx-"));
10
+ const npmEnv = {
11
+ ...process.env,
12
+ npm_config_cache: join(tempDir, "npm-cache"),
13
+ };
10
14
 
11
15
  try {
12
16
  const pack = spawnSync(
13
17
  "npm",
14
18
  ["pack", "--json", "--pack-destination", tempDir],
15
- { cwd: root, encoding: "utf8" },
19
+ { cwd: root, encoding: "utf8", env: npmEnv },
16
20
  );
17
21
  if (pack.error) {
18
22
  process.stderr.write(`failed to execute npm: ${pack.error.message}\n`);
@@ -31,7 +35,7 @@ try {
31
35
  ["--yes", "--package", tarball, "--", "dart-decimate", "--help"],
32
36
  {
33
37
  encoding: "utf8",
34
- env: { ...process.env, DART_DECIMATE_SKIP_DOWNLOAD: "1" },
38
+ env: { ...npmEnv, DART_DECIMATE_SKIP_DOWNLOAD: "1" },
35
39
  },
36
40
  );
37
41
  if (result.stdout) {
@@ -7,12 +7,16 @@ const { spawnSync } = require("child_process");
7
7
 
8
8
  const root = join(__dirname, "..", "..");
9
9
  const tempDir = mkdtempSync(join(tmpdir(), "dart-decimate-npx-mcp-"));
10
+ const npmEnv = {
11
+ ...process.env,
12
+ npm_config_cache: join(tempDir, "npm-cache"),
13
+ };
10
14
 
11
15
  try {
12
16
  const pack = spawnSync(
13
17
  "npm",
14
18
  ["pack", "--json", "--pack-destination", tempDir],
15
- { cwd: root, encoding: "utf8" },
19
+ { cwd: root, encoding: "utf8", env: npmEnv },
16
20
  );
17
21
  if (pack.error) {
18
22
  process.stderr.write(`failed to execute npm: ${pack.error.message}\n`);
@@ -34,7 +38,7 @@ try {
34
38
  {
35
39
  input: initialize,
36
40
  encoding: "utf8",
37
- env: { ...process.env, DART_DECIMATE_SKIP_DOWNLOAD: "1" },
41
+ env: { ...npmEnv, DART_DECIMATE_SKIP_DOWNLOAD: "1" },
38
42
  },
39
43
  );
40
44
  if (result.stdout) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dart-decimate",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "description": "Rust-native codebase intelligence for Dart and Flutter module graphs.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -52,7 +52,6 @@
52
52
  "access": "public"
53
53
  },
54
54
  "devDependencies": {
55
- "fallow": "3.15.0",
56
55
  "oxlint": "1.78.0",
57
56
  "prettier": "3.9.6"
58
57
  }
@@ -6,8 +6,7 @@ pub(crate) fn package_used_in_tooling(package_root: &Path, dependency: &str) ->
6
6
  || known_tooling_convention(package_root, dependency)
7
7
  || tooling_files(package_root).into_iter().any(|path| {
8
8
  fs::read_to_string(path)
9
- .ok()
10
- .is_some_and(|source| source_mentions_dependency(&source, dependency))
9
+ .is_ok_and(|source| source_mentions_dependency(&source, dependency))
11
10
  })
12
11
  }
13
12
 
@@ -33,7 +32,7 @@ fn contains_runnable_test(dir: &Path) -> bool {
33
32
  };
34
33
  entries.flatten().any(|entry| {
35
34
  let path = entry.path();
36
- entry.file_type().ok().is_some_and(|file_type| {
35
+ entry.file_type().is_ok_and(|file_type| {
37
36
  file_type.is_file() && is_runnable_test_file(&path)
38
37
  || file_type.is_dir() && contains_runnable_test(&path)
39
38
  })
@@ -52,8 +51,7 @@ fn is_runnable_test_file(path: &Path) -> bool {
52
51
  return true;
53
52
  }
54
53
  crate::extract_dart_file(path)
55
- .ok()
56
- .is_some_and(|file| crate::extract::has_top_level_function(&file, "main"))
54
+ .is_ok_and(|file| crate::extract::has_top_level_function(&file, "main"))
57
55
  }
58
56
 
59
57
  fn tooling_files(package_root: &Path) -> Vec<PathBuf> {
@@ -746,9 +746,7 @@ fn parse_numeric_literal(source: &str) -> Option<Rational> {
746
746
  } else {
747
747
  (normalized, 0)
748
748
  };
749
- let (whole, fraction) = mantissa
750
- .split_once('.')
751
- .map_or((mantissa, ""), |parts| parts);
749
+ let (whole, fraction) = mantissa.split_once('.').unwrap_or((mantissa, ""));
752
750
  if fraction.contains('.') || (whole.is_empty() && fraction.is_empty()) {
753
751
  return None;
754
752
  }
@@ -74,9 +74,7 @@ pub(super) fn claude_settings_status(
74
74
  }
75
75
 
76
76
  fn settings_source_has_agent_command(source: &str) -> bool {
77
- serde_json::from_str::<Value>(source)
78
- .ok()
79
- .is_some_and(|value| value_has_agent_command(&value))
77
+ serde_json::from_str::<Value>(source).is_ok_and(|value| value_has_agent_command(&value))
80
78
  }
81
79
 
82
80
  fn value_has_agent_command(value: &Value) -> bool {
@@ -14,8 +14,7 @@ pub(super) fn route_alias_receiver_node(
14
14
  source: &str,
15
15
  ) -> bool {
16
16
  node.utf8_text(source.as_bytes())
17
- .ok()
18
- .is_some_and(|text| route_alias_receiver_text(text, aliases))
17
+ .is_ok_and(|text| route_alias_receiver_text(text, aliases))
19
18
  }
20
19
 
21
20
  pub(super) fn route_alias_receiver_text(text: &str, aliases: &BTreeSet<String>) -> bool {
@@ -1267,8 +1267,7 @@ fn method_name(node: Node<'_>, source: &str) -> Option<String> {
1267
1267
 
1268
1268
  fn method_is_getter(node: Node<'_>, source: &str) -> bool {
1269
1269
  node.utf8_text(source.as_bytes())
1270
- .ok()
1271
- .is_some_and(|text| text.split_whitespace().any(|part| part == "get"))
1270
+ .is_ok_and(|text| text.split_whitespace().any(|part| part == "get"))
1272
1271
  }
1273
1272
 
1274
1273
  fn local_function_name(node: Node<'_>, source: &str) -> Option<String> {
package/src/scan.rs CHANGED
@@ -200,7 +200,7 @@ fn ignored_by_parent_gitignore(root: &Path, scan_root: &Path) -> bool {
200
200
  return false;
201
201
  }
202
202
  }
203
- builder.build().ok().is_some_and(|gitignore| {
203
+ builder.build().is_ok_and(|gitignore| {
204
204
  gitignore
205
205
  .matched_path_or_any_parents(scan_root, true)
206
206
  .is_ignore()
@@ -3865,7 +3865,7 @@ fn debug_or_local_only_http_context(source: &str, index: usize) -> bool {
3865
3865
  .map_or(0, |line| {
3866
3866
  let mut start = line;
3867
3867
  for _ in 0..5 {
3868
- start = source[..start].rfind('\n').map_or(0, |previous| previous);
3868
+ start = source[..start].rfind('\n').unwrap_or(0);
3869
3869
  }
3870
3870
  start
3871
3871
  })
@@ -240,8 +240,7 @@ fn is_named_parameter(param: Node<'_>, source: &str) -> bool {
240
240
  parent.kind() == "optional_formal_parameters"
241
241
  && parent
242
242
  .utf8_text(source.as_bytes())
243
- .ok()
244
- .is_some_and(|text| text.trim_start().starts_with('{'))
243
+ .is_ok_and(|text| text.trim_start().starts_with('{'))
245
244
  }
246
245
 
247
246
  fn formal_parameter_name(param: Node<'_>, source: &str) -> Option<String> {
@@ -141,8 +141,7 @@ fn is_named_parameter(param: Node<'_>, signature: Node<'_>, source: &str) -> boo
141
141
  if node.kind() == "optional_formal_parameters" {
142
142
  return node
143
143
  .utf8_text(source.as_bytes())
144
- .ok()
145
- .is_some_and(|text| text.trim_start().starts_with('{'));
144
+ .is_ok_and(|text| text.trim_start().starts_with('{'));
146
145
  }
147
146
  parent = node.parent();
148
147
  }
@@ -205,8 +205,7 @@ fn is_named_parameter(param: Node<'_>, source: &str) -> bool {
205
205
  parent.kind() == "optional_formal_parameters"
206
206
  && parent
207
207
  .utf8_text(source.as_bytes())
208
- .ok()
209
- .is_some_and(|text| text.trim_start().starts_with('{'))
208
+ .is_ok_and(|text| text.trim_start().starts_with('{'))
210
209
  }
211
210
 
212
211
  fn formal_parameter_name(param: Node<'_>, source: &str) -> Option<String> {
@@ -2324,8 +2323,7 @@ fn named_argument_value(node: Node<'_>) -> Option<Node<'_>> {
2324
2323
  fn argument_matches_roots(argument: Node<'_>, roots: &BTreeSet<String>, source: &str) -> bool {
2325
2324
  argument
2326
2325
  .utf8_text(source.as_bytes())
2327
- .ok()
2328
- .is_some_and(|text| expression_matches_roots(text, roots))
2326
+ .is_ok_and(|text| expression_matches_roots(text, roots))
2329
2327
  }
2330
2328
 
2331
2329
  pub(super) fn pattern_binds_name(node: Node<'_>, name: &str, source: &str) -> bool {