MCPcopy
hub / github.com/vitejs/vite / getDependencyInformation

Function getDependencyInformation

packages/vite/rollupLicensePlugin.ts:157–183  ·  view source on GitHub ↗
(dep: Dependency)

Source from the content-addressed store, hash-verified

155}
156
157function getDependencyInformation(dep: Dependency): DependencyInfo {
158 const info: DependencyInfo = {}
159 const { license, author, maintainers, contributors, repository } = dep
160
161 if (license) {
162 info.license = license
163 }
164
165 const names = new Set<string>()
166 for (const person of [author, ...maintainers, ...contributors]) {
167 const name = typeof person === 'string' ? person : person?.name
168 if (name) {
169 names.add(name)
170 }
171 }
172 if (names.size > 0) {
173 info.names = Array.from(names).join(', ')
174 }
175
176 if (repository) {
177 info.repository = normalizeGitUrl(
178 typeof repository === 'string' ? repository : repository.url,
179 )
180 }
181
182 return info
183}
184
185function normalizeGitUrl(url: string): string {
186 url = url

Callers 1

thirdPartyFunction · 0.85

Calls 2

normalizeGitUrlFunction · 0.85
addMethod · 0.80

Tested by

no test coverage detected