Skip to content

Commit 8a56fb0

Browse files
mbhrznrcrowlKats
andauthored
feat: add deps graph (#860)
Co-authored-by: crowlkats <[email protected]>
1 parent 67ba749 commit 8a56fb0

File tree

12 files changed

+1415
-35
lines changed

12 files changed

+1415
-35
lines changed

api/src/api/package.rs

Lines changed: 671 additions & 7 deletions
Large diffs are not rendered by default.

api/src/api/types.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,36 @@ impl From<PublishingTask> for ApiPublishingTask {
8181
}
8282
}
8383

84+
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
85+
#[serde(rename_all = "camelCase")]
86+
pub struct ApiDependencyGraphItem {
87+
pub dependency: super::package::DependencyKind,
88+
pub children: Vec<usize>,
89+
pub size: Option<u64>,
90+
pub media_type: Option<String>,
91+
}
92+
93+
impl
94+
From<(
95+
super::package::DependencyKind,
96+
super::package::DependencyInfo,
97+
)> for ApiDependencyGraphItem
98+
{
99+
fn from(
100+
(kind, info): (
101+
super::package::DependencyKind,
102+
super::package::DependencyInfo,
103+
),
104+
) -> Self {
105+
Self {
106+
dependency: kind,
107+
children: info.children,
108+
size: info.size,
109+
media_type: info.media_type.map(|media_type| media_type.to_string()),
110+
}
111+
}
112+
}
113+
84114
#[derive(Debug, Serialize, Deserialize)]
85115
#[serde(rename_all = "camelCase")]
86116
pub struct ApiUser {

api/src/util.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ where
114114
pub struct CacheDuration(pub usize);
115115
impl CacheDuration {
116116
pub const ONE_MINUTE: CacheDuration = CacheDuration(60);
117+
pub const ONE_DAY: CacheDuration = CacheDuration(60 * 60 * 24);
117118
}
118119

119120
pub fn cache<H, HF>(
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2024 the JSR authors. All rights reserved. MIT license.
2+
export function ChevronUp(props: { class?: string }) {
3+
return (
4+
<svg
5+
class={`h-4 w-4 ${props.class ?? ""}`}
6+
viewBox="0 0 14 14"
7+
fill="none"
8+
xmlns="http://www.w3.org/2000/svg"
9+
>
10+
<path
11+
transform="translate(-1 0) rotate(270 7 7)"
12+
fill-rule="evenodd"
13+
clip-rule="evenodd"
14+
d="M3.96967 12.5303C3.67678 12.2374 3.67678 11.7626 3.96967 11.4697L8.43934 7L3.96967 2.53033C3.67678 2.23744 3.67678 1.76256 3.96967 1.46967C4.26256 1.17678 4.73744 1.17678 5.03033 1.46967L10.0303 6.46967C10.3232 6.76256 10.3232 7.23744 10.0303 7.53033L5.03033 12.5303C4.73744 12.8232 4.26256 12.8232 3.96967 12.5303Z"
15+
fill="currentColor"
16+
/>
17+
</svg>
18+
);
19+
}

frontend/components/icons/Minus.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2024 the JSR authors. All rights reserved. MIT license.
2+
export function Minus(props: { class?: string }) {
3+
return (
4+
<svg
5+
class={`w-4 h-4 ${props.class ?? ""}`}
6+
aria-hidden="true"
7+
viewBox="0 0 14 14"
8+
fill="none"
9+
>
10+
<path
11+
fill-rule="evenodd"
12+
clip-rule="evenodd"
13+
d="M1 7C1 6.58579 1.33579 6.25 1.75 6.25H12.25C12.6642 6.25 13 6.58579 13 7C13 7.41421 12.6642 7.75 12.25 7.75H1.75C1.33579 7.75 1 7.41421 1 7Z"
14+
fill="currentColor"
15+
/>
16+
</svg>
17+
);
18+
}

frontend/components/icons/Reset.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2024 the JSR authors. All rights reserved. MIT license.
2+
export function Reset(props: { class?: string }) {
3+
return (
4+
<svg
5+
class={`w-4 h-4 ${props.class ?? ""}`}
6+
aria-hidden="true"
7+
viewBox="0 0 16 16"
8+
fill="none"
9+
>
10+
<path
11+
fill-rule="evenodd"
12+
clip-rule="evenodd"
13+
d="M1.705 8.005a.75.75 0 0 1 .834.656 5.5 5.5 0 0 0 9.592 2.97l-1.204-1.204a.25.25 0 0 1 .177-.427h3.646a.25.25 0 0 1 .25.25v3.646a.25.25 0 0 1-.427.177l-1.38-1.38A7.002 7.002 0 0 1 1.05 8.84a.75.75 0 0 1 .656-.834ZM8 2.5a5.487 5.487 0 0 0-4.131 1.869l1.204 1.204A.25.25 0 0 1 4.896 6H1.25A.25.25 0 0 1 1 5.75V2.104a.25.25 0 0 1 .427-.177l1.38 1.38A7.002 7.002 0 0 1 14.95 7.16a.75.75 0 0 1-1.49.178A5.5 5.5 0 0 0 8 2.5Z"
14+
fill="currentColor"
15+
/>
16+
</svg>
17+
);
18+
}

frontend/deno.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
"@oramacloud/client": "npm:@oramacloud/client@^1",
3939

4040
"tailwindcss": "npm:[email protected]",
41-
"postcss": "npm:[email protected]"
41+
"postcss": "npm:[email protected]",
42+
43+
"@viz-js/viz": "npm:@viz-js/viz@^3.11.0"
4244
},
4345
"compilerOptions": {
4446
"lib": [

frontend/deno.lock

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)