File tree Expand file tree Collapse file tree 2 files changed +20
-19
lines changed
Expand file tree Collapse file tree 2 files changed +20
-19
lines changed Original file line number Diff line number Diff line change 11import { 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+
89109export async function fetchPackageWithTypesAndFiles (
90110 packageName : string ,
91111 version ?: string ,
Original file line number Diff line number Diff 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 */
You can’t perform that action at this time.
0 commit comments