style: no default exports (#5490)

This commit is contained in:
Zoltan Kochan
2022-10-14 16:49:11 +03:00
committed by GitHub
parent 1d0fd82fd0
commit 043d988fc9
248 changed files with 630 additions and 576 deletions

View File

@@ -0,0 +1,31 @@
---
"@pnpm/audit": major
"@pnpm/build-modules": major
"@pnpm/cafs": major
"@pnpm/cli-meta": major
"@pnpm/client": major
"@pnpm/config": major
"@pnpm/create-cafs-store": major
"@pnpm/default-reporter": major
"@pnpm/default-resolver": major
"dependencies-hierarchy": major
"@pnpm/directory-fetcher": major
"@pnpm/error": major
"@pnpm/exportable-manifest": major
"@pnpm/fetch": major
"@pnpm/filter-workspace-packages": major
"find-packages": major
"@pnpm/find-workspace-dir": major
"@pnpm/find-workspace-packages": major
"@pnpm/git-fetcher": major
"@pnpm/git-resolver": major
"@pnpm/hoist": major
"@pnpm/lifecycle": major
"@pnpm/link-bins": major
"@pnpm/list": major
"@pnpm/local-resolver": major
"@pnpm/lockfile-walker": major
"@pnpm/resolve-dependencies": major
---
Breaking change to the API. Defaul export is not used.

View File

@@ -1,4 +1,4 @@
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import { AgentOptions, fetchWithAgent, RetryTimeoutOptions } from '@pnpm/fetch'
import { GetCredentials } from '@pnpm/fetching-types'
import { Lockfile } from '@pnpm/lockfile-types'
@@ -8,7 +8,7 @@ import { AuditReport } from './types'
export * from './types'
export default async function audit (
export async function audit (
lockfile: Lockfile,
getCredentials: GetCredentials,
opts: {

View File

@@ -1,6 +1,6 @@
import audit from '@pnpm/audit'
import { audit } from '@pnpm/audit'
import { LOCKFILE_VERSION } from '@pnpm/constants'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import nock from 'nock'
import lockfileToAuditTree from '../lib/lockfileToAuditTree'

View File

@@ -1,11 +1,11 @@
import path from 'path'
import { calcDepState, DepsStateCache } from '@pnpm/calc-dep-state'
import { skippedOptionalDependencyLogger } from '@pnpm/core-loggers'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import { runPostinstallHooks } from '@pnpm/lifecycle'
import linkBins, { linkBinsOfPackages } from '@pnpm/link-bins'
import { linkBins, linkBinsOfPackages } from '@pnpm/link-bins'
import logger from '@pnpm/logger'
import { fromDir as readPackageFromDir, safeReadPackageFromDir } from '@pnpm/read-package-json'
import { readPackageJsonFromDir, safeReadPackageJsonFromDir } from '@pnpm/read-package-json'
import { StoreController } from '@pnpm/store-controller-types'
import { DependencyManifest } from '@pnpm/types'
import { applyPatch } from 'patch-package/dist/applyPatches'
@@ -14,7 +14,7 @@ import buildSequence, { DependenciesGraph, DependenciesGraphNode } from './build
export { DepsStateCache }
export default async (
export async function buildModules (
depGraph: DependenciesGraph,
rootDepPaths: string[],
opts: {
@@ -38,7 +38,7 @@ export default async (
storeController: StoreController
rootModulesDir: string
}
) => {
) {
const warn = (message: string) => logger.warn({ message, prefix: opts.lockfileDir })
// postinstall hooks
@@ -132,7 +132,7 @@ async function buildDependency (
} catch (err: any) { // eslint-disable-line
if (depNode.optional) {
// TODO: add parents field to the log
const pkg = await readPackageFromDir(path.join(depNode.dir)) as DependencyManifest
const pkg = await readPackageJsonFromDir(path.join(depNode.dir)) as DependencyManifest
skippedOptionalDependencyLogger.debug({
details: err.toString(),
package: {
@@ -203,7 +203,7 @@ export async function linkBinsOfDependencies (
const pkgs = await Promise.all(pkgNodes
.map(async (dep) => ({
location: dep.dir,
manifest: await dep.fetchingBundledManifest?.() ?? (await safeReadPackageFromDir(dep.dir) as DependencyManifest) ?? {},
manifest: await dep.fetchingBundledManifest?.() ?? (await safeReadPackageJsonFromDir(dep.dir) as DependencyManifest) ?? {},
}))
)

View File

@@ -32,7 +32,7 @@ export {
PackageFilesIndex,
}
export default function createCafs (cafsDir: string, ignore?: ((filename: string) => Boolean)) {
export function createCafs (cafsDir: string, ignore?: ((filename: string) => Boolean)) {
const locker = new Map()
const _writeBufferToCafs = writeBufferToCafs.bind(null, locker, cafsDir)
const addStream = addStreamToCafs.bind(null, _writeBufferToCafs)

View File

@@ -3,7 +3,8 @@ import { DependencyManifest } from '@pnpm/types'
import pDefer from 'p-defer'
import path from 'path'
import tempy from 'tempy'
import createCafs, {
import {
createCafs,
checkFilesIntegrity,
getFilePathInCafs,
} from '../src'

View File

@@ -26,7 +26,7 @@ if (require.main == null) {
}
}
const packageManager = {
export const packageManager = {
name: pkgJson.name,
// Never a prerelease version
stableVersion: pkgJson.version.includes('-')
@@ -35,4 +35,3 @@ const packageManager = {
// This may be a 3.0.0-beta.2
version: pkgJson.version,
}
export default packageManager

View File

@@ -1,5 +1,5 @@
import packageManager from '@pnpm/cli-meta'
import getConfig, { CliOptions } from '@pnpm/config'
import { packageManager } from '@pnpm/cli-meta'
import { getConfig, CliOptions } from '@pnpm/config'
import { formatWarn } from '@pnpm/default-reporter'
export default async function (

View File

@@ -1,4 +1,4 @@
import pnpmManifest from '@pnpm/cli-meta'
import { packageManager } from '@pnpm/cli-meta'
import getConfig from './getConfig'
export { getConfig }
@@ -10,6 +10,6 @@ export * from './recursiveSummary'
export * from './style'
export const docsUrl = (cmd: string) => {
const [pnpmMajorVersion] = pnpmManifest.version.split('.')
const [pnpmMajorVersion] = packageManager.version.split('.')
return `https://pnpm.io/${pnpmMajorVersion}.x/cli/${cmd}`
}

View File

@@ -1,4 +1,4 @@
import packageManager from '@pnpm/cli-meta'
import { packageManager } from '@pnpm/cli-meta'
import logger from '@pnpm/logger'
import { checkPackage, UnsupportedEngineError, WantedEngine } from '@pnpm/package-is-installable'

View File

@@ -1,5 +1,5 @@
import { getAllDependenciesFromManifest } from '@pnpm/manifest-utils'
import readProjectManifest from '@pnpm/read-project-manifest'
import { readProjectManifest } from '@pnpm/read-project-manifest'
export async function readDepNameCompletions (dir?: string) {
const { manifest } = await readProjectManifest(dir ?? process.cwd())

View File

@@ -1,4 +1,4 @@
import _readProjectManifest, * as utils from '@pnpm/read-project-manifest'
import * as utils from '@pnpm/read-project-manifest'
import { ProjectManifest } from '@pnpm/types'
import { packageIsInstallable } from './packageIsInstallable'
@@ -13,7 +13,7 @@ export async function readProjectManifest (
manifest: ProjectManifest
writeProjectManifest: (manifest: ProjectManifest, force?: boolean) => Promise<void>
}> {
const { fileName, manifest, writeProjectManifest } = await _readProjectManifest(projectDir)
const { fileName, manifest, writeProjectManifest } = await utils.readProjectManifest(projectDir)
packageIsInstallable(projectDir, manifest as any, opts) // eslint-disable-line @typescript-eslint/no-explicit-any
return { fileName, manifest, writeProjectManifest }
}

View File

@@ -1,4 +1,4 @@
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
interface ActionFailure {
prefix: string

View File

@@ -1,13 +1,14 @@
import createResolve, {
import {
createResolver as _createResolver,
ResolveFunction,
ResolverFactoryOptions,
} from '@pnpm/default-resolver'
import { AgentOptions, createFetchFromRegistry } from '@pnpm/fetch'
import { FetchFromRegistry, GetCredentials, RetryTimeoutOptions } from '@pnpm/fetching-types'
import type { CustomFetchers } from '@pnpm/fetcher-base'
import createDirectoryFetcher from '@pnpm/directory-fetcher'
import fetchFromGit from '@pnpm/git-fetcher'
import createTarballFetcher from '@pnpm/tarball-fetcher'
import type { CustomFetchers, GitFetcher, DirectoryFetcher } from '@pnpm/fetcher-base'
import { createDirectoryFetcher } from '@pnpm/directory-fetcher'
import { createGitFetcher } from '@pnpm/git-fetcher'
import { createTarballFetcher, TarballFetchers } from '@pnpm/tarball-fetcher'
import getCredentialsByURI from 'credentials-by-uri'
import mem from 'mem'
@@ -23,30 +24,40 @@ export type ClientOptions = {
gitShallowHosts?: string[]
} & ResolverFactoryOptions & AgentOptions
export default function (opts: ClientOptions) {
export interface Client {
fetchers: Fetchers
resolve: ResolveFunction
}
export function createClient (opts: ClientOptions): Client {
const fetchFromRegistry = createFetchFromRegistry(opts)
const getCredentials = mem((registry: string) => getCredentialsByURI(opts.authConfig, registry, opts.userConfig))
return {
fetchers: createFetchers(fetchFromRegistry, getCredentials, opts, opts.customFetchers),
resolve: createResolve(fetchFromRegistry, getCredentials, opts),
resolve: _createResolver(fetchFromRegistry, getCredentials, opts),
}
}
export function createResolver (opts: ClientOptions) {
const fetchFromRegistry = createFetchFromRegistry(opts)
const getCredentials = mem((registry: string) => getCredentialsByURI(opts.authConfig, registry))
return createResolve(fetchFromRegistry, getCredentials, opts)
return _createResolver(fetchFromRegistry, getCredentials, opts)
}
type Fetchers = {
git: GitFetcher
directory: DirectoryFetcher
} & TarballFetchers
function createFetchers (
fetchFromRegistry: FetchFromRegistry,
getCredentials: GetCredentials,
opts: Pick<ClientOptions, 'retry' | 'gitShallowHosts'>,
customFetchers?: CustomFetchers
) {
): Fetchers {
const defaultFetchers = {
...createTarballFetcher(fetchFromRegistry, getCredentials, opts),
...fetchFromGit(opts),
...createGitFetcher(opts),
...createDirectoryFetcher(),
}

View File

@@ -1,5 +1,5 @@
/// <reference path="../../../typings/index.d.ts"/>
import createClient, { createResolver } from '@pnpm/client'
import { createClient, createResolver } from '@pnpm/client'
test('createClient()', () => {
const client = createClient({

View File

@@ -15,7 +15,7 @@ pnpm add @pnpm/config
## Usage
```ts
import getConfig from '@pnpm/config'
import { getConfig } from '@pnpm/config'
getConfig().then(pnpmConfig => console.log(pnpmConfig))
```

View File

@@ -1,6 +1,6 @@
import { promises as fs } from 'fs'
import path from 'path'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import { sync as canWriteToDir } from 'can-write-to-dir'
import PATH from 'path-name'

View File

@@ -1,13 +1,13 @@
import path from 'path'
import fs from 'fs'
import { LAYOUT_VERSION } from '@pnpm/constants'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import loadNpmConf from '@pnpm/npm-conf'
import npmTypes from '@pnpm/npm-conf/lib/types'
import { requireHooks } from '@pnpm/pnpmfile'
import { safeReadProjectManifestOnly } from '@pnpm/read-project-manifest'
import { getCurrentBranch } from '@pnpm/git-utils'
import matcher from '@pnpm/matcher'
import { createMatcher } from '@pnpm/matcher'
import camelcase from 'camelcase'
import isWindows from 'is-windows'
import normalizeRegistryUrl from 'normalize-registry-url'
@@ -133,7 +133,7 @@ export const types = Object.assign({
export type CliOptions = Record<string, unknown> & { dir?: string }
export default async (
export async function getConfig (
opts: {
globalDirShouldAllowWrite?: boolean
cliOptions: CliOptions
@@ -146,7 +146,7 @@ export default async (
checkUnknownSetting?: boolean
env?: Record<string, string | undefined>
}
): Promise<{ config: Config, warnings: string[] }> => {
): Promise<{ config: Config, warnings: string[] }> {
const env = opts.env ?? process.env
const packageManager = opts.packageManager ?? { name: 'pnpm', version: 'undefined' }
const cliOptions = opts.cliOptions ?? {}
@@ -291,7 +291,7 @@ export default async (
if (pnpmConfig['mergeGitBranchLockfilesBranchPattern'] != null && pnpmConfig['mergeGitBranchLockfilesBranchPattern'].length > 0) {
const branch = await getCurrentBranch()
if (branch) {
const branchMatcher = matcher(pnpmConfig['mergeGitBranchLockfilesBranchPattern'])
const branchMatcher = createMatcher(pnpmConfig['mergeGitBranchLockfilesBranchPattern'])
return branchMatcher(branch)
}
}

View File

@@ -5,7 +5,7 @@ import path from 'path'
import pathName from 'path-name'
import symlinkDir from 'symlink-dir'
import { homedir } from 'os'
import getConfig from '@pnpm/config'
import { getConfig } from '@pnpm/config'
const globalBinDir = path.join(homedir(), '.local', 'pnpm')
const isWindows = process.platform === 'win32'

View File

@@ -3,8 +3,8 @@ import { promises as fs } from 'fs'
import path from 'path'
import PATH from 'path-name'
import { getCurrentBranch } from '@pnpm/git-utils'
import getConfig from '@pnpm/config'
import PnpmError from '@pnpm/error'
import { getConfig } from '@pnpm/config'
import { PnpmError } from '@pnpm/error'
import loadNpmConf from '@pnpm/npm-conf'
import prepare, { prepareEmpty } from '@pnpm/prepare'

View File

@@ -1,4 +1,4 @@
import resolveDependencies, { getWantedDependencies } from '@pnpm/resolve-dependencies'
import { resolveDependencies, getWantedDependencies } from '@pnpm/resolve-dependencies'
import { PeerDependencyIssuesByProjects } from '@pnpm/types'
import { getContext, GetContextOptions, ProjectOptions } from '@pnpm/get-context'
import { createReadPackageHook } from '@pnpm/hooks.read-package-hook'

View File

@@ -5,7 +5,7 @@ import {
ProjectSnapshot,
} from '@pnpm/lockfile-file'
import { satisfiesPackageManifest } from '@pnpm/lockfile-utils'
import { safeReadPackageFromDir as safeReadPkgFromDir } from '@pnpm/read-package-json'
import { safeReadPackageJsonFromDir } from '@pnpm/read-package-json'
import { WorkspacePackages } from '@pnpm/resolver-base'
import {
DEPENDENCIES_FIELDS,
@@ -99,7 +99,7 @@ async function linkedPackagesAreUpToDate (
// workspace:x.x.x dependency
continue
}
const linkedPkg = manifestsByDir[linkedDir] ?? await safeReadPkgFromDir(linkedDir)
const linkedPkg = manifestsByDir[linkedDir] ?? await safeReadPackageJsonFromDir(linkedDir)
const availableRange = getVersionRange(currentSpec)
// This should pass the same options to semver as @pnpm/npm-resolver
const localPackageSatisfiesRange = availableRange === '*' || availableRange === '^' || availableRange === '~' ||

View File

@@ -1,11 +1,11 @@
import { WANTED_LOCKFILE } from '@pnpm/constants'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import { ProjectOptions } from '@pnpm/get-context'
import { HoistingLimits } from '@pnpm/headless'
import { createReadPackageHook } from '@pnpm/hooks.read-package-hook'
import { Lockfile } from '@pnpm/lockfile-file'
import { IncludedDependencies } from '@pnpm/modules-yaml'
import normalizeRegistries, { DEFAULT_REGISTRIES } from '@pnpm/normalize-registries'
import { normalizeRegistries, DEFAULT_REGISTRIES } from '@pnpm/normalize-registries'
import { WorkspacePackages } from '@pnpm/resolver-base'
import { StoreController } from '@pnpm/store-controller-types'
import {

View File

@@ -1,6 +1,6 @@
import crypto from 'crypto'
import path from 'path'
import buildModules, { DepsStateCache, linkBinsOfDependencies } from '@pnpm/build-modules'
import { buildModules, DepsStateCache, linkBinsOfDependencies } from '@pnpm/build-modules'
import {
LAYOUT_VERSION,
LOCKFILE_VERSION,
@@ -11,15 +11,16 @@ import {
summaryLogger,
} from '@pnpm/core-loggers'
import { createBase32HashFromFile } from '@pnpm/crypto.base32-hash'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import { getContext, PnpmContext } from '@pnpm/get-context'
import { headlessInstall } from '@pnpm/headless'
import runLifecycleHook, {
import {
makeNodeRequireOption,
runLifecycleHook,
runLifecycleHooksConcurrently,
RunLifecycleHooksConcurrentlyOptions,
} from '@pnpm/lifecycle'
import linkBins, { linkBinsOfPackages } from '@pnpm/link-bins'
import { linkBins, linkBinsOfPackages } from '@pnpm/link-bins'
import {
ProjectSnapshot,
Lockfile,
@@ -34,14 +35,15 @@ import { extendProjectsWithTargetDirs } from '@pnpm/lockfile-utils'
import logger, { globalInfo, streamParser } from '@pnpm/logger'
import { getAllDependenciesFromManifest } from '@pnpm/manifest-utils'
import { write as writeModulesYaml } from '@pnpm/modules-yaml'
import readModulesDirs from '@pnpm/read-modules-dir'
import { readModulesDir } from '@pnpm/read-modules-dir'
import { safeReadProjectManifestOnly } from '@pnpm/read-project-manifest'
import { removeBin } from '@pnpm/remove-bins'
import resolveDependencies, {
import {
getWantedDependencies,
DependenciesGraph,
DependenciesGraphNode,
PinnedVersion,
resolveDependencies,
WantedDependency,
} from '@pnpm/resolve-dependencies'
import {
@@ -419,7 +421,7 @@ export async function mutateModules (
break
}
case 'unlink': {
const packageDirs = await readModulesDirs(projectOpts.modulesDir)
const packageDirs = await readModulesDir(projectOpts.modulesDir)
const externalPackages = await pFilter(
packageDirs!,
async (packageDir: string) => isExternalLink(ctx.storeDir, projectOpts.modulesDir, packageDir)

View File

@@ -10,7 +10,7 @@ import {
import {
filterLockfileByImporters,
} from '@pnpm/filter-lockfile'
import hoist from '@pnpm/hoist'
import { hoist } from '@pnpm/hoist'
import { Lockfile } from '@pnpm/lockfile-file'
import logger from '@pnpm/logger'
import { prune } from '@pnpm/modules-cleaner'
@@ -21,7 +21,7 @@ import {
LinkedDependency,
} from '@pnpm/resolve-dependencies'
import { StoreController } from '@pnpm/store-controller-types'
import symlinkDependency, { symlinkDirectRootDependency } from '@pnpm/symlink-dependency'
import { symlinkDependency, symlinkDirectRootDependency } from '@pnpm/symlink-dependency'
import {
HoistedDependencies,
Registries,

View File

@@ -1,4 +1,4 @@
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import { peerDependencyIssuesLogger } from '@pnpm/core-loggers'
import { PeerDependencyIssuesByProjects } from '@pnpm/types'
import isEmpty from 'ramda/src/isEmpty'

View File

@@ -2,7 +2,7 @@ import path from 'path'
import {
summaryLogger,
} from '@pnpm/core-loggers'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import { getContextForSingleImporter } from '@pnpm/get-context'
import { linkBinsOfPackages } from '@pnpm/link-bins'
import {
@@ -20,7 +20,7 @@ import {
updateProjectManifestObject,
} from '@pnpm/manifest-utils'
import { pruneSharedLockfile } from '@pnpm/prune-lockfile'
import readProjectManifest from '@pnpm/read-project-manifest'
import { readProjectManifest } from '@pnpm/read-project-manifest'
import { symlinkDirectRootDependency } from '@pnpm/symlink-dependency'
import {
DependenciesField,

View File

@@ -1,5 +1,5 @@
import path from 'path'
import normalizeRegistries, { DEFAULT_REGISTRIES } from '@pnpm/normalize-registries'
import { normalizeRegistries, DEFAULT_REGISTRIES } from '@pnpm/normalize-registries'
import { StoreController } from '@pnpm/store-controller-types'
import {
DependenciesField,

View File

@@ -1,6 +1,6 @@
import parseWantedDependency from '@pnpm/parse-wanted-dependency'
import { parseWantedDependency } from '@pnpm/parse-wanted-dependency'
import { Dependencies } from '@pnpm/types'
import whichVersionIsPinned from '@pnpm/which-version-is-pinned'
import { whichVersionIsPinned } from '@pnpm/which-version-is-pinned'
import { PinnedVersion, WantedDependency } from '@pnpm/resolve-dependencies/lib/getWantedDependencies'
export default function parseWantedDependencies (

View File

@@ -1,7 +1,7 @@
import { promises as fs } from 'fs'
import path from 'path'
import { WANTED_LOCKFILE } from '@pnpm/constants'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import { prepareEmpty, preparePackages } from '@pnpm/prepare'
import { addDependenciesToPackage, install } from '@pnpm/core'
import rimraf from '@zkochan/rimraf'

View File

@@ -1,7 +1,7 @@
import * as path from 'path'
import { promises as fs } from 'fs'
import { prepareEmpty, preparePackages } from '@pnpm/prepare'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import {
PackageManifestLog,
ProgressLog,

View File

@@ -1,4 +1,4 @@
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import { prepareEmpty } from '@pnpm/prepare'
import { addDistTag } from '@pnpm/registry-mock'
import { addDependenciesToPackage, mutateModulesInSingleProject } from '@pnpm/core'

View File

@@ -1,4 +1,4 @@
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import { prepareEmpty } from '@pnpm/prepare'
import { addDependenciesToPackage, mutateModulesInSingleProject } from '@pnpm/core'
import { createObjectChecksum } from '../../lib/install/index'

View File

@@ -2,10 +2,10 @@ import { promises as fs } from 'fs'
import path from 'path'
import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants'
import { RootLog } from '@pnpm/core-loggers'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import { Lockfile, TarballResolution } from '@pnpm/lockfile-file'
import { prepareEmpty, preparePackages } from '@pnpm/prepare'
import { fromDir as readPackageJsonFromDir } from '@pnpm/read-package-json'
import { readPackageJsonFromDir } from '@pnpm/read-package-json'
import { addDistTag, getIntegrity, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock'
import { ProjectManifest } from '@pnpm/types'
import readYamlFile from 'read-yaml-file'

View File

@@ -1,9 +1,9 @@
import * as path from 'path'
import createClient from '@pnpm/client'
import createStore from '@pnpm/package-store'
import { createClient } from '@pnpm/client'
import { createPackageStore } from '@pnpm/package-store'
import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock'
import { StoreController } from '@pnpm/store-controller-types'
import storePath from '@pnpm/store-path'
import { getStorePath } from '@pnpm/store-path'
import { Registries } from '@pnpm/types'
import { InstallOptions } from '@pnpm/core'
@@ -45,12 +45,12 @@ export default async function testDefaults<T> (
...fetchOpts,
})
let storeDir = opts?.storeDir ?? path.resolve('.store')
storeDir = await storePath({
storeDir = await getStorePath({
pkgRoot: opts?.prefix ?? process.cwd(),
storePath: storeDir,
pnpmHomeDir: '',
})
const storeController = await createStore(
const storeController = await createPackageStore(
resolve,
fetchers,
{

View File

@@ -1,6 +1,7 @@
import { promises as fs } from 'fs'
import path from 'path'
import createCafs, {
import {
createCafs,
getFilePathByModeInCafs,
} from '@pnpm/cafs'
import type { Cafs, PackageFilesResponse } from '@pnpm/cafs-types'
@@ -63,7 +64,7 @@ function getFlatMap (
return { filesMap, isBuilt }
}
export default function createCafsStore (
export function createCafsStore (
storeDir: string,
opts?: {
ignoreFile?: (filename: string) => boolean

View File

@@ -12,9 +12,9 @@ pnpm add @pnpm/default-reporter
```ts
import { streamParser } from '@pnpm/logger'
import defaultReporter from '@pnpm/default-reporter'
import { initDefaultReporter } from '@pnpm/default-reporter'
const stopReporting = defaultReporter({
const stopReporting = initDefaultReporter({
context: {
argv: [],
},

View File

@@ -12,7 +12,7 @@ import reporterForServer from './reporterForServer'
export { formatWarn }
export default function (
export function initDefaultReporter (
opts: {
useStderr?: boolean
streamParser: object

View File

@@ -1,7 +1,7 @@
import { Config } from '@pnpm/config'
import { Log } from '@pnpm/core-loggers'
import PnpmError from '@pnpm/error'
import renderPeerIssues from '@pnpm/render-peer-issues'
import { PnpmError } from '@pnpm/error'
import { renderPeerIssues } from '@pnpm/render-peer-issues'
import { PeerDependencyIssuesByProjects } from '@pnpm/types'
import chalk from 'chalk'
import equals from 'ramda/src/equals'

View File

@@ -1,5 +1,5 @@
import { PeerDependencyIssuesLog } from '@pnpm/core-loggers'
import renderPeerIssues from '@pnpm/render-peer-issues'
import { renderPeerIssues } from '@pnpm/render-peer-issues'
import * as Rx from 'rxjs'
import { map, take } from 'rxjs/operators'
import formatWarn from './utils/formatWarn'

View File

@@ -12,7 +12,7 @@ import {
summaryLogger,
} from '@pnpm/core-loggers'
import { toOutput$ } from '@pnpm/default-reporter'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import logger, {
createStreamParser,
} from '@pnpm/logger'

View File

@@ -1,6 +1,6 @@
import path from 'path'
import { toOutput$ } from '@pnpm/default-reporter'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import logger, {
createStreamParser,
} from '@pnpm/logger'

View File

@@ -1,15 +1,16 @@
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import { FetchFromRegistry, GetCredentials } from '@pnpm/fetching-types'
import createResolveFromGit from '@pnpm/git-resolver'
import resolveFromLocal from '@pnpm/local-resolver'
import createResolveFromNpm, {
import { createGitResolver } from '@pnpm/git-resolver'
import { resolveFromLocal } from '@pnpm/local-resolver'
import {
createNpmResolver,
PackageMeta,
PackageMetaCache,
ResolveFromNpmOptions,
ResolverFactoryOptions,
} from '@pnpm/npm-resolver'
import { ResolveFunction } from '@pnpm/resolver-base'
import resolveFromTarball from '@pnpm/tarball-resolver'
import { resolveFromTarball } from '@pnpm/tarball-resolver'
export {
PackageMeta,
@@ -18,13 +19,13 @@ export {
ResolverFactoryOptions,
}
export default function createResolver (
export function createResolver (
fetchFromRegistry: FetchFromRegistry,
getCredentials: GetCredentials,
pnpmOpts: ResolverFactoryOptions
): ResolveFunction {
const resolveFromNpm = createResolveFromNpm(fetchFromRegistry, getCredentials, pnpmOpts)
const resolveFromGit = createResolveFromGit(pnpmOpts)
const resolveFromNpm = createNpmResolver(fetchFromRegistry, getCredentials, pnpmOpts)
const resolveFromGit = createGitResolver(pnpmOpts)
return async (wantedDependency, opts) => {
const resolution = await resolveFromNpm(wantedDependency, opts as ResolveFromNpmOptions) ??
(wantedDependency.pref && (

View File

@@ -1,5 +1,5 @@
/// <reference path="../../../typings/index.d.ts"/>
import createResolver from '@pnpm/default-resolver'
import { createResolver } from '@pnpm/default-resolver'
import { createFetchFromRegistry } from '@pnpm/fetch'
test('createResolver()', () => {

View File

@@ -13,9 +13,9 @@ import {
pkgSnapshotToResolution,
} from '@pnpm/lockfile-utils'
import { read as readModulesYaml } from '@pnpm/modules-yaml'
import normalizeRegistries from '@pnpm/normalize-registries'
import readModulesDir from '@pnpm/read-modules-dir'
import { safeReadPackageFromDir } from '@pnpm/read-package-json'
import { normalizeRegistries } from '@pnpm/normalize-registries'
import { readModulesDir } from '@pnpm/read-modules-dir'
import { safeReadPackageJsonFromDir } from '@pnpm/read-package-json'
import { DependenciesField, DEPENDENCIES_FIELDS, Registries } from '@pnpm/types'
import { depPathToFilename, refToRelative } from 'dependency-path'
import normalizePath from 'normalize-path'
@@ -47,7 +47,7 @@ export interface DependenciesHierarchy {
unsavedDependencies?: PackageNode[]
}
export default async function dependenciesHierarchy (
export async function buildDependenciesHierarchy (
projectPaths: string[],
maybeOpts: {
depth: number
@@ -189,7 +189,7 @@ async function dependenciesHierarchyForPackage (
version = `link:${normalizePath(path.relative(projectPath, pkgPath))}`
} catch (err: any) { // eslint-disable-line
// if error happened. The package is not a link
const pkg = await safeReadPackageFromDir(pkgPath)
const pkg = await safeReadPackageJsonFromDir(pkgPath)
version = pkg?.version ?? 'undefined'
}
const pkg = {

View File

@@ -1,7 +1,7 @@
/// <reference path="../../../typings/index.d.ts"/>
import path from 'path'
import { WANTED_LOCKFILE } from '@pnpm/constants'
import dh, { PackageNode } from 'dependencies-hierarchy'
import { buildDependenciesHierarchy, PackageNode } from 'dependencies-hierarchy'
const fixtures = path.join(__dirname, '../../../fixtures')
const generalFixture = path.join(fixtures, 'general')
@@ -15,7 +15,7 @@ const fixtureMonorepo = path.join(__dirname, '..', 'fixtureMonorepo')
const withAliasedDepFixture = path.join(fixtures, 'with-aliased-dep')
test('one package depth 0', async () => {
const tree = await dh([generalFixture], { depth: 0, lockfileDir: generalFixture })
const tree = await buildDependenciesHierarchy([generalFixture], { depth: 0, lockfileDir: generalFixture })
const modulesDir = path.join(generalFixture, 'node_modules')
expect(tree).toStrictEqual({
@@ -76,7 +76,7 @@ test('one package depth 0', async () => {
})
test('one package depth 1', async () => {
const tree = await dh([generalFixture], { depth: 1, lockfileDir: generalFixture })
const tree = await buildDependenciesHierarchy([generalFixture], { depth: 1, lockfileDir: generalFixture })
const modulesDir = path.join(generalFixture, 'node_modules')
expect(tree).toStrictEqual({
@@ -165,7 +165,7 @@ test('one package depth 1', async () => {
})
test('only prod depth 0', async () => {
const tree = await dh(
const tree = await buildDependenciesHierarchy(
[generalFixture],
{
depth: 0,
@@ -210,7 +210,7 @@ test('only prod depth 0', async () => {
})
test('only dev depth 0', async () => {
const tree = await dh(
const tree = await buildDependenciesHierarchy(
[generalFixture],
{
depth: 0,
@@ -244,7 +244,7 @@ test('only dev depth 0', async () => {
})
test('hierarchy for no packages', async () => {
const tree = await dh([generalFixture], {
const tree = await buildDependenciesHierarchy([generalFixture], {
depth: 100,
lockfileDir: generalFixture,
search: () => false,
@@ -260,7 +260,7 @@ test('hierarchy for no packages', async () => {
})
test('filter 1 package with depth 0', async () => {
const tree = await dh(
const tree = await buildDependenciesHierarchy(
[generalFixture],
{
depth: 0,
@@ -293,7 +293,7 @@ test('filter 1 package with depth 0', async () => {
})
test('circular dependency', async () => {
const tree = await dh([circularFixture], { depth: 1000, lockfileDir: circularFixture })
const tree = await buildDependenciesHierarchy([circularFixture], { depth: 1000, lockfileDir: circularFixture })
const modulesDir = path.join(circularFixture, 'node_modules')
expect(tree).toStrictEqual({
@@ -325,7 +325,7 @@ function resolvePaths (modulesDir: string, node: PackageNode): PackageNode {
}
test('local package depth 0', async () => {
const tree = await dh([withFileDepFixture], { depth: 1, lockfileDir: withFileDepFixture })
const tree = await buildDependenciesHierarchy([withFileDepFixture], { depth: 1, lockfileDir: withFileDepFixture })
const modulesDir = path.join(withFileDepFixture, 'node_modules')
expect(tree).toStrictEqual({
@@ -359,7 +359,7 @@ test('local package depth 0', async () => {
})
test('on a package that has only links', async () => {
const tree = await dh([withLinksOnlyFixture], { depth: 1000, lockfileDir: withLinksOnlyFixture })
const tree = await buildDependenciesHierarchy([withLinksOnlyFixture], { depth: 1000, lockfileDir: withLinksOnlyFixture })
expect(tree).toStrictEqual({
[withLinksOnlyFixture]: {
@@ -382,7 +382,7 @@ test('on a package that has only links', async () => {
test('unsaved dependencies are listed', async () => {
const modulesDir = path.join(withUnsavedDepsFixture, 'node_modules')
expect(await dh([withUnsavedDepsFixture], { depth: 0, lockfileDir: withUnsavedDepsFixture }))
expect(await buildDependenciesHierarchy([withUnsavedDepsFixture], { depth: 0, lockfileDir: withUnsavedDepsFixture }))
.toStrictEqual({
[withUnsavedDepsFixture]: {
dependencies: [
@@ -418,7 +418,7 @@ test('unsaved dependencies are listed', async () => {
test('unsaved dependencies are listed and filtered', async () => {
const modulesDir = path.join(withUnsavedDepsFixture, 'node_modules')
expect(
await dh(
await buildDependenciesHierarchy(
[withUnsavedDepsFixture],
{
depth: 0,
@@ -450,13 +450,13 @@ test('unsaved dependencies are listed and filtered', async () => {
// Covers https://github.com/pnpm/pnpm/issues/1549
test(`do not fail on importers that are not in current ${WANTED_LOCKFILE}`, async () => {
expect(await dh([fixtureMonorepo], { depth: 0, lockfileDir: fixtureMonorepo })).toStrictEqual({ [fixtureMonorepo]: {} })
expect(await buildDependenciesHierarchy([fixtureMonorepo], { depth: 0, lockfileDir: fixtureMonorepo })).toStrictEqual({ [fixtureMonorepo]: {} })
})
test('dependency with an alias', async () => {
const modulesDir = path.join(withAliasedDepFixture, 'node_modules')
expect(
await dh([withAliasedDepFixture], { depth: 0, lockfileDir: withAliasedDepFixture })
await buildDependenciesHierarchy([withAliasedDepFixture], { depth: 0, lockfileDir: withAliasedDepFixture })
).toStrictEqual({
[withAliasedDepFixture]: {
dependencies: [
@@ -479,7 +479,7 @@ test('dependency with an alias', async () => {
})
test('peer dependencies', async () => {
const hierarchy = await dh([withPeerFixture], { depth: 1, lockfileDir: withPeerFixture })
const hierarchy = await buildDependenciesHierarchy([withPeerFixture], { depth: 1, lockfileDir: withPeerFixture })
expect(hierarchy[withPeerFixture].dependencies![1].dependencies![0].name).toEqual('ajv')
expect(hierarchy[withPeerFixture].dependencies![1].dependencies![0].isPeer).toEqual(true)
})
@@ -489,7 +489,7 @@ test('dependency without a package.json', async () => {
const org = 'denolib'
const pkg = 'camelcase'
const commit = 'aeb6b15f9c9957c8fa56f9731e914c4d8a6d2f2b'
const tree = await dh([withNonPackageDepFixture], { depth: 0, lockfileDir: withNonPackageDepFixture })
const tree = await buildDependenciesHierarchy([withNonPackageDepFixture], { depth: 0, lockfileDir: withNonPackageDepFixture })
expect(tree).toStrictEqual({
[withNonPackageDepFixture]: {
dependencies: [

View File

@@ -9,9 +9,9 @@ export interface CreateDirectoryFetcherOptions {
includeOnlyPackageFiles?: boolean
}
export default (
export function createDirectoryFetcher (
opts?: CreateDirectoryFetcherOptions
) => {
) {
const fetchFromDir = opts?.includeOnlyPackageFiles ? fetchPackageFilesFromDir : fetchAllFilesFromDir
const directoryFetcher: DirectoryFetcher = (cafs, resolution, opts) => {

View File

@@ -1,13 +1,13 @@
/// <reference path="../../../typings/index.d.ts"/>
import path from 'path'
import createFetcher from '@pnpm/directory-fetcher'
import { createDirectoryFetcher } from '@pnpm/directory-fetcher'
import fixtures from '@pnpm/test-fixtures'
const f = fixtures(__dirname)
test('fetch including only package files', async () => {
process.chdir(f.find('simple-pkg'))
const fetcher = createFetcher({ includeOnlyPackageFiles: true })
const fetcher = createDirectoryFetcher({ includeOnlyPackageFiles: true })
// eslint-disable-next-line
const fetchResult = await fetcher.directory({} as any, {
@@ -30,7 +30,7 @@ test('fetch including only package files', async () => {
test('fetch including all files', async () => {
process.chdir(f.find('simple-pkg'))
const fetcher = createFetcher()
const fetcher = createDirectoryFetcher()
// eslint-disable-next-line
const fetchResult = await fetcher.directory({} as any, {
@@ -54,7 +54,7 @@ test('fetch including all files', async () => {
test('fetch a directory that has no package.json', async () => {
process.chdir(f.find('no-manifest'))
const fetcher = createFetcher()
const fetcher = createDirectoryFetcher()
const manifest = {
resolve: jest.fn(),
reject: jest.fn(),

View File

@@ -15,7 +15,7 @@ pnpm add @pnpm/error
### Usage
```ts
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
try {
throw new PnpmError('THE_ERROR_CODE', 'The error message')

View File

@@ -1,6 +1,6 @@
import { WANTED_LOCKFILE } from '@pnpm/constants'
export default class PnpmError extends Error {
export class PnpmError extends Error {
public readonly code: string
public readonly hint?: string
public attempts?: number

View File

@@ -1,5 +1,5 @@
import path from 'path'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import { tryReadProjectManifest } from '@pnpm/read-project-manifest'
import { Dependencies, ProjectManifest } from '@pnpm/types'
import fromPairs from 'ramda/src/fromPairs'
@@ -20,7 +20,7 @@ export interface MakePublishManifestOptions {
readmeFile?: string
}
export default async function makePublishManifest (
export async function createExportableManifest (
dir: string,
originalManifest: ProjectManifest,
opts?: MakePublishManifestOptions

View File

@@ -1,8 +1,8 @@
/// <reference path="../../../typings/index.d.ts"/>
import exportableManifest from '@pnpm/exportable-manifest'
import { createExportableManifest } from '@pnpm/exportable-manifest'
test('the pnpm options are removed', async () => {
expect(await exportableManifest(process.cwd(), {
expect(await createExportableManifest(process.cwd(), {
name: 'foo',
version: '1.0.0',
dependencies: {
@@ -23,7 +23,7 @@ test('the pnpm options are removed', async () => {
})
test('publish lifecycle scripts are removed', async () => {
expect(await exportableManifest(process.cwd(), {
expect(await createExportableManifest(process.cwd(), {
name: 'foo',
version: '1.0.0',
scripts: {
@@ -47,7 +47,7 @@ test('publish lifecycle scripts are removed', async () => {
})
test('readme added to published manifest', async () => {
expect(await exportableManifest(process.cwd(), {
expect(await createExportableManifest(process.cwd(), {
name: 'foo',
version: '1.0.0',
}, { readmeFile: 'readme content' })).toStrictEqual({

View File

@@ -2,8 +2,8 @@ import { FetchFromRegistry } from '@pnpm/fetching-types'
import fetch, { RetryTimeoutOptions } from './fetch'
import createFetchFromRegistry, { fetchWithAgent, AgentOptions } from './fetchFromRegistry'
export default fetch
export {
fetch,
AgentOptions,
createFetchFromRegistry,
fetchWithAgent,

View File

@@ -4,7 +4,7 @@ import {
Lockfile,
PackageSnapshots,
} from '@pnpm/lockfile-types'
import lockfileWalker, { LockfileWalkerStep } from '@pnpm/lockfile-walker'
import { lockfileWalker, LockfileWalkerStep } from '@pnpm/lockfile-walker'
import pnpmLogger from '@pnpm/logger'
import { DependenciesField } from '@pnpm/types'
import { filterImporter } from './filterImporter'

View File

@@ -6,7 +6,7 @@ import {
} from '@pnpm/lockfile-types'
import { nameVerFromPkgSnapshot } from '@pnpm/lockfile-utils'
import pnpmLogger from '@pnpm/logger'
import packageIsInstallable from '@pnpm/package-is-installable'
import { packageIsInstallable } from '@pnpm/package-is-installable'
import { DependenciesField } from '@pnpm/types'
import * as dp from 'dependency-path'
import unnest from 'ramda/src/unnest'

View File

@@ -1,5 +1,5 @@
import path from 'path'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import * as micromatch from 'micromatch'
import execa from 'execa'
import findUp from 'find-up'

View File

@@ -1,6 +1,6 @@
import findWorkspacePackages, { Project } from '@pnpm/find-workspace-packages'
import matcher from '@pnpm/matcher'
import createPkgGraph, { Package, PackageNode } from 'pkgs-graph'
import { findWorkspacePackages, Project } from '@pnpm/find-workspace-packages'
import { createMatcher } from '@pnpm/matcher'
import { createPkgGraph, Package, PackageNode } from 'pkgs-graph'
import isSubdir from 'is-subdir'
import difference from 'ramda/src/difference'
import partition from 'ramda/src/partition'
@@ -114,7 +114,7 @@ export async function filterPkgsBySelectorObjects<T> (
const { graph } = createPkgGraph<T>(pkgs, { linkWorkspacePackages: opts.linkWorkspacePackages })
if (allPackageSelectors.length > 0) {
filteredGraph = await filterGraph(graph, allPackageSelectors, {
filteredGraph = await filterWorkspacePackages(graph, allPackageSelectors, {
workspaceDir: opts.workspaceDir,
testPattern: opts.testPattern,
changedFilesIgnorePattern: opts.changedFilesIgnorePattern,
@@ -126,7 +126,7 @@ export async function filterPkgsBySelectorObjects<T> (
if (prodPackageSelectors.length > 0) {
const { graph } = createPkgGraph<T>(pkgs, { ignoreDevDeps: true, linkWorkspacePackages: opts.linkWorkspacePackages })
prodFilteredGraph = await filterGraph(graph, prodPackageSelectors, {
prodFilteredGraph = await filterWorkspacePackages(graph, prodPackageSelectors, {
workspaceDir: opts.workspaceDir,
testPattern: opts.testPattern,
changedFilesIgnorePattern: opts.changedFilesIgnorePattern,
@@ -151,7 +151,7 @@ export async function filterPkgsBySelectorObjects<T> (
}
}
export default async function filterGraph<T> (
export async function filterWorkspacePackages<T> (
pkgGraph: PackageGraph<T>,
packageSelectors: PackageSelector[],
opts: {
@@ -295,7 +295,7 @@ function matchPackages<T> (
graph: PackageGraph<T>,
pattern: string
): string[] {
const match = matcher(pattern)
const match = createMatcher(pattern)
const matches = Object.keys(graph).filter((id) => graph[id].package.manifest.name && match(graph[id].package.manifest.name!))
if (matches.length === 0 && !pattern.startsWith('@') && !pattern.includes('/')) {
const scopedMatches = matchPackages(graph, `@*/${pattern}`)

View File

@@ -1,6 +1,6 @@
import { promisify } from 'util'
import PnpmError from '@pnpm/error'
import filterWorkspacePackages, { PackageGraph } from '@pnpm/filter-workspace-packages'
import { PnpmError } from '@pnpm/error'
import { filterWorkspacePackages, PackageGraph } from '@pnpm/filter-workspace-packages'
import './parsePackageSelector'
import fs from 'fs'
import execa from 'execa'

View File

@@ -24,7 +24,7 @@ export interface Project {
writeProjectManifest: (manifest: ProjectManifest, force?: boolean | undefined) => Promise<void>
}
export default async function findPkgs (root: string, opts?: Options): Promise<Project[]> {
export async function findPackages (root: string, opts?: Options): Promise<Project[]> {
opts = opts ?? {}
const globOpts = { ...opts, cwd: root, includeRoot: undefined }
globOpts.ignore = opts.ignore ?? DEFAULT_IGNORE

View File

@@ -1,6 +1,6 @@
/// <reference path="../../../typings/index.d.ts"/>
import path from 'path'
import findPackages from 'find-packages'
import { findPackages } from 'find-packages'
const fixtures = path.join(__dirname, 'fixtures')

View File

@@ -1,12 +1,12 @@
import fs from 'fs'
import path from 'path'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import findUp from 'find-up'
const WORKSPACE_DIR_ENV_VAR = 'NPM_CONFIG_WORKSPACE_DIR'
const WORKSPACE_MANIFEST_FILENAME = 'pnpm-workspace.yaml'
export default async function findWorkspaceDir (cwd: string) {
export async function findWorkspaceDir (cwd: string) {
const workspaceManifestDirEnvVar = process.env[WORKSPACE_DIR_ENV_VAR] ?? process.env[WORKSPACE_DIR_ENV_VAR.toLowerCase()]
const workspaceManifestLocation = workspaceManifestDirEnvVar
? path.join(workspaceManifestDirEnvVar, 'pnpm-workspace.yaml')

View File

@@ -1,7 +1,7 @@
/// <reference path="../../../typings/index.d.ts"/>
import path from 'path'
import fs from 'fs'
import findWorkspaceDir from '@pnpm/find-workspace-dir'
import { findWorkspaceDir } from '@pnpm/find-workspace-dir'
const NPM_CONFIG_WORKSPACE_DIR_ENV_VAR = 'NPM_CONFIG_WORKSPACE_DIR'
const FAKE_PATH = 'FAKE_PATH'

View File

@@ -2,12 +2,12 @@ import path from 'path'
import { packageIsInstallable } from '@pnpm/cli-utils'
import { WORKSPACE_MANIFEST_FILENAME } from '@pnpm/constants'
import { Project } from '@pnpm/types'
import findPackages from 'find-packages'
import { findPackages } from 'find-packages'
import readYamlFile from 'read-yaml-file'
export { Project }
export default async function (
export async function findWorkspacePackages (
workspaceRoot: string,
opts?: {
engineStrict?: boolean

View File

@@ -1,4 +1,4 @@
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import ErrorRelatedSources from './ErrorRelatedSources'
export type BreakingChangeErrorOptions = ErrorRelatedSources & {

View File

@@ -1,4 +1,4 @@
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
export default class UnexpectedStoreError extends PnpmError {
public expectedStorePath: string

View File

@@ -1,4 +1,4 @@
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
export default class UnexpectedVirtualStoreDirError extends PnpmError {
public expected: string

View File

@@ -1,14 +1,14 @@
import { promises as fs } from 'fs'
import path from 'path'
import { contextLogger, packageManifestLogger } from '@pnpm/core-loggers'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import { Lockfile } from '@pnpm/lockfile-file'
import logger from '@pnpm/logger'
import {
IncludedDependencies,
Modules,
} from '@pnpm/modules-yaml'
import readProjectsContext from '@pnpm/read-projects-context'
import { readProjectsContext } from '@pnpm/read-projects-context'
import {
DEPENDENCIES_FIELDS,
HoistedDependencies,

View File

@@ -1,11 +1,11 @@
import path from 'path'
import type { GitFetcher } from '@pnpm/fetcher-base'
import preparePackage from '@pnpm/prepare-package'
import { preparePackage } from '@pnpm/prepare-package'
import rimraf from '@zkochan/rimraf'
import execa from 'execa'
import { URL } from 'url'
export default (createOpts?: { gitShallowHosts?: string[] }) => {
export function createGitFetcher (createOpts?: { gitShallowHosts?: string[] }) {
const allowedHosts = new Set(createOpts?.gitShallowHosts ?? [])
const gitFetcher: GitFetcher = async (cafs, resolution, opts) => {

View File

@@ -1,7 +1,7 @@
/// <reference path="../../../typings/index.d.ts"/>
import path from 'path'
import createCafsStore from '@pnpm/create-cafs-store'
import createFetcher from '@pnpm/git-fetcher'
import { createCafsStore } from '@pnpm/create-cafs-store'
import { createGitFetcher } from '@pnpm/git-fetcher'
import { DependencyManifest } from '@pnpm/types'
import pDefer from 'p-defer'
import tempy from 'tempy'
@@ -22,7 +22,7 @@ beforeEach(() => {
test('fetch', async () => {
const cafsDir = tempy.directory()
const fetch = createFetcher().git
const fetch = createGitFetcher().git
const manifest = pDefer<DependencyManifest>()
const { filesIndex } = await fetch(
createCafsStore(cafsDir),
@@ -43,7 +43,7 @@ test('fetch', async () => {
test('fetch a package from Git that has a prepare script', async () => {
const cafsDir = tempy.directory()
const fetch = createFetcher().git
const fetch = createGitFetcher().git
const manifest = pDefer<DependencyManifest>()
const { filesIndex } = await fetch(
createCafsStore(cafsDir),
@@ -62,7 +62,7 @@ test('fetch a package from Git that has a prepare script', async () => {
// Test case for https://github.com/pnpm/pnpm/issues/1866
test('fetch a package without a package.json', async () => {
const cafsDir = tempy.directory()
const fetch = createFetcher().git
const fetch = createGitFetcher().git
const manifest = pDefer<DependencyManifest>()
const { filesIndex } = await fetch(
createCafsStore(cafsDir),
@@ -82,7 +82,7 @@ test('fetch a package without a package.json', async () => {
// Covers the regression reported in https://github.com/pnpm/pnpm/issues/4064
test('fetch a big repository', async () => {
const cafsDir = tempy.directory()
const fetch = createFetcher().git
const fetch = createGitFetcher().git
const manifest = pDefer<DependencyManifest>()
const { filesIndex } = await fetch(createCafsStore(cafsDir),
{
@@ -95,7 +95,7 @@ test('fetch a big repository', async () => {
test('still able to shallow fetch for allowed hosts', async () => {
const cafsDir = tempy.directory()
const fetch = createFetcher({ gitShallowHosts: ['github.com'] }).git
const fetch = createGitFetcher({ gitShallowHosts: ['github.com'] }).git
const manifest = pDefer<DependencyManifest>()
const resolution = {
commit: 'c9b30e71d704cd30fa71f2edd1ecc7dcc4985493',

View File

@@ -5,7 +5,7 @@ import parsePref, { HostedPackageSpec } from './parsePref'
export { HostedPackageSpec }
export default function (
export function createGitResolver (
opts: {}
) {
return async function resolveGit (

View File

@@ -1,5 +1,5 @@
import url, { URL } from 'url'
import fetch from '@pnpm/fetch'
import { fetch } from '@pnpm/fetch'
import git from 'graceful-git'
import HostedGit from 'hosted-git-info'

View File

@@ -1,10 +1,10 @@
/// <reference path="../../../typings/index.d.ts"/>
import path from 'path'
import createResolveFromGit from '@pnpm/git-resolver'
import { createGitResolver } from '@pnpm/git-resolver'
import git from 'graceful-git'
import isWindows from 'is-windows'
const resolveFromGit = createResolveFromGit({})
const resolveFromGit = createGitResolver({})
test('resolveFromGit() with commit', async () => {
const resolveResult = await resolveFromGit({ pref: 'zkochan/is-negative#163360a8d3ae6bee9524541043197ff356f8ed99' })

View File

@@ -1,6 +1,6 @@
import { promises as fs } from 'fs'
import path from 'path'
import buildModules from '@pnpm/build-modules'
import { buildModules } from '@pnpm/build-modules'
import { calcDepState, DepsStateCache } from '@pnpm/calc-dep-state'
import {
LAYOUT_VERSION,
@@ -14,16 +14,16 @@ import {
statsLogger,
summaryLogger,
} from '@pnpm/core-loggers'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import {
filterLockfileByImportersAndEngine,
} from '@pnpm/filter-lockfile'
import hoist from '@pnpm/hoist'
import { hoist } from '@pnpm/hoist'
import {
runLifecycleHooksConcurrently,
makeNodeRequireOption,
} from '@pnpm/lifecycle'
import linkBins, { linkBinsOfPackages } from '@pnpm/link-bins'
import { linkBins, linkBinsOfPackages } from '@pnpm/link-bins'
import {
getLockfileImporterId,
Lockfile,
@@ -48,13 +48,13 @@ import {
write as writeModulesYaml,
} from '@pnpm/modules-yaml'
import { HoistingLimits } from '@pnpm/real-hoist'
import { fromDir as readPackageFromDir } from '@pnpm/read-package-json'
import { readPackageJsonFromDir } from '@pnpm/read-package-json'
import { readProjectManifestOnly, safeReadProjectManifestOnly } from '@pnpm/read-project-manifest'
import {
PackageFilesResponse,
StoreController,
} from '@pnpm/store-controller-types'
import symlinkDependency, { symlinkDirectRootDependency } from '@pnpm/symlink-dependency'
import { symlinkDependency, symlinkDirectRootDependency } from '@pnpm/symlink-dependency'
import { DependencyManifest, HoistedDependencies, ProjectManifest, Registries } from '@pnpm/types'
import * as dp from 'dependency-path'
import pLimit from 'p-limit'
@@ -790,7 +790,7 @@ async function linkAllBins (
.filter(({ hasBin }) => hasBin)
.map(async ({ dir }) => ({
location: dir,
manifest: await readPackageFromDir(dir) as DependencyManifest,
manifest: await readPackageJsonFromDir(dir) as DependencyManifest,
}))
)

View File

@@ -5,7 +5,7 @@ import {
removalLogger,
statsLogger,
} from '@pnpm/core-loggers'
import linkBins from '@pnpm/link-bins'
import { linkBins } from '@pnpm/link-bins'
import logger from '@pnpm/logger'
import {
PackageFilesResponse,

View File

@@ -14,7 +14,7 @@ import {
} from '@pnpm/lockfile-utils'
import logger from '@pnpm/logger'
import { IncludedDependencies } from '@pnpm/modules-yaml'
import packageIsInstallable from '@pnpm/package-is-installable'
import { packageIsInstallable } from '@pnpm/package-is-installable'
import { PatchFile, Registries } from '@pnpm/types'
import {
FetchPackageToStoreFunction,

View File

@@ -10,13 +10,13 @@ import {
pkgSnapshotToResolution,
} from '@pnpm/lockfile-utils'
import { IncludedDependencies } from '@pnpm/modules-yaml'
import packageIsInstallable from '@pnpm/package-is-installable'
import { packageIsInstallable } from '@pnpm/package-is-installable'
import { PatchFile, Registries } from '@pnpm/types'
import {
FetchPackageToStoreFunction,
StoreController,
} from '@pnpm/store-controller-types'
import hoist, { HoistingLimits, HoisterResult } from '@pnpm/real-hoist'
import { hoist, HoistingLimits, HoisterResult } from '@pnpm/real-hoist'
import * as dp from 'dependency-path'
import {
DependenciesGraph,

View File

@@ -1,11 +1,11 @@
import path from 'path'
import createClient from '@pnpm/client'
import { createClient } from '@pnpm/client'
import { HeadlessOptions } from '@pnpm/headless'
import createStore from '@pnpm/package-store'
import { safeReadPackageFromDir } from '@pnpm/read-package-json'
import readProjectsContext from '@pnpm/read-projects-context'
import { createPackageStore } from '@pnpm/package-store'
import { safeReadPackageJsonFromDir } from '@pnpm/read-package-json'
import { readProjectsContext } from '@pnpm/read-projects-context'
import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock'
import storePath from '@pnpm/store-path'
import { getStorePath } from '@pnpm/store-path'
import fromPairs from 'ramda/src/fromPairs'
import tempy from 'tempy'
@@ -38,7 +38,7 @@ export default async function testDefaults (
],
{ lockfileDir }
)
storeDir = await storePath({
storeDir = await getStorePath({
pkgRoot: lockfileDir,
storePath: storeDir,
pnpmHomeDir: '',
@@ -51,7 +51,7 @@ export default async function testDefaults (
...resolveOpts,
...fetchOpts,
})
const storeController = await createStore(
const storeController = await createPackageStore(
resolve,
fetchers,
{
@@ -77,7 +77,7 @@ export default async function testDefaults (
pendingBuilds,
selectedProjectDirs: opts.selectedProjectDirs ?? projects.map((project) => project.rootDir),
allProjects: fromPairs(
await Promise.all(projects.map(async (project) => [project.rootDir, { ...project, manifest: await safeReadPackageFromDir(project.rootDir) }]))
await Promise.all(projects.map(async (project) => [project.rootDir, { ...project, manifest: await safeReadPackageJsonFromDir(project.rootDir) }]))
),
rawConfig: {},
registries: {

View File

@@ -1,20 +1,20 @@
import path from 'path'
import { WANTED_LOCKFILE } from '@pnpm/constants'
import linkBins, { WarnFunction } from '@pnpm/link-bins'
import { linkBins, WarnFunction } from '@pnpm/link-bins'
import {
Lockfile,
nameVerFromPkgSnapshot,
} from '@pnpm/lockfile-utils'
import lockfileWalker, { LockfileWalkerStep } from '@pnpm/lockfile-walker'
import { lockfileWalker, LockfileWalkerStep } from '@pnpm/lockfile-walker'
import logger from '@pnpm/logger'
import matcher from '@pnpm/matcher'
import symlinkDependency from '@pnpm/symlink-dependency'
import { createMatcher } from '@pnpm/matcher'
import { symlinkDependency } from '@pnpm/symlink-dependency'
import { HoistedDependencies } from '@pnpm/types'
import * as dp from 'dependency-path'
const hoistLogger = logger('hoist')
export default async function hoistByLockfile (
export async function hoist (
opts: {
extraNodePath?: string[]
preferSymlinkedExecutables?: boolean
@@ -80,8 +80,8 @@ function createGetAliasHoistType (
publicHoistPattern: string[],
privateHoistPattern: string[]
): GetAliasHoistType {
const publicMatcher = matcher(publicHoistPattern)
const privateMatcher = matcher(privateHoistPattern)
const publicMatcher = createMatcher(publicHoistPattern)
const privateMatcher = createMatcher(privateHoistPattern)
return (alias: string) => {
if (publicMatcher(alias)) return 'public'
if (privateMatcher(alias)) return 'private'

View File

@@ -1,5 +1,5 @@
import { PackageManifest, PackageExtension, ReadPackageHook } from '@pnpm/types'
import parseWantedDependency from '@pnpm/parse-wanted-dependency'
import { parseWantedDependency } from '@pnpm/parse-wanted-dependency'
import semver from 'semver'
interface PackageExtensionMatch {

View File

@@ -1,14 +1,14 @@
import { PeerDependencyRules, ReadPackageHook } from '@pnpm/types'
import matcher from '@pnpm/matcher'
import { createMatcher } from '@pnpm/matcher'
import isEmpty from 'ramda/src/isEmpty'
export default function (
peerDependencyRules: PeerDependencyRules
): ReadPackageHook {
const ignoreMissingPatterns = [...new Set(peerDependencyRules.ignoreMissing ?? [])]
const ignoreMissingMatcher = matcher(ignoreMissingPatterns)
const ignoreMissingMatcher = createMatcher(ignoreMissingPatterns)
const allowAnyPatterns = [...new Set(peerDependencyRules.allowAny ?? [])]
const allowAnyMatcher = matcher(allowAnyPatterns)
const allowAnyMatcher = createMatcher(allowAnyPatterns)
return ((pkg) => {
if (isEmpty(pkg.peerDependencies)) return pkg
for (const [peerName, peerVersion] of Object.entries(pkg.peerDependencies ?? {})) {

View File

@@ -1,7 +1,7 @@
import path from 'path'
import partition from 'ramda/src/partition'
import { Dependencies, PackageManifest, ReadPackageHook } from '@pnpm/types'
import parseOverrides from '@pnpm/parse-overrides'
import { parseOverrides } from '@pnpm/parse-overrides'
import normalizePath from 'normalize-path'
import semver from 'semver'

View File

@@ -1,5 +1,5 @@
import path from 'path'
import { safeReadPackageFromDir } from '@pnpm/read-package-json'
import { safeReadPackageJsonFromDir } from '@pnpm/read-package-json'
import exists from 'path-exists'
import runLifecycleHook, { RunLifecycleHookOptions } from './runLifecycleHook'
import runLifecycleHooksConcurrently, { RunLifecycleHooksConcurrentlyOptions } from './runLifecycleHooksConcurrently'
@@ -10,8 +10,8 @@ export function makeNodeRequireOption (modulePath: string) {
return { NODE_OPTIONS }
}
export default runLifecycleHook
export {
runLifecycleHook,
runLifecycleHooksConcurrently,
RunLifecycleHookOptions,
RunLifecycleHooksConcurrentlyOptions,
@@ -20,7 +20,7 @@ export {
export async function runPostinstallHooks (
opts: RunLifecycleHookOptions
): Promise<boolean> {
const pkg = await safeReadPackageFromDir(opts.pkgRoot)
const pkg = await safeReadPackageJsonFromDir(opts.pkgRoot)
if (pkg == null) return false
if (pkg.scripts == null) {
pkg.scripts = {}

View File

@@ -1,6 +1,6 @@
/// <reference path="../../../typings/index.d.ts"/>
import path from 'path'
import runLifecycleHook, { runPostinstallHooks } from '@pnpm/lifecycle'
import { runLifecycleHook, runPostinstallHooks } from '@pnpm/lifecycle'
import loadJsonFile from 'load-json-file'
import rimraf from '@zkochan/rimraf'

View File

@@ -1,11 +1,11 @@
import { promises as fs, existsSync } from 'fs'
import path from 'path'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import logger, { globalWarn } from '@pnpm/logger'
import { getAllDependenciesFromManifest } from '@pnpm/manifest-utils'
import binify, { Command } from '@pnpm/package-bins'
import readModulesDir from '@pnpm/read-modules-dir'
import { fromDir as readPackageJsonFromDir } from '@pnpm/read-package-json'
import { Command, getBinsFromPackageManifest } from '@pnpm/package-bins'
import { readModulesDir } from '@pnpm/read-modules-dir'
import { readPackageJsonFromDir } from '@pnpm/read-package-json'
import { safeReadProjectManifestOnly } from '@pnpm/read-project-manifest'
import { DependencyManifest, ProjectManifest } from '@pnpm/types'
import cmdShim from '@zkochan/cmd-shim'
@@ -31,7 +31,7 @@ export type WarningCode = 'BINARIES_CONFLICT' | 'EMPTY_BIN'
export type WarnFunction = (msg: string, code: WarningCode) => void
export default async (
export async function linkBins (
modulesDir: string,
binsDir: string,
opts: LinkBinOptions & {
@@ -40,7 +40,7 @@ export default async (
projectManifest?: ProjectManifest
warn: WarnFunction
}
): Promise<string[]> => {
): Promise<string[]> {
const allDeps = await readModulesDir(modulesDir)
// If the modules dir does not exist, do nothing
if (allDeps === null) return []
@@ -70,7 +70,7 @@ export default async (
)
const cmdsToLink = directDependencies != null ? preferDirectCmds(allCmds) : allCmds
return linkBins(cmdsToLink, binsDir, opts)
return _linkBins(cmdsToLink, binsDir, opts)
}
function preferDirectCmds (allCmds: Array<CommandInfo & { isDirectDependency?: boolean }>) {
@@ -101,7 +101,7 @@ export async function linkBinsOfPackages (
.filter((cmds: Command[]) => cmds.length)
)
return linkBins(allCmds, binsTarget, opts)
return _linkBins(allCmds, binsTarget, opts)
}
type CommandInfo = Command & {
@@ -111,7 +111,7 @@ type CommandInfo = Command & {
nodeExecPath?: string
}
async function linkBins (
async function _linkBins (
allCmds: CommandInfo[],
binsDir: string,
opts: LinkBinOptions
@@ -184,7 +184,7 @@ async function getPackageBins (
}
async function getPackageBinsFromManifest (manifest: DependencyManifest, pkgDir: string, nodeExecPath?: string): Promise<CommandInfo[]> {
const cmds = await binify(manifest, pkgDir)
const cmds = await getBinsFromPackageManifest(manifest, pkgDir)
return cmds.map((cmd) => ({
...cmd,
ownName: cmd.name === manifest.name,

View File

@@ -2,7 +2,8 @@
import { promises as fs, writeFileSync } from 'fs'
import path from 'path'
import logger, { globalWarn } from '@pnpm/logger'
import linkBins, {
import {
linkBins,
linkBinsOfPackages,
} from '@pnpm/link-bins'
import fixtures from '@pnpm/test-fixtures'

View File

@@ -1,4 +1,4 @@
import matcher from '@pnpm/matcher'
import { createMatcher } from '@pnpm/matcher'
import npa from '@pnpm/npm-package-arg'
import { SearchFunction } from 'dependencies-hierarchy'
import semver from 'semver'
@@ -31,13 +31,13 @@ function search (
function parseSearchQuery (query: string) {
const parsed = npa(query)
if (parsed.raw === parsed.name) {
return { matchName: matcher(parsed.name) }
return { matchName: createMatcher(parsed.name) }
}
if (parsed.type !== 'version' && parsed.type !== 'range') {
throw new Error(`Invalid queryment - ${query}. List can search only by version or range`)
}
return {
matchName: matcher(parsed.name),
matchName: createMatcher(parsed.name),
matchVersion: (version: string) => semver.satisfies(version, parsed.fetchSpec),
}
}

View File

@@ -1,6 +1,6 @@
import { readProjectManifestOnly } from '@pnpm/read-project-manifest'
import { DependenciesField, Registries } from '@pnpm/types'
import dh from 'dependencies-hierarchy'
import { buildDependenciesHierarchy } from 'dependencies-hierarchy'
import createPackagesSearcher from './createPackagesSearcher'
import renderJson from './renderJson'
import renderParseable from './renderParseable'
@@ -16,7 +16,7 @@ const DEFAULTS = {
showExtraneous: true,
}
export async function forPackages (
export async function listForPackages (
packages: string[],
projectPaths: string[],
maybeOpts: {
@@ -34,21 +34,21 @@ export async function forPackages (
const search = createPackagesSearcher(packages)
const pkgs = await Promise.all(
Object.entries(await dh(projectPaths, {
Object.entries(await buildDependenciesHierarchy(projectPaths, {
depth: opts.depth,
include: maybeOpts?.include,
lockfileDir: maybeOpts?.lockfileDir,
registries: opts.registries,
search,
}))
.map(async ([projectPath, dependenciesHierarchy]) => {
.map(async ([projectPath, buildDependenciesHierarchy]) => {
const entryPkg = await readProjectManifestOnly(projectPath)
return {
name: entryPkg.name,
version: entryPkg.version,
path: projectPath,
...dependenciesHierarchy,
...buildDependenciesHierarchy,
} as PackageDependencyHierarchy
})
)
@@ -63,7 +63,7 @@ export async function forPackages (
})
}
export default async function (
export async function list (
projectPaths: string[],
maybeOpts: {
alwaysPrintRootPackage?: boolean
@@ -85,7 +85,7 @@ export default async function (
acc[projectPath] = {}
return acc
}, {})
: await dh(projectPaths, {
: await buildDependenciesHierarchy(projectPaths, {
depth: opts.depth,
include: maybeOpts?.include,
lockfileDir: maybeOpts?.lockfileDir,

View File

@@ -1,4 +1,4 @@
import readPackageJson from '@pnpm/read-package-json'
import { readPackageJson } from '@pnpm/read-package-json'
import pLimit from 'p-limit'
const limitPkgReads = pLimit(4)

View File

@@ -1,6 +1,6 @@
/// <reference path="../../../typings/index.d.ts"/>
import path from 'path'
import list, { forPackages as listForPackages } from '@pnpm/list'
import { list, listForPackages } from '@pnpm/list'
import chalk from 'chalk'
import cliColumns from 'cli-columns'
import renderTree from '../lib/renderTree'

View File

@@ -1,6 +1,6 @@
import { existsSync } from 'fs'
import path from 'path'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import gfs from '@pnpm/graceful-fs'
import { readProjectManifestOnly } from '@pnpm/read-project-manifest'
import {
@@ -17,7 +17,7 @@ export { WantedLocalDependency }
/**
* Resolves a package hosted on the local filesystem
*/
export default async function resolveLocal (
export async function resolveFromLocal (
wantedDependency: WantedLocalDependency,
opts: {
lockfileDir?: string

View File

@@ -1,6 +1,6 @@
import os from 'os'
import path from 'path'
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
import normalize from 'normalize-path'
const isWindows = process.platform === 'win32' || global['FAKE_WINDOWS']

View File

@@ -1,6 +1,6 @@
/// <reference path="../../../typings/index.d.ts"/>
import path from 'path'
import resolveFromLocal from '@pnpm/local-resolver'
import { resolveFromLocal } from '@pnpm/local-resolver'
import normalize from 'normalize-path'
test('resolve directory', async () => {

View File

@@ -1,4 +1,4 @@
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
export default class LockfileBreakingChangeError extends PnpmError {
public filename: string

View File

@@ -1,5 +1,5 @@
import { Lockfile } from '@pnpm/lockfile-types'
import mergeLockfileChanges from '@pnpm/merge-lockfile-changes'
import { mergeLockfileChanges } from '@pnpm/merge-lockfile-changes'
import yaml from 'js-yaml'
const MERGE_CONFLICT_PARENT = '|||||||'

View File

@@ -4,8 +4,8 @@ import {
LOCKFILE_VERSION,
WANTED_LOCKFILE,
} from '@pnpm/constants'
import PnpmError from '@pnpm/error'
import mergeLockfileChanges from '@pnpm/merge-lockfile-changes'
import { PnpmError } from '@pnpm/error'
import { mergeLockfileChanges } from '@pnpm/merge-lockfile-changes'
import { Lockfile } from '@pnpm/lockfile-types'
import { DEPENDENCIES_FIELDS } from '@pnpm/types'
import comverToSemver from 'comver-to-semver'

View File

@@ -44,7 +44,7 @@ export function lockfileWalkerGroupImporterSteps (
})
}
export default function lockfileWalker (
export function lockfileWalker (
lockfile: Lockfile,
importerIds: string[],
opts?: {

View File

@@ -1,5 +1,5 @@
import PnpmError from '@pnpm/error'
import findWorkspaceDir from '@pnpm/find-workspace-dir'
import { PnpmError } from '@pnpm/error'
import { findWorkspaceDir } from '@pnpm/find-workspace-dir'
import makeDedicatedLockfile from '.'
main() // eslint-disable-line

View File

@@ -1,6 +1,6 @@
import path from 'path'
import pnpmExec from '@pnpm/exec'
import exportableManifest from '@pnpm/exportable-manifest'
import { createExportableManifest } from '@pnpm/exportable-manifest'
import {
getLockfileImporterId,
ProjectSnapshot,
@@ -8,7 +8,7 @@ import {
writeWantedLockfile,
} from '@pnpm/lockfile-file'
import { pruneSharedLockfile } from '@pnpm/prune-lockfile'
import readProjectManifest from '@pnpm/read-project-manifest'
import { readProjectManifest } from '@pnpm/read-project-manifest'
import { DEPENDENCIES_FIELDS } from '@pnpm/types'
import fromPairs from 'ramda/src/fromPairs'
import renameOverwrite from 'rename-overwrite'
@@ -36,7 +36,7 @@ export default async function (lockfileDir: string, projectDir: string) {
await writeWantedLockfile(projectDir, dedicatedLockfile)
const { manifest, writeProjectManifest } = await readProjectManifest(projectDir)
const publishManifest = await exportableManifest(projectDir, manifest)
const publishManifest = await createExportableManifest(projectDir, manifest)
await writeProjectManifest(publishManifest)
const modulesDir = path.join(projectDir, 'node_modules')

View File

@@ -1,4 +1,4 @@
import PnpmError from '@pnpm/error'
import { PnpmError } from '@pnpm/error'
export type PinnedVersion = 'major' | 'minor' | 'patch' | 'none'

View File

@@ -3,8 +3,8 @@ import escapeStringRegexp from 'escape-string-regexp'
type Matcher = (input: string) => boolean
type MatcherWithIndex = (input: string) => number
export default function matcher (patterns: string[] | string): Matcher {
const m = matcherWithIndex(Array.isArray(patterns) ? patterns : [patterns])
export function createMatcher (patterns: string[] | string): Matcher {
const m = createMatcherWithIndex(Array.isArray(patterns) ? patterns : [patterns])
return (input) => m(input) !== -1
}
@@ -13,7 +13,7 @@ interface MatcherFunction {
ignore: boolean
}
export function matcherWithIndex (patterns: string[]): MatcherWithIndex {
export function createMatcherWithIndex (patterns: string[]): MatcherWithIndex {
switch (patterns.length) {
case 0: return () => -1
case 1: return matcherWhenOnlyOnePatternWithIndex(patterns[0])

Some files were not shown because too many files have changed in this diff Show More