summaryrefslogtreecommitdiff
path: root/cli/module_graph.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/module_graph.rs')
-rw-r--r--cli/module_graph.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/cli/module_graph.rs b/cli/module_graph.rs
index 331f45241..40147c44c 100644
--- a/cli/module_graph.rs
+++ b/cli/module_graph.rs
@@ -197,7 +197,7 @@ const SUPPORTED_MEDIA_TYPES: [MediaType; 4] = [
pub type ModuleGraph = HashMap<String, ModuleGraphFile>;
-#[derive(Debug, Serialize)]
+#[derive(Clone, Debug, Serialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ImportDescriptor {
pub specifier: String,
@@ -241,6 +241,12 @@ pub struct ModuleGraphFile {
pub source_code: String,
}
+impl ModuleGraphFile {
+ pub fn size(&self) -> usize {
+ self.source_code.as_bytes().len()
+ }
+}
+
type SourceFileFuture =
Pin<Box<dyn Future<Output = Result<(ModuleSpecifier, SourceFile), ErrBox>>>>;