Compare commits
1 Commits
main
...
use-from-e
| Author | SHA1 | Date |
|---|---|---|
|
|
837dcbdab7 |
|
|
@ -11,7 +11,6 @@ import { createMatcher } from '@pnpm/matcher'
|
|||
import camelcase from 'camelcase'
|
||||
import isWindows from 'is-windows'
|
||||
import normalizeRegistryUrl from 'normalize-registry-url'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
import realpathMissing from 'realpath-missing'
|
||||
import pathAbsolute from 'path-absolute'
|
||||
import which from 'which'
|
||||
|
|
@ -244,7 +243,7 @@ export async function getConfig (
|
|||
|
||||
const rcOptions = Object.keys(rcOptionsTypes)
|
||||
|
||||
const pnpmConfig: ConfigWithDeprecatedSettings = fromPairs([
|
||||
const pnpmConfig: ConfigWithDeprecatedSettings = Object.fromEntries([
|
||||
...rcOptions.map((configKey) => [camelcase(configKey), npmConfig.get(configKey)]) as any, // eslint-disable-line
|
||||
...Object.entries(cliOptions).filter(([name, value]) => typeof value !== 'undefined').map(([name, value]) => [camelcase(name), value]),
|
||||
]) as unknown as ConfigWithDeprecatedSettings
|
||||
|
|
|
|||
|
|
@ -37,14 +37,12 @@
|
|||
"@pnpm/fetcher-base": "workspace:*",
|
||||
"@pnpm/read-project-manifest": "workspace:*",
|
||||
"@pnpm/resolver-base": "workspace:*",
|
||||
"npm-packlist": "^5.1.3",
|
||||
"ramda": "npm:@pnpm/ramda@0.28.1"
|
||||
"npm-packlist": "^5.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@pnpm/directory-fetcher": "workspace:*",
|
||||
"@pnpm/test-fixtures": "workspace:*",
|
||||
"@types/npm-packlist": "^3.0.0",
|
||||
"@types/ramda": "0.28.20",
|
||||
"@zkochan/rimraf": "^2.1.2"
|
||||
},
|
||||
"exports": {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import path from 'path'
|
|||
import type { DirectoryFetcher, DirectoryFetcherOptions } from '@pnpm/fetcher-base'
|
||||
import { logger } from '@pnpm/logger'
|
||||
import { safeReadProjectManifestOnly } from '@pnpm/read-project-manifest'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
import packlist from 'npm-packlist'
|
||||
|
||||
const directoryFetcherLogger = logger('directory-fetcher')
|
||||
|
|
@ -128,7 +127,7 @@ async function fetchPackageFilesFromDir (
|
|||
opts: FetchFromDirOpts
|
||||
) {
|
||||
const files = await packlist({ path: dir })
|
||||
const filesIndex: Record<string, string> = fromPairs(files.map((file) => [file, path.join(dir, file)]))
|
||||
const filesIndex: Record<string, string> = Object.fromEntries(files.map((file) => [file, path.join(dir, file)]))
|
||||
if (opts.manifest) {
|
||||
// In a regular pnpm workspace it will probably never happen that a dependency has no package.json file.
|
||||
// Safe read was added to support the Bit workspace in which the components have no package.json files.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import {
|
|||
ProjectManifest,
|
||||
ReadPackageHook,
|
||||
} from '@pnpm/types'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
import isEmpty from 'ramda/src/isEmpty'
|
||||
import pipeWith from 'ramda/src/pipeWith'
|
||||
import { createPackageExtender } from './createPackageExtender'
|
||||
|
|
@ -32,7 +31,7 @@ export function createReadPackageHook (
|
|||
): ReadPackageHook | undefined {
|
||||
const hooks: ReadPackageHook[] = []
|
||||
if (!ignoreCompatibilityDb) {
|
||||
hooks.push(createPackageExtender(fromPairs(compatPackageExtensions)))
|
||||
hooks.push(createPackageExtender(Object.fromEntries(compatPackageExtensions)))
|
||||
}
|
||||
if (!isEmpty(packageExtensions ?? {})) {
|
||||
hooks.push(createPackageExtender(packageExtensions!))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { Lockfile } from '@pnpm/lockfile-types'
|
||||
import { DependenciesField } from '@pnpm/types'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
import mapValues from 'ramda/src/map'
|
||||
import { filterImporter } from './filterImporter'
|
||||
|
||||
|
|
@ -25,6 +24,6 @@ export function filterLockfile (
|
|||
return {
|
||||
...lockfile,
|
||||
importers: mapValues((importer) => filterImporter(importer, opts.include), lockfile.importers),
|
||||
packages: fromPairs(pairs),
|
||||
packages: Object.fromEntries(pairs),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import path from 'path'
|
||||
import { Lockfile } from '@pnpm/lockfile-types'
|
||||
import { depPathToFilename } from '@pnpm/dependency-path'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
|
||||
type GetLocalLocations = (depPath: string, pkgName: string) => string[]
|
||||
|
||||
|
|
@ -17,7 +16,7 @@ export function extendProjectsWithTargetDirs<T> (
|
|||
? (depPath: string) => ctx.pkgLocationsByDepPath![depPath]
|
||||
: (depPath: string, pkgName: string) => [path.join(ctx.virtualStoreDir, depPathToFilename(depPath), 'node_modules', pkgName)]
|
||||
const projectsById: Record<string, T & { id: string, targetDirs: string[], stages?: string[] }> =
|
||||
fromPairs(projects.map((project) => [project.id, { ...project, targetDirs: [] as string[] }]))
|
||||
Object.fromEntries(projects.map((project) => [project.id, { ...project, targetDirs: [] as string[] }]))
|
||||
Object.entries(lockfile.packages ?? {})
|
||||
.forEach(([depPath, pkg]) => {
|
||||
if (pkg.resolution?.['type'] !== 'directory') return
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import { AuditReport, AuditAdvisory } from '@pnpm/audit'
|
||||
import { readProjectManifest } from '@pnpm/read-project-manifest'
|
||||
import { difference } from 'ramda'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
import difference from 'ramda/src/difference'
|
||||
|
||||
export async function fix (dir: string, auditReport: AuditReport) {
|
||||
const { manifest, writeProjectManifest } = await readProjectManifest(dir)
|
||||
|
|
@ -24,7 +23,7 @@ function createOverrides (advisories: AuditAdvisory[], ignoreCves?: string[]) {
|
|||
if (ignoreCves) {
|
||||
advisories = advisories.filter(({ cves }) => difference(cves, ignoreCves).length > 0)
|
||||
}
|
||||
return fromPairs(
|
||||
return Object.fromEntries(
|
||||
advisories
|
||||
.filter(({ vulnerable_versions, patched_versions }) => vulnerable_versions !== '>=0.0.0' && patched_versions !== '<0.0.0') // eslint-disable-line
|
||||
.map((advisory) => [
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ import pFilter from 'p-filter'
|
|||
import pLimit from 'p-limit'
|
||||
import pMapValues from 'p-map-values'
|
||||
import flatten from 'ramda/src/flatten'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
import mapValues from 'ramda/src/map'
|
||||
import equals from 'ramda/src/equals'
|
||||
import isEmpty from 'ramda/src/isEmpty'
|
||||
|
|
@ -918,7 +917,7 @@ const _installInContext: InstallFunction = async (projects, ctx, opts) => {
|
|||
)
|
||||
await finishLockfileUpdates()
|
||||
if (opts.enablePnp) {
|
||||
const importerNames = fromPairs(
|
||||
const importerNames = Object.fromEntries(
|
||||
projects.map(({ manifest, id }) => [id, manifest.name ?? id])
|
||||
)
|
||||
await writePnpFile(result.currentLockfile, {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import {
|
|||
} from '@pnpm/types'
|
||||
import pLimit from 'p-limit'
|
||||
import pathExists from 'path-exists'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
import equals from 'ramda/src/equals'
|
||||
import isEmpty from 'ramda/src/isEmpty'
|
||||
import difference from 'ramda/src/difference'
|
||||
|
|
@ -99,7 +98,7 @@ export async function linkPackages (
|
|||
if (!opts.include.optionalDependencies) {
|
||||
depNodes = depNodes.filter(({ optional }) => !optional)
|
||||
}
|
||||
depGraph = fromPairs(depNodes.map((depNode) => [depNode.depPath, depNode]))
|
||||
depGraph = Object.fromEntries(depNodes.map((depNode) => [depNode.depPath, depNode]))
|
||||
const removedDepPaths = await prune(projects, {
|
||||
currentLockfile: opts.currentLockfile,
|
||||
hoistedDependencies: opts.hoistedDependencies,
|
||||
|
|
@ -159,7 +158,7 @@ export async function linkPackages (
|
|||
})
|
||||
|
||||
if (opts.symlink) {
|
||||
const projectsToLink = fromPairs(await Promise.all(
|
||||
const projectsToLink = Object.fromEntries(await Promise.all(
|
||||
projects.map(async ({ id, manifest, modulesDir, rootDir }) => {
|
||||
const deps = opts.dependenciesByProjectId[id]
|
||||
const importerFromLockfile = newCurrentLockfile.importers[id]
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import rimraf from '@zkochan/rimraf'
|
|||
import pathAbsolute from 'path-absolute'
|
||||
import clone from 'ramda/src/clone'
|
||||
import equals from 'ramda/src/equals'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
import { checkCompatibility } from './checkCompatibility'
|
||||
import { UnexpectedStoreError } from './checkCompatibility/UnexpectedStoreError'
|
||||
import { UnexpectedVirtualStoreDirError } from './checkCompatibility/UnexpectedVirtualStoreDirError'
|
||||
|
|
@ -160,7 +159,7 @@ export async function getContext (
|
|||
lockfileDir: opts.lockfileDir,
|
||||
modulesFile: importersContext.modules,
|
||||
pendingBuilds: importersContext.pendingBuilds,
|
||||
projects: fromPairs(importersContext.projects.map((project) => [project.rootDir, project])),
|
||||
projects: Object.fromEntries(importersContext.projects.map((project) => [project.rootDir, project])),
|
||||
publicHoistPattern: importersContext.currentPublicHoistPattern ?? opts.publicHoistPattern,
|
||||
registries: {
|
||||
...opts.registries,
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ import * as dp from '@pnpm/dependency-path'
|
|||
import pLimit from 'p-limit'
|
||||
import pathAbsolute from 'path-absolute'
|
||||
import equals from 'ramda/src/equals'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
import isEmpty from 'ramda/src/isEmpty'
|
||||
import omit from 'ramda/src/omit'
|
||||
import pick from 'ramda/src/pick'
|
||||
|
|
@ -302,7 +301,7 @@ export async function headlessInstall (opts: HeadlessOptions) {
|
|||
)
|
||||
)
|
||||
if (opts.enablePnp) {
|
||||
const importerNames = fromPairs(
|
||||
const importerNames = Object.fromEntries(
|
||||
selectedProjects.map(({ manifest, id }) => [id, manifest.name ?? id])
|
||||
)
|
||||
await writePnpFile(filteredLockfile, {
|
||||
|
|
@ -594,7 +593,7 @@ async function symlinkDirectDependencies (
|
|||
})
|
||||
})
|
||||
if (symlink !== false) {
|
||||
const projectsToLink = fromPairs(await Promise.all(
|
||||
const projectsToLink = Object.fromEntries(await Promise.all(
|
||||
projects.map(async ({ rootDir, id, modulesDir }) => ([id, {
|
||||
dir: rootDir,
|
||||
modulesDir,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import { safeReadPackageJsonFromDir } from '@pnpm/read-package-json'
|
|||
import { readProjectsContext } from '@pnpm/read-projects-context'
|
||||
import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock'
|
||||
import { getStorePath } from '@pnpm/store-path'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
import tempy from 'tempy'
|
||||
|
||||
const registry = `http://localhost:${REGISTRY_MOCK_PORT}/`
|
||||
|
|
@ -76,7 +75,7 @@ export async function testDefaults (
|
|||
},
|
||||
pendingBuilds,
|
||||
selectedProjectDirs: opts.selectedProjectDirs ?? projects.map((project) => project.rootDir),
|
||||
allProjects: fromPairs(
|
||||
allProjects: Object.fromEntries(
|
||||
await Promise.all(projects.map(async (project) => [project.rootDir, { ...project, manifest: await safeReadPackageJsonFromDir(project.rootDir) }]))
|
||||
),
|
||||
rawConfig: {},
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import isWindows from 'is-windows'
|
|||
import normalizePath from 'normalize-path'
|
||||
import pSettle from 'p-settle'
|
||||
import { KeyValuePair } from 'ramda'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
import isEmpty from 'ramda/src/isEmpty'
|
||||
import unnest from 'ramda/src/unnest'
|
||||
import partition from 'ramda/src/partition'
|
||||
|
|
@ -124,7 +123,7 @@ async function _linkBins (
|
|||
|
||||
const results1 = await pSettle(cmdsWithOwnName.map(async (cmd) => linkBin(cmd, binsDir, opts)))
|
||||
|
||||
const usedNames = fromPairs(cmdsWithOwnName.map((cmd) => [cmd.name, cmd.name] as KeyValuePair<string, string>))
|
||||
const usedNames = Object.fromEntries(cmdsWithOwnName.map((cmd) => [cmd.name, cmd.name] as KeyValuePair<string, string>))
|
||||
const results2 = await pSettle(cmdsWithOtherNames.map(async (cmd) => {
|
||||
if (usedNames[cmd.name]) {
|
||||
binsConflictLogger.debug({
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import path from 'path'
|
||||
import { DependenciesField, HoistedDependencies, Registries } from '@pnpm/types'
|
||||
import readYamlFile from 'read-yaml-file'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
import mapValues from 'ramda/src/map'
|
||||
import isWindows from 'is-windows'
|
||||
import writeYamlFile from 'write-yaml-file'
|
||||
|
|
@ -57,7 +56,7 @@ export async function readModulesManifest (modulesDir: string): Promise<Modules
|
|||
}
|
||||
if ((modules.hoistedAliases != null) && !modules.hoistedDependencies) {
|
||||
modules.hoistedDependencies = mapValues(
|
||||
(aliases) => fromPairs(aliases.map((alias) => [alias, 'public'])),
|
||||
(aliases) => Object.fromEntries(aliases.map((alias) => [alias, 'public'])),
|
||||
modules.hoistedAliases
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import { logger } from '@pnpm/logger'
|
|||
import { sequenceGraph } from '@pnpm/sort-packages'
|
||||
import rimraf from '@zkochan/rimraf'
|
||||
import loadJsonFile from 'load-json-file'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
import mapValues from 'ramda/src/map'
|
||||
import renderHelp from 'render-help'
|
||||
import { parse as parseYarnLock } from '@yarnpkg/lockfile'
|
||||
|
|
@ -227,7 +226,7 @@ async function readNpmLockfile (dir: string) {
|
|||
|
||||
function getPreferredVersions (versionsByPackageNames: Record<string, Set<string>>) {
|
||||
const preferredVersions = mapValues(
|
||||
(versions) => fromPairs(Array.from(versions).map((version) => [version, 'version'])),
|
||||
(versions) => Object.fromEntries(Array.from(versions).map((version) => [version, 'version'])),
|
||||
versionsByPackageNames
|
||||
)
|
||||
return preferredVersions
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import {
|
|||
ReadPackageHook,
|
||||
Registries,
|
||||
} from '@pnpm/types'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
import partition from 'ramda/src/partition'
|
||||
import zipObj from 'ramda/src/zipObj'
|
||||
import { WantedDependency } from './getNonDevWantedDependencies'
|
||||
|
|
@ -154,7 +153,7 @@ export async function resolveDependencyTree<T> (
|
|||
}
|
||||
return {
|
||||
updatePackageManifest: importer.updatePackageManifest,
|
||||
parentPkgAliases: fromPairs(
|
||||
parentPkgAliases: Object.fromEntries(
|
||||
importer.wantedDependencies.filter(({ alias }) => alias).map(({ alias }) => [alias, true])
|
||||
) as ParentPkgAliases,
|
||||
preferredVersions: importer.preferredVersions ?? {},
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import {
|
|||
} from '@pnpm/types'
|
||||
import { depPathToFilename, createPeersFolderSuffix } from '@pnpm/dependency-path'
|
||||
import { KeyValuePair } from 'ramda'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
import isEmpty from 'ramda/src/isEmpty'
|
||||
import mapValues from 'ramda/src/map'
|
||||
import pick from 'ramda/src/pick'
|
||||
|
|
@ -117,7 +116,7 @@ function createPkgsByName<T extends PartialResolvedPackage> (
|
|||
}
|
||||
) {
|
||||
return Object.assign(
|
||||
fromPairs(
|
||||
Object.fromEntries(
|
||||
topParents.map(({ name, version, linkedDir }): KeyValuePair<string, ParentRef> => [
|
||||
name,
|
||||
{
|
||||
|
|
@ -215,7 +214,7 @@ function resolvePeersOfNode<T extends PartialResolvedPackage> (
|
|||
ctx.depGraph[hit.depPath].depth = Math.min(ctx.depGraph[hit.depPath].depth, node.depth)
|
||||
return {
|
||||
missingPeers: hit.missingPeers,
|
||||
resolvedPeers: fromPairs(hit.resolvedPeers),
|
||||
resolvedPeers: Object.fromEntries(hit.resolvedPeers),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import * as dp from '@pnpm/dependency-path'
|
|||
import getNpmTarballUrl from 'get-npm-tarball-url'
|
||||
import { KeyValuePair } from 'ramda'
|
||||
import isEmpty from 'ramda/src/isEmpty'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
import mergeRight from 'ramda/src/mergeRight'
|
||||
import partition from 'ramda/src/partition'
|
||||
import { depPathToRef } from './depPathToRef'
|
||||
|
|
@ -199,7 +198,7 @@ function updateResolvedDeps (
|
|||
registries: Registries,
|
||||
depGraph: DependenciesGraph
|
||||
) {
|
||||
const newResolvedDeps = fromPairs<string>(
|
||||
const newResolvedDeps = Object.fromEntries(
|
||||
updatedDeps
|
||||
.map(({ alias, depPath }): KeyValuePair<string, string> => {
|
||||
if (depPath.startsWith('link:')) {
|
||||
|
|
|
|||
|
|
@ -1220,9 +1220,6 @@ importers:
|
|||
npm-packlist:
|
||||
specifier: ^5.1.3
|
||||
version: 5.1.3
|
||||
ramda:
|
||||
specifier: npm:@pnpm/ramda@0.28.1
|
||||
version: /@pnpm/ramda/0.28.1
|
||||
devDependencies:
|
||||
'@pnpm/directory-fetcher':
|
||||
specifier: workspace:*
|
||||
|
|
@ -1233,9 +1230,6 @@ importers:
|
|||
'@types/npm-packlist':
|
||||
specifier: ^3.0.0
|
||||
version: 3.0.0
|
||||
'@types/ramda':
|
||||
specifier: 0.28.20
|
||||
version: 0.28.20
|
||||
'@zkochan/rimraf':
|
||||
specifier: ^2.1.2
|
||||
version: 2.1.2
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import nopt from '@pnpm/nopt'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
import omit from 'ramda/src/omit'
|
||||
|
||||
export interface CompletionCtx {
|
||||
|
|
@ -42,7 +41,7 @@ function getOptionType (
|
|||
shorthands: Record<string, string | string[]>,
|
||||
option: string
|
||||
) {
|
||||
const allBools = fromPairs(Object.keys(optionTypes).map((optionName) => [optionName, Boolean]))
|
||||
const allBools = Object.fromEntries(Object.keys(optionTypes).map((optionName) => [optionName, Boolean]))
|
||||
const result = omit(['argv'], nopt(allBools, shorthands, [option], 0))
|
||||
return optionTypes[Object.entries(result)[0]?.[0]]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import realpathMissing from 'realpath-missing'
|
|||
import renderHelp from 'render-help'
|
||||
import tar from 'tar-stream'
|
||||
import packlist from 'npm-packlist'
|
||||
import fromPairs from 'ramda/src/fromPairs'
|
||||
import { runScriptsIfPresent } from './publish'
|
||||
|
||||
const LICENSE_GLOB = 'LICEN{S,C}E{,.*}'
|
||||
|
|
@ -95,7 +94,7 @@ export async function handler (
|
|||
}
|
||||
const tarballName = `${manifest.name.replace('@', '').replace('/', '-')}-${manifest.version}.tgz`
|
||||
const files = await packlist({ path: dir })
|
||||
const filesMap: Record<string, string> = fromPairs(files.map((file) => [`package/${file}`, path.join(dir, file)]))
|
||||
const filesMap: Record<string, string> = Object.fromEntries(files.map((file) => [`package/${file}`, path.join(dir, file)]))
|
||||
if (opts.workspaceDir != null && dir !== opts.workspaceDir && !files.some((file) => /LICEN[CS]E(\..+)?/i.test(file))) {
|
||||
const licenses = await findLicenses({ cwd: opts.workspaceDir })
|
||||
for (const license of licenses) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue