fetch-yarn-deps: handle packages that are locally linked (#342186)

This commit is contained in:
Doron Behar 2024-09-29 22:59:39 +03:00 committed by GitHub
commit 796699f22b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -42,7 +42,7 @@ const downloadFileHttps = (fileName, url, expectedHash, hashType = 'sha1') => {
} else if (h != expectedHash) return reject(new Error(`hash mismatch, expected ${expectedHash}, got ${h} for ${url}`)) } else if (h != expectedHash) return reject(new Error(`hash mismatch, expected ${expectedHash}, got ${h} for ${url}`))
resolve() resolve()
}) })
res.on('error', e => reject(e)) res.on('error', e => reject(e))
}) })
get(url) get(url)
}) })
@ -88,13 +88,14 @@ const isGitUrl = pattern => {
} }
const downloadPkg = (pkg, verbose) => { const downloadPkg = (pkg, verbose) => {
const fileMarker = '@file:' for (let marker of ['@file:', '@link:']) {
const split = pkg.key.split(fileMarker) const split = pkg.key.split(marker)
if (split.length == 2) { if (split.length == 2) {
console.info(`ignoring lockfile entry "${split[0]}" which points at path "${split[1]}"`) console.info(`ignoring lockfile entry "${split[0]}" which points at path "${split[1]}"`)
return return
} else if (split.length > 2) { } else if (split.length > 2) {
throw new Error(`The lockfile entry key "${pkg.key}" contains "${fileMarker}" more than once. Processing is not implemented.`) throw new Error(`The lockfile entry key "${pkg.key}" contains "${marker}" more than once. Processing is not implemented.`)
}
} }
if (pkg.resolved === undefined) { if (pkg.resolved === undefined) {