From 1c8c4e49f5b1294f6353933ddbd2ffc9b08dd6bc Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Fri, 13 Mar 2026 02:02:38 +0100 Subject: [PATCH] style: add eslint-plugin-simple-import-sort (#10947) Add eslint-plugin-simple-import-sort to enforce consistent import ordering: - Node.js builtins first - External packages second - Relative imports last - Named imports sorted alphabetically within each statement --- .meta-updater/src/index.ts | 7 +-- __utils__/assert-project/src/index.ts | 4 +- __utils__/assert-project/src/isExecutable.ts | 1 + __utils__/assert-project/test/index.ts | 1 + __utils__/assert-store/src/index.ts | 3 +- __utils__/assert-store/test/index.ts | 1 + __utils__/eslint-config/index.js | 16 ++++++ __utils__/eslint-config/package.json | 1 + __utils__/get-release-text/src/main.ts | 5 +- __utils__/prepare/src/index.ts | 5 +- __utils__/scripts/src/copy-artifacts.ts | 5 +- __utils__/scripts/src/typecheck-only.ts | 9 ++-- __utils__/test-fixtures/src/index.ts | 1 + .../test-ipc-server/src/TestIpcServer.ts | 1 + __utils__/test-ipc-server/src/clientBin.ts | 1 + .../test/TestIpcServer.test.ts | 3 +- .../after-install/src/extendBuildOptions.ts | 3 +- building/after-install/src/index.ts | 8 +-- building/build-commands/src/rebuild.ts | 1 + building/build-commands/src/recursive.ts | 3 +- building/build-commands/test/index.ts | 10 ++-- building/build-commands/test/recursive.ts | 4 +- building/during-install/src/buildSequence.ts | 2 +- building/during-install/src/index.ts | 6 ++- building/policy-commands/src/approveBuilds.ts | 1 + .../src/getAutomaticallyIgnoredBuilds.ts | 2 + building/policy-commands/src/ignoredBuilds.ts | 1 + .../test/approveBuilds.test.ts | 17 +++--- .../test/ignoredBuilds.test.ts | 5 +- building/policy/src/index.ts | 2 +- cache/api/src/cacheDelete.ts | 3 +- cache/api/src/cacheList.ts | 1 + cache/api/src/cacheView.ts | 5 +- cache/api/src/index.ts | 2 +- cache/commands/src/cache.cmd.ts | 17 +++--- cache/commands/test/cacheDelete.cmd.test.ts | 5 +- cache/commands/test/cacheList.cmd.test.ts | 5 +- cache/commands/test/cacheView.cmd.test.ts | 5 +- .../src/getCatalogsFromWorkspaceManifest.ts | 2 +- catalogs/resolver/src/index.ts | 4 +- .../resolver/src/matchCatalogResolveResult.ts | 2 +- catalogs/resolver/src/resolveFromCatalog.ts | 2 +- .../resolver/test/resolveFromCatalog.test.ts | 4 +- cli/cli-utils/src/getConfig.ts | 3 +- cli/cli-utils/src/readProjectManifest.ts | 3 +- cli/cli-utils/test/getConfig.test.ts | 3 +- cli/default-reporter/src/index.ts | 5 +- cli/default-reporter/src/mergeOutputs.ts | 1 + cli/default-reporter/src/reportError.ts | 1 + .../src/reporterForClient/index.ts | 7 +-- .../src/reporterForClient/pkgsDiff.ts | 2 +- .../reportBigTarballsProgress.ts | 3 +- .../src/reporterForClient/reportContext.ts | 3 +- .../reporterForClient/reportDeprecations.ts | 5 +- .../reporterForClient/reportExecutionTime.ts | 2 +- .../src/reporterForClient/reportHooks.ts | 3 +- .../reporterForClient/reportIgnoredBuilds.ts | 2 +- .../reporterForClient/reportInstallChecks.ts | 1 + .../reportLifecycleScripts.ts | 10 ++-- .../src/reporterForClient/reportMisc.ts | 2 + .../reportPeerDependencyIssues.ts | 1 + .../src/reporterForClient/reportProgress.ts | 3 +- .../reporterForClient/reportRequestRetry.ts | 3 +- .../src/reporterForClient/reportStats.ts | 5 +- .../src/reporterForClient/reportSummary.ts | 14 ++--- .../reporterForClient/reportUpdateCheck.ts | 2 +- .../reporterForClient/utils/formatPrefix.ts | 2 + cli/default-reporter/test/filterLogHook.ts | 2 +- cli/default-reporter/test/index.ts | 6 ++- cli/default-reporter/test/reportingContext.ts | 1 + .../test/reportingDeprecations.ts | 5 +- cli/default-reporter/test/reportingErrors.ts | 5 +- .../test/reportingExecutionTime.ts | 3 +- .../test/reportingLifecycleScripts.ts | 3 +- .../test/reportingProgress.ts | 5 +- .../test/reportingRequestRetry.ts | 1 + cli/default-reporter/test/reportingScope.ts | 1 + .../test/reportingUpdateCheck.ts | 3 +- cli/parse-cli-args/test/index.ts | 1 + .../src/complete.ts | 3 +- .../src/completionServer.ts | 9 ++-- .../src/generateCompletion.ts | 3 +- .../src/getShell.test.ts | 2 +- .../plugin-commands-completion/src/index.ts | 2 +- .../test/generateCompletion.ts | 4 +- config/config-writer/src/index.ts | 2 +- config/config/src/Config.ts | 3 +- config/config/src/checkGlobalBinDir.ts | 1 + config/config/src/configFileKey.ts | 1 + config/config/src/env.ts | 3 +- config/config/src/getNetworkConfigs.ts | 4 +- .../config/src/getOptionsFromRootManifest.ts | 5 +- config/config/src/index.ts | 42 +++++++-------- config/config/src/projectConfig.ts | 5 +- config/config/src/transformPath.ts | 1 + config/config/test/concurrency.test.ts | 6 ++- config/config/test/dirs.test.ts | 1 + config/config/test/env.test.ts | 3 +- config/config/test/getNetworkConfigs.test.ts | 4 +- .../test/getOptionsFromRootManifest.test.ts | 3 +- config/config/test/globalBinDir.test.ts | 7 +-- config/config/test/index.ts | 8 +-- ...rrideSupportedArchitecturesWithCLI.test.ts | 3 +- config/config/test/parseAuthInfo.test.ts | 2 +- config/config/test/projectConfig.test.ts | 1 + config/config/test/transformPath.test.ts | 1 + config/deps-installer/src/index.ts | 2 +- .../deps-installer/src/installConfigDeps.ts | 4 +- .../deps-installer/src/migrateConfigDeps.ts | 3 +- .../deps-installer/src/resolveConfigDeps.ts | 9 ++-- .../src/resolveManifestDependencies.ts | 9 ++-- .../src/resolvePackageManagerIntegrities.ts | 3 +- .../deps-installer/test/installConfigDeps.ts | 1 + .../test/resolveConfigDeps.test.ts | 1 + config/package-is-installable/src/index.ts | 3 +- config/parse-overrides/src/index.ts | 4 +- config/plugin-commands-config/src/config.ts | 7 +-- .../plugin-commands-config/src/configGet.ts | 6 ++- .../plugin-commands-config/src/configList.ts | 2 +- .../plugin-commands-config/src/configSet.ts | 6 ++- .../src/getConfigFileInfo.ts | 3 +- .../src/parseConfigPropertyPath.ts | 2 +- .../src/processConfig.ts | 3 +- .../test/configDelete.test.ts | 3 +- .../test/configGet.test.ts | 2 + .../test/configList.test.ts | 1 + .../test/configSet.test.ts | 4 +- .../test/utils/index.ts | 4 +- crypto/hash/src/index.ts | 1 + crypto/hash/test/index.ts | 7 +-- crypto/object-hasher/src/index.ts | 3 +- crypto/object-hasher/test/index.ts | 2 +- dedupe/check/src/dedupeDiffCheck.ts | 7 +-- dedupe/check/src/index.ts | 2 +- dedupe/issues-renderer/src/index.ts | 2 +- dedupe/issues-renderer/test/index.ts | 3 +- .../src/iteratePkgsForVirtualStore.ts | 11 ++-- deps/graph-builder/src/lockfileToDepGraph.ts | 26 +++++----- deps/status/src/checkDepsStatus.ts | 12 +++-- deps/status/src/index.ts | 2 +- deps/status/src/statManifestFile.ts | 2 + deps/status/test/assertLockfilesEqual.test.ts | 1 + deps/status/test/checkDepsStatus.test.ts | 5 +- deps/status/test/statManifestFile.test.ts | 1 + env/node.fetcher/src/index.ts | 13 ++--- env/node.fetcher/test/node.test.ts | 11 ++-- env/node.resolver/src/index.ts | 11 ++-- env/path/src/index.ts | 1 + env/path/test/index.ts | 1 + env/plugin-commands-env/src/env.ts | 1 + env/plugin-commands-env/src/envList.ts | 3 +- env/plugin-commands-env/src/envUse.ts | 1 + env/system-node-version/src/index.ts | 2 +- exec/lifecycle/src/index.ts | 3 +- exec/lifecycle/src/runLifecycleHook.ts | 7 +-- .../src/runLifecycleHooksConcurrently.ts | 8 +-- exec/lifecycle/test/index.ts | 9 ++-- .../src/buildCommandNotFoundHint.ts | 5 +- .../src/create.ts | 3 +- .../plugin-commands-script-runners/src/dlx.ts | 14 ++--- .../src/exec.ts | 20 +++---- .../src/makeEnv.ts | 5 +- .../src/restart.ts | 1 + .../plugin-commands-script-runners/src/run.ts | 18 ++++--- .../src/runDepsStatusCheck.ts | 2 +- .../src/runRecursive.ts | 8 +-- .../test/create.ts | 3 +- .../test/dlx.createCacheKey.test.ts | 1 + .../test/dlx.e2e.ts | 4 +- .../test/dlx.ts | 4 +- .../test/exec.e2e.ts | 6 ++- .../test/exec.logs.ts | 4 +- .../test/exec.ts | 3 +- .../test/index.ts | 4 +- .../test/makeEnv.test.ts | 1 + .../test/runRecursive.ts | 10 ++-- .../test/testRecursive.ts | 4 +- .../test/utils/index.ts | 1 + .../test/verifyDepsBeforeRun.ts | 6 ++- exec/pnpm-cli-runner/src/index.ts | 1 + exec/prepare-package/src/index.ts | 1 + exec/prepare-package/test/index.ts | 5 +- exec/run-npm/src/index.ts | 1 + fetching/binary-fetcher/src/index.ts | 7 +-- fetching/binary-fetcher/test/index.ts | 5 +- fetching/directory-fetcher/src/index.ts | 1 + fetching/directory-fetcher/test/index.ts | 3 +- fetching/fetcher-base/src/index.ts | 12 ++--- fetching/git-fetcher/src/index.ts | 5 +- fetching/git-fetcher/test/index.ts | 5 +- fetching/pick-fetcher/src/index.ts | 4 +- fetching/pick-fetcher/test/customFetch.ts | 23 ++++---- fetching/pick-fetcher/test/pickFetcher.ts | 4 +- .../src/gitHostedTarballFetcher.ts | 3 +- fetching/tarball-fetcher/src/index.ts | 13 ++--- .../src/localTarballFetcher.ts | 3 +- .../src/remoteTarballFetcher.ts | 6 ++- fetching/tarball-fetcher/test/fetch.ts | 7 +-- fs/find-packages/src/index.ts | 3 +- fs/find-packages/test/index.ts | 1 + fs/graceful-fs/src/index.ts | 1 + fs/hard-link-dir/src/index.ts | 7 +-- fs/hard-link-dir/test/index.ts | 3 +- .../src/importIndexedDir.ts | 9 ++-- fs/indexed-pkg-importer/src/index.ts | 18 ++++--- .../test/createImportPackage.test.ts | 1 + .../test/importIndexedDir.race.test.ts | 1 + .../test/importIndexedDir.test.ts | 4 +- .../test/importingPkgWithInvalidFiles.ts | 3 +- fs/is-empty-dir-or-nothing/test/index.test.ts | 3 +- fs/msgpack-file/src/index.ts | 2 +- fs/msgpack-file/test/index.test.ts | 1 + fs/packlist/src/index.ts | 1 + fs/read-modules-dir/src/index.ts | 1 + fs/symlink-dependency/src/index.ts | 1 + .../src/symlinkDirectRootDependency.ts | 1 + .../test/symlinkDirectRootDependency.test.ts | 1 + .../commands/src/checkGlobalBinConflicts.ts | 9 ++-- global/commands/src/globalAdd.ts | 2 + global/commands/src/globalRemove.ts | 1 + global/commands/src/globalUpdate.ts | 4 +- global/commands/src/index.ts | 8 +-- global/commands/src/listGlobalPackages.ts | 2 +- global/commands/src/readInstalledPackages.ts | 1 + .../test/checkGlobalBinConflicts.test.ts | 1 + global/packages/src/index.ts | 2 +- global/packages/src/scanGlobalPackages.ts | 1 + hooks/pnpmfile/src/Hooks.ts | 2 +- hooks/pnpmfile/src/index.ts | 2 +- hooks/pnpmfile/src/requireHooks.ts | 15 +++--- hooks/pnpmfile/src/requirePnpmfile.ts | 12 +++-- hooks/pnpmfile/test/index.ts | 4 +- .../src/createOptionalDependenciesRemover.ts | 2 +- .../src/createPackageExtender.ts | 2 +- .../src/createReadPackageHook.ts | 3 +- .../src/createVersionsOverrider.ts | 8 +-- .../createOptionalDependenciesRemover.test.ts | 3 +- .../test/createReadPackageHook.ts | 1 + .../test/createVersionOverrider.test.ts | 1 + hooks/types/src/index.ts | 10 ++-- hooks/types/test/customResolverCache.test.ts | 6 +-- lockfile/audit/src/index.ts | 1 + lockfile/audit/src/lockfileToAuditTree.ts | 5 +- lockfile/audit/test/index.ts | 1 + lockfile/detect-dep-types/src/index.ts | 2 +- lockfile/filtering/src/filterLockfile.ts | 1 + .../src/filterLockfileByImporters.ts | 1 + .../src/filterLockfileByImportersAndEngine.ts | 5 +- lockfile/filtering/src/index.ts | 2 +- .../test/filterByImportersAndEngine.ts | 2 +- lockfile/fs/src/envLockfile.ts | 2 + lockfile/fs/src/existsWantedLockfile.ts | 1 + lockfile/fs/src/getLockfileImporterId.ts | 3 +- lockfile/fs/src/gitMergeFile.ts | 3 +- lockfile/fs/src/index.ts | 20 +++---- lockfile/fs/src/lockfileFormatConverters.ts | 16 +++--- lockfile/fs/src/read.ts | 8 +-- lockfile/fs/src/sortLockfileKeys.ts | 2 +- lockfile/fs/src/write.ts | 8 +-- lockfile/fs/test/gitBranchLockfile.test.ts | 1 + lockfile/fs/test/lockfileName.test.ts | 2 +- lockfile/fs/test/normalizeLockfile.test.ts | 1 + lockfile/fs/test/read.test.ts | 3 +- lockfile/fs/test/sortLockfileKeys.test.ts | 1 + lockfile/fs/test/write.test.ts | 3 +- lockfile/lockfile-to-pnp/src/index.ts | 3 +- lockfile/lockfile-to-pnp/test/index.ts | 1 + lockfile/merger/test/index.ts | 1 + lockfile/plugin-commands-audit/src/audit.ts | 7 +-- lockfile/plugin-commands-audit/src/fix.ts | 3 +- .../src/fixWithUpdate.ts | 17 +++--- lockfile/plugin-commands-audit/src/ignore.ts | 2 +- lockfile/plugin-commands-audit/test/fix.ts | 8 +-- .../test/fixWithUpdate.ts | 14 ++--- lockfile/plugin-commands-audit/test/ignore.ts | 6 ++- lockfile/plugin-commands-audit/test/index.ts | 10 ++-- .../test/preserveReferenceOverrides.ts | 8 +-- .../test/utils/responses/index.ts | 1 + .../test/utils/responses/update.ts | 1 + lockfile/pruner/src/index.ts | 2 +- .../settings-checker/src/calcPatchHashes.ts | 2 +- lockfile/types/src/index.ts | 2 +- lockfile/utils/src/index.ts | 2 +- lockfile/utils/src/nameVerFromPkgSnapshot.ts | 2 +- lockfile/utils/src/packageIdFromSnapshot.ts | 4 +- lockfile/utils/src/pkgSnapshotToResolution.ts | 4 +- .../src/allCatalogsAreUpToDate.ts | 2 +- .../src/allProjectsAreUpToDate.ts | 3 +- lockfile/verification/src/index.ts | 4 +- .../src/linkedPackagesAreUpToDate.ts | 5 +- .../src/localTarballDepsAreUpToDate.ts | 5 +- .../src/satisfiesPackageManifest.ts | 3 +- .../test/allProjectsAreUpToDate.test.ts | 15 +++--- lockfile/walker/src/index.ts | 2 +- modules-mounter/daemon/src/cli.ts | 3 +- .../daemon/src/createFuseHandlers.ts | 10 ++-- .../daemon/src/makeVirtualNodeModules.ts | 7 +-- .../daemon/test/createFuseHandlers.test.ts | 5 +- .../test/makeVirtualNodeModules.test.ts | 2 + .../src/getAuthHeadersFromConfig.ts | 5 +- network/auth-header/src/index.ts | 1 + .../test/getAuthHeadersFromConfig.test.ts | 6 ++- network/fetch/src/fetch.ts | 1 + network/fetch/src/fetchFromRegistry.ts | 8 +-- network/fetch/src/index.ts | 4 +- network/fetch/test/fetchFromRegistry.test.ts | 9 ++-- network/fetching-types/src/index.ts | 4 +- object/property-path/src/index.ts | 4 +- object/property-path/src/parse.ts | 4 +- object/property-path/src/token/index.ts | 7 ++- object/property-path/src/token/tokenize.ts | 6 +-- object/property-path/test/parse.test.ts | 2 +- .../test/token/StringLiteral.test.ts | 2 +- packages/calc-dep-state/src/index.ts | 6 +-- .../test/calcGraphNodeHash.test.ts | 2 +- packages/core-loggers/src/all.ts | 4 +- packages/core-loggers/src/index.ts | 4 +- packages/dependency-path/src/index.ts | 2 +- packages/dependency-path/test/index.ts | 4 +- packages/git-utils/test/index.test.ts | 5 +- packages/logger/src/index.ts | 8 +-- packages/logger/src/streamParser.ts | 1 + packages/make-dedicated-lockfile/src/bin.ts | 1 + packages/make-dedicated-lockfile/src/index.ts | 1 + .../make-dedicated-lockfile/test/index.ts | 4 +- packages/plugin-commands-doctor/src/doctor.ts | 4 +- packages/plugin-commands-doctor/test/index.ts | 4 +- packages/plugin-commands-init/src/init.ts | 6 ++- packages/plugin-commands-init/src/utils.ts | 5 +- .../plugin-commands-init/test/init.test.ts | 3 +- .../plugin-commands-init/test/utils.test.ts | 6 ++- packages/plugin-commands-setup/src/setup.ts | 1 + .../plugin-commands-setup/test/setup.test.ts | 2 +- packages/render-peer-issues/src/index.ts | 2 +- packages/render-peer-issues/test/index.ts | 3 +- patching/apply-patch/test/applyPatchToDir.ts | 5 +- patching/config/src/index.ts | 8 +-- patching/config/src/verifyPatches.ts | 1 + .../test/groupPatchedDependencies.test.ts | 1 + .../src/getEditDirPath.ts | 1 + .../src/getPatchedDependency.ts | 9 ++-- .../plugin-commands-patching/src/patch.ts | 14 ++--- .../src/patchCommit.ts | 14 ++--- .../src/patchRemove.ts | 8 +-- .../src/updatePatchedDependencies.ts | 3 +- .../src/writePackage.ts | 2 +- .../test/getEditDirPath.test.ts | 1 + .../test/patch.test.ts | 16 +++--- pkg-manager/client/src/index.ts | 14 ++--- pkg-manager/core/src/api.ts | 2 +- .../core/src/getPeerDependencyIssues.ts | 7 +-- pkg-manager/core/src/index.ts | 18 +++---- .../checkCompatibility/BreakingChangeError.ts | 1 + .../src/install/checkCompatibility/index.ts | 2 + .../checkCustomResolverForceResolve.ts | 2 +- .../core/src/install/extendInstallOptions.ts | 14 ++--- pkg-manager/core/src/install/index.ts | 42 ++++++++------- pkg-manager/core/src/install/link.ts | 12 +++-- .../src/install/reportPeerDependencyIssues.ts | 8 +-- .../core/src/install/validateModules.ts | 4 +- .../core/src/parseWantedDependencies.ts | 6 +-- pkg-manager/core/src/pnpmPkgJson.ts | 1 + pkg-manager/core/src/uninstall/removeDeps.ts | 2 +- pkg-manager/core/test/api.ts | 1 + pkg-manager/core/test/breakingChanges.ts | 4 +- .../core/test/brokenLockfileIntegrity.ts | 11 ++-- pkg-manager/core/test/cache.ts | 3 +- pkg-manager/core/test/catalogs.ts | 12 +++-- .../core/test/checkCompatibility.test.ts | 1 + .../core/test/getPeerDependencyIssues.test.ts | 1 + .../core/test/hoistedNodeLinker/install.ts | 2 + .../core/test/hoistedNodeLinker/uninstall.ts | 11 ++-- pkg-manager/core/test/install/aliases.ts | 3 +- pkg-manager/core/test/install/auth.ts | 4 +- .../core/test/install/autoInstallPeers.ts | 4 +- .../core/test/install/blockExoticSubdeps.ts | 5 +- pkg-manager/core/test/install/bunRuntime.ts | 3 +- .../core/test/install/bundledDependencies.ts | 3 +- .../checkCustomResolverForceResolve.ts | 3 +- .../core/test/install/customResolvers.ts | 3 +- pkg-manager/core/test/install/dedupe.ts | 3 +- .../core/test/install/dedupeDirectDeps.ts | 4 +- .../core/test/install/dedupeInWorkspace.ts | 4 +- .../core/test/install/deepRecursive.ts | 4 +- .../test/install/defaultPeerDependencies.ts | 6 ++- pkg-manager/core/test/install/denoRuntime.ts | 3 +- pkg-manager/core/test/install/errors.ts | 3 +- .../test/install/excludeLinksFromLockfile.ts | 8 +-- pkg-manager/core/test/install/fixLockfile.ts | 8 +-- pkg-manager/core/test/install/fromRepo.ts | 14 ++--- pkg-manager/core/test/install/fromTarball.ts | 3 +- .../core/test/install/frozenLockfile.ts | 6 ++- .../test/install/gitBranchLockfile.test.ts | 10 ++-- .../core/test/install/globalVirtualStore.ts | 6 ++- pkg-manager/core/test/install/hoist.ts | 8 +-- pkg-manager/core/test/install/hooks.ts | 9 ++-- .../install/ignoredOptionalDependencies.ts | 5 +- .../core/test/install/injectLocalPackages.ts | 2 + .../core/test/install/installationChecks.ts | 3 +- .../core/test/install/lifecycleScripts.ts | 12 +++-- pkg-manager/core/test/install/local.ts | 18 ++++--- pkg-manager/core/test/install/lockfileDir.ts | 8 +-- pkg-manager/core/test/install/lockfileOnly.ts | 6 ++- .../core/test/install/minimumReleaseAge.ts | 3 +- pkg-manager/core/test/install/misc.ts | 32 ++++++------ pkg-manager/core/test/install/modulesCache.ts | 6 ++- pkg-manager/core/test/install/modulesDir.ts | 4 +- .../core/test/install/multipleImporters.ts | 14 ++--- pkg-manager/core/test/install/nodeRuntime.ts | 6 ++- pkg-manager/core/test/install/only.ts | 4 +- .../core/test/install/optionalDependencies.ts | 12 +++-- pkg-manager/core/test/install/overrides.ts | 14 ++--- .../core/test/install/packageExtensions.ts | 7 +-- pkg-manager/core/test/install/patch.ts | 6 ++- .../core/test/install/peerDependencies.ts | 18 ++++--- pkg-manager/core/test/install/reporting.ts | 7 +-- .../core/test/install/resolutionMode.ts | 3 +- .../core/test/install/setExtraNodePath.ts | 8 +-- pkg-manager/core/test/install/sideEffects.ts | 8 +-- pkg-manager/core/test/install/stats.ts | 5 +- pkg-manager/core/test/install/update.ts | 4 +- .../core/test/install/updatingPkgJson.ts | 3 +- .../test/install/validatePeerDependencies.ts | 2 + .../test/install/virtualStoreDirMaxLength.ts | 2 + pkg-manager/core/test/link.ts | 4 +- pkg-manager/core/test/lockfile.ts | 26 +++++----- pkg-manager/core/test/offline.ts | 3 +- pkg-manager/core/test/packageImportMethods.ts | 4 +- pkg-manager/core/test/prune.ts | 10 ++-- pkg-manager/core/test/uninstall.ts | 18 ++++--- pkg-manager/core/test/utils/testDefaults.ts | 8 +-- .../direct-dep-linker/src/linkDirectDeps.ts | 5 +- pkg-manager/get-context/src/index.ts | 10 ++-- pkg-manager/get-context/test/index.ts | 6 ++- pkg-manager/headless/src/index.ts | 48 +++++++++-------- .../headless/src/linkHoistedModules.ts | 7 +-- .../headless/src/lockfileToHoistedDepGraph.ts | 23 ++++---- pkg-manager/headless/test/index.ts | 12 +++-- .../headless/test/utils/testDefaults.ts | 1 + pkg-manager/hoist/src/index.ts | 5 +- pkg-manager/link-bins/src/index.ts | 14 ++--- pkg-manager/link-bins/test/getBinNodePaths.ts | 4 +- pkg-manager/link-bins/test/index.ts | 5 +- pkg-manager/modules-cleaner/src/prune.ts | 8 +-- .../src/removeDirectDependency.ts | 3 +- pkg-manager/modules-yaml/src/index.ts | 7 +-- pkg-manager/modules-yaml/test/index.ts | 5 +- pkg-manager/package-bins/src/index.ts | 3 +- pkg-manager/package-bins/test/index.ts | 1 + .../package-bins/test/path-traversal.test.ts | 1 + pkg-manager/package-requester/src/index.ts | 1 - .../package-requester/src/packageRequester.ts | 27 +++++----- pkg-manager/package-requester/test/index.ts | 15 +++--- .../plugin-commands-installation/src/add.ts | 3 +- .../src/createProjectManifestWriter.ts | 1 + .../src/dedupe.ts | 3 +- .../plugin-commands-installation/src/fetch.ts | 3 +- .../src/import/index.ts | 22 ++++---- .../plugin-commands-installation/src/index.ts | 8 +-- .../src/install.ts | 1 + .../src/installDeps.ts | 44 ++++++++-------- .../plugin-commands-installation/src/link.ts | 16 +++--- .../src/nodeExecPath.ts | 1 + .../plugin-commands-installation/src/prune.ts | 3 +- .../src/recursive.ts | 52 ++++++++++--------- .../src/remove.ts | 9 ++-- .../src/unlink.ts | 1 + .../src/update/getUpdateChoices.ts | 3 +- .../src/update/index.ts | 11 ++-- .../plugin-commands-installation/test/add.ts | 1 + .../test/addJsr.ts | 2 + .../test/addRecursive.ts | 4 +- .../test/dedupe.ts | 4 +- .../test/disallowWorkspaceCycles.test.ts | 9 ++-- .../test/fetch.ts | 3 +- .../test/import.ts | 3 +- .../test/importRecursive.ts | 3 +- .../test/install.ts | 4 +- .../plugin-commands-installation/test/link.ts | 8 +-- .../test/miscRecursive.ts | 8 +-- .../test/patchedDependencies.ts | 6 ++- .../test/peerDependencies.ts | 1 + .../test/prune.ts | 3 +- .../test/remove/remove.ts | 1 + .../test/remove/workspace.ts | 4 +- .../test/saveCatalog.ts | 6 ++- .../test/update/getUpdateChoices.test.ts | 2 + .../test/update/interactive.ts | 9 ++-- .../test/update/issue-7415.ts | 3 +- .../test/update/jsr.ts | 2 + .../test/update/recursive.ts | 3 +- .../test/update/update.ts | 2 + .../test/updateWorkspaceDependencies.test.ts | 1 + .../test/warnCyclicDependencies.ts | 5 +- .../read-projects-context/src/index.ts | 7 +-- pkg-manager/real-hoist/src/index.ts | 6 +-- pkg-manager/real-hoist/test/index.ts | 2 +- pkg-manager/remove-bins/src/removeBins.ts | 1 + .../src/dedupeInjectedDeps.ts | 8 +-- .../src/getCatalogSnapshots.ts | 1 + .../src/getExactSinglePreferredVersions.ts | 1 + .../src/getNonDevWantedDependencies.ts | 2 +- .../resolve-dependencies/src/hoistPeers.ts | 1 + pkg-manager/resolve-dependencies/src/index.ts | 30 ++++++----- .../src/resolveDependencies.ts | 42 ++++++++------- .../src/resolveDependencyTree.ts | 23 ++++---- .../resolve-dependencies/src/resolvePeers.ts | 20 +++---- .../src/safeIsInnerLink.ts | 1 + .../src/toResolveImporter.ts | 3 +- .../src/updateLockfile.ts | 7 +-- .../src/updateProjectManifest.ts | 3 +- .../src/validatePeerDependencies.ts | 2 +- .../src/wantedDepIsLocallyAvailable.ts | 3 +- .../test/dedupeDepPaths.test.ts | 7 +-- .../test/getManifestFromResponse.test.ts | 3 +- .../test/hoistPeers.test.ts | 2 +- .../test/parentIdsContainSequence.test.ts | 1 + .../resolve-dependencies/test/resolvePeers.ts | 7 +-- pkg-manifest/exportable-manifest/src/index.ts | 8 +-- .../exportable-manifest/src/transform/bin.ts | 1 + .../src/transform/engines.ts | 1 + .../src/transform/index.ts | 3 +- .../src/transform/peerDependenciesMeta.ts | 1 + .../src/transform/requiredFields.ts | 1 + .../test/beforePackingHook.test.ts | 1 + .../exportable-manifest/test/index.test.ts | 7 +-- .../test/overridePublishConfig.test.ts | 1 + .../test/transformEngines.test.ts | 2 +- .../transformPeerDependenciesMeta.test.ts | 1 + .../manifest-utils/src/getAllUniqueSpecs.ts | 1 + .../src/getDependencyTypeFromManifest.ts | 2 +- .../src/getSpecFromPackageManifest.ts | 2 +- pkg-manifest/manifest-utils/src/index.ts | 5 +- .../src/updateProjectManifestObject.ts | 6 +-- pkg-manifest/read-package-json/src/index.ts | 1 + pkg-manifest/read-package-json/test/index.ts | 1 + .../read-project-manifest/src/index.ts | 8 +-- .../read-project-manifest/test/index.ts | 3 +- .../write-project-manifest/src/index.ts | 3 +- .../write-project-manifest/test/index.ts | 3 +- pnpm-lock.yaml | 15 ++++++ pnpm-workspace.yaml | 1 + pnpm/src/checkForUpdates.test.ts | 2 +- pnpm/src/checkForUpdates.ts | 3 +- pnpm/src/cmd/clean.ts | 3 +- pnpm/src/cmd/help.ts | 3 +- pnpm/src/cmd/index.ts | 25 ++++----- pnpm/src/cmd/installTest.ts | 1 + pnpm/src/cmd/recursive.ts | 2 +- pnpm/src/cmd/root.ts | 3 +- pnpm/src/errorHandler.ts | 2 + pnpm/src/main.ts | 12 +++-- pnpm/src/parseCliArgs.ts | 3 +- pnpm/src/reporter/index.ts | 3 +- pnpm/src/runNpm.ts | 3 +- pnpm/src/switchCliVersion.ts | 7 +-- pnpm/test/bin.ts | 4 +- pnpm/test/clean.ts | 2 + pnpm/test/cli.ts | 4 +- pnpm/test/config.ts | 2 + pnpm/test/config/get.ts | 6 ++- pnpm/test/config/list.ts | 4 +- pnpm/test/configurationalDependencies.test.ts | 4 +- pnpm/test/deploy.ts | 2 + pnpm/test/dlx.ts | 8 +-- pnpm/test/errorHandler.test.ts | 9 ++-- pnpm/test/exec.ts | 2 + pnpm/test/filterProd.test.ts | 5 +- pnpm/test/formatError.test.ts | 1 + pnpm/test/hooks.ts | 4 +- pnpm/test/install/global.ts | 8 +-- pnpm/test/install/globalVirtualStore.ts | 2 + pnpm/test/install/hoist.ts | 1 + pnpm/test/install/hooks.ts | 4 +- pnpm/test/install/issue-8959.ts | 2 + pnpm/test/install/lifecycleScripts.ts | 10 ++-- pnpm/test/install/misc.ts | 12 +++-- pnpm/test/install/nodeRuntime.ts | 2 + pnpm/test/install/only.ts | 2 + pnpm/test/install/optional.ts | 1 + pnpm/test/install/preferOffline.ts | 1 + pnpm/test/install/selfUpdate.ts | 4 +- pnpm/test/install/sideEffects.ts | 2 + pnpm/test/install/supportedArchitectures.ts | 4 +- pnpm/test/install/yesFlag.ts | 4 +- pnpm/test/list.ts | 2 + pnpm/test/monorepo/dedupePeers.test.ts | 6 ++- pnpm/test/monorepo/index.ts | 20 +++---- pnpm/test/monorepo/peerDependencies.ts | 1 + pnpm/test/packageManagerCheck.test.ts | 1 + pnpm/test/patch/allowUnusedPatches.ts | 1 + pnpm/test/recursive/filter.ts | 2 + pnpm/test/recursive/misc.ts | 6 ++- pnpm/test/recursive/rebuild.ts | 1 + pnpm/test/recursive/run.ts | 1 + pnpm/test/recursive/update.ts | 6 ++- pnpm/test/root.ts | 4 +- pnpm/test/run.ts | 2 + pnpm/test/saveCatalog.ts | 1 + pnpm/test/sbom.ts | 1 + pnpm/test/switchingVersions.test.ts | 6 ++- pnpm/test/syncInjectedDepsAfterScripts-bin.ts | 2 + pnpm/test/syncInjectedDepsAfterScripts.ts | 2 + pnpm/test/uninstall.ts | 4 +- pnpm/test/update.ts | 2 + pnpm/test/utils/execPnpm.ts | 5 +- pnpm/test/utils/index.ts | 6 +-- pnpm/test/utils/testDefaults.ts | 1 + pnpm/test/verifyDepsBeforeRun/exec.ts | 2 + pnpm/test/verifyDepsBeforeRun/install.ts | 2 + pnpm/test/verifyDepsBeforeRun/issue-9424.ts | 4 +- .../multiProjectWorkspace.ts | 2 + .../singleProjectWorkspace.ts | 4 +- .../src/createDeployFiles.ts | 3 +- .../plugin-commands-deploy/src/deploy.ts | 16 +++--- .../test/deploy.test.ts | 6 ++- .../test/shared-lockfile.test.ts | 10 ++-- .../src/FailedToPublishError.ts | 1 + .../src/extractManifestFromPacked.ts | 5 +- .../src/oidc/authToken.ts | 1 + .../src/oidc/idToken.ts | 1 + .../src/oidc/provenance.ts | 1 + .../src/oidc/utils/shared-context.ts | 3 +- .../plugin-commands-publishing/src/pack.ts | 24 +++++---- .../plugin-commands-publishing/src/publish.ts | 8 +-- .../src/publishPackedPkg.ts | 10 ++-- .../src/recursivePublish.ts | 4 +- .../test/FailedToPublishError.test.ts | 2 +- .../test/executeTokenHelper.test.ts | 1 + .../test/extractManifestFromPacked.test.ts | 10 ++-- .../test/gitChecks.ts | 7 +-- .../test/oidcAuthToken.test.ts | 5 +- .../test/oidcIdToken.test.ts | 5 +- .../test/oidcProvenance.test.ts | 11 ++-- .../plugin-commands-publishing/test/pack.ts | 8 +-- .../test/publish.ts | 12 +++-- .../test/recursivePublish.ts | 10 ++-- .../test/registryConfigKeys.test.ts | 4 +- resolving/bun-resolver/src/index.ts | 2 +- resolving/default-resolver/src/index.ts | 14 ++--- .../default-resolver/test/customResolver.ts | 2 +- resolving/deno-resolver/src/index.ts | 2 +- resolving/git-resolver/src/index.ts | 9 ++-- .../git-resolver/src/parseBareSpecifier.ts | 2 +- resolving/git-resolver/test/index.ts | 3 +- .../jsr-specifier-parser/test/parse.test.ts | 2 +- resolving/local-resolver/src/index.ts | 4 +- .../local-resolver/src/parseBareSpecifier.ts | 3 +- resolving/local-resolver/test/index.ts | 5 +- resolving/npm-resolver/src/fetch.ts | 3 +- resolving/npm-resolver/src/index.ts | 36 +++++++------ resolving/npm-resolver/src/pickPackage.ts | 22 ++++---- .../npm-resolver/src/pickPackageFromMeta.ts | 4 +- resolving/npm-resolver/src/trustChecks.ts | 1 + resolving/npm-resolver/test/index.ts | 6 ++- .../npm-resolver/test/publishedBy.test.ts | 3 +- .../npm-resolver/test/resolveJsr.test.ts | 2 + .../npm-resolver/test/trustChecks.test.ts | 5 +- resolving/resolver-base/src/index.ts | 6 +-- resolving/tarball-resolver/src/index.ts | 2 +- resolving/tarball-resolver/test/index.ts | 2 +- .../src/buildDependenciesTree.ts | 12 +++-- .../src/buildDependencyGraph.ts | 1 + .../src/buildDependentsTree.ts | 10 ++-- .../src/createPackagesSearcher.ts | 2 +- .../dependencies-hierarchy/src/getPkgInfo.ts | 8 +-- .../dependencies-hierarchy/src/getTree.ts | 4 +- .../src/getTreeNodeChildId.ts | 4 +- reviewing/dependencies-hierarchy/src/index.ts | 4 +- .../src/peersSuffixHash.ts | 1 + .../src/readManifestFromCafs.ts | 4 +- .../src/resolvePackagePath.ts | 1 + .../test/buildDependentsTree.test.ts | 2 + .../test/createPackagesSearcher.spec.ts | 1 + .../test/getPkgInfo.test.ts | 3 +- .../test/getTree.test.ts | 1 + .../dependencies-hierarchy/test/index.ts | 5 +- reviewing/license-scanner/src/getPkgInfo.ts | 16 +++--- reviewing/license-scanner/src/index.ts | 2 +- reviewing/license-scanner/src/licenses.ts | 7 +-- .../src/lockfileToLicenseNodeTree.ts | 7 +-- .../license-scanner/test/getPkgInfo.spec.ts | 2 + .../license-scanner/test/licenses.spec.ts | 10 ++-- reviewing/list/src/getPkgInfo.ts | 4 +- reviewing/list/src/index.ts | 16 +++--- reviewing/list/src/renderDependentsTree.ts | 5 +- reviewing/list/src/renderJson.ts | 5 +- reviewing/list/src/renderParseable.ts | 3 +- reviewing/list/src/renderTree.ts | 2 + reviewing/list/test/index.ts | 4 +- .../list/test/renderDependentsTree.test.ts | 4 +- .../outdated/src/createManifestGetter.ts | 2 +- reviewing/outdated/src/index.ts | 2 +- reviewing/outdated/src/outdated.ts | 12 ++--- .../outdated/src/outdatedDepsOfProjects.ts | 2 + reviewing/outdated/test/getManifest.spec.ts | 1 + reviewing/outdated/test/outdated.spec.ts | 1 + .../plugin-commands-licenses/src/licenses.ts | 3 +- .../src/licensesList.ts | 8 +-- .../src/outputRenderer.ts | 5 +- .../plugin-commands-licenses/test/index.ts | 10 ++-- reviewing/plugin-commands-listing/src/list.ts | 3 +- reviewing/plugin-commands-listing/src/ll.ts | 1 + .../plugin-commands-listing/src/recursive.ts | 2 + reviewing/plugin-commands-listing/src/why.ts | 5 +- .../plugin-commands-listing/test/index.ts | 4 +- .../plugin-commands-listing/test/json.ts | 1 + .../plugin-commands-listing/test/recursive.ts | 6 ++- reviewing/plugin-commands-listing/test/why.ts | 5 +- .../plugin-commands-outdated/src/outdated.ts | 6 ++- .../plugin-commands-outdated/src/recursive.ts | 1 + .../plugin-commands-outdated/test/index.ts | 3 +- .../test/recursive.ts | 6 ++- .../test/renderLatest.test.ts | 2 + reviewing/plugin-commands-sbom/src/sbom.ts | 10 ++-- reviewing/plugin-commands-sbom/test/index.ts | 4 +- reviewing/sbom/src/collectComponents.ts | 9 ++-- reviewing/sbom/src/getPkgMetadata.ts | 6 +-- reviewing/sbom/src/index.ts | 8 +-- reviewing/sbom/src/serializeCycloneDx.ts | 1 + reviewing/sbom/src/serializeSpdx.ts | 1 + reviewing/sbom/test/license.test.ts | 1 + .../sbom/test/serializeCycloneDx.test.ts | 2 +- reviewing/sbom/test/serializeSpdx.test.ts | 2 +- store/cafs/src/addFilesFromDir.ts | 4 +- store/cafs/src/addFilesFromTarball.ts | 4 +- store/cafs/src/checkPkgFilesIntegrity.ts | 4 +- store/cafs/src/index.ts | 18 ++++--- store/cafs/src/writeBufferToCafs.ts | 4 +- store/cafs/src/writeFile.ts | 1 + store/cafs/test/index.ts | 6 ++- .../test/optimisticRenameOverwrite.test.ts | 2 + store/cafs/test/recursiveSymlink.test.ts | 2 + store/cafs/test/writeBufferToCafs.test.ts | 2 + store/create-cafs-store/src/index.ts | 5 +- store/index/src/index.ts | 5 +- store/index/test/index.ts | 3 +- store/package-store/src/index.ts | 5 +- .../src/storeController/index.ts | 10 ++-- .../src/storeController/projectRegistry.ts | 5 +- .../src/storeController/prune.ts | 8 +-- .../pruneGlobalVirtualStore.ts | 8 +-- store/package-store/test/index.ts | 3 +- store/package-store/test/projectRegistry.ts | 3 +- store/pkg-finder/src/index.ts | 3 +- .../src/catFile.ts | 1 - .../src/catIndex.ts | 11 ++-- .../src/findHash.ts | 6 +-- .../src/index.ts | 4 +- .../test/catFile.ts | 5 +- .../test/catIndex.ts | 5 +- .../test/findHash.ts | 5 +- .../src/cleanExpiredDlxCache.test.ts | 3 +- .../src/cleanExpiredDlxCache.ts | 2 +- store/plugin-commands-store/src/store.ts | 3 +- store/plugin-commands-store/src/storeAdd.ts | 3 +- store/plugin-commands-store/src/storePrune.ts | 3 +- .../storeStatus/extendStoreStatusOptions.ts | 4 +- .../src/storeStatus/index.ts | 10 ++-- store/plugin-commands-store/test/storeAdd.ts | 1 + store/plugin-commands-store/test/storePath.ts | 1 + .../plugin-commands-store/test/storePrune.ts | 3 +- .../plugin-commands-store/test/storeStatus.ts | 1 + .../src/createNewStoreController.ts | 7 +-- store/store-connection-manager/src/index.ts | 1 + store/store-controller-types/src/index.ts | 22 ++++---- store/store-path/src/index.ts | 5 +- store/store-path/test/index.ts | 3 +- testing/temp-store/src/index.ts | 3 +- text/comments-parser/src/extractComments.ts | 1 + text/comments-parser/src/index.ts | 2 +- .../src/installPnpm.ts | 1 + .../src/selfUpdate.ts | 8 +-- .../test/selfUpdate.test.ts | 5 +- worker/src/index.ts | 22 ++++---- worker/src/start.ts | 22 ++++---- .../filter-packages-from-dir/src/index.ts | 2 +- .../src/getChangedPackages.ts | 5 +- .../filter-workspace-packages/src/index.ts | 9 ++-- .../filter-workspace-packages/test/index.ts | 12 +++-- .../test/parsePackageSelector.ts | 1 + workspace/find-packages/src/index.ts | 4 +- workspace/find-packages/test/index.ts | 7 +-- workspace/find-workspace-dir/src/index.ts | 1 + workspace/find-workspace-dir/test/index.ts | 3 +- .../injected-deps-syncer/src/DirPatcher.ts | 3 +- workspace/injected-deps-syncer/src/index.ts | 2 + .../test/DirPatcher.test.ts | 4 +- .../test/applyPatch.test.ts | 6 ++- .../injected-deps-syncer/test/diffDir.test.ts | 2 +- .../test/extendFilesMap.test.ts | 6 ++- workspace/manifest-writer/src/index.ts | 13 ++--- .../manifest-writer/test/addCatalogs.test.ts | 1 + .../test/removeCatalogs.test.ts | 7 +-- .../test/updateWorkspaceManifest.test.ts | 1 + workspace/pkgs-graph/src/index.ts | 5 +- workspace/read-manifest/src/index.ts | 4 +- workspace/read-manifest/test/index.ts | 3 +- workspace/sort-packages/src/index.ts | 4 +- workspace/state/src/createWorkspaceState.ts | 5 +- workspace/state/src/index.ts | 4 +- workspace/state/src/loadWorkspaceState.ts | 2 + workspace/state/src/updateWorkspaceState.ts | 6 ++- .../state/test/createWorkspaceState.test.ts | 2 + workspace/state/test/filePath.test.ts | 2 + .../state/test/loadWorkspaceState.test.ts | 12 +++-- .../state/test/updatePackagesList.test.ts | 4 +- 807 files changed, 2572 insertions(+), 1640 deletions(-) diff --git a/.meta-updater/src/index.ts b/.meta-updater/src/index.ts index 6c6163ffd9..929013264d 100644 --- a/.meta-updater/src/index.ts +++ b/.meta-updater/src/index.ts @@ -1,15 +1,16 @@ import fs from 'fs' import path from 'path' -import { readWantedLockfile, type LockfileObject } from '@pnpm/lockfile.fs' -import type { ProjectId, ProjectManifest } from '@pnpm/types' + +import { type LockfileObject, readWantedLockfile } from '@pnpm/lockfile.fs' import { createUpdateOptions, type FormatPluginFnOptions } from '@pnpm/meta-updater' import { sortDirectKeys, sortKeysByPriority } from '@pnpm/object.key-sorting' +import type { ProjectId, ProjectManifest } from '@pnpm/types' import { findWorkspacePackagesNoCheck } from '@pnpm/workspace.find-packages' import { readWorkspaceManifest } from '@pnpm/workspace.read-manifest' import { isSubdir } from 'is-subdir' import { loadJsonFileSync } from 'load-json-file' -import semver from 'semver' import normalizePath from 'normalize-path' +import semver from 'semver' import { writeJsonFile } from 'write-json-file' const CLI_PKG_NAME = 'pnpm' diff --git a/__utils__/assert-project/src/index.ts b/__utils__/assert-project/src/index.ts index a49f0dcaba..6a6989fbec 100644 --- a/__utils__/assert-project/src/index.ts +++ b/__utils__/assert-project/src/index.ts @@ -1,7 +1,8 @@ import fs from 'fs' +import { createRequire } from 'module' import path from 'path' import util from 'util' -import { createRequire } from 'module' + import { assertStore } from '@pnpm/assert-store' import { WANTED_LOCKFILE } from '@pnpm/constants' import type { LockfileFile } from '@pnpm/lockfile.types' @@ -9,6 +10,7 @@ import type { Modules } from '@pnpm/modules-yaml' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { readYamlFileSync } from 'read-yaml-file' import { writePackageSync } from 'write-package' + import isExecutable from './isExecutable.js' const require = createRequire(import.meta.url) diff --git a/__utils__/assert-project/src/isExecutable.ts b/__utils__/assert-project/src/isExecutable.ts index 9fd5983d21..3ac38cc280 100644 --- a/__utils__/assert-project/src/isExecutable.ts +++ b/__utils__/assert-project/src/isExecutable.ts @@ -1,4 +1,5 @@ import fs from 'fs' + import isWindows from 'is-windows' import isExe from 'isexe' diff --git a/__utils__/assert-project/test/index.ts b/__utils__/assert-project/test/index.ts index 5ac2d0c0c3..16b7bf1086 100644 --- a/__utils__/assert-project/test/index.ts +++ b/__utils__/assert-project/test/index.ts @@ -1,5 +1,6 @@ /// import path from 'path' + import { assertProject } from '../src/index.js' test('assertProject()', async () => { diff --git a/__utils__/assert-store/src/index.ts b/__utils__/assert-store/src/index.ts index ed60deeed5..f91a6e86f2 100644 --- a/__utils__/assert-store/src/index.ts +++ b/__utils__/assert-store/src/index.ts @@ -1,7 +1,8 @@ import fs from 'fs' import path from 'path' -import { StoreIndex, storeIndexKey } from '@pnpm/store.index' + import { getIntegrity, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' +import { StoreIndex, storeIndexKey } from '@pnpm/store.index' export interface StoreAssertions { getPkgIndexFilePath: (pkgName: string, version: string) => string diff --git a/__utils__/assert-store/test/index.ts b/__utils__/assert-store/test/index.ts index e754a7cae7..d4834cd977 100644 --- a/__utils__/assert-store/test/index.ts +++ b/__utils__/assert-store/test/index.ts @@ -1,5 +1,6 @@ /// import path from 'path' + import { assertStore } from '@pnpm/assert-store' import { STORE_VERSION } from '@pnpm/constants' diff --git a/__utils__/eslint-config/index.js b/__utils__/eslint-config/index.js index 319cfa9366..9f34bb3bef 100644 --- a/__utils__/eslint-config/index.js +++ b/__utils__/eslint-config/index.js @@ -2,6 +2,7 @@ import js from '@eslint/js' import tseslint from 'typescript-eslint' import stylistic from '@stylistic/eslint-plugin' import * as importX from 'eslint-plugin-import-x' +import simpleImportSort from 'eslint-plugin-simple-import-sort' import n from 'eslint-plugin-n' import promise from 'eslint-plugin-promise' import noDupeConditions from './no-dupe-conditions.js' @@ -29,6 +30,7 @@ export default tseslint.config( plugins: { '@stylistic': stylistic, 'import-x': importX, + 'simple-import-sort': simpleImportSort, n, promise, conditions: { @@ -41,6 +43,19 @@ export default tseslint.config( }, rules: { + // Import sorting + 'simple-import-sort/imports': ['error', { + groups: [ + // Node.js builtins + ['^node:', '^(assert|buffer|child_process|crypto|dns|events|fs|http|https|net|os|path|readline|stream|string_decoder|timers|tls|url|util|vm|zlib|async_hooks|cluster|console|constants|dgram|diagnostics_channel|domain|http2|inspector|module|perf_hooks|process|punycode|querystring|repl|sys|trace_events|tty|v8|wasi|worker_threads)(/|$|\\u0000)'], + // External packages + ['^@?\\w'], + // Relative imports + ['^\\.'], + ], + }], + 'simple-import-sort/exports': 'error', + // Import rules (migrated from eslint-plugin-import) 'import-x/extensions': ['error', 'always', { ignorePackages: true }], 'import-x/no-extraneous-dependencies': ['error', { @@ -63,6 +78,7 @@ export default tseslint.config( }], '@stylistic/type-annotation-spacing': 'error', '@stylistic/brace-style': ['error', '1tbs'], + '@stylistic/comma-spacing': ['error', { before: false, after: true }], '@stylistic/space-before-function-paren': ['error', 'always'], // TypeScript rules diff --git a/__utils__/eslint-config/package.json b/__utils__/eslint-config/package.json index 6609ff5b6f..805c41bf11 100644 --- a/__utils__/eslint-config/package.json +++ b/__utils__/eslint-config/package.json @@ -33,6 +33,7 @@ "eslint-plugin-import-x": "catalog:", "eslint-plugin-n": "catalog:", "eslint-plugin-promise": "catalog:", + "eslint-plugin-simple-import-sort": "catalog:", "typescript": "catalog:", "typescript-eslint": "catalog:" }, diff --git a/__utils__/get-release-text/src/main.ts b/__utils__/get-release-text/src/main.ts index 3fdb6ad87f..dbeb5c6dbc 100644 --- a/__utils__/get-release-text/src/main.ts +++ b/__utils__/get-release-text/src/main.ts @@ -2,10 +2,11 @@ import fs from 'fs' import path from 'path' import { fileURLToPath } from 'url' -import unified from 'unified' + +import mdastToString from 'mdast-util-to-string' import remarkParse from 'remark-parse' import remarkStringify from 'remark-stringify' -import mdastToString from 'mdast-util-to-string' +import unified from 'unified' export const BumpLevels = { dep: 0, diff --git a/__utils__/prepare/src/index.ts b/__utils__/prepare/src/index.ts index 4cffc8af7a..0ec000ab0f 100644 --- a/__utils__/prepare/src/index.ts +++ b/__utils__/prepare/src/index.ts @@ -1,11 +1,12 @@ import fs from 'fs' import path from 'path' + import { assertProject, type Modules, type Project } from '@pnpm/assert-project' -import type { ProjectManifest } from '@pnpm/types' import { tempDir } from '@pnpm/prepare-temp-dir' +import type { ProjectManifest } from '@pnpm/types' import { writeJson5FileSync } from 'write-json5-file' -import { writeYamlFileSync } from 'write-yaml-file' import { writePackageSync } from 'write-package' +import { writeYamlFileSync } from 'write-yaml-file' export type { Modules, Project } export type ManifestFormat = 'JSON' | 'JSON5' | 'YAML' diff --git a/__utils__/scripts/src/copy-artifacts.ts b/__utils__/scripts/src/copy-artifacts.ts index 4b2070b463..19033522c0 100644 --- a/__utils__/scripts/src/copy-artifacts.ts +++ b/__utils__/scripts/src/copy-artifacts.ts @@ -1,8 +1,9 @@ import fs from 'fs' -import * as execa from 'execa' import path from 'path' -import { makeEmptyDir } from 'make-empty-dir' import stream from 'stream' + +import * as execa from 'execa' +import { makeEmptyDir } from 'make-empty-dir' import * as tar from 'tar' import { glob } from 'tinyglobby' diff --git a/__utils__/scripts/src/typecheck-only.ts b/__utils__/scripts/src/typecheck-only.ts index ea308a0f68..d1f61ff7c1 100644 --- a/__utils__/scripts/src/typecheck-only.ts +++ b/__utils__/scripts/src/typecheck-only.ts @@ -1,11 +1,12 @@ -import { readWorkspaceManifest } from '@pnpm/workspace.read-manifest' -import { findWorkspacePackages } from '@pnpm/workspace.find-packages' import assert from 'assert/strict' -import { sync as execa } from 'execa' import fs from 'fs' +import path from 'path' + +import { findWorkspacePackages } from '@pnpm/workspace.find-packages' +import { readWorkspaceManifest } from '@pnpm/workspace.read-manifest' +import { sync as execa } from 'execa' import glob from 'fast-glob' import normalizePath from 'normalize-path' -import path from 'path' const repoRoot = path.resolve(import.meta.dirname, '../../../') const typeCheckDir = path.resolve(repoRoot, '__typecheck__') diff --git a/__utils__/test-fixtures/src/index.ts b/__utils__/test-fixtures/src/index.ts index 17d7d71e26..f9c29bd73d 100644 --- a/__utils__/test-fixtures/src/index.ts +++ b/__utils__/test-fixtures/src/index.ts @@ -1,5 +1,6 @@ import fs from 'fs' import path from 'path' + import { tempDir } from '@pnpm/prepare-temp-dir' export interface FixturesHandle { diff --git a/__utils__/test-ipc-server/src/TestIpcServer.ts b/__utils__/test-ipc-server/src/TestIpcServer.ts index 02ac3083ff..8344e14942 100644 --- a/__utils__/test-ipc-server/src/TestIpcServer.ts +++ b/__utils__/test-ipc-server/src/TestIpcServer.ts @@ -1,5 +1,6 @@ import net from 'node:net' import { promisify, stripVTControlCharacters } from 'node:util' + import { computeHandlePath } from './computeHandlePath.js' // Polyfilling Symbol.asyncDispose for Jest. diff --git a/__utils__/test-ipc-server/src/clientBin.ts b/__utils__/test-ipc-server/src/clientBin.ts index c393f511f9..3ae975023f 100644 --- a/__utils__/test-ipc-server/src/clientBin.ts +++ b/__utils__/test-ipc-server/src/clientBin.ts @@ -1,4 +1,5 @@ import net from 'node:net' + import { computeHandlePath } from './computeHandlePath.js' const [handle] = process.argv.slice(2) diff --git a/__utils__/test-ipc-server/test/TestIpcServer.test.ts b/__utils__/test-ipc-server/test/TestIpcServer.test.ts index 5c61a93967..8feea83a61 100644 --- a/__utils__/test-ipc-server/test/TestIpcServer.test.ts +++ b/__utils__/test-ipc-server/test/TestIpcServer.test.ts @@ -2,11 +2,12 @@ import fs from 'fs' import net from 'net' import path from 'path' -import { safeExeca as execa } from 'execa' import { setTimeout } from 'timers/promises' import { promisify } from 'util' + import { prepare } from '@pnpm/prepare' import { createTestIpcServer } from '@pnpm/test-ipc-server' +import { safeExeca as execa } from 'execa' const pnpmBin = path.join(import.meta.dirname, '../../../pnpm/bin/pnpm.mjs') diff --git a/building/after-install/src/extendBuildOptions.ts b/building/after-install/src/extendBuildOptions.ts index 4a5b909148..99ee4824dd 100644 --- a/building/after-install/src/extendBuildOptions.ts +++ b/building/after-install/src/extendBuildOptions.ts @@ -1,7 +1,8 @@ import path from 'path' + import { type Config, getOptionsFromRootManifest } from '@pnpm/config' import type { LogBase } from '@pnpm/logger' -import { normalizeRegistries, DEFAULT_REGISTRIES } from '@pnpm/normalize-registries' +import { DEFAULT_REGISTRIES, normalizeRegistries } from '@pnpm/normalize-registries' import type { StoreController } from '@pnpm/store-controller-types' import type { Registries } from '@pnpm/types' import { loadJsonFile } from 'load-json-file' diff --git a/building/after-install/src/index.ts b/building/after-install/src/index.ts index 272afa2a94..6748aeba8c 100644 --- a/building/after-install/src/index.ts +++ b/building/after-install/src/index.ts @@ -1,9 +1,10 @@ import assert from 'assert' import path from 'path' import util from 'util' + import { pkgRequiresBuild } from '@pnpm/building.pkg-requires-build' import { createAllowBuildFunction } from '@pnpm/building.policy' -import { calcDepState, lockfileToDepGraph, type DepsStateCache } from '@pnpm/calc-dep-state' +import { calcDepState, type DepsStateCache, lockfileToDepGraph } from '@pnpm/calc-dep-state' import { LAYOUT_VERSION, WANTED_LOCKFILE, @@ -36,17 +37,18 @@ import { createStoreController } from '@pnpm/store-connection-manager' import type { DepPath, IgnoredBuilds, - ProjectManifest, ProjectId, + ProjectManifest, ProjectRootDir, } from '@pnpm/types' import { hardLinkDir } from '@pnpm/worker' import pLimit from 'p-limit' import { runGroups } from 'run-groups' import semver from 'semver' + import { - extendBuildOptions, type BuildOptions, + extendBuildOptions, type StrictBuildOptions, } from './extendBuildOptions.js' diff --git a/building/build-commands/src/rebuild.ts b/building/build-commands/src/rebuild.ts index 6294cff00e..89ca45436c 100644 --- a/building/build-commands/src/rebuild.ts +++ b/building/build-commands/src/rebuild.ts @@ -13,6 +13,7 @@ import { import type { ProjectRootDir } from '@pnpm/types' import { pick } from 'ramda' import { renderHelp } from 'render-help' + import { recursiveRebuild } from './recursive.js' export function rcOptionsTypes (): Record { diff --git a/building/build-commands/src/recursive.ts b/building/build-commands/src/recursive.ts index 73b985e332..af2b272b55 100755 --- a/building/build-commands/src/recursive.ts +++ b/building/build-commands/src/recursive.ts @@ -1,6 +1,7 @@ import assert from 'assert' import util from 'util' -import { buildProjects as rebuildAll, type BuildOptions, buildSelectedPkgs } from '@pnpm/building.after-install' + +import { type BuildOptions, buildProjects as rebuildAll, buildSelectedPkgs } from '@pnpm/building.after-install' import { type RecursiveSummary, throwOnCommandFail, diff --git a/building/build-commands/test/index.ts b/building/build-commands/test/index.ts index d5bcb67228..c54b0a97c0 100644 --- a/building/build-commands/test/index.ts +++ b/building/build-commands/test/index.ts @@ -1,16 +1,18 @@ /// import fs from 'fs' import path from 'path' -import type { PackageFilesIndex } from '@pnpm/store.cafs' -import { StoreIndex, storeIndexKey } from '@pnpm/store.index' + +import { jest } from '@jest/globals' +import { rebuild } from '@pnpm/building.build-commands' import { ENGINE_NAME, STORE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' import { hashObject } from '@pnpm/crypto.object-hasher' -import { rebuild } from '@pnpm/building.build-commands' import { prepare } from '@pnpm/prepare' import { getIntegrity, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' +import type { PackageFilesIndex } from '@pnpm/store.cafs' +import { StoreIndex, storeIndexKey } from '@pnpm/store.index' import { fixtures } from '@pnpm/test-fixtures' import { safeExeca as execa } from 'execa' -import { jest } from '@jest/globals' + import { DEFAULT_OPTS } from './utils/index.js' const REGISTRY = `http://localhost:${REGISTRY_MOCK_PORT}/` diff --git a/building/build-commands/test/recursive.ts b/building/build-commands/test/recursive.ts index 3377fc046b..14046f95c5 100644 --- a/building/build-commands/test/recursive.ts +++ b/building/build-commands/test/recursive.ts @@ -1,12 +1,14 @@ import path from 'path' + import { assertProject } from '@pnpm/assert-project' -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { rebuild } from '@pnpm/building.build-commands' import { preparePackages } from '@pnpm/prepare' import { createTestIpcServer } from '@pnpm/test-ipc-server' import type { PackageManifest } from '@pnpm/types' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { safeExeca as execa } from 'execa' import { writeYamlFileSync } from 'write-yaml-file' + import { DEFAULT_OPTS, REGISTRY } from './utils/index.js' const pnpmBin = path.join(import.meta.dirname, '../../../pnpm/bin/pnpm.mjs') diff --git a/building/during-install/src/buildSequence.ts b/building/during-install/src/buildSequence.ts index 773fb23a89..8f9b75b82f 100644 --- a/building/during-install/src/buildSequence.ts +++ b/building/during-install/src/buildSequence.ts @@ -1,7 +1,7 @@ import { graphSequencer } from '@pnpm/deps.graph-sequencer' import type { PatchInfo } from '@pnpm/patching.types' import type { PkgRequestFetchResult } from '@pnpm/store-controller-types' -import type { PkgIdWithPatchHash, DepPath } from '@pnpm/types' +import type { DepPath, PkgIdWithPatchHash } from '@pnpm/types' import { filter } from 'ramda' export interface DependenciesGraphNode { diff --git a/building/during-install/src/index.ts b/building/during-install/src/index.ts index bc00fc9df9..610f1477d3 100644 --- a/building/during-install/src/index.ts +++ b/building/during-install/src/index.ts @@ -2,6 +2,7 @@ import assert from 'assert' import fs from 'fs/promises' import path from 'path' import util from 'util' + import { calcDepState, type DepsStateCache } from '@pnpm/calc-dep-state' import { getWorkspaceConcurrency } from '@pnpm/config' import { skippedOptionalDependencyLogger } from '@pnpm/core-loggers' @@ -9,19 +10,20 @@ import { PnpmError } from '@pnpm/error' import { runPostinstallHooks } from '@pnpm/lifecycle' import { linkBins, linkBinsOfPackages } from '@pnpm/link-bins' import { logger } from '@pnpm/logger' -import { hardLinkDir } from '@pnpm/worker' +import { applyPatchToDir } from '@pnpm/patching.apply-patch' import { safeReadPackageJsonFromDir } from '@pnpm/read-package-json' import type { StoreController } from '@pnpm/store-controller-types' -import { applyPatchToDir } from '@pnpm/patching.apply-patch' import type { AllowBuild, DependencyManifest, DepPath, IgnoredBuilds, } from '@pnpm/types' +import { hardLinkDir } from '@pnpm/worker' import pDefer, { type DeferredPromise } from 'p-defer' import { pickBy } from 'ramda' import { runGroups } from 'run-groups' + import { buildSequence, type DependenciesGraph, type DependenciesGraphNode } from './buildSequence.js' export type { DepsStateCache } diff --git a/building/policy-commands/src/approveBuilds.ts b/building/policy-commands/src/approveBuilds.ts index 79ccf7261f..0da5844d60 100644 --- a/building/policy-commands/src/approveBuilds.ts +++ b/building/policy-commands/src/approveBuilds.ts @@ -8,6 +8,7 @@ import { lexCompare } from '@pnpm/util.lex-comparator' import chalk from 'chalk' import enquirer from 'enquirer' import { renderHelp } from 'render-help' + import { getAutomaticallyIgnoredBuilds } from './getAutomaticallyIgnoredBuilds.js' export type ApproveBuildsCommandOpts = Pick & { all?: boolean, global?: boolean } diff --git a/building/policy-commands/src/getAutomaticallyIgnoredBuilds.ts b/building/policy-commands/src/getAutomaticallyIgnoredBuilds.ts index da90396c13..3c43455cf0 100644 --- a/building/policy-commands/src/getAutomaticallyIgnoredBuilds.ts +++ b/building/policy-commands/src/getAutomaticallyIgnoredBuilds.ts @@ -1,6 +1,8 @@ import path from 'path' + import { parse } from '@pnpm/dependency-path' import { type Modules, readModulesManifest } from '@pnpm/modules-yaml' + import type { IgnoredBuildsCommandOpts } from './ignoredBuilds.js' export interface GetAutomaticallyIgnoredBuildsResult { diff --git a/building/policy-commands/src/ignoredBuilds.ts b/building/policy-commands/src/ignoredBuilds.ts index 26c927a694..38354261ef 100644 --- a/building/policy-commands/src/ignoredBuilds.ts +++ b/building/policy-commands/src/ignoredBuilds.ts @@ -1,5 +1,6 @@ import type { Config } from '@pnpm/config' import { renderHelp } from 'render-help' + import { getAutomaticallyIgnoredBuilds } from './getAutomaticallyIgnoredBuilds.js' export type IgnoredBuildsCommandOpts = Pick diff --git a/building/policy-commands/test/approveBuilds.test.ts b/building/policy-commands/test/approveBuilds.test.ts index 9c414e2688..8f2cd41b6f 100644 --- a/building/policy-commands/test/approveBuilds.test.ts +++ b/building/policy-commands/test/approveBuilds.test.ts @@ -1,18 +1,19 @@ import fs from 'fs' import path from 'path' -import type { ApproveBuildsCommandOpts } from '@pnpm/building.policy-commands' + +import { jest } from '@jest/globals' import type { RebuildCommandOpts } from '@pnpm/building.build-commands' -import { prepare } from '@pnpm/prepare' +import type { ApproveBuildsCommandOpts } from '@pnpm/building.policy-commands' import { getConfig } from '@pnpm/config' import { readModulesManifest } from '@pnpm/modules-yaml' -import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' -import { jest } from '@jest/globals' -import { omit } from 'ramda' +import { prepare } from '@pnpm/prepare' import { tempDir } from '@pnpm/prepare-temp-dir' -import { writePackageSync } from 'write-package' -import { readYamlFileSync } from 'read-yaml-file' -import { writeYamlFileSync } from 'write-yaml-file' +import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { safeExeca as execa } from 'execa' +import { omit } from 'ramda' +import { readYamlFileSync } from 'read-yaml-file' +import { writePackageSync } from 'write-package' +import { writeYamlFileSync } from 'write-yaml-file' jest.unstable_mockModule('enquirer', () => ({ default: { prompt: jest.fn() } })) const { default: enquirer } = await import('enquirer') diff --git a/building/policy-commands/test/ignoredBuilds.test.ts b/building/policy-commands/test/ignoredBuilds.test.ts index ea6a93164c..9c893aa88e 100644 --- a/building/policy-commands/test/ignoredBuilds.test.ts +++ b/building/policy-commands/test/ignoredBuilds.test.ts @@ -1,8 +1,9 @@ -import path from 'path' import fs from 'fs' +import path from 'path' + import { ignoredBuilds } from '@pnpm/building.policy-commands' -import { tempDir } from '@pnpm/prepare-temp-dir' import { writeModulesManifest } from '@pnpm/modules-yaml' +import { tempDir } from '@pnpm/prepare-temp-dir' import type { DepPath } from '@pnpm/types' const DEFAULT_MODULES_MANIFEST = { diff --git a/building/policy/src/index.ts b/building/policy/src/index.ts index 140f5a5195..d647367208 100644 --- a/building/policy/src/index.ts +++ b/building/policy/src/index.ts @@ -1,5 +1,5 @@ -import type { AllowBuild } from '@pnpm/types' import { expandPackageVersionSpecs } from '@pnpm/config.version-policy' +import type { AllowBuild } from '@pnpm/types' export function createAllowBuildFunction ( opts: { diff --git a/cache/api/src/cacheDelete.ts b/cache/api/src/cacheDelete.ts index 4bdb333cd0..195e9a73d2 100644 --- a/cache/api/src/cacheDelete.ts +++ b/cache/api/src/cacheDelete.ts @@ -1,5 +1,6 @@ -import path from 'path' import fs from 'fs' +import path from 'path' + import { findMetadataFiles } from './cacheList.js' export async function cacheDelete (opts: { cacheDir: string, registry?: string }, filter: string[]): Promise { diff --git a/cache/api/src/cacheList.ts b/cache/api/src/cacheList.ts index 00554b916d..2e55f23ea6 100644 --- a/cache/api/src/cacheList.ts +++ b/cache/api/src/cacheList.ts @@ -1,4 +1,5 @@ import fs from 'fs' + import getRegistryName from 'encode-registry' import { glob } from 'tinyglobby' diff --git a/cache/api/src/cacheView.ts b/cache/api/src/cacheView.ts index d72d778e1c..928897d333 100644 --- a/cache/api/src/cacheView.ts +++ b/cache/api/src/cacheView.ts @@ -1,9 +1,10 @@ import fs from 'fs' import path from 'path' -import { glob } from 'tinyglobby' -import { StoreIndex, storeIndexKey } from '@pnpm/store.index' + import type { PackageMeta } from '@pnpm/npm-resolver' +import { StoreIndex, storeIndexKey } from '@pnpm/store.index' import getRegistryName from 'encode-registry' +import { glob } from 'tinyglobby' interface CachedVersions { cachedVersions: string[] diff --git a/cache/api/src/index.ts b/cache/api/src/index.ts index 3f349efb2d..d6b284069f 100644 --- a/cache/api/src/index.ts +++ b/cache/api/src/index.ts @@ -1,3 +1,3 @@ -export * from './cacheList.js' export * from './cacheDelete.js' +export * from './cacheList.js' export * from './cacheView.js' diff --git a/cache/commands/src/cache.cmd.ts b/cache/commands/src/cache.cmd.ts index 19956a4333..85a8c005f3 100644 --- a/cache/commands/src/cache.cmd.ts +++ b/cache/commands/src/cache.cmd.ts @@ -1,17 +1,18 @@ import path from 'path' + +import { + cacheDelete, + cacheList, + cacheListRegistries, + cacheView, +} from '@pnpm/cache.api' import { docsUrl } from '@pnpm/cli-utils' import { type Config, types as allTypes } from '@pnpm/config' -import { FULL_FILTERED_META_DIR, ABBREVIATED_META_DIR } from '@pnpm/constants' +import { ABBREVIATED_META_DIR, FULL_FILTERED_META_DIR } from '@pnpm/constants' +import { PnpmError } from '@pnpm/error' import { getStorePath } from '@pnpm/store-path' import { pick } from 'ramda' import { renderHelp } from 'render-help' -import { - cacheList, - cacheView, - cacheDelete, - cacheListRegistries, -} from '@pnpm/cache.api' -import { PnpmError } from '@pnpm/error' export const rcOptionsTypes = cliOptionsTypes diff --git a/cache/commands/test/cacheDelete.cmd.test.ts b/cache/commands/test/cacheDelete.cmd.test.ts index 0ce14b8365..617d43a415 100644 --- a/cache/commands/test/cacheDelete.cmd.test.ts +++ b/cache/commands/test/cacheDelete.cmd.test.ts @@ -1,9 +1,10 @@ import path from 'path' + +import { cache } from '@pnpm/cache.commands' import { prepare } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' -import { safeExeca as execa } from 'execa' -import { cache } from '@pnpm/cache.commands' import { rimrafSync } from '@zkochan/rimraf' +import { safeExeca as execa } from 'execa' const pnpmBin = path.join(import.meta.dirname, '../../../pnpm/bin/pnpm.mjs') const REGISTRY = `http://localhost:${REGISTRY_MOCK_PORT}/` diff --git a/cache/commands/test/cacheList.cmd.test.ts b/cache/commands/test/cacheList.cmd.test.ts index b6e4fffc6d..86ce42d466 100644 --- a/cache/commands/test/cacheList.cmd.test.ts +++ b/cache/commands/test/cacheList.cmd.test.ts @@ -1,9 +1,10 @@ import path from 'path' + +import { cache } from '@pnpm/cache.commands' import { prepare } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' -import { safeExeca as execa } from 'execa' -import { cache } from '@pnpm/cache.commands' import { rimrafSync } from '@zkochan/rimraf' +import { safeExeca as execa } from 'execa' const pnpmBin = path.join(import.meta.dirname, '../../../pnpm/bin/pnpm.mjs') const REGISTRY = `http://localhost:${REGISTRY_MOCK_PORT}/` diff --git a/cache/commands/test/cacheView.cmd.test.ts b/cache/commands/test/cacheView.cmd.test.ts index 40d34e39ee..b4da5b2dc2 100644 --- a/cache/commands/test/cacheView.cmd.test.ts +++ b/cache/commands/test/cacheView.cmd.test.ts @@ -1,9 +1,10 @@ import path from 'path' + +import { cache } from '@pnpm/cache.commands' import { prepare } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' -import { safeExeca as execa } from 'execa' -import { cache } from '@pnpm/cache.commands' import { rimrafSync } from '@zkochan/rimraf' +import { safeExeca as execa } from 'execa' const pnpmBin = path.join(import.meta.dirname, '../../../pnpm/bin/pnpm.mjs') const REGISTRY = `http://localhost:${REGISTRY_MOCK_PORT}/` diff --git a/catalogs/config/src/getCatalogsFromWorkspaceManifest.ts b/catalogs/config/src/getCatalogsFromWorkspaceManifest.ts index 7fc2554352..80a858bf28 100644 --- a/catalogs/config/src/getCatalogsFromWorkspaceManifest.ts +++ b/catalogs/config/src/getCatalogsFromWorkspaceManifest.ts @@ -1,5 +1,5 @@ -import { PnpmError } from '@pnpm/error' import type { Catalogs } from '@pnpm/catalogs.types' +import { PnpmError } from '@pnpm/error' import type { WorkspaceManifest } from '@pnpm/workspace.read-manifest' export function getCatalogsFromWorkspaceManifest ( diff --git a/catalogs/resolver/src/index.ts b/catalogs/resolver/src/index.ts index 7ba5816826..ec9f6e41c4 100644 --- a/catalogs/resolver/src/index.ts +++ b/catalogs/resolver/src/index.ts @@ -1,11 +1,11 @@ +export { type CatalogResultMatcher, matchCatalogResolveResult } from './matchCatalogResolveResult.js' export { - resolveFromCatalog, type CatalogResolution, type CatalogResolutionFound, type CatalogResolutionMisconfiguration, type CatalogResolutionUnused as CatalogResolutionNotUsed, type CatalogResolutionResult, type CatalogResolver, + resolveFromCatalog, type WantedDependency, } from './resolveFromCatalog.js' -export { type CatalogResultMatcher, matchCatalogResolveResult } from './matchCatalogResolveResult.js' diff --git a/catalogs/resolver/src/matchCatalogResolveResult.ts b/catalogs/resolver/src/matchCatalogResolveResult.ts index aaa5ad1803..33a4a58f28 100644 --- a/catalogs/resolver/src/matchCatalogResolveResult.ts +++ b/catalogs/resolver/src/matchCatalogResolveResult.ts @@ -1,4 +1,4 @@ -import type { CatalogResolutionUnused, CatalogResolutionResult, CatalogResolutionFound, CatalogResolutionMisconfiguration } from './resolveFromCatalog.js' +import type { CatalogResolutionFound, CatalogResolutionMisconfiguration, CatalogResolutionResult, CatalogResolutionUnused } from './resolveFromCatalog.js' export interface CatalogResultMatcher { readonly found: (found: CatalogResolutionFound) => T diff --git a/catalogs/resolver/src/resolveFromCatalog.ts b/catalogs/resolver/src/resolveFromCatalog.ts index 15d33953e7..695e904d18 100644 --- a/catalogs/resolver/src/resolveFromCatalog.ts +++ b/catalogs/resolver/src/resolveFromCatalog.ts @@ -1,6 +1,6 @@ -import { PnpmError } from '@pnpm/error' import { parseCatalogProtocol } from '@pnpm/catalogs.protocol-parser' import type { Catalogs } from '@pnpm/catalogs.types' +import { PnpmError } from '@pnpm/error' export interface WantedDependency { readonly bareSpecifier: string diff --git a/catalogs/resolver/test/resolveFromCatalog.test.ts b/catalogs/resolver/test/resolveFromCatalog.test.ts index 3642c15162..4e2d7f6cd8 100644 --- a/catalogs/resolver/test/resolveFromCatalog.test.ts +++ b/catalogs/resolver/test/resolveFromCatalog.test.ts @@ -1,7 +1,7 @@ -import { type WantedDependency, resolveFromCatalog, matchCatalogResolveResult } from '@pnpm/catalogs.resolver' +import { jest } from '@jest/globals' +import { matchCatalogResolveResult, resolveFromCatalog, type WantedDependency } from '@pnpm/catalogs.resolver' import type { Catalogs } from '@pnpm/catalogs.types' import { PnpmError } from '@pnpm/error' -import { jest } from '@jest/globals' describe('default catalog', () => { const catalogs = { diff --git a/cli/cli-utils/src/getConfig.ts b/cli/cli-utils/src/getConfig.ts index ac496bc7a8..3a926e9ae6 100644 --- a/cli/cli-utils/src/getConfig.ts +++ b/cli/cli-utils/src/getConfig.ts @@ -1,7 +1,8 @@ import fs from 'fs' import path from 'path' + import { packageManager } from '@pnpm/cli-meta' -import { getConfig as _getConfig, type CliOptions, type Config } from '@pnpm/config' +import { type CliOptions, type Config, getConfig as _getConfig } from '@pnpm/config' import { installConfigDeps } from '@pnpm/config.deps-installer' import { formatWarn } from '@pnpm/default-reporter' import { requireHooks } from '@pnpm/pnpmfile' diff --git a/cli/cli-utils/src/readProjectManifest.ts b/cli/cli-utils/src/readProjectManifest.ts index 78aceda42c..1821930846 100644 --- a/cli/cli-utils/src/readProjectManifest.ts +++ b/cli/cli-utils/src/readProjectManifest.ts @@ -1,5 +1,6 @@ import * as utils from '@pnpm/read-project-manifest' -import type { SupportedArchitectures, ProjectManifest } from '@pnpm/types' +import type { ProjectManifest, SupportedArchitectures } from '@pnpm/types' + import { packageIsInstallable } from './packageIsInstallable.js' export interface ReadProjectManifestOpts { diff --git a/cli/cli-utils/test/getConfig.test.ts b/cli/cli-utils/test/getConfig.test.ts index ab75a5f7ed..47bed9094a 100644 --- a/cli/cli-utils/test/getConfig.test.ts +++ b/cli/cli-utils/test/getConfig.test.ts @@ -1,9 +1,10 @@ /// import fs from 'fs' import path from 'path' + +import { jest } from '@jest/globals' import { calcPnpmfilePathsOfPluginDeps, getConfig } from '@pnpm/cli-utils' import { prepare } from '@pnpm/prepare' -import { jest } from '@jest/globals' beforeEach(() => { jest.spyOn(console, 'warn') diff --git a/cli/default-reporter/src/index.ts b/cli/default-reporter/src/index.ts index b4901a6077..bc3a50e9b8 100644 --- a/cli/default-reporter/src/index.ts +++ b/cli/default-reporter/src/index.ts @@ -1,14 +1,15 @@ import type { Config } from '@pnpm/config' import type * as logs from '@pnpm/core-loggers' import type { LogLevel, StreamParser } from '@pnpm/logger' +import createDiffer from 'ansi-diff' import * as Rx from 'rxjs' import { filter, map, mergeAll } from 'rxjs/operators' -import createDiffer from 'ansi-diff' + import { EOL } from './constants.js' import { mergeOutputs } from './mergeOutputs.js' import { reporterForClient } from './reporterForClient/index.js' -import { formatWarn } from './reporterForClient/utils/formatWarn.js' import type { FilterPkgsDiff } from './reporterForClient/reportSummary.js' +import { formatWarn } from './reporterForClient/utils/formatWarn.js' export { formatWarn } diff --git a/cli/default-reporter/src/mergeOutputs.ts b/cli/default-reporter/src/mergeOutputs.ts index 154fe714ca..01160f80e9 100644 --- a/cli/default-reporter/src/mergeOutputs.ts +++ b/cli/default-reporter/src/mergeOutputs.ts @@ -1,5 +1,6 @@ import * as Rx from 'rxjs' import { filter, map, mergeAll, scan } from 'rxjs/operators' + import { EOL } from './constants.js' export function mergeOutputs (outputs: Array>>): Rx.Observable { diff --git a/cli/default-reporter/src/reportError.ts b/cli/default-reporter/src/reportError.ts index bc4f9435b7..25eb7b04b7 100644 --- a/cli/default-reporter/src/reportError.ts +++ b/cli/default-reporter/src/reportError.ts @@ -8,6 +8,7 @@ import type { PeerDependencyIssuesByProjects } from '@pnpm/types' import chalk from 'chalk' import { equals } from 'ramda' import StackTracey from 'stacktracey' + import { EOL } from './constants.js' StackTracey.maxColumnWidths = { diff --git a/cli/default-reporter/src/reporterForClient/index.ts b/cli/default-reporter/src/reporterForClient/index.ts index 18d2f35186..1292ba1f42 100644 --- a/cli/default-reporter/src/reporterForClient/index.ts +++ b/cli/default-reporter/src/reporterForClient/index.ts @@ -3,23 +3,24 @@ import type * as logs from '@pnpm/core-loggers' import type { LogLevel } from '@pnpm/logger' import type * as Rx from 'rxjs' import { throttleTime } from 'rxjs/operators' + import { reportBigTarballProgress } from './reportBigTarballsProgress.js' import { reportContext } from './reportContext.js' -import { reportExecutionTime } from './reportExecutionTime.js' import { reportDeprecations } from './reportDeprecations.js' +import { reportExecutionTime } from './reportExecutionTime.js' import { reportHooks } from './reportHooks.js' import { reportIgnoredBuilds } from './reportIgnoredBuilds.js' import { reportInstallChecks } from './reportInstallChecks.js' import { reportInstallingConfigDeps } from './reportInstallingConfigDeps.js' import { reportLifecycleScripts } from './reportLifecycleScripts.js' -import { reportMisc, LOG_LEVEL_NUMBER } from './reportMisc.js' +import { LOG_LEVEL_NUMBER, reportMisc } from './reportMisc.js' import { reportPeerDependencyIssues } from './reportPeerDependencyIssues.js' import { reportProgress } from './reportProgress.js' import { reportRequestRetry } from './reportRequestRetry.js' import { reportScope } from './reportScope.js' import { reportSkippedOptionalDependencies } from './reportSkippedOptionalDependencies.js' import { reportStats } from './reportStats.js' -import { reportSummary, type FilterPkgsDiff } from './reportSummary.js' +import { type FilterPkgsDiff, reportSummary } from './reportSummary.js' import { reportUpdateCheck } from './reportUpdateCheck.js' const PRINT_EXECUTION_TIME_IN_COMMANDS = { diff --git a/cli/default-reporter/src/reporterForClient/pkgsDiff.ts b/cli/default-reporter/src/reporterForClient/pkgsDiff.ts index 686d25222d..77e3370364 100644 --- a/cli/default-reporter/src/reporterForClient/pkgsDiff.ts +++ b/cli/default-reporter/src/reporterForClient/pkgsDiff.ts @@ -1,8 +1,8 @@ import type * as logs from '@pnpm/core-loggers' import type { BaseManifest } from '@pnpm/types' +import { difference, mergeRight } from 'ramda' import * as Rx from 'rxjs' import { filter, map, mapTo, reduce, scan, startWith, take } from 'rxjs/operators' -import { mergeRight, difference } from 'ramda' export interface PackageDiff { added: boolean diff --git a/cli/default-reporter/src/reporterForClient/reportBigTarballsProgress.ts b/cli/default-reporter/src/reporterForClient/reportBigTarballsProgress.ts index 1c3a14e7f1..8777b6f092 100644 --- a/cli/default-reporter/src/reporterForClient/reportBigTarballsProgress.ts +++ b/cli/default-reporter/src/reporterForClient/reportBigTarballsProgress.ts @@ -1,7 +1,8 @@ import type { FetchingProgressLog } from '@pnpm/core-loggers' +import prettyBytes from 'pretty-bytes' import type * as Rx from 'rxjs' import { filter, map, startWith } from 'rxjs/operators' -import prettyBytes from 'pretty-bytes' + import { hlValue, } from './outputConstants.js' diff --git a/cli/default-reporter/src/reporterForClient/reportContext.ts b/cli/default-reporter/src/reporterForClient/reportContext.ts index 291c222239..df81d87472 100644 --- a/cli/default-reporter/src/reporterForClient/reportContext.ts +++ b/cli/default-reporter/src/reporterForClient/reportContext.ts @@ -1,8 +1,9 @@ import path from 'path' + import type { ContextLog, PackageImportMethodLog } from '@pnpm/core-loggers' +import normalize from 'normalize-path' import * as Rx from 'rxjs' import { map, take } from 'rxjs/operators' -import normalize from 'normalize-path' export function reportContext ( log$: { diff --git a/cli/default-reporter/src/reporterForClient/reportDeprecations.ts b/cli/default-reporter/src/reporterForClient/reportDeprecations.ts index e19bfc5a5f..89baa2ec2c 100644 --- a/cli/default-reporter/src/reporterForClient/reportDeprecations.ts +++ b/cli/default-reporter/src/reporterForClient/reportDeprecations.ts @@ -1,7 +1,8 @@ import type { DeprecationLog, StageLog } from '@pnpm/core-loggers' -import * as Rx from 'rxjs' -import { map, filter, buffer, switchMap } from 'rxjs/operators' import chalk from 'chalk' +import * as Rx from 'rxjs' +import { buffer, filter, map, switchMap } from 'rxjs/operators' + import { formatWarn } from './utils/formatWarn.js' import { zoomOut } from './utils/zooming.js' diff --git a/cli/default-reporter/src/reporterForClient/reportExecutionTime.ts b/cli/default-reporter/src/reporterForClient/reportExecutionTime.ts index 0ccba31979..18be9ef19d 100644 --- a/cli/default-reporter/src/reporterForClient/reportExecutionTime.ts +++ b/cli/default-reporter/src/reporterForClient/reportExecutionTime.ts @@ -1,6 +1,6 @@ -import prettyMs from 'pretty-ms' import { packageManager } from '@pnpm/cli-meta' import type { ExecutionTimeLog } from '@pnpm/core-loggers' +import prettyMs from 'pretty-ms' import * as Rx from 'rxjs' import { map, take } from 'rxjs/operators' diff --git a/cli/default-reporter/src/reporterForClient/reportHooks.ts b/cli/default-reporter/src/reporterForClient/reportHooks.ts index dc46a10bc6..edb07c2656 100644 --- a/cli/default-reporter/src/reporterForClient/reportHooks.ts +++ b/cli/default-reporter/src/reporterForClient/reportHooks.ts @@ -1,7 +1,8 @@ import type { HookLog } from '@pnpm/core-loggers' +import chalk from 'chalk' import * as Rx from 'rxjs' import { map } from 'rxjs/operators' -import chalk from 'chalk' + import { autozoom } from './utils/zooming.js' export function reportHooks ( diff --git a/cli/default-reporter/src/reporterForClient/reportIgnoredBuilds.ts b/cli/default-reporter/src/reporterForClient/reportIgnoredBuilds.ts index a3fc989339..13021aa6cd 100644 --- a/cli/default-reporter/src/reporterForClient/reportIgnoredBuilds.ts +++ b/cli/default-reporter/src/reporterForClient/reportIgnoredBuilds.ts @@ -1,9 +1,9 @@ import type { Config } from '@pnpm/config' import type { IgnoredScriptsLog } from '@pnpm/core-loggers' import { lexCompare } from '@pnpm/util.lex-comparator' +import boxen from 'boxen' import * as Rx from 'rxjs' import { map } from 'rxjs/operators' -import boxen from 'boxen' export function reportIgnoredBuilds ( log$: { diff --git a/cli/default-reporter/src/reporterForClient/reportInstallChecks.ts b/cli/default-reporter/src/reporterForClient/reportInstallChecks.ts index 841b9662ea..ebea125789 100644 --- a/cli/default-reporter/src/reporterForClient/reportInstallChecks.ts +++ b/cli/default-reporter/src/reporterForClient/reportInstallChecks.ts @@ -1,6 +1,7 @@ import type { InstallCheckLog } from '@pnpm/core-loggers' import * as Rx from 'rxjs' import { filter, map } from 'rxjs/operators' + import { formatWarn } from './utils/formatWarn.js' import { autozoom } from './utils/zooming.js' diff --git a/cli/default-reporter/src/reporterForClient/reportLifecycleScripts.ts b/cli/default-reporter/src/reporterForClient/reportLifecycleScripts.ts index 1a681e8bca..ef4cd7e5e4 100644 --- a/cli/default-reporter/src/reporterForClient/reportLifecycleScripts.ts +++ b/cli/default-reporter/src/reporterForClient/reportLifecycleScripts.ts @@ -1,13 +1,15 @@ -import cliTruncate from 'cli-truncate' import path from 'path' + import type { LifecycleLog } from '@pnpm/core-loggers' +import chalk from 'chalk' +import cliTruncate from 'cli-truncate' +import prettyTime from 'pretty-ms' import * as Rx from 'rxjs' import { buffer, filter, groupBy, map, mergeAll, mergeMap } from 'rxjs/operators' -import chalk from 'chalk' -import prettyTime from 'pretty-ms' + import { EOL } from '../constants.js' -import { formatPrefix, formatPrefixNoTrim } from './utils/formatPrefix.js' import { hlValue } from './outputConstants.js' +import { formatPrefix, formatPrefixNoTrim } from './utils/formatPrefix.js' const NODE_MODULES = `${path.sep}node_modules${path.sep}` const TMP_DIR_IN_STORE = `tmp${path.sep}_tmp_` // git-hosted dependencies are built in these temporary directories diff --git a/cli/default-reporter/src/reporterForClient/reportMisc.ts b/cli/default-reporter/src/reporterForClient/reportMisc.ts index 7cc049f32d..b68ae4741e 100644 --- a/cli/default-reporter/src/reporterForClient/reportMisc.ts +++ b/cli/default-reporter/src/reporterForClient/reportMisc.ts @@ -1,9 +1,11 @@ import os from 'os' + import type { Config } from '@pnpm/config' import type { Log, RegistryLog } from '@pnpm/core-loggers' import type { LogLevel } from '@pnpm/logger' import * as Rx from 'rxjs' import { filter, map } from 'rxjs/operators' + import { reportError } from '../reportError.js' import { formatWarn } from './utils/formatWarn.js' import { autozoom } from './utils/zooming.js' diff --git a/cli/default-reporter/src/reporterForClient/reportPeerDependencyIssues.ts b/cli/default-reporter/src/reporterForClient/reportPeerDependencyIssues.ts index c185672756..dd3a9a9aeb 100644 --- a/cli/default-reporter/src/reporterForClient/reportPeerDependencyIssues.ts +++ b/cli/default-reporter/src/reporterForClient/reportPeerDependencyIssues.ts @@ -2,6 +2,7 @@ import type { PeerDependencyIssuesLog } from '@pnpm/core-loggers' import { renderPeerIssues } from '@pnpm/render-peer-issues' import * as Rx from 'rxjs' import { map, take } from 'rxjs/operators' + import { formatWarn } from './utils/formatWarn.js' export function reportPeerDependencyIssues ( diff --git a/cli/default-reporter/src/reporterForClient/reportProgress.ts b/cli/default-reporter/src/reporterForClient/reportProgress.ts index b624e1305c..9c199b163e 100644 --- a/cli/default-reporter/src/reporterForClient/reportProgress.ts +++ b/cli/default-reporter/src/reporterForClient/reportProgress.ts @@ -1,6 +1,7 @@ import type { ProgressLog, StageLog } from '@pnpm/core-loggers' import * as Rx from 'rxjs' -import { filter, map, mapTo, takeWhile, startWith, take } from 'rxjs/operators' +import { filter, map, mapTo, startWith, take, takeWhile } from 'rxjs/operators' + import { hlValue } from './outputConstants.js' import { zoomOut } from './utils/zooming.js' diff --git a/cli/default-reporter/src/reporterForClient/reportRequestRetry.ts b/cli/default-reporter/src/reporterForClient/reportRequestRetry.ts index d1a18fce5f..03879e4f96 100644 --- a/cli/default-reporter/src/reporterForClient/reportRequestRetry.ts +++ b/cli/default-reporter/src/reporterForClient/reportRequestRetry.ts @@ -1,7 +1,8 @@ import type { RequestRetryLog } from '@pnpm/core-loggers' +import prettyMilliseconds from 'pretty-ms' import * as Rx from 'rxjs' import { map } from 'rxjs/operators' -import prettyMilliseconds from 'pretty-ms' + import { formatWarn } from './utils/formatWarn.js' export function reportRequestRetry ( diff --git a/cli/default-reporter/src/reporterForClient/reportStats.ts b/cli/default-reporter/src/reporterForClient/reportStats.ts index 0ea40daac1..1afd002f36 100644 --- a/cli/default-reporter/src/reporterForClient/reportStats.ts +++ b/cli/default-reporter/src/reporterForClient/reportStats.ts @@ -1,9 +1,10 @@ import type { StatsLog } from '@pnpm/core-loggers' -import * as Rx from 'rxjs' -import { filter, take, reduce, map } from 'rxjs/operators' import chalk from 'chalk' import { repeat } from 'ramda' +import * as Rx from 'rxjs' +import { filter, map, reduce, take } from 'rxjs/operators' import stringLength from 'string-length' + import { EOL } from '../constants.js' import { ADDED_CHAR, diff --git a/cli/default-reporter/src/reporterForClient/reportSummary.ts b/cli/default-reporter/src/reporterForClient/reportSummary.ts index 6be7a148b9..edd8fe5449 100644 --- a/cli/default-reporter/src/reporterForClient/reportSummary.ts +++ b/cli/default-reporter/src/reporterForClient/reportSummary.ts @@ -1,25 +1,27 @@ import path from 'path' + +import type { Config } from '@pnpm/config' import type { DeprecationLog, PackageManifestLog, RootLog, SummaryLog, } from '@pnpm/core-loggers' -import type { Config } from '@pnpm/config' +import chalk from 'chalk' import * as Rx from 'rxjs' import { map, take } from 'rxjs/operators' -import chalk from 'chalk' import semver from 'semver' + import { EOL } from '../constants.js' +import { + ADDED_CHAR, + REMOVED_CHAR, +} from './outputConstants.js' import { getPkgsDiff, type PackageDiff, propertyByDependencyType, } from './pkgsDiff.js' -import { - ADDED_CHAR, - REMOVED_CHAR, -} from './outputConstants.js' type DepType = 'prod' | 'optional' | 'peer' | 'dev' | 'nodeModulesOnly' diff --git a/cli/default-reporter/src/reporterForClient/reportUpdateCheck.ts b/cli/default-reporter/src/reporterForClient/reportUpdateCheck.ts index a280422c7c..abc99b865d 100644 --- a/cli/default-reporter/src/reporterForClient/reportUpdateCheck.ts +++ b/cli/default-reporter/src/reporterForClient/reportUpdateCheck.ts @@ -1,5 +1,5 @@ -import type { UpdateCheckLog } from '@pnpm/core-loggers' import { detectIfCurrentPkgIsExecutable, isExecutedByCorepack } from '@pnpm/cli-meta' +import type { UpdateCheckLog } from '@pnpm/core-loggers' import boxen from 'boxen' import chalk from 'chalk' import * as Rx from 'rxjs' diff --git a/cli/default-reporter/src/reporterForClient/utils/formatPrefix.ts b/cli/default-reporter/src/reporterForClient/utils/formatPrefix.ts index e2c7c13aea..2da945fb11 100644 --- a/cli/default-reporter/src/reporterForClient/utils/formatPrefix.ts +++ b/cli/default-reporter/src/reporterForClient/utils/formatPrefix.ts @@ -1,5 +1,7 @@ import path from 'path' + import normalize from 'normalize-path' + import { PREFIX_MAX_LENGTH } from '../outputConstants.js' export function formatPrefix (cwd: string, prefix: string): string { diff --git a/cli/default-reporter/test/filterLogHook.ts b/cli/default-reporter/test/filterLogHook.ts index ac5b2d6d74..632eefa2db 100644 --- a/cli/default-reporter/test/filterLogHook.ts +++ b/cli/default-reporter/test/filterLogHook.ts @@ -1,6 +1,6 @@ import type { Log } from '@pnpm/core-loggers' import { toOutput$ } from '@pnpm/default-reporter' -import { logger, createStreamParser } from '@pnpm/logger' +import { createStreamParser, logger } from '@pnpm/logger' import { firstValueFrom } from 'rxjs' test('logger with filterLog hook', async () => { diff --git a/cli/default-reporter/test/index.ts b/cli/default-reporter/test/index.ts index 40b4a437fe..e2a69a0294 100644 --- a/cli/default-reporter/test/index.ts +++ b/cli/default-reporter/test/index.ts @@ -1,5 +1,6 @@ /// import path from 'path' + import type { Config } from '@pnpm/config' import { deprecationLogger, @@ -17,11 +18,12 @@ import { createStreamParser, logger, } from '@pnpm/logger' -import { map, skip, take } from 'rxjs/operators' import chalk from 'chalk' import normalizeNewline from 'normalize-newline' -import { firstValueFrom } from 'rxjs' import { repeat } from 'ramda' +import { firstValueFrom } from 'rxjs' +import { map, skip, take } from 'rxjs/operators' + import { formatWarn } from '../src/reporterForClient/utils/formatWarn.js' const formatErrorCode = (code: string) => chalk.bgRed.black(`\u2009${code}\u2009`) diff --git a/cli/default-reporter/test/reportingContext.ts b/cli/default-reporter/test/reportingContext.ts index 7597427fc8..a1465b0569 100644 --- a/cli/default-reporter/test/reportingContext.ts +++ b/cli/default-reporter/test/reportingContext.ts @@ -1,4 +1,5 @@ import { setTimeout } from 'node:timers/promises' + import { contextLogger, packageImportMethodLogger } from '@pnpm/core-loggers' import { toOutput$ } from '@pnpm/default-reporter' import { diff --git a/cli/default-reporter/test/reportingDeprecations.ts b/cli/default-reporter/test/reportingDeprecations.ts index 6a328e9b9a..4519588400 100644 --- a/cli/default-reporter/test/reportingDeprecations.ts +++ b/cli/default-reporter/test/reportingDeprecations.ts @@ -5,10 +5,11 @@ import { } from '@pnpm/core-loggers' import { toOutput$ } from '@pnpm/default-reporter' import { createStreamParser } from '@pnpm/logger' -import { firstValueFrom } from 'rxjs' -import { map, take } from 'rxjs/operators' import chalk from 'chalk' import normalizeNewline from 'normalize-newline' +import { firstValueFrom } from 'rxjs' +import { map, take } from 'rxjs/operators' + import { formatWarn } from '../src/reporterForClient/utils/formatWarn.js' test('prints summary of deprecated subdependencies', async () => { diff --git a/cli/default-reporter/test/reportingErrors.ts b/cli/default-reporter/test/reportingErrors.ts index f508fb51a3..fe9be5f49a 100644 --- a/cli/default-reporter/test/reportingErrors.ts +++ b/cli/default-reporter/test/reportingErrors.ts @@ -1,15 +1,16 @@ import path from 'path' + import { toOutput$ } from '@pnpm/default-reporter' import { PnpmError } from '@pnpm/error' import { createStreamParser, logger, } from '@pnpm/logger' -import { firstValueFrom } from 'rxjs' -import { map, take } from 'rxjs/operators' import chalk from 'chalk' import { loadJsonFileSync } from 'load-json-file' import normalizeNewline from 'normalize-newline' +import { firstValueFrom } from 'rxjs' +import { map, take } from 'rxjs/operators' import StackTracey from 'stacktracey' interface Exception extends NodeJS.ErrnoException { diff --git a/cli/default-reporter/test/reportingExecutionTime.ts b/cli/default-reporter/test/reportingExecutionTime.ts index 2756267e57..0838caf35f 100644 --- a/cli/default-reporter/test/reportingExecutionTime.ts +++ b/cli/default-reporter/test/reportingExecutionTime.ts @@ -1,6 +1,7 @@ import { setTimeout } from 'node:timers/promises' -import { executionTimeLogger } from '@pnpm/core-loggers' + import { packageManager } from '@pnpm/cli-meta' +import { executionTimeLogger } from '@pnpm/core-loggers' import { toOutput$ } from '@pnpm/default-reporter' import { createStreamParser } from '@pnpm/logger' import { firstValueFrom } from 'rxjs' diff --git a/cli/default-reporter/test/reportingLifecycleScripts.ts b/cli/default-reporter/test/reportingLifecycleScripts.ts index d7bb8fc195..5eaa969ae6 100644 --- a/cli/default-reporter/test/reportingLifecycleScripts.ts +++ b/cli/default-reporter/test/reportingLifecycleScripts.ts @@ -1,11 +1,12 @@ import path from 'path' + import { lifecycleLogger } from '@pnpm/core-loggers' import { toOutput$ } from '@pnpm/default-reporter' import { createStreamParser } from '@pnpm/logger' -import { map, skip, take, toArray } from 'rxjs/operators' import chalk from 'chalk' import normalizeNewline from 'normalize-newline' import { firstValueFrom } from 'rxjs' +import { map, skip, take, toArray } from 'rxjs/operators' const hlValue = chalk.cyanBright diff --git a/cli/default-reporter/test/reportingProgress.ts b/cli/default-reporter/test/reportingProgress.ts index af1e92f6b8..7bb2ab7baa 100644 --- a/cli/default-reporter/test/reportingProgress.ts +++ b/cli/default-reporter/test/reportingProgress.ts @@ -10,10 +10,11 @@ import { createStreamParser, logger, } from '@pnpm/logger' -import { firstValueFrom } from 'rxjs' -import { map, skip, take, toArray } from 'rxjs/operators' import chalk from 'chalk' import normalizeNewline from 'normalize-newline' +import { firstValueFrom } from 'rxjs' +import { map, skip, take, toArray } from 'rxjs/operators' + import { formatWarn } from '../src/reporterForClient/utils/formatWarn.js' const hlValue = chalk.cyanBright diff --git a/cli/default-reporter/test/reportingRequestRetry.ts b/cli/default-reporter/test/reportingRequestRetry.ts index 4f37b59444..dfef58bf6e 100644 --- a/cli/default-reporter/test/reportingRequestRetry.ts +++ b/cli/default-reporter/test/reportingRequestRetry.ts @@ -4,6 +4,7 @@ import { createStreamParser, } from '@pnpm/logger' import { firstValueFrom } from 'rxjs' + import { formatWarn } from '../src/reporterForClient/utils/formatWarn.js' test('print warning about request retry', async () => { diff --git a/cli/default-reporter/test/reportingScope.ts b/cli/default-reporter/test/reportingScope.ts index f7a233338c..592e14bd61 100644 --- a/cli/default-reporter/test/reportingScope.ts +++ b/cli/default-reporter/test/reportingScope.ts @@ -1,4 +1,5 @@ import { setTimeout } from 'node:timers/promises' + import type { Config } from '@pnpm/config' import { scopeLogger } from '@pnpm/core-loggers' import { toOutput$ } from '@pnpm/default-reporter' diff --git a/cli/default-reporter/test/reportingUpdateCheck.ts b/cli/default-reporter/test/reportingUpdateCheck.ts index 71494ed3a5..a9678fd69f 100644 --- a/cli/default-reporter/test/reportingUpdateCheck.ts +++ b/cli/default-reporter/test/reportingUpdateCheck.ts @@ -1,10 +1,11 @@ import { setTimeout } from 'node:timers/promises' +import { stripVTControlCharacters as stripAnsi } from 'util' + import type { Config } from '@pnpm/config' import { updateCheckLogger } from '@pnpm/core-loggers' import { toOutput$ } from '@pnpm/default-reporter' import { createStreamParser } from '@pnpm/logger' import { firstValueFrom } from 'rxjs' -import { stripVTControlCharacters as stripAnsi } from 'util' const NO_OUTPUT = Symbol('test should not log anything') diff --git a/cli/parse-cli-args/test/index.ts b/cli/parse-cli-args/test/index.ts index 594d33236b..739146869c 100644 --- a/cli/parse-cli-args/test/index.ts +++ b/cli/parse-cli-args/test/index.ts @@ -1,4 +1,5 @@ import os from 'os' + import type { PnpmError } from '@pnpm/error' import { parseCliArgs } from '@pnpm/parse-cli-args' import { temporaryDirectory } from 'tempy' diff --git a/completion/plugin-commands-completion/src/complete.ts b/completion/plugin-commands-completion/src/complete.ts index 357fcdeeb3..6400534f70 100644 --- a/completion/plugin-commands-completion/src/complete.ts +++ b/completion/plugin-commands-completion/src/complete.ts @@ -1,8 +1,9 @@ -import type { CompletionItem } from '@pnpm/tabtab' import type { CompletionFunc } from '@pnpm/command' import { findWorkspaceDir } from '@pnpm/find-workspace-dir' +import type { CompletionItem } from '@pnpm/tabtab' import { findWorkspacePackages } from '@pnpm/workspace.find-packages' import { readWorkspaceManifest } from '@pnpm/workspace.read-manifest' + import { getOptionCompletions } from './getOptionType.js' import { optionTypesToCompletions } from './optionTypesToCompletions.js' diff --git a/completion/plugin-commands-completion/src/completionServer.ts b/completion/plugin-commands-completion/src/completionServer.ts index a8167bc86c..f946cff3e7 100644 --- a/completion/plugin-commands-completion/src/completionServer.ts +++ b/completion/plugin-commands-completion/src/completionServer.ts @@ -1,13 +1,14 @@ -import { type CompletionItem, getShellFromEnv } from '@pnpm/tabtab' import type { CompletionFunc } from '@pnpm/command' -import { split as splitCmd } from 'split-cmd/index.modern.mjs' +import type { ParsedCliArgs } from '@pnpm/parse-cli-args' +import { type CompletionItem, getShellFromEnv } from '@pnpm/tabtab' import tabtab from '@pnpm/tabtab' +import { split as splitCmd } from 'split-cmd/index.modern.mjs' + +import { complete } from './complete.js' import { currentTypedWordType, getLastOption, } from './getOptionType.js' -import type { ParsedCliArgs } from '@pnpm/parse-cli-args' -import { complete } from './complete.js' export function createCompletionServer ( opts: { diff --git a/completion/plugin-commands-completion/src/generateCompletion.ts b/completion/plugin-commands-completion/src/generateCompletion.ts index 509f59fb04..33b0e22004 100644 --- a/completion/plugin-commands-completion/src/generateCompletion.ts +++ b/completion/plugin-commands-completion/src/generateCompletion.ts @@ -1,5 +1,6 @@ -import { renderHelp } from 'render-help' import { getCompletionScript, SUPPORTED_SHELLS } from '@pnpm/tabtab' +import { renderHelp } from 'render-help' + import { getShellFromParams } from './getShell.js' export const commandNames = ['completion'] diff --git a/completion/plugin-commands-completion/src/getShell.test.ts b/completion/plugin-commands-completion/src/getShell.test.ts index b8bb587bf9..fcd5c94fe7 100644 --- a/completion/plugin-commands-completion/src/getShell.test.ts +++ b/completion/plugin-commands-completion/src/getShell.test.ts @@ -1,4 +1,4 @@ -import { getShellFromString, getShellFromParams } from './getShell.js' +import { getShellFromParams, getShellFromString } from './getShell.js' test('getShellFromString errors on undefined', () => { expect(() => getShellFromString()).toThrow('`pnpm completion` requires a shell name') diff --git a/completion/plugin-commands-completion/src/index.ts b/completion/plugin-commands-completion/src/index.ts index 3242342f34..de6bca31a4 100644 --- a/completion/plugin-commands-completion/src/index.ts +++ b/completion/plugin-commands-completion/src/index.ts @@ -1,2 +1,2 @@ -export * as generateCompletion from './generateCompletion.js' export { createCompletionServer } from './completionServer.js' +export * as generateCompletion from './generateCompletion.js' diff --git a/completion/plugin-commands-completion/test/generateCompletion.ts b/completion/plugin-commands-completion/test/generateCompletion.ts index e5476fe89b..07795af278 100644 --- a/completion/plugin-commands-completion/test/generateCompletion.ts +++ b/completion/plugin-commands-completion/test/generateCompletion.ts @@ -1,6 +1,6 @@ -import { SUPPORTED_SHELLS } from '@pnpm/tabtab' -import { generateCompletion } from '@pnpm/plugin-commands-completion' import { jest } from '@jest/globals' +import { generateCompletion } from '@pnpm/plugin-commands-completion' +import { SUPPORTED_SHELLS } from '@pnpm/tabtab' function createHandler () { const log = jest.fn() diff --git a/config/config-writer/src/index.ts b/config/config-writer/src/index.ts index afdf51e717..912be9b34a 100644 --- a/config/config-writer/src/index.ts +++ b/config/config-writer/src/index.ts @@ -1,5 +1,5 @@ -import type { ProjectManifest, PnpmSettings } from '@pnpm/types' import { tryReadProjectManifest } from '@pnpm/read-project-manifest' +import type { PnpmSettings, ProjectManifest } from '@pnpm/types' import { updateWorkspaceManifest } from '@pnpm/workspace.manifest-writer' import { equals } from 'ramda' diff --git a/config/config/src/Config.ts b/config/config/src/Config.ts index 5e2cbbb850..549e734e23 100644 --- a/config/config/src/Config.ts +++ b/config/config/src/Config.ts @@ -1,4 +1,5 @@ import type { Catalogs } from '@pnpm/catalogs.types' +import type { Hooks } from '@pnpm/pnpmfile' import type { EngineDependency, Finder, @@ -9,7 +10,7 @@ import type { SslConfig, TrustPolicy, } from '@pnpm/types' -import type { Hooks } from '@pnpm/pnpmfile' + import type { OptionsFromRootManifest } from './getOptionsFromRootManifest.js' import type { AuthInfo } from './parseAuthInfo.js' diff --git a/config/config/src/checkGlobalBinDir.ts b/config/config/src/checkGlobalBinDir.ts index db66e99dfd..30641149ce 100644 --- a/config/config/src/checkGlobalBinDir.ts +++ b/config/config/src/checkGlobalBinDir.ts @@ -1,6 +1,7 @@ import { promises as fs } from 'fs' import path from 'path' import util from 'util' + import { PnpmError } from '@pnpm/error' import { canWriteToDirSync } from 'can-write-to-dir' import PATH from 'path-name' diff --git a/config/config/src/configFileKey.ts b/config/config/src/configFileKey.ts index 58f8be1fd8..0d4fd8551b 100644 --- a/config/config/src/configFileKey.ts +++ b/config/config/src/configFileKey.ts @@ -1,4 +1,5 @@ import npmTypes from '@pnpm/npm-conf/lib/types.js' + import type { pnpmTypes } from './types.js' type NpmKey = keyof typeof npmTypes.types diff --git a/config/config/src/env.ts b/config/config/src/env.ts index 8d69bc083a..1e5d9a72e2 100644 --- a/config/config/src/env.ts +++ b/config/config/src/env.ts @@ -1,7 +1,8 @@ import path from 'path' import url from 'url' -import kebabCase from 'lodash.kebabcase' + import camelcase from 'camelcase' +import kebabCase from 'lodash.kebabcase' const PREFIX = 'pnpm_config_' diff --git a/config/config/src/getNetworkConfigs.ts b/config/config/src/getNetworkConfigs.ts index dbb1664f0a..15f3d38539 100644 --- a/config/config/src/getNetworkConfigs.ts +++ b/config/config/src/getNetworkConfigs.ts @@ -1,6 +1,8 @@ +import fs from 'fs' + import type { SslConfig } from '@pnpm/types' import normalizeRegistryUrl from 'normalize-registry-url' -import fs from 'fs' + import { type AuthInfo, type AuthInfoInput, parseAuthInfo } from './parseAuthInfo.js' export interface NetworkConfigs { diff --git a/config/config/src/getOptionsFromRootManifest.ts b/config/config/src/getOptionsFromRootManifest.ts index 0deafdfa49..74d3097930 100644 --- a/config/config/src/getOptionsFromRootManifest.ts +++ b/config/config/src/getOptionsFromRootManifest.ts @@ -1,13 +1,14 @@ import path from 'path' + import { envReplace } from '@pnpm/config.env-replace' import { PnpmError } from '@pnpm/error' import type { - SupportedArchitectures, AllowedDeprecatedVersions, PackageExtension, PeerDependencyRules, - ProjectManifest, PnpmSettings, + ProjectManifest, + SupportedArchitectures, } from '@pnpm/types' import { map as mapValues, pick } from 'ramda' diff --git a/config/config/src/index.ts b/config/config/src/index.ts index 4f89e05de5..b3a860bda3 100644 --- a/config/config/src/index.ts +++ b/config/config/src/index.ts @@ -1,34 +1,33 @@ -import path from 'path' import fs from 'fs' import os from 'os' -import { isCI } from 'ci-info' -import { omit } from 'ramda' +import path from 'path' + import { getCatalogsFromWorkspaceManifest } from '@pnpm/catalogs.config' import { GLOBAL_CONFIG_YAML_FILENAME, GLOBAL_LAYOUT_VERSION } from '@pnpm/constants' import { PnpmError } from '@pnpm/error' +import { getCurrentBranch } from '@pnpm/git-utils' +import { createMatcher } from '@pnpm/matcher' import { isCamelCase } from '@pnpm/naming-cases' import loadNpmConf from '@pnpm/npm-conf' import type npmTypes from '@pnpm/npm-conf/lib/types.js' import { safeReadProjectManifestOnly } from '@pnpm/read-project-manifest' -import { getCurrentBranch } from '@pnpm/git-utils' -import { createMatcher } from '@pnpm/matcher' import type { DevEngines, EngineDependency, ProjectManifest } from '@pnpm/types' +import { readWorkspaceManifest, type WorkspaceManifest } from '@pnpm/workspace.read-manifest' import { betterPathResolve } from 'better-path-resolve' import camelcase from 'camelcase' +import { isCI } from 'ci-info' import isWindows from 'is-windows' import kebabCase from 'lodash.kebabcase' import normalizeRegistryUrl from 'normalize-registry-url' -import semver from 'semver' -import { realpathMissing } from 'realpath-missing' import { pathAbsolute } from 'path-absolute' +import { omit } from 'ramda' +import { realpathMissing } from 'realpath-missing' +import semver from 'semver' import which from 'which' + import { inheritAuthConfig, isIniConfigKey, pickIniConfig } from './auth.js' -import { isConfigFileKey } from './configFileKey.js' import { checkGlobalBinDir } from './checkGlobalBinDir.js' -import { hasDependencyBuildOptions, extractAndRemoveDependencyBuildOptions } from './dependencyBuildOptions.js' -import { getDefaultAuthInfo, getNetworkConfigs } from './getNetworkConfigs.js' -import { transformPathKeys } from './transformPath.js' -import { getCacheDir, getConfigDir, getDataDir, getStateDir } from './dirs.js' +import { getDefaultWorkspaceConcurrency, getWorkspaceConcurrency } from './concurrency.js' import type { Config, ConfigWithDeprecatedSettings, @@ -36,32 +35,33 @@ import type { UniversalOptions, VerifyDepsBeforeRun, } from './Config.js' -import { getDefaultWorkspaceConcurrency, getWorkspaceConcurrency } from './concurrency.js' +import { isConfigFileKey } from './configFileKey.js' +import { extractAndRemoveDependencyBuildOptions, hasDependencyBuildOptions } from './dependencyBuildOptions.js' +import { getCacheDir, getConfigDir, getDataDir, getStateDir } from './dirs.js' import { parseEnvVars } from './env.js' -import { type WorkspaceManifest, readWorkspaceManifest } from '@pnpm/workspace.read-manifest' - -import { types } from './types.js' +import { getDefaultAuthInfo, getNetworkConfigs } from './getNetworkConfigs.js' import { getOptionsFromPnpmSettings, getOptionsFromRootManifest } from './getOptionsFromRootManifest.js' import { type CliOptions as SupportedArchitecturesCliOptions, overrideSupportedArchitecturesWithCLI, } from './overrideSupportedArchitecturesWithCLI.js' +import { transformPathKeys } from './transformPath.js' +import { types } from './types.js' export { types } -export { getOptionsFromRootManifest, getOptionsFromPnpmSettings, type OptionsFromRootManifest } from './getOptionsFromRootManifest.js' export { getDefaultWorkspaceConcurrency, getWorkspaceConcurrency } from './concurrency.js' - +export { getOptionsFromPnpmSettings, getOptionsFromRootManifest, type OptionsFromRootManifest } from './getOptionsFromRootManifest.js' export { + createProjectConfigRecord, + type CreateProjectConfigRecordOptions, ProjectConfigInvalidValueTypeError, ProjectConfigIsNotAnObjectError, - ProjectConfigUnsupportedFieldError, ProjectConfigsArrayItemIsNotAnObjectError, ProjectConfigsArrayItemMatchIsNotAnArrayError, ProjectConfigsArrayItemMatchIsNotDefinedError, ProjectConfigsIsNeitherObjectNorArrayError, ProjectConfigsMatchItemIsNotAStringError, - type CreateProjectConfigRecordOptions, - createProjectConfigRecord, + ProjectConfigUnsupportedFieldError, } from './projectConfig.js' export type { Config, ProjectConfig, UniversalOptions, VerifyDepsBeforeRun } diff --git a/config/config/src/projectConfig.ts b/config/config/src/projectConfig.ts index 2b90d066ce..6c992f8580 100644 --- a/config/config/src/projectConfig.ts +++ b/config/config/src/projectConfig.ts @@ -1,6 +1,7 @@ -import { omit } from 'ramda' import { PnpmError } from '@pnpm/error' -import { PROJECT_CONFIG_FIELDS, type Config, type ProjectConfig, type ProjectConfigRecord } from './Config.js' +import { omit } from 'ramda' + +import { type Config, PROJECT_CONFIG_FIELDS, type ProjectConfig, type ProjectConfigRecord } from './Config.js' export type CreateProjectConfigRecordOptions = Pick diff --git a/config/config/src/transformPath.ts b/config/config/src/transformPath.ts index 87f50c0193..a41fe4a680 100644 --- a/config/config/src/transformPath.ts +++ b/config/config/src/transformPath.ts @@ -1,4 +1,5 @@ import { join } from 'path' + import type { Config } from './Config.js' const REGEX = /^~[/\\]/ diff --git a/config/config/test/concurrency.test.ts b/config/config/test/concurrency.test.ts index 77ae013693..13b5e7b060 100644 --- a/config/config/test/concurrency.test.ts +++ b/config/config/test/concurrency.test.ts @@ -1,6 +1,8 @@ -import { jest } from '@jest/globals' import os, { cpus } from 'os' -import { getDefaultWorkspaceConcurrency, resetAvailableParallelismCache, getWorkspaceConcurrency } from '../lib/concurrency.js' + +import { jest } from '@jest/globals' + +import { getDefaultWorkspaceConcurrency, getWorkspaceConcurrency, resetAvailableParallelismCache } from '../lib/concurrency.js' const hostCores = cpus().length diff --git a/config/config/test/dirs.test.ts b/config/config/test/dirs.test.ts index e1d915ccfb..ee65e3c40f 100644 --- a/config/config/test/dirs.test.ts +++ b/config/config/test/dirs.test.ts @@ -1,5 +1,6 @@ import os from 'os' import path from 'path' + import { getCacheDir, getConfigDir, getDataDir, getStateDir } from '../lib/dirs.js' test('getCacheDir()', () => { diff --git a/config/config/test/env.test.ts b/config/config/test/env.test.ts index 41d6a14434..6bcdc8b80c 100644 --- a/config/config/test/env.test.ts +++ b/config/config/test/env.test.ts @@ -1,6 +1,7 @@ import path from 'path' import url from 'url' -import { type ConfigPair, type GetSchema, type Schema, parseEnvVars } from '../src/env.js' + +import { type ConfigPair, type GetSchema, parseEnvVars, type Schema } from '../src/env.js' function assertSchemaKey (key: string): void { const strictlyKebabCase = key diff --git a/config/config/test/getNetworkConfigs.test.ts b/config/config/test/getNetworkConfigs.test.ts index eff688a1c7..e8b6c6fb2a 100644 --- a/config/config/test/getNetworkConfigs.test.ts +++ b/config/config/test/getNetworkConfigs.test.ts @@ -1,6 +1,8 @@ import fs from 'fs' + import { prepareEmpty } from '@pnpm/prepare' -import { type NetworkConfigs, getNetworkConfigs } from '../src/getNetworkConfigs.js' + +import { getNetworkConfigs, type NetworkConfigs } from '../src/getNetworkConfigs.js' test('without files', () => { expect(getNetworkConfigs({})).toStrictEqual({ diff --git a/config/config/test/getOptionsFromRootManifest.test.ts b/config/config/test/getOptionsFromRootManifest.test.ts index 04ad6a4042..783f60e1e0 100644 --- a/config/config/test/getOptionsFromRootManifest.test.ts +++ b/config/config/test/getOptionsFromRootManifest.test.ts @@ -1,5 +1,6 @@ import path from 'path' -import { getOptionsFromRootManifest, getOptionsFromPnpmSettings } from '../lib/getOptionsFromRootManifest.js' + +import { getOptionsFromPnpmSettings, getOptionsFromRootManifest } from '../lib/getOptionsFromRootManifest.js' const ORIGINAL_ENV = process.env diff --git a/config/config/test/globalBinDir.test.ts b/config/config/test/globalBinDir.test.ts index e21dbba69b..9fe9287ca1 100644 --- a/config/config/test/globalBinDir.test.ts +++ b/config/config/test/globalBinDir.test.ts @@ -1,11 +1,12 @@ /// import fs from 'fs' -import { tempDir } from '@pnpm/prepare' -import { jest } from '@jest/globals' +import { homedir } from 'os' import path from 'path' + +import { jest } from '@jest/globals' +import { tempDir } from '@pnpm/prepare' import pathName from 'path-name' import symlinkDir from 'symlink-dir' -import { homedir } from 'os' const globalBinDir = path.join(homedir(), '.local', 'pnpm') const isWindows = process.platform === 'win32' diff --git a/config/config/test/index.ts b/config/config/test/index.ts index 11316349b2..438d16fd09 100644 --- a/config/config/test/index.ts +++ b/config/config/test/index.ts @@ -2,14 +2,14 @@ import fs from 'fs' import os from 'os' import path from 'path' -import PATH from 'path-name' -import { writeYamlFileSync } from 'write-yaml-file' + +import { jest } from '@jest/globals' import loadNpmConf from '@pnpm/npm-conf' import { prepare, prepareEmpty } from '@pnpm/prepare' import { fixtures } from '@pnpm/test-fixtures' -import { jest } from '@jest/globals' - +import PATH from 'path-name' import symlinkDir from 'symlink-dir' +import { writeYamlFileSync } from 'write-yaml-file' jest.unstable_mockModule('@pnpm/git-utils', () => ({ getCurrentBranch: jest.fn() })) diff --git a/config/config/test/overrideSupportedArchitecturesWithCLI.test.ts b/config/config/test/overrideSupportedArchitecturesWithCLI.test.ts index 92e4c88746..fd7d05318d 100644 --- a/config/config/test/overrideSupportedArchitecturesWithCLI.test.ts +++ b/config/config/test/overrideSupportedArchitecturesWithCLI.test.ts @@ -1,5 +1,6 @@ import type { SupportedArchitectures } from '@pnpm/types' -import { type CliOptions, type TargetConfig, overrideSupportedArchitecturesWithCLI } from '../src/overrideSupportedArchitecturesWithCLI.js' + +import { type CliOptions, overrideSupportedArchitecturesWithCLI, type TargetConfig } from '../src/overrideSupportedArchitecturesWithCLI.js' function getOverriddenSupportedArchitectures ( supportedArchitectures: SupportedArchitectures | undefined, diff --git a/config/config/test/parseAuthInfo.test.ts b/config/config/test/parseAuthInfo.test.ts index 8c3cf82794..36251baafb 100644 --- a/config/config/test/parseAuthInfo.test.ts +++ b/config/config/test/parseAuthInfo.test.ts @@ -1,8 +1,8 @@ import { type AuthInfo, AuthMissingSeparatorError, - TokenHelperUnsupportedCharacterError, parseAuthInfo, + TokenHelperUnsupportedCharacterError, } from '../src/parseAuthInfo.js' describe('parseAuthInfo', () => { diff --git a/config/config/test/projectConfig.test.ts b/config/config/test/projectConfig.test.ts index c41f4bd463..2190a1b701 100644 --- a/config/config/test/projectConfig.test.ts +++ b/config/config/test/projectConfig.test.ts @@ -1,4 +1,5 @@ import { omit } from 'ramda' + import type { Config, ProjectConfig, diff --git a/config/config/test/transformPath.test.ts b/config/config/test/transformPath.test.ts index f0cace5389..c6a8ec05a5 100644 --- a/config/config/test/transformPath.test.ts +++ b/config/config/test/transformPath.test.ts @@ -1,4 +1,5 @@ import path from 'path' + import type { Config } from '../src/Config.js' import { transformPath, transformPathKeys } from '../src/transformPath.js' diff --git a/config/deps-installer/src/index.ts b/config/deps-installer/src/index.ts index 3ab6c04216..ac5de551d9 100644 --- a/config/deps-installer/src/index.ts +++ b/config/deps-installer/src/index.ts @@ -1,3 +1,3 @@ export { installConfigDeps, type InstallConfigDepsOpts } from './installConfigDeps.js' export { resolveConfigDeps, type ResolveConfigDepsOpts } from './resolveConfigDeps.js' -export { resolvePackageManagerIntegrities, isPackageManagerResolved, type ResolvePackageManagerIntegritiesOpts } from './resolvePackageManagerIntegrities.js' +export { isPackageManagerResolved, resolvePackageManagerIntegrities, type ResolvePackageManagerIntegritiesOpts } from './resolvePackageManagerIntegrities.js' diff --git a/config/deps-installer/src/installConfigDeps.ts b/config/deps-installer/src/installConfigDeps.ts index 501dca4e60..8be62e122f 100644 --- a/config/deps-installer/src/installConfigDeps.ts +++ b/config/deps-installer/src/installConfigDeps.ts @@ -1,9 +1,10 @@ import fs from 'fs' import path from 'path' + import { calcLeafGlobalVirtualStorePath } from '@pnpm/calc-dep-state' import { installingConfigDepsLogger } from '@pnpm/core-loggers' import { PnpmError } from '@pnpm/error' -import { readEnvLockfile, type EnvLockfile } from '@pnpm/lockfile.fs' +import { type EnvLockfile, readEnvLockfile } from '@pnpm/lockfile.fs' import type { StoreController } from '@pnpm/package-store' import { pickRegistryForPackage } from '@pnpm/pick-registry-for-package' import { readModulesDir } from '@pnpm/read-modules-dir' @@ -12,6 +13,7 @@ import type { ConfigDependencies, Registries } from '@pnpm/types' import { rimraf } from '@zkochan/rimraf' import getNpmTarballUrl from 'get-npm-tarball-url' import symlinkDir from 'symlink-dir' + import { migrateConfigDepsToLockfile } from './migrateConfigDeps.js' import type { NormalizedConfigDep } from './parseIntegrity.js' diff --git a/config/deps-installer/src/migrateConfigDeps.ts b/config/deps-installer/src/migrateConfigDeps.ts index c17698d314..001f462d54 100644 --- a/config/deps-installer/src/migrateConfigDeps.ts +++ b/config/deps-installer/src/migrateConfigDeps.ts @@ -1,10 +1,11 @@ -import { PnpmError } from '@pnpm/error' import { writeSettings } from '@pnpm/config.config-writer' +import { PnpmError } from '@pnpm/error' import { createEnvLockfile, writeEnvLockfile } from '@pnpm/lockfile.fs' import { toLockfileResolution } from '@pnpm/lockfile.utils' import { pickRegistryForPackage } from '@pnpm/pick-registry-for-package' import type { ConfigDependencies, ConfigDependencySpecifiers, Registries } from '@pnpm/types' import getNpmTarballUrl from 'get-npm-tarball-url' + import type { NormalizedConfigDep } from './parseIntegrity.js' import { parseIntegrity } from './parseIntegrity.js' diff --git a/config/deps-installer/src/resolveConfigDeps.ts b/config/deps-installer/src/resolveConfigDeps.ts index c0e0f220aa..14c3b2dcce 100644 --- a/config/deps-installer/src/resolveConfigDeps.ts +++ b/config/deps-installer/src/resolveConfigDeps.ts @@ -1,18 +1,19 @@ -import { PnpmError } from '@pnpm/error' import { writeSettings } from '@pnpm/config.config-writer' +import { PnpmError } from '@pnpm/error' import { createFetchFromRegistry, type CreateFetchFromRegistryOptions } from '@pnpm/fetch' import { - type EnvLockfile, createEnvLockfile, + type EnvLockfile, readEnvLockfile, writeEnvLockfile, } from '@pnpm/lockfile.fs' import { toLockfileResolution } from '@pnpm/lockfile.utils' -import { createNpmResolver, type ResolverFactoryOptions } from '@pnpm/npm-resolver' import { createGetAuthHeaderByURI } from '@pnpm/network.auth-header' +import { createNpmResolver, type ResolverFactoryOptions } from '@pnpm/npm-resolver' import { parseWantedDependency } from '@pnpm/parse-wanted-dependency' -import type { ConfigDependencies, ConfigDependencySpecifiers } from '@pnpm/types' import { pickRegistryForPackage } from '@pnpm/pick-registry-for-package' +import type { ConfigDependencies, ConfigDependencySpecifiers } from '@pnpm/types' + import { installConfigDeps, type InstallConfigDepsOpts } from './installConfigDeps.js' export type ResolveConfigDepsOpts = CreateFetchFromRegistryOptions & ResolverFactoryOptions & InstallConfigDepsOpts & { diff --git a/config/deps-installer/src/resolveManifestDependencies.ts b/config/deps-installer/src/resolveManifestDependencies.ts index c4a5687387..086e6224ea 100644 --- a/config/deps-installer/src/resolveManifestDependencies.ts +++ b/config/deps-installer/src/resolveManifestDependencies.ts @@ -1,14 +1,15 @@ import path from 'path' + import { LOCKFILE_VERSION } from '@pnpm/constants' +import type { + LockfileObject, + ProjectSnapshot, +} from '@pnpm/lockfile.types' import { getWantedDependencies, resolveDependencies, } from '@pnpm/resolve-dependencies' import type { StoreController } from '@pnpm/store-controller-types' -import type { - LockfileObject, - ProjectSnapshot, -} from '@pnpm/lockfile.types' import type { ProjectId, ProjectManifest, diff --git a/config/deps-installer/src/resolvePackageManagerIntegrities.ts b/config/deps-installer/src/resolvePackageManagerIntegrities.ts index efc74070e5..ea55c857b8 100644 --- a/config/deps-installer/src/resolvePackageManagerIntegrities.ts +++ b/config/deps-installer/src/resolvePackageManagerIntegrities.ts @@ -1,8 +1,9 @@ -import { convertToLockfileFile, convertToLockfileObject, readEnvLockfile, writeEnvLockfile, createEnvLockfile } from '@pnpm/lockfile.fs' +import { convertToLockfileFile, convertToLockfileObject, createEnvLockfile, readEnvLockfile, writeEnvLockfile } from '@pnpm/lockfile.fs' import { pruneSharedLockfile } from '@pnpm/lockfile.pruner' import type { EnvLockfile } from '@pnpm/lockfile.types' import type { StoreController } from '@pnpm/package-store' import type { DepPath, ProjectId, Registries } from '@pnpm/types' + import { resolveManifestDependencies } from './resolveManifestDependencies.js' export interface ResolvePackageManagerIntegritiesOpts { diff --git a/config/deps-installer/test/installConfigDeps.ts b/config/deps-installer/test/installConfigDeps.ts index c5d022aaf3..806a6c0ed7 100644 --- a/config/deps-installer/test/installConfigDeps.ts +++ b/config/deps-installer/test/installConfigDeps.ts @@ -1,4 +1,5 @@ import fs from 'fs' + import { installConfigDeps } from '@pnpm/config.deps-installer' import { createEnvLockfile, type EnvLockfile } from '@pnpm/lockfile.fs' import { prepareEmpty } from '@pnpm/prepare' diff --git a/config/deps-installer/test/resolveConfigDeps.test.ts b/config/deps-installer/test/resolveConfigDeps.test.ts index c9c5fd371d..e5ecad4d0c 100644 --- a/config/deps-installer/test/resolveConfigDeps.test.ts +++ b/config/deps-installer/test/resolveConfigDeps.test.ts @@ -1,4 +1,5 @@ import path from 'path' + import { resolveConfigDeps } from '@pnpm/config.deps-installer' import { readEnvLockfile } from '@pnpm/lockfile.fs' import { prepareEmpty } from '@pnpm/prepare' diff --git a/config/package-is-installable/src/index.ts b/config/package-is-installable/src/index.ts index 3cfcfc954c..00fa3827da 100644 --- a/config/package-is-installable/src/index.ts +++ b/config/package-is-installable/src/index.ts @@ -3,9 +3,10 @@ import { skippedOptionalDependencyLogger, } from '@pnpm/core-loggers' import { getSystemNodeVersion } from '@pnpm/env.system-node-version' +import type { SupportedArchitectures } from '@pnpm/types' + import { checkEngine, UnsupportedEngineError, type WantedEngine } from './checkEngine.js' import { checkPlatform, UnsupportedPlatformError } from './checkPlatform.js' -import type { SupportedArchitectures } from '@pnpm/types' export type { Engine } from './checkEngine.js' export type { Platform, WantedPlatform } from './checkPlatform.js' diff --git a/config/parse-overrides/src/index.ts b/config/parse-overrides/src/index.ts index fb5ffd2fd4..87660ba114 100644 --- a/config/parse-overrides/src/index.ts +++ b/config/parse-overrides/src/index.ts @@ -1,7 +1,7 @@ -import { PnpmError } from '@pnpm/error' -import { parseWantedDependency } from '@pnpm/parse-wanted-dependency' import { matchCatalogResolveResult, resolveFromCatalog } from '@pnpm/catalogs.resolver' import type { Catalogs } from '@pnpm/catalogs.types' +import { PnpmError } from '@pnpm/error' +import { parseWantedDependency } from '@pnpm/parse-wanted-dependency' const DELIMITER_REGEX = /[^ |@]>/ diff --git a/config/plugin-commands-config/src/config.ts b/config/plugin-commands-config/src/config.ts index 045acb0a37..85e4727498 100644 --- a/config/plugin-commands-config/src/config.ts +++ b/config/plugin-commands-config/src/config.ts @@ -1,10 +1,11 @@ import { docsUrl } from '@pnpm/cli-utils' import { PnpmError } from '@pnpm/error' import { renderHelp } from 'render-help' -import { configGet } from './configGet.js' -import { configSet } from './configSet.js' -import { configList } from './configList.js' + import type { ConfigCommandOptions } from './ConfigCommandOptions.js' +import { configGet } from './configGet.js' +import { configList } from './configList.js' +import { configSet } from './configSet.js' export function rcOptionsTypes (): Record { return {} diff --git a/config/plugin-commands-config/src/configGet.ts b/config/plugin-commands-config/src/configGet.ts index 89a8b0e6ff..3c325b83b0 100644 --- a/config/plugin-commands-config/src/configGet.ts +++ b/config/plugin-commands-config/src/configGet.ts @@ -1,12 +1,14 @@ import path from 'path' -import kebabCase from 'lodash.kebabcase' + import { types } from '@pnpm/config' import { isCamelCase, isStrictlyKebabCase } from '@pnpm/naming-cases' import { getObjectValueByPropertyPath } from '@pnpm/object.property-path' import { runNpm } from '@pnpm/run-npm' +import kebabCase from 'lodash.kebabcase' + import type { ConfigCommandOptions } from './ConfigCommandOptions.js' -import { processConfig } from './processConfig.js' import { parseConfigPropertyPath } from './parseConfigPropertyPath.js' +import { processConfig } from './processConfig.js' import { settingShouldFallBackToNpm } from './settingShouldFallBackToNpm.js' export function configGet (opts: ConfigCommandOptions, key: string): { output: string, exitCode: number } { diff --git a/config/plugin-commands-config/src/configList.ts b/config/plugin-commands-config/src/configList.ts index 019470f8c9..07f0749a67 100644 --- a/config/plugin-commands-config/src/configList.ts +++ b/config/plugin-commands-config/src/configList.ts @@ -1,5 +1,5 @@ -import { processConfig } from './processConfig.js' import type { ConfigCommandOptions } from './ConfigCommandOptions.js' +import { processConfig } from './processConfig.js' export type ConfigListOptions = Pick diff --git a/config/plugin-commands-config/src/configSet.ts b/config/plugin-commands-config/src/configSet.ts index cfb08f56bc..8ac783a3c7 100644 --- a/config/plugin-commands-config/src/configSet.ts +++ b/config/plugin-commands-config/src/configSet.ts @@ -1,16 +1,18 @@ import path from 'path' import util from 'util' -import { type ConfigFileKey, types, isConfigFileKey } from '@pnpm/config' + +import { type ConfigFileKey, isConfigFileKey, types } from '@pnpm/config' import { GLOBAL_CONFIG_YAML_FILENAME, WORKSPACE_MANIFEST_FILENAME } from '@pnpm/constants' import { PnpmError } from '@pnpm/error' import { isCamelCase, isStrictlyKebabCase } from '@pnpm/naming-cases' import { parsePropertyPath } from '@pnpm/object.property-path' -import { type RunNPMOptions, runNpm } from '@pnpm/run-npm' +import { runNpm, type RunNPMOptions } from '@pnpm/run-npm' import { updateWorkspaceManifest } from '@pnpm/workspace.manifest-writer' import camelCase from 'camelcase' import kebabCase from 'lodash.kebabcase' import { readIniFile } from 'read-ini-file' import { writeIniFile } from 'write-ini-file' + import type { ConfigCommandOptions } from './ConfigCommandOptions.js' import { getConfigFileInfo } from './getConfigFileInfo.js' import { settingShouldFallBackToNpm } from './settingShouldFallBackToNpm.js' diff --git a/config/plugin-commands-config/src/getConfigFileInfo.ts b/config/plugin-commands-config/src/getConfigFileInfo.ts index 87527b8a3c..76af2d8369 100644 --- a/config/plugin-commands-config/src/getConfigFileInfo.ts +++ b/config/plugin-commands-config/src/getConfigFileInfo.ts @@ -1,6 +1,7 @@ -import kebabCase from 'lodash.kebabcase' import { isIniConfigKey } from '@pnpm/config' import { GLOBAL_CONFIG_YAML_FILENAME, WORKSPACE_MANIFEST_FILENAME } from '@pnpm/constants' +import kebabCase from 'lodash.kebabcase' + import type { ConfigCommandOptions } from './ConfigCommandOptions.js' export type ConfigFileName = diff --git a/config/plugin-commands-config/src/parseConfigPropertyPath.ts b/config/plugin-commands-config/src/parseConfigPropertyPath.ts index 19c7fd137e..c5b378ae73 100644 --- a/config/plugin-commands-config/src/parseConfigPropertyPath.ts +++ b/config/plugin-commands-config/src/parseConfigPropertyPath.ts @@ -1,6 +1,6 @@ -import kebabCase from 'lodash.kebabcase' import { types } from '@pnpm/config' import { parsePropertyPath } from '@pnpm/object.property-path' +import kebabCase from 'lodash.kebabcase' /** * Just like {@link parsePropertyPath} but the first element may be converted into kebab-case diff --git a/config/plugin-commands-config/src/processConfig.ts b/config/plugin-commands-config/src/processConfig.ts index 3acc48e409..96085057c4 100644 --- a/config/plugin-commands-config/src/processConfig.ts +++ b/config/plugin-commands-config/src/processConfig.ts @@ -1,5 +1,6 @@ -import camelcase from 'camelcase' import { sortDirectKeys } from '@pnpm/object.key-sorting' +import camelcase from 'camelcase' + import { censorProtectedSettings } from './protectedSettings.js' const shouldChangeCase = (key: string): boolean => key[0] !== '@' && !key.startsWith('//') diff --git a/config/plugin-commands-config/test/configDelete.test.ts b/config/plugin-commands-config/test/configDelete.test.ts index 3b96023c02..e85300c399 100644 --- a/config/plugin-commands-config/test/configDelete.test.ts +++ b/config/plugin-commands-config/test/configDelete.test.ts @@ -1,7 +1,8 @@ import fs from 'fs' import path from 'path' -import { tempDir } from '@pnpm/prepare' + import { config } from '@pnpm/plugin-commands-config' +import { tempDir } from '@pnpm/prepare' import { readIniFileSync } from 'read-ini-file' import { readYamlFileSync } from 'read-yaml-file' import { writeYamlFileSync } from 'write-yaml-file' diff --git a/config/plugin-commands-config/test/configGet.test.ts b/config/plugin-commands-config/test/configGet.test.ts index 424f72c605..49fb7ad775 100644 --- a/config/plugin-commands-config/test/configGet.test.ts +++ b/config/plugin-commands-config/test/configGet.test.ts @@ -1,5 +1,7 @@ import path from 'path' + import { config } from '@pnpm/plugin-commands-config' + import { getOutputString } from './utils/index.js' test('config get', async () => { diff --git a/config/plugin-commands-config/test/configList.test.ts b/config/plugin-commands-config/test/configList.test.ts index 0958e21c9d..987577653e 100644 --- a/config/plugin-commands-config/test/configList.test.ts +++ b/config/plugin-commands-config/test/configList.test.ts @@ -1,4 +1,5 @@ import { config } from '@pnpm/plugin-commands-config' + import { getOutputString } from './utils/index.js' test('config list', async () => { diff --git a/config/plugin-commands-config/test/configSet.test.ts b/config/plugin-commands-config/test/configSet.test.ts index bca61d26b2..eaaea5419d 100644 --- a/config/plugin-commands-config/test/configSet.test.ts +++ b/config/plugin-commands-config/test/configSet.test.ts @@ -1,10 +1,12 @@ import fs from 'fs' import path from 'path' + import { PnpmError } from '@pnpm/error' -import { tempDir } from '@pnpm/prepare' import { config } from '@pnpm/plugin-commands-config' +import { tempDir } from '@pnpm/prepare' import { readIniFileSync } from 'read-ini-file' import { readYamlFileSync } from 'read-yaml-file' + import { type ConfigFilesData, readConfigFiles, writeConfigFiles } from './utils/index.js' test('config set registry setting using the global option', async () => { diff --git a/config/plugin-commands-config/test/utils/index.ts b/config/plugin-commands-config/test/utils/index.ts index 2324d46db7..98b87e7ba6 100644 --- a/config/plugin-commands-config/test/utils/index.ts +++ b/config/plugin-commands-config/test/utils/index.ts @@ -1,9 +1,11 @@ import fs from 'fs' import path from 'path' + import { readIniFileSync } from 'read-ini-file' -import { writeIniFileSync } from 'write-ini-file' import { readYamlFileSync } from 'read-yaml-file' +import { writeIniFileSync } from 'write-ini-file' import { writeYamlFileSync } from 'write-yaml-file' + import type { config } from '../../src/index.js' export function getOutputString (result: config.ConfigHandlerResult): string { diff --git a/crypto/hash/src/index.ts b/crypto/hash/src/index.ts index b32df0c211..2ad0b95e74 100644 --- a/crypto/hash/src/index.ts +++ b/crypto/hash/src/index.ts @@ -1,5 +1,6 @@ import crypto from 'crypto' import fs from 'fs' + import gfs from '@pnpm/graceful-fs' import ssri from 'ssri' diff --git a/crypto/hash/test/index.ts b/crypto/hash/test/index.ts index be67072e4b..a7820edf69 100644 --- a/crypto/hash/test/index.ts +++ b/crypto/hash/test/index.ts @@ -1,8 +1,9 @@ /// -import fs from 'fs' -import { createShortHash, createHashFromFile, getTarballIntegrity } from '@pnpm/crypto.hash' -import { tempDir } from '@pnpm/prepare' import { pipeline } from 'node:stream/promises' +import fs from 'fs' + +import { createHashFromFile, createShortHash, getTarballIntegrity } from '@pnpm/crypto.hash' +import { tempDir } from '@pnpm/prepare' import tar from 'tar-stream' test('createShortHash()', () => { diff --git a/crypto/object-hasher/src/index.ts b/crypto/object-hasher/src/index.ts index 10caf9de66..4939edee6a 100644 --- a/crypto/object-hasher/src/index.ts +++ b/crypto/object-hasher/src/index.ts @@ -1,9 +1,8 @@ -import { isEmpty } from 'ramda' - // We use object-hash even though node-object-hash is faster. // Unlike node-object-hash, object-hash is streaming the hash updates, // avoiding "Invalid string length" errors. import hash from 'object-hash' +import { isEmpty } from 'ramda' const defaultOptions: hash.NormalOption = { respectType: false, diff --git a/crypto/object-hasher/test/index.ts b/crypto/object-hasher/test/index.ts index ab6079130a..2ec06510f3 100644 --- a/crypto/object-hasher/test/index.ts +++ b/crypto/object-hasher/test/index.ts @@ -1,4 +1,4 @@ -import { hashObject, hashObjectWithoutSorting, hashObjectNullableWithPrefix } from '@pnpm/crypto.object-hasher' +import { hashObject, hashObjectNullableWithPrefix, hashObjectWithoutSorting } from '@pnpm/crypto.object-hasher' describe('hashObject', () => { const hash = hashObject diff --git a/dedupe/check/src/dedupeDiffCheck.ts b/dedupe/check/src/dedupeDiffCheck.ts index a55a7dec17..f9ddb25d27 100644 --- a/dedupe/check/src/dedupeDiffCheck.ts +++ b/dedupe/check/src/dedupeDiffCheck.ts @@ -1,10 +1,11 @@ -import type { ResolvedDependencies, LockfileObject } from '@pnpm/lockfile.types' import type { - ResolutionChangesByAlias, DedupeCheckIssues, + ResolutionChangesByAlias, SnapshotsChanges, } from '@pnpm/dedupe.types' -import { type DepPath, DEPENDENCIES_FIELDS } from '@pnpm/types' +import type { LockfileObject, ResolvedDependencies } from '@pnpm/lockfile.types' +import { DEPENDENCIES_FIELDS, type DepPath } from '@pnpm/types' + import { DedupeCheckIssuesError } from './DedupeCheckIssuesError.js' const PACKAGE_SNAPSHOT_DEP_FIELDS = ['dependencies', 'optionalDependencies'] as const diff --git a/dedupe/check/src/index.ts b/dedupe/check/src/index.ts index 880b78174b..6061806e03 100644 --- a/dedupe/check/src/index.ts +++ b/dedupe/check/src/index.ts @@ -1,2 +1,2 @@ -export { dedupeDiffCheck, countChangedSnapshots } from './dedupeDiffCheck.js' export { DedupeCheckIssuesError } from './DedupeCheckIssuesError.js' +export { countChangedSnapshots, dedupeDiffCheck } from './dedupeDiffCheck.js' diff --git a/dedupe/issues-renderer/src/index.ts b/dedupe/issues-renderer/src/index.ts index c786641353..36f3070f7c 100644 --- a/dedupe/issues-renderer/src/index.ts +++ b/dedupe/issues-renderer/src/index.ts @@ -1,6 +1,6 @@ import type { - ResolutionChange, DedupeCheckIssues, + ResolutionChange, ResolutionChangesByAlias, SnapshotsChanges, } from '@pnpm/dedupe.types' diff --git a/dedupe/issues-renderer/test/index.ts b/dedupe/issues-renderer/test/index.ts index c6249cc440..a0b922c6ac 100644 --- a/dedupe/issues-renderer/test/index.ts +++ b/dedupe/issues-renderer/test/index.ts @@ -1,6 +1,7 @@ -import { renderDedupeCheckIssues } from '@pnpm/dedupe.issues-renderer' import { stripVTControlCharacters as stripAnsi } from 'util' +import { renderDedupeCheckIssues } from '@pnpm/dedupe.issues-renderer' + describe('renderDedupeCheckIssues', () => { test('prints removed packages and updated resolutions', () => { expect(stripAnsi(renderDedupeCheckIssues({ diff --git a/deps/graph-builder/src/iteratePkgsForVirtualStore.ts b/deps/graph-builder/src/iteratePkgsForVirtualStore.ts index 6c2caff9d5..376c7005c6 100644 --- a/deps/graph-builder/src/iteratePkgsForVirtualStore.ts +++ b/deps/graph-builder/src/iteratePkgsForVirtualStore.ts @@ -1,20 +1,21 @@ import path from 'path' + import { + calcGraphNodeHash, + type DepsGraph, + type DepsStateCache, + type HashedDepPath, iterateHashedGraphNodes, iteratePkgMeta, lockfileToDepGraph, - calcGraphNodeHash, type PkgMetaAndSnapshot, - type DepsGraph, - type HashedDepPath, - type DepsStateCache, } from '@pnpm/calc-dep-state' +import * as dp from '@pnpm/dependency-path' import type { LockfileObject } from '@pnpm/lockfile.fs' import { nameVerFromPkgSnapshot, } from '@pnpm/lockfile.utils' import type { AllowBuild, DepPath } from '@pnpm/types' -import * as dp from '@pnpm/dependency-path' interface PkgSnapshotWithLocation { pkgMeta: PkgMetaAndSnapshot diff --git a/deps/graph-builder/src/lockfileToDepGraph.ts b/deps/graph-builder/src/lockfileToDepGraph.ts index 80bfa5a61d..9a205e370c 100644 --- a/deps/graph-builder/src/lockfileToDepGraph.ts +++ b/deps/graph-builder/src/lockfileToDepGraph.ts @@ -1,10 +1,12 @@ import fs from 'fs' import path from 'path' + import { WANTED_LOCKFILE } from '@pnpm/constants' import { progressLogger, } from '@pnpm/core-loggers' -import type { LockfileResolution, LockfileObject } from '@pnpm/lockfile.fs' +import * as dp from '@pnpm/dependency-path' +import type { LockfileObject, LockfileResolution } from '@pnpm/lockfile.fs' import { packageIdFromSnapshot, pkgSnapshotToResolution, @@ -12,24 +14,24 @@ import { import { logger } from '@pnpm/logger' import type { IncludedDependencies } from '@pnpm/modules-yaml' import { packageIsInstallable } from '@pnpm/package-is-installable' -import { type PatchGroupRecord, getPatchInfo } from '@pnpm/patching.config' +import { getPatchInfo, type PatchGroupRecord } from '@pnpm/patching.config' import type { PatchInfo } from '@pnpm/patching.types' import type { - DepPath, - SupportedArchitectures, - Registries, - PkgIdWithPatchHash, - ProjectId, - AllowBuild, -} from '@pnpm/types' -import type { - PkgRequestFetchResult, FetchResponse, + PkgRequestFetchResult, StoreController, } from '@pnpm/store-controller-types' -import * as dp from '@pnpm/dependency-path' +import type { + AllowBuild, + DepPath, + PkgIdWithPatchHash, + ProjectId, + Registries, + SupportedArchitectures, +} from '@pnpm/types' import { pathExists } from 'path-exists' import { equals, isEmpty } from 'ramda' + import { iteratePkgsForVirtualStore } from './iteratePkgsForVirtualStore.js' const brokenModulesLogger = logger('_broken_node_modules') diff --git a/deps/status/src/checkDepsStatus.ts b/deps/status/src/checkDepsStatus.ts index ea5d22a000..5401e67c78 100644 --- a/deps/status/src/checkDepsStatus.ts +++ b/deps/status/src/checkDepsStatus.ts @@ -1,15 +1,15 @@ import fs from 'fs' import path from 'path' import util from 'util' -import { equals, isEmpty, filter, once } from 'ramda' -import { type Config, type OptionsFromRootManifest, getOptionsFromRootManifest } from '@pnpm/config' + +import { type Config, getOptionsFromRootManifest, type OptionsFromRootManifest } from '@pnpm/config' import { MANIFEST_BASE_NAMES, WANTED_LOCKFILE } from '@pnpm/constants' import { hashObjectNullableWithPrefix } from '@pnpm/crypto.object-hasher' import { PnpmError } from '@pnpm/error' import { arrayOfWorkspacePackagesToMap } from '@pnpm/get-context' import { - type LockfileObject, getLockfileImporterId, + type LockfileObject, readCurrentLockfile, readWantedLockfile, } from '@pnpm/lockfile.fs' @@ -19,8 +19,8 @@ import { getOutdatedLockfileSetting, } from '@pnpm/lockfile.settings-checker' import { - linkedPackagesAreUpToDate, getWorkspacePackagesByDirectory, + linkedPackagesAreUpToDate, satisfiesPackageManifest, } from '@pnpm/lockfile.verification' import { globalWarn, logger } from '@pnpm/logger' @@ -34,7 +34,9 @@ import type { } from '@pnpm/types' import { findWorkspacePackages } from '@pnpm/workspace.find-packages' import { readWorkspaceManifest } from '@pnpm/workspace.read-manifest' -import { type WorkspaceState, type WorkspaceStateSettings, loadWorkspaceState, updateWorkspaceState } from '@pnpm/workspace.state' +import { loadWorkspaceState, updateWorkspaceState, type WorkspaceState, type WorkspaceStateSettings } from '@pnpm/workspace.state' +import { equals, filter, isEmpty, once } from 'ramda' + import { assertLockfilesEqual } from './assertLockfilesEqual.js' import { safeStat, safeStatSync } from './safeStat.js' import { statManifestFile } from './statManifestFile.js' diff --git a/deps/status/src/index.ts b/deps/status/src/index.ts index 0b1b7196e4..eba75bf21f 100644 --- a/deps/status/src/index.ts +++ b/deps/status/src/index.ts @@ -1,2 +1,2 @@ +export { checkDepsStatus, type CheckDepsStatusOptions, type CheckDepsStatusResult } from './checkDepsStatus.js' export { type WorkspaceStateSettings } from '@pnpm/workspace.state' -export { type CheckDepsStatusOptions, type CheckDepsStatusResult, checkDepsStatus } from './checkDepsStatus.js' diff --git a/deps/status/src/statManifestFile.ts b/deps/status/src/statManifestFile.ts index 5bbe9aa88e..af6f4c54af 100644 --- a/deps/status/src/statManifestFile.ts +++ b/deps/status/src/statManifestFile.ts @@ -1,6 +1,8 @@ import type fs from 'fs' import path from 'path' + import { MANIFEST_BASE_NAMES } from '@pnpm/constants' + import { safeStat } from './safeStat.js' export async function statManifestFile (projectRootDir: string): Promise { diff --git a/deps/status/test/assertLockfilesEqual.test.ts b/deps/status/test/assertLockfilesEqual.test.ts index 45b6e5f6e5..4260c73597 100644 --- a/deps/status/test/assertLockfilesEqual.test.ts +++ b/deps/status/test/assertLockfilesEqual.test.ts @@ -1,6 +1,7 @@ import { LOCKFILE_VERSION } from '@pnpm/constants' import type { LockfileObject } from '@pnpm/lockfile.fs' import type { ProjectId } from '@pnpm/types' + import { assertLockfilesEqual } from '../src/assertLockfilesEqual.js' test('if wantedLockfile does not have any specifier, currentLockfile is allowed to be null', () => { diff --git a/deps/status/test/checkDepsStatus.test.ts b/deps/status/test/checkDepsStatus.test.ts index c36bf51ede..919ee9e086 100644 --- a/deps/status/test/checkDepsStatus.test.ts +++ b/deps/status/test/checkDepsStatus.test.ts @@ -1,8 +1,9 @@ import type { Stats } from 'fs' -import type { CheckDepsStatusOptions } from '@pnpm/deps.status' -import type { WorkspaceState } from '@pnpm/workspace.state' + import { jest } from '@jest/globals' +import type { CheckDepsStatusOptions } from '@pnpm/deps.status' import type { LockfileObject } from '@pnpm/lockfile.fs' +import type { WorkspaceState } from '@pnpm/workspace.state' { const original = await import('@pnpm/workspace.state') diff --git a/deps/status/test/statManifestFile.test.ts b/deps/status/test/statManifestFile.test.ts index 428382e718..231a644ef5 100644 --- a/deps/status/test/statManifestFile.test.ts +++ b/deps/status/test/statManifestFile.test.ts @@ -1,6 +1,7 @@ import { MANIFEST_BASE_NAMES } from '@pnpm/constants' import { prepareEmpty } from '@pnpm/prepare' import { writeProjectManifest } from '@pnpm/write-project-manifest' + import { statManifestFile } from '../src/statManifestFile.js' test.each(MANIFEST_BASE_NAMES)('load %s', async baseName => { diff --git a/env/node.fetcher/src/index.ts b/env/node.fetcher/src/index.ts index 22789d9bdd..a794156899 100644 --- a/env/node.fetcher/src/index.ts +++ b/env/node.fetcher/src/index.ts @@ -1,19 +1,20 @@ import path from 'path' + +import type { Cafs } from '@pnpm/cafs-types' +import { createCafsStore } from '@pnpm/create-cafs-store' import { fetchShasumsFileRaw, pickFileChecksumFromShasumsFile } from '@pnpm/crypto.shasums-file' +import { downloadAndUnpackZip } from '@pnpm/fetching.binary-fetcher' import type { FetchFromRegistry, RetryTimeoutOptions, } from '@pnpm/fetching-types' -import { createCafsStore } from '@pnpm/create-cafs-store' -import type { Cafs } from '@pnpm/cafs-types' -import type { StoreIndex } from '@pnpm/store.index' -import { createTarballFetcher } from '@pnpm/tarball-fetcher' import { - getNodeArtifactAddress, DEFAULT_NODE_MIRROR_BASE_URL, + getNodeArtifactAddress, UNOFFICIAL_NODE_MIRROR_BASE_URL, } from '@pnpm/node.resolver' -import { downloadAndUnpackZip } from '@pnpm/fetching.binary-fetcher' +import type { StoreIndex } from '@pnpm/store.index' +import { createTarballFetcher } from '@pnpm/tarball-fetcher' import { isNonGlibcLinux } from 'detect-libc' export interface FetchNodeOptionsToDir { diff --git a/env/node.fetcher/test/node.test.ts b/env/node.fetcher/test/node.test.ts index 1598cd36d0..87258a45f3 100644 --- a/env/node.fetcher/test/node.test.ts +++ b/env/node.fetcher/test/node.test.ts @@ -1,11 +1,12 @@ -import AdmZip from 'adm-zip' -import { Response } from 'node-fetch' import path from 'path' import { Readable } from 'stream' -import type { FetchNodeOptionsToDir as FetchNodeOptions } from '@pnpm/node.fetcher' -import { StoreIndex } from '@pnpm/store.index' -import { tempDir } from '@pnpm/prepare' + import { jest } from '@jest/globals' +import type { FetchNodeOptionsToDir as FetchNodeOptions } from '@pnpm/node.fetcher' +import { tempDir } from '@pnpm/prepare' +import { StoreIndex } from '@pnpm/store.index' +import AdmZip from 'adm-zip' +import { Response } from 'node-fetch' jest.unstable_mockModule('detect-libc', () => ({ isNonGlibcLinux: jest.fn(), diff --git a/env/node.resolver/src/index.ts b/env/node.resolver/src/index.ts index 06cbabb3b9..d02e7a7621 100644 --- a/env/node.resolver/src/index.ts +++ b/env/node.resolver/src/index.ts @@ -11,14 +11,15 @@ import type { VariationsResolution, WantedDependency, } from '@pnpm/resolver-base' +import type { PkgResolutionId } from '@pnpm/types' import semver from 'semver' import versionSelectorType from 'version-selector-type' -import type { PkgResolutionId } from '@pnpm/types' -import { parseNodeSpecifier } from './parseNodeSpecifier.js' -import { getNodeMirror } from './getNodeMirror.js' -import { getNodeArtifactAddress } from './getNodeArtifactAddress.js' -export { getNodeMirror, parseNodeSpecifier, getNodeArtifactAddress } +import { getNodeArtifactAddress } from './getNodeArtifactAddress.js' +import { getNodeMirror } from './getNodeMirror.js' +import { parseNodeSpecifier } from './parseNodeSpecifier.js' + +export { getNodeArtifactAddress, getNodeMirror, parseNodeSpecifier } export const DEFAULT_NODE_MIRROR_BASE_URL = 'https://nodejs.org/download/release/' export const UNOFFICIAL_NODE_MIRROR_BASE_URL = 'https://unofficial-builds.nodejs.org/download/release/' diff --git a/env/path/src/index.ts b/env/path/src/index.ts index ae950b1d0c..541563aa5d 100644 --- a/env/path/src/index.ts +++ b/env/path/src/index.ts @@ -1,4 +1,5 @@ import path from 'path' + import PATH from 'path-name' export interface PrependDirsToPathResult { diff --git a/env/path/test/index.ts b/env/path/test/index.ts index 7e1d665c74..3b01a41c36 100644 --- a/env/path/test/index.ts +++ b/env/path/test/index.ts @@ -1,4 +1,5 @@ import path from 'path' + import { prependDirsToPath } from '@pnpm/env.path' import PATH from 'path-name' diff --git a/env/plugin-commands-env/src/env.ts b/env/plugin-commands-env/src/env.ts index d1614afecd..b477bb531a 100644 --- a/env/plugin-commands-env/src/env.ts +++ b/env/plugin-commands-env/src/env.ts @@ -1,6 +1,7 @@ import { docsUrl } from '@pnpm/cli-utils' import { PnpmError } from '@pnpm/error' import { renderHelp } from 'render-help' + import { envList } from './envList.js' import { envUse } from './envUse.js' import type { NvmNodeCommandOptions } from './node.js' diff --git a/env/plugin-commands-env/src/envList.ts b/env/plugin-commands-env/src/envList.ts index 719229bffc..c2fcf02a11 100644 --- a/env/plugin-commands-env/src/envList.ts +++ b/env/plugin-commands-env/src/envList.ts @@ -1,5 +1,6 @@ import { createFetchFromRegistry } from '@pnpm/fetch' -import { resolveNodeVersions, parseNodeSpecifier, getNodeMirror } from '@pnpm/node.resolver' +import { getNodeMirror, parseNodeSpecifier, resolveNodeVersions } from '@pnpm/node.resolver' + import type { NvmNodeCommandOptions } from './node.js' export async function envList (opts: NvmNodeCommandOptions, params: string[]): Promise { diff --git a/env/plugin-commands-env/src/envUse.ts b/env/plugin-commands-env/src/envUse.ts index 8f37e521cd..352594fb32 100644 --- a/env/plugin-commands-env/src/envUse.ts +++ b/env/plugin-commands-env/src/envUse.ts @@ -1,6 +1,7 @@ import { PnpmError } from '@pnpm/error' import { runPnpmCli } from '@pnpm/exec.pnpm-cli-runner' import { globalWarn } from '@pnpm/logger' + import type { NvmNodeCommandOptions } from './node.js' export async function envUse (opts: NvmNodeCommandOptions, params: string[]): Promise { diff --git a/env/system-node-version/src/index.ts b/env/system-node-version/src/index.ts index 41ebaff719..0bed6704de 100644 --- a/env/system-node-version/src/index.ts +++ b/env/system-node-version/src/index.ts @@ -1,6 +1,6 @@ import { detectIfCurrentPkgIsExecutable } from '@pnpm/cli-meta' -import mem from 'memoize' import * as execa from 'execa' +import mem from 'memoize' export function getSystemNodeVersionNonCached (): string | undefined { if (detectIfCurrentPkgIsExecutable()) { diff --git a/exec/lifecycle/src/index.ts b/exec/lifecycle/src/index.ts index 09de261bc9..a8af1b904d 100644 --- a/exec/lifecycle/src/index.ts +++ b/exec/lifecycle/src/index.ts @@ -1,4 +1,5 @@ import { safeReadPackageJsonFromDir } from '@pnpm/read-package-json' + import { runLifecycleHook, type RunLifecycleHookOptions } from './runLifecycleHook.js' import { runLifecycleHooksConcurrently, type RunLifecycleHooksConcurrentlyOptions } from './runLifecycleHooksConcurrently.js' @@ -10,8 +11,8 @@ export function makeNodeRequireOption (modulePath: string): { NODE_OPTIONS: stri export { runLifecycleHook, - runLifecycleHooksConcurrently, type RunLifecycleHookOptions, + runLifecycleHooksConcurrently, type RunLifecycleHooksConcurrentlyOptions, } diff --git a/exec/lifecycle/src/runLifecycleHook.ts b/exec/lifecycle/src/runLifecycleHook.ts index 7e56d801b3..2fa6bb4b5c 100644 --- a/exec/lifecycle/src/runLifecycleHook.ts +++ b/exec/lifecycle/src/runLifecycleHook.ts @@ -1,10 +1,11 @@ +import { existsSync } from 'fs' import path from 'path' + import { lifecycleLogger } from '@pnpm/core-loggers' +import { PnpmError } from '@pnpm/error' import { globalWarn } from '@pnpm/logger' import lifecycle from '@pnpm/npm-lifecycle' -import type { DependencyManifest, ProjectManifest, PackageScripts } from '@pnpm/types' -import { PnpmError } from '@pnpm/error' -import { existsSync } from 'fs' +import type { DependencyManifest, PackageScripts, ProjectManifest } from '@pnpm/types' import isWindows from 'is-windows' import { join as shellQuote } from 'shlex' diff --git a/exec/lifecycle/src/runLifecycleHooksConcurrently.ts b/exec/lifecycle/src/runLifecycleHooksConcurrently.ts index 1eecd23960..7a8ba0973b 100644 --- a/exec/lifecycle/src/runLifecycleHooksConcurrently.ts +++ b/exec/lifecycle/src/runLifecycleHooksConcurrently.ts @@ -1,12 +1,14 @@ import fs from 'fs' +import path from 'path' + +import type { FilesMap } from '@pnpm/cafs-types' +import { fetchFromDir } from '@pnpm/directory-fetcher' import { linkBins } from '@pnpm/link-bins' import { logger } from '@pnpm/logger' -import path from 'path' -import { fetchFromDir } from '@pnpm/directory-fetcher' -import type { FilesMap } from '@pnpm/cafs-types' import type { StoreController } from '@pnpm/store-controller-types' import type { ProjectManifest, ProjectRootDir } from '@pnpm/types' import { runGroups } from 'run-groups' + import { runLifecycleHook, type RunLifecycleHookOptions } from './runLifecycleHook.js' export type RunLifecycleHooksConcurrentlyOptions = Omit import fs from 'fs' import path from 'path' -import { runLifecycleHook, runLifecycleHooksConcurrently, runPostinstallHooks } from '@pnpm/lifecycle' + import { PnpmError } from '@pnpm/error' -import { createTestIpcServer } from '@pnpm/test-ipc-server' -import { fixtures } from '@pnpm/test-fixtures' +import { runLifecycleHook, runLifecycleHooksConcurrently, runPostinstallHooks } from '@pnpm/lifecycle' import { tempDir } from '@pnpm/prepare' -import type { ProjectRootDir } from '@pnpm/types' import type { StoreController } from '@pnpm/store-controller-types' +import { fixtures } from '@pnpm/test-fixtures' +import { createTestIpcServer } from '@pnpm/test-ipc-server' +import type { ProjectRootDir } from '@pnpm/types' import isWindows from 'is-windows' const skipOnWindows = isWindows() ? test.skip : test diff --git a/exec/plugin-commands-script-runners/src/buildCommandNotFoundHint.ts b/exec/plugin-commands-script-runners/src/buildCommandNotFoundHint.ts index 61f5d16b38..c1ecdc8692 100644 --- a/exec/plugin-commands-script-runners/src/buildCommandNotFoundHint.ts +++ b/exec/plugin-commands-script-runners/src/buildCommandNotFoundHint.ts @@ -1,8 +1,9 @@ -import type { PackageScripts } from '@pnpm/types' -import didYouMean, { ReturnTypeEnums } from 'didyoumean2' import { readdirSync } from 'fs' import path from 'path' +import type { PackageScripts } from '@pnpm/types' +import didYouMean, { ReturnTypeEnums } from 'didyoumean2' + export function getNearestProgram ({ dir, modulesDir, diff --git a/exec/plugin-commands-script-runners/src/create.ts b/exec/plugin-commands-script-runners/src/create.ts index 9a871b53cd..5d7323135e 100644 --- a/exec/plugin-commands-script-runners/src/create.ts +++ b/exec/plugin-commands-script-runners/src/create.ts @@ -1,6 +1,7 @@ -import { renderHelp } from 'render-help' import { docsUrl } from '@pnpm/cli-utils' import { PnpmError } from '@pnpm/error' +import { renderHelp } from 'render-help' + import * as dlx from './dlx.js' export const commandNames = ['create'] diff --git a/exec/plugin-commands-script-runners/src/dlx.ts b/exec/plugin-commands-script-runners/src/dlx.ts index acec63b3d8..4e63946e3a 100644 --- a/exec/plugin-commands-script-runners/src/dlx.ts +++ b/exec/plugin-commands-script-runners/src/dlx.ts @@ -1,28 +1,30 @@ import fs, { type Stats } from 'fs' import path from 'path' import util from 'util' + +import { + type CatalogResolver, + resolveFromCatalog, +} from '@pnpm/catalogs.resolver' import { docsUrl, readProjectManifestOnly } from '@pnpm/cli-utils' import { createResolver } from '@pnpm/client' -import { parseWantedDependency } from '@pnpm/parse-wanted-dependency' import { OUTPUT_OPTIONS } from '@pnpm/common-cli-options-help' import { type Config, types } from '@pnpm/config' import { createPackageVersionPolicy } from '@pnpm/config.version-policy' import { createHexHash } from '@pnpm/crypto.hash' import { PnpmError } from '@pnpm/error' +import { getBinsFromPackageManifest } from '@pnpm/package-bins' +import { parseWantedDependency } from '@pnpm/parse-wanted-dependency' import { add } from '@pnpm/plugin-commands-installation' import { readPackageJsonFromDir } from '@pnpm/read-package-json' -import { getBinsFromPackageManifest } from '@pnpm/package-bins' import type { PackageManifest, PnpmSettings, SupportedArchitectures } from '@pnpm/types' import { lexCompare } from '@pnpm/util.lex-comparator' import { safeExeca as execa } from 'execa' import { pick } from 'ramda' import { renderHelp } from 'render-help' import symlinkDir from 'symlink-dir' + import { makeEnv } from './makeEnv.js' -import { - type CatalogResolver, - resolveFromCatalog, -} from '@pnpm/catalogs.resolver' export const skipPackageManagerCheck = true diff --git a/exec/plugin-commands-script-runners/src/exec.ts b/exec/plugin-commands-script-runners/src/exec.ts index 74218386d5..899c8e9968 100644 --- a/exec/plugin-commands-script-runners/src/exec.ts +++ b/exec/plugin-commands-script-runners/src/exec.ts @@ -1,19 +1,25 @@ import path from 'path' -import { docsUrl, type RecursiveSummary, throwOnCommandFail, readProjectManifestOnly } from '@pnpm/cli-utils' -import { type LifecycleMessage, lifecycleLogger } from '@pnpm/core-loggers' + +import { docsUrl, readProjectManifestOnly, type RecursiveSummary, throwOnCommandFail } from '@pnpm/cli-utils' import { FILTERING, UNIVERSAL_OPTIONS } from '@pnpm/common-cli-options-help' -import { type Config, types, getWorkspaceConcurrency } from '@pnpm/config' +import { type Config, getWorkspaceConcurrency, types } from '@pnpm/config' +import { lifecycleLogger, type LifecycleMessage } from '@pnpm/core-loggers' import type { CheckDepsStatusOptions } from '@pnpm/deps.status' +import { prependDirsToPath } from '@pnpm/env.path' +import { PnpmError } from '@pnpm/error' import { makeNodeRequireOption } from '@pnpm/lifecycle' import { logger } from '@pnpm/logger' import { tryReadProjectManifest } from '@pnpm/read-project-manifest' import { sortPackages } from '@pnpm/sort-packages' -import type { Project, ProjectsGraph, ProjectRootDir, ProjectRootDirRealPath } from '@pnpm/types' +import type { Project, ProjectRootDir, ProjectRootDirRealPath, ProjectsGraph } from '@pnpm/types' import { safeExeca as execa } from 'execa' import pLimit from 'p-limit' -import { prependDirsToPath } from '@pnpm/env.path' import { pick } from 'ramda' import { renderHelp } from 'render-help' +import which from 'which' +import { writeJsonFile } from 'write-json-file' + +import { getNearestProgram, getNearestScript } from './buildCommandNotFoundHint.js' import { existsInDir } from './existsInDir.js' import { makeEnv } from './makeEnv.js' import { @@ -22,10 +28,6 @@ import { RESUME_FROM_OPTION_HELP, shorthands as runShorthands, } from './run.js' -import { PnpmError } from '@pnpm/error' -import which from 'which' -import { writeJsonFile } from 'write-json-file' -import { getNearestProgram, getNearestScript } from './buildCommandNotFoundHint.js' import { runDepsStatusCheck } from './runDepsStatusCheck.js' export const shorthands: Record = { diff --git a/exec/plugin-commands-script-runners/src/makeEnv.ts b/exec/plugin-commands-script-runners/src/makeEnv.ts index 1287d8bde8..29912d8938 100644 --- a/exec/plugin-commands-script-runners/src/makeEnv.ts +++ b/exec/plugin-commands-script-runners/src/makeEnv.ts @@ -1,7 +1,8 @@ -import { PnpmError } from '@pnpm/error' -import { prependDirsToPath } from '@pnpm/env.path' import path from 'path' +import { prependDirsToPath } from '@pnpm/env.path' +import { PnpmError } from '@pnpm/error' + export interface Env extends NodeJS.ProcessEnv { npm_config_user_agent: string PATH?: string diff --git a/exec/plugin-commands-script-runners/src/restart.ts b/exec/plugin-commands-script-runners/src/restart.ts index 7d845a7453..0aac210a36 100644 --- a/exec/plugin-commands-script-runners/src/restart.ts +++ b/exec/plugin-commands-script-runners/src/restart.ts @@ -1,6 +1,7 @@ import { types as allTypes } from '@pnpm/config' import { pick } from 'ramda' import { renderHelp } from 'render-help' + import { handler as run, IF_PRESENT_OPTION, diff --git a/exec/plugin-commands-script-runners/src/run.ts b/exec/plugin-commands-script-runners/src/run.ts index 5db1c98383..eb980391bc 100644 --- a/exec/plugin-commands-script-runners/src/run.ts +++ b/exec/plugin-commands-script-runners/src/run.ts @@ -1,5 +1,5 @@ import path from 'path' -import pLimit from 'p-limit' + import { docsUrl, readProjectManifestOnly, @@ -7,24 +7,26 @@ import { } from '@pnpm/cli-utils' import type { CompletionFunc } from '@pnpm/command' import { FILTERING, UNIVERSAL_OPTIONS } from '@pnpm/common-cli-options-help' -import { type Config, types as allTypes, getWorkspaceConcurrency } from '@pnpm/config' -import { PnpmError } from '@pnpm/error' +import { type Config, getWorkspaceConcurrency, types as allTypes } from '@pnpm/config' import type { CheckDepsStatusOptions } from '@pnpm/deps.status' +import { PnpmError } from '@pnpm/error' import { - runLifecycleHook, makeNodeRequireOption, + runLifecycleHook, type RunLifecycleHookOptions, } from '@pnpm/lifecycle' -import { syncInjectedDeps } from '@pnpm/workspace.injected-deps-syncer' import type { PackageScripts, ProjectManifest } from '@pnpm/types' +import { syncInjectedDeps } from '@pnpm/workspace.injected-deps-syncer' +import pLimit from 'p-limit' import { pick } from 'ramda' import { realpathMissing } from 'realpath-missing' import { renderHelp } from 'render-help' -import { runRecursive, type RecursiveRunOpts, getSpecifiedScripts as getSpecifiedScriptWithoutStartCommand } from './runRecursive.js' -import { existsInDir } from './existsInDir.js' -import { handler as exec } from './exec.js' + import { buildCommandNotFoundHint } from './buildCommandNotFoundHint.js' +import { handler as exec } from './exec.js' +import { existsInDir } from './existsInDir.js' import { runDepsStatusCheck } from './runDepsStatusCheck.js' +import { getSpecifiedScripts as getSpecifiedScriptWithoutStartCommand, type RecursiveRunOpts, runRecursive } from './runRecursive.js' export const IF_PRESENT_OPTION: Record = { 'if-present': Boolean, diff --git a/exec/plugin-commands-script-runners/src/runDepsStatusCheck.ts b/exec/plugin-commands-script-runners/src/runDepsStatusCheck.ts index 4694cc312c..243f379f0b 100644 --- a/exec/plugin-commands-script-runners/src/runDepsStatusCheck.ts +++ b/exec/plugin-commands-script-runners/src/runDepsStatusCheck.ts @@ -1,8 +1,8 @@ import type { VerifyDepsBeforeRun } from '@pnpm/config' +import { checkDepsStatus, type CheckDepsStatusOptions, type WorkspaceStateSettings } from '@pnpm/deps.status' import { PnpmError } from '@pnpm/error' import { runPnpmCli } from '@pnpm/exec.pnpm-cli-runner' import { globalWarn } from '@pnpm/logger' -import { checkDepsStatus, type CheckDepsStatusOptions, type WorkspaceStateSettings } from '@pnpm/deps.status' import enquirer from 'enquirer' export interface RunDepsStatusCheckOptions extends CheckDepsStatusOptions { diff --git a/exec/plugin-commands-script-runners/src/runRecursive.ts b/exec/plugin-commands-script-runners/src/runRecursive.ts index 56ad361c9e..ec5d68079c 100644 --- a/exec/plugin-commands-script-runners/src/runRecursive.ts +++ b/exec/plugin-commands-script-runners/src/runRecursive.ts @@ -1,6 +1,7 @@ import assert from 'assert' import path from 'path' import util from 'util' + import { throwOnCommandFail } from '@pnpm/cli-utils' import { type Config, getWorkspaceConcurrency } from '@pnpm/config' import { PnpmError } from '@pnpm/error' @@ -10,13 +11,14 @@ import { } from '@pnpm/lifecycle' import { groupStart } from '@pnpm/log.group' import { sortPackages } from '@pnpm/sort-packages' +import type { PackageScripts, ProjectRootDir } from '@pnpm/types' import pLimit from 'p-limit' import { realpathMissing } from 'realpath-missing' -import { existsInDir } from './existsInDir.js' + import { createEmptyRecursiveSummary, getExecutionDuration, getResumedPackageChunks, writeRecursiveSummary } from './exec.js' -import { type RunScriptOptions, runScript } from './run.js' +import { existsInDir } from './existsInDir.js' import { tryBuildRegExpFromCommand } from './regexpCommand.js' -import type { PackageScripts, ProjectRootDir } from '@pnpm/types' +import { runScript, type RunScriptOptions } from './run.js' export type RecursiveRunOpts = Pick ({ handler: jest.fn() })) diff --git a/exec/plugin-commands-script-runners/test/dlx.createCacheKey.test.ts b/exec/plugin-commands-script-runners/test/dlx.createCacheKey.test.ts index 2d42f4daac..a44779e710 100644 --- a/exec/plugin-commands-script-runners/test/dlx.createCacheKey.test.ts +++ b/exec/plugin-commands-script-runners/test/dlx.createCacheKey.test.ts @@ -1,4 +1,5 @@ import { createHexHash } from '@pnpm/crypto.hash' + import { createCacheKey } from '../src/dlx.js' test('creates a hash', () => { diff --git a/exec/plugin-commands-script-runners/test/dlx.e2e.ts b/exec/plugin-commands-script-runners/test/dlx.e2e.ts index 08b43f552d..762dfb7bef 100644 --- a/exec/plugin-commands-script-runners/test/dlx.e2e.ts +++ b/exec/plugin-commands-script-runners/test/dlx.e2e.ts @@ -1,7 +1,9 @@ import fs from 'fs' import path from 'path' -import { prepareEmpty } from '@pnpm/prepare' + import { jest } from '@jest/globals' +import { prepareEmpty } from '@pnpm/prepare' + import { DLX_DEFAULT_OPTS as DEFAULT_OPTS } from './utils/index.js' const { getSystemNodeVersion: originalGetSystemNodeVersion } = await import('@pnpm/env.system-node-version') diff --git a/exec/plugin-commands-script-runners/test/dlx.ts b/exec/plugin-commands-script-runners/test/dlx.ts index d5e91c5f31..533f8b1ccc 100644 --- a/exec/plugin-commands-script-runners/test/dlx.ts +++ b/exec/plugin-commands-script-runners/test/dlx.ts @@ -1,6 +1,8 @@ import path from 'path' -import { prepareEmpty } from '@pnpm/prepare' + import { jest } from '@jest/globals' +import { prepareEmpty } from '@pnpm/prepare' + import { DLX_DEFAULT_OPTS as DEFAULT_OPTS } from './utils/index.js' jest.unstable_mockModule('execa', () => ({ diff --git a/exec/plugin-commands-script-runners/test/exec.e2e.ts b/exec/plugin-commands-script-runners/test/exec.e2e.ts index 051ca14eb2..d09fe3c406 100644 --- a/exec/plugin-commands-script-runners/test/exec.e2e.ts +++ b/exec/plugin-commands-script-runners/test/exec.e2e.ts @@ -1,12 +1,14 @@ import fs from 'fs' import path from 'path' + import type { PnpmError } from '@pnpm/error' -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { exec, run } from '@pnpm/plugin-commands-script-runners' import { prepare, prepareEmpty, preparePackages } from '@pnpm/prepare' import { createTestIpcServer } from '@pnpm/test-ipc-server' -import type { ProjectRootDirRealPath, ProjectRootDir } from '@pnpm/types' +import type { ProjectRootDir, ProjectRootDirRealPath } from '@pnpm/types' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { safeExeca as execa } from 'execa' + import { DEFAULT_OPTS, REGISTRY_URL } from './utils/index.js' const pnpmBin = path.join(import.meta.dirname, '../../../pnpm/bin/pnpm.mjs') diff --git a/exec/plugin-commands-script-runners/test/exec.logs.ts b/exec/plugin-commands-script-runners/test/exec.logs.ts index 5cf7eb671f..7a3acb346a 100644 --- a/exec/plugin-commands-script-runners/test/exec.logs.ts +++ b/exec/plugin-commands-script-runners/test/exec.logs.ts @@ -1,8 +1,10 @@ import fs from 'fs' import path from 'path' -import { preparePackages } from '@pnpm/prepare' + import { jest } from '@jest/globals' +import { preparePackages } from '@pnpm/prepare' import { writeYamlFile } from 'write-yaml-file' + import { DEFAULT_OPTS } from './utils/index.js' const debug = jest.fn() diff --git a/exec/plugin-commands-script-runners/test/exec.ts b/exec/plugin-commands-script-runners/test/exec.ts index 18348bdb05..529b57be89 100644 --- a/exec/plugin-commands-script-runners/test/exec.ts +++ b/exec/plugin-commands-script-runners/test/exec.ts @@ -1,5 +1,6 @@ -import { prepareEmpty } from '@pnpm/prepare' import { jest } from '@jest/globals' +import { prepareEmpty } from '@pnpm/prepare' + import { DEFAULT_OPTS } from './utils/index.js' jest.unstable_mockModule('execa', () => ({ diff --git a/exec/plugin-commands-script-runners/test/index.ts b/exec/plugin-commands-script-runners/test/index.ts index eeee3c6c42..4afadde521 100644 --- a/exec/plugin-commands-script-runners/test/index.ts +++ b/exec/plugin-commands-script-runners/test/index.ts @@ -1,17 +1,19 @@ /// import fs from 'fs' import path from 'path' + import type { PnpmError } from '@pnpm/error' -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { restart, run, } from '@pnpm/plugin-commands-script-runners' import { prepare, preparePackages } from '@pnpm/prepare' import { createTestIpcServer } from '@pnpm/test-ipc-server' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { safeExeca as execa } from 'execa' import isWindows from 'is-windows' import { writeYamlFileSync } from 'write-yaml-file' + import { DEFAULT_OPTS, REGISTRY_URL } from './utils/index.js' const pnpmBin = path.join(import.meta.dirname, '../../../pnpm/bin/pnpm.mjs') diff --git a/exec/plugin-commands-script-runners/test/makeEnv.test.ts b/exec/plugin-commands-script-runners/test/makeEnv.test.ts index 3fbc4c61c5..57ae4f48ce 100644 --- a/exec/plugin-commands-script-runners/test/makeEnv.test.ts +++ b/exec/plugin-commands-script-runners/test/makeEnv.test.ts @@ -1,4 +1,5 @@ import path from 'path' + import { makeEnv } from '../src/makeEnv.js' test('makeEnv should fail if prependPaths has a path with a colon', () => { diff --git a/exec/plugin-commands-script-runners/test/runRecursive.ts b/exec/plugin-commands-script-runners/test/runRecursive.ts index 5db25b4cd9..3caeaf9964 100644 --- a/exec/plugin-commands-script-runners/test/runRecursive.ts +++ b/exec/plugin-commands-script-runners/test/runRecursive.ts @@ -1,13 +1,15 @@ import fs from 'fs' import path from 'path' -import { preparePackages } from '@pnpm/prepare' -import { run } from '@pnpm/plugin-commands-script-runners' -import { filterPkgsBySelectorObjects } from '@pnpm/filter-workspace-packages' -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' + import type { PnpmError } from '@pnpm/error' +import { filterPkgsBySelectorObjects } from '@pnpm/filter-workspace-packages' +import { run } from '@pnpm/plugin-commands-script-runners' +import { preparePackages } from '@pnpm/prepare' import { createTestIpcServer } from '@pnpm/test-ipc-server' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { safeExeca as execa } from 'execa' import { writeYamlFileSync } from 'write-yaml-file' + import { DEFAULT_OPTS, REGISTRY_URL } from './utils/index.js' const pnpmBin = path.join(import.meta.dirname, '../../../pnpm/bin/pnpm.mjs') diff --git a/exec/plugin-commands-script-runners/test/testRecursive.ts b/exec/plugin-commands-script-runners/test/testRecursive.ts index b8ed0d4adf..4facfe0780 100644 --- a/exec/plugin-commands-script-runners/test/testRecursive.ts +++ b/exec/plugin-commands-script-runners/test/testRecursive.ts @@ -1,10 +1,12 @@ import path from 'path' + import { filterPkgsBySelectorObjects } from '@pnpm/filter-workspace-packages' -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { run } from '@pnpm/plugin-commands-script-runners' import { preparePackages } from '@pnpm/prepare' import { createTestIpcServer } from '@pnpm/test-ipc-server' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { safeExeca as execa } from 'execa' + import { DEFAULT_OPTS, REGISTRY_URL } from './utils/index.js' const pnpmBin = path.join(import.meta.dirname, '../../../pnpm/bin/pnpm.mjs') diff --git a/exec/plugin-commands-script-runners/test/utils/index.ts b/exec/plugin-commands-script-runners/test/utils/index.ts index 5b86a5a796..6a413d585e 100644 --- a/exec/plugin-commands-script-runners/test/utils/index.ts +++ b/exec/plugin-commands-script-runners/test/utils/index.ts @@ -1,4 +1,5 @@ import path from 'path' + import { tempDir } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' diff --git a/exec/plugin-commands-script-runners/test/verifyDepsBeforeRun.ts b/exec/plugin-commands-script-runners/test/verifyDepsBeforeRun.ts index 4fb553057a..be16c9ab56 100644 --- a/exec/plugin-commands-script-runners/test/verifyDepsBeforeRun.ts +++ b/exec/plugin-commands-script-runners/test/verifyDepsBeforeRun.ts @@ -1,8 +1,10 @@ -import path from 'path' import fs from 'fs' +import path from 'path' + +import { jest } from '@jest/globals' import type { VerifyDepsBeforeRun } from '@pnpm/config' import { prepare } from '@pnpm/prepare' -import { jest } from '@jest/globals' + import { DEFAULT_OPTS } from './utils/index.js' const originalModule = await import('@pnpm/logger') diff --git a/exec/pnpm-cli-runner/src/index.ts b/exec/pnpm-cli-runner/src/index.ts index 6d4fbceb27..3005d3f84c 100644 --- a/exec/pnpm-cli-runner/src/index.ts +++ b/exec/pnpm-cli-runner/src/index.ts @@ -1,4 +1,5 @@ import path from 'path' + import { sync as execSync } from 'execa' export function runPnpmCli (command: string[], { cwd }: { cwd: string }): void { diff --git a/exec/prepare-package/src/index.ts b/exec/prepare-package/src/index.ts index e201b48568..5aaaf584a1 100644 --- a/exec/prepare-package/src/index.ts +++ b/exec/prepare-package/src/index.ts @@ -2,6 +2,7 @@ import assert from 'assert' import fs from 'fs' import path from 'path' import util from 'util' + import { PnpmError } from '@pnpm/error' import { runLifecycleHook, type RunLifecycleHookOptions } from '@pnpm/lifecycle' import { safeReadPackageJsonFromDir } from '@pnpm/read-package-json' diff --git a/exec/prepare-package/test/index.ts b/exec/prepare-package/test/index.ts index 2a82e6bd74..640ca2c633 100644 --- a/exec/prepare-package/test/index.ts +++ b/exec/prepare-package/test/index.ts @@ -1,8 +1,9 @@ import path from 'path' -import { preparePackage } from '@pnpm/prepare-package' + import { tempDir } from '@pnpm/prepare' -import { createTestIpcServer } from '@pnpm/test-ipc-server' +import { preparePackage } from '@pnpm/prepare-package' import { fixtures } from '@pnpm/test-fixtures' +import { createTestIpcServer } from '@pnpm/test-ipc-server' const f = fixtures(import.meta.dirname) const allowBuild = () => true diff --git a/exec/run-npm/src/index.ts b/exec/run-npm/src/index.ts index bf283f4d3b..1525a76d03 100644 --- a/exec/run-npm/src/index.ts +++ b/exec/run-npm/src/index.ts @@ -1,5 +1,6 @@ import type childProcess from 'child_process' import path from 'path' + import spawn from 'cross-spawn' import PATH from 'path-name' diff --git a/fetching/binary-fetcher/src/index.ts b/fetching/binary-fetcher/src/index.ts index a4cfeb4338..61799ab633 100644 --- a/fetching/binary-fetcher/src/index.ts +++ b/fetching/binary-fetcher/src/index.ts @@ -1,15 +1,16 @@ -import path from 'path' import fsPromises from 'fs/promises' +import path from 'path' + import { PnpmError } from '@pnpm/error' -import type { FetchFromRegistry } from '@pnpm/fetching-types' import type { BinaryFetcher, FetchFunction, FetchResult } from '@pnpm/fetcher-base' +import type { FetchFromRegistry } from '@pnpm/fetching-types' import type { StoreIndex } from '@pnpm/store.index' import { addFilesFromDir } from '@pnpm/worker' import AdmZip from 'adm-zip' import { isSubdir } from 'is-subdir' import { renameOverwrite } from 'rename-overwrite' -import { temporaryDirectory } from 'tempy' import ssri from 'ssri' +import { temporaryDirectory } from 'tempy' export function createBinaryFetcher (ctx: { fetch: FetchFromRegistry diff --git a/fetching/binary-fetcher/test/index.ts b/fetching/binary-fetcher/test/index.ts index a4c208835e..7bd23bb8fb 100644 --- a/fetching/binary-fetcher/test/index.ts +++ b/fetching/binary-fetcher/test/index.ts @@ -1,11 +1,12 @@ /// import fs from 'fs' import path from 'path' + import { PnpmError } from '@pnpm/error' -import { temporaryDirectory } from 'tempy' +import { downloadAndUnpackZip } from '@pnpm/fetching.binary-fetcher' import AdmZip from 'adm-zip' import ssri from 'ssri' -import { downloadAndUnpackZip } from '@pnpm/fetching.binary-fetcher' +import { temporaryDirectory } from 'tempy' // Mock fetch function that returns a ZIP buffer and simulates FetchFromRegistry function createMockFetch (zipBuffer: Buffer) { diff --git a/fetching/directory-fetcher/src/index.ts b/fetching/directory-fetcher/src/index.ts index 6edf1c7fb0..59602ebfa2 100644 --- a/fetching/directory-fetcher/src/index.ts +++ b/fetching/directory-fetcher/src/index.ts @@ -1,6 +1,7 @@ import { promises as fs, type Stats } from 'fs' import path from 'path' import util from 'util' + import { pkgRequiresBuild } from '@pnpm/building.pkg-requires-build' import type { FilesMap } from '@pnpm/cafs-types' import type { DirectoryFetcher, DirectoryFetcherOptions } from '@pnpm/fetcher-base' diff --git a/fetching/directory-fetcher/test/index.ts b/fetching/directory-fetcher/test/index.ts index 56c63f678c..9da5bfa434 100644 --- a/fetching/directory-fetcher/test/index.ts +++ b/fetching/directory-fetcher/test/index.ts @@ -1,10 +1,11 @@ /// import fs from 'fs' import path from 'path' + +import { jest } from '@jest/globals' import { fixtures } from '@pnpm/test-fixtures' import { lexCompare } from '@pnpm/util.lex-comparator' import { rimrafSync } from '@zkochan/rimraf' -import { jest } from '@jest/globals' const debug = jest.fn() jest.unstable_mockModule('@pnpm/logger', () => { diff --git a/fetching/fetcher-base/src/index.ts b/fetching/fetcher-base/src/index.ts index cb919c99af..14491379ec 100644 --- a/fetching/fetcher-base/src/index.ts +++ b/fetching/fetcher-base/src/index.ts @@ -1,10 +1,10 @@ -import type { - Resolution, - GitResolution, - DirectoryResolution, - BinaryResolution, -} from '@pnpm/resolver-base' import type { Cafs, FilesMap } from '@pnpm/cafs-types' +import type { + BinaryResolution, + DirectoryResolution, + GitResolution, + Resolution, +} from '@pnpm/resolver-base' import type { AllowBuild, BundledManifest, DependencyManifest } from '@pnpm/types' export interface PkgNameVersion { diff --git a/fetching/git-fetcher/src/index.ts b/fetching/git-fetcher/src/index.ts index 585c839c28..85e436dd6a 100644 --- a/fetching/git-fetcher/src/index.ts +++ b/fetching/git-fetcher/src/index.ts @@ -1,16 +1,17 @@ import assert from 'assert' import path from 'path' +import { URL } from 'url' import util from 'util' + +import { PnpmError } from '@pnpm/error' import type { GitFetcher } from '@pnpm/fetcher-base' import { packlist } from '@pnpm/fs.packlist' import { globalWarn } from '@pnpm/logger' import { preparePackage } from '@pnpm/prepare-package' import type { StoreIndex } from '@pnpm/store.index' import { addFilesFromDir } from '@pnpm/worker' -import { PnpmError } from '@pnpm/error' import { rimraf } from '@zkochan/rimraf' import { safeExeca as execa } from 'execa' -import { URL } from 'url' export interface CreateGitFetcherOptions { gitShallowHosts?: string[] diff --git a/fetching/git-fetcher/test/index.ts b/fetching/git-fetcher/test/index.ts index 231bf66317..d4ec4f5c60 100644 --- a/fetching/git-fetcher/test/index.ts +++ b/fetching/git-fetcher/test/index.ts @@ -1,10 +1,11 @@ /// import path from 'path' + +import { jest } from '@jest/globals' import { createCafsStore } from '@pnpm/create-cafs-store' import { StoreIndex } from '@pnpm/store.index' -import { jest } from '@jest/globals' -import { temporaryDirectory } from 'tempy' import { lexCompare } from '@pnpm/util.lex-comparator' +import { temporaryDirectory } from 'tempy' { const originalModule = await import('execa') diff --git a/fetching/pick-fetcher/src/index.ts b/fetching/pick-fetcher/src/index.ts index 2613a10eab..97f6939222 100644 --- a/fetching/pick-fetcher/src/index.ts +++ b/fetching/pick-fetcher/src/index.ts @@ -1,8 +1,8 @@ -import type { AtomicResolution } from '@pnpm/resolver-base' -import type { Fetchers, FetchFunction, DirectoryFetcher, GitFetcher, BinaryFetcher, FetchOptions } from '@pnpm/fetcher-base' import type { Cafs } from '@pnpm/cafs-types' import { PnpmError } from '@pnpm/error' +import type { BinaryFetcher, DirectoryFetcher, Fetchers, FetchFunction, FetchOptions, GitFetcher } from '@pnpm/fetcher-base' import type { CustomFetcher } from '@pnpm/hooks.types' +import type { AtomicResolution } from '@pnpm/resolver-base' export async function pickFetcher ( fetcherByHostingType: Fetchers, diff --git a/fetching/pick-fetcher/test/customFetch.ts b/fetching/pick-fetcher/test/customFetch.ts index baa4c668ab..738667e837 100644 --- a/fetching/pick-fetcher/test/customFetch.ts +++ b/fetching/pick-fetcher/test/customFetch.ts @@ -1,17 +1,18 @@ -import { pickFetcher } from '@pnpm/pick-fetcher' -import { jest } from '@jest/globals' -import { createTarballFetcher } from '@pnpm/tarball-fetcher' -import { createFetchFromRegistry } from '@pnpm/fetch' -import { createCafsStore } from '@pnpm/create-cafs-store' -import { StoreIndex } from '@pnpm/store.index' -import { fixtures } from '@pnpm/test-fixtures' -import { temporaryDirectory } from 'tempy' import path from 'path' -import nock from 'nock' + +import { jest } from '@jest/globals' import type { Cafs } from '@pnpm/cafs-types' -import type { FetchFunction, Fetchers, FetchOptions } from '@pnpm/fetcher-base' -import type { AtomicResolution } from '@pnpm/resolver-base' +import { createCafsStore } from '@pnpm/create-cafs-store' +import { createFetchFromRegistry } from '@pnpm/fetch' +import type { Fetchers, FetchFunction, FetchOptions } from '@pnpm/fetcher-base' import type { CustomFetcher } from '@pnpm/hooks.types' +import { pickFetcher } from '@pnpm/pick-fetcher' +import type { AtomicResolution } from '@pnpm/resolver-base' +import { StoreIndex } from '@pnpm/store.index' +import { createTarballFetcher } from '@pnpm/tarball-fetcher' +import { fixtures } from '@pnpm/test-fixtures' +import nock from 'nock' +import { temporaryDirectory } from 'tempy' const f = fixtures(import.meta.dirname) const storeIndex = new StoreIndex(temporaryDirectory()) diff --git a/fetching/pick-fetcher/test/pickFetcher.ts b/fetching/pick-fetcher/test/pickFetcher.ts index 10b476c2a7..ce33f4b78d 100644 --- a/fetching/pick-fetcher/test/pickFetcher.ts +++ b/fetching/pick-fetcher/test/pickFetcher.ts @@ -1,7 +1,7 @@ -import { pickFetcher } from '@pnpm/pick-fetcher' import { jest } from '@jest/globals' -import type { FetchFunction, Fetchers } from '@pnpm/fetcher-base' +import type { Fetchers, FetchFunction } from '@pnpm/fetcher-base' import type { CustomFetcher } from '@pnpm/hooks.types' +import { pickFetcher } from '@pnpm/pick-fetcher' // Helper to create a mock Fetchers object with only the needed fetcher function createMockFetchers (partial: Partial): Fetchers { diff --git a/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts b/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts index b5769d1204..96ab7ab510 100644 --- a/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts +++ b/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts @@ -1,7 +1,8 @@ import assert from 'assert' import util from 'util' -import type { FetchFunction, FetchOptions } from '@pnpm/fetcher-base' + import type { Cafs, FilesMap } from '@pnpm/cafs-types' +import type { FetchFunction, FetchOptions } from '@pnpm/fetcher-base' import { packlist } from '@pnpm/fs.packlist' import { globalWarn } from '@pnpm/logger' import { preparePackage } from '@pnpm/prepare-package' diff --git a/fetching/tarball-fetcher/src/index.ts b/fetching/tarball-fetcher/src/index.ts index 85e535b29f..5cc10b43d9 100644 --- a/fetching/tarball-fetcher/src/index.ts +++ b/fetching/tarball-fetcher/src/index.ts @@ -1,10 +1,10 @@ +import type { Cafs } from '@pnpm/cafs-types' import { PnpmError } from '@pnpm/error' import type { FetchFunction, FetchOptions, FetchResult, } from '@pnpm/fetcher-base' -import type { Cafs } from '@pnpm/cafs-types' import type { FetchFromRegistry, GetAuthHeader, @@ -12,22 +12,23 @@ import type { } from '@pnpm/fetching-types' import type { StoreIndex } from '@pnpm/store.index' import { TarballIntegrityError } from '@pnpm/worker' + +import { createGitHostedTarballFetcher } from './gitHostedTarballFetcher.js' +import { createLocalTarballFetcher } from './localTarballFetcher.js' import { createDownloader, - type DownloadFunction, type CreateDownloaderOptions, + type DownloadFunction, } from './remoteTarballFetcher.js' -import { createLocalTarballFetcher } from './localTarballFetcher.js' -import { createGitHostedTarballFetcher } from './gitHostedTarballFetcher.js' export { BadTarballError } from './errorTypes/index.js' export { TarballIntegrityError } // Export individual fetcher factories for custom fetcher authors -export { createLocalTarballFetcher } from './localTarballFetcher.js' export { createGitHostedTarballFetcher } from './gitHostedTarballFetcher.js' -export { createDownloader, type DownloadFunction, type CreateDownloaderOptions } from './remoteTarballFetcher.js' +export { createLocalTarballFetcher } from './localTarballFetcher.js' +export { createDownloader, type CreateDownloaderOptions, type DownloadFunction } from './remoteTarballFetcher.js' export interface TarballFetchers { localTarball: FetchFunction diff --git a/fetching/tarball-fetcher/src/localTarballFetcher.ts b/fetching/tarball-fetcher/src/localTarballFetcher.ts index b088019d78..37239f24e2 100644 --- a/fetching/tarball-fetcher/src/localTarballFetcher.ts +++ b/fetching/tarball-fetcher/src/localTarballFetcher.ts @@ -1,6 +1,7 @@ import path from 'path' -import type { FetchFunction, FetchOptions } from '@pnpm/fetcher-base' + import type { Cafs } from '@pnpm/cafs-types' +import type { FetchFunction, FetchOptions } from '@pnpm/fetcher-base' import gfs from '@pnpm/graceful-fs' import type { StoreIndex } from '@pnpm/store.index' import { addFilesFromTarball } from '@pnpm/worker' diff --git a/fetching/tarball-fetcher/src/remoteTarballFetcher.ts b/fetching/tarball-fetcher/src/remoteTarballFetcher.ts index 63d9cd6f72..88a1831697 100644 --- a/fetching/tarball-fetcher/src/remoteTarballFetcher.ts +++ b/fetching/tarball-fetcher/src/remoteTarballFetcher.ts @@ -1,16 +1,18 @@ import assert from 'assert' import type { IncomingMessage } from 'http' import util from 'util' + +import type { Cafs } from '@pnpm/cafs-types' import { requestRetryLogger } from '@pnpm/core-loggers' import { FetchError } from '@pnpm/error' -import type { FetchResult, FetchOptions } from '@pnpm/fetcher-base' -import type { Cafs } from '@pnpm/cafs-types' +import type { FetchOptions, FetchResult } from '@pnpm/fetcher-base' import type { FetchFromRegistry } from '@pnpm/fetching-types' import { globalWarn } from '@pnpm/logger' import type { StoreIndex } from '@pnpm/store.index' import { addFilesFromTarball } from '@pnpm/worker' import * as retry from '@zkochan/retry' import throttle from 'lodash.throttle' + import { BadTarballError } from './errorTypes/index.js' const BIG_TARBALL_SIZE = 1024 * 1024 * 5 // 5 MB diff --git a/fetching/tarball-fetcher/test/fetch.ts b/fetching/tarball-fetcher/test/fetch.ts index 0c9befbffe..d77fe7b201 100644 --- a/fetching/tarball-fetcher/test/fetch.ts +++ b/fetching/tarball-fetcher/test/fetch.ts @@ -1,13 +1,14 @@ /// -import { jest } from '@jest/globals' import fs from 'fs' import path from 'path' + +import { jest } from '@jest/globals' +import { createCafsStore } from '@pnpm/create-cafs-store' import { FetchError, PnpmError } from '@pnpm/error' import { createFetchFromRegistry } from '@pnpm/fetch' -import { createCafsStore } from '@pnpm/create-cafs-store' +import { StoreIndex } from '@pnpm/store.index' import { fixtures } from '@pnpm/test-fixtures' import { lexCompare } from '@pnpm/util.lex-comparator' -import { StoreIndex } from '@pnpm/store.index' import nock from 'nock' import ssri from 'ssri' import { temporaryDirectory } from 'tempy' diff --git a/fs/find-packages/src/index.ts b/fs/find-packages/src/index.ts index b51a3c23a9..f7d45e4141 100644 --- a/fs/find-packages/src/index.ts +++ b/fs/find-packages/src/index.ts @@ -1,11 +1,12 @@ import { promises as fs } from 'fs' import path from 'path' import util from 'util' + import { readExactProjectManifest } from '@pnpm/read-project-manifest' import type { Project, ProjectRootDir, ProjectRootDirRealPath } from '@pnpm/types' import { lexCompare } from '@pnpm/util.lex-comparator' -import { glob } from 'tinyglobby' import pFilter from 'p-filter' +import { glob } from 'tinyglobby' const DEFAULT_IGNORE = [ '**/node_modules/**', diff --git a/fs/find-packages/test/index.ts b/fs/find-packages/test/index.ts index 12907d7d70..e4933f39ef 100644 --- a/fs/find-packages/test/index.ts +++ b/fs/find-packages/test/index.ts @@ -1,5 +1,6 @@ /// import path from 'path' + import { findPackages } from '@pnpm/fs.find-packages' function compare (a: string | undefined, b: string | undefined) { diff --git a/fs/graceful-fs/src/index.ts b/fs/graceful-fs/src/index.ts index cb26232637..169bda2e0b 100644 --- a/fs/graceful-fs/src/index.ts +++ b/fs/graceful-fs/src/index.ts @@ -1,4 +1,5 @@ import util, { promisify } from 'util' + import gfs from 'graceful-fs' export default { // eslint-disable-line diff --git a/fs/hard-link-dir/src/index.ts b/fs/hard-link-dir/src/index.ts index dd3f764b60..fb9d5f873d 100644 --- a/fs/hard-link-dir/src/index.ts +++ b/fs/hard-link-dir/src/index.ts @@ -1,11 +1,12 @@ import assert from 'assert' +import fs from 'fs' import path from 'path' import util from 'util' -import fs from 'fs' -import { globalWarn } from '@pnpm/logger' + import gfs from '@pnpm/graceful-fs' -import { renameOverwriteSync } from 'rename-overwrite' +import { globalWarn } from '@pnpm/logger' import { pathTemp } from 'path-temp' +import { renameOverwriteSync } from 'rename-overwrite' export function hardLinkDir (src: string, destDirs: string[]): void { if (destDirs.length === 0) return diff --git a/fs/hard-link-dir/test/index.ts b/fs/hard-link-dir/test/index.ts index 3e2d3ad667..73ad34f1a5 100644 --- a/fs/hard-link-dir/test/index.ts +++ b/fs/hard-link-dir/test/index.ts @@ -1,7 +1,8 @@ import fs from 'fs' import path from 'path' -import { tempDir as createTempDir } from '@pnpm/prepare' + import { hardLinkDir } from '@pnpm/fs.hard-link-dir' +import { tempDir as createTempDir } from '@pnpm/prepare' test('hardLinkDirectory()', () => { const tempDir = createTempDir() diff --git a/fs/indexed-pkg-importer/src/importIndexedDir.ts b/fs/indexed-pkg-importer/src/importIndexedDir.ts index f84ea33949..bff959a3c1 100644 --- a/fs/indexed-pkg-importer/src/importIndexedDir.ts +++ b/fs/indexed-pkg-importer/src/importIndexedDir.ts @@ -1,14 +1,15 @@ import fs from 'fs' -import util from 'util' -import fsx from 'fs-extra' import path from 'path' +import util from 'util' + +import gfs from '@pnpm/graceful-fs' import { globalInfo, globalWarn, logger } from '@pnpm/logger' import { rimrafSync } from '@zkochan/rimraf' +import fsx from 'fs-extra' import { makeEmptyDirSync } from 'make-empty-dir' -import sanitizeFilename from 'sanitize-filename' import { fastPathTemp as pathTemp } from 'path-temp' import { renameOverwriteSync } from 'rename-overwrite' -import gfs from '@pnpm/graceful-fs' +import sanitizeFilename from 'sanitize-filename' const filenameConflictsLogger = logger('_filename-conflicts') diff --git a/fs/indexed-pkg-importer/src/index.ts b/fs/indexed-pkg-importer/src/index.ts index 057e1b9559..7ae75bef1e 100644 --- a/fs/indexed-pkg-importer/src/index.ts +++ b/fs/indexed-pkg-importer/src/index.ts @@ -1,14 +1,16 @@ import assert from 'assert' -import { constants, type Stats, existsSync } from 'fs' -import util from 'util' -import fs from '@pnpm/graceful-fs' +import { constants, existsSync, type Stats } from 'fs' import path from 'path' -import { globalInfo, globalWarn } from '@pnpm/logger' -import { packageImportMethodLogger } from '@pnpm/core-loggers' -import type { FilesMap, ImportOptions, ImportIndexedPackage } from '@pnpm/store-controller-types' -import { importIndexedDir, type ImportFile } from './importIndexedDir.js' +import util from 'util' -export { type FilesMap, type ImportOptions, type ImportIndexedPackage } +import { packageImportMethodLogger } from '@pnpm/core-loggers' +import fs from '@pnpm/graceful-fs' +import { globalInfo, globalWarn } from '@pnpm/logger' +import type { FilesMap, ImportIndexedPackage, ImportOptions } from '@pnpm/store-controller-types' + +import { type ImportFile, importIndexedDir } from './importIndexedDir.js' + +export { type FilesMap, type ImportIndexedPackage, type ImportOptions } export type PackageImportMethod = 'auto' | 'hardlink' | 'copy' | 'clone' | 'clone-or-copy' diff --git a/fs/indexed-pkg-importer/test/createImportPackage.test.ts b/fs/indexed-pkg-importer/test/createImportPackage.test.ts index bf1c7b4be8..dc75c293ab 100644 --- a/fs/indexed-pkg-importer/test/createImportPackage.test.ts +++ b/fs/indexed-pkg-importer/test/createImportPackage.test.ts @@ -1,5 +1,6 @@ import fs, { type BigIntStats } from 'fs' import path from 'path' + import { jest } from '@jest/globals' const testOnLinuxOnly = (process.platform === 'darwin' || process.platform === 'win32') ? test.skip : test diff --git a/fs/indexed-pkg-importer/test/importIndexedDir.race.test.ts b/fs/indexed-pkg-importer/test/importIndexedDir.race.test.ts index d145152b9c..537bf37854 100644 --- a/fs/indexed-pkg-importer/test/importIndexedDir.race.test.ts +++ b/fs/indexed-pkg-importer/test/importIndexedDir.race.test.ts @@ -1,5 +1,6 @@ import fs from 'fs' import path from 'path' + import { jest } from '@jest/globals' import { tempDir } from '@pnpm/prepare' diff --git a/fs/indexed-pkg-importer/test/importIndexedDir.test.ts b/fs/indexed-pkg-importer/test/importIndexedDir.test.ts index ee423562e6..2100cc99c2 100644 --- a/fs/indexed-pkg-importer/test/importIndexedDir.test.ts +++ b/fs/indexed-pkg-importer/test/importIndexedDir.test.ts @@ -1,6 +1,8 @@ -import { tempDir } from '@pnpm/prepare' import fs from 'fs' import path from 'path' + +import { tempDir } from '@pnpm/prepare' + import { importIndexedDir } from '../src/importIndexedDir.js' test('importIndexedDir() keepModulesDir merges node_modules', async () => { diff --git a/fs/indexed-pkg-importer/test/importingPkgWithInvalidFiles.ts b/fs/indexed-pkg-importer/test/importingPkgWithInvalidFiles.ts index 6717b49cf3..96e0db9272 100644 --- a/fs/indexed-pkg-importer/test/importingPkgWithInvalidFiles.ts +++ b/fs/indexed-pkg-importer/test/importingPkgWithInvalidFiles.ts @@ -1,7 +1,8 @@ import fs from 'fs' import path from 'path' -import { prepareEmpty } from '@pnpm/prepare' + import { createIndexedPkgImporter } from '@pnpm/fs.indexed-pkg-importer' +import { prepareEmpty } from '@pnpm/prepare' test('importing a package with invalid files', () => { prepareEmpty() diff --git a/fs/is-empty-dir-or-nothing/test/index.test.ts b/fs/is-empty-dir-or-nothing/test/index.test.ts index 3985257caf..d29656c2d7 100644 --- a/fs/is-empty-dir-or-nothing/test/index.test.ts +++ b/fs/is-empty-dir-or-nothing/test/index.test.ts @@ -1,6 +1,7 @@ import fs from 'node:fs' -import path from 'node:path' import os from 'node:os' +import path from 'node:path' + import { isEmptyDirOrNothing } from '@pnpm/fs.is-empty-dir-or-nothing' describe('isEmptyDirOrNothing', () => { diff --git a/fs/msgpack-file/src/index.ts b/fs/msgpack-file/src/index.ts index f7977fa965..8422889331 100644 --- a/fs/msgpack-file/src/index.ts +++ b/fs/msgpack-file/src/index.ts @@ -1,5 +1,5 @@ -import { Packr } from 'msgpackr' import gfs from '@pnpm/graceful-fs' +import { Packr } from 'msgpackr' /** * Create a Packr instance with record structure optimization enabled. diff --git a/fs/msgpack-file/test/index.test.ts b/fs/msgpack-file/test/index.test.ts index 7bb02f94af..86c914e090 100644 --- a/fs/msgpack-file/test/index.test.ts +++ b/fs/msgpack-file/test/index.test.ts @@ -1,4 +1,5 @@ import fs from 'fs' + import { readMsgpackFile, readMsgpackFileSync, diff --git a/fs/packlist/src/index.ts b/fs/packlist/src/index.ts index 51b61debbe..e353eb322c 100644 --- a/fs/packlist/src/index.ts +++ b/fs/packlist/src/index.ts @@ -1,6 +1,7 @@ import fs from 'fs/promises' import path from 'path' import util from 'util' + import npmPacklist from 'npm-packlist' export async function packlist (pkgDir: string, opts?: { diff --git a/fs/read-modules-dir/src/index.ts b/fs/read-modules-dir/src/index.ts index 727f855b69..66a8dcb122 100644 --- a/fs/read-modules-dir/src/index.ts +++ b/fs/read-modules-dir/src/index.ts @@ -1,5 +1,6 @@ import path from 'path' import util from 'util' + import gracefulFs from 'graceful-fs' const readdir = util.promisify(gracefulFs.readdir) diff --git a/fs/symlink-dependency/src/index.ts b/fs/symlink-dependency/src/index.ts index a04077ae96..f67196b2fb 100644 --- a/fs/symlink-dependency/src/index.ts +++ b/fs/symlink-dependency/src/index.ts @@ -1,4 +1,5 @@ import path from 'path' + import { linkLogger } from '@pnpm/core-loggers' import symlinkDir from 'symlink-dir' diff --git a/fs/symlink-dependency/src/symlinkDirectRootDependency.ts b/fs/symlink-dependency/src/symlinkDirectRootDependency.ts index 274aa2c3c1..6797ecb00f 100644 --- a/fs/symlink-dependency/src/symlinkDirectRootDependency.ts +++ b/fs/symlink-dependency/src/symlinkDirectRootDependency.ts @@ -1,6 +1,7 @@ import { promises as fs } from 'fs' import path from 'path' import util from 'util' + import { type DependencyType, rootLogger, diff --git a/fs/symlink-dependency/test/symlinkDirectRootDependency.test.ts b/fs/symlink-dependency/test/symlinkDirectRootDependency.test.ts index 737d7fad1e..d7ae864af5 100644 --- a/fs/symlink-dependency/test/symlinkDirectRootDependency.test.ts +++ b/fs/symlink-dependency/test/symlinkDirectRootDependency.test.ts @@ -1,5 +1,6 @@ import fs from 'fs' import path from 'path' + import { tempDir } from '@pnpm/prepare' import { symlinkDirectRootDependency } from '@pnpm/symlink-dependency' diff --git a/global/commands/src/checkGlobalBinConflicts.ts b/global/commands/src/checkGlobalBinConflicts.ts index 0fd141b37e..b8245a2247 100644 --- a/global/commands/src/checkGlobalBinConflicts.ts +++ b/global/commands/src/checkGlobalBinConflicts.ts @@ -1,10 +1,11 @@ import fs from 'fs' import path from 'path' -import { - scanGlobalPackages, - type GlobalPackageInfo, -} from '@pnpm/global.packages' + import { PnpmError } from '@pnpm/error' +import { + type GlobalPackageInfo, + scanGlobalPackages, +} from '@pnpm/global.packages' import { getBinsFromPackageManifest } from '@pnpm/package-bins' import { safeReadPackageJsonFromDir } from '@pnpm/read-package-json' import type { DependencyManifest } from '@pnpm/types' diff --git a/global/commands/src/globalAdd.ts b/global/commands/src/globalAdd.ts index 4b8c45b696..3306d6e9ac 100644 --- a/global/commands/src/globalAdd.ts +++ b/global/commands/src/globalAdd.ts @@ -1,5 +1,6 @@ import fs from 'fs' import path from 'path' + import { approveBuilds } from '@pnpm/building.policy-commands' import { cleanOrphanedInstallDirs, @@ -15,6 +16,7 @@ import { removeBin } from '@pnpm/remove-bins' import type { CreateStoreControllerOptions } from '@pnpm/store-connection-manager' import { isSubdir } from 'is-subdir' import symlinkDir from 'symlink-dir' + import { installGlobalPackages } from './installGlobalPackages.js' type ApproveBuildsHandlerOpts = Parameters[0] diff --git a/global/commands/src/globalRemove.ts b/global/commands/src/globalRemove.ts index ee3a160a31..8679aaee11 100644 --- a/global/commands/src/globalRemove.ts +++ b/global/commands/src/globalRemove.ts @@ -1,5 +1,6 @@ import fs from 'fs' import path from 'path' + import { PnpmError } from '@pnpm/error' import { findGlobalPackage, diff --git a/global/commands/src/globalUpdate.ts b/global/commands/src/globalUpdate.ts index 3cc5468d18..0b0f729fe0 100644 --- a/global/commands/src/globalUpdate.ts +++ b/global/commands/src/globalUpdate.ts @@ -1,19 +1,21 @@ import fs from 'fs' import path from 'path' + import { approveBuilds } from '@pnpm/building.policy-commands' import { cleanOrphanedInstallDirs, createInstallDir, getHashLink, getInstalledBinNames, - scanGlobalPackages, type GlobalPackageInfo, + scanGlobalPackages, } from '@pnpm/global.packages' import { linkBinsOfPackages } from '@pnpm/link-bins' import { removeBin } from '@pnpm/remove-bins' import type { CreateStoreControllerOptions } from '@pnpm/store-connection-manager' import { isSubdir } from 'is-subdir' import symlinkDir from 'symlink-dir' + import { installGlobalPackages } from './installGlobalPackages.js' type ApproveBuildsHandlerOpts = Parameters[0] diff --git a/global/commands/src/index.ts b/global/commands/src/index.ts index cd9a669522..bf2aba625b 100644 --- a/global/commands/src/index.ts +++ b/global/commands/src/index.ts @@ -1,6 +1,6 @@ -export { handleGlobalAdd, type GlobalAddOptions } from './globalAdd.js' -export { handleGlobalRemove } from './globalRemove.js' -export { handleGlobalUpdate, type GlobalUpdateOptions } from './globalUpdate.js' export { checkGlobalBinConflicts } from './checkGlobalBinConflicts.js' -export { listGlobalPackages } from './listGlobalPackages.js' +export { type GlobalAddOptions, handleGlobalAdd } from './globalAdd.js' +export { handleGlobalRemove } from './globalRemove.js' +export { type GlobalUpdateOptions, handleGlobalUpdate } from './globalUpdate.js' export { installGlobalPackages, type InstallGlobalPackagesOptions } from './installGlobalPackages.js' +export { listGlobalPackages } from './listGlobalPackages.js' diff --git a/global/commands/src/listGlobalPackages.ts b/global/commands/src/listGlobalPackages.ts index dcc545b5b7..ee4bc3a5c5 100644 --- a/global/commands/src/listGlobalPackages.ts +++ b/global/commands/src/listGlobalPackages.ts @@ -1,6 +1,6 @@ import { - scanGlobalPackages, getGlobalPackageDetails, + scanGlobalPackages, } from '@pnpm/global.packages' import { createMatcher } from '@pnpm/matcher' import { lexCompare } from '@pnpm/util.lex-comparator' diff --git a/global/commands/src/readInstalledPackages.ts b/global/commands/src/readInstalledPackages.ts index 10d5369c2b..8e9c16e22e 100644 --- a/global/commands/src/readInstalledPackages.ts +++ b/global/commands/src/readInstalledPackages.ts @@ -1,4 +1,5 @@ import path from 'path' + import { readPackageJsonFromDir, readPackageJsonFromDirRawSync } from '@pnpm/read-package-json' import type { DependencyManifest } from '@pnpm/types' diff --git a/global/commands/test/checkGlobalBinConflicts.test.ts b/global/commands/test/checkGlobalBinConflicts.test.ts index 26f13d84cd..74803c05a3 100644 --- a/global/commands/test/checkGlobalBinConflicts.test.ts +++ b/global/commands/test/checkGlobalBinConflicts.test.ts @@ -1,6 +1,7 @@ import fs from 'node:fs' import os from 'node:os' import path from 'node:path' + import { checkGlobalBinConflicts } from '@pnpm/global.commands' import type { DependencyManifest } from '@pnpm/types' import symlinkDir from 'symlink-dir' diff --git a/global/packages/src/index.ts b/global/packages/src/index.ts index 2867ec8565..0ae4327f26 100644 --- a/global/packages/src/index.ts +++ b/global/packages/src/index.ts @@ -9,7 +9,7 @@ export { findGlobalPackage, getGlobalPackageDetails, getInstalledBinNames, - scanGlobalPackages, type GlobalPackageInfo, type InstalledGlobalPackage, + scanGlobalPackages, } from './scanGlobalPackages.js' diff --git a/global/packages/src/scanGlobalPackages.ts b/global/packages/src/scanGlobalPackages.ts index 2134d2b1ae..1814a5236e 100644 --- a/global/packages/src/scanGlobalPackages.ts +++ b/global/packages/src/scanGlobalPackages.ts @@ -1,6 +1,7 @@ import fs from 'fs' import path from 'path' import util from 'util' + import { getBinsFromPackageManifest } from '@pnpm/package-bins' import { readPackageJsonFromDirRawSync, safeReadPackageJsonFromDir } from '@pnpm/read-package-json' import type { PackageManifest } from '@pnpm/types' diff --git a/hooks/pnpmfile/src/Hooks.ts b/hooks/pnpmfile/src/Hooks.ts index 7056f646f3..4721080d0c 100644 --- a/hooks/pnpmfile/src/Hooks.ts +++ b/hooks/pnpmfile/src/Hooks.ts @@ -1,6 +1,6 @@ +import type { Log } from '@pnpm/core-loggers' import type { PreResolutionHook } from '@pnpm/hooks.types' import type { LockfileObject } from '@pnpm/lockfile.types' -import type { Log } from '@pnpm/core-loggers' import type { ImportIndexedPackageAsync } from '@pnpm/store-controller-types' export interface HookContext { diff --git a/hooks/pnpmfile/src/index.ts b/hooks/pnpmfile/src/index.ts index cd23a23d17..fc6b2f5e1c 100644 --- a/hooks/pnpmfile/src/index.ts +++ b/hooks/pnpmfile/src/index.ts @@ -1,6 +1,6 @@ import type { CookedHooks } from './requireHooks.js' +export type { HookContext } from './Hooks.js' export { requireHooks } from './requireHooks.js' export { BadReadPackageHookError } from './requirePnpmfile.js' -export type { HookContext } from './Hooks.js' export type Hooks = CookedHooks diff --git a/hooks/pnpmfile/src/requireHooks.ts b/hooks/pnpmfile/src/requireHooks.ts index c7e4627872..176cce512c 100644 --- a/hooks/pnpmfile/src/requireHooks.ts +++ b/hooks/pnpmfile/src/requireHooks.ts @@ -1,13 +1,14 @@ -import type { PreResolutionHookContext, PreResolutionHookLogger, CustomResolver, CustomFetcher } from '@pnpm/hooks.types' -import { PnpmError } from '@pnpm/error' import { hookLogger } from '@pnpm/core-loggers' import { createHashFromMultipleFiles } from '@pnpm/crypto.hash' -import { pathAbsolute } from 'path-absolute' -import type { ImportIndexedPackageAsync } from '@pnpm/store-controller-types' -import type { ReadPackageHook, BeforePackingHook, BaseManifest } from '@pnpm/types' +import { PnpmError } from '@pnpm/error' +import type { CustomFetcher, CustomResolver, PreResolutionHookContext, PreResolutionHookLogger } from '@pnpm/hooks.types' import type { LockfileObject } from '@pnpm/lockfile.types' -import { requirePnpmfile, type Pnpmfile, type Finders } from './requirePnpmfile.js' -import type { Hooks, HookContext } from './Hooks.js' +import type { ImportIndexedPackageAsync } from '@pnpm/store-controller-types' +import type { BaseManifest, BeforePackingHook, ReadPackageHook } from '@pnpm/types' +import { pathAbsolute } from 'path-absolute' + +import type { HookContext, Hooks } from './Hooks.js' +import { type Finders, type Pnpmfile, requirePnpmfile } from './requirePnpmfile.js' // eslint-disable-next-line type Cook any> = ( diff --git a/hooks/pnpmfile/src/requirePnpmfile.ts b/hooks/pnpmfile/src/requirePnpmfile.ts index 0bfd5b5dc5..36fea15aeb 100644 --- a/hooks/pnpmfile/src/requirePnpmfile.ts +++ b/hooks/pnpmfile/src/requirePnpmfile.ts @@ -1,14 +1,16 @@ import assert from 'assert' import fs from 'fs' -import path from 'path' -import util from 'util' -import { pathToFileURL } from 'url' import { createRequire } from 'module' +import path from 'path' +import { pathToFileURL } from 'url' +import util from 'util' + import { PnpmError } from '@pnpm/error' +import type { CustomFetcher, CustomResolver } from '@pnpm/hooks.types' import { logger } from '@pnpm/logger' -import type { PackageManifest, Finder } from '@pnpm/types' -import type { CustomResolver, CustomFetcher } from '@pnpm/hooks.types' +import type { Finder, PackageManifest } from '@pnpm/types' import chalk from 'chalk' + import type { Hooks } from './Hooks.js' const require = createRequire(import.meta.url) diff --git a/hooks/pnpmfile/test/index.ts b/hooks/pnpmfile/test/index.ts index a27ee4e803..c027c4ddd7 100644 --- a/hooks/pnpmfile/test/index.ts +++ b/hooks/pnpmfile/test/index.ts @@ -1,7 +1,9 @@ import path from 'path' + import type { Log } from '@pnpm/core-loggers' -import { requireHooks, BadReadPackageHookError, type HookContext } from '@pnpm/pnpmfile' +import { BadReadPackageHookError, type HookContext, requireHooks } from '@pnpm/pnpmfile' import { fixtures } from '@pnpm/test-fixtures' + import { requirePnpmfile } from '../src/requirePnpmfile.js' const defaultHookContext: HookContext = { log () {} } diff --git a/hooks/read-package-hook/src/createOptionalDependenciesRemover.ts b/hooks/read-package-hook/src/createOptionalDependenciesRemover.ts index fd54d44c3d..66ba3c67cf 100644 --- a/hooks/read-package-hook/src/createOptionalDependenciesRemover.ts +++ b/hooks/read-package-hook/src/createOptionalDependenciesRemover.ts @@ -1,5 +1,5 @@ -import type { BaseManifest, ReadPackageHook } from '@pnpm/types' import { createMatcher } from '@pnpm/matcher' +import type { BaseManifest, ReadPackageHook } from '@pnpm/types' export function createOptionalDependenciesRemover (toBeRemoved: string[]): ReadPackageHook { if (!toBeRemoved.length) return (manifest: Manifest) => manifest diff --git a/hooks/read-package-hook/src/createPackageExtender.ts b/hooks/read-package-hook/src/createPackageExtender.ts index d4cbadfddb..e5e73b1e9a 100644 --- a/hooks/read-package-hook/src/createPackageExtender.ts +++ b/hooks/read-package-hook/src/createPackageExtender.ts @@ -1,5 +1,5 @@ -import type { PackageManifest, PackageExtension, ReadPackageHook } from '@pnpm/types' import { parseWantedDependency } from '@pnpm/parse-wanted-dependency' +import type { PackageExtension, PackageManifest, ReadPackageHook } from '@pnpm/types' import semver from 'semver' interface PackageExtensionMatch { diff --git a/hooks/read-package-hook/src/createReadPackageHook.ts b/hooks/read-package-hook/src/createReadPackageHook.ts index cca71a19a1..dacff03dcd 100644 --- a/hooks/read-package-hook/src/createReadPackageHook.ts +++ b/hooks/read-package-hook/src/createReadPackageHook.ts @@ -1,11 +1,12 @@ -import { packageExtensions as compatPackageExtensions } from '@yarnpkg/extensions' import type { PackageExtension, PackageManifest, ProjectManifest, ReadPackageHook, } from '@pnpm/types' +import { packageExtensions as compatPackageExtensions } from '@yarnpkg/extensions' import { isEmpty, pipeWith } from 'ramda' + import { createOptionalDependenciesRemover } from './createOptionalDependenciesRemover.js' import { createPackageExtender } from './createPackageExtender.js' import { createVersionsOverrider, type VersionOverrideWithoutRawSelector } from './createVersionsOverrider.js' diff --git a/hooks/read-package-hook/src/createVersionsOverrider.ts b/hooks/read-package-hook/src/createVersionsOverrider.ts index ce84588b5e..f78effa3bd 100644 --- a/hooks/read-package-hook/src/createVersionsOverrider.ts +++ b/hooks/read-package-hook/src/createVersionsOverrider.ts @@ -1,10 +1,12 @@ import path from 'path' -import semver from 'semver' -import { partition } from 'ramda' -import type { Dependencies, PackageManifest, ReadPackageHook } from '@pnpm/types' + import type { PackageSelector, VersionOverride as VersionOverrideBase } from '@pnpm/parse-overrides' import { isValidPeerRange } from '@pnpm/semver.peer-range' +import type { Dependencies, PackageManifest, ReadPackageHook } from '@pnpm/types' import normalizePath from 'normalize-path' +import { partition } from 'ramda' +import semver from 'semver' + import { isIntersectingRange } from './isIntersectingRange.js' export type VersionOverrideWithoutRawSelector = Omit diff --git a/hooks/read-package-hook/test/createOptionalDependenciesRemover.test.ts b/hooks/read-package-hook/test/createOptionalDependenciesRemover.test.ts index 13a0cd7747..3dc9086faa 100644 --- a/hooks/read-package-hook/test/createOptionalDependenciesRemover.test.ts +++ b/hooks/read-package-hook/test/createOptionalDependenciesRemover.test.ts @@ -1,6 +1,7 @@ -import { createOptionalDependenciesRemover } from '../lib/createOptionalDependenciesRemover.js' import type { BaseManifest } from '@pnpm/types' +import { createOptionalDependenciesRemover } from '../lib/createOptionalDependenciesRemover.js' + test('createOptionalDependenciesRemover() does not modify the manifest if provided array is empty', async () => { const removeOptionalDependencies = createOptionalDependenciesRemover([]) const manifest: BaseManifest = Object.freeze({ diff --git a/hooks/read-package-hook/test/createReadPackageHook.ts b/hooks/read-package-hook/test/createReadPackageHook.ts index 017b166f6a..e91fbecf59 100644 --- a/hooks/read-package-hook/test/createReadPackageHook.ts +++ b/hooks/read-package-hook/test/createReadPackageHook.ts @@ -1,5 +1,6 @@ import { jest } from '@jest/globals' import type { ReadPackageHook } from '@pnpm/types' + import { createReadPackageHook } from '../lib/createReadPackageHook.js' test('createReadPackageHook() is passing directory to all hooks', async () => { diff --git a/hooks/read-package-hook/test/createVersionOverrider.test.ts b/hooks/read-package-hook/test/createVersionOverrider.test.ts index 40b6b3659a..05f6a80e27 100644 --- a/hooks/read-package-hook/test/createVersionOverrider.test.ts +++ b/hooks/read-package-hook/test/createVersionOverrider.test.ts @@ -1,4 +1,5 @@ import path from 'path' + import { createVersionsOverrider } from '../src/createVersionsOverrider.js' test('createVersionsOverrider() matches sub-ranges', () => { diff --git a/hooks/types/src/index.ts b/hooks/types/src/index.ts index 004875413e..4bbaf27d76 100644 --- a/hooks/types/src/index.ts +++ b/hooks/types/src/index.ts @@ -1,8 +1,8 @@ +import type { Cafs } from '@pnpm/cafs-types' +import type { Fetchers, FetchOptions, FetchResult } from '@pnpm/fetcher-base' import type { LockfileObject, PackageSnapshot } from '@pnpm/lockfile.types' import type { Resolution, WantedDependency } from '@pnpm/resolver-base' import type { Registries } from '@pnpm/types' -import type { Cafs } from '@pnpm/cafs-types' -import type { FetchOptions, FetchResult, Fetchers } from '@pnpm/fetcher-base' // Custom resolution types must use scoped naming to avoid conflicts with pnpm's built-in types export type CustomResolutionType = `@${string}/${string}` @@ -116,8 +116,8 @@ export interface CustomFetcher { } export { - getCustomResolverCacheKey, - getCachedCanResolve, - setCachedCanResolve, checkCustomResolverCanResolve, + getCachedCanResolve, + getCustomResolverCacheKey, + setCachedCanResolve, } from './customResolverCache.js' diff --git a/hooks/types/test/customResolverCache.test.ts b/hooks/types/test/customResolverCache.test.ts index ed7e710a49..46c67e865b 100644 --- a/hooks/types/test/customResolverCache.test.ts +++ b/hooks/types/test/customResolverCache.test.ts @@ -1,9 +1,9 @@ import { - getCustomResolverCacheKey, - getCachedCanResolve, - setCachedCanResolve, checkCustomResolverCanResolve, type CustomResolver, + getCachedCanResolve, + getCustomResolverCacheKey, + setCachedCanResolve, } from '../src/index.js' describe('customResolverCache', () => { diff --git a/lockfile/audit/src/index.ts b/lockfile/audit/src/index.ts index 0afa597b5b..cf16efaa2f 100644 --- a/lockfile/audit/src/index.ts +++ b/lockfile/audit/src/index.ts @@ -3,6 +3,7 @@ import { type AgentOptions, fetchWithAgent, type RetryTimeoutOptions } from '@pn import type { GetAuthHeader } from '@pnpm/fetching-types' import type { EnvLockfile, LockfileObject } from '@pnpm/lockfile.types' import type { DependenciesField } from '@pnpm/types' + import { lockfileToAuditTree } from './lockfileToAuditTree.js' import type { AuditReport } from './types.js' diff --git a/lockfile/audit/src/lockfileToAuditTree.ts b/lockfile/audit/src/lockfileToAuditTree.ts index c6369f7584..6fdea84390 100644 --- a/lockfile/audit/src/lockfileToAuditTree.ts +++ b/lockfile/audit/src/lockfileToAuditTree.ts @@ -1,11 +1,12 @@ import path from 'path' + +import { DepType, type DepTypes, detectDepTypes } from '@pnpm/lockfile.detect-dep-types' import { convertToLockfileObject } from '@pnpm/lockfile.fs' import type { EnvLockfile, LockfileObject, TarballResolution } from '@pnpm/lockfile.types' import { nameVerFromPkgSnapshot } from '@pnpm/lockfile.utils' import { lockfileWalkerGroupImporterSteps, type LockfileWalkerStep } from '@pnpm/lockfile.walker' -import { detectDepTypes, type DepTypes, DepType } from '@pnpm/lockfile.detect-dep-types' -import type { DependenciesField, ProjectId } from '@pnpm/types' import { safeReadProjectManifestOnly } from '@pnpm/read-project-manifest' +import type { DependenciesField, ProjectId } from '@pnpm/types' import { map as mapValues } from 'ramda' export interface AuditNode { diff --git a/lockfile/audit/test/index.ts b/lockfile/audit/test/index.ts index e6001f5b86..4b28a4585e 100644 --- a/lockfile/audit/test/index.ts +++ b/lockfile/audit/test/index.ts @@ -4,6 +4,7 @@ import type { PnpmError } from '@pnpm/error' import { fixtures } from '@pnpm/test-fixtures' import type { DepPath, ProjectId } from '@pnpm/types' import nock from 'nock' + import { lockfileToAuditTree } from '../lib/lockfileToAuditTree.js' const f = fixtures(import.meta.dirname) diff --git a/lockfile/detect-dep-types/src/index.ts b/lockfile/detect-dep-types/src/index.ts index b1f8f7c67b..8f519cadd7 100644 --- a/lockfile/detect-dep-types/src/index.ts +++ b/lockfile/detect-dep-types/src/index.ts @@ -1,5 +1,5 @@ -import type { LockfileObject, PackageSnapshots, ResolvedDependencies } from '@pnpm/lockfile.types' import * as dp from '@pnpm/dependency-path' +import type { LockfileObject, PackageSnapshots, ResolvedDependencies } from '@pnpm/lockfile.types' import type { DepPath } from '@pnpm/types' export const DepType = { diff --git a/lockfile/filtering/src/filterLockfile.ts b/lockfile/filtering/src/filterLockfile.ts index 4ac45e5ab9..6d3e94f32e 100644 --- a/lockfile/filtering/src/filterLockfile.ts +++ b/lockfile/filtering/src/filterLockfile.ts @@ -1,5 +1,6 @@ import type { LockfileObject } from '@pnpm/lockfile.types' import type { DependenciesField, DepPath, ProjectId } from '@pnpm/types' + import { filterLockfileByImporters } from './filterLockfileByImporters.js' export function filterLockfile ( diff --git a/lockfile/filtering/src/filterLockfileByImporters.ts b/lockfile/filtering/src/filterLockfileByImporters.ts index 62333c66db..47266d8129 100644 --- a/lockfile/filtering/src/filterLockfileByImporters.ts +++ b/lockfile/filtering/src/filterLockfileByImporters.ts @@ -7,6 +7,7 @@ import type { import { lockfileWalker, type LockfileWalkerStep } from '@pnpm/lockfile.walker' import { logger } from '@pnpm/logger' import type { DependenciesField, DepPath, ProjectId } from '@pnpm/types' + import { filterImporter } from './filterImporter.js' const lockfileLogger = logger('lockfile') diff --git a/lockfile/filtering/src/filterLockfileByImportersAndEngine.ts b/lockfile/filtering/src/filterLockfileByImportersAndEngine.ts index 6dce92bbf1..28ab8f17ad 100644 --- a/lockfile/filtering/src/filterLockfileByImportersAndEngine.ts +++ b/lockfile/filtering/src/filterLockfileByImportersAndEngine.ts @@ -1,4 +1,5 @@ import { WANTED_LOCKFILE } from '@pnpm/constants' +import * as dp from '@pnpm/dependency-path' import { LockfileMissingDependencyError } from '@pnpm/error' import type { LockfileObject, @@ -7,9 +8,9 @@ import type { import { nameVerFromPkgSnapshot } from '@pnpm/lockfile.utils' import { logger } from '@pnpm/logger' import { packageIsInstallable } from '@pnpm/package-is-installable' -import type { DepPath, SupportedArchitectures, DependenciesField, ProjectId } from '@pnpm/types' -import * as dp from '@pnpm/dependency-path' +import type { DependenciesField, DepPath, ProjectId, SupportedArchitectures } from '@pnpm/types' import { map as mapValues, pickBy, unnest } from 'ramda' + import { filterImporter } from './filterImporter.js' const lockfileLogger = logger('lockfile') diff --git a/lockfile/filtering/src/index.ts b/lockfile/filtering/src/index.ts index 3b67c33a33..b7a3d4e645 100644 --- a/lockfile/filtering/src/index.ts +++ b/lockfile/filtering/src/index.ts @@ -1,3 +1,3 @@ export { filterLockfile } from './filterLockfile.js' export { filterLockfileByImporters } from './filterLockfileByImporters.js' -export { filterLockfileByImportersAndEngine, filterLockfileByEngine } from './filterLockfileByImportersAndEngine.js' +export { filterLockfileByEngine, filterLockfileByImportersAndEngine } from './filterLockfileByImportersAndEngine.js' diff --git a/lockfile/filtering/test/filterByImportersAndEngine.ts b/lockfile/filtering/test/filterByImportersAndEngine.ts index d00caca6fd..59ccb2d956 100644 --- a/lockfile/filtering/test/filterByImportersAndEngine.ts +++ b/lockfile/filtering/test/filterByImportersAndEngine.ts @@ -1,6 +1,6 @@ +import { jest } from '@jest/globals' import { LOCKFILE_VERSION } from '@pnpm/constants' import type { DepPath, ProjectId } from '@pnpm/types' -import { jest } from '@jest/globals' const REGIONAL_ARCH = Object.assign({}, process.arch) const REGIONAL_CPU = Object.assign({}, process.platform) diff --git a/lockfile/fs/src/envLockfile.ts b/lockfile/fs/src/envLockfile.ts index bc918b800c..8abb087d4e 100644 --- a/lockfile/fs/src/envLockfile.ts +++ b/lockfile/fs/src/envLockfile.ts @@ -1,6 +1,7 @@ import { promises as fs } from 'fs' import path from 'path' import util from 'util' + import { ENV_LOCKFILE, LOCKFILE_VERSION } from '@pnpm/constants' import { PnpmError } from '@pnpm/error' import type { EnvLockfile } from '@pnpm/lockfile.types' @@ -8,6 +9,7 @@ import { sortDirectKeys } from '@pnpm/object.key-sorting' import yaml from 'js-yaml' import stripBom from 'strip-bom' import writeFileAtomic from 'write-file-atomic' + import { lockfileYamlDump } from './write.js' export function createEnvLockfile (): EnvLockfile { diff --git a/lockfile/fs/src/existsWantedLockfile.ts b/lockfile/fs/src/existsWantedLockfile.ts index 1e91591ebb..c6ff4ddf3a 100644 --- a/lockfile/fs/src/existsWantedLockfile.ts +++ b/lockfile/fs/src/existsWantedLockfile.ts @@ -1,5 +1,6 @@ import fs from 'fs' import path from 'path' + import { getWantedLockfileName } from './lockfileName.js' interface ExistsNonEmptyWantedLockfileOptions { diff --git a/lockfile/fs/src/getLockfileImporterId.ts b/lockfile/fs/src/getLockfileImporterId.ts index 667e13b015..ea7da01657 100644 --- a/lockfile/fs/src/getLockfileImporterId.ts +++ b/lockfile/fs/src/getLockfileImporterId.ts @@ -1,5 +1,6 @@ -import type { ProjectId } from '@pnpm/types' import path from 'path' + +import type { ProjectId } from '@pnpm/types' import normalize from 'normalize-path' export function getLockfileImporterId (lockfileDir: string, prefix: string): ProjectId { diff --git a/lockfile/fs/src/gitMergeFile.ts b/lockfile/fs/src/gitMergeFile.ts index 1bee9e1a24..1e0824b175 100644 --- a/lockfile/fs/src/gitMergeFile.ts +++ b/lockfile/fs/src/gitMergeFile.ts @@ -1,6 +1,7 @@ -import type { LockfileObject, LockfileFile } from '@pnpm/lockfile.types' import { mergeLockfileChanges } from '@pnpm/lockfile.merger' +import type { LockfileFile, LockfileObject } from '@pnpm/lockfile.types' import yaml from 'js-yaml' + import { convertToLockfileObject } from './lockfileFormatConverters.js' const MERGE_CONFLICT_PARENT = '|||||||' diff --git a/lockfile/fs/src/index.ts b/lockfile/fs/src/index.ts index 96afa09b41..718bb06d4c 100644 --- a/lockfile/fs/src/index.ts +++ b/lockfile/fs/src/index.ts @@ -1,14 +1,14 @@ -export { - isEmptyLockfile, - writeLockfiles, - writeCurrentLockfile, - writeWantedLockfile, - writeLockfileFile, -} from './write.js' +export { createEnvLockfile, readEnvLockfile, writeEnvLockfile } from './envLockfile.js' export { existsNonEmptyWantedLockfile } from './existsWantedLockfile.js' export { getLockfileImporterId } from './getLockfileImporterId.js' -export * from '@pnpm/lockfile.types' -export * from './read.js' export { cleanGitBranchLockfiles } from './gitBranchLockfile.js' export { convertToLockfileFile, convertToLockfileObject } from './lockfileFormatConverters.js' -export { createEnvLockfile, readEnvLockfile, writeEnvLockfile } from './envLockfile.js' +export * from './read.js' +export { + isEmptyLockfile, + writeCurrentLockfile, + writeLockfileFile, + writeLockfiles, + writeWantedLockfile, +} from './write.js' +export * from '@pnpm/lockfile.types' diff --git a/lockfile/fs/src/lockfileFormatConverters.ts b/lockfile/fs/src/lockfileFormatConverters.ts index fe959b8f7a..c2315b4603 100644 --- a/lockfile/fs/src/lockfileFormatConverters.ts +++ b/lockfile/fs/src/lockfileFormatConverters.ts @@ -1,18 +1,18 @@ +import { LOCKFILE_VERSION } from '@pnpm/constants' import { removeSuffix } from '@pnpm/dependency-path' import type { - LockfileObject, - ProjectSnapshot, - LockfilePackageSnapshot, - ResolvedDependencies, LockfileFile, - LockfileFileProjectSnapshot, LockfileFileProjectResolvedDependencies, + LockfileFileProjectSnapshot, + LockfileObject, LockfilePackageInfo, + LockfilePackageSnapshot, PackageSnapshots, + ProjectSnapshot, + ResolvedDependencies, } from '@pnpm/lockfile.types' -import { type DepPath, DEPENDENCIES_FIELDS } from '@pnpm/types' -import { isEmpty, map as _mapValues, omit, pickBy, pick } from 'ramda' -import { LOCKFILE_VERSION } from '@pnpm/constants' +import { DEPENDENCIES_FIELDS, type DepPath } from '@pnpm/types' +import { isEmpty, map as _mapValues, omit, pick, pickBy } from 'ramda' export function convertToLockfileFile (lockfile: LockfileObject): LockfileFile { const packages: Record = {} diff --git a/lockfile/fs/src/read.ts b/lockfile/fs/src/read.ts index 2516a39890..d4eecbb138 100644 --- a/lockfile/fs/src/read.ts +++ b/lockfile/fs/src/read.ts @@ -1,6 +1,7 @@ import { promises as fs } from 'fs' import path from 'path' import util from 'util' + import { LOCKFILE_VERSION, WANTED_LOCKFILE, @@ -13,12 +14,13 @@ import { comverToSemver } from 'comver-to-semver' import yaml from 'js-yaml' import semver from 'semver' import stripBom from 'strip-bom' + import { LockfileBreakingChangeError } from './errors/index.js' -import { autofixMergeConflicts, isDiff } from './gitMergeFile.js' -import { lockfileLogger as logger } from './logger.js' -import { getWantedLockfileName } from './lockfileName.js' import { getGitBranchLockfileNames } from './gitBranchLockfile.js' +import { autofixMergeConflicts, isDiff } from './gitMergeFile.js' import { convertToLockfileObject } from './lockfileFormatConverters.js' +import { getWantedLockfileName } from './lockfileName.js' +import { lockfileLogger as logger } from './logger.js' export async function readCurrentLockfile ( pnpmInternalDir: string, diff --git a/lockfile/fs/src/sortLockfileKeys.ts b/lockfile/fs/src/sortLockfileKeys.ts index 2f2d475005..b2847a9cc1 100644 --- a/lockfile/fs/src/sortLockfileKeys.ts +++ b/lockfile/fs/src/sortLockfileKeys.ts @@ -1,5 +1,5 @@ import type { LockfileFile } from '@pnpm/lockfile.types' -import { sortKeysByPriority, sortDirectKeys, sortDeepKeys } from '@pnpm/object.key-sorting' +import { sortDeepKeys, sortDirectKeys, sortKeysByPriority } from '@pnpm/object.key-sorting' const ORDERED_KEYS = { resolution: 1, diff --git a/lockfile/fs/src/write.ts b/lockfile/fs/src/write.ts index 9513ced84b..a4bcd135e1 100644 --- a/lockfile/fs/src/write.ts +++ b/lockfile/fs/src/write.ts @@ -1,15 +1,17 @@ import { promises as fs } from 'fs' import path from 'path' -import type { LockfileObject, LockfileFile } from '@pnpm/lockfile.types' + import { WANTED_LOCKFILE } from '@pnpm/constants' +import type { LockfileFile, LockfileObject } from '@pnpm/lockfile.types' import { rimraf } from '@zkochan/rimraf' import yaml from 'js-yaml' import { isEmpty } from 'ramda' import writeFileAtomic from 'write-file-atomic' + +import { convertToLockfileFile } from './lockfileFormatConverters.js' +import { getWantedLockfileName } from './lockfileName.js' import { lockfileLogger as logger } from './logger.js' import { sortLockfileKeys } from './sortLockfileKeys.js' -import { getWantedLockfileName } from './lockfileName.js' -import { convertToLockfileFile } from './lockfileFormatConverters.js' const LOCKFILE_YAML_FORMAT = { blankLines: true, diff --git a/lockfile/fs/test/gitBranchLockfile.test.ts b/lockfile/fs/test/gitBranchLockfile.test.ts index 5e26cfed64..50dd479046 100644 --- a/lockfile/fs/test/gitBranchLockfile.test.ts +++ b/lockfile/fs/test/gitBranchLockfile.test.ts @@ -1,4 +1,5 @@ import path from 'path' + import { getGitBranchLockfileNames } from '../lib/gitBranchLockfile.js' process.chdir(import.meta.dirname) diff --git a/lockfile/fs/test/lockfileName.test.ts b/lockfile/fs/test/lockfileName.test.ts index c2daa239d8..e40fd2fa4e 100644 --- a/lockfile/fs/test/lockfileName.test.ts +++ b/lockfile/fs/test/lockfileName.test.ts @@ -1,5 +1,5 @@ -import { WANTED_LOCKFILE } from '@pnpm/constants' import { jest } from '@jest/globals' +import { WANTED_LOCKFILE } from '@pnpm/constants' jest.unstable_mockModule('@pnpm/git-utils', () => ({ getCurrentBranch: jest.fn() })) diff --git a/lockfile/fs/test/normalizeLockfile.test.ts b/lockfile/fs/test/normalizeLockfile.test.ts index 64aafcbd76..463858aa35 100644 --- a/lockfile/fs/test/normalizeLockfile.test.ts +++ b/lockfile/fs/test/normalizeLockfile.test.ts @@ -1,5 +1,6 @@ import { LOCKFILE_VERSION } from '@pnpm/constants' import type { ProjectId } from '@pnpm/types' + import { convertToLockfileFile } from '../lib/lockfileFormatConverters.js' test('empty overrides and neverBuiltDependencies are removed during lockfile normalization', () => { diff --git a/lockfile/fs/test/read.test.ts b/lockfile/fs/test/read.test.ts index 2e1eead4c3..3f2ecdfcc9 100644 --- a/lockfile/fs/test/read.test.ts +++ b/lockfile/fs/test/read.test.ts @@ -1,6 +1,7 @@ import path from 'path' -import type { DepPath, ProjectId } from '@pnpm/types' + import { jest } from '@jest/globals' +import type { DepPath, ProjectId } from '@pnpm/types' import { temporaryDirectory } from 'tempy' jest.unstable_mockModule('@pnpm/git-utils', () => ({ getCurrentBranch: jest.fn() })) diff --git a/lockfile/fs/test/sortLockfileKeys.test.ts b/lockfile/fs/test/sortLockfileKeys.test.ts index bdd0ca6907..48601d32fd 100644 --- a/lockfile/fs/test/sortLockfileKeys.test.ts +++ b/lockfile/fs/test/sortLockfileKeys.test.ts @@ -1,4 +1,5 @@ import { LOCKFILE_VERSION } from '@pnpm/constants' + import { sortLockfileKeys } from '../lib/sortLockfileKeys.js' test('sorts keys alphabetically', () => { diff --git a/lockfile/fs/test/write.test.ts b/lockfile/fs/test/write.test.ts index f451fe2a99..ae8962ca04 100644 --- a/lockfile/fs/test/write.test.ts +++ b/lockfile/fs/test/write.test.ts @@ -1,7 +1,8 @@ import fs from 'fs' import path from 'path' -import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' + import { jest } from '@jest/globals' +import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' import { temporaryDirectory } from 'tempy' import yaml from 'yaml-tag' diff --git a/lockfile/lockfile-to-pnp/src/index.ts b/lockfile/lockfile-to-pnp/src/index.ts index 53f98dfeb5..e2b7c0809a 100644 --- a/lockfile/lockfile-to-pnp/src/index.ts +++ b/lockfile/lockfile-to-pnp/src/index.ts @@ -1,11 +1,12 @@ import { promises as fs } from 'fs' import path from 'path' + +import { depPathToFilename, refToRelative } from '@pnpm/dependency-path' import type { LockfileObject } from '@pnpm/lockfile.fs' import { nameVerFromPkgSnapshot, } from '@pnpm/lockfile.utils' import type { Registries } from '@pnpm/types' -import { depPathToFilename, refToRelative } from '@pnpm/dependency-path' import { generateInlinedScript, type PackageRegistry } from '@yarnpkg/pnp' import normalizePath from 'normalize-path' diff --git a/lockfile/lockfile-to-pnp/test/index.ts b/lockfile/lockfile-to-pnp/test/index.ts index 443d16e76c..0dbff6a43e 100644 --- a/lockfile/lockfile-to-pnp/test/index.ts +++ b/lockfile/lockfile-to-pnp/test/index.ts @@ -1,5 +1,6 @@ // cspell:ignore haspeer import path from 'path' + import { lockfileToPackageRegistry } from '@pnpm/lockfile-to-pnp' import type { DepPath, ProjectId } from '@pnpm/types' diff --git a/lockfile/merger/test/index.ts b/lockfile/merger/test/index.ts index 3ef8d2edd2..ca99b99023 100644 --- a/lockfile/merger/test/index.ts +++ b/lockfile/merger/test/index.ts @@ -1,5 +1,6 @@ import type { LockfileObject } from '@pnpm/lockfile.types' import type { DepPath, ProjectId } from '@pnpm/types' + import { mergeLockfileChanges } from '../src/index.js' const simpleLockfile = { diff --git a/lockfile/plugin-commands-audit/src/audit.ts b/lockfile/plugin-commands-audit/src/audit.ts index c016698d3d..db787fd102 100644 --- a/lockfile/plugin-commands-audit/src/audit.ts +++ b/lockfile/plugin-commands-audit/src/audit.ts @@ -1,16 +1,17 @@ -import { audit, type AuditLevelNumber, type AuditLevelString, type AuditReport, type AuditAdvisory, type AuditVulnerabilityCounts, type IgnoredAuditVulnerabilityCounts } from '@pnpm/audit' -import { createGetAuthHeaderByURI } from '@pnpm/network.auth-header' +import { audit, type AuditAdvisory, type AuditLevelNumber, type AuditLevelString, type AuditReport, type AuditVulnerabilityCounts, type IgnoredAuditVulnerabilityCounts } from '@pnpm/audit' import { docsUrl, TABLE_OPTIONS } from '@pnpm/cli-utils' import { type Config, types as allTypes, type UniversalOptions } from '@pnpm/config' import { WANTED_LOCKFILE } from '@pnpm/constants' import { PnpmError } from '@pnpm/error' import { readEnvLockfile, readWantedLockfile } from '@pnpm/lockfile.fs' +import { createGetAuthHeaderByURI } from '@pnpm/network.auth-header' +import { type InstallCommandOptions, update } from '@pnpm/plugin-commands-installation' import type { Registries } from '@pnpm/types' -import { update, type InstallCommandOptions } from '@pnpm/plugin-commands-installation' import { table } from '@zkochan/table' import chalk, { type ChalkInstance } from 'chalk' import { difference, pick, pickBy } from 'ramda' import { renderHelp } from 'render-help' + import { fix } from './fix.js' import { fixWithUpdate, type FixWithUpdateResult } from './fixWithUpdate.js' import { ignore } from './ignore.js' diff --git a/lockfile/plugin-commands-audit/src/fix.ts b/lockfile/plugin-commands-audit/src/fix.ts index 17ec6b3fa5..aa95b0b475 100644 --- a/lockfile/plugin-commands-audit/src/fix.ts +++ b/lockfile/plugin-commands-audit/src/fix.ts @@ -1,6 +1,7 @@ -import type { AuditReport, AuditAdvisory } from '@pnpm/audit' +import type { AuditAdvisory, AuditReport } from '@pnpm/audit' import { writeSettings } from '@pnpm/config.config-writer' import { difference } from 'ramda' + import type { AuditOptions } from './audit.js' export async function fix (auditReport: AuditReport, opts: AuditOptions): Promise> { diff --git a/lockfile/plugin-commands-audit/src/fixWithUpdate.ts b/lockfile/plugin-commands-audit/src/fixWithUpdate.ts index 2f0f075fee..c4ca51d010 100644 --- a/lockfile/plugin-commands-audit/src/fixWithUpdate.ts +++ b/lockfile/plugin-commands-audit/src/fixWithUpdate.ts @@ -1,15 +1,16 @@ import type { AuditReport } from '@pnpm/audit' -import type { - VulnerabilitySeverity, - PackageVulnerability, - PackageVulnerabilityAudit, - DependenciesField, -} from '@pnpm/types' -import { update } from '@pnpm/plugin-commands-installation' -import semver from 'semver' import { WANTED_LOCKFILE } from '@pnpm/constants' import { PnpmError } from '@pnpm/error' import { readWantedLockfile } from '@pnpm/lockfile.fs' +import { update } from '@pnpm/plugin-commands-installation' +import type { + DependenciesField, + PackageVulnerability, + PackageVulnerabilityAudit, + VulnerabilitySeverity, +} from '@pnpm/types' +import semver from 'semver' + import type { AuditOptions } from './audit.js' import { lockfileToPackages } from './lockfileToPackages.js' diff --git a/lockfile/plugin-commands-audit/src/ignore.ts b/lockfile/plugin-commands-audit/src/ignore.ts index 6e24d27b03..254ca63b77 100644 --- a/lockfile/plugin-commands-audit/src/ignore.ts +++ b/lockfile/plugin-commands-audit/src/ignore.ts @@ -1,6 +1,6 @@ import type { AuditAdvisory, AuditReport } from '@pnpm/audit' -import type { ProjectManifest, AuditConfig } from '@pnpm/types' import { writeSettings } from '@pnpm/config.config-writer' +import type { AuditConfig, ProjectManifest } from '@pnpm/types' import { difference } from 'ramda' export interface IgnoreVulnerabilitiesOptions { diff --git a/lockfile/plugin-commands-audit/test/fix.ts b/lockfile/plugin-commands-audit/test/fix.ts index f6c216aadf..e581847003 100644 --- a/lockfile/plugin-commands-audit/test/fix.ts +++ b/lockfile/plugin-commands-audit/test/fix.ts @@ -1,10 +1,12 @@ import path from 'path' -import { fixtures } from '@pnpm/test-fixtures' + import { audit } from '@pnpm/plugin-commands-audit' -import { readYamlFileSync } from 'read-yaml-file' +import { fixtures } from '@pnpm/test-fixtures' import nock from 'nock' +import { readYamlFileSync } from 'read-yaml-file' + +import { AUDIT_REGISTRY, AUDIT_REGISTRY_OPTS } from './utils/options.js' import * as responses from './utils/responses/index.js' -import { AUDIT_REGISTRY_OPTS, AUDIT_REGISTRY } from './utils/options.js' const f = fixtures(import.meta.dirname) diff --git a/lockfile/plugin-commands-audit/test/fixWithUpdate.ts b/lockfile/plugin-commands-audit/test/fixWithUpdate.ts index 77022576bd..c1e93a6a08 100644 --- a/lockfile/plugin-commands-audit/test/fixWithUpdate.ts +++ b/lockfile/plugin-commands-audit/test/fixWithUpdate.ts @@ -1,15 +1,17 @@ -import { join } from 'path' import { readFile } from 'fs/promises' -import { fixtures } from '@pnpm/test-fixtures' -import { audit } from '@pnpm/plugin-commands-audit' -import { readWantedLockfile } from '@pnpm/lockfile.fs' -import { readProjectManifest } from '@pnpm/read-project-manifest' +import { join } from 'path' + import { filterPackagesFromDir } from '@pnpm/filter-workspace-packages' -import type { DepPath } from '@pnpm/types' +import { readWantedLockfile } from '@pnpm/lockfile.fs' +import { audit } from '@pnpm/plugin-commands-audit' +import { readProjectManifest } from '@pnpm/read-project-manifest' import { addDistTag } from '@pnpm/registry-mock' +import { fixtures } from '@pnpm/test-fixtures' +import type { DepPath } from '@pnpm/types' import chalk from 'chalk' import nock from 'nock' import { readYamlFileSync } from 'read-yaml-file' + import { MOCK_REGISTRY, MOCK_REGISTRY_OPTS } from './utils/options.js' const f = fixtures(import.meta.dirname) diff --git a/lockfile/plugin-commands-audit/test/ignore.ts b/lockfile/plugin-commands-audit/test/ignore.ts index 3862f38206..2c405488b4 100644 --- a/lockfile/plugin-commands-audit/test/ignore.ts +++ b/lockfile/plugin-commands-audit/test/ignore.ts @@ -1,10 +1,12 @@ import path from 'path' -import { fixtures } from '@pnpm/test-fixtures' + import { audit } from '@pnpm/plugin-commands-audit' +import { fixtures } from '@pnpm/test-fixtures' import nock from 'nock' import { readYamlFileSync } from 'read-yaml-file' + +import { AUDIT_REGISTRY, AUDIT_REGISTRY_OPTS } from './utils/options.js' import * as responses from './utils/responses/index.js' -import { AUDIT_REGISTRY_OPTS, AUDIT_REGISTRY } from './utils/options.js' const f = fixtures(import.meta.dirname) diff --git a/lockfile/plugin-commands-audit/test/index.ts b/lockfile/plugin-commands-audit/test/index.ts index 12c48b03d9..ab740544f2 100644 --- a/lockfile/plugin-commands-audit/test/index.ts +++ b/lockfile/plugin-commands-audit/test/index.ts @@ -1,12 +1,14 @@ import path from 'path' -import { fixtures } from '@pnpm/test-fixtures' +import { stripVTControlCharacters as stripAnsi } from 'util' + +import { AuditEndpointNotExistsError } from '@pnpm/audit' import { audit } from '@pnpm/plugin-commands-audit' import { install } from '@pnpm/plugin-commands-installation' -import { AuditEndpointNotExistsError } from '@pnpm/audit' +import { fixtures } from '@pnpm/test-fixtures' import nock from 'nock' -import { stripVTControlCharacters as stripAnsi } from 'util' + +import { AUDIT_REGISTRY, AUDIT_REGISTRY_OPTS, DEFAULT_OPTS } from './utils/options.js' import * as responses from './utils/responses/index.js' -import { DEFAULT_OPTS, AUDIT_REGISTRY_OPTS, AUDIT_REGISTRY } from './utils/options.js' const f = fixtures(path.join(import.meta.dirname, 'fixtures')) diff --git a/lockfile/plugin-commands-audit/test/preserveReferenceOverrides.ts b/lockfile/plugin-commands-audit/test/preserveReferenceOverrides.ts index 01588cc21c..d296d9d80b 100644 --- a/lockfile/plugin-commands-audit/test/preserveReferenceOverrides.ts +++ b/lockfile/plugin-commands-audit/test/preserveReferenceOverrides.ts @@ -1,11 +1,13 @@ import path from 'path' + import { audit } from '@pnpm/plugin-commands-audit' -import { fixtures } from '@pnpm/test-fixtures' import { readProjectManifest } from '@pnpm/read-project-manifest' -import { readYamlFileSync } from 'read-yaml-file' +import { fixtures } from '@pnpm/test-fixtures' import nock from 'nock' +import { readYamlFileSync } from 'read-yaml-file' + +import { AUDIT_REGISTRY, AUDIT_REGISTRY_OPTS } from './utils/options.js' import * as responses from './utils/responses/index.js' -import { AUDIT_REGISTRY_OPTS, AUDIT_REGISTRY } from './utils/options.js' const f = fixtures(import.meta.dirname) diff --git a/lockfile/plugin-commands-audit/test/utils/responses/index.ts b/lockfile/plugin-commands-audit/test/utils/responses/index.ts index 86e249d2fc..b7de6dd383 100644 --- a/lockfile/plugin-commands-audit/test/utils/responses/index.ts +++ b/lockfile/plugin-commands-audit/test/utils/responses/index.ts @@ -1,4 +1,5 @@ import path from 'path' + import { loadJsonFileSync } from 'load-json-file' // eslint-disable-next-line diff --git a/lockfile/plugin-commands-audit/test/utils/responses/update.ts b/lockfile/plugin-commands-audit/test/utils/responses/update.ts index 4962bce160..7975f99b02 100644 --- a/lockfile/plugin-commands-audit/test/utils/responses/update.ts +++ b/lockfile/plugin-commands-audit/test/utils/responses/update.ts @@ -1,5 +1,6 @@ import fs from 'fs' import path from 'path' + import { audit } from '@pnpm/audit' import { readWantedLockfile } from '@pnpm/lockfile.fs' import { fixtures } from '@pnpm/test-fixtures' diff --git a/lockfile/pruner/src/index.ts b/lockfile/pruner/src/index.ts index 79758a00a5..ee21c6c38e 100644 --- a/lockfile/pruner/src/index.ts +++ b/lockfile/pruner/src/index.ts @@ -1,4 +1,5 @@ import { LOCKFILE_VERSION } from '@pnpm/constants' +import { refToRelative } from '@pnpm/dependency-path' import type { LockfileObject, PackageSnapshots, @@ -6,7 +7,6 @@ import type { ResolvedDependencies, } from '@pnpm/lockfile.types' import type { DepPath, PackageManifest, ProjectId } from '@pnpm/types' -import { refToRelative } from '@pnpm/dependency-path' import { difference, isEmpty, unnest } from 'ramda' export * from '@pnpm/lockfile.types' diff --git a/lockfile/settings-checker/src/calcPatchHashes.ts b/lockfile/settings-checker/src/calcPatchHashes.ts index 2573bfdda3..9a83af271b 100644 --- a/lockfile/settings-checker/src/calcPatchHashes.ts +++ b/lockfile/settings-checker/src/calcPatchHashes.ts @@ -1,5 +1,5 @@ -import { pMapValues } from 'p-map-values' import { createHexHashFromFile } from '@pnpm/crypto.hash' +import { pMapValues } from 'p-map-values' export async function calcPatchHashes (patches: Record): Promise> { return pMapValues(async (patchFilePath: string) => { diff --git a/lockfile/types/src/index.ts b/lockfile/types/src/index.ts index b6d4fcef16..d96c326f03 100644 --- a/lockfile/types/src/index.ts +++ b/lockfile/types/src/index.ts @@ -1,5 +1,5 @@ -import type { DependenciesMeta, DepPath, ProjectId } from '@pnpm/types' import type { PlatformAssetTarget } from '@pnpm/resolver-base' +import type { DependenciesMeta, DepPath, ProjectId } from '@pnpm/types' export type { ProjectId } diff --git a/lockfile/utils/src/index.ts b/lockfile/utils/src/index.ts index fc59f85ed2..a894bef614 100644 --- a/lockfile/utils/src/index.ts +++ b/lockfile/utils/src/index.ts @@ -4,7 +4,7 @@ export { nameVerFromPkgSnapshot } from './nameVerFromPkgSnapshot.js' export { packageIdFromSnapshot } from './packageIdFromSnapshot.js' export { packageIsIndependent } from './packageIsIndependent.js' export { pkgSnapshotToResolution } from './pkgSnapshotToResolution.js' -export { refIsLocalTarball, refIsLocalDirectory } from './refIsLocalTarball.js' +export { refIsLocalDirectory, refIsLocalTarball } from './refIsLocalTarball.js' export { toLockfileResolution } from './toLockfileResolution.js' export * from '@pnpm/lockfile.types' diff --git a/lockfile/utils/src/nameVerFromPkgSnapshot.ts b/lockfile/utils/src/nameVerFromPkgSnapshot.ts index 0bb0096dd6..0e46c68848 100644 --- a/lockfile/utils/src/nameVerFromPkgSnapshot.ts +++ b/lockfile/utils/src/nameVerFromPkgSnapshot.ts @@ -1,5 +1,5 @@ -import type { PackageSnapshot } from '@pnpm/lockfile.types' import * as dp from '@pnpm/dependency-path' +import type { PackageSnapshot } from '@pnpm/lockfile.types' import type { PkgResolutionId } from '@pnpm/types' export interface NameVer { diff --git a/lockfile/utils/src/packageIdFromSnapshot.ts b/lockfile/utils/src/packageIdFromSnapshot.ts index 5045735d76..ad14425e84 100644 --- a/lockfile/utils/src/packageIdFromSnapshot.ts +++ b/lockfile/utils/src/packageIdFromSnapshot.ts @@ -1,6 +1,6 @@ -import type { DepPath, PkgId } from '@pnpm/types' -import type { PackageSnapshot } from '@pnpm/lockfile.types' import * as dp from '@pnpm/dependency-path' +import type { PackageSnapshot } from '@pnpm/lockfile.types' +import type { DepPath, PkgId } from '@pnpm/types' export function packageIdFromSnapshot ( depPath: DepPath, diff --git a/lockfile/utils/src/pkgSnapshotToResolution.ts b/lockfile/utils/src/pkgSnapshotToResolution.ts index 02fbd1b99c..90c1a15fcc 100644 --- a/lockfile/utils/src/pkgSnapshotToResolution.ts +++ b/lockfile/utils/src/pkgSnapshotToResolution.ts @@ -1,9 +1,11 @@ import url from 'url' + import type { PackageSnapshot, TarballResolution } from '@pnpm/lockfile.types' +import { isGitHostedPkgUrl } from '@pnpm/pick-fetcher' import type { Resolution } from '@pnpm/resolver-base' import type { Registries } from '@pnpm/types' import getNpmTarballUrl from 'get-npm-tarball-url' -import { isGitHostedPkgUrl } from '@pnpm/pick-fetcher' + import { nameVerFromPkgSnapshot } from './nameVerFromPkgSnapshot.js' export function pkgSnapshotToResolution ( diff --git a/lockfile/verification/src/allCatalogsAreUpToDate.ts b/lockfile/verification/src/allCatalogsAreUpToDate.ts index 360b25f16a..7ab4856759 100644 --- a/lockfile/verification/src/allCatalogsAreUpToDate.ts +++ b/lockfile/verification/src/allCatalogsAreUpToDate.ts @@ -1,5 +1,5 @@ -import type { CatalogSnapshots } from '@pnpm/lockfile.types' import type { Catalogs } from '@pnpm/catalogs.types' +import type { CatalogSnapshots } from '@pnpm/lockfile.types' export function allCatalogsAreUpToDate ( catalogsConfig: Catalogs, diff --git a/lockfile/verification/src/allProjectsAreUpToDate.ts b/lockfile/verification/src/allProjectsAreUpToDate.ts index bc82a16c97..d4986966b1 100644 --- a/lockfile/verification/src/allProjectsAreUpToDate.ts +++ b/lockfile/verification/src/allProjectsAreUpToDate.ts @@ -7,11 +7,12 @@ import type { WorkspacePackages } from '@pnpm/resolver-base' import { DEPENDENCIES_FIELDS, type ProjectId } from '@pnpm/types' import pEvery from 'p-every' import { isEmpty } from 'ramda' + import { allCatalogsAreUpToDate } from './allCatalogsAreUpToDate.js' import { getWorkspacePackagesByDirectory } from './getWorkspacePackagesByDirectory.js' import { linkedPackagesAreUpToDate } from './linkedPackagesAreUpToDate.js' -import { satisfiesPackageManifest } from './satisfiesPackageManifest.js' import { localTarballDepsAreUpToDate } from './localTarballDepsAreUpToDate.js' +import { satisfiesPackageManifest } from './satisfiesPackageManifest.js' export async function allProjectsAreUpToDate ( projects: Array & { id: ProjectId }>, diff --git a/lockfile/verification/src/index.ts b/lockfile/verification/src/index.ts index ef8428c8b0..ecffbeaa7c 100644 --- a/lockfile/verification/src/index.ts +++ b/lockfile/verification/src/index.ts @@ -1,6 +1,6 @@ -export { allProjectsAreUpToDate } from './allProjectsAreUpToDate.js' export { allCatalogsAreUpToDate } from './allCatalogsAreUpToDate.js' +export { allProjectsAreUpToDate } from './allProjectsAreUpToDate.js' export { getWorkspacePackagesByDirectory } from './getWorkspacePackagesByDirectory.js' -export { localTarballDepsAreUpToDate } from './localTarballDepsAreUpToDate.js' export { linkedPackagesAreUpToDate } from './linkedPackagesAreUpToDate.js' +export { localTarballDepsAreUpToDate } from './localTarballDepsAreUpToDate.js' export { satisfiesPackageManifest } from './satisfiesPackageManifest.js' diff --git a/lockfile/verification/src/linkedPackagesAreUpToDate.ts b/lockfile/verification/src/linkedPackagesAreUpToDate.ts index 22b7e20234..2a6069ae6a 100644 --- a/lockfile/verification/src/linkedPackagesAreUpToDate.ts +++ b/lockfile/verification/src/linkedPackagesAreUpToDate.ts @@ -1,12 +1,13 @@ import path from 'path' + +import { refToRelative } from '@pnpm/dependency-path' import type { PackageSnapshot, - ProjectSnapshot, PackageSnapshots, + ProjectSnapshot, } from '@pnpm/lockfile.types' import { refIsLocalDirectory } from '@pnpm/lockfile.utils' import { safeReadPackageJsonFromDir } from '@pnpm/read-package-json' -import { refToRelative } from '@pnpm/dependency-path' import type { DirectoryResolution, WorkspacePackages } from '@pnpm/resolver-base' import { DEPENDENCIES_FIELDS, diff --git a/lockfile/verification/src/localTarballDepsAreUpToDate.ts b/lockfile/verification/src/localTarballDepsAreUpToDate.ts index af55cc3b2a..e0fb932da8 100644 --- a/lockfile/verification/src/localTarballDepsAreUpToDate.ts +++ b/lockfile/verification/src/localTarballDepsAreUpToDate.ts @@ -1,13 +1,14 @@ +import path from 'node:path' + import { getTarballIntegrity } from '@pnpm/crypto.hash' import * as dp from '@pnpm/dependency-path' import type { - ProjectSnapshot, PackageSnapshots, + ProjectSnapshot, TarballResolution, } from '@pnpm/lockfile.types' import { refIsLocalTarball } from '@pnpm/lockfile.utils' import { DEPENDENCIES_FIELDS } from '@pnpm/types' -import path from 'node:path' import pEvery from 'p-every' export interface LocalTarballDepsUpToDateContext { diff --git a/lockfile/verification/src/satisfiesPackageManifest.ts b/lockfile/verification/src/satisfiesPackageManifest.ts index fc22abad7b..656c226ef5 100644 --- a/lockfile/verification/src/satisfiesPackageManifest.ts +++ b/lockfile/verification/src/satisfiesPackageManifest.ts @@ -4,8 +4,9 @@ import { DEPENDENCIES_FIELDS, type ProjectManifest, } from '@pnpm/types' -import { equals, pickBy, omit } from 'ramda' +import { equals, omit, pickBy } from 'ramda' import semver from 'semver' + import { type Diff, diffFlatRecords, isEqual } from './diffFlatRecords.js' export function satisfiesPackageManifest ( diff --git a/lockfile/verification/test/allProjectsAreUpToDate.test.ts b/lockfile/verification/test/allProjectsAreUpToDate.test.ts index 6c9a5aee85..a71919401f 100644 --- a/lockfile/verification/test/allProjectsAreUpToDate.test.ts +++ b/lockfile/verification/test/allProjectsAreUpToDate.test.ts @@ -1,14 +1,15 @@ +import { createWriteStream } from 'fs' +import { mkdir, writeFile } from 'fs/promises' +import { pipeline } from 'stream/promises' + import { LOCKFILE_VERSION } from '@pnpm/constants' +import { getTarballIntegrity } from '@pnpm/crypto.hash' +import type { LockfileObject } from '@pnpm/lockfile.types' +import { allProjectsAreUpToDate } from '@pnpm/lockfile.verification' import { prepareEmpty } from '@pnpm/prepare' import type { WorkspacePackages } from '@pnpm/resolver-base' -import type { DepPath, DependencyManifest, ProjectId, ProjectRootDir } from '@pnpm/types' -import { allProjectsAreUpToDate } from '@pnpm/lockfile.verification' -import { createWriteStream } from 'fs' -import { writeFile, mkdir } from 'fs/promises' -import type { LockfileObject } from '@pnpm/lockfile.types' +import type { DependencyManifest, DepPath, ProjectId, ProjectRootDir } from '@pnpm/types' import tar from 'tar-stream' -import { pipeline } from 'stream/promises' -import { getTarballIntegrity } from '@pnpm/crypto.hash' const fooManifest = { name: 'foo', diff --git a/lockfile/walker/src/index.ts b/lockfile/walker/src/index.ts index 61b4bced26..2fe4655ec8 100644 --- a/lockfile/walker/src/index.ts +++ b/lockfile/walker/src/index.ts @@ -1,6 +1,6 @@ +import * as dp from '@pnpm/dependency-path' import type { LockfileObject, PackageSnapshot } from '@pnpm/lockfile.types' import type { DependenciesField, DepPath, ProjectId } from '@pnpm/types' -import * as dp from '@pnpm/dependency-path' export interface LockedDependency { depPath: DepPath diff --git a/modules-mounter/daemon/src/cli.ts b/modules-mounter/daemon/src/cli.ts index 5cdb6497db..589d275469 100644 --- a/modules-mounter/daemon/src/cli.ts +++ b/modules-mounter/daemon/src/cli.ts @@ -1,9 +1,10 @@ -import { getConfig } from '@pnpm/config' import { promises as fs } from 'fs' import path from 'path' +import { getConfig } from '@pnpm/config' import { getStorePath } from '@pnpm/store-path' import Fuse from 'fuse-native' + import { createFuseHandlers } from './createFuseHandlers.js' (async () => { const mnt = path.join(process.cwd(), 'node_modules') diff --git a/modules-mounter/daemon/src/createFuseHandlers.ts b/modules-mounter/daemon/src/createFuseHandlers.ts index 5f4d6dd387..bd9c524425 100644 --- a/modules-mounter/daemon/src/createFuseHandlers.ts +++ b/modules-mounter/daemon/src/createFuseHandlers.ts @@ -1,14 +1,16 @@ // cspell:ignore ents import fs from 'fs' -import { StoreIndex, storeIndexKey } from '@pnpm/store.index' -import { getFilePathByModeInCafs, type PackageFilesIndex } from '@pnpm/store.cafs' -import { type LockfileObject, readWantedLockfile, type PackageSnapshot, type TarballResolution } from '@pnpm/lockfile.fs' + +import { type LockfileObject, type PackageSnapshot, readWantedLockfile, type TarballResolution } from '@pnpm/lockfile.fs' import { nameVerFromPkgSnapshot, } from '@pnpm/lockfile.utils' +import { getFilePathByModeInCafs, type PackageFilesIndex } from '@pnpm/store.cafs' +import { StoreIndex, storeIndexKey } from '@pnpm/store.index' import type { DepPath } from '@pnpm/types' -import schemas from 'hyperdrive-schemas' import Fuse from 'fuse-native' +import schemas from 'hyperdrive-schemas' + import * as cafsExplorer from './cafsExplorer.js' import { makeVirtualNodeModules } from './makeVirtualNodeModules.js' diff --git a/modules-mounter/daemon/src/makeVirtualNodeModules.ts b/modules-mounter/daemon/src/makeVirtualNodeModules.ts index 2317a0e364..3828afc28d 100644 --- a/modules-mounter/daemon/src/makeVirtualNodeModules.ts +++ b/modules-mounter/daemon/src/makeVirtualNodeModules.ts @@ -1,8 +1,9 @@ import path from 'path' -import type { LockfileObject } from '@pnpm/lockfile.fs' -import { DEPENDENCIES_FIELDS, type ProjectId } from '@pnpm/types' -import { nameVerFromPkgSnapshot } from '@pnpm/lockfile.utils' + import * as dp from '@pnpm/dependency-path' +import type { LockfileObject } from '@pnpm/lockfile.fs' +import { nameVerFromPkgSnapshot } from '@pnpm/lockfile.utils' +import { DEPENDENCIES_FIELDS, type ProjectId } from '@pnpm/types' import normalize from 'normalize-path' interface DirDirEntry { diff --git a/modules-mounter/daemon/test/createFuseHandlers.test.ts b/modules-mounter/daemon/test/createFuseHandlers.test.ts index caeafa9dcc..86e90e7f05 100644 --- a/modules-mounter/daemon/test/createFuseHandlers.test.ts +++ b/modules-mounter/daemon/test/createFuseHandlers.test.ts @@ -1,7 +1,8 @@ -import { STORE_VERSION } from '@pnpm/constants' -import { jest } from '@jest/globals' import path from 'path' +import { jest } from '@jest/globals' +import { STORE_VERSION } from '@pnpm/constants' + jest.unstable_mockModule('fuse-native', () => ({ default: { ENOENT: -2 } })) const { default: Fuse } = await import('fuse-native') diff --git a/modules-mounter/daemon/test/makeVirtualNodeModules.test.ts b/modules-mounter/daemon/test/makeVirtualNodeModules.test.ts index c8dee457d1..31b7af4b15 100644 --- a/modules-mounter/daemon/test/makeVirtualNodeModules.test.ts +++ b/modules-mounter/daemon/test/makeVirtualNodeModules.test.ts @@ -1,5 +1,7 @@ import path from 'path' + import { readWantedLockfile } from '@pnpm/lockfile.fs' + import { makeVirtualNodeModules } from '../src/makeVirtualNodeModules.js' test('makeVirtualNodeModules', async () => { diff --git a/network/auth-header/src/getAuthHeadersFromConfig.ts b/network/auth-header/src/getAuthHeadersFromConfig.ts index e6ba957532..8aeb4bd5f8 100644 --- a/network/auth-header/src/getAuthHeadersFromConfig.ts +++ b/network/auth-header/src/getAuthHeadersFromConfig.ts @@ -1,9 +1,10 @@ -import { nerfDart } from '@pnpm/config.nerf-dart' -import { PnpmError } from '@pnpm/error' import { spawnSync } from 'child_process' import fs from 'fs' import path from 'path' +import { nerfDart } from '@pnpm/config.nerf-dart' +import { PnpmError } from '@pnpm/error' + export function getAuthHeadersFromConfig ( { allSettings, userSettings }: { allSettings: Record diff --git a/network/auth-header/src/index.ts b/network/auth-header/src/index.ts index db66ef597c..6a86c1edfb 100644 --- a/network/auth-header/src/index.ts +++ b/network/auth-header/src/index.ts @@ -1,4 +1,5 @@ import { nerfDart } from '@pnpm/config.nerf-dart' + import { getAuthHeadersFromConfig, loadToken } from './getAuthHeadersFromConfig.js' import { removePort } from './helpers/removePort.js' diff --git a/network/auth-header/test/getAuthHeadersFromConfig.test.ts b/network/auth-header/test/getAuthHeadersFromConfig.test.ts index 4dc7ed25dd..8b1c8fcddf 100644 --- a/network/auth-header/test/getAuthHeadersFromConfig.test.ts +++ b/network/auth-header/test/getAuthHeadersFromConfig.test.ts @@ -1,8 +1,10 @@ -import path from 'path' import os from 'os' -import { getAuthHeadersFromConfig } from '../src/getAuthHeadersFromConfig.js' +import path from 'path' + import { Buffer } from 'safe-buffer' +import { getAuthHeadersFromConfig } from '../src/getAuthHeadersFromConfig.js' + const osTokenHelper = { linux: path.join(import.meta.dirname, 'utils/test-exec.js'), win32: path.join(import.meta.dirname, 'utils/test-exec.bat'), diff --git a/network/fetch/src/fetch.ts b/network/fetch/src/fetch.ts index d133390929..f9326742b3 100644 --- a/network/fetch/src/fetch.ts +++ b/network/fetch/src/fetch.ts @@ -1,5 +1,6 @@ import assert from 'assert' import util from 'util' + import { requestRetryLogger } from '@pnpm/core-loggers' import { operation, type RetryTimeoutOptions } from '@zkochan/retry' import nodeFetch, { type Request, type RequestInit as NodeRequestInit, Response } from 'node-fetch' diff --git a/network/fetch/src/fetchFromRegistry.ts b/network/fetch/src/fetchFromRegistry.ts index 2697a61c44..b55c28aab0 100644 --- a/network/fetch/src/fetchFromRegistry.ts +++ b/network/fetch/src/fetchFromRegistry.ts @@ -1,8 +1,10 @@ import { URL } from 'url' -import type { SslConfig } from '@pnpm/types' + import type { FetchFromRegistry } from '@pnpm/fetching-types' -import { getAgent, type AgentOptions } from '@pnpm/network.agent' -import { fetch, isRedirect, type Response, type RequestInfo, type RequestInit } from './fetch.js' +import { type AgentOptions, getAgent } from '@pnpm/network.agent' +import type { SslConfig } from '@pnpm/types' + +import { fetch, isRedirect, type RequestInfo, type RequestInit, type Response } from './fetch.js' const USER_AGENT = 'pnpm' // or maybe make it `${pkg.name}/${pkg.version} (+https://npm.im/${pkg.name})` diff --git a/network/fetch/src/index.ts b/network/fetch/src/index.ts index 9caff1b8f0..f6db731293 100644 --- a/network/fetch/src/index.ts +++ b/network/fetch/src/index.ts @@ -1,3 +1,3 @@ -export type { FetchFromRegistry } from '@pnpm/fetching-types' export { fetch, type RetryTimeoutOptions } from './fetch.js' -export { createFetchFromRegistry, fetchWithAgent, type AgentOptions, type CreateFetchFromRegistryOptions } from './fetchFromRegistry.js' +export { type AgentOptions, createFetchFromRegistry, type CreateFetchFromRegistryOptions, fetchWithAgent } from './fetchFromRegistry.js' +export type { FetchFromRegistry } from '@pnpm/fetching-types' diff --git a/network/fetch/test/fetchFromRegistry.test.ts b/network/fetch/test/fetchFromRegistry.test.ts index ed587f5b0e..3fba6d6d87 100644 --- a/network/fetch/test/fetchFromRegistry.test.ts +++ b/network/fetch/test/fetchFromRegistry.test.ts @@ -1,9 +1,10 @@ /// -import path from 'path' -import { createFetchFromRegistry } from '@pnpm/fetch' -import nock from 'nock' -import { ProxyServer } from 'https-proxy-server-express' import fs from 'fs' +import path from 'path' + +import { createFetchFromRegistry } from '@pnpm/fetch' +import { ProxyServer } from 'https-proxy-server-express' +import nock from 'nock' const CERTS_DIR = path.join(import.meta.dirname, '__certs__') diff --git a/network/fetching-types/src/index.ts b/network/fetching-types/src/index.ts index 579ad4bab6..526ef95f5f 100644 --- a/network/fetching-types/src/index.ts +++ b/network/fetching-types/src/index.ts @@ -1,7 +1,7 @@ import type { RetryTimeoutOptions } from '@zkochan/retry' -import type { Response, RequestInit as NodeRequestInit } from 'node-fetch' +import type { RequestInit as NodeRequestInit, Response } from 'node-fetch' -export type { RetryTimeoutOptions, Response } +export type { Response, RetryTimeoutOptions } export interface RequestInit extends NodeRequestInit { retry?: RetryTimeoutOptions diff --git a/object/property-path/src/index.ts b/object/property-path/src/index.ts index 40670f8958..b2ca238e12 100644 --- a/object/property-path/src/index.ts +++ b/object/property-path/src/index.ts @@ -1,3 +1,3 @@ -export * from './token/index.js' -export * from './parse.js' export * from './get.js' +export * from './parse.js' +export * from './token/index.js' diff --git a/object/property-path/src/parse.ts b/object/property-path/src/parse.ts index f02b29d575..30bf46e6ab 100644 --- a/object/property-path/src/parse.ts +++ b/object/property-path/src/parse.ts @@ -1,12 +1,14 @@ import assert from 'assert/strict' + import { PnpmError } from '@pnpm/error' + import { type ExactToken, type Identifier, type NumericLiteral, type StringLiteral, - type UnexpectedToken, tokenize, + type UnexpectedToken, } from './token/index.js' export class UnexpectedTokenError | UnexpectedToken> extends PnpmError { diff --git a/object/property-path/src/token/index.ts b/object/property-path/src/token/index.ts index 027749767d..2b5cd404fd 100644 --- a/object/property-path/src/token/index.ts +++ b/object/property-path/src/token/index.ts @@ -1,10 +1,9 @@ +export * from './combine.js' export * from './ExactToken.js' export * from './Identifier.js' export * from './NumericLiteral.js' -export * from './StringLiteral.js' -export * from './Whitespace.js' - export * from './ParseErrorBase.js' -export * from './combine.js' +export * from './StringLiteral.js' export * from './tokenize.js' export * from './types.js' +export * from './Whitespace.js' diff --git a/object/property-path/src/token/tokenize.ts b/object/property-path/src/token/tokenize.ts index 2f744e6399..0c486c9019 100644 --- a/object/property-path/src/token/tokenize.ts +++ b/object/property-path/src/token/tokenize.ts @@ -1,10 +1,10 @@ +import { combineParsers } from './combine.js' import { type ExactToken, parseCloseBracket, parseDotOperator, parseOpenBracket } from './ExactToken.js' import { type Identifier, parseIdentifier } from './Identifier.js' import { type NumericLiteral, parseNumericLiteral } from './NumericLiteral.js' -import { type StringLiteral, parseStringLiteral } from './StringLiteral.js' -import { type Whitespace, parseWhitespace } from './Whitespace.js' -import { combineParsers } from './combine.js' +import { parseStringLiteral, type StringLiteral } from './StringLiteral.js' import type { TokenBase, Tokenize } from './types.js' +import { parseWhitespace, type Whitespace } from './Whitespace.js' export type ExpectedToken = | ExactToken<'.'> diff --git a/object/property-path/test/parse.test.ts b/object/property-path/test/parse.test.ts index 889c00b9c2..6ad07da3a1 100644 --- a/object/property-path/test/parse.test.ts +++ b/object/property-path/test/parse.test.ts @@ -1,11 +1,11 @@ import { type ExactToken, + parsePropertyPath, type UnexpectedEndOfInputError, type UnexpectedIdentifierError, type UnexpectedLiteralError, type UnexpectedToken, type UnexpectedTokenError, - parsePropertyPath, } from '../src/index.js' test('valid property path', () => { diff --git a/object/property-path/test/token/StringLiteral.test.ts b/object/property-path/test/token/StringLiteral.test.ts index 7f5832c4e7..f4f0132784 100644 --- a/object/property-path/test/token/StringLiteral.test.ts +++ b/object/property-path/test/token/StringLiteral.test.ts @@ -1,4 +1,4 @@ -import { type StringLiteral, parseStringLiteral } from '../../src/index.js' +import { parseStringLiteral, type StringLiteral } from '../../src/index.js' test('not a string literal', () => { expect(parseStringLiteral('')).toBeUndefined() diff --git a/packages/calc-dep-state/src/index.ts b/packages/calc-dep-state/src/index.ts index ac75ed26db..44c66c657a 100644 --- a/packages/calc-dep-state/src/index.ts +++ b/packages/calc-dep-state/src/index.ts @@ -1,9 +1,9 @@ import { ENGINE_NAME } from '@pnpm/constants' +import { hashObject, hashObjectWithoutSorting } from '@pnpm/crypto.object-hasher' import { getPkgIdWithPatchHash, refToRelative } from '@pnpm/dependency-path' -import type { AllowBuild, DepPath, PkgIdWithPatchHash } from '@pnpm/types' -import { hashObjectWithoutSorting, hashObject } from '@pnpm/crypto.object-hasher' -import type { LockfileResolution, LockfileObject, PackageSnapshot } from '@pnpm/lockfile.types' +import type { LockfileObject, LockfileResolution, PackageSnapshot } from '@pnpm/lockfile.types' import { nameVerFromPkgSnapshot } from '@pnpm/lockfile.utils' +import type { AllowBuild, DepPath, PkgIdWithPatchHash } from '@pnpm/types' export type DepsGraph = Record> diff --git a/packages/calc-dep-state/test/calcGraphNodeHash.test.ts b/packages/calc-dep-state/test/calcGraphNodeHash.test.ts index 8da6cea9c1..fa18b8964c 100644 --- a/packages/calc-dep-state/test/calcGraphNodeHash.test.ts +++ b/packages/calc-dep-state/test/calcGraphNodeHash.test.ts @@ -1,6 +1,6 @@ import { calcGraphNodeHash, type DepsGraph, type DepsStateCache, type PkgMeta } from '@pnpm/calc-dep-state' import { ENGINE_NAME } from '@pnpm/constants' -import { hashObjectWithoutSorting, hashObject } from '@pnpm/crypto.object-hasher' +import { hashObject, hashObjectWithoutSorting } from '@pnpm/crypto.object-hasher' import type { DepPath, PkgIdWithPatchHash } from '@pnpm/types' describe('calcGraphNodeHash', () => { diff --git a/packages/core-loggers/src/all.ts b/packages/core-loggers/src/all.ts index 9fbec573c6..dcd5f8d646 100644 --- a/packages/core-loggers/src/all.ts +++ b/packages/core-loggers/src/all.ts @@ -1,10 +1,11 @@ export * from './contextLogger.js' export * from './deprecationLogger.js' +export * from './executionTimeLogger.js' export * from './fetchingProgressLogger.js' export * from './hookLogger.js' +export * from './ignoredScriptsLogger.js' export * from './installCheckLogger.js' export * from './installingConfigDeps.js' -export * from './ignoredScriptsLogger.js' export * from './lifecycleLogger.js' export * from './linkLogger.js' export * from './packageImportMethodLogger.js' @@ -21,4 +22,3 @@ export * from './stageLogger.js' export * from './statsLogger.js' export * from './summaryLogger.js' export * from './updateCheckLogger.js' -export * from './executionTimeLogger.js' diff --git a/packages/core-loggers/src/index.ts b/packages/core-loggers/src/index.ts index 0268018327..9dfce3ff69 100644 --- a/packages/core-loggers/src/index.ts +++ b/packages/core-loggers/src/index.ts @@ -1,12 +1,12 @@ import type { ContextLog, DeprecationLog, - FetchingProgressLog, ExecutionTimeLog, + FetchingProgressLog, HookLog, + IgnoredScriptsLog, InstallCheckLog, InstallingConfigDepsLog, - IgnoredScriptsLog, LifecycleLog, LinkLog, PackageImportMethodLog, diff --git a/packages/dependency-path/src/index.ts b/packages/dependency-path/src/index.ts index ddeb56fe49..0deebc4e18 100644 --- a/packages/dependency-path/src/index.ts +++ b/packages/dependency-path/src/index.ts @@ -1,5 +1,5 @@ import { createShortHash } from '@pnpm/crypto.hash' -import type { DepPath, PkgResolutionId, Registries, PkgId, PkgIdWithPatchHash } from '@pnpm/types' +import type { DepPath, PkgId, PkgIdWithPatchHash, PkgResolutionId, Registries } from '@pnpm/types' import semver from 'semver' export function isAbsolute (dependencyPath: string): boolean { diff --git a/packages/dependency-path/test/index.ts b/packages/dependency-path/test/index.ts index d2f4912e4f..2062cce4bb 100644 --- a/packages/dependency-path/test/index.ts +++ b/packages/dependency-path/test/index.ts @@ -3,11 +3,11 @@ import { depPathToFilename, getPkgIdWithPatchHash, isAbsolute, + isRuntimeDepPath, parse, refToRelative, - tryGetPackageId, - isRuntimeDepPath, removeSuffix, + tryGetPackageId, } from '@pnpm/dependency-path' import type { DepPath } from '@pnpm/types' diff --git a/packages/git-utils/test/index.test.ts b/packages/git-utils/test/index.test.ts index 6e105e4e06..21f5be0e67 100644 --- a/packages/git-utils/test/index.test.ts +++ b/packages/git-utils/test/index.test.ts @@ -1,8 +1,9 @@ -import { temporaryDirectory } from 'tempy' -import { safeExeca as execa } from 'execa' import fs from 'fs' import path from 'path' + import { getCurrentBranch, isGitRepo, isWorkingTreeClean } from '@pnpm/git-utils' +import { safeExeca as execa } from 'execa' +import { temporaryDirectory } from 'tempy' test('isGitRepo', async () => { const tempDir = temporaryDirectory() diff --git a/packages/logger/src/index.ts b/packages/logger/src/index.ts index f74714b158..f4464ea431 100644 --- a/packages/logger/src/index.ts +++ b/packages/logger/src/index.ts @@ -1,4 +1,3 @@ -export { type LogLevel } from './LogLevel.js' export { type LogBase, type LogBaseDebug, @@ -7,15 +6,16 @@ export { type LogBaseWarn, } from './LogBase.js' export { - type Logger, - logger, globalInfo, globalWarn, + type Logger, + logger, } from './logger.js' +export { type LogLevel } from './LogLevel.js' export { + createStreamParser, type Reporter, type StreamParser, - createStreamParser, streamParser, } from './streamParser.js' export { writeToConsole } from './writeToConsole.js' diff --git a/packages/logger/src/streamParser.ts b/packages/logger/src/streamParser.ts index 79034db25c..fe493635e6 100644 --- a/packages/logger/src/streamParser.ts +++ b/packages/logger/src/streamParser.ts @@ -1,4 +1,5 @@ import bole from 'bole' + import type { LogBase } from './LogBase.js' import * as ndjson from './ndjsonParse.js' diff --git a/packages/make-dedicated-lockfile/src/bin.ts b/packages/make-dedicated-lockfile/src/bin.ts index bbef882360..3ed869a2ff 100644 --- a/packages/make-dedicated-lockfile/src/bin.ts +++ b/packages/make-dedicated-lockfile/src/bin.ts @@ -1,5 +1,6 @@ import { PnpmError } from '@pnpm/error' import { findWorkspaceDir } from '@pnpm/find-workspace-dir' + import { makeDedicatedLockfile } from './index.js' main() diff --git a/packages/make-dedicated-lockfile/src/index.ts b/packages/make-dedicated-lockfile/src/index.ts index f9b677271b..143a8ab227 100644 --- a/packages/make-dedicated-lockfile/src/index.ts +++ b/packages/make-dedicated-lockfile/src/index.ts @@ -1,4 +1,5 @@ import path from 'path' + import pnpmExec from '@pnpm/exec' import { createExportableManifest } from '@pnpm/exportable-manifest' import { diff --git a/packages/make-dedicated-lockfile/test/index.ts b/packages/make-dedicated-lockfile/test/index.ts index 36c29efc38..15521ff5e2 100644 --- a/packages/make-dedicated-lockfile/test/index.ts +++ b/packages/make-dedicated-lockfile/test/index.ts @@ -1,7 +1,9 @@ import path from 'path' -import { safeExeca as execa } from 'execa' + import { readWantedLockfile } from '@pnpm/lockfile.fs' import { fixtures } from '@pnpm/test-fixtures' +import { safeExeca as execa } from 'execa' + import { makeDedicatedLockfile } from '../lib/index.js' const f = fixtures(import.meta.dirname) diff --git a/packages/plugin-commands-doctor/src/doctor.ts b/packages/plugin-commands-doctor/src/doctor.ts index f3ae279297..caf0e44628 100644 --- a/packages/plugin-commands-doctor/src/doctor.ts +++ b/packages/plugin-commands-doctor/src/doctor.ts @@ -1,7 +1,7 @@ -import { renderHelp } from 'render-help' import { docsUrl } from '@pnpm/cli-utils' -import { logger } from '@pnpm/logger' import type { Config } from '@pnpm/config' +import { logger } from '@pnpm/logger' +import { renderHelp } from 'render-help' export const rcOptionsTypes = cliOptionsTypes diff --git a/packages/plugin-commands-doctor/test/index.ts b/packages/plugin-commands-doctor/test/index.ts index 312c13de36..a0a7bcf3b4 100644 --- a/packages/plugin-commands-doctor/test/index.ts +++ b/packages/plugin-commands-doctor/test/index.ts @@ -1,6 +1,6 @@ -import { doctor } from '@pnpm/plugin-commands-doctor' -import { logger } from '@pnpm/logger' import { jest } from '@jest/globals' +import { logger } from '@pnpm/logger' +import { doctor } from '@pnpm/plugin-commands-doctor' beforeEach(() => { jest.spyOn(logger, 'warn') diff --git a/packages/plugin-commands-init/src/init.ts b/packages/plugin-commands-init/src/init.ts index 259c5fb97f..39cbfdbdc3 100644 --- a/packages/plugin-commands-init/src/init.ts +++ b/packages/plugin-commands-init/src/init.ts @@ -1,14 +1,16 @@ import fs from 'fs' import path from 'path' -import { docsUrl } from '@pnpm/cli-utils' + import { packageManager } from '@pnpm/cli-meta' -import { types as allTypes, type Config, type UniversalOptions } from '@pnpm/config' +import { docsUrl } from '@pnpm/cli-utils' +import { type Config, types as allTypes, type UniversalOptions } from '@pnpm/config' import { PnpmError } from '@pnpm/error' import { sortKeysByPriority } from '@pnpm/object.key-sorting' import type { ProjectManifest } from '@pnpm/types' import { writeProjectManifest } from '@pnpm/write-project-manifest' import { pick } from 'ramda' import { renderHelp } from 'render-help' + import { parseRawConfig } from './utils.js' export const rcOptionsTypes = cliOptionsTypes diff --git a/packages/plugin-commands-init/src/utils.ts b/packages/plugin-commands-init/src/utils.ts index abb06377e3..06ad29e70b 100644 --- a/packages/plugin-commands-init/src/utils.ts +++ b/packages/plugin-commands-init/src/utils.ts @@ -1,7 +1,8 @@ -import path from 'path' import { spawnSync } from 'child_process' -import camelcaseKeys from 'camelcase-keys' import fs from 'fs' +import path from 'path' + +import camelcaseKeys from 'camelcase-keys' export interface Person { name?: string diff --git a/packages/plugin-commands-init/test/init.test.ts b/packages/plugin-commands-init/test/init.test.ts index 9b4ee5e2a9..d0858cf7b1 100644 --- a/packages/plugin-commands-init/test/init.test.ts +++ b/packages/plugin-commands-init/test/init.test.ts @@ -1,5 +1,6 @@ -import path from 'path' import fs from 'fs' +import path from 'path' + import { init } from '@pnpm/plugin-commands-init' import { prepare, prepareEmpty } from '@pnpm/prepare' import type { ProjectManifest } from '@pnpm/types' diff --git a/packages/plugin-commands-init/test/utils.test.ts b/packages/plugin-commands-init/test/utils.test.ts index e82fcfefaa..f69f4be1f5 100644 --- a/packages/plugin-commands-init/test/utils.test.ts +++ b/packages/plugin-commands-init/test/utils.test.ts @@ -1,7 +1,9 @@ -import { fixtures } from '@pnpm/test-fixtures' import fs from 'fs' import path from 'path' -import { workWithInitModule, personToString } from '../lib/utils.js' + +import { fixtures } from '@pnpm/test-fixtures' + +import { personToString, workWithInitModule } from '../lib/utils.js' const f = fixtures(path.join(import.meta.dirname, '../fixtures')) diff --git a/packages/plugin-commands-setup/src/setup.ts b/packages/plugin-commands-setup/src/setup.ts index 5a1892dfc4..dfd580f480 100644 --- a/packages/plugin-commands-setup/src/setup.ts +++ b/packages/plugin-commands-setup/src/setup.ts @@ -1,6 +1,7 @@ import { spawnSync } from 'child_process' import fs from 'fs' import path from 'path' + import { detectIfCurrentPkgIsExecutable, packageManager } from '@pnpm/cli-meta' import { docsUrl } from '@pnpm/cli-utils' import { logger } from '@pnpm/logger' diff --git a/packages/plugin-commands-setup/test/setup.test.ts b/packages/plugin-commands-setup/test/setup.test.ts index ef31c384c0..e6e7fdaff1 100644 --- a/packages/plugin-commands-setup/test/setup.test.ts +++ b/packages/plugin-commands-setup/test/setup.test.ts @@ -1,5 +1,5 @@ -import { PnpmError } from '@pnpm/error' import { jest } from '@jest/globals' +import { PnpmError } from '@pnpm/error' import type { PathExtenderReport } from '@pnpm/os.env.path-extender' jest.unstable_mockModule('@pnpm/os.env.path-extender', () => ({ diff --git a/packages/render-peer-issues/src/index.ts b/packages/render-peer-issues/src/index.ts index 384a9aa7ee..5dea0c7b21 100644 --- a/packages/render-peer-issues/src/index.ts +++ b/packages/render-peer-issues/src/index.ts @@ -1,8 +1,8 @@ +import { renderTree, type TreeNode } from '@pnpm/text.tree-renderer' import type { BadPeerDependencyIssue, PeerDependencyIssuesByProjects, } from '@pnpm/types' -import { renderTree, type TreeNode } from '@pnpm/text.tree-renderer' import chalk from 'chalk' import cliColumns from 'cli-columns' diff --git a/packages/render-peer-issues/test/index.ts b/packages/render-peer-issues/test/index.ts index 1f0a56d0f2..488bda81b3 100644 --- a/packages/render-peer-issues/test/index.ts +++ b/packages/render-peer-issues/test/index.ts @@ -1,6 +1,7 @@ -import { renderPeerIssues } from '@pnpm/render-peer-issues' import { stripVTControlCharacters as stripAnsi } from 'util' +import { renderPeerIssues } from '@pnpm/render-peer-issues' + test('renderPeerIssues()', () => { expect(stripAnsi(renderPeerIssues({ 'packages/0': { diff --git a/patching/apply-patch/test/applyPatchToDir.ts b/patching/apply-patch/test/applyPatchToDir.ts index 2bf683309d..b5e40b0ae4 100644 --- a/patching/apply-patch/test/applyPatchToDir.ts +++ b/patching/apply-patch/test/applyPatchToDir.ts @@ -1,8 +1,9 @@ import fs from 'fs' import path from 'path' -import { fixtures } from '@pnpm/test-fixtures' -import { tempDir } from '@pnpm/prepare' + import { jest } from '@jest/globals' +import { tempDir } from '@pnpm/prepare' +import { fixtures } from '@pnpm/test-fixtures' const f = fixtures(import.meta.dirname) diff --git a/patching/config/src/index.ts b/patching/config/src/index.ts index 233b390827..6af614aa35 100644 --- a/patching/config/src/index.ts +++ b/patching/config/src/index.ts @@ -1,10 +1,10 @@ +export { getPatchInfo } from './getPatchInfo.js' +export { groupPatchedDependencies } from './groupPatchedDependencies.js' +export { verifyPatches, type VerifyPatchesOptions } from './verifyPatches.js' export { type ExtendedPatchInfo, - type PatchInfo, type PatchGroup, type PatchGroupRangeItem, type PatchGroupRecord, + type PatchInfo, } from '@pnpm/patching.types' -export { groupPatchedDependencies } from './groupPatchedDependencies.js' -export { getPatchInfo } from './getPatchInfo.js' -export { type VerifyPatchesOptions, verifyPatches } from './verifyPatches.js' diff --git a/patching/config/src/verifyPatches.ts b/patching/config/src/verifyPatches.ts index b66ffd8a49..565262cdf8 100644 --- a/patching/config/src/verifyPatches.ts +++ b/patching/config/src/verifyPatches.ts @@ -1,6 +1,7 @@ import { PnpmError } from '@pnpm/error' import { globalWarn } from '@pnpm/logger' import type { PatchGroupRecord } from '@pnpm/patching.types' + import { allPatchKeys } from './allPatchKeys.js' export interface VerifyPatchesOptions { diff --git a/patching/config/test/groupPatchedDependencies.test.ts b/patching/config/test/groupPatchedDependencies.test.ts index 52d54083c0..88be3701fd 100644 --- a/patching/config/test/groupPatchedDependencies.test.ts +++ b/patching/config/test/groupPatchedDependencies.test.ts @@ -1,4 +1,5 @@ import type { ExtendedPatchInfo, PatchGroupRecord } from '@pnpm/patching.types' + import { groupPatchedDependencies } from '../src/groupPatchedDependencies.js' function sanitizePatchGroupRecord (patchGroups: PatchGroupRecord): PatchGroupRecord { diff --git a/patching/plugin-commands-patching/src/getEditDirPath.ts b/patching/plugin-commands-patching/src/getEditDirPath.ts index 2b2dd31cd8..4c9d96c148 100644 --- a/patching/plugin-commands-patching/src/getEditDirPath.ts +++ b/patching/plugin-commands-patching/src/getEditDirPath.ts @@ -1,4 +1,5 @@ import path from 'path' + import type { ParseWantedDependencyResult } from '@pnpm/parse-wanted-dependency' export interface GetEditDirOptions { diff --git a/patching/plugin-commands-patching/src/getPatchedDependency.ts b/patching/plugin-commands-patching/src/getPatchedDependency.ts index 0af0134a08..5453848f97 100644 --- a/patching/plugin-commands-patching/src/getPatchedDependency.ts +++ b/patching/plugin-commands-patching/src/getPatchedDependency.ts @@ -1,13 +1,14 @@ import path from 'path' -import { parseWantedDependency, type ParseWantedDependencyResult } from '@pnpm/parse-wanted-dependency' -import enquirer from 'enquirer' + +import type { Config } from '@pnpm/config' +import { PnpmError } from '@pnpm/error' import { readCurrentLockfile, type TarballResolution } from '@pnpm/lockfile.fs' import { nameVerFromPkgSnapshot } from '@pnpm/lockfile.utils' -import { PnpmError } from '@pnpm/error' +import { parseWantedDependency, type ParseWantedDependencyResult } from '@pnpm/parse-wanted-dependency' import { isGitHostedPkgUrl } from '@pnpm/pick-fetcher' +import enquirer from 'enquirer' import { realpathMissing } from 'realpath-missing' import semver from 'semver' -import type { Config } from '@pnpm/config' export type GetPatchedDependencyOptions = { lockfileDir: string diff --git a/patching/plugin-commands-patching/src/patch.ts b/patching/plugin-commands-patching/src/patch.ts index 856fc781b2..756a87cb8f 100644 --- a/patching/plugin-commands-patching/src/patch.ts +++ b/patching/plugin-commands-patching/src/patch.ts @@ -1,22 +1,24 @@ import fs from 'fs' import path from 'path' -import { applyPatchToDir } from '@pnpm/patching.apply-patch' + import { docsUrl } from '@pnpm/cli-utils' import { type Config, types as allTypes } from '@pnpm/config' +import { PnpmError } from '@pnpm/error' import type { LogBase } from '@pnpm/logger' +import { applyPatchToDir } from '@pnpm/patching.apply-patch' import type { CreateStoreControllerOptions, } from '@pnpm/store-connection-manager' +import chalk from 'chalk' +import isWindows from 'is-windows' import { pick } from 'ramda' import { renderHelp } from 'render-help' -import chalk from 'chalk' import terminalLink from 'terminal-link' -import { PnpmError } from '@pnpm/error' -import { writePackage } from './writePackage.js' + import { getEditDirPath } from './getEditDirPath.js' -import { type GetPatchedDependencyResult, getPatchedDependency } from './getPatchedDependency.js' +import { getPatchedDependency, type GetPatchedDependencyResult } from './getPatchedDependency.js' import { writeEditDirState } from './stateFile.js' -import isWindows from 'is-windows' +import { writePackage } from './writePackage.js' export function rcOptionsTypes (): Record { return pick([], allTypes) diff --git a/patching/plugin-commands-patching/src/patchCommit.ts b/patching/plugin-commands-patching/src/patchCommit.ts index f9bee6e03a..7b43d7edfb 100644 --- a/patching/plugin-commands-patching/src/patchCommit.ts +++ b/patching/plugin-commands-patching/src/patchCommit.ts @@ -1,27 +1,29 @@ import fs from 'fs' import path from 'path' + import { docsUrl } from '@pnpm/cli-utils' import { type Config, types as allTypes } from '@pnpm/config' import { createShortHash } from '@pnpm/crypto.hash' import { PnpmError } from '@pnpm/error' import { packlist } from '@pnpm/fs.packlist' import { globalWarn } from '@pnpm/logger' +import { parseWantedDependency, type ParseWantedDependencyResult } from '@pnpm/parse-wanted-dependency' import { install } from '@pnpm/plugin-commands-installation' import { readPackageJsonFromDir } from '@pnpm/read-package-json' import { getStorePath } from '@pnpm/store-path' import type { ProjectRootDir } from '@pnpm/types' -import { glob } from 'tinyglobby' -import normalizePath from 'normalize-path' -import { pick, equals } from 'ramda' -import { safeExeca as execa } from 'safe-execa' import escapeStringRegexp from 'escape-string-regexp' import { makeEmptyDir } from 'make-empty-dir' +import normalizePath from 'normalize-path' +import { equals, pick } from 'ramda' import { renderHelp } from 'render-help' -import { type WritePackageOptions, writePackage } from './writePackage.js' -import { type ParseWantedDependencyResult, parseWantedDependency } from '@pnpm/parse-wanted-dependency' +import { safeExeca as execa } from 'safe-execa' +import { glob } from 'tinyglobby' + import { type GetPatchedDependencyOptions, getVersionsFromLockfile } from './getPatchedDependency.js' import { readEditDirState } from './stateFile.js' import { updatePatchedDependencies } from './updatePatchedDependencies.js' +import { writePackage, type WritePackageOptions } from './writePackage.js' export const rcOptionsTypes = cliOptionsTypes diff --git a/patching/plugin-commands-patching/src/patchRemove.ts b/patching/plugin-commands-patching/src/patchRemove.ts index 17e04518b6..9dde4f39a1 100644 --- a/patching/plugin-commands-patching/src/patchRemove.ts +++ b/patching/plugin-commands-patching/src/patchRemove.ts @@ -1,12 +1,14 @@ -import path from 'path' import fs from 'fs/promises' +import path from 'path' + import { docsUrl } from '@pnpm/cli-utils' -import { install } from '@pnpm/plugin-commands-installation' import { type Config, types as allTypes } from '@pnpm/config' import { PnpmError } from '@pnpm/error' -import { renderHelp } from 'render-help' +import { install } from '@pnpm/plugin-commands-installation' import enquirer from 'enquirer' import { pick } from 'ramda' +import { renderHelp } from 'render-help' + import { updatePatchedDependencies } from './updatePatchedDependencies.js' export function rcOptionsTypes (): Record { diff --git a/patching/plugin-commands-patching/src/updatePatchedDependencies.ts b/patching/plugin-commands-patching/src/updatePatchedDependencies.ts index 768d6a6710..108b7f7434 100644 --- a/patching/plugin-commands-patching/src/updatePatchedDependencies.ts +++ b/patching/plugin-commands-patching/src/updatePatchedDependencies.ts @@ -1,6 +1,7 @@ import path from 'path' -import normalizePath from 'normalize-path' + import { writeSettings, type WriteSettingsOptions } from '@pnpm/config.config-writer' +import normalizePath from 'normalize-path' export async function updatePatchedDependencies ( patchedDependencies: Record, diff --git a/patching/plugin-commands-patching/src/writePackage.ts b/patching/plugin-commands-patching/src/writePackage.ts index c1ea9b3d7c..1135a2510c 100644 --- a/patching/plugin-commands-patching/src/writePackage.ts +++ b/patching/plugin-commands-patching/src/writePackage.ts @@ -1,9 +1,9 @@ import type { Config } from '@pnpm/config' +import type { ParseWantedDependencyResult } from '@pnpm/parse-wanted-dependency' import { createStoreController, type CreateStoreControllerOptions, } from '@pnpm/store-connection-manager' -import type { ParseWantedDependencyResult } from '@pnpm/parse-wanted-dependency' export type WritePackageOptions = CreateStoreControllerOptions & Pick diff --git a/patching/plugin-commands-patching/test/getEditDirPath.test.ts b/patching/plugin-commands-patching/test/getEditDirPath.test.ts index ff9395623f..26707ef3c3 100644 --- a/patching/plugin-commands-patching/test/getEditDirPath.test.ts +++ b/patching/plugin-commands-patching/test/getEditDirPath.test.ts @@ -1,4 +1,5 @@ import path from 'path' + import { getEditDirPath } from '../src/getEditDirPath.js' test('getEditDirPath() returns path to pkg@version inside node_modules/.pnpm_patches', () => { diff --git a/patching/plugin-commands-patching/test/patch.test.ts b/patching/plugin-commands-patching/test/patch.test.ts index 5f3985bb39..af1416aa19 100644 --- a/patching/plugin-commands-patching/test/patch.test.ts +++ b/patching/plugin-commands-patching/test/patch.test.ts @@ -1,18 +1,20 @@ import fs from 'fs' import os from 'os' import path from 'path' -import { prepare, preparePackages, tempDir } from '@pnpm/prepare' + +import { jest } from '@jest/globals' import { install } from '@pnpm/plugin-commands-installation' -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' -import { writeYamlFileSync } from 'write-yaml-file' -import { readWorkspaceManifest } from '@pnpm/workspace.read-manifest' import type { PatchCommandOptions, PatchRemoveCommandOptions } from '@pnpm/plugin-commands-patching' -import { temporaryDirectory } from 'tempy' +import { prepare, preparePackages, tempDir } from '@pnpm/prepare' import { readProjectManifest } from '@pnpm/read-project-manifest' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' -import { DEFAULT_OPTS } from './utils/index.js' import { fixtures } from '@pnpm/test-fixtures' -import { jest } from '@jest/globals' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' +import { readWorkspaceManifest } from '@pnpm/workspace.read-manifest' +import { temporaryDirectory } from 'tempy' +import { writeYamlFileSync } from 'write-yaml-file' + +import { DEFAULT_OPTS } from './utils/index.js' jest.unstable_mockModule('enquirer', () => ({ default: { prompt: jest.fn() } })) const { default: enquirer } = await import('enquirer') diff --git a/pkg-manager/client/src/index.ts b/pkg-manager/client/src/index.ts index b132e2d3e6..f8601a1e3d 100644 --- a/pkg-manager/client/src/index.ts +++ b/pkg-manager/client/src/index.ts @@ -3,17 +3,17 @@ import { type ResolveFunction, type ResolverFactoryOptions, } from '@pnpm/default-resolver' -import { type AgentOptions, createFetchFromRegistry } from '@pnpm/fetch' -import type { SslConfig } from '@pnpm/types' -import type { CustomResolver, CustomFetcher } from '@pnpm/hooks.types' -import type { FetchFromRegistry, GetAuthHeader, RetryTimeoutOptions } from '@pnpm/fetching-types' -import type { GitFetcher, DirectoryFetcher, BinaryFetcher } from '@pnpm/fetcher-base' import { createDirectoryFetcher } from '@pnpm/directory-fetcher' +import { type AgentOptions, createFetchFromRegistry } from '@pnpm/fetch' +import type { BinaryFetcher, DirectoryFetcher, GitFetcher } from '@pnpm/fetcher-base' +import { createBinaryFetcher } from '@pnpm/fetching.binary-fetcher' +import type { FetchFromRegistry, GetAuthHeader, RetryTimeoutOptions } from '@pnpm/fetching-types' import { createGitFetcher } from '@pnpm/git-fetcher' -import { createTarballFetcher, type TarballFetchers } from '@pnpm/tarball-fetcher' +import type { CustomFetcher, CustomResolver } from '@pnpm/hooks.types' import { createGetAuthHeaderByURI } from '@pnpm/network.auth-header' import type { StoreIndex } from '@pnpm/store.index' -import { createBinaryFetcher } from '@pnpm/fetching.binary-fetcher' +import { createTarballFetcher, type TarballFetchers } from '@pnpm/tarball-fetcher' +import type { SslConfig } from '@pnpm/types' export type { ResolveFunction } diff --git a/pkg-manager/core/src/api.ts b/pkg-manager/core/src/api.ts index 44a96ec5b7..a92742e0ca 100644 --- a/pkg-manager/core/src/api.ts +++ b/pkg-manager/core/src/api.ts @@ -1,3 +1,3 @@ +export * from './getPeerDependencyIssues.js' export * from './install/index.js' export { PeerDependencyIssuesError } from './install/reportPeerDependencyIssues.js' -export * from './getPeerDependencyIssues.js' diff --git a/pkg-manager/core/src/getPeerDependencyIssues.ts b/pkg-manager/core/src/getPeerDependencyIssues.ts index c12046de75..a30c374df1 100644 --- a/pkg-manager/core/src/getPeerDependencyIssues.ts +++ b/pkg-manager/core/src/getPeerDependencyIssues.ts @@ -1,10 +1,11 @@ -import { getPreferredVersionsFromLockfileAndManifests } from '@pnpm/lockfile.preferred-versions' -import { resolveDependencies, getWantedDependencies } from '@pnpm/resolve-dependencies' -import type { PeerDependencyIssuesByProjects } from '@pnpm/types' import { getContext, type GetContextOptions, type ProjectOptions } from '@pnpm/get-context' import { createReadPackageHook } from '@pnpm/hooks.read-package-hook' +import { getPreferredVersionsFromLockfileAndManifests } from '@pnpm/lockfile.preferred-versions' import { DEFAULT_REGISTRIES } from '@pnpm/normalize-registries' import { parseOverrides } from '@pnpm/parse-overrides' +import { getWantedDependencies, resolveDependencies } from '@pnpm/resolve-dependencies' +import type { PeerDependencyIssuesByProjects } from '@pnpm/types' + import type { InstallOptions } from './install/extendInstallOptions.js' export type ListMissingPeersOptions = Partial diff --git a/pkg-manager/core/src/index.ts b/pkg-manager/core/src/index.ts index 9da7b03c64..c1732dab80 100644 --- a/pkg-manager/core/src/index.ts +++ b/pkg-manager/core/src/index.ts @@ -1,3 +1,11 @@ +export * from './api.js' +export { UnexpectedStoreError } from './install/checkCompatibility/UnexpectedStoreError.js' +export { UnexpectedVirtualStoreDirError } from './install/checkCompatibility/UnexpectedVirtualStoreDirError.js' +export type { InstallOptions } from './install/extendInstallOptions.js' +export { type ProjectOptions } from '@pnpm/get-context' +export type { HoistingLimits } from '@pnpm/headless' +export type { UpdateMatchingFunction } from '@pnpm/resolve-dependencies' +export type { WorkspacePackages } from '@pnpm/resolver-base' export type { BadPeerDependencyIssue, MissingPeerDependencyIssue, @@ -6,13 +14,3 @@ export type { PeerDependencyIssues, PeerDependencyIssuesByProjects, } from '@pnpm/types' -export type { HoistingLimits } from '@pnpm/headless' -export * from './api.js' - -export { type ProjectOptions } from '@pnpm/get-context' -export { UnexpectedStoreError } from './install/checkCompatibility/UnexpectedStoreError.js' -export { UnexpectedVirtualStoreDirError } from './install/checkCompatibility/UnexpectedVirtualStoreDirError.js' -export type { InstallOptions } from './install/extendInstallOptions.js' - -export type { WorkspacePackages } from '@pnpm/resolver-base' -export type { UpdateMatchingFunction } from '@pnpm/resolve-dependencies' diff --git a/pkg-manager/core/src/install/checkCompatibility/BreakingChangeError.ts b/pkg-manager/core/src/install/checkCompatibility/BreakingChangeError.ts index 3719adae90..756cff75a9 100644 --- a/pkg-manager/core/src/install/checkCompatibility/BreakingChangeError.ts +++ b/pkg-manager/core/src/install/checkCompatibility/BreakingChangeError.ts @@ -1,4 +1,5 @@ import { PnpmError } from '@pnpm/error' + import type { ErrorRelatedSources } from './ErrorRelatedSources.js' export interface BreakingChangeErrorOptions extends ErrorRelatedSources { diff --git a/pkg-manager/core/src/install/checkCompatibility/index.ts b/pkg-manager/core/src/install/checkCompatibility/index.ts index ac06330deb..3b3b03da38 100644 --- a/pkg-manager/core/src/install/checkCompatibility/index.ts +++ b/pkg-manager/core/src/install/checkCompatibility/index.ts @@ -1,6 +1,8 @@ import path from 'path' + import { LAYOUT_VERSION } from '@pnpm/constants' import type { Modules } from '@pnpm/modules-yaml' + import { ModulesBreakingChangeError } from './ModulesBreakingChangeError.js' import { UnexpectedStoreError } from './UnexpectedStoreError.js' import { UnexpectedVirtualStoreDirError } from './UnexpectedVirtualStoreDirError.js' diff --git a/pkg-manager/core/src/install/checkCustomResolverForceResolve.ts b/pkg-manager/core/src/install/checkCustomResolverForceResolve.ts index 68e2fef519..0ff3db599d 100644 --- a/pkg-manager/core/src/install/checkCustomResolverForceResolve.ts +++ b/pkg-manager/core/src/install/checkCustomResolverForceResolve.ts @@ -1,5 +1,5 @@ -import type { LockfileObject } from '@pnpm/lockfile.types' import type { CustomResolver } from '@pnpm/hooks.types' +import type { LockfileObject } from '@pnpm/lockfile.types' /** * Check if any custom resolver's shouldRefreshResolution returns true for any diff --git a/pkg-manager/core/src/install/extendInstallOptions.ts b/pkg-manager/core/src/install/extendInstallOptions.ts index 7e537120ee..821ede4c2a 100644 --- a/pkg-manager/core/src/install/extendInstallOptions.ts +++ b/pkg-manager/core/src/install/extendInstallOptions.ts @@ -1,27 +1,29 @@ import path from 'path' -import { WANTED_LOCKFILE } from '@pnpm/constants' + import type { Catalogs } from '@pnpm/catalogs.types' +import { WANTED_LOCKFILE } from '@pnpm/constants' import { PnpmError } from '@pnpm/error' import type { ProjectOptions } from '@pnpm/get-context' import type { HoistingLimits } from '@pnpm/headless' import { createReadPackageHook } from '@pnpm/hooks.read-package-hook' +import type { CustomFetcher, CustomResolver, PreResolutionHookContext } from '@pnpm/hooks.types' import type { LockfileObject } from '@pnpm/lockfile.fs' import type { IncludedDependencies } from '@pnpm/modules-yaml' -import { normalizeRegistries, DEFAULT_REGISTRIES } from '@pnpm/normalize-registries' +import { DEFAULT_REGISTRIES, normalizeRegistries } from '@pnpm/normalize-registries' +import { parseOverrides, type VersionOverride } from '@pnpm/parse-overrides' import type { WorkspacePackages } from '@pnpm/resolver-base' import type { StoreController } from '@pnpm/store-controller-types' import type { - SupportedArchitectures, AllowedDeprecatedVersions, PackageExtension, + PackageVulnerabilityAudit, PeerDependencyRules, ReadPackageHook, Registries, + SupportedArchitectures, TrustPolicy, - PackageVulnerabilityAudit, } from '@pnpm/types' -import type { CustomResolver, CustomFetcher, PreResolutionHookContext } from '@pnpm/hooks.types' -import { parseOverrides, type VersionOverride } from '@pnpm/parse-overrides' + import { pnpmPkgJson } from '../pnpmPkgJson.js' import type { ReporterFunction } from '../types.js' diff --git a/pkg-manager/core/src/install/index.ts b/pkg-manager/core/src/install/index.ts index adee7a0d88..21bd599ac4 100644 --- a/pkg-manager/core/src/install/index.ts +++ b/pkg-manager/core/src/install/index.ts @@ -1,14 +1,15 @@ import path from 'path' + import { buildSelectedPkgs } from '@pnpm/building.after-install' import { buildModules, type DepsStateCache, linkBinsOfDependencies } from '@pnpm/building.during-install' import { createAllowBuildFunction } from '@pnpm/building.policy' import { parseCatalogProtocol } from '@pnpm/catalogs.protocol-parser' -import { resolveFromCatalog, matchCatalogResolveResult, type CatalogResultMatcher } from '@pnpm/catalogs.resolver' +import { type CatalogResultMatcher, matchCatalogResolveResult, resolveFromCatalog } from '@pnpm/catalogs.resolver' import type { Catalogs } from '@pnpm/catalogs.types' import { LAYOUT_VERSION, - LOCKFILE_VERSION, LOCKFILE_MAJOR_VERSION, + LOCKFILE_VERSION, WANTED_LOCKFILE, } from '@pnpm/constants' import { @@ -18,11 +19,6 @@ import { } from '@pnpm/core-loggers' import { hashObjectNullableWithPrefix } from '@pnpm/crypto.object-hasher' import * as dp from '@pnpm/dependency-path' -import { - calcPatchHashes, - createOverridesMapFromParsed, - getOutdatedLockfileSetting, -} from '@pnpm/lockfile.settings-checker' import { PnpmError } from '@pnpm/error' import { getContext, type PnpmContext } from '@pnpm/get-context' import { extendProjectsWithTargetDirs, headlessInstall, type InstallationResultStats } from '@pnpm/headless' @@ -34,26 +30,31 @@ import { } from '@pnpm/lifecycle' import { linkBins, linkBinsOfPackages } from '@pnpm/link-bins' import { - type ProjectSnapshot, + type CatalogSnapshots, + cleanGitBranchLockfiles, type LockfileObject, + type ProjectSnapshot, writeCurrentLockfile, writeLockfiles, writeWantedLockfile, - cleanGitBranchLockfiles, - type CatalogSnapshots, } from '@pnpm/lockfile.fs' -import { writePnpFile } from '@pnpm/lockfile-to-pnp' -import { allProjectsAreUpToDate, satisfiesPackageManifest } from '@pnpm/lockfile.verification' import { getPreferredVersionsFromLockfileAndManifests } from '@pnpm/lockfile.preferred-versions' -import { logger, globalInfo, streamParser } from '@pnpm/logger' +import { + calcPatchHashes, + createOverridesMapFromParsed, + getOutdatedLockfileSetting, +} from '@pnpm/lockfile.settings-checker' +import { allProjectsAreUpToDate, satisfiesPackageManifest } from '@pnpm/lockfile.verification' +import { writePnpFile } from '@pnpm/lockfile-to-pnp' +import { globalInfo, logger, streamParser } from '@pnpm/logger' import { getAllDependenciesFromManifest, getAllUniqueSpecs } from '@pnpm/manifest-utils' import { writeModulesManifest } from '@pnpm/modules-yaml' -import { type PatchGroupRecord, groupPatchedDependencies } from '@pnpm/patching.config' +import { groupPatchedDependencies, type PatchGroupRecord } from '@pnpm/patching.config' import { safeReadProjectManifestOnly } from '@pnpm/read-project-manifest' import { - getWantedDependencies, type DependenciesGraph, type DependenciesGraphNode, + getWantedDependencies, type PinnedVersion, resolveDependencies, type UpdateMatchingFunction, @@ -63,23 +64,26 @@ import type { PreferredVersions, } from '@pnpm/resolver-base' import type { - DepPath, AllowBuild, DependenciesField, DependencyManifest, + DepPath, IgnoredBuilds, PeerDependencyIssues, ProjectId, ProjectManifest, - ReadPackageHook, ProjectRootDir, + ReadPackageHook, } from '@pnpm/types' import { lexCompare } from '@pnpm/util.lex-comparator' import { isSubdir } from 'is-subdir' import pLimit from 'p-limit' -import { map as mapValues, clone, isEmpty, pipeWith, props } from 'ramda' +import { clone, isEmpty, map as mapValues, pipeWith, props } from 'ramda' +import semver from 'semver' + import { parseWantedDependencies } from '../parseWantedDependencies.js' import { removeDeps } from '../uninstall/removeDeps.js' +import { CatalogVersionMismatchError } from './checkCompatibility/CatalogVersionMismatchError.js' import { checkCustomResolverForceResolve } from './checkCustomResolverForceResolve.js' import { extendOptions, @@ -89,8 +93,6 @@ import { import { linkPackages } from './link.js' import { reportPeerDependencyIssues } from './reportPeerDependencyIssues.js' import { validateModules } from './validateModules.js' -import semver from 'semver' -import { CatalogVersionMismatchError } from './checkCompatibility/CatalogVersionMismatchError.js' class LockfileConfigMismatchError extends PnpmError { constructor (outdatedLockfileSettingName: string) { diff --git a/pkg-manager/core/src/install/link.ts b/pkg-manager/core/src/install/link.ts index 246d0d24c3..9a2426cc40 100644 --- a/pkg-manager/core/src/install/link.ts +++ b/pkg-manager/core/src/install/link.ts @@ -1,21 +1,22 @@ import { promises as fs } from 'fs' import path from 'path' + import { calcDepState, type DepsStateCache } from '@pnpm/calc-dep-state' import { progressLogger, stageLogger, statsLogger, } from '@pnpm/core-loggers' +import type { InstallationResultStats } from '@pnpm/headless' +import { hoist, type HoistedWorkspaceProject } from '@pnpm/hoist' import { filterLockfileByImporters, } from '@pnpm/lockfile.filtering' -import { linkDirectDeps } from '@pnpm/pkg-manager.direct-dep-linker' -import type { InstallationResultStats } from '@pnpm/headless' -import { hoist, type HoistedWorkspaceProject } from '@pnpm/hoist' import type { LockfileObject } from '@pnpm/lockfile.fs' import { logger } from '@pnpm/logger' import { prune } from '@pnpm/modules-cleaner' import type { IncludedDependencies } from '@pnpm/modules-yaml' +import { linkDirectDeps } from '@pnpm/pkg-manager.direct-dep-linker' import type { DependenciesGraph, DependenciesGraphNode, @@ -27,13 +28,14 @@ import type { AllowBuild, DepPath, HoistedDependencies, - Registries, ProjectId, + Registries, } from '@pnpm/types' import { symlinkAllModules } from '@pnpm/worker' import pLimit from 'p-limit' import { pathExists } from 'path-exists' -import { equals, isEmpty, difference, pick, pickBy, props } from 'ramda' +import { difference, equals, isEmpty, pick, pickBy, props } from 'ramda' + import type { ImporterToUpdate } from './index.js' const brokenModulesLogger = logger('_broken_node_modules') diff --git a/pkg-manager/core/src/install/reportPeerDependencyIssues.ts b/pkg-manager/core/src/install/reportPeerDependencyIssues.ts index bf2dc119a8..0bfa7aee48 100644 --- a/pkg-manager/core/src/install/reportPeerDependencyIssues.ts +++ b/pkg-manager/core/src/install/reportPeerDependencyIssues.ts @@ -1,10 +1,10 @@ +import { peerDependencyIssuesLogger } from '@pnpm/core-loggers' import { PnpmError } from '@pnpm/error' import { createMatcher } from '@pnpm/matcher' -import { peerDependencyIssuesLogger } from '@pnpm/core-loggers' -import type { PeerDependencyIssuesByProjects, PeerDependencyRules, BadPeerDependencyIssue } from '@pnpm/types' -import semver from 'semver' -import { isEmpty } from 'ramda' import { parseOverrides, type VersionOverride } from '@pnpm/parse-overrides' +import type { BadPeerDependencyIssue, PeerDependencyIssuesByProjects, PeerDependencyRules } from '@pnpm/types' +import { isEmpty } from 'ramda' +import semver from 'semver' export function reportPeerDependencyIssues ( peerDependencyIssuesByProjects: PeerDependencyIssuesByProjects, diff --git a/pkg-manager/core/src/install/validateModules.ts b/pkg-manager/core/src/install/validateModules.ts index 938ba7defb..08b7344492 100644 --- a/pkg-manager/core/src/install/validateModules.ts +++ b/pkg-manager/core/src/install/validateModules.ts @@ -1,5 +1,6 @@ import { promises as fs } from 'fs' import path from 'path' + import { PnpmError } from '@pnpm/error' import { logger } from '@pnpm/logger' import type { @@ -8,12 +9,13 @@ import type { } from '@pnpm/modules-yaml' import { DEPENDENCIES_FIELDS, - type Registries, type ProjectRootDir, + type Registries, } from '@pnpm/types' import { rimraf } from '@zkochan/rimraf' import enquirer from 'enquirer' import { equals } from 'ramda' + import { checkCompatibility } from './checkCompatibility/index.js' interface ImporterToPurge { diff --git a/pkg-manager/core/src/parseWantedDependencies.ts b/pkg-manager/core/src/parseWantedDependencies.ts index 366ccba7c5..ab27b5856a 100644 --- a/pkg-manager/core/src/parseWantedDependencies.ts +++ b/pkg-manager/core/src/parseWantedDependencies.ts @@ -1,7 +1,7 @@ -import { parseWantedDependency } from '@pnpm/parse-wanted-dependency' -import type { Dependencies } from '@pnpm/types' -import type { WantedDependency } from '@pnpm/resolve-dependencies' import type { Catalog } from '@pnpm/catalogs.types' +import { parseWantedDependency } from '@pnpm/parse-wanted-dependency' +import type { WantedDependency } from '@pnpm/resolve-dependencies' +import type { Dependencies } from '@pnpm/types' export function parseWantedDependencies ( rawWantedDependencies: string[], diff --git a/pkg-manager/core/src/pnpmPkgJson.ts b/pkg-manager/core/src/pnpmPkgJson.ts index 184e9f60cc..70d1c3ab3c 100644 --- a/pkg-manager/core/src/pnpmPkgJson.ts +++ b/pkg-manager/core/src/pnpmPkgJson.ts @@ -1,4 +1,5 @@ import path from 'path' + import type { PackageManifest } from '@pnpm/types' import { loadJsonFileSync } from 'load-json-file' diff --git a/pkg-manager/core/src/uninstall/removeDeps.ts b/pkg-manager/core/src/uninstall/removeDeps.ts index 76587ea9b5..d7801f77ec 100644 --- a/pkg-manager/core/src/uninstall/removeDeps.ts +++ b/pkg-manager/core/src/uninstall/removeDeps.ts @@ -1,7 +1,7 @@ import { packageManifestLogger } from '@pnpm/core-loggers' import { - type DependenciesField, DEPENDENCIES_FIELDS, + type DependenciesField, type ProjectManifest, } from '@pnpm/types' diff --git a/pkg-manager/core/test/api.ts b/pkg-manager/core/test/api.ts index 8d49f6eead..def6774404 100644 --- a/pkg-manager/core/test/api.ts +++ b/pkg-manager/core/test/api.ts @@ -1,4 +1,5 @@ import * as pnpm from '@pnpm/core' + import { testDefaults } from './utils/index.js' test('API', () => { diff --git a/pkg-manager/core/test/breakingChanges.ts b/pkg-manager/core/test/breakingChanges.ts index 59bb7e1ea1..714dd294fd 100644 --- a/pkg-manager/core/test/breakingChanges.ts +++ b/pkg-manager/core/test/breakingChanges.ts @@ -1,11 +1,13 @@ import fs from 'fs' import path from 'path' + import { WANTED_LOCKFILE } from '@pnpm/constants' +import { addDependenciesToPackage, install } from '@pnpm/core' import type { PnpmError } from '@pnpm/error' import { prepareEmpty, preparePackages } from '@pnpm/prepare' -import { addDependenciesToPackage, install } from '@pnpm/core' import { rimrafSync } from '@zkochan/rimraf' import { isCI } from 'ci-info' + import { testDefaults } from './utils/index.js' test('fail on non-compatible node_modules', async () => { diff --git a/pkg-manager/core/test/brokenLockfileIntegrity.ts b/pkg-manager/core/test/brokenLockfileIntegrity.ts index e08ecff50d..acf61a8ccf 100644 --- a/pkg-manager/core/test/brokenLockfileIntegrity.ts +++ b/pkg-manager/core/test/brokenLockfileIntegrity.ts @@ -1,16 +1,17 @@ +import { jest } from '@jest/globals' import { WANTED_LOCKFILE } from '@pnpm/constants' +import { + addDependenciesToPackage, + mutateModulesInSingleProject, +} from '@pnpm/core' import type { TarballResolution } from '@pnpm/lockfile.fs' import { prepareEmpty } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' import type { ProjectRootDir } from '@pnpm/types' import { rimrafSync } from '@zkochan/rimraf' -import { jest } from '@jest/globals' import { clone } from 'ramda' -import { - addDependenciesToPackage, - mutateModulesInSingleProject, -} from '@pnpm/core' import { writeYamlFileSync } from 'write-yaml-file' + import { testDefaults } from './utils/index.js' test('installation breaks if the lockfile contains the wrong checksum', async () => { diff --git a/pkg-manager/core/test/cache.ts b/pkg-manager/core/test/cache.ts index d673b62c87..cfaf2f5023 100644 --- a/pkg-manager/core/test/cache.ts +++ b/pkg-manager/core/test/cache.ts @@ -1,6 +1,7 @@ -import { prepareEmpty } from '@pnpm/prepare' import { addDependenciesToPackage, install } from '@pnpm/core' +import { prepareEmpty } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' + import { testDefaults } from './utils/index.js' test('should fail to update when requests are cached', async () => { diff --git a/pkg-manager/core/test/catalogs.ts b/pkg-manager/core/test/catalogs.ts index fdaff9b4cc..47465f79e7 100644 --- a/pkg-manager/core/test/catalogs.ts +++ b/pkg-manager/core/test/catalogs.ts @@ -1,12 +1,14 @@ +import path from 'path' + +import { jest } from '@jest/globals' +import type { MutatedProject, MutateModulesOptions, ProjectOptions } from '@pnpm/core' import { createPeerDepGraphHash } from '@pnpm/dependency-path' -import type { ProjectRootDir, ProjectId, ProjectManifest } from '@pnpm/types' +import type { CatalogSnapshots } from '@pnpm/lockfile.types' import { prepareEmpty } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' -import type { MutatedProject, ProjectOptions, MutateModulesOptions } from '@pnpm/core' -import type { CatalogSnapshots } from '@pnpm/lockfile.types' -import { jest } from '@jest/globals' +import type { ProjectId, ProjectManifest, ProjectRootDir } from '@pnpm/types' import { loadJsonFileSync } from 'load-json-file' -import path from 'path' + import { testDefaults } from './utils/index.js' const originalModule = await import('@pnpm/logger') diff --git a/pkg-manager/core/test/checkCompatibility.test.ts b/pkg-manager/core/test/checkCompatibility.test.ts index f94954538c..9ed353d8a3 100644 --- a/pkg-manager/core/test/checkCompatibility.test.ts +++ b/pkg-manager/core/test/checkCompatibility.test.ts @@ -1,4 +1,5 @@ import { LAYOUT_VERSION } from '@pnpm/constants' + import { checkCompatibility } from '../lib/install/checkCompatibility/index.js' test('fail if the store directory changed', () => { diff --git a/pkg-manager/core/test/getPeerDependencyIssues.test.ts b/pkg-manager/core/test/getPeerDependencyIssues.test.ts index 5262df2b4b..071948415a 100644 --- a/pkg-manager/core/test/getPeerDependencyIssues.test.ts +++ b/pkg-manager/core/test/getPeerDependencyIssues.test.ts @@ -1,6 +1,7 @@ import { getPeerDependencyIssues } from '@pnpm/core' import { prepareEmpty } from '@pnpm/prepare' import type { ProjectRootDir } from '@pnpm/types' + import { testDefaults } from './utils/index.js' test('cannot resolve peer dependency for top-level dependency', async () => { diff --git a/pkg-manager/core/test/hoistedNodeLinker/install.ts b/pkg-manager/core/test/hoistedNodeLinker/install.ts index ea4d4d8ad7..bf544bacad 100644 --- a/pkg-manager/core/test/hoistedNodeLinker/install.ts +++ b/pkg-manager/core/test/hoistedNodeLinker/install.ts @@ -1,5 +1,6 @@ import fs from 'fs' import path from 'path' + import { addDependenciesToPackage, install, mutateModules, mutateModulesInSingleProject } from '@pnpm/core' import { prepareEmpty, preparePackages } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' @@ -8,6 +9,7 @@ import { rimrafSync } from '@zkochan/rimraf' import { loadJsonFileSync } from 'load-json-file' import { readYamlFileSync } from 'read-yaml-file' import symlinkDir from 'symlink-dir' + import { testDefaults } from '../utils/index.js' test('installing with hoisted node-linker', async () => { diff --git a/pkg-manager/core/test/hoistedNodeLinker/uninstall.ts b/pkg-manager/core/test/hoistedNodeLinker/uninstall.ts index 27e07f7316..97199b1a46 100644 --- a/pkg-manager/core/test/hoistedNodeLinker/uninstall.ts +++ b/pkg-manager/core/test/hoistedNodeLinker/uninstall.ts @@ -1,14 +1,15 @@ +import { jest } from '@jest/globals' +import { + addDependenciesToPackage, + mutateModulesInSingleProject, +} from '@pnpm/core' import type { PackageManifestLog, StatsLog, } from '@pnpm/core-loggers' import { prepareEmpty } from '@pnpm/prepare' -import { - addDependenciesToPackage, - mutateModulesInSingleProject, -} from '@pnpm/core' import type { ProjectRootDir } from '@pnpm/types' -import { jest } from '@jest/globals' + import { testDefaults } from './../utils/index.js' test('uninstall package with no dependencies', async () => { diff --git a/pkg-manager/core/test/install/aliases.ts b/pkg-manager/core/test/install/aliases.ts index 450fea3e06..f673174042 100644 --- a/pkg-manager/core/test/install/aliases.ts +++ b/pkg-manager/core/test/install/aliases.ts @@ -1,7 +1,8 @@ import { LOCKFILE_VERSION } from '@pnpm/constants' +import { addDependenciesToPackage } from '@pnpm/core' import { prepareEmpty } from '@pnpm/prepare' import { addDistTag, getIntegrity } from '@pnpm/registry-mock' -import { addDependenciesToPackage } from '@pnpm/core' + import { testDefaults } from '../utils/index.js' test('installing aliased dependency', async () => { diff --git a/pkg-manager/core/test/install/auth.ts b/pkg-manager/core/test/install/auth.ts index 878b51739d..cb43ec706e 100644 --- a/pkg-manager/core/test/install/auth.ts +++ b/pkg-manager/core/test/install/auth.ts @@ -1,8 +1,10 @@ import path from 'path' + +import { addDependenciesToPackage, install } from '@pnpm/core' import { prepareEmpty } from '@pnpm/prepare' import { addUser, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' -import { addDependenciesToPackage, install } from '@pnpm/core' import { rimrafSync } from '@zkochan/rimraf' + import { testDefaults } from '../utils/index.js' const skipOnNode17 = ['v14', 'v16'].includes(process.version.split('.')[0]) ? test : test.skip diff --git a/pkg-manager/core/test/install/autoInstallPeers.ts b/pkg-manager/core/test/install/autoInstallPeers.ts index 0cc8386e24..e3870507d2 100644 --- a/pkg-manager/core/test/install/autoInstallPeers.ts +++ b/pkg-manager/core/test/install/autoInstallPeers.ts @@ -1,11 +1,13 @@ import path from 'path' + import { assertProject } from '@pnpm/assert-project' import { addDependenciesToPackage, install, mutateModules, mutateModulesInSingleProject, type PackageManifest } from '@pnpm/core' +import { createPeerDepGraphHash } from '@pnpm/dependency-path' import { prepareEmpty, preparePackages } from '@pnpm/prepare' import { addDistTag, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import type { ProjectRootDir } from '@pnpm/types' import { rimrafSync } from '@zkochan/rimraf' -import { createPeerDepGraphHash } from '@pnpm/dependency-path' + import { testDefaults } from '../utils/index.js' test('auto install non-optional peer dependencies', async () => { diff --git a/pkg-manager/core/test/install/blockExoticSubdeps.ts b/pkg-manager/core/test/install/blockExoticSubdeps.ts index 439a5a8dc3..d7bb1e8ebd 100644 --- a/pkg-manager/core/test/install/blockExoticSubdeps.ts +++ b/pkg-manager/core/test/install/blockExoticSubdeps.ts @@ -1,8 +1,9 @@ -import { prepareEmpty } from '@pnpm/prepare' import { addDependenciesToPackage } from '@pnpm/core' -import { testDefaults } from '../utils/index.js' +import { prepareEmpty } from '@pnpm/prepare' import nock from 'nock' +import { testDefaults } from '../utils/index.js' + afterEach(() => { nock.abortPendingRequests() nock.cleanAll() diff --git a/pkg-manager/core/test/install/bunRuntime.ts b/pkg-manager/core/test/install/bunRuntime.ts index 6ac1258e1e..d085b4878e 100644 --- a/pkg-manager/core/test/install/bunRuntime.ts +++ b/pkg-manager/core/test/install/bunRuntime.ts @@ -1,9 +1,10 @@ import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' -import { prepareEmpty } from '@pnpm/prepare' import { addDependenciesToPackage, install } from '@pnpm/core' +import { prepareEmpty } from '@pnpm/prepare' import { getIntegrity } from '@pnpm/registry-mock' import { rimrafSync } from '@zkochan/rimraf' import { writeYamlFileSync } from 'write-yaml-file' + import { testDefaults } from '../utils/index.js' const RESOLUTIONS = [ diff --git a/pkg-manager/core/test/install/bundledDependencies.ts b/pkg-manager/core/test/install/bundledDependencies.ts index 7e009231cd..f190936b9e 100644 --- a/pkg-manager/core/test/install/bundledDependencies.ts +++ b/pkg-manager/core/test/install/bundledDependencies.ts @@ -1,6 +1,7 @@ +import { addDependenciesToPackage } from '@pnpm/core' import { prepareEmpty } from '@pnpm/prepare' import { fixtures } from '@pnpm/test-fixtures' -import { addDependenciesToPackage } from '@pnpm/core' + import { testDefaults } from '../utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/core/test/install/checkCustomResolverForceResolve.ts b/pkg-manager/core/test/install/checkCustomResolverForceResolve.ts index eb745b1c9d..f842adcf13 100644 --- a/pkg-manager/core/test/install/checkCustomResolverForceResolve.ts +++ b/pkg-manager/core/test/install/checkCustomResolverForceResolve.ts @@ -1,7 +1,8 @@ -import { checkCustomResolverForceResolve } from '../../src/install/checkCustomResolverForceResolve.js' import type { CustomResolver } from '@pnpm/hooks.types' import type { LockfileObject } from '@pnpm/lockfile.types' +import { checkCustomResolverForceResolve } from '../../src/install/checkCustomResolverForceResolve.js' + // eslint-disable-next-line @typescript-eslint/no-explicit-any type AnyPackages = any diff --git a/pkg-manager/core/test/install/customResolvers.ts b/pkg-manager/core/test/install/customResolvers.ts index 2211057de5..c238a63fb0 100644 --- a/pkg-manager/core/test/install/customResolvers.ts +++ b/pkg-manager/core/test/install/customResolvers.ts @@ -1,7 +1,8 @@ -import { prepareEmpty } from '@pnpm/prepare' import { addDependenciesToPackage } from '@pnpm/core' import type { CustomResolver } from '@pnpm/hooks.types' +import { prepareEmpty } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' + import { testDefaults } from '../utils/index.js' // Integration tests for custom resolvers diff --git a/pkg-manager/core/test/install/dedupe.ts b/pkg-manager/core/test/install/dedupe.ts index cdee90ba9f..fe7ff18afe 100644 --- a/pkg-manager/core/test/install/dedupe.ts +++ b/pkg-manager/core/test/install/dedupe.ts @@ -1,6 +1,7 @@ -import { prepareEmpty } from '@pnpm/prepare' import { addDependenciesToPackage, install } from '@pnpm/core' +import { prepareEmpty } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' + import { testDefaults } from '../utils/index.js' test('prefer version ranges specified for top dependencies', async () => { diff --git a/pkg-manager/core/test/install/dedupeDirectDeps.ts b/pkg-manager/core/test/install/dedupeDirectDeps.ts index 0b8faf23e3..59172805e4 100644 --- a/pkg-manager/core/test/install/dedupeDirectDeps.ts +++ b/pkg-manager/core/test/install/dedupeDirectDeps.ts @@ -1,9 +1,11 @@ import fs from 'fs' import path from 'path' + +import { type MutatedProject, mutateModules } from '@pnpm/core' import { preparePackages } from '@pnpm/prepare' -import { mutateModules, type MutatedProject } from '@pnpm/core' import type { ProjectRootDir } from '@pnpm/types' import { rimrafSync } from '@zkochan/rimraf' + import { testDefaults } from '../utils/index.js' test('dedupe direct dependencies', async () => { diff --git a/pkg-manager/core/test/install/dedupeInWorkspace.ts b/pkg-manager/core/test/install/dedupeInWorkspace.ts index 7c0ef2a3c5..aba46a3e66 100644 --- a/pkg-manager/core/test/install/dedupeInWorkspace.ts +++ b/pkg-manager/core/test/install/dedupeInWorkspace.ts @@ -1,9 +1,11 @@ import path from 'path' + import { assertProject } from '@pnpm/assert-project' +import { type MutatedProject, mutateModules } from '@pnpm/core' import { preparePackages } from '@pnpm/prepare' -import { mutateModules, type MutatedProject } from '@pnpm/core' import { addDistTag } from '@pnpm/registry-mock' import type { ProjectRootDir } from '@pnpm/types' + import { testDefaults } from '../utils/index.js' test('pick common range for a dependency used in two workspace projects when resolution mode is highest', async () => { diff --git a/pkg-manager/core/test/install/deepRecursive.ts b/pkg-manager/core/test/install/deepRecursive.ts index f9346fb6fc..44ed0d3d8b 100644 --- a/pkg-manager/core/test/install/deepRecursive.ts +++ b/pkg-manager/core/test/install/deepRecursive.ts @@ -1,6 +1,8 @@ import fs from 'fs' -import { prepareEmpty } from '@pnpm/prepare' + import { addDependenciesToPackage } from '@pnpm/core' +import { prepareEmpty } from '@pnpm/prepare' + import { testDefaults } from '../utils/index.js' test('a package with a huge amount of circular dependencies and many peer dependencies should successfully be resolved', async () => { diff --git a/pkg-manager/core/test/install/defaultPeerDependencies.ts b/pkg-manager/core/test/install/defaultPeerDependencies.ts index a5943130d6..ab7ddcb689 100644 --- a/pkg-manager/core/test/install/defaultPeerDependencies.ts +++ b/pkg-manager/core/test/install/defaultPeerDependencies.ts @@ -1,10 +1,12 @@ import fs from 'fs' import path from 'path' + +import { addDependenciesToPackage } from '@pnpm/core' +import { createPeerDepGraphHash } from '@pnpm/dependency-path' import { prepareEmpty } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' -import { addDependenciesToPackage } from '@pnpm/core' import deepRequireCwd from 'deep-require-cwd' -import { createPeerDepGraphHash } from '@pnpm/dependency-path' + import { testDefaults } from '../utils/index.js' test('package with default peer dependency, when auto install peers is on', async () => { diff --git a/pkg-manager/core/test/install/denoRuntime.ts b/pkg-manager/core/test/install/denoRuntime.ts index 396d4bb47e..62cfc3b7c2 100644 --- a/pkg-manager/core/test/install/denoRuntime.ts +++ b/pkg-manager/core/test/install/denoRuntime.ts @@ -1,10 +1,11 @@ import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' -import { prepareEmpty } from '@pnpm/prepare' import { addDependenciesToPackage, install } from '@pnpm/core' +import { prepareEmpty } from '@pnpm/prepare' import { getIntegrity } from '@pnpm/registry-mock' import { rimrafSync } from '@zkochan/rimraf' import nock from 'nock' import { writeYamlFileSync } from 'write-yaml-file' + import { testDefaults } from '../utils/index.js' afterEach(() => { diff --git a/pkg-manager/core/test/install/errors.ts b/pkg-manager/core/test/install/errors.ts index a4202484ce..cae83d9025 100644 --- a/pkg-manager/core/test/install/errors.ts +++ b/pkg-manager/core/test/install/errors.ts @@ -1,11 +1,12 @@ +import { addDependenciesToPackage, mutateModulesInSingleProject } from '@pnpm/core' import type { PnpmError } from '@pnpm/error' import { prepareEmpty } from '@pnpm/prepare' -import { addDependenciesToPackage, mutateModulesInSingleProject } from '@pnpm/core' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { fixtures } from '@pnpm/test-fixtures' import type { ProjectRootDir } from '@pnpm/types' import { loadJsonFileSync } from 'load-json-file' import nock from 'nock' + import { testDefaults } from '../utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/core/test/install/excludeLinksFromLockfile.ts b/pkg-manager/core/test/install/excludeLinksFromLockfile.ts index 7a7b0170c5..728c6899df 100644 --- a/pkg-manager/core/test/install/excludeLinksFromLockfile.ts +++ b/pkg-manager/core/test/install/excludeLinksFromLockfile.ts @@ -1,22 +1,24 @@ import fs from 'fs' import path from 'path' + import { WANTED_LOCKFILE } from '@pnpm/constants' import { addDependenciesToPackage, install, - mutateModules, type MutatedProject, + mutateModules, type ProjectOptions, } from '@pnpm/core' -import type { LockfileObject, LockfileFile } from '@pnpm/lockfile.types' -import type { ProjectRootDir, ProjectId } from '@pnpm/types' +import type { LockfileFile, LockfileObject } from '@pnpm/lockfile.types' import { prepareEmpty, preparePackages, tempDir } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' import { fixtures } from '@pnpm/test-fixtures' +import type { ProjectId, ProjectRootDir } from '@pnpm/types' import { rimrafSync } from '@zkochan/rimraf' import normalizePath from 'normalize-path' import { readYamlFileSync } from 'read-yaml-file' import { writeJsonFileSync } from 'write-json-file' + import { testDefaults } from '../utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/core/test/install/fixLockfile.ts b/pkg-manager/core/test/install/fixLockfile.ts index 6db19ba879..054a657b07 100644 --- a/pkg-manager/core/test/install/fixLockfile.ts +++ b/pkg-manager/core/test/install/fixLockfile.ts @@ -1,11 +1,13 @@ import path from 'path' + import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' -import { prepareEmpty, preparePackages } from '@pnpm/prepare' import { install, type MutatedProject, mutateModules } from '@pnpm/core' -import { writeYamlFileSync } from 'write-yaml-file' -import { readYamlFileSync } from 'read-yaml-file' import type { LockfileFile, PackageSnapshots } from '@pnpm/lockfile.fs' +import { prepareEmpty, preparePackages } from '@pnpm/prepare' import type { ProjectRootDir } from '@pnpm/types' +import { readYamlFileSync } from 'read-yaml-file' +import { writeYamlFileSync } from 'write-yaml-file' + import { testDefaults } from '../utils/index.js' test('fix broken lockfile with --fix-lockfile', async () => { diff --git a/pkg-manager/core/test/install/fromRepo.ts b/pkg-manager/core/test/install/fromRepo.ts index 6ba0a8a5fd..77feaed537 100644 --- a/pkg-manager/core/test/install/fromRepo.ts +++ b/pkg-manager/core/test/install/fromRepo.ts @@ -1,18 +1,20 @@ -import path from 'path' import fs from 'fs' -import type { RootLog } from '@pnpm/core-loggers' -import { depPathToFilename } from '@pnpm/dependency-path' -import { prepareEmpty } from '@pnpm/prepare' +import path from 'path' + +import { jest } from '@jest/globals' +import { assertProject } from '@pnpm/assert-project' import { addDependenciesToPackage, install, } from '@pnpm/core' +import type { RootLog } from '@pnpm/core-loggers' +import { depPathToFilename } from '@pnpm/dependency-path' +import { prepareEmpty } from '@pnpm/prepare' import { fixtures } from '@pnpm/test-fixtures' -import { assertProject } from '@pnpm/assert-project' import { rimrafSync } from '@zkochan/rimraf' import { isCI } from 'ci-info' import nock from 'nock' -import { jest } from '@jest/globals' + import { testDefaults } from '../utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/core/test/install/fromTarball.ts b/pkg-manager/core/test/install/fromTarball.ts index 8d2e1b592d..022a5c009a 100644 --- a/pkg-manager/core/test/install/fromTarball.ts +++ b/pkg-manager/core/test/install/fromTarball.ts @@ -1,6 +1,7 @@ +import { addDependenciesToPackage } from '@pnpm/core' import { prepareEmpty } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' -import { addDependenciesToPackage } from '@pnpm/core' + import { testDefaults } from '../utils/index.js' test('tarball from npm registry', async () => { diff --git a/pkg-manager/core/test/install/frozenLockfile.ts b/pkg-manager/core/test/install/frozenLockfile.ts index 8b0c36627b..36e65afaca 100644 --- a/pkg-manager/core/test/install/frozenLockfile.ts +++ b/pkg-manager/core/test/install/frozenLockfile.ts @@ -1,13 +1,15 @@ import path from 'path' + +import { jest } from '@jest/globals' import { WANTED_LOCKFILE } from '@pnpm/constants' -import { prepareEmpty, preparePackages } from '@pnpm/prepare' import { install, type MutatedProject, mutateModules, } from '@pnpm/core' +import { prepareEmpty, preparePackages } from '@pnpm/prepare' import type { ProjectRootDir } from '@pnpm/types' -import { jest } from '@jest/globals' + import { testDefaults } from '../utils/index.js' test(`frozen-lockfile: installation fails if specs in package.json don't match the ones in ${WANTED_LOCKFILE}`, async () => { diff --git a/pkg-manager/core/test/install/gitBranchLockfile.test.ts b/pkg-manager/core/test/install/gitBranchLockfile.test.ts index 514d6c2bd3..a5bc96d590 100644 --- a/pkg-manager/core/test/install/gitBranchLockfile.test.ts +++ b/pkg-manager/core/test/install/gitBranchLockfile.test.ts @@ -1,12 +1,14 @@ import fs from 'fs' import path from 'path' -import { prepareEmpty, preparePackages } from '@pnpm/prepare' -import { testDefaults } from '../utils/index.js' -import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' -import type { ProjectRootDir, ProjectManifest } from '@pnpm/types' + import { jest } from '@jest/globals' +import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' +import { prepareEmpty, preparePackages } from '@pnpm/prepare' +import type { ProjectManifest, ProjectRootDir } from '@pnpm/types' import { writeYamlFileSync } from 'write-yaml-file' +import { testDefaults } from '../utils/index.js' + jest.unstable_mockModule('@pnpm/git-utils', () => ({ getCurrentBranch: jest.fn() })) const { getCurrentBranch } = await import('@pnpm/git-utils') diff --git a/pkg-manager/core/test/install/globalVirtualStore.ts b/pkg-manager/core/test/install/globalVirtualStore.ts index f031bf6aa4..95dc195f4d 100644 --- a/pkg-manager/core/test/install/globalVirtualStore.ts +++ b/pkg-manager/core/test/install/globalVirtualStore.ts @@ -1,13 +1,15 @@ import fs from 'fs' import path from 'path' + import { assertProject } from '@pnpm/assert-project' -import { prepareEmpty, preparePackages } from '@pnpm/prepare' import { install, type MutatedProject, mutateModules, type ProjectOptions } from '@pnpm/core' +import { prepareEmpty, preparePackages } from '@pnpm/prepare' +import { getIntegrity } from '@pnpm/registry-mock' import type { PackageFilesIndex } from '@pnpm/store.cafs' import { StoreIndex, storeIndexKey } from '@pnpm/store.index' -import { getIntegrity } from '@pnpm/registry-mock' import type { ProjectRootDir } from '@pnpm/types' import { rimrafSync } from '@zkochan/rimraf' + import { testDefaults } from '../utils/index.js' const storeIndexes: StoreIndex[] = [] diff --git a/pkg-manager/core/test/install/hoist.ts b/pkg-manager/core/test/install/hoist.ts index 3810247c1a..0cf0cfab86 100644 --- a/pkg-manager/core/test/install/hoist.ts +++ b/pkg-manager/core/test/install/hoist.ts @@ -1,7 +1,8 @@ import fs from 'fs' import path from 'path' + import { assertProject } from '@pnpm/assert-project' -import { prepareEmpty, preparePackages } from '@pnpm/prepare' +import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' import { addDependenciesToPackage, install, @@ -9,13 +10,14 @@ import { mutateModules, mutateModulesInSingleProject, } from '@pnpm/core' +import { prepareEmpty, preparePackages } from '@pnpm/prepare' +import { addDistTag } from '@pnpm/registry-mock' import type { DepPath, ProjectRootDir } from '@pnpm/types' import { rimrafSync } from '@zkochan/rimraf' import { resolveLinkTarget } from 'resolve-link-target' -import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' -import { addDistTag } from '@pnpm/registry-mock' import symlinkDir from 'symlink-dir' import { writeYamlFileSync } from 'write-yaml-file' + import { testDefaults } from '../utils/index.js' test('should hoist dependencies', async () => { diff --git a/pkg-manager/core/test/install/hooks.ts b/pkg-manager/core/test/install/hooks.ts index 972734ed0d..36003ebfe4 100644 --- a/pkg-manager/core/test/install/hooks.ts +++ b/pkg-manager/core/test/install/hooks.ts @@ -1,12 +1,13 @@ +import { jest } from '@jest/globals' import { LOCKFILE_VERSION } from '@pnpm/constants' -import type { LockfileObject } from '@pnpm/lockfile.fs' -import { prepareEmpty } from '@pnpm/prepare' -import { addDistTag } from '@pnpm/registry-mock' import { addDependenciesToPackage, type PackageManifest, } from '@pnpm/core' -import { jest } from '@jest/globals' +import type { LockfileObject } from '@pnpm/lockfile.fs' +import { prepareEmpty } from '@pnpm/prepare' +import { addDistTag } from '@pnpm/registry-mock' + import { testDefaults } from '../utils/index.js' test('readPackage, afterAllResolved hooks', async () => { diff --git a/pkg-manager/core/test/install/ignoredOptionalDependencies.ts b/pkg-manager/core/test/install/ignoredOptionalDependencies.ts index 31c66646f7..41a91a8ec3 100644 --- a/pkg-manager/core/test/install/ignoredOptionalDependencies.ts +++ b/pkg-manager/core/test/install/ignoredOptionalDependencies.ts @@ -1,6 +1,7 @@ -import type { ProjectManifest } from '@pnpm/types' -import { prepareEmpty } from '@pnpm/prepare' import { addDependenciesToPackage, install } from '@pnpm/core' +import { prepareEmpty } from '@pnpm/prepare' +import type { ProjectManifest } from '@pnpm/types' + import { testDefaults, } from '../utils/index.js' diff --git a/pkg-manager/core/test/install/injectLocalPackages.ts b/pkg-manager/core/test/install/injectLocalPackages.ts index fb16c25e93..b4c6d2eff6 100644 --- a/pkg-manager/core/test/install/injectLocalPackages.ts +++ b/pkg-manager/core/test/install/injectLocalPackages.ts @@ -1,11 +1,13 @@ import fs from 'fs' import path from 'path' + import { assertProject } from '@pnpm/assert-project' import { type MutatedProject, mutateModules, type ProjectOptions } from '@pnpm/core' import { preparePackages } from '@pnpm/prepare' import type { ProjectRootDir } from '@pnpm/types' import { rimrafSync } from '@zkochan/rimraf' import { writeJsonFileSync } from 'write-json-file' + import { testDefaults } from '../utils/index.js' test('inject local packages', async () => { diff --git a/pkg-manager/core/test/install/installationChecks.ts b/pkg-manager/core/test/install/installationChecks.ts index 7769089fd8..c75b2b90bf 100644 --- a/pkg-manager/core/test/install/installationChecks.ts +++ b/pkg-manager/core/test/install/installationChecks.ts @@ -1,6 +1,7 @@ import { WANTED_LOCKFILE } from '@pnpm/constants' -import { prepareEmpty } from '@pnpm/prepare' import { addDependenciesToPackage } from '@pnpm/core' +import { prepareEmpty } from '@pnpm/prepare' + import { testDefaults } from '../utils/index.js' test('fail if installed package does not support the current engine and engine-strict = true', async () => { diff --git a/pkg-manager/core/test/install/lifecycleScripts.ts b/pkg-manager/core/test/install/lifecycleScripts.ts index 022f5d122e..99d9d50839 100644 --- a/pkg-manager/core/test/install/lifecycleScripts.ts +++ b/pkg-manager/core/test/install/lifecycleScripts.ts @@ -1,23 +1,25 @@ -import * as path from 'path' import fs from 'fs' +import * as path from 'path' + +import { jest } from '@jest/globals' import { assertProject } from '@pnpm/assert-project' -import type { LifecycleLog } from '@pnpm/core-loggers' -import { prepareEmpty, preparePackages } from '@pnpm/prepare' import { addDependenciesToPackage, install, - mutateModulesInSingleProject, type MutatedProject, mutateModules, + mutateModulesInSingleProject, } from '@pnpm/core' +import type { LifecycleLog } from '@pnpm/core-loggers' +import { prepareEmpty, preparePackages } from '@pnpm/prepare' import { createTestIpcServer } from '@pnpm/test-ipc-server' import type { ProjectRootDir } from '@pnpm/types' import { restartWorkerPool } from '@pnpm/worker' -import { jest } from '@jest/globals' import { rimrafSync } from '@zkochan/rimraf' import isWindows from 'is-windows' import { loadJsonFileSync } from 'load-json-file' import PATH from 'path-name' + import { testDefaults } from '../utils/index.js' const testOnNonWindows = isWindows() ? test.skip : test diff --git a/pkg-manager/core/test/install/local.ts b/pkg-manager/core/test/install/local.ts index 55025b0814..622d8533ec 100644 --- a/pkg-manager/core/test/install/local.ts +++ b/pkg-manager/core/test/install/local.ts @@ -1,23 +1,25 @@ import fs from 'fs' import path from 'path' + import { LOCKFILE_VERSION } from '@pnpm/constants' +import { + addDependenciesToPackage, + install, + type MutatedProject, + mutateModules, + mutateModulesInSingleProject, + type ProjectOptions, +} from '@pnpm/core' import type { LockfileFile } from '@pnpm/lockfile.fs' import { prepareEmpty, preparePackages } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' import { fixtures } from '@pnpm/test-fixtures' import type { ProjectRootDir } from '@pnpm/types' -import { - addDependenciesToPackage, - install, - mutateModules, - type MutatedProject, - mutateModulesInSingleProject, - type ProjectOptions, -} from '@pnpm/core' import { rimrafSync } from '@zkochan/rimraf' import normalizePath from 'normalize-path' import { readYamlFileSync } from 'read-yaml-file' import symlinkDir from 'symlink-dir' + import { testDefaults } from '../utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/core/test/install/lockfileDir.ts b/pkg-manager/core/test/install/lockfileDir.ts index 0a62d11750..3786734d08 100644 --- a/pkg-manager/core/test/install/lockfileDir.ts +++ b/pkg-manager/core/test/install/lockfileDir.ts @@ -1,12 +1,14 @@ import path from 'path' + import { WANTED_LOCKFILE } from '@pnpm/constants' +import { addDependenciesToPackage, mutateModulesInSingleProject } from '@pnpm/core' import type { LockfileObject } from '@pnpm/lockfile.fs' import { prepareEmpty } from '@pnpm/prepare' import { fixtures } from '@pnpm/test-fixtures' -import { readYamlFileSync } from 'read-yaml-file' -import { addDependenciesToPackage, mutateModulesInSingleProject } from '@pnpm/core' -import type { ProjectRootDir, DepPath } from '@pnpm/types' +import type { DepPath, ProjectRootDir } from '@pnpm/types' import { rimrafSync } from '@zkochan/rimraf' +import { readYamlFileSync } from 'read-yaml-file' + import { testDefaults } from '../utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/core/test/install/lockfileOnly.ts b/pkg-manager/core/test/install/lockfileOnly.ts index 47cd8c70e6..e8eb7fc8b5 100644 --- a/pkg-manager/core/test/install/lockfileOnly.ts +++ b/pkg-manager/core/test/install/lockfileOnly.ts @@ -1,13 +1,15 @@ import fs from 'fs' import path from 'path' + import { assertStore } from '@pnpm/assert-store' -import { prepareEmpty } from '@pnpm/prepare' -import { REGISTRY_MOCK_PORT, addDistTag } from '@pnpm/registry-mock' import { ABBREVIATED_META_DIR } from '@pnpm/constants' import { addDependenciesToPackage, install, } from '@pnpm/core' +import { prepareEmpty } from '@pnpm/prepare' +import { addDistTag, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' + import { testDefaults } from '../utils/index.js' test('install with lockfileOnly = true', async () => { diff --git a/pkg-manager/core/test/install/minimumReleaseAge.ts b/pkg-manager/core/test/install/minimumReleaseAge.ts index aecb32c735..e783aedff5 100644 --- a/pkg-manager/core/test/install/minimumReleaseAge.ts +++ b/pkg-manager/core/test/install/minimumReleaseAge.ts @@ -1,5 +1,6 @@ -import { prepareEmpty } from '@pnpm/prepare' import { addDependenciesToPackage } from '@pnpm/core' +import { prepareEmpty } from '@pnpm/prepare' + import { testDefaults } from '../utils/index.js' const isOdd011ReleaseDate = new Date(2016, 11, 7 - 2) // 0.1.1 was released at 2016-12-07T07:18:01.205Z diff --git a/pkg-manager/core/test/install/misc.ts b/pkg-manager/core/test/install/misc.ts index 019a62f018..60a3c175a0 100644 --- a/pkg-manager/core/test/install/misc.ts +++ b/pkg-manager/core/test/install/misc.ts @@ -1,17 +1,8 @@ -import * as path from 'path' import fs from 'fs' -import { prepare, prepareEmpty, preparePackages } from '@pnpm/prepare' -import type { - PackageManifestLog, - ProgressLog, - RootLog, - StageLog, - StatsLog, -} from '@pnpm/core-loggers' +import * as path from 'path' + +import { jest } from '@jest/globals' import { LOCKFILE_VERSION } from '@pnpm/constants' -import { fixtures } from '@pnpm/test-fixtures' -import type { ProjectManifest, ProjectRootDir } from '@pnpm/types' -import { addDistTag, getIntegrity, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { addDependenciesToPackage, install, @@ -19,14 +10,25 @@ import { UnexpectedStoreError, UnexpectedVirtualStoreDirError, } from '@pnpm/core' +import type { + PackageManifestLog, + ProgressLog, + RootLog, + StageLog, + StatsLog, +} from '@pnpm/core-loggers' +import { prepare, prepareEmpty, preparePackages } from '@pnpm/prepare' +import { addDistTag, getIntegrity, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' +import { fixtures } from '@pnpm/test-fixtures' +import type { ProjectManifest, ProjectRootDir } from '@pnpm/types' import { rimrafSync } from '@zkochan/rimraf' -import { safeExeca as execa } from 'execa' import { isCI } from 'ci-info' +import deepRequireCwd from 'deep-require-cwd' +import { safeExeca as execa } from 'execa' import isWindows from 'is-windows' import semver from 'semver' -import { jest } from '@jest/globals' -import deepRequireCwd from 'deep-require-cwd' import { writeYamlFileSync } from 'write-yaml-file' + import { testDefaults } from '../utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/core/test/install/modulesCache.ts b/pkg-manager/core/test/install/modulesCache.ts index e4e9d29830..61e990c2e7 100644 --- a/pkg-manager/core/test/install/modulesCache.ts +++ b/pkg-manager/core/test/install/modulesCache.ts @@ -1,12 +1,14 @@ import path from 'path' -import { readModulesManifest, writeModulesManifest } from '@pnpm/modules-yaml' -import { prepareEmpty } from '@pnpm/prepare' + import { addDependenciesToPackage, install, mutateModulesInSingleProject, } from '@pnpm/core' +import { readModulesManifest, writeModulesManifest } from '@pnpm/modules-yaml' +import { prepareEmpty } from '@pnpm/prepare' import type { ProjectRootDir } from '@pnpm/types' + import { testDefaults } from '../utils/index.js' test('the modules cache is pruned when it expires', async () => { diff --git a/pkg-manager/core/test/install/modulesDir.ts b/pkg-manager/core/test/install/modulesDir.ts index 593790583a..baf7972d04 100644 --- a/pkg-manager/core/test/install/modulesDir.ts +++ b/pkg-manager/core/test/install/modulesDir.ts @@ -1,12 +1,14 @@ import path from 'path' -import { prepareEmpty, preparePackages } from '@pnpm/prepare' + import { install, type MutatedProject, mutateModules, } from '@pnpm/core' +import { prepareEmpty, preparePackages } from '@pnpm/prepare' import type { ProjectRootDir } from '@pnpm/types' import { rimrafSync } from '@zkochan/rimraf' + import { testDefaults } from '../utils/index.js' test('installing to a custom modules directory', async () => { diff --git a/pkg-manager/core/test/install/multipleImporters.ts b/pkg-manager/core/test/install/multipleImporters.ts index b6cbfae9d1..a2bb6de749 100644 --- a/pkg-manager/core/test/install/multipleImporters.ts +++ b/pkg-manager/core/test/install/multipleImporters.ts @@ -1,23 +1,25 @@ import fs from 'fs' import path from 'path' + +import { jest } from '@jest/globals' import { assertProject } from '@pnpm/assert-project' import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' -import { readCurrentLockfile } from '@pnpm/lockfile.fs' -import { prepareEmpty, preparePackages } from '@pnpm/prepare' -import { addDistTag } from '@pnpm/registry-mock' -import type { ProjectManifest, ProjectId, ProjectRootDir } from '@pnpm/types' import { addDependenciesToPackage, type MutatedProject, mutateModules, mutateModulesInSingleProject, } from '@pnpm/core' -import { rimrafSync } from '@zkochan/rimraf' import { createPeerDepGraphHash } from '@pnpm/dependency-path' +import { readCurrentLockfile } from '@pnpm/lockfile.fs' +import { prepareEmpty, preparePackages } from '@pnpm/prepare' +import { addDistTag } from '@pnpm/registry-mock' +import type { ProjectId, ProjectManifest, ProjectRootDir } from '@pnpm/types' +import { rimrafSync } from '@zkochan/rimraf' import { loadJsonFileSync } from 'load-json-file' import { readYamlFileSync } from 'read-yaml-file' -import { jest } from '@jest/globals' import { writeYamlFileSync } from 'write-yaml-file' + import { testDefaults } from '../utils/index.js' test('install only the dependencies of the specified importer', async () => { diff --git a/pkg-manager/core/test/install/nodeRuntime.ts b/pkg-manager/core/test/install/nodeRuntime.ts index 3f846473ed..cc812b7f38 100644 --- a/pkg-manager/core/test/install/nodeRuntime.ts +++ b/pkg-manager/core/test/install/nodeRuntime.ts @@ -1,12 +1,14 @@ import fs from 'fs' import path from 'path' + import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' -import type { VariationsResolution } from '@pnpm/resolver-base' -import { prepareEmpty } from '@pnpm/prepare' import { addDependenciesToPackage, install } from '@pnpm/core' +import { prepareEmpty } from '@pnpm/prepare' import { getIntegrity } from '@pnpm/registry-mock' +import type { VariationsResolution } from '@pnpm/resolver-base' import { rimrafSync } from '@zkochan/rimraf' import { writeYamlFileSync } from 'write-yaml-file' + import { testDefaults } from '../utils/index.js' // The standard glibc variants from nodejs.org/download/release/ diff --git a/pkg-manager/core/test/install/only.ts b/pkg-manager/core/test/install/only.ts index 3846c18871..df3944b9b0 100644 --- a/pkg-manager/core/test/install/only.ts +++ b/pkg-manager/core/test/install/only.ts @@ -1,7 +1,9 @@ import fs from 'fs' import path from 'path' -import { prepareEmpty } from '@pnpm/prepare' + import { addDependenciesToPackage, install } from '@pnpm/core' +import { prepareEmpty } from '@pnpm/prepare' + import { testDefaults } from '../utils/index.js' test('production install (with --production flag)', async () => { diff --git a/pkg-manager/core/test/install/optionalDependencies.ts b/pkg-manager/core/test/install/optionalDependencies.ts index 6b4b9d3d7b..1209490807 100644 --- a/pkg-manager/core/test/install/optionalDependencies.ts +++ b/pkg-manager/core/test/install/optionalDependencies.ts @@ -1,11 +1,7 @@ import fs from 'fs' import path from 'path' -import type { LockfileFile } from '@pnpm/lockfile.fs' -import { prepareEmpty, preparePackages } from '@pnpm/prepare' -import type { ProjectRootDir } from '@pnpm/types' + import { jest } from '@jest/globals' -import deepRequireCwd from 'deep-require-cwd' -import { readYamlFileSync } from 'read-yaml-file' import { addDependenciesToPackage, install, @@ -13,7 +9,13 @@ import { mutateModules, mutateModulesInSingleProject, } from '@pnpm/core' +import type { LockfileFile } from '@pnpm/lockfile.fs' +import { prepareEmpty, preparePackages } from '@pnpm/prepare' +import type { ProjectRootDir } from '@pnpm/types' import { rimrafSync } from '@zkochan/rimraf' +import deepRequireCwd from 'deep-require-cwd' +import { readYamlFileSync } from 'read-yaml-file' + import { testDefaults } from '../utils/index.js' test('successfully install optional dependency with subdependencies', async () => { diff --git a/pkg-manager/core/test/install/overrides.ts b/pkg-manager/core/test/install/overrides.ts index 4503d3dd7b..186d6dc2f9 100644 --- a/pkg-manager/core/test/install/overrides.ts +++ b/pkg-manager/core/test/install/overrides.ts @@ -1,13 +1,15 @@ -import path from 'path' import fs from 'fs' -import { readYamlFileSync } from 'read-yaml-file' +import path from 'path' + +import { WANTED_LOCKFILE } from '@pnpm/constants' +import { addDependenciesToPackage, type MutatedProject, mutateModules, mutateModulesInSingleProject, type ProjectOptions } from '@pnpm/core' import { PnpmError } from '@pnpm/error' +import type { LockfileFile } from '@pnpm/lockfile.types' import { prepare, prepareEmpty, preparePackages } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' -import { WANTED_LOCKFILE } from '@pnpm/constants' -import { type MutatedProject, type ProjectOptions, addDependenciesToPackage, mutateModulesInSingleProject, mutateModules } from '@pnpm/core' -import type { LockfileFile } from '@pnpm/lockfile.types' -import type { ProjectRootDir, ProjectManifest } from '@pnpm/types' +import type { ProjectManifest, ProjectRootDir } from '@pnpm/types' +import { readYamlFileSync } from 'read-yaml-file' + import { testDefaults } from '../utils/index.js' test('versions are replaced with versions specified through overrides option', async () => { diff --git a/pkg-manager/core/test/install/packageExtensions.ts b/pkg-manager/core/test/install/packageExtensions.ts index 5f42630aa1..acd085a98a 100644 --- a/pkg-manager/core/test/install/packageExtensions.ts +++ b/pkg-manager/core/test/install/packageExtensions.ts @@ -1,8 +1,9 @@ +import { addDependenciesToPackage, install, mutateModulesInSingleProject } from '@pnpm/core' +import { hashObject as _hashObject } from '@pnpm/crypto.object-hasher' import { PnpmError } from '@pnpm/error' import { prepareEmpty } from '@pnpm/prepare' -import { addDependenciesToPackage, mutateModulesInSingleProject, install } from '@pnpm/core' -import { hashObject as _hashObject } from '@pnpm/crypto.object-hasher' -import type { ProjectRootDir, PackageExtension, ProjectManifest } from '@pnpm/types' +import type { PackageExtension, ProjectManifest, ProjectRootDir } from '@pnpm/types' + import { testDefaults, } from '../utils/index.js' diff --git a/pkg-manager/core/test/install/patch.ts b/pkg-manager/core/test/install/patch.ts index 52f37780d5..8fa92efe58 100644 --- a/pkg-manager/core/test/install/patch.ts +++ b/pkg-manager/core/test/install/patch.ts @@ -1,16 +1,18 @@ import fs from 'fs' import path from 'path' -import type { PackageFilesIndex } from '@pnpm/store.cafs' + +import { jest } from '@jest/globals' import { ENGINE_NAME } from '@pnpm/constants' import { install } from '@pnpm/core' import type { IgnoredScriptsLog } from '@pnpm/core-loggers' import { createHexHashFromFile } from '@pnpm/crypto.hash' import { prepareEmpty } from '@pnpm/prepare' import { getIntegrity } from '@pnpm/registry-mock' +import type { PackageFilesIndex } from '@pnpm/store.cafs' import { StoreIndex, storeIndexKey } from '@pnpm/store.index' import { fixtures } from '@pnpm/test-fixtures' -import { jest } from '@jest/globals' import { rimrafSync } from '@zkochan/rimraf' + import { testDefaults } from '../utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/core/test/install/peerDependencies.ts b/pkg-manager/core/test/install/peerDependencies.ts index c35e7527ff..b66a1508b7 100644 --- a/pkg-manager/core/test/install/peerDependencies.ts +++ b/pkg-manager/core/test/install/peerDependencies.ts @@ -1,14 +1,9 @@ import fs from 'fs' import path from 'path' + +import { jest } from '@jest/globals' import type { Project } from '@pnpm/assert-project' import { WANTED_LOCKFILE } from '@pnpm/constants' -import type { LockfileFile } from '@pnpm/lockfile.fs' -import { prepareEmpty, preparePackages } from '@pnpm/prepare' -import { addDistTag, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' -import { fixtures } from '@pnpm/test-fixtures' -import type { ProjectRootDir } from '@pnpm/types' -import { jest } from '@jest/globals' -import { readYamlFileSync } from 'read-yaml-file' import { addDependenciesToPackage, install, @@ -18,9 +13,16 @@ import { type PeerDependencyIssuesError, type ProjectOptions, } from '@pnpm/core' +import { createPeerDepGraphHash, depPathToFilename } from '@pnpm/dependency-path' +import type { LockfileFile } from '@pnpm/lockfile.fs' +import { prepareEmpty, preparePackages } from '@pnpm/prepare' +import { addDistTag, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' +import { fixtures } from '@pnpm/test-fixtures' +import type { ProjectRootDir } from '@pnpm/types' import { rimrafSync } from '@zkochan/rimraf' import deepRequireCwd from 'deep-require-cwd' -import { createPeerDepGraphHash, depPathToFilename } from '@pnpm/dependency-path' +import { readYamlFileSync } from 'read-yaml-file' + import { testDefaults } from '../utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/core/test/install/reporting.ts b/pkg-manager/core/test/install/reporting.ts index bf723c9c83..e3777b7d57 100644 --- a/pkg-manager/core/test/install/reporting.ts +++ b/pkg-manager/core/test/install/reporting.ts @@ -1,9 +1,10 @@ -import type { DeprecationLog } from '@pnpm/core-loggers' -import { prepareEmpty } from '@pnpm/prepare' +import { jest } from '@jest/globals' import { addDependenciesToPackage, } from '@pnpm/core' -import { jest } from '@jest/globals' +import type { DeprecationLog } from '@pnpm/core-loggers' +import { prepareEmpty } from '@pnpm/prepare' + import { testDefaults } from '../utils/index.js' // TODO: use a smaller package for testing deprecation diff --git a/pkg-manager/core/test/install/resolutionMode.ts b/pkg-manager/core/test/install/resolutionMode.ts index bd05ea2f46..87ea83d852 100644 --- a/pkg-manager/core/test/install/resolutionMode.ts +++ b/pkg-manager/core/test/install/resolutionMode.ts @@ -1,6 +1,7 @@ +import { addDependenciesToPackage, install } from '@pnpm/core' import { prepareEmpty } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' -import { addDependenciesToPackage, install } from '@pnpm/core' + import { testDefaults } from '../utils/index.js' test('time-based resolution mode', async () => { diff --git a/pkg-manager/core/test/install/setExtraNodePath.ts b/pkg-manager/core/test/install/setExtraNodePath.ts index b1fb177b7a..9964758329 100644 --- a/pkg-manager/core/test/install/setExtraNodePath.ts +++ b/pkg-manager/core/test/install/setExtraNodePath.ts @@ -1,13 +1,15 @@ import fs from 'fs' import path from 'path' -import { preparePackages, tempDir } from '@pnpm/prepare' -import { fixtures } from '@pnpm/test-fixtures' + import { + install, type MutatedProject, mutateModules, - install, } from '@pnpm/core' +import { preparePackages, tempDir } from '@pnpm/prepare' +import { fixtures } from '@pnpm/test-fixtures' import type { ProjectRootDir } from '@pnpm/types' + import { testDefaults } from '../utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/core/test/install/sideEffects.ts b/pkg-manager/core/test/install/sideEffects.ts index 33a45c74f5..534ab8e94a 100644 --- a/pkg-manager/core/test/install/sideEffects.ts +++ b/pkg-manager/core/test/install/sideEffects.ts @@ -1,13 +1,15 @@ import fs from 'fs' import path from 'path' + +import { ENGINE_NAME } from '@pnpm/constants' import { addDependenciesToPackage, install } from '@pnpm/core' import { hashObject } from '@pnpm/crypto.object-hasher' +import { prepareEmpty } from '@pnpm/prepare' +import { getIntegrity, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { getFilePathByModeInCafs, type PackageFilesIndex } from '@pnpm/store.cafs' import { StoreIndex, storeIndexKey } from '@pnpm/store.index' -import { getIntegrity, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' -import { prepareEmpty } from '@pnpm/prepare' -import { ENGINE_NAME } from '@pnpm/constants' import { rimrafSync } from '@zkochan/rimraf' + import { testDefaults } from '../utils/index.js' const ENGINE_DIR = `${process.platform}-${process.arch}-node-${process.version.split('.')[0]}` diff --git a/pkg-manager/core/test/install/stats.ts b/pkg-manager/core/test/install/stats.ts index 6212981acf..14e9cc0e35 100644 --- a/pkg-manager/core/test/install/stats.ts +++ b/pkg-manager/core/test/install/stats.ts @@ -1,10 +1,11 @@ -import { prepareEmpty } from '@pnpm/prepare' import { - mutateModules, type MutatedProject, + mutateModules, } from '@pnpm/core' +import { prepareEmpty } from '@pnpm/prepare' import type { ProjectRootDir } from '@pnpm/types' import { rimrafSync } from '@zkochan/rimraf' + import { testDefaults } from '../utils/index.js' test('spec not specified in package.json.dependencies', async () => { diff --git a/pkg-manager/core/test/install/update.ts b/pkg-manager/core/test/install/update.ts index 23cbb9a714..48aca29e3a 100644 --- a/pkg-manager/core/test/install/update.ts +++ b/pkg-manager/core/test/install/update.ts @@ -1,10 +1,12 @@ import path from 'path' + import { WANTED_LOCKFILE } from '@pnpm/constants' +import { addDependenciesToPackage, install } from '@pnpm/core' import type { LockfileFile } from '@pnpm/lockfile.fs' import { prepareEmpty } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' import { readYamlFileSync } from 'read-yaml-file' -import { addDependenciesToPackage, install } from '@pnpm/core' + import { testDefaults } from '../utils/index.js' test('preserve subdeps on update', async () => { diff --git a/pkg-manager/core/test/install/updatingPkgJson.ts b/pkg-manager/core/test/install/updatingPkgJson.ts index 7adb98f699..3e4ee7d399 100644 --- a/pkg-manager/core/test/install/updatingPkgJson.ts +++ b/pkg-manager/core/test/install/updatingPkgJson.ts @@ -1,11 +1,12 @@ -import { prepareEmpty } from '@pnpm/prepare' import { addDependenciesToPackage, install, mutateModulesInSingleProject, } from '@pnpm/core' +import { prepareEmpty } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' import type { ProjectRootDir } from '@pnpm/types' + import { testDefaults } from '../utils/index.js' test('save to package.json (is-positive@^1.0.0)', async () => { diff --git a/pkg-manager/core/test/install/validatePeerDependencies.ts b/pkg-manager/core/test/install/validatePeerDependencies.ts index 56d04d8e27..82700ff5d8 100644 --- a/pkg-manager/core/test/install/validatePeerDependencies.ts +++ b/pkg-manager/core/test/install/validatePeerDependencies.ts @@ -1,8 +1,10 @@ import fs from 'fs' import path from 'path' + import { install } from '@pnpm/core' import { readWantedLockfile } from '@pnpm/lockfile.fs' import { preparePackages } from '@pnpm/prepare' + import { testDefaults } from '../utils/index.js' test('throws an error when the peerDependencies have unallowed specs', async () => { diff --git a/pkg-manager/core/test/install/virtualStoreDirMaxLength.ts b/pkg-manager/core/test/install/virtualStoreDirMaxLength.ts index ba25495704..850592105e 100644 --- a/pkg-manager/core/test/install/virtualStoreDirMaxLength.ts +++ b/pkg-manager/core/test/install/virtualStoreDirMaxLength.ts @@ -1,6 +1,8 @@ import fs from 'fs' + import { addDependenciesToPackage, install } from '@pnpm/core' import { prepareEmpty } from '@pnpm/prepare' + import { testDefaults } from '../utils/index.js' test('setting a custom virtual store directory max length', async () => { diff --git a/pkg-manager/core/test/link.ts b/pkg-manager/core/test/link.ts index 63d7b4503c..6e686f1131 100644 --- a/pkg-manager/core/test/link.ts +++ b/pkg-manager/core/test/link.ts @@ -1,9 +1,11 @@ import path from 'path' + import { addDependenciesToPackage, install } from '@pnpm/core' -import { fixtures } from '@pnpm/test-fixtures' import { prepareEmpty } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' +import { fixtures } from '@pnpm/test-fixtures' import symlinkDir from 'symlink-dir' + import { testDefaults } from './utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/core/test/lockfile.ts b/pkg-manager/core/test/lockfile.ts index 73ad4fa9ed..a83b5508aa 100644 --- a/pkg-manager/core/test/lockfile.ts +++ b/pkg-manager/core/test/lockfile.ts @@ -1,29 +1,31 @@ import fs from 'fs' import path from 'path' -import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' -import type { RootLog } from '@pnpm/core-loggers' -import type { PnpmError } from '@pnpm/error' -import { fixtures } from '@pnpm/test-fixtures' -import type { LockfileObject, TarballResolution } from '@pnpm/lockfile.fs' -import type { LockfileFile } from '@pnpm/lockfile.types' -import { tempDir, prepareEmpty, preparePackages } from '@pnpm/prepare' -import { readPackageJsonFromDir } from '@pnpm/read-package-json' -import { addDistTag, getIntegrity, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' -import type { DepPath, ProjectManifest, ProjectRootDir } from '@pnpm/types' + import { jest } from '@jest/globals' -import { readYamlFileSync } from 'read-yaml-file' +import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' import { addDependenciesToPackage, install, + type MutatedProject, mutateModules, mutateModulesInSingleProject, - type MutatedProject, type ProjectOptions, } from '@pnpm/core' +import type { RootLog } from '@pnpm/core-loggers' +import type { PnpmError } from '@pnpm/error' +import type { LockfileObject, TarballResolution } from '@pnpm/lockfile.fs' +import type { LockfileFile } from '@pnpm/lockfile.types' +import { prepareEmpty, preparePackages, tempDir } from '@pnpm/prepare' +import { readPackageJsonFromDir } from '@pnpm/read-package-json' +import { addDistTag, getIntegrity, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' +import { fixtures } from '@pnpm/test-fixtures' +import type { DepPath, ProjectManifest, ProjectRootDir } from '@pnpm/types' import { rimrafSync } from '@zkochan/rimraf' import { loadJsonFileSync } from 'load-json-file' import nock from 'nock' +import { readYamlFileSync } from 'read-yaml-file' import { writeYamlFileSync } from 'write-yaml-file' + import { testDefaults } from './utils/index.js' afterEach(() => { diff --git a/pkg-manager/core/test/offline.ts b/pkg-manager/core/test/offline.ts index 5455897c2a..e2c7d015c5 100644 --- a/pkg-manager/core/test/offline.ts +++ b/pkg-manager/core/test/offline.ts @@ -1,6 +1,7 @@ -import { prepareEmpty } from '@pnpm/prepare' import { addDependenciesToPackage, install } from '@pnpm/core' +import { prepareEmpty } from '@pnpm/prepare' import { rimrafSync } from '@zkochan/rimraf' + import { testDefaults } from './utils/index.js' test('offline installation fails when package meta not found in local registry mirror', async () => { diff --git a/pkg-manager/core/test/packageImportMethods.ts b/pkg-manager/core/test/packageImportMethods.ts index 5ee0a2b508..dc5766d696 100644 --- a/pkg-manager/core/test/packageImportMethods.ts +++ b/pkg-manager/core/test/packageImportMethods.ts @@ -1,7 +1,9 @@ import fs from 'fs' -import { prepareEmpty } from '@pnpm/prepare' + import { addDependenciesToPackage } from '@pnpm/core' +import { prepareEmpty } from '@pnpm/prepare' import { loadJsonFileSync } from 'load-json-file' + import { testDefaults } from './utils/index.js' test('packageImportMethod can be set to copy', async () => { diff --git a/pkg-manager/core/test/prune.ts b/pkg-manager/core/test/prune.ts index a154c84fdb..348b67155b 100644 --- a/pkg-manager/core/test/prune.ts +++ b/pkg-manager/core/test/prune.ts @@ -1,15 +1,17 @@ import path from 'path' -import type { RootLog } from '@pnpm/core-loggers' -import { prepareEmpty } from '@pnpm/prepare' -import { fixtures } from '@pnpm/test-fixtures' + +import { jest } from '@jest/globals' import { addDependenciesToPackage, install, mutateModulesInSingleProject, } from '@pnpm/core' +import type { RootLog } from '@pnpm/core-loggers' +import { prepareEmpty } from '@pnpm/prepare' +import { fixtures } from '@pnpm/test-fixtures' import type { ProjectRootDir } from '@pnpm/types' -import { jest } from '@jest/globals' import symlinkDir from 'symlink-dir' + import { testDefaults } from './utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/core/test/uninstall.ts b/pkg-manager/core/test/uninstall.ts index 227177bf01..3b86291f1a 100644 --- a/pkg-manager/core/test/uninstall.ts +++ b/pkg-manager/core/test/uninstall.ts @@ -1,6 +1,13 @@ import fs from 'fs' import path from 'path' + +import { jest } from '@jest/globals' import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' +import { + addDependenciesToPackage, + mutateModules, + mutateModulesInSingleProject, +} from '@pnpm/core' import type { PackageManifestLog, RootLog, @@ -10,17 +17,12 @@ import type { LockfileObject } from '@pnpm/lockfile.fs' import { prepareEmpty, preparePackages } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { fixtures } from '@pnpm/test-fixtures' -import type { ProjectRootDir, PackageManifest } from '@pnpm/types' +import type { PackageManifest, ProjectRootDir } from '@pnpm/types' +import existsSymlink from 'exists-link' import { readYamlFileSync } from 'read-yaml-file' import symlinkDir from 'symlink-dir' -import { - addDependenciesToPackage, - mutateModules, - mutateModulesInSingleProject, -} from '@pnpm/core' -import { jest } from '@jest/globals' import { writeJsonFileSync } from 'write-json-file' -import existsSymlink from 'exists-link' + import { testDefaults } from './utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/core/test/utils/testDefaults.ts b/pkg-manager/core/test/utils/testDefaults.ts index cf69983322..7e548952b1 100644 --- a/pkg-manager/core/test/utils/testDefaults.ts +++ b/pkg-manager/core/test/utils/testDefaults.ts @@ -1,9 +1,9 @@ -import { createTempStore } from '@pnpm/testing.temp-store' -import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' -import type { StoreController } from '@pnpm/store-controller-types' -import type { Registries } from '@pnpm/types' import type { InstallOptions } from '@pnpm/core' import type { CustomResolver } from '@pnpm/hooks.types' +import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' +import type { StoreController } from '@pnpm/store-controller-types' +import { createTempStore } from '@pnpm/testing.temp-store' +import type { Registries } from '@pnpm/types' const registry = `http://localhost:${REGISTRY_MOCK_PORT}/` diff --git a/pkg-manager/direct-dep-linker/src/linkDirectDeps.ts b/pkg-manager/direct-dep-linker/src/linkDirectDeps.ts index b9e94109b7..e2aea9a932 100644 --- a/pkg-manager/direct-dep-linker/src/linkDirectDeps.ts +++ b/pkg-manager/direct-dep-linker/src/linkDirectDeps.ts @@ -1,10 +1,11 @@ import fs from 'fs' import path from 'path' + import { rootLogger } from '@pnpm/core-loggers' -import { symlinkDependency, symlinkDirectRootDependency } from '@pnpm/symlink-dependency' -import { omit } from 'ramda' import { readModulesDir } from '@pnpm/read-modules-dir' +import { symlinkDependency, symlinkDirectRootDependency } from '@pnpm/symlink-dependency' import { rimraf } from '@zkochan/rimraf' +import { omit } from 'ramda' import { resolveLinkTarget } from 'resolve-link-target' export interface LinkedDirectDep { diff --git a/pkg-manager/get-context/src/index.ts b/pkg-manager/get-context/src/index.ts index 956e3388e9..ab818a14e7 100644 --- a/pkg-manager/get-context/src/index.ts +++ b/pkg-manager/get-context/src/index.ts @@ -1,27 +1,29 @@ import { promises as fs } from 'fs' import path from 'path' + import { contextLogger, packageManifestLogger } from '@pnpm/core-loggers' import type { LockfileObject } from '@pnpm/lockfile.fs' import type { IncludedDependencies, Modules, } from '@pnpm/modules-yaml' +import { registerProject } from '@pnpm/package-store' import { readProjectsContext } from '@pnpm/read-projects-context' import type { WorkspacePackages } from '@pnpm/resolver-base' import type { + DependencyManifest, DepPath, HoistedDependencies, ProjectId, ProjectManifest, - ReadPackageHook, - Registries, - DependencyManifest, ProjectRootDir, ProjectRootDirRealPath, + ReadPackageHook, + Registries, } from '@pnpm/types' import { pathAbsolute } from 'path-absolute' import { clone } from 'ramda' -import { registerProject } from '@pnpm/package-store' + import { readLockfiles } from './readLockfiles.js' /** diff --git a/pkg-manager/get-context/test/index.ts b/pkg-manager/get-context/test/index.ts index 4b96d4defd..e1d2741329 100644 --- a/pkg-manager/get-context/test/index.ts +++ b/pkg-manager/get-context/test/index.ts @@ -1,7 +1,9 @@ /// -import { getContext, arrayOfWorkspacePackagesToMap } from '@pnpm/get-context' -import type { ProjectRootDir } from '@pnpm/types' import path from 'path' + +import { arrayOfWorkspacePackagesToMap, getContext } from '@pnpm/get-context' +import type { ProjectRootDir } from '@pnpm/types' + import type { GetContextOptions } from '../src/index.js' const DEFAULT_OPTIONS: GetContextOptions = { diff --git a/pkg-manager/headless/src/index.ts b/pkg-manager/headless/src/index.ts index 853e2792fe..3eb7340770 100644 --- a/pkg-manager/headless/src/index.ts +++ b/pkg-manager/headless/src/index.ts @@ -1,5 +1,6 @@ import { promises as fs } from 'fs' import path from 'path' + import { buildModules } from '@pnpm/building.during-install' import { createAllowBuildFunction } from '@pnpm/building.policy' import { calcDepState, type DepsStateCache } from '@pnpm/calc-dep-state' @@ -14,29 +15,36 @@ import { statsLogger, summaryLogger, } from '@pnpm/core-loggers' +import * as dp from '@pnpm/dependency-path' +import { + type DependenciesGraph, + type DependenciesGraphNode, + type DirectDependenciesByImporterId, + lockfileToDepGraph, + type LockfileToDepGraphOptions, +} from '@pnpm/deps.graph-builder' +import { hoist, type HoistedWorkspaceProject } from '@pnpm/hoist' +import { + makeNodeRequireOption, + runLifecycleHooksConcurrently, +} from '@pnpm/lifecycle' +import { linkBins, linkBinsOfPackages } from '@pnpm/link-bins' import { filterLockfileByEngine, filterLockfileByImportersAndEngine, } from '@pnpm/lockfile.filtering' -import { hoist, type HoistedWorkspaceProject } from '@pnpm/hoist' -import { - runLifecycleHooksConcurrently, - makeNodeRequireOption, -} from '@pnpm/lifecycle' -import { linkBins, linkBinsOfPackages } from '@pnpm/link-bins' import { getLockfileImporterId, type LockfileObject, readCurrentLockfile, readWantedLockfile, - writeLockfiles, writeCurrentLockfile, + writeLockfiles, } from '@pnpm/lockfile.fs' -import { writePnpFile } from '@pnpm/lockfile-to-pnp' import { nameVerFromPkgSnapshot, } from '@pnpm/lockfile.utils' -import { extendProjectsWithTargetDirs } from './extendProjectsWithTargetDirs.js' +import { writePnpFile } from '@pnpm/lockfile-to-pnp' import { type LogBase, logger, @@ -49,9 +57,10 @@ import { writeModulesManifest, } from '@pnpm/modules-yaml' import type { PatchGroupRecord } from '@pnpm/patching.config' -import type { HoistingLimits } from '@pnpm/real-hoist' +import { linkDirectDeps, type LinkedDirectDep } from '@pnpm/pkg-manager.direct-dep-linker' import { readPackageJsonFromDir } from '@pnpm/read-package-json' import { readProjectManifestOnly, safeReadProjectManifestOnly } from '@pnpm/read-project-manifest' +import type { HoistingLimits } from '@pnpm/real-hoist' import type { PackageFilesResponse, StoreController, @@ -59,33 +68,26 @@ import type { import { symlinkDependency } from '@pnpm/symlink-dependency' import { type AllowBuild, - type DepPath, + DEPENDENCIES_FIELDS, type DependencyManifest, + type DepPath, type HoistedDependencies, type IgnoredBuilds, type ProjectId, type ProjectManifest, - type Registries, - DEPENDENCIES_FIELDS, - type SupportedArchitectures, type ProjectRootDir, + type Registries, + type SupportedArchitectures, } from '@pnpm/types' -import * as dp from '@pnpm/dependency-path' import { symlinkAllModules } from '@pnpm/worker' import pLimit from 'p-limit' import { pathAbsolute } from 'path-absolute' import { equals, isEmpty, omit, pick, pickBy, props, union } from 'ramda' import { realpathMissing } from 'realpath-missing' + +import { extendProjectsWithTargetDirs } from './extendProjectsWithTargetDirs.js' import { linkHoistedModules } from './linkHoistedModules.js' -import { - type DirectDependenciesByImporterId, - type DependenciesGraph, - type DependenciesGraphNode, - type LockfileToDepGraphOptions, - lockfileToDepGraph, -} from '@pnpm/deps.graph-builder' import { lockfileToHoistedDepGraph } from './lockfileToHoistedDepGraph.js' -import { linkDirectDeps, type LinkedDirectDep } from '@pnpm/pkg-manager.direct-dep-linker' export { extendProjectsWithTargetDirs } from './extendProjectsWithTargetDirs.js' export type { HoistingLimits } diff --git a/pkg-manager/headless/src/linkHoistedModules.ts b/pkg-manager/headless/src/linkHoistedModules.ts index a0d4760e8c..40e7789d1a 100644 --- a/pkg-manager/headless/src/linkHoistedModules.ts +++ b/pkg-manager/headless/src/linkHoistedModules.ts @@ -1,4 +1,5 @@ import path from 'path' + import { calcDepState, type DepsStateCache } from '@pnpm/calc-dep-state' import { progressLogger, @@ -6,8 +7,8 @@ import { statsLogger, } from '@pnpm/core-loggers' import type { - DepHierarchy, DependenciesGraph, + DepHierarchy, } from '@pnpm/deps.graph-builder' import { linkBins } from '@pnpm/link-bins' import { logger } from '@pnpm/logger' @@ -15,10 +16,10 @@ import type { PackageFilesResponse, StoreController, } from '@pnpm/store-controller-types' +import type { AllowBuild } from '@pnpm/types' +import { rimraf } from '@zkochan/rimraf' import pLimit from 'p-limit' import { difference, isEmpty } from 'ramda' -import { rimraf } from '@zkochan/rimraf' -import type { AllowBuild } from '@pnpm/types' const limitLinking = pLimit(16) diff --git a/pkg-manager/headless/src/lockfileToHoistedDepGraph.ts b/pkg-manager/headless/src/lockfileToHoistedDepGraph.ts index 2c926b5c85..3caf04b7b6 100644 --- a/pkg-manager/headless/src/lockfileToHoistedDepGraph.ts +++ b/pkg-manager/headless/src/lockfileToHoistedDepGraph.ts @@ -1,5 +1,12 @@ -import { pathExists } from 'path-exists' import path from 'path' + +import * as dp from '@pnpm/dependency-path' +import type { + DependenciesGraph, + DepHierarchy, + DirectDependenciesByImporterId, + LockfileToDepGraphResult, +} from '@pnpm/deps.graph-builder' import type { LockfileObject, PackageSnapshot, @@ -13,21 +20,15 @@ import { import { logger } from '@pnpm/logger' import type { IncludedDependencies } from '@pnpm/modules-yaml' import { packageIsInstallable } from '@pnpm/package-is-installable' -import { type PatchGroupRecord, getPatchInfo } from '@pnpm/patching.config' +import { getPatchInfo, type PatchGroupRecord } from '@pnpm/patching.config' import { safeReadPackageJsonFromDir } from '@pnpm/read-package-json' -import type { DepPath, SupportedArchitectures, ProjectId, Registries, AllowBuild } from '@pnpm/types' +import { hoist, type HoisterResult, type HoistingLimits } from '@pnpm/real-hoist' import type { FetchPackageToStoreFunction, StoreController, } from '@pnpm/store-controller-types' -import { hoist, type HoistingLimits, type HoisterResult } from '@pnpm/real-hoist' -import * as dp from '@pnpm/dependency-path' -import type { - DependenciesGraph, - DepHierarchy, - DirectDependenciesByImporterId, - LockfileToDepGraphResult, -} from '@pnpm/deps.graph-builder' +import type { AllowBuild, DepPath, ProjectId, Registries, SupportedArchitectures } from '@pnpm/types' +import { pathExists } from 'path-exists' export interface LockfileToHoistedDepGraphOptions { allowBuild?: AllowBuild diff --git a/pkg-manager/headless/test/index.ts b/pkg-manager/headless/test/index.ts index 66fbe6f138..9064ce52e4 100644 --- a/pkg-manager/headless/test/index.ts +++ b/pkg-manager/headless/test/index.ts @@ -1,9 +1,9 @@ /// import fs from 'fs' import path from 'path' + +import { jest } from '@jest/globals' import { assertProject } from '@pnpm/assert-project' -import { hashObject } from '@pnpm/crypto.object-hasher' -import type { PackageFilesIndex } from '@pnpm/store.cafs' import { ENGINE_NAME, WANTED_LOCKFILE } from '@pnpm/constants' import type { PackageManifestLog, @@ -11,18 +11,20 @@ import type { StageLog, StatsLog, } from '@pnpm/core-loggers' -import { StoreIndex, storeIndexKey } from '@pnpm/store.index' +import { hashObject } from '@pnpm/crypto.object-hasher' import { headlessInstall } from '@pnpm/headless' import { readWantedLockfile } from '@pnpm/lockfile.fs' import { readModulesManifest } from '@pnpm/modules-yaml' import { tempDir } from '@pnpm/prepare' -import type { DepPath } from '@pnpm/types' import { getIntegrity } from '@pnpm/registry-mock' +import type { PackageFilesIndex } from '@pnpm/store.cafs' +import { StoreIndex, storeIndexKey } from '@pnpm/store.index' import { fixtures } from '@pnpm/test-fixtures' import { createTestIpcServer } from '@pnpm/test-ipc-server' -import { jest } from '@jest/globals' +import type { DepPath } from '@pnpm/types' import { rimrafSync } from '@zkochan/rimraf' import { loadJsonFileSync } from 'load-json-file' + import { testDefaults } from './utils/testDefaults.js' const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/headless/test/utils/testDefaults.ts b/pkg-manager/headless/test/utils/testDefaults.ts index 135705ef58..a88124f005 100644 --- a/pkg-manager/headless/test/utils/testDefaults.ts +++ b/pkg-manager/headless/test/utils/testDefaults.ts @@ -1,4 +1,5 @@ import path from 'path' + import type { HeadlessOptions } from '@pnpm/headless' import { safeReadPackageJsonFromDir } from '@pnpm/read-package-json' import { readProjectsContext } from '@pnpm/read-projects-context' diff --git a/pkg-manager/hoist/src/index.ts b/pkg-manager/hoist/src/index.ts index da27870f1e..9d3f2746d9 100644 --- a/pkg-manager/hoist/src/index.ts +++ b/pkg-manager/hoist/src/index.ts @@ -1,11 +1,12 @@ import fs from 'fs' import path from 'path' -import { linkLogger } from '@pnpm/core-loggers' + import { WANTED_LOCKFILE } from '@pnpm/constants' +import { linkLogger } from '@pnpm/core-loggers' import { linkBinsOfPkgsByAliases, type WarnFunction } from '@pnpm/link-bins' import { logger } from '@pnpm/logger' import { createMatcher } from '@pnpm/matcher' -import type { DepPath, HoistedDependencies, ProjectId, DependenciesField } from '@pnpm/types' +import type { DependenciesField, DepPath, HoistedDependencies, ProjectId } from '@pnpm/types' import { lexCompare } from '@pnpm/util.lex-comparator' import { isSubdir } from 'is-subdir' import { resolveLinkTarget } from 'resolve-link-target' diff --git a/pkg-manager/link-bins/src/index.ts b/pkg-manager/link-bins/src/index.ts index 82521b25c5..39efa361f2 100644 --- a/pkg-manager/link-bins/src/index.ts +++ b/pkg-manager/link-bins/src/index.ts @@ -1,24 +1,26 @@ -import { promises as fs, existsSync } from 'fs' +import { existsSync, promises as fs } from 'fs' import { createRequire } from 'module' import path from 'path' -import { getNodeBinLocationForCurrentOS, getDenoBinLocationForCurrentOS, getBunBinLocationForCurrentOS } from '@pnpm/constants' + +import { getBunBinLocationForCurrentOS, getDenoBinLocationForCurrentOS, getNodeBinLocationForCurrentOS } from '@pnpm/constants' import { PnpmError } from '@pnpm/error' -import { logger, globalWarn } from '@pnpm/logger' +import { globalWarn, logger } from '@pnpm/logger' import { getAllDependenciesFromManifest } from '@pnpm/manifest-utils' import { type 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 type { EngineDependency, DependencyManifest, ProjectManifest } from '@pnpm/types' +import type { DependencyManifest, EngineDependency, ProjectManifest } from '@pnpm/types' import cmdShim from '@zkochan/cmd-shim' import { rimraf } from '@zkochan/rimraf' +import fixBin from 'bin-links/lib/fix-bin.js' import { isSubdir } from 'is-subdir' import isWindows from 'is-windows' import normalizePath from 'normalize-path' -import { isEmpty, unnest, groupBy, partition } from 'ramda' +import { groupBy, isEmpty, partition, unnest } from 'ramda' import semver from 'semver' import symlinkDir from 'symlink-dir' -import fixBin from 'bin-links/lib/fix-bin.js' + import { getBinNodePaths } from './getBinNodePaths.js' const binsConflictLogger = logger('bins-conflict') diff --git a/pkg-manager/link-bins/test/getBinNodePaths.ts b/pkg-manager/link-bins/test/getBinNodePaths.ts index 787b98023d..291633f5a1 100644 --- a/pkg-manager/link-bins/test/getBinNodePaths.ts +++ b/pkg-manager/link-bins/test/getBinNodePaths.ts @@ -1,8 +1,10 @@ import fs, { promises as fsPromises } from 'fs' import path from 'path' -import { getBinNodePaths } from '../src/getBinNodePaths.js' + import { temporaryDirectory } from 'tempy' +import { getBinNodePaths } from '../src/getBinNodePaths.js' + // On Windows, temporaryDirectory() may return 8.3 short paths (e.g., RUNNER~1) // but getBinNodePaths resolves these via fs.promises.realpath (the native // implementation that uses GetFinalPathNameByHandleW), returning long paths. diff --git a/pkg-manager/link-bins/test/index.ts b/pkg-manager/link-bins/test/index.ts index 70d70ba331..805e8b8da1 100644 --- a/pkg-manager/link-bins/test/index.ts +++ b/pkg-manager/link-bins/test/index.ts @@ -1,13 +1,14 @@ /// +import { spawnSync } from 'child_process' import fs from 'fs' import path from 'path' -import { fixtures } from '@pnpm/test-fixtures' + import { jest } from '@jest/globals' +import { fixtures } from '@pnpm/test-fixtures' import { cmdExtension as CMD_EXTENSION } from 'cmd-extension' import isWindows from 'is-windows' import normalizePath from 'normalize-path' import { temporaryDirectory } from 'tempy' -import { spawnSync } from 'child_process' jest.unstable_mockModule('@pnpm/logger', () => { const debug = jest.fn() diff --git a/pkg-manager/modules-cleaner/src/prune.ts b/pkg-manager/modules-cleaner/src/prune.ts index 9de2cc5f46..345b4ceb40 100644 --- a/pkg-manager/modules-cleaner/src/prune.ts +++ b/pkg-manager/modules-cleaner/src/prune.ts @@ -1,9 +1,11 @@ import { promises as fs } from 'fs' import path from 'path' + import { removalLogger, statsLogger, } from '@pnpm/core-loggers' +import { depPathToFilename } from '@pnpm/dependency-path' import { filterLockfile, filterLockfileByImporters } from '@pnpm/lockfile.filtering' import type { LockfileObject, @@ -15,16 +17,16 @@ import { logger } from '@pnpm/logger' import { readModulesDir } from '@pnpm/read-modules-dir' import type { StoreController } from '@pnpm/store-controller-types' import { - type DepPath, - type DependenciesField, DEPENDENCIES_FIELDS, + type DependenciesField, + type DepPath, type HoistedDependencies, type ProjectId, type ProjectRootDir, } from '@pnpm/types' -import { depPathToFilename } from '@pnpm/dependency-path' import { rimraf } from '@zkochan/rimraf' import { difference, equals, mergeAll, pickAll } from 'ramda' + import { removeDirectDependency, removeIfEmpty } from './removeDirectDependency.js' export async function prune ( diff --git a/pkg-manager/modules-cleaner/src/removeDirectDependency.ts b/pkg-manager/modules-cleaner/src/removeDirectDependency.ts index 932593bb38..005563b974 100644 --- a/pkg-manager/modules-cleaner/src/removeDirectDependency.ts +++ b/pkg-manager/modules-cleaner/src/removeDirectDependency.ts @@ -1,5 +1,6 @@ -import path from 'path' import { promises as fs } from 'fs' +import path from 'path' + import { rootLogger } from '@pnpm/core-loggers' import { removeBin, removeBinsOfDependency } from '@pnpm/remove-bins' import type { DependenciesField, ProjectRootDir } from '@pnpm/types' diff --git a/pkg-manager/modules-yaml/src/index.ts b/pkg-manager/modules-yaml/src/index.ts index 1ac7c4a8a4..1fc6a2cfeb 100644 --- a/pkg-manager/modules-yaml/src/index.ts +++ b/pkg-manager/modules-yaml/src/index.ts @@ -1,15 +1,16 @@ import path from 'path' + import fs from '@pnpm/graceful-fs' import type { - DepPath, DependenciesField, + DepPath, HoistedDependencies, IgnoredBuilds, Registries, } from '@pnpm/types' -import { readYamlFile } from 'read-yaml-file' -import { map as mapValues } from 'ramda' import isWindows from 'is-windows' +import { map as mapValues } from 'ramda' +import { readYamlFile } from 'read-yaml-file' // The dot prefix is needed because otherwise `npm shrinkwrap` // thinks that it is an extraneous package. diff --git a/pkg-manager/modules-yaml/test/index.ts b/pkg-manager/modules-yaml/test/index.ts index 4c02375310..aeecb4ea65 100644 --- a/pkg-manager/modules-yaml/test/index.ts +++ b/pkg-manager/modules-yaml/test/index.ts @@ -1,8 +1,9 @@ /// import path from 'path' -import { readModulesManifest, writeModulesManifest, type StrictModules } from '@pnpm/modules-yaml' -import { readYamlFileSync } from 'read-yaml-file' + +import { readModulesManifest, type StrictModules, writeModulesManifest } from '@pnpm/modules-yaml' import isWindows from 'is-windows' +import { readYamlFileSync } from 'read-yaml-file' import { temporaryDirectory } from 'tempy' test('writeModulesManifest() and readModulesManifest()', async () => { diff --git a/pkg-manager/package-bins/src/index.ts b/pkg-manager/package-bins/src/index.ts index 3a922d4a05..ed95cd8beb 100644 --- a/pkg-manager/package-bins/src/index.ts +++ b/pkg-manager/package-bins/src/index.ts @@ -1,7 +1,8 @@ import path from 'path' + import type { DependencyManifest, PackageBin } from '@pnpm/types' -import { glob } from 'tinyglobby' import { isSubdir } from 'is-subdir' +import { glob } from 'tinyglobby' export interface Command { name: string diff --git a/pkg-manager/package-bins/test/index.ts b/pkg-manager/package-bins/test/index.ts index 7ce1a19566..b2bfb2f056 100644 --- a/pkg-manager/package-bins/test/index.ts +++ b/pkg-manager/package-bins/test/index.ts @@ -1,4 +1,5 @@ import path from 'path' + import { getBinsFromPackageManifest } from '@pnpm/package-bins' test('getBinsFromPackageManifest()', async () => { diff --git a/pkg-manager/package-bins/test/path-traversal.test.ts b/pkg-manager/package-bins/test/path-traversal.test.ts index fbd5ad3116..7168442ba1 100644 --- a/pkg-manager/package-bins/test/path-traversal.test.ts +++ b/pkg-manager/package-bins/test/path-traversal.test.ts @@ -1,6 +1,7 @@ import fs from 'fs' import path from 'path' + import { getBinsFromPackageManifest } from '@pnpm/package-bins' import { temporaryDirectory } from 'tempy' diff --git a/pkg-manager/package-requester/src/index.ts b/pkg-manager/package-requester/src/index.ts index 05f0dbd12d..a30e307a61 100644 --- a/pkg-manager/package-requester/src/index.ts +++ b/pkg-manager/package-requester/src/index.ts @@ -1,3 +1,2 @@ export { createPackageRequester } from './packageRequester.js' - export type { PackageResponse } from '@pnpm/store-controller-types' diff --git a/pkg-manager/package-requester/src/packageRequester.ts b/pkg-manager/package-requester/src/packageRequester.ts index 51649de0a9..45ff91f43f 100644 --- a/pkg-manager/package-requester/src/packageRequester.ts +++ b/pkg-manager/package-requester/src/packageRequester.ts @@ -1,11 +1,9 @@ import { createReadStream, promises as fs } from 'fs' import path from 'path' -import { - normalizeBundledManifest, -} from '@pnpm/store.cafs' -import { gitHostedStoreIndexKey, storeIndexKey } from '@pnpm/store.index' + +import type { Cafs } from '@pnpm/cafs-types' import { fetchingProgressLogger, progressLogger } from '@pnpm/core-loggers' -import { pickFetcher } from '@pnpm/pick-fetcher' +import { depPathToFilename } from '@pnpm/dependency-path' import { PnpmError } from '@pnpm/error' import type { DirectoryFetcherResult, @@ -13,36 +11,38 @@ import type { FetchOptions, FetchResult, } from '@pnpm/fetcher-base' -import type { Cafs } from '@pnpm/cafs-types' import gfs from '@pnpm/graceful-fs' +import type { CustomFetcher } from '@pnpm/hooks.types' import { logger } from '@pnpm/logger' import { packageIsInstallable } from '@pnpm/package-is-installable' -import { loadJsonFile } from 'load-json-file' +import { pickFetcher } from '@pnpm/pick-fetcher' import type { - PlatformAssetResolution, + AtomicResolution, DirectoryResolution, + PlatformAssetResolution, PreferredVersions, Resolution, ResolveFunction, ResolveResult, TarballResolution, - AtomicResolution, } from '@pnpm/resolver-base' +import { + normalizeBundledManifest, +} from '@pnpm/store.cafs' +import { gitHostedStoreIndexKey, storeIndexKey } from '@pnpm/store.index' import type { BundledManifest, - PkgRequestFetchResult, FetchPackageToStoreFunction, FetchPackageToStoreOptions, GetFilesIndexFilePath, PackageResponse, PkgNameVersion, + PkgRequestFetchResult, RequestPackageFunction, RequestPackageOptions, WantedDependency, } from '@pnpm/store-controller-types' import type { DependencyManifest, SupportedArchitectures } from '@pnpm/types' -import type { CustomFetcher } from '@pnpm/hooks.types' -import { depPathToFilename } from '@pnpm/dependency-path' import { calcMaxWorkers, readPkgFromCafs as _readPkgFromCafs, @@ -50,8 +50,9 @@ import { type ReadPkgFromCafsResult, } from '@pnpm/worker' import { familySync } from 'detect-libc' -import PQueue from 'p-queue' +import { loadJsonFile } from 'load-json-file' import pDefer, { type DeferredPromise } from 'p-defer' +import PQueue from 'p-queue' import { pShare } from 'promise-share' import { pick } from 'ramda' import ssri from 'ssri' diff --git a/pkg-manager/package-requester/test/index.ts b/pkg-manager/package-requester/test/index.ts index 417088a7ea..ee3ebb70b2 100644 --- a/pkg-manager/package-requester/test/index.ts +++ b/pkg-manager/package-requester/test/index.ts @@ -1,22 +1,23 @@ /// import fs from 'fs' import path from 'path' -import type { PackageFilesIndex } from '@pnpm/store.cafs' + +import { jest } from '@jest/globals' import { createClient } from '@pnpm/client' -import { StoreIndex } from '@pnpm/store.index' +import { createCafsStore } from '@pnpm/create-cafs-store' +import { depPathToFilename } from '@pnpm/dependency-path' import { streamParser } from '@pnpm/logger' import { createPackageRequester, type PackageResponse } from '@pnpm/package-requester' -import { createCafsStore } from '@pnpm/create-cafs-store' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' +import type { PackageFilesIndex } from '@pnpm/store.cafs' +import { StoreIndex } from '@pnpm/store.index' +import type { PkgRequestFetchResult, PkgResolutionId, RequestPackageOptions } from '@pnpm/store-controller-types' import { fixtures } from '@pnpm/test-fixtures' -import delay from 'delay' -import { depPathToFilename } from '@pnpm/dependency-path' import { restartWorkerPool } from '@pnpm/worker' -import { jest } from '@jest/globals' +import delay from 'delay' import nock from 'nock' import normalize from 'normalize-path' import { temporaryDirectory } from 'tempy' -import type { PkgResolutionId, PkgRequestFetchResult, RequestPackageOptions } from '@pnpm/store-controller-types' const registry = `http://localhost:${REGISTRY_MOCK_PORT}` const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/plugin-commands-installation/src/add.ts b/pkg-manager/plugin-commands-installation/src/add.ts index 5c6c6da068..c3f81b0ec3 100644 --- a/pkg-manager/plugin-commands-installation/src/add.ts +++ b/pkg-manager/plugin-commands-installation/src/add.ts @@ -1,16 +1,17 @@ import { docsUrl } from '@pnpm/cli-utils' import { FILTERING, OPTIONS, UNIVERSAL_OPTIONS } from '@pnpm/common-cli-options-help' import { types as allTypes } from '@pnpm/config' +import { writeSettings } from '@pnpm/config.config-writer' import { resolveConfigDeps } from '@pnpm/config.deps-installer' import { PnpmError } from '@pnpm/error' import { handleGlobalAdd } from '@pnpm/global.commands' import { createStoreController } from '@pnpm/store-connection-manager' import { pick } from 'ramda' import { renderHelp } from 'render-help' + import { getFetchFullMetadata } from './getFetchFullMetadata.js' import type { InstallCommandOptions } from './install.js' import { installDeps } from './installDeps.js' -import { writeSettings } from '@pnpm/config.config-writer' export const shorthands: Record = { 'save-catalog': '--save-catalog-name=default', diff --git a/pkg-manager/plugin-commands-installation/src/createProjectManifestWriter.ts b/pkg-manager/plugin-commands-installation/src/createProjectManifestWriter.ts index 1b351c7171..c2b454ac3f 100644 --- a/pkg-manager/plugin-commands-installation/src/createProjectManifestWriter.ts +++ b/pkg-manager/plugin-commands-installation/src/createProjectManifestWriter.ts @@ -1,5 +1,6 @@ import path from 'path' import util from 'util' + import { readProjectManifest, type WriteProjectManifest } from '@pnpm/read-project-manifest' import { writeProjectManifest } from '@pnpm/write-project-manifest' diff --git a/pkg-manager/plugin-commands-installation/src/dedupe.ts b/pkg-manager/plugin-commands-installation/src/dedupe.ts index f03195f7f3..329672671f 100644 --- a/pkg-manager/plugin-commands-installation/src/dedupe.ts +++ b/pkg-manager/plugin-commands-installation/src/dedupe.ts @@ -1,10 +1,11 @@ import { docsUrl } from '@pnpm/cli-utils' import { OPTIONS, UNIVERSAL_OPTIONS } from '@pnpm/common-cli-options-help' import { dedupeDiffCheck } from '@pnpm/dedupe.check' +import { omit } from 'ramda' import { renderHelp } from 'render-help' + import { type InstallCommandOptions, rcOptionsTypes as installCommandRcOptionsTypes } from './install.js' import { installDeps } from './installDeps.js' -import { omit } from 'ramda' // In general, the "pnpm dedupe" command should use .npmrc options that "pnpm install" would also accept. export function rcOptionsTypes (): Record { diff --git a/pkg-manager/plugin-commands-installation/src/fetch.ts b/pkg-manager/plugin-commands-installation/src/fetch.ts index 2c66c69f76..a367ebcff3 100644 --- a/pkg-manager/plugin-commands-installation/src/fetch.ts +++ b/pkg-manager/plugin-commands-installation/src/fetch.ts @@ -1,10 +1,11 @@ import { docsUrl } from '@pnpm/cli-utils' import { UNIVERSAL_OPTIONS } from '@pnpm/common-cli-options-help' import { type Config, getOptionsFromRootManifest } from '@pnpm/config' -import { createStoreController, type CreateStoreControllerOptions } from '@pnpm/store-connection-manager' import { type InstallOptions, mutateModulesInSingleProject } from '@pnpm/core' +import { createStoreController, type CreateStoreControllerOptions } from '@pnpm/store-connection-manager' import type { ProjectRootDir } from '@pnpm/types' import { renderHelp } from 'render-help' + import { cliOptionsTypes } from './install.js' export const rcOptionsTypes = cliOptionsTypes diff --git a/pkg-manager/plugin-commands-installation/src/import/index.ts b/pkg-manager/plugin-commands-installation/src/import/index.ts index f6749f16bd..f64c1e6a67 100644 --- a/pkg-manager/plugin-commands-installation/src/import/index.ts +++ b/pkg-manager/plugin-commands-installation/src/import/index.ts @@ -1,28 +1,30 @@ import fs from 'fs' import path from 'path' + import { docsUrl } from '@pnpm/cli-utils' +import { type Config, getOptionsFromRootManifest } from '@pnpm/config' import { WANTED_LOCKFILE } from '@pnpm/constants' +import { install, type InstallOptions } from '@pnpm/core' import { PnpmError } from '@pnpm/error' +import gfs from '@pnpm/graceful-fs' +import { logger } from '@pnpm/logger' import { readProjectManifestOnly } from '@pnpm/read-project-manifest' +import { sequenceGraph } from '@pnpm/sort-packages' import { createStoreController, type CreateStoreControllerOptions, } from '@pnpm/store-connection-manager' -import gfs from '@pnpm/graceful-fs' -import { install, type InstallOptions } from '@pnpm/core' -import { type Config, getOptionsFromRootManifest } from '@pnpm/config' +import type { Project, ProjectsGraph } from '@pnpm/types' import { findWorkspacePackages } from '@pnpm/workspace.find-packages' -import type { ProjectsGraph, Project } from '@pnpm/types' -import { logger } from '@pnpm/logger' -import { sequenceGraph } from '@pnpm/sort-packages' +import * as structUtils from '@yarnpkg/core/structUtils' +import type { LockFileObject } from '@yarnpkg/lockfile' +import yarnLockfileLib from '@yarnpkg/lockfile' +import { parseSyml } from '@yarnpkg/parsers' import { rimraf } from '@zkochan/rimraf' import { loadJsonFile } from 'load-json-file' import { map as mapValues } from 'ramda' import { renderHelp } from 'render-help' -import yarnLockfileLib from '@yarnpkg/lockfile' -import type { LockFileObject } from '@yarnpkg/lockfile' -import * as structUtils from '@yarnpkg/core/structUtils' -import { parseSyml } from '@yarnpkg/parsers' + import { recursive } from '../recursive.js' import { yarnLockFileKeyNormalizer } from './yarnUtil.js' diff --git a/pkg-manager/plugin-commands-installation/src/index.ts b/pkg-manager/plugin-commands-installation/src/index.ts index 33b5d9ef82..fd2ccb3d7f 100644 --- a/pkg-manager/plugin-commands-installation/src/index.ts +++ b/pkg-manager/plugin-commands-installation/src/index.ts @@ -1,14 +1,14 @@ import * as add from './add.js' import * as ci from './ci.js' import * as dedupe from './dedupe.js' -import * as install from './install.js' import * as fetch from './fetch.js' +import * as importCommand from './import/index.js' +import type { InstallCommandOptions } from './install.js' +import * as install from './install.js' import * as link from './link.js' import * as prune from './prune.js' import * as remove from './remove.js' import * as unlink from './unlink.js' import * as update from './update/index.js' -import * as importCommand from './import/index.js' -import type { InstallCommandOptions } from './install.js' -export { add, ci, dedupe, fetch, install, link, prune, remove, unlink, update, importCommand, type InstallCommandOptions } +export { add, ci, dedupe, fetch, importCommand, install, type InstallCommandOptions, link, prune, remove, unlink, update } diff --git a/pkg-manager/plugin-commands-installation/src/install.ts b/pkg-manager/plugin-commands-installation/src/install.ts index a40258a3c1..86be60251c 100644 --- a/pkg-manager/plugin-commands-installation/src/install.ts +++ b/pkg-manager/plugin-commands-installation/src/install.ts @@ -6,6 +6,7 @@ import { PnpmError } from '@pnpm/error' import type { CreateStoreControllerOptions } from '@pnpm/store-connection-manager' import { pick } from 'ramda' import { renderHelp } from 'render-help' + import { getFetchFullMetadata } from './getFetchFullMetadata.js' import { installDeps, type InstallDepsOptions } from './installDeps.js' diff --git a/pkg-manager/plugin-commands-installation/src/installDeps.ts b/pkg-manager/plugin-commands-installation/src/installDeps.ts index b12ea94783..66eadb0e03 100644 --- a/pkg-manager/plugin-commands-installation/src/installDeps.ts +++ b/pkg-manager/plugin-commands-installation/src/installDeps.ts @@ -1,26 +1,11 @@ import path from 'path' + import { buildProjects } from '@pnpm/building.after-install' import { readProjectManifestOnly, tryReadProjectManifest, } from '@pnpm/cli-utils' import { type Config, getOptionsFromRootManifest } from '@pnpm/config' -import { checkDepsStatus } from '@pnpm/deps.status' -import { PnpmError } from '@pnpm/error' -import { arrayOfWorkspacePackagesToMap } from '@pnpm/get-context' -import { filterPkgsBySelectorObjects } from '@pnpm/filter-workspace-packages' -import { filterDependenciesByType } from '@pnpm/manifest-utils' -import { findWorkspacePackages } from '@pnpm/workspace.find-packages' -import type { LockfileObject } from '@pnpm/lockfile.types' -import { createStoreController, type CreateStoreControllerOptions } from '@pnpm/store-connection-manager' -import type { - IncludedDependencies, - Project, - ProjectsGraph, - ProjectRootDir, - PackageVulnerabilityAudit, - VulnerabilitySeverity, -} from '@pnpm/types' import { IgnoredBuildsError, install, @@ -29,22 +14,39 @@ import { type UpdateMatchingFunction, type WorkspacePackages, } from '@pnpm/core' +import { checkDepsStatus } from '@pnpm/deps.status' +import { PnpmError } from '@pnpm/error' +import { filterPkgsBySelectorObjects } from '@pnpm/filter-workspace-packages' +import { arrayOfWorkspacePackagesToMap } from '@pnpm/get-context' +import type { LockfileObject } from '@pnpm/lockfile.types' import { globalInfo, logger } from '@pnpm/logger' +import { filterDependenciesByType } from '@pnpm/manifest-utils' +import type { PreferredVersions, VersionSelectors } from '@pnpm/resolver-base' import { sequenceGraph } from '@pnpm/sort-packages' +import { createStoreController, type CreateStoreControllerOptions } from '@pnpm/store-connection-manager' +import type { + IncludedDependencies, + PackageVulnerabilityAudit, + Project, + ProjectRootDir, + ProjectsGraph, + VulnerabilitySeverity, +} from '@pnpm/types' +import { findWorkspacePackages } from '@pnpm/workspace.find-packages' import { updateWorkspaceManifest } from '@pnpm/workspace.manifest-writer' import { createPkgGraph } from '@pnpm/workspace.pkgs-graph' import { updateWorkspaceState, type WorkspaceStateSettings } from '@pnpm/workspace.state' -import type { PreferredVersions, VersionSelectors } from '@pnpm/resolver-base' + import { getPinnedVersion } from './getPinnedVersion.js' import { getSaveType } from './getSaveType.js' import { type CommandFullName, + createMatcher, + makeIgnorePatterns, + matchDependencies, + recursive, type RecursiveOptions, type UpdateDepsMatcher, - createMatcher, - matchDependencies, - makeIgnorePatterns, - recursive, } from './recursive.js' import { createWorkspaceSpecs, updateToWorkspacePackagesFromManifest } from './updateWorkspaceDependencies.js' diff --git a/pkg-manager/plugin-commands-installation/src/link.ts b/pkg-manager/plugin-commands-installation/src/link.ts index 7df35fe157..a521ed4c3a 100644 --- a/pkg-manager/plugin-commands-installation/src/link.ts +++ b/pkg-manager/plugin-commands-installation/src/link.ts @@ -1,25 +1,27 @@ import path from 'path' + import { docsUrl, tryReadProjectManifest, } from '@pnpm/cli-utils' import { UNIVERSAL_OPTIONS } from '@pnpm/common-cli-options-help' -import { writeSettings } from '@pnpm/config.config-writer' import { type Config, types as allTypes } from '@pnpm/config' -import { DEPENDENCIES_FIELDS, type ProjectManifest, type Project } from '@pnpm/types' -import { PnpmError } from '@pnpm/error' -import { arrayOfWorkspacePackagesToMap } from '@pnpm/get-context' -import { findWorkspacePackages } from '@pnpm/workspace.find-packages' +import { writeSettings } from '@pnpm/config.config-writer' import type { WorkspacePackages, } from '@pnpm/core' +import { PnpmError } from '@pnpm/error' +import { arrayOfWorkspacePackagesToMap } from '@pnpm/get-context' import { logger } from '@pnpm/logger' -import { pick, partition } from 'ramda' +import { DEPENDENCIES_FIELDS, type Project, type ProjectManifest } from '@pnpm/types' +import { findWorkspacePackages } from '@pnpm/workspace.find-packages' +import normalize from 'normalize-path' +import { partition, pick } from 'ramda' import { renderHelp } from 'render-help' + import { createProjectManifestWriter } from './createProjectManifestWriter.js' import { getSaveType } from './getSaveType.js' import * as install from './install.js' -import normalize from 'normalize-path' // @ts-expect-error const isWindows = process.platform === 'win32' || global['FAKE_WINDOWS'] diff --git a/pkg-manager/plugin-commands-installation/src/nodeExecPath.ts b/pkg-manager/plugin-commands-installation/src/nodeExecPath.ts index f344aa0b89..900636f878 100644 --- a/pkg-manager/plugin-commands-installation/src/nodeExecPath.ts +++ b/pkg-manager/plugin-commands-installation/src/nodeExecPath.ts @@ -1,4 +1,5 @@ import { promises as fs } from 'fs' + import which from 'which' export async function getNodeExecPath (): Promise { diff --git a/pkg-manager/plugin-commands-installation/src/prune.ts b/pkg-manager/plugin-commands-installation/src/prune.ts index 7136dffbf1..43ea29dea4 100644 --- a/pkg-manager/plugin-commands-installation/src/prune.ts +++ b/pkg-manager/plugin-commands-installation/src/prune.ts @@ -1,8 +1,9 @@ import { docsUrl } from '@pnpm/cli-utils' -import { UNIVERSAL_OPTIONS, OPTIONS } from '@pnpm/common-cli-options-help' +import { OPTIONS, UNIVERSAL_OPTIONS } from '@pnpm/common-cli-options-help' import { types as allTypes } from '@pnpm/config' import { pick } from 'ramda' import { renderHelp } from 'render-help' + import * as install from './install.js' export const rcOptionsTypes = cliOptionsTypes diff --git a/pkg-manager/plugin-commands-installation/src/recursive.ts b/pkg-manager/plugin-commands-installation/src/recursive.ts index 7d20537d7e..567b66e58d 100755 --- a/pkg-manager/plugin-commands-installation/src/recursive.ts +++ b/pkg-manager/plugin-commands-installation/src/recursive.ts @@ -1,5 +1,6 @@ import { promises as fs } from 'fs' import path from 'path' + import { rebuild } from '@pnpm/building.build-commands' import type { Catalogs } from '@pnpm/catalogs.types' import { @@ -8,32 +9,12 @@ import { } from '@pnpm/cli-utils' import { type Config, - type OptionsFromRootManifest, - type ProjectConfig, createProjectConfigRecord, getOptionsFromRootManifest, getWorkspaceConcurrency, + type OptionsFromRootManifest, + type ProjectConfig, } from '@pnpm/config' -import { PnpmError } from '@pnpm/error' -import { arrayOfWorkspacePackagesToMap } from '@pnpm/get-context' -import { logger } from '@pnpm/logger' -import { filterDependenciesByType } from '@pnpm/manifest-utils' -import { createMatcherWithIndex } from '@pnpm/matcher' -import type { StoreController } from '@pnpm/package-store' -import { requireHooks } from '@pnpm/pnpmfile' -import { sortPackages } from '@pnpm/sort-packages' -import { createStoreController, type CreateStoreControllerOptions } from '@pnpm/store-connection-manager' -import type { - IgnoredBuilds, - IncludedDependencies, - PackageManifest, - Project, - ProjectManifest, - ProjectsGraph, - ProjectRootDir, - ProjectRootDirRealPath, -} from '@pnpm/types' -import { updateWorkspaceManifest } from '@pnpm/workspace.manifest-writer' import { addDependenciesToPackage, IgnoredBuildsError, @@ -45,13 +26,34 @@ import { type UpdateMatchingFunction, type WorkspacePackages, } from '@pnpm/core' +import { PnpmError } from '@pnpm/error' +import { arrayOfWorkspacePackagesToMap } from '@pnpm/get-context' +import { logger } from '@pnpm/logger' +import { filterDependenciesByType } from '@pnpm/manifest-utils' +import { createMatcherWithIndex } from '@pnpm/matcher' +import type { StoreController } from '@pnpm/package-store' +import { requireHooks } from '@pnpm/pnpmfile' +import type { PreferredVersions } from '@pnpm/resolver-base' +import { sortPackages } from '@pnpm/sort-packages' +import { createStoreController, type CreateStoreControllerOptions } from '@pnpm/store-connection-manager' +import type { + IgnoredBuilds, + IncludedDependencies, + PackageManifest, + Project, + ProjectManifest, + ProjectRootDir, + ProjectRootDirRealPath, + ProjectsGraph, +} from '@pnpm/types' +import { updateWorkspaceManifest } from '@pnpm/workspace.manifest-writer' import { isSubdir } from 'is-subdir' import pFilter from 'p-filter' import pLimit from 'p-limit' -import { createWorkspaceSpecs, updateToWorkspacePackagesFromManifest } from './updateWorkspaceDependencies.js' -import { getSaveType } from './getSaveType.js' + import { getPinnedVersion } from './getPinnedVersion.js' -import type { PreferredVersions } from '@pnpm/resolver-base' +import { getSaveType } from './getSaveType.js' +import { createWorkspaceSpecs, updateToWorkspacePackagesFromManifest } from './updateWorkspaceDependencies.js' export type RecursiveOptions = CreateStoreControllerOptions & Pick { return pick([ 'cache-dir', diff --git a/pkg-manager/plugin-commands-installation/test/add.ts b/pkg-manager/plugin-commands-installation/test/add.ts index 661dc64d09..d3e392f1dd 100644 --- a/pkg-manager/plugin-commands-installation/test/add.ts +++ b/pkg-manager/plugin-commands-installation/test/add.ts @@ -1,5 +1,6 @@ import fs from 'fs' import path from 'path' + import type { PnpmError } from '@pnpm/error' import { add, remove } from '@pnpm/plugin-commands-installation' import { prepare, prepareEmpty, preparePackages } from '@pnpm/prepare' diff --git a/pkg-manager/plugin-commands-installation/test/addJsr.ts b/pkg-manager/plugin-commands-installation/test/addJsr.ts index 7687c0bb76..d0675b6e7e 100644 --- a/pkg-manager/plugin-commands-installation/test/addJsr.ts +++ b/pkg-manager/plugin-commands-installation/test/addJsr.ts @@ -1,9 +1,11 @@ import path from 'path' + import type { LockfileFile } from '@pnpm/lockfile.types' import { add } from '@pnpm/plugin-commands-installation' import { prepare } from '@pnpm/prepare' import type { ProjectManifest } from '@pnpm/types' import { loadJsonFileSync } from 'load-json-file' + import { DEFAULT_OPTS } from './utils/index.js' // This must be a function because some of its values depend on CWD diff --git a/pkg-manager/plugin-commands-installation/test/addRecursive.ts b/pkg-manager/plugin-commands-installation/test/addRecursive.ts index d554810860..a611621838 100644 --- a/pkg-manager/plugin-commands-installation/test/addRecursive.ts +++ b/pkg-manager/plugin-commands-installation/test/addRecursive.ts @@ -1,10 +1,12 @@ import path from 'path' -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' + import type { LockfileObject } from '@pnpm/lockfile.types' import { add } from '@pnpm/plugin-commands-installation' import { preparePackages } from '@pnpm/prepare' import type { ProjectId } from '@pnpm/types' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { readYamlFileSync } from 'read-yaml-file' + import { DEFAULT_OPTS } from './utils/index.js' test('recursive add --save-dev, --save-peer on workspace with multiple lockfiles', async () => { diff --git a/pkg-manager/plugin-commands-installation/test/dedupe.ts b/pkg-manager/plugin-commands-installation/test/dedupe.ts index e40e8950c0..84dc3cf7fc 100644 --- a/pkg-manager/plugin-commands-installation/test/dedupe.ts +++ b/pkg-manager/plugin-commands-installation/test/dedupe.ts @@ -1,14 +1,16 @@ import fs from 'fs' import path from 'path' + import { DedupeCheckIssuesError } from '@pnpm/dedupe.check' -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import type { LockfileObject } from '@pnpm/lockfile.types' import { dedupe, install } from '@pnpm/plugin-commands-installation' import { prepare } from '@pnpm/prepare' import { fixtures } from '@pnpm/test-fixtures' import { createTestIpcServer } from '@pnpm/test-ipc-server' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { diff } from 'jest-diff' import { readYamlFileSync } from 'read-yaml-file' + import { DEFAULT_OPTS } from './utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/plugin-commands-installation/test/disallowWorkspaceCycles.test.ts b/pkg-manager/plugin-commands-installation/test/disallowWorkspaceCycles.test.ts index 5d5a01285b..08323135be 100644 --- a/pkg-manager/plugin-commands-installation/test/disallowWorkspaceCycles.test.ts +++ b/pkg-manager/plugin-commands-installation/test/disallowWorkspaceCycles.test.ts @@ -1,8 +1,9 @@ -import { install } from '@pnpm/plugin-commands-installation' -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' -import { preparePackages } from '@pnpm/prepare' -import { DEFAULT_OPTS } from './utils/index.js' import type { PnpmError } from '@pnpm/error' +import { install } from '@pnpm/plugin-commands-installation' +import { preparePackages } from '@pnpm/prepare' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' + +import { DEFAULT_OPTS } from './utils/index.js' test('should error if disallow-workspace-cycles is set', async () => { preparePackages([ diff --git a/pkg-manager/plugin-commands-installation/test/fetch.ts b/pkg-manager/plugin-commands-installation/test/fetch.ts index 0e68d99a8c..d599ac69ff 100644 --- a/pkg-manager/plugin-commands-installation/test/fetch.ts +++ b/pkg-manager/plugin-commands-installation/test/fetch.ts @@ -1,7 +1,8 @@ import fs from 'fs' import path from 'path' + import { STORE_VERSION } from '@pnpm/constants' -import { install, fetch } from '@pnpm/plugin-commands-installation' +import { fetch, install } from '@pnpm/plugin-commands-installation' import { prepare } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { closeAllStoreIndexes } from '@pnpm/store.index' diff --git a/pkg-manager/plugin-commands-installation/test/import.ts b/pkg-manager/plugin-commands-installation/test/import.ts index 98265177f0..fd1ad0ef52 100644 --- a/pkg-manager/plugin-commands-installation/test/import.ts +++ b/pkg-manager/plugin-commands-installation/test/import.ts @@ -1,11 +1,12 @@ /// import path from 'path' + import { assertProject } from '@pnpm/assert-project' import { PnpmError } from '@pnpm/error' import { importCommand } from '@pnpm/plugin-commands-installation' import { prepare } from '@pnpm/prepare' -import { fixtures } from '@pnpm/test-fixtures' import { addDistTag, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' +import { fixtures } from '@pnpm/test-fixtures' import { temporaryDirectory } from 'tempy' const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/plugin-commands-installation/test/importRecursive.ts b/pkg-manager/plugin-commands-installation/test/importRecursive.ts index 6a59560c2f..c682d50f2d 100644 --- a/pkg-manager/plugin-commands-installation/test/importRecursive.ts +++ b/pkg-manager/plugin-commands-installation/test/importRecursive.ts @@ -1,10 +1,11 @@ /// import path from 'path' + import { assertProject } from '@pnpm/assert-project' import { importCommand } from '@pnpm/plugin-commands-installation' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { fixtures } from '@pnpm/test-fixtures' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { temporaryDirectory } from 'tempy' const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/plugin-commands-installation/test/install.ts b/pkg-manager/plugin-commands-installation/test/install.ts index a69056ab4c..33b48a4530 100644 --- a/pkg-manager/plugin-commands-installation/test/install.ts +++ b/pkg-manager/plugin-commands-installation/test/install.ts @@ -1,11 +1,13 @@ import fs from 'fs' -import delay from 'delay' import path from 'path' + import { STORE_VERSION } from '@pnpm/constants' import { add, install } from '@pnpm/plugin-commands-installation' import { prepare, prepareEmpty } from '@pnpm/prepare' import { rimrafSync } from '@zkochan/rimraf' +import delay from 'delay' import { loadJsonFileSync } from 'load-json-file' + import { DEFAULT_OPTS } from './utils/index.js' const describeOnLinuxOnly = process.platform === 'linux' ? describe : describe.skip diff --git a/pkg-manager/plugin-commands-installation/test/link.ts b/pkg-manager/plugin-commands-installation/test/link.ts index ae04477e68..e13d63d20c 100644 --- a/pkg-manager/plugin-commands-installation/test/link.ts +++ b/pkg-manager/plugin-commands-installation/test/link.ts @@ -1,13 +1,15 @@ import fs from 'fs' import path from 'path' -import { prepare, preparePackages, prepareEmpty } from '@pnpm/prepare' -import { isExecutable, assertProject } from '@pnpm/assert-project' + +import { jest } from '@jest/globals' +import { assertProject, isExecutable } from '@pnpm/assert-project' +import { prepare, prepareEmpty, preparePackages } from '@pnpm/prepare' import { fixtures } from '@pnpm/test-fixtures' import PATH from 'path-name' import { readYamlFileSync } from 'read-yaml-file' import { writePackageSync } from 'write-package' -import { jest } from '@jest/globals' import { writeYamlFileSync } from 'write-yaml-file' + import { DEFAULT_OPTS } from './utils/index.js' const original = await import('@pnpm/logger') diff --git a/pkg-manager/plugin-commands-installation/test/miscRecursive.ts b/pkg-manager/plugin-commands-installation/test/miscRecursive.ts index 71abf30a42..db456d29ee 100644 --- a/pkg-manager/plugin-commands-installation/test/miscRecursive.ts +++ b/pkg-manager/plugin-commands-installation/test/miscRecursive.ts @@ -1,18 +1,20 @@ import fs from 'fs' import path from 'path' + import type { PnpmError } from '@pnpm/error' -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import type { LockfileFile } from '@pnpm/lockfile.types' import { add, install, remove, update } from '@pnpm/plugin-commands-installation' import { preparePackages } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' import type { ProjectManifest } from '@pnpm/types' -import { readYamlFileSync } from 'read-yaml-file' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { loadJsonFile } from 'load-json-file' +import { readYamlFileSync } from 'read-yaml-file' +import symlinkDir from 'symlink-dir' import { writeJsonFileSync } from 'write-json-file' import { writeYamlFileSync } from 'write-yaml-file' + import { DEFAULT_OPTS } from './utils/index.js' -import symlinkDir from 'symlink-dir' test('recursive add/remove', async () => { const projects = preparePackages([ diff --git a/pkg-manager/plugin-commands-installation/test/patchedDependencies.ts b/pkg-manager/plugin-commands-installation/test/patchedDependencies.ts index 21c7fc0505..24b465c664 100644 --- a/pkg-manager/plugin-commands-installation/test/patchedDependencies.ts +++ b/pkg-manager/plugin-commands-installation/test/patchedDependencies.ts @@ -1,9 +1,11 @@ import fs from 'fs' import path from 'path' -import type { ProjectManifest } from '@pnpm/types' + +import { jest } from '@jest/globals' import { prepareEmpty } from '@pnpm/prepare' import { fixtures } from '@pnpm/test-fixtures' -import { jest } from '@jest/globals' +import type { ProjectManifest } from '@pnpm/types' + import { DEFAULT_OPTS } from './utils/index.js' const originalModule = await import('@pnpm/logger') diff --git a/pkg-manager/plugin-commands-installation/test/peerDependencies.ts b/pkg-manager/plugin-commands-installation/test/peerDependencies.ts index 92a08146d3..8b6263e651 100644 --- a/pkg-manager/plugin-commands-installation/test/peerDependencies.ts +++ b/pkg-manager/plugin-commands-installation/test/peerDependencies.ts @@ -1,4 +1,5 @@ import path from 'path' + import { add, install } from '@pnpm/plugin-commands-installation' import { prepare } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' diff --git a/pkg-manager/plugin-commands-installation/test/prune.ts b/pkg-manager/plugin-commands-installation/test/prune.ts index 6394896558..91c1f1af9d 100644 --- a/pkg-manager/plugin-commands-installation/test/prune.ts +++ b/pkg-manager/plugin-commands-installation/test/prune.ts @@ -1,11 +1,12 @@ +import fs from 'fs' import path from 'path' + import { add, install, prune } from '@pnpm/plugin-commands-installation' import { prepare } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { fixtures } from '@pnpm/test-fixtures' import { createTestIpcServer } from '@pnpm/test-ipc-server' import symlinkDir from 'symlink-dir' -import fs from 'fs' const REGISTRY_URL = `http://localhost:${REGISTRY_MOCK_PORT}` const f = fixtures(import.meta.dirname) diff --git a/pkg-manager/plugin-commands-installation/test/remove/remove.ts b/pkg-manager/plugin-commands-installation/test/remove/remove.ts index 232ef572fa..04caca4082 100644 --- a/pkg-manager/plugin-commands-installation/test/remove/remove.ts +++ b/pkg-manager/plugin-commands-installation/test/remove/remove.ts @@ -1,6 +1,7 @@ import type { PnpmError } from '@pnpm/error' import { remove } from '@pnpm/plugin-commands-installation' import { prepare } from '@pnpm/prepare' + import { DEFAULT_OPTS } from '../utils/index.js' test('remove should fail if no dependency is specified for removal', async () => { diff --git a/pkg-manager/plugin-commands-installation/test/remove/workspace.ts b/pkg-manager/plugin-commands-installation/test/remove/workspace.ts index 007b0988af..b9ed08399a 100644 --- a/pkg-manager/plugin-commands-installation/test/remove/workspace.ts +++ b/pkg-manager/plugin-commands-installation/test/remove/workspace.ts @@ -1,9 +1,11 @@ import path from 'path' -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' + import type { LockfileFile } from '@pnpm/lockfile.types' import { install, remove } from '@pnpm/plugin-commands-installation' import { preparePackages } from '@pnpm/prepare' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { readYamlFileSync } from 'read-yaml-file' + import { DEFAULT_OPTS } from '../utils/index.js' test('remove --filter only changes the specified dependency, when run with link-workspace-packages=false', async () => { diff --git a/pkg-manager/plugin-commands-installation/test/saveCatalog.ts b/pkg-manager/plugin-commands-installation/test/saveCatalog.ts index 34de8f0609..ca3534e6c5 100644 --- a/pkg-manager/plugin-commands-installation/test/saveCatalog.ts +++ b/pkg-manager/plugin-commands-installation/test/saveCatalog.ts @@ -1,12 +1,14 @@ import fs from 'fs' import path from 'path' + +import type { LockfileFile } from '@pnpm/lockfile.types' import { add } from '@pnpm/plugin-commands-installation' import { prepare, preparePackages } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' -import type { LockfileFile } from '@pnpm/lockfile.types' import { loadJsonFileSync } from 'load-json-file' -import { readYamlFileSync } from 'read-yaml-file' import nock from 'nock' +import { readYamlFileSync } from 'read-yaml-file' + import { DEFAULT_OPTS } from './utils/index.js' // This must be a function because some of its values depend on CWD diff --git a/pkg-manager/plugin-commands-installation/test/update/getUpdateChoices.test.ts b/pkg-manager/plugin-commands-installation/test/update/getUpdateChoices.test.ts index d2b962ae19..028396ab00 100644 --- a/pkg-manager/plugin-commands-installation/test/update/getUpdateChoices.test.ts +++ b/pkg-manager/plugin-commands-installation/test/update/getUpdateChoices.test.ts @@ -1,5 +1,7 @@ import { stripVTControlCharacters } from 'util' + import chalk from 'chalk' + import { getUpdateChoices } from '../../lib/update/getUpdateChoices.js' test('getUpdateChoices()', () => { diff --git a/pkg-manager/plugin-commands-installation/test/update/interactive.ts b/pkg-manager/plugin-commands-installation/test/update/interactive.ts index 577580062a..19d724a709 100644 --- a/pkg-manager/plugin-commands-installation/test/update/interactive.ts +++ b/pkg-manager/plugin-commands-installation/test/update/interactive.ts @@ -1,11 +1,12 @@ import path from 'path' -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' + +import { jest } from '@jest/globals' import type { LockfileObject } from '@pnpm/lockfile.types' import { prepare, preparePackages } from '@pnpm/prepare' -import { REGISTRY_MOCK_PORT, addDistTag } from '@pnpm/registry-mock' -import { jest } from '@jest/globals' -import { readYamlFileSync } from 'read-yaml-file' +import { addDistTag, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import chalk from 'chalk' +import { readYamlFileSync } from 'read-yaml-file' jest.unstable_mockModule('enquirer', () => ({ default: { prompt: jest.fn() } })) const { default: enquirer } = await import('enquirer') diff --git a/pkg-manager/plugin-commands-installation/test/update/issue-7415.ts b/pkg-manager/plugin-commands-installation/test/update/issue-7415.ts index 344011c697..8a6fcd0468 100644 --- a/pkg-manager/plugin-commands-installation/test/update/issue-7415.ts +++ b/pkg-manager/plugin-commands-installation/test/update/issue-7415.ts @@ -1,8 +1,9 @@ import path from 'path' + +import { jest } from '@jest/globals' import { preparePackages } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' -import { jest } from '@jest/globals' jest.unstable_mockModule('enquirer', () => ({ default: { prompt: jest.fn() } })) diff --git a/pkg-manager/plugin-commands-installation/test/update/jsr.ts b/pkg-manager/plugin-commands-installation/test/update/jsr.ts index 8e28802665..c76e4a1773 100644 --- a/pkg-manager/plugin-commands-installation/test/update/jsr.ts +++ b/pkg-manager/plugin-commands-installation/test/update/jsr.ts @@ -1,10 +1,12 @@ import path from 'path' + import type { LockfileFile } from '@pnpm/lockfile.types' import { install, update } from '@pnpm/plugin-commands-installation' import { prepare } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' import type { ProjectManifest } from '@pnpm/types' import { loadJsonFileSync } from 'load-json-file' + import { DEFAULT_OPTS } from '../utils/index.js' // This must be a function because some of its values depend on CWD diff --git a/pkg-manager/plugin-commands-installation/test/update/recursive.ts b/pkg-manager/plugin-commands-installation/test/update/recursive.ts index 17d28c6056..2397cedf61 100644 --- a/pkg-manager/plugin-commands-installation/test/update/recursive.ts +++ b/pkg-manager/plugin-commands-installation/test/update/recursive.ts @@ -1,12 +1,13 @@ import type { PnpmError } from '@pnpm/error' -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import type { LockfileObject } from '@pnpm/lockfile.types' import { readModulesManifest } from '@pnpm/modules-yaml' import { install, update } from '@pnpm/plugin-commands-installation' import { preparePackages } from '@pnpm/prepare' import { readProjectManifestOnly } from '@pnpm/read-project-manifest' import { addDistTag } from '@pnpm/registry-mock' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { readYamlFileSync } from 'read-yaml-file' + import { DEFAULT_OPTS } from '../utils/index.js' test('recursive update', async () => { diff --git a/pkg-manager/plugin-commands-installation/test/update/update.ts b/pkg-manager/plugin-commands-installation/test/update/update.ts index 240c4b5ec8..62d4ece428 100644 --- a/pkg-manager/plugin-commands-installation/test/update/update.ts +++ b/pkg-manager/plugin-commands-installation/test/update/update.ts @@ -1,10 +1,12 @@ import path from 'path' + import type { PnpmError } from '@pnpm/error' import { install, update } from '@pnpm/plugin-commands-installation' import { prepare, preparePackages } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' import type { ProjectManifest } from '@pnpm/types' import { loadJsonFileSync } from 'load-json-file' + import { DEFAULT_OPTS } from '../utils/index.js' test('update with "*" pattern', async () => { diff --git a/pkg-manager/plugin-commands-installation/test/updateWorkspaceDependencies.test.ts b/pkg-manager/plugin-commands-installation/test/updateWorkspaceDependencies.test.ts index 1175029fb4..2835453da0 100644 --- a/pkg-manager/plugin-commands-installation/test/updateWorkspaceDependencies.test.ts +++ b/pkg-manager/plugin-commands-installation/test/updateWorkspaceDependencies.test.ts @@ -1,5 +1,6 @@ import type { PnpmError } from '@pnpm/error' import type { ProjectRootDir } from '@pnpm/types' + import { createWorkspaceSpecs, updateToWorkspacePackagesFromManifest, diff --git a/pkg-manager/plugin-commands-installation/test/warnCyclicDependencies.ts b/pkg-manager/plugin-commands-installation/test/warnCyclicDependencies.ts index e10b8d605f..a57c1ff8c1 100644 --- a/pkg-manager/plugin-commands-installation/test/warnCyclicDependencies.ts +++ b/pkg-manager/plugin-commands-installation/test/warnCyclicDependencies.ts @@ -1,6 +1,7 @@ -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' -import { preparePackages } from '@pnpm/prepare' import { jest } from '@jest/globals' +import { preparePackages } from '@pnpm/prepare' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' + import { DEFAULT_OPTS } from './utils/index.js' const warn = jest.fn() diff --git a/pkg-manager/read-projects-context/src/index.ts b/pkg-manager/read-projects-context/src/index.ts index 1c2ad5c4ca..20bb122c3b 100644 --- a/pkg-manager/read-projects-context/src/index.ts +++ b/pkg-manager/read-projects-context/src/index.ts @@ -1,17 +1,18 @@ import { promises as fs } from 'fs' -import util from 'util' import path from 'path' +import util from 'util' + import { getLockfileImporterId } from '@pnpm/lockfile.fs' import { type Modules, readModulesManifest } from '@pnpm/modules-yaml' import { normalizeRegistries } from '@pnpm/normalize-registries' import type { - DepPath, DependenciesField, + DepPath, HoistedDependencies, ProjectId, - Registries, ProjectRootDir, ProjectRootDirRealPath, + Registries, } from '@pnpm/types' import { realpathMissing } from 'realpath-missing' diff --git a/pkg-manager/real-hoist/src/index.ts b/pkg-manager/real-hoist/src/index.ts index f761418806..7890f57760 100644 --- a/pkg-manager/real-hoist/src/index.ts +++ b/pkg-manager/real-hoist/src/index.ts @@ -1,11 +1,11 @@ +import * as dp from '@pnpm/dependency-path' import { LockfileMissingDependencyError } from '@pnpm/error' import { type LockfileObject, - type ProjectId, nameVerFromPkgSnapshot, + type ProjectId, } from '@pnpm/lockfile.utils' -import * as dp from '@pnpm/dependency-path' -import { hoist as _hoist, HoisterDependencyKind, type HoisterTree, type HoisterResult } from '@yarnpkg/nm/hoist' +import { hoist as _hoist, HoisterDependencyKind, type HoisterResult, type HoisterTree } from '@yarnpkg/nm/hoist' export type HoistingLimits = Map> diff --git a/pkg-manager/real-hoist/test/index.ts b/pkg-manager/real-hoist/test/index.ts index 7506f5b34a..c6512c6448 100644 --- a/pkg-manager/real-hoist/test/index.ts +++ b/pkg-manager/real-hoist/test/index.ts @@ -1,5 +1,5 @@ -import { hoist } from '@pnpm/real-hoist' import { readWantedLockfile } from '@pnpm/lockfile.fs' +import { hoist } from '@pnpm/real-hoist' import { fixtures } from '@pnpm/test-fixtures' import type { ProjectId } from '@pnpm/types' diff --git a/pkg-manager/remove-bins/src/removeBins.ts b/pkg-manager/remove-bins/src/removeBins.ts index b6db880830..4acfba271e 100644 --- a/pkg-manager/remove-bins/src/removeBins.ts +++ b/pkg-manager/remove-bins/src/removeBins.ts @@ -1,4 +1,5 @@ import path from 'path' + import { removalLogger, } from '@pnpm/core-loggers' diff --git a/pkg-manager/resolve-dependencies/src/dedupeInjectedDeps.ts b/pkg-manager/resolve-dependencies/src/dedupeInjectedDeps.ts index dd9cb09fef..738fa5d57e 100644 --- a/pkg-manager/resolve-dependencies/src/dedupeInjectedDeps.ts +++ b/pkg-manager/resolve-dependencies/src/dedupeInjectedDeps.ts @@ -1,12 +1,14 @@ import path from 'path' + +import type { DepPath, PkgResolutionId } from '@pnpm/types' import normalize from 'normalize-path' -import type { PkgResolutionId, DepPath } from '@pnpm/types' -import type { ResolvedDirectDependency, ResolvedImporters } from './resolveDependencyTree.js' + import type { NodeId } from './nextNodeId.js' import type { LinkedDependency } from './resolveDependencies.js' +import type { ResolvedDirectDependency, ResolvedImporters } from './resolveDependencyTree.js' import type { - GenericDependenciesGraphWithResolvedChildren, DependenciesByProjectId, + GenericDependenciesGraphWithResolvedChildren, PartialResolvedPackage, ProjectToResolve, } from './resolvePeers.js' diff --git a/pkg-manager/resolve-dependencies/src/getCatalogSnapshots.ts b/pkg-manager/resolve-dependencies/src/getCatalogSnapshots.ts index f05f71991a..ed9d2839e4 100644 --- a/pkg-manager/resolve-dependencies/src/getCatalogSnapshots.ts +++ b/pkg-manager/resolve-dependencies/src/getCatalogSnapshots.ts @@ -1,5 +1,6 @@ import type { Catalogs } from '@pnpm/catalogs.types' import type { CatalogSnapshots } from '@pnpm/lockfile.types' + import type { ResolvedDirectDependency } from './resolveDependencyTree.js' export function getCatalogSnapshots ( diff --git a/pkg-manager/resolve-dependencies/src/getExactSinglePreferredVersions.ts b/pkg-manager/resolve-dependencies/src/getExactSinglePreferredVersions.ts index a496057952..ab225916dc 100644 --- a/pkg-manager/resolve-dependencies/src/getExactSinglePreferredVersions.ts +++ b/pkg-manager/resolve-dependencies/src/getExactSinglePreferredVersions.ts @@ -1,4 +1,5 @@ import type { PreferredVersions } from '@pnpm/resolver-base' + import type { WantedDependency } from './getWantedDependencies.js' import { unwrapPackageName } from './unwrapPackageName.js' diff --git a/pkg-manager/resolve-dependencies/src/getNonDevWantedDependencies.ts b/pkg-manager/resolve-dependencies/src/getNonDevWantedDependencies.ts index 23281b3b18..d8ac98f539 100644 --- a/pkg-manager/resolve-dependencies/src/getNonDevWantedDependencies.ts +++ b/pkg-manager/resolve-dependencies/src/getNonDevWantedDependencies.ts @@ -1,4 +1,4 @@ -import type { Dependencies, DependencyManifest, DependenciesMeta } from '@pnpm/types' +import type { Dependencies, DependenciesMeta, DependencyManifest } from '@pnpm/types' import { pickBy } from 'ramda' export interface WantedDependency { diff --git a/pkg-manager/resolve-dependencies/src/hoistPeers.ts b/pkg-manager/resolve-dependencies/src/hoistPeers.ts index a5ca05a582..a464441022 100644 --- a/pkg-manager/resolve-dependencies/src/hoistPeers.ts +++ b/pkg-manager/resolve-dependencies/src/hoistPeers.ts @@ -1,6 +1,7 @@ import type { PreferredVersions } from '@pnpm/resolver-base' import { lexCompare } from '@pnpm/util.lex-comparator' import semver from 'semver' + import type { PkgAddressOrLink } from './resolveDependencies.js' export function hoistPeers ( diff --git a/pkg-manager/resolve-dependencies/src/index.ts b/pkg-manager/resolve-dependencies/src/index.ts index dc60a2ebe5..9461ed3a69 100644 --- a/pkg-manager/resolve-dependencies/src/index.ts +++ b/pkg-manager/resolve-dependencies/src/index.ts @@ -1,9 +1,10 @@ import path from 'path' + +import { iterateHashedGraphNodes } from '@pnpm/calc-dep-state' import type { Catalogs } from '@pnpm/catalogs.types' import { packageManifestLogger, } from '@pnpm/core-loggers' -import { iterateHashedGraphNodes } from '@pnpm/calc-dep-state' import { isRuntimeDepPath } from '@pnpm/dependency-path' import type { LockfileObject, @@ -17,41 +18,42 @@ import { verifyPatches } from '@pnpm/patching.config' import { safeReadPackageJsonFromDir } from '@pnpm/read-package-json' import { type AllowBuild, - type DependenciesField, DEPENDENCIES_FIELDS, + type DependenciesField, type DependencyManifest, + type DepPath, type PeerDependencyIssuesByProjects, type PinnedVersion, - type ProjectManifest, - type ProjectId, - type ProjectRootDir, - type DepPath, type PkgIdWithPatchHash, + type ProjectId, + type ProjectManifest, + type ProjectRootDir, } from '@pnpm/types' -import { difference, zipWith } from 'ramda' import { isSubdir } from 'is-subdir' -import { getWantedDependencies, type WantedDependency } from './getWantedDependencies.js' +import { difference, zipWith } from 'ramda' + import { depPathToRef } from './depPathToRef.js' +import { getCatalogSnapshots } from './getCatalogSnapshots.js' +import { getWantedDependencies, type WantedDependency } from './getWantedDependencies.js' import type { NodeId } from './nextNodeId.js' import { createNodeIdForLinkedLocalPkg, type UpdateMatchingFunction } from './resolveDependencies.js' import { type Importer, type LinkedDependency, - type ResolveDependenciesOptions, type ResolvedDirectDependency, - type ResolvedPackage, + type ResolveDependenciesOptions, resolveDependencyTree, + type ResolvedPackage, } from './resolveDependencyTree.js' import { type DependenciesByProjectId, - resolvePeers, - type GenericDependenciesGraphWithResolvedChildren, type GenericDependenciesGraphNodeWithResolvedChildren, + type GenericDependenciesGraphWithResolvedChildren, + resolvePeers, } from './resolvePeers.js' import { toResolveImporter } from './toResolveImporter.js' import { updateLockfile } from './updateLockfile.js' import { updateProjectManifest } from './updateProjectManifest.js' -import { getCatalogSnapshots } from './getCatalogSnapshots.js' export type DependenciesGraph = GenericDependenciesGraphWithResolvedChildren @@ -60,8 +62,8 @@ export type DependenciesGraphNode = GenericDependenciesGraphNodeWithResolvedChil export { getWantedDependencies, type LinkedDependency, - type ResolvedPackage, type PinnedVersion, + type ResolvedPackage, type UpdateMatchingFunction, type WantedDependency, } diff --git a/pkg-manager/resolve-dependencies/src/resolveDependencies.ts b/pkg-manager/resolve-dependencies/src/resolveDependencies.ts index 53c8aa7cb4..fc32e42a3c 100644 --- a/pkg-manager/resolve-dependencies/src/resolveDependencies.ts +++ b/pkg-manager/resolve-dependencies/src/resolveDependencies.ts @@ -1,11 +1,14 @@ import path from 'path' -import { type CatalogResolution, matchCatalogResolveResult, type CatalogResolver } from '@pnpm/catalogs.resolver' + +import { type CatalogResolution, type CatalogResolver, matchCatalogResolveResult } from '@pnpm/catalogs.resolver' import { deprecationLogger, progressLogger, skippedOptionalDependencyLogger, } from '@pnpm/core-loggers' +import * as dp from '@pnpm/dependency-path' import { PnpmError } from '@pnpm/error' +import { getPreferredVersionsFromLockfileAndManifests } from '@pnpm/lockfile.preferred-versions' import type { LockfileObject, PackageSnapshot, @@ -16,52 +19,51 @@ import { pkgSnapshotToResolution, } from '@pnpm/lockfile.utils' import { logger } from '@pnpm/logger' -import { type PatchGroupRecord, getPatchInfo } from '@pnpm/patching.config' +import { convertEnginesRuntimeToDependencies } from '@pnpm/manifest-utils' +import { getPatchInfo, type PatchGroupRecord } from '@pnpm/patching.config' +import type { PatchInfo } from '@pnpm/patching.types' import { - type DirectoryResolution, DIRECT_DEP_SELECTOR_WEIGHT, + type DirectoryResolution, + type PkgResolutionId, type PreferredVersions, type Resolution, type WorkspacePackages, - type PkgResolutionId, } from '@pnpm/resolver-base' import type { - PkgRequestFetchResult, PackageResponse, + PkgRequestFetchResult, StoreController, } from '@pnpm/store-controller-types' import type { AllowBuild, - DepPath, - SupportedArchitectures, AllowedDeprecatedVersions, + DepPath, PackageManifest, + PackageVersionPolicy, + PinnedVersion, + PkgIdWithPatchHash, ReadPackageHook, Registries, - PkgIdWithPatchHash, - PinnedVersion, - PackageVersionPolicy, + SupportedArchitectures, TrustPolicy, } from '@pnpm/types' -import * as dp from '@pnpm/dependency-path' -import { getPreferredVersionsFromLockfileAndManifests } from '@pnpm/lockfile.preferred-versions' -import { convertEnginesRuntimeToDependencies } from '@pnpm/manifest-utils' -import type { PatchInfo } from '@pnpm/patching.types' import normalizePath from 'normalize-path' -import { pathExists } from 'path-exists' import pDefer from 'p-defer' +import { pathExists } from 'path-exists' import { pShare } from 'promise-share' -import { pickBy, omit, zipWith } from 'ramda' +import { omit, pickBy, zipWith } from 'ramda' import semver from 'semver' + import { getExactSinglePreferredVersions } from './getExactSinglePreferredVersions.js' import { getNonDevWantedDependencies, type WantedDependency } from './getNonDevWantedDependencies.js' +import { getHoistableOptionalPeers, hoistPeers } from './hoistPeers.js' import { safeIntersect } from './mergePeers.js' -import { type NodeId, nextNodeId } from './nextNodeId.js' +import { nextNodeId, type NodeId } from './nextNodeId.js' import { parentIdsContainSequence } from './parentIdsContainSequence.js' -import { hoistPeers, getHoistableOptionalPeers } from './hoistPeers.js' -import { wantedDepIsLocallyAvailable } from './wantedDepIsLocallyAvailable.js' -import type { CatalogLookupMetadata } from './resolveDependencyTree.js' import { replaceVersionInBareSpecifier } from './replaceVersionInBareSpecifier.js' +import type { CatalogLookupMetadata } from './resolveDependencyTree.js' +import { wantedDepIsLocallyAvailable } from './wantedDepIsLocallyAvailable.js' export type { WantedDependency } diff --git a/pkg-manager/resolve-dependencies/src/resolveDependencyTree.ts b/pkg-manager/resolve-dependencies/src/resolveDependencyTree.ts index 5da382c263..642951845a 100644 --- a/pkg-manager/resolve-dependencies/src/resolveDependencyTree.ts +++ b/pkg-manager/resolve-dependencies/src/resolveDependencyTree.ts @@ -1,47 +1,48 @@ -import { PnpmError } from '@pnpm/error' import { resolveFromCatalog } from '@pnpm/catalogs.resolver' import type { Catalogs } from '@pnpm/catalogs.types' +import { createPackageVersionPolicy } from '@pnpm/config.version-policy' +import { PnpmError } from '@pnpm/error' import type { LockfileObject } from '@pnpm/lockfile.types' import { globalWarn } from '@pnpm/logger' -import { createPackageVersionPolicy } from '@pnpm/config.version-policy' import type { PatchGroupRecord } from '@pnpm/patching.config' import type { PreferredVersions, Resolution, WorkspacePackages } from '@pnpm/resolver-base' import type { StoreController } from '@pnpm/store-controller-types' import type { AllowBuild, - SupportedArchitectures, AllowedDeprecatedVersions, + PackageVersionPolicy, PinnedVersion, PkgResolutionId, - ProjectManifest, ProjectId, + ProjectManifest, + ProjectRootDir, ReadPackageHook, Registries, - ProjectRootDir, - PackageVersionPolicy, + SupportedArchitectures, TrustPolicy, } from '@pnpm/types' import { partition, zipObj } from 'ramda' + import type { WantedDependency } from './getNonDevWantedDependencies.js' -import { type NodeId, nextNodeId } from './nextNodeId.js' +import { nextNodeId, type NodeId } from './nextNodeId.js' import { parentIdsContainSequence } from './parentIdsContainSequence.js' import { type ChildrenByParentId, type DependenciesTree, - type LinkedDependency, type ImporterToResolve, type ImporterToResolveOptions, + type LinkedDependency, type ParentPkgAliases, type PendingNode, type PkgAddress, type PkgAddressOrLink, - resolveRootDependencies, + type ResolutionContext, type ResolvedPackage, type ResolvedPkgsById, - type ResolutionContext, + resolveRootDependencies, } from './resolveDependencies.js' -export type { LinkedDependency, ResolvedPackage, DependenciesTree, DependenciesTreeNode } from './resolveDependencies.js' +export type { DependenciesTree, DependenciesTreeNode, LinkedDependency, ResolvedPackage } from './resolveDependencies.js' export interface ResolvedImporters { [id: string]: { diff --git a/pkg-manager/resolve-dependencies/src/resolvePeers.ts b/pkg-manager/resolve-dependencies/src/resolvePeers.ts index f36e30ef29..81f763596d 100644 --- a/pkg-manager/resolve-dependencies/src/resolvePeers.ts +++ b/pkg-manager/resolve-dependencies/src/resolvePeers.ts @@ -1,9 +1,6 @@ -import filenamify from 'filenamify' -import { analyzeGraph, type Graph } from 'graph-cycles' import path from 'path' -import pDefer, { type DeferredPromise } from 'p-defer' -import semver from 'semver' -import * as semverUtils from '@yarnpkg/core/semverUtils' + +import { createPeerDepGraphHash, depPathToFilename, type PeerId } from '@pnpm/dependency-path' import type { DepPath, ParentPackages, @@ -12,19 +9,24 @@ import type { PkgIdWithPatchHash, ProjectRootDir, } from '@pnpm/types' -import { depPathToFilename, createPeerDepGraphHash, type PeerId } from '@pnpm/dependency-path' +import * as semverUtils from '@yarnpkg/core/semverUtils' +import filenamify from 'filenamify' +import { analyzeGraph, type Graph } from 'graph-cycles' +import pDefer, { type DeferredPromise } from 'p-defer' import { partition, pick } from 'ramda' +import semver from 'semver' + +import { dedupeInjectedDeps } from './dedupeInjectedDeps.js' +import { mergePeers } from './mergePeers.js' import type { NodeId } from './nextNodeId.js' import type { ChildrenMap, - PeerDependencies, DependenciesTree, DependenciesTreeNode, + PeerDependencies, ResolvedPackage, } from './resolveDependencies.js' import type { ResolvedImporters } from './resolveDependencyTree.js' -import { mergePeers } from './mergePeers.js' -import { dedupeInjectedDeps } from './dedupeInjectedDeps.js' export interface BaseGenericDependenciesGraphNode { // at this point the version is really needed only for logging diff --git a/pkg-manager/resolve-dependencies/src/safeIsInnerLink.ts b/pkg-manager/resolve-dependencies/src/safeIsInnerLink.ts index 255b114c3d..5f8c2f62e4 100644 --- a/pkg-manager/resolve-dependencies/src/safeIsInnerLink.ts +++ b/pkg-manager/resolve-dependencies/src/safeIsInnerLink.ts @@ -1,4 +1,5 @@ import path from 'path' + import { logger } from '@pnpm/logger' import { isInnerLink } from 'is-inner-link' import { isSubdir } from 'is-subdir' diff --git a/pkg-manager/resolve-dependencies/src/toResolveImporter.ts b/pkg-manager/resolve-dependencies/src/toResolveImporter.ts index 7e89b50d68..a18cdf8d59 100644 --- a/pkg-manager/resolve-dependencies/src/toResolveImporter.ts +++ b/pkg-manager/resolve-dependencies/src/toResolveImporter.ts @@ -6,8 +6,9 @@ import type { } from '@pnpm/resolver-base' import type { Dependencies, ProjectManifest } from '@pnpm/types' import getVerSelType from 'version-selector-type' -import type { ImporterToResolve } from './index.js' + import { getWantedDependencies, type WantedDependency } from './getWantedDependencies.js' +import type { ImporterToResolve } from './index.js' import type { ImporterToResolveGeneric } from './resolveDependencyTree.js' import { safeIsInnerLink } from './safeIsInnerLink.js' import { unwrapPackageName } from './unwrapPackageName.js' diff --git a/pkg-manager/resolve-dependencies/src/updateLockfile.ts b/pkg-manager/resolve-dependencies/src/updateLockfile.ts index d973abac0b..cf58f980b3 100644 --- a/pkg-manager/resolve-dependencies/src/updateLockfile.ts +++ b/pkg-manager/resolve-dependencies/src/updateLockfile.ts @@ -1,17 +1,18 @@ -import { logger } from '@pnpm/logger' +import * as dp from '@pnpm/dependency-path' import { type LockfileObject, type PackageSnapshot, pruneSharedLockfile, } from '@pnpm/lockfile.pruner' import { toLockfileResolution } from '@pnpm/lockfile.utils' +import { logger } from '@pnpm/logger' import type { DepPath, Registries } from '@pnpm/types' -import * as dp from '@pnpm/dependency-path' import type { KeyValuePair } from 'ramda' import { partition } from 'ramda' + import { depPathToRef } from './depPathToRef.js' -import type { ResolvedPackage } from './resolveDependencies.js' import type { DependenciesGraph } from './index.js' +import type { ResolvedPackage } from './resolveDependencies.js' export function updateLockfile ( { dependenciesGraph, lockfile, prefix, registries, lockfileIncludeTarballUrl }: { diff --git a/pkg-manager/resolve-dependencies/src/updateProjectManifest.ts b/pkg-manager/resolve-dependencies/src/updateProjectManifest.ts index 6d4d705f44..d197da57e8 100644 --- a/pkg-manager/resolve-dependencies/src/updateProjectManifest.ts +++ b/pkg-manager/resolve-dependencies/src/updateProjectManifest.ts @@ -3,8 +3,9 @@ import { updateProjectManifestObject, } from '@pnpm/manifest-utils' import type { ProjectManifest } from '@pnpm/types' -import type { ResolvedDirectDependency } from './resolveDependencyTree.js' + import type { ImporterToResolve } from './index.js' +import type { ResolvedDirectDependency } from './resolveDependencyTree.js' export async function updateProjectManifest ( importer: ImporterToResolve, diff --git a/pkg-manager/resolve-dependencies/src/validatePeerDependencies.ts b/pkg-manager/resolve-dependencies/src/validatePeerDependencies.ts index aad7c237ff..d10aa4be4b 100644 --- a/pkg-manager/resolve-dependencies/src/validatePeerDependencies.ts +++ b/pkg-manager/resolve-dependencies/src/validatePeerDependencies.ts @@ -1,6 +1,6 @@ import { PnpmError } from '@pnpm/error' -import type { ProjectManifest } from '@pnpm/types' import { isValidPeerRange } from '@pnpm/semver.peer-range' +import type { ProjectManifest } from '@pnpm/types' export interface ProjectToValidate { rootDir: string diff --git a/pkg-manager/resolve-dependencies/src/wantedDepIsLocallyAvailable.ts b/pkg-manager/resolve-dependencies/src/wantedDepIsLocallyAvailable.ts index 21a015d02f..11095b3ed4 100644 --- a/pkg-manager/resolve-dependencies/src/wantedDepIsLocallyAvailable.ts +++ b/pkg-manager/resolve-dependencies/src/wantedDepIsLocallyAvailable.ts @@ -1,6 +1,7 @@ import { parseBareSpecifier, type RegistryPackageSpec } from '@pnpm/npm-resolver' -import type { WorkspacePackagesByVersion, WorkspacePackages } from '@pnpm/resolver-base' +import type { WorkspacePackages, WorkspacePackagesByVersion } from '@pnpm/resolver-base' import semver from 'semver' + import type { WantedDependency } from './getNonDevWantedDependencies.js' export function wantedDepIsLocallyAvailable ( diff --git a/pkg-manager/resolve-dependencies/test/dedupeDepPaths.test.ts b/pkg-manager/resolve-dependencies/test/dedupeDepPaths.test.ts index 6726c7bef8..402c89432f 100644 --- a/pkg-manager/resolve-dependencies/test/dedupeDepPaths.test.ts +++ b/pkg-manager/resolve-dependencies/test/dedupeDepPaths.test.ts @@ -1,7 +1,8 @@ -import type { PkgResolutionId, PkgIdWithPatchHash, ProjectRootDir } from '@pnpm/types' -import { type PartialResolvedPackage, resolvePeers } from '../lib/resolvePeers.js' -import type { DependenciesTreeNode } from '../lib/resolveDependencies.js' +import type { PkgIdWithPatchHash, PkgResolutionId, ProjectRootDir } from '@pnpm/types' + import type { NodeId } from '../lib/nextNodeId.js' +import type { DependenciesTreeNode } from '../lib/resolveDependencies.js' +import { type PartialResolvedPackage, resolvePeers } from '../lib/resolvePeers.js' test('packages are not deduplicated when versions do not match', async () => { const fooPkg: PartialResolvedPackage = { diff --git a/pkg-manager/resolve-dependencies/test/getManifestFromResponse.test.ts b/pkg-manager/resolve-dependencies/test/getManifestFromResponse.test.ts index 6ffb643a94..ca5f663768 100644 --- a/pkg-manager/resolve-dependencies/test/getManifestFromResponse.test.ts +++ b/pkg-manager/resolve-dependencies/test/getManifestFromResponse.test.ts @@ -1,6 +1,7 @@ -import { getManifestFromResponse, type WantedDependency } from '../lib/resolveDependencies.js' import type { PackageResponse } from '@pnpm/store-controller-types' +import { getManifestFromResponse, type WantedDependency } from '../lib/resolveDependencies.js' + test('getManifestFromResponse returns manifest from pkgResponse when available', () => { const pkgResponse = { body: { diff --git a/pkg-manager/resolve-dependencies/test/hoistPeers.test.ts b/pkg-manager/resolve-dependencies/test/hoistPeers.test.ts index c922bc93c9..a268e5b19c 100644 --- a/pkg-manager/resolve-dependencies/test/hoistPeers.test.ts +++ b/pkg-manager/resolve-dependencies/test/hoistPeers.test.ts @@ -1,4 +1,4 @@ -import { hoistPeers, getHoistableOptionalPeers } from '../lib/hoistPeers.js' +import { getHoistableOptionalPeers, hoistPeers } from '../lib/hoistPeers.js' test('hoistPeers picks an already available prerelease version', () => { expect(hoistPeers({ diff --git a/pkg-manager/resolve-dependencies/test/parentIdsContainSequence.test.ts b/pkg-manager/resolve-dependencies/test/parentIdsContainSequence.test.ts index 14af314926..0493a0c699 100644 --- a/pkg-manager/resolve-dependencies/test/parentIdsContainSequence.test.ts +++ b/pkg-manager/resolve-dependencies/test/parentIdsContainSequence.test.ts @@ -1,4 +1,5 @@ import type { PkgResolutionId } from '@pnpm/types' + import { parentIdsContainSequence } from '../lib/parentIdsContainSequence.js' test('parentIdsContainSequence()', () => { diff --git a/pkg-manager/resolve-dependencies/test/resolvePeers.ts b/pkg-manager/resolve-dependencies/test/resolvePeers.ts index 710563c1fe..0e374825f0 100644 --- a/pkg-manager/resolve-dependencies/test/resolvePeers.ts +++ b/pkg-manager/resolve-dependencies/test/resolvePeers.ts @@ -1,13 +1,14 @@ /// import type { - PkgResolutionId, PeerDependencyIssuesByProjects, PkgIdWithPatchHash, + PkgResolutionId, ProjectRootDir, } from '@pnpm/types' -import { type PartialResolvedPackage, resolvePeers } from '../lib/resolvePeers.js' -import type { DependenciesTreeNode, PeerDependencies } from '../lib/resolveDependencies.js' + import type { NodeId } from '../lib/nextNodeId.js' +import type { DependenciesTreeNode, PeerDependencies } from '../lib/resolveDependencies.js' +import { type PartialResolvedPackage, resolvePeers } from '../lib/resolvePeers.js' test('resolve peer dependencies of cyclic dependencies', async () => { const fooPkg = { diff --git a/pkg-manifest/exportable-manifest/src/index.ts b/pkg-manifest/exportable-manifest/src/index.ts index 151331d22a..1a0a5d5e07 100644 --- a/pkg-manifest/exportable-manifest/src/index.ts +++ b/pkg-manifest/exportable-manifest/src/index.ts @@ -1,13 +1,15 @@ import path from 'path' + import { type CatalogResolver, resolveFromCatalog } from '@pnpm/catalogs.resolver' import type { Catalogs } from '@pnpm/catalogs.types' import { PnpmError } from '@pnpm/error' -import { parseJsrSpecifier } from '@pnpm/resolving.jsr-specifier-parser' -import { tryReadProjectManifest } from '@pnpm/read-project-manifest' import type { Hooks } from '@pnpm/pnpmfile' +import { tryReadProjectManifest } from '@pnpm/read-project-manifest' +import { parseJsrSpecifier } from '@pnpm/resolving.jsr-specifier-parser' import type { Dependencies, ProjectManifest } from '@pnpm/types' -import { omit } from 'ramda' import { pMapValues } from 'p-map-values' +import { omit } from 'ramda' + import { overridePublishConfig } from './overridePublishConfig.js' import { type ExportedManifest, transform } from './transform/index.js' diff --git a/pkg-manifest/exportable-manifest/src/transform/bin.ts b/pkg-manifest/exportable-manifest/src/transform/bin.ts index 0193ed6e3c..d32d7c04f5 100644 --- a/pkg-manifest/exportable-manifest/src/transform/bin.ts +++ b/pkg-manifest/exportable-manifest/src/transform/bin.ts @@ -1,5 +1,6 @@ import { PnpmError } from '@pnpm/error' import type { ProjectManifest } from '@pnpm/types' + import type { ExportedManifest } from './index.js' type Input = Pick & Pick diff --git a/pkg-manifest/exportable-manifest/src/transform/engines.ts b/pkg-manifest/exportable-manifest/src/transform/engines.ts index 4e3506ad00..b0d7f6222e 100644 --- a/pkg-manifest/exportable-manifest/src/transform/engines.ts +++ b/pkg-manifest/exportable-manifest/src/transform/engines.ts @@ -1,5 +1,6 @@ import { PnpmError } from '@pnpm/error' import type { ProjectManifest } from '@pnpm/types' + import type { ExportedManifest } from './index.js' type EnginesField = 'engines' | 'devEngines' diff --git a/pkg-manifest/exportable-manifest/src/transform/index.ts b/pkg-manifest/exportable-manifest/src/transform/index.ts index 02df396727..b8fcd9053d 100644 --- a/pkg-manifest/exportable-manifest/src/transform/index.ts +++ b/pkg-manifest/exportable-manifest/src/transform/index.ts @@ -1,10 +1,11 @@ import type { PackageJSON as ExportedManifest } from '@npm/types' import type { ProjectManifest } from '@pnpm/types' import { pipe } from 'ramda' + import { transformBin } from './bin.js' import { transformEngines } from './engines.js' -import { transformRequiredFields } from './requiredFields.js' import { transformPeerDependenciesMeta } from './peerDependenciesMeta.js' +import { transformRequiredFields } from './requiredFields.js' export { type ExportedManifest } diff --git a/pkg-manifest/exportable-manifest/src/transform/peerDependenciesMeta.ts b/pkg-manifest/exportable-manifest/src/transform/peerDependenciesMeta.ts index c50b61f561..cf21a75201 100644 --- a/pkg-manifest/exportable-manifest/src/transform/peerDependenciesMeta.ts +++ b/pkg-manifest/exportable-manifest/src/transform/peerDependenciesMeta.ts @@ -1,4 +1,5 @@ import type { ProjectManifest } from '@pnpm/types' + import type { ExportedManifest } from './index.js' type Input = Pick diff --git a/pkg-manifest/exportable-manifest/src/transform/requiredFields.ts b/pkg-manifest/exportable-manifest/src/transform/requiredFields.ts index 1ce660f6e0..62f2b7cacd 100644 --- a/pkg-manifest/exportable-manifest/src/transform/requiredFields.ts +++ b/pkg-manifest/exportable-manifest/src/transform/requiredFields.ts @@ -1,5 +1,6 @@ import { PnpmError } from '@pnpm/error' import type { ProjectManifest } from '@pnpm/types' + import type { ExportedManifest } from './index.js' type RequiredField = 'name' | 'version' diff --git a/pkg-manifest/exportable-manifest/test/beforePackingHook.test.ts b/pkg-manifest/exportable-manifest/test/beforePackingHook.test.ts index 541ab1d9bb..63c90e7cf3 100644 --- a/pkg-manifest/exportable-manifest/test/beforePackingHook.test.ts +++ b/pkg-manifest/exportable-manifest/test/beforePackingHook.test.ts @@ -1,4 +1,5 @@ import fs from 'fs' + import { createExportableManifest, type MakePublishManifestOptions } from '@pnpm/exportable-manifest' import { requireHooks } from '@pnpm/pnpmfile' import { prepare } from '@pnpm/prepare' diff --git a/pkg-manifest/exportable-manifest/test/index.test.ts b/pkg-manifest/exportable-manifest/test/index.test.ts index 0dd79b73cb..f0621fa8ea 100644 --- a/pkg-manifest/exportable-manifest/test/index.test.ts +++ b/pkg-manifest/exportable-manifest/test/index.test.ts @@ -1,11 +1,12 @@ /// +import path from 'path' + import { getCatalogsFromWorkspaceManifest } from '@pnpm/catalogs.config' -import { type MakePublishManifestOptions, createExportableManifest } from '@pnpm/exportable-manifest' +import { createExportableManifest, type MakePublishManifestOptions } from '@pnpm/exportable-manifest' import { preparePackages } from '@pnpm/prepare' -import { writeYamlFileSync } from 'write-yaml-file' import type { ProjectManifest } from '@pnpm/types' import crossSpawn from 'cross-spawn' -import path from 'path' +import { writeYamlFileSync } from 'write-yaml-file' const pnpmBin = path.join(import.meta.dirname, '../../../pnpm/bin/pnpm.mjs') diff --git a/pkg-manifest/exportable-manifest/test/overridePublishConfig.test.ts b/pkg-manifest/exportable-manifest/test/overridePublishConfig.test.ts index 3a47164aa6..ebc2b569fb 100644 --- a/pkg-manifest/exportable-manifest/test/overridePublishConfig.test.ts +++ b/pkg-manifest/exportable-manifest/test/overridePublishConfig.test.ts @@ -1,4 +1,5 @@ import type { PackageManifest, PublishConfig } from '@pnpm/types' + import { overridePublishConfig } from '../lib/overridePublishConfig.js' test('publish config to be overridden', async () => { diff --git a/pkg-manifest/exportable-manifest/test/transformEngines.test.ts b/pkg-manifest/exportable-manifest/test/transformEngines.test.ts index c82946eed1..e0b5e58e29 100644 --- a/pkg-manifest/exportable-manifest/test/transformEngines.test.ts +++ b/pkg-manifest/exportable-manifest/test/transformEngines.test.ts @@ -1,4 +1,4 @@ -import { transformEngines, DevEnginesRuntimeConflictError } from '../lib/transform/engines.js' +import { DevEnginesRuntimeConflictError, transformEngines } from '../lib/transform/engines.js' describe('transformEngines', () => { test('moves engines.runtime to devEngines.runtime', () => { diff --git a/pkg-manifest/exportable-manifest/test/transformPeerDependenciesMeta.test.ts b/pkg-manifest/exportable-manifest/test/transformPeerDependenciesMeta.test.ts index 64dbce9a17..3027728709 100644 --- a/pkg-manifest/exportable-manifest/test/transformPeerDependenciesMeta.test.ts +++ b/pkg-manifest/exportable-manifest/test/transformPeerDependenciesMeta.test.ts @@ -1,4 +1,5 @@ import type { ProjectManifest } from '@pnpm/types' + import { transformPeerDependenciesMeta } from '../lib/transform/peerDependenciesMeta.js' test('returns manifest as-is when peerDependenciesMeta is absent', () => { diff --git a/pkg-manifest/manifest-utils/src/getAllUniqueSpecs.ts b/pkg-manifest/manifest-utils/src/getAllUniqueSpecs.ts index a9a5ab98d0..9e0e1d342d 100644 --- a/pkg-manifest/manifest-utils/src/getAllUniqueSpecs.ts +++ b/pkg-manifest/manifest-utils/src/getAllUniqueSpecs.ts @@ -1,4 +1,5 @@ import type { DependencyManifest } from '@pnpm/types' + import { getAllDependenciesFromManifest } from './getAllDependenciesFromManifest.js' export function getAllUniqueSpecs (manifests: DependencyManifest[]): Record { diff --git a/pkg-manifest/manifest-utils/src/getDependencyTypeFromManifest.ts b/pkg-manifest/manifest-utils/src/getDependencyTypeFromManifest.ts index 904a7eb04a..b7cd8d54c8 100644 --- a/pkg-manifest/manifest-utils/src/getDependencyTypeFromManifest.ts +++ b/pkg-manifest/manifest-utils/src/getDependencyTypeFromManifest.ts @@ -1,4 +1,4 @@ -import type { ProjectManifest, DependenciesOrPeersField } from '@pnpm/types' +import type { DependenciesOrPeersField, ProjectManifest } from '@pnpm/types' export function getDependencyTypeFromManifest ( manifest: Pick, diff --git a/pkg-manifest/manifest-utils/src/getSpecFromPackageManifest.ts b/pkg-manifest/manifest-utils/src/getSpecFromPackageManifest.ts index ec8b29af32..679e1a813a 100644 --- a/pkg-manifest/manifest-utils/src/getSpecFromPackageManifest.ts +++ b/pkg-manifest/manifest-utils/src/getSpecFromPackageManifest.ts @@ -1,4 +1,4 @@ -import type { ProjectManifest, DependenciesOrPeersField } from '@pnpm/types' +import type { DependenciesOrPeersField, ProjectManifest } from '@pnpm/types' export function getSpecFromPackageManifest ( manifest: Pick, diff --git a/pkg-manifest/manifest-utils/src/index.ts b/pkg-manifest/manifest-utils/src/index.ts index 8d3ce951f4..5b19e6546c 100644 --- a/pkg-manifest/manifest-utils/src/index.ts +++ b/pkg-manifest/manifest-utils/src/index.ts @@ -3,14 +3,15 @@ import type { IncludedDependencies, ProjectManifest, } from '@pnpm/types' + import { getAllUniqueSpecs } from './getAllUniqueSpecs.js' import { getSpecFromPackageManifest } from './getSpecFromPackageManifest.js' export * from './convertEnginesRuntimeToDependencies.js' -export * from './updateProjectManifestObject.js' export * from './getDependencyTypeFromManifest.js' +export * from './updateProjectManifestObject.js' -export { getSpecFromPackageManifest, getAllUniqueSpecs } +export { getAllUniqueSpecs, getSpecFromPackageManifest } export function filterDependenciesByType ( manifest: ProjectManifest, diff --git a/pkg-manifest/manifest-utils/src/updateProjectManifestObject.ts b/pkg-manifest/manifest-utils/src/updateProjectManifestObject.ts index d71af6a293..bb7538ab42 100644 --- a/pkg-manifest/manifest-utils/src/updateProjectManifestObject.ts +++ b/pkg-manifest/manifest-utils/src/updateProjectManifestObject.ts @@ -1,14 +1,14 @@ import { packageManifestLogger } from '@pnpm/core-loggers' import { isValidPeerRange } from '@pnpm/semver.peer-range' -import semver from 'semver' import { - type DependenciesOrPeersField, - type DependenciesField, DEPENDENCIES_FIELDS, DEPENDENCIES_OR_PEER_FIELDS, + type DependenciesField, + type DependenciesOrPeersField, type PinnedVersion, type ProjectManifest, } from '@pnpm/types' +import semver from 'semver' export interface PackageSpecObject { alias: string diff --git a/pkg-manifest/read-package-json/src/index.ts b/pkg-manifest/read-package-json/src/index.ts index 5caa00269e..a2a1553bf3 100644 --- a/pkg-manifest/read-package-json/src/index.ts +++ b/pkg-manifest/read-package-json/src/index.ts @@ -1,5 +1,6 @@ import path from 'path' import util from 'util' + import { PnpmError } from '@pnpm/error' import type { PackageManifest } from '@pnpm/types' import { loadJsonFile, loadJsonFileSync } from 'load-json-file' diff --git a/pkg-manifest/read-package-json/test/index.ts b/pkg-manifest/read-package-json/test/index.ts index b8edbbd26c..dec0f06dac 100644 --- a/pkg-manifest/read-package-json/test/index.ts +++ b/pkg-manifest/read-package-json/test/index.ts @@ -1,5 +1,6 @@ /// import path from 'path' + import { readPackageJson, readPackageJsonFromDir } from '@pnpm/read-package-json' const fixtures = path.join(import.meta.dirname, 'fixtures') diff --git a/pkg-manifest/read-project-manifest/src/index.ts b/pkg-manifest/read-project-manifest/src/index.ts index 9ca5cc447c..4d31debac6 100644 --- a/pkg-manifest/read-project-manifest/src/index.ts +++ b/pkg-manifest/read-project-manifest/src/index.ts @@ -1,14 +1,16 @@ import { promises as fs, type Stats } from 'fs' import path from 'path' + import { PnpmError } from '@pnpm/error' -import type { ProjectManifest, EngineDependency } from '@pnpm/types' import { convertEnginesRuntimeToDependencies } from '@pnpm/manifest-utils' -import { extractComments, type CommentSpecifier } from '@pnpm/text.comments-parser' +import { type CommentSpecifier, extractComments } from '@pnpm/text.comments-parser' +import type { EngineDependency, ProjectManifest } from '@pnpm/types' import { writeProjectManifest } from '@pnpm/write-project-manifest' -import { readYamlFile } from 'read-yaml-file' import detectIndent from 'detect-indent' import equal from 'fast-deep-equal' import isWindows from 'is-windows' +import { readYamlFile } from 'read-yaml-file' + import { readJson5File, readJsonFile, diff --git a/pkg-manifest/read-project-manifest/test/index.ts b/pkg-manifest/read-project-manifest/test/index.ts index dc5969f75d..06837e4736 100644 --- a/pkg-manifest/read-project-manifest/test/index.ts +++ b/pkg-manifest/read-project-manifest/test/index.ts @@ -1,10 +1,11 @@ /// import fs from 'fs' import path from 'path' + import { readProjectManifest, tryReadProjectManifest } from '@pnpm/read-project-manifest' import { fixtures } from '@pnpm/test-fixtures' -import { temporaryDirectory } from 'tempy' import type { ProjectManifest } from '@pnpm/types' +import { temporaryDirectory } from 'tempy' const f = fixtures(import.meta.dirname) diff --git a/pkg-manifest/write-project-manifest/src/index.ts b/pkg-manifest/write-project-manifest/src/index.ts index 002e6b79e0..b6007f028a 100644 --- a/pkg-manifest/write-project-manifest/src/index.ts +++ b/pkg-manifest/write-project-manifest/src/index.ts @@ -1,6 +1,7 @@ import { promises as fs } from 'fs' import path from 'path' -import { insertComments, type CommentSpecifier } from '@pnpm/text.comments-parser' + +import { type CommentSpecifier, insertComments } from '@pnpm/text.comments-parser' import type { ProjectManifest } from '@pnpm/types' import JSON5 from 'json5' import writeFileAtomic from 'write-file-atomic' diff --git a/pkg-manifest/write-project-manifest/test/index.ts b/pkg-manifest/write-project-manifest/test/index.ts index 9ab77899ce..9adfc9a53b 100644 --- a/pkg-manifest/write-project-manifest/test/index.ts +++ b/pkg-manifest/write-project-manifest/test/index.ts @@ -1,7 +1,8 @@ /// -import { promisify } from 'util' import fs from 'fs' import path from 'path' +import { promisify } from 'util' + import { writeProjectManifest } from '@pnpm/write-project-manifest' import { temporaryDirectory } from 'tempy' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d4dfadf28b..4ceeacfe94 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -372,6 +372,9 @@ catalogs: eslint-plugin-regexp: specifier: ^2.10.0 version: 2.10.0 + eslint-plugin-simple-import-sort: + specifier: ^12.1.1 + version: 12.1.1 execa: specifier: npm:safe-execa@0.3.0 version: 0.3.0 @@ -1029,6 +1032,9 @@ importers: eslint-plugin-promise: specifier: 'catalog:' version: 7.2.1(eslint@9.39.4(jiti@2.6.1)) + eslint-plugin-simple-import-sort: + specifier: 'catalog:' + version: 12.1.1(eslint@9.39.4(jiti@2.6.1)) typescript: specifier: 'catalog:' version: 5.9.2 @@ -13020,6 +13026,11 @@ packages: peerDependencies: eslint: '>=8.44.0' + eslint-plugin-simple-import-sort@12.1.1: + resolution: {integrity: sha512-6nuzu4xwQtE3332Uz0to+TxDQYRLTKRESSc2hefVT48Zc8JthmN23Gx9lnYhu0FtkRSL1oxny3kJ2aveVhmOVA==} + peerDependencies: + eslint: '>=5.0.0' + eslint-scope@8.4.0: resolution: {integrity: sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -21861,6 +21872,10 @@ snapshots: regexp-ast-analysis: 0.7.1 scslre: 0.3.0 + eslint-plugin-simple-import-sort@12.1.1(eslint@9.39.4(jiti@2.6.1)): + dependencies: + eslint: 9.39.4(jiti@2.6.1) + eslint-scope@8.4.0: dependencies: esrecurse: 4.3.0 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 7a4df340f3..b804c81f18 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -183,6 +183,7 @@ catalog: escape-string-regexp: ^5.0.0 eslint: ^9.39.2 eslint-plugin-import-x: ^4.16.1 + eslint-plugin-simple-import-sort: ^12.1.1 eslint-plugin-jest: ^29.12.1 eslint-plugin-n: ^17.23.2 eslint-plugin-promise: ^7.2.1 diff --git a/pnpm/src/checkForUpdates.test.ts b/pnpm/src/checkForUpdates.test.ts index b1445807a8..6bb0a4c2a0 100644 --- a/pnpm/src/checkForUpdates.test.ts +++ b/pnpm/src/checkForUpdates.test.ts @@ -1,6 +1,6 @@ +import { jest } from '@jest/globals' import { getConfig } from '@pnpm/config' import { prepareEmpty } from '@pnpm/prepare' -import { jest } from '@jest/globals' import { loadJsonFileSync } from 'load-json-file' import { writeJsonFileSync } from 'write-json-file' diff --git a/pnpm/src/checkForUpdates.ts b/pnpm/src/checkForUpdates.ts index 054c7a469b..12f4fb2dbf 100644 --- a/pnpm/src/checkForUpdates.ts +++ b/pnpm/src/checkForUpdates.ts @@ -1,7 +1,8 @@ import path from 'path' + import { packageManager } from '@pnpm/cli-meta' -import type { Config } from '@pnpm/config' import { createResolver } from '@pnpm/client' +import type { Config } from '@pnpm/config' import { updateCheckLogger } from '@pnpm/core-loggers' import { loadJsonFile } from 'load-json-file' import { writeJsonFile } from 'write-json-file' diff --git a/pnpm/src/cmd/clean.ts b/pnpm/src/cmd/clean.ts index 5fd2512296..49070b5b9f 100644 --- a/pnpm/src/cmd/clean.ts +++ b/pnpm/src/cmd/clean.ts @@ -1,10 +1,11 @@ import { promises as fs } from 'fs' import path from 'path' + import { docsUrl } from '@pnpm/cli-utils' import { findWorkspacePackagesNoCheck } from '@pnpm/workspace.find-packages' +import { rimraf } from '@zkochan/rimraf' import { isSubdir } from 'is-subdir' import { pathExists } from 'path-exists' -import { rimraf } from '@zkochan/rimraf' import { renderHelp } from 'render-help' export const commandNames = ['clean'] diff --git a/pnpm/src/cmd/help.ts b/pnpm/src/cmd/help.ts index f69a10fb33..44e2f0f47d 100644 --- a/pnpm/src/cmd/help.ts +++ b/pnpm/src/cmd/help.ts @@ -1,6 +1,7 @@ -import { packageManager, detectIfCurrentPkgIsExecutable } from '@pnpm/cli-meta' +import { detectIfCurrentPkgIsExecutable, packageManager } from '@pnpm/cli-meta' import { docsUrl } from '@pnpm/cli-utils' import { renderHelp } from 'render-help' + import type { CommandDefinition } from './index.js' type HelpByCommandName = Record string> diff --git a/pnpm/src/cmd/index.ts b/pnpm/src/cmd/index.ts index 7a60d87012..82ce09172a 100644 --- a/pnpm/src/cmd/index.ts +++ b/pnpm/src/cmd/index.ts @@ -4,20 +4,19 @@ import { cache } from '@pnpm/cache.commands' import type { CompletionFunc } from '@pnpm/command' import { types as allTypes } from '@pnpm/config' import { audit } from '@pnpm/plugin-commands-audit' -import { generateCompletion, createCompletionServer } from '@pnpm/plugin-commands-completion' +import { createCompletionServer, generateCompletion } from '@pnpm/plugin-commands-completion' import { config, getCommand, setCommand } from '@pnpm/plugin-commands-config' +import { deploy } from '@pnpm/plugin-commands-deploy' import { doctor } from '@pnpm/plugin-commands-doctor' import { env } from '@pnpm/plugin-commands-env' -import { runtime } from '@pnpm/runtime.commands' -import { deploy } from '@pnpm/plugin-commands-deploy' -import { add, ci, dedupe, fetch, install, link, prune, remove, unlink, update, importCommand } from '@pnpm/plugin-commands-installation' -import { selfUpdate } from '@pnpm/tools.plugin-commands-self-updater' -import { list, ll, why } from '@pnpm/plugin-commands-listing' +import { init } from '@pnpm/plugin-commands-init' +import { add, ci, dedupe, fetch, importCommand, install, link, prune, remove, unlink, update } from '@pnpm/plugin-commands-installation' import { licenses } from '@pnpm/plugin-commands-licenses' -import { sbom } from '@pnpm/plugin-commands-sbom' +import { list, ll, why } from '@pnpm/plugin-commands-listing' import { outdated } from '@pnpm/plugin-commands-outdated' -import { pack, publish } from '@pnpm/plugin-commands-publishing' import { patch, patchCommit, patchRemove } from '@pnpm/plugin-commands-patching' +import { pack, publish } from '@pnpm/plugin-commands-publishing' +import { sbom } from '@pnpm/plugin-commands-sbom' import { create, dlx, @@ -28,11 +27,13 @@ import { import { setup } from '@pnpm/plugin-commands-setup' import { store } from '@pnpm/plugin-commands-store' import { catFile, catIndex, findHash } from '@pnpm/plugin-commands-store-inspecting' -import { init } from '@pnpm/plugin-commands-init' +import { runtime } from '@pnpm/runtime.commands' +import { selfUpdate } from '@pnpm/tools.plugin-commands-self-updater' import { pick } from 'ramda' -import type { PnpmOptions } from '../types.js' -import { shorthands as universalShorthands } from '../shorthands.js' + import { parseCliArgs } from '../parseCliArgs.js' +import { shorthands as universalShorthands } from '../shorthands.js' +import type { PnpmOptions } from '../types.js' import * as bin from './bin.js' import * as clean from './clean.js' import { createHelp } from './help.js' @@ -239,4 +240,4 @@ export function getCommandFullName (commandName: string): string | null { (handlerByCommandName[commandName] ? commandName : null) } -export { shorthandsByCommandName, rcOptionsTypes } +export { rcOptionsTypes, shorthandsByCommandName } diff --git a/pnpm/src/cmd/installTest.ts b/pnpm/src/cmd/installTest.ts index 3cb2a8aadd..2a872724d7 100644 --- a/pnpm/src/cmd/installTest.ts +++ b/pnpm/src/cmd/installTest.ts @@ -2,6 +2,7 @@ import { docsUrl } from '@pnpm/cli-utils' import { install } from '@pnpm/plugin-commands-installation' import { run } from '@pnpm/plugin-commands-script-runners' import { renderHelp } from 'render-help' + import type { PnpmOptions } from '../types.js' export const cliOptionsTypes = install.cliOptionsTypes diff --git a/pnpm/src/cmd/recursive.ts b/pnpm/src/cmd/recursive.ts index 5e13289732..6597cb1995 100644 --- a/pnpm/src/cmd/recursive.ts +++ b/pnpm/src/cmd/recursive.ts @@ -1,7 +1,7 @@ import { docsUrl } from '@pnpm/cli-utils' import { FILTERING } from '@pnpm/common-cli-options-help' -import { WANTED_LOCKFILE } from '@pnpm/constants' import { getDefaultWorkspaceConcurrency } from '@pnpm/config' +import { WANTED_LOCKFILE } from '@pnpm/constants' import { renderHelp } from 'render-help' export const rcOptionsTypes = (): Record => ({}) diff --git a/pnpm/src/cmd/root.ts b/pnpm/src/cmd/root.ts index 79e51a4336..fa35b51b68 100644 --- a/pnpm/src/cmd/root.ts +++ b/pnpm/src/cmd/root.ts @@ -1,6 +1,7 @@ import path from 'path' -import { types as allTypes } from '@pnpm/config' + import { docsUrl } from '@pnpm/cli-utils' +import { types as allTypes } from '@pnpm/config' import { pick } from 'ramda' import { renderHelp } from 'render-help' diff --git a/pnpm/src/errorHandler.ts b/pnpm/src/errorHandler.ts index 10722c3a72..b02db93adb 100644 --- a/pnpm/src/errorHandler.ts +++ b/pnpm/src/errorHandler.ts @@ -1,6 +1,8 @@ import { promisify } from 'util' + import { logger } from '@pnpm/logger' import pidTree from 'pidtree' + import { type Global, REPORTER_INITIALIZED } from './main.js' declare const global: Global diff --git a/pnpm/src/main.ts b/pnpm/src/main.ts index beb88c86e7..7b36f6cb50 100644 --- a/pnpm/src/main.ts +++ b/pnpm/src/main.ts @@ -6,8 +6,10 @@ declare const global: Global if (!global['pnpm__startedAt']) { global['pnpm__startedAt'] = Date.now() } -import loudRejection from 'loud-rejection' -import { packageManager, isExecutedByCorepack } from '@pnpm/cli-meta' +import path from 'path' +import { stripVTControlCharacters as stripAnsi } from 'util' + +import { isExecutedByCorepack, packageManager } from '@pnpm/cli-meta' import { getConfig, installConfigDepsAndLoadHooks } from '@pnpm/cli-utils' import type { Config } from '@pnpm/config' import { executionTimeLogger, scopeLogger } from '@pnpm/core-loggers' @@ -18,10 +20,10 @@ import type { ParsedCliArgs } from '@pnpm/parse-cli-args' import type { EngineDependency } from '@pnpm/types' import { finishWorkers } from '@pnpm/worker' import chalk from 'chalk' -import semver from 'semver' -import path from 'path' +import loudRejection from 'loud-rejection' import { isEmpty } from 'ramda' -import { stripVTControlCharacters as stripAnsi } from 'util' +import semver from 'semver' + import { checkForUpdates } from './checkForUpdates.js' import { pnpmCmds, rcOptionsTypes, skipPackageManagerCheckForCommand } from './cmd/index.js' import { formatUnknownOptionsError } from './formatError.js' diff --git a/pnpm/src/parseCliArgs.ts b/pnpm/src/parseCliArgs.ts index d74b1040a0..4c14a3c02c 100644 --- a/pnpm/src/parseCliArgs.ts +++ b/pnpm/src/parseCliArgs.ts @@ -1,4 +1,5 @@ -import { type ParsedCliArgs, parseCliArgs as parseCliArgsLib } from '@pnpm/parse-cli-args' +import { parseCliArgs as parseCliArgsLib, type ParsedCliArgs } from '@pnpm/parse-cli-args' + import { getCliOptionsTypes, getCommandFullName, diff --git a/pnpm/src/reporter/index.ts b/pnpm/src/reporter/index.ts index 4607a798ff..52d0011170 100644 --- a/pnpm/src/reporter/index.ts +++ b/pnpm/src/reporter/index.ts @@ -1,7 +1,8 @@ import type { Config } from '@pnpm/config' -import { initDefaultReporter } from '@pnpm/default-reporter' import type { Log } from '@pnpm/core-loggers' +import { initDefaultReporter } from '@pnpm/default-reporter' import { type LogLevel, type StreamParser, streamParser, writeToConsole } from '@pnpm/logger' + import { silentReporter } from './silentReporter.js' export type ReporterType = 'default' | 'ndjson' | 'silent' | 'append-only' diff --git a/pnpm/src/runNpm.ts b/pnpm/src/runNpm.ts index b221dbe3f0..916aaa8d0e 100644 --- a/pnpm/src/runNpm.ts +++ b/pnpm/src/runNpm.ts @@ -1,5 +1,6 @@ -import path from 'path' import type { SpawnSyncReturns } from 'child_process' +import path from 'path' + import { packageManager } from '@pnpm/cli-meta' import { getConfig, types as allTypes } from '@pnpm/config' import { runNpm as _runNpm } from '@pnpm/run-npm' diff --git a/pnpm/src/switchCliVersion.ts b/pnpm/src/switchCliVersion.ts index 76dfa09567..37d8a4ff25 100644 --- a/pnpm/src/switchCliVersion.ts +++ b/pnpm/src/switchCliVersion.ts @@ -1,11 +1,12 @@ import path from 'path' + import { packageManager } from '@pnpm/cli-meta' import type { Config } from '@pnpm/config' -import { resolvePackageManagerIntegrities, isPackageManagerResolved } from '@pnpm/config.deps-installer' -import { PnpmError } from '@pnpm/error' +import { isPackageManagerResolved, resolvePackageManagerIntegrities } from '@pnpm/config.deps-installer' import { prependDirsToPath } from '@pnpm/env.path' -import { globalWarn } from '@pnpm/logger' +import { PnpmError } from '@pnpm/error' import { readEnvLockfile } from '@pnpm/lockfile.fs' +import { globalWarn } from '@pnpm/logger' import { createStoreController } from '@pnpm/store-connection-manager' import { installPnpmToStore } from '@pnpm/tools.plugin-commands-self-updater' import spawn from 'cross-spawn' diff --git a/pnpm/test/bin.ts b/pnpm/test/bin.ts index 5bb365329b..30ad562600 100644 --- a/pnpm/test/bin.ts +++ b/pnpm/test/bin.ts @@ -1,7 +1,9 @@ import fs from 'fs' import path from 'path' -import PATH_NAME from 'path-name' + import { tempDir } from '@pnpm/prepare' +import PATH_NAME from 'path-name' + import { execPnpmSync } from './utils/index.js' test('pnpm bin', async () => { diff --git a/pnpm/test/clean.ts b/pnpm/test/clean.ts index b8ea0dd507..efccd34b17 100644 --- a/pnpm/test/clean.ts +++ b/pnpm/test/clean.ts @@ -1,7 +1,9 @@ import fs from 'fs' import path from 'path' + import { preparePackages, tempDir } from '@pnpm/prepare' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpmSync } from './utils/index.js' test('pnpm clean removes pnpm entries and packages but preserves non-pnpm hidden files', () => { diff --git a/pnpm/test/cli.ts b/pnpm/test/cli.ts index 721e73a60b..0438716c3d 100644 --- a/pnpm/test/cli.ts +++ b/pnpm/test/cli.ts @@ -1,10 +1,12 @@ import fs from 'fs' import path from 'path' -import PATH_NAME from 'path-name' + import { prepare, prepareEmpty } from '@pnpm/prepare' import { fixtures } from '@pnpm/test-fixtures' import { rimrafSync } from '@zkochan/rimraf' import { safeExeca as execa } from 'execa' +import PATH_NAME from 'path-name' + import { execPnpm, execPnpmSync, diff --git a/pnpm/test/config.ts b/pnpm/test/config.ts index fa456e525f..f1fbd9acbb 100644 --- a/pnpm/test/config.ts +++ b/pnpm/test/config.ts @@ -1,6 +1,8 @@ import fs from 'fs' + import { WANTED_LOCKFILE } from '@pnpm/constants' import { prepare } from '@pnpm/prepare' + import { execPnpmSync } from './utils/index.js' test('read settings from pnpm-workspace.yaml', async () => { diff --git a/pnpm/test/config/get.ts b/pnpm/test/config/get.ts index e583f210f0..6b698349b1 100644 --- a/pnpm/test/config/get.ts +++ b/pnpm/test/config/get.ts @@ -1,8 +1,10 @@ import fs from 'fs' import path from 'path' -import { writeYamlFileSync } from 'write-yaml-file' -import type { WorkspaceManifest } from '@pnpm/workspace.read-manifest' + import { prepare } from '@pnpm/prepare' +import type { WorkspaceManifest } from '@pnpm/workspace.read-manifest' +import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpmSync } from '../utils/index.js' test('pnpm config get reads npm options but ignores other settings from .npmrc', () => { diff --git a/pnpm/test/config/list.ts b/pnpm/test/config/list.ts index c198ebf821..ba498f9c96 100644 --- a/pnpm/test/config/list.ts +++ b/pnpm/test/config/list.ts @@ -1,8 +1,10 @@ import fs from 'fs' import path from 'path' -import { writeYamlFileSync } from 'write-yaml-file' + import type { Config } from '@pnpm/config' import { prepare } from '@pnpm/prepare' +import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpmSync } from '../utils/index.js' test('pnpm config list reads npm options but ignores other settings from .npmrc', () => { diff --git a/pnpm/test/configurationalDependencies.test.ts b/pnpm/test/configurationalDependencies.test.ts index fad9e1a15b..67c3348fd1 100644 --- a/pnpm/test/configurationalDependencies.test.ts +++ b/pnpm/test/configurationalDependencies.test.ts @@ -1,12 +1,14 @@ import fs from 'fs' import path from 'path' + import { readEnvLockfile } from '@pnpm/lockfile.fs' import { prepare } from '@pnpm/prepare' import { getIntegrity } from '@pnpm/registry-mock' +import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { readYamlFileSync } from 'read-yaml-file' import { writeJsonFileSync } from 'write-json-file' import { writeYamlFileSync } from 'write-yaml-file' -import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' + import { execPnpm, execPnpmSync, pnpmBinLocation } from './utils/index.js' test('patch from configuration dependency is applied', async () => { diff --git a/pnpm/test/deploy.ts b/pnpm/test/deploy.ts index 9b04082b7d..41ab79c1bb 100644 --- a/pnpm/test/deploy.ts +++ b/pnpm/test/deploy.ts @@ -1,8 +1,10 @@ import fs from 'fs' import path from 'path' + import { preparePackages } from '@pnpm/prepare' import { loadJsonFileSync } from 'load-json-file' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm } from './utils/index.js' // Covers https://github.com/pnpm/pnpm/issues/9550 diff --git a/pnpm/test/dlx.ts b/pnpm/test/dlx.ts index 379cffbd2b..c844f98bfc 100644 --- a/pnpm/test/dlx.ts +++ b/pnpm/test/dlx.ts @@ -1,12 +1,14 @@ import fs from 'fs' import path from 'path' -import PATH_NAME from 'path-name' + import { getConfig } from '@pnpm/config' -import { prepare, prepareEmpty } from '@pnpm/prepare' import { readModulesManifest } from '@pnpm/modules-yaml' -import { addUser, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { dlx } from '@pnpm/plugin-commands-script-runners' +import { prepare, prepareEmpty } from '@pnpm/prepare' +import { addUser, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import type { BaseManifest } from '@pnpm/types' +import PATH_NAME from 'path-name' + import { execPnpm, execPnpmSync } from './utils/index.js' let registries: Record diff --git a/pnpm/test/errorHandler.test.ts b/pnpm/test/errorHandler.test.ts index 5522a50e70..344e629fd5 100644 --- a/pnpm/test/errorHandler.test.ts +++ b/pnpm/test/errorHandler.test.ts @@ -1,9 +1,10 @@ import { prepare, preparePackages } from '@pnpm/prepare' -import isWindows from 'is-windows' -import getPort from 'get-port' -import { writeYamlFileSync } from 'write-yaml-file' -import { execPnpmSync } from './utils/index.js' import { fixtures } from '@pnpm/test-fixtures' +import getPort from 'get-port' +import isWindows from 'is-windows' +import { writeYamlFileSync } from 'write-yaml-file' + +import { execPnpmSync } from './utils/index.js' import { isPortInUse } from './utils/isPortInUse.js' const f = fixtures(import.meta.dirname) diff --git a/pnpm/test/exec.ts b/pnpm/test/exec.ts index 87d40f146b..7b493251e6 100644 --- a/pnpm/test/exec.ts +++ b/pnpm/test/exec.ts @@ -1,6 +1,8 @@ import fs from 'fs' import path from 'path' + import { prepare } from '@pnpm/prepare' + import { execPnpm, execPnpmSync } from './utils/index.js' test("exec should respect the caller's current working directory", async () => { diff --git a/pnpm/test/filterProd.test.ts b/pnpm/test/filterProd.test.ts index fbfe0907ff..cddce973a1 100644 --- a/pnpm/test/filterProd.test.ts +++ b/pnpm/test/filterProd.test.ts @@ -1,10 +1,11 @@ -import { writeYamlFileSync } from 'write-yaml-file' -import { execPnpm } from './utils/index.js' import { preparePackages, } from '@pnpm/prepare' import { createTestIpcServer } from '@pnpm/test-ipc-server' import type { ProjectManifest } from '@pnpm/types' +import { writeYamlFileSync } from 'write-yaml-file' + +import { execPnpm } from './utils/index.js' test.each([ { message: '--filter should include devDependencies', filter: '--filter', expected: ['project-1', 'project-3', 'project-4'] }, diff --git a/pnpm/test/formatError.test.ts b/pnpm/test/formatError.test.ts index 87b1c5c2ff..f5a2947311 100644 --- a/pnpm/test/formatError.test.ts +++ b/pnpm/test/formatError.test.ts @@ -1,4 +1,5 @@ import { stripVTControlCharacters as stripAnsi } from 'util' + import { formatUnknownOptionsError } from '../src/formatError.js' test('formatUnknownOptionsError()', async () => { diff --git a/pnpm/test/hooks.ts b/pnpm/test/hooks.ts index 561cb16ab4..de9e765b97 100644 --- a/pnpm/test/hooks.ts +++ b/pnpm/test/hooks.ts @@ -1,11 +1,13 @@ import fs from 'fs' import path from 'path' + import { createHash } from '@pnpm/crypto.hash' -import type { PackageManifest } from '@pnpm/types' import { prepare, preparePackages } from '@pnpm/prepare' import { getIntegrity } from '@pnpm/registry-mock' +import type { PackageManifest } from '@pnpm/types' import { loadJsonFileSync } from 'load-json-file' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm, execPnpmSync } from './utils/index.js' test('readPackage hook in single project doesn\'t modify manifest', async () => { diff --git a/pnpm/test/install/global.ts b/pnpm/test/install/global.ts index be435cd0ca..c844ea0f28 100644 --- a/pnpm/test/install/global.ts +++ b/pnpm/test/install/global.ts @@ -1,10 +1,12 @@ -import path from 'path' -import PATH_NAME from 'path-name' import fs from 'fs' +import path from 'path' + +import { GLOBAL_LAYOUT_VERSION } from '@pnpm/constants' import { prepare } from '@pnpm/prepare' import type { ProjectManifest } from '@pnpm/types' import isWindows from 'is-windows' -import { GLOBAL_LAYOUT_VERSION } from '@pnpm/constants' +import PATH_NAME from 'path-name' + import { addDistTag, execPnpm, diff --git a/pnpm/test/install/globalVirtualStore.ts b/pnpm/test/install/globalVirtualStore.ts index c58a994404..5cc5437333 100644 --- a/pnpm/test/install/globalVirtualStore.ts +++ b/pnpm/test/install/globalVirtualStore.ts @@ -1,7 +1,9 @@ import fs from 'fs' import path from 'path' + import { prepare } from '@pnpm/prepare' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm } from '../utils/index.js' test('using a global virtual store', async () => { diff --git a/pnpm/test/install/hoist.ts b/pnpm/test/install/hoist.ts index 1ddd5995f2..a8c70d88fa 100644 --- a/pnpm/test/install/hoist.ts +++ b/pnpm/test/install/hoist.ts @@ -1,5 +1,6 @@ import { prepare, preparePackages } from '@pnpm/prepare' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm } from '../utils/index.js' test('hoist the dependency graph', async () => { diff --git a/pnpm/test/install/hooks.ts b/pnpm/test/install/hooks.ts index fefadb6a12..a24c5f8632 100644 --- a/pnpm/test/install/hooks.ts +++ b/pnpm/test/install/hooks.ts @@ -1,11 +1,13 @@ import fs from 'fs' import path from 'path' + import type { LockfileFile } from '@pnpm/lockfile.types' import { prepare, preparePackages } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' -import { readYamlFileSync } from 'read-yaml-file' import { loadJsonFileSync } from 'load-json-file' +import { readYamlFileSync } from 'read-yaml-file' import { writeYamlFileSync } from 'write-yaml-file' + import { addDistTag, execPnpm, diff --git a/pnpm/test/install/issue-8959.ts b/pnpm/test/install/issue-8959.ts index ece8c6d216..5799845066 100644 --- a/pnpm/test/install/issue-8959.ts +++ b/pnpm/test/install/issue-8959.ts @@ -1,6 +1,8 @@ import fs from 'fs' + import { preparePackages } from '@pnpm/prepare' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm } from '../utils/index.js' // Covers https://github.com/pnpm/pnpm/issues/8959 diff --git a/pnpm/test/install/lifecycleScripts.ts b/pnpm/test/install/lifecycleScripts.ts index 5a1709c84b..c4508a09ef 100644 --- a/pnpm/test/install/lifecycleScripts.ts +++ b/pnpm/test/install/lifecycleScripts.ts @@ -1,12 +1,14 @@ import fs from 'fs' import path from 'path' + import { prepare } from '@pnpm/prepare' import type { PackageManifest, ProjectManifest } from '@pnpm/types' -import PATH from 'path-name' -import { loadJsonFileSync } from 'load-json-file' -import { writeYamlFile } from 'write-yaml-file' -import { execPnpmSync, pnpmBinLocation } from '../utils/index.js' import { readWorkspaceManifest } from '@pnpm/workspace.read-manifest' +import { loadJsonFileSync } from 'load-json-file' +import PATH from 'path-name' +import { writeYamlFile } from 'write-yaml-file' + +import { execPnpmSync, pnpmBinLocation } from '../utils/index.js' const pkgRoot = path.join(import.meta.dirname, '..', '..') const pnpmPkg = loadJsonFileSync(path.join(pkgRoot, 'package.json')) diff --git a/pnpm/test/install/misc.ts b/pnpm/test/install/misc.ts index a8504cee9c..2efac5350f 100644 --- a/pnpm/test/install/misc.ts +++ b/pnpm/test/install/misc.ts @@ -1,5 +1,6 @@ import fs from 'fs' import path from 'path' + import { STORE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' import type { LockfileObject } from '@pnpm/lockfile.types' import { prepare, prepareEmpty, preparePackages } from '@pnpm/prepare' @@ -8,15 +9,16 @@ import { readProjectManifest } from '@pnpm/read-project-manifest' import { getIntegrity } from '@pnpm/registry-mock' import type { PackageFilesIndex } from '@pnpm/store.cafs' import { StoreIndex, storeIndexKey } from '@pnpm/store.index' +import { fixtures } from '@pnpm/test-fixtures' import { lexCompare } from '@pnpm/util.lex-comparator' import { writeProjectManifest } from '@pnpm/write-project-manifest' -import { fixtures } from '@pnpm/test-fixtures' -import { dirIsCaseSensitive } from 'dir-is-case-sensitive' -import { readYamlFileSync } from 'read-yaml-file' import { rimrafSync } from '@zkochan/rimraf' -import isWindows from 'is-windows' -import { writeYamlFileSync } from 'write-yaml-file' import crossSpawn from 'cross-spawn' +import { dirIsCaseSensitive } from 'dir-is-case-sensitive' +import isWindows from 'is-windows' +import { readYamlFileSync } from 'read-yaml-file' +import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm, execPnpmSync, diff --git a/pnpm/test/install/nodeRuntime.ts b/pnpm/test/install/nodeRuntime.ts index 881900b29a..d2ad0b62d6 100644 --- a/pnpm/test/install/nodeRuntime.ts +++ b/pnpm/test/install/nodeRuntime.ts @@ -1,5 +1,7 @@ import fs from 'fs' + import { prepare } from '@pnpm/prepare' + import { execPnpm } from '../utils/index.js' test('installing a CLI tool that requires a specific version of Node.js to be installed alongside it', async () => { diff --git a/pnpm/test/install/only.ts b/pnpm/test/install/only.ts index 3081d5ef33..b679c58a0b 100644 --- a/pnpm/test/install/only.ts +++ b/pnpm/test/install/only.ts @@ -1,7 +1,9 @@ import path from 'path' + import { prepare } from '@pnpm/prepare' import type { PackageManifest } from '@pnpm/types' import { loadJsonFileSync } from 'load-json-file' + import { execPnpm } from '../utils/index.js' const basicPackageManifest = loadJsonFileSync(path.join(import.meta.dirname, '../utils/simple-package.json')) diff --git a/pnpm/test/install/optional.ts b/pnpm/test/install/optional.ts index a92e60da70..73f2811be8 100644 --- a/pnpm/test/install/optional.ts +++ b/pnpm/test/install/optional.ts @@ -1,5 +1,6 @@ import { prepare } from '@pnpm/prepare' import deepRequireCwd from 'deep-require-cwd' + import { execPnpm } from '../utils/index.js' test('installing optional dependencies when --no-optional is not used', async () => { diff --git a/pnpm/test/install/preferOffline.ts b/pnpm/test/install/preferOffline.ts index cf5a5ea439..a319bcef7d 100644 --- a/pnpm/test/install/preferOffline.ts +++ b/pnpm/test/install/preferOffline.ts @@ -1,6 +1,7 @@ import { WANTED_LOCKFILE } from '@pnpm/constants' import { prepare } from '@pnpm/prepare' import { rimrafSync } from '@zkochan/rimraf' + import { addDistTag, execPnpm, diff --git a/pnpm/test/install/selfUpdate.ts b/pnpm/test/install/selfUpdate.ts index 67d4e18fc7..a75254928b 100644 --- a/pnpm/test/install/selfUpdate.ts +++ b/pnpm/test/install/selfUpdate.ts @@ -1,9 +1,11 @@ import fs from 'fs' import path from 'path' -import PATH_NAME from 'path-name' + import { prepare } from '@pnpm/prepare' import type { ProjectManifest } from '@pnpm/types' import { loadJsonFileSync } from 'load-json-file' +import PATH_NAME from 'path-name' + import { execPnpm, execPnpmSync } from '../utils/index.js' test('self-update updates the packageManager field in package.json', async () => { diff --git a/pnpm/test/install/sideEffects.ts b/pnpm/test/install/sideEffects.ts index 5f57981f3c..fd3d5a162b 100644 --- a/pnpm/test/install/sideEffects.ts +++ b/pnpm/test/install/sideEffects.ts @@ -1,8 +1,10 @@ import fs from 'fs' import path from 'path' + import { prepare } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { rimrafSync } from '@zkochan/rimraf' + import { execPnpm } from '../utils/index.js' const ENGINE_DIR = `${process.platform}-${process.arch}-node-${process.version.split('.')[0]}` diff --git a/pnpm/test/install/supportedArchitectures.ts b/pnpm/test/install/supportedArchitectures.ts index 1732254de0..0eb54f9d1d 100644 --- a/pnpm/test/install/supportedArchitectures.ts +++ b/pnpm/test/install/supportedArchitectures.ts @@ -1,8 +1,10 @@ import fs from 'fs' -import { prepare, prepareEmpty } from '@pnpm/prepare' + import { readModulesManifest } from '@pnpm/modules-yaml' +import { prepare, prepareEmpty } from '@pnpm/prepare' import type { WorkspaceManifest } from '@pnpm/workspace.read-manifest' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm } from '../utils/index.js' const describeOnLinuxOnly = process.platform === 'linux' ? describe : describe.skip diff --git a/pnpm/test/install/yesFlag.ts b/pnpm/test/install/yesFlag.ts index 0bfec1de08..22ed1f029d 100644 --- a/pnpm/test/install/yesFlag.ts +++ b/pnpm/test/install/yesFlag.ts @@ -1,10 +1,12 @@ import fs from 'fs' import path from 'path' + import { prepare } from '@pnpm/prepare' import type { PackageManifest } from '@pnpm/types' import { loadJsonFileSync } from 'load-json-file' -import { execPnpmSync } from '../utils/index.js' + import type { ExecPnpmSyncOpts } from '../utils/execPnpm.js' +import { execPnpmSync } from '../utils/index.js' const basicPackageManifest = loadJsonFileSync(path.join(import.meta.dirname, '../utils/simple-package.json')) diff --git a/pnpm/test/list.ts b/pnpm/test/list.ts index cc4730f89a..b62785ef62 100644 --- a/pnpm/test/list.ts +++ b/pnpm/test/list.ts @@ -1,7 +1,9 @@ import fs from 'fs' import path from 'path' + import { prepare, preparePackages } from '@pnpm/prepare' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm, execPnpmSync } from './utils/index.js' test('ls --filter=not-exist --json should prints an empty array (#9672)', async () => { diff --git a/pnpm/test/monorepo/dedupePeers.test.ts b/pnpm/test/monorepo/dedupePeers.test.ts index 6789ba1b56..5954c5468d 100644 --- a/pnpm/test/monorepo/dedupePeers.test.ts +++ b/pnpm/test/monorepo/dedupePeers.test.ts @@ -1,12 +1,14 @@ import path from 'path' + import { WANTED_LOCKFILE } from '@pnpm/constants' +import { createPeerDepGraphHash } from '@pnpm/dependency-path' import type { LockfileFile } from '@pnpm/lockfile.types' import { preparePackages } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' -import { readYamlFileSync } from 'read-yaml-file' -import { createPeerDepGraphHash } from '@pnpm/dependency-path' import { loadJsonFileSync } from 'load-json-file' +import { readYamlFileSync } from 'read-yaml-file' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm } from '../utils/index.js' test('deduplicate packages that have peers, when adding new dependency in a workspace', async () => { diff --git a/pnpm/test/monorepo/index.ts b/pnpm/test/monorepo/index.ts index f55d05b589..265fe30f33 100644 --- a/pnpm/test/monorepo/index.ts +++ b/pnpm/test/monorepo/index.ts @@ -1,10 +1,9 @@ // cspell:ignore buildscript import fs from 'fs' import path from 'path' + import type { Config } from '@pnpm/config' import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' -import type { WorkspaceManifest } from '@pnpm/workspace.read-manifest' -import { findWorkspacePackages } from '@pnpm/workspace.find-packages' import type { LockfileFile } from '@pnpm/lockfile.types' import { readModulesManifest } from '@pnpm/modules-yaml' import { @@ -14,16 +13,19 @@ import { tempDir as makeTempDir, } from '@pnpm/prepare' import { readPackageJsonFromDir } from '@pnpm/read-package-json' -import { readYamlFileSync } from 'read-yaml-file' -import { safeExeca as execa } from 'execa' -import { rimrafSync } from '@zkochan/rimraf' -import { temporaryDirectory } from 'tempy' -import symlink from 'symlink-dir' -import { writeYamlFileSync } from 'write-yaml-file' -import { execPnpm, execPnpmSync } from '../utils/index.js' import { addDistTag } from '@pnpm/registry-mock' import { createTestIpcServer } from '@pnpm/test-ipc-server' import type { ProjectManifest } from '@pnpm/types' +import { findWorkspacePackages } from '@pnpm/workspace.find-packages' +import type { WorkspaceManifest } from '@pnpm/workspace.read-manifest' +import { rimrafSync } from '@zkochan/rimraf' +import { safeExeca as execa } from 'execa' +import { readYamlFileSync } from 'read-yaml-file' +import symlink from 'symlink-dir' +import { temporaryDirectory } from 'tempy' +import { writeYamlFileSync } from 'write-yaml-file' + +import { execPnpm, execPnpmSync } from '../utils/index.js' test('no projects matched the filters', async () => { preparePackages([ diff --git a/pnpm/test/monorepo/peerDependencies.ts b/pnpm/test/monorepo/peerDependencies.ts index 91575b4568..bbb97afb9e 100644 --- a/pnpm/test/monorepo/peerDependencies.ts +++ b/pnpm/test/monorepo/peerDependencies.ts @@ -3,6 +3,7 @@ import type { LockfileFile } from '@pnpm/lockfile.types' import { preparePackages } from '@pnpm/prepare' import { readYamlFileSync } from 'read-yaml-file' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm } from '../utils/index.js' // Covers https://github.com/pnpm/pnpm/issues/6272 diff --git a/pnpm/test/packageManagerCheck.test.ts b/pnpm/test/packageManagerCheck.test.ts index 1967f77dc8..85e2a6aa3f 100644 --- a/pnpm/test/packageManagerCheck.test.ts +++ b/pnpm/test/packageManagerCheck.test.ts @@ -1,4 +1,5 @@ import { prepare } from '@pnpm/prepare' + import { execPnpmSync } from './utils/index.js' test('install should fail if the used pnpm version does not satisfy the pnpm version specified in engines', async () => { diff --git a/pnpm/test/patch/allowUnusedPatches.ts b/pnpm/test/patch/allowUnusedPatches.ts index acd30a0cfa..0aeb1a0578 100644 --- a/pnpm/test/patch/allowUnusedPatches.ts +++ b/pnpm/test/patch/allowUnusedPatches.ts @@ -1,6 +1,7 @@ import { preparePackages } from '@pnpm/prepare' import { fixtures } from '@pnpm/test-fixtures' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpmSync } from '../utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/pnpm/test/recursive/filter.ts b/pnpm/test/recursive/filter.ts index 3d979eeb27..46bf621b13 100644 --- a/pnpm/test/recursive/filter.ts +++ b/pnpm/test/recursive/filter.ts @@ -1,5 +1,7 @@ import fs from 'fs' + import { prepare } from '@pnpm/prepare' + import { execPnpmSync } from '../utils/index.js' test('pnpm --filter add should work', async () => { diff --git a/pnpm/test/recursive/misc.ts b/pnpm/test/recursive/misc.ts index 5b7884f491..d74d52c0ab 100644 --- a/pnpm/test/recursive/misc.ts +++ b/pnpm/test/recursive/misc.ts @@ -1,13 +1,15 @@ import fs from 'fs' import path from 'path' + import type { Config } from '@pnpm/config' +import type { LockfileFile } from '@pnpm/lockfile.types' import { preparePackages } from '@pnpm/prepare' import type { WorkspaceManifest } from '@pnpm/workspace.read-manifest' -import type { LockfileFile } from '@pnpm/lockfile.types' -import { readYamlFileSync } from 'read-yaml-file' import { isCI } from 'ci-info' import isWindows from 'is-windows' +import { readYamlFileSync } from 'read-yaml-file' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm, execPnpmSync, diff --git a/pnpm/test/recursive/rebuild.ts b/pnpm/test/recursive/rebuild.ts index ec9c389e03..07baa97e96 100644 --- a/pnpm/test/recursive/rebuild.ts +++ b/pnpm/test/recursive/rebuild.ts @@ -1,4 +1,5 @@ import { preparePackages } from '@pnpm/prepare' + import { execPnpm } from '../utils/index.js' test('`pnpm recursive rebuild` specific dependencies', async () => { diff --git a/pnpm/test/recursive/run.ts b/pnpm/test/recursive/run.ts index eb418604cf..c828dd0e9b 100644 --- a/pnpm/test/recursive/run.ts +++ b/pnpm/test/recursive/run.ts @@ -1,6 +1,7 @@ import { preparePackages } from '@pnpm/prepare' import { createTestIpcServer } from '@pnpm/test-ipc-server' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm } from '../utils/index.js' test('pnpm recursive run finds bins from the root of the workspace', async () => { diff --git a/pnpm/test/recursive/update.ts b/pnpm/test/recursive/update.ts index e777a95bac..a08e286533 100644 --- a/pnpm/test/recursive/update.ts +++ b/pnpm/test/recursive/update.ts @@ -1,9 +1,11 @@ import path from 'path' -import { writeYamlFileSync } from 'write-yaml-file' + import type { Config } from '@pnpm/config' import { preparePackages } from '@pnpm/prepare' -import type { WorkspaceManifest } from '@pnpm/workspace.read-manifest' import { addDistTag } from '@pnpm/registry-mock' +import type { WorkspaceManifest } from '@pnpm/workspace.read-manifest' +import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm } from '../utils/index.js' // TODO: This should work if the settings are passed through CLI diff --git a/pnpm/test/root.ts b/pnpm/test/root.ts index d555799c87..10395db427 100644 --- a/pnpm/test/root.ts +++ b/pnpm/test/root.ts @@ -1,8 +1,10 @@ import fs from 'fs' import path from 'path' -import PATH_NAME from 'path-name' + import { GLOBAL_LAYOUT_VERSION } from '@pnpm/constants' import { tempDir } from '@pnpm/prepare' +import PATH_NAME from 'path-name' + import { execPnpmSync } from './utils/index.js' test('pnpm root', async () => { diff --git a/pnpm/test/run.ts b/pnpm/test/run.ts index 8a7d143d4b..3bd9d31701 100644 --- a/pnpm/test/run.ts +++ b/pnpm/test/run.ts @@ -1,8 +1,10 @@ import fs from 'fs' import path from 'path' + import { prepare, preparePackages } from '@pnpm/prepare' import isWindows from 'is-windows' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm, execPnpmSync } from './utils/index.js' const RECORD_ARGS_FILE = 'require(\'fs\').writeFileSync(\'args.json\', JSON.stringify(require(\'./args.json\').concat([process.argv.slice(2)])), \'utf8\')' diff --git a/pnpm/test/saveCatalog.ts b/pnpm/test/saveCatalog.ts index 4e62c1962f..2fdca6df55 100644 --- a/pnpm/test/saveCatalog.ts +++ b/pnpm/test/saveCatalog.ts @@ -5,6 +5,7 @@ import type { ProjectManifest } from '@pnpm/types' import { loadJsonFileSync } from 'load-json-file' import { readYamlFileSync } from 'read-yaml-file' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm } from './utils/index.js' test('--save-catalog adds catalogs to the manifest of a single package workspace', async () => { diff --git a/pnpm/test/sbom.ts b/pnpm/test/sbom.ts index 371215730f..34353d1bae 100644 --- a/pnpm/test/sbom.ts +++ b/pnpm/test/sbom.ts @@ -1,4 +1,5 @@ import { prepare } from '@pnpm/prepare' + import { execPnpm, execPnpmSync } from './utils/index.js' test('pnpm sbom --sbom-format cyclonedx outputs valid JSON to stdout', async () => { diff --git a/pnpm/test/switchingVersions.test.ts b/pnpm/test/switchingVersions.test.ts index 9103b579d7..3607d260a8 100644 --- a/pnpm/test/switchingVersions.test.ts +++ b/pnpm/test/switchingVersions.test.ts @@ -1,10 +1,12 @@ -import path from 'path' import fs from 'fs' +import path from 'path' + import { prepare } from '@pnpm/prepare' +import isWindows from 'is-windows' import { writeJsonFileSync } from 'write-json-file' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpmSync } from './utils/index.js' -import isWindows from 'is-windows' test('switch to the pnpm version specified in the packageManager field of package.json', async () => { prepare() diff --git a/pnpm/test/syncInjectedDepsAfterScripts-bin.ts b/pnpm/test/syncInjectedDepsAfterScripts-bin.ts index 458523ed65..417e7ed994 100644 --- a/pnpm/test/syncInjectedDepsAfterScripts-bin.ts +++ b/pnpm/test/syncInjectedDepsAfterScripts-bin.ts @@ -1,6 +1,8 @@ import fs from 'fs' + import { preparePackages } from '@pnpm/prepare' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm } from './utils/index.js' test('sync bin links after build script', async () => { diff --git a/pnpm/test/syncInjectedDepsAfterScripts.ts b/pnpm/test/syncInjectedDepsAfterScripts.ts index 44ea00a7b5..c2bdad187e 100644 --- a/pnpm/test/syncInjectedDepsAfterScripts.ts +++ b/pnpm/test/syncInjectedDepsAfterScripts.ts @@ -1,8 +1,10 @@ import fs from 'fs' import path from 'path' + import { preparePackages } from '@pnpm/prepare' import { fixtures } from '@pnpm/test-fixtures' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm } from './utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/pnpm/test/uninstall.ts b/pnpm/test/uninstall.ts index 297d527bc6..e9d4a79a40 100644 --- a/pnpm/test/uninstall.ts +++ b/pnpm/test/uninstall.ts @@ -1,8 +1,10 @@ import fs from 'fs' import path from 'path' -import { readPackageJsonFromDir } from '@pnpm/read-package-json' + import { prepare } from '@pnpm/prepare' +import { readPackageJsonFromDir } from '@pnpm/read-package-json' import PATH from 'path-name' + import { execPnpm } from './utils/index.js' test('uninstall package and remove from appropriate property', async () => { diff --git a/pnpm/test/update.ts b/pnpm/test/update.ts index 94200b84f1..a1af1e06a3 100644 --- a/pnpm/test/update.ts +++ b/pnpm/test/update.ts @@ -1,8 +1,10 @@ import path from 'path' + import { prepare, preparePackages } from '@pnpm/prepare' import { readPackageJsonFromDir } from '@pnpm/read-package-json' import { readYamlFileSync } from 'read-yaml-file' import { writeYamlFileSync } from 'write-yaml-file' + import { addDistTag, execPnpm, diff --git a/pnpm/test/utils/execPnpm.ts b/pnpm/test/utils/execPnpm.ts index 59d677095c..733ec01879 100644 --- a/pnpm/test/utils/execPnpm.ts +++ b/pnpm/test/utils/execPnpm.ts @@ -1,9 +1,10 @@ import type { ChildProcess as NodeChildProcess, StdioOptions } from 'child_process' import path from 'path' -import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' + import type { Config } from '@pnpm/config' -import isWindows from 'is-windows' +import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import crossSpawn from 'cross-spawn' +import isWindows from 'is-windows' import { readYamlFileSync } from 'read-yaml-file' export const binDir = path.join(import.meta.dirname, '../..', isWindows() ? 'dist' : 'bin') diff --git a/pnpm/test/utils/index.ts b/pnpm/test/utils/index.ts index 4d8e4c2652..baaf1db46e 100644 --- a/pnpm/test/utils/index.ts +++ b/pnpm/test/utils/index.ts @@ -14,16 +14,16 @@ import { pathToLocalPkg } from './localPkg.js' import testDefaults from './testDefaults.js' export { - pathToLocalPkg, - testDefaults, + addDistTag, binDir, execPnpm, execPnpmSync, execPnpx, execPnpxSync, + pathToLocalPkg, pnpmBinLocation, pnpxBinLocation, spawnPnpm, spawnPnpx, - addDistTag, + testDefaults, } diff --git a/pnpm/test/utils/testDefaults.ts b/pnpm/test/utils/testDefaults.ts index 687af2a380..06780252d9 100644 --- a/pnpm/test/utils/testDefaults.ts +++ b/pnpm/test/utils/testDefaults.ts @@ -1,4 +1,5 @@ import path from 'path' + import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' export default function testDefaults (opts?: any): any & { storeDir: string } { // eslint-disable-line diff --git a/pnpm/test/verifyDepsBeforeRun/exec.ts b/pnpm/test/verifyDepsBeforeRun/exec.ts index 54d557ed2e..0e7b9a4717 100644 --- a/pnpm/test/verifyDepsBeforeRun/exec.ts +++ b/pnpm/test/verifyDepsBeforeRun/exec.ts @@ -1,9 +1,11 @@ import fs from 'fs' import path from 'path' + import { prepare, preparePackages } from '@pnpm/prepare' import type { ProjectManifest } from '@pnpm/types' import { loadWorkspaceState } from '@pnpm/workspace.state' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm, execPnpmSync } from '../utils/index.js' const CONFIG = ['--config.verify-deps-before-run=error'] as const diff --git a/pnpm/test/verifyDepsBeforeRun/install.ts b/pnpm/test/verifyDepsBeforeRun/install.ts index 4938dbeb40..041ccefdd7 100644 --- a/pnpm/test/verifyDepsBeforeRun/install.ts +++ b/pnpm/test/verifyDepsBeforeRun/install.ts @@ -1,7 +1,9 @@ import fs from 'fs' + import { prepare } from '@pnpm/prepare' import type { ProjectManifest } from '@pnpm/types' import { loadWorkspaceState } from '@pnpm/workspace.state' + import { execPnpm, execPnpmSync } from '../utils/index.js' const CONFIG = [ diff --git a/pnpm/test/verifyDepsBeforeRun/issue-9424.ts b/pnpm/test/verifyDepsBeforeRun/issue-9424.ts index 44af9f99c3..d1492fd2ed 100644 --- a/pnpm/test/verifyDepsBeforeRun/issue-9424.ts +++ b/pnpm/test/verifyDepsBeforeRun/issue-9424.ts @@ -1,9 +1,11 @@ import fs from 'fs' import path from 'path' + import { preparePackages } from '@pnpm/prepare' import type { ProjectManifest } from '@pnpm/types' -import { type WorkspaceState, loadWorkspaceState } from '@pnpm/workspace.state' +import { loadWorkspaceState, type WorkspaceState } from '@pnpm/workspace.state' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm, execPnpmSync } from '../utils/index.js' test('hoisted node linker and node_modules not exist (#9424)', async () => { diff --git a/pnpm/test/verifyDepsBeforeRun/multiProjectWorkspace.ts b/pnpm/test/verifyDepsBeforeRun/multiProjectWorkspace.ts index 683d3a6b26..a1249cf1f0 100644 --- a/pnpm/test/verifyDepsBeforeRun/multiProjectWorkspace.ts +++ b/pnpm/test/verifyDepsBeforeRun/multiProjectWorkspace.ts @@ -1,9 +1,11 @@ import fs from 'fs' import path from 'path' + import { preparePackages } from '@pnpm/prepare' import type { ProjectManifest } from '@pnpm/types' import { loadWorkspaceState } from '@pnpm/workspace.state' import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm, execPnpmSync, pnpmBinLocation } from '../utils/index.js' const CONFIG = ['--config.verify-deps-before-run=error'] as const diff --git a/pnpm/test/verifyDepsBeforeRun/singleProjectWorkspace.ts b/pnpm/test/verifyDepsBeforeRun/singleProjectWorkspace.ts index c245ce5a27..1126db73f2 100644 --- a/pnpm/test/verifyDepsBeforeRun/singleProjectWorkspace.ts +++ b/pnpm/test/verifyDepsBeforeRun/singleProjectWorkspace.ts @@ -1,9 +1,11 @@ import fs from 'fs' import path from 'path' -import { writeYamlFileSync } from 'write-yaml-file' + import { prepare } from '@pnpm/prepare' import type { ProjectManifest } from '@pnpm/types' import { loadWorkspaceState } from '@pnpm/workspace.state' +import { writeYamlFileSync } from 'write-yaml-file' + import { execPnpm, execPnpmSync, pnpmBinLocation } from '../utils/index.js' const CONFIG = ['--config.verify-deps-before-run=error'] as const diff --git a/releasing/plugin-commands-deploy/src/createDeployFiles.ts b/releasing/plugin-commands-deploy/src/createDeployFiles.ts index 2a19cc8db0..6bc50cf552 100644 --- a/releasing/plugin-commands-deploy/src/createDeployFiles.ts +++ b/releasing/plugin-commands-deploy/src/createDeployFiles.ts @@ -1,6 +1,6 @@ import path from 'path' import url from 'url' -import normalizePath from 'normalize-path' + import * as dp from '@pnpm/dependency-path' import type { DirectoryResolution, @@ -18,6 +18,7 @@ import type { ProjectId, ProjectManifest, } from '@pnpm/types' +import normalizePath from 'normalize-path' const DEPENDENCIES_FIELD = ['dependencies', 'devDependencies', 'optionalDependencies'] as const satisfies DependenciesField[] diff --git a/releasing/plugin-commands-deploy/src/deploy.ts b/releasing/plugin-commands-deploy/src/deploy.ts index cfdd12d180..394bf7d4a5 100644 --- a/releasing/plugin-commands-deploy/src/deploy.ts +++ b/releasing/plugin-commands-deploy/src/deploy.ts @@ -1,23 +1,25 @@ import fs from 'fs' import path from 'path' -import { pick } from 'ramda' + import { docsUrl } from '@pnpm/cli-utils' +import { FILTERING } from '@pnpm/common-cli-options-help' import { type Config, types as configTypes } from '@pnpm/config' import { WORKSPACE_MANIFEST_FILENAME } from '@pnpm/constants' import { fetchFromDir } from '@pnpm/directory-fetcher' +import { PnpmError } from '@pnpm/error' import { createIndexedPkgImporter } from '@pnpm/fs.indexed-pkg-importer' import { isEmptyDirOrNothing } from '@pnpm/fs.is-empty-dir-or-nothing' -import { install } from '@pnpm/plugin-commands-installation' -import { FILTERING } from '@pnpm/common-cli-options-help' -import { PnpmError } from '@pnpm/error' import { getLockfileImporterId, readWantedLockfile, writeWantedLockfile } from '@pnpm/lockfile.fs' +import { globalWarn, logger } from '@pnpm/logger' +import { install } from '@pnpm/plugin-commands-installation' +import type { Project } from '@pnpm/types' import { rimraf } from '@zkochan/rimraf' +import { pick } from 'ramda' import { renderHelp } from 'render-help' import { writeYamlFile } from 'write-yaml-file' -import { deployHook } from './deployHook.js' -import { logger, globalWarn } from '@pnpm/logger' -import type { Project } from '@pnpm/types' + import { createDeployFiles } from './createDeployFiles.js' +import { deployHook } from './deployHook.js' const FORCE_LEGACY_DEPLOY = 'force-legacy-deploy' satisfies keyof typeof configTypes diff --git a/releasing/plugin-commands-deploy/test/deploy.test.ts b/releasing/plugin-commands-deploy/test/deploy.test.ts index 5e1f0b81d3..71b3265d40 100644 --- a/releasing/plugin-commands-deploy/test/deploy.test.ts +++ b/releasing/plugin-commands-deploy/test/deploy.test.ts @@ -1,11 +1,13 @@ import fs from 'fs' import path from 'path' + +import { jest } from '@jest/globals' import { assertProject } from '@pnpm/assert-project' +import { install } from '@pnpm/plugin-commands-installation' import { preparePackages } from '@pnpm/prepare' import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' -import { jest } from '@jest/globals' + import { DEFAULT_OPTS } from './utils/index.js' -import { install } from '@pnpm/plugin-commands-installation' const original = await import('@pnpm/logger') const warn = jest.fn() diff --git a/releasing/plugin-commands-deploy/test/shared-lockfile.test.ts b/releasing/plugin-commands-deploy/test/shared-lockfile.test.ts index f8e4df0611..0c2b10037a 100644 --- a/releasing/plugin-commands-deploy/test/shared-lockfile.test.ts +++ b/releasing/plugin-commands-deploy/test/shared-lockfile.test.ts @@ -1,15 +1,17 @@ import fs from 'fs' import path from 'path' import url from 'url' -import { install } from '@pnpm/plugin-commands-installation' + +import { jest } from '@jest/globals' import { assertProject } from '@pnpm/assert-project' -import { preparePackages } from '@pnpm/prepare' import type { LockfileFile, LockfilePackageSnapshot } from '@pnpm/lockfile.types' -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' +import { install } from '@pnpm/plugin-commands-installation' +import { preparePackages } from '@pnpm/prepare' import { fixtures } from '@pnpm/test-fixtures' import type { ProjectManifest } from '@pnpm/types' -import { jest } from '@jest/globals' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { writeYamlFile } from 'write-yaml-file' + import { DEFAULT_OPTS } from './utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/releasing/plugin-commands-publishing/src/FailedToPublishError.ts b/releasing/plugin-commands-publishing/src/FailedToPublishError.ts index dc06612d87..c3e461cec8 100644 --- a/releasing/plugin-commands-publishing/src/FailedToPublishError.ts +++ b/releasing/plugin-commands-publishing/src/FailedToPublishError.ts @@ -1,4 +1,5 @@ import { PnpmError } from '@pnpm/error' + import type { PackResult } from './pack.js' interface PublishErrorProperties { diff --git a/releasing/plugin-commands-publishing/src/extractManifestFromPacked.ts b/releasing/plugin-commands-publishing/src/extractManifestFromPacked.ts index 373737005b..502ff9a21f 100644 --- a/releasing/plugin-commands-publishing/src/extractManifestFromPacked.ts +++ b/releasing/plugin-commands-publishing/src/extractManifestFromPacked.ts @@ -1,9 +1,10 @@ import fs from 'fs' -import { createGunzip } from 'zlib' import path from 'path' -import tar from 'tar-stream' +import { createGunzip } from 'zlib' + import { PnpmError } from '@pnpm/error' import type { ExportedManifest } from '@pnpm/exportable-manifest' +import tar from 'tar-stream' const TARBALL_SUFFIXES = ['.tar.gz', '.tgz'] as const diff --git a/releasing/plugin-commands-publishing/src/oidc/authToken.ts b/releasing/plugin-commands-publishing/src/oidc/authToken.ts index 83a7a62e98..6675be7515 100644 --- a/releasing/plugin-commands-publishing/src/oidc/authToken.ts +++ b/releasing/plugin-commands-publishing/src/oidc/authToken.ts @@ -1,4 +1,5 @@ import { PnpmError } from '@pnpm/error' + import { displayError } from '../displayError.js' import type { PublishPackedPkgOptions } from '../publishPackedPkg.js' import { SHARED_CONTEXT } from './utils/shared-context.js' diff --git a/releasing/plugin-commands-publishing/src/oidc/idToken.ts b/releasing/plugin-commands-publishing/src/oidc/idToken.ts index 17975b8167..513d651479 100644 --- a/releasing/plugin-commands-publishing/src/oidc/idToken.ts +++ b/releasing/plugin-commands-publishing/src/oidc/idToken.ts @@ -1,4 +1,5 @@ import { PnpmError } from '@pnpm/error' + import { displayError } from '../displayError.js' import type { PublishPackedPkgOptions } from '../publishPackedPkg.js' import { SHARED_CONTEXT } from './utils/shared-context.js' diff --git a/releasing/plugin-commands-publishing/src/oidc/provenance.ts b/releasing/plugin-commands-publishing/src/oidc/provenance.ts index 96d0992b66..d42d7c65f8 100644 --- a/releasing/plugin-commands-publishing/src/oidc/provenance.ts +++ b/releasing/plugin-commands-publishing/src/oidc/provenance.ts @@ -1,4 +1,5 @@ import { PnpmError } from '@pnpm/error' + import type { PublishPackedPkgOptions } from '../publishPackedPkg.js' import { SHARED_CONTEXT } from './utils/shared-context.js' diff --git a/releasing/plugin-commands-publishing/src/oidc/utils/shared-context.ts b/releasing/plugin-commands-publishing/src/oidc/utils/shared-context.ts index 6890db65a8..266658e5d0 100644 --- a/releasing/plugin-commands-publishing/src/oidc/utils/shared-context.ts +++ b/releasing/plugin-commands-publishing/src/oidc/utils/shared-context.ts @@ -1,6 +1,7 @@ -import ciInfo from 'ci-info' import { fetch } from '@pnpm/fetch' import { globalInfo } from '@pnpm/logger' +import ciInfo from 'ci-info' + import type { AuthTokenContext } from '../authToken.js' import type { IdTokenContext } from '../idToken.js' import type { ProvenanceContext } from '../provenance.js' diff --git a/releasing/plugin-commands-publishing/src/pack.ts b/releasing/plugin-commands-publishing/src/pack.ts index ab2b135976..853cf7f0f4 100644 --- a/releasing/plugin-commands-publishing/src/pack.ts +++ b/releasing/plugin-commands-publishing/src/pack.ts @@ -1,27 +1,29 @@ import fs from 'fs' import path from 'path' import { createGzip } from 'zlib' + import type { Catalogs } from '@pnpm/catalogs.types' -import { PnpmError } from '@pnpm/error' -import { types as allTypes, type UniversalOptions, type Config, getWorkspaceConcurrency, getDefaultWorkspaceConcurrency } from '@pnpm/config' import { readProjectManifest } from '@pnpm/cli-utils' -import { type ExportedManifest, createExportableManifest } from '@pnpm/exportable-manifest' +import { FILTERING } from '@pnpm/common-cli-options-help' +import { type Config, getDefaultWorkspaceConcurrency, getWorkspaceConcurrency, types as allTypes, type UniversalOptions } from '@pnpm/config' +import { PnpmError } from '@pnpm/error' +import { createExportableManifest, type ExportedManifest } from '@pnpm/exportable-manifest' import { packlist } from '@pnpm/fs.packlist' +import { logger } from '@pnpm/logger' import { getBinsFromPackageManifest } from '@pnpm/package-bins' import type { Hooks } from '@pnpm/pnpmfile' -import type { ProjectManifest, Project, ProjectRootDir, ProjectsGraph, DependencyManifest } from '@pnpm/types' -import { glob } from 'tinyglobby' +import { sortPackages } from '@pnpm/sort-packages' +import type { DependencyManifest, Project, ProjectManifest, ProjectRootDir, ProjectsGraph } from '@pnpm/types' +import chalk from 'chalk' +import pLimit from 'p-limit' import { pick } from 'ramda' import { realpathMissing } from 'realpath-missing' import { renderHelp } from 'render-help' import tar from 'tar-stream' -import { runScriptsIfPresent } from './publish.js' -import chalk from 'chalk' +import { glob } from 'tinyglobby' import validateNpmPackageName from 'validate-npm-package-name' -import pLimit from 'p-limit' -import { FILTERING } from '@pnpm/common-cli-options-help' -import { sortPackages } from '@pnpm/sort-packages' -import { logger } from '@pnpm/logger' + +import { runScriptsIfPresent } from './publish.js' const LICENSE_GLOB = 'LICEN{S,C}E{,.*}' // cspell:disable-line diff --git a/releasing/plugin-commands-publishing/src/publish.ts b/releasing/plugin-commands-publishing/src/publish.ts index 4783d0e227..c233aeb051 100644 --- a/releasing/plugin-commands-publishing/src/publish.ts +++ b/releasing/plugin-commands-publishing/src/publish.ts @@ -1,22 +1,24 @@ import path from 'path' + import { docsUrl, readProjectManifest } from '@pnpm/cli-utils' import { FILTERING } from '@pnpm/common-cli-options-help' import { type Config, types as allTypes } from '@pnpm/config' import { PnpmError } from '@pnpm/error' +import { getCurrentBranch, isGitRepo, isRemoteHistoryClean, isWorkingTreeClean } from '@pnpm/git-utils' import { runLifecycleHook, type RunLifecycleHookOptions } from '@pnpm/lifecycle' import type { ProjectManifest } from '@pnpm/types' -import { getCurrentBranch, isGitRepo, isRemoteHistoryClean, isWorkingTreeClean } from '@pnpm/git-utils' -import enquirer from 'enquirer' import { rimraf } from '@zkochan/rimraf' +import enquirer from 'enquirer' import { pick } from 'ramda' import { realpathMissing } from 'realpath-missing' import { renderHelp } from 'render-help' import { temporaryDirectory } from 'tempy' + import { extractManifestFromPacked, isTarballPath } from './extractManifestFromPacked.js' import { optionsWithOtpEnv } from './otpEnv.js' import * as pack from './pack.js' import { publishPackedPkg } from './publishPackedPkg.js' -import { recursivePublish, type PublishRecursiveOpts } from './recursivePublish.js' +import { type PublishRecursiveOpts, recursivePublish } from './recursivePublish.js' export function rcOptionsTypes (): Record { return pick([ diff --git a/releasing/plugin-commands-publishing/src/publishPackedPkg.ts b/releasing/plugin-commands-publishing/src/publishPackedPkg.ts index 936b723c12..b33f88fa74 100644 --- a/releasing/plugin-commands-publishing/src/publishPackedPkg.ts +++ b/releasing/plugin-commands-publishing/src/publishPackedPkg.ts @@ -1,17 +1,19 @@ import fs from 'fs/promises' -import { type PublishOptions, publish } from 'libnpmpublish' + import type { Config } from '@pnpm/config' import { PnpmError } from '@pnpm/error' import type { ExportedManifest } from '@pnpm/exportable-manifest' import { globalInfo, globalWarn } from '@pnpm/logger' +import { publish, type PublishOptions } from 'libnpmpublish' + import { displayError } from './displayError.js' import { executeTokenHelper } from './executeTokenHelper.js' import { createFailedToPublishError } from './FailedToPublishError.js' import { AuthTokenError, fetchAuthToken } from './oidc/authToken.js' -import { IdTokenError, getIdToken } from './oidc/idToken.js' -import { ProvenanceError, determineProvenance } from './oidc/provenance.js' +import { getIdToken, IdTokenError } from './oidc/idToken.js' +import { determineProvenance, ProvenanceError } from './oidc/provenance.js' import type { PackResult } from './pack.js' -import { type NormalizedRegistryUrl, allRegistryConfigKeys, parseSupportedRegistryUrl } from './registryConfigKeys.js' +import { allRegistryConfigKeys, type NormalizedRegistryUrl, parseSupportedRegistryUrl } from './registryConfigKeys.js' type AuthConfigKey = | 'authToken' diff --git a/releasing/plugin-commands-publishing/src/recursivePublish.ts b/releasing/plugin-commands-publishing/src/recursivePublish.ts index 44da699200..91663e2a5b 100644 --- a/releasing/plugin-commands-publishing/src/recursivePublish.ts +++ b/releasing/plugin-commands-publishing/src/recursivePublish.ts @@ -1,14 +1,16 @@ import path from 'path' + import { createResolver } from '@pnpm/client' import type { Config } from '@pnpm/config' import { logger } from '@pnpm/logger' import { pickRegistryForPackage } from '@pnpm/pick-registry-for-package' import type { ResolveFunction } from '@pnpm/resolver-base' import { sortPackages } from '@pnpm/sort-packages' -import type { Registries, ProjectRootDir } from '@pnpm/types' +import type { ProjectRootDir, Registries } from '@pnpm/types' import pFilter from 'p-filter' import { pick } from 'ramda' import { writeJsonFile } from 'write-json-file' + import { publish } from './publish.js' import type { PublishPackedPkgOptions } from './publishPackedPkg.js' diff --git a/releasing/plugin-commands-publishing/test/FailedToPublishError.test.ts b/releasing/plugin-commands-publishing/test/FailedToPublishError.test.ts index ac0c570c64..312a5181da 100644 --- a/releasing/plugin-commands-publishing/test/FailedToPublishError.test.ts +++ b/releasing/plugin-commands-publishing/test/FailedToPublishError.test.ts @@ -1,5 +1,5 @@ +import { createFailedToPublishError, type FailedToPublishError } from '../src/FailedToPublishError.js' import type { PackResult } from '../src/pack.js' -import { type FailedToPublishError, createFailedToPublishError } from '../src/FailedToPublishError.js' const pack = (): PackResult => ({ contents: ['index.js', 'bin.js'], diff --git a/releasing/plugin-commands-publishing/test/executeTokenHelper.test.ts b/releasing/plugin-commands-publishing/test/executeTokenHelper.test.ts index eed834032b..9fcae21e00 100644 --- a/releasing/plugin-commands-publishing/test/executeTokenHelper.test.ts +++ b/releasing/plugin-commands-publishing/test/executeTokenHelper.test.ts @@ -1,4 +1,5 @@ import { jest } from '@jest/globals' + import { executeTokenHelper } from '../src/executeTokenHelper.js' test('executeTokenHelper returns stdout of the tokenHelper command', () => { diff --git a/releasing/plugin-commands-publishing/test/extractManifestFromPacked.test.ts b/releasing/plugin-commands-publishing/test/extractManifestFromPacked.test.ts index 5f20a33409..5f83cb8c52 100644 --- a/releasing/plugin-commands-publishing/test/extractManifestFromPacked.test.ts +++ b/releasing/plugin-commands-publishing/test/extractManifestFromPacked.test.ts @@ -1,13 +1,15 @@ import fs from 'fs' import { createGzip } from 'zlib' -import tar from 'tar-stream' + import type { ExportedManifest } from '@pnpm/exportable-manifest' import { prepareEmpty } from '@pnpm/prepare' +import tar from 'tar-stream' + import { - type TarballPath, - PublishArchiveMissingManifestError, - isTarballPath, extractManifestFromPacked, + isTarballPath, + PublishArchiveMissingManifestError, + type TarballPath, } from '../src/extractManifestFromPacked.js' async function createTarball (tarballPath: string, contents: Record): Promise { diff --git a/releasing/plugin-commands-publishing/test/gitChecks.ts b/releasing/plugin-commands-publishing/test/gitChecks.ts index 3a2db35c90..cc336dfd15 100644 --- a/releasing/plugin-commands-publishing/test/gitChecks.ts +++ b/releasing/plugin-commands-publishing/test/gitChecks.ts @@ -1,11 +1,12 @@ import fs from 'fs' -import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' -import { prepare } from '@pnpm/prepare' + +import { jest } from '@jest/globals' import { PnpmError } from '@pnpm/error' +import { prepare } from '@pnpm/prepare' +import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { safeExeca as execa } from 'execa' import { temporaryDirectory } from 'tempy' -import { jest } from '@jest/globals' import { DEFAULT_OPTS } from './utils/index.js' jest.unstable_mockModule('enquirer', () => ({ default: { prompt: jest.fn() } })) diff --git a/releasing/plugin-commands-publishing/test/oidcAuthToken.test.ts b/releasing/plugin-commands-publishing/test/oidcAuthToken.test.ts index ae31d427f8..4e887454d5 100644 --- a/releasing/plugin-commands-publishing/test/oidcAuthToken.test.ts +++ b/releasing/plugin-commands-publishing/test/oidcAuthToken.test.ts @@ -1,9 +1,10 @@ import { jest } from '@jest/globals' + import { type AuthTokenContext, - type AuthTokenFetchOptions, - AuthTokenFetchError, AuthTokenExchangeError, + AuthTokenFetchError, + type AuthTokenFetchOptions, AuthTokenJsonInterruptedError, AuthTokenMalformedJsonError, fetchAuthToken, diff --git a/releasing/plugin-commands-publishing/test/oidcIdToken.test.ts b/releasing/plugin-commands-publishing/test/oidcIdToken.test.ts index 2dbe9da26f..363c5e4928 100644 --- a/releasing/plugin-commands-publishing/test/oidcIdToken.test.ts +++ b/releasing/plugin-commands-publishing/test/oidcIdToken.test.ts @@ -1,12 +1,13 @@ import { jest } from '@jest/globals' + import { + getIdToken, type IdTokenContext, type IdTokenFetchOptions, - IdTokenGitHubWorkflowIncorrectPermissionsError, IdTokenGitHubInvalidResponseError, IdTokenGitHubJsonInterruptedError, IdTokenGitHubJsonInvalidValueError, - getIdToken, + IdTokenGitHubWorkflowIncorrectPermissionsError, } from '../src/oidc/idToken.js' describe('getIdToken', () => { diff --git a/releasing/plugin-commands-publishing/test/oidcProvenance.test.ts b/releasing/plugin-commands-publishing/test/oidcProvenance.test.ts index 86cc9e1890..41a2d216d5 100644 --- a/releasing/plugin-commands-publishing/test/oidcProvenance.test.ts +++ b/releasing/plugin-commands-publishing/test/oidcProvenance.test.ts @@ -1,11 +1,12 @@ import { jest } from '@jest/globals' + import { - type ProvenanceContext, - type ProvenanceFetchOptions, - ProvenanceMalformedIdTokenError, - ProvenanceInsufficientInformationError, - ProvenanceFailedToFetchVisibilityError, determineProvenance, + type ProvenanceContext, + ProvenanceFailedToFetchVisibilityError, + type ProvenanceFetchOptions, + ProvenanceInsufficientInformationError, + ProvenanceMalformedIdTokenError, } from '../src/oidc/provenance.js' describe('determineProvenance', () => { diff --git a/releasing/plugin-commands-publishing/test/pack.ts b/releasing/plugin-commands-publishing/test/pack.ts index 3a5becabb6..4e7be43e53 100644 --- a/releasing/plugin-commands-publishing/test/pack.ts +++ b/releasing/plugin-commands-publishing/test/pack.ts @@ -1,11 +1,13 @@ import fs from 'fs' import path from 'path' + import { pack } from '@pnpm/plugin-commands-publishing' import { prepare, preparePackages, tempDir } from '@pnpm/prepare' -import * as tar from 'tar' -import chalk from 'chalk' -import { writeYamlFileSync } from 'write-yaml-file' import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' +import chalk from 'chalk' +import * as tar from 'tar' +import { writeYamlFileSync } from 'write-yaml-file' + import type { PackResultJson } from '../src/pack.js' import { DEFAULT_OPTS } from './utils/index.js' diff --git a/releasing/plugin-commands-publishing/test/publish.ts b/releasing/plugin-commands-publishing/test/publish.ts index 9a3193bc78..c097132a91 100644 --- a/releasing/plugin-commands-publishing/test/publish.ts +++ b/releasing/plugin-commands-publishing/test/publish.ts @@ -1,17 +1,19 @@ import fs from 'fs' import path from 'path' -import { temporaryDirectory } from 'tempy' -import { safeExeca as execa } from 'execa' -import { isCI } from 'ci-info' -import isWindows from 'is-windows' + import { getCatalogsFromWorkspaceManifest } from '@pnpm/catalogs.config' import { pack, publish } from '@pnpm/plugin-commands-publishing' import { prepare, preparePackages } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { createTestIpcServer } from '@pnpm/test-ipc-server' +import { isCI } from 'ci-info' import crossSpawn from 'cross-spawn' +import { safeExeca as execa } from 'execa' +import isWindows from 'is-windows' +import { temporaryDirectory } from 'tempy' import { writeYamlFileSync } from 'write-yaml-file' -import { DEFAULT_OPTS, checkPkgExists } from './utils/index.js' + +import { checkPkgExists, DEFAULT_OPTS } from './utils/index.js' const skipOnWindowsCI = isCI && isWindows() ? test.skip : test diff --git a/releasing/plugin-commands-publishing/test/recursivePublish.ts b/releasing/plugin-commands-publishing/test/recursivePublish.ts index afcdf5853c..7fda54418d 100644 --- a/releasing/plugin-commands-publishing/test/recursivePublish.ts +++ b/releasing/plugin-commands-publishing/test/recursivePublish.ts @@ -1,16 +1,18 @@ import fs from 'fs' import path from 'path' -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' + +import { jest } from '@jest/globals' import { streamParser } from '@pnpm/logger' import { publish } from '@pnpm/plugin-commands-publishing' import { preparePackages } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import type { ProjectManifest } from '@pnpm/types' -import { jest } from '@jest/globals' -import { safeExeca as execa } from 'execa' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import crossSpawn from 'cross-spawn' +import { safeExeca as execa } from 'execa' import { loadJsonFileSync } from 'load-json-file' -import { DEFAULT_OPTS, checkPkgExists } from './utils/index.js' + +import { checkPkgExists, DEFAULT_OPTS } from './utils/index.js' const CREDENTIALS = `\ registry=http://localhost:${REGISTRY_MOCK_PORT}/ diff --git a/releasing/plugin-commands-publishing/test/registryConfigKeys.test.ts b/releasing/plugin-commands-publishing/test/registryConfigKeys.test.ts index b41d04346e..890fd70b03 100644 --- a/releasing/plugin-commands-publishing/test/registryConfigKeys.test.ts +++ b/releasing/plugin-commands-publishing/test/registryConfigKeys.test.ts @@ -1,9 +1,9 @@ import { + allRegistryConfigKeys, type NormalizedRegistryUrl, + parseSupportedRegistryUrl, type RegistryConfigKey, type SupportedRegistryUrlInfo, - allRegistryConfigKeys, - parseSupportedRegistryUrl, } from '../src/registryConfigKeys.js' describe('parseSupportedRegistryUrl', () => { diff --git a/resolving/bun-resolver/src/index.ts b/resolving/bun-resolver/src/index.ts index e91f503a41..8b54152942 100644 --- a/resolving/bun-resolver/src/index.ts +++ b/resolving/bun-resolver/src/index.ts @@ -2,6 +2,7 @@ import { getBunBinLocationForCurrentOS } from '@pnpm/constants' import { fetchShasumsFile } from '@pnpm/crypto.shasums-file' import { PnpmError } from '@pnpm/error' import type { FetchFromRegistry } from '@pnpm/fetching-types' +import type { NpmResolver } from '@pnpm/npm-resolver' import type { BinaryResolution, PlatformAssetResolution, @@ -12,7 +13,6 @@ import type { WantedDependency, } from '@pnpm/resolver-base' import type { PkgResolutionId } from '@pnpm/types' -import type { NpmResolver } from '@pnpm/npm-resolver' import { lexCompare } from '@pnpm/util.lex-comparator' export interface BunRuntimeResolveResult extends ResolveResult { diff --git a/resolving/default-resolver/src/index.ts b/resolving/default-resolver/src/index.ts index 0ced1874b7..a05b230440 100644 --- a/resolving/default-resolver/src/index.ts +++ b/resolving/default-resolver/src/index.ts @@ -1,19 +1,18 @@ import { PnpmError } from '@pnpm/error' import type { FetchFromRegistry, GetAuthHeader } from '@pnpm/fetching-types' -import { type GitResolveResult, createGitResolver } from '@pnpm/git-resolver' +import { createGitResolver, type GitResolveResult } from '@pnpm/git-resolver' +import { checkCustomResolverCanResolve, type CustomResolver } from '@pnpm/hooks.types' import { type LocalResolveResult, resolveFromLocal } from '@pnpm/local-resolver' -import { resolveNodeRuntime, type NodeRuntimeResolveResult } from '@pnpm/node.resolver' -import { resolveDenoRuntime, type DenoRuntimeResolveResult } from '@pnpm/resolving.deno-resolver' -import { resolveBunRuntime, type BunRuntimeResolveResult } from '@pnpm/resolving.bun-resolver' +import { type NodeRuntimeResolveResult, resolveNodeRuntime } from '@pnpm/node.resolver' import { createNpmResolver, type JsrResolveResult, type NpmResolveResult, - type WorkspaceResolveResult, type PackageMeta, type PackageMetaCache, type ResolveFromNpmOptions, type ResolverFactoryOptions, + type WorkspaceResolveResult, } from '@pnpm/npm-resolver' import type { ResolveFunction, @@ -21,8 +20,9 @@ import type { ResolveResult, WantedDependency, } from '@pnpm/resolver-base' -import { type TarballResolveResult, resolveFromTarball } from '@pnpm/tarball-resolver' -import { type CustomResolver, checkCustomResolverCanResolve } from '@pnpm/hooks.types' +import { type BunRuntimeResolveResult, resolveBunRuntime } from '@pnpm/resolving.bun-resolver' +import { type DenoRuntimeResolveResult, resolveDenoRuntime } from '@pnpm/resolving.deno-resolver' +import { resolveFromTarball, type TarballResolveResult } from '@pnpm/tarball-resolver' export type { PackageMeta, diff --git a/resolving/default-resolver/test/customResolver.ts b/resolving/default-resolver/test/customResolver.ts index 14a7396b21..4a433f36e5 100644 --- a/resolving/default-resolver/test/customResolver.ts +++ b/resolving/default-resolver/test/customResolver.ts @@ -1,7 +1,7 @@ /// import { jest } from '@jest/globals' import { createResolver } from '@pnpm/default-resolver' -import type { WantedDependency, CustomResolver } from '@pnpm/hooks.types' +import type { CustomResolver, WantedDependency } from '@pnpm/hooks.types' import { Response } from 'node-fetch' test('custom resolver intercepts matching packages', async () => { diff --git a/resolving/deno-resolver/src/index.ts b/resolving/deno-resolver/src/index.ts index 422827386b..7300c96445 100644 --- a/resolving/deno-resolver/src/index.ts +++ b/resolving/deno-resolver/src/index.ts @@ -1,6 +1,7 @@ import { getDenoBinLocationForCurrentOS } from '@pnpm/constants' import { PnpmError } from '@pnpm/error' import type { FetchFromRegistry } from '@pnpm/fetching-types' +import type { NpmResolver } from '@pnpm/npm-resolver' import type { BinaryResolution, PlatformAssetResolution, @@ -11,7 +12,6 @@ import type { WantedDependency, } from '@pnpm/resolver-base' import type { PkgResolutionId } from '@pnpm/types' -import type { NpmResolver } from '@pnpm/npm-resolver' import { lexCompare } from '@pnpm/util.lex-comparator' const ASSET_REGEX = /^deno-(?aarch64|x86_64)-(?apple-darwin|unknown-linux-gnu|pc-windows-msvc)\.zip\.sha256sum$/ diff --git a/resolving/git-resolver/src/index.ts b/resolving/git-resolver/src/index.ts index c2d57d00c1..5ce9c14daa 100644 --- a/resolving/git-resolver/src/index.ts +++ b/resolving/git-resolver/src/index.ts @@ -1,10 +1,11 @@ -import type { TarballResolution, GitResolution, PkgResolutionId, ResolveOptions, ResolveResult } from '@pnpm/resolver-base' +import { PnpmError } from '@pnpm/error' +import type { AgentOptions } from '@pnpm/network.agent' +import type { GitResolution, PkgResolutionId, ResolveOptions, ResolveResult, TarballResolution } from '@pnpm/resolver-base' import { gracefulGit as git } from 'graceful-git' import semver from 'semver' -import { parseBareSpecifier, type HostedPackageSpec } from './parseBareSpecifier.js' + import { createGitHostedPkgId } from './createGitHostedPkgId.js' -import type { AgentOptions } from '@pnpm/network.agent' -import { PnpmError } from '@pnpm/error' +import { type HostedPackageSpec, parseBareSpecifier } from './parseBareSpecifier.js' export { createGitHostedPkgId } diff --git a/resolving/git-resolver/src/parseBareSpecifier.ts b/resolving/git-resolver/src/parseBareSpecifier.ts index 3b6dbcfa2c..b80b81cf59 100644 --- a/resolving/git-resolver/src/parseBareSpecifier.ts +++ b/resolving/git-resolver/src/parseBareSpecifier.ts @@ -1,8 +1,8 @@ // cspell:ignore sshurl import urlLib, { URL } from 'url' + import { fetchWithAgent } from '@pnpm/fetch' import type { AgentOptions } from '@pnpm/network.agent' - import { gracefulGit as git } from 'graceful-git' import HostedGit from 'hosted-git-info' diff --git a/resolving/git-resolver/test/index.ts b/resolving/git-resolver/test/index.ts index 3d566e8680..efc1582ca3 100644 --- a/resolving/git-resolver/test/index.ts +++ b/resolving/git-resolver/test/index.ts @@ -1,7 +1,8 @@ /// import path from 'path' -import isWindows from 'is-windows' + import { jest } from '@jest/globals' +import isWindows from 'is-windows' const { fetchWithAgent: fetchWithAgentOriginal } = await import('@pnpm/fetch') jest.unstable_mockModule('@pnpm/fetch', () => ({ diff --git a/resolving/jsr-specifier-parser/test/parse.test.ts b/resolving/jsr-specifier-parser/test/parse.test.ts index 1f52f046ea..f7aae13356 100644 --- a/resolving/jsr-specifier-parser/test/parse.test.ts +++ b/resolving/jsr-specifier-parser/test/parse.test.ts @@ -1,4 +1,4 @@ -import { parseJsrSpecifier, type JsrSpec } from '@pnpm/resolving.jsr-specifier-parser' +import { type JsrSpec, parseJsrSpecifier } from '@pnpm/resolving.jsr-specifier-parser' describe('parseJsrSpecifier', () => { test('skips on non-jsr specifiers', () => { diff --git a/resolving/local-resolver/src/index.ts b/resolving/local-resolver/src/index.ts index 0532987308..7b9afaac6f 100644 --- a/resolving/local-resolver/src/index.ts +++ b/resolving/local-resolver/src/index.ts @@ -1,11 +1,13 @@ import { existsSync } from 'fs' import path from 'path' + import { getTarballIntegrity } from '@pnpm/crypto.hash' import { PnpmError } from '@pnpm/error' +import { logger } from '@pnpm/logger' import { readProjectManifestOnly } from '@pnpm/read-project-manifest' import type { DirectoryResolution, Resolution, ResolveResult, TarballResolution } from '@pnpm/resolver-base' import type { DependencyManifest, PkgResolutionId } from '@pnpm/types' -import { logger } from '@pnpm/logger' + import { parseBareSpecifier, type WantedLocalDependency } from './parseBareSpecifier.js' export { type WantedLocalDependency } diff --git a/resolving/local-resolver/src/parseBareSpecifier.ts b/resolving/local-resolver/src/parseBareSpecifier.ts index 9a6baa6101..64eb8f9bae 100644 --- a/resolving/local-resolver/src/parseBareSpecifier.ts +++ b/resolving/local-resolver/src/parseBareSpecifier.ts @@ -1,8 +1,9 @@ import os from 'os' import path from 'path' + import { PnpmError } from '@pnpm/error' -import normalize from 'normalize-path' import type { PkgResolutionId } from '@pnpm/resolver-base' +import normalize from 'normalize-path' // @ts-expect-error const isWindows = process.platform === 'win32' || global['FAKE_WINDOWS'] diff --git a/resolving/local-resolver/test/index.ts b/resolving/local-resolver/test/index.ts index 927cef67d3..7bb0b07e9c 100644 --- a/resolving/local-resolver/test/index.ts +++ b/resolving/local-resolver/test/index.ts @@ -1,11 +1,12 @@ /// import { createRequire } from 'module' import path from 'path' + +import { jest } from '@jest/globals' import { resolveFromLocal } from '@pnpm/local-resolver' +import { logger } from '@pnpm/logger' import type { DirectoryResolution } from '@pnpm/resolver-base' import normalize from 'normalize-path' -import { logger } from '@pnpm/logger' -import { jest } from '@jest/globals' const require = createRequire(import.meta.dirname) const TEST_DIR = path.dirname(require.resolve('@pnpm/tgz-fixtures/tgz/pnpm-local-resolver-0.1.1.tgz')) diff --git a/resolving/npm-resolver/src/fetch.ts b/resolving/npm-resolver/src/fetch.ts index 0a3a1d6bf1..49d9170d3d 100644 --- a/resolving/npm-resolver/src/fetch.ts +++ b/resolving/npm-resolver/src/fetch.ts @@ -1,6 +1,6 @@ import url from 'url' + import { requestRetryLogger } from '@pnpm/core-loggers' -import { globalWarn } from '@pnpm/logger' import { FetchError, type FetchErrorRequest, @@ -8,6 +8,7 @@ import { PnpmError, } from '@pnpm/error' import type { FetchFromRegistry, RetryTimeoutOptions } from '@pnpm/fetching-types' +import { globalWarn } from '@pnpm/logger' import type { PackageMeta } from '@pnpm/registry.types' import * as retry from '@zkochan/retry' diff --git a/resolving/npm-resolver/src/index.ts b/resolving/npm-resolver/src/index.ts index 06cf1a5fc1..510d014c75 100644 --- a/resolving/npm-resolver/src/index.ts +++ b/resolving/npm-resolver/src/index.ts @@ -1,4 +1,5 @@ import path from 'path' + import { PnpmError } from '@pnpm/error' import type { FetchFromRegistry, @@ -6,7 +7,7 @@ import type { RetryTimeoutOptions, } from '@pnpm/fetching-types' import { pickRegistryForPackage } from '@pnpm/pick-registry-for-package' -import type { PackageMeta, PackageInRegistry } from '@pnpm/registry.types' +import type { PackageInRegistry, PackageMeta } from '@pnpm/registry.types' import { resolveWorkspaceRange } from '@pnpm/resolve-workspace-range' import type { DirectoryResolution, @@ -20,9 +21,6 @@ import type { WorkspacePackagesByVersion, } from '@pnpm/resolver-base' import { storeIndexKey } from '@pnpm/store.index' -import { - readPkgFromCafs, -} from '@pnpm/worker' import type { DependencyManifest, PackageVersionPolicy, @@ -30,6 +28,9 @@ import type { Registries, TrustPolicy, } from '@pnpm/types' +import { + readPkgFromCafs, +} from '@pnpm/worker' import { LRUCache } from 'lru-cache' import normalize from 'normalize-path' import pMemoize from 'p-memoize' @@ -37,23 +38,24 @@ import { clone } from 'ramda' import semver from 'semver' import ssri from 'ssri' import versionSelectorType from 'version-selector-type' + +import { fetchMetadataFromFromRegistry, type FetchMetadataFromFromRegistryOptions, RegistryResponseError } from './fetch.js' +import { normalizeRegistryUrl } from './normalizeRegistryUrl.js' import { - type PackageMetaCache, - type PickPackageOptions, - pickPackage, -} from './pickPackage.js' -import { - parseJsrSpecifierToRegistryPackageSpec, - parseBareSpecifier, type JsrRegistryPackageSpec, + parseBareSpecifier, + parseJsrSpecifierToRegistryPackageSpec, type RegistryPackageSpec, } from './parseBareSpecifier.js' -import { fetchMetadataFromFromRegistry, type FetchMetadataFromFromRegistryOptions, RegistryResponseError } from './fetch.js' -import { workspacePrefToNpm } from './workspacePrefToNpm.js' -import { whichVersionIsPinned } from './whichVersionIsPinned.js' +import { + type PackageMetaCache, + pickPackage, + type PickPackageOptions, +} from './pickPackage.js' import { pickVersionByVersionRange } from './pickPackageFromMeta.js' import { failIfTrustDowngraded } from './trustChecks.js' -import { normalizeRegistryUrl } from './normalizeRegistryUrl.js' +import { whichVersionIsPinned } from './whichVersionIsPinned.js' +import { workspacePrefToNpm } from './workspacePrefToNpm.js' export interface NoMatchingVersionErrorOptions { wantedDependency: WantedDependency @@ -108,12 +110,12 @@ function formatTimeAgo (date: Date): string { } export { - parseBareSpecifier, - workspacePrefToNpm, type PackageMeta, type PackageMetaCache, + parseBareSpecifier, type RegistryPackageSpec, RegistryResponseError, + workspacePrefToNpm, } export { whichVersionIsPinned } from './whichVersionIsPinned.js' diff --git a/resolving/npm-resolver/src/pickPackage.ts b/resolving/npm-resolver/src/pickPackage.ts index c312934697..762eee2b8c 100644 --- a/resolving/npm-resolver/src/pickPackage.ts +++ b/resolving/npm-resolver/src/pickPackage.ts @@ -1,26 +1,28 @@ import { promises as fs } from 'fs' import path from 'path' -import { ABBREVIATED_META_DIR, FULL_META_DIR, FULL_FILTERED_META_DIR } from '@pnpm/constants' + +import { ABBREVIATED_META_DIR, FULL_FILTERED_META_DIR, FULL_META_DIR } from '@pnpm/constants' import { createHexHash } from '@pnpm/crypto.hash' import { PnpmError } from '@pnpm/error' import gfs from '@pnpm/graceful-fs' import { logger } from '@pnpm/logger' -import type { PackageMeta, PackageInRegistry } from '@pnpm/registry.types' +import type { PackageInRegistry, PackageMeta } from '@pnpm/registry.types' import getRegistryName from 'encode-registry' import pLimit, { type LimitFunction } from 'p-limit' import { fastPathTemp as pathTemp } from 'path-temp' import { pick } from 'ramda' -import semver from 'semver' import { renameOverwrite } from 'rename-overwrite' -import { toRaw } from './toRaw.js' +import semver from 'semver' + import type { FetchMetadataResult } from './fetch.js' -import { - pickPackageFromMeta, - pickVersionByVersionRange, - pickLowestVersionByVersionRange, - type PickPackageFromMetaOptions, -} from './pickPackageFromMeta.js' import type { RegistryPackageSpec } from './parseBareSpecifier.js' +import { + pickLowestVersionByVersionRange, + pickPackageFromMeta, + type PickPackageFromMetaOptions, + pickVersionByVersionRange, +} from './pickPackageFromMeta.js' +import { toRaw } from './toRaw.js' export interface PackageMetaCache { get: (key: string) => PackageMeta | undefined diff --git a/resolving/npm-resolver/src/pickPackageFromMeta.ts b/resolving/npm-resolver/src/pickPackageFromMeta.ts index 1adb04fe28..62b2cf72bc 100644 --- a/resolving/npm-resolver/src/pickPackageFromMeta.ts +++ b/resolving/npm-resolver/src/pickPackageFromMeta.ts @@ -1,10 +1,12 @@ +import util from 'util' + import { PnpmError } from '@pnpm/error' import { filterPkgMetadataByPublishDate } from '@pnpm/registry.pkg-metadata-filter' import type { PackageInRegistry, PackageMeta, PackageMetaWithTime } from '@pnpm/registry.types' import type { VersionSelectors } from '@pnpm/resolver-base' import type { PackageVersionPolicy } from '@pnpm/types' import semver from 'semver' -import util from 'util' + import type { RegistryPackageSpec } from './parseBareSpecifier.js' export interface PickVersionByVersionRangeOptions { diff --git a/resolving/npm-resolver/src/trustChecks.ts b/resolving/npm-resolver/src/trustChecks.ts index 85b64f1497..b6edb00ee5 100644 --- a/resolving/npm-resolver/src/trustChecks.ts +++ b/resolving/npm-resolver/src/trustChecks.ts @@ -2,6 +2,7 @@ import { PnpmError } from '@pnpm/error' import type { PackageInRegistry, PackageMeta, PackageMetaWithTime } from '@pnpm/registry.types' import type { PackageVersionPolicy } from '@pnpm/types' import semver from 'semver' + import { assertMetaHasTime } from './pickPackageFromMeta.js' type TrustEvidence = 'provenance' | 'trustedPublisher' diff --git a/resolving/npm-resolver/test/index.ts b/resolving/npm-resolver/test/index.ts index 6834efce5f..b84b9fc230 100644 --- a/resolving/npm-resolver/test/index.ts +++ b/resolving/npm-resolver/test/index.ts @@ -1,21 +1,23 @@ /// import fs from 'fs' import path from 'path' + import { ABBREVIATED_META_DIR } from '@pnpm/constants' import { createHexHash } from '@pnpm/crypto.hash' import { PnpmError } from '@pnpm/error' import { createFetchFromRegistry } from '@pnpm/fetch' import { createNpmResolver, - RegistryResponseError, NoMatchingVersionError, + RegistryResponseError, } from '@pnpm/npm-resolver' import { fixtures } from '@pnpm/test-fixtures' -import type { Registries, ProjectRootDir } from '@pnpm/types' +import type { ProjectRootDir, Registries } from '@pnpm/types' import { loadJsonFileSync } from 'load-json-file' import nock from 'nock' import { omit } from 'ramda' import { temporaryDirectory } from 'tempy' + import { delay, retryLoadJsonFile } from './utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/resolving/npm-resolver/test/publishedBy.test.ts b/resolving/npm-resolver/test/publishedBy.test.ts index 33894e6645..5e390311d7 100644 --- a/resolving/npm-resolver/test/publishedBy.test.ts +++ b/resolving/npm-resolver/test/publishedBy.test.ts @@ -1,10 +1,11 @@ import fs from 'fs' import path from 'path' + import { FULL_FILTERED_META_DIR } from '@pnpm/constants' import { createFetchFromRegistry } from '@pnpm/fetch' import { createNpmResolver } from '@pnpm/npm-resolver' -import type { Registries } from '@pnpm/types' import { fixtures } from '@pnpm/test-fixtures' +import type { Registries } from '@pnpm/types' import { loadJsonFileSync } from 'load-json-file' import nock from 'nock' import { temporaryDirectory } from 'tempy' diff --git a/resolving/npm-resolver/test/resolveJsr.test.ts b/resolving/npm-resolver/test/resolveJsr.test.ts index d0bec1548a..54dd834e43 100644 --- a/resolving/npm-resolver/test/resolveJsr.test.ts +++ b/resolving/npm-resolver/test/resolveJsr.test.ts @@ -1,4 +1,5 @@ import path from 'path' + import { ABBREVIATED_META_DIR } from '@pnpm/constants' import { createFetchFromRegistry } from '@pnpm/fetch' import { createNpmResolver } from '@pnpm/npm-resolver' @@ -7,6 +8,7 @@ import type { Registries } from '@pnpm/types' import { loadJsonFileSync } from 'load-json-file' import nock from 'nock' import { temporaryDirectory } from 'tempy' + import { retryLoadJsonFile } from './utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/resolving/npm-resolver/test/trustChecks.test.ts b/resolving/npm-resolver/test/trustChecks.test.ts index 54db936873..e03030b847 100644 --- a/resolving/npm-resolver/test/trustChecks.test.ts +++ b/resolving/npm-resolver/test/trustChecks.test.ts @@ -1,6 +1,7 @@ -import type { PackageInRegistry, PackageMetaWithTime } from '@pnpm/registry.types' import { createPackageVersionPolicy } from '@pnpm/config.version-policy' -import { getTrustEvidence, failIfTrustDowngraded } from '../src/trustChecks.js' +import type { PackageInRegistry, PackageMetaWithTime } from '@pnpm/registry.types' + +import { failIfTrustDowngraded, getTrustEvidence } from '../src/trustChecks.js' describe('getTrustEvidence', () => { test('returns "trustedPublisher" when _npmUser.trustedPublisher exists', () => { diff --git a/resolving/resolver-base/src/index.ts b/resolving/resolver-base/src/index.ts index 8a30817115..f297a51d6b 100644 --- a/resolving/resolver-base/src/index.ts +++ b/resolving/resolver-base/src/index.ts @@ -1,9 +1,9 @@ import type { - ProjectRootDir, DependencyManifest, - PkgResolutionId, - PinnedVersion, PackageVersionPolicy, + PinnedVersion, + PkgResolutionId, + ProjectRootDir, TrustPolicy, } from '@pnpm/types' diff --git a/resolving/tarball-resolver/src/index.ts b/resolving/tarball-resolver/src/index.ts index a50d0180bf..4d385e3983 100644 --- a/resolving/tarball-resolver/src/index.ts +++ b/resolving/tarball-resolver/src/index.ts @@ -1,5 +1,5 @@ -import type { PkgResolutionId, ResolveResult, TarballResolution } from '@pnpm/resolver-base' import type { FetchFromRegistry } from '@pnpm/fetching-types' +import type { PkgResolutionId, ResolveResult, TarballResolution } from '@pnpm/resolver-base' export interface TarballResolveResult extends ResolveResult { normalizedBareSpecifier: string diff --git a/resolving/tarball-resolver/test/index.ts b/resolving/tarball-resolver/test/index.ts index 7d23cf891e..e5799a62a4 100644 --- a/resolving/tarball-resolver/test/index.ts +++ b/resolving/tarball-resolver/test/index.ts @@ -1,7 +1,7 @@ /// // cspell:ignore buildserver -import { resolveFromTarball as _resolveFromTarball } from '@pnpm/tarball-resolver' import { createFetchFromRegistry } from '@pnpm/fetch' +import { resolveFromTarball as _resolveFromTarball } from '@pnpm/tarball-resolver' const fetch = createFetchFromRegistry({}) const resolveFromTarball = _resolveFromTarball.bind(null, fetch) diff --git a/reviewing/dependencies-hierarchy/src/buildDependenciesTree.ts b/reviewing/dependencies-hierarchy/src/buildDependenciesTree.ts index 74de8346fa..178eed6e60 100644 --- a/reviewing/dependencies-hierarchy/src/buildDependenciesTree.ts +++ b/reviewing/dependencies-hierarchy/src/buildDependenciesTree.ts @@ -1,4 +1,6 @@ import path from 'path' + +import { detectDepTypes } from '@pnpm/lockfile.detect-dep-types' import { getLockfileImporterId, type LockfileObject, @@ -7,19 +9,19 @@ import { readWantedLockfile, type ResolvedDependencies, } from '@pnpm/lockfile.fs' -import { detectDepTypes } from '@pnpm/lockfile.detect-dep-types' import { readModulesManifest } from '@pnpm/modules-yaml' -import { StoreIndex } from '@pnpm/store.index' import { normalizeRegistries } from '@pnpm/normalize-registries' import { readModulesDir } from '@pnpm/read-modules-dir' import { safeReadPackageJsonFromDir } from '@pnpm/read-package-json' -import { type DependenciesField, type Finder, DEPENDENCIES_FIELDS, type Registries } from '@pnpm/types' +import { StoreIndex } from '@pnpm/store.index' +import { DEPENDENCIES_FIELDS, type DependenciesField, type Finder, type Registries } from '@pnpm/types' import normalizePath from 'normalize-path' import { realpathMissing } from 'realpath-missing' import { resolveLinkTarget } from 'resolve-link-target' -import type { DependencyNode } from './DependencyNode.js' + import { buildDependencyGraph } from './buildDependencyGraph.js' -import { getTree, type BaseTreeOpts, type MaterializationCache } from './getTree.js' +import type { DependencyNode } from './DependencyNode.js' +import { type BaseTreeOpts, getTree, type MaterializationCache } from './getTree.js' import type { TreeNodeId } from './TreeNodeId.js' export interface DependenciesTree { diff --git a/reviewing/dependencies-hierarchy/src/buildDependencyGraph.ts b/reviewing/dependencies-hierarchy/src/buildDependencyGraph.ts index 5ec72ce015..f3e87ee885 100644 --- a/reviewing/dependencies-hierarchy/src/buildDependencyGraph.ts +++ b/reviewing/dependencies-hierarchy/src/buildDependencyGraph.ts @@ -1,4 +1,5 @@ import type { PackageSnapshots, ProjectSnapshot } from '@pnpm/lockfile.fs' + import { getTreeNodeChildId } from './getTreeNodeChildId.js' import { serializeTreeNodeId, type TreeNodeId } from './TreeNodeId.js' diff --git a/reviewing/dependencies-hierarchy/src/buildDependentsTree.ts b/reviewing/dependencies-hierarchy/src/buildDependentsTree.ts index 672d7dd4f8..b09c200faa 100644 --- a/reviewing/dependencies-hierarchy/src/buildDependentsTree.ts +++ b/reviewing/dependencies-hierarchy/src/buildDependentsTree.ts @@ -1,23 +1,25 @@ import path from 'path' + import { getLockfileImporterId, type LockfileObject, - type ProjectSnapshot, type PackageSnapshots, + type ProjectSnapshot, } from '@pnpm/lockfile.fs' import { nameVerFromPkgSnapshot } from '@pnpm/lockfile.utils' import { readModulesManifest } from '@pnpm/modules-yaml' -import { StoreIndex } from '@pnpm/store.index' import { normalizeRegistries } from '@pnpm/normalize-registries' +import { StoreIndex } from '@pnpm/store.index' import type { DependenciesField, DependencyManifest, Finder, Registries } from '@pnpm/types' import { lexCompare } from '@pnpm/util.lex-comparator' -import semver from 'semver' import { realpathMissing } from 'realpath-missing' +import semver from 'semver' + import { buildDependencyGraph, type DependencyGraph } from './buildDependencyGraph.js' import { createPackagesSearcher } from './createPackagesSearcher.js' +import { getPkgInfo } from './getPkgInfo.js' import { peersSuffixHashFromDepPath } from './peersSuffixHash.js' import type { TreeNodeId } from './TreeNodeId.js' -import { getPkgInfo } from './getPkgInfo.js' interface ReverseEdge { parentSerialized: string diff --git a/reviewing/dependencies-hierarchy/src/createPackagesSearcher.ts b/reviewing/dependencies-hierarchy/src/createPackagesSearcher.ts index 6d661ed367..60ef3e7d53 100644 --- a/reviewing/dependencies-hierarchy/src/createPackagesSearcher.ts +++ b/reviewing/dependencies-hierarchy/src/createPackagesSearcher.ts @@ -1,6 +1,6 @@ import { createMatcher } from '@pnpm/matcher' import npa from '@pnpm/npm-package-arg' -import type { FinderContext, Finder } from '@pnpm/types' +import type { Finder, FinderContext } from '@pnpm/types' import semver from 'semver' export function createPackagesSearcher (queries: string[], finders?: Finder[]): Finder { diff --git a/reviewing/dependencies-hierarchy/src/getPkgInfo.ts b/reviewing/dependencies-hierarchy/src/getPkgInfo.ts index da64e7f917..73c95dd7d9 100644 --- a/reviewing/dependencies-hierarchy/src/getPkgInfo.ts +++ b/reviewing/dependencies-hierarchy/src/getPkgInfo.ts @@ -1,4 +1,7 @@ import path from 'path' + +import { refToRelative } from '@pnpm/dependency-path' +import { DepType, type DepTypes } from '@pnpm/lockfile.detect-dep-types' import type { PackageSnapshot, PackageSnapshots, @@ -8,12 +11,11 @@ import { nameVerFromPkgSnapshot, pkgSnapshotToResolution, } from '@pnpm/lockfile.utils' -import { type DepTypes, DepType } from '@pnpm/lockfile.detect-dep-types' +import { readPackageJsonFromDirSync } from '@pnpm/read-package-json' import type { StoreIndex } from '@pnpm/store.index' import type { DependencyManifest, Registries } from '@pnpm/types' -import { refToRelative } from '@pnpm/dependency-path' -import { readPackageJsonFromDirSync } from '@pnpm/read-package-json' import normalizePath from 'normalize-path' + import { readManifestFromCafs } from './readManifestFromCafs.js' import { resolvePackagePath } from './resolvePackagePath.js' diff --git a/reviewing/dependencies-hierarchy/src/getTree.ts b/reviewing/dependencies-hierarchy/src/getTree.ts index da8889ef7e..d01831df5c 100644 --- a/reviewing/dependencies-hierarchy/src/getTree.ts +++ b/reviewing/dependencies-hierarchy/src/getTree.ts @@ -1,9 +1,11 @@ import path from 'path' -import type { PackageSnapshots, ProjectSnapshot } from '@pnpm/lockfile.fs' + import type { DepTypes } from '@pnpm/lockfile.detect-dep-types' +import type { PackageSnapshots, ProjectSnapshot } from '@pnpm/lockfile.fs' import type { StoreIndex } from '@pnpm/store.index' import type { Finder, Registries } from '@pnpm/types' import { lexCompare } from '@pnpm/util.lex-comparator' + import type { DependencyGraph } from './buildDependencyGraph.js' import type { DependencyNode } from './DependencyNode.js' import { getPkgInfo } from './getPkgInfo.js' diff --git a/reviewing/dependencies-hierarchy/src/getTreeNodeChildId.ts b/reviewing/dependencies-hierarchy/src/getTreeNodeChildId.ts index 1346ea6b70..4929dbc9ed 100644 --- a/reviewing/dependencies-hierarchy/src/getTreeNodeChildId.ts +++ b/reviewing/dependencies-hierarchy/src/getTreeNodeChildId.ts @@ -1,6 +1,8 @@ -import { refToRelative } from '@pnpm/dependency-path' import path from 'path' + +import { refToRelative } from '@pnpm/dependency-path' import { getLockfileImporterId, type ProjectSnapshot } from '@pnpm/lockfile.fs' + import type { TreeNodeId } from './TreeNodeId.js' export interface GetTreeNodeChildIdOpts { diff --git a/reviewing/dependencies-hierarchy/src/index.ts b/reviewing/dependencies-hierarchy/src/index.ts index 68719fc369..eb83463711 100644 --- a/reviewing/dependencies-hierarchy/src/index.ts +++ b/reviewing/dependencies-hierarchy/src/index.ts @@ -1,4 +1,4 @@ export { buildDependenciesTree, type DependenciesTree } from './buildDependenciesTree.js' -export { type DependencyNode } from './DependencyNode.js' +export { buildDependentsTree, type DependentNode, type DependentsTree, type ImporterInfo } from './buildDependentsTree.js' export { createPackagesSearcher } from './createPackagesSearcher.js' -export { buildDependentsTree, type DependentsTree, type DependentNode, type ImporterInfo } from './buildDependentsTree.js' +export { type DependencyNode } from './DependencyNode.js' diff --git a/reviewing/dependencies-hierarchy/src/peersSuffixHash.ts b/reviewing/dependencies-hierarchy/src/peersSuffixHash.ts index 3ac440b5e3..efed250529 100644 --- a/reviewing/dependencies-hierarchy/src/peersSuffixHash.ts +++ b/reviewing/dependencies-hierarchy/src/peersSuffixHash.ts @@ -1,4 +1,5 @@ import crypto from 'crypto' + import { parseDepPath } from '@pnpm/dependency-path' export function peersSuffixHashFromDepPath (depPath: string): string | undefined { diff --git a/reviewing/dependencies-hierarchy/src/readManifestFromCafs.ts b/reviewing/dependencies-hierarchy/src/readManifestFromCafs.ts index 78ee2e42a9..9135c23606 100644 --- a/reviewing/dependencies-hierarchy/src/readManifestFromCafs.ts +++ b/reviewing/dependencies-hierarchy/src/readManifestFromCafs.ts @@ -1,7 +1,7 @@ -import { type StoreIndex, storeIndexKey } from '@pnpm/store.index' -import { loadJsonFileSync } from 'load-json-file' import { getFilePathByModeInCafs, type PackageFilesIndex } from '@pnpm/store.cafs' +import { type StoreIndex, storeIndexKey } from '@pnpm/store.index' import type { DependencyManifest } from '@pnpm/types' +import { loadJsonFileSync } from 'load-json-file' /** * Attempts to read a package manifest from the content-addressable store (CAFS) diff --git a/reviewing/dependencies-hierarchy/src/resolvePackagePath.ts b/reviewing/dependencies-hierarchy/src/resolvePackagePath.ts index aad0b4c77a..4a964749c6 100644 --- a/reviewing/dependencies-hierarchy/src/resolvePackagePath.ts +++ b/reviewing/dependencies-hierarchy/src/resolvePackagePath.ts @@ -1,5 +1,6 @@ import fs from 'fs' import path from 'path' + import { depPathToFilename } from '@pnpm/dependency-path' /** diff --git a/reviewing/dependencies-hierarchy/test/buildDependentsTree.test.ts b/reviewing/dependencies-hierarchy/test/buildDependentsTree.test.ts index 520b64c097..b65181dfd7 100644 --- a/reviewing/dependencies-hierarchy/test/buildDependentsTree.test.ts +++ b/reviewing/dependencies-hierarchy/test/buildDependentsTree.test.ts @@ -1,9 +1,11 @@ import fs from 'fs' import os from 'os' import path from 'path' + import { depPathToFilename, refToRelative } from '@pnpm/dependency-path' import type { PackageSnapshots, ProjectSnapshot } from '@pnpm/lockfile.fs' import type { DepPath, ProjectId } from '@pnpm/types' + import { buildDependentsTree } from '../lib/buildDependentsTree.js' function refToRelativeOrThrow (reference: string, pkgName: string): DepPath { diff --git a/reviewing/dependencies-hierarchy/test/createPackagesSearcher.spec.ts b/reviewing/dependencies-hierarchy/test/createPackagesSearcher.spec.ts index c8191a067d..f543e1995f 100644 --- a/reviewing/dependencies-hierarchy/test/createPackagesSearcher.spec.ts +++ b/reviewing/dependencies-hierarchy/test/createPackagesSearcher.spec.ts @@ -1,4 +1,5 @@ import type { DependencyManifest } from '@pnpm/types' + import { createPackagesSearcher } from '../lib/createPackagesSearcher.js' test('packages searcher', () => { diff --git a/reviewing/dependencies-hierarchy/test/getPkgInfo.test.ts b/reviewing/dependencies-hierarchy/test/getPkgInfo.test.ts index cf79a4e087..1b4c169f30 100644 --- a/reviewing/dependencies-hierarchy/test/getPkgInfo.test.ts +++ b/reviewing/dependencies-hierarchy/test/getPkgInfo.test.ts @@ -1,6 +1,7 @@ -import { getPkgInfo, type GetPkgInfoOpts } from '../src/getPkgInfo.js' import path from 'path' +import { getPkgInfo, type GetPkgInfoOpts } from '../src/getPkgInfo.js' + test('getPkgInfo handles missing pkgSnapshot without crashing', () => { const opts: GetPkgInfoOpts = { alias: 'missing-pkg', diff --git a/reviewing/dependencies-hierarchy/test/getTree.test.ts b/reviewing/dependencies-hierarchy/test/getTree.test.ts index 4da3e3eb5f..7efd8133fb 100644 --- a/reviewing/dependencies-hierarchy/test/getTree.test.ts +++ b/reviewing/dependencies-hierarchy/test/getTree.test.ts @@ -2,6 +2,7 @@ import { refToRelative } from '@pnpm/dependency-path' import type { PackageSnapshots } from '@pnpm/lockfile.fs' import type { DependencyNode } from '@pnpm/reviewing.dependencies-hierarchy' import type { DepPath, Finder } from '@pnpm/types' + import { buildDependencyGraph } from '../lib/buildDependencyGraph.js' import { getTree, type MaterializationCache } from '../lib/getTree.js' import type { TreeNodeId } from '../lib/TreeNodeId.js' diff --git a/reviewing/dependencies-hierarchy/test/index.ts b/reviewing/dependencies-hierarchy/test/index.ts index 38877b37ce..9e9df2d0f1 100644 --- a/reviewing/dependencies-hierarchy/test/index.ts +++ b/reviewing/dependencies-hierarchy/test/index.ts @@ -1,10 +1,11 @@ /// import fs from 'fs' import path from 'path' + import { WANTED_LOCKFILE } from '@pnpm/constants' -import { fixtures } from '@pnpm/test-fixtures' -import { buildDependenciesTree, type DependencyNode } from '@pnpm/reviewing.dependencies-hierarchy' import { depPathToFilename } from '@pnpm/dependency-path' +import { buildDependenciesTree, type DependencyNode } from '@pnpm/reviewing.dependencies-hierarchy' +import { fixtures } from '@pnpm/test-fixtures' const virtualStoreDirMaxLength = process.platform === 'win32' ? 60 : 120 const f = fixtures(import.meta.dirname) diff --git a/reviewing/license-scanner/src/getPkgInfo.ts b/reviewing/license-scanner/src/getPkgInfo.ts index c7dcab26b3..b372feec46 100644 --- a/reviewing/license-scanner/src/getPkgInfo.ts +++ b/reviewing/license-scanner/src/getPkgInfo.ts @@ -1,15 +1,17 @@ -import path from 'path' -import { pathAbsolute } from 'path-absolute' import { readFile } from 'fs/promises' -import { readPackageJson } from '@pnpm/read-package-json' +import path from 'path' + import { depPathToFilename } from '@pnpm/dependency-path' -import pLimit from 'p-limit' -import type { PackageManifest, Registries } from '@pnpm/types' +import { PnpmError } from '@pnpm/error' +import { type PackageSnapshot, pkgSnapshotToResolution } from '@pnpm/lockfile.utils' +import { readPackageJson } from '@pnpm/read-package-json' import type { StoreIndex } from '@pnpm/store.index' import { readPackageFileMap } from '@pnpm/store.pkg-finder' -import { PnpmError } from '@pnpm/error' +import type { PackageManifest, Registries } from '@pnpm/types' +import pLimit from 'p-limit' +import { pathAbsolute } from 'path-absolute' + import type { LicensePackage } from './licenses.js' -import { type PackageSnapshot, pkgSnapshotToResolution } from '@pnpm/lockfile.utils' const limitPkgReads = pLimit(4) diff --git a/reviewing/license-scanner/src/index.ts b/reviewing/license-scanner/src/index.ts index 76955929fa..5d3dbe5a1e 100644 --- a/reviewing/license-scanner/src/index.ts +++ b/reviewing/license-scanner/src/index.ts @@ -1 +1 @@ -export { type LicensePackage, findDependencyLicenses } from './licenses.js' +export { findDependencyLicenses, type LicensePackage } from './licenses.js' diff --git a/reviewing/license-scanner/src/licenses.ts b/reviewing/license-scanner/src/licenses.ts index a8cddc4075..75a24c110b 100644 --- a/reviewing/license-scanner/src/licenses.ts +++ b/reviewing/license-scanner/src/licenses.ts @@ -1,19 +1,20 @@ import { PnpmError } from '@pnpm/error' -import type { LockfileObject } from '@pnpm/lockfile.fs' import { detectDepTypes } from '@pnpm/lockfile.detect-dep-types' +import type { LockfileObject } from '@pnpm/lockfile.fs' import type { - SupportedArchitectures, DependenciesField, IncludedDependencies, ProjectId, ProjectManifest, Registries, + SupportedArchitectures, } from '@pnpm/types' +import semver from 'semver' + import { type LicenseNode, lockfileToLicenseNodeTree, } from './lockfileToLicenseNodeTree.js' -import semver from 'semver' export interface LicensePackage { belongsTo: DependenciesField diff --git a/reviewing/license-scanner/src/lockfileToLicenseNodeTree.ts b/reviewing/license-scanner/src/lockfileToLicenseNodeTree.ts index 4944f18d20..f8cbe05693 100644 --- a/reviewing/license-scanner/src/lockfileToLicenseNodeTree.ts +++ b/reviewing/license-scanner/src/lockfileToLicenseNodeTree.ts @@ -1,14 +1,15 @@ +import { DepType, type DepTypes, detectDepTypes } from '@pnpm/lockfile.detect-dep-types' import type { LockfileObject, TarballResolution } from '@pnpm/lockfile.types' import { nameVerFromPkgSnapshot, packageIdFromSnapshot } from '@pnpm/lockfile.utils' -import { packageIsInstallable } from '@pnpm/package-is-installable' import { lockfileWalkerGroupImporterSteps, type LockfileWalkerStep, } from '@pnpm/lockfile.walker' -import { type DepTypes, DepType, detectDepTypes } from '@pnpm/lockfile.detect-dep-types' +import { packageIsInstallable } from '@pnpm/package-is-installable' import { StoreIndex } from '@pnpm/store.index' -import type { SupportedArchitectures, DependenciesField, ProjectId, Registries } from '@pnpm/types' +import type { DependenciesField, ProjectId, Registries, SupportedArchitectures } from '@pnpm/types' import { map as mapValues } from 'ramda' + import { getPkgInfo } from './getPkgInfo.js' export interface LicenseNode { diff --git a/reviewing/license-scanner/test/getPkgInfo.spec.ts b/reviewing/license-scanner/test/getPkgInfo.spec.ts index b6cbe040c7..16bbf0140a 100644 --- a/reviewing/license-scanner/test/getPkgInfo.spec.ts +++ b/reviewing/license-scanner/test/getPkgInfo.spec.ts @@ -1,7 +1,9 @@ import fs from 'fs' import os from 'os' import path from 'path' + import { StoreIndex } from '@pnpm/store.index' + import { getPkgInfo } from '../lib/getPkgInfo.js' export const DEFAULT_REGISTRIES = { diff --git a/reviewing/license-scanner/test/licenses.spec.ts b/reviewing/license-scanner/test/licenses.spec.ts index 5e0d378f31..f370d8ae19 100644 --- a/reviewing/license-scanner/test/licenses.spec.ts +++ b/reviewing/license-scanner/test/licenses.spec.ts @@ -1,12 +1,14 @@ import fs from 'fs' import os from 'os' import path from 'path' -import { LOCKFILE_VERSION } from '@pnpm/constants' -import type { DepPath, ProjectManifest, Registries, ProjectId } from '@pnpm/types' -import type { LockfileObject } from '@pnpm/lockfile.fs' + import { jest } from '@jest/globals' -import type { LicensePackage } from '../lib/licenses.js' +import { LOCKFILE_VERSION } from '@pnpm/constants' +import type { LockfileObject } from '@pnpm/lockfile.fs' +import type { DepPath, ProjectId, ProjectManifest, Registries } from '@pnpm/types' + import type { GetPackageInfoOptions, PackageInfo } from '../lib/getPkgInfo.js' +import type { LicensePackage } from '../lib/licenses.js' const tmpStoreDir = fs.mkdtempSync(path.join(os.tmpdir(), 'pnpm-license-spec-')) afterAll(() => { diff --git a/reviewing/list/src/getPkgInfo.ts b/reviewing/list/src/getPkgInfo.ts index 9c7ff52757..65e35317ce 100644 --- a/reviewing/list/src/getPkgInfo.ts +++ b/reviewing/list/src/getPkgInfo.ts @@ -1,5 +1,7 @@ -import type { ProjectManifest } from '@pnpm/types' import path from 'path' + +import type { ProjectManifest } from '@pnpm/types' + import { readPkg } from './readPkg.js' interface PkgData { diff --git a/reviewing/list/src/index.ts b/reviewing/list/src/index.ts index 86c7e8e4f3..b60a5e43e1 100644 --- a/reviewing/list/src/index.ts +++ b/reviewing/list/src/index.ts @@ -1,23 +1,25 @@ import path from 'path' + import { readCurrentLockfile, readWantedLockfile } from '@pnpm/lockfile.fs' import { safeReadProjectManifestOnly } from '@pnpm/read-project-manifest' -import { type DependencyNode, buildDependenciesTree, type DependenciesTree, createPackagesSearcher, buildDependentsTree, type ImporterInfo } from '@pnpm/reviewing.dependencies-hierarchy' -import type { DependenciesField, Registries, Finder } from '@pnpm/types' +import { buildDependenciesTree, buildDependentsTree, createPackagesSearcher, type DependenciesTree, type DependencyNode, type ImporterInfo } from '@pnpm/reviewing.dependencies-hierarchy' +import type { DependenciesField, Finder, Registries } from '@pnpm/types' + +import { renderDependentsJson, renderDependentsParseable, renderDependentsTree } from './renderDependentsTree.js' import { renderJson } from './renderJson.js' import { renderParseable } from './renderParseable.js' import { renderTree } from './renderTree.js' -import { renderDependentsTree, renderDependentsJson, renderDependentsParseable } from './renderDependentsTree.js' import type { PackageDependencyHierarchy } from './types.js' export type { DependencyNode } from '@pnpm/reviewing.dependencies-hierarchy' export { + type PackageDependencyHierarchy, + renderDependentsJson, + renderDependentsParseable, + renderDependentsTree, renderJson, renderParseable, renderTree, - type PackageDependencyHierarchy, - renderDependentsTree, - renderDependentsParseable, - renderDependentsJson, } const DEFAULTS = { diff --git a/reviewing/list/src/renderDependentsTree.ts b/reviewing/list/src/renderDependentsTree.ts index 5553af9671..94262a87ce 100644 --- a/reviewing/list/src/renderDependentsTree.ts +++ b/reviewing/list/src/renderDependentsTree.ts @@ -1,8 +1,9 @@ -import type { DependentsTree, DependentNode } from '@pnpm/reviewing.dependencies-hierarchy' +import type { DependentNode, DependentsTree } from '@pnpm/reviewing.dependencies-hierarchy' import { renderTree as renderArchyTree, type TreeNode } from '@pnpm/text.tree-renderer' import chalk from 'chalk' -import { collectHashes, DEDUPED_LABEL, filterMultiPeerEntries, nameAtVersion, peerHashSuffix } from './peerVariants.js' + import { getPkgInfo } from './getPkgInfo.js' +import { collectHashes, DEDUPED_LABEL, filterMultiPeerEntries, nameAtVersion, peerHashSuffix } from './peerVariants.js' export async function renderDependentsTree (trees: DependentsTree[], opts: { long: boolean, depth?: number }): Promise { if (trees.length === 0) return '' diff --git a/reviewing/list/src/renderJson.ts b/reviewing/list/src/renderJson.ts index 851f46db5b..ca35413aa9 100644 --- a/reviewing/list/src/renderJson.ts +++ b/reviewing/list/src/renderJson.ts @@ -1,6 +1,7 @@ -import { DEPENDENCIES_FIELDS } from '@pnpm/types' import type { DependencyNode } from '@pnpm/reviewing.dependencies-hierarchy' -import { sortBy, path, type Ord } from 'ramda' +import { DEPENDENCIES_FIELDS } from '@pnpm/types' +import { type Ord, path, sortBy } from 'ramda' + import { getPkgInfo, type PkgInfo } from './getPkgInfo.js' import type { PackageDependencyHierarchy } from './types.js' diff --git a/reviewing/list/src/renderParseable.ts b/reviewing/list/src/renderParseable.ts index 7d33331b90..ad000553c6 100644 --- a/reviewing/list/src/renderParseable.ts +++ b/reviewing/list/src/renderParseable.ts @@ -1,5 +1,6 @@ import type { DependencyNode } from '@pnpm/reviewing.dependencies-hierarchy' -import { sortBy, prop } from 'ramda' +import { prop, sortBy } from 'ramda' + import type { PackageDependencyHierarchy } from './types.js' const sortPackages = sortBy(prop('name')) diff --git a/reviewing/list/src/renderTree.ts b/reviewing/list/src/renderTree.ts index 02b1406dbd..0b5ee14ade 100644 --- a/reviewing/list/src/renderTree.ts +++ b/reviewing/list/src/renderTree.ts @@ -1,9 +1,11 @@ import path from 'path' + import type { DependencyNode } from '@pnpm/reviewing.dependencies-hierarchy' import { renderTree as renderArchyTree, type TreeNode, type TreeNodeGroup } from '@pnpm/text.tree-renderer' import { DEPENDENCIES_FIELDS, type DependenciesField } from '@pnpm/types' import { lexCompare } from '@pnpm/util.lex-comparator' import chalk from 'chalk' + import { getPkgInfo } from './getPkgInfo.js' import { collectHashes, DEDUPED_LABEL, filterMultiPeerEntries, nameAtVersion, peerHashSuffix } from './peerVariants.js' import type { PackageDependencyHierarchy } from './types.js' diff --git a/reviewing/list/test/index.ts b/reviewing/list/test/index.ts index 36ac552278..e480763ba1 100644 --- a/reviewing/list/test/index.ts +++ b/reviewing/list/test/index.ts @@ -1,10 +1,12 @@ /// import path from 'path' + import { list, listForPackages } from '@pnpm/list' import { fixtures } from '@pnpm/test-fixtures' import chalk from 'chalk' -import { renderTree } from '../lib/renderTree.js' + import { renderParseable } from '../lib/renderParseable.js' +import { renderTree } from '../lib/renderTree.js' const DEV_DEP_ONLY_CLR = chalk.yellow const PROD_DEP_CLR = (s: string) => s // just use the default color diff --git a/reviewing/list/test/renderDependentsTree.test.ts b/reviewing/list/test/renderDependentsTree.test.ts index 2bef696e56..5cfccc2ff4 100644 --- a/reviewing/list/test/renderDependentsTree.test.ts +++ b/reviewing/list/test/renderDependentsTree.test.ts @@ -1,7 +1,9 @@ import { stripVTControlCharacters as stripAnsi } from 'util' -import { renderDependentsTree, renderDependentsJson, renderDependentsParseable } from '../lib/renderDependentsTree.js' + import type { DependentsTree } from '@pnpm/reviewing.dependencies-hierarchy' +import { renderDependentsJson, renderDependentsParseable, renderDependentsTree } from '../lib/renderDependentsTree.js' + // Shared fixture: target → mid-a → root-project (2 levels of dependents) function deepTree (): DependentsTree[] { return [ diff --git a/reviewing/outdated/src/createManifestGetter.ts b/reviewing/outdated/src/createManifestGetter.ts index ca710da374..99dca44fae 100644 --- a/reviewing/outdated/src/createManifestGetter.ts +++ b/reviewing/outdated/src/createManifestGetter.ts @@ -4,7 +4,7 @@ import { type ResolveFunction, } from '@pnpm/client' import { createPackageVersionPolicy } from '@pnpm/config.version-policy' -import type { PackageVersionPolicy, DependencyManifest } from '@pnpm/types' +import type { DependencyManifest, PackageVersionPolicy } from '@pnpm/types' interface GetManifestOpts { dir: string diff --git a/reviewing/outdated/src/index.ts b/reviewing/outdated/src/index.ts index c59784009e..0a34c372b0 100644 --- a/reviewing/outdated/src/index.ts +++ b/reviewing/outdated/src/index.ts @@ -1,2 +1,2 @@ -export { outdatedDepsOfProjects } from './outdatedDepsOfProjects.js' export type { OutdatedPackage } from './outdated.js' +export { outdatedDepsOfProjects } from './outdatedDepsOfProjects.js' diff --git a/reviewing/outdated/src/outdated.ts b/reviewing/outdated/src/outdated.ts index 4620986375..276b4c763c 100644 --- a/reviewing/outdated/src/outdated.ts +++ b/reviewing/outdated/src/outdated.ts @@ -1,12 +1,14 @@ import { + type CatalogResolutionFound, matchCatalogResolveResult, resolveFromCatalog, - type CatalogResolutionFound, type WantedDependency, } from '@pnpm/catalogs.resolver' import type { Catalogs } from '@pnpm/catalogs.types' import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' +import * as dp from '@pnpm/dependency-path' import { PnpmError } from '@pnpm/error' +import { createReadPackageHook } from '@pnpm/hooks.read-package-hook' import { getLockfileImporterId, type LockfileObject, @@ -14,21 +16,19 @@ import { } from '@pnpm/lockfile.fs' import { nameVerFromPkgSnapshot } from '@pnpm/lockfile.utils' import { getAllDependenciesFromManifest } from '@pnpm/manifest-utils' +import { createMatcher } from '@pnpm/matcher' import { parseBareSpecifier } from '@pnpm/npm-resolver' +import { parseOverrides } from '@pnpm/parse-overrides' import { pickRegistryForPackage } from '@pnpm/pick-registry-for-package' import { - type DependenciesField, DEPENDENCIES_FIELDS, + type DependenciesField, type IncludedDependencies, type PackageManifest, type ProjectManifest, type Registries, } from '@pnpm/types' -import * as dp from '@pnpm/dependency-path' import semver from 'semver' -import { createMatcher } from '@pnpm/matcher' -import { createReadPackageHook } from '@pnpm/hooks.read-package-hook' -import { parseOverrides } from '@pnpm/parse-overrides' export * from './createManifestGetter.js' diff --git a/reviewing/outdated/src/outdatedDepsOfProjects.ts b/reviewing/outdated/src/outdatedDepsOfProjects.ts index 5aa0097707..4667b65797 100644 --- a/reviewing/outdated/src/outdatedDepsOfProjects.ts +++ b/reviewing/outdated/src/outdatedDepsOfProjects.ts @@ -1,4 +1,5 @@ import path from 'path' + import type { Catalogs } from '@pnpm/catalogs.types' import { readCurrentLockfile, @@ -11,6 +12,7 @@ import type { ProjectRootDir, } from '@pnpm/types' import { unnest } from 'ramda' + import { createManifestGetter, type ManifestGetterOptions } from './createManifestGetter.js' import { outdated, type OutdatedPackage } from './outdated.js' diff --git a/reviewing/outdated/test/getManifest.spec.ts b/reviewing/outdated/test/getManifest.spec.ts index 621b15be20..5785758b8e 100644 --- a/reviewing/outdated/test/getManifest.spec.ts +++ b/reviewing/outdated/test/getManifest.spec.ts @@ -1,6 +1,7 @@ import { jest } from '@jest/globals' import type { ResolveFunction } from '@pnpm/client' import type { PkgResolutionId, TarballResolution } from '@pnpm/resolver-base' + import { getManifest } from '../lib/createManifestGetter.js' test('getManifest()', async () => { diff --git a/reviewing/outdated/test/outdated.spec.ts b/reviewing/outdated/test/outdated.spec.ts index 1e58ed7ca5..5d95bc4163 100644 --- a/reviewing/outdated/test/outdated.spec.ts +++ b/reviewing/outdated/test/outdated.spec.ts @@ -1,5 +1,6 @@ import { LOCKFILE_VERSION } from '@pnpm/constants' import type { DepPath, ProjectId } from '@pnpm/types' + import { outdated } from '../lib/outdated.js' async function getLatestManifest (packageName: string) { diff --git a/reviewing/plugin-commands-licenses/src/licenses.ts b/reviewing/plugin-commands-licenses/src/licenses.ts index 763ccc232d..50f9433b32 100644 --- a/reviewing/plugin-commands-licenses/src/licenses.ts +++ b/reviewing/plugin-commands-licenses/src/licenses.ts @@ -8,8 +8,9 @@ import { types as allTypes } from '@pnpm/config' import { PnpmError } from '@pnpm/error' import { pick } from 'ramda' import { renderHelp } from 'render-help' + import type { LicensesCommandResult } from './LicensesCommandResult.js' -import { licensesList, type LicensesCommandOptions } from './licensesList.js' +import { type LicensesCommandOptions, licensesList } from './licensesList.js' export function rcOptionsTypes (): Record { return { diff --git a/reviewing/plugin-commands-licenses/src/licensesList.ts b/reviewing/plugin-commands-licenses/src/licensesList.ts index 65194e9a88..cbafc357c0 100644 --- a/reviewing/plugin-commands-licenses/src/licensesList.ts +++ b/reviewing/plugin-commands-licenses/src/licensesList.ts @@ -1,11 +1,13 @@ import path from 'path' + import { readProjectManifestOnly } from '@pnpm/cli-utils' import { type Config, getOptionsFromRootManifest } from '@pnpm/config' -import { PnpmError } from '@pnpm/error' -import { getStorePath } from '@pnpm/store-path' import { WANTED_LOCKFILE } from '@pnpm/constants' -import { getLockfileImporterId, readWantedLockfile } from '@pnpm/lockfile.fs' +import { PnpmError } from '@pnpm/error' import { findDependencyLicenses } from '@pnpm/license-scanner' +import { getLockfileImporterId, readWantedLockfile } from '@pnpm/lockfile.fs' +import { getStorePath } from '@pnpm/store-path' + import type { LicensesCommandResult } from './LicensesCommandResult.js' import { renderLicences } from './outputRenderer.js' diff --git a/reviewing/plugin-commands-licenses/src/outputRenderer.ts b/reviewing/plugin-commands-licenses/src/outputRenderer.ts index 5fb683c472..526a66a92e 100644 --- a/reviewing/plugin-commands-licenses/src/outputRenderer.ts +++ b/reviewing/plugin-commands-licenses/src/outputRenderer.ts @@ -1,9 +1,10 @@ import { TABLE_OPTIONS } from '@pnpm/cli-utils' import type { LicensePackage } from '@pnpm/license-scanner' -import chalk from 'chalk' import { table } from '@zkochan/table' -import { groupBy, sortWith, omit, pick } from 'ramda' +import chalk from 'chalk' +import { groupBy, omit, pick, sortWith } from 'ramda' import semver from 'semver' + import type { LicensesCommandResult } from './LicensesCommandResult.js' function sortLicensesPackages (licensePackages: readonly LicensePackage[]): LicensePackage[] { diff --git a/reviewing/plugin-commands-licenses/test/index.ts b/reviewing/plugin-commands-licenses/test/index.ts index 4d01694064..4e643fbbd9 100644 --- a/reviewing/plugin-commands-licenses/test/index.ts +++ b/reviewing/plugin-commands-licenses/test/index.ts @@ -1,15 +1,17 @@ /// -import path from 'path' import fs from 'fs' +import path from 'path' +import { stripVTControlCharacters as stripAnsi } from 'util' + import { STORE_VERSION } from '@pnpm/constants' -import { licenses } from '@pnpm/plugin-commands-licenses' import { install } from '@pnpm/plugin-commands-installation' +import { licenses } from '@pnpm/plugin-commands-licenses' import { tempDir } from '@pnpm/prepare' import { fixtures } from '@pnpm/test-fixtures' -import { stripVTControlCharacters as stripAnsi } from 'util' -import { DEFAULT_OPTS } from './utils/index.js' import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' +import { DEFAULT_OPTS } from './utils/index.js' + const f = fixtures(import.meta.dirname) test('pnpm licenses', async () => { diff --git a/reviewing/plugin-commands-listing/src/list.ts b/reviewing/plugin-commands-listing/src/list.ts index 4373c61099..eaf626834b 100644 --- a/reviewing/plugin-commands-listing/src/list.ts +++ b/reviewing/plugin-commands-listing/src/list.ts @@ -6,7 +6,8 @@ import { list, listForPackages } from '@pnpm/list' import type { Finder, IncludedDependencies } from '@pnpm/types' import { pick } from 'ramda' import { renderHelp } from 'render-help' -import { computeInclude, resolveFinders, determineReportAs, SHARED_CLI_HELP_OPTIONS, BASE_RC_OPTION_KEYS } from './common.js' + +import { BASE_RC_OPTION_KEYS, computeInclude, determineReportAs, resolveFinders, SHARED_CLI_HELP_OPTIONS } from './common.js' import { listRecursive } from './recursive.js' export const EXCLUDE_PEERS_HELP = { diff --git a/reviewing/plugin-commands-listing/src/ll.ts b/reviewing/plugin-commands-listing/src/ll.ts index d0a6d1f91e..1c9f58f5f9 100644 --- a/reviewing/plugin-commands-listing/src/ll.ts +++ b/reviewing/plugin-commands-listing/src/ll.ts @@ -1,4 +1,5 @@ import { omit } from 'ramda' + import * as list from './list.js' export const commandNames = ['ll', 'la'] diff --git a/reviewing/plugin-commands-listing/src/recursive.ts b/reviewing/plugin-commands-listing/src/recursive.ts index 8e32018a11..a072b1ffe4 100644 --- a/reviewing/plugin-commands-listing/src/recursive.ts +++ b/reviewing/plugin-commands-listing/src/recursive.ts @@ -1,8 +1,10 @@ import assert from 'assert' import util from 'util' + import type { Config } from '@pnpm/config' import { logger } from '@pnpm/logger' import type { IncludedDependencies, Project } from '@pnpm/types' + import { render } from './list.js' export async function listRecursive ( diff --git a/reviewing/plugin-commands-listing/src/why.ts b/reviewing/plugin-commands-listing/src/why.ts index 0138aebf8f..941cbdb581 100644 --- a/reviewing/plugin-commands-listing/src/why.ts +++ b/reviewing/plugin-commands-listing/src/why.ts @@ -5,8 +5,9 @@ import { PnpmError } from '@pnpm/error' import { whyForPackages } from '@pnpm/list' import { pick } from 'ramda' import { renderHelp } from 'render-help' -import { computeInclude, resolveFinders, determineReportAs, SHARED_CLI_HELP_OPTIONS, BASE_RC_OPTION_KEYS } from './common.js' -import { type ListCommandOptions, EXCLUDE_PEERS_HELP } from './list.js' + +import { BASE_RC_OPTION_KEYS, computeInclude, determineReportAs, resolveFinders, SHARED_CLI_HELP_OPTIONS } from './common.js' +import { EXCLUDE_PEERS_HELP, type ListCommandOptions } from './list.js' export function rcOptionsTypes (): Record { return pick([...BASE_RC_OPTION_KEYS, 'depth'], allTypes) diff --git a/reviewing/plugin-commands-listing/test/index.ts b/reviewing/plugin-commands-listing/test/index.ts index e95fda4d80..e0d614fc32 100644 --- a/reviewing/plugin-commands-listing/test/index.ts +++ b/reviewing/plugin-commands-listing/test/index.ts @@ -1,11 +1,11 @@ /// import path from 'path' +import { stripVTControlCharacters as stripAnsi } from 'util' + import { WANTED_LOCKFILE } from '@pnpm/constants' import { list, why } from '@pnpm/plugin-commands-listing' import { prepare, preparePackages } from '@pnpm/prepare' - import { safeExeca as execa } from 'execa' -import { stripVTControlCharacters as stripAnsi } from 'util' import { writeYamlFileSync } from 'write-yaml-file' const pnpmBin = path.join(import.meta.dirname, '../../../pnpm/bin/pnpm.mjs') diff --git a/reviewing/plugin-commands-listing/test/json.ts b/reviewing/plugin-commands-listing/test/json.ts index b6ac39fbaf..8b7324d496 100644 --- a/reviewing/plugin-commands-listing/test/json.ts +++ b/reviewing/plugin-commands-listing/test/json.ts @@ -1,5 +1,6 @@ import { list } from '@pnpm/plugin-commands-listing' import { prepare } from '@pnpm/prepare' + import { DEFAULT_OPTS } from './utils/index.js' // Covers https://github.com/pnpm/pnpm/issues/8519 diff --git a/reviewing/plugin-commands-listing/test/recursive.ts b/reviewing/plugin-commands-listing/test/recursive.ts index 8e987edfc4..b55e370341 100644 --- a/reviewing/plugin-commands-listing/test/recursive.ts +++ b/reviewing/plugin-commands-listing/test/recursive.ts @@ -1,12 +1,14 @@ import path from 'path' +import { stripVTControlCharacters as stripAnsi } from 'util' + import type { PnpmError } from '@pnpm/error' -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { install } from '@pnpm/plugin-commands-installation' import { list, why } from '@pnpm/plugin-commands-listing' import { prepare, preparePackages } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' -import { stripVTControlCharacters as stripAnsi } from 'util' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' import { writeYamlFileSync } from 'write-yaml-file' + import { DEFAULT_OPTS } from './utils/index.js' test('recursive list', async () => { diff --git a/reviewing/plugin-commands-listing/test/why.ts b/reviewing/plugin-commands-listing/test/why.ts index 27c0c07bc4..43f9b95e49 100644 --- a/reviewing/plugin-commands-listing/test/why.ts +++ b/reviewing/plugin-commands-listing/test/why.ts @@ -1,11 +1,12 @@ -import path from 'path' import fs from 'fs' +import path from 'path' +import { stripVTControlCharacters as stripAnsi } from 'util' + import type { PnpmError } from '@pnpm/error' import { why } from '@pnpm/plugin-commands-listing' import { prepare } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { safeExeca as execa } from 'execa' -import { stripVTControlCharacters as stripAnsi } from 'util' const pnpmBin = path.join(import.meta.dirname, '../../../pnpm/bin/pnpm.mjs') diff --git a/reviewing/plugin-commands-outdated/src/outdated.ts b/reviewing/plugin-commands-outdated/src/outdated.ts index d0749dbb04..8d91389837 100644 --- a/reviewing/plugin-commands-outdated/src/outdated.ts +++ b/reviewing/plugin-commands-outdated/src/outdated.ts @@ -1,3 +1,5 @@ +import { stripVTControlCharacters as stripAnsi } from 'util' + import { docsUrl, readDepNameCompletions, @@ -20,13 +22,13 @@ import { table } from '@zkochan/table' import chalk from 'chalk' import { pick, sortWith } from 'ramda' import { renderHelp } from 'render-help' -import { stripVTControlCharacters as stripAnsi } from 'util' + +import { outdatedRecursive } from './recursive.js' import { DEFAULT_COMPARATORS, NAME_COMPARATOR, type OutdatedWithVersionDiff, } from './utils.js' -import { outdatedRecursive } from './recursive.js' export function rcOptionsTypes (): Record { return { diff --git a/reviewing/plugin-commands-outdated/src/recursive.ts b/reviewing/plugin-commands-outdated/src/recursive.ts index a50daf8048..329b00b6b5 100644 --- a/reviewing/plugin-commands-outdated/src/recursive.ts +++ b/reviewing/plugin-commands-outdated/src/recursive.ts @@ -13,6 +13,7 @@ import type { import { table } from '@zkochan/table' import chalk from 'chalk' import { isEmpty, sortWith } from 'ramda' + import { getCellWidth, type OutdatedCommandOptions, diff --git a/reviewing/plugin-commands-outdated/test/index.ts b/reviewing/plugin-commands-outdated/test/index.ts index 728850ec8d..c506535259 100644 --- a/reviewing/plugin-commands-outdated/test/index.ts +++ b/reviewing/plugin-commands-outdated/test/index.ts @@ -1,13 +1,14 @@ /// import fs from 'fs' import path from 'path' +import { stripVTControlCharacters as stripAnsi } from 'util' + import { WANTED_LOCKFILE } from '@pnpm/constants' import type { PnpmError } from '@pnpm/error' import { outdated } from '@pnpm/plugin-commands-outdated' import { prepare, tempDir } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { fixtures } from '@pnpm/test-fixtures' -import { stripVTControlCharacters as stripAnsi } from 'util' import symlinkDir from 'symlink-dir' const f = fixtures(import.meta.dirname) diff --git a/reviewing/plugin-commands-outdated/test/recursive.ts b/reviewing/plugin-commands-outdated/test/recursive.ts index bc286b0e9a..52b1c66f40 100644 --- a/reviewing/plugin-commands-outdated/test/recursive.ts +++ b/reviewing/plugin-commands-outdated/test/recursive.ts @@ -1,9 +1,11 @@ import path from 'path' -import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' +import { stripVTControlCharacters as stripAnsi } from 'util' + import { install } from '@pnpm/plugin-commands-installation' import { outdated } from '@pnpm/plugin-commands-outdated' import { preparePackages } from '@pnpm/prepare' -import { stripVTControlCharacters as stripAnsi } from 'util' +import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir' + import { DEFAULT_OPTS, DEFAULT_OUTDATED_OPTS } from './utils/index.js' test('pnpm recursive outdated', async () => { diff --git a/reviewing/plugin-commands-outdated/test/renderLatest.test.ts b/reviewing/plugin-commands-outdated/test/renderLatest.test.ts index 37e6bbc1ba..76b92e9808 100644 --- a/reviewing/plugin-commands-outdated/test/renderLatest.test.ts +++ b/reviewing/plugin-commands-outdated/test/renderLatest.test.ts @@ -1,7 +1,9 @@ import { stripVTControlCharacters as stripAnsi } from 'util' + import { outdated } from '@pnpm/plugin-commands-outdated' import semverDiff from '@pnpm/semver-diff' import type { PackageManifest } from '@pnpm/types' + import type { OutdatedWithVersionDiff } from '../src/utils.js' test('renderLatest: outdated and deprecated', () => { diff --git a/reviewing/plugin-commands-sbom/src/sbom.ts b/reviewing/plugin-commands-sbom/src/sbom.ts index e80a68fafd..af9a640ec5 100644 --- a/reviewing/plugin-commands-sbom/src/sbom.ts +++ b/reviewing/plugin-commands-sbom/src/sbom.ts @@ -1,18 +1,18 @@ +import { packageManager } from '@pnpm/cli-meta' import { docsUrl, readProjectManifestOnly } from '@pnpm/cli-utils' -import { type Config, types as allTypes } from '@pnpm/config' import { FILTERING } from '@pnpm/common-cli-options-help' +import { type Config, types as allTypes } from '@pnpm/config' import { WANTED_LOCKFILE } from '@pnpm/constants' import { PnpmError } from '@pnpm/error' import { getLockfileImporterId, readWantedLockfile } from '@pnpm/lockfile.fs' -import { getStorePath } from '@pnpm/store-path' -import { packageManager } from '@pnpm/cli-meta' import { collectSbomComponents, + type SbomComponentType, + type SbomFormat, serializeCycloneDx, serializeSpdx, - type SbomFormat, - type SbomComponentType, } from '@pnpm/sbom' +import { getStorePath } from '@pnpm/store-path' import { pick } from 'ramda' import { renderHelp } from 'render-help' diff --git a/reviewing/plugin-commands-sbom/test/index.ts b/reviewing/plugin-commands-sbom/test/index.ts index e5b50f58bb..98859cf015 100644 --- a/reviewing/plugin-commands-sbom/test/index.ts +++ b/reviewing/plugin-commands-sbom/test/index.ts @@ -1,10 +1,12 @@ /// import path from 'path' + import { STORE_VERSION } from '@pnpm/constants' -import { sbom } from '@pnpm/plugin-commands-sbom' import { install } from '@pnpm/plugin-commands-installation' +import { sbom } from '@pnpm/plugin-commands-sbom' import { tempDir } from '@pnpm/prepare' import { fixtures } from '@pnpm/test-fixtures' + import { DEFAULT_OPTS } from './utils/index.js' const f = fixtures(import.meta.dirname) diff --git a/reviewing/sbom/src/collectComponents.ts b/reviewing/sbom/src/collectComponents.ts index 83a746dbbc..2ee6c6ad11 100644 --- a/reviewing/sbom/src/collectComponents.ts +++ b/reviewing/sbom/src/collectComponents.ts @@ -1,15 +1,16 @@ +import { DepType, type DepTypes, detectDepTypes } from '@pnpm/lockfile.detect-dep-types' import type { LockfileObject, TarballResolution } from '@pnpm/lockfile.types' import { nameVerFromPkgSnapshot, pkgSnapshotToResolution } from '@pnpm/lockfile.utils' import { lockfileWalkerGroupImporterSteps, type LockfileWalkerStep, } from '@pnpm/lockfile.walker' -import { type DepTypes, DepType, detectDepTypes } from '@pnpm/lockfile.detect-dep-types' -import type { DependenciesField, ProjectId, Registries } from '@pnpm/types' import { StoreIndex } from '@pnpm/store.index' -import { buildPurl, encodePurlName } from './purl.js' +import type { DependenciesField, ProjectId, Registries } from '@pnpm/types' + import { getPkgMetadata, type GetPkgMetadataOptions } from './getPkgMetadata.js' -import type { SbomComponent, SbomRelationship, SbomResult, SbomComponentType } from './types.js' +import { buildPurl, encodePurlName } from './purl.js' +import type { SbomComponent, SbomComponentType, SbomRelationship, SbomResult } from './types.js' export interface CollectSbomComponentsOptions { lockfile: LockfileObject diff --git a/reviewing/sbom/src/getPkgMetadata.ts b/reviewing/sbom/src/getPkgMetadata.ts index af89d28aea..65bf1e6ac2 100644 --- a/reviewing/sbom/src/getPkgMetadata.ts +++ b/reviewing/sbom/src/getPkgMetadata.ts @@ -1,8 +1,8 @@ -import type { PackageManifest, Registries } from '@pnpm/types' +import { type PackageSnapshot, pkgSnapshotToResolution } from '@pnpm/lockfile.utils' +import { readPackageJson } from '@pnpm/read-package-json' import type { StoreIndex } from '@pnpm/store.index' import { readPackageFileMap } from '@pnpm/store.pkg-finder' -import { readPackageJson } from '@pnpm/read-package-json' -import { type PackageSnapshot, pkgSnapshotToResolution } from '@pnpm/lockfile.utils' +import type { PackageManifest, Registries } from '@pnpm/types' import pLimit from 'p-limit' const limitMetadataReads = pLimit(4) diff --git a/reviewing/sbom/src/index.ts b/reviewing/sbom/src/index.ts index 482a32488f..924460b357 100644 --- a/reviewing/sbom/src/index.ts +++ b/reviewing/sbom/src/index.ts @@ -1,6 +1,6 @@ export { collectSbomComponents, type CollectSbomComponentsOptions } from './collectComponents.js' -export { serializeCycloneDx, type CycloneDxOptions } from './serializeCycloneDx.js' -export { serializeSpdx } from './serializeSpdx.js' -export { buildPurl, encodePurlName } from './purl.js' export { integrityToHashes } from './integrity.js' -export type { SbomComponent, SbomRelationship, SbomResult, SbomFormat, SbomComponentType } from './types.js' +export { buildPurl, encodePurlName } from './purl.js' +export { type CycloneDxOptions, serializeCycloneDx } from './serializeCycloneDx.js' +export { serializeSpdx } from './serializeSpdx.js' +export type { SbomComponent, SbomComponentType, SbomFormat, SbomRelationship, SbomResult } from './types.js' diff --git a/reviewing/sbom/src/serializeCycloneDx.ts b/reviewing/sbom/src/serializeCycloneDx.ts index 3655a01548..6363271f78 100644 --- a/reviewing/sbom/src/serializeCycloneDx.ts +++ b/reviewing/sbom/src/serializeCycloneDx.ts @@ -1,4 +1,5 @@ import crypto from 'crypto' + import { integrityToHashes } from './integrity.js' import { classifyLicense } from './license.js' import { encodePurlName } from './purl.js' diff --git a/reviewing/sbom/src/serializeSpdx.ts b/reviewing/sbom/src/serializeSpdx.ts index 94ac290ee0..237247b34d 100644 --- a/reviewing/sbom/src/serializeSpdx.ts +++ b/reviewing/sbom/src/serializeSpdx.ts @@ -1,4 +1,5 @@ import crypto from 'crypto' + import { integrityToHashes } from './integrity.js' import { encodePurlName } from './purl.js' import type { SbomResult } from './types.js' diff --git a/reviewing/sbom/test/license.test.ts b/reviewing/sbom/test/license.test.ts index c4ef5d8ce3..c7f001e75b 100644 --- a/reviewing/sbom/test/license.test.ts +++ b/reviewing/sbom/test/license.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from '@jest/globals' + import { classifyLicense } from '../src/license.js' describe('classifyLicense', () => { diff --git a/reviewing/sbom/test/serializeCycloneDx.test.ts b/reviewing/sbom/test/serializeCycloneDx.test.ts index 43b0b29cc8..0f7ccac67a 100644 --- a/reviewing/sbom/test/serializeCycloneDx.test.ts +++ b/reviewing/sbom/test/serializeCycloneDx.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from '@jest/globals' -import { serializeCycloneDx, type SbomResult } from '@pnpm/sbom' import { DepType } from '@pnpm/lockfile.detect-dep-types' +import { type SbomResult, serializeCycloneDx } from '@pnpm/sbom' function makeSbomResult (): SbomResult { return { diff --git a/reviewing/sbom/test/serializeSpdx.test.ts b/reviewing/sbom/test/serializeSpdx.test.ts index 1fce8cbdd4..7049aef822 100644 --- a/reviewing/sbom/test/serializeSpdx.test.ts +++ b/reviewing/sbom/test/serializeSpdx.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from '@jest/globals' -import { serializeSpdx, type SbomResult } from '@pnpm/sbom' import { DepType } from '@pnpm/lockfile.detect-dep-types' +import { type SbomResult, serializeSpdx } from '@pnpm/sbom' function makeSbomResult (): SbomResult { return { diff --git a/store/cafs/src/addFilesFromDir.ts b/store/cafs/src/addFilesFromDir.ts index 135161fa0b..db99ada8c4 100644 --- a/store/cafs/src/addFilesFromDir.ts +++ b/store/cafs/src/addFilesFromDir.ts @@ -1,6 +1,7 @@ -import util from 'util' import fs, { type Stats } from 'fs' import path from 'path' +import util from 'util' + import type { AddToStoreResult, FilesIndex, @@ -9,6 +10,7 @@ import type { import gfs from '@pnpm/graceful-fs' import type { DependencyManifest } from '@pnpm/types' import { isSubdir } from 'is-subdir' + import { parseJsonBufferSync } from './parseJson.js' export function addFilesFromDir ( diff --git a/store/cafs/src/addFilesFromTarball.ts b/store/cafs/src/addFilesFromTarball.ts index a17608013b..71a897543a 100644 --- a/store/cafs/src/addFilesFromTarball.ts +++ b/store/cafs/src/addFilesFromTarball.ts @@ -1,3 +1,5 @@ +import { gunzipSync } from 'zlib' + import type { AddToStoreResult, FilesIndex, @@ -5,7 +7,7 @@ import type { } from '@pnpm/cafs-types' import type { DependencyManifest } from '@pnpm/types' import isGzip from 'is-gzip' -import { gunzipSync } from 'zlib' + import { parseJsonBufferSync } from './parseJson.js' import { parseTarball } from './parseTarball.js' diff --git a/store/cafs/src/checkPkgFilesIntegrity.ts b/store/cafs/src/checkPkgFilesIntegrity.ts index de3ae3b236..6e7d512b25 100644 --- a/store/cafs/src/checkPkgFilesIntegrity.ts +++ b/store/cafs/src/checkPkgFilesIntegrity.ts @@ -1,11 +1,13 @@ import crypto from 'crypto' import fs from 'fs' import util from 'util' + +import type { FilesMap, PackageFileInfo, PackageFiles, SideEffects } from '@pnpm/cafs-types' import { PnpmError } from '@pnpm/error' -import type { PackageFiles, PackageFileInfo, SideEffects, FilesMap } from '@pnpm/cafs-types' import gfs from '@pnpm/graceful-fs' import type { BundledManifest } from '@pnpm/types' import { rimrafSync } from '@zkochan/rimraf' + import { getFilePathByModeInCafs } from './getFilePathInCafs.js' export interface Integrity { diff --git a/store/cafs/src/index.ts b/store/cafs/src/index.ts index 94c314cce2..0947d1d745 100644 --- a/store/cafs/src/index.ts +++ b/store/cafs/src/index.ts @@ -1,18 +1,20 @@ import crypto from 'crypto' + import type { AddToStoreResult, - FileWriteResult, - PackageFiles, - PackageFileInfo, FilesIndex, + FileWriteResult, + PackageFileInfo, + PackageFiles, SideEffects, SideEffectsDiff, } from '@pnpm/cafs-types' + import { addFilesFromDir } from './addFilesFromDir.js' import { addFilesFromTarball } from './addFilesFromTarball.js' import { - checkPkgFilesIntegrity, buildFileMapsFromIndex, + checkPkgFilesIntegrity, type Integrity, type PackageFilesIndex, type VerifyResult, @@ -32,19 +34,19 @@ export { type BundledManifest } from '@pnpm/types' export { normalizeBundledManifest } export { - checkPkgFilesIntegrity, buildFileMapsFromIndex, + checkPkgFilesIntegrity, + type FilesIndex, type FileType, getFilePathByModeInCafs, type Integrity, + optimisticRenameOverwrite, type PackageFileInfo, type PackageFiles, type PackageFilesIndex, - optimisticRenameOverwrite, - type FilesIndex, - type VerifyResult, type SideEffects, type SideEffectsDiff, + type VerifyResult, } export type CafsLocker = Map diff --git a/store/cafs/src/writeBufferToCafs.ts b/store/cafs/src/writeBufferToCafs.ts index 0885a19014..36d7334cfd 100644 --- a/store/cafs/src/writeBufferToCafs.ts +++ b/store/cafs/src/writeBufferToCafs.ts @@ -1,8 +1,10 @@ import fs from 'fs' import path from 'path' -import workerThreads from 'worker_threads' import util from 'util' +import workerThreads from 'worker_threads' + import { renameOverwriteSync } from 'rename-overwrite' + import { type Integrity, verifyFileIntegrity } from './checkPkgFilesIntegrity.js' import { writeFile } from './writeFile.js' diff --git a/store/cafs/src/writeFile.ts b/store/cafs/src/writeFile.ts index 14303377e0..4fec94111f 100644 --- a/store/cafs/src/writeFile.ts +++ b/store/cafs/src/writeFile.ts @@ -1,4 +1,5 @@ import path from 'path' + import fs from '@pnpm/graceful-fs' const dirs = new Set() diff --git a/store/cafs/test/index.ts b/store/cafs/test/index.ts index 04ef204b74..2edea99013 100644 --- a/store/cafs/test/index.ts +++ b/store/cafs/test/index.ts @@ -1,11 +1,13 @@ import fs from 'fs' import path from 'path' + +import { fixtures } from '@pnpm/test-fixtures' import symlinkDir from 'symlink-dir' import { temporaryDirectory } from 'tempy' -import { fixtures } from '@pnpm/test-fixtures' + import { - createCafs, checkPkgFilesIntegrity, + createCafs, getFilePathByModeInCafs, } from '../src/index.js' import { parseTarball } from '../src/parseTarball.js' diff --git a/store/cafs/test/optimisticRenameOverwrite.test.ts b/store/cafs/test/optimisticRenameOverwrite.test.ts index f7dc5f14b2..720a32ddeb 100644 --- a/store/cafs/test/optimisticRenameOverwrite.test.ts +++ b/store/cafs/test/optimisticRenameOverwrite.test.ts @@ -1,6 +1,8 @@ import fs from 'fs' import path from 'path' + import { temporaryDirectory } from 'tempy' + import { optimisticRenameOverwrite } from '../src/writeBufferToCafs.js' test("optimisticRenameOverwrite() doesn't crash if target file exists", () => { diff --git a/store/cafs/test/recursiveSymlink.test.ts b/store/cafs/test/recursiveSymlink.test.ts index ce1c699132..90ad7139f0 100644 --- a/store/cafs/test/recursiveSymlink.test.ts +++ b/store/cafs/test/recursiveSymlink.test.ts @@ -1,6 +1,8 @@ import fs from 'fs' import path from 'path' + import { temporaryDirectory } from 'tempy' + import { createCafs } from '../src/index.js' test('addFilesFromDir does not loop infinitely on recursive symlinks', () => { diff --git a/store/cafs/test/writeBufferToCafs.test.ts b/store/cafs/test/writeBufferToCafs.test.ts index bf4c72cd50..d89b672c49 100644 --- a/store/cafs/test/writeBufferToCafs.test.ts +++ b/store/cafs/test/writeBufferToCafs.test.ts @@ -1,7 +1,9 @@ import crypto from 'crypto' import fs from 'fs' import path from 'path' + import { temporaryDirectory } from 'tempy' + import { pathTemp, writeBufferToCafs } from '../src/writeBufferToCafs.js' describe('writeBufferToCafs', () => { diff --git a/store/create-cafs-store/src/index.ts b/store/create-cafs-store/src/index.ts index daf6dff495..ef4384558f 100644 --- a/store/create-cafs-store/src/index.ts +++ b/store/create-cafs-store/src/index.ts @@ -1,11 +1,12 @@ import { promises as fs } from 'fs' import path from 'path' + +import type { Cafs, FilesMap, PackageFilesResponse } from '@pnpm/cafs-types' +import { createIndexedPkgImporter } from '@pnpm/fs.indexed-pkg-importer' import { type CafsLocker, createCafs, } from '@pnpm/store.cafs' -import type { Cafs, PackageFilesResponse, FilesMap } from '@pnpm/cafs-types' -import { createIndexedPkgImporter } from '@pnpm/fs.indexed-pkg-importer' import type { ImportIndexedPackage, ImportIndexedPackageAsync, diff --git a/store/index/src/index.ts b/store/index/src/index.ts index f786dcf8d4..3f067a771a 100644 --- a/store/index/src/index.ts +++ b/store/index/src/index.ts @@ -1,6 +1,7 @@ -import { createRequire } from 'module' -import fs from 'fs' import type { DatabaseSync as DatabaseSyncType, StatementSync } from 'node:sqlite' +import fs from 'fs' +import { createRequire } from 'module' + import { Packr } from 'msgpackr' // Use createRequire to load node:sqlite because it is a prefix-only builtin diff --git a/store/index/test/index.ts b/store/index/test/index.ts index 5a977e6b3f..7bcb37f3fe 100644 --- a/store/index/test/index.ts +++ b/store/index/test/index.ts @@ -1,5 +1,6 @@ -import { StoreIndex, storeIndexKey } from '@pnpm/store.index' import path from 'path' + +import { StoreIndex, storeIndexKey } from '@pnpm/store.index' import { temporaryDirectory } from 'tempy' test('StoreIndex round-trips data via SQLite key', () => { diff --git a/store/package-store/src/index.ts b/store/package-store/src/index.ts index 822def99bb..7d1b4e9f2e 100644 --- a/store/package-store/src/index.ts +++ b/store/package-store/src/index.ts @@ -1,4 +1,3 @@ -export { createPackageStore, type CafsLocker, type CreatePackageStoreOptions } from './storeController/index.js' -export { registerProject, getRegisteredProjects } from './storeController/projectRegistry.js' - +export { type CafsLocker, createPackageStore, type CreatePackageStoreOptions } from './storeController/index.js' +export { getRegisteredProjects, registerProject } from './storeController/projectRegistry.js' export * from '@pnpm/store-controller-types' diff --git a/store/package-store/src/storeController/index.ts b/store/package-store/src/storeController/index.ts index 91a8ec6dc8..2992faecfe 100644 --- a/store/package-store/src/storeController/index.ts +++ b/store/package-store/src/storeController/index.ts @@ -1,16 +1,18 @@ -import path from 'path' import fs from 'fs' -import { createCafsStore, createPackageImporterAsync, type CafsLocker } from '@pnpm/create-cafs-store' +import path from 'path' + +import { type CafsLocker, createCafsStore, createPackageImporterAsync } from '@pnpm/create-cafs-store' import type { Fetchers } from '@pnpm/fetcher-base' +import type { CustomFetcher } from '@pnpm/hooks.types' import { createPackageRequester } from '@pnpm/package-requester' import type { ResolveFunction } from '@pnpm/resolver-base' +import type { StoreIndex } from '@pnpm/store.index' import type { ImportIndexedPackageAsync, StoreController, } from '@pnpm/store-controller-types' -import type { CustomFetcher } from '@pnpm/hooks.types' -import type { StoreIndex } from '@pnpm/store.index' import { addFilesFromDir, importPackage, initStoreDir } from '@pnpm/worker' + import { prune } from './prune.js' export { type CafsLocker } diff --git a/store/package-store/src/storeController/projectRegistry.ts b/store/package-store/src/storeController/projectRegistry.ts index 3c9f07acec..9d7ffd0d65 100644 --- a/store/package-store/src/storeController/projectRegistry.ts +++ b/store/package-store/src/storeController/projectRegistry.ts @@ -1,11 +1,12 @@ import { type Dirent, promises as fs } from 'fs' -import util from 'util' import path from 'path' +import util from 'util' + import { createShortHash } from '@pnpm/crypto.hash' import { PnpmError } from '@pnpm/error' import { globalInfo } from '@pnpm/logger' -import symlinkDir from 'symlink-dir' import { isSubdir } from 'is-subdir' +import symlinkDir from 'symlink-dir' const PROJECTS_DIR = 'projects' diff --git a/store/package-store/src/storeController/prune.ts b/store/package-store/src/storeController/prune.ts index f3fbb164de..e138194ed4 100644 --- a/store/package-store/src/storeController/prune.ts +++ b/store/package-store/src/storeController/prune.ts @@ -1,10 +1,12 @@ import { type Dirent, promises as fs } from 'fs' -import util from 'util' import path from 'path' -import type { StoreIndex } from '@pnpm/store.index' -import type { PackageFilesIndex } from '@pnpm/store.cafs' +import util from 'util' + import { globalInfo, globalWarn } from '@pnpm/logger' +import type { PackageFilesIndex } from '@pnpm/store.cafs' +import type { StoreIndex } from '@pnpm/store.index' import { rimraf } from '@zkochan/rimraf' + import { pruneGlobalVirtualStore } from './pruneGlobalVirtualStore.js' const BIG_ONE = BigInt(1) as unknown diff --git a/store/package-store/src/storeController/pruneGlobalVirtualStore.ts b/store/package-store/src/storeController/pruneGlobalVirtualStore.ts index 2c584f9302..2b3931ec8d 100644 --- a/store/package-store/src/storeController/pruneGlobalVirtualStore.ts +++ b/store/package-store/src/storeController/pruneGlobalVirtualStore.ts @@ -1,10 +1,12 @@ -import { type Dirent, promises as fs } from 'fs' -import util from 'util' -import path from 'path' import crypto from 'crypto' +import { type Dirent, promises as fs } from 'fs' +import path from 'path' +import util from 'util' + import { globalInfo } from '@pnpm/logger' import { rimraf } from '@zkochan/rimraf' import { isSubdir } from 'is-subdir' + import { getRegisteredProjects } from './projectRegistry.js' const LINKS_DIR = 'links' diff --git a/store/package-store/test/index.ts b/store/package-store/test/index.ts index bb929579e2..c6890b13f3 100644 --- a/store/package-store/test/index.ts +++ b/store/package-store/test/index.ts @@ -1,9 +1,10 @@ /// import path from 'path' + import { createClient } from '@pnpm/client' import { createPackageStore } from '@pnpm/package-store' -import type { FetchPackageToStoreFunction } from '@pnpm/store-controller-types' import { StoreIndex } from '@pnpm/store.index' +import type { FetchPackageToStoreFunction } from '@pnpm/store-controller-types' import { temporaryDirectory } from 'tempy' describe('store.importPackage()', () => { diff --git a/store/package-store/test/projectRegistry.ts b/store/package-store/test/projectRegistry.ts index 0b2476ab75..f63f36302b 100644 --- a/store/package-store/test/projectRegistry.ts +++ b/store/package-store/test/projectRegistry.ts @@ -1,7 +1,8 @@ /// import { promises as fs } from 'fs' import path from 'path' -import { registerProject, getRegisteredProjects } from '@pnpm/package-store' + +import { getRegisteredProjects, registerProject } from '@pnpm/package-store' import { temporaryDirectory } from 'tempy' describe('projectRegistry', () => { diff --git a/store/pkg-finder/src/index.ts b/store/pkg-finder/src/index.ts index 4e2f37cdb0..3b1a937b06 100644 --- a/store/pkg-finder/src/index.ts +++ b/store/pkg-finder/src/index.ts @@ -1,9 +1,10 @@ import path from 'path' + import { parse } from '@pnpm/dependency-path' import { fetchFromDir } from '@pnpm/directory-fetcher' -import { type StoreIndex, storeIndexKey, gitHostedStoreIndexKey } from '@pnpm/store.index' import type { Resolution } from '@pnpm/resolver-base' import { getFilePathByModeInCafs, type PackageFilesIndex } from '@pnpm/store.cafs' +import { gitHostedStoreIndexKey, type StoreIndex, storeIndexKey } from '@pnpm/store.index' export interface ReadPackageFileMapOptions { storeDir: string diff --git a/store/plugin-commands-store-inspecting/src/catFile.ts b/store/plugin-commands-store-inspecting/src/catFile.ts index cd52b4c919..887d3d2ceb 100644 --- a/store/plugin-commands-store-inspecting/src/catFile.ts +++ b/store/plugin-commands-store-inspecting/src/catFile.ts @@ -5,7 +5,6 @@ import type { Config } from '@pnpm/config' import { PnpmError } from '@pnpm/error' import gfs from '@pnpm/graceful-fs' import { getStorePath } from '@pnpm/store-path' - import { renderHelp } from 'render-help' const INTEGRITY_REGEX: RegExp = /^[^-]+-([a-z0-9+/=]+)$/i diff --git a/store/plugin-commands-store-inspecting/src/catIndex.ts b/store/plugin-commands-store-inspecting/src/catIndex.ts index 21f4b9e098..1722798a87 100644 --- a/store/plugin-commands-store-inspecting/src/catIndex.ts +++ b/store/plugin-commands-store-inspecting/src/catIndex.ts @@ -1,16 +1,15 @@ -import type { Config } from '@pnpm/config' import util from 'util' -import { createResolver } from '@pnpm/client' -import type { TarballResolution } from '@pnpm/lockfile.types' +import { createResolver } from '@pnpm/client' +import type { Config } from '@pnpm/config' import { PnpmError } from '@pnpm/error' +import type { TarballResolution } from '@pnpm/lockfile.types' import { sortDeepKeys } from '@pnpm/object.key-sorting' +import { parseWantedDependency } from '@pnpm/parse-wanted-dependency' +import type { PackageFilesIndex } from '@pnpm/store.cafs' import { StoreIndex, storeIndexKey } from '@pnpm/store.index' import { getStorePath } from '@pnpm/store-path' -import type { PackageFilesIndex } from '@pnpm/store.cafs' -import { parseWantedDependency } from '@pnpm/parse-wanted-dependency' import { lexCompare } from '@pnpm/util.lex-comparator' - import { renderHelp } from 'render-help' export const skipPackageManagerCheck = true diff --git a/store/plugin-commands-store-inspecting/src/findHash.ts b/store/plugin-commands-store-inspecting/src/findHash.ts index 51884193c4..225f7e569e 100644 --- a/store/plugin-commands-store-inspecting/src/findHash.ts +++ b/store/plugin-commands-store-inspecting/src/findHash.ts @@ -1,11 +1,9 @@ -import chalk from 'chalk' - import type { Config } from '@pnpm/config' import { PnpmError } from '@pnpm/error' +import type { PackageFilesIndex } from '@pnpm/store.cafs' import { StoreIndex } from '@pnpm/store.index' import { getStorePath } from '@pnpm/store-path' -import type { PackageFilesIndex } from '@pnpm/store.cafs' - +import chalk from 'chalk' import { renderHelp } from 'render-help' export const PACKAGE_INFO_CLR = chalk.greenBright diff --git a/store/plugin-commands-store-inspecting/src/index.ts b/store/plugin-commands-store-inspecting/src/index.ts index a45b114e80..6a853683eb 100644 --- a/store/plugin-commands-store-inspecting/src/index.ts +++ b/store/plugin-commands-store-inspecting/src/index.ts @@ -1,5 +1,5 @@ -import * as catIndex from './catIndex.js' import * as catFile from './catFile.js' +import * as catIndex from './catIndex.js' import * as findHash from './findHash.js' -export { catIndex, catFile, findHash } +export { catFile, catIndex, findHash } diff --git a/store/plugin-commands-store-inspecting/test/catFile.ts b/store/plugin-commands-store-inspecting/test/catFile.ts index f804dcfb5c..c6bbe28cd5 100644 --- a/store/plugin-commands-store-inspecting/test/catFile.ts +++ b/store/plugin-commands-store-inspecting/test/catFile.ts @@ -1,11 +1,10 @@ /// import path from 'path' -import { prepare } from '@pnpm/prepare' import { getConfig } from '@pnpm/config' -import { catFile } from '@pnpm/plugin-commands-store-inspecting' import type { PnpmError } from '@pnpm/error' - +import { catFile } from '@pnpm/plugin-commands-store-inspecting' +import { prepare } from '@pnpm/prepare' import { safeExeca as execa } from 'execa' const pnpmBin = path.join(import.meta.dirname, '../../../pnpm/bin/pnpm.mjs') diff --git a/store/plugin-commands-store-inspecting/test/catIndex.ts b/store/plugin-commands-store-inspecting/test/catIndex.ts index 8bb510c891..9ae6e57ca5 100644 --- a/store/plugin-commands-store-inspecting/test/catIndex.ts +++ b/store/plugin-commands-store-inspecting/test/catIndex.ts @@ -1,11 +1,10 @@ /// import path from 'path' -import { prepare } from '@pnpm/prepare' import { getConfig } from '@pnpm/config' -import { catIndex } from '@pnpm/plugin-commands-store-inspecting' import type { PnpmError } from '@pnpm/error' - +import { catIndex } from '@pnpm/plugin-commands-store-inspecting' +import { prepare } from '@pnpm/prepare' import { safeExeca as execa } from 'execa' const pnpmBin = path.join(import.meta.dirname, '../../../pnpm/bin/pnpm.mjs') diff --git a/store/plugin-commands-store-inspecting/test/findHash.ts b/store/plugin-commands-store-inspecting/test/findHash.ts index 26ca68853d..1f5728ffd4 100644 --- a/store/plugin-commands-store-inspecting/test/findHash.ts +++ b/store/plugin-commands-store-inspecting/test/findHash.ts @@ -1,11 +1,10 @@ /// import path from 'path' -import { prepare } from '@pnpm/prepare' import { getConfig } from '@pnpm/config' -import { findHash } from '@pnpm/plugin-commands-store-inspecting' import type { PnpmError } from '@pnpm/error' - +import { findHash } from '@pnpm/plugin-commands-store-inspecting' +import { prepare } from '@pnpm/prepare' import { safeExeca as execa } from 'execa' import { temporaryDirectory } from 'tempy' diff --git a/store/plugin-commands-store/src/cleanExpiredDlxCache.test.ts b/store/plugin-commands-store/src/cleanExpiredDlxCache.test.ts index f1b448c4d7..391191b5e3 100644 --- a/store/plugin-commands-store/src/cleanExpiredDlxCache.test.ts +++ b/store/plugin-commands-store/src/cleanExpiredDlxCache.test.ts @@ -1,6 +1,7 @@ import path from 'path' -import { prepareEmpty } from '@pnpm/prepare' + import { jest } from '@jest/globals' +import { prepareEmpty } from '@pnpm/prepare' const fsOriginal = await import('fs') jest.unstable_mockModule('fs', () => ({ diff --git a/store/plugin-commands-store/src/cleanExpiredDlxCache.ts b/store/plugin-commands-store/src/cleanExpiredDlxCache.ts index c7af911f27..5a10859912 100644 --- a/store/plugin-commands-store/src/cleanExpiredDlxCache.ts +++ b/store/plugin-commands-store/src/cleanExpiredDlxCache.ts @@ -1,4 +1,4 @@ -import { readdirSync, type Stats, promises as fs } from 'fs' +import { promises as fs, readdirSync, type Stats } from 'fs' import path from 'path' import util from 'util' diff --git a/store/plugin-commands-store/src/store.ts b/store/plugin-commands-store/src/store.ts index fb1274b9db..f19e42e20c 100644 --- a/store/plugin-commands-store/src/store.ts +++ b/store/plugin-commands-store/src/store.ts @@ -1,11 +1,12 @@ import { docsUrl } from '@pnpm/cli-utils' import { type Config, types as allTypes } from '@pnpm/config' import { PnpmError } from '@pnpm/error' -import { logger, type LogBase } from '@pnpm/logger' +import { type LogBase, logger } from '@pnpm/logger' import { createStoreController, type CreateStoreControllerOptions } from '@pnpm/store-connection-manager' import { getStorePath } from '@pnpm/store-path' import { pick } from 'ramda' import { renderHelp } from 'render-help' + import { storeAdd } from './storeAdd.js' import { storePrune } from './storePrune.js' import { storeStatus } from './storeStatus/index.js' diff --git a/store/plugin-commands-store/src/storeAdd.ts b/store/plugin-commands-store/src/storeAdd.ts index e00e127c7f..4432fcc83f 100644 --- a/store/plugin-commands-store/src/storeAdd.ts +++ b/store/plugin-commands-store/src/storeAdd.ts @@ -1,8 +1,9 @@ import { PnpmError } from '@pnpm/error' -import { logger, globalInfo, streamParser } from '@pnpm/logger' +import { globalInfo, logger, streamParser } from '@pnpm/logger' import { parseWantedDependency } from '@pnpm/parse-wanted-dependency' import type { StoreController } from '@pnpm/store-controller-types' import type { SupportedArchitectures } from '@pnpm/types' + import type { ReporterFunction } from './types.js' export async function storeAdd ( diff --git a/store/plugin-commands-store/src/storePrune.ts b/store/plugin-commands-store/src/storePrune.ts index ffa9ae965b..2d95f0c6d7 100644 --- a/store/plugin-commands-store/src/storePrune.ts +++ b/store/plugin-commands-store/src/storePrune.ts @@ -1,8 +1,9 @@ import { cleanOrphanedInstallDirs } from '@pnpm/global.packages' import { streamParser } from '@pnpm/logger' import type { StoreController } from '@pnpm/store-controller-types' -import type { ReporterFunction } from './types.js' + import { cleanExpiredDlxCache } from './cleanExpiredDlxCache.js' +import type { ReporterFunction } from './types.js' export async function storePrune ( opts: { diff --git a/store/plugin-commands-store/src/storeStatus/extendStoreStatusOptions.ts b/store/plugin-commands-store/src/storeStatus/extendStoreStatusOptions.ts index 5f5c1ebdd0..543023c2d1 100644 --- a/store/plugin-commands-store/src/storeStatus/extendStoreStatusOptions.ts +++ b/store/plugin-commands-store/src/storeStatus/extendStoreStatusOptions.ts @@ -1,6 +1,8 @@ import path from 'path' -import { normalizeRegistries, DEFAULT_REGISTRIES } from '@pnpm/normalize-registries' + +import { DEFAULT_REGISTRIES, normalizeRegistries } from '@pnpm/normalize-registries' import type { Registries } from '@pnpm/types' + import type { ReporterFunction } from '../types.js' export interface StrictStoreStatusOptions { diff --git a/store/plugin-commands-store/src/storeStatus/index.ts b/store/plugin-commands-store/src/storeStatus/index.ts index 2cf0f577c5..5d35423fed 100644 --- a/store/plugin-commands-store/src/storeStatus/index.ts +++ b/store/plugin-commands-store/src/storeStatus/index.ts @@ -1,7 +1,7 @@ import path from 'path' + import { formatIntegrity } from '@pnpm/crypto.integrity' -import type { PackageFilesIndex } from '@pnpm/store.cafs' -import { storeIndexKey, gitHostedStoreIndexKey } from '@pnpm/store.index' +import * as dp from '@pnpm/dependency-path' import { getContextForSingleImporter } from '@pnpm/get-context' import { nameVerFromPkgSnapshot, @@ -9,16 +9,18 @@ import { type PackageSnapshot, } from '@pnpm/lockfile.utils' import { streamParser } from '@pnpm/logger' -import * as dp from '@pnpm/dependency-path' +import type { PackageFilesIndex } from '@pnpm/store.cafs' +import { gitHostedStoreIndexKey, storeIndexKey } from '@pnpm/store.index' import { StoreIndex } from '@pnpm/store.index' +import type { TarballResolution } from '@pnpm/store-controller-types' import type { DepPath } from '@pnpm/types' import dint from 'dint' import pFilter from 'p-filter' + import { extendStoreStatusOptions, type StoreStatusOptions, } from './extendStoreStatusOptions.js' -import type { TarballResolution } from '@pnpm/store-controller-types' export async function storeStatus (maybeOpts: StoreStatusOptions): Promise { const reporter = maybeOpts?.reporter diff --git a/store/plugin-commands-store/test/storeAdd.ts b/store/plugin-commands-store/test/storeAdd.ts index f7b50ffb8a..c6e4b9356a 100644 --- a/store/plugin-commands-store/test/storeAdd.ts +++ b/store/plugin-commands-store/test/storeAdd.ts @@ -1,5 +1,6 @@ import fs from 'fs' import path from 'path' + import { assertStore } from '@pnpm/assert-store' import { STORE_VERSION } from '@pnpm/constants' import { store } from '@pnpm/plugin-commands-store' diff --git a/store/plugin-commands-store/test/storePath.ts b/store/plugin-commands-store/test/storePath.ts index 64b0bdb707..1c63689102 100644 --- a/store/plugin-commands-store/test/storePath.ts +++ b/store/plugin-commands-store/test/storePath.ts @@ -1,5 +1,6 @@ import os from 'os' import path from 'path' + import { STORE_VERSION } from '@pnpm/constants' import { store } from '@pnpm/plugin-commands-store' import { prepare } from '@pnpm/prepare' diff --git a/store/plugin-commands-store/test/storePrune.ts b/store/plugin-commands-store/test/storePrune.ts index fdc1180656..5ee35aa993 100644 --- a/store/plugin-commands-store/test/storePrune.ts +++ b/store/plugin-commands-store/test/storePrune.ts @@ -1,5 +1,7 @@ import fs from 'fs' import path from 'path' + +import { jest } from '@jest/globals' import { assertStore } from '@pnpm/assert-store' import { STORE_VERSION } from '@pnpm/constants' import { dlx } from '@pnpm/plugin-commands-script-runners' @@ -7,7 +9,6 @@ import { store } from '@pnpm/plugin-commands-store' import { prepare, prepareEmpty } from '@pnpm/prepare' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { rimrafSync } from '@zkochan/rimraf' -import { jest } from '@jest/globals' import { safeExeca as execa } from 'execa' const REGISTRY = `http://localhost:${REGISTRY_MOCK_PORT}/` diff --git a/store/plugin-commands-store/test/storeStatus.ts b/store/plugin-commands-store/test/storeStatus.ts index f38818e87b..9243bbe706 100644 --- a/store/plugin-commands-store/test/storeStatus.ts +++ b/store/plugin-commands-store/test/storeStatus.ts @@ -1,5 +1,6 @@ import fs from 'fs' import path from 'path' + import type { PnpmError } from '@pnpm/error' import { store } from '@pnpm/plugin-commands-store' import { prepare } from '@pnpm/prepare' diff --git a/store/store-connection-manager/src/createNewStoreController.ts b/store/store-connection-manager/src/createNewStoreController.ts index 867efe2431..bfbeab3fa2 100644 --- a/store/store-connection-manager/src/createNewStoreController.ts +++ b/store/store-connection-manager/src/createNewStoreController.ts @@ -1,8 +1,9 @@ import { promises as fs } from 'fs' -import { createClient, type ClientOptions } from '@pnpm/client' -import type { Config } from '@pnpm/config' -import { createPackageStore, type CafsLocker, type StoreController } from '@pnpm/package-store' + import { packageManager } from '@pnpm/cli-meta' +import { type ClientOptions, createClient } from '@pnpm/client' +import type { Config } from '@pnpm/config' +import { type CafsLocker, createPackageStore, type StoreController } from '@pnpm/package-store' import { StoreIndex } from '@pnpm/store.index' type CreateResolverOptions = Pick { diff --git a/testing/temp-store/src/index.ts b/testing/temp-store/src/index.ts index 6ff6f6de24..a4be98bfd6 100644 --- a/testing/temp-store/src/index.ts +++ b/testing/temp-store/src/index.ts @@ -1,9 +1,10 @@ import * as path from 'path' + import { type ClientOptions, createClient } from '@pnpm/client' import { createPackageStore, type CreatePackageStoreOptions } from '@pnpm/package-store' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' -import type { StoreController } from '@pnpm/store-controller-types' import { StoreIndex } from '@pnpm/store.index' +import type { StoreController } from '@pnpm/store-controller-types' const registry = `http://localhost:${REGISTRY_MOCK_PORT}/` diff --git a/text/comments-parser/src/extractComments.ts b/text/comments-parser/src/extractComments.ts index eaa56b5ae5..a4cdcfeac4 100644 --- a/text/comments-parser/src/extractComments.ts +++ b/text/comments-parser/src/extractComments.ts @@ -1,4 +1,5 @@ import { parseString, stripComments } from 'strip-comments-strings' + import type { CommentSpecifier } from './CommentSpecifier.js' interface ExtractedComments { diff --git a/text/comments-parser/src/index.ts b/text/comments-parser/src/index.ts index 89db3bdbf6..79970925c1 100644 --- a/text/comments-parser/src/index.ts +++ b/text/comments-parser/src/index.ts @@ -1,3 +1,3 @@ +export * from './CommentSpecifier.js' export * from './extractComments.js' export * from './insertComments.js' -export * from './CommentSpecifier.js' diff --git a/tools/plugin-commands-self-updater/src/installPnpm.ts b/tools/plugin-commands-self-updater/src/installPnpm.ts index 381947d4a1..20b7aa8d87 100644 --- a/tools/plugin-commands-self-updater/src/installPnpm.ts +++ b/tools/plugin-commands-self-updater/src/installPnpm.ts @@ -1,6 +1,7 @@ import fs from 'fs' import path from 'path' import util from 'util' + import { iterateHashedGraphNodes, iteratePkgMeta, diff --git a/tools/plugin-commands-self-updater/src/selfUpdate.ts b/tools/plugin-commands-self-updater/src/selfUpdate.ts index 02b24accee..1d812f2ff3 100644 --- a/tools/plugin-commands-self-updater/src/selfUpdate.ts +++ b/tools/plugin-commands-self-updater/src/selfUpdate.ts @@ -1,19 +1,21 @@ import path from 'path' + +import { isExecutedByCorepack, packageManager } from '@pnpm/cli-meta' import { docsUrl } from '@pnpm/cli-utils' -import { packageManager, isExecutedByCorepack } from '@pnpm/cli-meta' import { createResolver } from '@pnpm/client' import { type Config, types as allTypes } from '@pnpm/config' import { resolvePackageManagerIntegrities } from '@pnpm/config.deps-installer' import { PnpmError } from '@pnpm/error' import { linkBins } from '@pnpm/link-bins' import { globalWarn } from '@pnpm/logger' +import { whichVersionIsPinned } from '@pnpm/npm-resolver' import { readProjectManifest } from '@pnpm/read-project-manifest' import { createStoreController, type CreateStoreControllerOptions } from '@pnpm/store-connection-manager' -import { whichVersionIsPinned } from '@pnpm/npm-resolver' import type { PinnedVersion } from '@pnpm/types' import { pick } from 'ramda' -import semver from 'semver' import { renderHelp } from 'render-help' +import semver from 'semver' + import { installPnpm } from './installPnpm.js' export function rcOptionsTypes (): Record { diff --git a/tools/plugin-commands-self-updater/test/selfUpdate.test.ts b/tools/plugin-commands-self-updater/test/selfUpdate.test.ts index 201d393b8d..ba06d68155 100644 --- a/tools/plugin-commands-self-updater/test/selfUpdate.test.ts +++ b/tools/plugin-commands-self-updater/test/selfUpdate.test.ts @@ -1,9 +1,10 @@ import fs from 'fs' import { createRequire } from 'module' import path from 'path' -import { prependDirsToPath } from '@pnpm/env.path' -import { tempDir, prepare as prepareWithPkg } from '@pnpm/prepare' + import { jest } from '@jest/globals' +import { prependDirsToPath } from '@pnpm/env.path' +import { prepare as prepareWithPkg, tempDir } from '@pnpm/prepare' import spawn from 'cross-spawn' import nock from 'nock' diff --git a/worker/src/index.ts b/worker/src/index.ts index cd0b7fbbe3..8ea35ffb07 100644 --- a/worker/src/index.ts +++ b/worker/src/index.ts @@ -1,21 +1,23 @@ // cspell:ignore checkin -import path from 'path' -import os from 'os' -import { WorkerPool } from '@rushstack/worker-pool' -import { PnpmError } from '@pnpm/error' import { execSync } from 'child_process' -import isWindows from 'is-windows' -import type { PackageFilesResponse, FilesMap } from '@pnpm/cafs-types' -import type { BundledManifest } from '@pnpm/types' -import pLimit from 'p-limit' +import os from 'os' +import path from 'path' + +import type { FilesMap, PackageFilesResponse } from '@pnpm/cafs-types' +import { PnpmError } from '@pnpm/error' import { globalWarn } from '@pnpm/logger' import type { StoreIndex } from '@pnpm/store.index' +import type { BundledManifest } from '@pnpm/types' +import { WorkerPool } from '@rushstack/worker-pool' +import isWindows from 'is-windows' +import pLimit from 'p-limit' + import type { - TarballExtractMessage, AddDirToStoreMessage, + HardLinkDirMessage, LinkPkgMessage, SymlinkAllModulesMessage, - HardLinkDirMessage, + TarballExtractMessage, } from './types.js' let workerPool: WorkerPool | undefined diff --git a/worker/src/start.ts b/worker/src/start.ts index 7ee72e68c6..4fb1dfd451 100644 --- a/worker/src/start.ts +++ b/worker/src/start.ts @@ -1,36 +1,38 @@ import crypto from 'crypto' -import path from 'path' import fs from 'fs' +import path from 'path' +import { parentPort } from 'worker_threads' + import { pkgRequiresBuild } from '@pnpm/building.pkg-requires-build' -import type { Cafs, PackageFiles, SideEffectsDiff, FilesMap } from '@pnpm/cafs-types' +import type { Cafs, FilesMap, PackageFiles, SideEffectsDiff } from '@pnpm/cafs-types' import { createCafsStore } from '@pnpm/create-cafs-store' import { formatIntegrity, parseIntegrity } from '@pnpm/crypto.integrity' import { PnpmError } from '@pnpm/error' import { hardLinkDir } from '@pnpm/fs.hard-link-dir' -import { StoreIndex, packForStorage } from '@pnpm/store.index' import { + buildFileMapsFromIndex, type CafsFunctions, checkPkgFilesIntegrity, - buildFileMapsFromIndex, createCafs, + type FilesIndex, HASH_ALGORITHM, normalizeBundledManifest, type PackageFilesIndex, - type FilesIndex, type VerifyResult, } from '@pnpm/store.cafs' +import { packForStorage, StoreIndex } from '@pnpm/store.index' import { symlinkDependencySync } from '@pnpm/symlink-dependency' import type { BundledManifest, DependencyManifest } from '@pnpm/types' -import { parentPort } from 'worker_threads' + import { equalOrSemverEqual } from './equalOrSemverEqual.js' import type { AddDirToStoreMessage, - ReadPkgFromCafsMessage, - LinkPkgMessage, - SymlinkAllModulesMessage, - TarballExtractMessage, HardLinkDirMessage, InitStoreMessage, + LinkPkgMessage, + ReadPkgFromCafsMessage, + SymlinkAllModulesMessage, + TarballExtractMessage, } from './types.js' export function startWorker (): void { diff --git a/workspace/filter-packages-from-dir/src/index.ts b/workspace/filter-packages-from-dir/src/index.ts index cd27dd6ba9..334f97cd37 100644 --- a/workspace/filter-packages-from-dir/src/index.ts +++ b/workspace/filter-packages-from-dir/src/index.ts @@ -1,7 +1,7 @@ +import { filterPkgsBySelectorObjects, type PackageSelector, type ReadProjectsResult } from '@pnpm/filter-workspace-packages' import type { SupportedArchitectures } from '@pnpm/types' import { findWorkspacePackages } from '@pnpm/workspace.find-packages' import { readWorkspaceManifest } from '@pnpm/workspace.read-manifest' -import { filterPkgsBySelectorObjects, type PackageSelector, type ReadProjectsResult } from '@pnpm/filter-workspace-packages' export async function filterPackagesFromDir ( workspaceDir: string, diff --git a/workspace/filter-workspace-packages/src/getChangedPackages.ts b/workspace/filter-workspace-packages/src/getChangedPackages.ts index 90a2a1bb45..fcd955a610 100644 --- a/workspace/filter-workspace-packages/src/getChangedPackages.ts +++ b/workspace/filter-workspace-packages/src/getChangedPackages.ts @@ -1,11 +1,12 @@ import assert from 'assert' import path from 'path' import util from 'util' + import { PnpmError } from '@pnpm/error' -import * as micromatch from 'micromatch' +import type { ProjectRootDir } from '@pnpm/types' import { safeExeca as execa } from 'execa' import { findUp } from 'find-up' -import type { ProjectRootDir } from '@pnpm/types' +import * as micromatch from 'micromatch' type ChangeType = 'source' | 'test' diff --git a/workspace/filter-workspace-packages/src/index.ts b/workspace/filter-workspace-packages/src/index.ts index a47a13bff1..0134e58c2c 100644 --- a/workspace/filter-workspace-packages/src/index.ts +++ b/workspace/filter-workspace-packages/src/index.ts @@ -3,12 +3,13 @@ import type { ProjectRootDir, SupportedArchitectures } from '@pnpm/types' import { findWorkspacePackages, type Project } from '@pnpm/workspace.find-packages' import { createPkgGraph, type Package, type PackageNode } from '@pnpm/workspace.pkgs-graph' import { isSubdir } from 'is-subdir' -import { difference, partition, pick } from 'ramda' import * as micromatch from 'micromatch' -import { getChangedPackages } from './getChangedPackages.js' -import { parsePackageSelector, type PackageSelector } from './parsePackageSelector.js' +import { difference, partition, pick } from 'ramda' -export { parsePackageSelector, type PackageSelector } +import { getChangedPackages } from './getChangedPackages.js' +import { type PackageSelector, parsePackageSelector } from './parsePackageSelector.js' + +export { type PackageSelector, parsePackageSelector } export interface WorkspaceFilter { filter: string diff --git a/workspace/filter-workspace-packages/test/index.ts b/workspace/filter-workspace-packages/test/index.ts index 34f99e99dc..d628b8a388 100644 --- a/workspace/filter-workspace-packages/test/index.ts +++ b/workspace/filter-workspace-packages/test/index.ts @@ -1,18 +1,20 @@ +import fs from 'fs' +import path from 'path' import { promisify } from 'util' + import type { PnpmError } from '@pnpm/error' import { filterWorkspacePackages, type PackageGraph } from '@pnpm/filter-workspace-packages' -import type { Package } from '@pnpm/workspace.pkgs-graph' import type { ProjectRootDir } from '@pnpm/types' -import './parsePackageSelector.js' -import fs from 'fs' -import { safeExeca as execa } from 'execa' +import type { Package } from '@pnpm/workspace.pkgs-graph' import { isCI } from 'ci-info' +import { safeExeca as execa } from 'execa' import isWindows from 'is-windows' -import path from 'path' import { omit } from 'ramda' import { temporaryDirectory } from 'tempy' import touchCB from 'touch' +import './parsePackageSelector.js' + const touch = promisify(touchCB) const mkdir = promisify(fs.mkdir) diff --git a/workspace/filter-workspace-packages/test/parsePackageSelector.ts b/workspace/filter-workspace-packages/test/parsePackageSelector.ts index 9141fb202b..77e18fac70 100644 --- a/workspace/filter-workspace-packages/test/parsePackageSelector.ts +++ b/workspace/filter-workspace-packages/test/parsePackageSelector.ts @@ -1,4 +1,5 @@ import path from 'path' + import { type PackageSelector, parsePackageSelector } from '@pnpm/filter-workspace-packages' import isWindows from 'is-windows' diff --git a/workspace/find-packages/src/index.ts b/workspace/find-packages/src/index.ts index 419bc2bee1..aefe8cbc5a 100644 --- a/workspace/find-packages/src/index.ts +++ b/workspace/find-packages/src/index.ts @@ -1,8 +1,8 @@ import { packageIsInstallable } from '@pnpm/cli-utils' -import type { ProjectManifest, Project, SupportedArchitectures } from '@pnpm/types' -import { lexCompare } from '@pnpm/util.lex-comparator' import { findPackages } from '@pnpm/fs.find-packages' import { logger } from '@pnpm/logger' +import type { Project, ProjectManifest, SupportedArchitectures } from '@pnpm/types' +import { lexCompare } from '@pnpm/util.lex-comparator' export type { Project } diff --git a/workspace/find-packages/test/index.ts b/workspace/find-packages/test/index.ts index eb030dd7ca..87c0e03ca7 100644 --- a/workspace/find-packages/test/index.ts +++ b/workspace/find-packages/test/index.ts @@ -1,11 +1,12 @@ import path from 'path' + +import { jest } from '@jest/globals' +import { logger } from '@pnpm/logger' import { - findWorkspacePackagesNoCheck, findWorkspacePackages, + findWorkspacePackagesNoCheck, } from '@pnpm/workspace.find-packages' import { readWorkspaceManifest } from '@pnpm/workspace.read-manifest' -import { logger } from '@pnpm/logger' -import { jest } from '@jest/globals' beforeEach(() => { jest.spyOn(logger, 'warn') diff --git a/workspace/find-workspace-dir/src/index.ts b/workspace/find-workspace-dir/src/index.ts index 55b5b68df8..dbac08dee5 100644 --- a/workspace/find-workspace-dir/src/index.ts +++ b/workspace/find-workspace-dir/src/index.ts @@ -1,5 +1,6 @@ import fs from 'fs' import path from 'path' + import { PnpmError } from '@pnpm/error' import { findUp } from 'find-up' diff --git a/workspace/find-workspace-dir/test/index.ts b/workspace/find-workspace-dir/test/index.ts index e7d0d302aa..3fdd2e8d16 100644 --- a/workspace/find-workspace-dir/test/index.ts +++ b/workspace/find-workspace-dir/test/index.ts @@ -1,6 +1,7 @@ /// -import path from 'path' import fs from 'fs' +import path from 'path' + import { findWorkspaceDir } from '@pnpm/find-workspace-dir' const NPM_CONFIG_WORKSPACE_DIR_ENV_VAR = 'NPM_CONFIG_WORKSPACE_DIR' diff --git a/workspace/injected-deps-syncer/src/DirPatcher.ts b/workspace/injected-deps-syncer/src/DirPatcher.ts index a0a455fb4b..20867f3e97 100644 --- a/workspace/injected-deps-syncer/src/DirPatcher.ts +++ b/workspace/injected-deps-syncer/src/DirPatcher.ts @@ -1,7 +1,8 @@ import fs from 'fs' import path from 'path' import util from 'util' -import { type FetchFromDirOptions, fetchFromDir } from '@pnpm/directory-fetcher' + +import { fetchFromDir, type FetchFromDirOptions } from '@pnpm/directory-fetcher' import { PnpmError } from '@pnpm/error' export const DIR: unique symbol = Symbol('Path is a directory') diff --git a/workspace/injected-deps-syncer/src/index.ts b/workspace/injected-deps-syncer/src/index.ts index a35ebb5073..b98e173812 100644 --- a/workspace/injected-deps-syncer/src/index.ts +++ b/workspace/injected-deps-syncer/src/index.ts @@ -1,4 +1,5 @@ import path from 'path' + import { PnpmError } from '@pnpm/error' import { linkBins, linkBinsOfPackages } from '@pnpm/link-bins' import { logger as createLogger } from '@pnpm/logger' @@ -7,6 +8,7 @@ import { safeReadPackageJsonFromDir } from '@pnpm/read-package-json' import type { DependencyManifest } from '@pnpm/types' import { findWorkspacePackagesNoCheck } from '@pnpm/workspace.find-packages' import normalizePath from 'normalize-path' + import { DirPatcher } from './DirPatcher.js' interface SkipSyncInjectedDepsMessage { diff --git a/workspace/injected-deps-syncer/test/DirPatcher.test.ts b/workspace/injected-deps-syncer/test/DirPatcher.test.ts index 423ab73f8c..320d3e73d3 100644 --- a/workspace/injected-deps-syncer/test/DirPatcher.test.ts +++ b/workspace/injected-deps-syncer/test/DirPatcher.test.ts @@ -1,9 +1,11 @@ import fs from 'fs' import path from 'path' + +import { jest } from '@jest/globals' import { fetchFromDir } from '@pnpm/directory-fetcher' import { prepareEmpty } from '@pnpm/prepare' -import { jest } from '@jest/globals' import { lexCompare } from '@pnpm/util.lex-comparator' + import { DirPatcher } from '../src/DirPatcher.js' const originalRm = fs.promises.rm diff --git a/workspace/injected-deps-syncer/test/applyPatch.test.ts b/workspace/injected-deps-syncer/test/applyPatch.test.ts index 2858f8a650..dd0980a272 100644 --- a/workspace/injected-deps-syncer/test/applyPatch.test.ts +++ b/workspace/injected-deps-syncer/test/applyPatch.test.ts @@ -1,10 +1,12 @@ import fs from 'fs' import path from 'path' + +import { jest } from '@jest/globals' import { fetchFromDir } from '@pnpm/directory-fetcher' import { prepareEmpty } from '@pnpm/prepare' -import { jest } from '@jest/globals' import { lexCompare } from '@pnpm/util.lex-comparator' -import { type DirDiff, DIR, applyPatch } from '../src/DirPatcher.js' + +import { applyPatch, DIR, type DirDiff } from '../src/DirPatcher.js' const originalRm = fs.promises.rm const originalMkdir = fs.promises.mkdir diff --git a/workspace/injected-deps-syncer/test/diffDir.test.ts b/workspace/injected-deps-syncer/test/diffDir.test.ts index 2c1adb4ee6..5bb003e4f0 100644 --- a/workspace/injected-deps-syncer/test/diffDir.test.ts +++ b/workspace/injected-deps-syncer/test/diffDir.test.ts @@ -1,4 +1,4 @@ -import { type DirDiff, type InodeMap, DIR, diffDir } from '../src/DirPatcher.js' +import { diffDir, DIR, type DirDiff, type InodeMap } from '../src/DirPatcher.js' test('produces a diff', () => { const unchangedParts = { diff --git a/workspace/injected-deps-syncer/test/extendFilesMap.test.ts b/workspace/injected-deps-syncer/test/extendFilesMap.test.ts index f583f238a5..254a372394 100644 --- a/workspace/injected-deps-syncer/test/extendFilesMap.test.ts +++ b/workspace/injected-deps-syncer/test/extendFilesMap.test.ts @@ -1,8 +1,10 @@ import fs from 'fs' import path from 'path' -import { prepareEmpty } from '@pnpm/prepare' + import { jest } from '@jest/globals' -import { type InodeMap, type ExtendFilesMapStats, DIR, extendFilesMap } from '../src/DirPatcher.js' +import { prepareEmpty } from '@pnpm/prepare' + +import { DIR, extendFilesMap, type ExtendFilesMapStats, type InodeMap } from '../src/DirPatcher.js' const originalStat = fs.promises.stat diff --git a/workspace/manifest-writer/src/index.ts b/workspace/manifest-writer/src/index.ts index c577e01367..4ea109246d 100644 --- a/workspace/manifest-writer/src/index.ts +++ b/workspace/manifest-writer/src/index.ts @@ -1,18 +1,19 @@ import fs from 'fs' import path from 'path' import util from 'util' + import type { Catalogs } from '@pnpm/catalogs.types' -import type { ResolvedCatalogEntry } from '@pnpm/lockfile.types' -import { validateWorkspaceManifest, type WorkspaceManifest } from '@pnpm/workspace.read-manifest' import { type GLOBAL_CONFIG_YAML_FILENAME, WORKSPACE_MANIFEST_FILENAME } from '@pnpm/constants' -import { patchDocument } from '@pnpm/yaml.document-sync' -import { equals } from 'ramda' -import yaml from 'yaml' -import writeFileAtomic from 'write-file-atomic' +import type { ResolvedCatalogEntry } from '@pnpm/lockfile.types' import { sortKeysByPriority } from '@pnpm/object.key-sorting' import type { Project, } from '@pnpm/types' +import { validateWorkspaceManifest, type WorkspaceManifest } from '@pnpm/workspace.read-manifest' +import { patchDocument } from '@pnpm/yaml.document-sync' +import { equals } from 'ramda' +import writeFileAtomic from 'write-file-atomic' +import yaml from 'yaml' export type FileName = | typeof GLOBAL_CONFIG_YAML_FILENAME diff --git a/workspace/manifest-writer/test/addCatalogs.test.ts b/workspace/manifest-writer/test/addCatalogs.test.ts index 02208346e7..21eeca6d8a 100644 --- a/workspace/manifest-writer/test/addCatalogs.test.ts +++ b/workspace/manifest-writer/test/addCatalogs.test.ts @@ -1,5 +1,6 @@ import fs from 'fs' import path from 'path' + import { WORKSPACE_MANIFEST_FILENAME } from '@pnpm/constants' import { tempDir } from '@pnpm/prepare-temp-dir' import { updateWorkspaceManifest } from '@pnpm/workspace.manifest-writer' diff --git a/workspace/manifest-writer/test/removeCatalogs.test.ts b/workspace/manifest-writer/test/removeCatalogs.test.ts index b431152e7c..66640ea5c9 100644 --- a/workspace/manifest-writer/test/removeCatalogs.test.ts +++ b/workspace/manifest-writer/test/removeCatalogs.test.ts @@ -1,12 +1,13 @@ -import path from 'path' import fs from 'fs' +import path from 'path' + import { WORKSPACE_MANIFEST_FILENAME } from '@pnpm/constants' -import { tempDir } from '@pnpm/prepare-temp-dir' +import { findPackages } from '@pnpm/fs.find-packages' import { prepare } from '@pnpm/prepare' +import { tempDir } from '@pnpm/prepare-temp-dir' import { updateWorkspaceManifest } from '@pnpm/workspace.manifest-writer' import { readYamlFileSync } from 'read-yaml-file' import { writeYamlFileSync } from 'write-yaml-file' -import { findPackages } from '@pnpm/fs.find-packages' test('remove the default catalog if it is empty', async () => { const dir = tempDir(false) diff --git a/workspace/manifest-writer/test/updateWorkspaceManifest.test.ts b/workspace/manifest-writer/test/updateWorkspaceManifest.test.ts index 515f695b90..5c71fb555d 100644 --- a/workspace/manifest-writer/test/updateWorkspaceManifest.test.ts +++ b/workspace/manifest-writer/test/updateWorkspaceManifest.test.ts @@ -1,5 +1,6 @@ import fs from 'fs' import path from 'path' + import { WORKSPACE_MANIFEST_FILENAME } from '@pnpm/constants' import { tempDir } from '@pnpm/prepare-temp-dir' import { updateWorkspaceManifest } from '@pnpm/workspace.manifest-writer' diff --git a/workspace/pkgs-graph/src/index.ts b/workspace/pkgs-graph/src/index.ts index b02339a403..b3f1127e6c 100644 --- a/workspace/pkgs-graph/src/index.ts +++ b/workspace/pkgs-graph/src/index.ts @@ -1,8 +1,9 @@ import path from 'path' + import npa from '@pnpm/npm-package-arg' -import { resolveWorkspaceRange } from '@pnpm/resolve-workspace-range' import { parseBareSpecifier, workspacePrefToNpm } from '@pnpm/npm-resolver' -import type { ProjectRootDir, BaseManifest } from '@pnpm/types' +import { resolveWorkspaceRange } from '@pnpm/resolve-workspace-range' +import type { BaseManifest, ProjectRootDir } from '@pnpm/types' import { map as mapValues } from 'ramda' export interface Package { diff --git a/workspace/read-manifest/src/index.ts b/workspace/read-manifest/src/index.ts index 917ec51574..fb1d63dbb1 100644 --- a/workspace/read-manifest/src/index.ts +++ b/workspace/read-manifest/src/index.ts @@ -1,8 +1,10 @@ +import path from 'node:path' import util from 'util' + import { type GLOBAL_CONFIG_YAML_FILENAME, WORKSPACE_MANIFEST_FILENAME } from '@pnpm/constants' import type { PnpmSettings } from '@pnpm/types' -import path from 'node:path' import { readYamlFile } from 'read-yaml-file' + import { assertValidWorkspaceManifestCatalog, assertValidWorkspaceManifestCatalogs, diff --git a/workspace/read-manifest/test/index.ts b/workspace/read-manifest/test/index.ts index 6bd53cb6f7..5b28fdeeaf 100644 --- a/workspace/read-manifest/test/index.ts +++ b/workspace/read-manifest/test/index.ts @@ -1,6 +1,7 @@ -import { readWorkspaceManifest } from '@pnpm/workspace.read-manifest' import path from 'node:path' +import { readWorkspaceManifest } from '@pnpm/workspace.read-manifest' + test('readWorkspaceManifest() works with a valid workspace file', async () => { const manifest = await readWorkspaceManifest(path.join(import.meta.dirname, '__fixtures__/ok')) diff --git a/workspace/sort-packages/src/index.ts b/workspace/sort-packages/src/index.ts index bcad7885f9..b79654761b 100644 --- a/workspace/sort-packages/src/index.ts +++ b/workspace/sort-packages/src/index.ts @@ -1,6 +1,6 @@ -import type { ProjectRootDir, ProjectsGraph } from '@pnpm/types' -import { graphSequencer } from '@pnpm/deps.graph-sequencer' import type { Result as GraphSequencerResult } from '@pnpm/deps.graph-sequencer' +import { graphSequencer } from '@pnpm/deps.graph-sequencer' +import type { ProjectRootDir, ProjectsGraph } from '@pnpm/types' export function sequenceGraph (pkgGraph: ProjectsGraph): GraphSequencerResult { const keys = Object.keys(pkgGraph) as ProjectRootDir[] diff --git a/workspace/state/src/createWorkspaceState.ts b/workspace/state/src/createWorkspaceState.ts index 1a49de1f84..76893bb295 100644 --- a/workspace/state/src/createWorkspaceState.ts +++ b/workspace/state/src/createWorkspaceState.ts @@ -1,6 +1,7 @@ -import { pick } from 'ramda' import type { ConfigDependencies } from '@pnpm/types' -import { WORKSPACE_STATE_SETTING_KEYS, type WorkspaceState, type WorkspaceStateSettings, type ProjectsList } from './types.js' +import { pick } from 'ramda' + +import { type ProjectsList, WORKSPACE_STATE_SETTING_KEYS, type WorkspaceState, type WorkspaceStateSettings } from './types.js' export interface CreateWorkspaceStateOptions { allProjects: ProjectsList diff --git a/workspace/state/src/index.ts b/workspace/state/src/index.ts index 78e0e95c5d..fdc443a7af 100644 --- a/workspace/state/src/index.ts +++ b/workspace/state/src/index.ts @@ -1,3 +1,3 @@ export { loadWorkspaceState } from './loadWorkspaceState.js' -export { type UpdateWorkspaceStateOptions, updateWorkspaceState } from './updateWorkspaceState.js' -export { WORKSPACE_STATE_SETTING_KEYS, type WorkspaceState, type WorkspaceStateSettings, type ProjectsList } from './types.js' +export { type ProjectsList, WORKSPACE_STATE_SETTING_KEYS, type WorkspaceState, type WorkspaceStateSettings } from './types.js' +export { updateWorkspaceState, type UpdateWorkspaceStateOptions } from './updateWorkspaceState.js' diff --git a/workspace/state/src/loadWorkspaceState.ts b/workspace/state/src/loadWorkspaceState.ts index 4b3c3749f9..a9668e369c 100644 --- a/workspace/state/src/loadWorkspaceState.ts +++ b/workspace/state/src/loadWorkspaceState.ts @@ -1,6 +1,8 @@ import fs from 'fs' import util from 'util' + import { logger } from '@pnpm/logger' + import { getFilePath } from './filePath.js' import type { WorkspaceState } from './types.js' diff --git a/workspace/state/src/updateWorkspaceState.ts b/workspace/state/src/updateWorkspaceState.ts index 79f118ba81..fc10bd63f8 100644 --- a/workspace/state/src/updateWorkspaceState.ts +++ b/workspace/state/src/updateWorkspaceState.ts @@ -1,10 +1,12 @@ import fs from 'fs' import path from 'path' + import { logger } from '@pnpm/logger' import type { ConfigDependencies } from '@pnpm/types' -import { getFilePath } from './filePath.js' + import { createWorkspaceState } from './createWorkspaceState.js' -import type { WorkspaceStateSettings, ProjectsList } from './types.js' +import { getFilePath } from './filePath.js' +import type { ProjectsList, WorkspaceStateSettings } from './types.js' export interface UpdateWorkspaceStateOptions { allProjects: ProjectsList diff --git a/workspace/state/test/createWorkspaceState.test.ts b/workspace/state/test/createWorkspaceState.test.ts index b59f02a4ea..d1d95da7cc 100644 --- a/workspace/state/test/createWorkspaceState.test.ts +++ b/workspace/state/test/createWorkspaceState.test.ts @@ -1,6 +1,8 @@ import path from 'path' + import { prepareEmpty, preparePackages } from '@pnpm/prepare' import type { ProjectRootDir } from '@pnpm/types' + import { createWorkspaceState } from '../src/createWorkspaceState.js' test('createWorkspaceState() on empty list', () => { diff --git a/workspace/state/test/filePath.test.ts b/workspace/state/test/filePath.test.ts index 5b1d57ed41..2c767f1c70 100644 --- a/workspace/state/test/filePath.test.ts +++ b/workspace/state/test/filePath.test.ts @@ -1,5 +1,7 @@ import path from 'path' + import { prepareEmpty } from '@pnpm/prepare' + import { getFilePath } from '../src/filePath.js' test('getFilePath()', () => { diff --git a/workspace/state/test/loadWorkspaceState.test.ts b/workspace/state/test/loadWorkspaceState.test.ts index e5d4e8f8cd..b80faf324a 100644 --- a/workspace/state/test/loadWorkspaceState.test.ts +++ b/workspace/state/test/loadWorkspaceState.test.ts @@ -1,11 +1,13 @@ -import path from 'path' import fs from 'fs' -import { logger } from '@pnpm/logger' -import type { ProjectRootDir } from '@pnpm/types' -import { prepareEmpty } from '@pnpm/prepare' +import path from 'path' + import { jest } from '@jest/globals' +import { logger } from '@pnpm/logger' +import { prepareEmpty } from '@pnpm/prepare' +import type { ProjectRootDir } from '@pnpm/types' + import { getFilePath } from '../src/filePath.js' -import { type WorkspaceState, loadWorkspaceState } from '../src/index.js' +import { loadWorkspaceState, type WorkspaceState } from '../src/index.js' const lastValidatedTimestamp = Date.now() diff --git a/workspace/state/test/updatePackagesList.test.ts b/workspace/state/test/updatePackagesList.test.ts index cdd4fcc75f..f8180dc651 100644 --- a/workspace/state/test/updatePackagesList.test.ts +++ b/workspace/state/test/updatePackagesList.test.ts @@ -1,8 +1,10 @@ import path from 'path' + +import { jest } from '@jest/globals' import { logger } from '@pnpm/logger' import { preparePackages } from '@pnpm/prepare' import type { ProjectRootDir } from '@pnpm/types' -import { jest } from '@jest/globals' + import { loadWorkspaceState, updateWorkspaceState } from '../src/index.js' const originalLoggerDebug = logger.debug