Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}),
readCurrentLockfile(opts.virtualStoreDir, lockfileOpts),
])
const sopts = { lockfileVersion: LOCKFILE_VERSION }
const importerIds = opts.importers.map((importer) => importer.id)
const currentLockfile = files[1] || createLockfileObject(importerIds, sopts)
for (const importerId of importerIds) {
if (!currentLockfile.importers[importerId]) {
currentLockfile.importers[importerId] = {
specifiers: {},
}
}
}
const wantedLockfile = files[0] ||
currentLockfile && R.clone(currentLockfile) ||
createLockfileObject(importerIds, sopts)
for (const importerId of importerIds) {
if (!wantedLockfile.importers[importerId]) {
wantedLockfile.importers[importerId] = {
specifiers: {},
}
}
}
return {
currentLockfile,
existsCurrentLockfile: !!files[1],
existsWantedLockfile: !!files[0],
wantedLockfile,
}
}
const lockfileOpts = {
ignoreIncompatible: opts.force || isCI,
wantedVersion: LOCKFILE_VERSION,
}
const files = await Promise.all([
opts.useLockfile && readWantedLockfile(opts.lockfileDir, lockfileOpts)
|| await existsWantedLockfile(opts.lockfileDir) &&
logger.warn({
message: `A ${WANTED_LOCKFILE} file exists. The current configuration prohibits to read or write a lockfile`,
prefix: opts.lockfileDir,
}),
readCurrentLockfile(opts.virtualStoreDir, lockfileOpts),
])
const sopts = { lockfileVersion: LOCKFILE_VERSION }
const importerIds = opts.importers.map((importer) => importer.id)
const currentLockfile = files[1] || createLockfileObject(importerIds, sopts)
for (const importerId of importerIds) {
if (!currentLockfile.importers[importerId]) {
currentLockfile.importers[importerId] = {
specifiers: {},
}
}
}
const wantedLockfile = files[0] ||
currentLockfile && R.clone(currentLockfile) ||
createLockfileObject(importerIds, sopts)
for (const importerId of importerIds) {
if (!wantedLockfile.importers[importerId]) {
wantedLockfile.importers[importerId] = {
specifiers: {},
}
}