summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-11-16 20:48:50 +0100
committerGitHub <noreply@github.com>2020-11-16 20:48:50 +0100
commit636af2850c90f6bf7005a270d95b68bc9718de75 (patch)
tree9ebffa025237f1ef42226e3168780beac2768b95
parent8ab20a4582016542ac3d8140593f817ab920005f (diff)
refactor(cli): rename fs module to fs_util (#8380)
This commit renames "fs" module in "cli/" to "fs_util". This is purely cosmetic change; there were a few places which aliased "crate::fs" to "deno_fs" which was very confusing with "fs" module in ops.
-rw-r--r--cli/disk_cache.rs4
-rw-r--r--cli/fmt.rs2
-rw-r--r--cli/fs_util.rs (renamed from cli/fs.rs)0
-rw-r--r--cli/http_cache.rs6
-rw-r--r--cli/installer.rs2
-rw-r--r--cli/lint.rs2
-rw-r--r--cli/main.rs10
-rw-r--r--cli/ops/fs.rs2
-rw-r--r--cli/permissions.rs2
-rw-r--r--cli/test_runner.rs6
-rw-r--r--cli/tsc_config.rs2
11 files changed, 19 insertions, 19 deletions
diff --git a/cli/disk_cache.rs b/cli/disk_cache.rs
index 398085cc2..96a4ff41a 100644
--- a/cli/disk_cache.rs
+++ b/cli/disk_cache.rs
@@ -1,6 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-use crate::fs as deno_fs;
+use crate::fs_util;
use crate::http_cache::url_to_filename;
use deno_core::url::{Host, Url};
use std::ffi::OsStr;
@@ -145,7 +145,7 @@ impl DiskCache {
Some(ref parent) => self.ensure_dir_exists(parent),
None => Ok(()),
}?;
- deno_fs::write_file(&path, data, crate::http_cache::CACHE_PERM)
+ fs_util::write_file(&path, data, crate::http_cache::CACHE_PERM)
.map_err(|e| with_io_context(&e, format!("{:#?}", &path)))
}
}
diff --git a/cli/fmt.rs b/cli/fmt.rs
index 9bb4dbc82..0036436c1 100644
--- a/cli/fmt.rs
+++ b/cli/fmt.rs
@@ -9,7 +9,7 @@
use crate::colors;
use crate::diff::diff;
-use crate::fs::{collect_files, is_supported_ext};
+use crate::fs_util::{collect_files, is_supported_ext};
use crate::text_encoding;
use deno_core::error::generic_error;
use deno_core::error::AnyError;
diff --git a/cli/fs.rs b/cli/fs_util.rs
index 16f9e1f64..16f9e1f64 100644
--- a/cli/fs.rs
+++ b/cli/fs_util.rs
diff --git a/cli/http_cache.rs b/cli/http_cache.rs
index 7310c9e92..9cf2adc1a 100644
--- a/cli/http_cache.rs
+++ b/cli/http_cache.rs
@@ -4,7 +4,7 @@
/// as defined in RFC 7234 (https://tools.ietf.org/html/rfc7234).
/// Currently it's a very simplified version to fulfill Deno needs
/// at hand.
-use crate::fs as deno_fs;
+use crate::fs_util;
use crate::http_util::HeadersMap;
use deno_core::error::AnyError;
use deno_core::serde_json;
@@ -87,7 +87,7 @@ impl Metadata {
pub fn write(&self, cache_filename: &Path) -> Result<(), AnyError> {
let metadata_filename = Self::filename(cache_filename);
let json = serde_json::to_string_pretty(self)?;
- deno_fs::write_file(&metadata_filename, json, CACHE_PERM)?;
+ fs_util::write_file(&metadata_filename, json, CACHE_PERM)?;
Ok(())
}
@@ -161,7 +161,7 @@ impl HttpCache {
.expect("Cache filename should have a parent dir");
self.ensure_dir_exists(parent_filename)?;
// Cache content
- deno_fs::write_file(&cache_filename, content, CACHE_PERM)?;
+ fs_util::write_file(&cache_filename, content, CACHE_PERM)?;
let metadata = Metadata {
url: url.to_string(),
diff --git a/cli/installer.rs b/cli/installer.rs
index dab81bc8d..e0a99873a 100644
--- a/cli/installer.rs
+++ b/cli/installer.rs
@@ -1,7 +1,7 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
use crate::flags::Flags;
-use crate::fs::canonicalize_path;
+use crate::fs_util::canonicalize_path;
use deno_core::error::generic_error;
use deno_core::error::AnyError;
use deno_core::url::Url;
diff --git a/cli/lint.rs b/cli/lint.rs
index 1ac680bac..e319a7be6 100644
--- a/cli/lint.rs
+++ b/cli/lint.rs
@@ -10,7 +10,7 @@ use crate::ast;
use crate::colors;
use crate::fmt::run_parallelized;
use crate::fmt_errors;
-use crate::fs::{collect_files, is_supported_ext};
+use crate::fs_util::{collect_files, is_supported_ext};
use crate::media_type::MediaType;
use deno_core::error::{generic_error, AnyError, JsStackFrame};
use deno_core::serde_json;
diff --git a/cli/main.rs b/cli/main.rs
index 87e817cf0..11674a8b6 100644
--- a/cli/main.rs
+++ b/cli/main.rs
@@ -22,7 +22,7 @@ mod flags;
mod flags_allow_net;
mod fmt;
mod fmt_errors;
-mod fs;
+mod fs_util;
mod http_cache;
mod http_util;
mod import_map;
@@ -57,7 +57,6 @@ use crate::coverage::CoverageCollector;
use crate::coverage::PrettyCoverageReporter;
use crate::file_fetcher::File;
use crate::file_fetcher::FileFetcher;
-use crate::fs as deno_fs;
use crate::media_type::MediaType;
use crate::permissions::Permissions;
use crate::program_state::ProgramState;
@@ -381,7 +380,7 @@ async fn bundle_command(
if let Some(out_file_) = out_file.as_ref() {
let output_bytes = output.as_bytes();
let output_len = output_bytes.len();
- deno_fs::write_file(out_file_, output_bytes, 0o644)?;
+ fs_util::write_file(out_file_, output_bytes, 0o644)?;
info!(
"{} {:?} ({})",
colors::green("Emit"),
@@ -583,8 +582,9 @@ async fn run_with_watch(flags: Flags, script: String) -> Result<(), AnyError> {
.collect();
if let Some(import_map) = program_state.flags.import_map_path.clone() {
- paths_to_watch
- .push(fs::resolve_from_cwd(std::path::Path::new(&import_map)).unwrap());
+ paths_to_watch.push(
+ fs_util::resolve_from_cwd(std::path::Path::new(&import_map)).unwrap(),
+ );
}
// FIXME(bartlomieju): new file watcher is created on after each restart
diff --git a/cli/ops/fs.rs b/cli/ops/fs.rs
index 37558ec6b..211404f39 100644
--- a/cli/ops/fs.rs
+++ b/cli/ops/fs.rs
@@ -2,7 +2,7 @@
// Some deserializer fields are only used on Unix and Windows build fails without it
use super::io::std_file_resource;
use super::io::{FileMetadata, StreamResource, StreamResourceHolder};
-use crate::fs::canonicalize_path;
+use crate::fs_util::canonicalize_path;
use crate::permissions::Permissions;
use deno_core::error::custom_error;
use deno_core::error::type_error;
diff --git a/cli/permissions.rs b/cli/permissions.rs
index 204176ad3..cc3ce8242 100644
--- a/cli/permissions.rs
+++ b/cli/permissions.rs
@@ -2,7 +2,7 @@
use crate::colors;
use crate::flags::Flags;
-use crate::fs::resolve_from_cwd;
+use crate::fs_util::resolve_from_cwd;
use deno_core::error::custom_error;
use deno_core::error::uri_error;
use deno_core::error::AnyError;
diff --git a/cli/test_runner.rs b/cli/test_runner.rs
index 265b514c1..cd8a394c5 100644
--- a/cli/test_runner.rs
+++ b/cli/test_runner.rs
@@ -1,6 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-use crate::fs as deno_fs;
+use crate::fs_util;
use crate::installer::is_remote_url;
use deno_core::error::AnyError;
use deno_core::serde_json::json;
@@ -42,10 +42,10 @@ pub fn prepare_test_modules_urls(
let mut prepared = vec![];
for path in include_paths {
- let p = deno_fs::normalize_path(&root_path.join(path));
+ let p = fs_util::normalize_path(&root_path.join(path));
if p.is_dir() {
let test_files =
- crate::fs::collect_files(vec![p], vec![], is_supported).unwrap();
+ crate::fs_util::collect_files(vec![p], vec![], is_supported).unwrap();
let test_files_as_urls = test_files
.iter()
.map(|f| Url::from_file_path(f).unwrap())
diff --git a/cli/tsc_config.rs b/cli/tsc_config.rs
index 92332cca6..5012e03a9 100644
--- a/cli/tsc_config.rs
+++ b/cli/tsc_config.rs
@@ -1,6 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-use crate::fs::canonicalize_path;
+use crate::fs_util::canonicalize_path;
use deno_core::error::AnyError;
use deno_core::serde_json;
use deno_core::serde_json::json;