summaryrefslogtreecommitdiff
path: root/cli/util/fs.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-02-08 20:40:26 -0500
committerGitHub <noreply@github.com>2024-02-09 01:40:26 +0000
commite5e2c45998d3a655c4b2d78c0a1fcb61e09c1982 (patch)
tree4a3af21378652245bdd2e58cc615458d5c163c2c /cli/util/fs.rs
parentb07a156b1d2548c07c7e822ab69d2ef9bfaca630 (diff)
fix: upgrade to deno_ast 0.33 (#22341)
* Uses diagnostics from deno_ast * Real fix for https://github.com/denoland/deno/pull/22310 * Moves `deno lint --json` code here * Upgrades swc Closes #22117 Closes #22109 Closes #21927 Closes #20993
Diffstat (limited to 'cli/util/fs.rs')
-rw-r--r--cli/util/fs.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/cli/util/fs.rs b/cli/util/fs.rs
index bab36b31e..c81686f95 100644
--- a/cli/util/fs.rs
+++ b/cli/util/fs.rs
@@ -361,8 +361,7 @@ pub fn collect_specifiers(
if path.is_dir() {
result.push(PathOrPattern::Path(path));
} else if !files.exclude.matches_path(&path) {
- let url = ModuleSpecifier::from_file_path(&path)
- .map_err(|_| anyhow!("Invalid file path '{}'", path.display()))?;
+ let url = specifier_from_file_path(&path)?;
prepared.push(url);
}
}
@@ -385,7 +384,7 @@ pub fn collect_specifiers(
.collect_file_patterns(files)?;
let mut collected_files_as_urls = collected_files
.iter()
- .map(|f| ModuleSpecifier::from_file_path(f).unwrap())
+ .map(|f| specifier_from_file_path(f).unwrap())
.collect::<Vec<ModuleSpecifier>>();
collected_files_as_urls.sort();
@@ -703,6 +702,13 @@ impl LaxSingleProcessFsFlag {
}
}
+pub fn specifier_from_file_path(
+ path: &Path,
+) -> Result<ModuleSpecifier, AnyError> {
+ ModuleSpecifier::from_file_path(path)
+ .map_err(|_| anyhow!("Invalid file path '{}'", path.display()))
+}
+
#[cfg(test)]
mod tests {
use super::*;