rust_jsr_registry/types/
graph.rs

1/// Module graph 1
2/// 
3/// JSR docs dosent explain this. Moreover, this only included on old & early JSR packages
4#[cfg(feature = "unstable")]
5pub mod one {}
6
7/// Objects for moduleGraph2
8pub mod two {
9    use serde::{Deserialize, Serialize};
10
11    /// Module graph 2
12    #[derive(Debug, Clone, Serialize, Deserialize)]
13    pub struct ModuleGraph2 {
14        /// Dependencies that are used in the file
15        pub dependencies: Option<Vec<Dependency>>,
16    }
17    /// Dependency type, as enum
18    #[derive(Debug, Clone, Copy, Serialize, Deserialize)]
19    #[serde(rename_all = "lowercase")]
20    pub enum DependencyType {
21        Static,
22        Dynamic
23    }
24    /// Dependency kind, as enum
25    #[derive(Debug, Clone, Copy, Serialize, Deserialize)]
26    #[serde(rename_all = "lowercase")]
27    pub enum DependencyKind {
28        Import,
29        Export
30    }    
31    /// Dependencies from [ModuleGraph2]
32    #[derive(Debug, Clone, Serialize, Deserialize)]
33    #[serde(rename_all = "camelCase")]
34    pub struct Dependency {
35        /// Dependency type ("importing from `import` keyword (static) or `import()` function (dynamic)?")
36        pub r#type: DependencyType,
37        /// Dependency kind ("Is it imported/exported?")
38        pub kind: DependencyKind,
39        /// Dependency specifier (module path)
40        pub specifier: String,
41        /// Specifier range
42        /// 
43        /// The line count was pretty tricky though, so we does'nt recommend using it
44        ///  
45        /// But since JSR does'nt document it, 
46        /// we assumed that the number is for the opening & closing path of [Dependency::specifier].
47        pub specifier_range: ((u32, u32), (u32, u32))
48    }
49}