Skip to content

Commit 2fcbd57

Browse files
committed
wip
1 parent 8e10a10 commit 2fcbd57

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

server/utils/file-tree.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { flattenFileTree } from '#server/utils/import-resolver'
2+
import type { ExtendedPackageJson, TypesPackageInfo } from '#shared/utils/package-analysis'
23

34
/**
45
* Fetch the file tree from jsDelivr API.
@@ -86,6 +87,25 @@ export async function getPackageFileTree(
8687
}
8788
}
8889

90+
/**
91+
* Fetch @types package info including deprecation status using fast-npm-meta.
92+
* Returns undefined if the package doesn't exist.
93+
*/
94+
async function fetchTypesPackageInfo(packageName: string): Promise<TypesPackageInfo | undefined> {
95+
const result = await getLatestVersion(packageName, { metadata: true, throw: false })
96+
if ('error' in result) {
97+
return undefined
98+
}
99+
return {
100+
packageName,
101+
deprecated: result.deprecated,
102+
}
103+
}
104+
105+
interface AnalysisPackageJson extends ExtendedPackageJson {
106+
readme?: string
107+
}
108+
89109
export async function fetchPackageWithTypesAndFiles(
90110
packageName: string,
91111
version?: string,

shared/utils/package-analysis.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -108,25 +108,6 @@ interface ExportsAnalysis {
108108
hasTypes: boolean
109109
}
110110

111-
interface AnalysisPackageJson extends ExtendedPackageJson {
112-
readme?: string
113-
}
114-
115-
/**
116-
* Fetch @types package info including deprecation status using fast-npm-meta.
117-
* Returns undefined if the package doesn't exist.
118-
*/
119-
async function fetchTypesPackageInfo(packageName: string): Promise<TypesPackageInfo | undefined> {
120-
const result = await getLatestVersion(packageName, { metadata: true, throw: false })
121-
if ('error' in result) {
122-
return undefined
123-
}
124-
return {
125-
packageName,
126-
deprecated: result.deprecated,
127-
}
128-
}
129-
130111
/**
131112
* Recursively analyze exports field for module format indicators
132113
*/

0 commit comments

Comments
 (0)